Commit Graph

185 Commits

Author SHA1 Message Date
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
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
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
b3ae790e2b Use endian macros from Predef
The `boost/detail/endian.hpp` header is deprecated.
2018-09-15 18:19:49 +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
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
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
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
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
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
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
0c27beaa38 X3.Tests: Add c++14 feature checks 2017-11-28 19:33:28 +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
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
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
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
mgresens
de81dc44dd Using boost TTI library to replace hand-written TTI code. 2016-04-01 13:51:59 +02:00
Joel de Guzman
b818ca5c8d - added x3 variant test
- added x3 variant, extended variant swap member function
2016-03-30 14:06:06 +08: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
Mikhail Strelnikov
a579e31229 add test case 2016-03-27 07:19:55 +03: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
octopus-prime
793ec4292c Added test for map support. 2016-01-25 19:51:11 +01:00
Adrian Vogelsgesang
99c679026a X3: test case for expect directive with nested kleene star
This testcase tries to use a kleene star within an expect directive.
The test compiles but the parsed attribute is not as expected.
2015-08-20 00:31:24 +02:00
Adrian Vogelsgesang
856f88f5d1 X3: test case for char_range boundaries
ticket: https://svn.boost.org/trac/boost/ticket/11531
2015-08-09 15:37:18 +02:00
Mario Lang
b42df6fe50 X3: Fix parse_sequence with variant_attribute. 2015-07-06 23:12:48 +02:00
Mario Lang
6846946823 X3: Make use of Fusion member type deduction to simplify examples. 2015-06-15 22:30:00 +02:00
Mario Lang
f8adee2ced X3: Add test for the fix in 2a94b18e97. 2015-06-03 16:35:10 +02:00
Joel de Guzman
0a7fadd838 Merge pull request #104 from teajay-fr/feature/x3_binary
Add support for the binary parsers
2015-05-27 14:08:49 +08:00
Thomas Bernard
d5f1197790 Add support for the binary parsers 2015-05-23 15:26:45 +02:00
Mario Lang
ad507e4da1 Fix include paths.
Now the x3 testsuite builds again.
2015-05-22 09:05:47 +02:00
Mario Lang
10c13779b3 Rename {directive => extensions}/matches.hpp. 2015-05-21 22:25:37 +02:00
Mario Lang
dc4c7f824e x3::matches. 2015-05-21 21:21:31 +02:00
Mario Lang
705524b1e1 X3: no_case *is* implemented. 2015-05-20 00:07:34 +02:00
Joel de Guzman
3627a46902 more test updates and cleanup 2015-05-14 07:40:18 +08:00
Joel de Guzman
0adee06b27 cleaning up the tests 2015-05-14 02:13:24 +08:00
Joel de Guzman
c5fe8848ce added explicit force_attribute bool template parameter to rule 2015-04-08 14:34:29 +08:00
Joel de Guzman
67854cb26e Merge pull request #55 from mlang/x3/test/optional-omit
Re-enable the use of omit in test/x3/optional.cpp.
2014-11-22 01:22:24 +08:00
Joel de Guzman
27d8c7e2f4 Merge pull request #67 from teajay-fr/bug/gcc_4.9.1_support
Change the language feature set option for gcc
2014-11-06 08:45:53 +08:00
Thomas Bernard
8237380a16 Change the language feature set option for gcc 2014-11-06 00:34:39 +01:00
Thomas Bernard
fec70d409c Merge branch 'x3-devel' into feature/x3_devlop_merge
Conflicts:
	include/boost/spirit/home/x3/extensions/repeat.hpp
	test/x3/Jamfile

Add support for no_case to the bool parsers
2014-11-01 23:43:02 +01:00
Thomas Bernard
e4d195ef29 Merge branch 'x3-devel' of https://github.com/boostorg/spirit into feature/x3_no_case
Conflicts:
	include/boost/spirit/home/x3/string/literal_string.hpp

Finalized the no_case handling based on the corrected encoding handling
2014-10-18 10:15:49 +02:00
Thomas Bernard
92bd34bd79 Corrected the seperation of the literal string from their sizes in the
any_char operator()
Reactivated all the char set tests
2014-10-15 23:00:58 +00:00
Thomas Bernard
7bde4c42ff Add as_parser templates to handle on char strings as char_ instead of
literal_string
2014-10-13 09:30:41 +00:00
Thomas Bernard
a4e043101c Add the char_set and char_range parser 2014-10-12 17:16:07 +00:00
Thomas Bernard
eec3ff5316 Fix the char encoding specific generators for all the string literal
parsers
2014-10-12 15:57:55 +00:00
Thomas Bernard
89cb0c3b69 Remove the development target 2014-10-12 14:11:18 +00:00
Thomas Bernard
60cca11616 Implement the no case directive for the symbols parser 2014-10-12 14:10:03 +00:00
Thomas Bernard
eb9f42adc7 Reactivate some test which pass 2014-10-07 23:25:45 +00:00
Thomas Bernard
ad9d0429a0 Use a less invasive case_compare type extraction from the context 2014-10-07 23:19:36 +00:00
Thomas Bernard
aa7ca423e4 Add the no_case context to the any_parser tests 2014-10-06 23:10:46 +00:00
Thomas Bernard
ea72c747af Make the char class parser no_case compatible.
Make all no_case tests pass.
2014-10-05 23:26:19 +00:00
Thomas Bernard
4b1fab071d Make no case directive compilable
Added helpers to parse no case strings
Fixed some include locks
Do not pass the encoding as runtime parameter to the parsing helpers
2014-09-21 22:41:22 +00:00
Mario Lang
707ae80ce7 Re-enable the use of omit in test/x3/optional.cpp. 2014-09-13 09:52:22 +02:00
Thomas Bernard
5a74952057 Add no case directive 2014-09-09 22:26:41 +00:00
Thomas Bernard
89d14edb05 Add no_case test cases 2014-09-08 22:05:52 +00:00
Joel de Guzman
bcd6f561ad Merge branch 'develop' 2014-07-10 08:07:16 +08:00
K-ballo
d912186426 Revert "Merge pull request #37 from cppljevans/context_debug_fix_swap"
This reverts commit 527e54b549, reversing
changes made to 3928caeb3d.
2014-06-08 22:44:29 -03:00
Joel de Guzman
e95d80d682 added bool.cpp test 2014-06-07 08:23:32 +08:00
Lee Clagett
6825a6716f Ported confix to x3 extensions 2014-06-01 20:44:16 -04:00
Joel de Guzman
41cf0f5fdb minor adjustments. we're good to go. test pass. 2014-05-30 13:34:25 +08:00
Joel de Guzman
3afadd48dc Merge pull request #28 from teajay-fr/feature/x3_repeat
Feature/x3 repeat
2014-05-30 13:26:32 +08:00
Joel de Guzman
99430b8077 simplification of semantic action interface
- there are only 2 variations now f() and f(ctx)
  - added _attr(ctx) accessor for accessing the attribute
  - added _where(ctx) accessor for accessing the iterator range
this, and in preparation for a unified call interface for actions as well as lazy args to e.g. eps(f)
2014-05-26 17:03:26 +08:00
Joel de Guzman
528c1de366 made on_success mechanism as a member of the rule ID 2014-05-26 13:06:58 +08:00
Joel de Guzman
168e202365 making the rule ID more useful by making it a class where you define on_error (and later on_success) hooks. 2014-05-26 12:38:30 +08:00
Joel de Guzman
571fcb07ba fixed for new on_error interface 2014-05-25 08:34:38 +08:00
Joel de Guzman
913a092ee6 reverting previous mistakes 2014-05-25 08:29:56 +08:00
Joel de Guzman
1a960e4bba All tests are now passing. 2014-05-17 09:25:06 +08:00
Joel de Guzman
0e47e08037 added rcontext argument to parse functions 2014-05-15 21:46:25 +08:00
Lee Clagett
b77ab8b3d1 Adding test_failure to x3 test framework
The new test_failure function ensures that the first iterator argument
remains at the start position when parsing fails.
2014-05-11 10:14:41 -04:00
Thomas Bernard
6dfba300b8 Don't use lambdas for the repeat limit evaluation
Comment out the not yet supported tests
Changed some variable names to improve the code clarity
2014-05-09 01:21:53 +02:00