summaryrefslogtreecommitdiff
path: root/dhall_parser
diff options
context:
space:
mode:
Diffstat (limited to 'dhall_parser')
-rw-r--r--dhall_parser/build.rs10
-rw-r--r--dhall_parser/src/dhall.abnf10
-rw-r--r--dhall_parser/src/dhall.pest.visibility2
3 files changed, 18 insertions, 4 deletions
diff --git a/dhall_parser/build.rs b/dhall_parser/build.rs
index 3ca36b5..743aa2d 100644
--- a/dhall_parser/build.rs
+++ b/dhall_parser/build.rs
@@ -38,8 +38,14 @@ fn main() -> std::io::Result<()> {
let mut file = File::create(pest_path)?;
writeln!(&mut file, "// AUTO-GENERATED FILE. See build.rs.")?;
writeln!(&mut file, "{}", abnf_to_pest(&data, &rule_settings)?)?;
- writeln!(&mut file, "keyword_raw = _{{ let_raw | in_raw | if_raw | then_raw | else_raw }}")?;
- writeln!(&mut file, "final_expression = {{ SOI ~ complete_expression ~ EOI }}")?;
+ writeln!(&mut file, "keyword_raw = _{{
+ let_raw | in_raw | if_raw | then_raw
+ | else_raw | Infinity_raw | NaN_raw
+ }}")?;
+ writeln!(
+ &mut file,
+ "final_expression = {{ SOI ~ complete_expression ~ EOI }}"
+ )?;
Ok(())
}
diff --git a/dhall_parser/src/dhall.abnf b/dhall_parser/src/dhall.abnf
index e311aa6..76af24b 100644
--- a/dhall_parser/src/dhall.abnf
+++ b/dhall_parser/src/dhall.abnf
@@ -279,6 +279,7 @@ Optional-raw = %x4f.70.74.69.6f.6e.61.6c
Text-raw = %x54.65.78.74
List-raw = %x4c.69.73.74
Infinity-raw = %x49.6e.66.69.6e.69.74.79
+NaN-raw = %x4e.61.4e
; Whitespaced rules for reserved words, to be used when matching expressions
if = if-raw nonempty-whitespace
@@ -648,7 +649,11 @@ literal-expression-raw =
/ integer-literal-raw
; "-Infinity"
- / "-" Infinity-raw
+ / minus-infinity-literal
+ ; "Infinity"
+ / plus-infinity-literal
+ ; "NaN"
+ / NaN-raw
; '"ABC"'
/ text-literal-raw
@@ -657,6 +662,9 @@ literal-expression-raw =
; "x@2"
/ identifier-raw
+minus-infinity-literal = "-" Infinity-raw
+plus-infinity-literal = Infinity-raw
+
; "{ foo = 1 , bar = True }"
; "{ foo : Integer, bar : Bool }"
record-type-or-literal =
diff --git a/dhall_parser/src/dhall.pest.visibility b/dhall_parser/src/dhall.pest.visibility
index b3a2660..08171b3 100644
--- a/dhall_parser/src/dhall.pest.visibility
+++ b/dhall_parser/src/dhall.pest.visibility
@@ -37,7 +37,7 @@ single_quote_literal
# Optional_raw
# Text_raw
# List_raw
-Infinity_raw
+# Infinity_raw
# if_
# then
# else_