mirror of
https://github.com/typst/typst
synced 2025-05-14 17:15:28 +08:00
decorator syntax
This commit is contained in:
parent
6f3166dc73
commit
849bb632f7
@ -286,6 +286,9 @@ pub fn highlight(node: &LinkedNode) -> Option<Tag> {
|
|||||||
SyntaxKind::Destructuring => None,
|
SyntaxKind::Destructuring => None,
|
||||||
SyntaxKind::DestructAssignment => None,
|
SyntaxKind::DestructAssignment => None,
|
||||||
|
|
||||||
|
// TODO
|
||||||
|
SyntaxKind::Decorator => Some(Tag::Comment),
|
||||||
|
|
||||||
SyntaxKind::LineComment => Some(Tag::Comment),
|
SyntaxKind::LineComment => Some(Tag::Comment),
|
||||||
SyntaxKind::BlockComment => Some(Tag::Comment),
|
SyntaxKind::BlockComment => Some(Tag::Comment),
|
||||||
SyntaxKind::Error => Some(Tag::Error),
|
SyntaxKind::Error => Some(Tag::Error),
|
||||||
|
@ -278,6 +278,9 @@ pub enum SyntaxKind {
|
|||||||
Destructuring,
|
Destructuring,
|
||||||
/// A destructuring assignment expression: `(x, y) = (1, 2)`.
|
/// A destructuring assignment expression: `(x, y) = (1, 2)`.
|
||||||
DestructAssignment,
|
DestructAssignment,
|
||||||
|
|
||||||
|
/// A decorator: `/! allow("amogus")`
|
||||||
|
Decorator,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl SyntaxKind {
|
impl SyntaxKind {
|
||||||
@ -498,6 +501,7 @@ impl SyntaxKind {
|
|||||||
Self::FuncReturn => "`return` expression",
|
Self::FuncReturn => "`return` expression",
|
||||||
Self::Destructuring => "destructuring pattern",
|
Self::Destructuring => "destructuring pattern",
|
||||||
Self::DestructAssignment => "destructuring assignment expression",
|
Self::DestructAssignment => "destructuring assignment expression",
|
||||||
|
Self::Decorator => "decorator",
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -151,6 +151,10 @@ impl Lexer<'_> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn decorator(&mut self) -> SyntaxKind {
|
||||||
|
todo!()
|
||||||
|
}
|
||||||
|
|
||||||
fn line_comment(&mut self) -> SyntaxKind {
|
fn line_comment(&mut self) -> SyntaxKind {
|
||||||
self.s.eat_until(is_newline);
|
self.s.eat_until(is_newline);
|
||||||
SyntaxKind::LineComment
|
SyntaxKind::LineComment
|
||||||
|
Loading…
x
Reference in New Issue
Block a user