Skip to content

Commit bff654b

Browse files
Distinguish anonymous declarations
New type constructor `QualNameAnon` is added to the `QualName` type to distinguish anonymous declarations in binding specifications and select predicates. The string representation uses an `@` prefix. Example: `@SC_c` This character should not cause issues with regular expressions. This character is reserved for future use by YAML and must therefore be quoted. Example: ```yaml cname: '@S1_c' ```
1 parent b4c2920 commit bff654b

27 files changed

+254
-237
lines changed

hs-bindgen/fixtures/anonymous.bindingspec.yaml

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -8,47 +8,47 @@ types:
88
- Show
99
- Storable
1010
- headers: anonymous.h
11-
cname: S1_c
11+
cname: struct S2
1212
module: Example
13-
identifier: S1_c
13+
identifier: S2
1414
instances:
1515
- Eq
1616
- Show
1717
- Storable
1818
- headers: anonymous.h
19-
cname: struct S2
19+
cname: struct S3
2020
module: Example
21-
identifier: S2
21+
identifier: S3
2222
instances:
2323
- Eq
2424
- Show
2525
- Storable
2626
- headers: anonymous.h
27-
cname: S2_inner
27+
cname: '@S1_c'
2828
module: Example
29-
identifier: S2_inner
29+
identifier: S1_c
3030
instances:
3131
- Eq
3232
- Show
3333
- Storable
3434
- headers: anonymous.h
35-
cname: S2_inner_deep
35+
cname: '@S2_inner'
3636
module: Example
37-
identifier: S2_inner_deep
37+
identifier: S2_inner
3838
instances:
3939
- Eq
4040
- Show
4141
- Storable
4242
- headers: anonymous.h
43-
cname: struct S3
43+
cname: '@S2_inner_deep'
4444
module: Example
45-
identifier: S3
45+
identifier: S2_inner_deep
4646
instances:
4747
- Eq
4848
- Show
4949
- Storable
5050
- headers: anonymous.h
51-
cname: S3_c
51+
cname: '@S3_c'
5252
module: Example
5353
identifier: S3_c
5454
instances:

hs-bindgen/fixtures/attributes.bindingspec.yaml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,23 +16,23 @@ types:
1616
- Show
1717
- Storable
1818
- headers: attributes.h
19-
cname: baz
19+
cname: struct foo
2020
module: Example
21-
identifier: Baz
21+
identifier: Foo
2222
instances:
2323
- Eq
2424
- Show
2525
- Storable
2626
- headers: attributes.h
27-
cname: struct foo
27+
cname: '@baz'
2828
module: Example
29-
identifier: Foo
29+
identifier: Baz
3030
instances:
3131
- Eq
3232
- Show
3333
- Storable
3434
- headers: attributes.h
35-
cname: qux
35+
cname: '@qux'
3636
module: Example
3737
identifier: Qux
3838
instances:

hs-bindgen/fixtures/distilled_lib_1.bindingspec.yaml

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -18,65 +18,65 @@ types:
1818
- Real
1919
- Storable
2020
- headers: distilled_lib_1.h
21-
cname: a_typedef_enum_e
21+
cname: struct a_typedef_struct
2222
module: Example
23-
identifier: A_typedef_enum_e
23+
identifier: A_typedef_struct_t
2424
instances:
2525
- Eq
26-
- Ord
27-
- Read
2826
- Show
2927
- Storable
3028
- headers: distilled_lib_1.h
31-
cname: struct a_typedef_struct
29+
cname: callback_t
3230
module: Example
33-
identifier: A_typedef_struct_t
31+
identifier: Callback_t
3432
instances:
3533
- Eq
34+
- Ord
3635
- Show
3736
- Storable
3837
- headers: distilled_lib_1.h
39-
cname: another_typedef_enum_e
38+
cname: var_t
4039
module: Example
41-
identifier: Another_typedef_enum_e
40+
identifier: Var_t
4241
instances:
4342
- Eq
4443
- Ord
44+
- Enum
45+
- Ix
46+
- Bounded
4547
- Read
4648
- Show
49+
- Bits
50+
- FiniteBits
51+
- Integral
52+
- Num
53+
- Real
4754
- Storable
4855
- headers: distilled_lib_1.h
49-
cname: another_typedef_struct_t
56+
cname: '@a_typedef_enum_e'
5057
module: Example
51-
identifier: Another_typedef_struct_t
58+
identifier: A_typedef_enum_e
5259
instances:
5360
- Eq
61+
- Ord
62+
- Read
5463
- Show
5564
- Storable
5665
- headers: distilled_lib_1.h
57-
cname: callback_t
66+
cname: '@another_typedef_enum_e'
5867
module: Example
59-
identifier: Callback_t
68+
identifier: Another_typedef_enum_e
6069
instances:
6170
- Eq
6271
- Ord
72+
- Read
6373
- Show
6474
- Storable
6575
- headers: distilled_lib_1.h
66-
cname: var_t
76+
cname: '@another_typedef_struct_t'
6777
module: Example
68-
identifier: Var_t
78+
identifier: Another_typedef_struct_t
6979
instances:
7080
- Eq
71-
- Ord
72-
- Enum
73-
- Ix
74-
- Bounded
75-
- Read
7681
- Show
77-
- Bits
78-
- FiniteBits
79-
- Integral
80-
- Num
81-
- Real
8282
- Storable

hs-bindgen/fixtures/doxygen_docs.bindingspec.yaml

Lines changed: 31 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,4 @@
11
types:
2-
- headers: doxygen_docs.h
3-
cname: bitfield_t
4-
module: Example
5-
identifier: Bitfield_t
6-
instances:
7-
- Eq
8-
- Show
9-
- Storable
102
- headers: doxygen_docs.h
113
cname: enum color_enum
124
module: Example
@@ -17,28 +9,6 @@ types:
179
- Read
1810
- Show
1911
- Storable
20-
- headers: doxygen_docs.h
21-
cname: config_t
22-
module: Example
23-
identifier: Config_t
24-
instances:
25-
- Eq
26-
- Show
27-
- Storable
28-
- headers: doxygen_docs.h
29-
cname: data_union_t
30-
module: Example
31-
identifier: Data_union_t
32-
instances:
33-
- Storable
34-
- headers: doxygen_docs.h
35-
cname: data_union_t_as_parts
36-
module: Example
37-
identifier: Data_union_t_as_parts
38-
instances:
39-
- Eq
40-
- Show
41-
- Storable
4212
- headers: doxygen_docs.h
4313
cname: event_callback_t
4414
module: Example
@@ -100,7 +70,37 @@ types:
10070
- Real
10171
- Storable
10272
- headers: doxygen_docs.h
103-
cname: status_code_t
73+
cname: '@bitfield_t'
74+
module: Example
75+
identifier: Bitfield_t
76+
instances:
77+
- Eq
78+
- Show
79+
- Storable
80+
- headers: doxygen_docs.h
81+
cname: '@config_t'
82+
module: Example
83+
identifier: Config_t
84+
instances:
85+
- Eq
86+
- Show
87+
- Storable
88+
- headers: doxygen_docs.h
89+
cname: '@data_union_t'
90+
module: Example
91+
identifier: Data_union_t
92+
instances:
93+
- Storable
94+
- headers: doxygen_docs.h
95+
cname: '@data_union_t_as_parts'
96+
module: Example
97+
identifier: Data_union_t_as_parts
98+
instances:
99+
- Eq
100+
- Show
101+
- Storable
102+
- headers: doxygen_docs.h
103+
cname: '@status_code_t'
104104
module: Example
105105
identifier: Status_code_t
106106
instances:

hs-bindgen/fixtures/enum_cpp_syntax.bindingspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
types:
22
- headers: enum_cpp_syntax.h
3-
cname: foo_enum
3+
cname: '@foo_enum'
44
module: Example
55
identifier: Foo_enum
66
instances:

hs-bindgen/fixtures/enums.bindingspec.yaml

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,4 @@
11
types:
2-
- headers: enums.h
3-
cname: enumA
4-
module: Example
5-
identifier: EnumA
6-
instances:
7-
- Eq
8-
- Ord
9-
- Read
10-
- Show
11-
- Storable
122
- headers: enums.h
133
cname: enum enumB
144
module: Example
@@ -89,3 +79,13 @@ types:
8979
- Read
9080
- Show
9181
- Storable
82+
- headers: enums.h
83+
cname: '@enumA'
84+
module: Example
85+
identifier: EnumA
86+
instances:
87+
- Eq
88+
- Ord
89+
- Read
90+
- Show
91+
- Storable

hs-bindgen/fixtures/flam.bindingspec.yaml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,25 +16,25 @@ types:
1616
- Show
1717
- Storable
1818
- headers: flam.h
19-
cname: foo_bar
19+
cname: struct pascal
2020
module: Example
21-
identifier: Foo_bar
21+
identifier: Pascal
2222
instances:
2323
- Eq
2424
- Show
2525
- Storable
2626
- headers: flam.h
27-
cname: struct pascal
27+
cname: struct triplets
2828
module: Example
29-
identifier: Pascal
29+
identifier: Triplets
3030
instances:
3131
- Eq
3232
- Show
3333
- Storable
3434
- headers: flam.h
35-
cname: struct triplets
35+
cname: '@foo_bar'
3636
module: Example
37-
identifier: Triplets
37+
identifier: Foo_bar
3838
instances:
3939
- Eq
4040
- Show

hs-bindgen/fixtures/fun_attributes.bindingspec.yaml

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,4 @@
11
types:
2-
- headers: fun_attributes.h
3-
cname: FILE
4-
module: Example
5-
identifier: FILE
6-
instances:
7-
- Eq
8-
- Show
9-
- Storable
102
- headers: fun_attributes.h
113
cname: size_t
124
module: Example
@@ -25,3 +17,11 @@ types:
2517
- Num
2618
- Real
2719
- Storable
20+
- headers: fun_attributes.h
21+
cname: '@FILE'
22+
module: Example
23+
identifier: FILE
24+
instances:
25+
- Eq
26+
- Show
27+
- Storable

hs-bindgen/fixtures/globals.bindingspec.yaml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -41,31 +41,31 @@ types:
4141
- Show
4242
- Storable
4343
- headers: globals.h
44-
cname: struct1_t
44+
cname: struct tuple
4545
module: Example
46-
identifier: Struct1_t
46+
identifier: Tuple
4747
instances:
4848
- Eq
4949
- Show
5050
- Storable
5151
- headers: globals.h
52-
cname: struct2_t
52+
cname: '@struct1_t'
5353
module: Example
54-
identifier: Struct2_t
54+
identifier: Struct1_t
5555
instances:
5656
- Eq
5757
- Show
5858
- Storable
5959
- headers: globals.h
60-
cname: struct tuple
60+
cname: '@struct2_t'
6161
module: Example
62-
identifier: Tuple
62+
identifier: Struct2_t
6363
instances:
6464
- Eq
6565
- Show
6666
- Storable
6767
- headers: globals.h
68-
cname: version_t
68+
cname: '@version_t'
6969
module: Example
7070
identifier: Version_t
7171
instances:

0 commit comments

Comments
 (0)