2
0
mirror of https://github.com/boostorg/spirit.git synced 2026-01-19 16:52:10 +00:00

15 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
0abca50754 X3: Remove unneeded reserve before insert
Every sane container implementation will make preallocation if possible,
calling `reserve` ourselves increases code size and creates a dead branch
inside `insert` which cannot be removed by compiler.
2020-06-10 14:43:31 +03:00
Nikita Kniazev
036993b086 X3: Infinity recursion in is_substitute
Match same arguments earlier to break infinity recursion
2020-06-06 21:38:24 +03:00
Nikita Kniazev
63a16b76dd X3.Tests: Fixed extra semicolon warnings 2019-03-01 01:12:01 +03:00
Nikita Kniazev
660d8ac3c1 X3.Tests: Fix odd temporary attribute creation 2019-02-26 21:23:43 +03:00
octopus-prime
74f67517c3 Bugfix and tests for issue #287 "x3 cannot parse into associative
containers anymore".
2017-11-23 15:26:28 +01:00
mgresens
de81dc44dd Using boost TTI library to replace hand-written TTI code. 2016-04-01 13:51:59 +02:00
Joel de Guzman
378142659c Some cleanup 2016-03-30 06:22:47 +08:00
Joel de Guzman
76c57b6005 call c.insert(iter, f, l) or c.inser(f, l) as appropriate depending on container type. 2016-03-28 11:56:21 +08:00
octopus-prime
81c37ba431 Cleaned up tests. 2016-01-30 11:11:07 +01:00
octopus-prime
e94e7dcc12 Added static asserts for testing has_reserve_method of common
containers.
2016-01-28 09:36:35 +01:00
octopus-prime
dd80f32e5c Renamed test_container_support() to test_sequence_support(). 2016-01-26 20:10:54 +01:00
octopus-prime
2cd5e66cbf Renamed test.
Added tests for:
<map>
<unordered_map>
<boost/unordered_map.hpp>
<vector>
<list>
<deque>
<set>
<unordered_set>
<boost/unordered_set.hpp>
<string>
2016-01-26 19:55:11 +01:00