home *** CD-ROM | disk | FTP | other *** search
/ PC World Komputer 1999 March B / SCO_CASTOR4RRT.iso / uccs / root.14 / udk / usr / ccs / lib / lex / nrform
Encoding:
Text File  |  1998-08-19  |  3.1 KB  |  157 lines

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