summaryrefslogtreecommitdiff
path: root/src/compiler.cc
diff options
context:
space:
mode:
authorAdrian Thurston <thurston@complang.org>2016-03-02 17:02:54 +0100
committerAdrian Thurston <thurston@complang.org>2016-03-02 19:01:30 +0100
commitf951638a502cb71ddc3632d54ef4929226669444 (patch)
treec8dacbf82fbd586311fbe1efe327336c26242bbe /src/compiler.cc
parentf5a07574923fdf1f398a6650ea599096737d75f3 (diff)
downloadcolm-f951638a502cb71ddc3632d54ef4929226669444.tar.gz
prep code for managing stream name in the stream destructor
Requires strduping static names, and also copying names when stealing location information when a stream is pushed onto a stream. Can't yet delete (strings need after colm program is deleted). Need a solution for delated delete of a program's strings.
Diffstat (limited to 'src/compiler.cc')
-rw-r--r--src/compiler.cc6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/compiler.cc b/src/compiler.cc
index 5a33ed31..3020d7f5 100644
--- a/src/compiler.cc
+++ b/src/compiler.cc
@@ -990,7 +990,7 @@ void Compiler::initEmptyScanners()
pda_run *Compiler::parsePattern( program_t *prg, tree_t **sp, const InputLoc &loc,
int parserId, struct stream_impl *sourceStream )
{
- struct stream_impl *in = colm_impl_new_generic( "<internal>" );
+ struct stream_impl *in = colm_impl_new_generic( strdup("<internal>") );
struct pda_run *pdaRun = new pda_run;
colm_pda_init( prg, pdaRun, pdaTables, parserId, 0, false, 0, false );
@@ -1035,13 +1035,13 @@ void Compiler::parsePatterns()
for ( ConsList::Iter cons = replList; cons.lte(); cons++ ) {
if ( cons->langEl != 0 ) {
- struct stream_impl *in = colm_impl_new_cons( "<internal>", cons );
+ struct stream_impl *in = colm_impl_new_cons( strdup("<internal>"), cons );
cons->pdaRun = parsePattern( prg, sp, cons->loc, cons->langEl->parserId, in );
}
}
for ( PatList::Iter pat = patternList; pat.lte(); pat++ ) {
- struct stream_impl *in = colm_impl_new_pat( "<internal>", pat );
+ struct stream_impl *in = colm_impl_new_pat( strdup("<internal>"), pat );
pat->pdaRun = parsePattern( prg, sp, pat->loc, pat->langEl->parserId, in );
}