diff options
Diffstat (limited to 'src/syntax')
| -rw-r--r-- | src/syntax/kind.rs | 6 | ||||
| -rw-r--r-- | src/syntax/lexer.rs | 8 | ||||
| -rw-r--r-- | src/syntax/mod.rs | 1 | ||||
| -rw-r--r-- | src/syntax/source.rs | 3 |
4 files changed, 7 insertions, 11 deletions
diff --git a/src/syntax/kind.rs b/src/syntax/kind.rs index 869d77af..c96539d1 100644 --- a/src/syntax/kind.rs +++ b/src/syntax/kind.rs @@ -4,11 +4,7 @@ #[derive(Debug, Copy, Clone, Eq, PartialEq, Hash)] #[repr(u8)] pub enum SyntaxKind { - /// Markup of which all lines must have a minimal indentation. - /// - /// Notably, the number does not determine in which column the markup - /// started, but to the right of which column all markup elements must be, - /// so it is zero except inside indent-aware constructs like lists. + /// Markup. Markup, /// Plain text without markup. Text, 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 == '-' } diff --git a/src/syntax/mod.rs b/src/syntax/mod.rs index ae12e818..c27547c4 100644 --- a/src/syntax/mod.rs +++ b/src/syntax/mod.rs @@ -14,6 +14,5 @@ pub use self::kind::*; pub use self::lexer::*; pub use self::node::*; pub use self::parser::*; -pub use self::reparser::*; pub use self::source::*; pub use self::span::*; diff --git a/src/syntax/source.rs b/src/syntax/source.rs index 607a2603..052e841a 100644 --- a/src/syntax/source.rs +++ b/src/syntax/source.rs @@ -9,7 +9,8 @@ use comemo::Prehashed; use unscanny::Scanner; use super::ast::Markup; -use super::{is_newline, parse, reparse, LinkedNode, Span, SyntaxNode}; +use super::reparser::reparse; +use super::{is_newline, parse, LinkedNode, Span, SyntaxNode}; use crate::diag::SourceResult; use crate::util::{PathExt, StrExt}; |
