* 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>
* src/output.c (prepare): Drop the muscle `ntbase' which

View File

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