mirror of
https://github.com/danbulant/oxc
synced 2026-05-24 12:21:58 +00:00
fix(parser): fix additional char being consumed in JSXText (#259)
This commit is contained in:
parent
6fca022982
commit
b17181a0c4
1 changed files with 11 additions and 5 deletions
|
|
@ -1128,10 +1128,17 @@ impl<'a> Lexer<'a> {
|
|||
/// `JSXFragment`
|
||||
/// { `JSXChildExpressionopt` }
|
||||
fn read_jsx_child(&mut self) -> Kind {
|
||||
match self.current.chars.next() {
|
||||
Some('<') => Kind::LAngle,
|
||||
Some('{') => Kind::LCurly,
|
||||
Some(c) => {
|
||||
match self.peek() {
|
||||
'<' => {
|
||||
self.current.chars.next();
|
||||
Kind::LAngle
|
||||
}
|
||||
'{' => {
|
||||
self.current.chars.next();
|
||||
Kind::LCurly
|
||||
}
|
||||
EOF => Kind::Eof,
|
||||
c => {
|
||||
let mut builder = AutoCow::new(self);
|
||||
builder.push_matching(c);
|
||||
loop {
|
||||
|
|
@ -1149,7 +1156,6 @@ impl<'a> Lexer<'a> {
|
|||
self.current.token.value = self.string_to_token_value(builder.finish(self));
|
||||
Kind::JSXText
|
||||
}
|
||||
None => Kind::Eof,
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue