summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/compiler.h10
-rw-r--r--src/declare.cc4
-rw-r--r--src/parser.cc11
-rw-r--r--src/parser.h4
-rw-r--r--src/parsetree.h48
5 files changed, 38 insertions, 39 deletions
diff --git a/src/compiler.h b/src/compiler.h
index 19874a8a..6e44c8e1 100644
--- a/src/compiler.h
+++ b/src/compiler.h
@@ -271,8 +271,8 @@ struct LangEl : public DListEl<LangEl>
PredType predType;
long predValue;
- Context *contextDef;
- Context *contextIn;
+ StructDef *contextDef;
+ StructDef *contextIn;
bool noPreIgnore;
bool noPostIgnore;
bool isZero;
@@ -868,13 +868,13 @@ struct Compiler
ConsList replList;
ParserTextList parserTextList;
- Context *global;
+ StructDef *global;
StructEl *globalSel;
ObjectDef *globalObjectDef;
ObjectField *argv0;
ObjectField *argvList;
- Context *stream;
+ StructDef *stream;
StructEl *streamSel;
VectorTypeIdMap vectorTypeIdMap;
@@ -1009,7 +1009,7 @@ LangEl *addLangEl( Compiler *pd, Namespace *nspace,
const String &data, LangEl::Type type );
StructEl *declareStruct( Compiler *pd, Namespace *nspace,
- const String &data, Context *context );
+ const String &data, StructDef *context );
void declareTypeAlias( Compiler *pd, Namespace *nspace,
const String &data, TypeRef *typeRef );
diff --git a/src/declare.cc b/src/declare.cc
index fae4325a..a1e66843 100644
--- a/src/declare.cc
+++ b/src/declare.cc
@@ -167,7 +167,7 @@ LangEl *declareLangEl( Compiler *pd, Namespace *nspace,
}
StructEl *declareStruct( Compiler *pd, Namespace *inNspace,
- const String &data, Context *context )
+ const String &data, StructDef *context )
{
if ( inNspace != 0 ) {
TypeMapEl *inDict = inNspace->typeMap.find( data );
@@ -1023,7 +1023,7 @@ void Compiler::initCtxField( GenericType *gen )
{
#if 0
LangEl *langEl = gen->utArg->langEl;
- Context *context = langEl->contextIn;
+ StructDef *context = langEl->contextIn;
/* Make the type ref and create the field. */
UniqueType *ctxUT = findUniqueType( TYPE_TREE, context->lel );
diff --git a/src/parser.cc b/src/parser.cc
index 2e65e545..896e26d1 100644
--- a/src/parser.cc
+++ b/src/parser.cc
@@ -77,7 +77,7 @@ void BaseParser::init()
pd->globalObjectDef = ObjectDef::cons( ObjectDef::UserType,
global, pd->nextObjectId++ );
- pd->global = new Context( internal, global, pd->globalObjectDef );
+ pd->global = new StructDef( internal, global, pd->globalObjectDef );
pd->globalSel = declareStruct( pd, 0, global, pd->global );
/* Setup the stream object. */
@@ -85,8 +85,7 @@ void BaseParser::init()
ObjectDef *objectDef = ObjectDef::cons( ObjectDef::BuiltinType,
global, pd->nextObjectId++ );
- pd->stream = new Context( internal, global, objectDef );
-
+ pd->stream = new StructDef( internal, global, objectDef );
pd->streamSel = declareStruct( pd, pd->rootNamespace,
pd->stream->name, pd->stream );
@@ -415,7 +414,7 @@ LangStmt *BaseParser::globalDef( ObjectField *objField, LangExpr *expr,
{
LangStmt *stmt = 0;
- Context *context = 0;
+ StructDef *context = 0;
ObjectDef *object = 0;
if ( curStruct() == 0 )
object = pd->globalObjectDef;
@@ -922,7 +921,7 @@ void BaseParser::structVarDef( const InputLoc &loc, ObjectField *objField )
if ( curStruct() == 0 )
error(loc) << "internal error: no context stack items found" << endp;
- Context *context = curStruct();
+ StructDef *context = curStruct();
objField->context = context;
object = context->objectDef;
@@ -940,7 +939,7 @@ void BaseParser::structHead( const InputLoc &loc,
ObjectDef *objectDef = ObjectDef::cons( objectType,
data, pd->nextObjectId++ );
- Context *context = new Context( loc, data, objectDef );
+ StructDef *context = new StructDef( loc, data, objectDef );
structStack.push( context );
inNspace->structDefList.append( context );
diff --git a/src/parser.h b/src/parser.h
index 62254689..7e87a46f 100644
--- a/src/parser.h
+++ b/src/parser.h
@@ -24,7 +24,7 @@ struct BaseParser
RegionSetVect regionStack;
NamespaceVect namespaceStack;
- ContextStack structStack;
+ StructStack structStack;
ObjectDef *curLocalFrame;
NameScope *curScope;
@@ -33,7 +33,7 @@ struct BaseParser
bool insideRegion()
{ return regionStack.length() > 0; }
- Context *curStruct()
+ StructDef *curStruct()
{ return structStack.length() == 0 ? 0 : structStack.top(); }
Namespace *curNspace()
diff --git a/src/parsetree.h b/src/parsetree.h
index 7cfc8529..5e79cec0 100644
--- a/src/parsetree.h
+++ b/src/parsetree.h
@@ -187,7 +187,7 @@ struct JoinOrLm;
struct RegionJoinOrLm;
struct TokenRegion;
struct Namespace;
-struct Context;
+struct StructDef;
struct TokenDef;
struct TokenDefListReg;
struct TokenDefListNs;
@@ -357,7 +357,7 @@ struct TokenDef
static TokenDef *cons( const String &name, const String &literal,
bool isLiteral, bool isIgnore, LexJoin *join, CodeBlock *codeBlock,
const InputLoc &semiLoc, int longestMatchId, Namespace *nspace,
- RegionSet *regionSet, ObjectDef *objectDef, Context *contextIn )
+ RegionSet *regionSet, ObjectDef *objectDef, StructDef *contextIn )
{
TokenDef *t = new TokenDef;
@@ -406,7 +406,7 @@ struct TokenDef
RegionSet *regionSet;
ReCaptureVect reCaptureVect;
ObjectDef *objectDef;
- Context *contextIn;
+ StructDef *contextIn;
TokenDef *dupOf;
bool noPostIgnore;
@@ -474,7 +474,7 @@ struct NtDef
{
static NtDef *cons( const String &name, Namespace *nspace,
LelDefList *defList, ObjectDef *objectDef,
- Context *contextIn, bool reduceFirst )
+ StructDef *contextIn, bool reduceFirst )
{
NtDef *nt = new NtDef;
@@ -489,7 +489,7 @@ struct NtDef
}
static NtDef *cons( const String &name, Namespace *nspace,
- Context *contextIn, bool reduceFirst )
+ StructDef *contextIn, bool reduceFirst )
{
NtDef *nt = new NtDef;
@@ -507,7 +507,7 @@ struct NtDef
Namespace *nspace;
LelDefList *defList;
ObjectDef *objectDef;
- Context *contextIn;
+ StructDef *contextIn;
bool reduceFirst;
NtDef *prev, *next;
@@ -522,16 +522,16 @@ struct TokenInstanceListReg : DListMel<TokenInstance, TokenInstancePtr> {};
struct TokenDefListReg : DListMel<TokenDef, TokenDefPtr1> {};
struct TokenDefListNs : DListMel<TokenDef, TokenDefPtr2> {};
-struct ContextStack
- : public Vector<Context*>
+struct StructStack
+ : public Vector<StructDef*>
{
- Context *top()
- { return length() > 0 ? Vector<Context*>::top() : 0; }
+ StructDef *top()
+ { return length() > 0 ? Vector<StructDef*>::top() : 0; }
};
-struct Context
+struct StructDef
{
- Context( const InputLoc &loc, const String &name, ObjectDef *objectDef )
+ StructDef( const InputLoc &loc, const String &name, ObjectDef *objectDef )
:
loc(loc),
name(name),
@@ -542,23 +542,23 @@ struct Context
String name;
ObjectDef *objectDef;
- Context *prev, *next;
+ StructDef *prev, *next;
};
struct StructEl
{
- StructEl( const String &name, Context *context )
+ StructEl( const String &name, StructDef *context )
: name(name), context(context), id(-1) {}
String name;
- Context *context;
+ StructDef *context;
int id;
StructEl *prev, *next;
};
typedef DList<StructEl> StructElList;
-struct StructDefList : DList<Context> {};
+struct StructDefList : DList<StructDef> {};
struct TypeMapEl
: public AvlTreeEl<TypeMapEl>
@@ -2317,7 +2317,7 @@ struct ObjectField
Type type;
TypeRef *typeRef;
String name;
- Context *context;
+ StructDef *context;
NameScope *scope;
long offset;
bool beenReferenced;
@@ -2530,7 +2530,7 @@ typedef Vector<QualItem> QualItemVect;
struct LangVarRef
{
- static LangVarRef *cons( const InputLoc &loc, Context *context,
+ static LangVarRef *cons( const InputLoc &loc, StructDef *context,
NameScope *scope, QualItemVect *qual, const String &name )
{
LangVarRef *l = new LangVarRef;
@@ -2542,7 +2542,7 @@ struct LangVarRef
return l;
}
- static LangVarRef *cons( const InputLoc &loc, Context *context,
+ static LangVarRef *cons( const InputLoc &loc, StructDef *context,
NameScope *scope, const String &name )
{
return cons( loc, context, scope, new QualItemVect, name );
@@ -2602,7 +2602,7 @@ struct LangVarRef
VarRefLookup &lookup, CallArgVect *args, bool temps ) const;
InputLoc loc;
- Context *context;
+ StructDef *context;
NameScope *scope;
QualItemVect *qual;
String name;
@@ -3110,7 +3110,7 @@ struct LangStmt
static LangStmt *cons( const InputLoc &loc, Type type, ObjectField *objField,
TypeRef *typeRef, IterCall *iterCall, StmtList *stmtList,
- Context *context, NameScope *scope )
+ StructDef *context, NameScope *scope )
{
LangStmt *s = new LangStmt;
s->loc = loc;
@@ -3170,7 +3170,7 @@ struct LangStmt
LangStmt *elsePart;
String name;
IterCall *iterCall;
- Context *context;
+ StructDef *context;
NameScope *scope;
ConsItemList *consItemList;
@@ -3204,7 +3204,7 @@ struct CodeBlock
StmtList *stmtList;
ObjectDef *localFrame;
Locals locals;
- Context *context;
+ StructDef *context;
/* Each frame has two versions of
* the code: revert and commit. */
@@ -3248,7 +3248,7 @@ struct Function
bool isUserIter;
long paramListSize;
UniqueType **paramUTs;
- Context *inContext;
+ StructDef *inContext;
bool exprt;
ObjectMethod *objMethod;