⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 cmdpars.cc

📁 sdcc是为51等小型嵌入式cpu设计的c语言编译器支持数种不同类型的cpu
💻 CC
📖 第 1 页 / 共 3 页
字号:
      if (YY_cl_ucsim_parser_DEBUG_FLAG)	fprintf(stderr, "Stack size increased to %d\n", yystacksize);#endif      if (yyssp >= yyss + yystacksize - 1)	YYABORT;    }#if YY_cl_ucsim_parser_DEBUG != 0  if (YY_cl_ucsim_parser_DEBUG_FLAG)    fprintf(stderr, "Entering state %d\n", yystate);#endif  YYGOTO(yybackup);YYLABEL(yybackup)/* Do appropriate processing given the current state.  *//* Read a lookahead token if we need one and don't already have one.  *//* YYLABEL(yyresume) */  /* First try to decide what to do without reference to lookahead token.  */  yyn = yypact[yystate];  if (yyn == YYFLAG)    YYGOTO(yydefault);  /* Not known => get a lookahead token if don't already have one.  */  /* yychar is either YYEMPTY or YYEOF     or a valid token in external form.  */  if (YY_cl_ucsim_parser_CHAR == YYEMPTY)    {#if YY_cl_ucsim_parser_DEBUG != 0      if (YY_cl_ucsim_parser_DEBUG_FLAG)	fprintf(stderr, "Reading a token: ");#endif      YY_cl_ucsim_parser_CHAR = YYLEX;    }  /* Convert token to internal form (in yychar1) for indexing tables with */  if (YY_cl_ucsim_parser_CHAR <= 0)           /* This means end of input. */    {      yychar1 = 0;      YY_cl_ucsim_parser_CHAR = YYEOF;                /* Don't call YYLEX any more */#if YY_cl_ucsim_parser_DEBUG != 0      if (YY_cl_ucsim_parser_DEBUG_FLAG)	fprintf(stderr, "Now at end of input.\n");#endif    }  else    {      yychar1 = YYTRANSLATE(YY_cl_ucsim_parser_CHAR);#if YY_cl_ucsim_parser_DEBUG != 0      if (YY_cl_ucsim_parser_DEBUG_FLAG)	{	  fprintf (stderr, "Next token is %d (%s", YY_cl_ucsim_parser_CHAR, yytname[yychar1]);	  /* Give the individual parser a way to print the precise meaning	     of a token, for further debugging info.  */#ifdef YYPRINT	  YYPRINT (stderr, YY_cl_ucsim_parser_CHAR, YY_cl_ucsim_parser_LVAL);#endif	  fprintf (stderr, ")\n");	}#endif    }  yyn += yychar1;  if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != yychar1)    YYGOTO(yydefault);  yyn = yytable[yyn];  /* yyn is what to do for this token type in this state.     Negative => reduce, -yyn is rule number.     Positive => shift, yyn is new state.       New state is final state => don't bother to shift,       just return success.     0, or most negative number => error.  */  if (yyn < 0)    {      if (yyn == YYFLAG)	YYGOTO(yyerrlab);      yyn = -yyn;      YYGOTO(yyreduce);    }  else if (yyn == 0)    YYGOTO(yyerrlab);  if (yyn == YYFINAL)    YYACCEPT;  /* Shift the lookahead token.  */#if YY_cl_ucsim_parser_DEBUG != 0  if (YY_cl_ucsim_parser_DEBUG_FLAG)    fprintf(stderr, "Shifting token %d (%s), ", YY_cl_ucsim_parser_CHAR, yytname[yychar1]);#endif  /* Discard the token being shifted unless it is eof.  */  if (YY_cl_ucsim_parser_CHAR != YYEOF)    YY_cl_ucsim_parser_CHAR = YYEMPTY;  *++yyvsp = YY_cl_ucsim_parser_LVAL;#ifdef YY_cl_ucsim_parser_LSP_NEEDED  *++yylsp = YY_cl_ucsim_parser_LLOC;#endif  /* count tokens shifted since error; after three, turn off error status.  */  if (yyerrstatus) yyerrstatus--;  yystate = yyn;  YYGOTO(yynewstate);/* Do the default action for the current state.  */YYLABEL(yydefault)  yyn = yydefact[yystate];  if (yyn == 0)    YYGOTO(yyerrlab);/* Do a reduction.  yyn is the number of a rule to reduce with.  */YYLABEL(yyreduce)  yylen = yyr2[yyn];  if (yylen > 0)    yyval = yyvsp[1-yylen]; /* implement default value of the action */#if YY_cl_ucsim_parser_DEBUG != 0  if (YY_cl_ucsim_parser_DEBUG_FLAG)    {      int i;      fprintf (stderr, "Reducing via rule %d (line %d), ",	       yyn, yyrline[yyn]);      /* Print the symbols being reduced, and their result.  */      for (i = yyprhs[yyn]; yyrhs[i] > 0; i++)	fprintf (stderr, "%s ", yytname[yyrhs[i]]);      fprintf (stderr, " -> %s\n", yytname[yyr1[yyn]]);    }#endif #line 839 "/usr/share/bison++/bison.cc"  switch (yyn) {case 1:#line 60 "cmdpars.y"{ application->dd_printf("%d\n", yyvsp[0].number); ;    break;}case 2:#line 65 "cmdpars.y"{	    yyvsp[-2].memory.memory->write(yyvsp[-2].memory.address, yyvsp[0].number);	    yyval.number= yyvsp[0].number;	  ;    break;}case 3:#line 70 "cmdpars.y"{	    if (yyvsp[0].number)	      {		yyvsp[-2].bit.memory->write(yyvsp[-2].bit.mem_address,				 yyvsp[-2].bit.memory->read(yyvsp[-2].bit.mem_address) | yyvsp[-2].bit.mask);		yyval.number= 1;	      }	    else	      {		yyvsp[-2].bit.memory->write(yyvsp[-2].bit.mem_address,				 yyvsp[-2].bit.memory->read(yyvsp[-2].bit.mem_address) & ~(yyvsp[-2].bit.mask));		yyval.number= 0;	      }	  ;    break;}case 4:#line 87 "cmdpars.y"{ yyval.number= yyvsp[0].number; ;    break;}case 5:#line 88 "cmdpars.y"{ yyval.number= yyvsp[-2].number + yyvsp[0].number; ;    break;}case 6:#line 89 "cmdpars.y"{ yyval.number= yyvsp[-2].number - yyvsp[0].number; ;    break;}case 7:#line 90 "cmdpars.y"{ yyval.number= yyvsp[-2].number * yyvsp[0].number; ;    break;}case 8:#line 92 "cmdpars.y"{	    if (yyvsp[0].number == 0)	      yyerror("Divide by zero");	    else	      yyval.number= yyvsp[-2].number / yyvsp[0].number;	  ;    break;}case 9:#line 98 "cmdpars.y"{ yyval.number= -yyvsp[0].number; ;    break;}case 10:#line 99 "cmdpars.y"{ yyval.number= yyvsp[0].number; ;    break;}case 11:#line 100 "cmdpars.y"{ yyval.number= yyvsp[-1].number; ;    break;}case 12:#line 101 "cmdpars.y"{ yyval.number= yyvsp[0].number; ;    break;}case 13:#line 102 "cmdpars.y"{ yyval.number= yyvsp[0].memory.memory->read(yyvsp[0].memory.address); ;    break;}case 14:#line 103 "cmdpars.y"{ yyval.number= (yyvsp[0].bit.memory->read(yyvsp[0].bit.mem_address) & yyvsp[0].bit.mask)?1:0; ;    break;}case 15:#line 107 "cmdpars.y"{ yyval.number= yyvsp[0].memory.address; ;    break;}case 16:#line 109 "cmdpars.y"{	  yyval.number= yyvsp[0].bit.bit_address;	  if (yyval.number < 0)	    {	      yyerror("Bit has no address.");	      yyval.number= 0;	    }	;    break;}case 18:#line 122 "cmdpars.y"{	    yyval.memory.memory= yyvsp[-3].memory_object;	    yyval.memory.address= yyvsp[-1].number;	  ;    break;}case 20:#line 130 "cmdpars.y"{	    yyval.bit.memory= yyvsp[-2].memory.memory;	    yyval.bit.mem_address= yyvsp[-2].memory.address;	    yyval.bit.mask= 1 << yyvsp[0].number;	    yyval.bit.bit_address= -1;	    class cl_uc *uc= application->get_uc();	    if (uc)	      yyval.bit.bit_address= uc->bit_address(yyvsp[-2].memory.memory, yyvsp[-2].memory.address, yyvsp[0].number);	  ;    break;}}#line 839 "/usr/share/bison++/bison.cc"   /* the action file gets copied in in place of this dollarsign  */  yyvsp -= yylen;  yyssp -= yylen;#ifdef YY_cl_ucsim_parser_LSP_NEEDED  yylsp -= yylen;#endif#if YY_cl_ucsim_parser_DEBUG != 0  if (YY_cl_ucsim_parser_DEBUG_FLAG)    {      short *ssp1 = yyss - 1;      fprintf (stderr, "state stack now");      while (ssp1 != yyssp)	fprintf (stderr, " %d", *++ssp1);      fprintf (stderr, "\n");    }#endif  *++yyvsp = yyval;#ifdef YY_cl_ucsim_parser_LSP_NEEDED  yylsp++;  if (yylen == 0)    {      yylsp->first_line = YY_cl_ucsim_parser_LLOC.first_line;      yylsp->first_column = YY_cl_ucsim_parser_LLOC.first_column;      yylsp->last_line = (yylsp-1)->last_line;      yylsp->last_column = (yylsp-1)->last_column;      yylsp->text = 0;    }  else    {      yylsp->last_line = (yylsp+yylen-1)->last_line;      yylsp->last_column = (yylsp+yylen-1)->last_column;    }#endif  /* Now "shift" the result of the reduction.     Determine what state that goes to,     based on the state we popped back to     and the rule number reduced by.  */  yyn = yyr1[yyn];  yystate = yypgoto[yyn - YYNTBASE] + *yyssp;  if (yystate >= 0 && yystate <= YYLAST && yycheck[yystate] == *yyssp)    yystate = yytable[yystate];  else    yystate = yydefgoto[yyn - YYNTBASE];  YYGOTO(yynewstate);YYLABEL(yyerrlab)   /* here on detecting error */  if (! yyerrstatus)    /* If not already recovering from an error, report this error.  */    {      ++YY_cl_ucsim_parser_NERRS;#ifdef YY_cl_ucsim_parser_ERROR_VERBOSE      yyn = yypact[yystate];      if (yyn > YYFLAG && yyn < YYLAST)	{	  int size = 0;	  char *msg;	  int x, count;	  count = 0;	  /* Start X at -yyn if nec to avoid negative indexes in yycheck.  */	  for (x = (yyn < 0 ? -yyn : 0);	       x < (sizeof(yytname) / sizeof(char *)); x++)	    if (yycheck[x + yyn] == x)	      size += strlen(yytname[x]) + 15, count++;	  msg = (char *) malloc(size + 15);	  if (msg != 0)	    {	      strcpy(msg, "parse error");	      if (count < 5)		{		  count = 0;		  for (x = (yyn < 0 ? -yyn : 0);		       x < (sizeof(yytname) / sizeof(char *)); x++)		    if (yycheck[x + yyn] == x)		      {			strcat(msg, count == 0 ? ", expecting `" : " or `");			strcat(msg, yytname[x]);			strcat(msg, "'");			count++;		      }		}	      YY_cl_ucsim_parser_ERROR(msg);	      free(msg);	    }	  else	    YY_cl_ucsim_parser_ERROR ("parse error; also virtual memory exceeded");	}      else#endif /* YY_cl_ucsim_parser_ERROR_VERBOSE */	YY_cl_ucsim_parser_ERROR("parse error");    }  YYGOTO(yyerrlab1);YYLABEL(yyerrlab1)   /* here on error raised explicitly by an action */  if (yyerrstatus == 3)    {      /* if just tried and failed to reuse lookahead token after an error, discard it.  */      /* return failure if at end of input */      if (YY_cl_ucsim_parser_CHAR == YYEOF)	YYABORT;#if YY_cl_ucsim_parser_DEBUG != 0      if (YY_cl_ucsim_parser_DEBUG_FLAG)	fprintf(stderr, "Discarding token %d (%s).\n", YY_cl_ucsim_parser_CHAR, yytname[yychar1]);#endif      YY_cl_ucsim_parser_CHAR = YYEMPTY;    }  /* Else will try to reuse lookahead token     after shifting the error token.  */  yyerrstatus = 3;              /* Each real token shifted decrements this */  YYGOTO(yyerrhandle);YYLABEL(yyerrdefault)  /* current state does not do anything special for the error token. */#if 0  /* This is wrong; only states that explicitly want error tokens     should shift them.  */  yyn = yydefact[yystate];  /* If its default is to accept any token, ok.  Otherwise pop it.*/  if (yyn) YYGOTO(yydefault);#endifYYLABEL(yyerrpop)   /* pop the current state because it cannot handle the error token */  if (yyssp == yyss) YYABORT;  yyvsp--;  yystate = *--yyssp;#ifdef YY_cl_ucsim_parser_LSP_NEEDED  yylsp--;#endif#if YY_cl_ucsim_parser_DEBUG != 0  if (YY_cl_ucsim_parser_DEBUG_FLAG)    {      short *ssp1 = yyss - 1;      fprintf (stderr, "Error: state stack now");      while (ssp1 != yyssp)	fprintf (stderr, " %d", *++ssp1);      fprintf (stderr, "\n");    }#endifYYLABEL(yyerrhandle)  yyn = yypact[yystate];  if (yyn == YYFLAG)    YYGOTO(yyerrdefault);  yyn += YYTERROR;  if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != YYTERROR)    YYGOTO(yyerrdefault);  yyn = yytable[yyn];  if (yyn < 0)    {      if (yyn == YYFLAG)	YYGOTO(yyerrpop);      yyn = -yyn;      YYGOTO(yyreduce);    }  else if (yyn == 0)    YYGOTO(yyerrpop);  if (yyn == YYFINAL)    YYACCEPT;#if YY_cl_ucsim_parser_DEBUG != 0  if (YY_cl_ucsim_parser_DEBUG_FLAG)    fprintf(stderr, "Shifting error token, ");#endif  *++yyvsp = YY_cl_ucsim_parser_LVAL;#ifdef YY_cl_ucsim_parser_LSP_NEEDED  *++yylsp = YY_cl_ucsim_parser_LLOC;#endif  yystate = yyn;  YYGOTO(yynewstate);/* end loop, in which YYGOTO may be used. */  YYENDGOTO}/* END */ #line 1038 "/usr/share/bison++/bison.cc"#line 141 "cmdpars.y"intYY_cl_ucsim_parser_CLASS::yylex(YY_cl_ucsim_parser_STYPE *yylval){  lexer_object->activate_lexer_to_parse_into(yylval);  return(lexer_object->yylex());}voidYY_cl_ucsim_parser_CLASS::yyerror(char *msg){  application->dd_printf("Parser error: %s\n", msg);}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -