-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- 新增加了内置颜色高亮和错误转义高亮 - 将大部分高亮组换成非捕获组以提速
- Loading branch information
Showing
12 changed files
with
228 additions
and
15 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
[package] | ||
name = "mindustry_logic_bang_lang" | ||
version = "0.13.8" | ||
version = "0.13.9" | ||
edition = "2021" | ||
|
||
authors = ["A4-Tacks <[email protected]>"] | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
#** | ||
* 这是0.13.9的字符串新语法, 可以使多行字符串更加好用 | ||
* | ||
* 可以使用反斜杠转义行尾的换行符, | ||
* 然后字符串将会由这个换行符忽略至下一行第一个非空白字符或者一个反斜杠转义的空格 | ||
* | ||
* 会很好的处理对左方括号的转义和对反斜杠自身的转义 | ||
* | ||
* 注意: `"[]"`作用为清除颜色, | ||
* 本编译器为了当反斜杠和n紧贴时不产生新行将在中间插入此符号, | ||
* 所以如 `"[red]foo\\nbar"` 这样的字符串, `bar`将会被清除颜色 | ||
*# | ||
|
||
{ | ||
set x "\ | ||
This is a mult line string!\ | ||
"; | ||
set y "\ | ||
foo\ | ||
\ bar\ | ||
"; | ||
set z "\ | ||
line1\n\ | ||
line2\n\ | ||
"; | ||
set a "back slash: \\\nnormal: \\n"; | ||
set b "\ | ||
[red]\[red]\n\ | ||
[yellow]\[yellow]\n\ | ||
"; | ||
} | ||
#* >>> | ||
set x "This is a mult line string!" | ||
set y "foo bar" | ||
set z "line1\nline2\n" | ||
set a "back slash: \\nnormal: \[]n" | ||
set b "[red][[red]\n[yellow][[yellow]\n" | ||
*# |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
" Vim syntax file | ||
" Language: mindustry_logic_bang_lang (mdtlbl) | ||
" Maintainer: A4-Tacks <[email protected]> | ||
" Last Change: 2023-12-18 | ||
" Last Change: 2023-12-19 | ||
" URL: https://github.com/A4-Tacks/mindustry_logic_bang_lang | ||
|
||
" 已加载高亮时就退出 | ||
|
@@ -54,19 +54,25 @@ setlocal formatoptions+=rq | |
|
||
|
||
" 值(Var) {{{1 | ||
syn match mdtlblSpecialChar /\\n/ contained | ||
syn match mdtlblStringFailedEscape /\\./ contained | ||
hi link mdtlblStringFailedEscape Error | ||
|
||
syn match mdtlblStringColor /\[\v%(#\x{6,8}|%(c%(lear|yan|oral)|b%(l%(ack|ue)|r%(own|ick))|white|li%(ghtgray|me)|g%(r%(ay|een)|old%(enrod)?)|darkgray|navy|r%(oyal|ed)|s%(late|ky|carlet|almon)|t%(eal|an)|acid|forest|o%(live|range)|yellow|p%(ink|urple)|ma%(genta|roon)|violet))\]/ contained | ||
hi link mdtlblStringColor Include | ||
|
||
syn match mdtlblSpecialChar /^ *\\ \|\\\%([n\\[]\|$\)/ contained | ||
hi link mdtlblSpecialChar SpecialChar | ||
|
||
syn region mdtlblString start=/"/ end=/"/ contains=mdtlblSpecialChar | ||
syn region mdtlblString start=/"/ end=/"/ contains=mdtlblSpecialChar,mdtlblStringFailedEscape,mdtlblStringColor | ||
hi link mdtlblString String | ||
|
||
syn match mdtlblOIdent /@\I\i*\(-\i*\)*/ | ||
syn match mdtlblOIdent /@\I\i*\%(-\i*\)*/ | ||
hi link mdtlblOIdent Identifier | ||
|
||
syn match mdtlblOtherVar /'[^' \t]\+'/ | ||
hi link mdtlblOtherVar Identifier | ||
|
||
syn match mdtlblNumber /\v(<0(x\-?[0-9a-fA-F][0-9a-fA-F_]*|b\-?[01][_01]*)|\-?<\d[0-9_]*(\.\d[0-9_]*|e[+\-]?\d[0-9_]*)?)>/ | ||
syn match mdtlblNumber /\v(<0%(x\-?[0-9a-fA-F][0-9a-fA-F_]*|b\-?[01][_01]*)|\-?<\d[0-9_]*%(\.\d[0-9_]*|e[+\-]?\d[0-9_]*)?)>/ | ||
hi link mdtlblNumber Number | ||
|
||
syn match mdtlblBoolean /\v<true|false>/ | ||
|
@@ -80,7 +86,7 @@ hi link mdtlblResultHandle Identifier | |
|
||
|
||
" Label {{{1 | ||
syn match mdtlblDefineResultHandle /\((\(\s\|\n\)*\)\@<=\I\i*:/ | ||
syn match mdtlblDefineResultHandle /\%((\%(\s\|#\*.*\*#\|\%(#[^*].*\|#\)\=\n\)*\)\@<=\I\i*:/ | ||
hi link mdtlblDefineResultHandle Identifier | ||
|
||
syn match mdtlblIdentLabel /:\I\i*/ | ||
|
@@ -117,7 +123,7 @@ function! GetMdtlblIndent() | |
|
||
let diff = 0 | ||
|
||
if preline =~# '\([({\[:]\|\<\(else\)\>\)$' | ||
if preline =~# '\([({[:]\|\<\(else\)\>\)$' | ||
let diff += 1 | ||
endif | ||
|
||
|
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters