protected int MultiplicativeExpr(int addPos) throws javax.xml.transform.TransformerException
  {

    int opPos = m_ops.getOp(OpMap.MAPINDEX_LENGTH);

    if (-1 == addPos)
      addPos = opPos;

    UnaryExpr();

    if (null != m_token)
    {
      if (tokenIs('*'))
      {
        nextToken();
        insertOp(addPos, 2, OpCodes.OP_MULT);

        int opPlusLeftHandLen = m_ops.getOp(OpMap.MAPINDEX_LENGTH) - addPos;

        addPos = MultiplicativeExpr(addPos);
        m_ops.setOp(addPos + OpMap.MAPINDEX_LENGTH,
          m_ops.getOp(addPos + opPlusLeftHandLen + 1) + opPlusLeftHandLen);
        addPos += 2;
      }
      else if (tokenIs("div"))
      {
        nextToken();
        insertOp(addPos, 2, OpCodes.OP_DIV);

        int opPlusLeftHandLen = m_ops.getOp(OpMap.MAPINDEX_LENGTH) - addPos;

        addPos = MultiplicativeExpr(addPos);
        m_ops.setOp(addPos + OpMap.MAPINDEX_LENGTH,
          m_ops.getOp(addPos + opPlusLeftHandLen + 1) + opPlusLeftHandLen);
        addPos += 2;
      }
      else if (tokenIs("mod"))
      {
        nextToken();
        insertOp(addPos, 2, OpCodes.OP_MOD);

        int opPlusLeftHandLen = m_ops.getOp(OpMap.MAPINDEX_LENGTH) - addPos;

        addPos = MultiplicativeExpr(addPos);
        m_ops.setOp(addPos + OpMap.MAPINDEX_LENGTH,
          m_ops.getOp(addPos + opPlusLeftHandLen + 1) + opPlusLeftHandLen);
        addPos += 2;
      }
      else if (tokenIs("quo"))
      {
        nextToken();
        insertOp(addPos, 2, OpCodes.OP_QUO);

        int opPlusLeftHandLen = m_ops.getOp(OpMap.MAPINDEX_LENGTH) - addPos;

        addPos = MultiplicativeExpr(addPos);
        m_ops.setOp(addPos + OpMap.MAPINDEX_LENGTH,
          m_ops.getOp(addPos + opPlusLeftHandLen + 1) + opPlusLeftHandLen);
        addPos += 2;
      }
    }

    return addPos;
  }
protected int MultiplicativeExpr ( int addPos ) throws javax . xml . transform . TransformerException { int opPos = m_ops . getOp ( OpMap . MAPINDEX_LENGTH ) ; if ( - 1 == addPos ) addPos = opPos ; UnaryExpr ( ) ; if ( null != m_token ) { if ( tokenIs ( '*' ) ) { nextToken ( ) ; insertOp ( addPos , 2 , OpCodes . OP_MULT ) ; int opPlusLeftHandLen = m_ops . getOp ( OpMap . MAPINDEX_LENGTH ) - addPos ; addPos = MultiplicativeExpr ( addPos ) ; m_ops . setOp ( addPos + OpMap . MAPINDEX_LENGTH , m_ops . getOp ( addPos + opPlusLeftHandLen + 1 ) + opPlusLeftHandLen ) ; addPos += 2 ; } else if ( tokenIs ( "div" ) ) { nextToken ( ) ; insertOp ( addPos , 2 , OpCodes . OP_DIV ) ; int opPlusLeftHandLen = m_ops . getOp ( OpMap . MAPINDEX_LENGTH ) - addPos ; addPos = MultiplicativeExpr ( addPos ) ; m_ops . setOp ( addPos + OpMap . MAPINDEX_LENGTH , m_ops . getOp ( addPos + opPlusLeftHandLen + 1 ) + opPlusLeftHandLen ) ; addPos += 2 ; } else if ( tokenIs ( "mod" ) ) { nextToken ( ) ; insertOp ( addPos , 2 , OpCodes . OP_MOD ) ; int opPlusLeftHandLen = m_ops . getOp ( OpMap . MAPINDEX_LENGTH ) - addPos ; addPos = MultiplicativeExpr ( addPos ) ; m_ops . setOp ( addPos + OpMap . MAPINDEX_LENGTH , m_ops . getOp ( addPos + opPlusLeftHandLen + 1 ) + opPlusLeftHandLen ) ; addPos += 2 ; } else if ( tokenIs ( "quo" ) ) { nextToken ( ) ; insertOp ( addPos , 2 , OpCodes . OP_QUO ) ; int opPlusLeftHandLen = m_ops . getOp ( OpMap . MAPINDEX_LENGTH ) - addPos ; addPos = MultiplicativeExpr ( addPos ) ; m_ops . setOp ( addPos + OpMap . MAPINDEX_LENGTH , m_ops . getOp ( addPos + opPlusLeftHandLen + 1 ) + opPlusLeftHandLen ) ; addPos += 2 ; } } return addPos ; }
This has to handle construction of the operations so that they are evaluated
in pre-fix order.  So, for 9+7-6, instead of |+|9|-|7|6|, this needs to be
evaluated as |-|+|9|7|6|.

MultiplicativeExpr  ::=  UnaryExpr
| MultiplicativeExpr MultiplyOperator UnaryExpr
| MultiplicativeExpr 'div' UnaryExpr
| MultiplicativeExpr 'mod' UnaryExpr
| MultiplicativeExpr 'quo' UnaryExpr

@param addPos Position where expression is to be added, or -1 for append.

@return the position at the end of the equality expression.

@throws javax.xml.transform.TransformerException