Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handle escaping the dangling right ] and right } in the regexp transpiler #9239

Merged
merged 3 commits into from
Sep 18, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ class RegularExpressionParserSuite extends AnyFunSuite {
test("not a quantifier") {
assert(parse("{1}") ===
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay so because there is nothing in front of the {1} that we do not parse it as a repetition.

RegexSequence(ListBuffer(
RegexChar('{'), RegexChar('1'),RegexChar('}'))))
RegexChar('{'), RegexChar('1'),RegexEscaped('}'))))
}

test("nested repetition") {
Expand Down Expand Up @@ -109,7 +109,7 @@ class RegularExpressionParserSuite extends AnyFunSuite {
assert(parse("[a]]") ===
RegexSequence(ListBuffer(
RegexCharacterClass(negated = false,
ListBuffer(RegexChar('a'))), RegexChar(']'))))
ListBuffer(RegexChar('a'))), RegexEscaped(']'))))
}

test("escaped brackets") {
Expand Down