on master help sign in
Text.Lexer: refactoring
0482a74Michael Morgan
libs/contrib/Text/Lexer.idr+2−2
@@ -220,7 +220,7 @@ digits = some digit
220||| Recognise a single hexidecimal digit
220||| Recognise a single hexidecimal digit
221export
221export
222hexDigit : Lexer
222hexDigit : Lexer
223−hexDigit = digit <|> oneOf "abcdefABCDEF"
223+hexDigit = pred isHexDigit
224
224
225||| Recognise one or more hexidecimal digits
225||| Recognise one or more hexidecimal digits
226export
226export
@@ -325,7 +325,7 @@ intLit = opt (is '-') <+> digits
325||| Recognise a hexidecimal literal, prefixed by "0x" or "0X"
325||| Recognise a hexidecimal literal, prefixed by "0x" or "0X"
326export
326export
327hexLit : Lexer
327hexLit : Lexer
328−hexLit = is '0' <+> oneOf "xX" <+> hexDigits
328+hexLit = approx "0x" <+> hexDigits
329
329
330||| A mapping from lexers to the tokens they produce.
330||| A mapping from lexers to the tokens they produce.
331||| This is a list of pairs `(Lexer, String -> tokenType)`
331||| This is a list of pairs `(Lexer, String -> tokenType)`