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 1993 Sun Microsystems, Inc. All rights reserved. 247c478bd9Sstevel@tonic-gate * Use is subject to license terms. 257c478bd9Sstevel@tonic-gate */ 267c478bd9Sstevel@tonic-gate 277c478bd9Sstevel@tonic-gate/* Copyright (c) 1988 AT&T */ 287c478bd9Sstevel@tonic-gate/* All Rights Reserved */ 297c478bd9Sstevel@tonic-gate 307c478bd9Sstevel@tonic-gate/* 317c478bd9Sstevel@tonic-gate** Skeleton parser driver for yacc output 327c478bd9Sstevel@tonic-gate*/ 337c478bd9Sstevel@tonic-gate 347c478bd9Sstevel@tonic-gate/* 357c478bd9Sstevel@tonic-gate** yacc user known macros and defines 367c478bd9Sstevel@tonic-gate*/ 377c478bd9Sstevel@tonic-gate#define YYERROR goto yyerrlab 387c478bd9Sstevel@tonic-gate#define YYACCEPT return(0) 397c478bd9Sstevel@tonic-gate#define YYABORT return(1) 407c478bd9Sstevel@tonic-gate#define YYBACKUP( newtoken, newvalue )\ 417c478bd9Sstevel@tonic-gate{\ 427c478bd9Sstevel@tonic-gate if ( yychar >= 0 || ( yyr2[ yytmp ] >> 1 ) != 1 )\ 437c478bd9Sstevel@tonic-gate {\ 44*1a90c98dSToomas Soome (void) yyerror( "syntax error - cannot backup" );\ 457c478bd9Sstevel@tonic-gate goto yyerrlab;\ 467c478bd9Sstevel@tonic-gate }\ 477c478bd9Sstevel@tonic-gate yychar = newtoken;\ 487c478bd9Sstevel@tonic-gate yystate = *yyps;\ 497c478bd9Sstevel@tonic-gate yylval = newvalue;\ 507c478bd9Sstevel@tonic-gate goto yynewstate;\ 517c478bd9Sstevel@tonic-gate} 527c478bd9Sstevel@tonic-gate#define YYRECOVERING() (!!yyerrflag) 537c478bd9Sstevel@tonic-gate#define YYNEW(type) malloc(sizeof(type) * yynewmax) 547c478bd9Sstevel@tonic-gate#define YYCOPY(to, from, type) \ 557c478bd9Sstevel@tonic-gate (type *) memcpy(to, (char *) from, yymaxdepth * sizeof (type)) 567c478bd9Sstevel@tonic-gate#define YYENLARGE( from, type) \ 577c478bd9Sstevel@tonic-gate (type *) realloc((char *) from, yynewmax * sizeof(type)) 587c478bd9Sstevel@tonic-gate#ifndef YYDEBUG 597c478bd9Sstevel@tonic-gate# define YYDEBUG 1 /* make debugging available */ 607c478bd9Sstevel@tonic-gate#endif 617c478bd9Sstevel@tonic-gate 627c478bd9Sstevel@tonic-gate/* 637c478bd9Sstevel@tonic-gate** user known globals 647c478bd9Sstevel@tonic-gate*/ 657c478bd9Sstevel@tonic-gateint yydebug; /* set to 1 to get debugging */ 667c478bd9Sstevel@tonic-gate 677c478bd9Sstevel@tonic-gate/* 687c478bd9Sstevel@tonic-gate** driver internal defines 697c478bd9Sstevel@tonic-gate*/ 707c478bd9Sstevel@tonic-gate#define YYFLAG (-10000000) 717c478bd9Sstevel@tonic-gate 727c478bd9Sstevel@tonic-gate/* 737c478bd9Sstevel@tonic-gate** global variables used by the parser 747c478bd9Sstevel@tonic-gate*/ 757c478bd9Sstevel@tonic-gateYYSTYPE *yypv; /* top of value stack */ 767c478bd9Sstevel@tonic-gateint *yyps; /* top of state stack */ 777c478bd9Sstevel@tonic-gate 787c478bd9Sstevel@tonic-gateint yystate; /* current state */ 797c478bd9Sstevel@tonic-gateint yytmp; /* extra var (lasts between blocks) */ 807c478bd9Sstevel@tonic-gate 817c478bd9Sstevel@tonic-gateint yynerrs; /* number of errors */ 827c478bd9Sstevel@tonic-gateint yyerrflag; /* error recovery flag */ 837c478bd9Sstevel@tonic-gateint yychar; /* current input token number */ 847c478bd9Sstevel@tonic-gate 857c478bd9Sstevel@tonic-gate 867c478bd9Sstevel@tonic-gate 877c478bd9Sstevel@tonic-gate#ifdef YYNMBCHARS 887c478bd9Sstevel@tonic-gate#define YYLEX() yycvtok(yylex()) 897c478bd9Sstevel@tonic-gate/* 907c478bd9Sstevel@tonic-gate** yycvtok - return a token if i is a wchar_t value that exceeds 255. 917c478bd9Sstevel@tonic-gate** If i<255, i itself is the token. If i>255 but the neither 927c478bd9Sstevel@tonic-gate** of the 30th or 31st bit is on, i is already a token. 937c478bd9Sstevel@tonic-gate*/ 94*1a90c98dSToomas Soomeint 95*1a90c98dSToomas Soomeyycvtok(int i) 967c478bd9Sstevel@tonic-gate{ 977c478bd9Sstevel@tonic-gate int first = 0; 987c478bd9Sstevel@tonic-gate int last = YYNMBCHARS - 1; 997c478bd9Sstevel@tonic-gate int mid; 1007c478bd9Sstevel@tonic-gate wchar_t j; 1017c478bd9Sstevel@tonic-gate 1027c478bd9Sstevel@tonic-gate if(i&0x60000000){/*Must convert to a token. */ 1037c478bd9Sstevel@tonic-gate if( yymbchars[last].character < i ){ 1047c478bd9Sstevel@tonic-gate return i;/*Giving up*/ 1057c478bd9Sstevel@tonic-gate } 1067c478bd9Sstevel@tonic-gate while ((last>=first)&&(first>=0)) {/*Binary search loop*/ 1077c478bd9Sstevel@tonic-gate mid = (first+last)/2; 1087c478bd9Sstevel@tonic-gate j = yymbchars[mid].character; 1097c478bd9Sstevel@tonic-gate if( j==i ){/*Found*/ 1107c478bd9Sstevel@tonic-gate return yymbchars[mid].tvalue; 1117c478bd9Sstevel@tonic-gate }else if( j<i ){ 1127c478bd9Sstevel@tonic-gate first = mid + 1; 1137c478bd9Sstevel@tonic-gate }else{ 1147c478bd9Sstevel@tonic-gate last = mid -1; 1157c478bd9Sstevel@tonic-gate } 1167c478bd9Sstevel@tonic-gate } 1177c478bd9Sstevel@tonic-gate /*No entry in the table.*/ 1187c478bd9Sstevel@tonic-gate return i;/* Giving up.*/ 1197c478bd9Sstevel@tonic-gate }else{/* i is already a token. */ 1207c478bd9Sstevel@tonic-gate return i; 1217c478bd9Sstevel@tonic-gate } 1227c478bd9Sstevel@tonic-gate} 1237c478bd9Sstevel@tonic-gate#else/*!YYNMBCHARS*/ 1247c478bd9Sstevel@tonic-gate#define YYLEX() yylex() 1257c478bd9Sstevel@tonic-gate#endif/*!YYNMBCHARS*/ 1267c478bd9Sstevel@tonic-gate 1277c478bd9Sstevel@tonic-gate/* 1287c478bd9Sstevel@tonic-gate** yyparse - return 0 if worked, 1 if syntax error not recovered from 1297c478bd9Sstevel@tonic-gate*/ 130*1a90c98dSToomas Soomeint 131*1a90c98dSToomas Soomeyyparse(void) 1327c478bd9Sstevel@tonic-gate{ 133a97db1b7SToomas Soome YYSTYPE *yypvt = 0; /* top of value stack for $vars */ 1347c478bd9Sstevel@tonic-gate 1357c478bd9Sstevel@tonic-gate#if defined(__cplusplus) || defined(lint) 1367c478bd9Sstevel@tonic-gate/* 1377c478bd9Sstevel@tonic-gate hacks to please C++ and lint - goto's inside 1387c478bd9Sstevel@tonic-gate switch should never be executed 1397c478bd9Sstevel@tonic-gate*/ 1407c478bd9Sstevel@tonic-gate static int __yaccpar_lint_hack__ = 0; 1417c478bd9Sstevel@tonic-gate switch (__yaccpar_lint_hack__) 1427c478bd9Sstevel@tonic-gate { 1437c478bd9Sstevel@tonic-gate case 1: goto yyerrlab; 1447c478bd9Sstevel@tonic-gate case 2: goto yynewstate; 1457c478bd9Sstevel@tonic-gate } 1467c478bd9Sstevel@tonic-gate#endif 1477c478bd9Sstevel@tonic-gate 1487c478bd9Sstevel@tonic-gate /* 1497c478bd9Sstevel@tonic-gate ** Initialize externals - yyparse may be called more than once 1507c478bd9Sstevel@tonic-gate */ 1517c478bd9Sstevel@tonic-gate yypv = &yyv[-1]; 1527c478bd9Sstevel@tonic-gate yyps = &yys[-1]; 1537c478bd9Sstevel@tonic-gate yystate = 0; 1547c478bd9Sstevel@tonic-gate yytmp = 0; 1557c478bd9Sstevel@tonic-gate yynerrs = 0; 1567c478bd9Sstevel@tonic-gate yyerrflag = 0; 1577c478bd9Sstevel@tonic-gate yychar = -1; 1587c478bd9Sstevel@tonic-gate 1597c478bd9Sstevel@tonic-gate#if YYMAXDEPTH <= 0 1607c478bd9Sstevel@tonic-gate if (yymaxdepth <= 0) 1617c478bd9Sstevel@tonic-gate { 1627c478bd9Sstevel@tonic-gate if ((yymaxdepth = YYEXPAND(0)) <= 0) 1637c478bd9Sstevel@tonic-gate { 164*1a90c98dSToomas Soome (void) yyerror("yacc initialization error"); 1657c478bd9Sstevel@tonic-gate YYABORT; 1667c478bd9Sstevel@tonic-gate } 1677c478bd9Sstevel@tonic-gate } 1687c478bd9Sstevel@tonic-gate#endif 1697c478bd9Sstevel@tonic-gate 1707c478bd9Sstevel@tonic-gate { 171a97db1b7SToomas Soome YYSTYPE *yy_pv; /* top of value stack */ 172a97db1b7SToomas Soome int *yy_ps; /* top of state stack */ 173a97db1b7SToomas Soome int yy_state; /* current state */ 174a97db1b7SToomas Soome int yy_n; /* internal state number info */ 1757c478bd9Sstevel@tonic-gate goto yystack; /* moved from 6 lines above to here to please C++ */ 1767c478bd9Sstevel@tonic-gate 1777c478bd9Sstevel@tonic-gate /* 1787c478bd9Sstevel@tonic-gate ** get globals into registers. 1797c478bd9Sstevel@tonic-gate ** branch to here only if YYBACKUP was called. 1807c478bd9Sstevel@tonic-gate */ 1817c478bd9Sstevel@tonic-gate yynewstate: 1827c478bd9Sstevel@tonic-gate yy_pv = yypv; 1837c478bd9Sstevel@tonic-gate yy_ps = yyps; 1847c478bd9Sstevel@tonic-gate yy_state = yystate; 1857c478bd9Sstevel@tonic-gate goto yy_newstate; 1867c478bd9Sstevel@tonic-gate 1877c478bd9Sstevel@tonic-gate /* 1887c478bd9Sstevel@tonic-gate ** get globals into registers. 1897c478bd9Sstevel@tonic-gate ** either we just started, or we just finished a reduction 1907c478bd9Sstevel@tonic-gate */ 1917c478bd9Sstevel@tonic-gate yystack: 1927c478bd9Sstevel@tonic-gate yy_pv = yypv; 1937c478bd9Sstevel@tonic-gate yy_ps = yyps; 1947c478bd9Sstevel@tonic-gate yy_state = yystate; 1957c478bd9Sstevel@tonic-gate 1967c478bd9Sstevel@tonic-gate /* 1977c478bd9Sstevel@tonic-gate ** top of for (;;) loop while no reductions done 1987c478bd9Sstevel@tonic-gate */ 1997c478bd9Sstevel@tonic-gate yy_stack: 2007c478bd9Sstevel@tonic-gate /* 2017c478bd9Sstevel@tonic-gate ** put a state and value onto the stacks 2027c478bd9Sstevel@tonic-gate */ 2037c478bd9Sstevel@tonic-gate#if YYDEBUG 2047c478bd9Sstevel@tonic-gate /* 2057c478bd9Sstevel@tonic-gate ** if debugging, look up token value in list of value vs. 2067c478bd9Sstevel@tonic-gate ** name pairs. 0 and negative (-1) are special values. 2077c478bd9Sstevel@tonic-gate ** Note: linear search is used since time is not a real 2087c478bd9Sstevel@tonic-gate ** consideration while debugging. 2097c478bd9Sstevel@tonic-gate */ 2107c478bd9Sstevel@tonic-gate if ( yydebug ) 2117c478bd9Sstevel@tonic-gate { 212a97db1b7SToomas Soome int yy_i; 2137c478bd9Sstevel@tonic-gate 2147c478bd9Sstevel@tonic-gate printf( "State %d, token ", yy_state ); 2157c478bd9Sstevel@tonic-gate if ( yychar == 0 ) 2167c478bd9Sstevel@tonic-gate printf( "end-of-file\n" ); 2177c478bd9Sstevel@tonic-gate else if ( yychar < 0 ) 2187c478bd9Sstevel@tonic-gate printf( "-none-\n" ); 2197c478bd9Sstevel@tonic-gate else 2207c478bd9Sstevel@tonic-gate { 2217c478bd9Sstevel@tonic-gate for ( yy_i = 0; yytoks[yy_i].t_val >= 0; 2227c478bd9Sstevel@tonic-gate yy_i++ ) 2237c478bd9Sstevel@tonic-gate { 2247c478bd9Sstevel@tonic-gate if ( yytoks[yy_i].t_val == yychar ) 2257c478bd9Sstevel@tonic-gate break; 2267c478bd9Sstevel@tonic-gate } 2277c478bd9Sstevel@tonic-gate printf( "%s\n", yytoks[yy_i].t_name ); 2287c478bd9Sstevel@tonic-gate } 2297c478bd9Sstevel@tonic-gate } 2307c478bd9Sstevel@tonic-gate#endif /* YYDEBUG */ 2317c478bd9Sstevel@tonic-gate if ( ++yy_ps >= &yys[ yymaxdepth ] ) /* room on stack? */ 2327c478bd9Sstevel@tonic-gate { 2337c478bd9Sstevel@tonic-gate /* 2347c478bd9Sstevel@tonic-gate ** reallocate and recover. Note that pointers 2357c478bd9Sstevel@tonic-gate ** have to be reset, or bad things will happen 2367c478bd9Sstevel@tonic-gate */ 2377c478bd9Sstevel@tonic-gate long yyps_index = (yy_ps - yys); 2387c478bd9Sstevel@tonic-gate long yypv_index = (yy_pv - yyv); 2397c478bd9Sstevel@tonic-gate long yypvt_index = (yypvt - yyv); 2407c478bd9Sstevel@tonic-gate int yynewmax; 2417c478bd9Sstevel@tonic-gate#ifdef YYEXPAND 2427c478bd9Sstevel@tonic-gate yynewmax = YYEXPAND(yymaxdepth); 2437c478bd9Sstevel@tonic-gate#else 2447c478bd9Sstevel@tonic-gate yynewmax = 2 * yymaxdepth; /* double table size */ 2457c478bd9Sstevel@tonic-gate if (yymaxdepth == YYMAXDEPTH) /* first time growth */ 2467c478bd9Sstevel@tonic-gate { 2477c478bd9Sstevel@tonic-gate char *newyys = (char *)YYNEW(int); 2487c478bd9Sstevel@tonic-gate char *newyyv = (char *)YYNEW(YYSTYPE); 2497c478bd9Sstevel@tonic-gate if (newyys != 0 && newyyv != 0) 2507c478bd9Sstevel@tonic-gate { 2517c478bd9Sstevel@tonic-gate yys = YYCOPY(newyys, yys, int); 2527c478bd9Sstevel@tonic-gate yyv = YYCOPY(newyyv, yyv, YYSTYPE); 2537c478bd9Sstevel@tonic-gate } 2547c478bd9Sstevel@tonic-gate else 2557c478bd9Sstevel@tonic-gate yynewmax = 0; /* failed */ 2567c478bd9Sstevel@tonic-gate } 2577c478bd9Sstevel@tonic-gate else /* not first time */ 2587c478bd9Sstevel@tonic-gate { 2597c478bd9Sstevel@tonic-gate yys = YYENLARGE(yys, int); 2607c478bd9Sstevel@tonic-gate yyv = YYENLARGE(yyv, YYSTYPE); 2617c478bd9Sstevel@tonic-gate if (yys == 0 || yyv == 0) 2627c478bd9Sstevel@tonic-gate yynewmax = 0; /* failed */ 2637c478bd9Sstevel@tonic-gate } 2647c478bd9Sstevel@tonic-gate#endif 2657c478bd9Sstevel@tonic-gate if (yynewmax <= yymaxdepth) /* tables not expanded */ 2667c478bd9Sstevel@tonic-gate { 267*1a90c98dSToomas Soome (void) yyerror( "yacc stack overflow" ); 2687c478bd9Sstevel@tonic-gate YYABORT; 2697c478bd9Sstevel@tonic-gate } 2707c478bd9Sstevel@tonic-gate yymaxdepth = yynewmax; 2717c478bd9Sstevel@tonic-gate 2727c478bd9Sstevel@tonic-gate yy_ps = yys + yyps_index; 2737c478bd9Sstevel@tonic-gate yy_pv = yyv + yypv_index; 2747c478bd9Sstevel@tonic-gate yypvt = yyv + yypvt_index; 2757c478bd9Sstevel@tonic-gate } 2767c478bd9Sstevel@tonic-gate *yy_ps = yy_state; 2777c478bd9Sstevel@tonic-gate *++yy_pv = yyval; 2787c478bd9Sstevel@tonic-gate 2797c478bd9Sstevel@tonic-gate /* 2807c478bd9Sstevel@tonic-gate ** we have a new state - find out what to do 2817c478bd9Sstevel@tonic-gate */ 2827c478bd9Sstevel@tonic-gate yy_newstate: 2837c478bd9Sstevel@tonic-gate if ( ( yy_n = yypact[ yy_state ] ) <= YYFLAG ) 2847c478bd9Sstevel@tonic-gate goto yydefault; /* simple state */ 2857c478bd9Sstevel@tonic-gate#if YYDEBUG 2867c478bd9Sstevel@tonic-gate /* 2877c478bd9Sstevel@tonic-gate ** if debugging, need to mark whether new token grabbed 2887c478bd9Sstevel@tonic-gate */ 2897c478bd9Sstevel@tonic-gate yytmp = yychar < 0; 2907c478bd9Sstevel@tonic-gate#endif 2917c478bd9Sstevel@tonic-gate if ( ( yychar < 0 ) && ( ( yychar = YYLEX() ) < 0 ) ) 2927c478bd9Sstevel@tonic-gate yychar = 0; /* reached EOF */ 2937c478bd9Sstevel@tonic-gate#if YYDEBUG 2947c478bd9Sstevel@tonic-gate if ( yydebug && yytmp ) 2957c478bd9Sstevel@tonic-gate { 296a97db1b7SToomas Soome int yy_i; 2977c478bd9Sstevel@tonic-gate 2987c478bd9Sstevel@tonic-gate printf( "Received token " ); 2997c478bd9Sstevel@tonic-gate if ( yychar == 0 ) 3007c478bd9Sstevel@tonic-gate printf( "end-of-file\n" ); 3017c478bd9Sstevel@tonic-gate else if ( yychar < 0 ) 3027c478bd9Sstevel@tonic-gate printf( "-none-\n" ); 3037c478bd9Sstevel@tonic-gate else 3047c478bd9Sstevel@tonic-gate { 3057c478bd9Sstevel@tonic-gate for ( yy_i = 0; yytoks[yy_i].t_val >= 0; 3067c478bd9Sstevel@tonic-gate yy_i++ ) 3077c478bd9Sstevel@tonic-gate { 3087c478bd9Sstevel@tonic-gate if ( yytoks[yy_i].t_val == yychar ) 3097c478bd9Sstevel@tonic-gate break; 3107c478bd9Sstevel@tonic-gate } 3117c478bd9Sstevel@tonic-gate printf( "%s\n", yytoks[yy_i].t_name ); 3127c478bd9Sstevel@tonic-gate } 3137c478bd9Sstevel@tonic-gate } 3147c478bd9Sstevel@tonic-gate#endif /* YYDEBUG */ 3157c478bd9Sstevel@tonic-gate if ( ( ( yy_n += yychar ) < 0 ) || ( yy_n >= YYLAST ) ) 3167c478bd9Sstevel@tonic-gate goto yydefault; 3177c478bd9Sstevel@tonic-gate if ( yychk[ yy_n = yyact[ yy_n ] ] == yychar ) /*valid shift*/ 3187c478bd9Sstevel@tonic-gate { 3197c478bd9Sstevel@tonic-gate yychar = -1; 3207c478bd9Sstevel@tonic-gate yyval = yylval; 3217c478bd9Sstevel@tonic-gate yy_state = yy_n; 3227c478bd9Sstevel@tonic-gate if ( yyerrflag > 0 ) 3237c478bd9Sstevel@tonic-gate yyerrflag--; 3247c478bd9Sstevel@tonic-gate goto yy_stack; 3257c478bd9Sstevel@tonic-gate } 3267c478bd9Sstevel@tonic-gate 3277c478bd9Sstevel@tonic-gate yydefault: 3287c478bd9Sstevel@tonic-gate if ( ( yy_n = yydef[ yy_state ] ) == -2 ) 3297c478bd9Sstevel@tonic-gate { 3307c478bd9Sstevel@tonic-gate#if YYDEBUG 3317c478bd9Sstevel@tonic-gate yytmp = yychar < 0; 3327c478bd9Sstevel@tonic-gate#endif 3337c478bd9Sstevel@tonic-gate if ( ( yychar < 0 ) && ( ( yychar = YYLEX() ) < 0 ) ) 3347c478bd9Sstevel@tonic-gate yychar = 0; /* reached EOF */ 3357c478bd9Sstevel@tonic-gate#if YYDEBUG 3367c478bd9Sstevel@tonic-gate if ( yydebug && yytmp ) 3377c478bd9Sstevel@tonic-gate { 338a97db1b7SToomas Soome int yy_i; 3397c478bd9Sstevel@tonic-gate 3407c478bd9Sstevel@tonic-gate printf( "Received token " ); 3417c478bd9Sstevel@tonic-gate if ( yychar == 0 ) 3427c478bd9Sstevel@tonic-gate printf( "end-of-file\n" ); 3437c478bd9Sstevel@tonic-gate else if ( yychar < 0 ) 3447c478bd9Sstevel@tonic-gate printf( "-none-\n" ); 3457c478bd9Sstevel@tonic-gate else 3467c478bd9Sstevel@tonic-gate { 3477c478bd9Sstevel@tonic-gate for ( yy_i = 0; 3487c478bd9Sstevel@tonic-gate yytoks[yy_i].t_val >= 0; 3497c478bd9Sstevel@tonic-gate yy_i++ ) 3507c478bd9Sstevel@tonic-gate { 3517c478bd9Sstevel@tonic-gate if ( yytoks[yy_i].t_val 3527c478bd9Sstevel@tonic-gate == yychar ) 3537c478bd9Sstevel@tonic-gate { 3547c478bd9Sstevel@tonic-gate break; 3557c478bd9Sstevel@tonic-gate } 3567c478bd9Sstevel@tonic-gate } 3577c478bd9Sstevel@tonic-gate printf( "%s\n", yytoks[yy_i].t_name ); 3587c478bd9Sstevel@tonic-gate } 3597c478bd9Sstevel@tonic-gate } 3607c478bd9Sstevel@tonic-gate#endif /* YYDEBUG */ 3617c478bd9Sstevel@tonic-gate /* 3627c478bd9Sstevel@tonic-gate ** look through exception table 3637c478bd9Sstevel@tonic-gate */ 3647c478bd9Sstevel@tonic-gate { 365*1a90c98dSToomas Soome const int *yyxi = yyexca; 3667c478bd9Sstevel@tonic-gate 3677c478bd9Sstevel@tonic-gate while ( ( *yyxi != -1 ) || 3687c478bd9Sstevel@tonic-gate ( yyxi[1] != yy_state ) ) 3697c478bd9Sstevel@tonic-gate { 3707c478bd9Sstevel@tonic-gate yyxi += 2; 3717c478bd9Sstevel@tonic-gate } 3727c478bd9Sstevel@tonic-gate while ( ( *(yyxi += 2) >= 0 ) && 3737c478bd9Sstevel@tonic-gate ( *yyxi != yychar ) ) 3747c478bd9Sstevel@tonic-gate ; 3757c478bd9Sstevel@tonic-gate if ( ( yy_n = yyxi[1] ) < 0 ) 3767c478bd9Sstevel@tonic-gate YYACCEPT; 3777c478bd9Sstevel@tonic-gate } 3787c478bd9Sstevel@tonic-gate } 3797c478bd9Sstevel@tonic-gate 3807c478bd9Sstevel@tonic-gate /* 3817c478bd9Sstevel@tonic-gate ** check for syntax error 3827c478bd9Sstevel@tonic-gate */ 3837c478bd9Sstevel@tonic-gate if ( yy_n == 0 ) /* have an error */ 3847c478bd9Sstevel@tonic-gate { 3857c478bd9Sstevel@tonic-gate /* no worry about speed here! */ 3867c478bd9Sstevel@tonic-gate switch ( yyerrflag ) 3877c478bd9Sstevel@tonic-gate { 3887c478bd9Sstevel@tonic-gate case 0: /* new error */ 389*1a90c98dSToomas Soome (void) yyerror( "syntax error" ); 3907c478bd9Sstevel@tonic-gate goto skip_init; 3917c478bd9Sstevel@tonic-gate yyerrlab: 3927c478bd9Sstevel@tonic-gate /* 3937c478bd9Sstevel@tonic-gate ** get globals into registers. 3947c478bd9Sstevel@tonic-gate ** we have a user generated syntax type error 3957c478bd9Sstevel@tonic-gate */ 3967c478bd9Sstevel@tonic-gate yy_pv = yypv; 3977c478bd9Sstevel@tonic-gate yy_ps = yyps; 3987c478bd9Sstevel@tonic-gate yy_state = yystate; 3997c478bd9Sstevel@tonic-gate skip_init: 4007c478bd9Sstevel@tonic-gate yynerrs++; 4017c478bd9Sstevel@tonic-gate /* FALLTHRU */ 4027c478bd9Sstevel@tonic-gate case 1: 4037c478bd9Sstevel@tonic-gate case 2: /* incompletely recovered error */ 4047c478bd9Sstevel@tonic-gate /* try again... */ 4057c478bd9Sstevel@tonic-gate yyerrflag = 3; 4067c478bd9Sstevel@tonic-gate /* 4077c478bd9Sstevel@tonic-gate ** find state where "error" is a legal 4087c478bd9Sstevel@tonic-gate ** shift action 4097c478bd9Sstevel@tonic-gate */ 4107c478bd9Sstevel@tonic-gate while ( yy_ps >= yys ) 4117c478bd9Sstevel@tonic-gate { 4127c478bd9Sstevel@tonic-gate yy_n = yypact[ *yy_ps ] + YYERRCODE; 4137c478bd9Sstevel@tonic-gate if ( yy_n >= 0 && yy_n < YYLAST && 4147c478bd9Sstevel@tonic-gate yychk[yyact[yy_n]] == YYERRCODE) { 4157c478bd9Sstevel@tonic-gate /* 4167c478bd9Sstevel@tonic-gate ** simulate shift of "error" 4177c478bd9Sstevel@tonic-gate */ 4187c478bd9Sstevel@tonic-gate yy_state = yyact[ yy_n ]; 4197c478bd9Sstevel@tonic-gate goto yy_stack; 4207c478bd9Sstevel@tonic-gate } 4217c478bd9Sstevel@tonic-gate /* 4227c478bd9Sstevel@tonic-gate ** current state has no shift on 4237c478bd9Sstevel@tonic-gate ** "error", pop stack 4247c478bd9Sstevel@tonic-gate */ 4257c478bd9Sstevel@tonic-gate#if YYDEBUG 4267c478bd9Sstevel@tonic-gate# define _POP_ "Error recovery pops state %d, uncovers state %d\n" 4277c478bd9Sstevel@tonic-gate if ( yydebug ) 4287c478bd9Sstevel@tonic-gate printf( _POP_, *yy_ps, 4297c478bd9Sstevel@tonic-gate yy_ps[-1] ); 4307c478bd9Sstevel@tonic-gate# undef _POP_ 4317c478bd9Sstevel@tonic-gate#endif 4327c478bd9Sstevel@tonic-gate yy_ps--; 4337c478bd9Sstevel@tonic-gate yy_pv--; 4347c478bd9Sstevel@tonic-gate } 4357c478bd9Sstevel@tonic-gate /* 4367c478bd9Sstevel@tonic-gate ** there is no state on stack with "error" as 4377c478bd9Sstevel@tonic-gate ** a valid shift. give up. 4387c478bd9Sstevel@tonic-gate */ 4397c478bd9Sstevel@tonic-gate YYABORT; 4407c478bd9Sstevel@tonic-gate case 3: /* no shift yet; eat a token */ 4417c478bd9Sstevel@tonic-gate#if YYDEBUG 4427c478bd9Sstevel@tonic-gate /* 4437c478bd9Sstevel@tonic-gate ** if debugging, look up token in list of 4447c478bd9Sstevel@tonic-gate ** pairs. 0 and negative shouldn't occur, 4457c478bd9Sstevel@tonic-gate ** but since timing doesn't matter when 4467c478bd9Sstevel@tonic-gate ** debugging, it doesn't hurt to leave the 4477c478bd9Sstevel@tonic-gate ** tests here. 4487c478bd9Sstevel@tonic-gate */ 4497c478bd9Sstevel@tonic-gate if ( yydebug ) 4507c478bd9Sstevel@tonic-gate { 451a97db1b7SToomas Soome int yy_i; 4527c478bd9Sstevel@tonic-gate 4537c478bd9Sstevel@tonic-gate printf( "Error recovery discards " ); 4547c478bd9Sstevel@tonic-gate if ( yychar == 0 ) 4557c478bd9Sstevel@tonic-gate printf( "token end-of-file\n" ); 4567c478bd9Sstevel@tonic-gate else if ( yychar < 0 ) 4577c478bd9Sstevel@tonic-gate printf( "token -none-\n" ); 4587c478bd9Sstevel@tonic-gate else 4597c478bd9Sstevel@tonic-gate { 4607c478bd9Sstevel@tonic-gate for ( yy_i = 0; 4617c478bd9Sstevel@tonic-gate yytoks[yy_i].t_val >= 0; 4627c478bd9Sstevel@tonic-gate yy_i++ ) 4637c478bd9Sstevel@tonic-gate { 4647c478bd9Sstevel@tonic-gate if ( yytoks[yy_i].t_val 4657c478bd9Sstevel@tonic-gate == yychar ) 4667c478bd9Sstevel@tonic-gate { 4677c478bd9Sstevel@tonic-gate break; 4687c478bd9Sstevel@tonic-gate } 4697c478bd9Sstevel@tonic-gate } 4707c478bd9Sstevel@tonic-gate printf( "token %s\n", 4717c478bd9Sstevel@tonic-gate yytoks[yy_i].t_name ); 4727c478bd9Sstevel@tonic-gate } 4737c478bd9Sstevel@tonic-gate } 4747c478bd9Sstevel@tonic-gate#endif /* YYDEBUG */ 4757c478bd9Sstevel@tonic-gate if ( yychar == 0 ) /* reached EOF. quit */ 4767c478bd9Sstevel@tonic-gate YYABORT; 4777c478bd9Sstevel@tonic-gate yychar = -1; 4787c478bd9Sstevel@tonic-gate goto yy_newstate; 4797c478bd9Sstevel@tonic-gate } 4807c478bd9Sstevel@tonic-gate }/* end if ( yy_n == 0 ) */ 4817c478bd9Sstevel@tonic-gate /* 4827c478bd9Sstevel@tonic-gate ** reduction by production yy_n 4837c478bd9Sstevel@tonic-gate ** put stack tops, etc. so things right after switch 4847c478bd9Sstevel@tonic-gate */ 4857c478bd9Sstevel@tonic-gate#if YYDEBUG 4867c478bd9Sstevel@tonic-gate /* 4877c478bd9Sstevel@tonic-gate ** if debugging, print the string that is the user's 4887c478bd9Sstevel@tonic-gate ** specification of the reduction which is just about 4897c478bd9Sstevel@tonic-gate ** to be done. 4907c478bd9Sstevel@tonic-gate */ 4917c478bd9Sstevel@tonic-gate if ( yydebug ) 4927c478bd9Sstevel@tonic-gate printf( "Reduce by (%d) \"%s\"\n", 4937c478bd9Sstevel@tonic-gate yy_n, yyreds[ yy_n ] ); 4947c478bd9Sstevel@tonic-gate#endif 4957c478bd9Sstevel@tonic-gate yytmp = yy_n; /* value to switch over */ 4967c478bd9Sstevel@tonic-gate yypvt = yy_pv; /* $vars top of value stack */ 4977c478bd9Sstevel@tonic-gate /* 4987c478bd9Sstevel@tonic-gate ** Look in goto table for next state 4997c478bd9Sstevel@tonic-gate ** Sorry about using yy_state here as temporary 5007c478bd9Sstevel@tonic-gate ** register variable, but why not, if it works... 5017c478bd9Sstevel@tonic-gate ** If yyr2[ yy_n ] doesn't have the low order bit 5027c478bd9Sstevel@tonic-gate ** set, then there is no action to be done for 5037c478bd9Sstevel@tonic-gate ** this reduction. So, no saving & unsaving of 5047c478bd9Sstevel@tonic-gate ** registers done. The only difference between the 5057c478bd9Sstevel@tonic-gate ** code just after the if and the body of the if is 5067c478bd9Sstevel@tonic-gate ** the goto yy_stack in the body. This way the test 5077c478bd9Sstevel@tonic-gate ** can be made before the choice of what to do is needed. 5087c478bd9Sstevel@tonic-gate */ 5097c478bd9Sstevel@tonic-gate { 5107c478bd9Sstevel@tonic-gate /* length of production doubled with extra bit */ 511a97db1b7SToomas Soome int yy_len = yyr2[ yy_n ]; 5127c478bd9Sstevel@tonic-gate 5137c478bd9Sstevel@tonic-gate if ( !( yy_len & 01 ) ) 5147c478bd9Sstevel@tonic-gate { 5157c478bd9Sstevel@tonic-gate yy_len >>= 1; 5167c478bd9Sstevel@tonic-gate yyval = ( yy_pv -= yy_len )[1]; /* $$ = $1 */ 5177c478bd9Sstevel@tonic-gate yy_state = yypgo[ yy_n = yyr1[ yy_n ] ] + 5187c478bd9Sstevel@tonic-gate *( yy_ps -= yy_len ) + 1; 5197c478bd9Sstevel@tonic-gate if ( yy_state >= YYLAST || 5207c478bd9Sstevel@tonic-gate yychk[ yy_state = 5217c478bd9Sstevel@tonic-gate yyact[ yy_state ] ] != -yy_n ) 5227c478bd9Sstevel@tonic-gate { 5237c478bd9Sstevel@tonic-gate yy_state = yyact[ yypgo[ yy_n ] ]; 5247c478bd9Sstevel@tonic-gate } 5257c478bd9Sstevel@tonic-gate goto yy_stack; 5267c478bd9Sstevel@tonic-gate } 5277c478bd9Sstevel@tonic-gate yy_len >>= 1; 5287c478bd9Sstevel@tonic-gate yyval = ( yy_pv -= yy_len )[1]; /* $$ = $1 */ 5297c478bd9Sstevel@tonic-gate yy_state = yypgo[ yy_n = yyr1[ yy_n ] ] + 5307c478bd9Sstevel@tonic-gate *( yy_ps -= yy_len ) + 1; 5317c478bd9Sstevel@tonic-gate if ( yy_state >= YYLAST || 5327c478bd9Sstevel@tonic-gate yychk[ yy_state = yyact[ yy_state ] ] != -yy_n ) 5337c478bd9Sstevel@tonic-gate { 5347c478bd9Sstevel@tonic-gate yy_state = yyact[ yypgo[ yy_n ] ]; 5357c478bd9Sstevel@tonic-gate } 5367c478bd9Sstevel@tonic-gate } 5377c478bd9Sstevel@tonic-gate /* save until reenter driver code */ 5387c478bd9Sstevel@tonic-gate yystate = yy_state; 5397c478bd9Sstevel@tonic-gate yyps = yy_ps; 5407c478bd9Sstevel@tonic-gate yypv = yy_pv; 5417c478bd9Sstevel@tonic-gate } 5427c478bd9Sstevel@tonic-gate /* 5437c478bd9Sstevel@tonic-gate ** code supplied by user is placed in this switch 5447c478bd9Sstevel@tonic-gate */ 5457c478bd9Sstevel@tonic-gate switch( yytmp ) 5467c478bd9Sstevel@tonic-gate { 5477c478bd9Sstevel@tonic-gate $A 5487c478bd9Sstevel@tonic-gate } 5497c478bd9Sstevel@tonic-gate goto yystack; /* reset registers in driver code */ 5507c478bd9Sstevel@tonic-gate} 551