mirror of
https://github.com/fluencelabs/lalrpop
synced 2025-03-16 17:00:53 +00:00
connect state machine reduce
to __reduce
helper
This commit is contained in:
parent
032034a3d9
commit
5968cf013c
@ -126,7 +126,7 @@ pub trait ParserDefinition: Sized {
|
||||
/// right? This would also allow us -- I think -- to extend error
|
||||
/// recovery to cover user-produced errors.
|
||||
fn reduce(
|
||||
&self,
|
||||
&mut self,
|
||||
reduce_index: Self::ReduceIndex,
|
||||
start_location: Option<&Self::Location>,
|
||||
states: &mut Vec<Self::StateIndex>,
|
||||
|
@ -349,7 +349,7 @@ impl<'ascent, 'grammar, W: Write> CodeGenerator<'ascent, 'grammar, W, TableDrive
|
||||
|
||||
rust!(self.out, "");
|
||||
rust!(self.out, "fn reduce(");
|
||||
rust!(self.out, "&self,");
|
||||
rust!(self.out, "&mut self,");
|
||||
rust!(self.out, "action: {state_type},", state_type = state_type);
|
||||
rust!(self.out, "start_location: Option<&Self::Location>,");
|
||||
rust!(
|
||||
@ -367,7 +367,16 @@ impl<'ascent, 'grammar, W: Write> CodeGenerator<'ascent, 'grammar, W, TableDrive
|
||||
") -> Option<{p}state_machine::ParseResult<Self>> {{",
|
||||
p = self.prefix,
|
||||
);
|
||||
rust!(self.out, "panic!()");
|
||||
rust!(self.out, "{p}reduce(", p = self.prefix);
|
||||
for Parameter { name, ty: _ } in self.grammar.parameters.iter() {
|
||||
rust!(self.out, "self.{},", name);
|
||||
}
|
||||
rust!(self.out, "action,");
|
||||
rust!(self.out, "start_location,");
|
||||
rust!(self.out, "states,");
|
||||
rust!(self.out, "symbols,");
|
||||
rust!(self.out, "{},", phantom_data_expr);
|
||||
rust!(self.out, ")");
|
||||
rust!(self.out, "}}");
|
||||
|
||||
rust!(self.out, "");
|
||||
|
Loading…
x
Reference in New Issue
Block a user