diff options
author | Mike Buland <eichlan@xagasoft.com> | 2011-12-30 11:28:30 -0700 |
---|---|---|
committer | Mike Buland <eichlan@xagasoft.com> | 2011-12-30 11:28:30 -0700 |
commit | e112d781ea5ffc4186e7d70dba595b5a233335a8 (patch) | |
tree | bea2120759c77e20e140e0958393aeef936f0a24 | |
parent | 5898cb722a225ca6a876152ae365c2de3a6e81ac (diff) | |
download | stage-e112d781ea5ffc4186e7d70dba595b5a233335a8.tar.gz stage-e112d781ea5ffc4186e7d70dba595b5a233335a8.tar.bz2 stage-e112d781ea5ffc4186e7d70dba595b5a233335a8.tar.xz stage-e112d781ea5ffc4186e7d70dba595b5a233335a8.zip |
Added vim highlighting for stage scripts.
-rw-r--r-- | support/vim/ftdetect/stage.vim | 1 | ||||
-rw-r--r-- | support/vim/ftplugin/stage.vim | 24 | ||||
-rw-r--r-- | support/vim/syntax/stage.vim | 77 | ||||
-rw-r--r-- | test.stage | 5 |
4 files changed, 107 insertions, 0 deletions
diff --git a/support/vim/ftdetect/stage.vim b/support/vim/ftdetect/stage.vim new file mode 100644 index 0000000..b826efe --- /dev/null +++ b/support/vim/ftdetect/stage.vim | |||
@@ -0,0 +1 @@ | |||
au BufRead,BufNewFile *.stage set filetype=stage | |||
diff --git a/support/vim/ftplugin/stage.vim b/support/vim/ftplugin/stage.vim new file mode 100644 index 0000000..96ed1b5 --- /dev/null +++ b/support/vim/ftplugin/stage.vim | |||
@@ -0,0 +1,24 @@ | |||
1 | " Vim filetype plugin file | ||
2 | " Language: Stage | ||
3 | |||
4 | " Only do this when not done yet for this buffer | ||
5 | if exists("b:did_ftplugin") | ||
6 | finish | ||
7 | endif | ||
8 | |||
9 | " Don't load another plugin for this buffer | ||
10 | let b:did_ftplugin = 1 | ||
11 | |||
12 | " Set format options -- allow comment formatting with gq, but disable | ||
13 | " other processing | ||
14 | setlocal fo-=tcrowan2 fo+=q | ||
15 | |||
16 | " Set 'comments' to be the same as C/C++ | ||
17 | setlocal comments=sO:*\ -,mO:*\ \ ,exO:*/,s1:/*,mb:*,ex:*/,:// | ||
18 | |||
19 | " Win32 can filter files in the browse dialog | ||
20 | if has("gui_win32") && !exists("b:browsefilter") | ||
21 | let b:browsefilter = "Stage files (*.stage)\t*.stage\n" . | ||
22 | \ "All Files (*.*)\t*.*\n" | ||
23 | endif | ||
24 | |||
diff --git a/support/vim/syntax/stage.vim b/support/vim/syntax/stage.vim new file mode 100644 index 0000000..b5dab28 --- /dev/null +++ b/support/vim/syntax/stage.vim | |||
@@ -0,0 +1,77 @@ | |||
1 | " Vim syntax file | ||
2 | " Language: Stage | ||
3 | " Maintainer: Mike Buland :) | ||
4 | " Last Change: 2012 Dec 30 | ||
5 | |||
6 | " For version 5.x: Clear all syntax items | ||
7 | " For version 6.x: Quit when a syntax file was already loaded | ||
8 | if version < 600 | ||
9 | syntax clear | ||
10 | elseif exists("b:current_syntax") | ||
11 | finish | ||
12 | endif | ||
13 | |||
14 | " Keywords | ||
15 | syn keyword Conditional if then else | ||
16 | syn keyword Loop for each do in while | ||
17 | syn keyword Logic not and or | ||
18 | syn keyword Statement setup enter | ||
19 | syn keyword Todo TODO FIXME XXX | ||
20 | syn keyword Type function command situation game global player | ||
21 | syn keyword Constant null true false | ||
22 | syn keyword Builtins display goto exists delete | ||
23 | |||
24 | syn match TargetProcess /[a-zA-Z_][a-zA-Z0-9_]*:/he=e-1 | ||
25 | |||
26 | syn cluster CommentGroup contains=Todo | ||
27 | |||
28 | syn match Special display contained "\\\(x\x\+\|\o\{1,3}\|.\|$\)" | ||
29 | syn match Special display contained "\\\(u\x\{4}\|U\x\{8}\)" | ||
30 | |||
31 | " TODO: do we want to end at end of line too? | ||
32 | syn region tripSingleString start=+'''+ skip=+\\\\\|\\'+ end=+'''+ contains=Special,CmdEx | ||
33 | syn region tripDoubleString start=+"""+ skip=+\\\\\|\\"+ end=+"""+ contains=Special,CmdEx | ||
34 | syn region singleString start=+'+ skip=+\\\\\|\\'+ end=+'+ contains=Special,CmdEx | ||
35 | syn region doubleString start=+"+ skip=+\\\\\|\\"+ end=+"+ contains=Special,CmdEx | ||
36 | syn region sitName start=+<<+ end=+>>+ contains=Special,CmdEx | ||
37 | |||
38 | syn region CmdEx start=+$(+ skip=+"\|\\)\|\\\\+ end=+)+ | ||
39 | |||
40 | syn case ignore | ||
41 | syn match Numbers display transparent "\<\d\|\.\d" contains=Number,Float,OctalError,Octal | ||
42 | syn match Number display contained "\d\+\(u\=l\{0,2}\|ll\=u\)\>" | ||
43 | " Hex | ||
44 | syn match Number display contained "0x\x\+\(u\=l\{0,2}\|ll\=u\)\>" | ||
45 | syn match Octal display contained "0\o\+\(u\=l\{0,2}\|ll\=u\)\>" contains=cOctalZero | ||
46 | syn match OctalZero display contained "\<0" | ||
47 | syn match Float display contained "\d\+f" | ||
48 | syn match Float display contained "\d\+\.\d*\(e[-+]\=\d\+\)\=[fl]\=" | ||
49 | syn match Float display contained "\.\d\+\(e[-+]\=\d\+\)\=[fl]\=\>" | ||
50 | syn match Float display contained "\d\+e[-+]\=\d\+[fl]\=\>" | ||
51 | " Flag bad digits in octal | ||
52 | syn match OctalError display contained "0\o*[89]\d*" | ||
53 | syn case match | ||
54 | |||
55 | |||
56 | syn region cppComment start="#" skip="\\$" end="$" contains=@CommentGroup keepend | ||
57 | syn region cComment start="/\*" end="\*/" contains=@CommentGroup fold | ||
58 | syn region cppComment start="//" skip="\\$" end="$" contains=@CommentGroup keepend | ||
59 | |||
60 | |||
61 | syntax region Block start="{" end="}" transparent fold | ||
62 | |||
63 | hi def link OctalError Error | ||
64 | hi def link cComment Comment | ||
65 | hi def link cppComment Comment | ||
66 | hi def link tripSingleString String | ||
67 | hi def link tripDoubleString String | ||
68 | hi def link singleString String | ||
69 | hi def link doubleString String | ||
70 | hi def link sitName String | ||
71 | hi def link cmdEx String | ||
72 | hi def link Constructor Operator | ||
73 | hi def link Logic Statement | ||
74 | hi def link Loop Conditional | ||
75 | hi def link Builtins Function | ||
76 | hi def link TargetProcess Type | ||
77 | |||
@@ -69,6 +69,11 @@ situation <<stuff>> | |||
69 | { | 69 | { |
70 | display("You can't eat " + object ); | 70 | display("You can't eat " + object ); |
71 | } | 71 | } |
72 | |||
73 | command: "eat" object "now" | ||
74 | { | ||
75 | display("Alright, fine, eat " + object + " now..." ); | ||
76 | } | ||
72 | 77 | ||
73 | setup | 78 | setup |
74 | { | 79 | { |