sql.tab.c

来自「一个类似windows」· C语言 代码 · 共 2,284 行 · 第 1/5 页

C
2,284
字号
	if (! yyptr)
	  goto yyoverflowlab;
	YYSTACK_RELOCATE (yyss);
	YYSTACK_RELOCATE (yyvs);

#  undef YYSTACK_RELOCATE
	if (yyss1 != yyssa)
	  YYSTACK_FREE (yyss1);
      }
# endif
#endif /* no yyoverflow */

      yyssp = yyss + yysize - 1;
      yyvsp = yyvs + yysize - 1;


      YYDPRINTF ((stderr, "Stack size increased to %lu\n",
		  (unsigned long int) yystacksize));

      if (yyss + yystacksize - 1 <= yyssp)
	YYABORT;
    }

  YYDPRINTF ((stderr, "Entering state %d\n", yystate));

  goto yybackup;

/*-----------.
| yybackup.  |
`-----------*/
yybackup:

/* Do appropriate processing given the current state.  */
/* Read a lookahead token if we need one and don't already have one.  */
/* yyresume: */

  /* First try to decide what to do without reference to lookahead token.  */

  yyn = yypact[yystate];
  if (yyn == YYPACT_NINF)
    goto yydefault;

  /* Not known => get a lookahead token if don't already have one.  */

  /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol.  */
  if (yychar == YYEMPTY)
    {
      YYDPRINTF ((stderr, "Reading a token: "));
      yychar = YYLEX;
    }

  if (yychar <= YYEOF)
    {
      yychar = yytoken = YYEOF;
      YYDPRINTF ((stderr, "Now at end of input.\n"));
    }
  else
    {
      yytoken = YYTRANSLATE (yychar);
      YYDSYMPRINTF ("Next token is", yytoken, &yylval, &yylloc);
    }

  /* If the proper action on seeing token YYTOKEN is to reduce or to
     detect an error, take that action.  */
  yyn += yytoken;
  if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
    goto yydefault;
  yyn = yytable[yyn];
  if (yyn <= 0)
    {
      if (yyn == 0 || yyn == YYTABLE_NINF)
	goto yyerrlab;
      yyn = -yyn;
      goto yyreduce;
    }

  if (yyn == YYFINAL)
    YYACCEPT;

  /* Shift the lookahead token.  */
  YYDPRINTF ((stderr, "Shifting token %s, ", yytname[yytoken]));

  /* Discard the token being shifted unless it is eof.  */
  if (yychar != YYEOF)
    yychar = YYEMPTY;

  *++yyvsp = yylval;


  /* Count tokens shifted since error; after three, turn off error
     status.  */
  if (yyerrstatus)
    yyerrstatus--;

  yystate = yyn;
  goto yynewstate;


/*-----------------------------------------------------------.
| yydefault -- do the default action for the current state.  |
`-----------------------------------------------------------*/
yydefault:
  yyn = yydefact[yystate];
  if (yyn == 0)
    goto yyerrlab;
  goto yyreduce;


/*-----------------------------.
| yyreduce -- Do a reduction.  |
`-----------------------------*/
yyreduce:
  /* yyn is the number of a rule to reduce with.  */
  yylen = yyr2[yyn];

  /* If YYLEN is nonzero, implement the default value of the action:
     `$$ = $1'.

     Otherwise, the following line sets YYVAL to garbage.
     This behavior is undocumented and Bison
     users should not rely upon it.  Assigning to YYVAL
     unconditionally makes the parser a bit smaller, and it avoids a
     GCC warning that YYVAL may be used uninitialized.  */
  yyval = yyvsp[1-yylen];


  YY_REDUCE_PRINT (yyn);
  switch (yyn)
    {
        case 2:
#line 139 "./sql.y"
    {
        SQL_input* sql = (SQL_input*) info;
        *sql->view = yyvsp[0].query;
    ;}
    break;

  case 8:
#line 155 "./sql.y"
    {
            SQL_input *sql = (SQL_input*) info;
            MSIVIEW *insert = NULL; 
            UINT r;

            r = INSERT_CreateView( sql->db, &insert, yyvsp[-7].string, yyvsp[-5].column_list, yyvsp[-1].column_list, FALSE ); 
            if( !insert )
                YYABORT;
            yyval.query = insert;
        ;}
    break;

  case 9:
#line 166 "./sql.y"
    {
            SQL_input *sql = (SQL_input*) info;
            MSIVIEW *insert = NULL; 

            INSERT_CreateView( sql->db, &insert, yyvsp[-8].string, yyvsp[-6].column_list, yyvsp[-2].column_list, TRUE ); 
            if( !insert )
                YYABORT;
            yyval.query = insert;
        ;}
    break;

  case 10:
#line 179 "./sql.y"
    {
            SQL_input* sql = (SQL_input*) info;
            MSIVIEW *create = NULL; 

            if( !yyvsp[-1].column_list )
                YYABORT;
            CREATE_CreateView( sql->db, &create, yyvsp[-3].string, yyvsp[-1].column_list, FALSE );
            if( !create )
                YYABORT;
            yyval.query = create;
        ;}
    break;

  case 11:
#line 191 "./sql.y"
    {
            SQL_input* sql = (SQL_input*) info;
            MSIVIEW *create = NULL; 

            if( !yyvsp[-2].column_list )
                YYABORT;
            CREATE_CreateView( sql->db, &create, yyvsp[-4].string, yyvsp[-2].column_list, TRUE );
            if( !create )
                YYABORT;
            yyval.query = create;
        ;}
    break;

  case 12:
#line 206 "./sql.y"
    {
            SQL_input* sql = (SQL_input*) info;
            MSIVIEW *update = NULL; 

            UPDATE_CreateView( sql->db, &update, yyvsp[-4].string, yyvsp[-2].column_list, yyvsp[0].expr );
            if( !update )
                YYABORT;
            yyval.query = update;
        ;}
    break;

  case 13:
#line 219 "./sql.y"
    {
            SQL_input* sql = (SQL_input*) info;
            MSIVIEW *delete = NULL; 

            DELETE_CreateView( sql->db, &delete, yyvsp[0].query );
            if( !delete )
                YYABORT;
            yyval.query = delete;
        ;}
    break;

  case 14:
#line 232 "./sql.y"
    {
            if( SQL_MarkPrimaryKeys( yyvsp[-3].column_list, yyvsp[0].column_list ) )
                yyval.column_list = yyvsp[-3].column_list;
            else
                yyval.column_list = NULL;
        ;}
    break;

  case 15:
#line 242 "./sql.y"
    {
            column_info *ci;

            for( ci = yyvsp[-2].column_list; ci->next; ci = ci->next )
                ;

            ci->next = yyvsp[0].column_list;
            yyval.column_list = yyvsp[-2].column_list;
        ;}
    break;

  case 16:
#line 252 "./sql.y"
    {
            yyval.column_list = yyvsp[0].column_list;
        ;}
    break;

  case 17:
#line 259 "./sql.y"
    {
            yyval.column_list = yyvsp[-1].column_list;
            yyval.column_list->type = yyvsp[0].column_type | MSITYPE_VALID;
        ;}
    break;

  case 18:
#line 267 "./sql.y"
    {
            yyval.column_type = yyvsp[0].column_type;
        ;}
    break;

  case 19:
#line 271 "./sql.y"
    {
            yyval.column_type = yyvsp[-1].column_type | MSITYPE_LOCALIZABLE;
        ;}
    break;

  case 20:
#line 278 "./sql.y"
    {
            yyval.column_type |= MSITYPE_NULLABLE;
        ;}
    break;

  case 21:
#line 282 "./sql.y"
    {
            yyval.column_type = yyvsp[-2].column_type;
        ;}
    break;

  case 22:
#line 289 "./sql.y"
    {
            yyval.column_type = MSITYPE_STRING | 1;
        ;}
    break;

  case 23:
#line 293 "./sql.y"
    {
            yyval.column_type = MSITYPE_STRING | 0x400 | yyvsp[-1].column_type;
        ;}
    break;

  case 24:
#line 297 "./sql.y"
    {
            yyval.column_type = 2;
        ;}
    break;

  case 25:
#line 301 "./sql.y"
    {
            yyval.column_type = 2;
        ;}
    break;

  case 26:
#line 305 "./sql.y"
    {
            yyval.column_type = 2;
        ;}
    break;

  case 27:
#line 309 "./sql.y"
    {
            yyval.column_type = 4;
        ;}
    break;

  case 28:
#line 313 "./sql.y"
    {
            yyval.column_type = MSITYPE_STRING | MSITYPE_VALID;
        ;}
    break;

  case 29:
#line 320 "./sql.y"
    {
            if( ( yyvsp[0].integer > 255 ) || ( yyvsp[0].integer < 0 ) )
                YYABORT;
            yyval.column_type = yyvsp[0].integer;
        ;}
    break;

  case 30:
#line 329 "./sql.y"
    {
            SQL_input* sql = (SQL_input*) info;

            yyval.query = NULL;
            if( yyvsp[0].column_list )
                ORDER_CreateView( sql->db, &yyval.query, yyvsp[-3].query, yyvsp[0].column_list );
            else
                yyval.query = yyvsp[-3].query;
            if( !yyval.query )
                YYABORT;
        ;}
    break;

  case 32:
#line 345 "./sql.y"
    {
            yyval.query = yyvsp[0].query;
        ;}
    break;

  case 33:
#line 349 "./sql.y"
    {
            SQL_input* sql = (SQL_input*) info;
            UINT r;

            yyval.query = NULL;
            r = DISTINCT_CreateView( sql->db, &yyval.query, yyvsp[0].query );
            if (r != ERROR_SUCCESS)
            {
                yyvsp[0].query->ops->delete(yyvsp[0].query);
                YYABORT;
            }
        ;}
    break;

  case 34:
#line 365 "./sql.y"
    {
            SQL_input* sql = (SQL_input*) info;
            UINT r;

            yyval.query = NULL;
            if( yyvsp[-1].column_list )
            {
                r = SELECT_CreateView( sql->db, &yyval.query, yyvsp[0].query, yyvsp[-1].column_list );
                if (r != ERROR_SUCCESS)
                {
                    yyvsp[0].query->ops->delete(yyvsp[0].query);
                    YYABORT;
                }
            }
            else
                yyval.query = yyvsp[0].query;
        ;}
    break;

  case 36:
#line 387 "./sql.y"
    { 
            yyvsp[-2].column_list->next = yyvsp[0].column_list;
        ;}
    break;

  case 37:
#line 391 "./sql.y"
    {
            yyval.column_list = NULL;
        ;}
    break;

  case 39:
#line 399 "./sql.y"
    { 
            SQL_input* sql = (SQL_input*) info;
            UINT r;

            yyval.query = NULL;
            r = WHERE_CreateView( sql->db, &yyval.query, yyvsp[-2].query, yyvsp[0].expr );
            if( r != ERROR_SUCCESS )
            {
                yyvsp[-2].query->ops->delete( yyvsp[-2].query );
                YYABORT;
            }
        ;}
    break;

  case 40:
#line 415 "./sql.y"
    {
            SQL_input* sql = (SQL_input*) info;
            UINT r;

            yyval.query = NULL;
            r = TABLE_CreateView( sql->db, yyvsp[0].string, &yyval.query );
            if( r != ERROR_SUCCESS || !yyval.query )
                YYABORT;
        ;}
    break;

  case 41:
#line 428 "./sql.y"
    {
            yyval.expr = yyvsp[-1].expr;
            if( !yyval.expr )
                YYABORT;
        ;}
    break;

  case 42:
#line 434 "./sql.y"

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?