blob: 3fc18c68476aa82dac5295815472e9c9b53ea7ce [file] [log] [blame]
Bram Moolenaar071d4272004-06-13 20:20:40 +00001" Vim syntax file
2" Language: TSS (Thermal Synthesizer System) Command Line
3" Maintainer: Adrian Nagle, anagle@ball.com
4" Last Change: 2003 May 11
5" Filenames: *.tsscl
6" URL: http://www.naglenet.org/vim/syntax/tsscl.vim
7" MAIN URL: http://www.naglenet.org/vim/
8
9
10
11" For version 5.x: Clear all syntax items
12" For version 6.x: Quit when a syntax file was already loaded
13if version < 600
14 syntax clear
15elseif exists("b:current_syntax")
16 finish
17endif
18
19
20
21" Ignore case
22syn case ignore
23
24
25
26"
27"
28" Begin syntax definitions for tss geomtery file.
29"
30
31" Load TSS geometry syntax file
32"source $VIM/myvim/tssgm.vim
33"source $VIMRUNTIME/syntax/c.vim
34
35" Define keywords for TSS
36syn keyword tssclCommand begin radk list heatrates attr draw
37
38syn keyword tssclKeyword cells rays error nodes levels objects cpu
39syn keyword tssclKeyword units length positions energy time unit solar
40syn keyword tssclKeyword solar_constant albedo planet_power
41
42syn keyword tssclEnd exit
43
44syn keyword tssclUnits cm feet meters inches
45syn keyword tssclUnits Celsius Kelvin Fahrenheit Rankine
46
47
48
49" Define matches for TSS
50syn match tssclString /"[^"]\+"/ contains=ALLBUT,tssInteger,tssclKeyword,tssclCommand,tssclEnd,tssclUnits
51
52syn match tssclComment "#.*$"
53
54" rational and logical operators
55" < Less than
56" > Greater than
57" <= Less than or equal
58" >= Greater than or equal
59" == or = Equal to
60" != Not equal to
61" && or & Logical AND
62" || or | Logical OR
63" ! Logical NOT
64"
65" algebraic operators:
66" ^ or ** Exponentation
67" * Multiplication
68" / Division
69" % Remainder
70" + Addition
71" - Subtraction
72"
73syn match tssclOper "||\||\|&&\|&\|!=\|!\|>=\|<=\|>\|<\|+\|-\|^\|\*\*\|\*\|/\|%\|==\|=\|\." skipwhite
74
75" CLI Directive Commands, with arguments
76"
77" BASIC COMMAND LIST
78" *ADD input_source
79" *ARITHMETIC { [ON] | OFF }
80" *CLOSE unit_number
81" *CPU
82" *DEFINE
83" *ECHO[/qualifiers] { [ON] | OFF }
84" *ELSE [IF { 0 | 1 } ]
85" *END { IF | WHILE }
86" *EXIT
87" *IF { 0 | 1 }
88" *LIST/n list variable
89" *OPEN[/r | /r+ | /w | /w+ ] unit_number file_name
90" *PROMPT prompt_string sybol_name
91" *READ/unit=unit_number[/LOCAL | /GLOBAL ] sym1 [sym2, [sym3 ...]]
92" *REWIND
93" *STOP
94" *STRCMP string_1 string_2 difference
95" *SYSTEM command
96" *UNDEFINE[/LOCAL][/GLOBAL] symbol_name
97" *WHILE { 0 | 1 }
98" *WRITE[/unit=unit_number] output text
99"
100syn match tssclDirective "\*ADD"
101syn match tssclDirective "\*ARITHMETIC \+\(ON\|OFF\)"
102syn match tssclDirective "\*CLOSE"
103syn match tssclDirective "\*CPU"
104syn match tssclDirective "\*DEFINE"
105syn match tssclDirective "\*ECHO"
106syn match tssclConditional "\*ELSE"
107syn match tssclConditional "\*END \+\(IF\|WHILE\)"
108syn match tssclDirective "\*EXIT"
109syn match tssclConditional "\*IF"
110syn match tssclDirective "\*LIST"
111syn match tssclDirective "\*OPEN"
112syn match tssclDirective "\*PROMPT"
113syn match tssclDirective "\*READ"
114syn match tssclDirective "\*REWIND"
115syn match tssclDirective "\*STOP"
116syn match tssclDirective "\*STRCMP"
117syn match tssclDirective "\*SYSTEM"
118syn match tssclDirective "\*UNDEFINE"
119syn match tssclConditional "\*WHILE"
120syn match tssclDirective "\*WRITE"
121
122syn match tssclContChar "-$"
123
124" C library functoins
125" Bessel functions (jn, yn)
126" Error and complementary error fuctions (erf, erfc)
127" Exponential functions (exp)
128" Logrithm (log, log10)
129" Power (pow)
130" Square root (sqrt)
131" Floor (floor)
132" Ceiling (ceil)
133" Floating point remainder (fmod)
134" Floating point absolute value (fabs)
135" Gamma (gamma)
136" Euclidean distance function (hypot)
137" Hperbolic functions (sinh, cosh, tanh)
138" Trigometric functions in radians (sin, cos, tan, asin, acos, atan, atan2)
139" Trigometric functions in degrees (sind, cosd, tand, asind, acosd, atand,
140" atan2d)
141"
142" local varialbles: cl_arg1, cl_arg2, etc. (cl_arg is an array of arguments)
143" cl_args is the number of arguments
144"
145"
146" I/O: *PROMPT, *WRITE, *READ
147"
148" Conditional branching:
149" IF, ELSE IF, END
150" *IF value *IF I==10
151" *ELSE IF value *ELSE IF I<10
152" *ELSE *ELSE
153" *ENDIF *ENDIF
154"
155"
156" Iterative looping:
157" WHILE
158" *WHILE test
159" .....
160" *END WHILE
161"
162"
163" EXAMPLE:
164" *DEFINE I = 1
165" *WHILE (I <= 10)
166" *WRITE I = 'I'
167" *DEFINE I = (I + 1)
168" *END WHILE
169"
170
171syn match tssclQualifier "/[^/ ]\+"hs=s+1
172syn match tssclSymbol "'\S\+'"
173"syn match tssclSymbol2 " \S\+ " contained
174
175syn match tssclInteger "-\=\<[0-9]*\>"
176syn match tssclFloat "-\=\<[0-9]*\.[0-9]*"
177syn match tssclScientific "-\=\<[0-9]*\.[0-9]*E[-+]\=[0-9]\+\>"
178
179
180
181" Define the default highlighting
182" For version 5.7 and earlier: only when not done already
183" For version 5.8 and later: only when an item doesn't have highlighting yet
184if version >= 508 || !exists("did_tsscl_syntax_inits")
185 if version < 508
186 let did_tsscl_syntax_inits = 1
187 command -nargs=+ HiLink hi link <args>
188 else
189 command -nargs=+ HiLink hi def link <args>
190 endif
191
192 HiLink tssclCommand Statement
193 HiLink tssclKeyword Special
194 HiLink tssclEnd Macro
195 HiLink tssclUnits Special
196
197 HiLink tssclComment Comment
198 HiLink tssclDirective Statement
199 HiLink tssclConditional Conditional
200 HiLink tssclContChar Macro
201 HiLink tssclQualifier Typedef
202 HiLink tssclSymbol Identifier
203 HiLink tssclSymbol2 Symbol
204 HiLink tssclString String
205 HiLink tssclOper Operator
206
207 HiLink tssclInteger Number
208 HiLink tssclFloat Number
209 HiLink tssclScientific Number
210
211 delcommand HiLink
212endif
213
214
215let b:current_syntax = "tsscl"
216
217" vim: ts=8 sw=2