Safe Haskell | None |
---|---|
Language | Haskell2010 |
Synopsis
- data Token
- = ITas
- | ITcase
- | ITclass
- | ITdata
- | ITdefault
- | ITderiving
- | ITdo
- | ITelse
- | IThiding
- | ITforeign
- | ITif
- | ITimport
- | ITin
- | ITinfix
- | ITinfixl
- | ITinfixr
- | ITinstance
- | ITlet
- | ITmodule
- | ITnewtype
- | ITof
- | ITqualified
- | ITthen
- | ITtype
- | ITwhere
- | ITforall IsUnicodeSyntax
- | ITexport
- | ITlabel
- | ITdynamic
- | ITsafe
- | ITinterruptible
- | ITunsafe
- | ITstdcallconv
- | ITccallconv
- | ITcapiconv
- | ITprimcallconv
- | ITjavascriptcallconv
- | ITmdo
- | ITfamily
- | ITrole
- | ITgroup
- | ITby
- | ITusing
- | ITpattern
- | ITstatic
- | ITstock
- | ITanyclass
- | ITvia
- | ITunit
- | ITsignature
- | ITdependency
- | ITrequires
- | ITinline_prag SourceText InlineSpec RuleMatchInfo
- | ITspec_prag SourceText
- | ITspec_inline_prag SourceText Bool
- | ITsource_prag SourceText
- | ITrules_prag SourceText
- | ITwarning_prag SourceText
- | ITdeprecated_prag SourceText
- | ITline_prag SourceText
- | ITcolumn_prag SourceText
- | ITscc_prag SourceText
- | ITgenerated_prag SourceText
- | ITcore_prag SourceText
- | ITunpack_prag SourceText
- | ITnounpack_prag SourceText
- | ITann_prag SourceText
- | ITcomplete_prag SourceText
- | ITclose_prag
- | IToptions_prag String
- | ITinclude_prag String
- | ITlanguage_prag
- | ITminimal_prag SourceText
- | IToverlappable_prag SourceText
- | IToverlapping_prag SourceText
- | IToverlaps_prag SourceText
- | ITincoherent_prag SourceText
- | ITctype SourceText
- | ITdotdot
- | ITcolon
- | ITdcolon IsUnicodeSyntax
- | ITequal
- | ITlam
- | ITlcase
- | ITvbar
- | ITlarrow IsUnicodeSyntax
- | ITrarrow IsUnicodeSyntax
- | ITat
- | ITtilde
- | ITdarrow IsUnicodeSyntax
- | ITminus
- | ITbang
- | ITstar IsUnicodeSyntax
- | 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)
- | ITdupipvarid FastString
- | ITlabelvarid FastString
- | ITchar SourceText Char
- | ITstring SourceText FastString
- | ITinteger IntegralLit
- | ITrational FractionalLit
- | ITprimchar SourceText Char
- | ITprimstring SourceText ByteString
- | ITprimint SourceText Integer
- | ITprimword SourceText Integer
- | ITprimfloat FractionalLit
- | ITprimdouble FractionalLit
- | ITopenExpQuote HasE IsUnicodeSyntax
- | ITopenPatQuote
- | ITopenDecQuote
- | ITopenTypQuote
- | ITcloseQuote IsUnicodeSyntax
- | ITopenTExpQuote HasE
- | ITcloseTExpQuote
- | ITidEscape FastString
- | ITparenEscape
- | ITidTyEscape FastString
- | ITparenTyEscape
- | ITtyQuote
- | ITquasiQuote (FastString, FastString, RealSrcSpan)
- | ITqQuasiQuote (FastString, FastString, FastString, RealSrcSpan)
- | ITproc
- | ITrec
- | IToparenbar IsUnicodeSyntax
- | ITcparenbar IsUnicodeSyntax
- | ITlarrowtail IsUnicodeSyntax
- | ITrarrowtail IsUnicodeSyntax
- | ITLarrowtail IsUnicodeSyntax
- | ITRarrowtail IsUnicodeSyntax
- | ITtypeApp
- | ITunknown String
- | ITeof
- | ITdocCommentNext String
- | ITdocCommentPrev String
- | ITdocCommentNamed String
- | ITdocSection Int String
- | ITdocOptions String
- | ITlineComment String
- | ITblockComment String
- lexer :: Bool -> (Located Token -> P a) -> P a
- pragState :: DynFlags -> StringBuffer -> RealSrcLoc -> PState
- mkPState :: DynFlags -> StringBuffer -> RealSrcLoc -> PState
- mkPStatePure :: ParserFlags -> StringBuffer -> RealSrcLoc -> PState
- data PState = PState {
- buffer :: StringBuffer
- options :: ParserFlags
- messages :: DynFlags -> Messages
- tab_first :: Maybe RealSrcSpan
- tab_count :: !Int
- last_tk :: Maybe Token
- last_loc :: RealSrcSpan
- last_len :: !Int
- loc :: RealSrcLoc
- 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
- use_pos_prags :: Bool
- annotations :: [(ApiAnnKey, [SrcSpan])]
- comment_q :: [Located AnnotationComment]
- annotations_comments :: [(SrcSpan, [Located AnnotationComment])]
- newtype P a = P {
- unP :: PState -> ParseResult a
- data ParseResult a
- mkParserFlags :: DynFlags -> ParserFlags
- data ParserFlags = ParserFlags {
- pWarningFlags :: EnumSet WarningFlag
- pExtensionFlags :: EnumSet Extension
- pThisPackage :: UnitId
- pExtsBitmap :: !ExtsBitmap
- getSrcLoc :: P RealSrcLoc
- getPState :: P PState
- extopt :: Extension -> ParserFlags -> Bool
- withThisPackage :: (UnitId -> a) -> P a
- failLocMsgP :: RealSrcLoc -> RealSrcLoc -> String -> P a
- failSpanMsgP :: SrcSpan -> SDoc -> P a
- srcParseFail :: P a
- getMessages :: PState -> DynFlags -> Messages
- popContext :: P ()
- pushModuleContext :: P ()
- setLastToken :: RealSrcSpan -> Int -> P ()
- setSrcLoc :: RealSrcLoc -> P ()
- activeContext :: P Bool
- nextIsEOF :: P Bool
- getLexState :: P Int
- popLexState :: P Int
- pushLexState :: Int -> P ()
- extension :: (ExtsBitmap -> Bool) -> P Bool
- bangPatEnabled :: ExtsBitmap -> Bool
- datatypeContextsEnabled :: ExtsBitmap -> Bool
- traditionalRecordSyntaxEnabled :: ExtsBitmap -> Bool
- explicitForallEnabled :: ExtsBitmap -> Bool
- inRulePrag :: ExtsBitmap -> Bool
- explicitNamespacesEnabled :: ExtsBitmap -> Bool
- patternSynonymsEnabled :: ExtsBitmap -> Bool
- sccProfilingOn :: ExtsBitmap -> Bool
- hpcEnabled :: ExtsBitmap -> Bool
- starIsTypeEnabled :: ExtsBitmap -> Bool
- addWarning :: WarningFlag -> SrcSpan -> SDoc -> P ()
- lexTokenStream :: StringBuffer -> RealSrcLoc -> DynFlags -> ParseResult [Located Token]
- addAnnotation :: SrcSpan -> AnnKeywordId -> SrcSpan -> P ()
- type AddAnn = SrcSpan -> P ()
- addAnnsAt :: SrcSpan -> [AddAnn] -> P ()
- mkParensApiAnn :: SrcSpan -> [AddAnn]
- commentToAnnotation :: Located Token -> Located AnnotationComment
- moveAnnotations :: SrcSpan -> SrcSpan -> P ()
Documentation
pragState :: DynFlags -> StringBuffer -> RealSrcLoc -> PState Source #
mkPState :: DynFlags -> StringBuffer -> RealSrcLoc -> PState Source #
Creates a parse state from a DynFlags
value
mkPStatePure :: ParserFlags -> StringBuffer -> RealSrcLoc -> PState Source #
Creates a parse state from a ParserFlags
value
PState | |
|
mkParserFlags :: DynFlags -> ParserFlags Source #
Extracts the flag information needed for parsing
data ParserFlags Source #
The subset of the DynFlags
used by the parser
ParserFlags | |
|
getSrcLoc :: P RealSrcLoc Source #
withThisPackage :: (UnitId -> a) -> P a Source #
failLocMsgP :: RealSrcLoc -> RealSrcLoc -> String -> P a Source #
srcParseFail :: P a Source #
popContext :: P () Source #
pushModuleContext :: P () Source #
setLastToken :: RealSrcSpan -> Int -> P () Source #
setSrcLoc :: RealSrcLoc -> P () Source #
activeContext :: P Bool Source #
getLexState :: P Int Source #
popLexState :: P Int Source #
pushLexState :: Int -> P () Source #
bangPatEnabled :: ExtsBitmap -> Bool Source #
datatypeContextsEnabled :: ExtsBitmap -> Bool Source #
traditionalRecordSyntaxEnabled :: ExtsBitmap -> Bool Source #
explicitForallEnabled :: ExtsBitmap -> Bool Source #
inRulePrag :: ExtsBitmap -> Bool Source #
explicitNamespacesEnabled :: ExtsBitmap -> Bool Source #
patternSynonymsEnabled :: ExtsBitmap -> Bool Source #
sccProfilingOn :: ExtsBitmap -> Bool Source #
hpcEnabled :: ExtsBitmap -> Bool Source #
starIsTypeEnabled :: ExtsBitmap -> Bool Source #
addWarning :: WarningFlag -> SrcSpan -> SDoc -> P () Source #
lexTokenStream :: StringBuffer -> RealSrcLoc -> DynFlags -> ParseResult [Located Token] Source #
addAnnotation :: SrcSpan -> AnnKeywordId -> SrcSpan -> P () Source #
type AddAnn = SrcSpan -> P () Source #
Encapsulated call to addAnnotation, requiring only the SrcSpan of the AST construct the annotation belongs to; together with the AnnKeywordId, this is the key of the annotation map.
This type is useful for places in the parser where it is not yet
known what SrcSpan an annotation should be added to. The most
common situation is when we are parsing a list: the annotations
need to be associated with the AST element that *contains* the
list, not the list itself. AddAnn
lets us defer adding the
annotations until we finish parsing the list and are now parsing
the enclosing element; we then apply the AddAnn
to associate
the annotations. Another common situation is where a common fragment of
the AST has been factored out but there is no separate AST node for
this fragment (this occurs in class and data declarations). In this
case, the annotation belongs to the parent data declaration.
The usual way an AddAnn
is created is using the mj
("make jump")
function, and then it can be discharged using the ams
function.
addAnnsAt :: SrcSpan -> [AddAnn] -> P () Source #
Given a location and a list of AddAnn, apply them all to the location.
mkParensApiAnn :: SrcSpan -> [AddAnn] Source #