Program: 75636
Project: 75636
Buggy source:
final public void primaryElement() throws ParseException {
  int len;
  String tidied, x;
switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
case COMPLEX:
    ASTPtLeafNode jjtn001=new ASTPtLeafNode(JJTPTLEAFNODE);
  boolean jjtc001=true;
jjtree.openNodeScope(jjtn001);
try {
jj_consume_token(COMPLEX);
jjtree.closeNodeScope(jjtn001,true);
jjtc001=false;
try {
  x=token.image.toLowerCase();
  len=x.length();
  Double imag=new Double(x.substring(0,len - 1));
  Complex value=new Complex(0,imag.doubleValue());
  jjtn001._ptToken=new ComplexToken(value);
  jjtn001._isConstant=true;
}
 catch (NumberFormatException ee) {
{
    if (true)     throw new ParseException("String_Node_Str" + token.image + "String_Node_Str");
  }
}
}
  finally {
if (jjtc001) {
  jjtree.closeNodeScope(jjtn001,true);
}
}
break;
case DOUBLE:
ASTPtLeafNode jjtn002=new ASTPtLeafNode(JJTPTLEAFNODE);
boolean jjtc002=true;
jjtree.openNodeScope(jjtn002);
try {
jj_consume_token(DOUBLE);
jjtree.closeNodeScope(jjtn002,true);
jjtc002=false;
try {
x=token.image.toLowerCase();
len=x.length();
if (x.endsWith("String_Node_Str") || x.endsWith("String_Node_Str")) {
Double value=new Double(x.substring(0,len - 1));
jjtn002._ptToken=new DoubleToken(value.doubleValue());
}
 else {
Double value=new Double(x);
jjtn002._ptToken=new DoubleToken(value.doubleValue());
}
jjtn002._isConstant=true;
}
 catch (NumberFormatException ee) {
{
if (true) throw new ParseException("String_Node_Str" + token.image + "String_Node_Str");
}
}
}
  finally {
if (jjtc002) {
jjtree.closeNodeScope(jjtn002,true);
}
}
break;
case INTEGER:
ASTPtLeafNode jjtn003=new ASTPtLeafNode(JJTPTLEAFNODE);
boolean jjtc003=true;
jjtree.openNodeScope(jjtn003);
try {
jj_consume_token(INTEGER);
jjtree.closeNodeScope(jjtn003,true);
jjtc003=false;
try {
x=token.image.toLowerCase();
len=x.length();
int radix;
boolean mustBeLong=x.endsWith("String_Node_Str");
boolean mustBeUnsignedByte=x.endsWith("String_Node_Str");
int prefixLength;
int suffixLength;
if (mustBeLong) {
suffixLength=1;
}
 else if (mustBeUnsignedByte) {
suffixLength=2;
}
 else {
suffixLength=0;
}
if (x.startsWith("String_Node_Str")) {
radix=16;
prefixLength=2;
}
 else if (x.startsWith("String_Node_Str") && (x.length() > 1)) {
radix=8;
prefixLength=1;
}
 else {
radix=10;
prefixLength=0;
}
x=x.substring(prefixLength,len - suffixLength);
if (mustBeLong) {
jjtn003._ptToken=new LongToken(Long.parseLong(x,radix));
}
 else if (mustBeUnsignedByte) {
jjtn003._ptToken=new UnsignedByteToken(Byte.parseByte(x,radix));
}
 else {
try {
jjtn003._ptToken=new IntToken(Integer.parseInt(x,radix));
}
 catch (NumberFormatException nfe) {
jjtn003._ptToken=new LongToken(Long.parseLong(x,radix));
}
}
jjtn003._isConstant=true;
}
 catch (NumberFormatException ee) {
{
if (true) throw new ParseException("String_Node_Str" + token.image + "String_Node_Str");
}
}
}
  finally {
if (jjtc003) {
jjtree.closeNodeScope(jjtn003,true);
}
}
break;
case STRING:
ASTPtLeafNode jjtn004=new ASTPtLeafNode(JJTPTLEAFNODE);
boolean jjtc004=true;
jjtree.openNodeScope(jjtn004);
try {
jj_consume_token(STRING);
jjtree.closeNodeScope(jjtn004,true);
jjtc004=false;
len=token.image.length();
tidied=token.image.substring(1,(len - 1));
StringTokenizer st=new StringTokenizer(tidied,"String_Node_Str",true);
boolean escape=false;
x=new String();
while (st.hasMoreTokens()) {
String tok=st.nextToken();
if (escape) {
escape=false;
int trailingCharIndex=1;
switch (tok.charAt(0)) {
case 'n':
x+="String_Node_Str";
break;
case 't':
x+="String_Node_Str";
break;
case 'b':
x+="String_Node_Str";
break;
case 'r':
x+="String_Node_Str";
break;
case 'f':
x+="String_Node_Str";
break;
case '\\':
x+="String_Node_Str";
break;
case '\'':
x+="String_Node_Str";
break;
case '"':
x+="String_Node_Str";
break;
default :
int i;
for (i=0; i < tok.length(); i++) {
char c=tok.charAt(i);
if (!(c == '0' || c == '1' || c == '2' || c == '3' || c == '4' || c == '5' || c == '6' || c == '7')) break;
}
trailingCharIndex=i;
int octVal=Integer.parseInt(tok.substring(0,trailingCharIndex),8);
x+=(char)octVal;
break;
}
if (trailingCharIndex < tok.length()) {
x+=tok.substring(trailingCharIndex);
}
}
 else if (tok.equals("String_Node_Str")) {
escape=true;
}
 else {
x+=tok;
}
}
jjtn004._ptToken=new StringToken(x);
jjtn004._isConstant=true;
}
  finally {
if (jjtc004) {
jjtree.closeNodeScope(jjtn004,true);
}
}
break;
case BOOLEAN:
ASTPtLeafNode jjtn005=new ASTPtLeafNode(JJTPTLEAFNODE);
boolean jjtc005=true;
jjtree.openNodeScope(jjtn005);
try {
jj_consume_token(BOOLEAN);
jjtree.closeNodeScope(jjtn005,true);
jjtc005=false;
if (token.image.equalsIgnoreCase("String_Node_Str")) {
jjtn005._ptToken=BooleanToken.TRUE;
}
 else if (token.image.equalsIgnoreCase("String_Node_Str")) {
jjtn005._ptToken=BooleanToken.FALSE;
}
jjtn005._isConstant=true;
}
  finally {
if (jjtc005) {
jjtree.closeNodeScope(jjtn005,true);
}
}
break;
case 47:
jj_consume_token(47);
funcIf();
jj_consume_token(49);
break;
default :
jj_la1[21]=jj_gen;
if (jj_2_1(2147483647)) {
matrixConstruct();
}
 else if (jj_2_2(2147483647)) {
recordConstruct();
}
 else if (jj_2_3(2147483647)) {
arrayConstruct();
}
 else if (jj_2_4(2147483647)) {
function();
}
 else {
switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
case ID:
identifier();
break;
default :
jj_la1[22]=jj_gen;
jj_consume_token(-1);
throw new ParseException();
}
}
}
}

Fixed version (ground truth):
final public void primaryElement() throws ParseException {
  int len;
  String tidied, x;
switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
case COMPLEX:
    ASTPtLeafNode jjtn001=new ASTPtLeafNode(JJTPTLEAFNODE);
  boolean jjtc001=true;
jjtree.openNodeScope(jjtn001);
try {
jj_consume_token(COMPLEX);
jjtree.closeNodeScope(jjtn001,true);
jjtc001=false;
try {
  x=token.image.toLowerCase();
  len=x.length();
  Double imag=new Double(x.substring(0,len - 1));
  Complex value=new Complex(0,imag.doubleValue());
  jjtn001._ptToken=new ComplexToken(value);
  jjtn001._isConstant=true;
}
 catch (NumberFormatException ee) {
{
    if (true)     throw new ParseException("String_Node_Str" + token.image + "String_Node_Str");
  }
}
}
  finally {
if (jjtc001) {
  jjtree.closeNodeScope(jjtn001,true);
}
}
break;
case DOUBLE:
ASTPtLeafNode jjtn002=new ASTPtLeafNode(JJTPTLEAFNODE);
boolean jjtc002=true;
jjtree.openNodeScope(jjtn002);
try {
jj_consume_token(DOUBLE);
jjtree.closeNodeScope(jjtn002,true);
jjtc002=false;
try {
x=token.image.toLowerCase();
len=x.length();
if (x.endsWith("String_Node_Str") || x.endsWith("String_Node_Str")) {
Double value=new Double(x.substring(0,len - 1));
jjtn002._ptToken=new DoubleToken(value.doubleValue());
}
 else {
Double value=new Double(x);
jjtn002._ptToken=new DoubleToken(value.doubleValue());
}
jjtn002._isConstant=true;
}
 catch (NumberFormatException ee) {
{
if (true) throw new ParseException("String_Node_Str" + token.image + "String_Node_Str");
}
}
}
  finally {
if (jjtc002) {
jjtree.closeNodeScope(jjtn002,true);
}
}
break;
case INTEGER:
ASTPtLeafNode jjtn003=new ASTPtLeafNode(JJTPTLEAFNODE);
boolean jjtc003=true;
jjtree.openNodeScope(jjtn003);
try {
jj_consume_token(INTEGER);
jjtree.closeNodeScope(jjtn003,true);
jjtc003=false;
try {
x=token.image.toLowerCase();
len=x.length();
int radix;
boolean mustBeLong=x.endsWith("String_Node_Str");
boolean mustBeUnsignedByte=x.endsWith("String_Node_Str");
int prefixLength;
int suffixLength;
if (mustBeLong) {
suffixLength=1;
}
 else if (mustBeUnsignedByte) {
suffixLength=2;
}
 else {
suffixLength=0;
}
if (x.startsWith("String_Node_Str")) {
radix=16;
prefixLength=2;
}
 else if (x.startsWith("String_Node_Str")) {
radix=8;
prefixLength=0;
}
 else {
radix=10;
prefixLength=0;
}
x=x.substring(prefixLength,len - suffixLength);
if (mustBeLong) {
jjtn003._ptToken=new LongToken(Long.parseLong(x,radix));
}
 else if (mustBeUnsignedByte) {
jjtn003._ptToken=new UnsignedByteToken(Integer.parseInt(x,radix));
}
 else {
try {
jjtn003._ptToken=new IntToken(Integer.parseInt(x,radix));
}
 catch (NumberFormatException nfe) {
jjtn003._ptToken=new LongToken(Long.parseLong(x,radix));
}
}
jjtn003._isConstant=true;
}
 catch (NumberFormatException ee) {
{
if (true) throw new ParseException("String_Node_Str" + token.image + "String_Node_Str");
}
}
}
  finally {
if (jjtc003) {
jjtree.closeNodeScope(jjtn003,true);
}
}
break;
case STRING:
ASTPtLeafNode jjtn004=new ASTPtLeafNode(JJTPTLEAFNODE);
boolean jjtc004=true;
jjtree.openNodeScope(jjtn004);
try {
jj_consume_token(STRING);
jjtree.closeNodeScope(jjtn004,true);
jjtc004=false;
len=token.image.length();
tidied=token.image.substring(1,(len - 1));
StringTokenizer st=new StringTokenizer(tidied,"String_Node_Str",true);
boolean escape=false;
x=new String();
while (st.hasMoreTokens()) {
String tok=st.nextToken();
if (escape) {
escape=false;
int trailingCharIndex=1;
switch (tok.charAt(0)) {
case 'n':
x+="String_Node_Str";
break;
case 't':
x+="String_Node_Str";
break;
case 'b':
x+="String_Node_Str";
break;
case 'r':
x+="String_Node_Str";
break;
case 'f':
x+="String_Node_Str";
break;
case '\\':
x+="String_Node_Str";
break;
case '\'':
x+="String_Node_Str";
break;
case '"':
x+="String_Node_Str";
break;
default :
int i;
for (i=0; i < tok.length(); i++) {
char c=tok.charAt(i);
if (!(c == '0' || c == '1' || c == '2' || c == '3' || c == '4' || c == '5' || c == '6' || c == '7')) break;
}
trailingCharIndex=i;
int octVal=Integer.parseInt(tok.substring(0,trailingCharIndex),8);
x+=(char)octVal;
break;
}
if (trailingCharIndex < tok.length()) {
x+=tok.substring(trailingCharIndex);
}
}
 else if (tok.equals("String_Node_Str")) {
escape=true;
}
 else {
x+=tok;
}
}
jjtn004._ptToken=new StringToken(x);
jjtn004._isConstant=true;
}
  finally {
if (jjtc004) {
jjtree.closeNodeScope(jjtn004,true);
}
}
break;
case BOOLEAN:
ASTPtLeafNode jjtn005=new ASTPtLeafNode(JJTPTLEAFNODE);
boolean jjtc005=true;
jjtree.openNodeScope(jjtn005);
try {
jj_consume_token(BOOLEAN);
jjtree.closeNodeScope(jjtn005,true);
jjtc005=false;
if (token.image.equalsIgnoreCase("String_Node_Str")) {
jjtn005._ptToken=BooleanToken.TRUE;
}
 else if (token.image.equalsIgnoreCase("String_Node_Str")) {
jjtn005._ptToken=BooleanToken.FALSE;
}
jjtn005._isConstant=true;
}
  finally {
if (jjtc005) {
jjtree.closeNodeScope(jjtn005,true);
}
}
break;
case 47:
jj_consume_token(47);
funcIf();
jj_consume_token(49);
break;
default :
jj_la1[21]=jj_gen;
if (jj_2_1(2147483647)) {
matrixConstruct();
}
 else if (jj_2_2(2147483647)) {
recordConstruct();
}
 else if (jj_2_3(2147483647)) {
arrayConstruct();
}
 else if (jj_2_4(2147483647)) {
function();
}
 else {
switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
case ID:
identifier();
break;
default :
jj_la1[22]=jj_gen;
jj_consume_token(-1);
throw new ParseException();
}
}
}
}