File tree Expand file tree Collapse file tree 5 files changed +16
-6
lines changed Expand file tree Collapse file tree 5 files changed +16
-6
lines changed Original file line number Diff line number Diff line change 3
3
import com .semmle .js .ast .SourceLocation ;
4
4
import java .util .List ;
5
5
6
+ /**
7
+ * A character class intersection in a regular expression available only with the `v` flag.
8
+ * Example: [[abc]&&[ab]&&[b]] matches character `b` only.
9
+ */
6
10
public class CharacterClassIntersection extends RegExpTerm {
7
11
private final List <RegExpTerm > elements ;
8
12
Original file line number Diff line number Diff line change 3
3
import com .semmle .js .ast .SourceLocation ;
4
4
5
5
/**
6
- * A '\q{}' escape sequence in a regular expression, which is a special extension
7
- * to standard regular expressions.
6
+ * A quoted string escape sequence '\q{}' in a regular expression.
7
+ * This feature is a non-standard extension that requires the 'v' flag.
8
+ *
9
+ * Example: [\q{abc|def}] creates a character class that matches either the string
10
+ * "abc" or "def". Within the quoted string, only the alternation operator '|' is supported.
8
11
*/
9
12
public class CharacterClassQuotedString extends RegExpTerm {
10
13
private final RegExpTerm term ;
@@ -17,7 +20,7 @@ public CharacterClassQuotedString(SourceLocation loc, RegExpTerm term) {
17
20
public RegExpTerm getTerm () {
18
21
return term ;
19
22
}
20
-
23
+
21
24
@ Override
22
25
public void accept (Visitor v ) {
23
26
v .visit (this );
Original file line number Diff line number Diff line change 3
3
import com .semmle .js .ast .SourceLocation ;
4
4
import java .util .List ;
5
5
6
+ /**
7
+ * A character class subtraction in a regular expression available only with the `v` flag.
8
+ * Example: [[abc]--[a]--[b]] matches character `c` only.
9
+ */
6
10
public class CharacterClassSubtraction extends RegExpTerm {
7
11
private final List <RegExpTerm > elements ;
8
12
Original file line number Diff line number Diff line change @@ -297,8 +297,8 @@ private RegExpTerm parseDisjunctionInsideQuotedString() {
297
297
disjuncts .add (this .parseAlternativeInsideQuotedString ());
298
298
}
299
299
if (disjuncts .size () == 1 ) return disjuncts .get (0 );
300
- return this .finishTerm (new Disjunction (loc , disjuncts ));
301
- }
300
+ return this .finishTerm (new Disjunction (loc , disjuncts ));
301
+ }
302
302
303
303
private RegExpTerm parseAlternativeInsideQuotedString () {
304
304
SourceLocation loc = new SourceLocation (pos ());
Original file line number Diff line number Diff line change @@ -4,5 +4,4 @@ category: feature
4
4
* Added ability to parse new ECMA 2024 ` v ` flag operations:
5
5
- Intersection ` && `
6
6
- Subtraction ` -- `
7
- - Union
8
7
- ` \q ` quoted string
You can’t perform that action at this time.
0 commit comments