Opened 14 years ago

Closed 13 years ago

Last modified 13 years ago

#2017 closed Bugs (wontfix)

leaf_node_d matches leading skip tokens

Reported by: j.swoboda@… Owned by: Hartmut Kaiser
Milestone: Boost 1.36.0 Component: spirit
Version: Boost 1.35.0 Severity: Showstopper
Keywords: Cc:

Description

Since spirit 1.86 (boost 1.35.0) the match of leaf_node_d contains any skip tokens directly before the actual match, if there was another token before.

Example: Add a skip parser to libs/spirit/example/fundamental/ast_calc.cpp line 131:

tree_parse_info<> info = ast_parse(str.c_str(), calc, ch_p('a'));

Build and feed the program with "1+a2" (called input a) or "a1+a2" (called input b).

Output: (a) The parse tree has a root node "+" with two child nodes "1" and "a2", the calculation yields "1" (due to being unable to convert "a2" to a number). (b) Results in the same parse tree as (a), that is, the leading skip token is in fact ignored, but not any subsequent ones.

Expected output: The second child node should only contain "2". This can be achieved by replacing leaf_node_d with reduced_node_d in tree_calc_grammar.hpp.

Relevance: This renders leaf_node_d useless in conjunction with skip parsers and breaks the runtime behaviour of existing grammars. Feel free to upgrade it to Showstopper.

Change History (7)

comment:1 by anonymous, 14 years ago

Severity: ProblemShowstopper

Having exactly the same problem...

comment:2 by Joel de Guzman, 14 years ago

Owner: changed from Joel de Guzman to Hartmut Kaiser

Hartmut, I'm reassigning this to you. I am assuming you are the maintainer of "Classic" AST/PTs?

comment:3 by anonymous, 13 years ago

This doesn't always seem to happen. You can't blindly replace leaf_node_d with reduced_node_d.

comment:4 by Peter Schüller <schueller.p@…>, 13 years ago

I also have this problem, so far i had to resort to extra postprocessing. regex_p would be an alternative, but it requires a bidirectional iterator which is a problem.

comment:5 by Hartmut Kaiser, 13 years ago

Resolution: wontfix
Status: newclosed

After the release of Spirit 2.1 in Boost V1.41 this is not relevant anymore.

comment:6 by OP, 13 years ago

Interesting solution. Will you be waiting out future bugs as well?

in reply to:  6 comment:7 by anonymous, 13 years ago

Replying to OP:

Interesting solution. Will you be waiting out future bugs as well?

Well, we didn't wait it out, we just fixed it in the new version. What else do you expect?

Regards Hartmut

Note: See TracTickets for help on using tickets.