Commit Graph

2382 Commits

Author SHA1 Message Date
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
b24f0ca9c9
Merge pull request #335 from Kojoley/classic-unused-parameter-warnings
Classic: Fixed unused parameter warnings
2017-12-18 18:49:15 +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
da4f1ed122 Classic: Fixed unused parameter warnings 2017-12-18 02:21:28 +03:00
Nikita Kniazev
11a36a0ce2 Remove unused boost/foreach.hpp includes 2017-12-17 20:14:56 +03:00
Nikita Kniazev
5b061a1130 Qi.Repository: Some header moving between keywords and kwd 2017-12-17 20:14:56 +03:00
Nikita Kniazev
9954b8467b Qi: permutation: Use array::fill instead of BOOST_FOREACH loop 2017-12-17 04:25:05 +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
60c971df52 Karma: Fix truncation warning if attribute is wider than binded value
Actually the warning here is a sign of bad design. Attribute should go directly
to sink, and there will be no truncation warning except a situation when sink
is not wide enough for attribute or binded value.
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
Nikita Kniazev
20a63aa976
Merge pull request #324 from Kojoley/lex-generated-lexer-newline_in_constant
Lex: Fixed C2001 'newline in constant' warning in generated lexers
2017-12-15 16:21:30 +03:00
octopus-prime
26c782c229 Replaced tabs by spaces 2017-12-15 11:44:51 +01:00
octopus-prime
6a4547ca43 Added fix and test from trac # 5983 2017-12-15 11:29:46 +01:00
Nikita Kniazev
3d6f2c9bce Lex: Fixed C2001 'newline in constant' warning in generated lexers
Closes https://svn.boost.org/trac10/ticket/11540.

Actually this should have been caught by `regression_matlib_generate_switch`
test, but it is not complex enough to cover all cases. We do not have the
coverage reports yet, but the fix is trivial so I think it is ok.
2017-12-14 21:53:27 +03:00
Nikita Kniazev
2d7dcd9f6e Classic: Fix compilation with BOOST_DISABLE_THREADS defined
Closes https://svn.boost.org/trac10/ticket/12639
2017-12-14 21:26:53 +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
djowel
6de1792825 If there's ambiguity in attribute_category on container_attribute or tuple_attribute (e.g. array and std::array), choose tuple_attribute. We probably should define is_container better. 2017-12-09 11:26:37 +08:00
Nikita Kniazev
d3cbd18af4
Merge pull request #310 from Kojoley/sequential_or-random-order-bug
sequential_or: Fixed random order execution of underlying parsers
2017-12-08 19:48:23 +03: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
52de6d17ba Fix for trac ticket 12928 "x3 cannot synthesize attribute of type
boost::iterator_range in a sequence parser"
2017-12-06 19:19:08 +01:00
Nikita Kniazev
6e329cbf45
Merge pull request #313 from Kojoley/fix-include-guard-names-collision
X3: Fixed include guard names collision
2017-12-06 13:51:53 +03:00
Nikita Kniazev
d58e26ed73 Karma: attr_cast: Wrong BOOST_SPIRIT_NO_PREDEFINED_TERMINALS ifndef 2017-12-05 21:31:54 +03:00
Nikita Kniazev
1c48ce8d1a Qi.Repository: advance: Add missing include 2017-12-05 20:40:14 +03:00
Nikita Kniazev
4d8ce7024d Qi.Repository: keywords: Added missing include 2017-12-05 20:40:14 +03:00
Nikita Kniazev
332d267d67 Qi.Repository: kwd: Added missing include 2017-12-05 20:40:14 +03:00
Nikita Kniazev
d0d9f67407 Repository: Fix compilation with BOOST_SPIRIT_NO_PREDEFINED_TERMINALS 2017-12-05 17:57:40 +03:00
Nikita Kniazev
cb946ba083 X3: Fixed include guard names collision 2017-12-05 17:01:05 +03:00
Nikita Kniazev
6a37fde4ca sequential_or: Fixed random order execution of underlying parsers
After two hours of fighting with the optimizer, I happily drew attention to
this little nifty bitwise operator in `any_if_ns` function.

Explanation of the bug: bitwise inclusive OR operator is not a sequence point
(per chapter §5.13 of C++14 standard), that's why at compiling the expression
`a() | b() | ... | z()` optimizer is allowed to rearrange the execution order
of the functions `a`, `b` ... `z`.

There is high chance that a lot of people were misguided by the bug and chose
not to use `sequential_or`.

I vaguely remember how about three years ago I thought that I am dumb and/or
the documentation is wrong when I tried to use the `sequential_or` but ended
with some workaround.

There are three possible fixes:
  - This one
  - Make the original `any_ns` and `any_if_ns` strict ordered
    (could potentially make permutations operator slower)
  - Break the `any_ns` and `any_if_ns` API and somehow generalize the code
2017-12-04 18:28:50 +03: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
Mike Gresens
5ec71cfd33
Merge pull request #307 from octopus-prime/optional_attribute
optional_attribute
2017-12-04 11:37:51 +01:00
Nikita Kniazev
1265ee169c
Merge pull request #120 from mlang/x3/implicit
X3: Make use of implicit constructibility.
2017-12-03 15:45:05 +03:00
Nikita Kniazev
deab0a2613
Merge pull request #109 from mlang/x3/repeat-kleene-auto
auto makes this simpler.
2017-12-03 15:25:36 +03:00
Nikita Kniazev
6d6f40c3e5 X3: Workaround VS2015 rvalue ref in template of noexcept expression bug
error C2057: expected constant expression
2017-12-02 18:20:07 +03:00
Nikita Kniazev
a30e517b1e X3: Workaround VS2015 decltype in function arguments bug
Thanks @hia3 for the c51a01 workaround.
2017-12-02 18:20:02 +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
c40e6742a0
Merge pull request #303 from Kojoley/fix-classic-file_iterator-truncation-warning
Classic: file_iterator.ipp: Fixed truncation warning
2017-12-01 13:43:00 +03:00
Nikita Kniazev
80414bc688 fix qi::uint_parser<T(signed)> overflow problem 2017-12-01 03:36:33 +03:00
Nikita Kniazev
59f9648a54 Classic: file_iterator.ipp: Fixed truncation warning 2017-12-01 03:22:19 +03:00
Nikita Kniazev
7422ab0682
Merge pull request #252 from jeking3/ignore-unused
silence coverity discovery of ignored return code from at_end
2017-11-30 03:58:24 +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
6908307132 Replaced tab by spaces. 2017-11-23 15:40:21 +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
Hartmut Kaiser
0854b45b6a Fix scary warning in hold_any 2017-11-22 09:58:47 -06:00
Joel de Guzman
2a6e8f73ed
Merge pull request #284 from Kojoley/fix-subrule-use-after-scope
subrule: Fixed a huge use after scope bug
2017-11-22 07:26:42 +08:00
Nikita Kniazev
f67fcd0e95 Fixed nested comment is not allowed warning from intel compiler 2017-11-21 19:49:38 +03:00
Nikita Kniazev
fdb56edbc8 Classic: Fixed forcing value to bool warning
The warning even removed from MSVC 2017
2017-11-21 19:49:37 +03:00
Nikita Kniazev
4e700fe285 Qi: stream: Fixed truncation warning 2017-11-21 19:49:37 +03:00
Nikita Kniazev
d3cc71002c Fixed redundant semicolons 2017-11-21 19:49:37 +03:00
Nikita Kniazev
34e078d11e Classic: switch: Fixed right_t typedef shadowing 2017-11-21 19:49:37 +03:00
Nikita Kniazev
7f012982e2 Classic.Phoenix: composite: Fixed placesholder names shadowing
Could be triggered if one uses `using namespace phoenix`.
2017-11-21 19:49:36 +03:00
Nikita Kniazev
138b055a1d Classic: escape_char: Suppress conditional expression is constant warning
`boost/spirit/home/classic/utility/impl/escape_char.ipp(143): warning C4127: conditional expression is constant`
2017-11-21 19:49:36 +03:00
Nikita Kniazev
9bf993abfa Classic: Fixed iter_policy_t and scanner_policies_t shadowing problem
`iter_policy_t` and `scanner_policies_t` declared at Spirit's namespace scope.
2017-11-21 19:49:36 +03:00
Nikita Kniazev
8f6a9aaaa3 Classic: file_iterator: Fixed 'size_t' to 'long' conversion warning 2017-11-21 19:49:36 +03:00
Nikita Kniazev
5c44ac5af5 Classic: Fixed unused parameter warnings 2017-11-21 19:49:36 +03:00
Nikita Kniazev
e79f03a062 Qi.Repository: keywords: Fixed unused parameter warnings
```
../boost/spirit/repository/home/qi/directive/kwd.hpp:899:76: warning: unused parameter 'modifiers' [-Wunused-parameter]
../boost/spirit/repository/home/qi/directive/kwd.hpp:922:76: warning: unused parameter 'modifiers' [-Wunused-parameter]
../boost/spirit/repository/home/qi/operator/detail/keywords.hpp:510:35: warning: unused parameter 'first' [-Wunused-parameter]
../boost/spirit/repository/home/qi/operator/detail/keywords.hpp:511:41: warning: unused parameter 'last' [-Wunused-parameter]
../boost/spirit/repository/home/qi/operator/detail/keywords.hpp:512:45: warning: unused parameter 'parse_visitor' [-Wunused-parameter]
../boost/spirit/repository/home/qi/operator/detail/keywords.hpp:513:51: warning: unused parameter 'no_case_parse_visitor' [-Wunused-parameter]
../boost/spirit/repository/home/qi/operator/detail/keywords.hpp:514:40: warning: unused parameter 'skipper' [-Wunused-parameter]
../boost/spirit/repository/home/qi/operator/detail/keywords.hpp:573:92: warning: unused parameter 'position' [-Wunused-parameter]
```
2017-11-21 19:49:35 +03:00
Nikita Kniazev
0773ca38d0 Support: utree_detail2: Fixes sign compare warning 2017-11-21 19:49:35 +03:00
Nikita Kniazev
b174d1f282 subrule: Fixed a huge use after scope bug
It took me 3 days of pulling my hair to debug and fix the bug. The subrule's
author put a big bomb under it and I caught the exposition only in a single
test, with modern versions of Clang/GCC and enabled optimizations (most of
boost regression test runners does not use `variant=release`). Valgrind did
not catch any problems. Enabling address sanitizer causes the bug to disappear
(now I understand why, it places big gaps between stack pointers).
`-fsanitize-address-use-after-scope` catches the bug, but I have discovered
that it is turned off in Clang by default after already having a repro.

The bug could be easily reproduced if you use any parser that invalidates
it's state in the destructor.

I used `literal_char` with added `~literal_char() { ch = char_type(0); }`.

Reproduction code:

```cpp

    rule<char const*> r;
    subrule<0> entry;
    r = (entry = 'a');
    BOOST_TEST(test("a", r));
```

It will fail because after assignment to `r` a temporary `subrule_group` is
destroyed and rule is binded to the already destroyed object.

The cause is in usage of `reference` parser. I am 100% sure the code was
copy-pasted from `rule`/`grammar`. They store an expression within their
body, while `subrule` actually used only as a placeholder.

I have split `subrule_group` into an actual parser/generator that stores the
expression and a Proto terminal that contains the parser/generator.

Tested on:
 - VS 2008, 2010, 2015, 2017
 - Clang 3.8, 3.9, 4.0, 5.0
 - GCC 4.8, 7
2017-11-21 00:37:54 +03:00
Nikita Kniazev
fd10da52b7 Repository: subrule: Fixed partial ordering problem
The problem is that `f(T&)` and `f(T&&)` overloads had the same priority
http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_defects.html#1164

Affected compilers are:
 - MSVC 9/10/11
 - GCC 4.7.2, 4.8.4 with `-std=c++1x`
2017-11-15 21:30:32 +03:00
Nikita Kniazev
4ec785d3ed
Merge pull request #271 from Kojoley/fix-alternate
Spirit accidentally relays on `types` typedef of `boost::optional`
2017-11-13 17:21:40 +03:00
Nikita Kniazev
e91aa9f3a2
Merge pull request #259 from Kojoley/fix-subrule
Fix `subrule` compilation
2017-11-13 17:15:57 +03:00
Nikita Kniazev
cdac069504 Classic: Fixed warning from isblank_ with bool scanner
While I do not see usages for `bool` scanner and consider it is a dumb idea
I have not removed the test. Adding the `isblank(bool)` overload seems to me
as a reasonable compromise because it cannot break anything.
2017-11-12 21:17:38 +03:00
Nikita Kniazev
a9e7f574ee Classic: Fixed conversion from 'ptrdiff_t' to 'int', possible loss of data warnings 2017-11-12 17:15:16 +03:00
Nikita Kniazev
99134e9d7b
Merge pull request #275 from Kojoley/fix-classic-boost-optional-has-no-argument_type
Classic: Fixed compilation of `match<T &>`
2017-11-12 17:13:03 +03:00
Nikita Kniazev
632252bafc
Merge pull request #274 from Kojoley/fix-classic-phoenix-actor-remove_reference
Classic: Fix `remove_reference` usage without a namespace
2017-11-12 17:08:32 +03:00
Nikita Kniazev
85fa626071
Merge pull request #273 from Kojoley/fix-classic-phoenix-special_ops-complex
Classic: Fixed `std::complex` usage without the include
2017-11-12 17:07:38 +03:00
Nikita Kniazev
45777098b8 Classic: Fixed compilation of match<T &>
`boost::optional<T &>` has member named `argument_type`

I do not know when it did break because defining
`BOOST_OPTIONAL_CONFIG_USE_OLD_IMPLEMENTATION_OF_OPTIONAL`
does not solve the problem.
2017-11-12 03:07:26 +03:00
Nikita Kniazev
41fe4eb5b3 Classic: Fixed unused local typedef in dynamic/for.hpp 2017-11-12 02:50:08 +03:00
Nikita Kniazev
9dac9fb638 Classic: Fixed std::complex usage without the include
08b336d (#195) removed forward declaration but did not add the include.

Closes https://svn.boost.org/trac10/ticket/13240
2017-11-12 02:32:31 +03:00
Nikita Kniazev
ebcedd2523 Classic: Fix remove_reference usage without a namespace 2017-11-12 02:27:10 +03:00
Nikita Kniazev
03b5ab568d Spirit accidentally relays on types typedef of boost::optional
Replaces #201, fixes #249.

New `boost:optional` implementation does not contain `types` what caused
a compilation error for Qi and wrong results for Karma.

Other problem is that `not_is_variant<optional<variant<T...>>>` results in
`mpl::false_` what is unclear from it's name. While Karma relays on exactly
this behavior, Qi wrongly considers that it `mpl::true_`. I have fixed this
name ambiguity and updated Karma for the new `not_is_variant` behavior.
2017-11-10 22:05:10 +03:00
Nikita Kniazev
23531c8ab3
Merge pull request #269 from Kojoley/fix-qi-keywords-unused-parameter-warnings
Qi.Repository: keywords: Fixed unused parameter warnings
2017-11-10 03:37:07 +03:00
Nikita Kniazev
3439373f0c Qi.Repository: keywords: Fixed unused parameter warnings 2017-11-10 03:34:32 +03:00
Nikita Kniazev
1360fdfd16 utree: Fixed possible loss of data warning 2017-11-10 03:33:16 +03:00
Nikita Kniazev
f7049833a1 Revert "Merge pull request #201 from mxc-commons/fix_alternative"
This reverts commit 4c5b976633, reversing
changes made to 0f7b47d33d.
2017-11-10 01:20:33 +03:00
Nikita Kniazev
ee4943d589 X3: Fix unused_type attribute case in parse_into_container
Passing `unused_type` attribute to `parse_into_container_impl::call`
produces a compilation error.

The issue was introduced in 379413a50c.
2017-11-08 19:42:47 +03:00
Nikita Kniazev
688f8c624b Karma: Fixed no_buffering_policy missing copy constructor
It seems that `no_buffering_policy` had a copy-paste error for 8 years.
2017-11-06 20:32:30 +03:00
Nikita Kniazev
025aa31292 Repository: subrule: Fix proto's operators kicks in on c++11 2017-11-03 19:35:19 +03:00
Nikita Kniazev
7240e1fbe7 Repository: subrule: Fix extract_sig usage
With e34a955f2f `extract_sig` changed
but `subrule` did not get an update for that change.
2017-11-03 19:27:50 +03:00
Nikita Kniazev
c240c5ecce Qi.Repository: Fix keywords compilation on c++11 2017-10-31 21:49:12 +03:00
James E. King, III
c744f31222 silence coverity discovery of ignored return code from at_end 2017-10-20 16:44:10 -04:00
Joel de Guzman
5430289e4b Merge pull request #248 from m-dhooge/develop
x3::error_handler::position() CR+LF lines wrongly counted.
2017-10-10 10:43:04 +08:00
Joel de Guzman
1fcefe5bc8 Merge pull request #245 from dtardon/overflow
oss-fuzz: avoid signed integer overflow
2017-10-07 17:08:00 +08:00
mdhooge
79995f7e8f x3::error_handler::position() CR+LF lines wrongly counted. 2017-10-05 09:51:09 +02:00
Edward Catmur
327b725afc Store id as promoted type to allow out-of-enum values 2017-10-03 17:00:13 +01:00
Edward Catmur
c342200867 Perform negation in unsigned type to prevent UB 2017-10-03 16:58:40 +01:00
David Tardon
3d8a80c4f3 ofz#2894 avoid signed integer overflow
/usr/include/boost/spirit/home/qi/numeric/detail/real_impl.hpp:86:48: runtime error: negation of -2147483648 cannot be represented in type 'int'; cast to an unsigned type to negate this value to itself
2017-10-02 16:38:11 +02:00
Ed Catmur
26356b5361 Avoid -Wlogical-op error in radix_traits::is_valid
With -Wlogical-op, gcc warns in radix_traits::is_valid with Radix <= 10:

```
boost/spirit/home/qi/numeric/detail/numeric_utils.hpp: In instantiation of ‘static bool boost::spirit::qi::detail::radix_traits<10u>::is_valid<char>(char)’:
[...]
boost/spirit/home/qi/numeric/detail/numeric_utils.hpp:107:31: warning: logical ‘and’ of mutually exclusive tests is always false [-Wlogical-op]
                 || (ch >= 'a' && ch <= static_cast<Char>('a' + Radix -10 -1))
                               ^
boost/spirit/home/qi/numeric/detail/numeric_utils.hpp:108:31: warning: logical ‘and’ of mutually exclusive tests is always false [-Wlogical-op]
                 || (ch >= 'A' && ch <= static_cast<Char>('A' + Radix -10 -1));
                               ^
```

Rather than suppressing the warning (https://github.com/boostorg/spirit/pull/77), refactor the test so that the warning is not triggered.
2017-09-19 18:51:34 +01:00
Adam Merz
b4e4762b6c Add noexcept specs to x3::variant and forward_ast
Add noexcept specifications to X3's variant and forward_ast
2017-08-24 18:05:38 -07:00
Han Wang
19972887f4 Context& -> Context const&
fix parsers like x3::skip(x3::space)[x3::double_] compile problem
2017-08-23 10:45:21 +02:00
Han Wang
30dfb6230a simplify with directive (3): make rvalue injection mutable 2017-08-22 15:43:34 +02:00
Han Wang
361b12eeeb simplify with directive
1. when used as x3::with<ID>(x), where x is an lvalue, we inject an lvalue reference of x to the context.
2. when used as x3::with<ID>(x), where x is a const lvalue, we inject a const lvalue reference of x to the context.
3. when used as x3::with<ID>(x), where x is an rvalue, we move the rvalue to the member of with_directive and inject an lvalue reference of that member to the context.
4. No copy is applied; std::ref is not needed
5. remove unused with_context
2017-08-21 13:48:08 +02:00
Hartmut Kaiser
b187f862b6 Removing use of bind2nd 2017-08-11 04:46:16 -05:00
Joel de Guzman
a476452dbd use boost::swap instead, which does all the namespace stuff. 2017-08-07 11:14:22 +08:00
David Olsen
e379a7bff6 Update PGI C++ compiler support
Remove a PGI-specific workaround in the functor constructor.  The workaround was necessary several years ago to get class functor to compiler with PGI, but the workaround now causes compilation errors.
2017-07-26 12:52:45 -07:00
Joel de Guzman
1f513cb401 Revert "Crash when print attribute in debug mode." 2017-06-19 17:07:21 +08:00
glacierx
e7962ea67f Update simple_trace.hpp
Crash in debug mode.
2017-06-19 15:42:20 +08:00
glacierx
8c7f9c0711 Update and_predicate.hpp 2017-06-19 15:40:08 +08:00
sehe
ca335f30f4 Fix dangling refs in debug of call_rule_defintion`
There was an issue in `call_rule_definition` where it tries to print the
attribute before transformation (via `context_debug` -> `simple_trace`).

However, it breaks if the made attribute type doesn't match the actual
attribute type. In this case, it makes `context_debug` store a dangling
reference to a temporary converted attribute, leading to Undefined
Behaviour.

See also
https://stackoverflow.com/questions/43679200/boost-spirit-x3-symbol-table-parser-segfaults-when-in-a-separate-compilation-uni/43688320#43688320
2017-04-29 01:07:09 +02:00
Benjamin Buch
cfa7446a87 silence unused parameter warning 2017-02-10 12:27:28 +01:00
sehe
16320a5566 Check for unitialized rules in parser composition
Unitialized rules can silently be aggregated during parser composition,
because of statics across translation units.

get_info<> has been fixed so it doesn't break. As a QoI measure, it also
added a debug assert to help diagnose the situation.

In unary_parser and binary_parser, this commit allows that debug assert
to run as early as possible (typically during program startup) so that
users will notice the initialization ordering problem.

See http://stackoverflow.com/a/41785268/85371 for the
reproducer/analysis.
2017-01-22 01:00:16 +01:00
sehe
6c1cab48fc Avoid logic_error if rule was unitialized
Unitialized rules can silently be aggregated during parser composition,
because of statics across translation units.

Also add a debug assert diagnosing this situation.

See http://stackoverflow.com/a/41785268/85371 for the
reproducer/analysis.
2017-01-22 00:43:19 +01:00
Romain Geissler
1e82fe1ad2 Fix warning "typedef 'iterator_t' locally defined but not used" in classic/error_handling/exceptions.hpp 2016-12-06 11:35:10 +01:00
mike96
e6bd38b615 Add cfloat include to pow10.hpp
Fixes Ticket #12642. The optimized pow10 function would not be used unless cfloat had already been externally included.
2016-12-02 04:13:30 +01:00
Romain Geissler
e1ebac8f00 Fix clang unused paramter warning. 2016-11-18 00:22:40 +01:00
Romain Geissler
dd47d8be67 Fix gcc's warning/error when building with -Wmisleading-indentation 2016-10-16 22:14:51 +02:00
Agustin K-ballo Berge
7859f979d6 Fix assign_to_attribute_from_iterators for long long types
The terminal tags `boost::spirit::[u]long_long_type` hide the integer types `boost::[u]long_long_types`, qualify the later.
2016-10-08 15:36:17 -03:00
Joel de Guzman
192f910c61 Fixes #12468: real_parser failure 2016-09-18 07:49:56 +08:00
Felipe Magno de Almeida
29dc7ec6ea Added BOOST_SPIRIT_NO_REAL_NUMBERS to not include float parsers
This conditional is used to avoid #include'ing traits on floating
point for platforms without floating point, like AVR 8-bit processors.
2016-09-15 23:13:22 -03:00
Felipe Magno de Almeida
30c1d59d35 Make standard_wide and wchar_t optional for platforms that do not support
Added preprocessor conditionals with name
BOOST_SPIRIT_NO_STANDARD_WIDE which can be defined to not use wchar_t.
2016-09-15 23:11:52 -03:00
cppljevans
1d5620fefc Update rule.hpp
As requested here:

https://svn.boost.org/trac/boost/ticket/12366#comment:2
2016-08-25 09:16:25 -05:00
Nikita Kniazev
b2298b8a58 Qi: Fixed missing space in the nested template
The bug was introduced in PR #201
2016-08-18 12:44:12 +03:00
Joel de Guzman
262d5524fb Merge pull request #206 from Kojoley/fix-refers-to-the-current-namespace-warning
Qi: `pow10` is already in the `spirit::traits` namespace
2016-08-18 06:50:56 +08:00
Joel de Guzman
4c5b976633 Merge pull request #201 from mxc-commons/fix_alternative
Fix for spirit_v2 qi/alternative test case
2016-08-18 06:47:38 +08:00
Nikita Kniazev
fa9d2b160d Qi: pow10 is already in the spirit::traits namespace
Fixes the following warning message from the Intel compiler:
> boost/spirit/home/qi/numeric/detail/real_impl.hpp(34): warning #780:
>  using-declaration ignored -- it refers to the current namespace
2016-08-18 01:03:05 +03:00
Nikita Kniazev
ce9814af67 Lex: Fixed unique_ptr usage
Lex is using `unique_ptr` from `movelib` and relying on a bug in it,
described in a ticket https://svn.boost.org/trac/boost/ticket/11758
Since that bug fixed in `movelib`, Lex is uncompilable.

I have simplified unique_ptr usage by the following rules:
  - `delete ptr.release()` is equal to `ptr.reset()`
  - `delete a.release(); a = b;` is equal to `b.swap(a); b.reset();`

Now Lex test suite compiles and runs succesfully. VC++ 6 should be
happy too despite the fact that Boost no longer supports it.
2016-08-15 01:05:21 +03:00
Joel de Guzman
b328180b49 Merge pull request #191 from jefftrull/bugfix/12138
Repair plain_token_range and add tests
2016-08-06 06:19:09 +08:00
mxc-commons
b2a0b2cbb2 Static assert removed. 2016-07-28 04:14:20 +02:00
mxc-commons
ca7952a100 Possible fix for alternative test case 2016-07-28 04:10:55 +02:00
mxc-commons
fade21a0cb Undo header inclusion from PR #197 (obsolete because of PR #198 being merged) 2016-07-23 04:19:36 +02:00
Joel de Guzman
ab18d4e319 Merge pull request #198 from mxc-commons/develop
Fixes for PR #196 expect directive
2016-07-22 13:06:36 +08:00
mxc-commons
3d1274a857 Added missing include for info. 2016-07-19 19:12:17 +02:00
mxc-commons
88871b4ca8 Moved <stdexcept> dependency to expectation_failure.hpp 2016-07-19 17:54:20 +02:00
mxc-commons
330372cb9d Removed inappropriate copyright claim.
Sorry. I was to fast with copy & paste.
2016-07-19 17:43:22 +02:00
mxc-commons
4a7a50dc7d Fix for PR #196 expect directive
Added dependency on qi/detail/expectation_failure.hpp.
Removed dependency on qi/operator/expect.hpp.
2016-07-19 17:01:53 +02:00
mxc-commons
88f494cb0d Fixes for PR #196 expect directive
This PR contains fixes for both issues reported by Lastique and
MarcelRaad. It makes PR #197 obsolete.

Removed obsolete dependency  of test/qi/expectd.cpp on
mxc/qitoo/qitoo.hpp. Was reintroduced by mistake.

Created qi/detail/expectation_failure.hpp. It defines the
expectation_failure template as a common dependency of expect directive
and expect operator. Removed expectation_failure from
operator/expect.hpp.

Changed version.hpp to 2.54. I did not notice that addl file in the
first place.
2016-07-19 16:42:03 +02:00
Andrey Semashev
785b456e5f Fix missing include for expectation_failure 2016-07-19 16:19:53 +04:00
Joel de Guzman
352ee56d24 Merge pull request #196 from mxc-commons/develop
Expect directive for spirit qi 2
2016-07-16 23:36:50 +08:00
mxc-commons
0d3dc69ca5 Changed type aliases to typedefs for C++03 compatibility 2016-07-15 02:14:44 +02:00
mxc-commons
e399298e7b Adjustments for naming consistency
The qi_expectd.hpp was removed. qi_expect.hpp now forwards to both
directive and operator. Directive doc adjusted to reflect that change.

Lexer.qbk restored to qi develop because change is not part of expect
directive.
2016-07-15 01:11:36 +02:00
mxc-commons
aa01de88d5 Header reordering undo. 2016-07-09 03:19:58 +02:00
mxc-commons
5ba4d68a9b Changed struct expect to struct expect_operator to distinguish from expect_directive.
This change is necessary only to to maintain the independence of order
of header inclusion in qi.hpp.
Without that change, directive.hpp must be included before operator.hpp,
because the expect operator implementation was in a struct named expect
(before this change). This caused a naming conflict with the new expect
directive.
2016-07-09 03:15:58 +02:00
mxc-commons
aed96ba915 spirit 2 expect directive
Initial commit.
2016-07-07 00:49:18 +02:00
Joel de Guzman
379413a50c Fixed bug where string("string1") >> attr(std::string("string2")) produces the wrong attribute result 2016-07-06 22:51:18 +08:00
Joel de Guzman
2759bf97e4 Merge pull request #195 from KayEss/develop
Don't try to declare std::complex for Android builds
2016-06-29 18:39:50 +08:00
Kirit Sælensminde
08b336ddfa Remove undefined behaviour of std::complex declaration. 2016-06-29 17:13:41 +07:00
Kirit Sælensminde
84c97e323d Don't try to declare std::complex for Android builds
This breaks for clang as the NDK namespaces are oddly set up.
2016-06-29 11:04:35 +07:00
Romain Geissler
e361754faf Remove auto_ptr (deprecated in recent C++ standards). 2016-05-31 12:28:25 +02:00
Joel de Guzman
7acc6f2a91 workaround for VX2015 optimization bug 2016-05-19 07:48:21 +08:00
Benjamin Buch
7ecec33021 add const to relational operators of class template multi_pass 2016-05-17 19:46:54 +02:00
Jeff Trull
8ac0d9b98b Fix plain_token_range and add a test for plain tokens 2016-05-16 18:11:02 -07:00
Jeff Trull
b01b402577 Make multi_pass_iterator != operator const and add tests for istream_iterator 2016-05-16 13:36:00 -07:00
Benjamin Buch
124fda5020 fix wrong out commented parameter in x3::detail::make_rule_context(...) 2016-05-13 14:57:32 +02:00
Benjamin Buch
8357037e84 use ignore_unused instead of C-cast to void 2016-05-12 21:35:57 +02:00
Benjamin Buch
a1a30d431b Suppress 'unused parameter' warnings in x3::parse_rule(...) 2016-05-12 21:18:01 +02:00
Benjamin Buch
5c782ee5e7 Suppress 'unused parameter' warnings in x3::detail::make_unique_context(...) 2016-05-12 21:00:03 +02:00
Benjamin Buch
6723910307 Suppress 'unused parameter' warnings in x3::detail::move_if_not_alternative::call(...) 2016-05-12 20:57:25 +02:00
Benjamin Buch
5b1a433d25 Suppress 'unused parameter' warnings in x3::detail::parse_into_container_base_impl::call(...) 2016-05-12 20:53:03 +02:00
Benjamin Buch
10286fafae Suppress 'unused parameter' warnings in x3::detail::call(...) 2016-05-12 20:48:33 +02:00
Benjamin Buch
96272e324f Suppress 'unused parameter' warnings in x3::get_info::operator()(...) 2016-05-12 20:46:33 +02:00
Benjamin Buch
3063a043c7 Suppress 'unused parameter' warnings in x3::lazy_semantic_predicate::parse(...) 2016-05-12 20:42:34 +02:00
Benjamin Buch
ce02014df6 Suppress 'unused parameter' warnings in x3::attr_parser::parse(...) 2016-05-12 20:38:58 +02:00
Benjamin Buch
c3f97a4615 Suppress 'unused parameter' warnings in rule.hpp 2016-05-12 20:35:12 +02:00
Benjamin Buch
277cdf7773 Suppress 'unused parameter' warnings in container_traits.hpp 2016-05-12 20:22:45 +02:00
Deokhwan Kim
a19bcb5b79 Suppress an "unused parameter" warning of rule_
The rule_ parameter is not used in parse_rule, which BOOST_SPIRIT_DEFINE
expands to. GCC with -Wunused-parameter (indirectly activated by -Wall
-Wextra) issues a warning when a function parameter is not used in its
function body.
2016-05-04 15:42:07 -04: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
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
hia3
2085a9f509 dangling reference to attribute when BOOST_SPIRIT_X3_DEBUG is defined
dbg_attribute_type(attr_) creates a temporary that is bound to const reference inside of context_debug.
2016-03-26 22:07:13 +03:00
Joel de Guzman
9e488859da Fixes for ticket https://svn.boost.org/trac/boost/ticket/12094 2016-03-26 09:13:16 +08:00
Joel de Guzman
c447315c1c Use forward<T> as appropriate 2016-03-25 07:04:37 +08:00
hia3
a077a4cae4 fixes problem with move_to
Fix bug described here - http://article.gmane.org/gmane.comp.lib.boost.devel/266211
2016-03-19 08:30:23 +03:00
Joel de Guzman
035431b343 Partial fix for ticket 12064: change relative includes using double quotes to a uniform style using angle brackets. 2016-03-13 07:42:52 +08:00
Joel de Guzman
7690022b93 Bigfix: with_context should not return const context. doing so will introduce type conflicts and linker errors 2016-03-11 23:24:41 +08:00
Joel de Guzman
82bd5b2cc1 fixes problem with BOOST_SPIRIT_X3_DEBUG. 2016-03-04 07:01:18 +08:00
Joel de Guzman
d98a7dc9fb Merge pull request #175 from octopus-prime/develop
x3::lit should delegate std::basic_string<Char> instead of Char*
2016-02-25 06:26:29 +08:00
octopus-prime
a39923104d Use std::basic_string<Char> instead of Char* 2016-02-24 21:58:04 +01:00
Joel de Guzman
035fc0fd9d - added static assert on phrase_parse to make sure user does not pass in unused_type skipper
- fixed symbols parser bug (fixes ticket 12016)
2016-02-24 06:29:41 +08:00
Michael Caisse
a4fe5b95af Merge pull request #173 from MarcelRaad/patch-1
Add missing include for mpl::if_
2016-02-23 13:01:48 -08:00
Joel de Guzman
3cee512a4a Merge pull request #170 from octopus-prime/develop
Cleaned up container_traits.
2016-02-22 03:43:31 +08:00
octopus-prime
8602d2b8eb Replaced cend() by end(). 2016-02-21 17:26:37 +01:00
octopus-prime
0037392a73 Changed push_back(unused_type, T const&) to push_back(unused_type, T&&). 2016-02-21 11:47:47 +01:00
Marcel Raad
e4ef5de16f Add missing include for mpl::if_
This caused compile breaks when building Boost.Serialization.
2016-02-18 11:51:36 +01:00
Joel de Guzman
c8ed3fe2e3 Merge pull request #172 from Lastique/patch-1
Add missing includes required in impl/subrule.ipp
2016-02-14 01:26:22 +08:00
Andrey Semashev
a1564f0135 Add missing includes required in impl/subrule.ipp 2016-02-13 19:40:06 +03:00
Andrzej Krzemieński
2edabd2e6f Added header for mpl::if_
without it trying to build quickbook fails for me with an error in MSVC 15.
2016-02-13 14:49:31 +01:00
Joel de Guzman
a8e391bd99 fix sequence partitioning problem 2016-02-04 08:49:53 +08:00
Joel de Guzman
d91cf74106 Fixes Ticket #11952 2016-02-04 08:49:53 +08:00
octopus-prime
9c2bc9f340 size calculation in has_reserve_method case only. 2016-01-30 11:15:33 +01:00
octopus-prime
1fbe050efa Replaced c.end() by c.cend().
Replaced std::integral_constant<bool,
detail::has_reserve_method<Container>::value>() by typename
detail::has_reserve_method<Container>::type{}.
2016-01-28 08:41:14 +01:00
octopus-prime
045216a5c1 Add and use has_reserve_method construct to determine whether container
has reserve() method.
2016-01-27 23:49:55 +01:00
octopus-prime
27d3352ecf Added reserve optimization for std::vector and std::basic_string 2016-01-26 22:30:41 +01:00
octopus-prime
c014a081b2 Cleaned up container_traits. 2016-01-26 21:46:35 +01:00
octopus-prime
c31e79efa8 Using insert() method of containers in push_back(). 2016-01-26 19:23:56 +01:00
octopus-prime
cec9817bc4 Added support for std::multimap, std::unordered_map and
std::unordered_multimap.
2016-01-25 19:50:17 +01:00
Romain Geissler
a52d08d9bf Fix "unused local typedefs" in grammar.ipp 2015-12-16 15:38:26 +01:00
Dmitry Marakasov
f0b6db5b72 Don't forward declare struct tst_pass_through
It is used later in find(), so complete type is needed.
Include tst.hpp which defines it.
2015-11-16 17:12:14 +03:00
Andrey Semashev
a6c79bc35c Silence MSVC warnings
Silence mass MSVC-14 warnings:

boost/spirit/home/support/terminal.hpp(264): warning C4348: 'boost::spirit::terminal<boost::spirit::tag::lit>::result_helper': redefinition of default parameter: parameter 3
boost/spirit/home/support/terminal.hpp(270): note: see declaration of 'boost::spirit::terminal<boost::spirit::tag::lit>::result_helper'
boost/spirit/home/support/common_terminals.hpp(142): note: see reference to class template instantiation 'boost::spirit::terminal<boost::spirit::tag::lit>' being compiled
boost/spirit/home/support/terminal.hpp(264): warning C4348: 'boost::spirit::terminal<boost::spirit::tag::lit>::result_helper': redefinition of default parameter: parameter 4
boost/spirit/home/support/terminal.hpp(270): note: see declaration of 'boost::spirit::terminal<boost::spirit::tag::lit>::result_helper'

and so on for all terminals.
2015-11-15 18:57:33 +03:00
Joel de Guzman
df92cb5c98 ascii char_type is now unsigned to allow 8 bits (reverted from commit 638e4ab54a) 2015-11-10 08:02:58 +08:00
Hartmut Kaiser
509b0891d7 Merge pull request #144 from vtnerd/BugFix_DuplicateAttribute
Fixed bug in karma::duplicate attribute reporting
2015-11-04 20:47:28 -06:00
Joel de Guzman
15bcb67b00 typo fix 2015-11-03 10:02:28 +08:00
Joel de Guzman
638e4ab54a ascii char_type is now unsigned to allow 8 bits 2015-11-03 09:56:14 +08:00
Joel de Guzman
8e0fb1ac22 just to be sure we're not going out of bounds here. 2015-11-03 06:56:24 +08:00
Joel de Guzman
72c8428090 ascii char parsers now fails instead of asserts. 2015-11-02 14:48:54 +08:00