[][src]Crate rustpython_parser

This crate can be used to parse python sourcecode into a so called AST (abstract syntax tree).

The stages involved in this process are lexical analysis and parsing. The lexical analysis splits the sourcecode into tokens, and the parsing transforms those tokens into an AST.

For example, one could do this:

use rustpython_parser::{parser, ast};

let python_source = "print('Hello world')";
let python_ast = parser::parse_expression(python_source).unwrap();

Modules

ast

Implement abstract syntax tree (AST) nodes for the python language.

error

Define internal parse error types The goal is to provide a matching and a safe error API, maksing errors from LALR

lexer

This module takes care of lexing python source text.

location

Datatypes to support source location information.

mode
parser

Python parsing.

token

Different token definitions. Loosely based on token.h from CPython source: