diff --git a/CITATION.cff b/CITATION.cff index b10aea847..9d8190f12 100644 --- a/CITATION.cff +++ b/CITATION.cff @@ -9,4 +9,4 @@ authors: family-names: Sutter repository-code: 'https://github.com/hsutter/cppfront' abstract: A personal experimental C++ Syntax 2 -> Syntax 1 compiler -license: CC-BY-NC-ND-4.0 +license: Apache-2.0 WITH LLVM-exception diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index d27b74165..386cba3c5 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -1,9 +1,10 @@ -This is the contributor license agreement. If you are looking for the usage license, see here: [usage license](https://github.com/hsutter/cppfront/blob/main/LICENSE) +## Contributing -## cppfront Contributor License Agreement +This project welcomes contributions and suggestions. Most contributions require you to agree to a Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant the rights to use your contribution. A sample of the CLA is below. -By contributing content to cppfront (i.e., submitting a pull request for inclusion in this repository): -- You warrant that your material is original, or you have the right to contribute it. -- With respect to the material that you own, you grant a worldwide, non-exclusive, irrevocable, transferable, and royalty-free license to your contributed material to Herb Sutter to display, reproduce, perform, distribute, and create derivative works of that material for commercial or non-commercial use. -- With respect to any other material you contribute, such material must be under a worldwide, non-exclusive, irrevocable, transferable, and royalty-free license sufficient to allow Herb Sutter to display, reproduce, perform, distribute, and create derivative works of that material for commercial or non-commercial use. +When you submit a pull request, a CLA bot or human will automatically determine whether you need to provide a CLA and decorate the PR appropriately (e.g., status check, comment). Simply follow the instructions provided. You will only need to do this once for all your contributions to cppfront. + +## Cppfront Contribution License Agreement (Sample) + +A sample can be found here: [Cppfront CLA 2024-10 - sample.pdf](docs/Cppfront CLA 2024-10 - sample.pdf) diff --git a/LICENSE b/LICENSE index 1689a5eac..e582264d1 100644 --- a/LICENSE +++ b/LICENSE @@ -1,11 +1,236 @@ -Copyright (c) Herb Sutter -SPDX-License-Identifier: CC-BY-NC-ND-4.0 - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. +Copyright 2022-2024 Herb Sutter +SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + + +Cppfront is under the Apache License v2.0 with LLVM Exception: + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + +---- LLVM Exceptions to the Apache 2.0 License ---- + +As an exception, if, as a result of your compiling your source code, portions +of this Software are embedded into an Object form of such source code, you +may redistribute such embedded portions in such Object form without complying +with the conditions of Sections 4(a), 4(b) and 4(d) of the License. + +In addition, if you combine or link compiled forms of this Software with +software that is licensed under the GPLv2 ("Combined Software") and if a +court of competent jurisdiction determines that the patent provision (Section +3), the indemnity provision (Section 9) or other Section of the License +conflicts with the conditions of the GPLv2, you may retroactively and +prospectively choose to deem waived or otherwise exclude such Section(s) of +the License, but only in their entirety and only with respect to the Combined +Software. diff --git a/docs/Cppfront CLA 2024-10 - sample.pdf b/docs/Cppfront CLA 2024-10 - sample.pdf new file mode 100644 index 000000000..85f8a4cb6 Binary files /dev/null and b/docs/Cppfront CLA 2024-10 - sample.pdf differ diff --git a/include/cpp2regex.h b/include/cpp2regex.h index e19398634..ee0fd2c54 100644 --- a/include/cpp2regex.h +++ b/include/cpp2regex.h @@ -10,67 +10,67 @@ #line 1 "cpp2regex.h2" -#line 27 "cpp2regex.h2" +#line 22 "cpp2regex.h2" namespace cpp2 { namespace regex { -#line 43 "cpp2regex.h2" +#line 38 "cpp2regex.h2" template class match_group; -#line 53 "cpp2regex.h2" +#line 48 "cpp2regex.h2" template class match_return; -#line 61 "cpp2regex.h2" +#line 56 "cpp2regex.h2" template class match_context; -#line 122 "cpp2regex.h2" +#line 117 "cpp2regex.h2" class true_end_func; -#line 130 "cpp2regex.h2" +#line 125 "cpp2regex.h2" class no_reset; -#line 137 "cpp2regex.h2" +#line 132 "cpp2regex.h2" template class on_return; -#line 164 "cpp2regex.h2" +#line 159 "cpp2regex.h2" template class single_class_entry; -#line 173 "cpp2regex.h2" +#line 168 "cpp2regex.h2" template class range_class_entry; -#line 182 "cpp2regex.h2" +#line 177 "cpp2regex.h2" template class combined_class_entry; -#line 191 "cpp2regex.h2" +#line 186 "cpp2regex.h2" template class list_class_entry; -#line 200 "cpp2regex.h2" +#line 195 "cpp2regex.h2" template class named_class_entry; -#line 207 "cpp2regex.h2" +#line 202 "cpp2regex.h2" template class negated_class_entry; -#line 216 "cpp2regex.h2" +#line 211 "cpp2regex.h2" template class shorthand_class_entry; -#line 264 "cpp2regex.h2" +#line 259 "cpp2regex.h2" template class alternative_token_matcher; -#line 342 "cpp2regex.h2" +#line 337 "cpp2regex.h2" template class class_token_matcher; -#line 497 "cpp2regex.h2" +#line 492 "cpp2regex.h2" class range_flags; -#line 506 "cpp2regex.h2" +#line 501 "cpp2regex.h2" template class range_token_matcher; -#line 678 "cpp2regex.h2" +#line 673 "cpp2regex.h2" template class regular_expression; -#line 761 "cpp2regex.h2" +#line 756 "cpp2regex.h2" } } @@ -79,16 +79,11 @@ template class regular_expression; #line 1 "cpp2regex.h2" -// Copyright (c) Herb Sutter -// SPDX-License-Identifier: CC-BY-NC-ND-4.0 - -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. +// Copyright 2022-2024 Herb Sutter +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +// Part of the Cppfront Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://github.com/hsutter/cppfront/blob/main/LICENSE for license information. //=========================================================================== @@ -104,7 +99,7 @@ using matcher_wrapper_type = typename matcher_wrapper::template wrap using matcher_context_type = typename matcher::context; -#line 27 "cpp2regex.h2" +#line 22 "cpp2regex.h2" namespace cpp2 { namespace regex { @@ -130,7 +125,7 @@ template class match_group public: match_group(auto const& start_, auto const& end_, auto const& matched_); public: match_group(); -#line 49 "cpp2regex.h2" +#line 44 "cpp2regex.h2" }; // Return value for every matcher. @@ -142,7 +137,7 @@ template class match_return public: match_return(auto const& matched_, auto const& pos_); public: match_return(); -#line 57 "cpp2regex.h2" +#line 52 "cpp2regex.h2" }; // Modifiable state during matching. @@ -156,13 +151,13 @@ template class match_context public: explicit match_context(Iter const& begin_, Iter const& end_); -#line 73 "cpp2regex.h2" +#line 68 "cpp2regex.h2" public: match_context(match_context const& that); -#line 73 "cpp2regex.h2" +#line 68 "cpp2regex.h2" public: auto operator=(match_context const& that) -> match_context& ; -#line 73 "cpp2regex.h2" +#line 68 "cpp2regex.h2" public: match_context(match_context&& that) noexcept; -#line 73 "cpp2regex.h2" +#line 68 "cpp2regex.h2" public: auto operator=(match_context&& that) noexcept -> match_context& ; // Getter and setter for groups @@ -171,22 +166,22 @@ template class match_context public: [[nodiscard]] auto get_group_end(auto const& group) const& -> int; -#line 85 "cpp2regex.h2" +#line 80 "cpp2regex.h2" public: [[nodiscard]] auto get_group_start(auto const& group) const& -> int; -#line 91 "cpp2regex.h2" +#line 86 "cpp2regex.h2" public: [[nodiscard]] auto get_group_string(auto const& group) const& -> std::string; -#line 98 "cpp2regex.h2" +#line 93 "cpp2regex.h2" public: auto set_group_end(auto const& group, auto const& pos) & -> void; -#line 103 "cpp2regex.h2" +#line 98 "cpp2regex.h2" public: auto set_group_invalid(auto const& group) & -> void; -#line 107 "cpp2regex.h2" +#line 102 "cpp2regex.h2" public: auto set_group_start(auto const& group, auto const& pos) & -> void; -#line 111 "cpp2regex.h2" +#line 106 "cpp2regex.h2" public: [[nodiscard]] auto size() const& -> decltype(auto); // Misc functions @@ -195,7 +190,7 @@ template class match_context public: [[nodiscard]] auto pass(cpp2::impl::in cur) const& -> decltype(auto); }; -#line 120 "cpp2regex.h2" +#line 115 "cpp2regex.h2" // End function that returns a valid match. // class true_end_func @@ -203,7 +198,7 @@ class true_end_func public: [[nodiscard]] auto operator()(auto const& cur, auto& ctx) const& -> decltype(auto); }; -#line 128 "cpp2regex.h2" +#line 123 "cpp2regex.h2" // Empty group reset function. // class no_reset @@ -211,30 +206,30 @@ class no_reset public: auto operator()([[maybe_unused]] auto& unnamed_param_2) const& -> void; }; -#line 136 "cpp2regex.h2" +#line 131 "cpp2regex.h2" // Evaluate func on destruction of the handle. template class on_return { private: Func func; public: explicit on_return(Func const& f); -#line 141 "cpp2regex.h2" +#line 136 "cpp2regex.h2" public: auto operator=(Func const& f) -> on_return& ; -#line 145 "cpp2regex.h2" +#line 140 "cpp2regex.h2" public: ~on_return() noexcept; public: on_return(on_return const&) = delete; /* No 'that' constructor, suppress copy */ public: auto operator=(on_return const&) -> void = delete; -#line 148 "cpp2regex.h2" +#line 143 "cpp2regex.h2" }; -#line 151 "cpp2regex.h2" +#line 146 "cpp2regex.h2" // Helper for auto deduction of the Func type. template [[nodiscard]] auto make_on_return(Func const& func) -> decltype(auto); -#line 155 "cpp2regex.h2" +#line 150 "cpp2regex.h2" //----------------------------------------------------------------------- // // Character classes for regular expressions. @@ -252,10 +247,10 @@ template class single_class_entry public: single_class_entry(single_class_entry const&) = delete; /* No 'that' constructor, suppress copy */ public: auto operator=(single_class_entry const&) -> void = delete; -#line 168 "cpp2regex.h2" +#line 163 "cpp2regex.h2" }; -#line 171 "cpp2regex.h2" +#line 166 "cpp2regex.h2" // Class syntax: - Example: a-c // template class range_class_entry @@ -266,10 +261,10 @@ template class range_class_entry public: range_class_entry(range_class_entry const&) = delete; /* No 'that' constructor, suppress copy */ public: auto operator=(range_class_entry const&) -> void = delete; -#line 177 "cpp2regex.h2" +#line 172 "cpp2regex.h2" }; -#line 180 "cpp2regex.h2" +#line 175 "cpp2regex.h2" // Helper for combining two character classes // template class combined_class_entry @@ -280,10 +275,10 @@ template class combined_class_entry public: combined_class_entry(combined_class_entry const&) = delete; /* No 'that' constructor, suppress copy */ public: auto operator=(combined_class_entry const&) -> void = delete; -#line 186 "cpp2regex.h2" +#line 181 "cpp2regex.h2" }; -#line 189 "cpp2regex.h2" +#line 184 "cpp2regex.h2" // Class syntax: Example: abcd // template class list_class_entry @@ -294,10 +289,10 @@ template class list_class_entry public: list_class_entry(list_class_entry const&) = delete; /* No 'that' constructor, suppress copy */ public: auto operator=(list_class_entry const&) -> void = delete; -#line 195 "cpp2regex.h2" +#line 190 "cpp2regex.h2" }; -#line 198 "cpp2regex.h2" +#line 193 "cpp2regex.h2" // Class syntax: [: class named_class_entry @@ -308,10 +303,10 @@ template class n public: named_class_entry(named_class_entry const&) = delete; /* No 'that' constructor, suppress copy */ public: auto operator=(named_class_entry const&) -> void = delete; -#line 204 "cpp2regex.h2" +#line 199 "cpp2regex.h2" }; -#line 207 "cpp2regex.h2" +#line 202 "cpp2regex.h2" template class negated_class_entry : public Inner { @@ -320,10 +315,10 @@ template class negated_class_entry public: negated_class_entry(negated_class_entry const&) = delete; /* No 'that' constructor, suppress copy */ public: auto operator=(negated_class_entry const&) -> void = delete; -#line 211 "cpp2regex.h2" +#line 206 "cpp2regex.h2" }; -#line 214 "cpp2regex.h2" +#line 209 "cpp2regex.h2" // Short class syntax: \ Example: \w // template class shorthand_class_entry @@ -334,10 +329,10 @@ template class s public: shorthand_class_entry(shorthand_class_entry const&) = delete; /* No 'that' constructor, suppress copy */ public: auto operator=(shorthand_class_entry const&) -> void = delete; -#line 220 "cpp2regex.h2" +#line 215 "cpp2regex.h2" }; -#line 223 "cpp2regex.h2" +#line 218 "cpp2regex.h2" // Named basic character classes // template using digits_class = named_class_entry>; @@ -374,7 +369,7 @@ template using short_not_space_class = nega template using short_not_vert_space_class = negated_class_entry>>; template using short_not_word_class = negated_class_entry>>; -#line 260 "cpp2regex.h2" +#line 255 "cpp2regex.h2" // Regex syntax: | Example: ab|ba // // Non greedy implementation. First alternative that matches is chosen. @@ -383,22 +378,22 @@ template class alternative_token_matcher { public: [[nodiscard]] static auto match(auto const& cur, auto& ctx, auto const& end_func, auto const& tail, auto const& ...functions) -> auto; -#line 270 "cpp2regex.h2" +#line 265 "cpp2regex.h2" private: template [[nodiscard]] static auto match_first(auto const& cur, auto& ctx, auto const& end_func, auto const& tail, auto const& cur_func, auto const& cur_reset, Other const& ...other) -> auto; public: alternative_token_matcher() = default; public: alternative_token_matcher(alternative_token_matcher const&) = delete; /* No 'that' constructor, suppress copy */ public: auto operator=(alternative_token_matcher const&) -> void = delete; -#line 288 "cpp2regex.h2" +#line 283 "cpp2regex.h2" }; -#line 291 "cpp2regex.h2" +#line 286 "cpp2regex.h2" // Regex syntax: . // template [[nodiscard]] auto any_token_matcher(auto& cur, auto& ctx) -> bool; -#line 306 "cpp2regex.h2" +#line 301 "cpp2regex.h2" // TODO: Check if vectorization works at some point with this implementation. // char_token_matcher: (inout cur, inout ctx) -> bool = { // if !(std::distance(cur, ctx.end) < tokens..size()) { @@ -432,21 +427,21 @@ template [[nodiscard]] auto any_token_matcher( // return matched; // } -#line 340 "cpp2regex.h2" +#line 335 "cpp2regex.h2" // Regex syntax: [] Example: [abcx-y[:digits:]] // template class class_token_matcher { public: [[nodiscard]] static auto match(auto& cur, auto& ctx) -> bool; -#line 373 "cpp2regex.h2" +#line 368 "cpp2regex.h2" private: template [[nodiscard]] static auto match_any(cpp2::impl::in c) -> bool; public: class_token_matcher() = default; public: class_token_matcher(class_token_matcher const&) = delete; /* No 'that' constructor, suppress copy */ public: auto operator=(class_token_matcher const&) -> void = delete; -#line 386 "cpp2regex.h2" +#line 381 "cpp2regex.h2" // TODO: Implement proper to string // to_string: () -> bstring = { // r: bstring = "["; @@ -458,10 +453,10 @@ template c // return r; // } -#line 397 "cpp2regex.h2" +#line 392 "cpp2regex.h2" }; -#line 400 "cpp2regex.h2" +#line 395 "cpp2regex.h2" // Named short classes // template using named_class_no_new_line = class_token_matcher>; @@ -477,7 +472,7 @@ template usi template using named_class_not_ver_space = class_token_matcher>; template using named_class_not_word = class_token_matcher>; -#line 416 "cpp2regex.h2" +#line 411 "cpp2regex.h2" // Regex syntax: \ Example: \1 // \g{name_or_number} // \k{name_or_number} @@ -486,27 +481,27 @@ template usi // template [[nodiscard]] auto group_ref_token_matcher(auto& cur, auto& ctx) -> bool; -#line 453 "cpp2regex.h2" +#line 448 "cpp2regex.h2" // Regex syntax: $ Example: aa$ // template [[nodiscard]] auto line_end_token_matcher(auto const& cur, auto& ctx) -> bool; -#line 469 "cpp2regex.h2" +#line 464 "cpp2regex.h2" // Regex syntax: ^ Example: ^aa // template [[nodiscard]] auto line_start_token_matcher(auto const& cur, auto& ctx) -> bool; -#line 478 "cpp2regex.h2" +#line 473 "cpp2regex.h2" // Regex syntax: (?=) or (?!) or (*pla), etc. Example: (?=AA) // // Parsed in group_token. // template [[nodiscard]] auto lookahead_token_matcher(auto const& cur, auto& ctx, auto const& func) -> bool; -#line 493 "cpp2regex.h2" +#line 488 "cpp2regex.h2" // TODO: @enum as template parameter currently not working. See issue https://github.com/hsutter/cppfront/issues/1147 -#line 496 "cpp2regex.h2" +#line 491 "cpp2regex.h2" // Options for range matching. class range_flags { public: static const int not_greedy;// Try to take as few as possible. @@ -517,9 +512,9 @@ class range_flags { public: range_flags(range_flags const&) = delete; /* No 'that' constructor, suppress copy */ public: auto operator=(range_flags const&) -> void = delete; }; -#line 502 "cpp2regex.h2" +#line 497 "cpp2regex.h2" -#line 504 "cpp2regex.h2" +#line 499 "cpp2regex.h2" // Regex syntax: {min, max} Example: a{2,4} // template class range_token_matcher @@ -527,42 +522,42 @@ template class range_tok public: template [[nodiscard]] static auto match(Iter const& cur, auto& ctx, auto const& inner, auto const& reset_func, auto const& end_func, auto const& tail) -> auto; -#line 522 "cpp2regex.h2" +#line 517 "cpp2regex.h2" private: [[nodiscard]] static auto is_below_upper_bound(cpp2::impl::in count) -> bool; -#line 527 "cpp2regex.h2" +#line 522 "cpp2regex.h2" private: [[nodiscard]] static auto is_below_lower_bound(cpp2::impl::in count) -> bool; -#line 532 "cpp2regex.h2" +#line 527 "cpp2regex.h2" private: [[nodiscard]] static auto is_in_range(cpp2::impl::in count) -> bool; -#line 538 "cpp2regex.h2" +#line 533 "cpp2regex.h2" private: template [[nodiscard]] static auto match_min_count(Iter const& cur, auto& ctx, auto const& inner, auto const& end_func, int& count_r) -> auto; -#line 554 "cpp2regex.h2" +#line 549 "cpp2regex.h2" private: template [[nodiscard]] static auto match_greedy(cpp2::impl::in count, Iter const& cur, Iter const& last_valid, auto& ctx, auto const& inner, auto const& reset_func, auto const& end_func, auto const& other) -> match_return; -#line 584 "cpp2regex.h2" +#line 579 "cpp2regex.h2" private: template [[nodiscard]] static auto match_possessive(Iter const& cur, auto& ctx, auto const& inner, auto const& end_func, auto const& other) -> match_return; -#line 612 "cpp2regex.h2" +#line 607 "cpp2regex.h2" private: template [[nodiscard]] static auto match_not_greedy(Iter const& cur, auto& ctx, auto const& inner, auto const& end_func, auto const& other) -> match_return; public: range_token_matcher() = default; public: range_token_matcher(range_token_matcher const&) = delete; /* No 'that' constructor, suppress copy */ public: auto operator=(range_token_matcher const&) -> void = delete; -#line 638 "cpp2regex.h2" +#line 633 "cpp2regex.h2" }; -#line 641 "cpp2regex.h2" +#line 636 "cpp2regex.h2" // Regex syntax: \b or \B Example: \bword\b // // Matches the start end end of word boundaries. // template [[nodiscard]] auto word_boundary_token_matcher(auto& cur, auto& ctx) -> bool; -#line 670 "cpp2regex.h2" +#line 665 "cpp2regex.h2" //----------------------------------------------------------------------- // // Regular expression implementation. @@ -584,7 +579,7 @@ template class regular_expression public: explicit search_return(cpp2::impl::in matched_, context const& ctx_, Iter const& pos_); -#line 695 "cpp2regex.h2" +#line 690 "cpp2regex.h2" public: [[nodiscard]] auto group_number() const& -> decltype(auto); public: [[nodiscard]] auto group(cpp2::impl::in g) const& -> decltype(auto); public: [[nodiscard]] auto group_start(cpp2::impl::in g) const& -> decltype(auto); @@ -599,7 +594,7 @@ template class regular_expression public: auto operator=(search_return const&) -> void = delete; -#line 711 "cpp2regex.h2" +#line 706 "cpp2regex.h2" }; public: [[nodiscard]] auto match(cpp2::impl::in> str) const& -> decltype(auto); @@ -607,13 +602,13 @@ template class regular_expression public: [[nodiscard]] auto match(cpp2::impl::in> str, auto const& start, auto const& length) const& -> decltype(auto); public: template [[nodiscard]] auto match(Iter const& start, Iter const& end) const& -> search_return; -#line 724 "cpp2regex.h2" +#line 719 "cpp2regex.h2" public: [[nodiscard]] auto search(cpp2::impl::in> str) const& -> decltype(auto); public: [[nodiscard]] auto search(cpp2::impl::in> str, auto const& start) const& -> decltype(auto); public: [[nodiscard]] auto search(cpp2::impl::in> str, auto const& start, auto const& length) const& -> decltype(auto); public: template [[nodiscard]] auto search(Iter const& start, Iter const& end) const& -> search_return; -#line 747 "cpp2regex.h2" +#line 742 "cpp2regex.h2" public: [[nodiscard]] auto to_string() const& -> decltype(auto); // Helper functions @@ -624,7 +619,7 @@ template class regular_expression public: auto operator=(regular_expression const&) -> void = delete; -#line 759 "cpp2regex.h2" +#line 754 "cpp2regex.h2" }; } @@ -636,7 +631,7 @@ template class regular_expression #line 1 "cpp2regex.h2" -#line 27 "cpp2regex.h2" +#line 22 "cpp2regex.h2" namespace cpp2 { namespace regex { @@ -651,55 +646,55 @@ template match_return::match_return(auto const& matched_, , pos{ pos_ }{} template match_return::match_return(){} -#line 68 "cpp2regex.h2" +#line 63 "cpp2regex.h2" template match_context::match_context(Iter const& begin_, Iter const& end_) : begin{ begin_ } , end{ end_ }{ -#line 71 "cpp2regex.h2" +#line 66 "cpp2regex.h2" } -#line 73 "cpp2regex.h2" +#line 68 "cpp2regex.h2" template match_context::match_context(match_context const& that) : begin{ that.begin } , end{ that.end } , groups{ that.groups }{} -#line 73 "cpp2regex.h2" +#line 68 "cpp2regex.h2" template auto match_context::operator=(match_context const& that) -> match_context& { begin = that.begin; end = that.end; groups = that.groups; return *this; } -#line 73 "cpp2regex.h2" +#line 68 "cpp2regex.h2" template match_context::match_context(match_context&& that) noexcept : begin{ std::move(that).begin } , end{ std::move(that).end } , groups{ std::move(that).groups }{} -#line 73 "cpp2regex.h2" +#line 68 "cpp2regex.h2" template auto match_context::operator=(match_context&& that) noexcept -> match_context& { begin = std::move(that).begin; end = std::move(that).end; groups = std::move(that).groups; return *this; } -#line 77 "cpp2regex.h2" +#line 72 "cpp2regex.h2" template [[nodiscard]] auto match_context::get_group(auto const& group) const& -> decltype(auto) { return CPP2_ASSERT_IN_BOUNDS(groups, group); } -#line 79 "cpp2regex.h2" +#line 74 "cpp2regex.h2" template [[nodiscard]] auto match_context::get_group_end(auto const& group) const& -> int{ if (cpp2::impl::cmp_greater_eq(group,max_groups) || !(CPP2_ASSERT_IN_BOUNDS(groups, group).matched)) { return 0; } return cpp2::unchecked_narrow(std::distance(begin, CPP2_ASSERT_IN_BOUNDS(groups, group).end)); } -#line 85 "cpp2regex.h2" +#line 80 "cpp2regex.h2" template [[nodiscard]] auto match_context::get_group_start(auto const& group) const& -> int{ if (cpp2::impl::cmp_greater_eq(group,max_groups) || !(CPP2_ASSERT_IN_BOUNDS(groups, group).matched)) { return 0; } return cpp2::unchecked_narrow(std::distance(begin, CPP2_ASSERT_IN_BOUNDS(groups, group).start)); } -#line 91 "cpp2regex.h2" +#line 86 "cpp2regex.h2" template [[nodiscard]] auto match_context::get_group_string(auto const& group) const& -> std::string{ if (cpp2::impl::cmp_greater_eq(group,max_groups) || !(CPP2_ASSERT_IN_BOUNDS(groups, group).matched)) { return ""; @@ -707,97 +702,97 @@ template match_return::match_return(){} return std::string(CPP2_ASSERT_IN_BOUNDS(groups, group).start, CPP2_ASSERT_IN_BOUNDS(groups, group).end); } -#line 98 "cpp2regex.h2" +#line 93 "cpp2regex.h2" template auto match_context::set_group_end(auto const& group, auto const& pos) & -> void{ CPP2_ASSERT_IN_BOUNDS(groups, group).end = pos; CPP2_ASSERT_IN_BOUNDS(groups, group).matched = true; } -#line 103 "cpp2regex.h2" +#line 98 "cpp2regex.h2" template auto match_context::set_group_invalid(auto const& group) & -> void{ CPP2_ASSERT_IN_BOUNDS(groups, group).matched = false; } -#line 107 "cpp2regex.h2" +#line 102 "cpp2regex.h2" template auto match_context::set_group_start(auto const& group, auto const& pos) & -> void{ CPP2_ASSERT_IN_BOUNDS(groups, group).start = pos; } -#line 111 "cpp2regex.h2" +#line 106 "cpp2regex.h2" template [[nodiscard]] auto match_context::size() const& -> decltype(auto) { return max_groups; } -#line 115 "cpp2regex.h2" +#line 110 "cpp2regex.h2" template [[nodiscard]] auto match_context::fail() const& -> decltype(auto) { return match_return(false, end); } -#line 116 "cpp2regex.h2" +#line 111 "cpp2regex.h2" template [[nodiscard]] auto match_context::pass(cpp2::impl::in cur) const& -> decltype(auto) { return match_return(true, cur); } -#line 124 "cpp2regex.h2" +#line 119 "cpp2regex.h2" [[nodiscard]] auto true_end_func::operator()(auto const& cur, auto& ctx) const& -> decltype(auto) { return ctx.pass(cur); } -#line 132 "cpp2regex.h2" +#line 127 "cpp2regex.h2" auto no_reset::operator()([[maybe_unused]] auto& unnamed_param_2) const& -> void{} -#line 141 "cpp2regex.h2" +#line 136 "cpp2regex.h2" template on_return::on_return(Func const& f) : func{ f }{ -#line 143 "cpp2regex.h2" +#line 138 "cpp2regex.h2" } -#line 141 "cpp2regex.h2" +#line 136 "cpp2regex.h2" template auto on_return::operator=(Func const& f) -> on_return& { func = f; return *this; -#line 143 "cpp2regex.h2" +#line 138 "cpp2regex.h2" } -#line 145 "cpp2regex.h2" +#line 140 "cpp2regex.h2" template on_return::~on_return() noexcept{ cpp2::move(*this).func(); } -#line 152 "cpp2regex.h2" +#line 147 "cpp2regex.h2" template [[nodiscard]] auto make_on_return(Func const& func) -> decltype(auto) { return on_return(func); } -#line 166 "cpp2regex.h2" +#line 161 "cpp2regex.h2" template [[nodiscard]] auto single_class_entry::includes(cpp2::impl::in c) -> decltype(auto) { return c == C; } -#line 167 "cpp2regex.h2" +#line 162 "cpp2regex.h2" template [[nodiscard]] auto single_class_entry::to_string() -> decltype(auto) { return bstring(1, C); } -#line 175 "cpp2regex.h2" +#line 170 "cpp2regex.h2" template [[nodiscard]] auto range_class_entry::includes(cpp2::impl::in c) -> decltype(auto) { return [_0 = Start, _1 = c, _2 = End]{ return cpp2::impl::cmp_less_eq(_0,_1) && cpp2::impl::cmp_less_eq(_1,_2); }(); } -#line 176 "cpp2regex.h2" +#line 171 "cpp2regex.h2" template [[nodiscard]] auto range_class_entry::to_string() -> decltype(auto) { return "" + cpp2::to_string(Start) + "-" + cpp2::to_string(End) + ""; } -#line 184 "cpp2regex.h2" +#line 179 "cpp2regex.h2" template [[nodiscard]] auto combined_class_entry::includes(cpp2::impl::in c) -> decltype(auto) { return (false || ... || List::includes(c)); } -#line 185 "cpp2regex.h2" +#line 180 "cpp2regex.h2" template [[nodiscard]] auto combined_class_entry::to_string() -> decltype(auto) { return (bstring() + ... + List::to_string()); } -#line 193 "cpp2regex.h2" +#line 188 "cpp2regex.h2" template [[nodiscard]] auto list_class_entry::includes(cpp2::impl::in c) -> decltype(auto) { return (false || ... || (List == c)); } -#line 194 "cpp2regex.h2" +#line 189 "cpp2regex.h2" template [[nodiscard]] auto list_class_entry::to_string() -> decltype(auto) { return (bstring() + ... + List); } -#line 202 "cpp2regex.h2" +#line 197 "cpp2regex.h2" template [[nodiscard]] auto named_class_entry::includes(cpp2::impl::in c) -> decltype(auto) { return Inner::includes(c); } -#line 203 "cpp2regex.h2" +#line 198 "cpp2regex.h2" template [[nodiscard]] auto named_class_entry::to_string() -> decltype(auto) { return "[:" + cpp2::to_string(Name.data()) + ":]"; } -#line 210 "cpp2regex.h2" +#line 205 "cpp2regex.h2" template [[nodiscard]] auto negated_class_entry::includes(cpp2::impl::in c) -> decltype(auto) { return !(Inner::includes(c)); } -#line 218 "cpp2regex.h2" +#line 213 "cpp2regex.h2" template [[nodiscard]] auto shorthand_class_entry::includes(cpp2::impl::in c) -> decltype(auto) { return Inner::includes(c); } -#line 219 "cpp2regex.h2" +#line 214 "cpp2regex.h2" template [[nodiscard]] auto shorthand_class_entry::to_string() -> decltype(auto) { return Name.str(); } -#line 266 "cpp2regex.h2" +#line 261 "cpp2regex.h2" template [[nodiscard]] auto alternative_token_matcher::match(auto const& cur, auto& ctx, auto const& end_func, auto const& tail, auto const& ...functions) -> auto{ return match_first(cur, ctx, end_func, tail, functions...); } -#line 270 "cpp2regex.h2" +#line 265 "cpp2regex.h2" template template [[nodiscard]] auto alternative_token_matcher::match_first(auto const& cur, auto& ctx, auto const& end_func, auto const& tail, auto const& cur_func, auto const& cur_reset, Other const& ...other) -> auto { auto inner_call {[_0 = (tail), _1 = (end_func)](auto const& tail_cur, auto& tail_ctx) -> auto{ @@ -817,7 +812,7 @@ template [[nodiscard]] auto make_on_return(Func const& func) -> d } } -#line 293 "cpp2regex.h2" +#line 288 "cpp2regex.h2" template [[nodiscard]] auto any_token_matcher(auto& cur, auto& ctx) -> bool { if ( cur != ctx.end // any char except the end @@ -830,7 +825,7 @@ template [[nodiscard]] auto any_token_matcher( return false; } -#line 344 "cpp2regex.h2" +#line 339 "cpp2regex.h2" template [[nodiscard]] auto class_token_matcher::match(auto& cur, auto& ctx) -> bool { if constexpr (case_insensitive) @@ -860,7 +855,7 @@ template [[nodiscard]] auto any_token_matcher( } } -#line 373 "cpp2regex.h2" +#line 368 "cpp2regex.h2" template template [[nodiscard]] auto class_token_matcher::match_any(cpp2::impl::in c) -> bool { bool r {First::includes(c)}; @@ -874,7 +869,7 @@ template [[nodiscard]] auto any_token_matcher( return r; } -#line 422 "cpp2regex.h2" +#line 417 "cpp2regex.h2" template [[nodiscard]] auto group_ref_token_matcher(auto& cur, auto& ctx) -> bool { auto g {ctx.get_group(group)}; @@ -905,7 +900,7 @@ template [[nodiscard]] auto gr } } -#line 455 "cpp2regex.h2" +#line 450 "cpp2regex.h2" template [[nodiscard]] auto line_end_token_matcher(auto const& cur, auto& ctx) -> bool { if (cur == ctx.end || (match_new_line && *cpp2::impl::assert_not_null(cur) == '\n')) { @@ -919,14 +914,14 @@ template [[ }} } -#line 471 "cpp2regex.h2" +#line 466 "cpp2regex.h2" template [[nodiscard]] auto line_start_token_matcher(auto const& cur, auto& ctx) -> bool { return cur == ctx.begin || // Start of string (match_new_line && *cpp2::impl::assert_not_null((cur - 1)) == '\n'); // Start of new line } -#line 482 "cpp2regex.h2" +#line 477 "cpp2regex.h2" template [[nodiscard]] auto lookahead_token_matcher(auto const& cur, auto& ctx, auto const& func) -> bool { auto r {func(cur, ctx, true_end_func())}; @@ -937,12 +932,12 @@ template [[nodiscard]] auto lookahead_token_match return cpp2::move(r).matched; } -#line 498 "cpp2regex.h2" +#line 493 "cpp2regex.h2" inline CPP2_CONSTEXPR int range_flags::not_greedy{ 1 }; inline CPP2_CONSTEXPR int range_flags::greedy{ 2 }; inline CPP2_CONSTEXPR int range_flags::possessive{ 3 }; -#line 509 "cpp2regex.h2" +#line 504 "cpp2regex.h2" template template [[nodiscard]] auto range_token_matcher::match(Iter const& cur, auto& ctx, auto const& inner, auto const& reset_func, auto const& end_func, auto const& tail) -> auto { if (range_flags::possessive == kind) { @@ -956,26 +951,26 @@ template [[nodiscard]] auto lookahead_token_match }} } -#line 522 "cpp2regex.h2" +#line 517 "cpp2regex.h2" template [[nodiscard]] auto range_token_matcher::is_below_upper_bound(cpp2::impl::in count) -> bool{ if (-1 == max_count) {return true; } else {return cpp2::impl::cmp_less(count,max_count); } } -#line 527 "cpp2regex.h2" +#line 522 "cpp2regex.h2" template [[nodiscard]] auto range_token_matcher::is_below_lower_bound(cpp2::impl::in count) -> bool{ if (-1 == min_count) {return false; } else {return cpp2::impl::cmp_less(count,min_count); } } -#line 532 "cpp2regex.h2" +#line 527 "cpp2regex.h2" template [[nodiscard]] auto range_token_matcher::is_in_range(cpp2::impl::in count) -> bool{ if (-1 != min_count && cpp2::impl::cmp_less(count,min_count)) {return false; } if (-1 != max_count && cpp2::impl::cmp_greater(count,max_count)) {return false; } return true; } -#line 538 "cpp2regex.h2" +#line 533 "cpp2regex.h2" template template [[nodiscard]] auto range_token_matcher::match_min_count(Iter const& cur, auto& ctx, auto const& inner, auto const& end_func, int& count_r) -> auto { // TODO: count_r as out parameter introduces a performance loss. auto res {ctx.pass(cur)}; @@ -992,7 +987,7 @@ template [[nodiscard]] auto lookahead_token_match return res; } -#line 554 "cpp2regex.h2" +#line 549 "cpp2regex.h2" template template [[nodiscard]] auto range_token_matcher::match_greedy(cpp2::impl::in count, Iter const& cur, Iter const& last_valid, auto& ctx, auto const& inner, auto const& reset_func, auto const& end_func, auto const& other) -> match_return { auto inner_call {[_0 = (count + 1), _1 = (cur), _2 = (inner), _3 = (reset_func), _4 = (end_func), _5 = (other)](auto const& tail_cur, auto& tail_ctx) -> auto{ @@ -1023,7 +1018,7 @@ template [[nodiscard]] auto lookahead_token_match return r; } -#line 584 "cpp2regex.h2" +#line 579 "cpp2regex.h2" template template [[nodiscard]] auto range_token_matcher::match_possessive(Iter const& cur, auto& ctx, auto const& inner, auto const& end_func, auto const& other) -> match_return { auto count {0}; @@ -1052,7 +1047,7 @@ template [[nodiscard]] auto lookahead_token_match return other(cpp2::move(pos), ctx, end_func); } -#line 612 "cpp2regex.h2" +#line 607 "cpp2regex.h2" template template [[nodiscard]] auto range_token_matcher::match_not_greedy(Iter const& cur, auto& ctx, auto const& inner, auto const& end_func, auto const& other) -> match_return { auto count {0}; @@ -1080,7 +1075,7 @@ template [[nodiscard]] auto lookahead_token_match return other(cpp2::move(pos), ctx, end_func); // Upper bound reached. } -#line 645 "cpp2regex.h2" +#line 640 "cpp2regex.h2" template [[nodiscard]] auto word_boundary_token_matcher(auto& cur, auto& ctx) -> bool { word_class words {}; @@ -1105,32 +1100,32 @@ template [[nodiscard]] auto word_boundary_token_mat return is_match; } -#line 689 "cpp2regex.h2" +#line 684 "cpp2regex.h2" template template regular_expression::search_return::search_return(cpp2::impl::in matched_, context const& ctx_, Iter const& pos_) : matched{ matched_ } , ctx{ ctx_ } , pos{ cpp2::unchecked_narrow(std::distance(ctx_.begin, pos_)) }{ -#line 693 "cpp2regex.h2" +#line 688 "cpp2regex.h2" } -#line 695 "cpp2regex.h2" +#line 690 "cpp2regex.h2" template template [[nodiscard]] auto regular_expression::search_return::group_number() const& -> decltype(auto) { return ctx.size(); } -#line 696 "cpp2regex.h2" +#line 691 "cpp2regex.h2" template template [[nodiscard]] auto regular_expression::search_return::group(cpp2::impl::in g) const& -> decltype(auto) { return ctx.get_group_string(g); } -#line 697 "cpp2regex.h2" +#line 692 "cpp2regex.h2" template template [[nodiscard]] auto regular_expression::search_return::group_start(cpp2::impl::in g) const& -> decltype(auto) { return ctx.get_group_start(g); } -#line 698 "cpp2regex.h2" +#line 693 "cpp2regex.h2" template template [[nodiscard]] auto regular_expression::search_return::group_end(cpp2::impl::in g) const& -> decltype(auto) { return ctx.get_group_end(g); } -#line 700 "cpp2regex.h2" +#line 695 "cpp2regex.h2" template template [[nodiscard]] auto regular_expression::search_return::group(cpp2::impl::in> g) const& -> decltype(auto) { return group(get_group_id(g)); } -#line 701 "cpp2regex.h2" +#line 696 "cpp2regex.h2" template template [[nodiscard]] auto regular_expression::search_return::group_start(cpp2::impl::in> g) const& -> decltype(auto) { return group_start(get_group_id(g)); } -#line 702 "cpp2regex.h2" +#line 697 "cpp2regex.h2" template template [[nodiscard]] auto regular_expression::search_return::group_end(cpp2::impl::in> g) const& -> decltype(auto) { return group_end(get_group_id(g)); } -#line 704 "cpp2regex.h2" +#line 699 "cpp2regex.h2" template template [[nodiscard]] auto regular_expression::search_return::get_group_id(cpp2::impl::in> g) const& -> auto{ auto group_id {matcher::get_named_group_index(g)}; if (-1 == group_id) { @@ -1139,13 +1134,13 @@ template [[nodiscard]] auto word_boundary_token_mat return group_id; } -#line 713 "cpp2regex.h2" +#line 708 "cpp2regex.h2" template [[nodiscard]] auto regular_expression::match(cpp2::impl::in> str) const& -> decltype(auto) { return match(str.begin(), str.end()); } -#line 714 "cpp2regex.h2" +#line 709 "cpp2regex.h2" template [[nodiscard]] auto regular_expression::match(cpp2::impl::in> str, auto const& start) const& -> decltype(auto) { return match(get_iter(str, start), str.end()); } -#line 715 "cpp2regex.h2" +#line 710 "cpp2regex.h2" template [[nodiscard]] auto regular_expression::match(cpp2::impl::in> str, auto const& start, auto const& length) const& -> decltype(auto) { return match(get_iter(str, start), get_iter(str, start + length)); } -#line 716 "cpp2regex.h2" +#line 711 "cpp2regex.h2" template template [[nodiscard]] auto regular_expression::match(Iter const& start, Iter const& end) const& -> search_return { context ctx {start, end}; @@ -1154,13 +1149,13 @@ template [[nodiscard]] auto word_boundary_token_mat return search_return(r.matched && r.pos == end, cpp2::move(ctx), r.pos); } -#line 724 "cpp2regex.h2" +#line 719 "cpp2regex.h2" template [[nodiscard]] auto regular_expression::search(cpp2::impl::in> str) const& -> decltype(auto) { return search(str.begin(), str.end()); } -#line 725 "cpp2regex.h2" +#line 720 "cpp2regex.h2" template [[nodiscard]] auto regular_expression::search(cpp2::impl::in> str, auto const& start) const& -> decltype(auto) { return search(get_iter(str, start), str.end()); } -#line 726 "cpp2regex.h2" +#line 721 "cpp2regex.h2" template [[nodiscard]] auto regular_expression::search(cpp2::impl::in> str, auto const& start, auto const& length) const& -> decltype(auto) { return search(get_iter(str, start), get_iter(str, start + length)); } -#line 727 "cpp2regex.h2" +#line 722 "cpp2regex.h2" template template [[nodiscard]] auto regular_expression::search(Iter const& start, Iter const& end) const& -> search_return { context ctx {start, end}; @@ -1181,10 +1176,10 @@ template [[nodiscard]] auto word_boundary_token_mat return search_return(r.matched, cpp2::move(ctx), cpp2::move(r).pos); } -#line 747 "cpp2regex.h2" +#line 742 "cpp2regex.h2" template [[nodiscard]] auto regular_expression::to_string() const& -> decltype(auto) { return matcher_wrapper::to_string(); } -#line 751 "cpp2regex.h2" +#line 746 "cpp2regex.h2" template [[nodiscard]] auto regular_expression::get_iter(cpp2::impl::in> str, auto const& pos) -> auto{ if (cpp2::impl::cmp_less(pos,str.size())) { return str.begin() + pos; @@ -1194,7 +1189,7 @@ template [[nodiscard]] auto word_boundary_token_mat } } -#line 761 "cpp2regex.h2" +#line 756 "cpp2regex.h2" } } diff --git a/include/cpp2regex.h2 b/include/cpp2regex.h2 index 41d699903..04b3add74 100644 --- a/include/cpp2regex.h2 +++ b/include/cpp2regex.h2 @@ -1,14 +1,9 @@ -// Copyright (c) Herb Sutter -// SPDX-License-Identifier: CC-BY-NC-ND-4.0 - -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. +// Copyright 2022-2024 Herb Sutter +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +// Part of the Cppfront Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://github.com/hsutter/cppfront/blob/main/LICENSE for license information. //=========================================================================== diff --git a/include/cpp2util.h b/include/cpp2util.h index ebedeb5fb..c59de3602 100644 --- a/include/cpp2util.h +++ b/include/cpp2util.h @@ -1,14 +1,9 @@ -// Copyright (c) Herb Sutter -// SPDX-License-Identifier: CC-BY-NC-ND-4.0 - -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. +// Copyright 2022-2024 Herb Sutter +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +// Part of the Cppfront Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://github.com/hsutter/cppfront/blob/main/LICENSE for license information. //=========================================================================== diff --git a/regression-tests/test-results/version b/regression-tests/test-results/version index 3e9d5db23..419132af7 100644 --- a/regression-tests/test-results/version +++ b/regression-tests/test-results/version @@ -1,11 +1,4 @@ -cppfront compiler v0.8.0 Build 9A10:0946 -Copyright(c) Herb Sutter All rights reserved - -SPDX-License-Identifier: CC-BY-NC-ND-4.0 - No commercial use - No forks/derivatives - Note: This license emphasizes that this is a personal - experiment; it will be upgraded if that changes - -Absolutely no warranty - try at your own risk +cppfront compiler v0.8.0 Build 9A10:1540 +SPDX-License-Identifier Apache-2.0 WITH LLVM-exception +Copyright (c) 2022-2024 Herb Sutter diff --git a/source/build.info b/source/build.info index 4aced9668..71b5052e3 100644 --- a/source/build.info +++ b/source/build.info @@ -1 +1 @@ -"9A10:0946" \ No newline at end of file +"9A10:1540" \ No newline at end of file diff --git a/source/common.h b/source/common.h index 5839b4cd8..2b46e9d2b 100644 --- a/source/common.h +++ b/source/common.h @@ -1,14 +1,9 @@ -// Copyright (c) Herb Sutter -// SPDX-License-Identifier: CC-BY-NC-ND-4.0 - -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. +// Copyright 2022-2024 Herb Sutter +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +// Part of the Cppfront Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://github.com/hsutter/cppfront/blob/main/LICENSE for license information. // We want cppfront to build cleanly at very high warning levels, with warnings @@ -912,16 +907,11 @@ class cmdline_processor help_requested = true; print("\ncppfront compiler " #include "version.info" - " Build " + " Build " #include "build.info" ); - print("\nCopyright(c) Herb Sutter All rights reserved\n"); - print("\nSPDX-License-Identifier: CC-BY-NC-ND-4.0"); - print("\n No commercial use"); - print("\n No forks/derivatives"); - print("\n Note: This license emphasizes that this is a personal"); - print("\n experiment; it will be upgraded if that changes\n"); - print("\nAbsolutely no warranty - try at your own risk\n"); + print("\nSPDX-License-Identifier Apache-2.0 WITH LLVM-exception"); + print("\nCopyright (c) 2022-2024 Herb Sutter\n"); } } cmdline; diff --git a/source/cppfront.cpp b/source/cppfront.cpp index a40825289..15226521d 100644 --- a/source/cppfront.cpp +++ b/source/cppfront.cpp @@ -1,14 +1,9 @@ -// Copyright (c) Herb Sutter -// SPDX-License-Identifier: CC-BY-NC-ND-4.0 - -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. +// Copyright 2022-2024 Herb Sutter +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +// Part of the Cppfront Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://github.com/hsutter/cppfront/blob/main/LICENSE for license information. //=========================================================================== diff --git a/source/io.h b/source/io.h index a2fc7aaf5..9da2128e7 100644 --- a/source/io.h +++ b/source/io.h @@ -1,14 +1,9 @@ -// Copyright (c) Herb Sutter -// SPDX-License-Identifier: CC-BY-NC-ND-4.0 - -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. +// Copyright 2022-2024 Herb Sutter +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +// Part of the Cppfront Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://github.com/hsutter/cppfront/blob/main/LICENSE for license information. //=========================================================================== diff --git a/source/lex.h b/source/lex.h index ef4d23a5b..8dce93406 100644 --- a/source/lex.h +++ b/source/lex.h @@ -1,14 +1,9 @@ -// Copyright (c) Herb Sutter -// SPDX-License-Identifier: CC-BY-NC-ND-4.0 - -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. +// Copyright 2022-2024 Herb Sutter +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +// Part of the Cppfront Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://github.com/hsutter/cppfront/blob/main/LICENSE for license information. //=========================================================================== diff --git a/source/parse.h b/source/parse.h index a8ad4bd9e..1290fcdba 100644 --- a/source/parse.h +++ b/source/parse.h @@ -1,14 +1,9 @@ -// Copyright (c) Herb Sutter -// SPDX-License-Identifier: CC-BY-NC-ND-4.0 - -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. +// Copyright 2022-2024 Herb Sutter +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +// Part of the Cppfront Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://github.com/hsutter/cppfront/blob/main/LICENSE for license information. //=========================================================================== diff --git a/source/reflect.h b/source/reflect.h index 27765339e..c73e5a497 100644 --- a/source/reflect.h +++ b/source/reflect.h @@ -10,103 +10,103 @@ #line 1 "reflect.h2" -#line 22 "reflect.h2" +#line 17 "reflect.h2" namespace cpp2 { namespace meta { -#line 34 "reflect.h2" +#line 29 "reflect.h2" class compiler_services; -#line 233 "reflect.h2" +#line 228 "reflect.h2" class declaration_base; -#line 259 "reflect.h2" +#line 254 "reflect.h2" class declaration; -#line 341 "reflect.h2" +#line 336 "reflect.h2" class function_declaration; -#line 432 "reflect.h2" +#line 427 "reflect.h2" class object_declaration; -#line 468 "reflect.h2" +#line 463 "reflect.h2" class type_declaration; -#line 606 "reflect.h2" +#line 601 "reflect.h2" class alias_declaration; -#line 1056 "reflect.h2" +#line 1051 "reflect.h2" class value_member_info; -#line 1574 "reflect.h2" +#line 1569 "reflect.h2" class expression_flags; -#line 1590 "reflect.h2" +#line 1585 "reflect.h2" class regex_token; -#line 1616 "reflect.h2" +#line 1611 "reflect.h2" class regex_token_check; -#line 1635 "reflect.h2" +#line 1630 "reflect.h2" class regex_token_code; -#line 1654 "reflect.h2" +#line 1649 "reflect.h2" class regex_token_empty; -#line 1670 "reflect.h2" +#line 1665 "reflect.h2" class regex_token_list; -#line 1709 "reflect.h2" +#line 1704 "reflect.h2" class parse_context_group_state; -#line 1770 "reflect.h2" +#line 1765 "reflect.h2" class parse_context_branch_reset_state; -#line 1813 "reflect.h2" +#line 1808 "reflect.h2" class parse_context; -#line 2211 "reflect.h2" +#line 2206 "reflect.h2" class generation_function_context; -#line 2229 "reflect.h2" +#line 2224 "reflect.h2" class generation_context; -#line 2427 "reflect.h2" +#line 2422 "reflect.h2" class alternative_token; -#line 2442 "reflect.h2" +#line 2437 "reflect.h2" class alternative_token_gen; -#line 2494 "reflect.h2" +#line 2489 "reflect.h2" class any_token; -#line 2512 "reflect.h2" +#line 2507 "reflect.h2" class char_token; -#line 2615 "reflect.h2" +#line 2610 "reflect.h2" class class_token; -#line 2830 "reflect.h2" +#line 2825 "reflect.h2" class group_ref_token; -#line 2961 "reflect.h2" +#line 2956 "reflect.h2" class group_token; -#line 3248 "reflect.h2" +#line 3243 "reflect.h2" class lookahead_token; -#line 3329 "reflect.h2" +#line 3324 "reflect.h2" class range_token; -#line 3477 "reflect.h2" +#line 3472 "reflect.h2" class special_range_token; -#line 3544 "reflect.h2" +#line 3539 "reflect.h2" template class regex_generator; -#line 3791 "reflect.h2" +#line 3786 "reflect.h2" } } @@ -116,16 +116,11 @@ template class regex_generator; #line 1 "reflect.h2" -// Copyright (c) Herb Sutter -// SPDX-License-Identifier: CC-BY-NC-ND-4.0 - -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. +// Copyright 2022-2024 Herb Sutter +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +// Part of the Cppfront Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://github.com/hsutter/cppfront/blob/main/LICENSE for license information. //=========================================================================== @@ -136,16 +131,16 @@ template class regex_generator; #include "cpp2regex.h" using namespace cpp2::regex; -#line 22 "reflect.h2" +#line 17 "reflect.h2" namespace cpp2 { namespace meta { -#line 34 "reflect.h2" +#line 29 "reflect.h2" class compiler_services { -#line 38 "reflect.h2" +#line 33 "reflect.h2" private: std::vector* errors; private: std::set* includes; private: int errors_original_size; @@ -155,7 +150,7 @@ class compiler_services private: std::vector metafunction_args {}; private: bool metafunctions_used {false}; -#line 49 "reflect.h2" +#line 44 "reflect.h2" public: explicit compiler_services( std::vector* errors_, @@ -163,59 +158,59 @@ class compiler_services stable_vector* generated_tokens_ ); -#line 65 "reflect.h2" +#line 60 "reflect.h2" public: auto set_metafunction_name(cpp2::impl::in name, cpp2::impl::in> args) & -> void; -#line 71 "reflect.h2" +#line 66 "reflect.h2" public: [[nodiscard]] auto get_metafunction_name() const& -> std::string_view; public: [[nodiscard]] auto get_argument(cpp2::impl::in index) & -> std::string; -#line 81 "reflect.h2" +#line 76 "reflect.h2" public: [[nodiscard]] auto get_arguments() & -> std::vector; -#line 86 "reflect.h2" +#line 81 "reflect.h2" public: [[nodiscard]] auto arguments_were_used() const& -> bool; using parse_statement_ret = std::unique_ptr; -#line 88 "reflect.h2" +#line 83 "reflect.h2" protected: [[nodiscard]] auto parse_statement( std::string_view source ) & -> parse_statement_ret; -#line 141 "reflect.h2" +#line 136 "reflect.h2" public: [[nodiscard]] auto add_runtime_support_include(cpp2::impl::in s) & -> decltype(auto); public: [[nodiscard]] virtual auto position() const -> source_position; -#line 152 "reflect.h2" +#line 147 "reflect.h2" public: auto require( cpp2::impl::in b, cpp2::impl::in msg ) const& -> void; -#line 163 "reflect.h2" +#line 158 "reflect.h2" public: auto error(cpp2::impl::in msg) const& -> void; -#line 175 "reflect.h2" +#line 170 "reflect.h2" public: auto report_violation(auto const& msg) const& -> void; -#line 183 "reflect.h2" +#line 178 "reflect.h2" public: [[nodiscard]] auto is_active() const& -> decltype(auto); public: virtual ~compiler_services() noexcept; public: compiler_services(compiler_services const& that); -#line 184 "reflect.h2" +#line 179 "reflect.h2" }; -#line 233 "reflect.h2" +#line 228 "reflect.h2" class declaration_base : public compiler_services { -#line 237 "reflect.h2" +#line 232 "reflect.h2" protected: declaration_node* n; protected: explicit declaration_base( @@ -224,28 +219,28 @@ class declaration_base cpp2::impl::in s ); -#line 250 "reflect.h2" +#line 245 "reflect.h2" public: [[nodiscard]] auto position() const -> source_position override; public: [[nodiscard]] auto print() const& -> std::string; public: virtual ~declaration_base() noexcept; public: declaration_base(declaration_base const& that); -#line 253 "reflect.h2" +#line 248 "reflect.h2" }; -#line 259 "reflect.h2" +#line 254 "reflect.h2" class declaration : public declaration_base { -#line 263 "reflect.h2" +#line 258 "reflect.h2" public: explicit declaration( declaration_node* n_, cpp2::impl::in s ); -#line 272 "reflect.h2" +#line 267 "reflect.h2" public: [[nodiscard]] auto is_public() const& -> bool; public: [[nodiscard]] auto is_protected() const& -> bool; public: [[nodiscard]] auto is_private() const& -> bool; @@ -264,7 +259,7 @@ class declaration public: [[nodiscard]] auto name() const& -> std::string_view; -#line 293 "reflect.h2" +#line 288 "reflect.h2" public: [[nodiscard]] auto has_initializer() const& -> bool; public: [[nodiscard]] auto is_global() const& -> bool; @@ -306,21 +301,21 @@ class declaration public: declaration(declaration const& that); -#line 335 "reflect.h2" +#line 330 "reflect.h2" }; -#line 341 "reflect.h2" +#line 336 "reflect.h2" class function_declaration : public declaration { -#line 345 "reflect.h2" +#line 340 "reflect.h2" public: explicit function_declaration( declaration_node* n_, cpp2::impl::in s ); -#line 355 "reflect.h2" +#line 350 "reflect.h2" public: [[nodiscard]] auto index_of_parameter_named(cpp2::impl::in s) const& -> int; public: [[nodiscard]] auto has_parameter_named(cpp2::impl::in s) const& -> bool; public: [[nodiscard]] auto has_in_parameter_named(cpp2::impl::in s) const& -> bool; @@ -361,7 +356,7 @@ class function_declaration public: [[nodiscard]] auto get_parameters() const& -> std::vector; -#line 403 "reflect.h2" +#line 398 "reflect.h2" public: [[nodiscard]] auto is_binary_comparison_function() const& -> bool; public: [[nodiscard]] auto default_to_virtual() & -> decltype(auto); @@ -372,94 +367,94 @@ class function_declaration public: function_declaration(function_declaration const& that); -#line 426 "reflect.h2" +#line 421 "reflect.h2" }; -#line 432 "reflect.h2" +#line 427 "reflect.h2" class object_declaration : public declaration { -#line 436 "reflect.h2" +#line 431 "reflect.h2" public: explicit object_declaration( declaration_node* n_, cpp2::impl::in s ); -#line 446 "reflect.h2" +#line 441 "reflect.h2" public: [[nodiscard]] auto is_const() const& -> bool; public: [[nodiscard]] auto has_wildcard_type() const& -> bool; public: [[nodiscard]] auto type() const& -> std::string; -#line 456 "reflect.h2" +#line 451 "reflect.h2" public: [[nodiscard]] auto initializer() const& -> std::string; public: object_declaration(object_declaration const& that); -#line 462 "reflect.h2" +#line 457 "reflect.h2" }; -#line 468 "reflect.h2" +#line 463 "reflect.h2" class type_declaration : public declaration { -#line 472 "reflect.h2" +#line 467 "reflect.h2" public: explicit type_declaration( declaration_node* n_, cpp2::impl::in s ); -#line 482 "reflect.h2" +#line 477 "reflect.h2" public: auto reserve_names(cpp2::impl::in name, auto&& ...etc) const& -> void; -#line 496 "reflect.h2" +#line 491 "reflect.h2" public: [[nodiscard]] auto is_polymorphic() const& -> bool; public: [[nodiscard]] auto is_final() const& -> bool; public: [[nodiscard]] auto make_final() & -> bool; public: [[nodiscard]] auto get_member_functions() const& -> std::vector; -#line 511 "reflect.h2" +#line 506 "reflect.h2" public: [[nodiscard]] auto get_member_functions_needing_initializer() const& -> std::vector; -#line 526 "reflect.h2" +#line 521 "reflect.h2" public: [[nodiscard]] auto get_member_objects() const& -> std::vector; -#line 536 "reflect.h2" +#line 531 "reflect.h2" public: [[nodiscard]] auto get_member_types() const& -> std::vector; -#line 546 "reflect.h2" +#line 541 "reflect.h2" public: [[nodiscard]] auto get_member_aliases() const& -> std::vector; -#line 556 "reflect.h2" +#line 551 "reflect.h2" public: [[nodiscard]] auto get_members() const& -> std::vector; struct query_declared_value_set_functions_ret { bool out_this_in_that; bool out_this_move_that; bool inout_this_in_that; bool inout_this_move_that; }; -#line 566 "reflect.h2" +#line 561 "reflect.h2" public: [[nodiscard]] auto query_declared_value_set_functions() const& -> query_declared_value_set_functions_ret; -#line 582 "reflect.h2" +#line 577 "reflect.h2" public: auto add_member(cpp2::impl::in source) & -> void; -#line 596 "reflect.h2" +#line 591 "reflect.h2" public: [[nodiscard]] auto remove_marked_members() & -> decltype(auto); public: [[nodiscard]] auto remove_all_members() & -> decltype(auto); public: [[nodiscard]] auto disable_member_function_generation() & -> decltype(auto); public: type_declaration(type_declaration const& that); -#line 600 "reflect.h2" +#line 595 "reflect.h2" }; -#line 606 "reflect.h2" +#line 601 "reflect.h2" class alias_declaration : public declaration { -#line 610 "reflect.h2" +#line 605 "reflect.h2" public: explicit alias_declaration( declaration_node* n_, @@ -468,65 +463,65 @@ class alias_declaration public: alias_declaration(alias_declaration const& that); -#line 619 "reflect.h2" +#line 614 "reflect.h2" }; -#line 634 "reflect.h2" +#line 629 "reflect.h2" auto add_virtual_destructor(meta::type_declaration& t) -> void; -#line 652 "reflect.h2" +#line 647 "reflect.h2" auto interface(meta::type_declaration& t) -> void; -#line 698 "reflect.h2" +#line 693 "reflect.h2" auto polymorphic_base(meta::type_declaration& t) -> void; -#line 743 "reflect.h2" +#line 738 "reflect.h2" auto ordered_impl( meta::type_declaration& t, cpp2::impl::in ordering ) -> void; -#line 772 "reflect.h2" +#line 767 "reflect.h2" auto ordered(meta::type_declaration& t) -> void; -#line 780 "reflect.h2" +#line 775 "reflect.h2" auto weakly_ordered(meta::type_declaration& t) -> void; -#line 788 "reflect.h2" +#line 783 "reflect.h2" auto partially_ordered(meta::type_declaration& t) -> void; -#line 810 "reflect.h2" +#line 805 "reflect.h2" auto copyable(meta::type_declaration& t) -> void; -#line 843 "reflect.h2" +#line 838 "reflect.h2" auto hashable(meta::type_declaration& t) -> void; -#line 876 "reflect.h2" +#line 871 "reflect.h2" auto basic_value(meta::type_declaration& t) -> void; -#line 904 "reflect.h2" +#line 899 "reflect.h2" auto value(meta::type_declaration& t) -> void; -#line 910 "reflect.h2" +#line 905 "reflect.h2" auto weakly_ordered_value(meta::type_declaration& t) -> void; -#line 916 "reflect.h2" +#line 911 "reflect.h2" auto partially_ordered_value(meta::type_declaration& t) -> void; -#line 945 "reflect.h2" +#line 940 "reflect.h2" auto cpp1_rule_of_zero(meta::type_declaration& t) -> void; -#line 987 "reflect.h2" +#line 982 "reflect.h2" auto cpp2_struct(meta::type_declaration& t) -> void; -#line 1056 "reflect.h2" +#line 1051 "reflect.h2" class value_member_info { public: std::string name; public: std::string type; public: std::string value; public: value_member_info(auto const& name_, auto const& type_, auto const& value_); -#line 1060 "reflect.h2" +#line 1055 "reflect.h2" }; auto basic_enum( @@ -535,22 +530,22 @@ auto basic_enum( cpp2::impl::in bitwise ) -> void; -#line 1326 "reflect.h2" +#line 1321 "reflect.h2" auto cpp2_enum(meta::type_declaration& t) -> void; -#line 1353 "reflect.h2" +#line 1348 "reflect.h2" auto flag_enum(meta::type_declaration& t) -> void; -#line 1399 "reflect.h2" +#line 1394 "reflect.h2" auto cpp2_union(meta::type_declaration& t) -> void; -#line 1550 "reflect.h2" +#line 1545 "reflect.h2" auto print(cpp2::impl::in t) -> void; -#line 1570 "reflect.h2" +#line 1565 "reflect.h2" using error_func = std::function x)>; -#line 1574 "reflect.h2" +#line 1569 "reflect.h2" class expression_flags { private: cpp2::u8 _value; private: constexpr expression_flags(cpp2::impl::in _val); @@ -585,20 +580,20 @@ public: [[nodiscard]] auto to_code() const& -> std::string; public: [[nodiscard]] static auto from_string(cpp2::impl::in s) -> expression_flags; public: [[nodiscard]] static auto from_code(cpp2::impl::in s) -> expression_flags; -#line 1582 "reflect.h2" +#line 1577 "reflect.h2" }; -#line 1590 "reflect.h2" +#line 1585 "reflect.h2" class regex_token { public: std::string string_rep; public: explicit regex_token(cpp2::impl::in str); -#line 1598 "reflect.h2" +#line 1593 "reflect.h2" public: explicit regex_token(); -#line 1603 "reflect.h2" +#line 1598 "reflect.h2" public: virtual auto generate_code([[maybe_unused]] generation_context& unnamed_param_2) const -> void = 0; public: virtual auto add_groups([[maybe_unused]] std::set& unnamed_param_2) const -> void; @@ -609,24 +604,24 @@ class regex_token public: regex_token(regex_token const&) = delete; /* No 'that' constructor, suppress copy */ public: auto operator=(regex_token const&) -> void = delete; -#line 1608 "reflect.h2" +#line 1603 "reflect.h2" }; using token_ptr = std::shared_ptr; using token_vec = std::vector; -#line 1614 "reflect.h2" +#line 1609 "reflect.h2" // Adds a check in code generation. // class regex_token_check : public regex_token { -#line 1620 "reflect.h2" +#line 1615 "reflect.h2" private: std::string check; public: explicit regex_token_check(cpp2::impl::in str, cpp2::impl::in check_); -#line 1627 "reflect.h2" +#line 1622 "reflect.h2" public: auto generate_code(generation_context& ctx) const -> void override; public: virtual ~regex_token_check() noexcept; @@ -634,21 +629,21 @@ class regex_token_check public: auto operator=(regex_token_check const&) -> void = delete; -#line 1630 "reflect.h2" +#line 1625 "reflect.h2" }; -#line 1633 "reflect.h2" +#line 1628 "reflect.h2" // Adds code in code generation. // class regex_token_code : public regex_token { -#line 1639 "reflect.h2" +#line 1634 "reflect.h2" private: std::string code; public: explicit regex_token_code(cpp2::impl::in str, cpp2::impl::in code_); -#line 1646 "reflect.h2" +#line 1641 "reflect.h2" public: auto generate_code(generation_context& ctx) const -> void override; public: virtual ~regex_token_code() noexcept; @@ -656,19 +651,19 @@ class regex_token_code public: auto operator=(regex_token_code const&) -> void = delete; -#line 1649 "reflect.h2" +#line 1644 "reflect.h2" }; -#line 1652 "reflect.h2" +#line 1647 "reflect.h2" // Token that does not influence the matching. E.g. comment. // class regex_token_empty : public regex_token { -#line 1658 "reflect.h2" +#line 1653 "reflect.h2" public: explicit regex_token_empty(cpp2::impl::in str); -#line 1662 "reflect.h2" +#line 1657 "reflect.h2" public: auto generate_code([[maybe_unused]] generation_context& unnamed_param_2) const -> void override; public: virtual ~regex_token_empty() noexcept; @@ -676,27 +671,27 @@ class regex_token_empty public: auto operator=(regex_token_empty const&) -> void = delete; -#line 1665 "reflect.h2" +#line 1660 "reflect.h2" }; -#line 1668 "reflect.h2" +#line 1663 "reflect.h2" // Represents a list of regex tokens as one token. // class regex_token_list : public regex_token { -#line 1674 "reflect.h2" +#line 1669 "reflect.h2" public: token_vec tokens; public: explicit regex_token_list(cpp2::impl::in t); -#line 1681 "reflect.h2" +#line 1676 "reflect.h2" public: auto generate_code(generation_context& ctx) const -> void override; -#line 1687 "reflect.h2" +#line 1682 "reflect.h2" public: auto add_groups(std::set& groups) const -> void override; -#line 1693 "reflect.h2" +#line 1688 "reflect.h2" public: [[nodiscard]] static auto gen_string(cpp2::impl::in vec) -> std::string; public: virtual ~regex_token_list() noexcept; @@ -704,10 +699,10 @@ class regex_token_list public: auto operator=(regex_token_list const&) -> void = delete; -#line 1700 "reflect.h2" +#line 1695 "reflect.h2" }; -#line 1703 "reflect.h2" +#line 1698 "reflect.h2" // // Parse and generation context. // @@ -723,33 +718,33 @@ class parse_context_group_state // Start a new alternative. public: auto next_alternative() & -> void; -#line 1723 "reflect.h2" +#line 1718 "reflect.h2" // Swap this state with the other one. NOLINTNEXTLINE(performance-noexcept-swap) public: auto swap(parse_context_group_state& t) & -> void; -#line 1730 "reflect.h2" +#line 1725 "reflect.h2" // Convert this state into a regex token. public: [[nodiscard]] auto get_as_token() & -> token_ptr; -#line 1742 "reflect.h2" +#line 1737 "reflect.h2" // Add a token to the current matcher list. public: auto add(cpp2::impl::in token) & -> void; -#line 1747 "reflect.h2" +#line 1742 "reflect.h2" // True if current matcher list is empty. public: [[nodiscard]] auto empty() const& -> bool; -#line 1751 "reflect.h2" +#line 1746 "reflect.h2" // Apply optimizations to the matcher list. public: static auto post_process_list(token_vec& list) -> void; public: parse_context_group_state(auto const& cur_match_list_, auto const& alternate_match_lists_, auto const& modifiers_); public: parse_context_group_state(); -#line 1765 "reflect.h2" +#line 1760 "reflect.h2" }; -#line 1768 "reflect.h2" +#line 1763 "reflect.h2" // State for the branch reset. Takes care of the group numbering. See '(|)'. // class parse_context_branch_reset_state @@ -762,25 +757,25 @@ class parse_context_branch_reset_state // Next group identifier. public: [[nodiscard]] auto next() & -> int; -#line 1786 "reflect.h2" +#line 1781 "reflect.h2" // Set next group identifier. public: auto set_next(cpp2::impl::in g) & -> void; -#line 1792 "reflect.h2" +#line 1787 "reflect.h2" // Start a new alternative branch. public: auto next_alternative() & -> void; -#line 1799 "reflect.h2" +#line 1794 "reflect.h2" // Initialize for a branch reset group. public: auto set_active_reset(cpp2::impl::in restart) & -> void; public: parse_context_branch_reset_state(auto const& is_active_, auto const& cur_group_, auto const& max_group_, auto const& from_); public: parse_context_branch_reset_state(); -#line 1806 "reflect.h2" +#line 1801 "reflect.h2" }; -#line 1809 "reflect.h2" +#line 1804 "reflect.h2" // Context during parsing of the regular expressions. // // Keeps track of the distributed group identifiers, current parsed group and branch resets. @@ -794,7 +789,7 @@ class parse_context private: parse_context_group_state cur_group_state {}; private: parse_context_branch_reset_state cur_branch_reset_state {}; -#line 1823 "reflect.h2" +#line 1818 "reflect.h2" public: std::map named_groups {}; private: error_func error_out; // TODO: Declaring std::function fails for cpp2. @@ -802,64 +797,64 @@ class parse_context public: explicit parse_context(cpp2::impl::in r, auto const& e); -#line 1834 "reflect.h2" +#line 1829 "reflect.h2" // State management functions // // Returned group state needs to be stored and provided in `end_group`. public: [[nodiscard]] auto start_group() & -> parse_context_group_state; -#line 1847 "reflect.h2" +#line 1842 "reflect.h2" // `old_state` argument needs to be from start group. public: [[nodiscard]] auto end_group(cpp2::impl::in old_state) & -> token_ptr; -#line 1855 "reflect.h2" +#line 1850 "reflect.h2" public: [[nodiscard]] auto get_modifiers() const& -> expression_flags; -#line 1859 "reflect.h2" +#line 1854 "reflect.h2" public: auto set_modifiers(cpp2::impl::in mod) & -> void; -#line 1863 "reflect.h2" +#line 1858 "reflect.h2" // Branch reset management functions // public: [[nodiscard]] auto branch_reset_new_state() & -> parse_context_branch_reset_state; -#line 1875 "reflect.h2" +#line 1870 "reflect.h2" public: auto branch_reset_restore_state(cpp2::impl::in old_state) & -> void; -#line 1882 "reflect.h2" +#line 1877 "reflect.h2" public: auto next_alternative() & -> void; -#line 1888 "reflect.h2" +#line 1883 "reflect.h2" // Regex token management // public: auto add_token(cpp2::impl::in token) & -> void; -#line 1894 "reflect.h2" +#line 1889 "reflect.h2" public: [[nodiscard]] auto has_token() const& -> bool; -#line 1898 "reflect.h2" +#line 1893 "reflect.h2" public: [[nodiscard]] auto pop_token() & -> token_ptr; -#line 1909 "reflect.h2" +#line 1904 "reflect.h2" public: [[nodiscard]] auto get_as_token() & -> token_ptr; -#line 1913 "reflect.h2" +#line 1908 "reflect.h2" // Group management // public: [[nodiscard]] auto get_cur_group() const& -> int; -#line 1919 "reflect.h2" +#line 1914 "reflect.h2" public: [[nodiscard]] auto next_group() & -> int; -#line 1923 "reflect.h2" +#line 1918 "reflect.h2" public: auto set_named_group(cpp2::impl::in name, cpp2::impl::in id) & -> void; -#line 1930 "reflect.h2" +#line 1925 "reflect.h2" public: [[nodiscard]] auto get_named_group(cpp2::impl::in name) const& -> int; -#line 1941 "reflect.h2" +#line 1936 "reflect.h2" // Position management functions // public: [[nodiscard]] auto current() const& -> char; @@ -867,51 +862,51 @@ class parse_context // Get the next token in the regex, skipping spaces according to the parameters. See `x` and `xx` modifiers. private: [[nodiscard]] auto get_next_position(cpp2::impl::in in_class, cpp2::impl::in no_skip) const& -> size_t; -#line 1985 "reflect.h2" +#line 1980 "reflect.h2" // Return true if next token is available. private: [[nodiscard]] auto next_impl(cpp2::impl::in in_class, cpp2::impl::in no_skip) & -> bool; -#line 1997 "reflect.h2" +#line 1992 "reflect.h2" public: [[nodiscard]] auto next() & -> decltype(auto); public: [[nodiscard]] auto next_in_class() & -> decltype(auto); public: [[nodiscard]] auto next_no_skip() & -> decltype(auto); public: [[nodiscard]] auto next_n(cpp2::impl::in n) & -> bool; -#line 2010 "reflect.h2" +#line 2005 "reflect.h2" public: [[nodiscard]] auto has_next() const& -> bool; private: [[nodiscard]] auto grab_until_impl(cpp2::impl::in e, cpp2::impl::out r, cpp2::impl::in any) & -> bool; -#line 2033 "reflect.h2" +#line 2028 "reflect.h2" public: [[nodiscard]] auto grab_until(cpp2::impl::in e, cpp2::impl::out r) & -> decltype(auto); public: [[nodiscard]] auto grab_until(cpp2::impl::in e, cpp2::impl::out r) & -> decltype(auto); public: [[nodiscard]] auto grab_until_one_of(cpp2::impl::in e, cpp2::impl::out r) & -> decltype(auto); public: [[nodiscard]] auto grab_n(cpp2::impl::in n, cpp2::impl::out r) & -> bool; -#line 2050 "reflect.h2" +#line 2045 "reflect.h2" public: [[nodiscard]] auto grab_number() & -> std::string; -#line 2071 "reflect.h2" +#line 2066 "reflect.h2" private: [[nodiscard]] auto peek_impl(cpp2::impl::in in_class) const& -> char; -#line 2081 "reflect.h2" +#line 2076 "reflect.h2" public: [[nodiscard]] auto peek() const& -> decltype(auto); public: [[nodiscard]] auto peek_in_class() const& -> decltype(auto); -#line 2085 "reflect.h2" +#line 2080 "reflect.h2" // Parsing functions // public: [[nodiscard]] auto parser_group_modifiers(cpp2::impl::in change_str, expression_flags& parser_modifiers) & -> bool; -#line 2141 "reflect.h2" +#line 2136 "reflect.h2" public: [[nodiscard]] auto parse_until(cpp2::impl::in term) & -> bool; -#line 2179 "reflect.h2" +#line 2174 "reflect.h2" public: [[nodiscard]] auto parse(cpp2::impl::in modifiers) & -> bool; -#line 2194 "reflect.h2" +#line 2189 "reflect.h2" // Misc functions public: [[nodiscard]] auto get_pos() const& -> decltype(auto); @@ -923,10 +918,10 @@ class parse_context public: auto operator=(parse_context const&) -> void = delete; -#line 2205 "reflect.h2" +#line 2200 "reflect.h2" }; -#line 2208 "reflect.h2" +#line 2203 "reflect.h2" // Context for one function generation. Generation of functions can be interleaved, // therefore we buffer the code for one function here. // @@ -936,16 +931,16 @@ class generation_function_context { public: auto add_tabs(cpp2::impl::in c) & -> void; -#line 2222 "reflect.h2" +#line 2217 "reflect.h2" public: auto remove_tabs(cpp2::impl::in c) & -> void; public: generation_function_context(auto const& code_, auto const& tabs_); public: generation_function_context(); -#line 2225 "reflect.h2" +#line 2220 "reflect.h2" }; -#line 2228 "reflect.h2" +#line 2223 "reflect.h2" // Context for generating the state machine. class generation_context { @@ -965,68 +960,68 @@ class generation_context // Add code line. public: auto add(cpp2::impl::in s) & -> void; -#line 2250 "reflect.h2" +#line 2245 "reflect.h2" // Add check for token. The check needs to be a function call that returns a boolean. public: auto add_check(cpp2::impl::in check) & -> void; -#line 2256 "reflect.h2" +#line 2251 "reflect.h2" // Add a stateful check. The check needs to return a `match_return`. public: auto add_statefull(cpp2::impl::in next_func, cpp2::impl::in check) & -> void; -#line 2265 "reflect.h2" +#line 2260 "reflect.h2" protected: auto start_func_named(cpp2::impl::in name) & -> void; -#line 2276 "reflect.h2" +#line 2271 "reflect.h2" protected: [[nodiscard]] auto start_func() & -> std::string; -#line 2283 "reflect.h2" +#line 2278 "reflect.h2" protected: auto end_func_statefull(cpp2::impl::in s) & -> void; -#line 2302 "reflect.h2" +#line 2297 "reflect.h2" // Generate the function for a token. public: [[nodiscard]] auto generate_func(cpp2::impl::in token) & -> std::string; -#line 2312 "reflect.h2" +#line 2307 "reflect.h2" // Generate the reset for a list of group identifiers. public: [[nodiscard]] auto generate_reset(cpp2::impl::in> groups) & -> std::string; -#line 2335 "reflect.h2" +#line 2330 "reflect.h2" // Name generation // protected: [[nodiscard]] auto gen_func_name() & -> std::string; -#line 2343 "reflect.h2" +#line 2338 "reflect.h2" public: [[nodiscard]] auto next_func_name() & -> std::string; -#line 2347 "reflect.h2" +#line 2342 "reflect.h2" protected: [[nodiscard]] auto gen_reset_func_name() & -> std::string; -#line 2353 "reflect.h2" +#line 2348 "reflect.h2" public: [[nodiscard]] auto gen_temp() & -> std::string; -#line 2359 "reflect.h2" +#line 2354 "reflect.h2" // Context management // public: [[nodiscard]] auto new_context() & -> generation_function_context*; -#line 2369 "reflect.h2" +#line 2364 "reflect.h2" public: auto finish_context() & -> void; -#line 2377 "reflect.h2" +#line 2372 "reflect.h2" // Misc functions // private: [[nodiscard]] auto get_current() & -> generation_function_context*; -#line 2383 "reflect.h2" +#line 2378 "reflect.h2" private: [[nodiscard]] auto get_base() & -> generation_function_context*; -#line 2387 "reflect.h2" +#line 2382 "reflect.h2" public: [[nodiscard]] auto get_entry_func() const& -> std::string; -#line 2391 "reflect.h2" +#line 2386 "reflect.h2" public: [[nodiscard]] auto create_named_group_lookup(cpp2::impl::in> named_groups) const& -> std::string; -#line 2415 "reflect.h2" +#line 2410 "reflect.h2" // Run the generation for the token. public: [[nodiscard]] auto run(cpp2::impl::in token) & -> std::string; public: generation_context() = default; @@ -1034,7 +1029,7 @@ class generation_context public: auto operator=(generation_context const&) -> void = delete; -#line 2421 "reflect.h2" +#line 2416 "reflect.h2" }; // Regex syntax: | Example: ab|ba @@ -1054,24 +1049,24 @@ class alternative_token public: auto operator=(alternative_token const&) -> void = delete; -#line 2440 "reflect.h2" +#line 2435 "reflect.h2" }; class alternative_token_gen : public regex_token { -#line 2446 "reflect.h2" +#line 2441 "reflect.h2" private: token_vec alternatives; public: explicit alternative_token_gen(cpp2::impl::in a); -#line 2453 "reflect.h2" +#line 2448 "reflect.h2" public: auto generate_code(generation_context& ctx) const -> void override; -#line 2470 "reflect.h2" +#line 2465 "reflect.h2" public: auto add_groups(std::set& groups) const -> void override; -#line 2477 "reflect.h2" +#line 2472 "reflect.h2" public: [[nodiscard]] static auto gen_string(cpp2::impl::in a) -> std::string; public: virtual ~alternative_token_gen() noexcept; @@ -1079,19 +1074,19 @@ class alternative_token_gen public: auto operator=(alternative_token_gen const&) -> void = delete; -#line 2489 "reflect.h2" +#line 2484 "reflect.h2" }; -#line 2492 "reflect.h2" +#line 2487 "reflect.h2" // Regex syntax: . // class any_token : public regex_token_check { -#line 2498 "reflect.h2" +#line 2493 "reflect.h2" public: explicit any_token(cpp2::impl::in single_line); -#line 2502 "reflect.h2" +#line 2497 "reflect.h2" public: [[nodiscard]] static auto parse(parse_context& ctx) -> token_ptr; public: virtual ~any_token() noexcept; @@ -1099,37 +1094,37 @@ class any_token public: auto operator=(any_token const&) -> void = delete; -#line 2507 "reflect.h2" +#line 2502 "reflect.h2" }; -#line 2510 "reflect.h2" +#line 2505 "reflect.h2" // Regex syntax: a // class char_token : public regex_token { -#line 2516 "reflect.h2" +#line 2511 "reflect.h2" private: std::string token; private: bool ignore_case; public: explicit char_token(cpp2::impl::in t, cpp2::impl::in ignore_case_); -#line 2525 "reflect.h2" +#line 2520 "reflect.h2" public: [[nodiscard]] static auto parse(parse_context& ctx) -> token_ptr; -#line 2529 "reflect.h2" +#line 2524 "reflect.h2" public: auto generate_code(generation_context& ctx) const -> void override; -#line 2552 "reflect.h2" +#line 2547 "reflect.h2" public: auto gen_case_insensitive(cpp2::impl::in lower, cpp2::impl::in upper, generation_context& ctx) const& -> void; -#line 2573 "reflect.h2" +#line 2568 "reflect.h2" public: auto gen_case_sensitive(generation_context& ctx) const& -> void; -#line 2591 "reflect.h2" +#line 2586 "reflect.h2" public: [[nodiscard]] auto add_escapes(std::string str) const& -> std::string; -#line 2606 "reflect.h2" +#line 2601 "reflect.h2" public: auto append(char_token const& that) & -> void; public: virtual ~char_token() noexcept; @@ -1137,30 +1132,30 @@ class char_token public: auto operator=(char_token const&) -> void = delete; -#line 2610 "reflect.h2" +#line 2605 "reflect.h2" }; -#line 2613 "reflect.h2" +#line 2608 "reflect.h2" // Regex syntax: [] Example: [abcx-y[:digits:]] // class class_token : public regex_token { -#line 2619 "reflect.h2" +#line 2614 "reflect.h2" private: bool negate; private: bool case_insensitive; private: std::string class_str; public: explicit class_token(cpp2::impl::in negate_, cpp2::impl::in case_insensitive_, cpp2::impl::in class_str_, cpp2::impl::in str); -#line 2631 "reflect.h2" +#line 2626 "reflect.h2" // TODO: Rework class generation: Generate check functions for classes. public: [[nodiscard]] static auto parse(parse_context& ctx) -> token_ptr; -#line 2757 "reflect.h2" +#line 2752 "reflect.h2" public: auto generate_code(generation_context& ctx) const -> void override; -#line 2762 "reflect.h2" +#line 2757 "reflect.h2" private: [[nodiscard]] static auto create_matcher(cpp2::impl::in name, cpp2::impl::in template_arguments) -> std::string; public: virtual ~class_token() noexcept; @@ -1168,20 +1163,20 @@ class class_token public: auto operator=(class_token const&) -> void = delete; -#line 2769 "reflect.h2" +#line 2764 "reflect.h2" }; -#line 2772 "reflect.h2" +#line 2767 "reflect.h2" // Regex syntax: \a or \n or \[ // [[nodiscard]] auto escape_token_parse(parse_context& ctx) -> token_ptr; -#line 2813 "reflect.h2" +#line 2808 "reflect.h2" // Regex syntax: \K Example: ab\Kcd // [[nodiscard]] auto global_group_reset_token_parse(parse_context& ctx) -> token_ptr; -#line 2824 "reflect.h2" +#line 2819 "reflect.h2" // Regex syntax: \ Example: \1 // \g{name_or_number} // \k{name_or_number} @@ -1191,16 +1186,16 @@ class class_token class group_ref_token : public regex_token { -#line 2834 "reflect.h2" +#line 2829 "reflect.h2" private: int id; private: bool case_insensitive; public: explicit group_ref_token(cpp2::impl::in id_, cpp2::impl::in case_insensitive_, cpp2::impl::in str); -#line 2844 "reflect.h2" +#line 2839 "reflect.h2" public: [[nodiscard]] static auto parse(parse_context& ctx) -> token_ptr; -#line 2945 "reflect.h2" +#line 2940 "reflect.h2" public: auto generate_code(generation_context& ctx) const -> void override; public: virtual ~group_ref_token() noexcept; @@ -1208,10 +1203,10 @@ class group_ref_token public: auto operator=(group_ref_token const&) -> void = delete; -#line 2948 "reflect.h2" +#line 2943 "reflect.h2" }; -#line 2951 "reflect.h2" +#line 2946 "reflect.h2" // Regex syntax: () Example: (abc) // (?:) (?i:abc) @@ -1225,22 +1220,22 @@ class group_ref_token class group_token : public regex_token { -#line 2965 "reflect.h2" +#line 2960 "reflect.h2" private: int number {-1}; private: token_ptr inner {nullptr}; public: [[nodiscard]] static auto parse_lookahead(parse_context& ctx, cpp2::impl::in syntax, cpp2::impl::in positive) -> token_ptr; -#line 2982 "reflect.h2" +#line 2977 "reflect.h2" public: [[nodiscard]] static auto parse(parse_context& ctx) -> token_ptr; -#line 3119 "reflect.h2" +#line 3114 "reflect.h2" public: [[nodiscard]] static auto gen_string(cpp2::impl::in name, cpp2::impl::in name_brackets, cpp2::impl::in has_modifier, cpp2::impl::in modifiers, cpp2::impl::in inner_) -> std::string; -#line 3137 "reflect.h2" +#line 3132 "reflect.h2" public: auto generate_code(generation_context& ctx) const -> void override; -#line 3157 "reflect.h2" +#line 3152 "reflect.h2" public: auto add_groups(std::set& groups) const -> void override; public: virtual ~group_token() noexcept; @@ -1249,25 +1244,25 @@ class group_token public: auto operator=(group_token const&) -> void = delete; -#line 3164 "reflect.h2" +#line 3159 "reflect.h2" }; -#line 3167 "reflect.h2" +#line 3162 "reflect.h2" // Regex syntax: \x or \x{} Example: \x{62} // [[nodiscard]] auto hexadecimal_token_parse(parse_context& ctx) -> token_ptr; -#line 3208 "reflect.h2" +#line 3203 "reflect.h2" // Regex syntax: $ Example: aa$ // [[nodiscard]] auto line_end_token_parse(parse_context& ctx) -> token_ptr; -#line 3228 "reflect.h2" +#line 3223 "reflect.h2" // Regex syntax: ^ Example: ^aa // [[nodiscard]] auto line_start_token_parse(parse_context& ctx) -> token_ptr; -#line 3244 "reflect.h2" +#line 3239 "reflect.h2" // Regex syntax: (?=) or (?!) or (*pla), etc. Example: (?=AA) // // Parsed in group_token. @@ -1275,16 +1270,16 @@ class group_token class lookahead_token : public regex_token { -#line 3252 "reflect.h2" +#line 3247 "reflect.h2" protected: bool positive; public: token_ptr inner {nullptr}; public: explicit lookahead_token(cpp2::impl::in positive_); -#line 3259 "reflect.h2" +#line 3254 "reflect.h2" public: auto generate_code(generation_context& ctx) const -> void override; -#line 3265 "reflect.h2" +#line 3260 "reflect.h2" public: auto add_groups(std::set& groups) const -> void override; public: virtual ~lookahead_token() noexcept; @@ -1292,26 +1287,26 @@ class lookahead_token public: auto operator=(lookahead_token const&) -> void = delete; -#line 3268 "reflect.h2" +#line 3263 "reflect.h2" }; -#line 3271 "reflect.h2" +#line 3266 "reflect.h2" // Named character classes // [[nodiscard]] auto named_class_token_parse(parse_context& ctx) -> token_ptr; -#line 3299 "reflect.h2" +#line 3294 "reflect.h2" // Regex syntax: \o{} Example: \o{142} // [[nodiscard]] auto octal_token_parse(parse_context& ctx) -> token_ptr; -#line 3327 "reflect.h2" +#line 3322 "reflect.h2" // Regex syntax: {min, max} Example: a{2,4} // class range_token : public regex_token { -#line 3333 "reflect.h2" +#line 3328 "reflect.h2" protected: int min_count {-1}; protected: int max_count {-1}; protected: int kind {range_flags::greedy}; @@ -1321,19 +1316,19 @@ class range_token public: [[nodiscard]] static auto parse(parse_context& ctx) -> token_ptr; -#line 3413 "reflect.h2" +#line 3408 "reflect.h2" public: auto parse_modifier(parse_context& ctx) & -> void; -#line 3425 "reflect.h2" +#line 3420 "reflect.h2" public: [[nodiscard]] auto gen_mod_string() const& -> std::string; -#line 3438 "reflect.h2" +#line 3433 "reflect.h2" public: [[nodiscard]] auto gen_range_string() const& -> std::string; -#line 3457 "reflect.h2" +#line 3452 "reflect.h2" public: auto generate_code(generation_context& ctx) const -> void override; -#line 3468 "reflect.h2" +#line 3463 "reflect.h2" public: auto add_groups(std::set& groups) const -> void override; public: virtual ~range_token() noexcept; @@ -1341,16 +1336,16 @@ class range_token public: auto operator=(range_token const&) -> void = delete; -#line 3472 "reflect.h2" +#line 3467 "reflect.h2" }; -#line 3475 "reflect.h2" +#line 3470 "reflect.h2" // Regex syntax: *, +, or ? Example: aa* // class special_range_token : public range_token { -#line 3481 "reflect.h2" +#line 3476 "reflect.h2" public: [[nodiscard]] static auto parse(parse_context& ctx) -> token_ptr; public: virtual ~special_range_token() noexcept; @@ -1359,17 +1354,17 @@ class special_range_token public: auto operator=(special_range_token const&) -> void = delete; -#line 3511 "reflect.h2" +#line 3506 "reflect.h2" }; -#line 3514 "reflect.h2" +#line 3509 "reflect.h2" // Regex syntax: \b or \B Example: \bword\b // // Matches the start end end of word boundaries. // [[nodiscard]] auto word_boundary_token_parse(parse_context& ctx) -> token_ptr; -#line 3536 "reflect.h2" +#line 3531 "reflect.h2" //----------------------------------------------------------------------- // // Parser for regular expression. @@ -1390,24 +1385,24 @@ template class regex_generator public: explicit regex_generator(cpp2::impl::in r, Error_out const& e); -#line 3559 "reflect.h2" +#line 3554 "reflect.h2" public: [[nodiscard]] auto parse() & -> std::string; -#line 3594 "reflect.h2" +#line 3589 "reflect.h2" private: auto extract_modifiers() & -> void; public: regex_generator(regex_generator const&) = delete; /* No 'that' constructor, suppress copy */ public: auto operator=(regex_generator const&) -> void = delete; -#line 3608 "reflect.h2" +#line 3603 "reflect.h2" }; template [[nodiscard]] auto generate_regex(cpp2::impl::in regex, Err const& err) -> std::string; -#line 3620 "reflect.h2" +#line 3615 "reflect.h2" auto regex_gen(meta::type_declaration& t) -> void; -#line 3675 "reflect.h2" +#line 3670 "reflect.h2" //----------------------------------------------------------------------- // // apply_metafunctions @@ -1418,7 +1413,7 @@ auto regex_gen(meta::type_declaration& t) -> void; auto const& error ) -> bool; -#line 3791 "reflect.h2" +#line 3786 "reflect.h2" } } @@ -1428,12 +1423,12 @@ auto regex_gen(meta::type_declaration& t) -> void; #line 1 "reflect.h2" -#line 22 "reflect.h2" +#line 17 "reflect.h2" namespace cpp2 { namespace meta { -#line 27 "reflect.h2" +#line 22 "reflect.h2" //----------------------------------------------------------------------- // // Compiler services @@ -1441,14 +1436,14 @@ namespace meta { //----------------------------------------------------------------------- // -#line 36 "reflect.h2" +#line 31 "reflect.h2" // Common data members // -#line 47 "reflect.h2" +#line 42 "reflect.h2" // Constructor // -#line 49 "reflect.h2" +#line 44 "reflect.h2" compiler_services::compiler_services( std::vector* errors_, @@ -1460,25 +1455,25 @@ namespace meta { , errors_original_size{ cpp2::unchecked_narrow(std::ssize(*cpp2::impl::assert_not_null(errors))) } , generated_tokens{ generated_tokens_ } , parser{ *cpp2::impl::assert_not_null(errors), *cpp2::impl::assert_not_null(includes) } -#line 55 "reflect.h2" +#line 50 "reflect.h2" { -#line 61 "reflect.h2" +#line 56 "reflect.h2" } // Common API // -#line 65 "reflect.h2" +#line 60 "reflect.h2" auto compiler_services::set_metafunction_name(cpp2::impl::in name, cpp2::impl::in> args) & -> void{ metafunction_name = name; metafunction_args = args; metafunctions_used = CPP2_UFCS(empty)(args); } -#line 71 "reflect.h2" +#line 66 "reflect.h2" [[nodiscard]] auto compiler_services::get_metafunction_name() const& -> std::string_view { return metafunction_name; } -#line 73 "reflect.h2" +#line 68 "reflect.h2" [[nodiscard]] auto compiler_services::get_argument(cpp2::impl::in index) & -> std::string{ metafunctions_used = true; if (([_0 = 0, _1 = index, _2 = CPP2_UFCS(ssize)(metafunction_args)]{ return cpp2::impl::cmp_less_eq(_0,_1) && cpp2::impl::cmp_less(_1,_2); }())) { @@ -1487,16 +1482,16 @@ namespace meta { return ""; } -#line 81 "reflect.h2" +#line 76 "reflect.h2" [[nodiscard]] auto compiler_services::get_arguments() & -> std::vector{ metafunctions_used = true; return metafunction_args; } -#line 86 "reflect.h2" +#line 81 "reflect.h2" [[nodiscard]] auto compiler_services::arguments_were_used() const& -> bool { return metafunctions_used; } -#line 88 "reflect.h2" +#line 83 "reflect.h2" [[nodiscard]] auto compiler_services::parse_statement( std::string_view source @@ -1504,7 +1499,7 @@ namespace meta { { cpp2::impl::deferred_init> ret; -#line 94 "reflect.h2" +#line 89 "reflect.h2" auto original_source {source}; CPP2_UFCS(push_back)(generated_lines, std::vector()); @@ -1519,7 +1514,7 @@ auto newline_pos{CPP2_UFCS(find)(source, '\n')}; // First split this string into source_lines // -#line 106 "reflect.h2" +#line 101 "reflect.h2" if ( cpp2::impl::cmp_greater(CPP2_UFCS(ssize)(source),1) && newline_pos != source.npos) { @@ -1532,7 +1527,7 @@ auto newline_pos{CPP2_UFCS(find)(source, '\n')}; } } -#line 117 "reflect.h2" +#line 112 "reflect.h2" if (!(CPP2_UFCS(empty)(source))) { cpp2::move(add_line)(cpp2::move(source)); } @@ -1557,10 +1552,10 @@ auto newline_pos{CPP2_UFCS(find)(source, '\n')}; }return std::move(ret.value()); } -#line 141 "reflect.h2" +#line 136 "reflect.h2" [[nodiscard]] auto compiler_services::add_runtime_support_include(cpp2::impl::in s) & -> decltype(auto) { return static_cast(CPP2_UFCS(emplace)((*cpp2::impl::assert_not_null(includes)), s)); } -#line 143 "reflect.h2" +#line 138 "reflect.h2" [[nodiscard]] auto compiler_services::position() const -> source_position { @@ -1570,7 +1565,7 @@ auto newline_pos{CPP2_UFCS(find)(source, '\n')}; // Error diagnosis and handling, integrated with compiler output // Unlike a contract violation, .requires continues further processing // -#line 152 "reflect.h2" +#line 147 "reflect.h2" auto compiler_services::require( cpp2::impl::in b, @@ -1582,7 +1577,7 @@ auto newline_pos{CPP2_UFCS(find)(source, '\n')}; } } -#line 163 "reflect.h2" +#line 158 "reflect.h2" auto compiler_services::error(cpp2::impl::in msg) const& -> void { auto message {cpp2::impl::as_(msg)}; @@ -1595,7 +1590,7 @@ auto newline_pos{CPP2_UFCS(find)(source, '\n')}; // Enable custom contracts on this object, integrated with compiler output // Unlike .requires, a contract violation stops further processing // -#line 175 "reflect.h2" +#line 170 "reflect.h2" auto compiler_services::report_violation(auto const& msg) const& -> void{ error(msg); throw(std::runtime_error( @@ -1604,7 +1599,7 @@ auto newline_pos{CPP2_UFCS(find)(source, '\n')}; )); } -#line 183 "reflect.h2" +#line 178 "reflect.h2" [[nodiscard]] auto compiler_services::is_active() const& -> decltype(auto) { return true; } compiler_services::~compiler_services() noexcept{} @@ -1618,7 +1613,7 @@ compiler_services::compiler_services(compiler_services const& that) , metafunction_args{ that.metafunction_args } , metafunctions_used{ that.metafunctions_used }{} -#line 187 "reflect.h2" +#line 182 "reflect.h2" /* //----------------------------------------------------------------------- // @@ -1655,7 +1650,7 @@ type_id: @polymorphic_base @copyable type = } */ -#line 224 "reflect.h2" +#line 219 "reflect.h2" //----------------------------------------------------------------------- // // Declarations @@ -1666,7 +1661,7 @@ type_id: @polymorphic_base @copyable type = // All declarations are wrappers around a pointer to node // -#line 239 "reflect.h2" +#line 234 "reflect.h2" declaration_base::declaration_base( declaration_node* n_, @@ -1674,17 +1669,17 @@ type_id: @polymorphic_base @copyable type = ) : compiler_services{ s } , n{ n_ } -#line 244 "reflect.h2" +#line 239 "reflect.h2" { -#line 247 "reflect.h2" +#line 242 "reflect.h2" if (cpp2::cpp2_default.is_active() && !(n) ) { cpp2::cpp2_default.report_violation(CPP2_CONTRACT_MSG("a meta::declaration must point to a valid declaration_node, not null")); } } -#line 250 "reflect.h2" +#line 245 "reflect.h2" [[nodiscard]] auto declaration_base::position() const -> source_position { return CPP2_UFCS(position)((*cpp2::impl::assert_not_null(n))); } -#line 252 "reflect.h2" +#line 247 "reflect.h2" [[nodiscard]] auto declaration_base::print() const& -> std::string { return CPP2_UFCS(pretty_print_visualize)((*cpp2::impl::assert_not_null(n)), 0); } declaration_base::~declaration_base() noexcept{} @@ -1692,126 +1687,126 @@ declaration_base::declaration_base(declaration_base const& that) : compiler_services{ static_cast(that) } , n{ that.n }{} -#line 256 "reflect.h2" +#line 251 "reflect.h2" //----------------------------------------------------------------------- // All declarations // -#line 263 "reflect.h2" +#line 258 "reflect.h2" declaration::declaration( declaration_node* n_, cpp2::impl::in s ) : declaration_base{ n_, s } -#line 268 "reflect.h2" +#line 263 "reflect.h2" { } -#line 272 "reflect.h2" +#line 267 "reflect.h2" [[nodiscard]] auto declaration::is_public() const& -> bool { return CPP2_UFCS(is_public)((*cpp2::impl::assert_not_null(n))); } -#line 273 "reflect.h2" +#line 268 "reflect.h2" [[nodiscard]] auto declaration::is_protected() const& -> bool { return CPP2_UFCS(is_protected)((*cpp2::impl::assert_not_null(n))); } -#line 274 "reflect.h2" +#line 269 "reflect.h2" [[nodiscard]] auto declaration::is_private() const& -> bool { return CPP2_UFCS(is_private)((*cpp2::impl::assert_not_null(n))); } -#line 275 "reflect.h2" +#line 270 "reflect.h2" [[nodiscard]] auto declaration::is_default_access() const& -> bool { return CPP2_UFCS(is_default_access)((*cpp2::impl::assert_not_null(n))); } -#line 277 "reflect.h2" +#line 272 "reflect.h2" [[nodiscard]] auto declaration::default_to_public() & -> decltype(auto) { return static_cast(CPP2_UFCS(make_public)((*cpp2::impl::assert_not_null(n)))); } -#line 278 "reflect.h2" +#line 273 "reflect.h2" [[nodiscard]] auto declaration::default_to_protected() & -> decltype(auto) { return static_cast(CPP2_UFCS(make_protected)((*cpp2::impl::assert_not_null(n)))); } -#line 279 "reflect.h2" +#line 274 "reflect.h2" [[nodiscard]] auto declaration::default_to_private() & -> decltype(auto) { return static_cast(CPP2_UFCS(make_private)((*cpp2::impl::assert_not_null(n)))); } -#line 281 "reflect.h2" +#line 276 "reflect.h2" [[nodiscard]] auto declaration::make_public() & -> bool { return CPP2_UFCS(make_public)((*cpp2::impl::assert_not_null(n))); } -#line 282 "reflect.h2" +#line 277 "reflect.h2" [[nodiscard]] auto declaration::make_protected() & -> bool { return CPP2_UFCS(make_protected)((*cpp2::impl::assert_not_null(n))); } -#line 283 "reflect.h2" +#line 278 "reflect.h2" [[nodiscard]] auto declaration::make_private() & -> bool { return CPP2_UFCS(make_private)((*cpp2::impl::assert_not_null(n))); } -#line 285 "reflect.h2" +#line 280 "reflect.h2" [[nodiscard]] auto declaration::has_name() const& -> bool { return CPP2_UFCS(has_name)((*cpp2::impl::assert_not_null(n))); } -#line 286 "reflect.h2" +#line 281 "reflect.h2" [[nodiscard]] auto declaration::has_name(cpp2::impl::in s) const& -> bool { return CPP2_UFCS(has_name)((*cpp2::impl::assert_not_null(n)), s); } -#line 288 "reflect.h2" +#line 283 "reflect.h2" [[nodiscard]] auto declaration::name() const& -> std::string_view{ if (has_name()) {return CPP2_UFCS(as_string_view)((*cpp2::impl::assert_not_null(CPP2_UFCS(name)(*cpp2::impl::assert_not_null(n))))); } else { return ""; } } -#line 293 "reflect.h2" +#line 288 "reflect.h2" [[nodiscard]] auto declaration::has_initializer() const& -> bool { return CPP2_UFCS(has_initializer)((*cpp2::impl::assert_not_null(n))); } -#line 295 "reflect.h2" +#line 290 "reflect.h2" [[nodiscard]] auto declaration::is_global() const& -> bool { return CPP2_UFCS(is_global)((*cpp2::impl::assert_not_null(n))); } -#line 296 "reflect.h2" +#line 291 "reflect.h2" [[nodiscard]] auto declaration::is_function() const& -> bool { return CPP2_UFCS(is_function)((*cpp2::impl::assert_not_null(n))); } -#line 297 "reflect.h2" +#line 292 "reflect.h2" [[nodiscard]] auto declaration::is_object() const& -> bool { return CPP2_UFCS(is_object)((*cpp2::impl::assert_not_null(n))); } -#line 298 "reflect.h2" +#line 293 "reflect.h2" [[nodiscard]] auto declaration::is_base_object() const& -> bool { return CPP2_UFCS(is_base_object)((*cpp2::impl::assert_not_null(n))); } -#line 299 "reflect.h2" +#line 294 "reflect.h2" [[nodiscard]] auto declaration::is_member_object() const& -> bool { return CPP2_UFCS(is_member_object)((*cpp2::impl::assert_not_null(n))); } -#line 300 "reflect.h2" +#line 295 "reflect.h2" [[nodiscard]] auto declaration::is_type() const& -> bool { return CPP2_UFCS(is_type)((*cpp2::impl::assert_not_null(n))); } -#line 301 "reflect.h2" +#line 296 "reflect.h2" [[nodiscard]] auto declaration::is_namespace() const& -> bool { return CPP2_UFCS(is_namespace)((*cpp2::impl::assert_not_null(n))); } -#line 302 "reflect.h2" +#line 297 "reflect.h2" [[nodiscard]] auto declaration::is_alias() const& -> bool { return CPP2_UFCS(is_alias)((*cpp2::impl::assert_not_null(n))); } -#line 304 "reflect.h2" +#line 299 "reflect.h2" [[nodiscard]] auto declaration::is_type_alias() const& -> bool { return CPP2_UFCS(is_type_alias)((*cpp2::impl::assert_not_null(n))); } -#line 305 "reflect.h2" +#line 300 "reflect.h2" [[nodiscard]] auto declaration::is_namespace_alias() const& -> bool { return CPP2_UFCS(is_namespace_alias)((*cpp2::impl::assert_not_null(n))); } -#line 306 "reflect.h2" +#line 301 "reflect.h2" [[nodiscard]] auto declaration::is_object_alias() const& -> bool { return CPP2_UFCS(is_object_alias)((*cpp2::impl::assert_not_null(n))); } -#line 308 "reflect.h2" +#line 303 "reflect.h2" [[nodiscard]] auto declaration::is_function_expression() const& -> bool { return CPP2_UFCS(is_function_expression)((*cpp2::impl::assert_not_null(n))); } -#line 310 "reflect.h2" +#line 305 "reflect.h2" [[nodiscard]] auto declaration::as_function() const& -> function_declaration { return function_declaration(n, (*this)); } -#line 311 "reflect.h2" +#line 306 "reflect.h2" [[nodiscard]] auto declaration::as_object() const& -> object_declaration { return object_declaration(n, (*this)); } -#line 312 "reflect.h2" +#line 307 "reflect.h2" [[nodiscard]] auto declaration::as_type() const& -> type_declaration { return type_declaration(n, (*this)); } -#line 313 "reflect.h2" +#line 308 "reflect.h2" [[nodiscard]] auto declaration::as_alias() const& -> alias_declaration { return alias_declaration(n, (*this)); } -#line 315 "reflect.h2" +#line 310 "reflect.h2" [[nodiscard]] auto declaration::get_parent() const& -> declaration { return declaration((*cpp2::impl::assert_not_null(n)).parent_declaration, (*this)); } -#line 317 "reflect.h2" +#line 312 "reflect.h2" [[nodiscard]] auto declaration::parent_is_function() const& -> bool { return CPP2_UFCS(parent_is_function)((*cpp2::impl::assert_not_null(n))); } -#line 318 "reflect.h2" +#line 313 "reflect.h2" [[nodiscard]] auto declaration::parent_is_object() const& -> bool { return CPP2_UFCS(parent_is_object)((*cpp2::impl::assert_not_null(n))); } -#line 319 "reflect.h2" +#line 314 "reflect.h2" [[nodiscard]] auto declaration::parent_is_type() const& -> bool { return CPP2_UFCS(parent_is_type)((*cpp2::impl::assert_not_null(n))); } -#line 320 "reflect.h2" +#line 315 "reflect.h2" [[nodiscard]] auto declaration::parent_is_namespace() const& -> bool { return CPP2_UFCS(parent_is_namespace)((*cpp2::impl::assert_not_null(n))); } -#line 321 "reflect.h2" +#line 316 "reflect.h2" [[nodiscard]] auto declaration::parent_is_alias() const& -> bool { return CPP2_UFCS(parent_is_alias)((*cpp2::impl::assert_not_null(n))); } -#line 323 "reflect.h2" +#line 318 "reflect.h2" [[nodiscard]] auto declaration::parent_is_type_alias() const& -> bool { return CPP2_UFCS(parent_is_type_alias)((*cpp2::impl::assert_not_null(n))); } -#line 324 "reflect.h2" +#line 319 "reflect.h2" [[nodiscard]] auto declaration::parent_is_namespace_alias() const& -> bool { return CPP2_UFCS(parent_is_namespace_alias)((*cpp2::impl::assert_not_null(n))); } -#line 325 "reflect.h2" +#line 320 "reflect.h2" [[nodiscard]] auto declaration::parent_is_object_alias() const& -> bool { return CPP2_UFCS(parent_is_object_alias)((*cpp2::impl::assert_not_null(n))); } -#line 327 "reflect.h2" +#line 322 "reflect.h2" [[nodiscard]] auto declaration::parent_is_polymorphic() const& -> bool { return CPP2_UFCS(parent_is_polymorphic)((*cpp2::impl::assert_not_null(n))); } -#line 329 "reflect.h2" +#line 324 "reflect.h2" auto declaration::mark_for_removal_from_enclosing_type() & -> void // this precondition should be sufficient ... { if (cpp2::type_safety.is_active() && !(parent_is_type()) ) { cpp2::type_safety.report_violation(""); } -#line 332 "reflect.h2" +#line 327 "reflect.h2" auto test {CPP2_UFCS(type_member_mark_for_removal)((*cpp2::impl::assert_not_null(n)))}; if (cpp2::cpp2_default.is_active() && !(cpp2::move(test)) ) { cpp2::cpp2_default.report_violation(""); }// ... to ensure this assert is true } @@ -1820,95 +1815,95 @@ declaration_base::declaration_base(declaration_base const& that) declaration::declaration(declaration const& that) : declaration_base{ static_cast(that) }{} -#line 338 "reflect.h2" +#line 333 "reflect.h2" //----------------------------------------------------------------------- // Function declarations // -#line 345 "reflect.h2" +#line 340 "reflect.h2" function_declaration::function_declaration( declaration_node* n_, cpp2::impl::in s ) : declaration{ n_, s } -#line 350 "reflect.h2" +#line 345 "reflect.h2" { if (cpp2::cpp2_default.is_active() && !(CPP2_UFCS(is_function)((*cpp2::impl::assert_not_null(n)))) ) { cpp2::cpp2_default.report_violation(""); } } -#line 355 "reflect.h2" +#line 350 "reflect.h2" [[nodiscard]] auto function_declaration::index_of_parameter_named(cpp2::impl::in s) const& -> int { return CPP2_UFCS(index_of_parameter_named)((*cpp2::impl::assert_not_null(n)), s); } -#line 356 "reflect.h2" +#line 351 "reflect.h2" [[nodiscard]] auto function_declaration::has_parameter_named(cpp2::impl::in s) const& -> bool { return CPP2_UFCS(has_parameter_named)((*cpp2::impl::assert_not_null(n)), s); } -#line 357 "reflect.h2" +#line 352 "reflect.h2" [[nodiscard]] auto function_declaration::has_in_parameter_named(cpp2::impl::in s) const& -> bool { return CPP2_UFCS(has_in_parameter_named)((*cpp2::impl::assert_not_null(n)), s); } -#line 358 "reflect.h2" +#line 353 "reflect.h2" [[nodiscard]] auto function_declaration::has_in_ref_parameter_named(cpp2::impl::in s) const& -> bool { return CPP2_UFCS(has_in_ref_parameter_named)((*cpp2::impl::assert_not_null(n)), s); } -#line 359 "reflect.h2" +#line 354 "reflect.h2" [[nodiscard]] auto function_declaration::has_copy_parameter_named(cpp2::impl::in s) const& -> bool { return CPP2_UFCS(has_copy_parameter_named)((*cpp2::impl::assert_not_null(n)), s); } -#line 360 "reflect.h2" +#line 355 "reflect.h2" [[nodiscard]] auto function_declaration::has_inout_parameter_named(cpp2::impl::in s) const& -> bool { return CPP2_UFCS(has_inout_parameter_named)((*cpp2::impl::assert_not_null(n)), s); } -#line 361 "reflect.h2" +#line 356 "reflect.h2" [[nodiscard]] auto function_declaration::has_out_parameter_named(cpp2::impl::in s) const& -> bool { return CPP2_UFCS(has_out_parameter_named)((*cpp2::impl::assert_not_null(n)), s); } -#line 362 "reflect.h2" +#line 357 "reflect.h2" [[nodiscard]] auto function_declaration::has_move_parameter_named(cpp2::impl::in s) const& -> bool { return CPP2_UFCS(has_move_parameter_named)((*cpp2::impl::assert_not_null(n)), s); } -#line 363 "reflect.h2" +#line 358 "reflect.h2" [[nodiscard]] auto function_declaration::has_forward_parameter_named(cpp2::impl::in s) const& -> bool { return CPP2_UFCS(has_forward_parameter_named)((*cpp2::impl::assert_not_null(n)), s); } -#line 364 "reflect.h2" +#line 359 "reflect.h2" [[nodiscard]] auto function_declaration::first_parameter_name() const& -> std::string { return CPP2_UFCS(first_parameter_name)((*cpp2::impl::assert_not_null(n))); } -#line 366 "reflect.h2" +#line 361 "reflect.h2" [[nodiscard]] auto function_declaration::has_parameter_with_name_and_pass(cpp2::impl::in s, cpp2::impl::in pass) const& -> bool { return CPP2_UFCS(has_parameter_with_name_and_pass)((*cpp2::impl::assert_not_null(n)), s, pass); } -#line 368 "reflect.h2" +#line 363 "reflect.h2" [[nodiscard]] auto function_declaration::is_function_with_this() const& -> bool { return CPP2_UFCS(is_function_with_this)((*cpp2::impl::assert_not_null(n))); } -#line 369 "reflect.h2" +#line 364 "reflect.h2" [[nodiscard]] auto function_declaration::is_virtual() const& -> bool { return CPP2_UFCS(is_virtual_function)((*cpp2::impl::assert_not_null(n))); } -#line 370 "reflect.h2" +#line 365 "reflect.h2" [[nodiscard]] auto function_declaration::is_defaultable() const& -> bool { return CPP2_UFCS(is_defaultable_function)((*cpp2::impl::assert_not_null(n))); } -#line 371 "reflect.h2" +#line 366 "reflect.h2" [[nodiscard]] auto function_declaration::is_constructor() const& -> bool { return CPP2_UFCS(is_constructor)((*cpp2::impl::assert_not_null(n))); } -#line 372 "reflect.h2" +#line 367 "reflect.h2" [[nodiscard]] auto function_declaration::is_default_constructor() const& -> bool { return CPP2_UFCS(is_default_constructor)((*cpp2::impl::assert_not_null(n))); } -#line 373 "reflect.h2" +#line 368 "reflect.h2" [[nodiscard]] auto function_declaration::is_move() const& -> bool { return CPP2_UFCS(is_move)((*cpp2::impl::assert_not_null(n))); } -#line 374 "reflect.h2" +#line 369 "reflect.h2" [[nodiscard]] auto function_declaration::is_swap() const& -> bool { return CPP2_UFCS(is_swap)((*cpp2::impl::assert_not_null(n))); } -#line 375 "reflect.h2" +#line 370 "reflect.h2" [[nodiscard]] auto function_declaration::is_constructor_with_that() const& -> bool { return CPP2_UFCS(is_constructor_with_that)((*cpp2::impl::assert_not_null(n))); } -#line 376 "reflect.h2" +#line 371 "reflect.h2" [[nodiscard]] auto function_declaration::is_constructor_with_in_that() const& -> bool { return CPP2_UFCS(is_constructor_with_in_that)((*cpp2::impl::assert_not_null(n))); } -#line 377 "reflect.h2" +#line 372 "reflect.h2" [[nodiscard]] auto function_declaration::is_constructor_with_move_that() const& -> bool { return CPP2_UFCS(is_constructor_with_move_that)((*cpp2::impl::assert_not_null(n))); } -#line 378 "reflect.h2" +#line 373 "reflect.h2" [[nodiscard]] auto function_declaration::is_assignment() const& -> bool { return CPP2_UFCS(is_assignment)((*cpp2::impl::assert_not_null(n))); } -#line 379 "reflect.h2" +#line 374 "reflect.h2" [[nodiscard]] auto function_declaration::is_assignment_with_that() const& -> bool { return CPP2_UFCS(is_assignment_with_that)((*cpp2::impl::assert_not_null(n))); } -#line 380 "reflect.h2" +#line 375 "reflect.h2" [[nodiscard]] auto function_declaration::is_assignment_with_in_that() const& -> bool { return CPP2_UFCS(is_assignment_with_in_that)((*cpp2::impl::assert_not_null(n))); } -#line 381 "reflect.h2" +#line 376 "reflect.h2" [[nodiscard]] auto function_declaration::is_assignment_with_move_that() const& -> bool { return CPP2_UFCS(is_assignment_with_move_that)((*cpp2::impl::assert_not_null(n))); } -#line 382 "reflect.h2" +#line 377 "reflect.h2" [[nodiscard]] auto function_declaration::is_destructor() const& -> bool { return CPP2_UFCS(is_destructor)((*cpp2::impl::assert_not_null(n))); } -#line 384 "reflect.h2" +#line 379 "reflect.h2" [[nodiscard]] auto function_declaration::is_copy_or_move() const& -> bool { return is_constructor_with_that() || is_assignment_with_that(); } -#line 386 "reflect.h2" +#line 381 "reflect.h2" [[nodiscard]] auto function_declaration::has_declared_return_type() const& -> bool { return CPP2_UFCS(has_declared_return_type)((*cpp2::impl::assert_not_null(n))); } -#line 387 "reflect.h2" +#line 382 "reflect.h2" [[nodiscard]] auto function_declaration::has_deduced_return_type() const& -> bool { return CPP2_UFCS(has_deduced_return_type)((*cpp2::impl::assert_not_null(n))); } -#line 388 "reflect.h2" +#line 383 "reflect.h2" [[nodiscard]] auto function_declaration::has_bool_return_type() const& -> bool { return CPP2_UFCS(has_bool_return_type)((*cpp2::impl::assert_not_null(n))); } -#line 389 "reflect.h2" +#line 384 "reflect.h2" [[nodiscard]] auto function_declaration::has_non_void_return_type() const& -> bool { return CPP2_UFCS(has_non_void_return_type)((*cpp2::impl::assert_not_null(n))); } -#line 391 "reflect.h2" +#line 386 "reflect.h2" [[nodiscard]] auto function_declaration::unnamed_return_type() const& -> std::string { return CPP2_UFCS(unnamed_return_type_to_string)((*cpp2::impl::assert_not_null(n))); } -#line 393 "reflect.h2" +#line 388 "reflect.h2" [[nodiscard]] auto function_declaration::get_parameters() const& -> std::vector { @@ -1919,19 +1914,19 @@ declaration::declaration(declaration const& that) return ret; } -#line 403 "reflect.h2" +#line 398 "reflect.h2" [[nodiscard]] auto function_declaration::is_binary_comparison_function() const& -> bool { return CPP2_UFCS(is_binary_comparison_function)((*cpp2::impl::assert_not_null(n))); } -#line 405 "reflect.h2" +#line 400 "reflect.h2" [[nodiscard]] auto function_declaration::default_to_virtual() & -> decltype(auto) { return static_cast(CPP2_UFCS(make_function_virtual)((*cpp2::impl::assert_not_null(n)))); } -#line 407 "reflect.h2" +#line 402 "reflect.h2" [[nodiscard]] auto function_declaration::make_virtual() & -> bool { return CPP2_UFCS(make_function_virtual)((*cpp2::impl::assert_not_null(n))); } -#line 409 "reflect.h2" +#line 404 "reflect.h2" auto function_declaration::add_initializer(cpp2::impl::in source) & -> void -#line 412 "reflect.h2" +#line 407 "reflect.h2" { if ((*this).is_active() && !(!(has_initializer())) ) { (*this).report_violation(CPP2_CONTRACT_MSG("cannot add an initializer to a function that already has one")); } if ((*this).is_active() && !(parent_is_type()) ) { (*this).report_violation(CPP2_CONTRACT_MSG("cannot add an initializer to a function that isn't in a type scope")); } @@ -1940,7 +1935,7 @@ declaration::declaration(declaration const& that) //require( parent_is_type(), // "cannot add an initializer to a function that isn't in a type scope"); -#line 418 "reflect.h2" +#line 413 "reflect.h2" auto stmt {parse_statement(source)}; if (!((cpp2::impl::as_(stmt)))) { error("cannot add an initializer that is not a valid statement"); @@ -1953,30 +1948,30 @@ declaration::declaration(declaration const& that) function_declaration::function_declaration(function_declaration const& that) : declaration{ static_cast(that) }{} -#line 429 "reflect.h2" +#line 424 "reflect.h2" //----------------------------------------------------------------------- // Object declarations // -#line 436 "reflect.h2" +#line 431 "reflect.h2" object_declaration::object_declaration( declaration_node* n_, cpp2::impl::in s ) : declaration{ n_, s } -#line 441 "reflect.h2" +#line 436 "reflect.h2" { if (cpp2::cpp2_default.is_active() && !(CPP2_UFCS(is_object)((*cpp2::impl::assert_not_null(n)))) ) { cpp2::cpp2_default.report_violation(""); } } -#line 446 "reflect.h2" +#line 441 "reflect.h2" [[nodiscard]] auto object_declaration::is_const() const& -> bool { return CPP2_UFCS(is_const)((*cpp2::impl::assert_not_null(n))); } -#line 447 "reflect.h2" +#line 442 "reflect.h2" [[nodiscard]] auto object_declaration::has_wildcard_type() const& -> bool { return CPP2_UFCS(has_wildcard_type)((*cpp2::impl::assert_not_null(n))); } -#line 449 "reflect.h2" +#line 444 "reflect.h2" [[nodiscard]] auto object_declaration::type() const& -> std::string{ auto ret {CPP2_UFCS(object_type)((*cpp2::impl::assert_not_null(n)))}; require(!(contains(ret, "(*ERROR*)")), @@ -1984,7 +1979,7 @@ declaration::declaration(declaration const& that) return ret; } -#line 456 "reflect.h2" +#line 451 "reflect.h2" [[nodiscard]] auto object_declaration::initializer() const& -> std::string{ auto ret {CPP2_UFCS(object_initializer)((*cpp2::impl::assert_not_null(n)))}; require(!(contains(ret, "(*ERROR*)")), @@ -1995,25 +1990,25 @@ declaration::declaration(declaration const& that) object_declaration::object_declaration(object_declaration const& that) : declaration{ static_cast(that) }{} -#line 465 "reflect.h2" +#line 460 "reflect.h2" //----------------------------------------------------------------------- // Type declarations // -#line 472 "reflect.h2" +#line 467 "reflect.h2" type_declaration::type_declaration( declaration_node* n_, cpp2::impl::in s ) : declaration{ n_, s } -#line 477 "reflect.h2" +#line 472 "reflect.h2" { if (cpp2::cpp2_default.is_active() && !(CPP2_UFCS(is_type)((*cpp2::impl::assert_not_null(n)))) ) { cpp2::cpp2_default.report_violation(""); } } -#line 482 "reflect.h2" +#line 477 "reflect.h2" auto type_declaration::reserve_names(cpp2::impl::in name, auto&& ...etc) const& -> void { // etc is not declared ':string_view' for compatibility with GCC 10.x for ( @@ -2028,14 +2023,14 @@ declaration::declaration(declaration const& that) } } -#line 496 "reflect.h2" +#line 491 "reflect.h2" [[nodiscard]] auto type_declaration::is_polymorphic() const& -> bool { return CPP2_UFCS(is_polymorphic)((*cpp2::impl::assert_not_null(n))); } -#line 497 "reflect.h2" +#line 492 "reflect.h2" [[nodiscard]] auto type_declaration::is_final() const& -> bool { return CPP2_UFCS(is_type_final)((*cpp2::impl::assert_not_null(n))); } -#line 498 "reflect.h2" +#line 493 "reflect.h2" [[nodiscard]] auto type_declaration::make_final() & -> bool { return CPP2_UFCS(make_type_final)((*cpp2::impl::assert_not_null(n))); } -#line 500 "reflect.h2" +#line 495 "reflect.h2" [[nodiscard]] auto type_declaration::get_member_functions() const& -> std::vector { @@ -2047,7 +2042,7 @@ declaration::declaration(declaration const& that) return ret; } -#line 511 "reflect.h2" +#line 506 "reflect.h2" [[nodiscard]] auto type_declaration::get_member_functions_needing_initializer() const& -> std::vector { @@ -2063,7 +2058,7 @@ declaration::declaration(declaration const& that) return ret; } -#line 526 "reflect.h2" +#line 521 "reflect.h2" [[nodiscard]] auto type_declaration::get_member_objects() const& -> std::vector { @@ -2074,7 +2069,7 @@ declaration::declaration(declaration const& that) return ret; } -#line 536 "reflect.h2" +#line 531 "reflect.h2" [[nodiscard]] auto type_declaration::get_member_types() const& -> std::vector { @@ -2085,7 +2080,7 @@ declaration::declaration(declaration const& that) return ret; } -#line 546 "reflect.h2" +#line 541 "reflect.h2" [[nodiscard]] auto type_declaration::get_member_aliases() const& -> std::vector { @@ -2096,7 +2091,7 @@ declaration::declaration(declaration const& that) return ret; } -#line 556 "reflect.h2" +#line 551 "reflect.h2" [[nodiscard]] auto type_declaration::get_members() const& -> std::vector { @@ -2107,16 +2102,16 @@ declaration::declaration(declaration const& that) return ret; } -#line 566 "reflect.h2" +#line 561 "reflect.h2" [[nodiscard]] auto type_declaration::query_declared_value_set_functions() const& -> query_declared_value_set_functions_ret -#line 573 "reflect.h2" +#line 568 "reflect.h2" { cpp2::impl::deferred_init out_this_in_that; cpp2::impl::deferred_init out_this_move_that; cpp2::impl::deferred_init inout_this_in_that; cpp2::impl::deferred_init inout_this_move_that; -#line 574 "reflect.h2" +#line 569 "reflect.h2" auto declared {CPP2_UFCS(find_declared_value_set_functions)((*cpp2::impl::assert_not_null(n)))}; out_this_in_that.construct(declared.out_this_in_that != nullptr); out_this_move_that.construct(declared.out_this_move_that != nullptr); @@ -2125,7 +2120,7 @@ declaration::declaration(declaration const& that) return { std::move(out_this_in_that.value()), std::move(out_this_move_that.value()), std::move(inout_this_in_that.value()), std::move(inout_this_move_that.value()) }; // NOLINT(performance-move-const-arg) } -#line 582 "reflect.h2" +#line 577 "reflect.h2" auto type_declaration::add_member(cpp2::impl::in source) & -> void { auto decl {parse_statement(source)}; @@ -2140,30 +2135,30 @@ declaration::declaration(declaration const& that) std::string("unexpected error while attempting to add member:\n") + source); } -#line 596 "reflect.h2" +#line 591 "reflect.h2" [[nodiscard]] auto type_declaration::remove_marked_members() & -> decltype(auto) { return CPP2_UFCS(type_remove_marked_members)((*cpp2::impl::assert_not_null(n))); } -#line 597 "reflect.h2" +#line 592 "reflect.h2" [[nodiscard]] auto type_declaration::remove_all_members() & -> decltype(auto) { return CPP2_UFCS(type_remove_all_members)((*cpp2::impl::assert_not_null(n))); } -#line 599 "reflect.h2" +#line 594 "reflect.h2" [[nodiscard]] auto type_declaration::disable_member_function_generation() & -> decltype(auto) { return CPP2_UFCS(type_disable_member_function_generation)((*cpp2::impl::assert_not_null(n))); } type_declaration::type_declaration(type_declaration const& that) : declaration{ static_cast(that) }{} -#line 603 "reflect.h2" +#line 598 "reflect.h2" //----------------------------------------------------------------------- // Alias declarations // -#line 610 "reflect.h2" +#line 605 "reflect.h2" alias_declaration::alias_declaration( declaration_node* n_, cpp2::impl::in s ) : declaration{ n_, s } -#line 615 "reflect.h2" +#line 610 "reflect.h2" { if (cpp2::cpp2_default.is_active() && !(CPP2_UFCS(is_alias)((*cpp2::impl::assert_not_null(n)))) ) { cpp2::cpp2_default.report_violation(""); } @@ -2172,7 +2167,7 @@ declaration::declaration(declaration const& that) alias_declaration::alias_declaration(alias_declaration const& that) : declaration{ static_cast(that) }{} -#line 622 "reflect.h2" +#line 617 "reflect.h2" //----------------------------------------------------------------------- // // Metafunctions - these are hardwired for now until we get to the @@ -2185,13 +2180,13 @@ declaration::declaration(declaration const& that) // Some common metafunction helpers (metafunctions are just functions, // so they can be factored as usual) // -#line 634 "reflect.h2" +#line 629 "reflect.h2" auto add_virtual_destructor(meta::type_declaration& t) -> void { CPP2_UFCS(add_member)(t, "operator=: (virtual move this) = { }"); } -#line 640 "reflect.h2" +#line 635 "reflect.h2" //----------------------------------------------------------------------- // // "... an abstract base class defines an interface ..." @@ -2204,7 +2199,7 @@ auto add_virtual_destructor(meta::type_declaration& t) -> void // // an abstract base class having only pure virtual functions // -#line 652 "reflect.h2" +#line 647 "reflect.h2" auto interface(meta::type_declaration& t) -> void { auto has_dtor {false}; @@ -2231,7 +2226,7 @@ auto interface(meta::type_declaration& t) -> void } } -#line 679 "reflect.h2" +#line 674 "reflect.h2" //----------------------------------------------------------------------- // // "C.35: A base class destructor should be either public and @@ -2251,7 +2246,7 @@ auto interface(meta::type_declaration& t) -> void // // Unlike an interface, it can have nonpublic and nonvirtual functions. // -#line 698 "reflect.h2" +#line 693 "reflect.h2" auto polymorphic_base(meta::type_declaration& t) -> void { auto has_dtor {false}; @@ -2276,7 +2271,7 @@ auto polymorphic_base(meta::type_declaration& t) -> void } } -#line 723 "reflect.h2" +#line 718 "reflect.h2" //----------------------------------------------------------------------- // // "... A totally ordered type ... requires operator<=> that @@ -2297,7 +2292,7 @@ auto polymorphic_base(meta::type_declaration& t) -> void //----------------------------------------------------------------------- // -#line 743 "reflect.h2" +#line 738 "reflect.h2" auto ordered_impl( meta::type_declaration& t, cpp2::impl::in ordering// must be "strong_ordering" etc. @@ -2327,7 +2322,7 @@ auto ordered_impl( // // Note: the ordering that should be encouraged as default gets the nice name // -#line 772 "reflect.h2" +#line 767 "reflect.h2" auto ordered(meta::type_declaration& t) -> void { ordered_impl(t, "strong_ordering"); @@ -2336,7 +2331,7 @@ auto ordered(meta::type_declaration& t) -> void //----------------------------------------------------------------------- // weakly_ordered - a weakly ordered type // -#line 780 "reflect.h2" +#line 775 "reflect.h2" auto weakly_ordered(meta::type_declaration& t) -> void { ordered_impl(t, "weak_ordering"); @@ -2345,13 +2340,13 @@ auto weakly_ordered(meta::type_declaration& t) -> void //----------------------------------------------------------------------- // partially_ordered - a partially ordered type // -#line 788 "reflect.h2" +#line 783 "reflect.h2" auto partially_ordered(meta::type_declaration& t) -> void { ordered_impl(t, "partial_ordering"); } -#line 794 "reflect.h2" +#line 789 "reflect.h2" //----------------------------------------------------------------------- // // "A value is ... a regular type. It must have all public @@ -2368,7 +2363,7 @@ auto partially_ordered(meta::type_declaration& t) -> void // // A type with (copy and move) x (construction and assignment) // -#line 810 "reflect.h2" +#line 805 "reflect.h2" auto copyable(meta::type_declaration& t) -> void { // If the user explicitly wrote any of the copy/move functions, @@ -2402,7 +2397,7 @@ auto copyable(meta::type_declaration& t) -> void // // A memberwise hashable type // -#line 843 "reflect.h2" +#line 838 "reflect.h2" auto hashable(meta::type_declaration& t) -> void { CPP2_UFCS(require)(t, !(CPP2_UFCS(empty)(CPP2_UFCS(get_member_objects)(t))), @@ -2428,7 +2423,7 @@ auto hashable(meta::type_declaration& t) -> void CPP2_UFCS(add_member)(t, cpp2::move(hash) + "\n return ret;\n }"); } -#line 869 "reflect.h2" +#line 864 "reflect.h2" //----------------------------------------------------------------------- // // basic_value @@ -2436,7 +2431,7 @@ auto hashable(meta::type_declaration& t) -> void // A regular type: copyable, plus has public default construction // and no protected or virtual functions // -#line 876 "reflect.h2" +#line 871 "reflect.h2" auto basic_value(meta::type_declaration& t) -> void { CPP2_UFCS(copyable)(t); @@ -2465,28 +2460,28 @@ auto basic_value(meta::type_declaration& t) -> void // // Note: the ordering that should be encouraged as default gets the nice name // -#line 904 "reflect.h2" +#line 899 "reflect.h2" auto value(meta::type_declaration& t) -> void { CPP2_UFCS(ordered)(t); CPP2_UFCS(basic_value)(t); } -#line 910 "reflect.h2" +#line 905 "reflect.h2" auto weakly_ordered_value(meta::type_declaration& t) -> void { CPP2_UFCS(weakly_ordered)(t); CPP2_UFCS(basic_value)(t); } -#line 916 "reflect.h2" +#line 911 "reflect.h2" auto partially_ordered_value(meta::type_declaration& t) -> void { CPP2_UFCS(partially_ordered)(t); CPP2_UFCS(basic_value)(t); } -#line 923 "reflect.h2" +#line 918 "reflect.h2" //----------------------------------------------------------------------- // // C.20: If you can avoid defining default operations, do @@ -2509,7 +2504,7 @@ auto partially_ordered_value(meta::type_declaration& t) -> void // // a type without declared copy/move/destructor functions // -#line 945 "reflect.h2" +#line 940 "reflect.h2" auto cpp1_rule_of_zero(meta::type_declaration& t) -> void { for ( auto& mf : CPP2_UFCS(get_member_functions)(t) ) @@ -2552,7 +2547,7 @@ auto cpp1_rule_of_zero(meta::type_declaration& t) -> void // parameters instead of concrete forwarding parameters (mainly used // for cppfront internal use, so cppfront builds under GCC 10) // -#line 987 "reflect.h2" +#line 982 "reflect.h2" auto cpp2_struct(meta::type_declaration& t) -> void { std::string ctor_params {}; @@ -2609,7 +2604,7 @@ value_member_info::value_member_info(auto const& name_, auto const& type_, auto , type{ type_ } , value{ value_ }{} -#line 1039 "reflect.h2" +#line 1034 "reflect.h2" //----------------------------------------------------------------------- // // "C enumerations constitute a curiously half-baked concept. ... @@ -2628,7 +2623,7 @@ value_member_info::value_member_info(auto const& name_, auto const& type_, auto // a type together with named constants that are its possible values // -#line 1062 "reflect.h2" +#line 1057 "reflect.h2" auto basic_enum( meta::type_declaration& t, auto const& nextval, @@ -2653,7 +2648,7 @@ auto basic_enum( { std::string value{"-1"}; -#line 1085 "reflect.h2" +#line 1080 "reflect.h2" for ( auto const& m : CPP2_UFCS(get_members)(t) ) if ( CPP2_UFCS(is_member_object)(m)) @@ -2695,7 +2690,7 @@ std::string value{"-1"}; } } -#line 1125 "reflect.h2" +#line 1120 "reflect.h2" if ((CPP2_UFCS(empty)(enumerators))) { CPP2_UFCS(error)(t, "an enumeration must contain at least one enumerator value"); return ; @@ -2746,7 +2741,7 @@ std::string value{"-1"}; } } -#line 1176 "reflect.h2" +#line 1171 "reflect.h2" // 2. Replace: Erase the contents and replace with modified contents // // Note that most values and functions are declared as '==' compile-time values, i.e. Cpp1 'constexpr' @@ -2796,7 +2791,7 @@ std::string to_string_impl{" to_string_impl: (this, prefix: std::string_view" // Provide 'to_string' and 'to_code' functions to print enumerator // name(s) as human-readable strings or as code expressions -#line 1223 "reflect.h2" +#line 1218 "reflect.h2" { if (bitwise) { to_string_impl += ", separator: std::string_view ) -> std::string = { \n" @@ -2837,7 +2832,7 @@ std::string to_string_impl{" to_string_impl: (this, prefix: std::string_view" } } -#line 1262 "reflect.h2" +#line 1257 "reflect.h2" if (bitwise) { CPP2_UFCS(add_member)(t, " to_string: (this) -> std::string = to_string_impl( \"\", \", \" );"); CPP2_UFCS(add_member)(t, " to_code : (this) -> std::string = to_string_impl( \"" + cpp2::to_string(CPP2_UFCS(name)(t)) + "::\", \" | \" );"); @@ -2851,7 +2846,7 @@ std::string from_string{" from_string: (s: std::string_view) -> " + cpp2::to_ // Provide a 'from_string' function to parse strings into enumerators -#line 1273 "reflect.h2" +#line 1268 "reflect.h2" { std::string_view prefix {""}; std::string_view combine_op {"return"}; @@ -2873,7 +2868,7 @@ std::string from_string{" from_string: (s: std::string_view) -> " + cpp2::to_ { std::string_view else_{""}; -#line 1293 "reflect.h2" +#line 1288 "reflect.h2" for ( auto const& e : cpp2::move(enumerators) ) { from_string += " " + cpp2::to_string(else_) + "if \"" + cpp2::to_string(e.name) + "\" == x { " + cpp2::to_string(combine_op) + " " + cpp2::to_string(e.name) + "; }\n"; @@ -2881,7 +2876,7 @@ std::string_view else_{""}; } } -#line 1299 "reflect.h2" +#line 1294 "reflect.h2" if (bitwise) { from_string += " else { break outer; }\n" " }\n" @@ -2897,11 +2892,11 @@ std::string_view else_{""}; } } -#line 1313 "reflect.h2" +#line 1308 "reflect.h2" CPP2_UFCS(add_member)(t, " from_code: (s: std::string_view) -> " + cpp2::to_string(CPP2_UFCS(name)(t)) + " = { str: std::string = s; return from_string( cpp2::string_util::replace_all(str, \"" + cpp2::to_string(CPP2_UFCS(name)(t)) + "::\", \"\" ) ); }"); } -#line 1317 "reflect.h2" +#line 1312 "reflect.h2" //----------------------------------------------------------------------- // // "An enum[...] is a totally ordered value type that stores a @@ -2911,7 +2906,7 @@ std::string_view else_{""}; // // -- P0707R4, section 3 // -#line 1326 "reflect.h2" +#line 1321 "reflect.h2" auto cpp2_enum(meta::type_declaration& t) -> void { // Let basic_enum do its thing, with an incrementing value generator @@ -2928,7 +2923,7 @@ auto cpp2_enum(meta::type_declaration& t) -> void ); } -#line 1343 "reflect.h2" +#line 1338 "reflect.h2" //----------------------------------------------------------------------- // // "flag_enum expresses an enumeration that stores values @@ -2939,7 +2934,7 @@ auto cpp2_enum(meta::type_declaration& t) -> void // // -- P0707R4, section 3 // -#line 1353 "reflect.h2" +#line 1348 "reflect.h2" auto flag_enum(meta::type_declaration& t) -> void { // Let basic_enum do its thing, with a power-of-two value generator @@ -2961,7 +2956,7 @@ auto flag_enum(meta::type_declaration& t) -> void ); } -#line 1375 "reflect.h2" +#line 1370 "reflect.h2" //----------------------------------------------------------------------- // // "As with void*, programmers should know that unions [...] are @@ -2986,7 +2981,7 @@ auto flag_enum(meta::type_declaration& t) -> void // a type that contains exactly one of a fixed set of values at a time // -#line 1399 "reflect.h2" +#line 1394 "reflect.h2" auto cpp2_union(meta::type_declaration& t) -> void { std::vector alternatives {}; @@ -2995,7 +2990,7 @@ auto value{0}; // 1. Gather: All the user-written members, and find/compute the max size -#line 1406 "reflect.h2" +#line 1401 "reflect.h2" for ( auto const& m : CPP2_UFCS(get_members)(t) ) { do @@ -3025,7 +3020,7 @@ auto value{0}; } while (false); ++value; } } -#line 1434 "reflect.h2" +#line 1429 "reflect.h2" std::string discriminator_type {}; if (cpp2::impl::cmp_less(CPP2_UFCS(ssize)(alternatives),std::numeric_limits::max())) { discriminator_type = "i8"; @@ -3040,7 +3035,7 @@ auto value{0}; discriminator_type = "i64"; }}} -#line 1449 "reflect.h2" +#line 1444 "reflect.h2" // 2. Replace: Erase the contents and replace with modified contents CPP2_UFCS(remove_marked_members)(t); @@ -3049,7 +3044,7 @@ std::string storage{" _storage: cpp2::aligned_storage t) -> void { std::cout << CPP2_UFCS(print)(t) << "\n"; @@ -3254,7 +3249,7 @@ return none; [[nodiscard]] auto expression_flags::from_code(cpp2::impl::in s) -> expression_flags{ std::string str {s}; return from_string(cpp2::string_util::replace_all(cpp2::move(str), "expression_flags::", "")); } -#line 1556 "reflect.h2" +#line 1551 "reflect.h2" //----------------------------------------------------------------------- // // regex - creates regular expressions from members @@ -3270,11 +3265,11 @@ std::string str {s}; return from_string(cpp2::string_util::replace_all(cpp2::mov // ``` // -#line 1572 "reflect.h2" +#line 1567 "reflect.h2" // Possible modifiers for a regular expression. // -#line 1576 "reflect.h2" +#line 1571 "reflect.h2" // mod: i // mod: m // mod: s @@ -3282,106 +3277,106 @@ std::string str {s}; return from_string(cpp2::string_util::replace_all(cpp2::mov // mod: x // mod: xx -#line 1585 "reflect.h2" +#line 1580 "reflect.h2" // Tokens for regular expressions. // // Basic class for a regex token. // -#line 1594 "reflect.h2" +#line 1589 "reflect.h2" regex_token::regex_token(cpp2::impl::in str) : string_rep{ str }{ -#line 1596 "reflect.h2" +#line 1591 "reflect.h2" } -#line 1598 "reflect.h2" +#line 1593 "reflect.h2" regex_token::regex_token() : string_rep{ "" }{ -#line 1600 "reflect.h2" +#line 1595 "reflect.h2" } //parse: (inout ctx: parse_context) -> token_ptr; // Generate the matching code. -#line 1605 "reflect.h2" +#line 1600 "reflect.h2" auto regex_token::add_groups([[maybe_unused]] std::set& unnamed_param_2) const -> void{}// Adds all group indices to the set. -#line 1606 "reflect.h2" +#line 1601 "reflect.h2" [[nodiscard]] auto regex_token::to_string() const& -> std::string{return string_rep; }// Create a string representation. -#line 1607 "reflect.h2" +#line 1602 "reflect.h2" auto regex_token::set_string(cpp2::impl::in s) & -> void{string_rep = s; } regex_token::~regex_token() noexcept{}// Set the string representation. -#line 1622 "reflect.h2" +#line 1617 "reflect.h2" regex_token_check::regex_token_check(cpp2::impl::in str, cpp2::impl::in check_) : regex_token{ str } , check{ check_ }{ -#line 1625 "reflect.h2" +#line 1620 "reflect.h2" } -#line 1627 "reflect.h2" +#line 1622 "reflect.h2" auto regex_token_check::generate_code(generation_context& ctx) const -> void{ ctx.add_check(check + "(" + ctx.match_parameters() + ")"); } regex_token_check::~regex_token_check() noexcept{} -#line 1641 "reflect.h2" +#line 1636 "reflect.h2" regex_token_code::regex_token_code(cpp2::impl::in str, cpp2::impl::in code_) : regex_token{ str } , code{ code_ }{ -#line 1644 "reflect.h2" +#line 1639 "reflect.h2" } -#line 1646 "reflect.h2" +#line 1641 "reflect.h2" auto regex_token_code::generate_code(generation_context& ctx) const -> void{ ctx.add(code); } regex_token_code::~regex_token_code() noexcept{} -#line 1658 "reflect.h2" +#line 1653 "reflect.h2" regex_token_empty::regex_token_empty(cpp2::impl::in str) : regex_token{ str }{ -#line 1660 "reflect.h2" +#line 1655 "reflect.h2" } -#line 1662 "reflect.h2" +#line 1657 "reflect.h2" auto regex_token_empty::generate_code([[maybe_unused]] generation_context& unnamed_param_2) const -> void{ // Nothing. } regex_token_empty::~regex_token_empty() noexcept{} -#line 1676 "reflect.h2" +#line 1671 "reflect.h2" regex_token_list::regex_token_list(cpp2::impl::in t) : regex_token{ gen_string(t) } , tokens{ t }{ -#line 1679 "reflect.h2" +#line 1674 "reflect.h2" } -#line 1681 "reflect.h2" +#line 1676 "reflect.h2" auto regex_token_list::generate_code(generation_context& ctx) const -> void{ for ( auto const& token : tokens ) { (*cpp2::impl::assert_not_null(token)).generate_code(ctx); } } -#line 1687 "reflect.h2" +#line 1682 "reflect.h2" auto regex_token_list::add_groups(std::set& groups) const -> void{ for ( auto const& token : tokens ) { (*cpp2::impl::assert_not_null(token)).add_groups(groups); } } -#line 1693 "reflect.h2" +#line 1688 "reflect.h2" [[nodiscard]] auto regex_token_list::gen_string(cpp2::impl::in vec) -> std::string{ std::string r {""}; for ( auto const& token : vec ) { @@ -3392,7 +3387,7 @@ std::string str {s}; return from_string(cpp2::string_util::replace_all(cpp2::mov regex_token_list::~regex_token_list() noexcept{} -#line 1716 "reflect.h2" +#line 1711 "reflect.h2" auto parse_context_group_state::next_alternative() & -> void{ token_vec new_list {}; std::swap(new_list, cur_match_list); @@ -3400,14 +3395,14 @@ std::string str {s}; return from_string(cpp2::string_util::replace_all(cpp2::mov static_cast(alternate_match_lists.insert(alternate_match_lists.end(), CPP2_UFCS_TEMPLATE(cpp2_new)(cpp2::shared, cpp2::move(new_list)))); } -#line 1724 "reflect.h2" +#line 1719 "reflect.h2" auto parse_context_group_state::swap(parse_context_group_state& t) & -> void{// NOLINT(performance-noexcept-swap) std::swap(cur_match_list, t.cur_match_list); std::swap(alternate_match_lists, t.alternate_match_lists); std::swap(modifiers, t.modifiers); } -#line 1731 "reflect.h2" +#line 1726 "reflect.h2" [[nodiscard]] auto parse_context_group_state::get_as_token() & -> token_ptr{ if (alternate_match_lists.empty()) { post_process_list(cur_match_list); @@ -3419,15 +3414,15 @@ std::string str {s}; return from_string(cpp2::string_util::replace_all(cpp2::mov } } -#line 1743 "reflect.h2" +#line 1738 "reflect.h2" auto parse_context_group_state::add(cpp2::impl::in token) & -> void{ cur_match_list.push_back(token); } -#line 1748 "reflect.h2" +#line 1743 "reflect.h2" [[nodiscard]] auto parse_context_group_state::empty() const& -> bool { return cur_match_list.empty(); } -#line 1752 "reflect.h2" +#line 1747 "reflect.h2" auto parse_context_group_state::post_process_list(token_vec& list) -> void{ // Merge all characters auto merge_pos {list.begin()}; @@ -3448,7 +3443,7 @@ std::string str {s}; return from_string(cpp2::string_util::replace_all(cpp2::mov , modifiers{ modifiers_ }{} parse_context_group_state::parse_context_group_state(){} -#line 1778 "reflect.h2" +#line 1773 "reflect.h2" [[nodiscard]] auto parse_context_branch_reset_state::next() & -> int{ auto g {cur_group}; cur_group += 1; @@ -3457,20 +3452,20 @@ parse_context_group_state::parse_context_group_state(){} return g; } -#line 1787 "reflect.h2" +#line 1782 "reflect.h2" auto parse_context_branch_reset_state::set_next(cpp2::impl::in g) & -> void{ cur_group = g; max_group = max(max_group, g); } -#line 1793 "reflect.h2" +#line 1788 "reflect.h2" auto parse_context_branch_reset_state::next_alternative() & -> void{ if (is_active) { cur_group = from; } } -#line 1800 "reflect.h2" +#line 1795 "reflect.h2" auto parse_context_branch_reset_state::set_active_reset(cpp2::impl::in restart) & -> void{ is_active = true; cur_group = restart; @@ -3485,16 +3480,16 @@ parse_context_group_state::parse_context_group_state(){} , from{ from_ }{} parse_context_branch_reset_state::parse_context_branch_reset_state(){} -#line 1828 "reflect.h2" +#line 1823 "reflect.h2" parse_context::parse_context(cpp2::impl::in r, auto const& e) : regex{ r } , root{ CPP2_UFCS_TEMPLATE_NONLOCAL(cpp2_new)(cpp2::shared, "") } , error_out{ e }{ -#line 1832 "reflect.h2" +#line 1827 "reflect.h2" } -#line 1838 "reflect.h2" +#line 1833 "reflect.h2" [[nodiscard]] auto parse_context::start_group() & -> parse_context_group_state { parse_context_group_state old_state {}; @@ -3504,7 +3499,7 @@ parse_context_branch_reset_state::parse_context_branch_reset_state(){} return old_state; } -#line 1848 "reflect.h2" +#line 1843 "reflect.h2" [[nodiscard]] auto parse_context::end_group(cpp2::impl::in old_state) & -> token_ptr { auto inner {cur_group_state.get_as_token()}; @@ -3512,17 +3507,17 @@ parse_context_branch_reset_state::parse_context_branch_reset_state(){} return inner; } -#line 1855 "reflect.h2" +#line 1850 "reflect.h2" [[nodiscard]] auto parse_context::get_modifiers() const& -> expression_flags{ return cur_group_state.modifiers; } -#line 1859 "reflect.h2" +#line 1854 "reflect.h2" auto parse_context::set_modifiers(cpp2::impl::in mod) & -> void{ cur_group_state.modifiers = mod; } -#line 1866 "reflect.h2" +#line 1861 "reflect.h2" [[nodiscard]] auto parse_context::branch_reset_new_state() & -> parse_context_branch_reset_state { parse_context_branch_reset_state old_state {}; @@ -3532,7 +3527,7 @@ parse_context_branch_reset_state::parse_context_branch_reset_state(){} return old_state; } -#line 1875 "reflect.h2" +#line 1870 "reflect.h2" auto parse_context::branch_reset_restore_state(cpp2::impl::in old_state) & -> void { auto max_group {cur_branch_reset_state.max_group}; @@ -3540,24 +3535,24 @@ parse_context_branch_reset_state::parse_context_branch_reset_state(){} cur_branch_reset_state.set_next(cpp2::move(max_group)); } -#line 1882 "reflect.h2" +#line 1877 "reflect.h2" auto parse_context::next_alternative() & -> void { cur_group_state.next_alternative(); cur_branch_reset_state.next_alternative(); } -#line 1890 "reflect.h2" +#line 1885 "reflect.h2" auto parse_context::add_token(cpp2::impl::in token) & -> void{ cur_group_state.add(token); } -#line 1894 "reflect.h2" +#line 1889 "reflect.h2" [[nodiscard]] auto parse_context::has_token() const& -> bool{ return !(cur_group_state.empty()); } -#line 1898 "reflect.h2" +#line 1893 "reflect.h2" [[nodiscard]] auto parse_context::pop_token() & -> token_ptr { token_ptr r {nullptr}; @@ -3569,22 +3564,22 @@ parse_context_branch_reset_state::parse_context_branch_reset_state(){} return r; } -#line 1909 "reflect.h2" +#line 1904 "reflect.h2" [[nodiscard]] auto parse_context::get_as_token() & -> token_ptr{ return root; } -#line 1915 "reflect.h2" +#line 1910 "reflect.h2" [[nodiscard]] auto parse_context::get_cur_group() const& -> int{ return cur_branch_reset_state.cur_group; } -#line 1919 "reflect.h2" +#line 1914 "reflect.h2" [[nodiscard]] auto parse_context::next_group() & -> int{ return cur_branch_reset_state.next(); } -#line 1923 "reflect.h2" +#line 1918 "reflect.h2" auto parse_context::set_named_group(cpp2::impl::in name, cpp2::impl::in id) & -> void { if (!(named_groups.contains(name))) {// Redefinition of group name is not an error. The left most one is retained. @@ -3592,7 +3587,7 @@ parse_context_branch_reset_state::parse_context_branch_reset_state(){} } } -#line 1930 "reflect.h2" +#line 1925 "reflect.h2" [[nodiscard]] auto parse_context::get_named_group(cpp2::impl::in name) const& -> int { auto iter {named_groups.find(name)}; @@ -3604,10 +3599,10 @@ parse_context_branch_reset_state::parse_context_branch_reset_state(){} } } -#line 1943 "reflect.h2" +#line 1938 "reflect.h2" [[nodiscard]] auto parse_context::current() const& -> char{return CPP2_ASSERT_IN_BOUNDS(regex, pos); } -#line 1946 "reflect.h2" +#line 1941 "reflect.h2" [[nodiscard]] auto parse_context::get_next_position(cpp2::impl::in in_class, cpp2::impl::in no_skip) const& -> size_t { auto perl_syntax {false}; @@ -3647,7 +3642,7 @@ parse_context_branch_reset_state::parse_context_branch_reset_state(){} return cur; } -#line 1986 "reflect.h2" +#line 1981 "reflect.h2" [[nodiscard]] auto parse_context::next_impl(cpp2::impl::in in_class, cpp2::impl::in no_skip) & -> bool { pos = get_next_position(in_class, no_skip); @@ -3659,14 +3654,14 @@ parse_context_branch_reset_state::parse_context_branch_reset_state(){} } } -#line 1997 "reflect.h2" +#line 1992 "reflect.h2" [[nodiscard]] auto parse_context::next() & -> decltype(auto) { return next_impl(false, false); } -#line 1998 "reflect.h2" +#line 1993 "reflect.h2" [[nodiscard]] auto parse_context::next_in_class() & -> decltype(auto) { return next_impl(true, false); } -#line 1999 "reflect.h2" +#line 1994 "reflect.h2" [[nodiscard]] auto parse_context::next_no_skip() & -> decltype(auto) { return next_impl(false, true); } -#line 2001 "reflect.h2" +#line 1996 "reflect.h2" [[nodiscard]] auto parse_context::next_n(cpp2::impl::in n) & -> bool{ auto r {true}; auto cur {0}; @@ -3676,10 +3671,10 @@ parse_context_branch_reset_state::parse_context_branch_reset_state(){} return r; } -#line 2010 "reflect.h2" +#line 2005 "reflect.h2" [[nodiscard]] auto parse_context::has_next() const& -> bool{return cpp2::impl::cmp_less(pos,regex.size()); } -#line 2012 "reflect.h2" +#line 2007 "reflect.h2" [[nodiscard]] auto parse_context::grab_until_impl(cpp2::impl::in e, cpp2::impl::out r, cpp2::impl::in any) & -> bool { auto end {pos}; // NOLINT(clang-analyzer-deadcode.DeadStores) @@ -3701,14 +3696,14 @@ parse_context_branch_reset_state::parse_context_branch_reset_state(){} } } -#line 2033 "reflect.h2" +#line 2028 "reflect.h2" [[nodiscard]] auto parse_context::grab_until(cpp2::impl::in e, cpp2::impl::out r) & -> decltype(auto) { return grab_until_impl(e, cpp2::impl::out(&r), false); } -#line 2034 "reflect.h2" +#line 2029 "reflect.h2" [[nodiscard]] auto parse_context::grab_until(cpp2::impl::in e, cpp2::impl::out r) & -> decltype(auto) { return grab_until_impl(std::string(1, e), cpp2::impl::out(&r), false); } -#line 2035 "reflect.h2" +#line 2030 "reflect.h2" [[nodiscard]] auto parse_context::grab_until_one_of(cpp2::impl::in e, cpp2::impl::out r) & -> decltype(auto) { return grab_until_impl(e, cpp2::impl::out(&r), true); } -#line 2037 "reflect.h2" +#line 2032 "reflect.h2" [[nodiscard]] auto parse_context::grab_n(cpp2::impl::in n, cpp2::impl::out r) & -> bool { if (cpp2::impl::cmp_less_eq(pos + cpp2::impl::as_(n),regex.size())) { @@ -3722,7 +3717,7 @@ parse_context_branch_reset_state::parse_context_branch_reset_state(){} } } -#line 2050 "reflect.h2" +#line 2045 "reflect.h2" [[nodiscard]] auto parse_context::grab_number() & -> std::string { auto start {pos}; @@ -3744,7 +3739,7 @@ parse_context_branch_reset_state::parse_context_branch_reset_state(){} return cpp2::move(r.value()); } -#line 2071 "reflect.h2" +#line 2066 "reflect.h2" [[nodiscard]] auto parse_context::peek_impl(cpp2::impl::in in_class) const& -> char{ auto next_pos {get_next_position(in_class, false)}; if (cpp2::impl::cmp_less(next_pos,regex.size())) { @@ -3755,12 +3750,12 @@ parse_context_branch_reset_state::parse_context_branch_reset_state(){} } } -#line 2081 "reflect.h2" +#line 2076 "reflect.h2" [[nodiscard]] auto parse_context::peek() const& -> decltype(auto) { return peek_impl(false); } -#line 2082 "reflect.h2" +#line 2077 "reflect.h2" [[nodiscard]] auto parse_context::peek_in_class() const& -> decltype(auto) { return peek_impl(true); } -#line 2087 "reflect.h2" +#line 2082 "reflect.h2" [[nodiscard]] auto parse_context::parser_group_modifiers(cpp2::impl::in change_str, expression_flags& parser_modifiers) & -> bool { auto is_negative {false}; @@ -3815,7 +3810,7 @@ parse_context_branch_reset_state::parse_context_branch_reset_state(){} return true; } -#line 2141 "reflect.h2" +#line 2136 "reflect.h2" [[nodiscard]] auto parse_context::parse_until(cpp2::impl::in term) & -> bool{ token_ptr cur_token {}; @@ -3854,7 +3849,7 @@ parse_context_branch_reset_state::parse_context_branch_reset_state(){} return true; } -#line 2179 "reflect.h2" +#line 2174 "reflect.h2" [[nodiscard]] auto parse_context::parse(cpp2::impl::in modifiers) & -> bool { @@ -3870,21 +3865,21 @@ parse_context_branch_reset_state::parse_context_branch_reset_state(){} return r; } -#line 2196 "reflect.h2" +#line 2191 "reflect.h2" [[nodiscard]] auto parse_context::get_pos() const& -> decltype(auto) { return pos; } -#line 2197 "reflect.h2" +#line 2192 "reflect.h2" [[nodiscard]] auto parse_context::get_range(cpp2::impl::in start, cpp2::impl::in end) const& -> decltype(auto) { return std::string(regex.substr(start, end - start + 1)); } -#line 2198 "reflect.h2" +#line 2193 "reflect.h2" [[nodiscard]] auto parse_context::valid() const& -> bool{return has_next() && !(has_error); } -#line 2200 "reflect.h2" +#line 2195 "reflect.h2" [[nodiscard]] auto parse_context::error(cpp2::impl::in err) & -> token_ptr{ has_error = true; error_out("Error during parsing of regex '" + cpp2::to_string(regex) + "' at position '" + cpp2::to_string(pos) + "': " + cpp2::to_string(err) + ""); return nullptr; } -#line 2215 "reflect.h2" +#line 2210 "reflect.h2" auto generation_function_context::add_tabs(cpp2::impl::in c) & -> void{ int i {0}; for( ; cpp2::impl::cmp_less(i,c); i += 1 ) { @@ -3892,7 +3887,7 @@ parse_context_branch_reset_state::parse_context_branch_reset_state(){} } } -#line 2222 "reflect.h2" +#line 2217 "reflect.h2" auto generation_function_context::remove_tabs(cpp2::impl::in c) & -> void{ tabs = tabs.substr(0, (cpp2::impl::as_(c)) * 2); } @@ -3902,22 +3897,22 @@ parse_context_branch_reset_state::parse_context_branch_reset_state(){} , tabs{ tabs_ }{} generation_function_context::generation_function_context(){} -#line 2240 "reflect.h2" +#line 2235 "reflect.h2" [[nodiscard]] auto generation_context::match_parameters() const& -> std::string{return "r.pos, ctx"; } -#line 2245 "reflect.h2" +#line 2240 "reflect.h2" auto generation_context::add(cpp2::impl::in s) & -> void{ auto cur {get_current()}; (*cpp2::impl::assert_not_null(cur)).code += "" + cpp2::to_string((*cpp2::impl::assert_not_null(cur)).tabs) + cpp2::to_string(s) + "\n"; } -#line 2251 "reflect.h2" +#line 2246 "reflect.h2" auto generation_context::add_check(cpp2::impl::in check) & -> void{ auto cur {get_current()}; (*cpp2::impl::assert_not_null(cur)).code += "" + cpp2::to_string((*cpp2::impl::assert_not_null(cur)).tabs) + "if !cpp2::regex::" + cpp2::to_string(check) + " { r.matched = false; break; }\n"; } -#line 2257 "reflect.h2" +#line 2252 "reflect.h2" auto generation_context::add_statefull(cpp2::impl::in next_func, cpp2::impl::in check) & -> void { end_func_statefull(check); @@ -3926,7 +3921,7 @@ generation_function_context::generation_function_context(){} start_func_named(cpp2::move(name)); } -#line 2265 "reflect.h2" +#line 2260 "reflect.h2" auto generation_context::start_func_named(cpp2::impl::in name) & -> void { auto cur {new_context()}; @@ -3938,7 +3933,7 @@ generation_function_context::generation_function_context(){} (*cpp2::impl::assert_not_null(cpp2::move(cur))).add_tabs(3); } -#line 2276 "reflect.h2" +#line 2271 "reflect.h2" [[nodiscard]] auto generation_context::start_func() & -> std::string { auto name {gen_func_name()}; @@ -3946,7 +3941,7 @@ generation_function_context::generation_function_context(){} return cpp2::move(name) + "()"; } -#line 2283 "reflect.h2" +#line 2278 "reflect.h2" auto generation_context::end_func_statefull(cpp2::impl::in s) & -> void { auto cur {get_current()}; @@ -3966,7 +3961,7 @@ generation_function_context::generation_function_context(){} finish_context(); } -#line 2303 "reflect.h2" +#line 2298 "reflect.h2" [[nodiscard]] auto generation_context::generate_func(cpp2::impl::in token) & -> std::string { auto name {start_func()}; @@ -3976,7 +3971,7 @@ generation_function_context::generation_function_context(){} return name; } -#line 2313 "reflect.h2" +#line 2308 "reflect.h2" [[nodiscard]] auto generation_context::generate_reset(cpp2::impl::in> groups) & -> std::string { if (groups.empty()) { @@ -3999,33 +3994,33 @@ generation_function_context::generation_function_context(){} return cpp2::move(name) + "()"; } -#line 2337 "reflect.h2" +#line 2332 "reflect.h2" [[nodiscard]] auto generation_context::gen_func_name() & -> std::string{ auto cur_id {matcher_func}; matcher_func += 1; return "func_" + cpp2::to_string(cpp2::move(cur_id)) + ""; } -#line 2343 "reflect.h2" +#line 2338 "reflect.h2" [[nodiscard]] auto generation_context::next_func_name() & -> std::string{ return gen_func_name() + "()"; } -#line 2347 "reflect.h2" +#line 2342 "reflect.h2" [[nodiscard]] auto generation_context::gen_reset_func_name() & -> std::string{ auto cur_id {reset_func}; reset_func += 1; return "reset_" + cpp2::to_string(cpp2::move(cur_id)) + ""; } -#line 2353 "reflect.h2" +#line 2348 "reflect.h2" [[nodiscard]] auto generation_context::gen_temp() & -> std::string{ auto cur_id {temp_name}; temp_name += 1; return "tmp_" + cpp2::to_string(cpp2::move(cur_id)) + ""; } -#line 2361 "reflect.h2" +#line 2356 "reflect.h2" [[nodiscard]] auto generation_context::new_context() & -> generation_function_context*{ gen_stack.push_back(generation_function_context()); auto cur {get_current()}; @@ -4034,7 +4029,7 @@ generation_function_context::generation_function_context(){} return cur; } -#line 2369 "reflect.h2" +#line 2364 "reflect.h2" auto generation_context::finish_context() & -> void{ auto cur {get_current()}; auto base {get_base()}; @@ -4043,22 +4038,22 @@ generation_function_context::generation_function_context(){} gen_stack.pop_back(); } -#line 2379 "reflect.h2" +#line 2374 "reflect.h2" [[nodiscard]] auto generation_context::get_current() & -> generation_function_context*{ return &gen_stack.back(); } -#line 2383 "reflect.h2" +#line 2378 "reflect.h2" [[nodiscard]] auto generation_context::get_base() & -> generation_function_context*{ return &CPP2_ASSERT_IN_BOUNDS_LITERAL(gen_stack, 0); } -#line 2387 "reflect.h2" +#line 2382 "reflect.h2" [[nodiscard]] auto generation_context::get_entry_func() const& -> std::string{ return entry_func; } -#line 2391 "reflect.h2" +#line 2386 "reflect.h2" [[nodiscard]] auto generation_context::create_named_group_lookup(cpp2::impl::in> named_groups) const& -> std::string { std::string res {"get_named_group_index: (name) -> int = {\n"}; @@ -4082,18 +4077,18 @@ generation_function_context::generation_function_context(){} return res; } -#line 2416 "reflect.h2" +#line 2411 "reflect.h2" [[nodiscard]] auto generation_context::run(cpp2::impl::in token) & -> std::string{ entry_func = generate_func(token); return (*cpp2::impl::assert_not_null(get_base())).code; } -#line 2431 "reflect.h2" +#line 2426 "reflect.h2" alternative_token::alternative_token() : regex_token_empty{ "" }{} -#line 2433 "reflect.h2" +#line 2428 "reflect.h2" [[nodiscard]] auto alternative_token::parse(parse_context& ctx) -> token_ptr{ if (ctx.current() != '|') {return nullptr; } @@ -4104,15 +4099,15 @@ generation_function_context::generation_function_context(){} alternative_token::~alternative_token() noexcept{} -#line 2448 "reflect.h2" +#line 2443 "reflect.h2" alternative_token_gen::alternative_token_gen(cpp2::impl::in a) : regex_token{ gen_string(a) } , alternatives{ a }{ -#line 2451 "reflect.h2" +#line 2446 "reflect.h2" } -#line 2453 "reflect.h2" +#line 2448 "reflect.h2" auto alternative_token_gen::generate_code(generation_context& ctx) const -> void { std::string functions {""}; @@ -4130,7 +4125,7 @@ generation_function_context::generation_function_context(){} ctx.add_statefull(next_name, "cpp2::regex::alternative_token_matcher::match(" + cpp2::to_string(ctx.match_parameters()) + ", other, " + cpp2::to_string(next_name) + " " + cpp2::to_string(cpp2::move(functions)) + ")"); } -#line 2470 "reflect.h2" +#line 2465 "reflect.h2" auto alternative_token_gen::add_groups(std::set& groups) const -> void { for ( auto const& cur : alternatives ) { @@ -4138,7 +4133,7 @@ generation_function_context::generation_function_context(){} } } -#line 2477 "reflect.h2" +#line 2472 "reflect.h2" [[nodiscard]] auto alternative_token_gen::gen_string(cpp2::impl::in a) -> std::string { std::string r {""}; @@ -4154,14 +4149,14 @@ generation_function_context::generation_function_context(){} alternative_token_gen::~alternative_token_gen() noexcept{} -#line 2498 "reflect.h2" +#line 2493 "reflect.h2" any_token::any_token(cpp2::impl::in single_line) : regex_token_check{ ".", "any_token_matcher" }{ -#line 2500 "reflect.h2" +#line 2495 "reflect.h2" } -#line 2502 "reflect.h2" +#line 2497 "reflect.h2" [[nodiscard]] auto any_token::parse(parse_context& ctx) -> token_ptr{ if ('.' != ctx.current()) {return nullptr; } @@ -4170,21 +4165,21 @@ generation_function_context::generation_function_context(){} any_token::~any_token() noexcept{} -#line 2519 "reflect.h2" +#line 2514 "reflect.h2" char_token::char_token(cpp2::impl::in t, cpp2::impl::in ignore_case_) : regex_token{ std::string(1, t) } , token{ t } , ignore_case{ ignore_case_ }{ -#line 2523 "reflect.h2" +#line 2518 "reflect.h2" } -#line 2525 "reflect.h2" +#line 2520 "reflect.h2" [[nodiscard]] auto char_token::parse(parse_context& ctx) -> token_ptr{ return CPP2_UFCS_TEMPLATE(cpp2_new)(cpp2::shared, ctx.current(), ctx.get_modifiers().has(expression_flags::case_insensitive)); } -#line 2529 "reflect.h2" +#line 2524 "reflect.h2" auto char_token::generate_code(generation_context& ctx) const -> void { if (ignore_case) { @@ -4193,14 +4188,14 @@ generation_function_context::generation_function_context(){} { size_t i{0}; -#line 2535 "reflect.h2" +#line 2530 "reflect.h2" for( ; cpp2::impl::cmp_less(i,token.size()); i += 1 ) { CPP2_ASSERT_IN_BOUNDS(lower, i) = string_util::safe_tolower(CPP2_ASSERT_IN_BOUNDS(token, i)); CPP2_ASSERT_IN_BOUNDS(upper, i) = string_util::safe_toupper(CPP2_ASSERT_IN_BOUNDS(token, i)); } } -#line 2540 "reflect.h2" +#line 2535 "reflect.h2" if (upper != lower) { gen_case_insensitive(cpp2::move(lower), cpp2::move(upper), ctx); } @@ -4213,7 +4208,7 @@ size_t i{0}; } } -#line 2552 "reflect.h2" +#line 2547 "reflect.h2" auto char_token::gen_case_insensitive(cpp2::impl::in lower, cpp2::impl::in upper, generation_context& ctx) const& -> void { std::string name {"str_" + cpp2::to_string(ctx.gen_temp()) + ""}; @@ -4235,7 +4230,7 @@ size_t i{0}; ctx.add("else { break; }"); } -#line 2573 "reflect.h2" +#line 2568 "reflect.h2" auto char_token::gen_case_sensitive(generation_context& ctx) const& -> void { std::string name {"str_" + cpp2::to_string(ctx.gen_temp()) + ""}; @@ -4254,7 +4249,7 @@ size_t i{0}; ctx.add("else { break; }"); } -#line 2591 "reflect.h2" +#line 2586 "reflect.h2" [[nodiscard]] auto char_token::add_escapes(std::string str) const& -> std::string { str = string_util::replace_all(str, "\\", "\\\\"); @@ -4270,7 +4265,7 @@ size_t i{0}; return cpp2::move(str); } -#line 2606 "reflect.h2" +#line 2601 "reflect.h2" auto char_token::append(char_token const& that) & -> void{ (*this).token += that.token; (*this).string_rep += that.string_rep; @@ -4278,19 +4273,19 @@ size_t i{0}; char_token::~char_token() noexcept{} -#line 2623 "reflect.h2" +#line 2618 "reflect.h2" class_token::class_token(cpp2::impl::in negate_, cpp2::impl::in case_insensitive_, cpp2::impl::in class_str_, cpp2::impl::in str) : regex_token{ str } , negate{ negate_ } , case_insensitive{ case_insensitive_ } , class_str{ class_str_ } -#line 2624 "reflect.h2" +#line 2619 "reflect.h2" { -#line 2629 "reflect.h2" +#line 2624 "reflect.h2" } -#line 2632 "reflect.h2" +#line 2627 "reflect.h2" [[nodiscard]] auto class_token::parse(parse_context& ctx) -> token_ptr { if (ctx.current() != '[') {return nullptr; } @@ -4416,13 +4411,13 @@ size_t i{0}; ); } -#line 2757 "reflect.h2" +#line 2752 "reflect.h2" auto class_token::generate_code(generation_context& ctx) const -> void { ctx.add_check("class_token_matcher::match(" + cpp2::to_string(ctx.match_parameters()) + ")"); } -#line 2762 "reflect.h2" +#line 2757 "reflect.h2" [[nodiscard]] auto class_token::create_matcher(cpp2::impl::in name, cpp2::impl::in template_arguments) -> std::string { auto sep {", "}; @@ -4433,12 +4428,12 @@ size_t i{0}; class_token::~class_token() noexcept{} -#line 2774 "reflect.h2" +#line 2769 "reflect.h2" [[nodiscard]] auto escape_token_parse(parse_context& ctx) -> token_ptr { if (ctx.current() != '\\') {return nullptr; } -#line 2779 "reflect.h2" +#line 2774 "reflect.h2" if (std::string::npos == std::string("afenrt^.[]()*{}?+|\\").find(ctx.peek())) { return nullptr; } @@ -4472,7 +4467,7 @@ size_t i{0}; } -#line 2815 "reflect.h2" +#line 2810 "reflect.h2" [[nodiscard]] auto global_group_reset_token_parse(parse_context& ctx) -> token_ptr { if (!((ctx.current() == '\\' && ctx.peek() == 'K'))) {return nullptr; } @@ -4481,18 +4476,18 @@ size_t i{0}; return CPP2_UFCS_TEMPLATE(cpp2_new)(cpp2::shared, "\\K", "ctx..set_group_start(0, r.pos);"); } -#line 2837 "reflect.h2" +#line 2832 "reflect.h2" group_ref_token::group_ref_token(cpp2::impl::in id_, cpp2::impl::in case_insensitive_, cpp2::impl::in str) : regex_token{ str } , id{ id_ } , case_insensitive{ case_insensitive_ } -#line 2838 "reflect.h2" +#line 2833 "reflect.h2" { -#line 2842 "reflect.h2" +#line 2837 "reflect.h2" } -#line 2844 "reflect.h2" +#line 2839 "reflect.h2" [[nodiscard]] auto group_ref_token::parse(parse_context& ctx) -> token_ptr { if (ctx.current() != '\\') {return nullptr; } @@ -4594,14 +4589,14 @@ size_t i{0}; return CPP2_UFCS_TEMPLATE(cpp2_new)(cpp2::shared, cpp2::move(group_id), ctx.get_modifiers().has(expression_flags::case_insensitive), cpp2::move(str)); } -#line 2945 "reflect.h2" +#line 2940 "reflect.h2" auto group_ref_token::generate_code(generation_context& ctx) const -> void{ ctx.add_check("group_ref_token_matcher(" + cpp2::to_string(ctx.match_parameters()) + ")"); } group_ref_token::~group_ref_token() noexcept{} -#line 2968 "reflect.h2" +#line 2963 "reflect.h2" [[nodiscard]] auto group_token::parse_lookahead(parse_context& ctx, cpp2::impl::in syntax, cpp2::impl::in positive) -> token_ptr { static_cast(ctx.next());// Skip last token defining the syntax @@ -4616,7 +4611,7 @@ size_t i{0}; return r; } -#line 2982 "reflect.h2" +#line 2977 "reflect.h2" [[nodiscard]] auto group_token::parse(parse_context& ctx) -> token_ptr { if (ctx.current() != '(') {return nullptr; } @@ -4754,7 +4749,7 @@ size_t i{0}; } } -#line 3119 "reflect.h2" +#line 3114 "reflect.h2" [[nodiscard]] auto group_token::gen_string(cpp2::impl::in name, cpp2::impl::in name_brackets, cpp2::impl::in has_modifier, cpp2::impl::in modifiers, cpp2::impl::in inner_) -> std::string { std::string start {"("}; @@ -4773,7 +4768,7 @@ size_t i{0}; return cpp2::move(start) + (*cpp2::impl::assert_not_null(inner_)).to_string() + ")"; } -#line 3137 "reflect.h2" +#line 3132 "reflect.h2" auto group_token::generate_code(generation_context& ctx) const -> void { if (-1 != number) { @@ -4794,7 +4789,7 @@ size_t i{0}; } } -#line 3157 "reflect.h2" +#line 3152 "reflect.h2" auto group_token::add_groups(std::set& groups) const -> void { (*cpp2::impl::assert_not_null(inner)).add_groups(groups); @@ -4805,7 +4800,7 @@ size_t i{0}; group_token::~group_token() noexcept{} -#line 3169 "reflect.h2" +#line 3164 "reflect.h2" [[nodiscard]] auto hexadecimal_token_parse(parse_context& ctx) -> token_ptr { if (!((ctx.current() == '\\' && ctx.peek() == 'x'))) {return nullptr; } @@ -4844,7 +4839,7 @@ size_t i{0}; return r; } -#line 3210 "reflect.h2" +#line 3205 "reflect.h2" [[nodiscard]] auto line_end_token_parse(parse_context& ctx) -> token_ptr { if (ctx.current() == '$' || (ctx.current() == '\\' && ctx.peek() == '$')) { @@ -4862,7 +4857,7 @@ size_t i{0}; }} } -#line 3230 "reflect.h2" +#line 3225 "reflect.h2" [[nodiscard]] auto line_start_token_parse(parse_context& ctx) -> token_ptr { if (ctx.current() != '^' && !((ctx.current() == '\\' && ctx.peek() == 'A'))) {return nullptr; } @@ -4876,29 +4871,29 @@ size_t i{0}; } } -#line 3255 "reflect.h2" +#line 3250 "reflect.h2" lookahead_token::lookahead_token(cpp2::impl::in positive_) : regex_token{ "" } , positive{ positive_ }{ -#line 3257 "reflect.h2" +#line 3252 "reflect.h2" } -#line 3259 "reflect.h2" +#line 3254 "reflect.h2" auto lookahead_token::generate_code(generation_context& ctx) const -> void{ auto inner_name {ctx.generate_func(inner)}; ctx.add_check("lookahead_token_matcher(" + cpp2::to_string(ctx.match_parameters()) + ", " + cpp2::to_string(cpp2::move(inner_name)) + ")"); } -#line 3265 "reflect.h2" +#line 3260 "reflect.h2" auto lookahead_token::add_groups(std::set& groups) const -> void{ (*cpp2::impl::assert_not_null(inner)).add_groups(groups); } lookahead_token::~lookahead_token() noexcept{} -#line 3273 "reflect.h2" +#line 3268 "reflect.h2" [[nodiscard]] auto named_class_token_parse(parse_context& ctx) -> token_ptr { if (ctx.current() != '\\') {return nullptr; } @@ -4924,7 +4919,7 @@ size_t i{0}; return CPP2_UFCS_TEMPLATE(cpp2_new)(cpp2::shared, "\\" + cpp2::to_string(ctx.current()) + "", "" + cpp2::to_string(cpp2::move(name)) + "::match"); } -#line 3301 "reflect.h2" +#line 3296 "reflect.h2" [[nodiscard]] auto octal_token_parse(parse_context& ctx) -> token_ptr { if (!((ctx.current() == '\\' && ctx.peek() == 'o'))) {return nullptr; } @@ -4950,11 +4945,11 @@ size_t i{0}; return r; } -#line 3338 "reflect.h2" +#line 3333 "reflect.h2" range_token::range_token() : regex_token{ "" }{} -#line 3340 "reflect.h2" +#line 3335 "reflect.h2" [[nodiscard]] auto range_token::parse(parse_context& ctx) -> token_ptr { auto r {CPP2_UFCS_TEMPLATE(cpp2_new)(cpp2::shared)}; @@ -5028,7 +5023,7 @@ size_t i{0}; return nullptr; } -#line 3413 "reflect.h2" +#line 3408 "reflect.h2" auto range_token::parse_modifier(parse_context& ctx) & -> void { if (ctx.peek() == '?') { @@ -5041,7 +5036,7 @@ size_t i{0}; }} } -#line 3425 "reflect.h2" +#line 3420 "reflect.h2" [[nodiscard]] auto range_token::gen_mod_string() const& -> std::string { if (kind == range_flags::not_greedy) { @@ -5055,7 +5050,7 @@ size_t i{0}; }} } -#line 3438 "reflect.h2" +#line 3433 "reflect.h2" [[nodiscard]] auto range_token::gen_range_string() const& -> std::string { std::string r {""}; @@ -5075,7 +5070,7 @@ size_t i{0}; return r; } -#line 3457 "reflect.h2" +#line 3452 "reflect.h2" auto range_token::generate_code(generation_context& ctx) const -> void { auto inner_name {ctx.generate_func(inner_token)}; @@ -5087,14 +5082,14 @@ size_t i{0}; ctx.add_statefull(next_name, "cpp2::regex::range_token_matcher::match(" + cpp2::to_string(ctx.match_parameters()) + ", " + cpp2::to_string(cpp2::move(inner_name)) + ", " + cpp2::to_string(cpp2::move(reset_name)) + ", other, " + cpp2::to_string(next_name) + ")"); } -#line 3468 "reflect.h2" +#line 3463 "reflect.h2" auto range_token::add_groups(std::set& groups) const -> void{ (*cpp2::impl::assert_not_null(inner_token)).add_groups(groups); } range_token::~range_token() noexcept{} -#line 3481 "reflect.h2" +#line 3476 "reflect.h2" [[nodiscard]] auto special_range_token::parse(parse_context& ctx) -> token_ptr { auto r {CPP2_UFCS_TEMPLATE(cpp2_new)(cpp2::shared)}; @@ -5118,7 +5113,7 @@ size_t i{0}; if (!(ctx.has_token())) {return ctx.error("'" + cpp2::to_string(ctx.current()) + "' without previous element."); } -#line 3505 "reflect.h2" +#line 3500 "reflect.h2" (*cpp2::impl::assert_not_null(r)).parse_modifier(ctx); (*cpp2::impl::assert_not_null(r)).inner_token = ctx.pop_token(); @@ -5128,7 +5123,7 @@ size_t i{0}; special_range_token::~special_range_token() noexcept{} -#line 3518 "reflect.h2" +#line 3513 "reflect.h2" [[nodiscard]] auto word_boundary_token_parse(parse_context& ctx) -> token_ptr { if (ctx.current() != '\\') {return nullptr; } @@ -5146,15 +5141,15 @@ size_t i{0}; }} } -#line 3554 "reflect.h2" +#line 3549 "reflect.h2" template regex_generator::regex_generator(cpp2::impl::in r, Error_out const& e) : regex{ r } , error_out{ e }{ -#line 3557 "reflect.h2" +#line 3552 "reflect.h2" } -#line 3559 "reflect.h2" +#line 3554 "reflect.h2" template [[nodiscard]] auto regex_generator::parse() & -> std::string { // Extract modifiers and adapt regex. @@ -5190,7 +5185,7 @@ size_t i{0}; return source; } -#line 3594 "reflect.h2" +#line 3589 "reflect.h2" template auto regex_generator::extract_modifiers() & -> void { if (regex.find_first_of("'/") == 0) { @@ -5206,7 +5201,7 @@ size_t i{0}; } } -#line 3610 "reflect.h2" +#line 3605 "reflect.h2" template [[nodiscard]] auto generate_regex(cpp2::impl::in regex, Err const& err) -> std::string { regex_generator parser {regex, err}; @@ -5215,7 +5210,7 @@ template [[nodiscard]] auto generate_regex(cpp2::impl::in void { auto has_default {false}; @@ -5270,7 +5265,7 @@ auto regex_gen(meta::type_declaration& t) -> void CPP2_UFCS(add_runtime_support_include)(t, "cpp2regex.h"); } -#line 3679 "reflect.h2" +#line 3674 "reflect.h2" [[nodiscard]] auto apply_metafunctions( declaration_node& n, type_declaration& rtype, @@ -5382,7 +5377,7 @@ auto regex_gen(meta::type_declaration& t) -> void return true; } -#line 3791 "reflect.h2" +#line 3786 "reflect.h2" } } diff --git a/source/reflect.h2 b/source/reflect.h2 index 734fa728a..8c99c06ad 100644 --- a/source/reflect.h2 +++ b/source/reflect.h2 @@ -1,14 +1,9 @@ -// Copyright (c) Herb Sutter -// SPDX-License-Identifier: CC-BY-NC-ND-4.0 - -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. +// Copyright 2022-2024 Herb Sutter +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +// Part of the Cppfront Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://github.com/hsutter/cppfront/blob/main/LICENSE for license information. //=========================================================================== diff --git a/source/sema.h b/source/sema.h index f3d8ac63f..424261a69 100644 --- a/source/sema.h +++ b/source/sema.h @@ -1,14 +1,9 @@ -// Copyright (c) Herb Sutter -// SPDX-License-Identifier: CC-BY-NC-ND-4.0 - -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. +// Copyright 2022-2024 Herb Sutter +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +// Part of the Cppfront Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://github.com/hsutter/cppfront/blob/main/LICENSE for license information. //=========================================================================== diff --git a/source/to_cpp1.h b/source/to_cpp1.h index 3e08d83e6..73b904ecb 100644 --- a/source/to_cpp1.h +++ b/source/to_cpp1.h @@ -1,14 +1,9 @@ -// Copyright (c) Herb Sutter -// SPDX-License-Identifier: CC-BY-NC-ND-4.0 - -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. +// Copyright 2022-2024 Herb Sutter +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +// Part of the Cppfront Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://github.com/hsutter/cppfront/blob/main/LICENSE for license information. //===========================================================================