mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-03-09 04:13:03 +00:00
c++: move stack<T> inside yy::parser
We used to define such auxiliary structures outside the class, mainly as a matter of style to keep the definition of yy::parser short and simple. However, now there's a lot more code generated inside the class definition (e.g., all the token constructors), so the readability no longer applies. However, if we move stack (and slice) inside yy::parser, then it should no longer be needed to change the namespace to have multiple parsers: changing the class name should suffice. One common argument against inner classes is that they code bloat. It hardly applies here, since typically different parsers will have different semantic value types, hence different actual stack types. * data/skeletons/lalr1.cc: Invoke b4_stack_define inside yy::parser.
This commit is contained in:
@@ -172,7 +172,6 @@ m4_define([b4_shared_declarations],
|
|||||||
|
|
||||||
]b4_namespace_open[
|
]b4_namespace_open[
|
||||||
|
|
||||||
]b4_stack_define[
|
|
||||||
]b4_bison_locations_if([m4_ifndef([b4_location_file],
|
]b4_bison_locations_if([m4_ifndef([b4_location_file],
|
||||||
[b4_location_define])])[
|
[b4_location_define])])[
|
||||||
|
|
||||||
@@ -339,6 +338,8 @@ m4_define([b4_shared_declarations],
|
|||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
|
]b4_stack_define[
|
||||||
|
|
||||||
/// Stack type.
|
/// Stack type.
|
||||||
typedef stack<stack_symbol_type> stack_type;
|
typedef stack<stack_symbol_type> stack_type;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user