void parse(InputStream in) throws IOException {
            while (!endOfFile) {
                n = in.read(buffer, 0, bufSize);
                if (n < 0) {
                    endOfFile = true;
                    n = 1;
                    buffer[0] = '\n';
                }

                for (int i = 0; i < n; i++) {
                    char c = (char) buffer[i];

                    if (state == ParseState.COMMENT) { // comment, skip to end of line
                        if (c == '\r' || c == '\n') {
                            state = ParseState.NORMAL;
                        }
                        else {
                            continue;
                        }
                    }

                    if (state == ParseState.ESCAPE) {
                        sb.append(c);
                        // if the EOL is \r\n, \ escapes both chars
                        state = c == '\r' ? ParseState.ESC_CRNL : ParseState.NORMAL;
                        continue;
                    }

                    switchC(c);
                }

            }
        }