Package org.mvel2.util

Examples of org.mvel2.util.ASTLinkedList


  private static final class DecompileContext {
    public int node = 0;
  }

  private static String decompile(CompiledExpression cExp, boolean nest, DecompileContext context) {
    ASTIterator iter = new ASTLinkedList(cExp.getFirstNode());
    ASTNode tk;

    StringBuffer sbuf = new StringBuffer();

    if (!nest) {
      sbuf.append("Expression Decompile\n-------------\n");
    }

    while (iter.hasMoreNodes()) {
      sbuf.append("(").append(context.node++).append(") ");

      if ((tk = iter.nextNode()) instanceof NestedStatement
          && ((NestedStatement) tk).getNestedStatement() instanceof CompiledExpression) {
        //noinspection StringConcatenationInsideStringBufferAppend
        sbuf.append("NEST [" + tk.getClass().getSimpleName() + "]: { " + tk.getName() + " }\n");
        sbuf.append(decompile((CompiledExpression) ((NestedStatement) tk).getNestedStatement(), true, context));
      }
View Full Code Here


    return "UNKNOWN_OPERATOR";
  }

  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;
View Full Code Here

  private static final class DecompileContext {
    public int node = 0;
  }

  private static String decompile(CompiledExpression cExp, boolean nest, DecompileContext context) {
    ASTIterator iter = new ASTLinkedList(cExp.getFirstNode());
    ASTNode tk;

    StringBuffer sbuf = new StringBuffer();

    if (!nest) {
      sbuf.append("Expression Decompile\n-------------\n");
    }

    while (iter.hasMoreNodes()) {
      sbuf.append("(").append(context.node++).append(") ");

      if ((tk = iter.nextNode()) instanceof NestedStatement
          && ((NestedStatement) tk).getNestedStatement() instanceof CompiledExpression) {
        //noinspection StringConcatenationInsideStringBufferAppend
        sbuf.append("NEST [" + tk.getClass().getSimpleName() + "]: { " + tk.getName() + " }\n");
        sbuf.append(decompile((CompiledExpression) ((NestedStatement) tk).getNestedStatement(), true, context));
      }
View Full Code Here

    return "UNKNOWN_OPERATOR";
  }

  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;
View Full Code Here

        }
        return node instanceof BinaryOperation ? ((BinaryOperation)node).getLeft().getAccessor() != null : node.getAccessor() != null;
    }

    private CompiledExpression asCompiledExpression(ASTNode node) {
        return new CompiledExpression(new ASTLinkedList(node), null, Object.class, parserContext, false);
    }
View Full Code Here

        }
        return node instanceof BinaryOperation ? ((BooleanNode) node).getLeft().getAccessor() != null : node.getAccessor() != null;
    }

    private CompiledExpression asCompiledExpression(ASTNode node) {
        return new CompiledExpression(new ASTLinkedList(node), null, Object.class, parserConfiguration, false);
    }
View Full Code Here

        }
        return node instanceof BinaryOperation ? ((BooleanNode) node).getLeft().getAccessor() != null : node.getAccessor() != null;
    }

    private CompiledExpression asCompiledExpression(ASTNode node) {
        return new CompiledExpression(new ASTLinkedList(node), null, Object.class, parserConfiguration, false);
    }
View Full Code Here

    private boolean isEvaluated(ASTNode node) {
        return node instanceof BinaryOperation ? ((BinaryOperation)node).getLeft().getAccessor() != null : node.getAccessor() != null;
    }

    private CompiledExpression asCompiledExpression(ASTNode node) {
        return new CompiledExpression(new ASTLinkedList(node), null, Object.class, parserContext, false);
    }
View Full Code Here

        }
        return node instanceof BinaryOperation ? ((BooleanNode) node).getLeft().getAccessor() != null : node.getAccessor() != null;
    }

    private CompiledExpression asCompiledExpression(ASTNode node) {
        return new CompiledExpression(new ASTLinkedList(node), null, Object.class, parserConfiguration, false);
    }
View Full Code Here

        String[] allVars = new String[varNames.length + locals.length];

        System.arraycopy(varNames, 0, allVars, 0, varNames.length);
        System.arraycopy(locals, 0, allVars, varNames.length, locals.length);       
       
        this.varModel = new SimpleVariableSpaceModel(allVars);
        this.allVarsLength = allVars.length;
       
        return stmt;
    }
View Full Code Here

TOP

Related Classes of org.mvel2.util.ASTLinkedList

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.