| 1 | //! Abstract syntax tree node definitions. |
| 2 | //! |
| 3 | //! AST nodes for expressions, statements, declarations, |
| 4 | //! program units, and all Fortran constructs. Every node |
| 5 | //! carries a Span for source location tracking. |
| 6 | |
| 7 | pub mod decl; |
| 8 | pub mod expr; |
| 9 | pub mod stmt; |
| 10 | pub mod unit; |
| 11 | |
| 12 | use crate::lexer::Span; |
| 13 | |
| 14 | /// A spanned AST node — wraps any node with its source location. |
| 15 | #[derive(Debug, Clone, PartialEq)] |
| 16 | pub struct Spanned<T> { |
| 17 | pub node: T, |
| 18 | pub span: Span, |
| 19 | } |
| 20 | |
| 21 | impl<T> Spanned<T> { |
| 22 | pub fn new(node: T, span: Span) -> Self { |
| 23 | Self { node, span } |
| 24 | } |
| 25 | } |
| 26 |