diff --git a/docs/src/tutorials/calculator/calculator1/src/calculator.rs b/docs/src/tutorials/calculator/calculator1/src/calculator.rs index b48776b3..2e0c54d4 100644 --- a/docs/src/tutorials/calculator/calculator1/src/calculator.rs +++ b/docs/src/tutorials/calculator/calculator1/src/calculator.rs @@ -200,7 +200,7 @@ impl< } } #[allow(dead_code)] -impl<'i, I, L, B> Parser<'i, I, Context<'i, I>, L, State, TokenKind> +impl<'i, I, L, B> Parser<'i, I, Context<'i, I>, State, TokenKind> for CalculatorParser<'i, I, L, B> where I: InputT + ?Sized + Debug, diff --git a/docs/src/tutorials/calculator/calculator2/src/calculator.rs b/docs/src/tutorials/calculator/calculator2/src/calculator.rs index ce170b05..4a250fff 100644 --- a/docs/src/tutorials/calculator/calculator2/src/calculator.rs +++ b/docs/src/tutorials/calculator/calculator2/src/calculator.rs @@ -326,7 +326,7 @@ impl< } } #[allow(dead_code)] -impl<'i, I, L, B> Parser<'i, I, Context<'i, I>, L, State, TokenKind> +impl<'i, I, L, B> Parser<'i, I, Context<'i, I>, State, TokenKind> for CalculatorParser<'i, I, L, B> where I: InputT + ?Sized + Debug, diff --git a/docs/src/tutorials/calculator/calculator3/src/calculator.rs b/docs/src/tutorials/calculator/calculator3/src/calculator.rs index d6319749..dd90bbf3 100644 --- a/docs/src/tutorials/calculator/calculator3/src/calculator.rs +++ b/docs/src/tutorials/calculator/calculator3/src/calculator.rs @@ -326,7 +326,7 @@ impl< } } #[allow(dead_code)] -impl<'i, I, L, B> Parser<'i, I, Context<'i, I>, L, State, TokenKind> +impl<'i, I, L, B> Parser<'i, I, Context<'i, I>, State, TokenKind> for CalculatorParser<'i, I, L, B> where I: InputT + ?Sized + Debug, diff --git a/docs/src/tutorials/calculator/calculator4/src/calculator.rs b/docs/src/tutorials/calculator/calculator4/src/calculator.rs index d6319749..dd90bbf3 100644 --- a/docs/src/tutorials/calculator/calculator4/src/calculator.rs +++ b/docs/src/tutorials/calculator/calculator4/src/calculator.rs @@ -326,7 +326,7 @@ impl< } } #[allow(dead_code)] -impl<'i, I, L, B> Parser<'i, I, Context<'i, I>, L, State, TokenKind> +impl<'i, I, L, B> Parser<'i, I, Context<'i, I>, State, TokenKind> for CalculatorParser<'i, I, L, B> where I: InputT + ?Sized + Debug, diff --git a/docs/src/tutorials/calculator/calculator5/src/calculator.rs b/docs/src/tutorials/calculator/calculator5/src/calculator.rs index d6319749..dd90bbf3 100644 --- a/docs/src/tutorials/calculator/calculator5/src/calculator.rs +++ b/docs/src/tutorials/calculator/calculator5/src/calculator.rs @@ -326,7 +326,7 @@ impl< } } #[allow(dead_code)] -impl<'i, I, L, B> Parser<'i, I, Context<'i, I>, L, State, TokenKind> +impl<'i, I, L, B> Parser<'i, I, Context<'i, I>, State, TokenKind> for CalculatorParser<'i, I, L, B> where I: InputT + ?Sized + Debug, diff --git a/rustemo-compiler/src/generator/mod.rs b/rustemo-compiler/src/generator/mod.rs index 8cacbe41..091d85c0 100644 --- a/rustemo-compiler/src/generator/mod.rs +++ b/rustemo-compiler/src/generator/mod.rs @@ -804,7 +804,7 @@ impl<'g, 's> ParserGenerator<'g, 's> { ast.push(parse_quote! { #[allow(dead_code)] - impl<'i, I, L, B> Parser<'i, I, Context<'i, I>, L, State, TokenKind> for #parser <'i, I, L, B> + impl<'i, I, L, B> Parser<'i, I, Context<'i, I>, State, TokenKind> for #parser <'i, I, L, B> where I: InputT + ?Sized + Debug, L: Lexer<'i, Context<'i, I>, State, TokenKind, Input = I>, diff --git a/rustemo-compiler/src/lang/rustemo.rs b/rustemo-compiler/src/lang/rustemo.rs index 87ad1cc6..247d3d17 100644 --- a/rustemo-compiler/src/lang/rustemo.rs +++ b/rustemo-compiler/src/lang/rustemo.rs @@ -16771,7 +16771,7 @@ impl< } } #[allow(dead_code)] -impl<'i, I, L, B> Parser<'i, I, Context<'i, I>, L, State, TokenKind> +impl<'i, I, L, B> Parser<'i, I, Context<'i, I>, State, TokenKind> for RustemoParser<'i, I, L, B> where I: InputT + ?Sized + Debug, diff --git a/rustemo/src/glr/parser.rs b/rustemo/src/glr/parser.rs index 4d4f9a98..ed8aefc1 100644 --- a/rustemo/src/glr/parser.rs +++ b/rustemo/src/glr/parser.rs @@ -875,8 +875,7 @@ where } } -impl<'i, I, L, S, TK, NTK, P, D, B> - Parser<'i, I, GssHead<'i, I, S, TK>, L, S, TK> +impl<'i, I, S, TK, NTK, L, P, D, B> Parser<'i, I, GssHead<'i, I, S, TK>, S, TK> for GlrParser<'i, S, L, P, TK, NTK, D, I, B> where I: Input + ?Sized + Debug, @@ -888,7 +887,7 @@ where { type Output = Forest<'i, I, P, TK>; - fn parse(&self, input: &'i L::Input) -> Result { + fn parse(&self, input: &'i I) -> Result { let mut context = GssHead::default(); context.set_position(self.start_position); self.parse_with_context(&mut context, input) @@ -897,7 +896,7 @@ where fn parse_with_context( &self, context: &mut GssHead<'i, I, S, TK>, - input: &'i L::Input, + input: &'i I, ) -> Result { let mut gss: GssGraph<'i, I, S, P, TK> = GssGraph::new(); let start_head = gss.add_head(context.clone()); diff --git a/rustemo/src/lr/parser.rs b/rustemo/src/lr/parser.rs index 0b0421d2..79e236d6 100644 --- a/rustemo/src/lr/parser.rs +++ b/rustemo/src/lr/parser.rs @@ -287,7 +287,7 @@ where } } -impl<'i, C, S, P, I, TK, NTK, D, L, B> Parser<'i, I, C, L, S, TK> +impl<'i, C, S, P, I, TK, NTK, D, L, B> Parser<'i, I, C, S, TK> for LRParser<'i, C, S, P, TK, NTK, D, L, B, I> where C: Context<'i, I, S, TK> + Default, @@ -302,7 +302,7 @@ where { type Output = B::Output; - fn parse(&self, input: &'i L::Input) -> Result { + fn parse(&self, input: &'i I) -> Result { log!("\n{}", "*** Parsing started".red().bold()); log!("\nfile: {}", self.file_name); let mut context = C::default(); @@ -313,7 +313,7 @@ where fn parse_with_context( &self, context: &mut C, - input: &'i L::Input, + input: &'i I, ) -> Result { let mut parse_stack: ParseStack = ParseStack::new(context, self.start_state); diff --git a/rustemo/src/parser.rs b/rustemo/src/parser.rs index f8c2d3a0..7ad3c498 100644 --- a/rustemo/src/parser.rs +++ b/rustemo/src/parser.rs @@ -1,13 +1,12 @@ use std::path::Path; -use crate::{context::Context, error::Result, input::Input, lexer::Lexer}; +use crate::{context::Context, error::Result, input::Input}; /// The trait implemented by all Rustemo parsers. -pub trait Parser<'i, I, C, L, S, TK> +pub trait Parser<'i, I, C, S, TK> where I: Input + ?Sized, C: Context<'i, I, S, TK>, - L: Lexer<'i, C, S, TK, Input = I>, S: State, { type Output; @@ -15,7 +14,7 @@ where /// Parse the given input and produce the result. The output type is set by /// the parser implementers and it is usually defined by the builder if the /// building is done during the parse process. - fn parse(&self, input: &'i L::Input) -> Result; + fn parse(&self, input: &'i I) -> Result; /// Parse with the given context which has information about the current /// parsing state (e.g. position, location). Used in situation when we need @@ -24,7 +23,7 @@ where fn parse_with_context( &self, context: &mut C, - input: &'i L::Input, + input: &'i I, ) -> Result; /// A convenience method for loading the content from the given file and diff --git a/tests/src/output_dir/output_dir.rs b/tests/src/output_dir/output_dir.rs index 25711799..a442aca7 100644 --- a/tests/src/output_dir/output_dir.rs +++ b/tests/src/output_dir/output_dir.rs @@ -223,7 +223,7 @@ impl< } } #[allow(dead_code)] -impl<'i, I, L, B> Parser<'i, I, Context<'i, I>, L, State, TokenKind> +impl<'i, I, L, B> Parser<'i, I, Context<'i, I>, State, TokenKind> for OutputDirParser<'i, I, L, B> where I: InputT + ?Sized + Debug,