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

5154 Commits

Author SHA1 Message Date
Nana Sakisaka
a0c9105839 Revert "Skip the "build" job for empty changes case"
This reverts commit af360dcb9b.
2025-09-13 08:57:09 +09:00
Nana Sakisaka
795d61688a Revert "Harmless commit to make sure CI is working on direct push"
This reverts commit 3ed39f1f23.
2025-09-13 08:57:08 +09:00
Nana Sakisaka
96b81d3e5a Revert "Fix typo in README"
This reverts commit 52c7e0497e.
2025-09-13 08:57:07 +09:00
Nana Sakisaka
63fabece48 Revert "Use concepts for attribute category overload resolution (#812)"
This reverts commit c64a9146fc.
2025-09-13 08:57:06 +09:00
Nana Sakisaka
e4d3fce09f Revert "Merge pull request #813 from saki7/modernize-rule-parser"
This reverts commit bae393d159, reversing
changes made to c64a9146fc.
2025-09-13 08:57:05 +09:00
Nana Sakisaka
569c52220e Revert "Modernize x3::action (#815)"
This reverts commit 3df9ca3788.
2025-09-13 08:57:05 +09:00
Nana Sakisaka
c41c9aec95 Revert "Modernize x3::confix (#819)"
This reverts commit b389b1ce56.
2025-09-13 08:57:04 +09:00
Nana Sakisaka
bc3138da91 Revert "Merge pull request #821 from saki7/modernize-lexeme"
This reverts commit b86852dd88, reversing
changes made to b389b1ce56.
2025-09-13 08:57:03 +09:00
Nana Sakisaka
26d6ec1a64 Revert "Merge pull request #822 from saki7/modernize-matches"
This reverts commit 495f936af2, reversing
changes made to b86852dd88.
2025-09-13 08:57:02 +09:00
Nana Sakisaka
5d52405c56 Revert "Merge pull request #824 from saki7/modernize-omit"
This reverts commit a80d412b0e, reversing
changes made to 495f936af2.
2025-09-13 08:57:01 +09:00
Nana Sakisaka
069d2a0162 Revert "Merge pull request #825 from saki7/modernize-raw"
This reverts commit b1111dc4af, reversing
changes made to a80d412b0e.
2025-09-13 08:57:00 +09:00
Nana Sakisaka
6218dcc51e Revert "Merge pull request #826 from saki7/modernize-repeat"
This reverts commit 1ef37da85d, reversing
changes made to b1111dc4af.
2025-09-13 08:56:59 +09:00
Nana Sakisaka
14dfeaffdc Revert "Merge pull request #817 from saki7/modernize-char-string"
This reverts commit b6acdc57d3, reversing
changes made to 1ef37da85d.
2025-09-13 08:56:57 +09:00
Nana Sakisaka
385a9c3f06 Revert "Merge pull request #820 from saki7/modernize-expect"
This reverts commit 70f968ef6c, reversing
changes made to b6acdc57d3.
2025-09-13 08:56:56 +09:00
Nana Sakisaka
ac6ed01642 Revert "Merge pull request #827 from saki7/modernize-skip"
This reverts commit 4cd604abf6, reversing
changes made to 70f968ef6c.
2025-09-13 08:56:54 +09:00
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