Package net.sf.jmatchparser.template.engine.operation

Examples of net.sf.jmatchparser.template.engine.operation.Operation


    while (queuedStates.size() > 0) {
      ParserState current = queuedStates.remove(0);
      OperationResult opres = OperationResult.CONTINUE;
      while (opres == OperationResult.CONTINUE) {
        int ip = current.getNextInstructionAndIncrement();
        Operation op = template.getOperation(ip);
        try {
          opres = op.execute(current);
        } catch (RuntimeException ex) {
          throw new RuntimeException("Cannot execute operation at template position:\n\t" + op.getTemplatePosition(), ex);
        }
        if (opres == null)
          throw new RuntimeException(op.getClass().toString() + " returned invalid operation result");
        switch (opres) {
        case CONTINUE:
          // everything fine
          break;
        case NEXTPASS:
          lastFailOffset = -1;
          lastFailTemplatePositions.clear();
          sideEffectBlockedTemplatePositions.clear();
          opres = OperationResult.CONTINUE;
          break;
        case DIE:
          if (queuedStates.size() == 0)
            throw new RuntimeException("Last state died");
          break;
        case FAIL_BLOCKED:
          sideEffectBlockedTemplatePositions.add(op.getTemplatePosition());
          // fall through
        case FAIL:
          if (current.getOffset() > lastFailOffset) {
            lastFailOffset = current.getOffset();
            lastFailTemplatePositions.clear();
          }
          if (current.getOffset() == lastFailOffset) {
            String cmd = op.getTemplatePosition();
            if (!lastFailTemplatePositions.contains(cmd)) {
              lastFailTemplatePositions.add(cmd);
            }
          }
          break;
View Full Code Here


  public List<String> getIncludedTemplateFileNames() {
    return includedTemplateFileNames;
  }

  public void nopOperation(int position) {
    Operation op = operations.get(position);
    operations.set(position, new NopOperation(op.getTemplatePosition()));
  }
View Full Code Here

TOP

Related Classes of net.sf.jmatchparser.template.engine.operation.Operation

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.