Examples of Rx


Examples of com.redcareditor.onig.Rx

    trySettingProperty(propertyName, value);
  }

  public void loadRegexProperty(String propertyName) {
    String value = dict.getString(propertyName);
    Rx regex = Rx.createRx(value);
    trySettingProperty(propertyName, regex);
  }
View Full Code Here

Examples of com.redcareditor.onig.Rx

  // Sets the grammar by examining the first line. If unable to find
  // a grammar, sets the grammar to null. Returns the grammar
  // name or null.
  public String setGrammarByFirstLine(String firstLine) {
    Rx re;
    for (Bundle bundle : Bundle.getBundles()) {
      for (Grammar grammar : bundle.getGrammars()) {
        re = grammar.firstLineMatch;
        if (re instanceof NullRx) {
        } else {
          if (re.search(firstLine, 0, (int) firstLine.length()) != null) {
            setGrammarByName(grammar.name);
            return grammar.name;
          }
        }
      }
View Full Code Here

Examples of com.redcareditor.onig.Rx

  @Benchmark(times = 1000)
  public void benchmarkAllPatternsOnSingleLine() {
    String line = lines.get(8); // this line has a class definition on it
    for (SinglePattern p : singlePatterns) {
      Rx regex = p.match;
      Match m = regex.search(line);
            // if(m != null){
            //  System.out.println(p.name);
            //  System.out.println(m);
            // }
    }
View Full Code Here

Examples of com.redcareditor.onig.Rx

  @Benchmark(times = 500)
  public void benchmarkAllPatternsOnFile() {
    for(String line : lines){
      for (SinglePattern p : singlePatterns) {
        Rx regex = p.match;
        Match m = regex.search(line);
      }
    }
  }
View Full Code Here

Examples of com.redcareditor.onig.Rx

    if (position > MAX_LINE_LENGTH)
      return null;
    Marker bestMarker = null;
    int newLength;
    boolean isCloseMatch = false;
    Rx closingRegex = currentScope.closingRegex;
    if (closingRegex != null && closingRegex.usable()) {
      //logger.info(String.format("closing regex: '%s'", closingRegex.pattern));
      Match match = closingRegex.search(this.line, this.position, this.lineLength);
      if (match != null &&
             !(match.getCapture(0).start == currentScope.getStart().getLineOffset() &&
               currentScope.getStart().getLine() == this.lineIx)
          ) {
        //logger.info(String.format("closing match: %s (%d-%d)", this.currentScope.name, match.getCapture(0).start, match.getCapture(0).end));
View Full Code Here

Examples of com.redcareditor.onig.Rx

  public Rx makeClosingRegex(String line, Scope scope, Marker m) {
    if (m.pattern instanceof DoublePattern && !m.isCloseScope) {
      DoublePattern dp = (DoublePattern) m.pattern;
      // System.out.printf("making closing regex: %s\n", dp.endString);
      Rx rx = Rx.createRx("\\\\(\\d+)");
      Match match;
      int pos = 0;
      StringBuilder src = new StringBuilder("");
      boolean found = false;
      while ((match = rx.search(dp.endString, pos, (int) dp.endString.length())) != null) {
        found = true;
        src.append(dp.endString.substring(pos, match.getCapture(0).start));
        String numstr = dp.endString.substring(match.getCapture(1).start, match.getCapture(1).end);
        int num = Integer.parseInt(numstr);
        // System.out.printf("capture found: %d\n", num);
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.