on master help sign in
BREAKING Text.Lexer: rename symbol and space

`symbol` and `space` have been renamed to `symbols` and `spaces` for consistency, as they recognised sequences. Two new functions, `symbol` and `space`, have been added as singular versions of the above. Previously, the above functions had singular names but plural behavior. The documentation was also worded in a singular way. This was misleading and has been corrected. This breaks existing parsers that rely on these functions, obviously.

commit0488d1eea87822fe50df9fe04f2aa32ad4ed566f authorMichael Morgan <morgan.michael@me.com> dateSun 27 Aug 2017, 22:47 (9 years ago) parent55762f6
1 file changed+14−4
libs/contrib/Text/Lexer.idr+14−4
libs/contrib/Text/Lexer.idr+14−4
@@ -212,15 +212,25 @@ export
212212alphaNums : Lexer
213213alphaNums = some alphaNum
214214
215−||| Recognise a whitespace character
215+||| Recognise a single whitespace character
216216export
217217space : Lexer
218−space = some (pred isSpace)
218+space = pred isSpace
219219
220−||| Recognise a non-alphanumeric, non-whitespace character
220+||| Recognise one or more whitespace characters
221+export
222+spaces : Lexer
223+spaces = some space
224+
225+||| Recognise a single non-whitespace, non-alphanumeric character
221226export
222227symbol : Lexer
223−symbol = some (pred (\x => not (isAlphaNum x) && not (isSpace x)))
228+symbol = pred (\x => not (isSpace x || isAlphaNum x))
229+
230+||| Recognise one or more non-whitespace, non-alphanumeric characters
231+export
232+symbols : Lexer
233+symbols = some symbol
224234
225235||| Recognise zero or more occurrences of a sub-lexer between
226236||| delimiting lexers