From 5289b078e80328de0169c77931fa1cc293e8c196 Mon Sep 17 00:00:00 2001 From: Jari Vetoniemi Date: Wed, 26 Sep 2018 20:08:42 +0300 Subject: types.lm: use lex blocks So the matcher wont include the tokens used by other tokens --- src/compiler/types.lm | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) (limited to 'src/compiler') 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? -- cgit v1.2.3-70-g09d2