summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJari Vetoniemi <mailroxas@gmail.com>2018-09-26 20:08:42 +0300
committerJari Vetoniemi <mailroxas@gmail.com>2018-09-26 20:08:42 +0300
commit5289b078e80328de0169c77931fa1cc293e8c196 (patch)
tree82c7d513a4a5b0f7cc94d96111003c5df2d542df
parent1e39ef27a14a498bfc578aafe5c36f86cb76edd2 (diff)
types.lm: use lex blocks
So the matcher wont include the tokens used by other tokens
-rw-r--r--src/compiler/types.lm24
1 files changed, 15 insertions, 9 deletions
diff --git a/src/compiler/types.lm b/src/compiler/types.lm
index c4982ac..b33adf7 100644
--- a/src/compiler/types.lm
+++ b/src/compiler/types.lm
@@ -5,10 +5,13 @@ token WS / space /
context number
context unsigned
- literal `true `false
- token OCT / '0'[0-7]+ /
- token DEC / [0-9]+ /
- token HEX / '0x' xdigit+ /
+ lex
+ literal `true `false
+ token OCT / '0'[0-7]+ /
+ token DEC / [0-9]+ /
+ token HEX / '0x' xdigit+ /
+ end
+
int strtoull(a:str, b:int) = c_strtoull
def type
@@ -34,11 +37,14 @@ end
context string
rl ESC / '\\' /
- token ESC_CHR / ESC [abfnrtv\\'"e] /
- token ESC_HEX / ESC 'x' xdigit{2} /
- token ESC_OCT / ESC [0-7]{1,3} /
- token CHAR / ^cntrl - ['"] - ESC /
- literal `' `"
+
+ lex
+ literal `' `"
+ token ESC_CHR / ESC [abfnrtv\\'"e] /
+ token ESC_HEX / ESC 'x' xdigit{2} /
+ token ESC_OCT / ESC [0-7]{1,3} /
+ token CHAR / ^cntrl /
+ end
def raw
[ESC_CHR] # TODO: how to output raw bytes?