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

Diff of /code/trunk/study.c

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

revision 43 by nigel, Sat Feb 24 21:39:21 2007 UTC revision 53 by nigel, Sat Feb 24 21:39:42 2007 UTC
# Line 9  the file Tech.Notes for some information Line 9  the file Tech.Notes for some information
9    
10  Written by: Philip Hazel <ph10@cam.ac.uk>  Written by: Philip Hazel <ph10@cam.ac.uk>
11    
12             Copyright (c) 1997-2000 University of Cambridge             Copyright (c) 1997-2001 University of Cambridge
13    
14  -----------------------------------------------------------------------------  -----------------------------------------------------------------------------
15  Permission is granted to anyone to use this software for any purpose on any  Permission is granted to anyone to use this software for any purpose on any
# Line 104  do Line 104  do
104    
105    while (try_next)    while (try_next)
106      {      {
     try_next = FALSE;  
   
107      /* If a branch starts with a bracket or a positive lookahead assertion,      /* If a branch starts with a bracket or a positive lookahead assertion,
108      recurse to set bits from within them. That's all for this branch. */      recurse to set bits from within them. That's all for this branch. */
109    
# Line 113  do Line 111  do
111        {        {
112        if (!set_start_bits(tcode, start_bits, caseless, cd))        if (!set_start_bits(tcode, start_bits, caseless, cd))
113          return FALSE;          return FALSE;
114          try_next = FALSE;
115        }        }
116    
117      else switch(*tcode)      else switch(*tcode)
# Line 120  do Line 119  do
119        default:        default:
120        return FALSE;        return FALSE;
121    
122          /* Skip over extended extraction bracket number */
123    
124          case OP_BRANUMBER:
125          tcode += 3;
126          break;
127    
128        /* Skip over lookbehind and negative lookahead assertions */        /* Skip over lookbehind and negative lookahead assertions */
129    
130        case OP_ASSERT_NOT:        case OP_ASSERT_NOT:
131        case OP_ASSERTBACK:        case OP_ASSERTBACK:
132        case OP_ASSERTBACK_NOT:        case OP_ASSERTBACK_NOT:
       try_next = TRUE;  
133        do tcode += (tcode[1] << 8) + tcode[2]; while (*tcode == OP_ALT);        do tcode += (tcode[1] << 8) + tcode[2]; while (*tcode == OP_ALT);
134        tcode += 3;        tcode += 3;
135        break;        break;
# Line 135  do Line 139  do
139        case OP_OPT:        case OP_OPT:
140        caseless = (tcode[1] & PCRE_CASELESS) != 0;        caseless = (tcode[1] & PCRE_CASELESS) != 0;
141        tcode += 2;        tcode += 2;
       try_next = TRUE;  
142        break;        break;
143    
144        /* BRAZERO does the bracket, but carries on. */        /* BRAZERO does the bracket, but carries on. */
# Line 147  do Line 150  do
150        dummy = 1;        dummy = 1;
151        do tcode += (tcode[1] << 8) + tcode[2]; while (*tcode == OP_ALT);        do tcode += (tcode[1] << 8) + tcode[2]; while (*tcode == OP_ALT);
152        tcode += 3;        tcode += 3;
       try_next = TRUE;  
153        break;        break;
154    
155        /* Single-char * or ? sets the bit and tries the next item */        /* Single-char * or ? sets the bit and tries the next item */
# Line 158  do Line 160  do
160        case OP_MINQUERY:        case OP_MINQUERY:
161        set_bit(start_bits, tcode[1], caseless, cd);        set_bit(start_bits, tcode[1], caseless, cd);
162        tcode += 2;        tcode += 2;
       try_next = TRUE;  
163        break;        break;
164    
165        /* Single-char upto sets the bit and tries the next */        /* Single-char upto sets the bit and tries the next */
# Line 167  do Line 168  do
168        case OP_MINUPTO:        case OP_MINUPTO:
169        set_bit(start_bits, tcode[3], caseless, cd);        set_bit(start_bits, tcode[3], caseless, cd);
170        tcode += 4;        tcode += 4;
       try_next = TRUE;  
171        break;        break;
172    
173        /* At least one single char sets the bit and stops */        /* At least one single char sets the bit and stops */
# Line 181  do Line 181  do
181        case OP_PLUS:        case OP_PLUS:
182        case OP_MINPLUS:        case OP_MINPLUS:
183        set_bit(start_bits, tcode[1], caseless, cd);        set_bit(start_bits, tcode[1], caseless, cd);
184          try_next = FALSE;
185        break;        break;
186    
187        /* Single character type sets the bits and stops */        /* Single character type sets the bits and stops */
# Line 188  do Line 189  do
189        case OP_NOT_DIGIT:        case OP_NOT_DIGIT:
190        for (c = 0; c < 32; c++)        for (c = 0; c < 32; c++)
191          start_bits[c] |= ~cd->cbits[c+cbit_digit];          start_bits[c] |= ~cd->cbits[c+cbit_digit];
192          try_next = FALSE;
193        break;        break;
194    
195        case OP_DIGIT:        case OP_DIGIT:
196        for (c = 0; c < 32; c++)        for (c = 0; c < 32; c++)
197          start_bits[c] |= cd->cbits[c+cbit_digit];          start_bits[c] |= cd->cbits[c+cbit_digit];
198          try_next = FALSE;
199        break;        break;
200    
201        case OP_NOT_WHITESPACE:        case OP_NOT_WHITESPACE:
202        for (c = 0; c < 32; c++)        for (c = 0; c < 32; c++)
203          start_bits[c] |= ~cd->cbits[c+cbit_space];          start_bits[c] |= ~cd->cbits[c+cbit_space];
204          try_next = FALSE;
205        break;        break;
206    
207        case OP_WHITESPACE:        case OP_WHITESPACE:
208        for (c = 0; c < 32; c++)        for (c = 0; c < 32; c++)
209          start_bits[c] |= cd->cbits[c+cbit_space];          start_bits[c] |= cd->cbits[c+cbit_space];
210          try_next = FALSE;
211        break;        break;
212    
213        case OP_NOT_WORDCHAR:        case OP_NOT_WORDCHAR:
214        for (c = 0; c < 32; c++)        for (c = 0; c < 32; c++)
215          start_bits[c] |= ~cd->cbits[c+cbit_word];          start_bits[c] |= ~cd->cbits[c+cbit_word];
216          try_next = FALSE;
217        break;        break;
218    
219        case OP_WORDCHAR:        case OP_WORDCHAR:
220        for (c = 0; c < 32; c++)        for (c = 0; c < 32; c++)
221          start_bits[c] |= cd->cbits[c+cbit_word];          start_bits[c] |= cd->cbits[c+cbit_word];
222          try_next = FALSE;
223        break;        break;
224    
225        /* One or more character type fudges the pointer and restarts, knowing        /* One or more character type fudges the pointer and restarts, knowing
# Line 221  do Line 228  do
228        case OP_TYPEPLUS:        case OP_TYPEPLUS:
229        case OP_TYPEMINPLUS:        case OP_TYPEMINPLUS:
230        tcode++;        tcode++;
       try_next = TRUE;  
231        break;        break;
232    
233        case OP_TYPEEXACT:        case OP_TYPEEXACT:
234        tcode += 3;        tcode += 3;
       try_next = TRUE;  
235        break;        break;
236    
237        /* Zero or more repeats of character types set the bits and then        /* Zero or more repeats of character types set the bits and then
# Line 274  do Line 279  do
279          }          }
280    
281        tcode += 2;        tcode += 2;
       try_next = TRUE;  
282        break;        break;
283    
284        /* Character class: set the bits and either carry on or not,        /* Character class: set the bits and either carry on or not,
# Line 292  do Line 296  do
296            case OP_CRQUERY:            case OP_CRQUERY:
297            case OP_CRMINQUERY:            case OP_CRMINQUERY:
298            tcode++;            tcode++;
           try_next = TRUE;  
299            break;            break;
300    
301            case OP_CRRANGE:            case OP_CRRANGE:
302            case OP_CRMINRANGE:            case OP_CRMINRANGE:
303            if (((tcode[1] << 8) + tcode[2]) == 0)            if (((tcode[1] << 8) + tcode[2]) == 0) tcode += 5;
304              {              else try_next = FALSE;
305              tcode += 5;            break;
306              try_next = TRUE;  
307              }            default:
308              try_next = FALSE;
309            break;            break;
310            }            }
311          }          }

Legend:
Removed from v.43  
changed lines
  Added in v.53

webmaster@exim.org
ViewVC Help
Powered by ViewVC 1.1.12