Skip to content

Commit 1fcefd5

Browse files
Fix select highlight after & operator (#165)
* Fix wrong select highlight on declarations with * Rebuild select constructs to be separated by kind (case|type|rank)
1 parent 6e14c58 commit 1fcefd5

File tree

1 file changed

+160
-96
lines changed

1 file changed

+160
-96
lines changed

syntaxes/fortran_free-form.tmLanguage.json

Lines changed: 160 additions & 96 deletions
Original file line numberDiff line numberDiff line change
@@ -994,7 +994,13 @@
994994
"include": "#if-construct"
995995
},
996996
{
997-
"include": "#select-construct"
997+
"include": "#select-case-construct"
998+
},
999+
{
1000+
"include": "#select-type-construct"
1001+
},
1002+
{
1003+
"include": "#select-rank-construct"
9981004
},
9991005
{
10001006
"include": "#where-construct"
@@ -1274,121 +1280,167 @@
12741280
}
12751281
]
12761282
},
1277-
"select-construct": {
1283+
"select-case-construct":{
1284+
"comment": "Select case construct. Introduced in the Fortran 1990 standard.",
1285+
"begin": "(?i)\\b(select)\\s*(case)\\b",
1286+
"beginCaptures": {
1287+
"1": {
1288+
"name": "keyword.control.select.fortran"
1289+
},
1290+
"2": {
1291+
"name": "keyword.control.case.fortran"
1292+
}
1293+
},
1294+
"end": "(?i)(?=\\b(end\\s*select)\\b)",
1295+
"endCaptures": {
1296+
"1": {
1297+
"name": "keyword.control.endselect.fortran"
1298+
}
1299+
},
12781300
"patterns": [
12791301
{
1280-
"name": "meta.block.select.fortran",
1281-
"begin": "(?i)\\b(select)",
1302+
"include": "#parentheses"
1303+
},
1304+
{
1305+
"begin": "(?i)\\b(case)\\b",
12821306
"beginCaptures": {
12831307
"1": {
1284-
"name": "keyword.control.select.fortran"
1308+
"name": "keyword.control.case.fortran"
12851309
}
12861310
},
1287-
"end": "(?i)\\b(end\\s*select)\\b",
1288-
"endCaptures": {
1311+
"end": "(?i)(?=[;!\\n])",
1312+
"patterns": [
1313+
{
1314+
"match": "(?i)\\G\\s*\\b(default)\\b",
1315+
"captures": {
1316+
"1": {
1317+
"name": "keyword.control.default.fortran"
1318+
}
1319+
}
1320+
},
1321+
{
1322+
"include": "#parentheses"
1323+
},
1324+
{
1325+
"include": "#invalid-word"
1326+
}
1327+
]
1328+
},
1329+
{
1330+
"include": "$base"
1331+
}
1332+
]
1333+
},
1334+
"select-type-construct":{
1335+
"comment": "Select type construct. Introduced in the Fortran 2003 standard.",
1336+
"begin": "(?i)\\b(select)\\s*(type)\\b",
1337+
"beginCaptures": {
1338+
"1": {
1339+
"name": "keyword.control.select.fortran"
1340+
},
1341+
"2": {
1342+
"name": "keyword.control.type.fortran"
1343+
}
1344+
},
1345+
"end": "(?i)(?=\\b(end\\s*select)\\b)",
1346+
"endCaptures": {
1347+
"1": {
1348+
"name": "keyword.control.endselect.fortran"
1349+
}
1350+
},
1351+
"patterns": [
1352+
{
1353+
"include": "#parentheses"
1354+
},
1355+
{
1356+
"begin": "(?i)\\b(?:(class)|(type))",
1357+
"beginCaptures": {
12891358
"1": {
1290-
"name": "keyword.control.endselect.fortran"
1359+
"name": "keyword.control.class.fortran"
1360+
},
1361+
"2": {
1362+
"name": "keyword.control.type.fortran"
12911363
}
12921364
},
1365+
"end": "(?i)(?=[;!\\n])",
12931366
"patterns": [
12941367
{
1295-
"comment": "Select case construct. Introduced in the Fortran 1990 standard.",
1296-
"begin": "(?i)\\s*(case)\\b",
1297-
"beginCaptures": {
1368+
"match": "(?i)\\G\\s*\\b(default)\\b",
1369+
"captures": {
12981370
"1": {
1299-
"name": "keyword.control.case.fortran"
1371+
"name": "keyword.control.default.fortran"
13001372
}
1301-
},
1302-
"end": "(?i)(?=\\b(end\\s*select)\\b)",
1303-
"patterns": [
1304-
{
1305-
"include": "#parentheses"
1306-
},
1307-
{
1308-
"begin": "(?i)\\b(case)\\b",
1309-
"beginCaptures": {
1310-
"1": {
1311-
"name": "keyword.control.case.fortran"
1312-
}
1313-
},
1314-
"end": "(?i)(?=[;!\\n])",
1315-
"patterns": [
1316-
{
1317-
"match": "(?i)\\G\\s*\\b(default)\\b",
1318-
"captures": {
1319-
"1": {
1320-
"name": "keyword.control.default.fortran"
1321-
}
1322-
}
1323-
},
1324-
{
1325-
"include": "#parentheses"
1326-
},
1327-
{
1328-
"include": "#invalid-word"
1329-
}
1330-
]
1331-
},
1332-
{
1333-
"include": "$base"
1334-
}
1335-
]
1373+
}
13361374
},
13371375
{
1338-
"comment": "Select type construct. Introduced in the Fortran 2003 standard.",
1339-
"begin": "(?i)\\s*(type)\\b",
1340-
"beginCaptures": {
1376+
"match": "(?i)\\G\\s*(is)\\b",
1377+
"captures": {
13411378
"1": {
1342-
"name": "keyword.control.type.fortran"
1379+
"name": "keyword.control.is.fortran"
13431380
}
1344-
},
1345-
"end": "(?i)(?=\\b(end\\s*select)\\b)",
1346-
"patterns": [
1347-
{
1348-
"include": "#parentheses"
1349-
},
1350-
{
1351-
"begin": "(?i)\\b(?:(class)|(type))",
1352-
"beginCaptures": {
1353-
"1": {
1354-
"name": "keyword.control.class.fortran"
1355-
},
1356-
"2": {
1357-
"name": "keyword.control.type.fortran"
1358-
}
1359-
},
1360-
"end": "(?i)(?=[;!\\n])",
1361-
"patterns": [
1362-
{
1363-
"match": "(?i)\\G\\s*\\b(default)\\b",
1364-
"captures": {
1365-
"1": {
1366-
"name": "keyword.control.default.fortran"
1367-
}
1368-
}
1369-
},
1370-
{
1371-
"match": "(?i)\\G\\s*(is)\\b",
1372-
"captures": {
1373-
"1": {
1374-
"name": "keyword.control.is.fortran"
1375-
}
1376-
}
1377-
},
1378-
{
1379-
"include": "#parentheses"
1380-
},
1381-
{
1382-
"include": "#invalid-word"
1383-
}
1384-
]
1385-
},
1386-
{
1387-
"include": "$base"
1381+
}
1382+
},
1383+
{
1384+
"include": "#parentheses"
1385+
},
1386+
{
1387+
"include": "#invalid-word"
1388+
}
1389+
]
1390+
},
1391+
{
1392+
"include": "$base"
1393+
}
1394+
]
1395+
},
1396+
"select-rank-construct":{
1397+
"comment": "Select rank construct. Introduced in the Fortran 2008 standard.",
1398+
"begin": "(?i)\\b(select)\\s*(rank)\\b",
1399+
"beginCaptures": {
1400+
"1": {
1401+
"name": "keyword.control.select.fortran"
1402+
},
1403+
"2": {
1404+
"name": "keyword.control.rank.fortran"
1405+
}
1406+
},
1407+
"end": "(?i)(?=\\b(end\\s*select)\\b)",
1408+
"endCaptures": {
1409+
"1": {
1410+
"name": "keyword.control.endselect.fortran"
1411+
}
1412+
},
1413+
"patterns": [
1414+
{
1415+
"include": "#parentheses"
1416+
},
1417+
{
1418+
"begin": "(?i)\\b(rank)\\b",
1419+
"beginCaptures": {
1420+
"1": {
1421+
"name": "keyword.control.rank.fortran"
1422+
}
1423+
},
1424+
"end": "(?i)(?=[;!\\n])",
1425+
"patterns": [
1426+
{
1427+
"match": "(?i)\\G\\s*\\b(default)\\b",
1428+
"captures": {
1429+
"1": {
1430+
"name": "keyword.control.default.fortran"
13881431
}
1389-
]
1432+
}
1433+
},
1434+
{
1435+
"include": "#parentheses"
1436+
},
1437+
{
1438+
"include": "#invalid-word"
13901439
}
13911440
]
1441+
},
1442+
{
1443+
"include": "$base"
13921444
}
13931445
]
13941446
},
@@ -2110,6 +2162,9 @@
21102162
"include": "#invalid-word"
21112163
}
21122164
]
2165+
},
2166+
{
2167+
"include": "#line-continuation-operator"
21132168
}
21142169
]
21152170
},
@@ -4070,6 +4125,9 @@
40704125
{
40714126
"include": "#types"
40724127
},
4128+
{
4129+
"include": "#line-continuation-operator"
4130+
},
40734131
{
40744132
"comment": "Attribute list.",
40754133
"contentName": "meta.attribute-list.fortran",
@@ -4148,6 +4206,9 @@
41484206
"include": "#invalid-word"
41494207
}
41504208
]
4209+
},
4210+
{
4211+
"include": "#line-continuation-operator"
41514212
}
41524213
]
41534214
},
@@ -4939,6 +5000,9 @@
49395000
},
49405001
{
49415002
"include": "#variable"
5003+
},
5004+
{
5005+
"include": "#line-continuation-operator"
49425006
}
49435007
]
49445008
},

0 commit comments

Comments
 (0)