Examples of ParserState


Examples of net.sf.jmatchparser.template.engine.ParserState

      success = m.find();
      if (!success)
        break;
      if (m.start() != 0)
        throw new RuntimeException();
      ParserState newState = new ParserState(state, nextInstruction.getDestination());
      parameter.applyMatch(newState, m);
      newState.discardCharacters(m.end());
      enqueued = true;
      state.getParser().enqueueState(newState);
      rest = rest.subSequence(0, m.end() - 1);
    }
    if (enqueued) {
View Full Code Here

Examples of net.sf.jmatchparser.template.engine.ParserState

    this.die = die;
  }

  @Override
  public OperationResult execute(ParserState state) {
    state.getParser().enqueueState(new ParserState(state, forkLabel.getDestination()));
    if (die)
      return OperationResult.DIE;
    return OperationResult.CONTINUE;
  }
View Full Code Here

Examples of net.sf.jmatchparser.template.engine.ParserState

      min = tmp;
    }
    int counter = co.getCounter();
    if (counter < max) {
      // fork inside the loop
      state.getParser().enqueueState(new ParserState(state, label.getDestination()));
    }
    if (counter < min) {
      return OperationResult.DIE;
    }
    return OperationResult.CONTINUE;
View Full Code Here

Examples of net.sf.jmatchparser.template.engine.ParserState

  private String[] build(String expression, int minparamcount, int maxparamcount, int noCommaCount) {
    try {
      Parameter[] params = Parameter.parseParameters(expression, minparamcount, maxparamcount, noCommaCount, SPECIAL_TAGS);
      String[] result = new String[params.length];
      ParserState state = newParserState();
      for (int i = 0; i < params.length; i++) {
        if (params[i] != null) {
          result[i] = params[i].getString(state);
        }
      }
View Full Code Here

Examples of net.sf.jmatchparser.template.engine.ParserState

    }
  }

  private TagParseResult doTestParsing(String expression, String text) {
    try {
      ParserState state = newParserState();
      Parameter param = Parameter.parseParameter(expression, SPECIAL_TAGS);
      Matcher m = PatternCache.compile(param.getRegex(state)).matcher(text);
      Assert.assertTrue("Text does not match expression", m.matches());
      param.applyMatch(state, m);
      return buildResult(state);
View Full Code Here

Examples of net.sf.jmatchparser.template.engine.ParserState

    try {
      ParserImpl pi = new ParserImpl(new PlainMatchTemplateImpl(null, "<empty>", new BufferedReader(new StringReader("")), new Formatter[0]));
      Constructor<Parser> c = Parser.class.getDeclaredConstructor(ParserImpl.class);
      c.setAccessible(true);
      c.newInstance(pi).parse("", "x");
      ParserState objState = new ParserState(pi);
      objState.setLocal("answer", "42");
      objState.setLocal("secret", "no");
      objState.setLocal("indirect", "answer");
      objState.setLocal("fish", "<>&<");
      return objState;
    } catch (RuntimeException ex) {
      throw ex;
    } catch (Exception ex) {
      throw new RuntimeException(ex);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.