pub struct ParseState<'e> {
    pub tokenizer_control: TokenizerControl,
    pub expr_filter: fn(_: &Token) -> bool,
    pub scope: &'e Scope<'e>,
    pub global: GlobalRuntimeState<'e>,
    pub stack: Scope<'e>,
    pub block_stack_len: usize,
    pub external_vars: Vec<Ident>,
    pub allow_capture: bool,
    pub imports: StaticVec<ImmutableString>,
    pub global_imports: StaticVec<ImmutableString>,
    pub max_expr_depth: usize,
    /* private fields */
}
Expand description

(internals) A type that encapsulates the current state of the parser. Exported under the internals feature only.

Fields

tokenizer_control: TokenizerControl

Input stream buffer containing the next character to read.

expr_filter: fn(_: &Token) -> bool

Controls whether parsing of an expression should stop given the next token.

scope: &'e Scope<'e>

External scope with constants.

global: GlobalRuntimeState<'e>

Global runtime state.

stack: Scope<'e>

Encapsulates a local stack with variable names to simulate an actual runtime scope.

block_stack_len: usize

Size of the local variables stack upon entry of the current block scope.

external_vars: Vec<Ident>

Tracks a list of external variables (variables that are not explicitly declared in the scope).

allow_capture: bool

An indicator that disables variable capturing into externals one single time up until the nearest consumed Identifier token. If set to false the next call to access_var will not capture the variable. All consequent calls to access_var will not be affected.

imports: StaticVec<ImmutableString>

Encapsulates a local stack with imported module names.

global_imports: StaticVec<ImmutableString>

List of globally-imported module names.

max_expr_depth: usize

Maximum levels of expression nesting (0 for unlimited).

Implementations

Create a new ParseState.

Find explicitly declared variable by name in the ParseState, searching in reverse order.

The first return value is the offset to be deducted from ParseState::stack::len(), i.e. the top element of ParseState’s variables stack is offset 1.

If the variable is not present in the scope, the first return value is zero.

The second return value indicates whether the barrier has been hit before finding the variable.

Find explicitly declared variable by name in the ParseState, searching in reverse order.

If the variable is not present in the scope adds it to the list of external variables.

The return value is the offset to be deducted from ParseState::stack::len(), i.e. the top element of ParseState’s variables stack is offset 1.

Return value: (index, is_func_name)
  • index: None when the variable name is not found in the stack, otherwise the index value.

  • is_func_name: true if the variable is actually the name of a function (in which case it will be converted into a function pointer).

Find a module by name in the ParseState, searching in reverse.

Returns the offset to be deducted from Stack::len, i.e. the top element of the ParseState is offset 1.

Returns None when the variable name is not found in the ParseState.

Panics

Panics when called under no_module.

Get an interned string, creating one if it is not yet interned.

Get an interned property getter, creating one if it is not yet interned.

Get an interned property setter, creating one if it is not yet interned.

Trait Implementations

Formats the value using the given formatter. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

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

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.