1- /** Provides a class hierarchy corresponding to a parse tree of regular expressions. */
1+ /**
2+ * Provides a class hierarchy corresponding to a parse tree of regular expressions.
3+ */
24
3- private import internal.ParseRegExp
5+ import swift
6+ private import internal.ParseRegex
47private import codeql.util.Numbers
5- private import codeql.ruby.ast.Literal as Ast
6- private import codeql.Locations
78private import codeql.regex.nfa.NfaUtils as NfaUtils
89private import codeql.regex.RegexTreeView
910// exporting as RegexTreeView, and in the top-level scope.
1011import Impl as RegexTreeView
1112import Impl
1213
13- /** Gets the parse tree resulting from parsing `re`, if such has been constructed. */
14- RegExpTerm getParsedRegExp ( Ast:: RegExpLiteral re ) {
15- result .getRegExp ( ) = re and result .isRootTerm ( )
16- }
17-
1814/**
1915 * An element containing a regular expression term, that is, either
2016 * a string literal (parsed as a regular expression)
@@ -211,25 +207,30 @@ private module Impl implements RegexTreeViewSig {
211207 */
212208 Location getLocation ( ) { result = re .getLocation ( ) }
213209
214- pragma [ noinline]
210+ /* pragma[noinline]
215211 private predicate componentHasLocationInfo(
216212 int i, string filepath, int startline, int startcolumn, int endline, int endcolumn
217213 ) {
218214 re.getComponent(i)
219215 .getLocation()
220216 .hasLocationInfo(filepath, startline, startcolumn, endline, endcolumn)
221- }
217+ }*/
222218
223219 /** Holds if this term is found at the specified location offsets. */
224220 predicate hasLocationInfo (
225221 string filepath , int startline , int startcolumn , int endline , int endcolumn
226222 ) {
227- exists ( int re_start |
223+ /* exists(int re_start |
228224 this.componentHasLocationInfo(0, filepath, startline, re_start, _, _) and
229225 this.componentHasLocationInfo(re.getNumberOfComponents() - 1, filepath, _, _, endline, _) and
230226 startcolumn = re_start + start and
231227 endcolumn = re_start + end - 1
232- )
228+ )*/
229+ filepath = re .getFile ( ) .getAbsolutePath ( ) and
230+ startline = re .getLocation ( ) .getStartLine ( ) and
231+ startcolumn = re .getLocation ( ) .getStartColumn ( ) and
232+ endline = re .getLocation ( ) .getEndLine ( ) and
233+ endcolumn = re .getLocation ( ) .getEndColumn ( )
233234 }
234235
235236 /** Gets the file in which this term is found. */
@@ -1196,7 +1197,7 @@ private module Impl implements RegexTreeViewSig {
11961197 * Holds if the regular expression should not be considered.
11971198 */
11981199 predicate isExcluded ( RegExpParent parent ) {
1199- parent .( RegExpTerm ) .getRegExp ( ) .( Ast:: RegExpLiteral ) .hasFreeSpacingFlag ( ) // exclude free-spacing mode regexes
1200+ none ( ) // parent.(RegExpTerm).getRegExp().(Ast::RegExpLiteral).hasFreeSpacingFlag() // exclude free-spacing mode regexes
12001201 }
12011202
12021203 /**
@@ -1207,13 +1208,13 @@ private module Impl implements RegexTreeViewSig {
12071208
12081209 /**
12091210 * Holds if the regex that `term` is part of is used in a way that ignores any leading prefix of the input it's matched against.
1210- * Not yet implemented for Ruby .
1211+ * Not yet implemented for Swift .
12111212 */
12121213 predicate matchesAnyPrefix ( RegExpTerm term ) { any ( ) }
12131214
12141215 /**
12151216 * Holds if the regex that `term` is part of is used in a way that ignores any trailing suffix of the input it's matched against.
1216- * Not yet implemented for Ruby .
1217+ * Not yet implemented for Swift .
12171218 */
12181219 predicate matchesAnySuffix ( RegExpTerm term ) { any ( ) }
12191220
0 commit comments