1#----------------------------------------------------------------- 2# pycparser: _c_ast.cfg 3# 4# Defines the AST Node classes used in pycparser. 5# 6# Each entry is a Node sub-class name, listing the attributes 7# and child nodes of the class: 8# <name>* - a child node 9# <name>** - a sequence of child nodes 10# <name> - an attribute 11# 12# Eli Bendersky [https://eli.thegreenplace.net/] 13# License: BSD 14#----------------------------------------------------------------- 15 16# ArrayDecl is a nested declaration of an array with the given type. 17# dim: the dimension (for example, constant 42) 18# dim_quals: list of dimension qualifiers, to support C99's allowing 'const' 19# and 'static' within the array dimension in function declarations. 20ArrayDecl: [type*, dim*, dim_quals] 21 22ArrayRef: [name*, subscript*] 23 24# op: =, +=, /= etc. 25# 26Assignment: [op, lvalue*, rvalue*] 27 28Alignas: [alignment*] 29 30BinaryOp: [op, left*, right*] 31 32Break: [] 33 34Case: [expr*, stmts**] 35 36Cast: [to_type*, expr*] 37 38# Compound statement in C99 is a list of block items (declarations or 39# statements). 40# 41Compound: [block_items**] 42 43# Compound literal (anonymous aggregate) for C99. 44# (type-name) {initializer_list} 45# type: the typename 46# init: InitList for the initializer list 47# 48CompoundLiteral: [type*, init*] 49 50# type: int, char, float, string, etc. 51# 52Constant: [type, value] 53 54Continue: [] 55 56# name: the variable being declared 57# quals: list of qualifiers (const, volatile) 58# funcspec: list function specifiers (i.e. inline in C99) 59# storage: list of storage specifiers (extern, register, etc.) 60# type: declaration type (probably nested with all the modifiers) 61# init: initialization value, or None 62# bitsize: bit field size, or None 63# 64Decl: [name, quals, align, storage, funcspec, type*, init*, bitsize*] 65 66DeclList: [decls**] 67 68Default: [stmts**] 69 70DoWhile: [cond*, stmt*] 71 72# Represents the ellipsis (...) parameter in a function 73# declaration 74# 75EllipsisParam: [] 76 77# An empty statement (a semicolon ';' on its own) 78# 79EmptyStatement: [] 80 81# Enumeration type specifier 82# name: an optional ID 83# values: an EnumeratorList 84# 85Enum: [name, values*] 86 87# A name/value pair for enumeration values 88# 89Enumerator: [name, value*] 90 91# A list of enumerators 92# 93EnumeratorList: [enumerators**] 94 95# A list of expressions separated by the comma operator. 96# 97ExprList: [exprs**] 98 99# This is the top of the AST, representing a single C file (a 100# translation unit in K&R jargon). It contains a list of 101# "external-declaration"s, which is either declarations (Decl), 102# Typedef or function definitions (FuncDef). 103# 104FileAST: [ext**] 105 106# for (init; cond; next) stmt 107# 108For: [init*, cond*, next*, stmt*] 109 110# name: Id 111# args: ExprList 112# 113FuncCall: [name*, args*] 114 115# type <decl>(args) 116# 117FuncDecl: [args*, type*] 118 119# Function definition: a declarator for the function name and 120# a body, which is a compound statement. 121# There's an optional list of parameter declarations for old 122# K&R-style definitions 123# 124FuncDef: [decl*, param_decls**, body*] 125 126Goto: [name] 127 128ID: [name] 129 130# Holder for types that are a simple identifier (e.g. the built 131# ins void, char etc. and typedef-defined types) 132# 133IdentifierType: [names] 134 135If: [cond*, iftrue*, iffalse*] 136 137# An initialization list used for compound literals. 138# 139InitList: [exprs**] 140 141Label: [name, stmt*] 142 143# A named initializer for C99. 144# The name of a NamedInitializer is a sequence of Nodes, because 145# names can be hierarchical and contain constant expressions. 146# 147NamedInitializer: [name**, expr*] 148 149# a list of comma separated function parameter declarations 150# 151ParamList: [params**] 152 153PtrDecl: [quals, type*] 154 155Return: [expr*] 156 157StaticAssert: [cond*, message*] 158 159# name: struct tag name 160# decls: declaration of members 161# 162Struct: [name, decls**] 163 164# type: . or -> 165# name.field or name->field 166# 167StructRef: [name*, type, field*] 168 169Switch: [cond*, stmt*] 170 171# cond ? iftrue : iffalse 172# 173TernaryOp: [cond*, iftrue*, iffalse*] 174 175# A base type declaration 176# 177TypeDecl: [declname, quals, align, type*] 178 179# A typedef declaration. 180# Very similar to Decl, but without some attributes 181# 182Typedef: [name, quals, storage, type*] 183 184Typename: [name, quals, align, type*] 185 186UnaryOp: [op, expr*] 187 188# name: union tag name 189# decls: declaration of members 190# 191Union: [name, decls**] 192 193While: [cond*, stmt*] 194 195Pragma: [string] 196