From e7a58d09748bd333f755a06090f378e31dc6617a Mon Sep 17 00:00:00 2001 From: Nadrieril Date: Thu, 4 Apr 2019 22:28:00 +0200 Subject: Import union rules from upstream grammar --- dhall_parser/src/dhall.abnf | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) (limited to 'dhall_parser/src') diff --git a/dhall_parser/src/dhall.abnf b/dhall_parser/src/dhall.abnf index 01ec6d8..7ad0b24 100644 --- a/dhall_parser/src/dhall.abnf +++ b/dhall_parser/src/dhall.abnf @@ -688,17 +688,18 @@ union-type-or-literal = empty-union-type = "" non-empty-union-type-or-literal = - any-label whsp - ( "=" whsp expression union-type-entries - / ":" whsp1 expression [ whsp "|" whsp non-empty-union-type-or-literal ] - ) -union-type-entries = *(whsp "|" whsp union-type-entry) + any-label [ whsp ( union-literal-variant-value / union-type-or-literal-variant-type) ] + +; = True | ... +union-literal-variant-value = "=" whsp expression *(whsp "|" whsp union-type-entry) union-type-entry = any-label whsp ":" whsp1 expression -; "[1, 2, 3]" -; `empty-list-or-optional` handles empty lists -non-empty-list-literal = "[" whsp expression whsp *("," whsp expression whsp) "]" +; : Integer | ... +; | ... +union-type-or-literal-variant-type = [ ":" whsp1 expression ] [ whsp "|" whsp non-empty-union-type-or-literal ] +non-empty-list-literal = "[" whsp expression whsp *("," whsp expression whsp) "]" + ; This just adds surrounding whitespace for the top-level of the program complete-expression = whsp expression whsp -- cgit v1.2.3