changes based on Python review

This commit is contained in:
erik-krogh
2022-12-19 11:20:31 +01:00
parent 35e8d6afd4
commit 6c8b1cf4be
2 changed files with 2 additions and 6 deletions

View File

@@ -858,7 +858,7 @@ module Impl implements RegexTreeViewSig {
* ``` * ```
*/ */
class RegExpAnchor extends RegExpSpecialChar { class RegExpAnchor extends RegExpSpecialChar {
RegExpAnchor() { this.getChar() = ["^", "$"] } RegExpAnchor() { this.getChar() = ["\\A", "^", "$", "\\Z"] }
} }
/** /**

View File

@@ -245,15 +245,11 @@ module Make<RegexTreeViewSig TreeImpl, HostnameRegexpSig<TreeImpl> Specific> {
term.isRootTerm() term.isRootTerm()
or or
exists(RegExpTerm parent | exists(RegExpTerm parent |
term = getLastChild(parent) and term = parent.getLastChild() and
isRightArmTerm(parent) isRightArmTerm(parent)
) )
} }
private RegExpTerm getLastChild(RegExpTerm parent) {
result = max(RegExpTerm child, int i | child = parent.getChild(i) | child order by i)
}
/** /**
* Holds if `regexp` is a regular expression that is likely to match a hostname, * Holds if `regexp` is a regular expression that is likely to match a hostname,
* but the pattern is incomplete and may match more hosts than intended. * but the pattern is incomplete and may match more hosts than intended.