Package net.sourceforge.chaperon.build

Examples of net.sourceforge.chaperon.build.ShiftAction


          {
            productionnode.linenumber = locator.getLineNumber();
            productionnode.columnnumber = locator.getColumnNumber();
          }

          ShiftAction shiftaction = ancestor.state.getShiftAction(productionnode.symbol);

          if (shiftaction!=null)
          {
            StateNode newstatenode = getStateNode(current, shiftaction.state, ancestor);

            if (newstatenode==null)
            {
              System.out.println("new state node: new state="+automaton.indexOf(shiftaction.state)+
                                 " ancestor state="+automaton.indexOf(ancestor.state));
              newstatenode = new StateNode(shiftaction.state, ancestor, productionnode);
              current.push(newstatenode);
            }
            else
            {
              System.out.println("merging state node");

              ProductionNode oldproductionnode = (ProductionNode)newstatenode.treenode;

              if (grammar.getPriority(oldproductionnode.production)>grammar.getPriority(production))
              {
                System.out.println("priority("+production+") < priority("+
                                   oldproductionnode.production+")");
                newstatenode.treenode = productionnode;
              }
              else
                System.out.println("priority("+production+") >= priority("+
                                   oldproductionnode.production+")");
            }
          }
        }
      }
    }

    Stack dummy = next;
    next = current;
    current = dummy;

    System.out.println("Current states");

    for (int i = 0; i<current.size(); i++)
      System.out.println(current.get(i));

    System.out.println();

    /* ==================================== Shift  =================================== */
    TokenNode tokennode = new TokenNode(symbol, text);

    if (locator!=null)
    {
      tokennode.linenumber = locator.getLineNumber();
      tokennode.columnnumber = locator.getColumnNumber();
    }

    while (!current.isEmpty())
    {
      StateNode statenode = (StateNode)current.pop();

      ShiftAction shiftaction = statenode.state.getShiftAction(symbol);

      if (shiftaction!=null)
      {
        if ((log!=null) && (log.isDebugEnabled()))
          log.debug(
View Full Code Here


            ancestor = ancestor.ancestor;
          }

          productionnode.descendants = descendants;

          ShiftAction shiftaction = ancestor.state.getShiftAction(productionnode.symbol);

          //System.out.println("current state:\n"+ancestor.state+"\ntransition for "+productionnode.symbol+" = "+shiftaction);
          if ((automaton.getState(0)==ancestor.state) &&
              (productionnode.symbol.equals(grammar.getStartSymbol())))
          {
View Full Code Here

TOP

Related Classes of net.sourceforge.chaperon.build.ShiftAction

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.