PostGIS  2.1.10dev-r@@SVN_REVISION@@
static int yysyntax_error ( YYSIZE_T yymsg_alloc,
char **  yymsg,
yytype_int16 yyssp,
int  yytoken 
)
static

Definition at line 1328 of file lwin_wkt_parse.c.

References YY_, YYCASE_, YYEMPTY, YYLAST, YYNTOKENS, yypact_value_is_default, YYSIZE_T, YYSTACK_ALLOC_MAXIMUM, yystrlen(), yytable_value_is_error, YYTERROR, and yytnamerr().

1330 {
1331  YYSIZE_T yysize0 = yytnamerr (0, yytname[yytoken]);
1332  YYSIZE_T yysize = yysize0;
1333  YYSIZE_T yysize1;
1334  enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
1335  /* Internationalized format string. */
1336  const char *yyformat = 0;
1337  /* Arguments of yyformat. */
1338  char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
1339  /* Number of reported tokens (one for the "unexpected", one per
1340  "expected"). */
1341  int yycount = 0;
1342 
1343  /* There are many possibilities here to consider:
1344  - Assume YYFAIL is not used. It's too flawed to consider. See
1345  <http://lists.gnu.org/archive/html/bison-patches/2009-12/msg00024.html>
1346  for details. YYERROR is fine as it does not invoke this
1347  function.
1348  - If this state is a consistent state with a default action, then
1349  the only way this function was invoked is if the default action
1350  is an error action. In that case, don't check for expected
1351  tokens because there are none.
1352  - The only way there can be no lookahead present (in yychar) is if
1353  this state is a consistent state with a default action. Thus,
1354  detecting the absence of a lookahead is sufficient to determine
1355  that there is no unexpected or expected token to report. In that
1356  case, just report a simple "syntax error".
1357  - Don't assume there isn't a lookahead just because this state is a
1358  consistent state with a default action. There might have been a
1359  previous inconsistent state, consistent state with a non-default
1360  action, or user semantic action that manipulated yychar.
1361  - Of course, the expected token list depends on states to have
1362  correct lookahead information, and it depends on the parser not
1363  to perform extra reductions after fetching a lookahead from the
1364  scanner and before detecting a syntax error. Thus, state merging
1365  (from LALR or IELR) and default reductions corrupt the expected
1366  token list. However, the list is correct for canonical LR with
1367  one exception: it will still contain any token that will not be
1368  accepted due to an error action in a later state.
1369  */
1370  if (yytoken != YYEMPTY)
1371  {
1372  int yyn = yypact[*yyssp];
1373  yyarg[yycount++] = yytname[yytoken];
1374  if (!yypact_value_is_default (yyn))
1375  {
1376  /* Start YYX at -YYN if negative to avoid negative indexes in
1377  YYCHECK. In other words, skip the first -YYN actions for
1378  this state because they are default actions. */
1379  int yyxbegin = yyn < 0 ? -yyn : 0;
1380  /* Stay within bounds of both yycheck and yytname. */
1381  int yychecklim = YYLAST - yyn + 1;
1382  int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
1383  int yyx;
1384 
1385  for (yyx = yyxbegin; yyx < yyxend; ++yyx)
1386  if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR
1387  && !yytable_value_is_error (yytable[yyx + yyn]))
1388  {
1389  if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
1390  {
1391  yycount = 1;
1392  yysize = yysize0;
1393  break;
1394  }
1395  yyarg[yycount++] = yytname[yyx];
1396  yysize1 = yysize + yytnamerr (0, yytname[yyx]);
1397  if (! (yysize <= yysize1
1398  && yysize1 <= YYSTACK_ALLOC_MAXIMUM))
1399  return 2;
1400  yysize = yysize1;
1401  }
1402  }
1403  }
1404 
1405  switch (yycount)
1406  {
1407 # define YYCASE_(N, S) \
1408  case N: \
1409  yyformat = S; \
1410  break
1411  YYCASE_(0, YY_("syntax error"));
1412  YYCASE_(1, YY_("syntax error, unexpected %s"));
1413  YYCASE_(2, YY_("syntax error, unexpected %s, expecting %s"));
1414  YYCASE_(3, YY_("syntax error, unexpected %s, expecting %s or %s"));
1415  YYCASE_(4, YY_("syntax error, unexpected %s, expecting %s or %s or %s"));
1416  YYCASE_(5, YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s"));
1417 # undef YYCASE_
1418  }
1419 
1420  yysize1 = yysize + yystrlen (yyformat);
1421  if (! (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM))
1422  return 2;
1423  yysize = yysize1;
1424 
1425  if (*yymsg_alloc < yysize)
1426  {
1427  *yymsg_alloc = 2 * yysize;
1428  if (! (yysize <= *yymsg_alloc
1429  && *yymsg_alloc <= YYSTACK_ALLOC_MAXIMUM))
1430  *yymsg_alloc = YYSTACK_ALLOC_MAXIMUM;
1431  return 1;
1432  }
1433 
1434  /* Avoid sprintf, as that infringes on the user's name space.
1435  Don't have undefined behavior even if the translation
1436  produced a string with the wrong number of "%s"s. */
1437  {
1438  char *yyp = *yymsg;
1439  int yyi = 0;
1440  while ((*yyp = *yyformat) != '\0')
1441  if (*yyp == '%' && yyformat[1] == 's' && yyi < yycount)
1442  {
1443  yyp += yytnamerr (yyp, yyarg[yyi++]);
1444  yyformat += 2;
1445  }
1446  else
1447  {
1448  yyp++;
1449  yyformat++;
1450  }
1451  }
1452  return 0;
1453 }
#define YYCASE_(N, S)
#define yytable_value_is_error(yytable_value)
#define YYTERROR
#define YYEMPTY
static const yytype_uint8 yycheck[]
#define yypact_value_is_default(yystate)
#define YYNTOKENS
#define YYSTACK_ALLOC_MAXIMUM
#define YY_(msgid)
static YYSIZE_T yystrlen(char *yystr) const
static const char *const yytname[]
static YYSIZE_T yytnamerr(char *yyres, const char *yystr)
#define YYSIZE_T
static const yytype_int16 yypact[]
#define YYLAST
static const yytype_uint16 yytable[]

Here is the call graph for this function: