Skip to content

Commit

Permalink
working alpha
Browse files Browse the repository at this point in the history
  • Loading branch information
dschach committed Oct 26, 2023
1 parent 129c92c commit e691c60
Show file tree
Hide file tree
Showing 5 changed files with 200 additions and 224 deletions.
4 changes: 3 additions & 1 deletion demo/testcode.html
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@

Integer myInt = 8 - 7++;

public List<String> myString { get; set; }
public List&lt;String&gt; myString { get; set; }

List&lt;Opportunity&gt; opps = [SELECT Id FROM Opportunity WHERE Id NOT IN :newRecordsMap.keySet()];

Expand All @@ -55,6 +55,8 @@
}
System.URL.getCurrentRequestUrl();
System.getCurrentRequestUrl();

public List&lt;SelectOption&gt; recordTypes { get; private set; }
</code></pre>
<p>-------NEW LANGUAGE----------</p>
<pre><code class="language-apex">
Expand Down
114 changes: 56 additions & 58 deletions dist/apex.es.min.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,82 +22,79 @@ match:[/\b/,t.either(...u),/\./,a,/(?=\()/],scope:{2:"title.class",
scope:{2:"title.class"},relevance:4},{
match:[/\b/,t.either("Callable","Comparable","Comparator","HttpCalloutMock","InstallHandler","Queueable","QueueableContext","SandboxPostCopy","Schedulable","SchedulableContext","StubProvider","UninstallHandler","WebServiceMock"),/\b/],
scope:{2:"title.class.inherited"},relevance:8}],S={match:[/\bswitch\s+on\s+/,a],
scope:{1:"keyword",2:"variable"}},A={
match:t.concat(t.either(/(?<!=|!)\=(?!=|>)/,/--/,/\+\+/,/&&|\|\|/,/\*=|\/=|%=|\+=|-=/,/\&=|\^=|<<=|>>=|>>>=|\|=/,/\&|~|\^|\|/,/%[^%]|\*[^\/]|\/[^\/\*]|(?<!\-)\-(?!\-)|(?<!\+)\+(?!\+)/,/<<|>>/,/<=|>=|\s(<|>)\s/,/==|!=/,/=>/,/!(?=\w)/,/\&\&/,/(?<=\s)(\?|:)(?=\s)/,/\?\./,/(?<!\?)\?(?!\?|\.|\[)/),"{1}"),
scope:"operator",relevance:0},E={match:t.either(/(\{|\})/,",",/\(|\)/,";"),
scope:"punctuation",relevance:0},g=e.COMMENT("//",/[$\n]/,{relevance:0
}),T=e.COMMENT("/\\*","\\*/",{relevance:0,contains:[{begin:/\w+@/,relevance:0},{
scope:{1:"keyword",2:"variable"}
},A=[/(?<!=|!)\=(?!=|>)/,/--/,/\+\+/,/&&|\|\|/,/\*=|\/=|%=|\+=|-=/,/\&=|\^=|<<=|>>=|>>>=|\|=/,/\&|~|\^|\|/,/%[^%]|\*[^\/]|\/[^\/\*]|(?<!\-)\-(?!\-)|(?<!\+)\+(?!\+)/,/<<|>>/,/<=|>=|\s(<|>)\s/,/==|!=/,/=>/,/!(?=\w)/,/\&\&/,/(?<=\s)(\?|:)(?=\s)/,/\?\./,/(?<!\?)\?(?!\?|\.|\[)/],E={
match:t.concat(t.either(...A),"{1}"),scope:"operator",relevance:0},g={
match:t.either(/(\{|\})/,",",/\(|\)/,";"),scope:"punctuation",relevance:0
},v=e.COMMENT("//",/[$\n]/,{relevance:0}),T=e.COMMENT("/\\*","\\*/",{
relevance:0,contains:[{begin:/\w+@/,relevance:0},{
match:[/@(?:exception|throws)/,/\s+/,a],scope:{1:"doctag",3:"class.title"}},{
begin:/@[A-Za-z_]+\s/,scope:"doctag"},{begin:"`",end:"`",excludeBegin:!0,
excludeEnd:!0,scope:"code",contains:[e.BACKSLASH_ESCAPE],relevance:0
},e.inherit(e.APOS_STRING_MODE,{className:"meta string"}),{
match:[/(?<=@param)/,/\s+/,/\S+/],scope:{3:"variable"}}]}),v=[{
},e.inherit(e.APOS_STRING_MODE,{scope:"meta string"}),{
match:[/(?<=@param)/,/\s+/,/\S+/],scope:{3:"variable"}}]}),R=[{
match:t.concat(n,/\b(?!\s*\()/),scope:"meta"},{begin:[t.concat(n,/\b/),/\s*\(/],
beginScope:{1:"meta",2:"punctuation"},end:/\)/,endScope:"punctuation",
scope:"annotation",contains:[{match:[t.concat(/\b/,a),/(?=\s*=)/],scope:{
1:"meta keyword"},contains:[A]},e.inherit(e.APOS_STRING_MODE,{
className:"meta string"}),c],keywords:{literal:i}}],R=[{
1:"meta keyword"},contains:[E]},e.inherit(e.APOS_STRING_MODE,{
scope:"meta string"}),c],keywords:{literal:i}}],_=[{
match:[/\b[a-zA-Z0-9\.]*Exception\b/,/\s+/,a],scope:{1:"title.class",
3:"variable"},relevance:0}],_=[{scope:"collection",
3:"variable"},relevance:0}],O=[{scope:"collection",
begin:/\b(list|set|map)\s*(?=<)/,beginScope:"type",end:/>+/,
endScope:"punctuation",contains:[{match:/</,scope:"punctuation"},E,{
endScope:"punctuation",contains:[{match:/</,scope:"punctuation"},g,{
match:t.concat(/\b/,a,/\b/),scope:"type"}],relevance:10},{match:[a,/\s*\[\]/],
scope:{1:"type",2:"punctuation"},contains:[E],relevance:0}],O={
scope:"assignment",relevance:0,contains:[E,A],variants:[{
scope:{1:"type",2:"punctuation"},contains:[g],relevance:0}],N={
scope:"assignment",relevance:0,contains:[g,E],variants:[{
match:[a,/\s+/,a,/(?=\s*\=)/],scope:{1:"type",3:"variable assigned"}},{
match:[a,/\s+/,a,/\s+/,";"],scope:{1:"type",3:"variable declare"}},{
match:[/(?<!\.)\b/,a,/(?=\s*\=)/],scope:{2:"variable mynum"}},{
match:[/(?<==)\s*/,/\(/,a,/\)/],scope:{2:"punctuation",3:"type",4:"punctuation"}
}]};t.concat(/\b/,a,/__(c|pc|r|b|e|mdt|x|share|kav|ka|history|del|s)/,/\b/)
;const N=[{match:[a,t.concat(/\b/,a,/\b[ \n\t]*/),/\{/],scope:{1:"type",
2:"property"}},{match:[t.concat(/\b/,a,/\b/),/[ \n\t]*\{/],scope:{1:"property"}
}],y={scope:"params",begin:/\(/,beginScope:"punctuation",end:/\)/,
endScope:"punctuation",endsParent:!0,relevance:0,
contains:[c,e.APOS_STRING_MODE,g,T,A,O,_,m,h,{
;const y={scope:"params",begin:/\(/,end:/\)/,endsParent:!0,relevance:0,
contains:[c,e.APOS_STRING_MODE,v,T,E,N,O,m,h,m,c,{
match:[t.concat(/(?<=[,\(])\s*/,a),/\./,a,/\s*(?=[,)])/],scope:{1:"variable",
3:"variable"}},{match:[t.concat(/\b/,a),/\s+/,a,/\s*(?=[,)])/],scope:{1:"type",
3:"variable"}},{match:[a,/\s*(?=[,)])/],scope:{1:"variable"}}]},D=[{
3:"variable"}},{match:[a,/\s*(?=[,)])/],scope:{1:"variable"}}]},I=[{
begin:[/\bnew\b/,/\s+/,a,/\s*(?=\()/],beginScope:{1:"keyword",
3:"title.function.invoke"},end:/\)/,returnEnd:!0,scope:"instantiate",
contains:[y,g,E],illegal:":",relevance:0}],I={end:/(?=\)\s*[^{])/,returnEnd:!0,
contains:[y,v,g],illegal:":",relevance:0}],D={end:/(?=\)\s*[^{])/,returnEnd:!0,
scope:"method_call",relevance:0,variants:[{begin:t.concat(a,/(?=\s*\()/),
beginScope:"title.function.invoke"},{
begin:[t.either(...p),/\./,t.concat(a,/(?=\s*\()/)],beginScope:{1:"built_in",
3:"title.function.invoke"}},{begin:[a,/\./,t.concat(a,/(?=\s*\()/)],beginScope:{
1:"class.title",3:"title.function.invoke"}}],
contains:[g,T,e.APOS_STRING_MODE,y,D],relevance:0,illegal:[].concat(...s)},C={
match:[/\bTrigger\b/,/\./,t.either("isExecuting","isInsert","isUpdate","isDelete","isBefore","isAfter","isUndelete","new","newMap","old","oldMap","size","operationType"),/\b/],
scope:{1:"built_in",3:"keyword"},relevance:10},L={
begin:[/\btrigger/,/\s+/,a,/\s+/,"on",/\s+/,a],beginScope:{1:"keyword",
contains:[v,T,e.APOS_STRING_MODE,y,I,"self"],relevance:0,illegal:[].concat(...s)
},C={begin:[/\btrigger/,/\s+/,a,/\s+/,"on",/\s+/,a],beginScope:{1:"keyword",
3:"title.class",5:"operator",7:"type"},end:"{",returnEnd:!0,
scope:"trigger_declaration",contains:[g,T,{begin:/\(/,beginScope:"punctuation",
scope:"trigger_declaration",contains:[v,T,{begin:/\(/,beginScope:"punctuation",
end:/\)/,endScope:"punctuation",scope:"trigger_params",contains:[{
match:/\b(before|after)\s+(insert|update|delete|merge|undelete)\b/,
scope:"built_in"}]}]},M={beginKeywords:"class",returnBegin:!0,end:/\{/,
endScope:"punctuation",returnEnd:!0,scope:"class_declaration",keywords:{type:r,
keyword:s},contains:[{match:[/(?<=\bclass\b)\s+/,a],scope:{2:"title.class"}},{
returnEnd:!0,endsWithParent:!0,variants:[{beginKeywords:"implements",
scope:"built_in"}]}]},L={begin:/\bclass\b/,beginScope:"keyword",end:/\{/,
endScope:"punctuation",scope:"class_declaration",keywords:{type:r,keyword:s},
contains:[{match:[/(?<=\bclass\b)\s+/,a],scope:{2:"title.class"}},{returnEnd:!0,
endsWithParent:!0,variants:[{beginKeywords:"implements",
end:/(\b(extends)\b)|\{/,scope:"implements block"},{beginKeywords:"extends",
end:/(\b(implements)\b)|\{/,scope:"extends block"}],contains:[{match:/\<|\>/,
scope:"punctuation"},{match:t.concat(/\b/,t.either(...p),/\b\s*(?!<>)/),
scope:"built_in"},{match:[/\b/,a,/\./,a,/(?=[,\s<])/],scope:{2:"built_in",
4:"title.class.inherited"}},{match:[/\b/,a,/(?=>)/],scope:{2:"type"}},{
match:t.concat(/\b/,a,/\b(?!<)/),scope:"title.class.inherited"},{
match:t.concat(/\b/,t.either(...b),/\b\s*(?!>)/),scope:"title.class.inherited"}]
}]},U=[L,{relevance:10,match:/\b(with|without|inherited)\s+sharing\b/,
scope:"keyword"},C,{begin:[/\benum\s+/,a,/\s*/,/\{/],beginScope:{1:"type",
2:"type"},end:/[\}\n]/,returnEnd:!0,scope:"enum_declaration",relevance:0,
contains:[g,T,E,{match:t.concat(/\b/,a,/\b/),scope:"variable.constant"}]
},M].concat(N),w=[{match:[/(?<=\breturn\b)\s+/,t.either(i),/(?=\s*;)/],scope:{
2:"literal"}},{match:[/(?<=\breturn\b)/,/\s+/,a,/(?=\s*;)/],scope:{3:"variable"}
},{match:[/(?<=\breturn\b)/,/\s+/,t.lookahead(a+/\(/)],scope:{
2:"title.function.invoke"}}],f={begin:[/\[/,/\s*/,/\b(SELECT|FIND)\b/],
beginScope:{1:"punctuation",3:"keyword soql"},end:/\]/,
endScope:"punctuation outer",scope:"soql",relevance:10,contains:[{
begin:[/\bFROM\b/,t.concat(/\s+/,a,/\b/)],beginScope:{1:"keyword",2:"type"},
scope:"from_clause",end:/(?=\]|\s)/,contains:[{match:[/(?<=\.)/,a,/\b/],scope:{
2:"type"}},E]},{match:/\]/,scope:"punctuation",endsParent:!0},{
match:/\b\s*IN|=\s*:/,scope:"operator"},{
}]},M=[C,{relevance:10,match:/\b(with|without|inherited)\s+sharing\b/,
scope:"keyword"},{
match:[/\bTrigger/,/\./,/(isExecuting|isInsert|isUpdate|isDelete|isBefore|isAfter|isUndelete|new|newMap|old|oldMap|size|operationType)\b/],
scope:{1:"built_in",3:"keyword"},relevance:10},{
begin:[/\benum\s+/,a,/\s*/,/\{/],beginScope:{1:"type",2:"type"},end:/[\}\n]/,
returnEnd:!0,scope:"enum_declaration",relevance:0,contains:[v,T,g,{
match:t.concat(/\b/,a,/\b/),scope:"variable.constant"}]},L],U=[{
match:[/\breturn\b/,/\s+/,a,";"],scope:{3:"variable"}},{
match:[/\breturn\b/,/\s+/,t.lookahead(a+/\(/)],scope:{2:"title.function.invoke"}
}],w={begin:[/\[/,/\s*/,/\b(SELECT|FIND)\b/],beginScope:{1:"punctuation",
3:"keyword soql"},end:/\]/,endScope:"punctuation outer",scope:"soql",
relevance:10,contains:[{begin:[/\bFROM\b/,t.concat(/\s+/,a,/\b/)],beginScope:{
1:"keyword",2:"type"},scope:"from_clause",end:/(?=\]|\s)/,contains:[{
match:[/(?<=\.)/,a,/\b/],scope:{2:"type"}},g]},{match:/\]/,scope:"punctuation",
endsParent:!0},{match:/\b\s*IN|=\s*:/,scope:"operator"},{
begin:t.concat(/\b/,t.either("ABOVE_OR_BELOW","ACTIVE","ADVANCED","ALL","ANY","ARRAY","AS","BY","CATEGORY","CONTAINS","CUSTOM","DATA","DIVISION","END","FIELDS","FIND","FROM","LAST","METADATA","NETWORK","ON","RETURNING","ROLLUP","ROWS","SEARCH","SELECT","SNIPPET","SORT","STANDARD","USER_MODE","WHERE",/USING\s+SCOPE\s*(Delegated|Everything|Mine|My_Territory|My_Team_Territory|Team)/,/WITH\s+SECURITY_ENFORCED/),/\b/),
scope:"keyword soql",relevance:0},{
match:t.concat(/\b/,t.either("ABOVE","AND","ASC","AT","DESC","HAVING","IN","LIKE","LIMIT","LISTVIEW","NOT","OFFSET","OR","TRACKING","TYPEOF","UPDATE","VIEWSTAT",/FOR\s+REFERENCE/,/FOR\s+UPDATE/,/FOR\s+VIEW/,/GROUP\s+BY/,/NOT\s+IN/,/NULLS\s+(FIRST|LAST)/,/ORDER\s+BY/,/WITH/,/DATA\s+CATEGORY/,/WITH\s+PricebookId/),/\b/),
Expand All @@ -110,23 +107,24 @@ match:/(NEXT|LAST|THIS)_(90_DAY|DAY|FISCAL_QUARTER|FISCAL_YEAR|MONTH|QUARTER|WEE
scope:"variable.language",relevance:10},{
match:[/(NEXT|LAST)_N_(DAY|FISCAL_QUARTER|FISCAL_YEAR|MONTH|QUARTER|WEEK|YEAR)S/,/\s*:\s*/,/\d+/],
scope:{1:"variable.language",2:"operator",3:"number"},relevance:10},{
match:[/(?<=:)/,/\s*/,a],scope:{3:"variable"}},c,I,A,E,e.APOS_STRING_MODE],
illegal:"::"},k={begin:[/\bfor\b\s*/,/\(/,a,/\s+/,a,/\s*:/],beginScope:{
2:"punctuation",3:"type",5:"variable for",6:"operator"},scope:"for_loop",
end:/\)\s*\{/,endScope:"punctuation",contains:[g,T,f,I,{
match:t.concat(a,/\b(?!\()/),scope:"variable"}],METHOD_CALL:I,PUNCTUATION:E}
;return{name:"Apex",aliases:["apex","lightning","soql"],case_insensitive:!0,
match:[/(?<=:)/,/\s*/,a],scope:{3:"variable"}},c,D,E,g,e.APOS_STRING_MODE],
illegal:"::"},f={begin:[/\bfor\b\s*/,/\(/,a,/\s+/,a,/\s*:/],beginScope:{
2:"punctuation",3:"type",5:"variable for"},scope:"for_loop",end:/\)\s*\{/,
endScope:"punctuation",contains:[v,T,w,D,{match:t.concat(a,/\b(?!\()/),
scope:"variable"}],METHOD_CALL:D,PUNCTUATION_RE:g,OPERATOR_LIST:A};return{
name:"Apex",aliases:["apex","lightning","soql"],case_insensitive:!0,
disableAutodetect:!1,ignoreIllegals:!1,keywords:{$pattern:a,keyword:s,
"variable.language":["instanceof","new","super","this"],built_in:b,type:r,
literal:i},
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\$/,"::=",/\s#[a-zA-Z]/,/\s_[a-zA-Z]/,/\s\$[a-zA-Z]/,"#if","%if",/\bif(?!\s+\()/,"%endif","#endif",/\w::\w/,/(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/,'"""',/\+\+\+/,/<%/,"<%#","%%>","<%%",":-"],
contains:[v,O,_,T,g,U,[{begin:t.concat(/\s\b/,t.either(...l),/\b\s/),
beginScope:"built_in",end:";|$",scope:"dml",contains:[D,{
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\$/,"::=",/\s#[a-zA-Z]/,/\s_[a-zA-Z]/,/\s\$[a-zA-Z]/,"#if","%if",/\bif(?!\s+\()/,"%endif","#endif",/\w::\w/,/(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:[R,N,O,T,v,M,[{begin:t.concat(/\s\b/,t.either(...l),/\b\s/),
beginScope:"built_in",end:";|$",scope:"dml",contains:[I,{
match:/\bas\s+(user|system)\b/,scope:"keyword"},{match:[a,/\s*;/],scope:{
1:"variable"}},E,g,f]},{begin:[/\bDatabase\b/,/\./,a,/\s*/,/\(/],beginScope:{
1:"built_in",3:"built_in"},end:";",scope:"database_dml",
contains:[y,m,e.APOS_STRING_MODE,T,g,{match:[/\(/,a,/,/],scope:{2:"variable"}},{
1:"variable"}},g,v,w]},{begin:[/\bDatabase\b/,/\./,a,/\s*/,t.lookahead(/\(/)],
beginScope:{1:"built_in",3:"built_in"},end:";",scope:"database_dml",
contains:[y,m,e.APOS_STRING_MODE,T,v,{match:[/\(/,a,/,/],scope:{2:"variable"}},{
match:["AccessLevel",/\./,/(SYSTEM_MODE|USER_MODE)/],scope:{1:"built_in",
3:"keyword"}}]}],R,k,e.APOS_STRING_MODE,D,I,h,c,A,E,w,{
match:/(?<!\.)\bId\b(?=[\s>])/,scope:"type",relevance:8},f,o,S]}}})()
;export default hljsGrammar;
3:"keyword"}}]}],_,f,e.APOS_STRING_MODE,I,D,h,c,E,g,U,{
match:/(?<!\.)\bId\b(?=[\s>])/,scope:"type",relevance:8},w,o,S,[{
match:[/(?<=(public|private)?\s+[\w<>,\.]+\s+)/,/[\w<>]+/,/(?=\s+\{\s*(public|private\s+)?(get|set);\s+((public|private)\s+)?(get|set);\s*\})/],
scope:{2:"property"}}]]}}})();export default hljsGrammar;
Loading

0 comments on commit e691c60

Please sign in to comment.