mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-03-20 17:53:02 +00:00
* reader.c (copy_at): New function.
(copy_guard): Use it. (copy_action): Use it.
This commit is contained in:
@@ -1,3 +1,9 @@
|
|||||||
|
2000-03-17 Akim Demaille <akim@epita.fr>
|
||||||
|
|
||||||
|
* reader.c (copy_at): New function.
|
||||||
|
(copy_guard): Use it.
|
||||||
|
(copy_action): Use it.
|
||||||
|
|
||||||
2000-03-17 Akim Demaille <akim@epita.fr>
|
2000-03-17 Akim Demaille <akim@epita.fr>
|
||||||
|
|
||||||
Be kind to translators, save some useless translations.
|
Be kind to translators, save some useless translations.
|
||||||
|
|||||||
76
src/reader.c
76
src/reader.c
@@ -976,6 +976,36 @@ parse_expect_decl (void)
|
|||||||
|
|
||||||
/* that's all of parsing the declaration section */
|
/* that's all of parsing the declaration section */
|
||||||
|
|
||||||
|
/* FINPUT is pointing to a location (i.e., a `@'). Output to FOUTPUT
|
||||||
|
a reference to this location. STACK_OFFSET is the number of values
|
||||||
|
in the current rule so far, which says where to find `$0' with
|
||||||
|
respect to the top of the stack. */
|
||||||
|
static inline void
|
||||||
|
copy_at (FILE *finput, FILE *foutput, int stack_offset)
|
||||||
|
{
|
||||||
|
int c;
|
||||||
|
|
||||||
|
c = getc (finput);
|
||||||
|
if (c == '$')
|
||||||
|
{
|
||||||
|
fprintf (foutput, "yyloc");
|
||||||
|
yylsp_needed = 1;
|
||||||
|
}
|
||||||
|
else if (isdigit(c) || c == '-')
|
||||||
|
{
|
||||||
|
int n;
|
||||||
|
|
||||||
|
ungetc (c, finput);
|
||||||
|
n = read_signed_integer (finput);
|
||||||
|
|
||||||
|
fprintf (foutput, "yylsp[%d]", n - stack_offset);
|
||||||
|
yylsp_needed = 1;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
warns (_("@%s is invalid"), printable_version (c));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/* Get the data type (alternative in the union) of the value for symbol n in rule rule. */
|
/* Get the data type (alternative in the union) of the value for symbol n in rule rule. */
|
||||||
|
|
||||||
char *
|
char *
|
||||||
@@ -1130,26 +1160,7 @@ copy_guard (symbol_list *rule, int stack_offset)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case '@':
|
case '@':
|
||||||
c = getc (finput);
|
copy_at (finput, fguard, stack_offset);
|
||||||
if (c == '$')
|
|
||||||
{
|
|
||||||
fprintf (fguard, "yyloc");
|
|
||||||
yylsp_needed = 1;
|
|
||||||
}
|
|
||||||
else if (isdigit(c) || c == '-')
|
|
||||||
{
|
|
||||||
ungetc (c, finput);
|
|
||||||
n = read_signed_integer (finput);
|
|
||||||
c = getc (finput);
|
|
||||||
fprintf (fguard, "yylsp[%d]", n - stack_offset);
|
|
||||||
yylsp_needed = 1;
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
warns (_("@%s is invalid"), printable_version (c));
|
|
||||||
n = 1;
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case EOF:
|
case EOF:
|
||||||
@@ -1167,12 +1178,12 @@ copy_guard (symbol_list *rule, int stack_offset)
|
|||||||
|
|
||||||
fprintf(fguard, ";\n break;}");
|
fprintf(fguard, ";\n break;}");
|
||||||
if (c == '{')
|
if (c == '{')
|
||||||
copy_action(rule, stack_offset);
|
copy_action (rule, stack_offset);
|
||||||
else if (c == '=')
|
else if (c == '=')
|
||||||
{
|
{
|
||||||
c = getc(finput); /* why not skip_white_space -wjh */
|
c = getc(finput); /* why not skip_white_space -wjh */
|
||||||
if (c == '{')
|
if (c == '{')
|
||||||
copy_action(rule, stack_offset);
|
copy_action (rule, stack_offset);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
ungetc(c, finput);
|
ungetc(c, finput);
|
||||||
@@ -1289,26 +1300,7 @@ copy_action (symbol_list *rule, int stack_offset)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case '@':
|
case '@':
|
||||||
c = getc (finput);
|
copy_at (finput, faction, stack_offset);
|
||||||
if (c == '$')
|
|
||||||
{
|
|
||||||
fprintf (faction, "yyloc");
|
|
||||||
yylsp_needed = 1;
|
|
||||||
}
|
|
||||||
else if (isdigit(c) || c == '-')
|
|
||||||
{
|
|
||||||
ungetc (c, finput);
|
|
||||||
n = read_signed_integer (finput);
|
|
||||||
c = getc (finput);
|
|
||||||
fprintf (faction, "yylsp[%d]", n - stack_offset);
|
|
||||||
yylsp_needed = 1;
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
warns (_("@%s is invalid"), printable_version (c));
|
|
||||||
n = 1;
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case EOF:
|
case EOF:
|
||||||
|
|||||||
Reference in New Issue
Block a user