summaryrefslogtreecommitdiff
path: root/dhall/src/syntax
diff options
context:
space:
mode:
authorNadrieril2020-06-25 18:48:43 +0100
committerNadrieril2020-06-25 18:48:43 +0100
commit51389702f26d25eb78f9e848f478cf2640544a29 (patch)
tree42cbcc2e0d7bc09ada7de3a38c94288aa321527c /dhall/src/syntax
parentd2d8ab436021cee48fc61d4d2bb04d2e09159ec6 (diff)
spec: allow trailing delimiters
Diffstat (limited to 'dhall/src/syntax')
-rw-r--r--dhall/src/syntax/text/dhall.abnf13
1 files changed, 7 insertions, 6 deletions
diff --git a/dhall/src/syntax/text/dhall.abnf b/dhall/src/syntax/text/dhall.abnf
index 37ec43b..2d487f5 100644
--- a/dhall/src/syntax/text/dhall.abnf
+++ b/dhall/src/syntax/text/dhall.abnf
@@ -853,7 +853,8 @@ selector-expression = primitive-expression *(whsp "." whsp selector)
selector = any-label / labels / type-selector
-labels = "{" whsp [ any-label-or-some whsp *("," whsp any-label-or-some whsp) ] "}"
+labels =
+ "{" whsp [ "," whsp ] [ any-label-or-some whsp *("," whsp any-label-or-some whsp) [ "," whsp ] ] "}"
type-selector = "(" whsp expression whsp ")"
; NOTE: Backtrack when parsing the first three alternatives (i.e. the numeric
@@ -894,18 +895,18 @@ record-type-or-literal =
empty-record-literal
/ [non-empty-record-type-or-literal]
-empty-record-literal = "="
+empty-record-literal = "=" [ whsp "," ]
non-empty-record-type-or-literal =
(non-empty-record-type / non-empty-record-literal)
non-empty-record-type =
- record-type-entry *(whsp "," whsp record-type-entry)
+ record-type-entry *(whsp "," whsp record-type-entry) [ whsp "," ]
record-type-entry = any-label-or-some whsp ":" whsp1 expression
non-empty-record-literal =
- record-literal-entry *(whsp "," whsp record-literal-entry)
+ record-literal-entry *(whsp "," whsp record-literal-entry) [ whsp "," ]
; If the `record-literal-normal-entry` is absent, that represents a punned
; record entry, such as in `{ x }`, which is a short-hand for `{ x = x }`
@@ -918,7 +919,7 @@ record-literal-normal-entry =
; If the `union-type-entry` is absent, that represents an empty union
; alternative, such as in `< Heads | Tails >`
union-type =
- [union-type-entry *(whsp "|" whsp union-type-entry)]
+ [union-type-entry *(whsp "|" whsp union-type-entry) [ whsp "|" ]]
; x : Natural
; x
@@ -926,7 +927,7 @@ union-type-entry = any-label-or-some [ whsp ":" whsp1 expression ]
non-empty-list-literal =
- "[" whsp [ "," whsp ] expression whsp *("," whsp expression whsp) "]"
+ "[" whsp [ "," whsp ] expression whsp *("," whsp expression whsp) [ "," whsp ] "]"
; This just adds surrounding whitespace for the top-level of the program
complete-expression = whsp expression whsp