Config

Struct Config 

Source
#[non_exhaustive]
pub struct Config { pub start_line_number: NonZeroU64, pub source: Option<Rc<Source>>, }
๐Ÿ‘ŽDeprecated since 0.17.0: use yash_env::parser::Config instead
Expand 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
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.
ยงstart_line_number: NonZeroU64
๐Ÿ‘ŽDeprecated since 0.17.0: use yash_env::parser::Config instead

Line 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>>
๐Ÿ‘ŽDeprecated since 0.17.0: use yash_env::parser::Config instead

Source 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

Source

pub fn new() -> Self

๐Ÿ‘ŽDeprecated since 0.17.0: use yash_env::parser::Config instead

Creates a new configuration with default settings.

ยงDeprecation

This struct is deprecated. Use yash_env::parser::Config instead.

Source

pub fn input<'a>(self, input: Box<dyn InputObject + 'a>) -> Lexer<'a>

Creates a lexer with the given input object.

Trait Implementationsยง

Sourceยง

impl Debug for Config

Sourceยง

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Sourceยง

impl Default for Config

Sourceยง

fn default() -> Self

Returns the โ€œdefault valueโ€ for a type. Read more

Auto Trait Implementationsยง

Blanket Implementationsยง

Sourceยง

impl<T> Any for T
where T: 'static + ?Sized,

Sourceยง

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Sourceยง

impl<T> Borrow<T> for T
where T: ?Sized,

Sourceยง

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Sourceยง

impl<T> BorrowMut<T> for T
where T: ?Sized,

Sourceยง

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Sourceยง

impl<T> From<T> for T

Sourceยง

fn from(t: T) -> T

Returns the argument unchanged.

Sourceยง

impl<T, U> Into<U> for T
where U: From<T>,

Sourceยง

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Sourceยง

impl<T> IntoEither for T

Sourceยง

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 more
Sourceยง

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

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
Sourceยง

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Sourceยง

type Error = Infallible

The type returned in the event of a conversion error.
Sourceยง

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Sourceยง

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Sourceยง

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Sourceยง

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.