From 3e4b2dcb8c371045737901c0d49f9d9403109ea0 Mon Sep 17 00:00:00 2001 From: Nadrieril Date: Thu, 4 Apr 2019 21:43:41 +0200 Subject: Get keyword rule from upstream --- dhall/src/normalize.rs | 2 +- dhall_parser/build.rs | 7 ------- dhall_parser/src/dhall.abnf | 9 +++++++++ dhall_parser/src/dhall.pest.visibility | 1 + 4 files changed, 11 insertions(+), 8 deletions(-) diff --git a/dhall/src/normalize.rs b/dhall/src/normalize.rs index a3a2318..d9bd08a 100644 --- a/dhall/src/normalize.rs +++ b/dhall/src/normalize.rs @@ -107,7 +107,7 @@ where break dhall_expr!( g (List a0) - (λ(a : a0) -> λ(as : List a1) -> [ a ] # as) + (λ(x : a0) -> λ(xs : List a1) -> [ x ] # xs) ([] : List a0) ); } diff --git a/dhall_parser/build.rs b/dhall_parser/build.rs index 4e75181..615a55c 100644 --- a/dhall_parser/build.rs +++ b/dhall_parser/build.rs @@ -40,13 +40,6 @@ fn main() -> std::io::Result<()> { | !keyword ~ simple_label_first_char ~ simple_label_next_char* }}" )?; - writeln!( - &mut file, - "keyword = _{{ - let_ | in_ | if_ | then - | else_ | Infinity | NaN - }}" - )?; writeln!( &mut file, "final_expression = ${{ SOI ~ complete_expression ~ EOI }}" diff --git a/dhall_parser/src/dhall.abnf b/dhall_parser/src/dhall.abnf index 4aa3fec..01ec6d8 100644 --- a/dhall_parser/src/dhall.abnf +++ b/dhall_parser/src/dhall.abnf @@ -291,6 +291,15 @@ Infinity = %x49.6e.66.69.6e.69.74.79 NaN = %x4e.61.4e Some = %x53.6f.6d.65 +; Unused rule that could be used as negative lookahead in the +; `simple-label` rule for parsers that support this. +keyword = + if / then / else + / let / in + / using / missing / as + / Infinity / NaN + / merge / Some + ; Reserved identifiers, only needed for some special cases of parsing Optional = %x4f.70.74.69.6f.6e.61.6c Text = %x54.65.78.74 diff --git a/dhall_parser/src/dhall.pest.visibility b/dhall_parser/src/dhall.pest.visibility index 63a4179..8205cc8 100644 --- a/dhall_parser/src/dhall.pest.visibility +++ b/dhall_parser/src/dhall.pest.visibility @@ -44,6 +44,7 @@ in_ # using merge # Infinity +# keyword Optional Text List -- cgit v1.2.3