Program: 12290
Project: 12290
Buggy source:
/** 
 * Given the id, attribute, and value already read, this routine parses zero or more   {@code <preference-specifier>'s}.  If preferences other than reject and acceptable are specified, it prints a warning message that they are being ignored.  It builds an action list for creating an ACCEPTABLE preference.  If binary  preferences are encountered, a warning message is printed and  the production is ignored (returns null).  It returns null if any  other error occurred.  This works in conjunction with the code that supports attribute_preferences_mode == 2.  Anywhere that attribute_preferences_mode == 2 is tested, the code now tests for operand2_mode == true. <pre>  {@code <value_make> ::= <rhs_value> <preferences> <preferences> ::= [,] | <preference_specifier>+    <preference-specifier> ::= <naturally-unary-preference> [,] | <forced-unary-preference> | <binary-preference> <rhs_value> [,]}</pre> <p>parser.cpp::parse_preferences_soar8_non_operator
 * @param id
 * @param attr
 * @param value
 * @return action
 * @throws IOException
 * @throws ParserException
 */
Action parse_preferences_soar8_non_operator(SymbolImpl id,RhsValue attr,RhsValue value) throws IOException, ParserException {
  boolean saw_plus_sign=(currentType() == LexemeType.PLUS);
  PreferenceType preference_type=parse_preference_specifier_without_referent();
  if ((preference_type == PreferenceType.ACCEPTABLE) && (!saw_plus_sign)) {
    consumeComma();
  }
  Action prev_a=null;
  while (true) {
    if (preference_type.isBinary()) {
      error(String.format("String_Node_Str" + "String_Node_Str",id,attr,value));
    }
    if ((preference_type != PreferenceType.ACCEPTABLE) && (preference_type != PreferenceType.REJECT)) {
      printer.warn("String_Node_Str" + "String_Node_Str" + "String_Node_Str",id,attr,value);
    }
    if (preference_type == PreferenceType.REJECT) {
      MakeAction a=new MakeAction();
      a.next=prev_a;
      prev_a=a;
      a.preference_type=preference_type;
      a.id=new RhsSymbolValue(id);
      a.attr=attr.copy();
      a.value=value.copy();
    }
    saw_plus_sign=(currentType() == LexemeType.PLUS);
    preference_type=parse_preference_specifier_without_referent();
    if ((preference_type == PreferenceType.ACCEPTABLE) && (!saw_plus_sign)) {
      if (prev_a == null) {
        MakeAction a=new MakeAction();
        a.next=prev_a;
        prev_a=a;
        a.preference_type=PreferenceType.ACCEPTABLE;
        a.id=new RhsSymbolValue(id);
        a.attr=attr.copy();
        a.value=value.copy();
      }
      return prev_a;
    }
  }
}

Fixed version (ground truth):
/** 
 * Given the id, attribute, and value already read, this routine parses zero or more   {@code <preference-specifier>'s}.  If preferences other than reject and acceptable are specified, it prints a warning message that they are being ignored.  It builds an action list for creating an ACCEPTABLE preference.  If binary  preferences are encountered, a warning message is printed and  the production is ignored (returns null).  It returns null if any  other error occurred.  This works in conjunction with the code that supports attribute_preferences_mode == 2.  Anywhere that attribute_preferences_mode == 2 is tested, the code now tests for operand2_mode == true. <pre>  {@code <value_make> ::= <rhs_value> <preferences> <preferences> ::= [,] | <preference_specifier>+    <preference-specifier> ::= <naturally-unary-preference> [,] | <forced-unary-preference> | <binary-preference> <rhs_value> [,]}</pre> <p>parser.cpp::parse_preferences_soar8_non_operator
 * @param id
 * @param attr
 * @param value
 * @return action
 * @throws IOException
 * @throws ParserException
 */
Action parse_preferences_soar8_non_operator(SymbolImpl id,RhsValue attr,RhsValue value) throws IOException, ParserException {
  boolean saw_plus_sign=(currentType() == LexemeType.PLUS);
  PreferenceType preference_type=parse_preference_specifier_without_referent();
  if ((preference_type == PreferenceType.ACCEPTABLE) && (!saw_plus_sign)) {
    consumeComma();
  }
  Action prev_a=null;
  while (true) {
    if (preference_type.isBinary()) {
      error(String.format("String_Node_Str" + "String_Node_Str",id,attr,value));
    }
    if ((preference_type != PreferenceType.ACCEPTABLE) && (preference_type != PreferenceType.REJECT)) {
      printer.warn("String_Node_Str" + "String_Node_Str" + "String_Node_Str",id,attr,value);
    }
    if (preference_type == PreferenceType.REJECT) {
      MakeAction a=new MakeAction();
      a.next=prev_a;
      prev_a=a;
      a.preference_type=preference_type;
      a.id=id.toRhsValue();
      a.attr=attr.copy();
      a.value=value.copy();
    }
    saw_plus_sign=(currentType() == LexemeType.PLUS);
    preference_type=parse_preference_specifier_without_referent();
    if ((preference_type == PreferenceType.ACCEPTABLE) && (!saw_plus_sign)) {
      if (prev_a == null) {
        MakeAction a=new MakeAction();
        a.next=prev_a;
        prev_a=a;
        a.preference_type=PreferenceType.ACCEPTABLE;
        a.id=id.toRhsValue();
        a.attr=attr.copy();
        a.value=value.copy();
      }
      return prev_a;
    }
  }
}