mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-03-19 17:23:02 +00:00
style: use b4_token_visible_if
And other formatting/comment changes. * data/variant.hh: Here.
This commit is contained in:
@@ -90,12 +90,15 @@ The various FIELDS are:
|
|||||||
- tag: string.
|
- tag: string.
|
||||||
A representation of the symbol. Can be 'foo', 'foo.id', '"foo"' etc.
|
A representation of the symbol. Can be 'foo', 'foo.id', '"foo"' etc.
|
||||||
- user_number: integer
|
- user_number: integer
|
||||||
The assigned (external) number as used by yylex.
|
The external number as used by yylex. Can be ASCII code when a character,
|
||||||
|
some number chosen by bison, or some user number in the case of
|
||||||
|
%token FOO <NUM>. Corresponds to yychar in yacc.c.
|
||||||
- is_token: 0 or 1
|
- is_token: 0 or 1
|
||||||
Whether this is a terminal symbol.
|
Whether this is a terminal symbol.
|
||||||
- number: integer
|
- number: integer
|
||||||
The internalized number (used after yytranslate). This is the same
|
The internal number (computed from the external number by yytranslate).
|
||||||
number that serves as key b4_symbol(NUM, FIELD).
|
Corresponds to yytoken in yacc.c. This is the same number that serves as
|
||||||
|
key in b4_symbol(NUM, FIELD).
|
||||||
- has_type: 0, 1
|
- has_type: 0, 1
|
||||||
Whether has a semantic value.
|
Whether has a semantic value.
|
||||||
- type_tag: string
|
- type_tag: string
|
||||||
|
|||||||
@@ -263,8 +263,8 @@ m4_define([b4_subtract],
|
|||||||
# -------------------
|
# -------------------
|
||||||
# Join with comma, skipping empty arguments.
|
# Join with comma, skipping empty arguments.
|
||||||
# b4_join calls itself recursively until it sees the first non-empty
|
# b4_join calls itself recursively until it sees the first non-empty
|
||||||
# argument, then calls _b4_join which prepends each non-empty argument
|
# argument, then calls _b4_join (i.e., `_$0`) which prepends each
|
||||||
# with a comma.
|
# non-empty argument with a comma.
|
||||||
m4_define([b4_join],
|
m4_define([b4_join],
|
||||||
[m4_if([$#$1],
|
[m4_if([$#$1],
|
||||||
[1], [],
|
[1], [],
|
||||||
|
|||||||
@@ -339,7 +339,7 @@ m4_define([b4_symbol_value_template],
|
|||||||
# ------------------------------------------
|
# ------------------------------------------
|
||||||
# Declare make_SYMBOL for SYMBOL-NUM. Use at class-level.
|
# Declare make_SYMBOL for SYMBOL-NUM. Use at class-level.
|
||||||
m4_define([_b4_symbol_constructor_declare],
|
m4_define([_b4_symbol_constructor_declare],
|
||||||
[b4_symbol_if([$1], [is_token], [b4_symbol_if([$1], [has_id],
|
[b4_token_visible_if([$1],
|
||||||
[#if 201103L <= YY_CPLUSPLUS
|
[#if 201103L <= YY_CPLUSPLUS
|
||||||
static
|
static
|
||||||
symbol_type
|
symbol_type
|
||||||
@@ -355,7 +355,7 @@ b4_join(b4_symbol_if([$1], [has_type],
|
|||||||
[const b4_symbol([$1], [type])& v]),
|
[const b4_symbol([$1], [type])& v]),
|
||||||
b4_locations_if([const location_type& l])));
|
b4_locations_if([const location_type& l])));
|
||||||
#endif
|
#endif
|
||||||
])])])
|
])])
|
||||||
|
|
||||||
|
|
||||||
# b4_symbol_constructor_declare
|
# b4_symbol_constructor_declare
|
||||||
@@ -372,8 +372,8 @@ b4_symbol_foreach([_b4_symbol_constructor_declare])])
|
|||||||
# -----------------------------------------
|
# -----------------------------------------
|
||||||
# Define make_SYMBOL for SYMBOL-NUM.
|
# Define make_SYMBOL for SYMBOL-NUM.
|
||||||
m4_define([_b4_symbol_constructor_define],
|
m4_define([_b4_symbol_constructor_define],
|
||||||
[b4_symbol_if([$1], [is_token], [b4_symbol_if([$1], [has_id],
|
[b4_token_visible_if([$1],
|
||||||
[# if 201103L <= YY_CPLUSPLUS
|
[#if 201103L <= YY_CPLUSPLUS
|
||||||
inline
|
inline
|
||||||
b4_parser_class_name::symbol_type
|
b4_parser_class_name::symbol_type
|
||||||
b4_parser_class_name::make_[]_b4_symbol([$1], [id]) (dnl
|
b4_parser_class_name::make_[]_b4_symbol([$1], [id]) (dnl
|
||||||
@@ -398,14 +398,14 @@ b4_join(b4_symbol_if([$1], [has_type],
|
|||||||
b4_locations_if([l])));
|
b4_locations_if([l])));
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
])])])
|
])])
|
||||||
|
|
||||||
|
|
||||||
# b4_basic_symbol_constructor_declare(SYMBOL-NUM)
|
# b4_basic_symbol_constructor_declare(SYMBOL-NUM)
|
||||||
# -----------------------------------------------
|
# -----------------------------------------------
|
||||||
# Generate a constructor declaration for basic_symbol from given type.
|
# Generate a constructor declaration for basic_symbol from given type.
|
||||||
m4_define([b4_basic_symbol_constructor_declare],
|
m4_define([b4_basic_symbol_constructor_declare],
|
||||||
[[# if 201103L <= YY_CPLUSPLUS
|
[[#if 201103L <= YY_CPLUSPLUS
|
||||||
basic_symbol (]b4_join(
|
basic_symbol (]b4_join(
|
||||||
[typename Base::kind_type t],
|
[typename Base::kind_type t],
|
||||||
b4_symbol_if([$1], [has_type], [b4_symbol([$1], [type])&& v]),
|
b4_symbol_if([$1], [has_type], [b4_symbol([$1], [type])&& v]),
|
||||||
@@ -418,11 +418,12 @@ m4_define([b4_basic_symbol_constructor_declare],
|
|||||||
#endif
|
#endif
|
||||||
]])
|
]])
|
||||||
|
|
||||||
|
|
||||||
# b4_basic_symbol_constructor_define(SYMBOL-NUM)
|
# b4_basic_symbol_constructor_define(SYMBOL-NUM)
|
||||||
# ----------------------------------------------
|
# ----------------------------------------------
|
||||||
# Generate a constructor implementation for basic_symbol from given type.
|
# Generate a constructor implementation for basic_symbol from given type.
|
||||||
m4_define([b4_basic_symbol_constructor_define],
|
m4_define([b4_basic_symbol_constructor_define],
|
||||||
[[# if 201103L <= YY_CPLUSPLUS
|
[[#if 201103L <= YY_CPLUSPLUS
|
||||||
template <typename Base>
|
template <typename Base>
|
||||||
]b4_parser_class_name[::basic_symbol<Base>::basic_symbol (]b4_join(
|
]b4_parser_class_name[::basic_symbol<Base>::basic_symbol (]b4_join(
|
||||||
[typename Base::kind_type t],
|
[typename Base::kind_type t],
|
||||||
|
|||||||
Reference in New Issue
Block a user