dmake: do not set MAKEFLAGS=k
[unleashed/tickless.git] / usr / src / cmd / sgs / lex / common / nrform
blobe12e64197a16abeddae71c25e0304a7e0c860970
1 /*
2  * CDDL HEADER START
3  *
4  * The contents of this file are subject to the terms of the
5  * Common Development and Distribution License, Version 1.0 only
6  * (the "License").  You may not use this file except in compliance
7  * with the License.
8  *
9  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10  * or http://www.opensolaris.org/os/licensing.
11  * See the License for the specific language governing permissions
12  * and limitations under the License.
13  *
14  * When distributing Covered Code, include this CDDL HEADER in each
15  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16  * If applicable, add the following below this CDDL HEADER, with the
17  * fields enclosed by brackets "[]" replaced with your own identifying
18  * information: Portions Copyright [yyyy] [name of copyright owner]
19  *
20  * CDDL HEADER END
21  */
23  * Copyright (c) 1993 by Sun Microsystems, Inc.
24  */
26 #pragma ident   "%Z%%M% %I%     %E% SMI"
28 block data
29 integer cshift, csize, yynlin
30 common /yyllib/ cshift, csize, yynlin
31 data yynlin/YYNEWLINE/
32 end
33 block data
34 common /yyldat/ yyfnd, ymorf, yyprev, yybgin, yytop
35 integer yyfnd, yymorf, yyprev, yybgin, yytop
36 data yybgin/1/
37 data yyprev/YYNEWLINE/
38 data yytop/YYTOPVAL/
39 end
40 integer function yylook(dummy)
41 common /Lverif/ verif
42 common /Ladvan/ advan
43 common /Lstoff/ stoff
44 common /Lsfall/ sfall
45 common /Latable/ atable
46 common /Lextra/ extra
47 common /Lvstop/ vstop
48 integer verif(Sverif), advan(Sadvan),stoff(Sstoff),match(Smatch)
49 integer sfall(Ssfall),atable(Satable),extra(Sextra), vstop(Svstop)
50 integer state, lsp, r
51 integer  ch, n
52 common /yyldat/ yyfnd, yymorf, yyprev, yybgin, yytop, yylsp, yylsta(YYLMAX)
53 common /yyxel/ yyleng, yytext
54 integer yyfnd, yymorf, yylsta, yylsp, yytext, yyprev, yyleng, yytop
55 integer  lexshf, yytext(YYLMAX), yyback, yybgin
56 integer z, t
57 if (yymorf .eq. 0)
58         yyleng = 0
59 else
60         yymorf=0
61 1776
62         lsp = 1
63         state = yybgin
64         if (yyprev .eq. YYNEWLINE)
65                 state = state + 1
66         for (;;){
67                 r = stoff(state)
68                 if (r .eq. 0){
69                         z = sfall(state)
70                         if (z .eq. 0)
71                                 break
72                         if(stoff(z) == 0) break
73                         }
74                 ch = input(dummy)
75                 ich = lexshf(ch)
76                 yyleng = yyleng+1
77                 yytext(yyleng) = ch
78                 1984
79                 if(r .gt. 0){
80                         t = r + ich
81                         if (t<= yytop){
82                           if (verif(t) .eq. state){
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                         }
95                 if(r < 0){
96                         t = r + ich
97                         if (t <= yytop .and. verif(t) .eq. state){
98                                 if(advan(t) == YYERROR){
99                                         call unput(yytext(yyleng))
100                                         yyleng = yyleng - 1
101                                         break
102                                         }
103                                 state = advan(t)
104                                 yylsta(lsp) = state
105                                 lsp = lsp +1
106                                 goto 2001
107                                 }
108                         t = r + match(ich)
109                         if(t <= yytop && state == verif(t)){
110                                 if(advan(t) == YYERROR){
111                                         call unput(yytext(yyleng))
112                                         yyleng = yyleng - 1
113                                         break
114                                         }
115                         state = advan(t)
116                         yylsta(lsp) = state
117                         lsp = lsp + 1
118                         goto 2001
119                         }
120                 }
121                 else {
122                         if (state > 0) state = sfall(state)
123                         if (state .gt. 0) r = stoff(state)
124                         if (state .gt. 0 .and. r .ne. 0)
125                                 goto 1984
126                         call unput(yytext(yyleng))
127                         yyleng = yyleng -1
128                         break
129                         }
130         2001
131                 continue
132                 }
133         while (lsp .gt. 1){
134                 lsp = lsp -1
135                 ilsp = yylsta(lsp)
136                 yyfnd = atable(ilsp)
137                 if (yyfnd .gt. 0)
138                         if (vstop(yyfnd) .gt. 0){
139                                 r = vstop(yyfnd)
140                                 if (extra(r) .ne. 0){
141                                         for(;;){
142                                         ilsp = yylsta(lsp)
143                                         if (yyback(atable(ilsp), -r) .eq. 1)
144                                                 break
145                                         lsp= lsp -1
146                                         call unput(yytext(yyleng))
147                                         yyleng = yyleng -1
148                                         }
149                                         }
150                                 yyprev = lexshf(yytext(yyleng))
151                                 yylsp = lsp
152                                 yyfnd = yyfnd + 1
153                                 yylook = r
154                                 yytext(yyleng+1) = 0
155                                 return
156                                 }
157                 call unput(yytext(yyleng))
158                 }
159         if (yytext(1) .eq. 0){
160                 yylook=0
161                 return
162                 }
163         yyprev = input(dummy)
164         call output(yyprev)
165         yyprev = lexshf(yyprev)
166         yyleng = 0
167         goto 1776
169 integer function yyback (isub, n)
170 common /Lvstop/ vstop
171 integer vstop(Svstop)
172 if (isub .ne. 0)
173 while (vstop(isub) .ne. 0){
174         if (vstop(isub) .eq. m){
175                 yyback = 1
176                 return
177                 }
178         isub = isub + 1
179         }
180 yyback = 0
181 return