1 package edu.berkeley.sbp.chr;
4 import java.lang.reflect.*;
5 import java.lang.ref.*;
6 import edu.berkeley.sbp.*;
7 import edu.berkeley.sbp.util.*;
8 import edu.berkeley.sbp.misc.*;
9 import edu.berkeley.sbp.Input.Location;
11 public class CharParser extends Parser<Character,String> {
13 public Forest<String> parse(InputStream is) throws IOException, ParseFailed { return super.parse(new CharInput(is)); }
14 public Forest<String> parse(Reader r) throws IOException, ParseFailed { return super.parse(new CharInput(r)); }
15 public Forest<String> parse(String s) throws IOException, ParseFailed { return parse(new StringReader(s)); }
17 public CharParser(Union u) { super(u, new CharTopology()); }
19 private Location oldloc;
21 public Forest<String> shiftToken(Character ct, Location newloc) {
22 if (oldloc==null) oldloc = newloc;
23 Forest<String> ret = Forest.create(oldloc.createRegion(newloc), ct.toString(), null);