{
CharSet *cs = new CharSet();
uint j;
- memset(cs, 0, sizeof(CharSet));
for (j = 0; j < nRealChars; ++j)
{
}
cs->freeHead = &cs->ptn[1];
- *(cs->freeTail = &cs->ptn[nChars - 1].nxt) = NULL;
- cs->ptn[0].card = nChars;
+ *(cs->freeTail = &cs->ptn[nRealChars - 1].nxt) = NULL;
+ cs->ptn[0].card = nRealChars;
cs->ptn[0].nxt = NULL;
re->split(*cs);
/*
for(uint k = 0; k < nChars;){
- for(j = k; ++k < nChars && cs->rep[k] == cs->rep[j];);
+ for(j = k; ++k < nRealChars && cs->rep[k] == cs->rep[j];);
printSpan(cerr, j, k);
cerr << "\t" << cs->rep[j] - &cs->ptn[0] << endl;
}
*/
- Char rep[nChars];
+ Char *rep = new Char[nRealChars];
for (j = 0; j < nRealChars; ++j)
{
dfa->emit(o, ind);
delete dfa;
delete [] ins;
+ delete [] rep;
delete cs;
}
#include <iostream>
#include "token.h"
#include "ins.h"
+#include "globals.h"
namespace re2c
{
CharPtn *nxt;
};
+typedef CharPtn *CharPtr;
+
struct CharSet
{
+ CharSet()
+ : fix(0)
+ , freeHead(0)
+ , freeTail(0)
+ , rep(new CharPtr[nRealChars])
+ , ptn(new CharPtn[nRealChars])
+ {
+ }
+
+ ~CharSet()
+ {
+ delete[] rep;
+ delete[] ptn;
+ }
+
CharPtn *fix;
CharPtn *freeHead, **freeTail;
- CharPtn *rep[nChars];
- CharPtn ptn[nChars];
+ CharPtr *rep;
+ CharPtn *ptn;
};
class Range