Add the array size to ZCC_VarName

This commit is contained in:
Randy Heit 2013-07-23 19:59:47 -05:00
parent 0d25ed8289
commit 67caf3303b
3 changed files with 5 additions and 1 deletions

View file

@ -373,6 +373,7 @@ static void PrintVarName(FLispString &out, ZCC_TreeNode *node)
ZCC_VarName *vnode = (ZCC_VarName *)node; ZCC_VarName *vnode = (ZCC_VarName *)node;
out.Open("var-name"); out.Open("var-name");
out.AddName(vnode->Name); out.AddName(vnode->Name);
PrintNodes(out, vnode->ArraySize);
out.Close(); out.Close();
} }

View file

@ -611,12 +611,14 @@ variable_name(X) ::= IDENTIFIER(A).
{ {
NEW_AST_NODE(VarName,var); NEW_AST_NODE(VarName,var);
var->Name = ENamedName(A.Int); var->Name = ENamedName(A.Int);
var->ArraySize = NULL;
X = var; X = var;
} }
variable_name(X) ::= IDENTIFIER(A) array_size. variable_name(X) ::= IDENTIFIER(A) array_size(B).
{ {
NEW_AST_NODE(VarName,var); NEW_AST_NODE(VarName,var);
var->Name = ENamedName(A.Int); var->Name = ENamedName(A.Int);
var->ArraySize = B;
X = var; X = var;
} }

View file

@ -307,6 +307,7 @@ struct ZCC_StateLine : ZCC_StatePart
struct ZCC_VarName : ZCC_TreeNode struct ZCC_VarName : ZCC_TreeNode
{ {
ENamedName Name; ENamedName Name;
ZCC_Expression *ArraySize; // NULL if not an array
}; };
struct ZCC_Type : ZCC_TreeNode struct ZCC_Type : ZCC_TreeNode