Re: Not able to use x3::skip(skipper)[some recursive rule] in its rule definition
Larry Evans <[email protected]>
| Newsgroups | gmane.comp.parsers.spirit.general |
|---|---|
| Message-ID | <[email protected]> |
On 07/25/2017 07:43 AM, Han Wang wrote:
> Hi Larry,
>
> Thanks. I've tried this get_rhs branch but it doesn't solve this
> problem. Still get the same error.
>
> Best regards,
> Han
>
[snip]
OPPS. Sorry about that. I should have read where you say in OP:
it will generate an infinite context (by x3::make_context in
x3::skip_directive).
I just saw the x3::make_context and remembered that was causing
long compile times. There's a make_unique_context which
avoids the infinite recursion. When that's applied, as shown here:
https://github.com/cppljevans/spirit/blob/get_rhs/include/boost/spirit/home/x3/directive/skip.hpp#L40
Compile succeeds fast:
make compile
time
/home/evansl/dwnlds/llvm/3.9/prebuilt/clang+llvm-3.9.0-x86_64-linux-gnu-ubuntu-16.04/bin/clang++
-c -O0 -stdlib=libc++ -std=c++1z -ftemplate-backtrace-limit=0
-fdiagnostics-show-template-tree -fno-elide-type
-fmacro-backtrace-limit=0 -c -std=c++14 -ftemplate-depth=1024
-I/home/evansl/prog_dev/boost/releases/ro/boost_1_64_0/sandbox/pull_requests/context_debug_fix.fork/spirit/include
-I/home/evansl/prog_dev/boost/releases/ro/boost_1_64_0
-DBOOST_SPIRIT_GET_RHS_CRTP=0 -DBOOST_SPIRIT_ATTR_XFORM_IN_RULE=0 main.cpp
In file included from main.cpp:7:
In file included from
/home/evansl/prog_dev/boost/releases/ro/boost_1_64_0/sandbox/pull_requests/context_debug_fix.fork/spirit/include/boost/spirit/home/x3.hpp:17:
In file included from
/home/evansl/prog_dev/boost/releases/ro/boost_1_64_0/sandbox/pull_requests/context_debug_fix.fork/spirit/include/boost/spirit/home/x3/nonterminal.hpp:10:
/home/evansl/prog_dev/boost/releases/ro/boost_1_64_0/sandbox/pull_requests/context_debug_fix.fork/spirit/include/boost/spirit/home/x3/nonterminal/rule.hpp:18:11:
warning:
deprecated. May cause link error when using
BOOST_SPIRIT_INSTANTIATE. [-W#pragma-messages]
#pragma message "deprecated. May cause link error when using
BOOST_SPIRIT_INSTANTIATE."
^
/home/evansl/prog_dev/boost/releases/ro/boost_1_64_0/sandbox/pull_requests/context_debug_fix.fork/spirit/include/boost/spirit/home/x3/nonterminal/rule.hpp:22:11:
warning:
deprecated. May cause excessive compile times when many rules.
[-W#pragma-messages]
#pragma message "deprecated. May cause excessive compile times when
many rules."
^
2 warnings generated.
real 0m2.351s
user 0m1.372s
sys 0m0.072s
Compilation finished at Tue Jul 25 08:53:02
HTH.
-regards,
Larry
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot