Closed jwortmann closed 3 years ago
- I'm not really familiar with the syntax
Cee%Dee
inMODULE SUBROUTINE MY_SUBROUTINE(A, B, Cee%Dee)
. TheCee
part was scopedstorage.type.class
before, so I kept this scope here via the "class-accessing" context. Not sure whether the wholeCee%Dee
expression should better bevariable.parameter
here?
This seems to be a mistake. Must have gotten in because it was confused with CALL MY_SUBROUTINE(A, B, Cee%Dee)
. You can remove it from the tests and only highlight the variables in function/subroutine declaration as variable.parameter
.
This seems to be a mistake. Must have gotten in because it was confused with CALL MY_SUBROUTINE(A, B, Cee%Dee).
Oh, this resolved some confusion 😄 . It's fixed now.
I'm not sure whether or how much if any of it can be re-used between functions and subroutines, because only functions need to highlight the result(x)
part. Keep in mind that Fortran doesn't have any reserved words, so it's probably advantageous to highlight keywords only where they make sense, and not in all arbitrary places of the code.
Btw there is one lookahead I used for functions, that might look like nonsense, but seems to be required because of a bug in the syntax highlighting engine with set
and meta_content_scope
(https://www.sublimetext.com/docs/syntax.html#compatibility). This was fixed in syntax version 2, but of course we can't use it because there is no backward compatibility to Sublime Text 3.
- match: (?=\()
set:
- clear_scopes: 1
- match: \(
I agree that result
should be understood in the context of the function declaration here. I thought perhaps the argument-parsing could be re-used, but it seems a bit difficult to separate out this part because of the behavior when ) is reached.
More generally, we have often opted not to interpret where keywords appear in the code. Mainly, this is because it can be easy to overlook alternative contexts in which keywords appear, and to forget to account for all valid syntax within a given context. I do of course agree that it is preferable if syntax is highlighted only when appropriate - but it has to be done with care.
... and proper
punctuation
scopes for the parentheses.Note:
- include: comments
in the "class-accessing" context, but I believe it had no effect because this context was only included in the "main" context, which also includescomments
separately. So I removed it.Cee%Dee
inMODULE SUBROUTINE MY_SUBROUTINE(A, B, Cee%Dee)
. TheCee
part was scopedstorage.type.class
before, so I kept this scope here via the "class-accessing" context. Not sure whether the wholeCee%Dee
expression should better bevariable.parameter
here?