ast: Do not promise PartialOrd/Ord (breaking change)
This commit is contained in:
parent
87c8d43d11
commit
0c1b3bfe39
@ -10,30 +10,31 @@
|
|||||||
//! - [Ty] and [TyKind]: Type qualifiers
|
//! - [Ty] and [TyKind]: Type qualifiers
|
||||||
//! - [Path]: Path expressions
|
//! - [Path]: Path expressions
|
||||||
use crate::common::*;
|
use crate::common::*;
|
||||||
|
|
||||||
pub mod ast_impl;
|
pub mod ast_impl;
|
||||||
|
|
||||||
#[derive(Clone, Copy, Debug, Default, PartialEq, Eq, PartialOrd, Ord)]
|
#[derive(Clone, Copy, Debug, Default, PartialEq, Eq)]
|
||||||
pub enum Mutability {
|
pub enum Mutability {
|
||||||
#[default]
|
#[default]
|
||||||
Not,
|
Not,
|
||||||
Mut,
|
Mut,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, Copy, Debug, Default, PartialEq, Eq, PartialOrd, Ord)]
|
#[derive(Clone, Copy, Debug, Default, PartialEq, Eq)]
|
||||||
pub enum Visibility {
|
pub enum Visibility {
|
||||||
#[default]
|
#[default]
|
||||||
Private,
|
Private,
|
||||||
Public,
|
Public,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, Debug, Default, PartialEq, Eq, PartialOrd, Ord)]
|
#[derive(Clone, Debug, Default, PartialEq, Eq)]
|
||||||
pub struct File {
|
pub struct File {
|
||||||
pub items: Vec<Item>,
|
pub items: Vec<Item>,
|
||||||
}
|
}
|
||||||
|
|
||||||
// Items
|
// Items
|
||||||
/// Stores an [ItemKind] and associated metadata
|
/// Stores an [ItemKind] and associated metadata
|
||||||
#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord)]
|
#[derive(Clone, Debug, PartialEq, Eq)]
|
||||||
pub struct Item {
|
pub struct Item {
|
||||||
pub extents: Span,
|
pub extents: Span,
|
||||||
pub vis: Visibility,
|
pub vis: Visibility,
|
||||||
@ -41,7 +42,7 @@ pub struct Item {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Stores a concrete Item
|
/// Stores a concrete Item
|
||||||
#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord)]
|
#[derive(Clone, Debug, PartialEq, Eq)]
|
||||||
pub enum ItemKind {
|
pub enum ItemKind {
|
||||||
/// A [constant](Const)
|
/// A [constant](Const)
|
||||||
Const(Const),
|
Const(Const),
|
||||||
@ -60,7 +61,7 @@ pub enum ItemKind {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Stores a `const` value
|
/// Stores a `const` value
|
||||||
#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord)]
|
#[derive(Clone, Debug, PartialEq, Eq)]
|
||||||
pub struct Const {
|
pub struct Const {
|
||||||
pub name: Identifier,
|
pub name: Identifier,
|
||||||
pub ty: Box<Ty>,
|
pub ty: Box<Ty>,
|
||||||
@ -68,7 +69,7 @@ pub struct Const {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Stores a `static` variable
|
/// Stores a `static` variable
|
||||||
#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord)]
|
#[derive(Clone, Debug, PartialEq, Eq)]
|
||||||
pub struct Static {
|
pub struct Static {
|
||||||
pub mutable: Mutability,
|
pub mutable: Mutability,
|
||||||
pub name: Identifier,
|
pub name: Identifier,
|
||||||
@ -77,20 +78,20 @@ pub struct Static {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Stores a collection of [Items](Item)
|
/// Stores a collection of [Items](Item)
|
||||||
#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord)]
|
#[derive(Clone, Debug, PartialEq, Eq)]
|
||||||
pub struct Module {
|
pub struct Module {
|
||||||
pub name: Identifier,
|
pub name: Identifier,
|
||||||
pub kind: ModuleKind,
|
pub kind: ModuleKind,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord)]
|
#[derive(Clone, Debug, PartialEq, Eq)]
|
||||||
pub enum ModuleKind {
|
pub enum ModuleKind {
|
||||||
Inline(File),
|
Inline(File),
|
||||||
Outline,
|
Outline,
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Contains code, and the interface to that code
|
/// Contains code, and the interface to that code
|
||||||
#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord)]
|
#[derive(Clone, Debug, PartialEq, Eq)]
|
||||||
pub struct Function {
|
pub struct Function {
|
||||||
pub name: Identifier,
|
pub name: Identifier,
|
||||||
pub args: Vec<Param>,
|
pub args: Vec<Param>,
|
||||||
@ -98,53 +99,53 @@ pub struct Function {
|
|||||||
pub rety: Option<Box<Ty>>,
|
pub rety: Option<Box<Ty>>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord)]
|
#[derive(Clone, Debug, PartialEq, Eq)]
|
||||||
pub struct Param {
|
pub struct Param {
|
||||||
pub mutability: Mutability,
|
pub mutability: Mutability,
|
||||||
pub name: Identifier,
|
pub name: Identifier,
|
||||||
pub ty: Box<Ty>,
|
pub ty: Box<Ty>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord)]
|
#[derive(Clone, Debug, PartialEq, Eq)]
|
||||||
pub struct Struct {
|
pub struct Struct {
|
||||||
pub name: Identifier,
|
pub name: Identifier,
|
||||||
pub kind: StructKind,
|
pub kind: StructKind,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord)]
|
#[derive(Clone, Debug, PartialEq, Eq)]
|
||||||
pub enum StructKind {
|
pub enum StructKind {
|
||||||
Empty,
|
Empty,
|
||||||
Tuple(Vec<Ty>),
|
Tuple(Vec<Ty>),
|
||||||
Struct(Vec<StructMember>),
|
Struct(Vec<StructMember>),
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord)]
|
#[derive(Clone, Debug, PartialEq, Eq)]
|
||||||
pub struct StructMember {
|
pub struct StructMember {
|
||||||
pub vis: Visibility,
|
pub vis: Visibility,
|
||||||
pub name: Identifier,
|
pub name: Identifier,
|
||||||
pub ty: Ty,
|
pub ty: Ty,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord)]
|
#[derive(Clone, Debug, PartialEq, Eq)]
|
||||||
pub struct Enum {
|
pub struct Enum {
|
||||||
pub name: Identifier,
|
pub name: Identifier,
|
||||||
pub kind: EnumKind,
|
pub kind: EnumKind,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord)]
|
#[derive(Clone, Debug, PartialEq, Eq)]
|
||||||
pub enum EnumKind {
|
pub enum EnumKind {
|
||||||
/// Represents an enum with no variants
|
/// Represents an enum with no variants
|
||||||
NoVariants,
|
NoVariants,
|
||||||
Variants(Vec<Variant>),
|
Variants(Vec<Variant>),
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord)]
|
#[derive(Clone, Debug, PartialEq, Eq)]
|
||||||
pub struct Variant {
|
pub struct Variant {
|
||||||
pub name: Identifier,
|
pub name: Identifier,
|
||||||
pub kind: VariantKind,
|
pub kind: VariantKind,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord)]
|
#[derive(Clone, Debug, PartialEq, Eq)]
|
||||||
pub enum VariantKind {
|
pub enum VariantKind {
|
||||||
Plain,
|
Plain,
|
||||||
CLike(u128),
|
CLike(u128),
|
||||||
@ -152,27 +153,27 @@ pub enum VariantKind {
|
|||||||
Struct(Vec<StructMember>),
|
Struct(Vec<StructMember>),
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord)]
|
#[derive(Clone, Debug, PartialEq, Eq)]
|
||||||
pub struct Impl {
|
pub struct Impl {
|
||||||
pub target: Ty,
|
pub target: Ty,
|
||||||
pub body: Vec<Item>,
|
pub body: Vec<Item>,
|
||||||
}
|
}
|
||||||
|
|
||||||
/// TODO: `impl` Trait for <Target> { }
|
// TODO: `impl` Trait for <Target> { }
|
||||||
#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord)]
|
#[derive(Clone, Debug, PartialEq, Eq)]
|
||||||
pub enum ImplKind {
|
pub enum ImplKind {
|
||||||
Type(Box<Ty>),
|
Type(Box<Ty>),
|
||||||
Trait { impl_trait: Path, for_type: Box<Ty> },
|
Trait { impl_trait: Path, for_type: Box<Ty> },
|
||||||
}
|
}
|
||||||
|
|
||||||
/// # Static Type Information
|
/// # Static Type Information
|
||||||
#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord)]
|
#[derive(Clone, Debug, PartialEq, Eq)]
|
||||||
pub struct Ty {
|
pub struct Ty {
|
||||||
pub extents: Span,
|
pub extents: Span,
|
||||||
pub kind: TyKind,
|
pub kind: TyKind,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord)]
|
#[derive(Clone, Debug, PartialEq, Eq)]
|
||||||
pub enum TyKind {
|
pub enum TyKind {
|
||||||
Never,
|
Never,
|
||||||
Empty,
|
Empty,
|
||||||
@ -182,30 +183,30 @@ pub enum TyKind {
|
|||||||
Fn(TyFn),
|
Fn(TyFn),
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord)]
|
#[derive(Clone, Debug, PartialEq, Eq)]
|
||||||
pub struct TyTuple {
|
pub struct TyTuple {
|
||||||
pub types: Vec<Ty>,
|
pub types: Vec<Ty>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord)]
|
#[derive(Clone, Debug, PartialEq, Eq)]
|
||||||
pub struct TyRef {
|
pub struct TyRef {
|
||||||
pub count: usize,
|
pub count: usize,
|
||||||
pub to: Path,
|
pub to: Path,
|
||||||
}
|
}
|
||||||
#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord)]
|
#[derive(Clone, Debug, PartialEq, Eq)]
|
||||||
pub struct TyFn {
|
pub struct TyFn {
|
||||||
pub args: TyTuple,
|
pub args: TyTuple,
|
||||||
pub rety: Option<Box<Ty>>,
|
pub rety: Option<Box<Ty>>,
|
||||||
}
|
}
|
||||||
|
|
||||||
// Path
|
// Path
|
||||||
#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord)]
|
#[derive(Clone, Debug, PartialEq, Eq)]
|
||||||
pub struct Path {
|
pub struct Path {
|
||||||
pub absolute: bool,
|
pub absolute: bool,
|
||||||
pub parts: Vec<PathPart>,
|
pub parts: Vec<PathPart>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord)]
|
#[derive(Clone, Debug, PartialEq, Eq)]
|
||||||
pub enum PathPart {
|
pub enum PathPart {
|
||||||
SuperKw,
|
SuperKw,
|
||||||
SelfKw,
|
SelfKw,
|
||||||
@ -213,24 +214,24 @@ pub enum PathPart {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// TODO: Capture token?
|
// TODO: Capture token?
|
||||||
#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord)]
|
#[derive(Clone, Debug, PartialEq, Eq)]
|
||||||
pub struct Identifier(pub String);
|
pub struct Identifier(pub String);
|
||||||
|
|
||||||
/// Stores an abstract statement, and associated metadata
|
/// Stores an abstract statement, and associated metadata
|
||||||
#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord)]
|
#[derive(Clone, Debug, PartialEq, Eq)]
|
||||||
pub struct Stmt {
|
pub struct Stmt {
|
||||||
pub extents: Span,
|
pub extents: Span,
|
||||||
pub kind: StmtKind,
|
pub kind: StmtKind,
|
||||||
pub semi: Semi,
|
pub semi: Semi,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord)]
|
#[derive(Clone, Debug, PartialEq, Eq)]
|
||||||
pub enum Semi {
|
pub enum Semi {
|
||||||
Terminated,
|
Terminated,
|
||||||
Unterminated,
|
Unterminated,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord)]
|
#[derive(Clone, Debug, PartialEq, Eq)]
|
||||||
pub enum StmtKind {
|
pub enum StmtKind {
|
||||||
Empty,
|
Empty,
|
||||||
Local(Let),
|
Local(Let),
|
||||||
@ -238,7 +239,7 @@ pub enum StmtKind {
|
|||||||
Expr(Box<Expr>),
|
Expr(Box<Expr>),
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord)]
|
#[derive(Clone, Debug, PartialEq, Eq)]
|
||||||
pub struct Let {
|
pub struct Let {
|
||||||
pub mutable: Mutability,
|
pub mutable: Mutability,
|
||||||
pub name: Identifier,
|
pub name: Identifier,
|
||||||
@ -247,13 +248,13 @@ pub struct Let {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Stores an abstract expression, and associated metadata
|
/// Stores an abstract expression, and associated metadata
|
||||||
#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord)]
|
#[derive(Clone, Debug, PartialEq, Eq)]
|
||||||
pub struct Expr {
|
pub struct Expr {
|
||||||
pub extents: Span,
|
pub extents: Span,
|
||||||
pub kind: ExprKind,
|
pub kind: ExprKind,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord)]
|
#[derive(Clone, Debug, PartialEq, Eq)]
|
||||||
pub enum ExprKind {
|
pub enum ExprKind {
|
||||||
/// An [Assign]ment expression: [`Expr`] ([`AssignKind`] [`Expr`])\+
|
/// An [Assign]ment expression: [`Expr`] ([`AssignKind`] [`Expr`])\+
|
||||||
Assign(Box<Assign>),
|
Assign(Box<Assign>),
|
||||||
@ -300,14 +301,14 @@ pub enum ExprKind {
|
|||||||
Continue(Continue),
|
Continue(Continue),
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord)]
|
#[derive(Clone, Debug, PartialEq, Eq)]
|
||||||
pub struct Assign {
|
pub struct Assign {
|
||||||
pub head: Expr,
|
pub head: Expr,
|
||||||
pub op: AssignKind,
|
pub op: AssignKind,
|
||||||
pub tail: Box<Expr>,
|
pub tail: Box<Expr>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, Copy, Debug, PartialEq, Eq, PartialOrd, Ord)]
|
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
|
||||||
pub enum AssignKind {
|
pub enum AssignKind {
|
||||||
/// Standard Assignment with no read-back
|
/// Standard Assignment with no read-back
|
||||||
Plain,
|
Plain,
|
||||||
@ -323,13 +324,13 @@ pub enum AssignKind {
|
|||||||
Rem,
|
Rem,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord)]
|
#[derive(Clone, Debug, PartialEq, Eq)]
|
||||||
pub struct Binary {
|
pub struct Binary {
|
||||||
pub head: Box<Expr>,
|
pub head: Box<Expr>,
|
||||||
pub tail: Vec<(BinaryKind, Expr)>,
|
pub tail: Vec<(BinaryKind, Expr)>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, Copy, Debug, PartialEq, Eq, PartialOrd, Ord)]
|
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
|
||||||
pub enum BinaryKind {
|
pub enum BinaryKind {
|
||||||
Lt,
|
Lt,
|
||||||
LtEq,
|
LtEq,
|
||||||
@ -355,13 +356,13 @@ pub enum BinaryKind {
|
|||||||
Dot,
|
Dot,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord)]
|
#[derive(Clone, Debug, PartialEq, Eq)]
|
||||||
pub struct Unary {
|
pub struct Unary {
|
||||||
pub ops: Vec<UnaryKind>,
|
pub ops: Vec<UnaryKind>,
|
||||||
pub tail: Box<Expr>,
|
pub tail: Box<Expr>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord)]
|
#[derive(Clone, Debug, PartialEq, Eq)]
|
||||||
pub enum UnaryKind {
|
pub enum UnaryKind {
|
||||||
Deref,
|
Deref,
|
||||||
Neg,
|
Neg,
|
||||||
@ -372,36 +373,36 @@ pub enum UnaryKind {
|
|||||||
Tilde,
|
Tilde,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord)]
|
#[derive(Clone, Debug, PartialEq, Eq)]
|
||||||
pub struct Member {
|
pub struct Member {
|
||||||
pub head: Box<Expr>,
|
pub head: Box<Expr>,
|
||||||
pub tail: Vec<Expr>,
|
pub tail: Vec<Expr>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord)]
|
#[derive(Clone, Debug, PartialEq, Eq)]
|
||||||
pub enum MemberKind {
|
pub enum MemberKind {
|
||||||
Dot,
|
Dot,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord)]
|
#[derive(Clone, Debug, PartialEq, Eq)]
|
||||||
pub struct Call {
|
pub struct Call {
|
||||||
pub callee: Box<Expr>,
|
pub callee: Box<Expr>,
|
||||||
pub args: Vec<Tuple>,
|
pub args: Vec<Tuple>,
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Index operator: Member (`[` Expr `]`)*
|
/// Index operator: Member (`[` Expr `]`)*
|
||||||
#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord)]
|
#[derive(Clone, Debug, PartialEq, Eq)]
|
||||||
pub struct Index {
|
pub struct Index {
|
||||||
pub head: Box<Expr>,
|
pub head: Box<Expr>,
|
||||||
pub indices: Vec<Indices>,
|
pub indices: Vec<Indices>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord)]
|
#[derive(Clone, Debug, PartialEq, Eq)]
|
||||||
pub struct Indices {
|
pub struct Indices {
|
||||||
pub exprs: Vec<Expr>,
|
pub exprs: Vec<Expr>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord)]
|
#[derive(Clone, Debug, PartialEq, Eq)]
|
||||||
pub enum Literal {
|
pub enum Literal {
|
||||||
Bool(bool),
|
Bool(bool),
|
||||||
Char(char),
|
Char(char),
|
||||||
@ -409,54 +410,54 @@ pub enum Literal {
|
|||||||
String(String),
|
String(String),
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord)]
|
#[derive(Clone, Debug, PartialEq, Eq)]
|
||||||
pub struct Array {
|
pub struct Array {
|
||||||
pub values: Vec<Expr>,
|
pub values: Vec<Expr>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord)]
|
#[derive(Clone, Debug, PartialEq, Eq)]
|
||||||
pub struct ArrayRep {
|
pub struct ArrayRep {
|
||||||
pub value: Box<Expr>,
|
pub value: Box<Expr>,
|
||||||
pub repeat: Box<Expr>,
|
pub repeat: Box<Expr>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord)]
|
#[derive(Clone, Debug, PartialEq, Eq)]
|
||||||
pub struct AddrOf {
|
pub struct AddrOf {
|
||||||
pub count: usize,
|
pub count: usize,
|
||||||
pub mutable: Mutability,
|
pub mutable: Mutability,
|
||||||
pub expr: Box<Expr>,
|
pub expr: Box<Expr>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord)]
|
#[derive(Clone, Debug, PartialEq, Eq)]
|
||||||
pub struct Block {
|
pub struct Block {
|
||||||
pub stmts: Vec<Stmt>,
|
pub stmts: Vec<Stmt>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord)]
|
#[derive(Clone, Debug, PartialEq, Eq)]
|
||||||
pub struct Group {
|
pub struct Group {
|
||||||
pub expr: Box<Expr>,
|
pub expr: Box<Expr>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord)]
|
#[derive(Clone, Debug, PartialEq, Eq)]
|
||||||
pub struct Tuple {
|
pub struct Tuple {
|
||||||
pub exprs: Vec<Expr>,
|
pub exprs: Vec<Expr>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord)]
|
#[derive(Clone, Debug, PartialEq, Eq)]
|
||||||
pub struct While {
|
pub struct While {
|
||||||
pub cond: Box<Expr>,
|
pub cond: Box<Expr>,
|
||||||
pub pass: Box<Block>,
|
pub pass: Box<Block>,
|
||||||
pub fail: Else,
|
pub fail: Else,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord)]
|
#[derive(Clone, Debug, PartialEq, Eq)]
|
||||||
pub struct If {
|
pub struct If {
|
||||||
pub cond: Box<Expr>,
|
pub cond: Box<Expr>,
|
||||||
pub pass: Box<Block>,
|
pub pass: Box<Block>,
|
||||||
pub fail: Else,
|
pub fail: Else,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord)]
|
#[derive(Clone, Debug, PartialEq, Eq)]
|
||||||
pub struct For {
|
pub struct For {
|
||||||
pub bind: Identifier, // TODO: Patterns?
|
pub bind: Identifier, // TODO: Patterns?
|
||||||
pub cond: Box<Expr>,
|
pub cond: Box<Expr>,
|
||||||
@ -464,20 +465,20 @@ pub struct For {
|
|||||||
pub fail: Else,
|
pub fail: Else,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord)]
|
#[derive(Clone, Debug, PartialEq, Eq)]
|
||||||
pub struct Else {
|
pub struct Else {
|
||||||
pub body: Option<Box<Expr>>,
|
pub body: Option<Box<Expr>>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord)]
|
#[derive(Clone, Debug, PartialEq, Eq)]
|
||||||
pub struct Break {
|
pub struct Break {
|
||||||
pub body: Option<Box<Expr>>,
|
pub body: Option<Box<Expr>>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord)]
|
#[derive(Clone, Debug, PartialEq, Eq)]
|
||||||
pub struct Return {
|
pub struct Return {
|
||||||
pub body: Option<Box<Expr>>,
|
pub body: Option<Box<Expr>>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, Copy, Debug, Default, PartialEq, Eq, PartialOrd, Ord)]
|
#[derive(Clone, Copy, Debug, Default, PartialEq, Eq)]
|
||||||
pub struct Continue;
|
pub struct Continue;
|
||||||
|
Loading…
Reference in New Issue
Block a user