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