mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-08-08 18:25:13 +00:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
21fe08cadc | ||
|
|
e8ec4d9b33 | ||
|
|
1ef30650b8 | ||
|
|
a36b333cc2 | ||
|
|
fa7b79c063 | ||
|
|
4ec13d6058 | ||
|
|
8e1687aef6 | ||
|
|
aef3da8689 | ||
|
|
84567a1b1c | ||
|
|
afac5ba023 | ||
|
|
3dc5e96b85 | ||
|
|
b2a0b7ca70 | ||
|
|
3be03b13e5 | ||
|
|
3508ce361b | ||
|
|
9350499cfc | ||
|
|
4d7370cb4f | ||
|
|
6d0ef4ec20 | ||
|
|
965537bc54 | ||
|
|
5362ed19b6 | ||
|
|
2d2c1a2dec | ||
|
|
47aee066cc | ||
|
|
1f6b3679b2 | ||
|
|
219741d873 | ||
|
|
11daa4e73b | ||
|
|
b4c2a79743 | ||
|
|
34ec357927 | ||
|
|
f9bfc42aa7 | ||
|
|
06e8700a00 | ||
|
|
9c4371263f | ||
|
|
284d8a13e8 | ||
|
|
ec5479ce35 | ||
|
|
868d2d9638 | ||
|
|
62a9592d3d | ||
|
|
10d6970fb1 | ||
|
|
50a339934c | ||
|
|
2ce4ed68c9 | ||
|
|
db7e5eb5ef | ||
|
|
a5d80ba505 | ||
|
|
23eb2a692f | ||
|
|
b321737f20 | ||
|
|
1f4cc0f4ae | ||
|
|
ddc8ede1ab | ||
|
|
b37acfe18c | ||
|
|
08bc001306 | ||
|
|
80ac75bcb6 | ||
|
|
f2e690d8c3 | ||
|
|
7b42569e12 | ||
|
|
3b452f4ea6 | ||
|
|
b8a4155924 | ||
|
|
cd9e1ba28d | ||
|
|
b8445a158c | ||
|
|
b3d9b5ba18 | ||
|
|
cb48f1919c | ||
|
|
cd48d21d94 | ||
|
|
8ec0a172bc | ||
|
|
4a678af8c6 | ||
|
|
dd60572a8b | ||
|
|
fab044e6da | ||
|
|
2073e1b602 | ||
|
|
8ee5b53874 | ||
|
|
ad6b1efa2f | ||
|
|
ffa4ba3aef | ||
|
|
300a193064 | ||
|
|
e256e17f57 | ||
|
|
381ecb0687 | ||
|
|
4210cd0bfc | ||
|
|
34f98f46ee | ||
|
|
31b2b07ef7 | ||
|
|
9bc0dd679f | ||
|
|
203b927414 | ||
|
|
1b818f33ad | ||
|
|
a7ee59cfb4 | ||
|
|
d2a1a60ab6 | ||
|
|
33ad1a9c2d | ||
|
|
5a2baae7b3 | ||
|
|
58d7a1a1c7 | ||
|
|
40637e8169 | ||
|
|
b931235eb9 | ||
|
|
9e6e7ed2b2 | ||
|
|
742e4900c8 | ||
|
|
3c40d0b52d | ||
|
|
5d27808262 | ||
|
|
9e6688995e | ||
|
|
a898d2780f | ||
|
|
0c8e079fa6 | ||
|
|
9f936c5e9c | ||
|
|
2346344a08 | ||
|
|
4862bdfd61 | ||
|
|
e9071366c3 | ||
|
|
184e42f065 | ||
|
|
7891a7c449 | ||
|
|
4ad3ed84f6 | ||
|
|
0210398466 | ||
|
|
2c08afa5dd | ||
|
|
6077da5824 | ||
|
|
c211f84be6 | ||
|
|
2a26b6c28b | ||
|
|
e4f0316ae0 | ||
|
|
aefef0d6cf | ||
|
|
fcd8e2011d | ||
|
|
7b5cdcbd17 | ||
|
|
566ac1b4a7 | ||
|
|
5ad0a449d6 | ||
|
|
50cce58e9a | ||
|
|
95c0638353 | ||
|
|
aca1717341 | ||
|
|
0d2c8934a5 | ||
|
|
ab8d9dc52f | ||
|
|
9138c575d8 | ||
|
|
d664514801 | ||
|
|
276f48df88 | ||
|
|
cd8b579166 | ||
|
|
34376418e2 | ||
|
|
327afc7c84 | ||
|
|
ba9ecd1910 | ||
|
|
4e83ea15f7 | ||
|
|
0a9f1c7d45 | ||
|
|
b15296ff31 | ||
|
|
04c12cb83d | ||
|
|
6e93d810ca | ||
|
|
eaea13f59f | ||
|
|
3cf084ecae | ||
|
|
f94705b204 | ||
|
|
32c96bd755 | ||
|
|
193d7c7054 | ||
|
|
f5d5ecdfaf | ||
|
|
7c7993487d | ||
|
|
f21ce5a3f7 | ||
|
|
ebe8ee4235 | ||
|
|
6e2d1146f2 | ||
|
|
4767105543 | ||
|
|
ed2e6384ed | ||
|
|
3cedc2dc0d | ||
|
|
b2ddc3f337 | ||
|
|
91e3ac9ab0 | ||
|
|
1bddda4d85 | ||
|
|
8c5b881de5 | ||
|
|
5cf61e933d | ||
|
|
aa08666d72 | ||
|
|
455671735e | ||
|
|
e9d8f881ce | ||
|
|
55ba27be34 | ||
|
|
c095d689c3 | ||
|
|
6e0f828781 | ||
|
|
d6b771c345 | ||
|
|
1e137b710b | ||
|
|
6d05403db4 | ||
|
|
73f2e47e51 | ||
|
|
8710fc41aa | ||
|
|
ae952af227 | ||
|
|
35ee866a32 | ||
|
|
520181ab91 | ||
|
|
18d9185cae | ||
|
|
841a773708 | ||
|
|
5f4236a0c2 | ||
|
|
765f22f0f4 | ||
|
|
fc3f467ff1 | ||
|
|
4d7bc38cdc | ||
|
|
a3af26dd7e | ||
|
|
4e26c69eb6 | ||
|
|
498e897c67 | ||
|
|
57bb17ca85 | ||
|
|
0be105dc42 | ||
|
|
c28adce59b | ||
|
|
7870f699e4 | ||
|
|
6fc0c02473 | ||
|
|
1a1a58269d | ||
|
|
fe6c2fdef2 | ||
|
|
927b425baa | ||
|
|
f6a6af9575 | ||
|
|
127bcae693 | ||
|
|
b947188419 | ||
|
|
b01df0368a | ||
|
|
d9735e9e3e | ||
|
|
8c86f0ef98 | ||
|
|
de35dd590c | ||
|
|
67a0dc4fa9 | ||
|
|
5a6755afcb | ||
|
|
3f0014152b | ||
|
|
e2a8c0f591 | ||
|
|
a7086c4f27 | ||
|
|
27622431dc | ||
|
|
6b7022680e | ||
|
|
d40ba6c272 | ||
|
|
bf8b3d9821 | ||
|
|
401aace63c | ||
|
|
d42cf84421 | ||
|
|
02d12d0de2 | ||
|
|
06f01bc496 | ||
|
|
f0064700f8 | ||
|
|
b66dfcd26f | ||
|
|
02650b7f0e | ||
|
|
68cae94e0b | ||
|
|
287c78f6ab | ||
|
|
c21493b89f | ||
|
|
b6e3facf99 | ||
|
|
b4068c7cf3 | ||
|
|
c66dfaddf4 | ||
|
|
ed94ef2ae4 | ||
|
|
51cbef6f63 | ||
|
|
d6ca7905ab | ||
|
|
2073ce56f5 | ||
|
|
ef1b70e009 | ||
|
|
cc14efa5bc | ||
|
|
db0dcbf315 | ||
|
|
e9ad4aeca5 | ||
|
|
02d7cce6e2 | ||
|
|
b7691f15bd | ||
|
|
ddee1b0666 | ||
|
|
12f4614d07 | ||
|
|
32c292920e | ||
|
|
de366a2f6b | ||
|
|
2781dbd121 | ||
|
|
bf70fa8729 | ||
|
|
05449a2c1b | ||
|
|
fd2493f7c4 | ||
|
|
4158e0a143 | ||
|
|
d659304d0a | ||
|
|
6ec2c0f295 | ||
|
|
7a0db73e6f | ||
|
|
2e4c30fa07 | ||
|
|
dd9010375b | ||
|
|
a2a3e98977 | ||
|
|
1b9c21fb18 | ||
|
|
8486615972 | ||
|
|
378f4bd846 | ||
|
|
f52b276c55 | ||
|
|
5466269793 | ||
|
|
9ae1f0c6a9 | ||
|
|
4d56beff96 | ||
|
|
073f92889f | ||
|
|
1221b78adb | ||
|
|
ff5150d9a4 | ||
|
|
e2a21b6f0c | ||
|
|
8f7e3cf9d0 | ||
|
|
0a96ba819f | ||
|
|
3953ed882a | ||
|
|
9ecafbbfe7 | ||
|
|
c4d497a010 | ||
|
|
a51d426a63 | ||
|
|
4517da3757 | ||
|
|
668c5d1927 | ||
|
|
e3233bf6b6 | ||
|
|
8f3596a633 | ||
|
|
f8e1c9e55b | ||
|
|
3b0ffc7ec1 | ||
|
|
721be13c5b | ||
|
|
a0af42fce6 | ||
|
|
affac6132a | ||
|
|
8bb4c753e2 | ||
|
|
9d9b8b7006 | ||
|
|
2c3b392a9a | ||
|
|
d6cff4dc6f | ||
|
|
a85284cfbd | ||
|
|
e14d0ab687 | ||
|
|
d508c2816f | ||
|
|
375234d9ff | ||
|
|
bf60087f69 | ||
|
|
90ddbd5eed | ||
|
|
69474954ac | ||
|
|
b09a18c50d | ||
|
|
3e7a2cd95f | ||
|
|
26546b4258 | ||
|
|
0eca5a39a7 | ||
|
|
72c4d3365a | ||
|
|
6c65b1525f | ||
|
|
2cec9080f6 | ||
|
|
7029f8927f | ||
|
|
877519f839 | ||
|
|
12ce2df60d | ||
|
|
f5228370c5 | ||
|
|
6ff9971122 | ||
|
|
69ce078b8c | ||
|
|
32b5b719e4 | ||
|
|
66809587a7 | ||
|
|
af3412cdea | ||
|
|
d9963c8597 | ||
|
|
035aa4a0bb | ||
|
|
d1ff7a7cc6 | ||
|
|
6de5398de3 | ||
|
|
a1373f559a | ||
|
|
3dc4aa8c36 | ||
|
|
613d8952e3 | ||
|
|
b2741627b1 | ||
|
|
422494834c | ||
|
|
5059b5c887 | ||
|
|
4626a15dd1 | ||
|
|
98ae96438e | ||
|
|
1989d9476c | ||
|
|
62b08cfcd7 | ||
|
|
0299809431 | ||
|
|
5210672f6b | ||
|
|
a8991a1da4 | ||
|
|
36b5e963e6 | ||
|
|
317fce927c | ||
|
|
44e7ead165 | ||
|
|
e10a80eeac | ||
|
|
067b32eef4 | ||
|
|
4b3673159e | ||
|
|
24cc23d96d | ||
|
|
d4476375cf | ||
|
|
302c0aeeba | ||
|
|
7625ec2c83 | ||
|
|
2ed284440f | ||
|
|
ba0fe3c710 | ||
|
|
9b8a5ce03b | ||
|
|
52d9d4112f | ||
|
|
4d7aa45e75 | ||
|
|
4f6e011e2e | ||
|
|
a1b3bf8c21 | ||
|
|
e764d4df76 | ||
|
|
2a4647a32f | ||
|
|
74e543d21f | ||
|
|
412e44aa0e | ||
|
|
2888e8b946 | ||
|
|
2f4f028d8b | ||
|
|
88c6637fa9 | ||
|
|
f8333ce5fd | ||
|
|
c59929c351 | ||
|
|
fb32e3730e | ||
|
|
2aee5b7e1e | ||
|
|
fb9c0b3360 | ||
|
|
edb8f44f06 | ||
|
|
b50d2359d7 | ||
|
|
21667f64cd | ||
|
|
2b81e969ea | ||
|
|
ad6a9b97e2 | ||
|
|
ec4d88f496 | ||
|
|
3d86656c1d | ||
|
|
3768a1ae18 | ||
|
|
fc695704a1 | ||
|
|
24dfa6ec84 | ||
|
|
6bebb37320 | ||
|
|
cd72b08b23 | ||
|
|
5215c87f14 | ||
|
|
fb9712a962 | ||
|
|
55f0c7b1f2 | ||
|
|
d4fb5e3cb9 | ||
|
|
8a6f72f3d7 | ||
|
|
ebc3737ebf | ||
|
|
58b90cc2d8 | ||
|
|
62c4328e00 | ||
|
|
2fc90989b7 | ||
|
|
0d50976f3c | ||
|
|
ac2434287d | ||
|
|
9069e5de23 | ||
|
|
552893661b | ||
|
|
a05b79dff9 | ||
|
|
ddc65ffdd1 | ||
|
|
3ab2ca2206 | ||
|
|
2abdfeefce | ||
|
|
a702593e05 | ||
|
|
b4c1f9d2b6 | ||
|
|
8a2800e787 | ||
|
|
a9739e7c4c | ||
|
|
c7e8607f6b | ||
|
|
f479c6c61e | ||
|
|
e2586f82b0 | ||
|
|
2e8cf949a5 | ||
|
|
c7fb0b9079 |
@@ -13,7 +13,6 @@ aclocal.m4
|
||||
autom4te.cache
|
||||
b.out
|
||||
bison-*
|
||||
build-aux
|
||||
conf[0-9]*
|
||||
confdefs*
|
||||
config.cache
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
data/glr.c
|
||||
data/yacc.c
|
||||
lib/yyerror.c
|
||||
@@ -0,0 +1 @@
|
||||
doc/bison.texinfo
|
||||
@@ -66,6 +66,9 @@ release:
|
||||
|
||||
* Release Procedure
|
||||
|
||||
** Try to get the *.pot files to the Translation Project at least one week
|
||||
before a stable release, to give them time to translate them.
|
||||
|
||||
** Tests
|
||||
See above.
|
||||
|
||||
@@ -115,7 +118,7 @@ separate message.
|
||||
|
||||
-----
|
||||
|
||||
Copyright (C) 2002, 2003, 2004 Free Software Foundation, Inc.
|
||||
Copyright (C) 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GNU Bison.
|
||||
|
||||
|
||||
+7
-2
@@ -18,14 +18,19 @@
|
||||
|
||||
ACLOCAL_AMFLAGS = -I m4
|
||||
|
||||
SUBDIRS = config po runtime-po lib data src doc examples tests
|
||||
SUBDIRS = build-aux po runtime-po lib data src doc examples tests
|
||||
|
||||
# Files installed for use by Automake.
|
||||
aclocaldir = @aclocaldir@
|
||||
aclocal_DATA = m4/bison-i18n.m4
|
||||
|
||||
EXTRA_DIST = GNUmakefile Makefile.cfg Makefile.maint \
|
||||
OChangeLog PACKAGING
|
||||
OChangeLog PACKAGING \
|
||||
djgpp/Makefile.maint djgpp/README.in djgpp/config.bat \
|
||||
djgpp/config.sed djgpp/config.site djgpp/config_h.sed \
|
||||
djgpp/subpipe.c djgpp/subpipe.h djgpp/djunpack.bat \
|
||||
djgpp/fnchange.lst
|
||||
|
||||
|
||||
.PHONY: maintainer-check
|
||||
maintainer-check:
|
||||
|
||||
+13
-14
@@ -1,5 +1,5 @@
|
||||
# Customize Makefile.maint for Bison. -*- makefile -*-
|
||||
# Copyright (C) 2003 Free Software Foundation, Inc.
|
||||
# Copyright (C) 2003, 2005, 2006 Free Software Foundation, Inc.
|
||||
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
@@ -16,8 +16,9 @@
|
||||
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
# 02110-1301, USA.
|
||||
|
||||
prev_version_file = $(srcdir)/config/prev-version.txt
|
||||
announce_gen = $(srcdir)/config/announce-gen
|
||||
build_aux_dir = $(srcdir)/build-aux
|
||||
prev_version_file = $(build_aux_dir)/prev-version.txt
|
||||
announce_gen = $(build_aux_dir)/announce-gen
|
||||
release_archive_dir = releases
|
||||
|
||||
# Use alpha.gnu.org for alpha and beta releases.
|
||||
@@ -32,18 +33,16 @@ url_dir_list = \
|
||||
|
||||
# Files to update automatically.
|
||||
wget_files = \
|
||||
$(srcdir)/config/config.guess \
|
||||
$(srcdir)/config/config.sub \
|
||||
$(srcdir)/config/texinfo.tex \
|
||||
$(build_aux_dir)/config.guess \
|
||||
$(build_aux_dir)/config.sub \
|
||||
$(build_aux_dir)/texinfo.tex \
|
||||
|
||||
cvs_files = \
|
||||
$(srcdir)/config/install-sh \
|
||||
$(srcdir)/config/mdate-sh \
|
||||
$(srcdir)/config/missing \
|
||||
$(srcdir)/config/mkinstalldirs
|
||||
$(build_aux_dir)/install-sh \
|
||||
$(build_aux_dir)/mdate-sh \
|
||||
$(build_aux_dir)/missing \
|
||||
$(build_aux_dir)/mkinstalldirs
|
||||
|
||||
# Tests not to run.
|
||||
# local-checks-to-skip ?= \
|
||||
# author_mark_check \
|
||||
# strftime-check syntax-check makefile_path_separator_check \
|
||||
# makefile-check
|
||||
local-checks-to-skip = \
|
||||
changelog-check
|
||||
|
||||
+94
-54
@@ -2,7 +2,7 @@
|
||||
# This Makefile fragment is shared between the coreutils,
|
||||
# CPPI, Bison, and Autoconf.
|
||||
|
||||
## Copyright (C) 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
|
||||
## Copyright (C) 2001-2006 Free Software Foundation, Inc.
|
||||
##
|
||||
## This program is free software; you can redistribute it and/or modify
|
||||
## it under the terms of the GNU General Public License as published by
|
||||
@@ -25,24 +25,25 @@ ME := Makefile.maint
|
||||
|
||||
# Do not save the original name or timestamp in the .tar.gz file.
|
||||
# Use --rsyncable if available.
|
||||
GZIP_ENV = \
|
||||
"--no-name --best$$( \
|
||||
case $$(gzip --help) in \
|
||||
(*--rsyncable*) echo ' --rsyncable';; \
|
||||
esac \
|
||||
)"
|
||||
gzip_rsyncable = \
|
||||
(gzip --help|grep rsyncable) >/dev/null 2>&1 && echo --rsyncable
|
||||
GZIP_ENV = "--no-name --best `$(gzip_rsyncable)`"
|
||||
|
||||
CVS = cvs
|
||||
|
||||
# cvsu is part of the cvsutils package: http://www.red-bean.com/cvsutils/
|
||||
CVS_LIST = sh -c ' \
|
||||
(cvsu --find --types=AFGM $$*) 2>/dev/null || \
|
||||
awk -F/ '\''{ \
|
||||
if (!$$1 && $$3 !~ /^-/) { \
|
||||
f=FILENAME; \
|
||||
sub(/CVS\/Entries/, "", f); \
|
||||
print f $$2; \
|
||||
}}'\'' \
|
||||
$$(find $${*-*} -name Entries -print) /dev/null \
|
||||
if test -x $(srcdir)/build-aux/cvsu; then \
|
||||
$(srcdir)/build-aux/cvsu --find --types=AFGM $$*; \
|
||||
else \
|
||||
awk -F/ '\''{ \
|
||||
if (!$$1 && $$3 !~ /^-/) { \
|
||||
f=FILENAME; \
|
||||
sub(/CVS\/Entries/, "", f); \
|
||||
print f $$2; \
|
||||
}}'\'' \
|
||||
$$(find $${*-*} -name Entries -print) /dev/null; \
|
||||
fi \
|
||||
' dummy
|
||||
|
||||
CVS_LIST_EXCEPT = \
|
||||
@@ -53,6 +54,7 @@ ifeq ($(origin prev_version_file), undefined)
|
||||
endif
|
||||
|
||||
PREV_VERSION := $(shell cat $(prev_version_file))
|
||||
VERSION_REGEXP = $(subst .,\.,$(VERSION))
|
||||
|
||||
tag-package = $(shell echo "$(PACKAGE)" | tr '[:lower:]' '[:upper:]')
|
||||
tag-this-version = $(subst .,_,$(VERSION))
|
||||
@@ -73,12 +75,17 @@ export LC_ALL = C
|
||||
## Sanity checks. ##
|
||||
## --------------- ##
|
||||
|
||||
# FIXME: add a check to prohibit definition in src/*.c of symbols defined
|
||||
# in system.h. E.g. today I removed from tail.c a useless definition of
|
||||
# ENOSYS. It was useless because system.h ensures it's defined.
|
||||
|
||||
# Checks that don't require cvs.
|
||||
# Run `changelog-check' last, as previous test may reveal problems requiring
|
||||
# new ChangeLog entries.
|
||||
local-checks-available = \
|
||||
po-check copyright-check writable-files m4-check author_mark_check \
|
||||
changelog-check strftime-check syntax-check makefile_path_separator_check \
|
||||
changelog-check strftime-check $(syntax-check-rules) \
|
||||
makefile_path_separator_check \
|
||||
makefile-check
|
||||
.PHONY: $(local-checks-available)
|
||||
|
||||
@@ -93,16 +100,21 @@ syntax-check-rules = \
|
||||
sc_dd_max_sym_length \
|
||||
sc_error_exit_success \
|
||||
sc_file_system \
|
||||
sc_no_if_have_config_h \
|
||||
sc_obsolete_symbols \
|
||||
sc_prohibit_atoi_atof \
|
||||
sc_prohibit_jm_in_m4 \
|
||||
sc_prohibit_assert_without_use \
|
||||
sc_require_config_h \
|
||||
sc_root_tests \
|
||||
sc_space_tab \
|
||||
sc_sun_os_names \
|
||||
sc_system_h_headers \
|
||||
sc_tight_scope \
|
||||
sc_trailing_space \
|
||||
sc_unmarked_diagnostics
|
||||
sc_trailing_blank \
|
||||
sc_two_space_separator_in_usage \
|
||||
sc_unmarked_diagnostics \
|
||||
sc_useless_cpp_parens
|
||||
|
||||
syntax-check: $(syntax-check-rules)
|
||||
# @grep -nE '# *include <(limits|std(def|arg|bool))\.h>' \
|
||||
@@ -135,8 +147,7 @@ sc_cast_of_alloca_return_value:
|
||||
exit 1; } || :
|
||||
|
||||
sc_space_tab:
|
||||
@grep -n '[ ] ' \
|
||||
$$($(CVS_LIST_EXCEPT)) && \
|
||||
@grep -n '[ ] ' $$($(CVS_LIST_EXCEPT)) && \
|
||||
{ echo '$(ME): found SPACE-TAB sequence; remove the SPACE' \
|
||||
1>&2; exit 1; } || :
|
||||
|
||||
@@ -144,8 +155,7 @@ sc_space_tab:
|
||||
# They provide no error checking mechanism.
|
||||
# Instead, use strto* functions.
|
||||
sc_prohibit_atoi_atof:
|
||||
@grep -nE '\<(ato[filq]|ato''ll)\>' \
|
||||
$$($(CVS_LIST_EXCEPT)) && \
|
||||
@grep -nE '\<ato([filq]|ll)\>' $$($(CVS_LIST_EXCEPT)) && \
|
||||
{ echo '$(ME): do not use ato''f, ato''i, ato''l, ato''ll, or ato''q' \
|
||||
1>&2; exit 1; } || :
|
||||
|
||||
@@ -158,16 +168,37 @@ sc_error_exit_success:
|
||||
exit 1; } || :
|
||||
|
||||
sc_file_system:
|
||||
@grep -ni 'file''system' \
|
||||
$$($(CVS_LIST_EXCEPT)) && \
|
||||
@grep -ni 'file''system' $$($(CVS_LIST_EXCEPT)) && \
|
||||
{ echo '$(ME): found use of "file''system";' \
|
||||
'rewrite to use "file system"' 1>&2; \
|
||||
exit 1; } || :
|
||||
|
||||
sc_no_if_have_config_h:
|
||||
@grep -n '^# *if HAVE_CONFIG_H' $$($(CVS_LIST_EXCEPT)) && \
|
||||
{ echo '$(ME): found use of #if HAVE_CONFIG_H; use #ifdef' \
|
||||
1>&2; exit 1; } || :
|
||||
|
||||
# Nearly all .c files must include <config.h>.
|
||||
sc_require_config_h:
|
||||
@grep -L '^# *include <config\.h>' \
|
||||
$$($(CVS_LIST_EXCEPT) | grep '\.c$$') \
|
||||
| grep . && \
|
||||
{ echo '$(ME): the above files do not include <config.h>' \
|
||||
1>&2; exit 1; } || :
|
||||
|
||||
# Prohibit the inclusion of assert.h without an actual use of assert.
|
||||
sc_prohibit_assert_without_use:
|
||||
@files=$$(grep -l '# *include <assert\.h>' \
|
||||
$$($(CVS_LIST_EXCEPT) | grep '\.c$$')) && \
|
||||
grep -L '\<assert (' $$files \
|
||||
| grep . && \
|
||||
{ echo "$(ME): the above files include <assert.h> but don't use it" \
|
||||
1>&2; exit 1; } || :
|
||||
|
||||
sc_obsolete_symbols:
|
||||
@grep -nE '\<(HAVE_''FCNTL_H)\>' \
|
||||
@grep -nE '\<(HAVE''_FCNTL_H|O''_NDELAY)\>' \
|
||||
$$($(CVS_LIST_EXCEPT)) && \
|
||||
{ echo '$(ME): do not use HAVE_''FCNTL_H' \
|
||||
{ echo '$(ME): do not use HAVE''_FCNTL_H or O''_NDELAY' \
|
||||
1>&2; exit 1; } || :
|
||||
|
||||
# FIXME: warn about definitions of EXIT_FAILURE, EXIT_SUCCESS, STREQ
|
||||
@@ -186,7 +217,7 @@ ifneq ($(wildcard $(dd_c)),)
|
||||
@len=$$( (sed -n '/conversions\[\] =$$/,/^};/p' $(dd_c);\
|
||||
sed -n '/flags\[\] =$$/,/^};/p' $(dd_c) ) \
|
||||
|sed -n '/"/s/^[^"]*"\([^"]*\)".*/\1/p' \
|
||||
| wc --max-line-length); \
|
||||
| wc --max-line-length); \
|
||||
max=$$(sed -n '/^#define LONGEST_SYMBOL /s///p' $(dd_c) \
|
||||
|tr -d '"' | wc --max-line-length); \
|
||||
if test "$$len" = "$$max"; then :; else \
|
||||
@@ -228,7 +259,7 @@ sc_root_tests:
|
||||
# Files in src/ should not include directly any of
|
||||
# the headers already included via system.h.
|
||||
sc_system_h_headers: .re-list
|
||||
if test -f $(srcdir)/src/system.h; then \
|
||||
@if test -f $(srcdir)/src/system.h; then \
|
||||
trap 'rc=$$?; rm -f .re-list; exit $$rc' 0 1 2 3 15; \
|
||||
grep -nE -f .re-list \
|
||||
$$($(CVS_LIST) src | \
|
||||
@@ -240,28 +271,41 @@ sc_system_h_headers: .re-list
|
||||
sc_sun_os_names:
|
||||
@grep -nEi \
|
||||
'solaris[^[:alnum:]]*2\.(7|8|9|[1-9][0-9])|sunos[^[:alnum:]][6-9]' \
|
||||
$$($(CVS_LIST_EXCEPT)) && \
|
||||
$$($(CVS_LIST_EXCEPT)) && \
|
||||
{ echo '$(ME): found misuse of Sun OS version numbers' 1>&2; \
|
||||
exit 1; } || :
|
||||
|
||||
sc_tight_scope:
|
||||
$(MAKE) -C src $@
|
||||
|
||||
sc_trailing_space:
|
||||
@grep -n '[ ]$$' \
|
||||
$$($(CVS_LIST_EXCEPT)) && \
|
||||
{ echo '$(ME): found trailing space(s)' \
|
||||
sc_trailing_blank:
|
||||
@grep -n '[ ]$$' $$($(CVS_LIST_EXCEPT)) && \
|
||||
{ echo '$(ME): found trailing blank(s)' \
|
||||
1>&2; exit 1; } || :
|
||||
|
||||
sc_two_space_separator_in_usage:
|
||||
@grep -n '^ *--[a-z][0-9A-Za-z-]* [^ ].*\\$$' \
|
||||
$$($(CVS_LIST_EXCEPT)) && \
|
||||
{ echo "$(ME): help2man requires at least two spaces between"; \
|
||||
echo "$(ME): an option and its description"; \
|
||||
1>&2; exit 1; } || :
|
||||
|
||||
# Look for diagnostics that aren't marked for translation.
|
||||
# This won't find any for which error's format string is on a separate line.
|
||||
sc_unmarked_diagnostics:
|
||||
@grep -nE \
|
||||
'\<error \([^"]*"[^"]*[a-z]{3}' $(srcdir)/{lib,src}/*.c \
|
||||
| grep -v '_(' && \
|
||||
'\<error \([^"]*"[^"]*[a-z]{3}' $$($(CVS_LIST_EXCEPT)) \
|
||||
| grep -v '_''(' && \
|
||||
{ echo '$(ME): found unmarked diagnostic(s)' 1>&2; \
|
||||
exit 1; } || :
|
||||
|
||||
# Avoid useless parentheses like those in this example:
|
||||
# #if defined (SYMBOL) || defined (SYM2)
|
||||
sc_useless_cpp_parens:
|
||||
@grep -n '^# *if .*defined *(' $$($(CVS_LIST_EXCEPT)) && \
|
||||
{ echo '$(ME): found useless parentheses in cpp directive' \
|
||||
1>&2; exit 1; } || :
|
||||
|
||||
# Ensure that date's --help output stays in sync with the info
|
||||
# documentation for GNU strftime. The only exception is %N,
|
||||
# which date accepts but GNU strftime does not.
|
||||
@@ -286,15 +330,17 @@ makefile-check:
|
||||
|
||||
news-date-check: NEWS
|
||||
today=`date +%Y-%m-%d`; \
|
||||
if head NEWS | grep '^\*.*'$$today >/dev/null; then \
|
||||
if head NEWS | grep '^\*.* $(VERSION_REGEXP) ('$$today')' \
|
||||
>/dev/null; then \
|
||||
:; \
|
||||
else \
|
||||
echo "today's date is not in NEWS" 1>&2; \
|
||||
echo "version or today's date is not in NEWS" 1>&2; \
|
||||
exit 1; \
|
||||
fi
|
||||
|
||||
changelog-check:
|
||||
if head ChangeLog | grep 'Version $(VERSION)' >/dev/null; then \
|
||||
if head ChangeLog | grep 'Version $(VERSION_REGEXP)\.$$' \
|
||||
>/dev/null; then \
|
||||
:; \
|
||||
else \
|
||||
echo "$(VERSION) not in ChangeLog" 1>&2; \
|
||||
@@ -302,18 +348,21 @@ changelog-check:
|
||||
fi
|
||||
|
||||
m4-check:
|
||||
@grep 'AC_DEFUN([^[]' m4/*.m4 \
|
||||
@grep -n 'AC_DEFUN([^[]' m4/*.m4 \
|
||||
&& { echo 'Makefile.maint: quote the first arg to AC_DEFUN' 1>&2; \
|
||||
exit 1; } || :
|
||||
|
||||
# Verify that all source files using _() are listed in po/POTFILES.in.
|
||||
# FIXME: don't hard-code src/false.c below; use a more general mechanism.
|
||||
# FIXME: don't hard-code file names below; use a more general mechanism.
|
||||
po-check:
|
||||
if test -f po/POTFILES.in; then \
|
||||
grep -E -v '^(#|$$)' po/POTFILES.in \
|
||||
| grep -v '^src/false\.c$$' | sort > $@-1; \
|
||||
files=; \
|
||||
for file in lib/*.[chly] src/*.[chly]; do \
|
||||
for file in $$($(CVS_LIST_EXCEPT)) lib/*.[ch]; do \
|
||||
case $$file in \
|
||||
djgpp/* | man/*) continue;; \
|
||||
esac; \
|
||||
case $$file in \
|
||||
*.[ch]) \
|
||||
base=`expr " $$file" : ' \(.*\)\..'`; \
|
||||
@@ -321,7 +370,7 @@ po-check:
|
||||
esac; \
|
||||
files="$$files $$file"; \
|
||||
done; \
|
||||
grep -E -l '\bN?_\([^)"]*("|$$)' $$files | sort > $@-2; \
|
||||
grep -E -l '\bN?_\([^)"]*("|$$)' $$files | sort -u > $@-2; \
|
||||
diff -u $@-1 $@-2 || exit 1; \
|
||||
rm -f $@-1 $@-2; \
|
||||
fi
|
||||
@@ -363,7 +412,7 @@ v_etc_file = lib/version-etc.c
|
||||
# Make sure that the copyright date in $(v_etc_file) is up to date.
|
||||
copyright-check:
|
||||
@if test -f $(v_etc_file); then \
|
||||
grep 'enum { COPYRIGHT_YEAR = 2005 };' $(v_etc_file) \
|
||||
grep 'enum { COPYRIGHT_YEAR = '$$(date +%Y)' };' $(v_etc_file) \
|
||||
>/dev/null \
|
||||
|| { echo 'out of date copyright in $(v_etc_file); update it' 1>&2; \
|
||||
exit 1; }; \
|
||||
@@ -419,7 +468,7 @@ null_AM_MAKEFLAGS = \
|
||||
# have to have a recent version of gcc and glibc headers.
|
||||
TMPDIR ?= /tmp
|
||||
t=$(TMPDIR)/$(PACKAGE)/test
|
||||
my-distcheck: $(local-check)
|
||||
my-distcheck: $(local-check) $(release_archive_dir)/$(prev-tgz)
|
||||
-rm -rf $(t)
|
||||
mkdir -p $(t)
|
||||
GZIP=$(GZIP_ENV) $(AMTAR) -C $(t) -zxf $(distdir).tar.gz
|
||||
@@ -441,16 +490,6 @@ my-distcheck: $(local-check)
|
||||
WGET = wget
|
||||
WGETFLAGS = -C off
|
||||
|
||||
tgz-md5 = $(shell md5sum < $(my_distdir).tar.gz|sed 's/ -//')
|
||||
tgz-sha1 = $(shell sha1sum < $(my_distdir).tar.gz|sed 's/ -//')
|
||||
bz2-md5 = $(shell md5sum < $(my_distdir).tar.bz2|sed 's/ -//')
|
||||
bz2-sha1 = $(shell sha1sum < $(my_distdir).tar.bz2|sed 's/ -//')
|
||||
xdelta-md5 = $(shell md5sum < $(xd-delta)|sed 's/ -//')
|
||||
xdelta-sha1 = $(shell sha1sum < $(xd-delta)|sed 's/ -//')
|
||||
tgz-size = $(shell du --human $(my_distdir).tar.gz|sed 's/\([MkK]\).*/ \1B/')
|
||||
bz2-size = $(shell du --human $(my_distdir).tar.bz2|sed 's/\([MkK]\).*/ \1B/')
|
||||
xd-size = $(shell du --human $(xd-delta)|sed 's/\([MkK]\).*/ \1B/')
|
||||
|
||||
rel-check:
|
||||
tarz=/tmp/rel-check-tarz-$$$$; \
|
||||
md5_tmp=/tmp/rel-check-md5-$$$$; \
|
||||
@@ -471,6 +510,7 @@ announcement: NEWS ChangeLog $(rel-files)
|
||||
--prev=$(PREV_VERSION) \
|
||||
--curr=$(VERSION) \
|
||||
--release-archive-directory=$(release_archive_dir) \
|
||||
--gpg-key-id=$(gpg_key_ID) \
|
||||
--news=NEWS \
|
||||
$(addprefix --url-dir=, $(url_dir_list)) \
|
||||
|
||||
|
||||
@@ -1,8 +1,207 @@
|
||||
Bison News
|
||||
----------
|
||||
|
||||
Changes in version 2.3a, 2006-09-13:
|
||||
|
||||
* Instead of %union, you can define and use your own union type
|
||||
YYSTYPE if your grammar contains at least one <type> tag.
|
||||
Your YYSTYPE need not be a macro; it can be a typedef.
|
||||
This change is for compatibility with other Yacc implementations,
|
||||
and is required by POSIX.
|
||||
|
||||
* Locations columns and lines start at 1.
|
||||
In accordance with the GNU Coding Standards and Emacs.
|
||||
|
||||
* You may now declare per-type and default %destructor's and %printer's:
|
||||
|
||||
For example:
|
||||
|
||||
%union { char *string; }
|
||||
%token <string> STRING1
|
||||
%token <string> STRING2
|
||||
%type <string> string1
|
||||
%type <string> string2
|
||||
%union { char character; }
|
||||
%token <character> CHR
|
||||
%type <character> chr
|
||||
%destructor { free ($$); } %symbol-default
|
||||
%destructor { free ($$); printf ("%d", @$.first_line); } STRING1 string1
|
||||
%destructor { } <character>
|
||||
|
||||
guarantees that, when the parser discards any user-defined symbol that has a
|
||||
semantic type tag other than `<character>', it passes its semantic value to
|
||||
`free'. However, when the parser discards a `STRING1' or a `string1', it
|
||||
also prints its line number to `stdout'. It performs only the second
|
||||
`%destructor' in this case, so it invokes `free' only once.
|
||||
|
||||
* Except for LALR(1) parsers in C with POSIX Yacc emulation enabled (with `-y',
|
||||
`--yacc', or `%yacc'), Bison no longer generates #define statements for
|
||||
associating token numbers with token names. Removing the #define statements
|
||||
helps to sanitize the global namespace during preprocessing, but POSIX Yacc
|
||||
requires them. Bison still generates an enum for token names in all cases.
|
||||
|
||||
* Handling of traditional Yacc prologue blocks is now more consistent but
|
||||
potentially incompatible with previous releases of Bison.
|
||||
|
||||
As before, you declare prologue blocks in your grammar file with the
|
||||
`%{ ... %}' syntax. To generate the pre-prologue, Bison concatenates all
|
||||
prologue blocks that you've declared before the first %union. To generate
|
||||
the post-prologue, Bison concatenates all prologue blocks that you've
|
||||
declared after the first %union.
|
||||
|
||||
Previous releases of Bison inserted the pre-prologue into both the header
|
||||
file and the code file in all cases except for LALR(1) parsers in C. In the
|
||||
latter case, Bison inserted it only into the code file. For parsers in C++,
|
||||
the point of insertion was before any token definitions (which associate
|
||||
token numbers with names). For parsers in C, the point of insertion was
|
||||
after the token definitions.
|
||||
|
||||
Now, Bison never inserts the pre-prologue into the header file. In the code
|
||||
file, it always inserts it before the token definitions.
|
||||
|
||||
* Bison now provides a more flexible alternative to the traditional Yacc
|
||||
prologue blocks: %before-header, %start-header, %end-header, and
|
||||
%after-header.
|
||||
|
||||
For example, the following declaration order in the grammar file reflects the
|
||||
order in which Bison will output these code blocks. However, you are free to
|
||||
declare these code blocks in your grammar file in whatever order is most
|
||||
convenient for you:
|
||||
|
||||
%before-header {
|
||||
/* Bison treats this block like a pre-prologue block: it inserts it into
|
||||
* the code file before the contents of the header file. It does *not*
|
||||
* insert it into the header file. This is a good place to put
|
||||
* #include's that you want at the top of your code file. A common
|
||||
* example is `#include "system.h"'. */
|
||||
}
|
||||
%start-header {
|
||||
/* Bison inserts this block into both the header file and the code file.
|
||||
* In both files, the point of insertion is before any Bison-generated
|
||||
* token, semantic type, location type, and class definitions. This is a
|
||||
* good place to define %union dependencies, for example. */
|
||||
}
|
||||
%union {
|
||||
/* Unlike the traditional Yacc prologue blocks, the output order for the
|
||||
* new %*-header blocks is not affected by their declaration position
|
||||
* relative to any %union in the grammar file. */
|
||||
}
|
||||
%end-header {
|
||||
/* Bison inserts this block into both the header file and the code file.
|
||||
* In both files, the point of insertion is after the Bison-generated
|
||||
* definitions. This is a good place to declare or define public
|
||||
* functions or data structures that depend on the Bison-generated
|
||||
* definitions. */
|
||||
}
|
||||
%after-header {
|
||||
/* Bison treats this block like a post-prologue block: it inserts it into
|
||||
* the code file after the contents of the header file. It does *not*
|
||||
* insert it into the header file. This is a good place to declare or
|
||||
* define internal functions or data structures that depend on the
|
||||
* Bison-generated definitions. */
|
||||
}
|
||||
|
||||
If you have multiple occurrences of any one of the above declarations, Bison
|
||||
will concatenate the contents in declaration order.
|
||||
|
||||
* The option `--report=look-ahead' has been changed to `--report=lookahead'.
|
||||
The old spelling still works, but is not documented and may be removed
|
||||
in a future release.
|
||||
|
||||
Changes in version 2.3, 2006-06-05:
|
||||
|
||||
* GLR grammars should now use `YYRECOVERING ()' instead of `YYRECOVERING',
|
||||
for compatibility with LALR(1) grammars.
|
||||
|
||||
* It is now documented that any definition of YYSTYPE or YYLTYPE should
|
||||
be to a type name that does not contain parentheses or brackets.
|
||||
|
||||
Changes in version 2.2, 2006-05-19:
|
||||
|
||||
* The distribution terms for all Bison-generated parsers now permit
|
||||
using the parsers in nonfree programs. Previously, this permission
|
||||
was granted only for Bison-generated LALR(1) parsers in C.
|
||||
|
||||
* %name-prefix changes the namespace name in C++ outputs.
|
||||
|
||||
* The C++ parsers export their token_type.
|
||||
|
||||
* Bison now allows multiple %union declarations, and concatenates
|
||||
their contents together.
|
||||
|
||||
* New warning: unused values
|
||||
Right-hand side symbols whose values are not used are reported,
|
||||
if the symbols have destructors. For instance:
|
||||
|
||||
exp: exp "?" exp ":" exp { $1 ? $1 : $3; }
|
||||
| exp "+" exp
|
||||
;
|
||||
|
||||
will trigger a warning about $$ and $5 in the first rule, and $3 in
|
||||
the second ($1 is copied to $$ by the default rule). This example
|
||||
most likely contains three errors, and could be rewritten as:
|
||||
|
||||
exp: exp "?" exp ":" exp
|
||||
{ $$ = $1 ? $3 : $5; free ($1 ? $5 : $3); free ($1); }
|
||||
| exp "+" exp
|
||||
{ $$ = $1 ? $1 : $3; if ($1) free ($3); }
|
||||
;
|
||||
|
||||
However, if the original actions were really intended, memory leaks
|
||||
and all, the warnings can be suppressed by letting Bison believe the
|
||||
values are used, e.g.:
|
||||
|
||||
exp: exp "?" exp ":" exp { $1 ? $1 : $3; (void) ($$, $5); }
|
||||
| exp "+" exp { $$ = $1; (void) $3; }
|
||||
;
|
||||
|
||||
If there are mid-rule actions, the warning is issued if no action
|
||||
uses it. The following triggers no warning: $1 and $3 are used.
|
||||
|
||||
exp: exp { push ($1); } '+' exp { push ($3); sum (); };
|
||||
|
||||
The warning is intended to help catching lost values and memory leaks.
|
||||
If a value is ignored, its associated memory typically is not reclaimed.
|
||||
|
||||
* %destructor vs. YYABORT, YYACCEPT, and YYERROR.
|
||||
Destructors are now called when user code invokes YYABORT, YYACCEPT,
|
||||
and YYERROR, for all objects on the stack, other than objects
|
||||
corresponding to the right-hand side of the current rule.
|
||||
|
||||
* %expect, %expect-rr
|
||||
Incorrect numbers of expected conflicts are now actual errors,
|
||||
instead of warnings.
|
||||
|
||||
* GLR, YACC parsers.
|
||||
The %parse-params are available in the destructors (and the
|
||||
experimental printers) as per the documentation.
|
||||
|
||||
* Bison now warns if it finds a stray `$' or `@' in an action.
|
||||
|
||||
* %require "VERSION"
|
||||
This specifies that the grammar file depends on features implemented
|
||||
in Bison version VERSION or higher.
|
||||
|
||||
* lalr1.cc: The token and value types are now class members.
|
||||
The tokens were defined as free form enums and cpp macros. YYSTYPE
|
||||
was defined as a free form union. They are now class members:
|
||||
tokens are enumerations of the `yy::parser::token' struct, and the
|
||||
semantic values have the `yy::parser::semantic_type' type.
|
||||
|
||||
If you do not want or can update to this scheme, the directive
|
||||
`%define "global_tokens_and_yystype" "1"' triggers the global
|
||||
definition of tokens and YYSTYPE. This change is suitable both
|
||||
for previous releases of Bison, and this one.
|
||||
|
||||
If you wish to update, then make sure older version of Bison will
|
||||
fail using `%require "2.2"'.
|
||||
|
||||
* DJGPP support added.
|
||||
|
||||
Changes in version 2.1, 2005-09-16:
|
||||
|
||||
* The C++ lalr1.cc skeleton supports %lex-param.
|
||||
|
||||
* Bison-generated parsers now support the translation of diagnostics like
|
||||
"syntax error" into languages other than English. The default
|
||||
language is still English. For details, please see the new
|
||||
@@ -24,7 +223,7 @@ Changes in version 2.1, 2005-09-16:
|
||||
a syntax error associated with '%token NUM "number"' they might
|
||||
print 'syntax error, unexpected number' instead of 'syntax error,
|
||||
unexpected "number"'.
|
||||
|
||||
|
||||
Changes in version 2.0, 2004-12-25:
|
||||
|
||||
* Possibly-incompatible changes
|
||||
@@ -67,8 +266,7 @@ Changes in version 2.0, 2004-12-25:
|
||||
This is a GNU extension.
|
||||
|
||||
- The option `--report=lookahead' was changed to `--report=look-ahead'.
|
||||
The old spelling still works, but is not documented and will be
|
||||
removed.
|
||||
[However, this was changed back after 2.3.]
|
||||
|
||||
- Experimental %destructor support has been added to lalr1.cc.
|
||||
|
||||
@@ -335,8 +533,8 @@ Changes in version 1.50, 2002-10-04:
|
||||
produces additional information:
|
||||
- itemset
|
||||
complete the core item sets with their closure
|
||||
- lookahead [changed to `look-ahead' in 1.875e and later]
|
||||
explicitly associate look-ahead tokens to items
|
||||
- lookahead [changed to `look-ahead' in 1.875e through 2.3, but changed back]
|
||||
explicitly associate lookahead tokens to items
|
||||
- solved
|
||||
describe shift/reduce conflicts solving.
|
||||
Bison used to systematically output this information on top of
|
||||
@@ -619,8 +817,8 @@ End:
|
||||
|
||||
-----
|
||||
|
||||
Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005
|
||||
Free Software Foundation, Inc.
|
||||
Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003,
|
||||
2004, 2005, 2006 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of Bison, the GNU Compiler Compiler.
|
||||
|
||||
|
||||
+2
-2
@@ -30,7 +30,7 @@ out-of-date version of the C code, but the process is not foolproof.
|
||||
Also, you may run into similar problems yourself if you modify Bison.
|
||||
|
||||
Only building the initial full source tree will be a bit painful,
|
||||
later, a plain `cvs update -P & make' should be sufficient.
|
||||
later, a plain `cvs update -P && make' should be sufficient.
|
||||
|
||||
* First CVS checkout
|
||||
|
||||
@@ -59,7 +59,7 @@ Enjoy!
|
||||
|
||||
-----
|
||||
|
||||
Copyright (C) 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
|
||||
Copyright (C) 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GNU Bison.
|
||||
|
||||
|
||||
+1
-1
@@ -19,7 +19,7 @@ kludges that Johnson had to perpetrate to make Yacc fit in a PDP-11.
|
||||
Also, Bison uses a faster but less space-efficient encoding for the
|
||||
parse tables (see Corbett's PhD thesis from Berkeley, "Static
|
||||
Semantics in Compiler Error Recovery", June 1985, Report No. UCB/CSD
|
||||
85/251), and more modern technique for generating the look-ahead sets.
|
||||
85/251), and more modern technique for generating the lookahead sets.
|
||||
(See Frank DeRemer and Thomas Pennello, "Efficient Computation of
|
||||
LALR(1) Look-Ahead Sets", ACM Transactions on Programming Languages
|
||||
and Systems (TOPLAS) 4, 4 (October 1982), 615-649. Their
|
||||
|
||||
@@ -21,6 +21,7 @@ Cris Bailiff [email protected]
|
||||
Cris van Pelt [email protected]
|
||||
Daniel Hagerty [email protected]
|
||||
David J. MacKenzie [email protected]
|
||||
Derek M. Jones [email protected]
|
||||
Dick Streefland [email protected]
|
||||
Enrico Scholz [email protected]
|
||||
Evgeny Stambulchik [email protected]
|
||||
@@ -34,7 +35,7 @@ Jan Nieuwenhuizen [email protected]
|
||||
Jesse Thilo [email protected]
|
||||
Jim Kent [email protected]
|
||||
Jim Meyering [email protected]
|
||||
Joel E. Denny jdenny@hubcap.clemson.edu
|
||||
Joel E. Denny jdenny@ces.clemson.edu
|
||||
Juan Manuel Guerrero [email protected]
|
||||
Kees Zeelenberg [email protected]
|
||||
Keith Browne [email protected]
|
||||
@@ -42,15 +43,18 @@ Laurent Mascherpa [email protected]
|
||||
Magnus Fromreide [email protected]
|
||||
Marc Autret [email protected]
|
||||
Martin Mokrejs [email protected]
|
||||
Martin Nylin [email protected]
|
||||
Matt Kraai [email protected]
|
||||
Matt Rosing [email protected]
|
||||
Michael Hayes [email protected]
|
||||
Mickael Labau [email protected]
|
||||
Mike Castle [email protected]
|
||||
Neil Booth [email protected]
|
||||
Nelson H. F. Beebe [email protected]
|
||||
Nicolas Burrus [email protected]
|
||||
Nicolas Tisserand [email protected]
|
||||
Noah Friedman [email protected]
|
||||
Oleg Smolsky [email protected]
|
||||
Pascal Bart [email protected]
|
||||
Paul Eggert [email protected]
|
||||
Paul Hilfinger [email protected]
|
||||
@@ -64,17 +68,19 @@ Raja R Harinath [email protected]
|
||||
Richard Stallman [email protected]
|
||||
Robert Anisko [email protected]
|
||||
Shura [email protected]
|
||||
Steve Murphy [email protected]
|
||||
Tim Josling [email protected]
|
||||
Tim Van Holder [email protected]
|
||||
Tom Lane [email protected]
|
||||
Tom Tromey [email protected]
|
||||
Tommy Nordgren [email protected]
|
||||
Troy A. Johnson [email protected]
|
||||
Tys Lefering [email protected]
|
||||
Vin Shelton [email protected]
|
||||
Wayne Green [email protected]
|
||||
Wolfram Wagner [email protected]
|
||||
Wwp [email protected]
|
||||
Zack Weinberg [email protected]
|
||||
[email protected]
|
||||
|
||||
Many people are not named here because we lost track of them. We
|
||||
thank them! Please, help us keeping this list up to date.
|
||||
|
||||
@@ -12,6 +12,15 @@ They should not: it is not documented. But if they need to, let's
|
||||
find something clean (not like YYLSP_NEEDED...).
|
||||
|
||||
|
||||
* Installation
|
||||
|
||||
** Disable installation of yacc.
|
||||
|
||||
Add an option to 'configure' that allows people to install Bison
|
||||
without installing the yacc wrapper script or the rarely-used little
|
||||
yacc library required by Posix. This is for people who prefer some
|
||||
other implementation of yacc.
|
||||
|
||||
* Documentation
|
||||
Before releasing, make sure the documentation ("Understanding your
|
||||
parser") refers to the current `output' format.
|
||||
@@ -27,7 +36,7 @@ Catch up with yacc.c.
|
||||
|
||||
** GLR
|
||||
How would Paul like to display the conflicted actions? In particular,
|
||||
what when two reductions are possible on a given look-ahead token, but one is
|
||||
what when two reductions are possible on a given lookahead token, but one is
|
||||
part of $default. Should we make the two reductions explicit, or just
|
||||
keep $default? See the following point.
|
||||
|
||||
@@ -87,32 +96,6 @@ we should be able to have:
|
||||
|
||||
Or something like this.
|
||||
|
||||
** yysymprint interface
|
||||
It should be improved, in particular when using Bison features such as
|
||||
locations, and YYPARSE_PARAMS. For the time being, it is almost
|
||||
recommended to yyprint to steal internal variables...
|
||||
|
||||
** Several %unions
|
||||
I think this is a pleasant (but useless currently) feature, but in the
|
||||
future, I want a means to %include other bits of grammars, and _then_
|
||||
it will be important for the various bits to define their needs in
|
||||
%union.
|
||||
|
||||
When implementing multiple-%union support, bare the following in mind:
|
||||
|
||||
- when --yacc, this must be flagged as an error. Don't make it fatal
|
||||
though.
|
||||
|
||||
- The #line must now appear *inside* the definition of yystype.
|
||||
Something like
|
||||
|
||||
{
|
||||
#line 12 "foo.y"
|
||||
int ival;
|
||||
#line 23 "foo.y"
|
||||
char *sval;
|
||||
}
|
||||
|
||||
** %if and the like
|
||||
It should be possible to have %if/%else/%endif. The implementation is
|
||||
not clear: should it be lexical or syntactic. Vadim Maslow thinks it
|
||||
@@ -203,28 +186,16 @@ Paul notes:
|
||||
the source code. This should get fixed.
|
||||
|
||||
* --graph
|
||||
Show reductions. []
|
||||
Show reductions.
|
||||
|
||||
* Broken options ?
|
||||
** %no-parser []
|
||||
** %token-table []
|
||||
** Skeleton strategy. []
|
||||
Must we keep %no-parser?
|
||||
%token-table?
|
||||
** %no-parser
|
||||
** %token-table
|
||||
** Skeleton strategy
|
||||
Must we keep %no-parser? %token-table?
|
||||
|
||||
* src/print_graph.c
|
||||
Find the best graph parameters. []
|
||||
|
||||
* doc/bison.texinfo
|
||||
** Update
|
||||
informations about ERROR_VERBOSE. []
|
||||
** Add explanations about
|
||||
skeleton muscles. []
|
||||
%skeleton. []
|
||||
|
||||
* testsuite
|
||||
** tests/pure-parser.at []
|
||||
New tests.
|
||||
Find the best graph parameters.
|
||||
|
||||
* BTYacc
|
||||
See if we can integrate backtracking in Bison. Charles-Henri de
|
||||
@@ -345,16 +316,17 @@ the parser with a means to create the (visual) parse tree.
|
||||
|
||||
-----
|
||||
|
||||
Copyright (C) 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
|
||||
Copyright (C) 2001, 2002, 2003, 2004, 2006 Free Software Foundation,
|
||||
Inc.
|
||||
|
||||
This file is part of GNU Bison.
|
||||
This file is part of Bison, the GNU Compiler Compiler.
|
||||
|
||||
GNU Bison is free software; you can redistribute it and/or modify
|
||||
Bison is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2, or (at your option)
|
||||
any later version.
|
||||
|
||||
GNU Bison is distributed in the hope that it will be useful,
|
||||
Bison is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
# Bootstrap this package from CVS.
|
||||
|
||||
# Copyright (C) 2003, 2004, 2005 Free Software Foundation, Inc.
|
||||
# Copyright (C) 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
|
||||
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
@@ -23,8 +23,10 @@
|
||||
|
||||
package=bison
|
||||
|
||||
# Ensure file names are sorted consistently across platforms;
|
||||
# e.g., m4/ulonglong_gl.m4 should follow m4/ulonglong.m4.
|
||||
# Translation Project URL, for the registry of all projects.
|
||||
TP_URL='http://www.iro.umontreal.ca/translation/registry.cgi?domain='
|
||||
|
||||
# Ensure file names are sorted consistently across platforms.
|
||||
# Also, ensure diagnostics are in English, e.g., "wget --help" below.
|
||||
LC_ALL=C
|
||||
export LC_ALL
|
||||
@@ -51,11 +53,10 @@ done
|
||||
|
||||
echo "$0: Bootstrapping CVS $package..."
|
||||
|
||||
build_cvs_prefix() {
|
||||
CVS_PREFIX=:${1}:
|
||||
if [ "${2}" != - ]; then
|
||||
CVS_PREFIX=${CVS_PREFIX}${2}@
|
||||
fi
|
||||
cleanup_gnulib() {
|
||||
status=$?
|
||||
rm -fr gnulib
|
||||
exit $status
|
||||
}
|
||||
|
||||
# Get gnulib files.
|
||||
@@ -65,12 +66,9 @@ case ${GNULIB_SRCDIR--} in
|
||||
if [ ! -d gnulib ]; then
|
||||
echo "$0: getting gnulib files..."
|
||||
|
||||
trap exit 1 2 13 15
|
||||
trap 'rm -fr gnulib; exit 1' 0
|
||||
|
||||
case ${CVS_AUTH-anoncvs} in
|
||||
anoncvs)
|
||||
CVS_PREFIX='anoncvs@';;
|
||||
case ${CVS_AUTH-pserver} in
|
||||
pserver)
|
||||
CVS_PREFIX=':pserver:anonymous@';;
|
||||
ssh)
|
||||
CVS_PREFIX="$CVS_USER${CVS_USER+@}";;
|
||||
*)
|
||||
@@ -82,24 +80,27 @@ case ${GNULIB_SRCDIR--} in
|
||||
'') export CVS_RSH=ssh;;
|
||||
esac
|
||||
|
||||
cvs -z3 -q -d ${CVS_PREFIX}subversions.gnu.org:/cvsroot/gnulib co gnulib || exit
|
||||
trap cleanup_gnulib 1 2 13 15
|
||||
|
||||
trap - 0
|
||||
cvs -z3 -q -d ${CVS_PREFIX}cvs.savannah.gnu.org:/cvsroot/gnulib co gnulib ||
|
||||
cleanup_gnulib
|
||||
|
||||
trap - 1 2 13 15
|
||||
fi
|
||||
GNULIB_SRCDIR=gnulib
|
||||
esac
|
||||
|
||||
<$GNULIB_SRCDIR/gnulib-tool || exit
|
||||
gnulib_tool=$GNULIB_SRCDIR/gnulib-tool
|
||||
<$gnulib_tool || exit
|
||||
|
||||
gnulib_modules='
|
||||
alloca
|
||||
argmatch
|
||||
dirname
|
||||
error
|
||||
extensions
|
||||
fopen-safer
|
||||
getopt
|
||||
gettext
|
||||
hard-locale
|
||||
hash
|
||||
malloc
|
||||
mbswidth
|
||||
@@ -107,9 +108,14 @@ obstack
|
||||
quote
|
||||
quotearg
|
||||
stdbool
|
||||
stdio-safer
|
||||
stdint
|
||||
stpcpy
|
||||
strerror
|
||||
strtoul
|
||||
strverscmp
|
||||
unistd-safer
|
||||
unlocked-io
|
||||
verify
|
||||
xalloc
|
||||
xalloc-die
|
||||
xstrndup
|
||||
@@ -121,14 +127,15 @@ while [ "$gnulib_modules" != "$previous_gnulib_modules" ]; do
|
||||
gnulib_modules=`
|
||||
(echo "$gnulib_modules"
|
||||
for gnulib_module in $gnulib_modules; do
|
||||
$GNULIB_SRCDIR/gnulib-tool --extract-dependencies $gnulib_module
|
||||
$gnulib_tool --extract-dependencies $gnulib_module
|
||||
done) | sort -u
|
||||
`
|
||||
done
|
||||
|
||||
gnulib_files=`
|
||||
(for gnulib_module in $gnulib_modules; do
|
||||
$GNULIB_SRCDIR/gnulib-tool --extract-filelist $gnulib_module
|
||||
(echo m4/warning.m4
|
||||
for gnulib_module in $gnulib_modules; do
|
||||
$gnulib_tool --extract-filelist $gnulib_module
|
||||
done) | sort -u
|
||||
`
|
||||
|
||||
@@ -137,18 +144,6 @@ mkdir -p $gnulib_dirs || exit
|
||||
|
||||
for gnulib_file in $gnulib_files; do
|
||||
dest=$gnulib_file
|
||||
|
||||
case $gnulib_file in
|
||||
m4/onceonly_2_57.m4) dest=m4/onceonly.m4;;
|
||||
# These will be overwritten by autopoint, which still uses
|
||||
# old jm_.* macro names, so we have to keep both copies.
|
||||
# m4/gettext.m4 isn't mentioned here, since it's patched below.
|
||||
m4/glibc21.m4 | m4/inttypes_h.m4 | m4/lib-ld.m4 | \
|
||||
m4/lib-prefix.m4 | m4/po.m4 | m4/stdint_h.m4 | m4/uintmax_t.m4 | \
|
||||
m4/ulonglong.m4)
|
||||
dest=`expr $gnulib_file : '\(.*\).m4'`_gl.m4;;
|
||||
esac
|
||||
|
||||
rm -f $dest &&
|
||||
echo "$0: Copying file $GNULIB_SRCDIR/$gnulib_file" &&
|
||||
cp -p $GNULIB_SRCDIR/$gnulib_file $dest || exit
|
||||
@@ -156,15 +151,50 @@ done
|
||||
|
||||
# This suppresses a bogus diagnostic
|
||||
# "warning: macro `AM_LANGINFO_CODESET' not found in library".
|
||||
echo "$0: patching m4/gettext.m4 so that AM_INTL_SUBDIR is empty ..."
|
||||
echo "$0: patching m4/gettext.m4 to remove need for intl/* ..."
|
||||
sed '
|
||||
/^AC_DEFUN(\[AM_INTL_SUBDIR],/,/^]/c\
|
||||
AC_DEFUN([AM_INTL_SUBDIR], [])
|
||||
/^AC_DEFUN(\[gt_INTL_SUBDIR_CORE],/,/^]/c\
|
||||
AC_DEFUN([gt_INTL_SUBDIR_CORE], [])
|
||||
' m4/gettext.m4 >m4/gettext_gl.m4 || exit
|
||||
|
||||
|
||||
# Get translations.
|
||||
|
||||
get_translations() {
|
||||
subdir=$1
|
||||
domain=$2
|
||||
|
||||
echo "$0: getting translations into $subdir for $domain..."
|
||||
(cd $subdir && rm -f dummy `ls | sed -n '/\.gmo$/p; /\.po/p'`) &&
|
||||
|
||||
$WGET_COMMAND -O "$subdir/$domain.html" "$TP_URL$domain" &&
|
||||
|
||||
sed -n 's|.*"http://[^"]*/translation/teams/PO/\([^/"]*\)/'"$domain"'-\([^/"]*\)\.[^."]*\.po".*|\1.\2|p' <"$subdir/$domain.html" |
|
||||
sort -k 1,1 -k 2,2n -k2,2 -k3,3n -k3,3 -k4,4n -k4,4 -k5,5n -k5.5 |
|
||||
awk -F. '
|
||||
{ if (lang && $1 != lang) print lang, ver }
|
||||
{ lang = $1; ver = substr($0, index($0, ".") + 1) }
|
||||
END { if (lang) print lang, ver }
|
||||
' | awk -v domain="$domain" -v subdir="$subdir" '
|
||||
{
|
||||
lang = $1
|
||||
|
||||
# Work around bugs in Bison 2.3 translations uncovered by gettext 0.15.
|
||||
# This workaround can be removed once the translations are fixed.
|
||||
if (lang == "id" || lang == "tr") next
|
||||
|
||||
ver = $2
|
||||
urlfmt = ""
|
||||
printf "$WGET_COMMAND -O %s/%s.po 'http://www.iro.umontreal.ca/translation/teams/PO/%s/%s-%s.%s.po' &&\n", subdir, lang, lang, domain, ver, lang
|
||||
}
|
||||
END { print ":" }
|
||||
' | sh &&
|
||||
ls "$subdir"/*.po | sed 's|.*/||; s|\.po$||' >"$subdir/LINGUAS" &&
|
||||
rm "$subdir/$domain.html"
|
||||
}
|
||||
|
||||
case $SKIP_PO in
|
||||
'')
|
||||
case `wget --help` in
|
||||
@@ -176,51 +206,14 @@ case $SKIP_PO in
|
||||
no_cache='';;
|
||||
esac
|
||||
|
||||
echo "$0: getting translations into po (please ignore the robots.txt ERROR 404)..."
|
||||
(cd po &&
|
||||
rm -f dummy `ls | sed -n '/\.gmo$/p; /\.po/p'` &&
|
||||
wget -nv -nd -r -l 1 -A .po $no_cache \
|
||||
http://www.iro.umontreal.ca/translation/maint/$package/ &&
|
||||
ls *.po | sed 's/\.po$//' >LINGUAS
|
||||
) || exit
|
||||
WGET_COMMAND="wget -nv $no_cache"
|
||||
export WGET_COMMAND
|
||||
|
||||
get_translations po $package || exit
|
||||
|
||||
case $package in
|
||||
bison)
|
||||
echo "$0: getting translations into po (please ignore the robots.txt ERROR 404)..."
|
||||
(cd runtime-po &&
|
||||
rm -f dummy `ls | sed -n '/\.gmo$/p; /\.po$/p'` &&
|
||||
wget -nv -nd -r -l 1 -A .po $no_cache \
|
||||
http://www.iro.umontreal.ca/translation/maint/$package-runtime/ &&
|
||||
|
||||
# For translations that have not yet been upgraded to the new
|
||||
# runtime-po domain, prime the pump by extracting the relevant
|
||||
# strings from the obsolete translations.
|
||||
# This code can be removed once the bison-runtime domain
|
||||
# has been translated by each team.
|
||||
for po in ../po/*.po; do
|
||||
test -f "$po" || continue
|
||||
runpo=`basename $po`
|
||||
test -f $runpo || {
|
||||
msggrep -K \
|
||||
-e 'memory exhausted' \
|
||||
-e 'syntax error' \
|
||||
$po 2>/dev/null |
|
||||
sed '
|
||||
s/^#~ //
|
||||
/^msgid "syntax error; also memory exhausted"$/,/^$/d
|
||||
/^$/,${ /^#/d; }
|
||||
' >$runpo-
|
||||
if cmp -s $runpo- $runpo; then
|
||||
rm $runpo-
|
||||
else
|
||||
mv $runpo- $runpo
|
||||
fi
|
||||
test -s $runpo || rm -f $runpo
|
||||
} || exit
|
||||
done &&
|
||||
|
||||
ls *.po | sed 's/\.po$//' >LINGUAS
|
||||
) || exit
|
||||
get_translations runtime-po $package-runtime || exit
|
||||
esac;;
|
||||
esac
|
||||
|
||||
@@ -229,25 +222,24 @@ esac
|
||||
|
||||
(echo '# This file is generated automatically by "bootstrap".' &&
|
||||
echo 'AC_DEFUN([GNULIB_AUTOCONF_SNIPPET],[' &&
|
||||
$GNULIB_SRCDIR/gnulib-tool --extract-autoconf-snippet $gnulib_modules &&
|
||||
$gnulib_tool --extract-autoconf-snippet $gnulib_modules |
|
||||
sed 's/AM_GNU_GETTEXT(\[external]/&, [need-ngettext]/' &&
|
||||
echo '])'
|
||||
) >m4/gnulib.m4 || exit
|
||||
|
||||
(echo '# This file is generated automatically by "bootstrap".' &&
|
||||
$GNULIB_SRCDIR/gnulib-tool --extract-automake-snippet $gnulib_modules
|
||||
$gnulib_tool --extract-automake-snippet $gnulib_modules |
|
||||
sed 's/^[ ]*AM_CPPFLAGS[ ]*+=/# (commented out by bootstrap) &/'
|
||||
) >lib/gnulib.mk || exit
|
||||
|
||||
|
||||
# Reconfigure, getting other files.
|
||||
|
||||
echo "$0: autoreconf --verbose --install --force ..."
|
||||
autoreconf --verbose --install --force || exit
|
||||
|
||||
echo "$0: autopoint --force ..."
|
||||
autopoint --force || exit
|
||||
|
||||
# We don't need intl, so remove it.
|
||||
# Remove aclocal.m4 too, so that it gets rebuilt.
|
||||
intl_files_to_remove='
|
||||
aclocal.m4
|
||||
intl
|
||||
m4/codeset.m4
|
||||
m4/gettext.m4
|
||||
@@ -255,32 +247,60 @@ intl_files_to_remove='
|
||||
m4/glibc21.m4
|
||||
m4/intdiv0.m4
|
||||
m4/intmax.m4
|
||||
m4/inttypes_h.m4
|
||||
m4/inttypes.m4
|
||||
m4/inttypes-h.m4
|
||||
m4/inttypes-pri.m4
|
||||
m4/isc-posix.m4
|
||||
m4/lcmessage.m4
|
||||
m4/lib-ld.m4
|
||||
m4/lib-prefix.m4
|
||||
m4/lock.m4
|
||||
m4/longdouble.m4
|
||||
m4/longlong.m4
|
||||
m4/po.m4
|
||||
m4/printf-posix.m4
|
||||
m4/signed.m4
|
||||
m4/size_max.m4
|
||||
m4/stdint_h.m4
|
||||
m4/uintmax_t.m4
|
||||
m4/ulonglong.m4
|
||||
m4/wchar_t.m4
|
||||
m4/visibility.m4
|
||||
m4/wint_t.m4
|
||||
m4/xsize.m4
|
||||
'
|
||||
echo $0: rm -fr $intl_files_to_remove ...
|
||||
rm -fr $intl_files_to_remove || exit
|
||||
|
||||
|
||||
# Undo changes to gnulib files that autoreconf made.
|
||||
for gnulib_file in $gnulib_files; do
|
||||
test ! -f $gnulib_file || cmp -s $gnulib_file $GNULIB_SRCDIR/$gnulib_file || {
|
||||
rm -f $gnulib_file &&
|
||||
echo "$0: Copying file $GNULIB_SRCDIR/$gnulib_file again" &&
|
||||
cp -p $GNULIB_SRCDIR/$gnulib_file $gnulib_file || exit
|
||||
}
|
||||
done
|
||||
|
||||
# Make sure aclocal.m4 is not older than input files.
|
||||
sleep 1
|
||||
|
||||
for command in \
|
||||
'aclocal --force -I m4' \
|
||||
'autoconf --force' \
|
||||
'autoheader --force' \
|
||||
'automake --add-missing --copy --force-missing';
|
||||
do
|
||||
echo "$0: $command ..."
|
||||
$command || exit
|
||||
done
|
||||
|
||||
|
||||
# Put bug-reporting address into po/Makevars.
|
||||
echo "$0: sed '/^MSGID_BUGS_ADDRESS *=/s/=.*/= [email protected]/' po/Makevars.template >po/Makevars ..."
|
||||
sed '/^MSGID_BUGS_ADDRESS *=/s/=.*/= [email protected]/' po/Makevars.template >po/Makevars
|
||||
echo "$0: Creating po/Makevars from po/Makevars.template ..."
|
||||
sed '
|
||||
/^MSGID_BUGS_ADDRESS *=/s/=.*/= [email protected]/
|
||||
/^XGETTEXT_OPTIONS *=/{
|
||||
s/$/ \\/
|
||||
a\
|
||||
--flag=_:1:pass-c-format \\\
|
||||
--flag=N_:1:pass-c-format \\\
|
||||
--flag=error:3:c-format --flag=error_at_line:5:c-format \\\
|
||||
--flag=warn:1:c-format --flag=warn_at:2:c-format \\\
|
||||
--flag=complain:1:c-format --flag=complain_at:2:c-format \\\
|
||||
--flag=fatal:1:c-format --flag=fatal_at:2:c-format
|
||||
}
|
||||
' po/Makevars.template >po/Makevars
|
||||
|
||||
# Likewise for runtime-po/Makevars, except also change a few other parameters.
|
||||
sed '
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
*.t
|
||||
Makefile
|
||||
Makefile.in
|
||||
config.guess
|
||||
config.rpath
|
||||
config.sub
|
||||
depcomp
|
||||
install-sh
|
||||
mdate-sh
|
||||
missing
|
||||
mkinstalldirs
|
||||
texinfo.tex
|
||||
ylwrap
|
||||
@@ -1,3 +0,0 @@
|
||||
*.t
|
||||
Makefile
|
||||
Makefile.in
|
||||
+23
-26
@@ -1,6 +1,7 @@
|
||||
# Configure template for GNU Bison. -*-Autoconf-*-
|
||||
#
|
||||
# Copyright (C) 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
|
||||
# Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006 Free Software
|
||||
# Foundation, Inc.
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
@@ -17,13 +18,10 @@
|
||||
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
# 02110-1301 USA
|
||||
|
||||
# This file uses AC_CONFIG_MACRO_DIR, so we need Autoconf 2.58 or better.
|
||||
# But Autoconf 2.58 has a bug in the way that it generates tests: it
|
||||
# puts the wrong absolute path names in the tests. So we need at
|
||||
# least Autoconf 2.59.
|
||||
AC_PREREQ(2.59)
|
||||
# We use macros like AC_CHECK_HEADERS_ONCE, so we need Autoconf 2.60 or better.
|
||||
AC_PREREQ(2.60)
|
||||
|
||||
AC_INIT([GNU Bison], [2.1], [[email protected]])
|
||||
AC_INIT([GNU Bison], [2.3a], [[email protected]])
|
||||
AC_CONFIG_AUX_DIR([build-aux])
|
||||
AC_CONFIG_MACRO_DIR([m4])
|
||||
|
||||
@@ -44,26 +42,28 @@ AC_ARG_ENABLE(gcc-warnings,
|
||||
esac],
|
||||
[enableval=no])
|
||||
if test "${enableval}" = yes; then
|
||||
BISON_WARNING(-Werror)
|
||||
gl_WARNING_CFLAGS([-Werror])
|
||||
AC_SUBST([WERROR_CFLAGS], [$WARNING_CFLAGS])
|
||||
WARNING_CFLAGS=
|
||||
BISON_WARNING(-W)
|
||||
BISON_WARNING(-Wall)
|
||||
BISON_WARNING(-Wcast-align)
|
||||
BISON_WARNING(-Wcast-qual)
|
||||
BISON_WARNING(-Wformat)
|
||||
BISON_WARNING(-Wwrite-strings)
|
||||
gl_WARNING_CFLAGS([-Wextra -Wno-sign-compare])
|
||||
gl_WARNING_CFLAGS([-Wall])
|
||||
gl_WARNING_CFLAGS([-Wcast-align])
|
||||
gl_WARNING_CFLAGS([-Wcast-qual])
|
||||
gl_WARNING_CFLAGS([-Wformat])
|
||||
gl_WARNING_CFLAGS([-Wpointer-arith])
|
||||
gl_WARNING_CFLAGS([-Wwrite-strings])
|
||||
AC_SUBST([WARNING_CXXFLAGS], [$WARNING_CFLAGS])
|
||||
# The following warnings are not suitable for C++.
|
||||
BISON_WARNING(-Wbad-function-cast)
|
||||
BISON_WARNING(-Wmissing-declarations)
|
||||
BISON_WARNING(-Wmissing-prototypes)
|
||||
BISON_WARNING(-Wnested-externs)
|
||||
BISON_WARNING(-Wshadow)
|
||||
BISON_WARNING(-Wstrict-prototypes)
|
||||
gl_WARNING_CFLAGS([-Wbad-function-cast])
|
||||
gl_WARNING_CFLAGS([-Wmissing-declarations])
|
||||
gl_WARNING_CFLAGS([-Wmissing-prototypes])
|
||||
gl_WARNING_CFLAGS([-Wshadow])
|
||||
gl_WARNING_CFLAGS([-Wstrict-prototypes])
|
||||
AC_DEFINE([lint], 1, [Define to 1 if the compiler is checking for lint.])
|
||||
fi
|
||||
|
||||
BISON_TEST_FOR_WORKING_C_COMPILER
|
||||
|
||||
AC_ARG_ENABLE([yacc],
|
||||
[AC_HELP_STRING([--disable-yacc],
|
||||
[do not build a yacc command or an -ly library])],
|
||||
@@ -96,9 +96,6 @@ AM_STDBOOL_H
|
||||
# Checks for compiler characteristics.
|
||||
AC_C_INLINE
|
||||
|
||||
# Checks for types.
|
||||
AC_CHECK_TYPES([uintptr_t])
|
||||
|
||||
# Checks for library functions.
|
||||
AC_CHECK_FUNCS_ONCE([setlocale])
|
||||
AM_WITH_DMALLOC
|
||||
@@ -107,8 +104,8 @@ BISON_PREREQ_TIMEVAR
|
||||
|
||||
# gnulib and gettext.
|
||||
GNULIB_AUTOCONF_SNIPPET
|
||||
# We use po/Makevars, so we need at least gettext 0.12.
|
||||
AM_GNU_GETTEXT_VERSION([0.12])
|
||||
# We've never tested with gettext versions before 0.15, so play it safe.
|
||||
AM_GNU_GETTEXT_VERSION([0.15])
|
||||
BISON_I18N
|
||||
|
||||
# Internationalized parsers.
|
||||
@@ -133,7 +130,7 @@ O0CXXFLAGS=`echo $CXXFLAGS | sed 's/-O[[0-9]] *//'`
|
||||
AC_SUBST([O0CXXFLAGS])
|
||||
|
||||
AC_CONFIG_FILES([Makefile
|
||||
config/Makefile
|
||||
build-aux/Makefile
|
||||
po/Makefile.in
|
||||
data/Makefile
|
||||
examples/Makefile
|
||||
|
||||
+1
-1
@@ -17,7 +17,7 @@
|
||||
|
||||
dist_pkgdata_DATA = README \
|
||||
c.m4 yacc.c glr.c \
|
||||
c++.m4 lalr1.cc
|
||||
c++.m4 location.cc lalr1.cc glr.cc
|
||||
|
||||
m4sugardir = $(pkgdatadir)/m4sugar
|
||||
dist_m4sugar_DATA = m4sugar/m4sugar.m4
|
||||
|
||||
+12
-9
@@ -1,8 +1,8 @@
|
||||
m4_divert(-1)
|
||||
m4_divert(-1) -*- Autoconf -*-
|
||||
|
||||
# C++ skeleton for Bison
|
||||
|
||||
# Copyright (C) 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
|
||||
# Copyright (C) 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
|
||||
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
@@ -19,6 +19,8 @@ m4_divert(-1)
|
||||
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
# 02110-1301 USA
|
||||
|
||||
m4_include(b4_pkgdatadir/[c.m4])
|
||||
|
||||
## ---------------- ##
|
||||
## Default values. ##
|
||||
## ---------------- ##
|
||||
@@ -27,21 +29,22 @@ m4_divert(-1)
|
||||
m4_define_default([b4_parser_class_name], [parser])
|
||||
m4_define_default([b4_location_type], [location])
|
||||
m4_define_default([b4_filename_type], [std::string])
|
||||
|
||||
m4_define_default([b4_namespace], m4_defn([b4_prefix]))
|
||||
m4_define_default([b4_define_location_comparison],
|
||||
m4_if(b4_filename_type, [std::string], [1], [0]))
|
||||
|
||||
|
||||
# b4_token_enums(LIST-OF-PAIRS-TOKEN-NAME-TOKEN-NUMBER)
|
||||
# -----------------------------------------------------
|
||||
# Output the definition of the tokens (if there are) as enums.
|
||||
# Output the definition of the tokens as enums.
|
||||
m4_define([b4_token_enums],
|
||||
[m4_if([$@], [[]], [],
|
||||
[/* Tokens. */
|
||||
enum yytokentype {
|
||||
m4_map_sep([ b4_token_enum], [,
|
||||
],
|
||||
[$@])
|
||||
};
|
||||
])])
|
||||
])
|
||||
|
||||
|
||||
## ----------------- ##
|
||||
@@ -61,7 +64,7 @@ m4_define([b4_lhs_value],
|
||||
# Expansion of $<TYPE>NUM, where the current rule has RULE-LENGTH
|
||||
# symbols on RHS.
|
||||
m4_define([b4_rhs_value],
|
||||
[(yysemantic_stack_@{m4_eval([$1 - $2])@}m4_ifval([$3], [.$3]))])
|
||||
[(yysemantic_stack_@{($1) - ($2)@}m4_ifval([$3], [.$3]))])
|
||||
|
||||
# b4_lhs_location()
|
||||
# -----------------
|
||||
@@ -75,7 +78,7 @@ m4_define([b4_lhs_location],
|
||||
# Expansion of @NUM, where the current rule has RULE-LENGTH symbols
|
||||
# on RHS.
|
||||
m4_define([b4_rhs_location],
|
||||
[(yylocation_stack_@{m4_eval([$1 - $2])@})])
|
||||
[(yylocation_stack_@{($1) - ($2)@})])
|
||||
|
||||
|
||||
# b4_parse_param_decl
|
||||
@@ -98,7 +101,7 @@ m4_define([b4_parse_param_decl_1],
|
||||
# Extra initialisations of the constructor.
|
||||
m4_define([b4_parse_param_cons],
|
||||
[m4_ifset([b4_parse_param],
|
||||
[,
|
||||
[
|
||||
b4_cc_constructor_calls(b4_parse_param)])])
|
||||
m4_define([b4_cc_constructor_calls],
|
||||
[m4_map_sep([b4_cc_constructor_call], [,
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
m4_divert(-1) -*- Autoconf -*-
|
||||
|
||||
# C M4 Macros for Bison.
|
||||
# Copyright (C) 2002, 2004, 2005 Free Software Foundation, Inc.
|
||||
# Copyright (C) 2002, 2004, 2005, 2006 Free Software Foundation, Inc.
|
||||
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
@@ -28,8 +28,9 @@ m4_divert(-1) -*- Autoconf -*-
|
||||
m4_define([b4_copyright],
|
||||
[/* A Bison parser, made by GNU Bison b4_version. */
|
||||
|
||||
/* $1,
|
||||
Copyright (C) $2 Free Software Foundation, Inc.
|
||||
/* $1
|
||||
|
||||
m4_text_wrap([Copyright (C) $2 Free Software Foundation, Inc.], [ ])
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
@@ -44,7 +45,20 @@ m4_define([b4_copyright],
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
Boston, MA 02110-1301, USA. */])
|
||||
Boston, MA 02110-1301, USA. */
|
||||
|
||||
/* As a special exception, you may create a larger work that contains
|
||||
part or all of the Bison parser skeleton and distribute that work
|
||||
under terms of your choice, so long as that work isn't itself a
|
||||
parser generator using the skeleton or a modified version thereof
|
||||
as a parser skeleton. Alternatively, if you modify or redistribute
|
||||
the parser skeleton itself, you may (at your option) remove this
|
||||
special exception, which will cause the skeleton and the resulting
|
||||
Bison output files to be licensed under the GNU General Public
|
||||
License without this special exception.
|
||||
|
||||
This special exception was added by the Free Software Foundation in
|
||||
version 2.2 of Bison. */])
|
||||
|
||||
|
||||
# b4_identification
|
||||
@@ -60,27 +74,31 @@ m4_define([b4_identification],
|
||||
[#]define YYSKELETON_NAME b4_skeleton
|
||||
|
||||
/* Pure parsers. */
|
||||
[#]define YYPURE b4_pure
|
||||
[#]define YYPURE b4_pure_flag
|
||||
|
||||
/* Using locations. */
|
||||
[#]define YYLSP_NEEDED b4_locations_flag
|
||||
])
|
||||
|
||||
|
||||
|
||||
## ---------------- ##
|
||||
## Default values. ##
|
||||
## ---------------- ##
|
||||
|
||||
m4_define_default([b4_epilogue], [])
|
||||
|
||||
# If the %union is not named, its name is YYSTYPE.
|
||||
m4_define_default([b4_union_name], [YYSTYPE])
|
||||
|
||||
# The initial column and line.
|
||||
m4_define_default([b4_location_initial_column], [1])
|
||||
m4_define_default([b4_location_initial_line], [1])
|
||||
|
||||
|
||||
## ------------------------ ##
|
||||
## Pure/impure interfaces. ##
|
||||
## ------------------------ ##
|
||||
|
||||
|
||||
# b4_user_args
|
||||
# ------------
|
||||
m4_define([b4_user_args],
|
||||
@@ -96,12 +114,32 @@ m4_define([b4_parse_param],
|
||||
b4_parse_param))
|
||||
|
||||
|
||||
# b4_parse_param_for(DECL, FORMAL, BODY)
|
||||
# ---------------------------------------
|
||||
# Iterate over the user parameters, binding the declaration to DECL,
|
||||
# the formal name to FORMAL, and evaluating the BODY.
|
||||
m4_define([b4_parse_param_for],
|
||||
[m4_foreach([$1_$2], m4_defn([b4_parse_param]),
|
||||
[m4_pushdef([$1], m4_fst($1_$2))dnl
|
||||
m4_pushdef([$2], m4_shift($1_$2))dnl
|
||||
$3[]dnl
|
||||
m4_popdef([$2])dnl
|
||||
m4_popdef([$1])dnl
|
||||
])])
|
||||
|
||||
# b4_parse_param_use
|
||||
# ------------------
|
||||
# `YYUSE' all the parse-params.
|
||||
m4_define([b4_parse_param_use],
|
||||
[b4_parse_param_for([Decl], [Formal], [ YYUSE (Formal);
|
||||
])dnl
|
||||
])
|
||||
|
||||
|
||||
## ------------ ##
|
||||
## Data Types. ##
|
||||
## ------------ ##
|
||||
|
||||
|
||||
# b4_ints_in(INT1, INT2, LOW, HIGH)
|
||||
# ---------------------------------
|
||||
# Return 1 iff both INT1 and INT2 are in [LOW, HIGH], 0 otherwise.
|
||||
@@ -122,7 +160,7 @@ m4_define([b4_int_type],
|
||||
|
||||
m4_eval([0 <= $1]), [1], [unsigned int],
|
||||
|
||||
[int])])
|
||||
[int])])
|
||||
|
||||
|
||||
# b4_int_type_for(NAME)
|
||||
@@ -133,27 +171,58 @@ m4_define([b4_int_type_for],
|
||||
[b4_int_type($1_min, $1_max)])
|
||||
|
||||
|
||||
## ---------##
|
||||
## Values. ##
|
||||
## ---------##
|
||||
|
||||
# b4_null
|
||||
---------
|
||||
# Return a null pointer constant. NULL infringes on the user name
|
||||
# space in C, so use 0 rather than NULL.
|
||||
m4_define([b4_null], [0])
|
||||
|
||||
|
||||
## ------------------ ##
|
||||
## Decoding options. ##
|
||||
## ------------------ ##
|
||||
|
||||
|
||||
# b4_location_if(IF-TRUE, IF-FALSE)
|
||||
# ---------------------------------
|
||||
# Expand IF-TRUE, if locations are used, IF-FALSE otherwise.
|
||||
m4_define([b4_location_if],
|
||||
[m4_if(b4_locations_flag, [1],
|
||||
[$1],
|
||||
[$2])])
|
||||
# b4_flag_if(FLAG, IF-TRUE, IF-FALSE)
|
||||
# -----------------------------------
|
||||
# Run IF-TRUE if b4_FLAG_flag is 1, IF-FALSE if FLAG is 0, otherwise fail.
|
||||
m4_define([b4_flag_if],
|
||||
[m4_case(b4_$1_flag,
|
||||
[0], [$3],
|
||||
[1], [$2],
|
||||
[m4_fatal([invalid $1 value: ]$1)])])
|
||||
|
||||
|
||||
# b4_pure_if(IF-TRUE, IF-FALSE)
|
||||
# b4_define_flag_if(FLAG)
|
||||
# -----------------------
|
||||
# Define "b4_FLAG_if(IF-TRUE, IF-FALSE)" that depends on the
|
||||
# value of the Boolean FLAG.
|
||||
m4_define([b4_define_flag_if],
|
||||
[_b4_define_flag_if($[1], $[2], [$1])])
|
||||
|
||||
# _b4_define_flag_if($1, $2, FLAG)
|
||||
# --------------------------------
|
||||
# This macro works around the impossibility to define macros
|
||||
# inside macros, because issuing `[$1]' is not possible in M4 :(.
|
||||
# This sucks hard, GNU M4 should really provide M5 like $$1.
|
||||
m4_define([_b4_define_flag_if],
|
||||
[m4_if([$1$2], $[1]$[2], [],
|
||||
[m4_fatal([$0: Invalid arguments: $@])])dnl
|
||||
m4_define([b4_$3_if],
|
||||
[b4_flag_if([$3], [$1], [$2])])])
|
||||
|
||||
|
||||
# b4_FLAG_if(IF-TRUE, IF-FALSE)
|
||||
# -----------------------------
|
||||
# Expand IF-TRUE, if %pure-parser, IF-FALSE otherwise.
|
||||
m4_define([b4_pure_if],
|
||||
[m4_if(b4_pure, [1],
|
||||
[$1],
|
||||
[$2])])
|
||||
# Expand IF-TRUE, if FLAG is true, IF-FALSE otherwise.
|
||||
b4_define_flag_if([defines]) # Whether headers are requested.
|
||||
b4_define_flag_if([error_verbose]) # Whether error are verbose.
|
||||
b4_define_flag_if([locations]) # Whether locations are tracked.
|
||||
b4_define_flag_if([pure]) # Whether the interface is pure.
|
||||
b4_define_flag_if([yacc]) # Whether POSIX Yacc is emulated.
|
||||
|
||||
|
||||
|
||||
@@ -199,7 +268,7 @@ m4_define([b4_token_enums],
|
||||
enum yytokentype {
|
||||
m4_map_sep([ b4_token_enum], [,
|
||||
],
|
||||
[$@])
|
||||
[$@])
|
||||
};
|
||||
#endif
|
||||
])])
|
||||
@@ -207,9 +276,10 @@ m4_map_sep([ b4_token_enum], [,
|
||||
|
||||
# b4_token_enums_defines(LIST-OF-PAIRS-TOKEN-NAME-TOKEN-NUMBER)
|
||||
# -------------------------------------------------------------
|
||||
# Output the definition of the tokens (if there are) as enums and #defines.
|
||||
# Output the definition of the tokens (if there are any) as enums and, if POSIX
|
||||
# Yacc is enabled, as #defines.
|
||||
m4_define([b4_token_enums_defines],
|
||||
[b4_token_enums($@)b4_token_defines($@)
|
||||
[b4_token_enums($@)b4_yacc_if([b4_token_defines($@)], [])
|
||||
])
|
||||
|
||||
|
||||
@@ -219,11 +289,25 @@ m4_define([b4_token_enums_defines],
|
||||
## --------------------------------------------- ##
|
||||
|
||||
|
||||
# b4_modern_c
|
||||
# -----------
|
||||
# A predicate useful in #if to determine whether C is ancient or modern.
|
||||
#
|
||||
# If __STDC__ is defined, the compiler is modern. IBM xlc 7.0 when run
|
||||
# as 'cc' doesn't define __STDC__ (or __STDC_VERSION__) for pedantic
|
||||
# reasons, but it defines __C99__FUNC__ so check that as well.
|
||||
# Microsoft C normally doesn't define these macros, but it defines _MSC_VER.
|
||||
# Consider a C++ compiler to be modern if it defines __cplusplus.
|
||||
#
|
||||
m4_define([b4_c_modern],
|
||||
[[(defined __STDC__ || defined __C99__FUNC__ \
|
||||
|| defined __cplusplus || defined _MSC_VER)]])
|
||||
|
||||
# b4_c_function_def(NAME, RETURN-VALUE, [DECL1, NAME1], ...)
|
||||
# ----------------------------------------------------------
|
||||
# Declare the function NAME.
|
||||
m4_define([b4_c_function_def],
|
||||
[#if defined (__STDC__) || defined (__cplusplus)
|
||||
[#if b4_c_modern
|
||||
b4_c_ansi_function_def($@)
|
||||
#else
|
||||
$2
|
||||
@@ -247,9 +331,9 @@ $1 (b4_c_ansi_formals(m4_shiftn(2, $@)))[]dnl
|
||||
# Output the arguments ANSI-C definition.
|
||||
m4_define([b4_c_ansi_formals],
|
||||
[m4_case([$@],
|
||||
[], [void],
|
||||
[[]], [void],
|
||||
[m4_map_sep([b4_c_ansi_formal], [, ], [$@])])])
|
||||
[], [void],
|
||||
[[]], [void],
|
||||
[m4_map_sep([b4_c_ansi_formal], [, ], [$@])])])
|
||||
|
||||
m4_define([b4_c_ansi_formal],
|
||||
[$1])
|
||||
@@ -270,9 +354,9 @@ m4_define([b4_c_knr_formal_name],
|
||||
# Output the K&R argument declarations.
|
||||
m4_define([b4_c_knr_formal_decls],
|
||||
[m4_map_sep([b4_c_knr_formal_decl],
|
||||
[
|
||||
[
|
||||
],
|
||||
[$@])])
|
||||
[$@])])
|
||||
|
||||
m4_define([b4_c_knr_formal_decl],
|
||||
[ $1;])
|
||||
@@ -288,7 +372,7 @@ m4_define([b4_c_knr_formal_decl],
|
||||
# -----------------------------------------------------------
|
||||
# Declare the function NAME.
|
||||
m4_define([b4_c_function_decl],
|
||||
[#if defined (__STDC__) || defined (__cplusplus)
|
||||
[#if defined __STDC__ || defined __cplusplus
|
||||
b4_c_ansi_function_decl($@)
|
||||
#else
|
||||
$2 $1 ();
|
||||
@@ -333,14 +417,63 @@ m4_define([b4_c_arg],
|
||||
## Synclines. ##
|
||||
## ----------- ##
|
||||
|
||||
# b4_basename(NAME)
|
||||
# -----------------
|
||||
# Similar to POSIX basename; the differences don't matter here.
|
||||
# Beware that NAME is not evaluated.
|
||||
m4_define([b4_basename],
|
||||
[m4_bpatsubst([$1], [^.*/\([^/]+\)/*$], [\1])])
|
||||
|
||||
|
||||
# b4_syncline(LINE, FILE)
|
||||
# -----------------------
|
||||
m4_define([b4_syncline],
|
||||
[m4_if(b4_synclines_flag, 1,
|
||||
[[#]line $1 $2])])
|
||||
[b4_flag_if([synclines],
|
||||
[/* Line __line__ of b4_basename(m4_quote(__file__)). */
|
||||
[#]line $1 $2])])
|
||||
|
||||
|
||||
# b4_user_code(USER-CODE)
|
||||
# -----------------------
|
||||
# Emit code from the user, ending it with synclines.
|
||||
m4_define([b4_user_code],
|
||||
[$1
|
||||
b4_syncline([@oline@], [@ofile@])])
|
||||
|
||||
|
||||
# b4_define_user_code(MACRO)
|
||||
# --------------------------
|
||||
# From b4_MACRO, build b4_user_MACRO that includes the synclines.
|
||||
m4_define([b4_define_user_code],
|
||||
[m4_define([b4_user_$1],
|
||||
[b4_user_code([b4_$1])])])
|
||||
|
||||
|
||||
# b4_user_actions
|
||||
# b4_user_initial_action
|
||||
# b4_user_post_prologue
|
||||
# b4_user_start_header
|
||||
# b4_user_stype
|
||||
# ----------------------
|
||||
# Macros that issue user code, ending with synclines.
|
||||
b4_define_user_code([actions])
|
||||
b4_define_user_code([initial_action])
|
||||
b4_define_user_code([post_prologue])
|
||||
b4_define_user_code([start_header])
|
||||
b4_define_user_code([stype])
|
||||
|
||||
|
||||
## -------------- ##
|
||||
## User actions. ##
|
||||
## -------------- ##
|
||||
|
||||
# b4_case(LABEL, STATEMENTS)
|
||||
# --------------------------
|
||||
m4_define([b4_case],
|
||||
[ case $1:
|
||||
$2
|
||||
break;])
|
||||
|
||||
# b4_symbol_actions(FILENAME, LINENO,
|
||||
# SYMBOL-TAG, SYMBOL-NUM,
|
||||
# SYMBOL-ACTION, SYMBOL-TYPENAME)
|
||||
@@ -351,9 +484,9 @@ m4_define([b4_symbol_actions],
|
||||
m4_pushdef([b4_at_dollar], [(*yylocationp)])dnl
|
||||
case $4: /* $3 */
|
||||
b4_syncline([$2], [$1])
|
||||
$5;
|
||||
$5;
|
||||
b4_syncline([@oline@], [@ofile@])
|
||||
break;
|
||||
break;
|
||||
m4_popdef([b4_at_dollar])dnl
|
||||
m4_popdef([b4_dollar_dollar])dnl
|
||||
])
|
||||
@@ -369,17 +502,20 @@ m4_define_default([b4_yydestruct_generate],
|
||||
| Release the memory associated to this symbol. |
|
||||
`-----------------------------------------------*/
|
||||
|
||||
/*ARGSUSED*/
|
||||
]$1([yydestruct],
|
||||
[static void],
|
||||
[[const char *yymsg], [yymsg]],
|
||||
[[int yytype], [yytype]],
|
||||
[[YYSTYPE *yyvaluep], [yyvaluep]]b4_location_if([,
|
||||
[[YYLTYPE *yylocationp], [yylocationp]]]))[
|
||||
[[YYSTYPE *yyvaluep], [yyvaluep]][]dnl
|
||||
b4_locations_if( [, [[YYLTYPE *yylocationp], [yylocationp]]])[]dnl
|
||||
m4_ifset([b4_parse_param], [, b4_parse_param]))[
|
||||
{
|
||||
/* Pacify ``unused variable'' warnings. */
|
||||
(void) yyvaluep;
|
||||
]b4_location_if([ (void) yylocationp;
|
||||
])[
|
||||
YYUSE (yyvaluep);
|
||||
]b4_locations_if([ YYUSE (yylocationp);
|
||||
])dnl
|
||||
b4_parse_param_use[]dnl
|
||||
[
|
||||
if (!yymsg)
|
||||
yymsg = "Deleting";
|
||||
YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);
|
||||
@@ -388,53 +524,74 @@ m4_define_default([b4_yydestruct_generate],
|
||||
{
|
||||
]m4_map([b4_symbol_actions], m4_defn([b4_symbol_destructors]))[
|
||||
default:
|
||||
break;
|
||||
break;
|
||||
}
|
||||
}]dnl
|
||||
])
|
||||
|
||||
|
||||
# b4_yysymprint_generate(FUNCTION-DECLARATOR)
|
||||
# -------------------------------------------
|
||||
# Generate the "yysymprint" function, which declaration is issued using
|
||||
# b4_yy_symbol_print_generate(FUNCTION-DECLARATOR)
|
||||
# ------------------------------------------------
|
||||
# Generate the "yy_symbol_print" function, which declaration is issued using
|
||||
# FUNCTION-DECLARATOR, which may be "b4_c_ansi_function_def" for ISO C
|
||||
# or "b4_c_function_def" for K&R.
|
||||
m4_define_default([b4_yysymprint_generate],
|
||||
[[/*--------------------------------.
|
||||
m4_define_default([b4_yy_symbol_print_generate],
|
||||
[[
|
||||
/*--------------------------------.
|
||||
| Print this symbol on YYOUTPUT. |
|
||||
`--------------------------------*/
|
||||
|
||||
]$1([yysymprint],
|
||||
/*ARGSUSED*/
|
||||
]$1([yy_symbol_value_print],
|
||||
[static void],
|
||||
[[FILE *yyoutput], [yyoutput]],
|
||||
[[int yytype], [yytype]],
|
||||
[[YYSTYPE *yyvaluep], [yyvaluep]]b4_location_if([,
|
||||
[[YYLTYPE *yylocationp], [yylocationp]]]))
|
||||
[[FILE *yyoutput], [yyoutput]],
|
||||
[[int yytype], [yytype]],
|
||||
[[YYSTYPE const * const yyvaluep], [yyvaluep]][]dnl
|
||||
b4_locations_if([, [[YYLTYPE const * const yylocationp], [yylocationp]]])[]dnl
|
||||
m4_ifset([b4_parse_param], [, b4_parse_param]))[
|
||||
{
|
||||
/* Pacify ``unused variable'' warnings. */
|
||||
(void) yyvaluep;
|
||||
b4_location_if([ (void) yylocationp;
|
||||
if (!yyvaluep)
|
||||
return;
|
||||
]b4_locations_if([ YYUSE (yylocationp);
|
||||
])dnl
|
||||
[
|
||||
if (yytype < YYNTOKENS)
|
||||
YYFPRINTF (yyoutput, "token %s (", yytname[yytype]);
|
||||
else
|
||||
YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]);
|
||||
|
||||
]b4_location_if([ YY_LOCATION_PRINT (yyoutput, *yylocationp);
|
||||
YYFPRINTF (yyoutput, ": ");
|
||||
])dnl
|
||||
[
|
||||
# ifdef YYPRINT
|
||||
b4_parse_param_use[]dnl
|
||||
[# ifdef YYPRINT
|
||||
if (yytype < YYNTOKENS)
|
||||
YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
|
||||
# else
|
||||
YYUSE (yyoutput);
|
||||
# endif
|
||||
switch (yytype)
|
||||
{
|
||||
]m4_map([b4_symbol_actions], m4_defn([b4_symbol_printers]))dnl
|
||||
[ default:
|
||||
break;
|
||||
break;
|
||||
}
|
||||
YYFPRINTF (yyoutput, ")");
|
||||
}
|
||||
]])
|
||||
|
||||
|
||||
/*--------------------------------.
|
||||
| Print this symbol on YYOUTPUT. |
|
||||
`--------------------------------*/
|
||||
|
||||
]$1([yy_symbol_print],
|
||||
[static void],
|
||||
[[FILE *yyoutput], [yyoutput]],
|
||||
[[int yytype], [yytype]],
|
||||
[[YYSTYPE const * const yyvaluep], [yyvaluep]][]dnl
|
||||
b4_locations_if([, [[YYLTYPE const * const yylocationp], [yylocationp]]])[]dnl
|
||||
m4_ifset([b4_parse_param], [, b4_parse_param]))[
|
||||
{
|
||||
if (yytype < YYNTOKENS)
|
||||
YYFPRINTF (yyoutput, "token %s (", yytname[yytype]);
|
||||
else
|
||||
YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]);
|
||||
|
||||
]b4_locations_if([ YY_LOCATION_PRINT (yyoutput, *yylocationp);
|
||||
YYFPRINTF (yyoutput, ": ");
|
||||
])dnl
|
||||
[ yy_symbol_value_print (yyoutput, yytype, yyvaluep]dnl
|
||||
b4_locations_if([, yylocationp])[]b4_user_args[);
|
||||
YYFPRINTF (yyoutput, ")");
|
||||
}]dnl
|
||||
])
|
||||
|
||||
+891
-633
File diff suppressed because it is too large
Load Diff
+380
@@ -0,0 +1,380 @@
|
||||
m4_divert(-1) -*- C -*-
|
||||
|
||||
# C++ GLR skeleton for Bison
|
||||
# Copyright (C) 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
|
||||
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2 of the License, or
|
||||
# (at your option) any later version.
|
||||
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
# 02110-1301 USA
|
||||
|
||||
|
||||
# This skeleton produces a C++ class that encapsulates a C glr parser.
|
||||
# This is in order to reduce the maintenance burden. The glr.c
|
||||
# skeleton is clean and pure enough so that there are no real
|
||||
# problems. The C++ interface is the same as that of lalr1.cc. In
|
||||
# fact, glr.c can replace yacc.c without the user noticing any
|
||||
# difference, and similarly for glr.cc replacing lalr1.cc.
|
||||
#
|
||||
# The passing of parse-params
|
||||
#
|
||||
# The additional arguments are stored as members of the parser
|
||||
# object, yyparser. The C routines need to carry yyparser
|
||||
# throughout the C parser; that easy: just let yyparser become an
|
||||
# additional parse-param. But because the C++ skeleton needs to
|
||||
# know the "real" original parse-param, we save them
|
||||
# (b4_parse_param_orig). Note that b4_parse_param is overquoted
|
||||
# (and c.m4 strips one level of quotes). This is a PITA, and
|
||||
# explains why there are so many levels of quotes.
|
||||
#
|
||||
# The locations
|
||||
#
|
||||
# We use location.cc just like lalr1.cc, but because glr.c stores
|
||||
# the locations in a (C++) union, the position and location classes
|
||||
# must not have a constructor. Therefore, contrary to lalr1.cc, we
|
||||
# must not define "b4_location_constructors". As a consequence the
|
||||
# user must initialize the first positions (in particular the
|
||||
# filename member).
|
||||
|
||||
# We require a pure interface using locations.
|
||||
m4_define([b4_locations_flag], [1])
|
||||
m4_define([b4_pure_flag], [1])
|
||||
|
||||
# The header is mandatory.
|
||||
b4_defines_if([],
|
||||
[m4_fatal(b4_skeleton[: using %defines is mandatory])])
|
||||
|
||||
m4_include(b4_pkgdatadir/[c++.m4])
|
||||
m4_include(b4_pkgdatadir/[location.cc])
|
||||
|
||||
|
||||
# Save the parse parameters.
|
||||
m4_define([b4_parse_param_orig], m4_defn([b4_parse_param]))
|
||||
|
||||
|
||||
# b4_yy_symbol_print_generate
|
||||
# ---------------------------
|
||||
# Bypass the default implementation to generate the "yy_symbol_print"
|
||||
# and "yy_symbol_value_print" functions.
|
||||
m4_define([b4_yy_symbol_print_generate],
|
||||
[[
|
||||
/*--------------------.
|
||||
| Print this symbol. |
|
||||
`--------------------*/
|
||||
|
||||
]b4_c_ansi_function_def([yy_symbol_print],
|
||||
[static void],
|
||||
[[FILE *], []],
|
||||
[[int yytype], [yytype]],
|
||||
[[const b4_namespace::b4_parser_class_name::semantic_type *yyvaluep],
|
||||
[yyvaluep]],
|
||||
[[const b4_namespace::b4_parser_class_name::location_type *yylocationp],
|
||||
[yylocationp]],
|
||||
b4_parse_param)[
|
||||
{
|
||||
]b4_parse_param_use[]dnl
|
||||
[ yyparser.yy_symbol_print_ (yytype, yyvaluep]b4_locations_if([, yylocationp])[);
|
||||
}
|
||||
]])
|
||||
|
||||
|
||||
# Declare yyerror.
|
||||
m4_append([b4_post_prologue],
|
||||
[b4_syncline([@oline@], [@ofile@])
|
||||
|
||||
b4_c_ansi_function_decl([yyerror],
|
||||
[static void],
|
||||
[[b4_namespace::b4_parser_class_name::location_type *yylocationp], [yylocationp]],
|
||||
b4_parse_param,
|
||||
[[const char* msg], [msg]])])
|
||||
|
||||
|
||||
# Define yyerror.
|
||||
m4_append([b4_epilogue],
|
||||
[b4_syncline([@oline@], [@ofile@])[
|
||||
/*------------------.
|
||||
| Report an error. |
|
||||
`------------------*/
|
||||
|
||||
]b4_c_ansi_function_def([yyerror],
|
||||
[static void],
|
||||
[[b4_namespace::b4_parser_class_name::location_type *yylocationp], [yylocationp]],
|
||||
b4_parse_param,
|
||||
[[const char* msg], [msg]])[
|
||||
{
|
||||
]b4_parse_param_use[]dnl
|
||||
[ yyparser.error (*yylocationp, msg);
|
||||
}
|
||||
|
||||
|
||||
namespace ]b4_namespace[
|
||||
{
|
||||
]dnl In this section, the parse param are the original parse_params.
|
||||
m4_pushdef([b4_parse_param], m4_defn([b4_parse_param_orig]))dnl
|
||||
[ /// Build a parser object.
|
||||
]b4_parser_class_name::b4_parser_class_name[ (]b4_parse_param_decl[)]m4_ifset([b4_parse_param], [
|
||||
:])[
|
||||
#if YYDEBUG
|
||||
]m4_ifset([b4_parse_param], [ ], [ :])[yydebug_ (false),
|
||||
yycdebug_ (&std::cerr)]m4_ifset([b4_parse_param], [,])[
|
||||
#endif]b4_parse_param_cons[
|
||||
{
|
||||
}
|
||||
|
||||
]b4_parser_class_name::~b4_parser_class_name[ ()
|
||||
{
|
||||
}
|
||||
|
||||
int
|
||||
]b4_parser_class_name[::parse ()
|
||||
{
|
||||
return ::yyparse (*this]b4_user_args[);
|
||||
}
|
||||
|
||||
#if YYDEBUG
|
||||
/*--------------------.
|
||||
| Print this symbol. |
|
||||
`--------------------*/
|
||||
|
||||
inline void
|
||||
]b4_parser_class_name[::yy_symbol_value_print_ (int yytype,
|
||||
const semantic_type* yyvaluep, const location_type* yylocationp)
|
||||
{
|
||||
/* Pacify ``unused variable'' warnings. */
|
||||
YYUSE (yyvaluep);
|
||||
YYUSE (yylocationp);
|
||||
switch (yytype)
|
||||
{
|
||||
]m4_map([b4_symbol_actions], m4_defn([b4_symbol_printers]))dnl
|
||||
[ default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
]b4_parser_class_name[::yy_symbol_print_ (int yytype,
|
||||
const semantic_type* yyvaluep, const location_type* yylocationp)
|
||||
{
|
||||
*yycdebug_ << (yytype < YYNTOKENS ? "token" : "nterm")
|
||||
<< ' ' << yytname[yytype] << " ("
|
||||
<< *yylocationp << ": ";
|
||||
yy_symbol_value_print_ (yytype, yyvaluep, yylocationp);
|
||||
*yycdebug_ << ')';
|
||||
}
|
||||
|
||||
std::ostream&
|
||||
]b4_parser_class_name[::debug_stream () const
|
||||
{
|
||||
return *yycdebug_;
|
||||
}
|
||||
|
||||
void
|
||||
]b4_parser_class_name[::set_debug_stream (std::ostream& o)
|
||||
{
|
||||
yycdebug_ = &o;
|
||||
}
|
||||
|
||||
|
||||
]b4_parser_class_name[::debug_level_type
|
||||
]b4_parser_class_name[::debug_level () const
|
||||
{
|
||||
return yydebug_;
|
||||
}
|
||||
|
||||
void
|
||||
]b4_parser_class_name[::set_debug_level (debug_level_type l)
|
||||
{
|
||||
yydebug_ = l;
|
||||
}
|
||||
|
||||
#endif
|
||||
]m4_popdef([b4_parse_param])dnl
|
||||
[} // namespace ]b4_namespace[
|
||||
|
||||
]])
|
||||
|
||||
|
||||
# Let glr.c believe that the user arguments include the parser itself.
|
||||
m4_ifset([b4_parse_param],
|
||||
[m4_pushdef([b4_parse_param],
|
||||
m4_dquote([[[b4_namespace::b4_parser_class_name& yyparser], [[yyparser]]],]
|
||||
m4_defn([b4_parse_param])))],
|
||||
[m4_pushdef([b4_parse_param],
|
||||
[[[[b4_namespace::b4_parser_class_name& yyparser], [[yyparser]]]]])
|
||||
])
|
||||
m4_include(b4_pkgdatadir/[glr.c])
|
||||
m4_popdef([b4_parse_param])
|
||||
|
||||
@output @output_header_name@
|
||||
b4_copyright([Skeleton interface for Bison GLR parsers in C++],
|
||||
[2002, 2003, 2004, 2005, 2006])[
|
||||
|
||||
/* C++ GLR parser skeleton written by Akim Demaille. */
|
||||
|
||||
#ifndef PARSER_HEADER_H
|
||||
# define PARSER_HEADER_H
|
||||
|
||||
]m4_ifdef([b4_start_header],
|
||||
[[/* Copy the %start-header blocks. */
|
||||
]b4_user_start_header])[
|
||||
|
||||
#include <string>
|
||||
#include <iostream>
|
||||
|
||||
/* Using locations. */
|
||||
#define YYLSP_NEEDED ]b4_locations_flag[
|
||||
|
||||
namespace ]b4_namespace[
|
||||
{
|
||||
class position;
|
||||
class location;
|
||||
}
|
||||
|
||||
#include "location.hh"
|
||||
|
||||
/* Enabling traces. */
|
||||
#ifndef YYDEBUG
|
||||
# define YYDEBUG ]b4_debug_flag[
|
||||
#endif
|
||||
|
||||
/* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N].
|
||||
If N is 0, then set CURRENT to the empty location which ends
|
||||
the previous symbol: RHS[0] (always defined). */
|
||||
|
||||
#ifndef YYLLOC_DEFAULT
|
||||
# define YYLLOC_DEFAULT(Current, Rhs, N) \
|
||||
do \
|
||||
if (N) \
|
||||
{ \
|
||||
(Current).begin = YYRHSLOC (Rhs, 1).begin; \
|
||||
(Current).end = YYRHSLOC (Rhs, N).end; \
|
||||
} \
|
||||
else \
|
||||
{ \
|
||||
(Current).begin = (Current).end = YYRHSLOC (Rhs, 0).end; \
|
||||
} \
|
||||
while (/*CONSTCOND*/ 0)
|
||||
#endif
|
||||
|
||||
namespace ]b4_namespace[
|
||||
{
|
||||
/// A Bison parser.
|
||||
class ]b4_parser_class_name[
|
||||
{
|
||||
public:
|
||||
/// Symbol semantic values.
|
||||
#ifndef YYSTYPE
|
||||
]m4_ifdef([b4_stype],
|
||||
[ union semantic_type
|
||||
b4_user_stype
|
||||
;],
|
||||
[m4_if(b4_tag_seen_flag, 0,
|
||||
[[ typedef int semantic_type;]],
|
||||
[[ typedef YYSTYPE semantic_type;]])])[
|
||||
#else
|
||||
typedef YYSTYPE semantic_type;
|
||||
#endif
|
||||
/// Symbol locations.
|
||||
typedef ]b4_location_type[ location_type;
|
||||
/// Tokens.
|
||||
struct token
|
||||
{
|
||||
]b4_token_enums(b4_tokens)[
|
||||
};
|
||||
/// Token type.
|
||||
typedef token::yytokentype token_type;
|
||||
|
||||
/// Build a parser object.
|
||||
]b4_parser_class_name[ (]b4_parse_param_decl[);
|
||||
virtual ~]b4_parser_class_name[ ();
|
||||
|
||||
/// Parse.
|
||||
/// \returns 0 iff parsing succeeded.
|
||||
virtual int parse ();
|
||||
|
||||
/// The current debugging stream.
|
||||
std::ostream& debug_stream () const;
|
||||
/// Set the current debugging stream.
|
||||
void set_debug_stream (std::ostream &);
|
||||
|
||||
/// Type for debugging levels.
|
||||
typedef int debug_level_type;
|
||||
/// The current debugging level.
|
||||
debug_level_type debug_level () const;
|
||||
/// Set the current debugging level.
|
||||
void set_debug_level (debug_level_type l);
|
||||
|
||||
private:
|
||||
|
||||
public:
|
||||
/// Report a syntax error.
|
||||
/// \param loc where the syntax error is found.
|
||||
/// \param msg a description of the syntax error.
|
||||
virtual void error (const location_type& loc, const std::string& msg);
|
||||
private:
|
||||
|
||||
#if YYDEBUG
|
||||
public:
|
||||
/// \brief Report a symbol value on the debug stream.
|
||||
/// \param yytype The token type.
|
||||
/// \param yyvaluep Its semantic value.
|
||||
/// \param yylocationp Its location.
|
||||
virtual void yy_symbol_value_print_ (int yytype,
|
||||
const semantic_type* yyvaluep,
|
||||
const location_type* yylocationp);
|
||||
/// \brief Report a symbol on the debug stream.
|
||||
/// \param yytype The token type.
|
||||
/// \param yyvaluep Its semantic value.
|
||||
/// \param yylocationp Its location.
|
||||
virtual void yy_symbol_print_ (int yytype,
|
||||
const semantic_type* yyvaluep,
|
||||
const location_type* yylocationp);
|
||||
private:
|
||||
/* Debugging. */
|
||||
int yydebug_;
|
||||
std::ostream* yycdebug_;
|
||||
#endif
|
||||
|
||||
|
||||
/// \brief Reclaim the memory associated to a symbol.
|
||||
/// \param yymsg Why this token is reclaimed.
|
||||
/// \param yytype The symbol type.
|
||||
/// \param yyvaluep Its semantic value.
|
||||
/// \param yylocationp Its location.
|
||||
inline void yydestruct_ (const char* yymsg,
|
||||
int yytype,
|
||||
semantic_type* yyvaluep,
|
||||
location_type* yylocationp);
|
||||
|
||||
]b4_parse_param_vars[
|
||||
};
|
||||
|
||||
]dnl Redirections for glr.c.
|
||||
m4_ifset([b4_global_tokens_and_yystype],
|
||||
[b4_token_defines(b4_tokens)])
|
||||
[
|
||||
#ifndef YYSTYPE
|
||||
# define YYSTYPE ]b4_namespace[::]b4_parser_class_name[::semantic_type
|
||||
#endif
|
||||
#ifndef YYLTYPE
|
||||
# define YYLTYPE ]b4_namespace[::]b4_parser_class_name[::location_type
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
]m4_ifdef([b4_end_header],
|
||||
[[/* Copy the %end-header blocks. */
|
||||
]b4_end_header])[]dnl
|
||||
|
||||
[#endif /* ! defined PARSER_HEADER_H */]
|
||||
+675
-884
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,280 @@
|
||||
m4_divert(-1)
|
||||
|
||||
# C++ skeleton for Bison
|
||||
|
||||
# Copyright (C) 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
|
||||
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2 of the License, or
|
||||
# (at your option) any later version.
|
||||
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
# 02110-1301 USA
|
||||
|
||||
# We do want M4 expansion after # for CPP macros.
|
||||
m4_changecom()
|
||||
m4_divert(0)dnl
|
||||
@output b4_dir_prefix[]position.hh
|
||||
b4_copyright([Positions for Bison parsers in C++],
|
||||
[2002, 2003, 2004, 2005, 2006])[
|
||||
|
||||
/**
|
||||
** \file position.hh
|
||||
** Define the ]b4_namespace[::position class.
|
||||
*/
|
||||
|
||||
#ifndef BISON_POSITION_HH
|
||||
# define BISON_POSITION_HH
|
||||
|
||||
# include <iostream>
|
||||
# include <string>
|
||||
# include <algorithm>
|
||||
|
||||
namespace ]b4_namespace[
|
||||
{
|
||||
/// Abstract a position.
|
||||
class position
|
||||
{
|
||||
public:
|
||||
]m4_ifdef([b4_location_constructors], [
|
||||
/// Construct a position.
|
||||
position ()
|
||||
: filename (0), line (]b4_location_initial_line[), column (]b4_location_initial_column[)
|
||||
{
|
||||
}
|
||||
|
||||
])[
|
||||
/// Initialization.
|
||||
inline void initialize (]b4_filename_type[* fn)
|
||||
{
|
||||
filename = fn;
|
||||
line = ]b4_location_initial_line[;
|
||||
column = ]b4_location_initial_column[;
|
||||
}
|
||||
|
||||
/** \name Line and Column related manipulators
|
||||
** \{ */
|
||||
public:
|
||||
/// (line related) Advance to the COUNT next lines.
|
||||
inline void lines (int count = 1)
|
||||
{
|
||||
column = ]b4_location_initial_column[;
|
||||
line += count;
|
||||
}
|
||||
|
||||
/// (column related) Advance to the COUNT next columns.
|
||||
inline void columns (int count = 1)
|
||||
{
|
||||
column = std::max (]b4_location_initial_column[u, column + count);
|
||||
}
|
||||
/** \} */
|
||||
|
||||
public:
|
||||
/// File name to which this position refers.
|
||||
]b4_filename_type[* filename;
|
||||
/// Current line number.
|
||||
unsigned int line;
|
||||
/// Current column number.
|
||||
unsigned int column;
|
||||
};
|
||||
|
||||
/// Add and assign a position.
|
||||
inline const position&
|
||||
operator+= (position& res, const int width)
|
||||
{
|
||||
res.columns (width);
|
||||
return res;
|
||||
}
|
||||
|
||||
/// Add two position objects.
|
||||
inline const position
|
||||
operator+ (const position& begin, const int width)
|
||||
{
|
||||
position res = begin;
|
||||
return res += width;
|
||||
}
|
||||
|
||||
/// Add and assign a position.
|
||||
inline const position&
|
||||
operator-= (position& res, const int width)
|
||||
{
|
||||
return res += -width;
|
||||
}
|
||||
|
||||
/// Add two position objects.
|
||||
inline const position
|
||||
operator- (const position& begin, const int width)
|
||||
{
|
||||
return begin + -width;
|
||||
}
|
||||
]m4_if(b4_define_location_comparison, [1], [[
|
||||
/// Compare two position objects.
|
||||
inline bool
|
||||
operator== (const position& pos1, const position& pos2)
|
||||
{
|
||||
return
|
||||
(pos1.filename == pos2.filename
|
||||
|| pos1.filename && pos2.filename && *pos1.filename == *pos2.filename)
|
||||
&& pos1.line == pos2.line && pos1.column == pos2.column;
|
||||
}
|
||||
|
||||
/// Compare two position objects.
|
||||
inline bool
|
||||
operator!= (const position& pos1, const position& pos2)
|
||||
{
|
||||
return !(pos1 == pos2);
|
||||
}
|
||||
]])[
|
||||
/** \brief Intercept output stream redirection.
|
||||
** \param ostr the destination output stream
|
||||
** \param pos a reference to the position to redirect
|
||||
*/
|
||||
inline std::ostream&
|
||||
operator<< (std::ostream& ostr, const position& pos)
|
||||
{
|
||||
if (pos.filename)
|
||||
ostr << *pos.filename << ':';
|
||||
return ostr << pos.line << '.' << pos.column;
|
||||
}
|
||||
|
||||
}
|
||||
#endif // not BISON_POSITION_HH]
|
||||
@output b4_dir_prefix[]location.hh
|
||||
b4_copyright([Locations for Bison parsers in C++],
|
||||
[2002, 2003, 2004, 2005, 2006])[
|
||||
|
||||
/**
|
||||
** \file location.hh
|
||||
** Define the ]b4_namespace[::location class.
|
||||
*/
|
||||
|
||||
#ifndef BISON_LOCATION_HH
|
||||
# define BISON_LOCATION_HH
|
||||
|
||||
# include <iostream>
|
||||
# include <string>
|
||||
# include "position.hh"
|
||||
|
||||
namespace ]b4_namespace[
|
||||
{
|
||||
|
||||
/// Abstract a location.
|
||||
class location
|
||||
{
|
||||
public:
|
||||
]m4_ifdef([b4_location_constructors], [
|
||||
/// Construct a location.
|
||||
location ()
|
||||
: begin (), end ()
|
||||
{
|
||||
}
|
||||
|
||||
])[
|
||||
/// Initialization.
|
||||
inline void initialize (]b4_filename_type[* fn)
|
||||
{
|
||||
begin.initialize (fn);
|
||||
end = begin;
|
||||
}
|
||||
|
||||
/** \name Line and Column related manipulators
|
||||
** \{ */
|
||||
public:
|
||||
/// Reset initial location to final location.
|
||||
inline void step ()
|
||||
{
|
||||
begin = end;
|
||||
}
|
||||
|
||||
/// Extend the current location to the COUNT next columns.
|
||||
inline void columns (unsigned int count = 1)
|
||||
{
|
||||
end += count;
|
||||
}
|
||||
|
||||
/// Extend the current location to the COUNT next lines.
|
||||
inline void lines (unsigned int count = 1)
|
||||
{
|
||||
end.lines (count);
|
||||
}
|
||||
/** \} */
|
||||
|
||||
|
||||
public:
|
||||
/// Beginning of the located region.
|
||||
position begin;
|
||||
/// End of the located region.
|
||||
position end;
|
||||
};
|
||||
|
||||
/// Join two location objects to create a location.
|
||||
inline const location operator+ (const location& begin, const location& end)
|
||||
{
|
||||
location res = begin;
|
||||
res.end = end.end;
|
||||
return res;
|
||||
}
|
||||
|
||||
/// Add two location objects.
|
||||
inline const location operator+ (const location& begin, unsigned int width)
|
||||
{
|
||||
location res = begin;
|
||||
res.columns (width);
|
||||
return res;
|
||||
}
|
||||
|
||||
/// Add and assign a location.
|
||||
inline location& operator+= (location& res, unsigned int width)
|
||||
{
|
||||
res.columns (width);
|
||||
return res;
|
||||
}
|
||||
]m4_if(b4_define_location_comparison, [1], [[
|
||||
/// Compare two location objects.
|
||||
inline bool
|
||||
operator== (const location& loc1, const location& loc2)
|
||||
{
|
||||
return loc1.begin == loc2.begin && loc1.end == loc2.end;
|
||||
}
|
||||
|
||||
/// Compare two location objects.
|
||||
inline bool
|
||||
operator!= (const location& loc1, const location& loc2)
|
||||
{
|
||||
return !(loc1 == loc2);
|
||||
}
|
||||
]])[
|
||||
/** \brief Intercept output stream redirection.
|
||||
** \param ostr the destination output stream
|
||||
** \param loc a reference to the location to redirect
|
||||
**
|
||||
** Avoid duplicate information.
|
||||
*/
|
||||
inline std::ostream& operator<< (std::ostream& ostr, const location& loc)
|
||||
{
|
||||
position last = loc.end - 1;
|
||||
ostr << loc.begin;
|
||||
if (last.filename
|
||||
&& (!loc.begin.filename
|
||||
|| *loc.begin.filename != *last.filename))
|
||||
ostr << '-' << last;
|
||||
else if (loc.begin.line != last.line)
|
||||
ostr << '-' << last.line << '.' << last.column;
|
||||
else if (loc.begin.column != last.column)
|
||||
ostr << '-' << last.column;
|
||||
return ostr;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
#endif // not BISON_LOCATION_HH]
|
||||
m4_divert(-1)
|
||||
m4_changecom([#])
|
||||
+12
-3
@@ -398,8 +398,11 @@ m4_define([m4_cdr],
|
||||
# of LIST (which can be lists themselves, for multiple arguments MACROs).
|
||||
m4_define([m4_fst], [$1])
|
||||
m4_define([m4_map],
|
||||
[m4_if([$2], [[]], [],
|
||||
[_m4_map([$1], [$2])])])
|
||||
m4_define([_m4_map],
|
||||
[m4_ifval([$2],
|
||||
[$1(m4_fst($2))[]m4_map([$1], m4_cdr($2))])])
|
||||
[$1(m4_fst($2))[]_m4_map([$1], m4_cdr($2))])])
|
||||
|
||||
|
||||
# m4_map_sep(MACRO, SEPARATOR, LIST)
|
||||
@@ -408,8 +411,8 @@ m4_define([m4_map],
|
||||
# are the elements of LIST (which can be lists themselves, for multiple
|
||||
# arguments MACROs).
|
||||
m4_define([m4_map_sep],
|
||||
[m4_ifval([$3],
|
||||
[$1(m4_fst($3))[]m4_map([$2[]$1], m4_cdr($3))])])
|
||||
[m4_if([$3], [[]], [],
|
||||
[$1(m4_fst($3))[]_m4_map([$2[]$1], m4_cdr($3))])])
|
||||
|
||||
|
||||
## ---------------------------------------- ##
|
||||
@@ -1512,6 +1515,12 @@ m4_define([m4_append],
|
||||
[m4_define([$1],
|
||||
m4_ifdef([$1], [m4_defn([$1])$3])[$2])])
|
||||
|
||||
# m4_prepend(MACRO-NAME, STRING, [SEPARATOR])
|
||||
# -------------------------------------------
|
||||
# Same, but prepend.
|
||||
m4_define([m4_prepend],
|
||||
[m4_define([$1],
|
||||
[$2]m4_ifdef([$1], [$3[]m4_defn([$1])]))])
|
||||
|
||||
# m4_append_uniq(MACRO-NAME, STRING, [SEPARATOR])
|
||||
# -----------------------------------------------
|
||||
|
||||
+479
-391
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,38 @@
|
||||
# DJGPP Maintainer's Makefile -*-Makefile-*-
|
||||
# Requires GNU sed
|
||||
|
||||
## Copyright (C) 2005, 2006 Free Software Foundation, Inc.
|
||||
|
||||
## This program is free software; you can redistribute it and/or modify
|
||||
## it under the terms of the GNU General Public License as published by
|
||||
## the Free Software Foundation; either version 2, or (at your option)
|
||||
## any later version.
|
||||
|
||||
## This program is distributed in the hope that it will be useful,
|
||||
## but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
## GNU General Public License for more details.
|
||||
|
||||
## You should have received a copy of the GNU General Public License
|
||||
## along with this program; if not, write to the Free Software Foundation,
|
||||
## Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
|
||||
top_srcdir = ..
|
||||
srcdir = .
|
||||
|
||||
SHELL = /bin/sh
|
||||
|
||||
all: README
|
||||
|
||||
README: README.in $(top_srcdir)/configure
|
||||
PACKAGE=`grep "^[ ]*PACKAGE=" $(top_srcdir)/configure | sed -e 's/^[ ]*PACKAGE=//' -e s/[\"\']//g`; \
|
||||
VERSION=`grep "^[ ]*VERSION=" $(top_srcdir)/configure | sed -e 's/^[ ]*VERSION=//' -e s/[\"\']//g`; \
|
||||
package_version=`echo "$${VERSION}" | sed 's/\.//g'`; \
|
||||
tree_version=`echo "$${VERSION}" | sed 's/\.//2g'`; \
|
||||
sed \
|
||||
-e "s/@V@/$${PACKAGE}-$${VERSION}/g" \
|
||||
-e "s/@VERSION@/$${VERSION}/g" \
|
||||
-e "s/@PACKAGE_VERSION@/$$package_version/g" \
|
||||
-e "s/@TREE_VERSION@/$$tree_version/g" \
|
||||
$(srcdir)/README.in > t-$@
|
||||
mv t-$@ $@
|
||||
+194
@@ -0,0 +1,194 @@
|
||||
This is a port of GNU Bison @VERSION@ to MSDOS/DJGPP.
|
||||
|
||||
Copyright (C) 2005, 2006 Free Software Foundation, Inc.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2, or (at your option)
|
||||
any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software Foundation,
|
||||
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
|
||||
|
||||
1.: DJGPP specific changes.
|
||||
=======================
|
||||
|
||||
The DJGPP port of Bison offers LFN and SFN support depending on which
|
||||
OS it is running. If LFN support is available or not is determinated at
|
||||
run time. If LFN support is available (DOS session under Win9X, Win2K,
|
||||
WinXP, etc.) the standard posix file name extensions will be used.
|
||||
These are: y.tab.c, y.tab.c++, y.tab.h, y.output, etc. If only SFN
|
||||
support is available (plain DOS), then the standard MSDOS short file
|
||||
names will be used. These are: y_tab.c, y_tab.h, y.out, etc.
|
||||
It should be noticed that this bison version needs the m4 program as
|
||||
back end to generate the parser file (y.tab.c etc.) from the skeleton
|
||||
files. This implies that m4 must always be installed to get bison
|
||||
working. m4 will use a couple of m4 scripts that will be installed in
|
||||
/dev/env/DJDIR/share/bison and shall not be removed.
|
||||
It should also be noticed that the skeleton files bison.simple and
|
||||
bison.hairy are no longer supported. This applies also to the environ-
|
||||
ment variables BISON_HAIRY and BISON_SIMPLE. Those variables are *no*
|
||||
longer honored at all.
|
||||
The kind of skeleton file bison.hairy is no longer supported at all.
|
||||
The skeleton file bison.simple is now called yacc.c and is an m4 script.
|
||||
The other two skeleton files supported by this bison version are glr.c
|
||||
and lalr1.cc. The first one is a generalized LR C parser based on
|
||||
Bison's LALR(1) tables and the second one is a experimental C++ parser
|
||||
class.
|
||||
As has been told before, bison uses m4 to generate the parser file.
|
||||
This is done by forking and using pipes for the IPC. MSDOS does not
|
||||
support this functionality so this has been reproduced in the usual
|
||||
way by redirecting stdin and stdout of bison and m4 to temporary files
|
||||
and processing these files in sequence. All the changes to the sources
|
||||
are documented in the djgpp/diffs file.
|
||||
|
||||
Please **read** the docs.
|
||||
|
||||
|
||||
2.: Installing the binary package.
|
||||
==============================
|
||||
|
||||
2.1.: Copy the binary distribution into the top DJGPP installation directory,
|
||||
just unzip it preserving the directory structure running *ONE* of the
|
||||
following commands:
|
||||
unzip32 bsn@[email protected] or
|
||||
djtarx bsn@[email protected] or
|
||||
pkunzip -d bsn@[email protected]
|
||||
|
||||
|
||||
|
||||
3.: Building the binaries from sources.
|
||||
===================================
|
||||
|
||||
3.1.: Create a temporary directory and copy the source package into the
|
||||
directory. If you download the source distribution from one of the
|
||||
DJGPP sites, just unzip it preserving the directory structure
|
||||
running *ONE* of the following commands:
|
||||
unzip32 bsn@[email protected] or
|
||||
djtarx bsn@[email protected] or
|
||||
pkunzip -d bsn@[email protected]
|
||||
and proceed to the paragraph 3.3, below.
|
||||
|
||||
3.2.: Source distributions downloaded from one of the GNU FTP sites need
|
||||
some more work to unpack, if LFN support is not available. If LFN is
|
||||
available then you can extract the source files from the archive with
|
||||
any unzip program and proceed to the paragraph 3.3, below. Any file
|
||||
name issue will be handled by the the DJGPP configuration files.
|
||||
To unpack the source distribution on SFN systems, first, you MUST use
|
||||
the `djunpack' batch file to unzip the package. That is because some
|
||||
file names in the official distributions need to be changed to avoid
|
||||
problems on the various platforms supported by DJGPP.
|
||||
`djunpack' invokes the `djtar' program (that is part of the basic DJGPP
|
||||
development kit) to rename these files on the fly given a file with
|
||||
name mappings; the distribution includes a file `djgpp/fnchange.lst'
|
||||
with the necessary mappings. So you need first to retrieve that batch
|
||||
file, and then invoke it to unpack the distribution. Here's how:
|
||||
|
||||
djtar -x -p -o bison-@VERSION@/djgpp/djunpack.bat bison-@[email protected] > djunpack.bat
|
||||
djunpack bison-@[email protected]
|
||||
|
||||
(The name of the distribution archive and the leading directory of the
|
||||
path to `djunpack.bat' in the distribution will be different for
|
||||
versions of Bison other than @VERSION@.)
|
||||
|
||||
If the argument to `djunpack.bat' include leading directories, it MUST
|
||||
be given with the DOS-style backslashes; Unix-style forward slashes
|
||||
will NOT work.
|
||||
|
||||
If the distribution comes as a .tar.bz2 archive, and your version of
|
||||
`djtar' doesn't support bzip2 decompression, you need to unpack it as
|
||||
follows:
|
||||
|
||||
bnzip2 bison-@[email protected]
|
||||
djtar -x -p -o bison-@VERSION@/djgpp/djunpack.bat bison-@[email protected] > djunpack.bat
|
||||
djunpack bison-@[email protected]
|
||||
|
||||
3.3.: To build the binaries you will need the following binary packages:
|
||||
djdev203.zip (or a later but NOT a prior version)
|
||||
bsh204b.zip (or a later but NOT a prior version)
|
||||
gcc410b.zip, gpp410b.zip, bnu2161b.zip, mak3791b.zip,
|
||||
fil40b.zip, shl20jb.zip, txt20b.zip,
|
||||
txi48b.zip, grep24b.zip, sed415b.zip,
|
||||
m4-144b.zip.
|
||||
|
||||
If you want to run the check you will need also:
|
||||
dif287b.zip
|
||||
|
||||
All this packages can be found in the v2gnu directory of any
|
||||
ftp.delorie.com mirror.
|
||||
You will need bsh204b.zip or later and *NOT* a prior version or
|
||||
the build will fail. The same applies to djdev203.zip. Please note
|
||||
that Bison requires m4-144b.zip or later to work properly. All the
|
||||
other packages are the ones I have used to build the binaries
|
||||
from this source. Previuos versions of this packages may do the
|
||||
job as well but I have not tested this.
|
||||
|
||||
3.4.: If for some reason you want to reconfigure the package cd into the top
|
||||
srcdir (bison-@TREE_VERSION@) and run the following commands:
|
||||
del djgpp\config.cache
|
||||
make clean
|
||||
djgpp\config
|
||||
|
||||
Please note that you *MUST* delete the config.cache file in the djgpp
|
||||
subdir or you will not really reconfigure the sources because the
|
||||
configuration informations will be read from the cache file instead
|
||||
of being newly computed.
|
||||
To build the programs in a directory other than where the sources are,
|
||||
you must add the parameter that specifies the source directory,
|
||||
e.g:
|
||||
x:\src\gnu\bison-@TREE_VERSION@\djgpp\config x:/src/gnu/bison-@TREE_VERSION@
|
||||
|
||||
Lets assume you want to build the binaries in a directory placed on a
|
||||
different drive (z:\build in this case) from where the sources are,
|
||||
then you will run the following commands:
|
||||
z:
|
||||
md \build
|
||||
cd \build
|
||||
x:\src\gnu\bison-@TREE_VERSION@\djgpp\config x:/src/gnu/bison-@TREE_VERSION@
|
||||
|
||||
The order of the options and the srcdir option does not matter. You
|
||||
*MUST* use forward slashes to specify the source directory.
|
||||
|
||||
The batch file will set same environment variables, make MSDOS specific
|
||||
modifications to the Makefile.in's and supply all other needed options
|
||||
to the configure script.
|
||||
|
||||
3.5.: To compile the package run from the top srcdir the command:
|
||||
make
|
||||
|
||||
3.6.: Now you can run the tests if you like. From the top srcdir run the
|
||||
command:
|
||||
make check
|
||||
|
||||
No test should fail but the tests #131 (Doxygen Public Documentation)
|
||||
and #132 (Doxygen Private Documentation) will be skipped. Please note
|
||||
that the testsuite only works with LFN available. On plain DOS, most
|
||||
of the tests will fail due to invalid DOS names.
|
||||
|
||||
3.7.: To install the binaries, header, library, catalogs, and info docs
|
||||
run the following command from the top srcdir:
|
||||
make install
|
||||
|
||||
This will install the products into your DJGPP installation tree given
|
||||
by the default prefix "/dev/env/DJDIR". If you prefer to install them
|
||||
into some other directory you will have to set prefix to the appropiate
|
||||
value:
|
||||
make install prefix=z:/some/other/place
|
||||
|
||||
|
||||
|
||||
Send GNU bison specific bug reports to <[email protected]>.
|
||||
Send suggestions and bug reports concerning the DJGPP port to
|
||||
comp.os.msdos.djgpp or <[email protected]>.
|
||||
|
||||
|
||||
Enjoy.
|
||||
|
||||
Guerrero, Juan Manuel <[email protected]>
|
||||
@@ -0,0 +1,480 @@
|
||||
@echo off
|
||||
Rem Configure Bison for DJGPP.
|
||||
|
||||
Rem WARNING WARNING WARNING: This file needs to have DOS CRLF end-of-line
|
||||
Rem format, or else stock DOS/Windows shells will refuse to run it.
|
||||
|
||||
Rem Copyright (C) 2005, 2006 Free Software Foundation, Inc.
|
||||
|
||||
Rem This program is free software; you can redistribute it and/or modify
|
||||
Rem it under the terms of the GNU General Public License as published by
|
||||
Rem the Free Software Foundation; either version 2, or (at your option)
|
||||
Rem any later version.
|
||||
|
||||
Rem This program is distributed in the hope that it will be useful,
|
||||
Rem but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
Rem MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
Rem GNU General Public License for more details.
|
||||
|
||||
Rem You should have received a copy of the GNU General Public License
|
||||
Rem along with this program; if not, write to the Free Software Foundation,
|
||||
Rem Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
|
||||
echo Configuring Bison for DJGPP v2.x...
|
||||
|
||||
Rem The SmallEnv tests protect against fixed and too small size
|
||||
Rem of the environment in stock DOS shell.
|
||||
|
||||
Rem Find out if NLS is wanted or not,
|
||||
Rem if dependency-tracking is wanted or not,
|
||||
Rem if caching is wanted or not
|
||||
Rem and where the sources are.
|
||||
Rem We always default to NLS support,
|
||||
Rem no dependency tracking
|
||||
Rem and to in place configuration.
|
||||
set ARGS=
|
||||
set NLS=enabled
|
||||
if not "%NLS%" == "enabled" goto SmallEnv
|
||||
set CACHING=enabled
|
||||
if not "%CACHING%" == "enabled" goto SmallEnv
|
||||
set DEPENDENCY_TRACKING=disabled
|
||||
if not "%DEPENDENCY_TRACKING%" == "disabled" goto SmallEnv
|
||||
set LIBICONV_PREFIX=disabled
|
||||
if not "%LIBICONV_PREFIX%" == "disabled" goto SmallEnv
|
||||
set LIBINTL_PREFIX=disabled
|
||||
if not "%LIBINTL_PREFIX%" == "disabled" goto SmallEnv
|
||||
set HTML=enabled
|
||||
if not "%HTML%" == "enabled" goto SmallEnv
|
||||
set XSRC=.
|
||||
if not "%XSRC%" == "." goto SmallEnv
|
||||
|
||||
Rem Loop over all arguments.
|
||||
Rem Special arguments are: NLS, XSRC, CACHE, STATIC_LIBS, LIBICONV_PREFIX, LIBINTL_PREFIX and DEPS.
|
||||
Rem All other arguments are stored into ARGS.
|
||||
:ArgLoop
|
||||
if "%1" == "nls" goto NextArgument
|
||||
if "%1" == "NLS" goto NextArgument
|
||||
if "%1" == "no-nls" goto NoNLS
|
||||
if "%1" == "no-NLS" goto NoNLS
|
||||
if "%1" == "NO-NLS" goto NoNLS
|
||||
goto CachingOption
|
||||
:NoNLS
|
||||
if "%1" == "no-nls" set NLS=disabled
|
||||
if "%1" == "no-NLS" set NLS=disabled
|
||||
if "%1" == "NO-NLS" set NLS=disabled
|
||||
if not "%NLS%" == "disabled" goto SmallEnv
|
||||
goto NextArgument
|
||||
:CachingOption
|
||||
if "%1" == "cache" goto NextArgument
|
||||
if "%1" == "CACHE" goto NextArgument
|
||||
if "%1" == "no-cache" goto NoCaching
|
||||
if "%1" == "no-CACHE" goto NoCaching
|
||||
if "%1" == "NO-CACHE" goto NoCaching
|
||||
goto DependencyOption
|
||||
:NoCaching
|
||||
if "%1" == "no-cache" set CACHING=disabled
|
||||
if "%1" == "no-CACHE" set CACHING=disabled
|
||||
if "%1" == "NO-CACHE" set CACHING=disabled
|
||||
if not "%CACHING%" == "disabled" goto SmallEnv
|
||||
goto NextArgument
|
||||
:DependencyOption
|
||||
if "%1" == "no-dep" goto NextArgument
|
||||
if "%1" == "no-DEP" goto NextArgument
|
||||
if "%1" == "NO-DEP" goto NextArgument
|
||||
if "%1" == "dep" goto DependecyTraking
|
||||
if "%1" == "DEP" goto DependecyTraking
|
||||
goto LibiconvPrefixOption
|
||||
:DependecyTraking
|
||||
if "%1" == "dep" set DEPENDENCY_TRACKING=enabled
|
||||
if "%1" == "DEP" set DEPENDENCY_TRACKING=enabled
|
||||
if not "%DEPENDENCY_TRACKING%" == "enabled" goto SmallEnv
|
||||
goto NextArgument
|
||||
:LibiconvPrefixOption
|
||||
if "%1" == "no-libiconvprefix" goto NextArgument
|
||||
if "%1" == "no-LIBICONVPREFIX" goto NextArgument
|
||||
if "%1" == "NO-LIBICONVPREFIX" goto NextArgument
|
||||
if "%1" == "libiconvprefix" goto WithLibiconvPrefix
|
||||
if "%1" == "LIBICONVPREFIX" goto WithLibiconvPrefix
|
||||
goto LibintlPrefixOption
|
||||
:WithLibiconvPrefix
|
||||
if "%1" == "libiconvprefix" set LIBICONV_PREFIX=enabled
|
||||
if "%1" == "LIBICONVPREFIX" set LIBICONV_PREFIX=enabled
|
||||
if not "%LIBICONV_PREFIX%" == "enabled" goto SmallEnv
|
||||
goto NextArgument
|
||||
:LibintlPrefixOption
|
||||
if "%1" == "no-libiconvprefix" goto NextArgument
|
||||
if "%1" == "no-LIBICONVPREFIX" goto NextArgument
|
||||
if "%1" == "NO-LIBICONVPREFIX" goto NextArgument
|
||||
if "%1" == "libintlprefix" goto _WithLibintlPrefix
|
||||
if "%1" == "LIBINTLPREFIX" goto _WithLibintlPrefix
|
||||
goto HTMLOption
|
||||
:_WithLibintlPrefix
|
||||
if "%1" == "libintlprefix" set LIBINTL_PREFIX=enabled
|
||||
if "%1" == "LIBINTLPREFIX" set LIBINTL_PREFIX=enabled
|
||||
if not "%LIBINTL_PREFIX%" == "enabled" goto SmallEnv
|
||||
:HTMLOption
|
||||
if "%1" == "withhtml" goto NextArgument
|
||||
if "%1" == "withHTML" goto NextArgument
|
||||
if "%1" == "WITHHTML" goto NextArgument
|
||||
if "%1" == "withouthtml" goto _WithoutHTML
|
||||
if "%1" == "withoutHTML" goto _WithoutHTML
|
||||
if "%1" == "WITHOUTHTML" goto _WithoutHTML
|
||||
goto SrcDirOption
|
||||
:_WithoutHTML
|
||||
if "%1" == "withouthtml" set HTML=disabled
|
||||
if "%1" == "withoutHTML" set HTML=disabled
|
||||
if "%1" == "WITHOUTHTML" set HTML=disabled
|
||||
if not "%HTML%" == "disabled" goto SmallEnv
|
||||
goto NextArgument
|
||||
:SrcDirOption
|
||||
echo %1 | grep -q "/"
|
||||
if errorlevel 1 goto CollectArgument
|
||||
set XSRC=%1
|
||||
if not "%XSRC%" == "%1" goto SmallEnv
|
||||
goto NextArgument
|
||||
:CollectArgument
|
||||
set _ARGS=%ARGS% %1
|
||||
if not "%_ARGS%" == "%ARGS% %1" if not "%_ARGS%" == "%ARGS%%1" goto SmallEnv
|
||||
echo %_ARGS% | grep -q "[^ ]"
|
||||
if not errorlevel 0 set ARGS=%_ARGS%
|
||||
set _ARGS=
|
||||
:NextArgument
|
||||
shift
|
||||
if not "%1" == "" goto ArgLoop
|
||||
|
||||
Rem Create an arguments file for the configure script.
|
||||
echo --srcdir=%XSRC% > arguments
|
||||
if "%CACHING%" == "enabled" echo --cache-file=%XSRC%/djgpp/config.cache >> arguments
|
||||
if "%DEPENDENCY_TRACKING%" == "enabled" echo --enable-dependency-tracking >> arguments
|
||||
if "%DEPENDENCY_TRACKING%" == "disabled" echo --disable-dependency-tracking >> arguments
|
||||
if "%LIBICONV_PREFIX%" == "enabled" echo --with-libiconv-prefix >> arguments
|
||||
if "%LIBICONV_PREFIX%" == "disabled" echo --without-libiconv-prefix >> arguments
|
||||
if "%LIBINTL_PREFIX%" == "enabled" echo --with-libintl-prefix >> arguments
|
||||
if "%LIBINTL_PREFIX%" == "disabled" echo --without-libintl-prefix >> arguments
|
||||
if "%HTML%" == "enabled" echo --enable-html >> arguments
|
||||
if "%HTML%" == "disabled" echo --disable-html >> arguments
|
||||
if not "%ARGS%" == "" echo %ARGS% >> arguments
|
||||
set ARGS=
|
||||
set CACHING=
|
||||
set DEPENDENCY_TRACKING=
|
||||
set LIBICONV_PREFIX=
|
||||
set LIBINTL_PREFIX=
|
||||
set HTML=
|
||||
|
||||
if "%XSRC%" == "." goto InPlace
|
||||
|
||||
:NotInPlace
|
||||
redir -e /dev/null update %XSRC%/configure.orig ./configure
|
||||
test -f ./configure
|
||||
if errorlevel 1 update %XSRC%/configure ./configure
|
||||
|
||||
:InPlace
|
||||
Rem Update configuration files
|
||||
echo Updating configuration scripts...
|
||||
test -f ./configure.orig
|
||||
if errorlevel 1 update configure configure.orig
|
||||
sed -f %XSRC%/djgpp/config.sed configure.orig > configure
|
||||
if errorlevel 1 goto SedError
|
||||
|
||||
Rem Make sure they have a config.site file
|
||||
set CONFIG_SITE=%XSRC%/djgpp/config.site
|
||||
if not "%CONFIG_SITE%" == "%XSRC%/djgpp/config.site" goto SmallEnv
|
||||
|
||||
Rem Make sure crucial file names are not munged by unpacking
|
||||
test -f %XSRC%/po/Makefile.in.in
|
||||
if not errorlevel 1 mv -f %XSRC%/po/Makefile.in.in %XSRC%/po/Makefile.in-in
|
||||
test -f %XSRC%/po/Makefile.in-in
|
||||
if errorlevel 1 mv -f %XSRC%/po/Makefile.in %XSRC%/po/Makefile.in-in
|
||||
test -f %XSRC%/po/Makefile.in-in
|
||||
if errorlevel 1 mv -f %XSRC%/po/Makefile.inin %XSRC%/po/Makefile.in-in
|
||||
test -f %XSRC%/po/Makefile.in-in
|
||||
if errorlevel 1 mv -f %XSRC%/po/Makefile.in_in %XSRC%/po/Makefile.in-in
|
||||
test -f %XSRC%/po/Makefile.in-in
|
||||
if errorlevel 1 mv -f %XSRC%/po/Makefile_in.in %XSRC%/po/Makefile.in-in
|
||||
test -f %XSRC%/runtime-po/Makefile.in.in
|
||||
if not errorlevel 1 mv -f %XSRC%/runtime-po/Makefile.in.in %XSRC%/runtime-po/Makefile.in-in
|
||||
test -f %XSRC%/runtime-po/Makefile.in-in
|
||||
if errorlevel 1 mv -f %XSRC%/runtime-po/Makefile.in %XSRC%/runtime-po/Makefile.in-in
|
||||
test -f %XSRC%/runtime-po/Makefile.in-in
|
||||
if errorlevel 1 mv -f %XSRC%/runtime-po/Makefile.inin %XSRC%/runtime-po/Makefile.in-in
|
||||
test -f %XSRC%/runtime-po/Makefile.in-in
|
||||
if errorlevel 1 mv -f %XSRC%/runtime-po/Makefile.in_in %XSRC%/runtime-po/Makefile.in-in
|
||||
test -f %XSRC%/runtime-po/Makefile.in-in
|
||||
if errorlevel 1 mv -f %XSRC%/runtime-po/Makefile_in.in %XSRC%/runtime-po/Makefile.in-in
|
||||
test -f %XSRC%/data/c++.m4
|
||||
if not errorlevel 1 mv -f %XSRC%/data/c++.m4 %XSRC%/data/cxx.m4
|
||||
test -f %XSRC%/data/cxx.m4
|
||||
if errorlevel 1 mv -f %XSRC%/data/cpp.m4 %XSRC%/data/cxx.m4
|
||||
:scan_gram_c_Test
|
||||
test -f %XSRC%/src/c-scan-gram.c
|
||||
if not errorlevel 1 goto scan_skel_c_Test
|
||||
test -f %XSRC%/src/scan-gram-c.c
|
||||
if not errorlevel 1 mv -f %XSRC%/src/scan-gram-c.c %XSRC%/src/c-scan-gram.c
|
||||
:scan_skel_c_Test
|
||||
test -f %XSRC%/src/c-scan-skel.c
|
||||
if not errorlevel 1 goto FixFiles
|
||||
test -f %XSRC%/src/scan-skel-c.c
|
||||
if not errorlevel 1 mv -f %XSRC%/src/scan-skel-c.c %XSRC%/src/c-scan-skel.c
|
||||
|
||||
:FixFiles
|
||||
Rem Fix data/lalr1.cc and data/location.cc to reflect the renaming of c++.m4
|
||||
sed "s/c++\.m4/cxx.m4/" %XSRC%/data/lalr1.cc > lalr1.cc
|
||||
if errorlevel 1 goto lalr1_ccFileError
|
||||
mv ./lalr1.cc %XSRC%/data/lalr1.cc
|
||||
sed "s/c++\.m4/cxx.m4/" %XSRC%/data/location.cc > location.cc
|
||||
if errorlevel 1 goto location.ccFileError
|
||||
mv ./location.cc %XSRC%/data/location.cc
|
||||
sed "s/c++\.m4/cxx.m4/" %XSRC%/data/glr.cc > glr.cc
|
||||
if errorlevel 1 goto glr.ccFileError
|
||||
mv ./glr.cc %XSRC%/data/glr.cc
|
||||
|
||||
Rem Define DJGPP specific defs in config.hin
|
||||
echo Editing config.hin...
|
||||
test -f %XSRC%/config_h.orig
|
||||
if errorlevel 1 update %XSRC%/config.hin %XSRC%/config_h.orig
|
||||
sed -f %XSRC%/djgpp/config_h.sed %XSRC%/config_h.orig > config.hin
|
||||
if errorlevel 1 goto SedError2
|
||||
mv -f config.hin %XSRC%/config.hin
|
||||
|
||||
|
||||
Rem Fixing ilicit testsuite file name.
|
||||
test -f %XSRC%/tests/c++.at
|
||||
if not errorlevel 1 mv -f %XSRC%/tests/c++.at %XSRC%/tests/cxx.at
|
||||
|
||||
Rem Fixing ilicit calc++ file names in the calc++ directory.
|
||||
test -d %XSRC%/examples/calc++
|
||||
if not errorlevel 1 mv -f %XSRC%/examples/calc++ %XSRC%/examples/calcxx
|
||||
test -d %XSRC%/examples/calcxx
|
||||
if errorlevel 1 mv -f %XSRC%/examples/calcpp %XSRC%/examples/calcxx
|
||||
test -f %XSRC%/examples/calcxx/calc++-scanner.cc
|
||||
if not errorlevel 1 mv -f %XSRC%/examples/calcxx/calc++-scanner.cc %XSRC%/examples/calcxx/calcxx-scanner.cc
|
||||
test -f %XSRC%/examples/calcxx/calcxx-scanner.cc
|
||||
if errorlevel 1 mv -f %XSRC%/examples/calcxx/calcpp-scanner.cc %XSRC%/examples/calcxx/calcxx-scanner.cc
|
||||
test -f %XSRC%/examples/calcxx/calc++-scanner.ll
|
||||
if not errorlevel 1 mv -f %XSRC%/examples/calcxx/calc++-scanner.ll %XSRC%/examples/calcxx/calcxx-scanner.ll
|
||||
test -f %XSRC%/examples/calcxx/calcxx-scanner.ll
|
||||
if errorlevel 1 mv -f %XSRC%/examples/calcxx/calcpp-scanner.ll %XSRC%/examples/calcxx/calcxx-scanner.ll
|
||||
test -f %XSRC%/examples/calcxx/calc++-driver.cc
|
||||
if not errorlevel 1 mv -f %XSRC%/examples/calcxx/calc++-driver.cc %XSRC%/examples/calcxx/calcxx-driver.cc
|
||||
test -f %XSRC%/examples/calcxx/calcxx-driver.cc
|
||||
if errorlevel 1 mv -f %XSRC%/examples/calcxx/calcpp-driver.cc %XSRC%/examples/calcxx/calcxx-driver.cc
|
||||
test -f %XSRC%/examples/calcxx/calc++-driver.hh
|
||||
if not errorlevel 1 mv -f %XSRC%/examples/calcxx/calc++-driver.hh %XSRC%/examples/calcxx/calcxx-driver.hh
|
||||
test -f %XSRC%/examples/calcxx/calcxx-driver.hh
|
||||
if errorlevel 1 mv -f %XSRC%/examples/calcxx/calcpp-driver.hh %XSRC%/examples/calcxx/calcxx-driver.hh
|
||||
test -f %XSRC%/examples/calcxx/calc++-parser.cc
|
||||
if not errorlevel 1 mv -f %XSRC%/examples/calcxx/calc++-parser.cc %XSRC%/examples/calcxx/calcxx-parser.cc
|
||||
test -f %XSRC%/examples/calcxx/calcxx-parser.cc
|
||||
if errorlevel 1 mv -f %XSRC%/examples/calcxx/calcpp-parser.cc %XSRC%/examples/calcxx/calcxx-parser.cc
|
||||
test -f %XSRC%/examples/calcxx/calc++-parser.hh
|
||||
if not errorlevel 1 mv -f %XSRC%/examples/calcxx/calc++-parser.hh %XSRC%/examples/calcxx/calcxx-parser.hh
|
||||
test -f %XSRC%/examples/calcxx/calcxx-parser.hh
|
||||
if errorlevel 1 mv -f %XSRC%/examples/calcxx/calcpp-parser.hh %XSRC%/examples/calcxx/calcxx-parser.hh
|
||||
test -f %XSRC%/examples/calcxx/calc++-parser.stamp
|
||||
if not errorlevel 1 mv -f %XSRC%/examples/calcxx/calc++-parser.stamp %XSRC%/examples/calcxx/calcxx-parser.stamp
|
||||
test -f %XSRC%/examples/calcxx/calcxx-parser.stamp
|
||||
if errorlevel 1 mv -f %XSRC%/examples/calcxx/calcpp-parser.stamp %XSRC%/examples/calcxx/calcxx-parser.stamp
|
||||
test -f %XSRC%/examples/calcxx/calc++-parser.yy
|
||||
if not errorlevel 1 mv -f %XSRC%/examples/calcxx/calc++-parser.yy %XSRC%/examples/calcxx/calcxx-parser.yy
|
||||
test -f %XSRC%/examples/calcxx/calcxx-parser.yy
|
||||
if errorlevel 1 mv -f %XSRC%/examples/calcxx/calcpp-parser.yy %XSRC%/examples/calcxx/calcxx-parser.yy
|
||||
test -f %XSRC%/examples/calcxx/calc++.cc
|
||||
if not errorlevel 1 mv -f %XSRC%/examples/calcxx/calc++.cc %XSRC%/examples/calcxx/calcxx.cc
|
||||
test -f %XSRC%/examples/calcxx/calcxx.cc
|
||||
if errorlevel 1 mv -f %XSRC%/examples/calcxx/calcpp.cc %XSRC%/examples/calcxx/calcxx.cc
|
||||
|
||||
Rem Fixing #include lines in calcxx files.
|
||||
sed "/#[ ]*include/s/++/xx/" %XSRC%/examples/calcxx/calcxx.cc > calcxx.cc
|
||||
if errorlevel 1 goto calcxxFileError
|
||||
mv ./calcxx.cc %XSRC%/examples/calcxx/calcxx.cc
|
||||
sed "/#[ ]*include/s/++/xx/" %XSRC%/examples/calcxx/calcxx-driver.cc > calcxx-driver.cc
|
||||
if errorlevel 1 goto calcxxFileError
|
||||
mv ./calcxx-driver.cc %XSRC%/examples/calcxx/calcxx-driver.cc
|
||||
sed "/#[ ]*include/s/++/xx/" %XSRC%/examples/calcxx/calcxx-driver.hh > calcxx-driver.hh
|
||||
if errorlevel 1 goto calcxxFileError
|
||||
mv ./calcxx-driver.hh %XSRC%/examples/calcxx/calcxx-driver.hh
|
||||
sed "/#[ ]*include/s/++/xx/" %XSRC%/examples/calcxx/calcxx-parser.cc > calcxx-parser.cc
|
||||
if errorlevel 1 goto calcxxFileError
|
||||
mv ./calcxx-parser.cc %XSRC%/examples/calcxx/calcxx-parser.cc
|
||||
sed "/#[ ]*include/s/++/xx/" %XSRC%/examples/calcxx/calcxx-parser.hh > calcxx-parser.hh
|
||||
if errorlevel 1 goto calcxxFileError
|
||||
mv ./calcxx-parser.hh %XSRC%/examples/calcxx/calcxx-parser.hh
|
||||
:sed "/#[ ]*include/s/++/xx/" %XSRC%/examples/calcxx/calcxx-parser.yy > calcxx-parser.yy
|
||||
:if errorlevel 1 goto calcxxFileError
|
||||
:mv ./calcxx-parser.yy %XSRC%/examples/calcxx/calcxx-parser.yy
|
||||
sed "/#[ ]*include/s/++/xx/" %XSRC%/examples/calcxx/calcxx-scanner.cc > calcxx-scanner.cc
|
||||
if errorlevel 1 goto calcxxFileError
|
||||
mv ./calcxx-scanner.cc %XSRC%/examples/calcxx/calcxx-scanner.cc
|
||||
:sed "/#[ ]*include/s/++/xx/" %XSRC%/examples/calcxx/calcxx-scanner.ll > calcxx-scanner.ll
|
||||
:if errorlevel 1 goto calcxxFileError
|
||||
:mv ./calcxx-scanner.ll %XSRC%/examples/calcxx/calcxx-scanner.ll
|
||||
sed "s/calc++/calcxx/" %XSRC%/examples/calcxx/test > test
|
||||
if errorlevel 1 goto calcxxFileError
|
||||
mv ./test %XSRC%/examples/calcxx/test
|
||||
|
||||
|
||||
Rem Fixing the scanner files to make file names 8.3 valid.
|
||||
Rem Use only if you want to change the scan-gram.l and scan-skel.l files.
|
||||
: sed "/outfile=/s/\.yy/yy/" %XSRC%/src/scan-gram.l > scan-gram.l
|
||||
: if errorlevel 1 goto ScannerFileError
|
||||
: mv ./scan-gram.l %XSRC%/src/scan-gram.l
|
||||
: sed "/outfile=/s/\.yy/yy/" %XSRC%/src/scan-skel.l > scan-skel.l
|
||||
: if errorlevel 1 goto ScannerFileError
|
||||
: mv ./scan-skel.l %XSRC%/src/scan-skel.l
|
||||
|
||||
|
||||
Rem This is required because DOS/Windows are case-insensitive
|
||||
Rem to file names, and "make install" will do nothing if Make
|
||||
Rem finds a file called `install'.
|
||||
if exist INSTALL ren INSTALL INSTALL.txt
|
||||
|
||||
Rem Set SHELL to a sane default or some configure tests stop working
|
||||
Rem if the package is configured across partitions.
|
||||
if not "%SHELL%" == "" goto HomeName
|
||||
set SHELL=/bin/sh
|
||||
if not "%SHELL%" == "/bin/sh" goto SmallEnv
|
||||
echo No SHELL found in the environment, using default value
|
||||
|
||||
:HomeName
|
||||
Rem Set HOME to a sane default so configure stops complaining.
|
||||
if not "%HOME%" == "" goto HostName
|
||||
set HOME=%XSRC%/djgpp
|
||||
if not "%HOME%" == "%XSRC%/djgpp" goto SmallEnv
|
||||
echo No HOME found in the environment, using default value
|
||||
|
||||
:HostName
|
||||
Rem Set HOSTNAME so it shows in config.status
|
||||
if not "%HOSTNAME%" == "" goto hostdone
|
||||
if "%windir%" == "" goto msdos
|
||||
set OS=MS-Windows
|
||||
if not "%OS%" == "MS-Windows" goto SmallEnv
|
||||
goto haveos
|
||||
:msdos
|
||||
set OS=MS-DOS
|
||||
if not "%OS%" == "MS-DOS" goto SmallEnv
|
||||
:haveos
|
||||
if not "%USERNAME%" == "" goto haveuname
|
||||
if not "%USER%" == "" goto haveuser
|
||||
echo No USERNAME and no USER found in the environment, using default values
|
||||
set HOSTNAME=Unknown PC
|
||||
if not "%HOSTNAME%" == "Unknown PC" goto SmallEnv
|
||||
goto userdone
|
||||
:haveuser
|
||||
set HOSTNAME=%USER%'s PC
|
||||
if not "%HOSTNAME%" == "%USER%'s PC" goto SmallEnv
|
||||
goto userdone
|
||||
:haveuname
|
||||
set HOSTNAME=%USERNAME%'s PC
|
||||
if not "%HOSTNAME%" == "%USERNAME%'s PC" goto SmallEnv
|
||||
:userdone
|
||||
set _HOSTNAME=%HOSTNAME%, %OS%
|
||||
if not "%_HOSTNAME%" == "%HOSTNAME%, %OS%" goto SmallEnv
|
||||
set HOSTNAME=%_HOSTNAME%
|
||||
:hostdone
|
||||
set _HOSTNAME=
|
||||
set OS=
|
||||
|
||||
Rem install-sh is required by the configure script but clashes with the
|
||||
Rem various Makefile install-foo targets, so we MUST have it before the
|
||||
Rem script runs and rename it afterwards
|
||||
test -f %XSRC%/install-sh
|
||||
if not errorlevel 1 goto NoRen0
|
||||
test -f %XSRC%/install-sh.sh
|
||||
if not errorlevel 1 mv -f %XSRC%/install-sh.sh %XSRC%/install-sh
|
||||
:NoRen0
|
||||
|
||||
if "%NLS%" == "disabled" goto WithoutNLS
|
||||
|
||||
:WithNLS
|
||||
Rem Check for the needed libraries and binaries.
|
||||
test -x /dev/env/DJDIR/bin/msgfmt.exe
|
||||
if errorlevel 1 goto MissingNLSTools
|
||||
test -x /dev/env/DJDIR/bin/xgettext.exe
|
||||
if errorlevel 1 goto MissingNLSTools
|
||||
test -f /dev/env/DJDIR/include/libcharset.h
|
||||
if errorlevel 1 goto MissingNLSTools
|
||||
test -f /dev/env/DJDIR/lib/libcharset.a
|
||||
if errorlevel 1 goto MissingNLSTools
|
||||
test -f /dev/env/DJDIR/include/iconv.h
|
||||
if errorlevel 1 goto MissingNLSTools
|
||||
test -f /dev/env/DJDIR/lib/libiconv.a
|
||||
if errorlevel 1 goto MissingNLSTools
|
||||
test -f /dev/env/DJDIR/include/libintl.h
|
||||
if errorlevel 1 goto MissingNLSTools
|
||||
test -f /dev/env/DJDIR/lib/libintl.a
|
||||
if errorlevel 1 goto MissingNLSTools
|
||||
|
||||
Rem Recreate the files in the %XSRC%/po subdir with our ported tools.
|
||||
redir -e /dev/null rm %XSRC%/po/*.gmo
|
||||
redir -e /dev/null rm %XSRC%/po/bison.pot
|
||||
redir -e /dev/null rm %XSRC%/po/cat-id-tbl.c
|
||||
redir -e /dev/null rm %XSRC%/po/stamp-cat-id
|
||||
|
||||
Rem Update the arguments file for the configure script.
|
||||
Rem We prefer without-included-gettext because libintl.a from gettext package
|
||||
Rem is the only one that is garanteed to have been ported to DJGPP.
|
||||
echo --enable-nls --without-included-gettext >> arguments
|
||||
goto ConfigurePackage
|
||||
|
||||
:MissingNLSTools
|
||||
echo Needed libs/tools for NLS not found. Configuring without NLS.
|
||||
:WithoutNLS
|
||||
Rem Update the arguments file for the configure script.
|
||||
echo --disable-nls >> arguments
|
||||
|
||||
:ConfigurePackage
|
||||
echo Running the ./configure script...
|
||||
sh ./configure @arguments
|
||||
if errorlevel 1 goto CfgError
|
||||
rm arguments
|
||||
echo Done.
|
||||
goto End
|
||||
|
||||
:lalr1_ccFileError
|
||||
echo ./data/lalr1.cc file editing failed!
|
||||
goto End
|
||||
|
||||
:glr_ccFileError
|
||||
echo ./data/glr.cc file editing failed!
|
||||
goto End
|
||||
|
||||
:location_ccFileError
|
||||
echo ./data/location.cc file editing failed!
|
||||
goto End
|
||||
|
||||
:calcxxFileError
|
||||
echo ./examples/calcxx file editing failed!
|
||||
goto End
|
||||
|
||||
:ScannerFileError
|
||||
echo ./scanner file editing failed!
|
||||
goto End
|
||||
|
||||
:SedError
|
||||
echo ./configure script editing failed!
|
||||
goto End
|
||||
|
||||
:SedError2
|
||||
echo ./config.hin editing failed!
|
||||
goto End
|
||||
|
||||
:CfgError
|
||||
echo ./configure script exited abnormally!
|
||||
goto End
|
||||
|
||||
:SmallEnv
|
||||
echo Your environment size is too small. Enlarge it and run me again.
|
||||
echo Configuration NOT done!
|
||||
|
||||
:End
|
||||
test -f %XSRC%/install-sh.sh
|
||||
if not errorlevel 1 goto NoRen1
|
||||
test -f %XSRC%/install-sh
|
||||
if not errorlevel 1 mv -f %XSRC%/install-sh %XSRC%/install-sh.sh
|
||||
:NoRen1
|
||||
if "%SHELL%" == "/bin/sh" set SHELL=
|
||||
if "%HOME%" == "%XSRC%/djgpp" set HOME=
|
||||
set CONFIG_SITE=
|
||||
set HOSTNAME=
|
||||
set NLS=
|
||||
set XSRC=
|
||||
@@ -0,0 +1,164 @@
|
||||
# DJGPP specific configuration file.
|
||||
# Sed script for additional DJGPP specific editing
|
||||
# of the configure script generated by autoconf 2.57.
|
||||
|
||||
|
||||
# Copyright (C) 2005, 2006 Free Software Foundation, Inc.
|
||||
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2 of the License, or
|
||||
# (at your option) any later version.
|
||||
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software Foundation,
|
||||
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
|
||||
# Additional editing of Makefiles
|
||||
/(echo[ ]*':t/ a\
|
||||
# DJGPP specific Makefile changes.\
|
||||
/^aliaspath * *=/s,:,";",g;t t\
|
||||
/TEXINPUTS=/s,:,";",g;t t\
|
||||
/PATH=/s,:,";",g;t t\
|
||||
s,\\.deps,_deps,g;t t\
|
||||
s,\\.new\\.,_new.,g;t t\
|
||||
s,\\.old\\.,_old.,g;t t\
|
||||
s,c++\\.at,cxx.at,g;t t\
|
||||
s,c++\\.m4,cxx.m4,g;t t\
|
||||
s,calc++,calcxx,g;t t\
|
||||
s,scan-gram-c,c-scan-gram,g;t t\
|
||||
s,scan-skel-c,c-scan-skel,g;t t\
|
||||
s,Makefile\\.in\\.in,Makefile.in-in,g;t t\
|
||||
s,Makefile\\.am\\.in,Makefile.am-in,g;t t\
|
||||
s,(MAKEINFOFLAGS),& --no-split,\
|
||||
/^install-info-am:/,/^$/ {\
|
||||
/@list=/ s,\\\$(INFO_DEPS),& bison.i,\
|
||||
/@for *file/ s,\\\$(INFO_DEPS),& bison.i,\
|
||||
s,file-\\[0-9\\]\\[0-9\\],& \\$\\$file[0-9] \\$\\$file[0-9][0-9],\
|
||||
}\
|
||||
/^\\.y\\.c:/,/^$/ {\
|
||||
/\\\$(YACCCOMPILE)/ {\
|
||||
a\\\
|
||||
-@test -f y.tab.c && mv -f y.tab.c y_tab.c\\\
|
||||
-@test -f y.tab.h && mv -f y.tab.h y_tab.h\
|
||||
}\
|
||||
}\
|
||||
/^libbison.a:/ i\\\
|
||||
\\$(top_srcdir)/djgpp/subpipe.c: \\$(top_srcdir)/djgpp/subpipe.h\\\
|
||||
subpipe.o: \\$(top_srcdir)/djgpp/subpipe.c \\$(top_srcdir)/djgpp/subpipe.h\\\
|
||||
\\$(COMPILE) -c \\$<\
|
||||
/^yacc:/ i\\\
|
||||
yacc.bat:\\\
|
||||
echo "bison\\$(EXEEXT) -y %1 %2 %3 %4 %5 %6 %7 %8 %9" >\\$@\
|
||||
/^bin_SCRIPTS =/s/$/ yacc.bat/\
|
||||
/^MOSTLYCLEANFILES = yacc/s/$/ yacc.bat/
|
||||
|
||||
|
||||
# Makefile.in.in is renamed to Makefile.in-in.
|
||||
/ac_config_files=/,/_ACEOF/ {
|
||||
s|po/Makefile\.in|&:po/Makefile.in-in|
|
||||
}
|
||||
/CONFIG_FILES=/ s|po/Makefile\.in|&:po/Makefile.in-in|2
|
||||
|
||||
# We always use _deps and _libs instead of .deps and .libs, because
|
||||
# the latter is an invalid name on 8+3 MS-DOS file system. This makes
|
||||
# the generated Makefiles good for every DJGPP installation, not only
|
||||
# the one where the package was configured (which could happen to be
|
||||
# a Windows box, where leading dots in file names are allowed).
|
||||
s,\.deps,_deps,g
|
||||
s,\.libs,_libs,g
|
||||
/^rmdir[ ]*\.tst/ i\
|
||||
am__leading_dot=_
|
||||
|
||||
# Replace (command) > /dev/null with `command > /dev/null`, since
|
||||
# parenthesized commands always return zero status in the ported Bash,
|
||||
# even if the named command doesn't exist
|
||||
/if ([^|;`]*null/{
|
||||
s,(,`,
|
||||
s,),,
|
||||
/null[ ]*2>&1/ s,2>&1,&`,
|
||||
/null.*null/ s,null.*null,&`,
|
||||
/null.*null/ !{
|
||||
/null[ ]*2>&1/ !s,null,&`,
|
||||
}
|
||||
}
|
||||
|
||||
# DOS-style absolute file names should be supported as well
|
||||
/\*) top_srcdir=/s,/\*,[\\\\/]* | ?:[\\\\/]*,
|
||||
|
||||
# Prevent the spliting of subs.sed.
|
||||
# The sed script: subs.sed is split into 48 lines long files.
|
||||
# This will produce sed scripts called subs-$ac_sed_frag.sed, where
|
||||
# $ac_sed_frag is some unique number. This will not work if the splited
|
||||
# sed script contains a multiple line sed command at line #48. In this
|
||||
# case the first part of the multiple line sed command will be written
|
||||
# at the end of one particular subs-$ac_sed_frag.sed and the rest of the
|
||||
# sed command will be written at the begining of the next subs-$ac_sed_frag.sed
|
||||
# making both sed script useless.
|
||||
# This matches the configure script produced by Autoconf 2.57
|
||||
/ac_max_sed_lines=[0-9]/ s,=.*$,=`sed -n "$=" $tmp/subs.sed`,
|
||||
|
||||
# The following two items are changes needed for configuring
|
||||
# and compiling across partitions.
|
||||
# 1) The given srcdir value is always translated from the
|
||||
# "x:" syntax into "/dev/x" syntax while we run configure.
|
||||
/^[ ]*-srcdir=\*.*$/ a\
|
||||
ac_optarg=`echo "$ac_optarg" | sed "s,^\\([A-Za-z]\\):,/dev/\\1,"`
|
||||
/set X `ls -Lt \$srcdir/ i\
|
||||
if `echo $srcdir | grep "^/dev/" - > /dev/null`; then\
|
||||
srcdir=`echo "$srcdir" | sed -e "s%^/dev/%%" -e "s%/%:/%"`\
|
||||
fi
|
||||
|
||||
# Autoconf 2.52e generated configure scripts
|
||||
# write absolute paths into Makefiles and bison.in
|
||||
# making them useless for DJGPP installations for
|
||||
# which the package has not been configured for.
|
||||
/MISSING=/,/^$/ {
|
||||
/^fi$/ a\
|
||||
am_missing_run=`echo "$am_missing_run" | sed 's%/dev.*/bison[-_0-9]\\{1,1\\}[-.0-9A-z]*%${top_srcdir}%;s%.:.*/bison[-_0-9]\\{1,1\\}[-.0-9A-z]*%${top_srcdir}%'`
|
||||
}
|
||||
/^install_sh=/a\
|
||||
install_sh=`echo "$install_sh" | sed 's%/dev.*/bison[-_0-9]\\{1,1\\}[-.0-9A-z]*%${top_srcdir}%;s%.:.*/bison[-_0-9]\\{1,1\\}[-.0-9A-z]*%${top_srcdir}%'`
|
||||
|
||||
# This will only work if the assumption that the
|
||||
# testsuite is ran from the following path:
|
||||
# ${top_srcdir}/tests/testsuite.dir
|
||||
# holds. The explicit names are of no importance.
|
||||
# ../../. == ${top_srcdir}
|
||||
/\.)[ ]*ac_abs_builddir=/,/^esac$/ {
|
||||
/^esac$/ a\
|
||||
ac_abs_builddir=`echo "$ac_abs_builddir" | sed "s%/dev.*/bison[-_0-9]\\{1,1\\}[-.0-9A-z]*/[^/]*%../../.%;s%.:.*/bison[-_0-9]\\{1,1\\}[-.0-9A-z]*/[^/]*%../../.%"`
|
||||
}
|
||||
/\.)[ ]*ac_abs_top_builddir=/,/^esac$/ {
|
||||
/^esac$/ a\
|
||||
ac_abs_top_builddir=`echo "$ac_abs_top_builddir" | sed "s%/dev.*/bison[-_0-9]\\{1,1\\}[-.0-9A-z]*/[^/]*%../../../%;s%.:.*/bison[-_0-9]\\{1,1\\}[-.0-9A-z]*/[^/]*%../../../%"`
|
||||
}
|
||||
/\.)[ ]*ac_abs_srcdir=/,/^esac$/ {
|
||||
/^esac$/ a\
|
||||
ac_abs_srcdir=`echo "$ac_abs_srcdir" | sed "s%/dev.*/bison[-_0-9]\\{1,1\\}[-.0-9A-z]*/[^/]*%../../.%;s%.:.*/bison[-_0-9]\\{1,1\\}[-.0-9A-z]*/[^/]*%../../.%"`
|
||||
}
|
||||
/\.)[ ]*ac_abs_top_srcdir=/,/^esac$/ {
|
||||
/^esac$/ a\
|
||||
ac_abs_top_srcdir=`echo "$ac_abs_top_srcdir" | sed "s%/dev.*/bison[-_0-9]\\{1,1\\}[-.0-9A-z]*/[^/]*%../../../%;s%.:.*/bison[-_0-9]\\{1,1\\}[-.0-9A-z]*/[^/]*%../../../%"`
|
||||
}
|
||||
|
||||
# Add DJGPP version information.
|
||||
/^#define VERSION/ s/\$VERSION/& (DJGPP port (r1))/
|
||||
|
||||
# We need makeinfo to make the html formated docs.
|
||||
/\$am_missing_run[ ]*makeinfo/ s,\$am_missing_run,,
|
||||
|
||||
# The path to the FORTRAN compiler and libraries
|
||||
# shall contain no absolute path reference so it
|
||||
# will be good for all djgpp installations.
|
||||
/^FLIBS="\$ac_cv_flibs"/ i\
|
||||
ac_djgpp_path=`echo "$DJDIR" | sed 's%\\\\\\%/%g' | tr $as_cr_LETTERS $as_cr_letters`\
|
||||
ac_cv_flibs=`echo "$ac_cv_flibs" | sed "s%-L$ac_djgpp_path%-L/dev/env/DJDIR%g"`
|
||||
|
||||
# The following is not a valid DOS file name
|
||||
s/calc++/calcxx/g
|
||||
@@ -0,0 +1,83 @@
|
||||
#! /bin/sh
|
||||
|
||||
# This is the config.site file for configuring GNU packages
|
||||
# which are to be built with DJGPP tools.
|
||||
|
||||
# Copyright (C) 2005, 2006 Free Software Foundation, Inc.
|
||||
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2, or (at your option)
|
||||
# any later version.
|
||||
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software Foundation,
|
||||
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
|
||||
|
||||
# Include the djgpp subdirectory in PATH, so that getconf is found
|
||||
PATH="$srcdir/djgpp:$PATH"
|
||||
|
||||
# These two variables are required, otherwise looking for
|
||||
# programs along the PATH will not work.
|
||||
PATH_SEPARATOR=:
|
||||
PATH_EXPAND=y
|
||||
|
||||
# This is required in for "test -f foo" to find foo.exe
|
||||
export TEST_FINDS_EXE=y
|
||||
|
||||
# The root of the DJGPP tree serves as the default prefix
|
||||
test "x$prefix" = xNONE && prefix='/dev/env/DJDIR'
|
||||
|
||||
# This is required for config.status script to be run, since
|
||||
# ./configure runs it by invoking ${CONFIG_SHELL-/bin/sh}
|
||||
CONFIG_SHELL=${CONFIG_SHELL='sh'}
|
||||
|
||||
# These are set here so the generated Makefile's will be good
|
||||
# for every DJGPP installation, not only the one where the
|
||||
# package was configured.
|
||||
# $INSTALL must be an absolute path name, otherwise config.status
|
||||
# will try to prepend ./ and ../ to it when it goes into subdirs.
|
||||
INSTALL=${INSTALL='/dev/env/DJDIR/bin/ginstall -c'}
|
||||
RANLIB=${RANLIB='ranlib'}
|
||||
GMSGFMT=${GMSGFMT='/dev/env/DJDIR/bin/msgfmt'}
|
||||
MSGFMT=${MSGFMT='/dev/env/DJDIR/bin/msgfmt'}
|
||||
XGETTEXT=${XGETTEXT='/dev/env/DJDIR/bin/xgettext'}
|
||||
AWK=${AWK='gawk'}
|
||||
|
||||
# A sane default for emacs.
|
||||
ac_cv_path_EMACS=${EMACS='/dev/env/DJDIR/gnu/emacs/bin/emacs'}
|
||||
|
||||
# A sane default for m4.
|
||||
ac_cv_path_M4=${M4='/dev/env/DJDIR/bin/m4'}
|
||||
|
||||
# A sane default for grep.
|
||||
ac_cv_path_GREP=${GREP='/dev/env/DJDIR/bin/grep'}
|
||||
|
||||
# A sane default for egrep.
|
||||
ac_cv_path_EGREP=${EGREP='/dev/env/DJDIR/bin/egrep'}
|
||||
|
||||
# A sane default for fgrep.
|
||||
ac_cv_path_FGREP=${FGREP='/dev/env/DJDIR/bin/fgrep'}
|
||||
|
||||
# A sane default for sed.
|
||||
ac_cv_path_SED=${SED='/dev/env/DJDIR/bin/sed'}
|
||||
|
||||
# These are set here so the generated libtool will be good
|
||||
# for every DJGPP installation, not only the one where the
|
||||
# package was configured.
|
||||
NM=${NM='nm'}
|
||||
LD=${LD='ld'}
|
||||
|
||||
# Force the test for 'ln -s' to report 'cp -pf'.
|
||||
ac_cv_prog_LN_S='cp -pf'
|
||||
|
||||
# There is no fork and vfork functionality.
|
||||
ac_cv_func_fork=no
|
||||
ac_cv_func_vfork=no
|
||||
ac_cv_func_pipe=no
|
||||
@@ -0,0 +1,29 @@
|
||||
# sed script for DJGPP specific editing of config.hin
|
||||
|
||||
# Copyright (C) 2005, 2006 Free Software Foundation, Inc.
|
||||
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2, or (at your option)
|
||||
# any later version.
|
||||
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software Foundation,
|
||||
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
|
||||
|
||||
$ a\
|
||||
\
|
||||
\
|
||||
/* DJGPP specific defines. */\
|
||||
\
|
||||
#include <unistd.h>\
|
||||
#define TAB_EXT ((pathconf(NULL, _PC_NAME_MAX) > 12) ? ".tab" : "_tab")\
|
||||
#define OUTPUT_EXT ((pathconf(NULL, _PC_NAME_MAX) > 12) ? ".output" : ".out")\
|
||||
\
|
||||
#define DEFAULT_TMPDIR "/dev/env/DJDIR/tmp"
|
||||
@@ -0,0 +1,88 @@
|
||||
@echo off
|
||||
Rem
|
||||
Rem WARNING WARNING WARNING: This file needs to have DOS CRLF end-of-line
|
||||
Rem format, or else stock DOS/Windows shells will refuse to run it.
|
||||
Rem
|
||||
Rem This batch file unpacks the Bison distribution while simultaneously
|
||||
Rem renaming some of the files whose names are invalid on DOS or conflict
|
||||
Rem with other file names after truncation to DOS 8+3 namespace.
|
||||
Rem
|
||||
Rem Copyright (C) 2005, 2006 Free Software Foundation, Inc.
|
||||
Rem
|
||||
Rem This program is free software; you can redistribute it and/or modify
|
||||
Rem it under the terms of the GNU General Public License as published by
|
||||
Rem the Free Software Foundation; either version 2, or (at your option)
|
||||
Rem any later version.
|
||||
Rem
|
||||
Rem This program is distributed in the hope that it will be useful,
|
||||
Rem but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
Rem MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
Rem GNU General Public License for more details.
|
||||
Rem
|
||||
Rem You should have received a copy of the GNU General Public License
|
||||
Rem along with this program; if not, write to the Free Software Foundation,
|
||||
Rem Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
Rem
|
||||
Rem
|
||||
Rem Invoke like this:
|
||||
Rem
|
||||
Rem djunpack bison-XYZ.tar.gz
|
||||
Rem or
|
||||
Rem djunpack bison-XYZ.tar.bz2
|
||||
Rem
|
||||
Rem where XYZ is the version number. If the argument includes leading
|
||||
Rem directories, it MUST use backslashes, not forward slashes.
|
||||
Rem
|
||||
|
||||
set ENVIRONMENT_SIZE_TEST_STRING=ENVIRONMENT_SIZE_TEST_STRING
|
||||
if "%ENVIRONMENT_SIZE_TEST_STRING%"=="ENVIRONMENT_SIZE_TEST_STRING" GoTo EnvOk
|
||||
Rem If their environment space is too small, re-exec with a larger one
|
||||
command.com /e:4096 /c %0 %1
|
||||
GoTo End
|
||||
|
||||
:EnvOk
|
||||
set ENVIRONMENT_SIZE_TEST_STRING=
|
||||
if "%1" == "" GoTo NoArgument
|
||||
if not exist %1 GoTo NoArchive
|
||||
Rem Extract top src dir from archive file.
|
||||
djtar -t %1 > top_src.dir
|
||||
Rem The following uses a feature of COPY whereby it does not copy
|
||||
Rem empty files. We need that because the previous line will create
|
||||
Rem an empty fnchange.tmp even if the command failed for some reason.
|
||||
copy top_src.dir junk.tmp > nul
|
||||
if not exist junk.tmp GoTo NoDjTar
|
||||
del junk.tmp
|
||||
sed "1{s/^.*bison-/djtar -x -p -o bison-/;s|$|djgpp/fnchange.lst %%1 > fnchange.tmp|};2,$d" top_src.dir > ext_list.bat
|
||||
Rem See the comment above about the reason for using COPY.
|
||||
copy ext_list.bat junk.tmp > nul
|
||||
if not exist junk.tmp GoTo NoSed
|
||||
del junk.tmp
|
||||
Rem Extract fnchange.lst from archive.
|
||||
call ext_list.bat %1
|
||||
del ext_list.bat
|
||||
sed "1{s|^.*bison-|s/@V@/bison-|;s|$|g|};2,$d" top_src.dir > version.sed
|
||||
sed -f version.sed < fnchange.tmp > fnchange.lst
|
||||
del version.sed
|
||||
del fnchange.tmp
|
||||
del top_src.dir
|
||||
Rem unpack the source distribution
|
||||
djtar -x -n fnchange.lst %1
|
||||
del fnchange.lst
|
||||
GoTo End
|
||||
|
||||
:NoSed
|
||||
del junk.tmp
|
||||
echo FAIL: Sed is not available.
|
||||
GoTo End
|
||||
:NoDjTar
|
||||
del junk.tmp
|
||||
echo FAIL: DJTAR is not available or no fnchange.lst file in %1.
|
||||
GoTo End
|
||||
:NoArchive
|
||||
echo FAIL: the file %1 does not seem to exist.
|
||||
echo Remember that %1 cannot use forward slashes, only backslashes.
|
||||
GoTo End
|
||||
:NoArgument
|
||||
echo FAIL: no archive file has been specified.
|
||||
echo Remember that the file name cannot use forward slashes, only backslashes.
|
||||
:End
|
||||
@@ -0,0 +1,2 @@
|
||||
@V@/src/scan-gram-c.c @V@/src/c-scan-gram.c
|
||||
@V@/src/scan-skel-c.c @V@/src/c-scan-skel.c
|
||||
+285
@@ -0,0 +1,285 @@
|
||||
/* Subprocesses with pipes.
|
||||
|
||||
Copyright (C) 2005, 2006 Free Software Foundation, Inc.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2, or (at your option)
|
||||
any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software Foundation,
|
||||
Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
|
||||
/* Written by Juan Manuel Guerrero <[email protected]>. */
|
||||
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
#include "subpipe.h"
|
||||
|
||||
#include <errno.h>
|
||||
#include <fcntl.h>
|
||||
#include <sys/stat.h>
|
||||
#include <process.h>
|
||||
#include <signal.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
#include "xalloc.h"
|
||||
|
||||
|
||||
#ifndef STDIN_FILENO
|
||||
# define STDIN_FILENO 0
|
||||
#endif
|
||||
#ifndef STDOUT_FILENO
|
||||
# define STDOUT_FILENO 1
|
||||
#endif
|
||||
|
||||
|
||||
#include "error.h"
|
||||
|
||||
#include "gettext.h"
|
||||
#define _(Msgid) gettext (Msgid)
|
||||
|
||||
|
||||
/* Initialize this module. */
|
||||
|
||||
|
||||
static int old_stdin;
|
||||
static int old_stdout;
|
||||
static char **arguments;
|
||||
static char tmp_file_name[2][L_tmpnam];
|
||||
|
||||
#define remove_tmp_file(fd, name) \
|
||||
do { \
|
||||
close ((fd)); \
|
||||
if (unlink ((name))) \
|
||||
error (EXIT_FAILURE, 0, _("removing of `%s' failed"), (name)); \
|
||||
} while (0)
|
||||
|
||||
|
||||
void
|
||||
init_subpipe(void)
|
||||
{
|
||||
int fd;
|
||||
|
||||
strcpy(tmp_file_name[0], "/dev/env/TMPDIR/bnXXXXXX");
|
||||
fd = mkstemp(tmp_file_name[0]);
|
||||
if (fd < 0)
|
||||
error(EXIT_FAILURE, 0, _("creation of a temporary file failed"));
|
||||
close (fd);
|
||||
|
||||
strcpy(tmp_file_name[1], "/dev/env/TMPDIR/bnXXXXXX");
|
||||
fd = mkstemp(tmp_file_name[1]);
|
||||
if (fd < 0)
|
||||
error(EXIT_FAILURE, 0, _("creation of a temporary file failed"));
|
||||
close (fd);
|
||||
}
|
||||
|
||||
|
||||
/* Create a subprocess that is run as a filter. ARGV is the
|
||||
NULL-terminated argument vector for the subprocess. Store read and
|
||||
write file descriptors for communication with the subprocess into
|
||||
FD[0] and FD[1]: input meant for the process can be written into
|
||||
FD[0], and output from the process can be read from FD[1]. Return
|
||||
the subprocess id.
|
||||
|
||||
Because DOS has neither fork nor pipe functionality to run the subprocess
|
||||
as a filter, the filter is reproduced using temporary files. First bison's
|
||||
stdout is redirected to a temporary file. After bison has produced all of
|
||||
is output, this file is closed and connected to m4's stdin. All m4's output
|
||||
is redirected from m4's stdout to a second temporary file and reopened as
|
||||
bison's stdin. */
|
||||
|
||||
pid_t
|
||||
create_subpipe(char const *const *argv, int fd[2])
|
||||
{
|
||||
int argc;
|
||||
int from_in_fd; /* pipe from bison to m4. */
|
||||
pid_t pid;
|
||||
|
||||
|
||||
pid = getpid();
|
||||
|
||||
/*
|
||||
* Save original stdin and stdout
|
||||
* for later restauration.
|
||||
*/
|
||||
old_stdin = dup(STDIN_FILENO);
|
||||
if (old_stdin < 0)
|
||||
error(EXIT_FAILURE, 0, _("saving stdin failed"));
|
||||
|
||||
old_stdout = dup(STDOUT_FILENO);
|
||||
if (old_stdout < 0)
|
||||
error(EXIT_FAILURE, 0, _("saving stdout failed"));
|
||||
|
||||
/*
|
||||
* Save argv for later use.
|
||||
*/
|
||||
for (argc = 0; argv[argc]; argc++)
|
||||
;
|
||||
argc++;
|
||||
arguments = xmalloc(argc * sizeof(arguments[0]));
|
||||
for (argc = 0; argv[argc]; argc++)
|
||||
{
|
||||
arguments[argc] = xmalloc((strlen(argv[argc]) + 1) * sizeof(arguments[0][0]));
|
||||
strcpy(arguments[argc], argv[argc]);
|
||||
}
|
||||
arguments[argc] = NULL;
|
||||
|
||||
/*
|
||||
* All bison's output will be gathered in this temporary file
|
||||
* and will be redirected to m4's stdin.
|
||||
*/
|
||||
from_in_fd = open(tmp_file_name[0], O_WRONLY | O_CREAT | O_TRUNC, S_IWUSR);
|
||||
if (from_in_fd < 0)
|
||||
error(EXIT_FAILURE, 0, _("opening of tmpfile failed"));
|
||||
if (dup2(from_in_fd, STDOUT_FILENO) < 0)
|
||||
{
|
||||
remove_tmp_file(from_in_fd, tmp_file_name[0]);
|
||||
error(EXIT_FAILURE, 0, _("redirecting bison's stdout to the temporary file failed"));
|
||||
}
|
||||
close(from_in_fd);
|
||||
|
||||
|
||||
fd[0] = STDOUT_FILENO;
|
||||
return pid;
|
||||
}
|
||||
|
||||
|
||||
/* A signal handler that just records that a signal has happened. */
|
||||
static int child_interrupted;
|
||||
|
||||
static void
|
||||
signal_catcher(int signo)
|
||||
{
|
||||
child_interrupted++;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
end_of_output_subpipe(pid_t pid, int fd[2])
|
||||
{
|
||||
char *program;
|
||||
int from_out_fd = open(tmp_file_name[0], O_RDONLY, S_IRUSR); /* pipe from bison to m4. */
|
||||
int to_in_fd = open(tmp_file_name[1], O_WRONLY | O_CREAT | O_TRUNC, S_IWUSR); /* pipe from m4 to bison. */
|
||||
int status;
|
||||
void (*previous_handler)(int);
|
||||
|
||||
|
||||
program = strrchr(arguments[0], '/');
|
||||
if (program)
|
||||
program++;
|
||||
else
|
||||
program = arguments[0];
|
||||
|
||||
/*
|
||||
* Redirect bison's output to m4's stdin.
|
||||
*/
|
||||
if (from_out_fd < 0)
|
||||
error(EXIT_FAILURE, 0, _("opening of tmpfile failed"));
|
||||
if (dup2(from_out_fd, STDIN_FILENO) < 0)
|
||||
{
|
||||
remove_tmp_file(from_out_fd, tmp_file_name[0]);
|
||||
error(EXIT_FAILURE, 0, _("redirecting m4's stdin from the temporary file failed"));
|
||||
}
|
||||
close(from_out_fd);
|
||||
|
||||
/*
|
||||
* All m4's output will be gathered in this temporary file
|
||||
* and will be redirected to bison's stdin.
|
||||
*/
|
||||
if (to_in_fd < 0)
|
||||
{
|
||||
remove_tmp_file(STDIN_FILENO, tmp_file_name[0]);
|
||||
error(EXIT_FAILURE, 0, _("opening of a temporary file failed"));
|
||||
}
|
||||
if (dup2(to_in_fd, STDOUT_FILENO) < 0)
|
||||
{
|
||||
remove_tmp_file(STDIN_FILENO, tmp_file_name[0]);
|
||||
remove_tmp_file(to_in_fd, tmp_file_name[1]);
|
||||
error(EXIT_FAILURE, 0, _("redirecting m4's stdout to a temporary file failed"));
|
||||
}
|
||||
close(to_in_fd);
|
||||
|
||||
/*
|
||||
* Run m4.
|
||||
*/
|
||||
child_interrupted = 0;
|
||||
errno = 0;
|
||||
previous_handler = signal(SIGINT, signal_catcher);
|
||||
status = spawnvp(P_WAIT, program, arguments);
|
||||
signal(SIGINT, previous_handler);
|
||||
if (child_interrupted)
|
||||
{
|
||||
remove_tmp_file(STDIN_FILENO, tmp_file_name[0]);
|
||||
remove_tmp_file(STDOUT_FILENO, tmp_file_name[1]);
|
||||
error(EXIT_FAILURE, 0, _("subsidiary program `%s' interrupted"), program);
|
||||
}
|
||||
if (status)
|
||||
{
|
||||
remove_tmp_file(STDIN_FILENO, tmp_file_name[0]);
|
||||
remove_tmp_file(STDOUT_FILENO, tmp_file_name[1]);
|
||||
error(EXIT_FAILURE, 0, _(errno == ENOENT
|
||||
? "subsidiary program `%s' not found"
|
||||
: status < 1
|
||||
? "subsidiary program `%s' failed"
|
||||
: "subsidiary program `%s' failed (status=%i, errno=%i)"), program, status, errno);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Redirect m4's output to bison's stdin.
|
||||
*/
|
||||
if (dup2(old_stdout, STDOUT_FILENO) < 0)
|
||||
error(EXIT_FAILURE, 0, "restore of bison's stdout failed");
|
||||
close(old_stdout);
|
||||
to_in_fd = open(tmp_file_name[1], O_RDONLY, S_IRUSR); /* pipe from m4 to bison. */
|
||||
if (to_in_fd < 0)
|
||||
{
|
||||
remove_tmp_file(STDIN_FILENO, tmp_file_name[0]);
|
||||
error(EXIT_FAILURE, 0, _("opening of tmpfile failed"));
|
||||
}
|
||||
if (dup2(to_in_fd, STDIN_FILENO) < 0)
|
||||
{
|
||||
remove_tmp_file(STDIN_FILENO, tmp_file_name[0]);
|
||||
remove_tmp_file(to_in_fd, tmp_file_name[1]);
|
||||
error(EXIT_FAILURE, -1, "dup2");
|
||||
error(EXIT_FAILURE, 0, _("redirecting bison's stdin from the temporary file failed"));
|
||||
}
|
||||
close(to_in_fd);
|
||||
|
||||
|
||||
fd[1] = STDIN_FILENO;
|
||||
}
|
||||
|
||||
|
||||
/* Free resources, unlink temporary files and restore stdin and stdout. */
|
||||
|
||||
void
|
||||
reap_subpipe(pid_t pid, char const *program)
|
||||
{
|
||||
int argc;
|
||||
|
||||
for (argc = 0; arguments[argc]; argc++)
|
||||
free(arguments[argc]);
|
||||
free(arguments);
|
||||
|
||||
if (unlink(tmp_file_name[0]))
|
||||
error(EXIT_FAILURE, 0, _("removing of `%s' failed"), tmp_file_name[0]);
|
||||
if (unlink(tmp_file_name[1]))
|
||||
error(EXIT_FAILURE, 0, _("removing of `%s' failed"), tmp_file_name[1]);
|
||||
|
||||
if (dup2(old_stdin, STDIN_FILENO) < 0)
|
||||
error(EXIT_FAILURE, 0, "restore of bison's stdin failed");
|
||||
close(old_stdin);
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
/* Subprocesses with pipes.
|
||||
Copyright (C) 2005 Free Software Foundation, Inc.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software Foundation,
|
||||
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
|
||||
|
||||
/* Written by Juan Manuel Guerrero <[email protected]>. */
|
||||
|
||||
#if HAVE_SYS_TYPES_H
|
||||
# include <sys/types.h>
|
||||
#endif
|
||||
|
||||
void init_subpipe(void);
|
||||
pid_t create_subpipe(char const * const *, int[2]);
|
||||
void end_of_output_subpipe(pid_t, int[2]);
|
||||
void reap_subpipe(pid_t, char const *);
|
||||
@@ -4,6 +4,7 @@ bison.cp
|
||||
bison.cps
|
||||
bison.dvi
|
||||
bison.fn
|
||||
bison.html
|
||||
bison.ky
|
||||
bison.log
|
||||
bison.pdf
|
||||
|
||||
+1087
File diff suppressed because it is too large
Load Diff
@@ -1,109 +0,0 @@
|
||||
Frequently Asked Questions about Bison:
|
||||
|
||||
----------------------------------------------------------------------
|
||||
|
||||
Q1. Is Bison Y2K compliant?
|
||||
|
||||
A1. If you're looking for a guarantee or certification, I can't
|
||||
provide it. With a little thought you can answer this one for
|
||||
yourself, though. (Hint: does a parser generator rely on the
|
||||
date or time for anything?) If you're still confused, see
|
||||
http://www.gnu.org/software/year2000.html for more information.
|
||||
|
||||
----------------------------------------------------------------------
|
||||
|
||||
Q2. I can't build Bison because "make" complains that "msgfmt" is not
|
||||
found. What should I do?
|
||||
|
||||
A2. Like most GNU packages with internationalization support, that
|
||||
feature is turned on by default. If you have problems building
|
||||
in the "po" subdirectory, it indicates that your system's
|
||||
internationalization support is lacking. You can re-configure
|
||||
Bison with "--disable-nls" to turn off this support, or you can
|
||||
install GNU gettext from ftp://ftp.gnu.org/gnu/gettext/ and
|
||||
re-configure Bison. See the file "ABOUT-NLS" for more
|
||||
information.
|
||||
|
||||
----------------------------------------------------------------------
|
||||
|
||||
Q3. I'm having trouble using Bison. Where can I find help?
|
||||
|
||||
A3. First, read the fine manual which comes with bison. Beyond that,
|
||||
you can send mail to <[email protected]>. This mailing list is
|
||||
intended to be populated with people who are willing to answer
|
||||
questions about using and installing Bison. Please keep in mind
|
||||
that (most of) the people on the list have aspects of their lives
|
||||
which are not related to Bison (!), so you may not receive an
|
||||
answer to your question right away. This can be frustrating, but
|
||||
please try not to honk them off; remember that any help they
|
||||
provide is purely voluntary and out of the kindness of their
|
||||
hearts.
|
||||
|
||||
----------------------------------------------------------------------
|
||||
|
||||
Q4. I found a bug. What should I include in the bug report?
|
||||
|
||||
A4. Before you send a bug report, make sure you are using the latest
|
||||
version. Check ftp://ftp.gnu.org/pub/gnu/bison/ or one of its
|
||||
mirrors. Be sure to include the version number in your bug
|
||||
report. If the bug is present in the latest version but not in a
|
||||
previous version, try to determine the most recent version which
|
||||
did not contain the bug.
|
||||
|
||||
If the bug is parser-related, you should include the smallest
|
||||
grammar you can which demonstrates the bug. The grammar file
|
||||
should also be complete (i.e., I should be able to run it through
|
||||
Bison without having to edit or add anything). The smaller and
|
||||
simpler the grammar, the easier it will be to fix the bug.
|
||||
|
||||
Include information about your compilation environment, including
|
||||
your operating system's name and version and your compiler's name
|
||||
and version. If you have trouble compiling, you should also
|
||||
include a transcript of the build session, starting with the
|
||||
invocation of `configure'. Depending on the nature of the bug,
|
||||
you may be asked to send additional files as well (such as
|
||||
`config.h' or `config.cache').
|
||||
|
||||
Patches are most welcome, but not required. That is, do not
|
||||
hesitate to send a bug report just because you can not provide a
|
||||
fix.
|
||||
|
||||
Send bug reports to <[email protected]>.
|
||||
|
||||
----------------------------------------------------------------------
|
||||
|
||||
Q5. Will Bison ever have C++ support?
|
||||
|
||||
A5. Yes, it's in the works. Things are very chaotic right now, but
|
||||
what little information floats around is posted to the bug-bison
|
||||
mailing list. If you're interested in testing C++ support when
|
||||
it becomes available, please consider subscribing to the list,
|
||||
especially if you are willing to beta test other releases as
|
||||
well.
|
||||
|
||||
----------------------------------------------------------------------
|
||||
|
||||
Q6. What is involved in being a beta tester?
|
||||
|
||||
A6. It's not terribly involved. Basically, you would download a test
|
||||
release, compile it, and use it to build and run a parser or two.
|
||||
After that, you would submit either a bug report or a message
|
||||
saying that everything is okay. It is important to report
|
||||
successes as well as failures because test releases eventually
|
||||
become mainstream releases, but only if they are adequately
|
||||
tested. If no one tests, development is essentially halted.
|
||||
|
||||
Beta testers are particularly needed for operating systems to
|
||||
which I do not have access. I currently have easy access to
|
||||
Linux (x86 glibc 2.1), Solaris (SPARC) 2.6 and 2.7, and HP-UX
|
||||
10.20. Reports about other operating systems are especially
|
||||
welcome.
|
||||
|
||||
----------------------------------------------------------------------
|
||||
|
||||
Q7. How do I join the help-bison and bug-bison mailing lists?
|
||||
|
||||
A7. See http://www.gnu.org/ (the section about "GNU mailing lists")
|
||||
for more information.
|
||||
|
||||
----------------------------------------------------------------------
|
||||
+37
-4
@@ -1,5 +1,5 @@
|
||||
## Process this file with automake to produce Makefile.in -*-Makefile-*-
|
||||
## Copyright (C) 2001, 2002, 2003, 2005 Free Software Foundation, Inc.
|
||||
## Copyright (C) 2001, 2002, 2003, 2005, 2006 Free Software Foundation, Inc.
|
||||
|
||||
## This program is free software; you can redistribute it and/or modify
|
||||
## it under the terms of the GNU General Public License as published by
|
||||
@@ -21,14 +21,47 @@ info_TEXINFOS = bison.texinfo
|
||||
man_MANS = bison.1
|
||||
bison_TEXINFOS = gpl.texi fdl.texi
|
||||
|
||||
EXTRA_DIST = FAQ bison.1 refcard.tex
|
||||
EXTRA_DIST = bison.1 refcard.tex
|
||||
|
||||
CLEANFILES = refcard.dvi refcard.log refcard.ps bison.fns
|
||||
|
||||
CLEANDIRS = *.t2d
|
||||
clean-local:
|
||||
rm -rf *.t2d
|
||||
rm -rf $(CLEANDIRS)
|
||||
|
||||
refcard.dvi: refcard.tex
|
||||
tex refcard.tex
|
||||
|
||||
refcard.ps: refcard.dvi
|
||||
|
||||
|
||||
|
||||
## -------------- ##
|
||||
## Doxygenation. ##
|
||||
## -------------- ##
|
||||
|
||||
DOXYGEN = doxygen
|
||||
|
||||
.PHONY: doc html
|
||||
|
||||
doc: html
|
||||
|
||||
html-local: Doxyfile
|
||||
$(DOXYGEN)
|
||||
|
||||
edit = sed -e "s|@ID@|$$Id|" \
|
||||
-e 's,@PACKAGE_NAME\@,$(PACKAGE_NAME),g' \
|
||||
-e 's,@PACKAGE_VERSION\@,$(PACKAGE_VERSION),g' \
|
||||
-e 's,@top_builddir\@,$(top_builddir),g' \
|
||||
-e 's,@top_srcdir\@,$(top_srcdir),g'
|
||||
|
||||
EXTRA_DIST += Doxyfile.in
|
||||
CLEANFILES += Doxyfile
|
||||
# Sed is used to generate Doxyfile from Doxyfile.in instead of
|
||||
# configure, because the former is way faster than the latter.
|
||||
# Moreover, this file is updated whenever ChangeLog is touched: using
|
||||
# sed instead of configure saves us a lot of time.
|
||||
Doxyfile: $(top_srcdir)/ChangeLog $(srcdir)/Doxyfile.in
|
||||
Id=`grep '^\$$Id' $(top_srcdir)/ChangeLog`; \
|
||||
$(edit) $(srcdir)/Doxyfile.in >Doxyfile
|
||||
|
||||
CLEANDIRS += html latex
|
||||
|
||||
+1
-1
@@ -284,7 +284,7 @@ so that the debugging facilities are compiled.
|
||||
.TP
|
||||
.B \-\-verbose
|
||||
Write an extra output file containing verbose descriptions of the
|
||||
parser states and what is done for each type of look-ahead token in
|
||||
parser states and what is done for each type of lookahead token in
|
||||
that state.
|
||||
.sp
|
||||
This file also describes all the conflicts, both those resolved by
|
||||
|
||||
+1035
-458
File diff suppressed because it is too large
Load Diff
+3
-3
@@ -458,7 +458,7 @@ as either {\tt first_column} or {\tt last_column}.
|
||||
\section {Variables and Types}
|
||||
%*****************************
|
||||
|
||||
\key{Current look ahead token.} {yychar}
|
||||
\key{Current lookahead token.} {yychar}
|
||||
\key{Debug mode flag.} {yydebug}
|
||||
\key{Data associated with the current token.} {yylval}
|
||||
\key{Source position of current token.} {yylloc}
|
||||
@@ -489,8 +489,8 @@ as either {\tt first_column} or {\tt last_column}.
|
||||
\key{Quit parsing immediately. Return 1.} {YYABORT}
|
||||
\key{Quit parsing immediately. Return 0.} {YYACCEPT}
|
||||
\key{Pretend a syntax error occurred.} {YYERROR}
|
||||
\key{Value in {\tt yychar} if no look-ahead token.} {YYEMPTY}
|
||||
\key{Clear previous look ahead token.} {yyclearin}
|
||||
\key{Value in {\tt yychar} if no lookahead token.} {YYEMPTY}
|
||||
\key{Clear previous lookahead token.} {yyclearin}
|
||||
\key{Recover normally from an error.} {yyerrok}
|
||||
|
||||
% **************
|
||||
|
||||
+43
@@ -0,0 +1,43 @@
|
||||
A directory of tools provided to people using CVS Bison. None of
|
||||
these is distributed.
|
||||
|
||||
* bench.pl
|
||||
A primitive Perl script to run benches. Currently its only bench is
|
||||
the usual calculator: it has a lightweight processing part (but not
|
||||
null), so it is really emphasizing the cost of the whole parsing
|
||||
(including scanning and I/O).
|
||||
|
||||
Set the envvars BISON and CC to the programs and flags you want to
|
||||
use. They default to bison and gcc. To run a non-installed bison
|
||||
from a tarball built in _build, I suggest the following.
|
||||
|
||||
BISON=_build/tests/bison CC='gcc -O2' ./bench.pl
|
||||
|
||||
(The _build/tests/bison wrapper makes sure that _build/src/bison will
|
||||
use the tarballs' skeletons, not those already installed as a
|
||||
straightforward use of _build/src/bison would.)
|
||||
|
||||
--
|
||||
|
||||
Copyright (C) 2006 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of Bison, the GNU Compiler Compiler.
|
||||
|
||||
Bison is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2, or (at your option)
|
||||
any later version.
|
||||
|
||||
Bison is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with autoconf; see the file COPYING. If not, write to
|
||||
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
Boston, MA 02110-1301, USA.
|
||||
|
||||
Local Variables:
|
||||
mode: outline
|
||||
End:
|
||||
Executable
+413
File diff suppressed because one or more lines are too long
@@ -16,6 +16,8 @@
|
||||
## Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
## 02110-1301 USA
|
||||
|
||||
if BISON_CXX_WORKS
|
||||
SUBDIRS = calc++
|
||||
endif
|
||||
|
||||
dist_noinst_SCRIPTS = extexi
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
## Process this file with automake to produce Makefile.in -*-Makefile-*-
|
||||
## Copyright (C) 2005 Free Software Foundation, Inc.
|
||||
## Copyright (C) 2005, 2006 Free Software Foundation, Inc.
|
||||
|
||||
## This program is free software; you can redistribute it and/or modify
|
||||
## it under the terms of the GNU General Public License as published by
|
||||
@@ -72,7 +72,7 @@ $(calc_sources_generated): $(srcdir)/calc++-parser.stamp
|
||||
## Building & testing calc++. ##
|
||||
## --------------------------- ##
|
||||
|
||||
noinst_PROGRAMS = calc++
|
||||
check_PROGRAMS = calc++
|
||||
|
||||
calc_sources_extracted = $(srcdir)/calc++-scanner.ll $(srcdir)/calc++.cc \
|
||||
$(srcdir)/calc++-driver.hh $(srcdir)/calc++-driver.cc
|
||||
|
||||
@@ -1,6 +1,10 @@
|
||||
#! /bin/sh
|
||||
|
||||
set +e
|
||||
test -z "$VERBOSE" && {
|
||||
exec > /dev/null 2>&1
|
||||
set -x
|
||||
}
|
||||
|
||||
cat >input <<EOF
|
||||
a := 1
|
||||
b := 2
|
||||
@@ -18,8 +22,6 @@ d := a + b * c
|
||||
EOF
|
||||
./calc++ input
|
||||
|
||||
set -x
|
||||
echo toto
|
||||
cat >input <<EOF
|
||||
toto := 1
|
||||
toto
|
||||
|
||||
+5
-3
@@ -1,7 +1,7 @@
|
||||
# Extract all examples from the manual source. -*- AWK -*-
|
||||
|
||||
# This file is part of GNU Bison
|
||||
# Copyright 1992, 2000, 2001, 2005 Free Software Foundation, Inc.
|
||||
# Copyright 1992, 2000, 2001, 2005, 2006 Free Software Foundation, Inc.
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
@@ -77,9 +77,11 @@ BEGIN {
|
||||
input = normalize(input);
|
||||
# No spurious end of line: use printf.
|
||||
if (files_output[file])
|
||||
printf ("%s", input) >> output_dir "/" file;
|
||||
# The parens around the output file seem to be required
|
||||
# by awk on Mac OS X Tiger (darwin 8.4.6).
|
||||
printf ("%s", input) >> (output_dir "/" file);
|
||||
else
|
||||
printf ("%s", input) > output_dir "/" file;
|
||||
printf ("%s", input) > (output_dir "/" file);
|
||||
close (output_dir "/" file);
|
||||
files_output[file] = 1;
|
||||
|
||||
|
||||
+9
-7
@@ -1,9 +1,6 @@
|
||||
.deps
|
||||
Makefile
|
||||
Makefile.in
|
||||
alloca.c
|
||||
alloca.h
|
||||
alloca_.h
|
||||
argmatch.c
|
||||
argmatch.h
|
||||
basename.c
|
||||
@@ -24,8 +21,6 @@ getopt_.h
|
||||
getopt_int.h
|
||||
gettext.h
|
||||
gnulib.mk
|
||||
hard-locale.c
|
||||
hard-locale.h
|
||||
hash.c
|
||||
hash.h
|
||||
malloc.c
|
||||
@@ -40,20 +35,27 @@ quotearg.c
|
||||
quotearg.h
|
||||
stdbool.h
|
||||
stdbool_.h
|
||||
stdint.h
|
||||
stdint_.h
|
||||
stdio--.h
|
||||
stdio-safer.h
|
||||
stpcpy.c
|
||||
stpcpy.h
|
||||
strdup.c
|
||||
strdup.h
|
||||
strerror.c
|
||||
stripslash.c
|
||||
strndup.c
|
||||
strndup.h
|
||||
strnlen.c
|
||||
strnlen.h
|
||||
strtol.c
|
||||
strtoul.c
|
||||
strverscmp.c
|
||||
strverscmp.h
|
||||
unistd--.h
|
||||
unistd-safer.h
|
||||
unlocked-io.h
|
||||
verify.h
|
||||
wcwidth.h
|
||||
xalloc-die.c
|
||||
xalloc.h
|
||||
xmalloc.c
|
||||
|
||||
+9
-11
@@ -1,5 +1,5 @@
|
||||
/* Array bitsets.
|
||||
Copyright (C) 2002, 2003 Free Software Foundation, Inc.
|
||||
Copyright (C) 2002, 2003, 2006 Free Software Foundation, Inc.
|
||||
Contributed by Michael Hayes ([email protected]).
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
@@ -13,12 +13,11 @@
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
along with this program; if not, write to the Free Software Foundation,
|
||||
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
#include "abitset.h"
|
||||
@@ -34,14 +33,13 @@
|
||||
|
||||
|
||||
static bitset_bindex
|
||||
abitset_resize (bitset src ATTRIBUTE_UNUSED,
|
||||
bitset_bindex size ATTRIBUTE_UNUSED)
|
||||
abitset_resize (bitset src, bitset_bindex size)
|
||||
{
|
||||
if (BITSET_SIZE_ (src) == size)
|
||||
return size;
|
||||
|
||||
/* These bitsets have a fixed size. */
|
||||
abort ();
|
||||
if (BITSET_SIZE_ (src) != size)
|
||||
abort ();
|
||||
|
||||
return size;
|
||||
}
|
||||
|
||||
/* Find list of up to NUM bits set in BSET starting from and including
|
||||
|
||||
+9
-9
@@ -1,5 +1,5 @@
|
||||
/* Base bitset stuff.
|
||||
Copyright (C) 2002, 2003, 2004 Free Software Foundation, Inc.
|
||||
Copyright (C) 2002, 2003, 2004, 2006 Free Software Foundation, Inc.
|
||||
Contributed by Michael Hayes ([email protected]).
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
@@ -126,16 +126,16 @@ struct bitset_vtable
|
||||
void (*copy) (bitset, bitset);
|
||||
bool (*disjoint_p) (bitset, bitset);
|
||||
bool (*equal_p) (bitset, bitset);
|
||||
void (*not) (bitset, bitset);
|
||||
void (*not_) (bitset, bitset);
|
||||
bool (*subset_p) (bitset, bitset);
|
||||
|
||||
void (*and) (bitset, bitset, bitset);
|
||||
void (*and_) (bitset, bitset, bitset);
|
||||
bool (*and_cmp) (bitset, bitset, bitset);
|
||||
void (*andn) (bitset, bitset, bitset);
|
||||
bool (*andn_cmp) (bitset, bitset, bitset);
|
||||
void (*or) (bitset, bitset, bitset);
|
||||
void (*or_) (bitset, bitset, bitset);
|
||||
bool (*or_cmp) (bitset, bitset, bitset);
|
||||
void (*xor) (bitset, bitset, bitset);
|
||||
void (*xor_) (bitset, bitset, bitset);
|
||||
bool (*xor_cmp) (bitset, bitset, bitset);
|
||||
|
||||
void (*and_or) (bitset, bitset, bitset, bitset);
|
||||
@@ -218,14 +218,14 @@ if (!BITSET_COMPATIBLE_ (DST, SRC1) || !BITSET_COMPATIBLE_ (DST, SRC2) \
|
||||
#define BITSET_EQUAL_P_(DST, SRC) (SRC)->b.vtable->equal_p (DST, SRC)
|
||||
|
||||
/* DST = ~SRC. */
|
||||
#define BITSET_NOT_(DST, SRC) (SRC)->b.vtable->not (DST, SRC)
|
||||
#define BITSET_NOT_(DST, SRC) (SRC)->b.vtable->not_ (DST, SRC)
|
||||
|
||||
/* Return DST == DST | SRC. */
|
||||
#define BITSET_SUBSET_P_(DST, SRC) (SRC)->b.vtable->subset_p (DST, SRC)
|
||||
|
||||
|
||||
/* DST = SRC1 & SRC2. */
|
||||
#define BITSET_AND_(DST, SRC1, SRC2) (SRC1)->b.vtable->and (DST, SRC1, SRC2)
|
||||
#define BITSET_AND_(DST, SRC1, SRC2) (SRC1)->b.vtable->and_ (DST, SRC1, SRC2)
|
||||
#define BITSET_AND_CMP_(DST, SRC1, SRC2) (SRC1)->b.vtable->and_cmp (DST, SRC1, SRC2)
|
||||
|
||||
/* DST = SRC1 & ~SRC2. */
|
||||
@@ -233,11 +233,11 @@ if (!BITSET_COMPATIBLE_ (DST, SRC1) || !BITSET_COMPATIBLE_ (DST, SRC2) \
|
||||
#define BITSET_ANDN_CMP_(DST, SRC1, SRC2) (SRC1)->b.vtable->andn_cmp (DST, SRC1, SRC2)
|
||||
|
||||
/* DST = SRC1 | SRC2. */
|
||||
#define BITSET_OR_(DST, SRC1, SRC2) (SRC1)->b.vtable->or (DST, SRC1, SRC2)
|
||||
#define BITSET_OR_(DST, SRC1, SRC2) (SRC1)->b.vtable->or_ (DST, SRC1, SRC2)
|
||||
#define BITSET_OR_CMP_(DST, SRC1, SRC2) (SRC1)->b.vtable->or_cmp (DST, SRC1, SRC2)
|
||||
|
||||
/* DST = SRC1 ^ SRC2. */
|
||||
#define BITSET_XOR_(DST, SRC1, SRC2) (SRC1)->b.vtable->xor (DST, SRC1, SRC2)
|
||||
#define BITSET_XOR_(DST, SRC1, SRC2) (SRC1)->b.vtable->xor_ (DST, SRC1, SRC2)
|
||||
#define BITSET_XOR_CMP_(DST, SRC1, SRC2) (SRC1)->b.vtable->xor_cmp (DST, SRC1, SRC2)
|
||||
|
||||
|
||||
|
||||
+13
-13
@@ -1,5 +1,5 @@
|
||||
/* General bitsets.
|
||||
Copyright (C) 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
|
||||
Copyright (C) 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
|
||||
Contributed by Michael Hayes ([email protected]).
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
@@ -13,11 +13,11 @@
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
|
||||
along with this program; if not, write to the Free Software Foundation,
|
||||
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
#include <stdlib.h>
|
||||
@@ -45,6 +45,9 @@ bitset_bytes (enum bitset_type type, bitset_bindex n_bits)
|
||||
|
||||
switch (type)
|
||||
{
|
||||
default:
|
||||
abort ();
|
||||
|
||||
case BITSET_ARRAY:
|
||||
bytes = abitset_bytes (n_bits);
|
||||
break;
|
||||
@@ -60,9 +63,6 @@ bitset_bytes (enum bitset_type type, bitset_bindex n_bits)
|
||||
case BITSET_VARRAY:
|
||||
bytes = vbitset_bytes (n_bits);
|
||||
break;
|
||||
|
||||
default:
|
||||
abort ();
|
||||
}
|
||||
|
||||
return bytes;
|
||||
@@ -78,6 +78,9 @@ bitset_init (bitset bset, bitset_bindex n_bits, enum bitset_type type)
|
||||
|
||||
switch (type)
|
||||
{
|
||||
default:
|
||||
abort ();
|
||||
|
||||
case BITSET_ARRAY:
|
||||
return abitset_init (bset, n_bits);
|
||||
|
||||
@@ -89,9 +92,6 @@ bitset_init (bitset bset, bitset_bindex n_bits, enum bitset_type type)
|
||||
|
||||
case BITSET_VARRAY:
|
||||
return vbitset_init (bset, n_bits);
|
||||
|
||||
default:
|
||||
abort ();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -421,6 +421,9 @@ bitset_op4_cmp (bitset dst, bitset src1, bitset src2, bitset src3,
|
||||
|
||||
switch (op)
|
||||
{
|
||||
default:
|
||||
abort ();
|
||||
|
||||
case BITSET_OP_OR_AND:
|
||||
bitset_or (tmp, src1, src2);
|
||||
changed = bitset_and_cmp (dst, src3, tmp);
|
||||
@@ -435,9 +438,6 @@ bitset_op4_cmp (bitset dst, bitset src1, bitset src2, bitset src3,
|
||||
bitset_andn (tmp, src1, src2);
|
||||
changed = bitset_or_cmp (dst, src3, tmp);
|
||||
break;
|
||||
|
||||
default:
|
||||
abort ();
|
||||
}
|
||||
|
||||
bitset_free (tmp);
|
||||
|
||||
@@ -26,6 +26,10 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
#include "obstack.h"
|
||||
#include <stdio.h>
|
||||
|
||||
#if USE_UNLOCKED_IO
|
||||
# include "unlocked-io.h"
|
||||
#endif
|
||||
|
||||
/* Attributes used to select a bitset implementation. */
|
||||
enum bitset_attr {BITSET_FIXED = 1, /* Bitset size fixed. */
|
||||
BITSET_VARIABLE = 2, /* Bitset size variable. */
|
||||
|
||||
+8
-10
@@ -1,5 +1,5 @@
|
||||
/* Bitset statistics.
|
||||
Copyright (C) 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
|
||||
Copyright (C) 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
|
||||
Contributed by Michael Hayes ([email protected]).
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
@@ -13,20 +13,18 @@
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
along with this program; if not, write to the Free Software Foundation,
|
||||
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
|
||||
|
||||
/* This file is a wrapper bitset implementation for the other bitset
|
||||
implementations. It provides bitset compatibility checking and
|
||||
statistics gathering without having to instrument the bitset
|
||||
implementations. When statistics gathering is enabled, the bitset
|
||||
operations get vectored through here and we then call the appropriate
|
||||
routines.
|
||||
*/
|
||||
routines. */
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
#include "bbitset.h"
|
||||
@@ -696,6 +694,9 @@ bitset_stats_init (bitset bset, bitset_bindex n_bits, enum bitset_type type)
|
||||
we are a wrapper over. */
|
||||
switch (type)
|
||||
{
|
||||
default:
|
||||
abort ();
|
||||
|
||||
case BITSET_ARRAY:
|
||||
bytes = abitset_bytes (n_bits);
|
||||
sbset = xcalloc (1, bytes);
|
||||
@@ -719,9 +720,6 @@ bitset_stats_init (bitset bset, bitset_bindex n_bits, enum bitset_type type)
|
||||
sbset = xcalloc (1, bytes);
|
||||
vbitset_init (sbset, n_bits);
|
||||
break;
|
||||
|
||||
default:
|
||||
abort ();
|
||||
}
|
||||
|
||||
bset->s.bset = sbset;
|
||||
|
||||
+13
-16
@@ -1,25 +1,22 @@
|
||||
/* Bitset vectors.
|
||||
Copyright (C) 2001, 2002, 2004 Free Software Foundation, Inc.
|
||||
Copyright (C) 2001, 2002, 2004, 2006 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of Bison.
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
Bison is free software; you can redistribute it and/or modify it under
|
||||
the terms of the GNU General Public License as published by the Free
|
||||
Software Foundation; either version 2, or (at your option) any later
|
||||
version.
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
Bison is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with Bison; see the file COPYING. If not, write to the Free
|
||||
Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
02110-1301, USA. */
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software Foundation,
|
||||
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
+13
-16
@@ -1,25 +1,22 @@
|
||||
/* Bitset vectors.
|
||||
Copyright (C) 2001, 2002, 2004, 2005 Free Software Foundation, Inc.
|
||||
Copyright (C) 2001, 2002, 2004, 2005, 2006 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GCC.
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
GCC is free software; you can redistribute it and/or modify it under
|
||||
the terms of the GNU General Public License as published by the Free
|
||||
Software Foundation; either version 2, or (at your option) any later
|
||||
version.
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
GCC is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with GCC; see the file COPYING. If not, write to the Free
|
||||
Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
02110-1301, USA. */
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software Foundation,
|
||||
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
+11
-12
@@ -1,5 +1,5 @@
|
||||
/* Functions to support expandable bitsets.
|
||||
Copyright (C) 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
|
||||
Copyright (C) 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
|
||||
Contributed by Michael Hayes ([email protected]).
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
@@ -13,12 +13,11 @@
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
along with this program; if not, write to the Free Software Foundation,
|
||||
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
#include "ebitset.h"
|
||||
@@ -210,7 +209,7 @@ ebitset_elt_alloc (void)
|
||||
#define OBSTACK_CHUNK_FREE free
|
||||
#endif
|
||||
|
||||
#if !defined(__GNUC__) || (__GNUC__ < 2)
|
||||
#if ! defined __GNUC__ || __GNUC__ < 2
|
||||
#define __alignof__(type) 0
|
||||
#endif
|
||||
|
||||
@@ -322,6 +321,9 @@ ebitset_elt_find (bitset bset, bitset_bindex bindex,
|
||||
|
||||
switch (mode)
|
||||
{
|
||||
default:
|
||||
abort ();
|
||||
|
||||
case EBITSET_FIND:
|
||||
return 0;
|
||||
|
||||
@@ -337,9 +339,6 @@ ebitset_elt_find (bitset bset, bitset_bindex bindex,
|
||||
|
||||
case EBITSET_SUBST:
|
||||
return &ebitset_zero_elts[0];
|
||||
|
||||
default:
|
||||
abort ();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1090,6 +1089,9 @@ ebitset_op3_cmp (bitset dst, bitset src1, bitset src2, enum bitset_ops op)
|
||||
dstp = EBITSET_WORDS (delt);
|
||||
switch (op)
|
||||
{
|
||||
default:
|
||||
abort ();
|
||||
|
||||
case BITSET_OP_OR:
|
||||
for (i = 0; i < EBITSET_ELT_WORDS; i++, dstp++)
|
||||
{
|
||||
@@ -1141,9 +1143,6 @@ ebitset_op3_cmp (bitset dst, bitset src1, bitset src2, enum bitset_ops op)
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
abort ();
|
||||
}
|
||||
|
||||
if (!ebitset_elt_zero_p (delt))
|
||||
|
||||
+3
-3
@@ -1,6 +1,6 @@
|
||||
/* get-errno.h - get and set errno.
|
||||
/* get-errno.c - get and set errno.
|
||||
|
||||
Copyright (C) 2002 Free Software Foundation, Inc.
|
||||
Copyright (C) 2002, 2006 Free Software Foundation, Inc.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
@@ -18,7 +18,7 @@
|
||||
|
||||
/* Written by Paul Eggert. */
|
||||
|
||||
#if HAVE_CONFIG_H
|
||||
#ifdef HAVE_CONFIG_H
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
|
||||
+11
-12
@@ -1,5 +1,5 @@
|
||||
/* Functions to support link list bitsets.
|
||||
Copyright (C) 2002, 2003, 2004 Free Software Foundation, Inc.
|
||||
Copyright (C) 2002, 2003, 2004, 2006 Free Software Foundation, Inc.
|
||||
Contributed by Michael Hayes (m.hayes@elec.canterbury.ac.nz).
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
@@ -13,12 +13,11 @@
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
along with this program; if not, write to the Free Software Foundation,
|
||||
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
#include "lbitset.h"
|
||||
@@ -121,7 +120,7 @@ lbitset_elt_alloc (void)
|
||||
#define OBSTACK_CHUNK_FREE free
|
||||
#endif
|
||||
|
||||
#if !defined(__GNUC__) || (__GNUC__ < 2)
|
||||
#if ! defined __GNUC__ || __GNUC__ < 2
|
||||
#define __alignof__(type) 0
|
||||
#endif
|
||||
|
||||
@@ -363,6 +362,9 @@ lbitset_elt_find (bitset bset, bitset_windex windex,
|
||||
|
||||
switch (mode)
|
||||
{
|
||||
default:
|
||||
abort ();
|
||||
|
||||
case LBITSET_FIND:
|
||||
return 0;
|
||||
|
||||
@@ -376,9 +378,6 @@ lbitset_elt_find (bitset bset, bitset_windex windex,
|
||||
|
||||
case LBITSET_SUBST:
|
||||
return &lbitset_zero_elts[0];
|
||||
|
||||
default:
|
||||
abort ();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1117,6 +1116,9 @@ lbitset_op3_cmp (bitset dst, bitset src1, bitset src2, enum bitset_ops op)
|
||||
dstp = dtmp->words;
|
||||
switch (op)
|
||||
{
|
||||
default:
|
||||
abort ();
|
||||
|
||||
case BITSET_OP_OR:
|
||||
for (i = 0; i < LBITSET_ELT_WORDS; i++, dstp++)
|
||||
{
|
||||
@@ -1168,9 +1170,6 @@ lbitset_op3_cmp (bitset dst, bitset src1, bitset src2, enum bitset_ops op)
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
abort ();
|
||||
}
|
||||
|
||||
if (!lbitset_elt_zero_p (dtmp))
|
||||
|
||||
+27
-14
@@ -1,6 +1,6 @@
|
||||
/* Subprocesses with pipes.
|
||||
|
||||
Copyright (C) 2002, 2004, 2005 Free Software Foundation, Inc.
|
||||
Copyright (C) 2002, 2004, 2005, 2006 Free Software Foundation, Inc.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
@@ -19,7 +19,7 @@
|
||||
/* Written by Paul Eggert <[email protected]>
|
||||
and Florian Krohm <florian@edamail.fishkill.ibm.com>. */
|
||||
|
||||
#if HAVE_CONFIG_H
|
||||
#ifdef HAVE_CONFIG_H
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
@@ -71,6 +71,18 @@
|
||||
#include "gettext.h"
|
||||
#define _(Msgid) gettext (Msgid)
|
||||
|
||||
#ifndef __attribute__
|
||||
/* This feature is available in gcc versions 2.5 and later. */
|
||||
# if ! defined __GNUC__ || __GNUC__ < 2 || \
|
||||
(__GNUC__ == 2 && __GNUC_MINOR__ < 5) || __STRICT_ANSI__
|
||||
# define __attribute__(Spec) /* empty */
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#ifndef ATTRIBUTE_UNUSED
|
||||
# define ATTRIBUTE_UNUSED __attribute__ ((__unused__))
|
||||
#endif
|
||||
|
||||
|
||||
/* Initialize this module. */
|
||||
|
||||
@@ -101,19 +113,15 @@ create_subpipe (char const * const *argv, int fd[2])
|
||||
int child_fd[2];
|
||||
pid_t pid;
|
||||
|
||||
if (pipe (child_fd) != 0
|
||||
|| (child_fd[0] = fd_safer (child_fd[0])) < 0
|
||||
|| (fd[0] = fd_safer (child_fd[1])) < 0
|
||||
|| pipe (pipe_fd) != 0
|
||||
|| (fd[1] = fd_safer (pipe_fd[0])) < 0
|
||||
|| (child_fd[1] = fd_safer (pipe_fd[1])) < 0)
|
||||
error (EXIT_FAILURE, errno,
|
||||
"pipe");
|
||||
if (pipe_safer (child_fd) != 0 || pipe_safer (pipe_fd) != 0)
|
||||
error (EXIT_FAILURE, errno, "pipe");
|
||||
fd[0] = child_fd[1];
|
||||
fd[1] = pipe_fd[0];
|
||||
child_fd[1] = pipe_fd[1];
|
||||
|
||||
pid = vfork ();
|
||||
if (pid < 0)
|
||||
error (EXIT_FAILURE, errno,
|
||||
"fork");
|
||||
error (EXIT_FAILURE, errno, "fork");
|
||||
|
||||
if (! pid)
|
||||
{
|
||||
@@ -148,8 +156,7 @@ reap_subpipe (pid_t pid, char const *program)
|
||||
#if HAVE_WAITPID || defined waitpid
|
||||
int wstatus;
|
||||
if (waitpid (pid, &wstatus, 0) < 0)
|
||||
error (EXIT_FAILURE, errno,
|
||||
"waitpid");
|
||||
error (EXIT_FAILURE, errno, "waitpid");
|
||||
else
|
||||
{
|
||||
int status = WIFEXITED (wstatus) ? WEXITSTATUS (wstatus) : -1;
|
||||
@@ -166,3 +173,9 @@ reap_subpipe (pid_t pid, char const *program)
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
end_of_output_subpipe (pid_t pid ATTRIBUTE_UNUSED,
|
||||
int fd[2] ATTRIBUTE_UNUSED)
|
||||
{
|
||||
}
|
||||
|
||||
+12
-14
@@ -1,22 +1,19 @@
|
||||
/* Subprocesses with pipes.
|
||||
Copyright (C) 2002, 2004 Free Software Foundation, Inc.
|
||||
Copyright (C) 2002, 2004, 2005 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of Bison, the GNU Compiler Compiler.
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
Bison is free software; you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2, or (at your option)
|
||||
any later version.
|
||||
|
||||
Bison is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
|
||||
License for more details.
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with Bison; see the file COPYING. If not, write to the Free
|
||||
Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
02110-1301, USA. */
|
||||
along with this program; if not, write to the Free Software Foundation,
|
||||
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
|
||||
|
||||
/* Written by Paul Eggert <[email protected]>
|
||||
and Florian Krohm <florian@edamail.fishkill.ibm.com>. */
|
||||
@@ -27,4 +24,5 @@
|
||||
|
||||
void init_subpipe (void);
|
||||
pid_t create_subpipe (char const * const *, int[2]);
|
||||
void end_of_output_subpipe (pid_t, int[2]);
|
||||
void reap_subpipe (pid_t, char const *);
|
||||
|
||||
+17
-17
@@ -1,27 +1,27 @@
|
||||
/* Timing variables for measuring compiler performance.
|
||||
Copyright (C) 2000, 2002, 2004 Free Software Foundation, Inc.
|
||||
Copyright (C) 2000, 2002, 2004, 2005, 2006 Free Software Foundation, Inc.
|
||||
Contributed by Alex Samuel <samuel@codesourcery.com>
|
||||
|
||||
This file is part of Bison, the GNU Compiler Compiler.
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
Bison is free software; you can redistribute it and/or modify it under
|
||||
the terms of the GNU General Public License as published by the Free
|
||||
Software Foundation; either version 2, or (at your option) any later
|
||||
version.
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
Bison is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software Foundation,
|
||||
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with Bison; see the file COPYING. If not, write to the Free
|
||||
Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
02110-1301, USA. */
|
||||
#ifdef HAVE_CONFIG_H
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
#if IN_GCC
|
||||
|
||||
#include "config.h"
|
||||
#include "system.h"
|
||||
#include "intl.h"
|
||||
#include "rtl.h"
|
||||
@@ -447,7 +447,7 @@ timevar_print (fp)
|
||||
FILE *fp;
|
||||
{
|
||||
/* Only print stuff if we have some sort of time information. */
|
||||
#if defined (HAVE_USER_TIME) || defined (HAVE_SYS_TIME) || defined (HAVE_WALL_TIME)
|
||||
#if defined HAVE_USER_TIME || defined HAVE_SYS_TIME || defined HAVE_WALL_TIME
|
||||
unsigned int /* timevar_id_t */ id;
|
||||
struct timevar_time_def *total = &timevars[TV_TOTAL].elapsed;
|
||||
struct timevar_time_def now;
|
||||
@@ -488,7 +488,7 @@ timevar_print (fp)
|
||||
continue;
|
||||
|
||||
/* Don't print timing variables if we're going to get a row of
|
||||
zeroes. */
|
||||
zeroes. */
|
||||
if (tv->elapsed.user < tiny
|
||||
&& tv->elapsed.sys < tiny
|
||||
&& tv->elapsed.wall < tiny)
|
||||
|
||||
+10
-13
@@ -2,22 +2,19 @@
|
||||
Copyright (C) 2000, 2002, 2004 Free Software Foundation, Inc.
|
||||
Contributed by Alex Samuel <samuel@codesourcery.com>
|
||||
|
||||
This file is part of Bison, the GNU Compiler Compiler.
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
Bison is free software; you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2, or (at your option)
|
||||
any later version.
|
||||
|
||||
Bison is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
|
||||
License for more details.
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with Bison; see the file COPYING. If not, write to the Free
|
||||
Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
02110-1301, USA. */
|
||||
along with this program; if not, write to the Free Software Foundation,
|
||||
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
|
||||
|
||||
#ifndef GCC_TIMEVAR_H
|
||||
#define GCC_TIMEVAR_H
|
||||
|
||||
+4
-5
@@ -1,5 +1,5 @@
|
||||
/* Variable array bitsets.
|
||||
Copyright (C) 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
|
||||
Copyright (C) 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
|
||||
Contributed by Michael Hayes (m.hayes@elec.canterbury.ac.nz).
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
@@ -13,12 +13,11 @@
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
along with this program; if not, write to the Free Software Foundation,
|
||||
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
#include "vbitset.h"
|
||||
|
||||
+20
-6
@@ -1,33 +1,47 @@
|
||||
*_gl.m4
|
||||
alloca.m4
|
||||
absolute-header.m4
|
||||
argmatch.m4
|
||||
dirname.m4
|
||||
dos.m4
|
||||
double-slash-root.m4
|
||||
error.m4
|
||||
exitfail.m4
|
||||
extensions.m4
|
||||
getopt.m4
|
||||
gnulib.m4
|
||||
hard-locale.m4
|
||||
hash.m4
|
||||
iconv.m4
|
||||
inttypes_h.m4
|
||||
lib-ld.m4
|
||||
lib-link.m4
|
||||
lib-prefix.m4
|
||||
longlong.m4
|
||||
mbrtowc.m4
|
||||
mbstate_t.m4
|
||||
mbswidth.m4
|
||||
nls.m4
|
||||
obstack.m4
|
||||
onceonly.m4
|
||||
po.m4
|
||||
progtest.m4
|
||||
quote.m4
|
||||
quotearg.m4
|
||||
stdbool.m4
|
||||
stdint.m4
|
||||
stdint_h.m4
|
||||
stdio-safer.m4
|
||||
stpcpy.m4
|
||||
strdup.m4
|
||||
strerror_r.m4
|
||||
strerror.m4
|
||||
strndup.m4
|
||||
strnlen.m4
|
||||
strtol.m4
|
||||
strtoul.m4
|
||||
strverscmp.m4
|
||||
uintmax_t.m4
|
||||
ulonglong.m4
|
||||
unistd-safer.m4
|
||||
unistd_h.m4
|
||||
unlocked-io.m4
|
||||
warning.m4
|
||||
wchar_t.m4
|
||||
wcwidth.m4
|
||||
xalloc.m4
|
||||
xstrndup.m4
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# Finding valid warning flags for the C Compiler. -*-Autoconf-*-
|
||||
#
|
||||
# Copyright (C) 2001, 2002 Free Software Foundation, Inc.
|
||||
# Sanity test a C compiler.
|
||||
|
||||
# Copyright (C) 2006 Free Software Foundation, Inc.
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
@@ -17,16 +17,13 @@
|
||||
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
# 02110-1301 USA
|
||||
|
||||
# serial 1
|
||||
# Written by Paul Eggert.
|
||||
|
||||
AC_DEFUN([BISON_WARNING],
|
||||
[AC_MSG_CHECKING(whether compiler accepts $1)
|
||||
AC_SUBST(WARNING_CFLAGS)
|
||||
ac_save_CFLAGS="$CFLAGS"
|
||||
CFLAGS="$CFLAGS $1"
|
||||
AC_TRY_COMPILE(,
|
||||
[int x;],
|
||||
WARNING_CFLAGS="$WARNING_CFLAGS $1"
|
||||
AC_MSG_RESULT(yes),
|
||||
AC_MSG_RESULT(no))
|
||||
CFLAGS="$ac_save_CFLAGS"])
|
||||
AC_DEFUN([BISON_TEST_FOR_WORKING_C_COMPILER], [
|
||||
AC_COMPILE_IFELSE(
|
||||
[AC_LANG_PROGRAM(
|
||||
[[#include <limits.h>
|
||||
int test_array[CHAR_BIT];]])],
|
||||
[],
|
||||
[AC_MSG_FAILURE([cannot compile a simple C program])])
|
||||
])
|
||||
@@ -1,7 +1,7 @@
|
||||
# -*- Autoconf -*-
|
||||
# Sanity-test a C++ compiler.
|
||||
#
|
||||
# Copyright (C) 2004 Free Software Foundation, Inc.
|
||||
# Copyright (C) 2004, 2006 Free Software Foundation, Inc.
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
@@ -18,22 +18,36 @@
|
||||
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
# 02110-1301 USA
|
||||
|
||||
# Written by Paul Eggert <[email protected]>.
|
||||
# Written by Paul Eggert.
|
||||
|
||||
AC_DEFUN([BISON_TEST_FOR_WORKING_CXX_COMPILER],
|
||||
[
|
||||
AC_CACHE_CHECK([whether $CXX builds executables that work],
|
||||
bison_cv_cxx_works,
|
||||
[AC_LANG_PUSH([C++])
|
||||
AC_RUN_IFELSE(
|
||||
bison_cv_cxx_works=no
|
||||
AC_COMPILE_IFELSE(
|
||||
[AC_LANG_PROGRAM(
|
||||
[#include <iostream>
|
||||
[#include <cstdlib>
|
||||
#include <iostream>
|
||||
#include <map>
|
||||
#include <string>
|
||||
using namespace std;],
|
||||
[std::cerr << "";
|
||||
cout << "";])],
|
||||
[bison_cv_cxx_works=yes],
|
||||
[bison_cv_cxx_works=no],
|
||||
[bison_cv_cxx_works=cross])
|
||||
cout << "";
|
||||
typedef std::pair<unsigned int, int> uipair;
|
||||
std::map<unsigned int, int> m;
|
||||
std::map<unsigned int, int>::iterator i;
|
||||
m.insert (uipair (4, -4));
|
||||
for (i = m.begin (); i != m.end (); ++i)
|
||||
if (i->first != 4)
|
||||
return 1;])],
|
||||
[AS_IF([AC_TRY_COMMAND([$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_objext $LIBS >&AS_MESSAGE_LOG_FD])],
|
||||
[AS_IF([test "$cross_compiling" = yes],
|
||||
[bison_cv_cxx_works=cross],
|
||||
[AS_IF([AC_TRY_COMMAND(./conftest$ac_exeext)],
|
||||
[bison_cv_cxx_works=yes])])])
|
||||
rm -f conftest$ac_exeext])
|
||||
AC_LANG_POP([C++])])
|
||||
|
||||
case $bison_cv_cxx_works in
|
||||
@@ -44,4 +58,5 @@ AC_DEFUN([BISON_TEST_FOR_WORKING_CXX_COMPILER],
|
||||
esac
|
||||
|
||||
AC_SUBST([BISON_CXX_WORKS])
|
||||
AM_CONDITIONAL(BISON_CXX_WORKS, test $bison_cv_cxx_works = yes)
|
||||
])
|
||||
|
||||
@@ -5,6 +5,8 @@
|
||||
Makefile
|
||||
Makefile.in
|
||||
bison
|
||||
revision.c
|
||||
scan-code.c
|
||||
scan-gram.c
|
||||
scan-skel.c
|
||||
yacc
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/* Generate the nondeterministic finite state machine for Bison.
|
||||
|
||||
Copyright (C) 1984, 1986, 1989, 2000, 2001, 2002, 2004 Free
|
||||
Copyright (C) 1984, 1986, 1989, 2000, 2001, 2002, 2004, 2005 Free
|
||||
Software Foundation, Inc.
|
||||
|
||||
This file is part of Bison, the GNU Compiler Compiler.
|
||||
@@ -24,6 +24,7 @@
|
||||
/* See comments in state.h for the data structures that represent it.
|
||||
The entry point is generate_states. */
|
||||
|
||||
#include <config.h>
|
||||
#include "system.h"
|
||||
|
||||
#include <bitset.h>
|
||||
@@ -66,11 +67,6 @@ state_list_append (symbol_number sym, size_t core_size, item_number *core)
|
||||
fprintf (stderr, "state_list_append (state = %d, symbol = %d (%s))\n",
|
||||
nstates, sym, symbols[sym]->tag);
|
||||
|
||||
/* If this is the endtoken, and this is not the initial state, then
|
||||
this is the final state. */
|
||||
if (sym == 0 && first_state)
|
||||
final_state = s;
|
||||
|
||||
node->next = NULL;
|
||||
node->state = s;
|
||||
|
||||
@@ -213,20 +209,20 @@ new_itemsets (state *s)
|
||||
static state *
|
||||
get_state (symbol_number sym, size_t core_size, item_number *core)
|
||||
{
|
||||
state *sp;
|
||||
state *s;
|
||||
|
||||
if (trace_flag & trace_automaton)
|
||||
fprintf (stderr, "Entering get_state, symbol = %d (%s)\n",
|
||||
sym, symbols[sym]->tag);
|
||||
|
||||
sp = state_hash_lookup (core_size, core);
|
||||
if (!sp)
|
||||
sp = state_list_append (sym, core_size, core);
|
||||
s = state_hash_lookup (core_size, core);
|
||||
if (!s)
|
||||
s = state_list_append (sym, core_size, core);
|
||||
|
||||
if (trace_flag & trace_automaton)
|
||||
fprintf (stderr, "Exiting get_state => %d\n", sp->number);
|
||||
fprintf (stderr, "Exiting get_state => %d\n", s->number);
|
||||
|
||||
return sp;
|
||||
return s;
|
||||
}
|
||||
|
||||
/*---------------------------------------------------------------.
|
||||
@@ -278,9 +274,18 @@ save_reductions (state *s)
|
||||
/* Find and count the active items that represent ends of rules. */
|
||||
for (i = 0; i < nritemset; ++i)
|
||||
{
|
||||
int item = ritem[itemset[i]];
|
||||
if (item < 0)
|
||||
redset[count++] = &rules[item_number_as_rule_number (item)];
|
||||
item_number item = ritem[itemset[i]];
|
||||
if (item_number_is_rule_number (item))
|
||||
{
|
||||
rule_number r = item_number_as_rule_number (item);
|
||||
redset[count++] = &rules[r];
|
||||
if (r == 0)
|
||||
{
|
||||
/* This is "reduce 0", i.e., accept. */
|
||||
assert (!final_state);
|
||||
final_state = s;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Make a reductions structure and copy the data into it. */
|
||||
@@ -338,9 +343,8 @@ generate_states (void)
|
||||
item of this initial rule. */
|
||||
state_list_append (0, 1, &initial_core);
|
||||
|
||||
list = first_state;
|
||||
|
||||
while (list)
|
||||
/* States are queued when they are created; process them all. */
|
||||
for (list = first_state; list; list = list->next)
|
||||
{
|
||||
state *s = list->state;
|
||||
if (trace_flag & trace_automaton)
|
||||
@@ -362,10 +366,6 @@ generate_states (void)
|
||||
/* Create the shifts structures for the shifts to those states,
|
||||
now that the state numbers transitioning to are known. */
|
||||
state_transitions_set (s, nshifts, shiftset);
|
||||
|
||||
/* states are queued when they are created; process them all.
|
||||
*/
|
||||
list = list->next;
|
||||
}
|
||||
|
||||
/* discard various storage */
|
||||
|
||||
+25
-5
@@ -1,4 +1,4 @@
|
||||
## Copyright (C) 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
|
||||
## Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
|
||||
|
||||
## This program is free software; you can redistribute it and/or modify
|
||||
## it under the terms of the GNU General Public License as published by
|
||||
@@ -39,6 +39,7 @@ bison_SOURCES = \
|
||||
conflicts.c conflicts.h \
|
||||
derives.c derives.h \
|
||||
files.c files.h \
|
||||
flex-scanner.h \
|
||||
getargs.c getargs.h \
|
||||
gram.c gram.h \
|
||||
lalr.h lalr.c \
|
||||
@@ -52,9 +53,11 @@ bison_SOURCES = \
|
||||
print_graph.c print_graph.h \
|
||||
reader.c reader.h \
|
||||
reduce.c reduce.h \
|
||||
revision.c revision.h \
|
||||
relation.c relation.h \
|
||||
scan-gram.l \
|
||||
scan-skel.h scan-skel.l \
|
||||
scan-code.h scan-code-c.c \
|
||||
scan-gram.h scan-gram-c.c \
|
||||
scan-skel.h scan-skel-c.c \
|
||||
state.c state.h \
|
||||
symlist.c symlist.h \
|
||||
symtab.c symtab.h \
|
||||
@@ -64,18 +67,35 @@ bison_SOURCES = \
|
||||
vcg.c vcg.h \
|
||||
vcg_defaults.h
|
||||
|
||||
BUILT_SOURCES = scan-skel.c scan-gram.c parse-gram.c parse-gram.h
|
||||
EXTRA_bison_SOURCES = scan-code.l scan-skel.l scan-gram.l
|
||||
|
||||
BUILT_SOURCES = \
|
||||
parse-gram.c parse-gram.h \
|
||||
revision.c \
|
||||
scan-code.c \
|
||||
scan-skel.c \
|
||||
scan-gram.c
|
||||
|
||||
MOSTLYCLEANFILES = yacc
|
||||
|
||||
yacc:
|
||||
echo '#! /bin/sh' >$@
|
||||
echo 'exec $(bindir)/bison -y "$$@"' >>$@
|
||||
echo "exec '$(bindir)/bison' -y \"$$@\"" >>$@
|
||||
chmod a+x $@
|
||||
|
||||
echo:
|
||||
echo $(bison_SOURCES) $(noinst_HEADERS)
|
||||
|
||||
revision.c: $(top_srcdir)/configure $(top_srcdir)/ChangeLog
|
||||
case "$(VERSION)" in \
|
||||
*+*) sed -n \
|
||||
's/^\$$\(Id.*\)\$$$$/const char *revision = "\1\\n";/p' \
|
||||
$(top_srcdir)/ChangeLog \
|
||||
;; \
|
||||
*) echo 'const char *revision = "";' \
|
||||
;; \
|
||||
esac >$@
|
||||
|
||||
# The following rule is not designed to be portable,
|
||||
# and relies on tools that not everyone has.
|
||||
|
||||
|
||||
+5
-2
@@ -1,5 +1,5 @@
|
||||
/* Associativity information.
|
||||
Copyright (C) 2002 Free Software Foundation, Inc.
|
||||
Copyright (C) 2002, 2005, 2006 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of Bison, the GNU Compiler Compiler.
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
Boston, MA 02110-1301, USA. */
|
||||
|
||||
#include <config.h>
|
||||
#include "system.h"
|
||||
|
||||
#include "assoc.h"
|
||||
@@ -28,6 +29,9 @@ assoc_to_string (assoc a)
|
||||
{
|
||||
switch (a)
|
||||
{
|
||||
default:
|
||||
abort ();
|
||||
|
||||
case undef_assoc:
|
||||
return "undefined associativity";
|
||||
|
||||
@@ -40,5 +44,4 @@ assoc_to_string (assoc a)
|
||||
case non_assoc:
|
||||
return "%nonassoc";
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
+2
-2
@@ -1,5 +1,5 @@
|
||||
/* Associativity information.
|
||||
Copyright (C) 2002 Free Software Foundation, Inc.
|
||||
Copyright (C) 2002, 2006 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of Bison, the GNU Compiler Compiler.
|
||||
|
||||
@@ -30,6 +30,6 @@ typedef enum
|
||||
non_assoc
|
||||
} assoc;
|
||||
|
||||
char const *assoc_to_string (assoc);
|
||||
char const *assoc_to_string (assoc a);
|
||||
|
||||
#endif /* !ASSOC_H_ */
|
||||
|
||||
+3
-2
@@ -1,7 +1,7 @@
|
||||
/* Closures for Bison
|
||||
|
||||
Copyright (C) 1984, 1989, 2000, 2001, 2002, 2004 Free Software
|
||||
Foundation, Inc.
|
||||
Copyright (C) 1984, 1989, 2000, 2001, 2002, 2004, 2005 Free
|
||||
Software Foundation, Inc.
|
||||
|
||||
This file is part of Bison, the GNU Compiler Compiler.
|
||||
|
||||
@@ -20,6 +20,7 @@
|
||||
Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
02110-1301, USA. */
|
||||
|
||||
#include <config.h>
|
||||
#include "system.h"
|
||||
|
||||
#include <bitset.h>
|
||||
|
||||
+53
-68
@@ -1,5 +1,7 @@
|
||||
/* Declaration for error-reporting function for Bison.
|
||||
Copyright (C) 2000, 2001, 2002, 2004 Free Software Foundation, Inc.
|
||||
|
||||
Copyright (C) 2000, 2001, 2002, 2004, 2005, 2006
|
||||
Free Software Foundation, Inc.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by the
|
||||
@@ -19,6 +21,7 @@
|
||||
/* Based on error.c and error.h,
|
||||
written by David MacKenzie <djm@gnu.ai.mit.edu>. */
|
||||
|
||||
#include <config.h>
|
||||
#include "system.h"
|
||||
|
||||
#include <stdarg.h>
|
||||
@@ -30,13 +33,48 @@
|
||||
name of the executing program. */
|
||||
extern char *program_name;
|
||||
|
||||
/* This variable is set each time `warn' is called. */
|
||||
bool warning_issued;
|
||||
|
||||
/* This variable is set each time `complain' is called. */
|
||||
bool complaint_issued;
|
||||
|
||||
|
||||
|
||||
/** Report an error message.
|
||||
*
|
||||
* \param loc the location, defaulting to the current file,
|
||||
* or the program name.
|
||||
* \param prefix put before the message (e.g., "warning").
|
||||
* \param message the error message, a printf format string.
|
||||
* \param args the arguments of the format string.
|
||||
*/
|
||||
static
|
||||
void
|
||||
error_message (location *loc,
|
||||
const char *prefix,
|
||||
const char *message, va_list args)
|
||||
{
|
||||
if (loc)
|
||||
location_print (stderr, *loc);
|
||||
else
|
||||
fputs (current_file ? current_file : program_name, stderr);
|
||||
fputs (": ", stderr);
|
||||
|
||||
if (prefix)
|
||||
fprintf (stderr, "%s: ", prefix);
|
||||
|
||||
vfprintf (stderr, message, args);
|
||||
va_end (args);
|
||||
putc ('\n', stderr);
|
||||
fflush (stderr);
|
||||
}
|
||||
|
||||
/** Wrap error_message() with varargs handling. */
|
||||
#define ERROR_MESSAGE(Loc, Prefix, Message) \
|
||||
{ \
|
||||
va_list args; \
|
||||
va_start (args, Message); \
|
||||
error_message (Loc, Prefix, Message, args); \
|
||||
}
|
||||
|
||||
|
||||
/*--------------------------------.
|
||||
| Report a warning, and proceed. |
|
||||
`--------------------------------*/
|
||||
@@ -44,35 +82,16 @@ bool complaint_issued;
|
||||
void
|
||||
warn_at (location loc, const char *message, ...)
|
||||
{
|
||||
va_list args;
|
||||
|
||||
location_print (stderr, loc);
|
||||
fputs (": ", stderr);
|
||||
fputs (_("warning: "), stderr);
|
||||
|
||||
va_start (args, message);
|
||||
vfprintf (stderr, message, args);
|
||||
va_end (args);
|
||||
|
||||
warning_issued = true;
|
||||
putc ('\n', stderr);
|
||||
ERROR_MESSAGE (&loc, _("warning"), message);
|
||||
}
|
||||
|
||||
void
|
||||
warn (const char *message, ...)
|
||||
{
|
||||
va_list args;
|
||||
|
||||
fprintf (stderr, "%s: %s", current_file ? current_file : program_name, _("warning: "));
|
||||
|
||||
va_start (args, message);
|
||||
vfprintf (stderr, message, args);
|
||||
va_end (args);
|
||||
|
||||
warning_issued = true;
|
||||
putc ('\n', stderr);
|
||||
ERROR_MESSAGE (NULL, _("warning"), message);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*-----------------------------------------------------------.
|
||||
| An error has occurred, but we can proceed, and die later. |
|
||||
`-----------------------------------------------------------*/
|
||||
@@ -80,34 +99,18 @@ warn (const char *message, ...)
|
||||
void
|
||||
complain_at (location loc, const char *message, ...)
|
||||
{
|
||||
va_list args;
|
||||
|
||||
location_print (stderr, loc);
|
||||
fputs (": ", stderr);
|
||||
|
||||
va_start (args, message);
|
||||
vfprintf (stderr, message, args);
|
||||
va_end (args);
|
||||
|
||||
ERROR_MESSAGE (&loc, NULL, message);
|
||||
complaint_issued = true;
|
||||
putc ('\n', stderr);
|
||||
}
|
||||
|
||||
void
|
||||
complain (const char *message, ...)
|
||||
{
|
||||
va_list args;
|
||||
|
||||
fprintf (stderr, "%s: ", current_file ? current_file : program_name);
|
||||
|
||||
va_start (args, message);
|
||||
vfprintf (stderr, message, args);
|
||||
va_end (args);
|
||||
|
||||
ERROR_MESSAGE (NULL, NULL, message);
|
||||
complaint_issued = true;
|
||||
putc ('\n', stderr);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*-------------------------------------------------.
|
||||
| A severe error has occurred, we cannot proceed. |
|
||||
`-------------------------------------------------*/
|
||||
@@ -115,31 +118,13 @@ complain (const char *message, ...)
|
||||
void
|
||||
fatal_at (location loc, const char *message, ...)
|
||||
{
|
||||
va_list args;
|
||||
|
||||
location_print (stderr, loc);
|
||||
fputs (": ", stderr);
|
||||
fputs (_("fatal error: "), stderr);
|
||||
|
||||
va_start (args, message);
|
||||
vfprintf (stderr, message, args);
|
||||
va_end (args);
|
||||
putc ('\n', stderr);
|
||||
ERROR_MESSAGE (&loc, _("fatal error"), message);
|
||||
exit (EXIT_FAILURE);
|
||||
}
|
||||
|
||||
void
|
||||
fatal (const char *message, ...)
|
||||
{
|
||||
va_list args;
|
||||
|
||||
fprintf (stderr, "%s: ", current_file ? current_file : program_name);
|
||||
|
||||
fputs (_("fatal error: "), stderr);
|
||||
|
||||
va_start (args, message);
|
||||
vfprintf (stderr, message, args);
|
||||
va_end (args);
|
||||
putc ('\n', stderr);
|
||||
ERROR_MESSAGE (NULL, _("fatal error"), message);
|
||||
exit (EXIT_FAILURE);
|
||||
}
|
||||
|
||||
+5
-8
@@ -1,5 +1,5 @@
|
||||
/* Declaration for error-reporting function for Bison.
|
||||
Copyright (C) 2000, 2001, 2002 Free Software Foundation, Inc.
|
||||
Copyright (C) 2000, 2001, 2002, 2006 Free Software Foundation, Inc.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by the
|
||||
@@ -25,7 +25,7 @@
|
||||
extern "C" {
|
||||
# endif
|
||||
|
||||
/* Informative messages, but we proceed. */
|
||||
/** Informative messages, but we proceed. */
|
||||
|
||||
void warn (char const *format, ...)
|
||||
__attribute__ ((__format__ (__printf__, 1, 2)));
|
||||
@@ -33,7 +33,7 @@ void warn (char const *format, ...)
|
||||
void warn_at (location loc, char const *format, ...)
|
||||
__attribute__ ((__format__ (__printf__, 2, 3)));
|
||||
|
||||
/* Something bad happened, but let's continue and die later. */
|
||||
/** An error, but we continue and die later. */
|
||||
|
||||
void complain (char const *format, ...)
|
||||
__attribute__ ((__format__ (__printf__, 1, 2)));
|
||||
@@ -41,7 +41,7 @@ void complain (char const *format, ...)
|
||||
void complain_at (location loc, char const *format, ...)
|
||||
__attribute__ ((__format__ (__printf__, 2, 3)));
|
||||
|
||||
/* Something bad happened, and let's die now. */
|
||||
/** A fatal error, causing immediate exit. */
|
||||
|
||||
void fatal (char const *format, ...)
|
||||
__attribute__ ((__noreturn__, __format__ (__printf__, 1, 2)));
|
||||
@@ -49,10 +49,7 @@ void fatal (char const *format, ...)
|
||||
void fatal_at (location loc, char const *format, ...)
|
||||
__attribute__ ((__noreturn__, __format__ (__printf__, 2, 3)));
|
||||
|
||||
/* This variable is set each time `warn' is called. */
|
||||
extern bool warning_issued;
|
||||
|
||||
/* This variable is set each time `complain' is called. */
|
||||
/** Whether an error was reported. */
|
||||
extern bool complaint_issued;
|
||||
|
||||
# ifdef __cplusplus
|
||||
|
||||
+59
-53
@@ -1,6 +1,6 @@
|
||||
/* Find and resolve or report look-ahead conflicts for bison,
|
||||
/* Find and resolve or report lookahead conflicts for bison,
|
||||
|
||||
Copyright (C) 1984, 1989, 1992, 2000, 2001, 2002, 2003, 2004
|
||||
Copyright (C) 1984, 1989, 1992, 2000, 2001, 2002, 2003, 2004, 2005, 2006
|
||||
Free Software Foundation, Inc.
|
||||
|
||||
This file is part of Bison, the GNU Compiler Compiler.
|
||||
@@ -20,6 +20,7 @@
|
||||
Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
02110-1301, USA. */
|
||||
|
||||
#include <config.h>
|
||||
#include "system.h"
|
||||
|
||||
#include <bitset.h>
|
||||
@@ -39,10 +40,10 @@
|
||||
int expected_sr_conflicts = -1;
|
||||
int expected_rr_conflicts = -1;
|
||||
static char *conflicts;
|
||||
struct obstack solved_conflicts_obstack;
|
||||
static struct obstack solved_conflicts_obstack;
|
||||
|
||||
static bitset shift_set;
|
||||
static bitset look_ahead_set;
|
||||
static bitset lookahead_set;
|
||||
|
||||
|
||||
|
||||
@@ -146,7 +147,7 @@ flush_shift (state *s, int token)
|
||||
transitions *trans = s->transitions;
|
||||
int i;
|
||||
|
||||
bitset_reset (look_ahead_set, token);
|
||||
bitset_reset (lookahead_set, token);
|
||||
for (i = 0; i < trans->num; i++)
|
||||
if (!TRANSITION_IS_DISABLED (trans, i)
|
||||
&& TRANSITION_SYMBOL (trans, i) == token)
|
||||
@@ -156,14 +157,14 @@ flush_shift (state *s, int token)
|
||||
|
||||
/*--------------------------------------------------------------------.
|
||||
| Turn off the reduce recorded for the specified token for the |
|
||||
| specified look-ahead. Used when we resolve a shift-reduce conflict |
|
||||
| specified lookahead. Used when we resolve a shift-reduce conflict |
|
||||
| in favor of the shift. |
|
||||
`--------------------------------------------------------------------*/
|
||||
|
||||
static void
|
||||
flush_reduce (bitset look_ahead_tokens, int token)
|
||||
flush_reduce (bitset lookahead_tokens, int token)
|
||||
{
|
||||
bitset_reset (look_ahead_tokens, token);
|
||||
bitset_reset (lookahead_tokens, token);
|
||||
}
|
||||
|
||||
|
||||
@@ -173,7 +174,7 @@ flush_reduce (bitset look_ahead_tokens, int token)
|
||||
| rule has a precedence. A conflict is resolved by modifying the |
|
||||
| shift or reduce tables so that there is no longer a conflict. |
|
||||
| |
|
||||
| RULENO is the number of the look-ahead bitset to consider. |
|
||||
| RULENO is the number of the lookahead bitset to consider. |
|
||||
| |
|
||||
| ERRORS can be used to store discovered explicit errors. |
|
||||
`------------------------------------------------------------------*/
|
||||
@@ -186,12 +187,12 @@ resolve_sr_conflict (state *s, int ruleno, symbol **errors)
|
||||
/* Find the rule to reduce by to get precedence of reduction. */
|
||||
rule *redrule = reds->rules[ruleno];
|
||||
int redprec = redrule->prec->prec;
|
||||
bitset look_ahead_tokens = reds->look_ahead_tokens[ruleno];
|
||||
bitset lookahead_tokens = reds->lookahead_tokens[ruleno];
|
||||
int nerrs = 0;
|
||||
|
||||
for (i = 0; i < ntokens; i++)
|
||||
if (bitset_test (look_ahead_tokens, i)
|
||||
&& bitset_test (look_ahead_set, i)
|
||||
if (bitset_test (lookahead_tokens, i)
|
||||
&& bitset_test (lookahead_set, i)
|
||||
&& symbols[i]->prec)
|
||||
{
|
||||
/* Shift-reduce conflict occurs for token number i
|
||||
@@ -205,7 +206,7 @@ resolve_sr_conflict (state *s, int ruleno, symbol **errors)
|
||||
else if (symbols[i]->prec > redprec)
|
||||
{
|
||||
log_resolution (redrule, i, shift_resolution);
|
||||
flush_reduce (look_ahead_tokens, i);
|
||||
flush_reduce (lookahead_tokens, i);
|
||||
}
|
||||
else
|
||||
/* Matching precedence levels.
|
||||
@@ -215,9 +216,12 @@ resolve_sr_conflict (state *s, int ruleno, symbol **errors)
|
||||
|
||||
switch (symbols[i]->assoc)
|
||||
{
|
||||
default:
|
||||
abort ();
|
||||
|
||||
case right_assoc:
|
||||
log_resolution (redrule, i, right_resolution);
|
||||
flush_reduce (look_ahead_tokens, i);
|
||||
flush_reduce (lookahead_tokens, i);
|
||||
break;
|
||||
|
||||
case left_assoc:
|
||||
@@ -228,13 +232,10 @@ resolve_sr_conflict (state *s, int ruleno, symbol **errors)
|
||||
case non_assoc:
|
||||
log_resolution (redrule, i, nonassoc_resolution);
|
||||
flush_shift (s, i);
|
||||
flush_reduce (look_ahead_tokens, i);
|
||||
flush_reduce (lookahead_tokens, i);
|
||||
/* Record an explicit error for this token. */
|
||||
errors[nerrs++] = symbols[i];
|
||||
break;
|
||||
|
||||
case undef_assoc:
|
||||
abort ();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -257,7 +258,7 @@ resolve_sr_conflict (state *s, int ruleno, symbol **errors)
|
||||
| Solve the S/R conflicts of state S using the |
|
||||
| precedence/associativity, and flag it inconsistent if it still has |
|
||||
| conflicts. ERRORS can be used as storage to compute the list of |
|
||||
| look-ahead tokens on which S raises a syntax error (%nonassoc). |
|
||||
| lookahead tokens on which S raises a syntax error (%nonassoc). |
|
||||
`-------------------------------------------------------------------*/
|
||||
|
||||
static void
|
||||
@@ -270,27 +271,27 @@ set_conflicts (state *s, symbol **errors)
|
||||
if (s->consistent)
|
||||
return;
|
||||
|
||||
bitset_zero (look_ahead_set);
|
||||
bitset_zero (lookahead_set);
|
||||
|
||||
FOR_EACH_SHIFT (trans, i)
|
||||
bitset_set (look_ahead_set, TRANSITION_SYMBOL (trans, i));
|
||||
bitset_set (lookahead_set, TRANSITION_SYMBOL (trans, i));
|
||||
|
||||
/* Loop over all rules which require look-ahead in this state. First
|
||||
/* Loop over all rules which require lookahead in this state. First
|
||||
check for shift-reduce conflict, and try to resolve using
|
||||
precedence. */
|
||||
for (i = 0; i < reds->num; ++i)
|
||||
if (reds->rules[i]->prec && reds->rules[i]->prec->prec
|
||||
&& !bitset_disjoint_p (reds->look_ahead_tokens[i], look_ahead_set))
|
||||
&& !bitset_disjoint_p (reds->lookahead_tokens[i], lookahead_set))
|
||||
resolve_sr_conflict (s, i, errors);
|
||||
|
||||
/* Loop over all rules which require look-ahead in this state. Check
|
||||
/* Loop over all rules which require lookahead in this state. Check
|
||||
for conflicts not resolved above. */
|
||||
for (i = 0; i < reds->num; ++i)
|
||||
{
|
||||
if (!bitset_disjoint_p (reds->look_ahead_tokens[i], look_ahead_set))
|
||||
if (!bitset_disjoint_p (reds->lookahead_tokens[i], lookahead_set))
|
||||
conflicts[s->number] = 1;
|
||||
|
||||
bitset_or (look_ahead_set, look_ahead_set, reds->look_ahead_tokens[i]);
|
||||
bitset_or (lookahead_set, lookahead_set, reds->lookahead_tokens[i]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -304,12 +305,12 @@ void
|
||||
conflicts_solve (void)
|
||||
{
|
||||
state_number i;
|
||||
/* List of look-ahead tokens on which we explicitly raise a syntax error. */
|
||||
/* List of lookahead tokens on which we explicitly raise a syntax error. */
|
||||
symbol **errors = xnmalloc (ntokens + 1, sizeof *errors);
|
||||
|
||||
conflicts = xcalloc (nstates, sizeof *conflicts);
|
||||
shift_set = bitset_create (ntokens, BITSET_FIXED);
|
||||
look_ahead_set = bitset_create (ntokens, BITSET_FIXED);
|
||||
lookahead_set = bitset_create (ntokens, BITSET_FIXED);
|
||||
obstack_init (&solved_conflicts_obstack);
|
||||
|
||||
for (i = 0; i < nstates; i++)
|
||||
@@ -341,18 +342,18 @@ count_sr_conflicts (state *s)
|
||||
if (!trans)
|
||||
return 0;
|
||||
|
||||
bitset_zero (look_ahead_set);
|
||||
bitset_zero (lookahead_set);
|
||||
bitset_zero (shift_set);
|
||||
|
||||
FOR_EACH_SHIFT (trans, i)
|
||||
bitset_set (shift_set, TRANSITION_SYMBOL (trans, i));
|
||||
|
||||
for (i = 0; i < reds->num; ++i)
|
||||
bitset_or (look_ahead_set, look_ahead_set, reds->look_ahead_tokens[i]);
|
||||
bitset_or (lookahead_set, lookahead_set, reds->lookahead_tokens[i]);
|
||||
|
||||
bitset_and (look_ahead_set, look_ahead_set, shift_set);
|
||||
bitset_and (lookahead_set, lookahead_set, shift_set);
|
||||
|
||||
src_count = bitset_count (look_ahead_set);
|
||||
src_count = bitset_count (lookahead_set);
|
||||
|
||||
return src_count;
|
||||
}
|
||||
@@ -377,7 +378,7 @@ count_rr_conflicts (state *s, bool one_per_token)
|
||||
int count = 0;
|
||||
int j;
|
||||
for (j = 0; j < reds->num; ++j)
|
||||
if (bitset_test (reds->look_ahead_tokens[j], i))
|
||||
if (bitset_test (reds->lookahead_tokens[j], i))
|
||||
count++;
|
||||
|
||||
if (count >= 2)
|
||||
@@ -432,7 +433,7 @@ conflicts_output (FILE *out)
|
||||
/*--------------------------------------------------------.
|
||||
| Total the number of S/R and R/R conflicts. Unlike the |
|
||||
| code in conflicts_output, however, count EACH pair of |
|
||||
| reductions for the same state and look-ahead as one |
|
||||
| reductions for the same state and lookahead as one |
|
||||
| conflict. |
|
||||
`--------------------------------------------------------*/
|
||||
|
||||
@@ -464,11 +465,13 @@ conflicts_print (void)
|
||||
/* Is the number of SR conflicts OK? Either EXPECTED_CONFLICTS is
|
||||
not set, and then we want 0 SR, or else it is specified, in which
|
||||
case we want equality. */
|
||||
bool src_ok = false;
|
||||
bool rrc_ok = false;
|
||||
bool src_ok;
|
||||
bool rrc_ok;
|
||||
|
||||
int src_total = 0;
|
||||
int rrc_total = 0;
|
||||
int src_expected;
|
||||
int rrc_expected;
|
||||
|
||||
/* Conflicts by state. */
|
||||
{
|
||||
@@ -488,33 +491,36 @@ conflicts_print (void)
|
||||
expected_rr_conflicts = -1;
|
||||
}
|
||||
|
||||
src_ok =
|
||||
src_total == (expected_sr_conflicts == -1 ? 0 : expected_sr_conflicts);
|
||||
rrc_ok =
|
||||
rrc_total == (expected_rr_conflicts == -1 ? 0 : expected_rr_conflicts);
|
||||
src_expected = expected_sr_conflicts == -1 ? 0 : expected_sr_conflicts;
|
||||
rrc_expected = expected_rr_conflicts == -1 ? 0 : expected_rr_conflicts;
|
||||
src_ok = src_total == src_expected;
|
||||
rrc_ok = rrc_total == rrc_expected;
|
||||
|
||||
/* If there are as many RR conflicts and SR conflicts as
|
||||
expected, then there is nothing to report. */
|
||||
if (rrc_ok && src_ok)
|
||||
if (rrc_ok & src_ok)
|
||||
return;
|
||||
|
||||
/* Report the total number of conflicts on STDERR. */
|
||||
if (! yacc_flag)
|
||||
fprintf (stderr, "%s: ", current_file);
|
||||
conflict_report (stderr, src_total, rrc_total);
|
||||
if (src_total | rrc_total)
|
||||
{
|
||||
if (! yacc_flag)
|
||||
fprintf (stderr, "%s: ", current_file);
|
||||
conflict_report (stderr, src_total, rrc_total);
|
||||
}
|
||||
|
||||
if (expected_sr_conflicts != -1 || expected_rr_conflicts != -1)
|
||||
{
|
||||
int sr = expected_sr_conflicts == -1 ? 0 : expected_sr_conflicts;
|
||||
int rr = expected_rr_conflicts == -1 ? 0 : expected_rr_conflicts;
|
||||
if (! src_ok)
|
||||
warn (ngettext ("expected %d shift/reduce conflict",
|
||||
"expected %d shift/reduce conflicts",
|
||||
sr), sr);
|
||||
complain (ngettext ("expected %d shift/reduce conflict",
|
||||
"expected %d shift/reduce conflicts",
|
||||
src_expected),
|
||||
src_expected);
|
||||
if (! rrc_ok)
|
||||
warn (ngettext ("expected %d reduce/reduce conflict",
|
||||
"expected %d reduce/reduce conflicts",
|
||||
rr), rr);
|
||||
complain (ngettext ("expected %d reduce/reduce conflict",
|
||||
"expected %d reduce/reduce conflicts",
|
||||
rrc_expected),
|
||||
rrc_expected);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -524,6 +530,6 @@ conflicts_free (void)
|
||||
{
|
||||
free (conflicts);
|
||||
bitset_free (shift_set);
|
||||
bitset_free (look_ahead_set);
|
||||
bitset_free (lookahead_set);
|
||||
obstack_free (&solved_conflicts_obstack, NULL);
|
||||
}
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
/* Find and resolve or report look-ahead conflicts for bison,
|
||||
/* Find and resolve or report lookahead conflicts for bison,
|
||||
Copyright (C) 2000, 2001, 2002, 2004 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of Bison, the GNU Compiler Compiler.
|
||||
|
||||
+3
-3
@@ -1,7 +1,7 @@
|
||||
/* Match rules with nonterminals for bison,
|
||||
|
||||
Copyright (C) 1984, 1989, 2000, 2001, 2002, 2003 Free Software
|
||||
Foundation, Inc.
|
||||
Copyright (C) 1984, 1989, 2000, 2001, 2002, 2003, 2005 Free
|
||||
Software Foundation, Inc.
|
||||
|
||||
This file is part of Bison, the GNU Compiler Compiler.
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
Boston, MA 02110-1301, USA. */
|
||||
|
||||
|
||||
#include <config.h>
|
||||
#include "system.h"
|
||||
|
||||
#include "getargs.h"
|
||||
|
||||
+60
-57
@@ -1,7 +1,7 @@
|
||||
/* Open and close files for Bison.
|
||||
|
||||
Copyright (C) 1984, 1986, 1989, 1992, 2000, 2001, 2002, 2003, 2004, 2005
|
||||
Free Software Foundation, Inc.
|
||||
Copyright (C) 1984, 1986, 1989, 1992, 2000, 2001, 2002, 2003, 2004,
|
||||
2005, 2006 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of Bison, the GNU Compiler Compiler.
|
||||
|
||||
@@ -20,24 +20,20 @@
|
||||
Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
02110-1301, USA. */
|
||||
|
||||
|
||||
#include <config.h>
|
||||
#include "system.h"
|
||||
|
||||
#include <error.h>
|
||||
#include <dirname.h>
|
||||
#include <get-errno.h>
|
||||
#include <quote.h>
|
||||
#include <stdio-safer.h>
|
||||
#include <xstrndup.h>
|
||||
|
||||
#include "complain.h"
|
||||
#include "files.h"
|
||||
#include "getargs.h"
|
||||
#include "gram.h"
|
||||
#include "stdio-safer.h"
|
||||
|
||||
/* From basename.c. Almost a lie, as it returns a char *. */
|
||||
const char *base_name (char const *name);
|
||||
|
||||
FILE *finput = NULL;
|
||||
|
||||
struct obstack pre_prologue_obstack;
|
||||
struct obstack post_prologue_obstack;
|
||||
@@ -49,21 +45,36 @@ struct obstack post_prologue_obstack;
|
||||
NULL), then the %directive is ignored. As a result, %name-prefix,
|
||||
for instance, will not be honored. */
|
||||
|
||||
char *spec_outfile = NULL; /* for -o. */
|
||||
char *spec_file_prefix = NULL; /* for -b. */
|
||||
const char *spec_name_prefix = NULL; /* for -p. */
|
||||
char *spec_verbose_file = NULL; /* for --verbose. */
|
||||
char *spec_graph_file = NULL; /* for -g. */
|
||||
char *spec_defines_file = NULL; /* for --defines. */
|
||||
char *parser_file_name = NULL;
|
||||
char const *spec_outfile = NULL; /* for -o. */
|
||||
char const *spec_file_prefix = NULL; /* for -b. */
|
||||
char const *spec_name_prefix = NULL; /* for -p. */
|
||||
char const *spec_verbose_file = NULL; /* for --verbose. */
|
||||
char const *spec_graph_file = NULL; /* for -g. */
|
||||
char const *spec_defines_file = NULL; /* for --defines. */
|
||||
char const *parser_file_name;
|
||||
|
||||
uniqstr grammar_file = NULL;
|
||||
uniqstr current_file = NULL;
|
||||
|
||||
static char *full_base_name = NULL;
|
||||
/* If --output=dir/foo.c was specified,
|
||||
DIR_PREFIX is `dir/' and ALL_BUT_EXT and ALL_BUT_TAB_EXT are `dir/foo'.
|
||||
|
||||
/* Prefix used to generate output file names. */
|
||||
char *short_base_name = NULL;
|
||||
If --output=dir/foo.tab.c was specified, DIR_PREFIX is `dir/',
|
||||
ALL_BUT_EXT is `dir/foo.tab', and ALL_BUT_TAB_EXT is `dir/foo'.
|
||||
|
||||
If --output was not specified but --file-prefix=dir/foo was specified,
|
||||
ALL_BUT_EXT = `foo.tab' and ALL_BUT_TAB_EXT = `foo'.
|
||||
|
||||
If neither --output nor --file was specified but the input grammar
|
||||
is name dir/foo.y, ALL_BUT_EXT and ALL_BUT_TAB_EXT are `foo'.
|
||||
|
||||
If neither --output nor --file was specified, DIR_PREFIX is the
|
||||
empty string (meaning the current directory); otherwise it is
|
||||
`dir/'. */
|
||||
|
||||
static char const *all_but_ext;
|
||||
static char const *all_but_tab_ext;
|
||||
char const *dir_prefix;
|
||||
|
||||
/* C source file extension (the parser source). */
|
||||
static char const *src_extension = NULL;
|
||||
@@ -121,9 +132,9 @@ xfclose (FILE *ptr)
|
||||
}
|
||||
|
||||
|
||||
/*---------------------------------------------------------------------.
|
||||
| Compute FULL_BASE_NAME, SHORT_BASE_NAME and output files extensions. |
|
||||
`---------------------------------------------------------------------*/
|
||||
/*------------------------------------------------------------------.
|
||||
| Compute ALL_BUT_EXT, ALL_BUT_TAB_EXT and output files extensions. |
|
||||
`------------------------------------------------------------------*/
|
||||
|
||||
/* Replace all characters FROM by TO in the string IN.
|
||||
and returns a new allocated string. */
|
||||
@@ -197,7 +208,7 @@ static void
|
||||
file_name_split (const char *file_name,
|
||||
const char **base, const char **tab, const char **ext)
|
||||
{
|
||||
*base = base_name (file_name);
|
||||
*base = last_component (file_name);
|
||||
|
||||
/* Look for the extension, i.e., look for the last dot. */
|
||||
*ext = strrchr (*base, '.');
|
||||
@@ -218,29 +229,27 @@ file_name_split (const char *file_name,
|
||||
|
||||
|
||||
static void
|
||||
compute_base_names (void)
|
||||
compute_file_name_parts (void)
|
||||
{
|
||||
const char *base, *tab, *ext;
|
||||
|
||||
/* If --output=foo.c was specified (SPEC_OUTFILE == foo.c),
|
||||
FULL_BASE_NAME and SHORT_BASE_NAME are `foo'.
|
||||
|
||||
If --output=foo.tab.c was specified, FULL_BASE_NAME is `foo.tab'
|
||||
and SHORT_BASE_NAME is `foo'.
|
||||
/* Compute ALL_BUT_EXT and ALL_BUT_TAB_EXT from SPEC_OUTFILE
|
||||
or GRAMMAR_FILE.
|
||||
|
||||
The precise -o name will be used for FTABLE. For other output
|
||||
files, remove the ".c" or ".tab.c" suffix. */
|
||||
if (spec_outfile)
|
||||
{
|
||||
file_name_split (spec_outfile, &base, &tab, &ext);
|
||||
dir_prefix = xstrndup (spec_outfile, base - spec_outfile);
|
||||
|
||||
/* The full base name goes up the EXT, excluding it. */
|
||||
full_base_name =
|
||||
/* ALL_BUT_EXT goes up the EXT, excluding it. */
|
||||
all_but_ext =
|
||||
xstrndup (spec_outfile,
|
||||
(strlen (spec_outfile) - (ext ? strlen (ext) : 0)));
|
||||
|
||||
/* The short base name goes up to TAB, excluding it. */
|
||||
short_base_name =
|
||||
/* ALL_BUT_TAB_EXT goes up to TAB, excluding it. */
|
||||
all_but_tab_ext =
|
||||
xstrndup (spec_outfile,
|
||||
(strlen (spec_outfile)
|
||||
- (tab ? strlen (tab) : (ext ? strlen (ext) : 0))));
|
||||
@@ -248,40 +257,34 @@ compute_base_names (void)
|
||||
if (ext)
|
||||
compute_exts_from_src (ext);
|
||||
}
|
||||
|
||||
/* If --file-prefix=foo was specified, FULL_BASE_NAME = `foo.tab'
|
||||
and SHORT_BASE_NAME = `foo'.
|
||||
|
||||
Construct names from it. */
|
||||
else
|
||||
{
|
||||
file_name_split (grammar_file, &base, &tab, &ext);
|
||||
|
||||
if (spec_file_prefix)
|
||||
{
|
||||
/* If --file-prefix=foo was specified, SHORT_BASE_NAME =
|
||||
`foo'. */
|
||||
short_base_name = xstrdup (spec_file_prefix);
|
||||
/* If --file-prefix=foo was specified, ALL_BUT_TAB_EXT = `foo'. */
|
||||
dir_prefix = xstrndup (grammar_file, base - grammar_file);
|
||||
all_but_tab_ext = xstrdup (spec_file_prefix);
|
||||
}
|
||||
else if (yacc_flag)
|
||||
{
|
||||
/* If --yacc, then the output is `y.tab.c'. */
|
||||
short_base_name = xstrdup ("y");
|
||||
/* If --yacc, then the output is `y.tab.c'. */
|
||||
dir_prefix = "";
|
||||
all_but_tab_ext = "y";
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Otherwise, the short base name is computed from the input
|
||||
/* Otherwise, ALL_BUT_TAB_EXT is computed from the input
|
||||
grammar: `foo/bar.yy' => `bar'. */
|
||||
file_name_split (grammar_file, &base, &tab, &ext);
|
||||
short_base_name =
|
||||
xstrndup (base,
|
||||
(strlen (base) - (ext ? strlen (ext) : 0)));
|
||||
dir_prefix = "";
|
||||
all_but_tab_ext =
|
||||
xstrndup (base, (strlen (base) - (ext ? strlen (ext) : 0)));
|
||||
}
|
||||
|
||||
full_base_name = xmalloc (strlen (short_base_name)
|
||||
+ strlen (TAB_EXT) + 1);
|
||||
stpcpy (stpcpy (full_base_name, short_base_name), TAB_EXT);
|
||||
all_but_ext = concat2 (all_but_tab_ext, TAB_EXT);
|
||||
|
||||
/* Compute the extensions from the grammar file name. */
|
||||
file_name_split (grammar_file, &base, &tab, &ext);
|
||||
if (ext && !yacc_flag)
|
||||
compute_exts_from_gf (ext);
|
||||
}
|
||||
@@ -299,7 +302,7 @@ compute_output_file_names (void)
|
||||
int j;
|
||||
int names = 0;
|
||||
|
||||
compute_base_names ();
|
||||
compute_file_name_parts ();
|
||||
|
||||
/* If not yet done. */
|
||||
if (!src_extension)
|
||||
@@ -308,25 +311,25 @@ compute_output_file_names (void)
|
||||
header_extension = ".h";
|
||||
|
||||
name[names++] = parser_file_name =
|
||||
spec_outfile ? spec_outfile : concat2 (full_base_name, src_extension);
|
||||
spec_outfile ? spec_outfile : concat2 (all_but_ext, src_extension);
|
||||
|
||||
if (defines_flag)
|
||||
{
|
||||
if (! spec_defines_file)
|
||||
spec_defines_file = concat2 (full_base_name, header_extension);
|
||||
spec_defines_file = concat2 (all_but_ext, header_extension);
|
||||
name[names++] = spec_defines_file;
|
||||
}
|
||||
|
||||
if (graph_flag)
|
||||
{
|
||||
if (! spec_graph_file)
|
||||
spec_graph_file = concat2 (short_base_name, ".vcg");
|
||||
spec_graph_file = concat2 (all_but_tab_ext, ".vcg");
|
||||
name[names++] = spec_graph_file;
|
||||
}
|
||||
|
||||
if (report_flag)
|
||||
{
|
||||
spec_verbose_file = concat2 (short_base_name, OUTPUT_EXT);
|
||||
spec_verbose_file = concat2 (all_but_tab_ext, OUTPUT_EXT);
|
||||
name[names++] = spec_verbose_file;
|
||||
}
|
||||
|
||||
|
||||
+8
-11
@@ -24,28 +24,28 @@
|
||||
# include "uniqstr.h"
|
||||
|
||||
/* File name specified with -o for the output file, or 0 if no -o. */
|
||||
extern char *spec_outfile;
|
||||
extern char const *spec_outfile;
|
||||
|
||||
/* File name for the parser (i.e., the one above, or its default.) */
|
||||
extern char *parser_file_name;
|
||||
extern char const *parser_file_name;
|
||||
|
||||
/* Symbol prefix specified with -p, or 0 if no -p. */
|
||||
extern const char *spec_name_prefix;
|
||||
|
||||
/* File name prefix specified with -b, or 0 if no -b. */
|
||||
extern char *spec_file_prefix;
|
||||
extern char const *spec_file_prefix;
|
||||
|
||||
/* --verbose. */
|
||||
extern char *spec_verbose_file;
|
||||
extern char const *spec_verbose_file;
|
||||
|
||||
/* File name specified for the output VCG graph. */
|
||||
extern char *spec_graph_file;
|
||||
extern char const *spec_graph_file;
|
||||
|
||||
/* File name specified with --defines. */
|
||||
extern char *spec_defines_file;
|
||||
extern char const *spec_defines_file;
|
||||
|
||||
/* Read grammar specifications. */
|
||||
extern FILE *finput;
|
||||
/* Directory prefix of output file names. */
|
||||
extern char const *dir_prefix;
|
||||
|
||||
|
||||
/* If semantic parser, output a .h file that defines YYSTYPE... */
|
||||
@@ -65,7 +65,4 @@ void compute_output_file_names (void);
|
||||
FILE *xfopen (const char *name, const char *mode);
|
||||
void xfclose (FILE *ptr);
|
||||
|
||||
/* Prefix used to generate output file names. */
|
||||
extern char *short_base_name;
|
||||
|
||||
#endif /* !FILES_H_ */
|
||||
|
||||
@@ -0,0 +1,78 @@
|
||||
/* Common parts between scan-code.l, scan-gram.l, and scan-skel.l.
|
||||
|
||||
Copyright (C) 2006 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of Bison, the GNU Compiler Compiler.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
02110-1301 USA
|
||||
*/
|
||||
|
||||
#ifndef FLEX_PREFIX
|
||||
# error "FLEX_PREFIX not defined"
|
||||
#endif
|
||||
|
||||
/* Pacify "gcc -Wmissing-prototypes" when flex 2.5.31 is used. */
|
||||
int FLEX_PREFIX (get_lineno) (void);
|
||||
FILE *FLEX_PREFIX (get_in) (void);
|
||||
FILE *FLEX_PREFIX (get_out) (void);
|
||||
int FLEX_PREFIX (get_leng) (void);
|
||||
char *FLEX_PREFIX (get_text) (void);
|
||||
void FLEX_PREFIX (set_lineno) (int);
|
||||
void FLEX_PREFIX (set_in) (FILE *);
|
||||
void FLEX_PREFIX (set_out) (FILE *);
|
||||
int FLEX_PREFIX (get_debug) (void);
|
||||
void FLEX_PREFIX (set_debug) (int);
|
||||
int FLEX_PREFIX (lex_destroy) (void);
|
||||
|
||||
#define last_string FLEX_PREFIX (last_string)
|
||||
|
||||
/* It seems to be a nice "feature" of Flex that one cannot use yytext,
|
||||
yyleng etc. when a prefix is given, since there is no longer a
|
||||
#define, but rather the token is actually changed in the output.
|
||||
However, this is not true for Flex 2.5.4. */
|
||||
#ifndef yyleng
|
||||
# define yyleng FLEX_PREFIX (leng)
|
||||
#endif
|
||||
#ifndef yytext
|
||||
# define yytext FLEX_PREFIX (text)
|
||||
#endif
|
||||
|
||||
/* OBSTACK_FOR_STRING -- Used to store all the characters that we need to
|
||||
keep (to construct ID, STRINGS etc.). Use the following macros to
|
||||
use it.
|
||||
|
||||
Use STRING_GROW to append what has just been matched, and
|
||||
STRING_FINISH to end the string (it puts the ending 0).
|
||||
STRING_FINISH also stores this string in LAST_STRING, which can be
|
||||
used, and which is used by STRING_FREE to free the last string. */
|
||||
|
||||
#ifndef FLEX_NO_OBSTACK
|
||||
|
||||
static struct obstack obstack_for_string;
|
||||
|
||||
#define STRING_GROW \
|
||||
obstack_grow (&obstack_for_string, yytext, yyleng)
|
||||
|
||||
#define STRING_FINISH \
|
||||
do { \
|
||||
obstack_1grow (&obstack_for_string, '\0'); \
|
||||
last_string = obstack_finish (&obstack_for_string); \
|
||||
} while (0)
|
||||
|
||||
#define STRING_FREE \
|
||||
obstack_free (&obstack_for_string, last_string)
|
||||
|
||||
#endif
|
||||
+160
-110
@@ -1,7 +1,7 @@
|
||||
/* Parse command line arguments for Bison.
|
||||
|
||||
Copyright (C) 1984, 1986, 1989, 1992, 2000, 2001, 2002, 2003, 2004, 2005
|
||||
Free Software Foundation, Inc.
|
||||
Copyright (C) 1984, 1986, 1989, 1992, 2000, 2001, 2002, 2003, 2004,
|
||||
2005, 2006 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of Bison, the GNU Compiler Compiler.
|
||||
|
||||
@@ -20,7 +20,9 @@
|
||||
Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
02110-1301, USA. */
|
||||
|
||||
#include <config.h>
|
||||
#include "system.h"
|
||||
#include "revision.h"
|
||||
|
||||
#include <argmatch.h>
|
||||
#include <error.h>
|
||||
@@ -45,25 +47,108 @@
|
||||
|
||||
bool debug_flag;
|
||||
bool defines_flag;
|
||||
bool graph_flag;
|
||||
bool locations_flag;
|
||||
bool no_lines_flag;
|
||||
bool no_parser_flag;
|
||||
int report_flag = report_none;
|
||||
bool token_table_flag;
|
||||
bool yacc_flag; /* for -y */
|
||||
bool graph_flag;
|
||||
int trace_flag = trace_none;
|
||||
|
||||
bool error_verbose = false;
|
||||
|
||||
bool nondeterministic_parser = false;
|
||||
bool glr_parser = false;
|
||||
bool pure_parser = false;
|
||||
|
||||
int report_flag = report_none;
|
||||
int trace_flag = trace_none;
|
||||
int warnings_flag = warnings_none;
|
||||
|
||||
const char *skeleton = NULL;
|
||||
const char *include = NULL;
|
||||
|
||||
extern char *program_name;
|
||||
|
||||
|
||||
/** Decode an option's set of keys.
|
||||
*
|
||||
* \param option option being decoded.
|
||||
* \paran keys array of valid subarguments.
|
||||
* \param values array of corresponding (int) values.
|
||||
* \param flag the flags to update
|
||||
* \param args colon separated list of effective subarguments to decode.
|
||||
* If 0, then activate all the flags.
|
||||
*
|
||||
* The special value 0 resets the flags to 0.
|
||||
*/
|
||||
static void
|
||||
flags_argmatch (const char *option,
|
||||
const char * const keys[], const int values[],
|
||||
int *flags, char *args)
|
||||
{
|
||||
if (args)
|
||||
{
|
||||
args = strtok (args, ",");
|
||||
do
|
||||
{
|
||||
int value = XARGMATCH (option, args, keys, values);
|
||||
if (value == 0)
|
||||
*flags = 0;
|
||||
else
|
||||
*flags |= value;
|
||||
}
|
||||
while ((args = strtok (NULL, ",")));
|
||||
}
|
||||
else
|
||||
*flags = ~0;
|
||||
}
|
||||
|
||||
/** Decode a set of sub arguments.
|
||||
*
|
||||
* \param FlagName the flag familly to update.
|
||||
* \param args the effective sub arguments to decode.
|
||||
*
|
||||
* \arg FlagName_args the list of keys.
|
||||
* \arg FlagName_types the list of values.
|
||||
* \arg FlagName_flag the flag to update.
|
||||
*/
|
||||
#define FLAGS_ARGMATCH(FlagName, Args) \
|
||||
flags_argmatch ("--" #FlagName, FlagName ## _args, FlagName ## _types, \
|
||||
&FlagName ## _flag, Args)
|
||||
|
||||
|
||||
/*----------------------.
|
||||
| --report's handling. |
|
||||
`----------------------*/
|
||||
|
||||
static const char * const report_args[] =
|
||||
{
|
||||
/* In a series of synonyms, present the most meaningful first, so
|
||||
that argmatch_valid be more readable. */
|
||||
"none",
|
||||
"state", "states",
|
||||
"itemset", "itemsets",
|
||||
"lookahead", "lookaheads", "look-ahead",
|
||||
"solved",
|
||||
"all",
|
||||
0
|
||||
};
|
||||
|
||||
static const int report_types[] =
|
||||
{
|
||||
report_none,
|
||||
report_states, report_states,
|
||||
report_states | report_itemsets, report_states | report_itemsets,
|
||||
report_states | report_lookahead_tokens,
|
||||
report_states | report_lookahead_tokens,
|
||||
report_states | report_lookahead_tokens,
|
||||
report_states | report_solved_conflicts,
|
||||
report_all
|
||||
};
|
||||
|
||||
ARGMATCH_VERIFY (report_args, report_types);
|
||||
|
||||
|
||||
/*---------------------.
|
||||
| --trace's handling. |
|
||||
`---------------------*/
|
||||
@@ -72,15 +157,16 @@ static const char * const trace_args[] =
|
||||
{
|
||||
/* In a series of synonyms, present the most meaningful first, so
|
||||
that argmatch_valid be more readable. */
|
||||
"none - no report",
|
||||
"none - no traces",
|
||||
"scan - grammar scanner traces",
|
||||
"parse - grammar parser traces",
|
||||
"automaton - contruction of the automaton",
|
||||
"automaton - construction of the automaton",
|
||||
"bitsets - use of bitsets",
|
||||
"grammar - reading, reducing of the grammar",
|
||||
"grammar - reading, reducing the grammar",
|
||||
"resource - memory consumption (where available)",
|
||||
"sets - grammar sets: firsts, nullable etc.",
|
||||
"tools - m4 invocation and preserve the temporary file",
|
||||
"tools - m4 invocation",
|
||||
"m4 - m4 traces",
|
||||
"skeleton - skeleton postprocessing",
|
||||
"time - time consumption",
|
||||
"all - all of the above",
|
||||
@@ -98,81 +184,39 @@ static const int trace_types[] =
|
||||
trace_resource,
|
||||
trace_sets,
|
||||
trace_tools,
|
||||
trace_m4,
|
||||
trace_skeleton,
|
||||
trace_time,
|
||||
trace_all
|
||||
};
|
||||
|
||||
|
||||
static void
|
||||
trace_argmatch (char *args)
|
||||
{
|
||||
verify (trace_constraint, ARGMATCH_CONSTRAINT (trace_args, trace_types));
|
||||
if (args)
|
||||
{
|
||||
args = strtok (args, ",");
|
||||
do
|
||||
{
|
||||
int trace = XARGMATCH ("--trace", args,
|
||||
trace_args, trace_types);
|
||||
if (trace == trace_none)
|
||||
trace_flag = trace_none;
|
||||
else
|
||||
trace_flag |= trace;
|
||||
}
|
||||
while ((args = strtok (NULL, ",")));
|
||||
}
|
||||
else
|
||||
trace_flag = trace_all;
|
||||
}
|
||||
ARGMATCH_VERIFY (trace_args, trace_types);
|
||||
|
||||
|
||||
/*----------------------.
|
||||
| --report's handling. |
|
||||
`----------------------*/
|
||||
/*------------------------.
|
||||
| --warnings's handling. |
|
||||
`------------------------*/
|
||||
|
||||
static const char * const report_args[] =
|
||||
static const char * const warnings_args[] =
|
||||
{
|
||||
/* In a series of synonyms, present the most meaningful first, so
|
||||
that argmatch_valid be more readable. */
|
||||
"none",
|
||||
"state", "states",
|
||||
"itemset", "itemsets",
|
||||
"look-ahead", "lookahead", "lookaheads",
|
||||
"solved",
|
||||
"all",
|
||||
"none - no warnings",
|
||||
"error - warnings are errors",
|
||||
"yacc - incompatibilities with POSIX YACC",
|
||||
"all - all of the above",
|
||||
0
|
||||
};
|
||||
|
||||
static const int report_types[] =
|
||||
static const int warnings_types[] =
|
||||
{
|
||||
report_none,
|
||||
report_states, report_states,
|
||||
report_states | report_itemsets, report_states | report_itemsets,
|
||||
report_states | report_look_ahead_tokens,
|
||||
report_states | report_look_ahead_tokens,
|
||||
report_states | report_look_ahead_tokens,
|
||||
report_states | report_solved_conflicts,
|
||||
report_all
|
||||
warnings_none,
|
||||
warnings_error,
|
||||
warnings_yacc,
|
||||
warnings_all
|
||||
};
|
||||
|
||||
|
||||
static void
|
||||
report_argmatch (char *args)
|
||||
{
|
||||
verify (report_constraint, ARGMATCH_CONSTRAINT (report_args, report_types));
|
||||
args = strtok (args, ",");
|
||||
do
|
||||
{
|
||||
int report = XARGMATCH ("--report", args,
|
||||
report_args, report_types);
|
||||
if (report == report_none)
|
||||
report_flag = report_none;
|
||||
else
|
||||
report_flag |= report;
|
||||
}
|
||||
while ((args = strtok (NULL, ",")));
|
||||
}
|
||||
ARGMATCH_VERIFY (warnings_args, warnings_types);
|
||||
|
||||
|
||||
/*-------------------------------------------.
|
||||
@@ -192,7 +236,7 @@ usage (int status)
|
||||
/* Some efforts were made to ease the translators' task, please
|
||||
continue. */
|
||||
fputs (_("\
|
||||
GNU bison generates parsers for LALR(1) grammars.\n"), stdout);
|
||||
GNU bison generates LALR(1) and GLR parsers.\n"), stdout);
|
||||
putc ('\n', stdout);
|
||||
|
||||
fprintf (stdout, _("\
|
||||
@@ -210,7 +254,7 @@ Operation modes:\n\
|
||||
-h, --help display this help and exit\n\
|
||||
-V, --version output version information and exit\n\
|
||||
--print-localedir output directory containing locale-dependent data\n\
|
||||
-y, --yacc emulate POSIX yacc\n"), stdout);
|
||||
-y, --yacc emulate POSIX Yacc\n"), stdout);
|
||||
putc ('\n', stdout);
|
||||
|
||||
fputs (_("\
|
||||
@@ -240,7 +284,7 @@ Output:\n\
|
||||
THINGS is a list of comma separated words that can include:\n\
|
||||
`state' describe the states\n\
|
||||
`itemset' complete the core item sets with their closure\n\
|
||||
`look-ahead' explicitly associate look-ahead tokens to items\n\
|
||||
`lookahead' explicitly associate lookahead tokens to items\n\
|
||||
`solved' describe shift/reduce conflicts solving\n\
|
||||
`all' include all the above information\n\
|
||||
`none' disable the report\n\
|
||||
@@ -248,7 +292,7 @@ THINGS is a list of comma separated words that can include:\n\
|
||||
putc ('\n', stdout);
|
||||
|
||||
fputs (_("\
|
||||
Report bugs to <bug-bison@gnu.org>.\n"), stdout);
|
||||
Report bugs to <" PACKAGE_BUGREPORT ">.\n"), stdout);
|
||||
}
|
||||
|
||||
exit (status);
|
||||
@@ -266,11 +310,12 @@ version (void)
|
||||
continue. */
|
||||
printf (_("bison (GNU Bison) %s"), VERSION);
|
||||
putc ('\n', stdout);
|
||||
printf ("%s", revision);
|
||||
fputs (_("Written by Robert Corbett and Richard Stallman.\n"), stdout);
|
||||
putc ('\n', stdout);
|
||||
|
||||
fprintf (stdout,
|
||||
_("Copyright (C) %d Free Software Foundation, Inc.\n"), 2005);
|
||||
_("Copyright (C) %d Free Software Foundation, Inc.\n"), 2006);
|
||||
|
||||
fputs (_("\
|
||||
This is free software; see the source for copying conditions. There is NO\n\
|
||||
@@ -285,7 +330,7 @@ warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n\
|
||||
`----------------------*/
|
||||
|
||||
/* Shorts options. */
|
||||
static char const short_options[] = "yvegdhr:ltknVo:b:p:S:T::";
|
||||
static char const short_options[] = "yvegdhr:ltknVo:b:p:S:T::W";
|
||||
|
||||
/* Values for long options that do not have single-letter equivalents. */
|
||||
enum
|
||||
@@ -297,9 +342,10 @@ enum
|
||||
static struct option const long_options[] =
|
||||
{
|
||||
/* Operation modes. */
|
||||
{ "help", no_argument, 0, 'h' },
|
||||
{ "version", no_argument, 0, 'V' },
|
||||
{ "print-localedir", no_argument, 0, PRINT_LOCALEDIR_OPTION },
|
||||
{ "help", no_argument, 0, 'h' },
|
||||
{ "version", no_argument, 0, 'V' },
|
||||
{ "print-localedir", no_argument, 0, PRINT_LOCALEDIR_OPTION },
|
||||
{ "warnings", optional_argument, 0, 'W' },
|
||||
|
||||
/* Parser. */
|
||||
{ "name-prefix", required_argument, 0, 'p' },
|
||||
@@ -356,21 +402,10 @@ getargs (int argc, char *argv[])
|
||||
/* Certain long options cause getopt_long to return 0. */
|
||||
break;
|
||||
|
||||
case 'y':
|
||||
yacc_flag = true;
|
||||
case 'b':
|
||||
spec_file_prefix = AS_FILE_NAME (optarg);
|
||||
break;
|
||||
|
||||
case 'h':
|
||||
usage (EXIT_SUCCESS);
|
||||
|
||||
case 'V':
|
||||
version ();
|
||||
exit (EXIT_SUCCESS);
|
||||
|
||||
case PRINT_LOCALEDIR_OPTION:
|
||||
printf ("%s\n", LOCALEDIR);
|
||||
exit (EXIT_SUCCESS);
|
||||
|
||||
case 'g':
|
||||
/* Here, the -g and --graph=FILE options are differentiated. */
|
||||
graph_flag = true;
|
||||
@@ -378,9 +413,8 @@ getargs (int argc, char *argv[])
|
||||
spec_graph_file = AS_FILE_NAME (optarg);
|
||||
break;
|
||||
|
||||
case 'v':
|
||||
report_flag |= report_states;
|
||||
break;
|
||||
case 'h':
|
||||
usage (EXIT_SUCCESS);
|
||||
|
||||
case 'S':
|
||||
skeleton = AS_FILE_NAME (optarg);
|
||||
@@ -397,46 +431,62 @@ getargs (int argc, char *argv[])
|
||||
spec_defines_file = AS_FILE_NAME (optarg);
|
||||
break;
|
||||
|
||||
case 'l':
|
||||
no_lines_flag = true;
|
||||
break;
|
||||
|
||||
case LOCATIONS_OPTION:
|
||||
locations_flag = true;
|
||||
break;
|
||||
|
||||
case 'k':
|
||||
token_table_flag = true;
|
||||
break;
|
||||
|
||||
case 'l':
|
||||
no_lines_flag = true;
|
||||
break;
|
||||
|
||||
case 'n':
|
||||
no_parser_flag = true;
|
||||
break;
|
||||
|
||||
case 't':
|
||||
debug_flag = true;
|
||||
break;
|
||||
|
||||
case 'o':
|
||||
spec_outfile = AS_FILE_NAME (optarg);
|
||||
break;
|
||||
|
||||
case 'b':
|
||||
spec_file_prefix = AS_FILE_NAME (optarg);
|
||||
break;
|
||||
|
||||
case 'p':
|
||||
spec_name_prefix = optarg;
|
||||
break;
|
||||
|
||||
case 'r':
|
||||
report_argmatch (optarg);
|
||||
FLAGS_ARGMATCH (report, optarg);
|
||||
break;
|
||||
|
||||
case 'T':
|
||||
trace_argmatch (optarg);
|
||||
FLAGS_ARGMATCH (trace, optarg);
|
||||
break;
|
||||
|
||||
case 't':
|
||||
debug_flag = true;
|
||||
break;
|
||||
|
||||
case 'V':
|
||||
version ();
|
||||
exit (EXIT_SUCCESS);
|
||||
|
||||
case 'v':
|
||||
report_flag |= report_states;
|
||||
break;
|
||||
|
||||
case 'y':
|
||||
yacc_flag = true;
|
||||
break;
|
||||
|
||||
case 'W':
|
||||
FLAGS_ARGMATCH (warnings, optarg);
|
||||
break;
|
||||
|
||||
case LOCATIONS_OPTION:
|
||||
locations_flag = true;
|
||||
break;
|
||||
|
||||
case PRINT_LOCALEDIR_OPTION:
|
||||
printf ("%s\n", LOCALEDIR);
|
||||
exit (EXIT_SUCCESS);
|
||||
|
||||
default:
|
||||
usage (EXIT_FAILURE);
|
||||
}
|
||||
|
||||
+53
-21
@@ -1,5 +1,5 @@
|
||||
/* Parse command line arguments for bison.
|
||||
Copyright (C) 1984, 1986, 1989, 1992, 2000, 2001, 2002, 2003, 2004, 2005
|
||||
Copyright (C) 1984, 1986, 1989, 1992, 2000, 2001, 2002, 2003, 2004, 2005, 2006
|
||||
Free Software Foundation, Inc.
|
||||
|
||||
This file is part of Bison, the GNU Compiler Compiler.
|
||||
@@ -32,13 +32,16 @@ extern char const *include;
|
||||
|
||||
extern bool debug_flag; /* for -t */
|
||||
extern bool defines_flag; /* for -d */
|
||||
extern bool graph_flag; /* for -g */
|
||||
extern bool locations_flag;
|
||||
extern bool no_lines_flag; /* for -l */
|
||||
extern bool no_parser_flag; /* for -n */
|
||||
extern bool token_table_flag; /* for -k */
|
||||
extern bool graph_flag; /* for -g */
|
||||
extern bool yacc_flag; /* for -y */
|
||||
|
||||
extern bool error_verbose;
|
||||
|
||||
|
||||
/* GLR_PARSER is true if the input file says to use the GLR
|
||||
(Generalized LR) parser, and to output some additional information
|
||||
used by the GLR algorithm. */
|
||||
@@ -56,36 +59,65 @@ extern bool pure_parser;
|
||||
|
||||
extern bool nondeterministic_parser;
|
||||
|
||||
/* --trace. */
|
||||
enum trace
|
||||
{
|
||||
trace_none = 0,
|
||||
trace_scan = 1 << 0,
|
||||
trace_parse = 1 << 1,
|
||||
trace_resource = 1 << 2,
|
||||
trace_sets = 1 << 3,
|
||||
trace_bitsets = 1 << 4,
|
||||
trace_tools = 1 << 5,
|
||||
trace_automaton = 1 << 6,
|
||||
trace_grammar = 1 << 7,
|
||||
trace_time = 1 << 8,
|
||||
trace_skeleton = 1 << 9,
|
||||
trace_all = ~0
|
||||
};
|
||||
extern int trace_flag;
|
||||
|
||||
/* --report. */
|
||||
/*-----------.
|
||||
| --report. |
|
||||
`-----------*/
|
||||
|
||||
enum report
|
||||
{
|
||||
report_none = 0,
|
||||
report_states = 1 << 0,
|
||||
report_itemsets = 1 << 1,
|
||||
report_look_ahead_tokens= 1 << 2,
|
||||
report_lookahead_tokens = 1 << 2,
|
||||
report_solved_conflicts = 1 << 3,
|
||||
report_all = ~0
|
||||
};
|
||||
/** What appears in the *.output file. */
|
||||
extern int report_flag;
|
||||
|
||||
/*----------.
|
||||
| --trace. |
|
||||
`----------*/
|
||||
enum trace
|
||||
{
|
||||
trace_none = 0, /**< No traces. */
|
||||
trace_scan = 1 << 0, /**< Grammar scanner traces. */
|
||||
trace_parse = 1 << 1, /**< Grammar parser traces. */
|
||||
trace_resource = 1 << 2, /**< Memory allocation. */
|
||||
trace_sets = 1 << 3, /**< Grammar sets: firsts, nullable etc. */
|
||||
trace_bitsets = 1 << 4, /**< Use of bitsets. */
|
||||
trace_tools = 1 << 5, /**< m4 invocation. */
|
||||
trace_automaton = 1 << 6, /**< Construction of the automaton. */
|
||||
trace_grammar = 1 << 7, /**< Reading, reducing the grammar. */
|
||||
trace_time = 1 << 8, /**< Time consumption. */
|
||||
trace_skeleton = 1 << 9, /**< Skeleton postprocessing. */
|
||||
trace_m4 = 1 << 10, /**< M4 traces. */
|
||||
trace_all = ~0 /**< All of the above. */
|
||||
};
|
||||
/** What debug items bison displays during its run. */
|
||||
extern int trace_flag;
|
||||
|
||||
/*-------------.
|
||||
| --warnings. |
|
||||
`-------------*/
|
||||
|
||||
enum warnings
|
||||
{
|
||||
warnings_none = 0, /**< Issue no warnings. */
|
||||
warnings_error = 1 << 0, /**< Warnings are treated as errors. */
|
||||
warnings_yacc = 1 << 1, /**< POSIXME. */
|
||||
warnings_all = ~0 /**< All of the above. */
|
||||
};
|
||||
/** What warnings are issued. */
|
||||
extern int warnings_flag;
|
||||
|
||||
|
||||
/** Process the command line arguments.
|
||||
*
|
||||
* \param argc size of \a argv
|
||||
* \param argv list of arguments.
|
||||
*/
|
||||
void getargs (int argc, char *argv[]);
|
||||
|
||||
#endif /* !GETARGS_H_ */
|
||||
|
||||
+8
-8
@@ -1,7 +1,7 @@
|
||||
/* Allocate input grammar variables for Bison.
|
||||
|
||||
Copyright (C) 1984, 1986, 1989, 2001, 2002, 2003 Free Software
|
||||
Foundation, Inc.
|
||||
Copyright (C) 1984, 1986, 1989, 2001, 2002, 2003, 2005, 2006 Free
|
||||
Software Foundation, Inc.
|
||||
|
||||
This file is part of Bison, the GNU Compiler Compiler.
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
Boston, MA 02110-1301, USA. */
|
||||
|
||||
|
||||
#include <config.h>
|
||||
#include "system.h"
|
||||
|
||||
#include <quotearg.h>
|
||||
@@ -65,7 +65,7 @@ rule_useful_p (rule *r)
|
||||
bool
|
||||
rule_useless_p (rule *r)
|
||||
{
|
||||
return r->number >= nrules;
|
||||
return !rule_useful_p (r);
|
||||
}
|
||||
|
||||
|
||||
@@ -77,7 +77,7 @@ rule_useless_p (rule *r)
|
||||
bool
|
||||
rule_never_reduced_p (rule *r)
|
||||
{
|
||||
return !r->useful && r->number < nrules;
|
||||
return !r->useful && rule_useful_p (r);
|
||||
}
|
||||
|
||||
|
||||
@@ -317,8 +317,7 @@ grammar_rules_never_reduced_report (const char *message)
|
||||
if (!rules[r].useful)
|
||||
{
|
||||
location_print (stderr, rules[r].location);
|
||||
fprintf (stderr, ": %s: %s: ",
|
||||
_("warning"), message);
|
||||
fprintf (stderr, ": %s: %s: ", _("warning"), message);
|
||||
rule_print (&rules[r], stderr);
|
||||
}
|
||||
}
|
||||
@@ -326,7 +325,8 @@ grammar_rules_never_reduced_report (const char *message)
|
||||
void
|
||||
grammar_free (void)
|
||||
{
|
||||
free (ritem);
|
||||
if (ritem)
|
||||
free (ritem - 1);
|
||||
free (rules);
|
||||
free (token_translations);
|
||||
/* Free the symbol table data structure. */
|
||||
|
||||
+14
-1
@@ -1,6 +1,6 @@
|
||||
/* Data definitions for internal representation of Bison's input.
|
||||
|
||||
Copyright (C) 1984, 1986, 1989, 1992, 2001, 2002, 2003, 2004
|
||||
Copyright (C) 1984, 1986, 1989, 1992, 2001, 2002, 2003, 2004, 2005, 2006
|
||||
Free Software Foundation, Inc.
|
||||
|
||||
This file is part of Bison, the GNU Compiler Compiler.
|
||||
@@ -115,6 +115,7 @@ extern int ntokens;
|
||||
extern int nvars;
|
||||
|
||||
typedef int item_number;
|
||||
#define ITEM_NUMBER_MAX INT_MAX
|
||||
extern item_number *ritem;
|
||||
extern unsigned int nritems;
|
||||
|
||||
@@ -138,8 +139,15 @@ item_number_as_symbol_number (item_number i)
|
||||
return i;
|
||||
}
|
||||
|
||||
static inline bool
|
||||
item_number_is_symbol_number (item_number i)
|
||||
{
|
||||
return i >= 0;
|
||||
}
|
||||
|
||||
/* Rule numbers. */
|
||||
typedef int rule_number;
|
||||
#define RULE_NUMBER_MAX INT_MAX
|
||||
extern rule_number nrules;
|
||||
|
||||
static inline item_number
|
||||
@@ -154,6 +162,11 @@ item_number_as_rule_number (item_number i)
|
||||
return -1 - i;
|
||||
}
|
||||
|
||||
static inline bool
|
||||
item_number_is_rule_number (item_number i)
|
||||
{
|
||||
return i < 0;
|
||||
}
|
||||
|
||||
/*--------.
|
||||
| Rules. |
|
||||
|
||||
+51
-50
@@ -1,7 +1,7 @@
|
||||
/* Compute look-ahead criteria for Bison.
|
||||
/* Compute lookahead criteria for Bison.
|
||||
|
||||
Copyright (C) 1984, 1986, 1989, 2000, 2001, 2002, 2003, 2004
|
||||
Free Software Foundation, Inc.
|
||||
Copyright (C) 1984, 1986, 1989, 2000, 2001, 2002, 2003, 2004, 2005,
|
||||
2006 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of Bison, the GNU Compiler Compiler.
|
||||
|
||||
@@ -22,9 +22,10 @@
|
||||
|
||||
|
||||
/* Compute how to make the finite state machine deterministic; find
|
||||
which rules need look-ahead in each state, and which look-ahead
|
||||
which rules need lookahead in each state, and which lookahead
|
||||
tokens they accept. */
|
||||
|
||||
#include <config.h>
|
||||
#include "system.h"
|
||||
|
||||
#include <bitset.h>
|
||||
@@ -93,8 +94,7 @@ set_goto_map (void)
|
||||
ngotos++;
|
||||
|
||||
/* Abort if (ngotos + 1) would overflow. */
|
||||
if (ngotos == GOTO_NUMBER_MAXIMUM)
|
||||
abort ();
|
||||
assert (ngotos != GOTO_NUMBER_MAXIMUM);
|
||||
|
||||
goto_map[TRANSITION_SYMBOL (sp, i) - ntokens]++;
|
||||
}
|
||||
@@ -153,8 +153,7 @@ map_goto (state_number s0, symbol_number sym)
|
||||
|
||||
for (;;)
|
||||
{
|
||||
if (high < low)
|
||||
abort ();
|
||||
assert (low <= high);
|
||||
middle = (low + high) / 2;
|
||||
s = from_state[middle];
|
||||
if (s == s0)
|
||||
@@ -220,9 +219,9 @@ add_lookback_edge (state *s, rule *r, goto_number gotono)
|
||||
{
|
||||
int ri = state_reduction_find (s, r);
|
||||
goto_list *sp = xmalloc (sizeof *sp);
|
||||
sp->next = lookback[(s->reductions->look_ahead_tokens - LA) + ri];
|
||||
sp->next = lookback[(s->reductions->lookahead_tokens - LA) + ri];
|
||||
sp->value = gotono;
|
||||
lookback[(s->reductions->look_ahead_tokens - LA) + ri] = sp;
|
||||
lookback[(s->reductions->lookahead_tokens - LA) + ri] = sp;
|
||||
}
|
||||
|
||||
|
||||
@@ -246,11 +245,11 @@ build_relations (void)
|
||||
{
|
||||
bool done;
|
||||
int length = 1;
|
||||
item_number *rp;
|
||||
item_number const *rp;
|
||||
state *s = states[from_state[i]];
|
||||
states1[0] = s->number;
|
||||
|
||||
for (rp = (*rulep)->rhs; *rp >= 0; rp++)
|
||||
for (rp = (*rulep)->rhs; ! item_number_is_rule_number (*rp); rp++)
|
||||
{
|
||||
s = transitions_to (s->transitions,
|
||||
item_number_as_symbol_number (*rp));
|
||||
@@ -265,9 +264,11 @@ build_relations (void)
|
||||
while (!done)
|
||||
{
|
||||
done = true;
|
||||
/* Each rhs ends in an item number, and there is a
|
||||
sentinel before the first rhs, so it is safe to
|
||||
decrement RP here. */
|
||||
rp--;
|
||||
/* JF added rp>=ritem && I hope to god its right! */
|
||||
if (rp >= ritem && ISVAR (*rp))
|
||||
if (ISVAR (*rp))
|
||||
{
|
||||
/* Downcasting from item_number to symbol_number. */
|
||||
edge[nedges++] = map_goto (states1[--length],
|
||||
@@ -313,7 +314,7 @@ compute_FOLLOWS (void)
|
||||
|
||||
|
||||
static void
|
||||
compute_look_ahead_tokens (void)
|
||||
compute_lookahead_tokens (void)
|
||||
{
|
||||
size_t i;
|
||||
goto_list *sp;
|
||||
@@ -331,27 +332,27 @@ compute_look_ahead_tokens (void)
|
||||
}
|
||||
|
||||
|
||||
/*-----------------------------------------------------.
|
||||
| Count the number of look-ahead tokens required for S |
|
||||
| (N_LOOK_AHEAD_TOKENS member). |
|
||||
`-----------------------------------------------------*/
|
||||
/*----------------------------------------------------.
|
||||
| Count the number of lookahead tokens required for S |
|
||||
| (N_LOOKAHEAD_TOKENS member). |
|
||||
`----------------------------------------------------*/
|
||||
|
||||
static int
|
||||
state_look_ahead_tokens_count (state *s)
|
||||
state_lookahead_tokens_count (state *s)
|
||||
{
|
||||
int k;
|
||||
int n_look_ahead_tokens = 0;
|
||||
int n_lookahead_tokens = 0;
|
||||
reductions *rp = s->reductions;
|
||||
transitions *sp = s->transitions;
|
||||
|
||||
/* We need a look-ahead either to distinguish different
|
||||
/* We need a lookahead either to distinguish different
|
||||
reductions (i.e., there are two or more), or to distinguish a
|
||||
reduction from a shift. Otherwise, it is straightforward,
|
||||
and the state is `consistent'. */
|
||||
if (rp->num > 1
|
||||
|| (rp->num == 1 && sp->num &&
|
||||
!TRANSITION_IS_DISABLED (sp, 0) && TRANSITION_IS_SHIFT (sp, 0)))
|
||||
n_look_ahead_tokens += rp->num;
|
||||
n_lookahead_tokens += rp->num;
|
||||
else
|
||||
s->consistent = 1;
|
||||
|
||||
@@ -362,13 +363,13 @@ state_look_ahead_tokens_count (state *s)
|
||||
break;
|
||||
}
|
||||
|
||||
return n_look_ahead_tokens;
|
||||
return n_lookahead_tokens;
|
||||
}
|
||||
|
||||
|
||||
/*-----------------------------------------------------.
|
||||
| Compute LA, NLA, and the look_ahead_tokens members. |
|
||||
`-----------------------------------------------------*/
|
||||
/*----------------------------------------------------.
|
||||
| Compute LA, NLA, and the lookahead_tokens members. |
|
||||
`----------------------------------------------------*/
|
||||
|
||||
static void
|
||||
initialize_LA (void)
|
||||
@@ -376,10 +377,10 @@ initialize_LA (void)
|
||||
state_number i;
|
||||
bitsetv pLA;
|
||||
|
||||
/* Compute the total number of reductions requiring a look-ahead. */
|
||||
/* Compute the total number of reductions requiring a lookahead. */
|
||||
nLA = 0;
|
||||
for (i = 0; i < nstates; i++)
|
||||
nLA += state_look_ahead_tokens_count (states[i]);
|
||||
nLA += state_lookahead_tokens_count (states[i]);
|
||||
/* Avoid having to special case 0. */
|
||||
if (!nLA)
|
||||
nLA = 1;
|
||||
@@ -387,54 +388,54 @@ initialize_LA (void)
|
||||
pLA = LA = bitsetv_create (nLA, ntokens, BITSET_FIXED);
|
||||
lookback = xcalloc (nLA, sizeof *lookback);
|
||||
|
||||
/* Initialize the members LOOK_AHEAD_TOKENS for each state whose reductions
|
||||
require look-ahead tokens. */
|
||||
/* Initialize the members LOOKAHEAD_TOKENS for each state whose reductions
|
||||
require lookahead tokens. */
|
||||
for (i = 0; i < nstates; i++)
|
||||
{
|
||||
int count = state_look_ahead_tokens_count (states[i]);
|
||||
int count = state_lookahead_tokens_count (states[i]);
|
||||
if (count)
|
||||
{
|
||||
states[i]->reductions->look_ahead_tokens = pLA;
|
||||
states[i]->reductions->lookahead_tokens = pLA;
|
||||
pLA += count;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*----------------------------------------------.
|
||||
| Output the look-ahead tokens for each state. |
|
||||
`----------------------------------------------*/
|
||||
/*---------------------------------------------.
|
||||
| Output the lookahead tokens for each state. |
|
||||
`---------------------------------------------*/
|
||||
|
||||
static void
|
||||
look_ahead_tokens_print (FILE *out)
|
||||
lookahead_tokens_print (FILE *out)
|
||||
{
|
||||
state_number i;
|
||||
int j, k;
|
||||
fprintf (out, "Look-ahead tokens: BEGIN\n");
|
||||
fprintf (out, "Lookahead tokens: BEGIN\n");
|
||||
for (i = 0; i < nstates; ++i)
|
||||
{
|
||||
reductions *reds = states[i]->reductions;
|
||||
bitset_iterator iter;
|
||||
int n_look_ahead_tokens = 0;
|
||||
int n_lookahead_tokens = 0;
|
||||
|
||||
if (reds->look_ahead_tokens)
|
||||
if (reds->lookahead_tokens)
|
||||
for (k = 0; k < reds->num; ++k)
|
||||
if (reds->look_ahead_tokens[k])
|
||||
++n_look_ahead_tokens;
|
||||
if (reds->lookahead_tokens[k])
|
||||
++n_lookahead_tokens;
|
||||
|
||||
fprintf (out, "State %d: %d look-ahead tokens\n",
|
||||
i, n_look_ahead_tokens);
|
||||
fprintf (out, "State %d: %d lookahead tokens\n",
|
||||
i, n_lookahead_tokens);
|
||||
|
||||
if (reds->look_ahead_tokens)
|
||||
if (reds->lookahead_tokens)
|
||||
for (j = 0; j < reds->num; ++j)
|
||||
BITSET_FOR_EACH (iter, reds->look_ahead_tokens[j], k, 0)
|
||||
BITSET_FOR_EACH (iter, reds->lookahead_tokens[j], k, 0)
|
||||
{
|
||||
fprintf (out, " on %d (%s) -> rule %d\n",
|
||||
k, symbols[k]->tag,
|
||||
reds->rules[j]->number);
|
||||
};
|
||||
}
|
||||
fprintf (out, "Look-ahead tokens: END\n");
|
||||
fprintf (out, "Lookahead tokens: END\n");
|
||||
}
|
||||
|
||||
void
|
||||
@@ -445,10 +446,10 @@ lalr (void)
|
||||
initialize_F ();
|
||||
build_relations ();
|
||||
compute_FOLLOWS ();
|
||||
compute_look_ahead_tokens ();
|
||||
compute_lookahead_tokens ();
|
||||
|
||||
if (trace_flag & trace_sets)
|
||||
look_ahead_tokens_print (stderr);
|
||||
lookahead_tokens_print (stderr);
|
||||
}
|
||||
|
||||
|
||||
@@ -457,6 +458,6 @@ lalr_free (void)
|
||||
{
|
||||
state_number s;
|
||||
for (s = 0; s < nstates; ++s)
|
||||
states[s]->reductions->look_ahead_tokens = NULL;
|
||||
states[s]->reductions->lookahead_tokens = NULL;
|
||||
bitsetv_free (LA);
|
||||
}
|
||||
|
||||
+25
-19
@@ -1,6 +1,6 @@
|
||||
/* Compute look-ahead criteria for bison,
|
||||
/* Compute lookahead criteria for bison,
|
||||
|
||||
Copyright (C) 1984, 1986, 1989, 2000, 2002, 2004 Free Software
|
||||
Copyright (C) 1984, 1986, 1989, 2000, 2002, 2004, 2006 Free Software
|
||||
Foundation, Inc.
|
||||
|
||||
This file is part of Bison, the GNU Compiler Compiler.
|
||||
@@ -32,35 +32,41 @@
|
||||
/* Import the definition of CORE, TRANSITIONS and REDUCTIONS. */
|
||||
# include "state.h"
|
||||
|
||||
/* Compute how to make the finite state machine deterministic; find
|
||||
which rules need look-ahead in each state, and which look-ahead
|
||||
tokens they accept. */
|
||||
|
||||
/** Build the LALR(1) automaton.
|
||||
|
||||
Compute how to make the finite state machine deterministic; find
|
||||
which rules need lookahead in each state, and which lookahead
|
||||
tokens they accept.
|
||||
|
||||
Builds:
|
||||
- #goto_map
|
||||
- #from_state
|
||||
- #to_state
|
||||
*/
|
||||
void lalr (void);
|
||||
|
||||
/* Release the information related to look-ahead tokens. Can be performed
|
||||
once the action tables are computed. */
|
||||
|
||||
/** Release the information related to lookahead tokens.
|
||||
|
||||
Can be performed once the action tables are computed. */
|
||||
void lalr_free (void);
|
||||
|
||||
|
||||
/* lalr() builds these data structures. */
|
||||
|
||||
/* GOTO_MAP, FROM_STATE and TO_STATE -- record each shift transition
|
||||
which accepts a variable (a nonterminal).
|
||||
|
||||
FROM_STATE[T] -- state number which a transition leads from.
|
||||
TO_STATE[T] -- state number it leads to.
|
||||
|
||||
All the transitions that accept a particular variable are grouped
|
||||
together and GOTO_MAP[I - NTOKENS] is the index in FROM_STATE and
|
||||
TO_STATE of the first of them. */
|
||||
|
||||
typedef size_t goto_number;
|
||||
# define GOTO_NUMBER_MAXIMUM ((goto_number) -1)
|
||||
|
||||
/** Index into #from_state and #to_state.
|
||||
|
||||
All the transitions that accept a particular variable are grouped
|
||||
together and GOTO_MAP[I - NTOKENS] is the index in FROM_STATE and
|
||||
TO_STATE of the first of them. */
|
||||
extern goto_number *goto_map;
|
||||
|
||||
/** State number which a transition leads from. */
|
||||
extern state_number *from_state;
|
||||
|
||||
/** State number it leads to. */
|
||||
extern state_number *to_state;
|
||||
|
||||
|
||||
|
||||
+77
-5
@@ -1,5 +1,5 @@
|
||||
/* Locations for Bison
|
||||
Copyright (C) 2002 Free Software Foundation, Inc.
|
||||
Copyright (C) 2002, 2005, 2006 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of Bison, the GNU Compiler Compiler.
|
||||
|
||||
@@ -18,19 +18,91 @@
|
||||
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
Boston, MA 02110-1301, USA. */
|
||||
|
||||
#include <config.h>
|
||||
#include "system.h"
|
||||
|
||||
#include <mbswidth.h>
|
||||
#include <quotearg.h>
|
||||
|
||||
#include "complain.h"
|
||||
#include "location.h"
|
||||
|
||||
location const empty_location;
|
||||
|
||||
/* If BUF is null, add BUFSIZE (which in this case must be less than
|
||||
INT_MAX) to COLUMN; otherwise, add mbsnwidth (BUF, BUFSIZE, 0) to
|
||||
COLUMN. If an overflow occurs, or might occur but is undetectable,
|
||||
return INT_MAX. Assume COLUMN is nonnegative. */
|
||||
|
||||
static inline int
|
||||
add_column_width (int column, char const *buf, size_t bufsize)
|
||||
{
|
||||
size_t width;
|
||||
unsigned int remaining_columns = INT_MAX - column;
|
||||
|
||||
if (buf)
|
||||
{
|
||||
if (INT_MAX / 2 <= bufsize)
|
||||
return INT_MAX;
|
||||
width = mbsnwidth (buf, bufsize, 0);
|
||||
}
|
||||
else
|
||||
width = bufsize;
|
||||
|
||||
return width <= remaining_columns ? column + width : INT_MAX;
|
||||
}
|
||||
|
||||
/* Set *LOC and adjust scanner cursor to account for token TOKEN of
|
||||
size SIZE. */
|
||||
|
||||
void
|
||||
location_compute (location *loc, boundary *cur, char const *token, size_t size)
|
||||
{
|
||||
int line = cur->line;
|
||||
int column = cur->column;
|
||||
char const *p0 = token;
|
||||
char const *p = token;
|
||||
char const *lim = token + size;
|
||||
|
||||
loc->start = *cur;
|
||||
|
||||
for (p = token; p < lim; p++)
|
||||
switch (*p)
|
||||
{
|
||||
case '\n':
|
||||
line += line < INT_MAX;
|
||||
column = 1;
|
||||
p0 = p + 1;
|
||||
break;
|
||||
|
||||
case '\t':
|
||||
column = add_column_width (column, p0, p - p0);
|
||||
column = add_column_width (column, NULL, 8 - ((column - 1) & 7));
|
||||
p0 = p + 1;
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
cur->line = line;
|
||||
cur->column = column = add_column_width (column, p0, p - p0);
|
||||
|
||||
loc->end = *cur;
|
||||
|
||||
if (line == INT_MAX && loc->start.line != INT_MAX)
|
||||
warn_at (*loc, _("line number overflow"));
|
||||
if (column == INT_MAX && loc->start.column != INT_MAX)
|
||||
warn_at (*loc, _("column number overflow"));
|
||||
}
|
||||
|
||||
|
||||
/* Output to OUT the location LOC.
|
||||
Warning: it uses quotearg's slot 3. */
|
||||
void
|
||||
location_print (FILE *out, location loc)
|
||||
{
|
||||
int end_col = 0 < loc.end.column ? loc.end.column - 1 : 0;
|
||||
fprintf (out, "%s:%d.%d",
|
||||
quotearg_n_style (3, escape_quoting_style, loc.start.file),
|
||||
loc.start.line, loc.start.column);
|
||||
@@ -38,9 +110,9 @@ location_print (FILE *out, location loc)
|
||||
if (loc.start.file != loc.end.file)
|
||||
fprintf (out, "-%s:%d.%d",
|
||||
quotearg_n_style (3, escape_quoting_style, loc.end.file),
|
||||
loc.end.line, loc.end.column - 1);
|
||||
loc.end.line, end_col);
|
||||
else if (loc.start.line < loc.end.line)
|
||||
fprintf (out, "-%d.%d", loc.end.line, loc.end.column - 1);
|
||||
else if (loc.start.column < loc.end.column - 1)
|
||||
fprintf (out, "-%d", loc.end.column - 1);
|
||||
fprintf (out, "-%d.%d", loc.end.line, end_col);
|
||||
else if (loc.start.column < end_col)
|
||||
fprintf (out, "-%d", end_col);
|
||||
}
|
||||
|
||||
+20
-4
@@ -1,5 +1,5 @@
|
||||
/* Locations for Bison
|
||||
Copyright (C) 2002, 2004 Free Software Foundation, Inc.
|
||||
Copyright (C) 2002, 2004, 2005, 2006 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of Bison, the GNU Compiler Compiler.
|
||||
|
||||
@@ -29,15 +29,26 @@ typedef struct
|
||||
/* The name of the file that contains the boundary. */
|
||||
uniqstr file;
|
||||
|
||||
/* The (origin-1) line that contains the boundary. */
|
||||
/* The (origin-1) line that contains the boundary.
|
||||
If this is INT_MAX, the line number has overflowed. */
|
||||
int line;
|
||||
|
||||
/* The (origin-1) column just after the boundary. This is neither a
|
||||
byte count, nor a character count; it is a column count. */
|
||||
byte count, nor a character count; it is a column count.
|
||||
If this is INT_MAX, the column number has overflowed. */
|
||||
int column;
|
||||
|
||||
} boundary;
|
||||
|
||||
/* Set the position of \a a. */
|
||||
static inline void
|
||||
boundary_set (boundary *b, const char *f, int l, int c)
|
||||
{
|
||||
b->file = f;
|
||||
b->line = l;
|
||||
b->column = c;
|
||||
}
|
||||
|
||||
/* Return nonzero if A and B are equal boundaries. */
|
||||
static inline bool
|
||||
equal_boundaries (boundary a, boundary b)
|
||||
@@ -62,6 +73,11 @@ typedef struct
|
||||
|
||||
extern location const empty_location;
|
||||
|
||||
void location_print (FILE *, location);
|
||||
/* Set *LOC and adjust scanner cursor to account for token TOKEN of
|
||||
size SIZE. */
|
||||
void location_compute (location *loc,
|
||||
boundary *cur, char const *token, size_t size);
|
||||
|
||||
void location_print (FILE *out, location loc);
|
||||
|
||||
#endif /* ! defined LOCATION_H_ */
|
||||
|
||||
+7
-13
@@ -1,6 +1,7 @@
|
||||
/* Top level entry point of Bison.
|
||||
|
||||
Copyright (C) 1984, 1986, 1989, 1992, 1995, 2000, 2001, 2002, 2004, 2005
|
||||
Copyright (C) 1984, 1986, 1989, 1992, 1995, 2000, 2001, 2002, 2004, 2005,
|
||||
2006
|
||||
Free Software Foundation, Inc.
|
||||
|
||||
This file is part of Bison, the GNU Compiler Compiler.
|
||||
@@ -20,7 +21,7 @@
|
||||
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
Boston, MA 02110-1301, USA. */
|
||||
|
||||
|
||||
#include <config.h>
|
||||
#include "system.h"
|
||||
|
||||
#include <bitset_stats.h>
|
||||
@@ -42,6 +43,7 @@
|
||||
#include "print_graph.h"
|
||||
#include "reader.h"
|
||||
#include "reduce.h"
|
||||
#include "scan-gram.h"
|
||||
#include "symtab.h"
|
||||
#include "tables.h"
|
||||
#include "uniqstr.h"
|
||||
@@ -108,7 +110,7 @@ main (int argc, char *argv[])
|
||||
timevar_pop (TV_LALR);
|
||||
|
||||
/* Find and record any conflicts: places where one token of
|
||||
look-ahead is not enough to disambiguate the parsing. In file
|
||||
lookahead is not enough to disambiguate the parsing. In file
|
||||
conflicts. Also resolve s/r conflicts based on precedence
|
||||
declarations. */
|
||||
timevar_push (TV_CONFLICTS);
|
||||
@@ -148,7 +150,7 @@ main (int argc, char *argv[])
|
||||
if (complaint_issued)
|
||||
goto finish;
|
||||
|
||||
/* Look-ahead tokens are no longer needed. */
|
||||
/* Lookahead tokens are no longer needed. */
|
||||
timevar_push (TV_FREE);
|
||||
lalr_free ();
|
||||
timevar_pop (TV_FREE);
|
||||
@@ -169,17 +171,9 @@ main (int argc, char *argv[])
|
||||
|
||||
/* The scanner memory cannot be released right after parsing, as it
|
||||
contains things such as user actions, prologue, epilogue etc. */
|
||||
scanner_free ();
|
||||
gram_scanner_free ();
|
||||
muscle_free ();
|
||||
uniqstrs_free ();
|
||||
/* If using alloca.c, flush the alloca'ed memory for the benefit of
|
||||
people running Bison as a library in IDEs. */
|
||||
#if C_ALLOCA
|
||||
{
|
||||
extern void *alloca (size_t);
|
||||
alloca (0);
|
||||
}
|
||||
#endif
|
||||
timevar_pop (TV_FREE);
|
||||
|
||||
if (trace_flag & trace_bitsets)
|
||||
|
||||
+5
-4
@@ -20,6 +20,7 @@
|
||||
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
Boston, MA 02110-1301, USA. */
|
||||
|
||||
#include <config.h>
|
||||
#include "system.h"
|
||||
|
||||
#include <hash.h>
|
||||
@@ -117,9 +118,9 @@ muscle_insert (const char *key, char *value)
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------.
|
||||
| Insert (KEY, VALUE). If KEY already existed, overwrite the |
|
||||
| previous value. Uses MUSCLE_OBSTACK. De-allocates the previously |
|
||||
| associated value. VALUE and SEPARATOR are copied. |
|
||||
| Append VALUE to the current value of KEY. If KEY did not already |
|
||||
| exist, create it. Use MUSCLE_OBSTACK. De-allocate the previously |
|
||||
| associated value. Copy VALUE and SEPARATOR. |
|
||||
`-------------------------------------------------------------------*/
|
||||
|
||||
void
|
||||
@@ -197,7 +198,7 @@ void muscle_pair_list_grow (const char *muscle,
|
||||
| Find the value of muscle KEY. |
|
||||
`-------------------------------*/
|
||||
|
||||
char*
|
||||
char *
|
||||
muscle_find (const char *key)
|
||||
{
|
||||
muscle_entry probe;
|
||||
|
||||
+3
-3
@@ -82,9 +82,9 @@ extern struct obstack muscle_obstack;
|
||||
muscle_insert (Key, obstack_finish (&muscle_obstack)); \
|
||||
}
|
||||
|
||||
/* Insert (KEY, VALUE). If KEY already existed, overwrite the
|
||||
previous value. Uses MUSCLE_OBSTACK. De-allocates the previously
|
||||
associated value. VALUE and SEPARATOR are copied. */
|
||||
/* Append VALUE to the current value of KEY. If KEY did not already
|
||||
exist, create it. Use MUSCLE_OBSTACK. De-allocate the previously
|
||||
associated value. Copy VALUE and SEPARATOR. */
|
||||
|
||||
void muscle_grow (const char *key, const char *value, const char *separator);
|
||||
|
||||
|
||||
+5
-4
@@ -1,7 +1,7 @@
|
||||
/* Calculate which nonterminals can expand into the null string for Bison.
|
||||
|
||||
Copyright (C) 1984, 1989, 2000, 2001, 2002, 2003, 2004 Free
|
||||
Software Foundation, Inc.
|
||||
Copyright (C) 1984, 1989, 2000, 2001, 2002, 2003, 2004, 2005, 2006
|
||||
Free Software Foundation, Inc.
|
||||
|
||||
This file is part of Bison, the GNU Compiler Compiler.
|
||||
|
||||
@@ -25,6 +25,7 @@
|
||||
the null string. NULLABLE[I - NTOKENS] is nonzero if symbol I can
|
||||
do so. */
|
||||
|
||||
#include <config.h>
|
||||
#include "system.h"
|
||||
|
||||
#include "getargs.h"
|
||||
@@ -103,8 +104,8 @@ nullable_compute (void)
|
||||
else
|
||||
{
|
||||
/* This rule has an empty RHS. */
|
||||
if (item_number_as_rule_number (rules_ruleno->rhs[0]) != ruleno)
|
||||
abort ();
|
||||
assert (item_number_as_rule_number (rules_ruleno->rhs[0])
|
||||
== ruleno);
|
||||
if (rules_ruleno->useful
|
||||
&& ! nullable[rules_ruleno->lhs->number - ntokens])
|
||||
{
|
||||
|
||||
+42
-41
@@ -1,7 +1,7 @@
|
||||
/* Output the generated parsing program for Bison.
|
||||
|
||||
Copyright (C) 1984, 1986, 1989, 1992, 2000, 2001, 2002, 2003, 2004, 2005
|
||||
Free Software Foundation, Inc.
|
||||
Copyright (C) 1984, 1986, 1989, 1992, 2000, 2001, 2002, 2003, 2004,
|
||||
2005, 2006 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of Bison, the GNU Compiler Compiler.
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
02110-1301, USA. */
|
||||
|
||||
|
||||
#include <config.h>
|
||||
#include "system.h"
|
||||
|
||||
#include <error.h>
|
||||
@@ -36,6 +36,7 @@
|
||||
#include "muscle_tab.h"
|
||||
#include "output.h"
|
||||
#include "reader.h"
|
||||
#include "scan-code.h" /* max_left_semantic_context */
|
||||
#include "scan-skel.h"
|
||||
#include "symtab.h"
|
||||
#include "tables.h"
|
||||
@@ -43,9 +44,6 @@
|
||||
|
||||
static struct obstack format_obstack;
|
||||
|
||||
bool error_verbose = false;
|
||||
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------.
|
||||
| Create a function NAME which associates to the muscle NAME the |
|
||||
@@ -178,9 +176,7 @@ prepare_symbols (void)
|
||||
obstack_1grow (&format_obstack, ',');
|
||||
j += width;
|
||||
}
|
||||
/* Add a NULL entry to list of tokens (well, 0, as NULL might not be
|
||||
defined). */
|
||||
obstack_sgrow (&format_obstack, " 0");
|
||||
obstack_sgrow (&format_obstack, " ]b4_null[");
|
||||
|
||||
/* Finish table and store. */
|
||||
obstack_1grow (&format_obstack, 0);
|
||||
@@ -239,8 +235,7 @@ prepare_rules (void)
|
||||
/* Merger-function index (GLR). */
|
||||
merger[r] = rules[r].merger;
|
||||
}
|
||||
if (i != nritems)
|
||||
abort ();
|
||||
assert (i == nritems);
|
||||
|
||||
muscle_insert_item_number_table ("rhs", rhs, ritem[0], 1, nritems);
|
||||
muscle_insert_unsigned_int_table ("prhs", prhs, 0, 0, nrules);
|
||||
@@ -293,20 +288,16 @@ user_actions_output (FILE *out)
|
||||
{
|
||||
rule_number r;
|
||||
|
||||
fputs ("m4_define([b4_actions], \n[[", out);
|
||||
fputs ("m4_define([b4_actions], \n[", out);
|
||||
for (r = 0; r < nrules; ++r)
|
||||
if (rules[r].action)
|
||||
{
|
||||
fprintf (out, " case %d:\n", r + 1);
|
||||
|
||||
fprintf (out, "]b4_syncline(%d, ",
|
||||
fprintf (out, "b4_case(%d, [b4_syncline(%d, ", r + 1,
|
||||
rules[r].action_location.start.line);
|
||||
escaped_output (out, rules[r].action_location.start.file);
|
||||
fprintf (out, ")[\n");
|
||||
fprintf (out, " %s\n break;\n\n",
|
||||
rules[r].action);
|
||||
fprintf (out, ")\n[ %s]])\n\n", rules[r].action);
|
||||
}
|
||||
fputs ("]])\n\n", out);
|
||||
fputs ("])\n\n", out);
|
||||
}
|
||||
|
||||
/*--------------------------------------.
|
||||
@@ -351,8 +342,7 @@ token_definitions_output (FILE *out)
|
||||
/* At this stage, if there are literal aliases, they are part of
|
||||
SYMBOLS, so we should not find symbols which are the aliases
|
||||
here. */
|
||||
if (number == USER_NUMBER_ALIAS)
|
||||
abort ();
|
||||
assert (number != USER_NUMBER_ALIAS);
|
||||
|
||||
/* Skip error token. */
|
||||
if (sym == errtoken)
|
||||
@@ -394,7 +384,7 @@ symbol_destructors_output (FILE *out)
|
||||
|
||||
fputs ("m4_define([b4_symbol_destructors], \n[", out);
|
||||
for (i = 0; i < nsyms; ++i)
|
||||
if (symbols[i]->destructor)
|
||||
if (symbol_destructor_get (symbols[i]))
|
||||
{
|
||||
symbol *sym = symbols[i];
|
||||
|
||||
@@ -403,10 +393,12 @@ symbol_destructors_output (FILE *out)
|
||||
destructor, optional typename. */
|
||||
fprintf (out, "%s[", sep);
|
||||
sep = ",\n";
|
||||
escaped_output (out, sym->destructor_location.start.file);
|
||||
fprintf (out, ", %d, ", sym->destructor_location.start.line);
|
||||
escaped_output (out, symbol_destructor_location_get (sym).start.file);
|
||||
fprintf (out, ", %d, ",
|
||||
symbol_destructor_location_get (sym).start.line);
|
||||
escaped_output (out, sym->tag);
|
||||
fprintf (out, ", %d, [[%s]]", sym->number, sym->destructor);
|
||||
fprintf (out, ", %d, [[%s]]", sym->number,
|
||||
symbol_destructor_get (sym));
|
||||
if (sym->type_name)
|
||||
fprintf (out, ", [[%s]]", sym->type_name);
|
||||
fputc (']', out);
|
||||
@@ -427,7 +419,7 @@ symbol_printers_output (FILE *out)
|
||||
|
||||
fputs ("m4_define([b4_symbol_printers], \n[", out);
|
||||
for (i = 0; i < nsyms; ++i)
|
||||
if (symbols[i]->printer)
|
||||
if (symbol_printer_get (symbols[i]))
|
||||
{
|
||||
symbol *sym = symbols[i];
|
||||
|
||||
@@ -436,10 +428,10 @@ symbol_printers_output (FILE *out)
|
||||
printer, optional typename. */
|
||||
fprintf (out, "%s[", sep);
|
||||
sep = ",\n";
|
||||
escaped_output (out, sym->printer_location.start.file);
|
||||
fprintf (out, ", %d, ", sym->printer_location.start.line);
|
||||
escaped_output (out, symbol_printer_location_get (sym).start.file);
|
||||
fprintf (out, ", %d, ", symbol_printer_location_get (sym).start.line);
|
||||
escaped_output (out, sym->tag);
|
||||
fprintf (out, ", %d, [[%s]]", sym->number, sym->printer);
|
||||
fprintf (out, ", %d, [[%s]]", sym->number, symbol_printer_get (sym));
|
||||
if (sym->type_name)
|
||||
fprintf (out, ", [[%s]]", sym->type_name);
|
||||
fputc (']', out);
|
||||
@@ -452,7 +444,7 @@ static void
|
||||
prepare_actions (void)
|
||||
{
|
||||
/* Figure out the actions for the specified state, indexed by
|
||||
look-ahead token type. */
|
||||
lookahead token type. */
|
||||
|
||||
muscle_insert_rule_number_table ("defact", yydefact,
|
||||
yydefact[0], 1, nstates);
|
||||
@@ -515,7 +507,6 @@ output_skeleton (void)
|
||||
cheap sanity check is worthwhile. */
|
||||
char const m4sugar[] = "m4sugar/m4sugar.m4";
|
||||
char *full_m4sugar;
|
||||
char *full_cm4;
|
||||
char *full_skeleton;
|
||||
char const *p;
|
||||
char const *m4 = (p = getenv ("M4")) ? p : M4;
|
||||
@@ -531,28 +522,25 @@ output_skeleton (void)
|
||||
full_skeleton[pkgdatadirlen] = '/';
|
||||
strcpy (full_skeleton + pkgdatadirlen + 1, m4sugar);
|
||||
full_m4sugar = xstrdup (full_skeleton);
|
||||
strcpy (full_skeleton + pkgdatadirlen + 1, "c.m4");
|
||||
full_cm4 = xstrdup (full_skeleton);
|
||||
strcpy (full_skeleton + pkgdatadirlen + 1, skeleton);
|
||||
xfclose (xfopen (full_m4sugar, "r"));
|
||||
|
||||
/* Create an m4 subprocess connected to us via two pipes. */
|
||||
|
||||
if (trace_flag & trace_tools)
|
||||
fprintf (stderr, "running: %s %s - %s %s\n",
|
||||
m4, full_m4sugar, full_cm4, full_skeleton);
|
||||
fprintf (stderr, "running: %s %s - %s\n",
|
||||
m4, full_m4sugar, full_skeleton);
|
||||
|
||||
argv[0] = m4;
|
||||
argv[1] = full_m4sugar;
|
||||
argv[2] = "-";
|
||||
argv[3] = full_cm4;
|
||||
argv[4] = full_skeleton;
|
||||
argv[3] = full_skeleton;
|
||||
argv[4] = trace_flag & trace_m4 ? "-dV" : NULL;
|
||||
argv[5] = NULL;
|
||||
|
||||
init_subpipe ();
|
||||
pid = create_subpipe (argv, filter_fd);
|
||||
free (full_m4sugar);
|
||||
free (full_cm4);
|
||||
free (full_skeleton);
|
||||
|
||||
out = fdopen (filter_fd[0], "w");
|
||||
@@ -577,6 +565,7 @@ output_skeleton (void)
|
||||
|
||||
/* Read and process m4's output. */
|
||||
timevar_push (TV_M4);
|
||||
end_of_output_subpipe (pid, filter_fd);
|
||||
in = fdopen (filter_fd[1], "r");
|
||||
if (! in)
|
||||
error (EXIT_FAILURE, get_errno (),
|
||||
@@ -591,15 +580,27 @@ static void
|
||||
prepare (void)
|
||||
{
|
||||
/* Flags. */
|
||||
MUSCLE_INSERT_BOOL ("debug", debug_flag);
|
||||
MUSCLE_INSERT_BOOL ("debug_flag", debug_flag);
|
||||
MUSCLE_INSERT_BOOL ("defines_flag", defines_flag);
|
||||
MUSCLE_INSERT_BOOL ("error_verbose", error_verbose);
|
||||
MUSCLE_INSERT_BOOL ("error_verbose_flag", error_verbose);
|
||||
MUSCLE_INSERT_BOOL ("locations_flag", locations_flag);
|
||||
MUSCLE_INSERT_BOOL ("pure", pure_parser);
|
||||
MUSCLE_INSERT_BOOL ("pure_flag", pure_parser);
|
||||
MUSCLE_INSERT_BOOL ("synclines_flag", !no_lines_flag);
|
||||
MUSCLE_INSERT_BOOL ("tag_seen_flag", tag_seen);
|
||||
MUSCLE_INSERT_BOOL ("yacc_flag", yacc_flag);
|
||||
|
||||
/* File names. */
|
||||
MUSCLE_INSERT_STRING ("prefix", spec_name_prefix ? spec_name_prefix : "yy");
|
||||
#define DEFINE(Name) MUSCLE_INSERT_STRING (#Name, Name ? Name : "")
|
||||
DEFINE (dir_prefix);
|
||||
DEFINE (parser_file_name);
|
||||
DEFINE (spec_defines_file);
|
||||
DEFINE (spec_file_prefix);
|
||||
DEFINE (spec_graph_file);
|
||||
DEFINE (spec_name_prefix);
|
||||
DEFINE (spec_outfile);
|
||||
DEFINE (spec_verbose_file);
|
||||
#undef DEFINE
|
||||
|
||||
/* User Code. */
|
||||
obstack_1grow (&pre_prologue_obstack, 0);
|
||||
|
||||
+1
-3
@@ -1,5 +1,5 @@
|
||||
/* Output the generated parsing program for bison,
|
||||
Copyright (C) 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
|
||||
Copyright (C) 2000, 2001, 2002, 2003, 2006 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of Bison, the GNU Compiler Compiler.
|
||||
|
||||
@@ -21,8 +21,6 @@
|
||||
#ifndef OUTPUT_H_
|
||||
# define OUTPUT_H_
|
||||
|
||||
extern bool error_verbose;
|
||||
|
||||
/* Output the parsing tables and the parser code to FTABLE. */
|
||||
void output (void);
|
||||
|
||||
|
||||
+1424
-978
File diff suppressed because it is too large
Load Diff
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user