From 3628146521aa93cdd499fa5058d21c7be33014bf Mon Sep 17 00:00:00 2001 From: Akim Demaille Date: Fri, 31 Mar 2000 14:27:06 +0000 Subject: [PATCH] s/return (foo)/return foo/ --- ChangeLog | 12 ++++++- po/de.po | 2 +- po/es.po | 2 +- po/fr.po | 2 +- po/nl.po | 2 +- po/ru.po | 2 +- src/LR0.c | 4 +-- src/allocate.c | 4 +-- src/lalr.c | 4 +-- src/lex.c | 50 ++++++++++++++--------------- src/output.c | 97 +++++++++++++++++++++++++++++++------------------------- src/reader.c | 8 ++--- src/symtab.c | 6 ++-- src/vmsgetargs.c | 10 +++--- 14 files changed, 113 insertions(+), 92 deletions(-) diff --git a/ChangeLog b/ChangeLog index 040af56..f42aff0 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,6 +1,16 @@ 2000-03-31 Akim Demaille - 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 + + Clean up the error reporting functions. * src/report.c: New file. * src/report.h: Likewise. diff --git a/po/de.po b/po/de.po index 0210c94..85f883a 100644 --- a/po/de.po +++ b/po/de.po @@ -5,7 +5,7 @@ msgid "" msgstr "" "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" "Last-Translator: Ulrich Drepper \n" "Language-Team: German \n" diff --git a/po/es.po b/po/es.po index 5449a00..5505edb 100644 --- a/po/es.po +++ b/po/es.po @@ -30,7 +30,7 @@ msgid "" msgstr "" "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" "Last-Translator: Nicolás García-Pedrajas \n" "Language-Team: Spanish \n" diff --git a/po/fr.po b/po/fr.po index 6e73dd6..71d247f 100644 --- a/po/fr.po +++ b/po/fr.po @@ -5,7 +5,7 @@ msgid "" msgstr "" "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" "Last-Translator: Dominique Boucher \n" "Language-Team: French \n" diff --git a/po/nl.po b/po/nl.po index 3f18ccf..a3ee381 100644 --- a/po/nl.po +++ b/po/nl.po @@ -5,7 +5,7 @@ msgid "" msgstr "" "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" "Last-Translator: Erick Branderhorst \n" "Language-Team: Dutch \n" diff --git a/po/ru.po b/po/ru.po index 8e399a9..53bb6cc 100644 --- a/po/ru.po +++ b/po/ru.po @@ -5,7 +5,7 @@ msgid "" msgstr "" "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" "Last-Translator: Dmitry S. Sivachenko \n" "Language-Team: Russian \n" diff --git a/src/LR0.c b/src/LR0.c index d03dfb5..8bdcd75 100644 --- a/src/LR0.c +++ b/src/LR0.c @@ -353,7 +353,7 @@ get_state (int symbol) state_table[key] = sp = new_state(symbol); } - return (sp->number); + return sp->number; } @@ -394,7 +394,7 @@ new_state (int symbol) nstates++; - return (p); + return p; } diff --git a/src/allocate.c b/src/allocate.c index fdc8385..31bb0d5 100644 --- a/src/allocate.c +++ b/src/allocate.c @@ -60,7 +60,7 @@ xmalloc (register unsigned n) done (1); } - return (block); + return block; } char * @@ -76,5 +76,5 @@ xrealloc (register char *block, register unsigned n) done (1); } - return (block); + return block; } diff --git a/src/lalr.c b/src/lalr.c index 767c646..27e3d28 100644 --- a/src/lalr.c +++ b/src/lalr.c @@ -352,7 +352,7 @@ map_goto (int state, int symbol) middle = (low + high) / 2; s = from_state[middle]; if (s == state) - return (middle); + return middle; else if (s < state) low = middle + 1; else @@ -617,7 +617,7 @@ transpose (short **R_arg, int n) FREE(temp_R); - return (new_R); + return new_R; } diff --git a/src/lex.c b/src/lex.c index cf4f7e5..b59793b 100644 --- a/src/lex.c +++ b/src/lex.c @@ -158,7 +158,7 @@ skip_white_space (void) break; default: - return (c); + return c; } } } @@ -314,7 +314,7 @@ lex (void) symval = unlexed_symval; c = unlexed; unlexed = -1; - return (c); + return c; } c = skip_white_space(); @@ -325,7 +325,7 @@ lex (void) { case EOF: strcpy(token_buffer, "EOF"); - return (ENDFILE); + return ENDFILE; case 'A': case 'B': case 'C': case 'D': case 'E': case 'F': case 'G': case 'H': case 'I': case 'J': @@ -353,7 +353,7 @@ lex (void) *p = 0; ungetc(c, finput); symval = getsym(token_buffer); - return (IDENTIFIER); + return IDENTIFIER; case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': @@ -372,7 +372,7 @@ lex (void) } *p = 0; ungetc(c, finput); - return (NUMBER); + return NUMBER; } case '\'': @@ -405,7 +405,7 @@ lex (void) symval->class = STOKEN; if (! symval->user_token_number) symval->user_token_number = code; - return (IDENTIFIER); + return IDENTIFIER; } case '\"': @@ -427,23 +427,23 @@ lex (void) symval = getsym(token_buffer); symval->class = STOKEN; - return (IDENTIFIER); + return IDENTIFIER; } case ',': - return (COMMA); + return COMMA; case ':': - return (COLON); + return COLON; case ';': - return (SEMICOLON); + return SEMICOLON; case '|': - return (BAR); + return BAR; case '{': - return (LEFT_CURLY); + return LEFT_CURLY; case '=': do @@ -456,12 +456,12 @@ lex (void) if (c == '{') { strcpy(token_buffer, "={"); - return(LEFT_CURLY); + return LEFT_CURLY; } else { ungetc(c, finput); - return(ILLEGAL); + return ILLEGAL; } case '<': @@ -485,14 +485,14 @@ lex (void) c = getc(finput); } *p = 0; - return (TYPENAME); + return TYPENAME; case '%': - return (parse_percent_token()); + return parse_percent_token(); default: - return (ILLEGAL); + return ILLEGAL; } } @@ -570,28 +570,28 @@ parse_percent_token (void) switch (c) { case '%': - return (TWO_PERCENTS); + return TWO_PERCENTS; case '{': - return (PERCENT_LEFT_CURLY); + return PERCENT_LEFT_CURLY; case '<': - return (LEFT); + return LEFT; case '>': - return (RIGHT); + return RIGHT; case '2': - return (NONASSOC); + return NONASSOC; case '0': - return (TOKEN); + return TOKEN; case '=': - return (PREC); + return PREC; } if (!isalpha(c)) - return (ILLEGAL); + return ILLEGAL; p = token_buffer; *p++ = '%'; diff --git a/src/output.c b/src/output.c index f7e2188..113393f 100644 --- a/src/output.c +++ b/src/output.c @@ -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 - is saved for putting into yytable later. */ + The yydefact table is output now. The detailed info is saved for + putting into yytable later. */ 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. - The value returned is used as the default action (yydefact) for the state. - In addition, actrow is filled with what to do for each kind of token, - index by symbol number, with zero meaning do the default action. - The value MINSHORT, a very negative number, means this situation - is an error. The parser recognizes this value specially. +/* Decide what to do for each type of token if seen as the lookahead + token in specified state. The value returned is used as the + default action (yydefact) for the state. In addition, actrow is + filled with what to do for each kind of token, index by symbol + number, with zero meaning do the default action. The value + 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 - considered lower-numbered rules last, and the last rule considered that likes - a token gets to handle it. */ + This is where conflicts are resolved. The loop over lookahead + rules considered lower-numbered rules last, and the last rule + considered that likes a token gets to handle it. */ int action_row (int state) @@ -746,7 +748,8 @@ action_row (int state) 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]; n = lookaheads[state + 1]; @@ -756,10 +759,12 @@ action_row (int state) wordp = LA + i * tokensetsize; 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++) { - /* 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) actrow[j] = rule; @@ -776,8 +781,9 @@ action_row (int state) shiftp = shift_table[state]; - /* now see which tokens are allowed for shifts in this state. - For them, record the shift as the thing to do. So shift is preferred to reduce. */ + /* Now see which tokens are allowed for shifts in this state. For + them, record the shift as the thing to do. So shift is preferred + to reduce. */ if (shiftp) { @@ -795,16 +801,17 @@ action_row (int state) actrow[symbol] = shift_state; - /* do not use any default reduction if there is a shift for error */ - - if (symbol == error_token_number) nodefault = 1; + /* Do not use any default reduction if there is a shift for + error */ + if (symbol == error_token_number) + nodefault = 1; } } errp = err_table[state]; - /* See which tokens are an explicit error in this state - (due to %nonassoc). For them, record MINSHORT as the action. */ + /* See which tokens are an explicit error in this state (due to + %nonassoc). For them, record MINSHORT as the action. */ 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) { @@ -870,7 +878,7 @@ action_row (int state) actrow[j] = 0; } - return (default_rule); + return default_rule; } @@ -970,7 +978,7 @@ default_goto (int symbol) n = goto_map[symbol + 1]; if (m == n) - return (-1); + return -1; for (i = 0; i < nstates; i++) 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]; if (i >= nstates) - return (-1); + return -1; t = tally[i]; w = width[i]; @@ -1149,7 +1157,7 @@ matching_state (int vector) { j = order[prev]; if (width[j] != w || tally[j] != t) - return (-1); + return -1; match = 1; for (k = 0; match && k < t; k++) @@ -1159,10 +1167,10 @@ matching_state (int vector) } if (match) - return (j); + return j; } - return (-1); + return -1; } @@ -1223,7 +1231,7 @@ pack_vector (int vector) if (loc > high) high = loc; - return (j); + return j; } } @@ -1455,10 +1463,11 @@ free_itemsets (void) FREE(state_table); - for (cp = first_state; cp; cp = cptmp) { - cptmp=cp->next; - FREE(cp); - } + for (cp = first_state; cp; cp = cptmp) + { + cptmp=cp->next; + FREE(cp); + } } @@ -1469,10 +1478,11 @@ free_shifts (void) FREE(shift_table); - for (sp = first_shift; sp; sp = sptmp) { - sptmp=sp->next; - FREE(sp); - } + for (sp = first_shift; sp; sp = sptmp) + { + sptmp=sp->next; + FREE(sp); + } } @@ -1483,8 +1493,9 @@ free_reductions (void) FREE(reduction_table); - for (rp = first_reduction; rp; rp = rptmp) { - rptmp=rp->next; - FREE(rp); - } + for (rp = first_reduction; rp; rp = rptmp) + { + rptmp=rp->next; + FREE(rp); + } } diff --git a/src/reader.c b/src/reader.c index 3b11ce7..552bdd4 100644 --- a/src/reader.c +++ b/src/reader.c @@ -1027,7 +1027,7 @@ get_type_name (int n, symbol_list *rule) i++; } - return (rp->sym->type_name); + return rp->sym->type_name; } @@ -1332,7 +1332,7 @@ gensym (void) sym = getsym(token_buffer); sym->class = SNTERM; sym->value = nvars++; - return (sym); + return sym; } /* Parse the input grammar into a one symbol_list structure. @@ -1685,7 +1685,7 @@ get_type (void) switch (t) { case SEMICOLON: - return (lex()); + return lex(); case COMMA: break; @@ -1699,7 +1699,7 @@ get_type (void) break; default: - return (t); + return t; } } } diff --git a/src/symtab.c b/src/symtab.c index 281239c..5f0d6f5 100644 --- a/src/symtab.c +++ b/src/symtab.c @@ -45,7 +45,7 @@ hash (char *key) while (*cp) k = ((k << 1) ^ (*cp++)) & 0x3fff; - return (k % TABSIZE); + return k % TABSIZE; } @@ -63,7 +63,7 @@ copys (char *s) result = xmalloc((unsigned int)i); strcpy(result, s); - return (result); + return result; } @@ -122,7 +122,7 @@ getsym (char *key) symtab[hashval] = bp; } - return (bp); + return bp; } diff --git a/src/vmsgetargs.c b/src/vmsgetargs.c index 7431c4c..5290d11 100644 --- a/src/vmsgetargs.c +++ b/src/vmsgetargs.c @@ -124,7 +124,7 @@ getargs(argc,argv) */ if (cli_present("BISON$FILE_PREFIX")) { - cli_get_value("BISON$FILE_PREFIX", file_prefix_spec, + cli_get_value("BISON$FILE_PREFIX", file_prefix_spec, sizeof(file_prefix_spec)); for (cp = spec_file_prefix = file_prefix_spec; *cp; cp++) if (isupper(*cp)) @@ -135,7 +135,7 @@ getargs(argc,argv) */ if (cli_present("BISON$NAME_PREFIX")) { - cli_get_value("BISON$NAME_PREFIX", name_prefix_spec, + cli_get_value("BISON$NAME_PREFIX", name_prefix_spec, sizeof(name_prefix_spec)); for (cp = spec_name_prefix = name_prefix_spec; *cp; cp++) if (isupper(*cp)) @@ -156,7 +156,7 @@ cli_present(Name) Descr.Ptr = 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; if (cli$get_value(&Descr1,&Descr2,&Descr2.Size) & 1) { Buffer[Descr2.Size] = 0; - return(1); + return 1; } - return(0); + return 0; } -- 2.7.4