diff options
| author | Said A. <47973576+Daaiid@users.noreply.github.com> | 2025-06-26 11:18:51 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-06-26 09:18:51 +0000 |
| commit | 5dd5771df03a666fe17930b0b071b06266e5937f (patch) | |
| tree | 68a79a843f7b813aea70733b75b7df45a938ee0d /crates/typst-syntax/src | |
| parent | 04fd0acacab8cf2e82268da9c18ef4bcf37507dc (diff) | |
Disallow empty labels and references (#5776) (#6332)
Co-authored-by: Laurenz <laurmaedje@gmail.com>
Diffstat (limited to 'crates/typst-syntax/src')
| -rw-r--r-- | crates/typst-syntax/src/ast.rs | 2 | ||||
| -rw-r--r-- | crates/typst-syntax/src/lexer.rs | 2 |
2 files changed, 3 insertions, 1 deletions
diff --git a/crates/typst-syntax/src/ast.rs b/crates/typst-syntax/src/ast.rs index 7b211bfc..547d53cd 100644 --- a/crates/typst-syntax/src/ast.rs +++ b/crates/typst-syntax/src/ast.rs @@ -724,6 +724,8 @@ node! { impl<'a> Ref<'a> { /// Get the target. + /// + /// Will not be empty. pub fn target(self) -> &'a str { self.0 .children() diff --git a/crates/typst-syntax/src/lexer.rs b/crates/typst-syntax/src/lexer.rs index 74f14cfe..82f65cd3 100644 --- a/crates/typst-syntax/src/lexer.rs +++ b/crates/typst-syntax/src/lexer.rs @@ -185,7 +185,7 @@ impl Lexer<'_> { 'h' if self.s.eat_if("ttp://") => self.link(), 'h' if self.s.eat_if("ttps://") => self.link(), '<' if self.s.at(is_id_continue) => self.label(), - '@' => self.ref_marker(), + '@' if self.s.at(is_id_continue) => self.ref_marker(), '.' if self.s.eat_if("..") => SyntaxKind::Shorthand, '-' if self.s.eat_if("--") => SyntaxKind::Shorthand, |
