diff --git a/doc/src/ast_example.md b/doc/src/ast_example.md index 08e0dabed..5cfbeb399 100644 --- a/doc/src/ast_example.md +++ b/doc/src/ast_example.md @@ -15,17 +15,17 @@ guide](quickstart.md). However the `calc.y` file is change as follows: %avoid_insert "INT" %% Expr -> Result: - Expr '+' Term { Ok(Expr::Add{ span: $span, lhs: Box::new($1?), rhs: Box::new($3?) }) } + Expr 'PLUS' Term { Ok(Expr::Add{ span: $span, lhs: Box::new($1?), rhs: Box::new($3?) }) } | Term { $1 } ; Term -> Result: - Term '*' Factor { Ok(Expr::Mul{ span: $span, lhs: Box::new($1?), rhs: Box::new($3?) }) } + Term 'MUL' Factor { Ok(Expr::Mul{ span: $span, lhs: Box::new($1?), rhs: Box::new($3?) }) } | Factor { $1 } ; Factor -> Result: - '(' Expr ')' { $2 } + 'LBRACK' Expr 'RBRACK' { $2 } | 'INT' { Ok(Expr::Number{ span: $span }) } ; %% @@ -113,7 +113,7 @@ fn main() { } } -fn eval(lexer: &dyn NonStreamingLexer, e: Expr) -> Result { +fn eval(lexer: &dyn NonStreamingLexer<'_, DefaultLexeme, u32>, e: Expr) -> Result { match e { Expr::Add { span, lhs, rhs } => eval(lexer, *lhs)? .checked_add(eval(lexer, *rhs)?) diff --git a/lrpar/src/lib/ctbuilder.rs b/lrpar/src/lib/ctbuilder.rs index a59bcb5a6..23b826588 100644 --- a/lrpar/src/lib/ctbuilder.rs +++ b/lrpar/src/lib/ctbuilder.rs @@ -758,7 +758,7 @@ where outs, " #[allow(dead_code)] - pub fn parse(lexer: &dyn ::lrpar::NonStreamingLexer<{lexemet}, {storaget}>) + pub fn parse(lexer: &dyn ::lrpar::NonStreamingLexer<'_, {lexemet}, {storaget}>) -> (::std::option::Option<::lrpar::Node<{lexemet}, {storaget}>>, ::std::vec::Vec<::lrpar::LexParseError<{lexemet}, {storaget}>>) {{", @@ -772,7 +772,7 @@ where outs, " #[allow(dead_code)] - pub fn parse(lexer: &dyn ::lrpar::NonStreamingLexer<{lexemet}, {storaget}>) + pub fn parse(lexer: &dyn ::lrpar::NonStreamingLexer<'_, {lexemet}, {storaget}>) -> ::std::vec::Vec<::lrpar::LexParseError<{lexemet}, {storaget}>> {{", lexemet = type_name::(), @@ -818,7 +818,7 @@ where let actions: ::std::vec::Vec<&dyn Fn(::cfgrammar::RIdx<{storaget}>, &'lexer dyn ::lrpar::NonStreamingLexer<'input, {lexemet}, {storaget}>, ::cfgrammar::Span, - ::std::vec::Drain<::lrpar::parser::AStackType<{lexemet}, {actionskind}<'input>>>, + ::std::vec::Drain<'_, ::lrpar::parser::AStackType<{lexemet}, {actionskind}<'input>>>, {parse_paramty}) -> {actionskind}<'input>> = ::std::vec![{wrappers}];\n", actionskind = ACTIONS_KIND, @@ -934,7 +934,7 @@ where " fn {prefix}wrapper_{}<'lexer, 'input: 'lexer>({prefix}ridx: ::cfgrammar::RIdx<{storaget}>, {prefix}lexer: &'lexer dyn ::lrpar::NonStreamingLexer<'input, {lexemet}, {storaget}>, {prefix}span: ::cfgrammar::Span, - mut {prefix}args: ::std::vec::Drain<::lrpar::parser::AStackType<{lexemet}, {actionskind}<'input>>>, + mut {prefix}args: ::std::vec::Drain<'_, ::lrpar::parser::AStackType<{lexemet}, {actionskind}<'input>>>, {parse_paramdef}) -> {actionskind}<'input> {{", usize::from(pidx),