getopt.add_option('d', "debug", debug, GetOpt::NO_ARG);
getopt(argc, argv);
- const list<string> &args=getopt.get_args();
+ const vector<string> &args=getopt.get_args();
if(args.empty())
{
return 1;
}
- Regex regex(argv[1]);
+ Regex regex(args[0]);
if(debug)
cout<<regex.disassemble();
string line;
if(flag)
{
- if(static_cast<unsigned char>(*i)<=LAST_INSTRUCTION_)
- result+=MATCH_CHAR;
+ result+=MATCH_CHAR;
result+=*i;
}
bool negate_match=false;
for(; j->citer!=code.end();)
{
- Instruction instr=static_cast<Instruction>(*j->citer);
- if(instr>LAST_INSTRUCTION_)
- instr=MATCH_CHAR;
- else
- ++j->citer;
+ Instruction instr=static_cast<Instruction>(*j->citer++);
if(instr==NEGATE)
negate_match=true;
string Regex::disassemble_instruction(Code::const_iterator &i) const
{
- Instruction instr=static_cast<Instruction>(*i);
- if(instr>=LAST_INSTRUCTION_)
- instr=MATCH_CHAR;
- else
- ++i;
+ Instruction instr=static_cast<Instruction>(*i++);
ostringstream result;
switch(instr)
case MATCH_ANY:
result<<"MATCH_ANY";
break;
- case FIRST_INSTRUCTION_:
- case LAST_INSTRUCTION_:
+ default:
result<<"UNKNOWN "<<instr;
}