PostGIS  3.0.6dev-r@@SVN_REVISION@@

◆ yysyntax_error()

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

Definition at line 1249 of file lwin_wkt_parse.c.

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