Commits

Ivan Kurnosov committed ad0bd88

First specific node "SelectNode" created

  • Participants
  • Parent commits 6e4bcaf

Comments (0)

Files changed (5)

MysqlParser/MysqlParser.csproj

     <Compile Include="PonySQLLexer.cs" />
     <Compile Include="PonySQLParser.cs" />
     <Compile Include="Properties\AssemblyInfo.cs" />
+    <Compile Include="SelectNode.cs" />
   </ItemGroup>
   <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
   <!-- To modify your build process, add your task inside one of the targets below and uncomment it. 

MysqlParser/PonySQLLexer.cs

-// $ANTLR 3.2 Sep 23, 2009 12:02:23 C:\\projects\\pony\\_grammatics\\PonySQL.g 2010-11-23 04:40:46
+// $ANTLR 3.2 Sep 23, 2009 12:02:23 D:\\projects\\PonyFormatter\\_grammatics\\PonySQL.g 2010-11-28 20:09:16
 
 // The variable 'variable' is assigned but its value is never used.
 #pragma warning disable 168, 219
     
     override public string GrammarFileName
     {
-    	get { return "C:\\projects\\pony\\_grammatics\\PonySQL.g";} 
+    	get { return "D:\\projects\\PonyFormatter\\_grammatics\\PonySQL.g";} 
     }
 
     // $ANTLR start "T__15"
     		{
             int _type = T__15;
     	int _channel = DEFAULT_TOKEN_CHANNEL;
-            // C:\\projects\\pony\\_grammatics\\PonySQL.g:11:7: ( '(' )
-            // C:\\projects\\pony\\_grammatics\\PonySQL.g:11:9: '('
+            // D:\\projects\\PonyFormatter\\_grammatics\\PonySQL.g:11:7: ( '(' )
+            // D:\\projects\\PonyFormatter\\_grammatics\\PonySQL.g:11:9: '('
             {
             	Match('('); 
 
     		{
             int _type = T__16;
     	int _channel = DEFAULT_TOKEN_CHANNEL;
-            // C:\\projects\\pony\\_grammatics\\PonySQL.g:12:7: ( ')' )
-            // C:\\projects\\pony\\_grammatics\\PonySQL.g:12:9: ')'
+            // D:\\projects\\PonyFormatter\\_grammatics\\PonySQL.g:12:7: ( ')' )
+            // D:\\projects\\PonyFormatter\\_grammatics\\PonySQL.g:12:9: ')'
             {
             	Match(')'); 
 
     		{
             int _type = T__17;
     	int _channel = DEFAULT_TOKEN_CHANNEL;
-            // C:\\projects\\pony\\_grammatics\\PonySQL.g:13:7: ( '+' )
-            // C:\\projects\\pony\\_grammatics\\PonySQL.g:13:9: '+'
+            // D:\\projects\\PonyFormatter\\_grammatics\\PonySQL.g:13:7: ( '+' )
+            // D:\\projects\\PonyFormatter\\_grammatics\\PonySQL.g:13:9: '+'
             {
             	Match('+'); 
 
     		{
             int _type = T__18;
     	int _channel = DEFAULT_TOKEN_CHANNEL;
-            // C:\\projects\\pony\\_grammatics\\PonySQL.g:14:7: ( '-' )
-            // C:\\projects\\pony\\_grammatics\\PonySQL.g:14:9: '-'
+            // D:\\projects\\PonyFormatter\\_grammatics\\PonySQL.g:14:7: ( '-' )
+            // D:\\projects\\PonyFormatter\\_grammatics\\PonySQL.g:14:9: '-'
             {
             	Match('-'); 
 
     		{
             int _type = ASTERISK;
     	int _channel = DEFAULT_TOKEN_CHANNEL;
-            // C:\\projects\\pony\\_grammatics\\PonySQL.g:82:9: ( '*' )
-            // C:\\projects\\pony\\_grammatics\\PonySQL.g:82:11: '*'
+            // D:\\projects\\PonyFormatter\\_grammatics\\PonySQL.g:83:9: ( '*' )
+            // D:\\projects\\PonyFormatter\\_grammatics\\PonySQL.g:83:11: '*'
             {
             	Match('*'); 
 
     		{
             int _type = SELECT;
     	int _channel = DEFAULT_TOKEN_CHANNEL;
-            // C:\\projects\\pony\\_grammatics\\PonySQL.g:83:9: ( ( 'SELECT' | 'select' ) )
-            // C:\\projects\\pony\\_grammatics\\PonySQL.g:83:11: ( 'SELECT' | 'select' )
+            // D:\\projects\\PonyFormatter\\_grammatics\\PonySQL.g:84:9: ( ( 'SELECT' | 'select' ) )
+            // D:\\projects\\PonyFormatter\\_grammatics\\PonySQL.g:84:11: ( 'SELECT' | 'select' )
             {
-            	// C:\\projects\\pony\\_grammatics\\PonySQL.g:83:11: ( 'SELECT' | 'select' )
+            	// D:\\projects\\PonyFormatter\\_grammatics\\PonySQL.g:84:11: ( 'SELECT' | 'select' )
             	int alt1 = 2;
             	int LA1_0 = input.LA(1);
 
             	switch (alt1) 
             	{
             	    case 1 :
-            	        // C:\\projects\\pony\\_grammatics\\PonySQL.g:83:12: 'SELECT'
+            	        // D:\\projects\\PonyFormatter\\_grammatics\\PonySQL.g:84:12: 'SELECT'
             	        {
             	        	Match("SELECT"); 
 
             	        }
             	        break;
             	    case 2 :
-            	        // C:\\projects\\pony\\_grammatics\\PonySQL.g:83:21: 'select'
+            	        // D:\\projects\\PonyFormatter\\_grammatics\\PonySQL.g:84:21: 'select'
             	        {
             	        	Match("select"); 
 
     		{
             int _type = FROM;
     	int _channel = DEFAULT_TOKEN_CHANNEL;
-            // C:\\projects\\pony\\_grammatics\\PonySQL.g:84:6: ( ( 'FROM' | 'from' ) )
-            // C:\\projects\\pony\\_grammatics\\PonySQL.g:84:8: ( 'FROM' | 'from' )
+            // D:\\projects\\PonyFormatter\\_grammatics\\PonySQL.g:85:6: ( ( 'FROM' | 'from' ) )
+            // D:\\projects\\PonyFormatter\\_grammatics\\PonySQL.g:85:8: ( 'FROM' | 'from' )
             {
-            	// C:\\projects\\pony\\_grammatics\\PonySQL.g:84:8: ( 'FROM' | 'from' )
+            	// D:\\projects\\PonyFormatter\\_grammatics\\PonySQL.g:85:8: ( 'FROM' | 'from' )
             	int alt2 = 2;
             	int LA2_0 = input.LA(1);
 
             	switch (alt2) 
             	{
             	    case 1 :
-            	        // C:\\projects\\pony\\_grammatics\\PonySQL.g:84:9: 'FROM'
+            	        // D:\\projects\\PonyFormatter\\_grammatics\\PonySQL.g:85:9: 'FROM'
             	        {
             	        	Match("FROM"); 
 
             	        }
             	        break;
             	    case 2 :
-            	        // C:\\projects\\pony\\_grammatics\\PonySQL.g:84:16: 'from'
+            	        // D:\\projects\\PonyFormatter\\_grammatics\\PonySQL.g:85:16: 'from'
             	        {
             	        	Match("from"); 
 
     		{
             int _type = ORDER_BY;
     	int _channel = DEFAULT_TOKEN_CHANNEL;
-            // C:\\projects\\pony\\_grammatics\\PonySQL.g:85:9: ( ( 'ORDER BY' | 'order by' ) )
-            // C:\\projects\\pony\\_grammatics\\PonySQL.g:85:11: ( 'ORDER BY' | 'order by' )
+            // D:\\projects\\PonyFormatter\\_grammatics\\PonySQL.g:86:9: ( ( 'ORDER BY' | 'order by' ) )
+            // D:\\projects\\PonyFormatter\\_grammatics\\PonySQL.g:86:11: ( 'ORDER BY' | 'order by' )
             {
-            	// C:\\projects\\pony\\_grammatics\\PonySQL.g:85:11: ( 'ORDER BY' | 'order by' )
+            	// D:\\projects\\PonyFormatter\\_grammatics\\PonySQL.g:86:11: ( 'ORDER BY' | 'order by' )
             	int alt3 = 2;
             	int LA3_0 = input.LA(1);
 
             	switch (alt3) 
             	{
             	    case 1 :
-            	        // C:\\projects\\pony\\_grammatics\\PonySQL.g:85:12: 'ORDER BY'
+            	        // D:\\projects\\PonyFormatter\\_grammatics\\PonySQL.g:86:12: 'ORDER BY'
             	        {
             	        	Match("ORDER BY"); 
 
             	        }
             	        break;
             	    case 2 :
-            	        // C:\\projects\\pony\\_grammatics\\PonySQL.g:85:23: 'order by'
+            	        // D:\\projects\\PonyFormatter\\_grammatics\\PonySQL.g:86:23: 'order by'
             	        {
             	        	Match("order by"); 
 
     		{
             int _type = ASC_DESC;
     	int _channel = DEFAULT_TOKEN_CHANNEL;
-            // C:\\projects\\pony\\_grammatics\\PonySQL.g:86:9: ( ( 'ASC' | 'asc' | 'DESC' | 'desc' ) )
-            // C:\\projects\\pony\\_grammatics\\PonySQL.g:86:11: ( 'ASC' | 'asc' | 'DESC' | 'desc' )
+            // D:\\projects\\PonyFormatter\\_grammatics\\PonySQL.g:87:9: ( ( 'ASC' | 'asc' | 'DESC' | 'desc' ) )
+            // D:\\projects\\PonyFormatter\\_grammatics\\PonySQL.g:87:11: ( 'ASC' | 'asc' | 'DESC' | 'desc' )
             {
-            	// C:\\projects\\pony\\_grammatics\\PonySQL.g:86:11: ( 'ASC' | 'asc' | 'DESC' | 'desc' )
+            	// D:\\projects\\PonyFormatter\\_grammatics\\PonySQL.g:87:11: ( 'ASC' | 'asc' | 'DESC' | 'desc' )
             	int alt4 = 4;
             	switch ( input.LA(1) ) 
             	{
             	switch (alt4) 
             	{
             	    case 1 :
-            	        // C:\\projects\\pony\\_grammatics\\PonySQL.g:86:12: 'ASC'
+            	        // D:\\projects\\PonyFormatter\\_grammatics\\PonySQL.g:87:12: 'ASC'
             	        {
             	        	Match("ASC"); 
 
             	        }
             	        break;
             	    case 2 :
-            	        // C:\\projects\\pony\\_grammatics\\PonySQL.g:86:18: 'asc'
+            	        // D:\\projects\\PonyFormatter\\_grammatics\\PonySQL.g:87:18: 'asc'
             	        {
             	        	Match("asc"); 
 
             	        }
             	        break;
             	    case 3 :
-            	        // C:\\projects\\pony\\_grammatics\\PonySQL.g:86:24: 'DESC'
+            	        // D:\\projects\\PonyFormatter\\_grammatics\\PonySQL.g:87:24: 'DESC'
             	        {
             	        	Match("DESC"); 
 
             	        }
             	        break;
             	    case 4 :
-            	        // C:\\projects\\pony\\_grammatics\\PonySQL.g:86:31: 'desc'
+            	        // D:\\projects\\PonyFormatter\\_grammatics\\PonySQL.g:87:31: 'desc'
             	        {
             	        	Match("desc"); 
 
     		{
             int _type = ID;
     	int _channel = DEFAULT_TOKEN_CHANNEL;
-            // C:\\projects\\pony\\_grammatics\\PonySQL.g:88:4: ( ( 'A' .. 'Z' | 'a' .. 'z' ) ( 'A' .. 'Z' | 'a' .. 'z' | '0' .. '9' | '_' | '$' | '#' )* )
-            // C:\\projects\\pony\\_grammatics\\PonySQL.g:88:6: ( 'A' .. 'Z' | 'a' .. 'z' ) ( 'A' .. 'Z' | 'a' .. 'z' | '0' .. '9' | '_' | '$' | '#' )*
+            // D:\\projects\\PonyFormatter\\_grammatics\\PonySQL.g:89:4: ( ( 'A' .. 'Z' | 'a' .. 'z' ) ( 'A' .. 'Z' | 'a' .. 'z' | '0' .. '9' | '_' | '$' | '#' )* )
+            // D:\\projects\\PonyFormatter\\_grammatics\\PonySQL.g:89:6: ( 'A' .. 'Z' | 'a' .. 'z' ) ( 'A' .. 'Z' | 'a' .. 'z' | '0' .. '9' | '_' | '$' | '#' )*
             {
             	if ( (input.LA(1) >= 'A' && input.LA(1) <= 'Z') || (input.LA(1) >= 'a' && input.LA(1) <= 'z') ) 
             	{
             	    Recover(mse);
             	    throw mse;}
 
-            	// C:\\projects\\pony\\_grammatics\\PonySQL.g:88:31: ( 'A' .. 'Z' | 'a' .. 'z' | '0' .. '9' | '_' | '$' | '#' )*
+            	// D:\\projects\\PonyFormatter\\_grammatics\\PonySQL.g:89:31: ( 'A' .. 'Z' | 'a' .. 'z' | '0' .. '9' | '_' | '$' | '#' )*
             	do 
             	{
             	    int alt5 = 2;
             	    switch (alt5) 
             		{
             			case 1 :
-            			    // C:\\projects\\pony\\_grammatics\\PonySQL.g:
+            			    // D:\\projects\\PonyFormatter\\_grammatics\\PonySQL.g:
             			    {
             			    	if ( (input.LA(1) >= '#' && input.LA(1) <= '$') || (input.LA(1) >= '0' && input.LA(1) <= '9') || (input.LA(1) >= 'A' && input.LA(1) <= 'Z') || input.LA(1) == '_' || (input.LA(1) >= 'a' && input.LA(1) <= 'z') ) 
             			    	{
     		{
             int _type = INT;
     	int _channel = DEFAULT_TOKEN_CHANNEL;
-            // C:\\projects\\pony\\_grammatics\\PonySQL.g:89:5: ( ( '0' .. '9' )+ )
-            // C:\\projects\\pony\\_grammatics\\PonySQL.g:89:7: ( '0' .. '9' )+
+            // D:\\projects\\PonyFormatter\\_grammatics\\PonySQL.g:90:5: ( ( '0' .. '9' )+ )
+            // D:\\projects\\PonyFormatter\\_grammatics\\PonySQL.g:90:7: ( '0' .. '9' )+
             {
-            	// C:\\projects\\pony\\_grammatics\\PonySQL.g:89:7: ( '0' .. '9' )+
+            	// D:\\projects\\PonyFormatter\\_grammatics\\PonySQL.g:90:7: ( '0' .. '9' )+
             	int cnt6 = 0;
             	do 
             	{
             	    switch (alt6) 
             		{
             			case 1 :
-            			    // C:\\projects\\pony\\_grammatics\\PonySQL.g:89:8: '0' .. '9'
+            			    // D:\\projects\\PonyFormatter\\_grammatics\\PonySQL.g:90:8: '0' .. '9'
             			    {
             			    	MatchRange('0','9'); 
 
     		{
             int _type = COMMA;
     	int _channel = DEFAULT_TOKEN_CHANNEL;
-            // C:\\projects\\pony\\_grammatics\\PonySQL.g:91:7: ( ',' )
-            // C:\\projects\\pony\\_grammatics\\PonySQL.g:91:9: ','
+            // D:\\projects\\PonyFormatter\\_grammatics\\PonySQL.g:92:7: ( ',' )
+            // D:\\projects\\PonyFormatter\\_grammatics\\PonySQL.g:92:9: ','
             {
             	Match(','); 
 
     		{
             int _type = WS;
     	int _channel = DEFAULT_TOKEN_CHANNEL;
-            // C:\\projects\\pony\\_grammatics\\PonySQL.g:94:9: ( ( ' ' | '\\r' | '\\t' | '\\n' )+ )
-            // C:\\projects\\pony\\_grammatics\\PonySQL.g:94:17: ( ' ' | '\\r' | '\\t' | '\\n' )+
+            // D:\\projects\\PonyFormatter\\_grammatics\\PonySQL.g:95:9: ( ( ' ' | '\\r' | '\\t' | '\\n' )+ )
+            // D:\\projects\\PonyFormatter\\_grammatics\\PonySQL.g:95:17: ( ' ' | '\\r' | '\\t' | '\\n' )+
             {
-            	// C:\\projects\\pony\\_grammatics\\PonySQL.g:94:17: ( ' ' | '\\r' | '\\t' | '\\n' )+
+            	// D:\\projects\\PonyFormatter\\_grammatics\\PonySQL.g:95:17: ( ' ' | '\\r' | '\\t' | '\\n' )+
             	int cnt7 = 0;
             	do 
             	{
             	    switch (alt7) 
             		{
             			case 1 :
-            			    // C:\\projects\\pony\\_grammatics\\PonySQL.g:
+            			    // D:\\projects\\PonyFormatter\\_grammatics\\PonySQL.g:
             			    {
             			    	if ( (input.LA(1) >= '\t' && input.LA(1) <= '\n') || input.LA(1) == '\r' || input.LA(1) == ' ' ) 
             			    	{
 
     override public void mTokens() // throws RecognitionException 
     {
-        // C:\\projects\\pony\\_grammatics\\PonySQL.g:1:8: ( T__15 | T__16 | T__17 | T__18 | ASTERISK | SELECT | FROM | ORDER_BY | ASC_DESC | ID | INT | COMMA | WS )
+        // D:\\projects\\PonyFormatter\\_grammatics\\PonySQL.g:1:8: ( T__15 | T__16 | T__17 | T__18 | ASTERISK | SELECT | FROM | ORDER_BY | ASC_DESC | ID | INT | COMMA | WS )
         int alt8 = 13;
         alt8 = dfa8.Predict(input);
         switch (alt8) 
         {
             case 1 :
-                // C:\\projects\\pony\\_grammatics\\PonySQL.g:1:10: T__15
+                // D:\\projects\\PonyFormatter\\_grammatics\\PonySQL.g:1:10: T__15
                 {
                 	mT__15(); 
 
                 }
                 break;
             case 2 :
-                // C:\\projects\\pony\\_grammatics\\PonySQL.g:1:16: T__16
+                // D:\\projects\\PonyFormatter\\_grammatics\\PonySQL.g:1:16: T__16
                 {
                 	mT__16(); 
 
                 }
                 break;
             case 3 :
-                // C:\\projects\\pony\\_grammatics\\PonySQL.g:1:22: T__17
+                // D:\\projects\\PonyFormatter\\_grammatics\\PonySQL.g:1:22: T__17
                 {
                 	mT__17(); 
 
                 }
                 break;
             case 4 :
-                // C:\\projects\\pony\\_grammatics\\PonySQL.g:1:28: T__18
+                // D:\\projects\\PonyFormatter\\_grammatics\\PonySQL.g:1:28: T__18
                 {
                 	mT__18(); 
 
                 }
                 break;
             case 5 :
-                // C:\\projects\\pony\\_grammatics\\PonySQL.g:1:34: ASTERISK
+                // D:\\projects\\PonyFormatter\\_grammatics\\PonySQL.g:1:34: ASTERISK
                 {
                 	mASTERISK(); 
 
                 }
                 break;
             case 6 :
-                // C:\\projects\\pony\\_grammatics\\PonySQL.g:1:43: SELECT
+                // D:\\projects\\PonyFormatter\\_grammatics\\PonySQL.g:1:43: SELECT
                 {
                 	mSELECT(); 
 
                 }
                 break;
             case 7 :
-                // C:\\projects\\pony\\_grammatics\\PonySQL.g:1:50: FROM
+                // D:\\projects\\PonyFormatter\\_grammatics\\PonySQL.g:1:50: FROM
                 {
                 	mFROM(); 
 
                 }
                 break;
             case 8 :
-                // C:\\projects\\pony\\_grammatics\\PonySQL.g:1:55: ORDER_BY
+                // D:\\projects\\PonyFormatter\\_grammatics\\PonySQL.g:1:55: ORDER_BY
                 {
                 	mORDER_BY(); 
 
                 }
                 break;
             case 9 :
-                // C:\\projects\\pony\\_grammatics\\PonySQL.g:1:64: ASC_DESC
+                // D:\\projects\\PonyFormatter\\_grammatics\\PonySQL.g:1:64: ASC_DESC
                 {
                 	mASC_DESC(); 
 
                 }
                 break;
             case 10 :
-                // C:\\projects\\pony\\_grammatics\\PonySQL.g:1:73: ID
+                // D:\\projects\\PonyFormatter\\_grammatics\\PonySQL.g:1:73: ID
                 {
                 	mID(); 
 
                 }
                 break;
             case 11 :
-                // C:\\projects\\pony\\_grammatics\\PonySQL.g:1:76: INT
+                // D:\\projects\\PonyFormatter\\_grammatics\\PonySQL.g:1:76: INT
                 {
                 	mINT(); 
 
                 }
                 break;
             case 12 :
-                // C:\\projects\\pony\\_grammatics\\PonySQL.g:1:80: COMMA
+                // D:\\projects\\PonyFormatter\\_grammatics\\PonySQL.g:1:80: COMMA
                 {
                 	mCOMMA(); 
 
                 }
                 break;
             case 13 :
-                // C:\\projects\\pony\\_grammatics\\PonySQL.g:1:86: WS
+                // D:\\projects\\PonyFormatter\\_grammatics\\PonySQL.g:1:86: WS
                 {
                 	mWS(); 
 

MysqlParser/PonySQLParser.cs

-// $ANTLR 3.2 Sep 23, 2009 12:02:23 C:\\projects\\pony\\_grammatics\\PonySQL.g 2010-11-23 04:40:46
+// $ANTLR 3.2 Sep 23, 2009 12:02:23 D:\\projects\\PonyFormatter\\_grammatics\\PonySQL.g 2010-11-28 20:09:16
 
 // The variable 'variable' is assigned but its value is never used.
 #pragma warning disable 168, 219
     }
 
     override public string GrammarFileName {
-		get { return "C:\\projects\\pony\\_grammatics\\PonySQL.g"; }
+		get { return "D:\\projects\\PonyFormatter\\_grammatics\\PonySQL.g"; }
     }
 
 
     };
 
     // $ANTLR start "query"
-    // C:\\projects\\pony\\_grammatics\\PonySQL.g:25:1: query : select_statement ;
+    // D:\\projects\\PonyFormatter\\_grammatics\\PonySQL.g:26:1: query : select_statement ;
     public PonySQLParser.query_return query() // throws RecognitionException [1]
     {   
         PonySQLParser.query_return retval = new PonySQLParser.query_return();
     	    {
     	    	return retval; 
     	    }
-            // C:\\projects\\pony\\_grammatics\\PonySQL.g:25:8: ( select_statement )
-            // C:\\projects\\pony\\_grammatics\\PonySQL.g:25:10: select_statement
+            // D:\\projects\\PonyFormatter\\_grammatics\\PonySQL.g:26:8: ( select_statement )
+            // D:\\projects\\PonyFormatter\\_grammatics\\PonySQL.g:26:10: select_statement
             {
             	root_0 = (object)adaptor.GetNilNode();
 
-            	PushFollow(FOLLOW_select_statement_in_query71);
+            	PushFollow(FOLLOW_select_statement_in_query72);
             	select_statement1 = select_statement();
             	state.followingStackPointer--;
             	if (state.failed) return retval;
     };
 
     // $ANTLR start "select_statement"
-    // C:\\projects\\pony\\_grammatics\\PonySQL.g:27:1: select_statement : select_list ( from_list )? ( order_by_list )? -> ^( T_SELECT select_list ( from_list )? ( order_by_list )? ) ;
+    // D:\\projects\\PonyFormatter\\_grammatics\\PonySQL.g:28:1: select_statement : select_list ( from_list )? ( order_by_list )? -> ^( select_list ( from_list )? ( order_by_list )? ) ;
     public PonySQLParser.select_statement_return select_statement() // throws RecognitionException [1]
     {   
         PonySQLParser.select_statement_return retval = new PonySQLParser.select_statement_return();
     	    {
     	    	return retval; 
     	    }
-            // C:\\projects\\pony\\_grammatics\\PonySQL.g:28:2: ( select_list ( from_list )? ( order_by_list )? -> ^( T_SELECT select_list ( from_list )? ( order_by_list )? ) )
-            // C:\\projects\\pony\\_grammatics\\PonySQL.g:28:4: select_list ( from_list )? ( order_by_list )?
+            // D:\\projects\\PonyFormatter\\_grammatics\\PonySQL.g:29:2: ( select_list ( from_list )? ( order_by_list )? -> ^( select_list ( from_list )? ( order_by_list )? ) )
+            // D:\\projects\\PonyFormatter\\_grammatics\\PonySQL.g:29:4: select_list ( from_list )? ( order_by_list )?
             {
-            	PushFollow(FOLLOW_select_list_in_select_statement80);
+            	PushFollow(FOLLOW_select_list_in_select_statement81);
             	select_list2 = select_list();
             	state.followingStackPointer--;
             	if (state.failed) return retval;
             	if ( (state.backtracking==0) ) stream_select_list.Add(select_list2.Tree);
-            	// C:\\projects\\pony\\_grammatics\\PonySQL.g:29:3: ( from_list )?
+            	// D:\\projects\\PonyFormatter\\_grammatics\\PonySQL.g:30:3: ( from_list )?
             	int alt1 = 2;
             	int LA1_0 = input.LA(1);
 
             	switch (alt1) 
             	{
             	    case 1 :
-            	        // C:\\projects\\pony\\_grammatics\\PonySQL.g:0:0: from_list
+            	        // D:\\projects\\PonyFormatter\\_grammatics\\PonySQL.g:0:0: from_list
             	        {
-            	        	PushFollow(FOLLOW_from_list_in_select_statement84);
+            	        	PushFollow(FOLLOW_from_list_in_select_statement85);
             	        	from_list3 = from_list();
             	        	state.followingStackPointer--;
             	        	if (state.failed) return retval;
 
             	}
 
-            	// C:\\projects\\pony\\_grammatics\\PonySQL.g:30:3: ( order_by_list )?
+            	// D:\\projects\\PonyFormatter\\_grammatics\\PonySQL.g:31:3: ( order_by_list )?
             	int alt2 = 2;
             	int LA2_0 = input.LA(1);
 
             	switch (alt2) 
             	{
             	    case 1 :
-            	        // C:\\projects\\pony\\_grammatics\\PonySQL.g:0:0: order_by_list
+            	        // D:\\projects\\PonyFormatter\\_grammatics\\PonySQL.g:0:0: order_by_list
             	        {
-            	        	PushFollow(FOLLOW_order_by_list_in_select_statement89);
+            	        	PushFollow(FOLLOW_order_by_list_in_select_statement90);
             	        	order_by_list4 = order_by_list();
             	        	state.followingStackPointer--;
             	        	if (state.failed) return retval;
 
 
             	// AST REWRITE
-            	// elements:          order_by_list, select_list, from_list
+            	// elements:          select_list, order_by_list, from_list
             	// token labels:      
             	// rule labels:       retval
             	// token list labels: 
             	RewriteRuleSubtreeStream stream_retval = new RewriteRuleSubtreeStream(adaptor, "rule retval", retval!=null ? retval.Tree : null);
 
             	root_0 = (object)adaptor.GetNilNode();
-            	// 32:3: -> ^( T_SELECT select_list ( from_list )? ( order_by_list )? )
+            	// 33:3: -> ^( select_list ( from_list )? ( order_by_list )? )
             	{
-            	    // C:\\projects\\pony\\_grammatics\\PonySQL.g:32:6: ^( T_SELECT select_list ( from_list )? ( order_by_list )? )
+            	    // D:\\projects\\PonyFormatter\\_grammatics\\PonySQL.g:33:6: ^( select_list ( from_list )? ( order_by_list )? )
             	    {
             	    object root_1 = (object)adaptor.GetNilNode();
-            	    root_1 = (object)adaptor.BecomeRoot((object)adaptor.Create(T_SELECT, "T_SELECT"), root_1);
+            	    root_1 = (object)adaptor.BecomeRoot(stream_select_list.NextNode(), root_1);
 
-            	    adaptor.AddChild(root_1, stream_select_list.NextTree());
-            	    // C:\\projects\\pony\\_grammatics\\PonySQL.g:32:29: ( from_list )?
+            	    // D:\\projects\\PonyFormatter\\_grammatics\\PonySQL.g:33:20: ( from_list )?
             	    if ( stream_from_list.HasNext() )
             	    {
             	        adaptor.AddChild(root_1, stream_from_list.NextTree());
 
             	    }
             	    stream_from_list.Reset();
-            	    // C:\\projects\\pony\\_grammatics\\PonySQL.g:32:40: ( order_by_list )?
+            	    // D:\\projects\\PonyFormatter\\_grammatics\\PonySQL.g:33:31: ( order_by_list )?
             	    if ( stream_order_by_list.HasNext() )
             	    {
             	        adaptor.AddChild(root_1, stream_order_by_list.NextTree());
     };
 
     // $ANTLR start "select_list"
-    // C:\\projects\\pony\\_grammatics\\PonySQL.g:35:1: select_list : SELECT select_expr ( COMMA select_expr )* -> ^( SELECT select_expr ( COMMA select_expr )* ) ;
+    // D:\\projects\\PonyFormatter\\_grammatics\\PonySQL.g:36:1: select_list : SELECT select_expr ( COMMA select_expr )* -> ^( SELECT select_expr ( COMMA select_expr )* ) ;
     public PonySQLParser.select_list_return select_list() // throws RecognitionException [1]
     {   
         PonySQLParser.select_list_return retval = new PonySQLParser.select_list_return();
     	    {
     	    	return retval; 
     	    }
-            // C:\\projects\\pony\\_grammatics\\PonySQL.g:36:2: ( SELECT select_expr ( COMMA select_expr )* -> ^( SELECT select_expr ( COMMA select_expr )* ) )
-            // C:\\projects\\pony\\_grammatics\\PonySQL.g:36:4: SELECT select_expr ( COMMA select_expr )*
+            // D:\\projects\\PonyFormatter\\_grammatics\\PonySQL.g:37:2: ( SELECT select_expr ( COMMA select_expr )* -> ^( SELECT select_expr ( COMMA select_expr )* ) )
+            // D:\\projects\\PonyFormatter\\_grammatics\\PonySQL.g:37:4: SELECT select_expr ( COMMA select_expr )*
             {
-            	SELECT5=(IToken)Match(input,SELECT,FOLLOW_SELECT_in_select_list120); if (state.failed) return retval; 
+            	SELECT5=(IToken)Match(input,SELECT,FOLLOW_SELECT_in_select_list119); if (state.failed) return retval; 
             	if ( (state.backtracking==0) ) stream_SELECT.Add(SELECT5);
 
-            	PushFollow(FOLLOW_select_expr_in_select_list122);
+            	PushFollow(FOLLOW_select_expr_in_select_list121);
             	select_expr6 = select_expr();
             	state.followingStackPointer--;
             	if (state.failed) return retval;
             	if ( (state.backtracking==0) ) stream_select_expr.Add(select_expr6.Tree);
-            	// C:\\projects\\pony\\_grammatics\\PonySQL.g:36:23: ( COMMA select_expr )*
+            	// D:\\projects\\PonyFormatter\\_grammatics\\PonySQL.g:37:23: ( COMMA select_expr )*
             	do 
             	{
             	    int alt3 = 2;
             	    switch (alt3) 
             		{
             			case 1 :
-            			    // C:\\projects\\pony\\_grammatics\\PonySQL.g:36:24: COMMA select_expr
+            			    // D:\\projects\\PonyFormatter\\_grammatics\\PonySQL.g:37:24: COMMA select_expr
             			    {
-            			    	COMMA7=(IToken)Match(input,COMMA,FOLLOW_COMMA_in_select_list125); if (state.failed) return retval; 
+            			    	COMMA7=(IToken)Match(input,COMMA,FOLLOW_COMMA_in_select_list124); if (state.failed) return retval; 
             			    	if ( (state.backtracking==0) ) stream_COMMA.Add(COMMA7);
 
-            			    	PushFollow(FOLLOW_select_expr_in_select_list127);
+            			    	PushFollow(FOLLOW_select_expr_in_select_list126);
             			    	select_expr8 = select_expr();
             			    	state.followingStackPointer--;
             			    	if (state.failed) return retval;
 
 
             	// AST REWRITE
-            	// elements:          select_expr, SELECT, select_expr, COMMA
+            	// elements:          SELECT, COMMA, select_expr, select_expr
             	// token labels:      
             	// rule labels:       retval
             	// token list labels: 
             	RewriteRuleSubtreeStream stream_retval = new RewriteRuleSubtreeStream(adaptor, "rule retval", retval!=null ? retval.Tree : null);
 
             	root_0 = (object)adaptor.GetNilNode();
-            	// 37:3: -> ^( SELECT select_expr ( COMMA select_expr )* )
+            	// 38:3: -> ^( SELECT select_expr ( COMMA select_expr )* )
             	{
-            	    // C:\\projects\\pony\\_grammatics\\PonySQL.g:37:6: ^( SELECT select_expr ( COMMA select_expr )* )
+            	    // D:\\projects\\PonyFormatter\\_grammatics\\PonySQL.g:38:6: ^( SELECT select_expr ( COMMA select_expr )* )
             	    {
             	    object root_1 = (object)adaptor.GetNilNode();
-            	    root_1 = (object)adaptor.BecomeRoot(stream_SELECT.NextNode(), root_1);
+            	    root_1 = (object)adaptor.BecomeRoot(new SelectNode(stream_SELECT.NextToken()), root_1);
 
             	    adaptor.AddChild(root_1, stream_select_expr.NextTree());
-            	    // C:\\projects\\pony\\_grammatics\\PonySQL.g:37:27: ( COMMA select_expr )*
-            	    while ( stream_select_expr.HasNext() || stream_COMMA.HasNext() )
+            	    // D:\\projects\\PonyFormatter\\_grammatics\\PonySQL.g:38:39: ( COMMA select_expr )*
+            	    while ( stream_COMMA.HasNext() || stream_select_expr.HasNext() )
             	    {
             	        adaptor.AddChild(root_1, stream_COMMA.NextNode());
             	        adaptor.AddChild(root_1, stream_select_expr.NextTree());
 
             	    }
+            	    stream_COMMA.Reset();
             	    stream_select_expr.Reset();
-            	    stream_COMMA.Reset();
 
             	    adaptor.AddChild(root_0, root_1);
             	    }
     };
 
     // $ANTLR start "select_expr"
-    // C:\\projects\\pony\\_grammatics\\PonySQL.g:40:1: select_expr : ( ASTERISK | expr );
+    // D:\\projects\\PonyFormatter\\_grammatics\\PonySQL.g:41:1: select_expr : ( ASTERISK | expr );
     public PonySQLParser.select_expr_return select_expr() // throws RecognitionException [1]
     {   
         PonySQLParser.select_expr_return retval = new PonySQLParser.select_expr_return();
     	    {
     	    	return retval; 
     	    }
-            // C:\\projects\\pony\\_grammatics\\PonySQL.g:41:2: ( ASTERISK | expr )
+            // D:\\projects\\PonyFormatter\\_grammatics\\PonySQL.g:42:2: ( ASTERISK | expr )
             int alt4 = 2;
             int LA4_0 = input.LA(1);
 
             switch (alt4) 
             {
                 case 1 :
-                    // C:\\projects\\pony\\_grammatics\\PonySQL.g:41:4: ASTERISK
+                    // D:\\projects\\PonyFormatter\\_grammatics\\PonySQL.g:42:4: ASTERISK
                     {
                     	root_0 = (object)adaptor.GetNilNode();
 
-                    	ASTERISK9=(IToken)Match(input,ASTERISK,FOLLOW_ASTERISK_in_select_expr157); if (state.failed) return retval;
+                    	ASTERISK9=(IToken)Match(input,ASTERISK,FOLLOW_ASTERISK_in_select_expr159); if (state.failed) return retval;
                     	if ( state.backtracking == 0 )
                     	{ASTERISK9_tree = (object)adaptor.Create(ASTERISK9);
                     		adaptor.AddChild(root_0, ASTERISK9_tree);
                     }
                     break;
                 case 2 :
-                    // C:\\projects\\pony\\_grammatics\\PonySQL.g:42:4: expr
+                    // D:\\projects\\PonyFormatter\\_grammatics\\PonySQL.g:43:4: expr
                     {
                     	root_0 = (object)adaptor.GetNilNode();
 
-                    	PushFollow(FOLLOW_expr_in_select_expr162);
+                    	PushFollow(FOLLOW_expr_in_select_expr164);
                     	expr10 = expr();
                     	state.followingStackPointer--;
                     	if (state.failed) return retval;
     };
 
     // $ANTLR start "from_list"
-    // C:\\projects\\pony\\_grammatics\\PonySQL.g:45:1: from_list : FROM from_expr -> ^( FROM from_expr ) ;
+    // D:\\projects\\PonyFormatter\\_grammatics\\PonySQL.g:46:1: from_list : FROM from_expr -> ^( FROM from_expr ) ;
     public PonySQLParser.from_list_return from_list() // throws RecognitionException [1]
     {   
         PonySQLParser.from_list_return retval = new PonySQLParser.from_list_return();
     	    {
     	    	return retval; 
     	    }
-            // C:\\projects\\pony\\_grammatics\\PonySQL.g:46:2: ( FROM from_expr -> ^( FROM from_expr ) )
-            // C:\\projects\\pony\\_grammatics\\PonySQL.g:46:4: FROM from_expr
+            // D:\\projects\\PonyFormatter\\_grammatics\\PonySQL.g:47:2: ( FROM from_expr -> ^( FROM from_expr ) )
+            // D:\\projects\\PonyFormatter\\_grammatics\\PonySQL.g:47:4: FROM from_expr
             {
-            	FROM11=(IToken)Match(input,FROM,FOLLOW_FROM_in_from_list174); if (state.failed) return retval; 
+            	FROM11=(IToken)Match(input,FROM,FOLLOW_FROM_in_from_list176); if (state.failed) return retval; 
             	if ( (state.backtracking==0) ) stream_FROM.Add(FROM11);
 
-            	PushFollow(FOLLOW_from_expr_in_from_list176);
+            	PushFollow(FOLLOW_from_expr_in_from_list178);
             	from_expr12 = from_expr();
             	state.followingStackPointer--;
             	if (state.failed) return retval;
             	RewriteRuleSubtreeStream stream_retval = new RewriteRuleSubtreeStream(adaptor, "rule retval", retval!=null ? retval.Tree : null);
 
             	root_0 = (object)adaptor.GetNilNode();
-            	// 47:3: -> ^( FROM from_expr )
+            	// 48:3: -> ^( FROM from_expr )
             	{
-            	    // C:\\projects\\pony\\_grammatics\\PonySQL.g:47:6: ^( FROM from_expr )
+            	    // D:\\projects\\PonyFormatter\\_grammatics\\PonySQL.g:48:6: ^( FROM from_expr )
             	    {
             	    object root_1 = (object)adaptor.GetNilNode();
             	    root_1 = (object)adaptor.BecomeRoot(stream_FROM.NextNode(), root_1);
     };
 
     // $ANTLR start "from_expr"
-    // C:\\projects\\pony\\_grammatics\\PonySQL.g:50:1: from_expr : id ;
+    // D:\\projects\\PonyFormatter\\_grammatics\\PonySQL.g:51:1: from_expr : id ;
     public PonySQLParser.from_expr_return from_expr() // throws RecognitionException [1]
     {   
         PonySQLParser.from_expr_return retval = new PonySQLParser.from_expr_return();
     	    {
     	    	return retval; 
     	    }
-            // C:\\projects\\pony\\_grammatics\\PonySQL.g:51:2: ( id )
-            // C:\\projects\\pony\\_grammatics\\PonySQL.g:51:4: id
+            // D:\\projects\\PonyFormatter\\_grammatics\\PonySQL.g:52:2: ( id )
+            // D:\\projects\\PonyFormatter\\_grammatics\\PonySQL.g:52:4: id
             {
             	root_0 = (object)adaptor.GetNilNode();
 
-            	PushFollow(FOLLOW_id_in_from_expr198);
+            	PushFollow(FOLLOW_id_in_from_expr200);
             	id13 = id();
             	state.followingStackPointer--;
             	if (state.failed) return retval;
     };
 
     // $ANTLR start "order_by_list"
-    // C:\\projects\\pony\\_grammatics\\PonySQL.g:54:1: order_by_list : ORDER_BY order_by_expr ( COMMA order_by_expr )* -> ^( ORDER_BY ( order_by_expr )* ) ;
+    // D:\\projects\\PonyFormatter\\_grammatics\\PonySQL.g:55:1: order_by_list : ORDER_BY order_by_expr ( COMMA order_by_expr )* -> ^( ORDER_BY ( order_by_expr )* ) ;
     public PonySQLParser.order_by_list_return order_by_list() // throws RecognitionException [1]
     {   
         PonySQLParser.order_by_list_return retval = new PonySQLParser.order_by_list_return();
     	    {
     	    	return retval; 
     	    }
-            // C:\\projects\\pony\\_grammatics\\PonySQL.g:55:2: ( ORDER_BY order_by_expr ( COMMA order_by_expr )* -> ^( ORDER_BY ( order_by_expr )* ) )
-            // C:\\projects\\pony\\_grammatics\\PonySQL.g:55:4: ORDER_BY order_by_expr ( COMMA order_by_expr )*
+            // D:\\projects\\PonyFormatter\\_grammatics\\PonySQL.g:56:2: ( ORDER_BY order_by_expr ( COMMA order_by_expr )* -> ^( ORDER_BY ( order_by_expr )* ) )
+            // D:\\projects\\PonyFormatter\\_grammatics\\PonySQL.g:56:4: ORDER_BY order_by_expr ( COMMA order_by_expr )*
             {
-            	ORDER_BY14=(IToken)Match(input,ORDER_BY,FOLLOW_ORDER_BY_in_order_by_list210); if (state.failed) return retval; 
+            	ORDER_BY14=(IToken)Match(input,ORDER_BY,FOLLOW_ORDER_BY_in_order_by_list212); if (state.failed) return retval; 
             	if ( (state.backtracking==0) ) stream_ORDER_BY.Add(ORDER_BY14);
 
-            	PushFollow(FOLLOW_order_by_expr_in_order_by_list212);
+            	PushFollow(FOLLOW_order_by_expr_in_order_by_list214);
             	order_by_expr15 = order_by_expr();
             	state.followingStackPointer--;
             	if (state.failed) return retval;
             	if ( (state.backtracking==0) ) stream_order_by_expr.Add(order_by_expr15.Tree);
-            	// C:\\projects\\pony\\_grammatics\\PonySQL.g:55:27: ( COMMA order_by_expr )*
+            	// D:\\projects\\PonyFormatter\\_grammatics\\PonySQL.g:56:27: ( COMMA order_by_expr )*
             	do 
             	{
             	    int alt5 = 2;
             	    switch (alt5) 
             		{
             			case 1 :
-            			    // C:\\projects\\pony\\_grammatics\\PonySQL.g:55:28: COMMA order_by_expr
+            			    // D:\\projects\\PonyFormatter\\_grammatics\\PonySQL.g:56:28: COMMA order_by_expr
             			    {
-            			    	COMMA16=(IToken)Match(input,COMMA,FOLLOW_COMMA_in_order_by_list215); if (state.failed) return retval; 
+            			    	COMMA16=(IToken)Match(input,COMMA,FOLLOW_COMMA_in_order_by_list217); if (state.failed) return retval; 
             			    	if ( (state.backtracking==0) ) stream_COMMA.Add(COMMA16);
 
-            			    	PushFollow(FOLLOW_order_by_expr_in_order_by_list217);
+            			    	PushFollow(FOLLOW_order_by_expr_in_order_by_list219);
             			    	order_by_expr17 = order_by_expr();
             			    	state.followingStackPointer--;
             			    	if (state.failed) return retval;
 
 
             	// AST REWRITE
-            	// elements:          ORDER_BY, order_by_expr
+            	// elements:          order_by_expr, ORDER_BY
             	// token labels:      
             	// rule labels:       retval
             	// token list labels: 
             	RewriteRuleSubtreeStream stream_retval = new RewriteRuleSubtreeStream(adaptor, "rule retval", retval!=null ? retval.Tree : null);
 
             	root_0 = (object)adaptor.GetNilNode();
-            	// 56:3: -> ^( ORDER_BY ( order_by_expr )* )
+            	// 57:3: -> ^( ORDER_BY ( order_by_expr )* )
             	{
-            	    // C:\\projects\\pony\\_grammatics\\PonySQL.g:56:6: ^( ORDER_BY ( order_by_expr )* )
+            	    // D:\\projects\\PonyFormatter\\_grammatics\\PonySQL.g:57:6: ^( ORDER_BY ( order_by_expr )* )
             	    {
             	    object root_1 = (object)adaptor.GetNilNode();
             	    root_1 = (object)adaptor.BecomeRoot(stream_ORDER_BY.NextNode(), root_1);
 
-            	    // C:\\projects\\pony\\_grammatics\\PonySQL.g:56:17: ( order_by_expr )*
+            	    // D:\\projects\\PonyFormatter\\_grammatics\\PonySQL.g:57:17: ( order_by_expr )*
             	    while ( stream_order_by_expr.HasNext() )
             	    {
             	        adaptor.AddChild(root_1, stream_order_by_expr.NextTree());
     };
 
     // $ANTLR start "order_by_expr"
-    // C:\\projects\\pony\\_grammatics\\PonySQL.g:59:1: order_by_expr : id ( ASC_DESC )? ;
+    // D:\\projects\\PonyFormatter\\_grammatics\\PonySQL.g:60:1: order_by_expr : id ( ASC_DESC )? ;
     public PonySQLParser.order_by_expr_return order_by_expr() // throws RecognitionException [1]
     {   
         PonySQLParser.order_by_expr_return retval = new PonySQLParser.order_by_expr_return();
     	    {
     	    	return retval; 
     	    }
-            // C:\\projects\\pony\\_grammatics\\PonySQL.g:60:2: ( id ( ASC_DESC )? )
-            // C:\\projects\\pony\\_grammatics\\PonySQL.g:60:4: id ( ASC_DESC )?
+            // D:\\projects\\PonyFormatter\\_grammatics\\PonySQL.g:61:2: ( id ( ASC_DESC )? )
+            // D:\\projects\\PonyFormatter\\_grammatics\\PonySQL.g:61:4: id ( ASC_DESC )?
             {
             	root_0 = (object)adaptor.GetNilNode();
 
-            	PushFollow(FOLLOW_id_in_order_by_expr242);
+            	PushFollow(FOLLOW_id_in_order_by_expr244);
             	id18 = id();
             	state.followingStackPointer--;
             	if (state.failed) return retval;
             	if ( state.backtracking == 0 ) adaptor.AddChild(root_0, id18.Tree);
-            	// C:\\projects\\pony\\_grammatics\\PonySQL.g:60:7: ( ASC_DESC )?
+            	// D:\\projects\\PonyFormatter\\_grammatics\\PonySQL.g:61:7: ( ASC_DESC )?
             	int alt6 = 2;
             	int LA6_0 = input.LA(1);
 
             	switch (alt6) 
             	{
             	    case 1 :
-            	        // C:\\projects\\pony\\_grammatics\\PonySQL.g:0:0: ASC_DESC
+            	        // D:\\projects\\PonyFormatter\\_grammatics\\PonySQL.g:0:0: ASC_DESC
             	        {
-            	        	ASC_DESC19=(IToken)Match(input,ASC_DESC,FOLLOW_ASC_DESC_in_order_by_expr244); if (state.failed) return retval;
+            	        	ASC_DESC19=(IToken)Match(input,ASC_DESC,FOLLOW_ASC_DESC_in_order_by_expr246); if (state.failed) return retval;
             	        	if ( state.backtracking == 0 )
             	        	{ASC_DESC19_tree = (object)adaptor.Create(ASC_DESC19);
             	        		adaptor.AddChild(root_0, ASC_DESC19_tree);
     };
 
     // $ANTLR start "id"
-    // C:\\projects\\pony\\_grammatics\\PonySQL.g:63:1: id : ( ID | INT );
+    // D:\\projects\\PonyFormatter\\_grammatics\\PonySQL.g:64:1: id : ( ID | INT );
     public PonySQLParser.id_return id() // throws RecognitionException [1]
     {   
         PonySQLParser.id_return retval = new PonySQLParser.id_return();
     	    {
     	    	return retval; 
     	    }
-            // C:\\projects\\pony\\_grammatics\\PonySQL.g:64:2: ( ID | INT )
-            // C:\\projects\\pony\\_grammatics\\PonySQL.g:
+            // D:\\projects\\PonyFormatter\\_grammatics\\PonySQL.g:65:2: ( ID | INT )
+            // D:\\projects\\PonyFormatter\\_grammatics\\PonySQL.g:
             {
             	root_0 = (object)adaptor.GetNilNode();
 
     };
 
     // $ANTLR start "expr"
-    // C:\\projects\\pony\\_grammatics\\PonySQL.g:68:1: expr : ( '(' select_statement ')' -> ^( T_SUBQUERY select_statement ) | ( multExpr ) ( ( '+' | '-' ) multExpr )* );
+    // D:\\projects\\PonyFormatter\\_grammatics\\PonySQL.g:69:1: expr : ( '(' select_statement ')' -> ^( T_SUBQUERY select_statement ) | ( multExpr ) ( ( '+' | '-' ) multExpr )* );
     public PonySQLParser.expr_return expr() // throws RecognitionException [1]
     {   
         PonySQLParser.expr_return retval = new PonySQLParser.expr_return();
     	    {
     	    	return retval; 
     	    }
-            // C:\\projects\\pony\\_grammatics\\PonySQL.g:69:2: ( '(' select_statement ')' -> ^( T_SUBQUERY select_statement ) | ( multExpr ) ( ( '+' | '-' ) multExpr )* )
+            // D:\\projects\\PonyFormatter\\_grammatics\\PonySQL.g:70:2: ( '(' select_statement ')' -> ^( T_SUBQUERY select_statement ) | ( multExpr ) ( ( '+' | '-' ) multExpr )* )
             int alt8 = 2;
             int LA8_0 = input.LA(1);
 
             switch (alt8) 
             {
                 case 1 :
-                    // C:\\projects\\pony\\_grammatics\\PonySQL.g:69:5: '(' select_statement ')'
+                    // D:\\projects\\PonyFormatter\\_grammatics\\PonySQL.g:70:5: '(' select_statement ')'
                     {
-                    	char_literal21=(IToken)Match(input,15,FOLLOW_15_in_expr274); if (state.failed) return retval; 
+                    	char_literal21=(IToken)Match(input,15,FOLLOW_15_in_expr276); if (state.failed) return retval; 
                     	if ( (state.backtracking==0) ) stream_15.Add(char_literal21);
 
-                    	PushFollow(FOLLOW_select_statement_in_expr276);
+                    	PushFollow(FOLLOW_select_statement_in_expr278);
                     	select_statement22 = select_statement();
                     	state.followingStackPointer--;
                     	if (state.failed) return retval;
                     	if ( (state.backtracking==0) ) stream_select_statement.Add(select_statement22.Tree);
-                    	char_literal23=(IToken)Match(input,16,FOLLOW_16_in_expr278); if (state.failed) return retval; 
+                    	char_literal23=(IToken)Match(input,16,FOLLOW_16_in_expr280); if (state.failed) return retval; 
                     	if ( (state.backtracking==0) ) stream_16.Add(char_literal23);
 
 
                     	RewriteRuleSubtreeStream stream_retval = new RewriteRuleSubtreeStream(adaptor, "rule retval", retval!=null ? retval.Tree : null);
 
                     	root_0 = (object)adaptor.GetNilNode();
-                    	// 69:30: -> ^( T_SUBQUERY select_statement )
+                    	// 70:30: -> ^( T_SUBQUERY select_statement )
                     	{
-                    	    // C:\\projects\\pony\\_grammatics\\PonySQL.g:69:33: ^( T_SUBQUERY select_statement )
+                    	    // D:\\projects\\PonyFormatter\\_grammatics\\PonySQL.g:70:33: ^( T_SUBQUERY select_statement )
                     	    {
                     	    object root_1 = (object)adaptor.GetNilNode();
                     	    root_1 = (object)adaptor.BecomeRoot((object)adaptor.Create(T_SUBQUERY, "T_SUBQUERY"), root_1);
                     }
                     break;
                 case 2 :
-                    // C:\\projects\\pony\\_grammatics\\PonySQL.g:70:7: ( multExpr ) ( ( '+' | '-' ) multExpr )*
+                    // D:\\projects\\PonyFormatter\\_grammatics\\PonySQL.g:71:7: ( multExpr ) ( ( '+' | '-' ) multExpr )*
                     {
                     	root_0 = (object)adaptor.GetNilNode();
 
-                    	// C:\\projects\\pony\\_grammatics\\PonySQL.g:70:7: ( multExpr )
-                    	// C:\\projects\\pony\\_grammatics\\PonySQL.g:70:8: multExpr
+                    	// D:\\projects\\PonyFormatter\\_grammatics\\PonySQL.g:71:7: ( multExpr )
+                    	// D:\\projects\\PonyFormatter\\_grammatics\\PonySQL.g:71:8: multExpr
                     	{
-                    		PushFollow(FOLLOW_multExpr_in_expr295);
+                    		PushFollow(FOLLOW_multExpr_in_expr297);
                     		multExpr24 = multExpr();
                     		state.followingStackPointer--;
                     		if (state.failed) return retval;
 
                     	}
 
-                    	// C:\\projects\\pony\\_grammatics\\PonySQL.g:70:18: ( ( '+' | '-' ) multExpr )*
+                    	// D:\\projects\\PonyFormatter\\_grammatics\\PonySQL.g:71:18: ( ( '+' | '-' ) multExpr )*
                     	do 
                     	{
                     	    int alt7 = 2;
                     	    switch (alt7) 
                     		{
                     			case 1 :
-                    			    // C:\\projects\\pony\\_grammatics\\PonySQL.g:70:19: ( '+' | '-' ) multExpr
+                    			    // D:\\projects\\PonyFormatter\\_grammatics\\PonySQL.g:71:19: ( '+' | '-' ) multExpr
                     			    {
                     			    	set25 = (IToken)input.LT(1);
                     			    	if ( (input.LA(1) >= 17 && input.LA(1) <= 18) ) 
                     			    	    throw mse;
                     			    	}
 
-                    			    	PushFollow(FOLLOW_multExpr_in_expr305);
+                    			    	PushFollow(FOLLOW_multExpr_in_expr307);
                     			    	multExpr26 = multExpr();
                     			    	state.followingStackPointer--;
                     			    	if (state.failed) return retval;
     };
 
     // $ANTLR start "multExpr"
-    // C:\\projects\\pony\\_grammatics\\PonySQL.g:73:1: multExpr : atom ( ASTERISK atom )* ;
+    // D:\\projects\\PonyFormatter\\_grammatics\\PonySQL.g:74:1: multExpr : atom ( ASTERISK atom )* ;
     public PonySQLParser.multExpr_return multExpr() // throws RecognitionException [1]
     {   
         PonySQLParser.multExpr_return retval = new PonySQLParser.multExpr_return();
     	    {
     	    	return retval; 
     	    }
-            // C:\\projects\\pony\\_grammatics\\PonySQL.g:74:6: ( atom ( ASTERISK atom )* )
-            // C:\\projects\\pony\\_grammatics\\PonySQL.g:74:10: atom ( ASTERISK atom )*
+            // D:\\projects\\PonyFormatter\\_grammatics\\PonySQL.g:75:6: ( atom ( ASTERISK atom )* )
+            // D:\\projects\\PonyFormatter\\_grammatics\\PonySQL.g:75:10: atom ( ASTERISK atom )*
             {
             	root_0 = (object)adaptor.GetNilNode();
 
-            	PushFollow(FOLLOW_atom_in_multExpr333);
+            	PushFollow(FOLLOW_atom_in_multExpr335);
             	atom27 = atom();
             	state.followingStackPointer--;
             	if (state.failed) return retval;
             	if ( state.backtracking == 0 ) adaptor.AddChild(root_0, atom27.Tree);
-            	// C:\\projects\\pony\\_grammatics\\PonySQL.g:74:15: ( ASTERISK atom )*
+            	// D:\\projects\\PonyFormatter\\_grammatics\\PonySQL.g:75:15: ( ASTERISK atom )*
             	do 
             	{
             	    int alt9 = 2;
             	    switch (alt9) 
             		{
             			case 1 :
-            			    // C:\\projects\\pony\\_grammatics\\PonySQL.g:74:16: ASTERISK atom
+            			    // D:\\projects\\PonyFormatter\\_grammatics\\PonySQL.g:75:16: ASTERISK atom
             			    {
-            			    	ASTERISK28=(IToken)Match(input,ASTERISK,FOLLOW_ASTERISK_in_multExpr336); if (state.failed) return retval;
+            			    	ASTERISK28=(IToken)Match(input,ASTERISK,FOLLOW_ASTERISK_in_multExpr338); if (state.failed) return retval;
             			    	if ( state.backtracking == 0 )
             			    	{ASTERISK28_tree = (object)adaptor.Create(ASTERISK28);
             			    		adaptor.AddChild(root_0, ASTERISK28_tree);
             			    	}
-            			    	PushFollow(FOLLOW_atom_in_multExpr338);
+            			    	PushFollow(FOLLOW_atom_in_multExpr340);
             			    	atom29 = atom();
             			    	state.followingStackPointer--;
             			    	if (state.failed) return retval;
     };
 
     // $ANTLR start "atom"
-    // C:\\projects\\pony\\_grammatics\\PonySQL.g:77:1: atom : ( id | '(' expr ')' );
+    // D:\\projects\\PonyFormatter\\_grammatics\\PonySQL.g:78:1: atom : ( id | '(' expr ')' );
     public PonySQLParser.atom_return atom() // throws RecognitionException [1]
     {   
         PonySQLParser.atom_return retval = new PonySQLParser.atom_return();
     	    {
     	    	return retval; 
     	    }
-            // C:\\projects\\pony\\_grammatics\\PonySQL.g:78:2: ( id | '(' expr ')' )
+            // D:\\projects\\PonyFormatter\\_grammatics\\PonySQL.g:79:2: ( id | '(' expr ')' )
             int alt10 = 2;
             int LA10_0 = input.LA(1);
 
             switch (alt10) 
             {
                 case 1 :
-                    // C:\\projects\\pony\\_grammatics\\PonySQL.g:78:4: id
+                    // D:\\projects\\PonyFormatter\\_grammatics\\PonySQL.g:79:4: id
                     {
                     	root_0 = (object)adaptor.GetNilNode();
 
-                    	PushFollow(FOLLOW_id_in_atom360);
+                    	PushFollow(FOLLOW_id_in_atom362);
                     	id30 = id();
                     	state.followingStackPointer--;
                     	if (state.failed) return retval;
                     }
                     break;
                 case 2 :
-                    // C:\\projects\\pony\\_grammatics\\PonySQL.g:79:10: '(' expr ')'
+                    // D:\\projects\\PonyFormatter\\_grammatics\\PonySQL.g:80:10: '(' expr ')'
                     {
                     	root_0 = (object)adaptor.GetNilNode();
 
-                    	char_literal31=(IToken)Match(input,15,FOLLOW_15_in_atom371); if (state.failed) return retval;
+                    	char_literal31=(IToken)Match(input,15,FOLLOW_15_in_atom373); if (state.failed) return retval;
                     	if ( state.backtracking == 0 )
                     	{char_literal31_tree = (object)adaptor.Create(char_literal31);
                     		adaptor.AddChild(root_0, char_literal31_tree);
                     	}
-                    	PushFollow(FOLLOW_expr_in_atom373);
+                    	PushFollow(FOLLOW_expr_in_atom375);
                     	expr32 = expr();
                     	state.followingStackPointer--;
                     	if (state.failed) return retval;
                     	if ( state.backtracking == 0 ) adaptor.AddChild(root_0, expr32.Tree);
-                    	char_literal33=(IToken)Match(input,16,FOLLOW_16_in_atom375); if (state.failed) return retval;
+                    	char_literal33=(IToken)Match(input,16,FOLLOW_16_in_atom377); if (state.failed) return retval;
                     	if ( state.backtracking == 0 )
                     	{char_literal33_tree = (object)adaptor.Create(char_literal33);
                     		adaptor.AddChild(root_0, char_literal33_tree);
 
  
 
-    public static readonly BitSet FOLLOW_select_statement_in_query71 = new BitSet(new ulong[]{0x0000000000000002UL});
-    public static readonly BitSet FOLLOW_select_list_in_select_statement80 = new BitSet(new ulong[]{0x0000000000000602UL});
-    public static readonly BitSet FOLLOW_from_list_in_select_statement84 = new BitSet(new ulong[]{0x0000000000000402UL});
-    public static readonly BitSet FOLLOW_order_by_list_in_select_statement89 = new BitSet(new ulong[]{0x0000000000000002UL});
-    public static readonly BitSet FOLLOW_SELECT_in_select_list120 = new BitSet(new ulong[]{0x000000000000B100UL});
-    public static readonly BitSet FOLLOW_select_expr_in_select_list122 = new BitSet(new ulong[]{0x0000000000000082UL});
-    public static readonly BitSet FOLLOW_COMMA_in_select_list125 = new BitSet(new ulong[]{0x000000000000B100UL});
-    public static readonly BitSet FOLLOW_select_expr_in_select_list127 = new BitSet(new ulong[]{0x0000000000000082UL});
-    public static readonly BitSet FOLLOW_ASTERISK_in_select_expr157 = new BitSet(new ulong[]{0x0000000000000002UL});
-    public static readonly BitSet FOLLOW_expr_in_select_expr162 = new BitSet(new ulong[]{0x0000000000000002UL});
-    public static readonly BitSet FOLLOW_FROM_in_from_list174 = new BitSet(new ulong[]{0x0000000000003000UL});
-    public static readonly BitSet FOLLOW_from_expr_in_from_list176 = new BitSet(new ulong[]{0x0000000000000002UL});
-    public static readonly BitSet FOLLOW_id_in_from_expr198 = new BitSet(new ulong[]{0x0000000000000002UL});
-    public static readonly BitSet FOLLOW_ORDER_BY_in_order_by_list210 = new BitSet(new ulong[]{0x0000000000003000UL});
-    public static readonly BitSet FOLLOW_order_by_expr_in_order_by_list212 = new BitSet(new ulong[]{0x0000000000000082UL});
-    public static readonly BitSet FOLLOW_COMMA_in_order_by_list215 = new BitSet(new ulong[]{0x0000000000003000UL});
-    public static readonly BitSet FOLLOW_order_by_expr_in_order_by_list217 = new BitSet(new ulong[]{0x0000000000000082UL});
-    public static readonly BitSet FOLLOW_id_in_order_by_expr242 = new BitSet(new ulong[]{0x0000000000000802UL});
-    public static readonly BitSet FOLLOW_ASC_DESC_in_order_by_expr244 = new BitSet(new ulong[]{0x0000000000000002UL});
+    public static readonly BitSet FOLLOW_select_statement_in_query72 = new BitSet(new ulong[]{0x0000000000000002UL});
+    public static readonly BitSet FOLLOW_select_list_in_select_statement81 = new BitSet(new ulong[]{0x0000000000000602UL});
+    public static readonly BitSet FOLLOW_from_list_in_select_statement85 = new BitSet(new ulong[]{0x0000000000000402UL});
+    public static readonly BitSet FOLLOW_order_by_list_in_select_statement90 = new BitSet(new ulong[]{0x0000000000000002UL});
+    public static readonly BitSet FOLLOW_SELECT_in_select_list119 = new BitSet(new ulong[]{0x000000000000B100UL});
+    public static readonly BitSet FOLLOW_select_expr_in_select_list121 = new BitSet(new ulong[]{0x0000000000000082UL});
+    public static readonly BitSet FOLLOW_COMMA_in_select_list124 = new BitSet(new ulong[]{0x000000000000B100UL});
+    public static readonly BitSet FOLLOW_select_expr_in_select_list126 = new BitSet(new ulong[]{0x0000000000000082UL});
+    public static readonly BitSet FOLLOW_ASTERISK_in_select_expr159 = new BitSet(new ulong[]{0x0000000000000002UL});
+    public static readonly BitSet FOLLOW_expr_in_select_expr164 = new BitSet(new ulong[]{0x0000000000000002UL});
+    public static readonly BitSet FOLLOW_FROM_in_from_list176 = new BitSet(new ulong[]{0x0000000000003000UL});
+    public static readonly BitSet FOLLOW_from_expr_in_from_list178 = new BitSet(new ulong[]{0x0000000000000002UL});
+    public static readonly BitSet FOLLOW_id_in_from_expr200 = new BitSet(new ulong[]{0x0000000000000002UL});
+    public static readonly BitSet FOLLOW_ORDER_BY_in_order_by_list212 = new BitSet(new ulong[]{0x0000000000003000UL});
+    public static readonly BitSet FOLLOW_order_by_expr_in_order_by_list214 = new BitSet(new ulong[]{0x0000000000000082UL});
+    public static readonly BitSet FOLLOW_COMMA_in_order_by_list217 = new BitSet(new ulong[]{0x0000000000003000UL});
+    public static readonly BitSet FOLLOW_order_by_expr_in_order_by_list219 = new BitSet(new ulong[]{0x0000000000000082UL});
+    public static readonly BitSet FOLLOW_id_in_order_by_expr244 = new BitSet(new ulong[]{0x0000000000000802UL});
+    public static readonly BitSet FOLLOW_ASC_DESC_in_order_by_expr246 = new BitSet(new ulong[]{0x0000000000000002UL});
     public static readonly BitSet FOLLOW_set_in_id0 = new BitSet(new ulong[]{0x0000000000000002UL});
-    public static readonly BitSet FOLLOW_15_in_expr274 = new BitSet(new ulong[]{0x0000000000000040UL});
-    public static readonly BitSet FOLLOW_select_statement_in_expr276 = new BitSet(new ulong[]{0x0000000000010000UL});
-    public static readonly BitSet FOLLOW_16_in_expr278 = new BitSet(new ulong[]{0x0000000000000002UL});
-    public static readonly BitSet FOLLOW_multExpr_in_expr295 = new BitSet(new ulong[]{0x0000000000060002UL});
-    public static readonly BitSet FOLLOW_set_in_expr299 = new BitSet(new ulong[]{0x000000000000B100UL});
-    public static readonly BitSet FOLLOW_multExpr_in_expr305 = new BitSet(new ulong[]{0x0000000000060002UL});
-    public static readonly BitSet FOLLOW_atom_in_multExpr333 = new BitSet(new ulong[]{0x0000000000000102UL});
-    public static readonly BitSet FOLLOW_ASTERISK_in_multExpr336 = new BitSet(new ulong[]{0x000000000000B100UL});
-    public static readonly BitSet FOLLOW_atom_in_multExpr338 = new BitSet(new ulong[]{0x0000000000000102UL});
-    public static readonly BitSet FOLLOW_id_in_atom360 = new BitSet(new ulong[]{0x0000000000000002UL});
-    public static readonly BitSet FOLLOW_15_in_atom371 = new BitSet(new ulong[]{0x000000000000B100UL});
-    public static readonly BitSet FOLLOW_expr_in_atom373 = new BitSet(new ulong[]{0x0000000000010000UL});
-    public static readonly BitSet FOLLOW_16_in_atom375 = new BitSet(new ulong[]{0x0000000000000002UL});
+    public static readonly BitSet FOLLOW_15_in_expr276 = new BitSet(new ulong[]{0x0000000000000040UL});
+    public static readonly BitSet FOLLOW_select_statement_in_expr278 = new BitSet(new ulong[]{0x0000000000010000UL});
+    public static readonly BitSet FOLLOW_16_in_expr280 = new BitSet(new ulong[]{0x0000000000000002UL});
+    public static readonly BitSet FOLLOW_multExpr_in_expr297 = new BitSet(new ulong[]{0x0000000000060002UL});
+    public static readonly BitSet FOLLOW_set_in_expr301 = new BitSet(new ulong[]{0x000000000000B100UL});
+    public static readonly BitSet FOLLOW_multExpr_in_expr307 = new BitSet(new ulong[]{0x0000000000060002UL});
+    public static readonly BitSet FOLLOW_atom_in_multExpr335 = new BitSet(new ulong[]{0x0000000000000102UL});
+    public static readonly BitSet FOLLOW_ASTERISK_in_multExpr338 = new BitSet(new ulong[]{0x000000000000B100UL});
+    public static readonly BitSet FOLLOW_atom_in_multExpr340 = new BitSet(new ulong[]{0x0000000000000102UL});
+    public static readonly BitSet FOLLOW_id_in_atom362 = new BitSet(new ulong[]{0x0000000000000002UL});
+    public static readonly BitSet FOLLOW_15_in_atom373 = new BitSet(new ulong[]{0x000000000000B100UL});
+    public static readonly BitSet FOLLOW_expr_in_atom375 = new BitSet(new ulong[]{0x0000000000010000UL});
+    public static readonly BitSet FOLLOW_16_in_atom377 = new BitSet(new ulong[]{0x0000000000000002UL});
 
 }
 }

MysqlParser/SelectNode.cs

+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+using Antlr.Runtime;
+using Antlr.Runtime.Tree;
+
+namespace MysqlParser
+{
+    public class SelectNode : CommonTree
+    {
+        public SelectNode(IToken token)
+        {
+            this.token = token;
+        }
+    }
+}

_grammatics/PonySQL.g

 	T_SUBQUERY;
 }
 
+
 @lexer::namespace {
     MysqlParser
 }
 		from_list?
 		order_by_list?
 		
-		-> ^(T_SELECT select_list from_list? order_by_list?)
+		-> ^(select_list from_list? order_by_list?)
 	;
 
 select_list
 	:	SELECT select_expr (COMMA select_expr)*
-		-> ^(SELECT select_expr (COMMA select_expr)*)
+		-> ^(SELECT<SelectNode> select_expr (COMMA select_expr)*)
 	;
 
 select_expr