From e7ccb1f2cec6e90445fd450940ff98542866cbbe Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 21 Jul 2026 10:27:55 +0000 Subject: [PATCH] Commit 8: Add location tests exposing term-location off-by-one (pre-fix) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add location test cases to test.cpp covering various C++ string literal forms: - r_plain: "a+b" — plain, offset 1 (already correct) - r_raw: R"(a+b)" — raw, offset 3 (R"( = 3); currently uses 1 (WRONG) - r_raw2: R"(\s+$)" — raw with metacharacters; currently wrong - r_raw3: R"(\(([,\w]+)+\)$)" — complex raw; currently wrong - r_raw4: R"x(a+b)x" — custom-delimiter raw, offset 4; currently uses 1 (WRONG) - r_wide: L"a+b" — L" prefix, offset 2; currently uses 1 (WRONG) - r_wide_raw: LR"(a+b)" — combined LR"( prefix, offset 4; currently uses 1 (WRONG) - r_esc1: "\\s+" — escape-containing plain; offset 1 (correct) - r_esc2: "a\\.b" — escaped dot; offset 1 (correct) Added std::wregex typedef to stubs (for L"..." and LR"(...)" wide-char literals). New locations.ql query reports per-term: litStartCol, valueStart, valueEnd, termStartCol, termEndCol — restricted to test_locations() function. Generated locations.expected via codeql test run --learn (CodeQL 2.26.1). All 3 tests pass. The expected output captures the CURRENT (pre-fix) columns: raw/prefixed rows show termStartCol = litStartCol + 1 (wrong); plain rows show litStartCol + 1 (correct). Commit 9 changes the raw/prefixed rows to their correct values. --- .../library-tests/regex/locations.expected | 40 ++ cpp/ql/test/library-tests/regex/locations.ql | 29 + .../test/library-tests/regex/parse.expected | 499 ++++++++------ .../test/library-tests/regex/regexp.expected | 608 ++++++++++-------- cpp/ql/test/library-tests/regex/test.cpp | 35 + 5 files changed, 743 insertions(+), 468 deletions(-) create mode 100644 cpp/ql/test/library-tests/regex/locations.expected create mode 100644 cpp/ql/test/library-tests/regex/locations.ql diff --git a/cpp/ql/test/library-tests/regex/locations.expected b/cpp/ql/test/library-tests/regex/locations.expected new file mode 100644 index 00000000000..52d1b7103d9 --- /dev/null +++ b/cpp/ql/test/library-tests/regex/locations.expected @@ -0,0 +1,40 @@ +| test.cpp:144:23:144:23 | a | 22 | 0 | 1 | 23 | 23 | +| test.cpp:144:23:144:24 | a+ | 22 | 0 | 2 | 23 | 24 | +| test.cpp:144:23:144:25 | a+b | 22 | 0 | 3 | 23 | 25 | +| test.cpp:144:25:144:25 | b | 22 | 2 | 3 | 25 | 25 | +| test.cpp:147:21:147:21 | a | 20 | 0 | 1 | 21 | 21 | +| test.cpp:147:21:147:22 | a+ | 20 | 0 | 2 | 21 | 22 | +| test.cpp:147:21:147:23 | a+b | 20 | 0 | 3 | 21 | 23 | +| test.cpp:147:23:147:23 | b | 20 | 2 | 3 | 23 | 23 | +| test.cpp:150:22:150:23 | \\s | 21 | 0 | 2 | 22 | 23 | +| test.cpp:150:22:150:24 | \\s+ | 21 | 0 | 3 | 22 | 24 | +| test.cpp:150:22:150:25 | \\s+$ | 21 | 0 | 4 | 22 | 25 | +| test.cpp:150:25:150:25 | $ | 21 | 3 | 4 | 25 | 25 | +| test.cpp:153:22:153:23 | \\( | 21 | 0 | 2 | 22 | 23 | +| test.cpp:153:22:153:35 | \\(([,\\w]+)+\\)$ | 21 | 0 | 14 | 22 | 35 | +| test.cpp:153:24:153:31 | ([,\\w]+) | 21 | 2 | 10 | 24 | 31 | +| test.cpp:153:24:153:32 | ([,\\w]+)+ | 21 | 2 | 11 | 24 | 32 | +| test.cpp:153:25:153:29 | [,\\w] | 21 | 3 | 8 | 25 | 29 | +| test.cpp:153:25:153:30 | [,\\w]+ | 21 | 3 | 9 | 25 | 30 | +| test.cpp:153:26:153:26 | , | 21 | 4 | 5 | 26 | 26 | +| test.cpp:153:27:153:28 | \\w | 21 | 5 | 7 | 27 | 28 | +| test.cpp:153:33:153:34 | \\) | 21 | 11 | 13 | 33 | 34 | +| test.cpp:153:35:153:35 | $ | 21 | 13 | 14 | 35 | 35 | +| test.cpp:156:22:156:22 | a | 21 | 0 | 1 | 22 | 22 | +| test.cpp:156:22:156:23 | a+ | 21 | 0 | 2 | 22 | 23 | +| test.cpp:156:22:156:24 | a+b | 21 | 0 | 3 | 22 | 24 | +| test.cpp:156:24:156:24 | b | 21 | 2 | 3 | 24 | 24 | +| test.cpp:159:23:159:23 | a | 22 | 0 | 1 | 23 | 23 | +| test.cpp:159:23:159:24 | a+ | 22 | 0 | 2 | 23 | 24 | +| test.cpp:159:23:159:25 | a+b | 22 | 0 | 3 | 23 | 25 | +| test.cpp:159:25:159:25 | b | 22 | 2 | 3 | 25 | 25 | +| test.cpp:162:27:162:27 | a | 26 | 0 | 1 | 27 | 27 | +| test.cpp:162:27:162:28 | a+ | 26 | 0 | 2 | 27 | 28 | +| test.cpp:162:27:162:29 | a+b | 26 | 0 | 3 | 27 | 29 | +| test.cpp:162:29:162:29 | b | 26 | 2 | 3 | 29 | 29 | +| test.cpp:166:22:166:23 | \\s | 21 | 0 | 2 | 22 | 23 | +| test.cpp:166:22:166:24 | \\s+ | 21 | 0 | 3 | 22 | 24 | +| test.cpp:169:22:169:22 | a | 21 | 0 | 1 | 22 | 22 | +| test.cpp:169:22:169:25 | a\\.b | 21 | 0 | 4 | 22 | 25 | +| test.cpp:169:23:169:24 | \\. | 21 | 1 | 3 | 23 | 24 | +| test.cpp:169:25:169:25 | b | 21 | 3 | 4 | 25 | 25 | diff --git a/cpp/ql/test/library-tests/regex/locations.ql b/cpp/ql/test/library-tests/regex/locations.ql new file mode 100644 index 00000000000..a338c77172b --- /dev/null +++ b/cpp/ql/test/library-tests/regex/locations.ql @@ -0,0 +1,29 @@ +/** + * Reports per-term location info for each regex term, showing the literal's + * start column, the term's value offsets, and the computed start/end columns. + * Used to verify that `hasLocationInfo` produces correct columns for plain, + * raw, and encoding-prefixed C++ string literals. + * + * Commit 8 captures pre-fix (wrong) columns for raw/prefixed literals. + * Commit 9 fixes them; plain "..." rows must remain unchanged. + */ + +import cpp +import semmle.code.cpp.regex.RegexTreeView as RE + +query predicate locations( + RE::RegExpTerm t, + int litStartCol, + int valueStart, + int valueEnd, + int termStartCol, + int termEndCol +) { + // Only report terms from the location test function (test_locations) + // to keep the output focused. + t.getRegExp().getLocation().getStartLine() >= 142 and // test_locations starts here + t.getRegExp().getLocation().hasLocationInfo(_, _, litStartCol, _, _) and + valueStart = t.getStart() and + valueEnd = t.getEnd() and + t.hasLocationInfo(_, _, termStartCol, _, termEndCol) +} diff --git a/cpp/ql/test/library-tests/regex/parse.expected b/cpp/ql/test/library-tests/regex/parse.expected index 02101deb0fb..7298205ebd6 100644 --- a/cpp/ql/test/library-tests/regex/parse.expected +++ b/cpp/ql/test/library-tests/regex/parse.expected @@ -1,524 +1,635 @@ test.cpp: -# 31| [RegExpConstant, RegExpNormalChar] abc +# 33| [RegExpConstant, RegExpNormalChar] abc -# 34| [RegExpConstant, RegExpNormalChar] a +# 36| [RegExpConstant, RegExpNormalChar] a -# 34| [RegExpStar] a* +# 36| [RegExpStar] a* #-----| 0 -> [RegExpConstant, RegExpNormalChar] a -# 34| [RegExpSequence] a*b+c?d +# 36| [RegExpSequence] a*b+c?d #-----| 0 -> [RegExpStar] a* #-----| 1 -> [RegExpPlus] b+ #-----| 2 -> [RegExpOpt] c? #-----| 3 -> [RegExpConstant, RegExpNormalChar] d -# 34| [RegExpConstant, RegExpNormalChar] b +# 36| [RegExpConstant, RegExpNormalChar] b -# 34| [RegExpPlus] b+ +# 36| [RegExpPlus] b+ #-----| 0 -> [RegExpConstant, RegExpNormalChar] b -# 34| [RegExpConstant, RegExpNormalChar] c +# 36| [RegExpConstant, RegExpNormalChar] c -# 34| [RegExpOpt] c? +# 36| [RegExpOpt] c? #-----| 0 -> [RegExpConstant, RegExpNormalChar] c -# 34| [RegExpConstant, RegExpNormalChar] d - -# 35| [RegExpConstant, RegExpNormalChar] a - -# 35| [RegExpRange] a{4,8} -#-----| 0 -> [RegExpConstant, RegExpNormalChar] a +# 36| [RegExpConstant, RegExpNormalChar] d # 37| [RegExpConstant, RegExpNormalChar] a -# 37| [InfiniteRepetitionQuantifier, RegExpRange] a{3,} +# 37| [RegExpRange] a{4,8} #-----| 0 -> [RegExpConstant, RegExpNormalChar] a -# 38| [RegExpConstant, RegExpNormalChar] a +# 39| [RegExpConstant, RegExpNormalChar] a -# 38| [RegExpRange] a{7} +# 39| [InfiniteRepetitionQuantifier, RegExpRange] a{3,} #-----| 0 -> [RegExpConstant, RegExpNormalChar] a -# 41| [RegExpConstant, RegExpNormalChar] foo +# 40| [RegExpConstant, RegExpNormalChar] a -# 41| [RegExpAlt] foo|bar +# 40| [RegExpRange] a{7} +#-----| 0 -> [RegExpConstant, RegExpNormalChar] a + +# 43| [RegExpConstant, RegExpNormalChar] foo + +# 43| [RegExpAlt] foo|bar #-----| 0 -> [RegExpConstant, RegExpNormalChar] foo #-----| 1 -> [RegExpConstant, RegExpNormalChar] bar -# 41| [RegExpConstant, RegExpNormalChar] bar +# 43| [RegExpConstant, RegExpNormalChar] bar -# 44| [RegExpCharacterClass] [abc] +# 46| [RegExpCharacterClass] [abc] #-----| 0 -> [RegExpConstant, RegExpNormalChar] a #-----| 1 -> [RegExpConstant, RegExpNormalChar] b #-----| 2 -> [RegExpConstant, RegExpNormalChar] c -# 44| [RegExpConstant, RegExpNormalChar] a +# 46| [RegExpConstant, RegExpNormalChar] a -# 44| [RegExpConstant, RegExpNormalChar] b +# 46| [RegExpConstant, RegExpNormalChar] b -# 44| [RegExpConstant, RegExpNormalChar] c +# 46| [RegExpConstant, RegExpNormalChar] c -# 45| [RegExpCharacterClass] [a-fA-F0-9_] +# 47| [RegExpCharacterClass] [a-fA-F0-9_] #-----| 0 -> [RegExpCharacterRange] a-f #-----| 1 -> [RegExpCharacterRange] A-F #-----| 2 -> [RegExpCharacterRange] 0-9 #-----| 3 -> [RegExpConstant, RegExpNormalChar] _ -# 45| [RegExpConstant, RegExpNormalChar] a +# 47| [RegExpConstant, RegExpNormalChar] a -# 45| [RegExpCharacterRange] a-f +# 47| [RegExpCharacterRange] a-f #-----| 0 -> [RegExpConstant, RegExpNormalChar] a #-----| 1 -> [RegExpConstant, RegExpNormalChar] f -# 45| [RegExpConstant, RegExpNormalChar] f +# 47| [RegExpConstant, RegExpNormalChar] f -# 45| [RegExpConstant, RegExpNormalChar] A +# 47| [RegExpConstant, RegExpNormalChar] A -# 45| [RegExpCharacterRange] A-F +# 47| [RegExpCharacterRange] A-F #-----| 0 -> [RegExpConstant, RegExpNormalChar] A #-----| 1 -> [RegExpConstant, RegExpNormalChar] F -# 45| [RegExpConstant, RegExpNormalChar] F +# 47| [RegExpConstant, RegExpNormalChar] F -# 45| [RegExpConstant, RegExpNormalChar] 0 +# 47| [RegExpConstant, RegExpNormalChar] 0 -# 45| [RegExpCharacterRange] 0-9 +# 47| [RegExpCharacterRange] 0-9 #-----| 0 -> [RegExpConstant, RegExpNormalChar] 0 #-----| 1 -> [RegExpConstant, RegExpNormalChar] 9 -# 45| [RegExpConstant, RegExpNormalChar] 9 +# 47| [RegExpConstant, RegExpNormalChar] 9 -# 45| [RegExpConstant, RegExpNormalChar] _ +# 47| [RegExpConstant, RegExpNormalChar] _ -# 47| [RegExpCaret] ^ +# 49| [RegExpCaret] ^ -# 47| [RegExpSequence] ^[+-]?\d+ +# 49| [RegExpSequence] ^[+-]?\d+ #-----| 0 -> [RegExpCaret] ^ #-----| 1 -> [RegExpOpt] [+-]? #-----| 2 -> [RegExpPlus] \d+ -# 47| [RegExpCharacterClass] [+-] +# 49| [RegExpCharacterClass] [+-] #-----| 0 -> [RegExpConstant, RegExpNormalChar] + #-----| 1 -> [RegExpConstant, RegExpNormalChar] - -# 47| [RegExpOpt] [+-]? +# 49| [RegExpOpt] [+-]? #-----| 0 -> [RegExpCharacterClass] [+-] -# 47| [RegExpConstant, RegExpNormalChar] + +# 49| [RegExpConstant, RegExpNormalChar] + -# 47| [RegExpConstant, RegExpNormalChar] - +# 49| [RegExpConstant, RegExpNormalChar] - -# 47| [RegExpCharacterClassEscape] \d +# 49| [RegExpCharacterClassEscape] \d -# 47| [RegExpPlus] \d+ +# 49| [RegExpPlus] \d+ #-----| 0 -> [RegExpCharacterClassEscape] \d -# 48| [RegExpCharacterClass] [\w] +# 50| [RegExpCharacterClass] [\w] #-----| 0 -> [RegExpCharacterClassEscape] \w -# 48| [RegExpPlus] [\w]+ +# 50| [RegExpPlus] [\w]+ #-----| 0 -> [RegExpCharacterClass] [\w] -# 48| [RegExpCharacterClassEscape] \w +# 50| [RegExpCharacterClassEscape] \w -# 49| [RegExpConstant, RegExpEscape] \[ +# 51| [RegExpConstant, RegExpEscape] \[ -# 49| [RegExpSequence] \[\][123] +# 51| [RegExpSequence] \[\][123] #-----| 0 -> [RegExpConstant, RegExpEscape] \[ #-----| 1 -> [RegExpConstant, RegExpEscape] \] #-----| 2 -> [RegExpCharacterClass] [123] -# 49| [RegExpConstant, RegExpEscape] \] +# 51| [RegExpConstant, RegExpEscape] \] -# 49| [RegExpCharacterClass] [123] +# 51| [RegExpCharacterClass] [123] #-----| 0 -> [RegExpConstant, RegExpNormalChar] 1 #-----| 1 -> [RegExpConstant, RegExpNormalChar] 2 #-----| 2 -> [RegExpConstant, RegExpNormalChar] 3 -# 49| [RegExpConstant, RegExpNormalChar] 1 +# 51| [RegExpConstant, RegExpNormalChar] 1 -# 49| [RegExpConstant, RegExpNormalChar] 2 +# 51| [RegExpConstant, RegExpNormalChar] 2 -# 49| [RegExpConstant, RegExpNormalChar] 3 +# 51| [RegExpConstant, RegExpNormalChar] 3 -# 50| [RegExpCharacterClass] [^A-Z] +# 52| [RegExpCharacterClass] [^A-Z] #-----| 0 -> [RegExpCharacterRange] A-Z -# 50| [RegExpConstant, RegExpNormalChar] A +# 52| [RegExpConstant, RegExpNormalChar] A -# 50| [RegExpCharacterRange] A-Z +# 52| [RegExpCharacterRange] A-Z #-----| 0 -> [RegExpConstant, RegExpNormalChar] A #-----| 1 -> [RegExpConstant, RegExpNormalChar] Z -# 50| [RegExpConstant, RegExpNormalChar] Z +# 52| [RegExpConstant, RegExpNormalChar] Z -# 51| [RegExpCharacterClass] []] +# 53| [RegExpCharacterClass] []] #-----| 0 -> [RegExpConstant, RegExpNormalChar] ] -# 51| [RegExpConstant, RegExpNormalChar] ] +# 53| [RegExpConstant, RegExpNormalChar] ] -# 52| [RegExpCharacterClass] [^]] +# 54| [RegExpCharacterClass] [^]] #-----| 0 -> [RegExpConstant, RegExpNormalChar] ] -# 52| [RegExpConstant, RegExpNormalChar] ] +# 54| [RegExpConstant, RegExpNormalChar] ] -# 53| [RegExpCharacterClass] [^-] +# 55| [RegExpCharacterClass] [^-] #-----| 0 -> [RegExpConstant, RegExpNormalChar] - -# 53| [RegExpConstant, RegExpNormalChar] - +# 55| [RegExpConstant, RegExpNormalChar] - -# 54| [RegExpCharacterClass] [|] +# 56| [RegExpCharacterClass] [|] #-----| 0 -> [RegExpConstant, RegExpNormalChar] | -# 54| [RegExpConstant, RegExpNormalChar] | +# 56| [RegExpConstant, RegExpNormalChar] | -# 57| [RegExpCharacterClass] [[a-f] +# 59| [RegExpCharacterClass] [[a-f] #-----| 0 -> [RegExpConstant, RegExpNormalChar] [ #-----| 1 -> [RegExpCharacterRange] a-f -# 57| [RegExpSequence] [[a-f]A-F] +# 59| [RegExpSequence] [[a-f]A-F] #-----| 0 -> [RegExpCharacterClass] [[a-f] #-----| 1 -> [RegExpConstant, RegExpNormalChar] A-F] -# 57| [RegExpConstant, RegExpNormalChar] [ +# 59| [RegExpConstant, RegExpNormalChar] [ -# 57| [RegExpConstant, RegExpNormalChar] a +# 59| [RegExpConstant, RegExpNormalChar] a -# 57| [RegExpCharacterRange] a-f +# 59| [RegExpCharacterRange] a-f #-----| 0 -> [RegExpConstant, RegExpNormalChar] a #-----| 1 -> [RegExpConstant, RegExpNormalChar] f -# 57| [RegExpConstant, RegExpNormalChar] f +# 59| [RegExpConstant, RegExpNormalChar] f -# 57| [RegExpConstant, RegExpNormalChar] A-F] +# 59| [RegExpConstant, RegExpNormalChar] A-F] -# 63| [RegExpCharacterClass] [[:alpha:]] +# 65| [RegExpCharacterClass] [[:alpha:]] #-----| 0 -> [RegExpNamedCharacterProperty] [:alpha:] -# 63| [RegExpNamedCharacterProperty] [:alpha:] +# 65| [RegExpNamedCharacterProperty] [:alpha:] -# 64| [RegExpCharacterClass] [[:digit:]] +# 66| [RegExpCharacterClass] [[:digit:]] #-----| 0 -> [RegExpNamedCharacterProperty] [:digit:] -# 64| [RegExpNamedCharacterProperty] [:digit:] +# 66| [RegExpNamedCharacterProperty] [:digit:] -# 65| [RegExpCharacterClass] [[:space:]] +# 67| [RegExpCharacterClass] [[:space:]] #-----| 0 -> [RegExpNamedCharacterProperty] [:space:] -# 65| [RegExpNamedCharacterProperty] [:space:] +# 67| [RegExpNamedCharacterProperty] [:space:] -# 66| [RegExpCharacterClass] [[:upper:]] +# 68| [RegExpCharacterClass] [[:upper:]] #-----| 0 -> [RegExpNamedCharacterProperty] [:upper:] -# 66| [RegExpNamedCharacterProperty] [:upper:] +# 68| [RegExpNamedCharacterProperty] [:upper:] -# 67| [RegExpCharacterClass] [[:lower:]] +# 69| [RegExpCharacterClass] [[:lower:]] #-----| 0 -> [RegExpNamedCharacterProperty] [:lower:] -# 67| [RegExpNamedCharacterProperty] [:lower:] +# 69| [RegExpNamedCharacterProperty] [:lower:] -# 68| [RegExpCharacterClass] [[:alnum:]] +# 70| [RegExpCharacterClass] [[:alnum:]] #-----| 0 -> [RegExpNamedCharacterProperty] [:alnum:] -# 68| [RegExpNamedCharacterProperty] [:alnum:] +# 70| [RegExpNamedCharacterProperty] [:alnum:] -# 69| [RegExpCharacterClass] [[:print:]] +# 71| [RegExpCharacterClass] [[:print:]] #-----| 0 -> [RegExpNamedCharacterProperty] [:print:] -# 69| [RegExpNamedCharacterProperty] [:print:] +# 71| [RegExpNamedCharacterProperty] [:print:] -# 70| [RegExpCharacterClass] [[:punct:]] +# 72| [RegExpCharacterClass] [[:punct:]] #-----| 0 -> [RegExpNamedCharacterProperty] [:punct:] -# 70| [RegExpNamedCharacterProperty] [:punct:] +# 72| [RegExpNamedCharacterProperty] [:punct:] -# 73| [RegExpCharacterClass] [^[:space:]] +# 75| [RegExpCharacterClass] [^[:space:]] #-----| 0 -> [RegExpNamedCharacterProperty] [:space:] -# 73| [RegExpNamedCharacterProperty] [:space:] +# 75| [RegExpNamedCharacterProperty] [:space:] -# 76| [RegExpCharacterClass] [a[:space:]] +# 78| [RegExpCharacterClass] [a[:space:]] #-----| 0 -> [RegExpConstant, RegExpNormalChar] a #-----| 1 -> [RegExpNamedCharacterProperty] [:space:] -# 76| [RegExpConstant, RegExpNormalChar] a +# 78| [RegExpConstant, RegExpNormalChar] a -# 76| [RegExpNamedCharacterProperty] [:space:] +# 78| [RegExpNamedCharacterProperty] [:space:] -# 79| [RegExpCharacterClass] [[.a.]] +# 81| [RegExpCharacterClass] [[.a.]] #-----| 0 -> [RegExpNamedCharacterProperty] [.a.] -# 79| [RegExpNamedCharacterProperty] [.a.] +# 81| [RegExpNamedCharacterProperty] [.a.] -# 82| [RegExpCharacterClass] [[=a=]] +# 84| [RegExpCharacterClass] [[=a=]] #-----| 0 -> [RegExpNamedCharacterProperty] [=a=] -# 82| [RegExpNamedCharacterProperty] [=a=] +# 84| [RegExpNamedCharacterProperty] [=a=] -# 85| [RegExpCharacterClass] [[:alpha:]0-9] +# 87| [RegExpCharacterClass] [[:alpha:]0-9] #-----| 0 -> [RegExpNamedCharacterProperty] [:alpha:] #-----| 1 -> [RegExpCharacterRange] 0-9 -# 85| [RegExpNamedCharacterProperty] [:alpha:] +# 87| [RegExpNamedCharacterProperty] [:alpha:] -# 85| [RegExpConstant, RegExpNormalChar] 0 +# 87| [RegExpConstant, RegExpNormalChar] 0 -# 85| [RegExpCharacterRange] 0-9 +# 87| [RegExpCharacterRange] 0-9 #-----| 0 -> [RegExpConstant, RegExpNormalChar] 0 #-----| 1 -> [RegExpConstant, RegExpNormalChar] 9 -# 85| [RegExpConstant, RegExpNormalChar] 9 +# 87| [RegExpConstant, RegExpNormalChar] 9 -# 88| [RegExpDot] . +# 90| [RegExpDot] . -# 88| [RegExpStar] .* +# 90| [RegExpStar] .* #-----| 0 -> [RegExpDot] . -# 89| [RegExpCharacterClassEscape] \w +# 91| [RegExpCharacterClassEscape] \w -# 89| [RegExpPlus] \w+ +# 91| [RegExpPlus] \w+ #-----| 0 -> [RegExpCharacterClassEscape] \w -# 89| [RegExpSequence] \w+\W +# 91| [RegExpSequence] \w+\W #-----| 0 -> [RegExpPlus] \w+ #-----| 1 -> [RegExpCharacterClassEscape] \W -# 89| [RegExpCharacterClassEscape] \W +# 91| [RegExpCharacterClassEscape] \W -# 90| [RegExpCharacterClassEscape] \s +# 92| [RegExpCharacterClassEscape] \s -# 90| [RegExpSequence] \s\S +# 92| [RegExpSequence] \s\S #-----| 0 -> [RegExpCharacterClassEscape] \s #-----| 1 -> [RegExpCharacterClassEscape] \S -# 90| [RegExpCharacterClassEscape] \S +# 92| [RegExpCharacterClassEscape] \S -# 91| [RegExpCharacterClassEscape] \d +# 93| [RegExpCharacterClassEscape] \d -# 91| [RegExpSequence] \d\D +# 93| [RegExpSequence] \d\D #-----| 0 -> [RegExpCharacterClassEscape] \d #-----| 1 -> [RegExpCharacterClassEscape] \D -# 91| [RegExpCharacterClassEscape] \D +# 93| [RegExpCharacterClassEscape] \D -# 93| [RegExpConstant, RegExpEscape] \n +# 95| [RegExpConstant, RegExpEscape] \n -# 93| [RegExpSequence] \n\r\t +# 95| [RegExpSequence] \n\r\t #-----| 0 -> [RegExpConstant, RegExpEscape] \n #-----| 1 -> [RegExpConstant, RegExpEscape] \r #-----| 2 -> [RegExpConstant, RegExpEscape] \t -# 93| [RegExpConstant, RegExpEscape] \r +# 95| [RegExpConstant, RegExpEscape] \r -# 93| [RegExpConstant, RegExpEscape] \t +# 95| [RegExpConstant, RegExpEscape] \t -# 97| [RegExpSpecialChar] \b +# 99| [RegExpSpecialChar] \b -# 97| [RegExpSequence] \b!a\B +# 99| [RegExpSequence] \b!a\B #-----| 0 -> [RegExpSpecialChar] \b #-----| 1 -> [RegExpConstant, RegExpNormalChar] !a #-----| 2 -> [RegExpNonWordBoundary] \B -# 97| [RegExpConstant, RegExpNormalChar] !a +# 99| [RegExpConstant, RegExpNormalChar] !a -# 97| [RegExpNonWordBoundary] \B +# 99| [RegExpNonWordBoundary] \B -# 100| [RegExpGroup] (foo) +# 102| [RegExpGroup] (foo) #-----| 0 -> [RegExpConstant, RegExpNormalChar] foo -# 100| [RegExpStar] (foo)* +# 102| [RegExpStar] (foo)* #-----| 0 -> [RegExpGroup] (foo) -# 100| [RegExpSequence] (foo)*bar +# 102| [RegExpSequence] (foo)*bar #-----| 0 -> [RegExpStar] (foo)* #-----| 1 -> [RegExpConstant, RegExpNormalChar] bar -# 100| [RegExpConstant, RegExpNormalChar] foo +# 102| [RegExpConstant, RegExpNormalChar] foo -# 100| [RegExpConstant, RegExpNormalChar] bar +# 102| [RegExpConstant, RegExpNormalChar] bar -# 101| [RegExpConstant, RegExpNormalChar] fo +# 103| [RegExpConstant, RegExpNormalChar] fo -# 101| [RegExpSequence] fo(o|b)ar +# 103| [RegExpSequence] fo(o|b)ar #-----| 0 -> [RegExpConstant, RegExpNormalChar] fo #-----| 1 -> [RegExpGroup] (o|b) #-----| 2 -> [RegExpConstant, RegExpNormalChar] ar -# 101| [RegExpGroup] (o|b) +# 103| [RegExpGroup] (o|b) #-----| 0 -> [RegExpAlt] o|b -# 101| [RegExpConstant, RegExpNormalChar] o +# 103| [RegExpConstant, RegExpNormalChar] o -# 101| [RegExpAlt] o|b +# 103| [RegExpAlt] o|b #-----| 0 -> [RegExpConstant, RegExpNormalChar] o #-----| 1 -> [RegExpConstant, RegExpNormalChar] b -# 101| [RegExpConstant, RegExpNormalChar] b +# 103| [RegExpConstant, RegExpNormalChar] b -# 101| [RegExpConstant, RegExpNormalChar] ar +# 103| [RegExpConstant, RegExpNormalChar] ar -# 102| [RegExpGroup] (a|b|cd) +# 104| [RegExpGroup] (a|b|cd) #-----| 0 -> [RegExpAlt] a|b|cd -# 102| [RegExpSequence] (a|b|cd)e +# 104| [RegExpSequence] (a|b|cd)e #-----| 0 -> [RegExpGroup] (a|b|cd) #-----| 1 -> [RegExpConstant, RegExpNormalChar] e -# 102| [RegExpConstant, RegExpNormalChar] a +# 104| [RegExpConstant, RegExpNormalChar] a -# 102| [RegExpAlt] a|b|cd +# 104| [RegExpAlt] a|b|cd #-----| 0 -> [RegExpConstant, RegExpNormalChar] a #-----| 1 -> [RegExpConstant, RegExpNormalChar] b #-----| 2 -> [RegExpConstant, RegExpNormalChar] cd -# 102| [RegExpConstant, RegExpNormalChar] b +# 104| [RegExpConstant, RegExpNormalChar] b -# 102| [RegExpConstant, RegExpNormalChar] cd +# 104| [RegExpConstant, RegExpNormalChar] cd -# 102| [RegExpConstant, RegExpNormalChar] e +# 104| [RegExpConstant, RegExpNormalChar] e -# 103| [RegExpGroup] (?::+) +# 105| [RegExpGroup] (?::+) #-----| 0 -> [RegExpPlus] :+ -# 103| [RegExpSequence] (?::+)\w +# 105| [RegExpSequence] (?::+)\w #-----| 0 -> [RegExpGroup] (?::+) #-----| 1 -> [RegExpCharacterClassEscape] \w -# 103| [RegExpConstant, RegExpNormalChar] : +# 105| [RegExpConstant, RegExpNormalChar] : -# 103| [RegExpPlus] :+ +# 105| [RegExpPlus] :+ #-----| 0 -> [RegExpConstant, RegExpNormalChar] : -# 103| [RegExpCharacterClassEscape] \w +# 105| [RegExpCharacterClassEscape] \w -# 106| [RegExpGroup] (?\w+) +# 108| [RegExpGroup] (?\w+) #-----| 0 -> [RegExpPlus] \w+ -# 106| [RegExpCharacterClassEscape] \w +# 108| [RegExpCharacterClassEscape] \w -# 106| [RegExpPlus] \w+ +# 108| [RegExpPlus] \w+ #-----| 0 -> [RegExpCharacterClassEscape] \w -# 110| [RegExpGroup] (a+) +# 112| [RegExpGroup] (a+) #-----| 0 -> [RegExpPlus] a+ -# 110| [RegExpSequence] (a+)b+\1 +# 112| [RegExpSequence] (a+)b+\1 #-----| 0 -> [RegExpGroup] (a+) #-----| 1 -> [RegExpPlus] b+ #-----| 2 -> [RegExpBackRef] \1 -# 110| [RegExpConstant, RegExpNormalChar] a +# 112| [RegExpConstant, RegExpNormalChar] a -# 110| [RegExpPlus] a+ +# 112| [RegExpPlus] a+ #-----| 0 -> [RegExpConstant, RegExpNormalChar] a -# 110| [RegExpConstant, RegExpNormalChar] b +# 112| [RegExpConstant, RegExpNormalChar] b -# 110| [RegExpPlus] b+ +# 112| [RegExpPlus] b+ #-----| 0 -> [RegExpConstant, RegExpNormalChar] b -# 110| [RegExpBackRef] \1 +# 112| [RegExpBackRef] \1 -# 111| [RegExpGroup] (?q+) +# 113| [RegExpGroup] (?q+) #-----| 0 -> [RegExpPlus] q+ -# 111| [RegExpSequence] (?q+)\s+\k+ +# 113| [RegExpSequence] (?q+)\s+\k+ #-----| 0 -> [RegExpGroup] (?q+) #-----| 1 -> [RegExpPlus] \s+ #-----| 2 -> [RegExpPlus] \k+ -# 111| [RegExpConstant, RegExpNormalChar] q +# 113| [RegExpConstant, RegExpNormalChar] q -# 111| [RegExpPlus] q+ +# 113| [RegExpPlus] q+ #-----| 0 -> [RegExpConstant, RegExpNormalChar] q -# 111| [RegExpCharacterClassEscape] \s +# 113| [RegExpCharacterClassEscape] \s -# 111| [RegExpPlus] \s+ +# 113| [RegExpPlus] \s+ #-----| 0 -> [RegExpCharacterClassEscape] \s -# 111| [RegExpBackRef] \k +# 113| [RegExpBackRef] \k -# 111| [RegExpPlus] \k+ +# 113| [RegExpPlus] \k+ #-----| 0 -> [RegExpBackRef] \k -# 114| [RegExpNamedCharacterProperty] \p{Word} +# 116| [RegExpNamedCharacterProperty] \p{Word} -# 114| [RegExpStar] \p{Word}* +# 116| [RegExpStar] \p{Word}* #-----| 0 -> [RegExpNamedCharacterProperty] \p{Word} -# 115| [RegExpNamedCharacterProperty] \P{Digit} +# 117| [RegExpNamedCharacterProperty] \P{Digit} -# 115| [RegExpPlus] \P{Digit}+ +# 117| [RegExpPlus] \P{Digit}+ #-----| 0 -> [RegExpNamedCharacterProperty] \P{Digit} -# 116| [RegExpNamedCharacterProperty] \p{^Alnum} +# 118| [RegExpNamedCharacterProperty] \p{^Alnum} -# 116| [RegExpRange] \p{^Alnum}{2,3} +# 118| [RegExpRange] \p{^Alnum}{2,3} #-----| 0 -> [RegExpNamedCharacterProperty] \p{^Alnum} -# 117| [RegExpCharacterClass] [a-f\p{Digit}] +# 119| [RegExpCharacterClass] [a-f\p{Digit}] #-----| 0 -> [RegExpCharacterRange] a-f #-----| 1 -> [RegExpNamedCharacterProperty] \p{Digit} -# 117| [RegExpPlus] [a-f\p{Digit}]+ +# 119| [RegExpPlus] [a-f\p{Digit}]+ #-----| 0 -> [RegExpCharacterClass] [a-f\p{Digit}] -# 117| [RegExpConstant, RegExpNormalChar] a +# 119| [RegExpConstant, RegExpNormalChar] a -# 117| [RegExpCharacterRange] a-f +# 119| [RegExpCharacterRange] a-f #-----| 0 -> [RegExpConstant, RegExpNormalChar] a #-----| 1 -> [RegExpConstant, RegExpNormalChar] f -# 117| [RegExpConstant, RegExpNormalChar] f +# 119| [RegExpConstant, RegExpNormalChar] f -# 117| [RegExpNamedCharacterProperty] \p{Digit} +# 119| [RegExpNamedCharacterProperty] \p{Digit} -# 120| [RegExpCharacterClass] [[:alpha:]] +# 122| [RegExpCharacterClass] [[:alpha:]] #-----| 0 -> [RegExpNamedCharacterProperty] [:alpha:] -# 120| [RegExpSequence] [[:alpha:]][[:digit:]] +# 122| [RegExpSequence] [[:alpha:]][[:digit:]] #-----| 0 -> [RegExpCharacterClass] [[:alpha:]] #-----| 1 -> [RegExpCharacterClass] [[:digit:]] -# 120| [RegExpNamedCharacterProperty] [:alpha:] +# 122| [RegExpNamedCharacterProperty] [:alpha:] -# 120| [RegExpCharacterClass] [[:digit:]] +# 122| [RegExpCharacterClass] [[:digit:]] #-----| 0 -> [RegExpNamedCharacterProperty] [:digit:] -# 120| [RegExpNamedCharacterProperty] [:digit:] +# 122| [RegExpNamedCharacterProperty] [:digit:] -# 123| [RegExpCharacterClass] [[:alpha:][:digit:]] +# 125| [RegExpCharacterClass] [[:alpha:][:digit:]] #-----| 0 -> [RegExpNamedCharacterProperty] [:alpha:] #-----| 1 -> [RegExpNamedCharacterProperty] [:digit:] -# 123| [RegExpNamedCharacterProperty] [:alpha:] +# 125| [RegExpNamedCharacterProperty] [:alpha:] -# 123| [RegExpNamedCharacterProperty] [:digit:] +# 125| [RegExpNamedCharacterProperty] [:digit:] -# 126| [RegExpCharacterClass] [A-F[:digit:]a-f] +# 128| [RegExpCharacterClass] [A-F[:digit:]a-f] #-----| 0 -> [RegExpCharacterRange] A-F #-----| 1 -> [RegExpNamedCharacterProperty] [:digit:] #-----| 2 -> [RegExpCharacterRange] a-f -# 126| [RegExpConstant, RegExpNormalChar] A +# 128| [RegExpConstant, RegExpNormalChar] A -# 126| [RegExpCharacterRange] A-F +# 128| [RegExpCharacterRange] A-F #-----| 0 -> [RegExpConstant, RegExpNormalChar] A #-----| 1 -> [RegExpConstant, RegExpNormalChar] F -# 126| [RegExpConstant, RegExpNormalChar] F +# 128| [RegExpConstant, RegExpNormalChar] F -# 126| [RegExpNamedCharacterProperty] [:digit:] +# 128| [RegExpNamedCharacterProperty] [:digit:] -# 126| [RegExpConstant, RegExpNormalChar] a +# 128| [RegExpConstant, RegExpNormalChar] a -# 126| [RegExpCharacterRange] a-f +# 128| [RegExpCharacterRange] a-f #-----| 0 -> [RegExpConstant, RegExpNormalChar] a #-----| 1 -> [RegExpConstant, RegExpNormalChar] f -# 126| [RegExpConstant, RegExpNormalChar] f +# 128| [RegExpConstant, RegExpNormalChar] f -# 129| [RegExpNamedCharacterProperty] [:digit:] +# 131| [RegExpNamedCharacterProperty] [:digit:] -# 134| [RegExpConstant, RegExpEscape] \u{987 +# 136| [RegExpConstant, RegExpEscape] \u{987 + +# 144| [RegExpConstant, RegExpNormalChar] a + +# 144| [RegExpPlus] a+ +#-----| 0 -> [RegExpConstant, RegExpNormalChar] a + +# 144| [RegExpSequence] a+b +#-----| 0 -> [RegExpPlus] a+ +#-----| 1 -> [RegExpConstant, RegExpNormalChar] b + +# 144| [RegExpConstant, RegExpNormalChar] b + +# 147| [RegExpConstant, RegExpNormalChar] a + +# 147| [RegExpPlus] a+ +#-----| 0 -> [RegExpConstant, RegExpNormalChar] a + +# 147| [RegExpSequence] a+b +#-----| 0 -> [RegExpPlus] a+ +#-----| 1 -> [RegExpConstant, RegExpNormalChar] b + +# 147| [RegExpConstant, RegExpNormalChar] b + +# 150| [RegExpCharacterClassEscape] \s + +# 150| [RegExpPlus] \s+ +#-----| 0 -> [RegExpCharacterClassEscape] \s + +# 150| [RegExpSequence] \s+$ +#-----| 0 -> [RegExpPlus] \s+ +#-----| 1 -> [RegExpDollar] $ + +# 150| [RegExpDollar] $ + +# 153| [RegExpConstant, RegExpEscape] \( + +# 153| [RegExpSequence] \(([,\w]+)+\)$ +#-----| 0 -> [RegExpConstant, RegExpEscape] \( +#-----| 1 -> [RegExpPlus] ([,\w]+)+ +#-----| 2 -> [RegExpConstant, RegExpEscape] \) +#-----| 3 -> [RegExpDollar] $ + +# 153| [RegExpGroup] ([,\w]+) +#-----| 0 -> [RegExpPlus] [,\w]+ + +# 153| [RegExpPlus] ([,\w]+)+ +#-----| 0 -> [RegExpGroup] ([,\w]+) + +# 153| [RegExpCharacterClass] [,\w] +#-----| 0 -> [RegExpConstant, RegExpNormalChar] , +#-----| 1 -> [RegExpCharacterClassEscape] \w + +# 153| [RegExpPlus] [,\w]+ +#-----| 0 -> [RegExpCharacterClass] [,\w] + +# 153| [RegExpConstant, RegExpNormalChar] , + +# 153| [RegExpCharacterClassEscape] \w + +# 153| [RegExpConstant, RegExpEscape] \) + +# 153| [RegExpDollar] $ + +# 156| [RegExpConstant, RegExpNormalChar] a + +# 156| [RegExpPlus] a+ +#-----| 0 -> [RegExpConstant, RegExpNormalChar] a + +# 156| [RegExpSequence] a+b +#-----| 0 -> [RegExpPlus] a+ +#-----| 1 -> [RegExpConstant, RegExpNormalChar] b + +# 156| [RegExpConstant, RegExpNormalChar] b + +# 159| [RegExpConstant, RegExpNormalChar] a + +# 159| [RegExpPlus] a+ +#-----| 0 -> [RegExpConstant, RegExpNormalChar] a + +# 159| [RegExpSequence] a+b +#-----| 0 -> [RegExpPlus] a+ +#-----| 1 -> [RegExpConstant, RegExpNormalChar] b + +# 159| [RegExpConstant, RegExpNormalChar] b + +# 162| [RegExpConstant, RegExpNormalChar] a + +# 162| [RegExpPlus] a+ +#-----| 0 -> [RegExpConstant, RegExpNormalChar] a + +# 162| [RegExpSequence] a+b +#-----| 0 -> [RegExpPlus] a+ +#-----| 1 -> [RegExpConstant, RegExpNormalChar] b + +# 162| [RegExpConstant, RegExpNormalChar] b + +# 166| [RegExpCharacterClassEscape] \s + +# 166| [RegExpPlus] \s+ +#-----| 0 -> [RegExpCharacterClassEscape] \s + +# 169| [RegExpConstant, RegExpNormalChar] a + +# 169| [RegExpSequence] a\.b +#-----| 0 -> [RegExpConstant, RegExpNormalChar] a +#-----| 1 -> [RegExpConstant, RegExpEscape] \. +#-----| 2 -> [RegExpConstant, RegExpNormalChar] b + +# 169| [RegExpConstant, RegExpEscape] \. + +# 169| [RegExpConstant, RegExpNormalChar] b diff --git a/cpp/ql/test/library-tests/regex/regexp.expected b/cpp/ql/test/library-tests/regex/regexp.expected index 092c5fbb446..d5e9979aed4 100644 --- a/cpp/ql/test/library-tests/regex/regexp.expected +++ b/cpp/ql/test/library-tests/regex/regexp.expected @@ -1,280 +1,340 @@ groupName -| test.cpp:106:21:106:30 | (?\\w+) | id | -| test.cpp:111:23:111:32 | (?q+) | qux | +| test.cpp:108:21:108:30 | (?\\w+) | id | +| test.cpp:113:23:113:32 | (?q+) | qux | groupNumber -| test.cpp:100:22:100:26 | (foo) | 1 | -| test.cpp:101:24:101:28 | (o\|b) | 1 | -| test.cpp:102:22:102:29 | (a\|b\|cd) | 1 | -| test.cpp:106:21:106:30 | (?\\w+) | 1 | -| test.cpp:110:23:110:26 | (a+) | 1 | -| test.cpp:111:23:111:32 | (?q+) | 1 | +| test.cpp:102:22:102:26 | (foo) | 1 | +| test.cpp:103:24:103:28 | (o\|b) | 1 | +| test.cpp:104:22:104:29 | (a\|b\|cd) | 1 | +| test.cpp:108:21:108:30 | (?\\w+) | 1 | +| test.cpp:112:23:112:26 | (a+) | 1 | +| test.cpp:113:23:113:32 | (?q+) | 1 | +| test.cpp:153:24:153:31 | ([,\\w]+) | 1 | term -| test.cpp:31:21:31:23 | abc | RegExpConstant,RegExpNormalChar | -| test.cpp:34:22:34:22 | a | RegExpConstant,RegExpNormalChar | -| test.cpp:34:22:34:23 | a* | RegExpStar | -| test.cpp:34:22:34:28 | a*b+c?d | RegExpSequence | -| test.cpp:34:24:34:24 | b | RegExpConstant,RegExpNormalChar | -| test.cpp:34:24:34:25 | b+ | RegExpPlus | -| test.cpp:34:26:34:26 | c | RegExpConstant,RegExpNormalChar | -| test.cpp:34:26:34:27 | c? | RegExpOpt | -| test.cpp:34:28:34:28 | d | RegExpConstant,RegExpNormalChar | -| test.cpp:35:22:35:22 | a | RegExpConstant,RegExpNormalChar | -| test.cpp:35:22:35:27 | a{4,8} | RegExpRange | +| test.cpp:33:21:33:23 | abc | RegExpConstant,RegExpNormalChar | +| test.cpp:36:22:36:22 | a | RegExpConstant,RegExpNormalChar | +| test.cpp:36:22:36:23 | a* | RegExpStar | +| test.cpp:36:22:36:28 | a*b+c?d | RegExpSequence | +| test.cpp:36:24:36:24 | b | RegExpConstant,RegExpNormalChar | +| test.cpp:36:24:36:25 | b+ | RegExpPlus | +| test.cpp:36:26:36:26 | c | RegExpConstant,RegExpNormalChar | +| test.cpp:36:26:36:27 | c? | RegExpOpt | +| test.cpp:36:28:36:28 | d | RegExpConstant,RegExpNormalChar | | test.cpp:37:22:37:22 | a | RegExpConstant,RegExpNormalChar | -| test.cpp:37:22:37:26 | a{3,} | InfiniteRepetitionQuantifier,RegExpRange | -| test.cpp:38:22:38:22 | a | RegExpConstant,RegExpNormalChar | -| test.cpp:38:22:38:25 | a{7} | RegExpRange | -| test.cpp:41:21:41:23 | foo | RegExpConstant,RegExpNormalChar | -| test.cpp:41:21:41:27 | foo\|bar | RegExpAlt | -| test.cpp:41:25:41:27 | bar | RegExpConstant,RegExpNormalChar | -| test.cpp:44:21:44:25 | [abc] | RegExpCharacterClass | -| test.cpp:44:22:44:22 | a | RegExpConstant,RegExpNormalChar | -| test.cpp:44:23:44:23 | b | RegExpConstant,RegExpNormalChar | -| test.cpp:44:24:44:24 | c | RegExpConstant,RegExpNormalChar | -| test.cpp:45:21:45:32 | [a-fA-F0-9_] | RegExpCharacterClass | -| test.cpp:45:22:45:22 | a | RegExpConstant,RegExpNormalChar | -| test.cpp:45:22:45:24 | a-f | RegExpCharacterRange | -| test.cpp:45:24:45:24 | f | RegExpConstant,RegExpNormalChar | -| test.cpp:45:25:45:25 | A | RegExpConstant,RegExpNormalChar | -| test.cpp:45:25:45:27 | A-F | RegExpCharacterRange | -| test.cpp:45:27:45:27 | F | RegExpConstant,RegExpNormalChar | -| test.cpp:45:28:45:28 | 0 | RegExpConstant,RegExpNormalChar | -| test.cpp:45:28:45:30 | 0-9 | RegExpCharacterRange | -| test.cpp:45:30:45:30 | 9 | RegExpConstant,RegExpNormalChar | -| test.cpp:45:31:45:31 | _ | RegExpConstant,RegExpNormalChar | -| test.cpp:47:21:47:21 | ^ | RegExpCaret | -| test.cpp:47:21:47:29 | ^[+-]?\\d+ | RegExpSequence | -| test.cpp:47:22:47:25 | [+-] | RegExpCharacterClass | -| test.cpp:47:22:47:26 | [+-]? | RegExpOpt | -| test.cpp:47:23:47:23 | + | RegExpConstant,RegExpNormalChar | -| test.cpp:47:24:47:24 | - | RegExpConstant,RegExpNormalChar | -| test.cpp:47:27:47:28 | \\d | RegExpCharacterClassEscape | -| test.cpp:47:27:47:29 | \\d+ | RegExpPlus | -| test.cpp:48:21:48:24 | [\\w] | RegExpCharacterClass | -| test.cpp:48:21:48:25 | [\\w]+ | RegExpPlus | -| test.cpp:48:22:48:23 | \\w | RegExpCharacterClassEscape | -| test.cpp:49:21:49:22 | \\[ | RegExpConstant,RegExpEscape | -| test.cpp:49:21:49:29 | \\[\\][123] | RegExpSequence | -| test.cpp:49:23:49:24 | \\] | RegExpConstant,RegExpEscape | -| test.cpp:49:25:49:29 | [123] | RegExpCharacterClass | -| test.cpp:49:26:49:26 | 1 | RegExpConstant,RegExpNormalChar | -| test.cpp:49:27:49:27 | 2 | RegExpConstant,RegExpNormalChar | -| test.cpp:49:28:49:28 | 3 | RegExpConstant,RegExpNormalChar | -| test.cpp:50:21:50:26 | [^A-Z] | RegExpCharacterClass | -| test.cpp:50:23:50:23 | A | RegExpConstant,RegExpNormalChar | -| test.cpp:50:23:50:25 | A-Z | RegExpCharacterRange | -| test.cpp:50:25:50:25 | Z | RegExpConstant,RegExpNormalChar | -| test.cpp:51:21:51:23 | []] | RegExpCharacterClass | -| test.cpp:51:22:51:22 | ] | RegExpConstant,RegExpNormalChar | -| test.cpp:52:21:52:24 | [^]] | RegExpCharacterClass | -| test.cpp:52:23:52:23 | ] | RegExpConstant,RegExpNormalChar | -| test.cpp:53:21:53:24 | [^-] | RegExpCharacterClass | -| test.cpp:53:23:53:23 | - | RegExpConstant,RegExpNormalChar | -| test.cpp:54:22:54:24 | [\|] | RegExpCharacterClass | -| test.cpp:54:23:54:23 | \| | RegExpConstant,RegExpNormalChar | -| test.cpp:57:24:57:29 | [[a-f] | RegExpCharacterClass | -| test.cpp:57:24:57:33 | [[a-f]A-F] | RegExpSequence | -| test.cpp:57:25:57:25 | [ | RegExpConstant,RegExpNormalChar | -| test.cpp:57:26:57:26 | a | RegExpConstant,RegExpNormalChar | -| test.cpp:57:26:57:28 | a-f | RegExpCharacterRange | -| test.cpp:57:28:57:28 | f | RegExpConstant,RegExpNormalChar | -| test.cpp:57:30:57:33 | A-F] | RegExpConstant,RegExpNormalChar | -| test.cpp:63:29:63:39 | [[:alpha:]] | RegExpCharacterClass | -| test.cpp:63:30:63:38 | [:alpha:] | RegExpNamedCharacterProperty | -| test.cpp:64:29:64:39 | [[:digit:]] | RegExpCharacterClass | -| test.cpp:64:30:64:38 | [:digit:] | RegExpNamedCharacterProperty | -| test.cpp:65:29:65:39 | [[:space:]] | RegExpCharacterClass | -| test.cpp:65:30:65:38 | [:space:] | RegExpNamedCharacterProperty | -| test.cpp:66:29:66:39 | [[:upper:]] | RegExpCharacterClass | -| test.cpp:66:30:66:38 | [:upper:] | RegExpNamedCharacterProperty | -| test.cpp:67:29:67:39 | [[:lower:]] | RegExpCharacterClass | -| test.cpp:67:30:67:38 | [:lower:] | RegExpNamedCharacterProperty | -| test.cpp:68:29:68:39 | [[:alnum:]] | RegExpCharacterClass | -| test.cpp:68:30:68:38 | [:alnum:] | RegExpNamedCharacterProperty | -| test.cpp:69:29:69:39 | [[:print:]] | RegExpCharacterClass | -| test.cpp:69:30:69:38 | [:print:] | RegExpNamedCharacterProperty | -| test.cpp:70:29:70:39 | [[:punct:]] | RegExpCharacterClass | -| test.cpp:70:30:70:38 | [:punct:] | RegExpNamedCharacterProperty | -| test.cpp:73:27:73:38 | [^[:space:]] | RegExpCharacterClass | -| test.cpp:73:29:73:37 | [:space:] | RegExpNamedCharacterProperty | -| test.cpp:76:29:76:40 | [a[:space:]] | RegExpCharacterClass | -| test.cpp:76:30:76:30 | a | RegExpConstant,RegExpNormalChar | -| test.cpp:76:31:76:39 | [:space:] | RegExpNamedCharacterProperty | -| test.cpp:79:28:79:34 | [[.a.]] | RegExpCharacterClass | -| test.cpp:79:29:79:33 | [.a.] | RegExpNamedCharacterProperty | -| test.cpp:82:29:82:35 | [[=a=]] | RegExpCharacterClass | -| test.cpp:82:30:82:34 | [=a=] | RegExpNamedCharacterProperty | -| test.cpp:85:29:85:42 | [[:alpha:]0-9] | RegExpCharacterClass | -| test.cpp:85:30:85:38 | [:alpha:] | RegExpNamedCharacterProperty | -| test.cpp:85:39:85:39 | 0 | RegExpConstant,RegExpNormalChar | -| test.cpp:85:39:85:41 | 0-9 | RegExpCharacterRange | -| test.cpp:85:41:85:41 | 9 | RegExpConstant,RegExpNormalChar | -| test.cpp:88:23:88:23 | . | RegExpDot | -| test.cpp:88:23:88:24 | .* | RegExpStar | -| test.cpp:89:23:89:24 | \\w | RegExpCharacterClassEscape | -| test.cpp:89:23:89:25 | \\w+ | RegExpPlus | -| test.cpp:89:23:89:27 | \\w+\\W | RegExpSequence | -| test.cpp:89:26:89:27 | \\W | RegExpCharacterClassEscape | -| test.cpp:90:23:90:24 | \\s | RegExpCharacterClassEscape | -| test.cpp:90:23:90:26 | \\s\\S | RegExpSequence | -| test.cpp:90:25:90:26 | \\S | RegExpCharacterClassEscape | -| test.cpp:91:23:91:24 | \\d | RegExpCharacterClassEscape | -| test.cpp:91:23:91:26 | \\d\\D | RegExpSequence | -| test.cpp:91:25:91:26 | \\D | RegExpCharacterClassEscape | -| test.cpp:93:23:93:24 | \\n | RegExpConstant,RegExpEscape | -| test.cpp:93:23:93:28 | \\n\\r\\t | RegExpSequence | -| test.cpp:93:25:93:26 | \\r | RegExpConstant,RegExpEscape | -| test.cpp:93:27:93:28 | \\t | RegExpConstant,RegExpEscape | -| test.cpp:97:22:97:23 | \\b | RegExpSpecialChar | -| test.cpp:97:22:97:27 | \\b!a\\B | RegExpSequence | -| test.cpp:97:24:97:25 | !a | RegExpConstant,RegExpNormalChar | -| test.cpp:97:26:97:27 | \\B | RegExpNonWordBoundary | -| test.cpp:100:22:100:26 | (foo) | RegExpGroup | -| test.cpp:100:22:100:27 | (foo)* | RegExpStar | -| test.cpp:100:22:100:30 | (foo)*bar | RegExpSequence | -| test.cpp:100:23:100:25 | foo | RegExpConstant,RegExpNormalChar | -| test.cpp:100:28:100:30 | bar | RegExpConstant,RegExpNormalChar | -| test.cpp:101:22:101:23 | fo | RegExpConstant,RegExpNormalChar | -| test.cpp:101:22:101:30 | fo(o\|b)ar | RegExpSequence | -| test.cpp:101:24:101:28 | (o\|b) | RegExpGroup | -| test.cpp:101:25:101:25 | o | RegExpConstant,RegExpNormalChar | -| test.cpp:101:25:101:27 | o\|b | RegExpAlt | -| test.cpp:101:27:101:27 | b | RegExpConstant,RegExpNormalChar | -| test.cpp:101:29:101:30 | ar | RegExpConstant,RegExpNormalChar | -| test.cpp:102:22:102:29 | (a\|b\|cd) | RegExpGroup | -| test.cpp:102:22:102:30 | (a\|b\|cd)e | RegExpSequence | -| test.cpp:102:23:102:23 | a | RegExpConstant,RegExpNormalChar | -| test.cpp:102:23:102:28 | a\|b\|cd | RegExpAlt | -| test.cpp:102:25:102:25 | b | RegExpConstant,RegExpNormalChar | -| test.cpp:102:27:102:28 | cd | RegExpConstant,RegExpNormalChar | -| test.cpp:102:30:102:30 | e | RegExpConstant,RegExpNormalChar | -| test.cpp:103:22:103:27 | (?::+) | RegExpGroup | -| test.cpp:103:22:103:29 | (?::+)\\w | RegExpSequence | -| test.cpp:103:25:103:25 | : | RegExpConstant,RegExpNormalChar | -| test.cpp:103:25:103:26 | :+ | RegExpPlus | -| test.cpp:103:28:103:29 | \\w | RegExpCharacterClassEscape | -| test.cpp:106:21:106:30 | (?\\w+) | RegExpGroup | -| test.cpp:106:27:106:28 | \\w | RegExpCharacterClassEscape | -| test.cpp:106:27:106:29 | \\w+ | RegExpPlus | -| test.cpp:110:23:110:26 | (a+) | RegExpGroup | -| test.cpp:110:23:110:30 | (a+)b+\\1 | RegExpSequence | -| test.cpp:110:24:110:24 | a | RegExpConstant,RegExpNormalChar | -| test.cpp:110:24:110:25 | a+ | RegExpPlus | -| test.cpp:110:27:110:27 | b | RegExpConstant,RegExpNormalChar | -| test.cpp:110:27:110:28 | b+ | RegExpPlus | -| test.cpp:110:29:110:30 | \\1 | RegExpBackRef | -| test.cpp:111:23:111:32 | (?q+) | RegExpGroup | -| test.cpp:111:23:111:43 | (?q+)\\s+\\k+ | RegExpSequence | -| test.cpp:111:30:111:30 | q | RegExpConstant,RegExpNormalChar | -| test.cpp:111:30:111:31 | q+ | RegExpPlus | -| test.cpp:111:33:111:34 | \\s | RegExpCharacterClassEscape | -| test.cpp:111:33:111:35 | \\s+ | RegExpPlus | -| test.cpp:111:36:111:42 | \\k | RegExpBackRef | -| test.cpp:111:36:111:43 | \\k+ | RegExpPlus | -| test.cpp:114:23:114:30 | \\p{Word} | RegExpNamedCharacterProperty | -| test.cpp:114:23:114:31 | \\p{Word}* | RegExpStar | -| test.cpp:115:23:115:31 | \\P{Digit} | RegExpNamedCharacterProperty | -| test.cpp:115:23:115:32 | \\P{Digit}+ | RegExpPlus | -| test.cpp:116:23:116:32 | \\p{^Alnum} | RegExpNamedCharacterProperty | -| test.cpp:116:23:116:37 | \\p{^Alnum}{2,3} | RegExpRange | -| test.cpp:117:23:117:36 | [a-f\\p{Digit}] | RegExpCharacterClass | -| test.cpp:117:23:117:37 | [a-f\\p{Digit}]+ | RegExpPlus | -| test.cpp:117:24:117:24 | a | RegExpConstant,RegExpNormalChar | -| test.cpp:117:24:117:26 | a-f | RegExpCharacterRange | -| test.cpp:117:26:117:26 | f | RegExpConstant,RegExpNormalChar | -| test.cpp:117:27:117:35 | \\p{Digit} | RegExpNamedCharacterProperty | -| test.cpp:120:24:120:34 | [[:alpha:]] | RegExpCharacterClass | -| test.cpp:120:24:120:45 | [[:alpha:]][[:digit:]] | RegExpSequence | -| test.cpp:120:25:120:33 | [:alpha:] | RegExpNamedCharacterProperty | -| test.cpp:120:35:120:45 | [[:digit:]] | RegExpCharacterClass | -| test.cpp:120:36:120:44 | [:digit:] | RegExpNamedCharacterProperty | -| test.cpp:123:24:123:43 | [[:alpha:][:digit:]] | RegExpCharacterClass | -| test.cpp:123:25:123:33 | [:alpha:] | RegExpNamedCharacterProperty | -| test.cpp:123:34:123:42 | [:digit:] | RegExpNamedCharacterProperty | -| test.cpp:126:24:126:40 | [A-F[:digit:]a-f] | RegExpCharacterClass | -| test.cpp:126:25:126:25 | A | RegExpConstant,RegExpNormalChar | -| test.cpp:126:25:126:27 | A-F | RegExpCharacterRange | -| test.cpp:126:27:126:27 | F | RegExpConstant,RegExpNormalChar | -| test.cpp:126:28:126:36 | [:digit:] | RegExpNamedCharacterProperty | -| test.cpp:126:37:126:37 | a | RegExpConstant,RegExpNormalChar | -| test.cpp:126:37:126:39 | a-f | RegExpCharacterRange | -| test.cpp:126:39:126:39 | f | RegExpConstant,RegExpNormalChar | -| test.cpp:129:24:129:32 | [:digit:] | RegExpNamedCharacterProperty | -| test.cpp:134:21:134:26 | \\u{987 | RegExpConstant,RegExpEscape | +| test.cpp:37:22:37:27 | a{4,8} | RegExpRange | +| test.cpp:39:22:39:22 | a | RegExpConstant,RegExpNormalChar | +| test.cpp:39:22:39:26 | a{3,} | InfiniteRepetitionQuantifier,RegExpRange | +| test.cpp:40:22:40:22 | a | RegExpConstant,RegExpNormalChar | +| test.cpp:40:22:40:25 | a{7} | RegExpRange | +| test.cpp:43:21:43:23 | foo | RegExpConstant,RegExpNormalChar | +| test.cpp:43:21:43:27 | foo\|bar | RegExpAlt | +| test.cpp:43:25:43:27 | bar | RegExpConstant,RegExpNormalChar | +| test.cpp:46:21:46:25 | [abc] | RegExpCharacterClass | +| test.cpp:46:22:46:22 | a | RegExpConstant,RegExpNormalChar | +| test.cpp:46:23:46:23 | b | RegExpConstant,RegExpNormalChar | +| test.cpp:46:24:46:24 | c | RegExpConstant,RegExpNormalChar | +| test.cpp:47:21:47:32 | [a-fA-F0-9_] | RegExpCharacterClass | +| test.cpp:47:22:47:22 | a | RegExpConstant,RegExpNormalChar | +| test.cpp:47:22:47:24 | a-f | RegExpCharacterRange | +| test.cpp:47:24:47:24 | f | RegExpConstant,RegExpNormalChar | +| test.cpp:47:25:47:25 | A | RegExpConstant,RegExpNormalChar | +| test.cpp:47:25:47:27 | A-F | RegExpCharacterRange | +| test.cpp:47:27:47:27 | F | RegExpConstant,RegExpNormalChar | +| test.cpp:47:28:47:28 | 0 | RegExpConstant,RegExpNormalChar | +| test.cpp:47:28:47:30 | 0-9 | RegExpCharacterRange | +| test.cpp:47:30:47:30 | 9 | RegExpConstant,RegExpNormalChar | +| test.cpp:47:31:47:31 | _ | RegExpConstant,RegExpNormalChar | +| test.cpp:49:21:49:21 | ^ | RegExpCaret | +| test.cpp:49:21:49:29 | ^[+-]?\\d+ | RegExpSequence | +| test.cpp:49:22:49:25 | [+-] | RegExpCharacterClass | +| test.cpp:49:22:49:26 | [+-]? | RegExpOpt | +| test.cpp:49:23:49:23 | + | RegExpConstant,RegExpNormalChar | +| test.cpp:49:24:49:24 | - | RegExpConstant,RegExpNormalChar | +| test.cpp:49:27:49:28 | \\d | RegExpCharacterClassEscape | +| test.cpp:49:27:49:29 | \\d+ | RegExpPlus | +| test.cpp:50:21:50:24 | [\\w] | RegExpCharacterClass | +| test.cpp:50:21:50:25 | [\\w]+ | RegExpPlus | +| test.cpp:50:22:50:23 | \\w | RegExpCharacterClassEscape | +| test.cpp:51:21:51:22 | \\[ | RegExpConstant,RegExpEscape | +| test.cpp:51:21:51:29 | \\[\\][123] | RegExpSequence | +| test.cpp:51:23:51:24 | \\] | RegExpConstant,RegExpEscape | +| test.cpp:51:25:51:29 | [123] | RegExpCharacterClass | +| test.cpp:51:26:51:26 | 1 | RegExpConstant,RegExpNormalChar | +| test.cpp:51:27:51:27 | 2 | RegExpConstant,RegExpNormalChar | +| test.cpp:51:28:51:28 | 3 | RegExpConstant,RegExpNormalChar | +| test.cpp:52:21:52:26 | [^A-Z] | RegExpCharacterClass | +| test.cpp:52:23:52:23 | A | RegExpConstant,RegExpNormalChar | +| test.cpp:52:23:52:25 | A-Z | RegExpCharacterRange | +| test.cpp:52:25:52:25 | Z | RegExpConstant,RegExpNormalChar | +| test.cpp:53:21:53:23 | []] | RegExpCharacterClass | +| test.cpp:53:22:53:22 | ] | RegExpConstant,RegExpNormalChar | +| test.cpp:54:21:54:24 | [^]] | RegExpCharacterClass | +| test.cpp:54:23:54:23 | ] | RegExpConstant,RegExpNormalChar | +| test.cpp:55:21:55:24 | [^-] | RegExpCharacterClass | +| test.cpp:55:23:55:23 | - | RegExpConstant,RegExpNormalChar | +| test.cpp:56:22:56:24 | [\|] | RegExpCharacterClass | +| test.cpp:56:23:56:23 | \| | RegExpConstant,RegExpNormalChar | +| test.cpp:59:24:59:29 | [[a-f] | RegExpCharacterClass | +| test.cpp:59:24:59:33 | [[a-f]A-F] | RegExpSequence | +| test.cpp:59:25:59:25 | [ | RegExpConstant,RegExpNormalChar | +| test.cpp:59:26:59:26 | a | RegExpConstant,RegExpNormalChar | +| test.cpp:59:26:59:28 | a-f | RegExpCharacterRange | +| test.cpp:59:28:59:28 | f | RegExpConstant,RegExpNormalChar | +| test.cpp:59:30:59:33 | A-F] | RegExpConstant,RegExpNormalChar | +| test.cpp:65:29:65:39 | [[:alpha:]] | RegExpCharacterClass | +| test.cpp:65:30:65:38 | [:alpha:] | RegExpNamedCharacterProperty | +| test.cpp:66:29:66:39 | [[:digit:]] | RegExpCharacterClass | +| test.cpp:66:30:66:38 | [:digit:] | RegExpNamedCharacterProperty | +| test.cpp:67:29:67:39 | [[:space:]] | RegExpCharacterClass | +| test.cpp:67:30:67:38 | [:space:] | RegExpNamedCharacterProperty | +| test.cpp:68:29:68:39 | [[:upper:]] | RegExpCharacterClass | +| test.cpp:68:30:68:38 | [:upper:] | RegExpNamedCharacterProperty | +| test.cpp:69:29:69:39 | [[:lower:]] | RegExpCharacterClass | +| test.cpp:69:30:69:38 | [:lower:] | RegExpNamedCharacterProperty | +| test.cpp:70:29:70:39 | [[:alnum:]] | RegExpCharacterClass | +| test.cpp:70:30:70:38 | [:alnum:] | RegExpNamedCharacterProperty | +| test.cpp:71:29:71:39 | [[:print:]] | RegExpCharacterClass | +| test.cpp:71:30:71:38 | [:print:] | RegExpNamedCharacterProperty | +| test.cpp:72:29:72:39 | [[:punct:]] | RegExpCharacterClass | +| test.cpp:72:30:72:38 | [:punct:] | RegExpNamedCharacterProperty | +| test.cpp:75:27:75:38 | [^[:space:]] | RegExpCharacterClass | +| test.cpp:75:29:75:37 | [:space:] | RegExpNamedCharacterProperty | +| test.cpp:78:29:78:40 | [a[:space:]] | RegExpCharacterClass | +| test.cpp:78:30:78:30 | a | RegExpConstant,RegExpNormalChar | +| test.cpp:78:31:78:39 | [:space:] | RegExpNamedCharacterProperty | +| test.cpp:81:28:81:34 | [[.a.]] | RegExpCharacterClass | +| test.cpp:81:29:81:33 | [.a.] | RegExpNamedCharacterProperty | +| test.cpp:84:29:84:35 | [[=a=]] | RegExpCharacterClass | +| test.cpp:84:30:84:34 | [=a=] | RegExpNamedCharacterProperty | +| test.cpp:87:29:87:42 | [[:alpha:]0-9] | RegExpCharacterClass | +| test.cpp:87:30:87:38 | [:alpha:] | RegExpNamedCharacterProperty | +| test.cpp:87:39:87:39 | 0 | RegExpConstant,RegExpNormalChar | +| test.cpp:87:39:87:41 | 0-9 | RegExpCharacterRange | +| test.cpp:87:41:87:41 | 9 | RegExpConstant,RegExpNormalChar | +| test.cpp:90:23:90:23 | . | RegExpDot | +| test.cpp:90:23:90:24 | .* | RegExpStar | +| test.cpp:91:23:91:24 | \\w | RegExpCharacterClassEscape | +| test.cpp:91:23:91:25 | \\w+ | RegExpPlus | +| test.cpp:91:23:91:27 | \\w+\\W | RegExpSequence | +| test.cpp:91:26:91:27 | \\W | RegExpCharacterClassEscape | +| test.cpp:92:23:92:24 | \\s | RegExpCharacterClassEscape | +| test.cpp:92:23:92:26 | \\s\\S | RegExpSequence | +| test.cpp:92:25:92:26 | \\S | RegExpCharacterClassEscape | +| test.cpp:93:23:93:24 | \\d | RegExpCharacterClassEscape | +| test.cpp:93:23:93:26 | \\d\\D | RegExpSequence | +| test.cpp:93:25:93:26 | \\D | RegExpCharacterClassEscape | +| test.cpp:95:23:95:24 | \\n | RegExpConstant,RegExpEscape | +| test.cpp:95:23:95:28 | \\n\\r\\t | RegExpSequence | +| test.cpp:95:25:95:26 | \\r | RegExpConstant,RegExpEscape | +| test.cpp:95:27:95:28 | \\t | RegExpConstant,RegExpEscape | +| test.cpp:99:22:99:23 | \\b | RegExpSpecialChar | +| test.cpp:99:22:99:27 | \\b!a\\B | RegExpSequence | +| test.cpp:99:24:99:25 | !a | RegExpConstant,RegExpNormalChar | +| test.cpp:99:26:99:27 | \\B | RegExpNonWordBoundary | +| test.cpp:102:22:102:26 | (foo) | RegExpGroup | +| test.cpp:102:22:102:27 | (foo)* | RegExpStar | +| test.cpp:102:22:102:30 | (foo)*bar | RegExpSequence | +| test.cpp:102:23:102:25 | foo | RegExpConstant,RegExpNormalChar | +| test.cpp:102:28:102:30 | bar | RegExpConstant,RegExpNormalChar | +| test.cpp:103:22:103:23 | fo | RegExpConstant,RegExpNormalChar | +| test.cpp:103:22:103:30 | fo(o\|b)ar | RegExpSequence | +| test.cpp:103:24:103:28 | (o\|b) | RegExpGroup | +| test.cpp:103:25:103:25 | o | RegExpConstant,RegExpNormalChar | +| test.cpp:103:25:103:27 | o\|b | RegExpAlt | +| test.cpp:103:27:103:27 | b | RegExpConstant,RegExpNormalChar | +| test.cpp:103:29:103:30 | ar | RegExpConstant,RegExpNormalChar | +| test.cpp:104:22:104:29 | (a\|b\|cd) | RegExpGroup | +| test.cpp:104:22:104:30 | (a\|b\|cd)e | RegExpSequence | +| test.cpp:104:23:104:23 | a | RegExpConstant,RegExpNormalChar | +| test.cpp:104:23:104:28 | a\|b\|cd | RegExpAlt | +| test.cpp:104:25:104:25 | b | RegExpConstant,RegExpNormalChar | +| test.cpp:104:27:104:28 | cd | RegExpConstant,RegExpNormalChar | +| test.cpp:104:30:104:30 | e | RegExpConstant,RegExpNormalChar | +| test.cpp:105:22:105:27 | (?::+) | RegExpGroup | +| test.cpp:105:22:105:29 | (?::+)\\w | RegExpSequence | +| test.cpp:105:25:105:25 | : | RegExpConstant,RegExpNormalChar | +| test.cpp:105:25:105:26 | :+ | RegExpPlus | +| test.cpp:105:28:105:29 | \\w | RegExpCharacterClassEscape | +| test.cpp:108:21:108:30 | (?\\w+) | RegExpGroup | +| test.cpp:108:27:108:28 | \\w | RegExpCharacterClassEscape | +| test.cpp:108:27:108:29 | \\w+ | RegExpPlus | +| test.cpp:112:23:112:26 | (a+) | RegExpGroup | +| test.cpp:112:23:112:30 | (a+)b+\\1 | RegExpSequence | +| test.cpp:112:24:112:24 | a | RegExpConstant,RegExpNormalChar | +| test.cpp:112:24:112:25 | a+ | RegExpPlus | +| test.cpp:112:27:112:27 | b | RegExpConstant,RegExpNormalChar | +| test.cpp:112:27:112:28 | b+ | RegExpPlus | +| test.cpp:112:29:112:30 | \\1 | RegExpBackRef | +| test.cpp:113:23:113:32 | (?q+) | RegExpGroup | +| test.cpp:113:23:113:43 | (?q+)\\s+\\k+ | RegExpSequence | +| test.cpp:113:30:113:30 | q | RegExpConstant,RegExpNormalChar | +| test.cpp:113:30:113:31 | q+ | RegExpPlus | +| test.cpp:113:33:113:34 | \\s | RegExpCharacterClassEscape | +| test.cpp:113:33:113:35 | \\s+ | RegExpPlus | +| test.cpp:113:36:113:42 | \\k | RegExpBackRef | +| test.cpp:113:36:113:43 | \\k+ | RegExpPlus | +| test.cpp:116:23:116:30 | \\p{Word} | RegExpNamedCharacterProperty | +| test.cpp:116:23:116:31 | \\p{Word}* | RegExpStar | +| test.cpp:117:23:117:31 | \\P{Digit} | RegExpNamedCharacterProperty | +| test.cpp:117:23:117:32 | \\P{Digit}+ | RegExpPlus | +| test.cpp:118:23:118:32 | \\p{^Alnum} | RegExpNamedCharacterProperty | +| test.cpp:118:23:118:37 | \\p{^Alnum}{2,3} | RegExpRange | +| test.cpp:119:23:119:36 | [a-f\\p{Digit}] | RegExpCharacterClass | +| test.cpp:119:23:119:37 | [a-f\\p{Digit}]+ | RegExpPlus | +| test.cpp:119:24:119:24 | a | RegExpConstant,RegExpNormalChar | +| test.cpp:119:24:119:26 | a-f | RegExpCharacterRange | +| test.cpp:119:26:119:26 | f | RegExpConstant,RegExpNormalChar | +| test.cpp:119:27:119:35 | \\p{Digit} | RegExpNamedCharacterProperty | +| test.cpp:122:24:122:34 | [[:alpha:]] | RegExpCharacterClass | +| test.cpp:122:24:122:45 | [[:alpha:]][[:digit:]] | RegExpSequence | +| test.cpp:122:25:122:33 | [:alpha:] | RegExpNamedCharacterProperty | +| test.cpp:122:35:122:45 | [[:digit:]] | RegExpCharacterClass | +| test.cpp:122:36:122:44 | [:digit:] | RegExpNamedCharacterProperty | +| test.cpp:125:24:125:43 | [[:alpha:][:digit:]] | RegExpCharacterClass | +| test.cpp:125:25:125:33 | [:alpha:] | RegExpNamedCharacterProperty | +| test.cpp:125:34:125:42 | [:digit:] | RegExpNamedCharacterProperty | +| test.cpp:128:24:128:40 | [A-F[:digit:]a-f] | RegExpCharacterClass | +| test.cpp:128:25:128:25 | A | RegExpConstant,RegExpNormalChar | +| test.cpp:128:25:128:27 | A-F | RegExpCharacterRange | +| test.cpp:128:27:128:27 | F | RegExpConstant,RegExpNormalChar | +| test.cpp:128:28:128:36 | [:digit:] | RegExpNamedCharacterProperty | +| test.cpp:128:37:128:37 | a | RegExpConstant,RegExpNormalChar | +| test.cpp:128:37:128:39 | a-f | RegExpCharacterRange | +| test.cpp:128:39:128:39 | f | RegExpConstant,RegExpNormalChar | +| test.cpp:131:24:131:32 | [:digit:] | RegExpNamedCharacterProperty | +| test.cpp:136:21:136:26 | \\u{987 | RegExpConstant,RegExpEscape | +| test.cpp:144:23:144:23 | a | RegExpConstant,RegExpNormalChar | +| test.cpp:144:23:144:24 | a+ | RegExpPlus | +| test.cpp:144:23:144:25 | a+b | RegExpSequence | +| test.cpp:144:25:144:25 | b | RegExpConstant,RegExpNormalChar | +| test.cpp:147:21:147:21 | a | RegExpConstant,RegExpNormalChar | +| test.cpp:147:21:147:22 | a+ | RegExpPlus | +| test.cpp:147:21:147:23 | a+b | RegExpSequence | +| test.cpp:147:23:147:23 | b | RegExpConstant,RegExpNormalChar | +| test.cpp:150:22:150:23 | \\s | RegExpCharacterClassEscape | +| test.cpp:150:22:150:24 | \\s+ | RegExpPlus | +| test.cpp:150:22:150:25 | \\s+$ | RegExpSequence | +| test.cpp:150:25:150:25 | $ | RegExpDollar | +| test.cpp:153:22:153:23 | \\( | RegExpConstant,RegExpEscape | +| test.cpp:153:22:153:35 | \\(([,\\w]+)+\\)$ | RegExpSequence | +| test.cpp:153:24:153:31 | ([,\\w]+) | RegExpGroup | +| test.cpp:153:24:153:32 | ([,\\w]+)+ | RegExpPlus | +| test.cpp:153:25:153:29 | [,\\w] | RegExpCharacterClass | +| test.cpp:153:25:153:30 | [,\\w]+ | RegExpPlus | +| test.cpp:153:26:153:26 | , | RegExpConstant,RegExpNormalChar | +| test.cpp:153:27:153:28 | \\w | RegExpCharacterClassEscape | +| test.cpp:153:33:153:34 | \\) | RegExpConstant,RegExpEscape | +| test.cpp:153:35:153:35 | $ | RegExpDollar | +| test.cpp:156:22:156:22 | a | RegExpConstant,RegExpNormalChar | +| test.cpp:156:22:156:23 | a+ | RegExpPlus | +| test.cpp:156:22:156:24 | a+b | RegExpSequence | +| test.cpp:156:24:156:24 | b | RegExpConstant,RegExpNormalChar | +| test.cpp:159:23:159:23 | a | RegExpConstant,RegExpNormalChar | +| test.cpp:159:23:159:24 | a+ | RegExpPlus | +| test.cpp:159:23:159:25 | a+b | RegExpSequence | +| test.cpp:159:25:159:25 | b | RegExpConstant,RegExpNormalChar | +| test.cpp:162:27:162:27 | a | RegExpConstant,RegExpNormalChar | +| test.cpp:162:27:162:28 | a+ | RegExpPlus | +| test.cpp:162:27:162:29 | a+b | RegExpSequence | +| test.cpp:162:29:162:29 | b | RegExpConstant,RegExpNormalChar | +| test.cpp:166:22:166:23 | \\s | RegExpCharacterClassEscape | +| test.cpp:166:22:166:24 | \\s+ | RegExpPlus | +| test.cpp:169:22:169:22 | a | RegExpConstant,RegExpNormalChar | +| test.cpp:169:22:169:25 | a\\.b | RegExpSequence | +| test.cpp:169:23:169:24 | \\. | RegExpConstant,RegExpEscape | +| test.cpp:169:25:169:25 | b | RegExpConstant,RegExpNormalChar | regExpNormalCharValue -| test.cpp:31:21:31:23 | abc | abc | -| test.cpp:34:22:34:22 | a | a | -| test.cpp:34:24:34:24 | b | b | -| test.cpp:34:26:34:26 | c | c | -| test.cpp:34:28:34:28 | d | d | -| test.cpp:35:22:35:22 | a | a | +| test.cpp:33:21:33:23 | abc | abc | +| test.cpp:36:22:36:22 | a | a | +| test.cpp:36:24:36:24 | b | b | +| test.cpp:36:26:36:26 | c | c | +| test.cpp:36:28:36:28 | d | d | | test.cpp:37:22:37:22 | a | a | -| test.cpp:38:22:38:22 | a | a | -| test.cpp:41:21:41:23 | foo | foo | -| test.cpp:41:25:41:27 | bar | bar | -| test.cpp:44:22:44:22 | a | a | -| test.cpp:44:23:44:23 | b | b | -| test.cpp:44:24:44:24 | c | c | -| test.cpp:45:22:45:22 | a | a | -| test.cpp:45:24:45:24 | f | f | -| test.cpp:45:25:45:25 | A | A | -| test.cpp:45:27:45:27 | F | F | -| test.cpp:45:28:45:28 | 0 | 0 | -| test.cpp:45:30:45:30 | 9 | 9 | -| test.cpp:45:31:45:31 | _ | _ | -| test.cpp:47:23:47:23 | + | + | -| test.cpp:47:24:47:24 | - | - | -| test.cpp:47:27:47:28 | \\d | d | -| test.cpp:48:22:48:23 | \\w | w | -| test.cpp:49:21:49:22 | \\[ | [ | -| test.cpp:49:23:49:24 | \\] | ] | -| test.cpp:49:26:49:26 | 1 | 1 | -| test.cpp:49:27:49:27 | 2 | 2 | -| test.cpp:49:28:49:28 | 3 | 3 | -| test.cpp:50:23:50:23 | A | A | -| test.cpp:50:25:50:25 | Z | Z | -| test.cpp:51:22:51:22 | ] | ] | -| test.cpp:52:23:52:23 | ] | ] | -| test.cpp:53:23:53:23 | - | - | -| test.cpp:54:23:54:23 | \| | \| | -| test.cpp:57:25:57:25 | [ | [ | -| test.cpp:57:26:57:26 | a | a | -| test.cpp:57:28:57:28 | f | f | -| test.cpp:57:30:57:33 | A-F] | A-F] | -| test.cpp:76:30:76:30 | a | a | -| test.cpp:85:39:85:39 | 0 | 0 | -| test.cpp:85:41:85:41 | 9 | 9 | -| test.cpp:89:23:89:24 | \\w | w | -| test.cpp:89:26:89:27 | \\W | W | -| test.cpp:90:23:90:24 | \\s | s | -| test.cpp:90:25:90:26 | \\S | S | -| test.cpp:91:23:91:24 | \\d | d | -| test.cpp:91:25:91:26 | \\D | D | -| test.cpp:93:23:93:24 | \\n | \n | -| test.cpp:93:25:93:26 | \\r | \r | -| test.cpp:93:27:93:28 | \\t | \t | -| test.cpp:97:24:97:25 | !a | !a | -| test.cpp:100:23:100:25 | foo | foo | -| test.cpp:100:28:100:30 | bar | bar | -| test.cpp:101:22:101:23 | fo | fo | -| test.cpp:101:25:101:25 | o | o | -| test.cpp:101:27:101:27 | b | b | -| test.cpp:101:29:101:30 | ar | ar | -| test.cpp:102:23:102:23 | a | a | -| test.cpp:102:25:102:25 | b | b | -| test.cpp:102:27:102:28 | cd | cd | -| test.cpp:102:30:102:30 | e | e | -| test.cpp:103:25:103:25 | : | : | -| test.cpp:103:28:103:29 | \\w | w | -| test.cpp:106:27:106:28 | \\w | w | -| test.cpp:110:24:110:24 | a | a | -| test.cpp:110:27:110:27 | b | b | -| test.cpp:111:30:111:30 | q | q | -| test.cpp:111:33:111:34 | \\s | s | -| test.cpp:117:24:117:24 | a | a | -| test.cpp:117:26:117:26 | f | f | -| test.cpp:126:25:126:25 | A | A | -| test.cpp:126:27:126:27 | F | F | -| test.cpp:126:37:126:37 | a | a | -| test.cpp:126:39:126:39 | f | f | -| test.cpp:134:21:134:26 | \\u{987 | \u0987 | +| test.cpp:39:22:39:22 | a | a | +| test.cpp:40:22:40:22 | a | a | +| test.cpp:43:21:43:23 | foo | foo | +| test.cpp:43:25:43:27 | bar | bar | +| test.cpp:46:22:46:22 | a | a | +| test.cpp:46:23:46:23 | b | b | +| test.cpp:46:24:46:24 | c | c | +| test.cpp:47:22:47:22 | a | a | +| test.cpp:47:24:47:24 | f | f | +| test.cpp:47:25:47:25 | A | A | +| test.cpp:47:27:47:27 | F | F | +| test.cpp:47:28:47:28 | 0 | 0 | +| test.cpp:47:30:47:30 | 9 | 9 | +| test.cpp:47:31:47:31 | _ | _ | +| test.cpp:49:23:49:23 | + | + | +| test.cpp:49:24:49:24 | - | - | +| test.cpp:49:27:49:28 | \\d | d | +| test.cpp:50:22:50:23 | \\w | w | +| test.cpp:51:21:51:22 | \\[ | [ | +| test.cpp:51:23:51:24 | \\] | ] | +| test.cpp:51:26:51:26 | 1 | 1 | +| test.cpp:51:27:51:27 | 2 | 2 | +| test.cpp:51:28:51:28 | 3 | 3 | +| test.cpp:52:23:52:23 | A | A | +| test.cpp:52:25:52:25 | Z | Z | +| test.cpp:53:22:53:22 | ] | ] | +| test.cpp:54:23:54:23 | ] | ] | +| test.cpp:55:23:55:23 | - | - | +| test.cpp:56:23:56:23 | \| | \| | +| test.cpp:59:25:59:25 | [ | [ | +| test.cpp:59:26:59:26 | a | a | +| test.cpp:59:28:59:28 | f | f | +| test.cpp:59:30:59:33 | A-F] | A-F] | +| test.cpp:78:30:78:30 | a | a | +| test.cpp:87:39:87:39 | 0 | 0 | +| test.cpp:87:41:87:41 | 9 | 9 | +| test.cpp:91:23:91:24 | \\w | w | +| test.cpp:91:26:91:27 | \\W | W | +| test.cpp:92:23:92:24 | \\s | s | +| test.cpp:92:25:92:26 | \\S | S | +| test.cpp:93:23:93:24 | \\d | d | +| test.cpp:93:25:93:26 | \\D | D | +| test.cpp:95:23:95:24 | \\n | \n | +| test.cpp:95:25:95:26 | \\r | \r | +| test.cpp:95:27:95:28 | \\t | \t | +| test.cpp:99:24:99:25 | !a | !a | +| test.cpp:102:23:102:25 | foo | foo | +| test.cpp:102:28:102:30 | bar | bar | +| test.cpp:103:22:103:23 | fo | fo | +| test.cpp:103:25:103:25 | o | o | +| test.cpp:103:27:103:27 | b | b | +| test.cpp:103:29:103:30 | ar | ar | +| test.cpp:104:23:104:23 | a | a | +| test.cpp:104:25:104:25 | b | b | +| test.cpp:104:27:104:28 | cd | cd | +| test.cpp:104:30:104:30 | e | e | +| test.cpp:105:25:105:25 | : | : | +| test.cpp:105:28:105:29 | \\w | w | +| test.cpp:108:27:108:28 | \\w | w | +| test.cpp:112:24:112:24 | a | a | +| test.cpp:112:27:112:27 | b | b | +| test.cpp:113:30:113:30 | q | q | +| test.cpp:113:33:113:34 | \\s | s | +| test.cpp:119:24:119:24 | a | a | +| test.cpp:119:26:119:26 | f | f | +| test.cpp:128:25:128:25 | A | A | +| test.cpp:128:27:128:27 | F | F | +| test.cpp:128:37:128:37 | a | a | +| test.cpp:128:39:128:39 | f | f | +| test.cpp:136:21:136:26 | \\u{987 | \u0987 | +| test.cpp:144:23:144:23 | a | a | +| test.cpp:144:25:144:25 | b | b | +| test.cpp:147:21:147:21 | a | a | +| test.cpp:147:23:147:23 | b | b | +| test.cpp:150:22:150:23 | \\s | s | +| test.cpp:153:22:153:23 | \\( | ( | +| test.cpp:153:26:153:26 | , | , | +| test.cpp:153:27:153:28 | \\w | w | +| test.cpp:153:33:153:34 | \\) | ) | +| test.cpp:156:22:156:22 | a | a | +| test.cpp:156:24:156:24 | b | b | +| test.cpp:159:23:159:23 | a | a | +| test.cpp:159:25:159:25 | b | b | +| test.cpp:162:27:162:27 | a | a | +| test.cpp:162:29:162:29 | b | b | +| test.cpp:166:22:166:23 | \\s | s | +| test.cpp:169:22:169:22 | a | a | +| test.cpp:169:23:169:24 | \\. | . | +| test.cpp:169:25:169:25 | b | b | diff --git a/cpp/ql/test/library-tests/regex/test.cpp b/cpp/ql/test/library-tests/regex/test.cpp index 59aeaf735ed..67cb3a050c6 100644 --- a/cpp/ql/test/library-tests/regex/test.cpp +++ b/cpp/ql/test/library-tests/regex/test.cpp @@ -8,9 +8,11 @@ namespace std { public: basic_regex(const char *s) {} basic_regex(const char *s, int flags) {} + basic_regex(const wchar_t *s) {} basic_regex &assign(const char *s) { return *this; } }; typedef basic_regex regex; + typedef basic_regex wregex; template bool regex_match(const char *s, const basic_regex &re) { return false; } @@ -133,3 +135,36 @@ void test() { // unicode: \u{9879} in C++ (Ruby unicode escape syntax) std::regex r_uni("\\u{9879}"); } + +// Location tests (commit 8: pre-fix columns; commit 9: fixes raw/prefixed offsets). +// Each literal is wrapped in an appropriate std::regex use so the literal is in the DB. +// For each form, we test a simple "a+b" regex so the term locations are predictable. +void test_locations() { + // Plain "..." — content offset 1 (CORRECT in current code) + std::regex r_plain("a+b"); + + // Raw R"(...)" — content offset 3 (R"( = 3 chars); currently wrong (uses 1) + std::regex r_raw(R"(a+b)"); + + // Raw with regex metacharacters — R"(\s+$)" offset 3; currently wrong + std::regex r_raw2(R"(\s+$)"); + + // Complex raw — R"(\(([,\w]+)+\)$)" offset 3; currently wrong + std::regex r_raw3(R"(\(([,\w]+)+\)$)"); + + // Custom-delimiter raw — R"x(a+b)x" offset 4 (R"x( = 4); currently wrong + std::regex r_raw4(R"x(a+b)x"); + + // Wide-char prefix L"..." — content offset 2 (L" = 2); currently wrong + std::wregex r_wide(L"a+b"); + + // Wide raw LR"(...)" — content offset 4 (LR"( = 4); currently wrong + std::wregex r_wide_raw(LR"(a+b)"); + + // Escape-containing plain — "\\s+" value is \s+ (2 chars); offset 1 correct + // (within-content mapping is approximate for escaped strings, documented) + std::regex r_esc1("\\s+"); + + // Escape with dot — "a\\.b" value is a\.b; offset 1 correct + std::regex r_esc2("a\\.b"); +}