Skip to content

Commit

Permalink
Fixes preprocessor syntax highlighting
Browse files Browse the repository at this point in the history
The line continuation operator is a bit too aggressive so instead of
adding lookaheads for every case where we don't need to apply it
we have excluded the preprocessor directives from the lint cont.

The original .cson highlighting does the same, see:
https://github.com/dparkins/language-fortran/blob/master/grammars/fortran%20-%20free%20form.cson

for injections see:
https://gist.github.com/Aerijo/b8c82d647db783187804e86fa0a604a1

Fixes Preprocessor statements in line continuations break syntax highlighting #248
Fixes Erroneous syntax highlighting for preprocessor conditionals in derived types #249
  • Loading branch information
gnikit committed Oct 6, 2021
1 parent 25eb5bb commit 6537b38
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion syntaxes/fortran_free-form.tmLanguage.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,13 @@
],
"firstLineMatch": "(?i)-[*]- mode: fortran free -[*]-",
"injections": {
"source.fortran.free - ( string | comment )": {
"source.fortran.free - ( string | comment | source.preprocessor )": {
"patterns": [
{
"include": "#line-continuation-operator"
},
{
"include": "#preprocessor"
}
]
},
Expand Down Expand Up @@ -121,6 +124,7 @@
],
"repository": {
"preprocessor": {
"name": "source.preprocessor",
"begin": "^\\s*(#)",
"beginCaptures": {
"1": {
Expand Down

0 comments on commit 6537b38

Please # to comment.