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 33import com .semmle .js .ast .SourceLocation ;
44import java .util .List ;
55
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+ */
610public class CharacterClassIntersection extends RegExpTerm {
711 private final List <RegExpTerm > elements ;
812
Original file line number Diff line number Diff line change 33import com .semmle .js .ast .SourceLocation ;
44
55/**
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.
811 */
912public class CharacterClassQuotedString extends RegExpTerm {
1013 private final RegExpTerm term ;
@@ -17,7 +20,7 @@ public CharacterClassQuotedString(SourceLocation loc, RegExpTerm term) {
1720 public RegExpTerm getTerm () {
1821 return term ;
1922 }
20-
23+
2124 @ Override
2225 public void accept (Visitor v ) {
2326 v .visit (this );
Original file line number Diff line number Diff line change 33import com .semmle .js .ast .SourceLocation ;
44import java .util .List ;
55
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+ */
610public class CharacterClassSubtraction extends RegExpTerm {
711 private final List <RegExpTerm > elements ;
812
Original file line number Diff line number Diff line change @@ -297,8 +297,8 @@ private RegExpTerm parseDisjunctionInsideQuotedString() {
297297 disjuncts .add (this .parseAlternativeInsideQuotedString ());
298298 }
299299 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+ }
302302
303303 private RegExpTerm parseAlternativeInsideQuotedString () {
304304 SourceLocation loc = new SourceLocation (pos ());
Original file line number Diff line number Diff line change @@ -4,5 +4,4 @@ category: feature
44* Added ability to parse new ECMA 2024 ` v ` flag operations:
55 - Intersection ` && `
66 - Subtraction ` -- `
7- - Union
87 - ` \q ` quoted string
You can’t perform that action at this time.
0 commit comments