public ConditionAnalyzer(ExecutableStatement stmt, Declaration[] declarations, String conditionClass) { this.declarations = declarations; this.conditionClass = conditionClass; if (stmt instanceof ExecutableLiteral) { executableLiteral = (ExecutableLiteral)stmt; } else if (stmt instanceof CompiledExpression) { node = ((CompiledExpression)stmt).getFirstNode(); } else { node = ((ExecutableAccessor)stmt).getNode(); } }
private ASTNode getRootNode() { if (executableStatement instanceof ExecutableLiteral) { return null; } return executableStatement instanceof CompiledExpression ? ((CompiledExpression) executableStatement).getFirstNode() : ((ExecutableAccessor) executableStatement).getNode(); } }
/** * 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; }
private static String decompile(CompiledExpression cExp, boolean nest, DecompileContext context) { ASTIterator iter = new ASTLinkedList(cExp.getFirstNode()); ASTNode tk;
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; }
private static String decompile(CompiledExpression cExp, boolean nest, DecompileContext context) { ASTIterator iter = new ASTLinkedList(cExp.getFirstNode()); ASTNode tk;
private static String decompile(CompiledExpression cExp, boolean nest, DecompileContext context) { ASTIterator iter = new ASTLinkedList(cExp.getFirstNode()); ASTNode tk;
accessorNode = (AccessorNode)accessor; } else if (accessor instanceof CompiledExpression) { return analyzeNode(((CompiledExpression)accessor).getFirstNode()); } else if (accessor instanceof ListCreator) { return analyzeListCreation(((ListCreator) accessor));
private static Serializable _optimizeTree(final CompiledExpression compiled) { /** * If there is only one token, and it's an identifier, we can optimize this as an accessor expression. */ if (compiled.isSingleNode()) { ASTNode tk = compiled.getFirstNode(); if (tk.isLiteral() && !tk.isThisVal()) { return new ExecutableLiteral(tk.getLiteralValue()); } return tk.canSerializeAccessor() ? new ExecutableAccessorSafe(tk, compiled.getKnownEgressType()) : new ExecutableAccessor(tk, compiled.getKnownEgressType()); } return compiled; }
private static Serializable _optimizeTree(final CompiledExpression compiled) { /** * If there is only one token, and it's an identifier, we can optimize this as an accessor expression. */ if (compiled.isSingleNode()) { ASTNode tk = compiled.getFirstNode(); if (tk.isLiteral() && !tk.isThisVal()) { return new ExecutableLiteral(tk.getLiteralValue()); } return tk.canSerializeAccessor() ? new ExecutableAccessorSafe(tk, compiled.getKnownEgressType()) : new ExecutableAccessor(tk, compiled.getKnownEgressType()); } return compiled; }
private static Serializable _optimizeTree(final CompiledExpression compiled) { /** * If there is only one token, and it's an identifier, we can optimize this as an accessor expression. */ if (compiled.isSingleNode()) { ASTNode tk = compiled.getFirstNode(); if (tk.isLiteral() && !tk.isThisVal()) { return new ExecutableLiteral(tk.getLiteralValue()); } return tk.canSerializeAccessor() ? new ExecutableAccessorSafe(tk, compiled.getKnownEgressType()) : new ExecutableAccessor(tk, compiled.getKnownEgressType()); } return compiled; }
ExecutionStack stk = new ExecutionStack(); ASTNode tk = expression.getFirstNode(); Integer operator;
ExecutionStack stk = new ExecutionStack(); ASTNode tk = expression.getFirstNode(); Integer operator;
ExecutionStack stk = new ExecutionStack(); ASTNode tk = expression.getFirstNode(); Integer operator;