Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fixes #1760 #1762

Merged
merged 1 commit into from
Jan 1, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion lib/rouge/lexers/kotlin.rb
Original file line number Diff line number Diff line change
Expand Up @@ -116,12 +116,14 @@ class Kotlin < RegexLexer
rule class_name, Name::Class
rule %r'(<)', Punctuation, :generic_parameters
rule %r'(reified|out|in)', Keyword
rule %r'([,:])', Punctuation
rule %r'([,:.?])', Punctuation
rule %r'(\s+)', Text
rule %r'(>)', Punctuation, :pop!
end

state :property do
rule %r'(<)', Punctuation, :generic_parameters
rule %r'(\s+)', Text
rule name, Name::Property, :pop!
end

Expand Down
10 changes: 10 additions & 0 deletions spec/visual/samples/kotlin
Original file line number Diff line number Diff line change
Expand Up @@ -192,4 +192,14 @@ val hexes = listOf(0xFF, 0Xa, 0x10L, 0X0UL)
val exponents = listOf(1e10, -1E10F, 1.5e10, 1e-10)
val doublesAndFloats = listOf(3.14, .99, 22f, 1_000.000_1, 19.95F)

// The ? is not an error #1760
fun <T : Any> foo(a: Array<T?>): Int = a.size

// The < is not an error #1760
val <T> T.exhaustive get() = this

// The . in Map.Entry is not an error #1760
fun foo(props: Iterable<Map.Entry<String, JsonNode>>) =
TODO()

// comment at EOF (#797)