haskell-src-exts-1.13.5: Manipulating Haskell source: abstract syntax, lexer, parser, and pretty-printer

Portability | portable
Stability | stable
Maintainer | Niklas Broberg, niklas.broberg@chalmers.se
Safe Haskell | Safe-Infered

Language.Haskell.Exts.Lexer

Description

Lexer for Haskell with extensions.

Synopsis

- lexTokenStream :: String -> ParseResult [Loc Token]
- lexTokenStreamWithMode :: ParseMode -> String -> ParseResult [Loc Token]
- data Token
  - = VarId String
  - | QVarId (String, String)
  - | IDupVarId String
  - | ILinVarId String
  - | ConId String
  - | QConId (String, String)
  - | DVarId [String]
  - | VarSym String
  - | ConSym String
  - | QVarSym (String, String)
  - | QConSym (String, String)
  - | IntTok (Integer, String)
  - | FloatTok (Rational, String)
  - | Character (Char, String)
  - | StringTok (String, String)
  - | IntTokHash (Integer, String)
  - | WordTokHash (Integer, String)
  - | FloatTokHash (Rational, String)
  - | DoubleTokHash (Rational, String)
  - | CharacterHash (Char, String)
  - | StringHash (String, String)
  - | LeftParen
  - | RightParen
  - | LeftHashParen
  - | RightHashParen
  - | LeftCurlyBar
  - | RightCurlyBar
  - | SemiColon
  - | LeftCurly
  - | RightCurly
  - | VRightCurly
  - | LeftSquare
  - | RightSquare
  - | Comma
  - | Underscore
  - | BackQuote
  - | Dot
  - | DotDot
  - | Colon
  - | DoubleColon
  - | Equals
  - | Backslash
  - | Bar
  - | LeftArrow
  - | RightArrow
  - | At
  - | Tilde
  - | DoubleArrow
  - | Minus
  - | Exclamation
  - | Star
  - | LeftArrowTail
  - | RightArrowTail
  - | LeftDblArrowTail
  - | RightDblArrowTail
  - | THExpQuote
  - | THPatQuote
  - | THDecQuote
  - | THTypQuote
  - | THCloseQuote
  - | THIdEscape String
  - | THParenEscape
  - | THVarQuote
  - | THTyQuote
  - | THQuasiQuote (String, String)
  - | RPGuardOpen
  - | RPGuardClose
  - | RPCAt
  - | XCodeTagOpen
  - | XCodeTagClose
  - | XStdTagOpen
  - | XStdTagClose
  - | XCloseTagOpen
  - | XEmptyTagClose
  - | XChildTagOpen
  - | XPCDATA String
  - | XRPatOpen
  - | XRPatClose
  - | PragmaEnd
  - | RULES
  - | INLINE Bool
  - | INLINE_CONLIKE
  - | SPECIALISE
  - | SPECIALISE_INLINE Bool
  - | SOURCE
  - | DEPRECATED
  - | WARNING
  - | SCC
  - | GENERATED
  - | CORE
  - | UNPACK
  - | OPTIONS (Maybe String, String)
  - | LANGUAGE
  - | ANN
  - | KW_As
  - | KW_By
  - | KW_Case
  - | KW_Class
  - | KW_Data
  - | KW_Default
  - | KW_Deriving
  - | KW_Do
  - | KW_MDo
  - | KW_Else
  - | KW_Family
  - | KW_Forall
  - | KW_Group
  - | KW_Hiding
  - | KW_If
  - | KW_Import
  - | KW_In
  - | KW_Infix
  - | KW_InfixL
  - | KW_InfixR
  - | KW_Instance
  - | KW_Let
  - | KW_Module
  - | KW_NewType
  - | KW_Of
  - | KW_Proc
  - | KW_Rec
  - | KW_Then
  - | KW_Type
  - | KW_Using
  - | KW_Where
  - | KW_Qualified
  - | KW_Foreign
  - | KW_Export
  - | KW_Safe
  - | KW_Unsafe
  - | KW_Threadsafe
  - | KW_StdCall
  - | KW_CCall
  - | KW_CPlusPlus
  - | KW_DotNet
  - | KW_Jvm
  - | KW_Js
  - | EOF
- data Loc a = Loc {
  - loc :: SrcSpan
  - unLoc :: a
  }

# Documentation

lexTokenStream :: String -> ParseResult [Loc Token]

Lex a string into a list of Haskell 2010 source tokens.

lexTokenStreamWithMode :: ParseMode -> String -> ParseResult [Loc Token]

Lex a string into a list of Haskell source tokens, using an explicit mode.

data Token

Constructors

VarId String |
QVarId (String, String) |
IDupVarId String |
ILinVarId String |
ConId String |
QConId (String, String) |
DVarId [String] |
VarSym String |
ConSym String |
QVarSym (String, String) |
QConSym (String, String) |
IntTok (Integer, String) |
FloatTok (Rational, String) |
Character (Char, String) |
StringTok (String, String) |
IntTokHash (Integer, String) |
WordTokHash (Integer, String) |
FloatTokHash (Rational, String) |
DoubleTokHash (Rational, String) |
CharacterHash (Char, String) |
StringHash (String, String) |
LeftParen |
RightParen |
LeftHashParen |
RightHashParen |
LeftCurlyBar |
RightCurlyBar |
SemiColon |
LeftCurly |
RightCurly |
VRightCurly |
LeftSquare |
RightSquare |
Comma |
Underscore |
BackQuote |
Dot |
DotDot |
Colon |
DoubleColon |
Equals |
Backslash |
Bar |
LeftArrow |
RightArrow |
At |
Tilde |
DoubleArrow |
Minus |
Exclamation |
Star |
LeftArrowTail |
RightArrowTail |
LeftDblArrowTail |
RightDblArrowTail |
THExpQuote |
THPatQuote |
THDecQuote |
THTypQuote |
THCloseQuote |
THIdEscape String | ]
THParenEscape |
THVarQuote |
THTyQuote |
THQuasiQuote (String, String) |
RPGuardOpen |
RPGuardClose |
RPCAt | )
XCodeTagOpen |
XCodeTagClose |
XStdTagOpen |
XStdTagClose |
XCloseTagOpen |
XEmptyTagClose |
XChildTagOpen |
XPCDATA String |
XRPatOpen |
XRPatClose |
PragmaEnd |
RULES |
INLINE Bool |
INLINE_CONLIKE |
SPECIALISE |
SPECIALISE_INLINE Bool |
SOURCE |
DEPRECATED |
WARNING |
SCC |
GENERATED |
CORE |
UNPACK |
OPTIONS (Maybe String, String) |
LANGUAGE |
ANN |
KW_As |
KW_By |
KW_Case |
KW_Class |
KW_Data |
KW_Default |
KW_Deriving |
KW_Do |
KW_MDo |
KW_Else |
KW_Family |
KW_Forall |
KW_Group |
KW_Hiding |
KW_If |
KW_Import |
KW_In |
KW_Infix |
KW_InfixL |
KW_InfixR |
KW_Instance |
KW_Let |
KW_Module |
KW_NewType |
KW_Of |
KW_Proc |
KW_Rec |
KW_Then |
KW_Type |
KW_Using |
KW_Where |
KW_Qualified |
KW_Foreign |
KW_Export |
KW_Safe |
KW_Unsafe |
KW_Threadsafe |
KW_StdCall |
KW_CCall |
KW_CPlusPlus |
KW_DotNet |
KW_Jvm |
KW_Js |
EOF |

Instances

Eq Token |
Show Token |

data Loc a

An entity located in the source.

Constructors

Loc |
Fields loc :: SrcSpan unLoc :: a

Instances

Eq a => Eq (Loc a) |
Ord a => Ord (Loc a) |
Show a => Show (Loc a) |