Commit cebddbd
authored
Commit 7: Implement POSIX collating symbol and equivalence class support
Add posixCollatingSymbol([.x.]) and posixEquivalenceClass([=x=]) predicates
to ParseRegExp.qll, enabling correct tokenization of all three POSIX bracket
atom types inside character classes:
- [:name:] — already handled, unchanged
- [.x.] — new: posixCollatingSymbol predicate
- [=x=] — new: posixEquivalenceClass predicate
Refactored:
- charSetDelimiter: use inAnyPosixBracket helper (covers all three types)
- charSet closing: use inAnyPosixBracket helper
- inPosixBracket: updated to cover all three types
- simpleCharacter: updated to exclude all three types
- namedCharacterProperty: includes posixCollatingSymbol and posixEquivalenceClass
- inAnyPosixBracket: new private helper; uses pos in [x..y-1] for QL binding
Before this commit (commit 6):
[[.a.]] → RegExpCharacterClass([[.a.]) + stray ] (WRONG)
[[=a=]] → RegExpCharacterClass([[=a=]) + stray ] (WRONG)
After this commit:
[[.a.]] → RegExpCharacterClass containing RegExpNamedCharacterProperty [.a.]
[[=a=]] → RegExpCharacterClass containing RegExpNamedCharacterProperty [=a=]
Regenerated parse.expected and regexp.expected via codeql test run --learn
(CodeQL 2.26.1); all 2 tests pass.1 parent 9fd7e94 commit cebddbd
3 files changed
Lines changed: 76 additions & 75 deletions
File tree
- cpp/ql
- lib/semmle/code/cpp/regex/internal
- test/library-tests/regex
Lines changed: 66 additions & 15 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
102 | 102 | | |
103 | 103 | | |
104 | 104 | | |
105 | | - | |
| 105 | + | |
106 | 106 | | |
107 | | - | |
108 | | - | |
109 | | - | |
| 107 | + | |
110 | 108 | | |
111 | 109 | | |
112 | 110 | | |
| |||
136 | 134 | | |
137 | 135 | | |
138 | 136 | | |
139 | | - | |
140 | | - | |
141 | | - | |
| 137 | + | |
142 | 138 | | |
143 | 139 | | |
144 | 140 | | |
| |||
289 | 285 | | |
290 | 286 | | |
291 | 287 | | |
292 | | - | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
293 | 291 | | |
294 | 292 | | |
295 | 293 | | |
296 | 294 | | |
297 | 295 | | |
298 | 296 | | |
299 | 297 | | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
| 309 | + | |
| 310 | + | |
| 311 | + | |
| 312 | + | |
300 | 313 | | |
301 | 314 | | |
302 | 315 | | |
| |||
318 | 331 | | |
319 | 332 | | |
320 | 333 | | |
| 334 | + | |
| 335 | + | |
| 336 | + | |
| 337 | + | |
| 338 | + | |
| 339 | + | |
| 340 | + | |
| 341 | + | |
| 342 | + | |
| 343 | + | |
| 344 | + | |
| 345 | + | |
| 346 | + | |
| 347 | + | |
| 348 | + | |
| 349 | + | |
| 350 | + | |
| 351 | + | |
| 352 | + | |
| 353 | + | |
| 354 | + | |
| 355 | + | |
| 356 | + | |
| 357 | + | |
| 358 | + | |
| 359 | + | |
| 360 | + | |
| 361 | + | |
| 362 | + | |
| 363 | + | |
| 364 | + | |
| 365 | + | |
| 366 | + | |
| 367 | + | |
| 368 | + | |
| 369 | + | |
321 | 370 | | |
322 | 371 | | |
323 | 372 | | |
| |||
398 | 447 | | |
399 | 448 | | |
400 | 449 | | |
401 | | - | |
| 450 | + | |
| 451 | + | |
402 | 452 | | |
403 | 453 | | |
404 | 454 | | |
405 | | - | |
| 455 | + | |
| 456 | + | |
| 457 | + | |
| 458 | + | |
| 459 | + | |
| 460 | + | |
406 | 461 | | |
407 | 462 | | |
408 | 463 | | |
| |||
413 | 468 | | |
414 | 469 | | |
415 | 470 | | |
416 | | - | |
417 | | - | |
418 | | - | |
419 | | - | |
420 | | - | |
| 471 | + | |
421 | 472 | | |
422 | 473 | | |
423 | 474 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
245 | 245 | | |
246 | 246 | | |
247 | 247 | | |
248 | | - | |
249 | | - | |
250 | | - | |
251 | | - | |
252 | | - | |
253 | | - | |
254 | | - | |
255 | | - | |
256 | | - | |
257 | | - | |
258 | | - | |
259 | | - | |
260 | | - | |
261 | | - | |
262 | | - | |
263 | | - | |
264 | | - | |
265 | | - | |
266 | | - | |
267 | | - | |
268 | | - | |
269 | | - | |
270 | | - | |
271 | | - | |
272 | | - | |
273 | | - | |
274 | | - | |
275 | | - | |
276 | | - | |
277 | | - | |
278 | | - | |
279 | | - | |
280 | | - | |
| 248 | + | |
| 249 | + | |
281 | 250 | | |
282 | | - | |
| 251 | + | |
283 | 252 | | |
284 | | - | |
| 253 | + | |
| 254 | + | |
285 | 255 | | |
286 | | - | |
| 256 | + | |
287 | 257 | | |
288 | 258 | | |
289 | 259 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
100 | 100 | | |
101 | 101 | | |
102 | 102 | | |
103 | | - | |
104 | | - | |
105 | | - | |
106 | | - | |
107 | | - | |
108 | | - | |
109 | | - | |
110 | | - | |
111 | | - | |
112 | | - | |
113 | | - | |
114 | | - | |
115 | | - | |
116 | | - | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
117 | 107 | | |
118 | 108 | | |
119 | 109 | | |
| |||
252 | 242 | | |
253 | 243 | | |
254 | 244 | | |
255 | | - | |
256 | | - | |
257 | | - | |
258 | | - | |
259 | | - | |
260 | | - | |
261 | | - | |
262 | | - | |
263 | | - | |
264 | | - | |
265 | 245 | | |
266 | 246 | | |
267 | 247 | | |
| |||
0 commit comments