Go to the documentation of this file.
28 mem::increment(s_class().c_str());
30 if(a_parent) a_parent->
m_sub.push_back(
this);
35 mem::decrement(s_class().c_str());
46 void dump_tree(std::ostream& a_out,
const std::string& a_margin) {
47 if(
m_dcl.size()) a_out << a_margin <<
m_dcl << std::endl;
49 (*it)->dump_tree(a_out,a_margin+
" ");
73 bool parse(
const std::string& a_s){
77 for(std::string::const_iterator it=a_s.begin();;++it) {
102 if(!prev)
return false;
127 std::vector<value>* vars =
128 (std::vector<value>*)(*it).get_void_star();
136 inline void copy_columns(
const std::vector<value>& a_from,std::vector<value>& a_to) {
137 std::vector<value>::const_iterator it;
138 for(it=a_from.begin();it!=a_from.end();++it) {
140 std::vector<value>* vars =
new std::vector<value>();
141 value v((
void*)vars);
144 std::vector<value>* p =
145 (std::vector<value>*)(*it).get_void_star();
153 inline void dump_columns(std::ostream& a_out,
const std::vector<value>& a_vars,
const std::string& a_margin =
"") {
154 std::vector<value>::const_iterator it;
155 for(it=a_vars.begin();it!=a_vars.end();++it) {
158 <<
"ITuple : " << (*it).label() <<
" : begin "
160 std::vector<value>* vars = (std::vector<value>*)(*it).get_void_star();
173 << (*it).label() <<
" : "
183 finder(std::ostream& a_out,
const std::string& a_script)
205 void result(std::vector<value>& a_vars)
const {
222 if(a_tree.
m_dcl.empty()) {
225 if(!
analyse(*(*it),a_stack))
return false;
233 if(a_tree.
m_sub.size()) {
235 m_out <<
"tools::columns::finder::analyse :"
236 <<
" Expect a VOID_STAR."
242 std::vector<value>* stk =
new std::vector<value>();
253 a_stack.push_back(*v);
259 std::vector<std::string> ws;
260 words(a_s,
"=",
false,ws);
262 std::vector<std::string> swords;
263 words(ws[0],
" ",
false,swords);
264 if(swords.size()==2) {
269 if(swords[0]==
"ITuple") {
279 if(!
s2type(swords[0],type)){
280 m_out <<
"tools::columns::finder::analyse_dcl :"
281 <<
" s2type failed for " <<
sout(swords[0]) <<
"."
289 m_out <<
"tools::columns::finder::analyse_dcl :"
290 <<
" syntax error in " <<
sout(a_s) <<
"."
291 <<
" new_value() failed."
300 }
else if(swords.size()==1) {
302 m_out <<
"tools::columns::finder::analyse_dcl :"
303 <<
" (1) current type is NONE."
311 m_out <<
"tools::columns::finder::analyse_dcl :"
312 <<
" syntax error in " <<
sout(a_s) <<
"."
313 <<
" Bad value " <<
sout(ws[1]) <<
"."
321 m_out <<
"tools::columns::finder::analyse_dcl :"
322 <<
" syntax error in " <<
sout(a_s)
328 }
else if(ws.size()==1) {
331 std::vector<std::string> swords;
332 words(ws[0],
" ",
false,swords);
333 if(swords.size()==2) {
337 if(swords[0]==
"ITuple") {
346 if(!
s2type(swords[0],type)){
347 m_out <<
"tools::columns::finder::analyse_dcl :"
348 <<
" s2type failed for " <<
sout(swords[0]) <<
"."
355 m_out <<
"tools::columns::finder::analyse_dcl :"
356 <<
" (2) syntax error in " <<
sout(ws[0]) <<
"."
357 <<
" Unknown type " <<
sout(swords[0]) <<
"."
365 }
else if(swords.size()==1) {
368 m_out <<
"tools::columns::finder::analyse_dcl :"
369 <<
" (1) current type is NONE."
380 m_out <<
"tools::columns::finder::analyse_dcl :"
381 <<
" syntax error in " <<
sout(a_s)
388 m_out <<
"tools::columns::finder::analyse_dcl :"
389 <<
" syntax error in " <<
sout(a_s)
399 }
else if(a_s==
"double") {
403 }
else if(a_s==
"short") {
405 }
else if(a_s==
"int") {
407 }
else if(a_s==
"long") {
409 }
else if((a_s==
"bool")||(a_s==
"boolean")) {
411 }
else if((a_s==
"string")||(a_s==
"java.lang.String")){
416 }
else if(a_s==
"float[]") {
418 }
else if(a_s==
"double[]") {
424 }
else if(a_s==
"short[]") {
426 }
else if(a_s==
"int[]") {
428 }
else if(a_s==
"long[]") {
430 }
else if((a_s==
"bool[]")||(a_s==
"boolean[]")) {
432 }
else if((a_s==
"string[]")||(a_s==
"java.lang.String[]")){
438 }
else if(a_s==
"ushort") {
440 }
else if(a_s==
"uint") {
442 }
else if(a_s==
"ulong") {
452 if(a_v.size()) {
if(!to<float>(a_v,v))
return 0;}
456 if(a_v.size()) {
if(!to<double>(a_v,v))
return 0;}
464 if(a_v.size()) {
if(!to<short>(a_v,v))
return 0;}
468 if(a_v.size()) {
if(!to<int>(a_v,v))
return 0;}
473 if(a_v.size()) {
if(!to<int64>(a_v,v))
return 0;}
477 if(a_v.size()) {
if(!
to(a_v,v))
return 0;}
481 if( (a_v.size()>=2) && (a_v[0]==
'"') && (a_v[a_v.size()-1]==
'"') ){
482 return new value(a_v.substr(1,a_v.size()-2));
484 return new value(a_v);
493 unsigned short v = 0;
494 if(a_v.size()) {
if(!to<unsigned short>(a_v,v))
return 0;}
498 if(a_v.size()) {
if(!to<unsigned int>(a_v,v))
return 0;}
503 if(a_v.size()) {
if(!to<uint64>(a_v,v))
return 0;}
507 if(a_v.size())
return 0;
512 if(a_v.size())
return 0;
527 if(a_v.size())
return 0;
532 if(a_v.size())
return 0;
537 if(a_v.size())
return 0;
542 if(a_v.size())
return 0;
547 if(a_v.size())
return 0;
#define TOOLS_SCLASS(a_name)
#define tools_vforit(a__T, a__v, a__it)