Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
0a789c5
Pin tree-sitter v0.25.6 and regenerate parser
jgonzac Jun 9, 2025
e4da6b2
Fix `preproc_def` rule
jgonzac Jun 9, 2025
9acc874
Fix `unary_expression` precedence
ZedThree Jun 12, 2025
4597410
Merge pull request #150 from codee-com/fix-preproc_def
stadelmanma Jul 8, 2025
7021f9f
Merge pull request #153 from stadelmanma/fix-unary-precedence
stadelmanma Jul 8, 2025
3fb1c0b
Update highlights.scm to allow better support for detecting function …
BucketHatGirl Jul 31, 2025
8334abc
Merge pull request #155 from BucketHatGirl/patch-1
stadelmanma Aug 1, 2025
a83bbe5
Fix passing identifier to `fmt` keyword arg
ZedThree Aug 18, 2025
95b728f
Add node for `do` statement; rename `do` block node
ZedThree Sep 11, 2025
0eeb430
Bump tar-fs from 2.1.3 to 2.1.4
dependabot[bot] Sep 26, 2025
2d29f3a
Bump js-yaml from 3.14.1 to 3.14.2
dependabot[bot] Nov 21, 2025
62ece64
fix(cmake): expose wctype functions on BSD systems
MichaelHatherly Dec 2, 2025
7ee45f6
Merge pull request #161 from MichaelHatherly/mh/fix-freebsd-wctype-vi…
ZedThree Dec 2, 2025
1d8d5a3
Allow `do` as an identifier
ZedThree Dec 2, 2025
901797a
Merge pull request #158 from stadelmanma/do-statement
stadelmanma Dec 3, 2025
cec3292
Merge pull request #159 from stadelmanma/dependabot/npm_and_yarn/tar-…
stadelmanma Dec 3, 2025
d0d1bc8
Merge pull request #160 from stadelmanma/dependabot/npm_and_yarn/js-y…
stadelmanma Dec 3, 2025
0e1ea74
Parse inline preprocessor comments
inaki-amatria Jul 8, 2025
8696854
Allow `identifier`s in `data_value`'s `repeat`s
inaki-amatria Jul 8, 2025
67a17e3
Parse multiline preprocessor comments
inaki-amatria Jul 8, 2025
e013289
Merge pull request #154 from codee-com/upstream-grammar-improvements
stadelmanma Dec 10, 2025
210a9dc
Merge tree-sitter-fortran/master
inaki-amatria Dec 11, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,15 @@ project(tree-sitter-fortran
option(BUILD_SHARED_LIBS "Build using shared libraries" ON)
option(TREE_SITTER_REUSE_ALLOCATOR "Reuse the library allocator" OFF)

# Ensure wide character functions (iswblank, iswxdigit, etc.) are visible
# when compiling in strict C11 mode on POSIX systems
if(UNIX)
add_compile_definitions(_XOPEN_SOURCE=700)
if(CMAKE_SYSTEM_NAME MATCHES "FreeBSD|NetBSD|DragonFly|OpenBSD")
add_compile_definitions(_BSD_VISIBLE)
endif()
endif()

set(TREE_SITTER_ABI_VERSION 14 CACHE STRING "Tree-sitter ABI version")
if(NOT ${TREE_SITTER_ABI_VERSION} MATCHES "^[0-9]+$")
unset(TREE_SITTER_ABI_VERSION CACHE)
Expand Down
2 changes: 1 addition & 1 deletion codee/patches/0001-Add-TypeScript-source-annotation.patch
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ Subject: Add TypeScript source annotation
1 file changed, 6 insertions(+)

diff --git a/grammar.js b/grammar.js
index dd65a87..a89ba01 100644
index 8b9f384..4f84bdb 100644
--- a/grammar.js
+++ b/grammar.js
@@ -14,6 +14,12 @@
Expand Down
16 changes: 10 additions & 6 deletions codee/patches/0002-Unalias-keywords-that-are-identifier-s.patch
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,15 @@ Subject: Unalias keywords that are `identifier`s

so they don't show as unnamed children of `identifier`s nodes.
---
grammar.js | 126 ++++++++++++++++++------------------
grammar.js | 130 ++++++++++++++++++------------------
test/corpus/expressions.txt | 31 +++++++++
2 files changed, 94 insertions(+), 63 deletions(-)
2 files changed, 96 insertions(+), 65 deletions(-)

diff --git a/grammar.js b/grammar.js
index a89ba01..4e6a7f1 100644
index 4f84bdb..bd68a65 100644
--- a/grammar.js
+++ b/grammar.js
@@ -2281,69 +2281,69 @@ module.exports = grammar({
@@ -2292,71 +2292,71 @@ module.exports = grammar({
// add the keywords here -- and possibly in `conflicts` too.
identifier: $ => choice(
/[a-zA-Z_$][\w$]*/,
Expand All @@ -31,6 +31,7 @@ index a89ba01..4e6a7f1 100644
- caseInsensitive('data'),
- caseInsensitive('device'),
- prec(-1, caseInsensitive('dimension')),
- caseInsensitive('do'),
- caseInsensitive('double'),
- caseInsensitive('else'),
- caseInsensitive('elseif'),
Expand All @@ -43,6 +44,7 @@ index a89ba01..4e6a7f1 100644
- caseInsensitive('external'),
- caseInsensitive('fail'),
- prec(-1, caseInsensitive('flush')),
- caseInsensitive('fmt'),
- caseInsensitive('form'),
- caseInsensitive('format'),
- caseInsensitive('go'),
Expand Down Expand Up @@ -94,6 +96,7 @@ index a89ba01..4e6a7f1 100644
+ caseInsensitive('data', false),
+ caseInsensitive('device', false),
+ prec(-1, caseInsensitive('dimension', false)),
+ caseInsensitive('do', false),
+ caseInsensitive('double', false),
+ caseInsensitive('else', false),
+ caseInsensitive('elseif', false),
Expand All @@ -106,6 +109,7 @@ index a89ba01..4e6a7f1 100644
+ caseInsensitive('external', false),
+ caseInsensitive('fail', false),
+ prec(-1, caseInsensitive('flush', false)),
+ caseInsensitive('fmt', false),
+ caseInsensitive('form', false),
+ caseInsensitive('format', false),
+ caseInsensitive('go', false),
Expand Down Expand Up @@ -147,10 +151,10 @@ index a89ba01..4e6a7f1 100644

comment: $ => token(seq('!', /.*/)),
diff --git a/test/corpus/expressions.txt b/test/corpus/expressions.txt
index 7032b51..c5a8f3d 100644
index 384393d..63781fa 100644
--- a/test/corpus/expressions.txt
+++ b/test/corpus/expressions.txt
@@ -1348,3 +1348,34 @@ end program test
@@ -1355,3 +1355,34 @@ end program test
(comment)
(end_program_statement
(name))))
Expand Down
38 changes: 19 additions & 19 deletions codee/patches/0003-Add-semantic-accessors.patch
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ Subject: Add semantic accessors
6 files changed, 36 insertions(+), 23 deletions(-)

diff --git a/grammar.js b/grammar.js
index 4e6a7f1..d0af7b9 100644
index bd68a65..1289710 100644
--- a/grammar.js
+++ b/grammar.js
@@ -302,7 +302,11 @@ module.exports = grammar({
@@ -305,7 +305,11 @@ module.exports = grammar({
$.end_program_statement
),

Expand All @@ -29,7 +29,7 @@ index 4e6a7f1..d0af7b9 100644
end_program_statement: $ => blockStructureEnding($, 'program'),

module: $ => seq(
@@ -318,7 +322,11 @@ module.exports = grammar({
@@ -321,7 +325,11 @@ module.exports = grammar({
$.end_module_statement
),

Expand All @@ -42,7 +42,7 @@ index 4e6a7f1..d0af7b9 100644
end_module_statement: $ => blockStructureEnding($, 'module'),

submodule: $ => seq(
@@ -342,7 +350,7 @@ module.exports = grammar({
@@ -345,7 +353,7 @@ module.exports = grammar({
':', field('parent', $.module_name)
)),
')',
Expand All @@ -51,7 +51,7 @@ index 4e6a7f1..d0af7b9 100644
$._end_of_statement,
),
end_submodule_statement: $ => blockStructureEnding($, 'submodule'),
@@ -374,7 +382,7 @@ module.exports = grammar({
@@ -377,7 +385,7 @@ module.exports = grammar({
interface_statement: $ => seq(
optional($.abstract_specifier),
caseInsensitive('interface'),
Expand All @@ -60,7 +60,7 @@ index 4e6a7f1..d0af7b9 100644
$._end_of_statement,
),

@@ -768,8 +776,13 @@ module.exports = grammar({
@@ -771,8 +779,13 @@ module.exports = grammar({
optional($.statement_label),
caseInsensitive('type'),
choice(
Expand All @@ -76,7 +76,7 @@ index 4e6a7f1..d0af7b9 100644
),
optional(alias($.argument_list, $.derived_type_parameter_list)),
$._end_of_statement,
@@ -2048,7 +2061,7 @@ module.exports = grammar({
@@ -2059,7 +2072,7 @@ module.exports = grammar({
// precedence is used to prevent conflict with assignment expression
keyword_argument: $ => prec(1, seq(
field("name",$.identifier),
Expand Down Expand Up @@ -114,7 +114,7 @@ index ab165f0..9b2eccb 100644
(name)))
(end_program_statement)))
diff --git a/test/corpus/expressions.txt b/test/corpus/expressions.txt
index c5a8f3d..eb8b11c 100644
index 63781fa..cf7f6c4 100644
--- a/test/corpus/expressions.txt
+++ b/test/corpus/expressions.txt
@@ -159,7 +159,7 @@ END PROGRAM
Expand All @@ -135,7 +135,7 @@ index c5a8f3d..eb8b11c 100644
(variable_declaration
type: (intrinsic_type)
declarator: (init_declarator
@@ -717,7 +717,7 @@ END PROGRAM
@@ -724,7 +724,7 @@ END PROGRAM
(translation_unit
(program
(program_statement
Expand All @@ -145,10 +145,10 @@ index c5a8f3d..eb8b11c 100644
left: (identifier)
right: (call_expression
diff --git a/test/corpus/preprocessor.txt b/test/corpus/preprocessor.txt
index 4fe227d..29175d5 100644
index d9dd3a3..a42ff39 100644
--- a/test/corpus/preprocessor.txt
+++ b/test/corpus/preprocessor.txt
@@ -434,7 +434,7 @@ end program
@@ -453,7 +453,7 @@ end program
(translation_unit
(program
(program_statement
Expand All @@ -157,7 +157,7 @@ index 4fe227d..29175d5 100644
(use_statement
(module_name)
(included_items
@@ -522,7 +522,7 @@ end module foo
@@ -541,7 +541,7 @@ end module foo
(translation_unit
(module
(module_statement
Expand All @@ -166,7 +166,7 @@ index 4fe227d..29175d5 100644
(internal_procedures
(contains_statement)
(subroutine
@@ -572,7 +572,7 @@ end module foo
@@ -591,7 +591,7 @@ end module foo
(translation_unit
(module
(module_statement
Expand All @@ -175,7 +175,7 @@ index 4fe227d..29175d5 100644
(internal_procedures
(contains_statement)
(subroutine
@@ -632,7 +632,7 @@ end module foo
@@ -651,7 +651,7 @@ end module foo
(translation_unit
(module
(module_statement
Expand All @@ -198,7 +198,7 @@ index fc47bf1..1af946a 100644
left: (call_expression
(identifier)
diff --git a/test/corpus/statements.txt b/test/corpus/statements.txt
index ca8c86e..d6bebae 100644
index 2065d4f..96bef40 100644
--- a/test/corpus/statements.txt
+++ b/test/corpus/statements.txt
@@ -289,7 +289,7 @@ END PROGRAM
Expand All @@ -210,7 +210,7 @@ index ca8c86e..d6bebae 100644
(variable_declaration
type: (intrinsic_type)
attribute: (type_qualifier)
@@ -799,7 +799,7 @@ END PROGRAM TEST
@@ -805,7 +805,7 @@ END PROGRAM TEST
(translation_unit
(program
(program_statement
Expand All @@ -219,7 +219,7 @@ index ca8c86e..d6bebae 100644
(variable_declaration
type: (intrinsic_type)
attribute: (type_qualifier
@@ -1961,7 +1961,7 @@ END PROGRAM test
@@ -1987,7 +1987,7 @@ END PROGRAM test
(translation_unit
(program
(program_statement
Expand All @@ -228,7 +228,7 @@ index ca8c86e..d6bebae 100644
(enum
(enum_statement
(language_binding
@@ -2711,7 +2711,7 @@ end program test
@@ -2748,7 +2748,7 @@ end program test
(translation_unit
(program
(program_statement
Expand All @@ -237,7 +237,7 @@ index ca8c86e..d6bebae 100644
(allocate_statement
allocation: (sized_allocation
(identifier)
@@ -3499,7 +3499,7 @@ end program
@@ -3536,7 +3536,7 @@ end program
(translation_unit
(program
(program_statement
Expand Down
Loading