public Forest<String> parse(InputStream is) throws IOException, ParseFailed { return super.parse(new CharInput(is)); }
public Forest<String> parse(Reader r) throws IOException, ParseFailed { return super.parse(new CharInput(r)); }
+ public Forest<String> parse(String s) throws IOException, ParseFailed { return parse(new StringReader(s)); }
public CharParser(Union u) { super(u, new CharTopology()); }
- public Forest<String> shiftToken(Character ct, Location loc) {
- return Forest.create(loc, ct.toString(), null, false, false);
+ private Location oldloc;
+
+ public Forest<String> shiftToken(Character ct, Location newloc) {
+ if (oldloc==null) oldloc = newloc;
+ Forest<String> ret = Forest.create(oldloc.createRegion(newloc), ct.toString(), null);
+ oldloc = newloc;
+ return ret;
}
}