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

📄 parser.c

📁 Linux的蓝牙操作工具。配合bluez-lib使用
💻 C
📖 第 1 页 / 共 4 页
字号:
	      yyres[yyn] = '\0';	    return yyn;	  }    do_not_strip_quotes: ;    }  if (! yyres)    return yystrlen (yystr);  return yystpcpy (yyres, yystr) - yyres;}# endif/* Copy into YYRESULT an error message about the unexpected token   YYCHAR while in state YYSTATE.  Return the number of bytes copied,   including the terminating null byte.  If YYRESULT is null, do not   copy anything; just return the number of bytes that would be   copied.  As a special case, return 0 if an ordinary "syntax error"   message will do.  Return YYSIZE_MAXIMUM if overflow occurs during   size calculation.  */static YYSIZE_Tyysyntax_error (char *yyresult, int yystate, int yychar){  int yyn = yypact[yystate];  if (! (YYPACT_NINF < yyn && yyn <= YYLAST))    return 0;  else    {      int yytype = YYTRANSLATE (yychar);      YYSIZE_T yysize0 = yytnamerr (0, yytname[yytype]);      YYSIZE_T yysize = yysize0;      YYSIZE_T yysize1;      int yysize_overflow = 0;      enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };      char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];      int yyx;# if 0      /* This is so xgettext sees the translatable formats that are	 constructed on the fly.  */      YY_("syntax error, unexpected %s");      YY_("syntax error, unexpected %s, expecting %s");      YY_("syntax error, unexpected %s, expecting %s or %s");      YY_("syntax error, unexpected %s, expecting %s or %s or %s");      YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s");# endif      char *yyfmt;      char const *yyf;      static char const yyunexpected[] = "syntax error, unexpected %s";      static char const yyexpecting[] = ", expecting %s";      static char const yyor[] = " or %s";      char yyformat[sizeof yyunexpected		    + sizeof yyexpecting - 1		    + ((YYERROR_VERBOSE_ARGS_MAXIMUM - 2)		       * (sizeof yyor - 1))];      char const *yyprefix = yyexpecting;      /* Start YYX at -YYN if negative to avoid negative indexes in	 YYCHECK.  */      int yyxbegin = yyn < 0 ? -yyn : 0;      /* Stay within bounds of both yycheck and yytname.  */      int yychecklim = YYLAST - yyn + 1;      int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;      int yycount = 1;      yyarg[0] = yytname[yytype];      yyfmt = yystpcpy (yyformat, yyunexpected);      for (yyx = yyxbegin; yyx < yyxend; ++yyx)	if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)	  {	    if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)	      {		yycount = 1;		yysize = yysize0;		yyformat[sizeof yyunexpected - 1] = '\0';		break;	      }	    yyarg[yycount++] = yytname[yyx];	    yysize1 = yysize + yytnamerr (0, yytname[yyx]);	    yysize_overflow |= (yysize1 < yysize);	    yysize = yysize1;	    yyfmt = yystpcpy (yyfmt, yyprefix);	    yyprefix = yyor;	  }      yyf = YY_(yyformat);      yysize1 = yysize + yystrlen (yyf);      yysize_overflow |= (yysize1 < yysize);      yysize = yysize1;      if (yysize_overflow)	return YYSIZE_MAXIMUM;      if (yyresult)	{	  /* Avoid sprintf, as that infringes on the user's name space.	     Don't have undefined behavior even if the translation	     produced a string with the wrong number of "%s"s.  */	  char *yyp = yyresult;	  int yyi = 0;	  while ((*yyp = *yyf) != '\0')	    {	      if (*yyp == '%' && yyf[1] == 's' && yyi < yycount)		{		  yyp += yytnamerr (yyp, yyarg[yyi++]);		  yyf += 2;		}	      else		{		  yyp++;		  yyf++;		}	    }	}      return yysize;    }}#endif /* YYERROR_VERBOSE *//*-----------------------------------------------.| Release the memory associated to this symbol.  |`-----------------------------------------------*//*ARGSUSED*/#if (defined __STDC__ || defined __C99__FUNC__ \     || defined __cplusplus || defined _MSC_VER)static voidyydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep)#elsestatic voidyydestruct (yymsg, yytype, yyvaluep)    const char *yymsg;    int yytype;    YYSTYPE *yyvaluep;#endif{  YYUSE (yyvaluep);  if (!yymsg)    yymsg = "Deleting";  YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);  switch (yytype)    {      default:	break;    }}/* Prevent warnings from -Wmissing-prototypes.  */#ifdef YYPARSE_PARAM#if defined __STDC__ || defined __cplusplusint yyparse (void *YYPARSE_PARAM);#elseint yyparse ();#endif#else /* ! YYPARSE_PARAM */#if defined __STDC__ || defined __cplusplusint yyparse (void);#elseint yyparse ();#endif#endif /* ! YYPARSE_PARAM *//* The look-ahead symbol.  */int yychar;/* The semantic value of the look-ahead symbol.  */YYSTYPE yylval;/* Number of syntax errors so far.  */int yynerrs;/*----------.| yyparse.  |`----------*/#ifdef YYPARSE_PARAM#if (defined __STDC__ || defined __C99__FUNC__ \     || defined __cplusplus || defined _MSC_VER)intyyparse (void *YYPARSE_PARAM)#elseintyyparse (YYPARSE_PARAM)    void *YYPARSE_PARAM;#endif#else /* ! YYPARSE_PARAM */#if (defined __STDC__ || defined __C99__FUNC__ \     || defined __cplusplus || defined _MSC_VER)intyyparse (void)#elseintyyparse ()#endif#endif{    int yystate;  int yyn;  int yyresult;  /* Number of tokens to shift before error messages enabled.  */  int yyerrstatus;  /* Look-ahead token as an internal (translated) token number.  */  int yytoken = 0;#if YYERROR_VERBOSE  /* Buffer for error messages, and its allocated size.  */  char yymsgbuf[128];  char *yymsg = yymsgbuf;  YYSIZE_T yymsg_alloc = sizeof yymsgbuf;#endif  /* Three stacks and their tools:     `yyss': related to states,     `yyvs': related to semantic values,     `yyls': related to locations.     Refer to the stacks thru separate pointers, to allow yyoverflow     to reallocate them elsewhere.  */  /* The state stack.  */  yytype_int16 yyssa[YYINITDEPTH];  yytype_int16 *yyss = yyssa;  yytype_int16 *yyssp;  /* The semantic value stack.  */  YYSTYPE yyvsa[YYINITDEPTH];  YYSTYPE *yyvs = yyvsa;  YYSTYPE *yyvsp;#define YYPOPSTACK(N)   (yyvsp -= (N), yyssp -= (N))  YYSIZE_T yystacksize = YYINITDEPTH;  /* The variables used to return semantic value and location from the     action routines.  */  YYSTYPE yyval;  /* The number of symbols on the RHS of the reduced rule.     Keep to zero when no symbol should be popped.  */  int yylen = 0;  YYDPRINTF ((stderr, "Starting parse\n"));  yystate = 0;  yyerrstatus = 0;  yynerrs = 0;  yychar = YYEMPTY;		/* Cause a token to be read.  */  /* Initialize stack pointers.     Waste one element of value and location stack     so that they stay on the same level as the state stack.     The wasted elements are never initialized.  */  yyssp = yyss;  yyvsp = yyvs;  goto yysetstate;/*------------------------------------------------------------.| yynewstate -- Push a new state, which is found in yystate.  |`------------------------------------------------------------*/ yynewstate:  /* In all cases, when you get here, the value and location stacks     have just been pushed.  So pushing a state here evens the stacks.  */  yyssp++; yysetstate:  *yyssp = yystate;  if (yyss + yystacksize - 1 <= yyssp)    {      /* Get the current used size of the three stacks, in elements.  */      YYSIZE_T yysize = yyssp - yyss + 1;#ifdef yyoverflow      {	/* Give user a chance to reallocate the stack.  Use copies of	   these so that the &'s don't force the real ones into	   memory.  */	YYSTYPE *yyvs1 = yyvs;	yytype_int16 *yyss1 = yyss;	/* Each stack pointer address is followed by the size of the	   data in use in that stack, in bytes.  This used to be a	   conditional around just the two extra args, but that might	   be undefined if yyoverflow is a macro.  */	yyoverflow (YY_("memory exhausted"),		    &yyss1, yysize * sizeof (*yyssp),		    &yyvs1, yysize * sizeof (*yyvsp),		    &yystacksize);	yyss = yyss1;	yyvs = yyvs1;      }#else /* no yyoverflow */# ifndef YYSTACK_RELOCATE      goto yyexhaustedlab;# else      /* Extend the stack our own way.  */      if (YYMAXDEPTH <= yystacksize)	goto yyexhaustedlab;      yystacksize *= 2;      if (YYMAXDEPTH < yystacksize)	yystacksize = YYMAXDEPTH;      {	yytype_int16 *yyss1 = yyss;	union yyalloc *yyptr =	  (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));	if (! yyptr)	  goto yyexhaustedlab;	YYSTACK_RELOCATE (yyss);	YYSTACK_RELOCATE (yyvs);#  undef YYSTACK_RELOCATE	if (yyss1 != yyssa)	  YYSTACK_FREE (yyss1);      }# endif#endif /* no yyoverflow */      yyssp = yyss + yysize - 1;      yyvsp = yyvs + yysize - 1;      YYDPRINTF ((stderr, "Stack size increased to %lu\n",		  (unsigned long int) yystacksize));      if (yyss + yystacksize - 1 <= yyssp)	YYABORT;    }  YYDPRINTF ((stderr, "Entering state %d\n", yystate));  goto yybackup;/*-----------.| yybackup.  |`-----------*/yybackup:  /* Do appropriate processing given the current state.  Read a     look-ahead token if we need one and don't already have one.  */  /* First try to decide what to do without reference to look-ahead token.  */  yyn = yypact[yystate];  if (yyn == YYPACT_NINF)    goto yydefault;  /* Not known => get a look-ahead token if don't already have one.  */  /* YYCHAR is either YYEMPTY or YYEOF or a valid look-ahead symbol.  */  if (yychar == YYEMPTY)    {      YYDPRINTF ((stderr, "Reading a token: "));      yychar = YYLEX;    }  if (yychar <= YYEOF)    {      yychar = yytoken = YYEOF;      YYDPRINTF ((stderr, "Now at end of input.\n"));    }  else    {      yytoken = YYTRANSLATE (yychar);      YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc);    }  /* If the proper action on seeing token YYTOKEN is to reduce or to     detect an error, take that action.  */  yyn += yytoken;  if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)    goto yydefault;  yyn = yytable[yyn];  if (yyn <= 0)    {      if (yyn == 0 || yyn == YYTABLE_NINF)	goto yyerrlab;      yyn = -yyn;      goto yyreduce;    }  if (yyn == YYFINAL)    YYACCEPT;  /* Count tokens shifted since error; after three, turn off error     status.  */  if (yyerrstatus)    yyerrstatus--;  /* Shift the look-ahead token.  */  YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);  /* Discard the shifted token unless it is eof.  */  if (yychar != YYEOF)    yychar = YYEMPTY;  yystate = yyn;  *++yyvsp = yylval;  goto yynewstate;/*-----------------------------------------------------------.| yydefault -- do the default action for the current state.  |`-----------------------------------------------------------*/yydefault:  yyn = yydefact[yystate];  if (yyn == 0)    goto yyerrlab;  goto yyreduce;/*-----------------------------.| yyreduce -- Do a reduction.  |`-----------------------------*/yyreduce:  /* yyn is the number of a rule to reduce with.  */  yylen = yyr2[yyn];  /* If YYLEN is nonzero, implement the default value of the action:     `$$ = $1'.     Otherwise, the following line sets YYVAL to garbage.     This behavior is undocumented and Bison     users should not rely upon it.  Assigning to YYVAL     unconditionally makes the parser a bit smaller, and it avoids a     GCC warning that YYVAL may be used uninitialized.  */  yyval = yyvsp[1-yylen];  YY_REDUCE_PRINT (yyn);  switch (yyn)    {        case 6:#line 83 "parser.y"    {			cfg_error("Invalid statement '%s'", (yyvsp[(1) - (1)].str));		}    break;  case 7:#line 87 "parser.y"    {			yyclearin; yyerrok;		}    break;  case 8:#line 93 "parser.y"    {				parser_device = &default_device;			}    break;  case 9:#line 97 "parser.y"    {				parser_device = alloc_device_opts((yyvsp[(2) - (2)].str));			}    break;  case 10:#line 101 "parser.y"    {				parser_device = alloc_device_opts((yyvsp[(2) - (2)].str));			}    break;  case 16:#line 109 "parser.y"    {				hcid.auto_init = (yyvsp[(2) - (2)].num);			}    break;  case 17:#line 113 "parser.y"    {				hcid.security = (yyvsp[(2) - (2)].num);			}    break;  case 18:#line 117 "parser.y"    {				hcid.pairing = (yyvsp[(2) - (2)].num);			}    break;  case 19:#line 121 "parser.y"    {				hcid.offmode = (yyvsp[(2) - (2)].num);			}    break;  case 20:#line 125 "parser.y"    {				strncpy((char *) hcid.deviceid, (yyvsp[(2) - (2)].str), 15);			}

⌨️ 快捷键说明

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