annotate runtime/syntax/mma.vim @ 17381:8f44c630c366 v8.1.1689

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