File tree Expand file tree Collapse file tree 1 file changed +58
-0
lines changed Expand file tree Collapse file tree 1 file changed +58
-0
lines changed Original file line number Diff line number Diff line change @@ -340,6 +340,62 @@ export default function(hljs) {
340340 }
341341 } ;
342342
343+ // This will not detect camelCase classes
344+ const PASCAL_CASE_CLASS_NAME = regex . concat ( "[A-Z]" , IDENT_RE ) ;
345+
346+ const CONSTANT_REFERENCE = regex . concat ( IDENT_RE , "\\b(?!\\()" ) ;
347+
348+ const LEFT_AND_RIGHT_SIDE_OF_DOUBLE_COLON = {
349+ variants : [
350+ {
351+ match : [
352+ regex . concat (
353+ / : : / ,
354+ regex . lookahead ( / (? ! c l a s s \b ) / )
355+ ) ,
356+ CONSTANT_REFERENCE ,
357+ ] ,
358+ scope : {
359+ 2 : "variable" ,
360+ } ,
361+ } ,
362+ {
363+ match : [
364+ PASCAL_CASE_CLASS_NAME ,
365+ regex . concat (
366+ "::" ,
367+ regex . lookahead ( / (? ! c l a s s \b ) / )
368+ ) ,
369+ CONSTANT_REFERENCE ,
370+ ] ,
371+ scope : {
372+ 1 : "title.class" ,
373+ 3 : "variable" ,
374+ } ,
375+ } ,
376+ {
377+ match : [
378+ / : : / ,
379+ / c l a s s / ,
380+ ] ,
381+ scope : {
382+ 2 : "variable.language" ,
383+ } ,
384+ } ,
385+ {
386+ match : [
387+ PASCAL_CASE_CLASS_NAME ,
388+ / : : / ,
389+ / c l a s s / ,
390+ ] ,
391+ scope : {
392+ 1 : "title.class" ,
393+ 3 : "variable.language" ,
394+ } ,
395+ }
396+ ]
397+ } ;
398+
343399 return {
344400 case_insensitive : false ,
345401 keywords : KEYWORDS ,
@@ -380,6 +436,7 @@ export default function(hljs) {
380436 } ,
381437 VARIABLE ,
382438 FUNCTION_INVOKE ,
439+ LEFT_AND_RIGHT_SIDE_OF_DOUBLE_COLON ,
383440 {
384441 match : [
385442 / c o n s t / ,
@@ -425,6 +482,7 @@ export default function(hljs) {
425482 contains : [
426483 'self' ,
427484 VARIABLE ,
485+ LEFT_AND_RIGHT_SIDE_OF_DOUBLE_COLON ,
428486 hljs . C_BLOCK_COMMENT_MODE ,
429487 STRING ,
430488 NUMBER
You can’t perform that action at this time.
0 commit comments