play around with Scintilla and Lexilla

This commit is contained in:
2024-07-02 23:47:26 +08:00
parent d7c71f41b2
commit 727a2ec214
992 changed files with 281111 additions and 195 deletions

View File

@ -0,0 +1,44 @@
% Examples of each style 0..8 except for SCE_MATLAB_COMMAND(2) which has a line ending bug
% White space=0
%
% Comment=1
% Line comment
% Next line is comment in Ocatve but not Matlab
# Octave comment
%{
Block comment.
%}
% Command=2
%{
Omitted as this places a style transiton between \r and \n
!rmdir oldtests
%}
% Number=3
33.3
% Keyword=4
global x
% Single Quoted String=5
'string'
% Operator=6
[X,Y] = meshgrid(-10:0.25:10,-10:0.25:10);
% Identifier=7
identifier = 2
% Double Quoted String=8
"string"
% This loop should fold
for i = 1:5
x(i) = 3 * i;
end

View File

@ -0,0 +1,45 @@
0 400 400 % Examples of each style 0..8 except for SCE_MATLAB_COMMAND(2) which has a line ending bug
1 400 400
0 400 400 % White space=0
0 400 400 %
1 400 400
0 400 400 % Comment=1
0 400 400 % Line comment
1 400 400
0 400 400 % Next line is comment in Ocatve but not Matlab
0 400 400 # Octave comment
1 400 400
0 400 400 %{
0 400 400 Block comment.
0 400 400 %}
1 400 400
0 400 400 % Command=2
1 400 400
0 400 400 %{
0 400 400 Omitted as this places a style transiton between \r and \n
0 400 400 !rmdir oldtests
0 400 400 %}
1 400 400
0 400 400 % Number=3
0 400 400 33.3
1 400 400
0 400 400 % Keyword=4
0 400 400 global x
1 400 400
0 400 400 % Single Quoted String=5
0 400 400 'string'
1 400 400
0 400 400 % Operator=6
0 400 400 [X,Y] = meshgrid(-10:0.25:10,-10:0.25:10);
1 400 400
0 400 400 % Identifier=7
0 400 400 identifier = 2
1 400 400
0 400 400 % Double Quoted String=8
0 400 400 "string"
1 400 400
0 400 400 % This loop should fold
2 400 401 + for i = 1:5
0 401 401 | x(i) = 3 * i;
0 401 400 | end
1 400 400

View File

@ -0,0 +1,44 @@
{1}% Examples of each style 0..8 except for SCE_MATLAB_COMMAND(2) which has a line ending bug{0}
{1}% White space=0{0}
{1}%{0}
{1}% Comment=1{0}
{1}% Line comment{0}
{1}% Next line is comment in Ocatve but not Matlab{0}
# {7}Octave{0} {7}comment{0}
{1}%{
Block comment.
%}{0}
{1}% Command=2{0}
{1}%{
Omitted as this places a style transiton between \r and \n
!rmdir oldtests
%}{0}
{1}% Number=3{0}
{3}33.3{0}
{1}% Keyword=4{0}
{4}global{0} {7}x{0}
{1}% Single Quoted String=5{0}
{5}'string'{0}
{1}% Operator=6{0}
{6}[{7}X{6},{7}Y{6}]{0} {6}={0} {7}meshgrid{6}(-{3}10{6}:{3}0.25{6}:{3}10{6},-{3}10{6}:{3}0.25{6}:{3}10{6});{0}
{1}% Identifier=7{0}
{7}identifier{0} {6}={0} {3}2{0}
{1}% Double Quoted String=8{0}
{8}"string"{0}
{1}% This loop should fold{0}
{4}for{0} {7}i{0} {6}={0} {3}1{6}:{3}5{0}
{7}x{6}({7}i{6}){0} {6}={0} {3}3{0} {6}*{0} {7}i{6};{0}
{4}end{0}

View File

@ -0,0 +1,44 @@
% Examples of each style 0..8 except for SCE_MATLAB_COMMAND(2) which has a line ending bug
% White space=0
%
% Comment=1
% Line comment
% Next line is comment in Ocatve but not Matlab
# Octave comment
%{
Block comment.
%}
% Command=2
%{
Omitted as this places a style transiton between \r and \n
!rmdir oldtests
%}
% Number=3
33.3
% Keyword=4
global x
% Single Quoted String=5
'string'
% Operator=6
[X,Y] = meshgrid(-10:0.25:10,-10:0.25:10);
% Identifier=7
identifier = 2
% Double Quoted String=8
"string"
% This loop should fold
for i = 1:5
x(i) = 3 * i;
end

View File

@ -0,0 +1,45 @@
0 400 400 % Examples of each style 0..8 except for SCE_MATLAB_COMMAND(2) which has a line ending bug
1 400 400
0 400 400 % White space=0
0 400 400 %
1 400 400
0 400 400 % Comment=1
0 400 400 % Line comment
1 400 400
0 400 400 % Next line is comment in Ocatve but not Matlab
0 400 400 # Octave comment
1 400 400
0 400 400 %{
0 400 400 Block comment.
0 400 400 %}
1 400 400
0 400 400 % Command=2
1 400 400
0 400 400 %{
0 400 400 Omitted as this places a style transiton between \r and \n
0 400 400 !rmdir oldtests
0 400 400 %}
1 400 400
0 400 400 % Number=3
0 400 400 33.3
1 400 400
0 400 400 % Keyword=4
0 400 400 global x
1 400 400
0 400 400 % Single Quoted String=5
0 400 400 'string'
1 400 400
0 400 400 % Operator=6
0 400 400 [X,Y] = meshgrid(-10:0.25:10,-10:0.25:10);
1 400 400
0 400 400 % Identifier=7
0 400 400 identifier = 2
1 400 400
0 400 400 % Double Quoted String=8
0 400 400 "string"
1 400 400
0 400 400 % This loop should fold
2 400 401 + for i = 1:5
0 401 401 | x(i) = 3 * i;
0 401 400 | end
1 400 400

View File

@ -0,0 +1,44 @@
{1}% Examples of each style 0..8 except for SCE_MATLAB_COMMAND(2) which has a line ending bug{0}
{1}% White space=0{0}
{1}%{0}
{1}% Comment=1{0}
{1}% Line comment{0}
{1}% Next line is comment in Ocatve but not Matlab{0}
{1}# Octave comment{0}
{1}%{
Block comment.
%}{0}
{1}% Command=2{0}
{1}%{
Omitted as this places a style transiton between \r and \n
!rmdir oldtests
%}{0}
{1}% Number=3{0}
{3}33.3{0}
{1}% Keyword=4{0}
{4}global{0} {7}x{0}
{1}% Single Quoted String=5{0}
{5}'string'{0}
{1}% Operator=6{0}
{6}[{7}X{6},{7}Y{6}]{0} {6}={0} {7}meshgrid{6}(-{3}10{6}:{3}0.25{6}:{3}10{6},-{3}10{6}:{3}0.25{6}:{3}10{6});{0}
{1}% Identifier=7{0}
{7}identifier{0} {6}={0} {3}2{0}
{1}% Double Quoted String=8{0}
{8}"string"{0}
{1}% This loop should fold{0}
{4}for{0} {7}i{0} {6}={0} {3}1{6}:{3}5{0}
{7}x{6}({7}i{6}){0} {6}={0} {3}3{0} {6}*{0} {7}i{6};{0}
{4}end{0}

View File

@ -0,0 +1,137 @@
%% Correctly defined arguments block
function y = foo (x)
% Some comment here
% And, maybe, here
arguments
x (1,2) {mustBeReal(x)}
end
y = x*2;
arguments = 1;
y = y + arguments;
end
%% No arguments block, "arguments" is used
% as a variable name (identifier)
% Prevent arguments from folding with an identifier
function y = foo (x)
% Some comment here
x = x + 1;
arguments = 10;
y = x + arguments;
end
% Prevent arguments from folding with a number
function y = foo (x)
4
arguments = 10;
y = x + arguments;
end
% With a double quote string
function y = foo (x)
"test"
arguments = 10;
y = x + arguments;
end
% With a string
function y = foo (x)
'test'
arguments = 10;
y = x + arguments;
end
% With a keyword
function y = foo (x)
if x == 0;
return 0;
end
arguments = 10;
y = x + arguments;
end
% With an operator (illegal syntax)
function y = foo (x)
*
arguments = 10;
y = x + arguments;
end
% Semicolon is equivalent to a comment
function y = foo(x)
;;;;;;;
arguments
x
end
y = x + 2;
end
% Arguments block is illegal in nested functions,
% but lexer should process it anyway
function y = foo (x)
arguments
x (1,2) {mustBeReal(x)}
end
function y = foo (x)
arguments
x (1,2) {mustBeReal(x)}
end
var = 0;
arguments = 5;
y = arguments + x;
end
% Use as a variable, just in case
arguments = 10;
end
% Erroneous use of arguments block
function y = foo(x)
% Some comment
x = x + 1;
arguments
x
end
y = x;
end
% "arguments" is an argument name too
function r = foo(x, arguments)
arguments
x
arguments
end
r = bar(x, arguments{:});
end
% Multiple arguments blocks
function [a, b] = foo(x, y, varargin)
arguments(Input)
x (1,4) {mustBeReal}
y (1,:) {mustBeInteger} = x(2:end);
end
arguments(Input, Repeating)
varargin
end
arguments(Output)
a (1,1) {mustBeReal}
b (1,1) {mustBeNonNegative}
end
var = 10;
arguments = {"now", "it's", "variable"};
[a, b] = bar(x, y, arguments);
end
% One line function with arguments block.
% This code style is rarely used (if at all), but the
% lexer shouldn't break
function y = foo(x); arguments; x; end; y = bar(x); end

View File

@ -0,0 +1,138 @@
0 400 400 %% Correctly defined arguments block
2 400 401 + function y = foo (x)
0 401 401 | % Some comment here
0 401 401 | % And, maybe, here
1 401 401 |
2 401 402 + arguments
0 402 402 | x (1,2) {mustBeReal(x)}
0 402 401 | end
1 401 401 |
0 401 401 | y = x*2;
0 401 401 | arguments = 1;
0 401 401 | y = y + arguments;
0 401 400 | end
1 400 400
0 400 400 %% No arguments block, "arguments" is used
0 400 400 % as a variable name (identifier)
0 400 400 % Prevent arguments from folding with an identifier
2 400 401 + function y = foo (x)
0 401 401 | % Some comment here
0 401 401 | x = x + 1;
0 401 401 | arguments = 10;
0 401 401 | y = x + arguments;
0 401 400 | end
1 400 400
0 400 400 % Prevent arguments from folding with a number
2 400 401 + function y = foo (x)
0 401 401 | 4
0 401 401 | arguments = 10;
0 401 401 | y = x + arguments;
0 401 400 | end
1 400 400
0 400 400 % With a double quote string
2 400 401 + function y = foo (x)
0 401 401 | "test"
0 401 401 | arguments = 10;
0 401 401 | y = x + arguments;
0 401 400 | end
1 400 400
0 400 400 % With a string
2 400 401 + function y = foo (x)
0 401 401 | 'test'
0 401 401 | arguments = 10;
0 401 401 | y = x + arguments;
0 401 400 | end
1 400 400
0 400 400 % With a keyword
2 400 401 + function y = foo (x)
2 401 402 + if x == 0;
0 402 402 | return 0;
0 402 401 | end
0 401 401 | arguments = 10;
0 401 401 | y = x + arguments;
0 401 400 | end
1 400 400
0 400 400 % With an operator (illegal syntax)
2 400 401 + function y = foo (x)
0 401 401 | *
0 401 401 | arguments = 10;
0 401 401 | y = x + arguments;
0 401 400 | end
1 400 400
0 400 400 % Semicolon is equivalent to a comment
2 400 401 + function y = foo(x)
0 401 401 | ;;;;;;;
2 401 402 + arguments
0 402 402 | x
0 402 401 | end
0 401 401 | y = x + 2;
0 401 400 | end
1 400 400
0 400 400 % Arguments block is illegal in nested functions,
0 400 400 % but lexer should process it anyway
2 400 401 + function y = foo (x)
2 401 402 + arguments
0 402 402 | x (1,2) {mustBeReal(x)}
0 402 401 | end
1 401 401 |
2 401 402 + function y = foo (x)
2 402 403 + arguments
0 403 403 | x (1,2) {mustBeReal(x)}
0 403 402 | end
0 402 402 | var = 0;
0 402 402 | arguments = 5;
0 402 402 | y = arguments + x;
0 402 401 | end
1 401 401 |
0 401 401 | % Use as a variable, just in case
0 401 401 | arguments = 10;
0 401 400 | end
1 400 400
0 400 400 % Erroneous use of arguments block
2 400 401 + function y = foo(x)
0 401 401 | % Some comment
0 401 401 | x = x + 1;
0 401 401 | arguments
0 401 401 | x
0 401 400 | end
0 400 400 y = x;
0 400 3ff end
1 3ff 3ff
0 3ff 3ff % "arguments" is an argument name too
2 3ff 400 + function r = foo(x, arguments)
2 400 401 + arguments
0 401 401 | x
0 401 401 | arguments
0 401 400 | end
0 400 400 r = bar(x, arguments{:});
0 400 3ff end
1 3ff 3ff
0 3ff 3ff % Multiple arguments blocks
2 3ff 400 + function [a, b] = foo(x, y, varargin)
1 400 400
2 400 401 + arguments(Input)
0 401 401 | x (1,4) {mustBeReal}
0 401 401 | y (1,:) {mustBeInteger} = x(2:end);
0 401 400 | end
1 400 400
2 400 401 + arguments(Input, Repeating)
0 401 401 | varargin
0 401 400 | end
1 400 400
2 400 401 + arguments(Output)
0 401 401 | a (1,1) {mustBeReal}
0 401 401 | b (1,1) {mustBeNonNegative}
0 401 400 | end
1 400 400
0 400 400 var = 10;
0 400 400 arguments = {"now", "it's", "variable"};
1 400 400
0 400 400 [a, b] = bar(x, y, arguments);
1 400 400
0 400 3ff end
1 3ff 3ff
0 3ff 3ff % One line function with arguments block.
0 3ff 3ff % This code style is rarely used (if at all), but the
0 3ff 3ff % lexer shouldn't break
0 3ff 3ff function y = foo(x); arguments; x; end; y = bar(x); end
1 3ff 3ff

View File

@ -0,0 +1,137 @@
{1}%% Correctly defined arguments block{0}
{4}function{0} {7}y{0} {6}={0} {7}foo{0} {6}({7}x{6}){0}
{1}% Some comment here{0}
{1}% And, maybe, here{0}
{4}arguments{0}
{7}x{0} {6}({3}1{6},{3}2{6}){0} {6}{{7}mustBeReal{6}({7}x{6})}{0}
{4}end{0}
{7}y{0} {6}={0} {7}x{6}*{3}2{6};{0}
{7}arguments{0} {6}={0} {3}1{6};{0}
{7}y{0} {6}={0} {7}y{0} {6}+{0} {7}arguments{6};{0}
{4}end{0}
{1}%% No arguments block, "arguments" is used {0}
{1}% as a variable name (identifier){0}
{1}% Prevent arguments from folding with an identifier{0}
{4}function{0} {7}y{0} {6}={0} {7}foo{0} {6}({7}x{6}){0}
{1}% Some comment here{0}
{7}x{0} {6}={0} {7}x{0} {6}+{0} {3}1{6};{0}
{7}arguments{0} {6}={0} {3}10{6};{0}
{7}y{0} {6}={0} {7}x{0} {6}+{0} {7}arguments{6};{0}
{4}end{0}
{1}% Prevent arguments from folding with a number{0}
{4}function{0} {7}y{0} {6}={0} {7}foo{0} {6}({7}x{6}){0}
{3}4{0}
{7}arguments{0} {6}={0} {3}10{6};{0}
{7}y{0} {6}={0} {7}x{0} {6}+{0} {7}arguments{6};{0}
{4}end{0}
{1}% With a double quote string{0}
{4}function{0} {7}y{0} {6}={0} {7}foo{0} {6}({7}x{6}){0}
{8}"test"{0}
{7}arguments{0} {6}={0} {3}10{6};{0}
{7}y{0} {6}={0} {7}x{0} {6}+{0} {7}arguments{6};{0}
{4}end{0}
{1}% With a string{0}
{4}function{0} {7}y{0} {6}={0} {7}foo{0} {6}({7}x{6}){0}
{5}'test'{0}
{7}arguments{0} {6}={0} {3}10{6};{0}
{7}y{0} {6}={0} {7}x{0} {6}+{0} {7}arguments{6};{0}
{4}end{0}
{1}% With a keyword{0}
{4}function{0} {7}y{0} {6}={0} {7}foo{0} {6}({7}x{6}){0}
{4}if{0} {7}x{0} {6}=={0} {3}0{6};{0}
{4}return{0} {3}0{6};{0}
{4}end{0}
{7}arguments{0} {6}={0} {3}10{6};{0}
{7}y{0} {6}={0} {7}x{0} {6}+{0} {7}arguments{6};{0}
{4}end{0}
{1}% With an operator (illegal syntax){0}
{4}function{0} {7}y{0} {6}={0} {7}foo{0} {6}({7}x{6}){0}
{6}*{0}
{7}arguments{0} {6}={0} {3}10{6};{0}
{7}y{0} {6}={0} {7}x{0} {6}+{0} {7}arguments{6};{0}
{4}end{0}
{1}% Semicolon is equivalent to a comment{0}
{4}function{0} {7}y{0} {6}={0} {7}foo{6}({7}x{6}){0}
{6};;;;;;;{0}
{4}arguments{0}
{7}x{0}
{4}end{0}
{7}y{0} {6}={0} {7}x{0} {6}+{0} {3}2{6};{0}
{4}end{0}
{1}% Arguments block is illegal in nested functions,{0}
{1}% but lexer should process it anyway{0}
{4}function{0} {7}y{0} {6}={0} {7}foo{0} {6}({7}x{6}){0}
{4}arguments{0}
{7}x{0} {6}({3}1{6},{3}2{6}){0} {6}{{7}mustBeReal{6}({7}x{6})}{0}
{4}end{0}
{4}function{0} {7}y{0} {6}={0} {7}foo{0} {6}({7}x{6}){0}
{4}arguments{0}
{7}x{0} {6}({3}1{6},{3}2{6}){0} {6}{{7}mustBeReal{6}({7}x{6})}{0}
{4}end{0}
{7}var{0} {6}={0} {3}0{6};{0}
{7}arguments{0} {6}={0} {3}5{6};{0}
{7}y{0} {6}={0} {7}arguments{0} {6}+{0} {7}x{6};{0}
{4}end{0}
{1}% Use as a variable, just in case{0}
{7}arguments{0} {6}={0} {3}10{6};{0}
{4}end{0}
{1}% Erroneous use of arguments block{0}
{4}function{0} {7}y{0} {6}={0} {7}foo{6}({7}x{6}){0}
{1}% Some comment{0}
{7}x{0} {6}={0} {7}x{0} {6}+{0} {3}1{6};{0}
{7}arguments{0}
{7}x{0}
{4}end{0}
{7}y{0} {6}={0} {7}x{6};{0}
{4}end{0}
{1}% "arguments" is an argument name too{0}
{4}function{0} {7}r{0} {6}={0} {7}foo{6}({7}x{6},{0} {7}arguments{6}){0}
{4}arguments{0}
{7}x{0}
{7}arguments{0}
{4}end{0}
{7}r{0} {6}={0} {7}bar{6}({7}x{6},{0} {7}arguments{6}{:});{0}
{4}end{0}
{1}% Multiple arguments blocks{0}
{4}function{0} {6}[{7}a{6},{0} {7}b{6}]{0} {6}={0} {7}foo{6}({7}x{6},{0} {7}y{6},{0} {7}varargin{6}){0}
{4}arguments{6}({7}Input{6}){0}
{7}x{0} {6}({3}1{6},{3}4{6}){0} {6}{{7}mustBeReal{6}}{0}
{7}y{0} {6}({3}1{6},:){0} {6}{{7}mustBeInteger{6}}{0} {6}={0} {7}x{6}({3}2{6}:{3}end{6});{0}
{4}end{0}
{4}arguments{6}({7}Input{6},{0} {7}Repeating{6}){0}
{7}varargin{0}
{4}end{0}
{4}arguments{6}({7}Output{6}){0}
{7}a{0} {6}({3}1{6},{3}1{6}){0} {6}{{7}mustBeReal{6}}{0}
{7}b{0} {6}({3}1{6},{3}1{6}){0} {6}{{7}mustBeNonNegative{6}}{0}
{4}end{0}
{7}var{0} {6}={0} {3}10{6};{0}
{7}arguments{0} {6}={0} {6}{{8}"now"{6},{0} {8}"it's"{6},{0} {8}"variable"{6}};{0}
{6}[{7}a{6},{0} {7}b{6}]{0} {6}={0} {7}bar{6}({7}x{6},{0} {7}y{6},{0} {7}arguments{6});{0}
{4}end{0}
{1}% One line function with arguments block.{0}
{1}% This code style is rarely used (if at all), but the{0}
{1}% lexer shouldn't break{0}
{4}function{0} {7}y{0} {6}={0} {7}foo{6}({7}x{6});{0} {4}arguments{6};{0} {7}x{6};{0} {4}end{6};{0} {7}y{0} {6}={0} {7}bar{6}({7}x{6});{0} {4}end{0}

View File

@ -0,0 +1,74 @@
classdef Foo < handle
% A couple of properties blocks
properties (SetAccess = private)
Var1
Var2
end
properties
Var3
Var4
end
methods (Static)
function y = f1(x)
% events, properties and methods are the valid idenifiers
% in the function scope
events = 1;
properties = 2;
y = x + events * properties;
end
% Any of these words are also valid functions' names inside
% methods block
function y = events(x)
arguments
x {mustBeNegative}
end
y = f2(x)*100;
function b = f2(a)
b = a + 5;
end
end
end
% Example events block
events
Event1
Event2
end
end
% Now, let's break some stuff
classdef Bar
properties
% Though MATLAB won't execute such a code, events, properties
% and methods are keywords here, because we're still in the class scope
events
end
methods
end
end
% Not allowed in MATLAB, but, technically, we're still in the class scope
if condition1
if condition2
% Though we're in the class scope, lexel will recognize no
% keywords here: to avoid the neccessaty to track nested scopes,
% it just considers everything beyond level 2 of folding to be
% a function scope
methods
events
properties
end
end
end

View File

@ -0,0 +1,75 @@
2 400 401 + classdef Foo < handle
1 401 401 |
0 401 401 | % A couple of properties blocks
2 401 402 + properties (SetAccess = private)
0 402 402 | Var1
0 402 402 | Var2
0 402 401 | end
1 401 401 |
2 401 402 + properties
0 402 402 | Var3
0 402 402 | Var4
0 402 401 | end
1 401 401 |
2 401 402 + methods (Static)
2 402 403 + function y = f1(x)
0 403 403 | % events, properties and methods are the valid idenifiers
0 403 403 | % in the function scope
0 403 403 | events = 1;
0 403 403 | properties = 2;
0 403 403 | y = x + events * properties;
0 403 402 | end
1 402 402 |
0 402 402 | % Any of these words are also valid functions' names inside
0 402 402 | % methods block
2 402 403 + function y = events(x)
1 403 403 |
2 403 404 + arguments
0 404 404 | x {mustBeNegative}
0 404 403 | end
1 403 403 |
0 403 403 | y = f2(x)*100;
2 403 404 + function b = f2(a)
0 404 404 | b = a + 5;
0 404 403 | end
0 403 402 | end
0 402 401 | end
1 401 401 |
0 401 401 | % Example events block
2 401 402 + events
0 402 402 | Event1
0 402 402 | Event2
0 402 401 | end
0 401 400 | end
1 400 400
1 400 400
0 400 400 % Now, let's break some stuff
2 400 401 + classdef Bar
1 401 401 |
2 401 402 + properties
0 402 402 | % Though MATLAB won't execute such a code, events, properties
0 402 402 | % and methods are keywords here, because we're still in the class scope
2 402 403 + events
0 403 402 | end
1 402 402 |
2 402 403 + methods
0 403 402 | end
0 402 401 | end
1 401 401 |
0 401 401 | % Not allowed in MATLAB, but, technically, we're still in the class scope
2 401 402 + if condition1
2 402 403 + if condition2
0 403 403 | % Though we're in the class scope, lexel will recognize no
0 403 403 | % keywords here: to avoid the neccessaty to track nested scopes,
0 403 403 | % it just considers everything beyond level 2 of folding to be
0 403 403 | % a function scope
0 403 403 | methods
0 403 403 | events
0 403 403 | properties
0 403 402 | end
0 402 401 | end
1 401 401 |
1 401 401 |
0 401 400 | end
1 400 400
1 400 400

View File

@ -0,0 +1,74 @@
{4}classdef{0} {7}Foo{0} {6}<{0} {7}handle{0}
{1}% A couple of properties blocks{0}
{4}properties{0} {6}({7}SetAccess{0} {6}={0} {7}private{6}){0}
{7}Var1{0}
{7}Var2{0}
{4}end{0}
{4}properties{0}
{7}Var3{0}
{7}Var4{0}
{4}end{0}
{4}methods{0} {6}({7}Static{6}){0}
{4}function{0} {7}y{0} {6}={0} {7}f1{6}({7}x{6}){0}
{1}% events, properties and methods are the valid idenifiers{0}
{1}% in the function scope{0}
{7}events{0} {6}={0} {3}1{6};{0}
{7}properties{0} {6}={0} {3}2{6};{0}
{7}y{0} {6}={0} {7}x{0} {6}+{0} {7}events{0} {6}*{0} {7}properties{6};{0}
{4}end{0}
{1}% Any of these words are also valid functions' names inside{0}
{1}% methods block{0}
{4}function{0} {7}y{0} {6}={0} {7}events{6}({7}x{6}){0}
{4}arguments{0}
{7}x{0} {6}{{7}mustBeNegative{6}}{0}
{4}end{0}
{7}y{0} {6}={0} {7}f2{6}({7}x{6})*{3}100{6};{0}
{4}function{0} {7}b{0} {6}={0} {7}f2{6}({7}a{6}){0}
{7}b{0} {6}={0} {7}a{0} {6}+{0} {3}5{6};{0}
{4}end{0}
{4}end{0}
{4}end{0}
{1}% Example events block{0}
{4}events{0}
{7}Event1{0}
{7}Event2{0}
{4}end{0}
{4}end{0}
{1}% Now, let's break some stuff{0}
{4}classdef{0} {7}Bar{0}
{4}properties{0}
{1}% Though MATLAB won't execute such a code, events, properties{0}
{1}% and methods are keywords here, because we're still in the class scope{0}
{4}events{0}
{4}end{0}
{4}methods{0}
{4}end{0}
{4}end{0}
{1}% Not allowed in MATLAB, but, technically, we're still in the class scope{0}
{4}if{0} {7}condition1{0}
{4}if{0} {7}condition2{0}
{1}% Though we're in the class scope, lexel will recognize no{0}
{1}% keywords here: to avoid the neccessaty to track nested scopes,{0}
{1}% it just considers everything beyond level 2 of folding to be{0}
{1}% a function scope{0}
{7}methods{0}
{7}events{0}
{7}properties{0}
{4}end{0}
{4}end{0}
{4}end{0}

View File

@ -0,0 +1,48 @@
% All the examples here should yield folding
classdef
% Some code
end
for
% Some code
end
function
% Some code
end
if
% Some code
elseif
% Some code
else
% Some code
end
parfor
% Some code
end
spmd
% Some code
end
switch
case
% Some code
case
% Some code
otherwise
% Some code
end
try
% Some code
catch
% Some code
end
while
% Some code
end

View File

@ -0,0 +1,49 @@
0 400 400 % All the examples here should yield folding
1 400 400
2 400 401 + classdef
0 401 401 | % Some code
0 401 400 | end
1 400 400
2 400 401 + for
0 401 401 | % Some code
0 401 400 | end
1 400 400
2 400 401 + function
0 401 401 | % Some code
0 401 400 | end
1 400 400
2 400 401 + if
0 401 401 | % Some code
0 401 401 | elseif
0 401 401 | % Some code
0 401 401 | else
0 401 401 | % Some code
0 401 400 | end
1 400 400
2 400 401 + parfor
0 401 401 | % Some code
0 401 400 | end
1 400 400
2 400 401 + spmd
0 401 401 | % Some code
0 401 400 | end
1 400 400
2 400 401 + switch
0 401 401 | case
0 401 401 | % Some code
0 401 401 | case
0 401 401 | % Some code
0 401 401 | otherwise
0 401 401 | % Some code
0 401 400 | end
1 400 400
2 400 401 + try
0 401 401 | % Some code
0 401 401 | catch
0 401 401 | % Some code
0 401 400 | end
1 400 400
2 400 401 + while
0 401 401 | % Some code
0 401 400 | end
1 400 400

View File

@ -0,0 +1,48 @@
{1}% All the examples here should yield folding{0}
{4}classdef{0}
{1}% Some code{0}
{4}end{0}
{4}for{0}
{1}% Some code{0}
{4}end{0}
{4}function{0}
{1}% Some code{0}
{4}end{0}
{4}if{0}
{1}% Some code{0}
{4}elseif{0}
{1}% Some code{0}
{4}else{0}
{1}% Some code{0}
{4}end{0}
{4}parfor{0}
{1}% Some code{0}
{4}end{0}
{4}spmd{0}
{1}% Some code{0}
{4}end{0}
{4}switch{0}
{4}case{0}
{1}% Some code{0}
{4}case{0}
{1}% Some code{0}
{4}otherwise{0}
{1}% Some code{0}
{4}end{0}
{4}try{0}
{1}% Some code{0}
{4}catch{0}
{1}% Some code{0}
{4}end{0}
{4}while{0}
{1}% Some code{0}
{4}end{0}

View File

@ -0,0 +1,21 @@
a="""";
b=1;
c='\';
d=2;
e="\";
f=3;
%" this should be a comment (colored as such), instead it closes the string
g="
h=123;
%" this is a syntax error in Matlab (about 'g'),
% followed by a valid assignment (of 'h')
% Instead, 'h' is colored as part of the string
% Octave terminates string at 3rd ", Matlab at 4th
i="\" "; % " %
% Matlab (unlike Octave) does not allow string continuation with an escape
b = "multi\
line"
% end

View File

@ -0,0 +1,22 @@
0 400 400 a="""";
0 400 400 b=1;
0 400 400 c='\';
0 400 400 d=2;
0 400 400 e="\";
0 400 400 f=3;
0 400 400 %" this should be a comment (colored as such), instead it closes the string
0 400 400 g="
0 400 400 h=123;
0 400 400 %" this is a syntax error in Matlab (about 'g'),
0 400 400 % followed by a valid assignment (of 'h')
0 400 400 % Instead, 'h' is colored as part of the string
1 400 400
0 400 400 % Octave terminates string at 3rd ", Matlab at 4th
0 400 400 i="\" "; % " %
1 400 400
0 400 400 % Matlab (unlike Octave) does not allow string continuation with an escape
0 400 400 b = "multi\
0 400 400 line"
1 400 400
0 400 400 % end
1 400 400

View File

@ -0,0 +1,21 @@
{7}a{6}={8}""""{6};{0}
{7}b{6}={3}1{6};{0}
{7}c{6}={5}'\'{6};{0}
{7}d{6}={3}2{6};{0}
{7}e{6}={8}"\"{6};{0}
{7}f{6}={3}3{6};{0}
{1}%" this should be a comment (colored as such), instead it closes the string{0}
{7}g{6}={8}"{0}
{7}h{6}={3}123{6};{0}
{1}%" this is a syntax error in Matlab (about 'g'),{0}
{1}% followed by a valid assignment (of 'h'){0}
{1}% Instead, 'h' is colored as part of the string{0}
{1}% Octave terminates string at 3rd ", Matlab at 4th{0}
{7}i{6}={8}"\"{0} {8}"; % "{0} {1}%{0}
{1}% Matlab (unlike Octave) does not allow string continuation with an escape{0}
{7}b{0} {6}={0} {8}"multi\{0}
{7}line{8}"{0}
{1}% end{0}

View File

@ -0,0 +1,14 @@
% Ensure escape sequences still work in octave
% Octave terminates string at 3rd ", Matlab at 4th
i="\" "; % " %
% Octave allows string continuation with an escape
b = "multi\
line"
% No escape so string ends at line end
c = "multi
line"
% end

View File

@ -0,0 +1,15 @@
0 400 400 % Ensure escape sequences still work in octave
0 400 400 % Octave terminates string at 3rd ", Matlab at 4th
0 400 400 i="\" "; % " %
1 400 400
1 400 400
0 400 400 % Octave allows string continuation with an escape
0 400 400 b = "multi\
0 400 400 line"
1 400 400
0 400 400 % No escape so string ends at line end
0 400 400 c = "multi
0 400 400 line"
1 400 400
0 400 400 % end
1 400 400

View File

@ -0,0 +1,14 @@
{1}% Ensure escape sequences still work in octave{0}
{1}% Octave terminates string at 3rd ", Matlab at 4th{0}
{7}i{6}={8}"\" "{6};{0} {1}% " %{0}
{1}% Octave allows string continuation with an escape{0}
{7}b{0} {6}={0} {8}"multi\
line"{0}
{1}% No escape so string ends at line end {0}
{7}c{0} {6}={0} {8}"multi{0}
{7}line{8}"{0}
{1}% end{0}

View File

@ -0,0 +1,28 @@
d = 123;
x = 0x123ABC;
b = 0b010101;
xs64 = 0x2As64;
xs32 = 0x2As32;
xs16 = 0x2As16;
xs8 = 0x2As8;
xu64 = 0x2Au64;
xu32 = 0x2Au32;
xu16 = 0x2Au16;
xu8 = 0x2Au8;
bs64 = 0b10s64;
bs32 = 0b10s32;
bs16 = 0b10s16;
bs8 = 0b10s8;
bu64 = 0b10u64;
bu32 = 0b10u32;
bu16 = 0b10u16;
bu8 = 0b10u8;
c = .1;
c = 1.1;
c = .1e1;
c = 1.1e1;
c = 1e1;
c = 1i;
c = 1j;
c = .1e2j;
c = 1e2j;

View File

@ -0,0 +1,29 @@
0 400 400 d = 123;
0 400 400 x = 0x123ABC;
0 400 400 b = 0b010101;
0 400 400 xs64 = 0x2As64;
0 400 400 xs32 = 0x2As32;
0 400 400 xs16 = 0x2As16;
0 400 400 xs8 = 0x2As8;
0 400 400 xu64 = 0x2Au64;
0 400 400 xu32 = 0x2Au32;
0 400 400 xu16 = 0x2Au16;
0 400 400 xu8 = 0x2Au8;
0 400 400 bs64 = 0b10s64;
0 400 400 bs32 = 0b10s32;
0 400 400 bs16 = 0b10s16;
0 400 400 bs8 = 0b10s8;
0 400 400 bu64 = 0b10u64;
0 400 400 bu32 = 0b10u32;
0 400 400 bu16 = 0b10u16;
0 400 400 bu8 = 0b10u8;
0 400 400 c = .1;
0 400 400 c = 1.1;
0 400 400 c = .1e1;
0 400 400 c = 1.1e1;
0 400 400 c = 1e1;
0 400 400 c = 1i;
0 400 400 c = 1j;
0 400 400 c = .1e2j;
0 400 400 c = 1e2j;
1 400 400

View File

@ -0,0 +1,28 @@
{7}d{0} {6}={0} {3}123{6};{0}
{7}x{0} {6}={0} {3}0x123ABC{6};{0}
{7}b{0} {6}={0} {3}0b010101{6};{0}
{7}xs64{0} {6}={0} {3}0x2As64{6};{0}
{7}xs32{0} {6}={0} {3}0x2As32{6};{0}
{7}xs16{0} {6}={0} {3}0x2As16{6};{0}
{7}xs8{0} {6}={0} {3}0x2As8{6};{0}
{7}xu64{0} {6}={0} {3}0x2Au64{6};{0}
{7}xu32{0} {6}={0} {3}0x2Au32{6};{0}
{7}xu16{0} {6}={0} {3}0x2Au16{6};{0}
{7}xu8{0} {6}={0} {3}0x2Au8{6};{0}
{7}bs64{0} {6}={0} {3}0b10s64{6};{0}
{7}bs32{0} {6}={0} {3}0b10s32{6};{0}
{7}bs16{0} {6}={0} {3}0b10s16{6};{0}
{7}bs8{0} {6}={0} {3}0b10s8{6};{0}
{7}bu64{0} {6}={0} {3}0b10u64{6};{0}
{7}bu32{0} {6}={0} {3}0b10u32{6};{0}
{7}bu16{0} {6}={0} {3}0b10u16{6};{0}
{7}bu8{0} {6}={0} {3}0b10u8{6};{0}
{7}c{0} {6}={0} {3}.1{6};{0}
{7}c{0} {6}={0} {3}1.1{6};{0}
{7}c{0} {6}={0} {3}.1e1{6};{0}
{7}c{0} {6}={0} {3}1.1e1{6};{0}
{7}c{0} {6}={0} {3}1e1{6};{0}
{7}c{0} {6}={0} {3}1i{6};{0}
{7}c{0} {6}={0} {3}1j{6};{0}
{7}c{0} {6}={0} {3}.1e2j{6};{0}
{7}c{0} {6}={0} {3}1e2j{6};{0}

View File

@ -0,0 +1,8 @@
lexer.*.matlab=matlab
keywords.*.matlab=end for global if break case catch classdef continue else elseif function otherwise parfor persistent return spmd switch try while
lexer.*.octave=octave
keywords.*.octave=end for global if
fold=1
fold.compact=1