-
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
3 changed files
with
85 additions
and
0 deletions.
There are no files selected for viewing
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 @@ | ||
au BufReadPost,FileReadPost,BufNewFile *.ms set filetype=shroom |
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,30 @@ | ||
setlocal nolisp | ||
setlocal autoindent | ||
setlocal indentkeys+=<:>,0=},0=) | ||
setlocal indentexpr=ShroomIndent(v:lnum) | ||
|
||
function! ShroomIndent(lnum) abort | ||
let l:prevlnum = prevnonblank(a:lnum-1) | ||
if l:prevlnum == 0 | ||
return 0 | ||
endif | ||
|
||
" strip comments from EOL | ||
let l:prevl = substitute(getline(l:prevlnum), '\(//\|#\).*$', '', '') | ||
let l:thisl = substitute(getline(a:lnum), '\(//\|#\).*$', '', '') | ||
let l:previ = indent(l:prevlnum) | ||
|
||
let l:ind = l:previ | ||
|
||
if l:prevl =~ '{\s*$' | ||
" previous line opened a block | ||
let l:ind += shiftwidth() | ||
endif | ||
|
||
if l:thisl =~ '^\s*}' | ||
" this line closed a block | ||
let l:ind -= shiftwidth() | ||
endif | ||
|
||
return l:ind | ||
endfunction |
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,54 @@ | ||
if exists("b:current_syntax") | ||
finish | ||
endif | ||
|
||
syn keyword shroomEvent onChoice onPrepare onDiscard onModPower onModStamina onUseStamina onGather onPlay onSummon onDie onEmpty onStart onMorning onTurn onNight onFinish | ||
|
||
syn keyword shroomKeyword if elif else return | ||
syn keyword shroomKeyword has and or space | ||
|
||
syn keyword shroomFunction activate event setPower setStamina setTraits modPower modStamina forceModPower forceModStamina useStamina summon | ||
|
||
syn keyword shroomVariable critter area amount source played target discarded first second none trait from to name value credit at pow stam name | ||
|
||
syn match shroomSymbol "\v\(" | ||
syn match shroomSymbol "\v\)" | ||
syn match shroomSymbol "\v\{" | ||
syn match shroomSymbol "\v\}" | ||
syn match shroomSymbol "\v\=" | ||
syn match shroomSymbol "\v\." | ||
syn match shroomSymbol "\v\," | ||
" syn match shroomSymbol "\v\:\=" | ||
|
||
syn match shroomOperator "\v\+" | ||
syn match shroomOperator "\v\/" | ||
syn match shroomOperator "\v\-" | ||
syn match shroomOperator "\v\*" | ||
|
||
syn region shroomString start=+"+ skip=+\\\\\|\\"\|\\$+ excludenl end=+"+ keepend | ||
|
||
syn match shroomNumber "\v\-?[0-9]+" | ||
|
||
syn match shroomComment1 "#.*$" display | ||
syn match shroomComment2 "\/\/.*$" display | ||
|
||
" hi link shroomBad DiagnosticWarn | ||
hi link shroomSymbol Operator | ||
" hi link shroomOperator Operator | ||
hi link shroomEvent Identifier | ||
hi link shroomFunction Special | ||
hi link shroomString String | ||
hi link shroomNumber Number | ||
hi link shroomVariable Operator | ||
hi link shroomKeyword Keyword | ||
hi link shroomComment1 Comment | ||
hi link shroomComment2 Comment | ||
" hi link shroomType Type | ||
" hi link shroomGeneric Identifier | ||
" PreProc | ||
" Boolean | ||
" String | ||
" Number | ||
" Number | ||
" Comment | ||
" not used PreProc |