Represent enumerations as constant definitions
- Instead of representating enumeration values with a special node type, use the same ZCC_ConstantDef nodes that const_def produces. These are created at the same scope as the ZCC_Enum, rather than being contained entirely within it. To mark the end of enums for a single instance of ZCC_Enum, a ZCC_EnumTerminator node is now appended to the chain of ZCC_ConstantDefs.
This commit is contained in:
parent
d5fa550118
commit
af8e0f2ba6
3 changed files with 93 additions and 44 deletions
|
|
@ -57,7 +57,7 @@ enum EZCCTreeNodeType
|
|||
AST_Class,
|
||||
AST_Struct,
|
||||
AST_Enum,
|
||||
AST_EnumNode,
|
||||
AST_EnumTerminator,
|
||||
AST_States,
|
||||
AST_StatePart,
|
||||
AST_StateLabel,
|
||||
|
|
@ -251,13 +251,11 @@ struct ZCC_Enum : ZCC_TreeNode
|
|||
{
|
||||
ENamedName EnumName;
|
||||
EZCCBuiltinType EnumType;
|
||||
struct ZCC_EnumNode *Elements;
|
||||
struct ZCC_ConstantDef *Elements;
|
||||
};
|
||||
|
||||
struct ZCC_EnumNode : ZCC_TreeNode
|
||||
struct ZCC_EnumTerminator : ZCC_TreeNode
|
||||
{
|
||||
ENamedName ElemName;
|
||||
ZCC_TreeNode *ElemValue;
|
||||
};
|
||||
|
||||
struct ZCC_States : ZCC_TreeNode
|
||||
|
|
@ -478,6 +476,7 @@ struct ZCC_ConstantDef : ZCC_TreeNode
|
|||
{
|
||||
ENamedName Name;
|
||||
ZCC_Expression *Value;
|
||||
PSymbolConst *Symbol;
|
||||
};
|
||||
|
||||
struct ZCC_Declarator : ZCC_TreeNode
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue