summaryrefslogtreecommitdiff
path: root/dhall/src/syntax/text/parser.rs
diff options
context:
space:
mode:
authorNadrieril2020-02-11 19:04:44 +0000
committerNadrieril2020-02-11 19:04:44 +0000
commit40bee3cdcb9ac0c76996feeceb6ca160a6bd8b42 (patch)
treecf764db516eee081be11587d66569961645a48eb /dhall/src/syntax/text/parser.rs
parentcab75190e86e8fd4ccc209499c0e7f300a669022 (diff)
Introduce LitKind to factor out common enum nodes
Diffstat (limited to 'dhall/src/syntax/text/parser.rs')
-rw-r--r--dhall/src/syntax/text/parser.rs11
1 files changed, 6 insertions, 5 deletions
diff --git a/dhall/src/syntax/text/parser.rs b/dhall/src/syntax/text/parser.rs
index 0ff1363..f3ebd2b 100644
--- a/dhall/src/syntax/text/parser.rs
+++ b/dhall/src/syntax/text/parser.rs
@@ -7,6 +7,7 @@ use pest_consume::{match_nodes, Parser};
use crate::syntax::map::{DupTreeMap, DupTreeSet};
use crate::syntax::ExprKind::*;
+use crate::syntax::LitKind::*;
use crate::syntax::{
Double, Expr, FilePath, FilePrefix, Hash, ImportLocation, ImportMode,
Integer, InterpolatedText, InterpolatedTextContents, Label, NaiveDouble,
@@ -344,8 +345,8 @@ impl DhallParser {
let e = match crate::syntax::Builtin::parse(s) {
Some(b) => Builtin(b),
None => match s {
- "True" => BoolLit(true),
- "False" => BoolLit(false),
+ "True" => Lit(Bool(true)),
+ "False" => Lit(Bool(false)),
"Type" => Const(crate::syntax::Const::Type),
"Kind" => Const(crate::syntax::Const::Kind),
"Sort" => Const(crate::syntax::Const::Sort),
@@ -833,9 +834,9 @@ impl DhallParser {
#[alias(expression, shortcut = true)]
fn primitive_expression(input: ParseInput) -> ParseResult<Expr> {
Ok(match_nodes!(input.children();
- [double_literal(n)] => spanned(input, DoubleLit(n)),
- [natural_literal(n)] => spanned(input, NaturalLit(n)),
- [integer_literal(n)] => spanned(input, IntegerLit(n)),
+ [double_literal(n)] => spanned(input, Lit(Double(n))),
+ [natural_literal(n)] => spanned(input, Lit(Natural(n))),
+ [integer_literal(n)] => spanned(input, Lit(Integer(n))),
[double_quote_literal(s)] => spanned(input, TextLit(s)),
[single_quote_literal(s)] => spanned(input, TextLit(s)),
[record_type_or_literal(e)] => spanned(input, e),