annotate runtime/syntax/mma.vim @ 3275:fbb23bd517f8 v7.3.406

updated for version 7.3.406 Problem: Multi-byte characters in b:browsefilter are not handled correctly. Solution: First use convert_filter() normally and then convert to wide characters. (Taro Muraoka)
author Bram Moolenaar <bram@vim.org>
date Fri, 20 Jan 2012 17:57:51 +0100
parents 7bc41231fbc7
children b7811ab264bf
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>
829
dc8197342755 updated for version 7.0d04
vimboss
parents: 274
diff changeset
4 " Last Change: Thu May 19 21:36:04 CDT 2005
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:
829
dc8197342755 updated for version 7.0d04
vimboss
parents: 274
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
8d34af900bae updated for version 7.0072
vimboss
parents: 7
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 "
829
dc8197342755 updated for version 7.0d04
vimboss
parents: 274
diff changeset
27 " Bugs:
dc8197342755 updated for version 7.0d04
vimboss
parents: 274
diff changeset
28 " o Vim 6.1 didn't really have support for character classes
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
dc8197342755 updated for version 7.0d04
vimboss
parents: 274
diff changeset
31 " character classes instead: [0-9a-zA-Z]
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
271
8d34af900bae updated for version 7.0072
vimboss
parents: 7
diff changeset
44 " Group Definitions:
8d34af900bae updated for version 7.0072
vimboss
parents: 7
diff changeset
45 syntax cluster mmaNotes contains=mmaTodo,mmaFixme
8d34af900bae updated for version 7.0072
vimboss
parents: 7
diff changeset
46 syntax cluster mmaComments contains=mmaComment,mmaFunctionComment,mmaItem,mmaFunctionTitle,mmaCommentStar
8d34af900bae updated for version 7.0072
vimboss
parents: 7
diff changeset
47 syntax cluster mmaCommentStrings contains=mmaLooseQuote,mmaCommentString,mmaUnicode
8d34af900bae updated for version 7.0072
vimboss
parents: 7
diff changeset
48 syntax cluster mmaStrings contains=@mmaCommentStrings,mmaString
8d34af900bae updated for version 7.0072
vimboss
parents: 7
diff changeset
49 syntax cluster mmaTop contains=mmaOperator,mmaGenericFunction,mmaPureFunction,mmaVariable
8d34af900bae updated for version 7.0072
vimboss
parents: 7
diff changeset
50
8d34af900bae updated for version 7.0072
vimboss
parents: 7
diff changeset
51 " Predefined Constants:
8d34af900bae updated for version 7.0072
vimboss
parents: 7
diff changeset
52 " to list all predefined Symbols would be too insane...
8d34af900bae updated for version 7.0072
vimboss
parents: 7
diff changeset
53 " 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
54 " context if absolutely necessary.
8d34af900bae updated for version 7.0072
vimboss
parents: 7
diff changeset
55 " TODO - populate this with other often used Symbols
8d34af900bae updated for version 7.0072
vimboss
parents: 7
diff changeset
56
8d34af900bae updated for version 7.0072
vimboss
parents: 7
diff changeset
57 " standard fixed symbols:
8d34af900bae updated for version 7.0072
vimboss
parents: 7
diff changeset
58 syntax keyword mmaVariable True False None Automatic All Null C General
8d34af900bae updated for version 7.0072
vimboss
parents: 7
diff changeset
59
8d34af900bae updated for version 7.0072
vimboss
parents: 7
diff changeset
60 " mathematical constants:
8d34af900bae updated for version 7.0072
vimboss
parents: 7
diff changeset
61 syntax keyword mmaVariable Pi I E Infinity ComplexInfinity Indeterminate GoldenRatio EulerGamma Degree Catalan Khinchin Glaisher
8d34af900bae updated for version 7.0072
vimboss
parents: 7
diff changeset
62
8d34af900bae updated for version 7.0072
vimboss
parents: 7
diff changeset
63 " stream data / atomic heads:
8d34af900bae updated for version 7.0072
vimboss
parents: 7
diff changeset
64 syntax keyword mmaVariable Byte Character Expression Number Real String Word EndOfFile Integer Symbol
8d34af900bae updated for version 7.0072
vimboss
parents: 7
diff changeset
65
8d34af900bae updated for version 7.0072
vimboss
parents: 7
diff changeset
66 " sets:
8d34af900bae updated for version 7.0072
vimboss
parents: 7
diff changeset
67 syntax keyword mmaVariable Integers Complexes Reals Booleans Rationals
8d34af900bae updated for version 7.0072
vimboss
parents: 7
diff changeset
68
8d34af900bae updated for version 7.0072
vimboss
parents: 7
diff changeset
69 " character classes:
8d34af900bae updated for version 7.0072
vimboss
parents: 7
diff changeset
70 syntax keyword mmaPattern DigitCharacter LetterCharacter WhitespaceCharacter WordCharacter EndOfString StartOfString EndOfLine StartOfLine WordBoundary
8d34af900bae updated for version 7.0072
vimboss
parents: 7
diff changeset
71
8d34af900bae updated for version 7.0072
vimboss
parents: 7
diff changeset
72 " SelectionMove directions/units:
8d34af900bae updated for version 7.0072
vimboss
parents: 7
diff changeset
73 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
74 syntax keyword mmaVariable CellTags CellStyle CellLabel
8d34af900bae updated for version 7.0072
vimboss
parents: 7
diff changeset
75
8d34af900bae updated for version 7.0072
vimboss
parents: 7
diff changeset
76 " TableForm positions:
8d34af900bae updated for version 7.0072
vimboss
parents: 7
diff changeset
77 syntax keyword mmaVariable Above Below Left Right
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
78
271
8d34af900bae updated for version 7.0072
vimboss
parents: 7
diff changeset
79 " colors:
8d34af900bae updated for version 7.0072
vimboss
parents: 7
diff changeset
80 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
81
8d34af900bae updated for version 7.0072
vimboss
parents: 7
diff changeset
82 " function attributes
8d34af900bae updated for version 7.0072
vimboss
parents: 7
diff changeset
83 syntax keyword mmaVariable Protected Listable OneIdentity Orderless Flat Constant NumericFunction Locked ReadProtected HoldFirst HoldRest HoldAll HoldAllComplete SequenceHold NHoldFirst NHoldRest NHoldAll Temporary Stub
8d34af900bae updated for version 7.0072
vimboss
parents: 7
diff changeset
84
274
8fa8d7964cf1 updated for version 7.0073
vimboss
parents: 271
diff changeset
85 " Comment Sections:
8fa8d7964cf1 updated for version 7.0073
vimboss
parents: 271
diff changeset
86 " this:
8fa8d7964cf1 updated for version 7.0073
vimboss
parents: 271
diff changeset
87 " :that:
829
dc8197342755 updated for version 7.0d04
vimboss
parents: 274
diff changeset
88 syntax match mmaItem "\%(^[( |*\t]*\)\@<=\%(:\+\|\w\)\w\+\%( \w\+\)\{0,3}:" contained contains=@mmaNotes
271
8d34af900bae updated for version 7.0072
vimboss
parents: 7
diff changeset
89
8d34af900bae updated for version 7.0072
vimboss
parents: 7
diff changeset
90 " Comment Keywords:
8d34af900bae updated for version 7.0072
vimboss
parents: 7
diff changeset
91 syntax keyword mmaTodo TODO NOTE HEY contained
8d34af900bae updated for version 7.0072
vimboss
parents: 7
diff changeset
92 syntax match mmaTodo "X\{3,}" contained
8d34af900bae updated for version 7.0072
vimboss
parents: 7
diff changeset
93 syntax keyword mmaFixme FIX[ME] FIXTHIS BROKEN contained
829
dc8197342755 updated for version 7.0d04
vimboss
parents: 274
diff changeset
94 syntax match mmaFixme "BUG\%( *\#\=[0-9]\+\)\=" contained
271
8d34af900bae updated for version 7.0072
vimboss
parents: 7
diff changeset
95 " yay pirates...
8d34af900bae updated for version 7.0072
vimboss
parents: 7
diff changeset
96 syntax match mmaFixme "\%(Y\=A\+R\+G\+\|GRR\+\|CR\+A\+P\+\)\%(!\+\)\=" contained
8d34af900bae updated for version 7.0072
vimboss
parents: 7
diff changeset
97
274
8fa8d7964cf1 updated for version 7.0073
vimboss
parents: 271
diff changeset
98 " EmPHAsis:
8fa8d7964cf1 updated for version 7.0073
vimboss
parents: 271
diff changeset
99 " this unnecessary, but whatever :)
829
dc8197342755 updated for version 7.0d04
vimboss
parents: 274
diff changeset
100 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
101 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
102
274
8fa8d7964cf1 updated for version 7.0073
vimboss
parents: 271
diff changeset
103 " Regular Comments:
271
8d34af900bae updated for version 7.0072
vimboss
parents: 7
diff changeset
104 " (* *)
8d34af900bae updated for version 7.0072
vimboss
parents: 7
diff changeset
105 " allow nesting (* (* *) *) even though the frontend
8d34af900bae updated for version 7.0072
vimboss
parents: 7
diff changeset
106 " won't always like it.
8d34af900bae updated for version 7.0072
vimboss
parents: 7
diff changeset
107 syntax region mmaComment start=+(\*+ end=+\*)+ skipempty contains=@mmaNotes,mmaItem,@mmaCommentStrings,mmaemPHAsis,mmaComment
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
108
271
8d34af900bae updated for version 7.0072
vimboss
parents: 7
diff changeset
109 " Function Comments:
8d34af900bae updated for version 7.0072
vimboss
parents: 7
diff changeset
110 " just like a normal comment except the first sentance is Special ala Java
8d34af900bae updated for version 7.0072
vimboss
parents: 7
diff changeset
111 " (** *)
8d34af900bae updated for version 7.0072
vimboss
parents: 7
diff changeset
112 " TODO - fix this for nesting, or not...
8d34af900bae updated for version 7.0072
vimboss
parents: 7
diff changeset
113 syntax region mmaFunctionComment start="(\*\*\+" end="\*\+)" contains=@mmaNotes,mmaItem,mmaFunctionTitle,@mmaCommentStrings,mmaemPHAsis,mmaComment
8d34af900bae updated for version 7.0072
vimboss
parents: 7
diff changeset
114 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
115
8d34af900bae updated for version 7.0072
vimboss
parents: 7
diff changeset
116 " catch remaining (**********)'s
8d34af900bae updated for version 7.0072
vimboss
parents: 7
diff changeset
117 syntax match mmaComment "(\*\*\+)"
8d34af900bae updated for version 7.0072
vimboss
parents: 7
diff changeset
118 " catch preceding *
8d34af900bae updated for version 7.0072
vimboss
parents: 7
diff changeset
119 syntax match mmaCommentStar "^\s*\*\+" contained
8d34af900bae updated for version 7.0072
vimboss
parents: 7
diff changeset
120
274
8fa8d7964cf1 updated for version 7.0073
vimboss
parents: 271
diff changeset
121 " Variables:
8fa8d7964cf1 updated for version 7.0073
vimboss
parents: 271
diff changeset
122 " Dollar sign variables
829
dc8197342755 updated for version 7.0d04
vimboss
parents: 274
diff changeset
123 syntax match mmaVariable "\$\a\+[0-9a-zA-Z$]*"
dc8197342755 updated for version 7.0d04
vimboss
parents: 274
diff changeset
124
dc8197342755 updated for version 7.0d04
vimboss
parents: 274
diff changeset
125 " Preceding and Following Contexts
dc8197342755 updated for version 7.0d04
vimboss
parents: 274
diff changeset
126 syntax match mmaVariable "`[a-zA-Z$]\+[0-9a-zA-Z$]*" contains=mmaVariable
dc8197342755 updated for version 7.0d04
vimboss
parents: 274
diff changeset
127 syntax match mmaVariable "[a-zA-Z$]\+[0-9a-zA-Z$]*`" contains=mmaVariable
274
8fa8d7964cf1 updated for version 7.0073
vimboss
parents: 271
diff changeset
128
8fa8d7964cf1 updated for version 7.0073
vimboss
parents: 271
diff changeset
129 " Strings:
8fa8d7964cf1 updated for version 7.0073
vimboss
parents: 271
diff changeset
130 " "string"
8fa8d7964cf1 updated for version 7.0073
vimboss
parents: 271
diff changeset
131 " 'string' is not accepted (until literal strings are supported!)
8fa8d7964cf1 updated for version 7.0073
vimboss
parents: 271
diff changeset
132 syntax region mmaString start=+\\\@<!"+ skip=+\\\@<!\\\%(\\\\\)*"+ end=+"+
8fa8d7964cf1 updated for version 7.0073
vimboss
parents: 271
diff changeset
133 syntax region mmaCommentString oneline start=+\\\@<!"+ skip=+\\\@<!\\\%(\\\\\)*"+ end=+"+ contained
8fa8d7964cf1 updated for version 7.0073
vimboss
parents: 271
diff changeset
134
8fa8d7964cf1 updated for version 7.0073
vimboss
parents: 271
diff changeset
135
271
8d34af900bae updated for version 7.0072
vimboss
parents: 7
diff changeset
136 " Patterns:
8d34af900bae updated for version 7.0072
vimboss
parents: 7
diff changeset
137 " Each pattern marker below can be Blank[] (_), BlankSequence[] (__)
8d34af900bae updated for version 7.0072
vimboss
parents: 7
diff changeset
138 " or BlankNullSequence[] (___). Most examples below can also be
8d34af900bae updated for version 7.0072
vimboss
parents: 7
diff changeset
139 " combined, for example Pattern tests with Default values.
8d34af900bae updated for version 7.0072
vimboss
parents: 7
diff changeset
140 "
8d34af900bae updated for version 7.0072
vimboss
parents: 7
diff changeset
141 " _Head Anonymous patterns
8d34af900bae updated for version 7.0072
vimboss
parents: 7
diff changeset
142 " name_Head
8d34af900bae updated for version 7.0072
vimboss
parents: 7
diff changeset
143 " name:(_Head|_Head2) Named patterns
8d34af900bae updated for version 7.0072
vimboss
parents: 7
diff changeset
144 "
8d34af900bae updated for version 7.0072
vimboss
parents: 7
diff changeset
145 " _Head : val
8d34af900bae updated for version 7.0072
vimboss
parents: 7
diff changeset
146 " name:_Head:val Default values
8d34af900bae updated for version 7.0072
vimboss
parents: 7
diff changeset
147 "
8d34af900bae updated for version 7.0072
vimboss
parents: 7
diff changeset
148 " _Head?testQ,
8d34af900bae updated for version 7.0072
vimboss
parents: 7
diff changeset
149 " _Head?(test[#]&) Pattern tests
8d34af900bae updated for version 7.0072
vimboss
parents: 7
diff changeset
150 "
8d34af900bae updated for version 7.0072
vimboss
parents: 7
diff changeset
151 " name_Head/;test[name] Conditionals
8d34af900bae updated for version 7.0072
vimboss
parents: 7
diff changeset
152 "
8d34af900bae updated for version 7.0072
vimboss
parents: 7
diff changeset
153 " _Head:. Predefined Default
8d34af900bae updated for version 7.0072
vimboss
parents: 7
diff changeset
154 "
8d34af900bae updated for version 7.0072
vimboss
parents: 7
diff changeset
155 " .. ... Pattern Repeat
8d34af900bae updated for version 7.0072
vimboss
parents: 7
diff changeset
156
8d34af900bae updated for version 7.0072
vimboss
parents: 7
diff changeset
157 syntax match mmaPatternError "\%(_\{4,}\|)\s*&\s*)\@!\)" contained
8d34af900bae updated for version 7.0072
vimboss
parents: 7
diff changeset
158
8d34af900bae updated for version 7.0072
vimboss
parents: 7
diff changeset
159 "pattern name:
8d34af900bae updated for version 7.0072
vimboss
parents: 7
diff changeset
160 syntax match mmaPattern "[A-Za-z0-9`]\+\s*:\+[=>]\@!" contains=mmaOperator
8d34af900bae updated for version 7.0072
vimboss
parents: 7
diff changeset
161 "pattern default:
8d34af900bae updated for version 7.0072
vimboss
parents: 7
diff changeset
162 syntax match mmaPattern ": *[^ ,]\+[\], ]\@=" contains=@mmaCommentStrings,@mmaTop,mmaOperator
8d34af900bae updated for version 7.0072
vimboss
parents: 7
diff changeset
163 "pattern head/test:
8d34af900bae updated for version 7.0072
vimboss
parents: 7
diff changeset
164 syntax match mmaPattern "[A-Za-z0-9`]*_\+\%(\a\+\)\=\%(?([^)]\+)\|?[^\]},]\+\)\=" contains=@mmaTop,@mmaCommentStrings,mmaPatternError
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
165
271
8d34af900bae updated for version 7.0072
vimboss
parents: 7
diff changeset
166 " Operators:
8d34af900bae updated for version 7.0072
vimboss
parents: 7
diff changeset
167 " /: ^= ^:= UpValue
8d34af900bae updated for version 7.0072
vimboss
parents: 7
diff changeset
168 " /; Conditional
8d34af900bae updated for version 7.0072
vimboss
parents: 7
diff changeset
169 " := = DownValue
8d34af900bae updated for version 7.0072
vimboss
parents: 7
diff changeset
170 " == === ||
8d34af900bae updated for version 7.0072
vimboss
parents: 7
diff changeset
171 " != =!= && Logic
8d34af900bae updated for version 7.0072
vimboss
parents: 7
diff changeset
172 " >= <= < >
8d34af900bae updated for version 7.0072
vimboss
parents: 7
diff changeset
173 " += -= *=
8d34af900bae updated for version 7.0072
vimboss
parents: 7
diff changeset
174 " /= ++ -- Math
8d34af900bae updated for version 7.0072
vimboss
parents: 7
diff changeset
175 " ^*
8d34af900bae updated for version 7.0072
vimboss
parents: 7
diff changeset
176 " -> :> Rules
8d34af900bae updated for version 7.0072
vimboss
parents: 7
diff changeset
177 " @@ @@@ Apply
8d34af900bae updated for version 7.0072
vimboss
parents: 7
diff changeset
178 " /@ //@ Map
8d34af900bae updated for version 7.0072
vimboss
parents: 7
diff changeset
179 " /. //. Replace
8d34af900bae updated for version 7.0072
vimboss
parents: 7
diff changeset
180 " // @ Function application
8d34af900bae updated for version 7.0072
vimboss
parents: 7
diff changeset
181 " <> ~~ String/Pattern join
8d34af900bae updated for version 7.0072
vimboss
parents: 7
diff changeset
182 " ~ infix operator
8d34af900bae updated for version 7.0072
vimboss
parents: 7
diff changeset
183 " . : Pattern operators
8d34af900bae updated for version 7.0072
vimboss
parents: 7
diff changeset
184 syntax match mmaOperator "\%(@\{1,3}\|//[.@]\=\)"
8d34af900bae updated for version 7.0072
vimboss
parents: 7
diff changeset
185 syntax match mmaOperator "\%(/[;:@.]\=\|\^\=:\==\)"
8d34af900bae updated for version 7.0072
vimboss
parents: 7
diff changeset
186 syntax match mmaOperator "\%([-:=]\=>\|<=\=\)"
8d34af900bae updated for version 7.0072
vimboss
parents: 7
diff changeset
187 "syntax match mmaOperator "\%(++\=\|--\=\|[/+-*]=\|[^*]\)"
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 "\%(=\{2,3}\|=\=!=\|||\=\|&&\|!\)" contains=ALLBUT,mmaPureFunction
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
191
829
dc8197342755 updated for version 7.0d04
vimboss
parents: 274
diff changeset
192 " Symbol Tags:
274
8fa8d7964cf1 updated for version 7.0073
vimboss
parents: 271
diff changeset
193 " "SymbolName::item"
829
dc8197342755 updated for version 7.0d04
vimboss
parents: 274
diff changeset
194 "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
195 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
196 syntax match mmaMessageType "::\a\+"hs=s+2 contained
274
8fa8d7964cf1 updated for version 7.0073
vimboss
parents: 271
diff changeset
197
8fa8d7964cf1 updated for version 7.0073
vimboss
parents: 271
diff changeset
198 " Pure Functions:
8fa8d7964cf1 updated for version 7.0073
vimboss
parents: 271
diff changeset
199 syntax match mmaPureFunction "#\%(#\|\d\+\)\="
8fa8d7964cf1 updated for version 7.0073
vimboss
parents: 271
diff changeset
200 syntax match mmaPureFunction "&"
8fa8d7964cf1 updated for version 7.0073
vimboss
parents: 271
diff changeset
201
8fa8d7964cf1 updated for version 7.0073
vimboss
parents: 271
diff changeset
202 " Named Functions:
8fa8d7964cf1 updated for version 7.0073
vimboss
parents: 271
diff changeset
203 " Since everything is pretty much a function, get this straight
8fa8d7964cf1 updated for version 7.0073
vimboss
parents: 271
diff changeset
204 " from context
8fa8d7964cf1 updated for version 7.0073
vimboss
parents: 271
diff changeset
205 syntax match mmaGenericFunction "[A-Za-z0-9`]\+\s*\%([@[]\|/:\|/\=/@\)\@=" contains=mmaOperator
8fa8d7964cf1 updated for version 7.0073
vimboss
parents: 271
diff changeset
206 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
207 syntax match mmaGenericFunction "//\s*[A-Za-z0-9`]\+"hs=s+2 contains=mmaOperator
8fa8d7964cf1 updated for version 7.0073
vimboss
parents: 271
diff changeset
208
8fa8d7964cf1 updated for version 7.0073
vimboss
parents: 271
diff changeset
209 " Numbers:
8fa8d7964cf1 updated for version 7.0073
vimboss
parents: 271
diff changeset
210 syntax match mmaNumber "\<\%(\d\+\.\=\d*\|\d*\.\=\d\+\)\>"
8fa8d7964cf1 updated for version 7.0073
vimboss
parents: 271
diff changeset
211 syntax match mmaNumber "`\d\+\%(\d\@!\.\|\>\)"
8fa8d7964cf1 updated for version 7.0073
vimboss
parents: 271
diff changeset
212
271
8d34af900bae updated for version 7.0072
vimboss
parents: 7
diff changeset
213 " Special Characters:
8d34af900bae updated for version 7.0072
vimboss
parents: 7
diff changeset
214 " \[Name] named character
8d34af900bae updated for version 7.0072
vimboss
parents: 7
diff changeset
215 " \ooo octal
8d34af900bae updated for version 7.0072
vimboss
parents: 7
diff changeset
216 " \.xx 2 digit hex
8d34af900bae updated for version 7.0072
vimboss
parents: 7
diff changeset
217 " \:xxxx 4 digit hex (multibyte unicode)
8d34af900bae updated for version 7.0072
vimboss
parents: 7
diff changeset
218 syntax match mmaUnicode "\\\[\w\+\d*\]"
8d34af900bae updated for version 7.0072
vimboss
parents: 7
diff changeset
219 syntax match mmaUnicode "\\\%(\x\{3}\|\.\x\{2}\|:\x\{4}\)"
8d34af900bae updated for version 7.0072
vimboss
parents: 7
diff changeset
220
8d34af900bae updated for version 7.0072
vimboss
parents: 7
diff changeset
221 " Syntax Errors:
8d34af900bae updated for version 7.0072
vimboss
parents: 7
diff changeset
222 syntax match mmaError "\*)" containedin=ALLBUT,@mmaComments,@mmaStrings
829
dc8197342755 updated for version 7.0d04
vimboss
parents: 274
diff changeset
223 syntax match mmaError "\%([/]{3,}\|[&:|+*?~-]\{3,}\|[.=]\{4,}\|_\@<=\.\{2,}\|`\{2,}\)" containedin=ALLBUT,@mmaComments,@mmaStrings
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
224
271
8d34af900bae updated for version 7.0072
vimboss
parents: 7
diff changeset
225 " Punctuation:
8d34af900bae updated for version 7.0072
vimboss
parents: 7
diff changeset
226 " things that shouldn't really be highlighted, or highlighted
8d34af900bae updated for version 7.0072
vimboss
parents: 7
diff changeset
227 " in they're own group if you _really_ want. :)
8d34af900bae updated for version 7.0072
vimboss
parents: 7
diff changeset
228 " ( ) { }
8d34af900bae updated for version 7.0072
vimboss
parents: 7
diff changeset
229 " TODO - use Delimiter group?
8d34af900bae updated for version 7.0072
vimboss
parents: 7
diff changeset
230 syntax match mmaBoring "[(){}]" contained
8d34af900bae updated for version 7.0072
vimboss
parents: 7
diff changeset
231
829
dc8197342755 updated for version 7.0d04
vimboss
parents: 274
diff changeset
232 " ------------------------------------
dc8197342755 updated for version 7.0d04
vimboss
parents: 274
diff changeset
233 " future explorations...
dc8197342755 updated for version 7.0d04
vimboss
parents: 274
diff changeset
234 " ------------------------------------
271
8d34af900bae updated for version 7.0072
vimboss
parents: 7
diff changeset
235 " Function Arguments:
8d34af900bae updated for version 7.0072
vimboss
parents: 7
diff changeset
236 " anything between brackets []
829
dc8197342755 updated for version 7.0d04
vimboss
parents: 274
diff changeset
237 " (fold)
dc8197342755 updated for version 7.0d04
vimboss
parents: 274
diff changeset
238 "syntax region mmaArgument start="\[" end="\]" containedin=ALLBUT,@mmaComments,@mmaStrings transparent fold
dc8197342755 updated for version 7.0d04
vimboss
parents: 274
diff changeset
239
dc8197342755 updated for version 7.0d04
vimboss
parents: 274
diff changeset
240 " Lists:
dc8197342755 updated for version 7.0d04
vimboss
parents: 274
diff changeset
241 " (fold)
dc8197342755 updated for version 7.0d04
vimboss
parents: 274
diff changeset
242 "syntax region mmaLists start="{" end="}" containedin=ALLBUT,@mmaComments,@mmaStrings transparent fold
dc8197342755 updated for version 7.0d04
vimboss
parents: 274
diff changeset
243
dc8197342755 updated for version 7.0d04
vimboss
parents: 274
diff changeset
244 " Regions:
dc8197342755 updated for version 7.0d04
vimboss
parents: 274
diff changeset
245 " (fold)
dc8197342755 updated for version 7.0d04
vimboss
parents: 274
diff changeset
246 "syntax region mmaRegion start="(\*\+[^<]*<!--[^>]*\*\+)" end="--> \*)" containedin=ALLBUT,@mmaStrings transparent fold keepend
dc8197342755 updated for version 7.0d04
vimboss
parents: 274
diff changeset
247
dc8197342755 updated for version 7.0d04
vimboss
parents: 274
diff changeset
248 " show fold text
dc8197342755 updated for version 7.0d04
vimboss
parents: 274
diff changeset
249 set commentstring='(*%s*)'
dc8197342755 updated for version 7.0d04
vimboss
parents: 274
diff changeset
250 "set foldtext=MmaFoldText()
dc8197342755 updated for version 7.0d04
vimboss
parents: 274
diff changeset
251
dc8197342755 updated for version 7.0d04
vimboss
parents: 274
diff changeset
252 "function MmaFoldText()
dc8197342755 updated for version 7.0d04
vimboss
parents: 274
diff changeset
253 " let line = getline(v:foldstart)
dc8197342755 updated for version 7.0d04
vimboss
parents: 274
diff changeset
254 "
dc8197342755 updated for version 7.0d04
vimboss
parents: 274
diff changeset
255 " let lines = v:foldend-v:foldstart+1
dc8197342755 updated for version 7.0d04
vimboss
parents: 274
diff changeset
256 "
dc8197342755 updated for version 7.0d04
vimboss
parents: 274
diff changeset
257 " let sub = substitute(line, '(\*\+|\*\+)|[-*_]\+', '', 'g')
dc8197342755 updated for version 7.0d04
vimboss
parents: 274
diff changeset
258 "
dc8197342755 updated for version 7.0d04
vimboss
parents: 274
diff changeset
259 " if match(line, '(\*') != -1
dc8197342755 updated for version 7.0d04
vimboss
parents: 274
diff changeset
260 " let lines = lines.' line comment'
dc8197342755 updated for version 7.0d04
vimboss
parents: 274
diff changeset
261 " else
dc8197342755 updated for version 7.0d04
vimboss
parents: 274
diff changeset
262 " let lines = lines.' lines'
dc8197342755 updated for version 7.0d04
vimboss
parents: 274
diff changeset
263 " endif
dc8197342755 updated for version 7.0d04
vimboss
parents: 274
diff changeset
264 "
dc8197342755 updated for version 7.0d04
vimboss
parents: 274
diff changeset
265 " return v:folddashes.' '.lines.' '.sub
dc8197342755 updated for version 7.0d04
vimboss
parents: 274
diff changeset
266 "endf
dc8197342755 updated for version 7.0d04
vimboss
parents: 274
diff changeset
267
dc8197342755 updated for version 7.0d04
vimboss
parents: 274
diff changeset
268 "this is slow for computing folds, but it does so accurately
dc8197342755 updated for version 7.0d04
vimboss
parents: 274
diff changeset
269 syntax sync fromstart
dc8197342755 updated for version 7.0d04
vimboss
parents: 274
diff changeset
270
dc8197342755 updated for version 7.0d04
vimboss
parents: 274
diff changeset
271 " but this seems to do alright for non fold syntax coloring.
dc8197342755 updated for version 7.0d04
vimboss
parents: 274
diff changeset
272 " for folding, however, it doesn't get the nesting right.
dc8197342755 updated for version 7.0d04
vimboss
parents: 274
diff changeset
273 " TODO - find sync group for multiline modules? ick...
dc8197342755 updated for version 7.0d04
vimboss
parents: 274
diff changeset
274
dc8197342755 updated for version 7.0d04
vimboss
parents: 274
diff changeset
275 " sync multi line comments
dc8197342755 updated for version 7.0d04
vimboss
parents: 274
diff changeset
276 "syntax sync match syncComments groupthere NONE "\*)"
dc8197342755 updated for version 7.0d04
vimboss
parents: 274
diff changeset
277 "syntax sync match syncComments groupthere mmaComment "(\*"
dc8197342755 updated for version 7.0d04
vimboss
parents: 274
diff changeset
278
271
8d34af900bae updated for version 7.0072
vimboss
parents: 7
diff changeset
279 "set foldmethod=syntax
829
dc8197342755 updated for version 7.0d04
vimboss
parents: 274
diff changeset
280 "set foldnestmax=1
dc8197342755 updated for version 7.0d04
vimboss
parents: 274
diff changeset
281 "set foldminlines=15
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
282
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
283 if version >= 508 || !exists("did_mma_syn_inits")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
284 if version < 508
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
285 let did_mma_syn_inits = 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
286 command -nargs=+ HiLink hi link <args>
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
287 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
288 command -nargs=+ HiLink hi def link <args>
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
289 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
290
271
8d34af900bae updated for version 7.0072
vimboss
parents: 7
diff changeset
291 " NOTE - the following links are not guaranteed to
8d34af900bae updated for version 7.0072
vimboss
parents: 7
diff changeset
292 " look good under all colorschemes. You might need to
8d34af900bae updated for version 7.0072
vimboss
parents: 7
diff changeset
293 " :so $VIMRUNTIME/syntax/hitest.vim and tweak these to
8d34af900bae updated for version 7.0072
vimboss
parents: 7
diff changeset
294 " look good in yours
8d34af900bae updated for version 7.0072
vimboss
parents: 7
diff changeset
295
829
dc8197342755 updated for version 7.0d04
vimboss
parents: 274
diff changeset
296
271
8d34af900bae updated for version 7.0072
vimboss
parents: 7
diff changeset
297 HiLink mmaComment Comment
8d34af900bae updated for version 7.0072
vimboss
parents: 7
diff changeset
298 HiLink mmaCommentStar Comment
8d34af900bae updated for version 7.0072
vimboss
parents: 7
diff changeset
299 HiLink mmaFunctionComment Comment
8d34af900bae updated for version 7.0072
vimboss
parents: 7
diff changeset
300 HiLink mmaLooseQuote Comment
8d34af900bae updated for version 7.0072
vimboss
parents: 7
diff changeset
301 HiLink mmaGenericFunction Function
274
8fa8d7964cf1 updated for version 7.0073
vimboss
parents: 271
diff changeset
302 HiLink mmaVariable Identifier
829
dc8197342755 updated for version 7.0d04
vimboss
parents: 274
diff changeset
303 " HiLink mmaSymbol Identifier
271
8d34af900bae updated for version 7.0072
vimboss
parents: 7
diff changeset
304 HiLink mmaOperator Operator
8d34af900bae updated for version 7.0072
vimboss
parents: 7
diff changeset
305 HiLink mmaPatternOp Operator
8d34af900bae updated for version 7.0072
vimboss
parents: 7
diff changeset
306 HiLink mmaPureFunction Operator
8d34af900bae updated for version 7.0072
vimboss
parents: 7
diff changeset
307 HiLink mmaString String
8d34af900bae updated for version 7.0072
vimboss
parents: 7
diff changeset
308 HiLink mmaCommentString String
8d34af900bae updated for version 7.0072
vimboss
parents: 7
diff changeset
309 HiLink mmaUnicode String
8d34af900bae updated for version 7.0072
vimboss
parents: 7
diff changeset
310 HiLink mmaMessage Type
8d34af900bae updated for version 7.0072
vimboss
parents: 7
diff changeset
311 HiLink mmaNumber Type
8d34af900bae updated for version 7.0072
vimboss
parents: 7
diff changeset
312 HiLink mmaPattern Type
8d34af900bae updated for version 7.0072
vimboss
parents: 7
diff changeset
313 HiLink mmaError Error
8d34af900bae updated for version 7.0072
vimboss
parents: 7
diff changeset
314 HiLink mmaFixme Error
8d34af900bae updated for version 7.0072
vimboss
parents: 7
diff changeset
315 HiLink mmaPatternError Error
8d34af900bae updated for version 7.0072
vimboss
parents: 7
diff changeset
316 HiLink mmaTodo Todo
8d34af900bae updated for version 7.0072
vimboss
parents: 7
diff changeset
317 HiLink mmaemPHAsis Special
8d34af900bae updated for version 7.0072
vimboss
parents: 7
diff changeset
318 HiLink mmaFunctionTitle Special
829
dc8197342755 updated for version 7.0d04
vimboss
parents: 274
diff changeset
319 HiLink mmaMessageType Special
271
8d34af900bae updated for version 7.0072
vimboss
parents: 7
diff changeset
320 HiLink mmaItem Preproc
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
321
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
322 delcommand HiLink
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
323 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
324
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
325 let b:current_syntax = "mma"