Opened 15 years ago

Closed 15 years ago

#1048 closed Bugs (fixed)

Spirit returns full = false in 1.34 if there is trailing spaces in input

Reported by: ibaxter@… Owned by: Joel de Guzman
Milestone: To Be Determined Component: spirit
Version: Boost 1.34.0 Severity: Showstopper
Keywords: spirit space full Cc:

Description

In boost 1.34, if there is a trailing white space characters in an input sequence, parse returns with info.full set to false, even though parsing was (essentially) full. The space_p skip parser is ignored for the last sequence. In 1.33 parsing succeeds as expected.

Change History (4)

comment:1 by biochimia, 15 years ago

Resolution: wontfix
Status: newclosed
Summary: Spirit returns full = false in 1.3.4 if there is trailing spaces in inputSpirit returns full = false in 1.34 if there is trailing spaces in input

The change in behaviour was intentional. It was made on the grounds of consistency (parsers shouldn't consume any more output than what they have matched), as well as to avoid a hang when directly parsing stdin: namely, parse() would hang waiting for a non-whitespace character at the end of a match.

You may workaround this change by adding eps_p or end_p after your grammar, as in:

my_grammar g;
my_skipper skipper;

parse(str, g >> eps_p, skipper); // 1

parse(str, g >> end_p, skipper); // 2

The 2nd option requires a full match, while the first one gets you the previous behaviour without making a full match obligatory.

Here's where the change was first announced, for context:

http://thread.gmane.org/gmane.comp.parsers.spirit.general/9839

comment:2 by cdiggins@…, 15 years ago

Resolution: wontfix
Status: closedreopened

This new change in behaviour breaks the C parser example in the repository. Others in the repository may be broken as well, I haven't checked.

comment:3 by Marshall Clow, 15 years ago

Owner: set to Joel de Guzman
Status: reopenednew

comment:4 by Joel de Guzman, 15 years ago

Resolution: fixed
Status: newclosed

Author (Hartmut Kaiser) notified and web-page note on this issue added. I shall close this now.

Note: See TracTickets for help on using tickets.