tree-sitter-fortran
tree-sitter-fortran copied to clipboard
Fortran grammar for tree-sitter
Not a bug, but I've added functionality upstream to allow for the case-insensitive regex flag, so `/foo/i` would work now. Hope it might help here.
~~Built on top of #87 to avoid massive conflicts, new commits are [354e376](https://github.com/stadelmanma/tree-sitter-fortran/pull/92/commits/354e3767af4de66b0ad5e045efe202fcee7c08d8) onwards~~ Closes #75 Closes #86 Closes #88 - Separate kind suffixes on number literals so they appear...
Currently variable declarations like the following: ```fortran INTEGER :: l(*) ``` get parsed like as: ```lisp (variable_declaration (intrinsic_type) (call_expression (identifier) (argument_list (assumed_size)))) ``` I'm not keen on the `call_expression` there...
Example from wikipedia: ```fortran program Hello_World implicit none integer :: i ! Local variable character(len=20) :: name[*] ! scalar coarray, one "name" for each image. ! Note: "name" is the...
User defined types can have `len` and `kind` parameters: ```fortran type foo(nlen) integer, len :: nlen character(nlen) :: name end type ```
Given that fortran and C both use the same preprocessor I can probably copy these over directly without too many changes.
Once I have all the key features I know of implemented I will want to do broad testing against real Fortran code bases to see if there was anything I...
Currently, parameterised intrinsic types such as: ```fortran real(kind=real64) :: var character(len=:) :: char ``` are parsed like: ```lisp (variable_declaration (intrinsic_type) (size (argument_list (keyword_argument (identifier) (identifier)))) (identifier)) (variable_declaration (intrinsic_type) (size (argument_list...
Add queries
We should add queries, similar to https://github.com/tree-sitter/tree-sitter-python/tree/master/queries which can be used to highlight, fold, indent Fortran source files. Relevant documentation: https://tree-sitter.github.io/tree-sitter/using-parsers#pattern-matching-with-queries Query files to add: - [x] `highlights.scm` - [x]...