on master help sign in
Text.Lexer: move exact so it's with other basic ops
00dc543Michael Morgan
libs/contrib/Text/Lexer.idr+8−8
@@ -70,6 +70,14 @@ export
70isNot : Char -> Lexer
70isNot : Char -> Lexer
71isNot x = Pred (/=x)
71isNot x = Pred (/=x)
72
72
73+||| Recognise a specific string
74+export
75+exact : String -> Lexer
76+exact str with (unpack str)
77+ exact str | [] = Fail -- Not allowed, Lexer has to consume
78+ exact str | (x :: xs)
79+ = foldl SeqEmpty (is x) (map is xs)
80+
73||| Recognise a lexer or recognise no input. This is not guaranteed
81||| Recognise a lexer or recognise no input. This is not guaranteed
74||| to consume input
82||| to consume input
75export
83export
@@ -190,14 +198,6 @@ export
190digits : Lexer
198digits : Lexer
191digits = some digit
199digits = some digit
192
200
193−||| Recognise a specific string
194−export
195−exact : String -> Lexer
196−exact str with (unpack str)
197− exact str | [] = Fail -- Not allowed, Lexer has to consume
198− exact str | (x :: xs)
199− = foldl SeqEmpty (is x) (map is xs)
200−
201||| Recognise a single hexidecimal digit
201||| Recognise a single hexidecimal digit
202export
202export
203hexDigit : Lexer
203hexDigit : Lexer