- allow parsing of static constant arrays in class scope.

This is only the parsing part, the arrays are not yet getting evaluated.
This required quite a hacky workaround because the gramma couldn't be made to accept the rule. The scanner will check if a 'static' token is immediately followed by a 'const' token and will combine both to a new 'staticconst' token that does not create conflicts with other rules.
This commit is contained in:
Christoph Oelckers 2017-03-14 20:22:37 +01:00
commit 6926875b21
7 changed files with 52 additions and 2 deletions

View file

@ -197,6 +197,10 @@ void ZCCCompiler::ProcessClass(ZCC_Class *cnode, PSymbolTreeNode *treenode)
cls->Defaults.Push(static_cast<ZCC_Default *>(node));
break;
case AST_StaticArrayStatement:
cls->Arrays.Push(static_cast<ZCC_StaticArrayStatement *>(node));
break;
default:
assert(0 && "Unhandled AST node type");
break;
@ -260,6 +264,10 @@ void ZCCCompiler::ProcessStruct(ZCC_Struct *cnode, PSymbolTreeNode *treenode, ZC
enumType = nullptr;
break;
case AST_StaticArrayStatement:
cls->Arrays.Push(static_cast<ZCC_StaticArrayStatement *>(node));
break;
default:
assert(0 && "Unhandled AST node type");
break;