@@ -18,7 +18,7 @@ private import semmle.python.ApiGraphs
1818/** Provides classes for modeling Regular Expression-related APIs. */
1919module RegexExecution {
2020 /**
21- * A data-flow node that works with regular expressions.
21+ * A data-flow node that works with regular expressions immediately executing an expression .
2222 *
2323 * Extend this class to model new APIs. If you want to refine existing API models,
2424 * extend `RegexExecution` instead.
@@ -31,7 +31,7 @@ module RegexExecution {
3131}
3232
3333/**
34- * A data-flow node that works with regular expressions.
34+ * A data-flow node that works with regular expressions immediately executing an expression .
3535 *
3636 * Extend this class to refine existing API models. If you want to model new APIs,
3737 * extend `RegexExecution::Range` instead.
@@ -46,17 +46,33 @@ class RegexExecution extends DataFlow::Node {
4646 Attribute getRegexMethod ( ) { result = range .getRegexMethod ( ) }
4747}
4848
49- class RegexEscape extends DataFlow:: CallCfgNode {
50- DataFlow:: Node regexNode ;
51- Attribute regexMethod ;
49+ /** Provides classes for modeling Regular Expression escape-related APIs. */
50+ module RegexEscape {
51+ /**
52+ * A data-flow node that collects functions escaping regular expressions.
53+ *
54+ * Extend this class to model new APIs. If you want to refine existing API models,
55+ * extend `RegexEscape` instead.
56+ */
57+ abstract class Range extends DataFlow:: Node {
58+ abstract DataFlow:: Node getRegexNode ( ) ;
5259
53- RegexEscape ( ) {
54- this = API:: moduleImport ( "re" ) .getMember ( "escape" ) .getACall ( ) and
55- regexNode = this .getArg ( 0 ) and
56- regexMethod = this .asExpr ( ) .( Attribute )
60+ abstract Attribute getEscapeMethod ( ) ;
5761 }
62+ }
5863
59- DataFlow:: Node getRegexNode ( ) { result = regexNode }
64+ /**
65+ * A data-flow node that collects functions escaping regular expressions.
66+ *
67+ * Extend this class to refine existing API models. If you want to model new APIs,
68+ * extend `RegexEscape::Range` instead.
69+ */
70+ class RegexEscape extends DataFlow:: Node {
71+ RegexEscape:: Range range ;
72+
73+ RegexEscape ( ) { this = range }
74+
75+ DataFlow:: Node getRegexNode ( ) { result = range .getRegexNode ( ) }
6076
61- Attribute getRegexMethod ( ) { result = regexMethod }
77+ Attribute getEscapeMethod ( ) { result = range . getEscapeMethod ( ) }
6278}
0 commit comments