@@ -70,6 +70,16 @@ export
70isNot : Char -> Lexer
70isNot : Char -> Lexer
71isNot x = Pred (/=x)
71isNot x = Pred (/=x)
73+||| Recognise a character case-insensitively
76+like x = Pred (\y => toUpper x == toUpper y)
78+||| Recognise anything but the given character case-insensitively
80+notLike : Char -> Lexer
81+notLike x = Pred (\y => toUpper x /= toUpper y)
73||| Recognise a specific string
83||| Recognise a specific string
75exact : String -> Lexer
85exact : String -> Lexer
@@ -78,6 +88,14 @@ exact str with (unpack str)
78 exact str | (x :: xs)
88 exact str | (x :: xs)
79 = foldl SeqEmpty (is x) (map is xs)
89 = foldl SeqEmpty (is x) (map is xs)
91+||| Recognise a specific string case-insensitively
93+approx : String -> Lexer
94+approx str with (unpack str)
95+ approx str | [] = Fail -- Not allowed, Lexer has to consume
96+ approx str | (x :: xs)
97+ = foldl SeqEmpty (like x) (map like xs)
81||| Recognise a lexer or recognise no input. This is not guaranteed
99||| Recognise a lexer or recognise no input. This is not guaranteed
82||| to consume input
100||| to consume input