grammar = (Grammar) stack.pop();
}
else if (localName.equals(TOKENLIST_ELEMENT))
{
TokenList tokens = (TokenList) stack.pop();
Grammar grammar = (Grammar) stack.peek();
grammar.getTokenList().addToken(tokens);
}
else if (localName.equals(IGNORABLETOKENLIST_ELEMENT))
{
TokenList tokens = (TokenList) stack.pop();
Grammar grammar = (Grammar) stack.peek();
grammar.getIgnorableTokenList().addToken(tokens);
}
else if (localName.equals(TOKEN_ELEMENT))
{
Token token = (Token) stack.pop();
TokenList tokens = (TokenList) stack.peek();
tokens.addToken(token);
}
else if ((localName.equals(ALTERNATION_ELEMENT))
|| (localName.equals(CONCATENATION_ELEMENT))
|| (localName.equals(CHARACTERSEQUENCE_ELEMENT))
|| (localName.equals(CHARACTERCLASS_ELEMENT))
|| (localName.equals(UNIVERSALCHARACTER_ELEMENT))
|| (localName.equals(BEGINOFLINE_ELEMENT))
|| (localName.equals(ENDOFLINE_ELEMENT))
|| (localName.equals("ncc")))
{
DefinitionElement definitionelement = (DefinitionElement) stack.pop();
if (stack.peek() instanceof Alternation)
{
Alternation alternation = (Alternation) stack.peek();
alternation.addDefinitionElement(definitionelement);
}
else if (stack.peek() instanceof Concatenation)
{
Concatenation concatenation = (Concatenation) stack.peek();
concatenation.addDefinitionElement(definitionelement);
}
else if (stack.peek() instanceof Token)
{
Token token = (Token) stack.peek();
token.setDefinition(definitionelement);
}
}
else if ((localName.equals(CHARACTERSET_ELEMENT))
|| (localName.equals(CHARACTERINTERVAL_ELEMENT)))
{
CharacterClassElement characterclasselement = (CharacterClassElement) stack.pop();
CharacterClass characterclass = (CharacterClass) stack.peek();
characterclass.addCharacterClassElement(characterclasselement);
}
/*else if (localName.equals(COMMENT_ELEMENT))
{
Comment comment = (Comment) stack.pop();
Grammar grammar = (Grammar) stack.peek();
grammar.setComment(comment);
}
else if (localName.equals(WHITESPACE_ELEMENT))
{
Whitespace whitespace = (Whitespace) stack.pop();
Grammar grammar = (Grammar) stack.peek();
grammar.setWhitespace(whitespace);
}*/
else if (localName.equals(PRODUCTIONLIST_ELEMENT))
{
ProductionList productions = (ProductionList) stack.pop();
Grammar grammar = (Grammar) stack.peek();
grammar.getProductionList().addProduction(productions);
}
else if (localName.equals(PRODUCTION_ELEMENT))
{
Production production = (Production) stack.pop();
ProductionList productions = (ProductionList) stack.peek();
productions.addProduction(production);
}
else if (localName.equals(NONTERMINALSYMBOL_ELEMENT))
{
Symbol ntsymbol = (Symbol) stack.pop();
Production production = (Production) stack.peek();
production.getDefinition().addSymbol(ntsymbol);
}
else if (localName.equals(TERMINALSYMBOL_ELEMENT))
{
Symbol tsymbol = (Symbol) stack.pop();
Production production = (Production) stack.peek();
production.getDefinition().addSymbol(tsymbol);
}
else if (localName.equals(STARTSYMBOL_ELEMENT))
{
NonTerminalSymbol ssymbol = (NonTerminalSymbol) stack.pop();
Grammar grammar = (Grammar) stack.peek();
grammar.setStartSymbol(ssymbol);
}
else
System.out.println(localName + " would not process");
}