Package com.stuffwithstuff.bantam.parselets

Source Code of com.stuffwithstuff.bantam.parselets.PostfixOperatorParselet

package com.stuffwithstuff.bantam.parselets;

import com.stuffwithstuff.bantam.Parser;
import com.stuffwithstuff.bantam.Token;
import com.stuffwithstuff.bantam.expressions.Expression;
import com.stuffwithstuff.bantam.expressions.PostfixExpression;

/**
* Generic infix parselet for an unary arithmetic operator. Parses postfix
* unary "?" expressions.
*/
public class PostfixOperatorParselet implements InfixParselet {
  public PostfixOperatorParselet(int precedence) {
    mPrecedence = precedence;
  }
 
  public Expression parse(Parser parser, Expression left, Token token) {
    return new PostfixExpression(left, token.getType());
  }

  public int getPrecedence() {
    return mPrecedence;
  }
 
  private final int mPrecedence;
}
TOP

Related Classes of com.stuffwithstuff.bantam.parselets.PostfixOperatorParselet

TOP
Copyright © 2018 www.massapi.com. 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.