1 /***** BEGIN LICENSE BLOCK *****2 * Version: CPL 1.0/GPL 2.0/LGPL 2.13 *4 * The contents of this file are subject to the Common Public5 * License Version 1.0 (the "License"); you may not use this file6 * except in compliance with the License. You may obtain a copy of7 * the License at http://www.eclipse.org/legal/cpl-v10.html8 *9 * Software distributed under the License is distributed on an "AS10 * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or11 * implied. See the License for the specific language governing12 * rights and limitations under the License.13 *14 * Copyright (C) 2001-2002 Benoit Cerrina <b.cerrina@wanadoo.fr>15 * Copyright (C) 2002 Jan Arne Petersen <jpetersen@uni-bonn.de>16 * Copyright (C) 2002-2004 Anders Bengtsson <ndrsbngtssn@yahoo.se>17 * Copyright (C) 2004 Thomas E Enebo <enebo@acm.org>18 * Copyright (C) 2004 Stefan Matthias Aust <sma@3plus4.de>19 * 20 * Alternatively, the contents of this file may be used under the terms of21 * either of the GNU General Public License Version 2 or later (the "GPL"),22 * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),23 * in which case the provisions of the GPL or the LGPL are applicable instead24 * of those above. If you wish to allow use of your version of this file only25 * under the terms of either the GPL or the LGPL, and not to allow others to26 * use your version of this file under the terms of the CPL, indicate your27 * decision by deleting the provisions above and replace them with the notice28 * and other provisions required by the GPL or the LGPL. If you do not delete29 * the provisions above, a recipient may use your version of this file under30 * the terms of any one of the CPL, the GPL or the LGPL.31 ***** END LICENSE BLOCK *****/32 package org.jruby.ast.visitor;33 34 import org.jruby.ast.AliasNode;35 import org.jruby.ast.AndNode;36 import org.jruby.ast.ArgsCatNode;37 import org.jruby.ast.ArgsNode;38 import org.jruby.ast.ArgsPushNode;39 import org.jruby.ast.ArrayNode;40 import org.jruby.ast.AttrAssignNode;41 import org.jruby.ast.BackRefNode;42 import org.jruby.ast.BeginNode;43 import org.jruby.ast.BignumNode;44 import org.jruby.ast.BlockArgNode;45 import org.jruby.ast.BlockNode;46 import org.jruby.ast.BlockPassNode;47 import org.jruby.ast.BreakNode;48 import org.jruby.ast.CallNode;49 import org.jruby.ast.CaseNode;50 import org.jruby.ast.ClassNode;51 import org.jruby.ast.ClassVarAsgnNode;52 import org.jruby.ast.ClassVarDeclNode;53 import org.jruby.ast.ClassVarNode;54 import org.jruby.ast.Colon2Node;55 import org.jruby.ast.Colon3Node;56 import org.jruby.ast.ConstDeclNode;57 import org.jruby.ast.ConstNode;58 import org.jruby.ast.DAsgnNode;59 import org.jruby.ast.DRegexpNode;60 import org.jruby.ast.DStrNode;61 import org.jruby.ast.DSymbolNode;62 import org.jruby.ast.DVarNode;63 import org.jruby.ast.DXStrNode;64 import org.jruby.ast.DefinedNode;65 import org.jruby.ast.DefnNode;66 import org.jruby.ast.DefsNode;67 import org.jruby.ast.DotNode;68 import org.jruby.ast.EnsureNode;69 import org.jruby.ast.EvStrNode;70 import org.jruby.ast.FCallNode;71 import org.jruby.ast.FalseNode;72 import org.jruby.ast.FixnumNode;73 import org.jruby.ast.FlipNode;74 import org.jruby.ast.FloatNode;75 import org.jruby.ast.ForNode;76 import org.jruby.ast.GlobalAsgnNode;77 import org.jruby.ast.GlobalVarNode;78 import org.jruby.ast.HashNode;79 import org.jruby.ast.IfNode;80 import org.jruby.ast.InstAsgnNode;81 import org.jruby.ast.InstVarNode;82 import org.jruby.ast.IterNode;83 import org.jruby.ast.LocalAsgnNode;84 import org.jruby.ast.LocalVarNode;85 import org.jruby.ast.Match2Node;86 import org.jruby.ast.Match3Node;87 import org.jruby.ast.MatchNode;88 import org.jruby.ast.ModuleNode;89 import org.jruby.ast.MultipleAsgnNode;90 import org.jruby.ast.NewlineNode;91 import org.jruby.ast.NextNode;92 import org.jruby.ast.NilNode;93 import org.jruby.ast.NotNode;94 import org.jruby.ast.NthRefNode;95 import org.jruby.ast.OpAsgnAndNode;96 import org.jruby.ast.OpAsgnNode;97 import org.jruby.ast.OpAsgnOrNode;98 import org.jruby.ast.OpElementAsgnNode;99 import org.jruby.ast.OptNNode;100 import org.jruby.ast.OrNode;101 import org.jruby.ast.PostExeNode;102 import org.jruby.ast.RedoNode;103 import org.jruby.ast.RegexpNode;104 import org.jruby.ast.RescueBodyNode;105 import org.jruby.ast.RescueNode;106 import org.jruby.ast.RetryNode;107 import org.jruby.ast.ReturnNode;108 import org.jruby.ast.RootNode;109 import org.jruby.ast.SClassNode;110 import org.jruby.ast.SValueNode;111 import org.jruby.ast.SelfNode;112 import org.jruby.ast.SplatNode;113 import org.jruby.ast.StrNode;114 import org.jruby.ast.SuperNode;115 import org.jruby.ast.SymbolNode;116 import org.jruby.ast.ToAryNode;117 import org.jruby.ast.TrueNode;118 import org.jruby.ast.UndefNode;119 import org.jruby.ast.UntilNode;120 import org.jruby.ast.VAliasNode;121 import org.jruby.ast.VCallNode;122 import org.jruby.ast.WhenNode;123 import org.jruby.ast.WhileNode;124 import org.jruby.ast.XStrNode;125 import org.jruby.ast.YieldNode;126 import org.jruby.ast.ZArrayNode;127 import org.jruby.ast.ZSuperNode;128 import org.jruby.evaluator.Instruction;129 130 /**131 * Visitor interface to be implemented by visitors of the jRuby AST.132 * each node will call the visit method appropriate to its type.133 * @see org.jruby.ast.Node134 * @see org.jruby.ast.visitor.AbstractVisitor135 * 136 * @author Benoit Cerrina137 **/138 public interface NodeVisitor {139 public Instruction visitAliasNode(AliasNode iVisited);140 public Instruction visitAndNode(AndNode iVisited);141 public Instruction visitArgsNode(ArgsNode iVisited);142 public Instruction visitArgsCatNode(ArgsCatNode iVisited);143 public Instruction visitArgsPushNode(ArgsPushNode iVisited);144 public Instruction visitArrayNode(ArrayNode iVisited);145 public Instruction visitAttrAssignNode(AttrAssignNode iVisited);146 public Instruction visitBackRefNode(BackRefNode iVisited);147 public Instruction visitBeginNode(BeginNode iVisited);148 public Instruction visitBignumNode(BignumNode iVisited);149 public Instruction visitBlockArgNode(BlockArgNode iVisited);150 public Instruction visitBlockNode(BlockNode iVisited);151 public Instruction visitBlockPassNode(BlockPassNode iVisited);152 public Instruction visitBreakNode(BreakNode iVisited);153 public Instruction visitConstDeclNode(ConstDeclNode iVisited);154 public Instruction visitClassVarAsgnNode(ClassVarAsgnNode iVisited);155 public Instruction visitClassVarDeclNode(ClassVarDeclNode iVisited);156 public Instruction visitClassVarNode(ClassVarNode iVisited);157 public Instruction visitCallNode(CallNode iVisited);158 public Instruction visitCaseNode(CaseNode iVisited);159 public Instruction visitClassNode(ClassNode iVisited);160 public Instruction visitColon2Node(Colon2Node iVisited);161 public Instruction visitColon3Node(Colon3Node iVisited);162 public Instruction visitConstNode(ConstNode iVisited);163 public Instruction visitDAsgnNode(DAsgnNode iVisited);164 public Instruction visitDRegxNode(DRegexpNode iVisited);165 public Instruction visitDStrNode(DStrNode iVisited);166 public Instruction visitDSymbolNode(DSymbolNode iVisited);167 public Instruction visitDVarNode(DVarNode iVisited);168 public Instruction visitDXStrNode(DXStrNode iVisited);169 public Instruction visitDefinedNode(DefinedNode iVisited);170 public Instruction visitDefnNode(DefnNode iVisited);171 public Instruction visitDefsNode(DefsNode iVisited);172 public Instruction visitDotNode(DotNode iVisited);173 public Instruction visitEnsureNode(EnsureNode iVisited);174 public Instruction visitEvStrNode(EvStrNode iVisited);175 public Instruction visitFCallNode(FCallNode iVisited);176 public Instruction visitFalseNode(FalseNode iVisited);177 public Instruction visitFixnumNode(FixnumNode iVisited);178 public Instruction visitFlipNode(FlipNode iVisited);179 public Instruction visitFloatNode(FloatNode iVisited);180 public Instruction visitForNode(ForNode iVisited);181 public Instruction visitGlobalAsgnNode(GlobalAsgnNode iVisited);182 public Instruction visitGlobalVarNode(GlobalVarNode iVisited);183 public Instruction visitHashNode(HashNode iVisited);184 public Instruction visitInstAsgnNode(InstAsgnNode iVisited);185 public Instruction visitInstVarNode(InstVarNode iVisited);186 public Instruction visitIfNode(IfNode iVisited);187 public Instruction visitIterNode(IterNode iVisited);188 public Instruction visitLocalAsgnNode(LocalAsgnNode iVisited);189 public Instruction visitLocalVarNode(LocalVarNode iVisited);190 public Instruction visitMultipleAsgnNode(MultipleAsgnNode iVisited);191 public Instruction visitMatch2Node(Match2Node iVisited);192 public Instruction visitMatch3Node(Match3Node iVisited);193 public Instruction visitMatchNode(MatchNode iVisited);194 public Instruction visitModuleNode(ModuleNode iVisited);195 public Instruction visitNewlineNode(NewlineNode iVisited);196 public Instruction visitNextNode(NextNode iVisited);197 public Instruction visitNilNode(NilNode iVisited);198 public Instruction visitNotNode(NotNode iVisited);199 public Instruction visitNthRefNode(NthRefNode iVisited);200 public Instruction visitOpElementAsgnNode(OpElementAsgnNode iVisited);201 public Instruction visitOpAsgnNode(OpAsgnNode iVisited);202 public Instruction visitOpAsgnAndNode(OpAsgnAndNode iVisited);203 public Instruction visitOpAsgnOrNode(OpAsgnOrNode iVisited);204 public Instruction visitOptNNode(OptNNode iVisited);205 public Instruction visitOrNode(OrNode iVisited);206 public Instruction visitPostExeNode(PostExeNode iVisited);207 public Instruction visitRedoNode(RedoNode iVisited);208 public Instruction visitRegexpNode(RegexpNode iVisited);209 public Instruction visitRescueBodyNode(RescueBodyNode iVisited);210 public Instruction visitRescueNode(RescueNode iVisited);211 public Instruction visitRetryNode(RetryNode iVisited);212 public Instruction visitReturnNode(ReturnNode iVisited);213 public Instruction visitRootNode(RootNode iVisited);214 public Instruction visitSClassNode(SClassNode iVisited);215 public Instruction visitSelfNode(SelfNode iVisited);216 public Instruction visitSplatNode(SplatNode iVisited);217 public Instruction visitStrNode(StrNode iVisited);218 public Instruction visitSuperNode(SuperNode iVisited);219 public Instruction visitSValueNode(SValueNode iVisited);220 public Instruction visitSymbolNode(SymbolNode iVisited);221 public Instruction visitToAryNode(ToAryNode iVisited);222 public Instruction visitTrueNode(TrueNode iVisited);223 public Instruction visitUndefNode(UndefNode iVisited);224 public Instruction visitUntilNode(UntilNode iVisited);225 public Instruction visitVAliasNode(VAliasNode iVisited);226 public Instruction visitVCallNode(VCallNode iVisited);227 public Instruction visitWhenNode(WhenNode iVisited);228 public Instruction visitWhileNode(WhileNode iVisited);229 public Instruction visitXStrNode(XStrNode iVisited);230 public Instruction visitYieldNode(YieldNode iVisited);231 public Instruction visitZArrayNode(ZArrayNode iVisited);232 public Instruction visitZSuperNode(ZSuperNode iVisited);233 }234