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: CRITICAL statement in IF statement triggers "Unexpected end of scope at line" #255

Closed
1 task done
han190 opened this issue Jan 12, 2023 · 3 comments · Fixed by #256
Closed
1 task done

bug: CRITICAL statement in IF statement triggers "Unexpected end of scope at line" #255

han190 opened this issue Jan 12, 2023 · 3 comments · Fixed by #256
Assignees
Labels
bug Something isn't working lsp/diagnostics Issues related with generating and displaying diagnostic messages parser: native Issues related with the native parser of fortls

Comments

@han190
Copy link

han190 commented Jan 12, 2023

Is there an existing issue for this?

  • I have searched the existing issues

Description

As described in the title, when CRITICAL statement appears in IF statement, an error "Unexpected end of scope at line" is triggered.

Screenshots

Screenshot 2023-01-11 193437

Expected Behaviour

I believe the test code should be standard conforming.

Version of Modern Fortran

v3.4.2023011101

Version of Visual Studio Code

v1.74.3

Platform and Architecture

WSL

Additional Information

No response

@han190 han190 added the bug Something isn't working label Jan 12, 2023
@gnikit
Copy link
Member

gnikit commented Jan 12, 2023

Thanks @han190, this appears to be a bug in fortls, I will transfer the issue there and issue a fix ASAP. Since you are working with coarrays, if you notice anything else that needs fixing do let me know. I have done very little work with coarrays in fortls so I would expect there would be plenty of issues.

@gnikit gnikit transferred this issue from fortran-lang/vscode-fortran-support Jan 12, 2023
@gnikit gnikit self-assigned this Jan 13, 2023
gnikit added a commit that referenced this issue Jan 13, 2023
@gnikit
Copy link
Member

gnikit commented Jan 13, 2023

See PR #256 (will merge once green).

I will wait a bit before I release a new version since the current master of fortls contains a bunch of new features that I need to go over again to make sure I don't disrupt people's workflows.

You can test the new version and tell me if you see anything wrong, including this bug by using:

pip install git+https://github.com/fortran-lang/fortls.git

@gnikit gnikit added parser: native Issues related with the native parser of fortls lsp/diagnostics Issues related with generating and displaying diagnostic messages labels Jan 13, 2023
@han190
Copy link
Author

han190 commented Jan 13, 2023

Thank you, the issue is resolved so fast! In #256 I saw that you combined block and critical in the same regex pattern. I guess this is fine for a quick fix, but based on the standard a BLOCK construct is

R1107 block-construct    is block-stmt
                         [ block-specification-part ]
                         block
                         end-block-stmt
R1108 block-stmt         is [ block-construct-name : ] BLOCK

and a CRITICAL construct is

R1116 critical-construct is critical-stmt
                            lock
                            end-critical-stmt
R1117 critical-stmt      is [ critical-construct-name : ] CRITICAL [ ( [ sync-stat-list ] ) ] 

So syntactically speaking a CRITICAL construct may include an extra [ ( [ sync-stat-list ] ) ] . Like what we discussed in #172, many of the coarray issues encountered require a better Fortran parser. And, yes I will keep you posted if I spotted new issues.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working lsp/diagnostics Issues related with generating and displaying diagnostic messages 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