Highlight extra chars in literal

This commit adds highlighting characters other than the first with red color helping to get immediate feedback of the syntax error.
This helps those who come from languagles like JS where single quotes also denote multi-character strings.
This commit is contained in:
Yerlan 2021-05-18 20:51:52 +02:00 committed by GitHub
parent 38f85706ff
commit a390a6f356
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -56,7 +56,7 @@ provide-module kotlin %§
add-highlighter shared/kotlin regions
add-highlighter shared/kotlin/code default-region group
add-highlighter shared/kotlin/string region %{(?<!')"} %{(?<!\\)(\\\\)*"} group
add-highlighter shared/kotlin/character region %{'} %{(?<!\\)'} fill value
add-highlighter shared/kotlin/character region %{'} %{(?<!\\)'} group
add-highlighter shared/kotlin/comment region /\* \*/ fill comment
add-highlighter shared/kotlin/inline_documentation region /// $ fill documentation
add-highlighter shared/kotlin/line_comment region // $ fill comment
@ -69,6 +69,10 @@ add-highlighter shared/kotlin/code/fields regex \.([A-Za-z_][\w]*)\s*?\. 1:
add-highlighter shared/kotlin/string/ fill string
add-highlighter shared/kotlin/string/ regex \$\{.*?\} 0:value
# Character
add-highlighter shared/kotlin/character/ fill value
add-highlighter shared/kotlin/character/ regex ('.{1})(.+)(') 2:red
# As at 15 March 2021, method see: https://regex101.com/r/Mhy4HG/1
add-highlighter shared/kotlin/code/methods regex ::([A-Za-z_][\w]*)|\.([A-Za-z_][\w]*)\s*?[\(\{]|\.([A-Za-z_][\w]*)[\s\)\}>](?=[^\(\{]) 1:function 2:function 3:function