Opened 6 years ago

Last modified 5 years ago

#12208 new Bugs

Lexer does not work with boost::spirit::istream_iterator

Reported by: edaskel@… Owned by: Hartmut Kaiser
Milestone: To Be Determined Component: wave
Version: Boost 1.61.0 Severity: Problem
Keywords: Cc:

Description

According to the documentation, any forward iterator should be usable for the input stream iterator. boost::spirit::istream_iterator is a forward iterator, yet I find boost::wave::lexing_exception is called when it is used instead of std::string_iterator. Further, the Changelog has this to say:

TODO (known issues): ...

  • Fix the re2c lexer for iterators others then string::iterator (or more generally for iterators, which aren't random access iterators)

which implies that this is a known problem.

Either the documentation should indicate that a random access iterator is required (and this should be enforced with an iterator traits check), or the code should be fixed to only require a forward iterator.

Attachments (1)

wave_testcase1.cpp (1.6 KB ) - added by edaskel@… 6 years ago.
test case demonstrating a failure with forward iterator

Download all attachments as: .zip

Change History (3)

by edaskel@…, 6 years ago

Attachment: wave_testcase1.cpp added

test case demonstrating a failure with forward iterator

comment:1 by edaskel@…, 5 years ago

So the issue is basically here. We take the address of the first element of the input and assume the rest is lined up in memory behind it. I'm looking at solutions - the most obvious is to make a copy, but Wave already makes one copy of the input and I'm not convinced even that should be necessary.

comment:2 by anonymous, 5 years ago

This issue was resolved by merging https://github.com/boostorg/wave/pull/21 and may be closed.

Note: See TracTickets for help on using tickets.