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.

265 lines
5.3 KiB

  1. // Copyright (c) 1993-1999 Microsoft Corporation
  2. /* SCCSWHAT( "@(#)yypars.c 2.4 88/05/09 15:22:59 " ) */
  3. ___a_r_u_start
  4. static char *SCCSID = "@(#)yypars.c:1.3";
  5. # define YYFLAG -1000
  6. # define YYERROR goto yyerrlab
  7. # define YYACCEPT return(0)
  8. # define YYABORT return(1)
  9. #ifdef YYDEBUG /* RRR - 10/9/85 */
  10. #define yyprintf(a, b, c, d, e) printf(a, b, c, d, e)
  11. #else
  12. #define yyprintf(a, b, c, d)
  13. #endif
  14. #ifndef YYPRINT
  15. #define YYPRINT printf
  16. #endif
  17. #if ! defined YYSTATIC
  18. #define YYSTATIC
  19. #endif
  20. /* parser for yacc output */
  21. #ifdef YYDEBUG
  22. YYSTATIC int yydebug = 0; /* 1 for debugging */
  23. #endif
  24. YYSTATIC YYSTYPE yyv[YYMAXDEPTH]; /* where the values are stored */
  25. YYSTATIC short yys[YYMAXDEPTH]; /* the parse stack */
  26. YYSTATIC int yychar = -1; /* current input token number */
  27. YYSTATIC int yynerrs = 0; /* number of errors */
  28. YYSTATIC short yyerrflag = 0; /* error recovery flag */
  29. #ifdef YYRECOVER
  30. /*
  31. ** yyscpy : copy f onto t and return a ptr to the null terminator at the
  32. ** end of t.
  33. */
  34. YYSTATIC char *yyscpy(t,f)
  35. register char *t, *f;
  36. {
  37. while(*t = *f++)
  38. t++;
  39. return(t); /* ptr to the null char */
  40. }
  41. #endif
  42. #ifndef YYNEAR
  43. #define YYNEAR
  44. #endif
  45. #ifndef YYPASCAL
  46. #define YYPASCAL
  47. #endif
  48. #ifndef YYLOCAL
  49. #define YYLOCAL
  50. #endif
  51. #if ! defined YYPARSER
  52. #define YYPARSER yyparse
  53. #endif
  54. #if ! defined YYLEX
  55. #define YYLEX yylex
  56. #endif
  57. static void yy_vc_init();
  58. typedef void (*pfn)();
  59. static pfn *pcase_fn_array;
  60. static int returnflag = 0;
  61. static YYSTYPE *yypvt;
  62. static int yym_vc_max = 0;
  63. extern short GrammarAct;
  64. extern short yysavestate;
  65. YYLOCAL YYNEAR YYPASCAL YYPARSER()
  66. {
  67. register short yyn;
  68. short yystate, *yyps, *yysave_yyps;
  69. YYSTYPE *yypv,*yysave_yypv;
  70. YYSTYPE yysave_yyval;
  71. short yyj, yym;
  72. short fHaveRecoveredChar = 0;
  73. yy_vc_init();
  74. #ifdef YYDEBUG
  75. yydebug = 1;
  76. #endif /* YYDEBUG */
  77. yystate = 0;
  78. yychar = -1;
  79. yynerrs = 0;
  80. yyerrflag = 0;
  81. yyps= &yys[-1];
  82. yypv= &yyv[-1];
  83. yystack: /* put a state and value onto the stack */
  84. #ifdef YYDEBUG
  85. yyprintf( "[yydebug] state %d, char %d = %c\n", yystate, yychar,yychar, 0 );
  86. #else /* YYDEBUG */
  87. yyprintf( "[yydebug] state %d, char %d\n", yystate, yychar, 0 );
  88. #endif /* YYDEBUG */
  89. if( ++yyps > &yys[YYMAXDEPTH] ) {
  90. /* yyerror( "yacc stack overflow" ); */
  91. ParseError(C_STACK_OVERFLOW, (char *)NULL);
  92. return(1);
  93. }
  94. *yyps = yystate;
  95. ++yypv;
  96. #ifdef UNION
  97. yyunion(yypv, &yyval);
  98. #else
  99. *yypv = yyval;
  100. #endif
  101. yynewstate:
  102. yysavestate = yystate;
  103. yysave_yypv = yypv;
  104. yysave_yyval= yyval;
  105. yysave_yyps = yyps;
  106. yyn = yypact[yystate];
  107. if( yyn <= YYFLAG ) { /* simple state, no lookahead */
  108. goto yydefault;
  109. }
  110. if( ! fHaveRecoveredChar )
  111. {
  112. if( yychar < 0 ) /* need a lookahead */
  113. {
  114. yychar = YYLEX();
  115. }
  116. }
  117. fHaveRecoveredChar = 0;
  118. if( ((yyn += yychar) < 0) || (yyn >= YYLAST) ) {
  119. goto yydefault;
  120. }
  121. if( yychk[ yyn = yyact[ yyn ] ] == yychar ) { /* valid shift */
  122. yychar = -1;
  123. #ifdef UNION
  124. yyunion(&yyval, &yylval);
  125. #else
  126. yyval = yylval;
  127. #endif
  128. yystate = yyn;
  129. if( yyerrflag > 0 ) {
  130. --yyerrflag;
  131. }
  132. goto yystack;
  133. }
  134. yydefault:
  135. /* default state action */
  136. if( (yyn = yydef[yystate]) == -2 ) {
  137. register short *yyxi;
  138. if( yychar < 0 ) {
  139. yychar = YYLEX();
  140. }
  141. /*
  142. ** search exception table, we find a -1 followed by the current state.
  143. ** if we find one, we'll look through terminal,state pairs. if we find
  144. ** a terminal which matches the current one, we have a match.
  145. ** the exception table is when we have a reduce on a terminal.
  146. */
  147. #if YYOPTTIME
  148. yyxi = yyexca + yyexcaind[yystate];
  149. while(( *yyxi != yychar ) && ( *yyxi >= 0 )){
  150. yyxi += 2;
  151. }
  152. #else
  153. for(yyxi = yyexca;
  154. (*yyxi != (-1)) || (yyxi[1] != yystate);
  155. yyxi += 2
  156. ) {
  157. ; /* VOID */
  158. }
  159. while( *(yyxi += 2) >= 0 ){
  160. if( *yyxi == yychar ) {
  161. break;
  162. }
  163. }
  164. #endif
  165. if( (yyn = yyxi[1]) < 0 ) {
  166. return(0); /* accept */
  167. }
  168. }
  169. if( yyn == 0 ) /* error */
  170. {
  171. int yytempchar;
  172. if( ( yytempchar = GetExpectedChar( yysavestate ) ) != -1 )
  173. {
  174. char Buf[ 9 ];
  175. SyntaxError( BENIGN_SYNTAX_ERROR, yysavestate );
  176. fHaveRecoveredChar = 1;
  177. yyunlex( yychar );
  178. yychar = yytempchar;
  179. sprintf( Buf, " %c ", yytempchar );
  180. ParseError( ASSUMING_CHAR, Buf );
  181. yystate = yysavestate;
  182. yypv = yysave_yypv;
  183. yyval = yysave_yyval;
  184. yyps = yysave_yyps;
  185. goto yynewstate;
  186. }
  187. else
  188. {
  189. SyntaxError( SYNTAX_ERROR, yysavestate );
  190. return 1;
  191. }
  192. }
  193. /* reduction by production yyn */
  194. /* yyreduce: */
  195. {
  196. #ifdef YYDEBUG
  197. yyprintf("[yydebug] reduce %d\n",yyn, 0, 0, 0);
  198. #else /* YYDEBUG */
  199. yyprintf("[yydebug] reduce %d\n",yyn, 0, 0);
  200. #endif /* YYDEBUG */
  201. yypvt = yypv;
  202. yyps -= yyr2[yyn];
  203. yypv -= yyr2[yyn];
  204. #ifdef UNION
  205. yyunion(&yyval, &yypv[1]);
  206. #else
  207. yyval = yypv[1];
  208. #endif
  209. yym = yyn;
  210. yyn = yyr1[yyn]; /* consult goto table to find next state */
  211. yyj = yypgo[yyn] + *yyps + 1;
  212. if( (yyj >= YYLAST) || (yychk[ yystate = yyact[yyj] ] != -yyn) ) {
  213. yystate = yyact[yypgo[yyn]];
  214. }
  215. returnflag = 0;
  216. GrammarAct = yym;
  217. (*(pcase_fn_array[ (yym <= yym_vc_max) ? yym : 0 ]))();
  218. if(returnflag != 0)
  219. return returnflag;
  220. }
  221. goto yystack; /* stack new state and value */
  222. }
  223. ___a_r_u_myact
  224. $A
  225. ___a_r_u_end