Move program ast into separate file
This commit is contained in:
parent
e2bb847577
commit
3e2f118e2e
2 changed files with 19 additions and 16 deletions
18
src/ast.rs
18
src/ast.rs
|
|
@ -4,32 +4,18 @@ mod expr;
|
||||||
mod field;
|
mod field;
|
||||||
mod func_def;
|
mod func_def;
|
||||||
mod lit;
|
mod lit;
|
||||||
|
mod program;
|
||||||
mod table_constr;
|
mod table_constr;
|
||||||
mod table_destr;
|
mod table_destr;
|
||||||
mod var;
|
mod var;
|
||||||
|
|
||||||
use crate::span::{HasSpan, Span};
|
|
||||||
|
|
||||||
pub use self::basic::*;
|
pub use self::basic::*;
|
||||||
pub use self::call::*;
|
pub use self::call::*;
|
||||||
pub use self::expr::*;
|
pub use self::expr::*;
|
||||||
pub use self::field::*;
|
pub use self::field::*;
|
||||||
pub use self::func_def::*;
|
pub use self::func_def::*;
|
||||||
pub use self::lit::*;
|
pub use self::lit::*;
|
||||||
|
pub use self::program::*;
|
||||||
pub use self::table_constr::*;
|
pub use self::table_constr::*;
|
||||||
pub use self::table_destr::*;
|
pub use self::table_destr::*;
|
||||||
pub use self::var::*;
|
pub use self::var::*;
|
||||||
|
|
||||||
#[derive(Debug, Clone)]
|
|
||||||
pub struct Program {
|
|
||||||
pub elems: Vec<(Space, TableLitElem, Space)>,
|
|
||||||
/// `Some` if there is a trailing comma, `None` otherwise.
|
|
||||||
pub trailing_comma: Option<Space>,
|
|
||||||
pub span: Span,
|
|
||||||
}
|
|
||||||
|
|
||||||
impl HasSpan for Program {
|
|
||||||
fn span(&self) -> Span {
|
|
||||||
self.span
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
|
||||||
17
src/ast/program.rs
Normal file
17
src/ast/program.rs
Normal file
|
|
@ -0,0 +1,17 @@
|
||||||
|
use crate::span::{HasSpan, Span};
|
||||||
|
|
||||||
|
use super::{Space, TableLitElem};
|
||||||
|
|
||||||
|
#[derive(Debug, Clone)]
|
||||||
|
pub struct Program {
|
||||||
|
pub elems: Vec<(Space, TableLitElem, Space)>,
|
||||||
|
/// `Some` if there is a trailing comma, `None` otherwise.
|
||||||
|
pub trailing_comma: Option<Space>,
|
||||||
|
pub span: Span,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl HasSpan for Program {
|
||||||
|
fn span(&self) -> Span {
|
||||||
|
self.span
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue