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

Diff of /code/trunk/pcre_dfa_exec.c

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

revision 178 by ph10, Wed Jun 13 08:44:34 2007 UTC revision 341 by ph10, Sat Apr 19 16:41:04 2008 UTC
# Line 6  Line 6 
6  and semantics are as close as possible to those of the Perl 5 language.  and semantics are as close as possible to those of the Perl 5 language.
7    
8                         Written by Philip Hazel                         Written by Philip Hazel
9             Copyright (c) 1997-2007 University of Cambridge             Copyright (c) 1997-2008 University of Cambridge
10    
11  -----------------------------------------------------------------------------  -----------------------------------------------------------------------------
12  Redistribution and use in source and binary forms, with or without  Redistribution and use in source and binary forms, with or without
# Line 44  FSM). This is NOT Perl- compatible, but Line 44  FSM). This is NOT Perl- compatible, but
44  applications. */  applications. */
45    
46    
47    #ifdef HAVE_CONFIG_H
48    #include "config.h"
49    #endif
50    
51  #define NLBLOCK md             /* Block containing newline information */  #define NLBLOCK md             /* Block containing newline information */
52  #define PSSTART start_subject  /* Field containing processed string start */  #define PSSTART start_subject  /* Field containing processed string start */
53  #define PSEND   end_subject    /* Field containing processed string end */  #define PSEND   end_subject    /* Field containing processed string end */
# Line 63  applications. */ Line 67  applications. */
67    
68  /* These are offsets that are used to turn the OP_TYPESTAR and friends opcodes  /* These are offsets that are used to turn the OP_TYPESTAR and friends opcodes
69  into others, under special conditions. A gap of 20 between the blocks should be  into others, under special conditions. A gap of 20 between the blocks should be
70  enough. The resulting opcodes don't have to be less than 256 because they are  enough. The resulting opcodes don't have to be less than 256 because they are
71  never stored, so we push them well clear of the normal opcodes. */  never stored, so we push them well clear of the normal opcodes. */
72    
73  #define OP_PROP_EXTRA       300  #define OP_PROP_EXTRA       300
# Line 80  centralize the loading of these characte Line 84  centralize the loading of these characte
84  small value. ***NOTE*** If the start of this table is modified, the two tables  small value. ***NOTE*** If the start of this table is modified, the two tables
85  that follow must also be modified. */  that follow must also be modified. */
86    
87  static uschar coptable[] = {  static const uschar coptable[] = {
88    0,                             /* End                                    */    0,                             /* End                                    */
89    0, 0, 0, 0, 0,                 /* \A, \G, \K, \B, \b                     */    0, 0, 0, 0, 0,                 /* \A, \G, \K, \B, \b                     */
90    0, 0, 0, 0, 0, 0,              /* \D, \d, \S, \s, \W, \w                 */    0, 0, 0, 0, 0, 0,              /* \D, \d, \S, \s, \W, \w                 */
91    0, 0,                          /* Any, Anybyte                           */    0, 0, 0,                       /* Any, AllAny, Anybyte                   */
92    0, 0, 0,                       /* NOTPROP, PROP, EXTUNI                  */    0, 0, 0,                       /* NOTPROP, PROP, EXTUNI                  */
93    0, 0, 0, 0, 0,                 /* \R, \H, \h, \V, \v                     */    0, 0, 0, 0, 0,                 /* \R, \H, \h, \V, \v                     */
94    0, 0, 0, 0, 0,                 /* \Z, \z, Opt, ^, $                      */    0, 0, 0, 0, 0,                 /* \Z, \z, Opt, ^, $                      */
# Line 126  static uschar coptable[] = { Line 130  static uschar coptable[] = {
130    0,                             /* CREF                                   */    0,                             /* CREF                                   */
131    0,                             /* RREF                                   */    0,                             /* RREF                                   */
132    0,                             /* DEF                                    */    0,                             /* DEF                                    */
133    0, 0                           /* BRAZERO, BRAMINZERO                    */    0, 0,                          /* BRAZERO, BRAMINZERO                    */
134      0, 0, 0, 0,                    /* PRUNE, SKIP, THEN, COMMIT              */
135      0, 0, 0                        /* FAIL, ACCEPT, SKIPZERO                 */
136  };  };
137    
138  /* These 2 tables allow for compact code for testing for \D, \d, \S, \s, \W,  /* These 2 tables allow for compact code for testing for \D, \d, \S, \s, \W,
139  and \w */  and \w */
140    
141  static uschar toptable1[] = {  static const uschar toptable1[] = {
142    0, 0, 0, 0, 0, 0,    0, 0, 0, 0, 0, 0,
143    ctype_digit, ctype_digit,    ctype_digit, ctype_digit,
144    ctype_space, ctype_space,    ctype_space, ctype_space,
145    ctype_word,  ctype_word,    ctype_word,  ctype_word,
146    0                               /* OP_ANY */    0, 0                            /* OP_ANY, OP_ALLANY */
147  };  };
148    
149  static uschar toptable2[] = {  static const uschar toptable2[] = {
150    0, 0, 0, 0, 0, 0,    0, 0, 0, 0, 0, 0,
151    ctype_digit, 0,    ctype_digit, 0,
152    ctype_space, 0,    ctype_space, 0,
153    ctype_word,  0,    ctype_word,  0,
154    1                               /* OP_ANY */    1, 1                            /* OP_ANY, OP_ALLANY */
155  };  };
156    
157    
# Line 217  Arguments: Line 223  Arguments:
223    rlevel            function call recursion level    rlevel            function call recursion level
224    recursing         regex recursive call level    recursing         regex recursive call level
225    
226  Returns:            > 0 =>  Returns:            > 0 => number of match offset pairs placed in offsets
227                      = 0 =>                      = 0 => offsets overflowed; longest matches are present
228                       -1 => failed to match                       -1 => failed to match
229                     < -1 => some kind of unexpected problem                     < -1 => some kind of unexpected problem
230    
# Line 585  for (;;) Line 591  for (;;)
591            case OP_ANYNL: codevalue += OP_ANYNL_EXTRA; break;            case OP_ANYNL: codevalue += OP_ANYNL_EXTRA; break;
592            case OP_EXTUNI: codevalue += OP_EXTUNI_EXTRA; break;            case OP_EXTUNI: codevalue += OP_EXTUNI_EXTRA; break;
593            case OP_NOT_HSPACE:            case OP_NOT_HSPACE:
594            case OP_HSPACE: codevalue += OP_HSPACE_EXTRA; break;            case OP_HSPACE: codevalue += OP_HSPACE_EXTRA; break;
595            case OP_NOT_VSPACE:            case OP_NOT_VSPACE:
596            case OP_VSPACE: codevalue += OP_VSPACE_EXTRA; break;            case OP_VSPACE: codevalue += OP_VSPACE_EXTRA; break;
597            default: break;            default: break;
598            }            }
599          }          }
# Line 688  for (;;) Line 694  for (;;)
694        break;        break;
695    
696        /*-----------------------------------------------------------------*/        /*-----------------------------------------------------------------*/
697          case OP_SKIPZERO:
698          code += 1 + GET(code, 2);
699          while (*code == OP_ALT) code += GET(code, 1);
700          ADD_ACTIVE(code - start_code + 1 + LINK_SIZE, 0);
701          break;
702    
703          /*-----------------------------------------------------------------*/
704        case OP_CIRC:        case OP_CIRC:
705        if ((ptr == start_subject && (md->moptions & PCRE_NOTBOL) == 0) ||        if ((ptr == start_subject && (md->moptions & PCRE_NOTBOL) == 0) ||
706            ((ims & PCRE_MULTILINE) != 0 &&            ((ims & PCRE_MULTILINE) != 0 &&
# Line 731  for (;;) Line 744  for (;;)
744        break;        break;
745    
746        /*-----------------------------------------------------------------*/        /*-----------------------------------------------------------------*/
747          case OP_ALLANY:
748          if (clen > 0)
749            { ADD_NEW(state_offset + 1, 0); }
750          break;
751    
752          /*-----------------------------------------------------------------*/
753        case OP_EODN:        case OP_EODN:
754        if (clen == 0 || (IS_NEWLINE(ptr) && ptr == end_subject - md->nllen))        if (clen == 0 || (IS_NEWLINE(ptr) && ptr == end_subject - md->nllen))
755          { ADD_ACTIVE(state_offset + 1, 0); }          { ADD_ACTIVE(state_offset + 1, 0); }
# Line 846  for (;;) Line 865  for (;;)
865  /* ========================================================================== */  /* ========================================================================== */
866        /* These opcodes likewise inspect the subject character, but have an        /* These opcodes likewise inspect the subject character, but have an
867        argument that is not a data character. It is one of these opcodes:        argument that is not a data character. It is one of these opcodes:
868        OP_ANY, OP_DIGIT, OP_NOT_DIGIT, OP_WHITESPACE, OP_NOT_SPACE, OP_WORDCHAR,        OP_ANY, OP_ALLANY, OP_DIGIT, OP_NOT_DIGIT, OP_WHITESPACE, OP_NOT_SPACE,
869        OP_NOT_WORDCHAR. The value is loaded into d. */        OP_WORDCHAR, OP_NOT_WORDCHAR. The value is loaded into d. */
870    
871        case OP_TYPEPLUS:        case OP_TYPEPLUS:
872        case OP_TYPEMINPLUS:        case OP_TYPEMINPLUS:
# Line 1074  for (;;) Line 1093  for (;;)
1093          int ncount = 0;          int ncount = 0;
1094          switch (c)          switch (c)
1095            {            {
           case 0x000d:  
           if (ptr + 1 < end_subject && ptr[1] == 0x0a) ncount = 1;  
           /* Fall through */  
           case 0x000a:  
1096            case 0x000b:            case 0x000b:
1097            case 0x000c:            case 0x000c:
1098            case 0x0085:            case 0x0085:
1099            case 0x2028:            case 0x2028:
1100            case 0x2029:            case 0x2029:
1101              if ((md->moptions & PCRE_BSR_ANYCRLF) != 0) break;
1102              goto ANYNL01;
1103    
1104              case 0x000d:
1105              if (ptr + 1 < end_subject && ptr[1] == 0x0a) ncount = 1;
1106              /* Fall through */
1107    
1108              ANYNL01:
1109              case 0x000a:
1110            if (count > 0 && codevalue == OP_ANYNL_EXTRA + OP_TYPEPOSPLUS)            if (count > 0 && codevalue == OP_ANYNL_EXTRA + OP_TYPEPOSPLUS)
1111              {              {
1112              active_count--;           /* Remove non-match possibility */              active_count--;           /* Remove non-match possibility */
# Line 1091  for (;;) Line 1115  for (;;)
1115            count++;            count++;
1116            ADD_NEW_DATA(-state_offset, count, ncount);            ADD_NEW_DATA(-state_offset, count, ncount);
1117            break;            break;
1118    
1119            default:            default:
1120            break;            break;
1121            }            }
# Line 1105  for (;;) Line 1130  for (;;)
1130        if (count > 0) { ADD_ACTIVE(state_offset + 2, 0); }        if (count > 0) { ADD_ACTIVE(state_offset + 2, 0); }
1131        if (clen > 0)        if (clen > 0)
1132          {          {
1133          BOOL OK;          BOOL OK;
1134          switch (c)          switch (c)
1135            {            {
1136            case 0x000a:            case 0x000a:
# Line 1116  for (;;) Line 1141  for (;;)
1141            case 0x2028:            case 0x2028:
1142            case 0x2029:            case 0x2029:
1143            OK = TRUE;            OK = TRUE;
1144            break;            break;
1145    
1146            default:            default:
1147            OK = FALSE;            OK = FALSE;
1148            break;            break;
1149            }            }
1150    
1151          if (OK == (d == OP_VSPACE))          if (OK == (d == OP_VSPACE))
1152            {            {
1153            if (count > 0 && codevalue == OP_VSPACE_EXTRA + OP_TYPEPOSPLUS)            if (count > 0 && codevalue == OP_VSPACE_EXTRA + OP_TYPEPOSPLUS)
1154              {              {
1155              active_count--;           /* Remove non-match possibility */              active_count--;           /* Remove non-match possibility */
# Line 1144  for (;;) Line 1169  for (;;)
1169        if (count > 0) { ADD_ACTIVE(state_offset + 2, 0); }        if (count > 0) { ADD_ACTIVE(state_offset + 2, 0); }
1170        if (clen > 0)        if (clen > 0)
1171          {          {
1172          BOOL OK;          BOOL OK;
1173          switch (c)          switch (c)
1174            {            {
1175            case 0x09:      /* HT */            case 0x09:      /* HT */
# Line 1168  for (;;) Line 1193  for (;;)
1193            case 0x3000:    /* IDEOGRAPHIC SPACE */            case 0x3000:    /* IDEOGRAPHIC SPACE */
1194            OK = TRUE;            OK = TRUE;
1195            break;            break;
1196    
1197            default:            default:
1198            OK = FALSE;            OK = FALSE;
1199            break;            break;
1200            }            }
1201    
1202          if (OK == (d == OP_HSPACE))          if (OK == (d == OP_HSPACE))
1203            {            {
1204            if (count > 0 && codevalue == OP_HSPACE_EXTRA + OP_TYPEPOSPLUS)            if (count > 0 && codevalue == OP_HSPACE_EXTRA + OP_TYPEPOSPLUS)
1205              {              {
1206              active_count--;           /* Remove non-match possibility */              active_count--;           /* Remove non-match possibility */
# Line 1307  for (;;) Line 1332  for (;;)
1332          int ncount = 0;          int ncount = 0;
1333          switch (c)          switch (c)
1334            {            {
           case 0x000d:  
           if (ptr + 1 < end_subject && ptr[1] == 0x0a) ncount = 1;  
           /* Fall through */  
           case 0x000a:  
1335            case 0x000b:            case 0x000b:
1336            case 0x000c:            case 0x000c:
1337            case 0x0085:            case 0x0085:
1338            case 0x2028:            case 0x2028:
1339            case 0x2029:            case 0x2029:
1340              if ((md->moptions & PCRE_BSR_ANYCRLF) != 0) break;
1341              goto ANYNL02;
1342    
1343              case 0x000d:
1344              if (ptr + 1 < end_subject && ptr[1] == 0x0a) ncount = 1;
1345              /* Fall through */
1346    
1347              ANYNL02:
1348              case 0x000a:
1349            if (codevalue == OP_ANYNL_EXTRA + OP_TYPEPOSSTAR ||            if (codevalue == OP_ANYNL_EXTRA + OP_TYPEPOSSTAR ||
1350                codevalue == OP_ANYNL_EXTRA + OP_TYPEPOSQUERY)                codevalue == OP_ANYNL_EXTRA + OP_TYPEPOSQUERY)
1351              {              {
# Line 1324  for (;;) Line 1354  for (;;)
1354              }              }
1355            ADD_NEW_DATA(-(state_offset + count), 0, ncount);            ADD_NEW_DATA(-(state_offset + count), 0, ncount);
1356            break;            break;
1357    
1358            default:            default:
1359            break;            break;
1360            }            }
# Line 1346  for (;;) Line 1377  for (;;)
1377        ADD_ACTIVE(state_offset + 2, 0);        ADD_ACTIVE(state_offset + 2, 0);
1378        if (clen > 0)        if (clen > 0)
1379          {          {
1380          BOOL OK;          BOOL OK;
1381          switch (c)          switch (c)
1382            {            {
1383            case 0x000a:            case 0x000a:
# Line 1358  for (;;) Line 1389  for (;;)
1389            case 0x2029:            case 0x2029:
1390            OK = TRUE;            OK = TRUE;
1391            break;            break;
1392    
1393            default:            default:
1394            OK = FALSE;            OK = FALSE;
1395            break;            break;
1396            }            }
1397          if (OK == (d == OP_VSPACE))          if (OK == (d == OP_VSPACE))
1398            {            {
1399            if (codevalue == OP_VSPACE_EXTRA + OP_TYPEPOSSTAR ||            if (codevalue == OP_VSPACE_EXTRA + OP_TYPEPOSSTAR ||
1400                codevalue == OP_VSPACE_EXTRA + OP_TYPEPOSQUERY)                codevalue == OP_VSPACE_EXTRA + OP_TYPEPOSQUERY)
1401              {              {
# Line 1392  for (;;) Line 1423  for (;;)
1423        ADD_ACTIVE(state_offset + 2, 0);        ADD_ACTIVE(state_offset + 2, 0);
1424        if (clen > 0)        if (clen > 0)
1425          {          {
1426          BOOL OK;          BOOL OK;
1427          switch (c)          switch (c)
1428            {            {
1429            case 0x09:      /* HT */            case 0x09:      /* HT */
# Line 1416  for (;;) Line 1447  for (;;)
1447            case 0x3000:    /* IDEOGRAPHIC SPACE */            case 0x3000:    /* IDEOGRAPHIC SPACE */
1448            OK = TRUE;            OK = TRUE;
1449            break;            break;
1450    
1451            default:            default:
1452            OK = FALSE;            OK = FALSE;
1453            break;            break;
1454            }            }
1455    
1456          if (OK == (d == OP_HSPACE))          if (OK == (d == OP_HSPACE))
1457            {            {
1458            if (codevalue == OP_HSPACE_EXTRA + OP_TYPEPOSSTAR ||            if (codevalue == OP_HSPACE_EXTRA + OP_TYPEPOSSTAR ||
1459                codevalue == OP_HSPACE_EXTRA + OP_TYPEPOSQUERY)                codevalue == OP_HSPACE_EXTRA + OP_TYPEPOSQUERY)
1460              {              {
# Line 1539  for (;;) Line 1570  for (;;)
1570          int ncount = 0;          int ncount = 0;
1571          switch (c)          switch (c)
1572            {            {
           case 0x000d:  
           if (ptr + 1 < end_subject && ptr[1] == 0x0a) ncount = 1;  
           /* Fall through */  
           case 0x000a:  
1573            case 0x000b:            case 0x000b:
1574            case 0x000c:            case 0x000c:
1575            case 0x0085:            case 0x0085:
1576            case 0x2028:            case 0x2028:
1577            case 0x2029:            case 0x2029:
1578              if ((md->moptions & PCRE_BSR_ANYCRLF) != 0) break;
1579              goto ANYNL03;
1580    
1581              case 0x000d:
1582              if (ptr + 1 < end_subject && ptr[1] == 0x0a) ncount = 1;
1583              /* Fall through */
1584    
1585              ANYNL03:
1586              case 0x000a:
1587            if (codevalue == OP_ANYNL_EXTRA + OP_TYPEPOSUPTO)            if (codevalue == OP_ANYNL_EXTRA + OP_TYPEPOSUPTO)
1588              {              {
1589              active_count--;           /* Remove non-match possibility */              active_count--;           /* Remove non-match possibility */
# Line 1558  for (;;) Line 1594  for (;;)
1594            else            else
1595              { ADD_NEW_DATA(-state_offset, count, ncount); }              { ADD_NEW_DATA(-state_offset, count, ncount); }
1596            break;            break;
1597    
1598            default:            default:
1599            break;            break;
1600            }            }
# Line 1574  for (;;) Line 1611  for (;;)
1611        count = current_state->count;  /* Number already matched */        count = current_state->count;  /* Number already matched */
1612        if (clen > 0)        if (clen > 0)
1613          {          {
1614          BOOL OK;          BOOL OK;
1615          switch (c)          switch (c)
1616            {            {
1617            case 0x000a:            case 0x000a:
# Line 1586  for (;;) Line 1623  for (;;)
1623            case 0x2029:            case 0x2029:
1624            OK = TRUE;            OK = TRUE;
1625            break;            break;
1626    
1627            default:            default:
1628            OK = FALSE;            OK = FALSE;
1629            }            }
1630    
1631          if (OK == (d == OP_VSPACE))          if (OK == (d == OP_VSPACE))
1632            {            {
1633            if (codevalue == OP_VSPACE_EXTRA + OP_TYPEPOSUPTO)            if (codevalue == OP_VSPACE_EXTRA + OP_TYPEPOSUPTO)
1634              {              {
1635              active_count--;           /* Remove non-match possibility */              active_count--;           /* Remove non-match possibility */
# Line 1616  for (;;) Line 1653  for (;;)
1653        count = current_state->count;  /* Number already matched */        count = current_state->count;  /* Number already matched */
1654        if (clen > 0)        if (clen > 0)
1655          {          {
1656          BOOL OK;          BOOL OK;
1657          switch (c)          switch (c)
1658            {            {
1659            case 0x09:      /* HT */            case 0x09:      /* HT */
# Line 1640  for (;;) Line 1677  for (;;)
1677            case 0x3000:    /* IDEOGRAPHIC SPACE */            case 0x3000:    /* IDEOGRAPHIC SPACE */
1678            OK = TRUE;            OK = TRUE;
1679            break;            break;
1680    
1681            default:            default:
1682            OK = FALSE;            OK = FALSE;
1683            break;            break;
1684            }            }
1685    
1686          if (OK == (d == OP_HSPACE))          if (OK == (d == OP_HSPACE))
1687            {            {
1688            if (codevalue == OP_HSPACE_EXTRA + OP_TYPEPOSUPTO)            if (codevalue == OP_HSPACE_EXTRA + OP_TYPEPOSUPTO)
1689              {              {
1690              active_count--;           /* Remove non-match possibility */              active_count--;           /* Remove non-match possibility */
# Line 1738  for (;;) Line 1775  for (;;)
1775        case OP_ANYNL:        case OP_ANYNL:
1776        if (clen > 0) switch(c)        if (clen > 0) switch(c)
1777          {          {
         case 0x000a:  
1778          case 0x000b:          case 0x000b:
1779          case 0x000c:          case 0x000c:
1780          case 0x0085:          case 0x0085:
1781          case 0x2028:          case 0x2028:
1782          case 0x2029:          case 0x2029:
1783            if ((md->moptions & PCRE_BSR_ANYCRLF) != 0) break;
1784    
1785            case 0x000a:
1786          ADD_NEW(state_offset + 1, 0);          ADD_NEW(state_offset + 1, 0);
1787          break;          break;
1788    
1789          case 0x000d:          case 0x000d:
1790          if (ptr + 1 < end_subject && ptr[1] == 0x0a)          if (ptr + 1 < end_subject && ptr[1] == 0x0a)
1791            {            {
# Line 1771  for (;;) Line 1811  for (;;)
1811          case 0x2028:          case 0x2028:
1812          case 0x2029:          case 0x2029:
1813          break;          break;
1814    
1815          default:          default:
1816          ADD_NEW(state_offset + 1, 0);          ADD_NEW(state_offset + 1, 0);
1817          break;          break;
1818          }          }
# Line 1791  for (;;) Line 1831  for (;;)
1831          case 0x2029:          case 0x2029:
1832          ADD_NEW(state_offset + 1, 0);          ADD_NEW(state_offset + 1, 0);
1833          break;          break;
1834    
1835          default: break;          default: break;
1836          }          }
1837        break;        break;
# Line 1820  for (;;) Line 1860  for (;;)
1860          case 0x205f:    /* MEDIUM MATHEMATICAL SPACE */          case 0x205f:    /* MEDIUM MATHEMATICAL SPACE */
1861          case 0x3000:    /* IDEOGRAPHIC SPACE */          case 0x3000:    /* IDEOGRAPHIC SPACE */
1862          break;          break;
1863    
1864          default:          default:
1865          ADD_NEW(state_offset + 1, 0);          ADD_NEW(state_offset + 1, 0);
1866          break;          break;
1867          }          }
# Line 2135  for (;;) Line 2175  for (;;)
2175    
2176  /* ========================================================================== */  /* ========================================================================== */
2177        /* These are the opcodes for fancy brackets of various kinds. We have        /* These are the opcodes for fancy brackets of various kinds. We have
2178        to use recursion in order to handle them. */        to use recursion in order to handle them. The "always failing" assersion
2179          (?!) is optimised when compiling to OP_FAIL, so we have to support that,
2180          though the other "backtracking verbs" are not supported. */
2181    
2182          case OP_FAIL:
2183          break;
2184    
2185        case OP_ASSERT:        case OP_ASSERT:
2186        case OP_ASSERT_NOT:        case OP_ASSERT_NOT:
# Line 2568  md->end_subject = end_subject; Line 2613  md->end_subject = end_subject;
2613  md->moptions = options;  md->moptions = options;
2614  md->poptions = re->options;  md->poptions = re->options;
2615    
2616    /* If the BSR option is not set at match time, copy what was set
2617    at compile time. */
2618    
2619    if ((md->moptions & (PCRE_BSR_ANYCRLF|PCRE_BSR_UNICODE)) == 0)
2620      {
2621      if ((re->options & (PCRE_BSR_ANYCRLF|PCRE_BSR_UNICODE)) != 0)
2622        md->moptions |= re->options & (PCRE_BSR_ANYCRLF|PCRE_BSR_UNICODE);
2623    #ifdef BSR_ANYCRLF
2624      else md->moptions |= PCRE_BSR_ANYCRLF;
2625    #endif
2626      }
2627    
2628  /* Handle different types of newline. The three bits give eight cases. If  /* Handle different types of newline. The three bits give eight cases. If
2629  nothing is set at run time, whatever was used at compile time applies. */  nothing is set at run time, whatever was used at compile time applies. */
2630    
# Line 2638  if (md->tables == NULL) md->tables = _pc Line 2695  if (md->tables == NULL) md->tables = _pc
2695  used in a loop when finding where to start. */  used in a loop when finding where to start. */
2696    
2697  lcc = md->tables + lcc_offset;  lcc = md->tables + lcc_offset;
2698  startline = (re->options & PCRE_STARTLINE) != 0;  startline = (re->flags & PCRE_STARTLINE) != 0;
2699  firstline = (re->options & PCRE_FIRSTLINE) != 0;  firstline = (re->options & PCRE_FIRSTLINE) != 0;
2700    
2701  /* Set up the first character to match, if available. The first_byte value is  /* Set up the first character to match, if available. The first_byte value is
# Line 2649  studied, there may be a bitmap of possib Line 2706  studied, there may be a bitmap of possib
2706    
2707  if (!anchored)  if (!anchored)
2708    {    {
2709    if ((re->options & PCRE_FIRSTSET) != 0)    if ((re->flags & PCRE_FIRSTSET) != 0)
2710      {      {
2711      first_byte = re->first_byte & 255;      first_byte = re->first_byte & 255;
2712      if ((first_byte_caseless = ((re->first_byte & REQ_CASELESS) != 0)) == TRUE)      if ((first_byte_caseless = ((re->first_byte & REQ_CASELESS) != 0)) == TRUE)
# Line 2666  if (!anchored) Line 2723  if (!anchored)
2723  /* For anchored or unanchored matches, there may be a "last known required  /* For anchored or unanchored matches, there may be a "last known required
2724  character" set. */  character" set. */
2725    
2726  if ((re->options & PCRE_REQCHSET) != 0)  if ((re->flags & PCRE_REQCHSET) != 0)
2727    {    {
2728    req_byte = re->req_byte & 255;    req_byte = re->req_byte & 255;
2729    req_byte_caseless = (re->req_byte & REQ_CASELESS) != 0;    req_byte_caseless = (re->req_byte & REQ_CASELESS) != 0;
# Line 2836  for (;;) Line 2893  for (;;)
2893      }      }
2894    if (current_subject > end_subject) break;    if (current_subject > end_subject) break;
2895    
2896    /* If we have just passed a CR and the newline option is CRLF or ANY or    /* If we have just passed a CR and we are now at a LF, and the pattern does
2897    ANYCRLF, and we are now at a LF, advance the match position by one more    not contain any explicit matches for \r or \n, and the newline option is CRLF
2898    character. */    or ANY or ANYCRLF, advance the match position by one more character. */
2899    
2900    if (current_subject[-1] == '\r' &&    if (current_subject[-1] == '\r' &&
2901         (md->nltype == NLTYPE_ANY ||        current_subject < end_subject &&
2902          md->nltype == NLTYPE_ANYCRLF ||        *current_subject == '\n' &&
2903          md->nllen == 2) &&        (re->flags & PCRE_HASCRORLF) == 0 &&
2904         current_subject < end_subject &&          (md->nltype == NLTYPE_ANY ||
2905         *current_subject == '\n')           md->nltype == NLTYPE_ANYCRLF ||
2906             md->nllen == 2))
2907      current_subject++;      current_subject++;
2908    
2909    }   /* "Bumpalong" loop */    }   /* "Bumpalong" loop */

Legend:
Removed from v.178  
changed lines
  Added in v.341

  ViewVC Help
Powered by ViewVC 1.1.5