StackMaximaLexer

Struct StackMaximaLexer 

Source
pub struct StackMaximaLexer {
    pub decimal_sep: char,
    pub list_sep: char,
    pub end_tokens: Vec<char>,
    pub pm: bool,
    pub case_isensitive_keywords: bool,
    pub localised_keywords: HashMap<String, String>,
    pub lisp_ids: bool,
    /* private fields */
}
Expand description

The actual lexer object.

Fields§

§decimal_sep: char

Decimal separator. Typically, '.'.

§list_sep: char

List separator. Typically, ','.

§end_tokens: Vec<char>

Supported end_tokens. Typically, vec![';','$'].

§pm: bool

Do we support the #pm#-operator?

§case_isensitive_keywords: bool

Are keywords case insensitive? Do we convert “tRuE” to “true”?

§localised_keywords: HashMap<String, String>

Are there mappings for other keywords, in other languages?

§lisp_ids: bool

Should we identify LISP-identifiers as tokens? Set to false if you work with questions, true if you work with the STACK-backend.

Implementations§

Source§

impl StackMaximaLexer

Source

pub fn new(input: String) -> StackMaximaLexer

Source

pub fn set_source(&mut self, input: String)

Resets the token, position and char buffers of the lexer and set the input string.

Source

pub fn next_token(&mut self) -> Option<StackMaximaToken>

Tries to get the next token. Either from the char-buffer or from a token buffer if any have been returned or previous actions have generated multiple tokens.

Source

pub fn return_token(&mut self, token: StackMaximaToken)

Allows returning a token to the lexer, e.g., when the parser does its own insertions of virtual tokens.

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, 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.