Add cell paths

This commit is contained in:
JT
2021-09-07 10:02:24 +12:00
parent f71b7e89e0
commit 3b7d7861e3
12 changed files with 395 additions and 99 deletions

View File

@@ -0,0 +1,19 @@
use super::Expression;
use crate::Span;
#[derive(Debug, Clone)]
pub enum PathMember {
String { val: String, span: Span },
Int { val: usize, span: Span },
}
#[derive(Debug, Clone)]
pub struct CellPath {
pub members: Vec<PathMember>,
}
#[derive(Debug, Clone)]
pub struct FullCellPath {
pub head: Expression,
pub tail: Vec<PathMember>,
}

View File

@@ -1,4 +1,4 @@
use super::{Call, Expression, Operator, RangeOperator};
use super::{Call, Expression, FullCellPath, Operator, RangeOperator};
use crate::{BlockId, Signature, Span, VarId};
#[derive(Debug, Clone)]
@@ -22,6 +22,7 @@ pub enum Expr {
Table(Vec<Expression>, Vec<Vec<Expression>>),
Keyword(Vec<u8>, Span, Box<Expression>),
String(String), // FIXME: improve this in the future?
FullCellPath(Box<FullCellPath>),
Signature(Box<Signature>),
Garbage,
}

View File

@@ -1,5 +1,6 @@
mod block;
mod call;
mod cell_path;
mod expr;
mod expression;
mod operator;
@@ -8,6 +9,7 @@ mod statement;
pub use block::*;
pub use call::*;
pub use cell_path::*;
pub use expr::*;
pub use expression::*;
pub use operator::*;