@@ -0,0 +1,1454 @@
+package com.five35.dex;%0A%0Aimport com.google.common.base.Optional;%0Aimport javax.annotation.concurrent.Immutable;%0A%0A/**%0A * An exception which occurs when a symbol is expected but not available.%0A */%0A@Immutable%0Apublic class MissingSymbolException extends ParserException %7B%0A%09private static final long serialVersionUID = 466382546876378790L;%0A%0A%09private final Optional%3CSymbol%3E expected;%0A%09private final Optional%3CToken%3E found;%0A%09private final int index;%0A%0A%09MissingSymbolException(final int index, final Optional%3CSymbol%3E expected, final Optional%3CToken%3E found) %7B%0A%09%09// In general, statements should be extracted rather than wrapped, but%0A%09%09// that isn't possible for constructors' super() calls, so just disable%0A%09%09// the formatter for this statement.%0A%0A%09%09//@formatter:off%0A%09%09super(String.format(%22Expected symbol%25s at %25d, but found %25s%22,%0A%09%09%09expected.isPresent() ? %22 %22 + expected.get().toString() : %22%22,%0A%09%09%09index,%0A%09%09%09found.isPresent() ? found.get().toString() : %22end of string%22));%0A%09%09//@formatter:on%0A%0A%09%09this.index = index;%0A%09%09this.expected = expected;%0A%09%09this.found = found;%0A%09%7D%0A%0A%09/**%0A%09 * @return The specific symbol expected, if any.%0A%09 */%0A%09public final Optional%3CSymbol%3E getExpected() %7B%0A%09%09return this.expected;%0A%09%7D%0A%0A%09/**%0A%09 * @return The unexpected token found, if any.%0A%09 */%0A%09public final Optional%3CToken%3E getFound() %7B%0A%09%09return this.found;%0A%09%7D%0A%0A%09/**%0A%09 * @return The index within the source at which this exception occurred.%0A%09 */%0A%09public final int getIndex() %7B%0A%09%09return this.index;%0A%09%7D%0A%7D%0A

implement an exception to throw when a symbol is requested but not available