/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * */ /* Generated By:JJTree: Do not edit this line. ASTInteger.java */ /* JJT: 0.3pre1 */ package Mini; import org.apache.bcel.generic.ConstantPoolGen; import org.apache.bcel.generic.InstructionList; import org.apache.bcel.generic.MethodGen; import org.apache.bcel.generic.PUSH; /** * * @version $Id: ASTInteger.java 1152313 2011-07-29 17:31:23Z sebb $ * @author <A HREF="mailto:m.dahm@gmx.de">M. Dahm</A> */ public class ASTInteger extends ASTExpr { private int value; // Generated methods ASTInteger(int id) { super(id); } ASTInteger(MiniParser p, int id) { super(p, id); } public static Node jjtCreate(MiniParser p, int id) { return new ASTInteger(p, id); } // closeNode, dump inherited from Expr /** * @return identifier and line/column number of appearance */ @Override public String toString() { return super.toString() + " = " + value; } /** * Overrides ASTExpr.traverse() */ @Override public ASTExpr traverse(Environment env) { this.env = env; return this; // Nothing to reduce/traverse here } /** * Second pass * Overrides AstExpr.eval() * @return type of expression */ @Override public int eval(int expected) { is_simple = true; // (Very) simple expression, always true return type = T_INT; } /** * Fourth pass, produce Java code. */ @Override public void code(StringBuffer buf) { ASTFunDecl.push(buf, "" + value); } /** * Fifth pass, produce Java byte code. */ @Override public void byte_code(InstructionList il, MethodGen method, ConstantPoolGen cp) { il.append(new PUSH(cp, value)); ASTFunDecl.push(); } void setValue(int value) { this.value = value; } int getValue() { return value; } }