annotate runtime/syntax/mma.vim @ 5723:bcb24ef20b88

Added tag v7-4-206 for changeset 7e826028d399
author Bram Moolenaar <bram@vim.org>
date Wed, 19 Mar 2014 12:37:22 +0100
parents b7811ab264bf
children 43efa4f5a8ea
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1 " Vim syntax file
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2 " Language: Mathematica
271
8d34af900bae updated for version 7.0072
vimboss
parents: 7
diff changeset
3 " Maintainer: steve layland <layland@wolfram.com>
3312
b7811ab264bf updated for version 7.3.423
Bram Moolenaar <bram@vim.org>
parents: 2034
diff changeset
4 " Last Change: 2012 Feb 03 by Thilo Six
829
dc8197342755 updated for version 7.0d04
vimboss
parents: 274
diff changeset
5 " Source: http://members.wri.com/layland/vim/syntax/mma.vim
dc8197342755 updated for version 7.0d04
vimboss
parents: 274
diff changeset
6 " http://vim.sourceforge.net/scripts/script.php?script_id=1273
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 829
diff changeset
7 " Id: $Id: mma.vim,v 1.4 2006/04/14 20:40:38 vimboss Exp $
271
8d34af900bae updated for version 7.0072
vimboss
parents: 7
diff changeset
8 " NOTE:
3312
b7811ab264bf updated for version 7.3.423
Bram Moolenaar <bram@vim.org>
parents: 2034
diff changeset
9 "
271
8d34af900bae updated for version 7.0072
vimboss
parents: 7
diff changeset
10 " Empty .m files will automatically be presumed as Matlab files
8d34af900bae updated for version 7.0072
vimboss
parents: 7
diff changeset
11 " unless you have the following in your .vimrc:
8d34af900bae updated for version 7.0072
vimboss
parents: 7
diff changeset
12 "
8d34af900bae updated for version 7.0072
vimboss
parents: 7
diff changeset
13 " let filetype_m="mma"
8d34af900bae updated for version 7.0072
vimboss
parents: 7
diff changeset
14 "
8d34af900bae updated for version 7.0072
vimboss
parents: 7
diff changeset
15 " I also recommend setting the default 'Comment' hilighting to something
8d34af900bae updated for version 7.0072
vimboss
parents: 7
diff changeset
16 " other than the color used for 'Function', since both are plentiful in
3312
b7811ab264bf updated for version 7.3.423
Bram Moolenaar <bram@vim.org>
parents: 2034
diff changeset
17 " most mathematica files, and they are often the same color (when using
274
8fa8d7964cf1 updated for version 7.0073
vimboss
parents: 271
diff changeset
18 " background=dark).
271
8d34af900bae updated for version 7.0072
vimboss
parents: 7
diff changeset
19 "
8d34af900bae updated for version 7.0072
vimboss
parents: 7
diff changeset
20 " Credits:
8d34af900bae updated for version 7.0072
vimboss
parents: 7
diff changeset
21 " o Original Mathematica syntax version written by
8d34af900bae updated for version 7.0072
vimboss
parents: 7
diff changeset
22 " Wolfgang Waltenberger <wwalten@ben.tuwien.ac.at>
8d34af900bae updated for version 7.0072
vimboss
parents: 7
diff changeset
23 " o Some ideas like the CommentStar,CommentTitle were adapted
8d34af900bae updated for version 7.0072
vimboss
parents: 7
diff changeset
24 " from the Java vim syntax file by Claudio Fleiner. Thanks!
8d34af900bae updated for version 7.0072
vimboss
parents: 7
diff changeset
25 " o Everything else written by steve <layland@wolfram.com>
8d34af900bae updated for version 7.0072
vimboss
parents: 7
diff changeset
26 "
3312
b7811ab264bf updated for version 7.3.423
Bram Moolenaar <bram@vim.org>
parents: 2034
diff changeset
27 " Bugs:
b7811ab264bf updated for version 7.3.423
Bram Moolenaar <bram@vim.org>
parents: 2034
diff changeset
28 " o Vim 6.1 didn't really have support for character classes
829
dc8197342755 updated for version 7.0d04
vimboss
parents: 274
diff changeset
29 " of other named character classes. For example, [\a\d]
dc8197342755 updated for version 7.0d04
vimboss
parents: 274
diff changeset
30 " didn't work. Therefore, a lot of this code uses explicit
3312
b7811ab264bf updated for version 7.3.423
Bram Moolenaar <bram@vim.org>
parents: 2034
diff changeset
31 " character classes instead: [0-9a-zA-Z]
829
dc8197342755 updated for version 7.0d04
vimboss
parents: 274
diff changeset
32 "
271
8d34af900bae updated for version 7.0072
vimboss
parents: 7
diff changeset
33 " TODO:
8d34af900bae updated for version 7.0072
vimboss
parents: 7
diff changeset
34 " folding
8d34af900bae updated for version 7.0072
vimboss
parents: 7
diff changeset
35 " fix nesting
8d34af900bae updated for version 7.0072
vimboss
parents: 7
diff changeset
36 " finish populating popular symbols
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
37
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
38 if version < 600
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
39 syntax clear
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
40 elseif exists("b:current_syntax")
271
8d34af900bae updated for version 7.0072
vimboss
parents: 7
diff changeset
41 finish
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
42 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
43
3312
b7811ab264bf updated for version 7.3.423
Bram Moolenaar <bram@vim.org>
parents: 2034
diff changeset
44 let s:cpo_save = &cpo
b7811ab264bf updated for version 7.3.423
Bram Moolenaar <bram@vim.org>
parents: 2034
diff changeset
45 set cpo&vim
b7811ab264bf updated for version 7.3.423
Bram Moolenaar <bram@vim.org>
parents: 2034
diff changeset
46
271
8d34af900bae updated for version 7.0072
vimboss
parents: 7
diff changeset
47 " Group Definitions:
8d34af900bae updated for version 7.0072
vimboss
parents: 7
diff changeset
48 syntax cluster mmaNotes contains=mmaTodo,mmaFixme
8d34af900bae updated for version 7.0072
vimboss
parents: 7
diff changeset
49 syntax cluster mmaComments contains=mmaComment,mmaFunctionComment,mmaItem,mmaFunctionTitle,mmaCommentStar
8d34af900bae updated for version 7.0072
vimboss
parents: 7
diff changeset
50 syntax cluster mmaCommentStrings contains=mmaLooseQuote,mmaCommentString,mmaUnicode
8d34af900bae updated for version 7.0072
vimboss
parents: 7
diff changeset
51 syntax cluster mmaStrings contains=@mmaCommentStrings,mmaString
8d34af900bae updated for version 7.0072
vimboss
parents: 7
diff changeset
52 syntax cluster mmaTop contains=mmaOperator,mmaGenericFunction,mmaPureFunction,mmaVariable
8d34af900bae updated for version 7.0072
vimboss
parents: 7
diff changeset
53
8d34af900bae updated for version 7.0072
vimboss
parents: 7
diff changeset
54 " Predefined Constants:
8d34af900bae updated for version 7.0072
vimboss
parents: 7
diff changeset
55 " to list all predefined Symbols would be too insane...
8d34af900bae updated for version 7.0072
vimboss
parents: 7
diff changeset
56 " it's probably smarter to define a select few, and get the rest from
8d34af900bae updated for version 7.0072
vimboss
parents: 7
diff changeset
57 " context if absolutely necessary.
8d34af900bae updated for version 7.0072
vimboss
parents: 7
diff changeset
58 " TODO - populate this with other often used Symbols
8d34af900bae updated for version 7.0072
vimboss
parents: 7
diff changeset
59
8d34af900bae updated for version 7.0072
vimboss
parents: 7
diff changeset
60 " standard fixed symbols:
8d34af900bae updated for version 7.0072
vimboss
parents: 7
diff changeset
61 syntax keyword mmaVariable True False None Automatic All Null C General
8d34af900bae updated for version 7.0072
vimboss
parents: 7
diff changeset
62
8d34af900bae updated for version 7.0072
vimboss
parents: 7
diff changeset
63 " mathematical constants:
3312
b7811ab264bf updated for version 7.3.423
Bram Moolenaar <bram@vim.org>
parents: 2034
diff changeset
64 syntax keyword mmaVariable Pi I E Infinity ComplexInfinity Indeterminate GoldenRatio EulerGamma Degree Catalan Khinchin Glaisher
271
8d34af900bae updated for version 7.0072
vimboss
parents: 7
diff changeset
65
8d34af900bae updated for version 7.0072
vimboss
parents: 7
diff changeset
66 " stream data / atomic heads:
8d34af900bae updated for version 7.0072
vimboss
parents: 7
diff changeset
67 syntax keyword mmaVariable Byte Character Expression Number Real String Word EndOfFile Integer Symbol
8d34af900bae updated for version 7.0072
vimboss
parents: 7
diff changeset
68
8d34af900bae updated for version 7.0072
vimboss
parents: 7
diff changeset
69 " sets:
8d34af900bae updated for version 7.0072
vimboss
parents: 7
diff changeset
70 syntax keyword mmaVariable Integers Complexes Reals Booleans Rationals
8d34af900bae updated for version 7.0072
vimboss
parents: 7
diff changeset
71
8d34af900bae updated for version 7.0072
vimboss
parents: 7
diff changeset
72 " character classes:
8d34af900bae updated for version 7.0072
vimboss
parents: 7
diff changeset
73 syntax keyword mmaPattern DigitCharacter LetterCharacter WhitespaceCharacter WordCharacter EndOfString StartOfString EndOfLine StartOfLine WordBoundary
8d34af900bae updated for version 7.0072
vimboss
parents: 7
diff changeset
74
8d34af900bae updated for version 7.0072
vimboss
parents: 7
diff changeset
75 " SelectionMove directions/units:
8d34af900bae updated for version 7.0072
vimboss
parents: 7
diff changeset
76 syntax keyword mmaVariable Next Previous After Before Character Word Expression TextLine CellContents Cell CellGroup EvaluationCell ButtonCell GeneratedCell Notebook
8d34af900bae updated for version 7.0072
vimboss
parents: 7
diff changeset
77 syntax keyword mmaVariable CellTags CellStyle CellLabel
8d34af900bae updated for version 7.0072
vimboss
parents: 7
diff changeset
78
8d34af900bae updated for version 7.0072
vimboss
parents: 7
diff changeset
79 " TableForm positions:
8d34af900bae updated for version 7.0072
vimboss
parents: 7
diff changeset
80 syntax keyword mmaVariable Above Below Left Right
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
81
271
8d34af900bae updated for version 7.0072
vimboss
parents: 7
diff changeset
82 " colors:
8d34af900bae updated for version 7.0072
vimboss
parents: 7
diff changeset
83 syntax keyword mmaVariable Black Blue Brown Cyan Gray Green Magenta Orange Pink Purple Red White Yellow
8d34af900bae updated for version 7.0072
vimboss
parents: 7
diff changeset
84
8d34af900bae updated for version 7.0072
vimboss
parents: 7
diff changeset
85 " function attributes
3312
b7811ab264bf updated for version 7.3.423
Bram Moolenaar <bram@vim.org>
parents: 2034
diff changeset
86 syntax keyword mmaVariable Protected Listable OneIdentity Orderless Flat Constant NumericFunction Locked ReadProtected HoldFirst HoldRest HoldAll HoldAllComplete SequenceHold NHoldFirst NHoldRest NHoldAll Temporary Stub
271
8d34af900bae updated for version 7.0072
vimboss
parents: 7
diff changeset
87
274
8fa8d7964cf1 updated for version 7.0073
vimboss
parents: 271
diff changeset
88 " Comment Sections:
8fa8d7964cf1 updated for version 7.0073
vimboss
parents: 271
diff changeset
89 " this:
8fa8d7964cf1 updated for version 7.0073
vimboss
parents: 271
diff changeset
90 " :that:
829
dc8197342755 updated for version 7.0d04
vimboss
parents: 274
diff changeset
91 syntax match mmaItem "\%(^[( |*\t]*\)\@<=\%(:\+\|\w\)\w\+\%( \w\+\)\{0,3}:" contained contains=@mmaNotes
271
8d34af900bae updated for version 7.0072
vimboss
parents: 7
diff changeset
92
8d34af900bae updated for version 7.0072
vimboss
parents: 7
diff changeset
93 " Comment Keywords:
8d34af900bae updated for version 7.0072
vimboss
parents: 7
diff changeset
94 syntax keyword mmaTodo TODO NOTE HEY contained
8d34af900bae updated for version 7.0072
vimboss
parents: 7
diff changeset
95 syntax match mmaTodo "X\{3,}" contained
8d34af900bae updated for version 7.0072
vimboss
parents: 7
diff changeset
96 syntax keyword mmaFixme FIX[ME] FIXTHIS BROKEN contained
829
dc8197342755 updated for version 7.0d04
vimboss
parents: 274
diff changeset
97 syntax match mmaFixme "BUG\%( *\#\=[0-9]\+\)\=" contained
271
8d34af900bae updated for version 7.0072
vimboss
parents: 7
diff changeset
98 " yay pirates...
8d34af900bae updated for version 7.0072
vimboss
parents: 7
diff changeset
99 syntax match mmaFixme "\%(Y\=A\+R\+G\+\|GRR\+\|CR\+A\+P\+\)\%(!\+\)\=" contained
8d34af900bae updated for version 7.0072
vimboss
parents: 7
diff changeset
100
274
8fa8d7964cf1 updated for version 7.0073
vimboss
parents: 271
diff changeset
101 " EmPHAsis:
8fa8d7964cf1 updated for version 7.0073
vimboss
parents: 271
diff changeset
102 " this unnecessary, but whatever :)
829
dc8197342755 updated for version 7.0d04
vimboss
parents: 274
diff changeset
103 syntax match mmaemPHAsis "\%(^\|\s\)\([_/]\)[a-zA-Z0-9]\+\%([- \t':]\+[a-zA-Z0-9]\+\)*\1\%(\s\|$\)" contained contains=mmaemPHAsis
dc8197342755 updated for version 7.0d04
vimboss
parents: 274
diff changeset
104 syntax match mmaemPHAsis "\%(^\|\s\)(\@<!\*[a-zA-Z0-9]\+\%([- \t':]\+[a-zA-Z0-9]\+\)*)\@!\*\%(\s\|$\)" contained contains=mmaemPHAsis
271
8d34af900bae updated for version 7.0072
vimboss
parents: 7
diff changeset
105
274
8fa8d7964cf1 updated for version 7.0073
vimboss
parents: 271
diff changeset
106 " Regular Comments:
271
8d34af900bae updated for version 7.0072
vimboss
parents: 7
diff changeset
107 " (* *)
8d34af900bae updated for version 7.0072
vimboss
parents: 7
diff changeset
108 " allow nesting (* (* *) *) even though the frontend
8d34af900bae updated for version 7.0072
vimboss
parents: 7
diff changeset
109 " won't always like it.
8d34af900bae updated for version 7.0072
vimboss
parents: 7
diff changeset
110 syntax region mmaComment start=+(\*+ end=+\*)+ skipempty contains=@mmaNotes,mmaItem,@mmaCommentStrings,mmaemPHAsis,mmaComment
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
111
271
8d34af900bae updated for version 7.0072
vimboss
parents: 7
diff changeset
112 " Function Comments:
8d34af900bae updated for version 7.0072
vimboss
parents: 7
diff changeset
113 " just like a normal comment except the first sentance is Special ala Java
8d34af900bae updated for version 7.0072
vimboss
parents: 7
diff changeset
114 " (** *)
8d34af900bae updated for version 7.0072
vimboss
parents: 7
diff changeset
115 " TODO - fix this for nesting, or not...
8d34af900bae updated for version 7.0072
vimboss
parents: 7
diff changeset
116 syntax region mmaFunctionComment start="(\*\*\+" end="\*\+)" contains=@mmaNotes,mmaItem,mmaFunctionTitle,@mmaCommentStrings,mmaemPHAsis,mmaComment
8d34af900bae updated for version 7.0072
vimboss
parents: 7
diff changeset
117 syntax region mmaFunctionTitle contained matchgroup=mmaFunctionComment start="\%((\*\*[ *]*\)" matchgroup=mmaFunctionTitle keepend end=".[.!-]\=\s*$" end="[.!-][ \t\r<&]"me=e-1 end="\%(\*\+)\)\@=" contained contains=@mmaNotes,mmaItem,mmaCommentStar
8d34af900bae updated for version 7.0072
vimboss
parents: 7
diff changeset
118
8d34af900bae updated for version 7.0072
vimboss
parents: 7
diff changeset
119 " catch remaining (**********)'s
8d34af900bae updated for version 7.0072
vimboss
parents: 7
diff changeset
120 syntax match mmaComment "(\*\*\+)"
8d34af900bae updated for version 7.0072
vimboss
parents: 7
diff changeset
121 " catch preceding *
8d34af900bae updated for version 7.0072
vimboss
parents: 7
diff changeset
122 syntax match mmaCommentStar "^\s*\*\+" contained
8d34af900bae updated for version 7.0072
vimboss
parents: 7
diff changeset
123
274
8fa8d7964cf1 updated for version 7.0073
vimboss
parents: 271
diff changeset
124 " Variables:
8fa8d7964cf1 updated for version 7.0073
vimboss
parents: 271
diff changeset
125 " Dollar sign variables
829
dc8197342755 updated for version 7.0d04
vimboss
parents: 274
diff changeset
126 syntax match mmaVariable "\$\a\+[0-9a-zA-Z$]*"
dc8197342755 updated for version 7.0d04
vimboss
parents: 274
diff changeset
127
dc8197342755 updated for version 7.0d04
vimboss
parents: 274
diff changeset
128 " Preceding and Following Contexts
dc8197342755 updated for version 7.0d04
vimboss
parents: 274
diff changeset
129 syntax match mmaVariable "`[a-zA-Z$]\+[0-9a-zA-Z$]*" contains=mmaVariable
dc8197342755 updated for version 7.0d04
vimboss
parents: 274
diff changeset
130 syntax match mmaVariable "[a-zA-Z$]\+[0-9a-zA-Z$]*`" contains=mmaVariable
274
8fa8d7964cf1 updated for version 7.0073
vimboss
parents: 271
diff changeset
131
8fa8d7964cf1 updated for version 7.0073
vimboss
parents: 271
diff changeset
132 " Strings:
8fa8d7964cf1 updated for version 7.0073
vimboss
parents: 271
diff changeset
133 " "string"
8fa8d7964cf1 updated for version 7.0073
vimboss
parents: 271
diff changeset
134 " 'string' is not accepted (until literal strings are supported!)
8fa8d7964cf1 updated for version 7.0073
vimboss
parents: 271
diff changeset
135 syntax region mmaString start=+\\\@<!"+ skip=+\\\@<!\\\%(\\\\\)*"+ end=+"+
8fa8d7964cf1 updated for version 7.0073
vimboss
parents: 271
diff changeset
136 syntax region mmaCommentString oneline start=+\\\@<!"+ skip=+\\\@<!\\\%(\\\\\)*"+ end=+"+ contained
8fa8d7964cf1 updated for version 7.0073
vimboss
parents: 271
diff changeset
137
8fa8d7964cf1 updated for version 7.0073
vimboss
parents: 271
diff changeset
138
271
8d34af900bae updated for version 7.0072
vimboss
parents: 7
diff changeset
139 " Patterns:
8d34af900bae updated for version 7.0072
vimboss
parents: 7
diff changeset
140 " Each pattern marker below can be Blank[] (_), BlankSequence[] (__)
3312
b7811ab264bf updated for version 7.3.423
Bram Moolenaar <bram@vim.org>
parents: 2034
diff changeset
141 " or BlankNullSequence[] (___). Most examples below can also be
271
8d34af900bae updated for version 7.0072
vimboss
parents: 7
diff changeset
142 " combined, for example Pattern tests with Default values.
3312
b7811ab264bf updated for version 7.3.423
Bram Moolenaar <bram@vim.org>
parents: 2034
diff changeset
143 "
271
8d34af900bae updated for version 7.0072
vimboss
parents: 7
diff changeset
144 " _Head Anonymous patterns
3312
b7811ab264bf updated for version 7.3.423
Bram Moolenaar <bram@vim.org>
parents: 2034
diff changeset
145 " name_Head
271
8d34af900bae updated for version 7.0072
vimboss
parents: 7
diff changeset
146 " name:(_Head|_Head2) Named patterns
3312
b7811ab264bf updated for version 7.3.423
Bram Moolenaar <bram@vim.org>
parents: 2034
diff changeset
147 "
271
8d34af900bae updated for version 7.0072
vimboss
parents: 7
diff changeset
148 " _Head : val
8d34af900bae updated for version 7.0072
vimboss
parents: 7
diff changeset
149 " name:_Head:val Default values
8d34af900bae updated for version 7.0072
vimboss
parents: 7
diff changeset
150 "
3312
b7811ab264bf updated for version 7.3.423
Bram Moolenaar <bram@vim.org>
parents: 2034
diff changeset
151 " _Head?testQ,
271
8d34af900bae updated for version 7.0072
vimboss
parents: 7
diff changeset
152 " _Head?(test[#]&) Pattern tests
8d34af900bae updated for version 7.0072
vimboss
parents: 7
diff changeset
153 "
8d34af900bae updated for version 7.0072
vimboss
parents: 7
diff changeset
154 " name_Head/;test[name] Conditionals
3312
b7811ab264bf updated for version 7.3.423
Bram Moolenaar <bram@vim.org>
parents: 2034
diff changeset
155 "
271
8d34af900bae updated for version 7.0072
vimboss
parents: 7
diff changeset
156 " _Head:. Predefined Default
8d34af900bae updated for version 7.0072
vimboss
parents: 7
diff changeset
157 "
8d34af900bae updated for version 7.0072
vimboss
parents: 7
diff changeset
158 " .. ... Pattern Repeat
3312
b7811ab264bf updated for version 7.3.423
Bram Moolenaar <bram@vim.org>
parents: 2034
diff changeset
159
271
8d34af900bae updated for version 7.0072
vimboss
parents: 7
diff changeset
160 syntax match mmaPatternError "\%(_\{4,}\|)\s*&\s*)\@!\)" contained
8d34af900bae updated for version 7.0072
vimboss
parents: 7
diff changeset
161
8d34af900bae updated for version 7.0072
vimboss
parents: 7
diff changeset
162 "pattern name:
8d34af900bae updated for version 7.0072
vimboss
parents: 7
diff changeset
163 syntax match mmaPattern "[A-Za-z0-9`]\+\s*:\+[=>]\@!" contains=mmaOperator
8d34af900bae updated for version 7.0072
vimboss
parents: 7
diff changeset
164 "pattern default:
8d34af900bae updated for version 7.0072
vimboss
parents: 7
diff changeset
165 syntax match mmaPattern ": *[^ ,]\+[\], ]\@=" contains=@mmaCommentStrings,@mmaTop,mmaOperator
8d34af900bae updated for version 7.0072
vimboss
parents: 7
diff changeset
166 "pattern head/test:
8d34af900bae updated for version 7.0072
vimboss
parents: 7
diff changeset
167 syntax match mmaPattern "[A-Za-z0-9`]*_\+\%(\a\+\)\=\%(?([^)]\+)\|?[^\]},]\+\)\=" contains=@mmaTop,@mmaCommentStrings,mmaPatternError
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
168
271
8d34af900bae updated for version 7.0072
vimboss
parents: 7
diff changeset
169 " Operators:
8d34af900bae updated for version 7.0072
vimboss
parents: 7
diff changeset
170 " /: ^= ^:= UpValue
8d34af900bae updated for version 7.0072
vimboss
parents: 7
diff changeset
171 " /; Conditional
8d34af900bae updated for version 7.0072
vimboss
parents: 7
diff changeset
172 " := = DownValue
8d34af900bae updated for version 7.0072
vimboss
parents: 7
diff changeset
173 " == === ||
8d34af900bae updated for version 7.0072
vimboss
parents: 7
diff changeset
174 " != =!= && Logic
8d34af900bae updated for version 7.0072
vimboss
parents: 7
diff changeset
175 " >= <= < >
8d34af900bae updated for version 7.0072
vimboss
parents: 7
diff changeset
176 " += -= *=
8d34af900bae updated for version 7.0072
vimboss
parents: 7
diff changeset
177 " /= ++ -- Math
3312
b7811ab264bf updated for version 7.3.423
Bram Moolenaar <bram@vim.org>
parents: 2034
diff changeset
178 " ^*
271
8d34af900bae updated for version 7.0072
vimboss
parents: 7
diff changeset
179 " -> :> Rules
8d34af900bae updated for version 7.0072
vimboss
parents: 7
diff changeset
180 " @@ @@@ Apply
8d34af900bae updated for version 7.0072
vimboss
parents: 7
diff changeset
181 " /@ //@ Map
8d34af900bae updated for version 7.0072
vimboss
parents: 7
diff changeset
182 " /. //. Replace
8d34af900bae updated for version 7.0072
vimboss
parents: 7
diff changeset
183 " // @ Function application
8d34af900bae updated for version 7.0072
vimboss
parents: 7
diff changeset
184 " <> ~~ String/Pattern join
8d34af900bae updated for version 7.0072
vimboss
parents: 7
diff changeset
185 " ~ infix operator
8d34af900bae updated for version 7.0072
vimboss
parents: 7
diff changeset
186 " . : Pattern operators
8d34af900bae updated for version 7.0072
vimboss
parents: 7
diff changeset
187 syntax match mmaOperator "\%(@\{1,3}\|//[.@]\=\)"
8d34af900bae updated for version 7.0072
vimboss
parents: 7
diff changeset
188 syntax match mmaOperator "\%(/[;:@.]\=\|\^\=:\==\)"
8d34af900bae updated for version 7.0072
vimboss
parents: 7
diff changeset
189 syntax match mmaOperator "\%([-:=]\=>\|<=\=\)"
8d34af900bae updated for version 7.0072
vimboss
parents: 7
diff changeset
190 "syntax match mmaOperator "\%(++\=\|--\=\|[/+-*]=\|[^*]\)"
8d34af900bae updated for version 7.0072
vimboss
parents: 7
diff changeset
191 syntax match mmaOperator "[*+=^.:?-]"
8d34af900bae updated for version 7.0072
vimboss
parents: 7
diff changeset
192 syntax match mmaOperator "\%(\~\~\=\)"
8d34af900bae updated for version 7.0072
vimboss
parents: 7
diff changeset
193 syntax match mmaOperator "\%(=\{2,3}\|=\=!=\|||\=\|&&\|!\)" contains=ALLBUT,mmaPureFunction
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
194
829
dc8197342755 updated for version 7.0d04
vimboss
parents: 274
diff changeset
195 " Symbol Tags:
274
8fa8d7964cf1 updated for version 7.0073
vimboss
parents: 271
diff changeset
196 " "SymbolName::item"
829
dc8197342755 updated for version 7.0d04
vimboss
parents: 274
diff changeset
197 "syntax match mmaSymbol "`\=[a-zA-Z$]\+[0-9a-zA-Z$]*\%(`\%([a-zA-Z$]\+[0-9a-zA-Z$]*\)\=\)*" contained
dc8197342755 updated for version 7.0d04
vimboss
parents: 274
diff changeset
198 syntax match mmaMessage "`\=\([a-zA-Z$]\+[0-9a-zA-Z$]*\)\%(`\%([a-zA-Z$]\+[0-9a-zA-Z$]*\)\=\)*::\a\+" contains=mmaMessageType
dc8197342755 updated for version 7.0d04
vimboss
parents: 274
diff changeset
199 syntax match mmaMessageType "::\a\+"hs=s+2 contained
274
8fa8d7964cf1 updated for version 7.0073
vimboss
parents: 271
diff changeset
200
8fa8d7964cf1 updated for version 7.0073
vimboss
parents: 271
diff changeset
201 " Pure Functions:
8fa8d7964cf1 updated for version 7.0073
vimboss
parents: 271
diff changeset
202 syntax match mmaPureFunction "#\%(#\|\d\+\)\="
8fa8d7964cf1 updated for version 7.0073
vimboss
parents: 271
diff changeset
203 syntax match mmaPureFunction "&"
8fa8d7964cf1 updated for version 7.0073
vimboss
parents: 271
diff changeset
204
8fa8d7964cf1 updated for version 7.0073
vimboss
parents: 271
diff changeset
205 " Named Functions:
3312
b7811ab264bf updated for version 7.3.423
Bram Moolenaar <bram@vim.org>
parents: 2034
diff changeset
206 " Since everything is pretty much a function, get this straight
274
8fa8d7964cf1 updated for version 7.0073
vimboss
parents: 271
diff changeset
207 " from context
8fa8d7964cf1 updated for version 7.0073
vimboss
parents: 271
diff changeset
208 syntax match mmaGenericFunction "[A-Za-z0-9`]\+\s*\%([@[]\|/:\|/\=/@\)\@=" contains=mmaOperator
8fa8d7964cf1 updated for version 7.0073
vimboss
parents: 271
diff changeset
209 syntax match mmaGenericFunction "\~\s*[^~]\+\s*\~"hs=s+1,he=e-1 contains=mmaOperator,mmaBoring
8fa8d7964cf1 updated for version 7.0073
vimboss
parents: 271
diff changeset
210 syntax match mmaGenericFunction "//\s*[A-Za-z0-9`]\+"hs=s+2 contains=mmaOperator
8fa8d7964cf1 updated for version 7.0073
vimboss
parents: 271
diff changeset
211
8fa8d7964cf1 updated for version 7.0073
vimboss
parents: 271
diff changeset
212 " Numbers:
8fa8d7964cf1 updated for version 7.0073
vimboss
parents: 271
diff changeset
213 syntax match mmaNumber "\<\%(\d\+\.\=\d*\|\d*\.\=\d\+\)\>"
8fa8d7964cf1 updated for version 7.0073
vimboss
parents: 271
diff changeset
214 syntax match mmaNumber "`\d\+\%(\d\@!\.\|\>\)"
8fa8d7964cf1 updated for version 7.0073
vimboss
parents: 271
diff changeset
215
271
8d34af900bae updated for version 7.0072
vimboss
parents: 7
diff changeset
216 " Special Characters:
8d34af900bae updated for version 7.0072
vimboss
parents: 7
diff changeset
217 " \[Name] named character
8d34af900bae updated for version 7.0072
vimboss
parents: 7
diff changeset
218 " \ooo octal
8d34af900bae updated for version 7.0072
vimboss
parents: 7
diff changeset
219 " \.xx 2 digit hex
8d34af900bae updated for version 7.0072
vimboss
parents: 7
diff changeset
220 " \:xxxx 4 digit hex (multibyte unicode)
8d34af900bae updated for version 7.0072
vimboss
parents: 7
diff changeset
221 syntax match mmaUnicode "\\\[\w\+\d*\]"
8d34af900bae updated for version 7.0072
vimboss
parents: 7
diff changeset
222 syntax match mmaUnicode "\\\%(\x\{3}\|\.\x\{2}\|:\x\{4}\)"
8d34af900bae updated for version 7.0072
vimboss
parents: 7
diff changeset
223
8d34af900bae updated for version 7.0072
vimboss
parents: 7
diff changeset
224 " Syntax Errors:
8d34af900bae updated for version 7.0072
vimboss
parents: 7
diff changeset
225 syntax match mmaError "\*)" containedin=ALLBUT,@mmaComments,@mmaStrings
829
dc8197342755 updated for version 7.0d04
vimboss
parents: 274
diff changeset
226 syntax match mmaError "\%([/]{3,}\|[&:|+*?~-]\{3,}\|[.=]\{4,}\|_\@<=\.\{2,}\|`\{2,}\)" containedin=ALLBUT,@mmaComments,@mmaStrings
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
227
271
8d34af900bae updated for version 7.0072
vimboss
parents: 7
diff changeset
228 " Punctuation:
3312
b7811ab264bf updated for version 7.3.423
Bram Moolenaar <bram@vim.org>
parents: 2034
diff changeset
229 " things that shouldn't really be highlighted, or highlighted
271
8d34af900bae updated for version 7.0072
vimboss
parents: 7
diff changeset
230 " in they're own group if you _really_ want. :)
8d34af900bae updated for version 7.0072
vimboss
parents: 7
diff changeset
231 " ( ) { }
8d34af900bae updated for version 7.0072
vimboss
parents: 7
diff changeset
232 " TODO - use Delimiter group?
8d34af900bae updated for version 7.0072
vimboss
parents: 7
diff changeset
233 syntax match mmaBoring "[(){}]" contained
8d34af900bae updated for version 7.0072
vimboss
parents: 7
diff changeset
234
829
dc8197342755 updated for version 7.0d04
vimboss
parents: 274
diff changeset
235 " ------------------------------------
dc8197342755 updated for version 7.0d04
vimboss
parents: 274
diff changeset
236 " future explorations...
dc8197342755 updated for version 7.0d04
vimboss
parents: 274
diff changeset
237 " ------------------------------------
271
8d34af900bae updated for version 7.0072
vimboss
parents: 7
diff changeset
238 " Function Arguments:
8d34af900bae updated for version 7.0072
vimboss
parents: 7
diff changeset
239 " anything between brackets []
829
dc8197342755 updated for version 7.0d04
vimboss
parents: 274
diff changeset
240 " (fold)
dc8197342755 updated for version 7.0d04
vimboss
parents: 274
diff changeset
241 "syntax region mmaArgument start="\[" end="\]" containedin=ALLBUT,@mmaComments,@mmaStrings transparent fold
dc8197342755 updated for version 7.0d04
vimboss
parents: 274
diff changeset
242
dc8197342755 updated for version 7.0d04
vimboss
parents: 274
diff changeset
243 " Lists:
dc8197342755 updated for version 7.0d04
vimboss
parents: 274
diff changeset
244 " (fold)
dc8197342755 updated for version 7.0d04
vimboss
parents: 274
diff changeset
245 "syntax region mmaLists start="{" end="}" containedin=ALLBUT,@mmaComments,@mmaStrings transparent fold
dc8197342755 updated for version 7.0d04
vimboss
parents: 274
diff changeset
246
dc8197342755 updated for version 7.0d04
vimboss
parents: 274
diff changeset
247 " Regions:
dc8197342755 updated for version 7.0d04
vimboss
parents: 274
diff changeset
248 " (fold)
dc8197342755 updated for version 7.0d04
vimboss
parents: 274
diff changeset
249 "syntax region mmaRegion start="(\*\+[^<]*<!--[^>]*\*\+)" end="--> \*)" containedin=ALLBUT,@mmaStrings transparent fold keepend
dc8197342755 updated for version 7.0d04
vimboss
parents: 274
diff changeset
250
dc8197342755 updated for version 7.0d04
vimboss
parents: 274
diff changeset
251 " show fold text
dc8197342755 updated for version 7.0d04
vimboss
parents: 274
diff changeset
252 set commentstring='(*%s*)'
dc8197342755 updated for version 7.0d04
vimboss
parents: 274
diff changeset
253 "set foldtext=MmaFoldText()
dc8197342755 updated for version 7.0d04
vimboss
parents: 274
diff changeset
254
dc8197342755 updated for version 7.0d04
vimboss
parents: 274
diff changeset
255 "function MmaFoldText()
dc8197342755 updated for version 7.0d04
vimboss
parents: 274
diff changeset
256 " let line = getline(v:foldstart)
3312
b7811ab264bf updated for version 7.3.423
Bram Moolenaar <bram@vim.org>
parents: 2034
diff changeset
257 "
829
dc8197342755 updated for version 7.0d04
vimboss
parents: 274
diff changeset
258 " let lines = v:foldend-v:foldstart+1
3312
b7811ab264bf updated for version 7.3.423
Bram Moolenaar <bram@vim.org>
parents: 2034
diff changeset
259 "
829
dc8197342755 updated for version 7.0d04
vimboss
parents: 274
diff changeset
260 " let sub = substitute(line, '(\*\+|\*\+)|[-*_]\+', '', 'g')
dc8197342755 updated for version 7.0d04
vimboss
parents: 274
diff changeset
261 "
dc8197342755 updated for version 7.0d04
vimboss
parents: 274
diff changeset
262 " if match(line, '(\*') != -1
dc8197342755 updated for version 7.0d04
vimboss
parents: 274
diff changeset
263 " let lines = lines.' line comment'
dc8197342755 updated for version 7.0d04
vimboss
parents: 274
diff changeset
264 " else
dc8197342755 updated for version 7.0d04
vimboss
parents: 274
diff changeset
265 " let lines = lines.' lines'
dc8197342755 updated for version 7.0d04
vimboss
parents: 274
diff changeset
266 " endif
dc8197342755 updated for version 7.0d04
vimboss
parents: 274
diff changeset
267 "
dc8197342755 updated for version 7.0d04
vimboss
parents: 274
diff changeset
268 " return v:folddashes.' '.lines.' '.sub
dc8197342755 updated for version 7.0d04
vimboss
parents: 274
diff changeset
269 "endf
3312
b7811ab264bf updated for version 7.3.423
Bram Moolenaar <bram@vim.org>
parents: 2034
diff changeset
270
829
dc8197342755 updated for version 7.0d04
vimboss
parents: 274
diff changeset
271 "this is slow for computing folds, but it does so accurately
dc8197342755 updated for version 7.0d04
vimboss
parents: 274
diff changeset
272 syntax sync fromstart
dc8197342755 updated for version 7.0d04
vimboss
parents: 274
diff changeset
273
dc8197342755 updated for version 7.0d04
vimboss
parents: 274
diff changeset
274 " but this seems to do alright for non fold syntax coloring.
dc8197342755 updated for version 7.0d04
vimboss
parents: 274
diff changeset
275 " for folding, however, it doesn't get the nesting right.
dc8197342755 updated for version 7.0d04
vimboss
parents: 274
diff changeset
276 " TODO - find sync group for multiline modules? ick...
dc8197342755 updated for version 7.0d04
vimboss
parents: 274
diff changeset
277
dc8197342755 updated for version 7.0d04
vimboss
parents: 274
diff changeset
278 " sync multi line comments
dc8197342755 updated for version 7.0d04
vimboss
parents: 274
diff changeset
279 "syntax sync match syncComments groupthere NONE "\*)"
dc8197342755 updated for version 7.0d04
vimboss
parents: 274
diff changeset
280 "syntax sync match syncComments groupthere mmaComment "(\*"
dc8197342755 updated for version 7.0d04
vimboss
parents: 274
diff changeset
281
271
8d34af900bae updated for version 7.0072
vimboss
parents: 7
diff changeset
282 "set foldmethod=syntax
829
dc8197342755 updated for version 7.0d04
vimboss
parents: 274
diff changeset
283 "set foldnestmax=1
dc8197342755 updated for version 7.0d04
vimboss
parents: 274
diff changeset
284 "set foldminlines=15
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
285
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
286 if version >= 508 || !exists("did_mma_syn_inits")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
287 if version < 508
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
288 let did_mma_syn_inits = 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
289 command -nargs=+ HiLink hi link <args>
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
290 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
291 command -nargs=+ HiLink hi def link <args>
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
292 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
293
3312
b7811ab264bf updated for version 7.3.423
Bram Moolenaar <bram@vim.org>
parents: 2034
diff changeset
294 " NOTE - the following links are not guaranteed to
b7811ab264bf updated for version 7.3.423
Bram Moolenaar <bram@vim.org>
parents: 2034
diff changeset
295 " look good under all colorschemes. You might need to
271
8d34af900bae updated for version 7.0072
vimboss
parents: 7
diff changeset
296 " :so $VIMRUNTIME/syntax/hitest.vim and tweak these to
8d34af900bae updated for version 7.0072
vimboss
parents: 7
diff changeset
297 " look good in yours
8d34af900bae updated for version 7.0072
vimboss
parents: 7
diff changeset
298
829
dc8197342755 updated for version 7.0d04
vimboss
parents: 274
diff changeset
299
271
8d34af900bae updated for version 7.0072
vimboss
parents: 7
diff changeset
300 HiLink mmaComment Comment
8d34af900bae updated for version 7.0072
vimboss
parents: 7
diff changeset
301 HiLink mmaCommentStar Comment
8d34af900bae updated for version 7.0072
vimboss
parents: 7
diff changeset
302 HiLink mmaFunctionComment Comment
8d34af900bae updated for version 7.0072
vimboss
parents: 7
diff changeset
303 HiLink mmaLooseQuote Comment
8d34af900bae updated for version 7.0072
vimboss
parents: 7
diff changeset
304 HiLink mmaGenericFunction Function
274
8fa8d7964cf1 updated for version 7.0073
vimboss
parents: 271
diff changeset
305 HiLink mmaVariable Identifier
829
dc8197342755 updated for version 7.0d04
vimboss
parents: 274
diff changeset
306 " HiLink mmaSymbol Identifier
271
8d34af900bae updated for version 7.0072
vimboss
parents: 7
diff changeset
307 HiLink mmaOperator Operator
8d34af900bae updated for version 7.0072
vimboss
parents: 7
diff changeset
308 HiLink mmaPatternOp Operator
8d34af900bae updated for version 7.0072
vimboss
parents: 7
diff changeset
309 HiLink mmaPureFunction Operator
8d34af900bae updated for version 7.0072
vimboss
parents: 7
diff changeset
310 HiLink mmaString String
8d34af900bae updated for version 7.0072
vimboss
parents: 7
diff changeset
311 HiLink mmaCommentString String
8d34af900bae updated for version 7.0072
vimboss
parents: 7
diff changeset
312 HiLink mmaUnicode String
8d34af900bae updated for version 7.0072
vimboss
parents: 7
diff changeset
313 HiLink mmaMessage Type
8d34af900bae updated for version 7.0072
vimboss
parents: 7
diff changeset
314 HiLink mmaNumber Type
8d34af900bae updated for version 7.0072
vimboss
parents: 7
diff changeset
315 HiLink mmaPattern Type
8d34af900bae updated for version 7.0072
vimboss
parents: 7
diff changeset
316 HiLink mmaError Error
8d34af900bae updated for version 7.0072
vimboss
parents: 7
diff changeset
317 HiLink mmaFixme Error
8d34af900bae updated for version 7.0072
vimboss
parents: 7
diff changeset
318 HiLink mmaPatternError Error
8d34af900bae updated for version 7.0072
vimboss
parents: 7
diff changeset
319 HiLink mmaTodo Todo
8d34af900bae updated for version 7.0072
vimboss
parents: 7
diff changeset
320 HiLink mmaemPHAsis Special
8d34af900bae updated for version 7.0072
vimboss
parents: 7
diff changeset
321 HiLink mmaFunctionTitle Special
829
dc8197342755 updated for version 7.0d04
vimboss
parents: 274
diff changeset
322 HiLink mmaMessageType Special
271
8d34af900bae updated for version 7.0072
vimboss
parents: 7
diff changeset
323 HiLink mmaItem Preproc
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
324
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
325 delcommand HiLink
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
326 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
327
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
328 let b:current_syntax = "mma"
3312
b7811ab264bf updated for version 7.3.423
Bram Moolenaar <bram@vim.org>
parents: 2034
diff changeset
329
b7811ab264bf updated for version 7.3.423
Bram Moolenaar <bram@vim.org>
parents: 2034
diff changeset
330 let &cpo = s:cpo_save
b7811ab264bf updated for version 7.3.423
Bram Moolenaar <bram@vim.org>
parents: 2034
diff changeset
331 unlet s:cpo_save