2018-01-07 18:46:10 +00:00
|
|
|
use super::*;
|
|
|
|
|
|
|
|
pub(super) fn literal(p: &mut Parser) -> bool {
|
2018-01-20 18:49:58 +00:00
|
|
|
match p.current() {
|
2018-01-27 23:31:23 +00:00
|
|
|
TRUE_KW | FALSE_KW | INT_NUMBER | FLOAT_NUMBER | BYTE | CHAR | STRING | RAW_STRING
|
|
|
|
| BYTE_STRING | RAW_BYTE_STRING => {
|
2018-01-20 20:25:34 +00:00
|
|
|
let lit = p.start();
|
2018-01-20 18:49:58 +00:00
|
|
|
p.bump();
|
2018-01-20 20:25:34 +00:00
|
|
|
lit.complete(p, LITERAL);
|
2018-01-20 18:49:58 +00:00
|
|
|
true
|
|
|
|
}
|
2018-01-27 23:31:23 +00:00
|
|
|
_ => false,
|
2018-01-20 18:49:58 +00:00
|
|
|
}
|
|
|
|
}
|
2018-01-28 19:59:18 +00:00
|
|
|
|
|
|
|
pub(super) fn expr(p: &mut Parser) {
|
|
|
|
if !literal(p) {
|
2018-02-09 19:44:50 +00:00
|
|
|
p.error("expected expression");
|
2018-01-28 19:59:18 +00:00
|
|
|
}
|
|
|
|
}
|