summaryrefslogtreecommitdiff
path: root/src/parser.cc
diff options
context:
space:
mode:
authorAdrian Thurston <thurston@complang.org>2014-01-18 18:21:08 -0500
committerAdrian Thurston <thurston@complang.org>2014-01-18 18:21:08 -0500
commit74c213affd86ed2df6f70a37b1b63b09ef94090b (patch)
treeb70dac934a1ac6ac82c95e6083dfd0801438ba19 /src/parser.cc
parent02ce09a1e32a178707d6699bf2555ff8b164188c (diff)
downloadcolm-74c213affd86ed2df6f70a37b1b63b09ef94090b.tar.gz
new syntax for collect-ignore tokens: token <id> -
Diffstat (limited to 'src/parser.cc')
-rw-r--r--src/parser.cc28
1 files changed, 6 insertions, 22 deletions
diff --git a/src/parser.cc b/src/parser.cc
index 462255d5..f1a0dfc6 100644
--- a/src/parser.cc
+++ b/src/parser.cc
@@ -235,41 +235,25 @@ void BaseParser::defineToken( const InputLoc &loc, String name, LexJoin *join, O
}
}
-void BaseParser::zeroDef( const InputLoc &loc, const String &data,
- bool noPreIgnore, bool noPostIgnore )
+void BaseParser::zeroDef( const InputLoc &loc, const String &name )
{
- /* Create a name for the literal. */
- String name( 32, "_literal_%.4x", pd->nextTokenId );
-
if ( !insideRegion() )
error(loc) << "zero token should be inside token" << endp;
- String interp("");;
-
- /* Look for the production's associated region. */
- Namespace *nspace = curNspace();
RegionSet *regionSet = regionStack.top();
+ Namespace *nspace = curNspace();
- LiteralDictEl *ldel = nspace->literalDict.find( interp );
- if ( ldel != 0 )
- error( loc ) << "literal already defined in this namespace" << endp;
-
- LexJoin *join = literalJoin( loc, data );
+ LexJoin *join = literalJoin( loc, String("`") );
- TokenDef *tokenDef = TokenDef::cons( name, data, true, false, join,
- 0, loc, 0, nspace, regionSet, 0, 0 );
+ TokenDef *tokenDef = TokenDef::cons( name, String(), false, false, join,
+ 0, loc, 0, nspace, regionSet, 0, curContext() );
tokenDef->isZero = true;
regionSet->tokenDefList.append( tokenDef );
nspace->tokenDefList.append( tokenDef );
- TokenInstance *tokenInstance = TokenInstance::cons( tokenDef, join,
- loc, pd->nextTokenId++, nspace, regionSet->tokenIgnore );
-
- /* Doesn't go into instance list. */
-
- ldel = nspace->literalDict.insert( interp, tokenInstance );
+ /* No token instance created. */
}
void BaseParser::literalDef( const InputLoc &loc, const String &data,