style: rename stmtMerge as stmt_merge

Follow the GNU Coding Style.

* doc/bison.texi, examples/c++/glr/c++-types.yy,
* examples/c/glr/c++-types.y, tests/cxx-type.at: s/stmtMerge/stmt_merge/g.
This commit is contained in:
Akim Demaille
2021-08-29 16:22:16 +02:00
parent a5c55bb758
commit a7ded4284e
4 changed files with 31 additions and 31 deletions

View File

@@ -1283,17 +1283,17 @@ follows:
@example @example
stmt: stmt:
expr ';' %merge <stmtMerge> expr ';' %merge <stmt_merge>
| decl %merge <stmtMerge> | decl %merge <stmt_merge>
; ;
@end example @end example
@noindent @noindent
and define the @code{stmtMerge} function as: and define the @code{stmt_merge} function as:
@example @example
static YYSTYPE static YYSTYPE
stmtMerge (YYSTYPE x0, YYSTYPE x1) stmt_merge (YYSTYPE x0, YYSTYPE x1)
@{ @{
printf ("<OR> "); printf ("<OR> ");
return ""; return "";
@@ -1306,7 +1306,7 @@ in the C declarations at the beginning of the file:
@example @example
%@{ %@{
static YYSTYPE stmtMerge (YYSTYPE x0, YYSTYPE x1); static YYSTYPE stmt_merge (YYSTYPE x0, YYSTYPE x1);
%@} %@}
@end example @end example
@@ -1331,7 +1331,7 @@ previous example, the merged-to symbol (@code{stmt}) does not have a
specific type, and the merger is specific type, and the merger is
@example @example
YYSTYPE stmtMerge (YYSTYPE x0, YYSTYPE x1); YYSTYPE stmt_merge (YYSTYPE x0, YYSTYPE x1);
@end example @end example
@noindent @noindent
@@ -1358,12 +1358,12 @@ or
then the prototype of the merger must be: then the prototype of the merger must be:
@example @example
Node *stmtMerge (YYSTYPE x0, YYSTYPE x1); Node *stmt_merge (YYSTYPE x0, YYSTYPE x1);
@end example @end example
@noindent @noindent
(This signature might be a mistake originally, and maybe it should have been (This signature might be a mistake originally, and maybe it should have been
@samp{Node *stmtMerge (Node *x0, Node *x1)}. If you have an opinion about @samp{Node *stmt_merge (Node *x0, Node *x1)}. If you have an opinion about
it, please let us know.) it, please let us know.)
@node GLR Semantic Actions @node GLR Semantic Actions
@@ -16594,7 +16594,7 @@ London, Department of Computer Science, TR-00-12 (December 2000).
@c LocalWords: rpcalc Lexer Expr ltcalc mfcalc yylex defaultprec Donnelly Gotos @c LocalWords: rpcalc Lexer Expr ltcalc mfcalc yylex defaultprec Donnelly Gotos
@c LocalWords: yyerror pxref LR yylval cindex dfn LALR samp gpl BNF xref yypush @c LocalWords: yyerror pxref LR yylval cindex dfn LALR samp gpl BNF xref yypush
@c LocalWords: const int paren ifnotinfo AC noindent emph expr stmt findex lr @c LocalWords: const int paren ifnotinfo AC noindent emph expr stmt findex lr
@c LocalWords: glr YYSTYPE TYPENAME prog dprec printf decl init stmtMerge POSIX @c LocalWords: glr YYSTYPE TYPENAME prog dprec printf decl init POSIX ODR
@c LocalWords: pre STDC GNUC endif yy YY alloca lf stddef stdlib YYDEBUG yypull @c LocalWords: pre STDC GNUC endif yy YY alloca lf stddef stdlib YYDEBUG yypull
@c LocalWords: NUM exp subsubsection kbd Ctrl ctype EOF getchar isdigit nonfree @c LocalWords: NUM exp subsubsection kbd Ctrl ctype EOF getchar isdigit nonfree
@c LocalWords: ungetc stdin scanf sc calc ulator ls lm cc NEG prec yyerrok rr @c LocalWords: ungetc stdin scanf sc calc ulator ls lm cc NEG prec yyerrok rr

View File

@@ -45,7 +45,7 @@
#include <cstring> #include <cstring>
static Node static Node
stmtMerge (const Node& x0, const Node& x1); stmt_merge (const Node& x0, const Node& x1);
static yy::parser::symbol_type static yy::parser::symbol_type
yylex (); yylex ();
@@ -74,9 +74,9 @@ prog : %empty
| prog stmt { std::cout << @2 << ": " << $2 << '\n'; } | prog stmt { std::cout << @2 << ": " << $2 << '\n'; }
; ;
stmt : expr ";" %merge <stmtMerge> { $$ = $1; } stmt : expr ";" %merge <stmt_merge> { $$ = $1; }
| decl %merge <stmtMerge> | decl %merge <stmt_merge>
| error ";" { $$ = Nterm ("<error>"); } | error ";" { $$ = Nterm ("<error>"); }
; ;
expr : ID expr : ID
@@ -169,7 +169,7 @@ yylex ()
} }
static Node static Node
stmtMerge (const Node& x0, const Node& x1) stmt_merge (const Node& x0, const Node& x1)
{ {
return Nterm ("<OR>", x0, x1); return Nterm ("<OR>", x0, x1);
} }

View File

@@ -66,7 +66,7 @@
static void free_node (Node *); static void free_node (Node *);
static char *node_to_string (const Node *); static char *node_to_string (const Node *);
static void node_print (FILE *, const Node *); static void node_print (FILE *, const Node *);
static Node *stmtMerge (YYSTYPE x0, YYSTYPE x1); static Node *stmt_merge (YYSTYPE x0, YYSTYPE x1);
static void yyerror (YYLTYPE const * const loc, const char *msg); static void yyerror (YYLTYPE const * const loc, const char *msg);
static yytoken_kind_t yylex (YYSTYPE *lval, YYLTYPE *lloc); static yytoken_kind_t yylex (YYSTYPE *lval, YYLTYPE *lloc);
@@ -83,9 +83,9 @@
%glr-parser %glr-parser
%type <Node*> stmt expr decl declarator TYPENAME ID %type <Node *> stmt expr decl declarator TYPENAME ID
%destructor { free_node ($$); } <Node*> %destructor { free_node ($$); } <Node *>
%printer { node_print (yyo, $$); } <Node*> %printer { node_print (yyo, $$); } <Node *>
%% %%
@@ -100,8 +100,8 @@ prog : %empty
} }
; ;
stmt : expr ';' %merge <stmtMerge> { $$ = $1; } stmt : expr ';' %merge <stmt_merge> { $$ = $1; }
| decl %merge <stmtMerge> | decl %merge <stmt_merge>
| error ';' { $$ = new_nterm ("<error>", NULL, NULL, NULL); } | error ';' { $$ = new_nterm ("<error>", NULL, NULL, NULL); }
; ;
@@ -290,8 +290,8 @@ node_print (FILE *out, const Node *n)
} }
static Node* static Node *
stmtMerge (YYSTYPE x0, YYSTYPE x1) stmt_merge (YYSTYPE x0, YYSTYPE x1)
{ {
return new_nterm ("<OR>(%s, %s)", x0.stmt, x1.stmt, NULL); return new_nterm ("<OR>(%s, %s)", x0.stmt, x1.stmt, NULL);
} }

View File

@@ -61,8 +61,8 @@ $1
static Node *new_term (char *); static Node *new_term (char *);
static void free_node (Node *); static void free_node (Node *);
static char *node_to_string (Node *); static char *node_to_string (Node *);
]m4_bmatch([$2], [stmtMerge], ]m4_bmatch([$2], [stmt_merge],
[ static YYSTYPE stmtMerge (YYSTYPE x0, YYSTYPE x1);])[ [ static YYSTYPE stmt_merge (YYSTYPE x0, YYSTYPE x1);])[
#define YYINITDEPTH 10 #define YYINITDEPTH 10
#define YYSTACKEXPANDABLE 1 #define YYSTACKEXPANDABLE 1
]AT_YYERROR_DECLARE[ ]AT_YYERROR_DECLARE[
@@ -291,9 +291,9 @@ node_to_string (Node *node)
} }
]] ]]
m4_bmatch([$2], [stmtMerge], m4_bmatch([$2], [stmt_merge],
[[static YYSTYPE [[static YYSTYPE
stmtMerge (YYSTYPE x0, YYSTYPE x1) stmt_merge (YYSTYPE x0, YYSTYPE x1)
{ {
return new_nterm ("<OR>(%s,%s)", x0, x1, YY_NULLPTR); return new_nterm ("<OR>(%s,%s)", x0, x1, YY_NULLPTR);
} }
@@ -431,30 +431,30 @@ AT_CLEANUP
AT_SETUP([GLR: Merge conflicting parses, impure, no locations]) AT_SETUP([GLR: Merge conflicting parses, impure, no locations])
_AT_TEST_GLR_CXXTYPES([], _AT_TEST_GLR_CXXTYPES([],
[%merge <stmtMerge>], [%merge <stmtMerge>]) [%merge <stmt_merge>], [%merge <stmt_merge>])
AT_TEST([_AT_AMBIG_GLR_OUTPUT], [_AT_GLR_STDERR]) AT_TEST([_AT_AMBIG_GLR_OUTPUT], [_AT_GLR_STDERR])
AT_CLEANUP AT_CLEANUP
AT_SETUP([GLR: Merge conflicting parses, impure, locations]) AT_SETUP([GLR: Merge conflicting parses, impure, locations])
_AT_TEST_GLR_CXXTYPES([%locations], _AT_TEST_GLR_CXXTYPES([%locations],
[%merge <stmtMerge>], [%merge <stmtMerge>]) [%merge <stmt_merge>], [%merge <stmt_merge>])
AT_TEST([_AT_AMBIG_GLR_OUTPUT_WITH_LOC], [_AT_GLR_STDERR_WITH_LOC]) AT_TEST([_AT_AMBIG_GLR_OUTPUT_WITH_LOC], [_AT_GLR_STDERR_WITH_LOC])
AT_CLEANUP AT_CLEANUP
AT_SETUP([GLR: Merge conflicting parses, pure, no locations]) AT_SETUP([GLR: Merge conflicting parses, pure, no locations])
_AT_TEST_GLR_CXXTYPES([%define api.pure], _AT_TEST_GLR_CXXTYPES([%define api.pure],
[%merge <stmtMerge>], [%merge <stmtMerge>]) [%merge <stmt_merge>], [%merge <stmt_merge>])
AT_TEST([_AT_AMBIG_GLR_OUTPUT], [_AT_GLR_STDERR]) AT_TEST([_AT_AMBIG_GLR_OUTPUT], [_AT_GLR_STDERR])
AT_CLEANUP AT_CLEANUP
AT_SETUP([GLR: Merge conflicting parses, pure, locations]) AT_SETUP([GLR: Merge conflicting parses, pure, locations])
_AT_TEST_GLR_CXXTYPES([%define api.pure %locations], _AT_TEST_GLR_CXXTYPES([%define api.pure %locations],
[%merge <stmtMerge>],[%merge <stmtMerge>]) [%merge <stmt_merge>],[%merge <stmt_merge>])
AT_TEST([_AT_AMBIG_GLR_OUTPUT_WITH_LOC], [_AT_GLR_STDERR_WITH_LOC]) AT_TEST([_AT_AMBIG_GLR_OUTPUT_WITH_LOC], [_AT_GLR_STDERR_WITH_LOC])
AT_CLEANUP AT_CLEANUP
AT_SETUP([GLR: Verbose messages, resolve ambiguity, impure, no locations]) AT_SETUP([GLR: Verbose messages, resolve ambiguity, impure, no locations])
_AT_TEST_GLR_CXXTYPES([%define parse.error verbose], _AT_TEST_GLR_CXXTYPES([%define parse.error verbose],
[%merge <stmtMerge>], [%merge <stmtMerge>]) [%merge <stmt_merge>], [%merge <stmt_merge>])
AT_TEST([_AT_AMBIG_GLR_OUTPUT], [_AT_VERBOSE_GLR_STDERR]) AT_TEST([_AT_AMBIG_GLR_OUTPUT], [_AT_VERBOSE_GLR_STDERR])
AT_CLEANUP AT_CLEANUP