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

5177 Commits

Author SHA1 Message Date
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
Ta'am
328d940c37 Document warning for incorrect floating-point values on Qi/Karma (#693)
* Qi double parser IEEE 754 compliance warning

* Document warning for incorrect floating-point values on Qi/Karma

---------

Co-authored-by: Nana Sakisaka <1901813+saki7@users.noreply.github.com>
2025-05-09 20:36:12 +09:00
ZHUO Qiang
8fac21bea3 workaround for #750 (#751)
workaroud #750 by replacing `std::endl` with `'\n'`

Co-authored-by: Nana Sakisaka <1901813+saki7@users.noreply.github.com>
2025-05-09 18:51:56 +09:00
chrisse74
1054bd0332 Removed shadow-field warnings. (#752)
Co-authored-by: Nana Sakisaka <1901813+saki7@users.noreply.github.com>
2025-05-09 18:43:59 +09:00
Robert Adam
ba53544ac9 Update syntax examples to parser operator docs (#770)
Fixes #769

Co-authored-by: Nana Sakisaka <1901813+saki7@users.noreply.github.com>
2025-05-09 16:45:49 +09:00
Adem Budak
b59f934da6 Fix typo: 'implementation' (#791)
Co-authored-by: Nana Sakisaka <1901813+saki7@users.noreply.github.com>
2025-05-09 16:44:51 +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
Nana Sakisaka
0452c7b2c5 Merge pull request #803 from boostorg/fix-ci-for-maintenance
Turn off -Werror in order to deal with unfixable upstream warnings.
Also includes some QoL fixes on the CI configuration.
2025-05-09 16:22:51 +09:00
Nana Sakisaka
fbf145b124 Omit manpage generation 2025-05-09 16:07:37 +09:00
Nana Sakisaka
d2211c51d4 Make the job names shorter to make it more distinguishable 2025-05-09 15:54:30 +09:00
Nana Sakisaka
f082c4b198 Make -Werror off, as it can't handle upstream warnings properly
Specifically, container and math is emitting warnings that makes
spirit unmaintainable since all tests fail
2025-05-09 15:38:02 +09:00
Joel de Guzman
c60664c4b3 Merge pull request #801 from boostorg/pr/harmonize-phoenix-limit
Change PHOENIX_LIMIT definition in classic/phoenix/tuples.hpp...
2025-05-08 07:24:40 +08:00
Peter Dimov
a76c6499ee Change PHOENIX_LIMIT definition in classic/phoenix/tuples.hpp to match the one in classic/attribute.hpp. Fixes #800. 2025-05-07 12:48:38 +03:00