-
Notifications
You must be signed in to change notification settings - Fork 65
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Matlab folding bugfix #70
Conversation
I think other keywords can be added too, https://www.mathworks.com/help/matlab/ref/classdef.html classdef (Attributes) ClassName < SuperclassNames
properties (Attributes) ... end
methods (Attributes) ... end
events (Attributes) ... end
enumeration ... end
end https://octave.org/doc/v6.4.0/Creating-a-classdef-Class.html classdef some_class
properties
endproperties
methods
endmethods
endclassdef |
Hi! The reason is, I think, that they're context-dependent. For instance, you can use function y = foo(x)
x = x + 1;
arguments = 10;
y = x + arguments;
end is perfectly valid for MATLAB. I wrote some code for Lexilla processing the |
On first impression, this seems minor so it will probably be accepted. Due to work in progress and vacations, it's likely I'll look at this in around 4 weeks. |
Ok, thank you, I'm not in a rush with it. |
Fine to add another commit to this PR. |
"arguments" is context dependent in MATLAB. If it is used right after a function declaration (commented lines don't count), it denotes the arguments code block describing the restrictions on the function's arguments. If it is used elsewhere, it's just a regular identifier. The code in this commit marks "arguments" as a keyword opening the folded code block only if it is really a keyword, and avoids folding in cases where "arguments" is used as an identifier.
The per line comparasion is switched off for this test because "arguments" is the context-dependent keyword. The differences between the whole file and per line processing are expected.
There's a problem with 0ab6a24. The common way to fix this is to remember the |
To avoid storing expectingArgumentsBlock flag's sttate between the lines directly in the lexing function's code. Fixes per-line testing, so it doesn't have to be disabled for the "ArgumentsBlock.m.matlab" file anymore.
Thank you, I guess, I should've studied the Lexilla's code better. |
With 43e7108 that works well. |
Complete list of MATLAB's keywords in SciTE.properties. Add a test for fold point detection.
"arguments" is context dependent in MATLAB. If it is used right after a function declaration (commented lines don't count), it denotes the arguments code block describing the restrictions on the function's arguments. If it is used elsewhere, it's just a regular identifier. The code in this commit marks "arguments" as a keyword opening the folded code block only if it is really a keyword, and avoids folding in cases where "arguments" is used as an identifier. Add a flag to line state to store expectingArgumentsBlock state between lines. Add test for the "arguments" processing in MATLAB lexer.
Thank you! |
I close issues with commits when the commits are included in a release. |
Included in 5.1.7 release. |
Lexilla doesn't know a couple of MATLAB's keywords, so it cannot do the proper folding when these keywords are used.
This PR adds the absent keywords into the MATLAB lexer.
It also includes the code processing the "arguments" keyword edge case.