Text.Lexer: fix behavior of `surround`
`manyTill` is a `Recognise False`. It will recognise either nothing,
or any number of `l` followed by an `end`. This makes it unsuited for
`surround`, because the end character is required.
commit82a82ab758d684e8d3447353d51f9571ba539b29
authorMichael Morgan <morgan.michael@me.com>
dateSat 2 Sep 2017, 17:50 (9 years ago)
parent0482a74
libs/contrib/Text/Lexer.idr+1−1
@@ -291,7 +291,7 @@ symbols = some symbol
291291||| delimiting lexers
292292export
293293surround : (start : Lexer) -> (end : Lexer) -> (l : Lexer) -> Lexer
294−surround start end l = start <+> manyTill l end
294+surround start end l = start <+> many (reject end <+> l) <+> end
295295
296296||| Recognise zero or more occurrences of a sub-lexer surrounded
297297||| by the same quote lexer on both sides (useful for strings)