Commit Graph

4777 Commits

Author SHA1 Message Date
Nikita Kniazev
4b1b710322 extract_int: Fixed underflow check for (MinOrMax % Base) == 0 2019-02-21 20:21:12 +03:00
Nikita Kniazev
7d3cf1da6d Make extract_int respect std::numeric_limits<T>::digits10 2019-02-21 20:21:12 +03:00
Nikita Kniazev
5ea06d04bd Refactor extract_int test 2019-02-21 02:40:31 +03:00
Nikita Kniazev
53469ae846 V2: Use pre/post/fail functions directly from the transform
This will ensure that the same transformation is used for all operations.
2019-02-19 15:40:44 +03:00
Nikita Kniazev
e9b8f15f05 X3: Replaced make_attribute with direct attribute construction
If the attribute has a general way to be constructed it should already have a
default constructor.
2019-02-18 20:25:53 +03:00
Nikita Kniazev
cd4b0f6e13 V2: Merge make_attribute into transform_attribute
This will allow to simplify transform_attribute (e.g. no need to handle
references anymore) and to ensure the pre/post/fail calls are made to the
same transformation.
2019-02-18 20:25:16 +03:00
Nikita Kniazev
e979d61975 utree: Fixed double conversion
The double conversion `spirit::string -> std::string -> spirit::string` was
happening silently in rules because of `transform_attribute` was returning
`std::string` and implicit constructor in `spirit::string`.

The mistake could be prevented if `spirit::basic_string` constructor from
derived class was explicit, but `utree_cast` uses `is_convertible` while
`is_constructible` is not implemented for C++03 (it is possible, but requires
expression SFINAE support from compiler - N2634).
2019-02-14 15:48:39 +03:00
djowel
981843da24 Merge branch 'more_x3_tutorial_updates' into develop 2019-02-14 11:07:20 +08:00
djowel
12a576967a fix duplicate text 2019-02-14 11:06:42 +08:00
Nikita Kniazev
d002a49a51 CI: Removed VC9 build [skip ci]
https://lists.boost.org/Archives/boost/2018/12/244648.php
2019-02-13 18:51:19 +03:00
Nikita Kniazev
0810e33c69 Remove broken 1.0#INF parser
It was poorly documented and never worked correctly. None of atof, strtof, and
input streams are accepting such values. Fixing it would be a bigger breaking
change than removing it.

Fixes #415, addresses #163 and https://svn.boost.org/trac10/ticket/8699
2019-02-10 02:43:40 +03:00
Nikita Kniazev
147f429673 Karma.Docs: Fixed link to and predicate [skip ci]
Fixes https://svn.boost.org/trac10/ticket/10266
2019-02-09 19:36:59 +03:00
Nikita Kniazev
5d40a5b320 X3: tst: Replace iterator_traits<T>::value_type with auto 2019-02-09 18:37:29 +03:00
Nikita Kniazev
8995e825d0 X3.Examples: rexpr_full: Additional compilation fixes 2019-02-09 17:55:17 +03:00
Nikita Kniazev
f64b28a13d X3.Examples: rexpr_full: Fixed path to test files 2019-02-09 17:55:17 +03:00
Nikita Kniazev
d4c0179fa6 X3: parse_rule attribute must always be of rule::attribute_type&
After #456 `parse_rule` is always called with value of `rule::attribute_type&`
type. By removing attribute type deduction we also will turn any possible bug
in `transform_attribute` from a linkage to compile error.

Fixes #454
2019-02-09 14:57:53 +03:00
Nikita Kniazev
9a84e5290f X3: unused_type: Trim included iostream headers 2019-02-09 05:08:05 +03:00
Nikita Kniazev
b5f1552ec2 X3: Perform attribute transformation before calling parse_rule
This will deal with linking problems when rule attribute type is not the same
as the actual attribute type. It will not harm anyone as the transformation
after parse_rule will just pass-through the attribute because it will be the
same there. It will also do not alter rule_definition parsing so other usages
are still valid.
2019-02-08 21:55:11 +03:00
Patrick Welche
9ae4210138 Remove header which is not needed since d6b5f0d925 2019-02-08 18:20:50 +03:00
Nikita Kniazev
afe763b61e X3: Fixed static assert on parse_rule instantiation
During overload resolution disallowed signature can be instantiated leading
to firing the static assertation and overload resolution failure. I could
just remove it, but do not want to leave unbounded by value overloads;
replacing to not deducing Attribute with specifying a default parameter will
not work because we want to allow `BOOST_SPIRIT_DECLARE` without prior
`BOOST_SPIRIT_DEFINE` - this requires having default parameters in both
declaration and definition and the standard seems to forbid it (GCC - fine,
MSVC - warning, Clang - error).

Reverts #437, fixes #453.
2019-02-08 14:51:35 +03:00
Nikita Kniazev
5663d7d39d X3: Added tests for non-movable and non default constructible types 2019-02-07 14:57:45 +03:00
Nikita Kniazev
4496caff78 X3: Ensure symmetric transforms
Use transform pre/post directly. Cannot do the same for V2 right now because of
make_attribute, it needs asymmetric transformations.
2019-02-07 14:57:45 +03:00
Nikita Kniazev
c915ac4170 X3: rule: Skip attribute synthesization on unused actual attribute
There is a mistake in `make_attribute` trait that leads to synthesization and
immediately throwing out an attribue, so rule context always was unused_type
when actual attribute is unused_type (added test for this case). Instead of
fixing `make_attribute` trait I just completely removed synthesization in
rule by removing `make_attribute` trait usage (the traits could be removed
after a simple change in 'action' parser). I think the change is better
than fixing the trait because it removes excessive attribute default
construction in every rule and makes rule almost free to use.
2019-02-06 16:42:07 +03:00
Xeverous
4b2b443e58 simplify value_initialize trait
removed use of boost::value_initialized which is obsolete post C++11
2019-02-02 02:24:38 +03:00
Nikita Kniazev
a0e5817444 Revert to use <dependency> feature
This was my fault when I did not mark subfeature `propogated` and after fixing
it I did not retest this thing.
2019-01-27 16:52:47 +03:00
Nikita Kniazev
9293cbee5e X3.Tests: Added some rule attribute advertising tests 2019-01-26 17:32:04 +03:00
Nikita Kniazev
a3cf3f2c3e X3: Fixed wrong parse_rule signature instantiation
When a rule has no attribute (leaves `Attribute` template parameter as default)
the `BOOST_SPIRIT_INSTANTIATE` macro instantiates a `parse_rule` helper function
with a wrong signature because `parse`, `phrase_parse`, and `skip_over` pass as
the attribute `unused` variable which deduces to `unused_type const&` type, but
`BOOST_SPIRIT_INSTANTIATE` instantiates `parse_rule` with `unused_type&` type.
2019-01-26 17:32:04 +03:00
Nikita Kniazev
2c85f6a08a Replace mpl::find_if+is_same with find
From `mpl::find` docs:
> `typedef find<s,t>::type i;`
> Semantics: Equivalent to `typedef find_if<s, is_same<_,t> >::type i;`
2019-01-25 21:56:18 +03:00
Nikita Kniazev
93b753ef7e X3: Removed unused Fusion includes 2019-01-23 15:04:20 +03:00
Nikita Kniazev
3338ebcdf9 X3.Examples: rexpr_full: Fixed compilation on windows
`filesystem::path::c_str()` on windows returns `wchar_t` while error_handler
file parameter is of `std::string` type.
2019-01-22 20:09:52 +03:00
Nikita Kniazev
ab280528a3
Merge pull request #439 from Kojoley/x3-remove-sequence-to-plain
X3:  Removed sequence into plain parsing
2019-01-21 14:23:49 +03:00
Nikita Kniazev
d80d32f892 X3: Removed sequence into plain parsing
The possibility to parse `int_ >> int_` into `int` is dangerous and hides the
actual bugs in user parsers (and in Spirit too).
2019-01-21 03:06:53 +03:00
Nikita Kniazev
bd3e56c423 X3: pass_sequence_attribute: Removed unused specialization
The `partition_attribute` never splits a sequence into zero sized parts.

Removing the specialization simplifies an ongoing patch that will forbid
sequence into plain types parsing.
2019-01-21 03:02:16 +03:00
Nikita Kniazev
e46e58f4cd Tests: Added precompiled headers
Not intrusive. Significantly speeds up tests on MSVC (for about 3 times).
Finally solves exceeding build time limits on CI with MSVC compilers.

Did not set up PCH for X3, it is fast as-is (tooks only about 2 minutes).
Repository tests reuse PCH from Qi/Karma tests.
2019-01-21 02:59:45 +03:00
Nikita Kniazev
a36077efbd X3.Tests: extract_int: Workaround GCC < 7 bug
[GCC prior to 7 version][1] does not implement [CWG 374][2] which is C++11.

[1]: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=56480
[2]: http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_defects.html#374
2019-01-13 23:03:26 +03:00
Xeverous
0a22620d25 Fix unused parameter warnings in position_tagged 2019-01-13 17:53:38 +03:00
Nikita Kniazev
2859693c7f
Merge pull request #429 from Kojoley/extract_int-custom-ints-support
extract_int: Custom integers support
2019-01-13 15:20:53 +03:00
Nikita Kniazev
65157bae07 extract_int: Custom integers support
It will allow to test `extract_int` properly.

Replacing `boost::integer_traits` with `std::numeric_limits` will not hurt
performance because even MSVC 9/GCC 4.1/Clang 3.0 folds `min`/`max` calls
to a constant at compile time and since C++11 they are even constexpr.
2019-01-13 01:12:09 +03:00
Nikita Kniazev
6faa709605 Unbounded types can't be checked for overflow
Changed default `check_overflow` trait implementation to be `is_bounded`
as it also covers float types and user data types.
2019-01-13 01:11:50 +03:00
Nikita Kniazev
dff85b5dbb CI: Improved git submodules depth patch 2019-01-12 01:11:26 +03:00
Nikita Kniazev
d15a26eb13 X3.Examples: Context type has changed due to #239 2019-01-08 19:05:08 +03:00
Nikita Kniazev
c8c42c006a Classic.Tests: Boost.System header only follow-up 2019-01-07 22:50:50 +03:00
Nikita Kniazev
1f24a5a04b X3.Tests: Removed Phoenix includes 2018-12-31 03:14:10 +03:00
Nikita Kniazev
c6d5c9c3d9 X3.Tests: Removed unused using declarations 2018-12-31 00:05:26 +03:00
Nikita Kniazev
4583a4b708 Boost.System is header only since 1.69 2018-12-30 17:06:19 +03:00
Nikita Kniazev
085f90f4ed
Removed unused private header. Closes #433
The `boost/spirit/home/support/detail/lexer/serialise.hpp` header is a private header
and is not used anywhere in Spirit or Boost. No one should be affected by the change.
2018-12-30 17:00:43 +03:00
Nikita Kniazev
98f8d86a12
Merge pull request #432 from Kojoley/remove-obsolete-detail-iterator
The `boost/detail/iterator.hpp` header is obsolete
2018-12-30 14:35:00 +03:00
Nikita Kniazev
da91db5a9c The boost/detail/iterator.hpp header is obsolete
Both `iterator_traits` and `distance` in `boost::detail` namespace are just
aliases from `std` namespace.
2018-12-29 17:46:33 +03:00
Nikita Kniazev
c87e8772b4
Merge pull request #431 from Kojoley/reduce-lexical_cast-includes
Reduce lexical_cast includes
2018-12-28 14:13:17 +03:00
Nikita Kniazev
54ca101440 Removed unneeded lexical_cast usages 2018-12-27 20:54:49 +03:00