Skip to content

Commit ea9afbb

Browse files
authored
Merge pull request #3240 from masatake/techee-fortran-reordered
Fortran: minor changes for merging #3237 Close #3237. The order of commits was rearranged, and s/fortran/Fortran/ in commit headers. ---- Fortran parser improvements from Geany (#3237) These are various improvements we had in Geany for the Fortran parser: reporting of anonymous tags reporting scopes for interfaces and enums allowing keyword names to be used as names of various Fortran types Note: I don't know what I'm doing much, I don't know Fortran and it's possible I'm doing something wrong - the patches are just based on what is present in Geany to allow us to use the uctags Fortran parser with correct scope information.
2 parents b4f0dfb + 16e1cee commit ea9afbb

File tree

11 files changed

+122
-87
lines changed

11 files changed

+122
-87
lines changed
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
1+
__anonadfcf4320105 input.f90 /^ abstract interface$/;" i module:test
12
add input.f90 /^ procedure(suba), deferred :: add$/;" M type:atype
23
atype input.f90 /^ type, abstract :: atype$/;" t module:test
34
b input.f90 /^ class(atype) :: self, b$/;" L prototype:suba file:
45
btype input.f90 /^ type, abstract, extends(atype) :: btype$/;" t module:test
56
c input.f90 /^ integer c,/;" L prototype:suba file:
67
d input.f90 /^ integer c, d$/;" L prototype:suba file:
78
self input.f90 /^ class(atype) :: self,/;" L prototype:suba file:
8-
suba input.f90 /^ subroutine suba(/;" P module:test
9+
suba input.f90 /^ subroutine suba(/;" P interface:__anonadfcf4320105
910
test input.f90 /^module test$/;" m
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1+
__anon73f11bcd0105 input.f90 /^ interface$/;" i module:test_bind_c
12
a input.f90 /^ real/;" k type:atype
23
atype input.f90 /^ type, bind(c) :: atype$/;" t module:test_bind_c
34
global_flag input.f90 /^ integer(C_INT), bind(C, name="_MyProject_flags") :: global_flag$/;" v module:test_bind_c
4-
print_c input.f90 /^ subroutine print_c(/;" P module:test_bind_c
5+
print_c input.f90 /^ subroutine print_c(/;" P interface:__anon73f11bcd0105
56
test_bind_c input.f90 /^module test_bind_c$/;" m

Units/parser-fortran.r/fortran-enum.d/expected.tags

Lines changed: 36 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -7,39 +7,41 @@ Named4 input.f90 /^ enum*8 Named4$/;" E module:Constants
77
Named5 input.f90 /^ enum(8) :: Named5$/;" E module:Constants
88
Named6 input.f90 /^ enum*8 :: Named6$/;" E module:Constants
99
Named7 input.f90 /^ enum, bind(c) :: Named7$/;" E module:Constants
10-
a input.f90 /^ enumerat/;" N module:Constants
11-
b input.f90 /^ enumerator :: a, b,/;" N module:Constants
12-
black input.f90 /^ enumerator :: red =1, blue, black /;" N module:Constants
13-
blue input.f90 /^ enumerator :: red =1, blue,/;" N module:Constants
14-
bronze input.f90 /^ enumerator gold, silver, bronze$/;" N module:Constants
15-
c input.f90 /^ enumerator :: a, b, c$/;" N module:Constants
16-
gold input.f90 /^ enumerator gold,/;" N module:Constants
10+
__anoncfbded350103 input.f90 /^ enum, bind(c) ! unnamed 1$/;" E module:Constants
11+
__anoncfbded350203 input.f90 /^ enum ! unnamed 2$/;" E module:Constants
12+
a input.f90 /^ enumerat/;" N enum:__anoncfbded350203
13+
b input.f90 /^ enumerator :: a, b,/;" N enum:__anoncfbded350203
14+
black input.f90 /^ enumerator :: red =1, blue, black /;" N enum:__anoncfbded350103
15+
blue input.f90 /^ enumerator :: red =1, blue,/;" N enum:__anoncfbded350103
16+
bronze input.f90 /^ enumerator gold, silver, bronze$/;" N enum:__anoncfbded350103
17+
c input.f90 /^ enumerator :: a, b, c$/;" N enum:__anoncfbded350203
18+
gold input.f90 /^ enumerator gold,/;" N enum:__anoncfbded350103
1719
hc input.f90 /^ real, parameter :: hc /;" v module:Constants
18-
lavender input.f90 /^ enumerator :: pink, lavender$/;" N module:Constants
20+
lavender input.f90 /^ enumerator :: pink, lavender$/;" N enum:__anoncfbded350103
1921
pi input.f90 /^ real, parameter :: pi /;" v module:Constants
20-
pink input.f90 /^ enumerator :: pink,/;" N module:Constants
21-
purple input.f90 /^ enumerator :: purple$/;" N module:Constants
22-
red input.f90 /^ enumerator :: red /;" N module:Constants
23-
silver input.f90 /^ enumerator gold, silver,/;" N module:Constants
24-
x1 input.f90 /^ enumerator :: x1,/;" N module:Constants
25-
x2 input.f90 /^ enumerator :: x2,/;" N module:Constants
26-
x3 input.f90 /^ enumerator :: x3,/;" N module:Constants
27-
x4 input.f90 /^ enumerator :: x4,/;" N module:Constants
28-
x5 input.f90 /^ enumerator :: x5,/;" N module:Constants
29-
x6 input.f90 /^ enumerator :: x6,/;" N module:Constants
30-
x7 input.f90 /^ enumerator :: x7,/;" N module:Constants
31-
y1 input.f90 /^ enumerator :: x1, y1,/;" N module:Constants
32-
y2 input.f90 /^ enumerator :: x2, y2,/;" N module:Constants
33-
y3 input.f90 /^ enumerator :: x3, y3,/;" N module:Constants
34-
y4 input.f90 /^ enumerator :: x4, y4,/;" N module:Constants
35-
y5 input.f90 /^ enumerator :: x5, y5,/;" N module:Constants
36-
y6 input.f90 /^ enumerator :: x6, y6,/;" N module:Constants
37-
y7 input.f90 /^ enumerator :: x7, y7,/;" N module:Constants
38-
yellow input.f90 /^ enumerator yellow$/;" N module:Constants
39-
z1 input.f90 /^ enumerator :: x1, y1, z1$/;" N module:Constants
40-
z2 input.f90 /^ enumerator :: x2, y2, z2$/;" N module:Constants
41-
z3 input.f90 /^ enumerator :: x3, y3, z3$/;" N module:Constants
42-
z4 input.f90 /^ enumerator :: x4, y4, z4$/;" N module:Constants
43-
z5 input.f90 /^ enumerator :: x5, y5, z5$/;" N module:Constants
44-
z6 input.f90 /^ enumerator :: x6, y6, z6$/;" N module:Constants
45-
z7 input.f90 /^ enumerator :: x7, y7, z7$/;" N module:Constants
22+
pink input.f90 /^ enumerator :: pink,/;" N enum:__anoncfbded350103
23+
purple input.f90 /^ enumerator :: purple$/;" N enum:__anoncfbded350103
24+
red input.f90 /^ enumerator :: red /;" N enum:__anoncfbded350103
25+
silver input.f90 /^ enumerator gold, silver,/;" N enum:__anoncfbded350103
26+
x1 input.f90 /^ enumerator :: x1,/;" N enum:Named1
27+
x2 input.f90 /^ enumerator :: x2,/;" N enum:Named2
28+
x3 input.f90 /^ enumerator :: x3,/;" N enum:Named3
29+
x4 input.f90 /^ enumerator :: x4,/;" N enum:Named4
30+
x5 input.f90 /^ enumerator :: x5,/;" N enum:Named5
31+
x6 input.f90 /^ enumerator :: x6,/;" N enum:Named6
32+
x7 input.f90 /^ enumerator :: x7,/;" N enum:Named7
33+
y1 input.f90 /^ enumerator :: x1, y1,/;" N enum:Named1
34+
y2 input.f90 /^ enumerator :: x2, y2,/;" N enum:Named2
35+
y3 input.f90 /^ enumerator :: x3, y3,/;" N enum:Named3
36+
y4 input.f90 /^ enumerator :: x4, y4,/;" N enum:Named4
37+
y5 input.f90 /^ enumerator :: x5, y5,/;" N enum:Named5
38+
y6 input.f90 /^ enumerator :: x6, y6,/;" N enum:Named6
39+
y7 input.f90 /^ enumerator :: x7, y7,/;" N enum:Named7
40+
yellow input.f90 /^ enumerator yellow$/;" N enum:__anoncfbded350103
41+
z1 input.f90 /^ enumerator :: x1, y1, z1$/;" N enum:Named1
42+
z2 input.f90 /^ enumerator :: x2, y2, z2$/;" N enum:Named2
43+
z3 input.f90 /^ enumerator :: x3, y3, z3$/;" N enum:Named3
44+
z4 input.f90 /^ enumerator :: x4, y4, z4$/;" N enum:Named4
45+
z5 input.f90 /^ enumerator :: x5, y5, z5$/;" N enum:Named5
46+
z6 input.f90 /^ enumerator :: x6, y6, z6$/;" N enum:Named6
47+
z7 input.f90 /^ enumerator :: x7, y7, z7$/;" N enum:Named7
Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
+ input.f90 /^ interface operator(+)/;" i module:test_interface
2+
__anon502b83b10105 input.f90 /^ interface ! anonymous interface$/;" i module:test_interface
23
add input.f90 /^ type(atype) function add(/;" P module:test_interface
34
atype input.f90 /^ type atype$/;" t module:test_interface
45
get input.f90 /^ interface get$/;" i module:test_interface
56
get_1d input.f90 /^ subroutine get_1d(/;" s module:test_interface
67
get_2d input.f90 /^ subroutine get_2d(/;" s module:test_interface
7-
suba input.f90 /^ subroutine suba(/;" P module:test_interface
8-
subb input.f90 /^ subroutine subb(/;" P module:test_interface
8+
suba input.f90 /^ subroutine suba(/;" P interface:__anon502b83b10105
9+
subb input.f90 /^ subroutine subb(/;" P interface:__anon502b83b10105
910
test_interface input.f90 /^module test_interface$/;" m
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
1+
__anon06616a720105 input.f90 /^ interface$/;" i module:test_signature
12
a input.f90 /^ integer :: a$/;" L subroutine:fnb file:
23
a input.f90 /^ integer a,/;" L subroutine:suba file:
34
arg input.f90 /^ type(atype) :: arg$/;" L prototype:subb file:
45
b input.f90 /^ integer a, b$/;" L subroutine:suba file:
56
fna input.f90 /^ real function fna(/;" f module:test_signature
67
fnb input.f90 /^ subroutine fnb$/;" s module:test_signature
78
suba input.f90 /^ subroutine suba /;" s module:test_signature signature:(a, b)
8-
subb input.f90 /^ subroutine subb /;" P module:test_signature signature:(arg)
9+
subb input.f90 /^ subroutine subb /;" P interface:__anon06616a720105 signature:(arg)
910
test_signature input.f90 /^module test_signature$/;" m

Units/parser-fortran.r/fortran-submodule.d/expected.tags

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,6 @@ example_smod input.f90 /^submodule (example_mod) example_smod$/;" submodule inhe
22
g input.f90 /^ module function g(/;" function submodule:example_smod
33
example_ssmod input.f90 /^submodule (example_mod:example_smod) example_ssmod$/;" submodule inherits:example_mod:example_smod
44
g2 input.f90 /^ module function g2(/;" function submodule:example_ssmod
5-
x input.f90 /^ integer :: x,/;" variable
6-
y input.f90 /^ integer :: x,y$/;" variable
5+
function input.f90 /^ module function /;" module
6+
x input.f90 /^ integer :: x,/;" variable module:function
7+
y input.f90 /^ integer :: x,y$/;" variable module:function
Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
a2ald input.f90 /^ subroutine a2ald /;" P module:numerical_libraries
2-
b2lsf input.f90 /^ subroutine b2lsf /;" P module:numerical_libraries
3-
fcn input.f90 /^ subroutine fcn(/;" P prototype:b2lsf
1+
__anon1963f93b0305 input.f90 /^ interface$/;" i module:numerical_libraries
2+
__anon1963f93b0405 input.f90 /^ interface$/;" i prototype:b2lsf
3+
a2ald input.f90 /^ subroutine a2ald /;" P interface:__anon1963f93b0305
4+
b2lsf input.f90 /^ subroutine b2lsf /;" P interface:__anon1963f93b0305
5+
fcn input.f90 /^ subroutine fcn(/;" P interface:__anon1963f93b0405
46
numerical_libraries input.f90 /^ module numerical_libraries$/;" m

Units/parser-fortran.r/recursive.f95.d/expected.tags

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,15 @@
1+
__anon8fb642160105 input.f95 /^ $/;" i module:approx
2+
__anon8fb642160205 input.f95 /^ $/;" i module:approx2
13
approx input.f95 /^ MODULE approx$/;" m
24
approx2 input.f95 /^ MODULE approx2$/;" m
3-
arcsin input.f95 /^ recursive function arcsin /;" P module:approx
4-
arcsin1 input.f95 /^ recursive function arcsin1 /;" P module:approx
5-
arcsin2 input.f95 /^ double precision recursive function arcsin2 /;" P module:approx
6-
arcsin3 input.f95 /^ recursive double precision function arcsin3 /;" P module:approx
7-
as input.f95 /^ double precision recursive function as /;" P module:approx2
8-
as1 input.f95 /^ recursive double precision function as1 /;" P module:approx2
9-
as2 input.f95 /^ recursive function as2 /;" P module:approx2
10-
as3 input.f95 /^ recursive function as3 /;" P module:approx2
5+
arcsin input.f95 /^ recursive function arcsin /;" P interface:__anon8fb642160105
6+
arcsin1 input.f95 /^ recursive function arcsin1 /;" P interface:__anon8fb642160105
7+
arcsin2 input.f95 /^ double precision recursive function arcsin2 /;" P interface:__anon8fb642160105
8+
arcsin3 input.f95 /^ recursive double precision function arcsin3 /;" P interface:__anon8fb642160105
9+
as input.f95 /^ double precision recursive function as /;" P interface:__anon8fb642160205
10+
as1 input.f95 /^ recursive double precision function as1 /;" P interface:__anon8fb642160205
11+
as2 input.f95 /^ recursive function as2 /;" P interface:__anon8fb642160205
12+
as3 input.f95 /^ recursive function as3 /;" P interface:__anon8fb642160205
1113
parts input.f95 /^ integer :: parts$/;" v module:approx
1214
parts2 input.f95 /^ integer :: parts2$/;" v module:approx2
1315
y input.f95 /^ double precision :: y$/;" v module:approx

Units/parser-fortran.r/structure.f.d/expected.tags

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
a input.f /^ integer a$/;" k type:anonymous
1+
__anon76fabc930106 input.f /^ structure level3a, level3b$/;" t type:nested
2+
a input.f /^ integer a$/;" k type:__anon76fabc930106
23
clouds input.f /^ character*20 clouds /;" k type:weather
34
clouds input.f /^ character*20 clouds$/;" k type:weather
45
day input.f /^ integer*1 month \/08\/, day /;" k type:weather
Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
+ input.fy /^ interface operator(+)/;" i line:31 module:test_interface
2+
__anonca2bcf340105 input.fy /^ interface ! anonymous interface$/;" i line:39 module:test_interface
23
add input.fy /^ type(atype) function add(/;" P line:33 module:test_interface
34
atype input.fy /^ type atype$/;" t line:28 module:test_interface
45
debug_code input.fy /^#:def debug_code(code)$/;" m line:4 end:8
@@ -7,6 +8,6 @@ get_1d input.fy /^ subroutine get_1d(/;" s line:55 module:test_interface
78
get_2d input.fy /^ subroutine get_2d(/;" s line:62 module:test_interface
89
helloworld input.fy /^program helloworld$/;" p line:17
910
repeat_code input.fy /^#:def repeat_code(code, repeat)$/;" m line:23 end:27
10-
suba input.fy /^ subroutine suba(/;" P line:40 module:test_interface
11-
subb input.fy /^ subroutine subb(/;" P line:42 module:test_interface
11+
suba input.fy /^ subroutine suba(/;" P line:40 interface:__anonca2bcf340105
12+
subb input.fy /^ subroutine subb(/;" P line:42 interface:__anonca2bcf340105
1213
test_interface input.fy /^module test_interface$/;" m line:21

0 commit comments

Comments
 (0)