[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
style: enforce GNU-style variable names
From: |
Akim Demaille |
Subject: |
style: enforce GNU-style variable names |
Date: |
Sun, 31 Jul 2022 13:09:12 +0200 |
commit db8c1bbbfd12e2208cf90e61972f862ffceec25c
Author: Akim Demaille <akim.demaille@gmail.com>
Date: Sun Jul 31 12:58:16 2022 +0200
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.
diff --git a/examples/c/glr/c++-types.y b/examples/c/glr/c++-types.y
index 07a2c700..ca592e27 100644
--- a/examples/c/glr/c++-types.y
+++ b/examples/c/glr/c++-types.y
@@ -144,8 +144,8 @@ FILE * input = NULL;
yytoken_kind_t
yylex (YYSTYPE *lval, YYLTYPE *lloc)
{
- static int lineNum = 1;
- static int colNum = 0;
+ static int line_num = 1;
+ static int col_num = 0;
while (1)
{
@@ -157,20 +157,20 @@ yylex (YYSTYPE *lval, YYLTYPE *lloc)
case EOF:
return 0;
case '\t':
- colNum = (colNum + 7) & ~7;
+ col_num = (col_num + 7) & ~7;
break;
case ' ': case '\f':
- colNum += 1;
+ col_num += 1;
break;
case '\n':
- lineNum += 1;
- colNum = 0;
+ line_num += 1;
+ col_num = 0;
break;
default:
{
yytoken_kind_t tok;
- lloc->first_line = lloc->last_line = lineNum;
- lloc->first_column = colNum;
+ lloc->first_line = lloc->last_line = line_num;
+ lloc->first_column = col_num;
if (isalpha (c))
{
char buffer[256];
@@ -179,7 +179,7 @@ yylex (YYSTYPE *lval, YYLTYPE *lloc)
do
{
buffer[i++] = (char) c;
- colNum += 1;
+ col_num += 1;
assert (i != sizeof buffer - 1);
c = getc (input);
}
@@ -200,10 +200,10 @@ yylex (YYSTYPE *lval, YYLTYPE *lloc)
}
else
{
- colNum += 1;
+ col_num += 1;
tok = c;
}
- lloc->last_column = colNum;
+ lloc->last_column = col_num;
return tok;
}
}
diff --git a/tests/cxx-type.at b/tests/cxx-type.at
index 4ebbf503..96315541 100644
--- a/tests/cxx-type.at
+++ b/tests/cxx-type.at
@@ -149,8 +149,8 @@ m4_define([_AT_TEST_GLR_CXXTYPES],
]AT_YYLEX_PROTOTYPE[
{]AT_LOCATION_IF([[
- static int lineNum = 1;
- static int colNum = 0;
+ static int line_num = 1;
+ static int col_num = 0;
]])[
#if YYPURE]AT_LOCATION_IF([[
# undef yylloc
@@ -169,20 +169,20 @@ m4_define([_AT_TEST_GLR_CXXTYPES],
case EOF:
return 0;
case '\t':]AT_LOCATION_IF([[
- colNum = (colNum + 7) & ~7;]])[
+ col_num = (col_num + 7) & ~7;]])[
break;
case ' ': case '\f':]AT_LOCATION_IF([[
- colNum += 1;]])[
+ col_num += 1;]])[
break;
case '\n':]AT_LOCATION_IF([[
- lineNum += 1;
- colNum = 0;]])[
+ line_num += 1;
+ col_num = 0;]])[
break;
default:
{
int tok;]AT_LOCATION_IF([[
- yylloc.first_line = yylloc.last_line = lineNum;
- yylloc.first_column = colNum;]])[
+ yylloc.first_line = yylloc.last_line = line_num;
+ yylloc.first_column = col_num;]])[
if (isalpha (c))
{
char buffer[256];
@@ -191,7 +191,7 @@ m4_define([_AT_TEST_GLR_CXXTYPES],
do
{
buffer[i++] = YY_CAST (char, c);]AT_LOCATION_IF([[
- colNum += 1;]])[
+ col_num += 1;]])[
assert (i != sizeof buffer - 1);
c = getchar ();
}
@@ -204,11 +204,11 @@ m4_define([_AT_TEST_GLR_CXXTYPES],
}
else
{]AT_LOCATION_IF([[
- colNum += 1;]])[
+ col_num += 1;]])[
tok = c;
yylval = YY_NULLPTR;
}]AT_LOCATION_IF([[
- yylloc.last_column = colNum;]])[
+ yylloc.last_column = col_num;]])[
return tok;
}
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- style: enforce GNU-style variable names,
Akim Demaille <=