The main parser program. ** The first argument is a pointer to a structure obtained from ** "ParseAlloc" which describes the current state of the parser. ** The second argument is the major token number. The third is ** the minor token. The fourth optional argument is whatever the ** user wants (and specified in the grammar) and is available for ** use by the action routines. ** ** Inputs: ** <u
| 893 | ** None. |
| 894 | */ |
| 895 | void Parse( |
| 896 | void *yyp, /* The parser */ |
| 897 | int yymajor, /* The major token code number */ |
| 898 | ParseTOKENTYPE yyminor /* The value for the token */ |
| 899 | ParseARG_PDECL /* Optional %extra_argument parameter */ |
| 900 | ){ |
| 901 | YYMINORTYPE yyminorunion; |
| 902 | YYACTIONTYPE yyact; /* The parser action. */ |
| 903 | #if !defined(YYERRORSYMBOL) && !defined(YYNOERRORRECOVERY) |
| 904 | int yyendofinput; /* True if we are at the end of input */ |
| 905 | #endif |
| 906 | #ifdef YYERRORSYMBOL |
| 907 | int yyerrorhit = 0; /* True if yymajor has invoked an error */ |
| 908 | #endif |
| 909 | yyParser *yypParser = (yyParser*)yyp; /* The parser */ |
| 910 | ParseCTX_FETCH |
| 911 | ParseARG_STORE |
| 912 | |
| 913 | assert( yypParser->yytos!=0 ); |
| 914 | #if !defined(YYERRORSYMBOL) && !defined(YYNOERRORRECOVERY) |
| 915 | yyendofinput = (yymajor==0); |
| 916 | #endif |
| 917 | |
| 918 | yyact = yypParser->yytos->stateno; |
| 919 | #ifndef NDEBUG |
| 920 | if( yyTraceFILE ){ |
| 921 | if( yyact < YY_MIN_REDUCE ){ |
| 922 | fprintf(yyTraceFILE,"%sInput '%s' in state %d\n", |
| 923 | yyTracePrompt,yyTokenName[yymajor],yyact); |
| 924 | }else{ |
| 925 | fprintf(yyTraceFILE,"%sInput '%s' with pending reduce %d\n", |
| 926 | yyTracePrompt,yyTokenName[yymajor],yyact-YY_MIN_REDUCE); |
| 927 | } |
| 928 | } |
| 929 | #endif |
| 930 | |
| 931 | do{ |
| 932 | assert( yyact==yypParser->yytos->stateno ); |
| 933 | yyact = yy_find_shift_action((YYCODETYPE)yymajor,yyact); |
| 934 | if( yyact >= YY_MIN_REDUCE ){ |
| 935 | yyact = yy_reduce(yypParser,yyact-YY_MIN_REDUCE,yymajor, |
| 936 | yyminor ParseCTX_PARAM); |
| 937 | }else if( yyact <= YY_MAX_SHIFTREDUCE ){ |
| 938 | yy_shift(yypParser,yyact,(YYCODETYPE)yymajor,yyminor); |
| 939 | #ifndef YYNOERRORRECOVERY |
| 940 | yypParser->yyerrcnt--; |
| 941 | #endif |
| 942 | break; |
| 943 | }else if( yyact==YY_ACCEPT_ACTION ){ |
| 944 | yypParser->yytos--; |
| 945 | yy_accept(yypParser); |
| 946 | return; |
| 947 | }else{ |
| 948 | assert( yyact == YY_ERROR_ACTION ); |
| 949 | yyminorunion.yy0 = yyminor; |
| 950 | #ifdef YYERRORSYMBOL |
| 951 | int yymx; |
| 952 | #endif |
no test coverage detected