Program: 83443
Project: 83443
Buggy source:
@Override public void parse(IParserManager pm,IToken token) throws SyntaxError {
  int type=token.type();
  if (this.mode == 0) {
    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) {
int nextType=token.next().type();
if (nextType == Symbols.CLOSE_PARENTHESIS) {
  this.value=new VoidValue(token.to(token.next()));
  pm.skip();
  this.mode=0;
  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) {
if (token.nameValue() == Name.at && 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;
}
this.getAccess(pm,token.nameValue(),token,type);
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(new ExpressionParser(this));
return;
}
case PATTERN_END:
if (type == Symbols.COLON) {
this.field.setValue(this.value);
pm.popParser();
if (token.next().type() != Keywords.CASE) {
pm.pushParser(new ExpressionParser((IValued)this.value));
}
return;
}
throw new SyntaxError(token,"String_Node_Str");
case ARRAY_END:
this.value.expandPosition(token);
if (type == Symbols.CLOSE_SQUARE_BRACKET) {
this.mode=ACCESS;
return;
}
this.field.setValue(this.value);
pm.popParser();
throw new SyntaxError(token,"String_Node_Str");
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);
throw new SyntaxError(token,"String_Node_Str");
case PARAMETERS_END:
this.mode=ACCESS;
this.value.expandPosition(token);
if (type == Symbols.CLOSE_PARENTHESIS) {
return;
}
throw new SyntaxError(token,"String_Node_Str",true);
case SUBSCRIPT_END:
this.mode=ACCESS;
this.value.expandPosition(token);
if (type == Symbols.CLOSE_SQUARE_BRACKET) {
return;
}
throw new SyntaxError(token,"String_Node_Str",true);
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.arguments=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.arguments=sa;
pm.pushParser(new ExpressionParser(sa),true);
this.mode=0;
return;
}
case CONSTRUCTOR_END:
this.mode=ACCESS;
if (token.next().type() == Symbols.OPEN_CURLY_BRACKET) {
this.createBody(((ConstructorCall)this.value).toClassConstructor(),pm);
return;
}
this.value.expandPosition(token);
if (type == Symbols.CLOSE_PARENTHESIS) {
return;
}
throw new SyntaxError(token,"String_Node_Str",true);
case BYTECODE_END:
this.field.setValue(this.value);
pm.popParser();
this.value.expandPosition(token);
if (type == Symbols.CLOSE_CURLY_BRACKET) {
return;
}
throw new SyntaxError(token,"String_Node_Str",true);
case TYPE_ARGUMENTS_END:
MethodCall mc=(MethodCall)this.value;
IToken next=token.next();
if (next.type() == Symbols.OPEN_PARENTHESIS) {
pm.skip();
mc.arguments=this.getArguments(pm,next.next());
}
 else {
mc.arguments=EmptyArguments.INSTANCE;
}
this.mode=ACCESS;
if (type == Symbols.CLOSE_SQUARE_BRACKET) {
return;
}
throw new SyntaxError(token,"String_Node_Str");
}
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;
this.mode=ACCESS_2;
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(new TypeParser(co));
this.value=co;
return;
}
if (type == Keywords.IS) {
InstanceOfOperator io=new InstanceOfOperator(token.raw(),this.value);
pm.pushParser(new TypeParser(io));
this.value=io;
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());
mc.arguments=args;
this.value=mc;
}
 else if (prevType == Symbols.CLOSE_SQUARE_BRACKET) {
MethodCall mc;
if (this.value.valueTag() == IValue.FIELD_ACCESS) {
mc=((FieldAccess)this.value).toMethodCall(null);
}
 else {
mc=(MethodCall)this.value;
}
mc.arguments=args;
this.value=mc;
}
 else {
ApplyMethodCall amc=new ApplyMethodCall(this.value.getPosition());
amc.instance=this.value;
amc.arguments=args;
this.value=amc;
}
this.mode=PARAMETERS_END;
return;
}
}
if (this.mode == ACCESS_2) {
if (ParserUtil.isIdentifier(type)) {
Name name=token.nameValue();
if (this.prefix) {
this.field.setValue(this.value);
pm.popParser(true);
return;
}
if (this.dotless && 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:
throw new SyntaxError(token,"String_Node_Str" + name + "String_Node_Str");
case Operator.INFIX_RIGHT:
}
}
}
this.getAccess(pm,name,token,type);
return;
}
if (ParserUtil.isTerminator(type)) {
this.field.setValue(this.value);
pm.popParser(true);
return;
}
IToken prev=token.prev();
if (ParserUtil.isIdentifier(prev.type())) {
this.value=null;
pm.reparse();
this.getAccess(pm,prev.nameValue(),prev,type);
return;
}
if (this.value != null) {
ApplyMethodCall call=new ApplyMethodCall(token.raw());
call.instance=this.value;
SingleArgument sa=new SingleArgument();
call.arguments=sa;
this.value=call;
this.mode=0;
pm.pushParser(new ExpressionParser(sa),true);
return;
}
throw new SyntaxError(token,"String_Node_Str" + token);
}
if (this.value != null) {
this.value.expandPosition(token);
this.field.setValue(this.value);
pm.popParser(true);
return;
}
throw new SyntaxError(token,"String_Node_Str" + token);
}

Fixed version (ground truth):
@Override public void parse(IParserManager pm,IToken token) throws SyntaxError {
  int type=token.type();
  if (this.mode == 0) {
    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) {
int nextType=token.next().type();
if (nextType == Symbols.CLOSE_PARENTHESIS) {
  this.value=new VoidValue(token.to(token.next()));
  pm.skip();
  this.mode=0;
  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) {
if (token.nameValue() == Name.at && 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;
}
this.getAccess(pm,token.nameValue(),token,type);
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(new ExpressionParser(this));
return;
}
case PATTERN_END:
if (type == Symbols.COLON) {
this.mode=0;
if (token.next().type() != Keywords.CASE) {
pm.pushParser(new ExpressionParser((IValued)this.value));
}
return;
}
throw new SyntaxError(token,"String_Node_Str");
case ARRAY_END:
this.value.expandPosition(token);
if (type == Symbols.CLOSE_SQUARE_BRACKET) {
this.mode=ACCESS;
return;
}
this.field.setValue(this.value);
pm.popParser();
throw new SyntaxError(token,"String_Node_Str");
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);
throw new SyntaxError(token,"String_Node_Str");
case PARAMETERS_END:
this.mode=ACCESS;
this.value.expandPosition(token);
if (type == Symbols.CLOSE_PARENTHESIS) {
return;
}
throw new SyntaxError(token,"String_Node_Str",true);
case SUBSCRIPT_END:
this.mode=ACCESS;
this.value.expandPosition(token);
if (type == Symbols.CLOSE_SQUARE_BRACKET) {
return;
}
throw new SyntaxError(token,"String_Node_Str",true);
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.arguments=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.arguments=sa;
pm.pushParser(new ExpressionParser(sa),true);
this.mode=0;
return;
}
case CONSTRUCTOR_END:
this.mode=ACCESS;
if (token.next().type() == Symbols.OPEN_CURLY_BRACKET) {
this.createBody(((ConstructorCall)this.value).toClassConstructor(),pm);
return;
}
this.value.expandPosition(token);
if (type == Symbols.CLOSE_PARENTHESIS) {
return;
}
throw new SyntaxError(token,"String_Node_Str",true);
case BYTECODE_END:
this.field.setValue(this.value);
pm.popParser();
this.value.expandPosition(token);
if (type == Symbols.CLOSE_CURLY_BRACKET) {
return;
}
throw new SyntaxError(token,"String_Node_Str",true);
case TYPE_ARGUMENTS_END:
MethodCall mc=(MethodCall)this.value;
IToken next=token.next();
if (next.type() == Symbols.OPEN_PARENTHESIS) {
pm.skip();
mc.arguments=this.getArguments(pm,next.next());
}
 else {
mc.arguments=EmptyArguments.INSTANCE;
}
this.mode=ACCESS;
if (type == Symbols.CLOSE_SQUARE_BRACKET) {
return;
}
throw new SyntaxError(token,"String_Node_Str");
}
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;
this.mode=ACCESS_2;
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(new TypeParser(co));
this.value=co;
return;
}
if (type == Keywords.IS) {
InstanceOfOperator io=new InstanceOfOperator(token.raw(),this.value);
pm.pushParser(new TypeParser(io));
this.value=io;
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());
mc.arguments=args;
this.value=mc;
}
 else if (prevType == Symbols.CLOSE_SQUARE_BRACKET) {
MethodCall mc;
if (this.value.valueTag() == IValue.FIELD_ACCESS) {
mc=((FieldAccess)this.value).toMethodCall(null);
}
 else {
mc=(MethodCall)this.value;
}
mc.arguments=args;
this.value=mc;
}
 else {
ApplyMethodCall amc=new ApplyMethodCall(this.value.getPosition());
amc.instance=this.value;
amc.arguments=args;
this.value=amc;
}
this.mode=PARAMETERS_END;
return;
}
}
if (this.mode == ACCESS_2) {
if (ParserUtil.isIdentifier(type)) {
Name name=token.nameValue();
if (this.prefix) {
this.field.setValue(this.value);
pm.popParser(true);
return;
}
if (this.dotless && 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:
throw new SyntaxError(token,"String_Node_Str" + name + "String_Node_Str");
case Operator.INFIX_RIGHT:
}
}
}
this.getAccess(pm,name,token,type);
return;
}
if (ParserUtil.isTerminator(type)) {
this.field.setValue(this.value);
pm.popParser(true);
return;
}
IToken prev=token.prev();
if (ParserUtil.isIdentifier(prev.type())) {
this.value=null;
pm.reparse();
this.getAccess(pm,prev.nameValue(),prev,type);
return;
}
if (this.value != null) {
ApplyMethodCall call=new ApplyMethodCall(token.raw());
call.instance=this.value;
SingleArgument sa=new SingleArgument();
call.arguments=sa;
this.value=call;
this.mode=0;
pm.pushParser(new ExpressionParser(sa),true);
return;
}
throw new SyntaxError(token,"String_Node_Str" + token);
}
if (this.value != null) {
this.value.expandPosition(token);
this.field.setValue(this.value);
pm.popParser(true);
return;
}
throw new SyntaxError(token,"String_Node_Str" + token);
}