📄 cqlyacc.cpp
字号:
String("chain.scoped_property"), CQL_globalParserState->currentTokenPos) ); } chain_state = CQLCHAINEDIDENTIFIER; }break;case 30:#line 634 "CQL.y"{ CQL_globalParserState->currentRule = "chain->chain.identifier"; sprintf(msg,"BISON::chain->chain.identifier : chain_state = %d\n",chain_state); printf_(msg); if(chain_state == CQLIDENTIFIER){ CQLIdentifier *_id = ((CQLIdentifier*)(_factory.getObject(yyvsp[-2]._node,Predicate,Identifier))); CQLChainedIdentifier _cid(*_id); _cid.append(*yyvsp[0]._identifier); yyval._node = _factory.makeObject(&_cid,Predicate); }else if(chain_state == CQLCHAINEDIDENTIFIER){ CQLChainedIdentifier *_cid = ((CQLChainedIdentifier*)(_factory.getObject(yyvsp[-2]._node,Predicate,ChainedIdentifier))); _cid->append(*yyvsp[0]._identifier); _factory.setObject(((CQLPredicate*)yyvsp[-2]._node),_cid,ChainedIdentifier); yyval._node = yyvsp[-2]._node; }else{ /* error */ String _msg("chain-> chain DOT identifier : chain state not CQLIDENTIFIER or CQLCHAINEDIDENTIFIER"); throw CQLSyntaxErrorException( MessageLoaderParms(String("CQL.CQL_y.NOT_CHAINID_OR_IDENTIFIER"), String("Chain state not a CQLIdentifier or a CQLChainedIdentifier while parsing rule $0 in position $1."), String("chain.identifier"), CQL_globalParserState->currentTokenPos) ); } chain_state = CQLCHAINEDIDENTIFIER; }break;case 31:#line 663 "CQL.y"{ CQL_globalParserState->currentRule = "chain->chain.identifier#literal_string"; sprintf(msg,"BISON::chain->chain.identifier#literal_string : chain_state = %d\n",chain_state); printf_(msg); if(chain_state == CQLIDENTIFIER){ CQLIdentifier *_id = ((CQLIdentifier*)(_factory.getObject(yyvsp[-4]._node,Predicate,Identifier))); CQLChainedIdentifier _cid(*_id); String tmp(yyvsp[-2]._identifier->getName().getString()); tmp.append("#").append(*yyvsp[0]._string); CQLIdentifier _id1(tmp); _cid.append(_id1); _factory.setObject(((CQLPredicate*)yyvsp[-4]._node),&_cid,ChainedIdentifier); yyval._node = yyvsp[-4]._node; }else if(chain_state == CQLCHAINEDIDENTIFIER){ CQLChainedIdentifier *_cid = ((CQLChainedIdentifier*)(_factory.getObject(yyvsp[-4]._node,Predicate,ChainedIdentifier))); String tmp(yyvsp[-2]._identifier->getName().getString()); tmp.append("#").append(*yyvsp[0]._string); CQLIdentifier _id1(tmp); _cid->append(_id1); _factory.setObject(((CQLPredicate*)yyvsp[-4]._node),_cid,ChainedIdentifier); yyval._node = yyvsp[-4]._node; }else{ /* error */ String _msg("chain->chain.identifier#literal_string : chain state not CQLIDENTIFIER or CQLCHAINEDIDENTIFIER"); throw CQLSyntaxErrorException( MessageLoaderParms(String("CQL.CQL_y.NOT_CHAINID_OR_IDENTIFIER"), String("Chain state not a CQLIdentifier or a CQLChainedIdentifier while parsing rule $0 in position $1."), String("chain.identifier#literal_string"), CQL_globalParserState->currentTokenPos) ); } chain_state = CQLCHAINEDIDENTIFIER; }break;case 32:#line 700 "CQL.y"{ CQL_globalParserState->currentRule = "chain->chain[ array_index_list ]"; sprintf(msg,"BISON::chain->chain[ array_index_list ] : chain_state = %d\n",chain_state); printf_(msg); if(chain_state == CQLIDENTIFIER){ CQLIdentifier *_id = ((CQLIdentifier*)(_factory.getObject(yyvsp[-3]._node,Predicate,Identifier))); String tmp = _id->getName().getString(); tmp.append("[").append(*yyvsp[-1]._string).append("]"); CQLIdentifier _id1(tmp); CQLChainedIdentifier _cid(_id1); _factory.setObject(((CQLPredicate*)yyvsp[-3]._node),&_cid,ChainedIdentifier); yyval._node = yyvsp[-3]._node; }else if(chain_state == CQLCHAINEDIDENTIFIER || chain_state == CQLVALUE){ CQLPredicate* _pred = (CQLPredicate*)yyvsp[-3]._node; CQLChainedIdentifier *_cid = ((CQLChainedIdentifier*)(_factory.getObject(yyvsp[-3]._node,Predicate,ChainedIdentifier))); CQLIdentifier tmpid = _cid->getLastIdentifier(); String tmp = tmpid.getName().getString(); tmp.append("[").append(*yyvsp[-1]._string).append("]"); CQLIdentifier _id1(tmp); CQLChainedIdentifier _tmpcid(_id1); if(_cid->size() == 1){ _cid = &_tmpcid; }else{ _cid->append(_id1); } _factory.setObject(((CQLPredicate*)yyvsp[-3]._node),_cid,ChainedIdentifier); yyval._node = yyvsp[-3]._node; }else{ /* error */ String _msg("chain->chain[ array_index_list ] : chain state not CQLIDENTIFIER or CQLCHAINEDIDENTIFIER or CQLVALUE"); throw CQLSyntaxErrorException( MessageLoaderParms(String("CQL.CQL_y.NOT_CHAINID_OR_IDENTIFIER_OR_VALUE"), String("Chain state not a CQLIdentifier or a CQLChainedIdentifier or a CQLValue while parsing rule $0 in position $1."), String("chain->chain[ array_index_list ]"), CQL_globalParserState->currentTokenPos) ); } }break;case 33:#line 742 "CQL.y"{ CQL_globalParserState->currentRule = "concat->chain"; sprintf(msg,"BISON::concat->chain\n"); printf_(msg); yyval._predicate = ((CQLPredicate*)yyvsp[0]._node); }break;case 34:#line 750 "CQL.y"{ CQL_globalParserState->currentRule = "concat->concat || literal_string"; sprintf(msg,"BISON::concat||literal_string\n"); printf_(msg); CQLValue* tmpval = new CQLValue(*yyvsp[0]._string); _ObjPtr._ptr = tmpval; _ObjPtr.type = Val; _ptrs.append(_ObjPtr); if((CQLPredicate*)yyvsp[-2]._predicate->isSimple()) { CQLSimplePredicate sp = ((CQLPredicate*)yyvsp[-2]._predicate)->getSimplePredicate(); if(sp.isSimple()) { CQLExpression exp = sp.getLeftExpression(); if(exp.isSimple()) { CQLTerm* _term = ((CQLTerm*)(_factory.getObject(yyvsp[-2]._predicate, Predicate, Term))); /* check for simple literal values*/ Array<CQLFactor> factors = _term->getFactors(); for(Uint32 i = 0; i < factors.size(); i++){ if(!factors[i].isSimpleValue()){ MessageLoaderParms mparms("CQL.CQL_y.CONCAT_PRODUCTION_FACTORS_NOT_SIMPLE", "The CQLFactors are not simple while processing rule $0.", CQL_globalParserState->currentRule); throw CQLSyntaxErrorException(mparms); }else{ CQLValue val = factors[i].getValue(); if(val.getValueType() != CQLValue::String_type){ MessageLoaderParms mparms("CQL.CQL_y.CONCAT_PRODUCTION_VALUE_NOT_LITERAL", "The CQLValue is not a string literal while processing rule $0.", CQL_globalParserState->currentRule); throw CQLSyntaxErrorException(mparms); } } } CQLFactor* _fctr2 = ((CQLFactor*)(_factory.makeObject(tmpval, Factor))); _term->appendOperation(concat,*_fctr2); yyval._predicate = (CQLPredicate*)(_factory.makeObject(_term,Predicate)); } else { MessageLoaderParms mparms("CQL.CQL_y.CONCAT_PRODUCTION_NOT_SIMPLE", "The $0 is not simple while processing rule $1.", String("CQLExpression"), CQL_globalParserState->currentRule); throw CQLSyntaxErrorException(mparms); } } else { MessageLoaderParms mparms("CQL.CQL_y.CONCAT_PRODUCTION_NOT_SIMPLE", "The $0 is not simple while processing rule $1.", String("CQLSimplePredicate"), CQL_globalParserState->currentRule); throw CQLSyntaxErrorException(mparms); } } else { MessageLoaderParms mparms("CQL.CQL_y.CONCAT_PRODUCTION_NOT_SIMPLE", "The $0 is not simple while processing rule $1.", String("CQLPredicate"), CQL_globalParserState->currentRule); throw CQLSyntaxErrorException(mparms); } }break;case 35:#line 821 "CQL.y"{ CQL_globalParserState->currentRule = "factor->concat"; sprintf(msg,"BISON::factor->concat\n"); printf_(msg); yyval._predicate = yyvsp[0]._predicate; }break;case 36:#line 848 "CQL.y"{ CQL_globalParserState->currentRule = "term->factor"; sprintf(msg,"BISON::term->factor\n"); printf_(msg); yyval._predicate = yyvsp[0]._predicate; }break;case 37:#line 874 "CQL.y"{ CQL_globalParserState->currentRule = "arith->term"; sprintf(msg,"BISON::arith->term\n"); printf_(msg); /*CQLPredicate* _pred = new CQLPredicate(*$1);*//* _factory._predicates.append(_pred);*/ yyval._predicate = yyvsp[0]._predicate; }break;case 38:#line 902 "CQL.y"{ CQL_globalParserState->currentRule = "value_symbol->#literal_string"; sprintf(msg,"BISON::value_symbol->#literal_string\n"); printf_(msg); String tmp("#"); tmp.append(*yyvsp[0]._string); CQLIdentifier tmpid(tmp); yyval._value = new CQLValue(tmpid); _ObjPtr._ptr = yyval._value; _ObjPtr.type = Val; _ptrs.append(_ObjPtr); }break;case 39:#line 918 "CQL.y"{ CQL_globalParserState->currentRule = "arith_or_value_symbol->arith"; sprintf(msg,"BISON::arith_or_value_symbol->arith\n"); printf_(msg); yyval._predicate = yyvsp[0]._predicate; }break;case 40:#line 926 "CQL.y"{ /* make into predicate */ CQL_globalParserState->currentRule = "arith_or_value_symbol->value_symbol"; sprintf(msg,"BISON::arith_or_value_symbol->value_symbol\n"); printf_(msg); CQLFactor _fctr(*yyvsp[0]._value); yyval._predicate = (CQLPredicate*)(_factory.makeObject(&_fctr, Predicate)); }break;case 41:#line 938 "CQL.y"{ CQL_globalParserState->currentRule = "comp_op->_EQ"; sprintf(msg,"BISON::comp_op->_EQ\n"); printf_(msg); yyval._opType = EQ; }break;case 42:#line 945 "CQL.y"{ CQL_globalParserState->currentRule = "comp_op->_NE"; sprintf(msg,"BISON::comp_op->_NE\n"); printf_(msg); yyval._opType = NE; }break;case 43:#line 952 "CQL.y"{ CQL_globalParserState->currentRule = "comp_op->_GT"; sprintf(msg,"BISON::comp_op->_GT\n"); printf_(msg); yyval._opType = GT; }break;case 44:#line 959 "CQL.y"{ CQL_globalParserState->currentRule = "comp_op->_LT"; sprintf(msg,"BISON::comp_op->_LT\n"); printf_(msg); yyval._opType = LT; }break;case 45:#line 966 "CQL.y"{ CQL_globalParserState->currentRule = "comp_op->_GE"; sprintf(msg,"BISON::comp_op->_GE\n"); printf_(msg); yyval._opType = GE; }break;case 46:#line 973 "CQL.y"{ CQL_globalParserState->currentRule = "comp_op->_LE"; sprintf(msg,"BISON::comp_op->_LE\n"); printf_(msg); yyval._opType = LE; }break;case 47:#line 982 "CQL.y"{ CQL_globalParserState->currentRule = "comp->arith"; sprintf(msg,"BISON::comp->arith\n"); printf_(msg); yyval._predicate = yyvsp[0]._predicate; }break;case 48:#line 990 "CQL.y"{ CQL_globalParserState->currentRule = "comp->arith IS NOT _NULL"; sprintf(msg,"BISON::comp->arith IS NOT _NULL\n"); printf_(msg); CQLExpression *_expr = (CQLExpression*)(_factory.getObject(yyvsp[-3]._predicate,Expression)); CQLSimplePredicate _sp(*_expr, IS_NOT_NULL); _factory.setObject(yyvsp[-3]._predicate,&_sp,SimplePredicate); yyval._predicate = yyvsp[-3]._predicate; }break;case 49:#line 1001 "CQL.y"{ CQL_globalParserState->currentRule = "comp->arith IS _NULL"; sprintf(msg,"BISON::comp->arith IS _NULL\n"); printf_(msg); CQLExpression *_expr = (CQLExpression*)(_factory.getObject(yyvsp[-2]._predicate,Expression)); CQLSimplePredicate _sp(*_expr, IS_NULL); _factory.setObject(yyvsp[-2]._predicate,&_sp,SimplePredicate); yyval._predicate = yyvsp[-2]._predicate; }break;case 50:#line 1012 "CQL.y"{ CQL_globalParserState->currentRule = "comp->arith comp_op arith_or_value_symbol"; sprintf(msg,"BISON::comp->arith comp_op arith_or_value_symbol\n"); printf_(msg); if(yyvsp[-2]._predicate->isSimple() && yyvsp[0]._predicate->isSimple()){ CQLExpression* _exp1 = (CQLExpression*)(_factory.getObject(yyvsp[-2]._predicate,Predicate,Expression)); CQLExpression* _exp2 = (CQLExpression*)(_factory.getObject(yyvsp[0]._predicate,Predicate,Expression)); CQLSimplePredicate _sp(*_exp1, *_exp2, yyvsp[-1]._opType); yyval._predicate = new CQLPredicate(_sp); _ObjPtr._ptr = yyval._predicate;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -