language-objc-0.4.2.8: Analysis and generation of Objective C code

Portabilityghc
Stabilityexperimental
Maintainerjwlato@gmail.com
Safe HaskellNone

Language.ObjC.Parser

Contents

Description

Language.ObjC parser

Synopsis

Simple API

parseC :: InputStream -> Position -> Either ParseError CTranslUnitSource

parseC input initialPos parses the given preprocessed Objective-C source input and returns the AST or a list of parse errors.

Parser Monad

type P a = LP [CExtDecl] aSource

Default parser type, so CExtDecls can be parsed lazily

execParser :: LP [s] a -> InputStream -> Position -> [Ident] -> [Name] -> Either ParseError (a, [Name])Source

execute the given parser on the supplied input stream. returns ParseError if the parser failed, and a pair of result and remaining name supply otherwise

Lazy parsing results are ignored.

Synopsis: execParser parser inputStream initialPos predefinedTypedefs uniqNameSupply

execLazyParser :: LP [s] a -> InputStream -> Position -> [Ident] -> [Name] -> ([s], Either ParseError a)Source

execute the given parser on the supplied input stream.

returns a lazy list of results, and either the parse result or a ParseError if there was an error.

The list should be consumed as far as possible before checking the result is evaluated for maximum laziness.

Synopsis: execParser parser inputStream initialPos predefinedTypedefs uniqNameSupply

execParser_ :: P a -> InputStream -> Position -> Either ParseError aSource

run the given parser using a new name supply and builtin typedefs see execParser

Synopsis: runParser parser inputStream initialPos

Exposed Parsers

translUnitP :: P CTranslUnitSource

translUnitP provides a parser for a complete C translation unit, i.e. a list of external declarations.

extDeclP :: P CExtDeclSource

extDeclP provides a parser for an external (file-scope) declaration

statementP :: P CStatSource

statementP provides a parser for C statements

expressionP :: P CExprSource

expressionP provides a parser for C expressions

Parser Monad

newtype ParseError Source

Constructors

ParseError ([String], Position) 

Instances