pub struct Parse { /* private fields */ }Expand description
The result of parsing one source file.
Cloning is cheap: the tree is reference counted.
Implementations§
Source§impl Parse
impl Parse
Sourcepub fn syntax(&self) -> SyntaxNode
pub fn syntax(&self) -> SyntaxNode
The root of the concrete syntax tree (a SOURCE_FILE node).
Sourcepub fn green(&self) -> &GreenNode
pub fn green(&self) -> &GreenNode
The immutable green tree, which is Send + Sync and cheap to clone.
Sourcepub fn diagnostics(&self) -> &[Diagnostic]
pub fn diagnostics(&self) -> &[Diagnostic]
All diagnostics, in source order.
Sourcepub fn is_ok(&self) -> bool
pub fn is_ok(&self) -> bool
Whether SANY’s parser would accept the input (no error diagnostics).
Sourcepub fn check_file_name(&self, file_name: &str) -> Option<Diagnostic>
pub fn check_file_name(&self, file_name: &str) -> Option<Diagnostic>
SANY’s file-name check: a file Name.tla must contain module Name
(compared exactly). file_name is the file’s base name; everything
from its last . is ignored, as in SANY. Returns the error, if any.
SANY only checks this after the module parsed, so this does too.
let p = dive_syntax::parse_module("---- MODULE A ----\n====");
assert!(p.check_file_name("A.tla").is_none());
assert_eq!(p.check_file_name("B.tla").unwrap().code.as_str(), "DIVE-S0006");Trait Implementations§
impl Eq for Parse
impl StructuralPartialEq for Parse
Auto Trait Implementations§
impl Forget for Parse
impl Freeze for Parse
impl Move for Parse
impl RefUnwindSafe for Parse
impl Send for Parse
impl Sync for Parse
impl Unpin for Parse
impl UnsafeUnpin for Parse
impl UnwindSafe for Parse
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