aboutsummaryrefslogtreecommitdiff
path: root/src/parser/grammar/expressions.rs
diff options
context:
space:
mode:
authorAleksey Kladov <[email protected]>2018-02-04 10:53:47 +0000
committerAleksey Kladov <[email protected]>2018-02-04 10:53:47 +0000
commitd94124e3b4a4380ad23c1a317fd3943664b7182a (patch)
treec11b5a548bac9dae6e77bead8f24db98dbea9dc8 /src/parser/grammar/expressions.rs
parenta40b715ce1cae4db1b4c3b4c383ee7517d4202c4 (diff)
Somewhat more san directory structure
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}