blob: abd1c489dd2209217124fd2be6fd161444d40171 [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 Moolenaar071d4272004-06-13 20:20:40 +000088syn match formPreProc "^\=\#[a-zA-z][a-zA-Z0-9]*\>"
89syn 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
97syn match formNumber "?[A-z0-9]*"
98" dollar-variables (new in 3.x)
99syn match formNumber "\\$[A-z0-9]*"
100" scalar products
101syn match formNumber "^\=[a-zA-z][a-zA-Z0-9]*\.[a-zA-z][a-zA-Z0-9]*\>"
102
Bram Moolenaar071d4272004-06-13 20:20:40 +0000103syn match formDirective "^\=\.[a-zA-z][a-zA-Z0-9]*\>"
104
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
110command -nargs=+ HiLink hi def link <args>
Bram Moolenaar071d4272004-06-13 20:20:40 +0000111
Bram Moolenaar89bcfda2016-08-30 23:26:57 +0200112HiLink formConditional Conditional
113HiLink formNumber Number
114HiLink formStatement Statement
115HiLink formComment Comment
116HiLink formPreProc PreProc
117HiLink formDirective PreProc
118HiLink formType Type
119HiLink formString String
120HiLink formNestedString String
121HiLink formReserved Error
122HiLink formTodo Todo
123HiLink formSpecial SpecialChar
Bram Moolenaar071d4272004-06-13 20:20:40 +0000124
Bram Moolenaar89bcfda2016-08-30 23:26:57 +0200125if !exists("form_enhanced_color")
126HiLink formHeaderStatement Statement
127else
128" enhanced color mode
129HiLink formHeaderStatement HeaderStatement
130" dark and a light background for local types
131if &background == "dark"
132hi HeaderStatement term=underline ctermfg=LightGreen guifg=LightGreen gui=bold
133else
134hi HeaderStatement term=underline ctermfg=DarkGreen guifg=SeaGreen gui=bold
Bram Moolenaar071d4272004-06-13 20:20:40 +0000135endif
Bram Moolenaar89bcfda2016-08-30 23:26:57 +0200136" change slightly the default for dark gvim
137if has("gui_running") && &background == "dark"
138hi Conditional guifg=LightBlue gui=bold
139hi Statement guifg=LightYellow
140endif
141endif
142
143delcommand HiLink
Bram Moolenaar071d4272004-06-13 20:20:40 +0000144
145 let b:current_syntax = "form"
146
147" vim: ts=8