/[pcre]/code/trunk/pcre_compile.c
ViewVC logotype

Diff of /code/trunk/pcre_compile.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1389 by ph10, Tue Nov 5 18:05:29 2013 UTC revision 1392 by ph10, Wed Nov 6 18:00:09 2013 UTC
# Line 532  static const char error_texts[] = Line 532  static const char error_texts[] =
532    "non-octal character in \\o{} (closing brace missing?)\0"    "non-octal character in \\o{} (closing brace missing?)\0"
533    "missing opening brace after \\o\0"    "missing opening brace after \\o\0"
534    "parentheses are too deeply nested\0"    "parentheses are too deeply nested\0"
535      "invalid range in character class\0"
536    ;    ;
537    
538  /* Table to identify digits and hex digits. This is used when compiling  /* Table to identify digits and hex digits. This is used when compiling
# Line 3793  class, but [abc[:x\]pqr:]] is (so that a Line 3794  class, but [abc[:x\]pqr:]] is (so that a
3794  below handles the special case of \], but does not try to do any other escape  below handles the special case of \], but does not try to do any other escape
3795  processing. This makes it different from Perl for cases such as [:l\ower:]  processing. This makes it different from Perl for cases such as [:l\ower:]
3796  where Perl recognizes it as the POSIX class "lower" but PCRE does not recognize  where Perl recognizes it as the POSIX class "lower" but PCRE does not recognize
3797  "l\ower". This is a lesser evil that not diagnosing bad classes when Perl does,  "l\ower". This is a lesser evil than not diagnosing bad classes when Perl does,
3798  I think.  I think.
3799    
3800  A user pointed out that PCRE was rejecting [:a[:digit:]] whereas Perl was not.  A user pointed out that PCRE was rejecting [:a[:digit:]] whereas Perl was not.
# Line 5143  for (;; ptr++) Line 5144  for (;; ptr++)
5144          else          else
5145  #endif  #endif
5146          d = *ptr;  /* Not UTF-8 mode */          d = *ptr;  /* Not UTF-8 mode */
5147    
5148          /* The second part of a range can be a single-character escape, but          /* The second part of a range can be a single-character escape
5149          not any of the other escapes. Perl 5.6 treats a hyphen as a literal          sequence, but not any of the other escapes. Perl treats a hyphen as a
5150          in such circumstances. */          literal in such circumstances. However, in Perl's warning mode, a
5151            warning is given, so PCRE now faults it as it is almost certainly a
5152          if (!inescq && d == CHAR_BACKSLASH)          mistake on the user's part. */
5153            {  
5154            int descape;          if (!inescq)
5155            descape = check_escape(&ptr, &d, errorcodeptr, cd->bracount, options, TRUE);            {
5156            if (*errorcodeptr != 0) goto FAILED;            if (d == CHAR_BACKSLASH)
   
           /* \b is backspace; any other special means the '-' was literal. */  
   
           if (descape != 0)  
5157              {              {
5158              if (descape == ESC_b) d = CHAR_BS; else              int descape;
5159                descape = check_escape(&ptr, &d, errorcodeptr, cd->bracount, options, TRUE);
5160                if (*errorcodeptr != 0) goto FAILED;
5161    
5162                /* 0 means a character was put into d; \b is backspace; any other
5163                special causes an error. */
5164    
5165                if (descape != 0)
5166                {                {
5167                ptr = oldptr;                if (descape == ESC_b) d = CHAR_BS; else
5168                goto CLASS_SINGLE_CHARACTER;  /* A few lines below */                  {
5169                    *errorcodeptr = ERR83;
5170                    goto FAILED;
5171                    }
5172                }                }
5173              }              }
5174            }  
5175              /* A hyphen followed by a POSIX class is treated in the same way. */
5176    
5177              else if (d == CHAR_LEFT_SQUARE_BRACKET &&
5178                       (ptr[1] == CHAR_COLON || ptr[1] == CHAR_DOT ||
5179                        ptr[1] == CHAR_EQUALS_SIGN) &&
5180                       check_posix_syntax(ptr, &tempptr))
5181                {
5182                *errorcodeptr = ERR83;
5183                goto FAILED;
5184                }
5185              }
5186    
5187          /* Check that the two values are in the correct order. Optimize          /* Check that the two values are in the correct order. Optimize
5188          one-character ranges. */          one-character ranges. */

Legend:
Removed from v.1389  
changed lines
  Added in v.1392

  ViewVC Help
Powered by ViewVC 1.1.5