1 | # Tea |
2 | |
3 | | TeaFunc(Token name, |
4 | ParamGroup? positional, ParamGroup? named, |
5 | List[TypeExpr] return_types, command body) |
6 | | Data(Token name, List[Param] params) |
7 | | Enum(Token name, List[Variant] variants) |
8 | | Class(Token name, Token? extends, List[class_item] items) |
9 | | Import(SingleQuoted path, Token? alias, List[ImportName] names) |
10 | | For(List[NameType] targets, expr iterable, command body) |
11 | | While(expr test, command body) |
12 | | Break | Continue |
13 | | Return(expr? value) |
14 | |
15 | # Binary(x expr, y expr) or Nullary %Token |
16 | # In the first case we have a tag, and an anonymous type. |
17 | variant_type = |
18 | Anon(List[Param] params) |
19 | | Ref(Token type_name) |
20 | |
21 | # tags and types are separate in our model of algebraic data types |
22 | Variant = (Token tag_name, variant_type? typ) |
23 | |
24 | class_item = |
25 | Data(Token keyword, List[NameType] fields) |
26 | | Method() |
27 | |
28 | ImportName = (Token name, Token? alias) |