-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapex.min.js
108 lines (108 loc) · 11.9 KB
/
apex.min.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
/*! `apex` grammar compiled for Highlight.js 11.11.1 */
(()=>{var e=(()=>{"use strict";return e=>{
const t=e.regex,a="[a-zA-Z][a-zA-Z_0-9]*",n="\\b"+a+"\\b",c="@"+a,s=/(?=\s*\()/,o=/\s+/,r=/\?\./,i=[{
match:/(?<!\?)\./,scope:"punctuation",relevance:0},{match:r,scope:"operator",
relevance:0}];function l(...e){return t.concat("(?!",e.join("|"),")")}const p={
scope:"number",
match:t.either(/\b(\d{4}\-\d{2}\-\d{2}T\d{2}\:\d{2}\:\d{2}(\.\d{1,3})?(\-|\+)\d{2}\:\d{2})\b/,/\b(\d{4}\-\d{2}\-\d{2}T\d{2}\:\d{2}\:\d{2}(\.\d{1,3})?(Z)?)\b/,/\b(\d{4}\-\d{2}\-\d{2})\b/,/\b0(x|X)[0-9a-fA-F_]+(U|u|L|l|UL|Ul|uL|ul|LU|Lu|lU|lu)?\b/,/\b0(b|B)[01_]+(U|u|L|l|UL|Ul|uL|ul|LU|Lu|lU|lu)?\b/,/\b([0-9]+)?\.[0-9]+((e|E)[0-9]+)?(F|f|D|d|M|m)?\b/,/(-?)\b[0-9]+(e|E)[0-9]+(F|f|D|d|M|m)?\b/,/(-?)\b[0-9]+(F|f|D|d|M|m)\b/,/(-?)\b[0-9]+(U|u|L|l|UL|Ul|uL|ul|LU|Lu|lU|lu)?\b/,/(-?)(\b0[0-9]+|(\b\d+(\.\d*)?|\.\d+)([eE][-+]?\d+)?)/),
relevance:0
},b=["try","catch","finally","get","set","put","if","for","else","do","while","continue","break","implements","extends","return","throw","when","new"],u=["instanceof","super","this"],d=["abstract","final","global","override","private","protected","public","static","testMethod","transient","virtual","webservice"],m=["anytype|0","blob|0","boolean|0","byte|0","currency|0","date|0","datetime|0","decimal|0","double|0","enum|0","float|0","integer|0","long|0","object|0","pagereference|8","selectoption|8","short|0","sobject|10","string|0","time|0","void|0","float|0"],E=["insert","update","upsert","delete","undelete","merge","convertLead"],h=["AppLauncher","Approval","Auth","Cache","Canvas","ChatterAnswers","CommerceOrders","fsccashflow","CommercePayments","ConnectApi","Context","Database","Datacloud","DataRetrieval","DataSource","Dataweave","Dom","EventBus","ExternalService","Flow","FormulaEval","Functions","id_verification","industriesDigitalLending","Invocable","KbManagement","LxScheduler","Messaging","Metadata","Pref_center","Process","QuickAction","Reports","RichMessageing","Schema","Search","Sfc","Sfdc_Checkout","IndustriesNlpSvc","PlaceQuote","Sfdc_Enablement","sfdc_surveys","Site","Slack","Support","System","TerritoryMgmt","TxnSecurity","UserProvisioning","VisualEditor","Wave"],v=["Address","Answers","ApexPages","Approval","Assert","AsyncInfo","AsyncOptions","BusinessHours","Cases","Collator","Compression","Continuation","Cookie","Crypto","Database","Date","Datetime","Decimal","Domain","DomainCreator","DomainParser","EmailMessages","EncodingUtil","EventBus","Exception","FeatureManagement","FlexQueue","Formula","FormulaRecalcFieldError","FormulaRecalcResult","Http","HttpRequest","HttpResponse","Ideas","IsvPartners","JSON","JSONGenerator","JSONParser","Label","Limits","Location","Matcher","Math","Messaging","MultiStaticResourceCalloutMock","Network","OrgLimit","OrgLimits","Packaging","PageReference","Pattern","QueueableDuplicateSignature","QueueableDuplicateSignature.Builder","QuickAction","Request","ResetPasswordResult","RestContext","RestRequest","RestResponse","Search","Security","SelectOption","Site","SObject","SObjectAccessDecision","StaticResourceCalloutMock","Test","TimeZone","Type","URL","UserInfo","UserManagement","UUID","Version","WebServiceCallout","XmlStreamReader","XmlStreamWriter"],A=["AccessType","AccessLevel","CallbackStatus","DomainType","JSONToken","LoggingLevel","Quiddity","TriggerOperation","operationType"],S=["false","true","null"],g={
match:/,/,scope:"punctuation",relevance:0
},R=[/--/,/\+\+/,/\&\&|\|\|/,/\*\=|\/\=|\%\=|\+\=|-\=/,/\&\=|\^\=|<<\=|>>\=|>>>\=|\|\=/,/\&|~|\^|\|/,/<<|>>/,/<\=|>\=|\s(<|>)\s/,/\=\=|!\=/,/\=>/,/!(?=\w)/,/(?<=\s)(\?|:)(?=\s)/,r,/(?<=\s)(\?\?)(?=\s)/,/(?<!\?)\?(?!\?|\.|\[)/,/%[^%]|\*[^\/]|\/[^\/\*]|(?<!\-)\-(?!\-)|(?<!\+)\+(?!\+)/,/(?<!\=|!)\=(?!\=|>)/],T=h.concat(...v),y={
$pattern:t.concat(/(?<!\.)\b/,a,/\b/),keyword:[...b,...d,...E],type:m,literal:S
},O=[...S,...b,...d,...h,...v,...A,...u,...E],L={
match:t.concat(/\b/,t.either(...u),/\b/),scope:"variable.language",relevance:0
},N=[{match:[t.concat(/\b/,t.either(...A)),/\./,a,/\b\s*(?![\.\(])/],scope:{
1:"built_in",2:"punctuation",3:"variable"},relevance:0},{
match:[t.concat(/\b/,t.either(...v)),/\./,a,/\b\s*(?![\.\(])/],scope:{
1:"built_in",2:"punctuation",3:"type"},relevance:0},{
match:[t.concat(/\b/,t.either(...h)),/\./,n,/\b(?=\.)/],scope:{1:"built_in",
2:"punctuation",3:"type"}},{
match:[t.concat(/\b/,t.either(...h,...v)),/\./,n,/\b(?!\.)/],scope:{
1:"built_in",2:"punctuation",3:"keyword"}},{
match:[/\bTrigger\b/,/\./,/(isExecuting|isInsert|isUpdate|isDelete|isBefore|isAfter|isUndelete|new|newMap|old|oldMap|size|operationType)\b(?!\.)/],
scope:{1:"built_in",2:"punctuation",3:"type"},relevance:10},{
match:[/\btrigger\b/,/\./,"operationtype",/\./,t.concat(n,/\b/)],scope:{
1:"built_in",2:"punctuation",3:"keyword",4:"punctuation",5:"variable.constant"},
relevance:10}],C=[{
match:t.either(",",/;/,/(?<=\w)\>/,/\<(?=\w)/,/\{|\}/,/\(|\)/,/\{|\}/),
scope:"punctuation",relevance:0},g],D=e.inherit(e.APOS_STRING_MODE,{
scope:"string",relevance:0,contains:[{match:/\\'/,scope:"literal",relevance:0}]
}),I=e.COMMENT("//",/[$\n]/,{relevance:0}),_=[e.COMMENT("/\\*","\\*/",{
relevance:0,contains:[{begin:/\w+@/,relevance:0},{
match:[/@(?:exception|throws)/,o,a],scope:{1:"doctag",3:"title.class"},
relevance:0},{begin:"@[A-Za-z_-]+",scope:"doctag",relevance:0},{
match:[/(?<=@param)\s+/,a],scope:{2:"variable"},relevance:0},{
contains:[e.BACKSLASH_ESCAPE],relevance:0,variants:[{begin:"`",end:"`",
scope:"string"},{begin:/'/,end:/'/,scope:"string"}],contains:[]}]}),I],w={
match:t.either(...R),scope:"operator",relevance:0},U={match:/(?<!\.)\bId\b/,
scope:"type",relevance:8},f=[{begin:/\b(list|set|map)(?=\s*<)/,
beginScope:"type",end:/\>+/,endScope:"punctuation",contains:[{match:/\<|\,/,
scope:"punctuation"},{match:n,scope:"type"}],relevance:8},{
match:[t.optional(n),/\[/,t.optional(/\d+/),/\]/],scope:{1:"variable",
2:"punctuation",3:"number",4:"punctuation"}},{match:[a,/\[\]/],scope:{1:"type",
2:"punctuation"},relevance:0}],M=[{match:t.concat(c,/\b(?!\s*\()/),scope:"meta"
},{scope:"meta",begin:[t.concat(c,/\b/),/\s*/,/\(/],beginScope:{3:"punctuation"
},end:/\)/,endScope:"punctuation",contains:[{match:[n,/\s*=/],scope:{
1:"keyword",2:"operator"},contains:[w]},D,p],keywords:{literal:S}}],k={
match:[/\b[a-zA-Z0-9\.]*Exception/,o,a],scope:{1:"type",3:"variable"},
relevance:0},F=[{match:[/(?<!\.)/,n,/\s*(?=\=[^\>])/],scope:{2:"variable"},
relevance:0},{match:[n,"(?=\\s+"+a+/\s*\=/+")"],scope:{1:"type"},relevance:0},{
match:[n,o,n,/\s*(?=\=[^\>])/],scope:{1:"type",3:"variable"},relevance:0}],P={
match:[/(?<=\=\s*\()/,a,"(?=\\)\\s*"+a+")"],scope:{2:"type"},relevance:0},Y={
match:[/\bnew\s+/,a,s],scope:{2:"type"},relevance:0};let W={scope:"params_call",
begin:/\(/,beginScope:"punctuation",end:/\)/,endScope:"punctuation",relevance:0,
keywords:y,contains:[]};const H=[{match:[/(?<=\.)/,a,s],scope:{
2:"title.function.invoke"},relevance:1,contains:[...i],starts:W},{
match:[/^\s*/,l(...b),a,s],scope:{3:"title.function.invoke"},relevance:1,
starts:W}];W.contains=[D,Y,_,w,f,N,p,U,H,{keywords:{KEYWORDS:y},
match:t.concat(/(?<=\s|\(|\,)/,l(...S),a,/\b/,/(?!\.)/),scope:"variable",
relevance:0},{match:/\(|\,|\./,scope:"punctuation",relevance:0},{match:a,
scope:"variable"}];const x={scope:"params",end:/\)/,endScope:"punctuation",
relevance:1,keywords:y,contains:[p,D,_,f,...N,{match:/\,|\(/,scope:"punctuation"
},U,{match:[/(?<=\(|\,)\s*/,a,/(?=\s)/],scope:{2:"type"}},{
match:[o,a,/\s*(?=[,)])/],scope:{2:"variable"}}]},B={
match:[/\bswitch\s+on\s+/,a],scope:{1:"keyword",2:"variable"}};return{
name:"Apex",aliases:["apex","lightning","soql","sosl"],case_insensitive:!0,
disableAutodetect:!1,ignoreIllegals:!1,keywords:y,
illegal:["</","<#","<]","<div>","\x3c!--","!DOCTYPE",/<iframe\b/,/^#/,/^import \.[a-zA-Z]+\./,/^import [\w]+/,/^import$/,/^include </,/^use\s+</,/\b(const|var)\s+\w+\s*=/,/\bstruct\b/,"System.log","console.log",/\bfor\s+\w+\s+IN\s+/,/\bif\s+\w+\s+IN\s+/,/\bend\s+if\b/,/\bend\s+select\b/,/\b(int|var)\s+\w+\s+=/,/\b(int[0-9]+|bool)\b/,/\b\$/,/\b_/,"::=",/\s#[a-zA-Z]/,/\s_[a-zA-Z]/,/\s\$[a-zA-Z]/,"#if","%if",/\bif(?!\s+\()/,"%endif","#endif","#_",/\d\s+\d/,/\w::\w/,/\bfloat\b/,/(SELECT|RETURNING)\s+\*/,/END\s+LOOP/,/CREATE\s+FUNCTION/,/\bint\b/,/import\s+\w+\s+=\s+require\("\w+"\)/,"/^include\b/",/\buse\s+strict\b/,/\w+\s+=\s+"\S*";/,/\/include\//,/\Anamespace\b/,/\bend(\.)?\n/,'"""',/\+\+\+/,/<%/,"<%#","%%>","<%%",":-",/\bmergesort\(/,/\bvar\s+env\b/,/\bdef\b\s\W:/,/"[^"]+"/,/\(\*|\*\)/],
contains:[_,M,D,p,P,f,[{begin:[/\btrigger/,o,a,o,"on",o,a],beginScope:{
1:"keyword",3:"title.class",5:"operator",7:"type"},end:/(?=\{)/,returnEnd:!0,
contains:[_,{begin:/\(/,end:/\)/,contains:[{
match:/\b(before|after)\s+(insert|update|delete|merge|undelete)\b/,
scope:"keyword",relevance:5},g]}]},{relevance:5,
match:/\b(with|without|inherited)\s+sharing\b/,scope:"keyword"},{
begin:[/(?!\.)/,/\b(class|interface)\b(?!\?|\.)/],beginScope:{2:"keyword"},
end:/(?=\{)/,relevance:1,keywords:{type:m,keyword:b},contains:[{
match:[/(?<=\bclass)\s+/,a],scope:{2:"title.class"}},{returnEnd:!0,
endsWithParent:!0,beginKeywords:"implements extends",end:/\{/,contains:[{
match:[n,/(?=\.)/],scope:{1:"built_in"}},{match:t.concat(n,/(?=\>)/),
scope:"type"},{match:n,scope:"title.class.inherited"},{match:/<|>|,/,
scope:"punctuation"},N],relevance:0}]},{begin:[/\benum\s+/,a,/\s*\{/],
beginScope:{2:"type",3:"punctuation"},end:/\}/,endScope:"punctuation",
relevance:0,contains:[_,g,{match:t.concat(n),scope:"variable.constant"}]},{
match:[/(public|private|protected)\s+/,a,s],scope:{1:"keyword",
2:"title.function"},starts:x,relevance:1},{
match:[/(?<!new)(?<!return)(?<=\<|\>|\w)\s+/,a,s],scope:{2:"title.function"},
relevance:1,starts:x}],[{match:/as\s+(user|system)\b/,scope:"keyword",
relevance:5}],k,{match:[/\bfor\b\s*/,/\(/,a,o,a,/\s*/,/:/],scope:{3:"type",
5:"variable",7:"operator"}},H,Y,L,N,U,{begin:[/\[/,/\s*(?=(SELECT|FIND)\b)/],
end:/\]/,beginScope:{1:"punctuation"},endScope:"punctuation",scope:"soql",
relevance:10,endsWithParent:!0,keywords:{literal:y.literal,built_in:T},
contains:[p,w,D,g,{match:/\(|\)/,scope:"punctuation",relevance:0},...i,{
begin:[/\bFROM\b/,o],beginScope:{1:"keyword"},end:/(?=\bWHERE\b|\]|\s|\))/,
contains:[{match:a,scope:"type"},...i]},{
match:t.concat(/\b/,t.either("CALENDAR_MONTH","CALENDAR_QUARTER","CALENDAR_YEAR","DAY_IN_MONTH","DAY_IN_WEEK","DAY_IN_YEAR","DAY_ONLY","FISCAL_MONTH","FISCAL_QUARTER","FISCAL_YEAR","HOUR_IN_DAY","WEEK_IN_MONTH","WEEK_IN_YEAR","AVG","convertCurrency","convertTimezone","COUNT_DISTINCT","COUNT","DISTANCE","EXCLUDES","FIELDS","FORMAT","GEOLOCATION","GROUPING","ROLLUP","CUBE","INCLUDES","MAX","MIN","SUM","toLabel","USER_MODE","SYSTEM_MODE","SECURITY_ENFORCED"),/\b/),
scope:"title.function"},{match:/\b(GROUP|ORDER)\s+BY\b/,scope:"title.function"
},{match:/\b(TODAY|TOMORROW|YESTERDAY)\b/,scope:"keyword"},{
match:/(NEXT|LAST|THIS)_(90_DAY|DAY|FISCAL_QUARTER|FISCAL_YEAR|MONTH|QUARTER|WEEK|YEAR)S?\b/,
scope:"keyword",relevance:8},{
match:[/(NEXT|LAST)_N_(DAY|FISCAL_QUARTER|FISCAL_YEAR|MONTH|QUARTER|WEEK|YEAR)S/,/\s*:\s*/,/\d+/],
scope:{1:"keyword",2:"operator",3:"number"},relevance:8},{
match:t.concat(/\b/,t.either(...y.keyword,"ABOVE_OR_BELOW","ABOVE","ACTIVE","ADVANCED","ALL","ANY","ARRAY","AS","ASC","BELOW","CATEGORY","CONTAINS","CUSTOM","DATA","DESC","DIVISION","ELSE","END","FIND","FROM","METADATA","NETWORK","ON","PricebookId","RETURNING","ROLLUP","ROWS","SEARCH","SELECT","SNIPPET","SORT","SPELL_CORRECTION","STANDARD","THEN","USING","WHEN","WHERE","WITH","SCOPE","Delegated","Everything","Mine","My_Territory","My_Team_Territory","Team","AND","AT","FIRST","FOR","HAVING","IN","LAST","LIKE","LIMIT","LISTVIEW","NOT","NULLS","OFFSET","OR","REFERENCE","TRACKING","TYPEOF","UPDATE","VIEW","VIEWSTAT"),/\b/),
scope:"keyword"},{match:[/(?<=:)/,/\s*/,n,/(?!\()/],scope:{3:"variable"},
relevance:0},{match:[/(?<=:|\.)/,a,/(?=\s*\()/],scope:{2:"title.function.invoke"
},relevance:0},{match:/:/,scope:"operator",relevance:0}],illegal:"::"
},B,F,w,C,i,{match:t.concat("(?<=this.)",a,"(?!\\()"),scope:"variable"},{
match:[t.concat(/\b/,l(...O)),a,o,/(?=\{)/],scope:{2:"property"},relevance:0}]}}
})();hljs.registerLanguage("apex",e)})();