Split up and expand ast
This commit is contained in:
parent
4e94c13351
commit
037a0f69a3
9 changed files with 614 additions and 414 deletions
39
src/ast/basic.rs
Normal file
39
src/ast/basic.rs
Normal file
|
|
@ -0,0 +1,39 @@
|
|||
use std::fmt;
|
||||
|
||||
use crate::span::{HasSpan, Span};
|
||||
|
||||
#[derive(Clone)]
|
||||
pub struct Space {
|
||||
pub comment: Vec<(String, Span)>,
|
||||
pub span: Span,
|
||||
}
|
||||
|
||||
impl fmt::Debug for Space {
|
||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
f.debug_struct("Space").finish()
|
||||
}
|
||||
}
|
||||
|
||||
impl HasSpan for Space {
|
||||
fn span(&self) -> Span {
|
||||
self.span
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Clone)]
|
||||
pub struct Ident {
|
||||
pub name: String,
|
||||
pub span: Span,
|
||||
}
|
||||
|
||||
impl fmt::Debug for Ident {
|
||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
write!(f, "i#{}", self.name)
|
||||
}
|
||||
}
|
||||
|
||||
impl HasSpan for Ident {
|
||||
fn span(&self) -> Span {
|
||||
self.span
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue