yaccpar revision 7c478bd95313f5f23a4c958a745db2134aa03244
/*
* 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
* 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 1993 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
/* Copyright (c) 1988 AT&T */
/* All Rights Reserved */
/*
** Skeleton parser driver for yacc output
*/
/*
** yacc user known macros and defines
*/
{\
{\
yyerror( "syntax error - cannot backup" );\
goto yyerrlab;\
}\
goto yynewstate;\
}
/*
** user known globals
*/
int yydebug; /* set to 1 to get debugging */
/*
** driver internal defines
*/
/*
** global variables used by the parser
*/
int *yyps; /* top of state stack */
int yystate; /* current state */
int yytmp; /* extra var (lasts between blocks) */
int yynerrs; /* number of errors */
int yyerrflag; /* error recovery flag */
int yychar; /* current input token number */
/*
** yycvtok - return a token if i is a wchar_t value that exceeds 255.
** If i<255, i itself is the token. If i>255 but the neither
** of the 30th or 31st bit is on, i is already a token.
*/
int yycvtok(int i)
#else
int yycvtok(i) int i;
{
int first = 0;
int mid;
wchar_t j;
if(i&0x60000000){/*Must convert to a token. */
return i;/*Giving up*/
}
if( j==i ){/*Found*/
}else if( j<i ){
}else{
}
}
/*No entry in the table.*/
return i;/* Giving up.*/
}else{/* i is already a token. */
return i;
}
}
#else/*!YYNMBCHARS*/
#endif/*!YYNMBCHARS*/
/*
** yyparse - return 0 if worked, 1 if syntax error not recovered from
*/
int yyparse(void)
#else
int yyparse()
{
/*
hacks to please C++ and lint - goto's inside
switch should never be executed
*/
static int __yaccpar_lint_hack__ = 0;
switch (__yaccpar_lint_hack__)
{
case 1: goto yyerrlab;
case 2: goto yynewstate;
}
/*
** Initialize externals - yyparse may be called more than once
*/
yystate = 0;
yytmp = 0;
yynerrs = 0;
yyerrflag = 0;
yychar = -1;
#if YYMAXDEPTH <= 0
if (yymaxdepth <= 0)
{
{
yyerror("yacc initialization error");
}
}
{
goto yystack; /* moved from 6 lines above to here to please C++ */
/*
** get globals into registers.
** branch to here only if YYBACKUP was called.
*/
goto yy_newstate;
/*
** get globals into registers.
** either we just started, or we just finished a reduction
*/
/*
** top of for (;;) loop while no reductions done
*/
/*
** put a state and value onto the stacks
*/
#if YYDEBUG
/*
** if debugging, look up token value in list of value vs.
** name pairs. 0 and negative (-1) are special values.
** Note: linear search is used since time is not a real
** consideration while debugging.
*/
if ( yydebug )
{
if ( yychar == 0 )
printf( "end-of-file\n" );
else if ( yychar < 0 )
printf( "-none-\n" );
else
{
yy_i++ )
{
break;
}
}
}
#endif /* YYDEBUG */
{
/*
** reallocate and recover. Note that pointers
** have to be reset, or bad things will happen
*/
int yynewmax;
#else
{
{
}
else
}
else /* not first time */
{
}
{
yyerror( "yacc stack overflow" );
}
}
/*
** we have a new state - find out what to do
*/
goto yydefault; /* simple state */
#if YYDEBUG
/*
** if debugging, need to mark whether new token grabbed
*/
#if YYDEBUG
{
printf( "Received token " );
if ( yychar == 0 )
printf( "end-of-file\n" );
else if ( yychar < 0 )
printf( "-none-\n" );
else
{
yy_i++ )
{
break;
}
}
}
#endif /* YYDEBUG */
goto yydefault;
{
yychar = -1;
if ( yyerrflag > 0 )
yyerrflag--;
goto yy_stack;
}
{
#if YYDEBUG
#if YYDEBUG
{
printf( "Received token " );
if ( yychar == 0 )
printf( "end-of-file\n" );
else if ( yychar < 0 )
printf( "-none-\n" );
else
{
for ( yy_i = 0;
yy_i++ )
{
== yychar )
{
break;
}
}
}
}
#endif /* YYDEBUG */
/*
** look through exception table
*/
{
while ( ( *yyxi != -1 ) ||
{
yyxi += 2;
}
;
}
}
/*
** check for syntax error
*/
{
/* no worry about speed here! */
switch ( yyerrflag )
{
case 0: /* new error */
yyerror( "syntax error" );
goto skip_init;
/*
** get globals into registers.
** we have a user generated syntax type error
*/
yynerrs++;
/* FALLTHRU */
case 1:
case 2: /* incompletely recovered error */
/* try again... */
yyerrflag = 3;
/*
** find state where "error" is a legal
** shift action
*/
{
/*
** simulate shift of "error"
*/
goto yy_stack;
}
/*
** current state has no shift on
** "error", pop stack
*/
#if YYDEBUG
if ( yydebug )
yy_ps[-1] );
yy_ps--;
yy_pv--;
}
/*
** there is no state on stack with "error" as
** a valid shift. give up.
*/
case 3: /* no shift yet; eat a token */
#if YYDEBUG
/*
** if debugging, look up token in list of
** pairs. 0 and negative shouldn't occur,
** but since timing doesn't matter when
** debugging, it doesn't hurt to leave the
** tests here.
*/
if ( yydebug )
{
printf( "Error recovery discards " );
if ( yychar == 0 )
printf( "token end-of-file\n" );
else if ( yychar < 0 )
printf( "token -none-\n" );
else
{
for ( yy_i = 0;
yy_i++ )
{
== yychar )
{
break;
}
}
printf( "token %s\n",
}
}
#endif /* YYDEBUG */
yychar = -1;
goto yy_newstate;
}
}/* end if ( yy_n == 0 ) */
/*
** reduction by production yy_n
** put stack tops, etc. so things right after switch
*/
#if YYDEBUG
/*
** if debugging, print the string that is the user's
** specification of the reduction which is just about
** to be done.
*/
if ( yydebug )
printf( "Reduce by (%d) \"%s\"\n",
/*
** Look in goto table for next state
** Sorry about using yy_state here as temporary
** register variable, but why not, if it works...
** If yyr2[ yy_n ] doesn't have the low order bit
** set, then there is no action to be done for
** this reduction. So, no saving & unsaving of
** registers done. The only difference between the
** code just after the if and the body of the if is
** the goto yy_stack in the body. This way the test
** can be made before the choice of what to do is needed.
*/
{
/* length of production doubled with extra bit */
if ( !( yy_len & 01 ) )
{
yy_len >>= 1;
{
}
goto yy_stack;
}
yy_len >>= 1;
{
}
}
/* save until reenter driver code */
}
/*
** code supplied by user is placed in this switch
*/
switch( yytmp )
{
$A
}
goto yystack; /* reset registers in driver code */
}