summaryrefslogtreecommitdiff
path: root/src/syntax/ast/expr.rs
diff options
context:
space:
mode:
authorLaurenz <laurmaedje@gmail.com>2020-10-10 22:41:56 +0200
committerLaurenz <laurmaedje@gmail.com>2020-10-10 22:41:56 +0200
commitc216a4fc26c72938ddad60bc5fe4fa9e45263b30 (patch)
tree0a563e3076a8d0724d0361b5d81a2b8d07d15cbe /src/syntax/ast/expr.rs
parent51bf3268ddf5db1bdd61e59bfb4a30f0463a4bfb (diff)
Flatten ast module back into syntax module 🌪
Diffstat (limited to 'src/syntax/ast/expr.rs')
-rw-r--r--src/syntax/ast/expr.rs68
1 files changed, 0 insertions, 68 deletions
diff --git a/src/syntax/ast/expr.rs b/src/syntax/ast/expr.rs
deleted file mode 100644
index 09729f52..00000000
--- a/src/syntax/ast/expr.rs
+++ /dev/null
@@ -1,68 +0,0 @@
-//! Expressions.
-
-use super::*;
-
-/// An expression.
-#[derive(Debug, Clone, PartialEq)]
-pub enum Expr {
- /// A literal: `true`, `1cm`, `"hi"`, `{_Hey!_}`.
- Lit(Lit),
- /// An invocation of a function: `[foo: ...]`, `foo(...)`.
- Call(ExprCall),
- /// A unary operation: `-x`.
- Unary(ExprUnary),
- /// A binary operation: `a + b`, `a / b`.
- Binary(ExprBinary),
-}
-
-/// An invocation of a function: `[foo: ...]`, `foo(...)`.
-#[derive(Debug, Clone, PartialEq)]
-pub struct ExprCall {
- /// The name of the function.
- pub name: Spanned<Ident>,
- /// The arguments to the function.
- ///
- /// In case of a bracketed invocation with a body, the body is _not_
- /// included in the span for the sake of clearer error messages.
- pub args: Spanned<LitDict>,
-}
-
-/// A unary operation: `-x`.
-#[derive(Debug, Clone, PartialEq)]
-pub struct ExprUnary {
- /// The operator: `-`.
- pub op: Spanned<UnOp>,
- /// The expression to operator on: `x`.
- pub expr: Spanned<Box<Expr>>,
-}
-
-/// A unary operator.
-#[derive(Debug, Copy, Clone, Eq, PartialEq)]
-pub enum UnOp {
- /// The negation operator: `-`.
- Neg,
-}
-
-/// A binary operation: `a + b`, `a / b`.
-#[derive(Debug, Clone, PartialEq)]
-pub struct ExprBinary {
- /// The left-hand side of the operation: `a`.
- pub lhs: Spanned<Box<Expr>>,
- /// The operator: `+`.
- pub op: Spanned<BinOp>,
- /// The right-hand side of the operation: `b`.
- pub rhs: Spanned<Box<Expr>>,
-}
-
-/// A binary operator.
-#[derive(Debug, Copy, Clone, Eq, PartialEq)]
-pub enum BinOp {
- /// The addition operator: `+`.
- Add,
- /// The subtraction operator: `-`.
- Sub,
- /// The multiplication operator: `*`.
- Mul,
- /// The division operator: `/`.
- Div,
-}