style: enforce GNU-style variable names

* examples/c/glr/c++-types.y, tests/cxx-type.at (lineNum, colNum):
Rename as...
(line_num, col_num): these.
This commit is contained in:
Akim Demaille
2022-07-31 12:58:16 +02:00
parent cf686be382
commit db8c1bbbfd
2 changed files with 22 additions and 22 deletions

View File

@@ -144,8 +144,8 @@ FILE * input = NULL;
yytoken_kind_t yytoken_kind_t
yylex (YYSTYPE *lval, YYLTYPE *lloc) yylex (YYSTYPE *lval, YYLTYPE *lloc)
{ {
static int lineNum = 1; static int line_num = 1;
static int colNum = 0; static int col_num = 0;
while (1) while (1)
{ {
@@ -157,20 +157,20 @@ yylex (YYSTYPE *lval, YYLTYPE *lloc)
case EOF: case EOF:
return 0; return 0;
case '\t': case '\t':
colNum = (colNum + 7) & ~7; col_num = (col_num + 7) & ~7;
break; break;
case ' ': case '\f': case ' ': case '\f':
colNum += 1; col_num += 1;
break; break;
case '\n': case '\n':
lineNum += 1; line_num += 1;
colNum = 0; col_num = 0;
break; break;
default: default:
{ {
yytoken_kind_t tok; yytoken_kind_t tok;
lloc->first_line = lloc->last_line = lineNum; lloc->first_line = lloc->last_line = line_num;
lloc->first_column = colNum; lloc->first_column = col_num;
if (isalpha (c)) if (isalpha (c))
{ {
char buffer[256]; char buffer[256];
@@ -179,7 +179,7 @@ yylex (YYSTYPE *lval, YYLTYPE *lloc)
do do
{ {
buffer[i++] = (char) c; buffer[i++] = (char) c;
colNum += 1; col_num += 1;
assert (i != sizeof buffer - 1); assert (i != sizeof buffer - 1);
c = getc (input); c = getc (input);
} }
@@ -200,10 +200,10 @@ yylex (YYSTYPE *lval, YYLTYPE *lloc)
} }
else else
{ {
colNum += 1; col_num += 1;
tok = c; tok = c;
} }
lloc->last_column = colNum; lloc->last_column = col_num;
return tok; return tok;
} }
} }

View File

@@ -149,8 +149,8 @@ main (int argc, char **argv)
]AT_YYLEX_PROTOTYPE[ ]AT_YYLEX_PROTOTYPE[
{]AT_LOCATION_IF([[ {]AT_LOCATION_IF([[
static int lineNum = 1; static int line_num = 1;
static int colNum = 0; static int col_num = 0;
]])[ ]])[
#if YYPURE]AT_LOCATION_IF([[ #if YYPURE]AT_LOCATION_IF([[
# undef yylloc # undef yylloc
@@ -169,20 +169,20 @@ main (int argc, char **argv)
case EOF: case EOF:
return 0; return 0;
case '\t':]AT_LOCATION_IF([[ case '\t':]AT_LOCATION_IF([[
colNum = (colNum + 7) & ~7;]])[ col_num = (col_num + 7) & ~7;]])[
break; break;
case ' ': case '\f':]AT_LOCATION_IF([[ case ' ': case '\f':]AT_LOCATION_IF([[
colNum += 1;]])[ col_num += 1;]])[
break; break;
case '\n':]AT_LOCATION_IF([[ case '\n':]AT_LOCATION_IF([[
lineNum += 1; line_num += 1;
colNum = 0;]])[ col_num = 0;]])[
break; break;
default: default:
{ {
int tok;]AT_LOCATION_IF([[ int tok;]AT_LOCATION_IF([[
yylloc.first_line = yylloc.last_line = lineNum; yylloc.first_line = yylloc.last_line = line_num;
yylloc.first_column = colNum;]])[ yylloc.first_column = col_num;]])[
if (isalpha (c)) if (isalpha (c))
{ {
char buffer[256]; char buffer[256];
@@ -191,7 +191,7 @@ main (int argc, char **argv)
do do
{ {
buffer[i++] = YY_CAST (char, c);]AT_LOCATION_IF([[ buffer[i++] = YY_CAST (char, c);]AT_LOCATION_IF([[
colNum += 1;]])[ col_num += 1;]])[
assert (i != sizeof buffer - 1); assert (i != sizeof buffer - 1);
c = getchar (); c = getchar ();
} }
@@ -204,11 +204,11 @@ main (int argc, char **argv)
} }
else else
{]AT_LOCATION_IF([[ {]AT_LOCATION_IF([[
colNum += 1;]])[ col_num += 1;]])[
tok = c; tok = c;
yylval = YY_NULLPTR; yylval = YY_NULLPTR;
}]AT_LOCATION_IF([[ }]AT_LOCATION_IF([[
yylloc.last_column = colNum;]])[ yylloc.last_column = col_num;]])[
return tok; return tok;
} }
} }