Struct rslint_parser::ParserState[][src]

pub struct ParserState {
Show 22 fields pub allow_object_expr: bool, pub include_in: bool, pub continue_allowed: bool, pub break_allowed: bool, pub labels: HashMap<String, Range<usize>>, pub in_generator: bool, pub in_function: bool, pub potential_arrow_start: bool, pub in_async: bool, pub strict: Option<StrictMode>, pub is_module: bool, pub default_item: Option<Range<usize>>, pub expr_recovery_set: TokenSet, pub should_record_names: bool, pub name_map: HashMap<String, Range<usize>>, pub in_cond_expr: bool, pub in_case_cond: bool, pub in_declare: bool, pub in_binding_list_for_signature: bool, pub decorators_were_valid: bool, pub in_default: bool, pub for_head_error: Option<Diagnostic>, // some fields omitted
}
Expand description

State kept by the parser while parsing. It is required for things such as strict mode or async functions

Fields

allow_object_expr: bool

If false, object expressions are not allowed to be parsed inside an expression.

Also applies for object patterns

include_in: bool

Whether in should be counted in a binary expression this is for for...in statements to prevent ambiguity.

continue_allowed: bool

Whether the parser is in an iteration statement and continue is allowed.

break_allowed: bool

Whether the parser is in an iteration or switch statement and break is allowed.

labels: HashMap<String, Range<usize>>

A list of labels for labelled statements used to report undefined label errors for break and continue, as well as duplicate labels

in_generator: bool

Whether the parser is in a generator function like function* a() {}

in_function: bool

Whether the parser is inside of a function

potential_arrow_start: bool

Whether we potentially are in a place to parse an arrow expression

in_async: bool

Whether we are in an async function

strict: Option<StrictMode>

Whether we are in strict mode code

is_module: bool

Whether the code we are parsing is a module

default_item: Option<Range<usize>>

The exported default item, used for checking duplicate defaults

expr_recovery_set: TokenSet

The recovery set primary_expr will use

should_record_names: boolname_map: HashMap<String, Range<usize>>in_cond_expr: bool

Whether the parser is in a conditional expr (ternary expr)

in_case_cond: boolin_declare: boolin_binding_list_for_signature: booldecorators_were_valid: boolin_default: boolfor_head_error: Option<Diagnostic>

Implementations

Check for duplicate defaults and update state

Turn on strict mode and issue a warning for redundant strict mode declarations

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Returns the “default value” for a type. Read more

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

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

Unerase this erased pointer. Read more

Whether this implementor has acknowledged the 1.1.0 update to unerase’s documented implementation requirements. Read more

Turn this erasable pointer into an erased pointer. Read more

Performs the conversion.

Performs the conversion.

The resulting type after obtaining ownership.

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

🔬 This is a nightly-only experimental API. (toowned_clone_into)

recently added

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

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.