Match Op declaration order in switches
This commit is contained in:
parent
2dd69b3d96
commit
7e75c9a1df
|
@ -1088,6 +1088,12 @@ String dump_regex(const CompiledRegex& program)
|
|||
case CompiledRegex::AnyCharExceptNewLine:
|
||||
res += "anything but newline\n";
|
||||
break;
|
||||
case CompiledRegex::CharClass:
|
||||
res += format("character class {}\n", inst.param.character_class_index);
|
||||
break;
|
||||
case CompiledRegex::CharType:
|
||||
res += format("character type {}\n", to_underlying(inst.param.character_type));
|
||||
break;
|
||||
case CompiledRegex::Jump:
|
||||
res += format("jump {}\n", inst.param.jump_target);
|
||||
break;
|
||||
|
@ -1101,12 +1107,6 @@ String dump_regex(const CompiledRegex& program)
|
|||
case CompiledRegex::Save:
|
||||
res += format("save {}\n", inst.param.save_index);
|
||||
break;
|
||||
case CompiledRegex::CharClass:
|
||||
res += format("character class {}\n", inst.param.character_class_index);
|
||||
break;
|
||||
case CompiledRegex::CharType:
|
||||
res += format("character type {}\n", to_underlying(inst.param.character_type));
|
||||
break;
|
||||
case CompiledRegex::LineAssertion:
|
||||
res += format("line {}\n", inst.param.line_start ? "start" : "end");;
|
||||
break;
|
||||
|
|
|
@ -413,6 +413,14 @@ private:
|
|||
if (pos != config.end and cp != '\n')
|
||||
return consumed();
|
||||
return failed();
|
||||
case CompiledRegex::CharClass:
|
||||
if (pos == config.end)
|
||||
return failed();
|
||||
return m_program.character_classes[inst.param.character_class_index].matches(cp) ? consumed() : failed();
|
||||
case CompiledRegex::CharType:
|
||||
if (pos == config.end)
|
||||
return failed();
|
||||
return is_ctype(inst.param.character_type, cp) ? consumed() : failed();
|
||||
case CompiledRegex::Jump:
|
||||
thread.inst = inst.param.jump_target;
|
||||
break;
|
||||
|
@ -440,14 +448,6 @@ private:
|
|||
m_saves[thread.saves].pos[inst.param.save_index] = pos;
|
||||
m_saves[thread.saves].valid_mask |= (1 << inst.param.save_index);
|
||||
break;
|
||||
case CompiledRegex::CharClass:
|
||||
if (pos == config.end)
|
||||
return failed();
|
||||
return m_program.character_classes[inst.param.character_class_index].matches(cp) ? consumed() : failed();
|
||||
case CompiledRegex::CharType:
|
||||
if (pos == config.end)
|
||||
return failed();
|
||||
return is_ctype(inst.param.character_type, cp) ? consumed() : failed();
|
||||
case CompiledRegex::LineAssertion:
|
||||
if (not (inst.param.line_start ? is_line_start(pos, config) : is_line_end(pos, config)))
|
||||
return failed();
|
||||
|
|
Loading…
Reference in New Issue
Block a user