diff options
author | DongHun Kwak <dh0128.kwak@samsung.com> | 2021-10-01 14:46:31 +0900 |
---|---|---|
committer | DongHun Kwak <dh0128.kwak@samsung.com> | 2021-10-01 14:46:31 +0900 |
commit | df8480a772d4352d0dff9a532d821c31893d9a78 (patch) | |
tree | e70e090d3fce311489de49c75e2b88d39b77563f /test | |
parent | 605f05e53d0fbc7ef4be1ab87aacc2649f8b9afa (diff) | |
download | byacc-df8480a772d4352d0dff9a532d821c31893d9a78.tar.gz byacc-df8480a772d4352d0dff9a532d821c31893d9a78.tar.bz2 byacc-df8480a772d4352d0dff9a532d821c31893d9a78.zip |
Imported Upstream version 20101126upstream/20101126
Diffstat (limited to 'test')
-rw-r--r-- | test/calc.tab.c | 8 | ||||
-rw-r--r-- | test/calc1.tab.c | 23 | ||||
-rw-r--r-- | test/calc1.tab.h | 9 | ||||
-rw-r--r-- | test/calc1.y | 6 | ||||
-rw-r--r-- | test/calc2.tab.c | 14 | ||||
-rw-r--r-- | test/calc2.y | 2 | ||||
-rw-r--r-- | test/calc3.tab.c | 14 | ||||
-rw-r--r-- | test/calc3.y | 2 | ||||
-rw-r--r-- | test/code_calc.code.c | 10 | ||||
-rw-r--r-- | test/code_error.code.c | 6 | ||||
-rw-r--r-- | test/error.tab.c | 6 | ||||
-rw-r--r-- | test/ftp.tab.c | 8 | ||||
-rw-r--r-- | test/grammar.tab.c | 8 | ||||
-rw-r--r-- | test/pure_calc.tab.c | 8 | ||||
-rw-r--r-- | test/pure_error.tab.c | 6 |
15 files changed, 93 insertions, 37 deletions
diff --git a/test/calc.tab.c b/test/calc.tab.c index 3d8f198..bd98caa 100644 --- a/test/calc.tab.c +++ b/test/calc.tab.c @@ -129,6 +129,10 @@ typedef int YYSTYPE; # define YYLEX yylex() #endif +/* Parameters sent to yyerror. */ +#define YYERROR_DECL() yyerror(const char *s) +#define YYERROR_CALL(msg) yyerror(msg) + extern int YYPARSE_DECL(); extern int YYLEX_DECL(); @@ -332,7 +336,7 @@ yylex(void) } return( c ); } -#line 336 "calc.tab.c" +#line 340 "calc.tab.c" #if YYDEBUG #include <stdio.h> /* needed for printf */ @@ -602,7 +606,7 @@ case 18: #line 60 "calc.y" { yyval = base * yystack.l_mark[-1] + yystack.l_mark[0]; } break; -#line 606 "calc.tab.c" +#line 610 "calc.tab.c" } yystack.s_mark -= yym; yystate = *yystack.s_mark; diff --git a/test/calc1.tab.c b/test/calc1.tab.c index 28b45cc..0597b94 100644 --- a/test/calc1.tab.c +++ b/test/calc1.tab.c @@ -118,13 +118,20 @@ double dreg[26]; INTERVAL vreg[26]; #line 27 "calc1.y" +#ifdef YYSTYPE +#undef YYSTYPE_IS_DECLARED +#define YYSTYPE_IS_DECLARED 1 +#endif +#ifndef YYSTYPE_IS_DECLARED +#define YYSTYPE_IS_DECLARED 1 typedef union { int ival; double dval; INTERVAL vval; } YYSTYPE; -#line 128 "calc1.tab.c" +#endif /* !YYSTYPE_IS_DECLARED */ +#line 135 "calc1.tab.c" /* compatibility with bison */ #ifdef YYPARSE_PARAM /* compatibility with FreeBSD */ @@ -146,6 +153,10 @@ typedef union # define YYLEX yylex() #endif +/* Parameters sent to yyerror. */ +#define YYERROR_DECL() yyerror(const char *s) +#define YYERROR_CALL(msg) yyerror(msg) + extern int YYPARSE_DECL(); extern int YYLEX_DECL(); @@ -368,7 +379,7 @@ yylex(void) { /* gobble up digits, points, exponents */ char buf[BSZ + 1], *cp = buf; - int dot = 0, exp = 0; + int dot = 0, expr = 0; for (; (cp - buf) < BSZ; ++cp, c = getchar()) { @@ -378,14 +389,14 @@ yylex(void) continue; if (c == '.') { - if (dot++ || exp) + if (dot++ || expr) return ('.'); /* will cause syntax error */ continue; } if (c == 'e') { - if (exp++) + if (expr++) return ('e'); /* will cause syntax error */ continue; } @@ -462,7 +473,7 @@ vdiv(double a, double b, INTERVAL v) { return (hilo(a / v.hi, a / v.lo, b / v.hi, b / v.lo)); } -#line 466 "calc1.tab.c" +#line 477 "calc1.tab.c" #if YYDEBUG #include <stdio.h> /* needed for printf */ @@ -835,7 +846,7 @@ case 28: yyval.vval = yystack.l_mark[-1].vval; } break; -#line 839 "calc1.tab.c" +#line 850 "calc1.tab.c" } yystack.s_mark -= yym; yystate = *yystack.s_mark; diff --git a/test/calc1.tab.h b/test/calc1.tab.h index 38927d5..c0633e3 100644 --- a/test/calc1.tab.h +++ b/test/calc1.tab.h @@ -2,12 +2,17 @@ #define VREG 258 #define CONST 259 #define UMINUS 260 -#if !(defined(YYSTYPE) || defined(YYSTYPE_IS_DECLARED)) +#ifdef YYSTYPE +#undef YYSTYPE_IS_DECLARED +#define YYSTYPE_IS_DECLARED 1 +#endif +#ifndef YYSTYPE_IS_DECLARED +#define YYSTYPE_IS_DECLARED 1 typedef union { int ival; double dval; INTERVAL vval; } YYSTYPE; -#endif /* !(YYSTYPE || YYSTYPE_IS_DECLARED) */ +#endif /* !YYSTYPE_IS_DECLARED */ extern YYSTYPE calc1_lval; diff --git a/test/calc1.y b/test/calc1.y index 2c0e55d..d99dd2d 100644 --- a/test/calc1.y +++ b/test/calc1.y @@ -205,7 +205,7 @@ yylex(void) { /* gobble up digits, points, exponents */ char buf[BSZ + 1], *cp = buf; - int dot = 0, exp = 0; + int dot = 0, expr = 0; for (; (cp - buf) < BSZ; ++cp, c = getchar()) { @@ -215,14 +215,14 @@ yylex(void) continue; if (c == '.') { - if (dot++ || exp) + if (dot++ || expr) return ('.'); /* will cause syntax error */ continue; } if (c == 'e') { - if (exp++) + if (expr++) return ('e'); /* will cause syntax error */ continue; } diff --git a/test/calc2.tab.c b/test/calc2.tab.c index 8a33361..5d863a5 100644 --- a/test/calc2.tab.c +++ b/test/calc2.tab.c @@ -126,6 +126,10 @@ typedef int YYSTYPE; # define YYLEX yylex(base) #endif +/* Parameters sent to yyerror. */ +#define YYERROR_DECL() yyerror(YYSTYPE *v, const char *s) +#define YYERROR_CALL(msg) yyerror(&yylval, msg) + extern int YYPARSE_DECL(); extern int YYLEX_DECL(); @@ -303,7 +307,7 @@ main (void) } static void -yyerror(const char *s) +YYERROR_DECL() { fprintf(stderr, "%s\n", s); } @@ -332,7 +336,7 @@ yylex(int *base) } return( c ); } -#line 336 "calc2.tab.c" +#line 340 "calc2.tab.c" #if YYDEBUG #include <stdio.h> /* needed for printf */ @@ -469,7 +473,7 @@ yyloop: } if (yyerrflag) goto yyinrecovery; - yyerror("syntax error"); + yyerror(&yylval, "syntax error"); goto yyerrlab; @@ -602,7 +606,7 @@ case 18: #line 62 "calc2.y" { yyval = (*base) * yystack.l_mark[-1] + yystack.l_mark[0]; } break; -#line 606 "calc2.tab.c" +#line 610 "calc2.tab.c" } yystack.s_mark -= yym; yystate = *yystack.s_mark; @@ -654,7 +658,7 @@ to state %d\n", YYPREFIX, *yystack.s_mark, yystate); goto yyloop; yyoverflow: - yyerror("yacc stack overflow"); + yyerror(&yylval, "yacc stack overflow"); yyabort: yyfreestack(&yystack); diff --git a/test/calc2.y b/test/calc2.y index 9bce132..ca6b74a 100644 --- a/test/calc2.y +++ b/test/calc2.y @@ -77,7 +77,7 @@ main (void) } static void -yyerror(const char *s) +YYERROR_DECL() { fprintf(stderr, "%s\n", s); } diff --git a/test/calc3.tab.c b/test/calc3.tab.c index b0a6b56..50b9009 100644 --- a/test/calc3.tab.c +++ b/test/calc3.tab.c @@ -126,6 +126,10 @@ typedef int YYSTYPE; # define YYLEX yylex(&yylval, base) #endif +/* Parameters sent to yyerror. */ +#define YYERROR_DECL() yyerror(YYSTYPE *v, const char *s) +#define YYERROR_CALL(msg) yyerror(&yylval, msg) + extern int YYPARSE_DECL(); extern int YYLEX_DECL(); @@ -296,7 +300,7 @@ main (void) } static void -yyerror(const char *s) +YYERROR_DECL() { fprintf(stderr, "%s\n", s); } @@ -325,7 +329,7 @@ YYLEX_DECL() } return( c ); } -#line 329 "calc3.tab.c" +#line 333 "calc3.tab.c" #if YYDEBUG #include <stdio.h> /* needed for printf */ @@ -469,7 +473,7 @@ yyloop: } if (yyerrflag) goto yyinrecovery; - yyerror("syntax error"); + yyerror(&yylval, "syntax error"); goto yyerrlab; @@ -602,7 +606,7 @@ case 18: #line 64 "calc3.y" { yyval = (*base) * yystack.l_mark[-1] + yystack.l_mark[0]; } break; -#line 606 "calc3.tab.c" +#line 610 "calc3.tab.c" } yystack.s_mark -= yym; yystate = *yystack.s_mark; @@ -654,7 +658,7 @@ to state %d\n", YYPREFIX, *yystack.s_mark, yystate); goto yyloop; yyoverflow: - yyerror("yacc stack overflow"); + yyerror(&yylval, "yacc stack overflow"); yyabort: yyfreestack(&yystack); diff --git a/test/calc3.y b/test/calc3.y index efca5eb..ce55a9c 100644 --- a/test/calc3.y +++ b/test/calc3.y @@ -79,7 +79,7 @@ main (void) } static void -yyerror(const char *s) +YYERROR_DECL() { fprintf(stderr, "%s\n", s); } diff --git a/test/code_calc.code.c b/test/code_calc.code.c index 38a45b5..6833def 100644 --- a/test/code_calc.code.c +++ b/test/code_calc.code.c @@ -21,7 +21,7 @@ static const char yysccsid[] = "@(#)yaccpar 1.9 (Berkeley) 02/21/93"; int regs[26]; int base; -#line 106 "code_calc.code.c" +#line 25 "code_calc.code.c" #ifndef YYSTYPE typedef int YYSTYPE; @@ -48,6 +48,10 @@ typedef int YYSTYPE; # define YYLEX yylex() #endif +/* Parameters sent to yyerror. */ +#define YYERROR_DECL() yyerror(const char *s) +#define YYERROR_CALL(msg) yyerror(msg) + extern int YYPARSE_DECL(); extern int YYLEX_DECL(); @@ -233,7 +237,7 @@ yylex(void) { } return( c ); } -#line 318 "code_calc.code.c" +#line 241 "code_calc.code.c" #if YYDEBUG #include <stdio.h> /* needed for printf */ @@ -503,7 +507,7 @@ case 18: #line 60 "code_calc.y" { yyval = base * yystack.l_mark[-1] + yystack.l_mark[0]; } break; -#line 588 "code_calc.code.c" +#line 511 "code_calc.code.c" } yystack.s_mark -= yym; yystate = *yystack.s_mark; diff --git a/test/code_error.code.c b/test/code_error.code.c index d45b8a4..35050b5 100644 --- a/test/code_error.code.c +++ b/test/code_error.code.c @@ -40,6 +40,10 @@ typedef int YYSTYPE; # define YYLEX yylex() #endif +/* Parameters sent to yyerror. */ +#define YYERROR_DECL() yyerror(const char *s) +#define YYERROR_CALL(msg) yyerror(msg) + extern int YYPARSE_DECL(); extern int YYLEX_DECL(); @@ -203,7 +207,7 @@ yyerror(const char* s) { printf("%s\n", s); } -#line 288 "code_error.code.c" +#line 211 "code_error.code.c" #if YYDEBUG #include <stdio.h> /* needed for printf */ diff --git a/test/error.tab.c b/test/error.tab.c index fd80e4e..66487ac 100644 --- a/test/error.tab.c +++ b/test/error.tab.c @@ -121,6 +121,10 @@ typedef int YYSTYPE; # define YYLEX yylex() #endif +/* Parameters sent to yyerror. */ +#define YYERROR_DECL() yyerror(const char *s) +#define YYERROR_CALL(msg) yyerror(msg) + extern int YYPARSE_DECL(); extern int YYLEX_DECL(); @@ -220,7 +224,7 @@ yyerror(const char* s) { printf("%s\n", s); } -#line 224 "error.tab.c" +#line 228 "error.tab.c" #if YYDEBUG #include <stdio.h> /* needed for printf */ diff --git a/test/ftp.tab.c b/test/ftp.tab.c index 93be71a..55f7de0 100644 --- a/test/ftp.tab.c +++ b/test/ftp.tab.c @@ -203,6 +203,10 @@ typedef int YYSTYPE; # define YYLEX yylex() #endif +/* Parameters sent to yyerror. */ +#define YYERROR_DECL() yyerror(const char *s) +#define YYERROR_CALL(msg) yyerror(msg) + extern int YYPARSE_DECL(); extern int YYLEX_DECL(); @@ -1062,7 +1066,7 @@ sizecmd(char *filename) reply(504, "SIZE not implemented for Type %c.", "?AEIL"[type]); } } -#line 1066 "ftp.tab.c" +#line 1070 "ftp.tab.c" #if YYDEBUG #include <stdio.h> /* needed for printf */ @@ -1908,7 +1912,7 @@ case 73: } } break; -#line 1912 "ftp.tab.c" +#line 1916 "ftp.tab.c" } yystack.s_mark -= yym; yystate = *yystack.s_mark; diff --git a/test/grammar.tab.c b/test/grammar.tab.c index f2d8b15..b8b16f6 100644 --- a/test/grammar.tab.c +++ b/test/grammar.tab.c @@ -396,6 +396,10 @@ haveAnsiParam (void) # define YYLEX yylex() #endif +/* Parameters sent to yyerror. */ +#define YYERROR_DECL() yyerror(const char *s) +#define YYERROR_CALL(msg) yyerror(msg) + extern int YYPARSE_DECL(); extern int YYLEX_DECL(); @@ -1064,7 +1068,7 @@ free_parser(void) #endif } #endif -#line 1068 "grammar.tab.c" +#line 1072 "grammar.tab.c" #if YYDEBUG #include <stdio.h> /* needed for printf */ @@ -1948,7 +1952,7 @@ case 114: yyval.declarator->func_def = FUNC_ANSI; } break; -#line 1952 "grammar.tab.c" +#line 1956 "grammar.tab.c" } yystack.s_mark -= yym; yystate = *yystack.s_mark; diff --git a/test/pure_calc.tab.c b/test/pure_calc.tab.c index 41c8e0f..5d10ba8 100644 --- a/test/pure_calc.tab.c +++ b/test/pure_calc.tab.c @@ -129,6 +129,10 @@ typedef int YYSTYPE; # define YYLEX yylex(&yylval) #endif +/* Parameters sent to yyerror. */ +#define YYERROR_DECL() yyerror(const char *s) +#define YYERROR_CALL(msg) yyerror(msg) + extern int YYPARSE_DECL(); extern int YYLEX_DECL(); @@ -325,7 +329,7 @@ yylex(YYSTYPE *value) } return( c ); } -#line 329 "pure_calc.tab.c" +#line 333 "pure_calc.tab.c" #if YYDEBUG #include <stdio.h> /* needed for printf */ @@ -602,7 +606,7 @@ case 18: #line 60 "pure_calc.y" { yyval = base * yystack.l_mark[-1] + yystack.l_mark[0]; } break; -#line 606 "pure_calc.tab.c" +#line 610 "pure_calc.tab.c" } yystack.s_mark -= yym; yystate = *yystack.s_mark; diff --git a/test/pure_error.tab.c b/test/pure_error.tab.c index 9076dd0..4bce3c8 100644 --- a/test/pure_error.tab.c +++ b/test/pure_error.tab.c @@ -121,6 +121,10 @@ typedef int YYSTYPE; # define YYLEX yylex(&yylval) #endif +/* Parameters sent to yyerror. */ +#define YYERROR_DECL() yyerror(const char *s) +#define YYERROR_CALL(msg) yyerror(msg) + extern int YYPARSE_DECL(); extern int YYLEX_DECL(); @@ -213,7 +217,7 @@ yyerror(const char* s) { printf("%s\n", s); } -#line 217 "pure_error.tab.c" +#line 221 "pure_error.tab.c" #if YYDEBUG #include <stdio.h> /* needed for printf */ |