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

1057 Commits

Author SHA1 Message Date
Sergiu Deitsch
b80d6489c5 Karma: fix broken real_generator output for long double
Eliminate Boost 1.90.0 regression introduced in e6fbdf615b.
2025-12-20 15:54:15 +01:00
joaquintides
f786c31e1b added compliance test for boost::spirit::lex::lexertl::lexer::iterator_type 2025-11-29 15:18:53 +01:00
joaquintides
662b484c5e tested compliance by all (most?) iterators provided 2025-11-28 20:36:27 +01:00
Xeverous
a6c0b0bb6a X3: rollback iterator when rule fails to parse
This commit adjusts work of commit 2db3fde.
It corrected error_handler which should not skip whitespaces but
introduced a regression where handlers returning fail were still
moving the iterator forward. This commit adds iterator rollback
and synchronizes rule's and guard's iterators behavior.
2025-10-06 11:55:52 +02:00
Nana Sakisaka
d88f114559 Revert "Define the concept of "parser" in X3 (#807)"
This reverts commit d21af8b48d.
2025-09-13 08:57:11 +09:00
Nana Sakisaka
ec681a2484 Revert "Merge pull request #808 from saki7/refine-ci-cpp23"
This reverts commit f66350f9dc, reversing
changes made to d21af8b48d.
2025-09-13 08:57:11 +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
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
33d11752b6 Modernize x3::skip 2025-09-10 19:03:51 +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
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
e758874031 Modernize x3::omit 2025-09-10 10:01:45 +09:00
Nana Sakisaka
e3c1389e9a Modernize x3::matches 2025-09-10 09:25:23 +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
c28805b591 Modernize char/string, use X3's own char_encoding 2025-09-08 10:02:43 +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
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
3ed39f1f23 Harmless commit to make sure CI is working on direct push 2025-09-05 13:40:13 +09:00
Nana Sakisaka
30f94f87a0 Remove obsolete tests 2025-09-05 01:31:27 +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
sigbjorn
e6fbdf615b Adding proposed fix, with tests, resolves #792 (#793)
Co-authored-by: Nana Sakisaka <1901813+saki7@users.noreply.github.com>
2025-05-09 16:43:41 +09:00
Rene Rivera
1bbea78003 Sync from upstream. 2024-08-20 09:56:54 -05:00
Nana Sakisaka
d9b53fedb0 Fix ODR violation, add tests 2024-08-13 20:02:38 +09:00
Nana Sakisaka
88d9987167 Implement non-throwing version of x3::expect 2024-08-12 17:18:52 +09:00
Rene Rivera
d85a0f485a Change math dep real target math/tr1. 2024-08-11 09:23:25 -05:00
Rene Rivera
32d0535ace Update build deps. 2024-08-08 23:15:28 -05:00
Rene Rivera
c714c24aa2 Add missing import-search for cconfig/predef checks. 2024-05-04 23:32:40 -05:00
Rene Rivera
c31939d691 Make the library modular usable. 2024-03-11 08:38:16 -05:00
Nikita Kniazev
43112c3f05 X3: Constrain operator>
It might be instantiated for user types inherited from classes in x3 namespace.
2024-02-24 02:10:26 +03:00
Nikita Kniazev
d4d4b8e9d8 Tests: Boost.Math drops MSVC 14.0 support 2024-02-23 07:42:12 +03:00
Nikita Kniazev
32fb6f6899 V2.Tests: Revise poorly named tests
Looking by the commit history they should not have been using classic iterators
2023-04-03 01:26:26 +03:00
Nikita Kniazev
94f4704f40 X3.Tests: expect: actually test exception info 2023-03-21 23:58:49 +03:00