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

📄 css_syntax.c

📁 著名的标准C++的html解析器
💻 C
📖 第 1 页 / 共 4 页
字号:
							yyval.selector->pseudo_element = 0;							yyval.selector->next = NULL;						}    break;case 48:#line 423 "css_syntax.y"{ yyval.lexeme = yyvsp[0].lexeme; }    break;case 49:#line 427 "css_syntax.y"{ yyval.pseudo_class = PS_CLASS_LINK; }    break;case 50:#line 428 "css_syntax.y"{ yyval.pseudo_class = PS_CLASS_VISITED; }    break;case 51:#line 429 "css_syntax.y"{ yyval.pseudo_class = PS_CLASS_ACTIVE; }    break;case 52:#line 433 "css_syntax.y"{ yyval.pseudo_class = PS_CLASS_LINK; }    break;case 53:#line 434 "css_syntax.y"{ yyval.pseudo_class = PS_CLASS_VISITED; }    break;case 54:#line 435 "css_syntax.y"{ yyval.pseudo_class = PS_CLASS_ACTIVE; }    break;case 55:#line 439 "css_syntax.y"{ yyval.lexeme = yyvsp[0].lexeme; }    break;case 56:#line 443 "css_syntax.y"{ yyval.lexeme = yyvsp[0].lexeme; }    break;case 57:#line 447 "css_syntax.y"{ yyval.pseudo_element = PS_ELEMENT_FIRST_LETTER; }    break;case 58:#line 448 "css_syntax.y"{ yyval.pseudo_element = PS_ELEMENT_FIRST_LINE; }    break;case 59:#line 452 "css_syntax.y"{					yyval.selector = (struct selector_t*)						malloc(sizeof(struct selector_t));					yyval.selector->element_name = NULL;					yyval.selector->id = NULL;					yyval.selector->e_class = NULL;					yyval.selector->pseudo_class = 0;					yyval.selector->pseudo_element = PS_ELEMENT_FIRST_LETTER;					yyval.selector->next = NULL;				}    break;case 60:#line 462 "css_syntax.y"{					yyval.selector = (struct selector_t*)						malloc(sizeof(struct selector_t));					yyval.selector->element_name = NULL;					yyval.selector->id = NULL;					yyval.selector->e_class = NULL;					yyval.selector->pseudo_class = 0;					yyval.selector->pseudo_element = PS_ELEMENT_FIRST_LINE;					yyval.selector->next = NULL;				}    break;case 61:#line 479 "css_syntax.y"{ yyval.lexeme = yyvsp[0].lexeme; }    break;case 62:#line 483 "css_syntax.y"{ yyval.lexeme = yyvsp[0].lexeme; }    break;case 63:#line 487 "css_syntax.y"{								yyval.property = (struct property_t*)									malloc(sizeof(struct property_t));								yyval.property->name = yyvsp[-3].lexeme;								yyval.property->val = yyvsp[-1].lexeme;								yyval.property->important = 1;								yyval.property->count = 0;								yyval.property->next = NULL;							}    break;case 64:#line 496 "css_syntax.y"{								yyval.property = (struct property_t*)									malloc(sizeof(struct property_t));								yyval.property->name = yyvsp[-2].lexeme;								yyval.property->val = yyvsp[0].lexeme;								yyval.property->important = 0;								yyval.property->count = 0;								yyval.property->next = NULL;							}    break;case 65:#line 505 "css_syntax.y"{ yyval.property = NULL; }    break;case 66:#line 506 "css_syntax.y"{								yyval.property = NULL;							}    break;case 67:#line 512 "css_syntax.y"{ }    break;case 68:#line 516 "css_syntax.y"{ yyval.lexeme = yyvsp[0].lexeme; }    break;case 69:#line 517 "css_syntax.y"{							char *s = (char*) malloc (strlen(yyvsp[-2].lexeme)+strlen(yyvsp[0].lexeme)+2);							strcpy(s, yyvsp[-2].lexeme);							s[strlen(s)+1] = 0;							s[strlen(s)] = yyvsp[-1].letter;							strcat(s, yyvsp[0].lexeme);							free(yyvsp[-2].lexeme);							free(yyvsp[0].lexeme);							yyval.lexeme = s;						}    break;case 70:#line 527 "css_syntax.y"{ yyval.lexeme = yyvsp[-1].lexeme; }    break;case 71:#line 531 "css_syntax.y"{							char *s = (char*) malloc(strlen(yyvsp[0].lexeme)+2);							s[0] = yyvsp[-1].letter;							s[1] = 0;							strcat(s, yyvsp[0].lexeme);							free(yyvsp[0].lexeme);							yyval.lexeme = s;						}    break;case 72:#line 539 "css_syntax.y"{ yyval.lexeme = yyvsp[0].lexeme; }    break;case 73:#line 543 "css_syntax.y"{ yyval.lexeme = yyvsp[0].lexeme; }    break;case 74:#line 544 "css_syntax.y"{ yyval.lexeme = yyvsp[0].lexeme; }    break;case 75:#line 545 "css_syntax.y"{ yyval.lexeme = yyvsp[0].lexeme; }    break;case 76:#line 546 "css_syntax.y"{ yyval.lexeme = yyvsp[0].lexeme; }    break;case 77:#line 547 "css_syntax.y"{ yyval.lexeme = yyvsp[0].lexeme; }    break;case 78:#line 548 "css_syntax.y"{ yyval.lexeme = yyvsp[0].lexeme; }    break;case 79:#line 549 "css_syntax.y"{ yyval.lexeme = yyvsp[0].lexeme; }    break;case 80:#line 550 "css_syntax.y"{ yyval.lexeme = yyvsp[0].lexeme; }    break;case 81:#line 551 "css_syntax.y"{ yyval.lexeme = yyvsp[0].lexeme; }    break;case 82:#line 552 "css_syntax.y"{ yyval.lexeme = yyvsp[0].lexeme; }    break;case 83:#line 560 "css_syntax.y"{ 			yyval.lexeme = (char*) malloc (strlen(yyvsp[0].lexeme)+2);			sprintf(yyval.lexeme, "#%s", yyvsp[0].lexeme);			free(yyvsp[0].lexeme);		}    break;case 84:#line 565 "css_syntax.y"{ 						yyval.lexeme = (char*) malloc (strlen(yyvsp[0].lexeme)+2);						sprintf(yyval.lexeme, "#%s", yyvsp[0].lexeme);						free(yyvsp[0].lexeme);					}    break;}#line 705 "/usr/share/bison/bison.simple"  yyvsp -= yylen;  yyssp -= yylen;#if YYLSP_NEEDED  yylsp -= yylen;#endif#if YYDEBUG  if (yydebug)    {      short *yyssp1 = yyss - 1;      YYFPRINTF (stderr, "state stack now");      while (yyssp1 != yyssp)	YYFPRINTF (stderr, " %d", *++yyssp1);      YYFPRINTF (stderr, "\n");    }#endif  *++yyvsp = yyval;#if YYLSP_NEEDED  *++yylsp = yyloc;#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];  goto yynewstate;/*------------------------------------.| yyerrlab -- here on detecting error |`------------------------------------*/yyerrlab:  /* If not already recovering from an error, report this error.  */  if (!yyerrstatus)    {      ++yynerrs;#ifdef YYERROR_VERBOSE      yyn = yypact[yystate];      if (yyn > YYFLAG && yyn < YYLAST)	{	  YYSIZE_T yysize = 0;	  char *yymsg;	  int yyx, yycount;	  yycount = 0;	  /* Start YYX at -YYN if negative to avoid negative indexes in	     YYCHECK.  */	  for (yyx = yyn < 0 ? -yyn : 0;	       yyx < (int) (sizeof (yytname) / sizeof (char *)); yyx++)	    if (yycheck[yyx + yyn] == yyx)	      yysize += yystrlen (yytname[yyx]) + 15, yycount++;	  yysize += yystrlen ("parse error, unexpected ") + 1;	  yysize += yystrlen (yytname[YYTRANSLATE (yychar)]);	  yymsg = (char *) YYSTACK_ALLOC (yysize);	  if (yymsg != 0)	    {	      char *yyp = yystpcpy (yymsg, "parse error, unexpected ");	      yyp = yystpcpy (yyp, yytname[YYTRANSLATE (yychar)]);	      if (yycount < 5)		{		  yycount = 0;		  for (yyx = yyn < 0 ? -yyn : 0;		       yyx < (int) (sizeof (yytname) / sizeof (char *));		       yyx++)		    if (yycheck[yyx + yyn] == yyx)		      {			const char *yyq = ! yycount ? ", expecting " : " or ";			yyp = yystpcpy (yyp, yyq);			yyp = yystpcpy (yyp, yytname[yyx]);			yycount++;		      }		}	      yyerror (yymsg);	      YYSTACK_FREE (yymsg);	    }	  else	    yyerror ("parse error; also virtual memory exhausted");	}      else#endif /* defined (YYERROR_VERBOSE) */	yyerror ("parse error");    }  goto yyerrlab1;/*--------------------------------------------------.| yyerrlab1 -- error raised explicitly by an action |`--------------------------------------------------*/yyerrlab1:  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 (yychar == YYEOF)	YYABORT;      YYDPRINTF ((stderr, "Discarding token %d (%s).\n",		  yychar, yytname[yychar1]));      yychar = YYEMPTY;    }  /* Else will try to reuse lookahead token after shifting the error     token.  */  yyerrstatus = 3;		/* Each real token shifted decrements this */  goto yyerrhandle;/*-------------------------------------------------------------------.| yyerrdefault -- current state does not do anything special for the || error token.                                                       |`-------------------------------------------------------------------*/yyerrdefault:#if 0  /* This is wrong; only states that explicitly want error tokens     should shift them.  */  /* If its default is to accept any token, ok.  Otherwise pop it.  */  yyn = yydefact[yystate];  if (yyn)    goto yydefault;#endif/*---------------------------------------------------------------.| yyerrpop -- pop the current state because it cannot handle the || error token                                                    |`---------------------------------------------------------------*/yyerrpop:  if (yyssp == yyss)    YYABORT;  yyvsp--;  yystate = *--yyssp;#if YYLSP_NEEDED  yylsp--;#endif#if YYDEBUG  if (yydebug)    {      short *yyssp1 = yyss - 1;      YYFPRINTF (stderr, "Error: state stack now");      while (yyssp1 != yyssp)	YYFPRINTF (stderr, " %d", *++yyssp1);      YYFPRINTF (stderr, "\n");    }#endif/*--------------.| yyerrhandle.  |`--------------*/yyerrhandle:  yyn = yypact[yystate];  if (yyn == YYFLAG)    goto yyerrdefault;  yyn += YYTERROR;  if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != YYTERROR)    goto yyerrdefault;  yyn = yytable[yyn];  if (yyn < 0)    {      if (yyn == YYFLAG)	goto yyerrpop;      yyn = -yyn;      goto yyreduce;    }  else if (yyn == 0)    goto yyerrpop;  if (yyn == YYFINAL)    YYACCEPT;  YYDPRINTF ((stderr, "Shifting error token, "));  *++yyvsp = yylval;#if YYLSP_NEEDED  *++yylsp = yylloc;#endif  yystate = yyn;  goto yynewstate;/*-------------------------------------.| yyacceptlab -- YYACCEPT comes here.  |`-------------------------------------*/yyacceptlab:  yyresult = 0;  goto yyreturn;/*-----------------------------------.| yyabortlab -- YYABORT comes here.  |`-----------------------------------*/yyabortlab:  yyresult = 1;  goto yyreturn;/*---------------------------------------------.| yyoverflowab -- parser overflow comes here.  |`---------------------------------------------*/yyoverflowlab:  yyerror ("parser stack overflow");  yyresult = 2;  /* Fall through.  */yyreturn:#ifndef yyoverflow  if (yyss != yyssa)    YYSTACK_FREE (yyss);#endif  return yyresult;}#line 572 "css_syntax.y"int yyerror(char *s) {#if YYDEBUG	fprintf(stderr, "Error: %s\n", s);#endif	return 0;}struct selector_list_t* css_parse(const char *buffer, int buf_len) {	struct selector_list_t *ret = NULL;	//yydebug = 1;	init_yylex(buffer, buf_len);	yyparse(&ret);	end_yylex();	return ret;}

⌨️ 快捷键说明

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