Add wrap and get and cell_path parsing

This commit is contained in:
JT
2021-10-02 15:59:11 +13:00
parent 3567bbbf32
commit 5843acec02
18 changed files with 290 additions and 81 deletions

View File

@@ -45,4 +45,8 @@ impl Call {
None
}
pub fn nth(&self, pos: usize) -> Option<Expression> {
self.positional.get(pos).cloned()
}
}

View File

@@ -1,13 +1,14 @@
use super::Expression;
use crate::Span;
use serde::{Deserialize, Serialize};
#[derive(Debug, Clone)]
#[derive(Debug, Clone, Serialize, Deserialize)]
pub enum PathMember {
String { val: String, span: Span },
Int { val: usize, span: Span },
}
#[derive(Debug, Clone)]
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct CellPath {
pub members: Vec<PathMember>,
}

View File

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