xref: /illumos-gate/usr/src/cmd/sgs/lex/common/nrform (revision 966c588f828c4693b5a80ec27b24ff16afa11ec9)
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-gateblock data
27*7c478bd9Sstevel@tonic-gateinteger cshift, csize, yynlin
28*7c478bd9Sstevel@tonic-gatecommon /yyllib/ cshift, csize, yynlin
29*7c478bd9Sstevel@tonic-gatedata yynlin/YYNEWLINE/
30*7c478bd9Sstevel@tonic-gateend
31*7c478bd9Sstevel@tonic-gateblock data
32*7c478bd9Sstevel@tonic-gatecommon /yyldat/ yyfnd, ymorf, yyprev, yybgin, yytop
33*7c478bd9Sstevel@tonic-gateinteger yyfnd, yymorf, yyprev, yybgin, yytop
34*7c478bd9Sstevel@tonic-gatedata yybgin/1/
35*7c478bd9Sstevel@tonic-gatedata yyprev/YYNEWLINE/
36*7c478bd9Sstevel@tonic-gatedata yytop/YYTOPVAL/
37*7c478bd9Sstevel@tonic-gateend
38*7c478bd9Sstevel@tonic-gateinteger function yylook(dummy)
39*7c478bd9Sstevel@tonic-gatecommon /Lverif/ verif
40*7c478bd9Sstevel@tonic-gatecommon /Ladvan/ advan
41*7c478bd9Sstevel@tonic-gatecommon /Lstoff/ stoff
42*7c478bd9Sstevel@tonic-gatecommon /Lsfall/ sfall
43*7c478bd9Sstevel@tonic-gatecommon /Latable/ atable
44*7c478bd9Sstevel@tonic-gatecommon /Lextra/ extra
45*7c478bd9Sstevel@tonic-gatecommon /Lvstop/ vstop
46*7c478bd9Sstevel@tonic-gateinteger verif(Sverif), advan(Sadvan),stoff(Sstoff),match(Smatch)
47*7c478bd9Sstevel@tonic-gateinteger sfall(Ssfall),atable(Satable),extra(Sextra), vstop(Svstop)
48*7c478bd9Sstevel@tonic-gateinteger state, lsp, r
49*7c478bd9Sstevel@tonic-gateinteger  ch, n
50*7c478bd9Sstevel@tonic-gatecommon /yyldat/ yyfnd, yymorf, yyprev, yybgin, yytop, yylsp, yylsta(YYLMAX)
51*7c478bd9Sstevel@tonic-gatecommon /yyxel/ yyleng, yytext
52*7c478bd9Sstevel@tonic-gateinteger yyfnd, yymorf, yylsta, yylsp, yytext, yyprev, yyleng, yytop
53*7c478bd9Sstevel@tonic-gateinteger  lexshf, yytext(YYLMAX), yyback, yybgin
54*7c478bd9Sstevel@tonic-gateinteger z, t
55*7c478bd9Sstevel@tonic-gateif (yymorf .eq. 0)
56*7c478bd9Sstevel@tonic-gate	yyleng = 0
57*7c478bd9Sstevel@tonic-gateelse
58*7c478bd9Sstevel@tonic-gate	yymorf=0
59*7c478bd9Sstevel@tonic-gate1776
60*7c478bd9Sstevel@tonic-gate	lsp = 1
61*7c478bd9Sstevel@tonic-gate	state = yybgin
62*7c478bd9Sstevel@tonic-gate	if (yyprev .eq. YYNEWLINE)
63*7c478bd9Sstevel@tonic-gate		state = state + 1
64*7c478bd9Sstevel@tonic-gate	for (;;){
65*7c478bd9Sstevel@tonic-gate		r = stoff(state)
66*7c478bd9Sstevel@tonic-gate		if (r .eq. 0){
67*7c478bd9Sstevel@tonic-gate			z = sfall(state)
68*7c478bd9Sstevel@tonic-gate			if (z .eq. 0)
69*7c478bd9Sstevel@tonic-gate				break
70*7c478bd9Sstevel@tonic-gate			if(stoff(z) == 0) break
71*7c478bd9Sstevel@tonic-gate			}
72*7c478bd9Sstevel@tonic-gate		ch = input(dummy)
73*7c478bd9Sstevel@tonic-gate		ich = lexshf(ch)
74*7c478bd9Sstevel@tonic-gate		yyleng = yyleng+1
75*7c478bd9Sstevel@tonic-gate		yytext(yyleng) = ch
76*7c478bd9Sstevel@tonic-gate		1984
77*7c478bd9Sstevel@tonic-gate		if(r .gt. 0){
78*7c478bd9Sstevel@tonic-gate			t = r + ich
79*7c478bd9Sstevel@tonic-gate			if (t<= yytop){
80*7c478bd9Sstevel@tonic-gate			  if (verif(t) .eq. state){
81*7c478bd9Sstevel@tonic-gate				if(advan(t) == YYERROR){
82*7c478bd9Sstevel@tonic-gate					call unput(yytext(yyleng))
83*7c478bd9Sstevel@tonic-gate					yyleng = yyleng - 1
84*7c478bd9Sstevel@tonic-gate					break
85*7c478bd9Sstevel@tonic-gate					}
86*7c478bd9Sstevel@tonic-gate				state = advan(t)
87*7c478bd9Sstevel@tonic-gate				yylsta(lsp) = state
88*7c478bd9Sstevel@tonic-gate				lsp = lsp +1
89*7c478bd9Sstevel@tonic-gate				goto 2001
90*7c478bd9Sstevel@tonic-gate				}
91*7c478bd9Sstevel@tonic-gate			  }
92*7c478bd9Sstevel@tonic-gate			}
93*7c478bd9Sstevel@tonic-gate		if(r < 0){
94*7c478bd9Sstevel@tonic-gate			t = r + ich
95*7c478bd9Sstevel@tonic-gate			if (t <= yytop .and. verif(t) .eq. state){
96*7c478bd9Sstevel@tonic-gate				if(advan(t) == YYERROR){
97*7c478bd9Sstevel@tonic-gate					call unput(yytext(yyleng))
98*7c478bd9Sstevel@tonic-gate					yyleng = yyleng - 1
99*7c478bd9Sstevel@tonic-gate					break
100*7c478bd9Sstevel@tonic-gate					}
101*7c478bd9Sstevel@tonic-gate				state = advan(t)
102*7c478bd9Sstevel@tonic-gate				yylsta(lsp) = state
103*7c478bd9Sstevel@tonic-gate				lsp = lsp +1
104*7c478bd9Sstevel@tonic-gate				goto 2001
105*7c478bd9Sstevel@tonic-gate				}
106*7c478bd9Sstevel@tonic-gate			t = r + match(ich)
107*7c478bd9Sstevel@tonic-gate			if(t <= yytop && state == verif(t)){
108*7c478bd9Sstevel@tonic-gate				if(advan(t) == YYERROR){
109*7c478bd9Sstevel@tonic-gate					call unput(yytext(yyleng))
110*7c478bd9Sstevel@tonic-gate					yyleng = yyleng - 1
111*7c478bd9Sstevel@tonic-gate					break
112*7c478bd9Sstevel@tonic-gate					}
113*7c478bd9Sstevel@tonic-gate			state = advan(t)
114*7c478bd9Sstevel@tonic-gate			yylsta(lsp) = state
115*7c478bd9Sstevel@tonic-gate			lsp = lsp + 1
116*7c478bd9Sstevel@tonic-gate			goto 2001
117*7c478bd9Sstevel@tonic-gate			}
118*7c478bd9Sstevel@tonic-gate		}
119*7c478bd9Sstevel@tonic-gate		else {
120*7c478bd9Sstevel@tonic-gate			if (state > 0) state = sfall(state)
121*7c478bd9Sstevel@tonic-gate			if (state .gt. 0) r = stoff(state)
122*7c478bd9Sstevel@tonic-gate			if (state .gt. 0 .and. r .ne. 0)
123*7c478bd9Sstevel@tonic-gate				goto 1984
124*7c478bd9Sstevel@tonic-gate			call unput(yytext(yyleng))
125*7c478bd9Sstevel@tonic-gate			yyleng = yyleng -1
126*7c478bd9Sstevel@tonic-gate			break
127*7c478bd9Sstevel@tonic-gate			}
128*7c478bd9Sstevel@tonic-gate	2001
129*7c478bd9Sstevel@tonic-gate		continue
130*7c478bd9Sstevel@tonic-gate		}
131*7c478bd9Sstevel@tonic-gate	while (lsp .gt. 1){
132*7c478bd9Sstevel@tonic-gate		lsp = lsp -1
133*7c478bd9Sstevel@tonic-gate		ilsp = yylsta(lsp)
134*7c478bd9Sstevel@tonic-gate		yyfnd = atable(ilsp)
135*7c478bd9Sstevel@tonic-gate		if (yyfnd .gt. 0)
136*7c478bd9Sstevel@tonic-gate			if (vstop(yyfnd) .gt. 0){
137*7c478bd9Sstevel@tonic-gate				r = vstop(yyfnd)
138*7c478bd9Sstevel@tonic-gate				if (extra(r) .ne. 0){
139*7c478bd9Sstevel@tonic-gate					for(;;){
140*7c478bd9Sstevel@tonic-gate					ilsp = yylsta(lsp)
141*7c478bd9Sstevel@tonic-gate					if (yyback(atable(ilsp), -r) .eq. 1)
142*7c478bd9Sstevel@tonic-gate						break
143*7c478bd9Sstevel@tonic-gate					lsp= lsp -1
144*7c478bd9Sstevel@tonic-gate					call unput(yytext(yyleng))
145*7c478bd9Sstevel@tonic-gate					yyleng = yyleng -1
146*7c478bd9Sstevel@tonic-gate					}
147*7c478bd9Sstevel@tonic-gate					}
148*7c478bd9Sstevel@tonic-gate				yyprev = lexshf(yytext(yyleng))
149*7c478bd9Sstevel@tonic-gate				yylsp = lsp
150*7c478bd9Sstevel@tonic-gate				yyfnd = yyfnd + 1
151*7c478bd9Sstevel@tonic-gate				yylook = r
152*7c478bd9Sstevel@tonic-gate				yytext(yyleng+1) = 0
153*7c478bd9Sstevel@tonic-gate				return
154*7c478bd9Sstevel@tonic-gate				}
155*7c478bd9Sstevel@tonic-gate		call unput(yytext(yyleng))
156*7c478bd9Sstevel@tonic-gate		}
157*7c478bd9Sstevel@tonic-gate	if (yytext(1) .eq. 0){
158*7c478bd9Sstevel@tonic-gate		yylook=0
159*7c478bd9Sstevel@tonic-gate		return
160*7c478bd9Sstevel@tonic-gate		}
161*7c478bd9Sstevel@tonic-gate	yyprev = input(dummy)
162*7c478bd9Sstevel@tonic-gate	call output(yyprev)
163*7c478bd9Sstevel@tonic-gate	yyprev = lexshf(yyprev)
164*7c478bd9Sstevel@tonic-gate	yyleng = 0
165*7c478bd9Sstevel@tonic-gate	goto 1776
166*7c478bd9Sstevel@tonic-gateend
167*7c478bd9Sstevel@tonic-gateinteger function yyback (isub, n)
168*7c478bd9Sstevel@tonic-gatecommon /Lvstop/ vstop
169*7c478bd9Sstevel@tonic-gateinteger vstop(Svstop)
170*7c478bd9Sstevel@tonic-gateif (isub .ne. 0)
171*7c478bd9Sstevel@tonic-gatewhile (vstop(isub) .ne. 0){
172*7c478bd9Sstevel@tonic-gate	if (vstop(isub) .eq. m){
173*7c478bd9Sstevel@tonic-gate		yyback = 1
174*7c478bd9Sstevel@tonic-gate		return
175*7c478bd9Sstevel@tonic-gate		}
176*7c478bd9Sstevel@tonic-gate	isub = isub + 1
177*7c478bd9Sstevel@tonic-gate	}
178*7c478bd9Sstevel@tonic-gateyyback = 0
179*7c478bd9Sstevel@tonic-gatereturn
180*7c478bd9Sstevel@tonic-gateend
181