7
|
1 " Vim syntax file
|
|
2 " Language: Metafont
|
|
3 " Maintainer: Andreas Scherer <andreas.scherer@pobox.com>
|
|
4 " Last Change: April 25, 2001
|
|
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 syn clear
|
|
10 elseif exists("b:current_syntax")
|
|
11 finish
|
|
12 endif
|
|
13
|
|
14 " Metafont 'primitives' as defined in chapter 25 of 'The METAFONTbook'
|
|
15 " Page 210: 'boolean expressions'
|
|
16 syn keyword mfBoolExp true false known unknown odd charexists not and or
|
|
17
|
|
18 " Page 210: 'numeric expression'
|
|
19 syn keyword mfNumExp normaldeviate length ASCII oct hex angle turningnumber
|
|
20 syn keyword mfNumExp totalweight directiontime xpart ypart xxpart xypart
|
|
21 syn keyword mfNumExp yxpart yypart sqrt sind cosd mlog mexp floor
|
|
22 syn keyword mfNumExp uniformdeviate
|
|
23
|
|
24 " Page 211: 'internal quantities'
|
|
25 syn keyword mfInternal tracingtitles tracingequations tracingcapsules
|
|
26 syn keyword mfInternal tracingchoices tracingspecs tracingpens
|
|
27 syn keyword mfInternal tracingcommands tracingrestores tracingmacros
|
|
28 syn keyword mfInternal tracingedges tracingoutput tracingonline tracingstats
|
|
29 syn keyword mfInternal pausing showstopping fontmaking proofing
|
|
30 syn keyword mfInternal turningcheck warningcheck smoothing autorounding
|
|
31 syn keyword mfInternal granularity fillin year month day time
|
|
32 syn keyword mfInternal charcode charext charwd charht chardp charic
|
|
33 syn keyword mfInternal chardx chardy designsize hppp vppp xoffset yoffset
|
|
34 syn keyword mfInternal boundarychar
|
|
35
|
|
36 " Page 212: 'pair expressions'
|
|
37 syn keyword mfPairExp point of precontrol postcontrol penoffset rotated
|
|
38 syn keyword mfPairExp scaled shifted slanted transformed xscaled yscaled
|
|
39 syn keyword mfPairExp zscaled
|
|
40
|
|
41 " Page 213: 'path expressions'
|
|
42 syn keyword mfPathExp makepath reverse subpath curl tension atleast
|
|
43 syn keyword mfPathExp controls cycle
|
|
44
|
|
45 " Page 214: 'pen expressions'
|
|
46 syn keyword mfPenExp nullpen pencircle makepen
|
|
47
|
|
48 " Page 214: 'picutre expressions'
|
|
49 syn keyword mfPicExp nullpicture
|
|
50
|
|
51 " Page 214: 'string expressions'
|
|
52 syn keyword mfStringExp jobname readstring str char decimal substring
|
|
53
|
|
54 " Page 217: 'commands and statements'
|
|
55 syn keyword mfCommand end dump save interim newinternal randomseed let
|
|
56 syn keyword mfCommand delimiters outer everyjob show showvariable showtoken
|
|
57 syn keyword mfCommand showdependencies showstats message errmessage errhelp
|
|
58 syn keyword mfCommand batchmode nonstopmode scrollmode errorstopmode
|
|
59 syn keyword mfCommand addto also contour doublepath withpen withweight cull
|
|
60 syn keyword mfCommand keeping dropping display inwindow openwindow at from to
|
|
61 syn keyword mfCommand shipout special numspecial
|
|
62
|
|
63 " Page 56: 'types'
|
|
64 syn keyword mfType boolean numeric pair path pen picture string transform
|
|
65
|
|
66 " Page 155: 'grouping'
|
|
67 syn keyword mfStatement begingroup endgroup
|
|
68
|
|
69 " Page 165: 'definitions'
|
|
70 syn keyword mfDefinition enddef def expr suffix text primary secondary
|
|
71 syn keyword mfDefinition tertiary vardef primarydef secondarydef tertiarydef
|
|
72
|
|
73 " Page 169: 'conditions and loops'
|
|
74 syn keyword mfCondition if fi else elseif endfor for forsuffixes forever
|
|
75 syn keyword mfCondition step until exitif
|
|
76
|
|
77 " Other primitives listed in the index
|
|
78 syn keyword mfPrimitive charlist endinput expandafter extensible
|
|
79 syn keyword mfPrimitive fontdimen headerbyte inner input intersectiontimes
|
|
80 syn keyword mfPrimitive kern ligtable quote scantokens skipto
|
|
81
|
|
82 " Keywords defined by plain.mf (defined on pp.262-278)
|
|
83 if !exists("plain_mf_macros")
|
|
84 let plain_mf_macros = 1 " Set this to '0' if your source gets too colourful
|
|
85 " metapost.vim does so to turn off Metafont macros
|
|
86 endif
|
|
87 if plain_mf_macros
|
|
88 syn keyword mfMacro abs addto_currentpicture aspect_ratio base_name
|
|
89 syn keyword mfMacro base_version beginchar blacker blankpicture bot bye byte
|
|
90 syn keyword mfMacro capsule_def ceiling change_width clear_pen_memory clearit
|
|
91 syn keyword mfMacro clearpen clearxy counterclockwise culldraw cullit
|
|
92 syn keyword mfMacro currentpen currentpen_path currentpicture
|
|
93 syn keyword mfMacro currenttransform currentwindow cutdraw cutoff d decr
|
|
94 syn keyword mfMacro define_blacker_pixels define_corrected_pixels
|
|
95 syn keyword mfMacro define_good_x_pixels define_good_y_pixels
|
|
96 syn keyword mfMacro define_horizontal_corrected_pixels define_pixels
|
|
97 syn keyword mfMacro define_whole_blacker_pixels define_whole_pixels
|
|
98 syn keyword mfMacro define_whole_vertical_blacker_pixels
|
|
99 syn keyword mfMacro define_whole_vertical_pixels dir direction directionpoint
|
|
100 syn keyword mfMacro displaying ditto div dotprod down downto draw drawdot
|
|
101 syn keyword mfMacro endchar eps epsilon extra_beginchar extra_endchar
|
|
102 syn keyword mfMacro extra_setup erase exitunless fill filldraw fix_units flex
|
|
103 syn keyword mfMacro font_coding_scheme font_extra_space font_identifier
|
|
104 syn keyword mfMacro font_normal_shrink font_normal_space font_normal_stretch
|
|
105 syn keyword mfMacro font_quad font_setup font_size font_slant font_x_height
|
|
106 syn keyword mfMacro fullcircle generate gfcorners gobble gobbled grayfont h
|
|
107 syn keyword mfMacro halfcircle hide hround identity image_rules incr infinity
|
|
108 syn keyword mfMacro interact interpath intersectionpoint inverse italcorr
|
|
109 syn keyword mfMacro join_radius killtext labelfont labels left lft localfont
|
|
110 syn keyword mfMacro loggingall lowres lowres_fix mag magstep makebox makegrid
|
|
111 syn keyword mfMacro makelabel maketicks max min mod mode mode_def mode_name
|
|
112 syn keyword mfMacro mode_setup nodisplays notransforms number_of_modes numtok
|
|
113 syn keyword mfMacro o_correction openit origin pen_bot pen_lft pen_rt pen_top
|
|
114 syn keyword mfMacro penlabels penpos penrazor penspeck pensquare penstroke
|
|
115 syn keyword mfMacro pickup pixels_per_inch proof proofoffset proofrule
|
|
116 syn keyword mfMacro proofrulethickness quartercircle range reflectedabout
|
|
117 syn keyword mfMacro relax right rotatedabout rotatedaround round rt rulepen
|
|
118 syn keyword mfMacro savepen screenchars screen_rows screen_cols screenrule
|
|
119 syn keyword mfMacro screenstrokes shipit showit slantfont smode smoke softjoin
|
|
120 syn keyword mfMacro solve stop superellipse takepower tensepath titlefont
|
|
121 syn keyword mfMacro tolerance top tracingall tracingnone undraw undrawdot
|
|
122 syn keyword mfMacro unfill unfilldraw unitpixel unitsquare unitvector up upto
|
|
123 syn keyword mfMacro vround w whatever
|
|
124 endif
|
|
125
|
|
126 " Some other basic macro names, e.g., from cmbase, logo, etc.
|
|
127 if !exists("other_mf_macros")
|
|
128 let other_mf_macros = 1 " Set this to '0' if your code gets too colourful
|
|
129 " metapost.vim does so to turn off Metafont macros
|
|
130 endif
|
|
131 if other_mf_macros
|
|
132 syn keyword mfMacro beginlogochar
|
|
133 endif
|
|
134
|
|
135 " Numeric tokens
|
|
136 syn match mfNumeric "[-]\=\d\+"
|
|
137 syn match mfNumeric "[-]\=\.\d\+"
|
|
138 syn match mfNumeric "[-]\=\d\+\.\d\+"
|
|
139
|
|
140 " Metafont lengths
|
|
141 syn match mfLength "\<\(bp\|cc\|cm\|dd\|in\|mm\|pc\|pt\)\>"
|
|
142 syn match mfLength "\<[-]\=\d\+\(bp\|cc\|cm\|dd\|in\|mm\|pc\|pt\)\#\=\>"
|
|
143 syn match mfLength "\<[-]\=\.\d\+\(bp\|cc\|cm\|dd\|in\|mm\|pc\|pt\)\#\=\>"
|
|
144 syn match mfLength "\<[-]\=\d\+\.\d\+\(bp\|cc\|cm\|dd\|in\|mm\|pc\|pt\)\#\=\>"
|
|
145
|
|
146 " Metafont coordinates and points
|
|
147 syn match mfCoord "\<[xy]\d\+\>"
|
|
148 syn match mfPoint "\<z\d\+\>"
|
|
149
|
|
150 " String constants
|
|
151 syn region mfString start=+"+ end=+"+
|
|
152
|
|
153 " Comments:
|
|
154 syn match mfComment "%.*$"
|
|
155
|
|
156 " synchronizing
|
|
157 syn sync maxlines=50
|
|
158
|
|
159 " Define the default highlighting
|
|
160 " For version 5.7 and earlier: only when not done already
|
|
161 " For version 5.8 and later: only when an item doesn't have highlighting yet
|
|
162 if version >= 508 || !exists("did_mf_syntax_inits")
|
|
163 if version < 508
|
|
164 let did_mf_syntax_inits = 1
|
|
165 command -nargs=+ HiLink hi link <args>
|
|
166 else
|
|
167 command -nargs=+ HiLink hi def link <args>
|
|
168 endif
|
|
169
|
|
170 HiLink mfBoolExp Statement
|
|
171 HiLink mfNumExp Statement
|
|
172 HiLink mfInternal Identifier
|
|
173 HiLink mfPairExp Statement
|
|
174 HiLink mfPathExp Statement
|
|
175 HiLink mfPenExp Statement
|
|
176 HiLink mfPicExp Statement
|
|
177 HiLink mfStringExp Statement
|
|
178 HiLink mfCommand Statement
|
|
179 HiLink mfType Type
|
|
180 HiLink mfStatement Statement
|
|
181 HiLink mfDefinition Statement
|
|
182 HiLink mfCondition Conditional
|
|
183 HiLink mfPrimitive Statement
|
|
184 HiLink mfMacro Macro
|
|
185 HiLink mfCoord Identifier
|
|
186 HiLink mfPoint Identifier
|
|
187 HiLink mfNumeric Number
|
|
188 HiLink mfLength Number
|
|
189 HiLink mfComment Comment
|
|
190 HiLink mfString String
|
|
191
|
|
192 delcommand HiLink
|
|
193 endif
|
|
194
|
|
195 let b:current_syntax = "mf"
|
|
196
|
|
197 " vim: ts=8
|