Skip to content

Commit 08c07f8

Browse files
committed
Improved documentation, removed union fram change note.
1 parent 9c8e0a5 commit 08c07f8

File tree

5 files changed

+16
-6
lines changed

5 files changed

+16
-6
lines changed

javascript/extractor/src/com/semmle/js/ast/regexp/CharacterClassIntersection.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,10 @@
33
import com.semmle.js.ast.SourceLocation;
44
import 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+
*/
610
public class CharacterClassIntersection extends RegExpTerm {
711
private final List<RegExpTerm> elements;
812

javascript/extractor/src/com/semmle/js/ast/regexp/CharacterClassQuotedString.java

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,11 @@
33
import 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
*/
912
public 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);

javascript/extractor/src/com/semmle/js/ast/regexp/CharacterClassSubtraction.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,10 @@
33
import com.semmle.js.ast.SourceLocation;
44
import 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+
*/
610
public class CharacterClassSubtraction extends RegExpTerm {
711
private final List<RegExpTerm> elements;
812

javascript/extractor/src/com/semmle/js/parser/RegExpParser.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff 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());

javascript/ql/lib/change-notes/2025-03-03-regex-v.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff 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

0 commit comments

Comments
 (0)