m3tk/src/gast/AST_Name.i3


Copyright (C) 1994, Digital Equipment Corp.
AST_Name defines a method that returns a print-name for an AST node.
INTERFACE AST_Name;

IMPORT AST;
IMPORT AST_Init AS Previous_View;

TYPE
  NODE = Previous_View.NODE OBJECT
    METHODS
      name(): TEXT RAISES {} := Null;
  END;

REVEAL
  AST.NODE <: NODE;

PROCEDURE Null(n: NODE): TEXT RAISES {};
Returns a text for a node without a specific name method, of the form:
       "no name for node with typecode " & 
            Fmt.Int(TYPECODE(n)) 

END AST_Name.
It is occasionally useful to have access to a name for an AST node, in the form of a TEXT. This view provides such a method, with a suitable default.