Skip to content

Commit 9f0ea73

Browse files
authored
chore: replace generate/select.ml with cppo (#2763)
* chore: replace generate/select.ml with cppo * fix dune file * wip * wip * fix version
1 parent 664a4df commit 9f0ea73

19 files changed

+23
-436
lines changed

ORIGINS.md

-208
Original file line numberDiff line numberDiff line change
@@ -51,211 +51,3 @@ CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
5151
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
5252
IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
5353
DEALINGS IN THE SOFTWARE.
54-
55-
---
56-
57-
`./src/generate` is a fork of [ppx_ast](https://github.com/janestreet/ppx_ast/tree/master/generate), which is licensed under Apache License 2.0.
58-
59-
---
60-
61-
Apache License
62-
Version 2.0, January 2004
63-
http://www.apache.org/licenses/
64-
65-
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
66-
67-
1. Definitions.
68-
69-
"License" shall mean the terms and conditions for use, reproduction,
70-
and distribution as defined by Sections 1 through 9 of this document.
71-
72-
"Licensor" shall mean the copyright owner or entity authorized by
73-
the copyright owner that is granting the License.
74-
75-
"Legal Entity" shall mean the union of the acting entity and all
76-
other entities that control, are controlled by, or are under common
77-
control with that entity. For the purposes of this definition,
78-
"control" means (i) the power, direct or indirect, to cause the
79-
direction or management of such entity, whether by contract or
80-
otherwise, or (ii) ownership of fifty percent (50%) or more of the
81-
outstanding shares, or (iii) beneficial ownership of such entity.
82-
83-
"You" (or "Your") shall mean an individual or Legal Entity
84-
exercising permissions granted by this License.
85-
86-
"Source" form shall mean the preferred form for making modifications,
87-
including but not limited to software source code, documentation
88-
source, and configuration files.
89-
90-
"Object" form shall mean any form resulting from mechanical
91-
transformation or translation of a Source form, including but
92-
not limited to compiled object code, generated documentation,
93-
and conversions to other media types.
94-
95-
"Work" shall mean the work of authorship, whether in Source or
96-
Object form, made available under the License, as indicated by a
97-
copyright notice that is included in or attached to the work
98-
(an example is provided in the Appendix below).
99-
100-
"Derivative Works" shall mean any work, whether in Source or Object
101-
form, that is based on (or derived from) the Work and for which the
102-
editorial revisions, annotations, elaborations, or other modifications
103-
represent, as a whole, an original work of authorship. For the purposes
104-
of this License, Derivative Works shall not include works that remain
105-
separable from, or merely link (or bind by name) to the interfaces of,
106-
the Work and Derivative Works thereof.
107-
108-
"Contribution" shall mean any work of authorship, including
109-
the original version of the Work and any modifications or additions
110-
to that Work or Derivative Works thereof, that is intentionally
111-
submitted to Licensor for inclusion in the Work by the copyright owner
112-
or by an individual or Legal Entity authorized to submit on behalf of
113-
the copyright owner. For the purposes of this definition, "submitted"
114-
means any form of electronic, verbal, or written communication sent
115-
to the Licensor or its representatives, including but not limited to
116-
communication on electronic mailing lists, source code control systems,
117-
and issue tracking systems that are managed by, or on behalf of, the
118-
Licensor for the purpose of discussing and improving the Work, but
119-
excluding communication that is conspicuously marked or otherwise
120-
designated in writing by the copyright owner as "Not a Contribution."
121-
122-
"Contributor" shall mean Licensor and any individual or Legal Entity
123-
on behalf of whom a Contribution has been received by Licensor and
124-
subsequently incorporated within the Work.
125-
126-
2. Grant of Copyright License. Subject to the terms and conditions of
127-
this License, each Contributor hereby grants to You a perpetual,
128-
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
129-
copyright license to reproduce, prepare Derivative Works of,
130-
publicly display, publicly perform, sublicense, and distribute the
131-
Work and such Derivative Works in Source or Object form.
132-
133-
3. Grant of Patent License. Subject to the terms and conditions of
134-
this License, each Contributor hereby grants to You a perpetual,
135-
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
136-
(except as stated in this section) patent license to make, have made,
137-
use, offer to sell, sell, import, and otherwise transfer the Work,
138-
where such license applies only to those patent claims licensable
139-
by such Contributor that are necessarily infringed by their
140-
Contribution(s) alone or by combination of their Contribution(s)
141-
with the Work to which such Contribution(s) was submitted. If You
142-
institute patent litigation against any entity (including a
143-
cross-claim or counterclaim in a lawsuit) alleging that the Work
144-
or a Contribution incorporated within the Work constitutes direct
145-
or contributory patent infringement, then any patent licenses
146-
granted to You under this License for that Work shall terminate
147-
as of the date such litigation is filed.
148-
149-
4. Redistribution. You may reproduce and distribute copies of the
150-
Work or Derivative Works thereof in any medium, with or without
151-
modifications, and in Source or Object form, provided that You
152-
meet the following conditions:
153-
154-
(a) You must give any other recipients of the Work or
155-
Derivative Works a copy of this License; and
156-
157-
(b) You must cause any modified files to carry prominent notices
158-
stating that You changed the files; and
159-
160-
(c) You must retain, in the Source form of any Derivative Works
161-
that You distribute, all copyright, patent, trademark, and
162-
attribution notices from the Source form of the Work,
163-
excluding those notices that do not pertain to any part of
164-
the Derivative Works; and
165-
166-
(d) If the Work includes a "NOTICE" text file as part of its
167-
distribution, then any Derivative Works that You distribute must
168-
include a readable copy of the attribution notices contained
169-
within such NOTICE file, excluding those notices that do not
170-
pertain to any part of the Derivative Works, in at least one
171-
of the following places: within a NOTICE text file distributed
172-
as part of the Derivative Works; within the Source form or
173-
documentation, if provided along with the Derivative Works; or,
174-
within a display generated by the Derivative Works, if and
175-
wherever such third-party notices normally appear. The contents
176-
of the NOTICE file are for informational purposes only and
177-
do not modify the License. You may add Your own attribution
178-
notices within Derivative Works that You distribute, alongside
179-
or as an addendum to the NOTICE text from the Work, provided
180-
that such additional attribution notices cannot be construed
181-
as modifying the License.
182-
183-
You may add Your own copyright statement to Your modifications and
184-
may provide additional or different license terms and conditions
185-
for use, reproduction, or distribution of Your modifications, or
186-
for any such Derivative Works as a whole, provided Your use,
187-
reproduction, and distribution of the Work otherwise complies with
188-
the conditions stated in this License.
189-
190-
5. Submission of Contributions. Unless You explicitly state otherwise,
191-
any Contribution intentionally submitted for inclusion in the Work
192-
by You to the Licensor shall be under the terms and conditions of
193-
this License, without any additional terms or conditions.
194-
Notwithstanding the above, nothing herein shall supersede or modify
195-
the terms of any separate license agreement you may have executed
196-
with Licensor regarding such Contributions.
197-
198-
6. Trademarks. This License does not grant permission to use the trade
199-
names, trademarks, service marks, or product names of the Licensor,
200-
except as required for reasonable and customary use in describing the
201-
origin of the Work and reproducing the content of the NOTICE file.
202-
203-
7. Disclaimer of Warranty. Unless required by applicable law or
204-
agreed to in writing, Licensor provides the Work (and each
205-
Contributor provides its Contributions) on an "AS IS" BASIS,
206-
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
207-
implied, including, without limitation, any warranties or conditions
208-
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
209-
PARTICULAR PURPOSE. You are solely responsible for determining the
210-
appropriateness of using or redistributing the Work and assume any
211-
risks associated with Your exercise of permissions under this License.
212-
213-
8. Limitation of Liability. In no event and under no legal theory,
214-
whether in tort (including negligence), contract, or otherwise,
215-
unless required by applicable law (such as deliberate and grossly
216-
negligent acts) or agreed to in writing, shall any Contributor be
217-
liable to You for damages, including any direct, indirect, special,
218-
incidental, or consequential damages of any character arising as a
219-
result of this License or out of the use or inability to use the
220-
Work (including but not limited to damages for loss of goodwill,
221-
work stoppage, computer failure or malfunction, or any and all
222-
other commercial damages or losses), even if such Contributor
223-
has been advised of the possibility of such damages.
224-
225-
9. Accepting Warranty or Additional Liability. While redistributing
226-
the Work or Derivative Works thereof, You may choose to offer,
227-
and charge a fee for, acceptance of support, warranty, indemnity,
228-
or other liability obligations and/or rights consistent with this
229-
License. However, in accepting such obligations, You may act only
230-
on Your own behalf and on Your sole responsibility, not on behalf
231-
of any other Contributor, and only if You agree to indemnify,
232-
defend, and hold each Contributor harmless for any liability
233-
incurred by, or claims asserted against, such Contributor by reason
234-
of your accepting any such warranty or additional liability.
235-
236-
END OF TERMS AND CONDITIONS
237-
238-
APPENDIX: How to apply the Apache License to your work.
239-
240-
To apply the Apache License to your work, attach the following
241-
boilerplate notice, with the fields enclosed by brackets "[]"
242-
replaced with your own identifying information. (Don't include
243-
the brackets!) The text should be enclosed in the appropriate
244-
comment syntax for the file format. We also recommend that a
245-
file or class name and description of purpose be included on the
246-
same "printed page" as the copyright notice for easier
247-
identification within third-party archives.
248-
249-
Copyright [yyyy] [name of copyright owner]
250-
251-
Licensed under the Apache License, Version 2.0 (the "License");
252-
you may not use this file except in compliance with the License.
253-
You may obtain a copy of the License at
254-
255-
http://www.apache.org/licenses/LICENSE-2.0
256-
257-
Unless required by applicable law or agreed to in writing, software
258-
distributed under the License is distributed on an "AS IS" BASIS,
259-
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
260-
See the License for the specific language governing permissions and
261-
limitations under the License.

src/generate/dune

-4
This file was deleted.

src/generate/select.ml

-40
This file was deleted.

src/reason-parser/dune

+2-34
Original file line numberDiff line numberDiff line change
@@ -5,41 +5,9 @@
55

66
(rule
77
(targets ocaml_util.ml)
8-
(deps
9-
../generate/select.exe
10-
ocaml_util.ml-5.2
11-
ocaml_util.ml-5.1
12-
ocaml_util.ml-5.0
13-
ocaml_util.ml-5.00
14-
ocaml_util.ml-4.14
15-
ocaml_util.ml-4.13
16-
ocaml_util.ml-4.12
17-
ocaml_util.ml-4.11
18-
ocaml_util.ml-4.10
19-
ocaml_util.ml-4.09
20-
ocaml_util.ml-4.08
21-
ocaml_util.ml-4.07
22-
ocaml_util.ml-4.06
23-
ocaml_util.ml-default)
8+
(deps ocaml_util.cppo.ml)
249
(action
25-
(with-stdout-to
26-
%{targets}
27-
(run
28-
../generate/select.exe
29-
ocaml_util.ml-5.2
30-
ocaml_util.ml-5.1
31-
ocaml_util.ml-5.0
32-
ocaml_util.ml-5.00
33-
ocaml_util.ml-4.14
34-
ocaml_util.ml-4.13
35-
ocaml_util.ml-4.12
36-
ocaml_util.ml-4.11
37-
ocaml_util.ml-4.10
38-
ocaml_util.ml-4.09
39-
ocaml_util.ml-4.08
40-
ocaml_util.ml-4.07
41-
ocaml_util.ml-4.06
42-
ocaml_util.ml-default))))
10+
(run %{bin:cppo} -V OCAML:%{ocaml_version} %{deps} -o %{targets})))
4311

4412
(menhir
4513
(flags --strict --inspection --unused-tokens --table --cmly)

src/reason-parser/ocaml_util.cppo.ml

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
#if OCAML_VERSION >= (4,6,0)
2+
let warn_latin1 lexbuf =
3+
Location.deprecated (Location.curr lexbuf) "ISO-Latin1 characters in identifiers"
4+
#else
5+
let warn_latin1 lexbuf =
6+
Location.prerr_warning (Location.curr lexbuf)
7+
(Warnings.Deprecated "ISO-Latin1 characters in identifiers")
8+
#endif
9+
10+
let print_loc ppf loc =
11+
Location.print_loc ppf loc
12+
13+
14+
let print_error loc f ppf x =
15+
#if OCAML_VERSION >= (4,8,0)
16+
let error = Location.error_of_printer ~loc f x in
17+
Location.print_report ppf error
18+
#else
19+
let error = Location.error_of_printer loc f x in
20+
Location.report_error ppf error
21+
#endif

src/reason-parser/ocaml_util.ml-4.06

-10
This file was deleted.

src/reason-parser/ocaml_util.ml-4.07

-10
This file was deleted.

src/reason-parser/ocaml_util.ml-4.08

-10
This file was deleted.

src/reason-parser/ocaml_util.ml-4.09

-11
This file was deleted.

src/reason-parser/ocaml_util.ml-4.10

-11
This file was deleted.

src/reason-parser/ocaml_util.ml-4.11

-11
This file was deleted.

0 commit comments

Comments
 (0)