summaryrefslogtreecommitdiff
path: root/src/taiga.lalrpop
diff options
context:
space:
mode:
Diffstat (limited to 'src/taiga.lalrpop')
-rw-r--r--src/taiga.lalrpop4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/taiga.lalrpop b/src/taiga.lalrpop
index 68238eb..ffee4ee 100644
--- a/src/taiga.lalrpop
+++ b/src/taiga.lalrpop
@@ -84,11 +84,15 @@ ExpressionSign: Box<ast::WithLocation<ast::Expression>> = {
ExpressionBase: Box<ast::WithLocation<ast::Expression>> = {
Num => Box::new(<>.map(|v| ast::Expression::Number(v))),
+ String => Box::new(<>.map(|v| ast::Expression::String(v))),
Spanned<r"nil"> => Box::new(<>.map(|v| ast::Expression::Nil)),
"(" <Expression> ")" => <>,
};
Num: WithLocation<u64> = <e: Spanned<r"[0-9]+">> => e.map(|v| u64::from_str(v).unwrap());
+String: WithLocation<String> = <l: @L> <v:r##""(?:[^"\\]|\\\\)*""##> <r: @R> => {
+ WithLocation::new(v[1..v.len() - 1].to_owned(), l, r)
+};
Spanned<T>: WithLocation<T> = {
<l: @L> <v: T> <r: @R> => WithLocation::new(v, l, r)