Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 0962af5

Browse files
committed
renamed "isGreedy" to "is_greedy"
1 parent 3743223 commit 0962af5

10 files changed

Lines changed: 31 additions & 24 deletions

File tree

javascript/extractor/src/com/semmle/js/extractor/RegExpExtractor.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,7 @@ public void visit(NonWordBoundary nd) {
219219

220220
private void visit(Quantifier nd) {
221221
Label lbl = extractTerm(nd, parent, idx);
222-
if (nd.isGreedy()) trapwriter.addTuple("isGreedy", lbl);
222+
if (nd.isGreedy()) trapwriter.addTuple("is_greedy", lbl);
223223
visit(nd.getOperand(), lbl, 0);
224224
}
225225

@@ -240,7 +240,7 @@ private boolean inRange(long l) {
240240
@Override
241241
public void visit(Range nd) {
242242
Label lbl = extractTerm(nd, parent, idx);
243-
if (nd.isGreedy()) trapwriter.addTuple("isGreedy", lbl);
243+
if (nd.isGreedy()) trapwriter.addTuple("is_greedy", lbl);
244244

245245
long lo = nd.getLowerBound();
246246
if (inRange(lo)) trapwriter.addTuple("rangeQuantifierLowerBound", lbl, lo);

javascript/extractor/tests/exprs/output/trap/primaries.js.trap

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1002,7 +1002,7 @@ regexpterm(#20357,10,#20353,1,"t?")
10021002
#20358=@"loc,{#10000},12,6,12,7"
10031003
locations_default(#20358,#10000,12,6,12,7)
10041004
hasLocation(#20357,#20358)
1005-
isGreedy(#20357)
1005+
is_greedy(#20357)
10061006
#20359=*
10071007
regexpterm(#20359,14,#20357,0,"t")
10081008
#20360=@"loc,{#10000},12,6,12,6"
@@ -1045,7 +1045,7 @@ regexpterm(#20369,10,#20365,1,"y?")
10451045
#20370=@"loc,{#10000},13,5,13,6"
10461046
locations_default(#20370,#10000,13,5,13,6)
10471047
hasLocation(#20369,#20370)
1048-
isGreedy(#20369)
1048+
is_greedy(#20369)
10491049
#20371=*
10501050
regexpterm(#20371,14,#20369,0,"y")
10511051
#20372=@"loc,{#10000},13,5,13,5"
@@ -1085,7 +1085,7 @@ regexpterm(#20381,9,#20377,1,"(need?le)+")
10851085
#20382=@"loc,{#10000},14,3,14,12"
10861086
locations_default(#20382,#10000,14,3,14,12)
10871087
hasLocation(#20381,#20382)
1088-
isGreedy(#20381)
1088+
is_greedy(#20381)
10891089
#20383=*
10901090
regexpterm(#20383,13,#20381,0,"(need?le)")
10911091
#20384=@"loc,{#10000},14,3,14,11"
@@ -1108,7 +1108,7 @@ regexpterm(#20389,10,#20385,1,"d?")
11081108
#20390=@"loc,{#10000},14,7,14,8"
11091109
locations_default(#20390,#10000,14,7,14,8)
11101110
hasLocation(#20389,#20390)
1111-
isGreedy(#20389)
1111+
is_greedy(#20389)
11121112
#20391=*
11131113
regexpterm(#20391,14,#20389,0,"d")
11141114
#20392=@"loc,{#10000},14,7,14,7"

javascript/extractor/tests/exprs/output/trap/regexp.js.trap

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -957,7 +957,7 @@ regexpterm(#20339,8,#20338,0,"a*")
957957
#20340=@"loc,{#10000},9,2,9,3"
958958
locations_default(#20340,#10000,9,2,9,3)
959959
hasLocation(#20339,#20340)
960-
isGreedy(#20339)
960+
is_greedy(#20339)
961961
#20341=*
962962
regexpterm(#20341,14,#20339,0,"a")
963963
#20342=@"loc,{#10000},9,2,9,2"
@@ -1000,7 +1000,7 @@ regexpterm(#20351,9,#20350,0,"a+")
10001000
#20352=@"loc,{#10000},11,2,11,3"
10011001
locations_default(#20352,#10000,11,2,11,3)
10021002
hasLocation(#20351,#20352)
1003-
isGreedy(#20351)
1003+
is_greedy(#20351)
10041004
#20353=*
10051005
regexpterm(#20353,14,#20351,0,"a")
10061006
#20354=@"loc,{#10000},11,2,11,2"
@@ -1043,7 +1043,7 @@ regexpterm(#20363,10,#20362,0,"a?")
10431043
#20364=@"loc,{#10000},13,2,13,3"
10441044
locations_default(#20364,#10000,13,2,13,3)
10451045
hasLocation(#20363,#20364)
1046-
isGreedy(#20363)
1046+
is_greedy(#20363)
10471047
#20365=*
10481048
regexpterm(#20365,14,#20363,0,"a")
10491049
#20366=@"loc,{#10000},13,2,13,2"
@@ -1086,7 +1086,7 @@ regexpterm(#20375,11,#20374,0,"a{1}")
10861086
#20376=@"loc,{#10000},15,2,15,5"
10871087
locations_default(#20376,#10000,15,2,15,5)
10881088
hasLocation(#20375,#20376)
1089-
isGreedy(#20375)
1089+
is_greedy(#20375)
10901090
rangeQuantifierLowerBound(#20375,1)
10911091
rangeQuantifierUpperBound(#20375,1)
10921092
#20377=*
@@ -1110,7 +1110,7 @@ regexpterm(#20381,11,#20380,0,"a{1,}")
11101110
#20382=@"loc,{#10000},16,2,16,6"
11111111
locations_default(#20382,#10000,16,2,16,6)
11121112
hasLocation(#20381,#20382)
1113-
isGreedy(#20381)
1113+
is_greedy(#20381)
11141114
rangeQuantifierLowerBound(#20381,1)
11151115
#20383=*
11161116
regexpterm(#20383,14,#20381,0,"a")
@@ -1133,7 +1133,7 @@ regexpterm(#20387,11,#20386,0,"a{1,2}")
11331133
#20388=@"loc,{#10000},17,2,17,7"
11341134
locations_default(#20388,#10000,17,2,17,7)
11351135
hasLocation(#20387,#20388)
1136-
isGreedy(#20387)
1136+
is_greedy(#20387)
11371137
rangeQuantifierLowerBound(#20387,1)
11381138
rangeQuantifierUpperBound(#20387,2)
11391139
#20389=*
@@ -1670,7 +1670,7 @@ regexpterm(#20542,11,#20541,0,"a{")
16701670
#20543=@"loc,{#10000},37,2,37,3"
16711671
locations_default(#20543,#10000,37,2,37,3)
16721672
hasLocation(#20542,#20543)
1673-
isGreedy(#20542)
1673+
is_greedy(#20542)
16741674
rangeQuantifierLowerBound(#20542,0)
16751675
rangeQuantifierUpperBound(#20542,0)
16761676
#20544=*
@@ -1709,7 +1709,7 @@ regexpterm(#20554,11,#20552,0,"a{")
17091709
#20555=@"loc,{#10000},38,2,38,3"
17101710
locations_default(#20555,#10000,38,2,38,3)
17111711
hasLocation(#20554,#20555)
1712-
isGreedy(#20554)
1712+
is_greedy(#20554)
17131713
rangeQuantifierLowerBound(#20554,0)
17141714
rangeQuantifierUpperBound(#20554,0)
17151715
#20556=*
@@ -1756,7 +1756,7 @@ regexpterm(#20568,11,#20567,0,"a{2")
17561756
#20569=@"loc,{#10000},39,2,39,4"
17571757
locations_default(#20569,#10000,39,2,39,4)
17581758
hasLocation(#20568,#20569)
1759-
isGreedy(#20568)
1759+
is_greedy(#20568)
17601760
rangeQuantifierLowerBound(#20568,2)
17611761
rangeQuantifierUpperBound(#20568,2)
17621762
#20570=*
@@ -1875,7 +1875,7 @@ regexpterm(#20602,8,#20596,2,"[^>]*")
18751875
#20603=@"loc,{#10000},44,8,44,12"
18761876
locations_default(#20603,#10000,44,8,44,12)
18771877
hasLocation(#20602,#20603)
1878-
isGreedy(#20602)
1878+
is_greedy(#20602)
18791879
#20604=*
18801880
regexpterm(#20604,23,#20602,0,"[^>]")
18811881
#20605=@"loc,{#10000},44,8,44,11"
@@ -1936,7 +1936,7 @@ regexpterm(#20624,9,#20622,0,"[^<]+")
19361936
#20625=@"loc,{#10000},44,22,44,26"
19371937
locations_default(#20625,#10000,44,22,44,26)
19381938
hasLocation(#20624,#20625)
1939-
isGreedy(#20624)
1939+
is_greedy(#20624)
19401940
#20626=*
19411941
regexpterm(#20626,23,#20624,0,"[^<]")
19421942
#20627=@"loc,{#10000},44,22,44,25"
@@ -1992,7 +1992,7 @@ regexpterm(#20644,8,#20638,2,"[^>]*")
19921992
#20645=@"loc,{#10000},44,41,44,45"
19931993
locations_default(#20645,#10000,44,41,44,45)
19941994
hasLocation(#20644,#20645)
1995-
isGreedy(#20644)
1995+
is_greedy(#20644)
19961996
#20646=*
19971997
regexpterm(#20646,23,#20644,0,"[^>]")
19981998
#20647=@"loc,{#10000},44,41,44,44"

javascript/extractor/tests/regexp/output/trap/es2018.js.trap

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ regexpterm(#20049,9,#20047,0,"\s+")
147147
#20050=@"loc,{#10000},1,9,1,11"
148148
locations_default(#20050,#10000,1,9,1,11)
149149
hasLocation(#20049,#20050)
150-
isGreedy(#20049)
150+
is_greedy(#20049)
151151
#20051=*
152152
regexpterm(#20051,20,#20049,0,"\s")
153153
#20052=@"loc,{#10000},1,9,1,10"
@@ -159,7 +159,7 @@ regexpterm(#20053,9,#20043,2,"\w+")
159159
#20054=@"loc,{#10000},1,13,1,15"
160160
locations_default(#20054,#10000,1,13,1,15)
161161
hasLocation(#20053,#20054)
162-
isGreedy(#20053)
162+
is_greedy(#20053)
163163
#20055=*
164164
regexpterm(#20055,20,#20053,0,"\w")
165165
#20056=@"loc,{#10000},1,13,1,14"

javascript/extractor/tests/regexp/output/trap/odasa-1934.js.trap

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -298,7 +298,7 @@ regexpterm(#20096,9,#20095,0,"[\x]+")
298298
#20097=@"loc,{#10000},5,9,5,13"
299299
locations_default(#20097,#10000,5,9,5,13)
300300
hasLocation(#20096,#20097)
301-
isGreedy(#20096)
301+
is_greedy(#20096)
302302
#20098=*
303303
regexpterm(#20098,23,#20096,0,"[\x]")
304304
#20099=@"loc,{#10000},5,9,5,12"

javascript/ql/src/semmle/javascript/Aliases.qll

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -225,3 +225,8 @@ deprecated predicate jsParseErrors(JSParseError id, TopLevel toplevel, string me
225225
* Use the `RegExpParseError` class instead.
226226
*/
227227
deprecated predicate regexpParseErrors(RegExpParseError id, RegExpTerm regexp, string message) { regexp_parse_errors(id, regexp, message) }
228+
/**
229+
* Alias for the predicate `is_greedy` defined in the .dbscheme.
230+
* Use `RegExpQuantifier#isGreedy` instead.
231+
*/
232+
deprecated predicate isGreedy(RegExpQuantifier id) { is_greedy(id) }

javascript/ql/src/semmle/javascript/Regexp.qll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,7 @@ class RegExpTerm extends Locatable, @regexpterm {
188188
*/
189189
class RegExpQuantifier extends RegExpTerm, @regexp_quantifier {
190190
/** Holds if the quantifier of this term is a greedy quantifier. */
191-
predicate isGreedy() { isGreedy(this) }
191+
predicate isGreedy() { is_greedy(this) }
192192
}
193193

194194
/**

javascript/ql/src/semmlecode.javascript.dbscheme

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -877,7 +877,7 @@ regexp_parse_errors (unique int id: @regexp_parse_error,
877877
@regexp_subpattern = @regexp_lookahead | @regexp_lookbehind;
878878
@regexp_anchor = @regexp_dollar | @regexp_caret;
879879

880-
isGreedy (int id: @regexp_quantifier ref);
880+
is_greedy (int id: @regexp_quantifier ref);
881881
rangeQuantifierLowerBound (unique int id: @regexp_range ref, int lo: int ref);
882882
rangeQuantifierUpperBound (unique int id: @regexp_range ref, int hi: int ref);
883883
isCapture (unique int id: @regexp_group ref, int number: int ref);

javascript/ql/src/semmlecode.javascript.dbscheme.stats

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20061,7 +20061,7 @@
2006120061
</dependencies>
2006220062
</relation>
2006320063
<relation>
20064-
<name>isGreedy</name>
20064+
<name>is_greedy</name>
2006520065
<cardinality>2629</cardinality>
2006620066
<columnsizes>
2006720067
<e>

javascript/upgrades/c73fbfca57f3d593b9ff50c6aa3a886d6888efec/upgrade.properties

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,3 +64,5 @@ js_parse_errors.rel: reorder jsParseErrors.rel(int id, int toplevel, string mess
6464
jsParseErrors.rel: delete
6565
regexp_parse_errors.rel: reorder regexpParseErrors.rel(int id, int regexp, string message) id regexp message
6666
regexpParseErrors.rel: delete
67+
is_greedy.rel: reorder isGreedy.rel(int id) id
68+
isGreedy.rel: delete

0 commit comments

Comments
 (0)