// This file is copyrighted and is part of nzdis-oql package. // See the file LICENSE for copyright information and the terms and conditions for copying, distributing and modifications of nzdis-oql package. // @copyright@ package nzdis.lang.oql; /**/ import nzdis.lang.oql.analysis.DepthFirstAdapter; import nzdis.lang.oql.node.*; import java.util.Hashtable; /** * Free variables extractor. Traverses the AST and collects all the * references to free variables. * *@author Mariusz Nowostawski *@version @version@ $Revision: 1.1 $ */ class FreeVariableWalker extends DepthFirstAdapter { /** * String variable names without leading $ indexed by appropriate * AST nodes.*/ private Hashtable variables = new Hashtable(); /** Returns the variable hash. */ public Hashtable getVariables(){ return this.variables; } public void outALongParamExpr(ALongParamExpr node){ this.variables.put(node, node.getLongLiteral().getText().trim()); } public void outANamedParamExpr(ANamedParamExpr node){ this.variables.put(node, node.getIdentifier().getText().trim()); } }