| 741 | } |
| 742 | |
| 743 | void Pattern::parse( |
| 744 | Positions& startpos, |
| 745 | Follow& followpos, |
| 746 | Lazypos& lazypos, |
| 747 | Mods modifiers, |
| 748 | Map& lookahead) |
| 749 | { |
| 750 | DBGLOG("BEGIN parse()"); |
| 751 | if (rex_.size() > Position::MAXLOC) |
| 752 | error(regex_error::exceeds_length, Position::MAXLOC); |
| 753 | Location len = static_cast<Location>(rex_.size()); |
| 754 | Location loc = 0; |
| 755 | Accept choice = 1; |
| 756 | Lazy lazyidx = 0; |
| 757 | Positions firstpos; |
| 758 | Positions lastpos; |
| 759 | bool nullable; |
| 760 | Iter iter; |
| 761 | #ifdef WITH_TREE_DFA |
| 762 | DFA::State *last_state = NULL; |
| 763 | #endif |
| 764 | timer_type t; |
| 765 | timer_start(t); |
| 766 | // parse (?imsux) directives that apply to the pattern as a whole |
| 767 | while (at(loc) == '(' && at(loc + 1) == '?') |
| 768 | { |
| 769 | Location back = loc; |
| 770 | loc += 2; |
| 771 | while (at(loc) == '-' || std::isalnum(at(loc))) |
| 772 | ++loc; |
| 773 | if (at(loc) == ')') |
| 774 | { |
| 775 | bool active = true; |
| 776 | loc = back + 2; |
| 777 | Char c; |
| 778 | while ((c = at(loc)) != ')') |
| 779 | { |
| 780 | c = at(loc); |
| 781 | if (c == '-') |
| 782 | active = false; |
| 783 | else if (c == 'i') |
| 784 | opt_.i = active; |
| 785 | else if (c == 'm') |
| 786 | opt_.m = active; |
| 787 | else if (c == 'q') |
| 788 | opt_.q = active; |
| 789 | else if (c == 's') |
| 790 | opt_.s = active; |
| 791 | else if (c == 'x') |
| 792 | opt_.x = active; |
| 793 | else |
| 794 | error(regex_error::invalid_modifier, loc); |
| 795 | ++loc; |
| 796 | } |
| 797 | ++loc; |
| 798 | } |
| 799 | else |
| 800 | { |
nothing calls this directly
no test coverage detected