Struct python_ast::Parser [] [src]

pub struct Parser<'a> {
    state: ParserState<'a>,
}

Create a Python AST from slice of Tokens created from the lexer::Lexer.

Fields

Methods

impl<'a> Parser<'a>
[src]

Create a new instance of Parser eager to consume TkSlice instances.

Public wrapper to the macro generated tkslice_to_ast which will take a slice of tokens, turn those into a TkSlice, and parse that into an AST.

Helper for the recursive parsing of a subexpression as is common in in cases where something has an infix-y semantic. For example: x = 1 if y else 2 or q = [i for i in entries if i >= 3]

Offload the work to parse tokens in the LHS here instead of in the binop parsers as a way to get around type inference hell. See build_conditional.

Offloads the work to parse the conditional subexpressions found in sub_expr_conditional. This could probably be done in that function however, there were issues with proper error type inference. In the future, a brave soul may wish to try to add a map!(..., ...) onto the subexpression matchers for purity.

Trait Implementations

impl<'a> Debug for Parser<'a>
[src]

Formats the value using the given formatter.

impl<'a> Copy for Parser<'a>
[src]

impl<'a> Clone for Parser<'a>
[src]

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more