aboutsummaryrefslogtreecommitdiff
path: root/src/parser/grammar/expressions.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/parser/grammar/expressions.rs')
-rw-r--r--src/parser/grammar/expressions.rs20
1 files changed, 20 insertions, 0 deletions
diff --git a/src/parser/grammar/expressions.rs b/src/parser/grammar/expressions.rs
new file mode 100644
index 000000000..8caaf3553
--- /dev/null
+++ b/src/parser/grammar/expressions.rs
@@ -0,0 +1,20 @@
1use super::*;
2
3pub(super) fn literal(p: &mut Parser) -> bool {
4 match p.current() {
5 TRUE_KW | FALSE_KW | INT_NUMBER | FLOAT_NUMBER | BYTE | CHAR | STRING | RAW_STRING
6 | BYTE_STRING | RAW_BYTE_STRING => {
7 let lit = p.start();
8 p.bump();
9 lit.complete(p, LITERAL);
10 true
11 }
12 _ => false,
13 }
14}
15
16pub(super) fn expr(p: &mut Parser) {
17 if !literal(p) {
18 p.error().message("expected expression").emit();
19 }
20}