mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-03-15 15:23:02 +00:00
glr2.cc: put semantic_option into an unnamed namespace
If we link several glr2.cc parsers together, we get linking failures because of duplicate symbols. * data/skeletons/glr2.cc (semantic_option::indexIn) (semantic_option::next): Remove the useless overloads.
This commit is contained in:
@@ -753,7 +753,10 @@ typedef int rule_num;
|
|||||||
|
|
||||||
// Forward declarations.
|
// Forward declarations.
|
||||||
class glr_state;
|
class glr_state;
|
||||||
class semantic_option;
|
namespace
|
||||||
|
{
|
||||||
|
class semantic_option;
|
||||||
|
}
|
||||||
class glr_stack_item;
|
class glr_stack_item;
|
||||||
class glr_stack;
|
class glr_stack;
|
||||||
|
|
||||||
@@ -1126,9 +1129,11 @@ private:
|
|||||||
glr_state* yylastDeleted;
|
glr_state* yylastDeleted;
|
||||||
};
|
};
|
||||||
|
|
||||||
class semantic_option
|
namespace
|
||||||
{
|
{
|
||||||
public:
|
class semantic_option
|
||||||
|
{
|
||||||
|
public:
|
||||||
typedef ]b4_namespace_ref[::]b4_parser_class[::symbol_kind symbol_kind;
|
typedef ]b4_namespace_ref[::]b4_parser_class[::symbol_kind symbol_kind;
|
||||||
typedef ]b4_namespace_ref[::]b4_parser_class[::symbol_kind_type symbol_kind_type;
|
typedef ]b4_namespace_ref[::]b4_parser_class[::symbol_kind_type symbol_kind_type;
|
||||||
typedef ]b4_namespace_ref[::]b4_parser_class[::value_type value_type;]b4_locations_if([[
|
typedef ]b4_namespace_ref[::]b4_parser_class[::value_type value_type;]b4_locations_if([[
|
||||||
@@ -1189,11 +1194,11 @@ public:
|
|||||||
const glr_state* state() const;
|
const glr_state* state() const;
|
||||||
void setState(const glr_state* s);
|
void setState(const glr_state* s);
|
||||||
|
|
||||||
const semantic_option* next () const;
|
const semantic_option* next () const YY_ATTRIBUTE_UNUSED;
|
||||||
semantic_option* next ();
|
semantic_option* next ();
|
||||||
void setNext (const semantic_option* s);
|
void setNext (const semantic_option* s);
|
||||||
|
|
||||||
std::ptrdiff_t indexIn (const glr_stack_item* array) const;
|
std::ptrdiff_t indexIn (const glr_stack_item* array) const YY_ATTRIBUTE_UNUSED;
|
||||||
|
|
||||||
/** True iff YYY0 and YYY1 represent identical options at the top level.
|
/** True iff YYY0 and YYY1 represent identical options at the top level.
|
||||||
* That is, they represent the same rule applied to RHS symbols
|
* That is, they represent the same rule applied to RHS symbols
|
||||||
@@ -1343,7 +1348,7 @@ public:
|
|||||||
/** Rule number for this reduction */
|
/** Rule number for this reduction */
|
||||||
rule_num yyrule;
|
rule_num yyrule;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
template <typename T>
|
template <typename T>
|
||||||
static const glr_stack_item* asItem(const T* state)
|
static const glr_stack_item* asItem(const T* state)
|
||||||
{
|
{
|
||||||
@@ -1360,14 +1365,14 @@ private:
|
|||||||
* options are chained in decreasing order by address. */
|
* options are chained in decreasing order by address. */
|
||||||
std::ptrdiff_t yynext;
|
std::ptrdiff_t yynext;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
/** The lookahead for this reduction. */
|
/** The lookahead for this reduction. */
|
||||||
symbol_kind_type yytoken;
|
symbol_kind_type yytoken;
|
||||||
value_type yyval;]b4_locations_if([[
|
value_type yyval;]b4_locations_if([[
|
||||||
location_type yyloc;]])[
|
location_type yyloc;]])[
|
||||||
|
|
||||||
]b4_parse_assert_if([[
|
]b4_parse_assert_if([[
|
||||||
public:
|
public:
|
||||||
// Check invariants.
|
// Check invariants.
|
||||||
void check_ () const
|
void check_ () const
|
||||||
{
|
{
|
||||||
@@ -1379,7 +1384,8 @@ public:
|
|||||||
// A magic number to check our pointer arithmetic is sane.
|
// A magic number to check our pointer arithmetic is sane.
|
||||||
enum { MAGIC = 0xeff1cace };
|
enum { MAGIC = 0xeff1cace };
|
||||||
unsigned int magic_;]])[
|
unsigned int magic_;]])[
|
||||||
};
|
};
|
||||||
|
}
|
||||||
|
|
||||||
/** Type of the items in the GLR stack.
|
/** Type of the items in the GLR stack.
|
||||||
* It can be either a glr_state or a semantic_option. The is_state_ field
|
* It can be either a glr_state or a semantic_option. The is_state_ field
|
||||||
|
|||||||
Reference in New Issue
Block a user