recognize and handle carrier loss
[unix-history] / usr / src / old / lex / nrform
CommitLineData
f16e05e1
SL
1block data
2integer cshift, csize, yynlin
3common /yyllib/ cshift, csize, yynlin
4data yynlin/YYNEWLINE/
5end
6block data
7common /yyldat/ yyfnd, ymorf, yyprev, yybgin, yytop
8integer yyfnd, yymorf, yyprev, yybgin, yytop
9data yybgin/1/
10data yyprev/YYNEWLINE/
11data yytop/YYTOPVAL/
12end
13integer function yylook(dummy)
14common /Lverif/ verif
15common /Ladvan/ advan
16common /Lstoff/ stoff
17common /Lsfall/ sfall
18common /Latable/ atable
19common /Lextra/ extra
20common /Lvstop/ vstop
21integer verif(Sverif), advan(Sadvan),stoff(Sstoff),match(Smatch)
22integer sfall(Ssfall),atable(Satable),extra(Sextra), vstop(Svstop)
23integer state, lsp, r
24integer ch, n
25common /yyldat/ yyfnd, yymorf, yyprev, yybgin, yytop, yylsp, yylsta(YYLMAX)
26common /yyxel/ yyleng, yytext
27integer yyfnd, yymorf, yylsta, yylsp, yytext, yyprev, yyleng, yytop
28integer lexshf, yytext(YYLMAX), yyback, yybgin
29integer z, t
30if (yymorf .eq. 0)
31 yyleng = 0
32else
33 yymorf=0
341776
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
141end
142integer function yyback (isub, n)
143common /Lvstop/ vstop
144integer vstop(Svstop)
145if (isub .ne. 0)
146while (vstop(isub) .ne. 0){
147 if (vstop(isub) .eq. m){
148 yyback = 1
149 return
150 }
151 isub = isub + 1
152 }
153yyback = 0
154return
155end