Skip to content

Commit

Permalink
Fix incomplete procedure pointer continuation (#53)
Browse files Browse the repository at this point in the history
* Adds escape in case of incomplete procedure pointer statement
  • Loading branch information
eirik-kjonstad authored Apr 25, 2021
1 parent f6a689b commit 0a16258
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 0 deletions.
4 changes: 4 additions & 0 deletions modern-fortran.sublime-syntax
Original file line number Diff line number Diff line change
Expand Up @@ -452,6 +452,10 @@ contexts:
- include: separators
- include: attribute
- include: pointer-symbol
- match: (?=\b(end|procedure|final|generic)\b)
pop: true
# this pop makes sure we don't recognize the "end type" or the next routine declaration
# as a function name when typing "procedure :: myProcedure &"
- match: \w+
scope: entity.name.function.fortran
- match: \n
Expand Down
39 changes: 39 additions & 0 deletions syntax_test_fortran.F90
Original file line number Diff line number Diff line change
Expand Up @@ -885,3 +885,42 @@ MODULE SUBROUTINE MY_SUBROUTINE(A, B, C)
! ^^^^^^ keyword.control.import.fortran
! ^^^^^^^^^ variable.other.fortran
!
procedure, private :: myProcedure &

end type myProcedure
! ^^^ keyword.declaration.class.fortran
! ^^^^ keyword.declaration.class.fortran
! ^^^^^^^^^^^ entity.name.class.fortran
!
procedure, private :: myProcedure &
! ^^^^^^^^^ keyword.declaration.function.fortran
! ^ punctuation.separator.comma.fortran
! ^^^^^^^ storage.modifier.fortran
! ^^ punctuation.separator.double-colon.fortran
! ^^^^^^^^^^^ entity.name.function.fortran

procedure :: otherProcedure
! ^^ punctuation.separator.double-colon.fortran
! ^^^^^^^^^ keyword.declaration.function.fortran
! ^^^^^^^^^^^^^^ entity.name.function.fortran

end type myProcedure
! ^^^ keyword.declaration.class.fortran
! ^^^^ keyword.declaration.class.fortran
! ^^^^^^^^^^^ entity.name.class.fortran
procedure, private :: myProcedure &
! ^^^^^^^^^ keyword.declaration.function.fortran
! ^ punctuation.separator.comma.fortran
! ^^^^^^^ storage.modifier.fortran
! ^^ punctuation.separator.double-colon.fortran
! ^^^^^^^^^^^ entity.name.function.fortran

final :: otherProcedure &
! ^^^^^ keyword.declaration.function.fortran
! ^^ punctuation.separator.double-colon.fortran
! ^^^^^^^^^^^^^^ entity.name.function.fortran
!
end type myProcedure
! ^^^ keyword.declaration.class.fortran
! ^^^^ keyword.declaration.class.fortran
! ^^^^^^^^^^^ entity.name.class.fortran

0 comments on commit 0a16258

Please sign in to comment.