diff options
author | DongHun Kwak <dh0128.kwak@samsung.com> | 2021-10-01 14:48:45 +0900 |
---|---|---|
committer | DongHun Kwak <dh0128.kwak@samsung.com> | 2021-10-01 14:48:45 +0900 |
commit | ae4f0c683c649b6df594cb47cda4825fda6af333 (patch) | |
tree | b13f7363679cbe46c5330c403b9f9ff6acd09b6d | |
parent | 72c77f8a5a5aeaca87e922e2920d9ce8404e4a0b (diff) | |
download | byacc-ae4f0c683c649b6df594cb47cda4825fda6af333.tar.gz byacc-ae4f0c683c649b6df594cb47cda4825fda6af333.tar.bz2 byacc-ae4f0c683c649b6df594cb47cda4825fda6af333.zip |
Imported Upstream version 20180525upstream/20180525
50 files changed, 782 insertions, 631 deletions
@@ -1,3 +1,41 @@ +2018-05-25 Thomas E. Dickey <dickey@invisible-island.net> + + * test/run_make.sh: + check if this is bison 3+ before adding options to suppress warnings + + * package/byacc.spec: build-fix for Mageia 6 + + * package/byacc.spec: add btyacc package + + * VERSION, package/byacc.spec, package/debian/changelog, package/mingw-byacc.spec, package/pkgsrc/Makefile: + bump + + * package/debian/control: add a package for btyacc + + * package/debian/rules: generate a package for btyacc + +2018-05-24 Thomas E. Dickey <dickey@invisible-island.net> + + * test/btyacc/pure_calc.tab.c, test/btyacc/pure_error.tab.c, test/btyacc/quote_calc-s.tab.c, test/btyacc/quote_calc.tab.c, test/btyacc/quote_calc2-s.tab.c, test/btyacc/quote_calc2.tab.c, test/btyacc/quote_calc3-s.tab.c, test/btyacc/quote_calc3.tab.c, test/btyacc/quote_calc4-s.tab.c, test/btyacc/quote_calc4.tab.c, test/btyacc/varsyntax_calc1.tab.c, test/btyacc/code_error.code.c, test/btyacc/empty.tab.c, test/btyacc/err_inherit3.tab.c, test/btyacc/err_inherit4.tab.c, test/btyacc/err_syntax10.tab.c, test/btyacc/err_syntax11.tab.c, test/btyacc/err_syntax12.tab.c, test/btyacc/err_syntax18.tab.c, test/btyacc/err_syntax20.tab.c, test/btyacc/error.tab.c, test/btyacc/expr.oxout.tab.c, test/btyacc/grammar.tab.c, test/btyacc/inherit0.tab.c, test/btyacc/inherit1.tab.c, test/btyacc/inherit2.tab.c, test/btyacc/ok_syntax1.tab.c, btyaccpar.c, test/btyacc/btyacc_calc1.tab.c, test/btyacc/btyacc_demo.tab.c, test/btyacc/btyacc_destroy1.tab.c, test/btyacc/btyacc_destroy2.tab.c, test/btyacc/btyacc_destroy3.tab.c, test/btyacc/calc.tab.c, test/btyacc/calc1.tab.c, test/btyacc/calc2.tab.c, test/btyacc/calc3.tab.c, test/btyacc/code_calc.code.c, test/btyacc/rename_debug.c: + regen + + * btyaccpar.skel: fix typo + +2018-05-21 Thomas E. Dickey <dickey@invisible-island.net> + + * test/run_make.sh: + ignore case for "%" directives to skip with old-yacc, and add %token-table + to the list + + * btyaccpar.c: regen + +2018-05-21 Christos.Zoulas + + * btyaccpar.skel: + improve compatibility with bison by changing the YYLLOC_DEFAULT macro to use + YYRHSLOC() macro, and adjusting the array indices of yyerror_loc_range[] for + consistency. + 2018-05-10 Thomas E. Dickey <dickey@invisible-island.net> * output.c: @@ -1,4 +1,4 @@ -MANIFEST for byacc-20180510, version t20180510 +MANIFEST for byacc-20180525, version t20180525 -------------------------------------------------------------------------------- MANIFEST this file ACKNOWLEDGEMENTS original version of byacc - 1993 @@ -1 +1 @@ -20180510 +20180525 diff --git a/btyaccpar.c b/btyaccpar.c index 1a344d8..3b6e59c 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.7 2017/05/01 00:13:19 tom Exp @ */ +/* @Id: btyaccpar.skel,v 1.9 2018/05/21 22:59:38 Christos.Zoulas Exp @ */ #include "defs.h" @@ -110,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 */", @@ -441,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;", @@ -863,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", @@ -892,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", @@ -908,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) @@ -1002,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", "", diff --git a/btyaccpar.skel b/btyaccpar.skel index da0a4f2..a26e093 100644 --- a/btyaccpar.skel +++ b/btyaccpar.skel @@ -1,4 +1,4 @@ -/* $Id: btyaccpar.skel,v 1.8 2018/05/10 00:40:40 tom Exp $ */ +/* $Id: btyaccpar.skel,v 1.10 2018/05/25 01:03:46 tom Exp $ */ #include "defs.h" @@ -77,17 +77,17 @@ do \ { \ 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 */ @@ -376,7 +376,7 @@ YYPARSE_DECL() YYParseState *yyerrctx = NULL; %%endif #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; @@ -778,7 +778,7 @@ yyerrhandler: 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 @@ -807,7 +807,7 @@ yyinrecovery: *++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 @@ -823,7 +823,7 @@ yyinrecovery: 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) %%ifdef YYBTYACC @@ -909,10 +909,10 @@ yyreduce: if (!yytrial) %%endif { - 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 diff --git a/package/byacc.spec b/package/byacc.spec index b1ff465..896a936 100644 --- a/package/byacc.spec +++ b/package/byacc.spec @@ -1,8 +1,9 @@ Summary: byacc - public domain Berkeley LALR Yacc parser generator %define AppProgram byacc -%define AppVersion 20180510 +%define AltProgram btyacc +%define AppVersion 20180525 %define UseProgram yacc -# $Id: byacc.spec,v 1.39 2018/05/10 08:59:09 tom Exp $ +# $Id: byacc.spec,v 1.42 2018/05/26 00:31:16 tom Exp $ Name: %{AppProgram} Version: %{AppVersion} Release: 1 @@ -10,7 +11,7 @@ License: Public Domain, MIT Group: Applications/Development URL: ftp://invisible-island.net/%{AppProgram} Source0: %{AppProgram}-%{AppVersion}.tgz -Packager: Thomas Dickey <dickey@invisible-island.net> +Packager: Thomas E. Dickey <dickey@invisible-island.net> %description This package provides a parser generator utility that reads a grammar @@ -19,6 +20,18 @@ parsers consist of a set of LALR(1) parsing tables and a driver routine written in the C programming language. It has a public domain license which includes the generated C. +%package -n btyacc +Summary: Curses library with POSIX thread support. + +%description -n btyacc +This package provides a parser generator utility that reads a grammar +specification from a file and generates an LR(1) parser for it. The +parsers consist of a set of LALR(1) parsing tables and a driver +routine written in the C programming language. It has a public domain +license which includes the generated C. + +This package has the backtracking extension. + %prep %define debug_package %{nil} @@ -26,23 +39,50 @@ license which includes the generated C. %setup -q -n %{AppProgram}-%{AppVersion} %build -%configure --verbose \ - --program-prefix=b \ - --target %{_target_platform} \ - --prefix=%{_prefix} \ - --bindir=%{_bindir} \ - --libdir=%{_libdir} \ - --mandir=%{_mandir} +%define my_srcdir .. +%define CFG_OPTS \\\ + --verbose \\\ + --disable-echo \\\ + --target %{_target_platform} \\\ + --prefix=%{_prefix} \\\ + --srcdir=%{my_srcdir} \\\ + --bindir=%{_bindir} \\\ + --libdir=%{_libdir} \\\ + --mandir=%{_mandir} + +%global _configure ../configure + +mkdir BUILD-byacc +pushd BUILD-byacc +CONFIGURE_TOP=%{my_srcdir} \ +%configure %{CFG_OPTS} \ + --program-prefix=b \ + --program-transform-name='s,\^,b,' +make +popd +mkdir BUILD-btyacc +pushd BUILD-btyacc +CONFIGURE_TOP=%{my_srcdir} \ +%configure %{CFG_OPTS} \ + --enable-btyacc \ + --program-prefix=bt \ + --with-max-table-size=18000 \ + --program-transform-name='s,\^,bt,' make +popd %install [ "$RPM_BUILD_ROOT" != "/" ] && rm -rf $RPM_BUILD_ROOT -make install DESTDIR=$RPM_BUILD_ROOT -( cd $RPM_BUILD_ROOT%{_bindir} && ln -s %{AppProgram} %{UseProgram} ) +pushd BUILD-byacc +make install DESTDIR=$RPM_BUILD_ROOT +( cd $RPM_BUILD_ROOT%{_bindir} && ln -vs %{AppProgram} %{UseProgram} ) +popd -strip $RPM_BUILD_ROOT%{_bindir}/%{AppProgram} +pushd BUILD-btyacc +make install DESTDIR=$RPM_BUILD_ROOT +popd %clean [ "$RPM_BUILD_ROOT" != "/" ] && rm -rf $RPM_BUILD_ROOT @@ -53,9 +93,17 @@ strip $RPM_BUILD_ROOT%{_bindir}/%{AppProgram} %{_prefix}/bin/%{UseProgram} %{_mandir}/man1/%{AppProgram}.* +%files -n btyacc +%defattr(-,root,root) +%{_prefix}/bin/%{AltProgram} +%{_mandir}/man1/%{AltProgram}.* + %changelog # each patch should add its ChangeLog entries here +* Fri May 25 2018 Thomas Dickey +- add btyacc package + * Sun Jul 09 2017 Thomas Dickey - use predefined "configure" diff --git a/package/debian/changelog b/package/debian/changelog index 6177033..d6c0cb1 100644 --- a/package/debian/changelog +++ b/package/debian/changelog @@ -1,3 +1,9 @@ +byacc (20180525) unstable; urgency=low + + * maintenance updates + + -- Thomas E. Dickey <dickey@invisible-island.net> Mon, 21 May 2018 18:50:44 -0400 + byacc (20180510) unstable; urgency=low * maintenance updates diff --git a/package/debian/control b/package/debian/control index 720aada..fccd907 100644 --- a/package/debian/control +++ b/package/debian/control @@ -1,7 +1,7 @@ Source: byacc -Maintainer: Dave Beckett <dajobe@debian.org> +Maintainer: Thomas E. Dickey <dickey@invisible-island.net> Section: devel -Priority: extra +Priority: optional Standards-Version: 3.8.4 Build-Depends: debhelper (>= 5) Homepage: http://invisible-island.net/byacc/ @@ -15,3 +15,15 @@ Description: public domain Berkeley LALR Yacc parser generator parsers consist of a set of LALR(1) parsing tables and a driver routine written in the C programming language. It has a public domain license which includes the generated C. + +Package: btyacc +Architecture: any +Depends: ${shlibs:Depends}, ${misc:Depends} +Description: public domain Berkeley LALR Yacc parser generator + This package provides a parser generator utility that reads a grammar + specification from a file and generates an LR(1) parser for it. The + parsers consist of a set of LALR(1) parsing tables and a driver + routine written in the C programming language. It has a public domain + license which includes the generated C. + . + This package has the backtracking extension. diff --git a/package/debian/rules b/package/debian/rules index ac10cdd..3db7e86 100755 --- a/package/debian/rules +++ b/package/debian/rules @@ -1,10 +1,6 @@ #!/usr/bin/make -f -# $Id: rules,v 1.2 2017/07/09 19:14:42 tom Exp $ +# $Id: rules,v 1.3 2018/05/25 20:03:37 tom Exp $ # -# Made with the aid of dh_make, by Craig Small -# Sample debian/rules that uses debhelper. GNU copyright 1997 by Joey Hess. -# Some lines taken from debmake, by Cristoph Lameter. - # Uncomment this to turn on verbose mode. #export DH_VERBOSE=1 @@ -13,6 +9,8 @@ DEB_HOST_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE) DEB_BUILD_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE) +PACKAGES.arch = byacc btyacc + CPPFLAGS := $(shell dpkg-buildflags --get CPPFLAGS) CFLAGS := $(shell dpkg-buildflags --get CFLAGS) LDFLAGS := $(shell dpkg-buildflags --get LDFLAGS) @@ -26,15 +24,19 @@ ifeq (,$(findstring nostrip,$(DEB_BUILD_OPTIONS))) INSTALL_PROGRAM += -s endif +BYACC_DIR = $(CURDIR)/debian/byacc +BTYACC_DIR = $(CURDIR)/debian/btyacc -configure: configure-stamp -configure-stamp: - dh_testdir +BYACC_TMP = t/byacc +BTYACC_TMP = t/btyacc + +verbose = # -v +configure = \ CPPFLAGS="$(CPPFLAGS)" \ CFLAGS="$(CFLAGS)" \ LDFLAGS="$(LDFLAGS)" \ - ./configure \ + ../../configure \ --host=$(DEB_HOST_GNU_TYPE) \ --build=$(DEB_BUILD_GNU_TYPE) \ --prefix=/usr \ @@ -42,59 +44,96 @@ configure-stamp: --sysconfdir=/etc \ --program-transform-name='s,^,b,' - touch configure-stamp +all: build -build: build-stamp -build-stamp: configure-stamp +config: config-arch +build: build-arch +install: install-arch +binary: binary-arch + +config-arch: $(PACKAGES.arch:%=config-%-stamp) +build-arch: $(PACKAGES.arch:%=build-%-stamp) +install-arch: $(PACKAGES.arch:%=install-%-stamp) + +config-byacc-stamp: dh_testdir - $(MAKE) + rm -rf $(BYACC_TMP) + mkdir -p $(BYACC_TMP) + cd $(BYACC_TMP); $(configure) - touch build-stamp + touch $@ -clean: +config-btyacc-stamp: dh_testdir - dh_testroot - [ ! -f Makefile ] || $(MAKE) clean + rm -rf $(BTYACC_TMP) + mkdir -p $(BTYACC_TMP) + cd $(BTYACC_TMP); $(configure) \ + --enable-btyacc \ + --with-max-table-size=18000 \ + --program-transform-name='s,^,bt,' + + touch $@ + +build-byacc-stamp: config-byacc-stamp + dh_testdir - rm -f configure-stamp build-stamp install-stamp \ - config.cache config.h config.status config.log makefile + cd $(BYACC_TMP); $(MAKE) + + touch $@ + +build-btyacc-stamp: config-btyacc-stamp + dh_testdir - rm -f *.o yacc + cd $(BTYACC_TMP); $(MAKE) - dh_clean + touch $@ -install: install-stamp -install-stamp: build-stamp +install-byacc-stamp: build-byacc-stamp dh_testdir dh_testroot - dh_clean -k dh_installdirs - $(MAKE) install DESTDIR=$(CURDIR)/debian/byacc + cd $(BYACC_TMP); $(MAKE) install DESTDIR=$(BYACC_DIR) - touch install-stamp + touch $@ -# Build architecture-independent files here. -binary-indep: build install -# No binary-indep target. +install-btyacc-stamp: build-btyacc-stamp + dh_testdir + dh_testroot + dh_installdirs + + cd $(BTYACC_TMP); $(MAKE) install DESTDIR=$(BTYACC_DIR) + + touch $@ + +clean: + dh_testdir + dh_testroot + + dh_clean $(verbose) + + rm -rf t # Build architecture-dependent files here. binary-arch: build install +ifneq ($(PACKAGES.arch),) + rm -f $(PACKAGES.arch:%=install-%-stamp) dh_testdir dh_testroot - dh_installdocs - dh_installexamples - dh_installchangelogs CHANGES - dh_strip - dh_compress - dh_fixperms - dh_installdeb - dh_shlibdeps - dh_gencontrol - dh_md5sums - dh_builddeb - -binary: binary-indep binary-arch -.PHONY: build clean binary-indep binary-arch binary install install-stamp + dh_lintian $(verbose) $(PACKAGES.arch:%=-p%) + dh_installdocs $(verbose) $(PACKAGES.arch:%=-p%) + dh_installexamples $(verbose) $(PACKAGES.arch:%=-p%) + dh_installchangelogs $(verbose) $(PACKAGES.arch:%=-p%) CHANGES + dh_strip $(verbose) $(PACKAGES.arch:%=-p%) + dh_compress $(verbose) $(PACKAGES.arch:%=-p%) + dh_fixperms $(verbose) $(PACKAGES.arch:%=-p%) + dh_installdeb $(verbose) $(PACKAGES.arch:%=-p%) + dh_shlibdeps $(verbose) $(PACKAGES.arch:%=-p%) + dh_gencontrol $(verbose) $(PACKAGES.arch:%=-p%) + dh_md5sums $(verbose) $(PACKAGES.arch:%=-p%) + dh_builddeb $(verbose) $(PACKAGES.arch:%=-p%) +endif + +.PHONY: build clean config config-arch binary binary-arch install install-arch diff --git a/package/mingw-byacc.spec b/package/mingw-byacc.spec index 75b02c8..4273460 100644 --- a/package/mingw-byacc.spec +++ b/package/mingw-byacc.spec @@ -1,8 +1,8 @@ Summary: byacc - public domain Berkeley LALR Yacc parser generator %define AppProgram byacc -%define AppVersion 20180510 +%define AppVersion 20180525 %define UseProgram yacc -# $Id: mingw-byacc.spec,v 1.21 2018/05/10 08:59:09 tom Exp $ +# $Id: mingw-byacc.spec,v 1.22 2018/05/25 20:12:25 tom Exp $ Name: %{AppProgram} Version: %{AppVersion} Release: 1 diff --git a/package/pkgsrc/Makefile b/package/pkgsrc/Makefile index 0ccb47f..21ae313 100644 --- a/package/pkgsrc/Makefile +++ b/package/pkgsrc/Makefile @@ -1,7 +1,7 @@ # $NetBSD: Makefile,v 1.9 2008/07/24 17:13:00 tonnerre Exp $ # -DISTNAME= byacc-20180510 +DISTNAME= byacc-20180525 PKGREVISION= 1 CATEGORIES= devel MASTER_SITES= ftp://ftp.invisible-island.net/byacc/ diff --git a/test/btyacc/btyacc_calc1.tab.c b/test/btyacc/btyacc_calc1.tab.c index 5994869..f8ab5a2 100644 --- a/test/btyacc/btyacc_calc1.tab.c +++ b/test/btyacc/btyacc_calc1.tab.c @@ -400,17 +400,17 @@ do \ { \ 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 */ @@ -807,7 +807,7 @@ YYPARSE_DECL() YYParseState *yyerrctx = NULL; #endif /* 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; @@ -1207,7 +1207,7 @@ yyerrhandler: 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 @@ -1236,7 +1236,7 @@ yyinrecovery: *++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 @@ -1252,7 +1252,7 @@ yyinrecovery: 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 YYBTYACC @@ -1338,10 +1338,10 @@ yyreduce: if (!yytrial) #endif /* 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 diff --git a/test/btyacc/btyacc_demo.tab.c b/test/btyacc/btyacc_demo.tab.c index a588bbc..0214637 100644 --- a/test/btyacc/btyacc_demo.tab.c +++ b/test/btyacc/btyacc_demo.tab.c @@ -530,17 +530,17 @@ do \ { \ 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 */ @@ -1319,7 +1319,7 @@ YYPARSE_DECL() YYParseState *yyerrctx = NULL; #endif /* 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; @@ -1710,7 +1710,7 @@ yyerrhandler: 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 @@ -1739,7 +1739,7 @@ yyinrecovery: *++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 @@ -1755,7 +1755,7 @@ yyinrecovery: 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 YYBTYACC @@ -1841,10 +1841,10 @@ yyreduce: if (!yytrial) #endif /* 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 diff --git a/test/btyacc/btyacc_destroy1.tab.c b/test/btyacc/btyacc_destroy1.tab.c index ee4aea1..d7ac224 100644 --- a/test/btyacc/btyacc_destroy1.tab.c +++ b/test/btyacc/btyacc_destroy1.tab.c @@ -379,17 +379,17 @@ do \ { \ 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 */ @@ -651,7 +651,7 @@ YYPARSE_DECL() YYParseState *yyerrctx = NULL; #endif /* 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; @@ -1042,7 +1042,7 @@ yyerrhandler: 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 @@ -1071,7 +1071,7 @@ yyinrecovery: *++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 @@ -1087,7 +1087,7 @@ yyinrecovery: 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 YYBTYACC @@ -1173,10 +1173,10 @@ yyreduce: if (!yytrial) #endif /* 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 diff --git a/test/btyacc/btyacc_destroy2.tab.c b/test/btyacc/btyacc_destroy2.tab.c index f83151a..2bb1fd6 100644 --- a/test/btyacc/btyacc_destroy2.tab.c +++ b/test/btyacc/btyacc_destroy2.tab.c @@ -379,17 +379,17 @@ do \ { \ 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 */ @@ -651,7 +651,7 @@ YYPARSE_DECL() YYParseState *yyerrctx = NULL; #endif /* 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; @@ -1042,7 +1042,7 @@ yyerrhandler: 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 @@ -1071,7 +1071,7 @@ yyinrecovery: *++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 @@ -1087,7 +1087,7 @@ yyinrecovery: 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 YYBTYACC @@ -1173,10 +1173,10 @@ yyreduce: if (!yytrial) #endif /* 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 diff --git a/test/btyacc/btyacc_destroy3.tab.c b/test/btyacc/btyacc_destroy3.tab.c index 07e3d0f..59b7da5 100644 --- a/test/btyacc/btyacc_destroy3.tab.c +++ b/test/btyacc/btyacc_destroy3.tab.c @@ -379,17 +379,17 @@ do \ { \ 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 */ @@ -651,7 +651,7 @@ YYPARSE_DECL() YYParseState *yyerrctx = NULL; #endif /* 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; @@ -1042,7 +1042,7 @@ yyerrhandler: 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 @@ -1071,7 +1071,7 @@ yyinrecovery: *++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 @@ -1087,7 +1087,7 @@ yyinrecovery: 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 YYBTYACC @@ -1173,10 +1173,10 @@ yyreduce: if (!yytrial) #endif /* 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 diff --git a/test/btyacc/calc.tab.c b/test/btyacc/calc.tab.c index 356316e..419d2fa 100644 --- a/test/btyacc/calc.tab.c +++ b/test/btyacc/calc.tab.c @@ -360,17 +360,17 @@ do \ { \ 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 */ @@ -646,7 +646,7 @@ YYPARSE_DECL() YYParseState *yyerrctx = NULL; #endif /* 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; @@ -1037,7 +1037,7 @@ yyerrhandler: 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 @@ -1066,7 +1066,7 @@ yyinrecovery: *++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 @@ -1082,7 +1082,7 @@ yyinrecovery: 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 YYBTYACC @@ -1168,10 +1168,10 @@ yyreduce: if (!yytrial) #endif /* 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 diff --git a/test/btyacc/calc1.tab.c b/test/btyacc/calc1.tab.c index 6c996b8..d16218c 100644 --- a/test/btyacc/calc1.tab.c +++ b/test/btyacc/calc1.tab.c @@ -415,17 +415,17 @@ do \ { \ 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 */ @@ -790,7 +790,7 @@ YYPARSE_DECL() YYParseState *yyerrctx = NULL; #endif /* 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; @@ -1181,7 +1181,7 @@ yyerrhandler: 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 @@ -1210,7 +1210,7 @@ yyinrecovery: *++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 @@ -1226,7 +1226,7 @@ yyinrecovery: 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 YYBTYACC @@ -1312,10 +1312,10 @@ yyreduce: if (!yytrial) #endif /* 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 diff --git a/test/btyacc/calc2.tab.c b/test/btyacc/calc2.tab.c index 0823c7c..efa58f8 100644 --- a/test/btyacc/calc2.tab.c +++ b/test/btyacc/calc2.tab.c @@ -362,17 +362,17 @@ do \ { \ 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 */ @@ -659,7 +659,7 @@ YYPARSE_DECL() YYParseState *yyerrctx = NULL; #endif /* 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; @@ -1050,7 +1050,7 @@ yyerrhandler: 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 @@ -1079,7 +1079,7 @@ yyinrecovery: *++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 @@ -1095,7 +1095,7 @@ yyinrecovery: 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 YYBTYACC @@ -1181,10 +1181,10 @@ yyreduce: if (!yytrial) #endif /* 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 diff --git a/test/btyacc/calc3.tab.c b/test/btyacc/calc3.tab.c index b3d9bad..138b32f 100644 --- a/test/btyacc/calc3.tab.c +++ b/test/btyacc/calc3.tab.c @@ -356,17 +356,17 @@ do \ { \ 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 */ @@ -664,7 +664,7 @@ YYPARSE_DECL() YYParseState *yyerrctx = NULL; #endif /* 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; @@ -1064,7 +1064,7 @@ yyerrhandler: 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 @@ -1093,7 +1093,7 @@ yyinrecovery: *++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 @@ -1109,7 +1109,7 @@ yyinrecovery: 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 YYBTYACC @@ -1195,10 +1195,10 @@ yyreduce: if (!yytrial) #endif /* 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 diff --git a/test/btyacc/code_calc.code.c b/test/btyacc/code_calc.code.c index c5b1f72..41f372f 100644 --- a/test/btyacc/code_calc.code.c +++ b/test/btyacc/code_calc.code.c @@ -229,17 +229,17 @@ do \ { \ 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 */ @@ -519,7 +519,7 @@ YYPARSE_DECL() YYParseState *yyerrctx = NULL; #endif /* 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; @@ -910,7 +910,7 @@ yyerrhandler: 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 @@ -939,7 +939,7 @@ yyinrecovery: *++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 @@ -955,7 +955,7 @@ yyinrecovery: 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 YYBTYACC @@ -1041,10 +1041,10 @@ yyreduce: if (!yytrial) #endif /* 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 diff --git a/test/btyacc/code_error.code.c b/test/btyacc/code_error.code.c index 32c81e6..aacb520 100644 --- a/test/btyacc/code_error.code.c +++ b/test/btyacc/code_error.code.c @@ -219,17 +219,17 @@ do \ { \ 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 */ @@ -489,7 +489,7 @@ YYPARSE_DECL() YYParseState *yyerrctx = NULL; #endif /* 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; @@ -880,7 +880,7 @@ yyerrhandler: 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 @@ -909,7 +909,7 @@ yyinrecovery: *++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 @@ -925,7 +925,7 @@ yyinrecovery: 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 YYBTYACC @@ -1011,10 +1011,10 @@ yyreduce: if (!yytrial) #endif /* 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 diff --git a/test/btyacc/empty.tab.c b/test/btyacc/empty.tab.c index 5b5df13..6b0f173 100644 --- a/test/btyacc/empty.tab.c +++ b/test/btyacc/empty.tab.c @@ -251,17 +251,17 @@ do \ { \ 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 */ @@ -508,7 +508,7 @@ YYPARSE_DECL() YYParseState *yyerrctx = NULL; #endif /* 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; @@ -899,7 +899,7 @@ yyerrhandler: 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 @@ -928,7 +928,7 @@ yyinrecovery: *++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 @@ -944,7 +944,7 @@ yyinrecovery: 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 YYBTYACC @@ -1030,10 +1030,10 @@ yyreduce: if (!yytrial) #endif /* 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 diff --git a/test/btyacc/err_inherit3.tab.c b/test/btyacc/err_inherit3.tab.c index 5e9dd49..063fa38 100644 --- a/test/btyacc/err_inherit3.tab.c +++ b/test/btyacc/err_inherit3.tab.c @@ -312,17 +312,17 @@ do \ { \ 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 */ @@ -608,7 +608,7 @@ YYPARSE_DECL() YYParseState *yyerrctx = NULL; #endif /* 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; @@ -999,7 +999,7 @@ yyerrhandler: 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 @@ -1028,7 +1028,7 @@ yyinrecovery: *++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 @@ -1044,7 +1044,7 @@ yyinrecovery: 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 YYBTYACC @@ -1130,10 +1130,10 @@ yyreduce: if (!yytrial) #endif /* 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 diff --git a/test/btyacc/err_inherit4.tab.c b/test/btyacc/err_inherit4.tab.c index fa5692f..fb943d1 100644 --- a/test/btyacc/err_inherit4.tab.c +++ b/test/btyacc/err_inherit4.tab.c @@ -331,17 +331,17 @@ do \ { \ 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 */ @@ -606,7 +606,7 @@ YYPARSE_DECL() YYParseState *yyerrctx = NULL; #endif /* 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; @@ -997,7 +997,7 @@ yyerrhandler: 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 @@ -1026,7 +1026,7 @@ yyinrecovery: *++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 @@ -1042,7 +1042,7 @@ yyinrecovery: 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 YYBTYACC @@ -1128,10 +1128,10 @@ yyreduce: if (!yytrial) #endif /* 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 diff --git a/test/btyacc/err_syntax10.tab.c b/test/btyacc/err_syntax10.tab.c index 15c770d..acfd573 100644 --- a/test/btyacc/err_syntax10.tab.c +++ b/test/btyacc/err_syntax10.tab.c @@ -241,17 +241,17 @@ do \ { \ 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 */ @@ -507,7 +507,7 @@ YYPARSE_DECL() YYParseState *yyerrctx = NULL; #endif /* 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; @@ -898,7 +898,7 @@ yyerrhandler: 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 @@ -927,7 +927,7 @@ yyinrecovery: *++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 @@ -943,7 +943,7 @@ yyinrecovery: 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 YYBTYACC @@ -1029,10 +1029,10 @@ yyreduce: if (!yytrial) #endif /* 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 diff --git a/test/btyacc/err_syntax11.tab.c b/test/btyacc/err_syntax11.tab.c index 23c6e49..7b9828d 100644 --- a/test/btyacc/err_syntax11.tab.c +++ b/test/btyacc/err_syntax11.tab.c @@ -247,17 +247,17 @@ do \ { \ 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 */ @@ -513,7 +513,7 @@ YYPARSE_DECL() YYParseState *yyerrctx = NULL; #endif /* 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; @@ -904,7 +904,7 @@ yyerrhandler: 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 @@ -933,7 +933,7 @@ yyinrecovery: *++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 @@ -949,7 +949,7 @@ yyinrecovery: 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 YYBTYACC @@ -1035,10 +1035,10 @@ yyreduce: if (!yytrial) #endif /* 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 diff --git a/test/btyacc/err_syntax12.tab.c b/test/btyacc/err_syntax12.tab.c index c7f92ba..eb246d9 100644 --- a/test/btyacc/err_syntax12.tab.c +++ b/test/btyacc/err_syntax12.tab.c @@ -253,17 +253,17 @@ do \ { \ 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 */ @@ -519,7 +519,7 @@ YYPARSE_DECL() YYParseState *yyerrctx = NULL; #endif /* 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; @@ -910,7 +910,7 @@ yyerrhandler: 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 @@ -939,7 +939,7 @@ yyinrecovery: *++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 @@ -955,7 +955,7 @@ yyinrecovery: 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 YYBTYACC @@ -1041,10 +1041,10 @@ yyreduce: if (!yytrial) #endif /* 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 diff --git a/test/btyacc/err_syntax18.tab.c b/test/btyacc/err_syntax18.tab.c index 671ebf7..1b34494 100644 --- a/test/btyacc/err_syntax18.tab.c +++ b/test/btyacc/err_syntax18.tab.c @@ -250,17 +250,17 @@ do \ { \ 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 */ @@ -516,7 +516,7 @@ YYPARSE_DECL() YYParseState *yyerrctx = NULL; #endif /* 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; @@ -907,7 +907,7 @@ yyerrhandler: 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 @@ -936,7 +936,7 @@ yyinrecovery: *++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 @@ -952,7 +952,7 @@ yyinrecovery: 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 YYBTYACC @@ -1038,10 +1038,10 @@ yyreduce: if (!yytrial) #endif /* 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 diff --git a/test/btyacc/err_syntax20.tab.c b/test/btyacc/err_syntax20.tab.c index 83b3ec5..5c840eb 100644 --- a/test/btyacc/err_syntax20.tab.c +++ b/test/btyacc/err_syntax20.tab.c @@ -245,17 +245,17 @@ do \ { \ 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 */ @@ -511,7 +511,7 @@ YYPARSE_DECL() YYParseState *yyerrctx = NULL; #endif /* 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; @@ -902,7 +902,7 @@ yyerrhandler: 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 @@ -931,7 +931,7 @@ yyinrecovery: *++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 @@ -947,7 +947,7 @@ yyinrecovery: 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 YYBTYACC @@ -1033,10 +1033,10 @@ yyreduce: if (!yytrial) #endif /* 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 diff --git a/test/btyacc/error.tab.c b/test/btyacc/error.tab.c index dc6bec3..72cbd92 100644 --- a/test/btyacc/error.tab.c +++ b/test/btyacc/error.tab.c @@ -246,17 +246,17 @@ do \ { \ 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 */ @@ -512,7 +512,7 @@ YYPARSE_DECL() YYParseState *yyerrctx = NULL; #endif /* 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; @@ -903,7 +903,7 @@ yyerrhandler: 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 @@ -932,7 +932,7 @@ yyinrecovery: *++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 @@ -948,7 +948,7 @@ yyinrecovery: 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 YYBTYACC @@ -1034,10 +1034,10 @@ yyreduce: if (!yytrial) #endif /* 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 diff --git a/test/btyacc/expr.oxout.tab.c b/test/btyacc/expr.oxout.tab.c index f0b5997..c3daca3 100644 --- a/test/btyacc/expr.oxout.tab.c +++ b/test/btyacc/expr.oxout.tab.c @@ -367,17 +367,17 @@ do \ { \ 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 */ @@ -1932,7 +1932,7 @@ YYPARSE_DECL() YYParseState *yyerrctx = NULL; #endif /* 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; @@ -2323,7 +2323,7 @@ yyerrhandler: 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 @@ -2352,7 +2352,7 @@ yyinrecovery: *++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 @@ -2368,7 +2368,7 @@ yyinrecovery: 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 YYBTYACC @@ -2454,10 +2454,10 @@ yyreduce: if (!yytrial) #endif /* 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 diff --git a/test/btyacc/grammar.tab.c b/test/btyacc/grammar.tab.c index 852e153..9fc9d79 100644 --- a/test/btyacc/grammar.tab.c +++ b/test/btyacc/grammar.tab.c @@ -1071,17 +1071,17 @@ do \ { \ 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 */ @@ -1486,7 +1486,7 @@ YYPARSE_DECL() YYParseState *yyerrctx = NULL; #endif /* 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; @@ -1877,7 +1877,7 @@ yyerrhandler: 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 @@ -1906,7 +1906,7 @@ yyinrecovery: *++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 @@ -1922,7 +1922,7 @@ yyinrecovery: 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 YYBTYACC @@ -2008,10 +2008,10 @@ yyreduce: if (!yytrial) #endif /* 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 diff --git a/test/btyacc/inherit0.tab.c b/test/btyacc/inherit0.tab.c index 0fec52c..dc3c132 100644 --- a/test/btyacc/inherit0.tab.c +++ b/test/btyacc/inherit0.tab.c @@ -283,17 +283,17 @@ do \ { \ 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 */ @@ -531,7 +531,7 @@ YYPARSE_DECL() YYParseState *yyerrctx = NULL; #endif /* 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; @@ -922,7 +922,7 @@ yyerrhandler: 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 @@ -951,7 +951,7 @@ yyinrecovery: *++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 @@ -967,7 +967,7 @@ yyinrecovery: 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 YYBTYACC @@ -1053,10 +1053,10 @@ yyreduce: if (!yytrial) #endif /* 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 diff --git a/test/btyacc/inherit1.tab.c b/test/btyacc/inherit1.tab.c index c5db4b7..60c5e82 100644 --- a/test/btyacc/inherit1.tab.c +++ b/test/btyacc/inherit1.tab.c @@ -304,17 +304,17 @@ do \ { \ 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 */ @@ -552,7 +552,7 @@ YYPARSE_DECL() YYParseState *yyerrctx = NULL; #endif /* 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; @@ -943,7 +943,7 @@ yyerrhandler: 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 @@ -972,7 +972,7 @@ yyinrecovery: *++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 @@ -988,7 +988,7 @@ yyinrecovery: 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 YYBTYACC @@ -1074,10 +1074,10 @@ yyreduce: if (!yytrial) #endif /* 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 diff --git a/test/btyacc/inherit2.tab.c b/test/btyacc/inherit2.tab.c index b6894d6..0c88787 100644 --- a/test/btyacc/inherit2.tab.c +++ b/test/btyacc/inherit2.tab.c @@ -311,17 +311,17 @@ do \ { \ 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 */ @@ -607,7 +607,7 @@ YYPARSE_DECL() YYParseState *yyerrctx = NULL; #endif /* 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; @@ -998,7 +998,7 @@ yyerrhandler: 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 @@ -1027,7 +1027,7 @@ yyinrecovery: *++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 @@ -1043,7 +1043,7 @@ yyinrecovery: 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 YYBTYACC @@ -1129,10 +1129,10 @@ yyreduce: if (!yytrial) #endif /* 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 diff --git a/test/btyacc/ok_syntax1.tab.c b/test/btyacc/ok_syntax1.tab.c index 8d1ef9c..f5e2104 100644 --- a/test/btyacc/ok_syntax1.tab.c +++ b/test/btyacc/ok_syntax1.tab.c @@ -379,17 +379,17 @@ do \ { \ 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 */ @@ -687,7 +687,7 @@ YYPARSE_DECL() YYParseState *yyerrctx = NULL; #endif /* 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; @@ -1087,7 +1087,7 @@ yyerrhandler: 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 @@ -1116,7 +1116,7 @@ yyinrecovery: *++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 @@ -1132,7 +1132,7 @@ yyinrecovery: 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 YYBTYACC @@ -1218,10 +1218,10 @@ yyreduce: if (!yytrial) #endif /* 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 diff --git a/test/btyacc/pure_calc.tab.c b/test/btyacc/pure_calc.tab.c index ee267b0..0990089 100644 --- a/test/btyacc/pure_calc.tab.c +++ b/test/btyacc/pure_calc.tab.c @@ -359,17 +359,17 @@ do \ { \ 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 */ @@ -660,7 +660,7 @@ YYPARSE_DECL() YYParseState *yyerrctx = NULL; #endif /* 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; @@ -1060,7 +1060,7 @@ yyerrhandler: 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 @@ -1089,7 +1089,7 @@ yyinrecovery: *++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 @@ -1105,7 +1105,7 @@ yyinrecovery: 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 YYBTYACC @@ -1191,10 +1191,10 @@ yyreduce: if (!yytrial) #endif /* 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 diff --git a/test/btyacc/pure_error.tab.c b/test/btyacc/pure_error.tab.c index 34d4f8c..c6cce12 100644 --- a/test/btyacc/pure_error.tab.c +++ b/test/btyacc/pure_error.tab.c @@ -247,17 +247,17 @@ do \ { \ 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 */ @@ -528,7 +528,7 @@ YYPARSE_DECL() YYParseState *yyerrctx = NULL; #endif /* 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; @@ -928,7 +928,7 @@ yyerrhandler: 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 @@ -957,7 +957,7 @@ yyinrecovery: *++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 @@ -973,7 +973,7 @@ yyinrecovery: 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 YYBTYACC @@ -1059,10 +1059,10 @@ yyreduce: if (!yytrial) #endif /* 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 diff --git a/test/btyacc/quote_calc-s.tab.c b/test/btyacc/quote_calc-s.tab.c index b6e9ebd..dd6a8f9 100644 --- a/test/btyacc/quote_calc-s.tab.c +++ b/test/btyacc/quote_calc-s.tab.c @@ -379,17 +379,17 @@ do \ { \ 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 */ @@ -664,7 +664,7 @@ YYPARSE_DECL() YYParseState *yyerrctx = NULL; #endif /* 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; @@ -1055,7 +1055,7 @@ yyerrhandler: 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 @@ -1084,7 +1084,7 @@ yyinrecovery: *++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 @@ -1100,7 +1100,7 @@ yyinrecovery: 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 YYBTYACC @@ -1186,10 +1186,10 @@ yyreduce: if (!yytrial) #endif /* 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 diff --git a/test/btyacc/quote_calc.tab.c b/test/btyacc/quote_calc.tab.c index af45d5d..c555427 100644 --- a/test/btyacc/quote_calc.tab.c +++ b/test/btyacc/quote_calc.tab.c @@ -385,17 +385,17 @@ do \ { \ 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 */ @@ -670,7 +670,7 @@ YYPARSE_DECL() YYParseState *yyerrctx = NULL; #endif /* 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; @@ -1061,7 +1061,7 @@ yyerrhandler: 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 @@ -1090,7 +1090,7 @@ yyinrecovery: *++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 @@ -1106,7 +1106,7 @@ yyinrecovery: 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 YYBTYACC @@ -1192,10 +1192,10 @@ yyreduce: if (!yytrial) #endif /* 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 diff --git a/test/btyacc/quote_calc2-s.tab.c b/test/btyacc/quote_calc2-s.tab.c index a9b2bce..249e6c7 100644 --- a/test/btyacc/quote_calc2-s.tab.c +++ b/test/btyacc/quote_calc2-s.tab.c @@ -379,17 +379,17 @@ do \ { \ 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 */ @@ -664,7 +664,7 @@ YYPARSE_DECL() YYParseState *yyerrctx = NULL; #endif /* 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; @@ -1055,7 +1055,7 @@ yyerrhandler: 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 @@ -1084,7 +1084,7 @@ yyinrecovery: *++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 @@ -1100,7 +1100,7 @@ yyinrecovery: 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 YYBTYACC @@ -1186,10 +1186,10 @@ yyreduce: if (!yytrial) #endif /* 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 diff --git a/test/btyacc/quote_calc2.tab.c b/test/btyacc/quote_calc2.tab.c index 25ba4ad..e35c76f 100644 --- a/test/btyacc/quote_calc2.tab.c +++ b/test/btyacc/quote_calc2.tab.c @@ -385,17 +385,17 @@ do \ { \ 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 */ @@ -670,7 +670,7 @@ YYPARSE_DECL() YYParseState *yyerrctx = NULL; #endif /* 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; @@ -1061,7 +1061,7 @@ yyerrhandler: 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 @@ -1090,7 +1090,7 @@ yyinrecovery: *++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 @@ -1106,7 +1106,7 @@ yyinrecovery: 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 YYBTYACC @@ -1192,10 +1192,10 @@ yyreduce: if (!yytrial) #endif /* 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 diff --git a/test/btyacc/quote_calc3-s.tab.c b/test/btyacc/quote_calc3-s.tab.c index 1ffbb07..ddf54d9 100644 --- a/test/btyacc/quote_calc3-s.tab.c +++ b/test/btyacc/quote_calc3-s.tab.c @@ -380,17 +380,17 @@ do \ { \ 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 */ @@ -665,7 +665,7 @@ YYPARSE_DECL() YYParseState *yyerrctx = NULL; #endif /* 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; @@ -1056,7 +1056,7 @@ yyerrhandler: 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 @@ -1085,7 +1085,7 @@ yyinrecovery: *++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 @@ -1101,7 +1101,7 @@ yyinrecovery: 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 YYBTYACC @@ -1187,10 +1187,10 @@ yyreduce: if (!yytrial) #endif /* 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 diff --git a/test/btyacc/quote_calc3.tab.c b/test/btyacc/quote_calc3.tab.c index 87d7ce0..d073f0d 100644 --- a/test/btyacc/quote_calc3.tab.c +++ b/test/btyacc/quote_calc3.tab.c @@ -380,17 +380,17 @@ do \ { \ 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 */ @@ -665,7 +665,7 @@ YYPARSE_DECL() YYParseState *yyerrctx = NULL; #endif /* 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; @@ -1056,7 +1056,7 @@ yyerrhandler: 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 @@ -1085,7 +1085,7 @@ yyinrecovery: *++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 @@ -1101,7 +1101,7 @@ yyinrecovery: 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 YYBTYACC @@ -1187,10 +1187,10 @@ yyreduce: if (!yytrial) #endif /* 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 diff --git a/test/btyacc/quote_calc4-s.tab.c b/test/btyacc/quote_calc4-s.tab.c index 39acf45..db43e49 100644 --- a/test/btyacc/quote_calc4-s.tab.c +++ b/test/btyacc/quote_calc4-s.tab.c @@ -380,17 +380,17 @@ do \ { \ 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 */ @@ -665,7 +665,7 @@ YYPARSE_DECL() YYParseState *yyerrctx = NULL; #endif /* 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; @@ -1056,7 +1056,7 @@ yyerrhandler: 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 @@ -1085,7 +1085,7 @@ yyinrecovery: *++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 @@ -1101,7 +1101,7 @@ yyinrecovery: 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 YYBTYACC @@ -1187,10 +1187,10 @@ yyreduce: if (!yytrial) #endif /* 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 diff --git a/test/btyacc/quote_calc4.tab.c b/test/btyacc/quote_calc4.tab.c index 1ec7822..b6173ea 100644 --- a/test/btyacc/quote_calc4.tab.c +++ b/test/btyacc/quote_calc4.tab.c @@ -380,17 +380,17 @@ do \ { \ 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 */ @@ -665,7 +665,7 @@ YYPARSE_DECL() YYParseState *yyerrctx = NULL; #endif /* 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; @@ -1056,7 +1056,7 @@ yyerrhandler: 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 @@ -1085,7 +1085,7 @@ yyinrecovery: *++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 @@ -1101,7 +1101,7 @@ yyinrecovery: 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 YYBTYACC @@ -1187,10 +1187,10 @@ yyreduce: if (!yytrial) #endif /* 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 diff --git a/test/btyacc/rename_debug.c b/test/btyacc/rename_debug.c index 3cd08d7..9bf90bc 100644 --- a/test/btyacc/rename_debug.c +++ b/test/btyacc/rename_debug.c @@ -105,17 +105,17 @@ do \ { \ 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 */ @@ -375,7 +375,7 @@ YYPARSE_DECL() YYParseState *yyerrctx = NULL; #endif /* 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; @@ -766,7 +766,7 @@ yyerrhandler: 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 @@ -795,7 +795,7 @@ yyinrecovery: *++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 @@ -811,7 +811,7 @@ yyinrecovery: 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 YYBTYACC @@ -897,10 +897,10 @@ yyreduce: if (!yytrial) #endif /* 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 diff --git a/test/btyacc/varsyntax_calc1.tab.c b/test/btyacc/varsyntax_calc1.tab.c index 2a7f442..25b8306 100644 --- a/test/btyacc/varsyntax_calc1.tab.c +++ b/test/btyacc/varsyntax_calc1.tab.c @@ -416,17 +416,17 @@ do \ { \ 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 */ @@ -791,7 +791,7 @@ YYPARSE_DECL() YYParseState *yyerrctx = NULL; #endif /* 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; @@ -1182,7 +1182,7 @@ yyerrhandler: 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 @@ -1211,7 +1211,7 @@ yyinrecovery: *++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 @@ -1227,7 +1227,7 @@ yyinrecovery: 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 YYBTYACC @@ -1313,10 +1313,10 @@ yyreduce: if (!yytrial) #endif /* 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 diff --git a/test/run_make.sh b/test/run_make.sh index 3035eb4..7a613b7 100755 --- a/test/run_make.sh +++ b/test/run_make.sh @@ -1,5 +1,5 @@ #!/bin/sh -# $Id: run_make.sh,v 1.15 2016/06/01 22:56:37 Tom.Shields Exp $ +# $Id: run_make.sh,v 1.17 2018/05/26 01:24:57 tom Exp $ # vi:ts=4 sw=4: # do a test-compile on each of the ".c" files in the test-directory @@ -97,7 +97,7 @@ then case $input in ${TEST_DIR}/pure_*) - if test -z `fgrep -l '%pure-parser' $input` + if test -z `fgrep -i -l '%pure-parser' $input` then echo "%pure-parser" >>run_make.y fi @@ -106,7 +106,14 @@ then sed -e '/^%expect/s,%expect.*,,' $input >>run_make.y - bison -Wno-other -Wno-conflicts-sr -Wconflicts-rr -y run_make.y + case $BISON in + [3-9].[0-9]*.[0-9]*) + bison -Wno-other -Wno-conflicts-sr -Wconflicts-rr -y run_make.y + ;; + *) + bison -y run_make.y + ;; + esac if test -f "y.tab.c" then sed -e '/^#line/s,"run_make.y","'$input'",' y.tab.c >run_make.c @@ -151,9 +158,10 @@ then continue; ;; *) - if fgrep '%pure-parser' $input >/dev/null || - fgrep '%parse-param' $input >/dev/null || - fgrep '%lex-param' $input >/dev/null || + if fgrep -i '%pure-parser' $input >/dev/null || + fgrep -i '%parse-param' $input >/dev/null || + fgrep -i '%lex-param' $input >/dev/null || + fgrep -i '%token-table' $input >/dev/null || fgrep 'YYLEX_PARAM' $input >/dev/null then echo "... skipping $input" |