diff --git a/dist/apex.es.min.js b/dist/apex.es.min.js index 085ec5e..d2af04a 100644 --- a/dist/apex.es.min.js +++ b/dist/apex.es.min.js @@ -22,8 +22,8 @@ scope:{2:"title.class"},relevance:9},{ match:[/\b/,t.either("Callable","Comparable","Comparator","HttpCalloutMock","InstallHandler","Queueable","QueueableContext","SandboxPostCopy","Schedulable","SchedulableContext","StubProvider","UninstallHandler","WebServiceMock"),/\b/], scope:{2:"title.class.inherited"},relevance:10}],h={ match:[/\bswitch\s+on\s+/,a],scope:{1:"keyword",2:"variable"}},S={ -match:t.concat(/\s*\(/,t.either(/(?)/,/(--)/,/(\!|&&|\|\|)/,/(\*=|\/=|%=|\+=|-=)/,/(\&=|\^=|<<=|>>=|\|=)/,/(\&|~|\^|\|)/,/(\+\+)/,/(\=)/,/(%[^%]|\*[^\/]|\/[^\/\*]|-|\+)/,/(<<|>>)/,/(<=|>=|\s(<|>)\s)/,/(==|!=)/,/(=>)/,/(!(?=\w))/,/(\&\&)/,/((?<=\s)(\?|:)(?=\s))/,/(\?\.)/,/(?)/,/(--)/,/(\!|&&|\|\|)/,/(\*=|\/=|%=|\+=|-=)/,/(\&=|\^=|<<=|>>=|\|=)/,/(\&|~|\^|\|)/,/(\+\+)/,/(%[^%]|\*[^\/]|\/[^\/\*]|-|\+)/,/(<<|>>)/,/(<=|>=|\s(<|>)\s)/,/(==|!=)/,/=>/,/(!(?=\w))/,/(\&\&)/,/((?<=\s)(\?|:)(?=\s))/,/(\?\.)/,/(?+/, endScope:"punctuation",contains:[{match:/","\x3c!--","!DOCTYPE",/","<%%"], -contains:[v,_,R,g,E,O,U,[{ +contains:[v,R,_,g,E,O,U,[{ match:[t.concat(/\b/,t.either(...b),/\b/),/\s*/,a,/(?=;)/],scope:{1:"built_in", 3:"variable"}},{match:t.concat(/\b/,t.either(...b),/\b/),scope:"built_in"},{ match:[/\s+/,/(?:\bas\s+(user|system)\b\s+)?/,a,t.lookahead(";")],scope:{ diff --git a/dist/apex.min.js b/dist/apex.min.js index e0b09ef..a650eb6 100644 --- a/dist/apex.min.js +++ b/dist/apex.min.js @@ -22,8 +22,8 @@ scope:{2:"title.class"},relevance:9},{ match:[/\b/,t.either("Callable","Comparable","Comparator","HttpCalloutMock","InstallHandler","Queueable","QueueableContext","SandboxPostCopy","Schedulable","SchedulableContext","StubProvider","UninstallHandler","WebServiceMock"),/\b/], scope:{2:"title.class.inherited"},relevance:10}],h={ match:[/\bswitch\s+on\s+/,a],scope:{1:"keyword",2:"variable"}},S={ -match:t.concat(/\s*\(/,t.either(/(?)/,/(--)/,/(\!|&&|\|\|)/,/(\*=|\/=|%=|\+=|-=)/,/(\&=|\^=|<<=|>>=|\|=)/,/(\&|~|\^|\|)/,/(\+\+)/,/(\=)/,/(%[^%]|\*[^\/]|\/[^\/\*]|-|\+)/,/(<<|>>)/,/(<=|>=|\s(<|>)\s)/,/(==|!=)/,/(=>)/,/(!(?=\w))/,/(\&\&)/,/((?<=\s)(\?|:)(?=\s))/,/(\?\.)/,/(?)/,/(--)/,/(\!|&&|\|\|)/,/(\*=|\/=|%=|\+=|-=)/,/(\&=|\^=|<<=|>>=|\|=)/,/(\&|~|\^|\|)/,/(\+\+)/,/(%[^%]|\*[^\/]|\/[^\/\*]|-|\+)/,/(<<|>>)/,/(<=|>=|\s(<|>)\s)/,/(==|!=)/,/=>/,/(!(?=\w))/,/(\&\&)/,/((?<=\s)(\?|:)(?=\s))/,/(\?\.)/,/(?+/, endScope:"punctuation",contains:[{match:/)/),scope:"title.class.inherited" 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"}]}]},U=[C,{relevance:10, -match:/\b(with|without|inherited)\s+sharing\b/,scope:"keyword"},I,{ +match:/\b(with|without|inherited)\s+sharing\b/,scope:"keyword"},L,{ begin:[/\benum\s+/,a,/\s*/,/\{/],beginScope:{1:"type",2:"type",4:"punctuation"}, -end:/[\}\n]/,endScope:"punctuation",scope:"enum declaration",relevance:0, +end:/[\}\n]/,endScope:"punctuation",scope:"enum_declaration",relevance:0, contains:[g,E,A,{match:t.concat(/\b/,a,/\b/),scope:"variable.constant"}] }].concat(M),w=[{match:[/(?<=\breturn\b)\s+/,t.either(o),/(?=\s*;)/],scope:{ 2:"literal"}},{match:[/(?<=return)/,/\s+/,a,/(?=\s*;)/],scope:{3:"variable"}},{ match:[/(?<=return)/,/\s+/,t.lookahead(a+/\(/)],scope:{2:"title.function.invoke" }}],f={begin:[/\[/,/\s*/,/\b(SELECT|FIND)\b/],beginScope:{1:"punctuation", -3:"keyword for 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"}},A]},{match:/\]/,scope:"punctuation", -endsParent:!0},{match:/\b\s*IN|=\s*:/,scope:"operator"},{ +3:"keyword soql"},end:/\]/,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"}},A]},{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",relevance:0},{ +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/), scope:"operator soql",relevance:0},{ match:t.concat(/\b/,t.either("AVG","convertCurrency","convertTimezone","COUNT_DISTINCT","COUNT","DAY_IN_MONTH","DAY_IN_WEEK","DAY_IN_YEAR","DAY_ONLY","DISTANCE","EXCLUDES","FORMAT","GEOLOCATION","GROUP BY CUBE","GROUP BY ROLLUP","GROUPING","HOUR_IN_DAY","INCLUDES","MAX","MIN","SUM","toLabel","WEEK_IN_MONTH","WEEK_IN_YEAR"),/\b/), @@ -112,7 +112,7 @@ 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,D,S,A,e.APOS_STRING_MODE], +match:[/(?<=:)/,/\s*/,a],scope:{3:"variable"}},c,I,S,A,e.APOS_STRING_MODE], illegal:"::"},k={begin:[/\bfor\b/,/\s*\(/,a,/\s+/,a,/\s*:/],beginScope:{ 2:"punctuation",3:"type",5:"variable",6:"operator"},end:"{",contains:[g,E,f]} ;return{name:"Apex",aliases:["apex","lightning","soql"],case_insensitive:!0, @@ -120,14 +120,14 @@ disableAutodetect:!1,ignoreIllegals:!1,keywords:{$pattern:a,keyword:s, "variable.language":["instanceof","new","super","this"],built_in:l,type:r, literal:o,classNameAliases:{soql:"subst"}}, illegal:["","\x3c!--","!DOCTYPE",/","<%%"], -contains:[v,_,R,E,g,O,U,[{ +contains:[v,R,_,E,g,O,U,[{ match:[t.concat(/\b/,t.either(...b),/\b/),/\s*/,a,/(?=;)/],scope:{1:"built_in", 3:"variable"}},{match:t.concat(/\b/,t.either(...b),/\b/),scope:"built_in"},{ match:[/\s+/,/(?:\bas\s+(user|system)\b\s+)?/,a,t.lookahead(";")],scope:{ 2:"built_in",3:"variable"}},{begin:t.concat(/\b/,t.either(...b),/\b/), -beginScope:"built_in",scope:"DML",contains:[L,{ +beginScope:"built_in",scope:"DML",contains:[D,{ match:[t.concat("(?<=",t.either(b),")"),/\s+/,/(?:\bas\s+(user|system)\b\s+)?/,a,t.lookahead(";")], scope:{3:"built_in",4:"variable"}},{match:t.either(b),scope:"built_in"},A]},{ match:["AccessLevel",/\./,/(SYSTEM_MODE|USER_MODE)/],scope:{1:"built_in", -3:"keyword"}}],T,k,e.APOS_STRING_MODE,L,D,m,c,S,y,A,w,{match:/(?)/, + /(?<=')\s*\+/, // string concat before + /\+(?=\s*')/, // string concat after + /(?)/, /(--)/, // decrement /(\!|&&|\|\|)/, // logical @@ -397,12 +399,12 @@ export default function (hljs) { /(\&=|\^=|<<=|>>=|\|=)/, // assignment.compound.bitwise /(\&|~|\^|\|)/, // bitwise /(\+\+)/, // increment - /(\=)/, // assignment + //(\=)/, // assignment /(%[^%]|\*[^\/]|\/[^\/\*]|-|\+)/, // arithmetic /(<<|>>)/, // bitwise.shift /(<=|>=|\s(<|>)\s)/, // relational /(==|!=)/, // comparison - /(=>)/, // map assign + /=>/, // map assign /(!(?=\w))/, // negator /(\&\&)/, /((?<=\s)(\?|:)(?=\s))/, // standalone ? or : (ternary operator?) @@ -412,8 +414,8 @@ export default function (hljs) { ]; const OPERATORS = { - match: regex.concat( /\s*\(/, regex.either(...OPERATOR_REGEX), /\){1}\s*/), - scope: 'operator main', + match: regex.concat( '(' + regex.either(...OPERATOR_REGEX) + '){1}'), + scope: 'operator', relevance: 0 }; @@ -506,7 +508,7 @@ export default function (hljs) { // Type 1: one annotation // @isTest match: regex.concat(ANNOTATION_RE, /\b(?!\s*\()/), //, /(?=(\(|\b|\s))/] - scope: 'meta SOLO' + scope: 'meta' //SOLO }, // Type 2: annotation and parentheses // @SuppressWarnings('PMD.AvoidGlobalModifier')) @@ -517,7 +519,7 @@ export default function (hljs) { begin: [regex.concat(ANNOTATION_RE, /\b/), /\s*\(/], beginScope: { 1: 'meta', 2: 'punctuation' }, end: /\)/, - endScope: 'punctuation end', + endScope: 'punctuation', //END //returnEnd: true, scope: 'annotation', contains: [ @@ -716,7 +718,7 @@ export default function (hljs) { const METHOD_CALL = { end: /(?=\)\s*[^{])/, returnEnd: true, - scope: 'method call', + scope: 'method_call', variants: [ { begin: regex.concat(APEX_IDENT_RE, /(?=\s*\()/), @@ -792,7 +794,6 @@ export default function (hljs) { 7: 'type' }, end: '{', - //endScope: 'punctuation end', returnEnd: true, scope: 'trigger_declaration', contains: [ @@ -823,7 +824,7 @@ export default function (hljs) { //endScope: 'punctuation', returnEnd: true, //returnEnd: true, - scope: 'class-declaration', + scope: 'class_declaration', keywords: {type: TYPES, keyword: ['extends','implements']}, contains: [ { @@ -891,7 +892,7 @@ export default function (hljs) { }, end: /[\}\n]/, endScope: 'punctuation', - scope: 'enum declaration', + scope: 'enum_declaration', relevance: 0, contains: [ COMMENT_LINE, @@ -1078,10 +1079,10 @@ export default function (hljs) { const SOQL_QUERY = { begin: [/\[/, /\s*/, /\b(SELECT|FIND)\b/], - beginScope: { 1: 'punctuation', 3: 'keyword for soql' }, + beginScope: { 1: 'punctuation', 3: 'keyword soql' }, //returnBegin: true, end: /\]/, - endScope: 'punctuation outer', + //endScope: 'punctuation', //outer //returnEnd: true, scope: 'soql', relevance: 10, @@ -1093,7 +1094,7 @@ export default function (hljs) { 1: 'keyword', 2: 'type' }, - scope: 'from clause', + scope: 'from_clause', end: /(?=\]|\s)/, //endScope: 'punctuation', contains: [ @@ -1115,7 +1116,7 @@ export default function (hljs) { }, { begin: regex.concat(/\b/, regex.either(...SOQL_KEYWORDS), /\b/), - scope: 'keyword', + scope: 'keyword soql', relevance: 0 }, {