Class AllTransitionsInOneTreeMatcher

java.lang.Object
com.oracle.truffle.regex.tregex.nodes.dfa.Matchers
com.oracle.truffle.regex.tregex.nodes.dfa.AllTransitionsInOneTreeMatcher

public final class AllTransitionsInOneTreeMatcher extends Matchers
This class provides an alternative way of calculating the next transition - instead of checking all transitions in sequential manner, all ranges of all transitions are merged into one sorted array, which is then searched in tree-recursive fashion.
See Also:
  • Constructor Details

    • AllTransitionsInOneTreeMatcher

      public AllTransitionsInOneTreeMatcher(int[] ranges, short[] successors, AllTransitionsInOneTreeMatcher.AllTransitionsInOneTreeLeafMatcher[] leafMatchers)
      Parameters:
      ranges - a sorted list of adjacent character ranges, in the following format: Every character in the array simultaneously represents the inclusive lower bound of a range and the exclusive upper bound of a range. The algorithm adds an implicit zero at the begin and an implicit Constants.MAX_CODE_POINT + 1 at the end of the array. An array representing the ranges [0x00-0x10][0x10-0xff][0xff-0x2000][0x2000-0x10ffff] (represented with exclusive upper bound) would be: [0x10, 0xff, 0x2000].
      successors - the list of successors corresponding to every range in the sorted list of ranges. Every entry in this array is an index of DFAAbstractStateNode.getSuccessors(), or a negative index. A negative index can mean one of two things: -1 denotes "no successor", indices below -1 denote leaf matchers. These specialized matchers are used when many ranges lie in the same lower byte range, i.e. all bytes of their numerical values except the lowest one are equal (e.g. [0x2020-0x2021][0x2030-0x2031]...).
  • Method Details

    • checkMatchTree

      public int checkMatchTree(int c)
    • toString

      public String toString()
      Overrides:
      toString in class Object