PostGIS  3.7.0dev-r@@SVN_REVISION@@

◆ yysyntax_error()

static int yysyntax_error ( YYPTRDIFF_T yymsg_alloc,
char **  yymsg,
const yypcontext_t yyctx 
)
static

Definition at line 1422 of file lwin_wkt_parse.c.

1424 {
1425  enum { YYARGS_MAX = 5 };
1426  /* Internationalized format string. */
1427  const char *yyformat = YY_NULLPTR;
1428  /* Arguments of yyformat: reported tokens (one for the "unexpected",
1429  one per "expected"). */
1430  yysymbol_kind_t yyarg[YYARGS_MAX];
1431  /* Cumulated lengths of YYARG. */
1432  YYPTRDIFF_T yysize = 0;
1433 
1434  /* Actual size of YYARG. */
1435  int yycount = yy_syntax_error_arguments (yyctx, yyarg, YYARGS_MAX);
1436  if (yycount == YYENOMEM)
1437  return YYENOMEM;
1438 
1439  switch (yycount)
1440  {
1441 #define YYCASE_(N, S) \
1442  case N: \
1443  yyformat = S; \
1444  break
1445  default: /* Avoid compiler warnings. */
1446  YYCASE_(0, YY_("syntax error"));
1447  YYCASE_(1, YY_("syntax error, unexpected %s"));
1448  YYCASE_(2, YY_("syntax error, unexpected %s, expecting %s"));
1449  YYCASE_(3, YY_("syntax error, unexpected %s, expecting %s or %s"));
1450  YYCASE_(4, YY_("syntax error, unexpected %s, expecting %s or %s or %s"));
1451  YYCASE_(5, YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s"));
1452 #undef YYCASE_
1453  }
1454 
1455  /* Compute error message size. Don't count the "%s"s, but reserve
1456  room for the terminator. */
1457  yysize = yystrlen (yyformat) - 2 * yycount + 1;
1458  {
1459  int yyi;
1460  for (yyi = 0; yyi < yycount; ++yyi)
1461  {
1462  YYPTRDIFF_T yysize1
1463  = yysize + yytnamerr (YY_NULLPTR, yytname[yyarg[yyi]]);
1464  if (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM)
1465  yysize = yysize1;
1466  else
1467  return YYENOMEM;
1468  }
1469  }
1470 
1471  if (*yymsg_alloc < yysize)
1472  {
1473  *yymsg_alloc = 2 * yysize;
1474  if (! (yysize <= *yymsg_alloc
1475  && *yymsg_alloc <= YYSTACK_ALLOC_MAXIMUM))
1476  *yymsg_alloc = YYSTACK_ALLOC_MAXIMUM;
1477  return -1;
1478  }
1479 
1480  /* Avoid sprintf, as that infringes on the user's name space.
1481  Don't have undefined behavior even if the translation
1482  produced a string with the wrong number of "%s"s. */
1483  {
1484  char *yyp = *yymsg;
1485  int yyi = 0;
1486  while ((*yyp = *yyformat) != '\0')
1487  if (*yyp == '%' && yyformat[1] == 's' && yyi < yycount)
1488  {
1489  yyp += yytnamerr (yyp, yytname[yyarg[yyi++]]);
1490  yyformat += 2;
1491  }
1492  else
1493  {
1494  ++yyp;
1495  ++yyformat;
1496  }
1497  }
1498  return 0;
1499 }
static YYPTRDIFF_T yystrlen(const char *yystr)
yysymbol_kind_t
#define YY_(Msgid)
#define YYCASE_(N, S)
#define YY_NULLPTR
static YYPTRDIFF_T yytnamerr(char *yyres, const char *yystr)
#define YYSTACK_ALLOC_MAXIMUM
#define YYPTRDIFF_T
static const char *const yytname[]
@ YYENOMEM
static int yy_syntax_error_arguments(const yypcontext_t *yyctx, yysymbol_kind_t yyarg[], int yyargn)

References YY_, YY_NULLPTR, yy_syntax_error_arguments(), YYCASE_, YYENOMEM, YYPTRDIFF_T, YYSTACK_ALLOC_MAXIMUM, yystrlen(), yytname, and yytnamerr().

Here is the call graph for this function: