#[non_exhaustive]pub struct Config<'a> {
pub input: Box<dyn InputObject + 'a>,
pub start_line_number: NonZeroU64,
pub source: Option<Rc<Source>>,
}Expand description
Configuration for the parser
This struct holds various configuration options for the parser, including the input function to read source code and source information.
Parser implementations are not provided in this crate (yash-env). The
standard parser implementation is provided in the yash-syntax crate.
Config is provided here so that other crates can use RunReadEvalLoop
without depending on yash-syntax.
Since this struct is marked as #[non_exhaustive], you cannot construct it
directly. Instead, use the with_input function to
create a Config instance, and then modify its fields as necessary.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.input: Box<dyn InputObject + 'a>Input function to read source code
start_line_number: NonZeroU64Line number for the first line of the input
The lexer counts lines starting from this number. This affects the
start_line_number field of the Code instance attached to the
parsed AST.
The default value is 1.
source: Option<Rc<Source>>Source information for the input
If provided, this source information is saved in the source field of
the Code instance attached to the parsed AST.
The default value is None, in which case Source::Unknown is used.
Implementations§
Source§impl<'a> Config<'a>
impl<'a> Config<'a>
Sourcepub fn with_input(input: Box<dyn InputObject + 'a>) -> Self
pub fn with_input(input: Box<dyn InputObject + 'a>) -> Self
Creates a Config with the given input function.
Trait Implementations§
Auto Trait Implementations§
impl<'a> Freeze for Config<'a>
impl<'a> !RefUnwindSafe for Config<'a>
impl<'a> !Send for Config<'a>
impl<'a> !Sync for Config<'a>
impl<'a> Unpin for Config<'a>
impl<'a> !UnwindSafe for Config<'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
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>
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>
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