syntax: enable a generalized for with iterate
[nit.git] / src / parser / parser_prod.nit
index d238917..655a8ab 100644 (file)
@@ -779,25 +779,25 @@ redef class AInterfaceClasskind
         v.enter_visit(_n_kwinterface)
     end
 end
-redef class AUniversalClasskind
+redef class AEnumClasskind
     private init empty_init do end
 
-    init init_auniversalclasskind (
-            n_kwuniversal: nullable TKwuniversal
+    init init_aenumclasskind (
+            n_kwenum: nullable TKwenum
     )
     do
         empty_init
-        _n_kwuniversal = n_kwuniversal.as(not null)
-       n_kwuniversal.parent = self
+        _n_kwenum = n_kwenum.as(not null)
+       n_kwenum.parent = self
     end
 
     redef fun replace_child(old_child: ANode, new_child: nullable ANode)
     do
-        if _n_kwuniversal == old_child then
+        if _n_kwenum == old_child then
             if new_child != null then
                 new_child.parent = self
-               assert new_child isa TKwuniversal
-                _n_kwuniversal = new_child
+               assert new_child isa TKwenum
+                _n_kwenum = new_child
            else
                abort
             end
@@ -807,7 +807,7 @@ redef class AUniversalClasskind
 
     redef fun visit_all(v: Visitor)
     do
-        v.enter_visit(_n_kwuniversal)
+        v.enter_visit(_n_kwenum)
     end
 end
 redef class AFormaldef
@@ -2463,6 +2463,68 @@ redef class AGtMethid
         v.enter_visit(_n_gt)
     end
 end
+redef class ALlMethid
+    private init empty_init do end
+
+    init init_allmethid (
+            n_ll: nullable TLl
+    )
+    do
+        empty_init
+        _n_ll = n_ll.as(not null)
+       n_ll.parent = self
+    end
+
+    redef fun replace_child(old_child: ANode, new_child: nullable ANode)
+    do
+        if _n_ll == old_child then
+            if new_child != null then
+                new_child.parent = self
+               assert new_child isa TLl
+                _n_ll = new_child
+           else
+               abort
+            end
+            return
+       end
+    end
+
+    redef fun visit_all(v: Visitor)
+    do
+        v.enter_visit(_n_ll)
+    end
+end
+redef class AGgMethid
+    private init empty_init do end
+
+    init init_aggmethid (
+            n_gg: nullable TGg
+    )
+    do
+        empty_init
+        _n_gg = n_gg.as(not null)
+       n_gg.parent = self
+    end
+
+    redef fun replace_child(old_child: ANode, new_child: nullable ANode)
+    do
+        if _n_gg == old_child then
+            if new_child != null then
+                new_child.parent = self
+               assert new_child isa TGg
+                _n_gg = new_child
+           else
+               abort
+            end
+            return
+       end
+    end
+
+    redef fun visit_all(v: Visitor)
+    do
+        v.enter_visit(_n_gg)
+    end
+end
 redef class ABraMethid
     private init empty_init do end
 
@@ -3772,7 +3834,7 @@ redef class AForExpr
 
     init init_aforexpr (
             n_kwfor: nullable TKwfor,
-            n_id: nullable TId,
+            n_ids: Collection[Object], # Should be Collection[TId]
             n_expr: nullable AExpr,
             n_kwdo: nullable TKwdo,
             n_block: nullable AExpr,
@@ -3782,8 +3844,11 @@ redef class AForExpr
         empty_init
         _n_kwfor = n_kwfor.as(not null)
        n_kwfor.parent = self
-        _n_id = n_id.as(not null)
-       n_id.parent = self
+       for n in n_ids do
+               assert n isa TId
+               _n_ids.add(n)
+               n.parent = self
+       end
         _n_expr = n_expr.as(not null)
        n_expr.parent = self
         _n_kwdo = n_kwdo.as(not null)
@@ -3810,16 +3875,18 @@ redef class AForExpr
             end
             return
        end
-        if _n_id == old_child then
-            if new_child != null then
-                new_child.parent = self
-               assert new_child isa TId
-                _n_id = new_child
-           else
-               abort
+        for i in [0.._n_ids.length[ do
+            if _n_ids[i] == old_child then
+                if new_child != null then
+                   assert new_child isa TId
+                    _n_ids[i] = new_child
+                    new_child.parent = self
+                else
+                    _n_ids.remove_at(i)
+                end
+                return
             end
-            return
-       end
+        end
         if _n_expr == old_child then
             if new_child != null then
                 new_child.parent = self
@@ -3865,7 +3932,9 @@ redef class AForExpr
     redef fun visit_all(v: Visitor)
     do
         v.enter_visit(_n_kwfor)
-        v.enter_visit(_n_id)
+            for n in _n_ids do
+                v.enter_visit(n)
+           end
         v.enter_visit(_n_expr)
         v.enter_visit(_n_kwdo)
         if _n_block != null then
@@ -4483,6 +4552,51 @@ redef class ALeExpr
         v.enter_visit(_n_expr2)
     end
 end
+redef class ALlExpr
+    private init empty_init do end
+
+    init init_allexpr (
+            n_expr: nullable AExpr,
+            n_expr2: nullable AExpr
+    )
+    do
+        empty_init
+        _n_expr = n_expr.as(not null)
+       n_expr.parent = self
+        _n_expr2 = n_expr2.as(not null)
+       n_expr2.parent = self
+    end
+
+    redef fun replace_child(old_child: ANode, new_child: nullable ANode)
+    do
+        if _n_expr == old_child then
+            if new_child != null then
+                new_child.parent = self
+               assert new_child isa AExpr
+                _n_expr = new_child
+           else
+               abort
+            end
+            return
+       end
+        if _n_expr2 == old_child then
+            if new_child != null then
+                new_child.parent = self
+               assert new_child isa AExpr
+                _n_expr2 = new_child
+           else
+               abort
+            end
+            return
+       end
+    end
+
+    redef fun visit_all(v: Visitor)
+    do
+        v.enter_visit(_n_expr)
+        v.enter_visit(_n_expr2)
+    end
+end
 redef class AGtExpr
     private init empty_init do end
 
@@ -4573,6 +4687,51 @@ redef class AGeExpr
         v.enter_visit(_n_expr2)
     end
 end
+redef class AGgExpr
+    private init empty_init do end
+
+    init init_aggexpr (
+            n_expr: nullable AExpr,
+            n_expr2: nullable AExpr
+    )
+    do
+        empty_init
+        _n_expr = n_expr.as(not null)
+       n_expr.parent = self
+        _n_expr2 = n_expr2.as(not null)
+       n_expr2.parent = self
+    end
+
+    redef fun replace_child(old_child: ANode, new_child: nullable ANode)
+    do
+        if _n_expr == old_child then
+            if new_child != null then
+                new_child.parent = self
+               assert new_child isa AExpr
+                _n_expr = new_child
+           else
+               abort
+            end
+            return
+       end
+        if _n_expr2 == old_child then
+            if new_child != null then
+                new_child.parent = self
+               assert new_child isa AExpr
+                _n_expr2 = new_child
+           else
+               abort
+            end
+            return
+       end
+    end
+
+    redef fun visit_all(v: Visitor)
+    do
+        v.enter_visit(_n_expr)
+        v.enter_visit(_n_expr2)
+    end
+end
 redef class AIsaExpr
     private init empty_init do end