Fixed arg list parsing
This commit is contained in:
parent
48ee6c9a75
commit
dffab8ae94
1
Grammar
1
Grammar
@ -12,6 +12,7 @@
|
|||||||
<fn_block> := fn <id> ( <arg_list> ) <statements> end
|
<fn_block> := fn <id> ( <arg_list> ) <statements> end
|
||||||
|
|
||||||
<arg_list> := e
|
<arg_list> := e
|
||||||
|
| <id>
|
||||||
| <id> , <arg_list>
|
| <id> , <arg_list>
|
||||||
|
|
||||||
<expr> := if <expr> then <statements> end
|
<expr> := if <expr> then <statements> end
|
||||||
|
@ -147,7 +147,11 @@ fn argument_list(tokens: &mut Tokens) -> ParseResult {
|
|||||||
Some(&Identifier(ref s)) => {
|
Some(&Identifier(ref s)) => {
|
||||||
args.push(s.clone());
|
args.push(s.clone());
|
||||||
tokens.next();
|
tokens.next();
|
||||||
expect!(Comma, tokens);
|
if let Some(&Comma) = tokens.peek().map(|i| i.clone()) {
|
||||||
|
tokens.next();
|
||||||
|
} else {
|
||||||
|
break;
|
||||||
|
}
|
||||||
},
|
},
|
||||||
_ => break
|
_ => break
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user