Program: 110711
Project: 110711
Buggy source:
/** 
 * Performs tokenization of the character buffer of file contents provided to the constructor.
 */
private void tokenize(){
  while (pos < buffer.length) {
    if (tokenizeTwoChars()) {
      pos+=2;
      continue;
    }
    char c=buffer[pos];
    pos++;
switch (c) {
case '{':
{
        addToken(new Token(TokenKind.LBRACE,pos - 1,pos));
        openParenStackDepth++;
        break;
      }
case '}':
{
      addToken(new Token(TokenKind.RBRACE,pos - 1,pos));
      popParen();
      break;
    }
case '(':
{
    addToken(new Token(TokenKind.LPAREN,pos - 1,pos));
    openParenStackDepth++;
    break;
  }
case ')':
{
  addToken(new Token(TokenKind.RPAREN,pos - 1,pos));
  popParen();
  break;
}
case '[':
{
addToken(new Token(TokenKind.LBRACKET,pos - 1,pos));
openParenStackDepth++;
break;
}
case ']':
{
addToken(new Token(TokenKind.RBRACKET,pos - 1,pos));
popParen();
break;
}
case '>':
{
addToken(new Token(TokenKind.GREATER,pos - 1,pos));
break;
}
case '<':
{
addToken(new Token(TokenKind.LESS,pos - 1,pos));
break;
}
case ':':
{
addToken(new Token(TokenKind.COLON,pos - 1,pos));
break;
}
case ',':
{
addToken(new Token(TokenKind.COMMA,pos - 1,pos));
break;
}
case '+':
{
addToken(new Token(TokenKind.PLUS,pos - 1,pos));
break;
}
case '-':
{
addToken(new Token(TokenKind.MINUS,pos - 1,pos));
break;
}
case '|':
{
addToken(new Token(TokenKind.PIPE,pos - 1,pos));
break;
}
case '=':
{
addToken(new Token(TokenKind.EQUALS,pos - 1,pos));
break;
}
case '%':
{
addToken(new Token(TokenKind.PERCENT,pos - 1,pos));
break;
}
case '/':
{
if (lookaheadIs(0,'/') && lookaheadIs(1,'=')) {
addToken(new Token(TokenKind.SLASH_SLASH_EQUALS,pos - 1,pos + 2));
pos+=2;
}
 else if (lookaheadIs(0,'/')) {
addToken(new Token(TokenKind.SLASH_SLASH,pos - 1,pos + 1));
pos+=1;
}
 else {
addToken(new Token(TokenKind.SLASH,pos - 1,pos));
}
break;
}
case ';':
{
addToken(new Token(TokenKind.SEMI,pos - 1,pos));
break;
}
case '.':
{
addToken(new Token(TokenKind.DOT,pos - 1,pos));
break;
}
case '*':
{
addToken(new Token(TokenKind.STAR,pos - 1,pos));
break;
}
case ' ':
case '\t':
case '\r':
{
break;
}
case '\\':
{
if (lookaheadIs(0,'\n')) {
pos+=1;
}
 else if (lookaheadIs(0,'\r') && lookaheadIs(1,'\n')) {
pos+=2;
}
 else {
addToken(new Token(TokenKind.ILLEGAL,pos - 1,pos,Character.toString(c)));
}
break;
}
case '\n':
{
newline();
break;
}
case '#':
{
int oldPos=pos - 1;
while (pos < buffer.length) {
c=buffer[pos];
if (c == '\n') {
break;
}
 else {
pos++;
}
}
addToken(new Token(TokenKind.COMMENT,oldPos,pos,bufferSlice(oldPos,pos)));
break;
}
case '\'':
case '\"':
{
addToken(stringLiteral(c,false));
break;
}
default :
{
if (c == 'r' && pos < buffer.length && (buffer[pos] == '\'' || buffer[pos] == '\"')) {
c=buffer[pos];
pos++;
addToken(stringLiteral(c,true));
break;
}
if (Character.isDigit(c)) {
addToken(integer());
}
 else if (Character.isJavaIdentifierStart(c) && c != '$') {
addToken(identifierOrKeyword());
}
 else {
error("String_Node_Str" + c + "String_Node_Str");
}
break;
}
}
}
if (indentStack.size() > 1) {
addToken(new Token(TokenKind.NEWLINE,pos - 1,pos));
while (indentStack.size() > 1) {
indentStack.pop();
addToken(new Token(TokenKind.OUTDENT,pos - 1,pos));
}
}
if (tokens.isEmpty() || Iterables.getLast(tokens).kind != TokenKind.NEWLINE) {
addToken(new Token(TokenKind.NEWLINE,pos - 1,pos));
}
addToken(new Token(TokenKind.EOF,pos,pos));
}

Fixed version (ground truth):
/** 
 * Performs tokenization of the character buffer of file contents provided to the constructor.
 */
private void tokenize(){
  while (pos < buffer.length) {
    if (tokenizeTwoChars()) {
      pos+=2;
      continue;
    }
    char c=buffer[pos];
    pos++;
switch (c) {
case '{':
{
        addToken(new Token(TokenKind.LBRACE,pos - 1,pos));
        openParenStackDepth++;
        break;
      }
case '}':
{
      addToken(new Token(TokenKind.RBRACE,pos - 1,pos));
      popParen();
      break;
    }
case '(':
{
    addToken(new Token(TokenKind.LPAREN,pos - 1,pos));
    openParenStackDepth++;
    break;
  }
case ')':
{
  addToken(new Token(TokenKind.RPAREN,pos - 1,pos));
  popParen();
  break;
}
case '[':
{
addToken(new Token(TokenKind.LBRACKET,pos - 1,pos));
openParenStackDepth++;
break;
}
case ']':
{
addToken(new Token(TokenKind.RBRACKET,pos - 1,pos));
popParen();
break;
}
case '>':
{
addToken(new Token(TokenKind.GREATER,pos - 1,pos));
break;
}
case '<':
{
addToken(new Token(TokenKind.LESS,pos - 1,pos));
break;
}
case ':':
{
addToken(new Token(TokenKind.COLON,pos - 1,pos));
break;
}
case ',':
{
addToken(new Token(TokenKind.COMMA,pos - 1,pos));
break;
}
case '+':
{
addToken(new Token(TokenKind.PLUS,pos - 1,pos));
break;
}
case '-':
{
addToken(new Token(TokenKind.MINUS,pos - 1,pos));
break;
}
case '|':
{
addToken(new Token(TokenKind.PIPE,pos - 1,pos));
break;
}
case '=':
{
addToken(new Token(TokenKind.EQUALS,pos - 1,pos));
break;
}
case '%':
{
addToken(new Token(TokenKind.PERCENT,pos - 1,pos));
break;
}
case '/':
{
if (lookaheadIs(0,'/') && lookaheadIs(1,'=')) {
addToken(new Token(TokenKind.SLASH_SLASH_EQUALS,pos - 1,pos + 2));
pos+=2;
}
 else if (lookaheadIs(0,'/')) {
addToken(new Token(TokenKind.SLASH_SLASH,pos - 1,pos + 1));
pos+=1;
}
 else {
addToken(new Token(TokenKind.SLASH,pos - 1,pos));
}
break;
}
case ';':
{
addToken(new Token(TokenKind.SEMI,pos - 1,pos));
break;
}
case '.':
{
addToken(new Token(TokenKind.DOT,pos - 1,pos));
break;
}
case '*':
{
addToken(new Token(TokenKind.STAR,pos - 1,pos));
break;
}
case ' ':
case '\t':
case '\r':
{
break;
}
case '\\':
{
if (lookaheadIs(0,'\n')) {
pos+=1;
}
 else if (lookaheadIs(0,'\r') && lookaheadIs(1,'\n')) {
pos+=2;
}
 else {
addToken(new Token(TokenKind.ILLEGAL,pos - 1,pos,Character.toString(c)));
}
break;
}
case '\n':
{
newline();
break;
}
case '#':
{
int oldPos=pos - 1;
while (pos < buffer.length) {
c=buffer[pos];
if (c == '\n') {
break;
}
 else {
pos++;
}
}
addToken(new Token(TokenKind.COMMENT,oldPos,pos,bufferSlice(oldPos,pos)));
break;
}
case '\'':
case '\"':
{
addToken(stringLiteral(c,false));
break;
}
default :
{
if (c == 'r' && pos < buffer.length && (buffer[pos] == '\'' || buffer[pos] == '\"')) {
c=buffer[pos];
pos++;
addToken(stringLiteral(c,true));
break;
}
if (c >= '0' && c <= '9') {
addToken(integer());
}
 else if ((c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z') || c == '_') {
addToken(identifierOrKeyword());
}
 else {
error("String_Node_Str" + c + "String_Node_Str");
}
break;
}
}
}
if (indentStack.size() > 1) {
addToken(new Token(TokenKind.NEWLINE,pos - 1,pos));
while (indentStack.size() > 1) {
indentStack.pop();
addToken(new Token(TokenKind.OUTDENT,pos - 1,pos));
}
}
if (tokens.isEmpty() || Iterables.getLast(tokens).kind != TokenKind.NEWLINE) {
addToken(new Token(TokenKind.NEWLINE,pos - 1,pos));
}
addToken(new Token(TokenKind.EOF,pos,pos));
}