mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-03-09 20:33:03 +00:00
java: use getExpectedTokens, not yyexpectedTokens
* data/skeletons/lalr1.java, examples/java/calc/Calc.y, tests/local.at: here.
This commit is contained in:
@@ -70,7 +70,9 @@ we are free to change them without fear of backward compatibility issues.
|
||||
Use `*_t` for types, especially for `yy*_t` in which case we shouldn't worry
|
||||
about the C standard introducing such a name.
|
||||
|
||||
In C++, use `*_type` for type aliases.
|
||||
#### C++
|
||||
Use `*_type` for type aliases. Use `foo_get()` and `foo_set(v)` for
|
||||
accessors, or simply `foo()` and `foo(v)`.
|
||||
|
||||
#### Java
|
||||
We follow https://www.oracle.com/technetwork/java/codeconventions-150003.pdf
|
||||
@@ -81,6 +83,9 @@ are standardizing the code, it is currently inconsistent.
|
||||
|
||||
Use a 2-space indentation (Google) rather than 4 (Oracle).
|
||||
|
||||
Don't use the "yy" prefix for public members: "getExpectedTokens", not
|
||||
"yyexpectedTokens" or "yygetExpectedTokens".
|
||||
|
||||
## Commit Messages
|
||||
Imitate the style we use. Use `git log` to get sources of inspiration.
|
||||
|
||||
|
||||
@@ -896,12 +896,12 @@ b4_dollar_popdef[]dnl
|
||||
current YYCTX, and return the number of tokens stored in YYARG. If
|
||||
YYARG is null, return the number of expected tokens (guaranteed to
|
||||
be less than YYNTOKENS). */
|
||||
int yyexpectedTokens (SymbolKind yyarg[], int yyargn)
|
||||
int getExpectedTokens (SymbolKind yyarg[], int yyargn)
|
||||
{
|
||||
return yyexpectedTokens (yyarg, 0, yyargn);
|
||||
return getExpectedTokens (yyarg, 0, yyargn);
|
||||
}
|
||||
|
||||
int yyexpectedTokens (SymbolKind yyarg[], int yyoffset, int yyargn)
|
||||
int getExpectedTokens (SymbolKind yyarg[], int yyoffset, int yyargn)
|
||||
{
|
||||
int yycount = yyoffset;
|
||||
int yyn = yypact_[this.yystack.stateAt (0)];
|
||||
@@ -972,7 +972,7 @@ b4_dollar_popdef[]dnl
|
||||
if (yyctx.getToken () != SymbolKind.YYSYMBOL_YYEMPTY)
|
||||
{
|
||||
yyarg[yycount++] = yyctx.getToken ();
|
||||
yycount += yyctx.yyexpectedTokens (yyarg, 1, yyargn);
|
||||
yycount += yyctx.getExpectedTokens (yyarg, 1, yyargn);
|
||||
}
|
||||
return yycount;
|
||||
}
|
||||
|
||||
@@ -122,7 +122,7 @@ class CalcLexer implements Calc.Lexer {
|
||||
{
|
||||
final int TOKENMAX = 10;
|
||||
Calc.SymbolKind[] arg = new Calc.SymbolKind[TOKENMAX];
|
||||
int n = ctx.yyexpectedTokens (arg, TOKENMAX);
|
||||
int n = ctx.getExpectedTokens (arg, TOKENMAX);
|
||||
for (int i = 0; i < n; ++i)
|
||||
System.err.print ((i == 0 ? ": expected " : " or ")
|
||||
+ ctx.yysymbolName (arg[i]));
|
||||
|
||||
@@ -987,7 +987,7 @@ m4_define([AT_YYERROR_DEFINE(java)],
|
||||
}
|
||||
{
|
||||
Calc.SymbolKind[] arg = new Calc.SymbolKind[ctx.NTOKENS];
|
||||
int n = ctx.yyexpectedTokens (arg, ctx.NTOKENS);
|
||||
int n = ctx.getExpectedTokens (arg, ctx.NTOKENS);
|
||||
if (0 < n)
|
||||
{
|
||||
System.err.print (" (expected:");
|
||||
|
||||
Reference in New Issue
Block a user