on master help sign in
Add MATLAB syntax test file
be84682Stefano Probst
tests/syntax-tests/highlighted/MATLAB/test.matlabnew file+34
@@ -0,0 +1,34 @@
1+function zz=sample(aa)
2+%%%%%%%%%%%%%%%%%%
3+% some comments
4+%%%%%%%%%%%%%%%%%%
5+
6+x = 'a string'; % some 'ticks' in a comment
7+y = 'a string with ''interal'' quotes';
8+
9+for i=1:20
10+ disp(i);
11+end
12+
13+a = rand(30);
14+b = rand(30);
15+
16+c = a .* b ./ a \ ... comment at end of line and continuation
17+ (b .* a + b - a);
18+
19+c = a' * b'; % note: these ticks are for transpose, not quotes.
20+
21+disp('a comment symbol, %, in a string');
22+
23+!echo abc % this isn't a comment - it's passed to system command
24+
25+function y=myfunc(x)
26+y = exp(x);
27+
28+%{
29+ a block comment
30+%}
31+
32+function no_arg_func
33+fprintf('%s\n', 'function with no args')
34+end
tests/syntax-tests/source/MATLAB/LICENSE.mdnew file+27
@@ -0,0 +1,27 @@
1+The `test.matlab` file is a modified version of https://github.com/pygments/pygments/blob/3e1b79c82d2df318f63f24984d875fd2a3400808/tests/test_matlab.py under the following license:
2+
3+Copyright (c) 2006-2020 by the respective authors (see AUTHORS file).
4+All rights reserved.
5+
6+Redistribution and use in source and binary forms, with or without
7+modification, are permitted provided that the following conditions are
8+met:
9+
10+* Redistributions of source code must retain the above copyright
11+ notice, this list of conditions and the following disclaimer.
12+
13+* Redistributions in binary form must reproduce the above copyright
14+ notice, this list of conditions and the following disclaimer in the
15+ documentation and/or other materials provided with the distribution.
16+
17+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
18+"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
19+LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
20+A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
21+OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
22+SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
23+LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
24+DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
25+THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
27+OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
tests/syntax-tests/source/MATLAB/test.matlabnew file+34
@@ -0,0 +1,34 @@
1+function zz=sample(aa)
2+%%%%%%%%%%%%%%%%%%
3+% some comments
4+%%%%%%%%%%%%%%%%%%
5+
6+x = 'a string'; % some 'ticks' in a comment
7+y = 'a string with ''interal'' quotes';
8+
9+for i=1:20
10+ disp(i);
11+end
12+
13+a = rand(30);
14+b = rand(30);
15+
16+c = a .* b ./ a \ ... comment at end of line and continuation
17+ (b .* a + b - a);
18+
19+c = a' * b'; % note: these ticks are for transpose, not quotes.
20+
21+disp('a comment symbol, %, in a string');
22+
23+!echo abc % this isn't a comment - it's passed to system command
24+
25+function y=myfunc(x)
26+y = exp(x);
27+
28+%{
29+ a block comment
30+%}
31+
32+function no_arg_func
33+fprintf('%s\n', 'function with no args')
34+end