Skip to content

Commit 0ab9454

Browse files
committed
C++: Address RegExpNormalChar review feedback
1 parent 40a8746 commit 0ab9454

4 files changed

Lines changed: 281 additions & 281 deletions

File tree

‎cpp/ql/lib/semmle/code/cpp/regex/RegexTreeView.qll‎

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ private newtype TRegExpParent =
4040
/** A special character */
4141
TRegExpSpecialChar(RegExp re, int start, int end) { re.specialCharacter(start, end, _) } or
4242
/** A normal character */
43-
TRegExpNormalChar(RegExp re, int start, int end) {
43+
TRegExpNormalChars(RegExp re, int start, int end) {
4444
re.normalCharacterSequence(start, end)
4545
or
4646
re.escapedCharacter(start, end) and
@@ -129,7 +129,7 @@ private module Impl implements RegexTreeViewSig {
129129
or
130130
this = TRegExpCharacterRange(re, start, end)
131131
or
132-
this = TRegExpNormalChar(re, start, end)
132+
this = TRegExpNormalChars(re, start, end)
133133
or
134134
this = TRegExpGroup(re, start, end)
135135
or
@@ -172,7 +172,7 @@ private module Impl implements RegexTreeViewSig {
172172
or
173173
result = this.(RegExpCharacterRange).getChild(i)
174174
or
175-
result = this.(RegExpNormalChar).getChild(i)
175+
result = this.(RegExpNormalChars).getChild(i)
176176
or
177177
result = this.(RegExpGroup).getChild(i)
178178
or
@@ -570,7 +570,7 @@ private module Impl implements RegexTreeViewSig {
570570
* \w
571571
* ```
572572
*/
573-
class RegExpEscape extends RegExpNormalChar {
573+
class RegExpEscape extends RegExpNormalChars {
574574
RegExpEscape() { re.escapedCharacter(start, end) }
575575

576576
/**
@@ -805,30 +805,30 @@ private module Impl implements RegexTreeViewSig {
805805
}
806806

807807
/**
808-
* A normal character in a regular expression, that is, a character
809-
* without special meaning. This includes escaped characters.
808+
* A normal-character term in a regular expression, that is, a sequence
809+
* of characters without special meaning or a single escaped character.
810810
*
811811
* Examples:
812812
* ```
813-
* t
813+
* abc
814814
* \t
815815
* ```
816816
*/
817-
additional class RegExpNormalChar extends RegExpTerm, TRegExpNormalChar {
818-
RegExpNormalChar() { this = TRegExpNormalChar(re, start, end) }
817+
additional class RegExpNormalChars extends RegExpTerm, TRegExpNormalChars {
818+
RegExpNormalChars() { this = TRegExpNormalChars(re, start, end) }
819819

820820
/**
821-
* Holds if this constant represents a valid Unicode character (as opposed
821+
* Holds if this constant consists of a valid Unicode character (as opposed
822822
* to a surrogate code point that does not correspond to a character by itself.)
823823
*/
824824
predicate isCharacter() { any() }
825825

826-
/** Gets the string representation of the char matched by this term. */
826+
/** Gets the string representation of this term. */
827827
string getValue() { result = re.getText().substring(start, end) }
828828

829829
override RegExpTerm getChild(int i) { none() }
830830

831-
override string getAPrimaryQlClass() { result = "RegExpNormalChar" }
831+
override string getAPrimaryQlClass() { result = "RegExpNormalChars" }
832832
}
833833

834834
/**
@@ -845,14 +845,14 @@ private module Impl implements RegexTreeViewSig {
845845
string value;
846846

847847
RegExpConstant() {
848-
this = TRegExpNormalChar(re, start, end) and
848+
this = TRegExpNormalChars(re, start, end) and
849849
not this instanceof RegExpCharacterClassEscape and
850850
// exclude chars in qualifiers
851851
// TODO: push this into regex library
852852
not exists(int qstart, int qend | re.qualifiedPart(_, qstart, qend, _, _) |
853853
qstart <= start and end <= qend
854854
) and
855-
value = this.(RegExpNormalChar).getValue()
855+
value = this.(RegExpNormalChars).getValue()
856856
or
857857
this = TRegExpSpecialChar(re, start, end) and
858858
re.inCharSet(start) and

0 commit comments

Comments
 (0)