Skip to content

Highlight of ERROR STOP #486

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

Closed
han190 opened this issue May 20, 2022 · 3 comments · Fixed by #506
Closed

Highlight of ERROR STOP #486

han190 opened this issue May 20, 2022 · 3 comments · Fixed by #506
Assignees
Labels
Milestone

Comments

@han190
Copy link
Contributor

han190 commented May 20, 2022

Hi, thanks for the great work! I have a little issue here regarding to the error stop statement.

If I use an character variable instead of an actual string after error stop, it will be highlighted as invalid. The corresponding textmate scope is invalid.error.character.fortran. I am not sure if this is reproducible on other computers, but on my laptop it appears even in the simplest case (like the image shown below).

image

I think this issue is related to the regex definition of "error-stop-statement" in the json file,

where only "#constants" and "#string-operators" are allowed after error stop. Apparently, it is difficult for the regex definition to capture all scalar character constant expressions and scalar integer constant expressions. Since I know you are also the author of fortls (Great work and thanks again!), I wonder if it is possible to use fortls instead of a regex definition to highlight what comes after error stop?

@han190 han190 added the bug label May 20, 2022
@gnikit
Copy link
Member

gnikit commented May 22, 2022

Thanks for the report @han190. I think I might be able to relax the constraint a bit to include variables, if I recall correctly I was just lazy to pull up the Fortran standard to see what values are allowed for the stop message.

As for the fortls + TM syntax highlighting see this issue, fortran-lang/fortls#56

Basically I need to make some changes to the AST scopes internally in fortls to match the textmate grammar

@gnikit gnikit self-assigned this May 22, 2022
@gnikit gnikit added this to the v3.0 milestone May 22, 2022
@han190
Copy link
Contributor Author

han190 commented May 23, 2022

Nice, @gnikit thanks for the reply. If fortls and textmate match perfectly, it will be possible to write a Fortran-aware color theme.

@gnikit
Copy link
Member

gnikit commented May 23, 2022

Nice, @gnikit thanks for the reply. If fortls and textmate match perfectly, it will be possible to write a Fortran-aware color theme.

The good think about this is that you wouldn't actually need to change anything to your current theme (assuming it has been written correctly). For example in Fortran a user defined function cannot be distinguished from an array when called, hence it cannot be coloured with the correct colour. If a language server was supplementing the syntax highlighting it would be able to overwrite the textmate scope with the entity.name.function....

gnikit added a commit that referenced this issue Jun 2, 2022
@gnikit gnikit mentioned this issue Jun 2, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants