Skip to content

bug(syntax): Panic when Parser is used twice #1392

Description

@langston-barrett

What version of regex are you using?

0.8.11

Describe the bug at a high level.

Parser panics if it is used twice

What are the steps to reproduce the behavior?

fn main() {
    let mut p = regex_syntax::ast::parse::Parser::new();
    p.parse("a").unwrap(); // ok
    p.parse("a");          // panics
}

What is the actual behavior?

thread 'main' (13) panicked at /playground/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/regex-syntax-0.8.11/src/ast/parse.rs:983:9:
assertion `left == right` failed: parser can only be used once
  left: 1
 right: 0

What is the expected behavior?

Ok(...), because there is no documented panic: https://docs.rs/regex-syntax/latest/regex_syntax/struct.Parser.html#method.parse

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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