-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
Don’t detect arbitrary properties when preceded by an escape #15456
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -595,7 +595,7 @@ impl<'a> Extractor<'a> { | |
fn parse_start(&mut self) -> ParseAction<'a> { | ||
match self.cursor.curr { | ||
// Enter arbitrary property mode | ||
b'[' => { | ||
b'[' if self.cursor.prev != b'\\' => { | ||
trace!("Arbitrary::Start\t"); | ||
self.arbitrary = Arbitrary::Brackets { | ||
start_idx: self.cursor.pos, | ||
|
@@ -755,7 +755,7 @@ impl<'a> Extractor<'a> { | |
|
||
#[inline(always)] | ||
fn parse_char(&mut self) -> ParseAction<'a> { | ||
if !matches!(self.arbitrary, Arbitrary::None) { | ||
if !matches!(self.arbitrary, Arbitrary::None) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Not sure what happened here? 🤔 |
||
self.parse_arbitrary() | ||
} else if self.in_candidate { | ||
self.parse_continue() | ||
|
@@ -1634,4 +1634,15 @@ mod test { | |
] | ||
); | ||
} | ||
|
||
#[test] | ||
fn wip2() { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Title needs updating 😅 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. oh yeah lol good call |
||
_please_trace(); | ||
let candidates = run( | ||
r"<!-- [!code word:group-has-\\[a\\]\\:block] -->", | ||
false, | ||
); | ||
|
||
assert_eq!(candidates, vec!["!code", "a"]); | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Easy 😍