mirror of
https://github.com/github/codeql.git
synced 2026-05-05 21:55:19 +02:00
JavaScript: Port regular expression parser to Java.
This commit is contained in:
@@ -3,3 +3,4 @@
|
||||
/(?<!.)/;
|
||||
/\p{Number}/u;
|
||||
/\P{Script=Greek}/u;
|
||||
/\k</;
|
||||
|
||||
2
javascript/extractor/tests/regexp/input/tst.js
Normal file
2
javascript/extractor/tests/regexp/input/tst.js
Normal file
@@ -0,0 +1,2 @@
|
||||
/\u{10400}/;
|
||||
/\c/;
|
||||
@@ -10,8 +10,8 @@ hasLocation(#10000,#10002)
|
||||
scopes(#20000,0)
|
||||
#20001=@"script;{#10000},1,1"
|
||||
toplevels(#20001,0)
|
||||
#20002=@"loc,{#10000},1,1,6,0"
|
||||
locations_default(#20002,#10000,1,1,6,0)
|
||||
#20002=@"loc,{#10000},1,1,7,0"
|
||||
locations_default(#20002,#10000,1,1,7,0)
|
||||
hasLocation(#20001,#20002)
|
||||
#20003=*
|
||||
stmts(#20003,2,#20001,0,"/^(?<ws ... <ws>$/;")
|
||||
@@ -169,81 +169,125 @@ hasLocation(#20051,#20052)
|
||||
unicodePropertyEscapeName(#20051,"Script")
|
||||
unicodePropertyEscapeValue(#20051,"Greek")
|
||||
#20053=*
|
||||
lines(#20053,#20001,"/^(?<ws>\s+)\w+\k<ws>$/;","
|
||||
")
|
||||
hasLocation(#20053,#20004)
|
||||
#20054=*
|
||||
lines(#20054,#20001,"/(?<=.)/;","
|
||||
")
|
||||
hasLocation(#20054,#20026)
|
||||
stmts(#20053,2,#20001,5,"/\k</;")
|
||||
#20054=@"loc,{#10000},6,1,6,6"
|
||||
locations_default(#20054,#10000,6,1,6,6)
|
||||
hasLocation(#20053,#20054)
|
||||
stmtContainers(#20053,#20001)
|
||||
#20055=*
|
||||
lines(#20055,#20001,"/(?<!.)/;","
|
||||
")
|
||||
hasLocation(#20055,#20034)
|
||||
#20056=*
|
||||
lines(#20056,#20001,"/\p{Number}/u;","
|
||||
")
|
||||
hasLocation(#20056,#20042)
|
||||
exprs(#20055,5,#20053,0,"/\k</")
|
||||
#20056=@"loc,{#10000},6,1,6,5"
|
||||
locations_default(#20056,#10000,6,1,6,5)
|
||||
hasLocation(#20055,#20056)
|
||||
enclosingStmt(#20055,#20053)
|
||||
exprContainers(#20055,#20001)
|
||||
literals("/\k</","/\k</",#20055)
|
||||
#20057=*
|
||||
lines(#20057,#20001,"/\P{Script=Greek}/u;","
|
||||
")
|
||||
hasLocation(#20057,#20048)
|
||||
numlines(#20001,5,5,0)
|
||||
#20058=*
|
||||
tokeninfo(#20058,5,#20001,0,"/^(?<ws>\s+)\w+\k<ws>$/")
|
||||
hasLocation(#20058,#20006)
|
||||
regexpterm(#20057,22,#20055,0,"\k<")
|
||||
#20058=@"loc,{#10000},6,2,6,4"
|
||||
locations_default(#20058,#10000,6,2,6,4)
|
||||
hasLocation(#20057,#20058)
|
||||
namedBackref(#20057,"")
|
||||
#20059=*
|
||||
tokeninfo(#20059,8,#20001,1,";")
|
||||
#20060=@"loc,{#10000},1,24,1,24"
|
||||
locations_default(#20060,#10000,1,24,1,24)
|
||||
regexpParseErrors(#20059,#20057,"expected identifier")
|
||||
#20060=@"loc,{#10000},6,5,6,5"
|
||||
locations_default(#20060,#10000,6,5,6,5)
|
||||
hasLocation(#20059,#20060)
|
||||
#20061=*
|
||||
tokeninfo(#20061,5,#20001,2,"/(?<=.)/")
|
||||
hasLocation(#20061,#20028)
|
||||
#20062=*
|
||||
tokeninfo(#20062,8,#20001,3,";")
|
||||
#20063=@"loc,{#10000},2,9,2,9"
|
||||
locations_default(#20063,#10000,2,9,2,9)
|
||||
hasLocation(#20062,#20063)
|
||||
regexpParseErrors(#20061,#20057,"expected '>'")
|
||||
#20062=@"loc,{#10000},6,4,6,4"
|
||||
locations_default(#20062,#10000,6,4,6,4)
|
||||
hasLocation(#20061,#20062)
|
||||
#20063=*
|
||||
lines(#20063,#20001,"/^(?<ws>\s+)\w+\k<ws>$/;","
|
||||
")
|
||||
hasLocation(#20063,#20004)
|
||||
#20064=*
|
||||
tokeninfo(#20064,5,#20001,4,"/(?<!.)/")
|
||||
hasLocation(#20064,#20036)
|
||||
lines(#20064,#20001,"/(?<=.)/;","
|
||||
")
|
||||
hasLocation(#20064,#20026)
|
||||
#20065=*
|
||||
tokeninfo(#20065,8,#20001,5,";")
|
||||
#20066=@"loc,{#10000},3,9,3,9"
|
||||
locations_default(#20066,#10000,3,9,3,9)
|
||||
hasLocation(#20065,#20066)
|
||||
lines(#20065,#20001,"/(?<!.)/;","
|
||||
")
|
||||
hasLocation(#20065,#20034)
|
||||
#20066=*
|
||||
lines(#20066,#20001,"/\p{Number}/u;","
|
||||
")
|
||||
hasLocation(#20066,#20042)
|
||||
#20067=*
|
||||
tokeninfo(#20067,5,#20001,6,"/\p{Number}/u")
|
||||
hasLocation(#20067,#20044)
|
||||
lines(#20067,#20001,"/\P{Script=Greek}/u;","
|
||||
")
|
||||
hasLocation(#20067,#20048)
|
||||
#20068=*
|
||||
tokeninfo(#20068,8,#20001,7,";")
|
||||
#20069=@"loc,{#10000},4,14,4,14"
|
||||
locations_default(#20069,#10000,4,14,4,14)
|
||||
hasLocation(#20068,#20069)
|
||||
lines(#20068,#20001,"/\k</;","
|
||||
")
|
||||
hasLocation(#20068,#20054)
|
||||
numlines(#20001,6,6,0)
|
||||
#20069=*
|
||||
tokeninfo(#20069,5,#20001,0,"/^(?<ws>\s+)\w+\k<ws>$/")
|
||||
hasLocation(#20069,#20006)
|
||||
#20070=*
|
||||
tokeninfo(#20070,5,#20001,8,"/\P{Script=Greek}/u")
|
||||
hasLocation(#20070,#20050)
|
||||
#20071=*
|
||||
tokeninfo(#20071,8,#20001,9,";")
|
||||
#20072=@"loc,{#10000},5,20,5,20"
|
||||
locations_default(#20072,#10000,5,20,5,20)
|
||||
hasLocation(#20071,#20072)
|
||||
tokeninfo(#20070,8,#20001,1,";")
|
||||
#20071=@"loc,{#10000},1,24,1,24"
|
||||
locations_default(#20071,#10000,1,24,1,24)
|
||||
hasLocation(#20070,#20071)
|
||||
#20072=*
|
||||
tokeninfo(#20072,5,#20001,2,"/(?<=.)/")
|
||||
hasLocation(#20072,#20028)
|
||||
#20073=*
|
||||
tokeninfo(#20073,0,#20001,10,"")
|
||||
#20074=@"loc,{#10000},6,1,6,0"
|
||||
locations_default(#20074,#10000,6,1,6,0)
|
||||
tokeninfo(#20073,8,#20001,3,";")
|
||||
#20074=@"loc,{#10000},2,9,2,9"
|
||||
locations_default(#20074,#10000,2,9,2,9)
|
||||
hasLocation(#20073,#20074)
|
||||
#20075=*
|
||||
entry_cfg_node(#20075,#20001)
|
||||
#20076=@"loc,{#10000},1,1,1,0"
|
||||
locations_default(#20076,#10000,1,1,1,0)
|
||||
hasLocation(#20075,#20076)
|
||||
#20077=*
|
||||
exit_cfg_node(#20077,#20001)
|
||||
hasLocation(#20077,#20074)
|
||||
tokeninfo(#20075,5,#20001,4,"/(?<!.)/")
|
||||
hasLocation(#20075,#20036)
|
||||
#20076=*
|
||||
tokeninfo(#20076,8,#20001,5,";")
|
||||
#20077=@"loc,{#10000},3,9,3,9"
|
||||
locations_default(#20077,#10000,3,9,3,9)
|
||||
hasLocation(#20076,#20077)
|
||||
#20078=*
|
||||
tokeninfo(#20078,5,#20001,6,"/\p{Number}/u")
|
||||
hasLocation(#20078,#20044)
|
||||
#20079=*
|
||||
tokeninfo(#20079,8,#20001,7,";")
|
||||
#20080=@"loc,{#10000},4,14,4,14"
|
||||
locations_default(#20080,#10000,4,14,4,14)
|
||||
hasLocation(#20079,#20080)
|
||||
#20081=*
|
||||
tokeninfo(#20081,5,#20001,8,"/\P{Script=Greek}/u")
|
||||
hasLocation(#20081,#20050)
|
||||
#20082=*
|
||||
tokeninfo(#20082,8,#20001,9,";")
|
||||
#20083=@"loc,{#10000},5,20,5,20"
|
||||
locations_default(#20083,#10000,5,20,5,20)
|
||||
hasLocation(#20082,#20083)
|
||||
#20084=*
|
||||
tokeninfo(#20084,5,#20001,10,"/\k</")
|
||||
hasLocation(#20084,#20056)
|
||||
#20085=*
|
||||
tokeninfo(#20085,8,#20001,11,";")
|
||||
#20086=@"loc,{#10000},6,6,6,6"
|
||||
locations_default(#20086,#10000,6,6,6,6)
|
||||
hasLocation(#20085,#20086)
|
||||
#20087=*
|
||||
tokeninfo(#20087,0,#20001,12,"")
|
||||
#20088=@"loc,{#10000},7,1,7,0"
|
||||
locations_default(#20088,#10000,7,1,7,0)
|
||||
hasLocation(#20087,#20088)
|
||||
#20089=*
|
||||
entry_cfg_node(#20089,#20001)
|
||||
#20090=@"loc,{#10000},1,1,1,0"
|
||||
locations_default(#20090,#10000,1,1,1,0)
|
||||
hasLocation(#20089,#20090)
|
||||
#20091=*
|
||||
exit_cfg_node(#20091,#20001)
|
||||
hasLocation(#20091,#20088)
|
||||
successor(#20053,#20055)
|
||||
successor(#20055,#20091)
|
||||
successor(#20047,#20049)
|
||||
successor(#20049,#20077)
|
||||
successor(#20049,#20053)
|
||||
successor(#20041,#20043)
|
||||
successor(#20043,#20047)
|
||||
successor(#20033,#20035)
|
||||
@@ -252,6 +296,6 @@ successor(#20025,#20027)
|
||||
successor(#20027,#20033)
|
||||
successor(#20003,#20005)
|
||||
successor(#20005,#20025)
|
||||
successor(#20075,#20003)
|
||||
numlines(#10000,5,5,0)
|
||||
successor(#20089,#20003)
|
||||
numlines(#10000,6,6,0)
|
||||
filetype(#10000,"javascript")
|
||||
|
||||
BIN
javascript/extractor/tests/regexp/output/trap/tst.js.trap
Normal file
BIN
javascript/extractor/tests/regexp/output/trap/tst.js.trap
Normal file
Binary file not shown.
Reference in New Issue
Block a user