/* Part of the bison parser generator,
- Copyright (C) 1984, 1989, 2000 Free Software Foundation, Inc.
+ Copyright 1984, 1989, 2000, 2001 Free Software Foundation, Inc.
This file is part of Bison, the GNU Compiler Compiler.
do so. */
#include "system.h"
+#include "getargs.h"
#include "types.h"
#include "gram.h"
-#include "alloc.h"
#include "nullable.h"
char *nullable = NULL;
char any_tokens;
short *r1;
-#ifdef TRACE
- fprintf (stderr, _("Entering set_nullable"));
-#endif
+ if (trace_flag)
+ fprintf (stderr, "Entering set_nullable");
- nullable = NEW2 (nvars, char) - ntokens;
+ nullable = XCALLOC (char, nvars) - ntokens;
- squeue = NEW2 (nvars, short);
+ squeue = XCALLOC (short, nvars);
s1 = s2 = squeue;
- rcount = NEW2 (nrules + 1, short);
- rsets = NEW2 (nvars, shorts *) - ntokens;
+ rcount = XCALLOC (short, nrules + 1);
+ rsets = XCALLOC (shorts *, nvars) - ntokens;
/* This is said to be more elements than we actually use.
Supposedly nitems - nrules is enough.
But why take the risk? */
- relts = NEW2 (nitems + nvars + 1, shorts);
+ relts = XCALLOC (shorts, nitems + nvars + 1);
p = relts;
r = ritem;
{
if (*r < 0)
{
- symbol = rlhs[-(*r++)];
+ symbol = rule_table[-(*r++)].lhs;
if (symbol >= 0 && !nullable[symbol])
{
nullable[symbol] = 1;
p = p->next;
if (--rcount[ruleno] == 0)
{
- symbol = rlhs[ruleno];
+ symbol = rule_table[ruleno].lhs;
if (symbol >= 0 && !nullable[symbol])
{
nullable[symbol] = 1;
}
}
- FREE (squeue);
- FREE (rcount);
- FREE (rsets + ntokens);
- FREE (relts);
+ XFREE (squeue);
+ XFREE (rcount);
+ XFREE (rsets + ntokens);
+ XFREE (relts);
}
void
free_nullable (void)
{
- FREE (nullable + ntokens);
+ XFREE (nullable + ntokens);
}