diff options
-rw-r--r-- | data/README.md | 9 | ||||
-rw-r--r-- | data/skeletons/c.m4 | 14 | ||||
-rw-r--r-- | data/skeletons/glr.c | 4 | ||||
-rw-r--r-- | data/skeletons/glr2.cc | 10 | ||||
-rw-r--r-- | data/skeletons/lalr1.cc | 10 | ||||
-rw-r--r-- | data/skeletons/yacc.c | 6 |
6 files changed, 31 insertions, 22 deletions
diff --git a/data/README.md b/data/README.md index 0b9c6b56..09886ea8 100644 --- a/data/README.md +++ b/data/README.md @@ -73,6 +73,15 @@ skeletons. If you are to write a new skeleton, please, implement them for your language. Overall, be sure to follow the same patterns as the existing skeletons. +## Vocabulary + +We use "formal arguments", or "formals" for short, to denote the declared +parameters of a function (e.g., `int argc, const char **argv`). Yes, this +is somewhat contradictory with `param` in the `%param` directives. + +We use "effective arguments", or "args" for short, to denote the values +passed in function calls (e.g., `argc, argv`). + ## Symbols ### `b4_symbol(NUM, FIELD)` diff --git a/data/skeletons/c.m4 b/data/skeletons/c.m4 index 2a992f51..2f774a26 100644 --- a/data/skeletons/c.m4 +++ b/data/skeletons/c.m4 @@ -107,21 +107,21 @@ b4_percent_define_default([[api.symbol.prefix]], [[YYSYMBOL_]]) ## Pure/impure interfaces. ## ## ------------------------ ## -# b4_lex_formals -# -------------- +# b4_yylex_formals +# ---------------- # All the yylex formal arguments. # b4_lex_param arrives quoted twice, but we want to keep only one level. -m4_define([b4_lex_formals], +m4_define([b4_yylex_formals], [b4_pure_if([[[b4_api_PREFIX[STYPE *yylvalp]], [[&yylval]]][]dnl b4_locations_if([, [b4_api_PREFIX[LTYPE *yyllocp], [&yylloc]]])])dnl m4_ifdef([b4_lex_param], [, ]b4_lex_param)]) -# b4_lex -# ------ +# b4_yylex +# -------- # Call yylex. -m4_define([b4_lex], -[b4_function_call([yylex], [int], b4_lex_formals)]) +m4_define([b4_yylex], +[b4_function_call([yylex], [int], b4_yylex_formals)]) # b4_user_args diff --git a/data/skeletons/glr.c b/data/skeletons/glr.c index 70ab8b1d..117c996b 100644 --- a/data/skeletons/glr.c +++ b/data/skeletons/glr.c @@ -848,7 +848,7 @@ yygetToken (int *yycharp][]b4_pure_if([, yyGLRStack* yystackp])[]b4_user_formals try { #endif // YY_EXCEPTIONS - *yycharp = ]b4_lex[; + *yycharp = ]b4_yylex[; #if YY_EXCEPTIONS } catch (const ]b4_namespace_ref[::]b4_parser_class[::syntax_error& yyexc) @@ -862,7 +862,7 @@ yygetToken (int *yycharp][]b4_pure_if([, yyGLRStack* yystackp])[]b4_user_formals *yycharp = ]b4_symbol(error, id)[; } #endif // YY_EXCEPTIONS]], [[ - *yycharp = ]b4_lex[;]])[ + *yycharp = ]b4_yylex[;]])[ } if (*yycharp <= ]b4_symbol(eof, [id])[) { diff --git a/data/skeletons/glr2.cc b/data/skeletons/glr2.cc index 51383fe3..edd05d89 100644 --- a/data/skeletons/glr2.cc +++ b/data/skeletons/glr2.cc @@ -173,10 +173,10 @@ m4_define([b4_call_merger], [yy0.b4_symbol($3, slot) = $2 (yy0, yy1);])], [yy0 = $2 (yy0, yy1);])])]) -# b4_lex -# ------ +# b4_yylex +# -------- # Call yylex. -m4_define([b4_lex], +m4_define([b4_yylex], [b4_token_ctor_if( [b4_function_call([yylex], [symbol_type], m4_ifdef([b4_lex_param], b4_lex_param))], @@ -3102,14 +3102,14 @@ private: #endif // YY_EXCEPTIONS {]b4_token_ctor_if([[ typedef ]b4_namespace_ref[::]b4_parser_class[::symbol_type symbol_type; - symbol_type yylookahead = ]b4_lex[; + symbol_type yylookahead = ]b4_yylex[; this->yytoken = yylookahead.kind ();]b4_variant_if([[ ]b4_symbol_variant([this->yytoken], [this->yylval], [move], [yylookahead.value])], [[ this->yylval = yylookahead.value;]])[]b4_locations_if([ this->yylloc = yylookahead.location; yylookahead.kind_ = symbol_kind::S_YYEMPTY;])[]], [[ - yychar = ]b4_lex[;]])[ + yychar = ]b4_yylex[;]])[ } #if YY_EXCEPTIONS } diff --git a/data/skeletons/lalr1.cc b/data/skeletons/lalr1.cc index 56b23f6f..c94cf4e4 100644 --- a/data/skeletons/lalr1.cc +++ b/data/skeletons/lalr1.cc @@ -145,10 +145,10 @@ b4_dollar_popdef[]dnl ])]) -# b4_lex -# ------ +# b4_yylex +# -------- # Call yylex. -m4_define([b4_lex], +m4_define([b4_yylex], [b4_token_ctor_if( [b4_function_call([yylex], [symbol_type], m4_ifdef([b4_lex_param], b4_lex_param))], @@ -912,9 +912,9 @@ b4_dollar_popdef])[]dnl try #endif // YY_EXCEPTIONS {]b4_token_ctor_if([[ - symbol_type yylookahead (]b4_lex[); + symbol_type yylookahead (]b4_yylex[); yyla.move (yylookahead);]], [[ - yyla.kind_ = yytranslate_ (]b4_lex[);]])[ + yyla.kind_ = yytranslate_ (]b4_yylex[);]])[ } #if YY_EXCEPTIONS catch (const syntax_error& yyexc) diff --git a/data/skeletons/yacc.c b/data/skeletons/yacc.c index 3fa8b14f..d50f3aaf 100644 --- a/data/skeletons/yacc.c +++ b/data/skeletons/yacc.c @@ -371,7 +371,7 @@ m4_define([b4_declare_yyerror_and_yylex], ]b4_function_declare([b4_prefix[error]], void, b4_yyerror_formals)[ #endif #if !defined ]b4_prefix[lex && !defined ]b4_api_PREFIX[LEX_IS_DECLARED -]b4_function_declare([b4_prefix[lex]], int, b4_lex_formals)[ +]b4_function_declare([b4_prefix[lex]], int, b4_yylex_formals)[ #endif ]])dnl ]) @@ -1532,7 +1532,7 @@ yypull_parse (yypstate *yyps]b4_user_formals[) int yystatus; do { ]b4_pure_if([[ YYSTYPE yylval; - int ]])[yychar = ]b4_lex[; + int ]])[yychar = ]b4_yylex[; yystatus = yypush_parse (yyps]b4_pure_if([[, yychar, &yylval]b4_locations_if([[, &yylloc]])])m4_ifset([b4_parse_param], [, b4_args(b4_parse_param)])[); } while (yystatus == YYPUSH_MORE); return yystatus; @@ -1836,7 +1836,7 @@ yyread_pushed_token:]])[ yylval = *yypushed_val;]b4_locations_if([[ if (yypushed_loc) yylloc = *yypushed_loc;]])])], [[ - yychar = ]b4_lex[;]])[ + yychar = ]b4_yylex[;]])[ } if (yychar <= ]b4_symbol(eof, [id])[) |