Regex: Add a RegexExecFlags::NotEndOfSubject flag

This commit is contained in:
Maxime Coste 2017-12-29 09:54:58 +11:00
parent 3a93365215
commit 6851604546

View File

@ -133,10 +133,11 @@ enum class RegexExecFlags
NotBeginOfWord = 1 << 3, NotBeginOfWord = 1 << 3,
NotEndOfWord = 1 << 4, NotEndOfWord = 1 << 4,
NotBeginOfSubject = 1 << 5, NotBeginOfSubject = 1 << 5,
NotInitialNull = 1 << 6, NotEndOfSubject = 1 << 6,
AnyMatch = 1 << 7, NotInitialNull = 1 << 7,
NoSaves = 1 << 8, AnyMatch = 1 << 8,
PrevAvailable = 1 << 9, NoSaves = 1 << 9,
PrevAvailable = 1 << 10,
}; };
constexpr bool with_bit_ops(Meta::Type<RegexExecFlags>) { return true; } constexpr bool with_bit_ops(Meta::Type<RegexExecFlags>) { return true; }
@ -372,7 +373,7 @@ private:
return StepResult::Failed; return StepResult::Failed;
break; break;
case CompiledRegex::SubjectEnd: case CompiledRegex::SubjectEnd:
if (pos != m_end) if (pos != m_end or (m_flags & RegexExecFlags::NotEndOfSubject))
return StepResult::Failed; return StepResult::Failed;
break; break;
case CompiledRegex::LookAhead: case CompiledRegex::LookAhead: