summaryrefslogtreecommitdiffstats
path: root/runtime/syntax
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2016-10-01 14:47:05 +0200
committerBram Moolenaar <Bram@vim.org>2016-10-01 14:47:05 +0200
commit2ec618c9feac4573b154510236ad8121c77d0eca (patch)
tree5a0d1b003e7829d735719a7795c5cdeb9959a74d /runtime/syntax
parentb3435b0a3a0967115658d0a8c0224a28969cfa02 (diff)
Updated runtime files.
Diffstat (limited to 'runtime/syntax')
-rw-r--r--runtime/syntax/debsources.vim4
-rw-r--r--runtime/syntax/mf.vim371
-rw-r--r--runtime/syntax/mp.vim828
3 files changed, 982 insertions, 221 deletions
diff --git a/runtime/syntax/debsources.vim b/runtime/syntax/debsources.vim
index 232e727e81..2777944971 100644
--- a/runtime/syntax/debsources.vim
+++ b/runtime/syntax/debsources.vim
@@ -2,7 +2,7 @@
" Language: Debian sources.list
" Maintainer: Debian Vim Maintainers <pkg-vim-maintainers@lists.alioth.debian.org>
" Former Maintainer: Matthijs Mohlmann <matthijs@cacholong.nl>
-" Last Change: 2016 Aug 30
+" Last Change: 2016 Sep 27
" URL: https://anonscm.debian.org/cgit/pkg-vim/vim.git/plain/runtime/syntax/debsources.vim
" Standard syntax initialization
@@ -39,7 +39,7 @@ let s:unsupported = [
let &cpo=s:cpo
" Match uri's
-syn match debsourcesUri +\(http://\|ftp://\|[rs]sh://\|debtorrent://\|\(cdrom\|copy\|file\):\)[^' <>"]\++
+syn match debsourcesUri +\(https\?://\|ftp://\|[rs]sh://\|debtorrent://\|\(cdrom\|copy\|file\):\)[^' <>"]\++
exe 'syn match debsourcesDistrKeyword +\([[:alnum:]_./]*\)\('. join(s:supported, '\|'). '\)\([-[:alnum:]_./]*\)+'
exe 'syn match debsourcesUnsupportedDistrKeyword +\([[:alnum:]_./]*\)\('. join(s:unsupported, '\|') .'\)\([-[:alnum:]_./]*\)+'
diff --git a/runtime/syntax/mf.vim b/runtime/syntax/mf.vim
index 5f600e2ebe..3589e4db3c 100644
--- a/runtime/syntax/mf.vim
+++ b/runtime/syntax/mf.vim
@@ -1,184 +1,295 @@
" Vim syntax file
-" Language: Metafont
-" Maintainer: Andreas Scherer <andreas.scherer@pobox.com>
-" Last Change: April 25, 2001
+" Language: METAFONT
+" Maintainer: Nicola Vitacolonna <nvitacolonna@gmail.com>
+" Former Maintainers: Andreas Scherer <andreas.scherer@pobox.com>
+" Last Change: 2016 Oct 1
-" quit when a syntax file was already loaded
if exists("b:current_syntax")
finish
endif
-" Metafont 'primitives' as defined in chapter 25 of 'The METAFONTbook'
+syn iskeyword @,_
+
+" METAFONT 'primitives' as defined in chapter 25 of 'The METAFONTbook'
" Page 210: 'boolean expressions'
-syn keyword mfBoolExp true false known unknown odd charexists not and or
+syn keyword mfBoolExp and charexists false known not odd or true unknown
" Page 210: 'numeric expression'
-syn keyword mfNumExp normaldeviate length ASCII oct hex angle turningnumber
-syn keyword mfNumExp totalweight directiontime xpart ypart xxpart xypart
-syn keyword mfNumExp yxpart yypart sqrt sind cosd mlog mexp floor
-syn keyword mfNumExp uniformdeviate
+syn keyword mfNumExp ASCII angle cosd directiontime floor hex length
+syn keyword mfNumExp mexp mlog normaldeviate oct sind sqrt totalweight
+syn keyword mfNumExp turningnumber uniformdeviate xpart xxpart xypart
+syn keyword mfNumExp ypart yxpart yypart
" Page 211: 'internal quantities'
-syn keyword mfInternal tracingtitles tracingequations tracingcapsules
-syn keyword mfInternal tracingchoices tracingspecs tracingpens
-syn keyword mfInternal tracingcommands tracingrestores tracingmacros
-syn keyword mfInternal tracingedges tracingoutput tracingonline tracingstats
-syn keyword mfInternal pausing showstopping fontmaking proofing
-syn keyword mfInternal turningcheck warningcheck smoothing autorounding
-syn keyword mfInternal granularity fillin year month day time
-syn keyword mfInternal charcode charext charwd charht chardp charic
-syn keyword mfInternal chardx chardy designsize hppp vppp xoffset yoffset
-syn keyword mfInternal boundarychar
+syn keyword mfInternal autorounding boundarychar charcode chardp chardx
+syn keyword mfInternal chardy charext charht charic charwd day designsize
+syn keyword mfInternal fillin fontmaking granularity hppp jobname month
+syn keyword mfInternal pausing proofing showstopping smoothing time
+syn keyword mfInternal tracingcapsules tracingchoices tracingcommands
+syn keyword mfInternal tracingedges tracingequations tracingmacros
+syn keyword mfInternal tracingonline tracingoutput tracingpens
+syn keyword mfInternal tracingrestores tracingspecs tracingstats
+syn keyword mfInternal tracingtitles turningcheck vppp warningcheck
+syn keyword mfInternal xoffset year yoffset
" Page 212: 'pair expressions'
-syn keyword mfPairExp point of precontrol postcontrol penoffset rotated
-syn keyword mfPairExp scaled shifted slanted transformed xscaled yscaled
-syn keyword mfPairExp zscaled
+syn keyword mfPairExp of penoffset point postcontrol precontrol rotated
+syn keyword mfPairExp scaled shifted slanted transformed xscaled yscaled
+syn keyword mfPairExp zscaled
" Page 213: 'path expressions'
-syn keyword mfPathExp makepath reverse subpath curl tension atleast
-syn keyword mfPathExp controls cycle
+syn keyword mfPathExp atleast controls curl cycle makepath reverse
+syn keyword mfPathExp subpath tension
" Page 214: 'pen expressions'
-syn keyword mfPenExp nullpen pencircle makepen
+syn keyword mfPenExp makepen nullpen pencircle
-" Page 214: 'picutre expressions'
-syn keyword mfPicExp nullpicture
+" Page 214: 'picture expressions'
+syn keyword mfPicExp nullpicture
" Page 214: 'string expressions'
-syn keyword mfStringExp jobname readstring str char decimal substring
+syn keyword mfStringExp char decimal readstring str substring
" Page 217: 'commands and statements'
-syn keyword mfCommand end dump save interim newinternal randomseed let
-syn keyword mfCommand delimiters outer everyjob show showvariable showtoken
-syn keyword mfCommand showdependencies showstats message errmessage errhelp
-syn keyword mfCommand batchmode nonstopmode scrollmode errorstopmode
-syn keyword mfCommand addto also contour doublepath withpen withweight cull
-syn keyword mfCommand keeping dropping display inwindow openwindow at from to
-syn keyword mfCommand shipout special numspecial
+syn keyword mfCommand addto also at batchmode contour cull delimiters
+syn keyword mfCommand display doublepath dropping dump end errhelp
+syn keyword mfCommand errmessage errorstopmode everyjob from interim
+syn keyword mfCommand inwindow keeping let message newinternal
+syn keyword mfCommand nonstopmode numspecial openwindow outer randomseed
+syn keyword mfCommand save scrollmode shipout show showdependencies
+syn keyword mfCommand showstats showtoken showvariable special to withpen
+syn keyword mfCommand withweight
" Page 56: 'types'
-syn keyword mfType boolean numeric pair path pen picture string transform
+syn keyword mfType boolean numeric pair path pen picture string
+syn keyword mfType transform
" Page 155: 'grouping'
-syn keyword mfStatement begingroup endgroup
+syn keyword mfStatement begingroup endgroup
" Page 165: 'definitions'
-syn keyword mfDefinition enddef def expr suffix text primary secondary
-syn keyword mfDefinition tertiary vardef primarydef secondarydef tertiarydef
+syn keyword mfDefinition def enddef expr primary primarydef secondary
+syn keyword mfDefinition secondarydef suffix tertiary tertiarydef text
+syn keyword mfDefinition vardef
" Page 169: 'conditions and loops'
-syn keyword mfCondition if fi else elseif endfor for forsuffixes forever
-syn keyword mfCondition step until exitif
+syn keyword mfCondition else elseif endfor exitif fi for forever
+syn keyword mfCondition forsuffixes if step until
" Other primitives listed in the index
-syn keyword mfPrimitive charlist endinput expandafter extensible
-syn keyword mfPrimitive fontdimen headerbyte inner input intersectiontimes
-syn keyword mfPrimitive kern ligtable quote scantokens skipto
+syn keyword mfPrimitive charlist endinput expandafter extensible fontdimen
+syn keyword mfPrimitive headerbyte inner input intersectiontimes kern
+syn keyword mfPrimitive ligtable quote scantokens skipto
+
+" Implicit suffix parameters
+syn match mfSuffixParam "@#\|#@\|@"
+
+" These are just tags, but given their special status, we
+" highlight them as variables
+syn keyword mfVariable x y
" Keywords defined by plain.mf (defined on pp.262-278)
-if !exists("plain_mf_macros")
- let plain_mf_macros = 1 " Set this to '0' if your source gets too colourful
- " metapost.vim does so to turn off Metafont macros
+if get(g:, "plain_mf_macros", 1)
+ syn keyword mfDef addto_currentpicture beginchar capsule_def
+ syn keyword mfDef change_width clear_pen_memory clearit clearpen
+ syn keyword mfDef clearxy culldraw cullit cutdraw
+ syn keyword mfDef define_blacker_pixels define_corrected_pixels
+ syn keyword mfDef define_good_x_pixels define_good_y_pixels
+ syn keyword mfDef define_horizontal_corrected_pixels define_pixels
+ syn keyword mfDef define_whole_blacker_pixels define_whole_pixels
+ syn keyword mfDef define_whole_vertical_blacker_pixels
+ syn keyword mfDef define_whole_vertical_pixels downto draw drawdot
+ syn keyword mfDef endchar erase exitunless fill filldraw fix_units
+ syn keyword mfDef flex font_coding_scheme font_extra_space
+ syn keyword mfDef font_identifier font_normal_shrink
+ syn keyword mfDef font_normal_space font_normal_stretch font_quad
+ syn keyword mfDef font_size font_slant font_x_height gfcorners gobble
+ syn keyword mfDef hide imagerules interact italcorr killtext
+ syn keyword mfDef loggingall lowres_fix makebox makegrid maketicks
+ syn keyword mfDef mode_def mode_setup nodisplays notransforms numtok
+ syn keyword mfDef openit penrazor pensquare penstroke pickup
+ syn keyword mfDef proofoffset proofrule range reflectedabout
+ syn keyword mfDef rotatedaround screenchars screenrule screenstrokes
+ syn keyword mfDef shipit showit smode stop superellipse takepower
+ syn keyword mfDef tracingall tracingnone undraw undrawdot unfill
+ syn keyword mfDef unfilldraw upto z
+ syn match mfDef "???"
+ syn keyword mfVardef bot byte ceiling counterclockwise cutoff decr dir
+ syn keyword mfVardef direction directionpoint grayfont hround incr
+ syn keyword mfVardef interpath inverse labelfont labels lft magstep
+ " Note: nodot is not a vardef, it is used as in makelabel.lft.nodot("5",z5)
+ " (METAFONT only)
+ syn keyword mfVardef makelabel max min nodot penlabels penpos
+ syn keyword mfVardef proofrulethickness round rt savepen slantfont solve
+ syn keyword mfVardef tensepath titlefont top unitvector vround whatever
+ syn match mpVardef "\<good\.\%(x\|y\|lft\|rt\|top\|bot\)\>"
+ syn keyword mfPrimaryDef div dotprod gobbled mod
+ syn keyword mfSecondaryDef intersectionpoint
+ syn keyword mfTertiaryDef softjoin thru
+ syn keyword mfNewInternal blacker currentwindow displaying eps epsilon
+ syn keyword mfNewInternal infinity join_radius number_of_modes o_correction
+ syn keyword mfNewInternal pen_bot pen_lft pen_rt pen_top pixels_per_inch
+ syn keyword mfNewInternal screen_cols screen_rows tolerance
+ " Predefined constants
+ syn keyword mfConstant base_name base_version blankpicture ditto down
+ syn keyword mfConstant fullcircle halfcircle identity left lowres origin
+ syn keyword mfConstant penspeck proof quartercircle right rulepen smoke
+ syn keyword mfConstant unitpixel unitsquare up
+ " Other predefined variables
+ syn keyword mfVariable aspect_ratio currentpen extra_beginchar
+ syn keyword mfVariable extra_endchar currentpen_path currentpicture
+ syn keyword mfVariable currenttransform d extra_setup h localfont mag mode
+ syn keyword mfVariable mode_name w
+ " let statements:
+ syn keyword mfnumExp abs
+ syn keyword mfPairExp rotatedabout
+ syn keyword mfCommand bye relax
endif
-if plain_mf_macros
- syn keyword mfMacro abs addto_currentpicture aspect_ratio base_name
- syn keyword mfMacro base_version beginchar blacker blankpicture bot bye byte
- syn keyword mfMacro capsule_def ceiling change_width clear_pen_memory clearit
- syn keyword mfMacro clearpen clearxy counterclockwise culldraw cullit
- syn keyword mfMacro currentpen currentpen_path currentpicture
- syn keyword mfMacro currenttransform currentwindow cutdraw cutoff d decr
- syn keyword mfMacro define_blacker_pixels define_corrected_pixels
- syn keyword mfMacro define_good_x_pixels define_good_y_pixels
- syn keyword mfMacro define_horizontal_corrected_pixels define_pixels
- syn keyword mfMacro define_whole_blacker_pixels define_whole_pixels
- syn keyword mfMacro define_whole_vertical_blacker_pixels
- syn keyword mfMacro define_whole_vertical_pixels dir direction directionpoint
- syn keyword mfMacro displaying ditto div dotprod down downto draw drawdot
- syn keyword mfMacro endchar eps epsilon extra_beginchar extra_endchar
- syn keyword mfMacro extra_setup erase exitunless fill filldraw fix_units flex
- syn keyword mfMacro font_coding_scheme font_extra_space font_identifier
- syn keyword mfMacro font_normal_shrink font_normal_space font_normal_stretch
- syn keyword mfMacro font_quad font_setup font_size font_slant font_x_height
- syn keyword mfMacro fullcircle generate gfcorners gobble gobbled grayfont h
- syn keyword mfMacro halfcircle hide hround identity image_rules incr infinity
- syn keyword mfMacro interact interpath intersectionpoint inverse italcorr
- syn keyword mfMacro join_radius killtext labelfont labels left lft localfont
- syn keyword mfMacro loggingall lowres lowres_fix mag magstep makebox makegrid
- syn keyword mfMacro makelabel maketicks max min mod mode mode_def mode_name
- syn keyword mfMacro mode_setup nodisplays notransforms number_of_modes numtok
- syn keyword mfMacro o_correction openit origin pen_bot pen_lft pen_rt pen_top
- syn keyword mfMacro penlabels penpos penrazor penspeck pensquare penstroke
- syn keyword mfMacro pickup pixels_per_inch proof proofoffset proofrule
- syn keyword mfMacro proofrulethickness quartercircle range reflectedabout
- syn keyword mfMacro relax right rotatedabout rotatedaround round rt rulepen
- syn keyword mfMacro savepen screenchars screen_rows screen_cols screenrule
- syn keyword mfMacro screenstrokes shipit showit slantfont smode smoke softjoin
- syn keyword mfMacro solve stop superellipse takepower tensepath titlefont
- syn keyword mfMacro tolerance top tracingall tracingnone undraw undrawdot
- syn keyword mfMacro unfill unfilldraw unitpixel unitsquare unitvector up upto
- syn keyword mfMacro vround w whatever
+
+" By default, METAFONT loads modes.mf, too
+if get(g:, "plain_mf_modes", 1)
+ syn keyword mfConstant APSSixMed AgfaFourZeroZero AgfaThreeFourZeroZero
+ syn keyword mfConstant AtariNineFive AtariNineSix AtariSLMEightZeroFour
+ syn keyword mfConstant AtariSMOneTwoFour CItohEightFiveOneZero
+ syn keyword mfConstant CItohThreeOneZero CanonBJCSixZeroZero CanonCX
+ syn keyword mfConstant CanonEX CanonLBPLX CanonLBPTen CanonSX ChelgraphIBX
+ syn keyword mfConstant CompugraphicEightSixZeroZero
+ syn keyword mfConstant CompugraphicNineSixZeroZero DD DEClarge DECsmall
+ syn keyword mfConstant DataDiscNew EightThree EpsonAction
+ syn keyword mfConstant EpsonLQFiveZeroZeroLo EpsonLQFiveZeroZeroMed
+ syn keyword mfConstant EpsonMXFX EpsonSQEightSevenZero EpsonStylusPro
+ syn keyword mfConstant EpsonStylusProHigh EpsonStylusProLow
+ syn keyword mfConstant EpsonStylusProMed FourFour GThreefax HPDeskJet
+ syn keyword mfConstant HPLaserJetIIISi IBMFourTwoFiveZero IBMFourTwoOneSix
+ syn keyword mfConstant IBMFourTwoThreeZero IBMFourZeroOneNine
+ syn keyword mfConstant IBMFourZeroThreeNine IBMFourZeroTwoNine
+ syn keyword mfConstant IBMProPrinter IBMSixOneFiveFour IBMSixSixSevenZero
+ syn keyword mfConstant IBMThreeEightOneTwo IBMThreeEightTwoZero
+ syn keyword mfConstant IBMThreeOneNineThree IBMThreeOneSevenNine
+ syn keyword mfConstant IBMUlfHolleberg LASevenFive LNOthreR LNOthree
+ syn keyword mfConstant LNZeroOne LNZeroThree LPSFourZero LPSTwoZero
+ syn keyword mfConstant LexmarkFourZeroThreeNine LexmarkOptraR
+ syn keyword mfConstant LexmarkOptraS LinotypeLThreeThreeZero
+ syn keyword mfConstant LinotypeOneZeroZero LinotypeOneZeroZeroLo
+ syn keyword mfConstant LinotypeThreeZeroZeroHi MacTrueSize NeXTprinter
+ syn keyword mfConstant NeXTscreen NecTwoZeroOne Newgen NineOne
+ syn keyword mfConstant OCESixSevenFiveZeroPS OneTwoZero OneZeroZero
+ syn keyword mfConstant PrintwareSevenTwoZeroIQ Prism QMSOneSevenTwoFive
+ syn keyword mfConstant QMSOneSevenZeroZero QMSTwoFourTwoFive RicohA
+ syn keyword mfConstant RicohFortyEighty RicohFourZeroEightZero RicohLP
+ syn keyword mfConstant SparcPrinter StarNLOneZero VAXstation VTSix
+ syn keyword mfConstant VarityperFiveZeroSixZeroW
+ syn keyword mfConstant VarityperFourThreeZeroZeroHi
+ syn keyword mfConstant VarityperFourThreeZeroZeroLo
+ syn keyword mfConstant VarityperFourTwoZeroZero VarityperSixZeroZero
+ syn keyword mfConstant XeroxDocutech XeroxEightSevenNineZero
+ syn keyword mfConstant XeroxFourZeroFiveZero XeroxNineSevenZeroZero
+ syn keyword mfConstant XeroxPhaserSixTwoZeroZeroDP XeroxThreeSevenZeroZero
+ syn keyword mfConstant Xerox_world agfafzz agfatfzz amiga aps apssixhi
+ syn keyword mfConstant aselect atariezf atarinf atarins atariotf bitgraph
+ syn keyword mfConstant bjtenex bjtzzex bjtzzl bjtzzs boise canonbjc
+ syn keyword mfConstant canonex canonlbp cg cgl cgnszz citohtoz corona crs
+ syn keyword mfConstant cthreeten cx datadisc declarge decsmall deskjet
+ syn keyword mfConstant docutech dover dp dpdfezzz eighthre elvira epscszz
+ syn keyword mfConstant epsdraft epsdrft epsdrftl epsfast epsfastl epshi
+ syn keyword mfConstant epslo epsmed epsmedl epson epsonact epsonfx epsonl
+ syn keyword mfConstant epsonlo epsonlol epsonlq epsonsq epstylus epstylwr
+ syn keyword mfConstant epstyplo epstypmd epstypml epstypro epswlo epswlol
+ syn keyword mfConstant esphi fourfour gpx gtfax gtfaxhi gtfaxl gtfaxlo
+ syn keyword mfConstant gtfaxlol help hifax highfax hplaser hprugged ibm_a
+ syn keyword mfConstant ibmd ibmega ibmegal ibmfzon ibmfztn ibmpp ibmppl
+ syn keyword mfConstant ibmsoff ibmteot ibmtetz ibmtont ibmtosn ibmtosnl
+ syn keyword mfConstant ibmvga ibx imagen imagewriter itoh itohl itohtoz
+ syn keyword mfConstant itohtozl iw jetiiisi kyocera laserjet laserjetfive
+ syn keyword mfConstant laserjetfivemp laserjetfour laserjetfourthousand
+ syn keyword mfConstant laserjetfourzerozerozero laserjethi laserjetlo
+ syn keyword mfConstant laserjettwoonezerozero
+ syn keyword mfConstant laserjettwoonezerozerofastres lasermaster
+ syn keyword mfConstant laserwriter lasf lexmarkr lexmarks lexmarku
+ syn keyword mfConstant linohalf linohi linolo linolttz linoone linosuper
+ syn keyword mfConstant linothree linothreelo linotzzh ljfive ljfivemp
+ syn keyword mfConstant ljfour ljfzzz ljfzzzfr ljlo ljtozz ljtozzfr lmaster
+ syn keyword mfConstant lnotr lnzo lps lpstz lqhires lqlores lqmed lqmedl
+ syn keyword mfConstant lqmedres lview lviewl lwpro macmag mactrue modes_mf
+ syn keyword mfConstant ncd nec nechi neclm nectzo newdd newddl nexthi
+ syn keyword mfConstant nextscreen nextscrn nineone nullmode ocessfz
+ syn keyword mfConstant okidata okidatal okifourten okifte okihi onetz
+ syn keyword mfConstant onezz pcprevw pcscreen phaser phaserfs phasertf
+ syn keyword mfConstant phasertfl phasertl pixpt printware prntware
+ syn keyword mfConstant proprinter qms qmsesz qmsostf qmsoszz qmstftf ricoh
+ syn keyword mfConstant ricoha ricohlp ricohsp sherpa sparcptr starnlt
+ syn keyword mfConstant starnltl styletwo stylewr stylewri stylewriter sun
+ syn keyword mfConstant supre swtwo toshiba ultre varityper vs vtftzz
+ syn keyword mfConstant vtftzzhi vtftzzlo vtfzszw vtszz xpstzz xpstzzl
+ syn keyword mfConstant xrxesnz xrxfzfz xrxnszz xrxtszz
+ syn keyword mfDef BCPL_string coding_scheme font_face_byte
+ syn keyword mfDef font_family landscape
+ syn keyword mfDef mode_extra_info mode_help mode_param
+ syn keyword mfNewInternal blacker_min
endif
" Some other basic macro names, e.g., from cmbase, logo, etc.
-if !exists("other_mf_macros")
- let other_mf_macros = 1 " Set this to '0' if your code gets too colourful
- " metapost.vim does so to turn off Metafont macros
-endif
-if other_mf_macros
- syn keyword mfMacro beginlogochar
+if get(g:, "other_mf_macros", 1)
+ syn keyword mfDef beginlogochar
+ syn keyword mfDef font_setup
+ syn keyword mfPrimitive generate
endif
" Numeric tokens
-syn match mfNumeric "[-]\=\d\+"
-syn match mfNumeric "[-]\=\.\d\+"
-syn match mfNumeric "[-]\=\d\+\.\d\+"
-
-" Metafont lengths
-syn match mfLength "\<\(bp\|cc\|cm\|dd\|in\|mm\|pc\|pt\)\>"
-syn match mfLength "\<[-]\=\d\+\(bp\|cc\|cm\|dd\|in\|mm\|pc\|pt\)\#\=\>"
-syn match mfLength "\<[-]\=\.\d\+\(bp\|cc\|cm\|dd\|in\|mm\|pc\|pt\)\#\=\>"
-syn match mfLength "\<[-]\=\d\+\.\d\+\(bp\|cc\|cm\|dd\|in\|mm\|pc\|pt\)\#\=\>"
+syn match mfNumeric "[-]\=\d\+"
+syn match mfNumeric "[-]\=\.\d\+"
+syn match mfNumeric "[-]\=\d\+\.\d\+"
-" Metafont coordinates and points
-syn match mfCoord "\<[xy]\d\+\>"
-syn match mfPoint "\<z\d\+\>"
+" METAFONT lengths
+syn match mfLength "\<\(bp\|cc\|cm\|dd\|in\|mm\|pc\|pt\)\>"
+syn match mfLength "[-]\=\d\+\(bp\|cc\|cm\|dd\|in\|mm\|pc\|pt\)\#\="
+syn match mfLength "[-]\=\.\d\+\(bp\|cc\|cm\|dd\|in\|mm\|pc\|pt\)\#\="
+syn match mfLength "[-]\=\d\+\.\d\+\(bp\|cc\|cm\|dd\|in\|mm\|pc\|pt\)\#\="
" String constants
-syn region mfString start=+"+ end=+"+
+syn match mfOpenString /"[^"]*/
+syn region mfString oneline keepend start=+"+ end=+"+
" Comments:
-syn match mfComment "%.*$"
+syn keyword mfTodoComment contained TODO FIXME XXX DEBUG NOTE
+syn match mfComment "%.*$" contains=mfTodoComment,@Spell
" synchronizing
syn sync maxlines=50
" Define the default highlighting
-" Only when an item doesn't have highlighting yet
-
-hi def link mfBoolExp Statement
-hi def link mfNumExp Statement
-hi def link mfInternal Identifier
-hi def link mfPairExp Statement
-hi def link mfPathExp Statement
-hi def link mfPenExp Statement
-hi def link mfPicExp Statement
-hi def link mfStringExp Statement
-hi def link mfCommand Statement
-hi def link mfType Type
-hi def link mfStatement Statement
-hi def link mfDefinition Statement
-hi def link mfCondition Conditional
-hi def link mfPrimitive Statement
-hi def link mfMacro Macro
-hi def link mfCoord Identifier
-hi def link mfPoint Identifier
-hi def link mfNumeric Number
-hi def link mfLength Number
-hi def link mfComment Comment
-hi def link mfString String
-
+hi def link mfBoolExp Statement
+hi def link mfNumExp Statement
+hi def link mfPairExp Statement
+hi def link mfPathExp Statement
+hi def link mfPenExp Statement
+hi def link mfPicExp Statement
+hi def link mfStringExp Statement
+hi def link mfInternal Identifier
+hi def link mfCommand Statement
+hi def link mfType Type
+hi def link mfStatement Statement
+hi def link mfDefinition Statement
+hi def link mfCondition Conditional
+hi def link mfPrimitive Statement
+hi def link mfDef Function
+hi def link mfVardef mfDef
+hi def link mfPrimaryDef mfDef
+hi def link mfSecondaryDef mfDef
+hi def link mfTertiaryDef mfDef
+hi def link mfCoord Identifier
+hi def link mfPoint Identifier
+hi def link mfNumeric Number
+hi def link mfLength Number
+hi def link mfComment Comment
+hi def link mfString String
+hi def link mfOpenString Todo
+hi def link mfSuffixParam Label
+hi def link mfNewInternal mfInternal
+hi def link mfVariable Identifier
+hi def link mfConstant Constant
+hi def link mfTodoComment Todo
let b:current_syntax = "mf"
-" vim: ts=8
+" vim:sw=2
diff --git a/runtime/syntax/mp.vim b/runtime/syntax/mp.vim
index 3966b69a03..95723d0d97 100644
--- a/runtime/syntax/mp.vim
+++ b/runtime/syntax/mp.vim
@@ -1,115 +1,765 @@
" Vim syntax file
-" Language: MetaPost
-" Maintainer: Andreas Scherer <andreas.scherer@pobox.com>
-" Last Change: April 30, 2001
+" Language: MetaPost
+" Maintainer: Nicola Vitacolonna <nvitacolonna@gmail.com>
+" Former Maintainers: Andreas Scherer <andreas.scherer@pobox.com>
+" Last Change: 2016 Oct 01
-" quit when a syntax file was already loaded
if exists("b:current_syntax")
finish
endif
-let plain_mf_macros = 0 " plain.mf has no special meaning for MetaPost
-let other_mf_macros = 0 " cmbase.mf, logo.mf, ... neither
+let s:cpo_sav = &cpo
+set cpo&vim
-" Read the Metafont syntax to start with
+if exists("g:plain_mf_macros")
+ let s:plain_mf_macros = g:plain_mf_macros
+endif
+if exists("g:plain_mf_modes")
+ let s:plain_mf_modes = g:plain_mf_modes
+endif
+if exists("g:other_mf_macros")
+ let s:other_mf_macros = g:other_mf_macros
+endif
+
+let g:plain_mf_macros = 0 " plain.mf has no special meaning for MetaPost
+let g:plain_mf_modes = 0 " No METAFONT modes
+let g:other_mf_macros = 0 " cmbase.mf, logo.mf, ... neither
+
+" Read the METAFONT syntax to start with
runtime! syntax/mf.vim
+unlet b:current_syntax " Necessary for syn include below
+
+" Restore the value of existing global variables
+if exists("s:plain_mf_macros")
+ let g:plain_mf_macros = s:plain_mf_macros
+else
+ unlet g:plain_mf_macros
+endif
+if exists("s:plain_mf_modes")
+ let g:plain_mf_modes = s:plain_mf_modes
+else
+ unlet g:plain_mf_modes
+endif
+if exists("s:other_mf_macros")
+ let g:other_mf_macros = s:other_mf_macros
+else
+ unlet g:other_mf_macros
+endif
-" MetaPost has TeX inserts for typeset labels
-" verbatimtex, btex, and etex will be treated as keywords
-syn match mpTeXbegin "\(verbatimtex\|btex\)"
-syn match mpTeXend "etex"
-syn region mpTeXinsert start="\(verbatimtex\|btex\)"hs=e+1 end="etex"he=s-1 contains=mpTeXbegin,mpTeXend keepend
+" Use TeX highlighting inside verbatimtex/btex... etex
+syn include @MPTeX syntax/tex.vim
+unlet b:current_syntax
+" These are defined as keywords rather than using matchgroup
+" in order to make them available to syntaxcomplete.
+syn keyword mpTeXdelim btex etex verbatimtex contained
+syn region mpTeXinsert
+ \ start=/\<verbatimtex\>\|\<btex\>/rs=e+1
+ \ end=/\<etex\>/re=s-1 keepend
+ \ contains=@MPTeX,mpTeXdelim
-" MetaPost primitives not found in Metafont
-syn keyword mpInternal bluepart clip color dashed fontsize greenpart infont
-syn keyword mpInternal linecap linejoin llcorner lrcorner miterlimit mpxbreak
-syn keyword mpInternal prologues redpart setbounds tracinglostchars
-syn keyword mpInternal truecorners ulcorner urcorner withcolor
+" iskeyword must be set after the syn include above, because tex.vim sets `syn
+" iskeyword`. Note that keywords do not contain numbers (numbers are
+" subscripts)
+syntax iskeyword @,_
-" Metafont primitives not found in MetaPost
-syn keyword notDefined autorounding chardx chardy fillin granularity hppp
-syn keyword notDefined proofing smoothing tracingedges tracingpens
-syn keyword notDefined turningcheck vppp xoffset yoffset
+" MetaPost primitives not found in METAFONT
+syn keyword mpBoolExp bounded clipped filled stroked textual arclength
+syn keyword mpNumExp arctime blackpart bluepart colormodel cyanpart
+syn keyword mpNumExp fontsize greenpart greypart magentapart redpart
+syn keyword mpPairExp yellowpart llcorner lrcorner ulcorner urcorner
+" envelope is seemingly undocumented, but it exists since mpost 1.003.
+" The syntax is: envelope <polygonal pen> of <path primary>. For example,
+" path p;
+" p := envelope pensquare of (up--left);
+" (Thanks to Daniel H. Luecking for the example!)
+syn keyword mpPathExp envelope pathpart
+syn keyword mpPenExp penpart
+syn keyword mpPicExp dashpart glyph infont
+syn keyword mpStringExp fontpart readfrom textpart
+syn keyword mpType cmykcolor color rgbcolor
+" Other MetaPost primitives listed in the manual
+syn keyword mpPrimitive mpxbreak within
+" Internal quantities not found in METAFONT
+" (Table 6 in MetaPost: A User's Manual)
+syn keyword mpInternal defaultcolormodel hour minute linecap linejoin
+syn keyword mpInternal miterlimit mpprocset mpversion numberprecision
+syn keyword mpInternal numbersystem outputfilename outputformat
+syn keyword mpInternal outputformatoptions outputtemplate prologues
+syn keyword mpInternal restoreclipcolor tracinglostchars troffmode
+syn keyword mpInternal truecorners
+" List of commands not found in METAFONT (from MetaPost: A User's Manual)
+syn keyword mpCommand clip closefrom dashed filenametemplate fontmapfile
+syn keyword mpCommand fontmapline setbounds withcmykcolor withcolor
+syn keyword mpCommand withgreyscale withoutcolor withpostscript
+syn keyword mpCommand withprescript withrgbcolor write
+" METAFONT internal variables not found in MetaPost
+syn keyword notDefined autorounding chardx chardy fillin granularity
+syn keyword notDefined proofing smoothing tracingedges tracingpens
+syn keyword notDefined turningcheck xoffset yoffset
+" Suffix defined only in METAFONT:
+syn keyword notDefined nodot
+" Other not implemented primitives (see MetaPost: A User's Manual, §C.1)
+syn keyword notDefined cull display openwindow numspecial totalweight
+syn keyword notDefined withweight
" Keywords defined by plain.mp
-if !exists("plain_mp_macros")
- let plain_mp_macros = 1 " Set this to '0' if your source gets too colourful
-endif
-if plain_mp_macros
- syn keyword mpMacro ahangle ahlength background bbox bboxmargin beginfig
- syn keyword mpMacro beveled black blue buildcycle butt center cutafter
- syn keyword mpMacro cutbefore cuttings dashpattern defaultfont defaultpen
- syn keyword mpMacro defaultscale dotlabel dotlabels drawarrow drawdblarrow
- syn keyword mpMacro drawoptions endfig evenly extra_beginfig extra_endfig
- syn keyword mpMacro green label labeloffset mitered red rounded squared
- syn keyword mpMacro thelabel white base_name base_version
- syn keyword mpMacro upto downto exitunless relax gobble gobbled
- syn keyword mpMacro interact loggingall tracingall tracingnone
- syn keyword mpMacro eps epsilon infinity right left up down origin
- syn keyword mpMacro quartercircle halfcircle fullcircle unitsquare identity
- syn keyword mpMacro blankpicture withdots ditto EOF pensquare penrazor
- syn keyword mpMacro penspeck whatever abs round ceiling byte dir unitvector
- syn keyword mpMacro inverse counterclockwise tensepath mod div dotprod
- syn keyword mpMacro takepower direction directionpoint intersectionpoint
- syn keyword mpMacro softjoin incr decr reflectedabout rotatedaround
- syn keyword mpMacro rotatedabout min max flex superellipse interpath
- syn keyword mpMacro magstep currentpen currentpen_path currentpicture
- syn keyword mpMacro fill draw filldraw drawdot unfill undraw unfilldraw
- syn keyword mpMacro undrawdot erase cutdraw image pickup numeric_pickup
- syn keyword mpMacro pen_lft pen_rt pen_top pen_bot savepen clearpen
- syn keyword mpMacro clear_pen_memory lft rt top bot ulft urt llft lrt
- syn keyword mpMacro penpos penstroke arrowhead makelabel labels penlabel
- syn keyword mpMacro range numtok thru clearxy clearit clearpen pickup
- syn keyword mpMacro shipit bye hide stop solve
+if get(g:, "plain_mp_macros", 1) || get(g:, "mp_metafun_macros", 0)
+ syn keyword mpDef beginfig clear_pen_memory clearit clearpen clearpen
+ syn keyword mpDef clearxy colorpart cutdraw downto draw drawarrow
+ syn keyword mpDef drawdblarrow drawdot drawoptions endfig erase
+ syn keyword mpDef exitunless fill filldraw flex gobble hide interact
+ syn keyword mpDef label loggingall makelabel numtok penstroke pickup
+ syn keyword mpDef range reflectedabout rotatedaround shipit
+ syn keyword mpDef stop superellipse takepower tracingall tracingnone
+ syn keyword mpDef undraw undrawdot unfill unfilldraw upto
+ syn match mpDef "???"
+ syn keyword mpVardef arrowhead bbox bot buildcycle byte ceiling center
+ syn keyword mpVardef counterclockwise decr dir direction directionpoint
+ syn keyword mpVardef dotlabel dotlabels image incr interpath inverse
+ syn keyword mpVardef labels lft magstep max min penlabels penpos round
+ syn keyword mpVardef rt savepen solve tensepath thelabel top unitvector
+ syn keyword mpVardef whatever z
+ syn keyword mpPrimaryDef div dotprod gobbled mod
+ syn keyword mpSecondaryDef intersectionpoint
+ syn keyword mpTertiaryDef cutafter cutbefore softjoin thru
+ syn keyword mpNewInternal ahangle ahlength bboxmargin beveled butt defaultpen
+ syn keyword mpNewInternal defaultscale dotlabeldiam eps epsilon infinity
+ syn keyword mpNewInternal join_radius labeloffset mitered pen_bot pen_lft
+ syn keyword mpNewInternal pen_rt pen_top rounded squared tolerance
+ " Predefined constants
+ syn keyword mpConstant EOF background base_name base_version black
+ syn keyword mpConstant blankpicture blue ditto down evenly fullcircle
+ syn keyword mpConstant green halfcircle identity left origin penrazor
+ syn keyword mpConstant penspeck pensquare quartercircle red right
+ syn keyword mpConstant unitsquare up white withdots
+ " Other predefined variables
+ syn keyword mpVariable currentpen currentpen_path currentpicture cuttings
+ syn keyword mpVariable defaultfont extra_beginfig extra_endfig
+ syn match mpVariable /\<\%(laboff\|labxf\|labyf\)\>/
+ syn match mpVariable /\<\%(laboff\|labxf\|labyf\)\.\%(lft\|rt\|bot\|top\|ulft\|urt\|llft\|lrt\)\>/
+ " let statements:
+ syn keyword mpnumExp abs
+ syn keyword mpDef rotatedabout
+ syn keyword mpCommand bye relax
+ " on and off are not technically keywords, but it is nice to highlight them
+ " inside dashpattern().
+ syn keyword mpOnOff off on contained
+ syn keyword mpDash dashpattern contained
+ syn region mpDashPattern
+ \ start="dashpattern\s*"
+ \ end=")"he=e-1
+ \ contains=mfNumeric,mfLength,mpOnOff,mpDash
endif
" Keywords defined by mfplain.mp
-if !exists("mfplain_mp_macros")
- let mfplain_mp_macros = 0 " Set this to '1' to include these macro names
-endif
-if mfplain_mp_macros
- syn keyword mpMacro beginchar blacker capsule_def change_width
- syn keyword mpMacro define_blacker_pixels define_corrected_pixels
- syn keyword mpMacro define_good_x_pixels define_good_y_pixels
- syn keyword mpMacro define_horizontal_corrected_pixels
- syn keyword mpMacro define_pixels define_whole_blacker_pixels
- syn keyword mpMacro define_whole_vertical_blacker_pixels
- syn keyword mpMacro define_whole_vertical_pixels endchar
- syn keyword mpMacro extra_beginchar extra_endchar extra_setup
- syn keyword mpMacro font_coding_scheme font_extra_space font_identifier
- syn keyword mpMacro font_normal_shrink font_normal_space
- syn keyword mpMacro font_normal_stretch font_quad font_size
- syn keyword mpMacro font_slant font_x_height italcorr labelfont
- syn keyword mpMacro makebox makegrid maketicks mode_def mode_setup
- syn keyword mpMacro o_correction proofrule proofrulethickness rulepen smode
-
+if get(g:, "mfplain_mp_macros", 0)
+ syn keyword mpDef beginchar capsule_def change_width
+ syn keyword mpDef define_blacker_pixels define_corrected_pixels
+ syn keyword mpDef define_good_x_pixels define_good_y_pixels
+ syn keyword mpDef define_horizontal_corrected_pixels define_pixels
+ syn keyword mpDef define_whole_blacker_pixels define_whole_pixels
+ syn keyword mpDef define_whole_vertical_blacker_pixels
+ syn keyword mpDef define_whole_vertical_pixels endchar
+ syn keyword mpDef font_coding_scheme font_extra_space font_identifier
+ syn keyword mpDef font_normal_shrink font_normal_space
+ syn keyword mpDef font_normal_stretch font_quad font_size font_slant
+ syn keyword mpDef font_x_height italcorr labelfont lowres_fix makebox
+ syn keyword mpDef makegrid maketicks mode_def mode_setup proofrule
+ syn keyword mpDef smode
+ syn keyword mpVardef hround proofrulethickness vround
+ syn keyword mpNewInternal blacker o_correction
+ syn keyword mpVariable extra_beginchar extra_endchar extra_setup rulepen
" plus some no-ops, also from mfplain.mp
- syn keyword mpMacro cullit currenttransform gfcorners grayfont hround
- syn keyword mpMacro imagerules lowres_fix nodisplays notransforms openit
- syn keyword mpMacro proofoffset screenchars screenrule screenstrokes
- syn keyword mpMacro showit slantfont titlefont unitpixel vround
+ syn keyword mpDef cull cullit gfcorners imagerules nodisplays
+ syn keyword mpDef notransforms openit proofoffset screenchars
+ syn keyword mpDef screenrule screenstrokes showit
+ syn keyword mpVardef grayfont slantfont titlefont
+ syn keyword mpVariable currenttransform
+ syn keyword mpConstant unitpixel
+ " These are not listed in the MetaPost manual, and some are ignored by
+ " MetaPost, but are nonetheless defined in mfplain.mp
+ syn keyword mpDef killtext
+ syn match mpVardef "\<good\.\%(x\|y\|lft\|rt\|top\|bot\)\>"
+ syn keyword mpVariable aspect_ratio localfont mag mode mode_name
+ syn keyword mpVariable proofcolor
+ syn keyword mpConstant lowres proof smoke
+ syn keyword mpNewInternal autorounding bp_per_pixel granularity
+ syn keyword mpNewInternal number_of_modes proofing smoothing turningcheck
endif
-" Keywords defined by other macro packages, e.g., boxes.mp
-if !exists("other_mp_macros")
- let other_mp_macros = 1 " Set this to '0' if your source gets too colourful
-endif
-if other_mp_macros
- syn keyword mpMacro circmargin defaultdx defaultdy
- syn keyword mpMacro boxit boxjoin bpath circleit drawboxed drawboxes
- syn keyword mpMacro drawunboxed fixpos fixsize pic
+" Keywords defined by all base macro packages:
+" - (r)boxes.mp
+" - format.mp
+" - graph.mp
+" - marith.mp
+" - sarith.mp
+" - string.mp
+" - TEX.mp
+if get(g:, "other_mp_macros", 1)
+ " boxes and rboxes
+ syn keyword mpDef boxjoin drawboxed drawboxes drawunboxed
+ syn keyword mpNewInternal circmargin defaultdx defaultdy rbox_radius
+ syn keyword mpVardef boxit bpath circleit fixpos fixsize generic_declare
+ syn keyword mpVardef generic_redeclare generisize pic rboxit str_prefix
+ " format
+ syn keyword mpVardef Mformat format init_numbers roundd
+ syn keyword mpVariable Fe_base Fe_plus
+ syn keyword mpConstant Ten_to
+ " graph
+ syn keyword mpDef Gfor Gxyscale OUT auto begingraph endgraph gdata
+ syn keyword mpDef gdraw gdrawarrow gdrawdblarrow gfill plot
+ syn keyword mpVardef augment autogrid frame gdotlabel glabel grid itick
+ syn keyword mpVardef otick
+ syn keyword mpVardef Mreadpath setcoords setrange
+ syn keyword mpNewInternal Gmarks Gminlog Gpaths linear log
+ syn keyword mpVariable Autoform Gemarks Glmarks Gumarks
+ syn keyword mpConstant Gtemplate
+ syn match mpVariable /Gmargin\.\%(low\|high\)/
+ " marith
+ syn keyword mpVardef Mabs Meform Mexp Mexp_str Mlog Mlog_Str Mlog_str
+ syn keyword mpPrimaryDef Mdiv Mmul
+ syn keyword mpSecondaryDef Madd Msub
+ syn keyword mpTertiaryDef Mleq
+ syn keyword mpNewInternal Mten Mzero
+ " sarith
+ syn keyword mpVardef Sabs Scvnum
+ syn keyword mpPrimaryDef Sdiv Smul
+ syn keyword mpSecondaryDef Sadd Ssub
+ syn keyword mpTertiaryDef Sleq Sneq
+ " string
+ syn keyword mpVardef cspan isdigit loptok
+ " TEX
+ syn keyword mpVardef TEX TEXPOST TEXPRE
endif
-" Define the default highlighting