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