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
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.
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]
23 /* Copyright (c) 1989 AT&T */
24 /* All Rights Reserved */
26 #pragma ident "%Z%%M% %I% %E% SMI"
30 # define NLSTATE yyprevious=YYNEWLINE
31 struct yysvf *yylstate [YYLMAX], **yylsp, **yyolsp;
33 char *yysptr = yysbuf;
35 extern struct yysvf *yyestate;
36 int yyprevious = YYNEWLINE;
37 #if defined(__cplusplus) || defined(__STDC__)
43 register struct yysvf *yystate, **lsp;
44 register struct yywork *yyt;
52 /* start off machines */
61 yylastch = yytext+yyleng;
65 yyestate = yystate = yybgin;
66 if (yyprevious==YYNEWLINE) yystate++;
69 if(debug)fprintf(yyout,"state %d\n",yystate-yysvec-1);
71 yyt = yystate->yystoff;
72 if(yyt == yycrank && !yyfirst){ /* may not be any transitions */
73 yyz = yystate->yyother;
75 if(yyz->yystoff == yycrank)break;
78 *yylastch++ = yych = input();
80 *yylastch++ = yych = lex_input();
83 if(yylastch > &yytext[YYLMAX]) {
84 fprintf(yyout,"Input string too long, limit %d\n",YYLMAX);
88 if (yylastch >= &yytext[ yytextsz ]) {
89 int x = yylastch - yytext;
91 yytextsz += YYTEXTSZINC;
92 if (yytext == yy_tbuf) {
93 yytext = (char *) malloc(yytextsz);
94 memcpy(yytext, yy_tbuf, sizeof (yy_tbuf));
97 yytext = (char *) realloc(yytext, yytextsz);
100 "Cannot realloc yytext\n");
103 yylastch = yytext + x;
110 fprintf(yyout,"char ");
116 if ( (uintptr_t)yyt > (uintptr_t)yycrank){
118 if (yyt <= yytop && yyt->verify+yysvec == yystate){
119 if(yyt->advance+yysvec == YYLERR) /* error transitions */
120 {unput(*--yylastch);break;}
121 *lsp++ = yystate = yyt->advance+yysvec;
122 if(lsp > &yylstate[YYLMAX]) {
123 fprintf(yyout,"Input string too long, limit %d\n",YYLMAX);
130 else if((uintptr_t)yyt < (uintptr_t)yycrank) { /* r < yycrank */
131 yyt = yyr = yycrank+(yycrank-yyt);
133 if(debug)fprintf(yyout,"compressed state\n");
136 if(yyt <= yytop && yyt->verify+yysvec == yystate){
137 if(yyt->advance+yysvec == YYLERR) /* error transitions */
138 {unput(*--yylastch);break;}
139 *lsp++ = yystate = yyt->advance+yysvec;
140 if(lsp > &yylstate[YYLMAX]) {
141 fprintf(yyout,"Input string too long, limit %d\n",YYLMAX);
146 yyt = yyr + YYU(yymatch[yych]);
149 fprintf(yyout,"try fall back character ");
150 allprint(YYU(yymatch[yych]));
154 if(yyt <= yytop && yyt->verify+yysvec == yystate){
155 if(yyt->advance+yysvec == YYLERR) /* error transition */
156 {unput(*--yylastch);break;}
157 *lsp++ = yystate = yyt->advance+yysvec;
158 if(lsp > &yylstate[YYLMAX]) {
159 fprintf(yyout,"Input string too long, limit %d\n",YYLMAX);
165 if ((yystate = yystate->yyother) && (yyt= yystate->yystoff) != yycrank){
167 if(debug)fprintf(yyout,"fall back to state %d\n",yystate-yysvec-1);
173 {unput(*--yylastch);break;}
177 fprintf(yyout,"state %d char ",yystate-yysvec-1);
186 fprintf(yyout,"stopped at %d with ",*(lsp-1)-yysvec-1);
191 while (lsp-- > yylstate){
193 if (*lsp != 0 && (yyfnd= (*lsp)->yystops) && *yyfnd > 0){
195 if(yyextra[*yyfnd]){ /* must backup */
196 while(yyback((*lsp)->yystops,-*yyfnd) != 1 && lsp > yylstate){
201 yyprevious = YYU(*yylastch);
203 yyleng = yylastch-yytext+1;
207 fprintf(yyout,"\nmatch ");
209 fprintf(yyout," action %d\n",*yyfnd);
216 if (yytext[0] == 0 /* && feof(yyin) */)
222 yyprevious = yytext[0] = input();
226 yyprevious = yytext[0] = lex_input();
228 lex_output(yyprevious);
232 if(debug)putchar('\n');
236 #if defined(__cplusplus) || defined(__STDC__)
237 int yyback(int *p, int m)
250 /* the following are only used in the lex library */
251 #if defined(__cplusplus) || defined(__STDC__)
263 #if defined(__cplusplus) || defined(__STDC__)
276 #if defined(__cplusplus) || defined(__STDC__)