_c_ast.cfg 4.1 KB

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