diff options
| author | PgBiel <9021226+PgBiel@users.noreply.github.com> | 2024-06-10 19:03:38 -0300 |
|---|---|---|
| committer | PgBiel <9021226+PgBiel@users.noreply.github.com> | 2024-06-26 12:17:53 -0300 |
| commit | 9f9ba7ba5a6442853a735e4d3454fc664bae2e66 (patch) | |
| tree | cab4ebe16836052a7b0fdd5e30d3915c6f081ec7 | |
| parent | ad6cc41261a72517e44fad99269c888c4310f796 (diff) | |
separate DecoratorMarker from Decorator
| -rw-r--r-- | crates/typst-syntax/src/highlight.rs | 4 | ||||
| -rw-r--r-- | crates/typst-syntax/src/kind.rs | 3 | ||||
| -rw-r--r-- | crates/typst-syntax/src/lexer.rs | 2 |
3 files changed, 6 insertions, 3 deletions
diff --git a/crates/typst-syntax/src/highlight.rs b/crates/typst-syntax/src/highlight.rs index 7128c358..59cad25e 100644 --- a/crates/typst-syntax/src/highlight.rs +++ b/crates/typst-syntax/src/highlight.rs @@ -286,8 +286,8 @@ pub fn highlight(node: &LinkedNode) -> Option<Tag> { SyntaxKind::Destructuring => None, SyntaxKind::DestructAssignment => None, - // TODO - SyntaxKind::Decorator => Some(Tag::Comment), + SyntaxKind::DecoratorMarker => Some(Tag::Comment), + SyntaxKind::Decorator => None, SyntaxKind::LineComment => Some(Tag::Comment), SyntaxKind::BlockComment => Some(Tag::Comment), diff --git a/crates/typst-syntax/src/kind.rs b/crates/typst-syntax/src/kind.rs index 769cdd72..b9ccf45c 100644 --- a/crates/typst-syntax/src/kind.rs +++ b/crates/typst-syntax/src/kind.rs @@ -13,6 +13,8 @@ pub enum SyntaxKind { LineComment, /// A block comment: `/* ... */`. BlockComment, + /// A decorator's marker: `/!` + DecoratorMarker, /// The contents of a file or content block. Markup, @@ -374,6 +376,7 @@ impl SyntaxKind { Self::Error => "syntax error", Self::LineComment => "line comment", Self::BlockComment => "block comment", + Self::DecoratorMarker => "decorator marker", Self::Markup => "markup", Self::Text => "text", Self::Space => "space", diff --git a/crates/typst-syntax/src/lexer.rs b/crates/typst-syntax/src/lexer.rs index e08b4501..05b12570 100644 --- a/crates/typst-syntax/src/lexer.rs +++ b/crates/typst-syntax/src/lexer.rs @@ -233,7 +233,7 @@ impl Lexer<'_> { // Already collected all we need from the decorator. self.s.jump(start + 2); - SyntaxKind::Decorator + SyntaxKind::DecoratorMarker } } |
