2021-10-02 04:59:11 +02:00
|
|
|
use super::{Call, CellPath, Expression, FullCellPath, Operator, RangeOperator};
|
2021-11-16 00:16:06 +01:00
|
|
|
use crate::{ast::ImportPattern, BlockId, Signature, Span, Spanned, Unit, VarId};
|
2021-09-02 10:25:22 +02:00
|
|
|
|
|
|
|
#[derive(Debug, Clone)]
|
|
|
|
pub enum Expr {
|
|
|
|
Bool(bool),
|
|
|
|
Int(i64),
|
|
|
|
Float(f64),
|
2021-09-04 23:52:57 +02:00
|
|
|
Range(
|
2021-09-11 13:13:04 +02:00
|
|
|
Option<Box<Expression>>, // from
|
|
|
|
Option<Box<Expression>>, // next value after "from"
|
|
|
|
Option<Box<Expression>>, // to
|
2021-09-04 23:52:57 +02:00
|
|
|
RangeOperator,
|
|
|
|
),
|
2021-09-02 10:25:22 +02:00
|
|
|
Var(VarId),
|
2021-10-25 22:04:23 +02:00
|
|
|
VarDecl(VarId),
|
2021-09-02 10:25:22 +02:00
|
|
|
Call(Box<Call>),
|
2021-10-09 00:30:10 +02:00
|
|
|
ExternalCall(String, Span, Vec<Expression>),
|
2021-09-02 10:25:22 +02:00
|
|
|
Operator(Operator),
|
2021-11-26 04:49:03 +01:00
|
|
|
RowCondition(BlockId),
|
2021-09-02 10:25:22 +02:00
|
|
|
BinaryOp(Box<Expression>, Box<Expression>, Box<Expression>), //lhs, op, rhs
|
|
|
|
Subexpression(BlockId),
|
|
|
|
Block(BlockId),
|
|
|
|
List(Vec<Expression>),
|
|
|
|
Table(Vec<Expression>, Vec<Vec<Expression>>),
|
2021-11-11 00:14:00 +01:00
|
|
|
Record(Vec<(Expression, Expression)>),
|
2021-09-02 10:25:22 +02:00
|
|
|
Keyword(Vec<u8>, Span, Box<Expression>),
|
2021-10-05 04:27:39 +02:00
|
|
|
ValueWithUnit(Box<Expression>, Spanned<Unit>),
|
2021-10-04 21:21:31 +02:00
|
|
|
Filepath(String),
|
|
|
|
GlobPattern(String),
|
2021-10-12 19:44:23 +02:00
|
|
|
String(String),
|
2021-10-02 04:59:11 +02:00
|
|
|
CellPath(CellPath),
|
2021-09-07 00:02:24 +02:00
|
|
|
FullCellPath(Box<FullCellPath>),
|
2021-11-16 00:16:06 +01:00
|
|
|
ImportPattern(ImportPattern),
|
2021-09-02 10:25:22 +02:00
|
|
|
Signature(Box<Signature>),
|
2021-12-25 21:50:02 +01:00
|
|
|
StringInterpolation(Vec<Expression>),
|
2021-12-20 02:05:33 +01:00
|
|
|
Nothing,
|
2021-09-02 10:25:22 +02:00
|
|
|
Garbage,
|
|
|
|
}
|