xref: /illumos-gate/usr/src/cmd/sgs/lex/common/nrform (revision 966c588f)
17c478bd9Sstevel@tonic-gate/*
27c478bd9Sstevel@tonic-gate * CDDL HEADER START
37c478bd9Sstevel@tonic-gate *
47c478bd9Sstevel@tonic-gate * The contents of this file are subject to the terms of the
57c478bd9Sstevel@tonic-gate * Common Development and Distribution License, Version 1.0 only
67c478bd9Sstevel@tonic-gate * (the "License").  You may not use this file except in compliance
77c478bd9Sstevel@tonic-gate * with the License.
87c478bd9Sstevel@tonic-gate *
97c478bd9Sstevel@tonic-gate * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
107c478bd9Sstevel@tonic-gate * or http://www.opensolaris.org/os/licensing.
117c478bd9Sstevel@tonic-gate * See the License for the specific language governing permissions
127c478bd9Sstevel@tonic-gate * and limitations under the License.
137c478bd9Sstevel@tonic-gate *
147c478bd9Sstevel@tonic-gate * When distributing Covered Code, include this CDDL HEADER in each
157c478bd9Sstevel@tonic-gate * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
167c478bd9Sstevel@tonic-gate * If applicable, add the following below this CDDL HEADER, with the
177c478bd9Sstevel@tonic-gate * fields enclosed by brackets "[]" replaced with your own identifying
187c478bd9Sstevel@tonic-gate * information: Portions Copyright [yyyy] [name of copyright owner]
197c478bd9Sstevel@tonic-gate *
207c478bd9Sstevel@tonic-gate * CDDL HEADER END
217c478bd9Sstevel@tonic-gate */
227c478bd9Sstevel@tonic-gate/*
237c478bd9Sstevel@tonic-gate * Copyright (c) 1993 by Sun Microsystems, Inc.
247c478bd9Sstevel@tonic-gate */
257c478bd9Sstevel@tonic-gate
267c478bd9Sstevel@tonic-gateblock data
277c478bd9Sstevel@tonic-gateinteger cshift, csize, yynlin
287c478bd9Sstevel@tonic-gatecommon /yyllib/ cshift, csize, yynlin
297c478bd9Sstevel@tonic-gatedata yynlin/YYNEWLINE/
307c478bd9Sstevel@tonic-gateend
317c478bd9Sstevel@tonic-gateblock data
327c478bd9Sstevel@tonic-gatecommon /yyldat/ yyfnd, ymorf, yyprev, yybgin, yytop
337c478bd9Sstevel@tonic-gateinteger yyfnd, yymorf, yyprev, yybgin, yytop
347c478bd9Sstevel@tonic-gatedata yybgin/1/
357c478bd9Sstevel@tonic-gatedata yyprev/YYNEWLINE/
367c478bd9Sstevel@tonic-gatedata yytop/YYTOPVAL/
377c478bd9Sstevel@tonic-gateend
387c478bd9Sstevel@tonic-gateinteger function yylook(dummy)
397c478bd9Sstevel@tonic-gatecommon /Lverif/ verif
407c478bd9Sstevel@tonic-gatecommon /Ladvan/ advan
417c478bd9Sstevel@tonic-gatecommon /Lstoff/ stoff
427c478bd9Sstevel@tonic-gatecommon /Lsfall/ sfall
437c478bd9Sstevel@tonic-gatecommon /Latable/ atable
447c478bd9Sstevel@tonic-gatecommon /Lextra/ extra
457c478bd9Sstevel@tonic-gatecommon /Lvstop/ vstop
467c478bd9Sstevel@tonic-gateinteger verif(Sverif), advan(Sadvan),stoff(Sstoff),match(Smatch)
477c478bd9Sstevel@tonic-gateinteger sfall(Ssfall),atable(Satable),extra(Sextra), vstop(Svstop)
487c478bd9Sstevel@tonic-gateinteger state, lsp, r
497c478bd9Sstevel@tonic-gateinteger  ch, n
507c478bd9Sstevel@tonic-gatecommon /yyldat/ yyfnd, yymorf, yyprev, yybgin, yytop, yylsp, yylsta(YYLMAX)
517c478bd9Sstevel@tonic-gatecommon /yyxel/ yyleng, yytext
527c478bd9Sstevel@tonic-gateinteger yyfnd, yymorf, yylsta, yylsp, yytext, yyprev, yyleng, yytop
537c478bd9Sstevel@tonic-gateinteger  lexshf, yytext(YYLMAX), yyback, yybgin
547c478bd9Sstevel@tonic-gateinteger z, t
557c478bd9Sstevel@tonic-gateif (yymorf .eq. 0)
567c478bd9Sstevel@tonic-gate	yyleng = 0
577c478bd9Sstevel@tonic-gateelse
587c478bd9Sstevel@tonic-gate	yymorf=0
597c478bd9Sstevel@tonic-gate1776
607c478bd9Sstevel@tonic-gate	lsp = 1
617c478bd9Sstevel@tonic-gate	state = yybgin
627c478bd9Sstevel@tonic-gate	if (yyprev .eq. YYNEWLINE)
637c478bd9Sstevel@tonic-gate		state = state + 1
647c478bd9Sstevel@tonic-gate	for (;;){
657c478bd9Sstevel@tonic-gate		r = stoff(state)
667c478bd9Sstevel@tonic-gate		if (r .eq. 0){
677c478bd9Sstevel@tonic-gate			z = sfall(state)
687c478bd9Sstevel@tonic-gate			if (z .eq. 0)
697c478bd9Sstevel@tonic-gate				break
707c478bd9Sstevel@tonic-gate			if(stoff(z) == 0) break
717c478bd9Sstevel@tonic-gate			}
727c478bd9Sstevel@tonic-gate		ch = input(dummy)
737c478bd9Sstevel@tonic-gate		ich = lexshf(ch)
747c478bd9Sstevel@tonic-gate		yyleng = yyleng+1
757c478bd9Sstevel@tonic-gate		yytext(yyleng) = ch
767c478bd9Sstevel@tonic-gate		1984
777c478bd9Sstevel@tonic-gate		if(r .gt. 0){
787c478bd9Sstevel@tonic-gate			t = r + ich
797c478bd9Sstevel@tonic-gate			if (t<= yytop){
807c478bd9Sstevel@tonic-gate			  if (verif(t) .eq. state){
817c478bd9Sstevel@tonic-gate				if(advan(t) == YYERROR){
827c478bd9Sstevel@tonic-gate					call unput(yytext(yyleng))
837c478bd9Sstevel@tonic-gate					yyleng = yyleng - 1
847c478bd9Sstevel@tonic-gate					break
857c478bd9Sstevel@tonic-gate					}
867c478bd9Sstevel@tonic-gate				state = advan(t)
877c478bd9Sstevel@tonic-gate				yylsta(lsp) = state
887c478bd9Sstevel@tonic-gate				lsp = lsp +1
897c478bd9Sstevel@tonic-gate				goto 2001
907c478bd9Sstevel@tonic-gate				}
917c478bd9Sstevel@tonic-gate			  }
927c478bd9Sstevel@tonic-gate			}
937c478bd9Sstevel@tonic-gate		if(r < 0){
947c478bd9Sstevel@tonic-gate			t = r + ich
957c478bd9Sstevel@tonic-gate			if (t <= yytop .and. verif(t) .eq. state){
967c478bd9Sstevel@tonic-gate				if(advan(t) == YYERROR){
977c478bd9Sstevel@tonic-gate					call unput(yytext(yyleng))
987c478bd9Sstevel@tonic-gate					yyleng = yyleng - 1
997c478bd9Sstevel@tonic-gate					break
1007c478bd9Sstevel@tonic-gate					}
1017c478bd9Sstevel@tonic-gate				state = advan(t)
1027c478bd9Sstevel@tonic-gate				yylsta(lsp) = state
1037c478bd9Sstevel@tonic-gate				lsp = lsp +1
1047c478bd9Sstevel@tonic-gate				goto 2001
1057c478bd9Sstevel@tonic-gate				}
1067c478bd9Sstevel@tonic-gate			t = r + match(ich)
1077c478bd9Sstevel@tonic-gate			if(t <= yytop && state == verif(t)){
1087c478bd9Sstevel@tonic-gate				if(advan(t) == YYERROR){
1097c478bd9Sstevel@tonic-gate					call unput(yytext(yyleng))
1107c478bd9Sstevel@tonic-gate					yyleng = yyleng - 1
1117c478bd9Sstevel@tonic-gate					break
1127c478bd9Sstevel@tonic-gate					}
1137c478bd9Sstevel@tonic-gate			state = advan(t)
1147c478bd9Sstevel@tonic-gate			yylsta(lsp) = state
1157c478bd9Sstevel@tonic-gate			lsp = lsp + 1
1167c478bd9Sstevel@tonic-gate			goto 2001
1177c478bd9Sstevel@tonic-gate			}
1187c478bd9Sstevel@tonic-gate		}
1197c478bd9Sstevel@tonic-gate		else {
1207c478bd9Sstevel@tonic-gate			if (state > 0) state = sfall(state)
1217c478bd9Sstevel@tonic-gate			if (state .gt. 0) r = stoff(state)
1227c478bd9Sstevel@tonic-gate			if (state .gt. 0 .and. r .ne. 0)
1237c478bd9Sstevel@tonic-gate				goto 1984
1247c478bd9Sstevel@tonic-gate			call unput(yytext(yyleng))
1257c478bd9Sstevel@tonic-gate			yyleng = yyleng -1
1267c478bd9Sstevel@tonic-gate			break
1277c478bd9Sstevel@tonic-gate			}
1287c478bd9Sstevel@tonic-gate	2001
1297c478bd9Sstevel@tonic-gate		continue
1307c478bd9Sstevel@tonic-gate		}
1317c478bd9Sstevel@tonic-gate	while (lsp .gt. 1){
1327c478bd9Sstevel@tonic-gate		lsp = lsp -1
1337c478bd9Sstevel@tonic-gate		ilsp = yylsta(lsp)
1347c478bd9Sstevel@tonic-gate		yyfnd = atable(ilsp)
1357c478bd9Sstevel@tonic-gate		if (yyfnd .gt. 0)
1367c478bd9Sstevel@tonic-gate			if (vstop(yyfnd) .gt. 0){
1377c478bd9Sstevel@tonic-gate				r = vstop(yyfnd)
1387c478bd9Sstevel@tonic-gate				if (extra(r) .ne. 0){
1397c478bd9Sstevel@tonic-gate					for(;;){
1407c478bd9Sstevel@tonic-gate					ilsp = yylsta(lsp)
1417c478bd9Sstevel@tonic-gate					if (yyback(atable(ilsp), -r) .eq. 1)
1427c478bd9Sstevel@tonic-gate						break
1437c478bd9Sstevel@tonic-gate					lsp= lsp -1
1447c478bd9Sstevel@tonic-gate					call unput(yytext(yyleng))
1457c478bd9Sstevel@tonic-gate					yyleng = yyleng -1
1467c478bd9Sstevel@tonic-gate					}
1477c478bd9Sstevel@tonic-gate					}
1487c478bd9Sstevel@tonic-gate				yyprev = lexshf(yytext(yyleng))
1497c478bd9Sstevel@tonic-gate				yylsp = lsp
1507c478bd9Sstevel@tonic-gate				yyfnd = yyfnd + 1
1517c478bd9Sstevel@tonic-gate				yylook = r
1527c478bd9Sstevel@tonic-gate				yytext(yyleng+1) = 0
1537c478bd9Sstevel@tonic-gate				return
1547c478bd9Sstevel@tonic-gate				}
1557c478bd9Sstevel@tonic-gate		call unput(yytext(yyleng))
1567c478bd9Sstevel@tonic-gate		}
1577c478bd9Sstevel@tonic-gate	if (yytext(1) .eq. 0){
1587c478bd9Sstevel@tonic-gate		yylook=0
1597c478bd9Sstevel@tonic-gate		return
1607c478bd9Sstevel@tonic-gate		}
1617c478bd9Sstevel@tonic-gate	yyprev = input(dummy)
1627c478bd9Sstevel@tonic-gate	call output(yyprev)
1637c478bd9Sstevel@tonic-gate	yyprev = lexshf(yyprev)
1647c478bd9Sstevel@tonic-gate	yyleng = 0
1657c478bd9Sstevel@tonic-gate	goto 1776
1667c478bd9Sstevel@tonic-gateend
1677c478bd9Sstevel@tonic-gateinteger function yyback (isub, n)
1687c478bd9Sstevel@tonic-gatecommon /Lvstop/ vstop
1697c478bd9Sstevel@tonic-gateinteger vstop(Svstop)
1707c478bd9Sstevel@tonic-gateif (isub .ne. 0)
1717c478bd9Sstevel@tonic-gatewhile (vstop(isub) .ne. 0){
1727c478bd9Sstevel@tonic-gate	if (vstop(isub) .eq. m){
1737c478bd9Sstevel@tonic-gate		yyback = 1
1747c478bd9Sstevel@tonic-gate		return
1757c478bd9Sstevel@tonic-gate		}
1767c478bd9Sstevel@tonic-gate	isub = isub + 1
1777c478bd9Sstevel@tonic-gate	}
1787c478bd9Sstevel@tonic-gateyyback = 0
179*966c588fSToomas Soomereturn
1807c478bd9Sstevel@tonic-gateend
181