From 37ed1b96ae4298e46f725e42e4e4d6bc6418e15d Mon Sep 17 00:00:00 2001 From: Manuel Dossinger Date: Mon, 10 Aug 2020 18:23:57 +0200 Subject: [PATCH 1/2] Explicitly find 'class' after the '::' operator and render as name. Prevents pushing a :class. Fixes #1571 --- lib/rouge/lexers/kotlin.rb | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/rouge/lexers/kotlin.rb b/lib/rouge/lexers/kotlin.rb index fe83a2adb0..c82f244821 100644 --- a/lib/rouge/lexers/kotlin.rb +++ b/lib/rouge/lexers/kotlin.rb @@ -65,6 +65,9 @@ class Kotlin < RegexLexer rule %r'/[*].*[*]/', Comment::Multiline # single line block comment rule %r'/[*].*', Comment::Multiline, :comment # multiline block comment rule %r'\n', Text + rule %r'(::)(class)' do + groups Operator, Name + end rule %r'::|!!|\?[:.]', Operator rule %r"(\.\.)", Operator # Number literals From ee94bd28d88f1d9fa949962996c1074dbdf656ac Mon Sep 17 00:00:00 2001 From: Michael Camilleri Date: Tue, 8 Sep 2020 18:45:44 +0900 Subject: [PATCH 2/2] Change token to Keyword --- lib/rouge/lexers/kotlin.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/rouge/lexers/kotlin.rb b/lib/rouge/lexers/kotlin.rb index c82f244821..a2cc138878 100644 --- a/lib/rouge/lexers/kotlin.rb +++ b/lib/rouge/lexers/kotlin.rb @@ -66,7 +66,7 @@ class Kotlin < RegexLexer rule %r'/[*].*', Comment::Multiline, :comment # multiline block comment rule %r'\n', Text rule %r'(::)(class)' do - groups Operator, Name + groups Operator, Keyword end rule %r'::|!!|\?[:.]', Operator rule %r"(\.\.)", Operator