summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdrian Thurston <thurston@complang.org>2012-07-22 11:12:10 -0400
committerAdrian Thurston <thurston@complang.org>2012-07-22 11:12:10 -0400
commitd2550313796c4ec7012f5769c66b6d88c7a13a65 (patch)
treedac76324081e6219dc8517ab936a07105b9fcc75
parentcf04ad267bb75d7830ea403ce6af01859e9418ed (diff)
downloadcolm-d2550313796c4ec7012f5769c66b6d88c7a13a65.tar.gz
cleanup: removed Token from PdaRun
Token is a data structure for the parser, not the collected parse tree. PdaLiteral now collects location and data.
-rw-r--r--src/ctinput.cc4
-rw-r--r--src/lmparse.kl8
-rw-r--r--src/parsedata.h6
-rw-r--r--src/resolve.cc4
-rw-r--r--src/synthesis.cc12
5 files changed, 17 insertions, 17 deletions
diff --git a/src/ctinput.cc b/src/ctinput.cc
index b5086268..eb71e560 100644
--- a/src/ctinput.cc
+++ b/src/ctinput.cc
@@ -229,8 +229,8 @@ LangEl *inputStreamReplGetLangEl( SourceStream *is, long *bindId, char **data, l
if ( is->replItem->factor->typeRef->pdaLiteral != 0 ) {
bool unusedCI;
prepareLitString( is->replItem->data, unusedCI,
- is->replItem->factor->typeRef->pdaLiteral->token.data,
- is->replItem->factor->typeRef->pdaLiteral->token.loc );
+ is->replItem->factor->typeRef->pdaLiteral->data,
+ is->replItem->factor->typeRef->pdaLiteral->loc );
*data = is->replItem->data;
*length = is->replItem->data.length();
diff --git a/src/lmparse.kl b/src/lmparse.kl
index e5b28a5a..6e496c5c 100644
--- a/src/lmparse.kl
+++ b/src/lmparse.kl
@@ -272,7 +272,7 @@ pred_token:
pred_token:
region_qual TK_Literal
final {
- PdaLiteral *literal = new PdaLiteral( $2->loc, *$2 );
+ PdaLiteral *literal = new PdaLiteral( $2->loc, $2->data );
TypeRef *typeRef = TypeRef::cons( $2->loc, $1->nspaceQual, literal );
PredDecl *predDecl = new PredDecl( typeRef, predType, pd->predValue );
@@ -660,7 +660,7 @@ pattern_el_type_or_lit: region_qual TK_Word opt_repeat
pattern_el_type_or_lit: region_qual TK_Literal opt_repeat
final {
- PdaLiteral *literal = new PdaLiteral( $2->loc, *$2 );
+ PdaLiteral *literal = new PdaLiteral( $2->loc, $2->data );
TypeRef *typeRef = TypeRef::cons( $2->loc, $1->nspaceQual, literal, $3->repeatType );
ProdEl *factor = new ProdEl( ProdEl::ReferenceType, $2->loc, 0, false, typeRef, 0 );
@@ -716,7 +716,7 @@ repl_el_list: ;
repl_el: region_qual TK_Literal
final {
- PdaLiteral *literal = new PdaLiteral( $2->loc, *$2 );
+ PdaLiteral *literal = new PdaLiteral( $2->loc, $2->data );
TypeRef *typeRef = TypeRef::cons( $2->loc, $1->nspaceQual, literal );
ProdEl *factor = new ProdEl( ProdEl::LiteralType, $2->loc, 0, false, typeRef, 0 );
ReplItem *replItem = ReplItem::cons( $2->loc, ReplItem::FactorType, factor );
@@ -864,7 +864,7 @@ prod_el:
opt_capture opt_commit region_qual TK_Literal opt_repeat
final {
/* Create a new factor node going to a concat literal. */
- PdaLiteral *literal = new PdaLiteral( $4->loc, *$4 );
+ PdaLiteral *literal = new PdaLiteral( $4->loc, $4->data );
TypeRef *typeRef = TypeRef::cons( $4->loc, $3->nspaceQual, literal, $5->repeatType );
$$->factor = new ProdEl( ProdEl::LiteralType, $4->loc, $1->objField, $2->commit, typeRef, 0 );
diff --git a/src/parsedata.h b/src/parsedata.h
index 66437422..f5e00b24 100644
--- a/src/parsedata.h
+++ b/src/parsedata.h
@@ -330,11 +330,11 @@ struct ProdElList : public DList<ProdEl>
/* This should be renamed. It is a literal string in a type reference. */
struct PdaLiteral
{
- PdaLiteral( const InputLoc &loc, const Token &token )
- : loc(loc), token(token), value(0) { }
+ PdaLiteral( const InputLoc &loc, const String &data )
+ : loc(loc), data(data), value(0) { }
InputLoc loc;
- Token token;
+ String data;
long value;
};
diff --git a/src/resolve.cc b/src/resolve.cc
index 6df73cba..31dd3883 100644
--- a/src/resolve.cc
+++ b/src/resolve.cc
@@ -70,8 +70,8 @@ UniqueType *TypeRef::lookupTypeLiteral( Compiler *pd )
/* Interpret escape sequences and remove quotes. */
bool unusedCI;
String interp;
- prepareLitString( interp, unusedCI, pdaLiteral->token.data,
- pdaLiteral->token.loc );
+ prepareLitString( interp, unusedCI, pdaLiteral->data,
+ pdaLiteral->loc );
while ( nspace != 0 ) {
LiteralDictEl *ldel = nspace->literalDict.find( interp );
diff --git a/src/synthesis.cc b/src/synthesis.cc
index a8ef43bb..fab28449 100644
--- a/src/synthesis.cc
+++ b/src/synthesis.cc
@@ -1359,8 +1359,8 @@ UniqueType *LangTerm::evaluateParse2( Compiler *pd, CodeVect &code ) const
String result;
bool unusedCI;
prepareLitString( result, unusedCI,
- item->factor->typeRef->pdaLiteral->token.data,
- item->factor->typeRef->pdaLiteral->token.loc );
+ item->factor->typeRef->pdaLiteral->data,
+ item->factor->typeRef->pdaLiteral->loc );
/* Make sure we have this string. */
StringMapEl *mapEl = 0;
@@ -1434,8 +1434,8 @@ UniqueType *LangTerm::evaluateSend( Compiler *pd, CodeVect &code ) const
String result;
bool unusedCI;
prepareLitString( result, unusedCI,
- item->factor->typeRef->pdaLiteral->token.data,
- item->factor->typeRef->pdaLiteral->token.loc );
+ item->factor->typeRef->pdaLiteral->data,
+ item->factor->typeRef->pdaLiteral->loc );
/* Make sure we have this string. */
StringMapEl *mapEl = 0;
@@ -1647,8 +1647,8 @@ UniqueType *LangTerm::evaluateEmbedString( Compiler *pd, CodeVect &code ) const
String result;
bool unusedCI;
prepareLitString( result, unusedCI,
- item->factor->typeRef->pdaLiteral->token.data,
- item->factor->typeRef->pdaLiteral->token.loc );
+ item->factor->typeRef->pdaLiteral->data,
+ item->factor->typeRef->pdaLiteral->loc );
/* Make sure we have this string. */
StringMapEl *mapEl = 0;