pub struct ParseState<'a> {
pub cursor: Cursor<'a>,
}Fields§
§cursor: Cursor<'a>Implementations§
Source§impl<'a> ParseState<'a>
impl<'a> ParseState<'a>
pub fn new(source: &'a str) -> Self
pub fn new_with_pos(source: &'a str, pos: Position) -> Self
pub fn with_cursor(cursor: Cursor<'a>) -> Self
Sourcepub fn get_context(&self, radius: usize) -> String
pub fn get_context(&self, radius: usize) -> String
获取当前位置的上下文信息
Sourcepub fn format_error_message(&self, message: &str) -> String
pub fn format_error_message(&self, message: &str) -> String
生成带有上下文的错误消息
pub fn unexpected_char(&self) -> Error
pub fn expected_char(&self, expected: char) -> Error
pub fn expected_string(&self, expected: &str) -> Error
pub fn error(&self, message: impl Into<String>) -> Error
Sourcepub fn expected_token(&self, expected: &str) -> Error
pub fn expected_token(&self, expected: &str) -> Error
期望特定的标记
Sourcepub fn syntax_error(&self, message: impl Into<String>) -> Error
pub fn syntax_error(&self, message: impl Into<String>) -> Error
语法错误
Sourcepub fn type_error(&self, message: impl Into<String>) -> Error
pub fn type_error(&self, message: impl Into<String>) -> Error
类型错误
pub fn parse_tag_attributes(&mut self) -> HashMap<String, String>
Auto Trait Implementations§
impl<'a> Freeze for ParseState<'a>
impl<'a> RefUnwindSafe for ParseState<'a>
impl<'a> Send for ParseState<'a>
impl<'a> Sync for ParseState<'a>
impl<'a> Unpin for ParseState<'a>
impl<'a> UnsafeUnpin for ParseState<'a>
impl<'a> UnwindSafe for ParseState<'a>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more