Skip to content

Commit

Permalink
Fix Hollerith constants inside Format statement
Browse files Browse the repository at this point in the history
  • Loading branch information
jgonzac committed Feb 21, 2025
1 parent 022b032 commit ac56867
Show file tree
Hide file tree
Showing 8 changed files with 408,651 additions and 408,883 deletions.
2 changes: 1 addition & 1 deletion grammar.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ module.exports = grammar({
$._string_literal_kind,
$._external_end_of_statement,
$._preproc_unary_operator,
$.hollerith_constant,
],

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

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

_io_arguments: $ => seq(
'(',
Expand Down
32 changes: 22 additions & 10 deletions src/grammar.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
{
"$schema": "https://tree-sitter.github.io/tree-sitter/assets/schemas/grammar.schema.json",
"name": "fortran",
"rules": {
"translation_unit": {
Expand Down Expand Up @@ -15993,14 +15992,6 @@
"type": "PATTERN",
"value": "[a-gi-zA-GI-Z0-9/:.*$]+"
},
"hollerith_constant": {
"type": "PREC_RIGHT",
"value": 10,
"content": {
"type": "PATTERN",
"value": "[0-9]+H[^/,)]+"
}
},
"_io_arguments": {
"type": "SEQ",
"members": [
Expand Down Expand Up @@ -20581,11 +20572,32 @@
{
"type": "SYMBOL",
"name": "_preproc_unary_operator"
},
{
"type": "SYMBOL",
"name": "hollerith_constant"
}
],
"inline": [
"_top_level_item",
"_statement"
],
"supertypes": []
"supertypes": [],
"PREC": {
"ASSIGNMENT": -10,
"DEFAULT": 0,
"DEFINED_OPERATOR": 2,
"LOGICAL_EQUIV": 5,
"LOGICAL_OR": 10,
"LOGICAL_AND": 20,
"LOGICAL_NOT": 30,
"RELATIONAL": 40,
"ADDITIVE": 50,
"MULTIPLICATIVE": 60,
"EXPONENT": 70,
"CALL": 80,
"UNARY": 90,
"TYPE_MEMBER": 100
}
}

14 changes: 6 additions & 8 deletions src/node-types.json
Original file line number Diff line number Diff line change
Expand Up @@ -5807,11 +5807,6 @@
]
}
},
{
"type": "hollerith_constant",
"named": true,
"fields": {}
},
{
"type": "identifier",
"named": true,
Expand Down Expand Up @@ -12499,7 +12494,6 @@
{
"type": "translation_unit",
"named": true,
"root": true,
"fields": {},
"children": {
"multiple": true,
Expand Down Expand Up @@ -14057,6 +14051,10 @@
"type": "grid_global",
"named": false
},
{
"type": "hollerith_constant",
"named": true
},
{
"type": "host",
"named": false
Expand Down Expand Up @@ -14171,11 +14169,11 @@
},
{
"type": "none",
"named": false
"named": true
},
{
"type": "none",
"named": true
"named": false
},
{
"type": "nopass",
Expand Down
Loading

0 comments on commit ac56867

Please sign in to comment.