PostGIS  2.3.8dev-r@@SVN_REVISION@@

◆ yysyntax_error()

static int yysyntax_error ( YYSIZE_T yymsg_alloc,
char **  yymsg,
yytype_int16 yyssp,
int  yytoken 
)
static

Definition at line 1267 of file lwin_wkt_parse.c.

References YY_, YY_NULLPTR, YYCASE_, yycheck, YYEMPTY, YYLAST, YYNTOKENS, yypact, yypact_value_is_default, YYSIZE_T, YYSTACK_ALLOC_MAXIMUM, yystrlen(), yytable, yytable_value_is_error, YYTERROR, yytname, and yytnamerr().

1269 {
1270  YYSIZE_T yysize0 = yytnamerr (YY_NULLPTR, yytname[yytoken]);
1271  YYSIZE_T yysize = yysize0;
1272  enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
1273  /* Internationalized format string. */
1274  const char *yyformat = YY_NULLPTR;
1275  /* Arguments of yyformat. */
1276  char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
1277  /* Number of reported tokens (one for the "unexpected", one per
1278  "expected"). */
1279  int yycount = 0;
1280 
1281  /* There are many possibilities here to consider:
1282  - If this state is a consistent state with a default action, then
1283  the only way this function was invoked is if the default action
1284  is an error action. In that case, don't check for expected
1285  tokens because there are none.
1286  - The only way there can be no lookahead present (in yychar) is if
1287  this state is a consistent state with a default action. Thus,
1288  detecting the absence of a lookahead is sufficient to determine
1289  that there is no unexpected or expected token to report. In that
1290  case, just report a simple "syntax error".
1291  - Don't assume there isn't a lookahead just because this state is a
1292  consistent state with a default action. There might have been a
1293  previous inconsistent state, consistent state with a non-default
1294  action, or user semantic action that manipulated yychar.
1295  - Of course, the expected token list depends on states to have
1296  correct lookahead information, and it depends on the parser not
1297  to perform extra reductions after fetching a lookahead from the
1298  scanner and before detecting a syntax error. Thus, state merging
1299  (from LALR or IELR) and default reductions corrupt the expected
1300  token list. However, the list is correct for canonical LR with
1301  one exception: it will still contain any token that will not be
1302  accepted due to an error action in a later state.
1303  */
1304  if (yytoken != YYEMPTY)
1305  {
1306  int yyn = yypact[*yyssp];
1307  yyarg[yycount++] = yytname[yytoken];
1308  if (!yypact_value_is_default (yyn))
1309  {
1310  /* Start YYX at -YYN if negative to avoid negative indexes in
1311  YYCHECK. In other words, skip the first -YYN actions for
1312  this state because they are default actions. */
1313  int yyxbegin = yyn < 0 ? -yyn : 0;
1314  /* Stay within bounds of both yycheck and yytname. */
1315  int yychecklim = YYLAST - yyn + 1;
1316  int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
1317  int yyx;
1318 
1319  for (yyx = yyxbegin; yyx < yyxend; ++yyx)
1320  if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR
1321  && !yytable_value_is_error (yytable[yyx + yyn]))
1322  {
1323  if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
1324  {
1325  yycount = 1;
1326  yysize = yysize0;
1327  break;
1328  }
1329  yyarg[yycount++] = yytname[yyx];
1330  {
1331  YYSIZE_T yysize1 = yysize + yytnamerr (YY_NULLPTR, yytname[yyx]);
1332  if (! (yysize <= yysize1
1333  && yysize1 <= YYSTACK_ALLOC_MAXIMUM))
1334  return 2;
1335  yysize = yysize1;
1336  }
1337  }
1338  }
1339  }
1340 
1341  switch (yycount)
1342  {
1343 # define YYCASE_(N, S) \
1344  case N: \
1345  yyformat = S; \
1346  break
1347  YYCASE_(0, YY_("syntax error"));
1348  YYCASE_(1, YY_("syntax error, unexpected %s"));
1349  YYCASE_(2, YY_("syntax error, unexpected %s, expecting %s"));
1350  YYCASE_(3, YY_("syntax error, unexpected %s, expecting %s or %s"));
1351  YYCASE_(4, YY_("syntax error, unexpected %s, expecting %s or %s or %s"));
1352  YYCASE_(5, YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s"));
1353 # undef YYCASE_
1354  }
1355 
1356  {
1357  YYSIZE_T yysize1 = yysize + yystrlen (yyformat);
1358  if (! (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM))
1359  return 2;
1360  yysize = yysize1;
1361  }
1362 
1363  if (*yymsg_alloc < yysize)
1364  {
1365  *yymsg_alloc = 2 * yysize;
1366  if (! (yysize <= *yymsg_alloc
1367  && *yymsg_alloc <= YYSTACK_ALLOC_MAXIMUM))
1368  *yymsg_alloc = YYSTACK_ALLOC_MAXIMUM;
1369  return 1;
1370  }
1371 
1372  /* Avoid sprintf, as that infringes on the user's name space.
1373  Don't have undefined behavior even if the translation
1374  produced a string with the wrong number of "%s"s. */
1375  {
1376  char *yyp = *yymsg;
1377  int yyi = 0;
1378  while ((*yyp = *yyformat) != '\0')
1379  if (*yyp == '%' && yyformat[1] == 's' && yyi < yycount)
1380  {
1381  yyp += yytnamerr (yyp, yyarg[yyi++]);
1382  yyformat += 2;
1383  }
1384  else
1385  {
1386  yyp++;
1387  yyformat++;
1388  }
1389  }
1390  return 0;
1391 }
#define YYCASE_(N, S)
#define YY_NULLPTR
#define yypact_value_is_default(Yystate)
static YYSIZE_T yystrlen(const char *yystr)
#define YYTERROR
#define YYEMPTY
static const yytype_uint8 yycheck[]
#define yytable_value_is_error(Yytable_value)
#define YYNTOKENS
#define YYSTACK_ALLOC_MAXIMUM
static const char *const yytname[]
#define YY_(Msgid)
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: