* bison.s1: Formatting and cosmetics changes.

* reader.c: Likewise.
Update the Copyright notice.
This commit is contained in:
Akim Demaille
2000-03-17 11:28:47 +00:00
parent dc08c1d53b
commit 41aca2e038
4 changed files with 77 additions and 65 deletions

View File

@@ -1,3 +1,9 @@
2000-03-17 Akim Demaille <akim@epita.fr>
* bison.s1: Formatting and cosmetics changes.
* reader.c: Likewise.
Update the Copyright notice.
2000-03-17 Akim Demaille <akim@epita.fr> 2000-03-17 Akim Demaille <akim@epita.fr>
* bison.s1 (#line): All set to `#line' only, since the Makefile * bison.s1 (#line): All set to `#line' only, since the Makefile

View File

@@ -132,20 +132,22 @@ while (0)
# endif /* not YYLSP_NEEDED */ # endif /* not YYLSP_NEEDED */
#endif #endif
/* If nonreentrant, generate the variables here */ /* If nonreentrant, generate the variables here. */
#ifndef YYPURE #ifndef YYPURE
/* The lookahead symbol. */
int yychar;
int yychar; /* the lookahead symbol */ /* The semantic value of the lookahead symbol. */
YYSTYPE yylval; /* the semantic value of the */ YYSTYPE yylval;
/* lookahead symbol */
# ifdef YYLSP_NEEDED # ifdef YYLSP_NEEDED
YYLTYPE yylloc; /* location data for the lookahead */ /* Location data for the lookahead symbol. */
/* symbol */ YYLTYPE yylloc;
# endif # endif
int yynerrs; /* number of parse errors so far */ /* Number of parse errors so far. */
int yynerrs;
#endif /* not YYPURE */ #endif /* not YYPURE */
@@ -587,10 +589,9 @@ $ /* the action file gets copied in in place of this dollarsign */
} }
#endif #endif
/* Now "shift" the result of the reduction. /* Now `shift' the result of the reduction. Determine what state
Determine what state that goes to, that goes to, based on the state we popped back to and the rule
based on the state we popped back to number reduced by. */
and the rule number reduced by. */
yyn = yyr1[yyn]; yyn = yyr1[yyn];

View File

@@ -132,20 +132,22 @@ while (0)
# endif /* not YYLSP_NEEDED */ # endif /* not YYLSP_NEEDED */
#endif #endif
/* If nonreentrant, generate the variables here */ /* If nonreentrant, generate the variables here. */
#ifndef YYPURE #ifndef YYPURE
/* The lookahead symbol. */
int yychar;
int yychar; /* the lookahead symbol */ /* The semantic value of the lookahead symbol. */
YYSTYPE yylval; /* the semantic value of the */ YYSTYPE yylval;
/* lookahead symbol */
# ifdef YYLSP_NEEDED # ifdef YYLSP_NEEDED
YYLTYPE yylloc; /* location data for the lookahead */ /* Location data for the lookahead symbol. */
/* symbol */ YYLTYPE yylloc;
# endif # endif
int yynerrs; /* number of parse errors so far */ /* Number of parse errors so far. */
int yynerrs;
#endif /* not YYPURE */ #endif /* not YYPURE */
@@ -587,10 +589,9 @@ $ /* the action file gets copied in in place of this dollarsign */
} }
#endif #endif
/* Now "shift" the result of the reduction. /* Now `shift' the result of the reduction. Determine what state
Determine what state that goes to, that goes to, based on the state we popped back to and the rule
based on the state we popped back to number reduced by. */
and the rule number reduced by. */
yyn = yyr1[yyn]; yyn = yyr1[yyn];

View File

@@ -1,5 +1,5 @@
/* Input parser for bison /* Input parser for bison
Copyright (C) 1984, 1986, 1989, 1992, 1998 Free Software Foundation, Inc. Copyright (C) 1984, 86, 89, 92, 98, 2000 Free Software Foundation, Inc.
This file is part of Bison, the GNU Compiler Compiler. This file is part of Bison, the GNU Compiler Compiler.
@@ -19,10 +19,11 @@ the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */ Boston, MA 02111-1307, USA. */
/* read in the grammar specification and record it in the format described in gram.h. /* Read in the grammar specification and record it in the format
All guards are copied into the fguard file and all actions into faction, described in gram.h. All guards are copied into the fguard file
in each case forming the body of a C function (yyguard or yyaction) and all actions into faction, in each case forming the body of a C
which contains a switch statement to decide which guard or action to execute. function (yyguard or yyaction) which contains a switch statement to
decide which guard or action to execute.
The entry point is reader (). */ The entry point is reader (). */
@@ -239,9 +240,9 @@ reader_output_yylsp (FILE *f)
fprintf(f, LTYPESTR); fprintf(f, LTYPESTR);
} }
/* read from finput until %% is seen. Discard the %%. /* Read from finput until `%%' is seen. Discard the `%%'. Handle any
Handle any % declarations, `%' declarations, and copy the contents of any `%{ ... %}' groups
and copy the contents of any %{ ... %} groups to fattrs. */ to fattrs. */
void void
read_declarations (void) read_declarations (void)
@@ -973,12 +974,12 @@ get_type_name (int n, symbol_list *rule)
} }
/* after %guard is seen in the input file, /* After `%guard' is seen in the input file, copy the actual guard
copy the actual guard into the guards file. into the guards file. If the guard is followed by an action, copy
If the guard is followed by an action, copy that into the actions file. that into the actions file. STACK_OFFSET is the number of values
stack_offset is the number of values in the current rule so far, in the current rule so far, which says where to find `$0' with
which says where to find $0 with respect to the top of the stack, respect to the top of the stack, for the simple parser in which the
for the simple parser in which the stack is not popped until after the guard is run. */ stack is not popped until after the guard is run. */
void void
copy_guard (symbol_list *rule, int stack_offset) copy_guard (symbol_list *rule, int stack_offset)
@@ -1136,13 +1137,13 @@ copy_guard (symbol_list *rule, int stack_offset)
if (c == '$') if (c == '$')
{ {
fprintf(fguard, "yyval"); fprintf(fguard, "yyval");
if (!type_name) type_name = rule->sym->type_name; if (!type_name)
type_name = rule->sym->type_name;
if (type_name) if (type_name)
fprintf(fguard, ".%s", type_name); fprintf(fguard, ".%s", type_name);
if(!type_name && typed) if(!type_name && typed)
warns(_("$$ of `%s' has no declared type"), rule->sym->tag); warns(_("$$ of `%s' has no declared type"), rule->sym->tag);
} }
else if (isdigit(c) || c == '-') else if (isdigit(c) || c == '-')
{ {
ungetc (c, finput); ungetc (c, finput);
@@ -1211,10 +1212,10 @@ copy_guard (symbol_list *rule, int stack_offset)
/* Assuming that a { has just been seen, copy everything up to the matching } /* Assuming that a `{' has just been seen, copy everything up to the
into the actions file. matching `}' into the actions file. STACK_OFFSET is the number of
stack_offset is the number of values in the current rule so far, values in the current rule so far, which says where to find `$0'
which says where to find $0 with respect to the top of the stack. */ with respect to the top of the stack. */
void void
copy_action (symbol_list *rule, int stack_offset) copy_action (symbol_list *rule, int stack_offset)
@@ -1228,7 +1229,8 @@ copy_action (symbol_list *rule, int stack_offset)
int cplus_comment; int cplus_comment;
/* offset is always 0 if parser has already popped the stack pointer */ /* offset is always 0 if parser has already popped the stack pointer */
if (semantic_parser) stack_offset = 0; if (semantic_parser)
stack_offset = 0;
fprintf (faction, "\ncase %d:\n", nrules); fprintf (faction, "\ncase %d:\n", nrules);
if (!nolinesflag) if (!nolinesflag)
@@ -1361,11 +1363,13 @@ copy_action (symbol_list *rule, int stack_offset)
if (c == '$') if (c == '$')
{ {
fprintf(faction, "yyval"); fprintf(faction, "yyval");
if (!type_name) type_name = get_type_name(0, rule); if (!type_name)
type_name = get_type_name(0, rule);
if (type_name) if (type_name)
fprintf(faction, ".%s", type_name); fprintf(faction, ".%s", type_name);
if(!type_name && typed) if(!type_name && typed)
warns(_("$$ of `%s' has no declared type"), rule->sym->tag); warns(_("$$ of `%s' has no declared type"),
rule->sym->tag);
} }
else if (isdigit(c) || c == '-') else if (isdigit(c) || c == '-')
{ {