From 52f70f6901d00f7b7609787f10fb6408b892aeda Mon Sep 17 00:00:00 2001 From: Paul Beckingham Date: Fri, 16 Dec 2011 07:44:19 -0500 Subject: [PATCH] Regexes - Added support for \< and \> for Solaris (thanks to Owen Clarke). --- src/A3.cpp | 9 +++++++++ test/rx.t.cpp | 12 ++++++++++++ 2 files changed, 21 insertions(+) diff --git a/src/A3.cpp b/src/A3.cpp index 3cb4c67b5..d72338b43 100644 --- a/src/A3.cpp +++ b/src/A3.cpp @@ -41,6 +41,7 @@ #include #include #include +#include extern Context context; @@ -1012,7 +1013,11 @@ const A3 A3::expand (const A3& input) const { expanded.push_back (Arg (name, Arg::type_string, Arg::cat_dom)); expanded.push_back (Arg ("~", Arg::cat_op)); +#ifdef SOLARIS + expanded.push_back (Arg ("\\<" + value + "\\>", Arg::type_string, Arg::cat_rx)); +#else expanded.push_back (Arg ("\\b" + value + "\\b", Arg::type_string, Arg::cat_rx)); +#endif } // name.noword:value --> name !~ \bvalue\n @@ -1020,7 +1025,11 @@ const A3 A3::expand (const A3& input) const { expanded.push_back (Arg (name, Arg::type_string, Arg::cat_dom)); expanded.push_back (Arg ("!~", Arg::cat_op)); +#ifdef SOLARIS + expanded.push_back (Arg ("\\<" + value + "\\>", Arg::type_string, Arg::cat_rx)); +#else expanded.push_back (Arg ("\\b" + value + "\\b", Arg::type_string, Arg::cat_rx)); +#endif } else throw format (STRING_A3_UNKNOWN_ATTMOD, mod); diff --git a/test/rx.t.cpp b/test/rx.t.cpp index cd0344215..4ffd03ced 100644 --- a/test/rx.t.cpp +++ b/test/rx.t.cpp @@ -93,6 +93,17 @@ int main (int argc, char** argv) ut.pass (text + " =~ /\\bthe/"); ut.pass (text + " =~ /the\\b/"); ut.pass (text + " =~ /\\bthe\\b/"); +#else +#ifdef SOLARIS + RX r10 ("\\"); + ut.ok (r11.match (text), text + " =~ /the\\>/"); + + RX r12 ("\\"); + ut.ok (r12.match (text), text + " =~ /\\/"); #else RX r10 ("\\bthe"); text = "this is the end."; @@ -103,6 +114,7 @@ int main (int argc, char** argv) RX r12 ("\\bthe\\b"); ut.ok (r12.match (text), text + " =~ /\\bthe\\b/"); +#endif #endif return 0;