boolean indenting = true;
int indentation = 0;
private ArrayList<Integer> istack = new ArrayList<Integer>();
- public Character next(int numstates, int resets, int waits) throws IOException {
- Character ret = nextc(numstates, resets);
+ 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");
}
Character waitingBrace = null;
- public Character nextc(int numstates, int resets) throws IOException {
+ public Character nextc() throws IOException {
char c;
if (waitingBrace != null) {
Character ret = waitingBrace;
}
if (indenting) {
if (c==' ') { indentation++; return done(c); }
- if (c=='\n') { indentation = 0; if (blank) return nextc(numstates, resets); blank = true; waiting = true; waitingChar='\n'; return '\n'; }
+ if (c=='\n') { indentation = 0; if (blank) return nextc(); blank = true; waiting = true; waitingChar='\n'; return '\n'; }
int last = istack.size()==0 ? -1 : istack.get(istack.size()-1);
if (indentation==last) {
if (blank) {