From c8bb762a52a9363e9eca92c788878fc82a29ed6d Mon Sep 17 00:00:00 2001 From: Adrian Thurston Date: Sun, 2 Sep 2012 22:24:21 -0400 Subject: some cleanup --- colm/compiler.cc | 2 +- colm/lmparse.kl | 2 +- colm/parsetree.cc | 2 +- colm/parsetree.h | 40 ++++++++-------------------------------- 4 files changed, 11 insertions(+), 35 deletions(-) diff --git a/colm/compiler.cc b/colm/compiler.cc index d3d4f7ef..c3887fd0 100644 --- a/colm/compiler.cc +++ b/colm/compiler.cc @@ -696,7 +696,7 @@ void Compiler::createBuiltin( const char *name, BuiltinMachine builtin ) { LexExpression *expression = LexExpression::cons( builtin ); LexJoin *join = new LexJoin( expression ); - VarDef *varDef = new VarDef( name, join ); + LexDefinition *varDef = new LexDefinition( name, join ); GraphDictEl *graphDictEl = new GraphDictEl( name, varDef ); rootNamespace->rlMap.insert( graphDictEl ); } diff --git a/colm/lmparse.kl b/colm/lmparse.kl index 1dd3cf72..c29a59a7 100644 --- a/colm/lmparse.kl +++ b/colm/lmparse.kl @@ -2649,7 +2649,7 @@ void ColmParser::addRegularDef( const InputLoc &loc, Namespace *nspace, GraphDictEl *newEl = nspace->rlMap.insert( name ); if ( newEl != 0 ) { /* New element in the dict, all good. */ - newEl->value = new VarDef( name, join ); + newEl->value = new LexDefinition( name, join ); newEl->isInstance = false; newEl->loc = loc; } diff --git a/colm/parsetree.cc b/colm/parsetree.cc index 0af983ae..313cc6c9 100644 --- a/colm/parsetree.cc +++ b/colm/parsetree.cc @@ -180,7 +180,7 @@ int CmpUniqueParser::compare( const UniqueParser &ut1, const UniqueParser &ut2 ) return 0; } -FsmGraph *VarDef::walk( Compiler *pd ) +FsmGraph *LexDefinition::walk( Compiler *pd ) { /* Recurse on the expression. */ FsmGraph *rtnVal = join->walk( pd ); diff --git a/colm/parsetree.h b/colm/parsetree.h index 46f30b44..7a2adbbe 100644 --- a/colm/parsetree.h +++ b/colm/parsetree.h @@ -315,9 +315,9 @@ struct PriorityAug /* * A Variable Definition */ -struct VarDef +struct LexDefinition { - VarDef( const String &name, LexJoin *join ) + LexDefinition( const String &name, LexJoin *join ) : name(name), join(join) { } /* Parse tree traversal. */ @@ -663,13 +663,13 @@ struct GraphDictEl { GraphDictEl( const String &key ) : key(key), value(0), isInstance(false) { } - GraphDictEl( const String &key, VarDef *value ) + GraphDictEl( const String &key, LexDefinition *value ) : key(key), value(value), isInstance(false) { } const String &getKey() { return key; } String key; - VarDef *value; + LexDefinition *value; bool isInstance; /* Location info of graph definition. Points to variable name of assignment. */ @@ -776,31 +776,7 @@ typedef DList NamespaceList; typedef BstSet< Namespace*, CmpOrd > NamespaceSet; /* List of Expressions. */ -typedef DList ExprList; - -struct JoinOrLm -{ - JoinOrLm( LexJoin *join ) : - join(join) {} - - FsmGraph *walk( Compiler *pd ); - void makeNameTree( Compiler *pd ); - - LexJoin *join; -}; - -struct RegionJoinOrLm -{ - enum Type { LongestMatchType }; - - RegionJoinOrLm( TokenRegion *tokenRegion ) : - tokenRegion(tokenRegion) {} - - FsmGraph *walk( Compiler *pd ); - void makeNameTree( Compiler *pd ); - - TokenRegion *tokenRegion; -}; +typedef DList LexExprList; /* * LexJoin @@ -815,7 +791,7 @@ struct LexJoin void makeNameTree( Compiler *pd ); /* Data. */ - ExprList exprList; + LexExprList exprList; LexJoin *context; Action *mark; @@ -1149,7 +1125,7 @@ struct LexFactor } /* Construct with a reference to a var def. */ - static LexFactor *cons( const InputLoc &loc, VarDef *varDef ) + static LexFactor *cons( const InputLoc &loc, LexDefinition *varDef ) { LexFactor *f = new LexFactor; f->type = ReferenceType; @@ -1179,7 +1155,7 @@ struct LexFactor Range *range; ReItem *reItem; RegExpr *regExp; - VarDef *varDef; + LexDefinition *varDef; LexJoin *join; int lower, upper; Type type; -- cgit v1.2.1