Skip to main content

shape_ast/ast/
mod.rs

1//! Abstract Syntax Tree definitions for Shape
2//!
3//! This module defines the complete AST for the Shape language,
4//! supporting all features from the language specification.
5
6// Declare submodules
7pub mod data_refs;
8pub mod data_sources;
9pub mod docs;
10pub mod expr_helpers;
11pub mod expressions;
12pub mod functions;
13pub mod joins;
14pub mod literals;
15pub mod modules;
16pub mod operators;
17pub mod patterns;
18pub mod program;
19pub mod queries;
20pub mod span;
21pub mod statements;
22pub mod streams;
23pub mod tests;
24pub mod time;
25pub mod type_path;
26pub mod types;
27pub mod windows;
28
29// Re-export all public types for backwards compatibility
30// This ensures that code using `use crate::ast::TypeName` continues to work
31
32// From span.rs
33pub use span::{Span, Spanned};
34
35// From literals.rs
36pub use literals::{Duration, DurationUnit, InterpolationMode, Literal};
37
38// From operators.rs
39pub use operators::{BinaryOp, RangeKind, UnaryOp};
40
41// From time.rs
42pub use time::{
43    DateTimeExpr, NamedTime, RelativeTime, TimeDirection, TimeReference, TimeUnit, TimeWindow,
44    Timeframe, TimeframeUnit,
45};
46
47// From data_refs.rs
48pub use data_refs::{DataDateTimeRef, DataIndex, DataRef};
49
50// From docs.rs
51pub use docs::{
52    DocComment, DocEntry, DocLink, DocTag, DocTagKind, DocTarget, DocTargetKind, ProgramDocs,
53    extend_method_doc_path, impl_method_doc_path, qualify_doc_owner_path, type_annotation_doc_path,
54    type_name_doc_path,
55};
56
57// From type_path.rs
58pub use type_path::TypePath;
59
60// From types.rs
61pub use types::{
62    EnumDef, EnumMember, EnumMemberKind, EnumValue, ExtendStatement, FunctionParam, ImplBlock,
63    MethodDef, NativeLayoutBinding, ObjectTypeField, StructField, StructTypeDef, TraitDef,
64    TraitMember, TraitMemberSignature, TypeAliasDef, TypeAnnotation, TypeName, TypeParam,
65};
66
67// From patterns.rs
68pub use patterns::{
69    DecompositionBinding, DestructurePattern, ObjectPatternField, Pattern,
70    PatternConstructorFields, SweepParam,
71};
72
73// From expressions.rs
74pub use expressions::{EnumConstructorPayload, Expr, ObjectEntry};
75
76// From expr_helpers.rs
77pub use expr_helpers::{
78    AssignExpr, AsyncLetExpr, BlockExpr, BlockItem, ComprehensionClause, ComptimeForExpr, ForExpr,
79    FromQueryExpr, IfExpr, JoinBranch, JoinExpr, JoinKind, LetExpr, ListComprehension, LoopExpr,
80    MatchArm, MatchExpr, OrderBySpec, QueryClause, WhileExpr,
81};
82
83// From statements.rs
84pub use statements::{Block, ForInit, ForLoop, IfStatement, Statement, WhileLoop};
85
86// From functions.rs
87pub use functions::{
88    Annotation, AnnotationDef, AnnotationHandler, AnnotationHandlerParam, AnnotationHandlerType,
89    AnnotationTargetKind, ForeignFunctionDef, FunctionDef, FunctionParameter, NativeAbiBinding,
90};
91
92// From modules.rs
93pub use modules::{
94    ExportItem, ExportSpec, ExportStmt, ImportItems, ImportSpec, ImportStmt, ModuleDecl,
95};
96
97// From queries.rs
98pub use queries::{AlertQuery, BacktestQuery, Cte, Query, QueryModifiers, WithQuery};
99
100// From joins.rs
101pub use joins::{JoinClause, JoinCondition, JoinSource, JoinType};
102
103// From windows.rs
104pub use windows::{
105    OrderByClause, SortDirection, WindowBound, WindowExpr, WindowFrame, WindowFrameType,
106    WindowFunction, WindowSpec,
107};
108
109// From streams.rs
110pub use streams::{StreamConfig, StreamDef, StreamOnError, StreamOnEvent, StreamOnWindow};
111
112// From tests.rs
113pub use tests::{
114    AssertStatement, ExpectStatement, ExpectationMatcher, ShouldMatcher, ShouldStatement, TestCase,
115    TestDef, TestFixture, TestMatchOptions, TestStatement,
116};
117
118// From data_sources.rs
119pub use data_sources::{DataSourceDecl, QueryDecl};
120
121// From program.rs
122pub use program::{
123    Assignment, BuiltinFunctionDecl, BuiltinTypeDecl, Item, OptimizationMetric, OptimizeStatement,
124    OwnershipModifier, Program, VarKind, VariableDecl,
125};