[jruby-joni] 197/223: Add isAsciiRange flag
Hideki Yamane
henrich at moszumanska.debian.org
Mon Nov 16 11:22:11 UTC 2015
This is an automated email from the git hooks/post-receive script.
henrich pushed a commit to branch debian/sid
in repository jruby-joni.
commit f189a9aeb4c9f9e31f1affabedc47f54afe487f0
Author: Marcin Mielzynski <lopx at gazeta.pl>
Date: Tue Apr 7 21:26:18 2015 +0200
Add isAsciiRange flag
---
src/org/joni/Lexer.java | 21 +++++++++++++++++----
src/org/joni/Parser.java | 2 +-
src/org/joni/ast/AnchorNode.java | 4 +++-
src/org/joni/ast/CTypeNode.java | 9 ++++++---
4 files changed, 27 insertions(+), 9 deletions(-)
diff --git a/src/org/joni/Lexer.java b/src/org/joni/Lexer.java
index 695e833..33b5d88 100644
--- a/src/org/joni/Lexer.java
+++ b/src/org/joni/Lexer.java
@@ -19,6 +19,7 @@
*/
package org.joni;
+import static org.joni.Option.isAsciiRange;
import static org.joni.Option.isSingleline;
import static org.joni.ast.QuantifierNode.isRepeatInfinite;
@@ -1029,16 +1030,28 @@ class Lexer extends ScannerSupport {
if (syntax.opEscWWord()) fetchTokenInCCFor_charType(true, Config.NON_UNICODE_SDW ? CharacterType.W : CharacterType.WORD);
break;
case 'b':
- if (syntax.opEscBWordBound()) fetchTokenFor_anchor(AnchorType.WORD_BOUND);
+ if (syntax.opEscBWordBound()) {
+ fetchTokenFor_anchor(AnchorType.WORD_BOUND);
+ token.setAnchorASCIIRange(isAsciiRange(env.option));
+ }
break;
case 'B':
- if (syntax.opEscBWordBound()) fetchTokenFor_anchor(AnchorType.NOT_WORD_BOUND);
+ if (syntax.opEscBWordBound()) {
+ fetchTokenFor_anchor(AnchorType.NOT_WORD_BOUND);
+ token.setAnchorASCIIRange(isAsciiRange(env.option));
+ }
break;
case '<':
- if (Config.USE_WORD_BEGIN_END && syntax.opEscLtGtWordBeginEnd()) fetchTokenFor_anchor(AnchorType.WORD_BEGIN);
+ if (Config.USE_WORD_BEGIN_END && syntax.opEscLtGtWordBeginEnd()) {
+ fetchTokenFor_anchor(AnchorType.WORD_BEGIN);
+ token.setAnchorASCIIRange(isAsciiRange(env.option));
+ }
break;
case '>':
- if (Config.USE_WORD_BEGIN_END && syntax.opEscLtGtWordBeginEnd()) fetchTokenFor_anchor(AnchorType.WORD_END);
+ if (Config.USE_WORD_BEGIN_END && syntax.opEscLtGtWordBeginEnd()) {
+ fetchTokenFor_anchor(AnchorType.WORD_END);
+ token.setAnchorASCIIRange(isAsciiRange(env.option));
+ }
break;
case 's':
if (syntax.opEscSWhiteSpace()) fetchTokenInCCFor_charType(false, Config.NON_UNICODE_SDW ? CharacterType.S : CharacterType.SPACE);
diff --git a/src/org/joni/Parser.java b/src/org/joni/Parser.java
index 1d49e37..39bf422 100644
--- a/src/org/joni/Parser.java
+++ b/src/org/joni/Parser.java
@@ -769,7 +769,7 @@ class Parser extends Lexer {
break;
case CharacterType.WORD:
- node = new CTypeNode(token.getPropCType(), token.getPropNot());
+ node = new CTypeNode(token.getPropCType(), token.getPropNot(), false);
break;
case CharacterType.SPACE:
diff --git a/src/org/joni/ast/AnchorNode.java b/src/org/joni/ast/AnchorNode.java
index 988d994..1000083 100644
--- a/src/org/joni/ast/AnchorNode.java
+++ b/src/org/joni/ast/AnchorNode.java
@@ -22,7 +22,8 @@ package org.joni.ast;
import org.joni.constants.AnchorType;
public final class AnchorNode extends Node implements AnchorType {
- public int type;
+ public final int type;
+ public boolean asciiRange;
public Node target;
public int charLength;
@@ -60,6 +61,7 @@ public final class AnchorNode extends Node implements AnchorType {
public String toString(int level) {
StringBuilder value = new StringBuilder();
value.append("\n type: " + typeToString());
+ value.append("\n ascii: " + asciiRange);
value.append("\n target: " + pad(target, level + 1));
return value.toString();
}
diff --git a/src/org/joni/ast/CTypeNode.java b/src/org/joni/ast/CTypeNode.java
index 017ce54..0472e9a 100644
--- a/src/org/joni/ast/CTypeNode.java
+++ b/src/org/joni/ast/CTypeNode.java
@@ -20,12 +20,14 @@
package org.joni.ast;
public final class CTypeNode extends Node {
- public int ctype;
- public boolean not;
+ public final int ctype;
+ public final boolean not;
+ public final boolean asciiRange;
- public CTypeNode(int type, boolean not) {
+ public CTypeNode(int type, boolean not, boolean asciiRange) {
this.ctype= type;
this.not = not;
+ this.asciiRange = asciiRange;
}
@Override
@@ -43,6 +45,7 @@ public final class CTypeNode extends Node {
StringBuilder value = new StringBuilder();
value.append("\n ctype: " + ctype);
value.append("\n not: " + not);
+ value.append("\n ascii: " + asciiRange);
return value.toString();
}
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-java/jruby-joni.git
More information about the pkg-java-commits
mailing list