pub struct DeclarationParserState<'i> {
output_block: PropertyDeclarationBlock,
declarations: SourcePropertyDeclaration,
importance: Importance,
errors: SmallVec<[(ParseError<'i>, &'i str, Option<PropertyId>); 2]>,
first_declaration_start: SourceLocation,
last_parsed_property_id: Option<PropertyId>,
}
Expand description
The state needed to parse a declaration block.
It stores declarations in output_block.
Fields§
§output_block: PropertyDeclarationBlock
The output block where results are stored.
declarations: SourcePropertyDeclaration
Declarations from the last declaration parsed. (note that a shorthand might expand to multiple declarations).
importance: Importance
The importance from the last declaration parsed.
errors: SmallVec<[(ParseError<'i>, &'i str, Option<PropertyId>); 2]>
A list of errors that have happened so far. Not all of them might be reported.
first_declaration_start: SourceLocation
The start of the first declaration
last_parsed_property_id: Option<PropertyId>
The last parsed property id, if any.
Implementations§
Source§impl<'i> DeclarationParserState<'i>
impl<'i> DeclarationParserState<'i>
Sourcepub fn first_declaration_start(&self) -> SourceLocation
pub fn first_declaration_start(&self) -> SourceLocation
Getter for first_declaration_start.
Sourcepub fn has_parsed_declarations(&self) -> bool
pub fn has_parsed_declarations(&self) -> bool
Returns whether any parsed declarations have been parsed so far.
Sourcepub fn take_declarations(&mut self) -> PropertyDeclarationBlock
pub fn take_declarations(&mut self) -> PropertyDeclarationBlock
Takes the parsed declarations.
Sourcepub fn parse_value<'t>(
&mut self,
context: &ParserContext<'_>,
name: CowRcStr<'i>,
input: &mut Parser<'i, 't>,
declaration_start: &ParserState,
) -> Result<(), ParseError<'i>>
pub fn parse_value<'t>( &mut self, context: &ParserContext<'_>, name: CowRcStr<'i>, input: &mut Parser<'i, 't>, declaration_start: &ParserState, ) -> Result<(), ParseError<'i>>
Parse a single declaration value.
Sourcepub fn report_errors_if_needed(
&mut self,
context: &ParserContext<'_>,
selectors: &[SelectorList<SelectorImpl>],
)
pub fn report_errors_if_needed( &mut self, context: &ParserContext<'_>, selectors: &[SelectorList<SelectorImpl>], )
Reports any CSS errors that have ocurred if needed.
fn do_report_css_errors( &mut self, context: &ParserContext<'_>, selectors: &[SelectorList<SelectorImpl>], )
Sourcepub fn did_error(
&mut self,
context: &ParserContext<'_>,
error: ParseError<'i>,
slice: &'i str,
)
pub fn did_error( &mut self, context: &ParserContext<'_>, error: ParseError<'i>, slice: &'i str, )
Resets the declaration parser state, and reports the error if needed.
Trait Implementations§
Source§impl<'i> Default for DeclarationParserState<'i>
impl<'i> Default for DeclarationParserState<'i>
Source§fn default() -> DeclarationParserState<'i>
fn default() -> DeclarationParserState<'i>
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl<'i> Freeze for DeclarationParserState<'i>
impl<'i> RefUnwindSafe for DeclarationParserState<'i>
impl<'i> !Send for DeclarationParserState<'i>
impl<'i> !Sync for DeclarationParserState<'i>
impl<'i> Unpin for DeclarationParserState<'i>
impl<'i> UnwindSafe for DeclarationParserState<'i>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
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 moreSource§impl<T> MaybeBoxed<Box<T>> for T
impl<T> MaybeBoxed<Box<T>> for T
Source§fn maybe_boxed(self) -> Box<T>
fn maybe_boxed(self) -> Box<T>
Convert
Source§impl<T> MaybeBoxed<T> for T
impl<T> MaybeBoxed<T> for T
Source§fn maybe_boxed(self) -> T
fn maybe_boxed(self) -> T
Convert