📄 main.c
字号:
case 7:
#line 142 "drop.y"
{
finish_flag=1; /*表示应当退出了*/
}
break;
case 9:
#line 150 "drop.y"
{
yyval.ss_var=(_selectstruct_type *)malloc(sizeof(_selectstruct_type));
yyval.ss_var->sf=yyvsp[-3].sf_var;
yyval.ss_var->st=yyvsp[-1].st_var;
yyval.ss_var->cons=NULL;
}
break;
case 10:
#line 157 "drop.y"
{
yyval.ss_var=(_selectstruct_type *)malloc(sizeof(_selectstruct_type));
yyval.ss_var->sf=yyvsp[-5].sf_var;
yyval.ss_var->st=yyvsp[-3].st_var;
yyval.ss_var->cons=yyvsp[-1].cons_var;
}
break;
case 11:
#line 165 "drop.y"
{
yyval.sf_var=yyvsp[0].sf_var;
}
break;
case 12:
#line 169 "drop.y"
{
yyval.sf_var=(_selectedfields_type *)malloc(sizeof(_selectedfields_type));
yyval.sf_var->table=NULL;
yyval.sf_var->field="*";
yyval.sf_var->next_sf=NULL;
}
break;
case 13:
#line 177 "drop.y"
{
yyval.st_var=(_selectedtables_type *)malloc(sizeof(_selectedtables_type));
yyval.st_var->table=yyvsp[0].yych;
yyval.st_var->next_st=NULL;
st_end=yyval.st_var;
}
break;
case 14:
#line 184 "drop.y"
{
yyval.st_var=yyvsp[-2].st_var;
st_var1=(_selectedtables_type *)malloc(sizeof(_selectedtables_type));
st_var1->table=yyvsp[0].yych;
st_var1->next_st=NULL;
st_end->next_st=st_var1; /*建立表名的连接*/
st_end=st_var1;
}
break;
case 15:
#line 194 "drop.y"
{
yyval.sf_var=yyvsp[0].sf_var;
sf_end=yyval.sf_var; /*第一个字段名称*/
}
break;
case 16:
#line 199 "drop.y"
{
yyval.sf_var=yyvsp[-2].sf_var;
sf_end->next_sf=yyvsp[0].sf_var; /*建立字段名的连接*/
sf_end=yyvsp[0].sf_var;
}
break;
case 17:
#line 206 "drop.y"
{
yyval.sf_var=(_selectedfields_type *)malloc(sizeof(_selectedfields_type));
yyval.sf_var->table=(char *)malloc(sizeof(10)); /*为以后填上表名预留空间*/
yyval.sf_var->table[0]='\0';
yyval.sf_var->field=yyvsp[0].yych;
yyval.sf_var->next_sf=NULL;
}
break;
case 18:
#line 214 "drop.y"
{
yyval.sf_var=(_selectedfields_type *)malloc(sizeof(_selectedfields_type));
yyval.sf_var->table=yyvsp[-2].yych;
yyval.sf_var->field=yyvsp[0].yych;
yyval.sf_var->next_sf=NULL;
}
break;
case 23:
#line 231 "drop.y"
{
yyval.cs_var=(_createstruct_type *)malloc(sizeof(_createstruct_type));
yyval.cs_var->table=yyvsp[-4].yych;
yyval.cs_var->fdef=yyvsp[-2].cfdef_var;
}
break;
case 24:
#line 238 "drop.y"
{
yyval.cfdef_var=yyvsp[0].cfdef_var;
cfdef_end=yyvsp[0].cfdef_var;
}
break;
case 25:
#line 243 "drop.y"
{
yyval.cfdef_var=yyvsp[-2].cfdef_var;
cfdef_end->next_fdef=yyvsp[0].cfdef_var;
cfdef_end=yyvsp[0].cfdef_var;
}
break;
case 26:
#line 250 "drop.y"
{
yyval.cfdef_var=(_createfieldsdef_type *)malloc(sizeof(_createfieldsdef_type));
yyval.cfdef_var->field=yyvsp[-1].yych;
if (strlen(yyvsp[0].yych)==0) /*表示类型为int的时候,用0表示类型,长度定为4*/
{yyval.cfdef_var->type="0";
yyval.cfdef_var->length="4";
yyval.cfdef_var->next_fdef=NULL;
}
else if(strcmp(yyvsp[0].yych,"d")==0)
{
yyval.cfdef_var->type="3";
yyval.cfdef_var->length="8";
yyval.cfdef_var->next_fdef=NULL;
}
else /*表示类型为char的时候,用1表示类型,长度定为$2*/
{yyval.cfdef_var->type="1";
yyval.cfdef_var->length=yyvsp[0].yych;
yyval.cfdef_var->next_fdef=NULL;
}
}
break;
case 27:
#line 273 "drop.y"
{yyval.yych=yyvsp[-1].yych;}
break;
case 28:
#line 275 "drop.y"
{yyval.yych="\0";}
break;
case 29:
#line 277 "drop.y"
{yyval.yych="d";}
break;
case 30:
#line 282 "drop.y"
{
yyval.drs_var=(_dropstruct_type *)malloc(sizeof(_dropstruct_type));
yyval.drs_var->table=yyvsp[-1].yych;
}
break;
case 31:
#line 289 "drop.y"
{
yyval.is_var=(_insertstruct_type *)malloc(sizeof(_insertstruct_type));
yyval.is_var->table=yyvsp[-6].yych;
yyval.is_var->ifs=yyvsp[-5].if_var;
yyval.is_var->iv=yyvsp[-2].iv_var;
}
break;
case 32:
#line 297 "drop.y"
{
yyval.if_var=(_insertfields_type *)malloc(sizeof(_insertfields_type));
yyval.if_var->field=(char *)malloc(sizeof(10));
yyval.if_var->field="";
yyval.if_var->next_if=(_insertfields_type *)malloc(sizeof(_insertfields_type));
yyval.if_var->next_if=NULL;
}
break;
case 33:
#line 305 "drop.y"
{
yyval.if_var=yyvsp[-1].if_var;
}
break;
case 34:
#line 310 "drop.y"
{
yyval.if_var=(_insertfields_type *)malloc(sizeof(_insertfields_type));
yyval.if_var->field=yyvsp[0].yych;
yyval.if_var->next_if=NULL;
if_end=yyval.if_var;
}
break;
case 35:
#line 317 "drop.y"
{
yyval.if_var=yyvsp[-2].if_var;
if_var1=(_insertfields_type *)malloc(sizeof(_insertfields_type));
if_var1->field=yyvsp[0].yych;
if_var1->next_if=NULL;
if_end->next_if=if_var1;
if_end=if_var1;
}
break;
case 36:
#line 327 "drop.y"
{
yyval.iv_var=yyvsp[0].iv_var;
yyval.iv_var->next_iv=NULL;
iv_end=yyval.iv_var;
}
break;
case 37:
#line 333 "drop.y"
{
yyval.iv_var=yyvsp[-2].iv_var;
iv_end->next_iv=yyvsp[0].iv_var;
iv_end=yyvsp[0].iv_var;
}
break;
case 38:
#line 340 "drop.y"
{
yyval.iv_var=(_insertvalues_type *)malloc(sizeof(_insertvalues_type));
yyval.iv_var->value=yyvsp[-1].yych;
yyval.iv_var->type='1';
yyval.iv_var->next_iv=NULL;
}
break;
case 39:
#line 347 "drop.y"
{
yyval.iv_var=(_insertvalues_type *)malloc(sizeof(_insertvalues_type));
yyval.iv_var->value=yyvsp[-1].yych;
yyval.iv_var->type='1';
yyval.iv_var->next_iv=NULL;
}
break;
case 40:
#line 354 "drop.y"
{
yyval.iv_var=(_insertvalues_type *)malloc(sizeof(_insertvalues_type));
yyval.iv_var->value=yyvsp[0].yych;
yyval.iv_var->type='0';
yyval.iv_var->next_iv=NULL;
}
break;
case 41:
#line 364 "drop.y"
{
yyval.ds_var=(_deletestruct_type *)malloc(sizeof(_deletestruct_type));
yyval.ds_var->table=yyvsp[-3].yych;
yyval.ds_var->cons=yyvsp[-1].cons_var;
}
break;
case 42:
#line 370 "drop.y"
{
yyval.ds_var=(_deletestruct_type *)malloc(sizeof(_deletestruct_type));
yyval.ds_var->table=yyvsp[-1].yych;
yyval.ds_var->cons=NULL;
}
break;
case 43:
#line 379 "drop.y"
{
yyval.cons_var=yyvsp[0].cons_var;
}
break;
case 44:
#line 383 "drop.y"
{
yyval.cons_var=(_conditions_type *)malloc(sizeof(_conditions_type));
yyval.cons_var->left=yyvsp[-5].cons_var;
yyval.cons_var->right=yyvsp[-1].cons_var;
yyval.cons_var->comp_op='a';
}
break;
case 45:
#line 390 "drop.y"
{
yyval.cons_var=(_conditions_type *)malloc(sizeof(_conditions_type));
yyval.cons_var->left=yyvsp[-5].cons_var;
yyval.cons_var->right=yyvsp[-1].cons_var;
yyval.cons_var->comp_op='o';
}
break;
case 46:
#line 398 "drop.y"
{
yyval.cons_var=(_conditions_type *)malloc(sizeof(_conditions_type));
yyval.cons_var->left=yyvsp[-2].cons_var;
yyval.cons_var->comp_op=yyvsp[-1].char_var;
yyval.cons_var->right=yyvsp[0].cons_var;
}
break;
case 47:
#line 406 "drop.y"
{yyval.cons_var=yyvsp[0].cons_var;
yyval.cons_var->comp_op='\0';
yyval.cons_var->type='2';
yyval.cons_var->left=NULL;
yyval.cons_var->right=NULL;
}
break;
case 48:
#line 414 "drop.y"
{
yyval.cons_var=yyvsp[0].cons_var;
yyval.cons_var->comp_op='\0';
yyval.cons_var->type='2';
yyval.cons_var->left=NULL;
yyval.cons_var->right=NULL;
}
break;
case 49:
#line 422 "drop.y"
{
yyval.cons_var=(_conditions_type *)malloc(sizeof(_conditions_type));
yyval.cons_var->left=NULL;
yyval.cons_var->right=NULL;
yyval.cons_var->comp_op='\0';
yyval.cons_var->type='1';
yyval.cons_var->value=yyvsp[-1].yych;
}
break;
case 50:
#line 431 "drop.y"
{
yyval.cons_var=(_conditions_type *)malloc(sizeof(_conditions_type));
yyval.cons_var->left=NULL;
yyval.cons_var->right=NULL;
yyval.cons_var->comp_op='\0';
yyval.cons_var->type='1';
yyval.cons_var->value=yyvsp[-1].yych;
}
break;
case 51:
#line 440 "drop.y"
{
yyval.cons_var=(_conditions_type *)malloc(sizeof(_conditions_type));
yyval.cons_var->left=NULL;
yyval.cons_var->right=NULL;
yyval.cons_var->type='0';
yyval.cons_var->value=yyvsp[0].yych;
yyval.cons_var->intval=atoi(yyvsp[0].yych);
}
break;
case 52:
#line 450 "drop.y"
{
yyval.cons_var=(_conditions_type *)malloc(sizeof(_conditions_type));
yyval.cons_var->table=(char *)malloc(sizeof(10)); /*为以后填上表名预留空间*/
yyval.cons_var->table[0]='\0';
yyval.cons_var->value=yyvsp[0].yych;
}
break;
case 53:
#line 457 "drop.y"
{
yyval.cons_var=(_conditions_type *)malloc(sizeof(_conditions_type));
yyval.cons_var->table=yyvsp[-2].yych;
yyval.cons_var->value=yyvsp[0].yych;
}
break;
case 54:
#line 465 "drop.y"
{yyval.char_var='<';
}
break;
case 55:
#line 468 "drop.y"
{yyval.char_var='>';
}
break;
case 56:
#line 471 "drop.y"
{yyval.char_var='=';
}
break;
case 57:
#line 476 "drop.y"
{
show_tables(dic.tab,dic.tab_num); /*显示已经有的表名*/
}
break;
case 58:
#line 480 "drop.y"
{
show_tab_dic(dic.tab,dic.tab_num); /*显示表数据字典*/
}
break;
case 59:
#line 484 "drop.y"
{
show_col_dic(dic.tab,dic.tab_num,dic.col,dic.col_num,yyvsp[0].yych); /*显示相应表的列信息*/
}
break;
#line 1194 "main.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 + -