test/derived/CalcLexStd.m3


MODULE CalcLexStd;
generated by kext
IMPORT CalcLex;
IMPORT Text;

REVEAL
  T = Public BRANDED "CalcLexStd" OBJECT
    allocate_DIGIT: Allocator := NIL;
    allocate_LETTER: Allocator := NIL;
  OVERRIDES
    purge := Proc_Purge;
    DIGIT := Proc_DIGIT;
    LETTER := Proc_LETTER;
  END;

PROCEDURE Proc_Purge(self: T): INTEGER =
  BEGIN
    RETURN CalcLex.T.purge(self)
      + Purge(self.allocate_DIGIT)
      + Purge(self.allocate_LETTER);
  END Proc_Purge;
expression procedures
PROCEDURE Proc_LETTER(self: T): Token =
  BEGIN (* user code *)
   VAR result:LETTER:=NewPT(self.allocate_LETTER,TYPECODE(LETTER));BEGIN BEGIN
    result.val := Text.GetChar(self.getText(),0)
   END;RETURN result;END
  END Proc_LETTER;

PROCEDURE Proc_DIGIT(self: T): Token =
  BEGIN (* user code *)
   VAR result:DIGIT:=NewPT(self.allocate_DIGIT,TYPECODE(DIGIT));BEGIN BEGIN
    result.val := ORD(Text.GetChar(self.getText(),0)) - ORD('0')
   END;RETURN result;END
  END Proc_DIGIT;

BEGIN
END CalcLexStd.