Skip to content

Incorrect attribute with * and + #215

Closed
@dunkyp

Description

@dunkyp

I'm seeing a weird (off by one) error in a simple parser:

#define BOOST_PARSER_DISABLE_CONCEPTS
#include <boost/parser/parser.hpp>
#include <print>


namespace bp = boost::parser;
int main() {
  const auto id_set_action = [](auto &ctx) {
    const auto& [left, right] = _attr(ctx);
    std::println("{} = {}", left, right);
  };

  const auto id_parser = bp::char_('a', 'z') > *bp::char_('a', 'z');

  const auto id_set = (id_parser >> '=' >> id_parser)[id_set_action];
  bp::parse("left=right", id_set);
  return 0;
}

I'd expect the output of this program to be left = right however it is leftr = ight this is the case on both the master and develop branches.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions