aboutsummaryrefslogtreecommitdiff
path: root/xsd/cxx/tree
diff options
context:
space:
mode:
Diffstat (limited to 'xsd/cxx/tree')
-rw-r--r--xsd/cxx/tree/elements.cxx14
-rw-r--r--xsd/cxx/tree/elements.hxx8
-rw-r--r--xsd/cxx/tree/generator.cxx41
-rw-r--r--xsd/cxx/tree/name-processor.cxx46
-rw-r--r--xsd/cxx/tree/tree-forward.cxx2
5 files changed, 60 insertions, 51 deletions
diff --git a/xsd/cxx/tree/elements.cxx b/xsd/cxx/tree/elements.cxx
index 0b69fff..233063a 100644
--- a/xsd/cxx/tree/elements.cxx
+++ b/xsd/cxx/tree/elements.cxx
@@ -291,7 +291,7 @@ namespace CXX
}
regex_custom_type_map.push_back (
- RegexCustomTypeMapInfo (pat, type, base));
+ RegexCustomTypeMapInfo (WideRegexPat (pat), type, base));
}
}
}
@@ -414,7 +414,7 @@ namespace CXX
return true;
}
- r = i->pat.merge (i->type_sub, name);
+ r = i->pat.replace (name, i->type_sub);
return true;
}
}
@@ -467,7 +467,7 @@ namespace CXX
{
if (!i->base_sub.empty ())
{
- r = i->pat.merge (i->base_sub, name);
+ r = i->pat.replace (name, i->base_sub);
}
else
r.clear ();
@@ -1354,25 +1354,25 @@ namespace CXX
{
case forward:
{
- inc_path = ctx_.fwd_expr->merge (path_str);
+ inc_path = ctx_.fwd_expr->replace (path_str);
break;
}
case header:
case source:
{
- inc_path = ctx_.hxx_expr->merge (path_str);
+ inc_path = ctx_.hxx_expr->replace (path_str);
break;
}
case inline_:
{
if (weak)
{
- inc_path = ctx_.hxx_expr->merge (path_str);
+ inc_path = ctx_.hxx_expr->replace (path_str);
ctx_.os << "#include " << ctx_.process_include_path (inc_path)
<< endl;
}
- inc_path = ctx_.ixx_expr->merge (path_str);
+ inc_path = ctx_.ixx_expr->replace (path_str);
break;
}
}
diff --git a/xsd/cxx/tree/elements.hxx b/xsd/cxx/tree/elements.hxx
index 369dc3a..edcb0d2 100644
--- a/xsd/cxx/tree/elements.hxx
+++ b/xsd/cxx/tree/elements.hxx
@@ -8,12 +8,12 @@
#include <sstream>
+#include <cutl/re.hxx>
+
#include <cult/containers/map.hxx>
#include <cult/containers/deque.hxx>
#include <cult/containers/vector.hxx>
-#include <backend-elements/regex.hxx>
-
#include <cxx/elements.hxx>
#include <cxx/tree/cli.hxx>
@@ -74,8 +74,8 @@ namespace CXX
class Context: public CXX::Context
{
public:
- typedef BackendElements::Regex::Expression<Char> Regex;
- typedef BackendElements::Regex::Pattern<WideChar> WideRegexPat;
+ typedef cutl::re::regexsub Regex;
+ typedef cutl::re::wregex WideRegexPat;
struct DirectCustomTypeMapInfo
{
diff --git a/xsd/cxx/tree/generator.cxx b/xsd/cxx/tree/generator.cxx
index d7e77d0..5fe4af5 100644
--- a/xsd/cxx/tree/generator.cxx
+++ b/xsd/cxx/tree/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>
@@ -853,7 +854,7 @@ namespace CXX
using std::ios_base;
namespace Indentation = BackendElements::Indentation;
- typedef BackendElements::Regex::Expression<Char> Regex;
+ typedef cutl::re::regexsub Regex;
using Cult::Containers::Vector;
@@ -990,7 +991,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 ();
}
@@ -998,7 +999,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 ();
}
@@ -1006,7 +1007,7 @@ namespace CXX
if (source && parts == 1 && !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 ();
}
@@ -1014,14 +1015,14 @@ namespace CXX
if (forward && !fwd_expr.match (name))
{
wcerr << "error: forward expression '" <<
- fwd_expr.pattern () << "' does not match '" <<
+ fwd_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 fwd_name (forward ? fwd_expr.merge (name) : NarrowString ());
+ NarrowString hxx_name (hxx_expr.replace (name));
+ NarrowString ixx_name (inline_ ? ixx_expr.replace (name) : NarrowString ());
+ NarrowString fwd_name (forward ? fwd_expr.replace (name) : NarrowString ());
Path hxx_path (hxx_name, boost::filesystem::native);
Path ixx_path (ixx_name, boost::filesystem::native);
@@ -1040,23 +1041,23 @@ namespace CXX
Regex expr (
"#^(.+?)(\\.[^./\\\\]+)?$#$1" + parts_suffix + os.str () + "$2#");
- NarrowString part_name (expr.merge (name));
+ NarrowString part_name (expr.replace (name));
if (!cxx_expr.match (part_name))
{
wcerr << "error: source expression '" <<
- cxx_expr.pattern () << "' does not match '" <<
+ cxx_expr.regex ().str ().c_str () << "' does not match '" <<
part_name.c_str () << "'" << endl;
throw Failed ();
}
cxx_paths.push_back (
- Path (cxx_expr.merge (part_name), boost::filesystem::native));
+ Path (cxx_expr.replace (part_name), boost::filesystem::native));
}
}
else
cxx_paths.push_back (
- Path (cxx_expr.merge (name), boost::filesystem::native));
+ Path (cxx_expr.replace (name), boost::filesystem::native));
}
Path out_dir;
@@ -1272,7 +1273,7 @@ namespace CXX
// Guard
//
- String guard (guard_expr.merge (guard_prefix + fwd_name));
+ String guard (guard_expr.replace (guard_prefix + fwd_name));
guard = ctx.escape (guard); // make a c++ id
std::transform (guard.begin (), guard.end(), guard.begin (), upcase);
@@ -1381,7 +1382,7 @@ namespace CXX
// Guard
//
- String guard (guard_expr.merge (guard_prefix + hxx_name));
+ String guard (guard_expr.replace (guard_prefix + hxx_name));
guard = ctx.escape (guard); // make a c++ id
std::transform (guard.begin (), guard.end(), guard.begin (), upcase);
@@ -1529,7 +1530,7 @@ namespace CXX
// Guard
//
- String guard (guard_expr.merge (guard_prefix + ixx_name));
+ String guard (guard_expr.replace (guard_prefix + ixx_name));
guard = ctx.escape (guard); // make a c++ id
std::transform (guard.begin (), guard.end(), guard.begin (), upcase);
@@ -1765,18 +1766,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/xsd/cxx/tree/name-processor.cxx b/xsd/cxx/tree/name-processor.cxx
index b731b82..ad1720f 100644
--- a/xsd/cxx/tree/name-processor.cxx
+++ b/xsd/cxx/tree/name-processor.cxx
@@ -6,12 +6,12 @@
#include <sstream>
#include <iostream>
+#include <cutl/re.hxx>
+
#include <cult/containers/set.hxx>
#include <cult/containers/map.hxx>
#include <cult/containers/vector.hxx>
-#include <backend-elements/regex.hxx>
-
#include <cxx/tree/default-value.hxx>
#include <cxx/tree/name-processor.hxx>
@@ -288,9 +288,17 @@ namespace CXX
}
public:
- typedef BackendElements::Regex::Expression<WideChar> Regex;
- typedef BackendElements::Regex::Format<WideChar> RegexFormat;
- typedef Cult::Containers::Vector<Regex> RegexVector;
+ typedef cutl::re::wregexsub Regex;
+ typedef cutl::re::wformat RegexFormat;
+
+ struct RegexVector: Cult::Containers::Vector<Regex>
+ {
+ void
+ push_back (String const& r)
+ {
+ Cult::Containers::Vector<Regex>::push_back (Regex (r));
+ }
+ };
String
process_regex (String const& name,
@@ -306,11 +314,11 @@ namespace CXX
i != rv.rend (); ++i)
{
if (trace)
- os << "try: '" << i->pattern () << "' : ";
+ os << "try: '" << i->regex () << "' : ";
if (i->match (name))
{
- String r (i->merge (name));
+ String r (i->replace (name));
if (trace)
os << "'" << r << "' : +" << endl;
@@ -340,11 +348,11 @@ namespace CXX
i != primary.rend (); ++i)
{
if (trace)
- os << "try: '" << i->pattern () << "' : ";
+ os << "try: '" << i->regex () << "' : ";
if (i->match (name))
{
- String r (i->merge (name));
+ String r (i->replace (name));
if (trace)
os << "'" << r << "' : +" << endl;
@@ -360,11 +368,11 @@ namespace CXX
i != backup.rend (); ++i)
{
if (trace)
- os << "try: '" << i->pattern () << "' : ";
+ os << "try: '" << i->regex () << "' : ";
if (i->match (name))
{
- String r (i->merge (name));
+ String r (i->replace (name));
if (trace)
os << "'" << r << "' : +" << endl;
@@ -395,11 +403,11 @@ namespace CXX
i != rv.rend (); ++i)
{
if (trace)
- os << "try: '" << i->pattern () << "' : ";
+ os << "try: '" << i->regex () << "' : ";
if (i->match (s))
{
- String r (i->merge (s));
+ String r (i->replace (s));
if (trace)
os << "'" << r << "' : +" << endl;
@@ -431,11 +439,11 @@ namespace CXX
i != primary.rend (); ++i)
{
if (trace)
- os << "try: '" << i->pattern () << "' : ";
+ os << "try: '" << i->regex () << "' : ";
if (i->match (s))
{
- String r (i->merge (s));
+ String r (i->replace (s));
if (trace)
os << "'" << r << "' : +" << endl;
@@ -451,11 +459,11 @@ namespace CXX
i != backup.rend (); ++i)
{
if (trace)
- os << "try: '" << i->pattern () << "' : ";
+ os << "try: '" << i->regex () << "' : ";
if (i->match (s))
{
- String r (i->merge (s));
+ String r (i->replace (s));
if (trace)
os << "'" << r << "' : +" << endl;
@@ -503,12 +511,12 @@ namespace CXX
{
try
{
- rv.push_back (Regex (*i));
+ rv.push_back (*i);
}
catch (RegexFormat const& e)
{
os << "error: invalid " << id << " name regex: '" <<
- e.expression () << "': " << e.description () << endl;
+ e.regex () << "': " << e.description ().c_str () << endl;
throw Failed ();
}
diff --git a/xsd/cxx/tree/tree-forward.cxx b/xsd/cxx/tree/tree-forward.cxx
index 2c6ad1b..7ec6155 100644
--- a/xsd/cxx/tree/tree-forward.cxx
+++ b/xsd/cxx/tree/tree-forward.cxx
@@ -145,7 +145,7 @@ namespace CXX
//
if (xml_schema)
{
- String name (ctx.hxx_expr->merge (xml_schema));
+ String name (ctx.hxx_expr->replace (xml_schema));
ctx.os << "#include " << ctx.process_include_path (name) << endl
<< endl;