diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2012-05-09 11:50:57 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2012-05-09 11:50:57 +0200 |
commit | 6bf1e46ccc93777ca9f62746ada0e18c72fcf138 (patch) | |
tree | 89af9295e53ed2751f8343e32b55f799ce385c07 /xsd/xsd.cxx | |
parent | 3067cb353cca291d25b4b1fcf6acdb110e560536 (diff) |
Port to use regex from libcutl instead of libbackend-elements
Diffstat (limited to 'xsd/xsd.cxx')
-rw-r--r-- | xsd/xsd.cxx | 47 |
1 files changed, 24 insertions, 23 deletions
diff --git a/xsd/xsd.cxx b/xsd/xsd.cxx index 3199e82..ef5c2f0 100644 --- a/xsd/xsd.cxx +++ b/xsd/xsd.cxx @@ -3,6 +3,8 @@ // copyright : Copyright (c) 2005-2011 Code Synthesis Tools CC // license : GNU GPL v2 + exceptions; see accompanying LICENSE file +#include <cutl/re.hxx> + #include <cult/types.hxx> #include <cult/trace/log.hxx> @@ -23,7 +25,6 @@ #include <xsd-frontend/transformations/schema-per-type.hxx> #include <xsd-frontend/transformations/simplifier.hxx> -#include <backend-elements/regex.hxx> #include <backend-elements/indentation/clip.hxx> #include <cxx/tree/generator.hxx> @@ -144,8 +145,8 @@ struct LocationTranslator: XSDFrontend::LocationTranslator private: typedef Cult::Containers::Map<NarrowString, NarrowString> Map; - typedef BackendElements::Regex::Expression<Char> Regex; - typedef BackendElements::Regex::Format<Char> RegexFormat; + typedef cutl::re::regexsub Regex; + typedef cutl::re::format RegexFormat; typedef Cult::Containers::Vector<Regex> RegexVector; typedef Cult::Containers::Map<NarrowString, NarrowString> Cache; @@ -171,8 +172,8 @@ struct AnonymousNameTranslator: Transformations::AnonymousNameTranslator WideString const& xpath); private: - typedef BackendElements::Regex::Expression<WideChar> Regex; - typedef BackendElements::Regex::Format<WideChar> RegexFormat; + typedef cutl::re::wregexsub Regex; + typedef cutl::re::wformat RegexFormat; typedef Cult::Containers::Vector<Regex> RegexVector; RegexVector regex_; @@ -198,15 +199,15 @@ struct SchemaPerTypeTranslator: Transformations::SchemaPerTypeTranslator translate_schema (NarrowString const& file); private: - typedef BackendElements::Regex::Expression<WideChar> TypeRegex; - typedef BackendElements::Regex::Format<WideChar> TypeRegexFormat; + typedef cutl::re::wregexsub TypeRegex; + typedef cutl::re::wformat TypeRegexFormat; typedef Cult::Containers::Vector<TypeRegex> TypeRegexVector; TypeRegexVector type_regex_; Boolean type_trace_; - typedef BackendElements::Regex::Expression<Char> SchemaRegex; - typedef BackendElements::Regex::Format<Char> SchemaRegexFormat; + typedef cutl::re::regexsub SchemaRegex; + typedef cutl::re::format SchemaRegexFormat; typedef Cult::Containers::Vector<SchemaRegex> SchemaRegexVector; SchemaRegexVector schema_regex_; @@ -1151,7 +1152,7 @@ LocationTranslator (NarrowStrings const& map, catch (RegexFormat const& e) { wcerr << "error: invalid location regex: '" << - e.expression ().c_str () << "': " << + e.regex ().c_str () << "': " << e.description ().c_str () << endl; throw Failed (); @@ -1188,11 +1189,11 @@ translate (NarrowString const& l) i != regex_.rend (); ++i) { if (trace_) - wcerr << "try: '" << i->pattern () << "' : "; + wcerr << "try: '" << i->regex ().str ().c_str () << "' : "; if (i->match (l)) { - NarrowString r (i->merge (l)); + NarrowString r (i->replace (l)); if (trace_) wcerr << "'" << r.c_str () << "' : +" << endl; @@ -1222,12 +1223,12 @@ AnonymousNameTranslator (NarrowStrings const& regex, Boolean trace) { try { - regex_.push_back (Regex (*i)); + regex_.push_back (Regex (WideString (*i))); } catch (RegexFormat const& e) { wcerr << "error: invalid anonymous type regex: '" << - e.expression () << "': " << e.description () << endl; + e.regex () << "': " << e.description () << endl; throw Failed (); } @@ -1249,11 +1250,11 @@ translate (WideString const& file, i != regex_.rend (); ++i) { if (trace_) - wcerr << "try: '" << i->pattern () << "' : "; + wcerr << "try: '" << i->regex () << "' : "; if (i->match (s)) { - WideString r (i->merge (s)); + WideString r (i->replace (s)); if (trace_) wcerr << "'" << r << "' : +" << endl; @@ -1285,12 +1286,12 @@ SchemaPerTypeTranslator (NarrowStrings const& type_regex, { try { - type_regex_.push_back (TypeRegex (*i)); + type_regex_.push_back (TypeRegex (WideString (*i))); } catch (TypeRegexFormat const& e) { wcerr << "error: invalid type file regex: '" << - e.expression () << "': " << e.description () << endl; + e.regex () << "': " << e.description () << endl; throw Failed (); } @@ -1306,7 +1307,7 @@ SchemaPerTypeTranslator (NarrowStrings const& type_regex, catch (SchemaRegexFormat const& e) { wcerr << "error: invalid type file regex: '" << - e.expression ().c_str () << "': " << e.description ().c_str () << endl; + e.regex ().c_str () << "': " << e.description ().c_str () << endl; throw Failed (); } @@ -1325,11 +1326,11 @@ translate_type (WideString const& ns, WideString const& name) i != type_regex_.rend (); ++i) { if (type_trace_) - wcerr << "try: '" << i->pattern () << "' : "; + wcerr << "try: '" << i->regex () << "' : "; if (i->match (s)) { - WideString r (i->merge (s)); + WideString r (i->replace (s)); if (type_trace_) wcerr << "'" << r << "' : +" << endl; @@ -1356,11 +1357,11 @@ translate_schema (NarrowString const& file) i != schema_regex_.rend (); ++i) { if (schema_trace_) - wcerr << "try: '" << i->pattern () << "' : "; + wcerr << "try: '" << i->regex ().str ().c_str () << "' : "; if (i->match (file)) { - NarrowString r (i->merge (file)); + NarrowString r (i->replace (file)); if (schema_trace_) wcerr << "'" << r.c_str () << "' : +" << endl; |