- Added support for \< and \> for Solaris (thanks to Owen Clarke).
This commit is contained in:
Paul Beckingham 2011-12-16 07:44:19 -05:00
parent f173469f98
commit 52f70f6901
2 changed files with 21 additions and 0 deletions

View file

@ -41,6 +41,7 @@
#include <util.h>
#include <i18n.h>
#include <A3.h>
#include <cmake.h>
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);

View file

@ -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 ("\\<the");
text = "this is the end.";
ut.ok (r10.match (text), text + " =~ /\\<the/");
RX r11 ("the\\>");
ut.ok (r11.match (text), text + " =~ /the\\>/");
RX r12 ("\\<the\\>");
ut.ok (r12.match (text), text + " =~ /\\<the\\>/");
#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;