LLVM M.D.Source codeContentsIndex
MD.Parser.Basic
MaintainerPaul Govereau <govereau@cs.harvard.edu>
Description
Parser setup and basic combinators for LLVM source files.
Synopsis
module MD.Parser.Parsec
type SrcLoc = SourcePos
type Warnings = [(SrcLoc, String)]
data PState = PState {
pws :: Warnings
lblno :: Int
}
type P a = Parser PState a
initState :: PState
setLbl :: Int -> P ()
nextLbl :: P Int
srcloc :: P SrcLoc
warn :: String -> P ()
warnAt :: SrcLoc -> String -> P ()
warnings :: P Warnings
ws :: P ()
comment :: P ()
whiteSpace :: P ()
token :: P a -> P a
symchar :: Char -> P ()
symbol :: String -> P ()
complete :: P a -> P a
equals :: P ()
semi :: P ()
optsemis :: P ()
semis :: P ()
comma :: P ()
braces :: P a -> P a
brackets :: P a -> P a
parens :: P a -> P a
angles :: P a -> P a
semiSep :: P a -> P [a]
tuple :: P a -> P [a]
record :: P a -> P [a]
enumeration :: Ord a => [(a, String)] -> P a
Documentation
module MD.Parser.Parsec
type SrcLoc = SourcePosSource
type Warnings = [(SrcLoc, String)]Source
data PState Source
Constructors
PState
pws :: Warnings
lblno :: Int
type P a = Parser PState aSource
initState :: PStateSource
setLbl :: Int -> P ()Source
nextLbl :: P IntSource
srcloc :: P SrcLocSource
Return the current source location without consuming any input.
warn :: String -> P ()Source
Emit a warning at the current source location.
warnAt :: SrcLoc -> String -> P ()Source
Emit a warning at the given source location.
warnings :: P WarningsSource
Return the current set of warnings
ws :: P ()Source
comment :: P ()Source
whiteSpace :: P ()Source
Consumes white space and comments that are not annotations.
token :: P a -> P aSource
Create a token from the given parser. This combinator will attempt to parse input using the supplied parser and then consume any remaining white space that follows.
symchar :: Char -> P ()Source
Create a token parser from the given character.
symbol :: String -> P ()Source
Create a token parser from the given string.
complete :: P a -> P aSource
Complete
equals :: P ()Source
Parse an equals sign as a token.
semi :: P ()Source
Parse a semicolon as a token.
optsemis :: P ()Source
Parse an optional set of semicolons, and emit a warning about unnecessary semicolons.
semis :: P ()Source
Parse one or more semicolons; warn if more than one.
comma :: P ()Source
Parse a comma as a token.
braces :: P a -> P aSource
Augment the given parser requiring braces. The braces will be parsed as normal tokens.
brackets :: P a -> P aSource
Augment the given parser requiring brackets ([]). The brackets will be parsed as normal tokens.
parens :: P a -> P aSource
Augment the given parser requiring parentheses. The parentheses will be parsed as normal tokens.
angles :: P a -> P aSource
Augment the given parser requiring angle brackets. The parentheses will be parsed as normal tokens.
semiSep :: P a -> P [a]Source
Parses a sequence of zero of more items separated by semicolons. The semicolons are normal tokens, and will destroy annotations (but, see semiSepAnn below). This parser allows any number of consecutive semicolons to be used as a separator. Also, any number of semicolons may appear before the first item, and the final separator (after the last item) is optional.
tuple :: P a -> P [a]Source

Parse a block of semicolon separated items. This parser uses the semiSep parser to parse the items, bit also requires that curly braces signify the beginning and end of the block.

Parse a tuple of items: (a,b,...,n)

record :: P a -> P [a]Source

Parse a list of items: [a,b,...,n]

Parse a record of items : {a,b,...,c}

enumeration :: Ord a => [(a, String)] -> P aSource
Parse an enumeration derived from an association list.
Produced by Haddock version 2.6.0