Skip to main content

yog_script_analyze/ast/
mod.rs

1//! The syntax tree of a Yog Script source (`docs/design/ys-grammar.md`).
2
3mod decl;
4mod expr;
5mod generics;
6mod pass;
7mod patch;
8mod pattern;
9mod stmt;
10mod walk;
11
12pub use decl::{
13    Accessor, Attribute, Chain, Ctor, Decl, DeclKind, Field, Method, MethodBody, Modifier, Param,
14    Prop, TypeHeader, Variant, VersionCond,
15};
16pub use expr::{Arg, Arm, BinOp, Element, Expr, ExprKind, LambdaBody, LambdaParam, StrSeg, UnOp};
17pub use generics::{Constraint, Generic, Variance, Where};
18pub use pass::Pass;
19pub use patch::{Callee, Local, Patch, PatchItem, Point, Selector, Target};
20pub use pattern::{Pattern, Type, TypeKind};
21pub use stmt::{Binding, Block, Stmt};
22
23use crate::source::token::Span;
24
25/// A block lambda's one parameter (`list.Select { it * 2 }`).
26pub const IT: &str = "it";
27
28/// A name as written, and where.
29#[derive(Debug, Clone, PartialEq)]
30pub struct Name {
31    pub text: String,
32    pub span: Span,
33}
34
35/// A source file.
36#[derive(Debug, Clone, PartialEq, Default)]
37pub struct File {
38    pub decls: Vec<Decl>,
39}