cleanups, reorg, and commenting
[sbp.git] / src / edu / berkeley / sbp / chr / CharParser.java
index 657afaf..7b6d560 100644 (file)
@@ -1,22 +1,21 @@
+// Copyright 2006 all rights reserved; see LICENSE file for BSD-style license
+
 package edu.berkeley.sbp.chr;
 import java.io.*;
 import java.util.*;
-import java.lang.reflect.*;
-import java.lang.ref.*;
 import edu.berkeley.sbp.*;
 import edu.berkeley.sbp.util.*;
-import edu.berkeley.sbp.misc.*;
-import edu.berkeley.sbp.Input.Location;
 
 public class CharParser extends Parser<Character,String> {
 
     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 CharParser(Union u) { super(u); }
 
-    public Forest<String> shiftToken(Character ct, Location loc) {
-        return Forest.create(loc, ct.toString(), null, null, false, false, null);
-    }
+    public Topology<Character> emptyTopology() { return new CharTopology(); }
+    public Forest<String> shiftToken(Character ct, Input.Region region) {
+        return Forest.create(region, ct.toString(), null); }
 
 }