public static ASTBinaryTree buildTree(ASTIterator input) { ASTIterator iter = new ASTLinkedList(input.firstNode()); ASTBinaryTree tree = new ASTBinaryTree(iter.nextNode()); while (iter.hasMoreNodes()) { ASTNode node = iter.nextNode(); if (node instanceof EndOfStatement) { if (iter.hasMoreNodes()) tree = new ASTBinaryTree(iter.nextNode()); } else { tree = tree.append(node); } } return tree; } }
public static ASTBinaryTree buildTree(ASTIterator input) { ASTIterator iter = new ASTLinkedList(input.firstNode()); ASTBinaryTree tree = new ASTBinaryTree(iter.nextNode()); while (iter.hasMoreNodes()) { ASTNode node = iter.nextNode(); if (node instanceof EndOfStatement) { if (iter.hasMoreNodes()) tree = new ASTBinaryTree(iter.nextNode()); } else { tree = tree.append(node); } } return tree; } }
/** * Returns an ordered Map of all functions declared within an compiled script. * * @param compile * @return - ordered Map */ public static Map<String, Function> extractAllDeclaredFunctions(CompiledExpression compile) { Map<String, Function> allFunctions = new LinkedHashMap<String, Function>(); ASTIterator instructions = new ASTLinkedList(compile.getFirstNode()); ASTNode n; while (instructions.hasMoreNodes()) { if ((n = instructions.nextNode()) instanceof Function) { allFunctions.put(n.getName(), (Function) n); } } return allFunctions; }
/** * Returns an ordered Map of all functions declared within an compiled script. * * @param compile * @return - ordered Map */ public static Map<String, Function> extractAllDeclaredFunctions(CompiledExpression compile) { Map<String, Function> allFunctions = new LinkedHashMap<String, Function>(); ASTIterator instructions = new ASTLinkedList(compile.getFirstNode()); ASTNode n; while (instructions.hasMoreNodes()) { if ((n = instructions.nextNode()) instanceof Function) { allFunctions.put(n.getName(), (Function) n); } } return allFunctions; }
/** * Returns an ordered Map of all functions declared within an compiled script. * * @param compile * @return - ordered Map */ public static Map<String, Function> extractAllDeclaredFunctions(CompiledExpression compile) { Map<String, Function> allFunctions = new LinkedHashMap<String, Function>(); ASTIterator instructions = new ASTLinkedList(compile.getFirstNode()); ASTNode n; while (instructions.hasMoreNodes()) { if ((n = instructions.nextNode()) instanceof Function) { allFunctions.put(n.getName(), (Function) n); } } return allFunctions; }
public static Class determineType(String name, CompiledExpression compiledExpression) { ASTIterator iter = new ASTLinkedList(compiledExpression.getFirstNode()); ASTNode node; while (iter.hasMoreNodes()) { if (name.equals((node = iter.nextNode()).getName()) && node.isAssignment()) { return node.getEgressType(); } } return null; }
public static Class determineType(String name, CompiledExpression compiledExpression) { ASTIterator iter = new ASTLinkedList(compiledExpression.getFirstNode()); ASTNode node; while (iter.hasMoreNodes()) { if (name.equals((node = iter.nextNode()).getName()) && node.isAssignment()) { return node.getEgressType(); } } return null; }
public static Class determineType(String name, CompiledExpression compiledExpression) { ASTIterator iter = new ASTLinkedList(compiledExpression.getFirstNode()); ASTNode node; while (iter.hasMoreNodes()) { if (name.equals((node = iter.nextNode()).getName()) && node.isAssignment()) { return node.getEgressType(); } } return null; }
sbuf.append("(").append(context.node++).append(") "); if ((tk = iter.nextNode()) instanceof NestedStatement && ((NestedStatement) tk).getNestedStatement() instanceof CompiledExpression) {
sbuf.append("(").append(context.node++).append(") "); if ((tk = iter.nextNode()) instanceof NestedStatement && ((NestedStatement) tk).getNestedStatement() instanceof CompiledExpression) {
sbuf.append("(").append(context.node++).append(") "); if ((tk = iter.nextNode()) instanceof NestedStatement && ((NestedStatement) tk).getNestedStatement() instanceof CompiledExpression) {