/* * CDDL HEADER START * * The contents of this file are subject to the terms of the * Common Development and Distribution License, Version 1.0 only * (the "License"). You may not use this file except in compliance * with the License. * * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE * or http://www.opensolaris.org/os/licensing. * See the License for the specific language governing permissions * and limitations under the License. * * When distributing Covered Code, include this CDDL HEADER in each * file and include the License file at usr/src/OPENSOLARIS.LICENSE. * If applicable, add the following below this CDDL HEADER, with the * fields enclosed by brackets "[]" replaced with your own identifying * information: Portions Copyright [yyyy] [name of copyright owner] * * CDDL HEADER END */ /* * Copyright 2005 Sun Microsystems, Inc. * All rights reserved. * Use is subject to license terms. */ /* Copyright (c) 1989 AT&T */ /* All Rights Reserved */ int yylineno =1; int yygid; #define LONG_WCHAR_T 1 # define YYU(x) x # define NLSTATE yyprevious=YYNEWLINE wchar_t yysbuf[YYLMAX]; wchar_t *yysptr = yysbuf; struct yysvf *yylstate [YYLMAX], **yylsp, **yyolsp; int *yyfnd; extern struct yysvf *yyestate; int yyprevious = YYNEWLINE; int yylook(void) { struct yysvf *yystate, **lsp; struct yywork *yyt; struct yysvf *yyz; int yych, yyfirst; struct yywork *yyr; # ifdef LEXDEBUG int debug; # endif wchar_t *yylastch; /* start off machines */ # ifdef LEXDEBUG debug = 0; # endif yyfirst=1; if (!yymorfg) yylastch = YYTEXT; else { yymorfg=0; yylastch = YYTEXT+YYLENG; } for(;;){ lsp = yylstate; yyestate = yystate = yybgin; if (yyprevious==YYNEWLINE) yystate++; for (;;){ # ifdef LEXDEBUG if(debug)fprintf(yyout,"state %d\n",yystate-yysvec-1); # endif yyt = yystate->yystoff; if(yyt == yycrank && !yyfirst){ /* may not be any transitions */ yyz = yystate->yyother; if(yyz == 0)break; if(yyz->yystoff == yycrank)break; } *yylastch++ = yych = YYINPUT(); #ifdef YYISARRAY if(yylastch > &YYTEXT[YYLMAX]) { fprintf(yyout,"Input string too long, limit %d\n",YYLMAX); exit(1); } #else if (yylastch >= &YYTEXT[ yytextsz ]) { int x = yylastch - YYTEXT; yytextsz += YYTEXTSZINC; #ifdef YYLEX_E /* -e */ if (YYTEXT == yy_twbuf) { YYTEXT = (wchar_t *) malloc(yytextsz * sizeof (wchar_t)); memcpy(YYTEXT, yy_twbuf, sizeof (yy_twbuf)); yytext = (wchar_t *) malloc(yytextsz * sizeof (wchar_t)); memcpy(yytext, yy_tbuf, sizeof (yy_tbuf)); #else if (YYTEXT == yy_tbuf) { YYTEXT = (wchar_t *) malloc(yytextsz * sizeof (wchar_t)); memcpy(YYTEXT, yy_tbuf, sizeof (yy_tbuf)); #endif } else { YYTEXT = (wchar_t *) realloc(YYTEXT, yytextsz); #ifdef YYLEX_E /* -e */ yytext = (wchar_t *) realloc(yytext, yytextsz * sizeof (wchar_t)); #endif } if (!YYTEXT) { fprintf(yyout, "Cannot realloc YYTEXT\n"); exit(1); } yylastch = YYTEXT + x; } #endif yygid = yycgid(yych); yyfirst=0; tryagain: # ifdef LEXDEBUG if(debug){ fprintf(yyout,"wchar_t "); allprint(yych); fprintf(yyout," gid %d\n", yygid); } # endif yyr = yyt; if ( (uintptr_t)yyt > (uintptr_t)yycrank){ yyt = yyr + yygid; if (yyt <= yytop && yyt->verify+yysvec == yystate){ if(yyt->advance+yysvec == YYLERR) /* error transitions */ {YYUNPUT(*--yylastch);break;} *lsp++ = yystate = yyt->advance+yysvec; if(lsp > &yylstate[YYLMAX]) { fprintf(yyout,"Input string too long, limit %d\n",YYLMAX); exit(1); } goto contin; } } # ifdef YYOPTIM else if((uintptr_t)yyt < (uintptr_t)yycrank) { /* r < yycrank */ yyt = yyr = yycrank+(yycrank-yyt); # ifdef LEXDEBUG if(debug)fprintf(yyout,"compressed state\n"); # endif yyt = yyt + yygid; if(yyt <= yytop && yyt->verify+yysvec == yystate){ if(yyt->advance+yysvec == YYLERR) /* error transitions */ {YYUNPUT(*--yylastch);break;} *lsp++ = yystate = yyt->advance+yysvec; if(lsp > &yylstate[YYLMAX]) { fprintf(yyout,"Input string too long, limit %d\n",YYLMAX); exit(1); } goto contin; } yyt = yyr + YYU(yymatch[yygid]); # ifdef LEXDEBUG if(debug){ fprintf(yyout,"try fall back character "); allprint_w(YYU(yymatch[yygid])); fprintf(yyout," gid %d\n", yygid); } # endif if(yyt <= yytop && yyt->verify+yysvec == yystate){ if(yyt->advance+yysvec == YYLERR) /* error transition */ {YYUNPUT(*--yylastch);break;} *lsp++ = yystate = yyt->advance+yysvec; if(lsp > &yylstate[YYLMAX]) { fprintf(yyout,"Input string too long, limit %d\n",YYLMAX); exit(1); } goto contin; } } if ((yystate = yystate->yyother) && (yyt= yystate->yystoff) != yycrank){ # ifdef LEXDEBUG if(debug)fprintf(yyout,"fall back to state %d\n",yystate-yysvec-1); # endif goto tryagain; } # endif else {YYUNPUT(*--yylastch);break;} contin: # ifdef LEXDEBUG if(debug){ fprintf(yyout,"state %d wchar_t ",yystate-yysvec-1); allprint_w(yych); fprintf(yyout," gid %d\n", yygid); } # endif ; } # ifdef LEXDEBUG if(debug){ fprintf(yyout,"stopped at %d with ",*(lsp-1)-yysvec-1); allprint_w(yych); fprintf(yyout," gid %d\n", yygid); } # endif while (lsp-- > yylstate){ *yylastch-- = 0; if (*lsp != 0 && (yyfnd= (*lsp)->yystops) && *yyfnd > 0){ yyolsp = lsp; if(yyextra[*yyfnd]){ /* must backup */ while(yyback((*lsp)->yystops,-*yyfnd) != 1 && lsp > yylstate){ lsp--; YYUNPUT(*yylastch--); } } yyprevious = YYU(*yylastch); yylsp = lsp; YYLENG = yylastch-YYTEXT+1; YYTEXT[YYLENG] = 0; # ifdef LEXDEBUG if(debug){ fprintf(yyout,"\nmatch "); sprint_w(YYTEXT); fprintf(yyout," action %d\n",*yyfnd); } # endif #ifdef YYLEX_E /* -e */ yyleng=wcstombs((char *)yytext, YYTEXT, sizeof(yytext)-1); #ifdef LEXDEBUG if(yyleng>=sizeof(yytext)-1) fprintf(yyout, "yytext[] too short\n"); #endif #endif return(*yyfnd++); } YYUNPUT(*yylastch); } if (YYTEXT[0] == 0 /* && feof(yyin) */) { yysptr=yysbuf; return(0); } yyprevious = YYTEXT[0] = YYINPUT(); if (yyprevious>0) YYOUTPUT(yyprevious); yylastch=YYTEXT; # ifdef LEXDEBUG if(debug)putchar('\n'); # endif } } int yyback(int *p, int m) { if (p==0) return(0); while (*p) { if (*p++ == m) return(1); } return(0); } #ifdef YYLEX_E /* -e */ wchar_t yywinput(void) { unsigned char eucbuf[MB_LEN_MAX]; wchar_t wc; unsigned char *p=eucbuf; int n; #ifndef __cplusplus *p++=input(); n=euclen(eucbuf); while(--n>0) *p++=input(); #else *p++=lex_input(); n=euclen(eucbuf); while(--n>0) *p++=lex_input(); #endif *p=0; mbtowc( &wc, (char *)eucbuf, MB_LEN_MAX ); return wc; } void yywoutput(wchar_t wc) { unsigned char eucbuf[MB_LEN_MAX]; int n; unsigned char *p=eucbuf; n=wctomb( (char *)eucbuf, wc ); #ifndef __cplusplus while(n-->0) output(*p++); #else while(n-->0) lex_output(*p++); #endif } void yywunput(wchar_t wc) { unsigned char eucbuf[MB_LEN_MAX]; int n; unsigned char *p; n=wctomb( (char *)eucbuf, wc ); p=eucbuf+n; while(n-->0) unput(*--p); } #endif #ifdef LONG_WCHAR_T #define yylinearize(lc) lc #else/*!LONG_WCHAR_T*/ unsigned long yylinearize(wc) wchar_t wc; { unsigned long prefix; switch(wc&0x8080){ case 0x0000: prefix=0x00000000; break; case 0x0080: prefix=0x20000000; break; case 0x8000: prefix=0x40000000; break; case 0x8080: prefix=0x60000000; break; } return prefix|wc; } #endif/*!LONG_WCHAR_T*/ int yycgid(wchar_t c) { int first = 0; int last = YYNCGIDTBL - 1; unsigned long lc=yylinearize(c); if( yycgidtbl[YYNCGIDTBL-1] < lc ) return YYNCGIDTBL*2-1; while (last >= 0) { int i = (first+last)/2; if (lc == yycgidtbl[i]) return (2*i); else if ( yycgidtbl[i]