private final String msgStackToString(ParseException e){
  StringBuffer msg;
  msg=new StringBuffer("***Parse Error***\n");
  if (!expecting.equals(emptyString)) {
    msg.append("Was expecting \"");
    msg.append(expecting);
    msg.append("\"\n");
  }
  msg.append(e.getShortMessage());
  msg.append("\n\nResidual stack trace follows:\n");
  int last=msgStackCurrentSize - 10;
  if (last < 0)   last=0;
  for (int lvi=msgStackCurrentSize; lvi > last; lvi-=2) {
    msg.append((String)msgStack[lvi - 2]);
    msg.append(" starting at line ");
    Token t=(Token)msgStack[lvi - 1];
    msg.append(t.beginLine);
    msg.append(", column ");
    msg.append(t.beginColumn);
    msg.append(".\n");
  }
  return msg.toString();
}

private final String msgStackToString ( ParseException e ) { StringBuffer msg ; msg = new StringBuffer ( "***Parse Error***\n" ) ; if ( ! expecting . equals ( emptyString ) ) { msg . append ( "Was expecting \"" ) ; msg . append ( expecting ) ; msg . append ( "\"\n" ) ; } msg . append ( e . getShortMessage ( ) ) ; msg . append ( "\n\nResidual stack trace follows:\n" ) ; int last = msgStackCurrentSize - 10 ; if ( last < 0 ) last = 0 ; for ( int lvi = msgStackCurrentSize ; lvi > last ; lvi -= 2 ) { msg . append ( ( String ) msgStack [ lvi - 2 ] ) ; msg . append ( " starting at line " ) ; Token t = ( Token ) msgStack [ lvi - 1 ] ; msg . append ( t . beginLine ) ; msg . append ( ", column " ) ; msg . append ( t . beginColumn ) ; msg . append ( ".\n" ) ; } return msg . toString ( ) ; }
it appears that the value of expecting is what is printed out in error messages as what the parser was expecting when it encountered an error .
