On 07/27/2017 02:48 AM, Larry Evans wrote:
> On 07/26/2017 08:37 AM, Larry Evans wrote:
>> On 07/25/2017 09:54 AM, Larry Evans wrote:
>>> On 07/25/2017 09:18 AM, Han Wang wrote:
>>>> Hi Larry,
>>>>
>>>> I think we cannot just change make_context to make_unique_context
>>>> here in x3::skip_directive. If there already is a skipper in the
>>>> context (x3::space e.g), the new skipper (ruleComment) will be
>>>> ignored (because x3::make_unique_context will simply return the
>>>> original context).
>>>>
>>> [snip]
>>> Good catch. I had assumed that context<ID,val,NEXT> was a dictionary
>>> with only 1 value for given ID. However, I guess there could be
>>> several entries where ID==skipper_tag and only the 1st one is retrieved
>>> by the context.get<ID_>(ID_) member function. I guess there's some
>>> method to pop the top value with given ID off the context stack.
>>>
>>> In that case, I've no idea how to solve the problem.
>>>
>>> Sorry :(
>>>
>>> -regards,
>>> Larry
>>>
>>
>> I kept trying and *maybe* this:
>>
>>
https://github.com/cppljevans/spirit/blob/get_rhs/include/boost/spirit/home/x3/directive/skip.hpp#L85
>>
>>
>> will solve problem. It did successfully compile & run your test
>> program.
>>
>> HTH.
>>
> Further revision were made to remove the code in skip.hpp which was,
> essentially, close duplication of code in context.hpp. This was done
> by just modifying the context.hpp detail::make_unique_context slightly.
>
[snip]
After further thought, the proposed solution may not always work.
I think it *may* suffer the same problem as before in some cases.
One such case maybe where the:
make_unique_context<skipper_tag>(skipper,context)
is called with alternate values for skipper, say, skipper1, skipper2.
Then the context would be:
context<skipper_tag>
( skipper1
, context<skipper_tag>
( skipper2
, context<skipper_tag>
( skipper1
, unused_type
)
)
)
I've no idea what type of grammar might produce this; however, before
this thread started, I had no idea would type of grammar would produce
your particular problem, which, simplified, produces:
context<skipper_tag>
( skipper1
, context<skipper_tag>
( skipper1
, context<skipper_tag>
( skipper1
, unused_type
)
)
)
IOW, each time the skip_directive::parse is called, the context is
extended. If the skip_directive is in a recursive rule, then it
get's extended without end.
I've no idea, yet, how to solve this problem. Also, I've not
made a test case either so I may be completely wrong.
I hope someone else will solve problem.
-regards,
Larry
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org!
http://sdm.link/slashdot_______________________________________________
Spirit-general mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/spirit-general