stadelmanma / tree-sitter-fortran

Fortran grammar for tree-sitter
MIT License
30 stars 15 forks source link

Support intrinsic variable declarations #5

Closed stadelmanma closed 6 years ago

stadelmanma commented 6 years ago

This simply means supporting the various static typing declarations that appear at the beginning of any Fortran program, module, subroutine or function (i.e. INTEGER :: i, j, k). A type declaration can be a couple of things, first simple identifiers, array or character declarations that provide the size of the variable and finally an assignment expression.

It may be better to only allow a subset of expressions (i.e. identifier and call) in declarations to minimize conflicts. A declaration specific form of assignment that doesn't allow any arbitrary expression as it's target might also be good (i.e. no derived type member as the target).

I also need to check if pointers can be declared and associated at the same time.

Derived type declarations will be done separately, this might include supporting the TYPE(...) declaration.