MCPcopy Create free account
hub / github.com/Genivia/RE-flex / parse

Method parse

lib/pattern.cpp:743–973  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

741}
742
743void 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 {

Callers

nothing calls this directly

Calls 15

timer_startFunction · 0.85
atFunction · 0.85
lowercaseFunction · 0.85
PositionClass · 0.85
timer_elapsedFunction · 0.85
edgeMethod · 0.80
errorFunction · 0.50
sizeMethod · 0.45
startMethod · 0.45
rootMethod · 0.45
findMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected