portability: rename accept to acceptsymbol because of MSVC

MSVC already defines this symbol.

* src/symtab.h, src/symtab.c (accept): Rename as...
(acceptsymbol): this.
Adjust dependencies.
This commit is contained in:
Maarten De Braekeleer
2020-07-30 20:53:35 +02:00
committed by Akim Demaille
parent de4f41eab7
commit ad6f600bb1
5 changed files with 12 additions and 12 deletions

View File

@@ -423,7 +423,7 @@ ielr_item_has_lookahead (state *s, symbol_number lhs, size_t item,
check all predecessors' goto follows for the LHS. */ check all predecessors' goto follows for the LHS. */
if (item_number_is_rule_number (ritem[s->items[item] - 2])) if (item_number_is_rule_number (ritem[s->items[item] - 2]))
{ {
aver (lhs != accept->content->number); aver (lhs != acceptsymbol->content->number);
for (state **predecessor = predecessors[s->number]; for (state **predecessor = predecessors[s->number];
*predecessor; *predecessor;
++predecessor) ++predecessor)

View File

@@ -804,7 +804,7 @@ check_and_convert_grammar (void)
$accept: %start $end. */ $accept: %start $end. */
{ {
symbol_list *p = symbol_list_sym_new (accept, empty_loc); symbol_list *p = symbol_list_sym_new (acceptsymbol, empty_loc);
p->rhs_loc = grammar->rhs_loc; p->rhs_loc = grammar->rhs_loc;
p->next = symbol_list_sym_new (startsymbol, empty_loc); p->next = symbol_list_sym_new (startsymbol, empty_loc);
p->next->next = symbol_list_sym_new (eoftoken, empty_loc); p->next->next = symbol_list_sym_new (eoftoken, empty_loc);

View File

@@ -160,9 +160,9 @@ inaccessable_symbols (void)
bitset Pp = bitset_create (nrules, BITSET_FIXED); bitset Pp = bitset_create (nrules, BITSET_FIXED);
/* If the start symbol isn't useful, then nothing will be useful. */ /* If the start symbol isn't useful, then nothing will be useful. */
if (bitset_test (N, accept->content->number - ntokens)) if (bitset_test (N, acceptsymbol->content->number - ntokens))
{ {
bitset_set (V, accept->content->number); bitset_set (V, acceptsymbol->content->number);
while (1) while (1)
{ {
@@ -301,7 +301,7 @@ nonterminals_reduce (void)
for (item_number *rhsp = rules[r].rhs; 0 <= *rhsp; ++rhsp) for (item_number *rhsp = rules[r].rhs; 0 <= *rhsp; ++rhsp)
if (ISVAR (*rhsp)) if (ISVAR (*rhsp))
*rhsp = symbol_number_as_item_number (nterm_map[*rhsp - ntokens]); *rhsp = symbol_number_as_item_number (nterm_map[*rhsp - ntokens]);
accept->content->number = nterm_map[accept->content->number - ntokens]; acceptsymbol->content->number = nterm_map[acceptsymbol->content->number - ntokens];
} }
nsyms -= nuseless_nonterminals; nsyms -= nuseless_nonterminals;
@@ -381,7 +381,7 @@ reduce_grammar (void)
{ {
reduce_print (); reduce_print ();
if (!bitset_test (N, accept->content->number - ntokens)) if (!bitset_test (N, acceptsymbol->content->number - ntokens))
complain (&startsymbol_loc, fatal, complain (&startsymbol_loc, fatal,
_("start symbol %s does not derive any sentence"), _("start symbol %s does not derive any sentence"),
startsymbol->tag); startsymbol->tag);

View File

@@ -59,7 +59,7 @@ static semantic_type **semantic_types_sorted = NULL;
symbol *errtoken = NULL; symbol *errtoken = NULL;
symbol *undeftoken = NULL; symbol *undeftoken = NULL;
symbol *eoftoken = NULL; symbol *eoftoken = NULL;
symbol *accept = NULL; symbol *acceptsymbol = NULL;
symbol *startsymbol = NULL; symbol *startsymbol = NULL;
location startsymbol_loc; location startsymbol_loc;
@@ -849,10 +849,10 @@ symbols_new (void)
hash_symbol_comparator, hash_symbol_comparator,
symbol_free); symbol_free);
/* Construct the accept symbol. */ /* Construct the acceptsymbol symbol. */
accept = symbol_get ("$accept", empty_loc); acceptsymbol = symbol_get ("$accept", empty_loc);
accept->content->class = nterm_sym; acceptsymbol->content->class = nterm_sym;
accept->content->number = nnterms++; acceptsymbol->content->number = nnterms++;
/* Construct the YYerror/"error" token */ /* Construct the YYerror/"error" token */
errtoken = symbol_get ("YYerror", empty_loc); errtoken = symbol_get ("YYerror", empty_loc);

View File

@@ -245,7 +245,7 @@ extern symbol *eoftoken;
/** The genuine start symbol. /** The genuine start symbol.
$accept: start-symbol $end */ $accept: start-symbol $end */
extern symbol *accept; extern symbol *acceptsymbol;
/** The user start symbol. */ /** The user start symbol. */
extern symbol *startsymbol; extern symbol *startsymbol;