/* --------------------------------------------------------- * * __________ D E L T A S C R I P T * * (_________() * * / === / - A fast, dynamic scripting language * * | == | - Version 4.13.11.0 * * / === / - Developed by Adam R. Nelson * * | = = | - 2011-2013 * * / === / - Distributed under GNU LGPL v3 * * (________() - http://github.com/ar-nelson/deltascript * * * * --------------------------------------------------------- */ package com.sector91.delta.script.parser; import java.io.IOException; class ErrorLexToken extends LexToken { private final Exception ex; ErrorLexToken(Exception ex, int line, int ch) { super(null, line, ch); this.ex = ex; } @Override public TokenType type() throws DScriptLexerException, IOException { if (ex instanceof IOException) throw (IOException)ex; else if (ex instanceof DScriptLexerException) throw (DScriptLexerException)ex; else throw new DScriptLexerException(ex); } @Override public String value() throws DScriptLexerException, IOException { if (ex instanceof IOException) throw (IOException)ex; else if (ex instanceof DScriptLexerException) throw (DScriptLexerException)ex; else throw new DScriptLexerException(ex); } @Override public String toString() { return "ERROR - " + ex.getClass().getSimpleName() + ": " + ex.getMessage(); } }