_c_ast.cfg 4.2 KB

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