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

bug(parser): variable types with line continuation character not parsed #235

Closed
certik opened this issue Nov 14, 2022 · 4 comments · Fixed by #401
Closed

bug(parser): variable types with line continuation character not parsed #235

certik opened this issue Nov 14, 2022 · 4 comments · Fixed by #401
Labels
bug Something isn't working parser: native Issues related with the native parser of fortls

Comments

@certik
Copy link
Member

certik commented Nov 14, 2022

Can't find the symbol "i" if you put the cursor at the last line and press F12 in VSCode

program test_ls
implicit none
inte&
&ger &
    :: i
    
i = 5
end program

The following works:

program test_ls
implicit none
integer &
    :: i
    
i = 5
end program

I just tested one of our examples from LFortran. I don't know for sure, but I think you have to have a full Fortran parser to parse everything.

@certik certik added the bug Something isn't working label Nov 14, 2022
@gnikit
Copy link
Member

gnikit commented Nov 14, 2022

I missed this type of syntax, I actually didn't know this was possible. Even syntax highlighting seems to break when splitting an intrinsic type with &. Definitely the LFortran parser is superior in every single aspect. Will try and see if I can patch fortls'.

@certik
Copy link
Member Author

certik commented Nov 14, 2022

This is just a minor example. Why don't you figure out a roadmap how we can use LFortran's parser and semantics for fortls? That way we can slowly work towards it and fix all issues eventually.

@gnikit
Copy link
Member

gnikit commented Nov 23, 2022

Let's continue this conversation in #85

@gnikit gnikit changed the title Can't find symbol definition bug(parser): variable types with line continuation character not parsed Jan 13, 2023
@gnikit gnikit added the parser: native Issues related with the native parser of fortls label Jan 13, 2023
@gnikit
Copy link
Member

gnikit commented Jan 13, 2023

I am not sure if this is possible to fix with the native fortls parser since the REGEX reads something like r"(INTEGER|REAL|CHARACTER|COMPLEX)" and we would have to do lookarounds for the & character and that will probably impact performance (if at all doable within the current framework).

Just another reason why a compiler parser would do a better job at capturing such edge cases.

I will leave this open for now and see if and how some small number of the regular expression can be modified with lookarounds. If the performance difference (I will have to also write some tools to get performance stats) is too great or I can't figure this out in fortls I will mark it as Won't Fix and we can use it as a test case for the LFortran's LSP parser test suite.

gnikit added a commit that referenced this issue May 20, 2024
The support is more permissive than the standard dictates
and obviously does not comform with all the LSP responses
e.g. completions under certain conditions.

Fixes #235
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working parser: native Issues related with the native parser of fortls
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants