PostGIS  2.5.7dev-r@@SVN_REVISION@@

◆ yysyntax_error()

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

Definition at line 1250 of file lwin_wkt_parse.c.

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

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().

Here is the call graph for this function: