Struct lexpr::parse::Options

source ·
pub struct Options { /* private fields */ }
Expand description

Various options to influence parser behavior.

Implementations§

source§

impl Options

source

pub fn new() -> Self

Construct an empty set of options.

This will recognize no keywords, and parse nil and t as regular symbols.

source

pub fn elisp() -> Self

Construct a set of options suitable for parsing Emacs Lisp.

source

pub fn with_keyword_syntax(self, syntax: KeywordSyntax) -> Self

Add syntax to the recognized keyword syntaxes.

source

pub fn with_keyword_syntaxes<I, T>(self, styles: I) -> Selfwhere I: IntoIterator<Item = T>, T: Borrow<KeywordSyntax>,

Set the recognized keyword syntaxes.

source

pub fn with_nil_symbol(self, treatment: NilSymbol) -> Self

Choose how to parse the nil symbol.

source

pub fn with_t_symbol(self, treatment: TSymbol) -> Self

Choose how to parse the t symbol.

source

pub fn with_brackets(self, treatment: Brackets) -> Self

Choose how to handle brackets.

source

pub fn with_string_syntax(self, syntax: StringSyntax) -> Self

Choose the accepted string syntax.

source

pub fn with_char_syntax(self, syntax: CharSyntax) -> Self

Choose the accepted character syntax.

source

pub fn keyword_syntax(self, syntax: KeywordSyntax) -> bool

Check wether a keyword syntax is enabled.

source

pub fn nil_symbol(self) -> NilSymbol

Query the way the nil symbol is handled.

source

pub fn t_symbol(self) -> TSymbol

Query the way the t symbol is handled.

source

pub fn brackets(self) -> Brackets

Query the way brackets are handled.

source

pub fn string_syntax(self) -> StringSyntax

Query the accepted string syntax.

source

pub fn char_syntax(self) -> CharSyntax

Query the accepted character syntax.

Trait Implementations§

source§

impl Clone for Options

source§

fn clone(&self) -> Options

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for Options

source§

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

Formats the value using the given formatter. Read more
source§

impl Default for Options

source§

fn default() -> Self

Construct a default set of options. This corresponds most closely to the Scheme dialect of S-expressions:

  • The identifiers nil and t are treated as regular symbols.
  • Only octothorpe keywords are recognized.
  • Brackets are treated just like parentheses, i.e. indicating a list.
source§

impl Copy for Options

Auto Trait Implementations§

Blanket Implementations§

source§

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

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

const: unstable · source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

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

const: unstable · source§

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

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

const: unstable · source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

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

const: unstable · 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> ToOwned for Twhere T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

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

§

type Error = Infallible

The type returned in the event of a conversion error.
const: unstable · source§

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

Performs the conversion.
source§

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

§

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

The type returned in the event of a conversion error.
const: unstable · source§

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

Performs the conversion.