Skip to content

Commit f460d5e

Browse files
author
Kyle
committed
Adds highlighting for type-bound subroutines
Fixes highlighting for derived-type names
1 parent 1488fd4 commit f460d5e

File tree

1 file changed

+40
-20
lines changed

1 file changed

+40
-20
lines changed

syntaxes/fortran90.tmLanguage.json

Lines changed: 40 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -236,7 +236,7 @@
236236
"end": "(?:\\)|(?=\\n))",
237237
"patterns": [
238238
{
239-
"name": "entity.name.derived-type.fortran",
239+
"name": "entity.name.type.fortran",
240240
"match": "(?i)\\s*\\b([a-z]\\w*)\\b"
241241
}
242242
]
@@ -1195,6 +1195,32 @@
11951195
},
11961196
"end": "(?=[;!\\n])",
11971197
"patterns": [
1198+
{
1199+
"comment": "type-bound subroutines",
1200+
"begin": "(?ix)\\G\\s*([a-z]\\w*)(%)([a-z]\\w*)\\b\\s*(?=\\()",
1201+
"beginCaptures": {
1202+
"1": {
1203+
"name": "variable.other.fortran"
1204+
},
1205+
"2": {
1206+
"name": "punctuation.accessor.fortran"
1207+
},
1208+
"3": {
1209+
"name": "entity.name.function.subroutine.fortran"
1210+
}
1211+
},
1212+
"end": "(?<!\\G)",
1213+
"endCaptures": {
1214+
"1": {
1215+
"name": "punctuation.parentheses.right.fortran"
1216+
}
1217+
},
1218+
"patterns": [
1219+
{
1220+
"include": "#parentheses-dummy-variables"
1221+
}
1222+
]
1223+
},
11981224
{
11991225
"include": "#intrinsic-subroutines"
12001226
},
@@ -1493,7 +1519,7 @@
14931519
"begin": "(?i)\\s*\\b([a-z]\\w*)\\b",
14941520
"beginCaptures": {
14951521
"1": {
1496-
"name": "entity.name.struct"
1522+
"name": "entity.name.type.fortran"
14971523
}
14981524
},
14991525
"end": "(?i)(?:^|(?<=;))\\s*(end\\s*type)(?:\\s+(?:(\\1)|(\\w+)))?\\b",
@@ -1502,7 +1528,7 @@
15021528
"name": "keyword.control.endtype.fortran"
15031529
},
15041530
"2": {
1505-
"name": "entity.name.derived-type.fortran"
1531+
"name": "entity.name.type.fortran"
15061532
},
15071533
"3": {
15081534
"name": "invalid.error.fortran"
@@ -2749,7 +2775,7 @@
27492775
},
27502776
{
27512777
"comment": "Intrinsic functions introduced in the Fortran 1990 standard.",
2752-
"begin": "(?ix)\\b(achar|adjustl|adjustr|all|allocated|associated|any|bit_size| btest|ceiling|count|cshift|digits|dot_product|eoshift|epsilon|exponent| floor|fraction|huge|iachar|iand|ibclr|ibits|ibset|ieor|ior|ishftc?| kind|lbound|len_trim|logical|matmul|maxexponent|maxloc|maxval|merge| minexponent|minloc|minval|modulo|nearest|not|pack|precision|present| product|radix|range|repeat|reshape|rrspacing|scale|scan| selected_(int|real)_kind|set_exponent|shape|size|spacing|spread|sum| tiny|transfer|transpose|trim|ubound|unpack|verify)\\s*(?=\\()",
2778+
"begin": "(?ix)\\b(achar|adjustl|adjustr|all|allocated|associated|any|bit_size|btest|ceiling|count|cshift|digits|dot_product|eoshift|epsilon|exponent|floor|fraction|huge|iachar|iand|ibclr|ibits|ibset|ieor|ior|ishftc?| kind|lbound|len_trim|logical|matmul|maxexponent|maxloc|maxval|merge|minexponent|minloc|minval|modulo|nearest|not|pack|precision|present|product|radix|range|repeat|reshape|rrspacing|scale|scan|selected_(int|real)_kind|set_exponent|shape|size|spacing|spread|sum|tiny|transfer|transpose|trim|ubound|unpack|verify)\\s*(?=\\()",
27532779
"beginCaptures": {
27542780
"1": {
27552781
"name": "support.function.intrinsic.fortran"
@@ -3039,7 +3065,7 @@
30393065
{
30403066
"comment": "Introduced in the Fortran 1977 standard.",
30413067
"match": "(?ix)(\\.(and|eq|eqv|le|lt|ge|gt|ne|neqv|not|or)\\.)",
3042-
"name": "keyword.operator.logical.fortran"
3068+
"name": "keyword.fortran"
30433069
},
30443070
{
30453071
"comment": "Introduced in the Fortran 1990 standard.",
@@ -4058,7 +4084,7 @@
40584084
"begin": "(?i)\\s*\\b([a-z]\\w*)\\b",
40594085
"beginCaptures": {
40604086
"1": {
4061-
"name": "entity.name.module.fortran"
4087+
"name": "entity.name.class.fortran"
40624088
}
40634089
},
40644090
"end": "(?=[;!\\n])",
@@ -4169,8 +4195,8 @@
41694195
"derived-type": {
41704196
"comment": "Introduced in the Fortran 1995 standard.",
41714197
"name": "meta.specification.type.derived.fortran",
4172-
"begin": "(?i)\\b(?:(class)|(type))\\s*(?=\\()",
4173-
"beginCaptures": {
4198+
"match": "(?i)\\b(?:(class)|(type))\\s*(\\()\\s*([a-z]\\w*)(\\))",
4199+
"captures": {
41744200
"1": {
41754201
"name": "storage.type.class.fortran"
41764202
},
@@ -4179,20 +4205,14 @@
41794205
},
41804206
"3": {
41814207
"name": "punctuation.parentheses.left.fortran"
4182-
}
4183-
},
4184-
"end": "(?<!\\G)",
4185-
"endCaptures": {
4186-
"1": {
4208+
},
4209+
"4": {
4210+
"name": "entity.name.type.fortran"
4211+
},
4212+
"5": {
41874213
"name": "punctuation.parentheses.right.fortran"
41884214
}
4189-
},
4190-
"contentName": "meta.type-spec.fortran",
4191-
"patterns": [
4192-
{
4193-
"include": "#parentheses-dummy-variables"
4194-
}
4195-
]
4215+
}
41964216
},
41974217
"logical-type": {
41984218
"comment": "Introduced in the Fortran 1977 standard.",

0 commit comments

Comments
 (0)