writer.start("parserTable");
int no = 0;
Iterator itr = impl.keySet().iterator();
while( itr.hasNext() ) {
Expression nonTerm = (Expression)itr.next();
Map t2r = (Map)impl.get(nonTerm);
writer.start("action",
new String[]{"stackTop",symbolizer.getId(nonTerm)});
Rule defaultAction=null;
{
Set defaultActionSet = (Set)t2r.get(Expression.epsilon);
if(defaultActionSet!=null) {
if(defaultActionSet.size()>1)
// only one default action is possible
throw new Error();
if(defaultActionSet.size()==1)
defaultAction = (Rule)defaultActionSet.toArray()[0];
}
}
Iterator jtr = t2r.keySet().iterator();
while( jtr.hasNext() ) {
Expression term = (Expression)jtr.next();
// applicable rules.
Rule[] rules = (Rule[])((Set)t2r.get(term)).toArray(new Rule[0]);
if( rules.length==1 && rules[0]==defaultAction && term!=Expression.epsilon )
continue; // this token statement can be absorbed by the "otherwise" clause.