⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 parse.c

📁 在VC6环境下开发
💻 C
📖 第 1 页 / 共 3 页
字号:
	yygotominor.yy20 = eDbIdListAppend(yymsp[-2].minor.yy20,&yymsp[0].minor.yy68);	break;
	case 41:
	yygotominor.yy20 = eDbIdListAppend(0,&yymsp[0].minor.yy68);	break;
	case 42:
	eDbDeleteFrom(pParse,eDbSrcListAppend(0,&yymsp[-1].minor.yy68,0),yymsp[0].minor.yy82);	break;
	case 43:
	yygotominor.yy82 = 0;	break;
	case 44:
	yygotominor.yy82 = yymsp[0].minor.yy82;	break;
	case 45:
	eDbUpdate(pParse,eDbSrcListAppend(0,&yymsp[-3].minor.yy68,0),yymsp[-1].minor.yy5,yymsp[0].minor.yy82);	break;
	case 46:
	yygotominor.yy5 = eDbIdExprListAppend(yymsp[-4].minor.yy5,yymsp[0].minor.yy82,&yymsp[-2].minor.yy68);	break;
	case 47:
	yygotominor.yy5 = eDbIdExprListAppend(0,yymsp[0].minor.yy82,&yymsp[-2].minor.yy68);	break;
	case 48:
	{
	Select *pS = eDbSelectNew(yymsp[-6].minor.yy64,yymsp[-4].minor.yy95,yymsp[-3].minor.yy82,yymsp[-2].minor.yy64,yymsp[-1].minor.yy82,yymsp[0].minor.yy64,yymsp[-7].minor.yy122);
	eDbSelect(pParse,pS); 
	}	break;
	case 49:
	yygotominor.yy122 = 1;	break;
	case 50:
	yygotominor.yy122 = 0;	break;
	case 51:
	yygotominor.yy122 = 0;	break;
	case 52:
	yygotominor.yy64 = yymsp[-1].minor.yy64;	break;
	case 53:
	yygotominor.yy64 = 0;	break;
	case 54:
	yygotominor.yy64 = eDbExprListAppend(yymsp[-2].minor.yy64,yymsp[-1].minor.yy82,yymsp[0].minor.yy68.n?&yymsp[0].minor.yy68:0);	break;
	case 55:
	yygotominor.yy64 = eDbExprListAppend(yymsp[-1].minor.yy64,eDbExpr(TK_ALL,0,0,0),0);	break;
	case 56:
	{
	Expr *pRight = eDbExpr(TK_ALL,0,0,0);
	Expr *pLeft = eDbExpr(TK_ID,0,0,&yymsp[-2].minor.yy68);
	yygotominor.yy64 = eDbExprListAppend(yymsp[-3].minor.yy64,eDbExpr(TK_DOT,pLeft,pRight,0),0);
	}	break;
	case 57:
	yygotominor.yy68 = yymsp[0].minor.yy68;	break;
	case 58:
	yygotominor.yy68 = yymsp[0].minor.yy68;	break;
	case 59:
	yygotominor.yy68.n = 0;	break;
	case 60:
	{
	yygotominor.yy95 = eDbSrcListAppend(yymsp[-3].minor.yy95,&yymsp[-1].minor.yy68,0);
	if( yymsp[0].minor.yy68.n ) eDbSrcListAddAlias(yygotominor.yy95,&yymsp[0].minor.yy68);
	}	break;
	case 61:
	{
	yygotominor.yy95 = eDbSrcListAppend(0,&yymsp[-1].minor.yy68,0);
	if( yymsp[0].minor.yy68.n ) eDbSrcListAddAlias(yygotominor.yy95,&yymsp[0].minor.yy68);
	}	break;
	case 62:
	yygotominor.yy64 = 0;	break;
	case 63:
	yygotominor.yy64 = yymsp[0].minor.yy64;	break;
	case 64:
	yygotominor.yy82 = 0;	break;
	case 65:
	yygotominor.yy82 = yymsp[0].minor.yy82;	break;
	case 66:
	yygotominor.yy64 = 0;	break;
	case 67:
	yygotominor.yy64 = yymsp[0].minor.yy64;	break;
	case 68:
	{
	yygotominor.yy64 = eDbExprListAppend(yymsp[-3].minor.yy64,yymsp[-1].minor.yy82,0);
	if(yygotominor.yy64) yygotominor.yy64->a[0].sortOrder = yymsp[0].minor.yy122;
	}	break;
	case 69:
	{
	yygotominor.yy64 = eDbExprListAppend(0,yymsp[-1].minor.yy82,0);
	if(yygotominor.yy64) yygotominor.yy64->a[0].sortOrder = yymsp[0].minor.yy122;
	}	break;
	case 70:
	yygotominor.yy122 = eDb_SO_ASC;	break;
	case 71:
	yygotominor.yy122 = eDb_SO_DESC;	break;
	case 72:
	yygotominor.yy122 = eDb_SO_ASC;	break;
	case 73:
	yygotominor.yy82 = yymsp[-1].minor.yy82;eDbExprSpan(yygotominor.yy82,&yymsp[-2].minor.yy0,&yymsp[0].minor.yy0);	break;
	case 74:
	{
	Expr *temp1 = eDbExpr(TK_ID,0,0,&yymsp[-2].minor.yy68);
	Expr *temp2 = eDbExpr(TK_ID,0,0,&yymsp[0].minor.yy68);
	yygotominor.yy82 = eDbExpr(TK_DOT,temp1,temp2,0);
	}
		break;
	case 75:
	yygotominor.yy82 = eDbExpr(TK_NULL,0,0,&yymsp[0].minor.yy0);	break;
	case 76:
	yygotominor.yy82 = eDbExpr(TK_ID,0,0,&yymsp[0].minor.yy0);	break;
	case 77:
	yygotominor.yy82 = eDbExpr(TK_INTEGER,0,0,&yymsp[0].minor.yy0);	break;
	case 78:
	yygotominor.yy82 = eDbExpr(TK_STRING,0,0,&yymsp[0].minor.yy0);	break;
	case 79:
	yygotominor.yy82 = eDbExpr(TK_AND,yymsp[-2].minor.yy82,yymsp[0].minor.yy82,0);	break;
	case 80:
	yygotominor.yy82 = eDbExpr(TK_OR,yymsp[-2].minor.yy82,yymsp[0].minor.yy82,0);	break;
	case 81:
	yygotominor.yy82 = eDbExpr(TK_LT,yymsp[-2].minor.yy82,yymsp[0].minor.yy82,0);	break;
	case 82:
	yygotominor.yy82 = eDbExpr(TK_GT,yymsp[-2].minor.yy82,yymsp[0].minor.yy82,0);	break;
	case 83:
	yygotominor.yy82 = eDbExpr(TK_LE,yymsp[-2].minor.yy82,yymsp[0].minor.yy82,0);	break;
	case 84:
	yygotominor.yy82 = eDbExpr(TK_GE,yymsp[-2].minor.yy82,yymsp[0].minor.yy82,0);	break;
	case 85:
	yygotominor.yy82 = eDbExpr(TK_NE,yymsp[-2].minor.yy82,yymsp[0].minor.yy82,0);	break;
	case 86:
	yygotominor.yy82 = eDbExpr(TK_EQ,yymsp[-2].minor.yy82,yymsp[0].minor.yy82,0);	break;
	case 87:
	yygotominor.yy82 = eDbExpr(TK_LSHIFT,yymsp[-2].minor.yy82,yymsp[0].minor.yy82,0);	break;
	case 88:
	yygotominor.yy82 = eDbExpr(TK_RSHIFT,yymsp[-2].minor.yy82,yymsp[0].minor.yy82,0);	break;
	case 89:
	yygotominor.yy64 = eDbExprListAppend(yymsp[-2].minor.yy64,yymsp[0].minor.yy82,0);	break;
  };
  yygoto = yyRuleInfo[yyruleno].lhs;
  yysize = yyRuleInfo[yyruleno].nrhs;
  yypParser->yyidx -= yysize;
  yyact = yy_find_reduce_action(yypParser,yygoto);
  if( yyact < YYNSTATE ){
    yy_shift(yypParser,yyact,yygoto,&yygotominor);
  }else if( yyact == YYNSTATE + YYNRULE + 1 ){
    yy_accept(yypParser);
  }
}

/*
** The following code executes when the parse fails
*/
static void yy_parse_failed(yyParser *yypParser){
  eDbParserARG_FETCH;
#ifndef NDEBUG
  if( yyTraceFILE ){
    fprintf(yyTraceFILE,"%sFail!\n",yyTracePrompt);
  }
#endif
  while( yypParser->yyidx>=0 ) yy_pop_parser_stack(yypParser);
  /* Here code is inserted which will be executed whenever the
  ** parser fails */
  eDbParserARG_STORE; /* Suppress warning about unused %extra_argument variable */
}

/*
** The following code executes when a syntax error first occurs.
*/
static void yy_syntax_error(yyParser *yypParser,int yymajor,yyMinor yyminor){
  eDbParserARG_FETCH;
#define TOKEN (yyminor.yy0)

  if( pParse->zErrMsg==0 ){	
    if(TOKEN.z[0] ){	  char *z=0;
	  eDbSetNString(&z,TOKEN.z,TOKEN.n,0);
      eDbErrorMsg(pParse, "near %s: syntax error", z);	  eDbFree(z);
    }else{
      eDbErrorMsg(pParse, "incomplete SQL statement");
    }
  }
  eDbParserARG_STORE; /* Suppress warning about unused %extra_argument variable */
}

/*
** The following is executed when the parser accepts
*/
static void yy_accept(yyParser *yypParser){
  eDbParserARG_FETCH;
#ifndef NDEBUG
  if( yyTraceFILE ){
    fprintf(yyTraceFILE,"%sAccept!\n",yyTracePrompt);
  }
#endif
  while( yypParser->yyidx>=0 ) yy_pop_parser_stack(yypParser);
  /* Here code is inserted which will be executed whenever the
  ** parser accepts */
  eDbParserARG_STORE; /* Suppress warning about unused %extra_argument variable */
}

/* The main parser program.
** The first argument is a pointer to a structure obtained from
** "eDbParserAlloc" which describes the current state of the parser.
** The second argument is the major token number.  The third is
** the minor token.  The fourth optional argument is whatever the
** user wants (and specified in the grammar) and is available for
** use by the action routines.
*/
void eDbParser(void *yyp,yyCode yymajor,eDbParserToken yyminor,eDbParserARG_PDECL){
  yyMinor yyminorunion;
  int yyact;            /* The parser action. */
  int yyendofinput;     /* True if we are at the end of input */
  int yyerrorhit = 0;   /* True if yymajor has invoked an error */
  yyParser *yypParser;  /* The parser */

  /* (re)initialize the parser, if necessary */
  yypParser = (yyParser*)yyp;
  if( yypParser->yyidx<0 ){
    if( yymajor==0 ) return;
    yypParser->yyidx = 0;
    yypParser->yyerrcnt = -1;
    yypParser->yystack[0].stateno = 0;
    yypParser->yystack[0].major = 0;
  }
  yyminorunion.yy0 = yyminor;
  yyendofinput = (yymajor==0);
  eDbParserARG_STORE;

#ifndef NDEBUG
  if( yyTraceFILE ){
    fprintf(yyTraceFILE,"%sInput %s\n",yyTracePrompt,yyTokenName[yymajor]);
  }
#endif

  do{
    yyact = yy_find_shift_action(yypParser,yymajor);
    if( yyact<YYNSTATE ){
      yy_shift(yypParser,yyact,yymajor,&yyminorunion);
      yypParser->yyerrcnt--;
      if( yyendofinput && yypParser->yyidx>=0 ){
        yymajor = 0;
      }else{
        yymajor = YYNOCODE;
      }
    }else if( yyact < YYNSTATE + YYNRULE ){
      yy_reduce(yypParser,yyact-YYNSTATE);
    }else if( yyact == YY_ERROR_ACTION ){
      int yymx;
#ifndef NDEBUG
      if( yyTraceFILE ){
        fprintf(yyTraceFILE,"%sSyntax Error!\n",yyTracePrompt);
      }
#endif
#ifdef YYERRORSYMBOL
      /* A syntax error has occurred.
      ** The response to an error depends upon whether or not the
      ** grammar defines an error token "ERROR".  
      **
      ** This is what we do if the grammar does define ERROR:
      **
      **  * Call the %syntax_error function.
      **
      **  * Begin popping the stack until we enter a state where
      **    it is legal to shift the error symbol, then shift
      **    the error symbol.
      **
      **  * Set the error count to three.
      **
      **  * Begin accepting and shifting new tokens.  No new error
      **    processing will occur until three tokens have been
      **    shifted successfully.
      **
      */
      if( yypParser->yyerrcnt<0 ){
        yy_syntax_error(yypParser,yymajor,yyminorunion);
      }
      yymx = yypParser->yystack[yypParser->yyidx].major;
      if( yymx==YYERRORSYMBOL || yyerrorhit ){
#ifndef NDEBUG
        if( yyTraceFILE ){
          fprintf(yyTraceFILE,"%sDiscard input token %s\n",
             yyTracePrompt,yyTokenName[yymajor]);
        }
#endif
        yy_destructor(yymajor,&yyminorunion);
        yymajor = YYNOCODE;
      }else{
         while(
          yypParser->yyidx >= 0 &&
          yymx != YYERRORSYMBOL &&
          (yyact = yy_find_shift_action(yypParser,YYERRORSYMBOL)) >= YYNSTATE
        ){
          yy_pop_parser_stack(yypParser);
        }
        if( yypParser->yyidx < 0 || yymajor==0 ){
          yy_destructor(yymajor,&yyminorunion);
          yy_parse_failed(yypParser);
          yymajor = YYNOCODE;
        }else if( yymx!=YYERRORSYMBOL ){
          yyMinor u2;
          u2.YYERRSYMDT = 0;
          yy_shift(yypParser,yyact,YYERRORSYMBOL,&u2);
        }
      }
      yypParser->yyerrcnt = 3;
      yyerrorhit = 1;
#else  /* YYERRORSYMBOL is not defined */
      /* This is what we do if the grammar does not define ERROR:
      **
      **  * Report an error message, and throw away the input token.
      **
      **  * If the input token is $, then fail the parse.
      **
      ** As before, subsequent error messages are suppressed until
      ** three input tokens have been successfully shifted.
      */
      if( yypParser->yyerrcnt<=0 ){
        yy_syntax_error(yypParser,yymajor,yyminorunion);
      }
      yypParser->yyerrcnt = 3;
      yy_destructor(yymajor,&yyminorunion);
      if( yyendofinput ){
        yy_parse_failed(yypParser);
      }
      yymajor = YYNOCODE;
#endif
    }else{
      yy_accept(yypParser);
      yymajor = YYNOCODE;
    }
  }while( yymajor!=YYNOCODE && yypParser->yyidx>=0 );
  return;
}

⌨️ 快捷键说明

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