metamodel: rename 'universal' to 'enum'
[nit.git] / src / parser / xss / nodes.xss
index 6d43485..a62df55 100644 (file)
@@ -18,18 +18,22 @@ $ // limitations under the License.
 $ template make_abs_nodes()
 # Root of the AST hierarchy
 abstract class PNode
-       readable var _location: nullable Location
+       var _location: nullable Location
+
+       # Location is set during AST building. Once built, location cannon be null
+       # However, manual instanciated nodes may need mode care
+       fun location: Location do return _location.as(not null)
 end
 
 # Ancestor of all tokens
 abstract class Token
-special PNode
+       super PNode
 end
 
 # Ancestor of all productions
 abstract class Prod
-special PNode
-       fun location=(loc: nullable Location) do _location = loc
+       super PNode
+       fun location=(loc: Location) do _location = loc
 end
 $ end template
 
@@ -58,31 +62,18 @@ redef class PNode
        # Visit all nodes in order.
        # Thus, call "v.visit(e)" for each node e
        fun visit_all(v: Visitor) is abstract
-
-       # Visit all nodes in reverse order.
-       # Thus, call "v.visit(e)" for each node e starting from the last child
-       fun visit_all_reverse(v: Visitor) is abstract
 end
 
 redef class Token
        redef fun visit_all(v: Visitor) do end
-       redef fun visit_all_reverse(v: Visitor) do end
        redef fun replace_child(old_child: PNode, new_child: nullable PNode) do end
 end
 
 redef class Prod
-       # The first token of the production node
-       readable writable var _first_token: nullable Token
-
-       # The last token of the production node
-       readable writable var _last_token: nullable Token
-
        redef fun replace_with(n: PNode)
         do
                 super
                 assert n isa Prod
-                n.first_token = first_token
-                n.last_token = last_token
                 n.location = location
         end
 end