Skip to content
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

Quote is not recognized as transpose after a closing curly brace #108

Closed
denisrosset opened this issue Jun 30, 2020 · 6 comments
Closed

Comments

@denisrosset
Copy link
Contributor

I get a few warnings:

WARNING: [sphinxcontrib-matlabdomain] Parsing failed in +replab.SedumiData. Check if valid MATLAB code.
WARNING: [sphinxcontrib-matlabdomain] Parsing failed in +replab.CommutantVar. Check if valid MATLAB code.
WARNING: [sphinxcontrib-matlabdomain] Parsing failed in +replab.RepByImages. Check if valid MATLAB code.

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

@joeced
Copy link
Collaborator

joeced commented Jun 30, 2020

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 ends. It simply runs out of "tokens". I haven't found where it is though.

@denisrosset
Copy link
Contributor Author

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.

denisrosset added a commit to denisrosset/matlabdomain that referenced this issue Jul 1, 2020
@denisrosset denisrosset changed the title Parse error, how to get the line number? Quote is not recognized as transpose after a closing curly brace Jul 1, 2020
@denisrosset
Copy link
Contributor Author

denisrosset commented Jul 1, 2020

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?

@denisrosset
Copy link
Contributor Author

See also the Matlab TM syntax where this was discussed ( mathworks/MATLAB-Language-grammar#10 ). The current regexp is:
((?<=[^\s])|(?<=\])|(?<=\))|(?<=\}))'

@joeced joeced closed this as completed in 6df7226 Jul 1, 2020
@joeced
Copy link
Collaborator

joeced commented Jul 1, 2020

Thanks a lot for the contribution. I'll make a new release tonight when I'm home.

@denisrosset
Copy link
Contributor Author

@joeced as mentioned above, tests are failing and I'm at a loss to explain why!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants