mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-08-20 04:13:07 +02:00
Regexes
- Added support for \< and \> for Solaris (thanks to Owen Clarke).
This commit is contained in:
parent
f173469f98
commit
52f70f6901
2 changed files with 21 additions and 0 deletions
|
@ -41,6 +41,7 @@
|
||||||
#include <util.h>
|
#include <util.h>
|
||||||
#include <i18n.h>
|
#include <i18n.h>
|
||||||
#include <A3.h>
|
#include <A3.h>
|
||||||
|
#include <cmake.h>
|
||||||
|
|
||||||
extern Context context;
|
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 (name, Arg::type_string, Arg::cat_dom));
|
||||||
expanded.push_back (Arg ("~", Arg::cat_op));
|
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));
|
expanded.push_back (Arg ("\\b" + value + "\\b", Arg::type_string, Arg::cat_rx));
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
// name.noword:value --> name !~ \bvalue\n
|
// 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 (name, Arg::type_string, Arg::cat_dom));
|
||||||
expanded.push_back (Arg ("!~", Arg::cat_op));
|
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));
|
expanded.push_back (Arg ("\\b" + value + "\\b", Arg::type_string, Arg::cat_rx));
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
throw format (STRING_A3_UNKNOWN_ATTMOD, mod);
|
throw format (STRING_A3_UNKNOWN_ATTMOD, mod);
|
||||||
|
|
|
@ -93,6 +93,17 @@ int main (int argc, char** argv)
|
||||||
ut.pass (text + " =~ /\\bthe/");
|
ut.pass (text + " =~ /\\bthe/");
|
||||||
ut.pass (text + " =~ /the\\b/");
|
ut.pass (text + " =~ /the\\b/");
|
||||||
ut.pass (text + " =~ /\\bthe\\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
|
#else
|
||||||
RX r10 ("\\bthe");
|
RX r10 ("\\bthe");
|
||||||
text = "this is the end.";
|
text = "this is the end.";
|
||||||
|
@ -103,6 +114,7 @@ int main (int argc, char** argv)
|
||||||
|
|
||||||
RX r12 ("\\bthe\\b");
|
RX r12 ("\\bthe\\b");
|
||||||
ut.ok (r12.match (text), text + " =~ /\\bthe\\b/");
|
ut.ok (r12.match (text), text + " =~ /\\bthe\\b/");
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue