xref: /vim-8.2.3635/runtime/syntax/sl.vim (revision 5f1920ad)
1" Vim syntax file
2" Language:	Renderman shader language
3" Maintainer:	Dan Piponi <[email protected]>
4" Last Change:	2001 May 09
5
6" quit when a syntax file was already loaded
7if exists("b:current_syntax")
8  finish
9endif
10
11" A bunch of useful Renderman keywords including special
12" RenderMan control structures
13syn keyword slStatement	break return continue
14syn keyword slConditional	if else
15syn keyword slRepeat		while for
16syn keyword slRepeat		illuminance illuminate solar
17
18syn keyword slTodo contained	TODO FIXME XXX
19
20" String and Character constants
21" Highlight special characters (those which have a backslash) differently
22syn match slSpecial contained	"\\[0-9][0-9][0-9]\|\\."
23syn region slString		start=+"+ skip=+\\\\\|\\"+ end=+"+ contains=slSpecial
24syn match slCharacter		"'[^\\]'"
25syn match slSpecialCharacter	"'\\.'"
26syn match slSpecialCharacter	"'\\[0-9][0-9]'"
27syn match slSpecialCharacter	"'\\[0-9][0-9][0-9]'"
28
29"catch errors caused by wrong parenthesis
30syn region slParen		transparent start='(' end=')' contains=ALLBUT,slParenError,slIncluded,slSpecial,slTodo,slUserLabel
31syn match slParenError		")"
32syn match slInParen contained	"[{}]"
33
34"integer number, or floating point number without a dot and with "f".
35syn case ignore
36syn match slNumber		"\<[0-9]\+\(u\=l\=\|lu\|f\)\>"
37"floating point number, with dot, optional exponent
38syn match slFloat		"\<[0-9]\+\.[0-9]*\(e[-+]\=[0-9]\+\)\=[fl]\=\>"
39"floating point number, starting with a dot, optional exponent
40syn match slFloat		"\.[0-9]\+\(e[-+]\=[0-9]\+\)\=[fl]\=\>"
41"floating point number, without dot, with exponent
42syn match slFloat		"\<[0-9]\+e[-+]\=[0-9]\+[fl]\=\>"
43"hex number
44syn match slNumber		"\<0x[0-9a-f]\+\(u\=l\=\|lu\)\>"
45"syn match slIdentifier	"\<[a-z_][a-z0-9_]*\>"
46syn case match
47
48if exists("sl_comment_strings")
49  " A comment can contain slString, slCharacter and slNumber.
50  " But a "*/" inside a slString in a slComment DOES end the comment!  So we
51  " need to use a special type of slString: slCommentString, which also ends on
52  " "*/", and sees a "*" at the start of the line as comment again.
53  " Unfortunately this doesn't very well work for // type of comments :-(
54  syntax match slCommentSkip	contained "^\s*\*\($\|\s\+\)"
55  syntax region slCommentString	contained start=+"+ skip=+\\\\\|\\"+ end=+"+ end=+\*/+me=s-1 contains=slSpecial,slCommentSkip
56  syntax region slComment2String	contained start=+"+ skip=+\\\\\|\\"+ end=+"+ end="$" contains=slSpecial
57  syntax region slComment	start="/\*" end="\*/" contains=slTodo,slCommentString,slCharacter,slNumber
58else
59  syn region slComment		start="/\*" end="\*/" contains=slTodo
60endif
61syntax match slCommentError	"\*/"
62
63syn keyword slOperator	sizeof
64syn keyword slType		float point color string vector normal matrix void
65syn keyword slStorageClass	varying uniform extern
66syn keyword slStorageClass	light surface volume displacement transformation imager
67syn keyword slVariable	Cs Os P dPdu dPdv N Ng u v du dv s t
68syn keyword slVariable L Cl Ol E I ncomps time Ci Oi
69syn keyword slVariable Ps alpha
70syn keyword slVariable dtime dPdtime
71
72syn sync ccomment slComment minlines=10
73
74" Define the default highlighting.
75" Only when an item doesn't have highlighting yet
76
77hi def link slLabel	Label
78hi def link slUserLabel	Label
79hi def link slConditional	Conditional
80hi def link slRepeat	Repeat
81hi def link slCharacter	Character
82hi def link slSpecialCharacter slSpecial
83hi def link slNumber	Number
84hi def link slFloat	Float
85hi def link slParenError	slError
86hi def link slInParen	slError
87hi def link slCommentError	slError
88hi def link slOperator	Operator
89hi def link slStorageClass	StorageClass
90hi def link slError	Error
91hi def link slStatement	Statement
92hi def link slType		Type
93hi def link slCommentError	slError
94hi def link slCommentString slString
95hi def link slComment2String slString
96hi def link slCommentSkip	slComment
97hi def link slString	String
98hi def link slComment	Comment
99hi def link slSpecial	SpecialChar
100hi def link slTodo	Todo
101hi def link slVariable	Identifier
102"hi def link slIdentifier	Identifier
103
104
105let b:current_syntax = "sl"
106
107" vim: ts=8
108