diff --git a/src/languages/kotlin.js b/src/languages/kotlin.js index f4b345bfea..8a8eace855 100644 --- a/src/languages/kotlin.js +++ b/src/languages/kotlin.js @@ -103,6 +103,10 @@ function(hljs) { begin: KOTLIN_NUMBER_RE, relevance: 0 }; + var KOTLIN_NESTED_COMMENT = hljs.COMMENT( + '/\\*', '\\*/', + { contains: [ hljs.C_BLOCK_COMMENT_MODE ] } + ); return { aliases: ['kt'], @@ -120,7 +124,7 @@ function(hljs) { } ), hljs.C_LINE_COMMENT_MODE, - hljs.C_BLOCK_COMMENT_MODE, + KOTLIN_NESTED_COMMENT, KEYWORDS_WITH_LABEL, LABEL, ANNOTATION_USE_SITE, @@ -156,19 +160,19 @@ function(hljs) { contains: [ {className: 'type', begin: hljs.UNDERSCORE_IDENT_RE}, hljs.C_LINE_COMMENT_MODE, - hljs.C_BLOCK_COMMENT_MODE + KOTLIN_NESTED_COMMENT ], relevance: 0 }, hljs.C_LINE_COMMENT_MODE, - hljs.C_BLOCK_COMMENT_MODE, + KOTLIN_NESTED_COMMENT, ANNOTATION_USE_SITE, ANNOTATION, STRING, hljs.C_NUMBER_MODE ] }, - hljs.C_BLOCK_COMMENT_MODE + KOTLIN_NESTED_COMMENT ] }, { diff --git a/test/markup/kotlin/nested_comment.expect.txt b/test/markup/kotlin/nested_comment.expect.txt new file mode 100644 index 0000000000..63aca9d91b --- /dev/null +++ b/test/markup/kotlin/nested_comment.expect.txt @@ -0,0 +1,9 @@ +/* begin comment at LEVEL 0 + /* + multiline nested comment LEVEL 1 + */ + println("on kotlin this is a commented code in comment LEVEL 0") + /* + another multiline nested comment LEVEL 1 + */ +end comment at LEVEL 0 */ diff --git a/test/markup/kotlin/nested_comment.txt b/test/markup/kotlin/nested_comment.txt new file mode 100644 index 0000000000..ee0d408c8c --- /dev/null +++ b/test/markup/kotlin/nested_comment.txt @@ -0,0 +1,9 @@ +/* begin comment at LEVEL 0 + /* + multiline nested comment LEVEL 1 + */ + println("on kotlin this is a commented code in comment LEVEL 0") + /* + another multiline nested comment LEVEL 1 + */ +end comment at LEVEL 0 */