/* --------------------------------------------------------- * * __________ 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 com.sector91.delta.script.DScriptErr; /** * <p>An exception thrown by the DeltaScript parser. Occurs when a syntax error * or other issue is encountered while parsing DeltaScript code, and records the * exact line and character at which the error occurred.</p> * * @author Adam R. Nelson * @version 4.13.11.0 */ @SuppressWarnings("serial") public class DScriptParserException extends Exception { private final String scriptName; private final LexToken location; DScriptParserException(String message, String scriptName, LexToken location) { super(message); this.scriptName = scriptName; this.location = location; } DScriptParserException(Throwable cause, String scriptName, LexToken location) { super(cause); this.scriptName = scriptName; this.location = location; } public String getScriptName() {return scriptName;} public int getLocation() {return location.start();} public String getLocatorText(String source) {return DScriptErr.locatorText(scriptName, source, location.start(), 1);} }