Closed denisrosset closed 4 years ago
Unfortunately I cannot print the line number currently. The MATLAB source is parsed into tokens (with no knowledge of position).
In your examples I looked at CommuntVar
and in the constructor there seems to be a mismatch in the with the number of end
s. It simply runs out of "tokens". I haven't found where it is though.
I found a minimal test case for that bug:
classdef CommutantVar
methods
function self = CommutantVar
A{i} = (A{i} + A{i}.')/2;
A{i} = (A{i} + A{i}')/2;
end
end
end
which I guess is related to the lexing/parsing of single quote characters.
For some reason, the above code is not parsed correctly from Sphinx after the correction, but is parsed successfully when calling directly MatlabLexer
and MatClass
from a Python 3 REPL. And tests fail after the change?
See also the Matlab TM syntax where this was discussed ( https://github.com/mathworks/MATLAB-Language-grammar/issues/10 ). The current regexp is:
((?<=[^\s])|(?<=\])|(?<=\))|(?<=\}))'
Thanks a lot for the contribution. I'll make a new release tonight when I'm home.
@joeced as mentioned above, tests are failing and I'm at a loss to explain why!
I get a few warnings:
and those files are valid MATLAB code. How can I get the line number where the parsing fails?
Attached the three files that can't be parsed.
src.zip