use crate::lexer::Span;
pub mod error;
pub mod literals;
pub mod nodes;
pub mod operators;
pub mod patterns;
pub mod types;
pub use error::ParseError;
pub use literals::{EnumVariant, Field, LiteralNode, Param, TraitBound, TraitRef};
pub use nodes::{
AstNode, ExpressionKind, ExpressionNode, FunctionNode, ImportSpec, StatementKind, StatementNode,
};
pub use operators::{BinaryOp, Precedence, UnaryOp};
pub use patterns::{MatchArm, PatternNode};
pub use types::{PrimitiveType, TypeKind, TypeNode};
pub trait Spanned {
fn span(&self) -> &Span;
}
pub trait SpanExt {
fn combine(&self, other: &Span) -> Span;
}
impl SpanExt for Span {
fn combine(&self, other: &Span) -> Span {
let mut span = *self;
if let (Some(end_row), Some(end_col)) = (other.row_end, other.col_end) {
span.complete(end_row, end_col);
}
span
}
}