home *** CD-ROM | disk | FTP | other *** search
/ OpenStep 4.2 / Openstep-4.2-Intel-User.iso / usr / lib / lex / nrform < prev   
Text File  |  1990-01-22  |  3KB  |  156 lines

  1. block data
  2. integer cshift, csize, yynlin
  3. common /yyllib/ cshift, csize, yynlin
  4. data yynlin/YYNEWLINE/
  5. end
  6. block data
  7. common /yyldat/ yyfnd, ymorf, yyprev, yybgin, yytop
  8. integer yyfnd, yymorf, yyprev, yybgin, yytop
  9. data yybgin/1/
  10. data yyprev/YYNEWLINE/
  11. data yytop/YYTOPVAL/
  12. end
  13. integer function yylook(dummy)
  14. common /Lverif/ verif
  15. common /Ladvan/ advan
  16. common /Lstoff/ stoff
  17. common /Lsfall/ sfall
  18. common /Latable/ atable
  19. common /Lextra/ extra
  20. common /Lvstop/ vstop
  21. integer verif(Sverif), advan(Sadvan),stoff(Sstoff),match(Smatch)
  22. integer sfall(Ssfall),atable(Satable),extra(Sextra), vstop(Svstop)
  23. integer state, lsp, r
  24. integer  ch, n
  25. common /yyldat/ yyfnd, yymorf, yyprev, yybgin, yytop, yylsp, yylsta(YYLMAX)
  26. common /yyxel/ yyleng, yytext
  27. integer yyfnd, yymorf, yylsta, yylsp, yytext, yyprev, yyleng, yytop
  28. integer  lexshf, yytext(YYLMAX), yyback, yybgin
  29. integer z, t
  30. if (yymorf .eq. 0)
  31.     yyleng = 0
  32. else
  33.     yymorf=0
  34. 1776
  35.     lsp = 1
  36.     state = yybgin
  37.     if (yyprev .eq. YYNEWLINE)
  38.         state = state + 1
  39.     for (;;){
  40.         r = stoff(state)
  41.         if (r .eq. 0){
  42.             z = sfall(state)
  43.             if (z .eq. 0)
  44.                 break
  45.             if(stoff(z) == 0) break
  46.             }
  47.         ch = input(dummy)
  48.         ich = lexshf(ch)
  49.         yyleng = yyleng+1
  50.         yytext(yyleng) = ch
  51.         1984
  52.         if(r .gt. 0){
  53.             t = r + ich
  54.             if (t<= yytop){
  55.               if (verif(t) .eq. state){
  56.                 if(advan(t) == YYERROR){
  57.                     call unput(yytext(yyleng))
  58.                     yyleng = yyleng - 1
  59.                     break
  60.                     }
  61.                 state = advan(t)
  62.                 yylsta(lsp) = state
  63.                 lsp = lsp +1
  64.                 goto 2001
  65.                 }
  66.               }
  67.             }
  68.         if(r < 0){
  69.             t = r + ich
  70.             if (t <= yytop .and. verif(t) .eq. state){
  71.                 if(advan(t) == YYERROR){
  72.                     call unput(yytext(yyleng))
  73.                     yyleng = yyleng - 1
  74.                     break
  75.                     }
  76.                 state = advan(t)
  77.                 yylsta(lsp) = state
  78.                 lsp = lsp +1
  79.                 goto 2001
  80.                 }
  81.             t = r + match(ich)
  82.             if(t <= yytop && state == verif(t)){
  83.                 if(advan(t) == YYERROR){
  84.                     call unput(yytext(yyleng))
  85.                     yyleng = yyleng - 1
  86.                     break
  87.                     }
  88.             state = advan(t)
  89.             yylsta(lsp) = state
  90.             lsp = lsp + 1
  91.             goto 2001
  92.             }
  93.         }
  94.         else {
  95.             if (state > 0) state = sfall(state)
  96.             if (state .gt. 0) r = stoff(state)
  97.             if (state .gt. 0 .and. r .ne. 0)
  98.                 goto 1984
  99.             call unput(yytext(yyleng))
  100.             yyleng = yyleng -1
  101.             break
  102.             }
  103.     2001
  104.         continue
  105.         }
  106.     while (lsp .gt. 1){
  107.         lsp = lsp -1
  108.         ilsp = yylsta(lsp)
  109.         yyfnd = atable(ilsp)
  110.         if (yyfnd .gt. 0)
  111.             if (vstop(yyfnd) .gt. 0){
  112.                 r = vstop(yyfnd)
  113.                 if (extra(r) .ne. 0){
  114.                     for(;;){
  115.                     ilsp = yylsta(lsp)
  116.                     if (yyback(atable(ilsp), -r) .eq. 1)
  117.                         break
  118.                     lsp= lsp -1
  119.                     call unput(yytext(yyleng))
  120.                     yyleng = yyleng -1
  121.                     }
  122.                     }
  123.                 yyprev = lexshf(yytext(yyleng))
  124.                 yylsp = lsp
  125.                 yyfnd = yyfnd + 1
  126.                 yylook = r
  127.                 yytext(yyleng+1) = 0
  128.                 return
  129.                 }
  130.         call unput(yytext(yyleng))
  131.         }
  132.     if (yytext(1) .eq. 0){
  133.         yylook=0
  134.         return
  135.         }
  136.     yyprev = input(dummy)
  137.     call output(yyprev)
  138.     yyprev = lexshf(yyprev)
  139.     yyleng = 0
  140.     goto 1776
  141. end
  142. integer function yyback (isub, n)
  143. common /Lvstop/ vstop
  144. integer vstop(Svstop)
  145. if (isub .ne. 0)
  146. while (vstop(isub) .ne. 0){
  147.     if (vstop(isub) .eq. m){
  148.         yyback = 1
  149.         return
  150.         }
  151.     isub = isub + 1
  152.     }
  153. yyback = 0
  154. return 
  155. end
  156.