Oh. The parser did pops element in Parser.java. In the block " else if (act > ERROR_ACTION) { /* shift-reduce */" it didn't pops elements,but it also didn't break, and then the reduce block execute. So it did pops elements.
enter } else if (act > ERROR_ACTION) { /* shift-reduce */
consumeToken(this.currentToken);
if (this.currentElement != null) {
boolean oldValue = this.recordStringLiterals;
this.recordStringLiterals = false;
recoveryTokenCheck();
this.recordStringLiterals = oldValue;
}
try {
this.currentToken = this.scanner.getNextToken();
} catch(InvalidInputException e){
if (!this.hasReportedError){
problemReporter().scannerError(this, e.getMessage());
this.hasReportedError = true;
}
this.lastCheckPoint = this.scanner.currentPosition;
this.currentToken = 0;
this.restartRecovery = true;
}
if(this.statementRecoveryActivated) {
jumpOverType();
}
act -= ERROR_ACTION;
if (DEBUG_AUTOMATON) {
System.out.print("Shift/Reduce - (" + name[terminal_index[this.currentToken]]+") "); //$NON-NLS-1$ //$NON-NLS-2$
}
// It din't break here ,so it go to reduce b
} else {
if (act < ACCEPT_ACTION) { /* shift */
consumeToken(this.currentToken);
if (this.currentElement != null) {
boolean oldValue = this.recordStringLiterals;
this.recordStringLiterals = false;
recoveryTokenCheck();
this.recordStringLiterals = oldValue;
}
try{
this.currentToken = this.scanner.getNextToken();
} catch(InvalidInputException e){
if (!this.hasReportedError){
problemReporter().scannerError(this, e.getMessage());
this.hasReportedError = true;
}
this.lastCheckPoint = this.scanner.currentPosition;
this.currentToken = 0;
this.restartRecovery = true;
}
if(this.statementRecoveryActivated) {
jumpOverType();
}
if (DEBUG_AUTOMATON) {
System.out.println("Shift - (" + name[terminal_index[this.currentToken]]+")"); //$NON-NLS-1$ //$NON-NLS-2$
}
continue ProcessTerminals;
}
break ProcessTerminals;
}
// ProcessNonTerminals :
do { /* reduce */
if (DEBUG_AUTOMATON) {
System.out.println(name[non_terminal_index[lhs[act]]]);
}
consumeRule(act);
this.stateStackTop -= (rhs[act] - 1);
act = ntAction(this.stack[this.stateStackTop], lhs[act]);
if (DEBUG_AUTOMATON) {
if (act <= NUM_RULES) {
System.out.print(" - "); //$NON-NLS-1$
}
}
} while (act <= NUM_RULES);here