diff options
author | Nadrieril | 2019-04-04 19:51:12 +0200 |
---|---|---|
committer | Nadrieril | 2019-04-04 20:24:30 +0200 |
commit | 2ef0951c45e3c9c87990ab7e334059aa9b21f540 (patch) | |
tree | 3a53797e9b2572fbc0fdb9c1c96e0b6c8b195071 /dhall_core | |
parent | f385e9dabfe3d923a841dc6d99542683cbbbb77a (diff) |
Tweak double literals
Diffstat (limited to 'dhall_core')
-rw-r--r-- | dhall_core/src/parser.rs | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/dhall_core/src/parser.rs b/dhall_core/src/parser.rs index f888f94..55fb177 100644 --- a/dhall_core/src/parser.rs +++ b/dhall_core/src/parser.rs @@ -406,7 +406,7 @@ make_parser! { token_rule!(minus_infinity_literal<()>); token_rule!(plus_infinity_literal<()>); - rule!(double_literal<core::Double>; + rule!(numeric_double_literal<core::Double>; captured_str!(s) => { let s = s.trim(); match s.parse::<f64>() { @@ -418,6 +418,13 @@ make_parser! { } ); + rule!(double_literal<core::Double>; children!( + [numeric_double_literal(n)] => n, + [minus_infinity_literal(n)] => std::f64::NEG_INFINITY.into(), + [plus_infinity_literal(n)] => std::f64::INFINITY.into(), + [NaN(n)] => std::f64::NAN.into(), + )); + rule!(natural_literal<core::Natural>; captured_str!(s) => { s.trim() @@ -737,11 +744,6 @@ make_parser! { rule!(literal_expression<ParsedExpr> as expression; children!( [double_literal(n)] => Expr::DoubleLit(n), - [minus_infinity_literal(n)] => - Expr::DoubleLit(std::f64::NEG_INFINITY.into()), - [plus_infinity_literal(n)] => - Expr::DoubleLit(std::f64::INFINITY.into()), - [NaN(n)] => Expr::DoubleLit(std::f64::NAN.into()), [natural_literal(n)] => Expr::NaturalLit(n), [integer_literal(n)] => Expr::IntegerLit(n), [double_quote_literal(s)] => Expr::TextLit(s), |