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:
Akim Demaille
2021-09-08 21:58:32 +02:00
parent ca96df89b2
commit 4ec4309cce

View File

@@ -753,7 +753,10 @@ typedef int rule_num;
// Forward declarations.
class glr_state;
namespace
{
class semantic_option;
}
class glr_stack_item;
class glr_stack;
@@ -1126,6 +1129,8 @@ private:
glr_state* yylastDeleted;
};
namespace
{
class semantic_option
{
public:
@@ -1189,11 +1194,11 @@ public:
const glr_state* state() const;
void setState(const glr_state* s);
const semantic_option* next () const;
const semantic_option* next () const YY_ATTRIBUTE_UNUSED;
semantic_option* next ();
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.
* That is, they represent the same rule applied to RHS symbols
@@ -1380,6 +1385,7 @@ public:
enum { MAGIC = 0xeff1cace };
unsigned int magic_;]])[
};
}
/** Type of the items in the GLR stack.
* It can be either a glr_state or a semantic_option. The is_state_ field