syntax: new 'assert else' statement
[nit.git] / src / parser / parser_prod.nit
index 3b605f3..30dc2ff 100644 (file)
@@ -5144,6 +5144,104 @@ redef class AWhileExpr
         end
     end
 end
+redef class ALoopExpr
+    redef fun n_kwloop=(n)
+    do
+        _n_kwloop = n
+       n.parent = self
+    end
+    redef fun n_block=(n)
+    do
+        _n_block = n
+        if n != null then
+           n.parent = self
+        end
+    end
+    redef fun n_label=(n)
+    do
+        _n_label = n
+        if n != null then
+           n.parent = self
+        end
+    end
+
+    private init empty_init do end
+
+    init init_aloopexpr (
+            n_kwloop: nullable TKwloop,
+            n_block: nullable AExpr,
+            n_label: nullable ALabel
+    )
+    do
+        empty_init
+        _n_kwloop = n_kwloop.as(not null)
+       n_kwloop.parent = self
+        _n_block = n_block
+       if n_block != null then
+               n_block.parent = self
+       end
+        _n_label = n_label
+       if n_label != null then
+               n_label.parent = self
+       end
+    end
+
+    redef fun replace_child(old_child: ANode, new_child: nullable ANode)
+    do
+        if _n_kwloop == old_child then
+            if new_child != null then
+                new_child.parent = self
+               assert new_child isa TKwloop
+                _n_kwloop = new_child
+           else
+               abort
+            end
+            return
+       end
+        if _n_block == old_child then
+            if new_child != null then
+                new_child.parent = self
+               assert new_child isa AExpr
+                _n_block = new_child
+           else
+               _n_block = null
+            end
+            return
+       end
+        if _n_label == old_child then
+            if new_child != null then
+                new_child.parent = self
+               assert new_child isa ALabel
+                _n_label = new_child
+           else
+               _n_label = null
+            end
+            return
+       end
+    end
+
+    redef fun visit_all(v: Visitor)
+    do
+        v.enter_visit(_n_kwloop)
+        if _n_block != null then
+            v.enter_visit(_n_block.as(not null))
+        end
+        if _n_label != null then
+            v.enter_visit(_n_label.as(not null))
+        end
+    end
+
+    redef fun visit_all_reverse(v: Visitor)
+    do
+        v.enter_visit(_n_kwloop)
+        if _n_block != null then
+            v.enter_visit(_n_block.as(not null))
+        end
+        if _n_label != null then
+            v.enter_visit(_n_label.as(not null))
+        end
+    end
+end
 redef class AForExpr
     redef fun n_kwfor=(n)
     do
@@ -5320,13 +5418,21 @@ redef class AAssertExpr
         _n_expr = n
        n.parent = self
     end
+    redef fun n_else=(n)
+    do
+        _n_else = n
+        if n != null then
+           n.parent = self
+        end
+    end
 
     private init empty_init do end
 
     init init_aassertexpr (
             n_kwassert: nullable TKwassert,
             n_id: nullable TId,
-            n_expr: nullable AExpr
+            n_expr: nullable AExpr,
+            n_else: nullable AExpr
     )
     do
         empty_init
@@ -5338,6 +5444,10 @@ redef class AAssertExpr
        end
         _n_expr = n_expr.as(not null)
        n_expr.parent = self
+        _n_else = n_else
+       if n_else != null then
+               n_else.parent = self
+       end
     end
 
     redef fun replace_child(old_child: ANode, new_child: nullable ANode)
@@ -5372,6 +5482,16 @@ redef class AAssertExpr
             end
             return
        end
+        if _n_else == old_child then
+            if new_child != null then
+                new_child.parent = self
+               assert new_child isa AExpr
+                _n_else = new_child
+           else
+               _n_else = null
+            end
+            return
+       end
     end
 
     redef fun visit_all(v: Visitor)
@@ -5381,6 +5501,9 @@ redef class AAssertExpr
             v.enter_visit(_n_id.as(not null))
         end
         v.enter_visit(_n_expr)
+        if _n_else != null then
+            v.enter_visit(_n_else.as(not null))
+        end
     end
 
     redef fun visit_all_reverse(v: Visitor)
@@ -5390,6 +5513,9 @@ redef class AAssertExpr
             v.enter_visit(_n_id.as(not null))
         end
         v.enter_visit(_n_expr)
+        if _n_else != null then
+            v.enter_visit(_n_else.as(not null))
+        end
     end
 end
 redef class AOnceExpr