Skip to content

Commit cda402d

Browse files
committed
Fix more keyword/identifier clashes
Fixes stadelmanma#134 Fixes stadelmanma#136 Fixes stadelmanma#139
1 parent 0cbfc85 commit cda402d

File tree

5 files changed

+529792
-532475
lines changed

5 files changed

+529792
-532475
lines changed

grammar.js

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,8 @@ module.exports = grammar({
9797
[$.preproc_ifdef_in_specification_part, $.program],
9898
[$.preproc_else_in_specification_part, $.program],
9999
[$.coarray_critical_statement, $.identifier],
100+
[$.format_statement, $.identifier],
101+
[$._inline_if_statement, $.arithmetic_if_statement, $._block_if_statement, $.identifier],
100102
],
101103

102104
rules: {
@@ -1052,7 +1054,6 @@ module.exports = grammar({
10521054
_statements: $ => choice(
10531055
$.assignment_statement,
10541056
$.pointer_association_statement,
1055-
$.call_expression,
10561057
$.subroutine_call,
10571058
$.keyword_statement,
10581059
$.if_statement,
@@ -1289,11 +1290,11 @@ module.exports = grammar({
12891290
$._block_if_statement
12901291
),
12911292

1292-
_inline_if_statement: $ => prec.right(2, seq(
1293+
_inline_if_statement: $ => seq(
12931294
caseInsensitive('if'),
12941295
$.parenthesized_expression,
12951296
$._statements
1296-
)),
1297+
),
12971298

12981299
arithmetic_if_statement: $ => prec.right(seq(
12991300
caseInsensitive('if'),
@@ -1565,12 +1566,12 @@ module.exports = grammar({
15651566
optional($._block_label)
15661567
),
15671568

1568-
format_statement: $ => prec(1, seq(
1569+
format_statement: $ => seq(
15691570
caseInsensitive('format'),
15701571
'(',
15711572
alias($._transfer_items, $.transfer_items),
15721573
')'
1573-
)),
1574+
),
15741575

15751576
_transfer_item: $ => choice(
15761577
$.string_literal,
@@ -2191,6 +2192,7 @@ module.exports = grammar({
21912192
caseInsensitive('device'),
21922193
prec(-1, caseInsensitive('dimension')),
21932194
caseInsensitive('double'),
2195+
caseInsensitive('else'),
21942196
caseInsensitive('elseif'),
21952197
caseInsensitive('end'),
21962198
caseInsensitive('endif'),

src/grammar.json

Lines changed: 65 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -13029,10 +13029,6 @@
1302913029
"type": "SYMBOL",
1303013030
"name": "pointer_association_statement"
1303113031
},
13032-
{
13033-
"type": "SYMBOL",
13034-
"name": "call_expression"
13035-
},
1303613032
{
1303713033
"type": "SYMBOL",
1303813034
"name": "subroutine_call"
@@ -14584,30 +14580,26 @@
1458414580
]
1458514581
},
1458614582
"_inline_if_statement": {
14587-
"type": "PREC_RIGHT",
14588-
"value": 2,
14589-
"content": {
14590-
"type": "SEQ",
14591-
"members": [
14592-
{
14593-
"type": "ALIAS",
14594-
"content": {
14595-
"type": "PATTERN",
14596-
"value": "[iI][fF]"
14597-
},
14598-
"named": false,
14599-
"value": "if"
14600-
},
14601-
{
14602-
"type": "SYMBOL",
14603-
"name": "parenthesized_expression"
14583+
"type": "SEQ",
14584+
"members": [
14585+
{
14586+
"type": "ALIAS",
14587+
"content": {
14588+
"type": "PATTERN",
14589+
"value": "[iI][fF]"
1460414590
},
14605-
{
14606-
"type": "SYMBOL",
14607-
"name": "_statements"
14608-
}
14609-
]
14610-
}
14591+
"named": false,
14592+
"value": "if"
14593+
},
14594+
{
14595+
"type": "SYMBOL",
14596+
"name": "parenthesized_expression"
14597+
},
14598+
{
14599+
"type": "SYMBOL",
14600+
"name": "_statements"
14601+
}
14602+
]
1461114603
},
1461214604
"arithmetic_if_statement": {
1461314605
"type": "PREC_RIGHT",
@@ -16474,39 +16466,35 @@
1647416466
]
1647516467
},
1647616468
"format_statement": {
16477-
"type": "PREC",
16478-
"value": 1,
16479-
"content": {
16480-
"type": "SEQ",
16481-
"members": [
16482-
{
16483-
"type": "ALIAS",
16484-
"content": {
16485-
"type": "PATTERN",
16486-
"value": "[fF][oO][rR][mM][aA][tT]"
16487-
},
16488-
"named": false,
16489-
"value": "format"
16490-
},
16491-
{
16492-
"type": "STRING",
16493-
"value": "("
16469+
"type": "SEQ",
16470+
"members": [
16471+
{
16472+
"type": "ALIAS",
16473+
"content": {
16474+
"type": "PATTERN",
16475+
"value": "[fF][oO][rR][mM][aA][tT]"
1649416476
},
16495-
{
16496-
"type": "ALIAS",
16497-
"content": {
16498-
"type": "SYMBOL",
16499-
"name": "_transfer_items"
16500-
},
16501-
"named": true,
16502-
"value": "transfer_items"
16477+
"named": false,
16478+
"value": "format"
16479+
},
16480+
{
16481+
"type": "STRING",
16482+
"value": "("
16483+
},
16484+
{
16485+
"type": "ALIAS",
16486+
"content": {
16487+
"type": "SYMBOL",
16488+
"name": "_transfer_items"
1650316489
},
16504-
{
16505-
"type": "STRING",
16506-
"value": ")"
16507-
}
16508-
]
16509-
}
16490+
"named": true,
16491+
"value": "transfer_items"
16492+
},
16493+
{
16494+
"type": "STRING",
16495+
"value": ")"
16496+
}
16497+
]
1651016498
},
1651116499
"_transfer_item": {
1651216500
"type": "CHOICE",
@@ -20671,6 +20659,15 @@
2067120659
"named": false,
2067220660
"value": "double"
2067320661
},
20662+
{
20663+
"type": "ALIAS",
20664+
"content": {
20665+
"type": "PATTERN",
20666+
"value": "[eE][lL][sS][eE]"
20667+
},
20668+
"named": false,
20669+
"value": "else"
20670+
},
2067420671
{
2067520672
"type": "ALIAS",
2067620673
"content": {
@@ -21213,6 +21210,16 @@
2121321210
[
2121421211
"coarray_critical_statement",
2121521212
"identifier"
21213+
],
21214+
[
21215+
"format_statement",
21216+
"identifier"
21217+
],
21218+
[
21219+
"_inline_if_statement",
21220+
"arithmetic_if_statement",
21221+
"_block_if_statement",
21222+
"identifier"
2121621223
]
2121721224
],
2121821225
"precedences": [],

0 commit comments

Comments
 (0)