static int lowzero;
static int high;
-struct obstack muscle_obstack;
static struct obstack format_obstack;
int error_verbose = 0;
int j = 0;
for (i = 0; i < nsyms; i++)
{
- /* Be sure not to use twice the same quotearg slot. */
+ /* Be sure not to use twice the same QUOTEARG slot:
+ SYMBOL_TAG_GET uses slot 0. */
const char *cp =
quotearg_n_style (1, c_quoting_style,
- quotearg_style (escape_quoting_style,
- symbols[i]->tag));
+ symbol_tag_get (symbols[i]));
/* Width of the next token, including the two quotes, the coma
and the space. */
int strsize = strlen (cp) + 2;
/* Separator in RHS. */
rhs[i++] = -1;
/* Line where rule was defined. */
- rline[r] = rules[r].line;
+ rline[r] = rules[r].location.first_line;
}
assert (i == nritems);
for (j = 0; j < ntokens; j++)
/* and record this rule as the rule to use if that
token follows. */
- if (bitset_test (LA[state->lookaheadsp + i], j))
- actrow[j] = -LArule[state->lookaheadsp + i]->number;
+ if (bitset_test (state->lookaheads[i], j))
+ actrow[j] = -state->lookaheads_rule[i]->number;
}
/* Now see which tokens are allowed for shifts in this state. For
for (i = 0; i < state->nlookaheads; i++)
{
int count = 0;
- int rule = -LArule[state->lookaheadsp + i]->number;
+ int rule = -state->lookaheads_rule[i]->number;
int j;
for (j = 0; j < ntokens; j++)
if (!no_lines_flag)
fprintf (out, muscle_find ("linef"),
- rules[rule].action_line,
+ rules[rule].action_location.first_line,
quotearg_style (c_quoting_style,
muscle_find ("filename")));
- /* As a Bison extension, add the ending semicolon. Since some
- Yacc don't do that, help people using bison as a Yacc
- finding their missing semicolons. */
- fprintf (out, "{ %s%s }\n break;\n\n",
- rules[rule].action,
- yacc_flag ? ";" : "");
+ fprintf (out, " %s\n break;\n\n",
+ rules[rule].action);
}
}
}
\f
+/*----------------------.
+| Run our backend, M4. |
+`----------------------*/
+
+static void
+m4_invoke (const char *definitions)
+{
+ /* Invoke m4 on the definition of the muscles, and the skeleton. */
+ const char *bison_pkgdatadir = getenv ("BISON_PKGDATADIR");
+ const char *m4 = getenv ("M4");
+ int pkg_data_len;
+ char *full_skeleton;
+
+ if (!m4)
+ m4 = M4;
+ if (!bison_pkgdatadir)
+ bison_pkgdatadir = PKGDATADIR;
+ pkg_data_len = strlen (bison_pkgdatadir);
+ full_skeleton = XMALLOC (char, pkg_data_len + strlen (skeleton) + 2);
+ if (bison_pkgdatadir[pkg_data_len-1] == '/')
+ sprintf (full_skeleton, "%s%s", bison_pkgdatadir, skeleton);
+ else
+ sprintf (full_skeleton, "%s/%s", bison_pkgdatadir, skeleton);
+ if (trace_flag)
+ fprintf (stderr,
+ "running: %s -I %s m4sugar/m4sugar.m4 %s %s\n",
+ m4, bison_pkgdatadir, definitions, full_skeleton);
+ skel_in = readpipe (m4,
+ "-I", bison_pkgdatadir,
+ "m4sugar/m4sugar.m4",
+ definitions,
+ full_skeleton,
+ NULL);
+ XFREE (full_skeleton);
+ if (!skel_in)
+ error (EXIT_FAILURE, errno, "cannot run m4");
+ skel_lex ();
+
+}
+
/*---------------------------.
| Call the skeleton parser. |
`---------------------------*/
fputs ("m4_divert_push(0)dnl\n", out);
xfclose (out);
- /* Invoke m4 on the definition of the muscles, and the skeleton. */
- {
- const char *bison_pkgdatadir = getenv ("BISON_PKGDATADIR");
- const char *m4 = getenv ("M4");
- int pkg_data_len;
- char *full_skeleton;
-
- if (!m4)
- m4 = M4;
- if (!bison_pkgdatadir)
- bison_pkgdatadir = PKGDATADIR;
- pkg_data_len = strlen (bison_pkgdatadir);
- full_skeleton = XMALLOC (char, pkg_data_len + strlen (skeleton) + 1);
- if (bison_pkgdatadir[pkg_data_len-1] == '/')
- sprintf (full_skeleton, "%s%s", bison_pkgdatadir, skeleton);
- else
- sprintf (full_skeleton, "%s/%s", bison_pkgdatadir, skeleton);
- if (trace_flag)
- fprintf (stderr,
- "running: %s -I %s m4sugar/m4sugar.m4 %s %s\n",
- m4, bison_pkgdatadir, tempfile, full_skeleton);
- skel_in = readpipe (m4,
- "-I", bison_pkgdatadir,
- "m4sugar/m4sugar.m4",
- tempfile,
- full_skeleton,
- NULL);
- XFREE (full_skeleton);
- if (!skel_in)
- error (EXIT_FAILURE, errno, "cannot run m4");
- skel_lex ();
-
- /* If `debugging', keep this file alive. */
- if (!trace_flag)
- unlink (tempfile);
- }
+ m4_invoke (tempfile);
+
+ /* If `debugging', keep this file alive. */
+ if (!trace_flag)
+ unlink (tempfile);
+
+ free (tempfile);
}
static void
/* Process the selected skeleton file. */
output_skeleton ();
- obstack_free (&muscle_obstack, NULL);
obstack_free (&format_obstack, NULL);
- obstack_free (&action_obstack, NULL);
obstack_free (&pre_prologue_obstack, NULL);
obstack_free (&post_prologue_obstack, NULL);
}