You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xerces.apache.org by am...@apache.org on 2005/06/28 19:43:16 UTC

svn commit: r202254 - /xerces/c/branches/xerces-2.7/src/xercesc/util/regx/ParserForXMLSchema.cpp

Author: amassari
Date: Tue Jun 28 10:43:15 2005
New Revision: 202254

URL: http://svn.apache.org/viewcvs?rev=202254&view=rev
Log:
Schema errata E2-67: allow unescaped '-' at the beginning and end of a regex

Modified:
    xerces/c/branches/xerces-2.7/src/xercesc/util/regx/ParserForXMLSchema.cpp

Modified: xerces/c/branches/xerces-2.7/src/xercesc/util/regx/ParserForXMLSchema.cpp
URL: http://svn.apache.org/viewcvs/xerces/c/branches/xerces-2.7/src/xercesc/util/regx/ParserForXMLSchema.cpp?rev=202254&r1=202253&r2=202254&view=diff
==============================================================================
--- xerces/c/branches/xerces-2.7/src/xercesc/util/regx/ParserForXMLSchema.cpp (original)
+++ xerces/c/branches/xerces-2.7/src/xercesc/util/regx/ParserForXMLSchema.cpp Tue Jun 28 10:43:15 2005
@@ -200,6 +200,14 @@
 
         if (!end) {
 
+            // handle '-' when appearing at the beginning of a positive character group
+            if (firstLoop && !isNRange && type == REGX_T_CHAR && ch == chDash)
+            {
+                tok->addRange(chDash, chDash);
+                firstLoop=false;
+                continue;
+            }
+
             if (type == REGX_T_CHAR
                 && (ch == chOpenSquare
                     || ch == chCloseSquare
@@ -218,8 +226,13 @@
                 if ((type = getState()) == REGX_T_EOF)
                     ThrowXMLwithMemMgr(ParseException,XMLExcepts::Parser_CC2, getMemoryManager());
 
-                if ((type == REGX_T_CHAR && getCharData() == chCloseSquare)
-                    || type == REGX_T_XMLSCHEMA_CC_SUBTRACTION) {
+                // handle '-' when appearing at the end of a positive character group
+                if (!isNRange && type == REGX_T_CHAR && getCharData() == chCloseSquare) {
+                    tok->addRange(ch, ch);
+                    tok->addRange(chDash, chDash);
+                }
+                else if((type == REGX_T_CHAR && getCharData() == chCloseSquare)
+                        || type == REGX_T_XMLSCHEMA_CC_SUBTRACTION) {
 
                     static const XMLCh dashStr[] = { chDash, chNull};
                     ThrowXMLwithMemMgr2(ParseException, XMLExcepts::Parser_CC6, dashStr, dashStr, getMemoryManager());



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