[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 08/14] glr2.cc: put glr_state_set and glr_stack_item in unnamed n
From: |
Akim Demaille |
Subject: |
[PATCH 08/14] glr2.cc: put glr_state_set and glr_stack_item in unnamed namespace |
Date: |
Sun, 12 Sep 2021 14:07:41 +0200 |
* data/skeletons/glr2.cc: here.
---
data/skeletons/glr2.cc | 25 +++++++++++++++++--------
1 file changed, 17 insertions(+), 8 deletions(-)
diff --git a/data/skeletons/glr2.cc b/data/skeletons/glr2.cc
index dcb00943..17dde98e 100644
--- a/data/skeletons/glr2.cc
+++ b/data/skeletons/glr2.cc
@@ -776,12 +776,15 @@ typedef int state_num;
/** Rule numbers, as in LALR(1) machine */
typedef int rule_num;
-// Forward declarations.
namespace
{
+ using parser_type = ]b4_namespace_ref[::]b4_parser_class[;
+ using glr_state = parser_type::glr_state;
+
+ // Forward declarations.
+ class glr_stack_item;
class semantic_option;
}
-class glr_stack_item;
/** Accessing symbol of state YYSTATE. */
static inline yysymbol_kind_t
@@ -954,7 +957,7 @@ namespace ]b4_namespace_ref[
}
#endif
- std::ptrdiff_t indexIn (const glr_stack_item* array) const;
+ std::ptrdiff_t indexIn (const glr_stack_item* array) const
YY_ATTRIBUTE_UNUSED;
glr_stack_item* asItem ()
{]b4_parse_assert_if([[
@@ -1015,10 +1018,12 @@ namespace ]b4_namespace_ref[
// A magic number to check our pointer arithmetic is sane.
enum { MAGIC = 713705 };
unsigned int magic_;]])[
- };
+ }; // class ]b4_parser_class[::glr_state
} // namespace ]b4_namespace_ref[
+namespace
+{
/** A stack of GLRState representing the different heads during
* nondeterministic evaluation. */
class glr_state_set
@@ -1154,7 +1159,8 @@ private:
/** The last stack we invalidated. */
glr_state* yylastDeleted;
-};
+ }; // class glr_state_set
+} // namespace
namespace
{
@@ -1411,9 +1417,11 @@ namespace
// A magic number to check our pointer arithmetic is sane.
enum { MAGIC = 0xeff1cace };
unsigned int magic_;]])[
- };
-}
+ }; // class semantic_option
+} // namespace
+namespace
+{
/** Type of the items in the GLR stack.
* It can be either a glr_state or a semantic_option. The is_state_ field
* indicates which item of the union is valid. */
@@ -1539,7 +1547,8 @@ public:
// A magic number to check our pointer arithmetic is sane.
enum { MAGIC = 0xDEAD1ACC }; // 3735886540.
const unsigned int magic_;]])[
-};
+ }; // class glr_stack_item
+} // namespace
glr_state* glr_state::pred ()
{]b4_parse_assert_if([[
--
2.32.0
- [PATCH 00/14] glr2.cc: fix linking conflicts, Akim Demaille, 2021/09/12
- [PATCH 01/14] glr2.cc: don't publish YY_EXCEPTIONS, Akim Demaille, 2021/09/12
- [PATCH 02/14] glr2.cc: put semantic_option into an unnamed namespace, Akim Demaille, 2021/09/12
- [PATCH 03/14] glr2.cc: prefer unnamed namespace to 'static', Akim Demaille, 2021/09/12
- [PATCH 04/14] glr2.cc: put create_state_set_index in unnamed namespace, Akim Demaille, 2021/09/12
- [PATCH 05/14] glr2.cc: move glr_stack and glr_state into the parser class, Akim Demaille, 2021/09/12
- [PATCH 06/14] glr2.cc: style: clarify control flow, Akim Demaille, 2021/09/12
- [PATCH 07/14] glr2.cc: move state_stack into the unnamed namespace, Akim Demaille, 2021/09/12
- [PATCH 08/14] glr2.cc: put glr_state_set and glr_stack_item in unnamed namespace,
Akim Demaille <=
- [PATCH 09/14] glr2.cc: prefer using, and remove useless type aliases, Akim Demaille, 2021/09/12
- [PATCH 10/14] glr2.cc: use only symbol_kind_type, not yysymbol_kind_t, Akim Demaille, 2021/09/12
- [PATCH 11/14] glr2.cc: move strong_index_alias into the unnamed namespace, Akim Demaille, 2021/09/12
- [PATCH 12/14] glr2.cc: check linking conflicts, Akim Demaille, 2021/09/12
- [PATCH 13/14] glr2.cc: kill trailing white spaces, Akim Demaille, 2021/09/12
- [PATCH 14/14] glr2.cc: don't pass %parse-param to destroy, Akim Demaille, 2021/09/12
- Re: [PATCH 00/14] glr2.cc: fix linking conflicts, Tom Shields, 2021/09/12