28517
|
1 " Vim syntax file
|
|
2 " Language: OpenSCAD
|
|
3 " Maintainer: Niklas Adam <adam@oddodd.org>
|
|
4 " Last change: 2022-04-15
|
|
5 "
|
|
6 "
|
|
7 " From salkin-mada/openscad.nvim
|
|
8 " Building on the work of Sirtaj Singh Kang and others for vim-openscad
|
|
9 "
|
|
10
|
|
11 " quit when a syntax file was already loaded
|
|
12 if exists("b:current_syntax")
|
|
13 finish
|
|
14 endif
|
|
15
|
|
16 syntax case ignore
|
|
17
|
|
18 setlocal iskeyword=a-z,A-Z,48-57,_
|
|
19
|
|
20 syn match openscadAoperator "{"
|
|
21 syn match openscadAoperator "}"
|
|
22 syn match openscadLi "\["
|
|
23 syn match openscadLi "\]"
|
|
24 syn match openscadPar "("
|
|
25 syn match openscadPar ")"
|
|
26
|
|
27 syn match openscadSpecialVariable "\$[a-zA-Z_]\+\>" display
|
|
28 syn match openscadModifier "^\s*[\*\!\#\%]" display
|
|
29
|
|
30 syn match openscadBinaryoperator "+"
|
|
31 syn match openscadBinaryoperator "-"
|
|
32 syn match openscadBinaryoperator "*"
|
|
33 syn match openscadBinaryoperator "/"
|
|
34 syn match openscadBinaryoperator "%"
|
|
35 syn match openscadBinaryoperator "\*\*"
|
|
36 syn match openscadBinaryoperator "<"
|
|
37 syn match openscadBinaryoperator "<="
|
|
38 syn match openscadBinaryoperator ">"
|
|
39 syn match openscadBinaryoperator ">="
|
|
40 syn match openscadBinaryoperator "="
|
|
41 syn match openscadBinaryoperator "=="
|
|
42 syn match openscadBinaryoperator "==="
|
|
43 syn match openscadBinaryoperator "!="
|
|
44 syn match openscadBinaryoperator "!=="
|
|
45 syn match openscadBinaryoperator "&"
|
|
46 syn match openscadBinaryoperator "|"
|
|
47 syn match openscadBinaryoperator "<!"
|
|
48 syn match openscadBinaryoperator "?"
|
|
49 syn match openscadBinaryoperator "??"
|
|
50 syn match openscadBinaryoperator "!?"
|
|
51 syn match openscadBinaryoperator "!"
|
|
52 syn match openscadBinaryoperator "#"
|
|
53 syn match openscadBinaryoperator "_"
|
|
54 syn match openscadBinaryoperator "\.\."
|
|
55 syn match openscadBinaryoperator "\.\.\."
|
|
56 syn match openscadBinaryoperator "`"
|
|
57 syn match openscadBinaryoperator ":"
|
|
58
|
|
59 syn keyword openscadFunctionDef function nextgroup=openscadFunction skipwhite skipempty
|
|
60 syn match openscadFunction /\<\h\w*\>/ contained display
|
|
61
|
|
62 syn keyword openscadModuleDef module nextgroup=openscadModule skipwhite skipempty
|
|
63 syn match openscadModule /\<\h\w*\>/ contained display
|
|
64
|
|
65 syn keyword openscadStatement echo assign let assert
|
|
66 syn keyword openscadConditional if else
|
|
67 syn keyword openscadRepeat for intersection_for
|
|
68 syn keyword openscadInclude include use
|
|
69 syn keyword openscadCsgKeyword union difference intersection render intersection_for
|
|
70 syn keyword openscadTransform scale rotate translate resize mirror multmatrix color minkowski hull projection linear_extrude rotate_extrude offset
|
|
71 syn keyword openscadPrimitiveSolid cube sphere cylinder polyhedron surface
|
|
72 syn keyword openscadPrimitive2D square circle polygon import_dxf text
|
|
73 syn keyword openscadPrimitiveImport import child children
|
|
74
|
|
75 syn match openscadNumbers "\<\d\|\.\d" contains=openscadNumber display transparent
|
|
76 syn match openscadNumber "\d\+" display contained
|
|
77 syn match openscadNumber "\.\d\+" display contained
|
|
78
|
|
79 syn region openscadString start=/"/ skip=/\\"/ end=/"/
|
|
80
|
|
81 syn keyword openscadBoolean true false
|
|
82
|
|
83 syn keyword openscadCommentTodo TODO FIXME XXX NOTE contained display
|
|
84 syn match openscadInlineComment ://.*$: contains=openscadCommentTodo
|
|
85 syn region openscadBlockComment start=:/\*: end=:\*/: fold contains=openscadCommentTodo
|
|
86
|
|
87 syn region openscadBlock start="{" end="}" transparent fold
|
|
88 syn region openscadVector start="\[" end="\]" transparent fold
|
|
89
|
|
90 syn keyword openscadBuiltin abs acos asin atan atan2 ceil cos exp floor ln log
|
|
91 syn keyword openscadBuiltin lookup max min pow rands round sign sin sqrt tan
|
|
92 syn keyword openscadBuiltin str len search version version_num concat chr ord cross norm
|
|
93 syn keyword openscadBuiltin parent_module
|
|
94 syn keyword openscadBuiltin dxf_cross dxf_dim
|
|
95 syn keyword openscadBuiltinSpecial PI undef
|
|
96
|
|
97 """""""""""""""""""""""""""""""""""""""""
|
|
98 " linkage
|
|
99 """""""""""""""""""""""""""""""""""""""""
|
|
100 hi def link openscadFunctionDef Structure
|
|
101 hi def link openscadAoperator Function
|
|
102 hi def link openscadLi Function
|
|
103 " hi def link openscadPar Structure
|
|
104 hi def link openscadBuiltinSpecial Special
|
|
105 hi def link openscadBinaryoperator Special
|
|
106 hi def link openscadFunction Function
|
|
107 hi def link openscadModuleDef Structure
|
|
108 hi def link openscadModule Function
|
|
109 hi def link openscadBlockComment Comment
|
|
110 hi def link openscadBoolean Boolean
|
|
111 hi def link openscadBuiltin Function
|
|
112 hi def link openscadConditional Conditional
|
|
113 hi def link openscadCsgKeyword Structure
|
|
114 hi def link openscadInclude Include
|
|
115 hi def link openscadInlineComment Comment
|
|
116 hi def link openscadModifier Special
|
|
117 hi def link openscadStatement Statement
|
|
118 hi def link openscadNumbers Number
|
|
119 hi def link openscadNumber Number
|
|
120 hi def link openscadPrimitiveSolid Keyword
|
|
121 hi def link openscadPrimitive2D Keyword
|
|
122 hi def link openscadPrimitiveImport Keyword
|
|
123 hi def link openscadRepeat Repeat
|
|
124 hi def link openscadSpecialVariable Special
|
|
125 hi def link openscadString String
|
|
126 hi def link openscadTransform Statement
|
|
127 hi def link openscadCommentTodo Todo
|
|
128
|
|
129 let b:current_syntax = 'openscad'
|