diff options
-rw-r--r-- | src/declare.cc | 35 | ||||
-rw-r--r-- | src/loadcolm.cc | 10 | ||||
-rw-r--r-- | src/parser.cc | 22 | ||||
-rw-r--r-- | src/parser.h | 1 | ||||
-rw-r--r-- | src/parsetree.h | 7 |
5 files changed, 8 insertions, 67 deletions
diff --git a/src/declare.cc b/src/declare.cc index b955ee34..0fd5fb94 100644 --- a/src/declare.cc +++ b/src/declare.cc @@ -389,39 +389,6 @@ void Namespace::declare( Compiler *pd ) } } - for ( ContextDefList::Iter c = contextDefList; c.lte(); c++ ) { - LangEl *lel = declareContext( pd, this, c->name, LangEl::NonTerm ); - ProdElList *emptyList = new ProdElList; - //addProduction( c->context->loc, c->name, emptyList, false, 0, 0 ); - - { - LangEl *prodName = lel; - assert( prodName->type == LangEl::NonTerm ); - - Production *newDef = Production::cons( loc, prodName, - emptyList, String(), false, 0, - pd->prodList.length(), prodName->defList.length() ); - - prodName->defList.append( newDef ); - pd->prodList.append( newDef ); - newDef->predOf = 0; - - /* If the token has the same name as the region it is in, then also - * insert it into the symbol map for the parent region. */ - if ( strcmp( c->name, this->name ) == 0 ) { - /* Insert the name into the top of the region stack after popping the - * region just created. We need it in the parent. */ - TypeMapEl *typeMapEl = new TypeMapEl( - TypeMapEl::ContextType, c->name, prodName ); - this->parentNamespace->typeMap.insert( typeMapEl ); - } - } - - c->context->lel = lel; - lel->contextDef = c->context; - lel->objectDef = c->context->objectDef; - } - for ( StructDefList::Iter s = structDefList; s.lte(); s++ ) { if ( s != pd->stream ) { StructEl *sel = declareStruct( pd, this, s->name, s->context ); @@ -1169,6 +1136,7 @@ void Compiler::initParserField( GenericType *gen, const char *name, void Compiler::initCtxField( GenericType *gen ) { +#if 0 LangEl *langEl = gen->utArg->langEl; Context *context = langEl->contextIn; @@ -1185,6 +1153,7 @@ void Compiler::initCtxField( GenericType *gen ) el->inSetWV = IN_SET_PARSER_CTX_WV; gen->objDef->rootScope->insertField( el->name, el ); +#endif } void Compiler::initParserFields( GenericType *gen ) diff --git a/src/loadcolm.cc b/src/loadcolm.cc index fd02ff01..eb64fc89 100644 --- a/src/loadcolm.cc +++ b/src/loadcolm.cc @@ -2194,14 +2194,8 @@ struct LoadColm void walkContextDef( context_def contextDef ) { - if ( contextDef.struct_key().STRUCT() ) { - String name = contextDef.id().data(); - structHead( contextDef.id().loc(), name, ObjectDef::StructType ); - } - else { - String name = contextDef.id().data(); - contextHead( contextDef.id().loc(), name, ObjectDef::UserType ); - } + String name = contextDef.id().data(); + structHead( contextDef.id().loc(), name, ObjectDef::StructType ); _repeat_context_item contextItemList = contextDef.ItemList(); while ( !contextItemList.end() ) { diff --git a/src/parser.cc b/src/parser.cc index b0dc4ee5..bd3de0f2 100644 --- a/src/parser.cc +++ b/src/parser.cc @@ -25,7 +25,7 @@ void BaseParser::init() pd->globalObjectDef = ObjectDef::cons( ObjectDef::UserType, global, pd->nextObjectId++ ); - Context *context = new Context( internal, 0 ); + Context *context = new Context( internal ); pd->global = new StructDef( global, context ); pd->rootNamespace->structDefList.append( pd->global ); context->objectDef = pd->globalObjectDef; @@ -35,7 +35,7 @@ void BaseParser::init() ObjectDef *objectDef = ObjectDef::cons( ObjectDef::BuiltinType, global, pd->nextObjectId++ ); - context = new Context( internal, 0 ); + context = new Context( internal ); pd->stream = new StructDef( global, context ); context->objectDef = objectDef; @@ -894,29 +894,13 @@ void BaseParser::contextVarDef( const InputLoc &loc, ObjectField *objField ) object->rootScope->insertField( objField->name, objField ); } -void BaseParser::contextHead( 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 ); - - ContextDef *contextDef = new ContextDef( data, context, nspace ); - nspace->contextDefList.append( contextDef ); - - context->objectDef = ObjectDef::cons( objectType, - 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 ); + Context *context = new Context( loc ); contextStack.push( context ); StructDef *structDef = new StructDef( data, context ); diff --git a/src/parser.h b/src/parser.h index 2a0134a6..8ce0a21e 100644 --- a/src/parser.h +++ b/src/parser.h @@ -115,7 +115,6 @@ struct BaseParser LangExpr *require( const InputLoc &loc, LangVarRef *varRef, PatternItemList *list ); void contextVarDef( const InputLoc &loc, ObjectField *objField ); - void contextHead( const InputLoc &loc, const String &data, ObjectDef::Type objectType ); void structHead( const InputLoc &loc, const String &data, ObjectDef::Type objectType ); StmtList *appendStatement( StmtList *stmtList, LangStmt *stmt ); ParameterList *appendParam( ParameterList *paramList, ObjectField *objField ); diff --git a/src/parsetree.h b/src/parsetree.h index ec6400e0..32622847 100644 --- a/src/parsetree.h +++ b/src/parsetree.h @@ -339,15 +339,13 @@ struct ContextStack struct Context { - Context( const InputLoc &loc, LangEl *lel ) + Context( const InputLoc &loc ) : loc(loc), - lel(lel), objectDef(0) {} InputLoc loc; - LangEl *lel; ObjectDef *objectDef; }; @@ -567,8 +565,6 @@ struct ContextDef ContextDef *prev, *next; }; -struct ContextDefList : DList<ContextDef> {}; - struct StructEl { StructEl( Namespace *nspace, const String &name ) @@ -846,7 +842,6 @@ struct Namespace /* List of nonterminal defs in the namespace. */ NtDefList ntDefList; - ContextDefList contextDefList; StructDefList structDefList; /* Dictionary of symbols within the region. */ |