|
2 | 2 |
|
3 | 3 | import python |
4 | 4 | private import semmle.python.regex |
5 | | -private import semmle.python.dataflow.new.DataFlow |
6 | 5 |
|
7 | 6 | /** |
8 | 7 | * An element containing a regular expression term, that is, either |
@@ -49,19 +48,6 @@ newtype TRegExpParent = |
49 | 48 | /** A back reference */ |
50 | 49 | TRegExpBackRef(Regex re, int start, int end) { re.backreference(start, end) } |
51 | 50 |
|
52 | | -/** |
53 | | - * Provides utility predicates related to regular expressions. |
54 | | - */ |
55 | | -module RegExpPatterns { |
56 | | - /** |
57 | | - * Gets a pattern that matches common top-level domain names in lower case. |
58 | | - */ |
59 | | - string getACommonTld() { |
60 | | - // according to ranking by http://google.com/search?q=site:.<<TLD>> |
61 | | - result = "(?:com|org|edu|gov|uk|net|io)(?![a-z0-9])" |
62 | | - } |
63 | | -} |
64 | | - |
65 | 51 | /** |
66 | 52 | * An element containing a regular expression term, that is, either |
67 | 53 | * a string literal (parsed as a regular expression) |
@@ -1028,24 +1014,3 @@ class RegExpBackRef extends RegExpTerm, TRegExpBackRef { |
1028 | 1014 |
|
1029 | 1015 | /** Gets the parse tree resulting from parsing `re`, if such has been constructed. */ |
1030 | 1016 | RegExpTerm getParsedRegExp(StrConst re) { result.getRegex() = re and result.isRootTerm() } |
1031 | | - |
1032 | | -/** |
1033 | | - * A node whose value may flow to a position where it is interpreted |
1034 | | - * as a part of a regular expression. |
1035 | | - */ |
1036 | | -class RegExpPatternSource extends DataFlow::CfgNode { |
1037 | | - private Regex astNode; |
1038 | | - |
1039 | | - RegExpPatternSource() { astNode = this.asExpr() } |
1040 | | - |
1041 | | - /** |
1042 | | - * Gets a node where the pattern of this node is parsed as a part of |
1043 | | - * a regular expression. |
1044 | | - */ |
1045 | | - DataFlow::Node getAParse() { result = this } |
1046 | | - |
1047 | | - /** |
1048 | | - * Gets the root term of the regular expression parsed from this pattern. |
1049 | | - */ |
1050 | | - RegExpTerm getRegExpTerm() { result.getRegex() = astNode } |
1051 | | -} |
0 commit comments