-
Notifications
You must be signed in to change notification settings - Fork 93
Add support for ASCII/Unicode modifiers #13
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
I started filling in the missing group flags but did not get everything in place. My work is in ac5ed3b. I tracked the 'a' flag back to this commit in Onigmo:k-takata/Onigmo@52b242c Ping @lopex! Untested, incomplete diff that starts to fill in more blanks: diff --git a/src/org/joni/Analyser.java b/src/org/joni/Analyser.java
index 6a4e418..9682d95 100644
--- a/src/org/joni/Analyser.java
+++ b/src/org/joni/Analyser.java
@@ -51,6 +51,7 @@ import org.joni.ast.StringNode;
import org.joni.constants.AnchorType;
import org.joni.constants.EncloseType;
import org.joni.constants.NodeType;
+import org.joni.constants.OPCode;
import org.joni.constants.StackPopLevel;
import org.joni.constants.TargetInfo;
@@ -2100,6 +2101,38 @@ final class Analyser extends Parser {
opt.anchor.add(an.type);
break;
+ case AnchorType.WORD_BOUND:
+ if (an.asciiRange) {
+ opt.anchor.add(OPCode.ASCII_WORD_BOUND);
+ } else {
+ opt.anchor.add(OPCode.WORD_BOUND);
+ }
+ break;
+
+ case AnchorType.NOT_WORD_BOUND:
+ if (an.asciiRange) {
+ opt.anchor.add(OPCode.NOT_ASCII_WORD_BOUND);
+ } else {
+ opt.anchor.add(OPCode.NOT_WORD_BOUND);
+ }
+ break;
+
+ case AnchorType.WORD_BEGIN:
+ if (an.asciiRange) {
+ opt.anchor.add(OPCode.ASCII_WORD_BEGIN);
+ } else {
+ opt.anchor.add(OPCode.WORD_BEGIN);
+ }
+ break;
+
+ case AnchorType.WORD_END:
+ if (an.asciiRange) {
+ opt.anchor.add(OPCode.ASCII_WORD_END);
+ } else {
+ opt.anchor.add(OPCode.WORD_END);
+ }
+ break;
+
case AnchorType.PREC_READ:
NodeOptInfo nopt = new NodeOptInfo();
optimizeNodeLeft(an.target, nopt, oenv); |
@headius, this is going to be a tough one. This and dependent features were plagued by bugs across many commits. Now picking related ones, it's going to be a multi day effort (already have some code ported). |
This JRuby spec https://github.com/jruby/jruby/blob/master/spec/ruby/language/regexp/modifiers_spec.rb#L103-L108 is tagged https://github.com/jruby/jruby/blob/master/spec/tags/ruby/language/regexp/modifiers_tags.txt#L1 because Joni doesn't yet have support for ASCII/Unicode modifiers. Onigmo commit: https://github.com/k-takata/Onigmo/blob/master/regparse.c#L5170.
The text was updated successfully, but these errors were encountered: