Absolute File Name: | /home/opencoverage/opencoverage/guest-scripts/qtdeclarative/src/qtdeclarative/src/3rdparty/masm/yarr/YarrPattern.cpp |
Switch to Source code | Preprocessed file |
Line | Source | Count | ||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
2 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
3 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
4 | using namespace WTF; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
5 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
6 | namespace JSC { namespace Yarr { | - | ||||||||||||||||||||||||||||||||||||||||||||||||
7 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
8 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
9 | class CharacterClassConstructor { | - | ||||||||||||||||||||||||||||||||||||||||||||||||
10 | public: | - | ||||||||||||||||||||||||||||||||||||||||||||||||
11 | CharacterClassConstructor(bool isCaseInsensitive = false) | - | ||||||||||||||||||||||||||||||||||||||||||||||||
12 | : m_isCaseInsensitive(isCaseInsensitive) | - | ||||||||||||||||||||||||||||||||||||||||||||||||
13 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||
14 | } executed 1149087 times by 153 tests: end of block Executed by:
| 1149087 | ||||||||||||||||||||||||||||||||||||||||||||||||
15 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
16 | void reset() | - | ||||||||||||||||||||||||||||||||||||||||||||||||
17 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||
18 | m_matches.clear(); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
19 | m_ranges.clear(); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
20 | m_matchesUnicode.clear(); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
21 | m_rangesUnicode.clear(); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
22 | } executed 72 times by 1 test: end of block Executed by:
| 72 | ||||||||||||||||||||||||||||||||||||||||||||||||
23 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
24 | void append(const CharacterClass* other) | - | ||||||||||||||||||||||||||||||||||||||||||||||||
25 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||
26 | for (size_t i = 0; i < other->m_matches.size()
| 1276-2656 | ||||||||||||||||||||||||||||||||||||||||||||||||
27 | addSorted(m_matches, other->m_matches[i]); executed 1276 times by 1 test: addSorted(m_matches, other->m_matches[i]); Executed by:
| 1276 | ||||||||||||||||||||||||||||||||||||||||||||||||
28 | for (size_t i = 0; i < other->m_ranges.size()
| 2656-5224 | ||||||||||||||||||||||||||||||||||||||||||||||||
29 | addSortedRange(m_ranges, other->m_ranges[i].begin, other->m_ranges[i].end); executed 5224 times by 1 test: addSortedRange(m_ranges, other->m_ranges[i].begin, other->m_ranges[i].end); Executed by:
| 5224 | ||||||||||||||||||||||||||||||||||||||||||||||||
30 | for (size_t i = 0; i < other->m_matchesUnicode.size()
| 2654-11330 | ||||||||||||||||||||||||||||||||||||||||||||||||
31 | addSorted(m_matchesUnicode, other->m_matchesUnicode[i]); executed 11329 times by 1 test: addSorted(m_matchesUnicode, other->m_matchesUnicode[i]); Executed by:
| 11329 | ||||||||||||||||||||||||||||||||||||||||||||||||
32 | for (size_t i = 0; i < other->m_rangesUnicode.size()
| 2656-13893 | ||||||||||||||||||||||||||||||||||||||||||||||||
33 | addSortedRange(m_rangesUnicode, other->m_rangesUnicode[i].begin, other->m_rangesUnicode[i].end); executed 13895 times by 1 test: addSortedRange(m_rangesUnicode, other->m_rangesUnicode[i].begin, other->m_rangesUnicode[i].end); Executed by:
| 13895 | ||||||||||||||||||||||||||||||||||||||||||||||||
34 | } executed 2656 times by 1 test: end of block Executed by:
| 2656 | ||||||||||||||||||||||||||||||||||||||||||||||||
35 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
36 | void putChar(UChar ch) | - | ||||||||||||||||||||||||||||||||||||||||||||||||
37 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||
38 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
39 | if (ch <= 0x7f
| 0-3618 | ||||||||||||||||||||||||||||||||||||||||||||||||
40 | if (m_isCaseInsensitive
| 4-3594 | ||||||||||||||||||||||||||||||||||||||||||||||||
41 | addSorted(m_matches, toASCIIUpper(ch)); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
42 | addSorted(m_matches, toASCIILower(ch)); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
43 | } executed 4 times by 1 test: elseend of block Executed by:
| 4 | ||||||||||||||||||||||||||||||||||||||||||||||||
44 | addSorted(m_matches, ch); executed 3614 times by 3 tests: addSorted(m_matches, ch); Executed by:
| 3614 | ||||||||||||||||||||||||||||||||||||||||||||||||
45 | return; executed 3620 times by 3 tests: return; Executed by:
| 3620 | ||||||||||||||||||||||||||||||||||||||||||||||||
46 | } | - | ||||||||||||||||||||||||||||||||||||||||||||||||
47 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
48 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
49 | if (!m_isCaseInsensitive
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
50 | addSorted(m_matchesUnicode, ch); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
51 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
52 | } | - | ||||||||||||||||||||||||||||||||||||||||||||||||
53 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
54 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
55 | UCS2CanonicalizationRange* info = rangeInfoFor(ch); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
56 | if (info->type == CanonicalizeUnique
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
57 | addSorted(m_matchesUnicode, ch); never executed: addSorted(m_matchesUnicode, ch); | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
58 | else | - | ||||||||||||||||||||||||||||||||||||||||||||||||
59 | putUnicodeIgnoreCase(ch, info); never executed: putUnicodeIgnoreCase(ch, info); | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
60 | } | - | ||||||||||||||||||||||||||||||||||||||||||||||||
61 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
62 | void putUnicodeIgnoreCase(UChar ch, UCS2CanonicalizationRange* info) | - | ||||||||||||||||||||||||||||||||||||||||||||||||
63 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||
64 | (!(m_isCaseInsensitive) ? (qmlWTFReportAssertionFailure(__FILE__, 96, __PRETTY_FUNCTION__, "m_isCaseInsensitive"), (qmlWTFReportBacktrace(), qmlWTFInvokeCrashHook(), (*(int *)(uintptr_t)0xbbadbeef = 0), __builtin_trap())) : (void)0); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
65 | (!(ch > 0x7f) ? (qmlWTFReportAssertionFailure(__FILE__, 97, __PRETTY_FUNCTION__, "ch > 0x7f"), (qmlWTFReportBacktrace(), qmlWTFInvokeCrashHook(), (*(int *)(uintptr_t)0xbbadbeef = 0), __builtin_trap())) : (void)0); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
66 | (!(ch >= info->begin && ch <= info->end) ? (qmlWTFReportAssertionFailure(__FILE__, 98, __PRETTY_FUNCTION__, "ch >= info->begin && ch <= info->end"), (qmlWTFReportBacktrace(), qmlWTFInvokeCrashHook(), (*(int *)(uintptr_t)0xbbadbeef = 0), __builtin_trap())) : (void)0); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
67 | (!(info->type != CanonicalizeUnique) ? (qmlWTFReportAssertionFailure(__FILE__, 99, __PRETTY_FUNCTION__, "info->type != CanonicalizeUnique"), (qmlWTFReportBacktrace(), qmlWTFInvokeCrashHook(), (*(int *)(uintptr_t)0xbbadbeef = 0), __builtin_trap())) : (void)0); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
68 | if (info->type == CanonicalizeSet
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
69 | for (uint16_t* set = characterSetInfo[info->value]; (
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
70 | addSorted(m_matchesUnicode, ch); never executed: addSorted(m_matchesUnicode, ch); | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
71 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
72 | addSorted(m_matchesUnicode, ch); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
73 | addSorted(m_matchesUnicode, getCanonicalPair(info, ch)); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
74 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
75 | } | - | ||||||||||||||||||||||||||||||||||||||||||||||||
76 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
77 | void putRange(UChar lo, UChar hi) | - | ||||||||||||||||||||||||||||||||||||||||||||||||
78 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||
79 | if (lo <= 0x7f
| 4-1354 | ||||||||||||||||||||||||||||||||||||||||||||||||
80 | char asciiLo = lo; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
81 | char asciiHi = std::min(hi, (UChar)0x7f); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
82 | addSortedRange(m_ranges, lo, asciiHi); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
83 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
84 | if (m_isCaseInsensitive
| 32-1324 | ||||||||||||||||||||||||||||||||||||||||||||||||
85 | if ((
| 0-24 | ||||||||||||||||||||||||||||||||||||||||||||||||
86 | addSortedRange(m_ranges, std::max(asciiLo, 'A')+('a'-'A'), std::min(asciiHi, 'Z')+('a'-'A')); never executed: addSortedRange(m_ranges, std::max(asciiLo, 'A')+('a'-'A'), std::min(asciiHi, 'Z')+('a'-'A')); | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
87 | if ((
| 0-32 | ||||||||||||||||||||||||||||||||||||||||||||||||
88 | addSortedRange(m_ranges, std::max(asciiLo, 'a')+('A'-'a'), std::min(asciiHi, 'z')+('A'-'a')); executed 24 times by 1 test: addSortedRange(m_ranges, std::max(asciiLo, 'a')+('A'-'a'), std::min(asciiHi, 'z')+('A'-'a')); Executed by:
| 24 | ||||||||||||||||||||||||||||||||||||||||||||||||
89 | } executed 32 times by 1 test: end of block Executed by:
| 32 | ||||||||||||||||||||||||||||||||||||||||||||||||
90 | } executed 1354 times by 5 tests: end of block Executed by:
| 1354 | ||||||||||||||||||||||||||||||||||||||||||||||||
91 | if (hi <= 0x7f
| 4-1356 | ||||||||||||||||||||||||||||||||||||||||||||||||
92 | return; executed 1356 times by 5 tests: return; Executed by:
| 1356 | ||||||||||||||||||||||||||||||||||||||||||||||||
93 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
94 | lo = std::max(lo, (UChar)0x80); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
95 | addSortedRange(m_rangesUnicode, lo, hi); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
96 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
97 | if (!m_isCaseInsensitive
| 0-4 | ||||||||||||||||||||||||||||||||||||||||||||||||
98 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
99 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
100 | UCS2CanonicalizationRange* info = rangeInfoFor(lo); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
101 | while (true) { | - | ||||||||||||||||||||||||||||||||||||||||||||||||
102 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
103 | UChar end = std::min<UChar>(info->end, hi); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
104 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
105 | switch (info->type) { | - | ||||||||||||||||||||||||||||||||||||||||||||||||
106 | case executed 20 times by 1 test: CanonicalizeUnique:case CanonicalizeUnique: Executed by:
executed 20 times by 1 test: case CanonicalizeUnique: Executed by:
| 20 | ||||||||||||||||||||||||||||||||||||||||||||||||
107 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
108 | break; executed 20 times by 1 test: break; Executed by:
| 20 | ||||||||||||||||||||||||||||||||||||||||||||||||
109 | case executed 4 times by 1 test: CanonicalizeSet:case CanonicalizeSet: Executed by:
executed 4 times by 1 test: {case CanonicalizeSet: Executed by:
| 4 | ||||||||||||||||||||||||||||||||||||||||||||||||
110 | UChar ch; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
111 | for (uint16_t* set = characterSetInfo[info->value]; (
| 4-12 | ||||||||||||||||||||||||||||||||||||||||||||||||
112 | addSorted(m_matchesUnicode, ch); executed 12 times by 1 test: addSorted(m_matchesUnicode, ch); Executed by:
| 12 | ||||||||||||||||||||||||||||||||||||||||||||||||
113 | break; executed 4 times by 1 test: break; Executed by:
| 4 | ||||||||||||||||||||||||||||||||||||||||||||||||
114 | } | - | ||||||||||||||||||||||||||||||||||||||||||||||||
115 | case executed 12 times by 1 test: CanonicalizeRangeLo:case CanonicalizeRangeLo: Executed by:
executed 12 times by 1 test: case CanonicalizeRangeLo: Executed by:
| 12 | ||||||||||||||||||||||||||||||||||||||||||||||||
116 | addSortedRange(m_rangesUnicode, lo + info->value, end + info->value); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
117 | break; executed 12 times by 1 test: break; Executed by:
| 12 | ||||||||||||||||||||||||||||||||||||||||||||||||
118 | case executed 8 times by 1 test: CanonicalizeRangeHi:case CanonicalizeRangeHi: Executed by:
executed 8 times by 1 test: case CanonicalizeRangeHi: Executed by:
| 8 | ||||||||||||||||||||||||||||||||||||||||||||||||
119 | addSortedRange(m_rangesUnicode, lo - info->value, end - info->value); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
120 | break; executed 8 times by 1 test: break; Executed by:
| 8 | ||||||||||||||||||||||||||||||||||||||||||||||||
121 | case never executed: CanonicalizeAlternatingAligned:case CanonicalizeAlternatingAligned: never executed: case CanonicalizeAlternatingAligned: | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
122 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
123 | if (lo & 1
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
124 | addSortedRange(m_rangesUnicode, lo - 1, lo - 1); never executed: addSortedRange(m_rangesUnicode, lo - 1, lo - 1); | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
125 | if (!(end & 1)
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
126 | addSortedRange(m_rangesUnicode, end + 1, end + 1); never executed: addSortedRange(m_rangesUnicode, end + 1, end + 1); | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
127 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
128 | case never executed: CanonicalizeAlternatingUnaligned:case CanonicalizeAlternatingUnaligned: never executed: case CanonicalizeAlternatingUnaligned: | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
129 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
130 | if (!(lo & 1)
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
131 | addSortedRange(m_rangesUnicode, lo - 1, lo - 1); never executed: addSortedRange(m_rangesUnicode, lo - 1, lo - 1); | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
132 | if (end & 1
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
133 | addSortedRange(m_rangesUnicode, end + 1, end + 1); never executed: addSortedRange(m_rangesUnicode, end + 1, end + 1); | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
134 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
135 | } | - | ||||||||||||||||||||||||||||||||||||||||||||||||
136 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
137 | if (hi == end
| 4-40 | ||||||||||||||||||||||||||||||||||||||||||||||||
138 | return; executed 4 times by 1 test: return; Executed by:
| 4 | ||||||||||||||||||||||||||||||||||||||||||||||||
139 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
140 | ++info; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
141 | lo = info->begin; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
142 | } executed 40 times by 1 test: ;end of block Executed by:
| 40 | ||||||||||||||||||||||||||||||||||||||||||||||||
143 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
144 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
145 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
146 | PassOwnPtr<CharacterClass> charClass() | - | ||||||||||||||||||||||||||||||||||||||||||||||||
147 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||
148 | OwnPtr<CharacterClass> characterClass = adoptPtr(new CharacterClass); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
149 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
150 | characterClass->m_matches.swap(m_matches); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
151 | characterClass->m_ranges.swap(m_ranges); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
152 | characterClass->m_matchesUnicode.swap(m_matchesUnicode); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
153 | characterClass->m_rangesUnicode.swap(m_rangesUnicode); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
154 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
155 | return executed 3382 times by 6 tests: characterClass.release();return characterClass.release(); Executed by:
executed 3382 times by 6 tests: return characterClass.release(); Executed by:
| 3382 | ||||||||||||||||||||||||||||||||||||||||||||||||
156 | } | - | ||||||||||||||||||||||||||||||||||||||||||||||||
157 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
158 | private: | - | ||||||||||||||||||||||||||||||||||||||||||||||||
159 | void addSorted(Vector<UChar>& matches, UChar ch) | - | ||||||||||||||||||||||||||||||||||||||||||||||||
160 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||
161 | unsigned pos = 0; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
162 | (!(matches.size() <= | - | ||||||||||||||||||||||||||||||||||||||||||||||||
163 | (0x7fffffff * 2U + 1U) | - | ||||||||||||||||||||||||||||||||||||||||||||||||
164 | ) ? (qmlWTFReportAssertionFailure(__FILE__, 194, __PRETTY_FUNCTION__, "matches.size() <= UINT_MAX"), (qmlWTFReportBacktrace(), qmlWTFInvokeCrashHook(), (*(int *)(uintptr_t)0xbbadbeef = 0), __builtin_trap())) : (void)0); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
165 | unsigned range = static_cast<unsigned>(matches.size()); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
166 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
167 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
168 | while (range
| 15994-23907 | ||||||||||||||||||||||||||||||||||||||||||||||||
169 | unsigned index = range >> 1; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
170 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
171 | int val = matches[pos+index] - ch; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
172 | if (!val
| 228-23679 | ||||||||||||||||||||||||||||||||||||||||||||||||
173 | return; executed 228 times by 1 test: return; Executed by:
| 228 | ||||||||||||||||||||||||||||||||||||||||||||||||
174 | else if (val > 0
| 2424-21254 | ||||||||||||||||||||||||||||||||||||||||||||||||
175 | range = index; executed 2424 times by 3 tests: range = index; Executed by:
| 2424 | ||||||||||||||||||||||||||||||||||||||||||||||||
176 | else { | - | ||||||||||||||||||||||||||||||||||||||||||||||||
177 | pos += (index+1); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
178 | range -= (index+1); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
179 | } executed 21257 times by 3 tests: end of block Executed by:
| 21257 | ||||||||||||||||||||||||||||||||||||||||||||||||
180 | } | - | ||||||||||||||||||||||||||||||||||||||||||||||||
181 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
182 | if (pos == matches.size()
| 1608-14383 | ||||||||||||||||||||||||||||||||||||||||||||||||
183 | matches.append(ch); executed 14382 times by 3 tests: matches.append(ch); Executed by:
| 14382 | ||||||||||||||||||||||||||||||||||||||||||||||||
184 | else | - | ||||||||||||||||||||||||||||||||||||||||||||||||
185 | matches.insert(pos, ch); executed 1608 times by 3 tests: matches.insert(pos, ch); Executed by:
| 1608 | ||||||||||||||||||||||||||||||||||||||||||||||||
186 | } | - | ||||||||||||||||||||||||||||||||||||||||||||||||
187 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
188 | void addSortedRange(Vector<CharacterRange>& ranges, UChar lo, UChar hi) | - | ||||||||||||||||||||||||||||||||||||||||||||||||
189 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||
190 | (!(ranges.size() <= | - | ||||||||||||||||||||||||||||||||||||||||||||||||
191 | (0x7fffffff * 2U + 1U) | - | ||||||||||||||||||||||||||||||||||||||||||||||||
192 | ) ? (qmlWTFReportAssertionFailure(__FILE__, 220, __PRETTY_FUNCTION__, "ranges.size() <= UINT_MAX"), (qmlWTFReportBacktrace(), qmlWTFInvokeCrashHook(), (*(int *)(uintptr_t)0xbbadbeef = 0), __builtin_trap())) : (void)0); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
193 | unsigned end = static_cast<unsigned>(ranges.size()); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
194 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
195 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
196 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
197 | for (unsigned i = 0; i < end
| 11592-59762 | ||||||||||||||||||||||||||||||||||||||||||||||||
198 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
199 | if (hi < ranges[i].begin
| 6397-53380 | ||||||||||||||||||||||||||||||||||||||||||||||||
200 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
201 | if (hi == (ranges[i].begin - 1)
| 2495-3907 | ||||||||||||||||||||||||||||||||||||||||||||||||
202 | ranges[i].begin = lo; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
203 | return; executed 2495 times by 1 test: return; Executed by:
| 2495 | ||||||||||||||||||||||||||||||||||||||||||||||||
204 | } | - | ||||||||||||||||||||||||||||||||||||||||||||||||
205 | ranges.insert(i, CharacterRange(lo, hi)); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
206 | return; executed 3907 times by 1 test: return; Executed by:
| 3907 | ||||||||||||||||||||||||||||||||||||||||||||||||
207 | } | - | ||||||||||||||||||||||||||||||||||||||||||||||||
208 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
209 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
210 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
211 | if (lo <= (ranges[i].end + 1)
| 2516-50880 | ||||||||||||||||||||||||||||||||||||||||||||||||
212 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
213 | ranges[i].begin = std::min(ranges[i].begin, lo); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
214 | ranges[i].end = std::max(ranges[i].end, hi); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
215 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
216 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
217 | unsigned next = i+1; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
218 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
219 | while (next < ranges.size()
| 0-2516 | ||||||||||||||||||||||||||||||||||||||||||||||||
220 | if (ranges[next].begin <= (ranges[i].end + 1)
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
221 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
222 | ranges[i].end = std::max(ranges[i].end, ranges[next].end); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
223 | ranges.remove(next); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
224 | } never executed: elseend of block | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
225 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
226 | } | - | ||||||||||||||||||||||||||||||||||||||||||||||||
227 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
228 | return; executed 2516 times by 3 tests: return; Executed by:
| 2516 | ||||||||||||||||||||||||||||||||||||||||||||||||
229 | } | - | ||||||||||||||||||||||||||||||||||||||||||||||||
230 | } executed 50878 times by 3 tests: end of block Executed by:
| 50878 | ||||||||||||||||||||||||||||||||||||||||||||||||
231 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
232 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
233 | ranges.append(CharacterRange(lo, hi)); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
234 | } executed 11606 times by 5 tests: end of block Executed by:
| 11606 | ||||||||||||||||||||||||||||||||||||||||||||||||
235 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
236 | bool m_isCaseInsensitive; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
237 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
238 | Vector<UChar> m_matches; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
239 | Vector<CharacterRange> m_ranges; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
240 | Vector<UChar> m_matchesUnicode; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
241 | Vector<CharacterRange> m_rangesUnicode; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
242 | }; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
243 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
244 | class YarrPatternConstructor { | - | ||||||||||||||||||||||||||||||||||||||||||||||||
245 | public: | - | ||||||||||||||||||||||||||||||||||||||||||||||||
246 | YarrPatternConstructor(YarrPattern& pattern) | - | ||||||||||||||||||||||||||||||||||||||||||||||||
247 | : m_pattern(pattern) | - | ||||||||||||||||||||||||||||||||||||||||||||||||
248 | , m_characterClassConstructor(pattern.m_ignoreCase) | - | ||||||||||||||||||||||||||||||||||||||||||||||||
249 | , m_invertParentheticalAssertion(false) | - | ||||||||||||||||||||||||||||||||||||||||||||||||
250 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||
251 | OwnPtr<PatternDisjunction> body = adoptPtr(new PatternDisjunction); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
252 | m_pattern.m_body = body.get(); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
253 | m_alternative = body->addNewAlternative(); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
254 | m_pattern.m_disjunctions.append(body.release()); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
255 | } executed 1149602 times by 153 tests: end of block Executed by:
| 1149602 | ||||||||||||||||||||||||||||||||||||||||||||||||
256 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
257 | ~YarrPatternConstructor() | - | ||||||||||||||||||||||||||||||||||||||||||||||||
258 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||
259 | } | - | ||||||||||||||||||||||||||||||||||||||||||||||||
260 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
261 | void reset() | - | ||||||||||||||||||||||||||||||||||||||||||||||||
262 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||
263 | m_pattern.reset(); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
264 | m_characterClassConstructor.reset(); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
265 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
266 | OwnPtr<PatternDisjunction> body = adoptPtr(new PatternDisjunction); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
267 | m_pattern.m_body = body.get(); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
268 | m_alternative = body->addNewAlternative(); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
269 | m_pattern.m_disjunctions.append(body.release()); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
270 | } executed 72 times by 1 test: end of block Executed by:
| 72 | ||||||||||||||||||||||||||||||||||||||||||||||||
271 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
272 | void assertionBOL() | - | ||||||||||||||||||||||||||||||||||||||||||||||||
273 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||
274 | if (!m_alternative->m_terms.size() & !m_invertParentheticalAssertion
| 32-148 | ||||||||||||||||||||||||||||||||||||||||||||||||
275 | m_alternative->m_startsWithBOL = true; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
276 | m_alternative->m_containsBOL = true; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
277 | m_pattern.m_containsBOL = true; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
278 | } executed 148 times by 5 tests: end of block Executed by:
| 148 | ||||||||||||||||||||||||||||||||||||||||||||||||
279 | m_alternative->m_terms.append(PatternTerm::BOL()); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
280 | } executed 181 times by 5 tests: end of block Executed by:
| 181 | ||||||||||||||||||||||||||||||||||||||||||||||||
281 | void assertionEOL() | - | ||||||||||||||||||||||||||||||||||||||||||||||||
282 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||
283 | m_alternative->m_terms.append(PatternTerm::EOL()); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
284 | } executed 178 times by 5 tests: end of block Executed by:
| 178 | ||||||||||||||||||||||||||||||||||||||||||||||||
285 | void assertionWordBoundary(bool invert) | - | ||||||||||||||||||||||||||||||||||||||||||||||||
286 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||
287 | m_alternative->m_terms.append(PatternTerm::WordBoundary(invert)); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
288 | } executed 1136 times by 1 test: end of block Executed by:
| 1136 | ||||||||||||||||||||||||||||||||||||||||||||||||
289 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
290 | void atomPatternCharacter(UChar ch) | - | ||||||||||||||||||||||||||||||||||||||||||||||||
291 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||
292 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
293 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
294 | if (!m_pattern.m_ignoreCase
| 0-2368942 | ||||||||||||||||||||||||||||||||||||||||||||||||
295 | m_alternative->m_terms.append(PatternTerm(ch)); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
296 | return; executed 2369244 times by 6 tests: return; Executed by:
| 2369244 | ||||||||||||||||||||||||||||||||||||||||||||||||
297 | } | - | ||||||||||||||||||||||||||||||||||||||||||||||||
298 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
299 | UCS2CanonicalizationRange* info = rangeInfoFor(ch); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
300 | if (info->type == CanonicalizeUnique
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
301 | m_alternative->m_terms.append(PatternTerm(ch)); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
302 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
303 | } | - | ||||||||||||||||||||||||||||||||||||||||||||||||
304 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
305 | m_characterClassConstructor.putUnicodeIgnoreCase(ch, info); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
306 | OwnPtr<CharacterClass> newCharacterClass = m_characterClassConstructor.charClass(); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
307 | m_alternative->m_terms.append(PatternTerm(newCharacterClass.get(), false)); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
308 | m_pattern.m_userCharacterClasses.append(newCharacterClass.release()); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
309 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
310 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
311 | void atomBuiltInCharacterClass(BuiltInCharacterClassID classID, bool invert) | - | ||||||||||||||||||||||||||||||||||||||||||||||||
312 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||
313 | switch (classID) { | - | ||||||||||||||||||||||||||||||||||||||||||||||||
314 | case executed 289 times by 3 tests: DigitClassID:case DigitClassID: Executed by:
executed 289 times by 3 tests: case DigitClassID: Executed by:
| 289 | ||||||||||||||||||||||||||||||||||||||||||||||||
315 | m_alternative->m_terms.append(PatternTerm(m_pattern.digitsCharacterClass(), invert)); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
316 | break; executed 289 times by 3 tests: break; Executed by:
| 289 | ||||||||||||||||||||||||||||||||||||||||||||||||
317 | case executed 170 times by 3 tests: SpaceClassID:case SpaceClassID: Executed by:
executed 170 times by 3 tests: case SpaceClassID: Executed by:
| 170 | ||||||||||||||||||||||||||||||||||||||||||||||||
318 | m_alternative->m_terms.append(PatternTerm(m_pattern.spacesCharacterClass(), invert)); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
319 | break; executed 170 times by 3 tests: break; Executed by:
| 170 | ||||||||||||||||||||||||||||||||||||||||||||||||
320 | case executed 124 times by 1 test: WordClassID:case WordClassID: Executed by:
executed 124 times by 1 test: case WordClassID: Executed by:
| 124 | ||||||||||||||||||||||||||||||||||||||||||||||||
321 | m_alternative->m_terms.append(PatternTerm(m_pattern.wordcharCharacterClass(), invert)); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
322 | break; executed 124 times by 1 test: break; Executed by:
| 124 | ||||||||||||||||||||||||||||||||||||||||||||||||
323 | case executed 626 times by 3 tests: NewlineClassID:case NewlineClassID: Executed by:
executed 626 times by 3 tests: case NewlineClassID: Executed by:
| 626 | ||||||||||||||||||||||||||||||||||||||||||||||||
324 | m_alternative->m_terms.append(PatternTerm(m_pattern.newlineCharacterClass(), invert)); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
325 | break; executed 626 times by 3 tests: break; Executed by:
| 626 | ||||||||||||||||||||||||||||||||||||||||||||||||
326 | } | - | ||||||||||||||||||||||||||||||||||||||||||||||||
327 | } executed 1209 times by 6 tests: end of block Executed by:
| 1209 | ||||||||||||||||||||||||||||||||||||||||||||||||
328 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
329 | void atomCharacterClassBegin(bool invert = false) | - | ||||||||||||||||||||||||||||||||||||||||||||||||
330 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||
331 | m_invertCharacterClass = invert; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
332 | } executed 3557 times by 6 tests: end of block Executed by:
| 3557 | ||||||||||||||||||||||||||||||||||||||||||||||||
333 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
334 | void atomCharacterClassAtom(UChar ch) | - | ||||||||||||||||||||||||||||||||||||||||||||||||
335 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||
336 | m_characterClassConstructor.putChar(ch); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
337 | } executed 3618 times by 3 tests: end of block Executed by:
| 3618 | ||||||||||||||||||||||||||||||||||||||||||||||||
338 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
339 | void atomCharacterClassRange(UChar begin, UChar end) | - | ||||||||||||||||||||||||||||||||||||||||||||||||
340 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||
341 | m_characterClassConstructor.putRange(begin, end); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
342 | } executed 1359 times by 5 tests: end of block Executed by:
| 1359 | ||||||||||||||||||||||||||||||||||||||||||||||||
343 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
344 | void atomCharacterClassBuiltIn(BuiltInCharacterClassID classID, bool invert) | - | ||||||||||||||||||||||||||||||||||||||||||||||||
345 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||
346 | (!(classID != NewlineClassID) ? (qmlWTFReportAssertionFailure(__FILE__, 374, __PRETTY_FUNCTION__, "classID != NewlineClassID"), (qmlWTFReportBacktrace(), qmlWTFInvokeCrashHook(), (*(int *)(uintptr_t)0xbbadbeef = 0), __builtin_trap())) : (void)0); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
347 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
348 | switch (classID) { | - | ||||||||||||||||||||||||||||||||||||||||||||||||
349 | case executed 116 times by 1 test: DigitClassID:case DigitClassID: Executed by:
executed 116 times by 1 test: case DigitClassID: Executed by:
| 116 | ||||||||||||||||||||||||||||||||||||||||||||||||
350 | m_characterClassConstructor.append(invert ? m_pattern.nondigitsCharacterClass() : m_pattern.digitsCharacterClass()); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
351 | break; executed 116 times by 1 test: break; Executed by:
| 116 | ||||||||||||||||||||||||||||||||||||||||||||||||
352 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
353 | case executed 2523 times by 1 test: SpaceClassID:case SpaceClassID: Executed by:
executed 2523 times by 1 test: case SpaceClassID: Executed by:
| 2523 | ||||||||||||||||||||||||||||||||||||||||||||||||
354 | m_characterClassConstructor.append(invert ? m_pattern.nonspacesCharacterClass() : m_pattern.spacesCharacterClass()); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
355 | break; executed 2524 times by 1 test: break; Executed by:
| 2524 | ||||||||||||||||||||||||||||||||||||||||||||||||
356 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
357 | case executed 16 times by 1 test: WordClassID:case WordClassID: Executed by:
executed 16 times by 1 test: case WordClassID: Executed by:
| 16 | ||||||||||||||||||||||||||||||||||||||||||||||||
358 | m_characterClassConstructor.append(invert ? m_pattern.nonwordcharCharacterClass() : m_pattern.wordcharCharacterClass()); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
359 | break; executed 16 times by 1 test: break; Executed by:
| 16 | ||||||||||||||||||||||||||||||||||||||||||||||||
360 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
361 | default never executed: :default: never executed: default: | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
362 | do { qmlWTFReportAssertionFailure(__FILE__, 390, __PRETTY_FUNCTION__, 0); (qmlWTFReportBacktrace(), qmlWTFInvokeCrashHook(), (*(int *)(uintptr_t)0xbbadbeef = 0), __builtin_trap()); } while (0); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
363 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
364 | } | - | ||||||||||||||||||||||||||||||||||||||||||||||||
365 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
366 | void atomCharacterClassEnd() | - | ||||||||||||||||||||||||||||||||||||||||||||||||
367 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||
368 | OwnPtr<CharacterClass> newCharacterClass = m_characterClassConstructor.charClass(); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
369 | m_alternative->m_terms.append(PatternTerm(newCharacterClass.get(), m_invertCharacterClass)); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
370 | m_pattern.m_userCharacterClasses.append(newCharacterClass.release()); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
371 | } executed 3384 times by 6 tests: end of block Executed by:
| 3384 | ||||||||||||||||||||||||||||||||||||||||||||||||
372 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
373 | void atomParenthesesSubpatternBegin(bool capture = true) | - | ||||||||||||||||||||||||||||||||||||||||||||||||
374 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||
375 | unsigned subpatternId = m_pattern.m_numSubpatterns + 1; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
376 | if (capture
| 951-2548 | ||||||||||||||||||||||||||||||||||||||||||||||||
377 | m_pattern.m_numSubpatterns++; executed 2548 times by 3 tests: m_pattern.m_numSubpatterns++; Executed by:
| 2548 | ||||||||||||||||||||||||||||||||||||||||||||||||
378 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
379 | OwnPtr<PatternDisjunction> parenthesesDisjunction = adoptPtr(new PatternDisjunction(m_alternative)); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
380 | m_alternative->m_terms.append(PatternTerm(PatternTerm::TypeParenthesesSubpattern, subpatternId, parenthesesDisjunction.get(), capture, false)); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
381 | m_alternative = parenthesesDisjunction->addNewAlternative(); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
382 | m_pattern.m_disjunctions.append(parenthesesDisjunction.release()); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
383 | } executed 3501 times by 3 tests: end of block Executed by:
| 3501 | ||||||||||||||||||||||||||||||||||||||||||||||||
384 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
385 | void atomParentheticalAssertionBegin(bool invert = false) | - | ||||||||||||||||||||||||||||||||||||||||||||||||
386 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||
387 | OwnPtr<PatternDisjunction> parenthesesDisjunction = adoptPtr(new PatternDisjunction(m_alternative)); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
388 | m_alternative->m_terms.append(PatternTerm(PatternTerm::TypeParentheticalAssertion, m_pattern.m_numSubpatterns + 1, parenthesesDisjunction.get(), false, invert)); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
389 | m_alternative = parenthesesDisjunction->addNewAlternative(); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
390 | m_invertParentheticalAssertion = invert; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
391 | m_pattern.m_disjunctions.append(parenthesesDisjunction.release()); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
392 | } executed 76 times by 1 test: end of block Executed by:
| 76 | ||||||||||||||||||||||||||||||||||||||||||||||||
393 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
394 | void atomParenthesesEnd() | - | ||||||||||||||||||||||||||||||||||||||||||||||||
395 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||
396 | (!(m_alternative->m_parent) ? (qmlWTFReportAssertionFailure(__FILE__, 424, __PRETTY_FUNCTION__, "m_alternative->m_parent"), (qmlWTFReportBacktrace(), qmlWTFInvokeCrashHook(), (*(int *)(uintptr_t)0xbbadbeef = 0), __builtin_trap())) : (void)0); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
397 | (!(m_alternative->m_parent->m_parent) ? (qmlWTFReportAssertionFailure(__FILE__, 425, __PRETTY_FUNCTION__, "m_alternative->m_parent->m_parent"), (qmlWTFReportBacktrace(), qmlWTFInvokeCrashHook(), (*(int *)(uintptr_t)0xbbadbeef = 0), __builtin_trap())) : (void)0); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
398 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
399 | PatternDisjunction* parenthesesDisjunction = m_alternative->m_parent; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
400 | m_alternative = m_alternative->m_parent->m_parent; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
401 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
402 | PatternTerm& lastTerm = m_alternative->lastTerm(); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
403 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
404 | (!(parenthesesDisjunction->m_alternatives.size() <= | - | ||||||||||||||||||||||||||||||||||||||||||||||||
405 | (0x7fffffff * 2U + 1U) | - | ||||||||||||||||||||||||||||||||||||||||||||||||
406 | ) ? (qmlWTFReportAssertionFailure(__FILE__, 432, __PRETTY_FUNCTION__, "parenthesesDisjunction->m_alternatives.size() <= UINT_MAX"), (qmlWTFReportBacktrace(), qmlWTFInvokeCrashHook(), (*(int *)(uintptr_t)0xbbadbeef = 0), __builtin_trap())) : (void)0); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
407 | unsigned numParenAlternatives = static_cast<unsigned>(parenthesesDisjunction->m_alternatives.size()); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
408 | unsigned numBOLAnchoredAlts = 0; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
409 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
410 | for (unsigned i = 0; i < numParenAlternatives
| 3576-4509 | ||||||||||||||||||||||||||||||||||||||||||||||||
411 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
412 | if (parenthesesDisjunction->m_alternatives[i]->m_startsWithBOL
| 0-4508 | ||||||||||||||||||||||||||||||||||||||||||||||||
413 | numBOLAnchoredAlts++; never executed: numBOLAnchoredAlts++; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
414 | } executed 4508 times by 3 tests: end of block Executed by:
| 4508 | ||||||||||||||||||||||||||||||||||||||||||||||||
415 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
416 | if (numBOLAnchoredAlts
| 0-3575 | ||||||||||||||||||||||||||||||||||||||||||||||||
417 | m_alternative->m_containsBOL = true; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
418 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
419 | if (numBOLAnchoredAlts == numParenAlternatives
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
420 | m_alternative->m_startsWithBOL = true; never executed: m_alternative->m_startsWithBOL = true; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
421 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
422 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
423 | lastTerm.parentheses.lastSubpatternId = m_pattern.m_numSubpatterns; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
424 | m_invertParentheticalAssertion = false; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
425 | } executed 3574 times by 3 tests: end of block Executed by:
| 3574 | ||||||||||||||||||||||||||||||||||||||||||||||||
426 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
427 | void atomBackReference(unsigned subpatternId) | - | ||||||||||||||||||||||||||||||||||||||||||||||||
428 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||
429 | (!(subpatternId) ? (qmlWTFReportAssertionFailure(__FILE__, 455, __PRETTY_FUNCTION__, "subpatternId"), (qmlWTFReportBacktrace(), qmlWTFInvokeCrashHook(), (*(int *)(uintptr_t)0xbbadbeef = 0), __builtin_trap())) : (void)0); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
430 | m_pattern.m_containsBackreferences = true; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
431 | m_pattern.m_maxBackReference = std::max(m_pattern.m_maxBackReference, subpatternId); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
432 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
433 | if (subpatternId > m_pattern.m_numSubpatterns
| 80-180 | ||||||||||||||||||||||||||||||||||||||||||||||||
434 | m_alternative->m_terms.append(PatternTerm::ForwardReference()); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
435 | return; executed 80 times by 1 test: return; Executed by:
| 80 | ||||||||||||||||||||||||||||||||||||||||||||||||
436 | } | - | ||||||||||||||||||||||||||||||||||||||||||||||||
437 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
438 | PatternAlternative* currentAlternative = m_alternative; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
439 | (!(currentAlternative) ? (qmlWTFReportAssertionFailure(__FILE__, 465, __PRETTY_FUNCTION__, "currentAlternative"), (qmlWTFReportBacktrace(), qmlWTFInvokeCrashHook(), (*(int *)(uintptr_t)0xbbadbeef = 0), __builtin_trap())) : (void)0); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
440 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
441 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
442 | while ((
| 4-180 | ||||||||||||||||||||||||||||||||||||||||||||||||
443 | PatternTerm& term = currentAlternative->lastTerm(); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
444 | (!((term.type == PatternTerm::TypeParenthesesSubpattern) || (term.type == PatternTerm::TypeParentheticalAssertion)) ? (qmlWTFReportAssertionFailure(__FILE__, 470, __PRETTY_FUNCTION__, "(term.type == PatternTerm::TypeParenthesesSubpattern) || (term.type == PatternTerm::TypeParentheticalAssertion)"), (qmlWTFReportBacktrace(), qmlWTFInvokeCrashHook(), (*(int *)(uintptr_t)0xbbadbeef = 0), __builtin_trap())) : (void)0); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
445 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
446 | if ((
| 0-4 | ||||||||||||||||||||||||||||||||||||||||||||||||
447 | m_alternative->m_terms.append(PatternTerm::ForwardReference()); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
448 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
449 | } | - | ||||||||||||||||||||||||||||||||||||||||||||||||
450 | } executed 4 times by 1 test: end of block Executed by:
| 4 | ||||||||||||||||||||||||||||||||||||||||||||||||
451 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
452 | m_alternative->m_terms.append(PatternTerm(subpatternId)); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
453 | } executed 180 times by 1 test: end of block Executed by:
| 180 | ||||||||||||||||||||||||||||||||||||||||||||||||
454 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
455 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
456 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
457 | PatternDisjunction* copyDisjunction(PatternDisjunction* disjunction, bool filterStartsWithBOL = false) | - | ||||||||||||||||||||||||||||||||||||||||||||||||
458 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||
459 | OwnPtr<PatternDisjunction> newDisjunction; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
460 | for (unsigned alt = 0; alt < disjunction->m_alternatives.size()
| 162-183 | ||||||||||||||||||||||||||||||||||||||||||||||||
461 | PatternAlternative* alternative = disjunction->m_alternatives[alt].get(); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
462 | if (!filterStartsWithBOL
| 6-131 | ||||||||||||||||||||||||||||||||||||||||||||||||
463 | if (!newDisjunction
| 12-45 | ||||||||||||||||||||||||||||||||||||||||||||||||
464 | newDisjunction = adoptPtr(new PatternDisjunction()); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
465 | newDisjunction->m_parent = disjunction->m_parent; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
466 | } executed 46 times by 2 tests: end of block Executed by:
| 46 | ||||||||||||||||||||||||||||||||||||||||||||||||
467 | PatternAlternative* newAlternative = newDisjunction->addNewAlternative(); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
468 | newAlternative->m_terms.reserveInitialCapacity(alternative->m_terms.size()); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
469 | for (unsigned i = 0; i < alternative->m_terms.size()
| 58-124 | ||||||||||||||||||||||||||||||||||||||||||||||||
470 | newAlternative->m_terms.append(copyTerm(alternative->m_terms[i], filterStartsWithBOL)); executed 124 times by 2 tests: newAlternative->m_terms.append(copyTerm(alternative->m_terms[i], filterStartsWithBOL)); Executed by:
| 124 | ||||||||||||||||||||||||||||||||||||||||||||||||
471 | } executed 58 times by 2 tests: end of block Executed by:
| 58 | ||||||||||||||||||||||||||||||||||||||||||||||||
472 | } executed 184 times by 5 tests: end of block Executed by:
| 184 | ||||||||||||||||||||||||||||||||||||||||||||||||
473 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
474 | if (!newDisjunction
| 46-115 | ||||||||||||||||||||||||||||||||||||||||||||||||
475 | return executed 115 times by 4 tests: 0;return 0; Executed by:
executed 115 times by 4 tests: return 0; Executed by:
| 115 | ||||||||||||||||||||||||||||||||||||||||||||||||
476 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
477 | PatternDisjunction* copiedDisjunction = newDisjunction.get(); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
478 | m_pattern.m_disjunctions.append(newDisjunction.release()); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
479 | return executed 46 times by 2 tests: copiedDisjunction;return copiedDisjunction; Executed by:
executed 46 times by 2 tests: return copiedDisjunction; Executed by:
| 46 | ||||||||||||||||||||||||||||||||||||||||||||||||
480 | } | - | ||||||||||||||||||||||||||||||||||||||||||||||||
481 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
482 | PatternTerm copyTerm(PatternTerm& term, bool filterStartsWithBOL = false) | - | ||||||||||||||||||||||||||||||||||||||||||||||||
483 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||
484 | if ((
| 0-1151 | ||||||||||||||||||||||||||||||||||||||||||||||||
485 | return executed 1152 times by 6 tests: PatternTerm(term);return PatternTerm(term); Executed by:
executed 1152 times by 6 tests: return PatternTerm(term); Executed by:
| 1152 | ||||||||||||||||||||||||||||||||||||||||||||||||
486 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
487 | PatternTerm termCopy = term; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
488 | termCopy.parentheses.disjunction = copyDisjunction(termCopy.parentheses.disjunction, filterStartsWithBOL); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
489 | return executed 39 times by 1 test: termCopy;return termCopy; Executed by:
executed 39 times by 1 test: return termCopy; Executed by:
| 39 | ||||||||||||||||||||||||||||||||||||||||||||||||
490 | } | - | ||||||||||||||||||||||||||||||||||||||||||||||||
491 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
492 | void quantifyAtom(unsigned min, unsigned max, bool greedy) | - | ||||||||||||||||||||||||||||||||||||||||||||||||
493 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||
494 | (!(min <= max) ? (qmlWTFReportAssertionFailure(__FILE__, 520, __PRETTY_FUNCTION__, "min <= max"), (qmlWTFReportBacktrace(), qmlWTFInvokeCrashHook(), (*(int *)(uintptr_t)0xbbadbeef = 0), __builtin_trap())) : (void)0); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
495 | (!(m_alternative->m_terms.size()) ? (qmlWTFReportAssertionFailure(__FILE__, 521, __PRETTY_FUNCTION__, "m_alternative->m_terms.size()"), (qmlWTFReportBacktrace(), qmlWTFInvokeCrashHook(), (*(int *)(uintptr_t)0xbbadbeef = 0), __builtin_trap())) : (void)0); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
496 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
497 | if (!max
| 0-4142 | ||||||||||||||||||||||||||||||||||||||||||||||||
498 | m_alternative->removeLastTerm(); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
499 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
500 | } | - | ||||||||||||||||||||||||||||||||||||||||||||||||
501 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
502 | PatternTerm& term = m_alternative->lastTerm(); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
503 | (!(term.type > PatternTerm::TypeAssertionWordBoundary) ? (qmlWTFReportAssertionFailure(__FILE__, 529, __PRETTY_FUNCTION__, "term.type > PatternTerm::TypeAssertionWordBoundary"), (qmlWTFReportBacktrace(), qmlWTFInvokeCrashHook(), (*(int *)(uintptr_t)0xbbadbeef = 0), __builtin_trap())) : (void)0); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
504 | (!((term.quantityCount == 1) && (term.quantityType == QuantifierFixedCount)) ? (qmlWTFReportAssertionFailure(__FILE__, 530, __PRETTY_FUNCTION__, "(term.quantityCount == 1) && (term.quantityType == QuantifierFixedCount)"), (qmlWTFReportBacktrace(), qmlWTFInvokeCrashHook(), (*(int *)(uintptr_t)0xbbadbeef = 0), __builtin_trap())) : (void)0); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
505 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
506 | if (term.type == PatternTerm::TypeParentheticalAssertion
| 0-4139 | ||||||||||||||||||||||||||||||||||||||||||||||||
507 | if (!min
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
508 | m_alternative->removeLastTerm(); never executed: m_alternative->removeLastTerm(); | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
509 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
510 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
511 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
512 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
513 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
514 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
515 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
516 | } | - | ||||||||||||||||||||||||||||||||||||||||||||||||
517 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
518 | if (min == 0
| 1356-2788 | ||||||||||||||||||||||||||||||||||||||||||||||||
519 | term.quantify(max, greedy ? QuantifierGreedy : QuantifierNonGreedy); executed 2788 times by 5 tests: term.quantify(max, greedy ? QuantifierGreedy : QuantifierNonGreedy); Executed by:
| 2788 | ||||||||||||||||||||||||||||||||||||||||||||||||
520 | else if (min == max
| 288-1064 | ||||||||||||||||||||||||||||||||||||||||||||||||
521 | term.quantify(min, QuantifierFixedCount); executed 288 times by 1 test: term.quantify(min, QuantifierFixedCount); Executed by:
| 288 | ||||||||||||||||||||||||||||||||||||||||||||||||
522 | else { | - | ||||||||||||||||||||||||||||||||||||||||||||||||
523 | term.quantify(min, QuantifierFixedCount); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
524 | m_alternative->m_terms.append(copyTerm(term)); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
525 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
526 | m_alternative->lastTerm().quantify((max == quantifyInfinite) ? max : max - min, greedy ? QuantifierGreedy : QuantifierNonGreedy); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
527 | if (m_alternative->lastTerm().type == PatternTerm::TypeParenthesesSubpattern
| 28-1041 | ||||||||||||||||||||||||||||||||||||||||||||||||
528 | m_alternative->lastTerm().parentheses.isCopy = true; executed 28 times by 1 test: m_alternative->lastTerm().parentheses.isCopy = true; Executed by:
| 28 | ||||||||||||||||||||||||||||||||||||||||||||||||
529 | } executed 1068 times by 6 tests: end of block Executed by:
| 1068 | ||||||||||||||||||||||||||||||||||||||||||||||||
530 | } | - | ||||||||||||||||||||||||||||||||||||||||||||||||
531 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
532 | void disjunction() | - | ||||||||||||||||||||||||||||||||||||||||||||||||
533 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||
534 | m_alternative = m_alternative->m_parent->addNewAlternative(); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
535 | } executed 1164 times by 4 tests: end of block Executed by:
| 1164 | ||||||||||||||||||||||||||||||||||||||||||||||||
536 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
537 | unsigned setupAlternativeOffsets(PatternAlternative* alternative, unsigned currentCallFrameSize, unsigned initialInputPosition) | - | ||||||||||||||||||||||||||||||||||||||||||||||||
538 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||
539 | alternative->m_hasFixedSize = true; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
540 | Checked<unsigned> currentInputPosition = initialInputPosition; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
541 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
542 | for (unsigned i = 0; i < alternative->m_terms.size()
| 1155336-2380650 | ||||||||||||||||||||||||||||||||||||||||||||||||
543 | PatternTerm& term = alternative->m_terms[i]; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
544 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
545 | switch (term.type) { | - | ||||||||||||||||||||||||||||||||||||||||||||||||
546 | case executed 178 times by 5 tests: PatternTerm::TypeAssertionBOL:case PatternTerm::TypeAssertionBOL: Executed by:
executed 178 times by 5 tests: case PatternTerm::TypeAssertionBOL: Executed by:
| 178 | ||||||||||||||||||||||||||||||||||||||||||||||||
547 | case executed 180 times by 5 tests: PatternTerm::TypeAssertionEOL:case PatternTerm::TypeAssertionEOL: Executed by:
executed 180 times by 5 tests: case PatternTerm::TypeAssertionEOL: Executed by:
| 180 | ||||||||||||||||||||||||||||||||||||||||||||||||
548 | case executed 1136 times by 1 test: PatternTerm::TypeAssertionWordBoundary:case PatternTerm::TypeAssertionWordBoundary: Executed by:
executed 1136 times by 1 test: case PatternTerm::TypeAssertionWordBoundary: Executed by:
| 1136 | ||||||||||||||||||||||||||||||||||||||||||||||||
549 | term.inputPosition = currentInputPosition.unsafeGet(); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
550 | break; executed 1494 times by 5 tests: break; Executed by:
| 1494 | ||||||||||||||||||||||||||||||||||||||||||||||||
551 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
552 | case executed 192 times by 1 test: PatternTerm::TypeBackReference:case PatternTerm::TypeBackReference: Executed by:
executed 192 times by 1 test: case PatternTerm::TypeBackReference: Executed by:
| 192 | ||||||||||||||||||||||||||||||||||||||||||||||||
553 | term.inputPosition = currentInputPosition.unsafeGet(); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
554 | term.frameLocation = currentCallFrameSize; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
555 | currentCallFrameSize += 2; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
556 | alternative->m_hasFixedSize = false; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
557 | break; executed 192 times by 1 test: break; Executed by:
| 192 | ||||||||||||||||||||||||||||||||||||||||||||||||
558 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
559 | case executed 8 times by 1 test: PatternTerm::TypeForwardReference:case PatternTerm::TypeForwardReference: Executed by:
executed 8 times by 1 test: case PatternTerm::TypeForwardReference: Executed by:
| 8 | ||||||||||||||||||||||||||||||||||||||||||||||||
560 | break; executed 8 times by 1 test: break; Executed by:
| 8 | ||||||||||||||||||||||||||||||||||||||||||||||||
561 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
562 | case executed 2370024 times by 6 tests: PatternTerm::TypePatternCharacter:case PatternTerm::TypePatternCharacter: Executed by:
executed 2370024 times by 6 tests: case PatternTerm::TypePatternCharacter: Executed by:
| 2370024 | ||||||||||||||||||||||||||||||||||||||||||||||||
563 | term.inputPosition = currentInputPosition.unsafeGet(); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
564 | if (term.quantityType != QuantifierFixedCount
| 472-2368880 | ||||||||||||||||||||||||||||||||||||||||||||||||
565 | term.frameLocation = currentCallFrameSize; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
566 | currentCallFrameSize += 1; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
567 | alternative->m_hasFixedSize = false; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
568 | } executed 472 times by 2 tests: elseend of block Executed by:
| 472 | ||||||||||||||||||||||||||||||||||||||||||||||||
569 | currentInputPosition += term.quantityCount; executed 2368661 times by 6 tests: currentInputPosition += term.quantityCount; Executed by:
| 2368661 | ||||||||||||||||||||||||||||||||||||||||||||||||
570 | break; executed 2369300 times by 6 tests: break; Executed by:
| 2369300 | ||||||||||||||||||||||||||||||||||||||||||||||||
571 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
572 | case executed 5373 times by 9 tests: PatternTerm::TypeCharacterClass:case PatternTerm::TypeCharacterClass: Executed by:
executed 5373 times by 9 tests: case PatternTerm::TypeCharacterClass: Executed by:
| 5373 | ||||||||||||||||||||||||||||||||||||||||||||||||
573 | term.inputPosition = currentInputPosition.unsafeGet(); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
574 | if (term.quantityType != QuantifierFixedCount
| 2566-2808 | ||||||||||||||||||||||||||||||||||||||||||||||||
575 | term.frameLocation = currentCallFrameSize; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
576 | currentCallFrameSize += 1; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
577 | alternative->m_hasFixedSize = false; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
578 | } executed 2566 times by 8 tests: elseend of block Executed by:
| 2566 | ||||||||||||||||||||||||||||||||||||||||||||||||
579 | currentInputPosition += term.quantityCount; executed 2809 times by 8 tests: currentInputPosition += term.quantityCount; Executed by:
| 2809 | ||||||||||||||||||||||||||||||||||||||||||||||||
580 | break; executed 5368 times by 9 tests: break; Executed by:
| 5368 | ||||||||||||||||||||||||||||||||||||||||||||||||
581 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
582 | case executed 3541 times by 3 tests: PatternTerm::TypeParenthesesSubpattern:case PatternTerm::TypeParenthesesSubpattern: Executed by:
executed 3541 times by 3 tests: case PatternTerm::TypeParenthesesSubpattern: Executed by:
| 3541 | ||||||||||||||||||||||||||||||||||||||||||||||||
583 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
584 | term.frameLocation = currentCallFrameSize; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
585 | if (term.quantityCount == 1
| 0-3118 | ||||||||||||||||||||||||||||||||||||||||||||||||
586 | if (term.quantityType != QuantifierFixedCount
| 338-2778 | ||||||||||||||||||||||||||||||||||||||||||||||||
587 | currentCallFrameSize += 1; executed 338 times by 2 tests: currentCallFrameSize += 1; Executed by:
| 338 | ||||||||||||||||||||||||||||||||||||||||||||||||
588 | currentCallFrameSize = setupDisjunctionOffsets(term.parentheses.disjunction, currentCallFrameSize, currentInputPosition.unsafeGet()); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
589 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
590 | if (term.quantityType == QuantifierFixedCount
| 338-2778 | ||||||||||||||||||||||||||||||||||||||||||||||||
591 | currentInputPosition += term.parentheses.disjunction->m_minimumSize; executed 2778 times by 3 tests: currentInputPosition += term.parentheses.disjunction->m_minimumSize; Executed by:
| 2778 | ||||||||||||||||||||||||||||||||||||||||||||||||
592 | term.inputPosition = currentInputPosition.unsafeGet(); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
593 | } executed 3118 times by 3 tests: else if (term.parentheses.isTerminalend of block Executed by:
| 11-3118 | ||||||||||||||||||||||||||||||||||||||||||||||||
594 | currentCallFrameSize += 1; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
595 | currentCallFrameSize = setupDisjunctionOffsets(term.parentheses.disjunction, currentCallFrameSize, currentInputPosition.unsafeGet()); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
596 | term.inputPosition = currentInputPosition.unsafeGet(); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
597 | } executed 12 times by 1 test: else {end of block Executed by:
| 12 | ||||||||||||||||||||||||||||||||||||||||||||||||
598 | term.inputPosition = currentInputPosition.unsafeGet(); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
599 | setupDisjunctionOffsets(term.parentheses.disjunction, 0, currentInputPosition.unsafeGet()); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
600 | currentCallFrameSize += 2; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
601 | } executed 412 times by 1 test: end of block Executed by:
| 412 | ||||||||||||||||||||||||||||||||||||||||||||||||
602 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
603 | alternative->m_hasFixedSize = false; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
604 | break; executed 3540 times by 3 tests: break; Executed by:
| 3540 | ||||||||||||||||||||||||||||||||||||||||||||||||
605 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
606 | case executed 76 times by 1 test: PatternTerm::TypeParentheticalAssertion:case PatternTerm::TypeParentheticalAssertion: Executed by:
executed 76 times by 1 test: case PatternTerm::TypeParentheticalAssertion: Executed by:
| 76 | ||||||||||||||||||||||||||||||||||||||||||||||||
607 | term.inputPosition = currentInputPosition.unsafeGet(); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
608 | term.frameLocation = currentCallFrameSize; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
609 | currentCallFrameSize = setupDisjunctionOffsets(term.parentheses.disjunction, currentCallFrameSize + 1, currentInputPosition.unsafeGet()); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
610 | break; executed 76 times by 1 test: break; Executed by:
| 76 | ||||||||||||||||||||||||||||||||||||||||||||||||
611 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
612 | case executed 8 times by 1 test: PatternTerm::TypeDotStarEnclosure:case PatternTerm::TypeDotStarEnclosure: Executed by:
executed 8 times by 1 test: case PatternTerm::TypeDotStarEnclosure: Executed by:
| 8 | ||||||||||||||||||||||||||||||||||||||||||||||||
613 | alternative->m_hasFixedSize = false; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
614 | term.inputPosition = initialInputPosition; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
615 | break; executed 8 times by 1 test: break; Executed by:
| 8 | ||||||||||||||||||||||||||||||||||||||||||||||||
616 | } | - | ||||||||||||||||||||||||||||||||||||||||||||||||
617 | } executed 2379996 times by 9 tests: end of block Executed by:
| 2379996 | ||||||||||||||||||||||||||||||||||||||||||||||||
618 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
619 | alternative->m_minimumSize = (currentInputPosition - initialInputPosition).unsafeGet(); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
620 | return executed 1154549 times by 153 tests: currentCallFrameSize;return currentCallFrameSize; Executed by:
executed 1154549 times by 153 tests: return currentCallFrameSize; Executed by:
| 1154549 | ||||||||||||||||||||||||||||||||||||||||||||||||
621 | } | - | ||||||||||||||||||||||||||||||||||||||||||||||||
622 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
623 | unsigned setupDisjunctionOffsets(PatternDisjunction* disjunction, unsigned initialCallFrameSize, unsigned initialInputPosition) | - | ||||||||||||||||||||||||||||||||||||||||||||||||
624 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||
625 | if ((
| 641-1149465 | ||||||||||||||||||||||||||||||||||||||||||||||||
626 | initialCallFrameSize += 1; executed 642 times by 3 tests: initialCallFrameSize += 1; Executed by:
| 642 | ||||||||||||||||||||||||||||||||||||||||||||||||
627 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
628 | unsigned minimumInputSize = | - | ||||||||||||||||||||||||||||||||||||||||||||||||
629 | (0x7fffffff * 2U + 1U) | - | ||||||||||||||||||||||||||||||||||||||||||||||||
630 | ; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
631 | unsigned maximumCallFrameSize = 0; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
632 | bool hasFixedSize = true; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
633 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
634 | for (unsigned alt = 0; alt < disjunction->m_alternatives.size()
| 1154390-1156077 | ||||||||||||||||||||||||||||||||||||||||||||||||
635 | PatternAlternative* alternative = disjunction->m_alternatives[alt].get(); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
636 | unsigned currentAlternativeCallFrameSize = setupAlternativeOffsets(alternative, initialCallFrameSize, initialInputPosition); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
637 | minimumInputSize = std::min(minimumInputSize, alternative->m_minimumSize); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
638 | maximumCallFrameSize = std::max(maximumCallFrameSize, currentAlternativeCallFrameSize); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
639 | hasFixedSize &= alternative->m_hasFixedSize; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
640 | } executed 1155127 times by 153 tests: end of block Executed by:
| 1155127 | ||||||||||||||||||||||||||||||||||||||||||||||||
641 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
642 | (!(minimumInputSize != | - | ||||||||||||||||||||||||||||||||||||||||||||||||
643 | (0x7fffffff * 2U + 1U) | - | ||||||||||||||||||||||||||||||||||||||||||||||||
644 | ) ? (qmlWTFReportAssertionFailure(__FILE__, 674, __PRETTY_FUNCTION__, "minimumInputSize != UINT_MAX"), (qmlWTFReportBacktrace(), qmlWTFInvokeCrashHook(), (*(int *)(uintptr_t)0xbbadbeef = 0), __builtin_trap())) : (void)0); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
645 | (!(maximumCallFrameSize >= initialCallFrameSize) ? (qmlWTFReportAssertionFailure(__FILE__, 675, __PRETTY_FUNCTION__, "maximumCallFrameSize >= initialCallFrameSize"), (qmlWTFReportBacktrace(), qmlWTFInvokeCrashHook(), (*(int *)(uintptr_t)0xbbadbeef = 0), __builtin_trap())) : (void)0); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
646 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
647 | disjunction->m_hasFixedSize = hasFixedSize; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
648 | disjunction->m_minimumSize = minimumInputSize; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
649 | disjunction->m_callFrameSize = maximumCallFrameSize; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
650 | return executed 1154201 times by 153 tests: maximumCallFrameSize;return maximumCallFrameSize; Executed by:
executed 1154201 times by 153 tests: return maximumCallFrameSize; Executed by:
| 1154201 | ||||||||||||||||||||||||||||||||||||||||||||||||
651 | } | - | ||||||||||||||||||||||||||||||||||||||||||||||||
652 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
653 | void setupOffsets() | - | ||||||||||||||||||||||||||||||||||||||||||||||||
654 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||
655 | setupDisjunctionOffsets(m_pattern.m_body, 0, 0); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
656 | } executed 1150138 times by 153 tests: end of block Executed by:
| 1150138 | ||||||||||||||||||||||||||||||||||||||||||||||||
657 | void checkForTerminalParentheses() | - | ||||||||||||||||||||||||||||||||||||||||||||||||
658 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||
659 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
660 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
661 | if (m_pattern.m_numSubpatterns
| 560-1149855 | ||||||||||||||||||||||||||||||||||||||||||||||||
662 | return; executed 560 times by 3 tests: return; Executed by:
| 560 | ||||||||||||||||||||||||||||||||||||||||||||||||
663 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
664 | Vector<OwnPtr<PatternAlternative> >& alternatives = m_pattern.m_body->m_alternatives; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
665 | for (size_t i = 0; i < alternatives.size()
| 1149644-1149923 | ||||||||||||||||||||||||||||||||||||||||||||||||
666 | Vector<PatternTerm>& terms = alternatives[i]->m_terms; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
667 | if (terms.size()
| 98066-1051678 | ||||||||||||||||||||||||||||||||||||||||||||||||
668 | PatternTerm& term = terms.last(); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
669 | if (term.type == PatternTerm::TypeParenthesesSubpattern
| 87-1051460 | ||||||||||||||||||||||||||||||||||||||||||||||||
670 | && term.quantityType == QuantifierGreedy
| 12-76 | ||||||||||||||||||||||||||||||||||||||||||||||||
671 | && term.quantityCount == quantifyInfinite
| 0-11 | ||||||||||||||||||||||||||||||||||||||||||||||||
672 | && !term.capture()
| 0-11 | ||||||||||||||||||||||||||||||||||||||||||||||||
673 | term.parentheses.isTerminal = true; executed 11 times by 1 test: term.parentheses.isTerminal = true; Executed by:
| 11 | ||||||||||||||||||||||||||||||||||||||||||||||||
674 | } executed 1051487 times by 9 tests: end of block Executed by:
| 1051487 | ||||||||||||||||||||||||||||||||||||||||||||||||
675 | } executed 1149807 times by 153 tests: end of block Executed by:
| 1149807 | ||||||||||||||||||||||||||||||||||||||||||||||||
676 | } executed 1149590 times by 153 tests: end of block Executed by:
| 1149590 | ||||||||||||||||||||||||||||||||||||||||||||||||
677 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
678 | void optimizeBOL() | - | ||||||||||||||||||||||||||||||||||||||||||||||||
679 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||
680 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
681 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
682 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
683 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
684 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
685 | PatternDisjunction* disjunction = m_pattern.m_body; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
686 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
687 | if (!m_pattern.m_containsBOL
| 20-1149777 | ||||||||||||||||||||||||||||||||||||||||||||||||
688 | return; executed 1149681 times by 153 tests: return; Executed by:
| 1149681 | ||||||||||||||||||||||||||||||||||||||||||||||||
689 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
690 | PatternDisjunction* loopDisjunction = copyDisjunction(disjunction, true); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
691 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
692 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
693 | for (unsigned alt = 0; alt < disjunction->m_alternatives.size()
| 121-132 | ||||||||||||||||||||||||||||||||||||||||||||||||
694 | disjunction->m_alternatives[alt]->setOnceThrough(); executed 132 times by 5 tests: disjunction->m_alternatives[alt]->setOnceThrough(); Executed by:
| 132 | ||||||||||||||||||||||||||||||||||||||||||||||||
695 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
696 | if (loopDisjunction
| 6-115 | ||||||||||||||||||||||||||||||||||||||||||||||||
697 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
698 | for (unsigned alt = 0; alt < loopDisjunction->m_alternatives.size()
| 6 | ||||||||||||||||||||||||||||||||||||||||||||||||
699 | disjunction->m_alternatives.append(loopDisjunction->m_alternatives[alt].release()); executed 6 times by 2 tests: disjunction->m_alternatives.append(loopDisjunction->m_alternatives[alt].release()); Executed by:
| 6 | ||||||||||||||||||||||||||||||||||||||||||||||||
700 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
701 | loopDisjunction->m_alternatives.clear(); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
702 | } executed 6 times by 2 tests: end of block Executed by:
| 6 | ||||||||||||||||||||||||||||||||||||||||||||||||
703 | } executed 121 times by 5 tests: end of block Executed by:
| 121 | ||||||||||||||||||||||||||||||||||||||||||||||||
704 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
705 | bool containsCapturingTerms(PatternAlternative* alternative, size_t firstTermIndex, size_t lastTermIndex) | - | ||||||||||||||||||||||||||||||||||||||||||||||||
706 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||
707 | Vector<PatternTerm>& terms = alternative->m_terms; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
708 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
709 | for (size_t termIndex = firstTermIndex; termIndex <= lastTermIndex
| 8-24 | ||||||||||||||||||||||||||||||||||||||||||||||||
710 | PatternTerm& term = terms[termIndex]; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
711 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
712 | if (term.m_capture
| 0-24 | ||||||||||||||||||||||||||||||||||||||||||||||||
713 | return never executed: true;return true; never executed: return true; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
714 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
715 | if (term.type == PatternTerm::TypeParenthesesSubpattern
| 0-24 | ||||||||||||||||||||||||||||||||||||||||||||||||
716 | PatternDisjunction* nestedDisjunction = term.parentheses.disjunction; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
717 | for (unsigned alt = 0; alt < nestedDisjunction->m_alternatives.size()
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
718 | if (containsCapturingTerms(nestedDisjunction->m_alternatives[alt].get(), 0, nestedDisjunction->m_alternatives[alt]->m_terms.size() - 1)
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
719 | return never executed: true;return true; never executed: return true; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
720 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
721 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
722 | } executed 24 times by 1 test: end of block Executed by:
| 24 | ||||||||||||||||||||||||||||||||||||||||||||||||
723 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
724 | return executed 8 times by 1 test: false;return false; Executed by:
executed 8 times by 1 test: return false; Executed by:
| 8 | ||||||||||||||||||||||||||||||||||||||||||||||||
725 | } | - | ||||||||||||||||||||||||||||||||||||||||||||||||
726 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
727 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
728 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
729 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
730 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
731 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
732 | void optimizeDotStarWrappedExpressions() | - | ||||||||||||||||||||||||||||||||||||||||||||||||
733 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||
734 | Vector<OwnPtr<PatternAlternative> >& alternatives = m_pattern.m_body->m_alternatives; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
735 | if (alternatives.size() != 1
| 197-1149634 | ||||||||||||||||||||||||||||||||||||||||||||||||
736 | return; executed 197 times by 2 tests: return; Executed by:
| 197 | ||||||||||||||||||||||||||||||||||||||||||||||||
737 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
738 | PatternAlternative* alternative = alternatives[0].get(); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
739 | Vector<PatternTerm>& terms = alternative->m_terms; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
740 | if (terms.size() >= 3
| 263139-886621 | ||||||||||||||||||||||||||||||||||||||||||||||||
741 | bool startsWithBOL = false; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
742 | bool endsWithEOL = false; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
743 | size_t termIndex, firstExpressionTerm, lastExpressionTerm; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
744 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
745 | termIndex = 0; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
746 | if (terms[termIndex].type == PatternTerm::TypeAssertionBOL
| 112-263027 | ||||||||||||||||||||||||||||||||||||||||||||||||
747 | startsWithBOL = true; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
748 | ++termIndex; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
749 | } executed 112 times by 4 tests: end of block Executed by:
| 112 | ||||||||||||||||||||||||||||||||||||||||||||||||
750 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
751 | PatternTerm& firstNonAnchorTerm = terms[termIndex]; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
752 | if ((
| 10-262953 | ||||||||||||||||||||||||||||||||||||||||||||||||
753 | return; executed 263115 times by 7 tests: return; Executed by:
| 263115 | ||||||||||||||||||||||||||||||||||||||||||||||||
754 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
755 | firstExpressionTerm = termIndex + 1; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
756 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
757 | termIndex = terms.size() - 1; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
758 | if (terms[termIndex].type == PatternTerm::TypeAssertionEOL
| 4-20 | ||||||||||||||||||||||||||||||||||||||||||||||||
759 | endsWithEOL = true; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
760 | --termIndex; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
761 | } executed 4 times by 1 test: end of block Executed by:
| 4 | ||||||||||||||||||||||||||||||||||||||||||||||||
762 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
763 | PatternTerm& lastNonAnchorTerm = terms[termIndex]; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
764 | if ((
| 2-14 | ||||||||||||||||||||||||||||||||||||||||||||||||
765 | return; executed 16 times by 2 tests: return; Executed by:
| 16 | ||||||||||||||||||||||||||||||||||||||||||||||||
766 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
767 | lastExpressionTerm = termIndex - 1; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
768 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
769 | if (firstExpressionTerm > lastExpressionTerm
| 0-8 | ||||||||||||||||||||||||||||||||||||||||||||||||
770 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
771 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
772 | if (!containsCapturingTerms(alternative, firstExpressionTerm, lastExpressionTerm)
| 0-8 | ||||||||||||||||||||||||||||||||||||||||||||||||
773 | for (termIndex = terms.size() - 1; termIndex > lastExpressionTerm
| 8 | ||||||||||||||||||||||||||||||||||||||||||||||||
774 | terms.remove(termIndex); executed 8 times by 1 test: terms.remove(termIndex); Executed by:
| 8 | ||||||||||||||||||||||||||||||||||||||||||||||||
775 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
776 | for (termIndex = firstExpressionTerm; termIndex > 0
| 8 | ||||||||||||||||||||||||||||||||||||||||||||||||
777 | terms.remove(termIndex - 1); executed 8 times by 1 test: terms.remove(termIndex - 1); Executed by:
| 8 | ||||||||||||||||||||||||||||||||||||||||||||||||
778 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
779 | terms.append(PatternTerm(startsWithBOL, endsWithEOL)); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
780 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
781 | m_pattern.m_containsBOL = false; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
782 | } executed 8 times by 1 test: end of block Executed by:
| 8 | ||||||||||||||||||||||||||||||||||||||||||||||||
783 | } executed 8 times by 1 test: end of block Executed by:
| 8 | ||||||||||||||||||||||||||||||||||||||||||||||||
784 | } executed 887320 times by 153 tests: end of block Executed by:
| 887320 | ||||||||||||||||||||||||||||||||||||||||||||||||
785 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
786 | private: | - | ||||||||||||||||||||||||||||||||||||||||||||||||
787 | YarrPattern& m_pattern; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
788 | PatternAlternative* m_alternative; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
789 | CharacterClassConstructor m_characterClassConstructor; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
790 | bool m_invertCharacterClass; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
791 | bool m_invertParentheticalAssertion; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
792 | }; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
793 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
794 | const char* YarrPattern::compile(const String& patternString) | - | ||||||||||||||||||||||||||||||||||||||||||||||||
795 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||
796 | YarrPatternConstructor constructor(*this); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
797 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
798 | if (const
| 249-1150587 | ||||||||||||||||||||||||||||||||||||||||||||||||
799 | return executed 250 times by 1 test: error;return error; Executed by:
executed 250 times by 1 test: return error; Executed by:
| 250 | ||||||||||||||||||||||||||||||||||||||||||||||||
800 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
801 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
802 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
803 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
804 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
805 | if (containsIllegalBackReference()
| 72-1150410 | ||||||||||||||||||||||||||||||||||||||||||||||||
806 | unsigned numSubpatterns = m_numSubpatterns; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
807 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
808 | constructor.reset(); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
809 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
810 | const char* error = | - | ||||||||||||||||||||||||||||||||||||||||||||||||
811 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
812 | parse(constructor, patternString, numSubpatterns); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
813 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
814 | (!(!error) ? (qmlWTFReportAssertionFailure(__FILE__, 852, __PRETTY_FUNCTION__, "!error"), (qmlWTFReportBacktrace(), qmlWTFInvokeCrashHook(), (*(int *)(uintptr_t)0xbbadbeef = 0), __builtin_trap())) : (void)0); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
815 | (!(numSubpatterns == m_numSubpatterns) ? (qmlWTFReportAssertionFailure(__FILE__, 853, __PRETTY_FUNCTION__, "numSubpatterns == m_numSubpatterns"), (qmlWTFReportBacktrace(), qmlWTFInvokeCrashHook(), (*(int *)(uintptr_t)0xbbadbeef = 0), __builtin_trap())) : (void)0); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
816 | } executed 72 times by 1 test: end of block Executed by:
| 72 | ||||||||||||||||||||||||||||||||||||||||||||||||
817 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
818 | constructor.checkForTerminalParentheses(); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
819 | constructor.optimizeDotStarWrappedExpressions(); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
820 | constructor.optimizeBOL(); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
821 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
822 | constructor.setupOffsets(); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
823 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
824 | return executed 1149806 times by 153 tests: 0;return 0; Executed by:
executed 1149806 times by 153 tests: return 0; Executed by:
| 1149806 | ||||||||||||||||||||||||||||||||||||||||||||||||
825 | } | - | ||||||||||||||||||||||||||||||||||||||||||||||||
826 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
827 | YarrPattern::YarrPattern(const String& pattern, bool ignoreCase, bool multiline, const char** error) | - | ||||||||||||||||||||||||||||||||||||||||||||||||
828 | : m_ignoreCase(ignoreCase) | - | ||||||||||||||||||||||||||||||||||||||||||||||||
829 | , m_multiline(multiline) | - | ||||||||||||||||||||||||||||||||||||||||||||||||
830 | , m_containsBackreferences(false) | - | ||||||||||||||||||||||||||||||||||||||||||||||||
831 | , m_containsBOL(false) | - | ||||||||||||||||||||||||||||||||||||||||||||||||
832 | , m_numSubpatterns(0) | - | ||||||||||||||||||||||||||||||||||||||||||||||||
833 | , m_maxBackReference(0) | - | ||||||||||||||||||||||||||||||||||||||||||||||||
834 | , newlineCached(0) | - | ||||||||||||||||||||||||||||||||||||||||||||||||
835 | , digitsCached(0) | - | ||||||||||||||||||||||||||||||||||||||||||||||||
836 | , spacesCached(0) | - | ||||||||||||||||||||||||||||||||||||||||||||||||
837 | , wordcharCached(0) | - | ||||||||||||||||||||||||||||||||||||||||||||||||
838 | , nondigitsCached(0) | - | ||||||||||||||||||||||||||||||||||||||||||||||||
839 | , nonspacesCached(0) | - | ||||||||||||||||||||||||||||||||||||||||||||||||
840 | , nonwordcharCached(0) | - | ||||||||||||||||||||||||||||||||||||||||||||||||
841 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||
842 | *error = compile(pattern); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
843 | } executed 1151010 times by 153 tests: end of block Executed by:
| 1151010 | ||||||||||||||||||||||||||||||||||||||||||||||||
844 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
845 | } } | - | ||||||||||||||||||||||||||||||||||||||||||||||||
Switch to Source code | Preprocessed file |