List elements are now consistently separated by semicolons.

This commit is contained in:
Christian Rinderknecht 2019-03-26 17:25:42 +01:00
parent 4476a2faba
commit f9ffc7b8e7
No known key found for this signature in database
GPG Key ID: 9446816CFD267040
3 changed files with 15 additions and 8 deletions

4
AST.ml
View File

@ -639,7 +639,7 @@ and selection =
| Component of (Lexer.lexeme * Z.t) reg
and tuple_expr =
TupleInj of tuple_injection
TupleInj of tuple_injection
and tuple_injection = (expr, comma) nsepseq par reg
@ -673,7 +673,7 @@ and pattern =
| PTuple of (pattern, comma) nsepseq par reg
and list_pattern =
Sugar of (pattern, comma) sepseq brackets reg
Sugar of (pattern, semi) sepseq brackets reg
| Raw of (pattern * cons * pattern) par reg
(* Projecting regions *)

View File

@ -623,7 +623,7 @@ and selection =
| Component of (Lexer.lexeme * Z.t) reg
and tuple_expr =
TupleInj of tuple_injection
TupleInj of tuple_injection
and tuple_injection = (expr, comma) nsepseq par reg
@ -657,7 +657,7 @@ and pattern =
| PTuple of (pattern, comma) nsepseq par reg
and list_pattern =
Sugar of (pattern, comma) sepseq brackets reg
Sugar of (pattern, semi) sepseq brackets reg
| Raw of (pattern * cons * pattern) par reg
(* Projecting regions *)

View File

@ -528,6 +528,8 @@ map_patch:
in {region; value}
}
(* Note: [list_injection] and [set_injection] could be merged. *)
set_injection:
Set series(expr,End) {
let first, (others, terminator, closing) = $2 in
@ -930,8 +932,7 @@ core_expr:
| C_True { ELogic (BoolExpr (True $1)) }
| C_Unit { EUnit $1 }
| tuple_expr { ETuple $1 }
| list_expr { EList (List $1) }
| nil { EList (Nil $1) }
| list_expr { EList $1 }
| none_expr { EConstr (NoneExpr $1) }
| fun_call { ECall $1 }
| map_expr { EMap $1 }
@ -1015,6 +1016,12 @@ arguments:
tuple_inj { $1 }
list_expr:
list_injection { List $1 }
| nil { Nil $1 }
(* Note: [list_injection] and [set_injection] could be merged. *)
list_injection:
List series(expr,End) {
let first, (others, terminator, closing) = $2 in
let region = cover $1 closing
@ -1095,8 +1102,8 @@ core_pattern:
in PSome {region; value = $1,$2}}
list_patt:
brackets(sepseq(core_pattern,COMMA)) { Sugar $1 }
| par(cons_pattern) { Raw $1 }
brackets(sepseq(core_pattern,SEMI)) { Sugar $1 }
| par(cons_pattern) { Raw $1 }
cons_pattern:
core_pattern CONS pattern { $1,$2,$3 }