Return-Path: Delivered-To: apmail-db-derby-commits-archive@www.apache.org Received: (qmail 66188 invoked from network); 2 Nov 2010 08:46:30 -0000 Received: from unknown (HELO mail.apache.org) (140.211.11.3) by 140.211.11.9 with SMTP; 2 Nov 2010 08:46:30 -0000 Received: (qmail 473 invoked by uid 500); 2 Nov 2010 08:47:01 -0000 Delivered-To: apmail-db-derby-commits-archive@db.apache.org Received: (qmail 406 invoked by uid 500); 2 Nov 2010 08:46:58 -0000 Mailing-List: contact derby-commits-help@db.apache.org; run by ezmlm Precedence: bulk list-help: list-unsubscribe: List-Post: Reply-To: "Derby Development" List-Id: Delivered-To: mailing list derby-commits@db.apache.org Received: (qmail 392 invoked by uid 99); 2 Nov 2010 08:46:57 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 02 Nov 2010 08:46:57 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 02 Nov 2010 08:46:56 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id 7C5C723888FE; Tue, 2 Nov 2010 08:45:42 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1029970 - /db/derby/code/trunk/java/tools/org/apache/derby/impl/tools/ij/ij.jj Date: Tue, 02 Nov 2010 08:45:42 -0000 To: derby-commits@db.apache.org From: kahatlen@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20101102084542.7C5C723888FE@eris.apache.org> Author: kahatlen Date: Tue Nov 2 08:45:42 2010 New Revision: 1029970 URL: http://svn.apache.org/viewvc?rev=1029970&view=rev Log: DERBY-4879: Lookahead warning from ij.jj Change lookahead from 2 to 1 in order to enable lookahead adequacy checking. Also change the grammar to work with the smaller lookahead. Modified: db/derby/code/trunk/java/tools/org/apache/derby/impl/tools/ij/ij.jj Modified: db/derby/code/trunk/java/tools/org/apache/derby/impl/tools/ij/ij.jj URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/tools/org/apache/derby/impl/tools/ij/ij.jj?rev=1029970&r1=1029969&r2=1029970&view=diff ============================================================================== --- db/derby/code/trunk/java/tools/org/apache/derby/impl/tools/ij/ij.jj (original) +++ db/derby/code/trunk/java/tools/org/apache/derby/impl/tools/ij/ij.jj Tue Nov 2 08:45:42 2010 @@ -18,7 +18,7 @@ options { STATIC = false; - LOOKAHEAD = 2; + LOOKAHEAD = 1; DEBUG_PARSER = false; DEBUG_TOKEN_MANAGER = false; ERROR_REPORTING = true; @@ -1597,15 +1597,11 @@ throws SQLException | r=ElapsedTimeStatement() | r=ExecuteStatement() | r=FirstStatement() -| r=FirstStatement() -| r=JBMSPreparedStatementExec() -| r=F2KExecuteProcedure() | r=ExitStatement() | r=ExpectStatement() | r=GetCursorStatement() | r=GetCurrentRowNumber() | r=HelpStatement() -| r=IllegalStatementName() | r=LastStatement() | r=LocalizedDisplay() | r=MaximumDisplayWidthStatement() @@ -1714,14 +1710,10 @@ throws SQLException ijResult result; } { - - ( result = dynamicConnection(true) ) - { - return result; - } -| - - ( result = dynamicConnection(false) | result = staticConnection() ) + ( + ( result = dynamicConnection(true) ) | + ( result = dynamicConnection(false) | result = staticConnection() ) + ) { return result; } @@ -1759,13 +1751,13 @@ throws SQLException String n = null, p = null, sVal; String userS = util.getSystemProperty(USER_PROPERTY); String passwordS = util.getSystemProperty(PASSWORD_PROPERTY); - Properties connInfo = null; + Properties connInfo = new Properties(); } { t= [ p=identifier() ] [ userT= ] [ passwordT= ] - [ connInfo = attributeList() ] + [ [ attributeList(connInfo) ] ] [ n=identifier() ] { // t.image is a database URL @@ -1859,15 +1851,26 @@ throws SQLException String i = null; String i2 = null; Token s = null; + String schema; + String table; } { - ( ( i=caIdentifier() i2=caIdentifier() ) - | i2=caIdentifier() - | s= - ) - { - if(s!=null) { + ( + + ( i = caIdentifier() ( i2 = caIdentifier() )? ) + { + if (i2 == null) { + schema = null; + table = i; + } else { + schema = i; + table = i2; + } + } + | + s= + { i2 = stringValue(s.image); if (i2.length() == 0) @@ -1880,12 +1883,17 @@ throws SQLException } if ("*".equals(i2)) i2 = null; - } - if(i==null) - i = util.getSelectedSchema(theConnection); + schema = i; + table = i2; + } + ) + { + if (schema == null) { + schema = util.getSelectedSchema(theConnection); + } - return describeTable(i,i2); + return describeTable(schema, table); } } @@ -1995,11 +2003,13 @@ throws SQLException Token v = null; } { - + ( + + { return showConnectionsMethod(false); } -| (t= | v= | | ) +| (t= | v= | | ) [ schema=caIdentifier() ] { if(t!=null) { @@ -2011,7 +2021,7 @@ throws SQLException types = new String[] { "SYNONYM" }; return showTables(schema, types); } -| +| [ ( schema=caIdentifier()) | ( tblname=caIdentifier() [ str=caIdentifier() ] ) ] { @@ -2028,32 +2038,34 @@ throws SQLException schema = util.getSelectedSchema(theConnection); return showIndexes(schema,tblname); } -| +| [ schema=caIdentifier() ] { return showProcedures(schema); } -| +| [ schema=caIdentifier() ] { return showFunctions(schema); } -| +| { return showSchemas(); } -| +| { return showRoles(); } -| +| { return showEnabledRoles(); } -| +| { return showSettableRoles(); } + + ) } /** @@ -2154,23 +2166,6 @@ throws SQLException } ijResult -IllegalStatementName() -throws SQLException -: -{ - Token s = null; -} -{ - s= - { - // "procedure" is not allowed as a statement name. this is - // because "execute procedure" is a valid Foundation2000 - // command - throw ijException.illegalStatementName( "procedure" ); - } -} - -ijResult PrepareStatement() throws SQLException : @@ -2181,7 +2176,17 @@ throws SQLException String sVal; } { - qi=qualifiedIdentifier() t= + ( + + t = + { + // "procedure" is not allowed as a statement name. This is + // because "execute procedure" is a valid Foundation2000 + // command. + throw ijException.illegalStatementName( "procedure" ); + } +| + qi=qualifiedIdentifier() t= { Session session = findSession(qi.getSessionName()); @@ -2195,6 +2200,8 @@ throws SQLException ps.clearWarnings(); return new ijWarningResult(w); } + + ) } ijResult @@ -2458,49 +2465,6 @@ throws SQLException } /** - * Hack to get the grammar to leave a - * EXECUTE STATEMENT <stmt> alone. Short - * circuit the ij EXECUTE built in. - */ -ijResult JBMSPreparedStatementExec() -throws SQLException : -{ - Token s = null; -} -{ - s = - { - return executeImmediate(stringValue(s.image)); - } -} - - -/** - * Hack to get the grammar to leave a - * EXECUTE PROCEDURE <procSpec> alone. Short - * circuit the ij EXECUTE built in so that - * we can deploy ij against Foundation2000. - */ -ijResult F2KExecuteProcedure() -throws SQLException : -{ - Token s = null; -} -{ - s = - { - haveConnection(); - - Statement aStatement = theConnection.createStatement(); - String text = "execute procedure " + s; - - aStatement.execute( text ); - - return new ijStatementResult( aStatement,true ); - } -} - -/** * Two forms of execute: immediate, with a string * and prepared, with the id of a prepared statement. * We expect the latter form will @@ -2529,7 +2493,32 @@ throws SQLException Token usingObject = null; } { - + ( + + // Hack to get the grammar to leave a + // EXECUTE STATEMENT alone. Short + // circuit the ij EXECUTE built in. + s = + { + return executeImmediate(stringValue(s.image)); + } +| + // Hack to get the grammar to leave a + // EXECUTE PROCEDURE alone. Short + // circuit the ij EXECUTE built in so that + // we can deploy ij against Foundation2000. + s = + { + haveConnection(); + + Statement aStatement = theConnection.createStatement(); + String text = "execute procedure " + s; + + aStatement.execute( text ); + + return new ijStatementResult( aStatement,true ); + } +| ( qi=qualifiedIdentifier() | s= ) @@ -2676,6 +2665,8 @@ throws SQLException } } } + + ) } /** @@ -3733,20 +3724,17 @@ ijResult CP_DisconnectStatement() throws -Properties - attributeList() : +void attributeList(Properties properties) : { - Properties properties = new Properties(); Token tok; String value; } { - [ property(properties) ( property(properties) )* ] + LOOKAHEAD({ getToken(2).kind == EQUALS_OPERATOR }) + ( property(properties) ( property(properties) )* ) { - //properties.put(tok.image,value); - return properties; } }