Program: 31216
Project: 31216
Buggy source:
private void parseSelectColumns(QueryModel model) throws ParserException {
  CharSequence tok;
  while (true) {
    ExprNode expr=expr();
    tok=tok();
    String alias;
    if (!columnAliasStop.contains(tok)) {
      alias=tok.toString();
      tok=tok();
    }
 else {
      alias=null;
    }
    if (Chars.equals(tok,"String_Node_Str")) {
      expectTok(tok(),'(');
      AnalyticColumn col=analyticColumnPool.next().of(alias,expr);
      tok=tok();
      if (Chars.equals(tok,"String_Node_Str")) {
        expectTok(tok(),"String_Node_Str");
        ObjList<ExprNode> partitionBy=col.getPartitionBy();
        do {
          partitionBy.add(expectExpr());
          tok=tok();
        }
 while (Chars.equals(tok,','));
      }
      if (Chars.equals(tok,"String_Node_Str")) {
        expectTok(tok(),"String_Node_Str");
        do {
          ExprNode e=expectExpr();
          tok=tok();
          if (Chars.equalsIgnoreCase(tok,"String_Node_Str")) {
            col.addOrderBy(e,QueryModel.ORDER_DIRECTION_DESCENDING);
            tok=tok();
          }
 else {
            col.addOrderBy(e,QueryModel.ORDER_DIRECTION_ASCENDING);
            if (Chars.equalsIgnoreCase(tok,"String_Node_Str")) {
              tok=tok();
            }
          }
        }
 while (Chars.equals(tok,','));
      }
      if (!Chars.equals(tok,')')) {
        throw err("String_Node_Str");
      }
      model.addColumn(col);
      tok=tok();
    }
 else {
      model.addColumn(queryColumnPool.next().of(alias,expr));
    }
    if (Chars.equals(tok,"String_Node_Str")) {
      break;
    }
    if (!Chars.equals(tok,',')) {
      throw err("String_Node_Str");
    }
  }
}

Fixed version (ground truth):
private void parseSelectColumns(QueryModel model) throws ParserException {
  CharSequence tok;
  while (true) {
    ExprNode expr=expr();
    String alias;
    int aliasPosition=lexer.position();
    tok=tok();
    if (!columnAliasStop.contains(tok)) {
      alias=tok.toString();
      tok=tok();
    }
 else {
      alias=null;
      aliasPosition=-1;
    }
    if (Chars.equals(tok,"String_Node_Str")) {
      expectTok(tok(),'(');
      AnalyticColumn col=analyticColumnPool.next().of(alias,aliasPosition,expr);
      tok=tok();
      if (Chars.equals(tok,"String_Node_Str")) {
        expectTok(tok(),"String_Node_Str");
        ObjList<ExprNode> partitionBy=col.getPartitionBy();
        do {
          partitionBy.add(expectExpr());
          tok=tok();
        }
 while (Chars.equals(tok,','));
      }
      if (Chars.equals(tok,"String_Node_Str")) {
        expectTok(tok(),"String_Node_Str");
        do {
          ExprNode e=expectExpr();
          tok=tok();
          if (Chars.equalsIgnoreCase(tok,"String_Node_Str")) {
            col.addOrderBy(e,QueryModel.ORDER_DIRECTION_DESCENDING);
            tok=tok();
          }
 else {
            col.addOrderBy(e,QueryModel.ORDER_DIRECTION_ASCENDING);
            if (Chars.equalsIgnoreCase(tok,"String_Node_Str")) {
              tok=tok();
            }
          }
        }
 while (Chars.equals(tok,','));
      }
      if (!Chars.equals(tok,')')) {
        throw err("String_Node_Str");
      }
      model.addColumn(col);
      tok=tok();
    }
 else {
      model.addColumn(queryColumnPool.next().of(alias,aliasPosition,expr));
    }
    if (Chars.equals(tok,"String_Node_Str")) {
      break;
    }
    if (!Chars.equals(tok,',')) {
      throw err("String_Node_Str");
    }
  }
}