📄 cqlyacc.cpp
字号:
_ObjPtr.type = Pred; _ptrs.append(_ObjPtr); }else{ /* error */ String _msg("comp->arith comp_op arith_or_value_symbol : $1 is not simple OR $3 is not simple"); throw CQLSyntaxErrorException( MessageLoaderParms(String("CQL.CQL_y.NOT_SIMPLE"), String("The CQLSimplePredicate is not simple while parsing rule $0 in position $1."), String("comp->arith comp_op arith_or_value_symbol"), CQL_globalParserState->currentTokenPos) ); } }break;case 51:#line 1036 "CQL.y"{ CQL_globalParserState->currentRule = "comp->value_symbol comp_op arith"; sprintf(msg,"BISON::comp->value_symbol comp_op arith\n"); printf_(msg); if(yyvsp[0]._predicate->isSimple()){ CQLExpression* _exp1 = (CQLExpression*)(_factory.makeObject(yyvsp[-2]._value, 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; _ObjPtr.type = Pred; _ptrs.append(_ObjPtr); }else{ /* error */ String _msg("comp->value_symbol comp_op arith : $3 is not simple"); throw CQLSyntaxErrorException( MessageLoaderParms(String("CQL.CQL_y.NOT_SIMPLE"), String("The CQLSimplePredicate is not simple while parsing rule $0 in position $1."), String("comp->value_symbol comp_op arith"), CQL_globalParserState->currentTokenPos) ); } }break;case 52:#line 1062 "CQL.y"{ CQL_globalParserState->currentRule = "comp->arith _ISA identifier"; /* make sure $1 isSimple(), get its expression, make simplepred->predicate */ sprintf(msg,"BISON::comp->arith _ISA identifier\n"); printf_(msg); CQLExpression *_expr1 = (CQLExpression*)(_factory.getObject(yyvsp[-2]._predicate,Predicate,Expression)); CQLChainedIdentifier _cid(*yyvsp[0]._identifier); CQLExpression *_expr2 = (CQLExpression*)(_factory.makeObject(&_cid,Expression)); CQLSimplePredicate _sp(*_expr1, *_expr2, ISA); _factory.setObject(yyvsp[-2]._predicate,&_sp,SimplePredicate); yyval._predicate = yyvsp[-2]._predicate; }break;case 53:#line 1076 "CQL.y"{ CQL_globalParserState->currentRule = "comp->arith _LIKE literal_string"; sprintf(msg,"BISON::comp->arith _LIKE literal_string\n"); printf_(msg); CQLExpression *_expr1 = (CQLExpression*)(_factory.getObject(yyvsp[-2]._predicate,Predicate,Expression)); CQLValue _val(*yyvsp[0]._string); CQLExpression *_expr2 = (CQLExpression*)(_factory.makeObject(&_val,Expression)); CQLSimplePredicate _sp(*_expr1, *_expr2, LIKE); _factory.setObject(yyvsp[-2]._predicate,&_sp,SimplePredicate); yyval._predicate = yyvsp[-2]._predicate; }break;case 54:#line 1090 "CQL.y"{ CQL_globalParserState->currentRule = "expr_factor->comp"; sprintf(msg,"BISON::expr_factor->comp\n"); printf_(msg); yyval._predicate = yyvsp[0]._predicate; }break;case 55:#line 1098 "CQL.y"{ CQL_globalParserState->currentRule = "expr_factor->NOT comp"; sprintf(msg,"BISON::expr_factor->NOT comp\n"); printf_(msg); yyvsp[0]._predicate->setInverted(!(yyvsp[0]._predicate->getInverted())); yyval._predicate = yyvsp[0]._predicate; }break;case 56:#line 1109 "CQL.y"{ CQL_globalParserState->currentRule = "expr_term->expr_factor"; sprintf(msg,"BISON::expr_term->expr_factor\n"); printf_(msg); yyval._predicate = yyvsp[0]._predicate; }break;case 57:#line 1117 "CQL.y"{ CQL_globalParserState->currentRule = "expr_term->expr_term AND expr_factor"; sprintf(msg,"BISON::expr_term->expr_term AND expr_factor\n"); printf_(msg); yyval._predicate = new CQLPredicate(); yyval._predicate->appendPredicate(*yyvsp[-2]._predicate); yyval._predicate->appendPredicate(*yyvsp[0]._predicate, AND); _ObjPtr._ptr = yyval._predicate; _ObjPtr.type = Pred; _ptrs.append(_ObjPtr); }break;case 58:#line 1132 "CQL.y"{ CQL_globalParserState->currentRule = "expr->expr_term"; sprintf(msg,"BISON::expr->expr_term\n"); printf_(msg); yyval._predicate = yyvsp[0]._predicate; }break;case 59:#line 1140 "CQL.y"{ CQL_globalParserState->currentRule = "expr->expr OR expr_term"; sprintf(msg,"BISON::expr->expr OR expr_term\n"); printf_(msg); yyval._predicate = new CQLPredicate(); yyval._predicate->appendPredicate(*yyvsp[-2]._predicate); yyval._predicate->appendPredicate(*yyvsp[0]._predicate, OR); _ObjPtr._ptr = yyval._predicate; _ObjPtr.type = Pred; _ptrs.append(_ObjPtr); }break;case 60:#line 1153 "CQL.y"{;}break;case 61:#line 1171 "CQL.y"{ CQL_globalParserState->currentRule = "arg_list->arg_list_sub->expr"; sprintf(msg,"BISON::arg_list_sub->expr\n"); printf_(msg); _arglist.append(*yyvsp[0]._predicate);/* since arg_list can loop back on itself, we need to store away previous solutions production. We keep track of previous productions in the _arglist array and later pass that to CQLFunction as part of chain: identifier LPAR arg_list RPAR */ }break;case 62:#line 1232 "CQL.y"{ CQL_globalParserState->currentRule = "from_specifier->class_path"; sprintf(msg,"BISON::from_specifier->class_path\n"); printf_(msg); CQL_globalParserState->statement->appendClassPath(*yyvsp[0]._identifier); }break;case 63:#line 1241 "CQL.y"{ CQL_globalParserState->currentRule = "from_specifier->class_path AS identifier"; sprintf(msg,"BISON::from_specifier->class_path AS identifier\n"); printf_(msg); CQLIdentifier _class(*yyvsp[-2]._identifier); String _alias(yyvsp[0]._identifier->getName().getString()); CQL_globalParserState->statement->insertClassPathAlias(_class,_alias); CQL_globalParserState->statement->appendClassPath(_class); }break;case 64:#line 1252 "CQL.y"{ CQL_globalParserState->currentRule = "from_specifier->class_path identifier"; sprintf(msg,"BISON::from_specifier->class_path identifier\n"); printf_(msg); CQLIdentifier _class(*yyvsp[-1]._identifier); String _alias(yyvsp[0]._identifier->getName().getString()); CQL_globalParserState->statement->insertClassPathAlias(_class,_alias); CQL_globalParserState->statement->appendClassPath(_class); }break;case 65:#line 1265 "CQL.y"{ CQL_globalParserState->currentRule = "from_criteria->from_specifier"; sprintf(msg,"BISON::from_criteria->from_specifier\n"); printf_(msg); }break;case 66:#line 1273 "CQL.y"{ CQL_globalParserState->currentRule = "star_expr->STAR"; sprintf(msg,"BISON::star_expr->STAR\n"); printf_(msg); CQLIdentifier _id("*"); yyval._chainedIdentifier = (CQLChainedIdentifier*)(_factory.makeObject(&_id,ChainedIdentifier)); }break;case 67:#line 1282 "CQL.y"{ CQL_globalParserState->currentRule = "star_expr->chain.*"; sprintf(msg,"BISON::star_expr->chain.*\n"); printf_(msg); CQLChainedIdentifier* _tmp = (CQLChainedIdentifier*)(_factory.getObject(yyvsp[-2]._node,Predicate,ChainedIdentifier)); CQLChainedIdentifier* _cid = new CQLChainedIdentifier(*_tmp); CQLIdentifier _id("*"); _cid->append(_id); yyval._chainedIdentifier = _cid; _ObjPtr._ptr = yyval._chainedIdentifier; _ObjPtr.type = CId; _ptrs.append(_ObjPtr); }break;case 68:#line 1298 "CQL.y"{ CQL_globalParserState->currentRule = "selected_entry->expr"; sprintf(msg,"BISON::selected_entry->expr\n"); printf_(msg); if(yyvsp[0]._predicate->isSimpleValue()){ CQLChainedIdentifier *_cid = (CQLChainedIdentifier*)(_factory.getObject(yyvsp[0]._predicate,Predicate,ChainedIdentifier)); CQL_globalParserState->statement->appendSelectIdentifier(*_cid); }else{ /* error */ String _msg("selected_entry->expr : $1 is not a simple value"); throw CQLSyntaxErrorException( MessageLoaderParms(String("CQL.CQL_y.NOT_SIMPLE_VALUE"), String("The CQLPredicate is not a simple value while parsing rule $0 in position $1."), String("selected_entry->expr"), CQL_globalParserState->currentTokenPos) ); } }break;case 69:#line 1317 "CQL.y"{ CQL_globalParserState->currentRule = "selected_entry->star_expr"; sprintf(msg,"BISON::selected_entry->star_expr\n"); printf_(msg); CQL_globalParserState->statement->appendSelectIdentifier(*yyvsp[0]._chainedIdentifier); }break;case 70:#line 1326 "CQL.y"{ CQL_globalParserState->currentRule = "select_list->selected_entry select_list_tail"; sprintf(msg,"BISON::select_list->selected_entry select_list_tail\n"); printf_(msg); }break;case 71:#line 1333 "CQL.y"{;}break;case 72:#line 1335 "CQL.y"{ CQL_globalParserState->currentRule = "select_list_tail->COMMA selected_entry select_list_tail"; sprintf(msg,"BISON::select_list_tail->COMMA selected_entry select_list_tail\n"); printf_(msg); }break;case 73:#line 1343 "CQL.y"{ CQL_globalParserState->currentRule = "search_condition->expr"; sprintf(msg,"BISON::search_condition->expr\n"); printf_(msg); CQL_globalParserState->statement->setPredicate(*yyvsp[0]._predicate); }break;case 74:#line 1351 "CQL.y"{}break;case 75:#line 1353 "CQL.y"{ CQL_globalParserState->currentRule = "optional_where->WHERE search_condition"; sprintf(msg,"BISON::optional_where->WHERE search_condition\n"); printf_(msg); CQL_globalParserState->statement->setHasWhereClause(); }break;case 76:#line 1362 "CQL.y"{ CQL_globalParserState->currentRule = "select_statement"; sprintf(msg,"select_statement\n\n"); printf_(msg); CQL_Bison_Cleanup(); }break;#line 1779 "y.tab.c" } yyssp -= yym; yystate = *yyssp; yyvsp -= yym; yym = yylhs[yyn]; if (yystate == 0 && yym == 0) {#if YYDEBUG if (yydebug) printf("%sdebug: after reduction, shifting from state 0 to\ state %d\n", YYPREFIX, YYFINAL);#endif yystate = YYFINAL; *++yyssp = YYFINAL; *++yyvsp = yyval; if (yychar < 0) { if ((yychar = yylex()) < 0) yychar = 0;#if YYDEBUG if (yydebug) { yys = 0; if (yychar <= YYMAXTOKEN) yys = yyname[yychar]; if (!yys) yys = "illegal-symbol"; printf("%sdebug: state %d, reading %d (%s)\n", YYPREFIX, YYFINAL, yychar, yys); }#endif } if (yychar == 0) goto yyaccept; goto yyloop; } if ((yyn = yygindex[yym]) && (yyn += yystate) >= 0 && yyn <= YYTABLESIZE && yycheck[yyn] == yystate) yystate = yytable[yyn]; else yystate = yydgoto[yym];#if YYDEBUG if (yydebug) printf("%sdebug: after reduction, shifting from state %d \to state %d\n", YYPREFIX, *yyssp, yystate);#endif if (yyssp >= yysslim && yygrowstack()) { goto yyoverflow; } *++yyssp = yystate; *++yyvsp = yyval; goto yyloop;yyoverflow: yyerror("yacc stack overflow");yyabort: return (1);yyaccept: return (0);}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -