[jruby-joni] 186/279: Add ALLOW_EMPTY_CC syntax option and enabled for JavaScript

Hideki Yamane henrich at moszumanska.debian.org
Mon Nov 16 11:27:29 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 0bbb057ecef5031b28b5ac59fadcc976ca0becc7
Author: Ben Browning <bbrownin at redhat.com>
Date:   Fri Sep 13 10:47:20 2013 -0400

    Add ALLOW_EMPTY_CC syntax option and enabled for JavaScript
    
    JavaScript allows empty character classes so add that as a
    configurable option in joni.
---
 src/org/joni/Parser.java                     | 2 +-
 src/org/joni/Syntax.java                     | 5 +++++
 src/org/joni/constants/SyntaxProperties.java | 1 +
 3 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/src/org/joni/Parser.java b/src/org/joni/Parser.java
index 4f9764b..95e5618 100644
--- a/src/org/joni/Parser.java
+++ b/src/org/joni/Parser.java
@@ -157,7 +157,7 @@ class Parser extends Lexer {
             neg = false;
         }
 
-        if (token.type == TokenType.CC_CLOSE) {
+        if (token.type == TokenType.CC_CLOSE && !syntax.allowEmptyCC()) {
             if (!codeExistCheck(']', true)) newSyntaxException(ERR_EMPTY_CHAR_CLASS);
             env.ccEscWarn("]");
             token.type = TokenType.CHAR; /* allow []...] */
diff --git a/src/org/joni/Syntax.java b/src/org/joni/Syntax.java
index 4a3a315..4cd349b 100644
--- a/src/org/joni/Syntax.java
+++ b/src/org/joni/Syntax.java
@@ -339,6 +339,10 @@ public final class Syntax implements SyntaxProperties{
     }
 
 
+    public boolean allowEmptyCC() {
+        return isBehavior(ALLOW_EMPTY_CC);
+    }
+
     public boolean notNewlineInNegativeCC() {
         return isBehavior(NOT_NEWLINE_IN_NEGATIVE_CC);
     }
@@ -639,6 +643,7 @@ public final class Syntax implements SyntaxProperties{
         CONTEXT_INDEP_REPEAT_OPS |
         CONTEXT_INVALID_REPEAT_OPS |
         ALLOW_INVALID_INTERVAL |
+        ALLOW_EMPTY_CC |
         BACKSLASH_ESCAPE_IN_CC | 
         ALLOW_DOUBLE_RANGE_OP_IN_CC |
         DIFFERENT_LEN_ALT_LOOK_BEHIND |
diff --git a/src/org/joni/constants/SyntaxProperties.java b/src/org/joni/constants/SyntaxProperties.java
index 9c8f031..4fb159d 100644
--- a/src/org/joni/constants/SyntaxProperties.java
+++ b/src/org/joni/constants/SyntaxProperties.java
@@ -93,6 +93,7 @@ public interface SyntaxProperties {
     final int IGNORE_BACKREF_PREC_READ_NOT    = (1<<11); /* /(?!(a+)b\2c)\2 */
 
     /* syntax (behavior); in char class [...] */
+    final int ALLOW_EMPTY_CC                  = (1<<19); /* [] */
     final int NOT_NEWLINE_IN_NEGATIVE_CC      = (1<<20); /* [^...] */
     final int BACKSLASH_ESCAPE_IN_CC          = (1<<21); /* [..\w..] etc.. */
     final int ALLOW_EMPTY_RANGE_IN_CC         = (1<<22);

-- 
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