diff --git a/Kotlin.JSON-tmLanguage b/Kotlin.JSON-tmLanguage index 2022a36..c511df9 100644 --- a/Kotlin.JSON-tmLanguage +++ b/Kotlin.JSON-tmLanguage @@ -109,7 +109,7 @@ "types": { "patterns": [ { - "match": "\\b(Any|Unit|String|Int|Boolean|Char|Long|Double|Float|Short|Byte|dynamic)\\b", + "match": "\\b(Nothing|Any|Unit|String|CharSequence|Int|Boolean|Char|Long|Double|Float|Short|Byte|dynamic)\\b", "name": "storage.type.buildin.kotlin" }, { @@ -117,7 +117,7 @@ "name": "storage.type.buildin.array.kotlin" }, { - "begin": "\\b(Array|List|Map)<\\b", + "begin": "\\b(Array|Collection|List|Map|Set|MutableList|MutableMap|MutableSet|Sequence)<\\b", "beginCaptures": { "1": { "name": "storage.type.buildin.collection.kotlin" @@ -145,20 +145,6 @@ } ] }, - { - "begin": "(#)\\(", - "beginCaptures": { - "1": { - "name": "keyword.operator.tuple.kotlin" - } - }, - "end": "\\)", - "patterns": [ - { - "include": "#expressions" - } - ] - }, { "begin": "\\{", "end": "\\}", @@ -231,21 +217,26 @@ ] }, "classes": { - "begin": "(?=\\s*(?:companion|class|object|interface))", - "end": "}|(?=$)", + "begin": "(?classes begin - (?=\s*(?:companion|class|object|interface)) + (?<!::)(?=\b(?:companion|class|object|interface)\b) end - }|(?=$) + (?=$|\}) patterns + + include + #comments + begin \b(companion\s*)?(class|object|interface)\b @@ -59,18 +63,21 @@ 1 name - keyword.other.kotlin + storage.modifier.kotlin + + 2 + + name + storage.modifier.kotlin end - (?=<|{|\(|:) + (?=<|\{|\(|:|$) patterns - match - \b(object)\b - name - keyword.other.kotlin + include + #comments match @@ -208,7 +215,7 @@ match - \b((0(x|X)[0-9a-fA-F]*)|(([0-9]+\.?[0-9]*)|(\.[0-9]+))((e|E)(\+|-)?[0-9]+)?)([LlFfUuDd]|UL|ul)?\b + \b((0(x|X)[0-9a-fA-F]*)|(([0-9]+\.?[0-9]*)|(\.[0-9]+))((e|E)(\+|-)?[0-9]+)?)([LlFf])?\b name constant.numeric.kotlin @@ -262,9 +269,9 @@ functions begin - (?=\s*(?:fun)) + (?=\s*\b(?:fun)\b) end - }|(?=$) + (?=$|\}) patterns @@ -566,7 +573,7 @@ match - \b(var|val|public|private|protected|abstract|final|enum|open|attribute|annotation|override|inline|var|val|vararg|lazy|in|out|internal|data|tailrec|operator|infix|const|yield|typealias|typeof)\b + \b(var|val|public|private|protected|abstract|final|sealed|enum|open|attribute|annotation|override|inline|vararg|in|out|internal|data|tailrec|operator|infix|const|yield|typealias|typeof|reified|suspend)\b name storage.modifier.kotlin @@ -584,7 +591,7 @@ match - \b(in|is|as|assert)\b + \b(in|is|!in|!is|as|as\?|assert)\b name keyword.operator.kotlin @@ -600,48 +607,72 @@ name keyword.operator.assignment.kotlin + + match + (::) + name + keyword.operator.kotlin + match (:) name keyword.operator.declaration.kotlin + + match + \b(by)\b + name + keyword.other.by.kotlin + + + match + (\?\.) + name + keyword.operator.safenav.kotlin + match (\.) name keyword.operator.dot.kotlin + + match + (\?:) + name + keyword.operator.elvis.kotlin + match (\-\-|\+\+) name keyword.operator.increment-decrement.kotlin + + match + (\+=|\-=|\*=|\/=) + name + keyword.operator.arithmetic.assign.kotlin + + + match + (\.\.) + name + keyword.operator.range.kotlin + match (\-|\+|\*|\/|%) name keyword.operator.arithmetic.kotlin - - match - (\+=|\-=|\*=|\/=) - name - keyword.operator.arithmetic.assign.kotlin - match (!|&&|\|\|) name keyword.operator.logical.kotlin - - match - (\.\.) - name - keyword.operator.range.kotlin - match (;) @@ -947,7 +978,7 @@ match - \b(Any|Unit|String|Int|Boolean|Char|Long|Double|Float|Short|Byte|dynamic)\b + \b(Nothing|Any|Unit|String|CharSequence|Int|Boolean|Char|Long|Double|Float|Short|Byte|dynamic)\b name storage.type.buildin.kotlin @@ -959,7 +990,7 @@ begin - \b(Array|List|Map)<\b + \b(Array|Collection|List|Map|Set|MutableList|MutableMap|MutableSet|Sequence)<\b beginCaptures 1 @@ -999,27 +1030,6 @@ - - begin - (#)\( - beginCaptures - - 1 - - name - keyword.operator.tuple.kotlin - - - end - \) - patterns - - - include - #expressions - - - begin \{ @@ -1057,9 +1067,9 @@ variables begin - (?=\s*(?:var|val)) + (?=\s*\b(?:var|val)\b) end - (?=:|=|$) + (?=:|=|(\b(by)\b)|$) patterns @@ -1074,7 +1084,7 @@ end - (?=:|=|$) + (?=:|=|(\b(by)\b)|$) patterns @@ -1129,6 +1139,27 @@ + + begin + \b(by)\b + beginCaptures + + 1 + + name + keyword.other.kotlin + + + end + (?=$) + patterns + + + include + #expressions + + + begin (=)