Copyright | (C) 2016-2025 David M. Johnson (@dmjio) |
---|---|
License | BSD3-style (see the file LICENSE) |
Maintainer | David M. Johnson <code@dmj.io> |
Stability | experimental |
Portability | non-portable |
Safe Haskell | None |
Language | Haskell2010 |
Miso.Util.Lexer
Contents
Description
Synopsis
- newtype Lexer token = Lexer {
- runLexer :: Stream -> Either LexerError (token, Stream)
- data Location = Location {}
- data Located token = Located {}
- data LexerError
- data Stream = Stream {}
- getStartColumn :: Location -> Int
- zeroLocation :: Location
- initialLocation :: Location
- mkStream :: MisoString -> Stream
- oops :: Lexer token
- streamError :: Stream -> LexerError
- string :: MisoString -> Lexer MisoString
- string' :: String -> Lexer String
- char :: Char -> Lexer Char
- satisfy :: (Char -> Bool) -> Lexer Char
- peek :: Lexer (Maybe Char)
- getInput :: Lexer Stream
- putInput :: Stream -> Lexer ()
- getLocation :: Lexer Location
- setLocation :: Location -> Lexer ()
- modifyInput :: (Stream -> Stream) -> Lexer ()
- withLocation :: ToMisoString token => Lexer token -> Lexer (Located token)
Types
data LexerError Source #
Constructors
LexerError MisoString Location | |
UnexpectedEOF Location |
Instances
Show LexerError Source # | |
Defined in Miso.Util.Lexer Methods showsPrec :: Int -> LexerError -> ShowS # show :: LexerError -> String # showList :: [LexerError] -> ShowS # | |
Eq LexerError Source # | |
Defined in Miso.Util.Lexer |
Constructors
Stream | |
Fields |
Combinators
getStartColumn :: Location -> Int Source #
mkStream :: MisoString -> Stream Source #
streamError :: Stream -> LexerError Source #
string :: MisoString -> Lexer MisoString Source #
setLocation :: Location -> Lexer () Source #
withLocation :: ToMisoString token => Lexer token -> Lexer (Located token) Source #