1// Many of these are cribbed from RE2's test suite. 2 3matiter!(wb1, r"\b", ""); 4matiter!(wb2, r"\b", "a", (0, 0), (1, 1)); 5matiter!(wb3, r"\b", "ab", (0, 0), (2, 2)); 6matiter!(wb4, r"^\b", "ab", (0, 0)); 7matiter!(wb5, r"\b$", "ab", (2, 2)); 8matiter!(wb6, r"^\b$", "ab"); 9matiter!(wb7, r"\bbar\b", "nobar bar foo bar", (6, 9), (14, 17)); 10matiter!(wb8, r"a\b", "faoa x", (3, 4)); 11matiter!(wb9, r"\bbar", "bar x", (0, 3)); 12matiter!(wb10, r"\bbar", "foo\nbar x", (4, 7)); 13matiter!(wb11, r"bar\b", "foobar", (3, 6)); 14matiter!(wb12, r"bar\b", "foobar\nxxx", (3, 6)); 15matiter!(wb13, r"(foo|bar|[A-Z])\b", "foo", (0, 3)); 16matiter!(wb14, r"(foo|bar|[A-Z])\b", "foo\n", (0, 3)); 17matiter!(wb15, r"\b(foo|bar|[A-Z])", "foo", (0, 3)); 18matiter!(wb16, r"\b(foo|bar|[A-Z])\b", "X", (0, 1)); 19matiter!(wb17, r"\b(foo|bar|[A-Z])\b", "XY"); 20matiter!(wb18, r"\b(foo|bar|[A-Z])\b", "bar", (0, 3)); 21matiter!(wb19, r"\b(foo|bar|[A-Z])\b", "foo", (0, 3)); 22matiter!(wb20, r"\b(foo|bar|[A-Z])\b", "foo\n", (0, 3)); 23matiter!(wb21, r"\b(foo|bar|[A-Z])\b", "ffoo bbar N x", (10, 11)); 24matiter!(wb22, r"\b(fo|foo)\b", "fo", (0, 2)); 25matiter!(wb23, r"\b(fo|foo)\b", "foo", (0, 3)); 26matiter!(wb24, r"\b\b", ""); 27matiter!(wb25, r"\b\b", "a", (0, 0), (1, 1)); 28matiter!(wb26, r"\b$", ""); 29matiter!(wb27, r"\b$", "x", (1, 1)); 30matiter!(wb28, r"\b$", "y x", (3, 3)); 31matiter!(wb29, r"\b.$", "x", (0, 1)); 32matiter!(wb30, r"^\b(fo|foo)\b", "fo", (0, 2)); 33matiter!(wb31, r"^\b(fo|foo)\b", "foo", (0, 3)); 34matiter!(wb32, r"^\b$", ""); 35matiter!(wb33, r"^\b$", "x"); 36matiter!(wb34, r"^\b.$", "x", (0, 1)); 37matiter!(wb35, r"^\b.\b$", "x", (0, 1)); 38matiter!(wb36, r"^^^^^\b$$$$$", ""); 39matiter!(wb37, r"^^^^^\b.$$$$$", "x", (0, 1)); 40matiter!(wb38, r"^^^^^\b$$$$$", "x"); 41matiter!(wb39, r"^^^^^\b\b\b.\b\b\b$$$$$", "x", (0, 1)); 42matiter!(wb40, r"\b.+\b", "$$abc$$", (2, 5)); 43matiter!(wb41, r"\b", "a b c", (0, 0), (1, 1), (2, 2), (3, 3), (4, 4), (5, 5)); 44 45matiter!(nb1, r"\Bfoo\B", "n foo xfoox that", (7, 10)); 46matiter!(nb2, r"a\B", "faoa x", (1, 2)); 47matiter!(nb3, r"\Bbar", "bar x"); 48matiter!(nb4, r"\Bbar", "foo\nbar x"); 49matiter!(nb5, r"bar\B", "foobar"); 50matiter!(nb6, r"bar\B", "foobar\nxxx"); 51matiter!(nb7, r"(foo|bar|[A-Z])\B", "foox", (0, 3)); 52matiter!(nb8, r"(foo|bar|[A-Z])\B", "foo\n"); 53matiter!(nb9, r"\B", "", (0, 0)); 54matiter!(nb10, r"\B", "x"); 55matiter!(nb11, r"\B(foo|bar|[A-Z])", "foo"); 56matiter!(nb12, r"\B(foo|bar|[A-Z])\B", "xXy", (1, 2)); 57matiter!(nb13, r"\B(foo|bar|[A-Z])\B", "XY"); 58matiter!(nb14, r"\B(foo|bar|[A-Z])\B", "XYZ", (1, 2)); 59matiter!(nb15, r"\B(foo|bar|[A-Z])\B", "abara", (1, 4)); 60matiter!(nb16, r"\B(foo|bar|[A-Z])\B", "xfoo_", (1, 4)); 61matiter!(nb17, r"\B(foo|bar|[A-Z])\B", "xfoo\n"); 62matiter!(nb18, r"\B(foo|bar|[A-Z])\B", "foo bar vNX", (9, 10)); 63matiter!(nb19, r"\B(fo|foo)\B", "xfoo", (1, 3)); 64matiter!(nb20, r"\B(foo|fo)\B", "xfooo", (1, 4)); 65matiter!(nb21, r"\B\B", "", (0, 0)); 66matiter!(nb22, r"\B\B", "x"); 67matiter!(nb23, r"\B$", "", (0, 0)); 68matiter!(nb24, r"\B$", "x"); 69matiter!(nb25, r"\B$", "y x"); 70matiter!(nb26, r"\B.$", "x"); 71matiter!(nb27, r"^\B(fo|foo)\B", "fo"); 72matiter!(nb28, r"^\B(fo|foo)\B", "foo"); 73matiter!(nb29, r"^\B", "", (0, 0)); 74matiter!(nb30, r"^\B", "x"); 75matiter!(nb31, r"^\B\B", "", (0, 0)); 76matiter!(nb32, r"^\B\B", "x"); 77matiter!(nb33, r"^\B$", "", (0, 0)); 78matiter!(nb34, r"^\B$", "x"); 79matiter!(nb35, r"^\B.$", "x"); 80matiter!(nb36, r"^\B.\B$", "x"); 81matiter!(nb37, r"^^^^^\B$$$$$", "", (0, 0)); 82matiter!(nb38, r"^^^^^\B.$$$$$", "x"); 83matiter!(nb39, r"^^^^^\B$$$$$", "x"); 84 85// These work for both Unicode and ASCII because all matches are reported as 86// byte offsets, and « and » do not correspond to word boundaries at either 87// the character or byte level. 88matiter!(unicode1, r"\bx\b", "«x", (2, 3)); 89matiter!(unicode2, r"\bx\b", "x»", (0, 1)); 90