Exposed flags to the regex parser

This commit is contained in:
Napalys
2025-03-02 16:53:18 +01:00
parent 2f2c9f8943
commit cb448db3ce
3 changed files with 13 additions and 3 deletions

View File

@@ -67,6 +67,7 @@ public class RegExpParser {
private List<Error> errors;
private List<BackReference> backrefs;
private int maxbackref;
private String flags;
/** Parse the given string as a regular expression. */
public Result parse(String src) {
@@ -82,6 +83,11 @@ public class RegExpParser {
return new Result(root, errors);
}
public Result parse(String src, String flags) {
this.flags = flags;
return parse(src);
}
private static String fromCodePoint(int codepoint) {
if (Character.isValidCodePoint(codepoint)) return new String(Character.toChars(codepoint));
// replacement character