Struct quad_compat_rhai::ParseState[][src]

pub struct ParseState<'e> {
    pub engine: &'e Engine,
    pub tokenizer_control: TokenizerControl,
    pub interned_strings: IdentifierBuilder,
    pub stack: StaticVec<(Identifier, AccessMode)>,
    pub entry_stack_len: usize,
    pub external_vars: BTreeMap<Identifier, Position>,
    pub allow_capture: bool,
    pub modules: StaticVec<Identifier>,
    pub max_expr_depth: Option<NonZeroUsize>,
    pub max_function_expr_depth: Option<NonZeroUsize>,
}
Expand description

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

Fields

engine: &'e Engine

Reference to the scripting Engine.

tokenizer_control: TokenizerControl

Input stream buffer containing the next character to read.

interned_strings: IdentifierBuilder

Interned strings.

stack: StaticVec<(Identifier, AccessMode)>

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

entry_stack_len: usize

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

external_vars: BTreeMap<Identifier, Position>

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

modules: StaticVec<Identifier>

Encapsulates a local stack with imported module names.

max_expr_depth: Option<NonZeroUsize>

Maximum levels of expression nesting.

max_function_expr_depth: Option<NonZeroUsize>

Maximum levels of expression nesting in functions.

Implementations

Create a new ParseState.

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 None when the variable name is not found in the stack.

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.

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

Performs the conversion.

Performs the conversion.

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.