Copy into *YYMSG, which is of size *YYMSG_ALLOC, an error message about the unexpected token YYTOKEN for the state stack whose top is YYSSP. Return 0 if *YYMSG was successfully written. Return -1 if *YYMSG is not large enough to hold the message. In that case, also set *YYMSG_ALLOC to the required number of bytes. Return YYENOMEM if the required number of bytes is too large t
| 2102 | *YYMSG_ALLOC to the required number of bytes. Return YYENOMEM if the |
| 2103 | required number of bytes is too large to store. */ |
| 2104 | static int |
| 2105 | yysyntax_error (YYPTRDIFF_T *yymsg_alloc, char **yymsg, |
| 2106 | const yypcontext_t *yyctx) |
| 2107 | { |
| 2108 | enum { YYARGS_MAX = 5 }; |
| 2109 | /* Internationalized format string. */ |
| 2110 | const char *yyformat = YY_NULLPTR; |
| 2111 | /* Arguments of yyformat: reported tokens (one for the "unexpected", |
| 2112 | one per "expected"). */ |
| 2113 | yysymbol_kind_t yyarg[YYARGS_MAX]; |
| 2114 | /* Cumulated lengths of YYARG. */ |
| 2115 | YYPTRDIFF_T yysize = 0; |
| 2116 | |
| 2117 | /* Actual size of YYARG. */ |
| 2118 | int yycount = yy_syntax_error_arguments (yyctx, yyarg, YYARGS_MAX); |
| 2119 | if (yycount == YYENOMEM) |
| 2120 | return YYENOMEM; |
| 2121 | |
| 2122 | switch (yycount) |
| 2123 | { |
| 2124 | #define YYCASE_(N, S) \ |
| 2125 | case N: \ |
| 2126 | yyformat = S; \ |
| 2127 | break |
| 2128 | default: /* Avoid compiler warnings. */ |
| 2129 | YYCASE_(0, YY_("syntax error")); |
| 2130 | YYCASE_(1, YY_("syntax error, unexpected %s")); |
| 2131 | YYCASE_(2, YY_("syntax error, unexpected %s, expecting %s")); |
| 2132 | YYCASE_(3, YY_("syntax error, unexpected %s, expecting %s or %s")); |
| 2133 | YYCASE_(4, YY_("syntax error, unexpected %s, expecting %s or %s or %s")); |
| 2134 | YYCASE_(5, YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s")); |
| 2135 | #undef YYCASE_ |
| 2136 | } |
| 2137 | |
| 2138 | /* Compute error message size. Don't count the "%s"s, but reserve |
| 2139 | room for the terminator. */ |
| 2140 | yysize = yystrlen (yyformat) - 2 * yycount + 1; |
| 2141 | { |
| 2142 | int yyi; |
| 2143 | for (yyi = 0; yyi < yycount; ++yyi) |
| 2144 | { |
| 2145 | YYPTRDIFF_T yysize1 |
| 2146 | = yysize + yytnamerr (YY_NULLPTR, yytname[yyarg[yyi]]); |
| 2147 | if (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM) |
| 2148 | yysize = yysize1; |
| 2149 | else |
| 2150 | return YYENOMEM; |
| 2151 | } |
| 2152 | } |
| 2153 | |
| 2154 | if (*yymsg_alloc < yysize) |
| 2155 | { |
| 2156 | *yymsg_alloc = 2 * yysize; |
| 2157 | if (! (yysize <= *yymsg_alloc |
| 2158 | && *yymsg_alloc <= YYSTACK_ALLOC_MAXIMUM)) |
| 2159 | *yymsg_alloc = YYSTACK_ALLOC_MAXIMUM; |
| 2160 | return -1; |
| 2161 | } |
no test coverage detected
searching dependent graphs…