mirror of
https://github.com/RustPython/Parser.git
synced 2025-08-04 10:49:55 +00:00
Parse Trait (#71)
This commit is contained in:
parent
5493c9f4e3
commit
4de0cb1827
7 changed files with 278 additions and 97 deletions
|
@ -60,7 +60,8 @@ Execution mode check. Allowed modes are `exec`, `eval` or `single`.
|
|||
|
||||
For example, one could do this:
|
||||
```
|
||||
use rustpython_parser::{parser, ast};
|
||||
use rustpython_parser::{Parse, ast};
|
||||
let python_source = "print('Hello world')";
|
||||
let python_ast = parser::parse_expression(python_source).unwrap();
|
||||
let python_statements = ast::Suite::parse(python_source).unwrap(); // statements
|
||||
let python_expr = ast::Expr::parse(python_source).unwrap(); // or expr
|
||||
```
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue