package edu.berkeley.sbp;
import edu.berkeley.sbp.*;
-import edu.berkeley.sbp.Sequence.Position;
+import edu.berkeley.sbp.Sequence.Pos;
import edu.berkeley.sbp.Sequence.Pos;
import edu.berkeley.sbp.GSS.Phase;
-import edu.berkeley.sbp.Node;
+import edu.berkeley.sbp.StateNode;
import edu.berkeley.sbp.util.*;
import java.io.*;
import java.util.*;
return ret.toString();
}
- private static boolean important(Position p) {
+ private static boolean important(Pos p) {
if (p.isLast()) return false;
if (p.element() == null) return false;
if (!(p.element() instanceof Union)) return false;
return (c >= 'A' && c <= 'Z');
}
- static <Tok> void barf(HashMap<Element,Input.Location> sb, Node n, int indent, boolean skip, int count, Input.Location loc) {
+ static <Tok> void barf(HashMap<Element,Input.Location> sb, StateNode n, int indent, boolean skip, int count, Input.Location loc) {
if (count <= 0) {
barf(sb, n, indent, skip, loc);
} else {
/*
FIXME: removed
- for(Node nn : (Iterable<Node>)n.parents())
+ for(StateNode nn : (Iterable<StateNode>)n.parents())
barf(sb, nn, indent, skip, count-1, n.phase().getLocation());
*/
}
}
- static <Tok> void barf(HashMap<Element,Input.Location> sb, Node n, int indent, boolean skip, Input.Location loc) {
+ static <Tok> void barf(HashMap<Element,Input.Location> sb, StateNode n, int indent, boolean skip, Input.Location loc) {
if (touched.contains(n)) return;
touched.add(n);
String s = "";
for(int i=0; i< indent; i++) s += " ";
- Node parent = n;
+ StateNode parent = n;
boolean done = false;
boolean alldone = false;
boolean go = false;
boolean force = false;
for(Pos pp : (Iterable<Pos>)parent.state().positions()) {
- Position p = (Position)pp;
+ Pos p = (Pos)pp;
if (skip) p = p.next();
int raise = 0;
done = false;
// FIXME
- private static HashSet<Node> touched = new HashSet<Node>();
- static <Tok> void complain(Node n, HashMap<String,HashSet<String>> errors, boolean force, int indent) {
+ private static HashSet<StateNode> touched = new HashSet<StateNode>();
+ static <Tok> void complain(StateNode n, HashMap<String,HashSet<String>> errors, boolean force, int indent) {
if (touched.contains(n)) return;
touched.add(n);
- for(Position p : (Iterable<Position>)n.state()) {
+ for(Pos p : (Iterable<Pos>)n.state()) {
//if (!p.isLast() && !p.next().isLast()) continue;
if (((p.isFirst() || p.isLast()) && !force)/* || p.owner().name==null*/ ||
!important(p)) {
/*
FIXME: removed
- for(Node n2 : n.parents())
+ for(StateNode n2 : n.parents())
complain(n2, errors, force
//| p.isFirst()
, indent);
}
private static void error(String message,
Object token,
- Iterable<Node> nodes,
+ Iterable<StateNode> nodes,
Input.Region region,
Input input,
GSS gss) throws ParseFailed{
*/
}
HashMap<Element,Input.Location> hm = new HashMap<Element,Input.Location>();
- for(Node no : nodes)
+ for(StateNode no : nodes)
barf(hm, no, 0, false, region.getStart());
ret.append("\n expected: ");
Set<Element> hs = hm.keySet();
/*
ret.append("\n The author of SBP apologizes for the these nearly-useless error messages:\n\n");
HashMap<String,HashSet<String>> errors = new HashMap<String,HashSet<String>>();
- for(Node n : nodes) {
+ for(StateNode n : nodes) {
//System.out.println(n.state);
complain(n, errors, false, 0);
}