Safe Haskell | Safe |
---|---|
Language | Haskell98 |
Character based scanners.
Synopsis
- module Text.Lexer.Inchworm
- scanStringIO :: String -> Scanner IO Location String a -> IO ([a], Location, String)
- data Range loc = Range !loc !loc
- data Location = Location !Int !Int
- bumpLocationWithChar :: Char -> Location -> Location
- scanInteger :: Monad m => Scanner m loc [Char] (Range loc, Integer)
- scanHaskellChar :: Monad m => Scanner m loc [Char] (Range loc, Char)
- scanHaskellString :: Monad m => Scanner m loc [Char] (Range loc, String)
- scanHaskellCommentBlock :: Monad m => Scanner m loc [Char] (Range loc, String)
- scanHaskellCommentLine :: Monad m => Scanner m loc [Char] (Range loc, String)
Documentation
module Text.Lexer.Inchworm
Driver
scanStringIO :: String -> Scanner IO Location String a -> IO ([a], Location, String) Source #
Scan a string, using the IO monad to maintain internal state.
Locations
A range of locations in a source file.
Range !loc !loc |
A location in a source file.
bumpLocationWithChar :: Char -> Location -> Location Source #
Bump a location using the given character, updating the line and column number as appropriate.
Scanners
scanInteger :: Monad m => Scanner m loc [Char] (Range loc, Integer) Source #
Scan a decimal integer, with optional -
and +
sign specifiers.
scanHaskellChar :: Monad m => Scanner m loc [Char] (Range loc, Char) Source #
Scan a literal character, enclosed in single quotes.
We handle the escape codes listed in Section 2.6 of the Haskell Report.
scanHaskellString :: Monad m => Scanner m loc [Char] (Range loc, String) Source #
Scan a literal string, enclosed in double quotes.
We handle the escape codes listed in Section 2.6 of the Haskell Report.