diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2012-05-09 11:52:59 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2012-05-09 11:52:59 +0200 |
commit | 713324411804114f2699c6c127c659345d7359d5 (patch) | |
tree | 614357de1a6607d864faf5df5a4b7e085e08fc03 /xsde/cxx/parser | |
parent | 1061c7c0ac3e6e9f6de93a9d8c68ce5d7a40c7ed (diff) |
Port to use regex from libcutl instead of libbackend-elements
Diffstat (limited to 'xsde/cxx/parser')
-rw-r--r-- | xsde/cxx/parser/elements.cxx | 4 | ||||
-rw-r--r-- | xsde/cxx/parser/elements.hxx | 4 | ||||
-rw-r--r-- | xsde/cxx/parser/generator.cxx | 41 | ||||
-rw-r--r-- | xsde/cxx/parser/parser-header.cxx | 2 | ||||
-rw-r--r-- | xsde/cxx/parser/type-processor.cxx | 12 |
5 files changed, 32 insertions, 31 deletions
diff --git a/xsde/cxx/parser/elements.cxx b/xsde/cxx/parser/elements.cxx index 1e58262..bd5b09a 100644 --- a/xsde/cxx/parser/elements.cxx +++ b/xsde/cxx/parser/elements.cxx @@ -305,12 +305,12 @@ namespace CXX case header: case source: { - inc_path = ctx_.hxx_expr->merge (path_str); + inc_path = ctx_.hxx_expr->replace (path_str); break; } case impl_header: { - inc_path = ctx_.hxx_impl_expr->merge (path_str); + inc_path = ctx_.hxx_impl_expr->replace (path_str); break; } } diff --git a/xsde/cxx/parser/elements.hxx b/xsde/cxx/parser/elements.hxx index 020e51b..6ce5593 100644 --- a/xsde/cxx/parser/elements.hxx +++ b/xsde/cxx/parser/elements.hxx @@ -8,7 +8,7 @@ #include <sstream> -#include <backend-elements/regex.hxx> +#include <cutl/re.hxx> #include <cxx/elements.hxx> @@ -33,7 +33,7 @@ namespace CXX class Context: public CXX::Context { public: - typedef BackendElements::Regex::Expression<Char> Regex; + typedef cutl::re::regexsub Regex; public: Context (std::wostream&, diff --git a/xsde/cxx/parser/generator.cxx b/xsde/cxx/parser/generator.cxx index 22e1669..6c8f8c7 100644 --- a/xsde/cxx/parser/generator.cxx +++ b/xsde/cxx/parser/generator.cxx @@ -7,6 +7,8 @@ #include <boost/filesystem/fstream.hpp> +#include <cutl/re.hxx> + #include <cult/containers/set.hxx> #include <cult/containers/vector.hxx> @@ -14,7 +16,6 @@ #include <cutl/compiler/cxx-indenter.hxx> #include <cutl/compiler/sloc-counter.hxx> -#include <backend-elements/regex.hxx> #include <backend-elements/indentation/clip.hxx> #include <xsd-frontend/semantic-graph.hxx> @@ -632,7 +633,7 @@ namespace CXX using std::ios_base; namespace Indentation = BackendElements::Indentation; - typedef BackendElements::Regex::Expression<Char> Regex; + typedef cutl::re::regexsub Regex; try { @@ -885,7 +886,7 @@ namespace CXX if (!hxx_expr.match (name)) { wcerr << "error: header expression '" << - hxx_expr.pattern () << "' does not match '" << + hxx_expr.regex ().str ().c_str () << "' does not match '" << name.c_str () << "'" << endl; throw Failed (); } @@ -893,7 +894,7 @@ namespace CXX if (inline_ && !ixx_expr.match (name)) { wcerr << "error: inline expression '" << - ixx_expr.pattern () << "' does not match '" << + ixx_expr.regex ().str ().c_str () << "' does not match '" << name.c_str () << "'" << endl; throw Failed (); } @@ -901,7 +902,7 @@ namespace CXX if (source && !cxx_expr.match (name)) { wcerr << "error: source expression '" << - cxx_expr.pattern () << "' does not match '" << + cxx_expr.regex ().str ().c_str () << "' does not match '" << name.c_str () << "'" << endl; throw Failed (); } @@ -911,7 +912,7 @@ namespace CXX if (!hxx_impl_expr.match (name)) { wcerr << "error: implementation header expression '" << - hxx_impl_expr.pattern () << "' does not match '" << + hxx_impl_expr.regex ().str ().c_str () << "' does not match '" << name.c_str () << "'" << endl; throw Failed (); } @@ -919,7 +920,7 @@ namespace CXX if (!cxx_impl_expr.match (name)) { wcerr << "error: implementation source expression '" << - cxx_impl_expr.pattern () << "' does not match '" << + cxx_impl_expr.regex ().str ().c_str () << "' does not match '" << name.c_str () << "'" << endl; throw Failed (); } @@ -927,15 +928,15 @@ namespace CXX if (!cxx_driver_expr.match (name)) { wcerr << "error: driver source expression '" << - cxx_driver_expr.pattern () << "' does not match '" << + cxx_driver_expr.regex ().str ().c_str () << "' does not match '" << name.c_str () << "'" << endl; throw Failed (); } } - NarrowString hxx_name (hxx_expr.merge (name)); - NarrowString ixx_name (inline_ ? ixx_expr.merge (name) : NarrowString ()); - NarrowString cxx_name (source ? cxx_expr.merge (name) : NarrowString ()); + NarrowString hxx_name (hxx_expr.replace (name)); + NarrowString ixx_name (inline_ ? ixx_expr.replace (name) : NarrowString ()); + NarrowString cxx_name (source ? cxx_expr.replace (name) : NarrowString ()); NarrowString hxx_impl_name; NarrowString cxx_impl_name; @@ -943,9 +944,9 @@ namespace CXX if (impl || driver) { - hxx_impl_name = hxx_impl_expr.merge (name); - cxx_impl_name = cxx_impl_expr.merge (name); - cxx_driver_name = cxx_driver_expr.merge (name); + hxx_impl_name = hxx_impl_expr.replace (name); + cxx_impl_name = cxx_impl_expr.replace (name); + cxx_driver_name = cxx_driver_expr.replace (name); } Path hxx_path (hxx_name, boost::filesystem::native); @@ -1215,7 +1216,7 @@ namespace CXX sloc_filter sloc (hxx); - String guard (guard_expr.merge (guard_prefix + hxx_name)); + String guard (guard_expr.replace (guard_prefix + hxx_name)); guard = ctx.escape (guard); // Make it a C++ id. std::transform (guard.begin (), guard.end(), guard.begin (), upcase); @@ -1595,7 +1596,7 @@ namespace CXX Context ctx (hxx_impl, schema, file_path, ops, &hxx_expr, &ixx_expr, &hxx_impl_expr); - String guard (guard_expr.merge (guard_prefix + hxx_impl_name)); + String guard (guard_expr.replace (guard_prefix + hxx_impl_name)); guard = ctx.escape (guard); // Make it a C++ id. std::transform (guard.begin (), guard.end(), guard.begin (), upcase); @@ -1675,18 +1676,18 @@ namespace CXX throw Failed (); } - catch (BackendElements::Regex::Format<Char> const& e) + catch (cutl::re::format const& e) { wcerr << "error: invalid regex: '" << - e.expression ().c_str () << "': " << + e.regex ().c_str () << "': " << e.description ().c_str () << endl; throw Failed (); } - catch (BackendElements::Regex::Format<WideChar> const& e) + catch (cutl::re::wformat const& e) { wcerr << "error: invalid regex: '" << - e.expression () << "': " << e.description () << endl; + e.regex () << "': " << e.description ().c_str () << endl; throw Failed (); } diff --git a/xsde/cxx/parser/parser-header.cxx b/xsde/cxx/parser/parser-header.cxx index 238b5e6..2cdc297 100644 --- a/xsde/cxx/parser/parser-header.cxx +++ b/xsde/cxx/parser/parser-header.cxx @@ -1750,7 +1750,7 @@ namespace CXX if (extern_xml_schema) { - String name (ctx.hxx_expr->merge (extern_xml_schema)); + String name (ctx.hxx_expr->replace (extern_xml_schema)); ctx.os << "#include " << ctx.process_include_path (name) << endl << endl; diff --git a/xsde/cxx/parser/type-processor.cxx b/xsde/cxx/parser/type-processor.cxx index 8605241..3e0abbe 100644 --- a/xsde/cxx/parser/type-processor.cxx +++ b/xsde/cxx/parser/type-processor.cxx @@ -105,8 +105,8 @@ namespace CXX { if (!n->xsd_name ().empty ()) { - cxx_ns = n->xsd_name ().merge ( - n->cxx_name (), ns_name, true); + cxx_ns = n->xsd_name ().replace ( + ns_name, n->cxx_name (), true); } else cxx_ns = n->cxx_name (); @@ -118,16 +118,16 @@ namespace CXX // String ret_type (cxx_ns); - ret_type += t->xsd_name ().merge ( - t->cxx_ret_name (), t_name, true); + ret_type += t->xsd_name ().replace ( + t_name, t->cxx_ret_name (), true); String arg_type; if (t->cxx_arg_name ()) { arg_type = cxx_ns; - arg_type += t->xsd_name ().merge ( - t->cxx_arg_name (), t_name, true); + arg_type += t->xsd_name ().replace ( + t_name, t->cxx_arg_name (), true); } else { |