Commit Graph

901 Commits

Author SHA1 Message Date
Nikita Kniazev
92596fe02e Fix extract_int test std::pow problems 2019-02-22 04:26:47 +03:00
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
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
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
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
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
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
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
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
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
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
e07ce69363 Removed unused lexical_cast includes 2018-12-27 19:36:51 +03:00
Nikita Kniazev
865a6a3de4 X3.Tests: Added variable templates requirement
Also updated the readme, as Clang 3.5 does not support variable templates
(it also has some bogus warnings and broken Fusion map support).
2018-11-26 18:39:01 +03:00
Nikita Kniazev
304a10ff33
Karma.Tests: real.hpp: Fixed typo in comments
https://svn.boost.org/trac10/ticket/8440
2018-11-22 18:27:58 +03:00
Nikita Kniazev
3fbde9c195 to_utf8: Fixed wchar_t handling on Windows
Spirit were assuming that wchar_t is 32-bit and the content is UCS-4.
It is wrong, the actual representation is implementation defined [lex.ccon]/6.
However, on most Unix platforms this assumption is valid and gives the
expected outcome, but on Windows wchar_t is 16-bit and the content is UTF-16.
2018-10-28 17:43:05 +03:00
Nikita Kniazev
5c62f8baf3 V2: Fixed transform_attribute ambiguity
Domain-agnostic class template partial specializations and
type agnostic domain partial specializations are ambious.
To resolve the ambiguity type agnostic domain partial
specializations are dispatched via intermediate type.
2018-10-22 01:19:27 +03:00
Nikita Kniazev
5e4ab36170 Tests: Include less headers 2018-10-01 02:16:04 +03:00
Nikita Kniazev
b3ae790e2b Use endian macros from Predef
The `boost/detail/endian.hpp` header is deprecated.
2018-09-15 18:19:49 +03:00
Nikita Kniazev
1d9aa696bf Karma: Fixed use after scope bug if ADT getter returns by value
The `extract_from_attribute` returns a reference to a temporary
value produced by calling Fusion ADT adapted sequence getter that
returns by value.

Was reported 6 years ago https://svn.boost.org/trac10/ticket/6126
2018-03-15 18:50:17 +03:00
Nikita Kniazev
02c3c30077 ts_real_policies: Parse directly into output parameter
There is no need to initialize accumulator with zero value before the first
call to `parse`, and to use a temporary.
2018-03-10 19:22:28 +03:00
Nikita Kniazev
dc9e23e9f5 ts_real_policies: Output parameter is of actual accumulator type 2018-03-10 19:12:28 +03:00
Nikita Kniazev
e472c0536f ts_real_policies: One iterator copy less optimization 2018-03-10 19:09:41 +03:00
Nikita Kniazev
1a72c27306 ts_real_policies: Fixed small numbers parsing
Numbers in range (-1000.0, 1000.0) has only one segment (no thousands delimiter),
and are parsed in `if` statement expression.
2018-03-10 19:06:11 +03:00
Nikita Kniazev
fac9dfae9e X3: Pass container attribute through sequence 2018-02-28 23:21:31 +03:00
Nikita Kniazev
49587ff7a0
Merge pull request #340 from Kojoley/x3-deref-view-instead-of-unwrap-seq
X3: Dereference a single item view instead of unwrapping sequence
2017-12-30 02:50:03 +03:00
Nikita Kniazev
0887e25568 X3: Check passed attribute type 2017-12-29 20:44:36 +03:00
Nikita Kniazev
ddcdafbe95
Merge pull request #344 from Kojoley/tests-lex-token_moretypes-use-optional
Lex.Tests: token_moretypes: Use optional
2017-12-27 19:08:13 +03:00
Nikita Kniazev
160dee1799 Do not use extended initializer lists 2017-12-26 16:25:54 +03:00
Nikita Kniazev
2d2c05c1ae Qi: Mirror char_range boundaries tests from #147 2017-12-26 15:28:14 +03:00
Nikita Kniazev
a9eab0ef78 Lex.Tests: token_moretypes: Use optional
Simplifies values declaration and fixes warnings.
2017-12-26 15:27:34 +03:00
Nikita Kniazev
3ae9e29184
Merge pull request #152 from vogelsgesang/fix_expect_container_parsing
X3: Fix expect directive's handling of container attributes
2017-12-23 03:12:39 +03:00
Nikita Kniazev
72c049499f X3: Return back omit tests 2017-12-22 02:10:02 +03:00
Nikita Kniazev
9bdbf6bd2b X3: Fixed iterator move_to to single item sequence
This affects lazy attribute constructing parsers, which exposes not an actual
attribute, but a pair of iterators (like `string` or `attr("...")`).
2017-12-21 01:55:51 +03:00
Nikita Kniazev
fa771b62d6
Merge pull request #330 from Kojoley/x3-reenable-fusion_map-support
X3: Reenable fusion::map support
2017-12-18 18:51:48 +03:00
Nikita Kniazev
62d604603c
Merge pull request #331 from Kojoley/boost-foreach
Remove unused `boost/foreach.hpp` includes
2017-12-18 18:51:32 +03:00
Nikita Kniazev
7fdc4d2460
Merge pull request #333 from Kojoley/fix-karma-binary2-overflow
Karma.Tests: Fixed overflow in binary tests
2017-12-18 18:51:02 +03:00
Mike Gresens
9a562de232
Merge pull request #328 from octopus-prime/fix_for_trac_5983
Stack overflow with Karma floating point generator
2017-12-18 12:03:25 +01:00
Nikita Kniazev
2104d5f063 Karma.Tests: Fixed overflow in binary tests 2017-12-18 00:10:16 +03:00
Nikita Kniazev
11a36a0ce2 Remove unused boost/foreach.hpp includes 2017-12-17 20:14:56 +03:00
octopus-prime
cf769b145f Trigger appveyor 2017-12-17 13:14:04 +01:00
Nikita Kniazev
c5411ad237 X3: Reenable fusion::map support
`build_container<char>` specialization was added in 84c0c075 (#5)
2017-12-17 01:02:27 +03:00
Nikita Kniazev
602a406c12 Tests: char1: Fixed typo leading to wchar_t to char truncation warning 2017-12-16 22:11:37 +03:00
Mike Gresens
60031eb779 Fix container traits for msvc (#318)
- Fixes #298 and is based on 45902cbb4e provided by @Kojoley 
- Added container_support.cpp to x3 test suite again
2017-12-16 22:10:00 +03:00
octopus-prime
6a4547ca43 Added fix and test from trac # 5983 2017-12-15 11:29:46 +01:00
Nikita Kniazev
d526cd1931 Use <c++-template-depth> feature 2017-12-15 01:12:06 +03:00
Joel de Guzman
b10e4a477b
Merge pull request #320 from think-cell/thinkcell_iterator_check
ForwardIterator -> ReadableIteratorConcept & ForwardTraversalConcept
2017-12-11 08:02:09 +08:00
Nikita Kniazev
109253ac8c
Merge pull request #319 from Kojoley/fix-qi-permutations-always-initializes-optionals
Qi: Permutations parser always initializes optionals
2017-12-08 19:46:40 +03:00
Han Wang
766cc4c9b7 ForwardIterator -> ReadableIteratorConcept & ForwardTraversalConcept
The concept of ForwardIterator is flawed because it mixed 2 sets of concepts (value access and traversal) into 1 package.

http://www.boost.org/doc/libs/1_65_1/libs/iterator/doc/new-iter-concepts.html

It requires value_type (const)& as return type when dereference is applied, which is not mandatory in spirit parsing. A return type which is convertible to value_type is good enough. ReadableIteratorConcept and ForwardTraversalConcept should be what we need for the iterator check.

For example, the iterator of the range returned by boost::adaptors::transform(std::string, func) is normally not a ForwardIterator. But it fulfills ReadableIteratorConcept and ForwardTraversalConcept and should be able to be parsed by spirit.
2017-12-07 17:25:37 +01:00
Nikita Kniazev
3f18a6e99f Qi: Permutations parser always initializes optionals
Closes https://svn.boost.org/trac10/ticket/12473

Optional parser never fails so `attr = val;` always triggers and initializes
the `attr` value. The special case for optional attributes could be safely
removed as any underlying parser must already correctly handle optionals.
2017-12-07 17:59:04 +03:00
octopus-prime
cb2750792e Test for trac ticket 12928 "x3 cannot synthesize attribute of type
boost::iterator_range in a sequence parser"
2017-12-06 19:28:04 +01:00
Nikita Kniazev
3a2f074c2b Qi.Tests: grammar_fail, rule_fail: Fixed past-the-end pointer problem 2017-12-06 16:05:06 +03:00
Nikita Kniazev
5f93ee81d9 Qi.Tests: rule_fail: Fixed ambiguous symbol 'char_'
..\libs\spirit\test\qi\rule_fail.cpp(28): error C2872: 'char_': ambiguous symbol
boost/spirit/home/support/common_terminals.hpp(235): note: could be 'const boost::spirit::ascii::char_type boost::spirit::ascii::char_'
boost/spirit/home/support/common_terminals.hpp(237): note: or       'const boost::spirit::standard::char_type boost::spirit::standard::char_'
2017-12-06 16:05:06 +03:00
Mike Gresens
5a720737af
Merge pull request #312 from octopus-prime/develop
error_handler test msvc-14.0
2017-12-05 09:38:27 +01:00
octopus-prime
868689ff40 error_handler test msvc-14.0 2017-12-05 00:23:33 +01:00
octopus-prime
b6fa1404fa Added missing dependency to filesystem for error_handler test. 2017-12-04 17:46:52 +01:00
Mike Gresens
b476a28af7
Merge pull request #304 from octopus-prime/line_pos_iterator_fix3
Line pos iterator fix3
2017-12-04 14:01:50 +01:00
octopus-prime
fa2bfb1c52 Added tests for error_handler 2017-12-04 12:56:43 +01:00
Mike Gresens
5ec71cfd33
Merge pull request #307 from octopus-prime/optional_attribute
optional_attribute
2017-12-04 11:37:51 +01:00
Nikita Kniazev
8e343697ad X3: Workaround VS2015 aliased namespace in lambda bug 2017-12-02 18:20:06 +03:00
octopus-prime
c3a83ce083 optional_attribute 2017-12-01 19:10:20 +01:00
octopus-prime
0dd6e531c8 Cleaned up 2017-12-01 15:05:44 +01:00
octopus-prime
646bce6ce7 Merged and added more tests. 2017-12-01 13:04:36 +01:00
Nikita Kniazev
9fc87a8d21
Merge pull request #297 from think-cell/thinkcell_uint_parser_overflow
fix uint_parser<T(signed)> overflow problem
2017-12-01 13:43:43 +03:00
Nikita Kniazev
80414bc688 fix qi::uint_parser<T(signed)> overflow problem 2017-12-01 03:36:33 +03:00
Nikita Kniazev
0c27beaa38 X3.Tests: Add c++14 feature checks 2017-11-28 19:33:28 +03:00
Nikita Kniazev
596079647b
Tests.Lex: Fixed dependencies race
It looks like `<implicit-dependency>` does not actually work.
2017-11-28 03:54:44 +03:00
Nikita Kniazev
0917fca9fd Tests: Improve tests
- Split Spirit v2 tests
  - Readd missing v2 tests
  - Run X3 tests
  - Remove `-p3` suffix
  - Use `<c++-template-depth>`
  - Automatic adding of subproject name prefix
  - Flatten tests declaration
2017-11-28 03:10:20 +03:00
Han Wang
b8b82630ac fix x3::uint_parser<T(signed)> overflow problem
According to spirit document,

  "All numeric parsers check for overflow conditions based on the type T the corresponding uint_parser<> has been instantiated with. If the parsed number overflows this type the parsing fails. Please be aware that the overflow check is not based on the type of the supplied attribute but solely depends on the template parameter T."

the valid input range of x3::uint_parser<T> should be 0 - std::numeric_limits<T>::max(). However, the current implementation takes values from std::numeric_limits<T>::max()+1 - std::numeric_limits<std::make_unsigned_t<T>>::max() also as valid input.
2017-11-27 17:47:10 +01:00
Nikita Kniazev
9c2d6dec93
Revert "Split Spirit v2 tests" 2017-11-26 14:45:39 +03:00
Nikita Kniazev
5e2c3f4f9a Qi.Tests: grammar_fail, rule_fail: Fixed unused variable warnings 2017-11-25 19:01:04 +03:00
Nikita Kniazev
cc9e4a83cb
Merge pull request #290 from Kojoley/split-tests
Split Spirit v2 tests
2017-11-25 17:17:32 +03:00
Nikita Kniazev
a21b0b33f5 Split Spirit v2 tests 2017-11-25 14:40:54 +03:00
octopus-prime
bc2cf3112b Enabled tests for container support 2017-11-24 09:01:56 +01: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
Nikita Kniazev
5ba6bd8f90
Merge pull request #285 from Kojoley/fix-warnings
Fixed bunch of warnings
2017-11-21 19:56:16 +03:00
Nikita Kniazev
a4c9940658 X3.Tests: symbol3: Extra semicolon warning 2017-11-21 19:49:37 +03:00
Nikita Kniazev
dd95a89c8b X3.Tests: expect: Suppress operator precedence warnings 2017-11-21 19:49:37 +03:00
Nikita Kniazev
39618ddced X3.Tests: binary: Fixed unused variable warnings 2017-11-21 19:49:37 +03:00
Nikita Kniazev
519f9db94b Qi.Tests: real: Fixed accumulator type 2017-11-21 19:49:37 +03:00
Nikita Kniazev
625fbc6cd9 Karma.Tests: regression_real_policy_sign: Fixed unused parameter warning 2017-11-21 19:49:35 +03:00
Nikita Kniazev
d06cc5945b Karma.Tests: regression_real_scientific: Fixed semicolon after main function 2017-11-21 19:49:35 +03:00
Nikita Kniazev
4810f02271 Fixed semicolon after BOOST_FUSION_ADAPT_* 2017-11-21 19:49:35 +03:00
Nikita Kniazev
ee900333b4 Lex.Tests: set_token_value: Fixed type conversion warning 2017-11-21 19:49:35 +03:00
Nikita Kniazev
7310d850fc Support.Tests: regression_multi_pass_position_iterator: Fixed MSVC 9 compilation
Maybe will fix and MSVC 8 too. The fix found accidentally.
2017-11-16 02:50:02 +03:00
Nikita Kniazev
2f68bc829f Qi.Tests: uint1: Fixed uint8_t usage
Fixes compilation problem on MSVC 8/9
2017-11-15 22:16:23 +03:00
Nikita Kniazev
af6102948e
Merge pull request #205 from Kojoley/add-regression_real_policy_sign-to-tests-list
Karma.Tests: Added `regression_real_policy_sign.cpp` to test suite
2017-11-07 21:19:00 +03:00
Han Wang
30dfb6230a simplify with directive (3): make rvalue injection mutable 2017-08-22 15:43:34 +02:00
Han Wang
6412f88813 simplify with directive (2): add test cases 2017-08-22 12:15:42 +02:00
Nikita Kniazev
d99cdf5bd2 Tests: Removed unused argc and argv parameters 2016-08-29 19:25:23 +03:00
Nikita Kniazev
a0f34f8a34 Qi.Tests: utree1: Fixed operator precedence warnings [clang] 2016-08-27 23:32:52 +03:00
Joel de Guzman
4789aec3d9 Merge pull request #215 from Kojoley/fix-multiple-unsued-variable-warnings
Tests: Fixed multiple unused variable warnings
2016-08-26 06:23:44 +08:00