Struct satysfi_parser::CstText
source · [−]Expand description
CST にテキストの情報を付加したもの。
Fields
text: String
lines: Vec<usize>
cst: Cst
Implementations
sourceimpl CstText
impl CstText
sourcepub fn parse<F>(
text: &str,
parser: F
) -> Result<Self, (LineCol, Vec<&'static str>)> where
F: Fn(&str) -> Result<Cst, ParseError<LineCol>>,
pub fn parse<F>(
text: &str,
parser: F
) -> Result<Self, (LineCol, Vec<&'static str>)> where
F: Fn(&str) -> Result<Cst, ParseError<LineCol>>,
与えられたパーサに基づき、与えられたテキストをパースする。
sourcepub fn get_text_from_span(&self, span: Span) -> &str
pub fn get_text_from_span(&self, span: Span) -> &str
self.cst の子要素である Cst について、その要素に相当する text を取得する。
sourcepub fn get_line_col(&self, pos: usize) -> Option<LineCol>
pub fn get_line_col(&self, pos: usize) -> Option<LineCol>
与えられた position の line 及び col を出力する。
sourcepub fn from_line_col(&self, line: usize, column: usize) -> Option<usize>
pub fn from_line_col(&self, line: usize, column: usize) -> Option<usize>
与えられた line 及び col の position を出力する。
sourcepub fn pritty_cst_recursive(&self, cst: &Cst) -> String
pub fn pritty_cst_recursive(&self, cst: &Cst) -> String
CST の構造を string にして出力する。
sourcepub fn pritty_cst(&self, cst: &Cst) -> String
pub fn pritty_cst(&self, cst: &Cst) -> String
Cst を pritty 表示。
sourcepub fn is_comment(&self, pos: usize) -> bool
pub fn is_comment(&self, pos: usize) -> bool
与えられた場所がコメント内かどうか判定する。
Trait Implementations
impl Eq for CstText
impl StructuralEq for CstText
impl StructuralPartialEq for CstText
Auto Trait Implementations
impl RefUnwindSafe for CstText
impl Send for CstText
impl Sync for CstText
impl Unpin for CstText
impl UnwindSafe for CstText
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more