Class OracleDBCharClassTrieNode

java.lang.Object
com.oracle.truffle.regex.tregex.parser.flavors.OracleDBCharClassTrieNode

public final class OracleDBCharClassTrieNode extends Object
This class implements an intermediate Prefix-Tree used to simulate the behavior of OracleDB on character classes in ignore-case mode. Every path from the tree's root to a node with isEndOfString represents a string contained in the character class, i.e. the following exemplary tree contains strings ["a", "b", "cd", "ce", "af", "bf"]:
 {_root node_}
 |           \__________
 |                      \ 
 {codepoints: [a,b],     {codepoints: [c],
  endOfString: true}      endOfString: false}
  |                       |
  |                       |
 {codepoints: [f],       {codepoints: [d, e],
  endOfString: true}      endOfString: true}
 
New strings are added in the order they are encountered in the parser, which is important to correctly mimic OracleDB's behavior.
  • Method Details

    • createTreeRoot

      public static OracleDBCharClassTrieNode createTreeRoot()
    • getOrAddChildren

      public ArrayList<OracleDBCharClassTrieNode> getOrAddChildren(CodePointSet cps, boolean endOfString, CompilationBuffer compilationBuffer)
      Add a new set of codepoints as children of this node. Since the set of codepoints may intersect with existing child nodes, this method may return an arbitrary amount of new or existing child nodes.
    • isEndOfString

      public boolean isEndOfString()
    • setEndOfString

      public void setEndOfString()
    • clear

      public void clear()
    • generateAST

      public void generateAST(RegexASTBuilder astBuilder, boolean negate)