You are viewing a plain text version of this content. The canonical link for it is here.
Posted to j-users@xerces.apache.org by Khaled Noaman <kn...@ca.ibm.com> on 2003/03/04 17:11:05 UTC

Patch for bug 17414

Hi,

I am a active committer for the Xerces-C++ parser. As a change of pace,
I started working on the Xerces-J parser, and look forward to being an
active contributor.

I am enclosing a patch for bug 17414, and would appreciate if such
changes are committed to the CVS repository.

Regards,
Khaled

----------- Patch Start -----------

---
D:\cvswork\xml-xerces\java\src\org\apache\xerces\impl\xpath\regex\RegexParser.java
2002-08-26 13:55:06.000000000 -0400
+++ RegexParser.java 2003-02-26 16:21:46.000000000 -0500
@@ -793,45 +793,23 @@
     }

     protected RangeToken processBacksolidus_pP(int c) throws
ParseException {
-        boolean positive = c == 'p';
-        this.next();
-        if (this.read() != T_CHAR)  throw this.ex("parser.atom.2",
this.offset-1);
-        RangeToken tok;
-        switch (this.chardata) {
-          case 'L':                             // Letter
-            tok = Token.getRange("L", positive);  break;
-          case 'M':                             // Mark
-            tok = Token.getRange("M", positive);  break;
-          case 'N':                             // Number
-            tok = Token.getRange("N", positive);  break;
-          case 'Z':                             // Separator
-            tok = Token.getRange("Z", positive);  break;
-          case 'C':                             // Other
-            tok = Token.getRange("C", positive);  break;
-          case 'P':                             // Punctuation
-            tok = Token.getRange("P", positive);  break;
-          case 'S':                             // Symbol
-            tok = Token.getRange("S", positive);  break;
-          case '{':
-            // this.offset points the next of '{'.
-            //pstart = this.offset;
-            int namestart = this.offset;
-            int nameend = this.regex.indexOf('}', namestart);
-            if (nameend < 0)  throw this.ex("parser.atom.3",
this.offset);
-            String pname = this.regex.substring(namestart, nameend);
-            this.offset = nameend+1;
-            tok = Token.getRange(pname, positive,
-
this.isSet(RegularExpression.XMLSCHEMA_MODE));
-            /*
-              if (this.isSet(RegularExpression.IGNORE_CASE))
-              tok = RangeToken.createCaseInsensitiveToken(tok);
-            */
-            break;

-          default:
+        this.next();
+        if (this.read() != T_CHAR || this.chardata != '{')
             throw this.ex("parser.atom.2", this.offset-1);
-        }
-        return tok;
+
+        // handle category escape
+        boolean positive = c == 'p';
+        int namestart = this.offset;
+        int nameend = this.regex.indexOf('}', namestart);
+
+        if (nameend < 0)
+            throw this.ex("parser.atom.3", this.offset);
+
+        String pname = this.regex.substring(namestart, nameend);
+        this.offset = nameend+1;
+
+        return Token.getRange(pname, positive,
this.isSet(RegularExpression.XMLSCHEMA_MODE));
     }

     int processCIinCharacterClass(RangeToken tok, int c) {



---
d:\cvswork\xml-xerces\java\src\org\apache\xerces\impl\xpath\regex\message.properties
2001-10-25 17:36:02.000000000 -0400
+++ message.properties 2003-03-03 16:52:10.000000000 -0500
@@ -11,7 +11,7 @@
 parser.factor.5=A back reference or an anchor or a lookahead or a
lookbehind is expected in a conditional pattern.
 parser.factor.6=There are more than three choises in a conditional
group.
 parser.atom.1=A character in U+0040-U+005f must follow \\c.
-parser.atom.2=A Category character or '{' is required.
+parser.atom.2=A '{' is required before a character category.
 parser.atom.3=A property name is not closed by '}'.
 parser.atom.4=Unexpected meta character.
 parser.atom.5=Unknown property.

----------- Patch End -----------



---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-j-user-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-j-user-help@xml.apache.org