codekingpro/portable-devtools
114k
1vim9script2 3# Vim syntax file4# Language: METAFONT5# Maintainer: Nicola Vitacolonna <nvitacolonna@gmail.com>6# Former Maintainers: Andreas Scherer <andreas.scherer@pobox.com>7# Latest Revision: 2026 Jan 108 9if exists("b:current_syntax")10 finish11endif12 13# Deprecation warnings: to be removed eventually14if exists("g:plain_mf_macros")15 echomsg "[mf] g:plain_mf_macros is deprecated: use g:mf_plain_macros instead."16endif17if exists("g:plain_mf_modes")18 echomsg "[mf] g:plain_mf_modes is deprecated: use g:mf_plain_modes instead."19endif20if exists("g:other_mf_macros")21 echomsg "[mf] g:other_mf_macros is deprecated: use g:mf_other_macros instead."22endif23 24syn iskeyword @,_25 26# METAFONT 'primitives' as defined in chapter 25 of 'The METAFONTbook'27# Page 210: 'boolean expressions'28syn keyword mfBoolExp and charexists false known not odd or true unknown29 30# Page 210: 'numeric expression'31syn keyword mfNumExp ASCII angle cosd directiontime floor hex length32syn keyword mfNumExp mexp mlog normaldeviate oct sind sqrt totalweight33syn keyword mfNumExp turningnumber uniformdeviate xpart xxpart xypart34syn keyword mfNumExp ypart yxpart yypart35 36# Page 211: 'internal quantities'37syn keyword mfInternal autorounding boundarychar charcode chardp chardx38syn keyword mfInternal chardy charext charht charic charwd day designsize39syn keyword mfInternal fillin fontmaking granularity hppp jobname month40syn keyword mfInternal pausing proofing showstopping smoothing time41syn keyword mfInternal tracingcapsules tracingchoices tracingcommands42syn keyword mfInternal tracingedges tracingequations tracingmacros43syn keyword mfInternal tracingonline tracingoutput tracingpens44syn keyword mfInternal tracingrestores tracingspecs tracingstats45syn keyword mfInternal tracingtitles turningcheck vppp warningcheck46syn keyword mfInternal xoffset year yoffset47 48# Page 212: 'pair expressions'49syn keyword mfPairExp of penoffset point postcontrol precontrol rotated50syn keyword mfPairExp scaled shifted slanted transformed xscaled yscaled51syn keyword mfPairExp zscaled52 53# Page 213: 'path expressions'54syn keyword mfPathExp atleast controls curl cycle makepath reverse55syn keyword mfPathExp subpath tension56 57# Page 214: 'pen expressions'58syn keyword mfPenExp makepen nullpen pencircle59 60# Page 214: 'picture expressions'61syn keyword mfPicExp nullpicture62 63# Page 214: 'string expressions'64syn keyword mfStringExp char decimal readstring str substring65 66# Page 217: 'commands and statements'67syn keyword mfCommand addto also at batchmode contour cull delimiters68syn keyword mfCommand display doublepath dropping dump end errhelp69syn keyword mfCommand errmessage errorstopmode everyjob from interim70syn keyword mfCommand inwindow keeping let message newinternal71syn keyword mfCommand nonstopmode numspecial openwindow outer randomseed72syn keyword mfCommand save scrollmode shipout show showdependencies73syn keyword mfCommand showstats showtoken showvariable special to withpen74syn keyword mfCommand withweight75 76# Page 56: 'types'77syn keyword mfType boolean numeric pair path pen picture string78syn keyword mfType transform79 80# Page 155: 'grouping'81syn keyword mfStatement begingroup endgroup82 83# Page 165: 'definitions'84syn keyword mfDefinition def enddef expr primary primarydef secondary85syn keyword mfDefinition secondarydef suffix tertiary tertiarydef text86syn keyword mfDefinition vardef87 88# Page 169: 'conditions and loops'89syn keyword mfCondition else elseif endfor exitif fi for forever90syn keyword mfCondition forsuffixes if step until91 92# Other primitives listed in the index93syn keyword mfPrimitive charlist endinput expandafter extensible fontdimen94syn keyword mfPrimitive headerbyte inner input intersectiontimes kern95syn keyword mfPrimitive ligtable quote scantokens skipto96 97# Implicit suffix parameters98syn match mfSuffixParam "@#\|#@\|@"99 100# These are just tags, but given their special status, we101# highlight them as variables102syn keyword mfVariable x y103 104# Keywords defined by plain.mf (defined on pp.262-278)105if get(g:, "mf_plain_macros", get(g:, "plain_mf_macros", 1))106 syn keyword mfDef addto_currentpicture beginchar capsule_def107 syn keyword mfDef change_width clear_pen_memory clearit clearpen108 syn keyword mfDef clearxy culldraw cullit cutdraw109 syn keyword mfDef define_blacker_pixels define_corrected_pixels110 syn keyword mfDef define_good_x_pixels define_good_y_pixels111 syn keyword mfDef define_horizontal_corrected_pixels define_pixels112 syn keyword mfDef define_whole_blacker_pixels define_whole_pixels113 syn keyword mfDef define_whole_vertical_blacker_pixels114 syn keyword mfDef define_whole_vertical_pixels downto draw drawdot115 syn keyword mfDef endchar erase exitunless fill filldraw fix_units116 syn keyword mfDef flex font_coding_scheme font_extra_space117 syn keyword mfDef font_identifier font_normal_shrink118 syn keyword mfDef font_normal_space font_normal_stretch font_quad119 syn keyword mfDef font_size font_slant font_x_height gfcorners gobble120 syn keyword mfDef hide imagerules interact italcorr killtext121 syn keyword mfDef loggingall lowres_fix makebox makegrid maketicks122 syn keyword mfDef mode_def mode_setup nodisplays notransforms numtok123 syn keyword mfDef openit penrazor pensquare penstroke pickup124 syn keyword mfDef proofoffset proofrule range reflectedabout125 syn keyword mfDef rotatedaround screenchars screenrule screenstrokes126 syn keyword mfDef shipit showit smode stop superellipse takepower127 syn keyword mfDef tracingall tracingnone undraw undrawdot unfill128 syn keyword mfDef unfilldraw upto z129 syn match mfDef "???"130 syn keyword mfVardef bot byte ceiling counterclockwise cutoff decr dir131 syn keyword mfVardef direction directionpoint grayfont hround incr132 syn keyword mfVardef interpath inverse labelfont labels lft magstep133 # Note: nodot is not a vardef, it is used as in makelabel.lft.nodot("5",z5)134 # (METAFONT only)135 syn keyword mfVardef makelabel max min nodot penlabels penpos136 syn keyword mfVardef proofrulethickness round rt savepen slantfont solve137 syn keyword mfVardef tensepath titlefont top unitvector vround whatever138 syn match mpVardef "\<good\.\%(x\|y\|lft\|rt\|top\|bot\)\>"139 syn keyword mfPrimaryDef div dotprod gobbled mod140 syn keyword mfSecondaryDef intersectionpoint141 syn keyword mfTertiaryDef softjoin thru142 syn keyword mfNewInternal blacker currentwindow displaying eps epsilon143 syn keyword mfNewInternal infinity join_radius number_of_modes o_correction144 syn keyword mfNewInternal pen_bot pen_lft pen_rt pen_top pixels_per_inch145 syn keyword mfNewInternal screen_cols screen_rows tolerance146 # Predefined constants147 syn keyword mfConstant base_name base_version blankpicture ditto down148 syn keyword mfConstant fullcircle halfcircle identity left lowres origin149 syn keyword mfConstant penspeck proof quartercircle right rulepen smoke150 syn keyword mfConstant unitpixel unitsquare up151 # Other predefined variables152 syn keyword mfVariable aspect_ratio currentpen extra_beginchar153 syn keyword mfVariable extra_endchar currentpen_path currentpicture154 syn keyword mfVariable currenttransform d extra_setup h localfont mag mode155 syn keyword mfVariable mode_name w156 # let statements:157 syn keyword mfnumExp abs158 syn keyword mfPairExp rotatedabout159 syn keyword mfCommand bye relax160endif161 162# By default, METAFONT loads modes.mf, too163if get(g:, "plain_mf_modes", get(g:, "mf_plain_modes", 1))164 syn keyword mfConstant APSSixMed AgfaFourZeroZero AgfaThreeFourZeroZero165 syn keyword mfConstant AtariNineFive AtariNineSix AtariSLMEightZeroFour166 syn keyword mfConstant AtariSMOneTwoFour CItohEightFiveOneZero167 syn keyword mfConstant CItohThreeOneZero CanonBJCSixZeroZero CanonCX168 syn keyword mfConstant CanonEX CanonLBPLX CanonLBPTen CanonSX ChelgraphIBX169 syn keyword mfConstant CompugraphicEightSixZeroZero170 syn keyword mfConstant CompugraphicNineSixZeroZero DD DEClarge DECsmall171 syn keyword mfConstant DataDiscNew EightThree EpsonAction172 syn keyword mfConstant EpsonLQFiveZeroZeroLo EpsonLQFiveZeroZeroMed173 syn keyword mfConstant EpsonMXFX EpsonSQEightSevenZero EpsonStylusPro174 syn keyword mfConstant EpsonStylusProHigh EpsonStylusProLow175 syn keyword mfConstant EpsonStylusProMed FourFour GThreefax HPDeskJet176 syn keyword mfConstant HPLaserJetIIISi IBMFourTwoFiveZero IBMFourTwoOneSix177 syn keyword mfConstant IBMFourTwoThreeZero IBMFourZeroOneNine178 syn keyword mfConstant IBMFourZeroThreeNine IBMFourZeroTwoNine179 syn keyword mfConstant IBMProPrinter IBMSixOneFiveFour IBMSixSixSevenZero180 syn keyword mfConstant IBMThreeEightOneTwo IBMThreeEightTwoZero181 syn keyword mfConstant IBMThreeOneNineThree IBMThreeOneSevenNine182 syn keyword mfConstant IBMUlfHolleberg LASevenFive LNOthreR LNOthree183 syn keyword mfConstant LNZeroOne LNZeroThree LPSFourZero LPSTwoZero184 syn keyword mfConstant LexmarkFourZeroThreeNine LexmarkOptraR185 syn keyword mfConstant LexmarkOptraS LinotypeLThreeThreeZero186 syn keyword mfConstant LinotypeOneZeroZero LinotypeOneZeroZeroLo187 syn keyword mfConstant LinotypeThreeZeroZeroHi MacTrueSize NeXTprinter188 syn keyword mfConstant NeXTscreen NecTwoZeroOne Newgen NineOne189 syn keyword mfConstant OCESixSevenFiveZeroPS OneTwoZero OneZeroZero190 syn keyword mfConstant PrintwareSevenTwoZeroIQ Prism QMSOneSevenTwoFive191 syn keyword mfConstant QMSOneSevenZeroZero QMSTwoFourTwoFive RicohA192 syn keyword mfConstant RicohFortyEighty RicohFourZeroEightZero RicohLP193 syn keyword mfConstant SparcPrinter StarNLOneZero VAXstation VTSix194 syn keyword mfConstant VarityperFiveZeroSixZeroW195 syn keyword mfConstant VarityperFourThreeZeroZeroHi196 syn keyword mfConstant VarityperFourThreeZeroZeroLo197 syn keyword mfConstant VarityperFourTwoZeroZero VarityperSixZeroZero198 syn keyword mfConstant XeroxDocutech XeroxEightSevenNineZero199 syn keyword mfConstant XeroxFourZeroFiveZero XeroxNineSevenZeroZero200 syn keyword mfConstant XeroxPhaserSixTwoZeroZeroDP XeroxThreeSevenZeroZero201 syn keyword mfConstant Xerox_world agfafzz agfatfzz amiga aps apssixhi202 syn keyword mfConstant aselect atariezf atarinf atarins atariotf bitgraph203 syn keyword mfConstant bjtenex bjtzzex bjtzzl bjtzzs boise canonbjc204 syn keyword mfConstant canonex canonlbp cg cgl cgnszz citohtoz corona crs205 syn keyword mfConstant cthreeten cx datadisc declarge decsmall deskjet206 syn keyword mfConstant docutech dover dp dpdfezzz eighthre elvira epscszz207 syn keyword mfConstant epsdraft epsdrft epsdrftl epsfast epsfastl epshi208 syn keyword mfConstant epslo epsmed epsmedl epson epsonact epsonfx epsonl209 syn keyword mfConstant epsonlo epsonlol epsonlq epsonsq epstylus epstylwr210 syn keyword mfConstant epstyplo epstypmd epstypml epstypro epswlo epswlol211 syn keyword mfConstant esphi fourfour gpx gtfax gtfaxhi gtfaxl gtfaxlo212 syn keyword mfConstant gtfaxlol help hifax highfax hplaser hprugged ibm_a213 syn keyword mfConstant ibmd ibmega ibmegal ibmfzon ibmfztn ibmpp ibmppl214 syn keyword mfConstant ibmsoff ibmteot ibmtetz ibmtont ibmtosn ibmtosnl215 syn keyword mfConstant ibmvga ibx imagen imagewriter itoh itohl itohtoz216 syn keyword mfConstant itohtozl iw jetiiisi kyocera laserjet laserjetfive217 syn keyword mfConstant laserjetfivemp laserjetfour laserjetfourthousand218 syn keyword mfConstant laserjetfourzerozerozero laserjethi laserjetlo219 syn keyword mfConstant laserjettwoonezerozero220 syn keyword mfConstant laserjettwoonezerozerofastres lasermaster221 syn keyword mfConstant laserwriter lasf lexmarkr lexmarks lexmarku222 syn keyword mfConstant linohalf linohi linolo linolttz linoone linosuper223 syn keyword mfConstant linothree linothreelo linotzzh ljfive ljfivemp224 syn keyword mfConstant ljfour ljfzzz ljfzzzfr ljlo ljtozz ljtozzfr lmaster225 syn keyword mfConstant lnotr lnzo lps lpstz lqhires lqlores lqmed lqmedl226 syn keyword mfConstant lqmedres lview lviewl lwpro macmag mactrue modes_mf227 syn keyword mfConstant ncd nec nechi neclm nectzo newdd newddl nexthi228 syn keyword mfConstant nextscreen nextscrn nineone nullmode ocessfz229 syn keyword mfConstant okidata okidatal okifourten okifte okihi onetz230 syn keyword mfConstant onezz pcprevw pcscreen phaser phaserfs phasertf231 syn keyword mfConstant phasertfl phasertl pixpt printware prntware232 syn keyword mfConstant proprinter qms qmsesz qmsostf qmsoszz qmstftf ricoh233 syn keyword mfConstant ricoha ricohlp ricohsp sherpa sparcptr starnlt234 syn keyword mfConstant starnltl styletwo stylewr stylewri stylewriter sun235 syn keyword mfConstant supre swtwo toshiba ultre varityper vs vtftzz236 syn keyword mfConstant vtftzzhi vtftzzlo vtfzszw vtszz xpstzz xpstzzl237 syn keyword mfConstant xrxesnz xrxfzfz xrxnszz xrxtszz238 syn keyword mfDef BCPL_string coding_scheme font_face_byte239 syn keyword mfDef font_family landscape240 syn keyword mfDef mode_extra_info mode_help mode_param241 syn keyword mfNewInternal blacker_min242endif243 244# Some other basic macro names, e.g., from cmbase, logo, etc.245if get(g:, "mf_other_macros", get(g:, "other_mf_macros", 1))246 syn keyword mfDef beginlogochar247 syn keyword mfDef font_setup248 syn keyword mfPrimitive generate249endif250 251# Numeric tokens252syn match mfNumeric "[-]\=\d\+"253syn match mfNumeric "[-]\=\.\d\+"254syn match mfNumeric "[-]\=\d\+\.\d\+"255 256# METAFONT lengths257syn match mfLength "\<\(bp\|cc\|cm\|dd\|in\|mm\|pc\|pt\)\>"258syn match mfLength "[-]\=\d\+\(bp\|cc\|cm\|dd\|in\|mm\|pc\|pt\)\#\="259syn match mfLength "[-]\=\.\d\+\(bp\|cc\|cm\|dd\|in\|mm\|pc\|pt\)\#\="260syn match mfLength "[-]\=\d\+\.\d\+\(bp\|cc\|cm\|dd\|in\|mm\|pc\|pt\)\#\="261 262# String constants263syn match mfOpenString /"[^"]*/264syn region mfString oneline keepend start=+"+ end=+"+265 266# Comments:267syn keyword mfTodoComment contained TODO FIXME XXX DEBUG NOTE268syn match mfComment "%.*$" contains=mfTodoComment,@Spell269 270# synchronizing271syn sync maxlines=100272 273# Define the default highlighting274hi def link mfBoolExp Statement275hi def link mfNumExp Statement276hi def link mfPairExp Statement277hi def link mfPathExp Statement278hi def link mfPenExp Statement279hi def link mfPicExp Statement280hi def link mfStringExp Statement281hi def link mfInternal Identifier282hi def link mfCommand Statement283hi def link mfType Type284hi def link mfStatement Statement285hi def link mfDefinition Statement286hi def link mfCondition Conditional287hi def link mfPrimitive Statement288hi def link mfDef Function289hi def link mfVardef mfDef290hi def link mfPrimaryDef mfDef291hi def link mfSecondaryDef mfDef292hi def link mfTertiaryDef mfDef293hi def link mfCoord Identifier294hi def link mfPoint Identifier295hi def link mfNumeric Number296hi def link mfLength Number297hi def link mfComment Comment298hi def link mfString String299hi def link mfOpenString Todo300hi def link mfSuffixParam Label301hi def link mfNewInternal mfInternal302hi def link mfVariable Identifier303hi def link mfConstant Constant304hi def link mfTodoComment Todo305 306b:current_syntax = "mf"307 308# vim: sw=2 fdm=marker309 