Skip to content
Snippets Groups Projects

Allow dangling commas in argument lists

Merged Aaron Councilman requested to merge juno-dangling-comma into main
2 files
+ 7
8
Compare changes
  • Side-by-side
  • Inline
Files
2
+ 5
6
@@ -174,13 +174,12 @@ FuncDecl -> Result<Top, ()>
@@ -174,13 +174,12 @@ FuncDecl -> Result<Top, ()>
body : $11? }) }
body : $11? }) }
;
;
Arguments -> Result<Vec<(Option<Span>, VarBind)>, ()>
Arguments -> Result<Vec<(Option<Span>, VarBind)>, ()>
: { Ok(vec![]) }
: ArgumentsList { Ok($1?.into_iter().collect()) }
| ArgBind { Ok(vec![$1?]) }
| ArgumentsS ',' ArgBind { flatten($1, $3) }
;
;
ArgumentsS -> Result<Vec<(Option<Span>, VarBind)>, ()>
ArgumentsList -> Result<VecDeque<(Option<Span>, VarBind)>, ()>
: ArgBind { Ok(vec![$1?]) }
: { Ok(VecDeque::new()) }
| ArgumentsS ',' ArgBind { flatten($1, $3) }
| ArgBind { Ok(VecDeque::from([$1?])) }
 
| ArgBind ',' ArgumentsList { let mut lst = $3?; lst.push_front($1?); Ok(lst) }
;
;
ArgBind -> Result<(Option<Span>, VarBind), ()>
ArgBind -> Result<(Option<Span>, VarBind), ()>
: 'inout' VarBind { Ok((Some(span_of_tok($1)?), $2?)) }
: 'inout' VarBind { Ok((Some(span_of_tok($1)?), $2?)) }
Loading