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.
*
*/
public class Tib implements Input<Character> {
- public String showRegion(Region<Character> r) { return null; }
+ public String showRegion(Region<Character> r) { return ""; }
public Tib(String s) throws IOException { this(new StringReader(s)); }
public Tib(Reader r) throws IOException { this(new BufferedReader(r)); }
//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;
boolean indenting = true;
int indentation = 0;
private ArrayList<Integer> istack = new ArrayList<Integer>();
+ private static boolean debug = "true".equals(System.getProperty("tib.debug", "false"));
public Character next() throws IOException {
Character ret = nextc();
- if (ret==null) return null;
- else if (ret==left) System.out.print("\033[31m{\033[0m");
- else if (ret==right) System.out.print("\033[31m}\033[0m");
- else System.out.print(ret);
+ if (debug) {
+ if (ret==null) return null;
+ else if (ret==left) System.out.print("\033[31m{\033[0m");
+ else if (ret==right) System.out.print("\033[31m}\033[0m");
+ else System.out.print(ret);
+ }
return ret;
}