s/return (foo)/return foo/

This commit is contained in:
Akim Demaille
2000-03-31 14:27:06 +00:00
parent a0f6b07611
commit 3628146521
14 changed files with 113 additions and 92 deletions

View File

@@ -1,6 +1,16 @@
2000-03-31 Akim Demaille <akim@epita.fr> 2000-03-31 Akim Demaille <akim@epita.fr>
Clean the error reporting functions. * allocate.c: s/return (foo)/return foo/.
* lalr.c: Likewise.
* LR0.c: Likewise.
* output.c: Likewise.
* reader.c: Likewise.
* symtab.c: Likewise.
* vmsgetargs.c: Likewise.
2000-03-31 Akim Demaille <akim@epita.fr>
Clean up the error reporting functions.
* src/report.c: New file. * src/report.c: New file.
* src/report.h: Likewise. * src/report.h: Likewise.

View File

@@ -5,7 +5,7 @@
msgid "" msgid ""
msgstr "" msgstr ""
"Project-Id-Version: bison 1.25\n" "Project-Id-Version: bison 1.25\n"
"POT-Creation-Date: 2000-03-31 15:40+0200\n" "POT-Creation-Date: 2000-03-31 16:02+0200\n"
"PO-Revision-Date: 1996-10-10 17:54 MET DST\n" "PO-Revision-Date: 1996-10-10 17:54 MET DST\n"
"Last-Translator: Ulrich Drepper <drepper@gnu.ai.mit.edu>\n" "Last-Translator: Ulrich Drepper <drepper@gnu.ai.mit.edu>\n"
"Language-Team: German <de@li.org>\n" "Language-Team: German <de@li.org>\n"

View File

@@ -30,7 +30,7 @@
msgid "" msgid ""
msgstr "" msgstr ""
"Project-Id-Version: GNU bison 1.25\n" "Project-Id-Version: GNU bison 1.25\n"
"POT-Creation-Date: 2000-03-31 15:40+0200\n" "POT-Creation-Date: 2000-03-31 16:02+0200\n"
"PO-Revision-Date: 1998-09-21 10:19+0200\n" "PO-Revision-Date: 1998-09-21 10:19+0200\n"
"Last-Translator: Nicolás García-Pedrajas <ngarcia-pedrajas@acm.org>\n" "Last-Translator: Nicolás García-Pedrajas <ngarcia-pedrajas@acm.org>\n"
"Language-Team: Spanish <es@li.org>\n" "Language-Team: Spanish <es@li.org>\n"

View File

@@ -5,7 +5,7 @@
msgid "" msgid ""
msgstr "" msgstr ""
"Project-Id-Version: bison 1.25\n" "Project-Id-Version: bison 1.25\n"
"POT-Creation-Date: 2000-03-31 15:40+0200\n" "POT-Creation-Date: 2000-03-31 16:02+0200\n"
"PO-Revision-Date: 1996-03-19 20:05 EST\n" "PO-Revision-Date: 1996-03-19 20:05 EST\n"
"Last-Translator: Dominique Boucher <boucherd@IRO.UMontreal.CA>\n" "Last-Translator: Dominique Boucher <boucherd@IRO.UMontreal.CA>\n"
"Language-Team: French <fr@li.org>\n" "Language-Team: French <fr@li.org>\n"

View File

@@ -5,7 +5,7 @@
msgid "" msgid ""
msgstr "" msgstr ""
"Project-Id-Version: bison 1.25\n" "Project-Id-Version: bison 1.25\n"
"POT-Creation-Date: 2000-03-31 15:40+0200\n" "POT-Creation-Date: 2000-03-31 16:02+0200\n"
"PO-Revision-Date: 1996-08-27 15:34 MET DST\n" "PO-Revision-Date: 1996-08-27 15:34 MET DST\n"
"Last-Translator: Erick Branderhorst <branderh@debian.org>\n" "Last-Translator: Erick Branderhorst <branderh@debian.org>\n"
"Language-Team: Dutch <nl@li.org>\n" "Language-Team: Dutch <nl@li.org>\n"

View File

@@ -5,7 +5,7 @@
msgid "" msgid ""
msgstr "" msgstr ""
"Project-Id-Version: bison 1.25\n" "Project-Id-Version: bison 1.25\n"
"POT-Creation-Date: 2000-03-31 15:40+0200\n" "POT-Creation-Date: 2000-03-31 16:02+0200\n"
"PO-Revision-Date: 1999-07-12 12:18\n" "PO-Revision-Date: 1999-07-12 12:18\n"
"Last-Translator: Dmitry S. Sivachenko <dima@Chg.RU>\n" "Last-Translator: Dmitry S. Sivachenko <dima@Chg.RU>\n"
"Language-Team: Russian <ru@li.org>\n" "Language-Team: Russian <ru@li.org>\n"

View File

@@ -353,7 +353,7 @@ get_state (int symbol)
state_table[key] = sp = new_state(symbol); state_table[key] = sp = new_state(symbol);
} }
return (sp->number); return sp->number;
} }
@@ -394,7 +394,7 @@ new_state (int symbol)
nstates++; nstates++;
return (p); return p;
} }

View File

@@ -60,7 +60,7 @@ xmalloc (register unsigned n)
done (1); done (1);
} }
return (block); return block;
} }
char * char *
@@ -76,5 +76,5 @@ xrealloc (register char *block, register unsigned n)
done (1); done (1);
} }
return (block); return block;
} }

View File

@@ -352,7 +352,7 @@ map_goto (int state, int symbol)
middle = (low + high) / 2; middle = (low + high) / 2;
s = from_state[middle]; s = from_state[middle];
if (s == state) if (s == state)
return (middle); return middle;
else if (s < state) else if (s < state)
low = middle + 1; low = middle + 1;
else else
@@ -617,7 +617,7 @@ transpose (short **R_arg, int n)
FREE(temp_R); FREE(temp_R);
return (new_R); return new_R;
} }

View File

@@ -158,7 +158,7 @@ skip_white_space (void)
break; break;
default: default:
return (c); return c;
} }
} }
} }
@@ -314,7 +314,7 @@ lex (void)
symval = unlexed_symval; symval = unlexed_symval;
c = unlexed; c = unlexed;
unlexed = -1; unlexed = -1;
return (c); return c;
} }
c = skip_white_space(); c = skip_white_space();
@@ -325,7 +325,7 @@ lex (void)
{ {
case EOF: case EOF:
strcpy(token_buffer, "EOF"); strcpy(token_buffer, "EOF");
return (ENDFILE); return ENDFILE;
case 'A': case 'B': case 'C': case 'D': case 'E': case 'A': case 'B': case 'C': case 'D': case 'E':
case 'F': case 'G': case 'H': case 'I': case 'J': case 'F': case 'G': case 'H': case 'I': case 'J':
@@ -353,7 +353,7 @@ lex (void)
*p = 0; *p = 0;
ungetc(c, finput); ungetc(c, finput);
symval = getsym(token_buffer); symval = getsym(token_buffer);
return (IDENTIFIER); return IDENTIFIER;
case '0': case '1': case '2': case '3': case '4': case '0': case '1': case '2': case '3': case '4':
case '5': case '6': case '7': case '8': case '9': case '5': case '6': case '7': case '8': case '9':
@@ -372,7 +372,7 @@ lex (void)
} }
*p = 0; *p = 0;
ungetc(c, finput); ungetc(c, finput);
return (NUMBER); return NUMBER;
} }
case '\'': case '\'':
@@ -405,7 +405,7 @@ lex (void)
symval->class = STOKEN; symval->class = STOKEN;
if (! symval->user_token_number) if (! symval->user_token_number)
symval->user_token_number = code; symval->user_token_number = code;
return (IDENTIFIER); return IDENTIFIER;
} }
case '\"': case '\"':
@@ -427,23 +427,23 @@ lex (void)
symval = getsym(token_buffer); symval = getsym(token_buffer);
symval->class = STOKEN; symval->class = STOKEN;
return (IDENTIFIER); return IDENTIFIER;
} }
case ',': case ',':
return (COMMA); return COMMA;
case ':': case ':':
return (COLON); return COLON;
case ';': case ';':
return (SEMICOLON); return SEMICOLON;
case '|': case '|':
return (BAR); return BAR;
case '{': case '{':
return (LEFT_CURLY); return LEFT_CURLY;
case '=': case '=':
do do
@@ -456,12 +456,12 @@ lex (void)
if (c == '{') if (c == '{')
{ {
strcpy(token_buffer, "={"); strcpy(token_buffer, "={");
return(LEFT_CURLY); return LEFT_CURLY;
} }
else else
{ {
ungetc(c, finput); ungetc(c, finput);
return(ILLEGAL); return ILLEGAL;
} }
case '<': case '<':
@@ -485,14 +485,14 @@ lex (void)
c = getc(finput); c = getc(finput);
} }
*p = 0; *p = 0;
return (TYPENAME); return TYPENAME;
case '%': case '%':
return (parse_percent_token()); return parse_percent_token();
default: default:
return (ILLEGAL); return ILLEGAL;
} }
} }
@@ -570,28 +570,28 @@ parse_percent_token (void)
switch (c) switch (c)
{ {
case '%': case '%':
return (TWO_PERCENTS); return TWO_PERCENTS;
case '{': case '{':
return (PERCENT_LEFT_CURLY); return PERCENT_LEFT_CURLY;
case '<': case '<':
return (LEFT); return LEFT;
case '>': case '>':
return (RIGHT); return RIGHT;
case '2': case '2':
return (NONASSOC); return NONASSOC;
case '0': case '0':
return (TOKEN); return TOKEN;
case '=': case '=':
return (PREC); return PREC;
} }
if (!isalpha(c)) if (!isalpha(c))
return (ILLEGAL); return ILLEGAL;
p = token_buffer; p = token_buffer;
*p++ = '%'; *p++ = '%';

View File

@@ -656,10 +656,11 @@ output_actions (void)
/* figure out the actions for the specified state, indexed by lookahead token type. /* Figure out the actions for the specified state, indexed by
lookahead token type.
The yydefact table is output now. The detailed info The yydefact table is output now. The detailed info is saved for
is saved for putting into yytable later. */ putting into yytable later. */
void void
token_actions (void) token_actions (void)
@@ -700,16 +701,17 @@ token_actions (void)
/* Decide what to do for each type of token if seen as the lookahead token in specified state. /* Decide what to do for each type of token if seen as the lookahead
The value returned is used as the default action (yydefact) for the state. token in specified state. The value returned is used as the
In addition, actrow is filled with what to do for each kind of token, default action (yydefact) for the state. In addition, actrow is
index by symbol number, with zero meaning do the default action. filled with what to do for each kind of token, index by symbol
The value MINSHORT, a very negative number, means this situation number, with zero meaning do the default action. The value
is an error. The parser recognizes this value specially. MINSHORT, a very negative number, means this situation is an error.
The parser recognizes this value specially.
This is where conflicts are resolved. The loop over lookahead rules This is where conflicts are resolved. The loop over lookahead
considered lower-numbered rules last, and the last rule considered that likes rules considered lower-numbered rules last, and the last rule
a token gets to handle it. */ considered that likes a token gets to handle it. */
int int
action_row (int state) action_row (int state)
@@ -746,7 +748,8 @@ action_row (int state)
if (nreds >= 1) if (nreds >= 1)
{ {
/* loop over all the rules available here which require lookahead */ /* loop over all the rules available here which require
lookahead */
m = lookaheads[state]; m = lookaheads[state];
n = lookaheads[state + 1]; n = lookaheads[state + 1];
@@ -756,10 +759,12 @@ action_row (int state)
wordp = LA + i * tokensetsize; wordp = LA + i * tokensetsize;
mask = 1; mask = 1;
/* and find each token which the rule finds acceptable to come next */ /* and find each token which the rule finds acceptable
to come next */
for (j = 0; j < ntokens; j++) for (j = 0; j < ntokens; j++)
{ {
/* and record this rule as the rule to use if that token follows. */ /* and record this rule as the rule to use if that
token follows. */
if (mask & *wordp) if (mask & *wordp)
actrow[j] = rule; actrow[j] = rule;
@@ -776,8 +781,9 @@ action_row (int state)
shiftp = shift_table[state]; shiftp = shift_table[state];
/* now see which tokens are allowed for shifts in this state. /* Now see which tokens are allowed for shifts in this state. For
For them, record the shift as the thing to do. So shift is preferred to reduce. */ them, record the shift as the thing to do. So shift is preferred
to reduce. */
if (shiftp) if (shiftp)
{ {
@@ -795,16 +801,17 @@ action_row (int state)
actrow[symbol] = shift_state; actrow[symbol] = shift_state;
/* do not use any default reduction if there is a shift for error */ /* Do not use any default reduction if there is a shift for
error */
if (symbol == error_token_number) nodefault = 1; if (symbol == error_token_number)
nodefault = 1;
} }
} }
errp = err_table[state]; errp = err_table[state];
/* See which tokens are an explicit error in this state /* See which tokens are an explicit error in this state (due to
(due to %nonassoc). For them, record MINSHORT as the action. */ %nonassoc). For them, record MINSHORT as the action. */
if (errp) if (errp)
{ {
@@ -817,7 +824,8 @@ action_row (int state)
} }
} }
/* now find the most common reduction and make it the default action for this state. */ /* Now find the most common reduction and make it the default action
for this state. */
if (nreds >= 1 && ! nodefault) if (nreds >= 1 && ! nodefault)
{ {
@@ -870,7 +878,7 @@ action_row (int state)
actrow[j] = 0; actrow[j] = 0;
} }
return (default_rule); return default_rule;
} }
@@ -970,7 +978,7 @@ default_goto (int symbol)
n = goto_map[symbol + 1]; n = goto_map[symbol + 1];
if (m == n) if (m == n)
return (-1); return -1;
for (i = 0; i < nstates; i++) for (i = 0; i < nstates; i++)
state_count[i] = 0; state_count[i] = 0;
@@ -990,7 +998,7 @@ default_goto (int symbol)
} }
} }
return (default_state); return default_state;
} }
@@ -1140,7 +1148,7 @@ matching_state (int vector)
i = order[vector]; i = order[vector];
if (i >= nstates) if (i >= nstates)
return (-1); return -1;
t = tally[i]; t = tally[i];
w = width[i]; w = width[i];
@@ -1149,7 +1157,7 @@ matching_state (int vector)
{ {
j = order[prev]; j = order[prev];
if (width[j] != w || tally[j] != t) if (width[j] != w || tally[j] != t)
return (-1); return -1;
match = 1; match = 1;
for (k = 0; match && k < t; k++) for (k = 0; match && k < t; k++)
@@ -1159,10 +1167,10 @@ matching_state (int vector)
} }
if (match) if (match)
return (j); return j;
} }
return (-1); return -1;
} }
@@ -1223,7 +1231,7 @@ pack_vector (int vector)
if (loc > high) if (loc > high)
high = loc; high = loc;
return (j); return j;
} }
} }
@@ -1455,10 +1463,11 @@ free_itemsets (void)
FREE(state_table); FREE(state_table);
for (cp = first_state; cp; cp = cptmp) { for (cp = first_state; cp; cp = cptmp)
cptmp=cp->next; {
FREE(cp); cptmp=cp->next;
} FREE(cp);
}
} }
@@ -1469,10 +1478,11 @@ free_shifts (void)
FREE(shift_table); FREE(shift_table);
for (sp = first_shift; sp; sp = sptmp) { for (sp = first_shift; sp; sp = sptmp)
sptmp=sp->next; {
FREE(sp); sptmp=sp->next;
} FREE(sp);
}
} }
@@ -1483,8 +1493,9 @@ free_reductions (void)
FREE(reduction_table); FREE(reduction_table);
for (rp = first_reduction; rp; rp = rptmp) { for (rp = first_reduction; rp; rp = rptmp)
rptmp=rp->next; {
FREE(rp); rptmp=rp->next;
} FREE(rp);
}
} }

View File

@@ -1027,7 +1027,7 @@ get_type_name (int n, symbol_list *rule)
i++; i++;
} }
return (rp->sym->type_name); return rp->sym->type_name;
} }
@@ -1332,7 +1332,7 @@ gensym (void)
sym = getsym(token_buffer); sym = getsym(token_buffer);
sym->class = SNTERM; sym->class = SNTERM;
sym->value = nvars++; sym->value = nvars++;
return (sym); return sym;
} }
/* Parse the input grammar into a one symbol_list structure. /* Parse the input grammar into a one symbol_list structure.
@@ -1685,7 +1685,7 @@ get_type (void)
switch (t) switch (t)
{ {
case SEMICOLON: case SEMICOLON:
return (lex()); return lex();
case COMMA: case COMMA:
break; break;
@@ -1699,7 +1699,7 @@ get_type (void)
break; break;
default: default:
return (t); return t;
} }
} }
} }

View File

@@ -45,7 +45,7 @@ hash (char *key)
while (*cp) while (*cp)
k = ((k << 1) ^ (*cp++)) & 0x3fff; k = ((k << 1) ^ (*cp++)) & 0x3fff;
return (k % TABSIZE); return k % TABSIZE;
} }
@@ -63,7 +63,7 @@ copys (char *s)
result = xmalloc((unsigned int)i); result = xmalloc((unsigned int)i);
strcpy(result, s); strcpy(result, s);
return (result); return result;
} }
@@ -122,7 +122,7 @@ getsym (char *key)
symtab[hashval] = bp; symtab[hashval] = bp;
} }
return (bp); return bp;
} }

View File

@@ -156,7 +156,7 @@ cli_present(Name)
Descr.Ptr = Name; Descr.Ptr = Name;
Descr.Size = strlen(Name); Descr.Size = strlen(Name);
return((cli$present(&Descr) & 1) ? 1 : 0); return (cli$present(&Descr) & 1) ? 1 : 0;
} }
/* /*
@@ -175,7 +175,7 @@ cli_get_value(Name,Buffer,Size)
Descr2.Size = Size-1; Descr2.Size = Size-1;
if (cli$get_value(&Descr1,&Descr2,&Descr2.Size) & 1) { if (cli$get_value(&Descr1,&Descr2,&Descr2.Size) & 1) {
Buffer[Descr2.Size] = 0; Buffer[Descr2.Size] = 0;
return(1); return 1;
} }
return(0); return 0;
} }