Program: 31168
Project: 31168
Buggy source:
@SuppressWarnings("String_Node_Str") public void parseExpr(Lexer lexer,ExprListener listener) throws ParserException {
  opStack.clear();
  paramCountStack.clear();
  int paramCount=0;
  int braceCount=0;
  ExprNode node;
  CharSequence tok;
  char thisChar=0, prevChar;
  int prevBranch;
  int thisBranch=BRANCH_NONE;
  OUT:   while ((tok=lexer.optionTok()) != null) {
    prevChar=thisChar;
    thisChar=tok.charAt(0);
    prevBranch=thisBranch;
switch (thisChar) {
case ',':
      thisBranch=BRANCH_COMMA;
    if (prevChar == ',') {
      throw QueryError.$(lexer.position(),"String_Node_Str");
    }
  if (braceCount == 0) {
    lexer.unparse();
    break OUT;
  }
while ((node=opStack.poll()) != null && node.token.charAt(0) != '(') {
  listener.onNode(node);
}
if (node != null) {
opStack.push(node);
}
paramCount++;
break;
case '(':
thisBranch=BRANCH_LEFT_BRACE;
braceCount++;
paramCountStack.push(paramCount);
paramCount=0;
opStack.push(exprNodePool.next().of(ExprNode.CONTROL,"String_Node_Str",Integer.MAX_VALUE,lexer.position()));
break;
case ')':
if (prevChar == ',') {
throw QueryError.$(lexer.position(),"String_Node_Str");
}
if (braceCount == 0) {
lexer.unparse();
break OUT;
}
thisBranch=BRANCH_RIGHT_BRACE;
braceCount--;
while ((node=opStack.poll()) != null && node.token.charAt(0) != '(') {
listener.onNode(node);
}
if ((node=opStack.peek()) != null && (node.type == ExprNode.LITERAL || (node.type == ExprNode.SET_OPERATION))) {
node.paramCount=(prevChar == '(' ? 0 : paramCount + 1) + (node.paramCount == 2 ? 1 : 0);
node.type=ExprNode.FUNCTION;
listener.onNode(node);
opStack.poll();
if (paramCountStack.notEmpty()) {
paramCount=paramCountStack.pop();
}
}
break;
case '`':
thisBranch=BRANCH_LAMBDA;
listener.onNode(exprNodePool.next().of(ExprNode.LAMBDA,tok.toString(),0,lexer.position()));
break;
case '0':
case '1':
case '2':
case '3':
case '4':
case '5':
case '6':
case '7':
case '8':
case '9':
case '"':
case '\'':
case 'N':
case 'n':
if ((thisChar != 'N' && thisChar != 'n') || Chars.equals("String_Node_Str",tok) || Chars.equals("String_Node_Str",tok)) {
thisBranch=BRANCH_CONSTANT;
listener.onNode(exprNodePool.next().of(ExprNode.CONSTANT,tok.toString(),0,lexer.position()));
break;
}
default :
ExprOperator op;
if ((op=ExprOperator.opMap.get(tok)) != null) {
thisBranch=BRANCH_OPERATOR;
int operatorType=op.type;
switch (thisChar) {
case '-':
switch (prevBranch) {
case BRANCH_OPERATOR:
case BRANCH_COMMA:
case BRANCH_NONE:
operatorType=ExprOperator.UNARY;
break;
default :
break;
}
break;
default :
break;
}
ExprNode other;
while ((other=opStack.peek()) != null) {
boolean greaterPrecedence=(op.leftAssociative && op.precedence >= other.precedence) || (!op.leftAssociative && op.precedence > other.precedence);
if (greaterPrecedence && (operatorType != ExprOperator.UNARY || (operatorType == ExprOperator.UNARY && other.paramCount == 1))) {
listener.onNode(other);
opStack.poll();
}
 else {
break;
}
}
node=exprNodePool.next().of(op.type == ExprOperator.SET ? ExprNode.SET_OPERATION : ExprNode.OPERATION,op.token,op.precedence,lexer.position());
switch (operatorType) {
case ExprOperator.UNARY:
node.paramCount=1;
break;
default :
node.paramCount=2;
break;
}
opStack.push(node);
}
 else if (!nonLiteralBranches.contains(thisBranch)) {
thisBranch=BRANCH_LITERAL;
opStack.push(exprNodePool.next().of(ExprNode.LITERAL,Chars.toString(tok),Integer.MIN_VALUE,lexer.position()));
}
 else {
lexer.unparse();
break OUT;
}
}
}
while ((node=opStack.poll()) != null) {
if (node.token.charAt(0) == '(') {
throw QueryError.$(node.position,"String_Node_Str");
}
listener.onNode(node);
}
}

Fixed version (ground truth):
@SuppressWarnings("String_Node_Str") public void parseExpr(Lexer lexer,ExprListener listener) throws ParserException {
  opStack.clear();
  paramCountStack.clear();
  int paramCount=0;
  int braceCount=0;
  ExprNode node;
  CharSequence tok;
  char thisChar=0, prevChar;
  int prevBranch;
  int thisBranch=BRANCH_NONE;
  OUT:   while ((tok=lexer.optionTok()) != null) {
    prevChar=thisChar;
    thisChar=tok.charAt(0);
    prevBranch=thisBranch;
switch (thisChar) {
case ',':
      thisBranch=BRANCH_COMMA;
    if (prevChar == ',') {
      throw QueryError.$(lexer.position(),"String_Node_Str");
    }
  if (braceCount == 0) {
    lexer.unparse();
    break OUT;
  }
while ((node=opStack.poll()) != null && node.token.charAt(0) != '(') {
  listener.onNode(node);
}
if (node != null) {
opStack.push(node);
}
paramCount++;
break;
case '(':
thisBranch=BRANCH_LEFT_BRACE;
braceCount++;
paramCountStack.push(paramCount);
paramCount=0;
opStack.push(exprNodePool.next().of(ExprNode.CONTROL,"String_Node_Str",Integer.MAX_VALUE,lexer.position()));
break;
case ')':
if (prevChar == ',') {
throw QueryError.$(lexer.position(),"String_Node_Str");
}
if (braceCount == 0) {
lexer.unparse();
break OUT;
}
thisBranch=BRANCH_RIGHT_BRACE;
braceCount--;
while ((node=opStack.poll()) != null && node.token.charAt(0) != '(') {
listener.onNode(node);
}
if ((node=opStack.peek()) != null && (node.type == ExprNode.LITERAL || (node.type == ExprNode.SET_OPERATION))) {
node.paramCount=(prevChar == '(' ? 0 : paramCount + 1) + (node.paramCount == 2 ? 1 : 0);
node.type=ExprNode.FUNCTION;
listener.onNode(node);
opStack.poll();
if (paramCountStack.notEmpty()) {
paramCount=paramCountStack.pop();
}
}
break;
case '`':
thisBranch=BRANCH_LAMBDA;
listener.onNode(exprNodePool.next().of(ExprNode.LAMBDA,tok.toString(),0,lexer.position()));
break;
case '0':
case '1':
case '2':
case '3':
case '4':
case '5':
case '6':
case '7':
case '8':
case '9':
case '"':
case '\'':
case 'N':
case 'n':
if ((thisChar != 'N' && thisChar != 'n') || Chars.equals("String_Node_Str",tok) || Chars.equals("String_Node_Str",tok)) {
thisBranch=BRANCH_CONSTANT;
listener.onNode(exprNodePool.next().of(ExprNode.CONSTANT,tok.toString(),0,lexer.position()));
break;
}
default :
ExprOperator op;
if ((op=ExprOperator.opMap.get(tok)) != null) {
thisBranch=BRANCH_OPERATOR;
int operatorType=op.type;
switch (thisChar) {
case '-':
switch (prevBranch) {
case BRANCH_OPERATOR:
case BRANCH_LEFT_BRACE:
case BRANCH_COMMA:
case BRANCH_NONE:
operatorType=ExprOperator.UNARY;
break;
default :
break;
}
break;
default :
break;
}
ExprNode other;
while ((other=opStack.peek()) != null) {
boolean greaterPrecedence=(op.leftAssociative && op.precedence >= other.precedence) || (!op.leftAssociative && op.precedence > other.precedence);
if (greaterPrecedence && (operatorType != ExprOperator.UNARY || (operatorType == ExprOperator.UNARY && other.paramCount == 1))) {
listener.onNode(other);
opStack.poll();
}
 else {
break;
}
}
node=exprNodePool.next().of(op.type == ExprOperator.SET ? ExprNode.SET_OPERATION : ExprNode.OPERATION,op.token,op.precedence,lexer.position());
switch (operatorType) {
case ExprOperator.UNARY:
node.paramCount=1;
break;
default :
node.paramCount=2;
break;
}
opStack.push(node);
}
 else if (!nonLiteralBranches.contains(thisBranch)) {
thisBranch=BRANCH_LITERAL;
opStack.push(exprNodePool.next().of(ExprNode.LITERAL,Chars.toString(tok),Integer.MIN_VALUE,lexer.position()));
}
 else {
lexer.unparse();
break OUT;
}
}
}
while ((node=opStack.poll()) != null) {
if (node.token.charAt(0) == '(') {
throw QueryError.$(node.position,"String_Node_Str");
}
listener.onNode(node);
}
}