[Haskell-beginners] Parsing keywords
mike_k_houghton at yahoo.co.uk
Sun Oct 4 15:25:09 UTC 2015
Thanks. I’ll try that.
> On 3 Oct 2015, at 10:21, Francesco Ariis <fa-ml at ariis.it> wrote:
> On Sat, Oct 03, 2015 at 10:12:20AM +0100, Mike Houghton wrote:
>> What is the idiomatic way of parsing keywords, in a case agnostic
>> fashion, for a ‘mini-language’?
> I lifted this from `Text.ParserCombinators.Parsec.Rfc2234` and used it
> in a project of mine (lentil).
> ciString s = mapM ciChar s <?> "case insensitive string"
> ciChar :: Char -> ParIssue Char
> ciChar c = char (C.toLower c) <|> char (C.toUpper c)
> This assumes you are using Parsec parsing library.
> Beginners mailing list
> Beginners at haskell.org
More information about the Beginners