all: fix confusion between token ctor and symbol ctor

The symbol constructors are genuine constructors.  Token constructors
are plain functions that construct tokens.
This commit is contained in:
Akim Demaille
2021-06-06 08:10:19 +02:00
parent 5325292e5d
commit 9b6065303b
3 changed files with 14 additions and 13 deletions

View File

@@ -458,7 +458,7 @@ m4_define([b4_symbol_type_define],
symbol_type () {} symbol_type () {}
/// Constructor for valueless symbols, and symbols from each type. /// Constructor for valueless symbols, and symbols from each type.
]b4_type_foreach([_b4_token_constructor_define])dnl ]b4_type_foreach([_b4_symbol_constructor_define])dnl
])[}; ])[};
]]) ]])
@@ -576,7 +576,7 @@ m4_define([b4_public_types_define],
# b4_token_constructor_define # b4_token_constructor_define
# ---------------------------- # ----------------------------
# Define symbol constructors for all the value types. # Define make_FOO for all the token kinds.
# Use at class-level. Redefined in variant.hh. # Use at class-level. Redefined in variant.hh.
m4_define([b4_token_constructor_define], []) m4_define([b4_token_constructor_define], [])

View File

@@ -209,9 +209,9 @@ m4_define([b4_symbol_translate],
[[_($1)]]) [[_($1)]])
# _b4_token_constructor_define # _b4_token_constructor_define(SYMBOL-NUM)
# ---------------------------- # ----------------------------------------
# Define make_symbol for a value type. # Define Symbol.FOO for SYMBOL-NUM.
m4_define([_b4_token_constructor_define], m4_define([_b4_token_constructor_define],
[b4_token_visible_if([$1], [b4_token_visible_if([$1],
[[ [[
@@ -226,13 +226,14 @@ m4_define([_b4_token_constructor_define],
# b4_token_constructor_define # b4_token_constructor_define
# --------------------------- # ---------------------------
# Define the overloaded versions of make_symbol for all the value types. # Define Symbol.FOO for each token kind FOO.
m4_define([b4_token_constructor_define], m4_define([b4_token_constructor_define],
[[ [[
/* Implementation of token constructors for each symbol type visible to /* Implementation of token constructors for each symbol type visible to
* the user. The code generates static methods that have the same names * the user. The code generates static methods that have the same names
* as the TokenKinds. * as the TokenKinds.
*/]b4_symbol_foreach([_b4_token_constructor_define])]) */]b4_symbol_foreach([_b4_token_constructor_define])dnl
])
## -------------- ## ## -------------- ##
## Symbol kinds. ## ## Symbol kinds. ##

View File

@@ -458,11 +458,11 @@ m4_define([b4_tok_in],
# _b4_token_constructor_define(SYMBOL-NUM...) # _b4_symbol_constructor_define(SYMBOL-NUM...)
# ------------------------------------------- # --------------------------------------------
# Define a unique make_symbol for all the SYMBOL-NUM (they # Define a symbol_type constructor common to all the SYMBOL-NUM (they
# have the same type). Use at class-level. # have the same type). Use at class-level.
m4_define([_b4_token_constructor_define], m4_define([_b4_symbol_constructor_define],
[m4_ifval(_b4_includes_tokens($@), [m4_ifval(_b4_includes_tokens($@),
[[#if 201103L <= YY_CPLUSPLUS [[#if 201103L <= YY_CPLUSPLUS
symbol_type (]b4_join( symbol_type (]b4_join(
@@ -517,7 +517,7 @@ m4_define([b4_basic_symbol_constructor_define],
# b4_token_constructor_define # b4_token_constructor_define
# --------------------------- # ---------------------------
# Define the overloaded versions of make_symbol for all the value types. # Define the overloaded versions of make_FOO for all the token kinds.
m4_define([b4_token_constructor_define], m4_define([b4_token_constructor_define],
[ // Implementation of make_symbol for each symbol type. [ // Implementation of make_symbol for each token kind.
b4_symbol_foreach([_b4_token_maker_define])]) b4_symbol_foreach([_b4_token_maker_define])])