Index: /trunk/FACT++/src/rootifysql.cc
===================================================================
--- /trunk/FACT++/src/rootifysql.cc	(revision 19093)
+++ /trunk/FACT++/src/rootifysql.cc	(revision 19094)
@@ -137,5 +137,5 @@
     vector<string> queries;
 
-    string resub(string str, size_t indent)
+    string resub(string str)
     {
         // search for "KEYWORD expression"
@@ -152,5 +152,5 @@
             const auto idx = atoi(arg.c_str()+1);
 
-            str.replace(pos, len, resub(vec[idx], indent));
+            str.replace(pos, len, resub(vec[idx]));
         }
 
@@ -175,5 +175,5 @@
                 if (vec[idx].substr(0,2)=="({")
                 {
-                    cout << setw(indent) << ' ' << "(" << resub(vec[idx], indent+4) << ") ";
+                    cout << setw(indent) << ' ' << "(" << resub(vec[idx]) << ") ";
                 }
                 else
@@ -181,5 +181,5 @@
                     if (indent>0)
                         cout << setw(indent) << ' ';
-                    cout << vec[idx];
+                    cout << resub(vec[idx]);
                 }
         }
@@ -188,5 +188,5 @@
             if (indent>0)
                 cout << setw(indent) << ' ';
-            cout << expr;
+            cout << resub(expr);
         }
     }
@@ -199,5 +199,5 @@
         const string _com = "\\/\\*\\ select\\#[0-9]+\\ \\*\\/\\ *";
 
-        const string _tok = "[a-zA-Z ]+";
+        const string _tok = "[a-zA-Z_ ]+";
 
         const string _nnn = "\\{[0-9]+\\}|[0-9]+";
@@ -261,5 +261,5 @@
 
         // substitute all paranthesis
-        sql = substitute(sql, "\\([^\\(\\)]*\\)");
+        sql = substitute(sql, "[a-zA-Z0-9_]*\\([^\\(\\)]*\\)");
 
         //cout << sql << "\n\n";
