1 package org.sentrysoftware.jawk.frontend; 2 3 /*- 4 * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ 5 * Jawk 6 * ჻჻჻჻჻჻ 7 * Copyright (C) 2006 - 2023 Sentry Software 8 * ჻჻჻჻჻჻ 9 * This program is free software: you can redistribute it and/or modify 10 * it under the terms of the GNU Lesser General Public License as 11 * published by the Free Software Foundation, either version 3 of the 12 * License, or (at your option) any later version. 13 * 14 * This program is distributed in the hope that it will be useful, 15 * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 * GNU General Lesser Public License for more details. 18 * 19 * You should have received a copy of the GNU General Lesser Public 20 * License along with this program. If not, see 21 * <http://www.gnu.org/licenses/lgpl-3.0.html>. 22 * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ 23 */ 24 25 import java.io.PrintStream; 26 27 import org.sentrysoftware.jawk.intermediate.AwkTuples; 28 29 /** 30 * A Jawk abstract syntax tree node. This provides 31 * an appropriate public interface to the abstract 32 * syntax tree. 33 * 34 * @author Danny Daglas 35 */ 36 public interface AwkSyntaxTree { 37 38 /** 39 * Dump a meaningful text representation of this 40 * abstract syntax tree node to the output (print) 41 * stream. Either it is called directly by the 42 * application program, or it is called by the 43 * parent node of this tree node. 44 * 45 * @param ps The print stream to dump the text 46 * representation. 47 */ 48 void dump(PrintStream ps); 49 50 /** 51 * Apply semantic checks to this node. The default 52 * implementation is to simply call semanticAnalysis() 53 * on all the children of this abstract syntax tree node. 54 * Therefore, this method must be overridden to provide 55 * meaningful semantic analysis / checks. 56 */ 57 void semanticAnalysis(); 58 59 /** 60 * Appends tuples to the AwkTuples list 61 * for this abstract syntax tree node. Subclasses 62 * must implement this method. 63 * <p> 64 * This is called either by the main program to generate a full 65 * list of tuples for the abstract syntax tree, or it is called 66 * by other abstract syntax tree nodes in response to their 67 * attempt at populating tuples. 68 * 69 * @param tuples The tuples to populate. 70 * @return The number of items left on the operand stack after 71 * these tuples have executed. 72 */ 73 int populateTuples(AwkTuples tuples); 74 }