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