pub trait Parse: Sized {
    // Required methods
    fn lex_starts_at(
        source: &str,
        offset: TextSize
    ) -> SoftKeywordTransformer<Lexer<Chars<'_>>>;
    fn parse_tokens(
        lxr: impl IntoIterator<Item = Result<(Tok, TextRange), LexicalError>>,
        source_path: &str
    ) -> Result<Self, BaseError<ParseErrorType>>;

    // Provided methods
    fn parse(
        source: &str,
        source_path: &str
    ) -> Result<Self, BaseError<ParseErrorType>> { ... }
    fn parse_without_path(
        source: &str
    ) -> Result<Self, BaseError<ParseErrorType>> { ... }
    fn parse_starts_at(
        source: &str,
        source_path: &str,
        offset: TextSize
    ) -> Result<Self, BaseError<ParseErrorType>> { ... }
}
Expand description

Parse Python code string to implementor’s type.

Example

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

use rustpython_parser::{self as parser, ast, Parse};
let source = r#"
def foo():
   return 42

print(foo())
"#;
let program = ast::Suite::parse(source, "<embedded>");
assert!(program.is_ok());

Parsing a single expression denoting the addition of two numbers, but this time specifying a different, somewhat silly, location:

use rustpython_parser::{self as parser, ast, Parse, text_size::TextSize};

let expr = ast::Expr::parse_starts_at("1 + 2", "<embedded>", TextSize::from(400));
assert!(expr.is_ok());

Required Methods§

source

fn lex_starts_at( source: &str, offset: TextSize ) -> SoftKeywordTransformer<Lexer<Chars<'_>>>

source

fn parse_tokens( lxr: impl IntoIterator<Item = Result<(Tok, TextRange), LexicalError>>, source_path: &str ) -> Result<Self, BaseError<ParseErrorType>>

Provided Methods§

source

fn parse( source: &str, source_path: &str ) -> Result<Self, BaseError<ParseErrorType>>

source

fn parse_without_path(source: &str) -> Result<Self, BaseError<ParseErrorType>>

source

fn parse_starts_at( source: &str, source_path: &str, offset: TextSize ) -> Result<Self, BaseError<ParseErrorType>>

Implementations on Foreign Types§

source§

impl Parse for StmtAsyncWith<TextRange>

source§

fn lex_starts_at( source: &str, offset: TextSize ) -> SoftKeywordTransformer<Lexer<Chars<'_>>>

source§

fn parse_tokens( lxr: impl IntoIterator<Item = Result<(Tok, TextRange), LexicalError>>, source_path: &str ) -> Result<StmtAsyncWith<TextRange>, BaseError<ParseErrorType>>

source§

impl Parse for StmtAnnAssign<TextRange>

source§

fn lex_starts_at( source: &str, offset: TextSize ) -> SoftKeywordTransformer<Lexer<Chars<'_>>>

source§

fn parse_tokens( lxr: impl IntoIterator<Item = Result<(Tok, TextRange), LexicalError>>, source_path: &str ) -> Result<StmtAnnAssign<TextRange>, BaseError<ParseErrorType>>

source§

impl Parse for StmtFunctionDef<TextRange>

source§

fn lex_starts_at( source: &str, offset: TextSize ) -> SoftKeywordTransformer<Lexer<Chars<'_>>>

source§

fn parse_tokens( lxr: impl IntoIterator<Item = Result<(Tok, TextRange), LexicalError>>, source_path: &str ) -> Result<StmtFunctionDef<TextRange>, BaseError<ParseErrorType>>

source§

impl Parse for ExprAttribute<TextRange>

source§

fn lex_starts_at( source: &str, offset: TextSize ) -> SoftKeywordTransformer<Lexer<Chars<'_>>>

source§

fn parse_tokens( lxr: impl IntoIterator<Item = Result<(Tok, TextRange), LexicalError>>, source_path: &str ) -> Result<ExprAttribute<TextRange>, BaseError<ParseErrorType>>

source§

impl Parse for StmtIf<TextRange>

source§

fn lex_starts_at( source: &str, offset: TextSize ) -> SoftKeywordTransformer<Lexer<Chars<'_>>>

source§

fn parse_tokens( lxr: impl IntoIterator<Item = Result<(Tok, TextRange), LexicalError>>, source_path: &str ) -> Result<StmtIf<TextRange>, BaseError<ParseErrorType>>

source§

impl Parse for ExprUnaryOp<TextRange>

source§

fn lex_starts_at( source: &str, offset: TextSize ) -> SoftKeywordTransformer<Lexer<Chars<'_>>>

source§

fn parse_tokens( lxr: impl IntoIterator<Item = Result<(Tok, TextRange), LexicalError>>, source_path: &str ) -> Result<ExprUnaryOp<TextRange>, BaseError<ParseErrorType>>

source§

impl Parse for ExprDictComp<TextRange>

source§

fn lex_starts_at( source: &str, offset: TextSize ) -> SoftKeywordTransformer<Lexer<Chars<'_>>>

source§

fn parse_tokens( lxr: impl IntoIterator<Item = Result<(Tok, TextRange), LexicalError>>, source_path: &str ) -> Result<ExprDictComp<TextRange>, BaseError<ParseErrorType>>

source§

impl Parse for StmtContinue<TextRange>

source§

fn lex_starts_at( source: &str, offset: TextSize ) -> SoftKeywordTransformer<Lexer<Chars<'_>>>

source§

fn parse_tokens( lxr: impl IntoIterator<Item = Result<(Tok, TextRange), LexicalError>>, source_path: &str ) -> Result<StmtContinue<TextRange>, BaseError<ParseErrorType>>

source§

impl Parse for Constant

source§

fn lex_starts_at( source: &str, offset: TextSize ) -> SoftKeywordTransformer<Lexer<Chars<'_>>>

source§

fn parse_tokens( lxr: impl IntoIterator<Item = Result<(Tok, TextRange), LexicalError>>, source_path: &str ) -> Result<Constant, BaseError<ParseErrorType>>

source§

impl Parse for StmtAsyncFor<TextRange>

source§

fn lex_starts_at( source: &str, offset: TextSize ) -> SoftKeywordTransformer<Lexer<Chars<'_>>>

source§

fn parse_tokens( lxr: impl IntoIterator<Item = Result<(Tok, TextRange), LexicalError>>, source_path: &str ) -> Result<StmtAsyncFor<TextRange>, BaseError<ParseErrorType>>

source§

impl Parse for ExprListComp<TextRange>

source§

fn lex_starts_at( source: &str, offset: TextSize ) -> SoftKeywordTransformer<Lexer<Chars<'_>>>

source§

fn parse_tokens( lxr: impl IntoIterator<Item = Result<(Tok, TextRange), LexicalError>>, source_path: &str ) -> Result<ExprListComp<TextRange>, BaseError<ParseErrorType>>

source§

impl Parse for StmtAugAssign<TextRange>

source§

fn lex_starts_at( source: &str, offset: TextSize ) -> SoftKeywordTransformer<Lexer<Chars<'_>>>

source§

fn parse_tokens( lxr: impl IntoIterator<Item = Result<(Tok, TextRange), LexicalError>>, source_path: &str ) -> Result<StmtAugAssign<TextRange>, BaseError<ParseErrorType>>

source§

impl Parse for StmtDelete<TextRange>

source§

fn lex_starts_at( source: &str, offset: TextSize ) -> SoftKeywordTransformer<Lexer<Chars<'_>>>

source§

fn parse_tokens( lxr: impl IntoIterator<Item = Result<(Tok, TextRange), LexicalError>>, source_path: &str ) -> Result<StmtDelete<TextRange>, BaseError<ParseErrorType>>

source§

impl Parse for ExprBinOp<TextRange>

source§

fn lex_starts_at( source: &str, offset: TextSize ) -> SoftKeywordTransformer<Lexer<Chars<'_>>>

source§

fn parse_tokens( lxr: impl IntoIterator<Item = Result<(Tok, TextRange), LexicalError>>, source_path: &str ) -> Result<ExprBinOp<TextRange>, BaseError<ParseErrorType>>

source§

impl Parse for StmtPass<TextRange>

source§

fn lex_starts_at( source: &str, offset: TextSize ) -> SoftKeywordTransformer<Lexer<Chars<'_>>>

source§

fn parse_tokens( lxr: impl IntoIterator<Item = Result<(Tok, TextRange), LexicalError>>, source_path: &str ) -> Result<StmtPass<TextRange>, BaseError<ParseErrorType>>

source§

impl Parse for ExprNamedExpr<TextRange>

source§

fn lex_starts_at( source: &str, offset: TextSize ) -> SoftKeywordTransformer<Lexer<Chars<'_>>>

source§

fn parse_tokens( lxr: impl IntoIterator<Item = Result<(Tok, TextRange), LexicalError>>, source_path: &str ) -> Result<ExprNamedExpr<TextRange>, BaseError<ParseErrorType>>

source§

impl Parse for ExprAwait<TextRange>

source§

fn lex_starts_at( source: &str, offset: TextSize ) -> SoftKeywordTransformer<Lexer<Chars<'_>>>

source§

fn parse_tokens( lxr: impl IntoIterator<Item = Result<(Tok, TextRange), LexicalError>>, source_path: &str ) -> Result<ExprAwait<TextRange>, BaseError<ParseErrorType>>

source§

impl Parse for ExprSlice<TextRange>

source§

fn lex_starts_at( source: &str, offset: TextSize ) -> SoftKeywordTransformer<Lexer<Chars<'_>>>

source§

fn parse_tokens( lxr: impl IntoIterator<Item = Result<(Tok, TextRange), LexicalError>>, source_path: &str ) -> Result<ExprSlice<TextRange>, BaseError<ParseErrorType>>

source§

impl Parse for StmtImport<TextRange>

source§

fn lex_starts_at( source: &str, offset: TextSize ) -> SoftKeywordTransformer<Lexer<Chars<'_>>>

source§

fn parse_tokens( lxr: impl IntoIterator<Item = Result<(Tok, TextRange), LexicalError>>, source_path: &str ) -> Result<StmtImport<TextRange>, BaseError<ParseErrorType>>

source§

impl Parse for StmtExpr<TextRange>

source§

fn lex_starts_at( source: &str, offset: TextSize ) -> SoftKeywordTransformer<Lexer<Chars<'_>>>

source§

fn parse_tokens( lxr: impl IntoIterator<Item = Result<(Tok, TextRange), LexicalError>>, source_path: &str ) -> Result<StmtExpr<TextRange>, BaseError<ParseErrorType>>

source§

impl Parse for ExprFormattedValue<TextRange>

source§

fn lex_starts_at( source: &str, offset: TextSize ) -> SoftKeywordTransformer<Lexer<Chars<'_>>>

source§

fn parse_tokens( lxr: impl IntoIterator<Item = Result<(Tok, TextRange), LexicalError>>, source_path: &str ) -> Result<ExprFormattedValue<TextRange>, BaseError<ParseErrorType>>

source§

impl Parse for Stmt<TextRange>

source§

fn lex_starts_at( source: &str, offset: TextSize ) -> SoftKeywordTransformer<Lexer<Chars<'_>>>

source§

fn parse_tokens( lxr: impl IntoIterator<Item = Result<(Tok, TextRange), LexicalError>>, source_path: &str ) -> Result<Stmt<TextRange>, BaseError<ParseErrorType>>

source§

impl Parse for StmtWith<TextRange>

source§

fn lex_starts_at( source: &str, offset: TextSize ) -> SoftKeywordTransformer<Lexer<Chars<'_>>>

source§

fn parse_tokens( lxr: impl IntoIterator<Item = Result<(Tok, TextRange), LexicalError>>, source_path: &str ) -> Result<StmtWith<TextRange>, BaseError<ParseErrorType>>

source§

impl Parse for StmtTry<TextRange>

source§

fn lex_starts_at( source: &str, offset: TextSize ) -> SoftKeywordTransformer<Lexer<Chars<'_>>>

source§

fn parse_tokens( lxr: impl IntoIterator<Item = Result<(Tok, TextRange), LexicalError>>, source_path: &str ) -> Result<StmtTry<TextRange>, BaseError<ParseErrorType>>

source§

impl Parse for StmtBreak<TextRange>

source§

fn lex_starts_at( source: &str, offset: TextSize ) -> SoftKeywordTransformer<Lexer<Chars<'_>>>

source§

fn parse_tokens( lxr: impl IntoIterator<Item = Result<(Tok, TextRange), LexicalError>>, source_path: &str ) -> Result<StmtBreak<TextRange>, BaseError<ParseErrorType>>

source§

impl Parse for StmtReturn<TextRange>

source§

fn lex_starts_at( source: &str, offset: TextSize ) -> SoftKeywordTransformer<Lexer<Chars<'_>>>

source§

fn parse_tokens( lxr: impl IntoIterator<Item = Result<(Tok, TextRange), LexicalError>>, source_path: &str ) -> Result<StmtReturn<TextRange>, BaseError<ParseErrorType>>

source§

impl Parse for Vec<Stmt<TextRange>, Global>

source§

fn lex_starts_at( source: &str, offset: TextSize ) -> SoftKeywordTransformer<Lexer<Chars<'_>>>

source§

fn parse_tokens( lxr: impl IntoIterator<Item = Result<(Tok, TextRange), LexicalError>>, source_path: &str ) -> Result<Vec<Stmt<TextRange>, Global>, BaseError<ParseErrorType>>

source§

impl Parse for ExprConstant<TextRange>

source§

fn lex_starts_at( source: &str, offset: TextSize ) -> SoftKeywordTransformer<Lexer<Chars<'_>>>

source§

fn parse_tokens( lxr: impl IntoIterator<Item = Result<(Tok, TextRange), LexicalError>>, source_path: &str ) -> Result<ExprConstant<TextRange>, BaseError<ParseErrorType>>

source§

impl Parse for StmtTypeAlias<TextRange>

source§

fn lex_starts_at( source: &str, offset: TextSize ) -> SoftKeywordTransformer<Lexer<Chars<'_>>>

source§

fn parse_tokens( lxr: impl IntoIterator<Item = Result<(Tok, TextRange), LexicalError>>, source_path: &str ) -> Result<StmtTypeAlias<TextRange>, BaseError<ParseErrorType>>

source§

impl Parse for StmtImportFrom<TextRange>

source§

fn lex_starts_at( source: &str, offset: TextSize ) -> SoftKeywordTransformer<Lexer<Chars<'_>>>

source§

fn parse_tokens( lxr: impl IntoIterator<Item = Result<(Tok, TextRange), LexicalError>>, source_path: &str ) -> Result<StmtImportFrom<TextRange>, BaseError<ParseErrorType>>

source§

impl Parse for StmtAssign<TextRange>

source§

fn lex_starts_at( source: &str, offset: TextSize ) -> SoftKeywordTransformer<Lexer<Chars<'_>>>

source§

fn parse_tokens( lxr: impl IntoIterator<Item = Result<(Tok, TextRange), LexicalError>>, source_path: &str ) -> Result<StmtAssign<TextRange>, BaseError<ParseErrorType>>

source§

impl Parse for ExprDict<TextRange>

source§

fn lex_starts_at( source: &str, offset: TextSize ) -> SoftKeywordTransformer<Lexer<Chars<'_>>>

source§

fn parse_tokens( lxr: impl IntoIterator<Item = Result<(Tok, TextRange), LexicalError>>, source_path: &str ) -> Result<ExprDict<TextRange>, BaseError<ParseErrorType>>

source§

impl Parse for ExprSetComp<TextRange>

source§

fn lex_starts_at( source: &str, offset: TextSize ) -> SoftKeywordTransformer<Lexer<Chars<'_>>>

source§

fn parse_tokens( lxr: impl IntoIterator<Item = Result<(Tok, TextRange), LexicalError>>, source_path: &str ) -> Result<ExprSetComp<TextRange>, BaseError<ParseErrorType>>

source§

impl Parse for ModInteractive<TextRange>

source§

fn lex_starts_at( source: &str, offset: TextSize ) -> SoftKeywordTransformer<Lexer<Chars<'_>>>

source§

fn parse_tokens( lxr: impl IntoIterator<Item = Result<(Tok, TextRange), LexicalError>>, source_path: &str ) -> Result<ModInteractive<TextRange>, BaseError<ParseErrorType>>

source§

impl Parse for ExprBoolOp<TextRange>

source§

fn lex_starts_at( source: &str, offset: TextSize ) -> SoftKeywordTransformer<Lexer<Chars<'_>>>

source§

fn parse_tokens( lxr: impl IntoIterator<Item = Result<(Tok, TextRange), LexicalError>>, source_path: &str ) -> Result<ExprBoolOp<TextRange>, BaseError<ParseErrorType>>

source§

impl Parse for ExprLambda<TextRange>

source§

fn lex_starts_at( source: &str, offset: TextSize ) -> SoftKeywordTransformer<Lexer<Chars<'_>>>

source§

fn parse_tokens( lxr: impl IntoIterator<Item = Result<(Tok, TextRange), LexicalError>>, source_path: &str ) -> Result<ExprLambda<TextRange>, BaseError<ParseErrorType>>

source§

impl Parse for ExprSubscript<TextRange>

source§

fn lex_starts_at( source: &str, offset: TextSize ) -> SoftKeywordTransformer<Lexer<Chars<'_>>>

source§

fn parse_tokens( lxr: impl IntoIterator<Item = Result<(Tok, TextRange), LexicalError>>, source_path: &str ) -> Result<ExprSubscript<TextRange>, BaseError<ParseErrorType>>

source§

impl Parse for StmtFor<TextRange>

source§

fn lex_starts_at( source: &str, offset: TextSize ) -> SoftKeywordTransformer<Lexer<Chars<'_>>>

source§

fn parse_tokens( lxr: impl IntoIterator<Item = Result<(Tok, TextRange), LexicalError>>, source_path: &str ) -> Result<StmtFor<TextRange>, BaseError<ParseErrorType>>

source§

impl Parse for ModExpression<TextRange>

source§

fn lex_starts_at( source: &str, offset: TextSize ) -> SoftKeywordTransformer<Lexer<Chars<'_>>>

source§

fn parse_tokens( lxr: impl IntoIterator<Item = Result<(Tok, TextRange), LexicalError>>, source_path: &str ) -> Result<ModExpression<TextRange>, BaseError<ParseErrorType>>

source§

impl Parse for ExprCall<TextRange>

source§

fn lex_starts_at( source: &str, offset: TextSize ) -> SoftKeywordTransformer<Lexer<Chars<'_>>>

source§

fn parse_tokens( lxr: impl IntoIterator<Item = Result<(Tok, TextRange), LexicalError>>, source_path: &str ) -> Result<ExprCall<TextRange>, BaseError<ParseErrorType>>

source§

impl Parse for StmtNonlocal<TextRange>

source§

fn lex_starts_at( source: &str, offset: TextSize ) -> SoftKeywordTransformer<Lexer<Chars<'_>>>

source§

fn parse_tokens( lxr: impl IntoIterator<Item = Result<(Tok, TextRange), LexicalError>>, source_path: &str ) -> Result<StmtNonlocal<TextRange>, BaseError<ParseErrorType>>

source§

impl Parse for StmtMatch<TextRange>

source§

fn lex_starts_at( source: &str, offset: TextSize ) -> SoftKeywordTransformer<Lexer<Chars<'_>>>

source§

fn parse_tokens( lxr: impl IntoIterator<Item = Result<(Tok, TextRange), LexicalError>>, source_path: &str ) -> Result<StmtMatch<TextRange>, BaseError<ParseErrorType>>

source§

impl Parse for Identifier

source§

fn lex_starts_at( source: &str, offset: TextSize ) -> SoftKeywordTransformer<Lexer<Chars<'_>>>

source§

fn parse_tokens( lxr: impl IntoIterator<Item = Result<(Tok, TextRange), LexicalError>>, source_path: &str ) -> Result<Identifier, BaseError<ParseErrorType>>

source§

impl Parse for Expr<TextRange>

source§

fn lex_starts_at( source: &str, offset: TextSize ) -> SoftKeywordTransformer<Lexer<Chars<'_>>>

source§

fn parse_tokens( lxr: impl IntoIterator<Item = Result<(Tok, TextRange), LexicalError>>, source_path: &str ) -> Result<Expr<TextRange>, BaseError<ParseErrorType>>

source§

impl Parse for ExprJoinedStr<TextRange>

source§

fn lex_starts_at( source: &str, offset: TextSize ) -> SoftKeywordTransformer<Lexer<Chars<'_>>>

source§

fn parse_tokens( lxr: impl IntoIterator<Item = Result<(Tok, TextRange), LexicalError>>, source_path: &str ) -> Result<ExprJoinedStr<TextRange>, BaseError<ParseErrorType>>

source§

impl Parse for StmtWhile<TextRange>

source§

fn lex_starts_at( source: &str, offset: TextSize ) -> SoftKeywordTransformer<Lexer<Chars<'_>>>

source§

fn parse_tokens( lxr: impl IntoIterator<Item = Result<(Tok, TextRange), LexicalError>>, source_path: &str ) -> Result<StmtWhile<TextRange>, BaseError<ParseErrorType>>

source§

impl Parse for ExprStarred<TextRange>

source§

fn lex_starts_at( source: &str, offset: TextSize ) -> SoftKeywordTransformer<Lexer<Chars<'_>>>

source§

fn parse_tokens( lxr: impl IntoIterator<Item = Result<(Tok, TextRange), LexicalError>>, source_path: &str ) -> Result<ExprStarred<TextRange>, BaseError<ParseErrorType>>

source§

impl Parse for StmtAssert<TextRange>

source§

fn lex_starts_at( source: &str, offset: TextSize ) -> SoftKeywordTransformer<Lexer<Chars<'_>>>

source§

fn parse_tokens( lxr: impl IntoIterator<Item = Result<(Tok, TextRange), LexicalError>>, source_path: &str ) -> Result<StmtAssert<TextRange>, BaseError<ParseErrorType>>

source§

impl Parse for ExprIfExp<TextRange>

source§

fn lex_starts_at( source: &str, offset: TextSize ) -> SoftKeywordTransformer<Lexer<Chars<'_>>>

source§

fn parse_tokens( lxr: impl IntoIterator<Item = Result<(Tok, TextRange), LexicalError>>, source_path: &str ) -> Result<ExprIfExp<TextRange>, BaseError<ParseErrorType>>

source§

impl Parse for ExprTuple<TextRange>

source§

fn lex_starts_at( source: &str, offset: TextSize ) -> SoftKeywordTransformer<Lexer<Chars<'_>>>

source§

fn parse_tokens( lxr: impl IntoIterator<Item = Result<(Tok, TextRange), LexicalError>>, source_path: &str ) -> Result<ExprTuple<TextRange>, BaseError<ParseErrorType>>

source§

impl Parse for StmtRaise<TextRange>

source§

fn lex_starts_at( source: &str, offset: TextSize ) -> SoftKeywordTransformer<Lexer<Chars<'_>>>

source§

fn parse_tokens( lxr: impl IntoIterator<Item = Result<(Tok, TextRange), LexicalError>>, source_path: &str ) -> Result<StmtRaise<TextRange>, BaseError<ParseErrorType>>

source§

impl Parse for ExprYieldFrom<TextRange>

source§

fn lex_starts_at( source: &str, offset: TextSize ) -> SoftKeywordTransformer<Lexer<Chars<'_>>>

source§

fn parse_tokens( lxr: impl IntoIterator<Item = Result<(Tok, TextRange), LexicalError>>, source_path: &str ) -> Result<ExprYieldFrom<TextRange>, BaseError<ParseErrorType>>

source§

impl Parse for StmtGlobal<TextRange>

source§

fn lex_starts_at( source: &str, offset: TextSize ) -> SoftKeywordTransformer<Lexer<Chars<'_>>>

source§

fn parse_tokens( lxr: impl IntoIterator<Item = Result<(Tok, TextRange), LexicalError>>, source_path: &str ) -> Result<StmtGlobal<TextRange>, BaseError<ParseErrorType>>

source§

impl Parse for StmtAsyncFunctionDef<TextRange>

source§

fn lex_starts_at( source: &str, offset: TextSize ) -> SoftKeywordTransformer<Lexer<Chars<'_>>>

source§

fn parse_tokens( lxr: impl IntoIterator<Item = Result<(Tok, TextRange), LexicalError>>, source_path: &str ) -> Result<StmtAsyncFunctionDef<TextRange>, BaseError<ParseErrorType>>

source§

impl Parse for ExprYield<TextRange>

source§

fn lex_starts_at( source: &str, offset: TextSize ) -> SoftKeywordTransformer<Lexer<Chars<'_>>>

source§

fn parse_tokens( lxr: impl IntoIterator<Item = Result<(Tok, TextRange), LexicalError>>, source_path: &str ) -> Result<ExprYield<TextRange>, BaseError<ParseErrorType>>

source§

impl Parse for ExprCompare<TextRange>

source§

fn lex_starts_at( source: &str, offset: TextSize ) -> SoftKeywordTransformer<Lexer<Chars<'_>>>

source§

fn parse_tokens( lxr: impl IntoIterator<Item = Result<(Tok, TextRange), LexicalError>>, source_path: &str ) -> Result<ExprCompare<TextRange>, BaseError<ParseErrorType>>

source§

impl Parse for ExprName<TextRange>

source§

fn lex_starts_at( source: &str, offset: TextSize ) -> SoftKeywordTransformer<Lexer<Chars<'_>>>

source§

fn parse_tokens( lxr: impl IntoIterator<Item = Result<(Tok, TextRange), LexicalError>>, source_path: &str ) -> Result<ExprName<TextRange>, BaseError<ParseErrorType>>

source§

impl Parse for StmtClassDef<TextRange>

source§

fn lex_starts_at( source: &str, offset: TextSize ) -> SoftKeywordTransformer<Lexer<Chars<'_>>>

source§

fn parse_tokens( lxr: impl IntoIterator<Item = Result<(Tok, TextRange), LexicalError>>, source_path: &str ) -> Result<StmtClassDef<TextRange>, BaseError<ParseErrorType>>

source§

impl Parse for ExprList<TextRange>

source§

fn lex_starts_at( source: &str, offset: TextSize ) -> SoftKeywordTransformer<Lexer<Chars<'_>>>

source§

fn parse_tokens( lxr: impl IntoIterator<Item = Result<(Tok, TextRange), LexicalError>>, source_path: &str ) -> Result<ExprList<TextRange>, BaseError<ParseErrorType>>

source§

impl Parse for StmtTryStar<TextRange>

source§

fn lex_starts_at( source: &str, offset: TextSize ) -> SoftKeywordTransformer<Lexer<Chars<'_>>>

source§

fn parse_tokens( lxr: impl IntoIterator<Item = Result<(Tok, TextRange), LexicalError>>, source_path: &str ) -> Result<StmtTryStar<TextRange>, BaseError<ParseErrorType>>

source§

impl Parse for ExprSet<TextRange>

source§

fn lex_starts_at( source: &str, offset: TextSize ) -> SoftKeywordTransformer<Lexer<Chars<'_>>>

source§

fn parse_tokens( lxr: impl IntoIterator<Item = Result<(Tok, TextRange), LexicalError>>, source_path: &str ) -> Result<ExprSet<TextRange>, BaseError<ParseErrorType>>

source§

impl Parse for ExprGeneratorExp<TextRange>

source§

fn lex_starts_at( source: &str, offset: TextSize ) -> SoftKeywordTransformer<Lexer<Chars<'_>>>

source§

fn parse_tokens( lxr: impl IntoIterator<Item = Result<(Tok, TextRange), LexicalError>>, source_path: &str ) -> Result<ExprGeneratorExp<TextRange>, BaseError<ParseErrorType>>

source§

impl Parse for ModModule<TextRange>

source§

fn lex_starts_at( source: &str, offset: TextSize ) -> SoftKeywordTransformer<Lexer<Chars<'_>>>

source§

fn parse_tokens( lxr: impl IntoIterator<Item = Result<(Tok, TextRange), LexicalError>>, source_path: &str ) -> Result<ModModule<TextRange>, BaseError<ParseErrorType>>

Implementors§