Program: 84481
Project: 84481
Buggy source:
@Override public void parse(IParserManager pm,IToken token){
  int type=token.type();
  if (this.mode == END) {
    if (this.value != null) {
      this.field.setValue(this.value);
    }
    pm.popParser(true);
    return;
  }
switch (type) {
case Symbols.SEMICOLON:
case Symbols.COMMA:
case Tokens.STRING_PART:
case Tokens.STRING_END:
    if (this.value != null) {
      this.field.setValue(this.value);
    }
  pm.popParser(true);
return;
}
switch (this.mode) {
case VALUE:
if (type == Symbols.OPEN_PARENTHESIS) {
IToken next=token.next();
if (next.type() == Symbols.CLOSE_PARENTHESIS) {
  if (next.next().type() == Symbols.ARROW_OPERATOR) {
    LambdaExpression le=new LambdaExpression(next.next().raw());
    this.value=le;
    pm.skip(2);
    pm.pushParser(pm.newExpressionParser(le));
    this.mode=ACCESS;
    return;
  }
  this.value=new VoidValue(token.to(token.next()));
  pm.skip();
  this.mode=END;
  return;
}
pm.pushParser(new LambdaOrTupleParser(this),true);
this.mode=ACCESS;
return;
}
if (type == Symbols.OPEN_SQUARE_BRACKET) {
this.mode=ARRAY_END;
Array vl=new Array(token);
this.value=vl;
int nextType=token.next().type();
if (nextType != Symbols.CLOSE_SQUARE_BRACKET) {
pm.pushParser(new ExpressionListParser(vl));
}
return;
}
if (type == Symbols.OPEN_CURLY_BRACKET) {
this.mode=LIST_END;
StatementList sl=new StatementList(token);
this.value=sl;
int nextType=token.next().type();
if (nextType != Symbols.CLOSE_CURLY_BRACKET) {
pm.pushParser(new StatementListParser(sl));
}
return;
}
if (type == Tokens.SYMBOL_IDENTIFIER) {
this.getAccess(pm,token.nameValue(),token,type);
return;
}
if (type == Symbols.AT) {
if (token.next().type() != Symbols.OPEN_CURLY_BRACKET) {
Bytecode bc=new Bytecode(token);
pm.skip();
pm.pushParser(new BytecodeParser(bc));
this.mode=BYTECODE_END;
this.value=bc;
return;
}
pm.report(new SyntaxError(token,"String_Node_Str"));
return;
}
if (type == Symbols.ARROW_OPERATOR) {
LambdaExpression le=new LambdaExpression(token.raw());
this.value=le;
this.mode=ACCESS;
pm.pushParser(pm.newExpressionParser(le));
return;
}
if (type == Symbols.COLON) {
pm.report(new SyntaxError(token,"String_Node_Str"));
return;
}
if ((type & Tokens.IDENTIFIER) != 0) {
this.getAccess(pm,token.nameValue(),token,type);
return;
}
if (this.parseKeyword(pm,token,type)) {
return;
}
this.mode=ACCESS;
pm.reparse();
return;
case PATTERN_IF:
this.mode=PATTERN_END;
if (type == Keywords.IF) {
pm.pushParser(pm.newExpressionParser(v -> ((ICase)this.value).setCondition(v)));
return;
}
case PATTERN_END:
if (type == Symbols.COLON || type == Symbols.ARROW_OPERATOR) {
this.mode=END;
if (token.next().type() != Keywords.CASE) {
pm.pushParser(pm.newExpressionParser(v -> ((ICase)this.value).setAction(v)));
}
return;
}
pm.report(new SyntaxError(token,"String_Node_Str"));
return;
case ARRAY_END:
this.value.expandPosition(token);
if (type == Symbols.CLOSE_SQUARE_BRACKET) {
this.mode=ACCESS;
return;
}
this.field.setValue(this.value);
pm.popParser();
pm.report(new SyntaxError(token,"String_Node_Str"));
return;
case LIST_END:
this.field.setValue(this.value);
this.value.expandPosition(token);
if (type == Symbols.CLOSE_CURLY_BRACKET) {
if (token.next().type() == Symbols.DOT) {
this.mode=ACCESS_2;
this.dotless=false;
pm.skip();
return;
}
pm.popParser();
return;
}
pm.popParser(true);
pm.report(new SyntaxError(token,"String_Node_Str"));
return;
case PARAMETERS_END:
this.mode=ACCESS;
this.value.expandPosition(token);
if (type == Symbols.CLOSE_PARENTHESIS) {
return;
}
pm.reparse();
pm.report(new SyntaxError(token,"String_Node_Str"));
return;
case SUBSCRIPT_END:
this.mode=ACCESS;
this.value.expandPosition(token);
if (type == Symbols.CLOSE_SQUARE_BRACKET) {
return;
}
pm.reparse();
pm.report(new SyntaxError(token,"String_Node_Str"));
return;
case CONSTRUCTOR:
{
ConstructorCall cc=(ConstructorCall)this.value;
if (type == Symbols.OPEN_CURLY_BRACKET) {
this.createBody(cc.toClassConstructor(),pm);
return;
}
if (type == Symbols.OPEN_PARENTHESIS) {
ArgumentList list=new ArgumentList();
cc.setArguments(list);
pm.pushParser(new ExpressionListParser(list));
this.mode=CONSTRUCTOR_END;
return;
}
if (ParserUtil.isTerminator2(type)) {
this.mode=ACCESS;
pm.reparse();
return;
}
SingleArgument sa=new SingleArgument();
cc.setArguments(sa);
ExpressionParser ep=(ExpressionParser)pm.newExpressionParser(sa);
ep.operator=Operators.DEFAULT;
pm.pushParser(ep,true);
this.mode=END;
return;
}
case CONSTRUCTOR_END:
this.mode=ACCESS;
if (token.next().type() == Symbols.OPEN_CURLY_BRACKET) {
pm.skip();
this.createBody(((ConstructorCall)this.value).toClassConstructor(),pm);
return;
}
this.value.expandPosition(token);
if (type == Symbols.CLOSE_PARENTHESIS) {
return;
}
pm.reparse();
pm.report(new SyntaxError(token,"String_Node_Str"));
return;
case BYTECODE_END:
this.field.setValue(this.value);
pm.popParser();
this.value.expandPosition(token);
if (type == Symbols.CLOSE_CURLY_BRACKET) {
return;
}
pm.reparse();
pm.report(new SyntaxError(token,"String_Node_Str"));
return;
case TYPE_ARGUMENTS_END:
MethodCall mc=(MethodCall)this.value;
IToken next=token.next();
if (next.type() == Symbols.OPEN_PARENTHESIS) {
pm.skip();
mc.setArguments(this.getArguments(pm,next.next()));
}
this.mode=ACCESS;
if (type == Symbols.CLOSE_SQUARE_BRACKET) {
return;
}
pm.report(new SyntaxError(token,"String_Node_Str"));
return;
}
if (type == Symbols.COLON) {
this.mode=ACCESS;
pm.report(new SyntaxError(token,"String_Node_Str"));
return;
}
if (ParserUtil.isCloseBracket(type)) {
if (this.value != null) {
this.field.setValue(this.value);
}
pm.popParser(true);
return;
}
if (this.mode == ACCESS) {
if (type == Symbols.DOT) {
this.mode=ACCESS_2;
this.dotless=false;
return;
}
this.dotless=true;
if (type == Keywords.ELSE) {
this.field.setValue(this.value);
pm.popParser(true);
return;
}
if (type == Symbols.EQUALS) {
this.getAssign(pm,token);
return;
}
if (type == Keywords.AS) {
CastOperator co=new CastOperator(token.raw(),this.value);
pm.pushParser(pm.newTypeParser(co));
this.value=co;
return;
}
if (type == Keywords.IS) {
InstanceOfOperator io=new InstanceOfOperator(token.raw(),this.value);
pm.pushParser(pm.newTypeParser(io));
this.value=io;
return;
}
if (type == Keywords.MATCH) {
MatchExpression me=new MatchExpression(token.raw(),this.value);
pm.pushParser(new MatchExpressionParser(me));
this.value=me;
return;
}
if (type == Symbols.OPEN_SQUARE_BRACKET) {
SubscriptGetter getter=new SubscriptGetter(token,this.value);
this.value=getter;
this.mode=SUBSCRIPT_END;
pm.pushParser(new ExpressionListParser(getter.getArguments()));
return;
}
if (type == Symbols.OPEN_PARENTHESIS) {
IToken prev=token.prev();
IToken next=token.next();
IArguments args;
args=this.getArguments(pm,next);
int prevType=prev.type();
if (ParserUtil.isIdentifier(prevType)) {
MethodCall mc=new MethodCall(prev,null,prev.nameValue(),args);
this.value=mc;
}
 else if (prevType == Symbols.CLOSE_SQUARE_BRACKET) {
AbstractCall mc;
if (this.value.valueTag() == IValue.FIELD_ACCESS) {
mc=((FieldAccess)this.value).toMethodCall(null);
}
 else {
mc=(AbstractCall)this.value;
}
mc.setArguments(args);
this.value=mc;
}
 else {
ApplyMethodCall amc=new ApplyMethodCall(this.value.getPosition(),this.value,args);
this.value=amc;
}
this.mode=PARAMETERS_END;
return;
}
this.mode=ACCESS_2;
}
if (this.mode == ACCESS_2) {
if (ParserUtil.isIdentifier(type)) {
Name name=token.nameValue();
if (this.dotless) {
if (this.prefix) {
this.field.setValue(this.value);
pm.popParser(true);
return;
}
if (this.operator != null) {
Operator operator=pm.getOperator(name);
int p;
if (operator == null || (p=this.operator.precedence) > operator.precedence) {
this.field.setValue(this.value);
pm.popParser(true);
return;
}
if (p == operator.precedence) {
switch (operator.type) {
case Operator.INFIX_LEFT:
this.field.setValue(this.value);
pm.popParser(true);
return;
case Operator.INFIX_NONE:
pm.report(new SyntaxError(token,"String_Node_Str" + name + "String_Node_Str"));
return;
case Operator.INFIX_RIGHT:
}
}
}
}
this.getAccess(pm,name,token,type);
return;
}
if (ParserUtil.isTerminator(type)) {
this.field.setValue(this.value);
pm.popParser(true);
return;
}
if (type == Symbols.HASH || type == Symbols.COLON) {
pm.report(new SyntaxError(token,"String_Node_Str" + token));
return;
}
IToken prev=token.prev();
if (prev != null && ParserUtil.isIdentifier(prev.type())) {
this.value=null;
pm.reparse();
this.getAccess(pm,prev.nameValue(),prev,type);
return;
}
if (this.value != null) {
SingleArgument sa=new SingleArgument();
ApplyMethodCall call=new ApplyMethodCall(token.raw(),this.value,sa);
this.value=call;
this.mode=END;
ExpressionParser ep=(ExpressionParser)pm.newExpressionParser(sa);
ep.operator=Operators.DEFAULT;
pm.pushParser(ep,true);
return;
}
pm.report(new SyntaxError(token,"String_Node_Str" + token));
return;
}
if (this.value != null) {
this.value.expandPosition(token);
this.field.setValue(this.value);
pm.popParser(true);
return;
}
pm.report(new SyntaxError(token,"String_Node_Str" + token));
return;
}

Fixed version (ground truth):
@Override public void parse(IParserManager pm,IToken token){
  int type=token.type();
  if (this.mode == END) {
    if (this.value != null) {
      this.field.setValue(this.value);
    }
    pm.popParser(true);
    return;
  }
switch (type) {
case Symbols.SEMICOLON:
case Symbols.COMMA:
case Tokens.STRING_PART:
case Tokens.STRING_END:
    if (this.value != null) {
      this.field.setValue(this.value);
    }
  pm.popParser(true);
return;
}
switch (this.mode) {
case VALUE:
if (type == Symbols.OPEN_PARENTHESIS) {
IToken next=token.next();
if (next.type() == Symbols.CLOSE_PARENTHESIS) {
  if (next.next().type() == Symbols.ARROW_OPERATOR) {
    LambdaExpression le=new LambdaExpression(next.next().raw());
    this.value=le;
    pm.skip(2);
    pm.pushParser(pm.newExpressionParser(le));
    this.mode=ACCESS;
    return;
  }
  this.value=new VoidValue(token.to(token.next()));
  pm.skip();
  this.mode=END;
  return;
}
pm.pushParser(new LambdaOrTupleParser(this),true);
this.mode=ACCESS;
return;
}
if (type == Symbols.OPEN_SQUARE_BRACKET) {
this.mode=ARRAY_END;
Array vl=new Array(token);
this.value=vl;
int nextType=token.next().type();
if (nextType != Symbols.CLOSE_SQUARE_BRACKET) {
pm.pushParser(new ExpressionListParser(vl));
}
return;
}
if (type == Symbols.OPEN_CURLY_BRACKET) {
this.mode=LIST_END;
StatementList sl=new StatementList(token);
this.value=sl;
int nextType=token.next().type();
if (nextType != Symbols.CLOSE_CURLY_BRACKET) {
pm.pushParser(new StatementListParser(sl));
}
return;
}
if (type == Tokens.SYMBOL_IDENTIFIER) {
this.getAccess(pm,token.nameValue(),token,type);
return;
}
if (type == Symbols.AT) {
if (token.next().type() != Symbols.OPEN_CURLY_BRACKET) {
Bytecode bc=new Bytecode(token);
pm.skip();
pm.pushParser(new BytecodeParser(bc));
this.mode=BYTECODE_END;
this.value=bc;
return;
}
pm.report(new SyntaxError(token,"String_Node_Str"));
return;
}
if (type == Symbols.ARROW_OPERATOR) {
LambdaExpression le=new LambdaExpression(token.raw());
this.value=le;
this.mode=ACCESS;
pm.pushParser(pm.newExpressionParser(le));
return;
}
if (type == Symbols.COLON) {
pm.report(new SyntaxError(token,"String_Node_Str"));
return;
}
if ((type & Tokens.IDENTIFIER) != 0) {
this.getAccess(pm,token.nameValue(),token,type);
return;
}
if (this.parseKeyword(pm,token,type)) {
return;
}
this.mode=ACCESS;
pm.reparse();
return;
case PATTERN_IF:
this.mode=PATTERN_END;
if (type == Keywords.IF) {
pm.pushParser(pm.newExpressionParser(v -> ((ICase)this.value).setCondition(v)));
return;
}
case PATTERN_END:
if (type == Symbols.COLON || type == Symbols.ARROW_OPERATOR) {
this.mode=END;
if (token.next().type() != Keywords.CASE) {
pm.pushParser(pm.newExpressionParser(v -> ((ICase)this.value).setAction(v)));
}
return;
}
pm.report(new SyntaxError(token,"String_Node_Str"));
return;
case ARRAY_END:
this.value.expandPosition(token);
if (type == Symbols.CLOSE_SQUARE_BRACKET) {
this.mode=ACCESS;
return;
}
this.field.setValue(this.value);
pm.popParser();
pm.report(new SyntaxError(token,"String_Node_Str"));
return;
case LIST_END:
this.value.expandPosition(token);
if (type == Symbols.CLOSE_CURLY_BRACKET) {
if (token.next().type() == Symbols.DOT) {
this.mode=ACCESS_2;
this.dotless=false;
pm.skip();
return;
}
this.field.setValue(this.value);
pm.popParser();
return;
}
this.field.setValue(this.value);
pm.popParser(true);
pm.report(new SyntaxError(token,"String_Node_Str"));
return;
case PARAMETERS_END:
this.mode=ACCESS;
this.value.expandPosition(token);
if (type == Symbols.CLOSE_PARENTHESIS) {
return;
}
pm.reparse();
pm.report(new SyntaxError(token,"String_Node_Str"));
return;
case SUBSCRIPT_END:
this.mode=ACCESS;
this.value.expandPosition(token);
if (type == Symbols.CLOSE_SQUARE_BRACKET) {
return;
}
pm.reparse();
pm.report(new SyntaxError(token,"String_Node_Str"));
return;
case CONSTRUCTOR:
{
ConstructorCall cc=(ConstructorCall)this.value;
if (type == Symbols.OPEN_CURLY_BRACKET) {
this.createBody(cc.toClassConstructor(),pm);
return;
}
if (type == Symbols.OPEN_PARENTHESIS) {
ArgumentList list=new ArgumentList();
cc.setArguments(list);
pm.pushParser(new ExpressionListParser(list));
this.mode=CONSTRUCTOR_END;
return;
}
if (ParserUtil.isTerminator2(type)) {
this.mode=ACCESS;
pm.reparse();
return;
}
SingleArgument sa=new SingleArgument();
cc.setArguments(sa);
ExpressionParser ep=(ExpressionParser)pm.newExpressionParser(sa);
ep.operator=Operators.DEFAULT;
pm.pushParser(ep,true);
this.mode=END;
return;
}
case CONSTRUCTOR_END:
this.mode=ACCESS;
if (token.next().type() == Symbols.OPEN_CURLY_BRACKET) {
pm.skip();
this.createBody(((ConstructorCall)this.value).toClassConstructor(),pm);
return;
}
this.value.expandPosition(token);
if (type == Symbols.CLOSE_PARENTHESIS) {
return;
}
pm.reparse();
pm.report(new SyntaxError(token,"String_Node_Str"));
return;
case BYTECODE_END:
this.field.setValue(this.value);
pm.popParser();
this.value.expandPosition(token);
if (type == Symbols.CLOSE_CURLY_BRACKET) {
return;
}
pm.reparse();
pm.report(new SyntaxError(token,"String_Node_Str"));
return;
case TYPE_ARGUMENTS_END:
MethodCall mc=(MethodCall)this.value;
IToken next=token.next();
if (next.type() == Symbols.OPEN_PARENTHESIS) {
pm.skip();
mc.setArguments(this.getArguments(pm,next.next()));
}
this.mode=ACCESS;
if (type == Symbols.CLOSE_SQUARE_BRACKET) {
return;
}
pm.report(new SyntaxError(token,"String_Node_Str"));
return;
}
if (type == Symbols.COLON) {
this.mode=ACCESS;
pm.report(new SyntaxError(token,"String_Node_Str"));
return;
}
if (ParserUtil.isCloseBracket(type)) {
if (this.value != null) {
this.field.setValue(this.value);
}
pm.popParser(true);
return;
}
if (this.mode == ACCESS) {
if (type == Symbols.DOT) {
this.mode=ACCESS_2;
this.dotless=false;
return;
}
this.dotless=true;
if (type == Keywords.ELSE) {
this.field.setValue(this.value);
pm.popParser(true);
return;
}
if (type == Symbols.EQUALS) {
this.getAssign(pm,token);
return;
}
if (type == Keywords.AS) {
CastOperator co=new CastOperator(token.raw(),this.value);
pm.pushParser(pm.newTypeParser(co));
this.value=co;
return;
}
if (type == Keywords.IS) {
InstanceOfOperator io=new InstanceOfOperator(token.raw(),this.value);
pm.pushParser(pm.newTypeParser(io));
this.value=io;
return;
}
if (type == Keywords.MATCH) {
MatchExpression me=new MatchExpression(token.raw(),this.value);
pm.pushParser(new MatchExpressionParser(me));
this.value=me;
return;
}
if (type == Symbols.OPEN_SQUARE_BRACKET) {
SubscriptGetter getter=new SubscriptGetter(token,this.value);
this.value=getter;
this.mode=SUBSCRIPT_END;
pm.pushParser(new ExpressionListParser(getter.getArguments()));
return;
}
if (type == Symbols.OPEN_PARENTHESIS) {
IToken prev=token.prev();
IToken next=token.next();
IArguments args;
args=this.getArguments(pm,next);
int prevType=prev.type();
if (ParserUtil.isIdentifier(prevType)) {
MethodCall mc=new MethodCall(prev,null,prev.nameValue(),args);
this.value=mc;
}
 else if (prevType == Symbols.CLOSE_SQUARE_BRACKET) {
AbstractCall mc;
if (this.value.valueTag() == IValue.FIELD_ACCESS) {
mc=((FieldAccess)this.value).toMethodCall(null);
}
 else {
mc=(AbstractCall)this.value;
}
mc.setArguments(args);
this.value=mc;
}
 else {
ApplyMethodCall amc=new ApplyMethodCall(this.value.getPosition(),this.value,args);
this.value=amc;
}
this.mode=PARAMETERS_END;
return;
}
this.mode=ACCESS_2;
}
if (this.mode == ACCESS_2) {
if (ParserUtil.isIdentifier(type)) {
Name name=token.nameValue();
if (this.dotless) {
if (this.prefix) {
this.field.setValue(this.value);
pm.popParser(true);
return;
}
if (this.operator != null) {
Operator operator=pm.getOperator(name);
int p;
if (operator == null || (p=this.operator.precedence) > operator.precedence) {
this.field.setValue(this.value);
pm.popParser(true);
return;
}
if (p == operator.precedence) {
switch (operator.type) {
case Operator.INFIX_LEFT:
this.field.setValue(this.value);
pm.popParser(true);
return;
case Operator.INFIX_NONE:
pm.report(new SyntaxError(token,"String_Node_Str" + name + "String_Node_Str"));
return;
case Operator.INFIX_RIGHT:
}
}
}
}
this.getAccess(pm,name,token,type);
return;
}
if (ParserUtil.isTerminator(type)) {
this.field.setValue(this.value);
pm.popParser(true);
return;
}
if (type == Symbols.HASH || type == Symbols.COLON) {
pm.report(new SyntaxError(token,"String_Node_Str" + token));
return;
}
IToken prev=token.prev();
if (prev != null && ParserUtil.isIdentifier(prev.type())) {
this.value=null;
pm.reparse();
this.getAccess(pm,prev.nameValue(),prev,type);
return;
}
if (this.value != null) {
SingleArgument sa=new SingleArgument();
ApplyMethodCall call=new ApplyMethodCall(token.raw(),this.value,sa);
this.value=call;
this.mode=END;
ExpressionParser ep=(ExpressionParser)pm.newExpressionParser(sa);
ep.operator=Operators.DEFAULT;
pm.pushParser(ep,true);
return;
}
pm.report(new SyntaxError(token,"String_Node_Str" + token));
return;
}
if (this.value != null) {
this.value.expandPosition(token);
this.field.setValue(this.value);
pm.popParser(true);
return;
}
pm.report(new SyntaxError(token,"String_Node_Str" + token));
return;
}