neovim

Neovim text editor
git clone https://git.dasho.dev/neovim.git
Log | Files | Refs | README

sl.vim (4084B)


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