[parser] Handle the result of passing a subparser's result to the next parser in the stack
This commit is contained in:
parent
580a71c997
commit
683c9df243
1 changed files with 6 additions and 5 deletions
|
@ -97,16 +97,17 @@ impl<T> Iterator for Parser<T> where T: Iterator<Item=LexerResult> {
|
||||||
Some(NodeParseResult::Complete{ obj }) => {
|
Some(NodeParseResult::Complete{ obj }) => {
|
||||||
println!("{:?} completed with {:?}", self.parsers.last().unwrap(), obj);
|
println!("{:?} completed with {:?}", self.parsers.last().unwrap(), obj);
|
||||||
self.pop_parser();
|
self.pop_parser();
|
||||||
if self.parsers.len() == 0 && input_lex.is_none() {
|
if self.parsers.len() == 0 {
|
||||||
// We are done.
|
println!("we are done parsing");
|
||||||
println!("we are done");
|
|
||||||
out = Some(Ok(obj));
|
out = Some(Ok(obj));
|
||||||
break;
|
break;
|
||||||
} else {
|
} else {
|
||||||
let prev_parser = self.parsers.last_mut().unwrap();
|
let prev_parser = self.parsers.last_mut().unwrap();
|
||||||
prev_parser.subparser_completed(obj);
|
println!("passing completed obj {:?} to previous parser {:?}", obj, prev_parser);
|
||||||
// TODO: Handle the result from above.
|
result = Some(prev_parser.subparser_completed(obj));
|
||||||
|
continue;
|
||||||
}
|
}
|
||||||
|
// TODO: This is dead code now... Is this correct?
|
||||||
println!("parsers {:?}", self.parsers);
|
println!("parsers {:?}", self.parsers);
|
||||||
self.next_lex()
|
self.next_lex()
|
||||||
},
|
},
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue