mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-03-22 18:53:04 +00:00
b4_public_types_declare.
* data/c++.m4 (b4_public_types_declare): New. * data/glr.cc, data/lalr1.cc: Use it.
This commit is contained in:
@@ -1,3 +1,9 @@
|
|||||||
|
2009-03-02 Akim Demaille <demaille@gostai.com>
|
||||||
|
|
||||||
|
b4_public_types_declare.
|
||||||
|
* data/c++.m4 (b4_public_types_declare): New.
|
||||||
|
* data/glr.cc, data/lalr1.cc: Use it.
|
||||||
|
|
||||||
2009-03-02 Akim Demaille <demaille@gostai.com>
|
2009-03-02 Akim Demaille <demaille@gostai.com>
|
||||||
|
|
||||||
b4_semantic_type_declare.
|
b4_semantic_type_declare.
|
||||||
|
|||||||
21
data/c++.m4
21
data/c++.m4
@@ -111,6 +111,27 @@ m4_ifdef([b4_stype],
|
|||||||
[[ typedef YYSTYPE semantic_type;]])])])
|
[[ typedef YYSTYPE semantic_type;]])])])
|
||||||
|
|
||||||
|
|
||||||
|
# b4_public_types_declare
|
||||||
|
# -----------------------
|
||||||
|
# Define the public types: token, semantic value, location, and so forth.
|
||||||
|
m4_define([b4_public_types_declare],
|
||||||
|
[[#ifndef YYSTYPE
|
||||||
|
]b4_semantic_type_declare[
|
||||||
|
#else
|
||||||
|
typedef YYSTYPE semantic_type;
|
||||||
|
#endif]b4_locations_if([
|
||||||
|
/// Symbol locations.
|
||||||
|
typedef b4_percent_define_get([[location_type]]) location_type;])[
|
||||||
|
/// Tokens.
|
||||||
|
struct token
|
||||||
|
{
|
||||||
|
]b4_token_enums(b4_tokens)[
|
||||||
|
};
|
||||||
|
/// Token type.
|
||||||
|
typedef token::yytokentype token_type;
|
||||||
|
]])
|
||||||
|
|
||||||
|
|
||||||
# b4_variant_if([IF-VARIANT-ARE-USED], [IF-NOT])
|
# b4_variant_if([IF-VARIANT-ARE-USED], [IF-NOT])
|
||||||
# ----------------------------------------------
|
# ----------------------------------------------
|
||||||
m4_define([b4_variant_if],
|
m4_define([b4_variant_if],
|
||||||
|
|||||||
15
data/glr.cc
15
data/glr.cc
@@ -266,20 +266,7 @@ b4_copyright([Skeleton interface for Bison GLR parsers in C++],
|
|||||||
class ]b4_parser_class_name[
|
class ]b4_parser_class_name[
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
#ifndef YYSTYPE
|
]b4_public_types_declare[
|
||||||
]b4_semantic_type_declare[
|
|
||||||
#else
|
|
||||||
typedef YYSTYPE semantic_type;
|
|
||||||
#endif
|
|
||||||
/// Symbol locations.
|
|
||||||
typedef ]b4_percent_define_get([[location_type]])[ location_type;
|
|
||||||
/// Tokens.
|
|
||||||
struct token
|
|
||||||
{
|
|
||||||
]b4_token_enums(b4_tokens)[
|
|
||||||
};
|
|
||||||
/// Token type.
|
|
||||||
typedef token::yytokentype token_type;
|
|
||||||
|
|
||||||
/// Build a parser object.
|
/// Build a parser object.
|
||||||
]b4_parser_class_name[ (]b4_parse_param_decl[);
|
]b4_parser_class_name[ (]b4_parse_param_decl[);
|
||||||
|
|||||||
@@ -388,21 +388,7 @@ do { \
|
|||||||
class ]b4_parser_class_name[
|
class ]b4_parser_class_name[
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
#ifndef YYSTYPE
|
]b4_public_types_declare[
|
||||||
]b4_semantic_type_declare[
|
|
||||||
#else
|
|
||||||
typedef YYSTYPE semantic_type;
|
|
||||||
#endif]b4_locations_if([
|
|
||||||
/// Symbol locations.
|
|
||||||
typedef b4_percent_define_get([[location_type]]) location_type;])[
|
|
||||||
/// Tokens.
|
|
||||||
struct token
|
|
||||||
{
|
|
||||||
]b4_token_enums(b4_tokens)[
|
|
||||||
};
|
|
||||||
/// Token type.
|
|
||||||
typedef token::yytokentype token_type;
|
|
||||||
|
|
||||||
/// Build a parser object.
|
/// Build a parser object.
|
||||||
]b4_parser_class_name[ (]b4_parse_param_decl[);
|
]b4_parser_class_name[ (]b4_parse_param_decl[);
|
||||||
virtual ~]b4_parser_class_name[ ();
|
virtual ~]b4_parser_class_name[ ();
|
||||||
|
|||||||
Reference in New Issue
Block a user