[][src]Struct rslint_parser::ParserState

pub struct ParserState {
    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,
}

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

Fields

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

Implementations

impl ParserState[src]

pub fn module() -> Self[src]

pub fn check_default(
    &mut self,
    p: &mut Parser<'_>,
    marker: CompletedMarker
) -> CompletedMarker
[src]

Check for duplicate defaults and update state

pub fn iteration_stmt(&mut self, set: bool)[src]

pub fn strict(&mut self, p: &mut Parser<'_>, range: Range<usize>)[src]

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

Trait Implementations

impl Clone for ParserState[src]

impl Debug for ParserState[src]

impl Default for ParserState[src]

impl Eq for ParserState[src]

impl PartialEq<ParserState> for ParserState[src]

impl StructuralEq for ParserState[src]

impl StructuralPartialEq for ParserState[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Erasable for T

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.