on master help sign in
Text.Lexer: add alpha, alphas, alphaNum, and alphaNums
611c709Michael Morgan
libs/contrib/Text/Lexer.idr+20
@@ -162,6 +162,26 @@ exact str with (unpack str)
162 exact str | (x :: xs)
162 exact str | (x :: xs)
163 = foldl SeqEmpty (is x) (map is xs)
163 = foldl SeqEmpty (is x) (map is xs)
164
164
165+||| Recognise an alpha character
166+export
167+alpha : Lexer
168+alpha = pred isAlpha
169+
170+||| Recognise one or more alpha characters
171+export
172+alphas : Lexer
173+alphas = some alpha
174+
175+||| Recognise an alphanumeric character
176+export
177+alphaNum : Lexer
178+alphaNum = pred isAlphaNum
179+
180+||| Recognise one or more alphanumeric characters
181+export
182+alphaNums : Lexer
183+alphaNums = some alphaNum
184+
165||| Recognise a whitespace character
185||| Recognise a whitespace character
166export
186export
167space : Lexer
187space : Lexer