aboutsummaryrefslogtreecommitdiff
path: root/micro-vim/syntax
diff options
context:
space:
mode:
authorJuan J. Martinez <jjm@usebox.net>2022-07-18 07:45:58 +0100
committerJuan J. Martinez <jjm@usebox.net>2022-07-18 07:45:58 +0100
commit8bb321f8b032dfaeffbe3d1b8dfeb215c12d3642 (patch)
treec53977d1284347bb1d5963ddb4dc7723c40c6e55 /micro-vim/syntax
downloadmicro-lang-8bb321f8b032dfaeffbe3d1b8dfeb215c12d3642.tar.gz
micro-lang-8bb321f8b032dfaeffbe3d1b8dfeb215c12d3642.zip
First public release
Diffstat (limited to 'micro-vim/syntax')
-rw-r--r--micro-vim/syntax/micro.vim90
1 files changed, 90 insertions, 0 deletions
diff --git a/micro-vim/syntax/micro.vim b/micro-vim/syntax/micro.vim
new file mode 100644
index 0000000..f620579
--- /dev/null
+++ b/micro-vim/syntax/micro.vim
@@ -0,0 +1,90 @@
+if exists("b:current_syntax")
+ finish
+endif
+
+let s:cpo_save = &cpo
+set cpo&vim
+
+syn clear
+syn sync fromstart
+
+syn match microNumber /\<[0-9]\d*\>/
+
+syn match microEscapeHex /\\x\x{2}/ transparent contained
+syn match microEscapeChar /\\[nt\\']/ transparent contained
+syn match microEscapeString /\\[nt\\"]/ transparent contained
+
+syn cluster microCharacterGroup contains=microEscapeChar,microEscapeHex
+syn region microCharacter start=/'/ skip=/\\\\\|\\'/ end=/'/ contains=@microCharacterGroup
+
+syn cluster microStringGroup contains=microEscapeString,microEscapeHex
+syn region microString start=/"/ skip=/\\\\\|\\"/ end=/"/ contains=@Spell,microStringGroup
+
+syn keyword microConditional if else continue break
+syn keyword microRepeat for in
+syn keyword microType number bool string func
+syn keyword microBoolean true false
+syn keyword microKeyword len
+syn keyword microStatement return nextgroup=microTagE skipwhite skipempty
+
+syn match microTagE /!?/ display contained
+
+"" this is probably not correct
+syn match microOperator display "?\|+\|-\|/\|*\|=\|=\|\^\|&\||\|!\|!=\|>\|>=\|<\|<=\|\~\|%"
+syn match microOperator display "&&\|||"
+
+syn keyword microKeyword def nextgroup=microFuncName skipwhite skipempty
+syn match microFuncName /[_a-zA-Z][_a-zA-Z0-9]*/ nextgroup=microFuncParams display contained
+syn region microFuncParams start=/(/ end=/)/ contains=microVarIdent,microNumber,microChar nextgroup=microVarType,microVarArray skipwhite contained
+
+syn match mucroPropStart /\./ nextgroup=microProp skipwhite
+syn match microProp /[_a-zA-Z][_a-zA-Z0-9]*/ display contained
+
+syn keyword microKeyword var nextgroup=microVarIdent skipwhite skipempty
+syn keyword microKeyword const nextgroup=microVarIdent skipwhite skipempty
+syn match microVarIdent /[_a-zA-Z][_a-zA-Z0-9]*/ nextgroup=microVarType,microVarArray skipwhite
+syn match microVarArray /\[[0-9]*\]/ nextgroup=microVarType transparent contained skipwhite
+syn match microVarType /[_a-zA-Z][_a-zA-Z0-9]*/ display contained
+
+syn match microCall /[_a-zA-Z][_a-zA-Z0-9]*(/he=e-1,me=e-1
+
+syn region microIndex start=/\[/ end=/\]/ contains=microNumber,microChar,microIndexIdent,microIndexCall
+syn match microIndexIdent /[_a-zA-Z][_a-zA-Z0-9]*/ display contained
+syn match microIndexCall /[_a-zA-Z][_a-zA-Z0-9]*(/he=e-1,me=e-1 display contained
+
+syn keyword microBuiltin println panic
+
+syn region microBlock start="{" end="}" transparent fold
+
+syn keyword microCommentTodo TODO FIXME XXX BUG contained
+syn match microLineComment "\/\/.*" contains=@Spell,microCommentTodo
+
+hi def link microLineComment Comment
+hi def link microCommentTodo Todo
+hi def link microNumber Number
+hi def link microCharacter Character
+hi def link microString String
+hi def link microStrEmbeddedQuote String
+hi def link microConditional Conditional
+hi def link microRepeat Repeat
+hi def link microOperator Operator
+hi def link microType Type
+hi def link microVarType Type
+hi def link microBoolean Boolean
+hi def link microKeyword Keyword
+hi def link microStatement Statement
+hi def link microTagE Keyword
+
+hi def link microBuiltin Function
+hi def link microFuncName Function
+hi def link microCall Function
+hi def link microProp Identifier
+
+hi def link microIndexIdent Number
+hi def link microIndexCall Function
+
+let b:current_syntax = "micro"
+
+let &cpo = s:cpo_save
+unlet s:cpo_save
+