CParser

Members

Enums

DTR
enum DTR

Types of declarator to parse

LVL
enum LVL

Declaration context

MOD
enum MOD

C11 6.7.3 Type qualifiers

SCW
enum SCW

C11 6.7.1 Storage-class specifiers

Functions

addDefines
void addDefines()

Go through the #define's in the defines buffer and see what we can convert to Dsymbols, which are then appended to symbols[]

cparseAssignExp
AST.Expression cparseAssignExp()

C11 6.5.16 assignment-expression: conditional-expression unary-expression assignment-operator assignment-expression

cparseDeclaration
void cparseDeclaration(LVL level)

C11 6.7 declaration: declaration-specifiers init-declarator-list (opt) ; static_assert-declaration

cparseExpression
AST.Expression cparseExpression()

C11 6.5.17 expression: assignment-expression expression , assignment-expression

cparseFunctionDefinition
AST.Dsymbol cparseFunctionDefinition(Identifier id, AST.TypeFunction ft, Specifier specifier)

C11 Function Definitions function-definition declaration-specifiers declarator declaration-list (opt) compound-statement

cparseInitializer
AST.Initializer cparseInitializer()

C11 Initialization initializer: assignment-expression { initializer-list } { initializer-list , }

cparseParameterList
AST.ParameterList cparseParameterList()

C11 6.7.6.3 ( parameter-type-list ) ( identifier-list (opt) )

cparsePrimaryExp
AST.Expression cparsePrimaryExp()

C11 6.5.1 primary-expression: identifier constant string-literal ( expression ) generic-selection __builtin_va_arg(assign_expression, type)

cparseSpecifierQualifierList
AST.Type cparseSpecifierQualifierList(LVL level, Specifier specifier)

C11 6.7.2.1 specifier-qualifier-list: type-specifier specifier-qualifier-list (opt) type-qualifier specifier-qualifier-list (opt)

cparseStatement
AST.Statement cparseStatement(int flags, const(char)** endPtr, Loc* pEndloc)

C11 6.8 statement: labeled-statement compound-statement expression-statement selection-statement iteration-statement jump-statement

cparseStructDeclaration
void cparseStructDeclaration(AST.Dsymbols* members)

C11 6.7.2.1 Parse a struct declaration member. struct-declaration: specifier-qualifier-list struct-declarator-list (opt) ; static_assert-declaration

cparseTypeName
AST.Type cparseTypeName()

C11 6.7.7

cparseTypeQualifierList
MOD cparseTypeQualifierList()

C11 6.7.3 type-qualifier: const restrict volatile _Atomic __stdcall

insertIdToTypedefTab
void insertIdToTypedefTab(Identifier id)

Add id to typedefTab[], but only if it will mask an existing typedef.

insertTypedefToTypedefTab
void insertTypedefToTypedefTab(Identifier id, AST.Type t)

Add id to typedefTab[]

isDeclarationList
bool isDeclarationList(Token* pt)

See if declaration-list is present.

isFunctionTypedef
bool isFunctionTypedef(AST.Type t)

Determines if type t is a function type.

isTypedef
bool isTypedef(Identifier id)

Determine if id is a symbol for a Typedef.

lookupTypedef
AST.Type* lookupTypedef(Identifier id)

Lookup id in typedefTab[].

panic
void panic()

After encountering an error, scan forward until a right brace or ; is found or the end of the file.

parseModule
AST.Dsymbols* parseModule()

Parse translation unit. C11 6.9 translation-unit: external-declaration translation-unit external-declaration

parseSpecialTokenSequence
bool parseSpecialTokenSequence()

Directive Parser **************************

specifiersToFuncDeclaration
void specifiersToFuncDeclaration(AST.FuncDeclaration fd, Specifier specifier)

Add attributes from Specifier to function

specifiersToSTC
StorageClass specifiersToSTC(LVL level, Specifier specifier)

Convert from C specifiers to D storage class

specifiersToVarDeclaration
void specifiersToVarDeclaration(AST.VarDeclaration vd, Specifier specifier)

Add attributes from Specifier to variable

Structs

Specifier
struct Specifier

Aggregate for all the various specifiers

Variables

addFuncName
bool addFuncName;

add declaration of __func__ to function symbol table

importBuiltins
bool importBuiltins;

seen use of C compiler builtins, so import __builtins;

typedefTab
Array!(void*) typedefTab;

Array of AST.TypeIdentifier, typedef's indexed by Identifier

Meta