Merge branch 'll-and-gg-operators' into wip
[nit.git] / src / parser / parser_prod.nit
index b51ae9e..4ec1345 100644 (file)
@@ -4,6 +4,7 @@ package parser_prod
 
 import lexer
 intrude import parser_nodes
+private import tables
 
 redef class ANode
        # Parent of the node in the AST
@@ -936,6 +937,7 @@ redef class AAttrPropdef
             n_visibility: nullable AVisibility,
             n_kwvar: nullable TKwvar,
             n_id: nullable TAttrid,
+            n_id2: nullable TId,
             n_type: nullable AType,
             n_expr: nullable AExpr
     )
@@ -961,8 +963,14 @@ redef class AAttrPropdef
        n_visibility.parent = self
         _n_kwvar = n_kwvar.as(not null)
        n_kwvar.parent = self
-        _n_id = n_id.as(not null)
-       n_id.parent = self
+        _n_id = n_id
+       if n_id != null then
+               n_id.parent = self
+       end
+        _n_id2 = n_id2
+       if n_id2 != null then
+               n_id2.parent = self
+       end
         _n_type = n_type
        if n_type != null then
                n_type.parent = self
@@ -1041,7 +1049,17 @@ redef class AAttrPropdef
                assert new_child isa TAttrid
                 _n_id = new_child
            else
-               abort
+               _n_id = null
+            end
+            return
+       end
+        if _n_id2 == old_child then
+            if new_child != null then
+                new_child.parent = self
+               assert new_child isa TId
+                _n_id2 = new_child
+           else
+               _n_id2 = null
             end
             return
        end
@@ -1083,7 +1101,12 @@ redef class AAttrPropdef
         end
         v.enter_visit(_n_visibility)
         v.enter_visit(_n_kwvar)
-        v.enter_visit(_n_id)
+        if _n_id != null then
+            v.enter_visit(_n_id.as(not null))
+        end
+        if _n_id2 != null then
+            v.enter_visit(_n_id2.as(not null))
+        end
         if _n_type != null then
             v.enter_visit(_n_type.as(not null))
         end
@@ -2006,6 +2029,7 @@ redef class AWriteAble
 
     init init_awriteable (
             n_kwredef: nullable TKwredef,
+            n_visibility: nullable AVisibility,
             n_kwwritable: nullable TKwwritable
     )
     do
@@ -2014,6 +2038,10 @@ redef class AWriteAble
        if n_kwredef != null then
                n_kwredef.parent = self
        end
+        _n_visibility = n_visibility
+       if n_visibility != null then
+               n_visibility.parent = self
+       end
         _n_kwwritable = n_kwwritable.as(not null)
        n_kwwritable.parent = self
     end
@@ -2030,6 +2058,16 @@ redef class AWriteAble
             end
             return
        end
+        if _n_visibility == old_child then
+            if new_child != null then
+                new_child.parent = self
+               assert new_child isa AVisibility
+                _n_visibility = new_child
+           else
+               _n_visibility = null
+            end
+            return
+       end
         if _n_kwwritable == old_child then
             if new_child != null then
                 new_child.parent = self
@@ -2047,6 +2085,9 @@ redef class AWriteAble
         if _n_kwredef != null then
             v.enter_visit(_n_kwredef.as(not null))
         end
+        if _n_visibility != null then
+            v.enter_visit(_n_visibility.as(not null))
+        end
         v.enter_visit(_n_kwwritable)
     end
 end
@@ -2422,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
 
@@ -4442,6 +4545,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
 
@@ -4532,6 +4680,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