Skip to content

Commit

Permalink
Support PICO-8's shorthand WHILE statements
Browse files Browse the repository at this point in the history
  • Loading branch information
Bakudankun committed Jul 21, 2021
1 parent 5376824 commit 8c1faca
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion syntax/pico8.vim
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ syn include @lua syntax/lua.vim


syn region pico8Lua transparent matchgroup=pico8Section start="^__lua__$" end="^__\l\+__$"me=s-1 contains=pico8Tab fold
syn region pico8Tab transparent matchgroup=pico8Tab start="^" end="^-->8$" end="^__\l\+__$"me=s-1 keepend contained contains=@lua,pico8Include,pico8Func,pico8ShortIf fold
syn region pico8Tab transparent matchgroup=pico8Tab start="^" end="^-->8$" end="^__\l\+__$"me=s-1 keepend contained contains=@lua,pico8Include,pico8Func,pico8ShortIf,pico8ShortWhile fold
syn region pico8Gfx transparent matchgroup=pico8Section start="^__gfx__$" end="^__\l\+__$"me=s-1 contains=@pico8Pixel fold
syn region pico8Gff transparent matchgroup=pico8Section start="^__gff__$" end="^__\l\+__$"me=s-1 contains=pico8Flag fold
syn region pico8Label transparent matchgroup=pico8Section start="^__label__$" end="^__\l\+__$"me=s-1 contains=@pico8Pixel fold
Expand All @@ -29,6 +29,9 @@ syn match pico8Include contained containedin=@lua "#include\>"
syn match pico8ShortIf contained containedin=luaFunctionBlock,luaThenEnd,luaElseifThen,luaBlock,luaLoopBlock
\ "\<if\>\s*(.\+)\%(\s*\%(then\|and\|or\|not\|)\|\[\|\]\|,\|+\|-\|\*\|\/\|^\|&\||\|^^\|\~\|<<\|>>\|>>>\|<<>\|>><\|==\|<\|>\|<=\|>=\|\~=\|!=\|,\|\.\|:\)\)\@!\s*.\+"me=s+2
\ nextgroup=luaParen skipwhite
syn match pico8ShortWhile contained containedin=luaFunctionBlock,luaThenEnd,luaElseifThen,luaBlock,luaLoopBlock
\ "\<while\>\s*(.\+)\%(\s*\%(do\|and\|or\|not\|)\|\[\|\]\|,\|+\|-\|\*\|\/\|^\|&\||\|^^\|\~\|<<\|>>\|>>>\|<<>\|>><\|==\|<\|>\|<=\|>=\|\~=\|!=\|,\|\.\|:\)\)\@!\s*.\+"me=s+5
\ nextgroup=luaParen skipwhite
syn keyword pico8Func contained containedin=@luaNormal load save folder dir run stop resume reboot
syn keyword pico8Func contained containedin=@luaNormal info flip printh time t stat extcmd clip pget
syn keyword pico8Func contained containedin=@luaNormal pset sget sset fget fset print cursor color
Expand All @@ -53,6 +56,7 @@ hi def link pico8Section Title
hi def link pico8Func luaFunc
hi def link pico8Include Include
hi def link pico8ShortIf luaCond
hi def link pico8ShortWhile luaCond


if pico8#get_config('colorize_graphics', 1)
Expand Down

0 comments on commit 8c1faca

Please sign in to comment.