blob: 9718480da3b92d0ab0ef9698b57e1268b1c2f523 [file] [log] [blame]
Bram Moolenaar071d4272004-06-13 20:20:40 +00001" Vim syntax file
2" Language: FORM
Bram Moolenaar5c736222010-01-06 20:54:52 +01003" Version: 2.0
Bram Moolenaar071d4272004-06-13 20:20:40 +00004" Maintainer: Michael M. Tung <michael.tung@uni-mainz.de>
Bram Moolenaar5c736222010-01-06 20:54:52 +01005" Last Change: <Thu Oct 23 13:11:21 CEST 2008>
6" Past Change: <October 2008 Thomas Reiter thomasr@nikhef.nl>
7" Past Change: <Wed, 2005/05/25 09:24:58 arwagner wptx44>
Bram Moolenaar071d4272004-06-13 20:20:40 +00008
9" First public release based on 'Symbolic Manipulation with FORM'
10" by J.A.M. Vermaseren, CAN, Netherlands, 1991.
11" This syntax file is still in development. Please send suggestions
12" to the maintainer.
13
Bram Moolenaar89bcfda2016-08-30 23:26:57 +020014" quit when a syntax file was already loaded
15if exists("b:current_syntax")
Bram Moolenaar071d4272004-06-13 20:20:40 +000016 finish
17endif
18
19syn case ignore
20
Bram Moolenaar5c736222010-01-06 20:54:52 +010021" a bunch of useful FORM keywords
Bram Moolenaar071d4272004-06-13 20:20:40 +000022syn keyword formType global local
23syn keyword formHeaderStatement symbol symbols cfunction cfunctions
24syn keyword formHeaderStatement function functions vector vectors
Bram Moolenaar5c736222010-01-06 20:54:52 +010025syn keyword formHeaderStatement tensor tensors ctensor ctensors
26syn keyword formHeaderStatement set sets index indices table ctable
Bram Moolenaar071d4272004-06-13 20:20:40 +000027syn keyword formHeaderStatement dimension dimensions unittrace
Bram Moolenaar5c736222010-01-06 20:54:52 +010028syn keyword formConditional if else elseif endif while
Bram Moolenaar071d4272004-06-13 20:20:40 +000029syn keyword formConditional repeat endrepeat label goto
Bram Moolenaar5c736222010-01-06 20:54:52 +010030syn keyword formConditional argument endargument exit
31syn keyword formConditional inexpression inside term
32syn keyword formConditional endinexpression endinside endterm
33syn keyword formStatement abrackets also antibrackets antisymmetrize
34syn keyword formStatement argexplode argimplode apply auto autodeclare
35syn keyword formStatement brackets chainin chainout chisholm cleartable
36syn keyword formStatement collect commuting compress contract
37syn keyword formStatement cyclesymmetrize deallocatetable delete
38syn keyword formStatement dimension discard disorder drop factarg fill
39syn keyword formStatement fillexpression fixindex format funpowers hide
40syn keyword formStatement identify idnew idold ifmatch inparallel
41syn keyword formStatement insidefirst keep load makeinteger many metric
42syn keyword formStatement moduleoption modulus multi multiply ndrop
43syn keyword formStatement nfunctions nhide normalize notinparallel
44syn keyword formStatement nprint nskip ntable ntensors nunhide nwrite
45syn keyword formStatement off on once only polyfun pophide print
46syn keyword formStatement printtable propercount pushhide ratio
47syn keyword formStatement rcyclesymmetrize redefine renumber
48syn keyword formStatement replaceinarg replaceloop save select
49syn keyword formStatement setexitflag skip slavepatchsize sort splitarg
50syn keyword formStatement splitfirstarg splitlastarg sum symmetrize
51syn keyword formStatement tablebase testuse threadbucketsize totensor
52syn keyword formStatement tovector trace4 tracen tryreplace unhide
53syn keyword formStatement unittrace vectors write
54" for compatibility with older FORM versions:
55syn keyword formStatement id bracket count match traceN
Bram Moolenaar071d4272004-06-13 20:20:40 +000056
57" some special functions
Bram Moolenaar5c736222010-01-06 20:54:52 +010058syn keyword formStatement abs_ bernoulli_ binom_ conjg_ count_
59syn keyword formStatement d_ dd_ delta_ deltap_ denom_ distrib_
60syn keyword formStatement dum_ dummy_ dummyten_ e_ exp_ fac_
61syn keyword formStatement factorin_ firstbracket_ g5_ g6_ g7_
62syn keyword formStatement g_ gcd_ gi_ integer_ invfac_ match_
63syn keyword formStatement max_ maxpowerof_ min_ minpowerof_
64syn keyword formStatement mod_ nargs_ nterms_ pattern_ poly_
65syn keyword formStatement polyadd_ polydiv_ polygcd_ polyintfac_
66syn keyword formStatement polymul_ polynorm_ polyrem_ polysub_
67syn keyword formStatement replace_ reverse_ root_ setfun_ sig_
68syn keyword formStatement sign_ sum_ sump_ table_ tbl_ term_
69syn keyword formStatement termsin_ termsinbracket_ theta_ thetap_
70syn keyword formStatement 5_ 6_ 7_
71
72syn keyword formReserved sqrt_ ln_ sin_ cos_ tan_ asin_ acos_
73syn keyword formReserved atan_ atan2_ sinh_ cosh_ tanh_ asinh_
74syn keyword formReserved acosh_ atanh_ li2_ lin_
75
76syn keyword formTodo contained TODO FIXME XXX
77
78syn match formSpecial display contained "\\\(n\|t\|b\|\\\|\"\)"
79syn match formSpecial display contained "%\(%\|e\|E\|s\|f\|\$\)"
80syn match formSpecial "\<N\d\+_[?]"
Bram Moolenaar071d4272004-06-13 20:20:40 +000081
82" pattern matching for keywords
Bram Moolenaar5c736222010-01-06 20:54:52 +010083syn match formComment "^\ *\*.*$" contains=formTodo
84syn match formComment "\;\ *\*.*$" contains=formTodo
85syn region formString start=+"+ end=+"+ contains=formSpecial
Bram Moolenaar071d4272004-06-13 20:20:40 +000086syn region formString start=+'+ end=+'+
Bram Moolenaar5c736222010-01-06 20:54:52 +010087syn region formNestedString start=+`+ end=+'+ contains=formNestedString
Bram Moolenaar37c64c72017-09-19 22:06:03 +020088syn match formPreProc "^\=\#[a-zA-Z][a-zA-Z0-9]*\>"
Bram Moolenaar071d4272004-06-13 20:20:40 +000089syn match formNumber "\<\d\+\>"
90syn match formNumber "\<\d\+\.\d*\>"
91syn match formNumber "\.\d\+\>"
92syn match formNumber "-\d" contains=Number
93syn match formNumber "-\.\d" contains=Number
94syn match formNumber "i_\+\>"
95syn match formNumber "fac_\+\>"
Bram Moolenaar5c736222010-01-06 20:54:52 +010096" pattern matching wildcards
Bram Moolenaar37c64c72017-09-19 22:06:03 +020097syn match formNumber "?[a-zA-Z0-9]*"
Bram Moolenaar5c736222010-01-06 20:54:52 +010098" dollar-variables (new in 3.x)
Bram Moolenaar37c64c72017-09-19 22:06:03 +020099syn match formNumber "\\$[a-zA-Z0-9]*"
Bram Moolenaar5c736222010-01-06 20:54:52 +0100100" scalar products
Bram Moolenaar37c64c72017-09-19 22:06:03 +0200101syn match formNumber "^\=[a-zA-Z][a-zA-Z0-9]*\.[a-zA-Z][a-zA-Z0-9]*\>"
Bram Moolenaar5c736222010-01-06 20:54:52 +0100102
Bram Moolenaar37c64c72017-09-19 22:06:03 +0200103syn match formDirective "^\=\.[a-zA-Z][a-zA-Z0-9]*\>"
Bram Moolenaar071d4272004-06-13 20:20:40 +0000104
105" hi User Labels
106syn sync ccomment formComment minlines=10
107
108" Define the default highlighting.
Bram Moolenaar89bcfda2016-08-30 23:26:57 +0200109" Only when an item doesn't have highlighting yet
Bram Moolenaar071d4272004-06-13 20:20:40 +0000110
Bram Moolenaarf37506f2016-08-31 22:22:10 +0200111hi def link formConditional Conditional
112hi def link formNumber Number
113hi def link formStatement Statement
114hi def link formComment Comment
115hi def link formPreProc PreProc
116hi def link formDirective PreProc
117hi def link formType Type
118hi def link formString String
119hi def link formNestedString String
120hi def link formReserved Error
121hi def link formTodo Todo
122hi def link formSpecial SpecialChar
Bram Moolenaar071d4272004-06-13 20:20:40 +0000123
Bram Moolenaar89bcfda2016-08-30 23:26:57 +0200124if !exists("form_enhanced_color")
Bram Moolenaarf37506f2016-08-31 22:22:10 +0200125hi def link formHeaderStatement Statement
Bram Moolenaar89bcfda2016-08-30 23:26:57 +0200126else
127" enhanced color mode
Bram Moolenaarf37506f2016-08-31 22:22:10 +0200128hi def link formHeaderStatement HeaderStatement
Bram Moolenaar89bcfda2016-08-30 23:26:57 +0200129" dark and a light background for local types
130if &background == "dark"
131hi HeaderStatement term=underline ctermfg=LightGreen guifg=LightGreen gui=bold
132else
133hi HeaderStatement term=underline ctermfg=DarkGreen guifg=SeaGreen gui=bold
Bram Moolenaar071d4272004-06-13 20:20:40 +0000134endif
Bram Moolenaar89bcfda2016-08-30 23:26:57 +0200135" change slightly the default for dark gvim
136if has("gui_running") && &background == "dark"
137hi Conditional guifg=LightBlue gui=bold
138hi Statement guifg=LightYellow
139endif
140endif
141
Bram Moolenaar071d4272004-06-13 20:20:40 +0000142
143 let b:current_syntax = "form"
144
145" vim: ts=8