From 51389702f26d25eb78f9e848f478cf2640544a29 Mon Sep 17 00:00:00 2001 From: Nadrieril Date: Thu, 25 Jun 2020 18:48:43 +0100 Subject: spec: allow trailing delimiters --- dhall/src/syntax/text/dhall.abnf | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'dhall/src/syntax/text/dhall.abnf') 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 -- cgit v1.2.3