private void shift(StackNode node, char[] text, int position)
{
for (PatternIterator i = node.pattern.getSuccessors(); i.hasNext();)
{
Pattern nextPattern = i.next();
if (nextPattern.contains(text[position]))
{
if (node instanceof NonterminalStackNode)
{
for (PatternIterator j = node.last.pattern.getSuccessors(); j.hasNext();)
if (j.next().contains(text[position]))
return;
for (PatternIterator j = node.last.pattern.getAscendingSuccessors(); j.hasNext();)
if (j.next().contains(text[position]))
return;
}
StackNode newNode = new TerminalStackNode(text, position, nextPattern, node);
if ((log!=null) && (log.isDebugEnabled()))
log.debug("shift "+newNode);
next.push(newNode);
}
}
for (PatternIterator i = node.pattern.getAscendingSuccessors(); i.hasNext();)
{
Pattern firstPattern = i.next();
if (firstPattern.contains(text[position]))
{
if (node instanceof NonterminalStackNode)
{
for (PatternIterator j = node.last.pattern.getSuccessors(); j.hasNext();)
if (j.next().contains(text[position]))