Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

JS: Add ECMAScript 2024 v Flag Operators for Regex Parsing #18899

Open
wants to merge 19 commits into
base: main
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Added test cases for subtraction --.
  • Loading branch information
Napalys committed Mar 3, 2025
commit ee83c42b7197b7b7fafcf88d541ff1ecdef3795d
3 changes: 3 additions & 0 deletions javascript/extractor/tests/es2024/input/subtraction.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
/[\p{Script_Extensions=Greek}--\p{Letter}]/v;
/[[abc]--[cbd]]/v;
/[[abc]--[cbd]--[bde]]/v;
328 changes: 328 additions & 0 deletions javascript/extractor/tests/es2024/output/trap/subtraction.js.trap
Original file line number Diff line number Diff line change
@@ -0,0 +1,328 @@
#10000=@"/subtraction.js;sourcefile"
files(#10000,"/subtraction.js")
#10001=@"/;folder"
folders(#10001,"/")
containerparent(#10001,#10000)
#10002=@"loc,{#10000},0,0,0,0"
locations_default(#10002,#10000,0,0,0,0)
hasLocation(#10000,#10002)
#20000=@"global_scope"
scopes(#20000,0)
#20001=@"script;{#10000},1,1"
#20002=*
lines(#20002,#20001,"/[\p{Script_Extensions=Greek}--\p{Letter}]/v;","
")
#20003=@"loc,{#10000},1,1,1,45"
locations_default(#20003,#10000,1,1,1,45)
hasLocation(#20002,#20003)
#20004=*
lines(#20004,#20001,"/[[abc]--[cbd]]/v;","
")
#20005=@"loc,{#10000},2,1,2,18"
locations_default(#20005,#10000,2,1,2,18)
hasLocation(#20004,#20005)
#20006=*
lines(#20006,#20001,"/[[abc]--[cbd]--[bde]]/v;","
")
#20007=@"loc,{#10000},3,1,3,25"
locations_default(#20007,#10000,3,1,3,25)
hasLocation(#20006,#20007)
numlines(#20001,3,3,0)
#20008=*
tokeninfo(#20008,5,#20001,0,"/[\p{Script_Extensions=Greek}--\p{Letter}]/v")
#20009=@"loc,{#10000},1,1,1,44"
locations_default(#20009,#10000,1,1,1,44)
hasLocation(#20008,#20009)
#20010=*
tokeninfo(#20010,8,#20001,1,";")
#20011=@"loc,{#10000},1,45,1,45"
locations_default(#20011,#10000,1,45,1,45)
hasLocation(#20010,#20011)
#20012=*
tokeninfo(#20012,5,#20001,2,"/[[abc]--[cbd]]/v")
#20013=@"loc,{#10000},2,1,2,17"
locations_default(#20013,#10000,2,1,2,17)
hasLocation(#20012,#20013)
#20014=*
tokeninfo(#20014,8,#20001,3,";")
#20015=@"loc,{#10000},2,18,2,18"
locations_default(#20015,#10000,2,18,2,18)
hasLocation(#20014,#20015)
#20016=*
tokeninfo(#20016,5,#20001,4,"/[[abc]--[cbd]--[bde]]/v")
#20017=@"loc,{#10000},3,1,3,24"
locations_default(#20017,#10000,3,1,3,24)
hasLocation(#20016,#20017)
#20018=*
tokeninfo(#20018,8,#20001,5,";")
#20019=@"loc,{#10000},3,25,3,25"
locations_default(#20019,#10000,3,25,3,25)
hasLocation(#20018,#20019)
#20020=*
tokeninfo(#20020,0,#20001,6,"")
#20021=@"loc,{#10000},4,1,4,0"
locations_default(#20021,#10000,4,1,4,0)
hasLocation(#20020,#20021)
toplevels(#20001,0)
#20022=@"loc,{#10000},1,1,4,0"
locations_default(#20022,#10000,1,1,4,0)
hasLocation(#20001,#20022)
#20023=*
stmts(#20023,2,#20001,0,"/[\p{Sc ... er}]/v;")
hasLocation(#20023,#20003)
stmt_containers(#20023,#20001)
#20024=*
exprs(#20024,5,#20023,0,"/[\p{Sc ... ter}]/v")
hasLocation(#20024,#20009)
enclosing_stmt(#20024,#20023)
expr_containers(#20024,#20001)
literals("/[\p{Script_Extensions=Greek}--\p{Letter}]/v","/[\p{Script_Extensions=Greek}--\p{Letter}]/v",#20024)
#20025=*
regexpterm(#20025,23,#20024,0,"[\p{Script_Extensions=Greek}--\p{Letter}]")
#20026=@"loc,{#10000},1,2,1,42"
locations_default(#20026,#10000,1,2,1,42)
hasLocation(#20025,#20026)
#20027=*
regexpterm(#20027,24,#20025,0,"\p{Script_Extensions=Greek}--")
#20028=@"loc,{#10000},1,3,1,31"
locations_default(#20028,#10000,1,3,1,31)
hasLocation(#20027,#20028)
#20029=*
regexpterm(#20029,27,#20027,0,"\p{Script_Extensions=Greek}")
#20030=@"loc,{#10000},1,3,1,29"
locations_default(#20030,#10000,1,3,1,29)
hasLocation(#20029,#20030)
unicode_property_escapename(#20029,"Script_Extensions")
unicode_property_escapevalue(#20029,"Greek")
#20031=*
regexpterm(#20031,14,#20027,1,"-")
#20032=@"loc,{#10000},1,31,1,31"
locations_default(#20032,#10000,1,31,1,31)
hasLocation(#20031,#20032)
regexp_const_value(#20031,"-")
#20033=*
regexpterm(#20033,27,#20025,1,"\p{Letter}")
#20034=@"loc,{#10000},1,32,1,41"
locations_default(#20034,#10000,1,32,1,41)
hasLocation(#20033,#20034)
unicode_property_escapename(#20033,"Letter")
#20035=*
stmts(#20035,2,#20001,1,"/[[abc]--[cbd]]/v;")
hasLocation(#20035,#20005)
stmt_containers(#20035,#20001)
#20036=*
exprs(#20036,5,#20035,0,"/[[abc]--[cbd]]/v")
hasLocation(#20036,#20013)
enclosing_stmt(#20036,#20035)
expr_containers(#20036,#20001)
literals("/[[abc]--[cbd]]/v","/[[abc]--[cbd]]/v",#20036)
#20037=*
regexpterm(#20037,1,#20036,0,"[[abc]--[cbd]]")
#20038=@"loc,{#10000},2,2,2,15"
locations_default(#20038,#10000,2,2,2,15)
hasLocation(#20037,#20038)
#20039=*
regexpterm(#20039,23,#20037,0,"[[abc]--[cbd]")
#20040=@"loc,{#10000},2,2,2,14"
locations_default(#20040,#10000,2,2,2,14)
hasLocation(#20039,#20040)
#20041=*
regexpterm(#20041,23,#20039,0,"[abc]")
#20042=@"loc,{#10000},2,3,2,7"
locations_default(#20042,#10000,2,3,2,7)
hasLocation(#20041,#20042)
#20043=*
regexpterm(#20043,14,#20041,0,"a")
#20044=@"loc,{#10000},2,4,2,4"
locations_default(#20044,#10000,2,4,2,4)
hasLocation(#20043,#20044)
regexp_const_value(#20043,"a")
#20045=*
regexpterm(#20045,14,#20041,1,"b")
#20046=@"loc,{#10000},2,5,2,5"
locations_default(#20046,#10000,2,5,2,5)
hasLocation(#20045,#20046)
regexp_const_value(#20045,"b")
#20047=*
regexpterm(#20047,14,#20041,2,"c")
#20048=@"loc,{#10000},2,6,2,6"
locations_default(#20048,#10000,2,6,2,6)
hasLocation(#20047,#20048)
regexp_const_value(#20047,"c")
#20049=*
regexpterm(#20049,24,#20039,1,"--[")
#20050=@"loc,{#10000},2,8,2,10"
locations_default(#20050,#10000,2,8,2,10)
hasLocation(#20049,#20050)
#20051=*
regexpterm(#20051,14,#20049,0,"-")
#20052=@"loc,{#10000},2,8,2,8"
locations_default(#20052,#10000,2,8,2,8)
hasLocation(#20051,#20052)
regexp_const_value(#20051,"-")
#20053=*
regexpterm(#20053,14,#20049,1,"[")
#20054=@"loc,{#10000},2,10,2,10"
locations_default(#20054,#10000,2,10,2,10)
hasLocation(#20053,#20054)
regexp_const_value(#20053,"[")
#20055=*
regexpterm(#20055,14,#20039,2,"c")
#20056=@"loc,{#10000},2,11,2,11"
locations_default(#20056,#10000,2,11,2,11)
hasLocation(#20055,#20056)
regexp_const_value(#20055,"c")
#20057=*
regexpterm(#20057,14,#20039,3,"b")
#20058=@"loc,{#10000},2,12,2,12"
locations_default(#20058,#10000,2,12,2,12)
hasLocation(#20057,#20058)
regexp_const_value(#20057,"b")
#20059=*
regexpterm(#20059,14,#20039,4,"d")
#20060=@"loc,{#10000},2,13,2,13"
locations_default(#20060,#10000,2,13,2,13)
hasLocation(#20059,#20060)
regexp_const_value(#20059,"d")
#20061=*
regexpterm(#20061,14,#20037,1,"]")
#20062=@"loc,{#10000},2,15,2,15"
locations_default(#20062,#10000,2,15,2,15)
hasLocation(#20061,#20062)
regexp_const_value(#20061,"]")
#20063=*
regexp_parse_errors(#20063,#20037,"unexpected character")
hasLocation(#20063,#20062)
#20064=*
stmts(#20064,2,#20001,2,"/[[abc] ... de]]/v;")
hasLocation(#20064,#20007)
stmt_containers(#20064,#20001)
#20065=*
exprs(#20065,5,#20064,0,"/[[abc] ... bde]]/v")
hasLocation(#20065,#20017)
enclosing_stmt(#20065,#20064)
expr_containers(#20065,#20001)
literals("/[[abc]--[cbd]--[bde]]/v","/[[abc]--[cbd]--[bde]]/v",#20065)
#20066=*
regexpterm(#20066,1,#20065,0,"[[abc]--[cbd]--[bde]]")
#20067=@"loc,{#10000},3,2,3,22"
locations_default(#20067,#10000,3,2,3,22)
hasLocation(#20066,#20067)
#20068=*
regexpterm(#20068,23,#20066,0,"[[abc]--[cbd]")
#20069=@"loc,{#10000},3,2,3,14"
locations_default(#20069,#10000,3,2,3,14)
hasLocation(#20068,#20069)
#20070=*
regexpterm(#20070,23,#20068,0,"[abc]")
#20071=@"loc,{#10000},3,3,3,7"
locations_default(#20071,#10000,3,3,3,7)
hasLocation(#20070,#20071)
#20072=*
regexpterm(#20072,14,#20070,0,"a")
#20073=@"loc,{#10000},3,4,3,4"
locations_default(#20073,#10000,3,4,3,4)
hasLocation(#20072,#20073)
regexp_const_value(#20072,"a")
#20074=*
regexpterm(#20074,14,#20070,1,"b")
#20075=@"loc,{#10000},3,5,3,5"
locations_default(#20075,#10000,3,5,3,5)
hasLocation(#20074,#20075)
regexp_const_value(#20074,"b")
#20076=*
regexpterm(#20076,14,#20070,2,"c")
#20077=@"loc,{#10000},3,6,3,6"
locations_default(#20077,#10000,3,6,3,6)
hasLocation(#20076,#20077)
regexp_const_value(#20076,"c")
#20078=*
regexpterm(#20078,24,#20068,1,"--[")
#20079=@"loc,{#10000},3,8,3,10"
locations_default(#20079,#10000,3,8,3,10)
hasLocation(#20078,#20079)
#20080=*
regexpterm(#20080,14,#20078,0,"-")
#20081=@"loc,{#10000},3,8,3,8"
locations_default(#20081,#10000,3,8,3,8)
hasLocation(#20080,#20081)
regexp_const_value(#20080,"-")
#20082=*
regexpterm(#20082,14,#20078,1,"[")
#20083=@"loc,{#10000},3,10,3,10"
locations_default(#20083,#10000,3,10,3,10)
hasLocation(#20082,#20083)
regexp_const_value(#20082,"[")
#20084=*
regexpterm(#20084,14,#20068,2,"c")
#20085=@"loc,{#10000},3,11,3,11"
locations_default(#20085,#10000,3,11,3,11)
hasLocation(#20084,#20085)
regexp_const_value(#20084,"c")
#20086=*
regexpterm(#20086,14,#20068,3,"b")
#20087=@"loc,{#10000},3,12,3,12"
locations_default(#20087,#10000,3,12,3,12)
hasLocation(#20086,#20087)
regexp_const_value(#20086,"b")
#20088=*
regexpterm(#20088,14,#20068,4,"d")
#20089=@"loc,{#10000},3,13,3,13"
locations_default(#20089,#10000,3,13,3,13)
hasLocation(#20088,#20089)
regexp_const_value(#20088,"d")
#20090=*
regexpterm(#20090,14,#20066,1,"--")
#20091=@"loc,{#10000},3,15,3,16"
locations_default(#20091,#10000,3,15,3,16)
hasLocation(#20090,#20091)
regexp_const_value(#20090,"--")
#20092=*
regexpterm(#20092,23,#20066,2,"[bde]")
#20093=@"loc,{#10000},3,17,3,21"
locations_default(#20093,#10000,3,17,3,21)
hasLocation(#20092,#20093)
#20094=*
regexpterm(#20094,14,#20092,0,"b")
#20095=@"loc,{#10000},3,18,3,18"
locations_default(#20095,#10000,3,18,3,18)
hasLocation(#20094,#20095)
regexp_const_value(#20094,"b")
#20096=*
regexpterm(#20096,14,#20092,1,"d")
#20097=@"loc,{#10000},3,19,3,19"
locations_default(#20097,#10000,3,19,3,19)
hasLocation(#20096,#20097)
regexp_const_value(#20096,"d")
#20098=*
regexpterm(#20098,14,#20092,2,"e")
#20099=@"loc,{#10000},3,20,3,20"
locations_default(#20099,#10000,3,20,3,20)
hasLocation(#20098,#20099)
regexp_const_value(#20098,"e")
#20100=*
regexpterm(#20100,14,#20066,3,"]")
#20101=@"loc,{#10000},3,22,3,22"
locations_default(#20101,#10000,3,22,3,22)
hasLocation(#20100,#20101)
regexp_const_value(#20100,"]")
#20102=*
regexp_parse_errors(#20102,#20066,"unexpected character")
hasLocation(#20102,#20101)
#20103=*
entry_cfg_node(#20103,#20001)
#20104=@"loc,{#10000},1,1,1,0"
locations_default(#20104,#10000,1,1,1,0)
hasLocation(#20103,#20104)
#20105=*
exit_cfg_node(#20105,#20001)
hasLocation(#20105,#20021)
successor(#20064,#20065)
successor(#20065,#20105)
successor(#20035,#20036)
successor(#20036,#20064)
successor(#20023,#20024)
successor(#20024,#20035)
successor(#20103,#20023)
numlines(#10000,3,3,0)
filetype(#10000,"javascript")