pub struct Parser<'a> {
str: &'a [u8],
pos: usize,
len: usize,
line: usize,
line_index: usize,
encoding: Encoding,
}
Available on crate feature
artemis
only.Expand description
A parser for Artemis AST scripts.
Fields§
§str: &'a [u8]
§pos: usize
§len: usize
§line: usize
§line_index: usize
§encoding: Encoding
Implementations§
Source§impl<'a> Parser<'a>
impl<'a> Parser<'a>
Sourcepub fn new<S: AsRef<[u8]> + ?Sized>(str: &'a S, encoding: Encoding) -> Self
pub fn new<S: AsRef<[u8]> + ?Sized>(str: &'a S, encoding: Encoding) -> Self
Creates a new parser for the given string with the specified encoding.
str
- The string to parse.encoding
- The encoding of the string.
Sourcepub fn try_parse_header(self) -> Result<()>
pub fn try_parse_header(self) -> Result<()>
Checks if input is a valid header for an AST file.
fn parse_equal(&mut self) -> Result<()>
fn parse_value(&mut self) -> Result<Value>
fn parse_array(&mut self) -> Result<Value>
fn parse_any_number(&mut self) -> Result<Value>
fn parse_any_str(&mut self) -> Result<String>
fn parse_f64(&mut self) -> Result<f64>
fn parse_str(&mut self) -> Result<String>
fn parse_raw_str(&mut self) -> Result<String>
fn erase_whitespace(&mut self)
fn next(&mut self) -> Option<u8>
fn peek(&self) -> Option<u8>
fn parse_key_val(&mut self) -> Result<Value>
fn get_indent(&mut self) -> Result<Value>
fn is_indent(&self, indent: &[u8]) -> bool
fn parse_indent(&mut self, indent: &[u8]) -> Result<()>
fn eat_char(&mut self)
fn error2<T>(&self, msg: T) -> Errorwhere
T: Display,
fn error<T, A>(&self, msg: T) -> Result<A>where
T: Display,
Auto Trait Implementations§
impl<'a> Freeze for Parser<'a>
impl<'a> RefUnwindSafe for Parser<'a>
impl<'a> Send for Parser<'a>
impl<'a> Sync for Parser<'a>
impl<'a> Unpin for Parser<'a>
impl<'a> UnwindSafe for Parser<'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
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more