PostGIS  3.4.0dev-r@@SVN_REVISION@@

◆ yysyntax_error()

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

Definition at line 1225 of file lwin_wkt_parse.c.

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