diff options
author | Adrian Thurston <thurston@complang.org> | 2012-09-15 19:06:05 -0400 |
---|---|---|
committer | Adrian Thurston <thurston@complang.org> | 2012-09-15 19:06:05 -0400 |
commit | 34f3f8ee2dab57dbb086335a3829b180ad52b44b (patch) | |
tree | 92d012d0aabf85cc882fde8de6d028c7b5aea405 | |
parent | 3504a282319700989198e3b7ff8638eea3f8ee60 (diff) | |
download | colm-34f3f8ee2dab57dbb086335a3829b180ad52b44b.tar.gz |
few more improvements to input location tracking
-rw-r--r-- | colm/compiler.cc | 21 | ||||
-rw-r--r-- | colm/lmparse.kl | 1 | ||||
-rw-r--r-- | colm/resolve.cc | 2 |
3 files changed, 12 insertions, 12 deletions
diff --git a/colm/compiler.cc b/colm/compiler.cc index fa245155..894a6dc4 100644 --- a/colm/compiler.cc +++ b/colm/compiler.cc @@ -39,8 +39,10 @@ #include "colm.h" #include "pool.h" -using namespace std; using std::ostringstream; +using std::cout; +using std::cerr; +using std::endl; char machineMain[] = "main"; exit_object endp; @@ -1125,13 +1127,13 @@ LangEl *Compiler::makeListProd( const InputLoc &loc, Namespace *nspace, UniqueType *prodNameUT = findUniqueType( TYPE_TREE, prodName ); TypeRef *typeRef2 = TypeRef::cons( loc, prodNameUT ); - ProdEl *factor2 = new ProdEl( ProdEl::ReferenceType, InputLoc(), 0, false, typeRef2, 0 ); + ProdEl *factor2 = new ProdEl( ProdEl::ReferenceType, loc, 0, false, typeRef2, 0 ); ProdElList *prodElList1 = new ProdElList; prodElList1->append( factor1 ); prodElList1->append( factor2 ); - Production *newDef1 = Production::cons( InputLoc(), + Production *newDef1 = Production::cons( loc, prodName, prodElList1, false, 0, prodList.length(), prodName->defList.length() ); @@ -1140,12 +1142,12 @@ LangEl *Compiler::makeListProd( const InputLoc &loc, Namespace *nspace, /* Build the second production of the list. */ TypeRef *typeRef3 = TypeRef::cons( loc, nspaceQual, name ); - ProdEl *factor3 = new ProdEl( ProdEl::ReferenceType, InputLoc(), 0, false, typeRef3, 0 ); + ProdEl *factor3 = new ProdEl( ProdEl::ReferenceType, loc, 0, false, typeRef3, 0 ); ProdElList *prodElList2 = new ProdElList; prodElList2->append( factor3 ); - Production *newDef2 = Production::cons( InputLoc(), + Production *newDef2 = Production::cons( loc, prodName, prodElList2, false, 0, prodList.length(), prodName->defList.length() ); @@ -1165,10 +1167,10 @@ LangEl *Compiler::makeOptProd( const InputLoc &loc, Namespace *nspace, /* Build the first production of the repeat. */ TypeRef *typeRef1 = TypeRef::cons( loc, nspaceQual, name ); - ProdEl *factor1 = new ProdEl( ProdEl::ReferenceType, InputLoc(), 0, false, typeRef1, 0 ); + ProdEl *factor1 = new ProdEl( ProdEl::ReferenceType, loc, 0, false, typeRef1, 0 ); prodElList1->append( factor1 ); - Production *newDef1 = Production::cons( InputLoc(), + Production *newDef1 = Production::cons( loc, prodName, prodElList1, false, 0, prodList.length(), prodName->defList.length() ); @@ -1178,7 +1180,7 @@ LangEl *Compiler::makeOptProd( const InputLoc &loc, Namespace *nspace, /* Build the second production of the repeat. */ ProdElList *prodElList2 = new ProdElList; - Production *newDef2 = Production::cons( InputLoc(), + Production *newDef2 = Production::cons( loc, prodName, prodElList2, false, 0, prodList.length(), prodName->defList.length() ); @@ -1265,13 +1267,12 @@ void Compiler::initEmptyScanners() reg->wasEmpty = true; static int def = 1; - InputLoc loc = { 0, 0, 0 }; String name( reg->name.length() + 16, "__%s_DEF_PAT_%d", reg->name.data, def++ ); LexJoin *join = new LexJoin( LexExpression::cons( BT_Any ) ); TokenDef *tokenDef = new TokenDef( name, String(), false, false, join, - 0, loc, nextTokenId++, rootNamespace, reg, 0, 0, 0 ); + 0, internal, nextTokenId++, rootNamespace, reg, 0, 0, 0 ); reg->tokenDefList.append( tokenDef ); /* These do not go in the namespace so so they cannot get declared diff --git a/colm/lmparse.kl b/colm/lmparse.kl index 6f228733..462da306 100644 --- a/colm/lmparse.kl +++ b/colm/lmparse.kl @@ -566,6 +566,7 @@ context_head: nonterm pattern { PatternItemList *list; + InputLoc loc; }; pattern: diff --git a/colm/resolve.cc b/colm/resolve.cc index 2ad2d738..bf639738 100644 --- a/colm/resolve.cc +++ b/colm/resolve.cc @@ -274,8 +274,6 @@ void TypeRef::resolveRepeat( Compiler *pd ) UniqueType *TypeRef::lookupType( Compiler *pd ) { - cout << "looking up typeref at " << loc.line << ":" << loc.col << endl; - if ( uniqueType != 0 ) return uniqueType; |