Skip to content

Commit 16e1cee

Browse files
techeemasatake
authored andcommitted
Fortran: report scope for interface and enum
I'm not quite sure why this was disabled (most probably because of missing anon tags) but scope isn't reported correctly without this.
1 parent 993905f commit 16e1cee

File tree

9 files changed

+53
-54
lines changed

9 files changed

+53
-54
lines changed

Units/parser-fortran.r/fortran-abstract-interface.d/expected.tags

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,5 @@ btype input.f90 /^ type, abstract, extends(atype) :: btype$/;" t module:test
66
c input.f90 /^ integer c,/;" L prototype:suba file:
77
d input.f90 /^ integer c, d$/;" L prototype:suba file:
88
self input.f90 /^ class(atype) :: self,/;" L prototype:suba file:
9-
suba input.f90 /^ subroutine suba(/;" P module:test
9+
suba input.f90 /^ subroutine suba(/;" P interface:__anonadfcf4320105
1010
test input.f90 /^module test$/;" m

Units/parser-fortran.r/fortran-bind-c.d/expected.tags

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@ __anon73f11bcd0105 input.f90 /^ interface$/;" i module:test_bind_c
22
a input.f90 /^ real/;" k type:atype
33
atype input.f90 /^ type, bind(c) :: atype$/;" t module:test_bind_c
44
global_flag input.f90 /^ integer(C_INT), bind(C, name="_MyProject_flags") :: global_flag$/;" v module:test_bind_c
5-
print_c input.f90 /^ subroutine print_c(/;" P module:test_bind_c
5+
print_c input.f90 /^ subroutine print_c(/;" P interface:__anon73f11bcd0105
66
test_bind_c input.f90 /^module test_bind_c$/;" m

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

Lines changed: 34 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -9,39 +9,39 @@ Named6 input.f90 /^ enum*8 :: Named6$/;" E module:Constants
99
Named7 input.f90 /^ enum, bind(c) :: Named7$/;" E module:Constants
1010
__anoncfbded350103 input.f90 /^ enum, bind(c) ! unnamed 1$/;" E module:Constants
1111
__anoncfbded350203 input.f90 /^ enum ! unnamed 2$/;" E module:Constants
12-
a input.f90 /^ enumerat/;" N module:Constants
13-
b input.f90 /^ enumerator :: a, b,/;" N module:Constants
14-
black input.f90 /^ enumerator :: red =1, blue, black /;" N module:Constants
15-
blue input.f90 /^ enumerator :: red =1, blue,/;" N module:Constants
16-
bronze input.f90 /^ enumerator gold, silver, bronze$/;" N module:Constants
17-
c input.f90 /^ enumerator :: a, b, c$/;" N module:Constants
18-
gold input.f90 /^ enumerator gold,/;" N 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
1919
hc input.f90 /^ real, parameter :: hc /;" v module:Constants
20-
lavender input.f90 /^ enumerator :: pink, lavender$/;" N module:Constants
20+
lavender input.f90 /^ enumerator :: pink, lavender$/;" N enum:__anoncfbded350103
2121
pi input.f90 /^ real, parameter :: pi /;" v module:Constants
22-
pink input.f90 /^ enumerator :: pink,/;" N module:Constants
23-
purple input.f90 /^ enumerator :: purple$/;" N module:Constants
24-
red input.f90 /^ enumerator :: red /;" N module:Constants
25-
silver input.f90 /^ enumerator gold, silver,/;" N module:Constants
26-
x1 input.f90 /^ enumerator :: x1,/;" N module:Constants
27-
x2 input.f90 /^ enumerator :: x2,/;" N module:Constants
28-
x3 input.f90 /^ enumerator :: x3,/;" N module:Constants
29-
x4 input.f90 /^ enumerator :: x4,/;" N module:Constants
30-
x5 input.f90 /^ enumerator :: x5,/;" N module:Constants
31-
x6 input.f90 /^ enumerator :: x6,/;" N module:Constants
32-
x7 input.f90 /^ enumerator :: x7,/;" N module:Constants
33-
y1 input.f90 /^ enumerator :: x1, y1,/;" N module:Constants
34-
y2 input.f90 /^ enumerator :: x2, y2,/;" N module:Constants
35-
y3 input.f90 /^ enumerator :: x3, y3,/;" N module:Constants
36-
y4 input.f90 /^ enumerator :: x4, y4,/;" N module:Constants
37-
y5 input.f90 /^ enumerator :: x5, y5,/;" N module:Constants
38-
y6 input.f90 /^ enumerator :: x6, y6,/;" N module:Constants
39-
y7 input.f90 /^ enumerator :: x7, y7,/;" N module:Constants
40-
yellow input.f90 /^ enumerator yellow$/;" N module:Constants
41-
z1 input.f90 /^ enumerator :: x1, y1, z1$/;" N module:Constants
42-
z2 input.f90 /^ enumerator :: x2, y2, z2$/;" N module:Constants
43-
z3 input.f90 /^ enumerator :: x3, y3, z3$/;" N module:Constants
44-
z4 input.f90 /^ enumerator :: x4, y4, z4$/;" N module:Constants
45-
z5 input.f90 /^ enumerator :: x5, y5, z5$/;" N module:Constants
46-
z6 input.f90 /^ enumerator :: x6, y6, z6$/;" N module:Constants
47-
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

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,6 @@ atype input.f90 /^ type atype$/;" t module:test_interface
55
get input.f90 /^ interface get$/;" i module:test_interface
66
get_1d input.f90 /^ subroutine get_1d(/;" s module:test_interface
77
get_2d input.f90 /^ subroutine get_2d(/;" s module:test_interface
8-
suba input.f90 /^ subroutine suba(/;" P module:test_interface
9-
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
1010
test_interface input.f90 /^module test_interface$/;" m

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,5 @@ b input.f90 /^ integer a, b$/;" L subroutine:suba file:
66
fna input.f90 /^ real function fna(/;" f module:test_signature
77
fnb input.f90 /^ subroutine fnb$/;" s module:test_signature
88
suba input.f90 /^ subroutine suba /;" s module:test_signature signature:(a, b)
9-
subb input.f90 /^ subroutine subb /;" P module:test_signature signature:(arg)
9+
subb input.f90 /^ subroutine subb /;" P interface:__anon06616a720105 signature:(arg)
1010
test_signature input.f90 /^module test_signature$/;" m
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
__anon1963f93b0305 input.f90 /^ interface$/;" i module:numerical_libraries
22
__anon1963f93b0405 input.f90 /^ interface$/;" i prototype:b2lsf
3-
a2ald input.f90 /^ subroutine a2ald /;" P module:numerical_libraries
4-
b2lsf input.f90 /^ subroutine b2lsf /;" P module:numerical_libraries
5-
fcn input.f90 /^ subroutine fcn(/;" P 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
66
numerical_libraries input.f90 /^ module numerical_libraries$/;" m

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

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,14 @@ __anon8fb642160105 input.f95 /^ $/;" i module:approx
22
__anon8fb642160205 input.f95 /^ $/;" i module:approx2
33
approx input.f95 /^ MODULE approx$/;" m
44
approx2 input.f95 /^ MODULE approx2$/;" m
5-
arcsin input.f95 /^ recursive function arcsin /;" P module:approx
6-
arcsin1 input.f95 /^ recursive function arcsin1 /;" P module:approx
7-
arcsin2 input.f95 /^ double precision recursive function arcsin2 /;" P module:approx
8-
arcsin3 input.f95 /^ recursive double precision function arcsin3 /;" P module:approx
9-
as input.f95 /^ double precision recursive function as /;" P module:approx2
10-
as1 input.f95 /^ recursive double precision function as1 /;" P module:approx2
11-
as2 input.f95 /^ recursive function as2 /;" P module:approx2
12-
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
1313
parts input.f95 /^ integer :: parts$/;" v module:approx
1414
parts2 input.f95 /^ integer :: parts2$/;" v module:approx2
1515
y input.f95 /^ double precision :: y$/;" v module:approx

Units/parser-fypp.r/run-guest.d/expected.tags

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,6 @@ get_1d input.fy /^ subroutine get_1d(/;" s line:55 module:test_interface
88
get_2d input.fy /^ subroutine get_2d(/;" s line:62 module:test_interface
99
helloworld input.fy /^program helloworld$/;" p line:17
1010
repeat_code input.fy /^#:def repeat_code(code, repeat)$/;" m line:23 end:27
11-
suba input.fy /^ subroutine suba(/;" P line:40 module:test_interface
12-
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
1313
test_interface input.fy /^module test_interface$/;" m line:21

parsers/fortran.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -409,8 +409,7 @@ static const tokenInfo* ancestorScope (void)
409409
{
410410
tokenInfo *const token = Ancestors.list + i - 1;
411411
if (token->type == TOKEN_IDENTIFIER &&
412-
token->tag != TAG_UNDEFINED && token->tag != TAG_INTERFACE &&
413-
token->tag != TAG_ENUM)
412+
token->tag != TAG_UNDEFINED)
414413
result = token;
415414
}
416415
return result;

0 commit comments

Comments
 (0)