diff options
Diffstat (limited to 'btyaccpar.c')
-rw-r--r-- | btyaccpar.c | 51 |
1 files changed, 28 insertions, 23 deletions
diff --git a/btyaccpar.c b/btyaccpar.c index 786978afd817..64a9febd17e4 100644 --- a/btyaccpar.c +++ b/btyaccpar.c @@ -2,7 +2,7 @@ * @Id: skel2c,v 1.4 2016/06/07 00:26:09 tom Exp @ */ -/* @Id: btyaccpar.skel,v 1.6 2017/04/30 23:40:34 tom Exp @ */ +/* @Id: btyaccpar.skel,v 1.10 2018/05/25 01:03:46 tom Exp @ */ #include "defs.h" @@ -78,8 +78,9 @@ const char *const tables[] = const char *const global_vars[] = { "", + "#if YYDEBUG", "int yydebug;", - "int yynerrs;", + "#endif", 0 }; @@ -90,6 +91,8 @@ const char *const impure_vars[] = "int yychar;", "YYSTYPE yyval;", "YYSTYPE yylval;", + "int yynerrs;", + "", "#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)", "YYLTYPE yyloc; /* position returned by actions */", "YYLTYPE yylloc; /* position from the lexer */", @@ -107,17 +110,17 @@ const char *const hdr_defs[] = "{ \\", " if (n == 0) \\", " { \\", - " (loc).first_line = ((rhs)[-1]).last_line; \\", - " (loc).first_column = ((rhs)[-1]).last_column; \\", - " (loc).last_line = ((rhs)[-1]).last_line; \\", - " (loc).last_column = ((rhs)[-1]).last_column; \\", + " (loc).first_line = YYRHSLOC(rhs, 0).last_line; \\", + " (loc).first_column = YYRHSLOC(rhs, 0).last_column; \\", + " (loc).last_line = YYRHSLOC(rhs, 0).last_line; \\", + " (loc).last_column = YYRHSLOC(rhs, 0).last_column; \\", " } \\", " else \\", " { \\", - " (loc).first_line = ((rhs)[ 0 ]).first_line; \\", - " (loc).first_column = ((rhs)[ 0 ]).first_column; \\", - " (loc).last_line = ((rhs)[n-1]).last_line; \\", - " (loc).last_column = ((rhs)[n-1]).last_column; \\", + " (loc).first_line = YYRHSLOC(rhs, 1).first_line; \\", + " (loc).first_column = YYRHSLOC(rhs, 1).first_column; \\", + " (loc).last_line = YYRHSLOC(rhs, n).last_line; \\", + " (loc).last_column = YYRHSLOC(rhs, n).last_column; \\", " } \\", "} while (0)", "#endif /* YYLLOC_DEFAULT */", @@ -232,6 +235,8 @@ const char *const body_vars[] = " int yychar;", " YYSTYPE yyval;", " YYSTYPE yylval;", + " int yynerrs;", + "", "#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)", " YYLTYPE yyloc; /* position returned by actions */", " YYLTYPE yylloc; /* position from the lexer */", @@ -436,7 +441,7 @@ const char *const body_2[] = "#endif /* YYBTYACC */", #endif /* defined(YYBTYACC) */ "#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)", - " YYLTYPE yyerror_loc_range[2]; /* position of error start & end */", + " YYLTYPE yyerror_loc_range[3]; /* position of error start/end (0 unused) */", "#endif", "#if YYDEBUG", " const char *yys;", @@ -525,10 +530,10 @@ const char *const body_3[] = " size_t s = (size_t) (yylvlim - yylvals);", "", " s += YYLVQUEUEGROWTH;", - " if ((yylexemes = realloc(yylexemes, s * sizeof(YYINT))) == NULL) goto yyenomem;", - " if ((yylvals = realloc(yylvals, s * sizeof(YYSTYPE))) == NULL) goto yyenomem;", + " if ((yylexemes = (YYINT *)realloc(yylexemes, s * sizeof(YYINT))) == NULL) goto yyenomem;", + " if ((yylvals = (YYSTYPE *)realloc(yylvals, s * sizeof(YYSTYPE))) == NULL) goto yyenomem;", "#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)", - " if ((yylpsns = realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL) goto yyenomem;", + " if ((yylpsns = (YYLTYPE *)realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL) goto yyenomem;", "#endif", " yylvp = yylve = yylvals + p;", " yylvlim = yylvals + s;", @@ -645,7 +650,7 @@ const char *const body_3[] = " /* If this is a first conflict in the stack, start saving lexemes */", " if (!yylexemes)", " {", - " yylexemes = malloc((YYLVQUEUEGROWTH) * sizeof(YYINT));", + " yylexemes = (YYINT *) malloc((YYLVQUEUEGROWTH) * sizeof(YYINT));", " if (yylexemes == NULL) goto yyenomem;", " yylvals = (YYSTYPE *) malloc((YYLVQUEUEGROWTH) * sizeof(YYSTYPE));", " if (yylvals == NULL) goto yyenomem;", @@ -858,7 +863,7 @@ const char *const body_3[] = "", " YYERROR_CALL(\"syntax error\");", "#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)", - " yyerror_loc_range[0] = yylloc; /* lookahead position is error start position */", + " yyerror_loc_range[1] = yylloc; /* lookahead position is error start position */", "#endif", "", "#if !YYBTYACC", @@ -887,7 +892,7 @@ const char *const body_3[] = " *++yystack.l_mark = yylval;", "#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)", " /* lookahead position is error end position */", - " yyerror_loc_range[1] = yylloc;", + " yyerror_loc_range[2] = yylloc;", " YYLLOC_DEFAULT(yyloc, yyerror_loc_range, 2); /* position of error span */", " *++yystack.p_mark = yyloc;", "#endif", @@ -903,7 +908,7 @@ const char *const body_3[] = " if (yystack.s_mark <= yystack.s_base) goto yyabort;", "#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)", " /* the current TOS position is the error start position */", - " yyerror_loc_range[0] = *yystack.p_mark;", + " yyerror_loc_range[1] = *yystack.p_mark;", "#endif", "#if defined(YYDESTRUCT_CALL)", #if defined(YYBTYACC) @@ -997,10 +1002,10 @@ const char *const body_3[] = "#endif /* YYBTYACC */", #endif /* defined(YYBTYACC) */ " {", - " YYLLOC_DEFAULT(yyloc, &yystack.p_mark[1-yym], yym);", + " YYLLOC_DEFAULT(yyloc, &yystack.p_mark[-yym], yym);", " /* just in case YYERROR is invoked within the action, save", " the start of the rhs as the error start position */", - " yyerror_loc_range[0] = yystack.p_mark[1-yym];", + " yyerror_loc_range[1] = yystack.p_mark[1-yym];", " }", "#endif", "", @@ -1068,12 +1073,12 @@ const char *const trailer[] = " size_t s = (size_t) (yylvlim - yylvals);", "", " s += YYLVQUEUEGROWTH;", - " if ((yylexemes = realloc(yylexemes, s * sizeof(YYINT))) == NULL)", + " if ((yylexemes = (YYINT *)realloc(yylexemes, s * sizeof(YYINT))) == NULL)", " goto yyenomem;", - " if ((yylvals = realloc(yylvals, s * sizeof(YYSTYPE))) == NULL)", + " if ((yylvals = (YYSTYPE *)realloc(yylvals, s * sizeof(YYSTYPE))) == NULL)", " goto yyenomem;", "#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)", - " if ((yylpsns = realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL)", + " if ((yylpsns = (YYLTYPE *)realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL)", " goto yyenomem;", "#endif", " yylvp = yylve = yylvals + p;", |