-C Add\sthe\sioerr3.test\sfile,\sthat\sfound\san\serror\sin\sbr3317.\sThe\serror\sis\snot\spresent\sin\sthis\sbranch.\s(CVS\s4640)
-D 2007-12-19T09:20:42
+C Fix\ssome\sissues\swith\slemon.\s\sTickets\s#2852\sand\s#2835.\s(CVS\s4641)
+D 2007-12-21T00:02:11
F Makefile.arm-wince-mingw32ce-gcc ac5f7b2cef0cd850d6f755ba6ee4ab961b1fadf7
F Makefile.in 30789bf70614bad659351660d76b8e533f3340e9
F Makefile.linux-gcc d53183f4aa6a9192d249731c90dbdffbd2c68654
F test/zeroblob.test 7d1854ea79d048e023e5f2e38106a7e99a17435c
F tool/diffdb.c 7524b1b5df217c20cd0431f6789851a4e0cb191b
F tool/fragck.tcl 5265a95126abcf6ab357f7efa544787e5963f439
-F tool/lemon.c 5b243377708d5fadb7ed4795ad6b2e9c379e1f0f
+F tool/lemon.c 1c5a788bdeccfcc61f2e11665e77cc74fd5ca92f
F tool/lempar.c 8f998bf8d08e2123149c2cc5d0597cd5d5d1abdd
F tool/memleak.awk 4e7690a51bf3ed757e611273d43fe3f65b510133
F tool/memleak2.awk 9cc20c8e8f3c675efac71ea0721ee6874a1566e8
F www/vdbe.tcl 87a31ace769f20d3627a64fa1fade7fed47b90d0
F www/version3.tcl 890248cf7b70e60c383b0e84d77d5132b3ead42b
F www/whentouse.tcl fc46eae081251c3c181bd79c5faef8195d7991a5
-P cdd866f59797b81b573c68d5c625f9bd9f0f6fde
-R ff63d5a53b9b64a61cb53c7cb7cd3109
-U danielk1977
-Z 8a273e2b803f60fa9acf4e5a0f85217b
+P d3efec148968538e225f5716359a6a25e8941362
+R 85004d42a22e2eebf7a2858fba477cd5
+U drh
+Z ad03768828df010e4ad9480b93fc71b4
ACCEPT,
REDUCE,
ERROR,
- CONFLICT, /* Was a reduce, but part of a conflict */
+ SSCONFLICT, /* A shift/shift conflict */
+ SRCONFLICT, /* Was a reduce, but part of a conflict */
+ RRCONFLICT, /* Was a reduce, but part of a conflict */
SH_RESOLVED, /* Was a shift. Precedence resolved conflict */
RD_RESOLVED, /* Was reduce. Precedence resolved conflict */
NOT_USED /* Deleted by compression */
if( freelist==0 ){
int i;
int amt = 100;
- freelist = (struct action *)malloc( sizeof(struct action)*amt );
+ freelist = (struct action *)calloc(amt, sizeof(struct action));
if( freelist==0 ){
fprintf(stderr,"Unable to allocate memory for a new parser action.");
exit(1);
){
int rc;
rc = ap1->sp->index - ap2->sp->index;
- if( rc==0 ) rc = (int)ap1->type - (int)ap2->type;
if( rc==0 ){
+ rc = (int)ap1->type - (int)ap2->type;
+ }
+ if( rc==0 && ap1->type==REDUCE ){
rc = ap1->x.rp->index - ap2->x.rp->index;
}
return rc;
/* Allocate a new acttab structure */
acttab *acttab_alloc(void){
- acttab *p = malloc( sizeof(*p) );
+ acttab *p = calloc( 1, sizeof(*p) );
if( p==0 ){
fprintf(stderr,"Unable to allocate memory for a new acttab.");
exit(1);
int errcnt = 0;
assert( apx->sp==apy->sp ); /* Otherwise there would be no conflict */
if( apx->type==SHIFT && apy->type==SHIFT ){
- apy->type = CONFLICT;
+ apy->type = SSCONFLICT;
errcnt++;
}
if( apx->type==SHIFT && apy->type==REDUCE ){
spy = apy->x.rp->precsym;
if( spy==0 || spx->prec<0 || spy->prec<0 ){
/* Not enough precedence information. */
- apy->type = CONFLICT;
+ apy->type = SRCONFLICT;
errcnt++;
}else if( spx->prec>spy->prec ){ /* Lower precedence wins */
apy->type = RD_RESOLVED;
apx->type = SH_RESOLVED;
}else{
assert( spx->prec==spy->prec && spx->assoc==NONE );
- apy->type = CONFLICT;
+ apy->type = SRCONFLICT;
errcnt++;
}
}else if( apx->type==REDUCE && apy->type==REDUCE ){
spy = apy->x.rp->precsym;
if( spx==0 || spy==0 || spx->prec<0 ||
spy->prec<0 || spx->prec==spy->prec ){
- apy->type = CONFLICT;
+ apy->type = RRCONFLICT;
errcnt++;
}else if( spx->prec>spy->prec ){
apy->type = RD_RESOLVED;
assert(
apx->type==SH_RESOLVED ||
apx->type==RD_RESOLVED ||
- apx->type==CONFLICT ||
+ apx->type==SSCONFLICT ||
+ apx->type==SRCONFLICT ||
+ apx->type==RRCONFLICT ||
apy->type==SH_RESOLVED ||
apy->type==RD_RESOLVED ||
- apy->type==CONFLICT
+ apy->type==SSCONFLICT ||
+ apy->type==SRCONFLICT ||
+ apy->type==RRCONFLICT
);
/* The REDUCE/SHIFT case cannot happen because SHIFTs come before
** REDUCEs on the list. If we reach this point it must be because
if( freelist==0 ){
int i;
int amt = 3;
- freelist = (struct config *)malloc( sizeof(struct config)*amt );
+ freelist = (struct config *)calloc( amt, sizeof(struct config) );
if( freelist==0 ){
fprintf(stderr,"Unable to allocate memory for a new configuration.");
exit(1);
Reprint(&lem);
}else{
/* Initialize the size for all follow and first sets */
- SetSize(lem.nterminal);
+ SetSize(lem.nterminal+1);
/* Find the precedence for every production rule (that has one) */
FindRulePrecedences(&lem);
case IN_RHS:
if( x[0]=='.' ){
struct rule *rp;
- rp = (struct rule *)malloc( sizeof(struct rule) +
- sizeof(struct symbol*)*psp->nrhs + sizeof(char*)*psp->nrhs );
+ rp = (struct rule *)calloc( sizeof(struct rule) +
+ sizeof(struct symbol*)*psp->nrhs + sizeof(char*)*psp->nrhs, 1);
if( rp==0 ){
ErrorMsg(psp->filename,psp->tokenlineno,
"Can't allocate enough memory for this rule.");
struct symbol *msp = psp->rhs[psp->nrhs-1];
if( msp->type!=MULTITERMINAL ){
struct symbol *origsp = msp;
- msp = malloc(sizeof(*msp));
+ msp = calloc(1,sizeof(*msp));
memset(msp, 0, sizeof(*msp));
msp->type = MULTITERMINAL;
msp->nsubsym = 1;
- msp->subsym = malloc(sizeof(struct symbol*));
+ msp->subsym = calloc(1,sizeof(struct symbol*));
msp->subsym[0] = origsp;
msp->name = origsp->name;
psp->rhs[psp->nrhs-1] = msp;
if( plink_freelist==0 ){
int i;
int amt = 100;
- plink_freelist = (struct plink *)malloc( sizeof(struct plink)*amt );
+ plink_freelist = (struct plink *)calloc( amt, sizeof(struct plink) );
if( plink_freelist==0 ){
fprintf(stderr,
"Unable to allocate memory for a new follow-set propagation link.\n");
case ERROR:
fprintf(fp,"%*s error",indent,ap->sp->name);
break;
- case CONFLICT:
+ case SRCONFLICT:
+ case RRCONFLICT:
fprintf(fp,"%*s reduce %-3d ** Parsing conflict **",
indent,ap->sp->name,ap->x.rp->index);
break;
+ case SSCONFLICT:
+ fprintf(fp,"%*s shift %d ** Parsing conflict **",
+ indent,ap->sp->name,ap->x.stp->statenum);
+ break;
case SH_RESOLVED:
case RD_RESOLVED:
case NOT_USED:
/* Allocate and initialize types[] and allocate stddt[] */
arraysize = lemp->nsymbol * 2;
- types = (char**)malloc( arraysize * sizeof(char*) );
+ types = (char**)calloc( arraysize, sizeof(char*) );
for(i=0; i<arraysize; i++) types[i] = 0;
maxdtlength = 0;
if( lemp->vartype ){
*/
/* Compute the actions on all states and count them up */
- ax = malloc( sizeof(ax[0])*lemp->nstate*2 );
+ ax = calloc(lemp->nstate*2, sizeof(ax[0]));
if( ax==0 ){
fprintf(stderr,"malloc failed\n");
exit(1);
char *SetNew(){
char *s;
int i;
- s = (char*)malloc( size );
+ s = (char*)calloc( size, 1);
if( s==0 ){
extern void memory_error();
memory_error();
}
- for(i=0; i<size; i++) s[i] = 0;
return s;
}
int e;
{
int rv;
+ assert( e>=0 && e<size );
rv = s[e];
s[e] = 1;
return !rv;
sp = Symbol_find(x);
if( sp==0 ){
- sp = (struct symbol *)malloc( sizeof(struct symbol) );
+ sp = (struct symbol *)calloc(1, sizeof(struct symbol) );
MemoryCheck(sp);
sp->name = Strsafe(x);
sp->type = isupper(*x) ? TERMINAL : NONTERMINAL;
int i,size;
if( x2a==0 ) return 0;
size = x2a->count;
- array = (struct symbol **)malloc( sizeof(struct symbol *)*size );
+ array = (struct symbol **)calloc(size, sizeof(struct symbol *));
if( array ){
for(i=0; i<size; i++) array[i] = x2a->tbl[i].data;
}
struct state *State_new()
{
struct state *new;
- new = (struct state *)malloc( sizeof(struct state) );
+ new = (struct state *)calloc(1, sizeof(struct state) );
MemoryCheck(new);
return new;
}