pub struct Cst {
pub rule: Rule,
pub span: Span,
pub inner: Vec<Cst>,
}
Expand description
Concrete syntax tree. 1つの CST は構文規則、テキストの範囲、子要素からなり、全体として木構造をなす。
Fields§
§rule: Rule
構文規則。
span: Span
§inner: Vec<Cst>
Implementations§
Source§impl Cst
impl Cst
pub fn as_str<'a>(&'a self, text: &'a str) -> &'a str
Sourcepub fn get_parent(&self, child: &Cst) -> Option<&Cst>
pub fn get_parent(&self, child: &Cst) -> Option<&Cst>
自分の Cst の内部で、 child の親となる Cst (child の scope を内包する最小の Cst)を探し、あればそれを返す。
pub fn mode(&self, pos: usize) -> Mode
Sourcepub fn get_terminal_spans(&self) -> Vec<Span>
pub fn get_terminal_spans(&self) -> Vec<Span>
終端要素の Span を返す。ここでいう終端要素とは、 自身の Cst の span には含まれているが、子の span には含まれていない範囲。
Trait Implementations§
impl Eq for Cst
impl StructuralPartialEq for Cst
Auto Trait Implementations§
impl Freeze for Cst
impl RefUnwindSafe for Cst
impl Send for Cst
impl Sync for Cst
impl Unpin for Cst
impl UnwindSafe for Cst
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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 more