Package org.allspice.parser.parsetable

Examples of org.allspice.parser.parsetable.Action


   */
  protected void addActions(ParseTable pt, LR1State st,
      Map<String, LR1State> lalr1gotos) throws StateConflict {
    for(LR1Item item: st.item) {
      if (item.core.pos >= item.core.r.rhs.size()) {
        final Action action ;
        if (item.core.r.equals(startRule)) {
          action = new AcceptAction(startRule) ;
        }
        else {
          action = new ReduceAction(item.core.r);
View Full Code Here


        return ;
      }
      boolean replaced = false ;
      for(Action prevAction: prevActions) {
        try {
          final Action newAction = getPreferred(st, prevAction, action, a) ;
          if (newAction != null) {
            newActions.add(newAction) ;
          }
          replaced = true ;
        }
View Full Code Here

   * @param a The symbol
   * @return the tie breaker
   * @throws StateConflict
   */
  protected Action getPreferred(LR1State st,Action a1,Action a2, String a) throws StateConflict {
    Action shiftAction = (a1 instanceof ShiftAction) ? a1 : (a2 instanceof ShiftAction) ? a2 : null ;
    Action otherAction = !(a1 instanceof ShiftAction) ? a1 : !(a2 instanceof ShiftAction) ? a2 : null ;
    if (shiftAction == null || otherAction == null) {
      throw new StateConflict(st,a,a1,a2) ;
    }
    int p1 = getPrecedence(a1, a) ;
    int p2 = getPrecedence(a2, a) ;
View Full Code Here

TOP

Related Classes of org.allspice.parser.parsetable.Action

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.