Program: 82987
Project: 82987
Buggy source:
@Override public void parse(IParserManager pm,IToken token){
  if (this.mode == END) {
    if (this.value != null) {
      this.valueConsumer.setValue(this.value);
    }
    pm.popParser(true);
    return;
  }
  int type=token.type();
switch (type) {
case Tokens.EOF:
case BaseSymbols.SEMICOLON:
case BaseSymbols.COMMA:
case Tokens.STRING_PART:
case Tokens.STRING_END:
    if (this.value != null) {
      this.valueConsumer.setValue(this.value);
    }
  pm.popParser(true);
return;
}
switch (this.mode) {
case VALUE:
switch (type) {
case Tokens.STRING:
this.value=new StringValue(token.raw(),token.stringValue());
this.mode=ACCESS;
return;
case Tokens.STRING_START:
{
StringInterpolationExpr ssv=new StringInterpolationExpr(token);
this.value=ssv;
this.mode=ACCESS;
pm.pushParser(new StingInterpolationParser(ssv),true);
return;
}
case Tokens.SINGLE_QUOTED_STRING:
this.value=new CharValue(token.raw(),token.stringValue());
this.mode=ACCESS;
return;
case Tokens.INT:
this.value=new IntValue(token.raw(),token.intValue());
this.mode=ACCESS;
return;
case Tokens.LONG:
this.value=new LongValue(token.raw(),token.longValue());
this.mode=ACCESS;
return;
case Tokens.FLOAT:
this.value=new FloatValue(token.raw(),token.floatValue());
this.mode=ACCESS;
return;
case Tokens.DOUBLE:
this.value=new DoubleValue(token.raw(),token.doubleValue());
this.mode=ACCESS;
return;
case DyvilSymbols.WILDCARD:
this.value=new WildcardValue(token.raw());
this.mode=ACCESS;
return;
case BaseSymbols.OPEN_PARENTHESIS:
IToken next=token.next();
if (next.type() == BaseSymbols.CLOSE_PARENTHESIS) {
if (next.next().type() == DyvilSymbols.ARROW_OPERATOR) {
LambdaExpr le=new LambdaExpr(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=ACCESS;
return;
}
pm.pushParser(new LambdaOrTupleParser(this),true);
this.mode=ACCESS;
return;
case BaseSymbols.OPEN_SQUARE_BRACKET:
this.mode=ACCESS;
pm.pushParser(new ArrayLiteralParser(this),true);
return;
case BaseSymbols.OPEN_CURLY_BRACKET:
this.mode=ACCESS;
pm.pushParser(new StatementListParser(this),true);
return;
case DyvilSymbols.AT:
if (token.next().type() == BaseSymbols.OPEN_CURLY_BRACKET) {
Bytecode bc=new Bytecode(token);
pm.skip();
pm.pushParser(new BytecodeParser(bc));
this.mode=BYTECODE_END;
this.value=bc;
return;
}
Annotation a=new Annotation();
pm.pushParser(new AnnotationParser(a));
this.value=new AnnotationValue(a);
this.mode=END;
return;
case DyvilSymbols.ARROW_OPERATOR:
LambdaExpr le=new LambdaExpr(token.raw());
this.value=le;
this.mode=ACCESS;
pm.pushParser(pm.newExpressionParser(le));
return;
}
if ((type & Tokens.IDENTIFIER) != 0) {
Name name=token.nameValue();
this.parseAccess(pm,token,type,name,pm.getOperator(name));
return;
}
if (this.parseKeyword(pm,token,type)) {
return;
}
this.mode=ACCESS;
break;
case PATTERN_IF:
this.mode=PATTERN_END;
if (type == DyvilKeywords.IF) {
pm.pushParser(pm.newExpressionParser(((ICase)this.value)::setCondition));
return;
}
case PATTERN_END:
if (type == DyvilSymbols.ARROW_OPERATOR || type == BaseSymbols.COLON) {
this.mode=END;
if (token.next().type() != DyvilKeywords.CASE) {
pm.pushParser(pm.newExpressionParser(((ICase)this.value)::setAction));
}
return;
}
pm.report(token,"String_Node_Str");
return;
case ANONYMOUS_CLASS_END:
this.value.expandPosition(token);
this.mode=ACCESS;
if (type != BaseSymbols.CLOSE_CURLY_BRACKET) {
pm.reparse();
pm.report(token,"String_Node_Str");
}
return;
case PARAMETERS_END:
this.mode=ACCESS;
this.value.expandPosition(token);
if (type != BaseSymbols.CLOSE_PARENTHESIS) {
pm.reparse();
pm.report(token,"String_Node_Str");
}
return;
case SUBSCRIPT_END:
this.mode=ACCESS;
this.value.expandPosition(token);
if (type != BaseSymbols.CLOSE_SQUARE_BRACKET) {
pm.reparse();
pm.report(token,"String_Node_Str");
}
return;
case CONSTRUCTOR:
{
ConstructorCall cc=(ConstructorCall)this.value;
if (type == BaseSymbols.OPEN_CURLY_BRACKET) {
this.parseBody(pm,cc.toClassConstructor());
return;
}
this.mode=CONSTRUCTOR_PARAMETERS;
pm.reparse();
return;
}
case CONSTRUCTOR_PARAMETERS:
{
ICall icall=(ICall)this.value;
if (type == BaseSymbols.OPEN_PARENTHESIS) {
IArguments arguments=this.parseArguments(pm,token.next());
icall.setArguments(arguments);
this.mode=CONSTRUCTOR_END;
return;
}
if (ParserUtil.isExpressionTerminator(type)) {
this.mode=ACCESS;
pm.reparse();
return;
}
SingleArgument sa=new SingleArgument();
icall.setArguments(sa);
ExpressionParser ep=(ExpressionParser)pm.newExpressionParser(sa);
ep.operator=Operators.DEFAULT;
pm.pushParser(ep,true);
this.mode=END;
return;
}
case CONSTRUCTOR_END:
if (type != BaseSymbols.CLOSE_PARENTHESIS) {
pm.reparse();
pm.report(token,"String_Node_Str");
}
this.value.expandPosition(token);
this.mode=ACCESS;
if (token.next().type() == BaseSymbols.OPEN_CURLY_BRACKET) {
pm.skip();
this.parseBody(pm,((ConstructorCall)this.value).toClassConstructor());
return;
}
return;
case BYTECODE_END:
this.mode=END;
if (type != BaseSymbols.CLOSE_CURLY_BRACKET) {
pm.reparse();
pm.report(token,"String_Node_Str");
}
return;
case TYPE_ARGUMENTS_END:
{
if (type != BaseSymbols.CLOSE_SQUARE_BRACKET) {
pm.report(token,"String_Node_Str");
}
MethodCall mc=(MethodCall)this.value;
GenericData genericData=mc.getGenericData();
IToken next=token.next();
int nextType=next.type();
if (nextType == BaseSymbols.OPEN_PARENTHESIS) {
pm.skip();
IArguments arguments=this.parseArguments(pm,next.next());
ApplyMethodCall amc=new ApplyMethodCall(mc.getPosition(),mc.getReceiver(),arguments);
amc.setGenericData(genericData);
this.value=amc;
this.mode=PARAMETERS_END;
return;
}
if (ParserUtil.isIdentifier(nextType)) {
pm.skip();
this.value=mc.getReceiver();
this.parseAccess(pm,token.next(),token.next().type(),token.next().nameValue(),null);
if (this.value instanceof AbstractCall) {
((AbstractCall)this.value).setGenericData(genericData);
}
if (this.value instanceof FieldAccess) {
FieldAccess fieldAccess=(FieldAccess)this.value;
mc.setName(fieldAccess.getName());
this.value=mc;
}
return;
}
if (ParserUtil.isExpressionTerminator(nextType)) {
ApplyMethodCall amc=new ApplyMethodCall(mc.getPosition(),mc.getReceiver(),EmptyArguments.INSTANCE);
amc.setGenericData(genericData);
this.value=amc;
this.mode=ACCESS;
return;
}
SingleArgument argument=new SingleArgument();
ApplyMethodCall amc=new ApplyMethodCall(mc.getPosition(),mc.getReceiver(),argument);
amc.setGenericData(genericData);
this.value=amc;
this.parseApply(pm,next,argument,Operators.DEFAULT);
this.mode=ACCESS;
return;
}
case PARAMETERIZED_THIS_END:
this.mode=ACCESS;
if (type != BaseSymbols.CLOSE_SQUARE_BRACKET) {
pm.report(token,"String_Node_Str");
}
return;
case PARAMETERIZED_SUPER_END:
this.mode=ACCESS;
if (type != BaseSymbols.CLOSE_SQUARE_BRACKET) {
pm.report(token,"String_Node_Str");
}
return;
}
if (ParserUtil.isCloseBracket(type) || type == BaseSymbols.COLON) {
if (this.value != null) {
this.valueConsumer.setValue(this.value);
}
pm.popParser(true);
return;
}
if (this.mode == ACCESS) {
if (type == BaseSymbols.DOT) {
this.mode=DOT_ACCESS;
this.explicitDot=true;
return;
}
this.explicitDot=false;
switch (type) {
case DyvilKeywords.ELSE:
this.valueConsumer.setValue(this.value);
pm.popParser(true);
return;
case BaseSymbols.EQUALS:
this.parseAssignment(pm,token);
return;
case DyvilKeywords.AS:
CastOperator co=new CastOperator(token.raw(),this.value);
pm.pushParser(pm.newTypeParser(co));
this.value=co;
return;
case DyvilKeywords.IS:
InstanceOfOperator io=new InstanceOfOperator(token.raw(),this.value);
pm.pushParser(pm.newTypeParser(io));
this.value=io;
return;
case DyvilKeywords.MATCH:
MatchExpr me=new MatchExpr(token.raw(),this.value);
pm.pushParser(new MatchExpressionParser(me));
this.value=me;
return;
case BaseSymbols.OPEN_SQUARE_BRACKET:
SubscriptGetter getter=new SubscriptGetter(token,this.value);
this.value=getter;
this.mode=SUBSCRIPT_END;
pm.pushParser(new ExpressionListParser(getter.getArguments()));
return;
case BaseSymbols.OPEN_PARENTHESIS:
this.value=new ApplyMethodCall(this.value.getPosition(),this.value,this.parseArguments(pm,token.next()));
this.mode=PARAMETERS_END;
return;
}
if (ParserUtil.isIdentifier(type)) {
this.parseIdentifierAccess(pm,token,type);
return;
}
if (this.value != null) {
if (this.operator != null) {
this.valueConsumer.setValue(this.value);
pm.popParser(true);
return;
}
SingleArgument sa=new SingleArgument();
ApplyMethodCall amc=new ApplyMethodCall(this.value.getPosition(),this.value,sa);
this.parseApply(pm,token,sa,Operators.DEFAULT);
pm.reparse();
this.value=amc;
return;
}
}
if (this.mode == DOT_ACCESS) {
if (ParserUtil.isIdentifier(type)) {
this.parseIdentifierAccess(pm,token,type);
return;
}
if (type == BaseSymbols.OPEN_SQUARE_BRACKET) {
MethodCall call=new MethodCall(token,this.value,null);
pm.pushParser(new TypeListParser(call.getGenericData()));
this.mode=TYPE_ARGUMENTS_END;
this.value=call;
return;
}
pm.report(MarkerMessages.createError(token,"String_Node_Str",token.toString()));
return;
}
pm.report(MarkerMessages.createError(token,"String_Node_Str",token.toString()));
return;
}

Fixed version (ground truth):
@Override public void parse(IParserManager pm,IToken token){
  if (this.mode == END) {
    if (this.value != null) {
      this.valueConsumer.setValue(this.value);
    }
    pm.popParser(true);
    return;
  }
  int type=token.type();
switch (type) {
case Tokens.EOF:
case BaseSymbols.SEMICOLON:
case BaseSymbols.COMMA:
case Tokens.STRING_PART:
case Tokens.STRING_END:
    if (this.value != null) {
      this.valueConsumer.setValue(this.value);
    }
  pm.popParser(true);
return;
}
switch (this.mode) {
case VALUE:
switch (type) {
case Tokens.STRING:
this.value=new StringValue(token.raw(),token.stringValue());
this.mode=ACCESS;
return;
case Tokens.STRING_START:
{
StringInterpolationExpr ssv=new StringInterpolationExpr(token);
this.value=ssv;
this.mode=ACCESS;
pm.pushParser(new StingInterpolationParser(ssv),true);
return;
}
case Tokens.SINGLE_QUOTED_STRING:
this.value=new CharValue(token.raw(),token.stringValue());
this.mode=ACCESS;
return;
case Tokens.INT:
this.value=new IntValue(token.raw(),token.intValue());
this.mode=ACCESS;
return;
case Tokens.LONG:
this.value=new LongValue(token.raw(),token.longValue());
this.mode=ACCESS;
return;
case Tokens.FLOAT:
this.value=new FloatValue(token.raw(),token.floatValue());
this.mode=ACCESS;
return;
case Tokens.DOUBLE:
this.value=new DoubleValue(token.raw(),token.doubleValue());
this.mode=ACCESS;
return;
case DyvilSymbols.WILDCARD:
this.value=new WildcardValue(token.raw());
this.mode=ACCESS;
return;
case BaseSymbols.OPEN_PARENTHESIS:
IToken next=token.next();
if (next.type() == BaseSymbols.CLOSE_PARENTHESIS) {
if (next.next().type() == DyvilSymbols.ARROW_OPERATOR) {
LambdaExpr le=new LambdaExpr(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=ACCESS;
return;
}
pm.pushParser(new LambdaOrTupleParser(this),true);
this.mode=ACCESS;
return;
case BaseSymbols.OPEN_SQUARE_BRACKET:
this.mode=ACCESS;
pm.pushParser(new ArrayLiteralParser(this),true);
return;
case BaseSymbols.OPEN_CURLY_BRACKET:
this.mode=ACCESS;
pm.pushParser(new StatementListParser(this),true);
return;
case DyvilSymbols.AT:
if (token.next().type() == BaseSymbols.OPEN_CURLY_BRACKET) {
Bytecode bc=new Bytecode(token);
pm.skip();
pm.pushParser(new BytecodeParser(bc));
this.mode=BYTECODE_END;
this.value=bc;
return;
}
Annotation a=new Annotation();
pm.pushParser(new AnnotationParser(a));
this.value=new AnnotationValue(a);
this.mode=END;
return;
case DyvilSymbols.ARROW_OPERATOR:
LambdaExpr le=new LambdaExpr(token.raw());
this.value=le;
this.mode=ACCESS;
pm.pushParser(pm.newExpressionParser(le));
return;
}
if ((type & Tokens.IDENTIFIER) != 0) {
Name name=token.nameValue();
this.parseAccess(pm,token,type,name,pm.getOperator(name));
return;
}
if (this.parseKeyword(pm,token,type)) {
return;
}
this.mode=ACCESS;
break;
case PATTERN_IF:
this.mode=PATTERN_END;
if (type == DyvilKeywords.IF) {
pm.pushParser(pm.newExpressionParser(((ICase)this.value)::setCondition));
return;
}
case PATTERN_END:
if (type == DyvilSymbols.ARROW_OPERATOR || type == BaseSymbols.COLON) {
this.mode=END;
if (token.next().type() != DyvilKeywords.CASE) {
pm.pushParser(pm.newExpressionParser(((ICase)this.value)::setAction));
}
return;
}
pm.report(token,"String_Node_Str");
return;
case ANONYMOUS_CLASS_END:
this.value.expandPosition(token);
this.mode=ACCESS;
if (type != BaseSymbols.CLOSE_CURLY_BRACKET) {
pm.reparse();
pm.report(token,"String_Node_Str");
}
return;
case PARAMETERS_END:
this.mode=ACCESS;
this.value.expandPosition(token);
if (type != BaseSymbols.CLOSE_PARENTHESIS) {
pm.reparse();
pm.report(token,"String_Node_Str");
}
return;
case SUBSCRIPT_END:
this.mode=ACCESS;
this.value.expandPosition(token);
if (type != BaseSymbols.CLOSE_SQUARE_BRACKET) {
pm.reparse();
pm.report(token,"String_Node_Str");
}
return;
case CONSTRUCTOR:
{
ConstructorCall cc=(ConstructorCall)this.value;
if (type == BaseSymbols.OPEN_CURLY_BRACKET) {
this.parseBody(pm,cc.toClassConstructor());
return;
}
this.mode=CONSTRUCTOR_PARAMETERS;
pm.reparse();
return;
}
case CONSTRUCTOR_PARAMETERS:
{
ICall icall=(ICall)this.value;
if (type == BaseSymbols.OPEN_PARENTHESIS) {
IArguments arguments=this.parseArguments(pm,token.next());
icall.setArguments(arguments);
this.mode=CONSTRUCTOR_END;
return;
}
if (ParserUtil.isExpressionTerminator(type)) {
this.mode=ACCESS;
pm.reparse();
return;
}
SingleArgument sa=new SingleArgument();
icall.setArguments(sa);
ExpressionParser ep=(ExpressionParser)pm.newExpressionParser(sa);
ep.operator=Operators.DEFAULT;
pm.pushParser(ep,true);
this.mode=END;
return;
}
case CONSTRUCTOR_END:
if (type != BaseSymbols.CLOSE_PARENTHESIS) {
pm.reparse();
pm.report(token,"String_Node_Str");
}
this.value.expandPosition(token);
this.mode=ACCESS;
if (token.next().type() == BaseSymbols.OPEN_CURLY_BRACKET) {
pm.skip();
this.parseBody(pm,((ConstructorCall)this.value).toClassConstructor());
return;
}
return;
case BYTECODE_END:
this.mode=END;
if (type != BaseSymbols.CLOSE_CURLY_BRACKET) {
pm.reparse();
pm.report(token,"String_Node_Str");
}
return;
case TYPE_ARGUMENTS_END:
{
if (type != BaseSymbols.CLOSE_SQUARE_BRACKET) {
pm.report(token,"String_Node_Str");
}
MethodCall mc=(MethodCall)this.value;
GenericData genericData=mc.getGenericData();
IToken next=token.next();
int nextType=next.type();
if (nextType == BaseSymbols.OPEN_PARENTHESIS) {
pm.skip();
IArguments arguments=this.parseArguments(pm,next.next());
ApplyMethodCall amc=new ApplyMethodCall(mc.getPosition(),mc.getReceiver(),arguments);
amc.setGenericData(genericData);
this.value=amc;
this.mode=PARAMETERS_END;
return;
}
if (ParserUtil.isIdentifier(nextType)) {
pm.skip();
this.value=mc.getReceiver();
this.parseAccess(pm,token.next(),token.next().type(),token.next().nameValue(),null);
if (this.value instanceof AbstractCall) {
((AbstractCall)this.value).setGenericData(genericData);
}
if (this.value instanceof FieldAccess) {
FieldAccess fieldAccess=(FieldAccess)this.value;
mc.setName(fieldAccess.getName());
this.value=mc;
}
return;
}
if (ParserUtil.isExpressionTerminator(nextType)) {
ApplyMethodCall amc=new ApplyMethodCall(mc.getPosition(),mc.getReceiver(),EmptyArguments.INSTANCE);
amc.setGenericData(genericData);
this.value=amc;
this.mode=ACCESS;
return;
}
SingleArgument argument=new SingleArgument();
ApplyMethodCall amc=new ApplyMethodCall(mc.getPosition(),mc.getReceiver(),argument);
amc.setGenericData(genericData);
this.value=amc;
this.parseApply(pm,next,argument,Operators.DEFAULT);
this.mode=ACCESS;
return;
}
case PARAMETERIZED_THIS_END:
this.mode=ACCESS;
if (type != BaseSymbols.CLOSE_SQUARE_BRACKET) {
pm.report(token,"String_Node_Str");
}
return;
case PARAMETERIZED_SUPER_END:
this.mode=ACCESS;
if (type != BaseSymbols.CLOSE_SQUARE_BRACKET) {
pm.report(token,"String_Node_Str");
}
return;
}
if (ParserUtil.isCloseBracket(type) || type == BaseSymbols.COLON) {
if (this.value != null) {
this.valueConsumer.setValue(this.value);
}
pm.popParser(true);
return;
}
if (this.mode == ACCESS) {
if (type == BaseSymbols.DOT) {
this.mode=DOT_ACCESS;
this.explicitDot=true;
return;
}
this.explicitDot=false;
switch (type) {
case DyvilKeywords.ELSE:
this.valueConsumer.setValue(this.value);
pm.popParser(true);
return;
case BaseSymbols.EQUALS:
this.parseAssignment(pm,token);
return;
case DyvilKeywords.AS:
CastOperator co=new CastOperator(token.raw(),this.value);
pm.pushParser(pm.newTypeParser(co));
this.value=co;
return;
case DyvilKeywords.IS:
InstanceOfOperator io=new InstanceOfOperator(token.raw(),this.value);
pm.pushParser(pm.newTypeParser(io));
this.value=io;
return;
case DyvilKeywords.MATCH:
MatchExpr me=new MatchExpr(token.raw(),this.value);
pm.pushParser(new MatchExpressionParser(me));
this.value=me;
return;
case BaseSymbols.OPEN_SQUARE_BRACKET:
SubscriptGetter getter=new SubscriptGetter(token,this.value);
this.value=getter;
this.mode=SUBSCRIPT_END;
pm.pushParser(new ExpressionListParser(getter.getArguments()));
return;
case BaseSymbols.OPEN_PARENTHESIS:
this.value=new ApplyMethodCall(this.value.getPosition(),this.value,this.parseArguments(pm,token.next()));
this.mode=PARAMETERS_END;
return;
}
if (ParserUtil.isIdentifier(type)) {
this.parseIdentifierAccess(pm,token,type);
return;
}
if (this.value != null) {
if (this.operator != null) {
this.valueConsumer.setValue(this.value);
pm.popParser(true);
return;
}
SingleArgument sa=new SingleArgument();
ApplyMethodCall amc=new ApplyMethodCall(this.value.getPosition(),this.value,sa);
this.parseApply(pm,token,sa,Operators.DEFAULT);
pm.reparse();
this.value=amc;
return;
}
}
if (this.mode == DOT_ACCESS) {
if (ParserUtil.isIdentifier(type)) {
this.parseIdentifierAccess(pm,token,type);
return;
}
if (type == BaseSymbols.OPEN_SQUARE_BRACKET) {
MethodCall call=new MethodCall(token,this.value,null);
pm.pushParser(new TypeListParser(call.getGenericData()));
this.mode=TYPE_ARGUMENTS_END;
this.value=call;
return;
}
pm.report(MarkerMessages.createSyntaxError(token,"String_Node_Str",token.toString()));
return;
}
pm.report(MarkerMessages.createSyntaxError(token,"String_Node_Str",token.toString()));
return;
}