[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
style: rename endtoken as eoftoken
From: |
Akim Demaille |
Subject: |
style: rename endtoken as eoftoken |
Date: |
Sat, 27 Jun 2020 17:35:36 +0200 |
commit feb0bb0a598b6ea222e62532e67facae873b5988
Author: Akim Demaille <akim.demaille@gmail.com>
Date: Sat Jun 27 17:30:27 2020 +0200
style: rename endtoken as eoftoken
* src/symtab.h, src/symtab.c (endtoken): Rename as...
(eoftoken): this.
Adjust dependencies.
diff --git a/TODO b/TODO
index 8e444e93..f8799078 100644
--- a/TODO
+++ b/TODO
@@ -73,14 +73,6 @@ enough.
*** calc.at
Stop hard-coding "Calc". Adjust local.at (look for FIXME).
-** Clean up
-Rename endtoken as eoftoken.
-
-Also do it in data/skeletons.
-
-Don't rename in Bison 3.6 (it would be logical to do so) because that
-would probably create many conflicts in Vincent's work (see previous point).
-
** A dev warning for b4_
Maybe we should check for m4_ and b4_ leaking out of the m4 processing, as
Autoconf does. It would have caught overquotation issues.
diff --git a/src/output.c b/src/output.c
index ba2d2157..db996283 100644
--- a/src/output.c
+++ b/src/output.c
@@ -198,9 +198,9 @@ static const char *
symbol_tag (const symbol *sym)
{
const bool eof_is_user_defined
- = !endtoken->alias || STRNEQ (endtoken->alias->tag, "$end");
+ = !eoftoken->alias || STRNEQ (eoftoken->alias->tag, "$end");
- if (!eof_is_user_defined && sym->content == endtoken->content)
+ if (!eof_is_user_defined && sym->content == eoftoken->content)
return "\"end of file\"";
else if (sym->content == undeftoken->content)
return "\"invalid token\"";
diff --git a/src/reader.c b/src/reader.c
index ecc4b19b..9289e087 100644
--- a/src/reader.c
+++ b/src/reader.c
@@ -776,18 +776,18 @@ check_and_convert_grammar (void)
if (nrules == 0)
complain (NULL, fatal, _("no rules in the input grammar"));
- /* If the user did not define her ENDTOKEN, do it now. */
- if (!endtoken)
+ /* If the user did not define her EOFTOKEN, do it now. */
+ if (!eoftoken)
{
- endtoken = symbol_get ("YYEOF", empty_loc);
- endtoken->content->class = token_sym;
- endtoken->content->number = 0;
+ eoftoken = symbol_get ("YYEOF", empty_loc);
+ eoftoken->content->class = token_sym;
+ eoftoken->content->number = 0;
/* Value specified by POSIX. */
- endtoken->content->code = 0;
+ eoftoken->content->code = 0;
{
symbol *alias = symbol_get ("$end", empty_loc);
symbol_class_set (alias, token_sym, empty_loc, false);
- symbol_make_alias (endtoken, alias, empty_loc);
+ symbol_make_alias (eoftoken, alias, empty_loc);
}
}
@@ -809,7 +809,7 @@ check_and_convert_grammar (void)
symbol_list *p = symbol_list_sym_new (accept, empty_loc);
p->rhs_loc = grammar->rhs_loc;
p->next = symbol_list_sym_new (startsymbol, empty_loc);
- p->next->next = symbol_list_sym_new (endtoken, empty_loc);
+ p->next->next = symbol_list_sym_new (eoftoken, empty_loc);
p->next->next->next = symbol_list_sym_new (NULL, empty_loc);
p->next->next->next->next = grammar;
nrules += 1;
diff --git a/src/reduce.c b/src/reduce.c
index 78bab23e..24d2f376 100644
--- a/src/reduce.c
+++ b/src/reduce.c
@@ -188,7 +188,7 @@ inaccessable_symbols (void)
/* These tokens (numbered 0, 1, and 2) are internal to Bison.
Consider them useful. */
- bitset_set (V, endtoken->content->number); /* end-of-input token */
+ bitset_set (V, eoftoken->content->number); /* end-of-input token */
bitset_set (V, errtoken->content->number); /* error token */
bitset_set (V, undeftoken->content->number); /* some undefined token */
diff --git a/src/symtab.c b/src/symtab.c
index 1a226620..d5a00c02 100644
--- a/src/symtab.c
+++ b/src/symtab.c
@@ -58,7 +58,7 @@ static semantic_type **semantic_types_sorted = NULL;
symbol *errtoken = NULL;
symbol *undeftoken = NULL;
-symbol *endtoken = NULL;
+symbol *eoftoken = NULL;
symbol *accept = NULL;
symbol *startsymbol = NULL;
location startsymbol_loc;
@@ -78,9 +78,9 @@ static bool
symbol_is_user_defined (symbol *sym)
{
const bool eof_is_user_defined
- = !endtoken->alias || STRNEQ (endtoken->alias->tag, "$end");
+ = !eoftoken->alias || STRNEQ (eoftoken->alias->tag, "$end");
return sym->tag[0] != '$'
- && (eof_is_user_defined || (sym != endtoken && sym->alias != errtoken))
+ && (eof_is_user_defined || (sym != eoftoken && sym->alias != errtoken))
&& sym != errtoken && sym->alias != errtoken
&& sym != undeftoken && sym->alias != undeftoken;
}
@@ -595,14 +595,14 @@ symbol_code_set (symbol *sym, int code, location loc)
{
*codep = code;
/* User defined $end token? */
- if (code == 0 && !endtoken)
+ if (code == 0 && !eoftoken)
{
- endtoken = sym->content->symbol;
+ eoftoken = sym->content->symbol;
/* It is always mapped to 0, so it was already counted in
NTOKENS. */
- if (endtoken->content->number != NUMBER_UNDEFINED)
+ if (eoftoken->content->number != NUMBER_UNDEFINED)
--ntokens;
- endtoken->content->number = 0;
+ eoftoken->content->number = 0;
}
}
}
@@ -1163,9 +1163,9 @@ symbols_pack (void)
if (has_translations ())
{
const bool eof_is_user_defined
- = !endtoken->alias || STRNEQ (endtoken->alias->tag, "$end");
+ = !eoftoken->alias || STRNEQ (eoftoken->alias->tag, "$end");
if (!eof_is_user_defined)
- endtoken->alias->translatable = true;
+ eoftoken->alias->translatable = true;
undeftoken->alias->translatable = true;
errtoken->alias->translatable = true;
}
diff --git a/src/symtab.h b/src/symtab.h
index 3ba8efc5..af6de8af 100644
--- a/src/symtab.h
+++ b/src/symtab.h
@@ -241,7 +241,7 @@ extern symbol *errtoken;
/** The token for unknown tokens. */
extern symbol *undeftoken;
/** The end of input token. */
-extern symbol *endtoken;
+extern symbol *eoftoken;
/** The genuine start symbol.
$accept: start-symbol $end */
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- style: rename endtoken as eoftoken,
Akim Demaille <=