Guest User

Untitled

a guest
Jan 28th, 2015
258
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.56 KB | None | 0 0
  1. int yylook (){
  2. register struct yysvf *yystate, **lsp;
  3. register struct yywork *yyt;
  4. struct yysvf *yyz;
  5. int yych, yyfirst;
  6. struct yywork *yyr;
  7. # ifdef LEXDEBUG
  8. int debug;
  9. # endif
  10. /* char *yylastch;
  11. * ***** nls8 ***** */
  12. unsigned char *yylastch;
  13. /* start off machines */
  14. # ifdef LEXDEBUG
  15. debug = 0;
  16. # endif
  17. yyfirst=1;
  18. if (!yymorfg)
  19. yylastch = yytext;
  20. else {
  21. yymorfg=0;
  22. yylastch = yytext+yyleng;
  23. }
  24. for (;;){
  25. lsp = yylstate;
  26. yyestate = yystate = yybgin;
  27. if (yyprevious==YYNEWLINE) yystate++;
  28. for (;;){
  29. # ifdef LEXDEBUG
  30. if (debug)fprintf (yyout,"state %d\n",yystate-yysvec-1);
  31. # endif
  32. yyt = &yycrank[yystate->yystoff];
  33. if (yyt == yycrank && !yyfirst){ /* may not be any transitions */
  34. yyz = yystate->yyother;
  35. if (yyz == 0)break;
  36. if (yyz->yystoff == 0)break;
  37. }
  38. *yylastch++ = yych = input ();
  39. yyfirst=0;
  40. tryagain:
  41. # ifdef LEXDEBUG
  42. if (debug){
  43. fprintf (yyout,"char ");
  44. allprint (yych);
  45. putchar ('\n');
  46. }
  47. # endif
  48. yyr = yyt;
  49. if ((int)yyt > (int)yycrank){
  50. yyt = yyr + yych;
  51. if (yyt <= yytop && yyt->verify+yysvec == yystate){
  52. if (yyt->advance+yysvec == YYLERR) /* error transitions */
  53. {unput (*--yylastch);break;}
  54. *lsp++ = yystate = yyt->advance+yysvec;
  55. goto contin;
  56. }
  57. }
  58. # ifdef YYOPTIM
  59. else if ((int)yyt < (int)yycrank) { /* r < yycrank */
  60. yyt = yyr = yycrank+ (yycrank-yyt);
  61. # ifdef LEXDEBUG
  62. if (debug)fprintf (yyout,"compressed state\n");
  63. # endif
  64. yyt = yyt + yych;
  65. if (yyt <= yytop && yyt->verify+yysvec == yystate){
  66. if (yyt->advance+yysvec == YYLERR) /* error transitions */
  67. {unput (*--yylastch);break;}
  68. *lsp++ = yystate = yyt->advance+yysvec;
  69. goto contin;
  70. }
  71. yyt = yyr + YYU (yymatch[yych]);
  72. # ifdef LEXDEBUG
  73. if (debug){
  74. fprintf (yyout,"try fall back character ");
  75. allprint (YYU (yymatch[yych]));
  76. putchar ('\n');
  77. }
  78. # endif
  79. if (yyt <= yytop && yyt->verify+yysvec == yystate){
  80. if (yyt->advance+yysvec == YYLERR) /* error transition */
  81. {unput (*--yylastch);break;}
  82. *lsp++ = yystate = yyt->advance+yysvec;
  83. goto contin;
  84. }
  85. }
  86. if ((yystate = yystate->yyother) && (yyt = &yycrank[yystate->yystoff]) != yycrank){
  87. # ifdef LEXDEBUG
  88. if (debug)fprintf (yyout,"fall back to state %d\n",yystate-yysvec-1);
  89. # endif
  90. goto tryagain;
  91. }
  92. # endif
  93. else
  94. {unput (*--yylastch);break;}
  95. contin:
  96. # ifdef LEXDEBUG
  97. if (debug){
  98. fprintf (yyout,"state %d char ",yystate-yysvec-1);
  99. allprint (yych);
  100. putchar ('\n');
  101. }
  102. # endif
  103. ;
  104. }
  105. # ifdef LEXDEBUG
  106. if (debug){
  107. fprintf (yyout,"stopped at %d with ",* (lsp-1)-yysvec-1);
  108. allprint (yych);
  109. putchar ('\n');
  110. }
  111. # endif
  112. while (lsp-- > yylstate){
  113. *yylastch-- = 0;
  114. if (*lsp != 0 && (yyfnd= (*lsp)->yystops) && *yyfnd > 0){
  115. yyolsp = lsp;
  116. if (yyextra[*yyfnd]){ /* must backup */
  117. while (yyback ((*lsp)->yystops,-*yyfnd) != 1 && lsp > yylstate){
  118. lsp--;
  119. unput (*yylastch--);
  120. }
  121. }
  122. yyprevious = YYU (*yylastch);
  123. yylsp = lsp;
  124. yyleng = yylastch-yytext+1;
  125. yytext[yyleng] = 0;
  126. # ifdef LEXDEBUG
  127. if (debug){
  128. fprintf (yyout,"\nmatch ");
  129. sprint (yytext);
  130. fprintf (yyout," action %d\n",*yyfnd);
  131. }
  132. # endif
  133. return (*yyfnd++);
  134. }
  135. unput (*yylastch);
  136. }
  137. if (yytext[0] == 0 /* && feof (yyin) */)
  138. {
  139. yysptr=yysbuf;
  140. return (0);
  141. }
  142. yyprevious = yytext[0] = input ();
  143. if (yyprevious>0)
  144. output (yyprevious);
  145. yylastch=yytext;
  146. # ifdef LEXDEBUG
  147. if (debug)putchar ('\n');
  148. # endif
  149. }
  150. }
Advertisement
Add Comment
Please, Sign In to add comment