language-c-quote-0.13.0.2: C/CUDA/OpenCL/Objective-C quasiquoting library.

Copyright | (c) 2006-2011 Harvard University (c) 2011-2013 Geoffrey Mainland
License | BSD-style
Maintainer | mainland@drexel.edu
Safe Haskell | None
Language | Haskell2010

Language.C.Parser.Monad

Description

Synopsis

- data P a
- runP :: P a -> PState -> Either SomeException (a, PState)
- evalP :: P a -> PState -> Either SomeException a
- data PState
- emptyPState :: [Extensions] -> [String] -> ByteString -> Maybe Pos -> PState
- getInput :: P AlexInput
- setInput :: AlexInput -> P ()
- pushLexState :: Int -> P ()
- popLexState :: P Int
- getLexState :: P Int
- pushbackToken :: L Token -> P ()
- getPushbackToken :: P (Maybe (L Token))
- getCurToken :: P (L Token)
- setCurToken :: L Token -> P ()
- addTypedef :: String -> P ()
- addClassdef :: String -> P ()
- addVariable :: String -> P ()
- isTypedef :: String -> P Bool
- isClassdef :: String -> P Bool
- pushScope :: P ()
- popScope :: P ()
- c99Exts :: ExtensionsInt
- c11Exts :: ExtensionsInt
- gccExts :: ExtensionsInt
- blocksExts :: ExtensionsInt
- cudaExts :: ExtensionsInt
- openCLExts :: ExtensionsInt
- objcExts :: ExtensionsInt
- useExts :: ExtensionsInt -> P Bool
- antiquotationExts :: ExtensionsInt
- useC99Exts :: P Bool
- useC11Exts :: P Bool
- useGccExts :: P Bool
- useBlocksExts :: P Bool
- useCUDAExts :: P Bool
- useOpenCLExts :: P Bool
- useObjCExts :: P Bool
- data LexerException = LexerException (Maybe Pos) Doc
- data ParserException = ParserException Loc Doc
- quoteTok :: Doc -> Doc
- failAt :: Loc -> String -> P a
- lexerError :: AlexInput -> Doc -> P a
- unexpectedEOF :: AlexInput -> P a
- emptyCharacterLiteral :: AlexInput -> P a
- illegalCharacterLiteral :: AlexInput -> P a
- illegalNumericalLiteral :: AlexInput -> P a
- parserError :: Loc -> Doc -> P a
- unclosed :: Loc -> String -> P a
- expected :: [String] -> Maybe String -> P b
- expectedAt :: L Token -> [String] -> Maybe String -> P b
- data AlexInput = AlexInput {
  - alexPos :: !(Maybe Pos)
  - alexPrevChar :: !Char
  - alexInput :: !ByteString
  - alexOff :: !Int
  }
- alexGetChar :: AlexInput -> Maybe (Char, AlexInput)
- alexGetByte :: AlexInput -> Maybe (Word8, AlexInput)
- alexInputPrevChar :: AlexInput -> Char
- alexLoc :: AlexInput -> AlexInput -> Loc
- nextChar :: P Char
- peekChar :: P Char
- maybePeekChar :: P (Maybe Char)
- skipChar :: P ()
- type AlexPredicate = PState -> AlexInput -> Int -> AlexInput -> Bool
- allowAnti :: AlexPredicate
- ifExtension :: ExtensionsInt -> AlexPredicate

# Documentation

data P a Source #

#### Instances

Instances details

MonadException P Source # |
Instance details Defined in Language.C.Parser.Monad Methods throw :: Exception e => e -> P a Source # catch :: Exception e => P a -> (e -> P a) -> P a Source # finally :: P a -> P b -> P a Source #
Applicative P Source # |
Instance details Defined in Language.C.Parser.Monad Methods pure :: a -> P a Source # (<*>) :: P (a -> b) -> P a -> P b Source # liftA2 :: (a -> b -> c) -> P a -> P b -> P c Source # (*>) :: P a -> P b -> P b Source # (<*) :: P a -> P b -> P a Source #
Functor P Source # |
Instance details Defined in Language.C.Parser.Monad Methods fmap :: (a -> b) -> P a -> P b Source # (<$) :: a -> P b -> P a Source #
Monad P Source # |
Instance details Defined in Language.C.Parser.Monad Methods (>>=) :: P a -> (a -> P b) -> P b Source # (>>) :: P a -> P b -> P b Source # return :: a -> P a Source #
MonadFail P Source # |
Instance details Defined in Language.C.Parser.Monad Methods fail :: String -> P a Source #
MonadState PState P Source # |
Instance details Defined in Language.C.Parser.Monad Methods get :: P PState Source # put :: PState -> P () Source # state :: (PState -> (a, PState)) -> P a Source #

runP :: P a -> PState -> Either SomeException (a, PState) Source #

evalP :: P a -> PState -> Either SomeException a Source #

data PState Source #

#### Instances

Instances details

MonadState PState P Source # |
Instance details Defined in Language.C.Parser.Monad Methods get :: P PState Source # put :: PState -> P () Source # state :: (PState -> (a, PState)) -> P a Source #

emptyPState :: [Extensions] -> [String] -> ByteString -> Maybe Pos -> PState Source #

getInput :: P AlexInput Source #

setInput :: AlexInput -> P () Source #

pushLexState :: Int -> P () Source #

popLexState :: P Int Source #

getLexState :: P Int Source #

pushbackToken :: L Token -> P () Source #

getPushbackToken :: P (Maybe (L Token)) Source #

getCurToken :: P (L Token) Source #

setCurToken :: L Token -> P () Source #

addTypedef :: String -> P () Source #

addClassdef :: String -> P () Source #

addVariable :: String -> P () Source #

isTypedef :: String -> P Bool Source #

isClassdef :: String -> P Bool Source #

pushScope :: P () Source #

popScope :: P () Source #

c99Exts :: ExtensionsInt Source #

c11Exts :: ExtensionsInt Source #

gccExts :: ExtensionsInt Source #

blocksExts :: ExtensionsInt Source #

cudaExts :: ExtensionsInt Source #

openCLExts :: ExtensionsInt Source #

objcExts :: ExtensionsInt Source #

useExts :: ExtensionsInt -> P Bool Source #

antiquotationExts :: ExtensionsInt Source #

useC99Exts :: P Bool Source #

useC11Exts :: P Bool Source #

useGccExts :: P Bool Source #

useBlocksExts :: P Bool Source #

useCUDAExts :: P Bool Source #

useOpenCLExts :: P Bool Source #

useObjCExts :: P Bool Source #

data LexerException Source #

Constructors

LexerException (Maybe Pos) Doc |

#### Instances

Instances details

Exception LexerException Source # |
Instance details Defined in Language.C.Parser.Monad Methods toException :: LexerException -> SomeException Source # fromException :: SomeException -> Maybe LexerException Source # displayException :: LexerException -> String Source # backtraceDesired :: LexerException -> Bool Source #
Show LexerException Source # |
Instance details Defined in Language.C.Parser.Monad Methods showsPrec :: Int -> LexerException -> ShowS Source # show :: LexerException -> String Source # showList :: [LexerException] -> ShowS Source #

data ParserException Source #

Constructors

ParserException Loc Doc |

#### Instances

Instances details

Exception ParserException Source # |
Instance details Defined in Language.C.Parser.Monad Methods toException :: ParserException -> SomeException Source # fromException :: SomeException -> Maybe ParserException Source # displayException :: ParserException -> String Source # backtraceDesired :: ParserException -> Bool Source #
Show ParserException Source # |
Instance details Defined in Language.C.Parser.Monad Methods showsPrec :: Int -> ParserException -> ShowS Source # show :: ParserException -> String Source # showList :: [ParserException] -> ShowS Source #

quoteTok :: Doc -> Doc Source #

failAt :: Loc -> String -> P a Source #

lexerError :: AlexInput -> Doc -> P a Source #

unexpectedEOF :: AlexInput -> P a Source #

emptyCharacterLiteral :: AlexInput -> P a Source #

illegalCharacterLiteral :: AlexInput -> P a Source #

illegalNumericalLiteral :: AlexInput -> P a Source #

parserError :: Loc -> Doc -> P a Source #

unclosed :: Loc -> String -> P a Source #

expected :: [String] -> Maybe String -> P b Source #

expectedAt :: L Token -> [String] -> Maybe String -> P b Source #

data AlexInput Source #

Constructors

AlexInput |

Fields

- alexPos :: !(Maybe Pos)
- alexPrevChar :: !Char
- alexInput :: !ByteString
- alexOff :: !Int

alexGetChar :: AlexInput -> Maybe (Char, AlexInput) Source #

alexGetByte :: AlexInput -> Maybe (Word8, AlexInput) Source #

alexInputPrevChar :: AlexInput -> Char Source #

alexLoc :: AlexInput -> AlexInput -> Loc Source #

nextChar :: P Char Source #

peekChar :: P Char Source #

maybePeekChar :: P (Maybe Char) Source #

skipChar :: P () Source #

type AlexPredicate = PState -> AlexInput -> Int -> AlexInput -> Bool Source #

The components of an `AlexPredicate` are the predicate state, input stream before the token, length of the token, input stream after the token.

allowAnti :: AlexPredicate Source #

ifExtension :: ExtensionsInt -> AlexPredicate Source #