Portability | GHC |
---|---|
Stability | highly unstable |
Maintainer | Stephen Tetley <stephen.tetley@gmail.com> |
Safe Haskell | Safe-Infered |
Generally you should expect to import this module qualified and define versions to consume trailing white-space.
lexDef :: P.LexemeParser lexDef = P.commentLineLexemeParser "Comment" [' ', '\t'] lexeme :: CharParser a -> CharParser a lexeme = P.lexeme lexDef integer :: CharParser Int integer = lexeme P.integer
- data LexemeParser
- spaceLexemeParser :: LexemeParser
- spaceCharLexemeParser :: [Char] -> LexemeParser
- commentLexemeParser :: String -> (String, String) -> [Char] -> LexemeParser
- commentLineLexemeParser :: String -> [Char] -> LexemeParser
- commentMultiLexemeParser :: String -> String -> [Char] -> LexemeParser
- lexeme :: LexemeParser -> CharParser a -> CharParser a
- whiteSpace :: LexemeParser -> CharParser ()
- octBase :: CharParser Int
- octHask :: CharParser Int
- hexBase :: CharParser Int
- natural :: CharParser Integer
- integer :: CharParser Integer
- double :: CharParser Double
Documentation
data LexemeParser Source
Opaque type representing a parser that consumes arbitrary space.
Unlike Parsec's lexeme parser, this can be customized so that e.g. newlines are not consumed as white space.
spaceLexemeParser :: LexemeParserSource
Build a lexeme parser that handles space.
Space is zero or more elements matching the isSpace
predicate from Data.Char
.
spaceCharLexemeParser :: [Char] -> LexemeParserSource
Build a lexeme parser that handles arbitrary space.
space is parametric, for instance this can manufacture a lexeme parser that consumes space and tab chars but not newline.
commentLexemeParser :: String -> (String, String) -> [Char] -> LexemeParserSource
Build a lexeme parser that handles start-and-end delimited comments and arbitrary space.
commentLineLexemeParser :: String -> [Char] -> LexemeParserSource
Build a lexeme parser that handles line spanning comments an arbitrary space.
commentMultiLexemeParser :: String -> String -> [Char] -> LexemeParserSource
Build a lexeme parser that handles start-and-end delimited comments, line comments and arbitrary space.
lexeme :: LexemeParser -> CharParser a -> CharParser aSource
Wrap a CharParser with a lexeme parser, the CharParser will consume trailing space according to the strategy of the LexemeParser.