nishtahir / language-kotlin

Textmate language grammar for the Kotlin programming language
Apache License 2.0
12 stars 6 forks source link

`<=` breaks highlighting #15

Closed seratch closed 4 years ago

seratch commented 4 years ago

Having <= in if statements breaks highlighting.

if (num <= 10) {
  // foo
}
if (num <= 10) {
  errors["num"] = "Something is wrong"
}

Screen shot as of Oct 2019:

Screen Shot 2019-10-25 at 15 14 22
paulstelian97 commented 4 years ago

Random hunch: does the order of definitions inside the language file matter? (< being matched in literal-function or on the contrary on the types: part)

mmazurkevich commented 4 years ago

GitHub uses this grammar to highlight all kotlin files Linguist. Example of broken highlighting https://git.io/Jfsdc. The root cause: < symbol parses as punctuation.definition.generic.begin.kotlin instead of keyword.operator.comparison.kotlin image

paulstelian97 commented 4 years ago

Isn't there a way to make the tokenizer also have a context which can allow this situation to be disambiguated?