diff options
Diffstat (limited to 'xsde/cxx/parser/elements.hxx')
-rw-r--r-- | xsde/cxx/parser/elements.hxx | 105 |
1 files changed, 97 insertions, 8 deletions
diff --git a/xsde/cxx/parser/elements.hxx b/xsde/cxx/parser/elements.hxx index 497577f..9857989 100644 --- a/xsde/cxx/parser/elements.hxx +++ b/xsde/cxx/parser/elements.hxx @@ -323,20 +323,44 @@ namespace CXX // struct ParticleParamDecl: Traversal::Element, Context { - ParticleParamDecl (Context& c, Boolean& first, Boolean name_arg) - : Context (c), first_ (first), name_arg_ (name_arg) + ParticleParamDecl (Context& c, + Boolean& first, + Boolean name_arg, + Boolean poly) + : Context (c), + first_ (first), + name_arg_ (name_arg), + poly_ (poly), + result_ (0) + { + } + + ParticleParamDecl (Context& c, Boolean* result, Boolean poly) + : Context (c), first_ (name_arg_), poly_ (poly), result_ (result) { } virtual Void traverse (SemanticGraph::Element& e) { + if (poly_ && anonymous (e.type ())) + return; + + if (result_ != 0) + { + *result_ = true; + return; + } + if (!first_) os << "," << endl; else first_ = false; - os << fq_name (e.type ()) << "&"; + if (poly_) + os << parser_map << "&"; + else + os << fq_name (e.type ()) << "&"; if (name_arg_) os << " " << ename (e); @@ -347,18 +371,34 @@ namespace CXX private: Boolean& first_; Boolean name_arg_; + Boolean poly_; + Boolean* result_; }; struct AttributeParamDecl: Traversal::Attribute, Context { AttributeParamDecl (Context& c, Boolean& first, Boolean name_arg) - : Context (c), first_ (first), name_arg_ (name_arg) + : Context (c), + first_ (first), + name_arg_ (name_arg), + result_ (0) + { + } + + AttributeParamDecl (Context& c, Boolean* result) + : Context (c), first_ (name_arg_), result_ (result) { } virtual Void traverse (Type& a) { + if (result_ != 0) + { + *result_ = true; + return; + } + if (!first_) os << "," << endl; else @@ -375,18 +415,38 @@ namespace CXX private: Boolean& first_; Boolean name_arg_; + Boolean* result_; }; struct ParserParamDecl : Traversal::Complex, Traversal::List, Context { - ParserParamDecl (Context& c, Boolean name_arg) + ParserParamDecl (Context& c, Boolean name_arg, Boolean poly) : Context (c), - particle_ (c, first_, name_arg), + particle_ (c, first_, name_arg, poly), attribute_ (c, first_, name_arg), first_ (true), - name_arg_ (name_arg) + name_arg_ (name_arg), + poly_ (poly), + result_ (0) + { + inherits_ >> *this; + + contains_compositor_ >> compositor_ >> contains_particle_; + contains_particle_ >> particle_; + contains_particle_ >> compositor_; + + if (!poly_) + names_ >> attribute_; + } + + ParserParamDecl (Context& c, Boolean* result, Boolean poly) + : Context (c), + particle_ (c, result, poly), + attribute_ (c, result), + poly_ (poly), + result_ (result) { inherits_ >> *this; @@ -394,7 +454,8 @@ namespace CXX contains_particle_ >> particle_; contains_particle_ >> compositor_; - names_ >> attribute_; + if (!poly_) + names_ >> attribute_; } virtual Void @@ -412,6 +473,15 @@ namespace CXX virtual Void traverse (SemanticGraph::List& l) { + if (poly_) + return; + + if (result_ != 0) + { + *result_ = true; + return; + } + if (!first_) os << "," << endl; else @@ -438,6 +508,25 @@ namespace CXX Boolean first_; Boolean name_arg_; + Boolean poly_; + Boolean* result_; + }; + + struct ParserParamTest + { + ParserParamTest (Context& c, Boolean& result, Boolean poly) + : impl_ (c, &result, poly) + { + } + + Void + traverse (SemanticGraph::Complex& c) + { + impl_.traverse (c); + } + + private: + ParserParamDecl impl_; }; // |