nushell/crates/nu-protocol/src/ast/expr.rs

35 lines
1 KiB
Rust
Raw Normal View History

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