Skip to content
This repository was archived by the owner on Jun 10, 2025. It is now read-only.
This repository was archived by the owner on Jun 10, 2025. It is now read-only.

Lexer.Parse called multiple times results in errors #19

Description

@starius
#include <pire/pire.h>

int main() {
    Pire::Lexer lexer("abc");
    Pire::Scanner s1 = lexer.Parse().Compile<Pire::Scanner>();
    Pire::Scanner s2 = lexer.Parse().Compile<Pire::Scanner>();
    const char* text = "abc";
    std::cout << "abc "
              << Pire::Matches(s1, text, text + 3) << ' '
              << Pire::Matches(s2, text, text + 3) << std::endl;
    std::cout << "ab  "
              << Pire::Matches(s1, text, text + 2) << ' '
              << Pire::Matches(s2, text, text + 2) << std::endl;
    std::cout << "    "
              << Pire::Matches(s1, text, text + 0) << ' '
              << Pire::Matches(s2, text, text + 0) << std::endl;
}

Output:

abc 1 0
ab  0 0
    0 1

Expected output:

abc 1 1
ab  0 0
    0 0

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions