fix decorator lexing with wrong offsets

This commit is contained in:
PgBiel 2024-06-18 19:07:07 -03:00
parent 1623a9135d
commit ad6cc41261

View File

@ -199,7 +199,7 @@ impl Lexer<'_> {
/// Decorators.
impl Lexer<'_> {
fn decorator(&mut self) -> SyntaxKind {
let start = self.s.cursor() - 1;
let start = self.s.cursor() - 2;
self.decorator.clear();
@ -227,8 +227,11 @@ impl Lexer<'_> {
self.decorator.push((token, end));
}
// The saved tokens will be removed in reverse.
self.decorator.reverse();
// Already collected all we need from the decorator.
self.s.jump(start + 1);
self.s.jump(start + 2);
SyntaxKind::Decorator
}