use chrono::FixedOffset; use serde::{Deserialize, Serialize}; use super::{ Call, CellPath, Expression, ExternalArgument, FullCellPath, MatchPattern, Operator, RangeOperator, }; use crate::{ast::ImportPattern, ast::Unit, BlockId, Signature, Span, Spanned, VarId}; #[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] pub enum Expr { Bool(bool), Int(i64), Float(f64), Binary(Vec), Range( Option>, // from Option>, // next value after "from" Option>, // to RangeOperator, ), Var(VarId), VarDecl(VarId), Call(Box), ExternalCall(Box, Vec, bool), // head, args, is_subexpression Operator(Operator), RowCondition(BlockId), UnaryNot(Box), BinaryOp(Box, Box, Box), //lhs, op, rhs Subexpression(BlockId), Block(BlockId), Closure(BlockId), MatchBlock(Vec<(MatchPattern, Expression)>), List(Vec), Table(Vec, Vec>), Record(Vec), Keyword(Vec, Span, Box), ValueWithUnit(Box, Spanned), DateTime(chrono::DateTime), Filepath(String, bool), Directory(String, bool), GlobPattern(String, bool), String(String), CellPath(CellPath), FullCellPath(Box), ImportPattern(ImportPattern), Overlay(Option), // block ID of the overlay's origin module Signature(Box), StringInterpolation(Vec), Spread(Box), Nothing, Garbage, } #[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] pub enum RecordItem { /// A key: val mapping Pair(Expression, Expression), /// Span for the "..." and the expression that's being spread Spread(Span, Expression), }