Skip to content

Commit 765d82a

Browse files
authored
Merge pull request stadelmanma#129 from jgonzac/fix-hollerith-in-format-stmt
Fix Hollerith constants inside Format statement
2 parents 022b032 + 1bc1d17 commit 765d82a

File tree

9 files changed

+408686
-408883
lines changed

9 files changed

+408686
-408883
lines changed

grammar.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ module.exports = grammar({
6060
$._string_literal_kind,
6161
$._external_end_of_statement,
6262
$._preproc_unary_operator,
63+
$.hollerith_constant,
6364
],
6465

6566
extras: $ => [
@@ -1530,7 +1531,6 @@ module.exports = grammar({
15301531

15311532
// H is not a valid edit descriptor because it clashes with Hollerith constants
15321533
edit_descriptor: $ => /[a-gi-zA-GI-Z0-9/:.*$]+/,
1533-
hollerith_constant: $ => prec.right(10, /[0-9]+H[^/,)]+/),
15341534

15351535
_io_arguments: $ => seq(
15361536
'(',

src/grammar.json

Lines changed: 22 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
{
2-
"$schema": "https://tree-sitter.github.io/tree-sitter/assets/schemas/grammar.schema.json",
32
"name": "fortran",
43
"rules": {
54
"translation_unit": {
@@ -15993,14 +15992,6 @@
1599315992
"type": "PATTERN",
1599415993
"value": "[a-gi-zA-GI-Z0-9/:.*$]+"
1599515994
},
15996-
"hollerith_constant": {
15997-
"type": "PREC_RIGHT",
15998-
"value": 10,
15999-
"content": {
16000-
"type": "PATTERN",
16001-
"value": "[0-9]+H[^/,)]+"
16002-
}
16003-
},
1600415995
"_io_arguments": {
1600515996
"type": "SEQ",
1600615997
"members": [
@@ -20581,11 +20572,32 @@
2058120572
{
2058220573
"type": "SYMBOL",
2058320574
"name": "_preproc_unary_operator"
20575+
},
20576+
{
20577+
"type": "SYMBOL",
20578+
"name": "hollerith_constant"
2058420579
}
2058520580
],
2058620581
"inline": [
2058720582
"_top_level_item",
2058820583
"_statement"
2058920584
],
20590-
"supertypes": []
20585+
"supertypes": [],
20586+
"PREC": {
20587+
"ASSIGNMENT": -10,
20588+
"DEFAULT": 0,
20589+
"DEFINED_OPERATOR": 2,
20590+
"LOGICAL_EQUIV": 5,
20591+
"LOGICAL_OR": 10,
20592+
"LOGICAL_AND": 20,
20593+
"LOGICAL_NOT": 30,
20594+
"RELATIONAL": 40,
20595+
"ADDITIVE": 50,
20596+
"MULTIPLICATIVE": 60,
20597+
"EXPONENT": 70,
20598+
"CALL": 80,
20599+
"UNARY": 90,
20600+
"TYPE_MEMBER": 100
20601+
}
2059120602
}
20603+

src/node-types.json

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5807,11 +5807,6 @@
58075807
]
58085808
}
58095809
},
5810-
{
5811-
"type": "hollerith_constant",
5812-
"named": true,
5813-
"fields": {}
5814-
},
58155810
{
58165811
"type": "identifier",
58175812
"named": true,
@@ -12499,7 +12494,6 @@
1249912494
{
1250012495
"type": "translation_unit",
1250112496
"named": true,
12502-
"root": true,
1250312497
"fields": {},
1250412498
"children": {
1250512499
"multiple": true,
@@ -14057,6 +14051,10 @@
1405714051
"type": "grid_global",
1405814052
"named": false
1405914053
},
14054+
{
14055+
"type": "hollerith_constant",
14056+
"named": true
14057+
},
1406014058
{
1406114059
"type": "host",
1406214060
"named": false
@@ -14171,11 +14169,11 @@
1417114169
},
1417214170
{
1417314171
"type": "none",
14174-
"named": false
14172+
"named": true
1417514173
},
1417614174
{
1417714175
"type": "none",
14178-
"named": true
14176+
"named": false
1417914177
},
1418014178
{
1418114179
"type": "nopass",

0 commit comments

Comments
 (0)