_____________________________________________________________________________
Immediately
+ - I still don't like Atom.Infer and Atom.Invert...
+
- Fix the metagrammar (really?)
- decent/better error messages
// Subclasses //////////////////////////////////////////////////////////////////////////////
+ /** an atom which tracks the possible tokenset of some element, provided that element can only match single-token sequences */
public static class Infer<T extends Input> extends Atom<T> {
private final Element e;
public Infer(Element e) { this.e = e; }
public Topology<T> top() { return (Topology<T>)toAtom(e); }
- public String toString() { return e.toString(); /* FIXME should be toAtom() */ }
+ public String toString() { return e.toString(); }
}
+ /** an atom which tracks the inverse of some other atom */
public static class Invert<T extends Input> extends Atom<T> {
private final Atom<T> a;
public Invert(Atom<T> a) { this.a = a; }
private Forest forest;
- public Phase(Phase prev, Parser parser, Phase previous, Tok token, Input.Location location, Forest forest) {
+ public Phase(Phase prev, Parser parser, Phase previous, Tok token, Input.Location location, Forest forest) throws ParseFailed {
this.prev = prev;
this.forest = forest;
this.parser = parser;
reset();
}
- public void reset() {
+ public void reset() throws ParseFailed {
waiting.clear();
performed.clear();
hash = new IntPairMap<Phase.Node>();
}
/** perform all reduction operations */
- public void reduce() {
+ public void reduce() throws ParseFailed{
try {
reducing = true;
if (reducing_list==null || reducing_list.length < hash.size())
import java.util.*;
/** thrown when the parser arrives at a state from which it is clear that no valid parse can result */
-public class ParseFailed extends RuntimeException {
+public class ParseFailed extends Exception {
private final Input.Location location;
private final String message;
public ParseFailed() { this("", null); }