Regex regex(re_str);
if(debug)
- cout<<regex.disassemble();
+ cout << regex.disassemble();
string line;
while(getline(cin, line))
{
if(RegMatch match = regex.match(line))
- cout<<line<<'\n';
+ cout << line << '\n';
}
return 0;
import sys
import os
-in_fn=sys.argv[1]
-out_fn=os.path.splitext(in_fn)[0]+".table"
+in_fn = sys.argv[1]
+out_fn = os.path.splitext(in_fn)[0]+".table"
-data=[]
+data = []
for line in file(in_fn):
- line=line.strip()
+ line = line.strip()
if line[0]=='#':
continue
- parts=line.split(None, 3)
- code=eval(parts[1])-0x2020
- code2=(code&0xFF)+((code>>8)&0xFF)*94-95
+ parts = line.split(None, 3)
+ code = eval(parts[1])-0x2020
+ code2 = (code&0xFF)+((code>>8)&0xFF)*94-95
data.append((code, eval(parts[2]), code2))
-out=file(out_fn, "w")
+out = file(out_fn, "w")
out.write("namespace {\n\n")
data.sort(lambda x,y: cmp(x[0],y[0]))
out.write("const unsigned short jisx0208_to_ucs_table[94*94] =\n{\n\t")
-i=0
+i = 0
for code in xrange(94*94):
if code>0:
out.write(", ")
out.write("\n\t")
if i<len(data) and data[i][2]==code:
out.write("0x%04X"%data[i][1])
- i+=1
+ i += 1
else:
out.write("0 ")
out.write("\n};\n\n")
else
args_raw.push_back(argv[i++]);
}
-
+
for(; i<argc; ++i)
args_raw.push_back(argv[i]);
// See if the argument contains an =
unsigned equals = 0;
for(; arg[equals] && arg[equals]!='='; ++equals) ;
-
+
OptionImpl &opt = get_option(string(arg, equals));
-
+
if(arg[equals])
// Process the part after the = as option argument
opt.process(arg+equals+1);
}
else
opt.process();
-
+
return 1;
}
{
if(!argp[1])
throw usage_error("-"+string(1, *arg)+" requires an argument");
-
+
// Use the next argument as option argument
opt.process(argp[1]);
return 2;
for(ArgumentList::const_iterator i=args.begin(); i!=args.end(); ++i, ++j)
result += format(" %s%s%s\n", *j, string(maxw+2-j->size(), ' '), (*i)->get_help());
}
-
+
return result;
}
operator<<(LexicalConverter &c, const T &v)
{
std::ostringstream ss;
- ss<<c.get_fmt()<<v;
+ ss << c.get_fmt() << v;
c.result(ss.str());
}
{
std::istringstream ss(c.get());
ss.setf(std::ios_base::fmtflags(0), std::ios_base::skipws);
- ss>>v;
+ ss >> v;
if(ss.fail() || !ss.eof())
throw lexical_error("conversion failure");
}
{
LexicalConverter conv(s, f);
T result;
- conv>>result;
+ conv >> result;
return result;
}
};
static std::string cast(const F &v, const Fmt &f = Fmt())
{
LexicalConverter conv(f);
- conv<<v;
+ conv << v;
return conv.get();
}
};
static std::string cast(const std::string &v, const Fmt &f = Fmt())
{
LexicalConverter conv(f);
- conv<<v;
+ conv << v;
return conv.get();
}
};