Merge branch 'pu/parser_tables_in_c' into wip
[nit.git] / src / parser / parser_prod.nit
index e356c4c..a4fbac9 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
@@ -863,12 +864,19 @@ redef class ASuperclass
 
     init init_asuperclass (
             n_kwspecial: nullable TKwspecial,
+            n_kwsuper: nullable TKwsuper,
             n_type: nullable AType
     )
     do
         empty_init
-        _n_kwspecial = n_kwspecial.as(not null)
-       n_kwspecial.parent = self
+        _n_kwspecial = n_kwspecial
+       if n_kwspecial != null then
+               n_kwspecial.parent = self
+       end
+        _n_kwsuper = n_kwsuper
+       if n_kwsuper != null then
+               n_kwsuper.parent = self
+       end
         _n_type = n_type.as(not null)
        n_type.parent = self
     end
@@ -881,7 +889,17 @@ redef class ASuperclass
                assert new_child isa TKwspecial
                 _n_kwspecial = new_child
            else
-               abort
+               _n_kwspecial = null
+            end
+            return
+       end
+        if _n_kwsuper == old_child then
+            if new_child != null then
+                new_child.parent = self
+               assert new_child isa TKwsuper
+                _n_kwsuper = new_child
+           else
+               _n_kwsuper = null
             end
             return
        end
@@ -899,7 +917,12 @@ redef class ASuperclass
 
     redef fun visit_all(v: Visitor)
     do
-        v.enter_visit(_n_kwspecial)
+        if _n_kwspecial != null then
+            v.enter_visit(_n_kwspecial.as(not null))
+        end
+        if _n_kwsuper != null then
+            v.enter_visit(_n_kwsuper.as(not null))
+        end
         v.enter_visit(_n_type)
     end
 end
@@ -4105,6 +4128,51 @@ redef class AAndExpr
         v.enter_visit(_n_expr2)
     end
 end
+redef class AOrElseExpr
+    private init empty_init do end
+
+    init init_aorelseexpr (
+            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 ANotExpr
     private init empty_init do end