* data/c.m4 (b4_token_enum): Always define the enum of tokens,

even if empty.
* data/lalrl1.cc, data/glr.cc (parser::token_type): New.
* doc/bison.texinfo (Calc++ Scanner): Use it.
This commit is contained in:
Akim Demaille
2006-03-10 13:30:19 +00:00
parent 6e0f828781
commit c095d689c3
5 changed files with 24 additions and 9 deletions

View File

@@ -34,16 +34,15 @@ m4_define_default([b4_filename_type], [std::string])
# b4_token_enums(LIST-OF-PAIRS-TOKEN-NAME-TOKEN-NUMBER)
# -----------------------------------------------------
# Output the definition of the tokens (if there are) as enums.
# Output the definition of the tokens as enums.
m4_define([b4_token_enums],
[m4_if([$@], [[]], [],
[/* Tokens. */
enum yytokentype {
m4_map_sep([ b4_token_enum], [,
],
[$@])
};
])])
])
## ----------------- ##

View File

@@ -312,6 +312,8 @@ b4_syncline([@oline@], [@ofile@])
{
]b4_token_enums(b4_tokens)[
};
/// Token type.
typedef token::yytokentype token_type;
/// Build a parser object.
]b4_parser_class_name[ (]b4_parse_param_decl[);

View File

@@ -120,6 +120,8 @@ b4_syncline([@oline@], [@ofile@])
{
]b4_token_enums(b4_tokens)[
};
/// Token type.
typedef token::yytokentype token_type;
/// Build a parser object.
]b4_parser_class_name[ (]b4_parse_param_decl[);