Merge remote-tracking branch 'origin/maint'

* origin/maint: (29 commits)
  regen
  synclines: remove spurious empty line
  also support $<foo>$ in the %initial-action
  skeletons: b4_dollar_pushdef and popdef to simpify complex definitions
  regen
  printer/destructor: translate only once
  factor the handling of m4 escaping
  news: schedule the removal of the ";" hack
  style changes in the scanners
  regen
  support $<tag>$ in printers and destructors
  scan-code: factor the handling of the type in $<TYPE>$
  muscles: fix another occurrence of unescaped type name
  glr.cc: fix the handling of yydebug
  gnulib: update
  formatting changes
  tests: fix an assertion
  tests: adjust to GCC 4.8, which displays caret errors
  be sure to properly escape type names
  obstack_quote: escape and quote for M4
  muscles: shuffle responsabilities
  muscles: make private functions static
  muscles: rename private functions/macros
  obstack_escape: escape M4 characters
  remove dead macro
  maint: style changes
  doc: avoid problems with case insensitive file systems
  configure: fix botched quoting
  news: fix typo.

Conflicts:
	NEWS
	data/c.m4
	data/glr.cc
	data/lalr1.cc
	examples/rpcalc/local.mk
	src/muscle-tab.h
	src/output.c
	src/parse-gram.c
	src/parse-gram.h
	src/parse-gram.y
	src/scan-code.l
	src/symlist.c
	src/symlist.h
	src/symtab.h
	tests/calc.at
This commit is contained in:
Akim Demaille
2012-07-27 16:22:45 +02:00
32 changed files with 669 additions and 294 deletions

View File

@@ -108,29 +108,39 @@ GENERATE_MUSCLE_INSERT_TABLE(muscle_insert_symbol_number_table, symbol_number)
GENERATE_MUSCLE_INSERT_TABLE(muscle_insert_state_number_table, state_number)
/*--------------------------------------------------------------------.
| Print to OUT a representation of STRING escaped both for C and M4. |
`--------------------------------------------------------------------*/
/*----------------------------------------------------------------.
| Print to OUT a representation of CP quoted and escaped for M4. |
`----------------------------------------------------------------*/
static void
escaped_output (FILE *out, char const *string)
quoted_output (FILE *out, char const *cp)
{
char const *p;
fprintf (out, "[[");
for (p = quotearg_style (c_quoting_style, string); *p; p++)
switch (*p)
for (; *cp; cp++)
switch (*cp)
{
case '$': fputs ("$][", out); break;
case '@': fputs ("@@", out); break;
case '[': fputs ("@{", out); break;
case ']': fputs ("@}", out); break;
default: fputc (*p, out); break;
default: fputc (*cp, out); break;
}
fprintf (out, "]]");
}
/*----------------------------------------------------------------.
| Print to OUT a representation of STRING quoted and escaped both |
| for C and M4. |
`----------------------------------------------------------------*/
static void
string_output (FILE *out, char const *string)
{
quoted_output (out, quotearg_style (c_quoting_style, string));
}
/*------------------------------------------------------------------.
| Prepare the muscles related to the symbols: translate, tname, and |
@@ -174,7 +184,7 @@ prepare_symbols (void)
if (i)
obstack_1grow (&format_obstack, ' ');
MUSCLE_OBSTACK_SGROW (&format_obstack, cp);
obstack_escape (&format_obstack, cp);
free (cp);
obstack_1grow (&format_obstack, ',');
j += width;
@@ -355,7 +365,7 @@ user_actions_output (FILE *out)
fprintf (out, "b4_%scase(%d, [b4_syncline(%d, ",
rules[r].is_predicate ? "predicate_" : "",
r + 1, rules[r].action_location.start.line);
escaped_output (out, rules[r].action_location.start.file);
string_output (out, rules[r].action_location.start.file);
fprintf (out, ")\n[ %s]])\n\n", rules[r].action);
}
fputs ("])\n\n", out);