/** returns the location the input stream is currently at */
public Location<Token> getLocation();
+
+ /** should return a short string describing where the input is coming from */
+ public String getName();
/**
* <b>Optional:</b> <i>If possible</i>, this method will return a
private final RollbackReader r;
- public CharInput(String s) { this(new StringReader(s)); }
- public CharInput(Reader r) { this(r, null); }
- public CharInput(Reader r, String s) { this.r = new RollbackReader(new BufferedReader(r)); }
- public CharInput(InputStream i) { this(i, null); }
- public CharInput(InputStream i, String s) { this(new InputStreamReader(i), s); }
+ public CharInput(Reader r, String s) {
+ this.name = s;
+ this.r = new RollbackReader(new BufferedReader(r));
+ }
+ public CharInput(String s) { this(new StringReader(s)); }
+ public CharInput(Reader r) { this(r, null); }
+ public CharInput(InputStream i) { this(i, null); }
+ public CharInput(InputStream i, String s) { this(new InputStreamReader(i), s); }
+ public CharInput(File f) throws IOException { this(new FileInputStream(f), f.getName()); }
public CharInput(InputStream i, String s, boolean indent) {
this(new InputStreamReader(i), s);
this.indent = indent;
}
+ public String getName() { return name; }
+ private String name;
boolean cr = false;
boolean indent = false;
private int count = 0;
import java.util.*;
import java.io.*;
-// TODO: multiple {{ }} for superquotation
-// TODO: strings
-// TODO: comments
-
/**
* A slow, ugly, inefficient, inelegant, ad-hoc parser for TIB files.
*
//cur = parse(br);
//System.out.println("\rparsing: \"" + cur.toString(0, -1) + "\"");
}
-
+ public String getName() { return null; }
private String s = "";
int pos = 0;
int spos = 0;