pub trait MarkupGrammar<'a> {
// Required methods
fn opens(&self, source: &'a str, offset: u32, site: MarkupSite) -> bool;
fn region(&self, cursor: &mut MarkupCursor<'_, 'a>, site: MarkupSite) -> u32;
}Expand description
A markup grammar embedded in host JS/TS.
The grammar is shared (&self) so a region may re-enter the host parser,
which may open nested regions with the same grammar.
Required Methods§
Sourcefn opens(&self, source: &'a str, offset: u32, site: MarkupSite) -> bool
fn opens(&self, source: &'a str, offset: u32, site: MarkupSite) -> bool
Whether a region opens at offset (the start of an @ token) for site.
A < in a JSX-enabled profile always opens an expression region.
Sourcefn region(&self, cursor: &mut MarkupCursor<'_, 'a>, site: MarkupSite) -> u32
fn region(&self, cursor: &mut MarkupCursor<'_, 'a>, site: MarkupSite) -> u32
Parse one region that starts at cursor.token(), and return the offset where
it ends. Errors are reported with MarkupCursor::fatal.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".