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

11 Commits

Author SHA1 Message Date
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
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
Nikita Kniazev
6a7c758376 Switch to the new location of lightweight test
Old location had been deprecated for a long time already.
2021-08-23 21:45:17 +03:00
Nikita Kniazev
2db3fde0d0 X3: Remove forced iterator rollback in rule
Removes inconsistency when a parser part is factorized into a rule.

Fixes regression introduced in #670.
2021-06-03 16:46:12 +03:00
Nikita Kniazev
0e15dd13bb Fix MSVC C4456 2021-05-17 03:01:58 +03:00
Nikita Kniazev
e30073e5be X3: error_handler should not skip whitespaces
A skipper does this already and Spirit usually does not roll back skipper work. When there is no skipper, skipping whitespaces is absolutely wrong thing to do. For example, an error points to an end of the word where an additional input is expected, but there are whitespaces after it.

The `skip_whitespace`/`skip_non_whitespace` were removed since they are not used anymore, and because they are also could trigger UB on a particular input due to unsafe `std::isspace` usage.
2021-04-26 14:49:49 +03:00
Rudolf Lovrenčić
487030e495 X3: Fix error_handler::get_line_start (#669)
Now it returns an iterator to the actual start of the line.

Co-authored-by: Nikita Kniazev <nok.raven@gmail.com>
2021-04-25 02:24:13 +03:00
Nikita Kniazev
63a16b76dd X3.Tests: Fixed extra semicolon warnings 2019-03-01 01:12:01 +03:00
Nikita Kniazev
666fed425e X3.Tests: Fix unused argument warnings 2019-03-01 01:11:59 +03:00
octopus-prime
868689ff40 error_handler test msvc-14.0 2017-12-05 00:23:33 +01:00
octopus-prime
fa2bfb1c52 Added tests for error_handler 2017-12-04 12:56:43 +01:00