View source code
Display the source code in dmd/cparse.d from which this page was generated on github.
Report a bug
If you spot a problem with this page, click here to create a Bugzilla issue.
Improve this page
Quickly fork, edit online, and submit a pull request for this page. Requires a signed-in GitHub account. This works well for small changes. If you'd like to make larger changes you may want to consider using local clone.

Class dmd.cparse.CParser

class CParser(AST) ;

Fields

NameTypeDescription
addFuncName booladd declaration of _func__ to function symbol table
importBuiltins boolseen use of C compiler builtins, so import _builtins;

Methods

NameDescription
applySpecifier (s, specifier) Apply specifier to a Dsymbol.
cparseAddExp () C11 6.5.6 additive-expression multiplicative-expression additive-expression + multiplicative-expression additive-expression - multiplicative-expression
cparseAndAndExp () C11 6.5.13 logical-AND-expression inclusive-OR-expression logical-AND-expression && inclusive-OR-expression
cparseAndExp () C11 6.5.10 AND-expression equality-expression AND-expression & equality-expression
cparseArguments () Collect argument list. Parser is on opening parenthesis.
cparseAssignExp () C11 6.5.16 assignment-expression: conditional-expression unary-expression assignment-operator assignment-expression
cparseBuiltin_va_arg () gcc extension: type _builtin_va_arg(assign-expression, type) Rewrite as va_arg template from core.stdc.stdarg: va_arg!(type)(assign-expression); Lexer is on __builtin_va_arg
cparseCastExp () C11 6.5.4 cast-expression unary-expression ( type-name ) cast-expression
cparseCondExp () C11 6.5.15 conditional-expression: logical-OR-expression logical-OR-expression ? expression : conditional-expression
cparseConstantExp () C11 6.6 Constant expressions constant-expression: conditional-expression
cparseDeclaration (level) Declaration Parser
cparseDeclarationSpecifiers (level, specifier) C11 6.7 declaration-specifier: storage-class-specifier declaration-specifiers (opt) type-specifier declaration-specifiers (opt) type-qualifier declaration-specifiers (opt) function-specifier declaration-specifiers (opt) alignment-specifier declaration-specifiers (opt)
cparseDeclarator (declarator, t, pident, specifier) C11 6.7.6 Parse a declarator (including function definitions).
cparseDeclspec () _declspec parser
cparseEnum (symbols) Struct & Enum Parser
cparseEqualityExp () C11 6.5.9 equality-expression relational-expression equality-expression == relational-expression equality-expression != relational-expression
cparseExpression () Expression Parser
cparseFunctionDefinition (id, ft, specifier) C11 Function Definitions function-definition declaration-specifiers declarator declaration-list (opt) compound-statement
cparseGenericSelection () C11 6.5.1.1 Generic ( assignment-expression, generic-assoc-list )
cparseGnuAttribute (specifier) Parse a single GNU attribute gnu-attribute: gnu-attribute-name gnu-attribute-name ( identifier ) gnu-attribute-name ( identifier , expression-list ) gnu-attribute-name ( expression-list (opt) )
cparseGnuAttributes (specifier) _attribute__ parser
cparseInitializer () C11 Initialization
cparseMulExp () C11 6.5.5 multiplicative-expression cast-expression multiplicative-expression * cast-expression multiplicative-expression / cast-expression multiplicative-expression % cast-expression
cparseOrExp () C11 6.5.12 inclusive-OR-expression exclusive-OR-expression inclusive-OR-expression | exclusive-OR-expression
cparseOrOrExp () C11 6.5.14 logical-OR-expression logical-AND-expression logical-OR-expression || logical-AND-expression
cparseParameterList () C11 6.7.6.3 ( parameter-type-list ) ( identifier-list (opt) )
cparseParens () Like skipParens(), but consume the tokens.
cparsePostfixExp (e) C11 6.5.2 postfix-expression: primary-expression postfix-expression [ expression ] postfix-expression ( argument-expression-list (opt) ) postfix-expression . identifier postfix-expression -> identifier postfix-expression ++ postfix-expression -- ( type-name ) { initializer-list } ( type-name ) { initializer-list , }
cparsePostfixOperators (e) C11 6.5.2 Parse a series of operators for a postfix expression after already parsing a primary-expression or compound literal expression.
cparsePrimaryExp () C11 6.5.1 primary-expression: identifier constant string-literal ( expression ) generic-selection _builtin_va_arg(assign_expression, type)
cparseRelationalExp () C11 6.5.8 relational-expression shift-expression relational-expression < shift-expression relational-expression > shift-expression relational-expression <= shift-expression relational-expression >= shift-expression
cparseShiftExp () C11 6.5.7 shift-expression additive-expression shift-expression << additive-expression shift-expression >> additive-expression
cparseSimpleAsmExpr () Simple asm parser
cparseSpecifierQualifierList (level, specifier) C11 6.7.2.1 specifier-qualifier-list: type-specifier specifier-qualifier-list (opt) type-qualifier specifier-qualifier-list (opt)
cparseStatement (flags, endPtr, pEndloc) Statement Parser
cparseStaticAssert () C11 6.7.10 Static_assert ( constant-expression , string-literal ) ;
cparseStruct (loc, structOrUnion, symbols) C11 6.7.2.1 Parse struct and union specifiers. Parser is advanced to the tag identifier or brace. struct-or-union-specifier: struct-or-union identifier (opt) { struct-declaration-list } struct-or-union identifier
cparseStructDeclaration (members) C11 6.7.2.1 Parse a struct declaration member. struct-declaration: specifier-qualifier-list struct-declarator-list (opt) ; static_assert-declaration
cparseTypeName () C11 6.7.7
cparseTypeQualifierList () C11 6.7.3 type-qualifier: const restrict volatile Atomic _stdcall
cparseUnaryExp () C11 6.5.3 unary-expression: postfix-expression ++ unary-expression -- unary-expression unary-operator cast-expression sizeof unary-expression sizeof ( type-name ) Alignof ( type-name )
cparseXorExp () C11 6.5.11 exclusive-OR-expression AND-expression exclusive-OR-expression ^ AND-expression
createFuncName (loc, id) C11 6.4.2.2 Create declaration to predefine _func__ static const char __func__[] = " function-name ";
isAssignmentExpression (pt) See if match for assignment-expression.
isCastExpression (pt, afterParenType) Looking at the leading left parenthesis, and determine if it is either of the following: ( type-name ) cast-expression ( type-name ) { initializer-list } as opposed to: ( expression )
isCDeclaration (pt) Lookahead Parser
isCDeclarator (pt, declarator) Check to see if tokens starting with *pt form a declarator.
isConstantExpression (pt) See if match for constant-expression.
isDeclarationList (pt) See if declaration-list is present.
isDeclarationSpecifiers (pt) See if match for declaration-specifiers. No errors are diagnosed.
isFunctionCall (pt) See if match for: postfix-expression ( argument-expression-list(opt) )
isGnuAttributeName () See if match for GNU attribute name, which may be any identifier, storage-class-specifier, type-specifier, or type-qualifier.
isInitializer (pt) See if match for initializer.
isPrimaryExpression (pt) See if match for primary-expression.
isSpecifierQualifierList (pt) Is this the start of a specifier-qualifier-list?
isTypeName (pt) Is this the start of a type-name?
isTypeQualifierList (pt) Is this the start of a type-qualifier-list? (Can be empty.)
isUnaryExpression (pt, afterParenType) See if match for unary-expression.
panic () After encountering an error, scan forward until a right brace or ; is found or the end of the file.
parseModule () Parse translation unit. C11 6.9 translation-unit: external-declaration translation-unit external-declaration
realType (flags) Return suitable D float type for C long double
skipBraces (pt) Skip braces.
skipBrackets (pt) Skip brackets.
specifiersToSTC (level, specifier) Convert from C specifiers to D storage class
toConst (t) Apply const to a type.
factory (classname) Create instance of class specified by the fully qualified name classname. The class must either have no constructors or have a default constructor.
opCmp (o) Compare with another Object obj.
opEquals (o) Test whether this is equal to o. The default implementation only compares by identity (using the is operator). Generally, overrides and overloads for opEquals should attempt to compare objects by their contents. A class will most likely want to add an overload that takes your specific type as the argument and does the content comparison. Then you can override this and forward it to your specific typed overload with a cast. Remember to check for null on the typed overload.
toHash () Compute hash function for Object.
toString () Convert Object to a human readable string.

Inner structs

NameDescription
Specifier Aggregate for all the various specifiers

Enums

NameDescription
DTR Types of declarator to parse
LVL More
MOD C11 6.7.3 Type qualifiers
RTFlags Flags for realType
SCW C11 6.7.1 Storage-class specifiers

Authors

Walter Bright

License

Boost License 1.0