GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Docs.rs
  • rustpython-parser-0.4.0
  • Permalink
  • Docs.rs crate page
  • MIT
  • Repository
  • crates.io
  • Source
  • coolreader18
  • windelbouwman
  • github:rustpython:packaging
  • is-macro ^0.3.0 normal
  • itertools ^0.11.0 normal
  • lalrpop-util ^0.20.0 normal

This view

  • Original page
  • New address

GeezerVison is showing docs.rs โ€” parse_program in rustpython_parser - Rust

rustpython_parser

Function parse_program 

Source
pub fn parse_program(
    source: &str,
    source_path: &str,
) -> Result<Suite, ParseError>
๐Ÿ‘ŽDeprecated:

Use ast::Suite::parse from rustpython_parser::Parse trait.

Expand description

Parse a full Python program usually consisting of multiple lines.

This is a convenience function that can be used to parse a full Python program without having to specify the Mode or the location. It is probably what you want to use most of the time.

ยงExample

For example, parsing a simple function definition and a call to that function:

use rustpython_parser as parser;
let source = r#"
def foo():
   return 42

print(foo())
"#;
let program = parser::parse_program(source, "<embedded>");
assert!(program.is_ok());
You are visitor 01402503 โ€” GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800ร—600. No cookies required.