on master help sign in
Text.Lexer: add `control` and `controls` lexers

These are based on `Prelude.Chars.isControl`.

commit905b7fc0c4dc231b508b8d8b4f3066ef8d310f66 authorMichael Morgan <morgan.michael@me.com> dateMon 4 Dec 2017, 11:39 (9 years ago) parent72937bb
1 file changed+8
libs/contrib/Text/Lexer.idr+8
libs/contrib/Text/Lexer.idr+8
@@ -197,6 +197,14 @@ symbol = pred (\x => not (isSpace x || isAlphaNum x))
197197symbols : Lexer
198198symbols = some symbol
199199
200+||| Recognise a single control character
201+control : Lexer
202+control = pred isControl
203+
204+||| Recognise one or more control characters
205+controls : Lexer
206+controls = some control
207+
200208||| Recognise zero or more occurrences of a sub-lexer between
201209||| delimiting lexers
202210surround : (start : Lexer) -> (end : Lexer) -> (l : Lexer) -> Lexer