diff options
author | Adrian Thurston <thurston@complang.org> | 2014-12-19 20:23:04 -0500 |
---|---|---|
committer | Adrian Thurston <thurston@complang.org> | 2014-12-19 20:23:04 -0500 |
commit | db9cfbc7d06ed34f1fe73465d81d3ac0975adaff (patch) | |
tree | 406d44a974f7242787b3c632146511785391f325 /src/parser.cc | |
parent | 12495ae402a5c9d80d467d9baae72f91ebac13cb (diff) | |
download | colm-db9cfbc7d06ed34f1fe73465d81d3ac0975adaff.tar.gz |
hacked together some struct (non-tree) semantics
Can new, get and set non-tree objects (very limited features).
Diffstat (limited to 'src/parser.cc')
-rw-r--r-- | src/parser.cc | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/src/parser.cc b/src/parser.cc index 264508cd..b7892480 100644 --- a/src/parser.cc +++ b/src/parser.cc @@ -885,6 +885,22 @@ void BaseParser::contextHead( const InputLoc &loc, const String &data, data, pd->nextObjectId++ ); } +void BaseParser::structHead( const InputLoc &loc, const String &data, + ObjectDef::Type objectType ) +{ + /* Make the new namespace. */ + Namespace *nspace = createNamespace( loc, data ); + + Context *context = new Context( loc, 0 ); + contextStack.push( context ); + + StructDef *structDef = new StructDef( data, context, nspace ); + nspace->structDefList.append( structDef ); + + context->objectDef = ObjectDef::cons( objectType, + data, pd->nextObjectId++ ); +} + StmtList *BaseParser::appendStatement( StmtList *stmtList, LangStmt *stmt ) { if ( stmt != 0 ) |