From ab048875e8f9b4861221c32751c5e503b3cafcb6 Mon Sep 17 00:00:00 2001 From: jantuomi Date: Mon, 29 Aug 2016 15:28:45 +0300 Subject: Implement 'new' keyword for object instantiation Add NotAPrototypeError --- .../exception/types/NotAPrototypeTunkkiError.java | 20 ++++++++++++++++++++ .../jantuomi/tunkki/exception/types/TunkkiError.java | 3 ++- 2 files changed, 22 insertions(+), 1 deletion(-) create mode 100644 src/main/com/jantuomi/tunkki/exception/types/NotAPrototypeTunkkiError.java (limited to 'src/main/com/jantuomi/tunkki/exception') diff --git a/src/main/com/jantuomi/tunkki/exception/types/NotAPrototypeTunkkiError.java b/src/main/com/jantuomi/tunkki/exception/types/NotAPrototypeTunkkiError.java new file mode 100644 index 0000000..db351bb --- /dev/null +++ b/src/main/com/jantuomi/tunkki/exception/types/NotAPrototypeTunkkiError.java @@ -0,0 +1,20 @@ +package com.jantuomi.tunkki.exception.types; + +/** + * Created by jan on 29.8.2016. + */ +public class NotAPrototypeTunkkiError extends TunkkiError { + public NotAPrototypeTunkkiError(int line, String... args) { + super(line, args); + } + + @Override + public String what() { + return "Symbol %s is not an object prototype."; + } + + @Override + ExceptionType getType() { + return ExceptionType.NotAPrototypeError; + } +} diff --git a/src/main/com/jantuomi/tunkki/exception/types/TunkkiError.java b/src/main/com/jantuomi/tunkki/exception/types/TunkkiError.java index dfef1cf..3bc4186 100644 --- a/src/main/com/jantuomi/tunkki/exception/types/TunkkiError.java +++ b/src/main/com/jantuomi/tunkki/exception/types/TunkkiError.java @@ -27,7 +27,8 @@ abstract public class TunkkiError extends Exception { FileNotFoundError, NotAnObjectError, MissingTerminatorTokenError, - NadaError + NadaError, + NotAPrototypeError } private int line; -- cgit v1.3