Regex: reorder lookaround ops, group by direction

This commit is contained in:
Maxime Coste 2017-10-04 23:00:19 +08:00
parent 854144c535
commit fabeab1ee1
2 changed files with 6 additions and 6 deletions

View File

@ -30,8 +30,8 @@ struct ParsedRegex
SubjectEnd, SubjectEnd,
ResetStart, ResetStart,
LookAhead, LookAhead,
LookBehind,
NegativeLookAhead, NegativeLookAhead,
LookBehind,
NegativeLookBehind, NegativeLookBehind,
}; };
@ -572,14 +572,14 @@ private:
push_op(CompiledRegex::LookAhead); push_op(CompiledRegex::LookAhead);
push_string(node->children); push_string(node->children);
break; break;
case ParsedRegex::LookBehind:
push_op(CompiledRegex::LookBehind);
push_string(node->children, true);
break;
case ParsedRegex::NegativeLookAhead: case ParsedRegex::NegativeLookAhead:
push_op(CompiledRegex::NegativeLookAhead); push_op(CompiledRegex::NegativeLookAhead);
push_string(node->children); push_string(node->children);
break; break;
case ParsedRegex::LookBehind:
push_op(CompiledRegex::LookBehind);
push_string(node->children, true);
break;
case ParsedRegex::NegativeLookBehind: case ParsedRegex::NegativeLookBehind:
push_op(CompiledRegex::NegativeLookBehind); push_op(CompiledRegex::NegativeLookBehind);
push_string(node->children, true); push_string(node->children, true);

View File

@ -30,8 +30,8 @@ struct CompiledRegex
SubjectBegin, SubjectBegin,
SubjectEnd, SubjectEnd,
LookAhead, LookAhead,
LookBehind,
NegativeLookAhead, NegativeLookAhead,
LookBehind,
NegativeLookBehind, NegativeLookBehind,
}; };