FEATURE: Allow trailing commas in map, filter, and reduce expressions.

This commit is contained in:
Jeremy Wall 2019-02-27 19:19:44 -06:00
parent 2134d79f0d
commit 00cc246903

View File

@ -563,6 +563,7 @@ fn call_expression(input: SliceIter<Token>) -> Result<SliceIter<Token>, Expressi
callee_name => trace_parse!(symbol), callee_name => trace_parse!(symbol),
_ => punct!("("), _ => punct!("("),
args => optional!(separated!(punct!(","), trace_parse!(expression))), args => optional!(separated!(punct!(","), trace_parse!(expression))),
_ => optional!(punct!(",")),
_ => must!(punct!(")")), _ => must!(punct!(")")),
(callee_name, args) (callee_name, args)
); );
@ -592,6 +593,7 @@ make_fn!(
acc => must!(trace_parse!(expression)), acc => must!(trace_parse!(expression)),
_ => must!(punct!(",")), _ => must!(punct!(",")),
tgt => must!(trace_parse!(expression)), tgt => must!(trace_parse!(expression)),
_ => optional!(punct!(",")),
_ => must!(punct!(")")), _ => must!(punct!(")")),
(Expression::FuncOp(FuncOpDef::Reduce(ReduceOpDef{ (Expression::FuncOp(FuncOpDef::Reduce(ReduceOpDef{
func: Box::new(func), func: Box::new(func),
@ -611,6 +613,7 @@ make_fn!(
func => must!(expression), func => must!(expression),
_ => must!(punct!(",")), _ => must!(punct!(",")),
list => must!(trace_parse!(expression)), list => must!(trace_parse!(expression)),
_ => optional!(punct!(",")),
_ => must!(punct!(")")), _ => must!(punct!(")")),
(Expression::FuncOp(FuncOpDef::Map(MapFilterOpDef{ (Expression::FuncOp(FuncOpDef::Map(MapFilterOpDef{
func: Box::new(func), func: Box::new(func),
@ -629,6 +632,7 @@ make_fn!(
func => must!(expression), func => must!(expression),
_ => must!(punct!(",")), _ => must!(punct!(",")),
list => must!(trace_parse!(expression)), list => must!(trace_parse!(expression)),
_ => optional!(punct!(",")),
_ => must!(punct!(")")), _ => must!(punct!(")")),
(Expression::FuncOp(FuncOpDef::Filter(MapFilterOpDef{ (Expression::FuncOp(FuncOpDef::Filter(MapFilterOpDef{
func: Box::new(func), func: Box::new(func),