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

📄 oaverilogparser.skl

📁 openaccess与verilog互相转化时所用的源代码
💻 SKL
📖 第 1 页 / 共 3 页
字号:
     detect an error, take that action.  */  n_ += ilooka_;  if (n_ < 0 || last_ < n_ || check_[n_] != ilooka_)    goto yydefault;  /* Reduce or error.  */  n_ = table_[n_];  if (n_ < 0)    {      if (n_ == table_ninf_)	goto yyerrlab;      else	{	  n_ = -n_;	  goto yyreduce;	}    }  else if (n_ == 0)    goto yyerrlab;  /* Accept?  */  if (n_ == final_)    goto yyacceptlab;  /* Shift the lookahead token.  */#if YYDEBUG  YYCDEBUG << "Shifting token " << looka_           << " (" << name_[ilooka_] << "), ";#endif  /* Discard the token being shifted unless it is eof.  */  if (looka_ != eof_)    looka_ = empty_;  semantic_stack_.push (value);  // location_stack_.push (location);  /* Count tokens shifted since error; after three, turn off error     status.  */  if (errstatus)    --errstatus;  state_ = n_;  goto yynewstate;/*-----------------------------------------------------------.| yydefault -- do the default action for the current state.  |`-----------------------------------------------------------*/ yydefault:  n_ = defact_[state_];  if (n_ == 0)    goto yyerrlab;  goto yyreduce;/*-----------------------------.| yyreduce -- Do a reduction.  |`-----------------------------*/ yyreduce:  len_ = r2_[n_];  /* If LEN_ is nonzero, implement the default value of the action:     `$$ = $1'.  Otherwise, use the top of the stack.     Otherwise, the following line sets YYVAL to garbage.     This behavior is undocumented and Bison     users should not rely upon it.  */  if (len_)    {      yyval = semantic_stack_[len_ - 1];      // yyloc = location_stack_[len_ - 1];    }  else    {      yyval = semantic_stack_[0];      // yyloc = location_stack_[0];    }  if (len_)    {      // Slice< LocationType, LocationStack > slice (location_stack_, len_);      // YYLLOC_DEFAULT (yyloc, slice, len_);    }  YY_REDUCE_PRINT (n_);  switch (n_)    {      ]b4_actions[    }]/* Line __line__ of lalr1.cc.  */b4_syncline([@oline@], [@ofile@])[  state_stack_.pop (len_);  semantic_stack_.pop (len_);  // location_stack_.pop (len_);  YY_STACK_PRINT ();  semantic_stack_.push (yyval);  // location_stack_.push (yyloc);  /* Shift the result of the reduction.  */  n_ = r1_[n_];  state_ = pgoto_[n_ - ntokens_] + state_stack_[0];  if (0 <= state_ && state_ <= last_ && check_[state_] == state_stack_[0])    state_ = table_[state_];  else    state_ = defgoto_[n_ - ntokens_];  goto yynewstate;/*------------------------------------.| yyerrlab -- here on detecting error |`------------------------------------*/ yyerrlab:  /* If not already recovering from an error, report this error.  */  if (!errstatus)    {      ++nerrs;#if YYERROR_VERBOSE      n_ = pact_[state_];      if (pact_ninf_ < n_ && n_ < last_)	{	  message = "syntax error, unexpected ";	  message += name_[ilooka_];	  {	    int count = 0;            /* Start YYX at -YYN if negative to avoid negative indexes in               YYCHECK.  */	    int xbegin = n_ < 0 ? -n_ : 0; 	    /* Stay within bounds of both yycheck and yytname.  */	    int checklim = last_ - n_;	    int xend = checklim < ntokens_ ? checklim : ntokens_;	    for (int x = xbegin; x < xend; x++)	      if (check_[x + n_] == x && x != terror_)		++count;	    if (count < 5)	      {		count = 0;		for (int x1 = xbegin; x1 < xend; x1++)		  if (check_[x1 + n_] == x1 && x1 != terror_)		    {		      message += (!count++) ? ", expecting " : " or ";		      message += name_[x1];		    }	      }	  }	}      else#endif	message = "syntax error";	error_ ();    }  if (errstatus == 3)    {      /* If just tried and failed to reuse lookahead token after an	 error, discard it.  */      /* Return failure if at end of input.  */      if (looka_ <= eof_)        {          /* If at end of input, pop the error token,	     then the rest of the stack, then return failure.  */	  if (looka_ == eof_)	     for (;;)	       {                 state_stack_.pop ();                 semantic_stack_.pop ();                 // location_stack_.pop ();		 if (state_stack_.height () == 1)		   YYABORT;//		 YYDSYMPRINTF ("Error: popping", yystos[*yyssp], yyvsp, yylsp);// FIXME: yydestruct (yystos[*yyssp], yyvsp]b4_location_if([, yylsp])[);	       }        }      else        {#if YYDEBUG           YYCDEBUG << "Discarding token " << looka_  	            << " (" << name_[ilooka_] << ")." << std::endl;//	  yydestruct (yytoken, &yylval]b4_location_if([, &yylloc])[);#endif           looka_ = empty_;        }    }  /* Else will try to reuse lookahead token after shifting the error     token.  */  goto yyerrlab1;/*---------------------------------------------------.| yyerrorlab -- error raised explicitly by YYERROR.  |`---------------------------------------------------*/yyerrorlab:  clearStack_();  goto yyerrlab1;/*-------------------------------------------------------------.| yyerrlab1 -- common code for both syntax error and YYERROR.  |`-------------------------------------------------------------*/yyerrlab1:  errstatus = 3;	/* Each real token shifted decrements this.  */  for (;;)    {      n_ = pact_[state_];      if (n_ != pact_ninf_)	{	  n_ += terror_;	  if (0 <= n_ && n_ <= last_ && check_[n_] == terror_)	    {	      n_ = table_[n_];	      if (0 < n_)		break;	    }	}      /* Pop the current state because it cannot handle the error token.  */      if (state_stack_.height () == 1)	YYABORT;#if YYDEBUG      if (debug_)	{	  if (stos_[state_] < ntokens_)	    {	      YYCDEBUG << "Error: popping token "		     << token_number_[stos_[state_]]		     << " (" << name_[stos_[state_]];# ifdef YYPRINT	      YYPRINT (stderr, token_number_[stos_[state_]],		       semantic_stack_.top ());# endif	      YYCDEBUG << ')' << std::endl;	    }	  else	    {	      YYCDEBUG << "Error: popping nonterminal ("		     << name_[stos_[state_]] << ')' << std::endl;	    }	}#endif      state_stack_.pop ();      semantic_stack_.pop ();      // location_stack_.pop ();      state_ = state_stack_[0];      YY_STACK_PRINT ();    }  if (n_ == final_)    goto yyacceptlab;  YYCDEBUG << "Shifting error token, ";  semantic_stack_.push (value);  // location_stack_.push (location);  state_ = n_;  goto yynewstate;  /* Accept.  */ yyacceptlab:  return 0;  /* Abort.  */ yyabortlab:  return 1;} catch (...) {    clearStack_ ();    scanner.cleanup();    throw;}}void]b4_parser_namespace[::]b4_parser_class_name[::lex_ (){#if YYLSP_NEEDED  // looka_ = yylex (&value, &location);#else  looka_ = yylex (&value);#endif}// This function deletes the value at the given position from the parser's// internal value stack.  The yyval is the return value for any given rule.  It// is initialized to the stack element at position 1 before the user's action is// evaluated.  The user's action may assign a new return value prior to// deleting any values.  Also, the user's action may delete the element at // postition 1.  In order to avoid restricting the order of operations in the// user's action and in order to prevent the return value from refering to a // deleted element, if the ID of the return value is equal to the ID of the// element being deleted, then the return value (yyval) is cleared.void]b4_parser_namespace[::]b4_parser_class_name[::deletePos (int n){    if (yyval.getID() == semantic_stack_[len_ - n].getID()) {	yyval.clear();    }    semantic_stack_[len_ - n].deleteValue();}// This function is called for syntax errors that are generated by explicit// calls to YYERROR or by the default syntax error rule.  This function clears// the semantic value stack in preparation for aborting the parse.void]b4_parser_namespace[::]b4_parser_class_name[::clearStack_ (){       if (stackCleared) {	return;    }        stackCleared = true;        YYSTYPE						    *val;    std::set<ParserStypeWrapper*, ParserStypeCmp>           toBeDeleted;    std::set<ParserStypeWrapper*, ParserStypeCmp>::iterator deleted;        for (oaUInt4 i = 0; i < semantic_stack_.height(); i++) {	val = &semantic_stack_[i];	        if (toBeDeleted.find(val) == toBeDeleted.end()) {            toBeDeleted.insert(val);        }    }        if (toBeDeleted.find(&yyval) == toBeDeleted.end()) {        toBeDeleted.insert(&yyval);    }        for (deleted = toBeDeleted.begin(); deleted != toBeDeleted.end();          deleted++) {        (*deleted)->deleteValue();    }        state_stack_.pop (len_);    semantic_stack_.pop (len_);    // location_stack_.pop (len_);    state_ = state_stack_[0];}// This function is called for syntax errors that are generated by explicit// calls to YYERROR or by the default syntax error rule.  This function clears// the semantic value stack and throws a SyntaxError exeception.void]b4_parser_namespace[::]b4_parser_class_name[::error_ (){       clearStack_();    throw Error(SyntaxError, &scanner, scanner.getText());}            /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing   STATE-NUM.  */const ]b4_int_type(b4_pact_ninf, b4_pact_ninf) b4_parser_namespace[::]b4_parser_class_name::pact_ninf_ = b4_pact_ninf[;const ]b4_int_type_for([b4_pact])[]b4_parser_namespace[::]b4_parser_class_name[::pact_[] ={  ]b4_pact[};/* YYDEFACT[S] -- default rule to reduce with in state S when YYTABLE   doesn't specify something else to do.  Zero means the default is an   error.  */const ]b4_int_type_for([b4_defact])[]b4_parser_namespace[::]b4_parser_class_name[::defact_[] ={  ]b4_defact[};/* YYPGOTO[NTERM-NUM].  */const ]b4_int_type_for([b4_pgoto])[]b4_parser_namespace[::]b4_parser_class_name[::pgoto_[] ={  ]b4_pgoto[};/* YYDEFGOTO[NTERM-NUM].  */const ]b4_int_type_for([b4_defgoto])[]b4_parser_namespace[::]b4_parser_class_name[::defgoto_[] ={  ]b4_defgoto[};/* YYTABLE[YYPACT[STATE-NUM]].  What to do in state STATE-NUM.  If   positive, shift that token.  If negative, reduce the rule which   number is the opposite.  If zero, do what YYDEFACT says.  */const ]b4_int_type(b4_table_ninf, b4_table_ninf)[ ]b4_parser_namespace[::]b4_parser_class_name::table_ninf_ = b4_table_ninf[;const ]b4_int_type_for([b4_table])[]b4_parser_namespace[::]b4_parser_class_name[::table_[] ={  ]b4_table[};/* YYCHECK.  */const ]b4_int_type_for([b4_check])[]b4_parser_namespace[::]b4_parser_class_name[::check_[] ={  ]b4_check[};#if YYDEBUG/* STOS_[STATE-NUM] -- The (internal number of the) accessing   symbol of state STATE-NUM.  */const ]b4_int_type_for([b4_stos])[]b4_parser_namespace[::]b4_parser_class_name[::stos_[] ={  ]b4_stos[};/* TOKEN_NUMBER_[YYLEX-NUM] -- Internal token number corresponding   to YYLEX-NUM.  */const ]b4_int_type_for([b4_toknum])[]b4_parser_namespace[::]b4_parser_class_name[::token_number_[] ={  ]b4_toknum[};

⌨️ 快捷键说明

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