File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -80,6 +80,8 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
8080
8181### Fixed
8282
83+ - Fixed nested syntax highlighting for derived type component accessors
84+ ([ #1114 ] ( https://github.com/fortran-lang/vscode-fortran-support/issues/1114 ) )
8385- Fixed inconsistent syntax highlighting of comments in Fixed Form
8486 ([ #923 ] ( https://github.com/fortran-lang/vscode-fortran-support/issues/923 ) )
8587- Fixed various bugs with syntax highlighting and ` FORMAT ` statements
Original file line number Diff line number Diff line change 20562056 }
20572057 },
20582058 "end" : " (?=[;!\\ n])" ,
2059+ "applyEndPatternLast" : 1 ,
20592060 "patterns" : [
20602061 {
20612062 "comment" : " type-bound subroutines" ,
2062- "begin" : " (?ix)\\ G\\ s*([a-z]\\ w*)(%)([a-z]\\ w*)\\ b\\ s*(?=\\ ()" ,
2063- "beginCaptures" : {
2064- "1" : {
2065- "name" : " variable.other.fortran"
2063+ "begin" : " (?ix)(?=\\ s*[a-z]\\ w*\\ s*%)" ,
2064+ "end" : " (?=[;!\\ n])" ,
2065+ "patterns" : [
2066+ {
2067+ "include" : " #comments"
20662068 },
2067- "2" : {
2068- "name" : " keyword.accessor.fortran"
2069+ {
2070+ "include" : " #line-continuation-operator"
2071+ },
2072+ {
2073+ "comment" : " Variable and accessor" ,
2074+ "match" : " (?ix)\\ s*([a-z]\\ w*)\\ s*(%)" ,
2075+ "captures" : {
2076+ "1" : {
2077+ "name" : " variable.other.fortran"
2078+ },
2079+ "2" : {
2080+ "name" : " keyword.accessor.fortran"
2081+ }
2082+ }
2083+ },
2084+ {
2085+ "comment" : " Final function" ,
2086+ "match" : " (?ix)\\ s*([a-z]\\ w*)" ,
2087+ "captures" : {
2088+ "1" : {
2089+ "name" : " entity.name.function.subroutine.fortran"
2090+ }
2091+ }
20692092 },
2070- "3" : {
2071- "name" : " entity.name.function.subroutine.fortran"
2072- }
2073- },
2074- "end" : " (?<!\\ G)" ,
2075- "endCaptures" : {
2076- "1" : {
2077- "name" : " punctuation.parentheses.right.fortran"
2078- }
2079- },
2080- "patterns" : [
20812093 {
20822094 "include" : " #parentheses-dummy-variables"
20832095 }
Original file line number Diff line number Diff line change 1+ module nested_types
2+ implicit none
3+ type :: A
4+ integer :: x
5+ contains
6+ procedure :: foo
7+ procedure :: bar
8+ end type A
9+
10+ type :: B
11+ type (A) :: a
12+ end type B
13+
14+ type :: C
15+ type (B) :: b
16+ end type C
17+
18+ contains
19+ subroutine foo (this )
20+ class(A), intent (inout ) :: this
21+ print * , " Value of x is:" , this% x
22+ end subroutine foo
23+
24+ subroutine bar (this , some_value )
25+ class(A), intent (inout ) :: this
26+ integer , intent (in ) :: some_value
27+ this% x = this% x + some_value
28+ print * , " Value of x after bar is:" , this% x
29+ end subroutine bar
30+
31+ end module nested_types
32+
33+ program mwe
34+ use nested_types
35+ implicit none
36+ type (A) :: a_inst
37+ type (C) :: c_inst
38+ c_inst% b% a% x = 42
39+ call a_inst% foo()
40+ call c_inst% b% a% foo()
41+ call &
42+ c_inst% b% a% bar(&
43+ ! some comment
44+ 8 + c_inst% b% a% x &
45+ )
46+ end program mwe
You can’t perform that action at this time.
0 commit comments