| 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. |
| 20 | ArrayDecl: [type*, dim*, dim_quals] |
| 21 | |
| 22 | ArrayRef: [name*, subscript*] |
| 23 | |
| 24 | # op: =, +=, /= etc. |
| 25 | # |
| 26 | Assignment: [op, lvalue*, rvalue*] |
| 27 | |
| 28 | Alignas: [alignment*] |
| 29 | |
| 30 | BinaryOp: [op, left*, right*] |
| 31 | |
| 32 | Break: [] |
| 33 | |
| 34 | Case: [expr*, stmts**] |
| 35 | |
| 36 | Cast: [to_type*, expr*] |
| 37 | |
| 38 | # Compound statement in C99 is a list of block items (declarations or |
| 39 | # statements). |
| 40 | # |
| 41 | Compound: [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 | # |
| 48 | CompoundLiteral: [type*, init*] |
| 49 | |
| 50 | # type: int, char, float, string, etc. |
| 51 | # |
| 52 | Constant: [type, value] |
| 53 | |
| 54 | Continue: [] |
| 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 | # |
| 64 | Decl: [name, quals, align, storage, funcspec, type*, init*, bitsize*] |
| 65 | |
| 66 | DeclList: [decls**] |
| 67 | |
| 68 | Default: [stmts**] |
| 69 | |
| 70 | DoWhile: [cond*, stmt*] |
| 71 | |
| 72 | # Represents the ellipsis (...) parameter in a function |
| 73 | # declaration |
| 74 | # |
| 75 | EllipsisParam: [] |
| 76 | |
| 77 | # An empty statement (a semicolon ';' on its own) |
| 78 | # |
| 79 | EmptyStatement: [] |
| 80 | |
| 81 | # Enumeration type specifier |
| 82 | # name: an optional ID |
| 83 | # values: an EnumeratorList |
| 84 | # |
| 85 | Enum: [name, values*] |
| 86 | |
| 87 | # A name/value pair for enumeration values |
| 88 | # |
| 89 | Enumerator: [name, value*] |
| 90 | |
| 91 | # A list of enumerators |
| 92 | # |
| 93 | EnumeratorList: [enumerators**] |
| 94 | |
| 95 | # A list of expressions separated by the comma operator. |
| 96 | # |
| 97 | ExprList: [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 | # |
| 104 | FileAST: [ext**] |
| 105 | |
| 106 | # for (init; cond; next) stmt |
| 107 | # |
| 108 | For: [init*, cond*, next*, stmt*] |
| 109 | |
| 110 | # name: Id |
| 111 | # args: ExprList |
| 112 | # |
| 113 | FuncCall: [name*, args*] |
| 114 | |
| 115 | # type <decl>(args) |
| 116 | # |
| 117 | FuncDecl: [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 | # |
| 124 | FuncDef: [decl*, param_decls**, body*] |
| 125 | |
| 126 | Goto: [name] |
| 127 | |
| 128 | ID: [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 | # |
| 133 | IdentifierType: [names] |
| 134 | |
| 135 | If: [cond*, iftrue*, iffalse*] |
| 136 | |
| 137 | # An initialization list used for compound literals. |
| 138 | # |
| 139 | InitList: [exprs**] |
| 140 | |
| 141 | Label: [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 | # |
| 147 | NamedInitializer: [name**, expr*] |
| 148 | |
| 149 | # a list of comma separated function parameter declarations |
| 150 | # |
| 151 | ParamList: [params**] |
| 152 | |
| 153 | PtrDecl: [quals, type*] |
| 154 | |
| 155 | Return: [expr*] |
| 156 | |
| 157 | StaticAssert: [cond*, message*] |
| 158 | |
| 159 | # name: struct tag name |
| 160 | # decls: declaration of members |
| 161 | # |
| 162 | Struct: [name, decls**] |
| 163 | |
| 164 | # type: . or -> |
| 165 | # name.field or name->field |
| 166 | # |
| 167 | StructRef: [name*, type, field*] |
| 168 | |
| 169 | Switch: [cond*, stmt*] |
| 170 | |
| 171 | # cond ? iftrue : iffalse |
| 172 | # |
| 173 | TernaryOp: [cond*, iftrue*, iffalse*] |
| 174 | |
| 175 | # A base type declaration |
| 176 | # |
| 177 | TypeDecl: [declname, quals, align, type*] |
| 178 | |
| 179 | # A typedef declaration. |
| 180 | # Very similar to Decl, but without some attributes |
| 181 | # |
| 182 | Typedef: [name, quals, storage, type*] |
| 183 | |
| 184 | Typename: [name, quals, align, type*] |
| 185 | |
| 186 | UnaryOp: [op, expr*] |
| 187 | |
| 188 | # name: union tag name |
| 189 | # decls: declaration of members |
| 190 | # |
| 191 | Union: [name, decls**] |
| 192 | |
| 193 | While: [cond*, stmt*] |
| 194 | |
| 195 | Pragma: [string] |