Lexer

ghc-7.8.2: The GHC API

Safe Haskell | None
Language | Haskell98

Lexer

# Documentation

data Token Source

Constructors

ITas |
ITcase |
ITclass |
ITdata |
ITdefault |
ITderiving |
ITdo |
ITelse |
IThiding |
ITif |
ITimport |
ITin |
ITinfix |
ITinfixl |
ITinfixr |
ITinstance |
ITlet |
ITmodule |
ITnewtype |
ITof |
ITqualified |
ITthen |
ITtype |
ITwhere |
ITforall |
ITforeign |
ITexport |
ITlabel |
ITdynamic |
ITsafe |
ITinterruptible |
ITunsafe |
ITstdcallconv |
ITccallconv |
ITcapiconv |
ITprimcallconv |
ITjavascriptcallconv |
ITmdo |
ITfamily |
ITrole |
ITgroup |
ITby |
ITusing |
ITpattern |
ITinline_prag InlineSpec RuleMatchInfo |
ITspec_prag |
ITspec_inline_prag Bool |
ITsource_prag |
ITrules_prag |
ITwarning_prag |
ITdeprecated_prag |
ITline_prag |
ITscc_prag |
ITgenerated_prag |
ITcore_prag |
ITunpack_prag |
ITnounpack_prag |
ITann_prag |
ITclose_prag |
IToptions_prag String |
ITinclude_prag String |
ITlanguage_prag |
ITvect_prag |
ITvect_scalar_prag |
ITnovect_prag |
ITminimal_prag |
ITctype |
ITdotdot |
ITcolon |
ITdcolon |
ITequal |
ITlam |
ITlcase |
ITvbar |
ITlarrow |
ITrarrow |
ITat |
ITtilde |
ITtildehsh |
ITdarrow |
ITminus |
ITbang |
ITstar |
ITdot |
ITbiglam |
ITocurly |
ITccurly |
ITvocurly |
ITvccurly |
ITobrack |
ITopabrack |
ITcpabrack |
ITcbrack |
IToparen |
ITcparen |
IToubxparen |
ITcubxparen |
ITsemi |
ITcomma |
ITunderscore |
ITbackquote |
ITsimpleQuote |
ITvarid FastString |
ITconid FastString |
ITvarsym FastString |
ITconsym FastString |
ITqvarid (FastString, FastString) |
ITqconid (FastString, FastString) |
ITqvarsym (FastString, FastString) |
ITqconsym (FastString, FastString) |
ITprefixqvarsym (FastString, FastString) |
ITprefixqconsym (FastString, FastString) |
ITdupipvarid FastString |
ITchar Char |
ITstring FastString |
ITinteger Integer |
ITrational FractionalLit |
ITprimchar Char |
ITprimstring ByteString |
ITprimint Integer |
ITprimword Integer |
ITprimfloat FractionalLit |
ITprimdouble FractionalLit |
ITopenExpQuote |
ITopenPatQuote |
ITopenDecQuote |
ITopenTypQuote |
ITcloseQuote |
ITopenTExpQuote |
ITcloseTExpQuote |
ITidEscape FastString |
ITparenEscape |
ITidTyEscape FastString |
ITparenTyEscape |
ITtyQuote |
ITquasiQuote (FastString, FastString, RealSrcSpan) |
ITqQuasiQuote (FastString, FastString, FastString, RealSrcSpan) |
ITproc |
ITrec |
IToparenbar |
ITcparenbar |
ITlarrowtail |
ITrarrowtail |
ITLarrowtail |
ITRarrowtail |
ITunknown String |
ITeof |
ITdocCommentNext String |
ITdocCommentPrev String |
ITdocCommentNamed String |
ITdocSection Int String |
ITdocOptions String |
ITdocOptionsOld String |
ITlineComment String |
ITblockComment String |

Instances

Show Token |

lexer :: (Located Token -> P a) -> P a Source

pragState :: DynFlags -> StringBuffer -> RealSrcLoc -> PState Source

mkPState :: DynFlags -> StringBuffer -> RealSrcLoc -> PState Source

data PState Source

Constructors

PState |
Fields buffer :: StringBuffer dflags :: DynFlags messages :: Messages last_tk :: Maybe Token last_loc :: RealSrcSpan last_len :: !Int loc :: RealSrcLoc extsBitmap :: !Int context :: [LayoutContext] lex_state :: [Int] srcfiles :: [FastString] alr_pending_implicit_tokens :: [RealLocated Token] alr_next_token :: Maybe (RealLocated Token) alr_last_loc :: RealSrcSpan alr_context :: [ALRContext] alr_expecting_ocurly :: Maybe ALRLayout alr_justClosedExplicitLetBlock :: Bool

newtype P a Source

Constructors

P |
Fields unP :: PState -> ParseResult a

Instances

Monad P |
HasDynFlags P |

data ParseResult a Source

Constructors

POk PState a |
PFailed SrcSpan MsgDoc |

getSrcLoc :: P RealSrcLoc Source

getPState :: P PState Source

getDynFlags :: HasDynFlags m => m DynFlags Source

withThisPackage :: (PackageId -> a) -> P a Source

failLocMsgP :: RealSrcLoc -> RealSrcLoc -> String -> P a Source

failSpanMsgP :: SrcSpan -> SDoc -> P a Source

srcParseFail :: P a Source

getMessages :: PState -> Messages Source

popContext :: P () Source

pushCurrentContext :: P () Source

setLastToken :: RealSrcSpan -> Int -> P () Source

setSrcLoc :: RealSrcLoc -> P () Source

activeContext :: P Bool Source

nextIsEOF :: P Bool Source

getLexState :: P Int Source

popLexState :: P Int Source

pushLexState :: Int -> P () Source

extension :: (Int -> Bool) -> P Bool Source

bangPatEnabled :: Int -> Bool Source

datatypeContextsEnabled :: Int -> Bool Source

traditionalRecordSyntaxEnabled :: Int -> Bool Source

typeLiteralsEnabled :: Int -> Bool Source

explicitForallEnabled :: Int -> Bool Source

inRulePrag :: Int -> Bool Source

explicitNamespacesEnabled :: Int -> Bool Source

patternSynonymsEnabled :: Int -> Bool Source

sccProfilingOn :: Int -> Bool Source

hpcEnabled :: Int -> Bool Source

addWarning :: WarningFlag -> SrcSpan -> SDoc -> P () Source

lexTokenStream :: StringBuffer -> RealSrcLoc -> DynFlags -> ParseResult [Located Token] Source