From: <ibr...@us...> - 2013-06-30 12:34:34
|
Revision: 4664 http://sourceforge.net/p/tora/code/4664 Author: ibre5041 Date: 2013-06-30 12:34:30 +0000 (Sun, 30 Jun 2013) Log Message: ----------- SET keyword Modified Paths: -------------- branches/tora3/extlibs/parsing.cpp/PLSQLGuiLexer.g Modified: branches/tora3/extlibs/parsing.cpp/PLSQLGuiLexer.g =================================================================== --- branches/tora3/extlibs/parsing.cpp/PLSQLGuiLexer.g 2013-06-29 20:11:36 UTC (rev 4663) +++ branches/tora3/extlibs/parsing.cpp/PLSQLGuiLexer.g 2013-06-30 12:34:30 UTC (rev 4664) @@ -115,7 +115,7 @@ 'RENAME' | 'REVOKE' | 'SAVEPOINT' | - 'SET' | // either "SET ROLE/CONSTRAINT/TRANSACTION ..." or "SET LINE ..." + //'SET' | // either "SET ROLE/CONSTRAINT/TRANSACTION ..." or "SET LINE ..." or "UPDATE A SET A.C1=.." 'TRUNCATE'; // NOTE: this one must be listed before SQLPLUS CONNECT @@ -124,6 +124,29 @@ { $type = PLSQL_RESERVED; } ; +SET + @init + { + ANTLR_UINT32 linePos = getCharPositionInLine(); // TODO check linePos == 0 + ANTLR_UINT32 line = getLine(); + } + : // First check is set is part sqlplus command (should start on newline) + ('SET' SPACE REGULAR_ID SPACE + ( + ('.'|';'|'_'|'&'|'#'|'>'|'\\'|'$'|'%'|'@'|'?') (NEWLINE|EOF) + | UNSIGNED_INTEGER + | CHAR_STRING + ) + ) => s='SET' SWALLOW_TO_NEWLINE_FRAGMENT + { $type = SQLPLUS_COMMAND_INTRODUCER; } + // Second check if is followed by '(' => part of SET operator (buildin function) + | ('SET' SPACE_FRAGMENT LEFT_PAREN) => 'SET' + { $type = BUILDIN_FUNCTIONS; } + // Otherwise PL/SQL reserved word + | 'SET' + { $type = PLSQL_RESERVED; } + ; + // All these should start a NEWLINE, tricky to implement fragment SQLPLUS_COMMAND_INTRODUCER @@ -172,7 +195,7 @@ | 'REPHEADER' | 'RUN' | 'SAVE' - | 'SET' + //| 'SET' | 'SHOW' | 'SHUTDOWN' | 'SPOOL' @@ -1030,7 +1053,7 @@ this->inc_backtracking(); start = this->mark(); this->mSPACE_FRAGMENT(); - this->mNEWLINE(); // can never throw exception + this->mNEWLINE(); success = !( this->get_failedflag() ); this->rewind(start); this->dec_backtracking(); @@ -1153,7 +1176,7 @@ | // or nothing ) ( - (SQLPLUS_COMMAND_INTRODUCER NEWLINE) => sqlplus=SQLPLUS_COMMAND_INTRODUCER + (SQLPLUS_COMMAND_INTRODUCER (NEWLINE|EOF)) => sqlplus=SQLPLUS_COMMAND_INTRODUCER { $sqlplus->set_type(SQLPLUS_COMMAND); get_tokSource()->enqueueToken($sqlplus); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |