pub struct Program {
pub statements: Vec<SpannedStatement>,
pub comments: Vec<CommentInfo>,
pub span: Span,
}Expand description
Root AST node representing a complete Carmen program.
A program consists of a sequence of statements and any comments found in the source. Comments are preserved to enable formatting and documentation tools.
Fields§
§statements: Vec<SpannedStatement>Top-level statements in the program
comments: Vec<CommentInfo>All comments found in the source
span: SpanSpan covering the entire program
Implementations§
Source§impl Program
impl Program
Sourcepub fn leading_comments(&self, span: &Span) -> Vec<&CommentInfo>
pub fn leading_comments(&self, span: &Span) -> Vec<&CommentInfo>
Get all comments that appear before the given span
Sourcepub fn trailing_comments(&self, span: &Span) -> Vec<&CommentInfo>
pub fn trailing_comments(&self, span: &Span) -> Vec<&CommentInfo>
Get all comments that appear after the given span on the same line
Sourcepub fn between_comments(
&self,
container_span: &Span,
element_index: usize,
) -> Vec<&CommentInfo>
pub fn between_comments( &self, container_span: &Span, element_index: usize, ) -> Vec<&CommentInfo>
Get comments between elements in a list/tuple/etc
Sourcepub fn standalone_comments(&self) -> Vec<&CommentInfo>
pub fn standalone_comments(&self) -> Vec<&CommentInfo>
Get all standalone comments (not associated with specific code)
Sourcepub fn comments_in_range(
&self,
start_offset: usize,
end_offset: usize,
) -> Vec<&CommentInfo>
pub fn comments_in_range( &self, start_offset: usize, end_offset: usize, ) -> Vec<&CommentInfo>
Get all comments within a given span range
Sourcepub fn has_comments_between(&self, span1: &Span, span2: &Span) -> bool
pub fn has_comments_between(&self, span1: &Span, span2: &Span) -> bool
Check if there are any comments between two spans
Trait Implementations§
impl StructuralPartialEq for Program
Auto Trait Implementations§
impl Freeze for Program
impl RefUnwindSafe for Program
impl Send for Program
impl Sync for Program
impl Unpin for Program
impl UnsafeUnpin for Program
impl UnwindSafe for Program
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