Use concepts in `x3::with`.
`x3::with` is now a CPO that inhibits ADL.
`x3::with_directive` now holds lvalue reference by reference, and rvalue by value.
This is necessary for preventing dangling reference. However, passing dangling
lvalue reference or destroying the value bound to the reference passed to
`x3::with` technically can't be detected and it is the user's responsibility to not
do such things.
Add `x3::with` test for all 4 value categories: `T`, `T const`, `T&`, `T const&`
`x3::action` now uses concepts to dispatch `f(ctx)` or `f()`, depending on
whether `f` accepts such signature.
The dispatching implementation is moved from `call.hpp` to `action.hpp`,
as the function is only used from the `x3::action` class.
`operator/`: Deprecated. The symbol `/` normally means "ordered choice"
in PEG, and is irrelevant to semantic actions. Furthermore, using C++'s
`operator/` for this purpose may introduce surprising behavior when it's
mixed with ordinary PEG operators, for instance, the unary `operator+`,
due to precedence.
`rule` now resolves the parse function using concepts, providing
significantly faster compile time & better errors.
`core/error_handler_types.hpp`: New header to separate enum
definition.
`annotate_on_success`: Modernized.
`on_error` and `on_success` now only accepts const iterators.
This is a breaking change, but we should apply this immediately
due to the reasons described below.
Historically, Spirit has passed mutable lvalue references of the
*internal* iterators to the `on_success`/`on_error` handlers. This
behavior was semantically a mistake, because:
(1) `on_success`/`on_error` mechanism was designed to be
grammar-agnostic, and
(2) it does not make sense to modify the grammar-specific
iterator on the grammar-agnostic callback.
Furthermore, any modification to X3's internal iterator variables
may invoke undefined behavior, since we had never provided any
kind of guarantee on how those variables are processed in X3's
implementation details.
In other words, I consider the old behavior as a serious BUG
that involves undefined behavior which may even lead to
security issues.
`BOOST_SPIRIT_DECLARE`: Deprecated regarding compile-time slowness
of `BOOST_PP_SEQ_FOR_EACH`.
`BOOST_SPIRIT_DEFINE`: Ditto.
`BOOST_SPIRIT_INSTANTIATE`: Deprecated because the name was not
correctly prefixed with `X3_`.
`BOOST_SPIRIT_X3_DECLARE`: New macro with correctly prefixed name.
`BOOST_SPIRIT_X3_DEFINE`: Ditto.
`BOOST_SPIRIT_X3_INSTANTIATE`: Ditto.
* Use concepts for attribute category overload resolution
`x3::traits::move_to`: Dump tag dispatching and use concepts for
overload resolution. This drastically improves compilation speed and
prints significantly concise errors on ill-formed programs, thanks to
the reduced nesting level on the entire control flow of X3. Also
partially (but not yet completely) improves #346 due to reduced MPL usage.
`x3::detail::parse_into_container`: Ditto.
`support/traits/optional_traits.hpp`:
`BOOST_SPIRIT_X3_USE_BOOST_OPTIONAL`: new macro.
Default to `boost::optional` unless above macro is defined as `0`. Implements
`std::optional` handling regardless of the value; fixes#270.
Note that most test suites are intentionally not defining above macro as `1`
(yet) to make sure the change does not break existing codes.
`x3::optional`: Ideally this should've split into a separate PR, but the
new attribute category handling requires the overhaul on this.
`core/proxy.hpp`: Removed. `x3::optional` was the only derived parser
which used this feature for years. We shouldn't support any overly
generic 'core' features whose extandable use case is unknown even to the
core components.
`extract_int`, etc.: Adjusted to properly "move" the local attribute
variable before passing it to `x3::traits::move_to`.
`char_parser`: Ditto, but this constructs temporary value instead of
applying `std::as_const`. Const references are costly for primitive type
like `Char` thus prvalue should be constructed here.
tests: No semantic changes intended. All changes exists solely for
adapting to the new attribute category handling (implementation details.)
* Fix incorrect `noexcept` specification
* Compensate for potential GCC bug on constraint satisfaction
It turns out that GCC 14 does not like the form below, resulting
in silently defining the flipped value (!) without raising any sort of
hard/soft errors in well-formed code.
```
struct S : std::bool_constant<requires(...) { ... }> {};
```
* Use the correct path to retrieve action cache
<638ed79f9d/restore (ensuring-proper-restores-and-save-happen-across-the-actions)>
> It is very important to use the same key and path that were used by either actions/cache or actions/cache/save while saving the cache.
* Define the concept of "parser" in X3
Also modernizes the entry points and the most fundamental "x3::parser"
base class.
Includes overhaul on `any_parser` as it operates on iterator/sentinal
now.
Deprecate `any_parser`. The reasoning is described in the comments.
* [X3] Bump C++ version to C++23
* Set correct compilers for C++23
* Avoid recursive instantiation on `unary_parser`
* Update Ubuntu 22.04 -> 24.04
* Specify correct flags for clang++/g++ detection
* Move deprecation warning of `any_parser` to its constructor