From 5005d4d4bd444eed25e3d60bef6ced160a84bb5b Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Wed, 30 Jul 2014 10:18:53 +0200 Subject: Support for abstract complex types --- xsd-frontend/parser.cxx | 11 +++++++++-- xsd-frontend/semantic-graph/complex.cxx | 9 ++++++--- xsd-frontend/semantic-graph/complex.hxx | 9 ++++++++- 3 files changed, 23 insertions(+), 6 deletions(-) diff --git a/xsd-frontend/parser.cxx b/xsd-frontend/parser.cxx index 6b582ab..6a37475 100644 --- a/xsd-frontend/parser.cxx +++ b/xsd-frontend/parser.cxx @@ -3148,7 +3148,10 @@ namespace XSDFrontend pop_scope (); else { - Complex& node (s_->new_node (file (), t.line (), t.column ())); + // Really a simple type so not abstract/mixed checks. + // + Complex& node (s_->new_node ( + file (), t.line (), t.column (), false)); if (base_type) restricts = &s_->new_edge (node, *base_type); @@ -3202,7 +3205,11 @@ namespace XSDFrontend { Type* r (0); - Complex& node (s_->new_node (file (), t.line (), t.column ())); + String abs_s (trim (t["abstract"])); + bool abs (abs_s == L"true" || abs_s == L"1"); + + Complex& node (s_->new_node ( + file (), t.line (), t.column (), abs)); if (String m = trim (t["mixed"])) node.mixed_p (m == L"true" || m == L"1"); diff --git a/xsd-frontend/semantic-graph/complex.cxx b/xsd-frontend/semantic-graph/complex.cxx index 8433a0e..5ac1d6f 100644 --- a/xsd-frontend/semantic-graph/complex.cxx +++ b/xsd-frontend/semantic-graph/complex.cxx @@ -12,14 +12,17 @@ namespace XSDFrontend { Complex:: Complex () - : mixed_ (false), contains_compositor_ (0) + : abstract_ (false), mixed_ (false), contains_compositor_ (0) { } Complex:: - Complex (Path const& file, unsigned long line, unsigned long column) + Complex (Path const& file, + unsigned long line, + unsigned long column, + bool abstract) : Node (file, line, column), - mixed_ (false), contains_compositor_ (0) + abstract_ (abstract), mixed_ (false), contains_compositor_ (0) { } diff --git a/xsd-frontend/semantic-graph/complex.hxx b/xsd-frontend/semantic-graph/complex.hxx index ac47810..c04de74 100644 --- a/xsd-frontend/semantic-graph/complex.hxx +++ b/xsd-frontend/semantic-graph/complex.hxx @@ -16,6 +16,9 @@ namespace XSDFrontend { public: bool + abstract_p () const {return abstract_;} + + bool mixed_p () const { if (mixed_) @@ -55,7 +58,10 @@ namespace XSDFrontend } public: - Complex (Path const& file, unsigned long line, unsigned long column); + Complex (Path const& file, + unsigned long line, + unsigned long column, + bool abstract); void add_edge_left (ContainsCompositor& e) @@ -78,6 +84,7 @@ namespace XSDFrontend Complex (); // For virtual inheritance (Enumeration). private: + bool abstract_; bool mixed_; ContainsCompositor* contains_compositor_; }; -- cgit v1.1