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