pub struct CompletedMarker { /* private fields */ }
Expand description
A structure signifying a completed node
Implementations§
Source§impl CompletedMarker
impl CompletedMarker
pub fn new(start_pos: u32, finish_pos: u32, kind: SyntaxKind) -> Self
Sourcepub fn change_kind(&mut self, p: &mut Parser<'_>, new_kind: SyntaxKind)
pub fn change_kind(&mut self, p: &mut Parser<'_>, new_kind: SyntaxKind)
Change the kind of node this marker represents
pub fn offset_range(&self, p: &Parser<'_>, range: TextRange) -> TextRange
Sourcepub fn precede(self, p: &mut Parser<'_>) -> Marker
pub fn precede(self, p: &mut Parser<'_>) -> Marker
This method allows to create a new node which starts
before the current one. That is, parser could start
node A
, then complete it, and then after parsing the
whole A
, decide that it should have started some node
B
before starting A
. precede
allows to do exactly
that. See also docs about forward_parent
in Event::Start
.
Given completed events [START, FINISH]
and its corresponding
CompletedMarker(pos: 0, _)
.
Append a new START
events as [START, FINISH, NEWSTART]
,
then mark NEWSTART
as START
’s parent with saving its relative
distance to NEWSTART
into forward_parent(=2 in this case);
Sourcepub fn undo_completion(self, p: &mut Parser<'_>) -> Marker
pub fn undo_completion(self, p: &mut Parser<'_>) -> Marker
Undo this completion and turns into a Marker
pub fn kind(&self) -> SyntaxKind
pub fn err_if_not_ts(&mut self, p: &mut Parser<'_>, err: &str)
Trait Implementations§
Source§impl Clone for CompletedMarker
impl Clone for CompletedMarker
Source§fn clone(&self) -> CompletedMarker
fn clone(&self) -> CompletedMarker
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreSource§impl Debug for CompletedMarker
impl Debug for CompletedMarker
Source§impl Hash for CompletedMarker
impl Hash for CompletedMarker
Source§impl PartialEq for CompletedMarker
impl PartialEq for CompletedMarker
impl Copy for CompletedMarker
impl Eq for CompletedMarker
impl StructuralPartialEq for CompletedMarker
Auto Trait Implementations§
impl Freeze for CompletedMarker
impl RefUnwindSafe for CompletedMarker
impl Send for CompletedMarker
impl Sync for CompletedMarker
impl Unpin for CompletedMarker
impl UnwindSafe for CompletedMarker
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