@@ -328,21 +328,6 @@ export default function(hljs) {
328328 ]
329329 } ;
330330
331- const FUNCTION_INVOKE = {
332- relevance : 0 ,
333- match : [
334- / \b / ,
335- // to prevent keywords from being confused as the function title
336- regex . concat ( "(?!fn\\b|function\\b|" , normalizeKeywords ( KWS ) . join ( "\\b|" ) , "|" , normalizeKeywords ( BUILT_INS ) . join ( "\\b|" ) , "\\b)" ) ,
337- IDENT_RE ,
338- regex . concat ( WHITESPACE , "*" ) ,
339- regex . lookahead ( / (? = \( ) / )
340- ] ,
341- scope : {
342- 3 : "title.function.invoke" ,
343- }
344- } ;
345-
346331 const CONSTANT_REFERENCE = regex . concat ( IDENT_RE , "\\b(?!\\()" ) ;
347332
348333 const LEFT_AND_RIGHT_SIDE_OF_DOUBLE_COLON = {
@@ -368,6 +353,20 @@ export default function(hljs) {
368353 2 : "variable.language" ,
369354 } ,
370355 } ,
356+ {
357+ match : [
358+ PASCAL_CASE_CLASS_NAME_RE ,
359+ regex . concat (
360+ / : : / ,
361+ regex . lookahead ( / (? ! c l a s s \b ) / )
362+ ) ,
363+ CONSTANT_REFERENCE ,
364+ ] ,
365+ scope : {
366+ 1 : "title.class" ,
367+ 3 : "variable.constant" ,
368+ } ,
369+ } ,
371370 {
372371 match : [
373372 PASCAL_CASE_CLASS_NAME_RE ,
@@ -394,6 +393,44 @@ export default function(hljs) {
394393 ]
395394 } ;
396395
396+ const NAMED_ARGUMENT = {
397+ scope : 'attr' ,
398+ match : regex . concat ( IDENT_RE , regex . lookahead ( ':' ) , regex . lookahead ( / (? ! : : ) / ) ) ,
399+ } ;
400+ const PARAMS_MODE = {
401+ relevance : 0 ,
402+ begin : / \( / ,
403+ end : / \) / ,
404+ keywords : KEYWORDS ,
405+ contains : [
406+ NAMED_ARGUMENT ,
407+ VARIABLE ,
408+ LEFT_AND_RIGHT_SIDE_OF_DOUBLE_COLON ,
409+ hljs . C_BLOCK_COMMENT_MODE ,
410+ STRING ,
411+ NUMBER ,
412+ CONSTRUCTOR_CALL ,
413+ ] ,
414+ } ;
415+ const FUNCTION_INVOKE = {
416+ relevance : 0 ,
417+ match : [
418+ / \b / ,
419+ // to prevent keywords from being confused as the function title
420+ regex . concat ( "(?!fn\\b|function\\b|" , normalizeKeywords ( KWS ) . join ( "\\b|" ) , "|" , normalizeKeywords ( BUILT_INS ) . join ( "\\b|" ) , "\\b)" ) ,
421+ IDENT_RE ,
422+ regex . concat ( WHITESPACE , "*" ) ,
423+ regex . lookahead ( / (? = \( ) / )
424+ ] ,
425+ scope : {
426+ 3 : "title.function.invoke" ,
427+ } ,
428+ contains : [
429+ PARAMS_MODE
430+ ]
431+ } ;
432+ PARAMS_MODE . contains . push ( FUNCTION_INVOKE ) ;
433+
397434 return {
398435 case_insensitive : false ,
399436 keywords : KEYWORDS ,
@@ -440,7 +477,6 @@ export default function(hljs) {
440477 / c o n s t / ,
441478 / \s / ,
442479 IDENT_RE ,
443- / \s * = / ,
444480 ] ,
445481 scope : {
446482 1 : "keyword" ,
@@ -476,7 +512,7 @@ export default function(hljs) {
476512 STRING ,
477513 NUMBER
478514 ]
479- }
515+ } ,
480516 ]
481517 } ,
482518 {
@@ -520,7 +556,7 @@ export default function(hljs) {
520556 ]
521557 } ,
522558 STRING ,
523- NUMBER
559+ NUMBER ,
524560 ]
525561 } ;
526562}
0 commit comments