File tree Expand file tree Collapse file tree 1 file changed +7
-1
lines changed Expand file tree Collapse file tree 1 file changed +7
-1
lines changed Original file line number Diff line number Diff line change @@ -16,12 +16,15 @@ import Control.Monad.Except
1616import Data. Char ( isSpace, toLower)
1717import Data. List ( dropWhileEnd)
1818import Data. Char ( chr )
19- import Numeric ( readDec )
19+ import Numeric ( readDec, readBin )
2020import Control. Monad ( when)
2121}
2222
2323% wrapper "monadUserState"
2424
25+ $bindigit = [ 01]
26+ $ octdigit = 0-7
27+ $ hexdigit = [ 0- 9A- Fa- f]
2528$ digit = 0-9
2629$ alpha = [ a- zA- Z]
2730$ alpha_ = [ $alpha \_ ]
@@ -110,6 +113,9 @@ tokens:-
110113<state_dclabel> "#null-confidentiality" { mkL TokenDCNullConf }
111114<state_dclabel> "#null-integrity" { mkL TokenDCNullInteg }
112115<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))))) }
113119<0> [ \< ][ \< ] { mkL TokenBinShiftLeft }
114120<0> [ \> ][ \> ] { mkL TokenBinShiftRight }
115121<0> [ \~ ][ \> ][ \> ] { mkL TokenBinZeroShiftRight }
You can’t perform that action at this time.
0 commit comments