From e3cdf3f386b6a682981e6bdf6ca6d215b0d0788d Mon Sep 17 00:00:00 2001 From: Nadrieril Date: Thu, 25 Jun 2020 14:06:24 +0100 Subject: spec: not all ABNF parsers like empty rules --- dhall/src/syntax/text/dhall.abnf | 20 +++++++------------- 1 file changed, 7 insertions(+), 13 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 05d76e6..362a436 100644 --- a/dhall/src/syntax/text/dhall.abnf +++ b/dhall/src/syntax/text/dhall.abnf @@ -896,11 +896,9 @@ primitive-expression = record-type-or-literal = empty-record-literal - / non-empty-record-type-or-literal - / empty-record-type + / [non-empty-record-type-or-literal] empty-record-literal = "=" -empty-record-type = "" non-empty-record-type-or-literal = (non-empty-record-type / non-empty-record-literal) @@ -913,22 +911,18 @@ record-type-entry = any-label-or-some whsp ":" whsp1 expression non-empty-record-literal = record-literal-entry *(whsp "," whsp record-literal-entry) +; 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 }` record-literal-entry = - any-label-or-some (record-literal-normal-entry / record-literal-punned-entry) + any-label-or-some [record-literal-normal-entry] record-literal-normal-entry = *(whsp "." whsp any-label-or-some) whsp "=" whsp expression -record-literal-punned-entry = "" - +; If the `union-type-entry` is absent, that represents an empty union +; alternative, such as in `< Heads | Tails >` union-type = - non-empty-union-type - / empty-union-type - -empty-union-type = "" - -non-empty-union-type = - union-type-entry *(whsp "|" whsp union-type-entry) + [union-type-entry *(whsp "|" whsp union-type-entry)] ; x : Natural ; x -- cgit v1.2.3