|
| 1 | +/** |
| 2 | + * Definitions for parsing regular expressions. |
| 3 | + */ |
| 4 | + |
1 | 5 | import java |
2 | 6 | private import RegexFlowConfigs |
3 | 7 |
|
@@ -142,7 +146,7 @@ abstract class RegexString extends StringLiteral { |
142 | 146 | } |
143 | 147 |
|
144 | 148 | bindingset[x] |
145 | | - int max_zero(int x) { result = max([x, 0]) } |
| 149 | + private int max_zero(int x) { result = max([x, 0]) } |
146 | 150 |
|
147 | 151 | /** |
148 | 152 | * Gets the nesting depth of character classes after position `pos`, |
@@ -375,11 +379,13 @@ abstract class RegexString extends StringLiteral { |
375 | 379 | not exists(int x, int y | this.backreference(x, y) and x <= start and y >= end) |
376 | 380 | } |
377 | 381 |
|
| 382 | + /** Holds if a normal character or escape sequence is between `start` and `end`. */ |
378 | 383 | predicate normalCharacter(int start, int end) { |
379 | 384 | this.character(start, end) and |
380 | 385 | not this.specialCharacter(start, end, _) |
381 | 386 | } |
382 | 387 |
|
| 388 | + /** Holds if a special character `char` is between `start` and `end`. */ |
383 | 389 | predicate specialCharacter(int start, int end, string char) { |
384 | 390 | this.character(start, end) and |
385 | 391 | end = start + 1 and |
@@ -510,6 +516,7 @@ abstract class RegexString extends StringLiteral { |
510 | 516 | this.simpleGroupStart(start, end) |
511 | 517 | } |
512 | 518 |
|
| 519 | + /** Holds if the text in the range start,end is a group with contents in the range in_start,in_end */ |
513 | 520 | predicate groupContents(int start, int end, int in_start, int in_end) { |
514 | 521 | this.groupStart(start, in_start) and |
515 | 522 | end = in_end + 1 and |
|
0 commit comments