Public Member Functions | |
cmt_char_list_node (cmt_string list) | |
const cmt_regexp::iterator | match (const cmt_string &text, int pos) const |
void | dump () const |
Protected Attributes | |
cmt_string | _list |
cmt_string | _choices |
|
Definition at line 386 of file cmt_regexp.cxx. References _choices, _list, and cmt_string::size().
00387 { 00388 _list = list; 00389 00390 _choices = ""; 00391 00392 char c; 00393 int i; 00394 00395 for (i = 0; i < list.size (); i++) 00396 { 00397 c = list[i]; 00398 00399 switch (c) 00400 { 00401 case '-': 00402 i++; 00403 { 00404 char c1 = _choices[_choices.size () - 1]; 00405 char c2 = list[i]; 00406 int j; 00407 int j0 = (c1 < c2) ? c1 : c2; 00408 int j1 = (c1 > c2) ? c1 : c2; 00409 for (j = j0; j <= j1; j++) 00410 { 00411 _choices += j; 00412 } 00413 } 00414 break; 00415 case '\\': 00416 i++; 00417 c = list[i]; 00418 switch (c) 00419 { 00420 case '[': 00421 case ']': 00422 case '(': 00423 case ')': 00424 case '.': 00425 case '*': 00426 case '?': 00427 case '^': 00428 case '$': 00429 case '\\': 00430 c = '\\'; 00431 break; 00432 case 'r': 00433 c = '\r'; 00434 break; 00435 case 't': 00436 c = '\t'; 00437 break; 00438 case 'n': 00439 c = '\n'; 00440 break; 00441 default: 00442 break; 00443 } 00444 default: 00445 _choices += c; 00446 break; 00447 } 00448 } 00449 } |
|
Reimplemented from cmt_regexp_node. Reimplemented in cmt_not_char_list_node. Definition at line 471 of file cmt_regexp.cxx. References _choices, _list, and tab().
|
|
Reimplemented from cmt_regexp_node. Reimplemented in cmt_not_char_list_node. Definition at line 451 of file cmt_regexp.cxx. References _choices, cmt_regexp::iterator::null(), and cmt_string::size().
00453 { 00454 if ((pos < 0) || (pos > text.size ())) 00455 { 00456 return (cmt_regexp::iterator::null ()); 00457 } 00458 00459 char c = text[pos]; 00460 00461 int i; 00462 00463 for (i = 0; i < _choices.size (); i++) 00464 { 00465 if (c == _choices[i]) return (cmt_regexp::iterator (pos, 1)); 00466 } 00467 00468 return (cmt_regexp::iterator::null ()); 00469 } |
|
Definition at line 94 of file cmt_regexp.cxx. Referenced by cmt_char_list_node(), dump(), and match(). |
|
Definition at line 93 of file cmt_regexp.cxx. Referenced by cmt_char_list_node(), and dump(). |