Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

987 lines
29 KiB

  1. #include "defs.h"
  2. /* The definition of yysccsid in the banner should be replaced with */
  3. /* a #pragma ident directive if the target C compiler supports */
  4. /* #pragma ident directives. */
  5. /* */
  6. /* If the skeleton is changed, the banner should be changed so that */
  7. /* the altered version can be easily distinguished from the original. */
  8. /* */
  9. /* The #defines included with the banner are there because they are */
  10. /* useful in subsequent code. The macros #defined in the header or */
  11. /* the body either are not useful outside of semantic actions or */
  12. /* are conditional. */
  13. char *banner[] =
  14. {
  15. "#ifndef lint",
  16. "static char yysccsid[] = \"@(#)yaccpar 1.9 (Berkeley) 02/21/93\";",
  17. "#endif",
  18. "#define YYBYACC 1",
  19. "#define YYMAJOR 1",
  20. "#define YYMINOR 9",
  21. "#define yyclearin (yychar=(-1))",
  22. "#define yyerrok (yyerrflag=0)",
  23. "#define YYRECOVERING (yyerrflag!=0)",
  24. 0
  25. };
  26. #if defined(TRIPLISH)
  27. char *includefiles[] =
  28. {
  29. "#include <pch.cxx>",
  30. "#pragma hdrstop",
  31. 0
  32. };
  33. #endif // TRIPLISH
  34. char *tables[] =
  35. {
  36. "extern short yylhs[];",
  37. "extern short yylen[];",
  38. "extern short yydefred[];",
  39. "extern short yydgoto[];",
  40. "extern short yysindex[];",
  41. "extern short yyrindex[];",
  42. "extern short yygindex[];",
  43. "extern short yytable[];",
  44. "extern short yycheck[];",
  45. "#if YYDEBUG",
  46. "extern char *yyname[];",
  47. "extern char *yyrule[];",
  48. "#endif",
  49. 0
  50. };
  51. #if defined(KYLEP_CHANGE)
  52. char *header1[] =
  53. {
  54. "#ifdef YYSTACKSIZE",
  55. "#undef YYMAXDEPTH",
  56. "#define YYMAXDEPTH YYSTACKSIZE",
  57. "#else",
  58. "#ifdef YYMAXDEPTH",
  59. "#define YYSTACKSIZE YYMAXDEPTH",
  60. "#else",
  61. "#define YYSTACKSIZE 500",
  62. "#define YYMAXDEPTH 500",
  63. "#endif",
  64. "#endif",
  65. "#define INITSTACKSIZE 30",
  66. 0
  67. };
  68. char *header2[] =
  69. {
  70. "{",
  71. " friend class YYLEXER;",
  72. "public:",
  73. "",
  74. 0
  75. };
  76. char *header3[] =
  77. {
  78. "",
  79. " ~YYPARSER() {}",
  80. "",
  81. " void ResetParser(); // Use to possibly restart parser",
  82. " int Parse();",
  83. "",
  84. "#ifdef YYAPI_VALUETYPE",
  85. " YYAPI_VALUETYPE GetParseTree() // Get result of parse",
  86. " {",
  87. " return yyval;",
  88. " }",
  89. "#endif",
  90. "",
  91. " void EmptyValueStack( YYAPI_VALUETYPE yylval );",
  92. " void PopVs();",
  93. "",
  94. "private:",
  95. "",
  96. " int yydebug;",
  97. " int yynerrs;",
  98. " int yyerrflag;",
  99. " int yychar;",
  100. " short *yyssp;",
  101. " YYSTYPE *yyvsp;",
  102. " YYSTYPE yyval;",
  103. " YYSTYPE yylval;",
  104. " XGrowable<short, INITSTACKSIZE> xyyss;",
  105. " CDynArrayInPlace<YYSTYPE> xyyvs;",
  106. "};",
  107. "#define yystacksize YYSTACKSIZE",
  108. 0
  109. };
  110. #if defined(TRIPLISH)
  111. char *header4[] =
  112. {
  113. "",
  114. " ~YYPARSER() {}",
  115. "",
  116. " int Parse();",
  117. "",
  118. "#ifdef YYAPI_VALUETYPE",
  119. " CDbRestriction* GetParseTree() // Get result of parse",
  120. " {",
  121. " CDbRestriction* pRst = ((YYAPI_VALUETYPE)yyval).pRest;",
  122. " _setRst.Remove( pRst );",
  123. " Win4Assert( 0 == _setRst.Count() );",
  124. " Win4Assert( 0 == _setStgVar.Count() );",
  125. " Win4Assert( 0 == _setValueParser.Count() );",
  126. " return pRst;",
  127. " };",
  128. "#endif",
  129. "",
  130. " void SetDebug() { yydebug = 1; }",
  131. " void EmptyValueStack(YYAPI_VALUETYPE yylval) {}",
  132. " void PopVs() { yyvsp--; }",
  133. "",
  134. "private:",
  135. "",
  136. " int yydebug;",
  137. " int yynerrs;",
  138. " int yyerrflag;",
  139. " int yychar;",
  140. " short *yyssp;",
  141. " YYSTYPE *yyvsp;",
  142. " YYSTYPE yyval;",
  143. " YYSTYPE yylval;",
  144. " XGrowable<short, INITSTACKSIZE> xyyss;",
  145. " CDynArrayInPlace<YYSTYPE> xyyvs;",
  146. "};",
  147. "#define yystacksize YYSTACKSIZE",
  148. 0
  149. };
  150. #endif // TRIPLISH
  151. #else // KYLEP_CHANGE
  152. char *header[] =
  153. {
  154. "#ifdef YYSTACKSIZE",
  155. "#undef YYMAXDEPTH",
  156. "#define YYMAXDEPTH YYSTACKSIZE",
  157. "#else",
  158. "#ifdef YYMAXDEPTH",
  159. "#define YYSTACKSIZE YYMAXDEPTH",
  160. "#else",
  161. "#define YYSTACKSIZE 500",
  162. "#define YYMAXDEPTH 500",
  163. "#endif",
  164. "#endif",
  165. "int yydebug;",
  166. "int yynerrs;",
  167. "int yyerrflag;",
  168. "int yychar;",
  169. "short *yyssp;",
  170. "YYSTYPE *yyvsp;",
  171. "YYSTYPE yyval;",
  172. "YYSTYPE yylval;",
  173. "short yyss[YYSTACKSIZE];",
  174. "YYSTYPE yyvs[YYSTACKSIZE];",
  175. "#define yystacksize YYSTACKSIZE",
  176. 0
  177. };
  178. #endif // KYLEP_CHANGE
  179. char *body[] =
  180. {
  181. #if defined(KYLEP_CHANGE)
  182. "#define YYABORT(sc) { EmptyValueStack( yylval ); return ResultFromScode(sc); }",
  183. "#define YYFATAL QPARSE_E_INVALID_QUERY",
  184. "#define YYSUCCESS S_OK",
  185. #else
  186. "#define YYABORT goto yyabort",
  187. #endif // KYLEP_CHANGE
  188. "#define YYREJECT goto yyabort",
  189. "#define YYACCEPT goto yyaccept",
  190. #if !defined(KYLEP_CHANGE) // YYERROR is not being used
  191. "#define YYERROR goto yyerrlab",
  192. #endif
  193. #if defined(KYLEP_CHANGE)
  194. "int mystrlen(char * str)",
  195. "{",
  196. " Win4Assert( 0 != str );",
  197. " int i = 0;",
  198. " while ( 0 != str[i] )",
  199. " i++;",
  200. " return i; ",
  201. "}",
  202. "void YYPARSER::ResetParser()",
  203. "{",
  204. " yynerrs = 0;",
  205. " yyerrflag = 0;",
  206. " yychar = (-1);",
  207. "",
  208. "yyssp = xyyss.Get();",
  209. "yyvsp = xyyvs.Get();",
  210. " *yyssp = 0;",
  211. "}",
  212. "",
  213. "void YYPARSER::PopVs()",
  214. "{",
  215. " if ( NULL != *yyvsp ) ",
  216. " DeleteDBQT(*yyvsp);",
  217. " yyvsp--;",
  218. "}",
  219. "",
  220. "void YYPARSER::EmptyValueStack( YYAPI_VALUETYPE yylval )",
  221. "{",
  222. " if ( yyvsp != NULL ) ",
  223. " {",
  224. " if ((*yyvsp != yylval) && (NULL != yylval))",
  225. " DeleteDBQT(yylval);",
  226. "",
  227. " unsigned cCount = (unsigned)ULONG_PTR(yyvsp - xyyvs.Get());",
  228. " for ( unsigned i=0; i < cCount; i++ )",
  229. " {",
  230. " if (NULL != xyyvs[i] )",
  231. " DeleteDBQT(xyyvs[i]);",
  232. " }",
  233. " }",
  234. "",
  235. " //@TODO RE-ACTIVATE",
  236. " // note: This was only done to empty any scope arrays",
  237. " // m_pIPSession->SetScopeProperties(m_pICommand);",
  238. "",
  239. " m_pIPTProperties->SetContainsColumn(NULL);",
  240. "}",
  241. "",
  242. #endif // KYLEP_CHANGE
  243. #if defined(KYLEP_CHANGE)
  244. "int YYPARSER::Parse()",
  245. #else
  246. "int",
  247. "yyparse()",
  248. #endif // KYLEP_CHANGE
  249. "{",
  250. " register int yym, yyn, yystate;",
  251. "#if YYDEBUG",
  252. " register char *yys;",
  253. #if !defined(KYLEP_CHANGE)
  254. " extern char *getenv();",
  255. #endif
  256. "",
  257. " if (yys = getenv(\"YYDEBUG\"))",
  258. " {",
  259. " yyn = *yys;",
  260. " if (yyn >= '0' && yyn <= '9')",
  261. " yydebug = yyn - '0';",
  262. " }",
  263. "#endif",
  264. "",
  265. " yynerrs = 0;",
  266. " yyerrflag = 0;",
  267. " yychar = (-1);",
  268. "",
  269. #if defined(KYLEP_CHANGE)
  270. "yyssp = xyyss.Get();",
  271. "yyvsp = xyyvs.Get();",
  272. #else
  273. " yyssp = yyss;",
  274. " yyvsp = yyvs;",
  275. #endif
  276. " *yyssp = yystate = 0;",
  277. "",
  278. "yyloop:",
  279. " if (yyn = yydefred[yystate]) goto yyreduce;",
  280. " if (yychar < 0)",
  281. " {",
  282. #if defined(KYLEP_CHANGE)
  283. " YYAPI_VALUENAME = NULL;",
  284. " try",
  285. " {",
  286. " if ( (yychar = YYLEX(&YYAPI_VALUENAME)) < 0 ) ",
  287. " yychar = 0;",
  288. " }",
  289. " catch (HRESULT hr)",
  290. " {",
  291. " switch(hr)",
  292. " {",
  293. " case E_OUTOFMEMORY:",
  294. " m_pIPTProperties->SetErrorHResult(DB_E_ERRORSINCOMMAND, MONSQL_OUT_OF_MEMORY);",
  295. " YYABORT(E_OUTOFMEMORY);",
  296. " break;",
  297. "",
  298. " default:",
  299. " YYABORT(QPARSE_E_INVALID_QUERY);",
  300. " break;",
  301. " }",
  302. " }",
  303. #else
  304. " if ((yychar = yylex()) < 0) yychar = 0;",
  305. #endif // KYLEP_CHANGE
  306. "#if YYDEBUG",
  307. " if (yydebug)",
  308. " {",
  309. " yys = 0;",
  310. " if (yychar <= YYMAXTOKEN) yys = yyname[yychar];",
  311. " if (!yys) yys = \"illegal-symbol\";",
  312. " printf(\"%sdebug: state %d, reading %d (%s)\\n\",",
  313. " YYPREFIX, yystate, yychar, yys);",
  314. " }",
  315. "#endif",
  316. " }",
  317. " if ((yyn = yysindex[yystate]) && (yyn += yychar) >= 0 &&",
  318. " yyn <= YYTABLESIZE && yycheck[yyn] == yychar)",
  319. " {",
  320. "#if YYDEBUG",
  321. " if (yydebug)",
  322. " printf(\"%sdebug: state %d, shifting to state %d\\n\",",
  323. " YYPREFIX, yystate, yytable[yyn]);",
  324. "#endif",
  325. #if defined(KYLEP_CHANGE)
  326. " if ( yyssp >= xyyss.Get() + xyyss.Count() - 1 )",
  327. " {",
  328. " int yysspLoc = (int) ( yyssp - xyyss.Get() );",
  329. " xyyss.SetSize((unsigned) (yyssp-xyyss.Get())+2);",
  330. " yyssp = xyyss.Get() + yysspLoc;",
  331. " }",
  332. " if ( yyvsp >= xyyvs.Get() + xyyvs.Size() - 1 )",
  333. " {",
  334. " int yyvspLoc = (int) ( yyvsp - xyyvs.Get() );",
  335. " xyyvs.SetSize((unsigned) (yyvsp-xyyvs.Get())+2); ",
  336. " yyvsp = xyyvs.Get() + yyvspLoc;",
  337. " }",
  338. #else
  339. " if (yyssp >= yyss + yystacksize - 1)",
  340. " {",
  341. " goto yyoverflow;",
  342. " }",
  343. #endif
  344. " *++yyssp = yystate = yytable[yyn];",
  345. " *++yyvsp = yylval;",
  346. " yychar = (-1);",
  347. " if (yyerrflag > 0) --yyerrflag;",
  348. " goto yyloop;",
  349. " }",
  350. " if ((yyn = yyrindex[yystate]) && (yyn += yychar) >= 0 &&",
  351. " yyn <= YYTABLESIZE && yycheck[yyn] == yychar)",
  352. " {",
  353. " yyn = yytable[yyn];",
  354. " goto yyreduce;",
  355. " }",
  356. #if defined(KYLEP_CHANGE)
  357. "#ifdef YYERROR_VERBOSE",
  358. "// error reporting; done before the goto error recovery",
  359. "{",
  360. "",
  361. " // must be first - cleans m_pIPTProperties",
  362. " m_pIPTProperties->SetErrorHResult(DB_E_ERRORSINCOMMAND, MONSQL_PARSE_ERROR);",
  363. "",
  364. " int size = 0, totSize = 0;",
  365. " int curr_yychar;",
  366. " XGrowable<WCHAR> xMsg;",
  367. " for ( curr_yychar =0; curr_yychar<=YYMAXTOKEN; curr_yychar++)",
  368. " {",
  369. " ",
  370. " if ( ( yycheck[yysindex[yystate] + curr_yychar] == curr_yychar ) ||",
  371. " ( yycheck[yyrindex[yystate] + curr_yychar] == curr_yychar ) )",
  372. " { ",
  373. " ",
  374. " char * token_name = yyname[curr_yychar];",
  375. " if ( 0 != token_name )",
  376. " {",
  377. " if ( '_' == token_name[0] )",
  378. " token_name++;",
  379. " size = mystrlen(token_name) + 1 ;",
  380. " xMsg.SetSize(totSize+size+2); // +2 for \", \"",
  381. " if (0 == MultiByteToWideChar(CP_ACP, 0, token_name, size,",
  382. " xMsg.Get()+totSize, size))",
  383. " {",
  384. " break;",
  385. " }",
  386. " totSize += size-1;",
  387. " wcscpy( xMsg.Get()+totSize, L\", \" );",
  388. " totSize+=2;",
  389. " }",
  390. " }",
  391. " }",
  392. " // get rid of last comma",
  393. " if ( totSize >= 2 ) ",
  394. " (xMsg.Get())[totSize-2] = 0;",
  395. "",
  396. " if ( wcslen((YY_CHAR*)m_yylex.YYText()) )",
  397. " m_pIPTProperties->SetErrorToken( (YY_CHAR*)m_yylex.YYText() );",
  398. " else",
  399. " m_pIPTProperties->SetErrorToken(L\"<end of input>\");",
  400. " ",
  401. " m_pIPTProperties->SetErrorToken(xMsg.Get());",
  402. "}",
  403. "#endif //YYERROR_VERBOSE",
  404. #endif // KYLEP_CHANGE
  405. " if (yyerrflag) goto yyinrecovery;",
  406. #if defined(KYLEP_CHANGE)
  407. " yyerror(\"syntax error\");",
  408. " ++yynerrs;",
  409. #else
  410. "#ifdef lint",
  411. " goto yynewerror;",
  412. "#endif",
  413. "yynewerror:",
  414. " yyerror(\"syntax error\");",
  415. "#ifdef lint",
  416. " goto yyerrlab;",
  417. "#endif",
  418. "yyerrlab:",
  419. " ++yynerrs;",
  420. #endif
  421. "yyinrecovery:",
  422. " if (yyerrflag < 3)",
  423. " {",
  424. " yyerrflag = 3;",
  425. " for (;;)",
  426. " {",
  427. " if ((yyn = yysindex[*yyssp]) && (yyn += YYERRCODE) >= 0 &&",
  428. " yyn <= YYTABLESIZE && yycheck[yyn] == YYERRCODE)",
  429. " {",
  430. "#if YYDEBUG",
  431. " if (yydebug)",
  432. " printf(\"%sdebug: state %d, error recovery shifting\\",
  433. " to state %d\\n\", YYPREFIX, *yyssp, yytable[yyn]);",
  434. "#endif",
  435. #if defined(KYLEP_CHANGE)
  436. " if ( yyssp >= xyyss.Get() + xyyss.Count() - 1 )",
  437. " {",
  438. " int yysspLoc = (int) ( yyssp - xyyss.Get() );",
  439. " xyyss.SetSize((unsigned) (yyssp-xyyss.Get())+2);",
  440. " yyssp = xyyss.Get() + yysspLoc;",
  441. " }",
  442. " if ( yyvsp >= xyyvs.Get() + xyyvs.Size() - 1 )",
  443. " {",
  444. " int yyvspLoc = (int) ( yyvsp - xyyvs.Get() );",
  445. " xyyvs.SetSize((unsigned) (yyvsp-xyyvs.Get())+2); ",
  446. " yyvsp = xyyvs.Get() + yyvspLoc;",
  447. " }",
  448. #else
  449. " if (yyssp >= yyss + yystacksize - 1)",
  450. " {",
  451. " goto yyoverflow;",
  452. " }",
  453. #endif
  454. " *++yyssp = yystate = yytable[yyn];",
  455. " *++yyvsp = yylval;",
  456. " goto yyloop;",
  457. " }",
  458. " else",
  459. " {",
  460. "#if YYDEBUG",
  461. " if (yydebug)",
  462. " printf(\"%sdebug: error recovery discarding state %d\\\n\",",
  463. " YYPREFIX, *yyssp);",
  464. "#endif",
  465. #if defined(KYLEP_CHANGE)
  466. " if (yyssp <= xyyss.Get()) goto yyabort;",
  467. #else
  468. " if (yyssp <= yyss) goto yyabort;",
  469. #endif
  470. " PopVs();",
  471. " --yyssp;",
  472. " }",
  473. " }",
  474. " }",
  475. " else",
  476. " {",
  477. " if (yychar == 0) goto yyabort;",
  478. "#if YYDEBUG",
  479. " if (yydebug)",
  480. " {",
  481. " yys = 0;",
  482. " if (yychar <= YYMAXTOKEN) yys = yyname[yychar];",
  483. " if (!yys) yys = \"illegal-symbol\";",
  484. " printf(\"%sdebug: state %d, error recovery discards token %d\
  485. (%s)\\n\",",
  486. " YYPREFIX, yystate, yychar, yys);",
  487. " }",
  488. "#endif",
  489. " yychar = (-1);",
  490. " goto yyloop;",
  491. " }",
  492. "yyreduce:",
  493. "#if YYDEBUG",
  494. " if (yydebug)",
  495. " printf(\"%sdebug: state %d, reducing by rule %d (%s)\\n\",",
  496. " YYPREFIX, yystate, yyn, yyrule[yyn]);",
  497. "#endif",
  498. " yym = yylen[yyn];",
  499. " yyval = yyvsp[1-yym];",
  500. " switch (yyn)",
  501. " {",
  502. 0
  503. };
  504. char *TriplishBody[] =
  505. {
  506. #if defined(KYLEP_CHANGE)
  507. "#define YYABORT(sc) { return ResultFromScode(sc); }",
  508. "#define YYFATAL E_FAIL",
  509. "#define YYSUCCESS S_OK",
  510. #else
  511. "#define YYABORT goto yyabort",
  512. #endif // KYLEP_CHANGE
  513. "#define YYREJECT goto yyabort",
  514. "#define YYACCEPT goto yyaccept",
  515. #if !defined(KYLEP_CHANGE) // YYERROR is not being used
  516. "#define YYERROR goto yyerrlab",
  517. #endif
  518. #if defined(KYLEP_CHANGE)
  519. "int YYPARSER::Parse()",
  520. #else
  521. "int",
  522. "yyparse()",
  523. #endif // KYLEP_CHANGE
  524. "{",
  525. " register int yym, yyn, yystate;",
  526. "#if YYDEBUG",
  527. " register char *yys;",
  528. #if !defined(KYLEP_CHANGE)
  529. " extern char *getenv();",
  530. #endif
  531. "",
  532. " if (yys = getenv(\"YYDEBUG\"))",
  533. " {",
  534. " yyn = *yys;",
  535. " if (yyn >= '0' && yyn <= '9')",
  536. " yydebug = yyn - '0';",
  537. " }",
  538. "#endif",
  539. "",
  540. " yynerrs = 0;",
  541. " yyerrflag = 0;",
  542. " yychar = (-1);",
  543. "",
  544. #if defined(KYLEP_CHANGE)
  545. "yyssp = xyyss.Get();",
  546. "yyvsp = xyyvs.Get();",
  547. #else
  548. " yyssp = yyss;",
  549. " yyvsp = yyvs;",
  550. #endif
  551. " *yyssp = yystate = 0;",
  552. "",
  553. "yyloop:",
  554. " if (yyn = yydefred[yystate]) goto yyreduce;",
  555. " if (yychar < 0)",
  556. " {",
  557. #if defined(KYLEP_CHANGE)
  558. " try",
  559. " {",
  560. " if ( (yychar = YYLEX(&YYAPI_VALUENAME)) < 0 ) ",
  561. " yychar = 0;",
  562. " }",
  563. " catch (HRESULT hr)",
  564. " {",
  565. " switch(hr)",
  566. " {",
  567. " case E_OUTOFMEMORY:",
  568. " YYABORT(E_OUTOFMEMORY);",
  569. " break;",
  570. "",
  571. " default:",
  572. " YYABORT(E_FAIL);",
  573. " break;",
  574. " }",
  575. " }",
  576. #else
  577. " if ((yychar = yylex()) < 0) yychar = 0;",
  578. #endif // KYLEP_CHANGE
  579. "#if YYDEBUG",
  580. " if (yydebug)",
  581. " {",
  582. " yys = 0;",
  583. " if (yychar <= YYMAXTOKEN) yys = yyname[yychar];",
  584. " if (!yys) yys = \"illegal-symbol\";",
  585. " printf(\"%sdebug: state %d, reading %d (%s)\\n\",",
  586. " YYPREFIX, yystate, yychar, yys);",
  587. " }",
  588. "#endif",
  589. " }",
  590. " if ((yyn = yysindex[yystate]) && (yyn += yychar) >= 0 &&",
  591. " yyn <= YYTABLESIZE && yycheck[yyn] == yychar)",
  592. " {",
  593. "#if YYDEBUG",
  594. " if (yydebug)",
  595. " printf(\"%sdebug: state %d, shifting to state %d\\n\",",
  596. " YYPREFIX, yystate, yytable[yyn]);",
  597. "#endif",
  598. #if defined(KYLEP_CHANGE)
  599. " if ( yyssp >= xyyss.Get() + xyyss.Count() - 1 )",
  600. " {",
  601. " int yysspLoc = (int) ( yyssp - xyyss.Get() );",
  602. " xyyss.SetSize((unsigned) (yyssp-xyyss.Get())+2);",
  603. " yyssp = xyyss.Get() + yysspLoc;",
  604. " }",
  605. " if ( yyvsp >= xyyvs.Get() + xyyvs.Size() - 1 )",
  606. " {",
  607. " int yyvspLoc = (int) ( yyvsp - xyyvs.Get() );",
  608. " xyyvs.SetSize((unsigned) (yyvsp-xyyvs.Get())+2);",
  609. " yyvsp = xyyvs.Get() + yyvspLoc;",
  610. " }",
  611. #else
  612. " if (yyssp >= yyss + yystacksize - 1)",
  613. " {",
  614. " goto yyoverflow;",
  615. " }",
  616. #endif
  617. " *++yyssp = yystate = yytable[yyn];",
  618. " *++yyvsp = yylval;",
  619. " yychar = (-1);",
  620. " if (yyerrflag > 0) --yyerrflag;",
  621. " goto yyloop;",
  622. " }",
  623. " if ((yyn = yyrindex[yystate]) && (yyn += yychar) >= 0 &&",
  624. " yyn <= YYTABLESIZE && yycheck[yyn] == yychar)",
  625. " {",
  626. " yyn = yytable[yyn];",
  627. " goto yyreduce;",
  628. " }",
  629. " if (yyerrflag) goto yyinrecovery;",
  630. #if defined(KYLEP_CHANGE)
  631. " yyerror(\"syntax error\");",
  632. " ++yynerrs;",
  633. #else
  634. "#ifdef lint",
  635. " goto yynewerror;",
  636. "#endif",
  637. "yynewerror:",
  638. " yyerror(\"syntax error\");",
  639. "#ifdef lint",
  640. " goto yyerrlab;",
  641. "#endif",
  642. "yyerrlab:",
  643. " ++yynerrs;",
  644. #endif
  645. "yyinrecovery:",
  646. " if (yyerrflag < 3)",
  647. " {",
  648. " yyerrflag = 3;",
  649. " for (;;)",
  650. " {",
  651. " if ((yyn = yysindex[*yyssp]) && (yyn += YYERRCODE) >= 0 &&",
  652. " yyn <= YYTABLESIZE && yycheck[yyn] == YYERRCODE)",
  653. " {",
  654. "#if YYDEBUG",
  655. " if (yydebug)",
  656. " printf(\"%sdebug: state %d, error recovery shifting\\",
  657. " to state %d\\n\", YYPREFIX, *yyssp, yytable[yyn]);",
  658. "#endif",
  659. #if defined(KYLEP_CHANGE)
  660. " if ( yyssp >= xyyss.Get() + xyyss.Count() - 1 )",
  661. " {",
  662. " int yysspLoc = (int) ( yyssp - xyyss.Get() );",
  663. " xyyss.SetSize((unsigned) (yyssp-xyyss.Get())+2);",
  664. " yyssp = xyyss.Get() + yysspLoc;",
  665. " }",
  666. " if ( yyvsp >= xyyvs.Get() + xyyvs.Size() - 1 )",
  667. " {",
  668. " int yyvspLoc = (int) ( yyvsp - xyyvs.Get() );",
  669. " xyyvs.SetSize((unsigned) (yyvsp-xyyvs.Get())+2);",
  670. " yyvsp = xyyvs.Get() + yyvspLoc;",
  671. " }",
  672. #else
  673. " if (yyssp >= yyss + yystacksize - 1)",
  674. " {",
  675. " goto yyoverflow;",
  676. " }",
  677. #endif
  678. " *++yyssp = yystate = yytable[yyn];",
  679. " *++yyvsp = yylval;",
  680. " goto yyloop;",
  681. " }",
  682. " else",
  683. " {",
  684. "#if YYDEBUG",
  685. " if (yydebug)",
  686. " printf(\"%sdebug: error recovery discarding state %d\\n\",",
  687. " YYPREFIX, *yyssp);",
  688. "#endif",
  689. #if defined(KYLEP_CHANGE)
  690. " if (yyssp <= xyyss.Get()) goto yyabort;",
  691. #else
  692. " if (yyssp <= yyss) goto yyabort;",
  693. #endif
  694. " --yyssp;",
  695. " PopVs();",
  696. " }",
  697. " }",
  698. " }",
  699. " else",
  700. " {",
  701. " if (yychar == 0) goto yyabort;",
  702. "#if YYDEBUG",
  703. " if (yydebug)",
  704. " {",
  705. " yys = 0;",
  706. " if (yychar <= YYMAXTOKEN) yys = yyname[yychar];",
  707. " if (!yys) yys = \"illegal-symbol\";",
  708. " printf(\"%sdebug: state %d, error recovery discards token %d\
  709. (%s)\\n\",",
  710. " YYPREFIX, yystate, yychar, yys);",
  711. " }",
  712. "#endif",
  713. " yychar = (-1);",
  714. " goto yyloop;",
  715. " }",
  716. "yyreduce:",
  717. "#if YYDEBUG",
  718. " if (yydebug)",
  719. " printf(\"%sdebug: state %d, reducing by rule %d (%s)\\n\",",
  720. " YYPREFIX, yystate, yyn, yyrule[yyn]);",
  721. "#endif",
  722. " yym = yylen[yyn];",
  723. " yyval = yyvsp[1-yym];",
  724. " switch (yyn)",
  725. " {",
  726. 0
  727. };
  728. char *trailer[] =
  729. {
  730. " }",
  731. " yyssp -= yym;",
  732. " yystate = *yyssp;",
  733. " yyvsp -= yym;",
  734. " yym = yylhs[yyn];",
  735. " if (yystate == 0 && yym == 0)",
  736. " {",
  737. "#if YYDEBUG",
  738. " if (yydebug)",
  739. " printf(\"%sdebug: after reduction, shifting from state 0 to\\",
  740. " state %d\\n\", YYPREFIX, YYFINAL);",
  741. "#endif",
  742. " yystate = YYFINAL;",
  743. " *++yyssp = YYFINAL;",
  744. " *++yyvsp = yyval;",
  745. " if (yychar < 0)",
  746. " {",
  747. #if defined(KYLEP_CHANGE)
  748. " YYAPI_VALUENAME = NULL;",
  749. " try",
  750. " {",
  751. " if ( (yychar = YYLEX(&YYAPI_VALUENAME)) < 0 ) ",
  752. " yychar = 0;",
  753. " }",
  754. " catch (HRESULT hr)",
  755. " {",
  756. " switch(hr)",
  757. " {",
  758. " case E_OUTOFMEMORY:",
  759. " m_pIPTProperties->SetErrorHResult(DB_E_ERRORSINCOMMAND, MONSQL_OUT_OF_MEMORY);",
  760. " YYABORT(E_OUTOFMEMORY);",
  761. " break;",
  762. "",
  763. " default:",
  764. " YYABORT(QPARSE_E_INVALID_QUERY);",
  765. " break;",
  766. " }",
  767. " }",
  768. #else
  769. " if ((yychar = yylex()) < 0) yychar = 0;",
  770. #endif // KYLEP_CHANGE
  771. "#if YYDEBUG",
  772. " if (yydebug)",
  773. " {",
  774. " yys = 0;",
  775. " if (yychar <= YYMAXTOKEN) yys = yyname[yychar];",
  776. " if (!yys) yys = \"illegal-symbol\";",
  777. " printf(\"%sdebug: state %d, reading %d (%s)\\n\",",
  778. " YYPREFIX, YYFINAL, yychar, yys);",
  779. " }",
  780. "#endif",
  781. " }",
  782. " if (yychar == 0) goto yyaccept;",
  783. " goto yyloop;",
  784. " }",
  785. " if ((yyn = yygindex[yym]) && (yyn += yystate) >= 0 &&",
  786. " yyn <= YYTABLESIZE && yycheck[yyn] == yystate)",
  787. " yystate = yytable[yyn];",
  788. " else",
  789. " yystate = yydgoto[yym];",
  790. "#if YYDEBUG",
  791. " if (yydebug)",
  792. " printf(\"%sdebug: after reduction, shifting from state %d \\",
  793. "to state %d\\n\", YYPREFIX, *yyssp, yystate);",
  794. "#endif",
  795. #if defined(KYLEP_CHANGE)
  796. " if ( yyssp >= xyyss.Get() + xyyss.Count() - 1 )",
  797. " {",
  798. " int yysspLoc = (int) ( yyssp - xyyss.Get() );",
  799. " xyyss.SetSize((unsigned) ( yyssp-xyyss.Get())+2);",
  800. " yyssp = xyyss.Get() + yysspLoc;",
  801. " }",
  802. " if ( yyvsp >= xyyvs.Get() + xyyvs.Size() - 1 )",
  803. " {",
  804. " int yyvspLoc = (int) ( yyvsp - xyyvs.Get() );",
  805. " xyyvs.SetSize((unsigned) ( yyvsp-xyyvs.Get())+2);",
  806. " yyvsp = xyyvs.Get() + yyvspLoc;",
  807. " }",
  808. " *++yyssp = (short) yystate;",
  809. #else
  810. " if (yyssp >= yyss + yystacksize - 1)",
  811. " {",
  812. " goto yyoverflow;",
  813. " }",
  814. " *++yyssp = yystate;",
  815. #endif
  816. " *++yyvsp = yyval;",
  817. " goto yyloop;",
  818. #if !defined(KYLEP_CHANGE)
  819. "yyoverflow:",
  820. " yyerror(\"yacc stack overflow\");",
  821. #endif
  822. "yyabort:",
  823. #if defined(KYLEP_CHANGE)
  824. " EmptyValueStack(yylval);",
  825. " return YYFATAL;",
  826. #else
  827. " return (1);",
  828. #endif // KYLEP_CHANGE
  829. "yyaccept:",
  830. #if defined(KYLEP_CHANGE)
  831. " return YYSUCCESS;",
  832. #else
  833. " return (0);",
  834. #endif // KYLEP_CHANGE
  835. "}",
  836. 0
  837. };
  838. char *TriplishTrailer[] =
  839. {
  840. " }",
  841. " yyssp -= yym;",
  842. " yystate = *yyssp;",
  843. " yyvsp -= yym;",
  844. " yym = yylhs[yyn];",
  845. " if (yystate == 0 && yym == 0)",
  846. " {",
  847. "#if YYDEBUG",
  848. " if (yydebug)",
  849. " printf(\"%sdebug: after reduction, shifting from state 0 to\\",
  850. " state %d\\n\", YYPREFIX, YYFINAL);",
  851. "#endif",
  852. " yystate = YYFINAL;",
  853. " *++yyssp = YYFINAL;",
  854. " *++yyvsp = yyval;",
  855. " if (yychar < 0)",
  856. " {",
  857. #if defined(KYLEP_CHANGE)
  858. " try",
  859. " {",
  860. " if ( (yychar = YYLEX(&YYAPI_VALUENAME)) < 0 ) ",
  861. " yychar = 0;",
  862. " }",
  863. " catch (HRESULT hr)",
  864. " {",
  865. " switch(hr)",
  866. " {",
  867. " case E_OUTOFMEMORY:",
  868. " YYABORT(E_OUTOFMEMORY);",
  869. " break;",
  870. "",
  871. " default:",
  872. " YYABORT(E_FAIL);",
  873. " break;",
  874. " }",
  875. " }",
  876. #else
  877. " if ((yychar = yylex()) < 0) yychar = 0;",
  878. #endif // KYLEP_CHANGE
  879. "#if YYDEBUG",
  880. " if (yydebug)",
  881. " {",
  882. " yys = 0;",
  883. " if (yychar <= YYMAXTOKEN) yys = yyname[yychar];",
  884. " if (!yys) yys = \"illegal-symbol\";",
  885. " printf(\"%sdebug: state %d, reading %d (%s)\\n\",",
  886. " YYPREFIX, YYFINAL, yychar, yys);",
  887. " }",
  888. "#endif",
  889. " }",
  890. " if (yychar == 0) goto yyaccept;",
  891. " goto yyloop;",
  892. " }",
  893. " if ((yyn = yygindex[yym]) && (yyn += yystate) >= 0 &&",
  894. " yyn <= YYTABLESIZE && yycheck[yyn] == yystate)",
  895. " yystate = yytable[yyn];",
  896. " else",
  897. " yystate = yydgoto[yym];",
  898. "#if YYDEBUG",
  899. " if (yydebug)",
  900. " printf(\"%sdebug: after reduction, shifting from state %d \\",
  901. "to state %d\\n\", YYPREFIX, *yyssp, yystate);",
  902. "#endif",
  903. #if defined(KYLEP_CHANGE)
  904. " if ( yyssp >= xyyss.Get() + xyyss.Count() - 1 )",
  905. " {",
  906. " int yysspLoc = (int) ( yyssp - xyyss.Get() );",
  907. " xyyss.SetSize((unsigned) ( yyssp-xyyss.Get())+2);",
  908. " yyssp = xyyss.Get() + yysspLoc;",
  909. " }",
  910. " if ( yyvsp >= xyyvs.Get() + xyyvs.Size() - 1 )",
  911. " {",
  912. " int yyvspLoc = (int) ( yyssp - xyyss.Get() );",
  913. " xyyvs.SetSize((unsigned) ( yyvsp-xyyvs.Get())+2);",
  914. " yyvsp = xyyvs.Get() + yyvspLoc;",
  915. " }",
  916. " *++yyssp = (short) yystate;",
  917. #else
  918. " if (yyssp >= yyss + yystacksize - 1)",
  919. " {",
  920. " goto yyoverflow;",
  921. " }",
  922. " *++yyssp = yystate;",
  923. #endif
  924. " *++yyvsp = yyval;",
  925. " goto yyloop;",
  926. #if !defined(KYLEP_CHANGE)
  927. "yyoverflow:",
  928. " yyerror(\"yacc stack overflow\");",
  929. #endif
  930. "yyabort:",
  931. #if defined(KYLEP_CHANGE)
  932. " EmptyValueStack(yylval);",
  933. " return YYFATAL;",
  934. #else
  935. " return (1);",
  936. #endif // KYLEP_CHANGE
  937. "yyaccept:",
  938. #if defined(KYLEP_CHANGE)
  939. " return YYSUCCESS;",
  940. #else
  941. " return (0);",
  942. #endif // KYLEP_CHANGE
  943. "}",
  944. 0
  945. };
  946. #if defined(KYLEP_CHANGE)
  947. void write_section(section,f)
  948. char *section[];
  949. FILE *f;
  950. #else
  951. write_section(section)
  952. char *section[];
  953. #endif // KYLEP_CHANGE
  954. {
  955. register int c;
  956. register int i;
  957. register char *s;
  958. #if !defined(KYLEP_CHANGE)
  959. register FILE *f;
  960. f = code_file;
  961. #endif // !KYLEP_CHANGE
  962. for (i = 0; s = section[i]; ++i)
  963. {
  964. ++outline;
  965. while (c = *s)
  966. {
  967. putc(c, f);
  968. ++s;
  969. }
  970. putc('\n', f);
  971. }
  972. }