/[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 733 by ph10, Tue Oct 11 10:29:36 2011 UTC revision 744 by zherczeg, Sun Nov 13 16:31:38 2011 UTC
# Line 676  else Line 676  else
676    
677      case CHAR_l:      case CHAR_l:
678      case CHAR_L:      case CHAR_L:
679        *errorcodeptr = ERR37;
680        break;
681    
682      case CHAR_u:      case CHAR_u:
683        if ((options & PCRE_JAVASCRIPT_COMPAT) != 0)
684          {
685          /* In JavaScript, \u must be followed by four hexadecimal numbers.
686          Otherwise it is a lowercase u letter. */
687          if ((digitab[ptr[1]] & ctype_xdigit) != 0 && (digitab[ptr[2]] & ctype_xdigit) != 0
688               && (digitab[ptr[3]] & ctype_xdigit) != 0 && (digitab[ptr[4]] & ctype_xdigit) != 0)
689            {
690            int i;
691            c = 0;
692            for (i = 0; i < 4; ++i)
693              {
694              register int cc = *(++ptr);
695    #ifndef EBCDIC  /* ASCII/UTF-8 coding */
696              if (cc >= CHAR_a) cc -= 32;               /* Convert to upper case */
697              c = (c << 4) + cc - ((cc < CHAR_A)? CHAR_0 : (CHAR_A - 10));
698    #else           /* EBCDIC coding */
699              if (cc >= CHAR_a && cc <= CHAR_z) cc += 64;  /* Convert to upper case */
700              c = (c << 4) + cc - ((cc >= CHAR_0)? CHAR_0 : (CHAR_A - 10));
701    #endif
702              }
703            }
704          }
705        else
706          *errorcodeptr = ERR37;
707        break;
708    
709      case CHAR_U:      case CHAR_U:
710      *errorcodeptr = ERR37;      /* In JavaScript, \U is an uppercase U letter. */
711        if ((options & PCRE_JAVASCRIPT_COMPAT) == 0) *errorcodeptr = ERR37;
712      break;      break;
713    
714      /* In a character class, \g is just a literal "g". Outside a character      /* In a character class, \g is just a literal "g". Outside a character
# Line 828  else Line 858  else
858      treated as a data character. */      treated as a data character. */
859    
860      case CHAR_x:      case CHAR_x:
861        if ((options & PCRE_JAVASCRIPT_COMPAT) != 0)
862          {
863          /* In JavaScript, \x must be followed by two hexadecimal numbers.
864          Otherwise it is a lowercase x letter. */
865          if ((digitab[ptr[1]] & ctype_xdigit) != 0 && (digitab[ptr[2]] & ctype_xdigit) != 0)
866            {
867            int i;
868            c = 0;
869            for (i = 0; i < 2; ++i)
870              {
871              register int cc = *(++ptr);
872    #ifndef EBCDIC  /* ASCII/UTF-8 coding */
873              if (cc >= CHAR_a) cc -= 32;               /* Convert to upper case */
874              c = (c << 4) + cc - ((cc < CHAR_A)? CHAR_0 : (CHAR_A - 10));
875    #else           /* EBCDIC coding */
876              if (cc >= CHAR_a && cc <= CHAR_z) cc += 64;  /* Convert to upper case */
877              c = (c << 4) + cc - ((cc >= CHAR_0)? CHAR_0 : (CHAR_A - 10));
878    #endif
879              }
880            }
881          break;
882          }
883    
884      if (ptr[1] == CHAR_LEFT_CURLY_BRACKET)      if (ptr[1] == CHAR_LEFT_CURLY_BRACKET)
885        {        {
886        const uschar *pt = ptr + 2;        const uschar *pt = ptr + 2;

Legend:
Removed from v.733  
changed lines
  Added in v.744

  ViewVC Help
Powered by ViewVC 1.1.5