diff options
Diffstat (limited to 'src/syntax/lexer.rs')
| -rw-r--r-- | src/syntax/lexer.rs | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/syntax/lexer.rs b/src/syntax/lexer.rs index 8e27d98d..3fea3fe1 100644 --- a/src/syntax/lexer.rs +++ b/src/syntax/lexer.rs @@ -473,7 +473,7 @@ impl Lexer<'_> { c if is_id_start(c) => self.ident(start), - _ => self.error("not valid here"), + _ => self.error("this character is not valid in code"), } } @@ -634,7 +634,7 @@ fn count_newlines(text: &str) -> usize { newlines } -/// Whether a string is a valid unicode identifier. +/// Whether a string is a valid Typst identifier. /// /// In addition to what is specified in the [Unicode Standard][uax31], we allow: /// - `_` as a starting character, @@ -651,13 +651,13 @@ pub fn is_ident(string: &str) -> bool { /// Whether a character can start an identifier. #[inline] -pub fn is_id_start(c: char) -> bool { +pub(crate) fn is_id_start(c: char) -> bool { c.is_xid_start() || c == '_' } /// Whether a character can continue an identifier. #[inline] -pub fn is_id_continue(c: char) -> bool { +pub(crate) fn is_id_continue(c: char) -> bool { c.is_xid_continue() || c == '_' || c == '-' } |
