* src/bison.hairy: Formatting/comment changes.

ANSIfy.
Remove `register' indications.
Add plenty of `static'.
This commit is contained in:
Akim Demaille
2001-12-27 18:04:43 +00:00
parent 7742ddebf1
commit 1b177bd731
2 changed files with 104 additions and 96 deletions

View File

@@ -1,3 +1,10 @@
2001-12-27 Akim Demaille <akim@epita.fr>
* src/bison.hairy: Formatting/comment changes.
ANSIfy.
Remove `register' indications.
Add plenty of `static'.
2001-12-27 Akim Demaille <akim@epita.fr> 2001-12-27 Akim Demaille <akim@epita.fr>
* src/output.c (prepare): Drop the muscle `ntbase' which * src/output.c (prepare): Drop the muscle `ntbase' which

View File

@@ -1,83 +1,88 @@
/* -*- C -*- */ /* -*- C -*- */
extern int timeclock;
/* YYERROR and YYCOST are set by guards. If yyerror is set to a
nonzero value by a guard, the reduction with which the guard is
associated is not performed, and the error recovery mechanism is
invoked. Yycost indicates the cost of performing the reduction
given the attributes of the symbols. */
static int yyerror;
static int yycost;
int yyerror; /* Yyerror and yycost are set by guards. */ /* YYMAXDEPTH indicates the size of the parser's state and value
int yycost; /* If yyerror is set to a nonzero value by a */ stacks. */
/* guard, the reduction with which the guard */
/* is associated is not performed, and the */
/* error recovery mechanism is invoked. */
/* Yycost indicates the cost of performing */
/* the reduction given the attributes of the */
/* symbols. */
/* YYMAXDEPTH indicates the size of the parser's state and value */
/* stacks. */
#ifndef YYMAXDEPTH #ifndef YYMAXDEPTH
#define YYMAXDEPTH 500 # define YYMAXDEPTH 500
#endif #endif
/* YYMAXRULES must be at least as large as the number of rules that */ /* YYMAXRULES must be at least as large as the number of rules that
/* could be placed in the rule queue. That number could be determined */ could be placed in the rule queue. That number could be determined
/* from the grammar and the size of the stack, but, as yet, it is not. */ from the grammar and the size of the stack, but, as yet, it is not.
*/
#ifndef YYMAXRULES #ifndef YYMAXRULES
#define YYMAXRULES 100 # define YYMAXRULES 100
#endif #endif
#ifndef YYMAXBACKUP #ifndef YYMAXBACKUP
#define YYMAXBACKUP 100 # define YYMAXBACKUP 100
#endif #endif
short yyss[YYMAXDEPTH]; /* the state stack */ /* The state stack. */
YYSTYPE yyvs[YYMAXDEPTH]; /* the semantic value stack */ static short yyss[YYMAXDEPTH];
YYLTYPE yyls[YYMAXDEPTH]; /* the location stack */ /* The semantic value stack. */
short yyrq[YYMAXRULES]; /* the rule queue */ static YYSTYPE yyvs[YYMAXDEPTH];
int yychar; /* the lookahead symbol */ /* The location stack. */
static YYLTYPE yyls[YYMAXDEPTH];
/* The rule queue. */
static short yyrq[YYMAXRULES];
/* The lookahead symbol. */
static int yychar;
YYSTYPE yylval; /* the semantic value of the */ /* the semantic value of the lookahead symbol. */
/* lookahead symbol */ static YYSTYPE yylval;
YYSTYPE yytval; /* the semantic value for the state */ /* the semantic value for the state at the top of the state stack. */
/* at the top of the state stack. */ static YYSTYPE yytval;
YYSTYPE yyval; /* the variable used to return */ /* the variable used to return semantic values from the action
/* semantic values from the action */ routines. */
/* routines */ static YYSTYPE yyval;
YYLTYPE yylloc; /* location data for the lookahead */ /* location data for the lookahead symbol. */
/* symbol */ static YYLTYPE yylloc;
YYLTYPE yytloc; /* location data for the state at the */ /* location data for the state at the top of the state stack. */
/* top of the state stack */ static YYLTYPE yytloc;
int yynunlexed; static int yynunlexed;
short yyunchar[YYMAXBACKUP]; static short yyunchar[YYMAXBACKUP];
YYSTYPE yyunval[YYMAXBACKUP]; static YYSTYPE yyunval[YYMAXBACKUP];
YYLTYPE yyunloc[YYMAXBACKUP]; static YYLTYPE yyunloc[YYMAXBACKUP];
short *yygssp; /* a pointer to the top of the state */ /* a pointer to the top of the state stack; only set during error
/* stack; only set during error */ recovery. */
/* recovery. */ static short *yygssp;
YYSTYPE *yygvsp; /* a pointer to the top of the value */ /* a pointer to the top of the value stack; only set during error
/* stack; only set during error */ recovery. */
/* recovery. */ static YYSTYPE *yygvsp;
YYLTYPE *yyglsp; /* a pointer to the top of the */ /* a pointer to the top of the location stack; only set during error
/* location stack; only set during */ recovery. */
/* error recovery. */ static YYLTYPE *yyglsp;
/* Yyget is an interface between the parser and the lexical analyzer. */ /*--------------------------------------------------------------------.
/* It is costly to provide such an interface, but it avoids requiring */ | Yyget is an interface between the parser and the lexical analyzer. |
/* the lexical analyzer to be able to back up the scan. */ | It is costly to provide such an interface, but it avoids requiring |
| the lexical analyzer to be able to back up the scan. |
`--------------------------------------------------------------------*/
yyget() static inline void
yyget (void)
{ {
if (yynunlexed > 0) if (yynunlexed > 0)
{ {
@@ -90,19 +95,17 @@ yyget()
yychar = 0; yychar = 0;
else else
{ {
yychar = yylex(); yychar = yylex ();
if (yychar < 0) if (yychar < 0)
yychar = 0; yychar = 0;
else yychar = YYTRANSLATE(yychar); else
yychar = YYTRANSLATE (yychar);
} }
} }
static inline void
yyunlex(chr, val, loc) yyunlex (int chr, YYSTYPE val, YYLTYPE loc)
int chr;
YYSTYPE val;
YYLTYPE loc;
{ {
yyunchar[yynunlexed] = chr; yyunchar[yynunlexed] = chr;
yyunval[yynunlexed] = val; yyunval[yynunlexed] = val;
@@ -111,19 +114,17 @@ YYLTYPE loc;
} }
static inline void
yyrestore(first, last) yyrestore (short *first, short *last)
register short *first;
register short *last;
{ {
register short *ssp; short *ssp;
register short *rp; short *rp;
register int symbol; int symbol;
register int state; int state;
register int tvalsaved; int tvalsaved;
ssp = yygssp; ssp = yygssp;
yyunlex(yychar, yylval, yylloc); yyunlex (yychar, yylval, yylloc);
tvalsaved = 0; tvalsaved = 0;
while (first != last) while (first != last)
@@ -131,7 +132,7 @@ register short *last;
symbol = yystos[*ssp]; symbol = yystos[*ssp];
if (symbol < YYNTBASE) if (symbol < YYNTBASE)
{ {
yyunlex(symbol, yytval, yytloc); yyunlex (symbol, yytval, yytloc);
tvalsaved = 1; tvalsaved = 1;
ssp--; ssp--;
} }
@@ -161,9 +162,9 @@ register short *last;
} }
} }
if ( ! tvalsaved && ssp > yyss) if (!tvalsaved && ssp > yyss)
{ {
yyunlex(yystos[*ssp], yytval, yytloc); yyunlex (yystos[*ssp], yytval, yytloc);
ssp--; ssp--;
} }
@@ -173,14 +174,14 @@ register short *last;
int int
yyparse() yyparse (void)
{ {
register int yystate; int yystate;
register int yyn; int yyn;
register short *yyssp; short *yyssp;
register short *yyrq0; short *yyrq0;
register short *yyptr; short *yyptr;
register YYSTYPE *yyvsp; YYSTYPE *yyvsp;
int yylen; int yylen;
YYLTYPE *yylsp; YYLTYPE *yylsp;
@@ -195,16 +196,17 @@ yyparse()
yyrq1 = yyrq0; yyrq1 = yyrq0;
yyrq2 = yyrq0; yyrq2 = yyrq0;
yychar = yylex(); yychar = yylex ();
if (yychar < 0) if (yychar < 0)
yychar = 0; yychar = 0;
else yychar = YYTRANSLATE(yychar); else
yychar = YYTRANSLATE (yychar);
yynewstate: yynewstate:
if (yyssp >= yyss + YYMAXDEPTH - 1) if (yyssp >= yyss + YYMAXDEPTH - 1)
{ {
yyabort("Parser Stack Overflow"); yyabort ("Parser Stack Overflow");
YYABORT; YYABORT;
} }
@@ -239,31 +241,30 @@ yyresume:
yyvsp -= yylen; yyvsp -= yylen;
yylsp -= yylen; yylsp -= yylen;
yyguard(yyn, yyvsp, yylsp); yyguard (yyn, yyvsp, yylsp);
if (yyerror) if (yyerror)
goto yysemerr; goto yysemerr;
yyaction(yyn, yyvsp, yylsp); yyaction (yyn, yyvsp, yylsp);
*++yyvsp = yyval; *++yyvsp = yyval;
yylsp++; yylsp++;
if (yylen == 0) if (yylen == 0)
{ {
yylsp->timestamp = timeclock;
yylsp->first_line = yytloc.first_line; yylsp->first_line = yytloc.first_line;
yylsp->first_column = yytloc.first_column; yylsp->first_column = yytloc.first_column;
yylsp->last_line = (yylsp-1)->last_line; yylsp->last_line = (yylsp - 1)->last_line;
yylsp->last_column = (yylsp-1)->last_column; yylsp->last_column = (yylsp - 1)->last_column;
yylsp->text = 0; yylsp->text = 0;
} }
else else
{ {
yylsp->last_line = (yylsp+yylen-1)->last_line; yylsp->last_line = (yylsp + yylen - 1)->last_line;
yylsp->last_column = (yylsp+yylen-1)->last_column; yylsp->last_column = (yylsp + yylen - 1)->last_column;
} }
if (yyptr == yyrq + YYMAXRULES) if (yyptr == yyrq + YYMAXRULES)
yyptr = yyrq; yyptr = yyrq;
} }
if (yystate == YYFINAL) if (yystate == YYFINAL)
@@ -276,7 +277,7 @@ yyresume:
*++yylsp = yytloc; *++yylsp = yytloc;
yytval = yylval; yytval = yylval;
yytloc = yylloc; yytloc = yylloc;
yyget(); yyget ();
goto yynewstate; goto yynewstate;
@@ -295,7 +296,7 @@ yyreduce:
if (yyrq0 == yyrq2) if (yyrq0 == yyrq2)
{ {
yyabort("Parser Rule Queue Overflow"); yyabort ("Parser Rule Queue Overflow");
YYABORT; YYABORT;
} }
@@ -320,8 +321,8 @@ yyerrlab:
yygssp = yyssp; yygssp = yyssp;
yygvsp = yyvsp; yygvsp = yyvsp;
yyglsp = yylsp; yyglsp = yylsp;
yyrestore(yyrq0, yyrq2); yyrestore (yyrq0, yyrq2);
yyrecover(); yyrecover ();
yystate = *yygssp; yystate = *yygssp;
yyssp = yygssp; yyssp = yygssp;
yyvsp = yygvsp; yyvsp = yygvsp;
@@ -331,4 +332,4 @@ yyerrlab:
goto yyresume; goto yyresume;
} }
%% actions %%actions