From 2a11d8ca5ae3af89ac2bdea58f71e463b6e4affe Mon Sep 17 00:00:00 2001 From: adam Date: Mon, 30 Jan 2006 04:15:29 -0500 Subject: [PATCH] checkpoint darcs-hash:20060130091529-5007d-b12eb361060e818895d2d019dfe84ae146f458d5.gz --- TODO | 2 ++ src/edu/berkeley/sbp/Atom.java | 4 +++- src/edu/berkeley/sbp/GSS.java | 6 +++--- src/edu/berkeley/sbp/ParseFailed.java | 2 +- 4 files changed, 9 insertions(+), 5 deletions(-) diff --git a/TODO b/TODO index d9f9879..58123e7 100644 --- a/TODO +++ b/TODO @@ -1,6 +1,8 @@ _____________________________________________________________________________ Immediately + - I still don't like Atom.Infer and Atom.Invert... + - Fix the metagrammar (really?) - decent/better error messages diff --git a/src/edu/berkeley/sbp/Atom.java b/src/edu/berkeley/sbp/Atom.java index 70c2904..55be283 100644 --- a/src/edu/berkeley/sbp/Atom.java +++ b/src/edu/berkeley/sbp/Atom.java @@ -30,13 +30,15 @@ public abstract class Atom extends Element implements Topology { // Subclasses ////////////////////////////////////////////////////////////////////////////// + /** an atom which tracks the possible tokenset of some element, provided that element can only match single-token sequences */ public static class Infer extends Atom { private final Element e; public Infer(Element e) { this.e = e; } public Topology top() { return (Topology)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 extends Atom { private final Atom a; public Invert(Atom a) { this.a = a; } diff --git a/src/edu/berkeley/sbp/GSS.java b/src/edu/berkeley/sbp/GSS.java index 89a16ed..a5d6f88 100644 --- a/src/edu/berkeley/sbp/GSS.java +++ b/src/edu/berkeley/sbp/GSS.java @@ -48,7 +48,7 @@ class GSS { 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; @@ -59,7 +59,7 @@ class GSS { reset(); } - public void reset() { + public void reset() throws ParseFailed { waiting.clear(); performed.clear(); hash = new IntPairMap(); @@ -183,7 +183,7 @@ class GSS { } /** perform all reduction operations */ - public void reduce() { + public void reduce() throws ParseFailed{ try { reducing = true; if (reducing_list==null || reducing_list.length < hash.size()) diff --git a/src/edu/berkeley/sbp/ParseFailed.java b/src/edu/berkeley/sbp/ParseFailed.java index 0fd9226..2245b67 100644 --- a/src/edu/berkeley/sbp/ParseFailed.java +++ b/src/edu/berkeley/sbp/ParseFailed.java @@ -8,7 +8,7 @@ import java.io.*; 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); } -- 1.7.10.4