summaryrefslogtreecommitdiff
path: root/crates/typst-syntax
diff options
context:
space:
mode:
Diffstat (limited to 'crates/typst-syntax')
-rw-r--r--crates/typst-syntax/src/parser.rs9
1 files changed, 8 insertions, 1 deletions
diff --git a/crates/typst-syntax/src/parser.rs b/crates/typst-syntax/src/parser.rs
index f1c798c6..9397952f 100644
--- a/crates/typst-syntax/src/parser.rs
+++ b/crates/typst-syntax/src/parser.rs
@@ -1685,7 +1685,14 @@ impl<'s> Parser<'s> {
if at {
self.eat();
} else if kind == SyntaxKind::Ident && self.current.is_keyword() {
- self.expected_found(kind.name(), self.current.name());
+ let found_text = self.current_text();
+ let found = self.current.name();
+ self.expected_found(kind.name(), found);
+ self.hint(eco_format!(
+ "{} is not allowed as an identifier; try `{}_` instead",
+ found,
+ found_text
+ ));
} else {
self.balanced &= !kind.is_grouping();
self.expected(kind.name());