Allow trailing comma in list and record grammars

This commit is contained in:
Brandon Dyck 2023-07-02 11:39:37 -06:00
parent 63edbae650
commit 5f9b4a2fb6

View File

@ -28,10 +28,10 @@ control ->
if -> "if" expression "then" expression "else" expression ;
when -> "when" expression "is" ( ( identifier | pattern ) "=>" expression )+ ;
variant -> "`" identifier ( "(" expression ")" )? ;
base_record -> expression ( "with" identifier "=" expression ( "," "with" identifier "=" expression )* )?
base_record -> expression ( "with" identifier "=" expression ( "," identifier "=" expression )* ","? )?
record ->
"{" ( identifier ("=" expression)? ( "," identifier ("=" expression)? )* )? ( "|" base_record )* "}" ;
list -> "[" ( expression ( "," expression )* )? "]" ;
"{" ( identifier ("=" expression)? ( "," identifier ("=" expression)? )* )? ( "|" base_record )? "}" ;
list -> "[" ( expression ( "," expression )* ","? )? "]" ;
identifier -> IDENTIFIER | "@" STRING ;
operand -> ( NUMBER | STRING | identifier | "(" expression ")" | record | variant | list) ;
selector -> "." identifier ;