#[non_exhaustive]pub struct Config {
pub start_line_number: NonZeroU64,
pub source: Option<Rc<Source>>,
}yash_env::parser::Config insteadExpand description
Configuration for the lexer
Config is a builder for the lexer. A new instance is created
with default settings. You can then customize the settings by modifying the
corresponding fields. Finally, you can pass an input object to the
input method to create a lexer.
ยงDeprecation
This struct is deprecated. Use yash_env::parser::Config instead.
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.start_line_number: NonZeroU64yash_env::parser::Config insteadLine number for the first line of the input
The lexer counts the line number from this value to annotate the
location of the tokens. The line number is saved in the
start_line_number field of the Code instance that is contained in
the Location instance of the token.
The default value is 1.
source: Option<Rc<Source>>yash_env::parser::Config insteadSource of the input
The source is used to annotate the location of the tokens. This value
is saved in the source field of the Code instance that is
contained in the Location instance of the token.
The default value is None, in which case the source is set to
Source::Unknown. It is recommended to set this to a more informative
value, so that the locations in the parsed syntax tree can be traced
back to the source code. Especially, the correct source is necessary to
indicate the location of possible errors that occur during parsing and
execution.
Implementationsยง
Sourceยงimpl Config
impl Config
Sourcepub fn new() -> Self
๐Deprecated since 0.17.0: use yash_env::parser::Config instead
pub fn new() -> Self
yash_env::parser::Config insteadCreates a new configuration with default settings.
ยงDeprecation
This struct is deprecated. Use yash_env::parser::Config instead.
Sourcepub fn input<'a>(self, input: Box<dyn InputObject + 'a>) -> Lexer<'a>
pub fn input<'a>(self, input: Box<dyn InputObject + 'a>) -> Lexer<'a>
Creates a lexer with the given input object.
Trait Implementationsยง
Auto Trait Implementationsยง
impl Freeze for Config
impl !RefUnwindSafe for Config
impl !Send for Config
impl !Sync for Config
impl Unpin for Config
impl !UnwindSafe for Config
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