Skip to content

Commit debc57b

Browse files
committed
Ruby: Add RegExpAnchor to RegExpTreeView
1 parent d95f533 commit debc57b

File tree

1 file changed

+17
-2
lines changed

1 file changed

+17
-2
lines changed

ruby/ql/lib/codeql/ruby/regexp/RegExpTreeView.qll

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -860,6 +860,21 @@ class RegExpDot extends RegExpSpecialChar {
860860
override string getAPrimaryQlClass() { result = "RegExpDot" }
861861
}
862862

863+
/**
864+
* A term that matches a specific position between characters in the string.
865+
*
866+
* Example:
867+
*
868+
* ```
869+
* \A
870+
* ```
871+
*/
872+
class RegExpAnchor extends RegExpSpecialChar {
873+
RegExpAnchor() { this.getChar() = ["^", "$", "\\A", "\\Z", "\\z"] }
874+
875+
override string getAPrimaryQlClass() { result = "RegExpAnchor" }
876+
}
877+
863878
/**
864879
* A dollar assertion `$` or `\Z` matching the end of a line.
865880
*
@@ -869,7 +884,7 @@ class RegExpDot extends RegExpSpecialChar {
869884
* $
870885
* ```
871886
*/
872-
class RegExpDollar extends RegExpSpecialChar {
887+
class RegExpDollar extends RegExpAnchor {
873888
RegExpDollar() { this.getChar() = ["$", "\\Z", "\\z"] }
874889

875890
override string getAPrimaryQlClass() { result = "RegExpDollar" }
@@ -884,7 +899,7 @@ class RegExpDollar extends RegExpSpecialChar {
884899
* ^
885900
* ```
886901
*/
887-
class RegExpCaret extends RegExpSpecialChar {
902+
class RegExpCaret extends RegExpAnchor {
888903
RegExpCaret() { this.getChar() = ["^", "\\A"] }
889904

890905
override string getAPrimaryQlClass() { result = "RegExpCaret" }

0 commit comments

Comments
 (0)