mirror of
https://github.com/fluencelabs/lalrpop
synced 2025-03-16 17:00:53 +00:00
print the set of things we are interpreting
makes debugging easier
This commit is contained in:
parent
f924cb857d
commit
c489c805d0
@ -35,7 +35,7 @@ fn random_test<'g>(grammar: &Grammar,
|
||||
|
||||
macro_rules! tokens {
|
||||
($($x:expr),*) => {
|
||||
vec![$(TerminalString::quoted(intern($x))),*].into_iter()
|
||||
vec![$(TerminalString::quoted(intern($x))),*]
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -12,7 +12,7 @@ fn nt(t: &str) -> NonterminalString {
|
||||
|
||||
macro_rules! tokens {
|
||||
($($x:expr),*) => {
|
||||
vec![$(TerminalString::quoted(intern($x))),*].into_iter()
|
||||
vec![$(TerminalString::quoted(intern($x))),*]
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -11,12 +11,12 @@ use util::Sep;
|
||||
pub type InterpretError<'grammar, L> = (&'grammar State<'grammar, L>, Token);
|
||||
|
||||
/// Feed in the given tokens and then EOF, returning the final parse tree that is reduced.
|
||||
pub fn interpret<'grammar, TOKENS, L>(states: &'grammar [State<'grammar, L>],
|
||||
tokens: TOKENS)
|
||||
-> Result<ParseTree, InterpretError<'grammar, L>>
|
||||
where TOKENS: IntoIterator<Item = TerminalString>,
|
||||
L: LookaheadInterpret
|
||||
pub fn interpret<'grammar, L>(states: &'grammar [State<'grammar, L>],
|
||||
tokens: Vec<TerminalString>)
|
||||
-> Result<ParseTree, InterpretError<'grammar, L>>
|
||||
where L: LookaheadInterpret
|
||||
{
|
||||
println!("interpret(tokens={:?})", tokens);
|
||||
let mut m = Machine::new(states);
|
||||
m.execute(tokens.into_iter())
|
||||
}
|
||||
|
@ -15,7 +15,7 @@ use super::table::*;
|
||||
|
||||
macro_rules! tokens {
|
||||
($($x:expr),*) => {
|
||||
vec![$(TerminalString::quoted(intern($x))),*].into_iter()
|
||||
vec![$(TerminalString::quoted(intern($x))),*]
|
||||
}
|
||||
}
|
||||
|
||||
@ -117,6 +117,7 @@ fn build_table<'grammar>(grammar: &'grammar Grammar,
|
||||
let first_sets = FirstSets::new(&grammar);
|
||||
let state_graph = StateGraph::new(&lr0_err.states);
|
||||
let mut tracer = LaneTracer::new(&grammar,
|
||||
nt("G"),
|
||||
&lr0_err.states,
|
||||
&first_sets,
|
||||
&state_graph,
|
||||
|
Loading…
x
Reference in New Issue
Block a user