1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
//! Tools for generating AST trees.

pub mod meta;
pub mod opcode;

pub use meta::AstMeta;
pub use opcode::Opcode;

/// A list of possible AST expressions.
#[derive(Debug)]
pub enum Ast {

    NullLiteral,

    /// A boolean literal, either `true` or `false`.
    BooleanLiteral(bool),

    /// A 64-bit floating point number literal.
    FloatLiteral(f64),

    /// A 64-bit integer literal.
    IntegerLiteral(i64),

    /// An identifier literal.
    IdentifierLiteral(String),

    /// A string literal.
    StringLiteral(String),

    /// A binary expression with two operands.
    /// 
    /// ```flycatcher
    /// 1 + 1
    /// ```
    BinaryExpression(Opcode, Box<AstMeta>, Box<AstMeta>),

    /// An expression made with an unlimited amount of indexes, for example,
    /// `item1["item2"].item3[item4()]`
    IndexExpression(Vec<AstMeta>),

    /// An index for an IndexExpression that may contain something other than an identifier.
    /// 
    /// ```flycatcher
    /// item1["BracketIndexHere"]
    /// ```
    BracketIndex(Box<AstMeta>),

    /// This is caused by using the `+` operator at the start of an operand, such as `+10`.
    PositiveUnary(Box<AstMeta>),

    /// This is caused by using the `-` operator at the start of an operand, such as `-10`.
    NegativeUnary(Box<AstMeta>),

}