2
0
mirror of https://github.com/boostorg/spirit.git synced 2026-01-19 04:42:11 +00:00
Commit Graph

5139 Commits

Author SHA1 Message Date
Nana Sakisaka
49753e2515 Revert "Modernize x3::with (#829)"
This reverts commit e1973fcb31.
2025-09-13 08:56:51 +09:00
Nana Sakisaka
e1973fcb31 Modernize x3::with (#829)
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&`
2025-09-11 20:54:37 +09:00
Nana Sakisaka
4cd604abf6 Merge pull request #827 from saki7/modernize-skip
Modernize `x3::skip`

Use concepts in `x3::skip`.
Make `x3::skip` a CPO that inhibits ADL.
`x3::reskip[...]`: new API that has the same effect as `x3::skip[...]`.
`x3::skip[...]`: deprecated in favor of `x3::reskip[...]`.
2025-09-11 15:50:52 +09:00
Nana Sakisaka
33d11752b6 Modernize x3::skip 2025-09-10 19:03:51 +09:00
Nana Sakisaka
70f968ef6c Merge pull request #820 from saki7/modernize-expect
Use concepts in `x3::expect`. It is also a CPO that inhibits ADL.
2025-09-10 18:16:33 +09:00
Nana Sakisaka
f52dae0d2c Modernize x3::expect 2025-09-10 18:08:51 +09:00
Nana Sakisaka
b6acdc57d3 Merge pull request #817 from saki7/modernize-char-string
[X3] Modernize char/string/symbols, make X3 totally self-contained
2025-09-10 18:06:31 +09:00
Nana Sakisaka
1ef37da85d Merge pull request #826 from saki7/modernize-repeat
Use concepts in `x3::repeat`.
`x3::repeat` is now a CPO that inhibits ADL.
`x3::inf` is deprecated regarding overly generic name; use `x3::repeat_inf` instead.

`x3::repeat[p]` is deprecated since it has the exact same meaning as `*p`. It is
generally discouraged to provide multiple ways to achieve same the
functionality in modern C++ library design.
2025-09-10 11:50:50 +09:00
Nana Sakisaka
0fd058fdd7 Modernize x3::repeat 2025-09-10 11:37:35 +09:00
Nana Sakisaka
b1111dc4af Merge pull request #825 from saki7/modernize-raw
Use concepts in `x3::raw`. It is now a CPO that inhibits ADL.
2025-09-10 10:52:48 +09:00
Nana Sakisaka
b232c5abc0 Modernize x3::raw 2025-09-10 10:41:59 +09:00
Nana Sakisaka
a80d412b0e Merge pull request #824 from saki7/modernize-omit
Use concepts in `x3::omit`. It is now a CPO that inhibits ADL.
2025-09-10 10:25:22 +09:00
Nana Sakisaka
e758874031 Modernize x3::omit 2025-09-10 10:01:45 +09:00
Nana Sakisaka
495f936af2 Merge pull request #822 from saki7/modernize-matches
Use concepts in `x3::matches`. It is now a CPO that inhibits ADL.
2025-09-10 09:51:38 +09:00
Nana Sakisaka
e3c1389e9a Modernize x3::matches 2025-09-10 09:25:23 +09:00
Nana Sakisaka
b86852dd88 Merge pull request #821 from saki7/modernize-lexeme
Modernize `x3::lexeme` and `x3::skip_over`

Use concepts in `x3::lexeme` and `x3::skip_over`. `x3::lexeme` is now a CPO that inhibits ADL.
2025-09-10 09:13:56 +09:00
Nana Sakisaka
53d8947011 Modernize x3::lexeme and x3::skip_over 2025-09-10 09:04:33 +09:00
Nana Sakisaka
b389b1ce56 Modernize x3::confix (#819)
* Modernize `x3::confix`

* Properly declare `cpos` as inline namespace
2025-09-10 08:43:11 +09:00
Nana Sakisaka
3df9ca3788 Modernize x3::action (#815)
`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.
2025-09-10 07:55:14 +09:00
Nana Sakisaka
ff730cb233 Suppress too much deprecation warning
[[deprecated]] is already applied on many functions; avoid adding
it to the namespace.
2025-09-08 11:21:04 +09:00
Nana Sakisaka
8527063f88 Fix symbols error in GCC 2025-09-08 11:07:03 +09:00
Nana Sakisaka
c28805b591 Modernize char/string, use X3's own char_encoding 2025-09-08 10:02:43 +09:00
Nana Sakisaka
5fb8252115 Modernize basic_chset and char range related components 2025-09-08 08:50:20 +09:00
Nana Sakisaka
572da40062 Modernize char_encoding 2025-09-08 08:38:00 +09:00
Nana Sakisaka
b9d3fe6d73 Copy basic_chset to X3's own subdirectory 2025-09-08 07:26:45 +09:00
Nana Sakisaka
4092366b35 Copy char_encoding to X3's own subdirectory 2025-09-08 07:21:23 +09:00
Nana Sakisaka
bae393d159 Merge pull request #813 from saki7/modernize-rule-parser
Modernize `rule`, `guard`, `on_error` and `on_success`
2025-09-08 02:26:47 +09:00
Nana Sakisaka
2c0ec263f5 doc: Reflect the correct signature of error handlers 2025-09-07 07:37:39 +09:00
Nana Sakisaka
47945d1e81 Modernize rule, guard, on_error and on_success
`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.
2025-09-07 07:29:17 +09:00
Nana Sakisaka
d2bad1a875 Rename detail/rule.hpp to rule_parser.hpp 2025-09-07 06:16:40 +09:00
Nana Sakisaka
c64a9146fc Use concepts for attribute category overload resolution (#812)
* 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.
2025-09-07 04:55:57 +09:00
Nana Sakisaka
52c7e0497e Fix typo in README
This also checks the CI is safely bypassed
2025-09-05 13:50:37 +09:00
Nana Sakisaka
3ed39f1f23 Harmless commit to make sure CI is working on direct push 2025-09-05 13:40:13 +09:00
Nana Sakisaka
af360dcb9b Skip the "build" job for empty changes case 2025-09-05 13:25:49 +09:00
Nana Sakisaka
65208fb39d Add CI badge 2025-09-05 13:18:02 +09:00
Nana Sakisaka
f66350f9dc Merge pull request #808 from saki7/refine-ci-cpp23
Refine CI for C++23 era
2025-09-05 13:03:13 +09:00
Nana Sakisaka
e332f16354 Don't cache .git in CI 2025-09-05 12:54:38 +09:00
Nana Sakisaka
c9b7954c44 Remove useless debug output in CI 2025-09-05 12:46:02 +09:00
Nana Sakisaka
7a84f062ac Update supported version info on README 2025-09-05 12:42:10 +09:00
Nana Sakisaka
ba985e0ca2 Fix "The syntax of the command is incorrect." 2025-09-05 12:34:21 +09:00
Nana Sakisaka
acabef90f7 Update README to reflect latest version requirements
closes #796
2025-09-05 12:18:27 +09:00
Nana Sakisaka
d7f5026f65 Add Windows support on GHA 2025-09-05 12:02:30 +09:00
Nana Sakisaka
da629c98fe Fix lex build on clang-22 2025-09-05 09:08:05 +09:00
Nana Sakisaka
efd9b3f637 Tweak job name 2025-09-05 09:03:51 +09:00
Nana Sakisaka
e5aad7844b Redesign workflow 2025-09-05 08:53:52 +09:00
Nana Sakisaka
e44248e59f Remove obsolete tests 2025-09-05 02:03:07 +09:00
Nana Sakisaka
efe0f832a2 Add /build*/ to gitignore 2025-09-05 01:32:08 +09:00
Nana Sakisaka
30f94f87a0 Remove obsolete tests 2025-09-05 01:31:27 +09:00
Nana Sakisaka
e60afc5f2c Remove obsolete CI (Windows CI will be added later on GHA) 2025-09-05 01:15:11 +09:00
Nana Sakisaka
d21af8b48d Define the concept of "parser" in X3 (#807)
* 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
2025-09-05 00:59:29 +09:00