mago-syntax 1.60.2

A correct, fast, and memory-efficient PHP syntax implementation, including Lexer, Parser, AST/CST, and utilities for Mago.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
use mago_span::HasSpan;
use mago_span::Span;

use crate::cst::cst::expression::Expression;
use crate::cst::cst::keyword::Keyword;

#[derive(Debug, Clone, Eq, PartialEq, Hash, PartialOrd, Ord)]
#[cfg_attr(feature = "serde", derive(serde::Serialize))]
pub struct Throw<'arena> {
    pub throw: Keyword<'arena>,
    pub exception: &'arena Expression<'arena>,
}

impl HasSpan for Throw<'_> {
    fn span(&self) -> Span {
        self.throw.span().join(self.exception.span())
    }
}