📄 cqlyacc.cpp
字号:
//%2006//////////////////////////////////////////////////////////////////////////// Copyright (c) 2000, 2001, 2002 BMC Software; Hewlett-Packard Development// Company, L.P.; IBM Corp.; The Open Group; Tivoli Systems.// Copyright (c) 2003 BMC Software; Hewlett-Packard Development Company, L.P.;// IBM Corp.; EMC Corporation, The Open Group.// Copyright (c) 2004 BMC Software; Hewlett-Packard Development Company, L.P.;// IBM Corp.; EMC Corporation; VERITAS Software Corporation; The Open Group.// Copyright (c) 2005 Hewlett-Packard Development Company, L.P.; IBM Corp.;// EMC Corporation; VERITAS Software Corporation; The Open Group.// Copyright (c) 2006 Hewlett-Packard Development Company, L.P.; IBM Corp.;// EMC Corporation; Symantec Corporation; The Open Group.//// Permission is hereby granted, free of charge, to any person obtaining a copy// of this software and associated documentation files (the "Software"), to// deal in the Software without restriction, including without limitation the// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or// sell copies of the Software, and to permit persons to whom the Software is// furnished to do so, subject to the following conditions:// // THE ABOVE COPYRIGHT NOTICE AND THIS PERMISSION NOTICE SHALL BE INCLUDED IN// ALL COPIES OR SUBSTANTIAL PORTIONS OF THE SOFTWARE. THE SOFTWARE IS PROVIDED// "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT// LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR// PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.////==============================================================================#ifndef lintstatic char const yyrcsid[] = "$FreeBSD: src/usr.bin/yacc/skeleton.c,v 1.28 2000/01/17 02:04:06 bde Exp $";#endif#include <stdlib.h>#define YYBYACC 1#define YYMAJOR 1#define YYMINOR 9#define YYLEX yylex()#define YYEMPTY -1#define yyclearin (yychar=(YYEMPTY))#define yyerrok (yyerrflag=0)#define YYRECOVERING() (yyerrflag!=0)static int yygrowstack();#define yyparse CQL_parse#define yylex CQL_lex#define yyerror CQL_error#define yychar CQL_char#define yyval CQL_val#define yylval CQL_lval#define yydebug CQL_debug#define yynerrs CQL_nerrs#define yyerrflag CQL_errflag#define yyss CQL_ss#define yyssp CQL_ssp#define yyvs CQL_vs#define yyvsp CQL_vsp#define yylhs CQL_lhs#define yylen CQL_len#define yydefred CQL_defred#define yydgoto CQL_dgoto#define yysindex CQL_sindex#define yyrindex CQL_rindex#define yygindex CQL_gindex#define yytable CQL_table#define yycheck CQL_check#define yyname CQL_name#define yyrule CQL_rule#define yysslim CQL_sslim#define yystacksize CQL_stacksize#define YYPREFIX "CQL_"#line 30 "CQL.y"#include <Pegasus/Common/Config.h>#include <Pegasus/Common/String.h>#include <Pegasus/Common/CommonUTF.h>#include <Pegasus/Query/QueryCommon/QueryException.h>#include <Pegasus/Common/MessageLoader.h>#include <Pegasus/CQL/CQLFactory.h>#include "CQLObjects.h"#include <stdio.h>#define yyparse CQL_parse#define CQLPREDICATE 0#define CQLVALUE 1#define CQLIDENTIFIER 2#define CQLFUNCTION 3#define CQLCHAINEDIDENTIFIER 4#ifdef CQL_DEBUG_GRAMMAR#define DEBUG_GRAMMAR 1#else#define DEBUG_GRAMMAR 0#endifint yylex();static char msg[100];void printf_(char * msg){ if(DEBUG_GRAMMAR == 1) printf("%s\n",msg);}extern char * yytext;int chain_state;CQLFactory _factory = CQLFactory();extern int CQL_error(const char *err);enum CQLType { Id, CId, Val, Func, Fact, Trm, Expr, SPred, Pred, Str };typedef struct CQLObjPtr { void* _ptr; CQLType type; } CQLOBJPTR;Array<CQLObjPtr> _ptrs;CQLOBJPTR _ObjPtr;void CQL_Bison_Cleanup(){ for(Uint32 i = 0; i < _ptrs.size(); i++){ if(_ptrs[i]._ptr){ switch(_ptrs[i].type){ case Id: delete (CQLIdentifier*)_ptrs[i]._ptr; break; case CId: delete (CQLChainedIdentifier*)_ptrs[i]._ptr; break; case Val: delete (CQLValue*)_ptrs[i]._ptr; break; case Func: delete (CQLFunction*)_ptrs[i]._ptr; break; case Fact: delete (CQLFactor*)_ptrs[i]._ptr; break; case Trm: delete (CQLTerm*)_ptrs[i]._ptr; break; case Expr: delete (CQLExpression*)_ptrs[i]._ptr; break; case SPred: delete (CQLSimplePredicate*)_ptrs[i]._ptr; break; case Pred: delete (CQLPredicate*)_ptrs[i]._ptr; break; case Str: delete (String*)_ptrs[i]._ptr; } } } _ptrs.clear(); _factory.cleanup(); _factory = CQLFactory();}PEGASUS_NAMESPACE_BEGIN extern CQLParserState* CQL_globalParserState;Array<CQLPredicate> _arglist;PEGASUS_NAMESPACE_END#line 125 "CQL.y"typedef union { char * strValue; String * _string; CQLValue * _value; CQLIdentifier * _identifier; CQLChainedIdentifier * _chainedIdentifier; CQLPredicate * _predicate; ExpressionOpType _opType; void * _node;} YYSTYPE;#line 149 "y.tab.c"#define YYERRCODE 256#define IDENTIFIER 257#define STRING_LITERAL 258#define BINARY 259#define NEGATIVE_BINARY 260#define HEXADECIMAL 261#define NEGATIVE_HEXADECIMAL 262#define INTEGER 263#define NEGATIVE_INTEGER 264#define REAL 265#define NEGATIVE_REAL 266#define _TRUE 267#define _FALSE 268#define SCOPED_PROPERTY 269#define LPAR 270#define RPAR 271#define HASH 272#define DOT 273#define LBRKT 274#define RBRKT 275#define UNDERSCORE 276#define COMMA 277#define CONCAT 278#define DBL_PIPE 279#define PLUS 280#define MINUS 281#define TIMES 282#define DIV 283#define IS 284#define _NULL 285#define _EQ 286#define _NE 287#define _GT 288#define _LT 289#define _GE 290#define _LE 291#define _ISA 292#define _LIKE 293#define NOT 294#define _AND 295#define _OR 296#define SCOPE 297#define ANY 298#define EVERY 299#define IN 300#define SATISFIES 301#define STAR 302#define DOTDOT 303#define SHARP 304#define DISTINCT 305#define SELECT 306#define FIRST 307#define FROM 308#define WHERE 309#define ORDER 310#define BY 311#define ASC 312#define DESC 313#define AS 314#define UNEXPECTED_CHAR 315const short CQL_lhs[] = { -1, 1, 2, 3, 4, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 10, 10, 10, 10, 10, 11, 12, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 14, 14, 15, 16, 17, 18, 19, 19, 20, 20, 20, 20, 20, 20, 21, 21, 21, 21, 21, 21, 21, 22, 22, 23, 23, 24, 24, 25, 25, 26, 26, 26, 27, 28, 28, 29, 29, 30, 31, 31, 32, 33, 33, 0,};const short CQL_len[] = { 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 3, 1, 3, 1, 4, 3, 3, 5, 4, 1, 3, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 4, 3, 3, 3, 3, 3, 1, 2, 1, 3, 1, 3, 0, 1, 1, 3, 2, 1, 1, 3, 1, 1, 2, 0, 3, 1, 0, 2, 5,};const short CQL_defred[] = { 0, 0, 0, 1, 5, 6, 7, 8, 9, 10, 11, 12, 13, 19, 20, 4, 0, 0, 0, 66, 0, 27, 14, 16, 17, 15, 18, 23, 0, 0, 36, 37, 0, 0, 54, 56, 0, 0, 69, 0, 0, 0, 0, 38, 55, 0, 0, 0, 0, 0, 0, 41, 42, 43, 44, 45, 46, 0, 0, 0, 0, 0, 0, 0, 70, 0, 0, 24, 0, 0, 26, 67, 0, 29, 22, 0, 0, 34, 49, 0, 52, 53, 39, 40, 50, 51, 57, 0, 0, 2, 3, 0, 65, 0, 28, 0, 32, 48, 72, 0, 64, 0, 76, 31, 63, 0, 75,};const short CQL_dgoto[] = { 2, 20, 90, 91, 21, 22, 23, 24, 25, 26, 27, 74, 75, 41, 29, 30, 31, 32, 33, 84, 59, 34, 35, 36, 37, 69, 92, 93, 38, 39, 40, 64, 106, 102,};const short CQL_sindex[] = { -295, -152, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -136, -241, -98, 0, -256, 0, 0, 0, 0, 0, 0, 0, -255, -257, 0, 0, -196, -247, 0, 0, -265, -264, 0, -240, -260, -227, -261, 0, 0, -136, -241, -249, -136, -241, -273, 0, 0, 0, 0, 0, 0, -207, -241, -98, -82, -136, -136, -152, 0, -207, -244, 0, -264, -220, 0, 0, -218, 0, 0, -216, -264, 0, 0, -230, 0, 0, 0, 0, 0, 0, 0, -265, -240, 0, 0, -251, 0, -253, 0, -241, 0, 0, 0, -207, 0, -136, 0, 0, 0, -264, 0,};const short CQL_rindex[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, -219, 75, 0, 0, 78, 0, 0, 0, 101, -270, 0, -242, 0, 52, 0, 0, 0, -210, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -192, 0, 0, 0, 29, 0, 0, 0, -211, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 104, -242, 0, 0, 1, 0, 80, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 81, 0,};const short CQL_gindex[] = { 0, -42, 0, 0, -38, -13, 0, 0, 0, 0, 0, 0, 0, -1, 0, 0, 0, -33, 24, 0, 51, 67, 25, 36, -14, 0, 0, 0, 0, 37, 0, 11, 0, 0,};#define YYTABLESIZE 412const short CQL_table[] = { 28, 62, 42, 25, 43, 72, 3, 68, 3, 73, 67, 1, 78, 3, 45, 80, 46, 4, 47, 48, 15, 79, 49, 89, 72, 15, 82, 85, 73, 30, 61, 68, 62, 70, 76, 62, 77, 63, 68, 51, 52, 53, 54, 55, 56, 81, 66, 48, 65, 100, 3, 94, 33, 71, 95, 97, 101, 104, 33, 96, 33, 60, 28, 99, 21, 33, 71, 33, 33, 33, 33, 33, 33, 33, 33, 35, 33, 33, 47, 61, 74, 73, 103, 83, 60, 44, 86, 105, 50, 33, 51, 52, 53, 54, 55, 56, 57, 58, 87, 98, 88, 58, 0, 0, 59, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 0, 17, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 0, 17, 0, 0, 0, 0, 0, 18, 0, 0, 0, 0, 0, 0, 0, 19, 0, 0, 0, 0, 0, 0, 0, 18, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 0, 17, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 25, 0, 25, 25, 25, 0, 25, 0, 25, 0, 0, 0, 0, 25, 0, 25, 25, 25, 25, 25, 25, 25, 25, 0, 25, 25, 30, 0, 30, 30, 30, 0, 30, 0, 30, 0, 62, 25, 0, 30, 0, 30, 30, 30, 30, 30, 30, 30, 30, 33, 30, 30, 0, 33, 0, 33, 0, 33, 0, 0, 0, 0, 33, 30, 33, 33, 33, 33, 33, 33, 33, 33, 35, 33, 33, 47, 35, 0, 35, 47, 0, 47, 0, 0, 0, 35, 33, 35, 35, 35, 35, 35, 35, 35, 35, 0, 35, 35, 58, 47, 47, 59, 58, 0, 58, 59, 0, 59, 0, 35, 0, 0, 47, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 58, 0, 0, 59, 0, 0, 0, 0, 0, 0, 0, 0, 58, 0, 0, 59,};const short CQL_check[] = { 1, 0, 16, 0, 17, 47, 257, 277, 257, 47, 271, 306, 285, 257, 270, 57, 272, 258, 273, 274, 269, 294, 279, 65, 66, 269, 59, 60, 66, 0, 295, 45, 296, 46, 48, 296, 49, 277, 308, 286, 287, 288, 289, 290, 291, 58, 273, 274, 308, 91, 257, 271, 0, 302, 272, 285, 309, 99, 277, 275, 279, 271, 63, 314, 275, 284, 308, 286, 287, 288, 289, 290, 291, 292, 293, 0, 295, 296, 0, 271, 0, 0, 95, 59, 33, 18, 61, 101, 284, 308, 286, 287, 288, 289, 290, 291, 292, 293, 62, 88, 63, 0, -1, -1, 0, 257, 258, 259, 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, 270, -1, 272, 257, 258, 259, 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, 270, -1, 272, -1, -1, -1, -1, -1, 294, -1, -1, -1, -1, -1, -1, -1, 302, -1, -1, -1, -1, -1, -1, -1, 294, 257, 258, 259, 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, 270, -1, 272, 257, 258, 259, 260, 261, 262,
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -