summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPgBiel <9021226+PgBiel@users.noreply.github.com>2024-06-07 16:38:24 -0300
committerPgBiel <9021226+PgBiel@users.noreply.github.com>2024-06-26 12:17:53 -0300
commit849bb632f77c6543c7e9979c9cbef46029a2f0c3 (patch)
treee37f0ac0b9bd598819e8ad78db29cf61d049d2de
parent6f3166dc7367a65d43afa6f2d0ab289e6de9a85e (diff)
decorator syntax
-rw-r--r--crates/typst-syntax/src/highlight.rs3
-rw-r--r--crates/typst-syntax/src/kind.rs4
-rw-r--r--crates/typst-syntax/src/lexer.rs4
3 files changed, 11 insertions, 0 deletions
diff --git a/crates/typst-syntax/src/highlight.rs b/crates/typst-syntax/src/highlight.rs
index 0c1f3d5f..7128c358 100644
--- a/crates/typst-syntax/src/highlight.rs
+++ b/crates/typst-syntax/src/highlight.rs
@@ -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),
diff --git a/crates/typst-syntax/src/kind.rs b/crates/typst-syntax/src/kind.rs
index 7505dbc6..769cdd72 100644
--- a/crates/typst-syntax/src/kind.rs
+++ b/crates/typst-syntax/src/kind.rs
@@ -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",
}
}
}
diff --git a/crates/typst-syntax/src/lexer.rs b/crates/typst-syntax/src/lexer.rs
index dd05e73f..502c458d 100644
--- a/crates/typst-syntax/src/lexer.rs
+++ b/crates/typst-syntax/src/lexer.rs
@@ -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