|
105 | 105 | import com.oracle.graal.python.nodes.util.CastToTruffleStringNode; |
106 | 106 | import com.oracle.graal.python.runtime.IndirectCallData.InteropCallData; |
107 | 107 | import com.oracle.graal.python.runtime.PythonContext; |
108 | | -import com.oracle.graal.python.runtime.PythonOptions; |
109 | 108 | import com.oracle.graal.python.runtime.exception.PException; |
110 | 109 | import com.oracle.graal.python.runtime.exception.PythonErrorType; |
111 | 110 | import com.oracle.graal.python.runtime.formatting.ErrorMessageFormatter; |
@@ -160,8 +159,6 @@ protected List<? extends NodeFactory<? extends PythonBuiltinBaseNode>> getNodeFa |
160 | 159 |
|
161 | 160 | @Override |
162 | 161 | public void initialize(Python3Core core) { |
163 | | - addBuiltinConstant("_with_tregex", core.getContext().getLanguage().getEngineOption(PythonOptions.WithTRegex)); |
164 | | - addBuiltinConstant("_with_sre", core.getContext().getLanguage().getEngineOption(PythonOptions.TRegexUsesSREFallback)); |
165 | 162 | addBuiltinConstant("_METHOD_SEARCH", PythonMethod.Search); |
166 | 163 | addBuiltinConstant("_METHOD_MATCH", PythonMethod.Match); |
167 | 164 | addBuiltinConstant("_METHOD_FULLMATCH", PythonMethod.FullMatch); |
@@ -524,7 +521,7 @@ static TRegexCache getTRegexCache(Node inliningTarget, PythonObject pattern, Hid |
524 | 521 |
|
525 | 522 | @GenerateCached |
526 | 523 | @ImportStatic(PythonMethod.class) |
527 | | - @SuppressWarnings("truffle-inlining") // TODO |
| 524 | + @SuppressWarnings("truffle-inlining") |
528 | 525 | abstract static class TRegexCompileInner extends PNodeWithContext { |
529 | 526 |
|
530 | 527 | private static final TruffleString T__GETLOCALE = tsLiteral("_getlocale"); |
@@ -949,8 +946,8 @@ static Object doCached(VirtualFrame frame, PythonObject pattern, Object input, i |
949 | 946 | Object compiledRegex = tRegexCompile.execute(frame, tRegexCache, PythonMethod.Search, false); |
950 | 947 | Object compiledRegexMustAdvance = tRegexCompile.execute(frame, tRegexCache, PythonMethod.Search, true); |
951 | 948 | if (compiledRegex == PNone.NONE || compiledRegexMustAdvance == PNone.NONE) { |
952 | | - // TODO: Fallback |
953 | | - throw CompilerDirectives.shouldNotReachHere(); |
| 949 | + CompilerDirectives.transferToInterpreterAndInvalidate(); |
| 950 | + throw CompilerDirectives.shouldNotReachHere("unsupported regular expression: /" + tRegexCache.pattern + "/" + tRegexCache.flags); |
954 | 951 | } |
955 | 952 | checkInputTypeNode.execute(frame, input, tRegexCache.binary); |
956 | 953 | int groupCount = TRegexUtil.TRegexCompiledRegexAccessor.groupCount(compiledRegex, inliningTarget, readGroupCountNode); |
@@ -1134,8 +1131,8 @@ private static Object doSubn(VirtualFrame frame, PythonObject pattern, Object re |
1134 | 1131 | Object compiledRegex = tRegexCompile.execute(frame, tRegexCache, PythonMethod.Search, false); |
1135 | 1132 | Object compiledRegexMustAdvance = tRegexCompile.execute(frame, tRegexCache, PythonMethod.Search, true); |
1136 | 1133 | if (compiledRegex == PNone.NONE || compiledRegexMustAdvance == PNone.NONE) { |
1137 | | - // TODO: Fallback |
1138 | | - throw CompilerDirectives.shouldNotReachHere(); |
| 1134 | + CompilerDirectives.transferToInterpreterAndInvalidate(); |
| 1135 | + throw CompilerDirectives.shouldNotReachHere("unsupported regular expression: /" + tRegexCache.pattern + "/" + tRegexCache.flags); |
1139 | 1136 | } |
1140 | 1137 | checkInputTypeNode.execute(frame, input, tRegexCache.binary); |
1141 | 1138 | return innerNode1.execute(inliningTarget, frame, pattern, compiledRegex, compiledRegexMustAdvance, replacement, input, count, tRegexCache.binary, |
|
0 commit comments