blob: 46e1e4ff84508ad8e9295a814374c366fd3c9d1f [file] [log] [blame]
Bram Moolenaar779b74b2006-04-10 14:55:34 +00001" Vim syntax file
2" Language: Maxima (symbolic algebra program)
3" Maintainer: Robert Dodier (robert.dodier@gmail.com)
4" Last Change: April 6, 2006
5" Version: 1
6" Adapted mostly from xmath.vim
7" Number formats adapted from r.vim
8"
Bram Moolenaar89bcfda2016-08-30 23:26:57 +02009" quit when a syntax file was already loaded
10if exists("b:current_syntax")
Bram Moolenaar779b74b2006-04-10 14:55:34 +000011 finish
12endif
13
14syn sync lines=1000
15
16" parenthesis sanity checker
17syn region maximaZone matchgroup=Delimiter start="(" matchgroup=Delimiter end=")" transparent contains=ALLBUT,maximaError,maximaBraceError,maximaCurlyError
18syn region maximaZone matchgroup=Delimiter start="{" matchgroup=Delimiter end="}" transparent contains=ALLBUT,maximaError,maximaBraceError,maximaParenError
19syn region maximaZone matchgroup=Delimiter start="\[" matchgroup=Delimiter end="]" transparent contains=ALLBUT,maximaError,maximaCurlyError,maximaParenError
20syn match maximaError "[)\]}]"
21syn match maximaBraceError "[)}]" contained
22syn match maximaCurlyError "[)\]]" contained
23syn match maximaParenError "[\]}]" contained
24syn match maximaComma "[\[\](),;]"
25syn match maximaComma "\.\.\.$"
26
27" A bunch of useful maxima keywords
28syn keyword maximaConditional if then else elseif and or not
29syn keyword maximaRepeat do for thru
30
31" ---------------------- BEGIN LIST OF ALL FUNCTIONS (EXCEPT KEYWORDS) ----------------------
32syn keyword maximaFunc abasep abs absboxchar absint acos acosh acot acoth acsc
33syn keyword maximaFunc acsch activate activecontexts addcol additive addrow adim
34syn keyword maximaFunc adjoint af aform airy algebraic algepsilon algexact algsys
35syn keyword maximaFunc alg_type alias aliases allbut all_dotsimp_denoms allroots allsym
36syn keyword maximaFunc alphabetic antid antidiff antisymmetric append appendfile
37syn keyword maximaFunc apply apply1 apply2 applyb1 apropos args array arrayapply
38syn keyword maximaFunc arrayinfo arraymake arrays asec asech asin asinh askexp
39syn keyword maximaFunc askinteger asksign assoc assoc_legendre_p assoc_legendre_q assume
40syn keyword maximaFunc assume_pos assume_pos_pred assumescalar asymbol asympa at atan
41syn keyword maximaFunc atan2 atanh atensimp atom atomgrad atrig1 atvalue augcoefmatrix
42syn keyword maximaFunc av backsubst backtrace bashindices batch batchload bc2 bdvac
43syn keyword maximaFunc berlefact bern bernpoly bessel besselexpand bessel_i bessel_j
44syn keyword maximaFunc bessel_k bessel_y beta bezout bffac bfhzeta bfloat bfloatp
45syn keyword maximaFunc bfpsi bfpsi0 bftorat bftrunc bfzeta bimetric binomial block
46syn keyword maximaFunc bothcoef box boxchar break breakup bug_report build_info buildq
47syn keyword maximaFunc burn cabs canform canten carg cartan catch cauchysum cbffac
48syn keyword maximaFunc cdisplay cf cfdisrep cfexpand cflength cframe_flag cgeodesic
49syn keyword maximaFunc changename changevar charpoly checkdiv check_overlaps christof
50syn keyword maximaFunc clear_rules closefile closeps cmetric cnonmet_flag coeff
51syn keyword maximaFunc coefmatrix cograd col collapse columnvector combine commutative
52syn keyword maximaFunc comp2pui compfile compile compile_file components concan concat
53syn keyword maximaFunc conj conjugate conmetderiv cons constant constantp cont2part
54syn keyword maximaFunc content context contexts contortion contract contragrad coord
55syn keyword maximaFunc copylist copymatrix cos cosh cosnpiflag cot coth covdiff
56syn keyword maximaFunc covect create_list csc csch csetup ctaylor ctaypov ctaypt
57syn keyword maximaFunc ctayswitch ctayvar ct_coords ct_coordsys ctorsion_flag ctransform
58syn keyword maximaFunc ctrgsimp current_let_rule_package dblint deactivate debugmode
59syn keyword maximaFunc declare declare_translated declare_weight decsym
60syn keyword maximaFunc default_let_rule_package defcon define define_variable defint
61syn keyword maximaFunc defmatch defrule deftaylor del delete deleten delta demo
62syn keyword maximaFunc demoivre denom dependencies depends derivabbrev derivdegree
63syn keyword maximaFunc derivlist derivsubst describe desolve determinant detout
64syn keyword maximaFunc diagmatrix diagmatrixp diagmetric diff dim dimension direct
65syn keyword maximaFunc disolate disp dispcon dispflag dispform dispfun display
66syn keyword maximaFunc display2d display_format_internal disprule dispterms distrib
67syn keyword maximaFunc divide divsum doallmxops domain domxexpt domxmxops domxnctimes
68syn keyword maximaFunc dontfactor doscmxops doscmxplus dot0nscsimp dot0simp dot1simp
69syn keyword maximaFunc dotassoc dotconstrules dotdistrib dotexptsimp dotident dotscrules
70syn keyword maximaFunc dotsimp dpart dscalar %e echelon %edispflag eigenvalues
71syn keyword maximaFunc eigenvectors eighth einstein eivals eivects ele2comp
72syn keyword maximaFunc ele2polynome ele2pui elem eliminate elliptic_e elliptic_ec
73syn keyword maximaFunc elliptic_eu elliptic_f elliptic_kc elliptic_pi ematrix %emode
74syn keyword maximaFunc endcons entermatrix entertensor entier %enumer equal equalp erf
75syn keyword maximaFunc erfflag errcatch error errormsg error_size error_syms
76syn keyword maximaFunc %e_to_numlog euler ev eval evenp every evflag evfun evundiff
77syn keyword maximaFunc example exp expand expandwrt expandwrt_denom expandwrt_factored
78syn keyword maximaFunc explose expon exponentialize expop express expt exptdispflag
79syn keyword maximaFunc exptisolate exptsubst extdiff extract_linear_equations ezgcd
80syn keyword maximaFunc facexpand factcomb factlim factor factorflag factorial factorout
81syn keyword maximaFunc factorsum facts false fast_central_elements fast_linsolve
82syn keyword maximaFunc fasttimes fb feature featurep features fft fib fibtophi fifth
83syn keyword maximaFunc filename_merge file_search file_search_demo file_search_lisp
84syn keyword maximaFunc file_search_maxima file_type fillarray findde first fix flatten
85syn keyword maximaFunc flipflag float float2bf floatnump flush flush1deriv flushd
86syn keyword maximaFunc flushnd forget fortindent fortran fortspaces fourcos fourexpand
87syn keyword maximaFunc fourier fourint fourintcos fourintsin foursimp foursin fourth
88syn keyword maximaFunc fpprec fpprintprec frame_bracket freeof fullmap fullmapl
89syn keyword maximaFunc fullratsimp fullratsubst funcsolve functions fundef funmake funp
90syn keyword maximaFunc gamma %gamma gammalim gauss gcd gcdex gcfactor gdet genfact
91syn keyword maximaFunc genindex genmatrix gensumnum get getchar gfactor gfactorsum
92syn keyword maximaFunc globalsolve go gradef gradefs gramschmidt grind grobner_basis
93syn keyword maximaFunc gschmit hach halfangles hermite hipow hodge horner i0 i1
94syn keyword maximaFunc *read-base* ic1 ic2 icc1 icc2 ic_convert ichr1 ichr2 icounter
95syn keyword maximaFunc icurvature ident idiff idim idummy idummyx ieqn ieqnprint ifb
96syn keyword maximaFunc ifc1 ifc2 ifg ifgi ifr iframe_bracket_form iframes ifri ift
97syn keyword maximaFunc igeodesic_coords igeowedge_flag ikt1 ikt2 ilt imagpart imetric
98syn keyword maximaFunc inchar indexed_tensor indices inf %inf infeval infinity infix
99syn keyword maximaFunc inflag infolists init_atensor init_ctensor inm inmc1 inmc2
100syn keyword maximaFunc innerproduct in_netmath inpart inprod inrt integerp integrate
101syn keyword maximaFunc integrate_use_rootsof integration_constant_counter interpolate
102syn keyword maximaFunc intfaclim intopois intosum intpolabs intpolerror intpolrel
103syn keyword maximaFunc invariant1 invariant2 inverse_jacobi_cd inverse_jacobi_cn
104syn keyword maximaFunc inverse_jacobi_cs inverse_jacobi_dc inverse_jacobi_dn
105syn keyword maximaFunc inverse_jacobi_ds inverse_jacobi_nc inverse_jacobi_nd
106syn keyword maximaFunc inverse_jacobi_ns inverse_jacobi_sc inverse_jacobi_sd
107syn keyword maximaFunc inverse_jacobi_sn invert is ishow isolate isolate_wrt_times
108syn keyword maximaFunc isqrt itr j0 j1 jacobi jacobi_cd jacobi_cn jacobi_cs jacobi_dc
109syn keyword maximaFunc jacobi_dn jacobi_ds jacobi_nc jacobi_nd jacobi_ns jacobi_sc
110syn keyword maximaFunc jacobi_sd jacobi_sn jn kdels kdelta keepfloat kill killcontext
111syn keyword maximaFunc kinvariant kostka kt labels lambda laplace lassociative last
112syn keyword maximaFunc lc2kdt lc_l lcm lc_u ldefint ldisp ldisplay leinstein length
113syn keyword maximaFunc let letrat let_rule_packages letrules letsimp levi_civita lfg
114syn keyword maximaFunc lfreeof lg lgtreillis lhospitallim lhs liediff limit limsubst
115syn keyword maximaFunc linear linechar linel linenum linsolve linsolve_params
116syn keyword maximaFunc linsolvewarn listarith listarray listconstvars listdummyvars
117syn keyword maximaFunc list_nc_monomials listoftens listofvars listp lmxchar load
118syn keyword maximaFunc loadfile loadprint local log logabs logarc logconcoeffp
119syn keyword maximaFunc logcontract logexpand lognegint lognumer logsimp lopow
120syn keyword maximaFunc lorentz_gauge lpart lratsubst lriem lriemann lsum ltreillis
121syn keyword maximaFunc m1pbranch macroexpansion mainvar make_array makebox makefact
122syn keyword maximaFunc makegamma makelist make_random_state make_transform map mapatom
123syn keyword maximaFunc maperror maplist matchdeclare matchfix matrix matrix_element_add
124syn keyword maximaFunc matrix_element_mult matrix_element_transpose matrixmap matrixp
125syn keyword maximaFunc mattrace max maxapplydepth maxapplyheight maxnegex maxposex
126syn keyword maximaFunc maxtayorder member min %minf minfactorial minor mod
127syn keyword maximaFunc mode_check_errorp mode_checkp mode_check_warnp mode_declare
128syn keyword maximaFunc mode_identity modulus mon2schur mono monomial_dimensions
129syn keyword maximaFunc multi_elem multinomial multi_orbit multiplicative multiplicities
130syn keyword maximaFunc multi_pui multsym multthru myoptions nc_degree ncexpt ncharpoly
131syn keyword maximaFunc negdistrib negsumdispflag newcontext newdet newton niceindices
132syn keyword maximaFunc niceindicespref ninth nm nmc noeval nolabels nonmetricity
133syn keyword maximaFunc nonscalar nonscalarp noun noundisp nounify nouns np npi
134syn keyword maximaFunc nptetrad nroots nterms ntermst nthroot ntrig num numberp numer
135syn keyword maximaFunc numerval numfactor nusum obase oddp ode2 op openplot_curves
136syn keyword maximaFunc operatorp opproperties opsubst optimize optimprefix optionset
137syn keyword maximaFunc orbit ordergreat ordergreatp orderless orderlessp outative
138syn keyword maximaFunc outchar outermap outofpois packagefile pade part part2cont
139syn keyword maximaFunc partfrac partition partpol partswitch permanent permut petrov
140syn keyword maximaFunc pfeformat pi pickapart piece playback plog plot2d plot2d_ps
141syn keyword maximaFunc plot3d plot_options poisdiff poisexpt poisint poislim poismap
142syn keyword maximaFunc poisplus poissimp poisson poissubst poistimes poistrim polarform
143syn keyword maximaFunc polartorect polynome2ele posfun potential powerdisp powers
144syn keyword maximaFunc powerseries pred prederror primep print printpois printprops
145syn keyword maximaFunc prodhack prodrac product programmode prompt properties props
146syn keyword maximaFunc propvars pscom psdraw_curve psexpand psi pui pui2comp pui2ele
147syn keyword maximaFunc pui2polynome pui_direct puireduc put qput qq quad_qag quad_qagi
148syn keyword maximaFunc quad_qags quad_qawc quad_qawf quad_qawo quad_qaws quanc8 quit
149syn keyword maximaFunc qunit quotient radcan radexpand radsubstflag random rank
150syn keyword maximaFunc rassociative rat ratalgdenom ratchristof ratcoef ratdenom
151syn keyword maximaFunc ratdenomdivide ratdiff ratdisrep rateinstein ratepsilon ratexpand
152syn keyword maximaFunc ratfac ratmx ratnumer ratnump ratp ratprint ratriemann ratsimp
153syn keyword maximaFunc ratsimpexpons ratsubst ratvars ratweight ratweights ratweyl
154syn keyword maximaFunc ratwtlvl read readonly realonly realpart realroots rearray
155syn keyword maximaFunc rectform recttopolar rediff refcheck rem remainder remarray
156syn keyword maximaFunc rembox remcomps remcon remcoord remfun remfunction remlet
157syn keyword maximaFunc remove remrule remsym remvalue rename reset residue resolvante
158syn keyword maximaFunc resolvante_alternee1 resolvante_bipartite resolvante_diedrale
159syn keyword maximaFunc resolvante_klein resolvante_klein3 resolvante_produit_sym
160syn keyword maximaFunc resolvante_unitaire resolvante_vierer rest resultant return
161syn keyword maximaFunc reveal reverse revert revert2 rhs ric ricci riem riemann
162syn keyword maximaFunc rinvariant risch rmxchar rncombine %rnum_list romberg rombergabs
163syn keyword maximaFunc rombergit rombergmin rombergtol room rootsconmode rootscontract
164syn keyword maximaFunc rootsepsilon round row run_testsuite save savedef savefactors
165syn keyword maximaFunc scalarmatrixp scalarp scalefactors scanmap schur2comp sconcat
166syn keyword maximaFunc scsimp scurvature sec sech second setcheck setcheckbreak
167syn keyword maximaFunc setelmx set_plot_option set_random_state setup_autoload
168syn keyword maximaFunc set_up_dot_simplifications setval seventh sf show showcomps
169syn keyword maximaFunc showratvars showtime sign signum similaritytransform simpsum
170syn keyword maximaFunc simtran sin sinh sinnpiflag sixth solve solvedecomposes
171syn keyword maximaFunc solveexplicit solvefactors solve_inconsistent_error solvenullwarn
172syn keyword maximaFunc solveradcan solvetrigwarn somrac sort sparse spherical_bessel_j
173syn keyword maximaFunc spherical_bessel_y spherical_hankel1 spherical_hankel2
174syn keyword maximaFunc spherical_harmonic splice sqfr sqrt sqrtdispflag sstatus
175syn keyword maximaFunc stardisp status string stringout sublis sublis_apply_lambda
176syn keyword maximaFunc sublist submatrix subst substinpart substpart subvarp sum
177syn keyword maximaFunc sumcontract sumexpand sumhack sumsplitfact supcontext symbolp
178syn keyword maximaFunc symmetric symmetricp system tan tanh taylor taylordepth
179syn keyword maximaFunc taylorinfo taylor_logexpand taylor_order_coefficients taylorp
180syn keyword maximaFunc taylor_simplifier taylor_truncate_polynomials taytorat tcl_output
181syn keyword maximaFunc tcontract tellrat tellsimp tellsimpafter tensorkill tentex tenth
182syn keyword maximaFunc tex %th third throw time timer timer_devalue timer_info
183syn keyword maximaFunc tldefint tlimit tlimswitch todd_coxeter to_lisp totaldisrep
184syn keyword maximaFunc totalfourier totient tpartpol tr trace trace_options
185syn keyword maximaFunc transcompile translate translate_file transpose transrun
186syn keyword maximaFunc tr_array_as_ref tr_bound_function_applyp treillis treinat
187syn keyword maximaFunc tr_file_tty_messagesp tr_float_can_branch_complex
188syn keyword maximaFunc tr_function_call_default triangularize trigexpand trigexpandplus
189syn keyword maximaFunc trigexpandtimes triginverses trigrat trigreduce trigsign trigsimp
190syn keyword maximaFunc tr_numer tr_optimize_max_loop tr_semicompile tr_state_vars true
191syn keyword maximaFunc trunc truncate tr_warn_bad_function_calls tr_warn_fexpr
192syn keyword maximaFunc tr_warnings_get tr_warn_meval tr_warn_mode tr_warn_undeclared
193syn keyword maximaFunc tr_warn_undefined_variable tr_windy ttyoff ueivects ufg ug
194syn keyword maximaFunc ultraspherical undiff uniteigenvectors unitvector unknown unorder
195syn keyword maximaFunc unsum untellrat untimer untrace uric uricci uriem uriemann
196syn keyword maximaFunc use_fast_arrays uvect values vect_cross vectorpotential
197syn keyword maximaFunc vectorsimp verb verbify verbose weyl with_stdout writefile
198syn keyword maximaFunc xgraph_curves xthru zerobern zeroequiv zeromatrix zeta zeta%pi
199syn match maximaOp "[\*\/\+\-\#\!\~\^\=\:\<\>\@]"
200" ---------------------- END LIST OF ALL FUNCTIONS (EXCEPT KEYWORDS) ----------------------
201
202
203syn case match
204
205" Labels (supports maxima's goto)
206syn match maximaLabel "^\s*<[a-zA-Z_][a-zA-Z0-9%_]*>"
207
208" String and Character constants
209" Highlight special characters (those which have a backslash) differently
210syn match maximaSpecial contained "\\\d\d\d\|\\."
211syn region maximaString start=+"+ skip=+\\\\\|\\"+ end=+"+ contains=maximaSpecial
212syn match maximaCharacter "'[^\\]'"
213syn match maximaSpecialChar "'\\.'"
214
215" number with no fractional part or exponent
216syn match maximaNumber /\<\d\+\>/
217" floating point number with integer and fractional parts and optional exponent
218syn match maximaFloat /\<\d\+\.\d*\([BbDdEeSs][-+]\=\d\+\)\=\>/
219" floating point number with no integer part and optional exponent
220syn match maximaFloat /\<\.\d\+\([BbDdEeSs][-+]\=\d\+\)\=\>/
221" floating point number with no fractional part and optional exponent
222syn match maximaFloat /\<\d\+[BbDdEeSs][-+]\=\d\+\>/
223
224" Comments:
225" maxima supports /* ... */ (like C)
226syn keyword maximaTodo contained TODO Todo DEBUG
Bram Moolenaar5c736222010-01-06 20:54:52 +0100227syn region maximaCommentBlock start="/\*" end="\*/" contains=maximaString,maximaTodo,maximaCommentBlock
Bram Moolenaar779b74b2006-04-10 14:55:34 +0000228
229" synchronizing
230syn sync match maximaSyncComment grouphere maximaCommentBlock "/*"
231syn sync match maximaSyncComment groupthere NONE "*/"
232
233" Define the default highlighting.
Bram Moolenaar89bcfda2016-08-30 23:26:57 +0200234" Only when an item doesn't have highlighting yet
Bram Moolenaar779b74b2006-04-10 14:55:34 +0000235
Bram Moolenaarf37506f2016-08-31 22:22:10 +0200236hi def link maximaBraceError maximaError
237hi def link maximaCmd maximaStatement
238hi def link maximaCurlyError maximaError
239hi def link maximaFuncCmd maximaStatement
240hi def link maximaParenError maximaError
Bram Moolenaar779b74b2006-04-10 14:55:34 +0000241
Bram Moolenaar89bcfda2016-08-30 23:26:57 +0200242" The default methods for highlighting. Can be overridden later
Bram Moolenaarf37506f2016-08-31 22:22:10 +0200243hi def link maximaCharacter Character
244hi def link maximaComma Function
245hi def link maximaCommentBlock Comment
246hi def link maximaConditional Conditional
247hi def link maximaError Error
248hi def link maximaFunc Delimiter
249hi def link maximaOp Delimiter
250hi def link maximaLabel PreProc
251hi def link maximaNumber Number
252hi def link maximaFloat Float
253hi def link maximaRepeat Repeat
254hi def link maximaSpecial Type
255hi def link maximaSpecialChar SpecialChar
256hi def link maximaStatement Statement
257hi def link maximaString String
258hi def link maximaTodo Todo
Bram Moolenaar779b74b2006-04-10 14:55:34 +0000259
Bram Moolenaar779b74b2006-04-10 14:55:34 +0000260
261let b:current_syntax = "maxima"