diff --git a/demo/testcode.html b/demo/testcode.html index cda794b..84f6d45 100644 --- a/demo/testcode.html +++ b/demo/testcode.html @@ -36,7 +36,7 @@ Integer myInt = 8 - 7++; - public List myString { get; set; } + public List<String> myString { get; set; } List<Opportunity> opps = [SELECT Id FROM Opportunity WHERE Id NOT IN :newRecordsMap.keySet()]; @@ -55,6 +55,8 @@ } System.URL.getCurrentRequestUrl(); System.getCurrentRequestUrl(); + + public List<SelectOption> recordTypes { get; private set; }

-------NEW LANGUAGE----------


diff --git a/dist/apex.es.min.js b/dist/apex.es.min.js
index c300d6f..cb3a70c 100644
--- a/dist/apex.es.min.js
+++ b/dist/apex.es.min.js
@@ -22,61 +22,57 @@ 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)/,/\?\./,/(?)/,/--/,/\+\+/,/&&|\|\|/,/\*=|\/=|%=|\+=|-=/,/\&=|\^=|<<=|>>=|>>>=|\|=/,/\&|~|\^|\|/,/%[^%]|\*[^\/]|\/[^\/\*]|(?>/,/<=|>=|\s(<|>)\s/,/==|!=/,/=>/,/!(?=\w)/,/\&\&/,/(?<=\s)(\?|:)(?=\s)/,/\?\./,/(?+/,
-endScope:"punctuation",contains:[{match://,
 scope:"punctuation"},{match:t.concat(/\b/,t.either(...p),/\b\s*(?!<>)/),
@@ -84,20 +80,21 @@ 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/),
@@ -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:["","\x3c!--","!DOCTYPE",/","<%%",":-"],
-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:["","\x3c!--","!DOCTYPE",/","<%%",":-",/\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:/(?])/,scope:"type",relevance:8},f,o,S]}}})()
-;export default hljsGrammar;
\ No newline at end of file
+3:"keyword"}}]}],_,f,e.APOS_STRING_MODE,I,D,h,c,E,g,U,{
+match:/(?])/,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;
\ No newline at end of file
diff --git a/dist/apex.min.js b/dist/apex.min.js
index 54a75b9..bc09b50 100644
--- a/dist/apex.min.js
+++ b/dist/apex.min.js
@@ -22,61 +22,57 @@ 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)/,/\?\./,/(?)/,/--/,/\+\+/,/&&|\|\|/,/\*=|\/=|%=|\+=|-=/,/\&=|\^=|<<=|>>=|>>>=|\|=/,/\&|~|\^|\|/,/%[^%]|\*[^\/]|\/[^\/\*]|(?>/,/<=|>=|\s(<|>)\s/,/==|!=/,/=>/,/!(?=\w)/,/\&\&/,/(?<=\s)(\?|:)(?=\s)/,/\?\./,/(?+/,
-endScope:"punctuation",contains:[{match://,
 scope:"punctuation"},{match:t.concat(/\b/,t.either(...p),/\b\s*(?!<>)/),
@@ -84,20 +80,21 @@ 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=[L,{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"}]},C],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/),
@@ -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:["","\x3c!--","!DOCTYPE",/","<%%",":-"],
-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:["","\x3c!--","!DOCTYPE",/","<%%",":-",/\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:/(?])/,scope:"type",relevance:8},f,o,S]}}})()
-;hljs.registerLanguage("apex",e)})();
\ No newline at end of file
+3:"keyword"}}]}],_,f,e.APOS_STRING_MODE,I,D,h,c,E,g,U,{
+match:/(?])/,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"}}]]}}})();hljs.registerLanguage("apex",e)})();
\ No newline at end of file
diff --git a/src/languages/apex.js b/src/languages/apex.js
index cbca50b..43f867b 100644
--- a/src/languages/apex.js
+++ b/src/languages/apex.js
@@ -28,7 +28,7 @@ export default function (hljs) {
     relevance: 0
   };
 
-  const MAIN_KEYWORDS = [
+  const MAIN_KEYWORD_LIST = [
     'cast',
     'default',
     'export',
@@ -58,7 +58,7 @@ export default function (hljs) {
     'when'
   ];
 
-  const LANGUAGE_VARS = ['instanceof', 'new', 'super', 'this'];
+  const LANGUAGE_VAR_LIST = ['instanceof', 'new', 'super', 'this'];
 
   // keyword
   const STORAGE_MODIFIER_LIST = [
@@ -77,7 +77,7 @@ export default function (hljs) {
     'webservice'
   ];
 
-  const STORAGE_MODIFIER = {
+  const STORAGE_MODIFIER_RE = {
     match: regex.concat(
       /(?,\.]+\s+)/,
+        /[\w<>]+/,
+        /(?=\s+\{\s*(public|private\s+)?(get|set);\s+((public|private)\s+)?(get|set);\s*\})/],
+      scope: {
+        //2: 'type',
+        2: 'property'
+      }
     }
   ];
 
   const PARAMS = {
     scope: 'params',
     begin: /\(/,
-    beginScope: 'punctuation',
+    //beginScope: 'punctuation',
     end: /\)/,
-    endScope: 'punctuation',
+    //endScope: 'punctuation',
     endsParent: true,
     relevance: 0,
     contains: [
@@ -682,11 +675,12 @@ export default function (hljs) {
       hljs.APOS_STRING_MODE,
       COMMENT_LINE,
       COMMENT_BLOCK,
-      OPERATORS,
+      OPERATOR_RE,
       ASSIGNMENTS,
       COLLECTION_DECLARATION,
-      LITERAL_REGEX,
+      LITERAL_RE,
       NAMESPACES,
+      LITERAL_RE, NUMBERS,
       //'self',
       {
         // mymethod(c.Id, c.Name); highlights each part of each parameter
@@ -730,7 +724,7 @@ export default function (hljs) {
       returnEnd: true,
       //endScope: 'punctuation',
       scope: 'instantiate',
-      contains: [PARAMS, COMMENT_LINE, PUNCTUATION],
+      contains: [PARAMS, COMMENT_LINE, PUNCTUATION_RE],
       illegal: ':',
       relevance: 0
     }
@@ -766,33 +760,17 @@ export default function (hljs) {
       COMMENT_BLOCK,
       hljs.APOS_STRING_MODE,
       PARAMS,
-      INSTANTIATE
+      INSTANTIATE,
+      "self",
     ],
     relevance: 0,
-    illegal: [].concat(...MAIN_KEYWORDS)
+    illegal: [].concat(...MAIN_KEYWORD_LIST)
   };
 
   // * TRIGGER DECLARATION
 
-  const TRIGGER_PROPERTIES = [
-    // will be scoped as keywords
-    'isExecuting',
-    'isInsert',
-    'isUpdate',
-    'isDelete',
-    'isBefore',
-    'isAfter',
-    'isUndelete',
-    'new',
-    'newMap',
-    'old',
-    'oldMap',
-    'size',
-    'operationType'
-  ];
-
-  const TRIGGER_CONTEXT_DECLARATION = {
-    match: [/\bTrigger\b/, /\./, regex.either(...TRIGGER_PROPERTIES), /\b/],
+  const TRIGGER_NAMESPACE_CALLS = {
+    match: [/\bTrigger/, /\./, /(isExecuting|isInsert|isUpdate|isDelete|isBefore|isAfter|isUndelete|new|newMap|old|oldMap|size|operationType)\b/],
     scope: { 1: 'built_in', 3: 'keyword' },
     relevance: 10
   };
@@ -841,15 +819,13 @@ export default function (hljs) {
     //begin: [/\bclass\b/, /\s+/, APEX_IDENT_RE],
     //beginScope: { 1: 'keyword', 3: 'title.class' },
     
-    beginKeywords: 'class',
-    returnBegin: true,
-
+    begin: /\bclass\b/,
+    beginScope: 'keyword',
     end: /\{/,
     endScope: 'punctuation',
-    returnEnd: true,
     //returnEnd: true,
     scope: 'class_declaration',
-    keywords: { type: TYPES, keyword: MAIN_KEYWORDS },
+    keywords: { type: TYPES, keyword: MAIN_KEYWORD_LIST },
     contains: [
       {
         match: [/(?<=\bclass\b)\s+/, APEX_IDENT_RE  ],
@@ -931,7 +907,7 @@ export default function (hljs) {
     contains: [
       COMMENT_LINE,
       COMMENT_BLOCK,
-      PUNCTUATION,
+      PUNCTUATION_RE,
       {
         match: regex.concat(/\b/, APEX_IDENT_RE, /\b/),
         scope: 'variable.constant'
@@ -963,27 +939,27 @@ export default function (hljs) {
   const DECLARATIONS = [
     TRIGGER_DECLARATION,
     CLASS_SHARING,
-    TRIGGER_CONTEXT_DECLARATION,
+    TRIGGER_NAMESPACE_CALLS,
     ENUM_DECLARATION,
     //CONSTRUCTOR_DECLARATION,
     CLASS_DECLARATION
-  ].concat(PROPERTY_DECLARATION);
+  ];
 
   const RETURNS = [
-    {
-      match: [/(?<=\breturn\b)\s+/, regex.either(LITERALS), /(?=\s*;)/],
+    /* {
+      match: [/\breturn\b\s+/, regex.either(LITERALS)],
       scope: {
         2: 'literal'
       }
-    },
+    }, */
     {
-      match: [/(?<=\breturn\b)/, /\s+/, APEX_IDENT_RE, /(?=\s*;)/],
+      match: [/\breturn\b/, /\s+/, APEX_IDENT_RE, ';'],
       scope: {
         3: 'variable'
       }
     },
     {
-      match: [/(?<=\breturn\b)/, /\s+/, regex.lookahead(APEX_IDENT_RE + /\(/)],
+      match: [/\breturn\b/, /\s+/, regex.lookahead(APEX_IDENT_RE + /\(/)],
       //returnBegin: true,
       //end: /(?=\))/,
       scope: {
@@ -1134,7 +1110,7 @@ export default function (hljs) {
             match: [/(?<=\.)/, APEX_IDENT_RE, /\b/],
             scope: { 2: 'type' }
           },
-          PUNCTUATION
+          PUNCTUATION_RE
         ]
       },
       {
@@ -1189,8 +1165,8 @@ export default function (hljs) {
       },
       NUMBERS,
       METHOD_CALL,
-      OPERATORS,
-      PUNCTUATION,
+      OPERATOR_RE,
+      PUNCTUATION_RE,
       hljs.APOS_STRING_MODE
     ],
     illegal: '::'
@@ -1203,7 +1179,7 @@ export default function (hljs) {
       2: 'punctuation',
       3: 'type',
       5: 'variable for',
-      6: 'operator'
+      //6: 'operator'
     },
     scope: 'for_loop',
     end: /\)\s*\{/,
@@ -1215,7 +1191,8 @@ export default function (hljs) {
       scope: 'variable'
     }],
     METHOD_CALL,
-    PUNCTUATION
+    PUNCTUATION_RE,
+    OPERATOR_LIST
    
   };
 
@@ -1244,7 +1221,7 @@ export default function (hljs) {
           match: [APEX_IDENT_RE, /\s*;/],
           scope: {1: 'variable'}
         },
-        PUNCTUATION,
+        PUNCTUATION_RE,
         COMMENT_LINE,
         SOQL_QUERY
       ]
@@ -1255,14 +1232,14 @@ export default function (hljs) {
      *
      */
     {
-    begin: [/\bDatabase\b/,/\./, APEX_IDENT_RE, /\s*/, /\(/],
+    begin: [/\bDatabase\b/,/\./, APEX_IDENT_RE, /\s*/, regex.lookahead(/\(/)],
     beginScope: { 1: 'built_in', 3: 'built_in'},
     end: ';',
     //endScope: 'punctuation',
     scope: 'database_dml',
     contains: [
       
-       PARAMS, LITERAL_REGEX, hljs.APOS_STRING_MODE, COMMENT_BLOCK, COMMENT_LINE,{
+       PARAMS, LITERAL_RE, hljs.APOS_STRING_MODE, COMMENT_BLOCK, COMMENT_LINE,{
         match: [/\(/, APEX_IDENT_RE,/,/],
         scope: {2: 'variable'}
       },{
@@ -1278,7 +1255,7 @@ export default function (hljs) {
         end: /\)/,
         scope: 'dml params',
         endsWithParent: true,
-        contains: [PARAMS, LITERAL_REGEX, hljs.APOS_STRING_MODE, COMMENT_BLOCK, COMMENT_LINE  ]
+        contains: [PARAMS, LITERAL_RE, hljs.APOS_STRING_MODE, COMMENT_BLOCK, COMMENT_LINE  ]
       } */
     ]
     }
@@ -1337,10 +1314,10 @@ export default function (hljs) {
     '%%>',
     '<%%',
     ':-',
-    //\bmergesort\(/,
-    //\bvar\s+env\b/,
-   //\bdef\b\s\W:/
-    // /"[^"]+"/, // Quote_string_mode
+    /\bmergesort\(/,
+    /\bvar\s+env\b/,
+   /\bdef\b\s\W:/,
+     /"[^"]+"/, // Quote_string_mode
     // /@\w+\[\w+\]/ //moonscript
   ];
 
@@ -1352,8 +1329,8 @@ export default function (hljs) {
     ignoreIllegals: false,
     keywords: {
       $pattern: APEX_IDENT_RE,
-      keyword: MAIN_KEYWORDS,
-      'variable.language': LANGUAGE_VARS,
+      keyword: MAIN_KEYWORD_LIST,
+      'variable.language': LANGUAGE_VAR_LIST,
       built_in: BUILT_INS,
       type: TYPES,
       literal: LITERALS
@@ -1375,13 +1352,14 @@ export default function (hljs) {
       METHOD_CALL,
       NAMESPACES,
       NUMBERS,
-      OPERATORS,
-      PUNCTUATION,
+      OPERATOR_RE,
+      PUNCTUATION_RE,
       RETURNS,
       SALESFORCE_ID,
       SOQL_QUERY,
-      STORAGE_MODIFIER,
-      SWITCH_STATEMENT
+      STORAGE_MODIFIER_RE,
+      SWITCH_STATEMENT,
+      VISUALFORCE_PROPERTY
     ]
   };
 }
diff --git a/test/markup/apex/apexcode.expected.txt b/test/markup/apex/apexcode.expected.txt
index b563d63..f1aede0 100644
--- a/test/markup/apex/apexcode.expected.txt
+++ b/test/markup/apex/apexcode.expected.txt
@@ -2,50 +2,50 @@
  * @author John Smith
  */
 @IsTest(Seealldata=true)
-public with sharing class L2Char implements Database.batchable {{
+public with sharing class L2Char implements Database.batchable {
   public static final String ERROR = 0x0001;
 
   @InvocableMethod(label='my invocable')
-  public static void moveTo(
+  public static void moveTo(
     Integer x, 
     Integer y, 
     Integer z
-  ) {
+  ) {
     
     
-    Account a = new Account();
+    Account a = new Account();
     a.Custom__c = 'stringvalue';
     insert a;
     Boolean ai = (Boolean) false;
-    System.debug('Should not be called');
-    if (1 > 5 && !Test.isRunningTest()) { // wtf!?
-      Database.insert(myAccounts, false);
+    System.debug('Should not be called');
+    if (1 > 5 && !Test.isRunningTest()) { // wtf!?
+      Database.insert(myAccounts, false);
     }
   }
 }
 
 @TestSetup
-private static void makeData(Boolean a){
-  Custom__c c = new Custom__c();
+private static void makeData(Boolean a){
+  Custom__c c = new Custom__c();
   
-  for(Account a : acctLis ){
+  for(Account a : acctLis ){
     ConnectApi.insert a;
   }
 }
 
 @isTest
-private static void testme(){
-  System.assert(true);
+private static void testme(){
+  System.assert(true);
 }
 
 @testVisible
-private List<SelectOption> recordTypes { get; private set; }
+private List<SelectOption> recordTypes { get; private set; }
 
-for(Account a : [SELECT Id FROM Account WHERE LastModifiedDate = LAST_N_DAYS:3]){
-  Assert.fail();
+for(Account a : [SELECT Id FROM Account WHERE LastModifiedDate = LAST_N_DAYS:3]){
+  Assert.fail();
 }
 
 trigger CTrig on Custom__c (before insert){
-  System.debug('inserting a record');
+  System.debug('inserting a record');
   upsert myRecord__c;
 }
\ No newline at end of file