X-Git-Url: http://git.tdb.fi/?p=libs%2Fcore.git;a=blobdiff_plain;f=source%2Fregex.cpp;h=48fe4a7c3422fb027c40481d1f7d39b8fc7010d3;hp=d3fd0b7ebc4e58b733947387a6e4f349e83bd7ce;hb=47df471884234130a2a27f0a5fc842df3f994a3e;hpb=a3bf8b72faa5fce99f0f6384d6d9b6588a1de072 diff --git a/source/regex.cpp b/source/regex.cpp index d3fd0b7..48fe4a7 100644 --- a/source/regex.cpp +++ b/source/regex.cpp @@ -244,8 +244,7 @@ Regex::Code Regex::parse_atom(const string &expr, string::const_iterator &i, uns if(flag) { - if(static_cast(*i)<=LAST_INSTRUCTION_) - result+=MATCH_CHAR; + result+=MATCH_CHAR; result+=*i; } @@ -388,11 +387,7 @@ bool Regex::run(const string &str, const string::const_iterator &begin, RegMatch bool negate_match=false; for(; j->citer!=code.end();) { - Instruction instr=static_cast(*j->citer); - if(instr>LAST_INSTRUCTION_) - instr=MATCH_CHAR; - else - ++j->citer; + Instruction instr=static_cast(*j->citer++); if(instr==NEGATE) negate_match=true; @@ -517,11 +512,7 @@ bool Regex::group_compare(const RegMatch::Group &g1, const RegMatch::Group &g2) string Regex::disassemble_instruction(Code::const_iterator &i) const { - Instruction instr=static_cast(*i); - if(instr>=LAST_INSTRUCTION_) - instr=MATCH_CHAR; - else - ++i; + Instruction instr=static_cast(*i++); ostringstream result; switch(instr) @@ -575,8 +566,7 @@ string Regex::disassemble_instruction(Code::const_iterator &i) const case MATCH_ANY: result<<"MATCH_ANY"; break; - case FIRST_INSTRUCTION_: - case LAST_INSTRUCTION_: + default: result<<"UNKNOWN "<