|
| 1 | +supertypes: |
| 2 | + expr: |
| 3 | + - binary_expr |
| 4 | + - unary_expr |
| 5 | + - name_expr |
| 6 | + - lambda_expr |
| 7 | + - unsupported_node |
| 8 | + stmt: |
| 9 | + - empty_stmt |
| 10 | + - if_stmt |
| 11 | + - variable_declaration_stmt |
| 12 | + - guard_if_stmt |
| 13 | + - unsupported_node |
| 14 | + condition: |
| 15 | + - expr_condition |
| 16 | + - let_pattern_condition |
| 17 | + - unsupported_node |
| 18 | + pattern: |
| 19 | + - var_pattern |
| 20 | + - apply_pattern |
| 21 | + - ignore_pattern |
| 22 | + - unsupported_node |
| 23 | +named: |
| 24 | + # Top-level is the root node, currently containing a list of expressions |
| 25 | + top_level: |
| 26 | + body*: expr |
| 27 | + |
| 28 | + # Application of a binary operator, such as `a + b` |
| 29 | + binary_expr: |
| 30 | + left: expr |
| 31 | + operator: operator |
| 32 | + right: expr |
| 33 | + |
| 34 | + # Application of a unary operator, such as `!x` |
| 35 | + unary_expr: |
| 36 | + operand: expr |
| 37 | + operator: operator |
| 38 | + |
| 39 | + # An identifier used in the context of an expression |
| 40 | + name_expr: |
| 41 | + identifier: identifier |
| 42 | + |
| 43 | + lambda_expr: |
| 44 | + parameter*: parameter |
| 45 | + body: [expr, stmt] |
| 46 | + |
| 47 | + # A parameter |
| 48 | + parameter: |
| 49 | + pattern: pattern |
| 50 | + |
| 51 | + empty_stmt: |
| 52 | + |
| 53 | + if_stmt: |
| 54 | + condition: condition |
| 55 | + then?: stmt |
| 56 | + else?: stmt |
| 57 | + |
| 58 | + variable_declaration_stmt: |
| 59 | + variable_declarator+: variable_declarator |
| 60 | + |
| 61 | + # A variable declaration, or assignment to a pattern. |
| 62 | + # The initializer is optional (but typically only possible in combination with a simple variable pattern). |
| 63 | + variable_declarator: |
| 64 | + pattern: pattern |
| 65 | + value?: expr |
| 66 | + |
| 67 | + # Evaluate 'condition', and if false, execute 'else' which must break from the enclosing block scope (return, break, etc). |
| 68 | + # Any variables bound by 'condition' will be in scope for the remainder of the enclosing block scope |
| 69 | + # (which differs from how if_stmt works). |
| 70 | + guard_if_stmt: |
| 71 | + condition: condition |
| 72 | + else: stmt |
| 73 | + |
| 74 | + # Evaluates the given condition and interprets it as a boolean (by language conventions) |
| 75 | + expr_condition: |
| 76 | + expr: expr |
| 77 | + |
| 78 | + # Evaluate 'expr' and match its result against 'pattern', and return true if it matches. |
| 79 | + # Variables bound by the pattern will be in scope within the 'true' branch controlled by this condition. |
| 80 | + let_pattern_condition: |
| 81 | + pattern: pattern |
| 82 | + value: expr |
| 83 | + |
| 84 | + # A pattern matching anything, binding its value to the given variable |
| 85 | + var_pattern: |
| 86 | + identifier: identifier |
| 87 | + |
| 88 | + # A pattern matching anything, binding no variables, usually using the syntax "_" |
| 89 | + ignore_pattern: |
| 90 | + |
| 91 | + # A pattern such as `Some(x)` where `Some` is the constructor and `x` is an argument |
| 92 | + apply_pattern: |
| 93 | + constructor: expr |
| 94 | + argument*: expr |
| 95 | + |
| 96 | + # An simple unqualified identifier token |
| 97 | + identifier: |
| 98 | + |
| 99 | + # A node that we don't yet translate |
| 100 | + unsupported_node: |
| 101 | + |
| 102 | + operator: |
0 commit comments