Skip to content

Commit 311ad96

Browse files
chore: reserve control escape
1 parent 54cf358 commit 311ad96

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/parse.mbt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -508,6 +508,8 @@ fn Parser::parse_factor(self : Parser) -> Regex raise Error_ {
508508
}
509509
Backreference(capture)
510510
}
511+
// reserve c
512+
'c' => raise Error_(err=InvalidEscape, data=self.input)
511513
_ =>
512514
if self.flags.ignore_case {
513515
CharClass(case_insensitive_char_class([c, c]), neg=false)
@@ -564,6 +566,7 @@ fn Parser::parse_char_class(self : Parser) -> Regex raise Error_ {
564566
}
565567
let chars = []
566568
while self.input is [ch, .. rest] && ch != ']' {
569+
let escape = rest
567570
let start_char = match ch {
568571
'\\' => {
569572
guard rest is [ch, .. rest] else {
@@ -639,6 +642,8 @@ fn Parser::parse_char_class(self : Parser) -> Regex raise Error_ {
639642
}
640643
continue
641644
}
645+
// reserve c and k
646+
'c' | 'k' => raise Error_(err=InvalidEscape, data=escape)
642647
_ => ch
643648
}
644649
}

0 commit comments

Comments
 (0)