stadelmanma / tree-sitter-fortran

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

Support include, use, implicit and format statements #12

Closed stadelmanma closed 6 years ago

stadelmanma commented 6 years ago

This will finish out the rest of the "specification_part" of a Fortran program. Once this is completed I can move on to supporting function and subroutines which will reuse the "specification_part". Additionally, it may be worthwhile to make a separate "executable_part" that can be reused in them as well.

use statement syntaxes

USE ISO_C_BINDING
USE ISO_FORTRAN_ENV, ONLY : ERROR_UNIT, OUTPUT_UNIT

Include statements have to be followed by a character literal, they can also appear anywhere in the program as they are similar in nature to pre-processor directives. Additional details on include statements: https://gcc.gnu.org/onlinedocs/gcc-3.4.4/g77/INCLUDE.html

INLCUDE 'fftw.f03'

Implicit statements have a similar design to equivalence statements. See: https://docs.oracle.com/cd/E19957-01/805-4939/6j4m0vn9v/index.html

IMPLICIT COMPLEX (U,V,W), CHARACTER*4 (C,S)
IMPLICIT UNDEFINED(A-Z)
IMPLICIT NONE 
stadelmanma commented 6 years ago

undefined, static and automatic values in the implicit statement cause an error so I am going to drop them which will allow me to use basic intrinsic types.