summaryrefslogtreecommitdiff
path: root/crates/typst-syntax/src/lexer.rs
diff options
context:
space:
mode:
Diffstat (limited to 'crates/typst-syntax/src/lexer.rs')
-rw-r--r--crates/typst-syntax/src/lexer.rs6
1 files changed, 6 insertions, 0 deletions
diff --git a/crates/typst-syntax/src/lexer.rs b/crates/typst-syntax/src/lexer.rs
index 6b5d2816..17401044 100644
--- a/crates/typst-syntax/src/lexer.rs
+++ b/crates/typst-syntax/src/lexer.rs
@@ -103,6 +103,7 @@ impl Lexer<'_> {
self.newline = false;
let kind = match self.s.eat() {
Some(c) if is_space(c, self.mode) => self.whitespace(start, c),
+ Some('#') if start == 0 && self.s.eat_if('!') => self.shebang(),
Some('/') if self.s.eat_if('/') => self.line_comment(),
Some('/') if self.s.eat_if('*') => self.block_comment(),
Some('*') if self.s.eat_if('/') => {
@@ -151,6 +152,11 @@ impl Lexer<'_> {
}
}
+ fn shebang(&mut self) -> SyntaxKind {
+ self.s.eat_until(is_newline);
+ SyntaxKind::Shebang
+ }
+
fn line_comment(&mut self) -> SyntaxKind {
self.s.eat_until(is_newline);
SyntaxKind::LineComment