commit 1005baab5b6a388d729a360ea35ceb69c3e6be7f
parent a4abdd731792df1883a9c19bba919ce96d50e7b6
Author: Drew DeVault <sir@cmpwn.com>
Date: Thu, 15 Apr 2021 12:01:44 -0400
hare::parse: make constant more concise
This list is unlikely to grow
Diffstat:
1 file changed, 4 insertions(+), 16 deletions(-)
diff --git a/hare/parse/expr.ha b/hare/parse/expr.ha
@@ -67,22 +67,10 @@ fn cast(lexer: *lex::lexer, lvalue: (ast::expr | void)) (ast::expr | error) = {
fn constant(lexer: *lex::lexer) (ast::expr | error) = {
let tok = want(lexer)?;
return switch (tok.0) {
- ltok::LIT_U8,
- ltok::LIT_U16,
- ltok::LIT_U32,
- ltok::LIT_U64,
- ltok::LIT_UINT,
- ltok::LIT_SIZE,
- ltok::LIT_I8,
- ltok::LIT_I16,
- ltok::LIT_I32,
- ltok::LIT_I64,
- ltok::LIT_INT,
- ltok::LIT_ICONST,
- ltok::LIT_F32,
- ltok::LIT_F64,
- ltok::LIT_FCONST,
- ltok::LIT_RUNE,
+ ltok::LIT_U8, ltok::LIT_U16, ltok::LIT_U32, ltok::LIT_U64,
+ ltok::LIT_UINT, ltok::LIT_SIZE, ltok::LIT_I8, ltok::LIT_I16,
+ ltok::LIT_I32, ltok::LIT_I64, ltok::LIT_INT, ltok::LIT_ICONST,
+ ltok::LIT_F32, ltok::LIT_F64, ltok::LIT_FCONST, ltok::LIT_RUNE,
ltok::LIT_STR => tok.1,
ltok::VOID => void,
ltok::TRUE => true,