MCPcopy Create free account
hub / github.com/boostorg/build / yysyntax_error

Function yysyntax_error

v2/engine/jamgram.c:1175–1274  ·  view source on GitHub ↗

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 du

Source from the content-addressed store, hash-verified

1173 copied. As a special case, return 0 if an ordinary "syntax error"
1174 message will do. Return YYSIZE_MAXIMUM if overflow occurs during
1175 size calculation. */
1176static YYSIZE_T
1177yysyntax_error (char *yyresult, int yystate, int yychar)
1178{
1179 int yyn = yypact[yystate];
1180
1181 if (! (YYPACT_NINF < yyn && yyn <= YYLAST))
1182 return 0;
1183 else
1184 {
1185 int yytype = YYTRANSLATE (yychar);
1186 YYSIZE_T yysize0 = yytnamerr (0, yytname[yytype]);
1187 YYSIZE_T yysize = yysize0;
1188 YYSIZE_T yysize1;
1189 int yysize_overflow = 0;
1190 enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
1191 char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
1192 int yyx;
1193
1194# if 0
1195 /* This is so xgettext sees the translatable formats that are
1196 constructed on the fly. */
1197 YY_("syntax error, unexpected %s");
1198 YY_("syntax error, unexpected %s, expecting %s");
1199 YY_("syntax error, unexpected %s, expecting %s or %s");
1200 YY_("syntax error, unexpected %s, expecting %s or %s or %s");
1201 YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s");
1202# endif
1203 char *yyfmt;
1204 char const *yyf;
1205 static char const yyunexpected[] = "syntax error, unexpected %s";
1206 static char const yyexpecting[] = ", expecting %s";
1207 static char const yyor[] = " or %s";
1208 char yyformat[sizeof yyunexpected
1209 + sizeof yyexpecting - 1
1210 + ((YYERROR_VERBOSE_ARGS_MAXIMUM - 2)
1211 * (sizeof yyor - 1))];
1212 char const *yyprefix = yyexpecting;
1213
1214 /* Start YYX at -YYN if negative to avoid negative indexes in
1215 YYCHECK. */
1216 int yyxbegin = yyn < 0 ? -yyn : 0;
1217
1218 /* Stay within bounds of both yycheck and yytname. */
1219 int yychecklim = YYLAST - yyn + 1;
1220 int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
1221 int yycount = 1;
1222
1223 yyarg[0] = yytname[yytype];
1224 yyfmt = yystpcpy (yyformat, yyunexpected);
1225
1226 for (yyx = yyxbegin; yyx < yyxend; ++yyx)
1227 if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
1228 {
1229 if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
1230 {
1231 yycount = 1;
1232 yysize = yysize0;

Callers 1

jamgram.cFile · 0.85

Calls 2

yytnamerrFunction · 0.85
yystrlenFunction · 0.85

Tested by

no test coverage detected