Fixed arg list parsing

This commit is contained in:
greg 2015-08-08 17:58:51 -07:00
parent 48ee6c9a75
commit dffab8ae94
2 changed files with 6 additions and 1 deletions

View File

@ -12,6 +12,7 @@
<fn_block> := fn <id> ( <arg_list> ) <statements> end
<arg_list> := e
| <id>
| <id> , <arg_list>
<expr> := if <expr> then <statements> end

View File

@ -147,7 +147,11 @@ fn argument_list(tokens: &mut Tokens) -> ParseResult {
Some(&Identifier(ref s)) => {
args.push(s.clone());
tokens.next();
expect!(Comma, tokens);
if let Some(&Comma) = tokens.peek().map(|i| i.clone()) {
tokens.next();
} else {
break;
}
},
_ => break
}