Skip to content

Commit 2a620ec

Browse files
committed
Support for extended integer literal syntax should be implemented
1 parent 513d9f8 commit 2a620ec

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

compiler/src/Lexer.x

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -112,10 +112,10 @@ tokens:-
112112
<state_dclabel> "#root-integrity" { mkL TokenDCRootInteg }
113113
<state_dclabel> "#null-confidentiality" { mkL TokenDCNullConf }
114114
<state_dclabel> "#null-integrity" { mkL TokenDCNullInteg }
115-
<0> $digit+ { mkLs (\s -> TokenNum (read s)) }
116-
<0> 0[bB]$bindigit+ { mkLs (\s -> TokenNum (fst (head (readBin (drop 2 s))))) }
117-
<0> 0[oO]$octdigit+ { mkLs (\s -> TokenNum (fst (head (readOct (drop 2 s))))) }
118-
<0> 0[xX]$hexdigit+ { mkLs (\s -> TokenNum (fst (head (readHex (drop 2 s))))) }
115+
<0> $digit[\_$digit]* { mkLs (\s -> TokenNum (read (filter (/='_') s))) }
116+
<0> 0[bB]$bindigit[\_$bindigit]* { mkLs (\s -> TokenNum (fst (head (readBin (filter (/='_') (drop 2 s)))))) }
117+
<0> 0[oO]$octdigit[\_$octdigit]* { mkLs (\s -> TokenNum (fst (head (readOct (filter (/='_') (drop 2 s)))))) }
118+
<0> 0[xX]$hexdigit[\_$hexdigit]* { mkLs (\s -> TokenNum (fst (head (readHex (filter (/='_') (drop 2 s)))))) }
119119
<0> [\<][\<] { mkL TokenBinShiftLeft }
120120
<0> [\>][\>] { mkL TokenBinShiftRight }
121121
<0> [\~][\>][\>] { mkL TokenBinZeroShiftRight }
@@ -393,8 +393,6 @@ lexerError msg =
393393
trim = reverse . dropWhile (== ' ') . reverse . dropWhile (== ' ')
394394

395395

396-
397-
398396
-- we use a custom version of monadScan so that we have full
399397
-- control over the error reporting; this one is based on
400398
-- the built-in alexMonadScan

0 commit comments

Comments
 (0)