From c216a4fc26c72938ddad60bc5fe4fa9e45263b30 Mon Sep 17 00:00:00 2001 From: Laurenz Date: Sat, 10 Oct 2020 22:41:56 +0200 Subject: =?UTF-8?q?Flatten=20ast=20module=20back=20into=20syntax=20module?= =?UTF-8?q?=20=F0=9F=8C=AA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/syntax/ast/expr.rs | 68 -------------------------------------------------- 1 file changed, 68 deletions(-) delete mode 100644 src/syntax/ast/expr.rs (limited to 'src/syntax/ast/expr.rs') 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, - /// 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, -} - -/// A unary operation: `-x`. -#[derive(Debug, Clone, PartialEq)] -pub struct ExprUnary { - /// The operator: `-`. - pub op: Spanned, - /// The expression to operator on: `x`. - pub expr: Spanned>, -} - -/// 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>, - /// The operator: `+`. - pub op: Spanned, - /// The right-hand side of the operation: `b`. - pub rhs: Spanned>, -} - -/// 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, -} -- cgit v1.2.3