decorator syntax

This commit is contained in:
PgBiel 2024-06-07 16:38:24 -03:00
parent 6f3166dc73
commit 849bb632f7
3 changed files with 11 additions and 0 deletions

View File

@ -286,6 +286,9 @@ pub fn highlight(node: &LinkedNode) -> Option<Tag> {
SyntaxKind::Destructuring => None,
SyntaxKind::DestructAssignment => None,
// TODO
SyntaxKind::Decorator => Some(Tag::Comment),
SyntaxKind::LineComment => Some(Tag::Comment),
SyntaxKind::BlockComment => Some(Tag::Comment),
SyntaxKind::Error => Some(Tag::Error),

View File

@ -278,6 +278,9 @@ pub enum SyntaxKind {
Destructuring,
/// A destructuring assignment expression: `(x, y) = (1, 2)`.
DestructAssignment,
/// A decorator: `/! allow("amogus")`
Decorator,
}
impl SyntaxKind {
@ -498,6 +501,7 @@ impl SyntaxKind {
Self::FuncReturn => "`return` expression",
Self::Destructuring => "destructuring pattern",
Self::DestructAssignment => "destructuring assignment expression",
Self::Decorator => "decorator",
}
}
}

View File

@ -151,6 +151,10 @@ impl Lexer<'_> {
}
}
fn decorator(&mut self) -> SyntaxKind {
todo!()
}
fn line_comment(&mut self) -> SyntaxKind {
self.s.eat_until(is_newline);
SyntaxKind::LineComment