Skip to content

Commit

Permalink
[GR-54824] TRegex: fix OracleDB base case fold table.
Browse files Browse the repository at this point in the history
PullRequest: graal/18073
  • Loading branch information
djoooooe committed Jun 19, 2024
2 parents 65d8848 + 32634a9 commit 895eb28
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -1370,6 +1370,9 @@ public void generatedTests() {
test("[\ua762-\ua78d]", "i", "\ua7ae", 0, false);
test("[\u1f1d-\ua7ab]", "i", "\u2c63", 0, false);
test("[\u10b1-\u1cac]", "i", "\u1f04", 0, false);
test("($)*\\s*", "m", "\n ", 0, true, 0, 0, 0, 0);
test("$*\\s*", "m", "\n ", 0, true, 0, 0);
test("(^|(|a))b\\z", "", "b", 0, true, 0, 1, 0, 0, -1, -1);
test("(a{1100,1100})\\1", "i", "a".repeat(2400), 0, true, 0, 2200, 0, 1100);

/* GENERATED CODE END - KEEP THIS MARKER FOR AUTOMATIC UPDATES */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@
import com.oracle.truffle.regex.tregex.parser.Counter;
import com.oracle.truffle.regex.tregex.parser.RegexProperties;
import com.oracle.truffle.regex.tregex.parser.ast.CharacterClass;
import com.oracle.truffle.regex.tregex.parser.ast.Group;
import com.oracle.truffle.regex.tregex.parser.ast.GroupBoundaries;
import com.oracle.truffle.regex.tregex.parser.ast.RegexAST;
import com.oracle.truffle.regex.tregex.parser.ast.RegexASTNode;
Expand Down Expand Up @@ -591,8 +592,13 @@ private DFAStateNodeBuilder createState(TransitionSet<NFA, NFAState, NFAStateTra

private void optimizeDFA() {
RegexProperties props = nfa.getAst().getProperties();
Group root = nfa.getAst().getRoot();

doSimpleCG = (isForward() || !nfa.getAst().getProperties().hasQuantifiers() && !nfa.getAst().getProperties().hasEmptyCaptureGroups()) &&
boolean doSimpleCGBackward = !props.hasQuantifiers() && !props.hasEmptyCaptureGroups() &&
(!root.hasCaret() || root.startsWithCaret()) &&
(!root.hasDollar() || root.endsWithDollar());

doSimpleCG = (isForward() || doSimpleCGBackward) &&
!isBooleanMatch() &&
executorProps.isAllowSimpleCG() &&
!hasAmbiguousStates &&
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1932,6 +1932,7 @@ public void appendRangesTo(RangesBuffer buffer, int startIndex, int endIndex) {
0x00ff10, 0x00ff19, INTEGER_OFFSET, -65248,
0x00ff21, 0x00ff3a, INTEGER_OFFSET, -65216,
0x00ff41, 0x00ff5a, INTEGER_OFFSET, -65248,
0x010400, 0x010425, INTEGER_OFFSET, 40,
});
public static final CodePointSet FOLDABLE_CHARACTERS = rangeSet(0x000041, 0x00005a, 0x0000b5, 0x0000b5, 0x0000c0, 0x0000d6, 0x0000d8, 0x0000de, 0x000100, 0x000100, 0x000102, 0x000102, 0x000104,
0x000104, 0x000106, 0x000106, 0x000108, 0x000108, 0x00010a, 0x00010a, 0x00010c, 0x00010c, 0x00010e, 0x00010e, 0x000110, 0x000110, 0x000112, 0x000112, 0x000114, 0x000114, 0x000116,
Expand Down

0 comments on commit 895eb28

Please sign in to comment.