ocelot-ast 0.1.2

Abstract syntax tree types for the ocelot project
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
use crate::expression_kind::ExpressionKind;
use ocelot_base::span::Span;

/// Expression node with an explicit source span.
#[derive(Debug, Clone, PartialEq, Eq)]
pub struct Expression {
    pub kind: ExpressionKind,
    pub span: Span,
}

impl Expression {
    /// Creates an expression from its kind and source span.
    pub fn new(kind: ExpressionKind, span: Span) -> Self {
        Self { kind, span }
    }
}