diff options
Diffstat (limited to 'xsde/cxx/hybrid/parser-header.cxx')
-rw-r--r-- | xsde/cxx/hybrid/parser-header.cxx | 49 |
1 files changed, 36 insertions, 13 deletions
diff --git a/xsde/cxx/hybrid/parser-header.cxx b/xsde/cxx/hybrid/parser-header.cxx index 450a27e..72cc2e3 100644 --- a/xsde/cxx/hybrid/parser-header.cxx +++ b/xsde/cxx/hybrid/parser-header.cxx @@ -397,6 +397,7 @@ namespace CXX Boolean restriction (restriction_p (c)); Boolean fixed (fixed_length (c)); + Boolean rec (recursive (c)); String const& ret (pret_type (c)); @@ -460,6 +461,15 @@ namespace CXX } } + // _post + // + if (rec && hb && !recursive (c.inherits ().base ())) + { + os << "virtual void" << endl + << "_post ();" + << endl; + } + // post // os << "virtual " << ret << endl @@ -476,6 +486,13 @@ namespace CXX << pre_impl_name (c) << " (" << type << "*);" << endl; + // Base implementation. + // + if (tiein && hb) + os << (tiein ? "public:" : "protected:") << endl + << fq_name (c.inherits ().base (), "p:impl") << " base_impl_;" + << endl; + // State. // String const& state_type (epstate_type (c)); @@ -493,32 +510,35 @@ namespace CXX if (!restriction && c.contains_compositor_p ()) contains_compositor (c, contains_compositor_state_); - os << "};" - << state_type << " " << epstate (c) << ";"; + os << "};"; - if (!fixed) - os << "bool " << epstate_base (c) << ";"; + if (rec) + { + os << state_type << " " << epstate_first (c) << ";" + << "::xsde::cxx::stack " << epstate (c) << ";"; - os << endl; + if (hb && !recursive (c.inherits ().base ())) + os << "bool " << epstate_top (c) << ";"; + } + else + os << state_type << " " << epstate (c) << ";"; - // Base implementation. - // - if (tiein && hb) - os << (tiein ? "public:" : "protected:") << endl - << fq_name (c.inherits ().base (), "p:impl") << " base_impl_;" - << endl; + if (!fixed) + os << "bool " << epstate_base (c) << ";"; os << "};"; } // Generate include for custom parser. // - if (c.context ().count ("p:impl-include")) + SemanticGraph::Context& ctx (c.context ()); + + if (ctx.count ("p:impl-include")) { close_ns (); os << "#include " << process_include_path ( - c.context ().get<String> ("p:impl-include")) << endl + ctx.get<String> ("p:impl-include")) << endl << endl; open_ns (); @@ -547,6 +567,9 @@ namespace CXX Void generate_parser_header (Context& ctx) { + ctx.os << "#include <xsde/cxx/stack.hxx>" << endl + << endl; + Traversal::Schema schema; Traversal::Sources sources; |