Struct SfcParser

Source
pub struct SfcParser<'i, 'e, 'p> {
    pub ignore_empty: bool,
    /* private fields */
}

Fields§

§ignore_empty: bool

Implementations§

Source§

impl SfcParser<'_, '_, '_>

Source

pub fn process_element_attributes( &mut self, raw_attributes: Vec<Attribute>, attrs_or_bindings: &mut Vec<AttributeOrBinding>, vue_directives: &mut Option<Box<VueDirectives>>, ) -> bool

Returns true when v-pre is discovered

Source

pub fn try_parse_directive( &mut self, raw_attribute: Attribute, attrs_or_bindings: &mut Vec<AttributeOrBinding>, vue_directives: &mut Option<Box<VueDirectives>>, ) -> Result<(), Attribute>

Returns true if it was recognized as a directive (regardless if it was successfully parsed)

Source§

impl SfcParser<'_, '_, '_>

Source§

impl SfcParser<'_, '_, '_>

Source

pub fn parse_sfc_script_element( &mut self, element: Element, ) -> Result<Option<SfcScriptBlock>, ParseError>

Parses the <script> and <script setup>, both in EcmaScript and TypeScript

Source

pub fn parse_module( &mut self, raw: &str, syntax: Syntax, span: Span, ) -> Result<Module, ParseError>

Source

pub fn parse_expr( &mut self, raw: &str, syntax: Syntax, span: Span, ) -> Result<Box<Expr>, ParseError>

Source

pub fn parse_pat( &mut self, raw: &str, syntax: Syntax, span: Span, ) -> Result<Pat, ParseError>

Source§

impl SfcParser<'_, '_, '_>

Source

pub fn parse_sfc(&mut self) -> Result<SfcDescriptor, ParseError>

Parses self.input as an SFC, producing an SfcDescriptor. When Err(ParseError) is returned, that means unrecoverable error was discovered.

Source

pub fn parse_html_document_fragment( &mut self, ) -> Result<DocumentFragment, Error>

Adapted from swc_html_parser

Source

pub fn use_rawtext_content( &mut self, element_content: Option<&DocumentFragment>, element_children: &[Child], ) -> Option<(&str, Span)>

Gets the raw contents of Element and also clears errors related to parsing it

Source

pub fn report_error(&mut self, error: ParseError)

Source§

impl SfcParser<'_, '_, '_>

Source

pub fn parse_sfc_style_element( &mut self, element: Element, ) -> Option<SfcStyleBlock>

Source§

impl SfcParser<'_, '_, '_>

Source

pub fn parse_template_to_ir( &mut self, root_element: Element, ) -> Option<SfcTemplateBlock>

Source§

impl<'i, 'e> SfcParser<'i, 'e, 'static>

Source

pub fn new(input: &'i str, errors: &'e mut Vec<ParseError>) -> Self

Trait Implementations§

Source§

impl<'i, 'e, 'p> Debug for SfcParser<'i, 'e, 'p>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<'i, 'e, 'p> Freeze for SfcParser<'i, 'e, 'p>

§

impl<'i, 'e, 'p> !RefUnwindSafe for SfcParser<'i, 'e, 'p>

§

impl<'i, 'e, 'p> !Send for SfcParser<'i, 'e, 'p>

§

impl<'i, 'e, 'p> !Sync for SfcParser<'i, 'e, 'p>

§

impl<'i, 'e, 'p> Unpin for SfcParser<'i, 'e, 'p>

§

impl<'i, 'e, 'p> !UnwindSafe for SfcParser<'i, 'e, 'p>

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> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
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.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

impl<T> ErasedDestructor for T
where T: 'static,

Source§

impl<T> Send for T
where T: ?Sized,

Source§

impl<T> Sync for T
where T: ?Sized,