Package com.stuffwithstuff.bantam.parselets

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

package com.stuffwithstuff.bantam.parselets;

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

/**
* Parses parentheses used to group an expression, like "a * (b + c)".
*/
public class GroupParselet implements PrefixParselet {
  public Expression parse(Parser parser, Token token) {
    Expression expression = parser.parseExpression();
    parser.consume(TokenType.RIGHT_PAREN);
    return expression;
  }
}
TOP

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

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.