public static Accessor extractAccessor(ASTNode n) { if (n instanceof LiteralNode) return new ExecutableLiteral(n.getLiteralValue()); else return new ExecutableAccessor(n, n.getEgressType()); }
public static Accessor extractAccessor(ASTNode n) { if (n instanceof LiteralNode) return new ExecutableLiteral(n.getLiteralValue()); else return new ExecutableAccessor(n, n.getEgressType()); }
public static Accessor extractAccessor(ASTNode n) { if (n instanceof LiteralNode) return new ExecutableLiteral(n.getLiteralValue()); else return new ExecutableAccessor(n, n.getEgressType()); }
sbuf.append("LITERAL :: ").append(tk.getLiteralValue()).append("'");
sbuf.append("LITERAL :: ").append(tk.getLiteralValue()).append("'");
sbuf.append("LITERAL :: ").append(tk.getLiteralValue()).append("'");
private static boolean isReductionOpportunity(ASTNode oper, ASTNode node) { ASTNode n = node; return (n != null && n.isLiteral() && (n = n.nextASTNode) != null && reducacbleOperator(n.getOperator()) && PTABLE[oper.getOperator()] <= PTABLE[n.getOperator()] && (n = n.nextASTNode) != null && n.isLiteral() && n.getLiteralValue() instanceof Number); }
private static boolean isReductionOpportunity(ASTNode oper, ASTNode node) { ASTNode n = node; return (n != null && n.isLiteral() && (n = n.nextASTNode) != null && reducacbleOperator(n.getOperator()) && PTABLE[oper.getOperator()] <= PTABLE[n.getOperator()] && (n = n.nextASTNode) != null && n.isLiteral() && n.getLiteralValue() instanceof Number); }
private static boolean isReductionOpportunity(ASTNode oper, ASTNode node) { ASTNode n = node; return (n != null && n.isLiteral() && (n = n.nextASTNode) != null && reducacbleOperator(n.getOperator()) && PTABLE[oper.getOperator()] <= PTABLE[n.getOperator()] && (n = n.nextASTNode) != null && n.isLiteral() && n.getLiteralValue() instanceof Number); }
if (lastNode.getLiteralValue() instanceof String) { char[] tmp = ((String) lastNode.getLiteralValue()).toCharArray(); TypeDescriptor tDescr = new TypeDescriptor(tmp, 0, tmp.length, 0); if (lastNode.isLiteral() && lastNode.getLiteralValue() instanceof Class) { lastNode.discard(); (Class) lastNode.getLiteralValue(), fields | ASTNode.ASSIGN, pCtx)); lastNode.getLiteralValue(), pCtx)); throw new CompileException("unknown class or illegal statement: " + lastNode.getLiteralValue(), expr, cursor); throw new CompileException("unknown class or illegal statement: " + lastNode.getLiteralValue(), expr, cursor);
if (lastNode.getLiteralValue() instanceof String) { char[] tmp = ((String) lastNode.getLiteralValue()).toCharArray(); TypeDescriptor tDescr = new TypeDescriptor(tmp, 0, tmp.length, 0); if (lastNode.isLiteral() && lastNode.getLiteralValue() instanceof Class) { lastNode.discard(); (Class) lastNode.getLiteralValue(), fields | ASTNode.ASSIGN, pCtx)); lastNode.getLiteralValue(), pCtx)); throw new CompileException("unknown class or illegal statement: " + lastNode.getLiteralValue(), expr, cursor); throw new CompileException("unknown class or illegal statement: " + lastNode.getLiteralValue(), expr, cursor);
if (lastNode.getLiteralValue() instanceof String) { TypeDescriptor tDescr = new TypeDescriptor(((String) lastNode.getLiteralValue()).toCharArray(), 0); if (lastNode.isLiteral() && lastNode.getLiteralValue() instanceof Class) { lastNode.discard(); (Class) lastNode.getLiteralValue(), fields | ASTNode.ASSIGN, pCtx)); lastNode.getLiteralValue(), pCtx)); throw new CompileException("unknown class or illegal statement: " + lastNode.getLiteralValue(), expr, cursor); throw new CompileException("unknown class or illegal statement: " + lastNode.getLiteralValue(), expr, cursor);
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; }
private Condition analyzeCondition(ASTNode node) { boolean isNegated = false; if (node instanceof Negation) { isNegated = true; ExecutableStatement statement = ((Negation)node).getStatement(); if (statement instanceof ExecutableLiteral) { return new FixedValueCondition(!(Boolean)((ExecutableLiteral)statement).getLiteral()); } node = ((ExecutableAccessor)statement).getNode(); } node = analyzeSubstatement(node); if (node instanceof LiteralNode && node.getEgressType() == Boolean.class) { boolean literalValue = (Boolean)node.getLiteralValue(); return new FixedValueCondition(isNegated ? !literalValue : literalValue); } if (node instanceof Negation) { isNegated = !isNegated; node = ((ExecutableAccessor)((Negation)node).getStatement()).getNode(); node = analyzeSubstatement(node); } if (node instanceof And || node instanceof Or) { return analyzeCombinedCondition((BooleanNode)node, isNegated); } return analyzeSingleCondition(node, isNegated); }
return new LiteralNode(tk.getLiteralValue());
return new LiteralNode(tk.getLiteralValue(), pCtx);
return new VariableExpression(variableName, analyzeExpressionNode(accessorNode, node, variableType), variableType); } else { if (node.getLiteralValue() instanceof ParserContext) { ParserContext pCtx = (ParserContext)node.getLiteralValue();
return new LiteralNode(tk.getLiteralValue(), pCtx);