From: <ibr...@us...> - 2011-02-22 00:51:48
|
Revision: 3906 http://tora.svn.sourceforge.net/tora/?rev=3906&view=rev Author: ibre5041 Date: 2011-02-22 00:51:36 +0000 (Tue, 22 Feb 2011) Log Message: ----------- first version of parsing framework Added Paths: ----------- branches/tora-trotl/src/parsing/ branches/tora-trotl/src/parsing/OracleSQLLexer.c branches/tora-trotl/src/parsing/OracleSQLLexer.h branches/tora-trotl/src/parsing/OracleSQLParser.c branches/tora-trotl/src/parsing/OracleSQLParser.h branches/tora-trotl/src/parsing/error_handler.c branches/tora-trotl/src/parsing/error_handler.h branches/tora-trotl/src/parsing/tsqlparse.h branches/tora-trotl/src/parsing/tsqlparseoracle.cpp Added: branches/tora-trotl/src/parsing/OracleSQLLexer.c =================================================================== --- branches/tora-trotl/src/parsing/OracleSQLLexer.c (rev 0) +++ branches/tora-trotl/src/parsing/OracleSQLLexer.c 2011-02-22 00:51:36 UTC (rev 3906) @@ -0,0 +1,53993 @@ +/** \file + * This C source file was generated by $ANTLR version 3.2 Sep 23, 2009 12:02:23 + * + * - From the grammar source file : OracleSQL.g + * - On : 2011-02-22 01:38:27 + * - for the lexer : OracleSQLLexerLexer * + * Editing it, at least manually, is not wise. + * + * C language generator and runtime by Jim Idle, jimi|hereisanat|idle|dotgoeshere|ws. + * + * +*/ +// [The "BSD licence"] +// Copyright (c) 2005-2009 Jim Idle, Temporal Wave LLC +// http://www.temporal-wave.com +// http://www.linkedin.com/in/jimidle +// +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. The name of the author may not be used to endorse or promote products +// derived from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR +// IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES +// OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. +// IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT +// NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF +// THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +/* ----------------------------------------- + * Include the ANTLR3 generated header file. + */ +#include "OracleSQLLexer.h" +/* ----------------------------------------- */ + + +/** String literals used by OracleSQLLexer that we must do things like MATCHS() with. + * C will normally just lay down 8 bit characters, and you can use L"xxx" to + * get wchar_t, but wchar_t is 16 bits on Windows, which is not UTF32 and so + * we perform this little trick of defining the literals as arrays of UINT32 + * and passing in the address of these. + */ +static ANTLR3_UCHAR lit_1[] = { 0x74, 0x5F, 0x75, 0x6E, 0x6B, 0x6E, 0x6F, 0x77, 0x6E, ANTLR3_STRING_TERMINATOR}; +static ANTLR3_UCHAR lit_2[] = { 0x74, 0x5F, 0x72, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x64, ANTLR3_STRING_TERMINATOR}; +static ANTLR3_UCHAR lit_3[] = { 0x74, 0x5F, 0x74, 0x61, 0x62, 0x6C, 0x65, 0x5F, 0x61, 0x6C, 0x69, 0x61, 0x73, ANTLR3_STRING_TERMINATOR}; +static ANTLR3_UCHAR lit_4[] = { 0x74, 0x5F, 0x63, 0x6F, 0x6C, 0x75, 0x6D, 0x6E, 0x5F, 0x61, 0x6C, 0x69, 0x61, 0x73, ANTLR3_STRING_TERMINATOR}; +static ANTLR3_UCHAR lit_5[] = { 0x74, 0x5F, 0x63, 0x6F, 0x6C, 0x75, 0x6D, 0x6E, 0x5F, 0x6E, 0x61, 0x6D, 0x65, ANTLR3_STRING_TERMINATOR}; +static ANTLR3_UCHAR lit_6[] = { 0x74, 0x5F, 0x74, 0x61, 0x62, 0x6C, 0x65, 0x5F, 0x6E, 0x61, 0x6D, 0x65, ANTLR3_STRING_TERMINATOR}; +static ANTLR3_UCHAR lit_7[] = { 0x74, 0x5F, 0x73, 0x63, 0x68, 0x65, 0x6D, 0x61, 0x5F, 0x6E, 0x61, 0x6D, 0x65, ANTLR3_STRING_TERMINATOR}; +static ANTLR3_UCHAR lit_8[] = { 0x74, 0x5F, 0x66, 0x75, 0x6E, 0x63, 0x74, 0x69, 0x6F, 0x6E, 0x5F, 0x6E, 0x61, 0x6D, 0x65, ANTLR3_STRING_TERMINATOR}; +static ANTLR3_UCHAR lit_9[] = { 0x74, 0x5F, 0x77, 0x69, 0x74, 0x68, ANTLR3_STRING_TERMINATOR}; +static ANTLR3_UCHAR lit_10[] = { 0x74, 0x5F, 0x73, 0x65, 0x6C, 0x65, 0x63, 0x74, ANTLR3_STRING_TERMINATOR}; +static ANTLR3_UCHAR lit_11[] = { 0x74, 0x5F, 0x63, 0x6F, 0x6C, 0x75, 0x6D, 0x6E, 0x5F, 0x6C, 0x69, 0x73, 0x74, ANTLR3_STRING_TERMINATOR}; +static ANTLR3_UCHAR lit_12[] = { 0x74, 0x5F, 0x73, 0x65, 0x6C, 0x65, 0x63, 0x74, 0x5F, 0x63, 0x6F, 0x6C, 0x75, 0x6D, 0x6E, ANTLR3_STRING_TERMINATOR}; +static ANTLR3_UCHAR lit_13[] = { 0x74, 0x5F, 0x66, 0x72, 0x6F, 0x6D, ANTLR3_STRING_TERMINATOR}; +static ANTLR3_UCHAR lit_14[] = { 0x73, 0x65, 0x6C, 0x65, 0x63, 0x74, 0x65, 0x64, 0x5F, 0x74, 0x61, 0x62, 0x6C, 0x65, ANTLR3_STRING_TERMINATOR}; +static ANTLR3_UCHAR lit_15[] = { 0x74, 0x5F, 0x77, 0x68, 0x65, 0x72, 0x65, ANTLR3_STRING_TERMINATOR}; +static ANTLR3_UCHAR lit_16[] = { 0x74, 0x5F, 0x68, 0x69, 0x65, 0x72, 0x61, 0x72, 0x63, 0x68, 0x69, 0x63, 0x61, 0x6C, ANTLR3_STRING_TERMINATOR}; +static ANTLR3_UCHAR lit_17[] = { 0x74, 0x5F, 0x67, 0x72, 0x6F, 0x75, 0x70, 0x5F, 0x62, 0x79, ANTLR3_STRING_TERMINATOR}; +static ANTLR3_UCHAR lit_18[] = { 0x74, 0x5F, 0x68, 0x61, 0x76, 0x69, 0x6E, 0x67, ANTLR3_STRING_TERMINATOR}; +static ANTLR3_UCHAR lit_19[] = { 0x74, 0x5F, 0x6D, 0x6F, 0x64, 0x65, 0x6C, ANTLR3_STRING_TERMINATOR}; +static ANTLR3_UCHAR lit_20[] = { 0x74, 0x5F, 0x75, 0x6E, 0x69, 0x6F, 0x6E, ANTLR3_STRING_TERMINATOR}; +static ANTLR3_UCHAR lit_21[] = { 0x74, 0x5F, 0x6F, 0x72, 0x64, 0x65, 0x72, 0x5F, 0x62, 0x79, ANTLR3_STRING_TERMINATOR}; +static ANTLR3_UCHAR lit_22[] = { 0x74, 0x5F, 0x66, 0x6F, 0x72, 0x5F, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, ANTLR3_STRING_TERMINATOR}; +static ANTLR3_UCHAR lit_23[] = { 0x74, 0x5F, 0x63, 0x6F, 0x6E, 0x64, 0x5F, 0x6F, 0x72, ANTLR3_STRING_TERMINATOR}; +static ANTLR3_UCHAR lit_24[] = { 0x74, 0x5F, 0x63, 0x6F, 0x6E, 0x64, 0x5F, 0x6F, 0x72, 0x5F, 0x73, 0x65, 0x71, ANTLR3_STRING_TERMINATOR}; +static ANTLR3_UCHAR lit_25[] = { 0x74, 0x5F, 0x63, 0x6F, 0x6E, 0x64, 0x5F, 0x61, 0x6E, 0x64, ANTLR3_STRING_TERMINATOR}; +static ANTLR3_UCHAR lit_26[] = { 0x74, 0x5F, 0x63, 0x6F, 0x6E, 0x64, 0x5F, 0x61, 0x6E, 0x64, 0x5F, 0x73, 0x65, 0x71, ANTLR3_STRING_TERMINATOR}; +static ANTLR3_UCHAR lit_27[] = { 0x74, 0x5F, 0x63, 0x6F, 0x6E, 0x64, 0x5F, 0x6E, 0x6F, 0x74, ANTLR3_STRING_TERMINATOR}; +static ANTLR3_UCHAR lit_28[] = { 0x74, 0x5F, 0x63, 0x6F, 0x6E, 0x64, 0x5F, 0x65, 0x78, 0x69, 0x73, 0x74, 0x73, ANTLR3_STRING_TERMINATOR}; +static ANTLR3_UCHAR lit_29[] = { 0x74, 0x5F, 0x63, 0x6F, 0x6E, 0x64, 0x5F, 0x69, 0x73, ANTLR3_STRING_TERMINATOR}; +static ANTLR3_UCHAR lit_30[] = { 0x74, 0x5F, 0x63, 0x6F, 0x6E, 0x64, 0x5F, 0x63, 0x6F, 0x6D, 0x70, 0x61, 0x72, 0x69, 0x73, 0x6F, 0x6E, ANTLR3_STRING_TERMINATOR}; +static ANTLR3_UCHAR lit_31[] = { 0x74, 0x5F, 0x63, 0x6F, 0x6E, 0x64, 0x5F, 0x67, 0x72, 0x6F, 0x75, 0x70, 0x5F, 0x63, 0x6F, 0x6D, 0x70, 0x61, 0x72, 0x69, 0x73, 0x6F, 0x6E, ANTLR3_STRING_TERMINATOR}; +static ANTLR3_UCHAR lit_32[] = { 0x74, 0x5F, 0x63, 0x6F, 0x6E, 0x64, 0x5F, 0x69, 0x6E, ANTLR3_STRING_TERMINATOR}; +static ANTLR3_UCHAR lit_33[] = { 0x74, 0x5F, 0x63, 0x6F, 0x6E, 0x64, 0x5F, 0x69, 0x73, 0x5F, 0x61, 0x5F, 0x73, 0x65, 0x74, ANTLR3_STRING_TERMINATOR}; +static ANTLR3_UCHAR lit_34[] = { 0x74, 0x5F, 0x63, 0x6F, 0x6E, 0x64, 0x5F, 0x69, 0x73, 0x5F, 0x61, 0x6E, 0x79, ANTLR3_STRING_TERMINATOR}; +static ANTLR3_UCHAR lit_35[] = { 0x74, 0x5F, 0x63, 0x6F, 0x6E, 0x64, 0x5F, 0x69, 0x73, 0x5F, 0x65, 0x6D, 0x70, 0x74, 0x79, ANTLR3_STRING_TERMINATOR}; +static ANTLR3_UCHAR lit_36[] = { 0x74, 0x5F, 0x63, 0x6F, 0x6E, 0x64, 0x5F, 0x69, 0x73, 0x5F, 0x6F, 0x66, 0x5F, 0x74, 0x79, 0x70, 0x65, ANTLR3_STRING_TERMINATOR}; +static ANTLR3_UCHAR lit_37[] = { 0x74, 0x5F, 0x63, 0x6F, 0x6E, 0x64, 0x5F, 0x69, 0x73, 0x5F, 0x70, 0x72, 0x65, 0x73, 0x65, 0x6E, 0x74, ANTLR3_STRING_TERMINATOR}; +static ANTLR3_UCHAR lit_38[] = { 0x74, 0x5F, 0x63, 0x6F, 0x6E, 0x64, 0x5F, 0x6C, 0x69, 0x6B, 0x65, ANTLR3_STRING_TERMINATOR}; +static ANTLR3_UCHAR lit_39[] = { 0x74, 0x5F, 0x63, 0x6F, 0x6E, 0x64, 0x5F, 0x6D, 0x65, 0x6D, 0x65, 0x62, 0x65, 0x72, ANTLR3_STRING_TERMINATOR}; +static ANTLR3_UCHAR lit_40[] = { 0x74, 0x5F, 0x63, 0x6F, 0x6E, 0x64, 0x5F, 0x62, 0x65, 0x74, 0x77, 0x65, 0x65, 0x6E, ANTLR3_STRING_TERMINATOR}; +static ANTLR3_UCHAR lit_41[] = { 0x74, 0x5F, 0x63, 0x6F, 0x6E, 0x64, 0x5F, 0x72, 0x65, 0x67, 0x65, 0x78, 0x70, 0x5F, 0x6C, 0x69, 0x6B, 0x65, ANTLR3_STRING_TERMINATOR}; +static ANTLR3_UCHAR lit_42[] = { 0x74, 0x5F, 0x63, 0x6F, 0x6E, 0x64, 0x5F, 0x73, 0x75, 0x62, 0x6D, 0x75, 0x6C, 0x74, 0x69, 0x73, 0x65, 0x74, ANTLR3_STRING_TERMINATOR}; +static ANTLR3_UCHAR lit_43[] = { 0x74, 0x5F, 0x63, 0x6F, 0x6E, 0x64, 0x5F, 0x65, 0x71, 0x75, 0x61, 0x6C, 0x73, 0x5F, 0x70, 0x61, 0x74, 0x68, ANTLR3_STRING_TERMINATOR}; +static ANTLR3_UCHAR lit_44[] = { 0x74, 0x5F, 0x63, 0x6F, 0x6E, 0x64, 0x5F, 0x75, 0x6E, 0x64, 0x65, 0x72, 0x5F, 0x70, 0x61, 0x74, 0x68, ANTLR3_STRING_TERMINATOR}; +static ANTLR3_UCHAR lit_45[] = { 0x74, 0x5F, 0x63, 0x6F, 0x6E, 0x64, 0x5F, 0x70, 0x61, 0x72, 0x65, 0x6E, ANTLR3_STRING_TERMINATOR}; +static ANTLR3_UCHAR lit_46[] = { 0x41, 0x43, 0x43, 0x45, 0x53, 0x53, ANTLR3_STRING_TERMINATOR}; +static ANTLR3_UCHAR lit_47[] = { 0x41, 0x44, 0x44, ANTLR3_STRING_TERMINATOR}; +static ANTLR3_UCHAR lit_48[] = { 0x41, 0x4C, 0x4C, ANTLR3_STRING_TERMINATOR}; +static ANTLR3_UCHAR lit_49[] = { 0x41, 0x4C, 0x54, 0x45, 0x52, ANTLR3_STRING_TERMINATOR}; +static ANTLR3_UCHAR lit_50[] = { 0x41, 0x4E, 0x44, ANTLR3_STRING_TERMINATOR}; +static ANTLR3_UCHAR lit_51[] = { 0x41, 0x4E, 0x59, ANTLR3_STRING_TERMINATOR}; +static ANTLR3_UCHAR lit_52[] = { 0x41, 0x52, 0x52, 0x41, 0x59, 0x4C, 0x45, 0x4E, ANTLR3_STRING_TERMINATOR}; +static ANTLR3_UCHAR lit_53[] = { 0x41, 0x53, ANTLR3_STRING_TERMINATOR}; +static ANTLR3_UCHAR lit_54[] = { 0x41, 0x53, 0x43, ANTLR3_STRING_TERMINATOR}; +static ANTLR3_UCHAR lit_55[] = { 0x41, 0x55, 0x44, 0x49, 0x54, ANTLR3_STRING_TERMINATOR}; +static ANTLR3_UCHAR lit_56[] = { 0x42, 0x45, 0x54, 0x57, 0x45, 0x45, 0x4E, ANTLR3_STRING_TERMINATOR}; +static ANTLR3_UCHAR lit_57[] = { 0x42, 0x59, ANTLR3_STRING_TERMINATOR}; +static ANTLR3_UCHAR lit_58[] = { 0x43, 0x41, 0x53, 0x45, ANTLR3_STRING_TERMINATOR}; +static ANTLR3_UCHAR lit_59[] = { 0x43, 0x48, 0x41, 0x52, ANTLR3_STRING_TERMINATOR}; +static ANTLR3_UCHAR lit_60[] = { 0x43, 0x48, 0x45, 0x43, 0x4B, ANTLR3_STRING_TERMINATOR}; +static ANTLR3_UCHAR lit_61[] = { 0x43, 0x4C, 0x55, 0x53, 0x54, 0x45, 0x52, ANTLR3_STRING_TERMINATOR}; +static ANTLR3_UCHAR lit_62[] = { 0x43, 0x4F, 0x4C, 0x55, 0x4D, 0x4E, ANTLR3_STRING_TERMINATOR}; +static ANTLR3_UCHAR lit_63[] = { 0x43, 0x4F, 0x4D, 0x4D, 0x45, 0x4E, 0x54, ANTLR3_STRING_TERMINATOR}; +static ANTLR3_UCHAR lit_64[] = { 0x43, 0x4F, 0x4D, 0x50, 0x52, 0x45, 0x53, 0x53, ANTLR3_STRING_TERMINATOR}; +static ANTLR3_UCHAR lit_65[] = { 0x43, 0x4F, 0x4E, 0x4E, 0x45, 0x43, 0x54, ANTLR3_STRING_TERMINATOR}; +static ANTLR3_UCHAR lit_66[] = { 0x43, 0x52, 0x45, 0x41, 0x54, 0x45, ANTLR3_STRING_TERMINATOR}; +static ANTLR3_UCHAR lit_67[] = { 0x43, 0x55, 0x52, 0x52, 0x45, 0x4E, 0x54, ANTLR3_STRING_TERMINATOR}; +static ANTLR3_UCHAR lit_68[] = { 0x44, 0x41, 0x54, 0x45, ANTLR3_STRING_TERMINATOR}; +static ANTLR3_UCHAR lit_69[] = { 0x44, 0x45, 0x43, 0x49, 0x4D, 0x41, 0x4C, ANTLR3_STRING_TERMINATOR}; +static ANTLR3_UCHAR lit_70[] = { 0x44, 0x45, 0x46, 0x41, 0x55, 0x4C, 0x54, ANTLR3_STRING_TERMINATOR}; +static ANTLR3_UCHAR lit_71[] = { 0x44, 0x45, 0x4C, 0x45, 0x54, 0x45, ANTLR3_STRING_TERMINATOR}; +static ANTLR3_UCHAR lit_72[] = { 0x44, 0x45, 0x53, 0x43, ANTLR3_STRING_TERMINATOR}; +static ANTLR3_UCHAR lit_73[] = { 0x44, 0x49, 0x53, 0x54, 0x49, 0x4E, 0x43, 0x54, ANTLR3_STRING_TERMINATOR}; +static ANTLR3_UCHAR lit_74[] = { 0x44, 0x52, 0x4F, 0x50, ANTLR3_STRING_TERMINATOR}; +static ANTLR3_UCHAR lit_75[] = { 0x45, 0x4C, 0x53, 0x45, ANTLR3_STRING_TERMINATOR}; +static ANTLR3_UCHAR lit_76[] = { 0x45, 0x58, 0x43, 0x4C, 0x55, 0x53, 0x49, 0x56, 0x45, ANTLR3_STRING_TERMINATOR}; +static ANTLR3_UCHAR lit_77[] = { 0x45, 0x58, 0x49, 0x53, 0x54, 0x53, ANTLR3_STRING_TERMINATOR}; +static ANTLR3_UCHAR lit_78[] = { 0x46, 0x41, 0x4C, 0x53, 0x45, ANTLR3_STRING_TERMINATOR}; +static ANTLR3_UCHAR lit_79[] = { 0x46, 0x49, 0x4C, 0x45, ANTLR3_STRING_TERMINATOR}; +static ANTLR3_UCHAR lit_80[] = { 0x46, 0x4C, 0x4F, 0x41, 0x54, ANTLR3_STRING_TERMINATOR}; +static ANTLR3_UCHAR lit_81[] = { 0x46, 0x4F, 0x52, ANTLR3_STRING_TERMINATOR}; +static ANTLR3_UCHAR lit_82[] = { 0x46, 0x52, 0x4F, 0x4D, ANTLR3_STRING_TERMINATOR}; +static ANTLR3_UCHAR lit_83[] = { 0x47, 0x52, 0x41, 0x4E, 0x54, ANTLR3_STRING_TERMINATOR}; +static ANTLR3_UCHAR lit_84[] = { 0x47, 0x52, 0x4F, 0x55, 0x50, ANTLR3_STRING_TERMINATOR}; +static ANTLR3_UCHAR lit_85[] = { 0x48, 0x41, 0x56, 0x49, 0x4E, 0x47, ANTLR3_STRING_TERMINATOR}; +static ANTLR3_UCHAR lit_86[] = { 0x49, 0x44, 0x45, 0x4E, 0x54, 0x49, 0x46, 0x49, 0x45, 0x44, ANTLR3_STRING_TERMINATOR}; +static ANTLR3_UCHAR lit_87[] = { 0x49, 0x4D, 0x4D, 0x45, 0x44, 0x49, 0x41, 0x54, 0x45, ANTLR3_STRING_TERMINATOR}; +static ANTLR3_UCHAR lit_88[] = { 0x49, 0x4E, ANTLR3_STRING_TERMINATOR}; +static ANTLR3_UCHAR lit_89[] = { 0x49, 0x4E, 0x43, 0x52, 0x45, 0x4D, 0x45, 0x4E, 0x54, ANTLR3_STRING_TERMINATOR}; +static ANTLR3_UCHAR lit_90[] = { 0x49, 0x4E, 0x44, 0x45, 0x58, ANTLR3_STRING_TERMINATOR}; +static ANTLR3_UCHAR lit_91[] = { 0x49, 0x4E, 0x49, 0x54, 0x49, 0x41, 0x4C, ANTLR3_STRING_TERMINATOR}; +static ANTLR3_UCHAR lit_92[] = { 0x49, 0x4E, 0x53, 0x45, 0x52, 0x54, ANTLR3_STRING_TERMINATOR}; +static ANTLR3_UCHAR lit_93[] = { 0x49, 0x4E, 0x54, 0x45, 0x47, 0x45, 0x52, ANTLR3_STRING_TERMINATOR}; +static ANTLR3_UCHAR lit_94[] = { 0x49, 0x4E, 0x54, 0x45, 0x52, 0x53, 0x45, 0x43, 0x54, ANTLR3_STRING_TERMINATOR}; +static ANTLR3_UCHAR lit_95[] = { 0x49, 0x4E, 0x54, 0x4F, ANTLR3_STRING_TERMINATOR}; +static ANTLR3_UCHAR lit_96[] = { 0x49, 0x53, ANTLR3_STRING_TERMINATOR}; +static ANTLR3_UCHAR lit_97[] = { 0x4C, 0x45, 0x56, 0x45, 0x4C, ANTLR3_STRING_TERMINATOR}; +static ANTLR3_UCHAR lit_98[] = { 0x4C, 0x49, 0x4B, 0x45, ANTLR3_STRING_TERMINATOR}; +static ANTLR3_UCHAR lit_99[] = { 0x4C, 0x4F, 0x43, 0x4B, ANTLR3_STRING_TERMINATOR}; +static ANTLR3_UCHAR lit_100[] = { 0x4C, 0x4F, 0x4E, 0x47, ANTLR3_STRING_TERMINATOR}; +static ANTLR3_UCHAR lit_101[] = { 0x4D, 0x41, 0x58, 0x45, 0x58, 0x54, 0x45, 0x4E, 0x54, 0x53, ANTLR3_STRING_TERMINATOR}; +static ANTLR3_UCHAR lit_102[] = { 0x4D, 0x49, 0x4E, 0x55, 0x53, ANTLR3_STRING_TERMINATOR}; +static ANTLR3_UCHAR lit_103[] = { 0x4D, 0x4F, 0x44, 0x45, ANTLR3_STRING_TERMINATOR}; +static ANTLR3_UCHAR lit_104[] = { 0x4D, 0x4F, 0x44, 0x49, 0x46, 0x59, ANTLR3_STRING_TERMINATOR}; +static ANTLR3_UCHAR lit_105[] = { 0x4E, 0x4F, 0x41, 0x55, 0x44, 0x49, 0x54, ANTLR3_STRING_TERMINATOR}; +static ANTLR3_UCHAR lit_106[] = { 0x4E, 0x4F, 0x43, 0x4F, 0x4D, 0x50, 0x52, 0x45, 0x53, 0x53, ANTLR3_STRING_TERMINATOR}; +static ANTLR3_UCHAR lit_107[] = { 0x4E, 0x4F, 0x54, ANTLR3_STRING_TERMINATOR}; +static ANTLR3_UCHAR lit_108[] = { 0x4E, 0x4F, 0x54, 0x46, 0x4F, 0x55, 0x4E, 0x44, ANTLR3_STRING_TERMINATOR}; +static ANTLR3_UCHAR lit_109[] = { 0x4E, 0x4F, 0x57, 0x41, 0x49, 0x54, ANTLR3_STRING_TERMINATOR}; +static ANTLR3_UCHAR lit_110[] = { 0x4E, 0x55, 0x4C, 0x4C, ANTLR3_STRING_TERMINATOR}; +static ANTLR3_UCHAR lit_111[] = { 0x4E, 0x55, 0x4D, 0x42, 0x45, 0x52, ANTLR3_STRING_TERMINATOR}; +static ANTLR3_UCHAR lit_112[] = { 0x4F, 0x46, ANTLR3_STRING_TERMINATOR}; +static ANTLR3_UCHAR lit_113[] = { 0x4F, 0x46, 0x46, 0x4C, 0x49, 0x4E, 0x45, ANTLR3_STRING_TERMINATOR}; +static ANTLR3_UCHAR lit_114[] = { 0x4F, 0x4E, ANTLR3_STRING_TERMINATOR}; +static ANTLR3_UCHAR lit_115[] = { 0x4F, 0x4E, 0x4C, 0x49, 0x4E, 0x45, ANTLR3_STRING_TERMINATOR}; +static ANTLR3_UCHAR lit_116[] = { 0x4F, 0x50, 0x54, 0x49, 0x4F, 0x4E, ANTLR3_STRING_TERMINATOR}; +static ANTLR3_UCHAR lit_117[] = { 0x4F, 0x52, ANTLR3_STRING_TERMINATOR}; +static ANTLR3_UCHAR lit_118[] = { 0x4F, 0x52, 0x44, 0x45, 0x52, ANTLR3_STRING_TERMINATOR}; +static ANTLR3_UCHAR lit_119[] = { 0x50, 0x43, 0x54, 0x46, 0x52, 0x45, 0x45, ANTLR3_STRING_TERMINATOR}; +static ANTLR3_UCHAR lit_120[] = { 0x50, 0x52, 0x49, 0x4F, 0x52, ANTLR3_STRING_TERMINATOR}; +static ANTLR3_UCHAR lit_121[] = { 0x50, 0x52, 0x49, 0x56, 0x49, 0x4C, 0x45, 0x47, 0x45, 0x53, ANTLR3_STRING_TERMINATOR}; +static ANTLR3_UCHAR lit_122[] = { 0x50, 0x55, 0x42, 0x4C, 0x49, 0x43, ANTLR3_STRING_TERMINATOR}; +static ANTLR3_UCHAR lit_123[] = { 0x52, 0x41, 0x57, ANTLR3_STRING_TERMINATOR}; +static ANTLR3_UCHAR lit_124[] = { 0x52, 0x45, 0x4E, 0x41, 0x4D, 0x45, ANTLR3_STRING_TERMINATOR}; +static ANTLR3_UCHAR lit_125[] = { 0x52, 0x45, 0x53, 0x4F, 0x55, 0x52, 0x43, 0x45, ANTLR3_STRING_TERMINATOR}; +static ANTLR3_UCHAR lit_126[] = { 0x52, 0x45, 0x56, 0x4F, 0x4B, 0x45, ANTLR3_STRING_TERMINATOR}; +static ANTLR3_UCHAR lit_127[] = { 0x52, 0x4F, 0x57, ANTLR3_STRING_TERMINATOR}; +static ANTLR3_UCHAR lit_128[] = { 0x52, 0x4F, 0x57, 0x49, 0x44, ANTLR3_STRING_TERMINATOR}; +static ANTLR3_UCHAR lit_129[] = { 0x52, 0x4F, 0x57, 0x4C, 0x41, 0x42, 0x45, 0x4C, ANTLR3_STRING_TERMINATOR}; +static ANTLR3_UCHAR lit_130[] = { 0x52, 0x4F, 0x57, 0x4E, 0x55, 0x4D, ANTLR3_STRING_TERMINATOR}; +static ANTLR3_UCHAR lit_131[] = { 0x52, 0x4F, 0x57, 0x53, ANTLR3_STRING_TERMINATOR}; +static ANTLR3_UCHAR lit_132[] = { 0x53, 0x45, 0x4C, 0x45, 0x43, 0x54, ANTLR3_STRING_TERMINATOR}; +static ANTLR3_UCHAR lit_133[] = { 0x53, 0x45, 0x53, 0x53, 0x49, 0x4F, 0x4E, ANTLR3_STRING_TERMINATOR}; +static ANTLR3_UCHAR lit_134[] = { 0x53, 0x45, 0x54, ANTLR3_STRING_TERMINATOR}; +static ANTLR3_UCHAR lit_135[] = { 0x53, 0x48, 0x41, 0x52, 0x45, ANTLR3_STRING_TERMINATOR}; +static ANTLR3_UCHAR lit_136[] = { 0x53, 0x49, 0x5A, 0x45, ANTLR3_STRING_TERMINATOR}; +static ANTLR3_UCHAR lit_137[] = { 0x53, 0x4D, 0x41, 0x4C, 0x4C, 0x49, 0x4E, 0x54, ANTLR3_STRING_TERMINATOR}; +static ANTLR3_UCHAR lit_138[] = { 0x53, 0x51, 0x4C, 0x42, 0x55, 0x46, ANTLR3_STRING_TERMINATOR}; +static ANTLR3_UCHAR lit_139[] = { 0x53, 0x54, 0x41, 0x52, 0x54, ANTLR3_STRING_TERMINATOR}; +static ANTLR3_UCHAR lit_140[] = { 0x53, 0x55, 0x43, 0x43, 0x45, 0x53, 0x53, 0x46, 0x55, 0x4C, ANTLR3_STRING_TERMINATOR}; +static ANTLR3_UCHAR lit_141[] = { 0x53, 0x59, 0x4E, 0x4F, 0x4E, 0x59, 0x4D, ANTLR3_STRING_TERMINATOR}; +static ANTLR3_UCHAR lit_142[] = { 0x53, 0x59, 0x53, 0x44, 0x41, 0x54, 0x45, ANTLR3_STRING_TERMINATOR}; +static ANTLR3_UCHAR lit_143[] = { 0x54, 0x41, 0x42, 0x4C, 0x45, ANTLR3_STRING_TERMINATOR}; +static ANTLR3_UCHAR lit_144[] = { 0x54, 0x48, 0x45, 0x4E, ANTLR3_STRING_TERMINATOR}; +static ANTLR3_UCHAR lit_145[] = { 0x54, 0x4F, ANTLR3_STRING_TERMINATOR}; +static ANTLR3_UCHAR lit_146[] = { 0x54, 0x52, 0x49, 0x47, 0x47, 0x45, 0x52, ANTLR3_STRING_TERMINATOR}; +static ANTLR3_UCHAR lit_147[] = { 0x54, 0x52, 0x55, 0x45, ANTLR3_STRING_TERMINATOR}; +static ANTLR3_UCHAR lit_148[] = { 0x55, 0x49, 0x44, ANTLR3_STRING_TERMINATOR}; +static ANTLR3_UCHAR lit_149[] = { 0x55, 0x4E, 0x49, 0x4F, 0x4E, ANTLR3_STRING_TERMINATOR}; +static ANTLR3_UCHAR lit_150[] = { 0x55, 0x4E, 0x49, 0x51, 0x55, 0x45, ANTLR3_STRING_TERMINATOR}; +static ANTLR3_UCHAR lit_151[] = { 0x55, 0x50, 0x44, 0x41, 0x54, 0x45, ANTLR3_STRING_TERMINATOR}; +static ANTLR3_UCHAR lit_152[] = { 0x55, 0x53, 0x45, 0x52, ANTLR3_STRING_TERMINATOR}; +static ANTLR3_UCHAR lit_153[] = { 0x56, 0x41, 0x4C, 0x49, 0x44, 0x41, 0x54, 0x45, ANTLR3_STRING_TERMINATOR}; +static ANTLR3_UCHAR lit_154[] = { 0x56, 0x41, 0x4C, 0x55, 0x45, 0x53, ANTLR3_STRING_TERMINATOR}; +static ANTLR3_UCHAR lit_155[] = { 0x56, 0x41, 0x52, 0x43, 0x48, 0x41, 0x52, ANTLR3_STRING_TERMINATOR}; +static ANTLR3_UCHAR lit_156[] = { 0x56, 0x41, 0x52, 0x43, 0x48, 0x41, 0x52, 0x32, ANTLR3_STRING_TERMINATOR}; +static ANTLR3_UCHAR lit_157[] = { 0x56, 0x49, 0x45, 0x57, ANTLR3_STRING_TERMINATOR}; +static ANTLR3_UCHAR lit_158[] = { 0x57, 0x48, 0x45, 0x4E, 0x45, 0x56, 0x45, 0x52, ANTLR3_STRING_TERMINATOR}; +static ANTLR3_UCHAR lit_159[] = { 0x57, 0x48, 0x45, 0x52, 0x45, ANTLR3_STRING_TERMINATOR}; +static ANTLR3_UCHAR lit_160[] = { 0x57, 0x49, 0x54, 0x48, ANTLR3_STRING_TERMINATOR}; +static ANTLR3_UCHAR lit_161[] = { 0x41, 0x54, ANTLR3_STRING_TERMINATOR}; +static ANTLR3_UCHAR lit_162[] = { 0x41, 0x55, 0x54, 0x4F, 0x4D, 0x41, 0x54, 0x49, 0x43, ANTLR3_STRING_TERMINATOR}; +static ANTLR3_UCHAR lit_163[] = { 0x41, 0x56, 0x47, ANTLR3_STRING_TERMINATOR}; +static ANTLR3_UCHAR lit_164[] = { 0x42, 0x46, 0x49, 0x4C, 0x45, ANTLR3_STRING_TERMINATOR}; +static ANTLR3_UCHAR lit_165[] = { 0x42, 0x49, 0x4E, 0x41, 0x52, 0x59, 0x5F, 0x44, 0x4F, 0x55, 0x42, 0x4C, 0x45, ANTLR3_STRING_TERMINATOR}; +static ANTLR3_UCHAR lit_166[] = { 0x42, 0x49, 0x4E, 0x41, 0x52, 0x59, 0x5F, 0x46, 0x4C, 0x4F, 0x41, 0x54, ANTLR3_STRING_TERMINATOR}; +static ANTLR3_UCHAR lit_167[] = { 0x42, 0x49, 0x4E, 0x41, 0x52, 0x59, 0x5F, 0x49, 0x4E, 0x54, 0x45, 0x47, 0x45, 0x52, ANTLR3_STRING_TERMINATOR}; +static ANTLR3_UCHAR lit_168[] = { 0x42, 0x4C, 0x4F, 0x42, ANTLR3_STRING_TERMINATOR}; +static ANTLR3_UCHAR lit_169[] = { 0x42, 0x4C, 0x4F, 0x43, 0x4B, ANTLR3_STRING_TERMINATOR}; +static ANTLR3_UCHAR lit_170[] = { 0x42, 0x4F, 0x4F, 0x4C, 0x45, 0x41, 0x4E, ANTLR3_STRING_TERMINATOR}; +static ANTLR3_UCHAR lit_171[] = { 0x42, 0x52, 0x45, 0x41, 0x44, 0x54, 0x48, ANTLR3_STRING_TERMINATOR}; +static ANTLR3_UCHAR lit_172[] = { 0x42, 0x59, 0x54, 0x45, ANTLR3_STRING_TERMINATOR}; +static ANTLR3_UCHAR lit_173[] = { 0x43, 0x41, 0x53, 0x54, ANTLR3_STRING_TERMINATOR}; +static ANTLR3_UCHAR lit_174[] = { 0x43, 0x48, 0x41, 0x52, 0x41, 0x43, 0x54, 0x45, 0x52, ANTLR3_STRING_TERMINATOR}; +static ANTLR3_UCHAR lit_175[] = { 0x43, 0x4C, 0x4F, 0x42, ANTLR3_STRING_TERMINATOR}; +static ANTLR3_UCHAR lit_176[] = { 0x43, 0x4C, 0x55, 0x53, 0x54, 0x45, 0x52, 0x5F, 0x53, 0x45, 0x54, ANTLR3_STRING_TERMINATOR}; +static ANTLR3_UCHAR lit_177[] = { 0x43, 0x4F, 0x4C, 0x55, 0x4D, 0x4E, 0x5F, 0x56, 0x41, 0x4C, 0x55, 0x45, ANTLR3_STRING_TERMINATOR}; +static ANTLR3_UCHAR lit_178[] = { 0x43, 0x4F, 0x4E, 0x4E, 0x45, 0x43, 0x54, 0x5F, 0x42, 0x59, 0x5F, 0x49, 0x53, 0x43, 0x59, 0x43, 0x4C, 0x45, ANTLR3_STRING_TERMINATOR}; +static ANTLR3_UCHAR lit_179[] = { 0x43, 0x4F, 0x4E, 0x4E, 0x45, 0x43, 0x54, 0x5F, 0x42, 0x59, 0x5F, 0x49, 0x53, 0x4C, 0x45, 0x41, 0x46, ANTLR3_STRING_TERMINATOR}; +static ANTLR3_UCHAR lit_180[] = { 0x43, 0x4F, 0x4E, 0x4E, 0x45, 0x43, 0x54, 0x5F, 0x42, 0x59, 0x5F, 0x52, 0x4F, 0x4F, 0x54, ANTLR3_STRING_TERMINATOR}; +static ANTLR3_UCHAR lit_181[] = { 0x43, 0x4F, 0x4E, 0x53, 0x54, 0x52, 0x41, 0x49, 0x4E, 0x54, ANTLR3_STRING_TERMINATOR}; +static ANTLR3_UCHAR lit_182[] = { 0x43, 0x4F, 0x52, 0x52, ANTLR3_STRING_TERMINATOR}; +static ANTLR3_UCHAR lit_183[] = { 0x43, 0x4F, 0x55, 0x4E, 0x54, ANTLR3_STRING_TERMINATOR}; +static ANTLR3_UCHAR lit_184[] = { 0x43, 0x4F, 0x56, 0x41, 0x52, 0x5F, 0x50, 0x4F, 0x50, ANTLR3_STRING_TERMINATOR}; +static ANTLR3_UCHAR lit_185[] = { 0x43, 0x4F, 0x56, 0x41, 0x52, 0x5F, 0x53, 0x41, 0x4D, 0x50, ANTLR3_STRING_TERMINATOR}; +static ANTLR3_UCHAR lit_186[] = { 0x43, 0x52, 0x4F, 0x53, 0x53, ANTLR3_STRING_TERMINATOR}; +static ANTLR3_UCHAR lit_187[] = { 0x43, 0x55, 0x42, 0x45, ANTLR3_STRING_TERMINATOR}; +static ANTLR3_UCHAR lit_188[] = { 0x43, 0x55, 0x4D, 0x45, 0x5F, 0x44, 0x49, 0x53, 0x54, ANTLR3_STRING_TERMINATOR}; +static ANTLR3_UCHAR lit_189[] = { 0x43, 0x55, 0x52, 0x53, 0x4F, 0x52, ANTLR3_STRING_TERMINATOR}; +static ANTLR3_UCHAR lit_190[] = { 0x43, 0x59, 0x43, 0x4C, 0x45, ANTLR3_STRING_TERMINATOR}; +static ANTLR3_UCHAR lit_191[] = { 0x44, 0x41, 0x59, ANTLR3_STRING_TERMINATOR}; +static ANTLR3_UCHAR lit_192[] = { 0x44, 0x42, 0x54, 0x49, 0x4D, 0x45, 0x5A, 0x4F, 0x4E, 0x45, ANTLR3_STRING_TERMINATOR}; +static ANTLR3_UCHAR lit_193[] = { 0x44, 0x45, 0x43, ANTLR3_STRING_TERMINATOR}; +static ANTLR3_UCHAR lit_194[] = { 0x44, 0x45, 0x43, 0x52, 0x45, 0x4D, 0x45, 0x4E, 0x54, ANTLR3_STRING_TERMINATOR}; +static ANTLR3_UCHAR lit_195[] = { 0x44, 0x45, 0x4E, 0x53, 0x45, 0x5F, 0x52, 0x41, 0x4E, 0x4B, ANTLR3_STRING_TERMINATOR}; +static ANTLR3_UCHAR lit_196[] = { 0x44, 0x45, 0x50, 0x54, 0x48, ANTLR3_STRING_TERMINATOR}; +static ANTLR3_UCHAR lit_197[] = { 0x44, 0x49, 0x4D, 0x45, 0x4E, 0x53, 0x49, 0x4F, 0x4E, ANTLR3_STRING_TERMINATOR}; +static ANTLR3_UCHAR lit_198[] = { 0x44, 0x4F, 0x55, 0x42, 0x4C, 0x45, ANTLR3_STRING_TERMINATOR}; +static ANTLR3_UCHAR lit_199[] = { 0x45, 0x4D, 0x50, 0x54, 0x59, ANTLR3_STRING_TERMINATOR}; +static ANTLR3_UCHAR lit_200[] = { 0x45, 0x4E, 0x44, ANTLR3_STRING_TERMINATOR}; +static ANTLR3_UCHAR lit_201[] = { 0x45, 0x51, 0x55, 0x41, 0x4C, 0x53, 0x5F, 0x50, 0x41, 0x54, 0x48, ANTLR3_STRING_TERMINATOR}; +static ANTLR3_UCHAR lit_202[] = { 0x45, 0x52, 0x52, 0x4F, 0x52, 0x53, ANTLR3_STRING_TERMINATOR}; +static ANTLR3_UCHAR lit_203[] = { 0x45, 0x53, 0x43, 0x41, 0x50, 0x45, ANTLR3_STRING_TERMINATOR}; +static ANTLR3_UCHAR lit_204[] = { 0x45, 0x58, 0x43, 0x4C, 0x55, 0x44, 0x45, ANTLR3_STRING_TERMINATOR}; +static ANTLR3_UCHAR lit_205[] = { 0x46, 0x49, 0x52, 0x53, 0x54, ANTLR3_STRING_TERMINATOR}; +static ANTLR3_UCHAR lit_206[] = { 0x46, 0x49, 0x52, 0x53, 0x54, 0x5F, 0x56, 0x41, 0x4C, 0x55, 0x45, ANTLR3_STRING_TERMINATOR}; +static ANTLR3_UCHAR lit_207[] = { 0x46, 0x4F, 0x4C, 0x4C, 0x4F, 0x57, 0x49, 0x4E, 0x47, ANTLR3_STRING_TERMINATOR}; +static ANTLR3_UCHAR lit_208[] = { 0x46, 0x55, 0x4C, 0x4C, ANTLR3_STRING_TERMINATOR}; +static ANTLR3_UCHAR lit_209[] = { 0x47, 0x52, 0x4F, 0x55, 0x50, 0x49, 0x4E, 0x47, ANTLR3_STRING_TERMINATOR}; +static ANTLR3_UCHAR lit_210[] = { 0x49, 0x47, 0x4E, 0x4F, 0x52, 0x45, ANTLR3_STRING_TERMINATOR}; +static ANTLR3_UCHAR lit_211[] = { 0x49, 0x4E, 0x43, 0x4C, 0x55, 0x44, 0x45, ANTLR3_STRING_TERMINATOR}; +static ANTLR3_UCHAR lit_212[] = { 0x49, 0x4E, 0x46, 0x49, 0x4E, 0x49, 0x54, 0x45, ANTLR3_STRING_TERMINATOR}; +static ANTLR3_UCHAR lit_213[] = { 0x49, 0x4E, 0x4E, 0x45, 0x52, ANTLR3_STRING_TERMINATOR}; +static ANTLR3_UCHAR lit_214[] = { 0x49, 0x4E, 0x54, ANTLR3_STRING_TERMINATOR}; +static ANTLR3_UCHAR lit_215[] = { 0x49, 0x4E, 0x54, 0x45, 0x52, 0x56, 0x41, 0x4C, ANTLR3_STRING_TERMINATOR}; +static ANTLR3_UCHAR lit_216[] = { 0x49, 0x54, 0x45, 0x52, 0x41, 0x54, 0x45, ANTLR3_STRING_TERMINATOR}; +static ANTLR3_UCHAR lit_217[] = { 0x4A, 0x4F, 0x49, 0x4E, ANTLR3_STRING_TERMINATOR}; +static ANTLR3_UCHAR lit_218[] = { 0x4B, 0x45, 0x45, 0x50, ANTLR3_STRING_TERMINATOR}; +static ANTLR3_UCHAR lit_219[] = { 0x4C, 0x41, 0x47, ANTLR3_STRING_TERMINATOR}; +static ANTLR3_UCHAR lit_220[] = { 0x4C, 0x41, 0x53, 0x54, ANTLR3_STRING_TERMINATOR}; +static ANTLR3_UCHAR lit_221[] = { 0x4C, 0x41, 0x53, 0x54, 0x5F, 0x56, 0x41, 0x4C, 0x55, 0x45, ANTLR3_STRING_TERMINATOR}; +static ANTLR3_UCHAR lit_222[] = { 0x4C, 0x45, 0x41, 0x44, ANTLR3_STRING_TERMINATOR}; +static ANTLR3_UCHAR lit_223[] = { 0x4C, 0x45, 0x46, 0x54, ANTLR3_STRING_TERMINATOR}; +static ANTLR3_UCHAR lit_224[] = { 0x4C, 0x49, 0x4B, 0x45, 0x32, ANTLR3_STRING_TERMINATOR}; +static ANTLR3_UCHAR lit_225[] = { 0x4C, 0x49, 0x4B, 0x45, 0x34, ANTLR3_STRING_TERMINATOR}; +static ANTLR3_UCHAR lit_226[] = { 0x4C, 0x49, 0x4B, 0x45, 0x43, ANTLR3_STRING_TERMINATOR}; +static ANTLR3_UCHAR lit_227[] = { 0x4C, 0x49, 0x4D, 0x49, 0x54, ANTLR3_STRING_TERMINATOR}; +static ANTLR3_UCHAR lit_228[] = { 0x4C, 0x4F, 0x43, 0x41, 0x4C, ANTLR3_STRING_TERMINATOR}; +static ANTLR3_UCHAR lit_229[] = { 0x4C, 0x4F, 0x43, 0x4B, 0x45, 0x44, ANTLR3_STRING_TERMINATOR}; +static ANTLR3_UCHAR lit_230[] = { 0x4C, 0x4F, 0x47, ANTLR3_STRING_TERMINATOR}; +static ANTLR3_UCHAR lit_231[] = { 0x4D, 0x41, 0x49, 0x4E, ANTLR3_STRING_TERMINATOR}; +static ANTLR3_UCHAR lit_232[] = { 0x4D, 0x41, 0x54, 0x43, 0x48, 0x45, 0x44, ANTLR3_STRING_TERMINATOR}; +static ANTLR3_UCHAR lit_233[] = { 0x4D, 0x41, 0x58, ANTLR3_STRING_TERMINATOR}; +static ANTLR3_UCHAR lit_234[] = { 0x4D, 0x41, 0x58, 0x56, 0x41, 0x4C, 0x55, 0x45, ANTLR3_STRING_TERMINATOR}; +static ANTLR3_UCHAR lit_235[] = { 0x4D, 0x45, 0x41, 0x53, 0x55, 0x52, 0x45, 0x53, ANTLR3_STRING_TERMINATOR}; +static ANTLR3_UCHAR lit_236[] = { 0x4D, 0x45, 0x4D, 0x42, 0x45, 0x52, ANTLR3_STRING_TERMINATOR}; +static ANTLR3_UCHAR lit_237[] = { 0x4D, 0x45, 0x52, 0x47, 0x45, ANTLR3_STRING_TERMINATOR}; +static ANTLR3_UCHAR lit_238[] = { 0x4D, 0x49, 0x4E, ANTLR3_STRING_TERMINATOR}; +static ANTLR3_UCHAR lit_239[] = { 0x4D, 0x49, 0x56, 0x41, 0x4C, 0x55, 0x45, ANTLR3_STRING_TERMINATOR}; +static ANTLR3_UCHAR lit_240[] = { 0x4D, 0x4C, 0x53, 0x4C, 0x41, 0x42, 0x45, 0x4C, ANTLR3_STRING_TERMINATOR}; +static ANTLR3_UCHAR lit_241[] = { 0x4D, 0x4F, 0x44, 0x45, 0x4C, ANTLR3_STRING_TERMINATOR}; +static ANTLR3_UCHAR lit_242[] = { 0x4D, 0x4F, 0x4E, 0x54, 0x48, ANTLR3_STRING_TERMINATOR}; +static ANTLR3_UCHAR lit_243[] = { 0x4D, 0x55, 0x4C, 0x54, 0x49, 0x53, 0x45, 0x54, ANTLR3_STRING_TERMINATOR}; +static ANTLR3_UCHAR lit_244[] = { 0x4E, 0x41, 0x4E, ANTLR3_STRING_TERMINATOR}; +static ANTLR3_UCHAR lit_245[] = { 0x4E, 0x41, 0x54, 0x49, 0x4F, 0x4E, 0x41, 0x4C, ANTLR3_STRING_TERMINATOR}; +static ANTLR3_UCHAR lit_246[] = { 0x4E, 0x41, 0x54, 0x55, 0x52, 0x41, 0x4C, ANTLR3_STRING_TERMINATOR}; +static ANTLR3_UCHAR lit_247[] = { 0x4E, 0x41, 0x56, ANTLR3_STRING_TERMINATOR}; +static ANTLR3_UCHAR lit_248[] = { 0x4E, 0x43, 0x48, 0x41, 0x52, ANTLR3_STRING_TERMINATOR}; +static ANTLR3_UCHAR lit_249[] = { 0x4E, 0x43, 0x4C, 0x4F, 0x42, ANTLR3_STRING_TERMINATOR}; +static ANTLR3_UCHAR lit_250[] = { 0x4E, 0x4F, 0x43, 0x59, 0x43, 0x4C, 0x45, ANTLR3_STRING_TERMINATOR}; +static ANTLR3_UCHAR lit_251[] = { 0x4E, 0x54, 0x49, 0x4C, 0x45, ANTLR3_STRING_TERMINATOR}; +static ANTLR3_UCHAR lit_252[] = { 0x4E, 0x55, 0x4C, 0x4C, 0x53, ANTLR3_STRING_TERMINATOR}; +static ANTLR3_UCHAR lit_253[] = { 0x4E, 0x55, 0x4D, 0x45, 0x52, 0x49, 0x43, ANTLR3_STRING_TERMINATOR}; +static ANTLR3_UCHAR lit_254[] = { 0x4E, 0x56, 0x41, 0x52, 0x43, 0x48, 0x41, 0x52, ANTLR3_STRING_TERMINATOR}; +static ANTLR3_UCHAR lit_255[] = { 0x4E, 0x56, 0x41, 0x52, 0x43, 0x48, 0x41, 0x52, 0x32, ANTLR3_STRING_TERMINATOR}; +static ANTLR3_UCHAR lit_256[] = { 0x4F, 0x42, 0x4A, 0x45, 0x43, 0x54, 0x5F, 0x49, 0x44, ANTLR3_STRING_TERMINATOR}; +static ANTLR3_UCHAR lit_257[] = { 0x4F, 0x42, 0x4A, 0x45, 0x43, 0x54, 0x5F, 0x56, 0x41, 0x4C, 0x55, 0x45, ANTLR3_STRING_TERMINATOR}; +static ANTLR3_UCHAR lit_258[] = { 0x4F, 0x4E, 0x4C, 0x59, ANTLR3_STRING_TERMINATOR}; +static ANTLR3_UCHAR lit_259[] = { 0x4F, 0x52, 0x41, 0x5F, 0x52, 0x4F, 0x57, 0x53, 0x43, 0x4E, ANTLR3_STRING_TERMINATOR}; +static ANTLR3_UCHAR lit_260[] = { 0x4F, 0x55, 0x54, 0x45, 0x52, ANTLR3_STRING_TERMINATOR}; +static ANTLR3_UCHAR lit_261[] = { 0x4F, 0x56, 0x45, 0x52, ANTLR3_STRING_TERMINATOR}; +static ANTLR3_UCHAR lit_262[] = { 0x50, 0x41, 0x52, 0x54, 0x49, 0x54, 0x49, 0x4F, 0x4E, ANTLR3_STRING_TERMINATOR}; +static ANTLR3_UCHAR lit_263[] = { 0x50, 0x45, 0x52, 0x43, 0x45, 0x4E, 0x54, 0x5F, 0x52, 0x41, 0x4E, 0x4B, ANTLR3_STRING_TERMINATOR}; +static ANTLR3_UCHAR lit_264[] = { 0x50, 0x45, 0x52, 0x43, 0x45, 0x4E, 0x54, 0x49, 0x4C, 0x45, 0x5F, 0x43, 0x4F, 0x4E, 0x54, ANTLR3_STRING_TERMINATOR}; +static ANTLR3_UCHAR lit_265[] = { 0x50, 0x45, 0x52, 0x43, 0x45, 0x4E, 0x54, 0x49, 0x4C, 0x45, 0x5F, 0x44, 0x49, 0x53, 0x43, ANTLR3_STRING_TERMINATOR}; +static ANTLR3_UCHAR lit_266[] = { 0x50, 0x49, 0x56, 0x4F, 0x54, ANTLR3_STRING_TERMINATOR}; +static ANTLR3_UCHAR lit_267[] = { 0x50, 0x4C, 0x53, 0x5F, 0x49, 0x4E, 0x54, 0x45, 0x47, 0x45, 0x52, ANTLR3_STRING_TERMINATOR}; +static ANTLR3_UCHAR lit_268[] = { 0x50, 0x4F, 0x53, 0x49, 0x54, 0x49, 0x56, 0x45, ANTLR3_STRING_TERMINATOR}; +static ANTLR3_UCHAR lit_269[] = { 0x50, 0x52, 0x45, 0x43, 0x45, 0x44, 0x49, 0x4E, 0x47, ANTLR3_STRING_TERMINATOR}; +static ANTLR3_UCHAR lit_270[] = { 0x50, 0x52, 0x45, 0x43, 0x49, 0x53, 0x49, 0x4F, 0x4E, ANTLR3_STRING_TERMINATOR}; +static ANTLR3_UCHAR lit_271[] = { 0x50, 0x52, 0x45, 0x53, 0x45, 0x4E, 0x54, ANTLR3_STRING_TERMINATOR}; +static ANTLR3_UCHAR lit_272[] = { 0x52, 0x41, 0x4E, 0x47, 0x45, ANTLR3_STRING_TERMINATOR}; +static ANTLR3_UCHAR lit_273[] = { 0x52, 0x41, 0x4E, 0x4B, ANTLR3_STRING_TERMINATOR}; +static ANTLR3_UCHAR lit_274[] = { 0x52, 0x41, 0x54, 0x49, 0x4F, 0x5F, 0x54, 0x4F, 0x5F, 0x52, 0x45, 0x50, 0x4F, 0x52, 0x54, ANTLR3_STRING_TERMINATOR}; +static ANTLR3_UCHAR lit_275[] = { 0x52, 0x45, 0x41, 0x44, ANTLR3_STRING_TERMINATOR}; +static ANTLR3_UCHAR lit_276[] = { 0x52, 0x45, 0x41, 0x4C, ANTLR3_STRING_TERMINATOR}; +static ANTLR3_UCHAR lit_277[] = { 0x52, 0x45, 0x46, 0x45, 0x52, 0x45, 0x4E, 0x43, 0x45, ANTLR3_STRING_TERMINATOR}; +static ANTLR3_UCHAR lit_278[] = { 0x52, 0x45, 0x47, 0x45, 0x58, 0x50, 0x5F, 0x4C, 0x49, 0x4B, 0x45, ANTLR3_STRING_TERMINATOR}; +static ANTLR3_UCHAR lit_279[] = { 0x52, 0x45, 0x47, 0x52, 0x5F, 0x41, 0x56, 0x47, 0x58, ANTLR3_STRING_TERMINATOR}; +static ANTLR3_UCHAR lit_280[] = { 0x52, 0x45, 0x47, 0x52, 0x5F, 0x41, 0x56, 0x47, 0x59, ANTLR3_STRING_TERMINATOR}; +static ANTLR3_UCHAR lit_281[] = { 0x52, 0x45, 0x47, 0x52, 0x5F, 0x43, 0x4F, 0x55, 0x4E, 0x54, ANTLR3_STRING_TERMINATOR}; +static ANTLR3_UCHAR lit_282[] = { 0x52, 0x45, 0x47, 0x52, 0x5F, 0x49, 0x4E, 0x54, 0x45, 0x52, 0x43, 0x45, 0x50, 0x54, ANTLR3_STRING_TERMINATOR}; +static ANTLR3_UCHAR lit_283[] = { 0x52, 0x45, 0x47, 0x52, 0x5F, 0x52, 0x32, ANTLR3_STRING_TERMINATOR}; +static ANTLR3_UCHAR lit_284[] = { 0x52, 0x45, 0x47, 0x52, 0x5F, 0x53, 0x4C, 0x4F, 0x50, 0x45, ANTLR3_STRING_TERMINATOR}; +static ANTLR3_UCHAR lit_285[] = { 0x52, 0x45, 0x47, 0x52, 0x5F, 0x53, 0x58, 0x58, ANTLR3_STRING_TERMINATOR}; +static ANTLR3_UCHAR lit_286[] = { 0x52, 0x45, 0x47, 0x52, 0x5F, 0x53, 0x58, 0x59, ANTLR3_STRING_TERMINATOR}; +static ANTLR3_UCHAR lit_287[] = { 0x52, 0x45, 0x47, 0x52, 0x5F, 0x53, 0x59, 0x59, ANTLR3_STRING_TERMINATOR}; +static ANTLR3_UCHAR lit_288[] = { 0x52, 0x45, 0x4A, 0x45, 0x43, 0x54, ANTLR3_STRING_TERMINATOR}; +static ANTLR3_UCHAR lit_289[] = { 0x52, 0x45, 0x53, 0x50, 0x45, 0x43, 0x54, ANTLR3_STRING_TERMINATOR}; +static ANTLR3_UCHAR lit_290[] = { 0x52, 0x45, 0x54, 0x55, 0x52, 0x4E, ANTLR3_STRING_TERMINATOR}; +static ANTLR3_UCHAR lit_291[] = { 0x52, 0x45, 0x54, 0x55, 0x52, 0x4E, 0x49, 0x4E, 0x47, ANTLR3_STRING_TERMINATOR}; +static ANTLR3_UCHAR lit_292[] = { 0x52, 0x49, 0x47, 0x48, 0x54, ANTLR3_STRING_TERMINATOR}; +static ANTLR3_UCHAR lit_293[] = { 0x52, 0x4F, 0x4C, 0x4C, 0x55, 0x50, ANTLR3_STRING_TERMINATOR}; +static ANTLR3_UCHAR lit_294[] = { 0x52, 0x4F, 0x57, 0x5F, 0x4E, 0x55, 0x4D, 0x42, 0x45, 0x52, ANTLR3_STRING_TERMINATOR}; +static ANTLR3_UCHAR lit_295[] = { 0x52, 0x55, 0x4C, 0x45, 0x53, ANTLR3_STRING_TERMINATOR}; +static ANTLR3_UCHAR lit_296[] = { 0x53, 0x41, 0x4D, 0x50, 0x4C, 0x45, ANTLR3_STRING_TERMINATOR}; +static ANTLR3_UCHAR lit_297[] = { 0x53, 0x43, 0x4E, ANTLR3_STRING_TERMINATOR}; +static ANTLR3_UCHAR lit_298[] = { 0x53, 0x45, 0x41, 0x52, 0x43, 0x48, ANTLR3_STRING_TERMINATOR}; +static ANTLR3_UCHAR lit_299[] = { 0x53, 0x45, 0x43, 0x4F, 0x4E, 0x44, ANTLR3_STRING_TERMINATOR}; +static ANTLR3_UCHAR lit_300[] = { 0x53, 0x45, 0x45, 0x44, ANTLR3_STRING_TERMINATOR}; +static ANTLR3_UCHAR lit_301[] = { 0x53, 0x45, 0x51, 0x55, 0x45, 0x4E, 0x54, 0x49, 0x41, 0x4C, ANTLR3_STRING_TERMINATOR}; +static ANTLR3_UCHAR lit_302[] = { 0x53, 0x45, 0x53, 0x53, 0x49, 0x4F, 0x4E, 0x54, 0x49, 0x4D, 0x45, 0x5A, 0x4F, 0x4E, 0x45, ANTLR3_STRING_TERMINATOR}; +static ANTLR3_UCHAR lit_303[] = { 0x53, 0x45, 0x54, 0x53, ANTLR3_STRING_TERMINATOR}; +static ANTLR3_UCHAR lit_304[] = { 0x53, 0x49, 0x42, 0x4C, 0x49, 0x4E, 0x47, 0x53, ANTLR3_STRING_TERMINATOR}; +static ANTLR3_UCHAR lit_305[] = { 0x53, 0x49, 0x4E, 0x47, 0x4C, 0x45, ANTLR3_STRING_TERMINATOR}; +static ANTLR3_UCHAR lit_306[] = { 0x53, 0x4B, 0x49, 0x50, ANTLR3_STRING_TERMINATOR}; +static ANTLR3_UCHAR lit_307[] = { 0x53, 0x4F, 0x4D, 0x45, ANTLR3_STRING_TERMINATOR}; +static ANTLR3_UCHAR lit_308[] = { 0x53, 0x51, 0x4C, ANTLR3_STRING_TERMINATOR}; +static ANTLR3_UCHAR lit_309[] = { 0x53, 0x54, 0x44, 0x44, 0x45, 0x56, ANTLR3_STRING_TERMINATOR}; +static ANTLR3_UCHAR lit_310[] = { 0x53, 0x54, 0x44, 0x44, 0x45, 0x56, 0x5F, 0x50, 0x4F, 0x50, ANTLR3_STRING_TERMINATOR}; +static ANTLR3_UCHAR lit_311[] = { 0x53, 0x54, 0x44, 0x44, 0x45, 0x56, 0x5F, 0x53, 0x41, 0x4D, 0x50, ANTLR3_STRING_TERMINATOR}; +static ANTLR3_UCHAR lit_312[] = { 0x53, 0x55, 0x42, 0x4D, 0x55, 0x4C, 0x54, 0x49, 0x53, 0x45, 0x54, ANTLR3_STRING_TERMINATOR}; +static ANTLR3_UCHAR lit_313[] = { 0x53, 0x55, 0x42, 0x50, 0x41, 0x52, 0x54, 0x49, 0x54, 0x49, 0x4F, 0x4E, ANTLR3_STRING_TERMINATOR}; +static ANTLR3_UCHAR lit_314[] = { 0x53, 0x55, 0x4D, ANTLR3_STRING_TERMINATOR}; +static ANTLR3_UCHAR lit_315[] = { 0x54, 0x48, 0x45, ANTLR3_STRING_TERMINATOR}; +static ANTLR3_UCHAR lit_316[] = { 0x54, 0x49, 0x4D, 0x45, ANTLR3_STRING_TERMINATOR}; +static ANTLR3_UCHAR lit_317[] = { 0x54, 0x49, 0x4D, 0x45, 0x53, 0x54, 0x41, 0x4D, 0x50, ANTLR3_STRING_TERMINATOR}; +static ANTLR3_UCHAR lit_318[] = { 0x54, 0x59, 0x50, 0x45, ANTLR3_STRING_TERMINATOR}; +static ANTLR3_UCHAR lit_319[] = { 0x55, 0x4E, 0x42, 0x4F, 0x55, 0x4E, 0x44, 0x45, 0x44, ANTLR3_STRING_TERMINATOR}; +static ANTLR3_UCHAR lit_320[] = { 0x55, 0x4E, 0x44, 0x45, 0x52, 0x5F, 0x50, 0x41, 0x54, 0x48, ANTLR3_STRING_TERMINATOR}; +static ANTLR3_UCHAR lit_321[] = { 0x55, 0x4E, 0x4C, 0x49, 0x4D, 0x49, 0x54, 0x45, 0x44, ANTLR3_STRING_TERMINATOR}; +static ANTLR3_UCHAR lit_322[] = { 0x55, 0x4E, 0x50, 0x49, 0x56, 0x4F, 0x54, ANTLR3_STRING_TERMINATOR}; +static ANTLR3_UCHAR lit_323[] = { 0x55, 0x4E, 0x54, 0x49, 0x4C, ANTLR3_STRING_TERMINATOR}; +static ANTLR3_UCHAR lit_324[] = { 0x55, 0x50, 0x44, 0x41, 0x54, 0x45, 0x44, ANTLR3_STRING_TERMINATOR}; +static ANTLR3_UCHAR lit_325[] = { 0x55, 0x50, 0x53, 0x45, 0x52, 0x54, ANTLR3_STRING_TERMINATOR}; +static ANTLR3_UCHAR lit_326[] = { 0x55, 0x52, 0x4F, 0x57, 0x49, 0x44, ANTLR3_STRING_TERMINATOR}; +static ANTLR3_UCHAR lit_327[] = { 0x55, 0x53, 0x49, 0x4E, 0x47, ANTLR3_STRING_TERMINATOR}; +static ANTLR3_UCHAR lit_328[] = { 0x56, 0x41, 0x4C, 0x55, 0x45, ANTLR3_STRING_TERMINATOR}; +static ANTLR3_UCHAR lit_329[] = { 0x56, 0x41, 0x52, 0x5F, 0x50, 0x4F, 0x50, ANTLR3_STRING_TERMINATOR}; +static ANTLR3_UCHAR lit_330[] = { 0x56, 0x41, 0x52, 0x5F, 0x53, 0x41, 0x4D, 0x50, ANTLR3_STRING_TERMINATOR}; +static ANTLR3_UCHAR lit_331[] = { 0x56, 0x41, 0x52, 0x49, 0x41, 0x4E, 0x43, 0x45, ANTLR3_STRING_TERMINATOR}; +static ANTLR3_UCHAR lit_332[] = { 0x56, 0x41, 0x52, 0x59, 0x49, 0x4E, 0x47, ANTLR3_STRING_TERMINATOR}; +static ANTLR3_UCHAR lit_333[] = { 0x56, 0x45, 0x52, 0x53, 0x49, 0x4F, 0x4E, 0x53, ANTLR3_STRING_TERMINATOR}; +static ANTLR3_UCHAR lit_334[] = { 0x57, 0x41, 0x49, 0x54, ANTLR3_STRING_TERMINATOR}; +static ANTLR3_UCHAR lit_335[] = { 0x57, 0x48, 0x45, 0x4E, ANTLR3_STRING_TERMINATOR}; +static ANTLR3_UCHAR lit_336[] = { 0x57, 0x49, 0x54, 0x48, 0x49, 0x4E, ANTLR3_STRING_TERMINATOR}; +static ANTLR3_UCHAR lit_337[] = { 0x58, 0x4D, 0x4C, ANTLR3_STRING_TERMINATOR}; +static ANTLR3_UCHAR lit_338[] = { 0x58, 0x4D, 0x4C, 0x44, 0x41, 0x54, 0x41, ANTLR3_STRING_TERMINATOR}; +static ANTLR3_UCHAR lit_339[] = { 0x59, 0x45, 0x41, 0x52, ANTLR3_STRING_TERMINATOR}; +static ANTLR3_UCHAR lit_340[] = { 0x5A, 0x4F, 0x4E, 0x45, ANTLR3_STRING_TERMINATOR}; +static ANTLR3_UCHAR lit_341[] = { 0x27, 0x27, ANTLR3_STRING_TERMINATOR}; +static ANTLR3_UCHAR lit_342[] = { 0x2A, 0x2A, ANTLR3_STRING_TERMINATOR}; +static ANTLR3_UCHAR lit_343[] = { 0x3C, 0x3C, ANTLR3_STRING_TERMINATOR}; +static ANTLR3_UCHAR lit_344[] = { 0x3E, 0x3E, ANTLR3_STRING_TERMINATOR}; +static ANTLR3_UCHAR lit_345[] = { 0x3A, 0x3D, ANTLR3_STRING_TERMINATOR}; +static ANTLR3_UCHAR lit_346[] = { 0x3D, 0x3E, ANTLR3_STRING_TERMINATOR}; +static ANTLR3_UCHAR lit_347[] = { 0x7C, 0x7C, ANTLR3_STRING_TERMINATOR}; +static ANTLR3_UCHAR lit_348[] = { 0x3C, 0x3E, ANTLR3_STRING_TERMINATOR}; +static ANTLR3_UCHAR lit_349[] = { 0x21, 0x3D, ANTLR3_STRING_TERMINATOR}; +static ANTLR3_UCHAR lit_350[] = { 0x5E, 0x3D, ANTLR3_STRING_TERMINATOR}; +static ANTLR3_UCHAR lit_351[] = { 0x3C, 0x3D, ANTLR3_STRING_TERMINATOR}; +static ANTLR3_UCHAR lit_352[] = { 0x3E, 0x3D, ANTLR3_STRING_TERMINATOR}; +static ANTLR3_UCHAR lit_353[] = { 0x2D, 0x2D, ANTLR3_STRING_TERMINATOR}; +static ANTLR3_UCHAR lit_354[] = { 0x2F, 0x2A, ANTLR3_STRING_TERMINATOR}; +static ANTLR3_UCHAR lit_355[] = { 0x2A, 0x2F, ANTLR3_STRING_TERMINATOR}; +static ANTLR3_UCHAR lit_356[] = { 0x25, 0x54, 0x59, 0x50, 0x45, ANTLR3_STRING_TERMINATOR}; +static ANTLR3_UCHAR lit_357[] = { 0x25, 0x52, 0x4F, 0x57, 0x54, 0x59, 0x50, 0x45, ANTLR3_STRING_TERMINATOR}; +static ANTLR3_UCHAR lit_358[] = { 0x25, 0x4E, 0x4F, 0x54, 0x46, 0x4F, 0x55, 0x4E, 0x44, ANTLR3_STRING_TERMINATOR}; +static ANTLR3_UCHAR lit_359[] = { 0x25, 0x46, 0x4F, 0x55, 0x4E, 0x44, ANTLR3_STRING_TERMINATOR}; +static ANTLR3_UCHAR lit_360[] = { 0x25, 0x49, 0x53, 0x4F, 0x50, 0x45, 0x4E, ANTLR3_STRING_TERMINATOR}; +static ANTLR3_UCHAR lit_361[] = { 0x25, 0x52, 0x4F, 0x57, 0x43, 0x4F, 0x55, 0x4E, 0x54, ANTLR3_STRING_TERMINATOR}; +static ANTLR3_UCHAR lit_362[] = { 0x25, 0x42, 0x55, 0x4C, 0x4B, 0x5F, 0x52, 0x4F, 0x57, 0x43, 0x4F, 0x55, 0x4E, 0x54, ANTLR3_STRING_TERMINATOR}; +static ANTLR3_UCHAR lit_363[] = { 0x25, 0x43, 0x48, 0x41, 0x52, 0x53, 0x45, 0x54, ANTLR3_STRING_TERMINATOR}; + + + + +/* MACROS that hide the C interface implementations from the + * generated code, which makes it a little more understandable to the human eye. + * I am very much against using C pre-processor macros for function calls and bits + * of code as you cannot see what is happening when single stepping in debuggers + * and so on. The exception (in my book at least) is for generated code, where you are + * not maintaining it, but may wish to read and understand it. If you single step it, you know that input() + * hides some indirect calls, but is always referring to the input stream. This is + * probably more readable than ctx->input->istream->input(snarfle0->blarg) and allows me to rejig + * the runtime interfaces without changing the generated code too often, without + * confusing the reader of the generated output, who may not wish to know the gory + * details of the interface inheritance. + */ + +#define CTX ctx + +/* Aids in accessing scopes for grammar programmers + */ +#undef SCOPE_TYPE +#undef SCOPE_STACK +#undef SCOPE_TOP +#define SCOPE_TYPE(scope) pOracleSQLLexer_##scope##_SCOPE +#define SCOPE_STACK(scope) pOracleSQLLexer_##scope##Stack +#define SCOPE_TOP(scope) ctx->pOracleSQLLexer_##scope##Top +#define SCOPE_SIZE(scope) ctx->pOracleSQLLexer_##scope##Stack_limit +#define SCOPE_INSTANCE(scope, i) (ctx->SCOPE_STACK(scope)->get(ctx->SCOPE_STACK(scope),i)) + + +/* Macros for accessing things in a lexer + */ +#undef LEXER +#undef RECOGNIZER +#undef RULEMEMO +#undef GETCHARINDEX +#undef GETLINE +#undef GETCHARPOSITIONINLINE +#undef EMIT +#undef EMITNEW +#undef MATCHC +#undef MATCHS +#undef MATCHRANGE +#undef LTOKEN +#undef HASFAILED +#undef FAILEDFLAG +#undef INPUT +#undef STRSTREAM +#undef LA +#undef HASEXCEPTION +#undef EXCEPTION +#undef CONSTRUCTEX +#undef CONSUME +#undef LRECOVER +#undef MARK +#undef REWIND +#undef REWINDLAST +#undef BACKTRACKING +#undef MATCHANY +#undef MEMOIZE +#undef HAVEPARSEDRULE +#undef GETTEXT +#undef INDEX +#undef SEEK +#undef PUSHSTREAM +#undef POPSTREAM +#undef SETTEXT +#undef SETTEXT8 + +#define LEXER ctx->pLexer +#define RECOGNIZER LEXER->rec +#define LEXSTATE RECOGNIZER->state +#define TOKSOURCE LEXSTATE->tokSource +#define GETCHARINDEX() LEXER->getCharIndex(LEXER) +#define GETLINE() LEXER->getLine(LEXER) +#define GETTEXT() LEXER->getText(LEXER) +#define GETCHARPOSITIONINLINE() LEXER->getCharPositionInLine(LEXER) +#define EMIT() LEXSTATE->type = _type; LEXER->emit(LEXER) +#define EMITNEW(t) LEXER->emitNew(LEXER, t) +#define MATCHC(c) LEXER->matchc(LEXER, c) +#define MATCHS(s) LEXER->matchs(LEXER, s) +#define MATCHRANGE(c1,c2) LEXER->matchRange(LEXER, c1, c2) +#define MATCHANY() LEXER->matchAny(LEXER) +#define LTOKEN LEXSTATE->token +#define HASFAILED() (LEXSTATE->failed == ANTLR3_TRUE) +#define BACKTRACKING LEXSTATE->backtracking +#define FAILEDFLAG LEXSTATE->failed +#define INPUT LEXER->input +#define STRSTREAM INPUT +#define ISTREAM INPUT->istream +#define INDEX() ISTREAM->index(ISTREAM) +#define SEEK(n) ISTREAM->seek(ISTREAM, n) +#define EOF_TOKEN &(LEXSTATE->tokSource->eofToken) +#define HASEXCEPTION() (LEXSTATE->error == ANTLR3_TRUE) +#define EXCEPTION LEXSTATE->exception +#define CONSTRUCTEX() RECOGNIZER->exConstruct(RECOGNIZER) +#define LRECOVER() LEXER->recover(LEXER) +#define MARK() ISTREAM->mark(ISTREAM) +#define REWIND(m) ISTREAM->rewind(ISTREAM, m) +#define REWINDLAST() ISTREAM->rewindLast(ISTREAM) +#define MEMOIZE(ri,si) RECOGNIZER->memoize(RECOGNIZER, ri, si) +#define HAVEPARSEDRULE(r) RECOGNIZER->alreadyParsedRule(RECOGNIZER, r) +#define PUSHSTREAM(str) LEXER->pushCharStream(LEXER, str) +#define POPSTREAM() LEXER->popCharStream(LEXER) +#define SETTEXT(str) LEXSTATE->text = str +#define SKIP() LEXSTATE->token = &(TOKSOURCE->skipToken) +#define USER1 LEXSTATE->user1 +#define USER2 LEXSTATE->user2 +#define USER3 LEXSTATE->user3 +#define CUSTOM LEXSTATE->custom +#define RULEMEMO LEXSTATE->ruleMemo +#define DBG RECOGNIZER->debugger + +/* If we have been told we can rely on the standard 8 bit or 16 bit input + * stream, then we can define our macros to use the direct pointers + * in the input object, which is much faster than indirect calls. This + * is really only significant to lexers with a lot of fragment rules (which + * do not place LA(1) in a temporary at the moment) and even then + * only if there is a lot of input (order of say 1M or so). + */ +#if defined(ANTLR3_INLINE_INPUT_ASCII) || defined(ANTLR3_INLINE_INPUT_UTF16) + +# ifdef ANTLR3_INLINE_INPUT_ASCII + +/* 8 bit "ASCII" (actually any 8 bit character set) */ + +# define NEXTCHAR ((pANTLR3_UINT8)(INPUT->nextChar)) +# define DATAP ((pANTLR3_UINT8)(INPUT->data)) + +# else + +# define NEXTCHAR ((pANTLR3_UINT16)(INPUT->nextChar)) +# define DATAP ((pANTLR3_UINT16)(INPUT->data)) + +# endif + +# define LA(n) ((NEXTCHAR + n) > (DATAP + INPUT->sizeBuf) ? ANTLR3_CHARSTREAM_EOF : (ANTLR3_UCHAR)(*(NEXTCHAR + n - 1))) +# define CONSUME() \ +{ \ + if (NEXTCHAR < (DATAP + INPUT->sizeBuf)) \ + { \ + INPUT->charPositionInLine++; \ + if ((ANTLR3_UCHAR)(*NEXTCHAR) == INPUT->newlineChar) \ + { \ + INPUT->line++; \ + INPUT->charPositionInLine = 0; \ + INPUT->currentLine = (void *)(NEXTCHAR + 1); \ + } \ + INPUT->nextChar = (void *)(NEXTCHAR + 1); \ + } \ +} + +#else + +// Pick up the input character by calling the input stream implementation. +// +#define CONSUME() INPUT->istream->consume(INPUT->istream) +#define LA(n) INPUT->istream->_LA(INPUT->istream, n) + +#endif +#define TOKTEXT(tok, txt) tok, (pANTLR3_UINT8)txt + +/* The 4 tokens defined below may well clash with your own #defines or token types. If so + * then for the present you must use different names for your defines as these are hard coded + * in the code generator. It would be better not to use such names internally, and maybe + * we can change this in a forthcoming release. I deliberately do not #undef these + * here as this will at least give you a redefined error somewhere if they clash. + */ +#define UP ANTLR3_TOKEN_UP +#define DOWN ANTLR3_TOKEN_DOWN +#define EOR ANTLR3_TOKEN_EOR +#define INVALID ANTLR3_TOKEN_INVALID + + +/* ============================================================================= + * Functions to create and destroy scopes. First come the rule scopes, followed + * by the global declared scopes. + */ + + + +/* ============================================================================= */ + +/* ============================================================================= + * Start of recognizer + */ + + +/* Forward declare the locally static matching functions we have generated and any predicate functions. + */ +static ANTLR3_INLINE void mT_UNKNOWN (pOracleSQLLexer ctx); +static ANTLR3_INLINE void mT_RESERVED (pOracleSQLLexer ctx); +static ANTLR3_INLINE void mT_TABLE_ALIAS (pOracleSQLLexer ctx); +static ANTLR3_INLINE void mT_COLUMN_ALIAS (pOracleSQLLexer ctx); +static ANTLR3_INLINE void mT_COLUMN_NAME (pOracleSQLLexer ctx); +static ANTLR3_INLINE void mT_TABLE_NAME (pOracleSQLLexer ctx); +static ANTLR3_INLINE void mT_SCHEMA_NAME (pOracleSQLLexer ctx); +static ANTLR3_INLINE void mT_FUNCTION_NAME (pOracleSQLLexer ctx); +static ANTLR3_INLINE void mT_WITH (pOracleSQLLexer ctx); +static ANTLR3_INLINE void mT_SELECT (pOracleSQLLexer ctx); +static ANTLR3_INLINE void mT_COLUMN_LIST (pOracleSQLLexer ctx); +static ANTLR3_INLINE void mT_SELECT_COLUMN (pOracleSQLLexer ctx); +static ANTLR3_INLINE void mT_FROM (pOracleSQLLexer ctx); +static ANTLR3_INLINE void mT_SELECTED_TABLE (pOracleSQLLexer ctx); +static ANTLR3_INLINE void mT_WHERE (pOracleSQLLexer ctx); +static ANTLR3_INLINE void mT_HIERARCHICAL (pOracleSQLLexer ctx); +static ANTLR3_INLINE void mT_GROUP_BY (pOracleSQLLexer ctx); +static ANTLR3_INLINE void mT_HAVING (pOracleSQLLexer ctx); +static ANTLR3_INLINE void mT_MODEL (pOracleSQLLexer ctx); +static ANTLR3_INLINE void mT_UNION (pOracleSQLLexer ctx); +static ANTLR3_INLINE void mT_ORDER_BY_CLAUSE (pOracleSQLLexer ctx); +static ANTLR3_INLINE void mT_FOR_UPDATE_CLAUSE (pOracleSQLLexer ctx); +static ANTLR3_INLINE void mT_COND_OR (pOracleSQLLexer ctx); +static ANTLR3_INLINE void mT_COND_OR_SEQ (pOracleSQLLexer ctx); +static ANTLR3_INLINE void mT_COND_AND (pOracleSQLLexer ctx); +static ANTLR3_INLINE void mT_COND_AND_SEQ (pOracleSQLLexer ctx); +static ANTLR3_INLINE void mT_COND_NOT (pOracleSQLLexer ctx); +static ANTLR3_INLINE void mT_COND_EXISTS (pOracleSQLLexer ctx); +static ANTLR3_INLINE void mT_COND_IS (pOracleSQLLexer ctx); +static ANTLR3_INLINE void mT_COND_COMPARISON (pOracleSQLLexer ctx); +static ANTLR3_INLINE void mT_COND_GROUP_COMPARISON (pOracleSQLLexer ctx); +static ANTLR3_INLINE void mT_COND_IN (pOracleSQLLexer ctx); +static ANTLR3_INLINE void mT_COND_IS_A_SET (pOracleSQLLexer ctx); +static ANTLR3_INLINE void mT_COND_IS_ANY (pOracleSQLLexer ctx); +static ANTLR3_INLINE void mT_COND_IS_EMPTY (pOracleSQLLexer ctx); +static ANTLR3_INLINE void mT_COND_IS_OF_TYPE (pOracleSQLLexer ctx); +static ANTLR3_INLINE void mT_COND_IS_PRESENT (pOracleSQLLexer ctx); +static ANTLR3_INLINE void mT_COND_LIKE (pOracleSQLLexer ctx); +static ANTLR3_INLINE void mT_COND_MEMEBER (pOracleSQLLexer ctx); +static ANTLR3_INLINE void mT_COND_BETWEEN (pOracleSQLLexer ctx); +static ANTLR3_INLINE void mT_COND_REGEXP_LIKE (pOracleSQLLexer ctx); +static ANTLR3_INLINE void mT_COND_SUBMULTISET (pOracleSQLLexer ctx); +static ANTLR3_INLINE void mT_COND_EQUALS_PATH (pOracleSQLLexer ctx); +static ANTLR3_INLINE void mT_COND_UNDER_PATH (pOracleSQLLexer ctx); +static ANTLR3_INLINE void mT_COND_PAREN (pOracleSQLLexer ctx); +static ANTLR3_INLINE void mT__102 (pOracleSQLLexer ctx); +static ANTLR3_INLINE void mT__103 (pOracleSQLLexer ctx); +static ANTLR3_INLINE void mT__104 (pOracleSQLLexer ctx); +static ANTLR3_INLINE void mT__105 (pOracleSQLLexer ctx); +static ANTLR3_INLINE void mT__106 (pOracleSQLLexer ctx); +static ANTLR3_INLINE void mT__107 (pOracleSQLLexer ctx); +static ANTLR3_INLINE void mT__108 (pOracleSQLLexer ctx); +static ANTLR3_INLINE void mT__109 (pOracleSQLLexer ctx); +static ANTLR3_INLINE void mT__110 (pOracleSQLLexer ctx); +static ANTLR3_INLINE void mT__111 (pOracleSQLLexer ctx); +static ANTLR3_INLINE void mT__112 (pOracleSQLLexer ctx); +static ANTLR3_INLINE void mT__113 (pOracleSQLLexer ctx); +static ANTLR3_INLINE void mT__114 (pOracleSQLLexer ctx); +static ANTLR3_INLINE void mT__115 (pOracleSQLLexer ctx); +static ANTLR3_INLINE void mT__116 (pOracleSQLLexer ctx); +static ANTLR3_INLINE void mT__117 (pOracleSQLLexer ctx); +static ANTLR3_INLINE void mT__118 (pOracleSQLLexer ctx); +static ANTLR3_INLINE void mT__119 (pOracleSQLLexer ctx); +static ANTLR3_INLINE void mT__120 (pOracleSQLLexer ctx); +static ANTLR3_INLINE void mT__121 (pOracleSQLLexer ctx); +static ANTLR3_INLINE void mT__122 (pOracleSQLLexer ctx); +static ANTLR3_INLINE void mT__123 (pOracleSQLLexer ctx); +static ANTLR3_INLINE void mT__124 (pOracleSQLLexer ctx); +static ANTLR3_INLINE void mT__125 (pOracleSQLLexer ctx); +static ANTLR3_INLINE void mT__126 (pOracleSQLLexer ctx); +static ANTLR3_INLINE void mT__127 (pOracleSQLLexer ctx); +static ANTLR3_INLINE void mT__128 (pOracleSQLLexer ctx); +static ANTLR3_INLINE void mT__129 (pOracleSQLLexer ctx); +static ANTLR3_INLINE void mT__130 (pOracleSQLLexer ctx); +static ANTLR3_INLINE void mT__131 (pOracleSQLLexer ctx); +static ANTLR3_INLINE void mT__132 (pOracleSQLLexer ctx); +static ANTLR3_INLINE void mT__133 (pOracleSQLLexer ctx); +static ANTLR3_INLINE void mT__134 (pOracleSQLLexer ctx); +static ANTLR3_INLINE void mT__135 (pOracleSQLLexer ctx); +static ANTLR3_INLINE void mT__136 (pOracleSQLLexer ctx); +static ANTLR3_INLINE void mT__137 (pOracleSQLLexer ctx); +static ANTLR3_INLINE void mT__138 (pOracleSQLLexer ctx); +static ANTLR3_INLINE void mT__139 (pOracleSQLLexer ctx); +static ANTLR3_INLINE void mT__140 (pOracleSQLLexer ctx); +static ANTLR3_INLINE void mT__141 (pOracleSQLLexer ctx); +static ANTLR3_INLINE void mT__142 (pOracleSQLLexer ctx); +static ANTLR3_INLINE void mT__143 (pOracleSQLLexer ctx); +static ANTLR3_INLINE void mT__144 (pOracleSQLLexer ctx); +static ANTLR3_INLINE void mT__145 (pOracleSQLLexer ctx); +static ANTLR3_INLINE void mT__146 (pOracleSQLLexer ctx); +static ANTLR3_INLINE void mT__147 (pOracleSQLLexer ctx); +static ANTLR3_INLINE void mT__148 (pOracleSQLLexer ctx); +static ANTLR3_INLINE void mT__149 (pOracleSQLLexer ctx); +static ANTLR3_INLINE void mT__150 (pOracleSQLLexer ctx); +static ANTLR3_INLINE void mT__151 (pOracleSQLLexer ctx); +static ANTLR3_INLINE void mT__152 (pOracleSQLLexer ctx); +static ANTLR3_INLINE void mT__153 (pOracleSQLLexer ctx); +static ANTLR3_INLINE void mT__154 (pOracleSQLLexer ctx); +static ANTLR3_INLINE void mT__155 (pOracleSQLLexer ctx); +static ANTLR3_INLINE void mT__156 (pOracleSQLLexer ctx); +static ANTLR3_INLINE void mT__157 (pOracleSQLLexer ctx); +static ANTLR3_INLINE void mT__158 (pOracleSQLLexer ctx); +static ANTLR3_INLINE void mT__159 (pOracleSQLLexer ctx); +static ANTLR3_INLINE void mT__160 (pOracleSQLLexer ctx); +static ANTLR3_INLINE void mT__161 (pOracleSQLLexer ctx); +static ANTLR3_INLINE void mT__162 (pOracleSQLLexer ctx); +static ANTLR3_INLINE void mT__163 (pOracleSQLLexer ctx); +static ANTLR3_INLINE void mT__164 (pOracleSQLLexer ctx); +static ANTLR3_INLINE void mT__165 (pOracleSQLLexer ctx); +static ANTLR3_INLINE void mT__166 (pOracleSQLLexer ctx); +static ANTLR3_INLINE void mT__167 (pOracleSQLLexer ctx); +static ANTLR3_INLINE void mT__168 (pOracleSQLLexer ctx); +static ANTLR3_INLINE void mT__169 (pOracleSQLLexer ctx); +static ANTLR3_INLINE void mT__170 (pOracleSQLLexer ctx); +static ANTLR3_INLINE void mT__171 (pOracleSQLLexer ctx); +static ANTLR3_INLINE void mT__172 (pOracleSQLLexer ctx); +static ANTLR3_INLINE void mT__173 (pOracleSQLLexer ctx); +static ANTLR3_INLINE void mT__174 (pOracleSQLLexer ctx); +static ANTLR3_INLINE void mT__175 (pOracleSQLLexer ctx); +static ANTLR3_INLINE void mT__176 (pOracleSQLLexer ctx); +static ANTLR3_INLINE void mT__177 (pOracleSQLLexer ctx); +static ANTLR3_INLINE void mT__178 (pOracleSQLLexer ctx); +static ANTLR3_INLINE void mT__179 (pOracleSQLLexer ctx); +static ANTLR3_INLINE void mT__180 (pOracleSQLLexer ctx); +static ANTLR3_INLINE void mT__181 (pOracleSQLLexer ctx); +static ANTLR3_INLINE void mT__182 (pOracleSQLLexer ctx); +static ANTLR3_INLINE void mT__183 (pOracleSQLLexer ctx); +static ANTLR3_INLINE void mT__184 (pOracleSQLLexer ctx); +static ANTLR3_INLINE void mT__185 (pOracleSQLLexer ctx); +static ANTLR3_INLINE void mT__186 (pOracleSQLLexer ctx); +static ANTLR3_INLINE void mT__187 (pOracleSQLLexer ctx); +static ANTLR3_INLINE void mT__188 (pOracleSQLLexer ctx); +static ANTLR3_INLINE void mT__189 (pOracleSQLLexer ctx); +static ANTLR3_INLINE void mT__190 (pOracleSQLLexer ctx); +static ANTLR3_INLINE void mT__191 (pOracleSQLLexer ctx); +static ANTLR3_INLINE void mT__192 (pOracleSQLLexer ctx); +static ANTLR3_INLINE void mT__193 (pOracleSQLLexer ctx); +static ANTLR3_INLINE void mT__194 (pOracleSQLLexer ctx); +static ANTLR3_INLINE void mT__195 (pOracleSQLLexer ctx); +static ANTLR3_INLINE void mT__196 (pOracleSQLLexer ctx); +static ANTLR3_INLINE void mT__197 (pOracleSQLLexer ctx); +static ANTLR3_INLINE void mT__198 (pOracleSQLLexer ctx); +static ANTLR3_INLINE void mT__199 (pOracleSQLLexer ctx); +static ANTLR3_INLINE void mT__200 (pOracleSQLLexer ctx); +static ANTLR3_INLINE void mT__201 (pOracleSQLLexer ctx); +static ANTLR3_INLINE void mT__202 (pOracleSQLLexer ctx); +static ANTLR3_INLINE void mT__203 (pOracleSQLLexer ctx); +static ANTLR3_INLINE void mT__204 (pOracleSQLLexer ctx); +static ANTLR3_INLINE void mT__205 (pOracleSQLLexer ctx); +static ANTLR3_INLINE void mT__206 (pOracleSQLLexer ctx); +static ANTLR3_INLINE void mT__207 (pOracleSQLLexer ctx); +static ANTLR3_INLINE void mT__208 (pOracleSQLLexer ctx); +static ANTLR3_INLINE void mT__209 (pOracleSQLLexer ctx); +static ANTLR3_INLINE void mT__210 (pOracleSQLLexer ctx); +static ANTLR3_INLINE void mT__211 (pOracleSQLLexer ctx); +static ANTLR3_INLINE void mT__212 (pOracleSQLLexer ctx); +static ANTLR3_INLINE void mT__213 (pOracleSQLLexer ctx); +static ANTLR3_INLINE void mT__214 (pOracleSQLLexer ctx); +static ANTLR3_INLINE void mT__215 (pOracleSQLLexer ctx); +static ANTLR3_INLINE void mT__216 (pOracleSQLLexer ctx); +static ANTLR3_INLINE void mT__217 (pOracleSQLLexer ctx); +static ANTLR3_INLINE void mT__218 (pOracleSQLLexer ctx); +static ANTLR3_INLINE void mT__219 (pOracleSQLLexer ctx); +static ANTLR3_INLINE void mT__220 (pOracleSQLLexer ctx); +static ANTLR3_INLINE void mT__221 (pOracleSQLLexer ctx); +static ANTLR3_INLINE void mT__222 (pOracleSQLLexer ctx); +static ANTLR3_INLINE void mT__223 (pOracleSQLLexer ctx); +static ANTLR3_INLINE void mT__224 (pOracleSQLLexer ctx); +static ANTLR3_INLINE void mT__225 (pOracleSQLLexer ctx); +static ANTLR3_INLINE void mT__226 (pOracleSQLLexer ctx); +static ANTLR3_INLINE void mT__227 (pOracleSQLLexer ctx); +static ANTLR3_INLINE void mT__228 (pOracleSQLLexer ctx); +static ANTLR3_INLINE void mT__229 (pOracleSQLLexer ctx); +static ANTLR3_INLINE void mT__230 (pOracleSQLLexer ctx); +static ANTLR3_INLINE void mT__231 (pOracleSQLLexer ctx); +static ANTLR3_INLINE void mT__232 (pOracleSQLLexer ctx); +static ANTLR3_INLINE void mT__233 (pOracleSQLLexer ctx); +static ANTLR3_INLINE void mT__234 (pOracleSQLLexer ctx); +static ANTLR3_INLINE void mT__235 (pOracleSQLLexer ctx); +static ANTLR3_INLINE void mT__236 (pOracleSQLLexer ctx); +s... [truncated message content] |
From: <ibr...@us...> - 2011-03-03 11:33:36
|
Revision: 3914 http://tora.svn.sourceforge.net/tora/?rev=3914&view=rev Author: ibre5041 Date: 2011-03-03 11:33:30 +0000 (Thu, 03 Mar 2011) Log Message: ----------- Modified Paths: -------------- branches/tora-trotl/src/trotl/src/Loki/Factory_alt.h branches/tora-trotl/src/trotl_test3.cpp Modified: branches/tora-trotl/src/trotl/src/Loki/Factory_alt.h =================================================================== --- branches/tora-trotl/src/trotl/src/Loki/Factory_alt.h 2011-03-03 11:29:59 UTC (rev 3913) +++ branches/tora-trotl/src/trotl/src/Loki/Factory_alt.h 2011-03-03 11:33:30 UTC (rev 3914) @@ -290,10 +290,10 @@ void dump() const { typename parent::FctRegistry::const_iterator i; - for(i = parent::mRegistry.begin(); i != parent::mRegistry.end(); ++i) - { - std::cout << "Key:" << i->first << std::endl; - } + /* for(i = parent::mRegistry.begin(); i != parent::mRegistry.end(); ++i) */ + /* { */ + /* std::cout << "Key:" << i->first << std::endl; */ + /* } */ } private: Modified: branches/tora-trotl/src/trotl_test3.cpp =================================================================== --- branches/tora-trotl/src/trotl_test3.cpp 2011-03-03 11:29:59 UTC (rev 3913) +++ branches/tora-trotl/src/trotl_test3.cpp 2011-03-03 11:33:30 UTC (rev 3914) @@ -39,403 +39,156 @@ * * END_COMMON_COPYRIGHT_HEADER */ +#include "trotl_test3.h" + #include "utils.h" #include "tologger.h" - #include "toabout.h" #include "toconf.h" +#include "toconfiguration.h" #include "toconnection.h" -#include "tohighlightedtext.h" -#include "tomain.h" #include "tosql.h" -#include "totool.h" -// qt4 in via the qtranslator -// #include "tora_toad.h" - -#ifndef Q_OS_WIN32 -#include <unistd.h> -#endif - -#include <stdio.h> -#include <stdlib.h> -#include <QDateTime> - -#include <memory> -#include <iostream> - -#include <qapplication.h> -#include <qmessagebox.h> -#include <qtextcodec.h> - -#include <QString> -#include <QTranslator> -#include <QStyleFactory> - - bool toMonolithic(void) { #ifdef TOMONOLITHIC - return true; + return true; #else - - return false; + return false; #endif } +toConnection *oraCon = NULL; -// void toUpdateIndicateEmpty(void); - -toSemaphore Parent_ChildSemaphore; -toSemaphore Parent_TargetSemaphore; -bool Parent_DebuggerStarted; -toQList Parent_InputData; -toLock Parent_Lock; -toQList Parent_OutputData; -bool Parent_RunningTarget; -QString Parent_TargetException; -QString Parent_TargetID; -QString Parent_TargetLog; -QString Parent_TargetSQL; -toThread *Parent_TargetThread; -//Parent_connection; -void toDebug_targetTask_run(toConnection *conn); - -int main(int argc, char **argv) +TrotlTest3Window::TrotlTest3Window(): toMainWindow() { - toConfiguration::setQSettingsEnv(); + toThread::setMainThread(QThread::currentThread()); - QApplication app(argc, argv); - - try - { - - try - { - toSQL::loadSQL(toConfigurationSingle::Instance().sqlFile()); - } - catch (...) + std::map<QString, toTool *> &tools = toTool::tools(); + for (std::map<QString, toTool *>::iterator k = tools.begin(); k != tools.end(); k++) { - TLOG(1,toDecorator,__HERE__) << " Ignored exception." << std::endl; + //(*k).second->customSetup(); } - toConnectionProvider::initializeAll(); - { - QString nls = getenv("NLS_LANG"); - if (nls.isEmpty()) - nls = "american_america.UTF8"; - else - { - int pos = nls.lastIndexOf('.'); - if (pos > 0) - nls = nls.left(pos); - nls += ".UTF8"; - } - toSetEnv("NLS_LANG", nls); - } + QToolBar *workToolbar = toAllocBar(this, tr("SQL worksheet")); + layout()->addWidget(workToolbar); - if (toConfigurationSingle::Instance().lastVersion() != TOVERSION) - { -// std::auto_ptr<toAbout> about ( new toAbout(toAbout::About, NULL, "About " TOAPPNAME, true)); -// if (!about->exec()) -// { -// exit (2); -// } - toConfigurationSingle::Instance().setLastVersion(TOVERSION); - } + Editor = new toWorksheet(this, *oraCon); + // stop any running query when a file is loaded + //connect(Editor, SIGNAL(fileOpened()), this, SLOT(stop())); + //connect(Editor, SIGNAL(modificationChanged(bool)), this, SLOT(setCaption())); + show(); +} - if (toConfigurationSingle::Instance().firstInstall().isEmpty()) - { - toConfigurationSingle::Instance().setFirstInstall( - QDateTime::currentDateTime().toString()); - } +int main(int argc, char **argv) +{ + toConfiguration::setQSettingsEnv(); - toQValue::setNumberFormat( - toConfigurationSingle::Instance().numberFormat(), - toConfigurationSingle::Instance().numberDecimals()); + QApplication app(argc, argv); - if (qApp->argc() > 2 || (qApp->argc() == 2 && qApp->argv()[1][0] == '-')) - { - printf("Usage:\n\n tora [{X options}] [connectstring]\n\n"); - exit(2); - } - else if (qApp->argc() == 2) - { - QString connect = QString::fromLatin1(qApp->argv()[1]); - QString user, password; - std::set<QString> options; - int pos = connect.indexOf(QString::fromLatin1("@")); - if (pos > -1) - { - user = connect.left(pos); - connect = connect.right(connect.length() - pos - 1); - } - else - { - user = connect; - if (getenv("ORACLE_SID")) - connect = QString::fromLatin1(getenv("ORACLE_SID")); - } - if (!connect.isEmpty()) - toConfigurationSingle::Instance().setDefaultDatabase(connect); - pos = user.indexOf(QString::fromLatin1("/")); - if (pos > -1) - { - password = user.right(user.length() - pos - 1); - toConfigurationSingle::Instance().setDefaultPassword(password); - user = user.left(pos); - } - if (!user.isEmpty()) - toConfigurationSingle::Instance().setDefaultUser(user); + try + { - //new toMain; - //int ret = qApp->exec(); - //return ret; - toConnection *oraCon = new toConnection( - QString("Oracle"), - user, - password, - "", - connect, - "", - "", - options); - TLOG(0,toDecorator,__HERE__) << "Version: " << oraCon->version().toUtf8().constData() << std::endl; + try + { + toSQL::loadSQL(toConfigurationSingle::Instance().sqlFile()); + } + catch (...) + { + TLOG(1,toDecorator,__HERE__) << " Ignored exception." << std::endl; + } + toConnectionProvider::initializeAll(); - //toDebug_targetTask_run(oraCon); - } - } - catch (const QString &str) - { - fprintf(stderr, - "Unhandled exception:\n\n%s\n", - (const char *) str.toLatin1()); - TOMessageBox::critical(NULL, - qApp->translate("main", "Unhandled exception"), - str, - qApp->translate("main", "Exit")); - } - catch (std::exception const &e) - { - TLOG(0,toDecorator,__HERE__) << "Exception: " << e.what() << std::endl; - } - catch (...) - { - TLOG(0,toDecorator,__HERE__) << "Exception: ???" << std::endl; - } - return 1; -} + if (toConfigurationSingle::Instance().lastVersion() != TOVERSION) + { + std::auto_ptr<toAbout> about ( new toAbout(toAbout::About, NULL, "About " TOAPPNAME, true)); + if (!about->exec()) + { + exit (2); + } + toConfigurationSingle::Instance().setLastVersion(TOVERSION); + } -// TODO: PLSQL_DEBUG is deprecated, PLSQL_OPTIMIZE_LEVEL=1 should be used instead -// Should be analysed which OracleDB versions support this new way. -static toSQL SQLDebugEnable("toDebug:EnableDebug", -// "ALTER SESSION SET PLSQL_DEBUG = TRUE", - "ALTER SESSION SET PLSQL_OPTIMIZE_LEVEL = 1", - "Enable PL/SQL debugging"); -static toSQL SQLDebugInit("toDebug:Initialize", - "DECLARE\n" - " ret VARCHAR2(200);\n" - "BEGIN\n" - " ret:=SYS.DBMS_DEBUG.INITIALIZE;\n" - " SELECT ret INTO :f2<char[201],out> FROM sys.DUAL;\n" - " SYS.DBMS_DEBUG.DEBUG_ON;\n" - "END;", - "Initialize the debug session, must have same bindings"); + if (toConfigurationSingle::Instance().firstInstall().isEmpty()) + { + toConfigurationSingle::Instance().setFirstInstall( + QDateTime::currentDateTime().toString()); + } + toQValue::setNumberFormat( + toConfigurationSingle::Instance().numberFormat(), + toConfigurationSingle::Instance().numberDecimals()); -class targetTask : public toTask -{ - //toDebug &Parent; - -public: -// targetTask(toDebug &parent) : Parent(parent) -// { } - - virtual void run() - { - TLOG(2,toDecorator,__HERE__) << "toDebug::targetTask::run" << std::endl; - try + if (qApp->argc() > 2 || (qApp->argc() == 2 && qApp->argv()[1][0] == '-')) { - // Create a target session using parameters of a current "debug" connection - toQuery targetSession(*conn); - try + printf("Usage:\n\n tora [{X options}] [connectstring]\n\n"); + exit(2); + } + else if (qApp->argc() == 2) + { + QString connect = QString::fromLatin1(qApp->argv()[1]); + QString user, password; + std::set<QString> options; + int pos = connect.indexOf(QString::fromLatin1("@")); + if (pos > -1) { - TLOG(2,toDecorator,__HERE__) << "toDebug::targetTask::run ALTER SESSION SET PLSQL_OPTIMIZE_LEVEL = 1" << std::endl; - targetSession.execute(SQLDebugEnable); + user = connect.left(pos); + connect = connect.right(connect.length() - pos - 1); } - catch (...) + else { - TLOG(1,toDecorator,__HERE__) << " Ignored exception." << std::endl; - toLocker lock (Parent_Lock); - Parent_TargetLog += QString::fromLatin1("Couldn't enable debugging for target session\n"); + user = connect; + if (getenv("ORACLE_SID")) + connect = QString::fromLatin1(getenv("ORACLE_SID")); } - try + if (!connect.isEmpty()) + toConfigurationSingle::Instance().setDefaultDatabase(connect); + pos = user.indexOf(QString::fromLatin1("/")); + if (pos > -1) { - TLOG(2,toDecorator,__HERE__) - << "toDebug::targetTask::run DBMS_DEBUG.INITIALIZE" - << "toDebug::targetTask::run DBMS_DEBUG.DEBUG_ON" << std::endl; - targetSession.execute(SQLDebugInit); - - // can't use moc from nested class -// QMetaObject::invokeMethod(&Parent, -// "enableDebugger", -// Qt::QueuedConnection, -// Q_ARG(bool, true)); - - toLocker lock (Parent_Lock); - Parent_DebuggerStarted = true; - Parent_TargetID = targetSession.readValue(); - TLOG(2,toDecorator,__HERE__) << "toDebug::targetTask::run target id = " << Parent_TargetID << std::endl; - Parent_ChildSemaphore.up(); // resume main TOra thread - Parent_TargetLog += QString::fromLatin1("Debug session connected\n"); + password = user.right(user.length() - pos - 1); + toConfigurationSingle::Instance().setDefaultPassword(password); + user = user.left(pos); } - catch (const QString &exc) - { -// QMetaObject::invokeMethod(&Parent, -// "enableDebugger", -// Qt::QueuedConnection, -// Q_ARG(bool, false)); + if (!user.isEmpty()) + toConfigurationSingle::Instance().setDefaultUser(user); - toLocker lock (Parent_Lock); - Parent_TargetLog += QString::fromLatin1("Couldn't start debugging:"); - Parent_TargetLog += exc; - Parent_DebuggerStarted = false; Parent_ChildSemaphore.up(); // resume main TOra thread - return ; - } - while (1) // this will loop until target thread is required (while debugger tool is running) - { - TLOG(2,toDecorator,__HERE__) << "toDebug::targetTask::run .........starting iteration...." << std::endl; - { - toLocker lock (Parent_Lock); - Parent_RunningTarget = false; - } - TLOG(2,toDecorator,__HERE__) << "toDebug::targetTask::run sleep until TargetSemaphore goes up" << std::endl; - Parent_TargetSemaphore.down(); - TLOG(2,toDecorator,__HERE__) << "toDebug::targetTask::run TargetSemaphore up! Continue!" << std::endl; + oraCon = new toConnection( + QString("Oracle"), + user, + password, + "", + connect, + "", + "", + options); + TLOG(0,toDecorator,__HERE__) << "Version: " << oraCon->version().toUtf8().constData() << std::endl; - QString sql; - toQList inParams; - toQList outParams; - { - toLocker lock (Parent_Lock); - Parent_RunningTarget = true; - sql = Parent_TargetSQL; - Parent_TargetSQL = ""; - TLOG(2,toDecorator,__HERE__) << "toDebug::targetTask::run Target now RUNNING! Got sql to execute/debug: " << sql << std::endl; - inParams = Parent_InputData; - Parent_InputData.clear(); // To make sure data is not shared - Parent_OutputData.clear(); - } -// Parent_StartedSemaphore.up(); - if (sql.isEmpty()) - break; - - try - { - Parent_Lock.lock(); - Parent_TargetLog += QString::fromLatin1("Executing SQL\n"); - Parent_Lock.unlock(); - - Parent_ChildSemaphore.up(); // resume main TOra thread - TLOG(2,toDecorator,__HERE__) << "toDebug::targetTask::run before execution of sql:" << sql << std::endl; - outParams = targetSession.readQuery(sql, inParams); - TLOG(2,toDecorator,__HERE__) << "toDebug::targetTask::run after execution of sql." << std::endl; - } - catch (const QString &str) - { - TLOG(2,toDecorator,__HERE__) << "toDebug::targetTask::run ERROR! catch1. str = " << str << std::endl; - Parent_Lock.lock(); - Parent_TargetLog += QString::fromLatin1("Encountered error: "); - Parent_TargetLog += str; - if (!str.startsWith("ORA-06543:")) // PL/SQL: execution error - execution aborted - Parent_TargetException += str; - Parent_TargetLog += QString::fromLatin1("\n"); - Parent_Lock.unlock(); - } - catch (const std::exception &e) - { - TLOG(2,toDecorator,__HERE__) << "toDebug::targetTask::run ERROR! catch3" << e.what() << std::endl; - Parent_Lock.lock(); - Parent_TargetLog += QString::fromLatin1("Encountered unknown exception\n") + e.what(); - Parent_TargetException += QString::fromLatin1("Encountered unknown exception\n") + e.what(); - Parent_Lock.unlock(); - } - catch (...) - { - TLOG(2,toDecorator,__HERE__) << "toDebug::targetTask::run ERROR! catch2" << std::endl; - Parent_Lock.lock(); - Parent_TargetLog += QString::fromLatin1("Encountered unknown exception\n"); - Parent_TargetException += QString::fromLatin1("Encountered unknown exception\n"); - Parent_Lock.unlock(); - } - - { - toLocker lock (Parent_Lock); - Parent_OutputData = outParams; - Parent_TargetLog += QString::fromLatin1("Execution ended\n"); - } - Parent_ChildSemaphore.up(); - } - + //new toMain; + new TrotlTest3Window; + int ret = qApp->exec(); + return ret; } - TOCATCH; - TLOG(2,toDecorator,__HERE__) << "toDebug::targetTask::run DONE. Finishing target session." << std::endl; - toLocker lock (Parent_Lock); - Parent_DebuggerStarted = false; -// QMetaObject::invokeMethod(&Parent, -// "enableDebugger", -// Qt::QueuedConnection, -// Q_ARG(bool, false)); - Parent_TargetLog += QString::fromLatin1("Closing debug session\n"); - Parent_TargetThread = NULL; - Parent_ChildSemaphore.up(); // Resume main TOra thread } -}; - -void toDebug_startTarget(void) -{ -#ifdef DEBUG - TLOG(2,toDecorator,__HERE__) << "toDebug::startTarget" << std::endl; -#endif - try + catch (const QString &str) { - toLocker lock (Parent_Lock); - Parent_TargetThread = new toThread(new targetTask()); - Parent_TargetThread->start(); + fprintf(stderr, + "Unhandled exception:\n\n%s\n", + (const char *) str.toLatin1()); + TOMessageBox::critical(NULL, + qApp->translate("main", "Unhandled exception"), + str, + qApp->translate("main", "Exit")); } - catch (...) + catch (std::exception const &e) { - TLOG(1,toDecorator,__HERE__) << " Failed to start target task thread, close some other tools and try again" << std::endl; - //toStatusMessage(tr("Failed to start target task thread, close some other tools and try again")); - return ; + TLOG(0,toDecorator,__HERE__) << "Exception: " << e.what() << std::endl; } - - Parent_ChildSemaphore.down(); // sleep until target session is initialised (or fails doing so) in other - // thread (toDebug::targetTask::run must raise this semapthore) - if (!Parent_DebuggerStarted) + catch (...) { - { -// toLocker lock (Lock); this line was here -// TOMessageBox::critical(this, tr("Couldn't start debugging"), -// tr("Couldn't connect to target session:\n") + -// TargetLog, -// tr("&Ok")); - TLOG(1,toDecorator,__HERE__) << "Couldn't start debugging" << std::endl; - } -// close(); this line was here - return ; + TLOG(0,toDecorator,__HERE__) << "Exception: ???" << std::endl; } - try - { -#ifdef DEBUG - TLOG(2,toDecorator,__HERE__) << "toDebug::startTarget DBMS_DEBUG.ATTACH_SESSION " << Parent_TargetID << std::endl; -#endif - if (Parent_DebuggerStarted) - debugSession->execute(SQLAttach, Parent_TargetID); - } - TOCATCH; // Trying to run somthing after this won't work (And will hang tora I think) -//TODO readLog(); -}; - + return 1; +} This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ibr...@us...> - 2011-03-12 01:54:29
|
Revision: 3924 http://tora.svn.sourceforge.net/tora/?rev=3924&view=rev Author: ibre5041 Date: 2011-03-12 01:54:22 +0000 (Sat, 12 Mar 2011) Log Message: ----------- Modified Paths: -------------- branches/tora-trotl/src/trotl_test3.cpp Added Paths: ----------- branches/tora-trotl/src/trotl_test3.h Modified: branches/tora-trotl/src/trotl_test3.cpp =================================================================== --- branches/tora-trotl/src/trotl_test3.cpp 2011-03-11 13:59:41 UTC (rev 3923) +++ branches/tora-trotl/src/trotl_test3.cpp 2011-03-12 01:54:22 UTC (rev 3924) @@ -39,6 +39,8 @@ * * END_COMMON_COPYRIGHT_HEADER */ +#include <poppler/qt4/poppler-qt4.h> + #include "trotl_test3.h" #include "utils.h" @@ -50,6 +52,8 @@ #include "toeventquerytask.h" #include "tosql.h" +#include <pthread.h> + bool toMonolithic(void) { #ifdef TOMONOLITHIC @@ -61,7 +65,7 @@ toConnection *oraCon = NULL; -TrotlTest3Window::TrotlTest3Window(): toMainWindow() +TrotlTest3Window::TrotlTest3Window(QString user, QString password, QString connect, std::set<QString>& options): toMainWindow() { toThread::setMainThread(QThread::currentThread()); @@ -69,6 +73,18 @@ Workspace->setViewMode(QMdiArea::TabbedView); setCentralWidget(Workspace); + show(); + oraCon = new toConnection( + QString("Oracle"), + user, + password, + "", + connect, + "", + "", + options); + TLOG(0,toDecorator,__HERE__) << "Version: " << oraCon->version().toUtf8().constData() << std::endl; + addConnection(oraCon); for (ToolsRegistrySing::ObjectType::iterator i = ToolsRegistrySing::Instance().begin(); @@ -82,12 +98,23 @@ i.value()->createWindow(); } } - - show(); + + Poppler::Document *doc = Poppler::Document::load("/home/ibrezina/Documents/11gr2_sql_reference_e17118.pdf"); + std::cout << "doc: " << doc << std::endl; + std::cout << "Num pages: " << doc->numPages() << std::endl; } int main(int argc, char **argv) { + int p = 0; + pthread_attr_t t_a; + pthread_t t = pthread_self(); + p += pthread_attr_init(&t_a); + p += pthread_getattr_np(t, &t_a); + p += pthread_attr_setstacksize(&t_a, 536870912); + p += pthread_attr_destroy(&t_a); + std::cout << "Res: " << p << std::endl; + toConfiguration::setQSettingsEnv(); QApplication app(argc, argv); @@ -101,7 +128,7 @@ } catch (...) { - TLOG(1,toDecorator,__HERE__) << " Ignored exception." << std::endl; + //TLOG(1,toDecorator,__HERE__) << " Ignored exception." << std::endl; } toConnectionProvider::initializeAll(); @@ -160,22 +187,11 @@ if (!user.isEmpty()) toConfigurationSingle::Instance().setDefaultUser(user); - oraCon = new toConnection( - QString("Oracle"), - user, - password, - "", - connect, - "", - "", - options); - TLOG(0,toDecorator,__HERE__) << "Version: " << oraCon->version().toUtf8().constData() << std::endl; - qRegisterMetaType<toQDescList>("toQDescList&"); qRegisterMetaType<ValuesList>("ValuesList&"); qRegisterMetaType<toConnection::exception>("toConnection::exception"); - new TrotlTest3Window; + new TrotlTest3Window(user, password, connect, options); int ret = qApp->exec(); return ret; } Added: branches/tora-trotl/src/trotl_test3.h =================================================================== --- branches/tora-trotl/src/trotl_test3.h (rev 0) +++ branches/tora-trotl/src/trotl_test3.h 2011-03-12 01:54:22 UTC (rev 3924) @@ -0,0 +1,119 @@ +#ifndef TROTL_TEST3_H +#define TROTL_TEST3_H + +#include <QObject> +#include <QMdiArea> +#include <QMdiSubWindow> + +#include "tothread.h" +#include "tomainwindow.h" +#include "toworksheet.h" +#include "todockbar.h" +#include "tolinechart.h" +#include "tobackgroundlabel.h" + +class TrotlTest3Window : public toMainWindow +{ + Q_OBJECT; + + //toWorksheet *Editor; + QMdiArea *Workspace; + std::list<toConnection *> Connections; +public: + TrotlTest3Window(QString, QString, QString, std::set<QString>&); + QMdiArea* workspace() const { return Workspace; }; + void addCustomMenu(QMenu *) const {}; + toBackgroundLabel* getBackgroundLabel() {}; + + std::list<QString> connections(void) {}; + toConnection& connection(const QString &) {}; + void updateWindowsMenu() {}; + toConnection& currentConnection(void) + { + std::list<toConnection *>::iterator i = Connections.begin(); + if(i != Connections.end()) + return *(*i); + throw tr("Can't find active connection"); + } + + void checkCaching(void) {}; + + toDockbar* dockbar(toDocklet *let) {}; + + QMenu* getEditMenu() {}; + + void addChart(toLineChart*) {}; + void addCustomMenu(QMenu*) {}; + void addRecentFile(const QString&) {}; + void changeConnection() {}; + void editSQL(const QString&) {}; + QAction* getCopyAction() {}; + QAction* getCutAction() {}; + QAction* getPasteAction() {}; + QAction* getRedoAction() {}; + QAction* getSelectAllAction() {}; + + QAction* getUndoAction() {}; + void registerSQLEditor(const QString&) {}; + void removeChart(toLineChart*) {}; + toSearchReplace* searchDialog() {}; + void setCoordinates(int, int) {}; + void setNeedCommit(toConnection&, bool) {}; + void setupChart(toLineChart*) {}; + void showMessage(const QString&, bool, bool) {}; + void showMessageImpl(const QString&, bool, bool) {}; + void toolWidgetRemoved(toToolWidget*) {}; + void windowActivated(QMdiSubWindow*) {}; + void workspaceCloseWindow(int) {}; + + QMdiSubWindow* lastActiveWindow() const {}; + + void toolWidgetAdded(toToolWidget *tool) {}; + + /** + * Add a new connection. The connection itself must already be created. + * Returns the connection or it's duplicate already opened connection. + */ + toConnection *addConnection(toConnection *conn, bool def = true) + { + /* int j = 0; */ + /* for (std::list<toConnection *>::iterator i = Connections.begin();i != Connections.end();i++, j++) */ + /* { */ + /* if ((*i)->description() == conn->description()) */ + /* { */ + /* ConnectionSelection->setCurrentIndex(j); */ + /* if (def) */ + /* createDefault(); */ + /* return *i; */ + /* } */ + /* } */ + + Connections.insert(Connections.end(), conn); + //ConnectionSelection->addItem(connectionColorPixmap(conn->color()), conn->description()); + //ConnectionSelection->setCurrentIndex(ConnectionSelection->count() - 1); + + //if (ConnectionSelection->count() == 1) + //enableConnectionActions(true); + + checkCaching(); + + changeConnection(); + //emit addedConnection(conn->description()); + + return conn; + } + + /** + * Open a file in sql worksheet + * + */ + void editOpenFile(QString file) {}; + + toEditWidget* editWidget() {}; + + void createDefault(void) {}; +}; + + +#endif + This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ibr...@us...> - 2011-04-14 15:19:25
|
Revision: 3933 http://tora.svn.sourceforge.net/tora/?rev=3933&view=rev Author: ibre5041 Date: 2011-04-14 15:19:19 +0000 (Thu, 14 Apr 2011) Log Message: ----------- Fixes for compilation on MSVC Express 2010 Modified Paths: -------------- branches/tora-trotl/src/tobackground.cpp branches/tora-trotl/src/tobackground.h branches/tora-trotl/src/tobackgroundlabel.h Modified: branches/tora-trotl/src/tobackground.cpp =================================================================== --- branches/tora-trotl/src/tobackground.cpp 2011-04-14 15:15:24 UTC (rev 3932) +++ branches/tora-trotl/src/tobackground.cpp 2011-04-14 15:19:19 UTC (rev 3933) @@ -58,72 +58,60 @@ toBackground::toBackground(QObject* parent, const char* name) : toTimer(parent, name) + , main(toMainWidget()) { - //createToBackgroundLabel() - main = toMainWidget(); + /* It it not allowed to touch the gui(instance of toBackgroundLabel) from parallel thread, + * therefore we connect it(if it exists) to our signals and will update it using signal emits. + * QT signal mechanism will satisfy handover of singal data between our thread and mainWindowThread + */ + if(main && main->getBackgroundLabel()) + { + connect(this, SIGNAL(pause(void)), main->getBackgroundLabel(), SLOT(pause(void))); + connect(this, SIGNAL(unpause(void)), main->getBackgroundLabel(), SLOT(unpause(void))); + connect(this, SIGNAL(setSpeed(int)), main->getBackgroundLabel(), SLOT(setSpeed(int))); + connect(this, SIGNAL(setTip(QString)), main->getBackgroundLabel(), SLOT(setTip(QString))); + } } void toBackground::start(int msec) { - main = toMainWidget(); - if (!isActive()) { Running++; - main->getBackgroundLabel()->unpause(); + emit unpause(); } - main->getBackgroundLabel()->setSpeed(std::min(Running, 1)*100); - //Animation->setSpeed(std::min(Running, 1)*100); + emit setSpeed(std::min(Running, 1)*100); if (Running > 1) { - main->getBackgroundLabel()->setTip(tr("%1 queries running in background.").arg(Running)); - //QToolTip::add(Label, tr("%1 queries running in background.").arg(Running)); + emit setTip(tr("%1 queries running in background.").arg(Running)); } else { - main->getBackgroundLabel()->setTip(tr("One query running in background.")); - // QToolTip::add(Label, tr("One query running in background.")); + emit setTip(tr("One query running in background.")); } toTimer::start(msec); } void toBackground::stop(void) { - main = toMainWidget(); - - /*if (!Animation) - init(); */ if (isActive()) { Running--; - if (Running == 0 ) - main->getBackgroundLabel()->pause(); - else - main->getBackgroundLabel()->setSpeed(Running*100); - if (Running > 1) - main->getBackgroundLabel()->setTip(tr("%1 queries running in background.").arg(Running)); - else if (Running == 1) - main->getBackgroundLabel()->setTip("One query running in background."); - else - main->getBackgroundLabel()->setTip(tr("No background queries.")); + if (Running == 0) + emit pause(); + else + emit setSpeed(Running*100); + if (Running > 1) + emit setTip(tr("%1 queries running in background.").arg(Running)); + else if (Running == 1) + emit setTip("One query running in background."); + else + emit setTip(tr("No background queries.")); } toTimer::stop(); } -/*void toBackground::init(void) -{ - toMain *main = toMainWidget(); - if (!main || Label) - return ; - - Label = theToBackgroundLabel(main->statusBar()); - Label->show(); - main->statusBar()->addWidget(Label, 0, true); - QToolTip::add - (Label, tr("No background queries.")); -}*/ - toBackground::~toBackground() { stop(); Modified: branches/tora-trotl/src/tobackground.h =================================================================== --- branches/tora-trotl/src/tobackground.h 2011-04-14 15:15:24 UTC (rev 3932) +++ branches/tora-trotl/src/tobackground.h 2011-04-14 15:19:19 UTC (rev 3933) @@ -20,6 +20,7 @@ */ class toBackground : public toTimer { + Q_OBJECT public: /** * Create a background timer widget. @@ -37,6 +38,12 @@ void stop(void); static void init(void); +signals: + void pause(); + void unpause(); + void setSpeed(int Running); + void setTip(QString tip); + private: static int Running; toMainWindow* main; Modified: branches/tora-trotl/src/tobackgroundlabel.h =================================================================== --- branches/tora-trotl/src/tobackgroundlabel.h 2011-04-14 15:15:24 UTC (rev 3932) +++ branches/tora-trotl/src/tobackgroundlabel.h 2011-04-14 15:19:19 UTC (rev 3933) @@ -21,11 +21,12 @@ public: //static toBackgroundLabel createToBackgroundLabel(); virtual void mouseReleaseEvent(QMouseEvent* e); - virtual void unpause(); + toBackgroundLabel(QWidget *parent); +public slots: + virtual void unpause(); virtual void pause(); virtual void setTip(QString tip); virtual void setSpeed(int Running); - toBackgroundLabel(QWidget *parent); private: static QMovie* Animation; }; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ibr...@us...> - 2011-04-15 09:20:50
|
Revision: 3936 http://tora.svn.sourceforge.net/tora/?rev=3936&view=rev Author: ibre5041 Date: 2011-04-15 09:20:42 +0000 (Fri, 15 Apr 2011) Log Message: ----------- Fix for async. calls from toBackground to toBackgroundLabel Modified Paths: -------------- branches/tora-trotl/src/CMakeLists.txt branches/tora-trotl/src/tobackground.cpp branches/tora-trotl/src/tobackground.h branches/tora-trotl/src/tobackgroundlabel.h Modified: branches/tora-trotl/src/CMakeLists.txt =================================================================== --- branches/tora-trotl/src/CMakeLists.txt 2011-04-15 07:50:31 UTC (rev 3935) +++ branches/tora-trotl/src/CMakeLists.txt 2011-04-15 09:20:42 UTC (rev 3936) @@ -1,782 +1,780 @@ -INCLUDE(ToraCompat) -INCLUDE(PCHSupport_26) - -#Subdirectories -# ADD_SUBDIRECTORY(i18n) -ADD_SUBDIRECTORY(loki) -IF (WIN32) - ADD_SUBDIRECTORY(windows) -ENDIF (WIN32) - -ADD_SUBDIRECTORY(trotl) -ADD_SUBDIRECTORY(libantlr3c-3.2) - -# Default: qsci2 as 3rd party lib! -IF (WANT_INTERNAL_QSCINTILLA) - ADD_SUBDIRECTORY(qscintilla2) -ENDIF(WANT_INTERNAL_QSCINTILLA) - -# only toad bindings are here. All others qm files will blow the binary too much -SET (TORA_I18N_TS - i18n/tora_toad.ts -) - -SET(TORA_RCC_FILES tora.qrc) - -SET(TORA_UI_SRC - toaboutui.ui - tobrowserconstraintui.ui - tobrowserfilterui.ui - tobrowserindexui.ui - tobrowsertableui.ui - toconnectionimportui.ui - todatabasesettingui.ui - todebugchangeui.ui - todebugwatch.ui - todescribeui.ui - todroptablespaceui.ui - toeditextensionsetupui.ui - toglobalsettingui.ui - tohelpaddfileui.ui - tohelpui.ui - tohelpsetupui.ui - tochartalarmui.ui - tochartsetupui.ui - tolinechartsetupui.ui - tomessageui.ui - tonewconnectionui.ui - topreferencesui.ui - toresultcontentfilterui.ui - toresultlistformatui.ui - torollbackdialogui.ui -# toschedulerui.ui - toscriptui.ui - toscriptschemawidgetui.ui - tosearchreplaceui.ui - tosecurityquotaui.ui - tosecurityroleui.ui - tosecurityuserui.ui - tostoragedatafileui.ui - tostoragedefinitionui.ui - tostoragedialogui.ui - tostorageprefsui.ui - tostoragetablespaceui.ui - tosyntaxsetupui.ui - totemplateaddfileui.ui - totemplateeditui.ui - totemplatesetupui.ui - totoolsettingui.ui - totuningoverviewui.ui - totuningsettingui.ui - toworksheetsetupui.ui - # shortcuteditor - shortcuteditor/shortcuteditordialog.ui - connectioncolorsdialogui.ui -) -IF (ORACLE_FOUND) - LIST (APPEND TORA_UI_SRC tooraclesettingui.ui) -ENDIF (ORACLE_FOUND) - -IF (POPPLER_QT4_FOUND) - LIST(APPEND TORA_UI_SRC pdfview/pdfviewwindow.ui) -ENDIF (POPPLER_QT4_FOUND) - -SET(TORA_MOC_CLASSES - toabout.h - toalert.h - toanalyze.h - toawr.h -# tobackground.h -# tobackgroundlabel.h - tobackup.h -# tobackuptool.h - tobarchart.h - tobackground.h - tobackgroundlabel.h - tobrowserconstraint.h - tobrowser.h - toresultgrants.h - tobrowserindex.h - tobrowsertable.h - tobrowserbasewidget.h - tobrowseraccesswidget.h - tobrowsertablewidget.h - tobrowserviewwidget.h - tobrowserindexwidget.h - tobrowserschemawidget.h - tobrowsersequencewidget.h - tobrowsersynonymwidget.h - tobrowsercodewidget.h - tobrowsertriggerwidget.h - tobrowserdblinkswidget.h - tobrowserdirectorieswidget.h -# tobrowserschemabasewidget.h -# toconf.h -# toconfiguration.h - toconnection.h - toquery.h - #tocache.h - toconnectionimport.h - toconnectionmodel.h - toconnectionpool.h - todocklet.h - todockbar.h - topushbutton.h - torunnable.h - tocurrent.h - todatatype.h - todebug.h - todebugtext.h - todescribe.h -# todefaultkeywords.h - toeditextensions.h -# toeditwidget.h -# toextract.h - toeventquery.h - toeventquerytask.h - tofilesize.h - toglobalsetting.h - tohelp.h - tohelpsetup.h - tohighlightedtext.h -# tohtml.h - tochangeconnection.h - tochartmanager.h - toinvalid.h - tolegendchart.h - tolinechart.h -# tolistviewformattercsv.h -# tolistviewformatterfactory.h -# tolistviewformatter.h -# tolistviewformatterhtml.h -# tolistviewformatteridentifier.h -# tolistviewformattersql.h -# tolistviewformattertabdel.h -# tolistviewformattertext.h - tomain.h - tomainwindow.h -# tomainwindow.kde.h - tomarkedtext.h - tomemoeditor.h - tomodeleditor.h - tomessage.h -# tomysqlkeywords.h - tonewconnection.h - tooutput.h - toparamget.h - topiechart.h - toplsqleditor.h - toplsqltext.h - topreferences.h - toprofiler.h - toproject.h -# toqvalue.h -# toreport.h - toresultbar.h - toresultcolscomment.h - toresultcols.h - toresultcombo.h - toresultschema.h - toresultdepend.h - toresultextract.h - toresultfield.h - toresult.h - toresultitem.h - toresultlabel.h - toresultline.h - toresultlock.h - toresultlong.h - toresultmodel.h - tocodemodel.h - toresultparam.h - toresultpie.h - toresultplan.h -# toresultresources.h - toresultstats.h - toresultstorage.h - toresulttableview.h - toresulttableviewedit.h - toresultdata.h - toresultdatasingle.h - toresultview.h - toresultlistformat.h - torollback.h -# toscheduler.h - toscript.h - toscriptschemawidget.h -# toscripttreeitem.h - toscripttreemodel.h - tosearchreplace.h - tosecurity.h - tosecuritytreemodel.h -# tosecuritytreeitem.h - tosession.h - tosgastatement.h - tosgatrace.h - tosmtp.h -# tosplash.h - tosqledit.h -# tosql.h -# tosqlparse.h -# tostoragedefinition.h - tostorage.h - tosyntaxsetup.h - totableselect.h - totabwidget.h - totemplate.h - totemporary.h -# totextview.h - tothread_p.h - totreewidget.h -# totimer.h - totool.h - totuning.h - tounittest.h - tovisualize.h - towaitevents.h - toworksheet.h - toworkingwidget.h - toeditablemenu.h - toworksheetstatistic.h -# toworksheettext.h - toworksheetwidget.h - utils.h -# shortcuteditor - shortcuteditor/shortcuteditordialog.h - shortcuteditor/shortcutmodel.h -# docklets - docklets/toviewconnections.h - docklets/toviewdirectory.h -# -) -IF (ORACLE_FOUND) - LIST(APPEND TORA_MOC_CLASSES tooraclesetting.h) -ENDIF (ORACLE_FOUND) - -IF (POPPLER_QT4_FOUND) - LIST(APPEND TORA_MOC_CLASSES pdfview/documentwidget.h pdfview/pdfviewwindow.h) -ENDIF (POPPLER_QT4_FOUND) - -SET(TORA_SOURCES -# main.cpp - totool.cpp - totemplateprovider.cpp - topreferences.cpp - tomain.cpp - - - #tosqlparsetest.cpp - toabout.cpp - toalert.cpp - toanalyze.cpp - toawr.cpp - tobackground.cpp - tobackgroundlabel.cpp - tobackup.cpp - tobackuptool.cpp - tobarchart.cpp - tobrowserconstraint.cpp - tobrowser.cpp - toresultgrants.cpp - tobrowserindex.cpp - tobrowsertable.cpp - tobrowserbasewidget.cpp - tobrowseraccesswidget.cpp - tobrowsertablewidget.cpp - tobrowserviewwidget.cpp - tobrowserindexwidget.cpp - tobrowserschemawidget.cpp - tobrowsersequencewidget.cpp - tobrowsersynonymwidget.cpp - tobrowsercodewidget.cpp - tobrowsertriggerwidget.cpp - tobrowserdblinkswidget.cpp - tobrowserdirectorieswidget.cpp -# tobrowserschemabasewidget.cpp - tocache.cpp - toconfiguration.cpp - toconnection.cpp - toquery.cpp - toqvalue.cpp - toconnectionimport.cpp - toconnectionmodel.cpp - toconnectionpool.cpp - todocklet.cpp - todockbar.cpp - topushbutton.cpp - torunnable.cpp - tocurrent.cpp - todatatype.cpp - todebug.cpp - todebugtext.cpp - todescribe.cpp - toeditextensions.cpp - toeditwidget.cpp - toextract.cpp - toextratranslations.cpp - toeventquery.cpp - toeventquerytask.cpp - tofilesize.cpp -# temporarily disabled due the lack of firebird here tofyracleconnection.cpp - toglobalsetting.cpp - tohelp.cpp - tohighlightedtext.cpp - tohtml.cpp - tochangeconnection.cpp - tochartmanager.cpp - toinvalid.cpp - tolegendchart.cpp - tolinechart.cpp - tolistviewformatter.cpp - tolistviewformattercsv.cpp - tolistviewformatterhtml.cpp - tolistviewformattersql.cpp - tolistviewformattertabdel.cpp - tolistviewformattertext.cpp - tomainwindow.cpp - tomarkedtext.cpp - tomemoeditor.cpp - tomodeleditor.cpp - tomessage.cpp - tonewconnection.cpp -#win only? toocistub.cpp - tooracleconnection_trotl.cpp - tooracleextract.cpp - tooraclepreload.cpp - tooutput.cpp - toparamget.cpp - topassword.cpp - topiechart.cpp - toplsqleditor.cpp - toplsqltext.cpp - toprofiler.cpp - toproject.cpp - toqsqlconnection.cpp - toreport.cpp - toresultbar.cpp - toresultcolscomment.cpp - toresultcols.cpp - toresultschema.cpp - toresultcombo.cpp - toresult.cpp - toresultdepend.cpp - toresultextract.cpp - toresultfield.cpp - toresultitem.cpp - toresultlabel.cpp - toresultline.cpp - toresultlock.cpp - toresultlong.cpp - toresultmodel.cpp - tocodemodel.cpp - toresultparam.cpp - toresultpie.cpp - toresultplan.cpp - toresultstats.cpp - toresultstorage.cpp - toresulttableview.cpp - toresulttableviewedit.cpp - toresultdata.cpp - toresultdatasingle.cpp - toresultview.cpp - toresultlistformat.cpp - torollback.cpp -# toscheduler.cpp - toscript.cpp - toscriptschemawidget.cpp - toscripttreeitem.cpp - toscripttreemodel.cpp - tosearchreplace.cpp - tosecurity.cpp - tosecuritytreemodel.cpp - tosecuritytreeitem.cpp - tosession.cpp - tosgastatement.cpp - tosgatrace.cpp - tosmtp.cpp - tosplash.cpp - tosql.cpp - tosqledit.cpp - tosqlparse.cpp - tostorage.cpp - tostoragedefinition.cpp - tosyntaxsetup.cpp - totableselect.cpp - totabwidget.cpp - totemplate.cpp - totemporary.cpp - totextview.cpp - tothread.cpp - totimer.cpp - totreewidget.cpp - totuning.cpp - tounittest.cpp - tovisualize.cpp - towaitevents.cpp - toworksheet.cpp - toworkingwidget.cpp - toeditablemenu.cpp - toworksheetstatistic.cpp - toworksheettext.cpp - toworksheetwidget.cpp - utils.cpp - # - migratetool/sqldeveloper.cpp - migratetool/squirrelsql.cpp - migratetool/tora3.cpp - # shortcuteditor - shortcuteditor/shortcuteditordialog.cpp - shortcuteditor/shortcutmodel.cpp - # docklets - docklets/toviewconnections.cpp - docklets/toviewdirectory.cpp - # - tooracletable.cpp -) - - -IF (DB2_FOUND) - LIST (APPEND TORA_SOURCES db2/todb2connection.cpp - db2/db2connectionsub.cpp - db2/db2provider.cpp - db2/db2query.cpp) - #db2/qsql_db2.cpp) -ENDIF (DB2_FOUND) - -IF (TERADATA_FOUND) - LIST (APPEND TORA_SOURCES toteradataconnection.cpp) -ENDIF (TERADATA_FOUND) - -IF (POPPLER_QT4_FOUND) - LIST(APPEND TORA_SOURCES pdfview/pdfviewwindow.cpp pdfview/documentwidget.cpp) -ENDIF (POPPLER_QT4_FOUND) - -# compiled in icons for windows -IF (WIN32 AND MSVC) - SET (TORA_SOURCES ${TORA_SOURCES} tora.rc) -ENDIF (WIN32 AND MSVC) -if (WIN32 AND MINGW) - # resource compilation for mingw - ADD_CUSTOM_COMMAND(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/tora_rc.o - COMMAND windres.exe -I${CMAKE_CURRENT_SOURCE_DIR} - -i${CMAKE_CURRENT_SOURCE_DIR}/tora.rc - -o ${CMAKE_CURRENT_BINARY_DIR}/tora_rc.o) - SET(TORA_SOURCES ${TORA_SOURCES} ${CMAKE_CURRENT_BINARY_DIR}/tora_rc.o) -endif (WIN32 AND MINGW) - - - -QT4_ADD_TRANSLATION(TORA_I18N_QM ${TORA_I18N_TS}) -QT4_WRAP_UI(TORA_UI_SOURCES ${TORA_UI_SRC} ) -QT4_WRAP_CPP(TORA_MOC_SOURCES ${TORA_MOC_CLASSES}) -QT4_ADD_RESOURCES(TORA_RCC_SRCS ${TORA_RCC_FILES}) - - -LINK_DIRECTORIES(./loki) -IF (WIN32) - LINK_DIRECTORIES(./windows) -ENDIF (WIN32) -IF (WANT_INTERNAL_QSCINTILLA) - LINK_DIRECTORIES(./qscintilla2) -ENDIF (WANT_INTERNAL_QSCINTILLA) -LINK_DIRECTORIES(./trotl) - -SET(TORA_LOKI_LIB "tora_loki_lib") -IF (WANT_INTERNAL_QSCINTILLA) - SET (TORA_QSCINTILLA_LIB tora_qscintilla2_lib) -ENDIF (WANT_INTERNAL_QSCINTILLA) - - -IF (WIN32) - SET (WINDOWS_LIB "windows_lib") -ENDIF (WIN32) - -SET (TROTL_LIB "trotl") - -IF(USE_TORA_MOC_LIB) - SET (TORA_MOC_LIB "tora_moc_lib") - ADD_LIBRARY(${TORA_MOC_LIB} STATIC ${TORA_MOC_SOURCES} ${TORA_I18N_QM} ${TORA_UI_SOURCES}) -ELSE(USE_TORA_MOC_LIB) - LIST(APPEND TORA_SOURCES ${TORA_MOC_SOURCES} ${TORA_I18N_QM} ${TORA_UI_SOURCES}) -ENDIF(USE_TORA_MOC_LIB) - -INCLUDE_DIRECTORIES( - ${CMAKE_SOURCE_DIR} - ${CMAKE_CURRENT_SOURCE_DIR} - ${CMAKE_BINARY_DIR} - ${QT_INCLUDES} - ${CMAKE_CURRENT_SOURCE_DIR}/loki/include - ${CMAKE_CURRENT_SOURCE_DIR}/otl - ${CMAKE_CURRENT_SOURCE_DIR}/trotl/src - "D:\\DEVEL\\boost_1_46_1" -) - -IF (ORACLE_INCLUDES) - INCLUDE_DIRECTORIES( ${ORACLE_INCLUDES} ) -ENDIF (ORACLE_INCLUDES) - -IF (POSTGRESQL_INCLUDE_DIR) - INCLUDE_DIRECTORIES( ${POSTGRESQL_INCLUDE_DIR} ) -ENDIF (POSTGRESQL_INCLUDE_DIR) - -IF (DB2_INCLUDES) - INCLUDE_DIRECTORIES( ${DB2_INCLUDES} ) -ENDIF (DB2_INCLUDES) - -IF (TERADATA_PATH_INCLUDES) - INCLUDE_DIRECTORIES( ${TERADATA_PATH_INCLUDES} ) -ENDIF (TERADATA_PATH_INCLUDES) - -IF (WANT_INTERNAL_QSCINTILLA) - INCLUDE_DIRECTORIES( - ${CMAKE_SOURCE_DIR}/src/qscintilla2/Qt4 - ${CMAKE_SOURCE_DIR}/src/qscintilla2/Qt4/Qci - ) -ELSE (WANT_INTERNAL_QSCINTILLA) - INCLUDE_DIRECTORIES(${QSCINTILLA_INCLUDE_DIR}) -ENDIF (WANT_INTERNAL_QSCINTILLA) - -IF (POPPLER_QT4_FOUND) - INCLUDE_DIRECTORIES(${POPPLER_QT4_INCLUDE_DIR}) -ENDIF (POPPLER_QT4_FOUND) - -# Handle win/mac special stuff - it's left empty for linux/unix -SET (GUI_TYPE) -IF (APPLE AND WANT_BUNDLE) - SET(GUI_TYPE MACOSX_BUNDLE) - SET(APPLE_BUNDLE_SOURCES icons/tora.icns) -ENDIF (APPLE AND WANT_BUNDLE) - - -IF(WIN32) - IF (MSVC) - # this is a must to switch off subsystem:console (console window poping up) - # WinMain wrapper from QT_QTMAIN_LIBRARY is used and liner must be modified - LINK_LIBRARIES(${QT_QTMAIN_LIBRARY}) - SET (GUI_TYPE WIN32) -# IF (WANT_DEBUG) -# SET (CMAKE_EXE_LINKER_FLAGS "/NODEFAULTLIB:msvcrtd.lib ${CMAKE_EXE_LINKER_FLAGS}") -# ELSE (WANT_DEBUG) -# SET (CMAKE_EXE_LINKER_FLAGS "/NODEFAULTLIB:msvcrt.lib ${CMAKE_EXE_LINKER_FLAGS}") -# ENDIF (WANT_DEBUG) - ENDIF (MSVC) -ENDIF(WIN32) - - -#Set up libraries to link with all found packages -# dynamic -SET(TORA_LIBS - ${QT_LIBRARIES} - ${ORACLE_LIBRARIES} - ${LIBXML2_LIBRARIES} - ${QSCINTILLA_LIBRARIES} - ${TORA_LOKI_LIB} #static -) - -#IF (ORACLE_LIBRARIES) -# TARGET_LINK_LIBRARIES (${EXE_NAME} ${ORACLE_LIBRARIES} ) -#ENDIF (ORACLE_LIBRARIES) - -IF (POSTGRESQL_LIBRARIES) - LIST(APPEND TORA_LIBS ${POSTGRESQL_LIBRARIES}) -ENDIF (POSTGRESQL_LIBRARIES) - -IF (DB2_LIBRARIES) - LIST(APPEND TORA_LIBS} ${DB2_LIBRARIES}) -ENDIF (DB2_LIBRARIES) - -IF (TERADATA_LIBRARIES) - LIST(APPEND TORA_LIBS ${TERADATA_LIBRARIES}) -ENDIF (TERADATA_LIBRARIES) - -IF (USE_TROTL) - LIST(APPEND TORA_LIBS ${TROTL_LIB}) - ADD_DEFINITIONS("-DTROTL_DLL") -ENDIF (USE_TROTL) - -IF (USE_ANTLR) - LIST(APPEND TORA_LIBS "libantlr3c") - LIST(APPEND TORA_SOURCES - "parsing/tsqlparseoracle.cpp" - "parsing/error_handler.c" - "parsing/OracleSQLLexer.c" - "parsing/OracleSQLParser.c" - ) - INCLUDE_DIRECTORIES( - "${CMAKE_CURRENT_SOURCE_DIR}/libantlr3c-3.2/include" - "${CMAKE_CURRENT_BINARY_DIR}/libantlr3c-3.2" - ) -ENDIF(USE_ANTLR) - -IF (POPPLER_QT4_FOUND) - LIST(APPEND TORA_LIBS ${POPPLER_QT4_LIBRARIES}) -ENDIF(POPPLER_QT4_FOUND) - -IF (WANT_INTERNAL_QSCINTILLA) - LIST(APPEND TORA_LIBS ${TORA_QSCINTILLA_LIB} ${QT_LIBRARIES}) -ENDIF (WANT_INTERNAL_QSCINTILLA) -# prevent opening the cmd.exe window -IF (WIN32) - LIST(APPEND TORA_LIBS ${WINDOWS_LIB}) - LIST(APPEND TORA_LIBS "ws2_32.lib") - # don't use console subsystem - IF (MINGW) - LIST(APPEND TORA_LIBS "-mwindows") - ENDIF (MINGW) -ENDIF (WIN32) - -ADD_EXECUTABLE(${EXE_NAME} ${GUI_TYPE} -# ${TORA_I18N_QM} -# ${TORA_MOC_SOURCES} - main.cpp - ${TORA_SOURCES} -# ${TORA_UI_SOURCES} - ${TORA_RCC_SRCS} - ${APPLE_BUNDLE_SOURCES} -) -#SET_TARGET_PROPERTIES(${EXE_NAME} PROPERTIES COMPILE_FLAGS "-DTROTL_DLL") -TARGET_LINK_LIBRARIES(${EXE_NAME} ${TORA_LIBS} ${TORA_MOC_LIB}) - -IF(USE_PCH) -# ADD_PRECOMPILED_HEADER(${EXE_NAME} ${CMAKE_CURRENT_SOURCE_DIR}/precompiled_msvc.h) -ENDIF(USE_PCH) - -# Test programs -ADD_EXECUTABLE(trotl_test0 ${GUI_TYPE} - trotl_test0.cpp - ${TORA_SOURCES} - ${TORA_RCC_SRCS} - ${APPLE_BUNDLE_SOURCES} -) -#SET_TARGET_PROPERTIES(trotl_test0 PROPERTIES COMPILE_FLAGS "-DTROTL_DLL") -TARGET_LINK_LIBRARIES(trotl_test0 ${TORA_LIBS} ${TORA_MOC_LIB}) - -ADD_EXECUTABLE(trotl_test1 ${GUI_TYPE} - trotl_test1.cpp - ${TORA_SOURCES} - ${TORA_RCC_SRCS} - ${APPLE_BUNDLE_SOURCES} -) -#SET_TARGET_PROPERTIES(trotl_test1 PROPERTIES COMPILE_FLAGS "-DTROTL_DLL") -TARGET_LINK_LIBRARIES(trotl_test1 ${TORA_LIBS} ${TORA_MOC_LIB}) - -ADD_EXECUTABLE(trotl_test2 ${GUI_TYPE} - trotl_test2.cpp - ${TORA_SOURCES} - ${TORA_RCC_SRCS} - ${APPLE_BUNDLE_SOURCES} -) -#SET_TARGET_PROPERTIES(trotl_test2 PROPERTIES COMPILE_FLAGS "-DTROTL_DLL") -TARGET_LINK_LIBRARIES(trotl_test2 ${TORA_LIBS} ${TORA_MOC_LIB}) - -QT4_WRAP_CPP(TROTL_TEST3_MOC_SOURCES "trotl_test3.h") -ADD_EXECUTABLE(trotl_test3 ${GUI_TYPE} - trotl_test3.cpp - ${TORA_SOURCES} - ${TORA_RCC_SRCS} - ${APPLE_BUNDLE_SOURCES} - ${TROTL_TEST3_MOC_SOURCES} -) -#SET_TARGET_PROPERTIES(trotl_test3 PROPERTIES COMPILE_FLAGS "-DTROTL_DLL") - -# Install -IF (WIN32) - INSTALL(TARGETS ${EXE_NAME} RUNTIME DESTINATION .) -ELSE (WIN32) - IF (NOT WANT_BUNDLE) - INSTALL(TARGETS ${EXE_NAME} RUNTIME DESTINATION bin LIBRARY DESTINATION lib) - ELSE (NOT WANT_BUNDLE) - - #SET_TARGET_PROPERTIES(${EXE_NAME} PROPERTIES MACOSX_BUNDLE_INFO_PLIST "${CMAKE_SOURCE_DIR}/osx_tools/Info.plist.in") - SET(MACOSX_BUNDLE_ICON_FILE tora.icns) - SET(MACOSX_BUNDLE_INFO_STRING "${EXE_NAME} ${VERSION}") - SET(MACOSX_BUNDLE_GUI_IDENTIFIER "com.torasql") - SET(MACOSX_BUNDLE_LONG_VERSION_STRING "${VERSION}") - SET(MACOSX_BUNDLE_BUNDLE_NAME "${EXE_NAME}") - SET(MACOSX_BUNDLE_SHORT_VERSION_STRING "${VERSION}") - SET(MACOSX_BUNDLE_BUNDLE_VERSION "${VERSION}") - SET(MACOSX_BUNDLE_COPYRIGHT "(c) TOra developers") - SET_SOURCE_FILES_PROPERTIES(${CMAKE_SOURCE_DIR}/src/icons/tora.icns PROPERTIES MACOSX_PACKAGE_LOCATION Resources) - - # Warning: This is dangerous to touch. Except you know what are you doing. - # I ususaly don't know anything about it. But it's working ;) - - INSTALL(TARGETS ${EXE_NAME} BUNDLE DESTINATION ${CMAKE_INSTALL_PREFIX}) - - IF (WANT_BUNDLE_STANDALONE) - # --- If we are on OS X copy all the embedded libraries to the app bundle - # -------- Function to build OS X Stand Alone Bundles ----------------- - function(MakeOSXBundleApp target binary_dir) - #-- Set some useful variables - SET (OSX_MAKE_STANDALONE_BUNDLE_CMAKE_SCRIPT "${binary_dir}/${target}_OSX_MakeStandAloneBundle.cmake") - SET (OSX_MAKE_STANDALONE_BUNDLE_BASH_SCRIPT "${binary_dir}/${target}_OSX_MakeStandAloneBundle.sh") - #-- Configure the cmake file and the shell script - CONFIGURE_FILE("${CMAKE_SOURCE_DIR}/osx_tools/CompleteBundle.cmake.in" - "${OSX_MAKE_STANDALONE_BUNDLE_CMAKE_SCRIPT}" @ONLY IMMEDIATE) - CONFIGURE_FILE("${CMAKE_SOURCE_DIR}/osx_tools/CreateBundle.sh.in" - "${OSX_MAKE_STANDALONE_BUNDLE_BASH_SCRIPT}" @ONLY IMMEDIATE) - #-- Create the installation code - install(SCRIPT "${OSX_MAKE_STANDALONE_BUNDLE_CMAKE_SCRIPT}") - endfunction(MakeOSXBundleApp) - - - install(DIRECTORY ${QT_PLUGINS_DIR}/ - DESTINATION ${PROJECT_BINARY_DIR}/Contents/Plugins/ - REGEX "(designer|script|phonon_backend|debug|sqlite|ico)" EXCLUDE) - - install(CODE " - # glob for previously installed qt plugins to include in fixup_bundle - file(GLOB_RECURSE PluginList - ${PROJECT_BINARY_DIR}/Contents/Plugins/*.bundle) - ") - - MakeOSXBundleApp(${EXE_NAME} ${PROJECT_BINARY_DIR}) - - # TODO/FIXME: this is evil! And it should be done automagically... - set(hack_bundle_pth "${CMAKE_INSTALL_PREFIX}/${EXE_NAME}.app/Contents/MacOS") - INSTALL(CODE "file(MAKE_DIRECTORY ${hack_bundle_pth}/sqldrivers)") - INSTALL(CODE "file(MAKE_DIRECTORY ${hack_bundle_pth}/codecs)") - INSTALL(CODE "file(MAKE_DIRECTORY ${hack_bundle_pth}/accessible)") - INSTALL(CODE "file(MAKE_DIRECTORY ${hack_bundle_pth}/imageformats)") - INSTALL(CODE "file(MAKE_DIRECTORY ${hack_bundle_pth}/graphicssystems)") - function(hack_move_plugins filename targetdir) - install(CODE " - message(STATUS \"file:: ${filename} -> targetdir: ${targetdir} ${hack_bundle_pth}\") - ") - install(FILES ${hack_bundle_pth}/${filename} DESTINATION ${hack_bundle_pth}/${targetdir}) - install(CODE "file(REMOVE ${hack_bundle_pth}/${filename})") - endfunction(hack_move_plugins) - hack_move_plugins("libqcncodecs.bundle" "codecs") - hack_move_plugins("libqjpcodecs.bundle" "codecs") - hack_move_plugins("libqtwcodecs.bundle" "codecs") - hack_move_plugins("libqkrcodecs.bundle" "codecs") - hack_move_plugins("libqsqlmysql.bundle" "sqldrivers") - hack_move_plugins("libqsqlodbc.bundle" "sqldrivers") - hack_move_plugins("libqsqlpsql.bundle" "sqldrivers") - hack_move_plugins("libqgif.bundle" "imageformats") - hack_move_plugins("libqjpeg.bundle" "imageformats") - hack_move_plugins("libqmng.bundle" "imageformats") - hack_move_plugins("libqsvg.bundle" "imageformats") - hack_move_plugins("libqtiff.bundle" "imageformats") - hack_move_plugins("libqtaccessiblewidgets.bundle" "accessible") - hack_move_plugins("libqtaccessiblecompatwidgets.bundle" "accessible") - hack_move_plugins("libqglgraphicssystem.bundle" "graphicssystems") - # end of hack - - #-- Put an empty qt.conf file in the bundle so as to NOT load plugins from the installed Qt. - INSTALL(CODE "message(STATUS \"${CMAKE_INSTALL_PREFIX}/${EXE_NAME}.app/Contents/Resources/qt.conf\")") - INSTALL(FILES "${CMAKE_SOURCE_DIR}/osx_tools/qt.conf.in" - DESTINATION "${CMAKE_INSTALL_PREFIX}/${EXE_NAME}.app/Contents/Resources/" - RENAME "qt.conf") - - if ("${QT_MAC_USE_COCOA}" STREQUAL "1") - INSTALL(CODE "message(STATUS \"Copying qt_menu.nib into ${CMAKE_INSTALL_PREFIX}/${EXE_NAME}.app/Contents/Resources\")") - INSTALL(CODE "file(MAKE_DIRECTORY \"${CMAKE_INSTALL_PREFIX}/${EXE_NAME}.app/Contents/Resources/qt_menu.nib\")") - INSTALL(CODE "execute_process(COMMAND ${CMAKE_COMMAND} -E copy_directory - \"${QT_LIBRARY_DIR}/QtGui.framework/Resources/qt_menu.nib\" - \"${CMAKE_INSTALL_PREFIX}/${EXE_NAME}.app/Contents/Resources/qt_menu.nib\")") - endif() - ENDIF (WANT_BUNDLE_STANDALONE) - - ENDIF (NOT WANT_BUNDLE) -ENDIF (WIN32) +INCLUDE(ToraCompat) +INCLUDE(PCHSupport_26) + +#Subdirectories +# ADD_SUBDIRECTORY(i18n) +ADD_SUBDIRECTORY(loki) +IF (WIN32) + ADD_SUBDIRECTORY(windows) +ENDIF (WIN32) + +ADD_SUBDIRECTORY(trotl) +ADD_SUBDIRECTORY(libantlr3c-3.2) + +# Default: qsci2 as 3rd party lib! +IF (WANT_INTERNAL_QSCINTILLA) + ADD_SUBDIRECTORY(qscintilla2) +ENDIF(WANT_INTERNAL_QSCINTILLA) + +# only toad bindings are here. All others qm files will blow the binary too much +SET (TORA_I18N_TS + i18n/tora_toad.ts +) + +SET(TORA_RCC_FILES tora.qrc) + +SET(TORA_UI_SRC + toaboutui.ui + tobrowserconstraintui.ui + tobrowserfilterui.ui + tobrowserindexui.ui + tobrowsertableui.ui + toconnectionimportui.ui + todatabasesettingui.ui + todebugchangeui.ui + todebugwatch.ui + todescribeui.ui + todroptablespaceui.ui + toeditextensionsetupui.ui + toglobalsettingui.ui + tohelpaddfileui.ui + tohelpui.ui + tohelpsetupui.ui + tochartalarmui.ui + tochartsetupui.ui + tolinechartsetupui.ui + tomessageui.ui + tonewconnectionui.ui + topreferencesui.ui + toresultcontentfilterui.ui + toresultlistformatui.ui + torollbackdialogui.ui +# toschedulerui.ui + toscriptui.ui + toscriptschemawidgetui.ui + tosearchreplaceui.ui + tosecurityquotaui.ui + tosecurityroleui.ui + tosecurityuserui.ui + tostoragedatafileui.ui + tostoragedefinitionui.ui + tostoragedialogui.ui + tostorageprefsui.ui + tostoragetablespaceui.ui + tosyntaxsetupui.ui + totemplateaddfileui.ui + totemplateeditui.ui + totemplatesetupui.ui + totoolsettingui.ui + totuningoverviewui.ui + totuningsettingui.ui + toworksheetsetupui.ui + # shortcuteditor + shortcuteditor/shortcuteditordialog.ui + connectioncolorsdialogui.ui +) +IF (ORACLE_FOUND) + LIST (APPEND TORA_UI_SRC tooraclesettingui.ui) +ENDIF (ORACLE_FOUND) + +IF (POPPLER_QT4_FOUND) + LIST(APPEND TORA_UI_SRC pdfview/pdfviewwindow.ui) +ENDIF (POPPLER_QT4_FOUND) + +SET(TORA_MOC_CLASSES + toabout.h + toalert.h + toanalyze.h + toawr.h + tobackground.h +# tobackgroundlabel.h + tobackup.h +# tobackuptool.h + tobarchart.h + tobrowserconstraint.h + tobrowser.h + toresultgrants.h + tobrowserindex.h + tobrowsertable.h + tobrowserbasewidget.h + tobrowseraccesswidget.h + tobrowsertablewidget.h + tobrowserviewwidget.h + tobrowserindexwidget.h + tobrowserschemawidget.h + tobrowsersequencewidget.h + tobrowsersynonymwidget.h + tobrowsercodewidget.h + tobrowsertriggerwidget.h + tobrowserdblinkswidget.h + tobrowserdirectorieswidget.h +# tobrowserschemabasewidget.h +# toconf.h +# toconfiguration.h + toconnection.h + toquery.h + #tocache.h + toconnectionimport.h + toconnectionmodel.h + toconnectionpool.h + todocklet.h + todockbar.h + topushbutton.h + torunnable.h + tocurrent.h + todatatype.h + todebug.h + todebugtext.h + todescribe.h +# todefaultkeywords.h + toeditextensions.h +# toeditwidget.h +# toextract.h + toeventquery.h + toeventquerytask.h + tofilesize.h + toglobalsetting.h + tohelp.h + tohelpsetup.h + tohighlightedtext.h +# tohtml.h + tochangeconnection.h + tochartmanager.h + toinvalid.h + tolegendchart.h + tolinechart.h +# tolistviewformattercsv.h +# tolistviewformatterfactory.h +# tolistviewformatter.h +# tolistviewformatterhtml.h +# tolistviewformatteridentifier.h +# tolistviewformattersql.h +# tolistviewformattertabdel.h +# tolistviewformattertext.h + tomain.h + tomainwindow.h +# tomainwindow.kde.h + tomarkedtext.h + tomemoeditor.h + tomodeleditor.h + tomessage.h +# tomysqlkeywords.h + tonewconnection.h + tooutput.h + toparamget.h + topiechart.h + toplsqleditor.h + toplsqltext.h + topreferences.h + toprofiler.h + toproject.h +# toqvalue.h +# toreport.h + toresultbar.h + toresultcolscomment.h + toresultcols.h + toresultcombo.h + toresultschema.h + toresultdepend.h + toresultextract.h + toresultfield.h + toresult.h + toresultitem.h + toresultlabel.h + toresultline.h + toresultlock.h + toresultlong.h + toresultmodel.h + tocodemodel.h + toresultparam.h + toresultpie.h + toresultplan.h +# toresultresources.h + toresultstats.h + toresultstorage.h + toresulttableview.h + toresulttableviewedit.h + toresultdata.h + toresultdatasingle.h + toresultview.h + toresultlistformat.h + torollback.h +# toscheduler.h + toscript.h + toscriptschemawidget.h +# toscripttreeitem.h + toscripttreemodel.h + tosearchreplace.h + tosecurity.h + tosecuritytreemodel.h +# tosecuritytreeitem.h + tosession.h + tosgastatement.h + tosgatrace.h + tosmtp.h +# tosplash.h + tosqledit.h +# tosql.h +# tosqlparse.h +# tostoragedefinition.h + tostorage.h + tosyntaxsetup.h + totableselect.h + totabwidget.h + totemplate.h + totemporary.h +# totextview.h + tothread_p.h + totreewidget.h +# totimer.h + totool.h + totuning.h + tounittest.h + tovisualize.h + towaitevents.h + toworksheet.h + toworkingwidget.h + toeditablemenu.h + toworksheetstatistic.h +# toworksheettext.h + toworksheetwidget.h + utils.h +# shortcuteditor + shortcuteditor/shortcuteditordialog.h + shortcuteditor/shortcutmodel.h +# docklets + docklets/toviewconnections.h + docklets/toviewdirectory.h +# +) +IF (ORACLE_FOUND) + LIST(APPEND TORA_MOC_CLASSES tooraclesetting.h) +ENDIF (ORACLE_FOUND) + +IF (POPPLER_QT4_FOUND) + LIST(APPEND TORA_MOC_CLASSES pdfview/documentwidget.h pdfview/pdfviewwindow.h) +ENDIF (POPPLER_QT4_FOUND) + +SET(TORA_SOURCES +# main.cpp + totool.cpp + totemplateprovider.cpp + topreferences.cpp + tomain.cpp + + + #tosqlparsetest.cpp + toabout.cpp + toalert.cpp + toanalyze.cpp + toawr.cpp + tobackground.cpp + tobackgroundlabel.cpp + tobackup.cpp + tobackuptool.cpp + tobarchart.cpp + tobrowserconstraint.cpp + tobrowser.cpp + toresultgrants.cpp + tobrowserindex.cpp + tobrowsertable.cpp + tobrowserbasewidget.cpp + tobrowseraccesswidget.cpp + tobrowsertablewidget.cpp + tobrowserviewwidget.cpp + tobrowserindexwidget.cpp + tobrowserschemawidget.cpp + tobrowsersequencewidget.cpp + tobrowsersynonymwidget.cpp + tobrowsercodewidget.cpp + tobrowsertriggerwidget.cpp + tobrowserdblinkswidget.cpp + tobrowserdirectorieswidget.cpp +# tobrowserschemabasewidget.cpp + tocache.cpp + toconfiguration.cpp + toconnection.cpp + toquery.cpp + toqvalue.cpp + toconnectionimport.cpp + toconnectionmodel.cpp + toconnectionpool.cpp + todocklet.cpp + todockbar.cpp + topushbutton.cpp + torunnable.cpp + tocurrent.cpp + todatatype.cpp + todebug.cpp + todebugtext.cpp + todescribe.cpp + toeditextensions.cpp + toeditwidget.cpp + toextract.cpp + toextratranslations.cpp + toeventquery.cpp + toeventquerytask.cpp + tofilesize.cpp +# temporarily disabled due the lack of firebird here tofyracleconnection.cpp + toglobalsetting.cpp + tohelp.cpp + tohighlightedtext.cpp + tohtml.cpp + tochangeconnection.cpp + tochartmanager.cpp + toinvalid.cpp + tolegendchart.cpp + tolinechart.cpp + tolistviewformatter.cpp + tolistviewformattercsv.cpp + tolistviewformatterhtml.cpp + tolistviewformattersql.cpp + tolistviewformattertabdel.cpp + tolistviewformattertext.cpp + tomainwindow.cpp + tomarkedtext.cpp + tomemoeditor.cpp + tomodeleditor.cpp + tomessage.cpp + tonewconnection.cpp +#win only? toocistub.cpp + tooracleconnection_trotl.cpp + tooracleextract.cpp + tooraclepreload.cpp + tooutput.cpp + toparamget.cpp + topassword.cpp + topiechart.cpp + toplsqleditor.cpp + toplsqltext.cpp + toprofiler.cpp + toproject.cpp + toqsqlconnection.cpp + toreport.cpp + toresultbar.cpp + toresultcolscomment.cpp + toresultcols.cpp + toresultschema.cpp + toresultcombo.cpp + toresult.cpp + toresultdepend.cpp + toresultextract.cpp + toresultfield.cpp + toresultitem.cpp + toresultlabel.cpp + toresultline.cpp + toresultlock.cpp + toresultlong.cpp + toresultmodel.cpp + tocodemodel.cpp + toresultparam.cpp + toresultpie.cpp + toresultplan.cpp + toresultstats.cpp + toresultstorage.cpp + toresulttableview.cpp + toresulttableviewedit.cpp + toresultdata.cpp + toresultdatasingle.cpp + toresultview.cpp + toresultlistformat.cpp + torollback.cpp +# toscheduler.cpp + toscript.cpp + toscriptschemawidget.cpp + toscripttreeitem.cpp + toscripttreemodel.cpp + tosearchreplace.cpp + tosecurity.cpp + tosecuritytreemodel.cpp + tosecuritytreeitem.cpp + tosession.cpp + tosgastatement.cpp + tosgatrace.cpp + tosmtp.cpp + tosplash.cpp + tosql.cpp + tosqledit.cpp + tosqlparse.cpp + tostorage.cpp + tostoragedefinition.cpp + tosyntaxsetup.cpp + totableselect.cpp + totabwidget.cpp + totemplate.cpp + totemporary.cpp + totextview.cpp + tothread.cpp + totimer.cpp + totreewidget.cpp + totuning.cpp + tounittest.cpp + tovisualize.cpp + towaitevents.cpp + toworksheet.cpp + toworkingwidget.cpp + toeditablemenu.cpp + toworksheetstatistic.cpp + toworksheettext.cpp + toworksheetwidget.cpp + utils.cpp + # + migratetool/sqldeveloper.cpp + migratetool/squirrelsql.cpp + migratetool/tora3.cpp + # shortcuteditor + shortcuteditor/shortcuteditordialog.cpp + shortcuteditor/shortcutmodel.cpp + # docklets + docklets/toviewconnections.cpp + docklets/toviewdirectory.cpp + # + tooracletable.cpp +) + + +IF (DB2_FOUND) + LIST (APPEND TORA_SOURCES db2/todb2connection.cpp + db2/db2connectionsub.cpp + db2/db2provider.cpp + db2/db2query.cpp) + #db2/qsql_db2.cpp) +ENDIF (DB2_FOUND) + +IF (TERADATA_FOUND) + LIST (APPEND TORA_SOURCES toteradataconnection.cpp) +ENDIF (TERADATA_FOUND) + +IF (POPPLER_QT4_FOUND) + LIST(APPEND TORA_SOURCES pdfview/pdfviewwindow.cpp pdfview/documentwidget.cpp) +ENDIF (POPPLER_QT4_FOUND) + +# compiled in icons for windows +IF (WIN32 AND MSVC) + SET (TORA_SOURCES ${TORA_SOURCES} tora.rc) +ENDIF (WIN32 AND MSVC) +if (WIN32 AND MINGW) + # resource compilation for mingw + ADD_CUSTOM_COMMAND(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/tora_rc.o + COMMAND windres.exe -I${CMAKE_CURRENT_SOURCE_DIR} + -i${CMAKE_CURRENT_SOURCE_DIR}/tora.rc + -o ${CMAKE_CURRENT_BINARY_DIR}/tora_rc.o) + SET(TORA_SOURCES ${TORA_SOURCES} ${CMAKE_CURRENT_BINARY_DIR}/tora_rc.o) +endif (WIN32 AND MINGW) + + + +QT4_ADD_TRANSLATION(TORA_I18N_QM ${TORA_I18N_TS}) +QT4_WRAP_UI(TORA_UI_SOURCES ${TORA_UI_SRC} ) +QT4_WRAP_CPP(TORA_MOC_SOURCES ${TORA_MOC_CLASSES}) +QT4_ADD_RESOURCES(TORA_RCC_SRCS ${TORA_RCC_FILES}) + + +LINK_DIRECTORIES(./loki) +IF (WIN32) + LINK_DIRECTORIES(./windows) +ENDIF (WIN32) +IF (WANT_INTERNAL_QSCINTILLA) + LINK_DIRECTORIES(./qscintilla2) +ENDIF (WANT_INTERNAL_QSCINTILLA) +LINK_DIRECTORIES(./trotl) + +SET(TORA_LOKI_LIB "tora_loki_lib") +IF (WANT_INTERNAL_QSCINTILLA) + SET (TORA_QSCINTILLA_LIB tora_qscintilla2_lib) +ENDIF (WANT_INTERNAL_QSCINTILLA) + + +IF (WIN32) + SET (WINDOWS_LIB "windows_lib") +ENDIF (WIN32) + +SET (TROTL_LIB "trotl") + +IF(USE_TORA_MOC_LIB) + SET (TORA_MOC_LIB "tora_moc_lib") + ADD_LIBRARY(${TORA_MOC_LIB} STATIC ${TORA_MOC_SOURCES} ${TORA_I18N_QM} ${TORA_UI_SOURCES}) +ELSE(USE_TORA_MOC_LIB) + LIST(APPEND TORA_SOURCES ${TORA_MOC_SOURCES} ${TORA_I18N_QM} ${TORA_UI_SOURCES}) +ENDIF(USE_TORA_MOC_LIB) + +INCLUDE_DIRECTORIES( + ${CMAKE_SOURCE_DIR} + ${CMAKE_CURRENT_SOURCE_DIR} + ${CMAKE_BINARY_DIR} + ${QT_INCLUDES} + ${CMAKE_CURRENT_SOURCE_DIR}/loki/include + ${CMAKE_CURRENT_SOURCE_DIR}/otl + ${CMAKE_CURRENT_SOURCE_DIR}/trotl/src + "D:\\DEVEL\\boost_1_46_1" +) + +IF (ORACLE_INCLUDES) + INCLUDE_DIRECTORIES( ${ORACLE_INCLUDES} ) +ENDIF (ORACLE_INCLUDES) + +IF (POSTGRESQL_INCLUDE_DIR) + INCLUDE_DIRECTORIES( ${POSTGRESQL_INCLUDE_DIR} ) +ENDIF (POSTGRESQL_INCLUDE_DIR) + +IF (DB2_INCLUDES) + INCLUDE_DIRECTORIES( ${DB2_INCLUDES} ) +ENDIF (DB2_INCLUDES) + +IF (TERADATA_PATH_INCLUDES) + INCLUDE_DIRECTORIES( ${TERADATA_PATH_INCLUDES} ) +ENDIF (TERADATA_PATH_INCLUDES) + +IF (WANT_INTERNAL_QSCINTILLA) + INCLUDE_DIRECTORIES( + ${CMAKE_SOURCE_DIR}/src/qscintilla2/Qt4 + ${CMAKE_SOURCE_DIR}/src/qscintilla2/Qt4/Qci + ) +ELSE (WANT_INTERNAL_QSCINTILLA) + INCLUDE_DIRECTORIES(${QSCINTILLA_INCLUDE_DIR}) +ENDIF (WANT_INTERNAL_QSCINTILLA) + +IF (POPPLER_QT4_FOUND) + INCLUDE_DIRECTORIES(${POPPLER_QT4_INCLUDE_DIR}) +ENDIF (POPPLER_QT4_FOUND) + +# Handle win/mac special stuff - it's left empty for linux/unix +SET (GUI_TYPE) +IF (APPLE AND WANT_BUNDLE) + SET(GUI_TYPE MACOSX_BUNDLE) + SET(APPLE_BUNDLE_SOURCES icons/tora.icns) +ENDIF (APPLE AND WANT_BUNDLE) + + +IF(WIN32) + IF (MSVC) + # this is a must to switch off subsystem:console (console window poping up) + # WinMain wrapper from QT_QTMAIN_LIBRARY is used and liner must be modified + LINK_LIBRARIES(${QT_QTMAIN_LIBRARY}) + SET (GUI_TYPE WIN32) +# IF (WANT_DEBUG) +# SET (CMAKE_EXE_LINKER_FLAGS "/NODEFAULTLIB:msvcrtd.lib ${CMAKE_EXE_LINKER_FLAGS}") +# ELSE (WANT_DEBUG) +# SET (CMAKE_EXE_LINKER_FLAGS "/NODEFAULTLIB:msvcrt.lib ${CMAKE_EXE_LINKER_FLAGS}") +# ENDIF (WANT_DEBUG) + ENDIF (MSVC) +ENDIF(WIN32) + + +#Set up libraries to link with all found packages +# dynamic +SET(TORA_LIBS + ${QT_LIBRARIES} + ${ORACLE_LIBRARIES} + ${LIBXML2_LIBRARIES} + ${QSCINTILLA_LIBRARIES} + ${TORA_LOKI_LIB} #static +) + +#IF (ORACLE_LIBRARIES) +# TARGET_LINK_LIBRARIES (${EXE_NAME} ${ORACLE_LIBRARIES} ) +#ENDIF (ORACLE_LIBRARIES) + +IF (POSTGRESQL_LIBRARIES) + LIST(APPEND TORA_LIBS ${POSTGRESQL_LIBRARIES}) +ENDIF (POSTGRESQL_LIBRARIES) + +IF (DB2_LIBRARIES) + LIST(APPEND TORA_LIBS} ${DB2_LIBRARIES}) +ENDIF (DB2_LIBRARIES) + +IF (TERADATA_LIBRARIES) + LIST(APPEND TORA_LIBS ${TERADATA_LIBRARIES}) +ENDIF (TERADATA_LIBRARIES) + +IF (USE_TROTL) + LIST(APPEND TORA_LIBS ${TROTL_LIB}) + ADD_DEFINITIONS("-DTROTL_DLL") +ENDIF (USE_TROTL) + +IF (USE_ANTLR) + LIST(APPEND TORA_LIBS "libantlr3c") + LIST(APPEND TORA_SOURCES + "parsing/tsqlparseoracle.cpp" + "parsing/error_handler.c" + "parsing/OracleSQLLexer.c" + "parsing/OracleSQLParser.c" + ) + INCLUDE_DIRECTORIES( + "${CMAKE_CURRENT_SOURCE_DIR}/libantlr3c-3.2/include" + "${CMAKE_CURRENT_BINARY_DIR}/libantlr3c-3.2" + ) +ENDIF(USE_ANTLR) + +IF (POPPLER_QT4_FOUND) + LIST(APPEND TORA_LIBS ${POPPLER_QT4_LIBRARIES}) +ENDIF(POPPLER_QT4_FOUND) + +IF (WANT_INTERNAL_QSCINTILLA) + LIST(APPEND TORA_LIBS ${TORA_QSCINTILLA_LIB} ${QT_LIBRARIES}) +ENDIF (WANT_INTERNAL_QSCINTILLA) +# prevent opening the cmd.exe window +IF (WIN32) + LIST(APPEND TORA_LIBS ${WINDOWS_LIB}) + LIST(APPEND TORA_LIBS "ws2_32.lib") + # don't use console subsystem + IF (MINGW) + LIST(APPEND TORA_LIBS "-mwindows") + ENDIF (MINGW) +ENDIF (WIN32) + +ADD_EXECUTABLE(${EXE_NAME} ${GUI_TYPE} +# ${TORA_I18N_QM} +# ${TORA_MOC_SOURCES} + main.cpp + ${TORA_SOURCES} +# ${TORA_UI_SOURCES} + ${TORA_RCC_SRCS} + ${APPLE_BUNDLE_SOURCES} +) +#SET_TARGET_PROPERTIES(${EXE_NAME} PROPERTIES COMPILE_FLAGS "-DTROTL_DLL") +TARGET_LINK_LIBRARIES(${EXE_NAME} ${TORA_LIBS} ${TORA_MOC_LIB}) + +IF(USE_PCH) +# ADD_PRECOMPILED_HEADER(${EXE_NAME} ${CMAKE_CURRENT_SOURCE_DIR}/precompiled_msvc.h) +ENDIF(USE_PCH) + +# Test programs +ADD_EXECUTABLE(trotl_test0 ${GUI_TYPE} + trotl_test0.cpp + ${TORA_SOURCES} + ${TORA_RCC_SRCS} + ${APPLE_BUNDLE_SOURCES} +) +#SET_TARGET_PROPERTIES(trotl_test0 PROPERTIES COMPILE_FLAGS "-DTROTL_DLL") +TARGET_LINK_LIBRARIES(trotl_test0 ${TORA_LIBS} ${TORA_MOC_LIB}) + +ADD_EXECUTABLE(trotl_test1 ${GUI_TYPE} + trotl_test1.cpp + ${TORA_SOURCES} + ${TORA_RCC_SRCS} + ${APPLE_BUNDLE_SOURCES} +) +#SET_TARGET_PROPERTIES(trotl_test1 PROPERTIES COMPILE_FLAGS "-DTROTL_DLL") +TARGET_LINK_LIBRARIES(trotl_test1 ${TORA_LIBS} ${TORA_MOC_LIB}) + +ADD_EXECUTABLE(trotl_test2 ${GUI_TYPE} + trotl_test2.cpp + ${TORA_SOURCES} + ${TORA_RCC_SRCS} + ${APPLE_BUNDLE_SOURCES} +) +#SET_TARGET_PROPERTIES(trotl_test2 PROPERTIES COMPILE_FLAGS "-DTROTL_DLL") +TARGET_LINK_LIBRARIES(trotl_test2 ${TORA_LIBS} ${TORA_MOC_LIB}) + +QT4_WRAP_CPP(TROTL_TEST3_MOC_SOURCES "trotl_test3.h") +ADD_EXECUTABLE(trotl_test3 ${GUI_TYPE} + trotl_test3.cpp + ${TORA_SOURCES} + ${TORA_RCC_SRCS} + ${APPLE_BUNDLE_SOURCES} + ${TROTL_TEST3_MOC_SOURCES} +) +#SET_TARGET_PROPERTIES(trotl_test3 PROPERTIES COMPILE_FLAGS "-DTROTL_DLL") + +# Install +IF (WIN32) + INSTALL(TARGETS ${EXE_NAME} RUNTIME DESTINATION .) +ELSE (WIN32) + IF (NOT WANT_BUNDLE) + INSTALL(TARGETS ${EXE_NAME} RUNTIME DESTINATION bin LIBRARY DESTINATION lib) + ELSE (NOT WANT_BUNDLE) + + #SET_TARGET_PROPERTIES(${EXE_NAME} PROPERTIES MACOSX_BUNDLE_INFO_PLIST "${CMAKE_SOURCE_DIR}/osx_tools/Info.plist.in") + SET(MACOSX_BUNDLE_ICON_FILE tora.icns) + SET(MACOSX_BUNDLE_INFO_STRING "${EXE_NAME} ${VERSION}") + SET(MACOSX_BUNDLE_GUI_IDENTIFIER "com.torasql") + SET(MACOSX_BUNDLE_LONG_VERSION_STRING "${VERSION}") + SET(MACOSX_BUNDLE_BUNDLE_NAME "${EXE_NAME}") + SET(MACOSX_BUNDLE_SHORT_VERSION_STRING "${VERSION}") + SET(MACOSX_BUNDLE_BUNDLE_VERSION "${VERSION}") + SET(MACOSX_BUNDLE_COPYRIGHT "(c) TOra developers") + SET_SOURCE_FILES_PROPERTIES(${CMAKE_SOURCE_DIR}/src/icons/tora.icns PROPERTIES MACOSX_PACKAGE_LOCATION Resources) + + # Warning: This is dangerous to touch. Except you know what are you doing. + # I ususaly don't know anything about it. But it's working ;) + + INSTALL(TARGETS ${EXE_NAME} BUNDLE DESTINATION ${CMAKE_INSTALL_PREFIX}) + + IF (WANT_BUNDLE_STANDALONE) + # --- If we are on OS X copy all the embedded libraries to the app bundle + # -------- Function to build OS X Stand Alone Bundles ----------------- + function(MakeOSXBundleApp target binary_dir) + #-- Set some useful variables + SET (OSX_MAKE_STANDALONE_BUNDLE_CMAKE_SCRIPT "${binary_dir}/${target}_OSX_MakeStandAloneBundle.cmake") + SET (OSX_MAKE_STANDALONE_BUNDLE_BASH_SCRIPT "${binary_dir}/${target}_OSX_MakeStandAloneBundle.sh") + #-- Configure the cmake file and the shell script + CONFIGURE_FILE("${CMAKE_SOURCE_DIR}/osx_tools/CompleteBundle.cmake.in" + "${OSX_MAKE_STANDALONE_BUNDLE_CMAKE_SCRIPT}" @ONLY IMMEDIATE) + CONFIGURE_FILE("${CMAKE_SOURCE_DIR}/osx_tools/CreateBundle.sh.in" + "${OSX_MAKE_STANDALONE_BUNDLE_BASH_SCRIPT}" @ONLY IMMEDIATE) + #-- Create the installation code + install(SCRIPT "${OSX_MAKE_STANDALONE_BUNDLE_CMAKE_SCRIPT}") + endfunction(MakeOSXBundleApp) + + + install(DIRECTORY ${QT_PLUGINS_DIR}/ + DESTINATION ${PROJECT_BINARY_DIR}/Contents/Plugins/ + REGEX "(designer|script|phonon_backend|debug|sqlite|ico)" EXCLUDE) + + install(CODE " + # glob for previously installed qt plugins to include in fixup_bundle + file(GLOB_RECURSE PluginList + ${PROJECT_BINARY_DIR}/Contents/Plugins/*.bundle) + ") + + MakeOSXBundleApp(${EXE_NAME} ${PROJECT_BINARY_DIR}) + + # TODO/FIXME: this is evil! And it should be done automagically... + set(hack_bundle_pth "${CMAKE_INSTALL_PREFIX}/${EXE_NAME}.app/Contents/MacOS") + INSTALL(CODE "file(MAKE_DIRECTORY ${hack_bundle_pth}/sqldrivers)") + INSTALL(CODE "file(MAKE_DIRECTORY ${hack_bundle_pth}/codecs)") + INSTALL(CODE "file(MAKE_DIRECTORY ${hack_bundle_pth}/accessible)") + INSTALL(CODE "file(MAKE_DIRECTORY ${hack_bundle_pth}/imageformats)") + INSTALL(CODE "file(MAKE_DIRECTORY ${hack_bundle_pth}/graphicssystems)") + function(hack_move_plugins filename targetdir) + install(CODE " + message(STATUS \"file:: ${filename} -> targetdir: ${targetdir} ${hack_bundle_pth}\") + ") + install(FILES ${hack_bundle_pth}/${filename} DESTINATION ${hack_bundle_pth}/${targetdir}) + install(CODE "file(REMOVE ${hack_bundle_pth}/${filename})") + endfunction(hack_move_plugins) + hack_move_plugins("libqcncodecs.bundle" "codecs") + hack_move_plugins("libqjpcodecs.bundle" "codecs") + hack_move_plugins("libqtwcodecs.bundle" "codecs") + hack_move_plugins("libqkrcodecs.bundle" "codecs") + hack_move_plugins("libqsqlmysql.bundle" "sqldrivers") + hack_move_plugins("libqsqlodbc.bundle" "sqldrivers") + hack_move_plugins("libqsqlpsql.bundle" "sqldrivers") + hack_move_plugins("libqgif.bundle" "imageformats") + hack_move_plugins("libqjpeg.bundle" "imageformats") + hack_move_plugins("libqmng.bundle" "imageformats") + hack_move_plugins("libqsvg.bundle" "imageformats") + hack_move_plugins("libqtiff.bundle" "imageformats") + hack_move_plugins("libqtaccessiblewidgets.bundle" "accessible") + hack_move_plugins("libqtaccessiblecompatwidgets.bundle" "accessible") + hack_move_plugins("libqglgraphicssystem.bundle" "graphicssystems") + # end of hack + + #-- Put an empty qt.conf file in the bundle so as to NOT load plugins from the installed Qt. + INSTALL(CODE "message(STATUS \"${CMAKE_INSTALL_PREFIX}/${EXE_NAME}.app/Contents/Resources/qt.conf\")") + INSTALL(FILES "${CMAKE_SOURCE_DIR}/osx_tools/qt.conf.in" + DESTINATION "${CMAKE_INSTALL_PREFIX}/${EXE_NAME}.app/Contents/Resources/" + RENAME "qt.conf") + + if ("${QT_MAC_USE_COCOA}" STREQUAL "1") + INSTALL(CODE "message(STATUS \"Copying qt_menu.nib into ${CMAKE_INSTALL_PREFIX}/${EXE_NAME}.app/Contents/Resources\")") + INSTALL(CODE "file(MAKE_DIRECTORY \"${CMAKE_INSTALL_PREFIX}/${EXE_NAME}.app/Contents/Resources/qt_menu.nib\")") + INSTALL(CODE "execute_process(COMMAND ${CMAKE_COMMAND} -E copy_directory + \"${QT_LIBRARY_DIR}/QtGui.framework/Resources/qt_menu.nib\" + \"${CMAKE_INSTALL_PREFIX}/${EXE_NAME}.app/Contents/Resources/qt_menu.nib\")") + endif() + ENDIF (WANT_BUNDLE_STANDALONE) + + ENDIF (NOT WANT_BUNDLE) +ENDIF (WIN32) Modified: branches/tora-trotl/src/tobackground.cpp =================================================================== --- branches/tora-trotl/src/tobackground.cpp 2011-04-15 07:50:31 UTC (rev 3935) +++ branches/tora-trotl/src/tobackground.cpp 2011-04-15 09:20:42 UTC (rev 3936) @@ -61,15 +61,15 @@ , main(toMainWidget()) { /* It it not allowed to touch the gui(instance of toBackgroundLabel) from parallel thread, - * therefore we connect it(if it exists) to our signals and will update it using signal emits. - * QT signal mechanism will satisfy handover of singal data between our thread and mainWindowThread - */ - if(main && main->getBackgroundLabel()) + * therefore we connect it(if it exists) to our signals and will update it using signal emits. + * QT signal mechanism will satisfy handover of singal data between our thread and mainWindowThread + */ + { - connect(this, SIGNAL(pause(void)), main->getBackgroundLabel(), SLOT(pause(void))); - connect(this, SIGNAL(unpause(void)), main->getBackgroundLabel(), SLOT(unpause(void))); - connect(this, SIGNAL(setSpeed(int)), main->getBackgroundLabel(), SLOT(setSpeed(int))); - connect(this, SIGNAL(setTip(QString)), main->getBackgroundLabel(), SLOT(setTip(QString))); + connect(this, SIGNAL(SignalPause(void)), this, SLOT(pause(void))); + connect(this, SIGNAL(SignalUnpause(void)), this, SLOT(unpause(void))); + connect(this, SIGNAL(SignalSetSpeed(int)), this, SLOT(setSpeed(int))); + connect(this, SIGNAL(SignalSetTip(QString)), this, SLOT(setTip(QString))); } } @@ -78,16 +78,16 @@ if (!isActive()) { Running++; - emit unpause(); + emit SignalUnpause(); } - emit setSpeed(std::min(Running, 1)*100); + emit SignalSetSpeed(std::min(Running, 1)*100); if (Running > 1) { - emit setTip(tr("%1 queries running in background.").arg(Running)); + emit SignalSetTip(tr("%1 queries running in background.").arg(Running)); } else { - emit setTip(tr("One query running in background.")); + emit SignalSetTip(tr("One query running in background.")); } toTimer::start(msec); } @@ -98,16 +98,16 @@ { Running--; if (Running == 0) - emit pause(); + emit SignalPause(); else - emit setSpeed(Running*100); + emit SignalSetSpeed(Running*100); if (Running > 1) - emit setTip(tr("%1 queries running in background.").arg(Running)); + emit SignalSetTip(tr("%1 queries running in background.").arg(Running)); else if (Running == 1) - emit setTip("One query running in background."); + emit SignalSetTip("One query running in background."); else - emit setTip(tr("No background queries.")); + emit SignalSetTip(tr("No background queries.")); } toTimer::stop(); } @@ -116,3 +116,35 @@ { stop(); } + +void toBackground::pause() +{ + if(main && main->getBackgroundLabel()) + { + main->getBackgroundLabel()->pause(); + } +} + +void toBackground::unpause() +{ + if(main && main->getBackgroundLabel()) + { + main->getBackgroundLabel()->unpause(); + } +} + +void toBackground::setSpeed(int speed) +{ + if(main && main->getBackgroundLabel()) + { + main->getBackgroundLabel()->setSpeed(speed); + } +} + +void toBackground::setTip(QString tip) +{ + if(main && main->getBackgroundLabel()) + { + main->getBackgroundLabel()->setTip(tip); + } +} \ No newline at end of file Modified: branches/tora-trotl/src/tobackground.h =================================================================== --- branches/tora-trotl/src/tobackground.h 2011-04-15 07:50:31 UTC (rev 3935) +++ branches/tora-trotl/src/tobackground.h 2011-04-15 09:20:42 UTC (rev 3936) @@ -39,6 +39,11 @@ static void init(void); signals: + void SignalPause(); + void SignalUnpause(); + void SignalSetSpeed(int Running); + void SignalSetTip(QString tip); +private slots: void pause(); void unpause(); void setSpeed(int Running); Modified: branches/tora-trotl/src/tobackgroundlabel.h =================================================================== --- branches/tora-trotl/src/tobackgroundlabel.h 2011-04-15 07:50:31 UTC (rev 3935) +++ branches/tora-trotl/src/tobackgroundlabel.h 2011-04-15 09:20:42 UTC (rev 3936) @@ -22,7 +22,6 @@ //static toBackgroundLabel createToBackgroundLabel(); virtual void mouseReleaseEvent(QMouseEvent* e); toBackgroundLabel(QWidget *parent); -public slots: virtual void unpause(); virtual void pause(); virtual void setTip(QString tip); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ibr...@us...> - 2011-04-22 13:00:58
|
Revision: 3948 http://tora.svn.sourceforge.net/tora/?rev=3948&view=rev Author: ibre5041 Date: 2011-04-22 13:00:51 +0000 (Fri, 22 Apr 2011) Log Message: ----------- Comments added Modified Paths: -------------- branches/tora-trotl/src/toeventquery.h branches/tora-trotl/src/torunnable.h Modified: branches/tora-trotl/src/toeventquery.h =================================================================== --- branches/tora-trotl/src/toeventquery.h 2011-04-19 15:14:47 UTC (rev 3947) +++ branches/tora-trotl/src/toeventquery.h 2011-04-22 13:00:51 UTC (rev 3948) @@ -86,6 +86,8 @@ // QThread instance that will do actual reading // Note: this pointer is NOT deleted by me, but by toRunnableThread::run/delete Runner + // This can not be guarded by QPointer until QT is fixed, + // see http://qt.gitorious.org/~varlucian/qt/varlucians-qt/commit/18e3cd65980e1bc01e6af4807cae0bceca25288c toEventQueryTask *Task; // true when task finishes. this set from a slot called by a Modified: branches/tora-trotl/src/torunnable.h =================================================================== --- branches/tora-trotl/src/torunnable.h 2011-04-19 15:14:47 UTC (rev 3947) +++ branches/tora-trotl/src/torunnable.h 2011-04-22 13:00:51 UTC (rev 3948) @@ -74,6 +74,8 @@ * allows you to send signals and use slots from a thread in an * intuitive fashion. * + * NOTE: at this moment it is subclassed only by toEventQueryTask + * and toConnectionPool */ class toRunnable : public QObject { Q_OBJECT; @@ -130,7 +132,7 @@ /** * Creates new thread. Call start to begin. - * + * and then delete the runner, callee should not delete it */ toRunnableThread(toRunnable *runner) : QThread(0) { Runner = runner; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ibr...@us...> - 2011-04-22 13:01:58
|
Revision: 3949 http://tora.svn.sourceforge.net/tora/?rev=3949&view=rev Author: ibre5041 Date: 2011-04-22 13:01:51 +0000 (Fri, 22 Apr 2011) Log Message: ----------- std::list replaced with QList Modified Paths: -------------- branches/tora-trotl/src/tobrowserconstraint.cpp branches/tora-trotl/src/tocache.cpp branches/tora-trotl/src/tocache.h branches/tora-trotl/src/toconnection.cpp branches/tora-trotl/src/toconnection.h branches/tora-trotl/src/todescribe.cpp branches/tora-trotl/src/tooracleconnection_trotl.cpp branches/tora-trotl/src/toqsqlconnection.cpp branches/tora-trotl/src/tosecuritytreemodel.cpp Modified: branches/tora-trotl/src/tobrowserconstraint.cpp =================================================================== --- branches/tora-trotl/src/tobrowserconstraint.cpp 2011-04-22 13:00:51 UTC (rev 3948) +++ branches/tora-trotl/src/tobrowserconstraint.cpp 2011-04-22 13:01:51 UTC (rev 3949) @@ -187,9 +187,9 @@ CheckColumn->changeParams(Owner, Table); ReferTable->clear(); - std::list<toConnection::objectName> objects = connection().objects(false); + QList<toConnection::objectName> objects = connection().objects(false); { - for (std::list<toConnection::objectName>::iterator i = objects.begin();i != objects.end();i++) + for (QList<toConnection::objectName>::iterator i = objects.begin();i != objects.end();i++) { if ((*i).Type == "TABLE" && (*i).Owner == Owner) ReferTable->addItem((*i).Name); Modified: branches/tora-trotl/src/tocache.cpp =================================================================== --- branches/tora-trotl/src/tocache.cpp 2011-04-22 13:00:51 UTC (rev 3948) +++ branches/tora-trotl/src/tocache.cpp 2011-04-22 13:01:51 UTC (rev 3949) @@ -107,7 +107,7 @@ toStatusMessage(qApp->translate("toConnection", "Not done caching objects"), false, false); return false; } - std::list<objectName>::iterator i = ObjectNames.begin(); + QList<objectName>::iterator i = ObjectNames.begin(); while (i != ObjectNames.end() && (*i) < obj) i++; if (i != ObjectNames.end() && *i == obj) // Already exists, don't add @@ -128,7 +128,7 @@ { (new toThread(t))->start(); ReadingThread.down(); // Wait till child thread starts - toMainWidget()->checkCaching(); + toMainWidget()->checkCaching(); // notify main window about the change of cache's state } catch (...) { @@ -206,7 +206,7 @@ QString un = name.toUpper(); synonym = QString::null; - for (std::list<objectName>::iterator i = ObjectNames.begin(); i != ObjectNames.end(); i++) + for (QList<objectName>::iterator i = ObjectNames.begin(); i != ObjectNames.end(); i++) { if (owner.isEmpty()) { @@ -250,12 +250,12 @@ return SynonymMap; } -std::list<toCache::objectName>& toCache::objects(bool block) +QList<toCache::objectName>& toCache::objects(bool block) { if (!cacheAvailable(OBJECTS, block)) { toStatusMessage(qApp->translate("toConnection", "Not done caching objects"), false, false); - static std::list<objectName> ret; + static QList<objectName> ret; return ret; } @@ -306,15 +306,15 @@ return Owner == nam.Owner && Name == nam.Name && Type == nam.Type; } -void toCache::setObjectList(const std::list<objectName> &list) +void toCache::setObjectList(const QList<objectName> &list) { toLocker lock(cacheLock); ObjectNames = list; // Set the date when information about this object was red. This will later // be used to clean up an old information. - for (std::list<objectName>::iterator i = ObjectNames.begin(); i != ObjectNames.end(); i++) + for (QList<objectName>::iterator i = ObjectNames.begin(); i != ObjectNames.end(); i++) (*i).Timestamp = QDate::currentDate(); - ObjectNames.sort(); + qSort(ObjectNames); } // setObjectList void toCache::setSynonymList(const std::map<QString, objectName> &list) @@ -327,7 +327,7 @@ { toLocker lock(cacheLock); // TODO: ObjectList is sorted therefore going through all of it is not necessary! - for (std::list<objectName>::iterator i = ObjectNames.begin(); i != ObjectNames.end(); i++) + for (QList<objectName>::iterator i = ObjectNames.begin(); i != ObjectNames.end(); i++) { if (((*i).Owner == owner || owner == "%") && (*i).Name == name && @@ -343,7 +343,7 @@ toLocker lock(cacheLock); Row r; RowList rl; - for (std::list<objectName>::iterator i = ObjectNames.begin(); i != ObjectNames.end(); i++) + for (QList<objectName>::iterator i = ObjectNames.begin(); i != ObjectNames.end(); i++) { if (((*i).Owner == owner || owner == "%") && (*i).Type == type) @@ -362,7 +362,7 @@ toLocker lock(cacheLock); bool OwnerExists = false; QList<objectName>::const_iterator newObjects = rows.begin(); - std::list<objectName>::iterator currentObjects = ObjectNames.begin(); + QList<objectName>::iterator currentObjects = ObjectNames.begin(); if (ObjectNames.size() > 0) { @@ -485,6 +485,7 @@ { toLocker lock(cacheLock); QStringList records = data.split("\x1D", QString::KeepEmptyParts); + bool objectNamesSorted = true; for (QStringList::Iterator i = records.begin(); i != records.end(); i++) { objCounter++; @@ -522,7 +523,7 @@ delete cur; cur = 0; } - ObjectNames.sort(); + qSort(ObjectNames); } return true; @@ -554,7 +555,7 @@ QStringList recordSynonym; // all synonyms of one particular object { toLocker lock(cacheLock); - for (std::list<objectName>::iterator i = ObjectNames.begin(); i != ObjectNames.end(); i++) + for (QList<objectName>::iterator i = ObjectNames.begin(); i != ObjectNames.end(); i++) { record.clear(); record.append((*i).Owner); Modified: branches/tora-trotl/src/tocache.h =================================================================== --- branches/tora-trotl/src/tocache.h 2011-04-22 13:00:51 UTC (rev 3948) +++ branches/tora-trotl/src/tocache.h 2011-04-22 13:01:51 UTC (rev 3949) @@ -7,7 +7,7 @@ #include <QList> #include <QVariant> #include <map> -#include <list> +#include <QList> #include <set> /** Object cache for a connection. This class is accessed only through toConnection @@ -111,7 +111,7 @@ }; private: - std::list<objectName> ObjectNames; + QList<objectName> ObjectNames; std::map<QString, objectName> SynonymMap; toCacheState state; @@ -192,7 +192,7 @@ * @return A list of object available for the current user. The list is sorted in * owner and name order. */ - std::list<objectName>& objects(bool block); + QList<objectName>& objects(bool block); toQDescList &columns(const objectName &table); @@ -215,7 +215,7 @@ * will remove any existing objects in cache (for this connection). * @param list list of objects to be set */ - void setObjectList(const std::list<objectName> &list); + void setObjectList(const QList<objectName> &list); /** Set a list of object synonyms. This is used when list of synonyms is loaded * in bulk outside of a cache (for example in connection class). Note that this Modified: branches/tora-trotl/src/toconnection.cpp =================================================================== --- branches/tora-trotl/src/toconnection.cpp 2011-04-22 13:00:51 UTC (rev 3948) +++ branches/tora-trotl/src/toconnection.cpp 2011-04-22 13:01:51 UTC (rev 3949) @@ -63,6 +63,7 @@ #include <QString> #include <QDateTime> #include <QPointer> +#include <QList> // A little magic to get lrefresh to work and get a check on qApp @@ -757,7 +758,7 @@ diskloaded = Connection->Cache->loadDiskCache(); if (!diskloaded && !Connection->Abort) { - const std::list<objectName> &n = Connection->Connection->objectNames(); + const QList<objectName> &n = Connection->Connection->objectNames(); if (!Connection->Abort) Connection->Cache->setObjectList(n); } @@ -813,15 +814,15 @@ return Connection->analyzer(); } -std::list<toConnection::objectName> toConnection::connectionImpl::objectNames(const QString &owner, +QList<toConnection::objectName> toConnection::connectionImpl::objectNames(const QString &owner, const QString &type, const QString &name) { - std::list<objectName> ret; + QList<objectName> ret; return ret; } -std::map<QString, toConnection::objectName> toConnection::connectionImpl::synonymMap(std::list<objectName> &) +std::map<QString, toConnection::objectName> toConnection::connectionImpl::synonymMap(QList<objectName> &) { std::map<QString, objectName> ret; return ret; @@ -850,7 +851,7 @@ Cache->rereadCache(new cacheObjects(this)); } -const std::list<toConnection::objectName> &toConnection::objects(bool block) const +const QList<toConnection::objectName> &toConnection::objects(bool block) const { return Cache->objects(block); } @@ -861,8 +862,8 @@ { bool added = false; // did we actually add at least one new object? - std::list<toConnection::objectName> objects = this->Connection->objectNames(owner, type, name); - for (std::list<toConnection::objectName>::iterator i = objects.begin(); i != objects.end(); i++) + QList<toConnection::objectName> objects = this->Connection->objectNames(owner, type, name); + for (QList<toConnection::objectName>::iterator i = objects.begin(); i != objects.end(); i++) { added = added || Cache->addIfNotExists(*i); } Modified: branches/tora-trotl/src/toconnection.h =================================================================== --- branches/tora-trotl/src/toconnection.h 2011-04-22 13:00:51 UTC (rev 3948) +++ branches/tora-trotl/src/toconnection.h 2011-04-22 13:01:51 UTC (rev 3949) @@ -261,7 +261,7 @@ * goes wrong should throw exception. * @return List of available objects. */ - virtual std::list<toConnection::objectName> objectNames(const QString &owner = "", + virtual QList<toConnection::objectName> objectNames(const QString &owner = "", const QString &type = "", const QString &name = ""); /** Get synonyms available for connection. Any access to the @@ -272,7 +272,7 @@ * this list. * @return Map of synonyms to objectnames. */ - virtual std::map<QString, toConnection::objectName> synonymMap(std::list<toConnection::objectName> &objects); + virtual std::map<QString, toConnection::objectName> synonymMap(QList<toConnection::objectName> &objects); /** Extract available columns to query for a table. * @param table Table to get column for. * @return List of columns for table or view. @@ -605,7 +605,7 @@ * @return A list of object available for the current user. The list is sorted in * owner and name order. */ - const std::list<toConnection::objectName>& objects(bool block) const; + const QList<toConnection::objectName>& objects(bool block) const; /** * Reread specified objects from database to the cache. If null is given as value of any Modified: branches/tora-trotl/src/todescribe.cpp =================================================================== --- branches/tora-trotl/src/todescribe.cpp 2011-04-22 13:00:51 UTC (rev 3948) +++ branches/tora-trotl/src/todescribe.cpp 2011-04-22 13:01:51 UTC (rev 3949) @@ -42,6 +42,7 @@ #include <QSettings> #include <QHideEvent> #include <QMessageBox> +#include <QList> #include "toconnection.h" #include "tobrowsertablewidget.h" @@ -92,8 +93,8 @@ do { // Get a cached list of objects and then search in it without querying // the database in order to improve performance - std::list<toConnection::objectName> objects = toCurrentConnection(this).Cache->objects(false); - for (std::list<toConnection::objectName>::iterator i = objects.begin();i != objects.end();i++) + QList<toConnection::objectName> objects = toCurrentConnection(this).Cache->objects(false); + for (QList<toConnection::objectName>::iterator i = objects.begin();i != objects.end();i++) { if ((*i).Name == object && (*i).Owner == owner) { Modified: branches/tora-trotl/src/tooracleconnection_trotl.cpp =================================================================== --- branches/tora-trotl/src/tooracleconnection_trotl.cpp 2011-04-22 13:00:51 UTC (rev 3948) +++ branches/tora-trotl/src/tooracleconnection_trotl.cpp 2011-04-22 13:01:51 UTC (rev 3949) @@ -1002,18 +1002,17 @@ return str.toUpper(); } - virtual std::list<toConnection::objectName> objectNames(const QString &owner, + virtual QList<toConnection::objectName> objectNames(const QString &owner, const QString &type, const QString &name) { - std::list<toConnection::objectName> ret; + QList<toConnection::objectName> ret; std::list<toQValue> par; par.insert(par.end(), owner); par.insert(par.end(), type); par.insert(par.end(), name); - toQuery objects(connection(), toQuery::Long, - SQLListObjects, par); + toQuery objects(connection(), toQuery::Long, SQLListObjects, par); toConnection::objectName cur; while (!objects.eof()) { Modified: branches/tora-trotl/src/toqsqlconnection.cpp =================================================================== --- branches/tora-trotl/src/toqsqlconnection.cpp 2011-04-22 13:00:51 UTC (rev 3948) +++ branches/tora-trotl/src/toqsqlconnection.cpp 2011-04-22 13:01:51 UTC (rev 3949) @@ -1218,8 +1218,8 @@ std::list<QString> extraData(const toQSqlProviderAggregate &aggr) { std::list<QString> ret; - const std::list<toConnection::objectName> &objects = query()->connection().objects(false); - for (std::list<toConnection::objectName>::const_iterator i = objects.begin();i != objects.end();i++) + const QList<toConnection::objectName> &objects = query()->connection().objects(false); + for (QList<toConnection::objectName>::const_iterator i = objects.begin();i != objects.end();i++) { if ((*i).Type == "DATABASE" && aggr.Type == toQSqlProviderAggregate::AllDatabases) { @@ -1531,11 +1531,11 @@ return name; } - virtual std::list<toConnection::objectName> objectNames(const QString &owner, + virtual QList<toConnection::objectName> objectNames(const QString &owner, const QString &type, const QString &name) { - std::list<toConnection::objectName> ret; + QList<toConnection::objectName> ret; toConnection::objectName cur; try Modified: branches/tora-trotl/src/tosecuritytreemodel.cpp =================================================================== --- branches/tora-trotl/src/tosecuritytreemodel.cpp 2011-04-22 13:00:51 UTC (rev 3948) +++ branches/tora-trotl/src/tosecuritytreemodel.cpp 2011-04-22 13:01:51 UTC (rev 3949) @@ -276,8 +276,8 @@ QString owner; QString name; - const std::list<toConnection::objectName> &objectList = toCurrentConnection(this).objects(true); - for (std::list<toConnection::objectName>::const_iterator i = objectList.begin(); + const QList<toConnection::objectName> &objectList = toCurrentConnection(this).objects(true); + for (QList<toConnection::objectName>::const_iterator i = objectList.begin(); i != objectList.end(); i++) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ibr...@us...> - 2011-05-14 11:12:11
|
Revision: 3962 http://tora.svn.sourceforge.net/tora/?rev=3962&view=rev Author: ibre5041 Date: 2011-05-14 11:12:04 +0000 (Sat, 14 May 2011) Log Message: ----------- newer libantlr version Added Paths: ----------- branches/tora-trotl/src/libantlr3c-3.3/ branches/tora-trotl/src/libantlr3c-3.3/AUTHORS branches/tora-trotl/src/libantlr3c-3.3/CMakeLists.txt branches/tora-trotl/src/libantlr3c-3.3/COPYING branches/tora-trotl/src/libantlr3c-3.3/ChangeLog branches/tora-trotl/src/libantlr3c-3.3/Makefile.am branches/tora-trotl/src/libantlr3c-3.3/NEWS branches/tora-trotl/src/libantlr3c-3.3/README branches/tora-trotl/src/libantlr3c-3.3/antlr3config.h.in branches/tora-trotl/src/libantlr3c-3.3/antlr3config.h.in.cmake branches/tora-trotl/src/libantlr3c-3.3/include/ branches/tora-trotl/src/libantlr3c-3.3/include/antlr3.h branches/tora-trotl/src/libantlr3c-3.3/include/antlr3baserecognizer.h branches/tora-trotl/src/libantlr3c-3.3/include/antlr3basetree.h branches/tora-trotl/src/libantlr3c-3.3/include/antlr3basetreeadaptor.h branches/tora-trotl/src/libantlr3c-3.3/include/antlr3bitset.h branches/tora-trotl/src/libantlr3c-3.3/include/antlr3collections.h branches/tora-trotl/src/libantlr3c-3.3/include/antlr3commontoken.h branches/tora-trotl/src/libantlr3c-3.3/include/antlr3commontree.h branches/tora-trotl/src/libantlr3c-3.3/include/antlr3commontreeadaptor.h branches/tora-trotl/src/libantlr3c-3.3/include/antlr3commontreenodestream.h branches/tora-trotl/src/libantlr3c-3.3/include/antlr3convertutf.h branches/tora-trotl/src/libantlr3c-3.3/include/antlr3cyclicdfa.h branches/tora-trotl/src/libantlr3c-3.3/include/antlr3debugeventlistener.h branches/tora-trotl/src/libantlr3c-3.3/include/antlr3defs.h branches/tora-trotl/src/libantlr3c-3.3/include/antlr3encodings.h branches/tora-trotl/src/libantlr3c-3.3/include/antlr3errors.h branches/tora-trotl/src/libantlr3c-3.3/include/antlr3exception.h branches/tora-trotl/src/libantlr3c-3.3/include/antlr3filestream.h branches/tora-trotl/src/libantlr3c-3.3/include/antlr3input.h branches/tora-trotl/src/libantlr3c-3.3/include/antlr3interfaces.h branches/tora-trotl/src/libantlr3c-3.3/include/antlr3intstream.h branches/tora-trotl/src/libantlr3c-3.3/include/antlr3lexer.h branches/tora-trotl/src/libantlr3c-3.3/include/antlr3memory.h branches/tora-trotl/src/libantlr3c-3.3/include/antlr3parser.h branches/tora-trotl/src/libantlr3c-3.3/include/antlr3parsetree.h branches/tora-trotl/src/libantlr3c-3.3/include/antlr3recognizersharedstate.h branches/tora-trotl/src/libantlr3c-3.3/include/antlr3rewritestreams.h branches/tora-trotl/src/libantlr3c-3.3/include/antlr3string.h branches/tora-trotl/src/libantlr3c-3.3/include/antlr3tokenstream.h branches/tora-trotl/src/libantlr3c-3.3/include/antlr3treeparser.h branches/tora-trotl/src/libantlr3c-3.3/src/ branches/tora-trotl/src/libantlr3c-3.3/src/antlr3baserecognizer.c branches/tora-trotl/src/libantlr3c-3.3/src/antlr3basetree.c branches/tora-trotl/src/libantlr3c-3.3/src/antlr3basetreeadaptor.c branches/tora-trotl/src/libantlr3c-3.3/src/antlr3bitset.c branches/tora-trotl/src/libantlr3c-3.3/src/antlr3collections.c branches/tora-trotl/src/libantlr3c-3.3/src/antlr3commontoken.c branches/tora-trotl/src/libantlr3c-3.3/src/antlr3commontree.c branches/tora-trotl/src/libantlr3c-3.3/src/antlr3commontreeadaptor.c branches/tora-trotl/src/libantlr3c-3.3/src/antlr3commontreenodestream.c branches/tora-trotl/src/libantlr3c-3.3/src/antlr3convertutf.c branches/tora-trotl/src/libantlr3c-3.3/src/antlr3cyclicdfa.c branches/tora-trotl/src/libantlr3c-3.3/src/antlr3debughandlers.c branches/tora-trotl/src/libantlr3c-3.3/src/antlr3encodings.c branches/tora-trotl/src/libantlr3c-3.3/src/antlr3exception.c branches/tora-trotl/src/libantlr3c-3.3/src/antlr3filestream.c branches/tora-trotl/src/libantlr3c-3.3/src/antlr3inputstream.c branches/tora-trotl/src/libantlr3c-3.3/src/antlr3intstream.c branches/tora-trotl/src/libantlr3c-3.3/src/antlr3lexer.c branches/tora-trotl/src/libantlr3c-3.3/src/antlr3parser.c branches/tora-trotl/src/libantlr3c-3.3/src/antlr3rewritestreams.c branches/tora-trotl/src/libantlr3c-3.3/src/antlr3string.c branches/tora-trotl/src/libantlr3c-3.3/src/antlr3tokenstream.c branches/tora-trotl/src/libantlr3c-3.3/src/antlr3treeparser.c Removed Paths: ------------- branches/tora-trotl/src/libantlr3c-3.2/ Added: branches/tora-trotl/src/libantlr3c-3.3/AUTHORS =================================================================== --- branches/tora-trotl/src/libantlr3c-3.3/AUTHORS (rev 0) +++ branches/tora-trotl/src/libantlr3c-3.3/AUTHORS 2011-05-14 11:12:04 UTC (rev 3962) @@ -0,0 +1,41 @@ +The ANTLR recognizer generator tool was written by (with many contributions) + + Prof. Terence Parr at USF + +The C runtime and related C code generation elements were written by + + Jim Idle (jimi idle ws s/ /./g) with no contributions at all because + nobody else was crazy enough to do it. + +The C runtime and the ANLTR tool itself are distributed under the BSD license +which basically gives the right to so anythign with it, so long as you +recognize the authors. See here: + + [The "BSD licence"] + Copyright (c) 2005-2009 Jim Idle, Temporal Wave LLC + http://www.temporal-wave.com + http://www.linkedin.com/in/jimidle + + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + 3. The name of the author may not be used to endorse or promote products + derived from this software without specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. Added: branches/tora-trotl/src/libantlr3c-3.3/CMakeLists.txt =================================================================== --- branches/tora-trotl/src/libantlr3c-3.3/CMakeLists.txt (rev 0) +++ branches/tora-trotl/src/libantlr3c-3.3/CMakeLists.txt 2011-05-14 11:12:04 UTC (rev 3962) @@ -0,0 +1,116 @@ + +project(libantlr3c) +OPTION(ANTLR3_NODEBUGGER "ANTLR debugger not required" OFF) + +SET (VERSION "3.2") +SET (PACKAGE_BUGREPORT "ji...@te...") +SET (PACKAGE ${CMAKE_PROJECT_NAME}) + +SET (PACKAGE_VERSION ${VERSION}) +SET (PACKAGE_NAME ${CMAKE_PROJECT_NAME}) +SET (PACKAGE_TARNAME ${CMAKE_PROJECT_NAME}) +SET (PACKAGE_STRING "${CMAKE_PROJECT_NAME} ${VERSION}") + +cmake_minimum_required(VERSION 2.6) + +INCLUDE (CheckIncludeFiles) +INCLUDE (CheckFunctionExists) + +CHECK_INCLUDE_FILES ( "arpa_nameser.h" HAVE_ARPA_NAMESER_H ) +CHECK_INCLUDE_FILES ( "ctype.h" HAVE_CTYPE_H ) +CHECK_INCLUDE_FILES ( "dlfcn.h" HAVE_DLFCN_H ) +CHECK_INCLUDE_FILES ( "inttypes.h" HAVE_INTTYPES_H ) +CHECK_INCLUDE_FILES ( "malloc.h" HAVE_MALLOC_H ) +CHECK_INCLUDE_FILES ( "sys/malloc.h" HAVE_SYS_MALLOC_H ) +CHECK_INCLUDE_FILES ( "memory.h" HAVE_MEMORY_H ) +CHECK_INCLUDE_FILES ( "netdb.h" HAVE_NETDB_H ) +CHECK_INCLUDE_FILES ( "netinet/in.h" HAVE_NETINET_IN_H ) +CHECK_INCLUDE_FILES ( "netinet/tcp.h" HAVE_NETINET_TCP_H ) +CHECK_INCLUDE_FILES ( "resolv.h" HAVE_RESOLV_H ) +CHECK_INCLUDE_FILES ( "sys/resolv.h" HAVE_RESOLV_H ) +CHECK_INCLUDE_FILES ( "socket.h" HAVE_SOCKET_H ) +CHECK_INCLUDE_FILES ( "sys/socket.h" HAVE_SYS_SOCKET_H ) +CHECK_INCLUDE_FILES ( "stdarg.h" HAVE_STDARG_H ) +CHECK_INCLUDE_FILES ( "stdint.h" HAVE_STDINT_H ) +CHECK_INCLUDE_FILES ( "stdlib.h" HAVE_STDLIB_H ) +CHECK_INCLUDE_FILES ( "string.h" HAVE_STRING_H ) +CHECK_INCLUDE_FILES ( "strings.h" HAVE_STRINGS_H ) +CHECK_INCLUDE_FILES ( "sys/stat.h" HAVE_SYS_STAT_H ) +CHECK_INCLUDE_FILES ( "sys/types.h" HAVE_SYS_TYPES_H ) +CHECK_INCLUDE_FILES ( "unistd.h" HAVE_UNISTD_H ) + +CHECK_FUNCTION_EXISTS ( "accept" HAVE_ACCEPT ) +CHECK_FUNCTION_EXISTS ( "memmove" HAVE_MEMMOVE ) +CHECK_FUNCTION_EXISTS ( "memset" HAVE_MEMSET ) +CHECK_FUNCTION_EXISTS ( "strdup" HAVE_STRDUP ) + +IF(CMAKE_SIZEOF_VOID_P EQUAL "8") + SET(ANTLR3_USE_64BIT 1) +ENDIF(CMAKE_SIZEOF_VOID_P EQUAL "8") + +CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/antlr3config.h.in.cmake ${CMAKE_CURRENT_BINARY_DIR}/antlr3config.h) + +set(ANTLR3_SRCS + src/antlr3baserecognizer.c + src/antlr3basetreeadaptor.c + src/antlr3basetree.c + src/antlr3bitset.c + src/antlr3collections.c + src/antlr3commontoken.c + src/antlr3commontreeadaptor.c + src/antlr3commontree.c + src/antlr3commontreenodestream.c + src/antlr3convertutf.c + src/antlr3cyclicdfa.c + src/antlr3debughandlers.c + src/antlr3encodings.c + src/antlr3exception.c + src/antlr3filestream.c + src/antlr3inputstream.c + src/antlr3intstream.c + src/antlr3lexer.c + src/antlr3parser.c + src/antlr3rewritestreams.c + src/antlr3string.c + src/antlr3tokenstream.c + src/antlr3treeparser.c +) + +set(ANTLR3_HDRS + include/antlr3baserecognizer.h + include/antlr3basetreeadaptor.h + include/antlr3basetree.h + include/antlr3bitset.h + include/antlr3collections.h + include/antlr3commontoken.h + include/antlr3commontreeadaptor.h + include/antlr3commontree.h + include/antlr3commontreenodestream.h + include/antlr3convertutf.h + include/antlr3cyclicdfa.h + include/antlr3debugeventlistener.h + include/antlr3defs.h + include/antlr3encodings.h + include/antlr3errors.h + include/antlr3exception.h + include/antlr3filestream.h + include/antlr3.h + include/antlr3input.h + include/antlr3interfaces.h + include/antlr3intstream.h + include/antlr3lexer.h + include/antlr3memory.h + include/antlr3parser.h + include/antlr3parsetree.h + include/antlr3recognizersharedstate.h + include/antlr3rewritestreams.h + include/antlr3string.h + include/antlr3tokenstream.h + include/antlr3treeparser.h + + antlr3config.h + ) + +include_directories(include ${CMAKE_CURRENT_BINARY_DIR}) + +add_library(libantlr3c STATIC ${ANTLR3_SRCS}) Added: branches/tora-trotl/src/libantlr3c-3.3/COPYING =================================================================== --- branches/tora-trotl/src/libantlr3c-3.3/COPYING (rev 0) +++ branches/tora-trotl/src/libantlr3c-3.3/COPYING 2011-05-14 11:12:04 UTC (rev 3962) @@ -0,0 +1,29 @@ +// [The "BSD licence"] +// Copyright (c) 2005-2009 Jim Idle, Temporal Wave LLC +// http://www.temporal-wave.com +// http://www.linkedin.com/in/jimidle +// +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. The name of the author may not be used to endorse or promote products +// derived from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR +// IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES +// OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. +// IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT +// NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF +// THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + Added: branches/tora-trotl/src/libantlr3c-3.3/ChangeLog =================================================================== --- branches/tora-trotl/src/libantlr3c-3.3/ChangeLog (rev 0) +++ branches/tora-trotl/src/libantlr3c-3.3/ChangeLog 2011-05-14 11:12:04 UTC (rev 3962) @@ -0,0 +1,550 @@ +The following changes (change numbers refer to perforce) were +made from version 3.1.1 to 3.1.2 + +Runtime +------- + +Change 5641 on 2009/02/20 by ji...@ji...tlr3 + + Release version 3.1.2 of the ANTLR C runtime. + + Updated documents and release notes will have to follow later. + +Change 5639 on 2009/02/20 by ji...@ji...tlr3 + + Fixed: ANTLR-356 + + Ensure that code generation for C++ does not require casts + +Change 5577 on 2009/02/12 by ji...@ji...tlr3 + + C Runtime - Bug fixes. + + o Having moved to use an extract directly from a vector for returning + tokens, it exposed a + bug whereby the EOF boudary calculation in tokLT was incorrectly + checking > rather than >=. + o Changing to API initialization of tokens rather than memcmp() + incorrectly forgot to set teh input stream pointer for the + manufactured tokens in the token factory; + o Rewrite streams for rewriting tree parsers did not check whether the + rewrite stream was ever assigned before trying to free it, it is now + in line with the ordinary parser code. + +Change 5576 on 2009/02/11 by ji...@ji...tlr3 + + C Runtime: Ensure that when we manufacture a new token for a missing + token, that the user suplied custom information (if any) is copied + from the current token. + +Change 5575 on 2009/02/08 by ji...@ji...tlr3 + + C Runtime - Vastly improve the reuse of allocated memory for nodes in + tree rewriting. + + A problem for all targets at the moment si that the rewrite logic + generated by ANTLR makes no attempt + to reuse any resources, it merely gurantees that the tree shape at the + end is correct. To some extent this is mitigated by the garbage + collection systems of Java and .Net, even thoguh it is still an overhead to + keep creating so many modes. + + This change implements the first of two C runtime changes that make + best efforst to track when a node has become orphaned and will never + be reused, based on inherent knowledge of the rewrite logic (which in + the long term is not a great soloution). + + Much of the rewrite logic consists of creating a niilnode into which + child nodes are appended. At: rulePost processing time; when a rewrite + stream is closed; and when becomeRoot is called, there are many situations + where the root of the tree that will be manipulted, or is finished with + (in the case of rewrtie streams), where the nilNode was just a temporary + creation for the sake of the rewrite itself. + + In these cases we can see that the nilNode would just be left ot rot in + the node factory that tracks all the tree nodes. + Rather than leave these in the factory to rot, we now keep a resuse + stck and always reuse any node on this + stack before claimin a new node from the factory pool. + + This single change alone reduces memory usage in the test case (20,604 + line C program and a GNU C parser) + from nearly a GB, to 276MB. This is still way more memory than we + shoudl need to do this operation, even on such a large input file, + but the reduction results in a huge performance increase and greatly + reduced system time spent on allocations. + + After this optimizatoin, comparison with gcc yeilds: + + time gcc -S a.c + a.c:1026: warning: conflicting types for built-in function ‘vsprintf’ + a.c:1030: warning: conflicting types for built-in function ‘vsnprintf’ + a.c:1041: warning: conflicting types for built-in function ‘vsscanf’ + 0.21user 0.01system 0:00.22elapsed 97%CPU (0avgtext+0avgdata 0maxresident)k + 0inputs+240outputs (0major+8345minor)pagefaults 0swaps + + and + + time ./jimi + Reading a.c + 0.28user 0.11system 0:00.39elapsed 98%CPU (0avgtext+0avgdata 0maxresident)k + 0inputs+0outputs (0major+66609minor)pagefaults 0swaps + + And we can now interpolate the fact that the only major differnce is + now the huge disparity in memory allocations. A + future optimization of vector pooling, to sepate node resue from vector + reuse, currently looks promising for further reuse of memory. + + Finally, a static analysis of the rewrte code, plus a realtime analysis + of the heap at runtime, may well give us a reasonable memory usage + pattern. In reality though, it is the generated rewrite logic + that must becom optional at not continuously rewriting things that it + need not, as it ascends the rule chain. + +Change 5563 on 2009/01/28 by ji...@ji...tlr3 + + Allow rewrite streams to use the base adaptors vector factory and not + try to malloc new vectors themselves. + +Change 5562 on 2009/01/28 by ji...@ji...tlr3 + + Don't use CALLOC to allocate tree pools, use malloc as there is no need + for calloc. + +Change 5561 on 2009/01/28 by ji...@ji...tlr3 + + Prevent warnigsn about retval.stop not being initialized when a rule + returns eraly because it is in backtracking mode + +Change 5558 on 2009/01/28 by ji...@ji...tlr3 + + Lots of optimizations (though the next one to be checked in is the huge + win) for AST building and vector factories. + + A large part of tree rewriting was the creation of vectors to hold AST + nodes. Although I had created a vector factory, for some reason I never got + around to creating a proper one, that pre-allocated the vectors in chunks and + so on. I guess I just forgot to. Hence a big win here is prevention of calling + malloc lots and lots of times to create vectors. + + A second inprovement was to change teh vector definition such that it + holds a certain number of elements wihtin the vector structure itself, rather + than malloc and freeing these. Currently this is set to 8, but may increase. + For AST construction, this is generally a big win because AST nodes don't often + have many individual children unless there has not been any shaping going on in + the parser. But if you are not shaping, then you don't really need a tree. + + Other perforamnce inprovements here include not calling functions + indirectly within token stream and common token stream. Hence tokens are + claimed directly from the vectors. Users can override these funcitons of course + and all this means is that if you override tokenstreams then you pretty much + have to provide all the mehtods, but then I think you woudl have to anyway (and + I don't know of anyone that has wanted to do this as you can carry your own + structure around with the tokens anyway and that is much easier). + +Change 5555 on 2009/01/26 by ji...@ji...tlr3 + + Fixed: ANTLR-288 + Correct the interpretation of the skip token such that channel, start + index, char pos in lie, start line and text are correctly reset to the start of + the new token when the one that we just traversed was marked as being skipped. + + This correctly excludes the text that was matched as part of the + SKIP()ed token from the next token in the token stream and so has the side + effect that asking for $text of a rule no longer includes the text that shuodl + be skipped, but DOES include the text of tokens that were merely placed off the + default channel. + +Change 5551 on 2009/01/25 by ji...@ji...tlr3 + + Fixed: ANTLR-287 + Most of the source files did not include the BSD license. THis might + not be that big a deal given that I don't care what people do with it + other than take my name off it, but having the license reproduced + everywhere + at least makes things perfectly clear. Hence this mass change of + sources and templates + to include the license. + +Change 5550 on 2009/01/25 by ji...@ji...tlr3 + + Fixed: ANTLR-365 + Ensure that as soon as we known about an input stream on the lexer that + we borrow its string factroy adn use it in our EOF token in case + anyone tries to make it a string, such as in error messages for + instance. + +Change 5548 on 2009/01/25 by ji...@ji...tlr3 + + Fixed: ANTLR-363 + At some point the Java runtime default changed from discarding offchannel + tokens to preserving them. The fix is to make the C runtime also + default to preserving off-channel tokens. + +Change 5544 on 2009/01/24 by ji...@ji...tlr3 + + Fixed: ANTLR-360 + Ensure that the fillBuffer funtiion does not call any methods + that require the cached buffer size to be recorded before we + have actually recorded it. + +Change 5543 on 2009/01/24 by ji...@ji...tlr3 + + Fixed: ANTLR-362 + Some users have started using string factories themselves and + exposed a flaw in the destroy method, that is intended to remove + a strng htat was created by the factory and is no longer needed. + The string was correctly removed from the vector that tracks them + but after the first one, all the remaining strings are then numbered + incorrectly. Hence the destroy method has been recoded to reindex + the strings in the factory after one is removed and everythig is once + more hunky dory. + User suggested fix rejected. + +Change 5542 on 2009/01/24 by ji...@ji...tlr3 + + Fixed ANTLR-366 + The recognizer state now ensures that all fields are set to NULL upon +creation + and the reset does not overwrite the tokenname array + +Change 5527 on 2009/01/15 by ji...@ji...tlr3 + + Add the C runtime for 3.1.2 beta2 to perforce + +Change 5526 on 2009/01/15 by ji...@ji...tlr3 + + Correctly define the MEMMOVE macro which was inadvertently left to be + memcpy. + +Change 5503 on 2008/12/12 by ji...@ji...tlr3 + + Change C runtime release number to 3.1.2 beta + +Change 5473 on 2008/12/01 by ji...@ji...tlr3 + + Fixed: ANTLR-350 - C runtime use of memcpy + Prior change to use memcpy instead of memmove in all cases missed the + fact that the string factory can be in a situation where overlaps occur. We now + have ANTLR3_MEMCPY and ANTLR3_MEMMOVE and use the two appropriately. + +Change 5471 on 2008/12/01 by ji...@ji...tlr3 + + Fixed ANTLR-361 + - Ensure that ANTLR3_BOOLEAN is typedef'ed correctly when building for + MingW + +Templates +--------- + +Change 5637 on 2009/02/20 by ji...@ji...tlr3 + + C rtunime - make sure that ADAPTOR results are cast to the tree type on + a rewrite + +Change 5620 on 2009/02/18 by ji...@ji...tlr3 + + Rename/Move: + From: //depot/code/antlr/main/src/org/antlr/codegen/templates/... + To: //depot/code/antlr/main/src/main/resources/org/antlr/codegen/templates/... + + Relocate the code generating templates to exist in the directory set + that maven expects. + + When checking in your templates, you may find it easiest to make a copy + of what you have, revert the change in perforce, then just check out the + template in the new location, and copy the changes back over. Nobody has oore + than two files open at the moment. + +Change 5578 on 2009/02/12 by ji...@ji...tlr3 + + Correct the string template escape sequences for generating scope + code in the C templates. + +Change 5577 on 2009/02/12 by ji...@ji...tlr3 + + C Runtime - Bug fixes. + + o Having moved to use an extract directly from a vector for returning + tokens, it exposed a + bug whereby the EOF boudary calculation in tokLT was incorrectly + checking > rather than + >=. + o Changing to API initialization of tokens rather than memcmp() + incorrectly forgot to + set teh input stream pointer for the manufactured tokens in the + token factory; + o Rewrite streams for rewriting tree parsers did not check whether the + rewrite stream + was ever assigned before trying to free it, it is now in line with + the ordinary parser code. + +Change 5567 on 2009/01/29 by ji...@ji...tlr3 + + C Runtime - Further Optimizations + + Within grammars that used scopes and were intended to parse large + inputs with many rule nests, + the creation anf deletion of the scopes themselves became significant. + Careful analysis shows that + for most grammars, while a parse could create and delete 20,000 scopes, + the maxium depth of + any scope was only 8. + + This change therefore changes the scope implementation so that it does + not free scope memory when + it is popped but just tracks it in a C runtime stack, eventually + freeing it when the stack is freed. This change + caused the allocation of only 12 scope structures instead of 20,000 for + the extreme example case. + + This change means that scope users must be carefule (as ever in C) to + initializae their scope elements + correctly as: + + 1) If not you may inherit values from a prior use of the scope + structure; + 2) SCope structure are now allocated with malloc and not calloc; + + Also, when using a custom free function to clean a scope when it is + popped, it is probably a good idea + to set any free'd pointers to NULL (this is generally good C programmig + practice in any case) + +Change 5566 on 2009/01/29 by ji...@ji...tlr3 + + Remove redundant BACKTRACK checking so that MSVC9 does not get confused + about possibly uninitialized variables + +Change 5565 on 2009/01/28 by ji...@ji...tlr3 + + Use malloc rather than calloc to allocate memory for new scopes. Note + that this means users will have to be careful to initialize any values in their + scopes that they expect to be 0 or NULL and I must document this. + +Change 5564 on 2009/01/28 by ji...@ji...tlr3 + + Use malloc rather than calloc for copying list lable tokens for + rewrites. + +Change 5561 on 2009/01/28 by ji...@ji...tlr3 + + Prevent warnigsn about retval.stop not being initialized when a rule + returns eraly because it is in backtracking mode + +Change 5560 on 2009/01/28 by ji...@ji...tlr3 + + Add a NULL check before freeing rewrite streams used in AST rewrites + rather than auto-rewrites. + + While the NULL check is redundant as the free cannot be called unless + it is assigned, Visual Studio C 2008 + gets it wrong and thinks that there is a PATH than can arrive at the + free wihtout it being assigned and that is too annoying to ignore. + +Change 5559 on 2009/01/28 by ji...@ji...tlr3 + + C target Tree rewrite optimization + + There is only one optimization in this change, but it is a huge one. + + The code generation templates were set up so that at the start of a rule, + any rewrite streams mentioned in the rule wer pre-created. However, this + is a massive overhead for rules where only one or two of the streams are + actually used, as we create them then free them without ever using them. + This was copied from the Java templates basically. + This caused literally millions of extra calls and vector allocations + in the case of the GNU C parser given to me for testing with a 20,000 + line program. + + After this change, the following comparison is avaiable against the gcc + compiler: + + Before (different machines here so use the relative difference for + comparison): + + gcc: + + real 0m0.425s + user 0m0.384s + sys 0m0.036s + + ANTLR C + real 0m1.958s + user 0m1.284s + sys 0m0.656s + + After the previous optimizations for vector pooling via a factory, + plus this huge win in removing redundant code, we have the following + (different machine to the one above): + + gcc: + 0.21user 0.01system 0:00.23elapsed 99%CPU (0avgtext+0avgdata 0maxresident)k + 0inputs+328outputs (0major+9922minor)pagefaults 0swaps + + ANTLR C: + + 0.37user 0.26system 0:00.64elapsed 99%CPU (0avgtext+0avgdata 0maxresident)k + 0inputs+0outputs (0major+130944minor)pagefaults 0swaps + + The extra system time coming from the fact that although the tree + rewriting is now optimal in terms of not allocating things it does + not need, there is still a lot more overhead in a parser that is generated + for generic use, including much more use of structures for tokens and extra + copying and so on. I will + continue to work on improviing things where I can, but the next big + improvement will come from Ter's optimization of the actual code structures we + generate including not doing things with rewrite streams that we do not need to + do at all. + + The second machine I used is about twice as fast CPU wise as the system + that was used originally by the user that asked about this performance. + +Change 5558 on 2009/01/28 by ji...@ji...tlr3 + + Lots of optimizations (though the next one to be checked in is the huge + win) for AST building and vector factories. + + A large part of tree rewriting was the creation of vectors to hold AST + nodes. Although I had created a vector factory, for some reason I never got + around to creating a proper one, that pre-allocated the vectors in chunks and + so on. I guess I just forgot to. Hence a big win here is prevention of calling + malloc lots and lots of times to create vectors. + + A second inprovement was to change teh vector definition such that it + holds a certain number of elements wihtin the vector structure itself, rather + than malloc and freeing these. Currently this is set to 8, but may increase. + For AST construction, this is generally a big win because AST nodes don't often + have many individual children unless there has not been any shaping going on in + the parser. But if you are not shaping, then you don't really need a tree. + + Other perforamnce inprovements here include not calling functions + indirectly within token stream and common token stream. Hence tokens are + claimed directly from the vectors. Users can override these funcitons of course + and all this means is that if you override tokenstreams then you pretty much + have to provide all the mehtods, but then I think you woudl have to anyway (and + I don't know of anyone that has wanted to do this as you can carry your own + structure around with the tokens anyway and that is much easier). + +Change 5554 on 2009/01/26 by ji...@ji...tlr3 + + Fixed: ANTLR-379 + For some reason in the past, the ruleMemozation() template had required + that the name parameter be set to the rule name. This does not seem to be a + requirement any more. The name=xxx override when invoking the template was + causing all the scope names derived when cleaning up in memoization to be + called after the rule name, which was not correct. Howver, this only affected + the output when in output=AST mode. + + This template invocation is now corrected. + +Change 5553 on 2009/01/26 by ji...@ji...tlr3 + + Fixed: ANTLR-330 + Managed to get the one rule that could not see the ASTLabelType to call + back in to the super template C.stg and ask it to construct hte name. I am not + 100% sure that this fixes all cases, but I cannot find any that fail. PLease + let me know if you find any exampoles of being unable to default the + ASTLabelType option in the C target. + +Change 5552 on 2009/01/25 by ji...@ji...tlr3 + + Progress: ANTLR-327 + Fix debug code generation templates when output=AST such that code + can at least be generated and I can debug the output code correctly. + Note that this checkin does not implement the debugging requirements + for tree generating parsers. + +Change 5551 on 2009/01/25 by ji...@ji...tlr3 + + Fixed: ANTLR-287 + Most of the source files did not include the BSD license. THis might + not be that big a deal given that I don't care what people do with it + other than take my name off it, but having the license reproduced + everywhere at least makes things perfectly clear. Hence this mass change of + sources and templates to include the license. + +Change 5549 on 2009/01/25 by ji...@ji...tlr3 + + Fixed: ANTLR-354 + Using 0.0D as the default initialize value for a double caused + VS 2003 C compiler to bomb out. There seesm to be no reason other + than force of habit to set this to 0.0D so I have dropped the D so + that older compilers do not complain. + +Change 5547 on 2009/01/25 by ji...@ji...tlr3 + + Fixed: ANTLR-282 + All references are now unadorned with any type of NULL check for the + following reasons: + + 1) A NULL reference means that there is a problem with the + grammar and we need the program to fail immediately so + that the programmer can work out where the problem occured; + 2) Most of the time, the only sensible value that can be + returned is NULL or 0 which + obviates the NULL check in the first place; + 3) If we replace a NULL reference with some value such as 0, + then the program may blithely continue but just do something + logically wrong, which will be very difficult for the + grammar programmer to detect and correct. + +Change 5545 on 2009/01/24 by ji...@ji...tlr3 + + Fixed: ANTLR-357 + The bug report was correct in that the types of references to things + like $start were being incorrectly cast as they wer not changed from + Java style casts (and the casts are unneccessary). this is now fixed + and references are referencing the correct, uncast, types. + However, the bug report was wrong in that the reference in the bok to + $start.pos will only work for Java and really, it is incorrect in the + book because it shoudl not access the .pos member directly but shudl + be using $start.getCharPositionInLine(). + Because there is no access qualification in C, one could use + $start.charPosition, however + really this should be $start->getCharPositionInLine($start); + +Change 5541 on 2009/01/24 by ji...@ji...tlr3 + + Fixed - ANTLR-367 + The code generation for the free method of a recognizer was not + distinguishing tree parsers from parsers when it came to calling delegate free + functions. + This is now corrected. + +Change 5540 on 2009/01/24 by ji...@ji...tlr3 + + Fixed ANTLR-355 + Ensure that we do not attempt to free any memory that we did not + actually allocate because the parser rule was being executed in + backtracking mode. + +Change 5539 on 2009/01/24 by ji...@ji...tlr3 + + Fixed: ANTLR-355 + When a C targetted parser is producing in backtracking mode, then the + creation of new stream rewrite structures shoudl not happen if the rule is + currently backtracking + +Change 5502 on 2008/12/11 by ji...@ji...tlr3 + + Fixed: ANTLR-349 Ensure that all marker labels in the lexer are 64 bit + compatible + +Change 5473 on 2008/12/01 by ji...@ji...tlr3 + + Fixed: ANTLR-350 - C runtime use of memcpy + Prior change to use memcpy instead of memmove in all cases missed the + fact that the string factory can be in a situation where overlaps occur. We now + have ANTLR3_MEMCPY and ANTLR3_MEMMOVE and use the two appropriately. + +Change 5387 on 2008/11/05 by parrt@parrt.spork + + Fixed x+=. issue with tree grammars; added unit test + +Change 5325 on 2008/10/23 by parrt@parrt.spork + + We were all ref'ing backtracking==0 hardcoded instead checking the + @synpredgate action. + + Added: branches/tora-trotl/src/libantlr3c-3.3/Makefile.am =================================================================== --- branches/tora-trotl/src/libantlr3c-3.3/Makefile.am (rev 0) +++ branches/tora-trotl/src/libantlr3c-3.3/Makefile.am 2011-05-14 11:12:04 UTC (rev 3962) @@ -0,0 +1,81 @@ +AUTOMAKE_OPTIONS = gnu +AM_LIBTOOLFLAGS = +## --silent +ACLOCAL_AMFLAGS = -I m4 +lib_LTLIBRARIES = libantlr3c.la + +LIBSOURCES = src/antlr3baserecognizer.c \ + src/antlr3basetree.c \ + src/antlr3basetreeadaptor.c \ + src/antlr3bitset.c \ + src/antlr3collections.c \ + src/antlr3commontoken.c \ + src/antlr3commontree.c \ + src/antlr3commontreeadaptor.c \ + src/antlr3commontreenodestream.c \ + src/antlr3convertutf.c \ + src/antlr3cyclicdfa.c \ + src/antlr3debughandlers.c \ + src/antlr3encodings.c \ + src/antlr3exception.c \ + src/antlr3filestream.c \ + src/antlr3inputstream.c \ + src/antlr3intstream.c \ + src/antlr3lexer.c \ + src/antlr3parser.c \ + src/antlr3rewritestreams.c \ + src/antlr3string.c \ + src/antlr3stringstream.c \ + src/antlr3tokenstream.c \ + src/antlr3treeparser.c \ + src/antlr3ucs2inputstream.c + +libantlr3c_la_SOURCES = $(LIBSOURCES) + +include_HEADERS = include/antlr3.h \ + include/antlr3baserecognizer.h \ + include/antlr3basetree.h \ + include/antlr3basetreeadaptor.h \ + include/antlr3bitset.h \ + include/antlr3collections.h \ + include/antlr3commontoken.h \ + include/antlr3commontree.h \ + include/antlr3commontreeadaptor.h \ + include/antlr3commontreenodestream.h \ + include/antlr3convertutf.h \ + include/antlr3cyclicdfa.h \ + include/antlr3debugeventlistener.h \ + include/antlr3defs.h \ + include/antlr3encodings.h \ + include/antlr3errors.h \ + include/antlr3exception.h \ + include/antlr3filestream.h \ + include/antlr3input.h \ + include/antlr3interfaces.h \ + include/antlr3intstream.h \ + include/antlr3lexer.h \ + include/antlr3memory.h \ + include/antlr3parser.h \ + include/antlr3parsetree.h \ + include/antlr3recognizersharedstate.h \ + include/antlr3rewritestreams.h \ + include/antlr3string.h \ + include/antlr3stringstream.h \ + include/antlr3tokenstream.h \ + include/antlr3treeparser.h \ + antlr3config.h + +libantlr3c_la_LDFLAGS = -avoid-version + +INCLUDES = -Iinclude + +EXTRA_DIST = \ + vsrulefiles/antlr3lexerandparser.rules \ + vsrulefiles/antlr3lexer.rules \ + vsrulefiles/antlr3parser.rules \ + vsrulefiles/antlr3treeparser.rules \ + C.sln C.vcproj C.vcproj.vspscc \ + C.vssscc doxyfile doxygen + +export OBJECT_MODE + Added: branches/tora-trotl/src/libantlr3c-3.3/NEWS =================================================================== --- branches/tora-trotl/src/libantlr3c-3.3/NEWS (rev 0) +++ branches/tora-trotl/src/libantlr3c-3.3/NEWS 2011-05-14 11:12:04 UTC (rev 3962) @@ -0,0 +1,2 @@ +See www.antlr.org and the associated email forums for release dates and +other announcements. Added: branches/tora-trotl/src/libantlr3c-3.3/README =================================================================== --- branches/tora-trotl/src/libantlr3c-3.3/README (rev 0) +++ branches/tora-trotl/src/libantlr3c-3.3/README 2011-05-14 11:12:04 UTC (rev 3962) @@ -0,0 +1,1924 @@ +ANTLR v3.0.1 C Runtime +ANTLR 3.0.1 +January 1, 2008 + +At the moment, the use of the C runtime engine for the parser is not generally +for the inexperienced C programmer. However this is mainly because of the lack +of documentation on use, which will be corrected shortly. The C runtime +code itself is however well documented with doxygen style comments and a +reasonably experienced C programmer should be able to piece it together. You +can visit the documentation at: http://www.antlr.org/api/C/index.html + +The general make up is that everything is implemented as a pseudo class/object +initialized with pointers to its 'member' functions and data. All objects are +(usually) created by factories, which auto manage the memory allocation and +release and generally make life easier. If you remember this rule, everything +should fall in to place. + +Jim Idle - Portland Oregon, Jan 2008 +jimi idle ws + +=============================================================================== + +Terence Parr, parrt at cs usfca edu +ANTLR project lead and supreme dictator for life +University of San Francisco + +INTRODUCTION + +Welcome to ANTLR v3! I've been working on this for nearly 4 years and it's +almost ready! I plan no feature additions between this beta and first +3.0 release. I have lots of features to add later, but this will be +the first set. Ultimately, I need to rewrite ANTLR v3 in itself (it's +written in 2.7.7 at the moment and also needs StringTemplate 3.0 or +later). + +You should use v3 in conjunction with ANTLRWorks: + + http://www.antlr.org/works/index.html + +WARNING: We have bits of documentation started, but nothing super-complete +yet. The book will be printed May 2007: + +http://www.pragmaticprogrammer.com/titles/tpantlr/index.html + +but we should have a beta PDF available on that page in Feb 2007. + +You also have the examples plus the source to guide you. + +See the new wiki FAQ: + + http://www.antlr.org/wiki/display/ANTLR3/ANTLR+v3+FAQ + +and general doc root: + + http://www.antlr.org/wiki/display/ANTLR3/ANTLR+3+Wiki+Home + +Please help add/update FAQ entries. + +I have made very little effort at this point to deal well with +erroneous input (e.g., bad syntax might make ANTLR crash). I will clean +this up after I've rewritten v3 in v3. + +Per the license in LICENSE.txt, this software is not guaranteed to +work and might even destroy all life on this planet: + +THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR +IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, +INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, +STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING +IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +POSSIBILITY OF SUCH DAMAGE. + +EXAMPLES + +ANTLR v3 sample grammars: + + http://www.antlr.org/download/examples-v3.tar.gz + +contains the following examples: LL-star, cminus, dynamic-scope, +fuzzy, hoistedPredicates, island-grammar, java, python, scopes, +simplecTreeParser, treeparser, tweak, xmlLexer. + +Also check out Mantra Programming Language for a prototype (work in +progress) using v3: + + http://www.linguamantra.org/ + +---------------------------------------------------------------------- + +What is ANTLR? + +ANTLR stands for (AN)other (T)ool for (L)anguage (R)ecognition and was +originally known as PCCTS. ANTLR is a language tool that provides a +framework for constructing recognizers, compilers, and translators +from grammatical descriptions containing actions. Target language list: + +http://www.antlr.org/wiki/display/ANTLR3/Code+Generation+Targets + +---------------------------------------------------------------------- + +How is ANTLR v3 different than ANTLR v2? + +See migration guide: + http://www.antlr.org/wiki/display/ANTLR3/Migrating+from+ANTLR+2+to+ANTLR+3 + +ANTLR v3 has a far superior parsing algorithm called LL(*) that +handles many more grammars than v2 does. In practice, it means you +can throw almost any grammar at ANTLR that is non-left-recursive and +unambiguous (same input can be matched by multiple rules); the cost is +perhaps a tiny bit of backtracking, but with a DFA not a full parser. +You can manually set the max lookahead k as an option for any decision +though. The LL(*) algorithm ramps up to use more lookahead when it +needs to and is much more efficient than normal LL backtracking. There +is support for syntactic predicate (full LL backtracking) when LL(*) +fails. + +Lexers are much easier due to the LL(*) algorithm as well. Previously +these two lexer rules would cause trouble because ANTLR couldn't +distinguish between them with finite lookahead to see the decimal +point: + +INT : ('0'..'9')+ ; +FLOAT : INT '.' INT ; + +The syntax is almost identical for features in common, but you should +note that labels are always '=' not ':'. So do id=ID not id:ID. + +You can do combined lexer/parser grammars again (ala PCCTS) both lexer +and parser rules are defined in the same file. See the examples. +Really nice. You can reference strings and characters in the grammar +and ANTLR will generate the lexer for you. + +The attribute structure has been enhanced. Rules may have multiple +return values, for example. Further, there are dynamically scoped +attributes whereby a rule may define a value usable by any rule it +invokes directly or indirectly w/o having to pass a parameter all the +way down. + +ANTLR v3 tree construction is far superior--it provides tree rewrite +rules where the right hand side is simply the tree grammar fragment +describing the tree you want to build: + +formalArgs + : typename declarator (',' typename declarator )* + -> ^(ARG typename declarator)+ + ; + +That builds tree sequences like: + +^(ARG int v1) ^(ARG int v2) + +ANTLR v3 also incorporates StringTemplate: + + http://www.stringtemplate.org + +just like AST support. It is useful for generating output. For +example this rule creates a template called 'import' for each import +definition found in the input stream: + +grammar Java; +options { + output=template; +} +... +importDefinition + : 'import' identifierStar SEMI + -> import(name={$identifierStar.st}, + begin={$identifierStar.start}, + end={$identifierStar.stop}) + ; + +The attributes are set via assignments in the argument list. The +arguments are actions with arbitrary expressions in the target +language. The .st label property is the result template from a rule +reference. There is a nice shorthand in actions too: + + %foo(a={},b={},...) ctor + %({name-expr})(a={},...) indirect template ctor reference + %{string-expr} anonymous template from string expr + %{expr}.y = z; template attribute y of StringTemplate-typed expr to z + %x.y = z; set template attribute y of x (always set never get attr) + to z [languages like python without ';' must still use the + ';' which the code generator is free to remove during code gen] + Same as '(x).setAttribute("y", z);' + +For ANTLR v3 I decided to make the most common tasks easy by default +rather. This means that some of the basic objects are heavier weight +than some speed demons would like, but they are free to pare it down +leaving most programmers the luxury of having it "just work." For +example, to read in some input, tweak it, and write it back out +preserving whitespace, is easy in v3. + +The ANTLR source code is much prettier. You'll also note that the +run-time classes are conveniently encapsulated in the +org.antlr.runtime package. + +---------------------------------------------------------------------- + +How do I install this damn thing? + +Just untar and you'll get: + +antlr-3.0b6/README.txt (this file) +antlr-3.0b6/LICENSE.txt +antlr-3.0b6/src/org/antlr/... +antlr-3.0b6/lib/stringtemplate-3.0.jar (3.0b6 needs 3.0) +antlr-3.0b6/lib/antlr-2.7.7.jar +antlr-3.0b6/lib/antlr-3.0b6.jar + +Then you need to add all the jars in lib to your CLASSPATH. + +---------------------------------------------------------------------- + +How do I use ANTLR v3? + +[I am assuming you are only using the command-line (and not the +ANTLRWorks GUI)]. + +Running ANTLR with no parameters shows you: + +ANTLR Parser Generator Early Access Version 3.0b6 (Jan 31, 2007) 1989-2007 +usage: java org.antlr.Tool [args] file.g [file2.g file3.g ...] + -o outputDir specify output directory where all output is generated + -lib dir specify location of token files + -report print out a report about the grammar(s) processed + -print print out the grammar without actions + -debug generate a parser that emits debugging events + -profile generate a parser that computes profiling information + -nfa generate an NFA for each rule + -dfa generate a DFA for each decision point + -message-format name specify output style for messages + -X display extended argument list + +For example, consider how to make the LL-star example from the examples +tarball you can get at http://www.antlr.org/download/examples-v3.tar.gz + +$ cd examples/java/LL-star +$ java org.antlr.Tool simplec.g +$ jikes *.java + +For input: + +char c; +int x; +void bar(int x); +int foo(int y, char d) { + int i; + for (i=0; i<3; i=i+1) { + x=3; + y=5; + } +} + +you will see output as follows: + +$ java Main input +bar is a declaration +foo is a definition + +What if I want to test my parser without generating code? Easy. Just +run ANTLR in interpreter mode. It can't execute your actions, but it +can create a parse tree from your input to show you how it would be +matched. Use the org.antlr.tool.Interp main class. In the following, +I interpret simplec.g on t.c, which contains "int x;" + +$ java org.antlr.tool.Interp simplec.g WS program t.c +( <grammar SimpleC> + ( program + ( declaration + ( variable + ( type [@0,0:2='int',<14>,1:0] ) + ( declarator [@2,4:4='x',<2>,1:4] ) + [@3,5:5=';',<5>,1:5] + ) + ) + ) +) + +where I have formatted the output to make it more readable. I have +told it to ignore all WS tokens. + +---------------------------------------------------------------------- + +How do I rebuild ANTLR v3? + +Make sure the following two jars are in your CLASSPATH + +antlr-3.0b6/lib/stringtemplate-3.0.jar +antlr-3.0b6/lib/antlr-2.7.7.jar +junit.jar [if you want to build the test directories] + +then jump into antlr-3.0b6/src directory and then type: + +$ javac -d . org/antlr/Tool.java org/antlr/*/*.java org/antlr/*/*/*.java + +Takes 9 seconds on my 1Ghz laptop or 4 seconds with jikes. Later I'll +have a real build mechanism, though I must admit the one-liner appeals +to me. I use Intellij so I never type anything actually to build. + +There is also an ANT build.xml file, but I know nothing of ANT; contributed +by others (I'm opposed to any tool with an XML interface for Humans). + +----------------------------------------------------------------------- +C# Target Notes + +1. Auto-generated lexers do not inherit parent parser's @namespace + {...} value. Use @lexer::namespace{...}. + +----------------------------------------------------------------------- + +CHANGES + +March 17, 2007 + +* Jonathan DeKlotz updated C# templates to be 3.0b6 current + +March 14, 2007 + +* Manually-specified (...)=> force backtracking eval of that predicate. + backtracking=true mode does not however. Added unit test. + +March 14, 2007 + +* Fixed bug in lexer where ~T didn't compute the set from rule T. + +* Added -Xnoinlinedfa make all DFA with tables; no inline prediction with IFs + +* Fixed http://www.antlr.org:8888/browse/ANTLR-80. + Sem pred states didn't define lookahead vars. + +* Fixed http://www.antlr.org:8888/browse/ANTLR-91. + When forcing some acyclic DFA to be state tables, they broke. + Forcing all DFA to be state tables should give same results. + +March 12, 2007 + +* setTokenSource in CommonTokenStream didn't clear tokens list. + setCharStream calls reset in Lexer. + +* Altered -depend. No longer printing grammar files for multiple input + files with -depend. Doesn't show T__.g temp file anymore. Added + TLexer.tokens. Added .h files if defined. + +February 11, 2007 + +* Added -depend command-line option that, instead of processing files, + it shows you what files the input grammar(s) depend on and what files + they generate. For combined grammar T.g: + + $ java org.antlr.Tool -depend T.g + + You get: + + TParser.java : T.g + T.tokens : T.g + T__.g : T.g + + Now, assuming U.g is a tree grammar ref'd T's tokens: + + $ java org.antlr.Tool -depend T.g U.g + + TParser.java : T.g + T.tokens : T.g + T__.g : T.g + U.g: T.tokens + U.java : U.g + U.tokens : U.g + + Handles spaces by escaping them. Pays attention to -o, -fo and -lib. + Dir 'x y' is a valid dir in current dir. + + $ java org.antlr.Tool -depend -lib /usr/local/lib -o 'x y' T.g U.g + x\ y/TParser.java : T.g + x\ y/T.tokens : T.g + x\ y/T__.g : T.g + U.g: /usr/local/lib/T.tokens + x\ y/U.java : U.g + x\ y/U.tokens : U.g + + You have API access via org.antlr.tool.BuildDependencyGenerator class: + getGeneratedFileList(), getDependenciesFileList(). You can also access + the output template: getDependencies(). The file + org/antlr/tool/templates/depend.stg contains the template. You can + modify as you want. File objects go in so you can play with path etc... + +February 10, 2007 + +* no more .gl files generated. All .g all the time. + +* changed @finally to be @after and added a finally clause to the + exception stuff. I also removed the superfluous "exception" + keyword. Here's what the new syntax looks like: + + a + @after { System.out.println("ick"); } + : 'a' + ; + catch[RecognitionException e] { System.out.println("foo"); } + catch[IOException e] { System.out.println("io"); } + finally { System.out.println("foobar"); } + + @after executes after bookkeeping to set $rule.stop, $rule.tree but + before scopes pop and any memoization happens. Dynamic scopes and + memoization are still in generated finally block because they must + exec even if error in rule. The @after action and tree setting + stuff can technically be skipped upon syntax error in rule. [Later + we might add something to finally to stick an ERROR token in the + tree and set the return value.] Sequence goes: set $stop, $tree (if + any), @after (if any), pop scopes (if any), memoize (if needed), + grammar finally clause. Last 3 are in generated code's finally + clause. + +3.0b6 - January 31, 2007 + +January 30, 2007 + +* Fixed bug in IntervalSet.and: it returned the same empty set all the time + rather than new empty set. Code altered the same empty set. + +* Made analysis terminate faster upon a decision that takes too long; + it seemed to keep doing work for a while. Refactored some names + and updated comments. Also made it terminate when it realizes it's + non-LL(*) due to recursion. just added terminate conditions to loop + in convert(). + +* Sometimes fatal non-LL(*) messages didn't appear; instead you got + "antlr couldn't analyze", which is actually untrue. I had the + order of some prints wrong in the DecisionProbe. + +* The code generator incorrectly detected when it could use a fixed, + acyclic inline DFA (i.e., using an IF). Upon non-LL(*) decisions + with predicates, analysis made cyclic DFA. But this stops + the computation detecting whether they are cyclic. I just added + a protection in front of the acyclic DFA generator to avoid if + non-LL(*). Updated comments. + +January 23, 2007 + +* Made tree node streams use adaptor to create navigation nodes. + Thanks to Emond Papegaaij. + +January 22, 2007 + +* Added lexer rule properties: start, stop + +January 1, 2007 + +* analysis failsafe is back on; if a decision takes too long, it bails out + and uses k=1 + +January 1, 2007 + +* += labels for rules only work for output option; previously elements + of list were the return value structs, but are now either the tree or + StringTemplate return value. You can label different rules now + x+=a x+=b. + +December 30, 2006 + +* Allow \" to work correctly in "..." template. + +December 28, 2006 + +* errors that are now warnings: missing AST label type in trees. + Also "no start rule detected" is warning. + +* tree grammars also can do rewrite=true for output=template. + Only works for alts with single node or tree as alt elements. + If you are going to use $text in a tree grammar or do rewrite=true + for templates, you must use in your main: + + nodes.setTokenStream(tokens); + +* You get a warning for tree grammars that do rewrite=true and + output=template and have -> for alts that are not simple nodes + or simple trees. new unit tests in TestRewriteTemplates at end. + +December 27, 2006 + +* Error message appears when you use -> in tree grammar with + output=template and rewrite=true for alt that is not simple + node or tree ref. + +* no more $stop attribute for tree parsers; meaningless/useless. + Removed from TreeRuleReturnScope also. + +* rule text attribute in tree parser must pull from token buffer. + Makes no sense otherwise. added getTokenStream to TreeNodeStream + so rule $text attr works. CommonTreeNodeStream etc... now let + you set the token stream so you can access later from tree parser. + $text is not well-defined for rules like + + slist : stat+ ; + + because stat is not a single node nor rooted with a single node. + $slist.text will get only first stat. I need to add a warning about + this... + +* Fixed http://www.antlr.org:8888/browse/ANTLR-76 for Java. + Enhanced TokenRewriteStream so it accepts any object; converts + to string at last second. Allows you to rewrite with StringTemplate + templates now :) + +* added rewrite option that makes -> template rewrites do replace ops for + TokenRewriteStream input stream. In output=template and rewrite=true mode + same as before 'cept that the parser does + + ((TokenRewriteStream)input).replace( + ((Token)retval.start).getTokenIndex(), + input.LT(-1).getTokenIndex(), + retval.st); + + after each rewrite so that the input stream is altered. Later refs to + $text will have rewrites. Here's a sample test program for grammar Rew. + + FileReader groupFileR = new FileReader("Rew.stg"); + StringTemplateGroup templates = new StringTemplateGroup(groupFileR); + ANTLRInputStream input = new ANTLRInputStream(System.in); + RewLexer lexer = new RewLexer(input); + TokenRewriteStream tokens = new TokenRewriteStream(lexer); + RewParser parser = new RewParser(tokens); + parser.setTemplateLib(templates); + parser.program(); + System.out.println(tokens.toString()); + groupFileR.close(); + +December 26, 2006 + +* BaseTree.dupTree didn't dup recursively. + +December 24, 2006 + +* Cleaned up some comments and removed field treeNode + from MismatchedTreeNodeException class. It is "node" in + RecognitionException. + +* Changed type from Object to BitSet for expecting fields in + MismatchedSetException and MismatchedNotSetException + +* Cleaned up error printing in lexers and the messages that it creates. + +* Added this to TreeAdaptor: + /** Return the token object from which this node was created. + * Currently used only for printing an error message. + * The error display routine in BaseRecognizer needs to + * display where the input the error occurred. If your + * tree of limitation does not store information that can + * lead you to the token, you can create a token filled with + * the appropriate information and pass that back. See + * BaseRecognizer.getErrorMessage(). + */ + public Token getToken(Object t); + +December 23, 2006 + +* made BaseRecognizer.displayRecognitionError nonstatic so people can + override it. Not sure why it was static before. + +* Removed state/decision message that comes out of no + viable alternative exceptions, as that was too much. + removed the decision number from the early exit exception + also. During development, you can simply override + displayRecognitionError from BaseRecognizer to add the stuff + back in if you want. + +* made output go to an output method you can override: emitErrorMessage() + +* general cleanup of the error emitting code in BaseRecognizer. Lots + more stuff you can override: getErrorHeader, getTokenErrorDisplay, + emitErrorMessage, getErrorMessage. + +December 22, ... [truncated message content] |
From: <ibr...@us...> - 2011-06-24 22:55:14
|
Revision: 3986 http://tora.svn.sourceforge.net/tora/?rev=3986&view=rev Author: ibre5041 Date: 2011-06-24 22:55:08 +0000 (Fri, 24 Jun 2011) Log Message: ----------- better layout Modified Paths: -------------- branches/tora-trotl/src/trotl_test3.cpp branches/tora-trotl/src/trotl_test3.h Modified: branches/tora-trotl/src/trotl_test3.cpp =================================================================== --- branches/tora-trotl/src/trotl_test3.cpp 2011-06-24 16:11:44 UTC (rev 3985) +++ branches/tora-trotl/src/trotl_test3.cpp 2011-06-24 22:55:08 UTC (rev 3986) @@ -58,6 +58,8 @@ #include "toeventquerytask.h" #include "tosql.h" +#include <QStatusBar> + bool toMonolithic(void) { #ifdef TOMONOLITHIC @@ -72,50 +74,28 @@ TrotlTest3Window::TrotlTest3Window(QString user, QString password, QString connect, std::set<QString>& options): toMainWindow() { toThread::setMainThread(QThread::currentThread()); - { - QGridLayout *gridLayout; QSplitter *splitter; - QScrollArea *scrollArea; - QWidget *scrollAreaWidgetContents; - QGridLayout *gridLayout_3; - //QCalendarWidget *calendarWidget; - QScrollArea *scrollArea_2; - QWidget *scrollAreaWidgetContents_2; - QGridLayout *gridLayout_2; - QTabWidget *tabWidget; - QWidget *tab; - QWidget *tab_2; - - //gridLayout = new QGridLayout(this); + QStatusBar *statusbar; + splitter = new QSplitter(this); splitter->setOrientation(Qt::Horizontal); - this->Workspace = new QMdiArea(this); - //this->Workspace->setWidgetResizable(true); - Workspace->setViewMode(QMdiArea::TabbedView); - //setCentralWidget(Workspace); - setCentralWidget(splitter); - + this->Workspace = new QMdiArea(splitter); + this->Workspace->setViewMode(QMdiArea::TabbedView); splitter->addWidget(this->Workspace); - - scrollArea_2 = new QScrollArea(splitter); - scrollArea_2->setWidgetResizable(true); - - //DocumentWidget *pdf = new DocumentWidget(scrollArea_2); - PDFViewWidget *pdf = new PDFViewWidget(scrollArea_2); - //pdf->setDocument("/home/ivan/Documents/PDFs/11gr2_sql_reference_e17118.pdf"); + + PDFViewWidget *pdf = new PDFViewWidget(splitter); pdf->openFile("/home/ivan/Documents/PDFs/11gr2_sql_reference_e17118.pdf"); - pdf->setPage(4); + pdf->setPage(4); + splitter->addWidget(pdf); - splitter->addWidget(scrollArea_2); + this->setCentralWidget(splitter); + statusbar = new QStatusBar(this); + this->setStatusBar(statusbar); } - //this->Workspace = new QMdiArea(this); - //Workspace->setViewMode(QMdiArea::TabbedView); - //setCentralWidget(Workspace); - show(); oraCon = new toConnection( QString("Oracle"), @@ -142,9 +122,6 @@ } } - //Poppler::Document *doc = Poppler::Document::load("D:\\11gr2_sql_reference_e17118.pdf"); - //std::cout << "doc: " << doc << std::endl; - //std::cout << "Num pages: " << doc->numPages() << std::endl; } int main(int argc, char **argv) Modified: branches/tora-trotl/src/trotl_test3.h =================================================================== --- branches/tora-trotl/src/trotl_test3.h 2011-06-24 16:11:44 UTC (rev 3985) +++ branches/tora-trotl/src/trotl_test3.h 2011-06-24 22:55:08 UTC (rev 3986) @@ -26,7 +26,7 @@ toBackgroundLabel* getBackgroundLabel() { return NULL; }; std::list<QString> connections(void) { return std::list<QString>(); }; - toConnection& connection(const QString &) { return *Connections.front(); } + toConnection& connection(const QString &) { return *Connections.front(); } void updateWindowsMenu() {}; toConnection& currentConnection(void) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ibr...@us...> - 2011-06-25 02:09:15
|
Revision: 3987 http://tora.svn.sourceforge.net/tora/?rev=3987&view=rev Author: ibre5041 Date: 2011-06-25 02:09:07 +0000 (Sat, 25 Jun 2011) Log Message: ----------- a case study is nearly usable Modified Paths: -------------- branches/tora-trotl/src/CMakeLists.txt branches/tora-trotl/src/parsing/error_handler.c branches/tora-trotl/src/parsing/error_handler.h branches/tora-trotl/src/parsing/tsqlparse.h branches/tora-trotl/src/parsing/tsqlparse.tcc branches/tora-trotl/src/parsing/tsqlparseoracle.cpp branches/tora-trotl/src/toworksheet.cpp branches/tora-trotl/src/trotl_test3.cpp Added Paths: ----------- branches/tora-trotl/src/parsing/tplsqlparseoracle.cpp branches/tora-trotl/src/parsing/tsqllexer.h branches/tora-trotl/src/parsing/tsqllexeroracle.cpp branches/tora-trotl/src/parsing/tsqlparseoracle.o Modified: branches/tora-trotl/src/CMakeLists.txt =================================================================== --- branches/tora-trotl/src/CMakeLists.txt 2011-06-24 22:55:08 UTC (rev 3986) +++ branches/tora-trotl/src/CMakeLists.txt 2011-06-25 02:09:07 UTC (rev 3987) @@ -595,9 +595,13 @@ LIST(APPEND TORA_LIBS "libantlr3c") LIST(APPEND TORA_SOURCES "parsing/tsqlparseoracle.cpp" + "parsing/tplsqlparseoracle.cpp" + "parsing/tsqllexeroracle.cpp" "parsing/error_handler.c" "parsing/OracleSQLLexer.c" "parsing/OracleSQLParser.c" + "parsing/OraclePLSQLLexer.c" + "parsing/OraclePLSQLParser.c" ) INCLUDE_DIRECTORIES( "${CMAKE_CURRENT_SOURCE_DIR}/libantlr3c-3.3/include" Modified: branches/tora-trotl/src/parsing/error_handler.c =================================================================== --- branches/tora-trotl/src/parsing/error_handler.c 2011-06-24 22:55:08 UTC (rev 3986) +++ branches/tora-trotl/src/parsing/error_handler.c 2011-06-25 02:09:07 UTC (rev 3987) @@ -6,3 +6,191 @@ void myDisplayRecognitionParserError (pANTLR3_BASE_RECOGNIZER recognizer, pANTLR3_UINT8 * tokenNames) {}; +void * myRecoverFromMismatchedToken (pANTLR3_BASE_RECOGNIZER recognizer, ANTLR3_UINT32 ttype, pANTLR3_BITSET_LIST follow); + +void * myGetMissingSymbol (pANTLR3_BASE_RECOGNIZER recognizer, pANTLR3_INT_STREAM istream, pANTLR3_EXCEPTION e, + ANTLR3_UINT32 expectedTokenType, pANTLR3_BITSET_LIST follow); + +void * myRecoverFromMismatchedToken (pANTLR3_BASE_RECOGNIZER recognizer, ANTLR3_UINT32 ttype, pANTLR3_BITSET_LIST follow) +{ + pANTLR3_PARSER parser; + pANTLR3_TREE_PARSER tparser; + pANTLR3_INT_STREAM is; + void * matchedSymbol; + + switch (recognizer->type) + { + case ANTLR3_TYPE_PARSER: + + parser = (pANTLR3_PARSER) (recognizer->super); + tparser = NULL; + is = parser->tstream->istream; + + break; + + case ANTLR3_TYPE_TREE_PARSER: + + tparser = (pANTLR3_TREE_PARSER) (recognizer->super); + parser = NULL; + is = tparser->ctnstream->tnstream->istream; + + break; + + default: + + ANTLR3_FPRINTF(stderr, "Base recognizer function recoverFromMismatchedToken called by unknown parser type - provide override for this function\n"); + return NULL; + + break; + } + + // Create an exception if we need one + // + if (recognizer->state->exception == NULL) + { + antlr3RecognitionExceptionNew(recognizer); + } + + // If the next token after the one we are looking at in the input stream + // is what we are looking for then we remove the one we have discovered + // from the stream by consuming it, then consume this next one along too as + // if nothing had happened. + // + if ( recognizer->mismatchIsUnwantedToken(recognizer, is, ttype) == ANTLR3_TRUE) + { + recognizer->state->exception->type = ANTLR3_UNWANTED_TOKEN_EXCEPTION; + recognizer->state->exception->message = ANTLR3_UNWANTED_TOKEN_EXCEPTION_NAME; + + // Call resync hook (for debuggers and so on) + // + if (recognizer->debugger != NULL) + { + recognizer->debugger->beginResync(recognizer->debugger); + } + + // "delete" the extra token + // + recognizer->beginResync(recognizer); + is->consume(is); + recognizer->endResync(recognizer); + // End resync hook + // + if (recognizer->debugger != NULL) + { + recognizer->debugger->endResync(recognizer->debugger); + } + + // Print out the error after we consume so that ANTLRWorks sees the + // token in the exception. + // + recognizer->reportError(recognizer); + + // Return the token we are actually matching + // + matchedSymbol = recognizer->getCurrentInputSymbol(recognizer, is); + + // Consume the token that the rule actually expected to get as if everything + // was hunky dory. + // + is->consume(is); + + recognizer->state->error = ANTLR3_FALSE; // Exception is not outstanding any more + + return matchedSymbol; + } + + // Single token deletion (Unwanted above) did not work + // so we see if we can insert a token instead by calculating which + // token would be missing + // + if (recognizer->mismatchIsMissingToken(recognizer, is, follow)) + { + // We can fake the missing token and proceed + // + matchedSymbol = myGetMissingSymbol(recognizer, is, recognizer->state->exception, ttype, follow); + //matchedSymbol = recognizer->getMissingSymbol(recognizer, is, recognizer->state->exception, ttype, follow); + recognizer->state->exception->type = ANTLR3_MISSING_TOKEN_EXCEPTION; + recognizer->state->exception->message = ANTLR3_MISSING_TOKEN_EXCEPTION_NAME; + recognizer->state->exception->token = matchedSymbol; + recognizer->state->exception->expecting = ttype; + + // Print out the error after we insert so that ANTLRWorks sees the + // token in the exception. + // + recognizer->reportError(recognizer); + + recognizer->state->error = ANTLR3_FALSE; // Exception is not outstanding any more + + return matchedSymbol; + } + + recognizer->state->error = ANTLR3_TRUE; + return NULL; +}; + + +void * myGetMissingSymbol (pANTLR3_BASE_RECOGNIZER recognizer, pANTLR3_INT_STREAM istream, pANTLR3_EXCEPTION e, + ANTLR3_UINT32 expectedTokenType, pANTLR3_BITSET_LIST follow) +{ + pANTLR3_TOKEN_STREAM ts; + pANTLR3_COMMON_TOKEN_STREAM cts; + pANTLR3_COMMON_TOKEN token; + pANTLR3_COMMON_TOKEN current; + pANTLR3_STRING text; + + // Dereference the standard pointers + // + ts = (pANTLR3_TOKEN_STREAM)istream->super; + cts = (pANTLR3_COMMON_TOKEN_STREAM)ts->super; + + // Work out what to use as the current symbol to make a line and offset etc + // If we are at EOF, we use the token before EOF + // + current = ts->_LT(ts, 1); + if (current->getType(current) == ANTLR3_TOKEN_EOF) + { + current = ts->_LT(ts, -1); + } + + // Create a new empty token + // + if (recognizer->state->tokFactory == NULL) + { + // We don't yet have a token factory for making tokens + // we just need a fake one using the input stream of the current + // token. + // + recognizer->state->tokFactory = antlr3TokenFactoryNew(current->input); + } + token = recognizer->state->tokFactory->newToken(recognizer->state->tokFactory); + + // Set some of the token properties based on the current token + // + token->setLine (token, current->getLine(current)); + token->setCharPositionInLine (token, current->getCharPositionInLine(current)); + token->setChannel (token, ANTLR3_TOKEN_DEFAULT_CHANNEL); + token->setType (token, expectedTokenType); + token->user1 = current->user1; + token->user2 = current->user2; + token->user3 = current->user3; + token->custom = current->custom; + token->lineStart = current->lineStart; + + // Create the token text that shows it has been inserted + // + token->setText8(token, (pANTLR3_UINT8)"<missing "); + text = token->getText(token); + + if (text != NULL) + { + text->append8(text, + expectedTokenType == EOF ? (const char *)"EOF" : + (const char *)recognizer->state->tokenNames[expectedTokenType] + ); + text->append8(text, (const char *)">"); + } + + // Finally return the pointer to our new token + // + return token; +}; Modified: branches/tora-trotl/src/parsing/error_handler.h =================================================================== --- branches/tora-trotl/src/parsing/error_handler.h 2011-06-24 22:55:08 UTC (rev 3986) +++ branches/tora-trotl/src/parsing/error_handler.h 2011-06-25 02:09:07 UTC (rev 3987) @@ -9,7 +9,9 @@ void myDisplayRecognitionLexerError (pANTLR3_BASE_RECOGNIZER recognizer, pANTLR3_UINT8 * tokenNames); void myDisplayRecognitionParserError (pANTLR3_BASE_RECOGNIZER recognizer, pANTLR3_UINT8 * tokenNames); - + void * myGetMissingSymbol (pANTLR3_BASE_RECOGNIZER recognizer, pANTLR3_INT_STREAM istream, pANTLR3_EXCEPTION e, + ANTLR3_UINT32 expectedTokenType, pANTLR3_BITSET_LIST follow); + void * myRecoverFromMismatchedToken (pANTLR3_BASE_RECOGNIZER recognizer, ANTLR3_UINT32 ttype, pANTLR3_BITSET_LIST follow); #ifdef __cplusplus } #endif Added: branches/tora-trotl/src/parsing/tplsqlparseoracle.cpp =================================================================== --- branches/tora-trotl/src/parsing/tplsqlparseoracle.cpp (rev 0) +++ branches/tora-trotl/src/parsing/tplsqlparseoracle.cpp 2011-06-25 02:09:07 UTC (rev 3987) @@ -0,0 +1,301 @@ + +// ANTLR runtime includes +#include "antlr3commontoken.h" +#include "antlr3string.h" +#include "antlr3input.h" +#include "antlr3lexer.h" + +#include "OraclePLSQLLexer.h" +#include "OraclePLSQLParser.h" + +#include "tsqlparse.h" + +namespace SQLParser +{ + class OraclePLSQLToken: public Token + { + public: + OraclePLSQLToken (Token *parent, const Position &pos, const QString &str, unsigned tokentype, unsigned usagetype = T_UNKNOWN) + : Token(parent, pos, str) + { + TokenType &token_type = const_cast<Token::TokenType&>(_mTokenType); + switch(tokentype) { + case T_UNKNOWN: + token_type = X_UNASSIGNED; + break; + case T_RESERVED: + token_type = L_RESERVED; + break; + case T_BINDVAR_NAME: + token_type = L_BINDVARNAME; + break; + case T_VARIABLE_NAME: + token_type = L_VARIABLE; + break; + case T_DATATYPE_NAME: + token_type = L_DATATYPE; + break; + case T_SCHEMA_NAME: + token_type = L_SCHEMANAME; + break; + case T_FUNCTION_NAME: + token_type = L_FUNCTIONNAME; + break; + case T_PACKAGE_NAME: + token_type = L_PACKAGENAME; + break; + case T_PARAMETER_NAME: + token_type = L_PARAMETER; + break; + } // switch(tokentype) + + UsageType &usage_type = const_cast<Token::UsageType&>(_mUsageType); + switch(usagetype) + { + case 0: + case T_UNKNOWN: + usage_type = Unknown; + break; + case T_USE: + usage_type = Usage; + break; + case T_USEL: + usage_type = UsageL; + break; + case T_DECL: + usage_type = Declaration; + break; + } + }; + }; // class OraclePLSQLToken: public Token + + class OraclePLSQLStatement: public Statement + { + public: + OraclePLSQLStatement(const QString &statement, const QString &name); + ~OraclePLSQLStatement() + {}; + virtual void print (QTextCursor&) const; + virtual void tree2Dot(std::ostream &o) const; + //template<class T> T& recursiveWalk(Token const* node, T &stream) const; + private: + void parse (); + /* Recursive walk through ANTLR3_BASE_TREE */ + void treeWalk(QPointer<Token> root, ANTLR3_BASE_TREE *tree, ANTLR3_UINT32 &lastindex); + /* Walk through Token tree and look for table names, table aliases, ... */ + void scanTree(); + pANTLR3_VECTOR lexerTokenVector; + }; + + OraclePLSQLStatement::OraclePLSQLStatement(const QString &statement, const QString &name) : Statement(statement, name) + { + _mStatementType = S_SELECT; + parse(); + }; + + void OraclePLSQLStatement::parse () + { + pANTLR3_INPUT_STREAM input; + pOraclePLSQLLexer lxr; + pANTLR3_COMMON_TOKEN_STREAM tstream; + pOraclePLSQLParser psr; + OraclePLSQLParser_start_rule_return langAST; + //pANTLR3_COMMON_TREE_NODE_STREAM nodes; + + QByteArray QBAinput(_mStatement.toUtf8()); + QByteArray QBAname(_mname.toUtf8()); + + input = antlr3StringStreamNew( (uint8_t*) QBAinput.data(), ANTLR3_ENC_8BIT, (ANTLR3_UINT64) QBAinput.size(), (uint8_t*)QBAname.data()); + //input = antlr3NewAsciiStringInPlaceStream( (uint8_t*) QBAinput.data(), (ANTLR3_UINT64) QBAinput.size(), NULL); + + input->setUcaseLA(input, ANTLR3_TRUE); // ignore case + + if (input == NULL) + { + // TODO throw here + throw ParseException(); + exit(ANTLR3_ERR_NOMEM); + } + + // Our input stream is now open and all set to go, so we can create a new instance of our + // lexer and set the lexer input to our input stream: + // (file | memory | ?) --> inputstream -> lexer --> tokenstream --> parser ( --> treeparser )? + // + lxr = OraclePLSQLLexerNew(input); // CLexerNew is generated by ANTLR + lxr->pLexer->input->charPositionInLine = 0; // fix off-by-one error for getCharPositionInLine for the 1st row + + if ( lxr == NULL ) + { + // TODO throw here + throw ParseException(); + exit(ANTLR3_ERR_NOMEM); + } + + tstream = antlr3CommonTokenStreamSourceNew(ANTLR3_SIZE_HINT, TOKENSOURCE(lxr)); + + if (tstream == NULL) + { + // TODO throw here + _mState = P_ERROR; + throw ParseException(); + exit(ANTLR3_ERR_NOMEM); + } + this->lexerTokenVector = tstream->getTokens(tstream); + _mState = P_LEXER; + + // Finally, now that we have our lexer constructed, we can create the parser + // + psr = OraclePLSQLParserNew(tstream); // CParserNew is generated by ANTLR3 + + if (psr == NULL) + { + // TODO throw here + throw ParseException(); + exit(ANTLR3_ERR_NOMEM); + } + + langAST = psr->start_rule(psr); + + if (psr->pParser->rec->state->errorCount > 0) + { + fprintf(stderr, "The parser returned %d errors, tree walking aborted.\n", psr->pParser->rec->state->errorCount); + throw ParseException(); + } + + //pANTLR3_COMMON_TOKEN root_token = langAST.tree->getToken(langAST.tree); + _mAST = new Token( NULL + ,Position(0,0) + , "" + , Token::X_ROOT + ); + ANTLR3_UINT32 lastIndex = 0; + + treeWalk(_mAST, langAST.tree, lastIndex); + + scanTree(); + + psr ->free (psr); psr = NULL; + tstream ->free (tstream); tstream = NULL; this->lexerTokenVector = NULL; + lxr ->free (lxr); lxr = NULL; + input ->close (input); input = NULL; + }; + + /* recursively copy an AST tree into */ + void OraclePLSQLStatement::treeWalk(QPointer<Token> root, ANTLR3_BASE_TREE *tree, ANTLR3_UINT32 &lastindex) + { + pANTLR3_BASE_TREE pRootNode = (ANTLR3_BASE_TREE*)tree; + + // if (pRootNode->isNilNode(pRootNode) == ANTLR3_TRUE) { + // printf("// nil-node\n"); + // //return; + // //TODO throw here + // } + + ANTLR3_UINT32 uChildCount = pRootNode->getChildCount(pRootNode); + for (ANTLR3_UINT32 i=0; i<uChildCount; ++i) + { + pANTLR3_BASE_TREE pChildNode = (pANTLR3_BASE_TREE) pRootNode->getChild(pRootNode, i); + ANTLR3_UINT32 uChildLexemeType = pChildNode->getType(pChildNode); + pANTLR3_COMMON_TOKEN pChildLexeme = pChildNode->getToken(pChildNode); + + // if child is not a leaf node - recurse + if ( pChildNode->getChildCount(pChildNode) != 0) + { + // pANTLR3_COMMON_TOKEN parser_token = child->getToken(child); + // printf("Non-Leaf node \'%s\'(%d)\n", + // (const char*)parser_token->getText(parser_token)->chars, + // parser_token->user1 //tree->u + // ); + + Token *childToken = new OraclePLSQLToken ( root + , Position(pChildLexeme->getLine(pChildLexeme), pChildLexeme->getCharPositionInLine(pChildLexeme)) + , (const char*)pChildLexeme->getText(pChildLexeme)->chars + , pChildLexeme->getType(pChildLexeme) + , (uint64_t)(pChildNode->u) + ); + root->appendChild(childToken); + treeWalk(childToken, pChildNode, lastindex); + } else { // if child is a leaf node + /* this is a leaf node */ + ANTLR3_MARKER uChildLexemeStart = pChildLexeme->start; + ANTLR3_UINT32 lexemeTotal = lexerTokenVector->count; + pANTLR3_COMMON_TOKEN pLocalLexeme; + + /* loop over lexer's tokens until leaf if found */ + while(lastindex < lexemeTotal) + { + pLocalLexeme = (pANTLR3_COMMON_TOKEN) lexerTokenVector->get(lexerTokenVector, lastindex); + ANTLR3_MARKER uLocalLexemeStart = pLocalLexeme->start; + if(uLocalLexemeStart == uChildLexemeStart) + break; + lastindex++; + } + + // TODO check for EOF in lexer stream */ + // printf("Leaf node \'%s\'(%d)\n", + // (const char*)parser_token->getText(parser_token)->chars, + // parser_token->user1 + // ); + + Token *childToken = new OraclePLSQLToken ( root + , Position(pChildLexeme->getLine(pChildLexeme), pChildLexeme->getCharPositionInLine(pChildLexeme)) + , (const char*)pChildLexeme->getText(pChildLexeme)->chars + // Leaf node can be either a reserved (key)word or identifier. Also some keywords can be identifiers. + // if the attribute user1 is set then the token is considered to be an identifier + // user2 represents either alias declaration or usage + , pChildLexeme->user1 ? pChildLexeme->user1 : pChildLexeme->getType(pChildLexeme) + , pChildLexeme->user2 ? pChildLexeme->user2 : T_UNKNOWN + ); + root->appendChild(childToken); + + // Process spaces and comments after parser_token + while(++lastindex < lexemeTotal) + { + pANTLR3_COMMON_TOKEN pSpacerLexeme = (pANTLR3_COMMON_TOKEN) lexerTokenVector->get(lexerTokenVector, lastindex); + ANTLR3_UINT32 SpacerLexemeChannel = pSpacerLexeme->getChannel(pSpacerLexeme); + + if(SpacerLexemeChannel != HIDDEN ) + break; + + Token *spacerToken = new Token( root + , Position(pSpacerLexeme->getLine(pSpacerLexeme), pSpacerLexeme->getCharPositionInLine(pSpacerLexeme)) + , (const char*)pSpacerLexeme->getText(pSpacerLexeme)->chars + , Token::X_COMMENT + ); + childToken->appendSpacer(spacerToken); + } + } // else for child is a leaf node + } // for each child + }; + + void OraclePLSQLStatement::scanTree() + { + for(SQLParser::Statement::token_const_iterator i=begin(); i!=end(); ++i) + { + Token const &node = *i; + switch(node.getTokenType()) + { + case Token::L_TABLENAME: + break; + } + // if( node.getTokenUsageType() == Token::Declaration ) + // _mAliasesSet.insert( node.toString().toUpper()); + // break; + } + }; + + /*virtual*/ void OraclePLSQLStatement::print(QTextCursor &cur) const + { + cur.insertText ( _mAST->toStringRecursive() ); + }; + + /*virtual*/ void OraclePLSQLStatement::tree2Dot(std::ostream &o) const + { + Token const* _root = Statement::root(); + QString s; + //recursiveWalk<>(_root, s); + }; + +}; // namespace SQLParser + +Util::RegisterInFactory<SQLParser::OraclePLSQLStatement, StatementFactTwoParmSing> regOraclePLSQLStatement("OraclePLSQL"); Added: branches/tora-trotl/src/parsing/tsqllexer.h =================================================================== --- branches/tora-trotl/src/parsing/tsqllexer.h (rev 0) +++ branches/tora-trotl/src/parsing/tsqllexer.h 2011-06-25 02:09:07 UTC (rev 3987) @@ -0,0 +1,33 @@ +#ifndef __TSQLLEXER__ +#define __TSQLLEXER__ + +#include <QString> + +#include "Loki/Factory_alt.h" + +#include <boost/iterator/iterator_facade.hpp> + +namespace SQLParser +{ + class Lexer { + public: + Lexer(const QString &statement, const QString &name) + : _mStatement(statement) + , _mName(name) + , _mEof(false) + {}; + + virtual QString firstWord() = 0; + protected: + QString _mStatement, _mName; + bool _mEof; + }; + + +}; // namespace SQLParser + +typedef Util::GenericFactory<SQLParser::Lexer, LOKI_TYPELIST_2(const QString &, const QString&)> LexerFactTwoParm; +class LexerFactTwoParmSing: public ::Loki::SingletonHolder<LexerFactTwoParm> {}; + + +#endif Added: branches/tora-trotl/src/parsing/tsqllexeroracle.cpp =================================================================== --- branches/tora-trotl/src/parsing/tsqllexeroracle.cpp (rev 0) +++ branches/tora-trotl/src/parsing/tsqllexeroracle.cpp 2011-06-25 02:09:07 UTC (rev 3987) @@ -0,0 +1,94 @@ +// ANTLR runtime includes +#include "antlr3commontoken.h" +#include "antlr3string.h" +#include "antlr3input.h" +#include "antlr3lexer.h" + +#include "OracleSQLLexer.h" +#include "tsqllexer.h" +#include "tsqlparse.h" + +namespace SQLParser +{ + + class OracleLexer : public Lexer + { + public: + OracleLexer(const QString &statement, const QString &name); + virtual QString firstWord(); + private: + QByteArray QBAinput; + QByteArray QBAname; + + pANTLR3_INPUT_STREAM input; + pOracleSQLLexer lxr; + pANTLR3_COMMON_TOKEN_STREAM tstream; + pANTLR3_VECTOR lexerTokenVector; + }; + + OracleLexer::OracleLexer(const QString &statement, const QString &name) + : Lexer(statement, name) + , QBAinput(statement.toUtf8()) + , QBAname(name.toUtf8()) + { + input = antlr3StringStreamNew( (uint8_t*) QBAinput.data(), ANTLR3_ENC_8BIT, (ANTLR3_UINT64) QBAinput.size(), (uint8_t*)QBAname.data()); + input->setUcaseLA(input, ANTLR3_TRUE); // ignore case + + if (input == NULL) + { + // TODO throw here + throw ParseException(); + exit(ANTLR3_ERR_NOMEM); + } + + // Our input stream is now open and all set to go, so we can create a new instance of our + // lexer and set the lexer input to our input stream: + // (file | memory | ?) --> inputstream -> lexer --> tokenstream --> parser ( --> treeparser )? + // + lxr = OracleSQLLexerNew(input); // CLexerNew is generated by ANTLR + lxr->pLexer->input->charPositionInLine = 0; // fix off-by-one error for getCharPositionInLine for the 1st row + + if ( lxr == NULL ) + { + // TODO throw here + throw ParseException(); + exit(ANTLR3_ERR_NOMEM); + } + + tstream = antlr3CommonTokenStreamSourceNew(ANTLR3_SIZE_HINT, TOKENSOURCE(lxr)); + + if (tstream == NULL) + { + // TODO throw here + //_mState = P_ERROR; + throw ParseException(); + exit(ANTLR3_ERR_NOMEM); + } + this->lexerTokenVector = tstream->getTokens(tstream); + //_mState = P_LEXER; + }; + + /*virtual*/ QString OracleLexer::firstWord() + { + ANTLR3_UINT32 size = this->lexerTokenVector->size(lexerTokenVector); + ANTLR3_UINT32 i; + for (i=0; i < size; i++) { + pANTLR3_COMMON_TOKEN token = (pANTLR3_COMMON_TOKEN)lexerTokenVector->get(lexerTokenVector, i); + printf("--%s-%d-\n", token->toString(token)->chars, token->getChannel(token)); + printf("[%d,%d,%d] '%s'\n", + token->getLine(token), + token->getCharPositionInLine(token), + token->getText(token)->len, + token->getText(token)->chars); + printf("--------------------------------------------------------------------------------\n"); + + if( token->getChannel(token) != HIDDEN) + { + //pANTLR3_COMMON_TOKEN token = (pANTLR3_COMMON_TOKEN)lexerTokenVector->get(lexerTokenVector, 0); + return QString((const char*)(token->getText(token)->chars)); + } + } + } +}; + +Util::RegisterInFactory<SQLParser::OracleLexer, LexerFactTwoParmSing> regOracleSQLLexStatement("OracleSQL"); Modified: branches/tora-trotl/src/parsing/tsqlparse.h =================================================================== --- branches/tora-trotl/src/parsing/tsqlparse.h 2011-06-24 22:55:08 UTC (rev 3986) +++ branches/tora-trotl/src/parsing/tsqlparse.h 2011-06-25 02:09:07 UTC (rev 3987) @@ -1,15 +1,6 @@ #ifndef __TSQLPARSE__ #define __TSQLPARSE__ -////TODO remove dependency on ANTLR3 in this header file -#include "antlr3lexer.h" -#include "antlr3commontoken.h" -#include "antlr3string.h" -#include "antlr3input.h" - -#include "OracleSQLLexer.h" -#include "OracleSQLParser.h" - #include <QString> #include <QList> #include <QMap> @@ -57,8 +48,8 @@ private: unsigned _mLine, _mLinePos; }; - - class Token: public QObject + + class Token : public QObject // inherit from QObject for QPointer { public: // TreeModel methods @@ -90,7 +81,6 @@ }; enum TokenType - // TODO remove dependency in antlr runtime headers { // Special node types X_UNASSIGNED = 0, @@ -103,11 +93,16 @@ L_SCHEMANAME, L_FUNCTIONNAME, L_PACKAGENAME, + L_BINDVARNAME, L_TABLEALIAS, L_IDENTIFIER, L_JOIN, L_ON, L_USING, + // Leaf node (PLSQL only) + L_VARIABLE, + L_DATATYPE, + L_PARAMETER, // Structural node types S_SUBQUERY_FACTORED, S_SUBQUERY_NESTED, @@ -126,16 +121,17 @@ { Unknown, Declaration, - Usage + Usage, + UsageL // Used in LVALUE }; - enum DisplayType - { - slComment = SL_COMMENT, - mlComment = ML_COMMENT, - keyword, - identifier - }; + /* enum DisplayType */ + /* { */ + /* slComment, //= SL_COMMENT, */ + /* mlComment, //= ML_COMMENT, */ + /* keyword, */ + /* identifier */ + /* }; */ Token(Token *parent, const Position &pos, const QString &str, const TokenType& tokentype = X_UNASSIGNED) : _mParent(parent) @@ -209,7 +205,7 @@ }; - class Statement: public QObject + class Statement //: public QObject { friend class ParseException; public: @@ -231,8 +227,8 @@ { P_ERROR = -1, P_INIT = 0, - P_LEXER, - P_PARSER + P_LEXER, // lexed + P_PARSER // parsed }; Statement(const QString &statement, const QString &name) @@ -246,7 +242,9 @@ ~Statement() {}; virtual void print (QTextCursor&) const = 0; - + void dumpTree (); + virtual void tree2Dot(std::ostream&) const = 0; + // TreeModel methods inline const Token* root() const { @@ -263,8 +261,6 @@ return _mAliasesSet; }; - virtual void tree2Dot(std::ostream&) const = 0; - class token_const_iterator : public boost::iterator_facade < token_const_iterator , @@ -317,15 +313,11 @@ > { public: - token_const_iterator_to_root() : m_token(0) - {}; + token_const_iterator_to_root() : m_token(0) {}; - explicit token_const_iterator_to_root(Token const* p) : m_token(p) - {}; + explicit token_const_iterator_to_root(Token const* p) : m_token(p) {}; - - token_const_iterator_to_root(token_const_iterator_to_root const& other) : m_token(other.m_token) - {}; + token_const_iterator_to_root(token_const_iterator_to_root const& other) : m_token(other.m_token) {}; ~token_const_iterator_to_root() {}; Modified: branches/tora-trotl/src/parsing/tsqlparse.tcc =================================================================== --- branches/tora-trotl/src/parsing/tsqlparse.tcc 2011-06-24 22:55:08 UTC (rev 3986) +++ branches/tora-trotl/src/parsing/tsqlparse.tcc 2011-06-25 02:09:07 UTC (rev 3987) @@ -19,11 +19,15 @@ ,"SCHEMANAME" ,"FUNCTIONNAME" ,"PACKAGENAME" + ,"BINDVARNAME" ,"TABLEALIAS" ,"IDENTIFIER" ,"JOIN" ,"ON" ,"USING" + ,"VARIABLE" + ,"DATATYPE" + ,"PARAMETER" ,"SUBQUERY_FACTORED" ,"SUBQUERY_NESTED" ,"SUBQUERY_ALIAS" Modified: branches/tora-trotl/src/parsing/tsqlparseoracle.cpp =================================================================== --- branches/tora-trotl/src/parsing/tsqlparseoracle.cpp 2011-06-24 22:55:08 UTC (rev 3986) +++ branches/tora-trotl/src/parsing/tsqlparseoracle.cpp 2011-06-25 02:09:07 UTC (rev 3987) @@ -12,10 +12,10 @@ namespace SQLParser { - class OracleToken: public Token + class OracleSQLToken: public Token { public: - OracleToken (Token *parent, const Position &pos, const QString &str, unsigned tokentype, unsigned usagetype = T_UNKNOWN) + OracleSQLToken (Token *parent, const Position &pos, const QString &str, unsigned tokentype, unsigned usagetype = T_UNKNOWN) : Token(parent, pos, str) { TokenType &token_type = const_cast<Token::TokenType&>(_mTokenType); @@ -49,6 +49,9 @@ case T_PACKAGE_NAME: token_type = L_PACKAGENAME; break; + case T_BINDVAR_NAME: + token_type = L_BINDVARNAME; + break; case T_COLUMN_ALIAS: case T_COLUMN_NAME: token_type = L_IDENTIFIER; @@ -104,11 +107,11 @@ }; }; - class OracleStatement: public Statement + class OracleSQLStatement: public Statement { public: - OracleStatement(const QString &statement, const QString &name); - ~OracleStatement() + OracleSQLStatement(const QString &statement, const QString &name); + ~OracleSQLStatement() {}; virtual void print (QTextCursor&) const; virtual void tree2Dot(std::ostream &o) const; @@ -122,13 +125,13 @@ pANTLR3_VECTOR lexerTokenVector; }; - OracleStatement::OracleStatement(const QString &statement, const QString &name) : Statement(statement, name) + OracleSQLStatement::OracleSQLStatement(const QString &statement, const QString &name) : Statement(statement, name) { _mStatementType = S_SELECT; parse(); }; - void OracleStatement::parse () + void OracleSQLStatement::parse () { pANTLR3_INPUT_STREAM input; pOracleSQLLexer lxr; @@ -216,7 +219,7 @@ }; /* recursively copy an AST tree into */ - void OracleStatement::treeWalk(QPointer<Token> root, ANTLR3_BASE_TREE *tree, ANTLR3_UINT32 &lastindex) + void OracleSQLStatement::treeWalk(QPointer<Token> root, ANTLR3_BASE_TREE *tree, ANTLR3_UINT32 &lastindex) { pANTLR3_BASE_TREE pRootNode = (ANTLR3_BASE_TREE*)tree; @@ -251,7 +254,7 @@ pANTLR3_COMMON_TOKEN pChildLexeme = pChildNode->getToken(pChildNode); } - Token *childToken = new OracleToken ( root + Token *childToken = new OracleSQLToken ( root , Position(pChildLexeme->getLine(pChildLexeme), pChildLexeme->getCharPositionInLine(pChildLexeme)) , (const char*)pChildLexeme->getText(pChildLexeme)->chars , pChildLexeme->getType(pChildLexeme) @@ -281,14 +284,14 @@ // parser_token->user1 // ); - Token *childToken = new OracleToken ( root - , Position(pChildLexeme->getLine(pChildLexeme), pChildLexeme->getCharPositionInLine(pChildLexeme)) - , (const char*)pChildLexeme->getText(pChildLexeme)->chars - // Leaf node can be either a reserved (key)word or identifier. Also some keywords can be identifiers. - // if the attribute user1 is set then the token is considered to be an identifier - // user2 represents either alias declaration or usage - , pChildLexeme->user1 ? pChildLexeme->user1 : pChildLexeme->getType(pChildLexeme) - , pChildLexeme->user2 ? pChildLexeme->user2 : T_UNKNOWN + Token *childToken = new OracleSQLToken ( root + , Position(pChildLexeme->getLine(pChildLexeme), pChildLexeme->getCharPositionInLine(pChildLexeme)) + , (const char*)pChildLexeme->getText(pChildLexeme)->chars + // Leaf node can be either a reserved (key)word or identifier. Also some keywords can be identifiers. + // if the attribute user1 is set then the token is considered to be an identifier + // user2 represents either alias declaration or usage + , pChildLexeme->user1 ? pChildLexeme->user1 : pChildLexeme->getType(pChildLexeme) + , pChildLexeme->user2 ? pChildLexeme->user2 : T_UNKNOWN ); root->appendChild(childToken); @@ -312,7 +315,7 @@ } // for each child }; - void OracleStatement::scanTree() + void OracleSQLStatement::scanTree() { for(SQLParser::Statement::token_const_iterator i=begin(); i!=end(); ++i) { @@ -384,12 +387,12 @@ } }; - /*virtual*/ void OracleStatement::print(QTextCursor &cur) const + /*virtual*/ void OracleSQLStatement::print(QTextCursor &cur) const { cur.insertText ( _mAST->toStringRecursive() ); }; - /*virtual*/ void OracleStatement::tree2Dot(std::ostream &o) const + /*virtual*/ void OracleSQLStatement::tree2Dot(std::ostream &o) const { Token const* _root = Statement::root(); QString s; @@ -398,4 +401,4 @@ }; // namespace SQLParser -Util::RegisterInFactory<SQLParser::OracleStatement, StatementFactTwoParmSing> regOracleStatement("Oracle"); +Util::RegisterInFactory<SQLParser::OracleSQLStatement, StatementFactTwoParmSing> regOracleSQLStatement("OracleSQL"); Added: branches/tora-trotl/src/parsing/tsqlparseoracle.o =================================================================== (Binary files differ) Property changes on: branches/tora-trotl/src/parsing/tsqlparseoracle.o ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Modified: branches/tora-trotl/src/toworksheet.cpp =================================================================== --- branches/tora-trotl/src/toworksheet.cpp 2011-06-24 22:55:08 UTC (rev 3986) +++ branches/tora-trotl/src/toworksheet.cpp 2011-06-25 02:09:07 UTC (rev 3987) @@ -68,6 +68,9 @@ #include "toeditablemenu.h" #include "todescribe.h" +#include "parsing/tsqlparse.h" +#include "parsing/tsqllexer.h" + #include <qcheckbox.h> #include <qcheckbox.h> #include <qcombobox.h> @@ -848,6 +851,7 @@ bool toWorksheet::describe(const QString &query) { + try { QRegExp white(QString::fromLatin1("[ \r\n\t.]+")); @@ -1783,6 +1787,54 @@ void toWorksheet::describe(void) { + int line, col; + QString txt = Editor->text(); + Editor->getCursorPosition(&line, &col); + TLOG(1,toDecorator,__HERE__) << "describe: " + << '[' << line << ',' << col << ']' + << "--------------------------------------------------------------------------------" << std::endl + << txt.toStdString() + << std::endl; + + std::auto_ptr <SQLParser::Lexer> lexer = LexerFactTwoParmSing::Instance().create("OracleSQL", txt, ""); + QString firstWord = lexer->firstWord(); + + if( QString::compare("CALL", firstWord, Qt::CaseInsensitive) == 0 || + QString::compare("ANALYZE", firstWord, Qt::CaseInsensitive) == 0 || + QString::compare("DECLARE", firstWord, Qt::CaseInsensitive) == 0 || + QString::compare("BEGIN", firstWord, Qt::CaseInsensitive) == 0 || + QString::compare("CREATE", firstWord, Qt::CaseInsensitive) == 0 || + QString::compare("ALTER", firstWord, Qt::CaseInsensitive) == 0 || + QString::compare("LOCK", firstWord, Qt::CaseInsensitive) == 0 || + QString::compare("EXPLAIN", firstWord, Qt::CaseInsensitive) == 0 || + QString::compare("DROP", firstWord, Qt::CaseInsensitive) == 0 || + QString::compare("COMMIT", firstWord, Qt::CaseInsensitive) == 0 || + QString::compare("ROLLBACK", firstWord, Qt::CaseInsensitive) == 0 || + QString::compare("GRANT", firstWord, Qt::CaseInsensitive) == 0 || + QString::compare("TRUNCATE", firstWord, Qt::CaseInsensitive) == 0 || + QString::compare("SAVEPOINT", firstWord, Qt::CaseInsensitive) == 0 || + QString::compare("SET", firstWord, Qt::CaseInsensitive) == 0 + ) + { + std::cout << "PLSQL:" << std::endl; + std::auto_ptr <SQLParser::Statement> stat = StatementFactTwoParmSing::Instance().create("OraclePLSQL", txt, ""); + std::cout << stat->root()->toStringRecursive().toStdString() << std::endl; + } else if( QString::compare("WITH", firstWord, Qt::CaseInsensitive) == 0 || + QString::compare("SELECT", firstWord, Qt::CaseInsensitive) == 0 || + QString::compare("INSERT", firstWord, Qt::CaseInsensitive) == 0 || + QString::compare("UPDATE", firstWord, Qt::CaseInsensitive) == 0 || + QString::compare("DELETE", firstWord, Qt::CaseInsensitive) == 0 || + QString::compare("MERGE", firstWord, Qt::CaseInsensitive) == 0 + ) { + std::cout << "SQL:" << std::endl; + std::auto_ptr <SQLParser::Statement> stat = StatementFactTwoParmSing::Instance().create("OracleSQL", txt, ""); + std::cout << stat->root()->toStringRecursive().toStdString() << std::endl; + } else { + std::cout << "Unknown:" << firstWord.QString::toStdString() << std::endl; + } + + return; + QString owner, table; Editor->tableAtCursor(owner, table); if (owner.isNull()) Modified: branches/tora-trotl/src/trotl_test3.cpp =================================================================== --- branches/tora-trotl/src/trotl_test3.cpp 2011-06-24 22:55:08 UTC (rev 3986) +++ branches/tora-trotl/src/trotl_test3.cpp 2011-06-25 02:09:07 UTC (rev 3987) @@ -175,7 +175,7 @@ if (qApp->argc() > 2 || (qApp->argc() == 2 && qApp->argv()[1][0] == '-')) { - printf("Usage:\n\n tora [{X options}] [connectstring]\n\n"); + printf("Usage:\n\n trotl_test3 [{X options}] [connectstring]\n\n"); exit(2); } else if (qApp->argc() == 2) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ibr...@us...> - 2011-06-26 21:35:46
|
Revision: 3988 http://tora.svn.sourceforge.net/tora/?rev=3988&view=rev Author: ibre5041 Date: 2011-06-26 21:35:40 +0000 (Sun, 26 Jun 2011) Log Message: ----------- Modified Paths: -------------- branches/tora-trotl/src/parsing/tsqllexer.h branches/tora-trotl/src/parsing/tsqllexeroracle.cpp branches/tora-trotl/src/toworksheet.cpp Modified: branches/tora-trotl/src/parsing/tsqllexer.h =================================================================== --- branches/tora-trotl/src/parsing/tsqllexer.h 2011-06-25 02:09:07 UTC (rev 3987) +++ branches/tora-trotl/src/parsing/tsqllexer.h 2011-06-26 21:35:40 UTC (rev 3988) @@ -18,6 +18,7 @@ {}; virtual QString firstWord() = 0; + virtual QString currentWord(unsigned line, unsigned column) = 0; protected: QString _mStatement, _mName; bool _mEof; Modified: branches/tora-trotl/src/parsing/tsqllexeroracle.cpp =================================================================== --- branches/tora-trotl/src/parsing/tsqllexeroracle.cpp 2011-06-25 02:09:07 UTC (rev 3987) +++ branches/tora-trotl/src/parsing/tsqllexeroracle.cpp 2011-06-26 21:35:40 UTC (rev 3988) @@ -16,6 +16,7 @@ public: OracleLexer(const QString &statement, const QString &name); virtual QString firstWord(); + virtual QString currentWord(unsigned line, unsigned column); private: QByteArray QBAinput; QByteArray QBAname; @@ -74,21 +75,38 @@ ANTLR3_UINT32 i; for (i=0; i < size; i++) { pANTLR3_COMMON_TOKEN token = (pANTLR3_COMMON_TOKEN)lexerTokenVector->get(lexerTokenVector, i); - printf("--%s-%d-\n", token->toString(token)->chars, token->getChannel(token)); - printf("[%d,%d,%d] '%s'\n", - token->getLine(token), - token->getCharPositionInLine(token), - token->getText(token)->len, - token->getText(token)->chars); - printf("--------------------------------------------------------------------------------\n"); - if( token->getChannel(token) != HIDDEN) { - //pANTLR3_COMMON_TOKEN token = (pANTLR3_COMMON_TOKEN)lexerTokenVector->get(lexerTokenVector, 0); return QString((const char*)(token->getText(token)->chars)); } } } + + /*virtual*/ QString OracleLexer::currentWord(unsigned line, unsigned column) + { + line++; // ANTLR3 start with 1st while QScintille starts with 0th + ANTLR3_UINT32 size = this->lexerTokenVector->size(lexerTokenVector); + ANTLR3_UINT32 i; + + pANTLR3_COMMON_TOKEN tokenZero = (pANTLR3_COMMON_TOKEN)lexerTokenVector->get(lexerTokenVector, 0); + QString retval((const char*)(tokenZero->getText(tokenZero)->chars)); + + for (i=1; i < size; i++) { + pANTLR3_COMMON_TOKEN token = (pANTLR3_COMMON_TOKEN)lexerTokenVector->get(lexerTokenVector, i); + if ( + token->getLine(token) > line || + ( token->getLine(token) == line && token->getCharPositionInLine(token) > column ) + ) + { + return retval; + } + + if ( token->getChannel(token) != HIDDEN) + { + retval = QString((const char*)(token->getText(token)->chars)); + } + } + } }; Util::RegisterInFactory<SQLParser::OracleLexer, LexerFactTwoParmSing> regOracleSQLLexStatement("OracleSQL"); Modified: branches/tora-trotl/src/toworksheet.cpp =================================================================== --- branches/tora-trotl/src/toworksheet.cpp 2011-06-25 02:09:07 UTC (rev 3987) +++ branches/tora-trotl/src/toworksheet.cpp 2011-06-26 21:35:40 UTC (rev 3988) @@ -1785,6 +1785,8 @@ query(Editor->selectedText(), Normal, toSQLParse::statement::unknown); } + + void toWorksheet::describe(void) { int line, col; @@ -1796,6 +1798,7 @@ << txt.toStdString() << std::endl; + std::auto_ptr <SQLParser::Statement> stat; std::auto_ptr <SQLParser::Lexer> lexer = LexerFactTwoParmSing::Instance().create("OracleSQL", txt, ""); QString firstWord = lexer->firstWord(); @@ -1817,7 +1820,7 @@ ) { std::cout << "PLSQL:" << std::endl; - std::auto_ptr <SQLParser::Statement> stat = StatementFactTwoParmSing::Instance().create("OraclePLSQL", txt, ""); + stat = StatementFactTwoParmSing::Instance().create("OraclePLSQL", txt, ""); std::cout << stat->root()->toStringRecursive().toStdString() << std::endl; } else if( QString::compare("WITH", firstWord, Qt::CaseInsensitive) == 0 || QString::compare("SELECT", firstWord, Qt::CaseInsensitive) == 0 || @@ -1827,12 +1830,21 @@ QString::compare("MERGE", firstWord, Qt::CaseInsensitive) == 0 ) { std::cout << "SQL:" << std::endl; - std::auto_ptr <SQLParser::Statement> stat = StatementFactTwoParmSing::Instance().create("OracleSQL", txt, ""); + stat = StatementFactTwoParmSing::Instance().create("OracleSQL", txt, ""); std::cout << stat->root()->toStringRecursive().toStdString() << std::endl; } else { std::cout << "Unknown:" << firstWord.QString::toStdString() << std::endl; } + SQLParser::Position cursor(line+1, col); + SQLParser::Statement::token_const_iterator i = stat->begin(); + for(SQLParser::Statement::token_const_iterator j=stat->begin(); j!=stat->end(); ++j) + { + if( j->getPosition() > cursor) + break; + i = j; + } + TOMessageBox::information (this, lexer->currentWord(line, col), i->parent()->toStringRecursive() ); return; QString owner, table; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ibr...@us...> - 2011-07-11 10:12:37
|
Revision: 4001 http://tora.svn.sourceforge.net/tora/?rev=4001&view=rev Author: ibre5041 Date: 2011-07-11 10:12:31 +0000 (Mon, 11 Jul 2011) Log Message: ----------- Outlines progress Modified Paths: -------------- branches/tora-trotl/src/parsing/tsqllexeroracle.cpp branches/tora-trotl/src/parsing/tsqlparse.h branches/tora-trotl/src/toresultfield.cpp branches/tora-trotl/src/toworksheet.cpp Modified: branches/tora-trotl/src/parsing/tsqllexeroracle.cpp =================================================================== --- branches/tora-trotl/src/parsing/tsqllexeroracle.cpp 2011-07-08 21:21:33 UTC (rev 4000) +++ branches/tora-trotl/src/parsing/tsqllexeroracle.cpp 2011-07-11 10:12:31 UTC (rev 4001) @@ -80,13 +80,16 @@ return QString((const char*)(token->getText(token)->chars)); } } + return QString(); } /*virtual*/ QString OracleLexer::currentWord(unsigned line, unsigned column) { - line++; // ANTLR3 start with 1st while QScintille starts with 0th + line++; // ANTLR3 starts with 1st while QScintille starts with 0th + ANTLR3_UINT32 i; ANTLR3_UINT32 size = this->lexerTokenVector->size(lexerTokenVector); - ANTLR3_UINT32 i; + if(size == 0) + return QString(); pANTLR3_COMMON_TOKEN tokenZero = (pANTLR3_COMMON_TOKEN)lexerTokenVector->get(lexerTokenVector, 0); QString retval((const char*)(tokenZero->getText(tokenZero)->chars)); @@ -106,7 +109,9 @@ retval = QString((const char*)(token->getText(token)->chars)); } } + return QString(); } + }; Util::RegisterInFactory<SQLParser::OracleLexer, LexerFactTwoParmSing> regOracleSQLLexStatement("OracleSQL"); Modified: branches/tora-trotl/src/parsing/tsqlparse.h =================================================================== --- branches/tora-trotl/src/parsing/tsqlparse.h 2011-07-08 21:21:33 UTC (rev 4000) +++ branches/tora-trotl/src/parsing/tsqlparse.h 2011-07-11 10:12:31 UTC (rev 4001) @@ -26,6 +26,7 @@ Position(unsigned line, unsigned linePos): _mLine(line), _mLinePos(linePos) {}; inline unsigned getLine() const { return _mLine; }; inline unsigned getLinePos() const { return _mLinePos; }; + inline QString toString() const { return QString("[%1,%2]").arg(_mLine).arg(_mLinePos); }; inline bool operator== (const Position &other) const { return _mLine==other._mLine && _mLinePos==other._mLinePos; @@ -175,7 +176,7 @@ inline bool isLeaf() const { return _mChildren.isEmpty(); }; inline const TokenType& getTokenType() const { return _mTokenType; }; - inline const char* getTokenTypeS() const { return TokenType2Text[_mTokenType]; }; + inline const char* getTokenTypeString() const { return TokenType2Text[_mTokenType]; }; inline const QString& getTokenTypeName() const { return _mTokenTypeName; }; inline void setTokenTypeName(QString const& name) { _mTokenTypeName = name; }; Modified: branches/tora-trotl/src/toresultfield.cpp =================================================================== --- branches/tora-trotl/src/toresultfield.cpp 2011-07-08 21:21:33 UTC (rev 4000) +++ branches/tora-trotl/src/toresultfield.cpp 2011-07-11 10:12:31 UTC (rev 4001) @@ -168,57 +168,72 @@ getCursorPosition(&line, &col); try { - std::auto_ptr <SQLParser::Statement> stat; - std::auto_ptr <SQLParser::Lexer> lexer = LexerFactTwoParmSing::Instance().create("OracleSQL", txt, ""); - firstWord = lexer->firstWord(); - currentWord = lexer->currentWord(line, col); - - if( QString::compare("CALL", firstWord, Qt::CaseInsensitive) == 0 || - QString::compare("ANALYZE", firstWord, Qt::CaseInsensitive) == 0 || - QString::compare("DECLARE", firstWord, Qt::CaseInsensitive) == 0 || - QString::compare("BEGIN", firstWord, Qt::CaseInsensitive) == 0 || - QString::compare("CREATE", firstWord, Qt::CaseInsensitive) == 0 || - QString::compare("ALTER", firstWord, Qt::CaseInsensitive) == 0 || - QString::compare("LOCK", firstWord, Qt::CaseInsensitive) == 0 || - QString::compare("EXPLAIN", firstWord, Qt::CaseInsensitive) == 0 || - QString::compare("DROP", firstWord, Qt::CaseInsensitive) == 0 || - QString::compare("COMMIT", firstWord, Qt::CaseInsensitive) == 0 || - QString::compare("ROLLBACK", firstWord, Qt::CaseInsensitive) == 0 || - QString::compare("GRANT", firstWord, Qt::CaseInsensitive) == 0 || - QString::compare("TRUNCATE", firstWord, Qt::CaseInsensitive) == 0 || - QString::compare("SAVEPOINT", firstWord, Qt::CaseInsensitive) == 0 || - QString::compare("PACKAGE", firstWord, Qt::CaseInsensitive) == 0 || - QString::compare("SET", firstWord, Qt::CaseInsensitive) == 0 - ) - { - std::cout << "PLSQL:" << std::endl; - if(firstWord == "PACKAGE") - txt = QString("CREATE OR REPLACE ") + txt; - stat = StatementFactTwoParmSing::Instance().create("OraclePLSQL", txt, ""); - std::cout << stat->root()->toStringRecursive().toStdString() << std::endl; - } else if( QString::compare("WITH", firstWord, Qt::CaseInsensitive) == 0 || - QString::compare("SELECT", firstWord, Qt::CaseInsensitive) == 0 || - QString::compare("INSERT", firstWord, Qt::CaseInsensitive) == 0 || - QString::compare("UPDATE", firstWord, Qt::CaseInsensitive) == 0 || - QString::compare("DELETE", firstWord, Qt::CaseInsensitive) == 0 || - QString::compare("MERGE", firstWord, Qt::CaseInsensitive) == 0 - ) { - std::cout << "SQL:" << std::endl; - stat = StatementFactTwoParmSing::Instance().create("OracleSQL", txt, ""); - std::cout << stat->root()->toStringRecursive().toStdString() << std::endl; - } else { - std::cout << "Unknown:" << firstWord.QString::toStdString() << std::endl; - } + do { + std::auto_ptr <SQLParser::Statement> stat; + std::auto_ptr <SQLParser::Lexer> lexer = LexerFactTwoParmSing::Instance().create("OracleSQL", txt, ""); + firstWord = lexer->firstWord(); + if(firstWord.isEmpty()) + break; + currentWord = lexer->currentWord(line, col); - QString decl; - foreach( decl, stat->allDeclarations()) - { - buffer += decl + '\n'; - } + if( QString::compare("CALL", firstWord, Qt::CaseInsensitive) == 0 || + QString::compare("ANALYZE", firstWord, Qt::CaseInsensitive) == 0 || + QString::compare("DECLARE", firstWord, Qt::CaseInsensitive) == 0 || + QString::compare("BEGIN", firstWord, Qt::CaseInsensitive) == 0 || + QString::compare("CREATE", firstWord, Qt::CaseInsensitive) == 0 || + QString::compare("PROCEDURE", firstWord, Qt::CaseInsensitive) == 0 || + QString::compare("FUNCTION", firstWord, Qt::CaseInsensitive) == 0 || + QString::compare("PACKAGE", firstWord, Qt::CaseInsensitive) == 0 || + QString::compare("LOCK", firstWord, Qt::CaseInsensitive) == 0 || + QString::compare("EXPLAIN", firstWord, Qt::CaseInsensitive) == 0 || + QString::compare("DROP", firstWord, Qt::CaseInsensitive) == 0 || + QString::compare("COMMIT", firstWord, Qt::CaseInsensitive) == 0 || + QString::compare("ROLLBACK", firstWord, Qt::CaseInsensitive) == 0 || + QString::compare("GRANT", firstWord, Qt::CaseInsensitive) == 0 || + QString::compare("TRUNCATE", firstWord, Qt::CaseInsensitive) == 0 || + QString::compare("SAVEPOINT", firstWord, Qt::CaseInsensitive) == 0 || + QString::compare("PACKAGE", firstWord, Qt::CaseInsensitive) == 0 || + QString::compare("SET", firstWord, Qt::CaseInsensitive) == 0 + ) + { + std::cout << "PLSQL:" << std::endl; + if(firstWord == "PACKAGE" || firstWord == "PROCEDURE" || firstWord == "FUNCTION") + txt = QString("CREATE OR REPLACE ") + txt; + stat = StatementFactTwoParmSing::Instance().create("OraclePLSQL", txt, ""); + std::cout << stat->root()->toStringRecursive().toStdString() << std::endl; + } else if( QString::compare("WITH", firstWord, Qt::CaseInsensitive) == 0 || + QString::compare("SELECT", firstWord, Qt::CaseInsensitive) == 0 || + QString::compare("INSERT", firstWord, Qt::CaseInsensitive) == 0 || + QString::compare("UPDATE", firstWord, Qt::CaseInsensitive) == 0 || + QString::compare("DELETE", firstWord, Qt::CaseInsensitive) == 0 || + QString::compare("MERGE", firstWord, Qt::CaseInsensitive) == 0 + ) { + std::cout << "SQL:" << std::endl; + stat = StatementFactTwoParmSing::Instance().create("OracleSQL", txt, ""); + std::cout << stat->root()->toStringRecursive().toStdString() << std::endl; + } else { + std::cout << "Unknown:" << firstWord.QString::toStdString() << std::endl; + throw SQLParser::ParseException(); + } + //QString declName; + foreach( QString declName, stat->allDeclarations()) + { + QList<const SQLParser::Token*> decl = stat->declarations(declName); + foreach(SQLParser::Token const*t, decl) + { + + buffer += QString("%1: %2%3\n") + .arg(declName) + .arg(t->getTokenTypeString()) + .arg(t->getPosition().toString()); + } + } + } while(false); } catch ( SQLParser::ParseException const &e) { buffer = "Parser error\n"; } - TOMessageBox::information (this, currentWord, buffer ); + if(!buffer.isEmpty()) + TOMessageBox::information (this, currentWord, buffer ); } // queryDone Modified: branches/tora-trotl/src/toworksheet.cpp =================================================================== --- branches/tora-trotl/src/toworksheet.cpp 2011-07-08 21:21:33 UTC (rev 4000) +++ branches/tora-trotl/src/toworksheet.cpp 2011-07-11 10:12:31 UTC (rev 4001) @@ -1894,7 +1894,7 @@ << "Detail for the token: " << currentToken->toString() << "\n" << "Positon: [" << currentToken->getPosition().getLine() << ", " << currentToken->getPosition().getLinePos() << "]\n" << "Token type: " << currentToken->getTokenTypeName() << '\n' - << "Token subtype: " << currentToken->getTokenTypeS() << '\n'; + << "Token subtype: " << currentToken->getTokenTypeString() << '\n'; QList<QString> stack; while(stackPath->parent()) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ibr...@us...> - 2011-07-11 15:32:35
|
Revision: 4002 http://tora.svn.sourceforge.net/tora/?rev=4002&view=rev Author: ibre5041 Date: 2011-07-11 15:32:29 +0000 (Mon, 11 Jul 2011) Log Message: ----------- Resolve SQL grammar ambiguity, + some small display formating changes. Modified Paths: -------------- branches/tora-trotl/src/parsing/tplsqlparseoracle.cpp branches/tora-trotl/src/parsing/tsqlparse.h branches/tora-trotl/src/parsing/tsqlparseoracle.cpp branches/tora-trotl/src/toworksheet.cpp Modified: branches/tora-trotl/src/parsing/tplsqlparseoracle.cpp =================================================================== --- branches/tora-trotl/src/parsing/tplsqlparseoracle.cpp 2011-07-11 10:12:31 UTC (rev 4001) +++ branches/tora-trotl/src/parsing/tplsqlparseoracle.cpp 2011-07-11 15:32:29 UTC (rev 4002) @@ -15,9 +15,11 @@ class OraclePLSQLToken: public Token { public: - OraclePLSQLToken (Token *parent, const Position &pos, const QString &str, unsigned tokentype, unsigned usagetype = T_UNKNOWN) + OraclePLSQLToken (Token *parent, const Position &pos, const QString &str, unsigned tokentype, const char* tokentypenamestring, unsigned usagetype = T_UNKNOWN) : Token(parent, pos, str) { + _mTokenATypeName = tokentypenamestring; + TokenType &_mTokenTypeRef = const_cast<Token::TokenType&>(_mTokenType); switch(tokentype) { case T_RESERVED: @@ -177,7 +179,7 @@ , "" , Token::X_ROOT ); - _mAST->setTokenTypeName("ROOT"); + _mAST->setTokenATypeName("ROOT"); ANTLR3_UINT32 lastIndex = 0; treeWalk(psr, _mAST, langAST.tree, lastIndex); @@ -221,10 +223,11 @@ , Position(pChildLexeme->getLine(pChildLexeme), pChildLexeme->getCharPositionInLine(pChildLexeme)) , (const char*)pChildLexeme->getText(pChildLexeme)->chars , pChildLexeme->getType(pChildLexeme) + , (const char*) psr->pParser->rec->state->tokenNames[ pChildNode->getType(pChildNode) ] , (ANTLR3_UINT64)(pChildNode->u) ); root->appendChild(childToken); - childToken->setTokenTypeName( (const char*) psr->pParser->rec->state->tokenNames[ pChildNode->getType(pChildNode) ]); + //childToken->setTokenATypeName( (const char*) psr->pParser->rec->state->tokenNames[ pChildNode->getType(pChildNode) ]); treeWalk(psr, childToken, pChildNode, lastindex); } else { // if child is a leaf node /* this is a leaf node */ @@ -255,10 +258,11 @@ // if the attribute user1 is set then the token is considered to be an identifier // user2 represents either alias declaration or usage , pChildLexeme->user1 ? pChildLexeme->user1 : pChildLexeme->getType(pChildLexeme) + , (const char*) psr->pParser->rec->state->tokenNames[ pChildNode->getType(pChildNode) ] , pChildLexeme->user2 ? pChildLexeme->user2 : T_UNKNOWN ); root->appendChild(childToken); - childToken->setTokenTypeName( (const char*) psr->pParser->rec->state->tokenNames[ pChildNode->getType(pChildNode) ]); + //childToken->setTokenTypeName( (const char*) psr->pParser->rec->state->tokenNames[ pChildNode->getType(pChildNode) ]); // Process spaces and comments after parser_token while(++lastindex < lexemeTotal) { Modified: branches/tora-trotl/src/parsing/tsqlparse.h =================================================================== --- branches/tora-trotl/src/parsing/tsqlparse.h 2011-07-11 10:12:31 UTC (rev 4001) +++ branches/tora-trotl/src/parsing/tsqlparse.h 2011-07-11 15:32:29 UTC (rev 4002) @@ -27,6 +27,7 @@ inline unsigned getLine() const { return _mLine; }; inline unsigned getLinePos() const { return _mLinePos; }; inline QString toString() const { return QString("[%1,%2]").arg(_mLine).arg(_mLinePos); }; + inline bool operator== (const Position &other) const { return _mLine==other._mLine && _mLinePos==other._mLinePos; @@ -129,14 +130,6 @@ UsageL // Used in LVALUE }; - /* enum DisplayType */ - /* { */ - /* slComment, //= SL_COMMENT, */ - /* mlComment, //= ML_COMMENT, */ - /* keyword, */ - /* identifier */ - /* }; */ - Token(Token *parent, const Position &pos, const QString &str, const TokenType& tokentype = X_UNASSIGNED) : _mParent(parent) , _mPosition(pos) @@ -178,8 +171,8 @@ inline const TokenType& getTokenType() const { return _mTokenType; }; inline const char* getTokenTypeString() const { return TokenType2Text[_mTokenType]; }; - inline const QString& getTokenTypeName() const { return _mTokenTypeName; }; - inline void setTokenTypeName(QString const& name) { _mTokenTypeName = name; }; + inline const QString& getTokenATypeName() const { return _mTokenATypeName; }; + inline void setTokenATypeName(QString const& name) { _mTokenATypeName = name; }; inline const UsageType& getTokenUsageType() const { return _mUsageType; }; @@ -199,7 +192,7 @@ const QString _mStr; const TokenType _mTokenType; const UsageType _mUsageType; - QString _mTokenTypeName; + QString _mTokenATypeName; //ANTLR token type - for debugging purposes only // TODO use only one of them QList<QPointer<Token> > _mChildren; QList<QPointer<Token> > _mSpaces; Modified: branches/tora-trotl/src/parsing/tsqlparseoracle.cpp =================================================================== --- branches/tora-trotl/src/parsing/tsqlparseoracle.cpp 2011-07-11 10:12:31 UTC (rev 4001) +++ branches/tora-trotl/src/parsing/tsqlparseoracle.cpp 2011-07-11 15:32:29 UTC (rev 4002) @@ -15,9 +15,26 @@ class OracleSQLToken: public Token { public: - OracleSQLToken (Token *parent, const Position &pos, const QString &str, unsigned tokentype, unsigned usagetype = T_UNKNOWN) + OracleSQLToken (Token *parent, const Position &pos, const QString &str, unsigned tokentype, const char* tokentypestring, unsigned usagetype = T_UNKNOWN) : Token(parent, pos, str) { + _mTokenATypeName = tokentypestring; + + UsageType &_mUsageTypeRef = const_cast<Token::UsageType&>(_mUsageType); + switch(usagetype) + { + case 0: + case T_UNKNOWN: + _mUsageTypeRef = Unknown; + break; + case T_USE: + _mUsageTypeRef = Usage; + break; + case T_DECL: + _mUsageTypeRef = Declaration; + break; + } + TokenType &_mTokenTypeRef = const_cast<Token::TokenType&>(_mTokenType); switch(tokentype) { case T_UNKNOWN: @@ -30,6 +47,14 @@ _mTokenTypeRef = L_TABLENAME; break; case T_TABLE_ALIAS: + // Resolve grammar ambiguity: SELECT * FROM A INNER JOIN B; (=> INNER is not a table alias) + if( usagetype == T_DECL && (!str.compare("INNER", Qt::CaseInsensitive) || !str.compare("OUTER", Qt::CaseInsensitive))) + { + _mTokenTypeRef = L_RESERVED; + _mUsageTypeRef = Unknown; + _mTokenATypeName = "T_RESERVED"; + break; + } switch(parent->getTokenType()) { case S_WITH: @@ -90,20 +115,6 @@ break; } // switch(tokentype) - UsageType &_mUsageTypeRef = const_cast<Token::UsageType&>(_mUsageType); - switch(usagetype) - { - case 0: - case T_UNKNOWN: - _mUsageTypeRef = Unknown; - break; - case T_USE: - _mUsageTypeRef = Usage; - break; - case T_DECL: - _mUsageTypeRef = Declaration; - break; - } }; }; @@ -206,7 +217,7 @@ , "" , Token::X_ROOT ); - _mAST->setTokenTypeName("ROOT"); + _mAST->setTokenATypeName("ROOT"); ANTLR3_UINT32 lastIndex = 0; treeWalk(psr, _mAST, langAST.tree, lastIndex); @@ -259,9 +270,10 @@ , Position(pChildLexeme->getLine(pChildLexeme), pChildLexeme->getCharPositionInLine(pChildLexeme)) , (const char*)pChildLexeme->getText(pChildLexeme)->chars , pChildLexeme->getType(pChildLexeme) + , (const char*) psr->pParser->rec->state->tokenNames[ pChildNode->getType(pChildNode) ] , (ANTLR3_UINT64)(pChildNode->u) ); - childToken->setTokenTypeName( (const char*) psr->pParser->rec->state->tokenNames[ pChildNode->getType(pChildNode) ]); + //childToken->setTokenTypeName( (const char*) psr->pParser->rec->state->tokenNames[ pChildNode->getType(pChildNode) ]); root->appendChild(childToken); treeWalk(psr, childToken, pChildNode, lastindex); @@ -294,10 +306,11 @@ // if the attribute user1 is set then the token is considered to be an identifier // user2 represents either alias declaration or usage , pChildLexeme->user1 ? pChildLexeme->user1 : pChildLexeme->getType(pChildLexeme) + , (const char*) psr->pParser->rec->state->tokenNames[ pChildNode->getType(pChildNode) ] , pChildLexeme->user2 ? pChildLexeme->user2 : T_UNKNOWN ); root->appendChild(childToken); - childToken->setTokenTypeName( (const char*) psr->pParser->rec->state->tokenNames[ pChildNode->getType(pChildNode) ]); + //childToken->setTokenTypeName( (const char*) psr->pParser->rec->state->tokenNames[ pChildNode->getType(pChildNode) ]); // Process spaces and comments after parser_token while(++lastindex < lexemeTotal) Modified: branches/tora-trotl/src/toworksheet.cpp =================================================================== --- branches/tora-trotl/src/toworksheet.cpp 2011-07-11 10:12:31 UTC (rev 4001) +++ branches/tora-trotl/src/toworksheet.cpp 2011-07-11 15:32:29 UTC (rev 4002) @@ -1890,16 +1890,16 @@ SQLParser::Statement::token_const_iterator_to_root stackPath(&*currentToken); QTextStream buf(&buffer); - buf << "Cursor position: [" << cursor.getLine() << ", " << cursor.getLinePos() << "]\n" + buf << "Cursor position: " << cursor.toString() << "\n" << "Detail for the token: " << currentToken->toString() << "\n" - << "Positon: [" << currentToken->getPosition().getLine() << ", " << currentToken->getPosition().getLinePos() << "]\n" - << "Token type: " << currentToken->getTokenTypeName() << '\n' - << "Token subtype: " << currentToken->getTokenTypeString() << '\n'; + << "Positon: " << currentToken->getPosition().toString() << "\n" + << "Token AType: " << currentToken->getTokenATypeName() << '\n' + << "Token Type: " << currentToken->getTokenTypeString() << '\n'; QList<QString> stack; while(stackPath->parent()) { - QString t = stackPath->toString() + '(' + stackPath->getTokenTypeName() + ')'; + QString t = stackPath->toString() + '(' + stackPath->getTokenATypeName() + ')'; stack.push_back(t); stackPath++; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ibr...@us...> - 2011-07-23 19:41:37
|
Revision: 4007 http://tora.svn.sourceforge.net/tora/?rev=4007&view=rev Author: ibre5041 Date: 2011-07-23 19:41:31 +0000 (Sat, 23 Jul 2011) Log Message: ----------- sync with tora trunk Modified Paths: -------------- branches/tora-trotl/src/toqvalue.cpp branches/tora-trotl/src/toqvalue.h branches/tora-trotl/src/toresultmodel.cpp branches/tora-trotl/src/toresultmodel.h branches/tora-trotl/src/toresulttableviewedit.cpp Modified: branches/tora-trotl/src/toqvalue.cpp =================================================================== --- branches/tora-trotl/src/toqvalue.cpp 2011-07-23 19:20:40 UTC (rev 4006) +++ branches/tora-trotl/src/toqvalue.cpp 2011-07-23 19:41:31 UTC (rev 4007) @@ -74,6 +74,10 @@ { Value = d; } +toQValue::toQValue(toRowDesc d) +{ + Value.setValue(d); +} toQValue::toQValue(const toQValue ©) { @@ -231,6 +235,9 @@ bool toQValue::isComplexType(void) const { + //toRowDesc is special + if (Value.canConvert<toRowDesc>()) + return false; return Value.type() == QVariant::UserType; } @@ -281,6 +288,11 @@ { return Value.toDouble(); } +toRowDesc toQValue::getRowDesc() const +{ + Q_ASSERT(Value.canConvert<toRowDesc>()); + return Value.value<toRowDesc>(); +} qlonglong toQValue::toLong() const { Modified: branches/tora-trotl/src/toqvalue.h =================================================================== --- branches/tora-trotl/src/toqvalue.h 2011-07-23 19:20:40 UTC (rev 4006) +++ branches/tora-trotl/src/toqvalue.h 2011-07-23 19:41:31 UTC (rev 4007) @@ -48,6 +48,13 @@ #include <QString> #include <QVariant> +enum toRowStatus {EXISTED=1,ADDED,MODIFIED,REMOVED}; +struct toRowDesc +{ + int key; + toRowStatus status; +}; +Q_DECLARE_METATYPE(toRowDesc); /** * This is now a wrapper around QVariant to avoid a lot of memory @@ -109,6 +116,10 @@ * @param d Value. */ toQValue(qulonglong d); + /** Create row + * @param + */ + toQValue(toRowDesc d); /** Destruct query. */ ~toQValue(); @@ -169,6 +180,8 @@ */ double toDouble(void) const; + toRowDesc getRowDesc() const; + /** Used for DisplayRole */ QString displayData() const; Modified: branches/tora-trotl/src/toresultmodel.cpp =================================================================== --- branches/tora-trotl/src/toresultmodel.cpp 2011-07-23 19:20:40 UTC (rev 4006) +++ branches/tora-trotl/src/toresultmodel.cpp 2011-07-23 19:41:31 UTC (rev 4007) @@ -136,7 +136,11 @@ for (toCache::RowList::iterator i = tmp.begin(); i != tmp.end(); i++) { // For each row a mandatory rownumber integer should be added - row.append(toQValue(counter++)); + toRowDesc rowDesc; + rowDesc.key=counter++; + rowDesc.status=EXISTED; + row.append(toQValue(rowDesc)); + //row.append(toQValue(counter++)); // Copy all values of a record for (toCache::Row::iterator ii = (*i).begin(); ii != (*i).end(); ii++) { @@ -218,7 +222,11 @@ Row row; // The number column (rowKey). should never change - row.append(toQValue(CurrRowKey++)); + toRowDesc rowDesc; + rowDesc.key=CurrRowKey++; + rowDesc.status=EXISTED; + row.append(toQValue(rowDesc)); + //row.append(toQValue(CurrRowKey++)); for (int j = 1; (j < cols || j == 0) && Query->hasMore(); j++) row.append(Query->readValue()); @@ -308,17 +316,21 @@ beginInsertRows(QModelIndex(), newRowPos, newRowPos); Row row; + toRowDesc rowDesc; + rowDesc.key= CurrRowKey++; + rowDesc.status=ADDED; + if (duplicate) { // Create a duplicate of current row row = Rows[ind.row()]; // Reset a 0'th column - row[0] = CurrRowKey++; + row[0]=rowDesc; } else { // Create a new empty row - row.append(toQValue(CurrRowKey++)); + row.append(toQValue(rowDesc)); // null out the rest of the row int cols = Headers.size(); @@ -341,13 +353,47 @@ if (!index.isValid() || index.row() >= Rows.size()) return; + Row deleted = Rows[index.row()]; + toRowDesc rowDesc=deleted[0].getRowDesc(); + + if(rowDesc.status==REMOVED) + { + //Make sure removed row can't be removed twice + return; + }else if(rowDesc.status==ADDED) + { + //Newly added record can be removed regularly beginRemoveRows(QModelIndex(), index.row(), index.row()); - Row deleted = Rows.takeAt(index.row()); + Rows.takeAt(index.row()); endRemoveRows(); + }else //Existed and Modified + { + rowDesc.status=REMOVED; + Rows[index.row()][0]=toQValue(rowDesc); + } emit rowDeleted(deleted); } +void toResultModel::clearStatus() +{ + // Go through all records and set their status to be existed + for(QList<Row>::iterator ite=Rows.begin();ite!=Rows.end();ite++) + { + toRowDesc rowDesc = ite->at(0).getRowDesc(); + if(rowDesc.status==REMOVED) + { + ite=Rows.erase(ite); + } + else if(rowDesc.status!=EXISTED) + { + rowDesc.status=EXISTED; + (*ite)[0]=toQValue(rowDesc); + } + } + emit headerDataChanged(Qt::Vertical,0,Rows.size()-1); +} + QStringList toResultModel::mimeTypes() const { QStringList types; @@ -561,6 +607,9 @@ toQValue const &data = Rows.at(index.row()).at(index.column()); + toRowDesc rowDesc=Rows[index.row()][0].getRowDesc(); + QFont fontRet; + switch(role) { case Qt::ToolTipRole: @@ -594,6 +643,14 @@ return (int) Headers.at(index.column()).align; case Qt::UserRole: return data.toQVariant(); + case Qt::FontRole: + if (rowDesc.status==REMOVED) + fontRet.setStrikeOut(true); + else if (rowDesc.status==ADDED) + fontRet.setBold(true); + else if (rowDesc.status==MODIFIED) + fontRet.setItalic(true); + return fontRet; default: return QVariant(); } @@ -628,6 +685,10 @@ // for the view emit dataChanged(index, index); + + toRowDesc rowDesc = Rows.at(index.row())[0].getRowDesc(); + rowDesc.status = MODIFIED; + Rows[index.row()][0] = toQValue(rowDesc); return true; } @@ -663,8 +724,8 @@ Qt::Orientation orientation, int role) const { - if (role != Qt::DisplayRole) - return QVariant(); + /*if (role != Qt::DisplayRole) + return QVariant();*/ if (orientation == Qt::Horizontal) { @@ -674,11 +735,34 @@ if (section > Headers.size() - 1) return QVariant(); + if (role == Qt::DisplayRole) return Headers[section].name; + else + return QVariant(); } if (orientation == Qt::Vertical) + { + if (role == Qt::DisplayRole) return section + 1; + else if (role == Qt::ForegroundRole) + { + if(section<0 || section>Rows.size()) + return QVariant(); + toRowDesc rowDesc = Rows[section][0].getRowDesc(); + switch (rowDesc.status) { + case REMOVED: + return QBrush(Qt::red); + case ADDED: + return QBrush(Qt::green); + case MODIFIED: + return QBrush(Qt::blue); + case EXISTED: + default: + return QVariant(); + } + } + } return QVariant(); } @@ -822,14 +906,21 @@ } toQValue const &data = Rows.at(index.row()).at(index.column()); + toRowDesc rowDesc = Rows.at(index.row()).at(0).getRowDesc(); if (data.isComplexType()) { return ( defaultFlags | fl ) & ~Qt::ItemIsEditable; } if (Editable) - return fl | defaultFlags | Qt::ItemIsEditable | Qt::ItemIsDropEnabled; - return fl | defaultFlags; + fl |= defaultFlags | Qt::ItemIsEditable | Qt::ItemIsDropEnabled; + else + fl |= defaultFlags; + + //Check the status of current record + if (rowDesc.status==REMOVED) + fl &= ~Qt::ItemIsEditable; + return fl; } Modified: branches/tora-trotl/src/toresultmodel.h =================================================================== --- branches/tora-trotl/src/toresultmodel.h 2011-07-23 19:20:40 UTC (rev 4006) +++ branches/tora-trotl/src/toresultmodel.h 2011-07-23 19:41:31 UTC (rev 4007) @@ -45,17 +45,15 @@ #include "tosql.h" #include "toresult.h" #include "toconnection.h" - +#include "toqvalue.h" #include <QObject> #include <QAbstractTableModel> #include <QModelIndex> #include <QList> #include <QMap> -class toQValue; + class toEventQuery; - - class toResultModel : public QAbstractTableModel { Q_OBJECT; @@ -69,7 +67,7 @@ Qt::Alignment align; /* alignment */ }; - typedef QList<toQValue> Row; // NOTE: first (0th) value in a row is a row number (see variable currRowKey) + typedef QList<toQValue> Row; // NOTE: first (0th) value in a row is a row description (see variable currRowKey) typedef QList<Row> RowList; typedef QList<HeaderDesc> HeaderList; @@ -303,13 +301,18 @@ /** - * Delete a row interally. Emits rowDeleted on success. + * Mark to delete a row interally. Emits rowDeleted on success. * * This is not an overridden method. */ void deleteRow(QModelIndex); + /** + * Clear the status of records. + */ + void clearStatus(); + /** * Returns a list of MIME types that can be used to describe a * list of model indexes. Modified: branches/tora-trotl/src/toresulttableviewedit.cpp =================================================================== --- branches/tora-trotl/src/toresulttableviewedit.cpp 2011-07-23 19:20:40 UTC (rev 4006) +++ branches/tora-trotl/src/toresulttableviewedit.cpp 2011-07-23 19:41:31 UTC (rev 4007) @@ -142,10 +142,10 @@ { // first, if it was an added row, find and update the ChangeSet so // they all get inserted as one. - toQValue rowid = row[0]; + toQValue rowDesc = row[0]; for (int changeIndex = 0; changeIndex < Changes.size(); changeIndex++) { - if (Changes[changeIndex].kind == Add && Changes[changeIndex].row[0] == rowid) + if (Changes[changeIndex].kind == Add && Changes[changeIndex].row[0].getRowDesc().key == rowDesc.getRowDesc().key) { Changes[changeIndex].row[index.column()] = newValue; return; @@ -156,6 +156,7 @@ if (newValue == row[index.column()]) return; + struct ChangeSet change; change.columnName = model()->headerData(index.column(), @@ -195,7 +196,7 @@ while (j.hasNext() && !insertFound) { cs = j.next(); - if ((cs.row[0] == row[0]) && + if ((cs.row[0].getRowDesc().key == row[0].getRowDesc().key) && (cs.kind == Add)) { j.remove(); @@ -551,9 +552,11 @@ .arg(added, 0, 10) .arg(deleted, 0, 10) , false, false); - if (error) + /*if (error) refresh(); else + Changes.clear();*/ + if (!error) Changes.clear(); emit changed(changed()); @@ -571,9 +574,11 @@ if (cmt) { - commitChanges(false); + bool success = commitChanges(false); connection().commit(); // make sure to commit connection // where our changes are. + // some cleanup work + if (success) Model->clearStatus(); } else refresh(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ibr...@us...> - 2011-08-09 17:03:13
|
Revision: 4034 http://tora.svn.sourceforge.net/tora/?rev=4034&view=rev Author: ibre5041 Date: 2011-08-09 17:03:06 +0000 (Tue, 09 Aug 2011) Log Message: ----------- toThread::sleep function added. Modified Paths: -------------- branches/tora-trotl/src/tothread.cpp branches/tora-trotl/src/tothread.h Modified: branches/tora-trotl/src/tothread.cpp =================================================================== --- branches/tora-trotl/src/tothread.cpp 2011-08-09 17:01:49 UTC (rev 4033) +++ branches/tora-trotl/src/tothread.cpp 2011-08-09 17:03:06 UTC (rev 4034) @@ -136,6 +136,11 @@ taskRunner::msleep(msec); } +void toThread::sleep(int sec) +{ + taskRunner::sleep(sec); +} + taskRunner::taskRunner(toTask *task) : Task(task) {} Modified: branches/tora-trotl/src/tothread.h =================================================================== --- branches/tora-trotl/src/tothread.h 2011-08-09 17:01:49 UTC (rev 4033) +++ branches/tora-trotl/src/tothread.h 2011-08-09 17:03:06 UTC (rev 4034) @@ -197,6 +197,7 @@ void start(void); void startAsync(void); static void msleep(int msec); + static void sleep(int sec); static bool mainThread(void); /** This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ibr...@us...> - 2011-09-01 19:40:25
|
Revision: 4041 http://tora.svn.sourceforge.net/tora/?rev=4041&view=rev Author: ibre5041 Date: 2011-09-01 19:40:18 +0000 (Thu, 01 Sep 2011) Log Message: ----------- Modified Paths: -------------- branches/tora-trotl/src/tologger.h branches/tora-trotl/src/toworksheet.cpp branches/tora-trotl/src/trotl_test3.cpp branches/tora-trotl/src/trotl_test3.h Added Paths: ----------- branches/tora-trotl/src/docklets/toastwalk.cpp branches/tora-trotl/src/docklets/toastwalk.h branches/tora-trotl/src/docklets/toquerymodel.cpp branches/tora-trotl/src/docklets/toquerymodel.h Added: branches/tora-trotl/src/docklets/toastwalk.cpp =================================================================== --- branches/tora-trotl/src/docklets/toastwalk.cpp (rev 0) +++ branches/tora-trotl/src/docklets/toastwalk.cpp 2011-09-01 19:40:18 UTC (rev 4041) @@ -0,0 +1,8 @@ + +#include "toastwalk.h" +#include "../ermodel/dotgraph.h" +#include "../parsing/tsqlparse.h" + +void toASTWalk(SQLParser::Statement *source, KGraphViewer::DotGraph *target) +{ +}; Added: branches/tora-trotl/src/docklets/toastwalk.h =================================================================== --- branches/tora-trotl/src/docklets/toastwalk.h (rev 0) +++ branches/tora-trotl/src/docklets/toastwalk.h 2011-09-01 19:40:18 UTC (rev 4041) @@ -0,0 +1,55 @@ + +/* BEGIN_COMMON_COPYRIGHT_HEADER + * + * TOra - An Oracle Toolkit for DBA's and developers + * + * Shared/mixed copyright is held throughout files in this product + * + * Portions Copyright (C) 2000-2001 Underscore AB + * Portions Copyright (C) 2003-2005 Quest Software, Inc. + * Portions Copyright (C) 2004-2009 Numerous Other Contributors + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; only version 2 of + * the License is valid for this program. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * + * As a special exception, you have permission to link this program + * with the Oracle Client libraries and distribute executables, as long + * as you follow the requirements of the GNU GPL in regard to all of the + * software in the executable aside from Oracle client libraries. + * + * Specifically you are not permitted to link this program with the + * Qt/UNIX, Qt/Windows or Qt Non Commercial products of TrollTech. + * And you are not permitted to distribute binaries compiled against + * these libraries. + * + * You may link this product with any GPL'd Qt library. + * + * All trademarks belong to their respective owners. + * + * END_COMMON_COPYRIGHT_HEADER */ + +#ifndef TOASTWALK_H +#define TOASTWALK_H + +namespace SQLParser { + class Statement; +}; + +namespace KGraphViewer { + class DotGraph; +}; + +void toASTWalk(SQLParser::Statement *source, KGraphViewer::DotGraph *target); + +#endif Added: branches/tora-trotl/src/docklets/toquerymodel.cpp =================================================================== --- branches/tora-trotl/src/docklets/toquerymodel.cpp (rev 0) +++ branches/tora-trotl/src/docklets/toquerymodel.cpp 2011-09-01 19:40:18 UTC (rev 4041) @@ -0,0 +1,137 @@ + +/* BEGIN_COMMON_COPYRIGHT_HEADER + * + * TOra - An Oracle Toolkit for DBA's and developers + * + * Shared/mixed copyright is held throughout files in this product + * + * Portions Copyright (C) 2000-2001 Underscore AB + * Portions Copyright (C) 2003-2005 Quest Software, Inc. + * Portions Copyright (C) 2004-2009 Numerous Other Contributors + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; only version 2 of + * the License is valid for this program. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * + * As a special exception, you have permission to link this program + * with the Oracle Client libraries and distribute executables, as long + * as you follow the requirements of the GNU GPL in regard to all of the + * software in the executable aside from Oracle client libraries. + * + * Specifically you are not permitted to link this program with the + * Qt/UNIX, Qt/Windows or Qt Non Commercial products of TrollTech. + * And you are not permitted to distribute binaries compiled against + * these libraries. + * + * You may link this product with any GPL'd Qt library. + * + * All trademarks belong to their respective owners. + * + * END_COMMON_COPYRIGHT_HEADER */ + +#include "utils.h" +#include "toquerymodel.h" +//#include "tomain.h" +//#include "toconnectionmodel.h" + +//#include <QHeaderView> +#include <QTabWidget> +#include <QListView> + +#include "toastwalk.h" + +#include "ermodel/dotgraphview.h" +#include "ermodel/dotgraph.h" + +#define TOOL_NAME "QueryModel" + +REGISTER_VIEW(TOOL_NAME, toQueryModel); + +toQueryModel::toQueryModel(QWidget *parent, + Qt::WindowFlags flags) + : toDocklet(tr(TOOL_NAME), parent, flags) +{ + setObjectName("Query model"); + + { + m_widget = new KGraphViewer::DotGraphView( NULL /*actionCollection()*/, this); + m_widget->initEmpty(); + m_widget->setSizePolicy(QSizePolicy::Expanding,QSizePolicy::Expanding); + // connect( m_widget, SIGNAL( graphLoaded() ), + // this, SIGNAL( graphLoaded() ) ); + // connect( m_widget, SIGNAL( newEdgeAdded(const QString&, const QString&) ), + // this, SIGNAL( newEdgeAdded(const QString&, const QString&) ) ); + // connect( m_widget, SIGNAL( newNodeAdded(const QString&) ), + // this, SIGNAL( newNodeAdded(const QString&) ) ); + // connect( m_widget, SIGNAL( removeEdge(const QString&) ), + // this, SIGNAL( removeEdge(const QString&) ) ); + // connect( m_widget, SIGNAL( removeElement(const QString&) ), + // this, SIGNAL( removeElement(const QString&) ) ); + // connect( m_widget, SIGNAL( selectionIs(const QList<QString>, const QPoint&) ), + // this, SIGNAL( selectionIs(const QList<QString>, const QPoint&) ) ); + // connect( m_widget, + // SIGNAL( contextMenuEvent(const QString&, const QPoint&) ), + // this, + // SIGNAL( contextMenuEvent(const QString&, const QPoint&) ) ); + // connect( m_widget, + // SIGNAL( newEdgeFinished(const QString&, const QString&, const QMap<QString, QString>&) ), + // this, + // SIGNAL( newEdgeFinished(const QString&, const QString&, const QMap<QString, QString>&) ) ); + // connect( m_widget, SIGNAL( hoverEnter(const QString&)) , + // this, SIGNAL( hoverEnter(const QString&) ) ); + // connect( m_widget, SIGNAL( hoverLeave(const QString&)) , + // this, SIGNAL( hoverLeave(const QString&)) ); + ///m_widget->loadLibrary(QString("/tmp/example1.dot")); + + setFocusProxy(m_widget); // TODO ?? What is this?? + setWidget(m_widget); // TODO ?? What is this?? + }; +} + + +QIcon toQueryModel::icon() const +{ + return QIcon(":/icons/connect.xpm"); +} + + +QString toQueryModel::name() const +{ + return tr(TOOL_NAME); +} + +void toQueryModel::describeSlot(void) +{ + + GVC_t *gvc = gvContext(); + graph_t *g = agopen("TST", AGRAPH); + + m_widget->loadLibrary(g); + + QMap<QString,QString> ga; + ga["compound"] = "true"; + + m_widget->graph()->setGraphAttributes(ga); + + QMap<QString,QString> na; + na["name"] = "Acko"; + na["label"] = "AckoL"; + na["fontsize"] = "5"; + na["comment"]="ACKO"; + + m_widget->graph()->addNewNode(na); + + toASTWalk(NULL, m_widget->graph()); + + m_widget->graph()->update(); +} Added: branches/tora-trotl/src/docklets/toquerymodel.h =================================================================== --- branches/tora-trotl/src/docklets/toquerymodel.h (rev 0) +++ branches/tora-trotl/src/docklets/toquerymodel.h 2011-09-01 19:40:18 UTC (rev 4041) @@ -0,0 +1,83 @@ + +/* BEGIN_COMMON_COPYRIGHT_HEADER + * + * TOra - An Oracle Toolkit for DBA's and developers + * + * Shared/mixed copyright is held throughout files in this product + * + * Portions Copyright (C) 2000-2001 Underscore AB + * Portions Copyright (C) 2003-2005 Quest Software, Inc. + * Portions Copyright (C) 2004-2009 Numerous Other Contributors + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; only version 2 of + * the License is valid for this program. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * + * As a special exception, you have permission to link this program + * with the Oracle Client libraries and distribute executables, as long + * as you follow the requirements of the GNU GPL in regard to all of the + * software in the executable aside from Oracle client libraries. + * + * Specifically you are not permitted to link this program with the + * Qt/UNIX, Qt/Windows or Qt Non Commercial products of TrollTech. + * And you are not permitted to distribute binaries compiled against + * these libraries. + * + * You may link this product with any GPL'd Qt library. + * + * All trademarks belong to their respective owners. + * + * END_COMMON_COPYRIGHT_HEADER */ + +#ifndef TOQUERYMODEL_H +#define TOQUERYMODEL_H + +#include "config.h" +#include "todocklet.h" + +#include <QSortFilterProxyModel> + +namespace KGraphViewer { + class DotGraphView; +}; + +class toQueryModel : public toDocklet +{ + Q_OBJECT; + +private: + QSortFilterProxyModel *Model; + KGraphViewer::DotGraphView *m_widget; +public: + toQueryModel(QWidget *parent = 0, + Qt::WindowFlags flags = 0); + + /** + * Get the action icon name for this docklet + * + */ + virtual QIcon icon() const; + + /** + * Get the docklet's name + * + */ + virtual QString name() const; + + +public slots: + void describeSlot(void); +}; + + +#endif Modified: branches/tora-trotl/src/tologger.h =================================================================== --- branches/tora-trotl/src/tologger.h 2011-09-01 19:36:09 UTC (rev 4040) +++ branches/tora-trotl/src/tologger.h 2011-09-01 19:40:18 UTC (rev 4041) @@ -56,7 +56,8 @@ return thread_safe_log( log); } -// generic debug <0> - debugging(disabled) +// generic debug <0> - debugging(enabled) +/* template<> inline thread_safe_log templ_get_log_ownthread(int_to_type<0>*) { @@ -65,6 +66,7 @@ static internal_thread_safe_log_ownthread log( out ); return thread_safe_log( log); } +*/ // exceptions debug<1> - debugging(disabled) template<> Modified: branches/tora-trotl/src/toworksheet.cpp =================================================================== --- branches/tora-trotl/src/toworksheet.cpp 2011-09-01 19:36:09 UTC (rev 4040) +++ branches/tora-trotl/src/toworksheet.cpp 2011-09-01 19:40:18 UTC (rev 4041) @@ -1459,6 +1459,10 @@ t = t.mid(i); } + TLOG(0, toDecorator,__HERE__) + << "Current statements: [" << LastLine << ',' << LastOffset << ']' << std::endl + << t.toStdString() << std::endl; + if (t.trimmed().length()) query(t, type, sc); } @@ -1838,33 +1842,36 @@ firstWord = lexer->firstWord(); currentWord = lexer->currentWord(line, col); - if( QString::compare("CALL", firstWord, Qt::CaseInsensitive) == 0 || - QString::compare("ANALYZE", firstWord, Qt::CaseInsensitive) == 0 || - QString::compare("DECLARE", firstWord, Qt::CaseInsensitive) == 0 || - QString::compare("BEGIN", firstWord, Qt::CaseInsensitive) == 0 || - QString::compare("CREATE", firstWord, Qt::CaseInsensitive) == 0 || - QString::compare("ALTER", firstWord, Qt::CaseInsensitive) == 0 || - QString::compare("LOCK", firstWord, Qt::CaseInsensitive) == 0 || - QString::compare("EXPLAIN", firstWord, Qt::CaseInsensitive) == 0 || - QString::compare("DROP", firstWord, Qt::CaseInsensitive) == 0 || - QString::compare("COMMIT", firstWord, Qt::CaseInsensitive) == 0 || - QString::compare("ROLLBACK", firstWord, Qt::CaseInsensitive) == 0 || - QString::compare("GRANT", firstWord, Qt::CaseInsensitive) == 0 || - QString::compare("TRUNCATE", firstWord, Qt::CaseInsensitive) == 0 || - QString::compare("SAVEPOINT", firstWord, Qt::CaseInsensitive) == 0 || - QString::compare("SET", firstWord, Qt::CaseInsensitive) == 0 + if( + QString::compare("CALL", firstWord, Qt::CaseInsensitive) == 0 || + QString::compare("ANALYZE", firstWord, Qt::CaseInsensitive) == 0 || + QString::compare("DECLARE", firstWord, Qt::CaseInsensitive) == 0 || + QString::compare("BEGIN", firstWord, Qt::CaseInsensitive) == 0 || + QString::compare("CREATE", firstWord, Qt::CaseInsensitive) == 0 || + QString::compare("ALTER", firstWord, Qt::CaseInsensitive) == 0 || + QString::compare("LOCK", firstWord, Qt::CaseInsensitive) == 0 || + QString::compare("EXPLAIN", firstWord, Qt::CaseInsensitive) == 0 || + QString::compare("DROP", firstWord, Qt::CaseInsensitive) == 0 || + QString::compare("COMMIT", firstWord, Qt::CaseInsensitive) == 0 || + QString::compare("ROLLBACK", firstWord, Qt::CaseInsensitive) == 0 || + QString::compare("GRANT", firstWord, Qt::CaseInsensitive) == 0 || + QString::compare("TRUNCATE", firstWord, Qt::CaseInsensitive) == 0 || + QString::compare("SAVEPOINT", firstWord, Qt::CaseInsensitive) == 0 || + QString::compare("SET", firstWord, Qt::CaseInsensitive) == 0 ) { std::cout << "PLSQL:" << std::endl; stat = StatementFactTwoParmSing::Instance().create("OraclePLSQL", txt, ""); std::cout << stat->root()->toStringRecursive().toStdString() << std::endl; - } else if( QString::compare("WITH", firstWord, Qt::CaseInsensitive) == 0 || - QString::compare("SELECT", firstWord, Qt::CaseInsensitive) == 0 || - QString::compare("INSERT", firstWord, Qt::CaseInsensitive) == 0 || - QString::compare("UPDATE", firstWord, Qt::CaseInsensitive) == 0 || - QString::compare("DELETE", firstWord, Qt::CaseInsensitive) == 0 || - QString::compare("MERGE", firstWord, Qt::CaseInsensitive) == 0 - ) { + } else if( + QString::compare("WITH", firstWord, Qt::CaseInsensitive) == 0 || + QString::compare("SELECT", firstWord, Qt::CaseInsensitive) == 0 || + QString::compare("INSERT", firstWord, Qt::CaseInsensitive) == 0 || + QString::compare("UPDATE", firstWord, Qt::CaseInsensitive) == 0 || + QString::compare("DELETE", firstWord, Qt::CaseInsensitive) == 0 || + QString::compare("MERGE", firstWord, Qt::CaseInsensitive) == 0 + ) + { std::cout << "SQL:" << std::endl; stat = StatementFactTwoParmSing::Instance().create("OracleSQL", txt, ""); std::cout << stat->root()->toStringRecursive().toStdString() << std::endl; Modified: branches/tora-trotl/src/trotl_test3.cpp =================================================================== --- branches/tora-trotl/src/trotl_test3.cpp 2011-09-01 19:36:09 UTC (rev 4040) +++ branches/tora-trotl/src/trotl_test3.cpp 2011-09-01 19:40:18 UTC (rev 4041) @@ -60,6 +60,9 @@ #include "todocklet.h" #include "todockbar.h" +#include "ermodel/dotgraphview.h" +#include "ermodel/dotgraph.h" + #include <QStatusBar> bool toMonolithic(void) @@ -87,18 +90,52 @@ this->Workspace->setViewMode(QMdiArea::TabbedView); splitter->addWidget(this->Workspace); + m_describeAction = new QAction("&Describe", this); + createDocklets(); // Must be called after Wokspace is initialized //QFile pdfFile("/home/ivan/Documents/PDFs/11gr2_sql_reference_e17118.pdf"); - QFile pdfFile("./e17118.pdf"); - if( pdfFile.exists() ) - { - PDFViewWidget *pdf = new PDFViewWidget(splitter); - //pdf->openFile("/home/ivan/Documents/PDFs/11gr2_sql_reference_e17118.pdf"); - pdf->openFile("./e17118.pdf"); - pdf->setPage(4); - splitter->addWidget(pdf); - }; + // QFile pdfFile("./e17118.pdf"); + // if( pdfFile.exists() ) + // { + // PDFViewWidget *pdf = new PDFViewWidget(splitter); + // //pdf->openFile("/home/ivan/Documents/PDFs/11gr2_sql_reference_e17118.pdf"); + // pdf->openFile("./e17118.pdf"); + // pdf->setPage(4); + // splitter->addWidget(pdf); + // }; + + // { + // KGraphViewer::DotGraphView *m_widget = new KGraphViewer::DotGraphView( NULL /*actionCollection()*/, splitter); + // m_widget->initEmpty(); + // m_widget->setSizePolicy(QSizePolicy::Expanding,QSizePolicy::Expanding); + // // connect( m_widget, SIGNAL( graphLoaded() ), + // // this, SIGNAL( graphLoaded() ) ); + // // connect( m_widget, SIGNAL( newEdgeAdded(const QString&, const QString&) ), + // // this, SIGNAL( newEdgeAdded(const QString&, const QString&) ) ); + // // connect( m_widget, SIGNAL( newNodeAdded(const QString&) ), + // // this, SIGNAL( newNodeAdded(const QString&) ) ); + // // connect( m_widget, SIGNAL( removeEdge(const QString&) ), + // // this, SIGNAL( removeEdge(const QString&) ) ); + // // connect( m_widget, SIGNAL( removeElement(const QString&) ), + // // this, SIGNAL( removeElement(const QString&) ) ); + // // connect( m_widget, SIGNAL( selectionIs(const QList<QString>, const QPoint&) ), + // // this, SIGNAL( selectionIs(const QList<QString>, const QPoint&) ) ); + // // connect( m_widget, + // // SIGNAL( contextMenuEvent(const QString&, const QPoint&) ), + // // this, + // // SIGNAL( contextMenuEvent(const QString&, const QPoint&) ) ); + // // connect( m_widget, + // // SIGNAL( newEdgeFinished(const QString&, const QString&, const QMap<QString, QString>&) ), + // // this, + // // SIGNAL( newEdgeFinished(const QString&, const QString&, const QMap<QString, QString>&) ) ); + // // connect( m_widget, SIGNAL( hoverEnter(const QString&)) , + // // this, SIGNAL( hoverEnter(const QString&) ) ); + // // connect( m_widget, SIGNAL( hoverLeave(const QString&)) , + // // this, SIGNAL( hoverLeave(const QString&)) ); + // m_widget->loadLibrary(QString("/tmp/example1.dot")); + // splitter->addWidget(m_widget); + // }; this->setCentralWidget(splitter); @@ -127,9 +164,9 @@ i != ToolsRegistrySing::Instance().end(); ++i) { - //if(i.value()->name() == "SQL Editor") + if(i.value()->name() == "SQL Editor") //if(i.value()->name() == "Security Manager") - if(i.value()->name() == "Schema Browser") + //if(i.value()->name() == "Schema Browser") { i.value()->customSetup(); i.value()->createWindow(); Modified: branches/tora-trotl/src/trotl_test3.h =================================================================== --- branches/tora-trotl/src/trotl_test3.h 2011-09-01 19:36:09 UTC (rev 4040) +++ branches/tora-trotl/src/trotl_test3.h 2011-09-01 19:40:18 UTC (rev 4041) @@ -14,112 +14,117 @@ class TrotlTest3Window : public toMainWindow { - Q_OBJECT; + Q_OBJECT; - QMdiArea *Workspace; + QMdiArea *Workspace; - toDockbar *leftDockbar,*rightDockbar; + toDockbar *leftDockbar,*rightDockbar; + + std::list<toConnection *> Connections; - std::list<toConnection *> Connections; + QAction * m_describeAction; public: - TrotlTest3Window(QString, QString, QString, std::set<QString>&); + TrotlTest3Window(QString, QString, QString, std::set<QString>&); void createDockbars(); void createDocklets(); void moveDocklet(toDocklet *let, Qt::DockWidgetArea area); - + // All the toMainWindow methods must be "reimplemented" somehow. QMdiArea* workspace() const { return Workspace; }; - void addCustomMenu(QMenu *) const {}; - toBackgroundLabel* getBackgroundLabel() { return NULL; }; + void addCustomMenu(QMenu *) const {}; + toBackgroundLabel* getBackgroundLabel() { return NULL; }; - std::list<QString> connections(void) { return std::list<QString>(); }; - toConnection& connection(const QString &) { return *Connections.front(); } - void updateWindowsMenu() {}; - toConnection& currentConnection(void) - { - std::list<toConnection *>::iterator i = Connections.begin(); - if(i != Connections.end()) - return *(*i); - throw tr("Can't find active connection"); - } + std::list<QString> connections(void) { return std::list<QString>(); }; + toConnection& connection(const QString &) { return *Connections.front(); } + void updateWindowsMenu() {}; + toConnection& currentConnection(void) + { + std::list<toConnection *>::iterator i = Connections.begin(); + if(i != Connections.end()) + return *(*i); + throw tr("Can't find active connection"); + } - void checkCaching(void) {}; + void checkCaching(void) {}; - toDockbar* dockbar(toDocklet *let); + toDockbar* dockbar(toDocklet *let); - QMenu* getEditMenu() { return NULL; }; + QMenu* getEditMenu() { return NULL; }; - void addChart(toLineChart*) {}; - void addCustomMenu(QMenu*) {}; - void addRecentFile(const QString&) {}; - void changeConnection() {}; - void editSQL(const QString&) {}; - QAction* getCopyAction() { return NULL; }; - QAction* getCutAction() { return NULL; }; - QAction* getPasteAction() { return NULL; }; - QAction* getRedoAction() { return NULL; }; - QAction* getSelectAllAction() { return NULL; }; + void addChart(toLineChart*) {}; + void addCustomMenu(QMenu*) {}; + void addRecentFile(const QString&) {}; + void changeConnection() {}; + void editSQL(const QString&) {}; + + QAction* getDescribeAction() { return m_describeAction; }; + + QAction* getCopyAction() { return NULL; }; + QAction* getCutAction() { return NULL; }; + QAction* getPasteAction() { return NULL; }; + QAction* getRedoAction() { return NULL; }; + QAction* getSelectAllAction() { return NULL; }; - QAction* getUndoAction() { return NULL; }; - void registerSQLEditor(const QString&) {}; - void removeChart(toLineChart*) {}; - toSearchReplace* searchDialog() { return NULL; }; - void setCoordinates(int, int) {}; - void setNeedCommit(toConnection&, bool) {}; - void setupChart(toLineChart*) {}; - void showMessage(const QString&, bool, bool) {}; - void showMessageImpl(const QString&, bool, bool) {}; - void toolWidgetRemoved(toToolWidget*) {}; - void windowActivated(QMdiSubWindow*) {}; - void workspaceCloseWindow(int) {}; + QAction* getUndoAction() { return NULL; }; + void registerSQLEditor(const QString&) {}; + void removeChart(toLineChart*) {}; + toSearchReplace* searchDialog() { return NULL; }; + void setCoordinates(int, int) {}; + void setNeedCommit(toConnection&, bool) {}; + void setupChart(toLineChart*) {}; + void showMessage(const QString&, bool, bool) {}; + void showMessageImpl(const QString&, bool, bool) {}; + void toolWidgetRemoved(toToolWidget*) {}; + void windowActivated(QMdiSubWindow*) {}; + void workspaceCloseWindow(int) {}; - QMdiSubWindow* lastActiveWindow() const { return NULL; }; + QMdiSubWindow* lastActiveWindow() const { return NULL; }; - void toolWidgetAdded(toToolWidget *tool) {}; + void toolWidgetAdded(toToolWidget *tool) {}; - /** - * Add a new connection. The connection itself must already be created. - * Returns the connection or it's duplicate already opened connection. - */ - toConnection *addConnection(toConnection *conn, bool def = true) - { - /* int j = 0; */ - /* for (std::list<toConnection *>::iterator i = Connections.begin();i != Connections.end();i++, j++) */ - /* { */ - /* if ((*i)->description() == conn->description()) */ - /* { */ - /* ConnectionSelection->setCurrentIndex(j); */ - /* if (def) */ - /* createDefault(); */ - /* return *i; */ - /* } */ - /* } */ + /** + * Add a new connection. The connection itself must already be created. + * Returns the connection or it's duplicate already opened connection. + */ + toConnection *addConnection(toConnection *conn, bool def = true) + { + /* int j = 0; */ + /* for (std::list<toConnection *>::iterator i = Connections.begin();i != Connections.end();i++, j++) */ + /* { */ + /* if ((*i)->description() == conn->description()) */ + /* { */ + /* ConnectionSelection->setCurrentIndex(j); */ + /* if (def) */ + /* createDefault(); */ + /* return *i; */ + /* } */ + /* } */ - Connections.insert(Connections.end(), conn); - //ConnectionSelection->addItem(connectionColorPixmap(conn->color()), conn->description()); - //ConnectionSelection->setCurrentIndex(ConnectionSelection->count() - 1); + Connections.insert(Connections.end(), conn); + //ConnectionSelection->addItem(connectionColorPixmap(conn->color()), conn->description()); + //ConnectionSelection->setCurrentIndex(ConnectionSelection->count() - 1); - //if (ConnectionSelection->count() == 1) - //enableConnectionActions(true); + //if (ConnectionSelection->count() == 1) + //enableConnectionActions(true); - checkCaching(); + checkCaching(); - changeConnection(); - //emit addedConnection(conn->description()); + changeConnection(); + //emit addedConnection(conn->description()); - return conn; - } + return conn; + } - /** - * Open a file in sql worksheet - * - */ - void editOpenFile(QString file) {}; + /** + * Open a file in sql worksheet + * + */ + void editOpenFile(QString file) {}; - toEditWidget* editWidget() { return NULL; }; + toEditWidget* editWidget() { return NULL; }; - void createDefault(void) {}; + void createDefault(void) {}; }; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ibr...@us...> - 2011-09-01 22:34:47
|
Revision: 4042 http://tora.svn.sourceforge.net/tora/?rev=4042&view=rev Author: ibre5041 Date: 2011-09-01 22:34:41 +0000 (Thu, 01 Sep 2011) Log Message: ----------- Modified Paths: -------------- branches/tora-trotl/src/docklets/toquerymodel.cpp branches/tora-trotl/src/docklets/toquerymodel.h branches/tora-trotl/src/toeditwidget.h branches/tora-trotl/src/tomarkedtext.h Modified: branches/tora-trotl/src/docklets/toquerymodel.cpp =================================================================== --- branches/tora-trotl/src/docklets/toquerymodel.cpp 2011-09-01 19:40:18 UTC (rev 4041) +++ branches/tora-trotl/src/docklets/toquerymodel.cpp 2011-09-01 22:34:41 UTC (rev 4042) @@ -41,6 +41,9 @@ #include "utils.h" #include "toquerymodel.h" + +#include "tologger.h" + //#include "tomain.h" //#include "toconnectionmodel.h" @@ -48,6 +51,8 @@ #include <QTabWidget> #include <QListView> +#include <QTimerEvent> + #include "toastwalk.h" #include "ermodel/dotgraphview.h" @@ -57,11 +62,14 @@ REGISTER_VIEW(TOOL_NAME, toQueryModel); -toQueryModel::toQueryModel(QWidget *parent, - Qt::WindowFlags flags) - : toDocklet(tr(TOOL_NAME), parent, flags) +toQueryModel::toQueryModel(QWidget *parent, Qt::WindowFlags flags) + : toDocklet(tr(TOOL_NAME), parent, flags) + , m_widget(NULL) + , m_currentEditor(new editHandlerHolder()) + , m_timerID(-1) { setObjectName("Query model"); + toEditWidget::addHandler(m_currentEditor); { m_widget = new KGraphViewer::DotGraphView( NULL /*actionCollection()*/, this); @@ -95,9 +103,23 @@ setFocusProxy(m_widget); // TODO ?? What is this?? setWidget(m_widget); // TODO ?? What is this?? + + m_timerID = startTimer(5000); }; } +void toQueryModel::timerEvent(QTimerEvent *e) +{ + TLOG(0,toDecorator,__HERE__) << "void toQueryModel::timerEvent(QTimerEvent *e) fired" << std::endl; + + if( m_timerID == e->timerId()) + { + if( m_currentEditor ) + TLOG(0,toDecorator,__HERE__) << m_currentEditor->m_current->editText().toStdString() << std::endl; + } else { + toDocklet::timerEvent(e); + } +} QIcon toQueryModel::icon() const { Modified: branches/tora-trotl/src/docklets/toquerymodel.h =================================================================== --- branches/tora-trotl/src/docklets/toquerymodel.h 2011-09-01 19:40:18 UTC (rev 4041) +++ branches/tora-trotl/src/docklets/toquerymodel.h 2011-09-01 22:34:41 UTC (rev 4042) @@ -45,23 +45,45 @@ #include "config.h" #include "todocklet.h" +#include "toeditwidget.h" + #include <QSortFilterProxyModel> namespace KGraphViewer { class DotGraphView; }; +class QTimerEvent; class toQueryModel : public toDocklet { Q_OBJECT; + + class editHandlerHolder: public toEditWidget::editHandler + { + public: + virtual ~editHandlerHolder() {}; + virtual void receivedFocus(toEditWidget *widget) + { + m_current = widget; + + } + virtual void lostFocus(toEditWidget *widget) + { + m_current = NULL; + } + toEditWidget *m_current; + }; + private: - QSortFilterProxyModel *Model; + ///QSortFilterProxyModel *Model; KGraphViewer::DotGraphView *m_widget; -public: - toQueryModel(QWidget *parent = 0, - Qt::WindowFlags flags = 0); + editHandlerHolder *m_currentEditor; + int m_timerID; +public: + toQueryModel(QWidget *parent = 0, Qt::WindowFlags flags = 0); + /** * Get the action icon name for this docklet * @@ -74,7 +96,7 @@ */ virtual QString name() const; - + virtual void timerEvent(QTimerEvent *e); public slots: void describeSlot(void); }; Modified: branches/tora-trotl/src/toeditwidget.h =================================================================== --- branches/tora-trotl/src/toeditwidget.h 2011-09-01 19:40:18 UTC (rev 4041) +++ branches/tora-trotl/src/toeditwidget.h 2011-09-01 22:34:41 UTC (rev 4042) @@ -297,6 +297,12 @@ return ReadAll; } + /*! \brief Return all current text + This is pure virtual as it has to be implemented in all + separated children of toEditWidget. + */ + virtual QString editText() { return QString(); } + /*! \brief Search for next occrence of text This is pure virtual as it has to be implemented in all separated children of toEditWidget. @@ -317,7 +323,7 @@ separated children of toEditWidget. */ virtual void searchReplaceAll(const QString &newData) = 0; - + /*! \brief Check if data can be modified by search * @param all If true can replace all, otherwise can replace right now. */ Modified: branches/tora-trotl/src/tomarkedtext.h =================================================================== --- branches/tora-trotl/src/tomarkedtext.h 2011-09-01 19:40:18 UTC (rev 4041) +++ branches/tora-trotl/src/tomarkedtext.h 2011-09-01 22:34:41 UTC (rev 4042) @@ -228,6 +228,11 @@ */ virtual bool searchCanReplace(bool all); + virtual QString editText() + { + return text(); + }; + /** Start incremental search mode, or search next if started. */ void incrementalSearch(bool forward); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ibr...@us...> - 2011-09-02 20:48:20
|
Revision: 4046 http://tora.svn.sourceforge.net/tora/?rev=4046&view=rev Author: ibre5041 Date: 2011-09-02 20:45:28 +0000 (Fri, 02 Sep 2011) Log Message: ----------- Modified Paths: -------------- branches/tora-trotl/src/CMakeLists.txt branches/tora-trotl/src/docklets/tocodeoutline.cpp branches/tora-trotl/src/docklets/tocodeoutline.h branches/tora-trotl/src/docklets/toquerymodel.cpp branches/tora-trotl/src/docklets/toquerymodel.h branches/tora-trotl/src/libantlr3c-3.3/CMakeLists.txt branches/tora-trotl/src/parsing/OraclePLSQLLexer.c branches/tora-trotl/src/parsing/OraclePLSQLLexer.h branches/tora-trotl/src/parsing/OraclePLSQLParser.c branches/tora-trotl/src/parsing/OraclePLSQLParser.h branches/tora-trotl/src/parsing/tsqlparse.h branches/tora-trotl/src/toeditwidget.h branches/tora-trotl/src/trotl_test3.cpp Modified: branches/tora-trotl/src/CMakeLists.txt =================================================================== --- branches/tora-trotl/src/CMakeLists.txt 2011-09-02 20:01:07 UTC (rev 4045) +++ branches/tora-trotl/src/CMakeLists.txt 2011-09-02 20:45:28 UTC (rev 4046) @@ -598,7 +598,7 @@ ENDIF (USE_TROTL) IF (USE_ANTLR) - LIST(APPEND TORA_LIBS "libantlr3c") + LIST(APPEND TORA_LIBS "antlr3c") LIST(APPEND TORA_SOURCES "parsing/tsqlparse.cpp" "parsing/tsqlparseoracle.cpp" Modified: branches/tora-trotl/src/docklets/tocodeoutline.cpp =================================================================== --- branches/tora-trotl/src/docklets/tocodeoutline.cpp 2011-09-02 20:01:07 UTC (rev 4045) +++ branches/tora-trotl/src/docklets/tocodeoutline.cpp 2011-09-02 20:45:28 UTC (rev 4046) @@ -41,62 +41,118 @@ #include "utils.h" #include "tocodeoutline.h" +#include "tologger.h" + +#include "parsing/tsqlparse.h" + //#include "tomain.h" //#include "toconnectionmodel.h" //#include <QHeaderView> -#include <QTabWidget> -#include <QListView> +#include <QListWidget> +//#include <QListView> REGISTER_VIEW("Outline", toCodeOutline); toCodeOutline::toCodeOutline(QWidget *parent, Qt::WindowFlags flags) : toDocklet(tr("Outline"), parent, flags) -{ - int tabIndex; - setObjectName("Code Outline"); - + , m_currentEditor(new editHandlerHolder()) + , m_timerID(-1) +{ + setObjectName("Code Outline"); + toEditWidget::addHandler(m_currentEditor); + TabWidget = new QTabWidget(this); - QListView *procedures = new QListView(); - tabIndex = TabWidget->addTab(procedures, "Procedures"); - QListView *functions = new QListView(); - tabIndex = TabWidget->addTab(functions, "Functions"); - QListView *cursors = new QListView(); - tabIndex = TabWidget->addTab(cursors, "Cursors"); - QListView *types = new QListView(); - tabIndex = TabWidget->addTab(types, "Types"); - QListView *exceptions = new QListView(); - tabIndex = TabWidget->addTab(exceptions, "Exceptions"); + procedures = new QListWidget(); + TabWidget->addTab(procedures, "Procedures"); + functions = new QListWidget(); + TabWidget->addTab(functions, "Functions"); + + cursors = new QListWidget(); + TabWidget->addTab(cursors, "Cursors"); + + types = new QListWidget(); + TabWidget->addTab(types, "Types"); + + exceptions = new QListWidget(); + TabWidget->addTab(exceptions, "Exceptions"); + //setFocusProxy(TableView); // TODO ?? What is this?? setFocusProxy(TabWidget); - //Model = toNewConnection::proxyModel(); - //toNewConnection::connectionModel()->readConfig(); - //TableView->setModel(Model); - + //Model = toNewConnection::proxyModel(); + //toNewConnection::connectionModel()->readConfig(); + //TableView->setModel(Model); + //TableView->horizontalHeader()->setStretchLastSection(true); - // TableView->horizontalHeader()->setHighlightSections(false); - // TableView->verticalHeader()->setVisible(false); - // TableView->hideColumn(0); - // TableView->hideColumn(1); - // TableView->hideColumn(5); + // TableView->horizontalHeader()->setHighlightSections(false); + // TableView->verticalHeader()->setVisible(false); + // TableView->hideColumn(0); + // TableView->hideColumn(1); + // TableView->hideColumn(5); + + // TableView->setSelectionBehavior(QAbstractItemView::SelectRows); + // TableView->setSelectionMode(QAbstractItemView::ContiguousSelection); + // TableView->setAlternatingRowColors(true); + + // connect(TableView, + // SIGNAL(activated(const QModelIndex &)), + // this, + // SLOT(handleActivated(const QModelIndex &))); + + setWidget(TabWidget); - // TableView->setSelectionBehavior(QAbstractItemView::SelectRows); - // TableView->setSelectionMode(QAbstractItemView::ContiguousSelection); - // TableView->setAlternatingRowColors(true); + m_timerID = startTimer(5000); + TLOG(0,toDecorator,__HERE__) << "void toQueryModel::timerEvent(QTimerEvent *e) fired" << std::endl; +} - // connect(TableView, - // SIGNAL(activated(const QModelIndex &)), - // this, - // SLOT(handleActivated(const QModelIndex &))); +void toCodeOutline::timerEvent(QTimerEvent *e) +{ + QString newText; + + TLOG(0,toDecorator,__HERE__) << "void toQueryModel::timerEvent(QTimerEvent *e) fired" << std::endl; + + if( m_timerID != e->timerId()) + { + toDocklet::timerEvent(e); + return; + } + + if( m_currentEditor->m_current == NULL) + return; - setWidget(TabWidget); + newText = m_currentEditor->m_current->editText(); + if( newText == m_lastText) + return; + + m_lastText = newText; + TLOG(0,toDecorator,__HERE__) << "New text: " << std::endl << m_lastText << std::endl; + + try { + std::auto_ptr <SQLParser::Statement> stat = StatementFactTwoParmSing::Instance().create("OraclePLSQL", m_lastText, ""); + TLOG(0,toDecorator,__HERE__) << "Parsing ok:" << std::endl + << stat->root()->toStringRecursive().toStdString() << std::endl; + + procedures->clear(); + + QMap<QString, const SQLParser::Token*>::const_iterator i = stat->declarations().begin(); + for(; i != stat->declarations().end(); ++i) + { + TLOG(0,toDecorator,__HERE__) << i.key() << ' ' << i.value()->getPosition().toString() << std::endl; + QListWidgetItem *wi = new QListWidgetItem(i.key()); + wi->setToolTip(i.value()->getPosition().toString()); + procedures->addItem(wi); + } + } + catch ( SQLParser::ParseException const &e) + { + + } } - QIcon toCodeOutline::icon() const { return QIcon(":/icons/connect.xpm"); Modified: branches/tora-trotl/src/docklets/tocodeoutline.h =================================================================== --- branches/tora-trotl/src/docklets/tocodeoutline.h 2011-09-02 20:01:07 UTC (rev 4045) +++ branches/tora-trotl/src/docklets/tocodeoutline.h 2011-09-02 20:45:28 UTC (rev 4046) @@ -44,27 +44,47 @@ #include "config.h" #include "todocklet.h" +#include "toeditwidget.h" -#include <QSortFilterProxyModel> - +#include <QModelIndex> //class toToolWidget; //class toConnectionModel; class QTabWidget; +class QListWidget; class toCodeOutline : public toDocklet { Q_OBJECT; + class editHandlerHolder: public toEditWidget::editHandler + { + public: + virtual ~editHandlerHolder() {}; + virtual void receivedFocus(toEditWidget *widget) + { + m_current = widget; + + } + virtual void lostFocus(toEditWidget *widget) + { + m_current = NULL; + } + toEditWidget *m_current; + }; + private: - QSortFilterProxyModel *Model; - QTabWidget *TabWidget; + QTabWidget *TabWidget; + QListWidget *procedures, *functions, *cursors, *types, *exceptions; + + QString m_lastText; + editHandlerHolder *m_currentEditor; + int m_timerID; + void timerEvent(QTimerEvent *e); public: - toCodeOutline(QWidget *parent = 0, - Qt::WindowFlags flags = 0); + toCodeOutline(QWidget *parent = 0, Qt::WindowFlags flags = 0); - /** * Get the action icon name for this docklet * Modified: branches/tora-trotl/src/docklets/toquerymodel.cpp =================================================================== --- branches/tora-trotl/src/docklets/toquerymodel.cpp 2011-09-02 20:01:07 UTC (rev 4045) +++ branches/tora-trotl/src/docklets/toquerymodel.cpp 2011-09-02 20:45:28 UTC (rev 4046) @@ -103,22 +103,23 @@ setFocusProxy(m_widget); // TODO ?? What is this?? setWidget(m_widget); // TODO ?? What is this?? + }; - m_timerID = startTimer(5000); - }; + m_timerID = startTimer(5000); + TLOG(0,toDecorator,__HERE__) << "void toQueryModel::timerEvent(QTimerEvent *e) fired" << std::endl; } void toQueryModel::timerEvent(QTimerEvent *e) { - TLOG(0,toDecorator,__HERE__) << "void toQueryModel::timerEvent(QTimerEvent *e) fired" << std::endl; + // TLOG(0,toDecorator,__HERE__) << "void toQueryModel::timerEvent(QTimerEvent *e) fired" << std::endl; - if( m_timerID == e->timerId()) - { - if( m_currentEditor ) - TLOG(0,toDecorator,__HERE__) << m_currentEditor->m_current->editText().toStdString() << std::endl; - } else { - toDocklet::timerEvent(e); - } + // if( m_timerID == e->timerId()) + // { + // // if( m_currentEditor->m_current) + // // TLOG(0,toDecorator,__HERE__) << m_currentEditor->m_current->editText().toStdString() << std::endl; + // } else { + // toDocklet::timerEvent(e); + // } } QIcon toQueryModel::icon() const Modified: branches/tora-trotl/src/docklets/toquerymodel.h =================================================================== --- branches/tora-trotl/src/docklets/toquerymodel.h 2011-09-02 20:01:07 UTC (rev 4045) +++ branches/tora-trotl/src/docklets/toquerymodel.h 2011-09-02 20:45:28 UTC (rev 4046) @@ -58,7 +58,6 @@ { Q_OBJECT; - class editHandlerHolder: public toEditWidget::editHandler { public: @@ -76,11 +75,10 @@ }; private: - ///QSortFilterProxyModel *Model; KGraphViewer::DotGraphView *m_widget; + editHandlerHolder *m_currentEditor; int m_timerID; - public: toQueryModel(QWidget *parent = 0, Qt::WindowFlags flags = 0); Modified: branches/tora-trotl/src/libantlr3c-3.3/CMakeLists.txt =================================================================== --- branches/tora-trotl/src/libantlr3c-3.3/CMakeLists.txt 2011-09-02 20:01:07 UTC (rev 4045) +++ branches/tora-trotl/src/libantlr3c-3.3/CMakeLists.txt 2011-09-02 20:45:28 UTC (rev 4046) @@ -113,4 +113,4 @@ include_directories(include ${CMAKE_CURRENT_BINARY_DIR}) -add_library(libantlr3c STATIC ${ANTLR3_SRCS}) +add_library(antlr3c STATIC ${ANTLR3_SRCS}) Modified: branches/tora-trotl/src/parsing/OraclePLSQLLexer.c =================================================================== --- branches/tora-trotl/src/parsing/OraclePLSQLLexer.c 2011-09-02 20:01:07 UTC (rev 4045) +++ branches/tora-trotl/src/parsing/OraclePLSQLLexer.c 2011-09-02 20:45:28 UTC (rev 4046) @@ -1,21929 +1,21927 @@ -/** \file - * This C source file was generated by $ANTLR version 3.3 Nov 30, 2010 12:50:56 - * - * - From the grammar source file : OraclePLSQL.g - * - On : 2011-08-09 14:19:33 - * - for the lexer : OraclePLSQLLexerLexer * - * Editing it, at least manually, is not wise. - * - * C language generator and runtime by Jim Idle, jimi|hereisanat|idle|dotgoeshere|ws. - * - * -*/ -// [The "BSD licence"] -// Copyright (c) 2005-2009 Jim Idle, Temporal Wave LLC -// http://www.temporal-wave.com -// http://www.linkedin.com/in/jimidle -// -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// 3. The name of the author may not be used to endorse or promote products -// derived from this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR -// IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES -// OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. -// IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT -// NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF -// THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -/* ----------------------------------------- - * Include the ANTLR3 generated header file. - */ -#include "OraclePLSQLLexer.h" -/* ----------------------------------------- */ - - -/** String literals used by OraclePLSQLLexer that we must do things like MATCHS() with. - * C will normally just lay down 8 bit characters, and you can use L"xxx" to - * get wchar_t, but wchar_t is 16 bits on Windows, which is not UTF32 and so - * we perform this little trick of defining the literals as arrays of UINT32 - * and passing in the address of these. - */ -static ANTLR3_UCHAR lit_1[] = { 0x74, 0x5F, 0x75, 0x6E, 0x6B, 0x6E, 0x6F, 0x77, 0x6E, ANTLR3_STRING_TERMINATOR}; -static ANTLR3_UCHAR lit_2[] = { 0x74, 0x5F, 0x72, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x64, ANTLR3_STRING_TERMINATOR}; -static ANTLR3_UCHAR lit_3[] = { 0x74, 0x5F, 0x73, 0x63, 0x68, 0x65, 0x6D, 0x61, 0x5F, 0x6E, 0x61, 0x6D, 0x65, ANTLR3_STRING_TERMINATOR}; -static ANTLR3_UCHAR lit_4[] = { 0x74, 0x5F, 0x74, 0x72, 0x69, 0x67, 0x67, 0x65, 0x72, 0x5F, 0x6E, 0x61, 0x6D, 0x65, ANTLR3_STRING_TERMINATOR}; -static ANTLR3_UCHAR lit_5[] = { 0x74, 0x5F, 0x70, 0x61, 0x63, 0x6B, 0x61, 0x67, 0x65, 0x5F, 0x6E, 0x61, 0x6D, 0x65, ANTLR3_STRING_TERMINATOR}; -static ANTLR3_UCHAR lit_6[] = { 0x74, 0x5F, 0x66, 0x75, 0x6E, 0x63, 0x74, 0x69, 0x6F, 0x6E, 0x5F, 0x6E, 0x61, 0x6D, 0x65, ANTLR3_STRING_TERMINATOR}; -static ANTLR3_UCHAR lit_7[] = { 0x74, 0x5F, 0x70, 0x72, 0x6F, 0x63, 0x65, 0x64, 0x75, 0x72, 0x65, 0x5F, 0x6E, 0x61, 0x6D, 0x65, ANTLR3_STRING_TERMINATOR}; -static ANTLR3_UCHAR lit_8[] = { 0x74, 0x5F, 0x70, 0x61, 0x72, 0x61, 0x6D, 0x65, 0x74, 0x65, 0x72, 0x5F, 0x6E, 0x61, 0x6D, 0x65, ANTLR3_STRING_TERMINATOR}; -static ANTLR3_UCHAR lit_9[] = { 0x74, 0x5F, 0x62, 0x69, 0x6E, 0x64, 0x76, 0x61, 0x72, 0x5F, 0x6E, 0x61, 0x6D, 0x65, ANTLR3_STRING_TERMINATOR}; -static ANTLR3_UCHAR lit_10[] = { 0x74, 0x5F, 0x76, 0x61, 0x72, 0x69, 0x61, 0x62, 0x6C, 0x65, 0x5F, 0x6E, 0x61, 0x6D, 0x65, ANTLR3_STRING_TERMINATOR}; -static ANTLR3_UCHAR lit_11[] = { 0x74, 0x5F, 0x64, 0x61, 0x74, 0x61, 0x74, 0x79, 0x70, 0x65, 0x5F, 0x6E, 0x61, 0x6D, 0x65, ANTLR3_STRING_TERMINATOR}; -static ANTLR3_UCHAR lit_12[] = { 0x74, 0x5F, 0x63, 0x75, 0x72, 0x73, 0x6F, 0x72, 0x5F, 0x6E, 0x61, 0x6D, 0x65, ANTLR3_STRING_TERMINATOR}; -static ANTLR3_UCHAR lit_13[] = { 0x74, 0x5F, 0x74, 0x61, 0x62, 0x6C, 0x65, 0x5F, 0x6E, 0x61, 0x6D, 0x65, ANTLR3_STRING_TERMINATOR}; -static ANTLR3_UCHAR lit_14[] = { 0x74, 0x5F, 0x63, 0x6F, 0x6C, 0x75, 0x6D, 0x6E, 0x5F, 0x6E, 0x61, 0x6D, 0x65, ANTLR3_STRING_TERMINATOR}; -static ANTLR3_UCHAR lit_15[] = { 0x74, 0x5F, 0x6F, 0x62, 0x6A, 0x65, 0x63, 0x74, 0x5F, 0x6E, 0x61, 0x6D, 0x65, ANTLR3_STRING_TERMINATOR}; -static ANTLR3_UCHAR lit_16[] = { 0x74, 0x5F, 0x6C, 0x61, 0x62, 0x65, 0x6C, 0x5F, 0x6E, 0x61, 0x6D, 0x65, ANTLR3_STRING_TERMINATOR}; -static ANTLR3_UCHAR lit_17[] = { 0x74, 0x5F, 0x65, 0x78, 0x63, 0x65, 0x70, 0x74, 0x69, 0x6F, 0x6E, 0x5F, 0x6E, 0x61, 0x6D, 0x65, ANTLR3_STRING_TERMINATOR}; -static ANTLR3_UCHAR lit_18[] = { 0x74, 0x5F, 0x64, 0x62, 0x6C, 0x69, 0x6E, 0x6B, 0x5F, 0x6E, 0x61, 0x6D, 0x65, ANTLR3_STRING_TERMINATOR}; -static ANTLR3_UCHAR lit_19[] = { 0x74, 0x5F, 0x64, 0x65, 0x63, 0x6C, ANTLR3_STRING_TERMINATOR}; -static ANTLR3_UCHAR lit_20[] = { 0x74, 0x5F, 0x75, 0x73, 0x65, ANTLR3_STRING_TERMINATOR}; -static ANTLR3_UCHAR lit_21[] = { 0x74, 0x5F, 0x75, 0x73, 0x65, 0x6C, ANTLR3_STRING_TERMINATOR}; -static ANTLR3_UCHAR lit_22[] = { 0x74, 0x5F, 0x74, 0x79, 0x70, 0x65, 0x5F, 0x64, 0x65, 0x63, 0x6C, ANTLR3_STRING_TERMINATOR}; -static ANTLR3_UCHAR lit_23[] = { 0x74, 0x5F, 0x73, 0x75, 0x62, 0x74, 0x79, 0x70, 0x65, 0x5F, 0x64, 0x65, 0x63, 0x6C, ANTLR3_STRING_TERMINATOR}; -static ANTLR3_UCHAR lit_24[] = { 0x74, 0x5F, 0x63, 0x75, 0x72, 0x73, 0x6F, 0x72, 0x5F, 0x64, 0x65, 0x63, 0x6C, ANTLR3_STRING_TERMINATOR}; -static ANTLR3_UCHAR lit_25[] = { 0x74, 0x5F, 0x76, 0x61, 0x72, 0x69, 0x61, 0x62, 0x6C, 0x65, 0x5F, 0x64, 0x65, 0x63, 0x6C, ANTLR3_STRING_TERMINATOR}; -static ANTLR3_UCHAR lit_26[] = { 0x74, 0x5F, 0x63, 0x6F, 0x6E, 0x73, 0x74, 0x5F, 0x64, 0x65, 0x63, 0x6C, ANTLR3_STRING_TERMINATOR}; -static ANTLR3_UCHAR lit_27[] = { 0x74, 0x5F, 0x65, 0x78, 0x63, 0x5F, 0x64, 0x65, 0x63, 0x6C, ANTLR3_STRING_TERMINATOR}; -static ANTLR3_UCHAR lit_28[] = { 0x74, 0x5F, 0x66, 0x75, 0x6E, 0x63, 0x74, 0x69, 0x6F, 0x6E, 0x5F, 0x64, 0x65, 0x63, 0x6C, ANTLR3_STRING_TERMINATOR}; -static ANTLR3_UCHAR lit_29[] = { 0x74, 0x5F, 0x70, 0x72, 0x6F, 0x63, 0x65, 0x64, 0x75, 0x72, 0x65, 0x5F, 0x64, 0x65, 0x63, 0x6C, ANTLR3_STRING_TERMINATOR}; -static ANTLR3_UCHAR lit_30[] = { 0x74, 0x5F, 0x70, 0x72, 0x61, 0x67, 0x6D, 0x61, 0x5F, 0x64, 0x65, 0x63, 0x6C, ANTLR3_STRING_TERMINATOR}; -static ANTLR3_UCHAR lit_31[] = { 0x74, 0x5F, 0x64, 0x65, 0x63, 0x6C, 0x5F, 0x62, 0x6C, 0x6F, 0x63, 0x6B, ANTLR3_STRING_TERMINATOR}; -static ANTLR3_UCHAR lit_32[] = { 0x74, 0x5F, 0x62, 0x6C, 0x6F, 0x63, 0x6B, 0x5F, 0x62, 0x6C, 0x6F, 0x63, 0x6B, ANTLR3_STRING_TERMINATOR}; -static ANTLR3_UCHAR lit_33[] = { 0x74, 0x5F, 0x70, 0x72, 0x6F, 0x63, 0x65, 0x64, 0x75, 0x72, 0x65, 0x5F, 0x62, 0x6C, 0x6F, 0x63, 0x6B, ANTLR3_STRING_TERMINATOR}; -static ANTLR3_UCHAR lit_34[] = { 0x74, 0x5F, 0x66, 0x75, 0x6E, 0x63, 0x74, 0x69, 0x6F, 0x6E, 0x5F, 0x62, 0x6C, 0x6F, 0x63, 0x6B, ANTLR3_STRING_TERMINATOR}; -static ANTLR3_UCHAR lit_35[] = { 0x74, 0x5F, 0x64, 0x65, 0x63, 0x6C, 0x61, 0x72, 0x65, 0x5F, 0x62, 0x6C, 0x6F, 0x63, 0x6B, ANTLR3_STRING_TERMINATOR}; -static ANTLR3_UCHAR lit_36[] = { 0x74, 0x5F, 0x62, 0x65, 0x67, 0x69, 0x6E, 0x5F, 0x62, 0x6C, 0x6F, 0x63, 0x6B, ANTLR3_STRING_TERMINATOR}; -static ANTLR3_UCHAR lit_37[] = { 0x74, 0x5F, 0x65, 0x78, 0x63, 0x65, 0x70, 0x74, 0x69, 0x6F, 0x6E, 0x73, 0x5F, 0x62, 0x6C, 0x6F, 0x63, 0x6B, ANTLR3_STRING_TERMINATOR}; -static ANTLR3_UCHAR lit_38[] = { 0x74, 0x5F, 0x63, 0x6F, 0x6D, 0x6D, 0x69, 0x74, ANTLR3_STRING_TERMINATOR}; -static ANTLR3_UCHAR lit_39[] = { 0x74, 0x5F, 0x64, 0x65, 0x6C, 0x65, 0x74, 0x65, ANTLR3_STRING_TERMINATOR}; -static ANTLR3_UCHAR lit_40[] = { 0x74, 0x5F, 0x69, 0x6E, 0x73, 0x65, 0x72, 0x74, ANTLR3_STRING_TERMINATOR}; -static ANTLR3_UCHAR lit_41[] = { 0x74, 0x5F, 0x6C, 0x6F, 0x63, 0x6B, 0x5F, 0x74, 0x61, 0x62, 0x6C, 0x65, ANTLR3_STRING_TERMINATOR}; -static ANTLR3_UCHAR lit_42[] = { 0x74, 0x5F, 0x6D, 0x65, 0x72, 0x67, 0x65, ANTLR3_STRING_TERMINATOR}; -static ANTLR3_UCHAR lit_43[] = { 0x74, 0x5F, 0x72, 0x6F, 0x6C, 0x6C, 0x62, 0x61, 0x63, 0x6B, ANTLR3_STRING_TERMINATOR}; -static ANTLR3_UCHAR lit_44[] = { 0x74, 0x5F, 0x73, 0x61, 0x76, 0x65, 0x70, 0x6F, 0x69, 0x6E, 0x74, ANTLR3_STRING_TERMINATOR}; -static ANTLR3_UCHAR lit_45[] = { 0x74, 0x5F, 0x73, 0x65, 0x6C, 0x65, 0x63, 0x74, ANTLR3_STRING_TERMINATOR}; -static ANTLR3_UCHAR lit_46[] = { 0x74, 0x5F, 0x73, 0x65, 0x74, 0x5F, 0x74, 0x72, 0x61, 0x6E, 0x73, 0x61, 0x63, 0x74, 0x69, 0x6F, 0x6E, ANTLR3_STRING_TERMINATOR}; -static ANTLR3_UCHAR lit_47[] = { 0x74, 0x5F, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, ANTLR3_STRING_TERMINATOR}; -static ANTLR3_UCHAR lit_48[] = { 0x74, 0x5F, 0x65, 0x78, 0x65, 0x63, 0x75, 0x74, 0x65, 0x5F, 0x69, 0x6D, 0x6D, 0x65, 0x64, 0x69, 0x61, 0x74, 0x65, ANTLR3_STRING_TERMINATOR}; -static ANTLR3_UCHAR lit_49[] = { 0x74, 0x5F, 0x63, 0x61, 0x73, 0x65, ANTLR3_STRING_TERMINATOR}; -static ANTLR3_UCHAR lit_50[] = { 0x74, 0x5F, 0x6F, 0x70, 0x65, 0x6E, ANTLR3_STRING_TERMINATOR}; -static ANTLR3_UCHAR lit_51[] = { 0x74, 0x5F, 0x63, 0x6C, 0x6F, 0x73, 0x65, ANTLR3_STRING_TERMINATOR}; -static ANTLR3_UCHAR lit_52[] = { 0x74, 0x5F, 0x63, 0x6F, 0x6E, 0x74, 0x69, 0x6E, 0x75, 0x65, ANTLR3_STRING_TERMINATOR}; -static ANTLR3_UCHAR lit_53[] = { 0x74, 0x5F, 0x70, 0x69, 0x70, 0x65, ANTLR3_STRING_TERMINATOR}; -static ANTLR3_UCHAR lit_54[] = { 0x74, 0x5F, 0x67, 0x6F, 0x74, 0x6F, ANTLR3_STRING_TERMINATOR}; -static ANTLR3_UCHAR lit_55[] = { 0x74, 0x5F, 0x65, 0x78, 0x69, 0x74, ANTLR3_STRING_TERMINATOR}; -static ANTLR3_UCHAR lit_56[] = { 0x74, 0x5F, 0x72, 0x65, 0x74, 0x75, 0x72, 0x6E, ANTLR3_STRING_TERMINATOR}; -static ANTLR3_UCHAR lit_57[] = { 0x74, 0x5F, 0x64, 0x65, 0x63, 0x6C, 0x61, 0x72, 0x65, ANTLR3_STRING_TERMINATOR}; -static ANTLR3_UCHAR lit_58[] = { 0x74, 0x5F, 0x72, 0x61, 0x69, 0x73, 0x65, ANTLR3_STRING_TERMINATOR}; -static ANTLR3_UCHAR lit_59[] = { 0x74, 0x5F, 0x66, 0x65, 0x74, 0x63, 0x68, ANTLR3_STRING_TERMINATOR}; -static ANTLR3_UCHAR lit_60[] = { 0x74, 0x5F, 0x6C, 0x6F, 0x6F, 0x70, ANTLR3_STRING_TERMINATOR}; -static ANTLR3_UCHAR lit_61[] = { 0x74, 0x5F, 0x77, 0x68, 0x69, 0x6C, 0x65, ANTLR3_STRING_TERMINATOR}; -static ANTLR3_UCHAR lit_62[] = { 0x74, 0x5F, 0x6E, 0x75, 0x6C, 0x6C, ANTLR3_STRING_TERMINATOR}; -static ANTLR3_UCHAR lit_63[] = { 0x74, 0x5F, 0x66, 0x6F, 0x72, ANTLR3_STRING_TERMINATOR}; -static ANTLR3_UCHAR lit_64[] = { 0x74, 0x5F, 0x66, 0x6F, 0x72, 0x61, 0x6C, 0x6C, ANTLR3_STRING_TERMINATOR}; -static ANTLR3_UCHAR lit_65[] = { 0x74, 0x5F, 0x69, 0x66, ANTLR3_STRING_TERMINATOR}; -static ANTLR3_UCHAR lit_66[] = { 0x74, 0x5F, 0x65, 0x6C, 0x73, 0x69, 0x66, ANTLR3_STRING_TERMINATOR}; -static ANTLR3_UCHAR lit_67[] = { 0x74, 0x5F, 0x65, 0x6C, 0x73, 0x65, ANTLR3_STRING_TERMINATOR}; -static ANTLR3_UCHAR lit_68[] = { 0x74, 0x5F, 0x65, 0x6E, 0x64, 0x69, 0x66, ANTLR3_STRING_TERMINATOR}; -static ANTLR3_UCHAR lit_69[] = { 0x74, 0x5F, 0x61, 0x73, 0x73, 0x69, 0x67, 0x6E, ANTLR3_STRING_TERMINATOR}; -static ANTLR3_UCHAR lit_70[] = { 0x74, 0x5F, 0x63, 0x61, 0x6C, 0x6C, ANTLR3_STRING_TERMINATOR}; -static ANTLR3_UCHAR lit_71[] = { 0x74, 0x5F, 0x64, 0x65, 0x63, 0x6C, 0x61, 0x72, 0x61, 0x74, 0x69, 0x6F, 0x6E, ANTLR3_STRING_TERMINATOR}; -static ANTLR3_UCHAR lit_72[] = { 0x74, 0x5F, 0x73, 0x74, 0x61, 0x74, 0x65, 0x6D, 0x65, 0x6E, 0x74, ANTLR3_STRING_TERMINATOR}; -static ANTLR3_UCHAR lit_73[] = { 0x4C, 0x4F, 0x4F, 0x50, ANTLR3_STRING_TERMINATOR}; -static ANTLR3_UCHAR lit_74[] = { 0x46, 0x4F, 0x55, 0x4E, 0x44, ANTLR3_STRING_TERMINATOR}; -static ANTLR3_UCHAR lit_75[] = { 0x54, 0x49, 0x4D, 0x45, 0x53, 0x54, 0x41, 0x4D, 0x50, ANTLR3_STRING_TERMINATOR}; -static ANTLR3_UCHAR lit_76[] = { 0x52, 0x4F, 0x57, 0x43, 0x4F, 0x55, 0x4E, 0x54, ANTLR3_STRING_TERMINATOR}; -static ANTLR3_UCHAR lit_77[] = { 0x49, 0x4E, 0x54, 0x45, 0x52, 0x56, 0x41, 0x4C, ANTLR3_STRING_TERMINATOR}; -static ANTLR3_UCHAR lit_78[] = { 0x54, 0x59, 0x50, 0x45, ANTLR3_STRING_TERMINATOR}; -static ANTLR3_UCHAR lit_79[] = { 0x45, 0x58, 0x45, 0x43, 0x55, 0x54, 0x45, ANTLR3_STRING_TERMINATOR}; -static ANTLR3_UCHAR lit_80[] = { 0x4C, 0x41, 0x4E, 0x47, 0x55, 0x41, 0x47, 0x45, ANTLR3_STRING_TERMINATOR}; -static ANTLR3_UCHAR lit_81[] = { 0x44, 0x45, 0x4C, 0x45, 0x54, 0x45, ANTLR3_STRING_TERMINATOR}; -static ANTLR3_UCHAR lit_82[] = { 0x52, 0x41, 0x49, 0x53, 0x45, ANTLR3_STRING_TERMINATOR}; -static ANTLR3_UCHAR lit_83[] = { 0x4F, 0x50, 0x45, 0x4E, ANTLR3_STRING_TERMINATOR}; -static ANTLR3_UCHAR lit_84[] = { 0x43, 0x41, 0x4C, 0x4C, ANTLR3_STRING_TERMINATOR}; -static ANTLR3_UCHAR lit_85[] = { 0x41, 0x52, 0x52, 0x41, 0x59, ANTLR3_STRING_TERMINATOR}; -static ANTLR3_UCHAR lit_86[] = { 0x44, 0x45, 0x43, 0x4C, 0x41, 0x52, 0x45, ANTLR3_STRING_TERMINATOR}; -static ANTLR3_UCHAR lit_87[] = { 0x42, 0x45, 0x47, 0x49, 0x4E, ANTLR3_STRING_TERMINATOR}; -static ANTLR3_UCHAR lit_88[] = { 0x43, 0x48, 0x41, 0x52, ANTLR3_STRING_TERMINATOR}; -static ANTLR3_UCHAR lit_89[] = { 0x46, 0x52, 0x4F, 0x4D, ANTLR3_STRING_TERMINATOR}; -static ANTLR3_UCHAR lit_90[] = { 0x4C, 0x4F, 0x4E, 0x47, ANTLR3_STRING_TERMINATOR}; -static ANTLR3_UCHAR lit_91[] = { 0x52, 0x41, 0x57, ANTLR3_STRING_TERMINATOR}; -static ANTLR3_UCHAR lit_92[] = { 0x53, 0x45, 0x54, ANTLR3_STRING_TERMINATOR}; -static ANTLR3_UCHAR lit_93[] = { 0x54, 0x4F, ANTLR3_STRING_TERMINATOR}; -static ANTLR3_UCHAR lit_94[] = { 0x56, 0x41, 0x52, 0x43, 0x48, 0x41, 0x52, ANTLR3_STRING_TERMINATOR}; -static ANTLR3_UCHAR lit_95[] = { 0x56, 0x41, 0x52, 0x43, 0x48, 0x41, 0x52, 0x32, ANTLR3_STRING_TERMINATOR}; -static ANTLR3_UCHAR lit_96[] = { 0x57, 0x49, 0x54, 0x48, ANTLR3_STRING_TERMINATOR}; -static ANTLR3_UCHAR lit_97[] = { 0x41, 0x47, 0x47, 0x52, 0x45, 0x47, 0x41, 0x54, 0x45, ANTLR3_STRING_TERMINATOR}; -static ANTLR3_UCHAR lit_98[] = { 0x41, 0x4E, 0x44, ANTLR3_STRING_TERMINATOR}; -static ANTLR3_UCHAR lit_99[] = { 0x41, 0x53, ANTLR3_STRING_TERMINATOR}; -static ANTLR3_UCHAR lit_100[] = { 0x41, 0x55, 0x54, 0x48, 0x49, 0x44, ANTLR3_STRING_TERMINATOR}; -static ANTLR3_UCHAR lit_101[] = { 0x42, 0x45, 0x54, 0x57, 0x45, 0x45, 0x4E, ANTLR3_STRING_TERMINATOR}; -static ANTLR3_UCHAR lit_102[] = { 0x42, 0x4F, 0x44, 0x59, ANTLR3_STRING_TERMINATOR}; -static ANTLR3_UCHAR lit_103[] = { 0x42, 0x55, 0x4C, 0x4B, ANTLR3_STRING_TERMINATOR}; -static ANTLR3_UCHAR lit_104[] = { 0x42, 0x59, ANTLR3_STRING_TERMINATOR}; -static ANTLR3_UCHAR lit_105[] = { 0x43, 0x41, 0x53, 0x45, ANTLR3_STRING_TERMINATOR}; -static ANTLR3_UCHAR lit_106[] = { 0x43, 0x48, 0x41, 0x52, 0x41, 0x43, 0x54, 0x45, 0x52, ANTLR3_STRING_TERMINATOR}; -static ANTLR3_UCHAR lit_107[] = { 0x43, 0x52, 0x45, 0x41, 0x54, 0x45, ANTLR3_STRING_TERMINATOR}; -static ANTLR3_UCHAR lit_108[] = { 0x43, 0x4F, 0x4C, 0x4C, 0x45, 0x43, 0x54, ANTLR3_STRING_TERMINATOR}; -static ANTLR3_UCHAR lit_109[] = { 0x43, 0x4F, 0x4D, 0x4D, 0x49, 0x54, ANTLR3_STRING_TERMINATOR}; -static ANTLR3_UCHAR lit_110[] = { 0x43, 0x55, 0x52, 0x52, 0x45, 0x4E, 0x54, 0x5F, 0x55, 0x53, 0x45, 0x52, ANTLR3_STRING_TERMINATOR}; -static ANTLR3_UCHAR lit_111[] = { 0x44, 0x41, 0x54, 0x45, ANTLR3_STRING_TERMINATOR}; -static ANTLR3_UCHAR lit_112[] = { 0x44, 0x45, 0x46, 0x41, 0x55, 0x4C, 0x54, ANTLR3_STRING_TERMINATOR}; -static ANTLR3_UCHAR lit_113[] = { 0x44, 0x45, 0x46, 0x49, 0x4E, 0x45, 0x52, ANTLR3_STRING_TERMINATOR}; -static ANTLR3_UCHAR lit_114[] = { 0x45, 0x4C, 0x53, 0x45, ANTLR3_STRING_TERMINATOR}; -static ANTLR3_UCHAR lit_115[] = { 0x45, 0x4C, 0x53, 0x49, 0x46, ANTLR3_STRING_TERMINATOR}; -static ANTLR3_UCHAR lit_116[] = { 0x45, 0x58, 0x54, 0x45, 0x52, 0x4E, 0x41, 0x4C, ANTLR3_STRING_TERMINATOR}; -static ANTLR3_UCHAR lit_117[] = { 0x46, 0x41, 0x4C, 0x53, 0x45, ANTLR3_STRING_TERMINATOR}; -static ANTLR3_UCHAR lit_118[] = { 0x46, 0x45, 0x54, 0x43, 0x48, ANTLR3_STRING_TERMINATOR}; -static ANTLR3_UCHAR lit_119[] = { 0x46, 0x4F, 0x52, ANTLR3_STRING_TERMINATOR}; -static ANTLR3_UCHAR lit_120[] = { 0x46, 0x4F, 0x52, 0x41, 0x4C, 0x4C, ANTLR3_STRING_TERMINATOR}; -static ANTLR3_UCHAR lit_121[] = { 0x47, 0x4F, 0x54, 0x4F, ANTLR3_STRING_TERMINATOR}; -static ANTLR3_UCHAR lit_122[] = { 0x49, 0x46, ANTLR3_STRING_TERMINATOR}; -static ANTLR3_UCHAR lit_123[] = { 0x49, 0x4E, 0x44, 0x45, 0x58, ANTLR3_STRING_TERMINATOR}; -static ANTLR3_UCHAR lit_124[] = { 0x49, 0x4E, 0x53, 0x45, 0x52, 0x54, ANTLR3_STRING_TERMINATOR}; -static ANTLR3_UCHAR lit_125[] = { 0x49, 0x4E, 0x54, 0x4F, ANTLR3_STRING_TERMINATOR}; -static ANTLR3_UCHAR lit_126[] = { 0x49, 0x53, ANTLR3_STRING_TERMINATOR}; -static ANTLR3_UCHAR lit_127[] = { 0x4C, 0x49, 0x4B, 0x45, ANTLR3_STRING_TERMINATOR}; -static ANTLR3_UCHAR lit_128[] = { 0x4C, 0x49, 0x4D, 0x49, 0x54, ANTLR3_STRING_TERMINATOR}; -static ANTLR3_UCHAR lit_129[] = { 0x4C, 0x4F, 0x43, 0x4B, ANTLR3_STRING_TERMINATOR}; -static ANTLR3_UCHAR lit_130[] = { 0x4E, 0x43, 0x48, 0x41, 0x52, ANTLR3_STRING_TERMINATOR}; -static ANTLR3_UCHAR lit_131[] = { 0x4E, 0x4F, 0x54, ANTLR3_STRING_TERMINATOR}; -static ANTLR3_UCHAR lit_132[] = { 0x4E, 0x55, 0x4C, 0x4C, ANTLR3_STRING_TERMINATOR}; -static ANTLR3_UCHAR lit_133[] = { 0x4F, 0x52, ANTLR3_STRING_TERMINATOR}; -static ANTLR3_UCHAR lit_134[] = { 0x50, 0x41, 0x43, 0x4B, 0x41, 0x47, 0x45, ANTLR3_STRING_TERMINATOR}; -static ANTLR3_UCHAR lit_135[] = { 0x52, 0x4F, 0x4C, 0x4C, 0x42, 0x41, 0x43, 0x4B, ANTLR3_STRING_TERMINATOR}; -static ANTLR3_UCHAR lit_136[] = { 0x53, 0x41, 0x56, 0x45, 0x50, 0x4F, 0x49, 0x4E, 0x54, ANTLR3_STRING_TERMINATOR}; -static ANTLR3_UCHAR lit_137[] = { 0x53, 0x45, 0x4C, 0x45, 0x43, 0x54, ANTLR3_STRING_TERMINATOR}; -static ANTLR3_UCHAR lit_138[] = { 0x53, 0x51, 0x4C, ANTLR3_STRING_TERMINATOR}; -static ANTLR3_UCHAR lit_139[] = { 0x54, 0x41, 0x42, 0x4C, 0x45, ANTLR3_STRING_TERMINATOR}; -static ANTLR3_UCHAR lit_140[] = { 0x54, 0x52, 0x41, 0x4E, 0x53, 0x41, 0x43, 0x54, 0x49, 0x4F, 0x4E, ANTLR3_STRING_TERMINATOR}; -static ANTLR3_UCHAR lit_141[] = { 0x54, 0x52, 0x49, 0x47, 0x47, 0x45, 0x52, ANTLR3_STRING_TERMINATOR}; -static ANTLR3_UCHAR lit_142[] = { 0x54, 0x52, 0x55, 0x45, ANTLR3_STRING_TERMINATOR}; -static ANTLR3_UCHAR lit_143[] = { 0x54, 0x48, 0x45, 0x4E, ANTLR3_STRING_TERMINATOR}; -static ANTLR3_UCHAR lit_144[] = { 0x55, 0x50, 0x44, 0x41, 0x54, 0x45, ANTLR3_STRING_TERMINATOR}; -static ANTLR3_UCHAR lit_145[] = { 0x57, 0x48, 0x49, 0x4C, 0x45, ANTLR3_STRING_TERMINATOR}; -static ANTLR3_UCHAR lit_146[] = { 0x49, 0x4E, 0x53, 0x45, 0x52, 0x54, 0x49, 0x4E, 0x47, ANTLR3_STRING_TERMINATOR}; -static ANTLR3_UCHAR lit_147[] = { 0x55, 0x50, 0x44, 0x41, 0x54, 0x49, 0x4E, 0x47, ANTLR3_STRING_TERMINATOR}; -static ANTLR3_UCHAR lit_148[] = { 0x44, 0x45, 0x4C, 0x45, 0x54, 0x49, 0x4E, 0x47, ANTLR3_STRING_TERMINATOR}; -static ANTLR3_UCHAR lit_149[] = { 0x45, 0x58, 0x49, 0x53, 0x54, 0x53, ANTLR3_STRING_TERMINATOR}; -static ANTLR3_UCHAR lit_150[] = { 0x43, 0x41, 0x53, 0x54, ANTLR3_STRING_TERMINATOR}; -static ANTLR3_UCHAR lit_151[] = { 0x43, 0x4C, 0x4F, 0x42, ANTLR3_STRING_TERMINATOR}; -static ANTLR3_UCHAR lit_152[] = { 0x43, 0x4C, 0x4F, 0x53, 0x45, ANTLR3_STRING_TERMINATOR}; -static ANTLR3_UCHAR lit_153[] = { 0x43, 0x4F, 0x4E, 0x53, 0x54, 0x41, 0x4E, 0x54, ANTLR3_STRING_TERMINATOR}; -static ANTLR3_UCHAR lit_154[] = { 0x43, 0x4F, 0x4E, 0x54, 0x49, 0x4E, 0x55, 0x45, ANTLR3_STRING_TERMINATOR}; -static ANTLR3_UCHAR lit_155[] = { 0x43, 0x55, 0x52, 0x53, 0x4F, 0x52, ANTLR3_STRING_TERMINATOR}; -static ANTLR3_UCHAR lit_156[] = { 0x44, 0x45, 0x54, 0x45, 0x52, 0x4D, 0x49, 0x4E, 0x49, 0x53, 0x54, 0x49, 0x43, ANTLR3_STRING_TERMINATOR}; -static ANTLR3_UCHAR lit_157[] = { 0x45, 0x4E, 0x44, ANTLR3_STRING_TERMINATOR}; -static ANTLR3_UCHAR lit_158[] = { 0x45, 0x53, 0x43, 0x41, 0x50, 0x45, ANTLR3_STRING_TERMINATOR}; -static ANTLR3_UCHAR lit_159[] = { 0x45, 0x58, 0x43, 0x45, 0x50, 0x54, 0x49, 0x4F, 0x4E, ANTLR3_STRING_TERMINATOR}; -static ANTLR3_UCHAR lit_160[] = { 0x45, 0x58, 0x49, 0x54, ANTLR3_STRING_TERMINATOR}; -static ANTLR3_UCHAR lit_161[] = { 0x46, 0x55, 0x4E, 0x43, 0x54, 0x49, 0x4F, 0x4E, ANTLR3_STRING_TERMINATOR}; -static ANTLR3_UCHAR lit_162[] = { 0x49, 0x4D, 0x4D, 0x45, 0x44, 0x49, 0x41, 0x54, 0x45, ANTLR3_STRING_TERMINATOR}; -static ANTLR3_UCHAR lit_163[] = { 0x4D, 0x45, 0x52, 0x47, 0x45, ANTLR3_STRING_TERMINATOR}; -static ANTLR3_UCHAR lit_164[] = { 0x4E, 0x41, 0x54, 0x49, 0x4F, 0x4E, 0x41, 0x4C, ANTLR3_STRING_TERMINATOR}; -static ANTLR3_UCHAR lit_165[] = { 0x4E, 0x4F, 0x43, 0x4F, 0x50, 0x59, ANTLR3_STRING_TERMINATOR}; -static ANTLR3_UCHAR lit_166[] = { 0x4F, 0x54, 0x48, 0x45, 0x52, 0x53, ANTLR3_STRING_TERMINATOR}; -static ANTLR3_UCHAR lit_167[] = { 0x50, 0x41, 0x52, 0x41, 0x4C, 0x4C, 0x45, 0x4C, 0x5F, 0x45, 0x4E, 0x41, 0x42, 0x4C, 0x45, ANTLR3_STRING_TERMINATOR}; -static ANTLR3_UCHAR lit_168[] = { 0x50, 0x49, 0x50, 0x45, ANTLR3_STRING_TERMINATOR}; -static ANTLR3_UCHAR lit_169[] = { 0x50, 0x49, 0x50, 0x45, 0x4C, 0x49, 0x4E, 0x45, 0x44, ANTLR3_STRING_TERMINATOR}; -static ANTLR3_UCHAR lit_170[] = { 0x50, 0x52, 0x41, 0x47, 0x4D, 0x41, ANTLR3_STRING_TERMINATOR}; -static ANTLR3_UCHAR lit_171[] = { 0x50, 0x52, 0x4F, 0x43, 0x45, 0x44, 0x55, 0x52, 0x45, ANTLR3_STRING_TERMINATOR}; -static ANTLR3_UCHAR lit_172[] = { 0x52, 0x45, 0x43, 0x4F, 0x52, 0x44, ANTLR3_STRING_TERMINATOR}; -static ANTLR3_UCHAR lit_173[] = { 0x52, 0x45, 0x46, ANTLR3_STRING_TERMINATOR}; -static ANTLR3_UCHAR lit_174[] = { 0x52, 0x45, 0x53, 0x55, 0x4C, 0x54, 0x5F, 0x43, 0x41, 0x43, 0x48, 0x45, ANTLR3_STRING_TERMINATOR}; -static ANTLR3_UCHAR lit_175[] = { 0x52, 0x45, 0x54, 0x55, 0x52, 0x4E, ANTLR3_STRING_TERMINATOR}; -static ANTLR3_UCHAR lit_176[] = { 0x52, 0x45, 0x54, 0x55, 0x52, 0x4E, 0x49, 0x4E, 0x47, ANTLR3_STRING_TERMINATOR}; -static ANTLR3_UCHAR lit_177[] = { 0x52, 0x4F, 0x57, ANTLR3_STRING_TERMINATOR}; -static ANTLR3_UCHAR lit_178[] = { 0x52, 0x4F, 0x57, 0x54, 0x59, 0x50, 0x45, ANTLR3_STRING_TERMINATOR}; -static ANTLR3_UCHAR lit_179[] = { 0x53, 0x59, 0x53, 0x54, 0x49, 0x4D, 0x45, 0x53, 0x54, 0x41, 0x4D, 0x50, ANTLR3_STRING_TERMINATOR}; -static ANTLR3_UCHAR lit_180[] = { 0x53, 0x55, 0x42, 0x54, 0x59, 0x50, 0x45, ANTLR3_STRING_TERMINATOR}; -static ANTLR3_UCHAR lit_181[] = { 0x56, 0x41, 0x52, 0x52, 0x41, 0x59, ANTLR3_STRING_TERMINATOR}; -static ANTLR3_UCHAR lit_182[] = { 0x56, 0x41, 0x52, 0x59, 0x49, 0x4E, 0x47, ANTLR3_STRING_TERMINATOR}; -static ANTLR3_UCHAR lit_183[] = { 0x57, 0x48, 0x45, 0x4E, ANTLR3_STRING_TERMINATOR}; -static ANTLR3_UCHAR lit_184[] = { 0x4E, 0x4F, 0x54, 0x46, 0x4F, 0x55, 0x4E, 0x44, ANTLR3_STRING_TERMINATOR}; -static ANTLR3_UCHAR lit_185[] = { 0x49, 0x53, 0x4F, 0x50, 0x45, 0x4E, ANTLR3_STRING_TERMINATOR}; -static ANTLR3_UCHAR lit_186[] = { 0x42, 0x55, 0x4C, 0x4B, 0x5F, 0x52, 0x4F, 0x57, 0x43, 0x4F, 0x55, 0x4E, 0x54, ANTLR3_STRING_TERMINATOR}; -static ANTLR3_UCHAR lit_187[] = { 0x43, 0x48, 0x41, 0x52, 0x53, 0x45, 0x54, ANTLR3_STRING_TERMINATOR}; -static ANTLR3_UCHAR lit_188[] = { 0x49, 0x4E, ANTLR3_STRING_TERMINATOR}; -static ANTLR3_UCHAR lit_189[] = { 0x4F, 0x55, 0x54, ANTLR3_STRING_TERMINATOR}; -static ANTLR3_UCHAR lit_190[] = { 0x55, 0x53, 0x49, 0x4E, 0x47, ANTLR3_STRING_TERMINATOR}; -static ANTLR3_UCHAR lit_191[] = { 0x27, 0x27, ANTLR3_STRING_TERMINATOR}; -static ANTLR3_UCHAR lit_192[] = { 0x3C, 0x3C, ANTLR3_STRING_TERMINATOR}; -static ANTLR3_UCHAR lit_193[] = { 0x3E, 0x3E, ANTLR3_STRING_TERMINATOR}; -static ANTLR3_UCHAR lit_194[] = { 0x3A, 0x3D, ANTLR3_STRING_TERMINATOR}; -static ANTLR3_UCHAR lit_195[] = { 0x3D, 0x3E, ANTLR3_STRING_TERMINATOR}; -static ANTLR3_UCHAR lit_196[] = { 0x7C, 0x7C, ANTLR3_STRING_TERMINATOR}; -static ANTLR3_UCHAR lit_197[] = { 0x3C, 0x3E, ANTLR3_STRING_TERMINATOR}; -static ANTLR3_UCHAR lit_198[] = { 0x21, 0x3D, ANTLR3_STRING_TERMINATOR}; -static ANTLR3_UCHAR lit_199[] = { 0x5E, 0x3D, ANTLR3_STRING_TERMINATOR}; -static ANTLR3_UCHAR lit_200[] = { 0x7E, 0x3D, ANTLR3_STRING_TERMINATOR}; -static ANTLR3_UCHAR lit_201[] = { 0x3C, 0x3D, ANTLR3_STRING_TERMINATOR}; -static ANTLR3_UCHAR lit_202[] = { 0x3E, 0x3D, ANTLR3_STRING_TERMINATOR}; -static ANTLR3_UCHAR lit_203[] = { 0x2D, 0x2D, ANTLR3_STRING_TERMINATOR}; -static ANTLR3_UCHAR lit_204[] = { 0x2F, 0x2A, ANTLR3_STRING_TERMINATOR}; -static ANTLR3_UCHAR lit_205[] = { 0x2A, 0x2F, ANTLR3_STRING_TERMINATOR}; - - - - -/* MACROS that hide the C interface implementations from the - * generated code, which makes it a little more understandable to the human eye. - * I am very much against using C pre-processor macros for function calls and bits - * of code as you cannot see what is happening when single stepping in debuggers - * and so on. The exception (in my book at least) is for generated code, where you are - * not maintaining it, but may wish to read and understand it. If you single step it, you know that input() - * hides some indirect calls, but is always referring to the input stream. This is - * probably more readable than ctx->input->istream->input(snarfle0->blarg) and allows me to rejig - * the runtime interfaces without changing the generated code too often, without - * confusing the reader of the generated output, who may not wish to know the gory - * details of the interface inheritance. - */ - -#define CTX ctx - -/* Aids in accessing scopes for grammar programmers - */ -#undef SCOPE_TYPE -#undef SCOPE_STACK -#undef SCOPE_TOP -#define SCOPE_TYPE(scope) pOraclePLSQLLexer_##scope##_SCOPE -#define SCOPE_STACK(scope) pOraclePLSQLLexer_##scope##Stack -#define SCOPE_TOP(scope) ctx->pOraclePLSQLLexer_##scope##Top -#define SCOPE_SIZE(scope) ctx->pOraclePLSQLLexer_##scope##Stack_limit -#define SCOPE_INSTANCE(scope, i) (ctx->SCOPE_STACK(scope)->get(ctx->SCOPE_STACK(scope),i)) - - -/* Macros for accessing things in a lexer - */ -#undef LEXER -#undef RECOGNIZER -#undef RULEMEMO -#undef GETCHARINDEX -#undef GETLINE -#undef GETCHARPOSITIONINLINE -#undef EMIT -#undef EMITNEW -#undef MATCHC -#undef MATCHS -#undef MATCHRANGE -#undef LTOKEN -#undef HASFAILED -#undef FAILEDFLAG -#undef INPUT -#undef STRSTREAM -#undef LA -#undef HASEXCEPTION -#undef EXCEPTION -#undef CONSTRUCTEX -#undef CONSUME -#undef LRECOVER -#undef MARK -#undef REWIND -#undef REWINDLAST -#undef BACKTRACKING -#undef MATCHANY -#undef MEMOIZE -#undef HAVEPARSEDRULE -#undef GETTEXT -#undef INDEX -#undef SEEK -#undef PUSHSTREAM -#undef POPSTREAM -#undef SETTEXT -#undef SETTEXT8 - -#define LEXER ctx->pLexer -#define RECOGNIZER LEXER->rec -#define LEXSTATE RECOGNIZER->state -#define TOKSOURCE LEXSTATE->tokSource -#define GETCHARINDEX() LEXER->getCharIndex(LEXER) -#define GETLINE() LEXER->getLine(LEXER) -#define GETTEXT() LEXER->getText(LEXER) -#define GETCHARPOSITIONINLINE() LEXER->getCharPositionInLine(LEXER) -#define EMIT() LEXSTATE->type = _type; LEXER->emit(LEXER) -#define EMITNEW(t) LEXER->emitNew(LEXER, t) -#define MATCHC(c) LEXER->matchc(LEXER, c) -#define MATCHS(s) LEXER->matchs(LEXER, s) -#define MATCHRANGE(c1,c2) LEXER->matchRange(LEXER, c1, c2) -#define MATCHANY() LEXER->matchAny(LEXER) -#define LTOKEN LEXSTATE->token -#define HASFAILED() (LEXSTATE->failed == ANTLR3_TRUE) -#define BACKTRACKING LEXSTATE->backtracking -#define FAILEDFLAG LEXSTATE->failed -#define INPUT LEXER->input -#define STRSTREAM INPUT -#define ISTREAM INPUT->istream -#define INDEX() ISTREAM->index(ISTREAM) -#define SEEK(n) ISTREAM->seek(ISTREAM, n) -#define EOF_TOKEN &(LEXSTATE->tokSource->eofToken) -#define HASEXCEPTION() (LEXSTATE->error == ANTLR3_TRUE) -#define EXCEPTION LEXSTATE->exception -#define CONSTRUCTEX() RECOGNIZER->exConstruct(RECOGNIZER) -#define LRECOVER() LEXER->recover(LEXER) -#define MARK() ISTREAM->mark(ISTREAM) -#define REWIND(m) ISTREAM->rewind(ISTREAM, m) -#define REWINDLAST() ISTREAM->rewindLast(ISTREAM) -#define MEMOIZE(ri,si) RECOGNIZER->memoize(RECOGNIZER, ri, si) -#define HAVEPARSEDRULE(r) RECOGNIZER->alreadyParsedRule(RECOGNIZER, r) -#define PUSHSTREAM(str) LEXER->pushCharStream(LEXER, str) -#define POPSTREAM() LEXER->popCharStream(LEXER) -#define SETTEXT(str) LEXSTATE->text = str -#define SKIP() LEXSTATE->token = &(TOKSOURCE->skipToken) -#define USER1 LEXSTATE->user1 -#define USER2 LEXSTATE->user2 -#define USER3 LEXSTATE->user3 -#define CUSTOM LEXSTATE->custom -#define RULEMEMO LEXSTATE->ruleMemo -#define DBG RECOGNIZER->debugger - -/* If we have been told we can rely on the standard 8 bit or UTF16 input - * stream, then we can define our macros to use the direct pointers - * in the input object, which is much faster than indirect calls. This - * is really only significant to lexers with a lot of fragment rules (which - * do not place LA(1) in a temporary at the moment) and even then - * only if there is a lot of input (order of say 1M or so). - */ -#if defined(ANTLR3_INLINE_INPUT_8BIT) || defined(ANTLR3_INLINE_INPUT_UTF16) - -# ifdef ANTLR3_INLINE_INPUT_8BIT - -/* 8 bit character set */ - -# define NEXTCHAR ((pANTLR3_UINT8)(INPUT->nextChar)) -# define DATAP ((pANTLR3_UINT8)(INPUT->data)) - -# else - -# define NEXTCHAR ((pANTLR3_UINT16)(INPUT->nextChar)) -# define DATAP ((pANTLR3_UINT16)(INPUT->data)) - -# endif - -# define LA(n) ((NEXTCHAR + n) > (DATAP + INPUT->sizeBuf) ? ANTLR3_CHARSTREAM_EOF : (ANTLR3_UCHAR)(*(NEXTCHAR + n - 1))) -# define CONSUME() \ -{ \ - if (NEXTCHAR < (DATAP + INPUT->sizeBuf)) \ - { \ - INPUT->charPositionInLine++; \ - if ((ANTLR3_UCHAR)(*NEXTCHAR) == INPUT->newlineChar) \ - { \ - INPUT->line++; \ - INPUT->charPositionInLine = 0; \ - INPUT->currentLine = (void *)(NEXTCHAR + 1); \ - } \ - INPUT->nextChar = (void *)(NEXTCHAR + 1); \ - } \ -} - -#else - -// Pick up the input character by calling the input stream implementation. -// -#define CONSUME() INPUT->istream->consume(INPUT->istream) -#define LA(n) INPUT->istream->_LA(INPUT->istream, n) - -#endif -#define TOKTEXT(tok, txt) tok, (pANTLR3_UINT8)txt - -/* The 4 tokens defined below may well clash with your own #defines or token types. If so - * then for the present you must use different names for your defines as these are hard coded - * in the code generator. It would be better not to use such names internally, and maybe - * we can change this in a forthcoming release. I deliberately do not #undef these - * here as this will at least give you a redefined error somewhere if they clash. - */ -#define UP ANTLR3_TOKEN_UP -#define DOWN ANTLR3_TOKEN_DOWN -#define EOR ANTLR3_TOKEN_EOR -#define INVALID ANTLR3_TOKEN_INVALID - - -/* ============================================================================= - * Functions to create and destroy scopes. First come the rule scopes, followed - * by the global declared scopes. - */ - - - -/* ============================================================================= */ - -/* ============================================================================= - * Start of recognizer - */ - - -/* Forward declare the locally static matching functions we have generated and any predicate functions. - */ -static ANTLR3_INLINE void mT_UNKNOWN (pOraclePLSQLLexer ctx); -static ANTLR3_INLINE void mT_RESERVED (pOraclePLSQLLexer ctx); -static ANTLR3_INLINE void mT_SCHEMA_NAME (pOraclePLSQLLexer ctx); -static ANTLR3_INLINE void mT_TRIGGER_NAME (pOraclePLSQLLexer ctx); -static ANTLR3_INLINE void mT_PACKAGE_NAME (pOraclePLSQLLexer ctx); -static ANTLR3_INLINE void mT_FUNCTION_NAME (pOraclePLSQLLexer ctx); -static ANTLR3_INLINE void mT_PROCEDURE_NAME (pOraclePLSQLLexer ctx); -static ANTLR3_INLINE void mT_PARAMETER_NAME (pOraclePLSQLLexer ctx); -static ANTLR3_INLINE void mT_BINDVAR_NAME (pOraclePLSQLLexer ctx); -static ANTLR3_INLINE void mT_VARIABLE_NAME (pOraclePLSQLLexer ctx); -static ANTLR3_INLINE void mT_DATATYPE_NAME (pOraclePLSQLLexer ctx); -static ANTLR3_INLINE void mT_CURSOR_NAME (pOraclePLSQLLexer ctx); -static ANTLR3_INLINE void mT_TABLE_NAME (pOraclePLSQLLexer ctx); -static ANTLR3_INLINE void mT_COLUMN_NAME (pOraclePLSQLLexer ctx); -static ANTLR3_INLINE void mT_OBJECT_NAME (pOraclePLSQLLexer ctx); -static ANTLR3_INLINE void mT_LABEL_NAME (pOraclePLSQLLexer ctx); -static ANTLR3_INLINE void mT_EXCEPTION_NAME (pOraclePLSQLLexer ctx); -static ANTLR3_INLINE void mT_DBLINK_NAME (pOraclePLSQLLexer ctx); -static ANTLR3_INLINE void mT_DECL (pOraclePLSQLLexer ctx); -static ANTLR3_INLINE void mT_USE (pOraclePLSQLLexer ctx); -static ANTLR3_INLINE void mT_USEL (pOraclePLSQLLexer ctx); -static ANTLR3_INLINE void mT_TYPE_DECL (pOraclePLSQLLexer ctx); -static ANTLR3_INLINE void mT_SUBTYPE_DECL (pOraclePLSQLLexer ctx); -static ANTLR3_INLINE void mT_CURSOR_DECL (pOraclePLSQLLexer ctx); -static ANTLR3_INLINE void mT_VAR_DECL (pOraclePLSQLLexer ctx); -static ANTLR3_INLINE void mT_CONST_DECL (pOraclePLSQLLexer ctx); -static ANTLR3_INLINE void mT_EXC_DECL (pOraclePLSQLLexer ctx); -static ANTLR3_INLINE void mT_FUNCTION_DECL (pOraclePLSQLLexer ctx); -static ANTLR3_INLINE void mT_PROCEDURE_DECL (pOraclePLSQLLexer ctx); -static ANTLR3_INLINE void mT_PRAGMA_DECL (pOraclePLSQLLexer ctx); -static ANTLR3_INLINE void mT_DECL_BLOCK (pOraclePLSQLLexer ctx); -static ANTLR3_INLINE void mT_BLOCK_BLOCK (pOraclePLSQLLexer ctx); -static ANTLR3_INLINE void mT_PROCEDURE_BLOCK (pOraclePLSQLLexer ctx); -static ANTLR3_INLINE void mT_FUNCTION_BLOCK (pOraclePLSQLLexer ctx); -static ANTLR3_INLINE void mT_DECLARE_BLOCK (pOraclePLSQLLexer ctx); -static ANTLR3_INLINE void mT_BEGIN_BLOCK (pOraclePLSQLLexer ctx); -static ANTLR3_INLINE void mT_EXCEPTIONS_BLOCK (pOraclePLSQLLexer ctx); -static ANTLR3_INLINE void mT_COMMIT (pOraclePLSQLLexer ctx); -static ANTLR3_INLINE void mT_DELETE (pOraclePLSQLLexer ctx); -static ANTLR3_INLINE void mT_INSERT (pOraclePLSQLLexer ctx); -static ANTLR3_INLINE void mT_LOCK_TABLE (pOraclePLSQLLexer ctx); -static ANTLR3_INLINE void mT_MERGE (pOraclePLSQLLexer ctx); -static ANTLR3_INLINE void mT_ROLLBACK (pOraclePLSQLLexer ctx); -static ANTLR3_INLINE void mT_SAVEPOINT (pOraclePLSQLLexer ctx); -static ANTLR3_INLINE void mT_SELECT (pOraclePLSQLLexer ctx); -static ANTLR3_INLINE void mT_SET_TRANSACTION (pOraclePLSQLLexer ctx); -static ANTLR3_INLINE void mT_UPDATE (pOraclePLSQLLexer ctx); -static ANTLR3_INLINE void mT_EXECUTE_IMMEDIATE (pOraclePLSQLLexer ctx); -static ANTLR3_INLINE void mT_CASE (pOraclePLSQLLexer ctx); -static ANTLR3_INLINE void mT_OPEN (pOraclePLSQLLexer ctx); -static ANTLR3_INLINE void mT_CLOSE (pOraclePLSQLLexer ctx); -static ANTLR3_INLINE void mT_CONTINUE (pOraclePLSQLLexer ctx); -static ANTLR3_INLINE void mT_PIPE (pOraclePLSQLLexer ctx); -static ANTLR3_INLINE void mT_GOTO (pOraclePLSQLLexer ctx); -static ANTLR3_INLINE void mT_EXIT (pOraclePLSQLLexer ctx); -static ANTLR3_INLINE void mT_RETURN (pOraclePLSQLLexer ctx); -static ANTLR3_INLINE void mT_DECLARE (pOraclePLSQLLexer ctx); -static ANTLR3_INLINE void mT_RAISE (pOraclePLSQLLexer ctx); -static ANTLR3_INLINE void mT_FETCH (pOraclePLSQLLexer ctx); -static ANTLR3_INLINE void mT_LOOP (pOraclePLSQLLexer ctx); -static ANTLR3_INLINE void mT_WHILE (pOraclePLSQLLexer ctx); -static ANTLR3_INLINE void mT_NULL_STAT (pOraclePLSQLLexer ctx); -static ANTLR3_INLINE void mT_FOR (pOraclePLSQLLexer ctx); -static ANTLR3_INLINE void mT_FORALL (pOraclePLSQLLexer ctx); -static ANTLR3_INLINE void mT_IF (pOraclePLSQLLexer ctx); -static ANTLR3_INLINE void mT_ELSIF (pOraclePLSQLLexer ctx); -static ANTLR3_INLINE void mT_ELSE (pOraclePLSQLLexer ctx); -static ANTLR3_INLINE void mT_ENDIF (pOraclePLSQLLexer ctx); -static ANTLR3_INLINE void mT_ASSIGN (pOraclePLSQLLexer ctx); -static ANTLR3_INLINE void mT_CALL (pOraclePLSQLLexer ctx); -static ANTLR3_INLINE void mT_DECLARATION (pOraclePLSQLLexer ctx); -static ANTLR3_INLINE void mT_STATEMENT (pOraclePLSQLLexer ctx); -static ANTLR3_INLINE void mT__126 (pOraclePLSQLLexer ctx); -static ANTLR3_INLINE void mT__127 (pOraclePLSQLLexer ctx); -static ANTLR3_INLINE void mT__128 (pOraclePLSQLLexer ctx); -static ANTLR3_INLINE void mT__129 (pOraclePLSQLLexer ctx); -static ANTLR3_INLINE void mT__130 (pOraclePLSQLLexer ctx); -static ANTLR3_INLINE void mT__131 (pOraclePLSQLLexer ctx); -static ANTLR3_INLINE void mT__132 (pOraclePLSQLLexer ctx); -static ANTLR3_INLINE void mT__133 (pOraclePLSQLLexer ctx); -static ANTLR3_INLINE void mT__134 (pOraclePLSQLLexer ctx); -static ANTLR3_INLINE void mT__135 (pOraclePLSQLLexer ctx); -static ANTLR3_INLINE void mT__136 (pOraclePLSQLLexer ctx); -static ANTLR3_INLINE void mT__137 (pOraclePLSQLLexer ctx); -static ANTLR3_INLINE void mT__138 (pOraclePLSQLLexer ctx); -static ANTLR3_INLINE void mT__139 (pOraclePLSQLLexer ctx); -static ANTLR3_INLINE void mT__140 (pOraclePLSQLLexer ctx); -static ANTLR3_INLINE void mT__141 (pOraclePLSQLLexer ctx); -static ANTLR3_INLINE void mT__142 (pOraclePLSQLLexer ctx); -static ANTLR3_INLINE void mT__143 (pOraclePLSQLLexer ctx); -static ANTLR3_INLINE void mT__144 (pOraclePLSQLLexer ctx); -static ANTLR3_INLINE void mT__145 (pOraclePLSQLLexer ctx); -static ANTLR3_INLINE void mT__146 (pOraclePLSQLLexer ctx); -static ANTLR3_INLINE void mT__147 (pOraclePLSQLLexer ctx); -static ANTLR3_INLINE void mT__148 (pOraclePLSQLLexer ctx); -static ANTLR3_INLINE void mT__149 (pOraclePLSQLLexer ctx); -static ANTLR3_INLINE void mT__150 (pOraclePLSQLLexer ctx); -static ANTLR3_INLINE void mT__151 (pOraclePLSQLLexer ctx); -static ANTLR3_INLINE void mT__152 (pOraclePLSQLLexer ctx); -static ANTLR3_INLINE void mT__153 (pOraclePLSQLLexer ctx); -static ANTLR3_INLINE void mT__154 (pOraclePLSQLLexer ctx); -static ANTLR3_INLINE void mT__155 (pOraclePLSQLLexer ctx); -static ANTLR3_INLINE void mT__156 (pOraclePLSQLLexer ctx); -static ANTLR3_INLINE void mT__157 (pOraclePLSQLLexer ctx); -static ANTLR3_INLINE void mT__158 (pOraclePLSQLLexer ctx); -static ANTLR3_INLINE void mT__159 (pOraclePLSQLLexer ctx); -static ANTLR3_INLINE void mT__160 (pOraclePLSQLLexer ctx); -static ANTLR3_INLINE void mT__161 (pOraclePLSQLLexer ctx); -static ANTLR3_INLINE void mT__162 (pOraclePLSQLLexer ctx); -static ANTLR3_INLINE void mT__163 (pOraclePLSQLLexer ctx); -static ANTLR3_INLINE void mT__164 (pOraclePLSQLLexer ctx); -static ANTLR3_INLINE void mT__165 (pOraclePLSQLLexer ctx); -static ANTLR3_INLINE void mT__166 (pOraclePLSQLLexer ctx); -static ANTLR3_INLINE void mT__167 (pOraclePLSQLLexer ctx); -static ANTLR3_INLINE void mT__168 (pOraclePLSQLLexer ctx); -static ANTLR3_INLINE void mT__169 (pOraclePLSQLLexer ctx); -static ANTLR3_INLINE void mT__170 (pOraclePLSQLLexer ctx); -static ANTLR3_INLINE void mT__171 (pOraclePLSQLLexer ctx); -static ANTLR3_INLINE void mT__172 (pOraclePLSQLLexer ctx); -static ANTLR3_INLINE void mT__173 (pOraclePLSQLLexer ctx); -static ANTLR3_INLINE void mT__174 (pOraclePLSQLLexer ctx); -static ANTLR3_INLINE void mT__175 (pOraclePLSQLLexer ctx); -static ANTLR3_INLINE void mT__176 (pOraclePLSQLLexer ctx); -static ANTLR3_INLINE void mT__177 (pOraclePLSQLLexer ctx); -static ANTLR3_INLINE void mT__178 (pOraclePLSQLLexer ctx); -static ANTLR3_INLINE void mT__179 (pOraclePLSQLLexer ctx); -static ANTLR3_INLINE void mT__180 (pOraclePLSQLLexer ctx); -static ANTLR3_INLINE void mT__181 (pOraclePLSQLLexer ctx); -static ANTLR3_INLINE void mT__182 (pOraclePLSQLLexer ctx); -static ANTLR3_INLINE void mT__183 (pOraclePLSQLLexer ctx); -static ANTLR3_INLINE void mT__184 (pOraclePLSQLLexer ctx); -static ANTLR3_INLINE void mT__185 (pOraclePLSQLLexer ctx); -static ANTLR3_INLINE void mT__186 (pOraclePLSQLLexer ctx); -static ANTLR3_INLINE void mT__187 (pOraclePLSQLLexer ctx); -static ANTLR3_INLINE void mT__188 (pOraclePLSQLLexer ctx); -static ANTLR3_INLINE void mT__189 (pOraclePLSQLLexer ctx); -static ANTLR3_INLINE void mT__190 (pOraclePLSQLLexer ctx); -static ANTLR3_INLINE void mT__191 (pOraclePLSQLLexer ctx); -static ANTLR3_INLINE void mT__192 (pOraclePLSQLLexer ctx); -static ANTLR3_INLINE void mT__193 (pOraclePLSQLLexer ctx); -static ANTLR3_INLINE void mT__194 (pOraclePLSQLLexer ctx); -static ANTLR3_INLINE void mT__195 (pOraclePLSQLLexer ctx); -static ANTLR3_INLINE void mT__196 (pOraclePLSQLLexer ctx); -static ANTLR3_INLINE void mT__197 (pOraclePLSQLLexer ctx); -static ANTLR3_INLINE void mT__198 (pOraclePLSQLLexer ctx); -static ANTLR3_INLINE void mT__199 (pOraclePLSQLLexer ctx); -static ANTLR3_INLINE void mT__200 (pOraclePLSQLLexer ctx); -static ANTLR3_INLINE void mT__201 (pOraclePLSQLLexer ctx); -static ANTLR3_INLINE void mT__202 (pOraclePLSQLLexer ctx); -static ANTLR3_INLINE void mT__203 (pOraclePLSQLLexer ctx); -static ANTLR3_INLINE void mT__204 (pOraclePLSQLLexer ctx); -static ANTLR3_INLINE void mT__205 (pOraclePLSQLLexer ctx); -static ANTLR3_INLINE void mT__206 (pOraclePLSQLLexer ctx); -static ANTLR3_INLINE void mT__207 (pOraclePLSQLLexer ctx); -static ANTLR3_INLINE void mT__208 (pOraclePLSQLLexer ctx); -static ANTLR3_INLINE void mT__209 (pOraclePLSQLLexer ctx); -static ANTLR3_INLINE void mT__210 (pOraclePLSQLLexer ctx); -static ANTLR3_INLINE void mT__211 (pOraclePLSQLLexer ctx); -static ANTLR3_INLINE void mT__212 (pOraclePLSQLLexer ctx); -static ANTLR3_INLINE void mT__213 (pOraclePLSQLLexer ctx); -static ANTLR3_INLINE void mT__214 (pOraclePLSQLLexer ctx); -static ANTLR3_INLINE void mT__215 (pOraclePLSQLLexer ctx); -static ANTLR3_INLINE void mT__216 (pOraclePLSQLLexer ctx); -static ANTLR3_INLINE void mT__217 (pOraclePLSQLLexer ctx); -static ANTLR3_INLINE void mT__218 (pOraclePLSQLLexer ctx); -static ANTLR3_INLINE void mT__219 (pOraclePLSQLLexer ctx); -static ANTLR3_INLINE void mT__220 (pOraclePLSQLLexer ctx); -static ANTLR3_INLINE void mT__221 (pOraclePLSQLLexer ctx); -static ANTLR3_INLINE void mT__222 (pOraclePLSQLLexer ctx); -static ANTLR3_INLINE void mT__223 (pOraclePLSQLLexer ctx); -static ANTLR3_INLINE void mT__224 (pOraclePLSQLLexer ctx); -static ANTLR3_INLINE void mT__225 (pOraclePLSQLLexer ctx); -static ANTLR3_INLINE void mT__226 (pOraclePLSQLLexer ctx); -static ANTLR3_INLINE void mT__227 (pOraclePLSQLLexer ctx); -static ANTLR3_INLINE void mT__228 (pOraclePLSQLLexer ctx); -static ANTLR3_INLINE void mT__229 (pOraclePLSQLLexer ctx); -static ANTLR3_INLINE void mT__230 (pOraclePLSQLLexer ctx); -static ANTLR3_INLINE void mT__231 (pOraclePLSQLLexer ctx); -static ANTLR3_INLINE void mT__232 (pOraclePLSQLLexer ctx); -static ANTLR3_INLINE void mT__233 (pOraclePLSQLLexer ctx); -static ANTLR3_INLINE void mT__234 (pOraclePLSQLLexer ctx); -static ANTLR3_INLINE void mT__235 (pOraclePLSQLLexer ctx); -static ANTLR3_INLINE void mT__236 (pOraclePLSQLLexer ctx); -static ANTLR3_INLINE void mT__237 (pOraclePLSQLLexer ctx); -static ANTLR3_INLINE void mT__238 (pOraclePLSQLLexer ctx); -static ANTLR3_INLINE void mT__239 (pOraclePLSQLLexer ctx); -static ANTLR3_INLINE void mT__240 (pOraclePLSQLLexer ctx); -static ANTLR3_INLINE void mT__241 (pOraclePLSQLLexer ctx); -static ANTLR3_INLINE void mT__242 (pOraclePLSQLLexer ctx); -static ANTLR3_INLINE void mT__243 (pOraclePLSQLLexer ctx); -static ANTLR3_INLINE void mK_IN (pOraclePLSQLLexer ctx); -static ANTLR3_INLINE void mK_OUT (pOraclePLSQLLexer ctx); -static ANTLR3_INLINE void mK_USING (pOraclePLSQLLexer ctx); -static ANTLR3_INLINE void mQUOTED_STRING (pOraclePLSQLLexer ctx); -static ANTLR3_INLINE void mQSTRING (pOraclePLSQLLexer ctx); -static ANTLR3_INLINE void mQS_ANGLE (pOraclePLSQLLexer ctx); -static ANTLR3_INLINE void mQS_BRACE (pOraclePLSQLLexer ctx); -static ANTLR3_INLINE void mQS_BRACK (pOraclePLSQLLexer ctx); -static ANTLR3_INLINE void mQS_PAREN (pOraclePLSQLLexer ctx); -static ANTLR3_INLINE void mQS_OTHER_CH (pOraclePLSQLLexer ctx); -static ANTLR3_INLINE void mQS_OTHER (pOraclePLSQLLexer ctx); -static ANTLR3_INLINE void mBINDVAR (pOraclePLSQLLexer ctx); -static ANTLR3_INLINE void mID (pOraclePLSQLLexer ctx); -static ANTLR3_INLINE void mSEMI (pOraclePLSQLLexer ctx); -static ANTLR3_INLINE void mCOLON (pOraclePLSQLLexer ctx); -static ANTLR3_INLINE void mDOUBLEDOT (pOraclePLSQLLexer ctx); -static ANTLR3_INLINE void mDOT (pOraclePLSQLLexer ctx); -static ANTLR3_INLINE void mPOINT (pOraclePLSQLLexer ctx); -static ANTLR3_INLINE void mCOMMA (pOraclePLSQLLexer ctx); -static ANTLR3_INLINE void mASTERISK (pOraclePLSQLLexer ctx); -static ANTLR3_INLINE void mAT_SIGN (pOraclePLSQLLexer ctx); -static ANTLR3_INLINE void mRPAREN (pOraclePLSQLLexer ctx); -static ANTLR3_INLINE void mLPAREN (pOraclePLSQLLexer ctx); -static ANTLR3_INLINE void mRBRACK (pOraclePLSQLLexer ctx); -static ANTLR3_INLINE void mLBRACK (pOraclePLSQLLexer ctx); -static ANTLR3_INLINE void mPLUS (pOraclePLSQLLexer ctx); -static ANTLR3_INLINE void mMINUS (pOraclePLSQLLexer ctx); -static ANTLR3_INLINE void mDIVIDE (pOraclePLSQLLexer ctx); -static ANTLR3_INLINE void mEQ (pOraclePLSQLLexer ctx); -static ANTLR3_INLINE void mPERCENT (pOraclePLSQLLexer ctx); -static ANTLR3_INLINE void mLLABEL (pOraclePLSQLLexer ctx); -static ANTLR3_INLINE void mRLABEL (pOraclePLSQLLexer ctx); -static ANTLR3_INLINE void mASSIGN (pOraclePLSQLLexer ctx); -static ANTLR3_INLINE void mARROW (pOraclePLSQLLexer ctx); -static ANTLR3_INLINE void mVERTBAR (pOraclePLSQLLexer ctx); -static ANTLR3_INLINE void mDOUBLEVERTBAR (pOraclePLSQLLexer ctx); -static ANTLR3_INLINE void mNOT_EQ (pOraclePLSQLLexer ctx); -static ANTLR3_INLINE void mLTH (pOraclePLSQLLexer ctx); -static ANTLR3_INLINE void mLEQ (pOraclePLSQLLexer ctx); -static ANTLR3_INLINE void mGTH (pOraclePLSQLLexer ctx); -static ANTLR3_INLINE void mGEQ (pOraclePLSQLLexer ctx); -static ANTLR3_INLINE void mINTEGER (pOraclePLSQLLexer ctx); -static ANTLR3_INLINE void mREAL_NUMBER (pOraclePLSQLLexer ctx); -static ANTLR3_INLINE void mNUMBER_VALUE (pOraclePLSQLLexer ctx); -static ANTLR3_INLINE void mNUM (pOraclePLSQLLexer ctx); -static ANTLR3_INLINE void mQUOTE (pOraclePLSQLLexer ctx); -static ANTLR3_INLINE void mDOUBLEQUOTED_STRING (pOraclePLSQLLexer ctx); -static ANTLR3_INLINE void mWS (pOraclePLSQLLexer ctx); -static ANTLR3_INLINE void mSL_COMMENT (pOraclePLSQLLexer ctx); -static ANTLR3_INLINE void mML_COMMENT (pOraclePLSQLLexer ctx); -static ANTLR3_INLINE void mTokens (pOraclePLSQLLexer ctx); -static void OraclePLSQLLexerFree(pOraclePLSQLLexer ctx); - -/* ========================================================================= - * Lexer matching rules end. - * ========================================================================= - */ - - - -// public String getErrorHeader(RecognitionException e) { -// return getSourceName()+":"+e.line+":"+(e.charPositionInLine+1)+":"; -// } - -// needed for things like BETWEEN 1..2 where 1. would be treated as a literal -// JAVA version -// private boolean numberDotValid() { -// int i = 1; -// while (input.LA(i) >= '0' && input.LA(i) <= '9') { i++; } -// return input.LA(i) == '.' && input.LA(i+1) != '.'; -// } -// C version - unsigned numberDotValid(pOraclePLSQLLexer ctx) - { - int i = 1; - while (LA(i) >= '0' && LA(i) <= '9') i++; - return LA(i) == '.' && LA(i+1) != '.'; - } - - -static void -OraclePLSQLLexerFree (pOraclePLSQLLexer ctx) -{ - LEXER->free(LEXER); - - ANTLR3_FREE(ctx); -} - -static void -OraclePLSQLLexerReset (pOraclePLSQLLexer ctx) -{ - RECOGNIZER->reset(RECOGNIZER); -} - -/** \brief Name of the grammar file that generated this code - */ -static const char fileName[] = "OraclePLSQL.g"; - -/** \brief Return the name of the grammar file that generated this code. - */ -static const char * getGrammarFileName() -{ - return fileName; -} - -/** \brief Create a new lexer called OraclePLSQLLexer - * - * \param[in] instream Pointer to an initialized input stream - * \return - * - Success pOraclePLSQLLexer initialized for the lex start - * - Fail NULL - */ -ANTLR3_API pOraclePLSQLLexer OraclePLSQLLexerNew -(pANTLR3_INPUT_STREAM... [truncated message content] |
From: <ibr...@us...> - 2011-09-15 13:50:26
|
Revision: 4078 http://tora.svn.sourceforge.net/tora/?rev=4078&view=rev Author: ibre5041 Date: 2011-09-15 13:50:15 +0000 (Thu, 15 Sep 2011) Log Message: ----------- Fixes for compilation on MSVC Express 2010 (Do not use pluginDir) Modified Paths: -------------- branches/tora-trotl/src/CMakeLists.txt branches/tora-trotl/src/toconf.h branches/tora-trotl/src/toconfiguration.cpp Modified: branches/tora-trotl/src/CMakeLists.txt =================================================================== --- branches/tora-trotl/src/CMakeLists.txt 2011-09-15 13:49:20 UTC (rev 4077) +++ branches/tora-trotl/src/CMakeLists.txt 2011-09-15 13:50:15 UTC (rev 4078) @@ -543,6 +543,10 @@ INCLUDE_DIRECTORIES(${POPPLER_QT4_INCLUDE_DIR}) ENDIF (POPPLER_QT4_FOUND) +IF(graphviz_FOUND) + INCLUDE_DIRECTORIES(${graphviz_INCLUDE_DIRECTORIES}) +ENDIF(graphviz_FOUND) + # Handle win/mac special stuff - it's left empty for linux/unix SET (GUI_TYPE) IF (APPLE AND WANT_BUNDLE) Modified: branches/tora-trotl/src/toconf.h =================================================================== --- branches/tora-trotl/src/toconf.h 2011-09-15 13:49:20 UTC (rev 4077) +++ branches/tora-trotl/src/toconf.h 2011-09-15 13:50:15 UTC (rev 4078) @@ -81,7 +81,7 @@ #define CONF_OBJECT_NAMES_UPPER "ObjectNamesUpper" #define DEFAULT_OBJECT_NAMES_UPPER false #define CONF_COLOR "KeywordColor" -#define CONF_PLUGIN_DIR "PluginDir" +////#define CONF_PLUGIN_DIR "PluginDir" #define CONF_CACHE_DIR "CacheDir" #define CONF_CACHE_DISK "CacheDiskUse" #define DEFAULT_CACHE_DISK true Modified: branches/tora-trotl/src/toconfiguration.cpp =================================================================== --- branches/tora-trotl/src/toconfiguration.cpp 2011-09-15 13:49:20 UTC (rev 4077) +++ branches/tora-trotl/src/toconfiguration.cpp 2011-09-15 13:50:15 UTC (rev 4078) @@ -325,7 +325,7 @@ m_keywordUpper = s.value(CONF_KEYWORD_UPPER, DEFAULT_KEYWORD_UPPER).toBool(); m_objectNamesUpper = s.value(CONF_OBJECT_NAMES_UPPER, DEFAULT_OBJECT_NAMES_UPPER).toBool(); - m_pluginDir = s.value(CONF_PLUGIN_DIR, DEFAULT_PLUGIN_DIR).toString(); +/// m_pluginDir = s.value(CONF_PLUGIN_DIR, DEFAULT_PLUGIN_DIR).toString(); m_cacheDir = s.value(CONF_CACHE_DIR, "").toString(); m_cacheDisk = s.value(CONF_CACHE_DISK, DEFAULT_CACHE_DISK).toBool(); m_sqlFile = s.value(CONF_SQL_FILE, getSpecialDir() + DEFAULT_SQL_FILE).toString(); @@ -581,7 +581,7 @@ s.setValue(CONF_HIGHLIGHT, m_highlight); s.setValue(CONF_KEYWORD_UPPER, m_keywordUpper); s.setValue(CONF_OBJECT_NAMES_UPPER, m_objectNamesUpper); - s.setValue(CONF_PLUGIN_DIR, m_pluginDir); +/// s.setValue(CONF_PLUGIN_DIR, m_pluginDir); s.setValue(CONF_CACHE_DIR, m_cacheDir); s.setValue(CONF_CACHE_DISK, m_cacheDisk); s.setValue(CONF_SQL_FILE, m_sqlFile); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ibr...@us...> - 2011-09-16 12:47:28
|
Revision: 4083 http://tora.svn.sourceforge.net/tora/?rev=4083&view=rev Author: ibre5041 Date: 2011-09-16 12:47:21 +0000 (Fri, 16 Sep 2011) Log Message: ----------- Information stored in Tokens Modified Paths: -------------- branches/tora-trotl/src/docklets/toastwalk.cpp branches/tora-trotl/src/docklets/tocodeoutline.cpp branches/tora-trotl/src/docklets/toquerymodel.cpp branches/tora-trotl/src/parsing/tsqlparse.cpp branches/tora-trotl/src/parsing/tsqlparse.h branches/tora-trotl/src/parsing/tsqlparseoracle.cpp Removed Paths: ------------- branches/tora-trotl/src/parsing/tsqlparse.tcc Modified: branches/tora-trotl/src/docklets/toastwalk.cpp =================================================================== --- branches/tora-trotl/src/docklets/toastwalk.cpp 2011-09-15 15:36:14 UTC (rev 4082) +++ branches/tora-trotl/src/docklets/toastwalk.cpp 2011-09-16 12:47:21 UTC (rev 4083) @@ -23,5 +23,18 @@ target->addNewNode(node); } + + SQLParser::Statement::token_const_iterator node; + for(node=source->begin(); node!=source->end(); ++node) + { + switch(node->getTokenType()) + { + case SQLParser::Token::S_SUBQUERY_FACTORED: + break; + case SQLParser::Token::S_SUBQUERY_NESTED: + break; + } + } + target->update(); }; Modified: branches/tora-trotl/src/docklets/tocodeoutline.cpp =================================================================== --- branches/tora-trotl/src/docklets/tocodeoutline.cpp 2011-09-15 15:36:14 UTC (rev 4082) +++ branches/tora-trotl/src/docklets/tocodeoutline.cpp 2011-09-16 12:47:21 UTC (rev 4083) @@ -129,6 +129,10 @@ return; m_lastText = newText; + + if(newText.isEmpty()) + return; + TLOG(0,toDecorator,__HERE__) << "New text: " << std::endl << m_lastText << std::endl; try { Modified: branches/tora-trotl/src/docklets/toquerymodel.cpp =================================================================== --- branches/tora-trotl/src/docklets/toquerymodel.cpp 2011-09-15 15:36:14 UTC (rev 4082) +++ branches/tora-trotl/src/docklets/toquerymodel.cpp 2011-09-16 12:47:21 UTC (rev 4083) @@ -179,6 +179,9 @@ m_lastText = newText; + if(newText.isEmpty()) + return; + try { std::auto_ptr <SQLParser::Statement> stat = StatementFactTwoParmSing::Instance().create("OracleSQL", m_lastText, ""); TLOG(0,toDecorator,__HERE__) << "Parsing ok:" << std::endl Modified: branches/tora-trotl/src/parsing/tsqlparse.cpp =================================================================== --- branches/tora-trotl/src/parsing/tsqlparse.cpp 2011-09-15 15:36:14 UTC (rev 4082) +++ branches/tora-trotl/src/parsing/tsqlparse.cpp 2011-09-16 12:47:21 UTC (rev 4083) @@ -97,4 +97,15 @@ return this->m_token == other.m_token; }; + TSQLPARSER_EXPORT void Statement::token_iterator_to_root::increment() + { + if(m_token) + m_token = m_token->parent(); + }; + + TSQLPARSER_EXPORT bool Statement::token_iterator_to_root::equal(Statement::token_iterator_to_root const& other) const + { + return this->m_token == other.m_token; + }; + }; Modified: branches/tora-trotl/src/parsing/tsqlparse.h =================================================================== --- branches/tora-trotl/src/parsing/tsqlparse.h 2011-09-15 15:36:14 UTC (rev 4082) +++ branches/tora-trotl/src/parsing/tsqlparse.h 2011-09-16 12:47:21 UTC (rev 4083) @@ -21,6 +21,25 @@ class TSQLPARSER_EXPORT Token; class TSQLPARSER_EXPORT Statement; class TSQLPARSER_EXPORT ParseException; + + /* each instance of T_SELECT can holds transtation map TABLE_ALIAS -> TABLE_REF */ + class TSQLPARSER_EXPORT Translation : public QMap<QString, Token*> + { + public: + virtual ~Translation() {}; + }; + + /* Vertex represents "table". Table's scope is either: "global" Token* == ROOT + or "local" Token* points into some nested/factored subquery + */ + class TSQLPARSER_EXPORT Vertex : public QPair<Translation*, Token*> + { + }; + + /* Edge connects two Vertexes */ + class TSQLPARSER_EXPORT Edge : public QPair<Vertex*, Vertex*> + { + }; class TSQLPARSER_EXPORT Position { @@ -143,6 +162,7 @@ , _mStr(str) , _mTokenType(tokentype) // will be overwriten by descendent , _mUsageType(Unknown) + , _mAlias(NULL) {}; const Position& getPosition() const { return _mPosition; }; @@ -191,6 +211,14 @@ return _mChildren; }; + inline Translation& aliasTranslation() { return _mAliasTranslation; }; + inline Translation const& aliasTranslation() const { return _mAliasTranslation; }; + + inline Token const* nodeAlias() const { return _mAlias; }; + inline void setNodeAlias(Token const *t) { _mAlias = t; }; + + inline QSet<Token*>& nodeTables() { return _mTables; }; + inline const QSet<Token*>& nodeTables() const { return _mTables; }; protected: friend class Statement; @@ -202,7 +230,23 @@ QString _mTokenATypeName; //ANTLR token type - for debugging purposes only // TODO use only one of them QList<QPointer<Token> > _mChildren; - QList<QPointer<Token> > _mSpaces; + QList<QPointer<Token> > _mSpaces; + + /* Graphviz realted attributes */ + + /* translate table alias "A" -> table ref "SCHEMA.TABLE_A" + this map is present only if token is of type SUBQUERY or ROOT + */ + Translation _mAliasTranslation; + + /* Translate table ref SCHEMA.TABLE_A -> table alias "A" + this pointer is present only if token is of type SUBQUERY, ROOT, TABLE_REF(schema.tablename) + */ + Token const* _mAlias; + + /* Set of tables used in a (sub)query. This query is present only if token is of type SUBQUERY or ROOT + */ + QSet<Token*> _mTables; }; class TSQLPARSER_EXPORT ParseException: public ::std::exception @@ -387,6 +431,35 @@ Token const* m_token; }; // class token_const_iterator_to_root + class token_iterator_to_root : public boost::iterator_facade + < + token_iterator_to_root , + Token, + boost::forward_traversal_tag + > + { + public: + token_iterator_to_root() : m_token(0) {}; + + explicit token_iterator_to_root(Token* p) : m_token(p) {}; + + token_iterator_to_root(token_iterator_to_root const& other) : m_token(other.m_token) {}; + + ~token_iterator_to_root() {}; + + inline operator Token* () { return m_token; }; + private: + friend class boost::iterator_core_access; + + TSQLPARSER_EXPORT void increment(); + + TSQLPARSER_EXPORT bool equal(token_iterator_to_root const& other) const; + + inline Token& dereference() const { return *m_token; } + + Token* m_token; + }; // class token_const_iterator_to_root + protected: QString _mStatement, _mname; QMap<Position,Position*> _mPosition2pToken; Deleted: branches/tora-trotl/src/parsing/tsqlparse.tcc =================================================================== --- branches/tora-trotl/src/parsing/tsqlparse.tcc 2011-09-15 15:36:14 UTC (rev 4082) +++ branches/tora-trotl/src/parsing/tsqlparse.tcc 2011-09-16 12:47:21 UTC (rev 4083) @@ -1,95 +0,0 @@ - -#include "macros.h" - -namespace SQLParser -{ - __weak_symbol__ const char* SQLParser::Token::TokenType2Text[] = { - "UNASSIGNED" - ,"ROOT" - ,"FAILURE" - - ,"COMMENT" - ,"RESERVED" - ,"TABLENAME" - ,"SCHEMANAME" - ,"FUNCTIONNAME" - ,"PROCEDURENAME" - ,"PACKAGENAME" - ,"BINDVARNAME" - ,"CURSORNAME" - ,"EXCEPTIONNAME" - ,"TABLEALIAS" - ,"IDENTIFIER" - ,"JOIN" - ,"ON" - ,"JOINING_CLAUSE" - ,"USING" - ,"VARIABLE" - ,"DATATYPE" - ,"PARAMETER" - ,"SUBQUERY_FACTORED" - ,"SUBQUERY_NESTED" - ,"SUBQUERY_ALIAS" - ,"WITH" - ,"COLUMN_LIST" - ,"FROM" - ,"WHERE" - ,"COND_AND" - ,"COND_OR" - }; - - inline void Statement::token_const_iterator::increment() - { - if(m_token->isLeaf()) - { - // while token has no right brother POP - while(m_token->row() == m_token->parent()->childCount()-1) - { - m_stack.pop_back(); - m_token = m_stack.back(); - } - // replace stack's bottom with node's right brother - m_token = m_token->parent()->child(m_token->row()+1); - m_stack.pop_back(); - m_stack.push_back(m_token); - } else { - m_token = m_token->child(0); - m_stack.push_back(m_token); - } - }; - - inline bool Statement::token_const_iterator::equal(token_const_iterator const& other) const - { - return this->m_token == other.m_token; - }; - - inline Statement::token_const_iterator Statement::begin() const - { - return token_const_iterator(_mAST); - } - - inline Statement::token_const_iterator Statement::end() const - { - if(_mEnd) - return token_const_iterator(_mEnd); - _mEnd = _mAST; - while(!_mEnd->isLeaf()) - { - _mEnd = _mEnd->child( _mEnd->childCount()-1 ); - } - return token_const_iterator(_mEnd); - }; - - - inline void Statement::token_const_iterator_to_root::increment() - { - if(m_token) - m_token = m_token->parent(); - }; - - inline bool Statement::token_const_iterator_to_root::equal(Statement::token_const_iterator_to_root const& other) const - { - return this->m_token == other.m_token; - }; - -}; Modified: branches/tora-trotl/src/parsing/tsqlparseoracle.cpp =================================================================== --- branches/tora-trotl/src/parsing/tsqlparseoracle.cpp 2011-09-15 15:36:14 UTC (rev 4082) +++ branches/tora-trotl/src/parsing/tsqlparseoracle.cpp 2011-09-16 12:47:21 UTC (rev 4083) @@ -13,32 +13,11 @@ #include <QPair> namespace SQLParser -{ - /* each instance of T_SELECT can holds transtation map TABLE_ALIAS -> TABLE_REF */ - class TSQLPARSER_EXPORT Translation : public QMap<QString, Token*> - { - public: - virtual ~Translation() {}; - }; - - /* Vertex represents "table". Table's scope is either: "global" Token* == ROOT - or "local" Token* points into some nested/factored subquery - */ - class TSQLPARSER_EXPORT Vertex : public QPair<Translation*, Token*> - { - }; - - /* Edge connects two Vertexes */ - class TSQLPARSER_EXPORT Edge : public QPair<Vertex*, Vertex*> - { - }; - +{ class OracleSQLToken: public Token { public: - OracleSQLToken (Token *parent, const Position &pos, const QString &str, unsigned tokentype, const char* tokentypestring, unsigned usagetype = T_UNKNOWN); - Translation _mTranslation; // table alias "A" -> table ref "SCHEMA.TABLE_A" - + OracleSQLToken (Token *parent, const Position &pos, const QString &str, unsigned tokentype, const char* tokentypestring, unsigned usagetype = T_UNKNOWN); }; OracleSQLToken::OracleSQLToken (Token *parent, const Position &pos, const QString &str, unsigned tokentype, const char* tokentypestring, unsigned usagetype) @@ -195,7 +174,7 @@ void disambiguate(); void addTranslation(QString const& alias, Token const *tableOrSubquery, Token const *context); - Token const* translate(QString const& alias, Token const *context); + Token const* translateAlias(QString const& alias, Token const *context); pANTLR3_VECTOR lexerTokenVector; }; @@ -440,7 +419,7 @@ if( node.getTokenUsageType() != Token::Declaration ) break; - //TODO loop over rigth brothers unil you find either a reserved word or a table name + //TODO loop over rigth brothers until you find either a reserved word or a table name QList<QPointer<Token> > const& brothers = node.parent()->getChildren(); QPointer<Token> t = const_cast<Token*>(&(*i)); QString table_name; @@ -459,6 +438,7 @@ { std::cout << k->toString().toStdString() << "->"; } + brother->setNodeAlias(&node); std::cout << std::endl; break; } @@ -472,11 +452,20 @@ std::cout << k->toString().toStdString() << "->"; } std::cout << std::endl; + brother->setNodeAlias(&node); addTranslation(node.toString(), brother.data(), &node); break; } + + /* We have not found anything usefull: + SELECT * FROM TABLE_A, TABLE(CAST(VariableX) AS TABLE) X; => no translation for table alias X + TODO - do break on "JOIN" (joining clause) too. + SELECT * FROM TABLE_A A NATURAL JOIN TABLE(CAST(VariableX) AS TABLE) X; => no translation for table alias X + */ if( brother->toString().compare(QString(",")) == 0) break; + if( brother->getTokenType() == Token::L_TABLEALIAS) + break; } _mAliasesSet.insert( node.toString().toUpper()); @@ -487,6 +476,7 @@ std::cout << "Subquery alias found:" << node.toString().toAscii().constData() << std::endl; QList<QPointer<Token> > const& brothers = node.parent()->getChildren(); bool nodeFound = false; + //TODO loop over rigth brothers until you find S_SUBQUERY_FACTORED foreach( const QPointer<Token> brother, brothers) { if( brother == &node) @@ -501,6 +491,7 @@ std::cout << node.toString().toAscii().constData() << "=>" << (*brother).toStringRecursive().toAscii().constData() << std::endl; _mDeclarations.insertMulti(node.toString(), brother.data()); + brother->setNodeAlias(&node); break; } } @@ -508,6 +499,23 @@ _mAliasesSet.insert( node.toString().toUpper()); break; } + case Token::S_TABLE_REF: + { + /* A table reference was found. Traverse to ROOT, try to find a SUBQUERies ROOT + and update its table list + */ + for( SQLParser::Statement::token_iterator_to_root k(const_cast<Token*>(&node)); k->parent(); ++k) + { + if( k->getTokenType() == Token::S_SUBQUERY_NESTED || + k->getTokenType() == Token::S_SUBQUERY_FACTORED || + k->getTokenType() == Token::X_ROOT) + { + k->nodeTables().insert(const_cast<Token*>(&node)); + break; + } + } + break; + } } // switch(node.getTokenType()) } }; @@ -517,7 +525,7 @@ /* loop over all the identifiers and try to find table alias translation in the AST tree */ foreach( Identifier const &i, _mIdentifiers) { - // WHERE A = 1 -- "A" is a column name not a table name + // WHERE A = 1 -- "A" is a column name wihout any schema prefix if ( i.length() == 1) continue; @@ -526,7 +534,7 @@ continue; QString alias = i._mFields.at(0)->toString(); - OracleSQLToken const* table = ( OracleSQLToken*)translate(alias, context); + OracleSQLToken const* table = ( OracleSQLToken*)translateAlias(alias, context); if( table) std::cout << "al: " << i.toString().toStdString() << "=>" << table->toStringRecursive().toStdString() << std::endl; @@ -546,14 +554,14 @@ if( OracleSQLToken const *l = dynamic_cast<OracleSQLToken const*>((Token const*)k)) { OracleSQLToken &m = *(const_cast<OracleSQLToken*>(l)); - m._mTranslation.insert(alias, const_cast<Token*>(tableOrSubquery)); + m.aliasTranslation().insert(alias, const_cast<Token*>(tableOrSubquery)); } break; } } }; - Token const* OracleSQLStatement::translate(QString const& alias, Token const *context) + Token const* OracleSQLStatement::translateAlias(QString const& alias, Token const *context) { for( SQLParser::Statement::token_const_iterator_to_root k(context); k->parent(); ++k) { @@ -564,8 +572,8 @@ if( OracleSQLToken const *l = dynamic_cast<OracleSQLToken const*>((Token const*)k)) { OracleSQLToken &m = *(const_cast<OracleSQLToken*>(l)); - if(m._mTranslation.contains(alias)) - return m._mTranslation.value(alias); + if(m.aliasTranslation().contains(alias)) + return m.aliasTranslation().value(alias); } } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ibr...@us...> - 2011-09-22 14:56:37
|
Revision: 4093 http://tora.svn.sourceforge.net/tora/?rev=4093&view=rev Author: ibre5041 Date: 2011-09-22 14:56:30 +0000 (Thu, 22 Sep 2011) Log Message: ----------- Graphs progress Modified Paths: -------------- branches/tora-trotl/src/docklets/toastwalk.cpp branches/tora-trotl/src/docklets/toquerymodel.cpp branches/tora-trotl/src/parsing/tsqlparse.cpp branches/tora-trotl/src/parsing/tsqlparse.h branches/tora-trotl/src/parsing/tsqlparseoracle.cpp Modified: branches/tora-trotl/src/docklets/toastwalk.cpp =================================================================== --- branches/tora-trotl/src/docklets/toastwalk.cpp 2011-09-20 07:03:53 UTC (rev 4092) +++ branches/tora-trotl/src/docklets/toastwalk.cpp 2011-09-22 14:56:30 UTC (rev 4093) @@ -94,7 +94,68 @@ } break; } + case SQLParser::Token::L_JOINING_CLAUSE: + { + SQLParser::Statement::token_const_iterator subnode(node); + subnode++; + + SQLParser::Token const* firstTable = NULL; + SQLParser::Token const* secondTable = NULL; + + bool isJoinON = false; + bool isJoinUSING = false; + + while(subnode.depth() > node.depth()) + { + TLOG(0,toDecorator,__HERE__) << "JC:(" << subnode.depth() << ')' << subnode->toString() << std::endl; + switch(subnode->getTokenType()) + { + case SQLParser::Token::L_RESERVED: + if( QString::compare("ON", subnode->toString(), Qt::CaseInsensitive) == 0) + isJoinON = true; + if( QString::compare("USING", subnode->toString(), Qt::CaseInsensitive) == 0) + isJoinUSING = true; + break; + case SQLParser::Token::S_OPERATOR_BINARY: + if(subnode->childCount() != 3) // assuming condition "T1.C1" "=" "T2.C2"; + break; + if(subnode->child(0)->getTokenType() == SQLParser::Token::S_IDENTIFIER && + subnode->child(2)->getTokenType() == SQLParser::Token::S_IDENTIFIER) + { + firstTable = subnode->child(0); + secondTable= subnode->child(2); + TLOG(0,toDecorator,__HERE__) << "!?" << firstTable->toStringRecursive(false) << "->" << secondTable->toStringRecursive(false) << std::endl; + } + break; + } + subnode++; + } // while + + if(isJoinON && + firstTable && firstTable->childCount() == 3 && + secondTable && secondTable->childCount() == 3 + ) + { + SQLParser::Token const *t1 = source->translateAlias(firstTable->child(0)->toStringRecursive(false), &*node); + SQLParser::Token const *t2 = source->translateAlias(secondTable->child(0)->toStringRecursive(false), &*node); + if(t1) + firstTable = t1; + if(t2) + secondTable = t2; + + QMap<QString,QString> ea; // edge attreibutes + if(t1 && t2) // TODO this is wrong + { + target->addNewEdge( + QString("ROOT") + GLUE + t1->child(0)->toString() + GLUE + t1->child(1)->toString(), + QString("ROOT") + GLUE + t2->child(0)->toString() + GLUE + t2->child(1)->toString(), + ea); + } + TLOG(0,toDecorator,__HERE__) << "!!" << firstTable->toStringRecursive(false) << "->" << secondTable->toStringRecursive(false) << std::endl; + } + break; } + } } target->update(); Modified: branches/tora-trotl/src/docklets/toquerymodel.cpp =================================================================== --- branches/tora-trotl/src/docklets/toquerymodel.cpp 2011-09-20 07:03:53 UTC (rev 4092) +++ branches/tora-trotl/src/docklets/toquerymodel.cpp 2011-09-22 14:56:30 UTC (rev 4093) @@ -154,13 +154,13 @@ } m_timerID = startTimer(5000); - TLOG(0,toDecorator,__HERE__) << "void toQueryModel::timerEvent(QTimerEvent *e) fired" << std::endl; + ///TLOG(0,toDecorator,__HERE__) << "void toQueryModel::timerEvent(QTimerEvent *e) fired" << std::endl; } void toQueryModel::timerEvent(QTimerEvent *e) { QString newText; - TLOG(0,toDecorator,__HERE__) << "void toQueryModel::timerEvent(QTimerEvent *e) fired" << std::endl; + ///TLOG(0,toDecorator,__HERE__) << "void toQueryModel::timerEvent(QTimerEvent *e) fired" << std::endl; if( m_timerID == e->timerId()) { Modified: branches/tora-trotl/src/parsing/tsqlparse.cpp =================================================================== --- branches/tora-trotl/src/parsing/tsqlparse.cpp 2011-09-20 07:03:53 UTC (rev 4092) +++ branches/tora-trotl/src/parsing/tsqlparse.cpp 2011-09-22 14:56:30 UTC (rev 4093) @@ -21,7 +21,7 @@ ,"CURSORNAME" ,"EXCEPTIONNAME" ,"TABLEALIAS" - ,"IDENTIFIER" + ,"IDENTIFIER_PART" ,"JOIN" ,"ON" ,"JOINING_CLAUSE" @@ -41,8 +41,24 @@ ,"COND_OR" ,"IDENTIFIER" ,"TABLE_REF" + ,"OPERATOR_BINARY" }; + TSQLPARSER_EXPORT Token const* Statement::translateAlias(QString const& alias, Token const *context) + { + for( SQLParser::Statement::token_const_iterator_to_root k(context); k->parent(); ++k) + { + if( k->getTokenType() == Token::S_SUBQUERY_NESTED || + k->getTokenType() == Token::S_SUBQUERY_FACTORED || + k->getTokenType() == Token::X_ROOT) + { + if(k->aliasTranslation().contains(alias)) + return k->aliasTranslation().value(alias); + } + } + return NULL; + }; + TSQLPARSER_EXPORT void Statement::token_const_iterator::increment() { if(m_token->isLeaf()) Modified: branches/tora-trotl/src/parsing/tsqlparse.h =================================================================== --- branches/tora-trotl/src/parsing/tsqlparse.h 2011-09-20 07:03:53 UTC (rev 4092) +++ branches/tora-trotl/src/parsing/tsqlparse.h 2011-09-22 14:56:30 UTC (rev 4093) @@ -143,7 +143,8 @@ S_COND_AND, S_COND_OR, S_IDENTIFIER, - S_TABLE_REF + S_TABLE_REF, + S_OPERATOR_BINARY }; const static char* TokenType2Text[]; @@ -246,7 +247,7 @@ */ Token const* _mAlias; - /* Set of tables used in a (sub)query. This query is present only if token is of type SUBQUERY or ROOT + /* Set of tables used in a (sub)query. This list is present only if token is of type SUBQUERY or ROOT */ QSet<Token*> _mTables; }; @@ -360,6 +361,8 @@ return _mDeclarations; }; + Token const* translateAlias(QString const& alias, Token const *context); + class token_const_iterator : public boost::iterator_facade < token_const_iterator , Modified: branches/tora-trotl/src/parsing/tsqlparseoracle.cpp =================================================================== --- branches/tora-trotl/src/parsing/tsqlparseoracle.cpp 2011-09-20 07:03:53 UTC (rev 4092) +++ branches/tora-trotl/src/parsing/tsqlparseoracle.cpp 2011-09-22 14:56:30 UTC (rev 4093) @@ -138,6 +138,9 @@ case T_IDENTIFIER: _mTokenTypeRef = S_IDENTIFIER; break; + case T_OPERATOR_BINARY: + _mTokenTypeRef = S_OPERATOR_BINARY; + break; } // switch(tokentype) }; @@ -145,14 +148,14 @@ class OracleIdentifier: public Identifier { public: - OracleIdentifier(QVector<Token*> const &a) : Identifier(a), _mTableRef(NULL) {}; - OracleIdentifier() : Identifier(), _mTableRef(0) {}; + OracleIdentifier(QVector<Token*> const &a) : Identifier(a) /*, _mTableRef(NULL)*/ {}; + OracleIdentifier() : Identifier() /*, _mTableRef(0) */ {}; - QString toStringTranslated() const; + //QString toStringTranslated() const; virtual ~OracleIdentifier() {}; private: - Token const* _mTableRef; + //Token const* _mTableRef; protected: }; @@ -174,7 +177,7 @@ void disambiguate(); void addTranslation(QString const& alias, Token const *tableOrSubquery, Token const *context); - Token const* translateAlias(QString const& alias, Token const *context); + //Token const* translateAlias(QString const& alias, Token const *context); pANTLR3_VECTOR lexerTokenVector; }; @@ -426,7 +429,7 @@ std::cout << "Alias found:" << node.toString().toAscii().constData() << std::endl; - for( int j = brothers.indexOf(t) ; j >= 0; --j) + for( int j = brothers.indexOf(t) - 1 ; j >= 0; --j) { QPointer<Token> const brother = brothers.at(j); if( brother->getTokenType() == Token::S_SUBQUERY_NESTED) @@ -472,8 +475,7 @@ break; } case Token::L_SUBQUERY_ALIAS: - { - std::cout << "Subquery alias found:" << node.toString().toStdString() << std::endl; + { QList<QPointer<Token> > const& brothers = node.parent()->getChildren(); bool nodeFound = false; //TODO loop over rigth brothers until you find S_SUBQUERY_FACTORED @@ -489,9 +491,10 @@ if( brother->getTokenType() == Token::S_SUBQUERY_FACTORED) { std::cout << node.toString().toAscii().constData() << "=>" - << (*brother).toStringRecursive().toAscii().constData() << std::endl; + << (*brother).toStringRecursive().toStdString() << std::endl; _mDeclarations.insertMulti(node.toString(), brother.data()); brother->setNodeAlias(&node); + std::cout << "Subquery alias found:" << node.toString().toStdString() << "->" << brother->toString().toStdString() << std::endl; break; } } @@ -500,8 +503,7 @@ break; } case Token::S_TABLE_REF: - { - std::cout << "Table reference found:" << node.toStringRecursive().toStdString() << std::endl; + { /* A table reference was found. Traverse to ROOT, try to find a SUBQUERies ROOT and update its table list */ @@ -512,6 +514,7 @@ k->getTokenType() == Token::X_ROOT) { k->nodeTables().insert(const_cast<Token*>(&node)); + std::cout << "Table reference found:" << node.toStringRecursive().toStdString() << std::endl; break; } } @@ -545,41 +548,19 @@ void OracleSQLStatement::addTranslation(QString const& alias, Token const *tableOrSubquery, Token const *context) { - for( SQLParser::Statement::token_const_iterator_to_root k(context); k->parent(); ++k) + for( SQLParser::Statement::token_iterator_to_root k(const_cast<Token*>(context)); k->parent(); ++k) { std::cout << "tr: " << k->toString().toStdString() << std::endl; if( k->getTokenType() == Token::S_SUBQUERY_NESTED || - k->getTokenType() == Token::S_SUBQUERY_FACTORED || - k->getTokenType() == Token::X_ROOT) + k->getTokenType() == Token::S_SUBQUERY_FACTORED || + k->getTokenType() == Token::X_ROOT) { - if( OracleSQLToken const *l = dynamic_cast<OracleSQLToken const*>((Token const*)k)) - { - OracleSQLToken &m = *(const_cast<OracleSQLToken*>(l)); - m.aliasTranslation().insert(alias, const_cast<Token*>(tableOrSubquery)); - } + k->aliasTranslation().insert(alias, const_cast<Token*>(tableOrSubquery)); + std::cout << "Alias translation added:" << alias.toStdString() << "=>" << tableOrSubquery->toStringRecursive(false).toStdString() << " context: " << k->toString().toStdString() << std::endl; break; } } }; - - Token const* OracleSQLStatement::translateAlias(QString const& alias, Token const *context) - { - for( SQLParser::Statement::token_const_iterator_to_root k(context); k->parent(); ++k) - { - if( k->getTokenType() == Token::S_SUBQUERY_NESTED || - k->getTokenType() == Token::S_SUBQUERY_FACTORED || - k->getTokenType() == Token::X_ROOT) - { - if( OracleSQLToken const *l = dynamic_cast<OracleSQLToken const*>((Token const*)k)) - { - OracleSQLToken &m = *(const_cast<OracleSQLToken*>(l)); - if(m.aliasTranslation().contains(alias)) - return m.aliasTranslation().value(alias); - } - } - } - return NULL; - }; /*virtual*/ void OracleSQLStatement::tree2Dot(std::ostream &o) const { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ibr...@us...> - 2011-09-23 16:36:43
|
Revision: 4094 http://tora.svn.sourceforge.net/tora/?rev=4094&view=rev Author: ibre5041 Date: 2011-09-23 16:36:36 +0000 (Fri, 23 Sep 2011) Log Message: ----------- rewritten, optimized, broken Modified Paths: -------------- branches/tora-trotl/src/docklets/toastwalk.cpp branches/tora-trotl/src/docklets/tocodeoutline.cpp branches/tora-trotl/src/parsing/tsqlparse.cpp branches/tora-trotl/src/parsing/tsqlparse.h branches/tora-trotl/src/parsing/tsqlparseoracle.cpp Modified: branches/tora-trotl/src/docklets/toastwalk.cpp =================================================================== --- branches/tora-trotl/src/docklets/toastwalk.cpp 2011-09-22 14:56:30 UTC (rev 4093) +++ branches/tora-trotl/src/docklets/toastwalk.cpp 2011-09-23 16:36:36 UTC (rev 4094) @@ -38,16 +38,17 @@ case SQLParser::Token::S_SUBQUERY_FACTORED: case SQLParser::Token::S_SUBQUERY_NESTED: { - QSet<SQLParser::Token*> const& tables = node->nodeTables(); + SQLParser::TokenSubquery const* snode = static_cast<SQLParser::TokenSubquery const*>(&*node); + QSet<SQLParser::Token const*> const& tables = snode->nodeTables(); QString clusterName; QMap<QString,QString> sg; - if( node->nodeAlias() == NULL) + if( snode->nodeAlias() == NULL) { emptyAliasCnt++; clusterName = QString("cluster_") + QString::number(emptyAliasCnt); } else { - clusterName = QString("cluster_") + node->nodeAlias()->toString(); + clusterName = QString("cluster_") + snode->nodeAlias()->toString(); } clusterName.replace('.', GLUE); clusterName.replace(':', GLUE); @@ -55,42 +56,45 @@ target->addNewSubgraph(sg); TLOG(0,toDecorator,__HERE__) << "Subgraph: " << clusterName << ":" << node->toStringRecursive(false) << std::endl; - foreach(SQLParser::Token* t, tables) + foreach(SQLParser::Token const* table, tables) { - QMap<QString,QString> table; + SQLParser::TokenTable const* t = static_cast<SQLParser::TokenTable const*>(table); + QMap<QString,QString> ta; // table attributes QString tableName = t->toStringRecursive(false); // DOT does not allow ant "dots" in identifier names tableName.replace('.', GLUE); tableName.replace(':', GLUE); - table["name"] = t->toStringRecursive(false); - table["label"] = t->toStringRecursive(false); - table["fontsize"] = "10"; - table["comment"]= t->toStringRecursive(false); - table["id"]= clusterName + GLUE + tableName; + ta["name"] = t->toStringRecursive(false); + ta["label"] = t->toStringRecursive(false); + ta["fontsize"] = "10"; + ta["comment"]= t->toStringRecursive(false); + ta["id"]= clusterName + GLUE + tableName; if(t->nodeAlias() != NULL) - table["tooltip"] = t->nodeAlias()->toString(); - target->addNewNodeToSubgraph(table, sg["id"]); - TLOG(0,toDecorator,__HERE__) << "new node:" << table["id"] << " in subgraph: " << sg["id"] << std::endl; + ta["tooltip"] = t->nodeAlias()->toString(); + target->addNewNodeToSubgraph(ta, sg["id"]); + TLOG(0,toDecorator,__HERE__) << "new node:" << ta["id"] << " in subgraph: " << sg["id"] << std::endl; } break; } case SQLParser::Token::X_ROOT: { - QSet<SQLParser::Token*> const& tables = node->nodeTables(); - foreach(SQLParser::Token* t, tables) + SQLParser::TokenSubquery const* snode = static_cast<SQLParser::TokenSubquery const*>(&*node); + QSet<SQLParser::Token const*> const& tables = snode->nodeTables(); + foreach(SQLParser::Token const* table, tables) { - QMap<QString,QString> table; + SQLParser::TokenTable const* t = static_cast<SQLParser::TokenTable const*>(table); + QMap<QString,QString> ta; // table atributes QString tableName = t->toStringRecursive(false); // DOT does not allow ant "dots" in identifier names tableName.replace('.', '_'); tableName.replace(':', '_'); - table["name"] = t->toStringRecursive(false); - table["label"] = t->toStringRecursive(false); - table["fontsize"] = "10"; - table["comment"]= t->toStringRecursive(false); - table["id"]= QString("ROOT") + GLUE + tableName; + ta["name"] = t->toStringRecursive(false); + ta["label"] = t->toStringRecursive(false); + ta["fontsize"] = "10"; + ta["comment"]= t->toStringRecursive(false); + ta["id"]= QString("ROOT") + GLUE + tableName; if(t->nodeAlias() != NULL) - table["tooltip"] = t->nodeAlias()->toString(); - target->addNewNode(table); - TLOG(0,toDecorator,__HERE__) << "new node:" << table["id"] << " under X_ROOT" << std::endl; + ta["tooltip"] = t->nodeAlias()->toString(); + target->addNewNode(ta); + TLOG(0,toDecorator,__HERE__) << "new node:" << ta["id"] << " under X_ROOT" << std::endl; } break; } @@ -147,11 +151,13 @@ if(t1 && t2) // TODO this is wrong { target->addNewEdge( - QString("ROOT") + GLUE + t1->child(0)->toString() + GLUE + t1->child(1)->toString(), - QString("ROOT") + GLUE + t2->child(0)->toString() + GLUE + t2->child(1)->toString(), + QString("ROOT") + GLUE + t1->child(0)->toString() + GLUE + t1->child(2)->toString(), + QString("ROOT") + GLUE + t2->child(0)->toString() + GLUE + t2->child(2)->toString(), ea); - } - TLOG(0,toDecorator,__HERE__) << "!!" << firstTable->toStringRecursive(false) << "->" << secondTable->toStringRecursive(false) << std::endl; + TLOG(0,toDecorator,__HERE__) << "!!" << firstTable->toStringRecursive(false) << "->" << secondTable->toStringRecursive(false) << std::endl; + } else { + TLOG(0,toDecorator,__HERE__) << "??" << firstTable->toStringRecursive(false) << "->" << secondTable->toStringRecursive(false) << std::endl; + } } break; } Modified: branches/tora-trotl/src/docklets/tocodeoutline.cpp =================================================================== --- branches/tora-trotl/src/docklets/tocodeoutline.cpp 2011-09-22 14:56:30 UTC (rev 4093) +++ branches/tora-trotl/src/docklets/tocodeoutline.cpp 2011-09-23 16:36:36 UTC (rev 4094) @@ -113,8 +113,6 @@ { QString newText; - TLOG(0,toDecorator,__HERE__) << "void toQueryModel::timerEvent(QTimerEvent *e) fired" << std::endl; - if( m_timerID != e->timerId()) { toDocklet::timerEvent(e); Modified: branches/tora-trotl/src/parsing/tsqlparse.cpp =================================================================== --- branches/tora-trotl/src/parsing/tsqlparse.cpp 2011-09-22 14:56:30 UTC (rev 4093) +++ branches/tora-trotl/src/parsing/tsqlparse.cpp 2011-09-23 16:36:36 UTC (rev 4094) @@ -52,8 +52,9 @@ k->getTokenType() == Token::S_SUBQUERY_FACTORED || k->getTokenType() == Token::X_ROOT) { - if(k->aliasTranslation().contains(alias)) - return k->aliasTranslation().value(alias); + TokenSubquery const &s = static_cast<TokenSubquery const&>(*k); + if(s.aliasTranslation().contains(alias)) + return s.aliasTranslation().value(alias); } } return NULL; Modified: branches/tora-trotl/src/parsing/tsqlparse.h =================================================================== --- branches/tora-trotl/src/parsing/tsqlparse.h 2011-09-22 14:56:30 UTC (rev 4093) +++ branches/tora-trotl/src/parsing/tsqlparse.h 2011-09-23 16:36:36 UTC (rev 4094) @@ -29,18 +29,21 @@ virtual ~Translation() {}; }; - /* Vertex represents "table". Table's scope is either: "global" Token* == ROOT - or "local" Token* points into some nested/factored subquery - */ - class TSQLPARSER_EXPORT Vertex : public QPair<Translation*, Token*> - { - }; + ///* Vertex represents "table". Table's scope is either: "global" Token* == ROOT + // or "local" Token* points into some nested/factored subquery + //*/ + //class TSQLPARSER_EXPORT Vertex : public QPair<Translation*, Token*> + //{ + //}; - /* Edge connects two Vertexes */ - class TSQLPARSER_EXPORT Edge : public QPair<Vertex*, Vertex*> - { - }; + ///* Edge connects two Vertexes */ + //class TSQLPARSER_EXPORT Edge : public QPair<Vertex*, Vertex*> + //{ + //}; + /* + * Token's position in the source + */ class TSQLPARSER_EXPORT Position { public: @@ -73,36 +76,24 @@ unsigned _mLine, _mLinePos; }; + /* + * Token - an element in AST tree hierarchy + */ class TSQLPARSER_EXPORT Token : public QObject // inherit from QObject for QPointer { public: // TreeModel methods - inline int columnCount() const - { - return 1; - }; - inline int childCount() const - { - return _mChildren.size(); - }; - inline QVariant data(int) const - { - return QVariant(toString()); - }; - inline Token* child(int row) const - { - return _mChildren.value(row); - }; + inline int columnCount() const { return 1; }; + inline int childCount() const { return _mChildren.size(); }; + inline QVariant data(int) const { return QVariant(toString()); }; + inline Token* child(int row) const { return _mChildren.value(row); }; + inline Token* parent() const { return _mParent; }; inline int row() const { - if (_mParent.isNull()) + if (_mParent == NULL) return 0; return _mParent->_mChildren.indexOf(const_cast<Token*>(this)); - }; - inline Token* parent() const - { - return _mParent; - }; + }; enum TokenType { @@ -146,9 +137,7 @@ S_TABLE_REF, S_OPERATOR_BINARY }; - - const static char* TokenType2Text[]; - + enum UsageType { Unknown, @@ -163,9 +152,22 @@ , _mStr(str) , _mTokenType(tokentype) // will be overwriten by descendent , _mUsageType(Unknown) - , _mAlias(NULL) + //, _mAlias(NULL) {}; + Token(const Token& other) + : _mParent(other._mParent) + , _mPosition(other._mPosition) + , _mStr(other._mStr) + , _mTokenType(other._mTokenType) // will be overwriten by descendent + , _mUsageType(other._mUsageType) + , _mTokenATypeName(other._mTokenATypeName) + , _mChildren(other._mChildren) + , _mSpaces(other._mSpaces) + {}; + + virtual ~Token() {}; + const Position& getPosition() const { return _mPosition; }; operator const Position&() const { return getPosition(); }; @@ -206,26 +208,32 @@ inline const UsageType& getTokenUsageType() const { return _mUsageType; }; - inline void appendChild(QPointer<Token> child) { _mChildren.append(child); }; + inline void appendChild(QPointer<Token> child) { _mChildren.append(child); }; inline void appendSpacer(QPointer<Token> space) { _mSpaces.append(space); }; + inline void replaceChild(QPointer<Token> oldOne, QPointer<Token> newOne) + { + int index = _mChildren.indexOf(oldOne); + _mChildren.insert(index, newOne); + }; inline QList<QPointer<Token> > const& getChildren() const { return _mChildren; }; - inline Translation& aliasTranslation() { return _mAliasTranslation; }; - inline Translation const& aliasTranslation() const { return _mAliasTranslation; }; + //inline Translation& aliasTranslation() { return _mAliasTranslation; }; + //inline Translation const& aliasTranslation() const { return _mAliasTranslation; }; - inline Token const* nodeAlias() const { return _mAlias; }; - inline void setNodeAlias(Token const *t) { _mAlias = t; }; + //inline Token const* nodeAlias() const { return _mAlias; }; + //inline void setNodeAlias(Token const *t) { _mAlias = t; }; - inline QSet<Token*>& nodeTables() { return _mTables; }; - inline const QSet<Token*>& nodeTables() const { return _mTables; }; + //inline QSet<Token*>& nodeTables() { return _mTables; }; + //inline const QSet<Token*>& nodeTables() const { return _mTables; }; protected: friend class Statement; - QPointer<Token> _mParent; + const static char* TokenType2Text[]; + Token* _mParent; const Position _mPosition; const QString _mStr; const TokenType _mTokenType; @@ -235,21 +243,94 @@ QList<QPointer<Token> > _mChildren; QList<QPointer<Token> > _mSpaces; - /* Graphviz realted attributes */ + ///* Graphviz realated attributes */ - /* translate table alias "A" -> table ref "SCHEMA.TABLE_A" - this map is present only if token is of type SUBQUERY or ROOT + ///* Translate table ref SCHEMA.TABLE_A -> table alias "A" + // this pointer is present only if token is of type SUBQUERY, ROOT, TABLE_REF(schema.tablename) + //*/ + //Token const* _mAlias; + + ///* Set of tables used in a (sub)query. This list is present only if token is of type SUBQUERY or ROOT + //*/ + //QSet<Token*> _mTables; + }; + + class TSQLPARSER_EXPORT TokenIdentifier: public Token + { + public: + TokenIdentifier(const Token& other) + : Token(other) + {}; + + virtual ~TokenIdentifier() {}; + + QString tableName () const; + QString columnName () const; + + protected: + }; + + class TSQLPARSER_EXPORT TokenTable: public Token + { + public: + TokenTable(const Token& other) + : Token(other) + , _mAlias(NULL) + {}; + + virtual ~TokenTable() {}; + + QString tableName () const; + QString columnName () const; + + inline Token const* nodeAlias() const { return _mAlias; }; + inline void setNodeAlias(Token const *t) { _mAlias = t; }; + + protected: + /* Translate table ref SCHEMA.TABLE_A -> table alias "A" + this pointer is present only if token is of type SUBQUERY, ROOT, TABLE_REF(schema.tablename) */ - Translation _mAliasTranslation; + Token const* _mAlias; + }; + class TSQLPARSER_EXPORT TokenSubquery: public Token + { + public: + TokenSubquery(Token *parent, const Position &pos, const QString &str, const TokenType& tokentype = X_UNASSIGNED) + : Token(parent, pos, str, tokentype) + , _mAlias(NULL) + {}; + + TokenSubquery(const Token& other) + : Token(other) + , _mAlias(NULL) + {}; + + virtual ~TokenSubquery() {}; + + inline Token const* nodeAlias() const { return _mAlias; }; + inline void setNodeAlias(Token const *t) { _mAlias = t; }; + + inline Translation& aliasTranslation() { return _mAliasTranslation; }; + inline Translation const& aliasTranslation() const { return _mAliasTranslation; }; + + inline QSet<Token const*>& nodeTables() { return _mTables; }; + inline const QSet<Token const*>& nodeTables() const { return _mTables; }; + + protected: /* Translate table ref SCHEMA.TABLE_A -> table alias "A" this pointer is present only if token is of type SUBQUERY, ROOT, TABLE_REF(schema.tablename) */ Token const* _mAlias; + /* translate table alias "A" -> table ref "SCHEMA.TABLE_A" + this map is present only if token is of type SUBQUERY or ROOT + */ + Translation _mAliasTranslation; + /* Set of tables used in a (sub)query. This list is present only if token is of type SUBQUERY or ROOT */ - QSet<Token*> _mTables; + QSet<Token const*> _mTables; }; class TSQLPARSER_EXPORT ParseException: public ::std::exception @@ -259,32 +340,6 @@ private: }; - - class TSQLPARSER_EXPORT Identifier - { - public: - QString toString(int fields = -1) const - { - QString retval; - foreach(const Token* token, _mFields) - { - if(fields == 0) - break; - if(!retval.isEmpty()) - retval += '.'; - retval += token->toString(); - if(fields > 0) - fields--; - } - return retval; - } - int length() const { return _mFields.size(); }; - Identifier(QVector<Token*> const &a) : _mFields(a) {}; - Identifier() {}; - virtual ~Identifier() {}; - //private: - QVector<Token*> _mFields; - }; class TSQLPARSER_EXPORT Statement //: public QObject { @@ -331,20 +386,20 @@ return _mAST; }; - inline const QSet<QString>& tables() const - { - return _mTablesSet; - }; + //inline const QSet<QString>& tables() const + //{ + // return _mTablesSet; + //}; inline const QVector<Token const*>& tableTokens() const { return _mTablesList; }; - inline const QSet<QString>& aliases() const - { - return _mAliasesSet; - }; + //inline const QSet<QString>& aliases() const + //{ + // return _mAliasesSet; + //}; inline const QList<QString> allDeclarations() const { @@ -473,11 +528,10 @@ virtual void parse() = 0; QPointer<Token> _mAST; mutable Token *_mEnd; - QSet<QString> _mTablesSet, _mAliasesSet; + //QSet<QString> _mTablesSet, _mAliasesSet; QVector<Token const*> _mTablesList; QMap<QString, const Token*> _mDeclarations; public: - QVector<Identifier> _mIdentifiers; }; }; // namespace SQLParser Modified: branches/tora-trotl/src/parsing/tsqlparseoracle.cpp =================================================================== --- branches/tora-trotl/src/parsing/tsqlparseoracle.cpp 2011-09-22 14:56:30 UTC (rev 4093) +++ branches/tora-trotl/src/parsing/tsqlparseoracle.cpp 2011-09-23 16:36:36 UTC (rev 4094) @@ -145,19 +145,16 @@ }; - class OracleIdentifier: public Identifier - { - public: - OracleIdentifier(QVector<Token*> const &a) : Identifier(a) /*, _mTableRef(NULL)*/ {}; - OracleIdentifier() : Identifier() /*, _mTableRef(0) */ {}; + //class OracleIdentifier: public Identifier + //{ + //public: + // OracleIdentifier(QVector<Token*> const &a) : Identifier(a) {}; + // OracleIdentifier() : Identifier() {}; - //QString toStringTranslated() const; - - virtual ~OracleIdentifier() {}; - private: - //Token const* _mTableRef; - protected: - }; + // virtual ~OracleIdentifier() {}; + //private: + //protected: + //}; class OracleSQLStatement: public Statement { @@ -260,10 +257,10 @@ } //pANTLR3_COMMON_TOKEN root_token = langAST.tree->getToken(langAST.tree); - _mAST = new Token( NULL - ,Position(0,0) - , "" - , Token::X_ROOT + _mAST = new TokenSubquery( NULL + ,Position(0,0) + , "" + , Token::X_ROOT ); _mAST->setTokenATypeName("ROOT"); ANTLR3_UINT32 lastIndex = 0; @@ -385,38 +382,37 @@ void OracleSQLStatement::scanTree() { /* find all identifiers */ - QVector<Token*> identifierParts; - bool dotFound = false; - SQLParser::Statement::token_const_iterator node; - for(node=begin(); node!=end(); ++node) - { - Token* pNode = const_cast<Token*>(&*node); - if( node->getTokenType() == Token::S_IDENTIFIER) - { - QList<QPointer<Token> > const& children = node->getChildren(); - foreach( const QPointer<Token> i, children) - { - if( i->toString().compare(QString(".")) == 0) - continue; - identifierParts.push_back(i.data()); - } - _mIdentifiers.push_back(OracleIdentifier(identifierParts)); - identifierParts.clear(); - } - } + ///QVector<Token*> identifierParts; + //bool dotFound = false; + //SQLParser::Statement::token_const_iterator node; + //for(node=begin(); node!=end(); ++node) + //{ + // Token* pNode = const_cast<Token*>(&*node); + // if( node->getTokenType() == Token::S_IDENTIFIER) + // { + // QList<QPointer<Token> > const& children = node->getChildren(); + // foreach( const QPointer<Token> i, children) + // { + // if( i->toString().compare(QString(".")) == 0) + // continue; + // identifierParts.push_back(i.data()); + // } + // //_mIdentifiers.push_back(OracleIdentifier(identifierParts)); + // identifierParts.clear(); + // } + //} for(SQLParser::Statement::token_const_iterator i=begin(); i!=end(); ++i) { Token const &node = *i; switch( node.getTokenType()) { - case Token::L_TABLENAME: - _mTablesSet.insert( node.toString().toUpper()); - _mTablesList.append( &*i); - break; - case Token::L_SCHEMANAME: - //_mAliases.insert( node.toString().toUpper()); - break; + /* + TABLE ALIAS was found: + - loop over left brothers until you find TABLE_REF or SUBQUERY_NESTED + - update brothers alias attribute + - find parent of type SUBQUERY(or X_ROOT) and insert translation ALIAS => BROTHER + */ case Token::L_TABLEALIAS: { if( node.getTokenUsageType() != Token::Declaration ) @@ -425,7 +421,7 @@ //TODO loop over rigth brothers until you find either a reserved word or a table name QList<QPointer<Token> > const& brothers = node.parent()->getChildren(); QPointer<Token> t = const_cast<Token*>(&(*i)); - QString table_name; + //QString table_name; std::cout << "Alias found:" << node.toString().toAscii().constData() << std::endl; @@ -434,28 +430,31 @@ QPointer<Token> const brother = brothers.at(j); if( brother->getTokenType() == Token::S_SUBQUERY_NESTED) { - std::cout << node.toString().toAscii().constData() << "=>" - << (*brother).toStringRecursive().toStdString() << std::endl; - _mDeclarations.insertMulti(node.toString(), brother.data()); - for(SQLParser::Statement::token_const_iterator_to_root k(&*i); &*k; ++k) - { - std::cout << k->toString().toStdString() << "->"; - } - brother->setNodeAlias(&node); - std::cout << std::endl; + std::cout << node.toString().toAscii().constData() << "=>" << (*brother).toStringRecursive().toStdString() << std::endl; + + //_mDeclarations.insertMulti(node.toString(), brother.data()); + //for(SQLParser::Statement::token_const_iterator_to_root k(&*i); &*k; ++k) + //{ + // std::cout << k->toString().toStdString() << "->"; + //} + //std::cout << std::endl; + + static_cast<TokenSubquery*>(brother.data())->setNodeAlias(&node); + addTranslation(node.toString(), brother.data(), &node); break; } if( brother->getTokenType() == Token::S_TABLE_REF) { - std::cout << node.toString().toAscii().constData() << "=>" - << (*brother).toStringRecursive().toAscii().constData() << std::endl; - _mDeclarations.insertMulti(node.toString(), brother.data()); - for(SQLParser::Statement::token_const_iterator_to_root k(&*i); &*k; ++k) - { - std::cout << k->toString().toStdString() << "->"; - } - std::cout << std::endl; - brother->setNodeAlias(&node); + std::cout << node.toString().toAscii().constData() << "=>" << (*brother).toStringRecursive().toAscii().constData() << std::endl; + + //_mDeclarations.insertMulti(node.toString(), brother.data()); + //for(SQLParser::Statement::token_const_iterator_to_root k(&*i); &*k; ++k) + //{ + // std::cout << k->toString().toStdString() << "->"; + //} + //std::cout << std::endl; + + static_cast<TokenSubquery*>(brother.data())->setNodeAlias(&node); addTranslation(node.toString(), brother.data(), &node); break; } @@ -471,9 +470,15 @@ break; } - _mAliasesSet.insert( node.toString().toUpper()); + ///_mAliasesSet.insert( node.toString().toUpper()); break; } + /* + SUBQUERY ALIAS was found: + - loop over right brothers until you find SUBQUERY_FACTORED + - update brothers alias attribute + - find parent of type SUBQUERY(or X_ROOT) and insert translation ALIAS => BROTHER + */ case Token::L_SUBQUERY_ALIAS: { QList<QPointer<Token> > const& brothers = node.parent()->getChildren(); @@ -490,36 +495,57 @@ continue; if( brother->getTokenType() == Token::S_SUBQUERY_FACTORED) { - std::cout << node.toString().toAscii().constData() << "=>" - << (*brother).toStringRecursive().toStdString() << std::endl; - _mDeclarations.insertMulti(node.toString(), brother.data()); - brother->setNodeAlias(&node); + std::cout << node.toString().toAscii().constData() << "=>" << (*brother).toStringRecursive().toStdString() << std::endl; + + //_mDeclarations.insertMulti(node.toString(), brother.data()); + + ///TODO check if brother was already replaced + ///static_cast<TokenSubquery*>(brother.data())->setNodeAlias(&node); + std::cout << "Subquery alias found:" << node.toString().toStdString() << "->" << brother->toString().toStdString() << std::endl; break; } } - if( node.getTokenUsageType() == Token::Declaration ) - _mAliasesSet.insert( node.toString().toUpper()); + //if( node.getTokenUsageType() == Token::Declaration ) + // _mAliasesSet.insert( node.toString().toUpper()); break; } case Token::S_TABLE_REF: - { + { + Token *parent = node.parent(); + Token *me = const_cast<Token*>(&node); + TokenTable *newToken = new TokenTable(node); + parent->replaceChild(QPointer<Token>(me), QPointer<Token>((Token*)newToken)); + i = SQLParser::Statement::token_const_iterator(newToken); /* A table reference was found. Traverse to ROOT, try to find a SUBQUERies ROOT and update its table list */ - for( SQLParser::Statement::token_iterator_to_root k(const_cast<Token*>(&node)); k->parent(); ++k) + for( SQLParser::Statement::token_iterator_to_root k(const_cast<Token*>((Token*)newToken)); k->parent(); ++k) { if( k->getTokenType() == Token::S_SUBQUERY_NESTED || k->getTokenType() == Token::S_SUBQUERY_FACTORED || k->getTokenType() == Token::X_ROOT) { - k->nodeTables().insert(const_cast<Token*>(&node)); + TokenSubquery &s = dynamic_cast<TokenSubquery&>(*k); + s.nodeTables().insert(const_cast<Token*>(&node)); std::cout << "Table reference found:" << node.toStringRecursive().toStdString() << std::endl; break; } } + _mTablesList.append(&*i); break; } + case Token::S_SUBQUERY_FACTORED: + case Token::S_SUBQUERY_NESTED: + { + Token *parent = node.parent(); + Token *me = const_cast<Token*>(&node); + TokenSubquery *newToken = new TokenSubquery(node); + ///newToken->setNodeAlias( (me->nodeAlias()); + parent->replaceChild(QPointer<Token>(me), QPointer<Token>((Token*)newToken)); + i = SQLParser::Statement::token_const_iterator(newToken); + break; + } } // switch(node.getTokenType()) } }; @@ -527,22 +553,22 @@ void OracleSQLStatement::disambiguate() { /* loop over all the identifiers and try to find table alias translation in the AST tree */ - foreach( Identifier const &i, _mIdentifiers) - { - // WHERE A = 1 -- "A" is a column name wihout any schema prefix - if ( i.length() == 1) - continue; + //foreach( Identifier const &i, _mIdentifiers) + //{ + // // WHERE A = 1 -- "A" is a column name wihout any schema prefix + // if ( i.length() == 1) + // continue; - OracleSQLToken const* context; - if (( context = dynamic_cast<OracleSQLToken*>(i._mFields.at(0))) == NULL) - continue; - - QString alias = i._mFields.at(0)->toString(); - OracleSQLToken const* table = ( OracleSQLToken*)translateAlias(alias, context); + // OracleSQLToken const* context; + // if (( context = dynamic_cast<OracleSQLToken*>(i._mFields.at(0))) == NULL) + // continue; + // + // QString alias = i._mFields.at(0)->toString(); + // OracleSQLToken const* table = ( OracleSQLToken*)translateAlias(alias, context); - if( table) - std::cout << "al: " << i.toString().toStdString() << "=>" << table->toStringRecursive().toStdString() << std::endl; - } + // if( table) + // std::cout << "al: " << i.toString().toStdString() << "=>" << table->toStringRecursive().toStdString() << std::endl; + //} /* TODO - table name can also point onto SUBQUERY_FACTORED */ }; @@ -555,7 +581,8 @@ k->getTokenType() == Token::S_SUBQUERY_FACTORED || k->getTokenType() == Token::X_ROOT) { - k->aliasTranslation().insert(alias, const_cast<Token*>(tableOrSubquery)); + TokenSubquery &s = static_cast<TokenSubquery&>(*k); + s.aliasTranslation().insert(alias, const_cast<Token*>(tableOrSubquery)); std::cout << "Alias translation added:" << alias.toStdString() << "=>" << tableOrSubquery->toStringRecursive(false).toStdString() << " context: " << k->toString().toStdString() << std::endl; break; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ibr...@us...> - 2011-09-28 19:26:29
|
Revision: 4100 http://tora.svn.sourceforge.net/tora/?rev=4100&view=rev Author: ibre5041 Date: 2011-09-28 19:26:23 +0000 (Wed, 28 Sep 2011) Log Message: ----------- Modified Paths: -------------- branches/tora-trotl/src/docklets/toastwalk.cpp branches/tora-trotl/src/parsing/tsqlparseoracle.cpp Modified: branches/tora-trotl/src/docklets/toastwalk.cpp =================================================================== --- branches/tora-trotl/src/docklets/toastwalk.cpp 2011-09-27 13:43:10 UTC (rev 4099) +++ branches/tora-trotl/src/docklets/toastwalk.cpp 2011-09-28 19:26:23 UTC (rev 4100) @@ -110,9 +110,11 @@ bool isJoinON = false; bool isJoinUSING = false; + TLOG(0,toDecorator,__HERE__) << "JC:(" << node.depth() << ')' << std::endl + << node->toStringRecursive().toStdString() << std::endl; while(subnode.depth() > node.depth()) { - TLOG(0,toDecorator,__HERE__) << "JC:(" << subnode.depth() << ')' << subnode->toString() << std::endl; + ///TLOG(0,toDecorator,__HERE__) << "JC:(" << subnode.depth() << ')' << subnode->toString() << std::endl; switch(subnode->getTokenType()) { case SQLParser::Token::L_RESERVED: @@ -143,6 +145,19 @@ { SQLParser::Token const *t1 = source->translateAlias(firstTable->child(0)->toStringRecursive(false), &*node); SQLParser::Token const *t2 = source->translateAlias(secondTable->child(0)->toStringRecursive(false), &*node); + + if(t1->getTokenType() == SQLParser::Token::S_SUBQUERY_NESTED || + t1->getTokenType() == SQLParser::Token::S_SUBQUERY_FACTORED) + { + t1 = source->translateAlias(firstTable->child(0)->toStringRecursive(false), t1); + } + + if(t2->getTokenType() == SQLParser::Token::S_SUBQUERY_NESTED || + t2->getTokenType() == SQLParser::Token::S_SUBQUERY_FACTORED) + { + t2 = source->translateAlias(firstTable->child(0)->toStringRecursive(false), t2); + } + if(t1) firstTable = t1; if(t2) Modified: branches/tora-trotl/src/parsing/tsqlparseoracle.cpp =================================================================== --- branches/tora-trotl/src/parsing/tsqlparseoracle.cpp 2011-09-27 13:43:10 UTC (rev 4099) +++ branches/tora-trotl/src/parsing/tsqlparseoracle.cpp 2011-09-28 19:26:23 UTC (rev 4100) @@ -174,7 +174,7 @@ void disambiguate(); void addTranslation(QString const& alias, Token const *tableOrSubquery, Token const *context); - //Token const* translateAlias(QString const& alias, Token const *context); + void addTableRef(Token const *tableOrSubquery, Token const *context); pANTLR3_VECTOR lexerTokenVector; }; @@ -395,26 +395,40 @@ /* walk through statement tree and detect identifiers, tables, table aliases */ void OracleSQLStatement::scanTree() { - /* find all identifiers */ - ///QVector<Token*> identifierParts; - //bool dotFound = false; - //SQLParser::Statement::token_const_iterator node; - //for(node=begin(); node!=end(); ++node) - //{ - // Token* pNode = const_cast<Token*>(&*node); - // if( node->getTokenType() == Token::S_IDENTIFIER) - // { - // QList<QPointer<Token> > const& children = node->getChildren(); - // foreach( const QPointer<Token> i, children) - // { - // if( i->toString().compare(QString(".")) == 0) - // continue; - // identifierParts.push_back(i.data()); - // } - // //_mIdentifiers.push_back(OracleIdentifier(identifierParts)); - // identifierParts.clear(); - // } - //} + // First of all replace some instances of Token with Token's sub-classes + for(SQLParser::Statement::token_const_iterator i=begin(); i!=end(); ++i) + { + Token const &node = *i; + switch( node.getTokenType()) + { + case Token::S_TABLE_REF: + { + i--; // At this moment iterator's stack points onto node beeing replaced. + Token *parent = node.parent(); + Token *me = const_cast<Token*>(&node); + TokenTable *newToken = new TokenTable(node); + parent->replaceChild(me->row(), newToken); + i++; + break; + } + case Token::S_SUBQUERY_FACTORED: + case Token::S_SUBQUERY_NESTED: + case Token::X_ROOT: // TODO fix me. T_SELECT under T_UNION is also marked as X_ROOT => there is more than one X_ROOT + { + if(node.parent() == NULL) + break; + + i--; // At this moment iterator's stack points onto node beeing replaced. + Token *parent = node.parent(); + Token *me = const_cast<Token*>(&node); + TokenSubquery *newToken = new TokenSubquery(node); + ///newToken->setNodeAlias( (me->nodeAlias()); + parent->replaceChild(me->row(), newToken); + i++; + break; + } + } // switch + } // for each AST node for(SQLParser::Statement::token_const_iterator i=begin(); i!=end(); ++i) { @@ -432,19 +446,18 @@ if( node.getTokenUsageType() != Token::Declaration ) break; - //TODO loop over rigth brothers until you find either a reserved word or a table name + //loop over left brothers until you find either a reserved word or a table name QList<QPointer<Token> > const& brothers = node.parent()->getChildren(); - QPointer<Token> t = const_cast<Token*>(&(*i)); - //QString table_name; + ////QPointer<Token> t = const_cast<Token*>(&(*i)); std::cout << "Alias found:" << node.toString().toAscii().constData() << std::endl; - for( int j = brothers.indexOf(t) - 1 ; j >= 0; --j) + for( int j = node.row() - 1 ; j >= 0; --j) { - QPointer<Token> const brother = brothers.at(j); + Token *brother = brothers.at(j); if( brother->getTokenType() == Token::S_SUBQUERY_NESTED) { - std::cout << node.toString().toAscii().constData() << "=>" << (*brother).toStringRecursive().toStdString() << std::endl; + std::cout << node.toString().toStdString() << "=>" << brother->toStringRecursive().toStdString() << std::endl; //_mDeclarations.insertMulti(node.toString(), brother.data()); //for(SQLParser::Statement::token_const_iterator_to_root k(&*i); &*k; ++k) @@ -453,8 +466,8 @@ //} //std::cout << std::endl; - static_cast<TokenSubquery*>(brother.data())->setNodeAlias(&node); - addTranslation(node.toString(), brother.data(), &node); + static_cast<TokenSubquery*>(brother)->setNodeAlias(&node); + addTranslation(node.toString(), brother, node.parent()); break; } if( brother->getTokenType() == Token::S_TABLE_REF) @@ -467,9 +480,9 @@ // std::cout << k->toString().toStdString() << "->"; //} //std::cout << std::endl; - - static_cast<TokenSubquery*>(brother.data())->setNodeAlias(&node); - addTranslation(node.toString(), brother.data(), &node); + + static_cast<TokenSubquery*>(brother)->setNodeAlias(&node); + addTranslation(node.toString(), brother, node.parent()); break; } @@ -482,9 +495,10 @@ break; if( brother->getTokenType() == Token::L_TABLEALIAS) break; + if( brother->getTokenType() == Token::L_RESERVED) + break; } - ///_mAliasesSet.insert( node.toString().toUpper()); break; } /* @@ -495,26 +509,26 @@ */ case Token::L_SUBQUERY_ALIAS: { + //QList<QPointer<Token> > const& brothers = node.parent()->getChildren(); + //bool nodeFound = false; + //TODO loop over rigth brothers until you find S_SUBQUERY_FACTORED + //foreach( const QPointer<Token> brother, brothers) + QList<QPointer<Token> > const& brothers = node.parent()->getChildren(); - bool nodeFound = false; - //TODO loop over rigth brothers until you find S_SUBQUERY_FACTORED - foreach( const QPointer<Token> brother, brothers) + + for( int j = node.row() - 1 ; j >= 0; --j) { - if( brother == &node) - { - nodeFound = true; - continue; - } - if( nodeFound == false) - continue; + Token *brother = brothers.at(j); + if( brother->getTokenType() == Token::S_SUBQUERY_FACTORED) { - std::cout << node.toString().toAscii().constData() << "=>" << (*brother).toStringRecursive().toStdString() << std::endl; + std::cout << node.toString().toAscii().constData() << "=>" << brother->toStringRecursive().toStdString() << std::endl; //_mDeclarations.insertMulti(node.toString(), brother.data()); - ///TODO check if brother was already replaced - ///static_cast<TokenSubquery*>(brother.data())->setNodeAlias(&node); + TokenSubquery *b = static_cast<TokenSubquery*>(brother); + b->setNodeAlias(&node); + addTranslation(node.toString(), brother, node.parent()); std::cout << "Subquery alias found:" << node.toString().toStdString() << "->" << brother->toString().toStdString() << std::endl; break; @@ -526,28 +540,23 @@ } case Token::S_TABLE_REF: { - i--; // At this moment iterator's stack points onto node beeing replaced. - Token *parent = node.parent(); - Token *me = const_cast<Token*>(&node); - TokenTable *newToken = new TokenTable(node); - parent->replaceChild(me->row(), newToken); - i++; /* A table reference was found. Traverse to ROOT, try to find a SUBQUERies ROOT - and update its table list + and update its table list */ - for( SQLParser::Statement::token_iterator_to_root k(const_cast<Token*>((Token*)newToken)); k->parent(); ++k) - { - if( k->getTokenType() == Token::S_SUBQUERY_NESTED || - k->getTokenType() == Token::S_SUBQUERY_FACTORED || - k->getTokenType() == Token::X_ROOT) - { - Token &n = *k; - TokenSubquery &s = static_cast<TokenSubquery&>(n); - s.nodeTables().insert(const_cast<Token*>((Token*)newToken)); - std::cout << "Table reference found:" << node.toStringRecursive().toStdString() << std::endl; - break; - } - } + // for( SQLParser::Statement::token_iterator_to_root k(const_cast<Token*>((Token*)&node)); k->parent(); ++k) + // { + // if( k->getTokenType() == Token::S_SUBQUERY_NESTED || + // k->getTokenType() == Token::S_SUBQUERY_FACTORED || + // k->getTokenType() == Token::X_ROOT) + // { + // TokenSubquery *s = static_cast<TokenSubquery*>(&*k); + // s->nodeTables().insert(const_cast<Token*>((Token*)&node)); + + // std::cout << "Table reference found:" << node.toStringRecursive().toStdString() << std::endl; + // break; + // } + // } + addTableRef(&node, node.parent()); _mTablesList.append(&*i); break; } @@ -556,14 +565,8 @@ case Token::X_ROOT: // TODO fix me. T_SELECT under T_UNION is also marked as X_ROOT => there is more than one X_ROOT node in AST tree. { if(node.parent() == NULL) - break; - i--; // At this moment iterator's stack points onto node beeing replaced. - Token *parent = node.parent(); - Token *me = const_cast<Token*>(&node); - TokenSubquery *newToken = new TokenSubquery(node); - ///newToken->setNodeAlias( (me->nodeAlias()); - parent->replaceChild(me->row(), newToken); - i++; + break; + addTableRef(&node, node.parent()); break; } } // switch(node.getTokenType()) @@ -608,7 +611,25 @@ } } }; - + + void OracleSQLStatement::addTableRef(Token const *tableOrSubquery, Token const *context) + { + for( SQLParser::Statement::token_iterator_to_root k(const_cast<Token*>(context)); k->parent(); ++k) + { + std::cout << "tr: " << k->toString().toStdString() << std::endl; + if( k->getTokenType() == Token::S_SUBQUERY_NESTED || + k->getTokenType() == Token::S_SUBQUERY_FACTORED || + k->getTokenType() == Token::X_ROOT) + { + TokenSubquery &s = static_cast<TokenSubquery&>(*k); + s.nodeTables().insert(tableOrSubquery); + + std::cout << "Table ref added:" << tableOrSubquery->toStringRecursive(false).toStdString() << " context: " << k->toString().toStdString() << std::endl; + break; + } + } + }; + /*virtual*/ void OracleSQLStatement::tree2Dot(std::ostream &o) const { Token const* _root = Statement::root(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ibr...@us...> - 2011-09-30 19:54:39
|
Revision: 4101 http://tora.svn.sourceforge.net/tora/?rev=4101&view=rev Author: ibre5041 Date: 2011-09-30 19:54:32 +0000 (Fri, 30 Sep 2011) Log Message: ----------- JOIN ON - partially working Modified Paths: -------------- branches/tora-trotl/src/docklets/toastwalk.cpp branches/tora-trotl/src/parsing/tsqlparse.h branches/tora-trotl/src/parsing/tsqlparseoracle.cpp Modified: branches/tora-trotl/src/docklets/toastwalk.cpp =================================================================== --- branches/tora-trotl/src/docklets/toastwalk.cpp 2011-09-28 19:26:23 UTC (rev 4100) +++ branches/tora-trotl/src/docklets/toastwalk.cpp 2011-09-30 19:54:32 UTC (rev 4101) @@ -53,12 +53,15 @@ } clusterName.replace('.', GLUE); clusterName.replace(':', GLUE); - sg["id"] = clusterName; + sg["id"] = clusterName; + snode->setNodeID(sg["id"]); target->addNewSubgraph(sg); TLOG(0,toDecorator,__HERE__) << "Subgraph: " << clusterName << ":" << node->toStringRecursive(false) << std::endl; foreach(SQLParser::Token const* table, tables) { + if( table->getTokenType() != SQLParser::Token::S_TABLE_REF) + continue; SQLParser::TokenTable const* t = static_cast<SQLParser::TokenTable const*>(table); QMap<QString,QString> ta; // table attributes QString tableName = t->toStringRecursive(false); // DOT does not allow ant "dots" in identifier names @@ -71,6 +74,7 @@ ta["id"]= clusterName + GLUE + tableName; if(t->nodeAlias() != NULL) ta["tooltip"] = t->nodeAlias()->toString(); + t->setNodeID(ta["id"]); target->addNewNodeToSubgraph(ta, sg["id"]); TLOG(0,toDecorator,__HERE__) << "new node:" << ta["id"] << " in subgraph: " << sg["id"] << std::endl; } @@ -82,6 +86,8 @@ QSet<SQLParser::Token const*> const& tables = snode->nodeTables(); foreach(SQLParser::Token const* table, tables) { + if( table->getTokenType() != SQLParser::Token::S_TABLE_REF) + continue; SQLParser::TokenTable const* t = static_cast<SQLParser::TokenTable const*>(table); QMap<QString,QString> ta; // table atributes QString tableName = t->toStringRecursive(false); // DOT does not allow ant "dots" in identifier names @@ -145,38 +151,50 @@ { SQLParser::Token const *t1 = source->translateAlias(firstTable->child(0)->toStringRecursive(false), &*node); SQLParser::Token const *t2 = source->translateAlias(secondTable->child(0)->toStringRecursive(false), &*node); - + QString e1, e2; + if(t1->getTokenType() == SQLParser::Token::S_SUBQUERY_NESTED || t1->getTokenType() == SQLParser::Token::S_SUBQUERY_FACTORED) { - t1 = source->translateAlias(firstTable->child(0)->toStringRecursive(false), t1); + if(!static_cast<SQLParser::TokenSubquery const*>(t1)->nodeID().isEmpty()) + e1 = static_cast<SQLParser::TokenSubquery const*>(t1)->nodeID(); } - + + if(t1->getTokenType() == SQLParser::Token::S_TABLE_REF) + { + e1 = QString("ROOT") + GLUE + t1->child(0)->toString() + GLUE + t1->child(2)->toString(); + } + if(t2->getTokenType() == SQLParser::Token::S_SUBQUERY_NESTED || t2->getTokenType() == SQLParser::Token::S_SUBQUERY_FACTORED) { - t2 = source->translateAlias(firstTable->child(0)->toStringRecursive(false), t2); + if(!static_cast<SQLParser::TokenSubquery const*>(t2)->nodeID().isEmpty()) + e2 = static_cast<SQLParser::TokenSubquery const*>(t2)->nodeID(); } - if(t1) - firstTable = t1; - if(t2) - secondTable = t2; - + if(t2->getTokenType() == SQLParser::Token::S_TABLE_REF) + { + e2 = QString("ROOT") + GLUE + t2->child(0)->toString() + GLUE + t2->child(2)->toString(); + } + QMap<QString,QString> ea; // edge attreibutes - if(t1 && t2) // TODO this is wrong + if(!e1.isEmpty() && !e2.isEmpty()) // TODO this is wrong { target->addNewEdge( - QString("ROOT") + GLUE + t1->child(0)->toString() + GLUE + t1->child(2)->toString(), - QString("ROOT") + GLUE + t2->child(0)->toString() + GLUE + t2->child(2)->toString(), + e1, + e2, ea); - TLOG(0,toDecorator,__HERE__) << "!!" << firstTable->toStringRecursive(false) << "->" << secondTable->toStringRecursive(false) << std::endl; + TLOG(0,toDecorator,__HERE__) << "!!" << e1.toStdString() << "->" << e2.toStdString() << std::endl; } else { - TLOG(0,toDecorator,__HERE__) << "??" << firstTable->toStringRecursive(false) << "->" << secondTable->toStringRecursive(false) << std::endl; + ////TLOG(0,toDecorator,__HERE__) << "??" << firstTable->toStringRecursive(false) << "->" << secondTable->toStringRecursive(false) << std::endl; } } break; } + case SQLParser::Token::S_WHERE: + { + break; + } } } Modified: branches/tora-trotl/src/parsing/tsqlparse.h =================================================================== --- branches/tora-trotl/src/parsing/tsqlparse.h 2011-09-28 19:26:23 UTC (rev 4100) +++ branches/tora-trotl/src/parsing/tsqlparse.h 2011-09-30 19:54:32 UTC (rev 4101) @@ -310,11 +310,15 @@ inline Token const* nodeAlias() const { return _mAlias; }; inline void setNodeAlias(Token const *t) { _mAlias = t; }; + inline QString nodeID() const { return _mNodeID; }; + inline void setNodeID(QString const &id) const { _mNodeID = id; }; + protected: /* Translate table ref SCHEMA.TABLE_A -> table alias "A" this pointer is present only if token is of type SUBQUERY, ROOT, TABLE_REF(schema.tablename) */ Token const* _mAlias; + mutable QString _mNodeID; }; class TSQLPARSER_EXPORT TokenSubquery: public Token @@ -340,6 +344,9 @@ inline Token const* nodeAlias() const { return _mAlias; }; inline void setNodeAlias(Token const *t) { _mAlias = t; }; + inline QString nodeID() const { return _mNodeID; }; + inline void setNodeID(QString const &id) const { _mNodeID = id; }; + inline Translation& aliasTranslation() { return _mAliasTranslation; }; inline Translation const& aliasTranslation() const { return _mAliasTranslation; }; @@ -360,6 +367,8 @@ /* Set of tables used in a (sub)query. This list is present only if token is of type SUBQUERY or ROOT */ QSet<Token const*> _mTables; + + mutable QString _mNodeID; }; class TSQLPARSER_EXPORT ParseException: public ::std::exception Modified: branches/tora-trotl/src/parsing/tsqlparseoracle.cpp =================================================================== --- branches/tora-trotl/src/parsing/tsqlparseoracle.cpp 2011-09-28 19:26:23 UTC (rev 4100) +++ branches/tora-trotl/src/parsing/tsqlparseoracle.cpp 2011-09-30 19:54:32 UTC (rev 4101) @@ -422,7 +422,6 @@ Token *parent = node.parent(); Token *me = const_cast<Token*>(&node); TokenSubquery *newToken = new TokenSubquery(node); - ///newToken->setNodeAlias( (me->nodeAlias()); parent->replaceChild(me->row(), newToken); i++; break; @@ -460,12 +459,12 @@ std::cout << node.toString().toStdString() << "=>" << brother->toStringRecursive().toStdString() << std::endl; //_mDeclarations.insertMulti(node.toString(), brother.data()); - //for(SQLParser::Statement::token_const_iterator_to_root k(&*i); &*k; ++k) - //{ - // std::cout << k->toString().toStdString() << "->"; - //} - //std::cout << std::endl; - + for(SQLParser::Statement::token_const_iterator_to_root k(&*i); &*k; ++k) + { + std::cout << k->toString().toStdString() << "->"; + } + std::cout << std::endl; + static_cast<TokenSubquery*>(brother)->setNodeAlias(&node); addTranslation(node.toString(), brother, node.parent()); break; @@ -475,11 +474,11 @@ std::cout << node.toString().toAscii().constData() << "=>" << (*brother).toStringRecursive().toAscii().constData() << std::endl; //_mDeclarations.insertMulti(node.toString(), brother.data()); - //for(SQLParser::Statement::token_const_iterator_to_root k(&*i); &*k; ++k) - //{ - // std::cout << k->toString().toStdString() << "->"; - //} - //std::cout << std::endl; + for(SQLParser::Statement::token_const_iterator_to_root k(&*i); &*k; ++k) + { + std::cout << k->toString().toStdString() << "->"; + } + std::cout << std::endl; static_cast<TokenSubquery*>(brother)->setNodeAlias(&node); addTranslation(node.toString(), brother, node.parent()); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ibr...@us...> - 2011-10-07 15:13:35
|
Revision: 4106 http://tora.svn.sourceforge.net/tora/?rev=4106&view=rev Author: ibre5041 Date: 2011-10-07 15:13:29 +0000 (Fri, 07 Oct 2011) Log Message: ----------- ObjectCache, identifier disambiguation Modified Paths: -------------- branches/tora-trotl/src/docklets/toastwalk.cpp branches/tora-trotl/src/parsing/tplsqlparseoracle.cpp branches/tora-trotl/src/parsing/tsqlparse.cpp branches/tora-trotl/src/parsing/tsqlparse.h branches/tora-trotl/src/parsing/tsqlparseoracle.cpp Modified: branches/tora-trotl/src/docklets/toastwalk.cpp =================================================================== --- branches/tora-trotl/src/docklets/toastwalk.cpp 2011-10-06 17:01:26 UTC (rev 4105) +++ branches/tora-trotl/src/docklets/toastwalk.cpp 2011-10-07 15:13:29 UTC (rev 4106) @@ -8,6 +8,52 @@ void toASTWalk(SQLParser::Statement *source, KGraphViewer::DotGraph *target) { + SQLParser::ObjectCache *o = new SQLParser::ObjectCache(); + QList<QString> cols; + + // INCIDENTS // T1 + cols.append(QString("INC_ACTUALFINISH")); + cols.append(QString("INC_ASSIGN_PERSON_TO")); + cols.append(QString("INC_ASSIGN_WORKGROUP")); + cols.append(QString("INC_CAT_OID")); + cols.append(QString("INC_CIT_OID")); + cols.append(QString("INC_CLA_OID")); + cols.append(QString("INC_CLO_OID")); + cols.append(QString("INC_DEADLINE")); + cols.append(QString("INC_DESCRIPTION")); + cols.append(QString("INC_ID")); + cols.append(QString("INC_IMP_OID")); + cols.append(QString("INC_OID")); + cols.append(QString("INC_POO_OID")); + cols.append(QString("INC_PRI_OID")); + cols.append(QString("INC_SEV_OID")); + cols.append(QString("INC_SOLUTION")); + cols.append(QString("INC_STA_OID")); + cols.append(QString("REG_CREATED")); + o->addTable(SQLParser::ObjectCache::TableInfo(QString("SERVICEDESK"), QString("ITSM_INCIDENTS"), cols)); + cols.clear(); + + // REP_CODES_TEXT // T2 + cols.append(QString("RCT_NAME")); + cols.append(QString("RCT_RCD_OID")); + o->addTable(SQLParser::ObjectCache::TableInfo(QString("SERVICEDESKREPO"), QString("REP_CODES_TEXT"), cols)); + cols.clear(); + + // ITSM_INC_CUSTOM_FIELDS // T3 + cols.append(QString("ICF_INCSHORTTEXT2")); + cols.append(QString("ICF_INCSHORTTEXT3")); + cols.append(QString("ICF_INCSHORTTEXT4")); + o->addTable(SQLParser::ObjectCache::TableInfo(QString("SERVICEDESK"), QString("ITSM_INC_CUSTOM_FIELDS"), cols)); + cols.clear(); + + // ITSM_WORKGROUPS // T4 + cols.append(QString("WOG_OID")); + cols.append(QString("WOG_SEARCHCODE")); + o->addTable(SQLParser::ObjectCache::TableInfo(QString("SERVICEDESK"), QString("ITSM_WORKGROUPS"), cols)); + cols.clear(); + + source->scanTree(o, QString("SERVICEDESK")); + //target->initEmpty(); //QMap<QString,QString> ga; //ga["id"] = "Query"; @@ -150,18 +196,19 @@ secondTable && secondTable->childCount() == 3 ) { - SQLParser::Token const *t1 = source->translateAlias(firstTable->child(0)->toStringRecursive(false), &*node); - SQLParser::Token const *t2 = source->translateAlias(secondTable->child(0)->toStringRecursive(false), &*node); + SQLParser::Token const *t1 = source->translateAlias(firstTable->child(0)->toStringRecursive(false).toUpper(), &*node); + SQLParser::Token const *t2 = source->translateAlias(secondTable->child(0)->toStringRecursive(false).toUpper(), &*node); QString e1, e2; - if(t1->getTokenType() == SQLParser::Token::S_SUBQUERY_NESTED || - t1->getTokenType() == SQLParser::Token::S_SUBQUERY_FACTORED) + if(t1 && ( + t1->getTokenType() == SQLParser::Token::S_SUBQUERY_NESTED || + t1->getTokenType() == SQLParser::Token::S_SUBQUERY_FACTORED)) { if(!static_cast<SQLParser::TokenSubquery const*>(t1)->nodeID().isEmpty()) e1 = static_cast<SQLParser::TokenSubquery const*>(t1)->nodeID(); } - if(t1->getTokenType() == SQLParser::Token::S_TABLE_REF) + if(t1 && t1->getTokenType() == SQLParser::Token::S_TABLE_REF) { e1 = QString("ROOT") + GLUE + t1->child(0)->toString(); if(t1->childCount() >= 3) @@ -169,14 +216,15 @@ } - if(t2->getTokenType() == SQLParser::Token::S_SUBQUERY_NESTED || - t2->getTokenType() == SQLParser::Token::S_SUBQUERY_FACTORED) + if(t2 && ( + t2->getTokenType() == SQLParser::Token::S_SUBQUERY_NESTED || + t2->getTokenType() == SQLParser::Token::S_SUBQUERY_FACTORED)) { if(!static_cast<SQLParser::TokenSubquery const*>(t2)->nodeID().isEmpty()) e2 = static_cast<SQLParser::TokenSubquery const*>(t2)->nodeID(); } - if(t2->getTokenType() == SQLParser::Token::S_TABLE_REF) + if(t2 && t2->getTokenType() == SQLParser::Token::S_TABLE_REF) { e2 = QString("ROOT") + GLUE + t2->child(0)->toString(); if(t2->childCount() >= 3) @@ -225,18 +273,19 @@ TLOG(0,toDecorator,__HERE__) << "!?" << firstTable->toStringRecursive(false) << "->" << secondTable->toStringRecursive(false) << std::endl; } - SQLParser::Token const *t1 = source->translateAlias(firstTable->child(0)->toStringRecursive(false), &*node); - SQLParser::Token const *t2 = source->translateAlias(secondTable->child(0)->toStringRecursive(false), &*node); + SQLParser::Token const *t1 = source->translateAlias(firstTable->child(0)->toStringRecursive(false).toUpper(), &*node); + SQLParser::Token const *t2 = source->translateAlias(secondTable->child(0)->toStringRecursive(false).toUpper(), &*node); QString e1, e2; - if(t1->getTokenType() == SQLParser::Token::S_SUBQUERY_NESTED || - t1->getTokenType() == SQLParser::Token::S_SUBQUERY_FACTORED) + if( t1 && ( + t1->getTokenType() == SQLParser::Token::S_SUBQUERY_NESTED || + t1->getTokenType() == SQLParser::Token::S_SUBQUERY_FACTORED)) { if(!static_cast<SQLParser::TokenSubquery const*>(t1)->nodeID().isEmpty()) e1 = static_cast<SQLParser::TokenSubquery const*>(t1)->nodeID(); } - if(t1->getTokenType() == SQLParser::Token::S_TABLE_REF) + if(t1 && t1->getTokenType() == SQLParser::Token::S_TABLE_REF) { // e1 = QString("ROOT") + GLUE + t1->child(0)->toString(); // if(t1->childCount() >= 3) @@ -244,14 +293,15 @@ e1 = static_cast<SQLParser::TokenTable const*>(t1)->nodeID(); } - if(t2->getTokenType() == SQLParser::Token::S_SUBQUERY_NESTED || - t2->getTokenType() == SQLParser::Token::S_SUBQUERY_FACTORED) + if(t2 && ( + t2->getTokenType() == SQLParser::Token::S_SUBQUERY_NESTED || + t2->getTokenType() == SQLParser::Token::S_SUBQUERY_FACTORED)) { if(!static_cast<SQLParser::TokenSubquery const*>(t2)->nodeID().isEmpty()) e2 = static_cast<SQLParser::TokenSubquery const*>(t2)->nodeID(); } - if(t2->getTokenType() == SQLParser::Token::S_TABLE_REF) + if(t2 && t2->getTokenType() == SQLParser::Token::S_TABLE_REF) { // e2 = QString("ROOT") + GLUE + t2->child(0)->toString(); // if(t2->childCount() >= 3) Modified: branches/tora-trotl/src/parsing/tplsqlparseoracle.cpp =================================================================== --- branches/tora-trotl/src/parsing/tplsqlparseoracle.cpp 2011-10-06 17:01:26 UTC (rev 4105) +++ branches/tora-trotl/src/parsing/tplsqlparseoracle.cpp 2011-10-07 15:13:29 UTC (rev 4106) @@ -84,16 +84,15 @@ { public: OraclePLSQLStatement(const QString &statement, const QString &name); - ~OraclePLSQLStatement() - {}; - virtual void tree2Dot(std::ostream &o) const; - //template<class T> T& recursiveWalk(Token const* node, T &stream) const; + virtual ~OraclePLSQLStatement() {}; + private: void parse (); /* Recursive walk through ANTLR3_BASE_TREE */ void treeWalk(pOraclePLSQLParser psr, QPointer<Token> root, ANTLR3_BASE_TREE *tree, ANTLR3_UINT32 &lastindex); /* Walk through Token tree and look for table names, table aliases, ... */ - void scanTree(); + virtual void scanTree(ObjectCache* o, QString const& cs); + void findDeclarations(); pANTLR3_VECTOR lexerTokenVector; }; @@ -183,7 +182,7 @@ treeWalk(psr, _mAST, langAST.tree, lastIndex); - scanTree(); + findDeclarations(); psr ->free (psr); psr = NULL; tstream ->free (tstream); tstream = NULL; this->lexerTokenVector = NULL; @@ -286,7 +285,9 @@ } // for each child }; - void OraclePLSQLStatement::scanTree() + /* virtual */ void OraclePLSQLStatement::scanTree(ObjectCache *, QString const& cs) {}; + + void OraclePLSQLStatement::findDeclarations() { for(SQLParser::Statement::token_const_iterator i=begin(); i!=end(); ++i) { @@ -319,13 +320,6 @@ } }; - /*virtual*/ void OraclePLSQLStatement::tree2Dot(std::ostream &o) const - { - Token const* _root = Statement::root(); - QString s; - //recursiveWalk<>(_root, s); - }; - }; // namespace SQLParser Util::RegisterInFactory<SQLParser::OraclePLSQLStatement, StatementFactTwoParmSing> regOraclePLSQLStatement("OraclePLSQL"); Modified: branches/tora-trotl/src/parsing/tsqlparse.cpp =================================================================== --- branches/tora-trotl/src/parsing/tsqlparse.cpp 2011-10-06 17:01:26 UTC (rev 4105) +++ branches/tora-trotl/src/parsing/tsqlparse.cpp 2011-10-07 15:13:29 UTC (rev 4106) @@ -142,7 +142,7 @@ k->getTokenType() == Token::X_ROOT) { TokenSubquery const &s = static_cast<TokenSubquery const&>(*k); - if(s.aliasTranslation().contains(alias)) + if(s.aliasTranslation().contains(alias.toUpper())) return s.aliasTranslation().value(alias); } } Modified: branches/tora-trotl/src/parsing/tsqlparse.h =================================================================== --- branches/tora-trotl/src/parsing/tsqlparse.h 2011-10-06 17:01:26 UTC (rev 4105) +++ branches/tora-trotl/src/parsing/tsqlparse.h 2011-10-07 15:13:29 UTC (rev 4106) @@ -35,7 +35,18 @@ public: class TableInfo { public: - inline QString const& schemaName() const { return _mSchema; }; + TableInfo(QString const& schema, QString const& table, QList<QString> columns) + : _mSchema(schema) + , _mTable(table) + , _mColumns(columns) + {}; + TableInfo(TableInfo const& other) + : _mSchema(other._mSchema) + , _mTable(other._mTable) + , _mColumns(other._mColumns) + {}; + + inline QString const& schemaName() const { return _mSchema; } inline QString const& tableName() const { return _mTable; }; inline QList<QString> const& columns() const { return _mColumns; }; protected: @@ -51,9 +62,19 @@ inline bool columnExists(QString const& schema, QString const& table, QString const& column) const { - return _mTableMap.constFind(QPair<QString, QString>(schema, table)) == _mTableMap.end(); + QMap<QPair<QString, QString>, TableInfo>::const_iterator t; + if( (t = getTable(schema, schema, table)) != _mTableMap.end()) + { + return t->columns().contains(column); + } else { + return false; + } }; + inline void addTable(TableInfo const& other) + { + _mTableMap.insert(QPair<QString,QString>(other.schemaName(), other.tableName()), other); + } protected: QMap<QPair<QString, QString>, TableInfo>::const_iterator getTable(QString const& currentSchema, QString const& schema, QString const& table) const; @@ -429,10 +450,15 @@ , _mEnd(NULL) {}; - ~Statement() {}; + /* Call this method after the instance is created. + It will use ObjectCache to disambiguate column names. + */ + virtual void scanTree(ObjectCache *, QString const&) = 0; + + virtual ~Statement() {}; + void dumpTree (); - virtual void tree2Dot(std::ostream&) const = 0; // TreeModel methods inline const Token* root() const Modified: branches/tora-trotl/src/parsing/tsqlparseoracle.cpp =================================================================== --- branches/tora-trotl/src/parsing/tsqlparseoracle.cpp 2011-10-06 17:01:26 UTC (rev 4105) +++ branches/tora-trotl/src/parsing/tsqlparseoracle.cpp 2011-10-07 15:13:29 UTC (rev 4106) @@ -9,6 +9,7 @@ #include "OracleSQLParser.h" #include "tsqlparse.h" +#include "tologger.h" #include <QPair> @@ -123,6 +124,9 @@ _mTokenTypeRef = X_FAILURE; } break; + case T_COLUMN_LIST: + _mTokenTypeRef = S_COLUMN_LIST; + break; case T_TABLE_CAST: _mTokenTypeRef = S_SUBQUERY_NESTED; break; @@ -144,25 +148,13 @@ } // switch(tokentype) }; - - //class OracleIdentifier: public Identifier - //{ - //public: - // OracleIdentifier(QVector<Token*> const &a) : Identifier(a) {}; - // OracleIdentifier() : Identifier() {}; - - // virtual ~OracleIdentifier() {}; - //private: - //protected: - //}; class OracleSQLStatement: public Statement { public: OracleSQLStatement(const QString &statement, const QString &name); - ~OracleSQLStatement() - {}; - virtual void tree2Dot(std::ostream &o) const; + virtual ~OracleSQLStatement() {}; + //template<class T> T& recursiveWalk(Token const* node, T &stream) const; private: void parse (); @@ -176,7 +168,7 @@ public: /* Walk through Token tree and look for table names, table aliases, ... and try to resolve them using cached database catalogue*/ - void scanTree(ObjectCache *); + virtual void scanTree(ObjectCache *, QString const&); private: void addTranslation(QString const& alias, Token const *tableOrSubquery, Token const *context); @@ -565,10 +557,96 @@ }; /* walk through statement tree and detect identifiers, tables, table aliases */ - void OracleSQLStatement::scanTree(ObjectCache* o) + void OracleSQLStatement::scanTree(ObjectCache* o, QString const& cs) { for(SQLParser::Statement::token_const_iterator i=begin(); i!=end(); ++i) { + if( i->getTokenType() == Token::S_IDENTIFIER ) + { + QString stopToken; + bool insideColumnList; + + // Do not resolve identifiers under S_COLUMN_LIST + for(token_iterator_to_root k(i->parent()); k->parent(); ++k) + { + stopToken = k->toString(); + if( k->getTokenType() == Token::S_COLUMN_LIST) + { + TLOG(0,toDecorator,__HERE__) << " Dont Resolve identifier: " << i->toStringRecursive().toStdString() << "\t under: " << stopToken.toStdString() << std::endl; + insideColumnList = true; + break; + } + if( k->getTokenType() == Token::X_ROOT || + k->getTokenType() == Token::S_SUBQUERY_FACTORED || + k->getTokenType() == Token::S_SUBQUERY_NESTED || + k->getTokenType() == Token::S_WHERE || + k->getTokenType() == Token::L_JOINING_CLAUSE) + { + insideColumnList = false; + break; + } + }; + if( insideColumnList) + continue; + + TokenIdentifier const& id = static_cast<TokenIdentifier const&>(*i); + TLOG(0,toDecorator,__HERE__) << "Resolve identifier: " << id.toStringRecursive().toStdString() << "\t under: " << stopToken.toStdString() << std::endl; + + QString schemaName, tableName, columnName; + + switch(id.childCount()) // odd children should be dots. + { + case 0: + case 2: + case 4: + TLOG(0,toDecorator,__HERE__) << " invalid length:" << id.childCount() << std::endl; + break; + case 1: + // We have column name only + break; + case 3: + { + // T1.C1 + tableName = id.child(0)->toStringRecursive(false).toUpper(); + // TODO check child(1) == '.' + columnName = id.child(2)->toStringRecursive(false).toUpper(); + + Token const *translatedAlias = translateAlias(tableName, &*i); + if( translatedAlias) + { + if(translatedAlias->childCount() == 3) + { + schemaName = translatedAlias->child(0)->toStringRecursive(false).toUpper(); + tableName = translatedAlias->child(2)->toStringRecursive(false).toUpper(); + goto label5; + } + if(translatedAlias->childCount() == 1) + { + tableName = translatedAlias->child(0)->toStringRecursive(false).toUpper(); + } + } + bool columnExists = o->columnExists(cs, tableName, columnName); + TLOG(0,toDecorator,__HERE__) << " identifier found " << cs << '.' << tableName << '.' << columnName << ':' << columnExists << std::endl; + } + break; + label5: + case 5: + { + if( schemaName.isEmpty() && tableName.isEmpty()) + { + schemaName = id.child(0)->toStringRecursive(false).toUpper(); + tableName = id.child(2)->toStringRecursive(false).toUpper(); + columnName = id.child(4)->toStringRecursive(false).toUpper(); + } + bool columnExists = o->columnExists(schemaName, tableName, columnName); + TLOG(0,toDecorator,__HERE__) << " identifier found: " << schemaName << '.' << tableName << '.' << columnName << ':' << columnExists << std::endl; + } + break; + default: + TLOG(0,toDecorator,__HERE__) << " unsupported length:" << id.childCount() << std::endl; + break; + } // switch(id.childCount()) // odd children should be dots. + } } }; @@ -582,7 +660,7 @@ k->getTokenType() == Token::X_ROOT) { TokenSubquery &s = static_cast<TokenSubquery&>(*k); - s.aliasTranslation().insert(alias, const_cast<Token*>(tableOrSubquery)); + s.aliasTranslation().insert(alias.toUpper(), const_cast<Token*>(tableOrSubquery)); //std::cout << "Alias translation added:" << alias.toStdString() << "=>" << tableOrSubquery->toStringRecursive(false).toStdString() << " context: " << k->toString().toStdString() << std::endl; break; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |