mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-08-12 04:05:14 +00:00
Compare commits
946
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
2caaeba496 | ||
|
|
95a65a3215 | ||
|
|
33e523878b | ||
|
|
2360e39906 | ||
|
|
10082ac068 | ||
|
|
de64159e7f | ||
|
|
280c40a350 | ||
|
|
c1cf82f9c8 | ||
|
|
55947367c6 | ||
|
|
b4e9eaefd5 | ||
|
|
1a968edcb8 | ||
|
|
82fa282a1b | ||
|
|
e504c843c1 | ||
|
|
3fda8335bf | ||
|
|
9645a2b20e | ||
|
|
7ff6b7bbca | ||
|
|
44e76d801f | ||
|
|
32e0fd1a99 | ||
|
|
b610f43f25 | ||
|
|
f348522005 | ||
|
|
e866c476fd | ||
|
|
72252aaa97 | ||
|
|
a1513c265b | ||
|
|
425044a936 | ||
|
|
5010af94d0 | ||
|
|
005ea24cbb | ||
|
|
adf0425d11 | ||
|
|
cb4e7ecefa | ||
|
|
2e9ad04cdb | ||
|
|
28cde9c128 | ||
|
|
d288047e9b | ||
|
|
d135a16792 | ||
|
|
75417c1c1c | ||
|
|
8bc4348cc7 | ||
|
|
1113522acb | ||
|
|
45b9d97b54 | ||
|
|
b01b80836d | ||
|
|
bd07c76b0a | ||
|
|
45ca5043ce | ||
|
|
ef98967ada | ||
|
|
7783ba2d4f | ||
|
|
bbd17b68fb | ||
|
|
30c179fee8 | ||
|
|
7ab25ad020 | ||
|
|
e555fb5e55 | ||
|
|
0931d14728 | ||
|
|
e76245fcd9 | ||
|
|
c2de9dafd1 | ||
|
|
f7de571ff1 | ||
|
|
c226d4ed48 | ||
|
|
9df53e7288 | ||
|
|
9a5c688ae4 | ||
|
|
e3b7c01820 | ||
|
|
5cc5703239 | ||
|
|
c8dc9a8f51 | ||
|
|
f9a6b34147 | ||
|
|
48828e779f | ||
|
|
4ad0ed3425 | ||
|
|
ad42f96053 | ||
|
|
4410084223 | ||
|
|
ccc759e81a | ||
|
|
e19e088e66 | ||
|
|
9c80fa286e | ||
|
|
da8f4a2f5f | ||
|
|
f18f71cfb0 | ||
|
|
11548b8e68 | ||
|
|
b79b889de5 | ||
|
|
7b24c424b5 | ||
|
|
0d06a966f8 | ||
|
|
3df32101e7 | ||
|
|
c699078246 | ||
|
|
4c7377f499 | ||
|
|
9502b2ab48 | ||
|
|
a0f33a28e9 | ||
|
|
0def17c3d1 | ||
|
|
d2e7bc1613 | ||
|
|
70875b4873 | ||
|
|
34d1773990 | ||
|
|
27767290da | ||
|
|
2efaa8e96a | ||
|
|
4cdcb6f243 | ||
|
|
7f42eb0a5e | ||
|
|
d03ad8b686 | ||
|
|
f462a08572 | ||
|
|
0ac08d2d6c | ||
|
|
6053dcae59 | ||
|
|
5952fe5abf | ||
|
|
d0447d949b | ||
|
|
f3bd6a25bf | ||
|
|
38d91ccd96 | ||
|
|
0dfa650f59 | ||
|
|
1e7a8315f6 | ||
|
|
4eeec4e41f | ||
|
|
6fd3372db4 | ||
|
|
f24afe4435 | ||
|
|
1047f3c095 | ||
|
|
928a817418 | ||
|
|
ae8d777ad6 | ||
|
|
d17dc9a8b5 | ||
|
|
7bb478bd19 | ||
|
|
9c29c52fce | ||
|
|
2a11380460 | ||
|
|
77a0e35143 | ||
|
|
2e9e591889 | ||
|
|
a6ec9ca2f1 | ||
|
|
370a302f34 | ||
|
|
2b5a27ba3d | ||
|
|
d132c2d545 | ||
|
|
bb45005671 | ||
|
|
0afeaa2ab7 | ||
|
|
dbd1609311 | ||
|
|
ad9500f3fd | ||
|
|
76bd8a6b4a | ||
|
|
7e6bd4bb33 | ||
|
|
e1dd2807e6 | ||
|
|
96748b2bf8 | ||
|
|
4b314bdb6d | ||
|
|
d855f6c806 | ||
|
|
1ee41a50d9 | ||
|
|
8bf276d820 | ||
|
|
476c1cca59 | ||
|
|
55fb68aabf | ||
|
|
0d40b36417 | ||
|
|
b809770efb | ||
|
|
009285d20a | ||
|
|
3e8d1bd053 | ||
|
|
32ea6125e3 | ||
|
|
baa423bd59 | ||
|
|
75fbe357c8 | ||
|
|
a668f48631 | ||
|
|
3d75e7de1e | ||
|
|
9524161147 | ||
|
|
d6445ec10b | ||
|
|
7ca7a3abf3 | ||
|
|
c4e686a1ab | ||
|
|
2646fd012d | ||
|
|
a2c525b34c | ||
|
|
658b189348 | ||
|
|
a06344172a | ||
|
|
573654ca9e | ||
|
|
0b0370ff42 | ||
|
|
eaa476a7e9 | ||
|
|
16832bf546 | ||
|
|
eabb3df7aa | ||
|
|
0ab29b7c20 | ||
|
|
559b30881d | ||
|
|
88ffc4b907 | ||
|
|
3e82dfaa0d | ||
|
|
11d820174f | ||
|
|
da6f07468a | ||
|
|
93ee7a47e7 | ||
|
|
875ef1b90c | ||
|
|
650af77812 | ||
|
|
c03a8db0cc | ||
|
|
8b06c6b871 | ||
|
|
c5da1a2adc | ||
|
|
dfd5b89d01 | ||
|
|
ca5a716303 | ||
|
|
d72642d691 | ||
|
|
9a91e7f246 | ||
|
|
671850a1c3 | ||
|
|
ee028dceff | ||
|
|
e1d06b5235 | ||
|
|
821394a3c8 | ||
|
|
00cebd11d4 | ||
|
|
ee2f433512 | ||
|
|
5422471cbb | ||
|
|
8a4ec3595b | ||
|
|
7cf84b13a0 | ||
|
|
56351d4c7b | ||
|
|
478c4a8f49 | ||
|
|
13e294ee55 | ||
|
|
a16074bb09 | ||
|
|
8386f6ef28 | ||
|
|
827bc59ca1 | ||
|
|
3209eb1c4c | ||
|
|
975bb56431 | ||
|
|
8d4dc896cb | ||
|
|
a3c3c6f242 | ||
|
|
179b2419ba | ||
|
|
b702ec61ab | ||
|
|
ab96bb2457 | ||
|
|
fc51acddb4 | ||
|
|
957255b82c | ||
|
|
8044fda634 | ||
|
|
b7d4c48e55 | ||
|
|
b167e7ba0d | ||
|
|
85d57e27d2 | ||
|
|
461f1516f8 | ||
|
|
26eb4f0bdc | ||
|
|
fc6c85664a | ||
|
|
0bd5ee5f89 | ||
|
|
a3efd13e44 | ||
|
|
a4122000c6 | ||
|
|
461983270c | ||
|
|
ea99d6e6a0 | ||
|
|
184b42c85b | ||
|
|
be29c71dd8 | ||
|
|
d439985436 | ||
|
|
f3d2a1b2ac | ||
|
|
21cf80399f | ||
|
|
7b0ca050f7 | ||
|
|
a339aef48a | ||
|
|
44186fc4ec | ||
|
|
5c77412162 | ||
|
|
5cf6e669af | ||
|
|
16bb9f1647 | ||
|
|
edb2e90531 | ||
|
|
6d94eebba7 | ||
|
|
c2ecada32b | ||
|
|
458171e6df | ||
|
|
8d0b7cef7d | ||
|
|
afc4457605 | ||
|
|
60dcc936ce | ||
|
|
ad9d4f9f2e | ||
|
|
3cc83855d9 | ||
|
|
5407fc7d76 | ||
|
|
516652b474 | ||
|
|
026816664f | ||
|
|
265640d56e | ||
|
|
ee9cdb8595 | ||
|
|
a810712331 | ||
|
|
1a9646fc91 | ||
|
|
67411a88a0 | ||
|
|
0bfe22b6d5 | ||
|
|
3a684d611e | ||
|
|
a9733794bb | ||
|
|
19fe1aa332 | ||
|
|
39bace5da8 | ||
|
|
071863b3d8 | ||
|
|
e4678430c2 | ||
|
|
2b7fe38c36 | ||
|
|
4c4191cec2 | ||
|
|
ae7cd18c98 | ||
|
|
4f3cc9c21b | ||
|
|
55a2063005 | ||
|
|
77482f2783 | ||
|
|
5a6e85fb8d | ||
|
|
9e87ff5472 | ||
|
|
3afe18fd1f | ||
|
|
b51cf830a6 | ||
|
|
66b03e134f | ||
|
|
3dc50b3bc2 | ||
|
|
0a244a2269 | ||
|
|
b5e27aa262 | ||
|
|
0149d39e6e | ||
|
|
1d91bfdf1c | ||
|
|
db40c3f869 | ||
|
|
b663fd5322 | ||
|
|
a728075710 | ||
|
|
c4aa4ff541 | ||
|
|
b97bbbaed7 | ||
|
|
e386b50f26 | ||
|
|
534497f54b | ||
|
|
a62a7b014c | ||
|
|
de1a2f20dd | ||
|
|
afcc58c63e | ||
|
|
d3ae5af6ec | ||
|
|
41dfa1cbf0 | ||
|
|
b7171c45f4 | ||
|
|
ac953ff80a | ||
|
|
facb910cbd | ||
|
|
8faace8d1d | ||
|
|
9cdcbdf2cf | ||
|
|
45c64fa627 | ||
|
|
58b465ae5f | ||
|
|
d116722c54 | ||
|
|
1d678854a4 | ||
|
|
28c4075b58 | ||
|
|
aa94def12d | ||
|
|
0fcc2e9a74 | ||
|
|
94a6225578 | ||
|
|
02798ba13d | ||
|
|
8e13c5c03b | ||
|
|
266cdc3025 | ||
|
|
fea2516636 | ||
|
|
c0ef22ab0b | ||
|
|
971ef18e30 | ||
|
|
ec991d74e1 | ||
|
|
c0efa83c0b | ||
|
|
e37054cf27 | ||
|
|
89ff1b5e71 | ||
|
|
f122444873 | ||
|
|
30465cb778 | ||
|
|
f9340b27b2 | ||
|
|
f249e803f0 | ||
|
|
dfb12d6845 | ||
|
|
d8ce703102 | ||
|
|
8782fe26cb | ||
|
|
7ba01e111c | ||
|
|
6ce4b4ff1b | ||
|
|
332019e19a | ||
|
|
9402b62353 | ||
|
|
985d7177e8 | ||
|
|
7dbadca2d0 | ||
|
|
3f21a394f4 | ||
|
|
827aca04eb | ||
|
|
ff2e3d397a | ||
|
|
aba47f5624 | ||
|
|
abcfd805b8 | ||
|
|
1f5542fe2d | ||
|
|
d065cb3853 | ||
|
|
c53b684889 | ||
|
|
5fad4d4f09 | ||
|
|
7956485cd6 | ||
|
|
bb4b189b9c | ||
|
|
d9cfa2bee2 | ||
|
|
0f9583b69b | ||
|
|
c98b5143b0 | ||
|
|
07e65a77aa | ||
|
|
ee616bdc62 | ||
|
|
630a021850 | ||
|
|
75ae829984 | ||
|
|
08cc1a3b18 | ||
|
|
edaa22ec15 | ||
|
|
cc8962bdde | ||
|
|
435575cb5e | ||
|
|
1fa19a7697 | ||
|
|
d1a07886ee | ||
|
|
71846502ae | ||
|
|
90b89dadb2 | ||
|
|
e4d49586b6 | ||
|
|
21e3a2b56c | ||
|
|
cb8d8bb9b6 | ||
|
|
e52ddf820b | ||
|
|
6574576cfb | ||
|
|
dde95ca432 | ||
|
|
6155db81aa | ||
|
|
11872a8372 | ||
|
|
49964a4fe0 | ||
|
|
68f91d58f1 | ||
|
|
42bcf1ce44 | ||
|
|
de7331a075 | ||
|
|
b0db817ff2 | ||
|
|
a565f73276 | ||
|
|
3cf3393bd4 | ||
|
|
e83be476a5 | ||
|
|
80a2826e69 | ||
|
|
eb0e86ac80 | ||
|
|
57597927ef | ||
|
|
de5fb744c9 | ||
|
|
14bfd2e9d9 | ||
|
|
36a17b50b5 | ||
|
|
8a9283494b | ||
|
|
dac72a91d9 | ||
|
|
a17c70f876 | ||
|
|
c56d0037d2 | ||
|
|
9fb61ca8d8 | ||
|
|
3f6e5dd6ac | ||
|
|
2dc8862bab | ||
|
|
5202b6ac1d | ||
|
|
02879b4e81 | ||
|
|
f24695eff9 | ||
|
|
05e25f2384 | ||
|
|
f1526426cd | ||
|
|
7601a471f5 | ||
|
|
6c7022f7d3 | ||
|
|
edd3280b69 | ||
|
|
fe65b14424 | ||
|
|
e39fcdda38 | ||
|
|
5ae8eb3202 | ||
|
|
bbed3fdef6 | ||
|
|
42fef01256 | ||
|
|
29248b4c13 | ||
|
|
361444e419 | ||
|
|
85bc7f5466 | ||
|
|
1282c12476 | ||
|
|
0fe5a72a26 | ||
|
|
4c9b8f1318 | ||
|
|
45eebca42d | ||
|
|
d49751602c | ||
|
|
6240346aa0 | ||
|
|
09add9c24f | ||
|
|
8b807f1177 | ||
|
|
42d101da8d | ||
|
|
f68a49ed49 | ||
|
|
684083f065 | ||
|
|
8ecac08f2d | ||
|
|
fd003416d5 | ||
|
|
ae2b48f5c0 | ||
|
|
9e4917b2a1 | ||
|
|
12bc1c9e47 | ||
|
|
808e523db4 | ||
|
|
4a3c55cf1a | ||
|
|
c017f88fde | ||
|
|
219458e22f | ||
|
|
fec5f3c0cc | ||
|
|
9a9130f26d | ||
|
|
312d0d654f | ||
|
|
848bcc288d | ||
|
|
ec6dc4375e | ||
|
|
c21e515e05 | ||
|
|
1dce289a00 | ||
|
|
66c209cf43 | ||
|
|
efbc95a7e4 | ||
|
|
c5dbd909d0 | ||
|
|
6112cb1802 | ||
|
|
246ff8c1d3 | ||
|
|
f50fa14529 | ||
|
|
2c056d696d | ||
|
|
06505b0c69 | ||
|
|
e96415a54b | ||
|
|
f038e56cdc | ||
|
|
f2e1d4090d | ||
|
|
be6fa942ac | ||
|
|
f29f8af3ed | ||
|
|
74ce3cfbf6 | ||
|
|
b805eca764 | ||
|
|
e6c25014bb | ||
|
|
97ad789d10 | ||
|
|
d2f9ae18be | ||
|
|
cc2235ace2 | ||
|
|
df1ca1b0de | ||
|
|
1217688141 | ||
|
|
e8f7155d98 | ||
|
|
284bc49c83 | ||
|
|
fbecd2ab59 | ||
|
|
c13928073c | ||
|
|
2f0b97a271 | ||
|
|
ee9cf8c4a6 | ||
|
|
858666c443 | ||
|
|
ddb9db151b | ||
|
|
675d9fe489 | ||
|
|
26f95f5f35 | ||
|
|
7fc7df7a38 | ||
|
|
38cea49be1 | ||
|
|
23be254ef4 | ||
|
|
c32b9ec077 | ||
|
|
bb1c50d88b | ||
|
|
312c0cff71 | ||
|
|
15c14fdfb9 | ||
|
|
8458a41144 | ||
|
|
5cf79ede61 | ||
|
|
1b92213969 | ||
|
|
b20e797a71 | ||
|
|
dc8e535c37 | ||
|
|
66fb016e1d | ||
|
|
7d1aa2d636 | ||
|
|
26a4d3c895 | ||
|
|
97ae878ec3 | ||
|
|
5f87211cb4 | ||
|
|
9e62f1a657 | ||
|
|
c6a731eebb | ||
|
|
93561c21e8 | ||
|
|
9b3bb25885 | ||
|
|
f0f95a50ee | ||
|
|
d9fa1b7c4f | ||
|
|
aedcb6c095 | ||
|
|
c7442984e3 | ||
|
|
597afd73d7 | ||
|
|
56b91ae0b1 | ||
|
|
f42c012fcf | ||
|
|
3ef9fa8f83 | ||
|
|
70b7c35747 | ||
|
|
184878b9ca | ||
|
|
6908c2e1f7 | ||
|
|
32f4c0a1b2 | ||
|
|
492dacbc34 | ||
|
|
733fb7c593 | ||
|
|
403febcac5 | ||
|
|
60607adb3c | ||
|
|
8b4499ad04 | ||
|
|
3f4bc2c1dd | ||
|
|
7d6bad1959 | ||
|
|
f6df83b4e8 | ||
|
|
016426c195 | ||
|
|
0242bf04ac | ||
|
|
9c4788b7ee | ||
|
|
6656c9b52a | ||
|
|
04816a6f32 | ||
|
|
39ad6cc6ac | ||
|
|
bc19eadd65 | ||
|
|
1092d69c34 | ||
|
|
99d795e8f2 | ||
|
|
0707d0c7fa | ||
|
|
462b243e1d | ||
|
|
bb1f0f5226 | ||
|
|
e7b26e942d | ||
|
|
1dbaf37f5c | ||
|
|
ca42755f13 | ||
|
|
bcf54c336e | ||
|
|
19b1b96f87 | ||
|
|
dbf3962c35 | ||
|
|
a256496a3a | ||
|
|
4119d1ea60 | ||
|
|
bdcbadbe37 | ||
|
|
b8a8cc42c6 | ||
|
|
a565e60eef | ||
|
|
0904099dd5 | ||
|
|
d2e3c807dc | ||
|
|
258b45c86b | ||
|
|
c5ae8e85aa | ||
|
|
fd7f0289bc | ||
|
|
510c8497f8 | ||
|
|
432a008d34 | ||
|
|
c1b2677ad0 | ||
|
|
11aef5e95b | ||
|
|
0a9042a652 | ||
|
|
6f0a6f274c | ||
|
|
e672a4ba5e | ||
|
|
465df9c65c | ||
|
|
33f7f342c3 | ||
|
|
c95f5dadd6 | ||
|
|
28be3b8e53 | ||
|
|
e697f05b35 | ||
|
|
db598939b8 | ||
|
|
64b3612ab1 | ||
|
|
40bb6f78f8 | ||
|
|
304b384ea3 | ||
|
|
3fd1d6b2f3 | ||
|
|
4d9bdbe384 | ||
|
|
ae8880deec | ||
|
|
1a06f28efc | ||
|
|
bc6038978f | ||
|
|
53f8e4096d | ||
|
|
1dc927a7d4 | ||
|
|
55439a1cea | ||
|
|
e38106582f | ||
|
|
acb741cd8c | ||
|
|
781eaf908d | ||
|
|
ac826bc4b1 | ||
|
|
38de4e570f | ||
|
|
bd04adb4c8 | ||
|
|
0fe9720964 | ||
|
|
5cd907c478 | ||
|
|
a99ec53eb1 | ||
|
|
975bdced50 | ||
|
|
a89a5b1442 | ||
|
|
7be08dfbe7 | ||
|
|
35f70d169f | ||
|
|
7c0d37283d | ||
|
|
eaf690a700 | ||
|
|
56441943d0 | ||
|
|
65e0291619 | ||
|
|
ca90437a61 | ||
|
|
ea45ade792 | ||
|
|
f9f1b3ebbb | ||
|
|
ea9e670d72 | ||
|
|
bcd80897f3 | ||
|
|
50977317cd | ||
|
|
758f7cfc14 | ||
|
|
657ed6d3be | ||
|
|
d42e695e53 | ||
|
|
a73aa764a1 | ||
|
|
f039b51805 | ||
|
|
b9278c7d17 | ||
|
|
e96b1b2c45 | ||
|
|
ae9c90ba00 | ||
|
|
be27db79a5 | ||
|
|
2bd435c36c | ||
|
|
0a7b855930 | ||
|
|
c13bb3484c | ||
|
|
4b6d641913 | ||
|
|
bb990d3809 | ||
|
|
1127a75a72 | ||
|
|
fc28638e1c | ||
|
|
911537c30f | ||
|
|
0906b12cd5 | ||
|
|
d4fe9e88f3 | ||
|
|
be22823e78 | ||
|
|
235892350f | ||
|
|
c949ada3da | ||
|
|
d4dcde2b75 | ||
|
|
c8e966e272 | ||
|
|
d4728d92c7 | ||
|
|
09a1cd5e58 | ||
|
|
a24e6b0d21 | ||
|
|
1a9ac9bdba | ||
|
|
9318e335c8 | ||
|
|
fb6040f0a8 | ||
|
|
c49e2f1535 | ||
|
|
dbda560400 | ||
|
|
edf9a06f27 | ||
|
|
85a2f27fc4 | ||
|
|
28d16d1f7c | ||
|
|
f72721518b | ||
|
|
f3ead217b8 | ||
|
|
9960a6ae75 | ||
|
|
b56484a5d3 | ||
|
|
e35cd6def7 | ||
|
|
7ae57e2a35 | ||
|
|
7bada5355e | ||
|
|
505ece5171 | ||
|
|
3f5d1b2c67 | ||
|
|
0db2648930 | ||
|
|
d6dc4d36d1 | ||
|
|
effd30c08d | ||
|
|
9527072c95 | ||
|
|
a37131cc63 | ||
|
|
d4e985d587 | ||
|
|
064e42b0ac | ||
|
|
03dbf629d5 | ||
|
|
1c7ec959b1 | ||
|
|
6ee95cd0d9 | ||
|
|
8aef6e0db5 | ||
|
|
3804aa260b | ||
|
|
4c36bc2b8d | ||
|
|
5215919366 | ||
|
|
5807bb9156 | ||
|
|
511dd971ba | ||
|
|
371f1b2b7b | ||
|
|
1f1bd57297 | ||
|
|
6428a8a4a5 | ||
|
|
f5fceda596 | ||
|
|
dbb998364f | ||
|
|
2f130f199a | ||
|
|
15a1a08a87 | ||
|
|
589149dccf | ||
|
|
c6b1772473 | ||
|
|
c6bf97ccb4 | ||
|
|
fb4c8a7cb9 | ||
|
|
68ac70bc7b | ||
|
|
ac7f308c8e | ||
|
|
53e2cd1ebd | ||
|
|
c28cd5dc5a | ||
|
|
534cee7ae8 | ||
|
|
51356dd2ad | ||
|
|
96029914a6 | ||
|
|
06ec0105b1 | ||
|
|
05c93b7d84 | ||
|
|
be3517b007 | ||
|
|
489b320d4a | ||
|
|
ccda5c9eac | ||
|
|
9c16d39944 | ||
|
|
d42fe46ec3 | ||
|
|
2c08dc504c | ||
|
|
fbca394ee1 | ||
|
|
bfdcc3a0b2 | ||
|
|
ebbc76d0d7 | ||
|
|
9bf1eca7c9 | ||
|
|
2bb8f621eb | ||
|
|
3a526f5cc3 | ||
|
|
2cf5f72e9e | ||
|
|
369342dd3a | ||
|
|
6d58c63202 | ||
|
|
429436aaf2 | ||
|
|
3ada393894 | ||
|
|
9d2423f55d | ||
|
|
9d3f7eaf1d | ||
|
|
2ead0fb793 | ||
|
|
63951be29f | ||
|
|
0a36880ad1 | ||
|
|
5a000c51f7 | ||
|
|
e42906f790 | ||
|
|
049016237e | ||
|
|
3154ff8ef6 | ||
|
|
d03c0413f0 | ||
|
|
41a4806a82 | ||
|
|
8aaa0c2f86 | ||
|
|
63e8426ac6 | ||
|
|
a1d1ab50a0 | ||
|
|
3237f57096 | ||
|
|
7d846072c7 | ||
|
|
8b49e6bfc5 | ||
|
|
0e1ccdfae0 | ||
|
|
86649705b4 | ||
|
|
7dbb8d8aba | ||
|
|
3472de825e | ||
|
|
3112e7a82b | ||
|
|
e36ec1f41f | ||
|
|
0b3287025d | ||
|
|
62cb570a8d | ||
|
|
95066e9208 | ||
|
|
baf0bd6145 | ||
|
|
623a5147e6 | ||
|
|
b720fedf83 | ||
|
|
a7ab55af2a | ||
|
|
003db649bb | ||
|
|
a21733f2b4 | ||
|
|
a68b1f237e | ||
|
|
32288c8cbd | ||
|
|
ed91d427fe | ||
|
|
e89d8806ea | ||
|
|
23ac665d21 | ||
|
|
ac0eca3ccb | ||
|
|
697a8022c6 | ||
|
|
8f6bbe0c10 | ||
|
|
19fdeb9b7e | ||
|
|
8d9cffffed | ||
|
|
d0a304384f | ||
|
|
71cb558dfe | ||
|
|
ead713a176 | ||
|
|
e20daefe98 | ||
|
|
0fb7b95c5f | ||
|
|
4f4a54ab92 | ||
|
|
bb8674a537 | ||
|
|
5fb07775a1 | ||
|
|
e0992e5458 | ||
|
|
6b1cbda1b9 | ||
|
|
0f92546f47 | ||
|
|
54dccdb2ca | ||
|
|
324a557651 | ||
|
|
94843f0aa3 | ||
|
|
20df0160bc | ||
|
|
e73ac5a09b | ||
|
|
851e3f8468 | ||
|
|
25b27513d9 | ||
|
|
2062d72deb | ||
|
|
df04a68ab5 | ||
|
|
6f1360bd89 | ||
|
|
0ac1584946 | ||
|
|
40a1cd37f3 | ||
|
|
468455e12b | ||
|
|
b7226022b0 | ||
|
|
a4eb820f17 | ||
|
|
6eb8f74f8f | ||
|
|
cc5a986ce4 | ||
|
|
ae2199381e | ||
|
|
7b70847e58 | ||
|
|
19d9b60787 | ||
|
|
8f8439cee1 | ||
|
|
fa5303b8ff | ||
|
|
39845e8e40 | ||
|
|
5b34bb3110 | ||
|
|
c955769a75 | ||
|
|
82443642d2 | ||
|
|
e272d9dc80 | ||
|
|
9a50c55af7 | ||
|
|
e28ce5def0 | ||
|
|
7aa15a0026 | ||
|
|
90b1335aed | ||
|
|
ddbd0c40dc | ||
|
|
c473e022d9 | ||
|
|
6192d2c6de | ||
|
|
3746fc33c4 | ||
|
|
36cdaaac53 | ||
|
|
73c2a97540 | ||
|
|
a8ad048142 | ||
|
|
a029e56f5c | ||
|
|
fc4fdd623e | ||
|
|
dd47b5220c | ||
|
|
ce6cf10f73 | ||
|
|
8048226f50 | ||
|
|
85935600ad | ||
|
|
d949eefdd3 | ||
|
|
8ea6525e3a | ||
|
|
f3bc338643 | ||
|
|
715978d726 | ||
|
|
2a6b66c5fd | ||
|
|
f60321dc59 | ||
|
|
56f0d1d187 | ||
|
|
7287be84f1 | ||
|
|
f6b561d9f9 | ||
|
|
e94ca80bbb | ||
|
|
d74d8cb6c5 | ||
|
|
43eb7674aa | ||
|
|
d79683fa95 | ||
|
|
83bae26d3f | ||
|
|
9fc99ca350 | ||
|
|
a13121f759 | ||
|
|
2be37f19fe | ||
|
|
47a31596c6 | ||
|
|
23d13411c8 | ||
|
|
db8ab2be33 | ||
|
|
2aa5b25995 | ||
|
|
211c818502 | ||
|
|
c12c4c507d | ||
|
|
34076080cd | ||
|
|
321d3e35d5 | ||
|
|
e365aa4c3d | ||
|
|
c5178eb75d | ||
|
|
d3e4409ad1 | ||
|
|
e8b86af83d | ||
|
|
25a6ad2f10 | ||
|
|
a26424642b | ||
|
|
7e1fabbeae | ||
|
|
cff926615f | ||
|
|
117c794200 | ||
|
|
88322b77b1 | ||
|
|
535ee0cb54 | ||
|
|
ff020c3061 | ||
|
|
45fdfd8108 | ||
|
|
a727e7124d | ||
|
|
a1a77e1fcc | ||
|
|
2b45240d6c | ||
|
|
fc5618b338 | ||
|
|
92f39ba6dc | ||
|
|
896517cdf0 | ||
|
|
c6c8de1609 | ||
|
|
0505df0cba | ||
|
|
b999409e09 | ||
|
|
10b009fa50 | ||
|
|
ec78bdab6d | ||
|
|
a2b3f10183 | ||
|
|
04a4684a51 | ||
|
|
57f8bd8d18 | ||
|
|
9ec79612e8 | ||
|
|
c4e3a1622d | ||
|
|
20964c33f9 | ||
|
|
a686f6cdc0 | ||
|
|
46b7d74cb5 | ||
|
|
782e818718 | ||
|
|
bb8e56ff67 | ||
|
|
a49f4904c3 | ||
|
|
fa98bb3233 | ||
|
|
595284e9d0 | ||
|
|
c9d5bcc938 | ||
|
|
5a05f42ecf | ||
|
|
93d133c932 | ||
|
|
b506d9bfcb | ||
|
|
46bdb8ec59 | ||
|
|
1048a1c901 | ||
|
|
9503b0a4a8 | ||
|
|
11b192127c | ||
|
|
bd52638008 | ||
|
|
37cfa1195d | ||
|
|
6c05543cb0 | ||
|
|
b8e7ad5887 | ||
|
|
a974c1ec26 | ||
|
|
6b1e1872d4 | ||
|
|
cbaea0106d | ||
|
|
24d96dd3eb | ||
|
|
d87ea54cf6 | ||
|
|
63fec1eeba | ||
|
|
6b4cb804b5 | ||
|
|
53425dbfaa | ||
|
|
6c094ad0e3 | ||
|
|
d140056923 | ||
|
|
51c994d8f0 | ||
|
|
77a1a208a9 | ||
|
|
0d43e6057b | ||
|
|
6652eeba58 | ||
|
|
fcd7e48cb6 | ||
|
|
41511178a7 | ||
|
|
fd01e1d05e | ||
|
|
981c53e257 | ||
|
|
47f6a236ec | ||
|
|
6b5a748937 | ||
|
|
403ddfb7e0 | ||
|
|
76e5017732 | ||
|
|
592bdad15e | ||
|
|
457bf91968 | ||
|
|
2e350a617f | ||
|
|
d740d2b541 | ||
|
|
1f77b2e095 | ||
|
|
2a8be426c3 | ||
|
|
518e88308f | ||
|
|
31557b9ead | ||
|
|
e4c0985b5c | ||
|
|
836dc3342b | ||
|
|
70a04dce64 | ||
|
|
5320fffdd8 | ||
|
|
a76c741d9b | ||
|
|
3edfae0490 | ||
|
|
e411069eee | ||
|
|
ae62d0fc4f | ||
|
|
e3f8c4ef69 | ||
|
|
1ad6f4daa3 | ||
|
|
b9c3c10c1c | ||
|
|
6fbe73b6a0 | ||
|
|
c7324354fb | ||
|
|
cceb7b94e9 | ||
|
|
3995c0533b | ||
|
|
52cc1ebda2 | ||
|
|
c85541913b | ||
|
|
95dbea8103 | ||
|
|
56f8d56088 | ||
|
|
e3f12e0818 | ||
|
|
933ec5449f | ||
|
|
e1eeecd384 | ||
|
|
ee52f6ec6b | ||
|
|
d00ff612f8 | ||
|
|
15f6666958 | ||
|
|
710c4a6571 | ||
|
|
86027be930 | ||
|
|
de62ae867b | ||
|
|
71b56f4683 | ||
|
|
43ca804096 | ||
|
|
dcd5344dcd | ||
|
|
62a58c14bd | ||
|
|
e39eff37e2 | ||
|
|
06f2ac78d7 | ||
|
|
1914a78115 | ||
|
|
d6e2a57964 | ||
|
|
a0c45dd5d2 | ||
|
|
c9d546b2a8 | ||
|
|
d61e59ea0e | ||
|
|
c28e8b685b | ||
|
|
cb9ec4fada | ||
|
|
84271837f6 | ||
|
|
1a5fb4f29b | ||
|
|
5de5b98751 | ||
|
|
93549bcd43 | ||
|
|
85f0b29e6d | ||
|
|
28427f57ce | ||
|
|
d27c5e6534 | ||
|
|
34904c575a | ||
|
|
aaf63e45b6 | ||
|
|
dbfcf7a89f | ||
|
|
8c707b10e7 | ||
|
|
9c26b8fc03 | ||
|
|
77b214ef48 | ||
|
|
d35d6dd2cd | ||
|
|
466a2de317 | ||
|
|
7cb40fd2b5 | ||
|
|
4acc22e5cf | ||
|
|
4323e0dac3 | ||
|
|
7b18c11231 | ||
|
|
e6cab382c5 | ||
|
|
cd735a8c6c | ||
|
|
d6a44ffd00 | ||
|
|
93e3dbab95 | ||
|
|
1c292035e1 | ||
|
|
263137264f | ||
|
|
e20e6a50d5 | ||
|
|
4d24ffb75e | ||
|
|
a74a3158d4 | ||
|
|
4982f078bf | ||
|
|
65a99eca25 | ||
|
|
9a86ee6058 | ||
|
|
0e164d43d1 | ||
|
|
d511fbd576 | ||
|
|
9c46ba16e3 | ||
|
|
55e075f229 | ||
|
|
0bb672d87c | ||
|
|
8617d87e24 | ||
|
|
0601c3bf0f | ||
|
|
eea7239a23 | ||
|
|
e58782294d | ||
|
|
c1cc91bdcd | ||
|
|
13b712d7d4 | ||
|
|
dba9149595 | ||
|
|
9b8585410a | ||
|
|
f9b8635172 | ||
|
|
733d4546ce | ||
|
|
9e41ba026a | ||
|
|
5f819b2f98 | ||
|
|
007c5908b9 | ||
|
|
47db7ed1a8 | ||
|
|
a34361a52a | ||
|
|
0294b13074 | ||
|
|
d507251c81 | ||
|
|
585a791ef0 | ||
|
|
4919604766 | ||
|
|
a82cbb63b6 | ||
|
|
e501ea04e7 | ||
|
|
9534d2be80 | ||
|
|
70946cff5e | ||
|
|
a943967010 | ||
|
|
afa4ec917b | ||
|
|
c5289832f2 | ||
|
|
0560fa24d6 | ||
|
|
4c0f554348 | ||
|
|
6687da3425 | ||
|
|
e3990e3c99 | ||
|
|
aaf6103699 |
+11
-2
@@ -1,7 +1,16 @@
|
|||||||
|
*.eps
|
||||||
|
*.log
|
||||||
|
*.o
|
||||||
|
*.pdf
|
||||||
|
*.png
|
||||||
|
*.stamp
|
||||||
|
*.trs
|
||||||
|
*~
|
||||||
|
.deps
|
||||||
|
.dirstamp
|
||||||
/*.cache
|
/*.cache
|
||||||
/*.flc
|
/*.flc
|
||||||
/*.prj
|
/*.prj
|
||||||
/*~
|
|
||||||
/.tarball-version
|
/.tarball-version
|
||||||
/.version
|
/.version
|
||||||
/ABOUT-NLS
|
/ABOUT-NLS
|
||||||
@@ -11,6 +20,7 @@
|
|||||||
/INSTALL
|
/INSTALL
|
||||||
/Makefile
|
/Makefile
|
||||||
/Makefile.in
|
/Makefile.in
|
||||||
|
/README-release
|
||||||
/_*
|
/_*
|
||||||
/a.exe
|
/a.exe
|
||||||
/a.out
|
/a.out
|
||||||
@@ -31,4 +41,3 @@
|
|||||||
/patches
|
/patches
|
||||||
/releases
|
/releases
|
||||||
/stamp-h*
|
/stamp-h*
|
||||||
/README-release
|
|
||||||
|
|||||||
+1
-1
@@ -1 +1 @@
|
|||||||
2.6
|
3.0.5
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ and nasty bugs.
|
|||||||
|
|
||||||
-----
|
-----
|
||||||
|
|
||||||
Copyright (C) 1998-2012 Free Software Foundation, Inc.
|
Copyright (C) 1998-2015, 2018 Free Software Foundation, Inc.
|
||||||
|
|
||||||
This file is part of Bison, the GNU Compiler Compiler.
|
This file is part of Bison, the GNU Compiler Compiler.
|
||||||
|
|
||||||
|
|||||||
+2
-2
@@ -26733,8 +26733,8 @@
|
|||||||
|
|
||||||
-----
|
-----
|
||||||
|
|
||||||
Copyright (C) 1987-1988, 1991-2012 Free Software Foundation,
|
Copyright (C) 1987-1988, 1991-2015, 2018 Free Software
|
||||||
Inc.
|
Foundation, Inc.
|
||||||
|
|
||||||
Copying and distribution of this file, with or without
|
Copying and distribution of this file, with or without
|
||||||
modification, are permitted provided the copyright notice and this
|
modification, are permitted provided the copyright notice and this
|
||||||
|
|||||||
+13
-11
@@ -1,6 +1,6 @@
|
|||||||
## Process this file with automake to produce Makefile.in.
|
## Process this file with automake to produce Makefile.in.
|
||||||
|
|
||||||
# Copyright (C) 2001-2012 Free Software Foundation, Inc.
|
# Copyright (C) 2001-2015, 2018 Free Software Foundation, Inc.
|
||||||
#
|
#
|
||||||
# This program is free software: you can redistribute it and/or modify
|
# 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
|
# it under the terms of the GNU General Public License as published by
|
||||||
@@ -24,21 +24,24 @@ SUBDIRS = po runtime-po .
|
|||||||
aclocaldir = @aclocaldir@
|
aclocaldir = @aclocaldir@
|
||||||
aclocal_DATA = m4/bison-i18n.m4
|
aclocal_DATA = m4/bison-i18n.m4
|
||||||
|
|
||||||
EXTRA_DIST = .prev-version .version \
|
EXTRA_DIST = .prev-version .version cfg.mk PACKAGING \
|
||||||
cfg.mk ChangeLog-1998 ChangeLog-2012 PACKAGING
|
ChangeLog-1998 ChangeLog-2012 ChangeLog
|
||||||
|
|
||||||
|
dist_doc_DATA = AUTHORS COPYING NEWS README THANKS TODO
|
||||||
|
|
||||||
## Running the bison from this tarball. To generate our own parser,
|
## Running the bison from this tarball. To generate our own parser,
|
||||||
## but also to run the tests. Of course, you ought to keep a sane
|
## but also to run the tests. Of course, you ought to keep a sane
|
||||||
## version of Bison nearby...
|
## version of Bison nearby...
|
||||||
BISON = $(top_builddir)/tests/bison
|
BISON = $(top_builddir)/tests/bison
|
||||||
BISON_IN = $(top_srcdir)/tests/bison.in
|
BISON_IN = $(top_srcdir)/tests/bison.in
|
||||||
YACC = $(BISON) -y
|
YACC = $(BISON) -o y.tab.c
|
||||||
AM_YFLAGS = -d -v --warnings=all,error --report=all
|
AM_YFLAGS = -d -v -Werror -Wall -Wno-yacc --report=all
|
||||||
|
|
||||||
# Initialization before completion by local.mk's.
|
# Initialization before completion by local.mk's.
|
||||||
AM_CFLAGS = $(WARN_CFLAGS)
|
AM_CFLAGS = $(WARN_CFLAGS)
|
||||||
# Find builddir/src/scan-code.c etc.
|
# Find builddir/src/scan-code.c etc. For some reason "-I./lib"
|
||||||
AM_CPPFLAGS = -I. -Ilib -I$(top_srcdir) -I$(top_srcdir)/lib
|
# instead of "-Ilib" avoids infinite recursions on #include_next.
|
||||||
|
AM_CPPFLAGS = -I. -I./lib -I$(top_srcdir) -I$(top_srcdir)/lib
|
||||||
BUILT_SOURCES =
|
BUILT_SOURCES =
|
||||||
CLEANFILES =
|
CLEANFILES =
|
||||||
DISTCLEANFILES =
|
DISTCLEANFILES =
|
||||||
@@ -78,12 +81,11 @@ dist-hook: gen-ChangeLog
|
|||||||
|
|
||||||
.PHONY: update-b4-copyright update-package-copyright-year
|
.PHONY: update-b4-copyright update-package-copyright-year
|
||||||
update-b4-copyright:
|
update-b4-copyright:
|
||||||
find data -type f \
|
$(AM_V_GEN)find $(srcdir)/data -type f \
|
||||||
| grep -v -E '^data/bison.m4$$' \
|
| xargs $(srcdir)/build-aux/$@
|
||||||
| xargs $(build_aux)/$@
|
|
||||||
@echo 'warning: src/parse-gram.[hc] may need to be regenerated.'
|
@echo 'warning: src/parse-gram.[hc] may need to be regenerated.'
|
||||||
update-package-copyright-year:
|
update-package-copyright-year:
|
||||||
$(build_aux)/$@ configure.ac
|
$(AM_V_GEN)$(srcdir)/build-aux/$@ $(srcdir)/configure.ac
|
||||||
|
|
||||||
gen_start_date = 2012-01-16
|
gen_start_date = 2012-01-16
|
||||||
.PHONY: gen-ChangeLog
|
.PHONY: gen-ChangeLog
|
||||||
|
|||||||
@@ -36,7 +36,7 @@ to the bison package.
|
|||||||
|
|
||||||
-----
|
-----
|
||||||
|
|
||||||
Copyright (C) 2002, 2005, 2009-2012 Free Software Foundation, Inc.
|
Copyright (C) 2002, 2005, 2009-2015, 2018 Free Software Foundation, Inc.
|
||||||
|
|
||||||
This file is part of Bison, the GNU Compiler Compiler.
|
This file is part of Bison, the GNU Compiler Compiler.
|
||||||
|
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ instructions.
|
|||||||
|
|
||||||
Bison requires GNU m4 1.4.6 or later. See:
|
Bison requires GNU m4 1.4.6 or later. See:
|
||||||
|
|
||||||
ftp://ftp.gnu.org/gnu/m4/m4-1.4.6.tar.gz
|
https://ftp.gnu.org/gnu/m4/m4-1.4.6.tar.gz
|
||||||
|
|
||||||
** Internationalization
|
** Internationalization
|
||||||
Bison supports two catalogues: one for Bison itself (i.e., for the
|
Bison supports two catalogues: one for Bison itself (i.e., for the
|
||||||
@@ -30,21 +30,21 @@ not answer them, please send mail to <[email protected]>.
|
|||||||
|
|
||||||
* Bug reports
|
* Bug reports
|
||||||
Please send bug reports to <[email protected]>. Please include the
|
Please send bug reports to <[email protected]>. Please include the
|
||||||
version number from `bison --version', and a complete, self-contained
|
version number from 'bison --version', and a complete, self-contained
|
||||||
test case in each bug report.
|
test case in each bug report.
|
||||||
|
|
||||||
* Copyright statements
|
* Copyright statements
|
||||||
For any copyright year range specified as YYYY-ZZZZ in this package,
|
For any copyright year range specified as YYYY-ZZZZ in this package,
|
||||||
note that the range specifies every single year in that closed interval.
|
note that the range specifies every single year in that closed interval.
|
||||||
|
|
||||||
|
-----
|
||||||
|
|
||||||
Local Variables:
|
Local Variables:
|
||||||
mode: outline
|
mode: outline
|
||||||
|
fill-column: 76
|
||||||
End:
|
End:
|
||||||
|
|
||||||
-----
|
Copyright (C) 1992, 1998-1999, 2003-2005, 2008-2015, 2018 Free Software
|
||||||
|
|
||||||
Copyright (C) 1992, 1998-1999, 2003-2005, 2008-2012 Free Software
|
|
||||||
Foundation, Inc.
|
Foundation, Inc.
|
||||||
|
|
||||||
This file is part of Bison, the GNU Compiler Compiler.
|
This file is part of Bison, the GNU Compiler Compiler.
|
||||||
|
|||||||
+1
-1
@@ -12,7 +12,7 @@ the problems you encounter.
|
|||||||
|
|
||||||
-----
|
-----
|
||||||
|
|
||||||
Copyright (C) 2002, 2004, 2009-2012 Free Software Foundation, Inc.
|
Copyright (C) 2002, 2004, 2009-2015, 2018 Free Software Foundation, Inc.
|
||||||
|
|
||||||
This file is part of GNU Bison.
|
This file is part of GNU Bison.
|
||||||
|
|
||||||
|
|||||||
+154
-110
@@ -9,19 +9,19 @@ Everything related to the development of Bison is on Savannah:
|
|||||||
* Administrivia
|
* Administrivia
|
||||||
|
|
||||||
** If you incorporate a change from somebody on the net:
|
** If you incorporate a change from somebody on the net:
|
||||||
First, if it is a large change, you must make sure they have signed
|
First, if it is a large change, you must make sure they have signed the
|
||||||
the appropriate paperwork. Second, be sure to add their name and
|
appropriate paperwork. Second, be sure to add their name and email address
|
||||||
email address to THANKS.
|
to THANKS.
|
||||||
|
|
||||||
** If a change fixes a test, mention the test in the commit message.
|
** If a change fixes a test, mention the test in the commit message.
|
||||||
|
|
||||||
** Bug reports
|
** Bug reports
|
||||||
If somebody reports a new bug, mention his name in the commit message
|
If somebody reports a new bug, mention his name in the commit message and in
|
||||||
and in the test case you write. Put him into THANKS.
|
the test case you write. Put him into THANKS.
|
||||||
|
|
||||||
The correct response to most actual bugs is to write a new test case
|
The correct response to most actual bugs is to write a new test case which
|
||||||
which demonstrates the bug. Then fix the bug, re-run the test suite,
|
demonstrates the bug. Then fix the bug, re-run the test suite, and check
|
||||||
and check everything in.
|
everything in.
|
||||||
|
|
||||||
|
|
||||||
* Hacking
|
* Hacking
|
||||||
@@ -30,17 +30,17 @@ and check everything in.
|
|||||||
Which include serious bug fixes, must be mentioned in NEWS.
|
Which include serious bug fixes, must be mentioned in NEWS.
|
||||||
|
|
||||||
** Translations
|
** Translations
|
||||||
Only user visible strings are to be translated: error messages, bits
|
Only user visible strings are to be translated: error messages, bits of the
|
||||||
of the .output file etc. This excludes impossible error messages
|
.output file etc. This excludes impossible error messages (comparable to
|
||||||
(comparable to assert/abort), and all the --trace output which is
|
assert/abort), and all the --trace output which is meant for the maintainers
|
||||||
meant for the maintainers only.
|
only.
|
||||||
|
|
||||||
** Horizontal tabs
|
** Horizontal tabs
|
||||||
Do not add horizontal tab characters to any file in Bison's repository
|
Do not add horizontal tab characters to any file in Bison's repository
|
||||||
except where required. For example, do not use tabs to format C code.
|
except where required. For example, do not use tabs to format C code.
|
||||||
However, make files, ChangeLog, and some regular expressions require
|
However, make files, ChangeLog, and some regular expressions require tabs.
|
||||||
tabs. Also, test cases might need to contain tabs to check that Bison
|
Also, test cases might need to contain tabs to check that Bison properly
|
||||||
properly processes tabs in its input.
|
processes tabs in its input.
|
||||||
|
|
||||||
|
|
||||||
* Working from the repository
|
* Working from the repository
|
||||||
@@ -50,34 +50,44 @@ These requirements do not apply when building from a distribution tarball.
|
|||||||
|
|
||||||
** Requirements
|
** Requirements
|
||||||
|
|
||||||
We've opted to keep only the highest-level sources in the repository.
|
We've opted to keep only the highest-level sources in the repository. This
|
||||||
This eases our maintenance burden, (fewer merges etc.), but imposes more
|
eases our maintenance burden, (fewer merges etc.), but imposes more
|
||||||
requirements on anyone wishing to build from the just-checked-out sources.
|
requirements on anyone wishing to build from the just-checked-out sources.
|
||||||
For example, you have to use the latest stable versions of the maintainer
|
For example, you have to use the latest stable versions of the maintainer
|
||||||
tools we depend upon, including:
|
tools we depend upon, including:
|
||||||
|
|
||||||
- Automake <http://www.gnu.org/software/automake/>
|
|
||||||
- Autoconf <http://www.gnu.org/software/autoconf/>
|
- Autoconf <http://www.gnu.org/software/autoconf/>
|
||||||
|
- Automake <http://www.gnu.org/software/automake/>
|
||||||
- Flex <http://www.gnu.org/software/flex/>
|
- Flex <http://www.gnu.org/software/flex/>
|
||||||
- Gettext <http://www.gnu.org/software/gettext/>
|
- Gettext <http://www.gnu.org/software/gettext/>
|
||||||
|
- Graphviz <http://www.graphviz.org>
|
||||||
- Gzip <http://www.gnu.org/software/gzip/>
|
- Gzip <http://www.gnu.org/software/gzip/>
|
||||||
|
- Help2man <http://www.gnu.org/software/help2man/>
|
||||||
- Perl <http://www.cpan.org/>
|
- Perl <http://www.cpan.org/>
|
||||||
- Rsync <http://samba.anu.edu.au/rsync/>
|
- Rsync <http://samba.anu.edu.au/rsync/>
|
||||||
- Tar <http://www.gnu.org/software/tar/>
|
- Tar <http://www.gnu.org/software/tar/>
|
||||||
|
- Texinfo <http://www.gnu.org/software/texinfo/>
|
||||||
|
|
||||||
Valgrind <http://valgrind.org/> is also highly recommended, if it supports
|
Valgrind <http://valgrind.org/> is also highly recommended, if it supports
|
||||||
your architecture.
|
your architecture.
|
||||||
|
|
||||||
Bison is written using Bison grammars, so there are bootstrapping
|
If you're using a GNU/Linux distribution, the easiest way to install the
|
||||||
issues. The bootstrap script attempts to discover when the C code
|
above packages depends on your system. The following shell command should
|
||||||
generated from the grammars is out of date, and to bootstrap with an
|
work for Debian-based systems such as Ubuntu:
|
||||||
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.
|
sudo apt-get install \
|
||||||
Later, after synchronizing from the repository a plain 'make' should
|
autoconf automake autopoint flex graphviz help2man texinfo valgrind
|
||||||
be sufficient. Note, however, that when gnulib is updated, running
|
|
||||||
'./bootstrap' again might be needed.
|
Bison is written using Bison grammars, so there are bootstrapping issues.
|
||||||
|
The bootstrap script attempts to discover when the C code generated from the
|
||||||
|
grammars is out of date, and to bootstrap with an 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,
|
||||||
|
after synchronizing from the repository a plain 'make' should be sufficient.
|
||||||
|
Note, however, that when gnulib is updated, running './bootstrap' again
|
||||||
|
might be needed.
|
||||||
|
|
||||||
** First checkout
|
** First checkout
|
||||||
|
|
||||||
@@ -93,15 +103,19 @@ to perform the first checkout of the submodules, run
|
|||||||
|
|
||||||
$ git submodule update --init
|
$ git submodule update --init
|
||||||
|
|
||||||
Git submodule support is weak before versions 1.6 and later, you
|
|
||||||
should probably upgrade Git if your version is older.
|
|
||||||
|
|
||||||
The next step is to get other files needed to build, which are
|
The next step is to get other files needed to build, which are
|
||||||
extracted from other source packages:
|
extracted from other source packages:
|
||||||
|
|
||||||
$ ./bootstrap
|
$ ./bootstrap
|
||||||
|
|
||||||
And there you are! Just
|
Bootstrapping updates the submodules to the versions registered in the
|
||||||
|
top-level directory. To change gnulib, first check out the version you want
|
||||||
|
in `gnulib`, then commit this change in Bison's repository, and finally run
|
||||||
|
bootstrap.
|
||||||
|
|
||||||
|
If it fails with missing symbols (e.g., "error: possibly undefined macro:
|
||||||
|
AC_PROG_GNU_M4"), you are likely to have forgotten the submodule
|
||||||
|
initialization part. Otherwise, there you are! Just
|
||||||
|
|
||||||
$ ./configure
|
$ ./configure
|
||||||
$ make
|
$ make
|
||||||
@@ -125,13 +139,12 @@ explicitly by the user.
|
|||||||
*** Updating Bison
|
*** Updating Bison
|
||||||
|
|
||||||
If you pull a newer version of a branch, say via "git pull", you might
|
If you pull a newer version of a branch, say via "git pull", you might
|
||||||
import requests for updated submodules. A simple "git diff" will
|
import requests for updated submodules. A simple "git diff" will reveal if
|
||||||
reveal if the current version of the submodule (i.e., the actual
|
the current version of the submodule (i.e., the actual contents of the
|
||||||
contents of the gnulib directory) and the current request from the
|
gnulib directory) and the current request from the subscriber (i.e., the
|
||||||
subscriber (i.e., the reference of the version of gnulib that the
|
reference of the version of gnulib that the Bison repository requests)
|
||||||
Bison repository requests) differ. To upgrade the submodules (i.e.,
|
differ. To upgrade the submodules (i.e., to check out the version that is
|
||||||
to check out the version that is actually requested by the subscriber,
|
actually requested by the subscriber, run "git submodule update".
|
||||||
run "git submodule update".
|
|
||||||
|
|
||||||
$ git pull
|
$ git pull
|
||||||
$ git submodule update
|
$ git submodule update
|
||||||
@@ -155,8 +168,8 @@ Register your changes.
|
|||||||
|
|
||||||
$ git checkin ...
|
$ git checkin ...
|
||||||
|
|
||||||
For a suggestion of what gnulib commit might be stable enough for a
|
For a suggestion of what gnulib commit might be stable enough for a formal
|
||||||
formal release, see the ChangeLog in the latest gnulib snapshot at:
|
release, see the ChangeLog in the latest gnulib snapshot at:
|
||||||
|
|
||||||
http://erislabs.net/ianb/projects/gnulib/
|
http://erislabs.net/ianb/projects/gnulib/
|
||||||
|
|
||||||
@@ -166,15 +179,50 @@ The Autoconf files we use are currently:
|
|||||||
lib/m4sugar/m4sugar.m4
|
lib/m4sugar/m4sugar.m4
|
||||||
lib/m4sugar/foreach.m4
|
lib/m4sugar/foreach.m4
|
||||||
|
|
||||||
These files don't change very often in Autoconf, so it should be
|
These files don't change very often in Autoconf, so it should be relatively
|
||||||
relatively straight-forward to examine the differences in order to
|
straight-forward to examine the differences in order to decide whether to
|
||||||
decide whether to update.
|
update.
|
||||||
|
|
||||||
* Test suite
|
* Test suite
|
||||||
|
|
||||||
** make check
|
** make check
|
||||||
Use liberally.
|
Use liberally.
|
||||||
|
|
||||||
|
** TESTSUITEFLAGS
|
||||||
|
|
||||||
|
The default is for make check to run all tests sequentially. This can be
|
||||||
|
very time consumming when checking repeatedly or on slower setups. This can
|
||||||
|
be sped up in two ways:
|
||||||
|
|
||||||
|
Using -j, in a make-like fashion, for example:
|
||||||
|
$ make check TESTSUITEFLAGS='-j8'
|
||||||
|
|
||||||
|
Running only the tests of a certain category, as specified in the AT files
|
||||||
|
with AT_KEYWORDS([[category]]). Categories include:
|
||||||
|
- c++, for c++ parsers
|
||||||
|
- deprec, for tests concerning deprecated constructs.
|
||||||
|
- glr, for glr parsers
|
||||||
|
- java, for java parsers
|
||||||
|
- report, for automaton dumps
|
||||||
|
|
||||||
|
To run a specific set of tests, use -k (for "keyword"). For example:
|
||||||
|
$ make check TESTSUITEFLAGS='-k c++'
|
||||||
|
|
||||||
|
Both can be combined.
|
||||||
|
|
||||||
|
** Typical errors
|
||||||
|
If the test suite shows failures such as the following one
|
||||||
|
|
||||||
|
.../bison/lib/getopt.h:196:8: error: redefinition of 'struct option'
|
||||||
|
/usr/include/getopt.h:54:8: error: previous definition of 'struct option'
|
||||||
|
|
||||||
|
it probably means that some file was compiled without
|
||||||
|
AT_DATA_SOURCE_PROLOGUE. This error is due to the fact that our -I options
|
||||||
|
pick up gnulib's replacement headers, such as getopt.h, and this will go
|
||||||
|
wrong if config.h was not included first.
|
||||||
|
|
||||||
|
See tests/local.at for details.
|
||||||
|
|
||||||
** make maintainer-check-valgrind
|
** make maintainer-check-valgrind
|
||||||
This target uses valgrind both to check bison, and the generated parsers.
|
This target uses valgrind both to check bison, and the generated parsers.
|
||||||
|
|
||||||
@@ -196,102 +244,99 @@ suite. So currently, do not try to run valgrind on Mac OS X.
|
|||||||
Try to run the test suite with more severe conditions before a
|
Try to run the test suite with more severe conditions before a
|
||||||
release:
|
release:
|
||||||
|
|
||||||
- Configure the package with --enable-gcc-warnings, so that one checks
|
- Configure the package with --enable-gcc-warnings, so that one checks that
|
||||||
that 1. Bison compiles cleanly, 2. the parsers it produces compile
|
1. Bison compiles cleanly, 2. the parsers it produces compile cleanly too.
|
||||||
cleanly too.
|
|
||||||
|
|
||||||
- Maybe build with -DGNULIB_POSIXCHECK, which suggests gnulib modules
|
- Maybe build with -DGNULIB_POSIXCHECK, which suggests gnulib modules that
|
||||||
that can fix portability issues. See if you really want to pay
|
can fix portability issues. See if you really want to pay attention to
|
||||||
attention to its warnings; there's no need to obey blindly to it
|
its warnings; there's no need to obey blindly to it
|
||||||
(<http://lists.gnu.org/archive/html/bison-patches/2012-05/msg00057.html>).
|
(<http://lists.gnu.org/archive/html/bison-patches/2012-05/msg00057.html>).
|
||||||
|
|
||||||
- Check with "make syntax-check" if there are issues diagnosed by
|
- Check with "make syntax-check" if there are issues diagnosed by gnulib.
|
||||||
gnulib.
|
|
||||||
|
|
||||||
- run "make maintainer-check" which:
|
- run "make maintainer-check" which:
|
||||||
- runs "valgrind -q bison" to run Bison under Valgrind.
|
- runs "valgrind -q bison" to run Bison under Valgrind.
|
||||||
- runs the parsers under Valgrind.
|
- runs the parsers under Valgrind.
|
||||||
- runs the test suite with G++ as C compiler...
|
- runs the test suite with G++ as C compiler...
|
||||||
|
|
||||||
- run "make maintainer-push-check", which runs "make maintainer-check"
|
- run "make maintainer-push-check", which runs "make maintainer-check" while
|
||||||
while activating the push implementation and its pull interface wrappers
|
activating the push implementation and its pull interface wrappers in many
|
||||||
in many test cases that were originally written to exercise only the
|
test cases that were originally written to exercise only the pull
|
||||||
pull implementation. This makes certain the push implementation can
|
implementation. This makes certain the push implementation can perform
|
||||||
perform every task the pull implementation can.
|
every task the pull implementation can.
|
||||||
|
|
||||||
- run "make maintainer-xml-check", which runs "make maintainer-check"
|
- run "make maintainer-xml-check", which runs "make maintainer-check" while
|
||||||
while checking Bison's XML automaton report for every working grammar
|
checking Bison's XML automaton report for every working grammar passed to
|
||||||
passed to Bison in the test suite. The check just diffs the output of
|
Bison in the test suite. The check just diffs the output of Bison's
|
||||||
Bison's included XSLT style sheets with the output of --report=all and
|
included XSLT style sheets with the output of --report=all and --graph.
|
||||||
--graph.
|
|
||||||
|
|
||||||
- running "make maintainer-release-check" takes care of running
|
- running "make maintainer-release-check" takes care of running
|
||||||
maintainer-check, maintainer-push-check and maintainer-xml-check.
|
maintainer-check, maintainer-push-check and maintainer-xml-check.
|
||||||
|
|
||||||
- Change tests/atlocal/CFLAGS to add your preferred options. For
|
- Change tests/atlocal/CFLAGS to add your preferred options. For instance,
|
||||||
instance, "-traditional" to check that the parsers are K&R. Note
|
"-traditional" to check that the parsers are K&R. Note that it does not
|
||||||
that it does not make sense for glr.c, which should be ANSI, but
|
make sense for glr.c, which should be ANSI, but currently is actually GNU
|
||||||
currently is actually GNU C, nor for lalr1.cc.
|
C, nor for lalr1.cc.
|
||||||
|
|
||||||
- Test with a very recent version of GCC for both C and C++. Testing
|
- Test with a very recent version of GCC for both C and C++. Testing with
|
||||||
with older versions that are still in use is nice too.
|
older versions that are still in use is nice too.
|
||||||
|
|
||||||
|
|
||||||
* Release Procedure
|
* Release Procedure
|
||||||
This section needs to be updated to take into account features from
|
This section needs to be updated to take into account features from gnulib.
|
||||||
gnulib. In particular, be sure to read README-release.
|
In particular, be sure to read README-release.
|
||||||
|
|
||||||
** Update the submodules. See above.
|
** Update the submodules. See above.
|
||||||
|
|
||||||
** Update maintainer tools, such as Autoconf. See above.
|
** Update maintainer tools, such as Autoconf. See above.
|
||||||
|
|
||||||
** Try to get the *.pot files to the Translation Project at least one
|
** 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.
|
week before a stable release, to give them time to translate them. Before
|
||||||
Before generating the *.pot files, make sure that po/POTFILES.in and
|
generating the *.pot files, make sure that po/POTFILES.in and
|
||||||
runtime-po/POTFILES.in list all files with translatable strings.
|
runtime-po/POTFILES.in list all files with translatable strings. This
|
||||||
This helps: grep -l '\<_(' *
|
helps: grep -l '\<_(' *
|
||||||
|
|
||||||
** Tests
|
** Tests
|
||||||
See above.
|
See above.
|
||||||
|
|
||||||
** Update the foreign files
|
** Update the foreign files
|
||||||
Running "./bootstrap" in the top level should update them all for you.
|
Running "./bootstrap" in the top level should update them all for you. This
|
||||||
This covers PO files too. Sometimes a PO file contains problems that
|
covers PO files too. Sometimes a PO file contains problems that causes it
|
||||||
causes it to be rejected by recent Gettext releases; please report
|
to be rejected by recent Gettext releases; please report these to the
|
||||||
these to the Translation Project.
|
Translation Project.
|
||||||
|
|
||||||
** Update README
|
** Update README
|
||||||
Make sure the information in README is current. Most notably, make sure
|
Make sure the information in README is current. Most notably, make sure it
|
||||||
it recommends a version of GNU M4 that is compatible with the latest
|
recommends a version of GNU M4 that is compatible with the latest Bison
|
||||||
Bison sources.
|
sources.
|
||||||
|
|
||||||
** Check copyright years.
|
** Check copyright years.
|
||||||
We update years in copyright statements throughout Bison once at the
|
We update years in copyright statements throughout Bison once at the start
|
||||||
start of every year by running "make update-copyright". However, before
|
of every year by running "make update-copyright". However, before a
|
||||||
a release, it's good to verify that it's actually been run. Besides the
|
release, it's good to verify that it's actually been run. Besides the
|
||||||
copyright statement for each Bison file, check the copyright statements
|
copyright statement for each Bison file, check the copyright statements that
|
||||||
that the skeletons insert into generated parsers, and check all
|
the skeletons insert into generated parsers, and check all occurrences of
|
||||||
occurrences of PACKAGE_COPYRIGHT_YEAR in configure.ac.
|
PACKAGE_COPYRIGHT_YEAR in configure.ac.
|
||||||
|
|
||||||
** Update NEWS, commit and tag.
|
** Update NEWS, commit and tag.
|
||||||
See do-release-commit-and-tag in README-release. For a while, we used
|
See do-release-commit-and-tag in README-release. For a while, we used beta
|
||||||
beta names such as "2.6_rc1". Now that we use gnulib in the release
|
names such as "2.6_rc1". Now that we use gnulib in the release procedure,
|
||||||
procedure, we must use "2.5.90", which has the additional benefit of
|
we must use "2.5.90", which has the additional benefit of being properly
|
||||||
being properly sorted in "git tag -l".
|
sorted in "git tag -l".
|
||||||
|
|
||||||
** make alpha, beta, or stable
|
** make alpha, beta, or stable
|
||||||
See README-release.
|
See README-release.
|
||||||
|
|
||||||
** Upload
|
** Upload
|
||||||
There are two ways to upload the tarballs to the GNU servers: using
|
There are two ways to upload the tarballs to the GNU servers: using gnupload
|
||||||
gnupload (from gnulib), or by hand. Obviously prefer the former. But
|
(from gnulib), or by hand. Obviously prefer the former. But in either
|
||||||
in either case, be sure to read the following paragraph.
|
case, be sure to read the following paragraph.
|
||||||
|
|
||||||
*** Setup
|
*** Setup
|
||||||
You need "gnupg".
|
You need "gnupg".
|
||||||
|
|
||||||
Make sure your public key has been uploaded at least to
|
Make sure your public key has been uploaded at least to keys.gnupg.net. You
|
||||||
keys.gnupg.net. You can upload it with:
|
can upload it with:
|
||||||
|
|
||||||
gpg --keyserver keys.gnupg.net --send-keys F125BDF3
|
gpg --keyserver keys.gnupg.net --send-keys F125BDF3
|
||||||
|
|
||||||
@@ -300,8 +345,8 @@ where F125BDF3 should be replaced with your key ID.
|
|||||||
*** Using gnupload
|
*** Using gnupload
|
||||||
You need "ncftp".
|
You need "ncftp".
|
||||||
|
|
||||||
At the end "make stable" (or alpha/beta) will display the procedure to
|
At the end "make stable" (or alpha/beta) will display the procedure to run.
|
||||||
run. Just copy and paste it in your shell.
|
Just copy and paste it in your shell.
|
||||||
|
|
||||||
*** By hand
|
*** By hand
|
||||||
|
|
||||||
@@ -363,9 +408,9 @@ sections that have been removed or renamed):
|
|||||||
$ ls -lt
|
$ ls -lt
|
||||||
|
|
||||||
Remove these files and commit their removal to CVS. For each of these
|
Remove these files and commit their removal to CVS. For each of these
|
||||||
files, add a line to the file .symlinks. This will ensure that
|
files, add a line to the file .symlinks. This will ensure that hyperlinks
|
||||||
hyperlinks to the removed files will redirect to the entire manual; this
|
to the removed files will redirect to the entire manual; this is better than
|
||||||
is better than a 404 error.
|
a 404 error.
|
||||||
|
|
||||||
There is a problem with 'index.html' being written twice (once for POSIX
|
There is a problem with 'index.html' being written twice (once for POSIX
|
||||||
function 'index', once for the table of contents); you can ignore this
|
function 'index', once for the table of contents); you can ignore this
|
||||||
@@ -384,19 +429,18 @@ Complete/fix the announcement file. The generated list of recipients
|
|||||||
([email protected], [email protected], [email protected],
|
([email protected], [email protected], [email protected],
|
||||||
[email protected], and [email protected]) is
|
[email protected], and [email protected]) is
|
||||||
appropriate for a stable release or a "serious beta". For any other
|
appropriate for a stable release or a "serious beta". For any other
|
||||||
release, drop at least [email protected]. For an example of how to
|
release, drop at least [email protected]. For an example of how to fill out
|
||||||
fill out the rest of the template, search the mailing list archives
|
the rest of the template, search the mailing list archives for the most
|
||||||
for the most recent release announcement.
|
recent release announcement.
|
||||||
|
|
||||||
For a stable release, send the same announcement on the comp.compilers
|
For a stable release, send the same announcement on the comp.compilers
|
||||||
newsgroup by sending email to [email protected]. Do not make any Cc as
|
newsgroup by sending email to [email protected]. Do not make any Cc as the
|
||||||
the moderator will throw away anything cross-posted or Cc'ed. It really
|
moderator will throw away anything cross-posted or Cc'ed. It really needs
|
||||||
needs to be a separate message.
|
to be a separate message.
|
||||||
|
|
||||||
** Prepare NEWS
|
** Prepare NEWS
|
||||||
So that developers don't accidentally add new items to the old NEWS
|
So that developers don't accidentally add new items to the old NEWS entry,
|
||||||
entry, create a new empty entry in line 3 (without the two leading
|
create a new empty entry in line 3 (without the two leading spaces):
|
||||||
spaces):
|
|
||||||
|
|
||||||
* Noteworthy changes in release ?.? (????-??-??) [?]
|
* Noteworthy changes in release ?.? (????-??-??) [?]
|
||||||
|
|
||||||
@@ -404,7 +448,7 @@ Push these changes.
|
|||||||
|
|
||||||
-----
|
-----
|
||||||
|
|
||||||
Copyright (C) 2002-2005, 2007-2012 Free Software Foundation, Inc.
|
Copyright (C) 2002-2005, 2007-2015, 2018 Free Software Foundation, Inc.
|
||||||
|
|
||||||
This file is part of GNU Bison.
|
This file is part of GNU Bison.
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -9,7 +9,7 @@ Bison supports the @N construction, which gives you access to
|
|||||||
the starting and ending line number and character number associated
|
the starting and ending line number and character number associated
|
||||||
with any of the symbols in the current rule.
|
with any of the symbols in the current rule.
|
||||||
|
|
||||||
Also, Bison supports the command `%expect N' which says not to mention
|
Also, Bison supports the command '%expect N' which says not to mention
|
||||||
the conflicts if there are N shift/reduce conflicts and no reduce/reduce
|
the conflicts if there are N shift/reduce conflicts and no reduce/reduce
|
||||||
conflicts.
|
conflicts.
|
||||||
|
|
||||||
|
|||||||
@@ -1,136 +1,191 @@
|
|||||||
Bison was originally written by Robert Corbett. It would not be what
|
Bison was originally written by Robert Corbett. It would not be what
|
||||||
it is today without the invaluable help of these people:
|
it is today without the invaluable help of these people:
|
||||||
|
|
||||||
|
Aaro Koskinen [email protected]
|
||||||
|
Аскар Сафин [email protected]
|
||||||
Airy Andre [email protected]
|
Airy Andre [email protected]
|
||||||
Akim Demaille akim@freefriends.org
|
Akim Demaille akim@lrde.epita.fr
|
||||||
Albert Chin-A-Young [email protected]
|
Albert Chin-A-Young [email protected]
|
||||||
Alexander Belopolsky [email protected]
|
Alexander Belopolsky [email protected]
|
||||||
Alexandre Duret-Lutz adl@src.lip6.fr
|
Alexandre Duret-Lutz adl@lrde.epita.fr
|
||||||
Andreas Schwab [email protected]
|
Andreas Schwab [email protected]
|
||||||
Andrew Suffield [email protected]
|
Andrew Suffield [email protected]
|
||||||
Angelo Borsotti [email protected]
|
Angelo Borsotti [email protected]
|
||||||
Anthony Heading [email protected]
|
Anthony Heading [email protected]
|
||||||
|
Antonio Silva Correia [email protected]
|
||||||
Arnold Robbins [email protected]
|
Arnold Robbins [email protected]
|
||||||
Art Haas [email protected]
|
Art Haas [email protected]
|
||||||
|
Askar Safin [email protected]
|
||||||
Baron Schwartz [email protected]
|
Baron Schwartz [email protected]
|
||||||
|
Ben Pfaff [email protected]
|
||||||
Benoit Perrot [email protected]
|
Benoit Perrot [email protected]
|
||||||
|
Bernd Edlinger [email protected]
|
||||||
Bernd Kiefer [email protected]
|
Bernd Kiefer [email protected]
|
||||||
Bert Deknuydt [email protected]
|
Bert Deknuydt [email protected]
|
||||||
Bill Allombert [email protected]
|
Bill Allombert [email protected]
|
||||||
Bob Rossi [email protected]
|
Bob Rossi [email protected]
|
||||||
Brandon Lucia [email protected]
|
Brandon Lucia [email protected]
|
||||||
|
Brooks Moses [email protected]
|
||||||
Bruce Lilly [email protected]
|
Bruce Lilly [email protected]
|
||||||
Bruno Haible [email protected]
|
Bruno Haible [email protected]
|
||||||
Charles-Henri de Boysson [email protected]
|
Charles-Henri de Boysson [email protected]
|
||||||
Christian Burger [email protected]
|
Christian Burger [email protected]
|
||||||
|
Colin Daley [email protected]
|
||||||
Cris Bailiff [email protected]
|
Cris Bailiff [email protected]
|
||||||
Cris van Pelt [email protected]
|
Cris van Pelt [email protected]
|
||||||
Csaba Raduly [email protected]
|
Csaba Raduly [email protected]
|
||||||
Dagobert Michelsen [email protected]
|
Dagobert Michelsen [email protected]
|
||||||
|
Daniel Frużyński [email protected]
|
||||||
|
Daniel Galloway [email protected]
|
||||||
Daniel Hagerty [email protected]
|
Daniel Hagerty [email protected]
|
||||||
David J. MacKenzie [email protected]
|
David J. MacKenzie [email protected]
|
||||||
David Kastrup [email protected]
|
David Kastrup [email protected]
|
||||||
|
David Michael [email protected]
|
||||||
|
Dengke Du [email protected]
|
||||||
|
Dennis Clarke [email protected]
|
||||||
|
Derek Clegg [email protected]
|
||||||
Derek M. Jones [email protected]
|
Derek M. Jones [email protected]
|
||||||
Di-an Jan [email protected]
|
Di-an Jan [email protected]
|
||||||
Dick Streefland [email protected]
|
Dick Streefland [email protected]
|
||||||
Didier Godefroy [email protected]
|
Didier Godefroy [email protected]
|
||||||
|
Efi Fogel [email protected]
|
||||||
Enrico Scholz [email protected]
|
Enrico Scholz [email protected]
|
||||||
Eric Blake [email protected]
|
Eric Blake [email protected]
|
||||||
Evgeny Stambulchik [email protected]
|
Evgeny Stambulchik [email protected]
|
||||||
Fabrice Bauzac [email protected]
|
Fabrice Bauzac [email protected]
|
||||||
|
Ferdinand Thiessen [email protected]
|
||||||
Florian Krohm [email protected]
|
Florian Krohm [email protected]
|
||||||
Frank Heckenbach [email protected]
|
Frank Heckenbach [email protected]
|
||||||
Frans Englich [email protected]
|
Frans Englich [email protected]
|
||||||
|
Gabriel Rassoul [email protected]
|
||||||
|
Gary L Peskin [email protected]
|
||||||
Georg Sauthoff [email protected]
|
Georg Sauthoff [email protected]
|
||||||
George Neuner [email protected]
|
George Neuner [email protected]
|
||||||
Gilles Espinasse [email protected]
|
Gilles Espinasse [email protected]
|
||||||
Goran Uddeborg [email protected]
|
Goran Uddeborg [email protected]
|
||||||
Guido Trentalancia [email protected]
|
Guido Trentalancia [email protected]
|
||||||
H. Merijn Brand [email protected]
|
H. Merijn Brand [email protected]
|
||||||
Hans Aberg haberg@matematik.su.se
|
Hans Åberg haberg[email protected]
|
||||||
Jan Nieuwenhuizen [email protected]
|
Jan Nieuwenhuizen [email protected]
|
||||||
|
Jannick [email protected]
|
||||||
Jerry Quinn [email protected]
|
Jerry Quinn [email protected]
|
||||||
Jesse Thilo [email protected]
|
Jesse Thilo [email protected]
|
||||||
Jim Kent [email protected]
|
Jim Kent [email protected]
|
||||||
Jim Meyering [email protected]
|
Jim Meyering [email protected]
|
||||||
Joel E. Denny [email protected]
|
Joel E. Denny [email protected]
|
||||||
Johan van Selst [email protected]
|
Johan van Selst [email protected]
|
||||||
|
John Horigan [email protected]
|
||||||
|
Jonathan Fabrizio [email protected]
|
||||||
Jonathan Nieder [email protected]
|
Jonathan Nieder [email protected]
|
||||||
Juan Manuel Guerrero [email protected]
|
Juan Manuel Guerrero [email protected]
|
||||||
Kees Zeelenberg [email protected]
|
Kees Zeelenberg [email protected]
|
||||||
Keith Browne [email protected]
|
Keith Browne [email protected]
|
||||||
|
Ken Moffat [email protected]
|
||||||
Laurent Mascherpa [email protected]
|
Laurent Mascherpa [email protected]
|
||||||
Lie Yan [email protected]
|
Lie Yan [email protected]
|
||||||
Magnus Fromreide [email protected]
|
Magnus Fromreide [email protected]
|
||||||
Marc Autret [email protected]
|
Marc Autret [email protected]
|
||||||
|
Marc Mendiola [email protected]
|
||||||
|
Mark Boyall [email protected]
|
||||||
Martin Jacobs [email protected]
|
Martin Jacobs [email protected]
|
||||||
Martin Mokrejs [email protected]
|
Martin Mokrejs [email protected]
|
||||||
Martin Nylin [email protected]
|
Martin Nylin [email protected]
|
||||||
Matt Kraai [email protected]
|
Matt Kraai [email protected]
|
||||||
Matt Rosing [email protected]
|
Matt Rosing [email protected]
|
||||||
|
Maxim Prohorenko [email protected]
|
||||||
|
Michael Catanzaro [email protected]
|
||||||
|
Michael Felt [email protected]
|
||||||
Michael Hayes [email protected]
|
Michael Hayes [email protected]
|
||||||
Michael Raskin [email protected]
|
Michael Raskin [email protected]
|
||||||
|
Michel d'Hooge [email protected]
|
||||||
Michiel De Wilde [email protected]
|
Michiel De Wilde [email protected]
|
||||||
Mickael Labau [email protected]
|
Mickael Labau [email protected]
|
||||||
Mike Castle [email protected]
|
Mike Castle [email protected]
|
||||||
|
Mike Sullivan [email protected]
|
||||||
|
Nate Guerin [email protected]
|
||||||
Neil Booth [email protected]
|
Neil Booth [email protected]
|
||||||
Nelson H. F. Beebe [email protected]
|
Nelson H. F. Beebe [email protected]
|
||||||
|
Nick Bowler [email protected]
|
||||||
|
Nicolas Bedon [email protected]
|
||||||
Nicolas Burrus [email protected]
|
Nicolas Burrus [email protected]
|
||||||
Nicolas Tisserand [email protected]
|
Nicolas Tisserand [email protected]
|
||||||
Noah Friedman [email protected]
|
Noah Friedman [email protected]
|
||||||
Odd Arild Olsen [email protected]
|
Odd Arild Olsen [email protected]
|
||||||
Oleg Smolsky [email protected]
|
Oleg Smolsky [email protected]
|
||||||
|
Oleksii Taran [email protected]
|
||||||
Paolo Bonzini [email protected]
|
Paolo Bonzini [email protected]
|
||||||
|
Paolo Simone Gasparello [email protected]
|
||||||
Pascal Bart [email protected]
|
Pascal Bart [email protected]
|
||||||
Paul Eggert [email protected]
|
Paul Eggert [email protected]
|
||||||
Paul Hilfinger [email protected]
|
Paul Hilfinger [email protected]
|
||||||
Per Allansson [email protected]
|
Per Allansson [email protected]
|
||||||
|
Peter Eisentraut [email protected]
|
||||||
Peter Fales [email protected]
|
Peter Fales [email protected]
|
||||||
Peter Hamorsky [email protected]
|
Peter Hamorsky [email protected]
|
||||||
|
Peter Simons [email protected]
|
||||||
|
Petr Machata [email protected]
|
||||||
|
Pho [email protected]
|
||||||
Piotr Gackiewicz [email protected]
|
Piotr Gackiewicz [email protected]
|
||||||
|
Piotr Marcińczyk [email protected]
|
||||||
Quentin Hocquet [email protected]
|
Quentin Hocquet [email protected]
|
||||||
Quoc Peyrot [email protected]
|
Quoc Peyrot [email protected]
|
||||||
R Blake [email protected]
|
R Blake [email protected]
|
||||||
Raja R Harinath [email protected]
|
Raja R Harinath [email protected]
|
||||||
Ralf Wildenhues [email protected]
|
Ralf Wildenhues [email protected]
|
||||||
|
Rich Wilson [email protected]
|
||||||
Richard Stallman [email protected]
|
Richard Stallman [email protected]
|
||||||
|
Rici Lake [email protected]
|
||||||
|
Rob Conde [email protected]
|
||||||
|
Rob Vermaas [email protected]
|
||||||
Robert Anisko [email protected]
|
Robert Anisko [email protected]
|
||||||
|
Robert Yang [email protected]
|
||||||
|
Roland Levillain [email protected]
|
||||||
Satya Kiran Popuri [email protected]
|
Satya Kiran Popuri [email protected]
|
||||||
Sebastian Setzer [email protected]
|
Sebastian Setzer [email protected]
|
||||||
Sebastien Fricker [email protected]
|
Sebastien Fricker [email protected]
|
||||||
Sergei Steshenko [email protected]
|
Sergei Steshenko [email protected]
|
||||||
Shura [email protected]
|
Shura [email protected]
|
||||||
Stefano Lattarini [email protected]
|
Stefano Lattarini [email protected]
|
||||||
|
Stephen Cameron [email protected]
|
||||||
Steve Murphy [email protected]
|
Steve Murphy [email protected]
|
||||||
Summum Bonum [email protected]
|
Sum Wu [email protected]
|
||||||
|
Théophile Ranquet [email protected]
|
||||||
Thiru Ramakrishnan [email protected]
|
Thiru Ramakrishnan [email protected]
|
||||||
|
Thomas Jahns [email protected]
|
||||||
Tim Josling [email protected]
|
Tim Josling [email protected]
|
||||||
Tim Landscheidt [email protected]
|
Tim Landscheidt [email protected]
|
||||||
Tim Van Holder [email protected]
|
Tim Van Holder [email protected]
|
||||||
|
Tobias Frost [email protected]
|
||||||
Tom Lane [email protected]
|
Tom Lane [email protected]
|
||||||
Tom Tromey [email protected]
|
Tom Tromey [email protected]
|
||||||
Tommy Nordgren [email protected]
|
Tommy Nordgren [email protected]
|
||||||
Troy A. Johnson [email protected]
|
Troy A. Johnson [email protected]
|
||||||
Tys Lefering [email protected]
|
Tys Lefering [email protected]
|
||||||
|
Valentin Tolmer [email protected]
|
||||||
|
Victor Khomenko [email protected]
|
||||||
Vin Shelton [email protected]
|
Vin Shelton [email protected]
|
||||||
W.C.A. Wijngaards [email protected]
|
W.C.A. Wijngaards [email protected]
|
||||||
Wayne Green [email protected]
|
Wayne Green [email protected]
|
||||||
Wei Song [email protected]
|
Wei Song [email protected]
|
||||||
|
Wojciech Polak [email protected]
|
||||||
Wolfgang S. Kechel [email protected]
|
Wolfgang S. Kechel [email protected]
|
||||||
Wolfram Wagner [email protected]
|
Wolfram Wagner [email protected]
|
||||||
Wwp [email protected]
|
Wwp [email protected]
|
||||||
|
xolodho [email protected]
|
||||||
Zack Weinberg [email protected]
|
Zack Weinberg [email protected]
|
||||||
|
長田偉伸 [email protected]
|
||||||
|
|
||||||
Many people are not named here because we lost track of them. We
|
Many people are not named here because we lost track of them. We
|
||||||
thank them! Please, help us keeping this list up to date.
|
thank them! Please, help us keeping this list up to date.
|
||||||
|
|
||||||
Local Variables:
|
Local Variables:
|
||||||
mode: text
|
mode: text
|
||||||
|
coding: utf-8
|
||||||
End:
|
End:
|
||||||
|
|
||||||
-----
|
-----
|
||||||
|
|
||||||
Copyright (C) 2000-2012 Free Software Foundation, Inc.
|
Copyright (C) 2000-2015, 2018 Free Software Foundation, Inc.
|
||||||
|
|
||||||
This file is part of Bison, the GNU Parser Generator.
|
This file is part of Bison, the GNU Parser Generator.
|
||||||
|
|
||||||
|
|||||||
@@ -1,8 +1,63 @@
|
|||||||
* Short term
|
* Short term
|
||||||
** Variable names.
|
** Graphviz display code thoughts
|
||||||
What should we name `variant' and `lex_symbol'?
|
The code for the --graph option is over two files: print_graph, and
|
||||||
|
graphviz. This is because Bison used to also produce VCG graphs, but since
|
||||||
|
this is no longer true, maybe we could consider these files for fusion.
|
||||||
|
|
||||||
** Update the documentation on gnu.org
|
An other consideration worth noting is that print_graph.c (correct me if I
|
||||||
|
am wrong) should contain generic functions, whereas graphviz.c and other
|
||||||
|
potential files should contain just the specific code for that output
|
||||||
|
format. It will probably prove difficult to tell if the implementation is
|
||||||
|
actually generic whilst only having support for a single format, but it
|
||||||
|
would be nice to keep stuff a bit tidier: right now, the construction of the
|
||||||
|
bitset used to show reductions is in the graphviz-specific code, and on the
|
||||||
|
opposite side we have some use of \l, which is graphviz-specific, in what
|
||||||
|
should be generic code.
|
||||||
|
|
||||||
|
Little effort seems to have been given to factoring these files and their
|
||||||
|
rint{,-xml} counterpart. We would very much like to re-use the pretty format
|
||||||
|
of states from .output for the graphs, etc.
|
||||||
|
|
||||||
|
Also, the underscore in print_graph.[ch] isn't very fitting considering the
|
||||||
|
dashes in the other filenames.
|
||||||
|
|
||||||
|
Since graphviz dies on medium-to-big grammars, maybe consider an other tool?
|
||||||
|
|
||||||
|
** push-parser
|
||||||
|
Check it too when checking the different kinds of parsers. And be
|
||||||
|
sure to check that the initial-action is performed once per parsing.
|
||||||
|
|
||||||
|
** m4 names
|
||||||
|
b4_shared_declarations is no longer what it is. Make it
|
||||||
|
b4_parser_declaration for instance.
|
||||||
|
|
||||||
|
** yychar in lalr1.cc
|
||||||
|
There is a large difference bw maint and master on the handling of
|
||||||
|
yychar (which was removed in lalr1.cc). See what needs to be
|
||||||
|
back-ported.
|
||||||
|
|
||||||
|
|
||||||
|
/* User semantic actions sometimes alter yychar, and that requires
|
||||||
|
that yytoken be updated with the new translation. We take the
|
||||||
|
approach of translating immediately before every use of yytoken.
|
||||||
|
One alternative is translating here after every semantic action,
|
||||||
|
but that translation would be missed if the semantic action
|
||||||
|
invokes YYABORT, YYACCEPT, or YYERROR immediately after altering
|
||||||
|
yychar. In the case of YYABORT or YYACCEPT, an incorrect
|
||||||
|
destructor might then be invoked immediately. In the case of
|
||||||
|
YYERROR, subsequent parser actions might lead to an incorrect
|
||||||
|
destructor call or verbose syntax error message before the
|
||||||
|
lookahead is translated. */
|
||||||
|
|
||||||
|
/* Make sure we have latest lookahead translation. See comments at
|
||||||
|
user semantic actions for why this is necessary. */
|
||||||
|
yytoken = yytranslate_ (yychar);
|
||||||
|
|
||||||
|
|
||||||
|
** stack.hh
|
||||||
|
Get rid of it. The original idea is nice, but actually it makes
|
||||||
|
the code harder to follow, and uselessly different from the other
|
||||||
|
skeletons.
|
||||||
|
|
||||||
** Get rid of fake #lines [Bison: ...]
|
** Get rid of fake #lines [Bison: ...]
|
||||||
Possibly as simple as checking whether the column number is nonnegative.
|
Possibly as simple as checking whether the column number is nonnegative.
|
||||||
@@ -30,14 +85,7 @@ since it is no longer bound to a particular parser, it's just a
|
|||||||
** Rename LR0.cc
|
** Rename LR0.cc
|
||||||
as lr0.cc, why upper case?
|
as lr0.cc, why upper case?
|
||||||
|
|
||||||
** bench several bisons.
|
|
||||||
Enhance bench.pl with %b to run different bisons.
|
|
||||||
|
|
||||||
* Various
|
* Various
|
||||||
** Warnings
|
|
||||||
Warnings about type tags that are used in printer and dtors, but not
|
|
||||||
for symbols?
|
|
||||||
|
|
||||||
** YYERRCODE
|
** YYERRCODE
|
||||||
Defined to 256, but not used, not documented. Probably the token
|
Defined to 256, but not used, not documented. Probably the token
|
||||||
number for the error token, which POSIX wants to be 256, but which
|
number for the error token, which POSIX wants to be 256, but which
|
||||||
@@ -64,7 +112,7 @@ We could (should?) also treat the case of the undef_token, which is
|
|||||||
numbered 257 for yylex, and 2 internal. Both appear for instance in
|
numbered 257 for yylex, and 2 internal. Both appear for instance in
|
||||||
toknum:
|
toknum:
|
||||||
|
|
||||||
const unsigned short int
|
const unsigned short
|
||||||
parser::yytoken_number_[] =
|
parser::yytoken_number_[] =
|
||||||
{
|
{
|
||||||
0, 256, 257, 258, 259, 260, 261, 262, 263, 264,
|
0, 256, 257, 258, 259, 260, 261, 262, 263, 264,
|
||||||
@@ -83,9 +131,6 @@ so both 256 and 257 are "mysterious".
|
|||||||
"\"end of command\"", "error", "$undefined", "\"=\"", "\"break\"",
|
"\"end of command\"", "error", "$undefined", "\"=\"", "\"break\"",
|
||||||
|
|
||||||
|
|
||||||
** YYFAIL
|
|
||||||
It is seems to be *really* obsolete now, shall we remove it?
|
|
||||||
|
|
||||||
** yychar == yyempty_
|
** yychar == yyempty_
|
||||||
The code in yyerrlab reads:
|
The code in yyerrlab reads:
|
||||||
|
|
||||||
@@ -103,12 +148,6 @@ really possible? The test suite does not exercise this case.
|
|||||||
This shows that it would be interesting to manage to install skeleton
|
This shows that it would be interesting to manage to install skeleton
|
||||||
coverage analysis to the test suite.
|
coverage analysis to the test suite.
|
||||||
|
|
||||||
** Table definitions
|
|
||||||
It should be very easy to factor the definition of the various tables,
|
|
||||||
including the separation bw declaration and definition. See for
|
|
||||||
instance b4_table_define in lalr1.cc. This way, we could even factor
|
|
||||||
C vs. C++ definitions.
|
|
||||||
|
|
||||||
* From lalr1.cc to yacc.c
|
* From lalr1.cc to yacc.c
|
||||||
** Single stack
|
** Single stack
|
||||||
Merging the three stacks in lalr1.cc simplified the code, prompted for
|
Merging the three stacks in lalr1.cc simplified the code, prompted for
|
||||||
@@ -137,13 +176,13 @@ part of $default. Should we make the two reductions explicit, or just
|
|||||||
keep $default? See the following point.
|
keep $default? See the following point.
|
||||||
|
|
||||||
** Disabled Reductions
|
** Disabled Reductions
|
||||||
See `tests/conflicts.at (Defaulted Conflicted Reduction)', and decide
|
See 'tests/conflicts.at (Defaulted Conflicted Reduction)', and decide
|
||||||
what we want to do.
|
what we want to do.
|
||||||
|
|
||||||
** Documentation
|
** Documentation
|
||||||
Extend with error productions. The hard part will probably be finding
|
Extend with error productions. The hard part will probably be finding
|
||||||
the right rule so that a single state does not exhibit too many yet
|
the right rule so that a single state does not exhibit too many yet
|
||||||
undocumented ``features''. Maybe an empty action ought to be
|
undocumented ''features''. Maybe an empty action ought to be
|
||||||
presented too. Shall we try to make a single grammar with all these
|
presented too. Shall we try to make a single grammar with all these
|
||||||
features, or should we have several very small grammars?
|
features, or should we have several very small grammars?
|
||||||
|
|
||||||
@@ -204,9 +243,9 @@ into
|
|||||||
exp: exp '+' exp | exp '&' exp;
|
exp: exp '+' exp | exp '&' exp;
|
||||||
|
|
||||||
when there are no actions. This can significantly speed up some
|
when there are no actions. This can significantly speed up some
|
||||||
grammars. I can't find the papers. In particular the book `LR
|
grammars. I can't find the papers. In particular the book 'LR
|
||||||
parsing: Theory and Practice' is impossible to find, but according to
|
parsing: Theory and Practice' is impossible to find, but according to
|
||||||
`Parsing Techniques: a Practical Guide', it includes information about
|
'Parsing Techniques: a Practical Guide', it includes information about
|
||||||
this issue. Does anybody have it?
|
this issue. Does anybody have it?
|
||||||
|
|
||||||
|
|
||||||
@@ -234,9 +273,6 @@ Paul notes:
|
|||||||
tokens, either via escapes (e.g., "x\0y") or via a NUL byte in
|
tokens, either via escapes (e.g., "x\0y") or via a NUL byte in
|
||||||
the source code. This should get fixed.
|
the source code. This should get fixed.
|
||||||
|
|
||||||
* --graph
|
|
||||||
Show reductions.
|
|
||||||
|
|
||||||
* Broken options ?
|
* Broken options ?
|
||||||
** %token-table
|
** %token-table
|
||||||
** Skeleton strategy
|
** Skeleton strategy
|
||||||
@@ -333,7 +369,8 @@ End:
|
|||||||
|
|
||||||
-----
|
-----
|
||||||
|
|
||||||
Copyright (C) 2001-2004, 2006, 2008-2012 Free Software Foundation, Inc.
|
Copyright (C) 2001-2004, 2006, 2008-2015, 2018 Free Software Foundation,
|
||||||
|
Inc.
|
||||||
|
|
||||||
This file is part of Bison, the GNU Compiler Compiler.
|
This file is part of Bison, the GNU Compiler Compiler.
|
||||||
|
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
#! /bin/sh
|
#! /bin/sh
|
||||||
# Print a version string.
|
# Print a version string.
|
||||||
scriptversion=2012-07-19.14; # UTC
|
scriptversion=2018-07-25.07; # UTC
|
||||||
|
|
||||||
# Bootstrap this package from checked-out sources.
|
# Bootstrap this package from checked-out sources.
|
||||||
|
|
||||||
# Copyright (C) 2003-2012 Free Software Foundation, Inc.
|
# Copyright (C) 2003-2018 Free Software Foundation, Inc.
|
||||||
|
|
||||||
# This program is free software: you can redistribute it and/or modify
|
# 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
|
# it under the terms of the GNU General Public License as published by
|
||||||
@@ -17,7 +17,7 @@ scriptversion=2012-07-19.14; # UTC
|
|||||||
# GNU General Public License for more details.
|
# GNU General Public License for more details.
|
||||||
|
|
||||||
# You should have received a copy of the GNU General Public License
|
# You should have received a copy of the GNU General Public License
|
||||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
# Originally written by Paul Eggert. The canonical version of this
|
# Originally written by Paul Eggert. The canonical version of this
|
||||||
# script is maintained as build-aux/bootstrap in gnulib, however, to
|
# script is maintained as build-aux/bootstrap in gnulib, however, to
|
||||||
@@ -42,8 +42,13 @@ export LC_ALL
|
|||||||
|
|
||||||
local_gl_dir=gl
|
local_gl_dir=gl
|
||||||
|
|
||||||
|
# Honor $PERL, but work even if there is none.
|
||||||
|
PERL="${PERL-perl}"
|
||||||
|
|
||||||
me=$0
|
me=$0
|
||||||
|
|
||||||
|
default_gnulib_url=git://git.sv.gnu.org/gnulib
|
||||||
|
|
||||||
usage() {
|
usage() {
|
||||||
cat <<EOF
|
cat <<EOF
|
||||||
Usage: $me [OPTION]...
|
Usage: $me [OPTION]...
|
||||||
@@ -73,6 +78,37 @@ contents are read as shell variables to configure the bootstrap.
|
|||||||
For build prerequisites, environment variables like \$AUTOCONF and \$AMTAR
|
For build prerequisites, environment variables like \$AUTOCONF and \$AMTAR
|
||||||
are honored.
|
are honored.
|
||||||
|
|
||||||
|
Gnulib sources can be fetched in various ways:
|
||||||
|
|
||||||
|
* If this package is in a git repository with a 'gnulib' submodule
|
||||||
|
configured, then that submodule is initialized and updated and sources
|
||||||
|
are fetched from there. If \$GNULIB_SRCDIR is set (directly or via
|
||||||
|
--gnulib-srcdir) and is a git repository, then it is used as a reference.
|
||||||
|
|
||||||
|
* Otherwise, if \$GNULIB_SRCDIR is set (directly or via --gnulib-srcdir),
|
||||||
|
then sources are fetched from that local directory. If it is a git
|
||||||
|
repository and \$GNULIB_REVISION is set, then that revision is checked
|
||||||
|
out.
|
||||||
|
|
||||||
|
* Otherwise, if this package is in a git repository with a 'gnulib'
|
||||||
|
submodule configured, then that submodule is initialized and updated and
|
||||||
|
sources are fetched from there.
|
||||||
|
|
||||||
|
* Otherwise, if the 'gnulib' directory does not exist, Gnulib sources are
|
||||||
|
cloned into that directory using git from \$GNULIB_URL, defaulting to
|
||||||
|
$default_gnulib_url.
|
||||||
|
If \$GNULIB_REVISION is set, then that revision is checked out.
|
||||||
|
|
||||||
|
* Otherwise, the existing Gnulib sources in the 'gnulib' directory are
|
||||||
|
used. If it is a git repository and \$GNULIB_REVISION is set, then that
|
||||||
|
revision is checked out.
|
||||||
|
|
||||||
|
If you maintain a package and want to pin a particular revision of the
|
||||||
|
Gnulib sources that has been tested with your package, then there are two
|
||||||
|
possible approaches: either configure a 'gnulib' submodule with the
|
||||||
|
appropriate revision, or set \$GNULIB_REVISION (and if necessary
|
||||||
|
\$GNULIB_URL) in $me.conf.
|
||||||
|
|
||||||
Running without arguments will suffice in most cases.
|
Running without arguments will suffice in most cases.
|
||||||
EOF
|
EOF
|
||||||
}
|
}
|
||||||
@@ -132,28 +168,29 @@ bootstrap_epilogue() { :; }
|
|||||||
# options because the latest/%s directory and the .po files within are
|
# options because the latest/%s directory and the .po files within are
|
||||||
# all symlinks.
|
# all symlinks.
|
||||||
po_download_command_format=\
|
po_download_command_format=\
|
||||||
"rsync --delete --exclude '*.s1' -Lrtvz \
|
"rsync --include '*.po' --exclude '*' -Lrtvz \
|
||||||
'translationproject.org::tp/latest/%s/' '%s'"
|
'translationproject.org::tp/latest/%s/' '%s'"
|
||||||
|
|
||||||
# Fallback for downloading .po files (if rsync fails).
|
# Fallback for downloading .po files (if rsync fails).
|
||||||
po_download_command_format2=\
|
po_download_command_format2=\
|
||||||
"wget --mirror -nd -q -np -A.po -P '%s' \
|
"wget --mirror -nd -q -np -A.po -P '%s' \
|
||||||
http://translationproject.org/latest/%s/"
|
https://translationproject.org/latest/%s/"
|
||||||
|
|
||||||
|
# Prefer a non-empty tarname (4th argument of AC_INIT if given), else
|
||||||
|
# fall back to the package name (1st argument with munging)
|
||||||
extract_package_name='
|
extract_package_name='
|
||||||
/^AC_INIT(/{
|
/^AC_INIT(\[*/{
|
||||||
/.*,.*,.*, */{
|
s///
|
||||||
s///
|
/^[^,]*,[^,]*,[^,]*,[ []*\([^][ ,)]\)/{
|
||||||
s/[][]//g
|
s//\1/
|
||||||
s/)$//
|
s/[],)].*//
|
||||||
p
|
p
|
||||||
q
|
q
|
||||||
}
|
}
|
||||||
s/AC_INIT(\[*//
|
s/[],)].*//
|
||||||
s/]*,.*//
|
|
||||||
s/^GNU //
|
s/^GNU //
|
||||||
y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/
|
y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/
|
||||||
s/[^A-Za-z0-9_]/-/g
|
s/[^abcdefghijklmnopqrstuvwxyz0123456789_]/-/g
|
||||||
p
|
p
|
||||||
}
|
}
|
||||||
'
|
'
|
||||||
@@ -166,7 +203,15 @@ source_base=lib
|
|||||||
m4_base=m4
|
m4_base=m4
|
||||||
doc_base=doc
|
doc_base=doc
|
||||||
tests_base=tests
|
tests_base=tests
|
||||||
gnulib_extra_files=''
|
gnulib_extra_files="
|
||||||
|
build-aux/install-sh
|
||||||
|
build-aux/mdate-sh
|
||||||
|
build-aux/texinfo.tex
|
||||||
|
build-aux/depcomp
|
||||||
|
build-aux/config.guess
|
||||||
|
build-aux/config.sub
|
||||||
|
doc/INSTALL
|
||||||
|
"
|
||||||
|
|
||||||
# Additional gnulib-tool options to use. Use "\newline" to break lines.
|
# Additional gnulib-tool options to use. Use "\newline" to break lines.
|
||||||
gnulib_tool_option_extras=
|
gnulib_tool_option_extras=
|
||||||
@@ -208,12 +253,26 @@ bootstrap_sync=false
|
|||||||
# Use git to update gnulib sources
|
# Use git to update gnulib sources
|
||||||
use_git=true
|
use_git=true
|
||||||
|
|
||||||
|
check_exists() {
|
||||||
|
if test "$1" = "--verbose"; then
|
||||||
|
($2 --version </dev/null) >/dev/null 2>&1
|
||||||
|
if test $? -ge 126; then
|
||||||
|
# If not found, run with diagnostics as one may be
|
||||||
|
# presented with env variables to set to find the right version
|
||||||
|
($2 --version </dev/null)
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
($1 --version </dev/null) >/dev/null 2>&1
|
||||||
|
fi
|
||||||
|
|
||||||
|
test $? -lt 126
|
||||||
|
}
|
||||||
|
|
||||||
# find_tool ENVVAR NAMES...
|
# find_tool ENVVAR NAMES...
|
||||||
# -------------------------
|
# -------------------------
|
||||||
# Search for a required program. Use the value of ENVVAR, if set,
|
# Search for a required program. Use the value of ENVVAR, if set,
|
||||||
# otherwise find the first of the NAMES that can be run (i.e.,
|
# otherwise find the first of the NAMES that can be run.
|
||||||
# supports --version). If found, set ENVVAR to the program name,
|
# If found, set ENVVAR to the program name, die otherwise.
|
||||||
# die otherwise.
|
|
||||||
#
|
#
|
||||||
# FIXME: code duplication, see also gnu-web-doc-update.
|
# FIXME: code duplication, see also gnu-web-doc-update.
|
||||||
find_tool ()
|
find_tool ()
|
||||||
@@ -223,27 +282,21 @@ find_tool ()
|
|||||||
find_tool_names=$@
|
find_tool_names=$@
|
||||||
eval "find_tool_res=\$$find_tool_envvar"
|
eval "find_tool_res=\$$find_tool_envvar"
|
||||||
if test x"$find_tool_res" = x; then
|
if test x"$find_tool_res" = x; then
|
||||||
for i
|
for i; do
|
||||||
do
|
if check_exists $i; then
|
||||||
if ($i --version </dev/null) >/dev/null 2>&1; then
|
find_tool_res=$i
|
||||||
find_tool_res=$i
|
break
|
||||||
break
|
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
else
|
|
||||||
find_tool_error_prefix="\$$find_tool_envvar: "
|
|
||||||
fi
|
fi
|
||||||
test x"$find_tool_res" != x \
|
if test x"$find_tool_res" = x; then
|
||||||
|| die "one of these is required: $find_tool_names"
|
warn_ "one of these is required: $find_tool_names;"
|
||||||
($find_tool_res --version </dev/null) >/dev/null 2>&1 \
|
die "alternatively set $find_tool_envvar to a compatible tool"
|
||||||
|| die "${find_tool_error_prefix}cannot run $find_tool_res --version"
|
fi
|
||||||
eval "$find_tool_envvar=\$find_tool_res"
|
eval "$find_tool_envvar=\$find_tool_res"
|
||||||
eval "export $find_tool_envvar"
|
eval "export $find_tool_envvar"
|
||||||
}
|
}
|
||||||
|
|
||||||
# Find sha1sum, named gsha1sum on MacPorts, and shasum on Mac OS X 10.6.
|
|
||||||
find_tool SHA1SUM sha1sum gsha1sum shasum
|
|
||||||
|
|
||||||
# Override the default configuration, if necessary.
|
# Override the default configuration, if necessary.
|
||||||
# Make sure that bootstrap.conf is sourced from the current directory
|
# Make sure that bootstrap.conf is sourced from the current directory
|
||||||
# if we were invoked as "sh bootstrap".
|
# if we were invoked as "sh bootstrap".
|
||||||
@@ -252,24 +305,18 @@ case "$0" in
|
|||||||
*) test -r "$0.conf" && . ./"$0.conf" ;;
|
*) test -r "$0.conf" && . ./"$0.conf" ;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
# Extra files from gnulib, which override files from other sources.
|
|
||||||
test -z "${gnulib_extra_files}" && \
|
|
||||||
gnulib_extra_files="
|
|
||||||
$build_aux/install-sh
|
|
||||||
$build_aux/mdate-sh
|
|
||||||
$build_aux/texinfo.tex
|
|
||||||
$build_aux/depcomp
|
|
||||||
$build_aux/config.guess
|
|
||||||
$build_aux/config.sub
|
|
||||||
doc/INSTALL
|
|
||||||
"
|
|
||||||
|
|
||||||
if test "$vc_ignore" = auto; then
|
if test "$vc_ignore" = auto; then
|
||||||
vc_ignore=
|
vc_ignore=
|
||||||
test -d .git && vc_ignore=.gitignore
|
test -d .git && vc_ignore=.gitignore
|
||||||
test -d CVS && vc_ignore="$vc_ignore .cvsignore"
|
test -d CVS && vc_ignore="$vc_ignore .cvsignore"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if test x"$gnulib_modules$gnulib_files$gnulib_extra_files" = x; then
|
||||||
|
use_gnulib=false
|
||||||
|
else
|
||||||
|
use_gnulib=true
|
||||||
|
fi
|
||||||
|
|
||||||
# Translate configuration into internal form.
|
# Translate configuration into internal form.
|
||||||
|
|
||||||
# Parse options.
|
# Parse options.
|
||||||
@@ -306,34 +353,34 @@ if test -n "$checkout_only_file" && test ! -r "$checkout_only_file"; then
|
|||||||
die "Bootstrapping from a non-checked-out distribution is risky."
|
die "Bootstrapping from a non-checked-out distribution is risky."
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Ensure that lines starting with ! sort last, per gitignore conventions
|
# Strip blank and comment lines to leave significant entries.
|
||||||
# for whitelisting exceptions after a more generic blacklist pattern.
|
gitignore_entries() {
|
||||||
sort_patterns() {
|
sed '/^#/d; /^$/d' "$@"
|
||||||
sort -u "$@" | sed '/^!/ {
|
|
||||||
H
|
|
||||||
d
|
|
||||||
}
|
|
||||||
$ {
|
|
||||||
P
|
|
||||||
x
|
|
||||||
s/^\n//
|
|
||||||
}' | sed '/^$/d'
|
|
||||||
}
|
}
|
||||||
|
|
||||||
# If $STR is not already on a line by itself in $FILE, insert it,
|
# If $STR is not already on a line by itself in $FILE, insert it at the start.
|
||||||
# sorting the new contents of the file and replacing $FILE with the result.
|
# Entries are inserted at the start of the ignore list to ensure existing
|
||||||
insert_sorted_if_absent() {
|
# entries starting with ! are not overridden. Such entries support
|
||||||
|
# whitelisting exceptions after a more generic blacklist pattern.
|
||||||
|
insert_if_absent() {
|
||||||
file=$1
|
file=$1
|
||||||
str=$2
|
str=$2
|
||||||
test -f $file || touch $file
|
test -f $file || touch $file
|
||||||
echo "$str" | sort_patterns - $file | cmp -s - $file > /dev/null \
|
test -r $file || die "Error: failed to read ignore file: $file"
|
||||||
|| { echo "$str" | sort_patterns - $file > $file.bak \
|
duplicate_entries=$(gitignore_entries $file | sort | uniq -d)
|
||||||
&& mv $file.bak $file; } \
|
if [ "$duplicate_entries" ] ; then
|
||||||
|| die "insert_sorted_if_absent $file $str: failed"
|
die "Error: Duplicate entries in $file: " $duplicate_entries
|
||||||
|
fi
|
||||||
|
linesold=$(gitignore_entries $file | wc -l)
|
||||||
|
linesnew=$( { echo "$str"; cat $file; } | gitignore_entries | sort -u | wc -l)
|
||||||
|
if [ $linesold != $linesnew ] ; then
|
||||||
|
{ echo "$str" | cat - $file > $file.bak && mv $file.bak $file; } \
|
||||||
|
|| die "insert_if_absent $file $str: failed"
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
# Adjust $PATTERN for $VC_IGNORE_FILE and insert it with
|
# Adjust $PATTERN for $VC_IGNORE_FILE and insert it with
|
||||||
# insert_sorted_if_absent.
|
# insert_if_absent.
|
||||||
insert_vc_ignore() {
|
insert_vc_ignore() {
|
||||||
vc_ignore_file="$1"
|
vc_ignore_file="$1"
|
||||||
pattern="$2"
|
pattern="$2"
|
||||||
@@ -344,7 +391,7 @@ insert_vc_ignore() {
|
|||||||
# .gitignore entry.
|
# .gitignore entry.
|
||||||
pattern=$(echo "$pattern" | sed s,^,/,);;
|
pattern=$(echo "$pattern" | sed s,^,/,);;
|
||||||
esac
|
esac
|
||||||
insert_sorted_if_absent "$vc_ignore_file" "$pattern"
|
insert_if_absent "$vc_ignore_file" "$pattern"
|
||||||
}
|
}
|
||||||
|
|
||||||
# Die if there is no AC_CONFIG_AUX_DIR($build_aux) line in configure.ac.
|
# Die if there is no AC_CONFIG_AUX_DIR($build_aux) line in configure.ac.
|
||||||
@@ -406,28 +453,30 @@ sort_ver() { # sort -V is not generally available
|
|||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
|
get_version_sed='
|
||||||
|
# Move version to start of line.
|
||||||
|
s/.*[v ]\([0-9]\)/\1/
|
||||||
|
|
||||||
|
# Skip lines that do not start with version.
|
||||||
|
/^[0-9]/!d
|
||||||
|
|
||||||
|
# Remove characters after the version.
|
||||||
|
s/[^.a-z0-9-].*//
|
||||||
|
|
||||||
|
# The first component must be digits only.
|
||||||
|
s/^\([0-9]*\)[a-z-].*/\1/
|
||||||
|
|
||||||
|
#the following essentially does s/5.005/5.5/
|
||||||
|
s/\.0*\([1-9]\)/.\1/g
|
||||||
|
p
|
||||||
|
q'
|
||||||
|
|
||||||
get_version() {
|
get_version() {
|
||||||
app=$1
|
app=$1
|
||||||
|
|
||||||
$app --version >/dev/null 2>&1 || return 1
|
$app --version >/dev/null 2>&1 || { $app --version; return 1; }
|
||||||
|
|
||||||
$app --version 2>&1 |
|
$app --version 2>&1 | sed -n "$get_version_sed"
|
||||||
sed -n '# Move version to start of line.
|
|
||||||
s/.*[v ]\([0-9]\)/\1/
|
|
||||||
|
|
||||||
# Skip lines that do not start with version.
|
|
||||||
/^[0-9]/!d
|
|
||||||
|
|
||||||
# Remove characters after the version.
|
|
||||||
s/[^.a-z0-9-].*//
|
|
||||||
|
|
||||||
# The first component must be digits only.
|
|
||||||
s/^\([0-9]*\)[a-z-].*/\1/
|
|
||||||
|
|
||||||
#the following essentially does s/5.005/5.5/
|
|
||||||
s/\.0*\([1-9]\)/.\1/g
|
|
||||||
p
|
|
||||||
q'
|
|
||||||
}
|
}
|
||||||
|
|
||||||
check_versions() {
|
check_versions() {
|
||||||
@@ -447,6 +496,7 @@ check_versions() {
|
|||||||
test "$appvar" = TAR && appvar=AMTAR
|
test "$appvar" = TAR && appvar=AMTAR
|
||||||
case $appvar in
|
case $appvar in
|
||||||
GZIP) ;; # Do not use $GZIP: it contains gzip options.
|
GZIP) ;; # Do not use $GZIP: it contains gzip options.
|
||||||
|
PERL::*) ;; # Keep perl modules as-is
|
||||||
*) eval "app=\${$appvar-$app}" ;;
|
*) eval "app=\${$appvar-$app}" ;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
@@ -464,12 +514,22 @@ check_versions() {
|
|||||||
ret=1
|
ret=1
|
||||||
continue
|
continue
|
||||||
} ;;
|
} ;;
|
||||||
|
# Another check is for perl modules. These can be written as
|
||||||
|
# e.g. perl::XML::XPath in case of XML::XPath module, etc.
|
||||||
|
perl::*)
|
||||||
|
# Extract module name
|
||||||
|
app="${app#perl::}"
|
||||||
|
if ! $PERL -m"$app" -e 'exit 0' >/dev/null 2>&1; then
|
||||||
|
warn_ "Error: perl module '$app' not found"
|
||||||
|
ret=1
|
||||||
|
fi
|
||||||
|
continue
|
||||||
|
;;
|
||||||
esac
|
esac
|
||||||
if [ "$req_ver" = "-" ]; then
|
if [ "$req_ver" = "-" ]; then
|
||||||
# Merely require app to exist; not all prereq apps are well-behaved
|
# Merely require app to exist; not all prereq apps are well-behaved
|
||||||
# so we have to rely on $? rather than get_version.
|
# so we have to rely on $? rather than get_version.
|
||||||
$app --version >/dev/null 2>&1
|
if ! check_exists --verbose $app; then
|
||||||
if [ 126 -le $? ]; then
|
|
||||||
warn_ "Error: '$app' not found"
|
warn_ "Error: '$app' not found"
|
||||||
ret=1
|
ret=1
|
||||||
fi
|
fi
|
||||||
@@ -502,6 +562,12 @@ print_versions() {
|
|||||||
# can't depend on column -t
|
# can't depend on column -t
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Find sha1sum, named gsha1sum on MacPorts, shasum on Mac OS X 10.6.
|
||||||
|
# Also find the compatible sha1 utility on the BSDs
|
||||||
|
if test x"$SKIP_PO" = x; then
|
||||||
|
find_tool SHA1SUM sha1sum gsha1sum shasum sha1
|
||||||
|
fi
|
||||||
|
|
||||||
use_libtool=0
|
use_libtool=0
|
||||||
# We'd like to use grep -E, to see if any of LT_INIT,
|
# We'd like to use grep -E, to see if any of LT_INIT,
|
||||||
# AC_PROG_LIBTOOL, AM_PROG_LIBTOOL is used in configure.ac,
|
# AC_PROG_LIBTOOL, AM_PROG_LIBTOOL is used in configure.ac,
|
||||||
@@ -547,13 +613,21 @@ if ! printf "$buildreq" | check_versions; then
|
|||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# Warn the user if autom4te appears to be broken; this causes known
|
||||||
|
# issues with at least gettext 0.18.3.
|
||||||
|
probe=$(echo 'm4_quote([hi])' | autom4te -l M4sugar -t 'm4_quote:$%' -)
|
||||||
|
if test "x$probe" != xhi; then
|
||||||
|
warn_ "WARNING: your autom4te wrapper eats stdin;"
|
||||||
|
warn_ "if bootstrap fails, consider upgrading your autotools"
|
||||||
|
fi
|
||||||
|
|
||||||
echo "$0: Bootstrapping from checked-out $package sources..."
|
echo "$0: Bootstrapping from checked-out $package sources..."
|
||||||
|
|
||||||
# See if we can use gnulib's git-merge-changelog merge driver.
|
# See if we can use gnulib's git-merge-changelog merge driver.
|
||||||
if test -d .git && (git --version) >/dev/null 2>/dev/null ; then
|
if $use_git && test -d .git && check_exists git; then
|
||||||
if git config merge.merge-changelog.driver >/dev/null ; then
|
if git config merge.merge-changelog.driver >/dev/null ; then
|
||||||
:
|
:
|
||||||
elif (git-merge-changelog --version) >/dev/null 2>/dev/null ; then
|
elif check_exists git-merge-changelog; then
|
||||||
echo "$0: initializing git-merge-changelog driver"
|
echo "$0: initializing git-merge-changelog driver"
|
||||||
git config merge.merge-changelog.name 'GNU-style ChangeLog merge driver'
|
git config merge.merge-changelog.name 'GNU-style ChangeLog merge driver'
|
||||||
git config merge.merge-changelog.driver 'git-merge-changelog %O %A %B'
|
git config merge.merge-changelog.driver 'git-merge-changelog %O %A %B'
|
||||||
@@ -573,73 +647,94 @@ git_modules_config () {
|
|||||||
test -f .gitmodules && git config --file .gitmodules "$@"
|
test -f .gitmodules && git config --file .gitmodules "$@"
|
||||||
}
|
}
|
||||||
|
|
||||||
gnulib_path=$(git_modules_config submodule.gnulib.path)
|
if $use_gnulib; then
|
||||||
test -z "$gnulib_path" && gnulib_path=gnulib
|
if $use_git; then
|
||||||
|
gnulib_path=$(git_modules_config submodule.gnulib.path)
|
||||||
# Get gnulib files.
|
test -z "$gnulib_path" && gnulib_path=gnulib
|
||||||
|
|
||||||
case ${GNULIB_SRCDIR--} in
|
|
||||||
-)
|
|
||||||
if git_modules_config submodule.gnulib.url >/dev/null; then
|
|
||||||
echo "$0: getting gnulib files..."
|
|
||||||
git submodule init || exit $?
|
|
||||||
git submodule update || exit $?
|
|
||||||
|
|
||||||
elif [ ! -d "$gnulib_path" ]; then
|
|
||||||
echo "$0: getting gnulib files..."
|
|
||||||
|
|
||||||
trap cleanup_gnulib 1 2 13 15
|
|
||||||
|
|
||||||
shallow=
|
|
||||||
git clone -h 2>&1 | grep -- --depth > /dev/null && shallow='--depth 2'
|
|
||||||
git clone $shallow git://git.sv.gnu.org/gnulib "$gnulib_path" ||
|
|
||||||
cleanup_gnulib
|
|
||||||
|
|
||||||
trap - 1 2 13 15
|
|
||||||
fi
|
fi
|
||||||
GNULIB_SRCDIR=$gnulib_path
|
|
||||||
;;
|
# Get gnulib files. Populate $GNULIB_SRCDIR, possibly updating a
|
||||||
*)
|
# submodule, for use in the rest of the script.
|
||||||
# Use GNULIB_SRCDIR as a reference.
|
|
||||||
if test -d "$GNULIB_SRCDIR"/.git && \
|
case ${GNULIB_SRCDIR--} in
|
||||||
git_modules_config submodule.gnulib.url >/dev/null; then
|
-)
|
||||||
echo "$0: getting gnulib files..."
|
# Note that $use_git is necessarily true in this case.
|
||||||
if git submodule -h|grep -- --reference > /dev/null; then
|
if git_modules_config submodule.gnulib.url >/dev/null; then
|
||||||
# Prefer the one-liner available in git 1.6.4 or newer.
|
echo "$0: getting gnulib files..."
|
||||||
git submodule update --init --reference "$GNULIB_SRCDIR" \
|
git submodule init -- "$gnulib_path" || exit $?
|
||||||
"$gnulib_path" || exit $?
|
git submodule update -- "$gnulib_path" || exit $?
|
||||||
else
|
|
||||||
# This fallback allows at least git 1.5.5.
|
elif [ ! -d "$gnulib_path" ]; then
|
||||||
if test -f "$gnulib_path"/gnulib-tool; then
|
echo "$0: getting gnulib files..."
|
||||||
# Since file already exists, assume submodule init already complete.
|
|
||||||
git submodule update || exit $?
|
trap cleanup_gnulib 1 2 13 15
|
||||||
else
|
|
||||||
# Older git can't clone into an empty directory.
|
shallow=
|
||||||
rmdir "$gnulib_path" 2>/dev/null
|
if test -z "$GNULIB_REVISION"; then
|
||||||
git clone --reference "$GNULIB_SRCDIR" \
|
git clone -h 2>&1 | grep -- --depth > /dev/null && shallow='--depth 2'
|
||||||
"$(git_modules_config submodule.gnulib.url)" "$gnulib_path" \
|
|
||||||
&& git submodule init && git submodule update \
|
|
||||||
|| exit $?
|
|
||||||
fi
|
fi
|
||||||
|
git clone $shallow ${GNULIB_URL:-$default_gnulib_url} "$gnulib_path" \
|
||||||
|
|| cleanup_gnulib
|
||||||
|
|
||||||
|
trap - 1 2 13 15
|
||||||
fi
|
fi
|
||||||
GNULIB_SRCDIR=$gnulib_path
|
GNULIB_SRCDIR=$gnulib_path
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
# Use GNULIB_SRCDIR directly or as a reference.
|
||||||
|
if $use_git && test -d "$GNULIB_SRCDIR"/.git && \
|
||||||
|
git_modules_config submodule.gnulib.url >/dev/null; then
|
||||||
|
echo "$0: getting gnulib files..."
|
||||||
|
if git submodule -h|grep -- --reference > /dev/null; then
|
||||||
|
# Prefer the one-liner available in git 1.6.4 or newer.
|
||||||
|
git submodule update --init --reference "$GNULIB_SRCDIR" \
|
||||||
|
"$gnulib_path" || exit $?
|
||||||
|
else
|
||||||
|
# This fallback allows at least git 1.5.5.
|
||||||
|
if test -f "$gnulib_path"/gnulib-tool; then
|
||||||
|
# Since file already exists, assume submodule init already complete.
|
||||||
|
git submodule update -- "$gnulib_path" || exit $?
|
||||||
|
else
|
||||||
|
# Older git can't clone into an empty directory.
|
||||||
|
rmdir "$gnulib_path" 2>/dev/null
|
||||||
|
git clone --reference "$GNULIB_SRCDIR" \
|
||||||
|
"$(git_modules_config submodule.gnulib.url)" "$gnulib_path" \
|
||||||
|
&& git submodule init -- "$gnulib_path" \
|
||||||
|
&& git submodule update -- "$gnulib_path" \
|
||||||
|
|| exit $?
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
GNULIB_SRCDIR=$gnulib_path
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
if test -d "$GNULIB_SRCDIR"/.git && test -n "$GNULIB_REVISION" \
|
||||||
|
&& ! git_modules_config submodule.gnulib.url >/dev/null; then
|
||||||
|
(cd "$GNULIB_SRCDIR" && git checkout "$GNULIB_REVISION") || cleanup_gnulib
|
||||||
fi
|
fi
|
||||||
;;
|
|
||||||
esac
|
|
||||||
|
|
||||||
if $bootstrap_sync; then
|
# $GNULIB_SRCDIR now points to the version of gnulib to use, and
|
||||||
cmp -s "$0" "$GNULIB_SRCDIR/build-aux/bootstrap" || {
|
# we no longer need to use git or $gnulib_path below here.
|
||||||
echo "$0: updating bootstrap and restarting..."
|
|
||||||
exec sh -c \
|
if $bootstrap_sync; then
|
||||||
'cp "$1" "$2" && shift && exec "${CONFIG_SHELL-/bin/sh}" "$@"' \
|
cmp -s "$0" "$GNULIB_SRCDIR/build-aux/bootstrap" || {
|
||||||
-- "$GNULIB_SRCDIR/build-aux/bootstrap" \
|
echo "$0: updating bootstrap and restarting..."
|
||||||
"$0" "$@" --no-bootstrap-sync
|
case $(sh -c 'echo "$1"' -- a) in
|
||||||
}
|
a) ignored=--;;
|
||||||
|
*) ignored=ignored;;
|
||||||
|
esac
|
||||||
|
exec sh -c \
|
||||||
|
'cp "$1" "$2" && shift && exec "${CONFIG_SHELL-/bin/sh}" "$@"' \
|
||||||
|
$ignored "$GNULIB_SRCDIR/build-aux/bootstrap" \
|
||||||
|
"$0" "$@" --no-bootstrap-sync
|
||||||
|
}
|
||||||
|
fi
|
||||||
|
|
||||||
|
gnulib_tool=$GNULIB_SRCDIR/gnulib-tool
|
||||||
|
<$gnulib_tool || exit $?
|
||||||
fi
|
fi
|
||||||
|
|
||||||
gnulib_tool=$GNULIB_SRCDIR/gnulib-tool
|
|
||||||
<$gnulib_tool || exit $?
|
|
||||||
|
|
||||||
# Get translations.
|
# Get translations.
|
||||||
|
|
||||||
download_po_files() {
|
download_po_files() {
|
||||||
@@ -648,7 +743,7 @@ download_po_files() {
|
|||||||
echo "$me: getting translations into $subdir for $domain..."
|
echo "$me: getting translations into $subdir for $domain..."
|
||||||
cmd=$(printf "$po_download_command_format" "$domain" "$subdir")
|
cmd=$(printf "$po_download_command_format" "$domain" "$subdir")
|
||||||
eval "$cmd" && return
|
eval "$cmd" && return
|
||||||
# Fallback to HTTP.
|
# Fallback to HTTPS.
|
||||||
cmd=$(printf "$po_download_command_format2" "$subdir" "$domain")
|
cmd=$(printf "$po_download_command_format2" "$subdir" "$domain")
|
||||||
eval "$cmd"
|
eval "$cmd"
|
||||||
}
|
}
|
||||||
@@ -680,11 +775,10 @@ update_po_files() {
|
|||||||
cksum_file="$ref_po_dir/$po.s1"
|
cksum_file="$ref_po_dir/$po.s1"
|
||||||
if ! test -f "$cksum_file" ||
|
if ! test -f "$cksum_file" ||
|
||||||
! test -f "$po_dir/$po.po" ||
|
! test -f "$po_dir/$po.po" ||
|
||||||
! $SHA1SUM -c --status "$cksum_file" \
|
! $SHA1SUM -c "$cksum_file" < "$new_po" > /dev/null 2>&1; then
|
||||||
< "$new_po" > /dev/null; then
|
|
||||||
echo "$me: updated $po_dir/$po.po..."
|
echo "$me: updated $po_dir/$po.po..."
|
||||||
cp "$new_po" "$po_dir/$po.po" \
|
cp "$new_po" "$po_dir/$po.po" \
|
||||||
&& $SHA1SUM < "$new_po" > "$cksum_file"
|
&& $SHA1SUM < "$new_po" > "$cksum_file" || return
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
@@ -740,9 +834,9 @@ symlink_to_dir()
|
|||||||
# Leave any existing symlink alone, if it already points to the source,
|
# Leave any existing symlink alone, if it already points to the source,
|
||||||
# so that broken build tools that care about symlink times
|
# so that broken build tools that care about symlink times
|
||||||
# aren't confused into doing unnecessary builds. Conversely, if the
|
# aren't confused into doing unnecessary builds. Conversely, if the
|
||||||
# existing symlink's time stamp is older than the source, make it afresh,
|
# existing symlink's timestamp is older than the source, make it afresh,
|
||||||
# so that broken tools aren't confused into skipping needed builds. See
|
# so that broken tools aren't confused into skipping needed builds. See
|
||||||
# <http://lists.gnu.org/archive/html/bug-gnulib/2011-05/msg00326.html>.
|
# <https://lists.gnu.org/r/bug-gnulib/2011-05/msg00326.html>.
|
||||||
test -h "$dst" &&
|
test -h "$dst" &&
|
||||||
src_ls=$(ls -diL "$src" 2>/dev/null) && set $src_ls && src_i=$1 &&
|
src_ls=$(ls -diL "$src" 2>/dev/null) && set $src_ls && src_i=$1 &&
|
||||||
dst_ls=$(ls -diL "$dst" 2>/dev/null) && set $dst_ls && dst_i=$1 &&
|
dst_ls=$(ls -diL "$dst" 2>/dev/null) && set $dst_ls && dst_i=$1 &&
|
||||||
@@ -848,31 +942,33 @@ fi
|
|||||||
|
|
||||||
# Import from gnulib.
|
# Import from gnulib.
|
||||||
|
|
||||||
gnulib_tool_options="\
|
if $use_gnulib; then
|
||||||
--import\
|
gnulib_tool_options="\
|
||||||
--no-changelog\
|
--no-changelog\
|
||||||
--aux-dir $build_aux\
|
--aux-dir=$build_aux\
|
||||||
--doc-base $doc_base\
|
--doc-base=$doc_base\
|
||||||
--lib $gnulib_name\
|
--lib=$gnulib_name\
|
||||||
--m4-base $m4_base/\
|
--m4-base=$m4_base/\
|
||||||
--source-base $source_base/\
|
--source-base=$source_base/\
|
||||||
--tests-base $tests_base\
|
--tests-base=$tests_base\
|
||||||
--local-dir $local_gl_dir\
|
--local-dir=$local_gl_dir\
|
||||||
$gnulib_tool_option_extras\
|
$gnulib_tool_option_extras\
|
||||||
"
|
"
|
||||||
if test $use_libtool = 1; then
|
if test $use_libtool = 1; then
|
||||||
case "$gnulib_tool_options " in
|
case "$gnulib_tool_options " in
|
||||||
*' --libtool '*) ;;
|
*' --libtool '*) ;;
|
||||||
*) gnulib_tool_options="$gnulib_tool_options --libtool" ;;
|
*) gnulib_tool_options="$gnulib_tool_options --libtool" ;;
|
||||||
esac
|
esac
|
||||||
fi
|
fi
|
||||||
echo "$0: $gnulib_tool $gnulib_tool_options --import ..."
|
echo "$0: $gnulib_tool $gnulib_tool_options --import ..."
|
||||||
$gnulib_tool $gnulib_tool_options --import $gnulib_modules &&
|
$gnulib_tool $gnulib_tool_options --import $gnulib_modules \
|
||||||
|
|| die "gnulib-tool failed"
|
||||||
|
|
||||||
for file in $gnulib_files; do
|
for file in $gnulib_files; do
|
||||||
symlink_to_dir "$GNULIB_SRCDIR" $file \
|
symlink_to_dir "$GNULIB_SRCDIR" $file \
|
||||||
|| die "failed to symlink $file"
|
|| die "failed to symlink $file"
|
||||||
done
|
done
|
||||||
|
fi
|
||||||
|
|
||||||
bootstrap_post_import_hook \
|
bootstrap_post_import_hook \
|
||||||
|| die "bootstrap_post_import_hook failed"
|
|| die "bootstrap_post_import_hook failed"
|
||||||
@@ -889,20 +985,21 @@ find "$m4_base" "$source_base" \
|
|||||||
-depth \( -name '*.m4' -o -name '*.[ch]' \) \
|
-depth \( -name '*.m4' -o -name '*.[ch]' \) \
|
||||||
-type l -xtype l -delete > /dev/null 2>&1
|
-type l -xtype l -delete > /dev/null 2>&1
|
||||||
|
|
||||||
|
# Invoke autoreconf with --force --install to ensure upgrades of tools
|
||||||
|
# such as ylwrap.
|
||||||
|
AUTORECONFFLAGS="--verbose --install --force -I $m4_base $ACLOCAL_FLAGS"
|
||||||
|
|
||||||
# Some systems (RHEL 5) are using ancient autotools, for which the
|
# Some systems (RHEL 5) are using ancient autotools, for which the
|
||||||
# --no-recursive option had not been invented. Detect that lack and
|
# --no-recursive option had not been invented. Detect that lack and
|
||||||
# omit the option when it's not supported. FIXME in 2017: remove this
|
# omit the option when it's not supported. FIXME in 2017: remove this
|
||||||
# hack when RHEL 5 autotools are updated, or when they become irrelevant.
|
# hack when RHEL 5 autotools are updated, or when they become irrelevant.
|
||||||
no_recursive=
|
|
||||||
case $($AUTORECONF --help) in
|
case $($AUTORECONF --help) in
|
||||||
*--no-recursive*) no_recursive=--no-recursive;;
|
*--no-recursive*) AUTORECONFFLAGS="$AUTORECONFFLAGS --no-recursive";;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
# Tell autoreconf not to invoke autopoint or libtoolize; they were run above.
|
# Tell autoreconf not to invoke autopoint or libtoolize; they were run above.
|
||||||
echo "running: AUTOPOINT=true LIBTOOLIZE=true " \
|
echo "running: AUTOPOINT=true LIBTOOLIZE=true $AUTORECONF $AUTORECONFFLAGS"
|
||||||
"$AUTORECONF --verbose --install $no_recursive -I $m4_base $ACLOCAL_FLAGS"
|
AUTOPOINT=true LIBTOOLIZE=true $AUTORECONF $AUTORECONFFLAGS \
|
||||||
AUTOPOINT=true LIBTOOLIZE=true \
|
|
||||||
$AUTORECONF --verbose --install $no_recursive -I $m4_base $ACLOCAL_FLAGS \
|
|
||||||
|| die "autoreconf failed"
|
|| die "autoreconf failed"
|
||||||
|
|
||||||
# Get some extra files from gnulib, overriding existing files.
|
# Get some extra files from gnulib, overriding existing files.
|
||||||
@@ -968,9 +1065,9 @@ bootstrap_epilogue
|
|||||||
echo "$0: done. Now you can run './configure'."
|
echo "$0: done. Now you can run './configure'."
|
||||||
|
|
||||||
# Local variables:
|
# Local variables:
|
||||||
# eval: (add-hook 'write-file-hooks 'time-stamp)
|
# eval: (add-hook 'before-save-hook 'time-stamp)
|
||||||
# time-stamp-start: "scriptversion="
|
# time-stamp-start: "scriptversion="
|
||||||
# time-stamp-format: "%:y-%02m-%02d.%02H"
|
# time-stamp-format: "%:y-%02m-%02d.%02H"
|
||||||
# time-stamp-time-zone: "UTC"
|
# time-stamp-time-zone: "UTC0"
|
||||||
# time-stamp-end: "; # UTC"
|
# time-stamp-end: "; # UTC"
|
||||||
# End:
|
# End:
|
||||||
|
|||||||
+16
-10
@@ -1,6 +1,6 @@
|
|||||||
# Bootstrap configuration.
|
# Bootstrap configuration.
|
||||||
|
|
||||||
# Copyright (C) 2006-2012 Free Software Foundation, Inc.
|
# Copyright (C) 2006-2015, 2018 Free Software Foundation, Inc.
|
||||||
|
|
||||||
# This program is free software: you can redistribute it and/or modify
|
# 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
|
# it under the terms of the GNU General Public License as published by
|
||||||
@@ -17,19 +17,26 @@
|
|||||||
|
|
||||||
# gnulib modules used by this package.
|
# gnulib modules used by this package.
|
||||||
gnulib_modules='
|
gnulib_modules='
|
||||||
argmatch assert calloc-posix close closeout config-h c-strcase
|
argmatch assert
|
||||||
|
calloc-posix close closeout config-h c-strcase
|
||||||
configmake
|
configmake
|
||||||
dirname
|
dirname
|
||||||
error extensions fdl fopen-safer getopt-gnu
|
error extensions fdl fopen-safer
|
||||||
|
getopt-gnu
|
||||||
gettext git-version-gen gitlog-to-changelog
|
gettext git-version-gen gitlog-to-changelog
|
||||||
gpl-3.0 hash inttypes isnan javacomp-script
|
gpl-3.0 hash inttypes isnan javacomp-script
|
||||||
javaexec-script ldexpl malloc-gnu
|
javaexec-script ldexpl malloc-gnu
|
||||||
mbswidth obstack perror progname
|
mbswidth
|
||||||
|
non-recursive-gnulib-prefix-hack
|
||||||
|
obstack
|
||||||
|
obstack-printf
|
||||||
|
perror progname
|
||||||
quote quotearg
|
quote quotearg
|
||||||
readme-release
|
readme-release
|
||||||
realloc-posix
|
realloc-posix
|
||||||
spawn-pipe stdbool stpcpy strdup-posix strerror strtoul strverscmp
|
spawn-pipe stdbool stpcpy strdup-posix strerror strverscmp
|
||||||
unistd unistd-safer unlocked-io update-copyright unsetenv verify
|
unistd unistd-safer unlink unlocked-io
|
||||||
|
update-copyright unsetenv verify
|
||||||
warnings
|
warnings
|
||||||
xalloc
|
xalloc
|
||||||
xalloc-die
|
xalloc-die
|
||||||
@@ -45,9 +52,8 @@ gnulib_modules='
|
|||||||
XGETTEXT_OPTIONS=$XGETTEXT_OPTIONS'\\\
|
XGETTEXT_OPTIONS=$XGETTEXT_OPTIONS'\\\
|
||||||
--from-code=UTF-8\\\
|
--from-code=UTF-8\\\
|
||||||
--flag=asprintf:2:c-format\\\
|
--flag=asprintf:2:c-format\\\
|
||||||
--flag=complain:2:c-format\\\
|
--flag=complain:3:c-format\\\
|
||||||
--flag=complain_at:3:c-format\\\
|
--flag=complain_indent:4:c-format\\\
|
||||||
--flag=complain_at_indent:4:c-format\\\
|
|
||||||
--flag=unexpected_end:2:c-format\\\
|
--flag=unexpected_end:2:c-format\\\
|
||||||
'
|
'
|
||||||
XGETTEXT_OPTIONS_RUNTIME=$XGETTEXT_OPTIONS'\\\
|
XGETTEXT_OPTIONS_RUNTIME=$XGETTEXT_OPTIONS'\\\
|
||||||
@@ -76,7 +82,7 @@ gnulib_tool_option_extras='--symlink --makefile-name=gnulib.mk'
|
|||||||
bootstrap_post_import_hook()
|
bootstrap_post_import_hook()
|
||||||
{
|
{
|
||||||
# Massage lib/gnulib.mk before using it later in the bootstrapping process.
|
# Massage lib/gnulib.mk before using it later in the bootstrapping process.
|
||||||
etc/prefix-gnulib-mk --lib-name=$gnulib_name lib/$gnulib_mk
|
build-aux/prefix-gnulib-mk --lib-name="$gnulib_name" "lib/$gnulib_mk"
|
||||||
|
|
||||||
# Ensure that ChangeLog exists, for automake.
|
# Ensure that ChangeLog exists, for automake.
|
||||||
test -f ChangeLog || touch ChangeLog
|
test -f ChangeLog || touch ChangeLog
|
||||||
|
|||||||
@@ -1,6 +1,4 @@
|
|||||||
/announce-gen
|
/announce-gen
|
||||||
/arg-nonnull.h
|
|
||||||
/c++defs.h
|
|
||||||
/compile
|
/compile
|
||||||
/config.guess
|
/config.guess
|
||||||
/config.rpath
|
/config.rpath
|
||||||
@@ -16,13 +14,12 @@
|
|||||||
/install-sh
|
/install-sh
|
||||||
/javacomp.sh.in
|
/javacomp.sh.in
|
||||||
/javaexec.sh.in
|
/javaexec.sh.in
|
||||||
/link-warning.h
|
|
||||||
/mdate-sh
|
/mdate-sh
|
||||||
/missing
|
/missing
|
||||||
|
/prefix-gnulib-mk
|
||||||
/test-driver
|
/test-driver
|
||||||
/texinfo.tex
|
/texinfo.tex
|
||||||
/update-copyright
|
/update-copyright
|
||||||
/useless-if-before-free
|
/useless-if-before-free
|
||||||
/vc-list-files
|
/vc-list-files
|
||||||
/warn-on-use.h
|
|
||||||
/ylwrap
|
/ylwrap
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
# Copyright (C) 2012 Free Software Foundation, Inc.
|
# Copyright (C) 2012-2015, 2018 Free Software Foundation, Inc.
|
||||||
|
|
||||||
# This program is free software: you can redistribute it and/or modify
|
# 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
|
# it under the terms of the GNU General Public License as published by
|
||||||
@@ -0,0 +1,48 @@
|
|||||||
|
# Copyright (C) 2012-2015, 2018 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 3 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, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
# Valgrind suppression file for Bison.
|
||||||
|
|
||||||
|
# Linux prague 4.1.2-2-ARCH #1 SMP PREEMPT Wed Jul 15 08:30:32 UTC 2015
|
||||||
|
# x86_64 GNU/Linux
|
||||||
|
{
|
||||||
|
Probably exception handling from G++ 5.1.
|
||||||
|
Memcheck:Leak
|
||||||
|
match-leak-kinds: reachable
|
||||||
|
fun:malloc
|
||||||
|
fun:pool
|
||||||
|
fun:__static_initialization_and_destruction_0
|
||||||
|
fun:_GLOBAL__sub_I_eh_alloc.cc
|
||||||
|
fun:call_init.part.0
|
||||||
|
fun:_dl_init
|
||||||
|
obj:/usr/lib/ld-2.21.so
|
||||||
|
}
|
||||||
|
|
||||||
|
# Linux seattle 2.6.32-5-amd64 #1 SMP Thu Mar 22 17:26:33 UTC 2012
|
||||||
|
# x86_64 GNU/Linux
|
||||||
|
{
|
||||||
|
index
|
||||||
|
Memcheck:Cond
|
||||||
|
fun:index
|
||||||
|
fun:expand_dynamic_string_token
|
||||||
|
fun:_dl_map_object
|
||||||
|
fun:map_doit
|
||||||
|
fun:_dl_catch_error
|
||||||
|
fun:do_preload
|
||||||
|
fun:dl_main
|
||||||
|
fun:_dl_sysdep_start
|
||||||
|
fun:_dl_start
|
||||||
|
obj:/lib/ld-2.11.3.so
|
||||||
|
}
|
||||||
@@ -1,3 +1,11 @@
|
|||||||
# This file is expected to be used via gitlog-to-changelog's --amend=FILE
|
# This file is expected to be used via gitlog-to-changelog's --amend=FILE
|
||||||
# option. It specifies what changes to make to each given SHA1's commit
|
# option. It specifies what changes to make to each given SHA1's commit
|
||||||
# log and metadata, using Perl-eval'able expressions.
|
# log and metadata, using Perl-eval'able expressions.
|
||||||
|
|
||||||
|
975bb564319aa4f4204c48aba265757ba207a80f
|
||||||
|
s/Edligner/Edlinger/;
|
||||||
|
|
||||||
|
0db2648930e3b6c376a539aabe368aade83ee29a
|
||||||
|
s/--flags/--feature/;
|
||||||
|
s/flag_flag/feature_flag/;
|
||||||
|
s/\bflag\b/feature/;
|
||||||
|
|||||||
+7
-8
@@ -1,6 +1,4 @@
|
|||||||
## Makefile for Bison testsuite.
|
# Copyright (C) 2000-2015, 2018 Free Software Foundation, Inc.
|
||||||
|
|
||||||
# Copyright (C) 2000-2012 Free Software Foundation, Inc.
|
|
||||||
#
|
#
|
||||||
# This program is free software: you can redistribute it and/or modify
|
# 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
|
# it under the terms of the GNU General Public License as published by
|
||||||
@@ -15,9 +13,10 @@
|
|||||||
# You should have received a copy of the GNU General Public License
|
# You should have received a copy of the GNU General Public License
|
||||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
EXTRA_DIST += \
|
EXTRA_DIST += \
|
||||||
build-aux/cross-options.pl \
|
build-aux/Darwin.valgrind \
|
||||||
build-aux/darwin11.4.0.valgrind \
|
build-aux/Linux.valgrind \
|
||||||
build-aux/move-if-change \
|
build-aux/cross-options.pl \
|
||||||
build-aux/prev-version.txt \
|
build-aux/move-if-change \
|
||||||
|
build-aux/prev-version.txt \
|
||||||
build-aux/update-b4-copyright
|
build-aux/update-b4-copyright
|
||||||
|
|||||||
@@ -1,4 +0,0 @@
|
|||||||
/_Noreturn.h
|
|
||||||
/arg-nonnull.h
|
|
||||||
/c++defs.h
|
|
||||||
/warn-on-use.h
|
|
||||||
@@ -3,7 +3,7 @@
|
|||||||
# Update b4_copyright invocations or b4_copyright_years definitions to
|
# Update b4_copyright invocations or b4_copyright_years definitions to
|
||||||
# include the current year.
|
# include the current year.
|
||||||
|
|
||||||
# Copyright (C) 2009-2012 Free Software Foundation, Inc.
|
# Copyright (C) 2009-2015, 2018 Free Software Foundation, Inc.
|
||||||
|
|
||||||
# This program is free software; you can redistribute it and/or modify
|
# 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
|
# it under the terms of the GNU General Public License as published by
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
# In configure.ac, update PACKAGE_COPYRIGHT_YEAR to the current year.
|
# In configure.ac, update PACKAGE_COPYRIGHT_YEAR to the current year.
|
||||||
|
|
||||||
# Copyright (C) 2010-2012 Free Software Foundation, Inc.
|
# Copyright (C) 2010-2015, 2018 Free Software Foundation, Inc.
|
||||||
#
|
#
|
||||||
# This program is free software; you can redistribute it and/or modify
|
# 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
|
# it under the terms of the GNU General Public License as published by
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
# Customize maint.mk -*- makefile -*-
|
# Customize maint.mk -*- makefile -*-
|
||||||
# Copyright (C) 2008-2012 Free Software Foundation, Inc.
|
# Copyright (C) 2008-2015, 2018 Free Software Foundation, Inc.
|
||||||
|
|
||||||
# This program is free software: you can redistribute it and/or modify
|
# 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
|
# it under the terms of the GNU General Public License as published by
|
||||||
@@ -24,6 +24,7 @@ regen: _version
|
|||||||
|
|
||||||
# Used in maint.mk's web-manual rule
|
# Used in maint.mk's web-manual rule
|
||||||
manual_title = The Yacc-compatible Parser Generator
|
manual_title = The Yacc-compatible Parser Generator
|
||||||
|
gendocs_options_ = -I $(abs_top_srcdir)/doc -I $(abs_top_builddir)/doc
|
||||||
|
|
||||||
# It's useful to run maintainer-*check* targets during development, but we
|
# It's useful to run maintainer-*check* targets during development, but we
|
||||||
# don't want to wait on a recompile because of an update to $(VERSION). Thus,
|
# don't want to wait on a recompile because of an update to $(VERSION). Thus,
|
||||||
@@ -33,7 +34,7 @@ _is-dist-target = $(filter-out %clean maintainer-check% maintainer-%-check, \
|
|||||||
$(filter maintainer-% dist% alpha beta major,$(MAKECMDGOALS)))
|
$(filter maintainer-% dist% alpha beta major,$(MAKECMDGOALS)))
|
||||||
|
|
||||||
url_dir_list = \
|
url_dir_list = \
|
||||||
ftp://$(gnu_rel_host)/gnu/bison
|
https://$(gnu_rel_host)/gnu/bison
|
||||||
|
|
||||||
# Tests not to run as part of "make distcheck".
|
# Tests not to run as part of "make distcheck".
|
||||||
local-checks-to-skip = \
|
local-checks-to-skip = \
|
||||||
@@ -54,19 +55,127 @@ update-copyright: update-b4-copyright update-package-copyright-year
|
|||||||
update-copyright-env = \
|
update-copyright-env = \
|
||||||
UPDATE_COPYRIGHT_FORCE=1 UPDATE_COPYRIGHT_USE_INTERVALS=1
|
UPDATE_COPYRIGHT_FORCE=1 UPDATE_COPYRIGHT_USE_INTERVALS=1
|
||||||
|
|
||||||
|
|
||||||
|
## -------------------- ##
|
||||||
|
## More syntax-checks. ##
|
||||||
|
## -------------------- ##
|
||||||
|
|
||||||
|
# At least for Mac OS X's grep, the order between . and [ in "[^.[]"
|
||||||
|
# matters:
|
||||||
|
# $ LC_ALL=fr_FR grep -nE '[^[.]' /dev/null
|
||||||
|
# $ LC_ALL=C grep -nE '[^[.]' /dev/null
|
||||||
|
# grep: invalid collating element or class
|
||||||
|
# $ LC_ALL=fr_FR grep -nE '[^.[]' /dev/null
|
||||||
|
# $ LC_ALL=C grep -nE '[^.[]' /dev/null
|
||||||
|
sc_at_parser_check:
|
||||||
|
@prohibit='AT_PARSER_CHECK\(\[+[^.[]|AT_CHECK\(\[+\./' \
|
||||||
|
halt='use AT_PARSER_CHECK for and only for generated parsers' \
|
||||||
|
$(_sc_search_regexp)
|
||||||
|
|
||||||
|
# Indent only with spaces.
|
||||||
|
# Taken from Coreutils.
|
||||||
|
sc_prohibit_tab_based_indentation:
|
||||||
|
@prohibit='^ * ' \
|
||||||
|
halt='TAB in indentation; use only spaces' \
|
||||||
|
$(_sc_search_regexp)
|
||||||
|
|
||||||
|
# Prohibit the use of `...` in tests/. Use $(...) instead.
|
||||||
|
# Taken from Coreutils.
|
||||||
|
# Not ready for Bison yet.
|
||||||
|
#sc_prohibit_test_backticks:
|
||||||
|
# @prohibit='`' in_vc_files='^tests/' \
|
||||||
|
# halt='use $$(...), not `...` in tests/' \
|
||||||
|
# $(_sc_search_regexp)
|
||||||
|
|
||||||
|
# Enforce recommended preprocessor indentation style.
|
||||||
|
# Taken from Coreutils.
|
||||||
|
sc_preprocessor_indentation:
|
||||||
|
@if cppi --version >/dev/null 2>&1; then \
|
||||||
|
$(VC_LIST_EXCEPT) | grep '\.[ch]$$' | xargs cppi -a -c \
|
||||||
|
|| { echo '$(ME): incorrect preprocessor indentation' 1>&2; \
|
||||||
|
exit 1; }; \
|
||||||
|
else \
|
||||||
|
echo '$(ME): skipping test $@: cppi not installed' 1>&2; \
|
||||||
|
fi
|
||||||
|
|
||||||
|
###########################################################
|
||||||
|
# Taken from Coreutils.
|
||||||
|
_p0 = \([^"'/]\|"\([^\"]\|[\].\)*"\|'\([^\']\|[\].\)*'
|
||||||
|
_pre = $(_p0)\|[/][^"'/*]\|[/]"\([^\"]\|[\].\)*"\|[/]'\([^\']\|[\].\)*'\)*
|
||||||
|
_pre_anchored = ^\($(_pre)\)
|
||||||
|
_comment_and_close = [^*]\|[*][^/*]\)*[*][*]*/
|
||||||
|
# help font-lock mode: '
|
||||||
|
|
||||||
|
# A sed expression that removes ANSI C and ISO C99 comments.
|
||||||
|
# Derived from the one in GNU gettext's 'moopp' preprocessor.
|
||||||
|
_sed_remove_comments = \
|
||||||
|
/[/][/*]/{ \
|
||||||
|
ta; \
|
||||||
|
:a; \
|
||||||
|
s,$(_pre_anchored)//.*,\1,; \
|
||||||
|
te; \
|
||||||
|
s,$(_pre_anchored)/[*]\($(_comment_and_close),\1 ,; \
|
||||||
|
ta; \
|
||||||
|
/^$(_pre)[/][*]/{ \
|
||||||
|
s,$(_pre_anchored)/[*].*,\1 ,; \
|
||||||
|
tu; \
|
||||||
|
:u; \
|
||||||
|
n; \
|
||||||
|
s,^\($(_comment_and_close),,; \
|
||||||
|
tv; \
|
||||||
|
s,^.*$$,,; \
|
||||||
|
bu; \
|
||||||
|
:v; \
|
||||||
|
}; \
|
||||||
|
:e; \
|
||||||
|
}
|
||||||
|
# Quote all single quotes.
|
||||||
|
_sed_rm_comments_q = $(subst ','\'',$(_sed_remove_comments))
|
||||||
|
# help font-lock mode: '
|
||||||
|
|
||||||
|
_space_before_paren_exempt =? \\n\\$$
|
||||||
|
_space_before_paren_exempt = \
|
||||||
|
(^ *\#|(LA)?LR\([01]\)|percent_(code|define)|b4_syncline|m4_(define|init)|symbol)
|
||||||
|
# Ensure that there is a space before each open parenthesis in C code.
|
||||||
|
sc_space_before_open_paren:
|
||||||
|
@if $(VC_LIST_EXCEPT) | grep -l '\.[ch]$$' > /dev/null; then \
|
||||||
|
fail=0; \
|
||||||
|
for c in $$($(VC_LIST_EXCEPT) | grep '\.[ch]$$'); do \
|
||||||
|
sed '$(_sed_rm_comments_q)' $$c 2>/dev/null \
|
||||||
|
| grep -i '[[:alnum:]](' \
|
||||||
|
| grep -vE '$(_space_before_paren_exempt)' \
|
||||||
|
| grep . && { fail=1; echo "*** $$c"; }; \
|
||||||
|
done; \
|
||||||
|
test $$fail = 1 && \
|
||||||
|
{ echo '$(ME): the above files lack a space-before-open-paren' \
|
||||||
|
1>&2; exit 1; } || :; \
|
||||||
|
else :; \
|
||||||
|
fi
|
||||||
|
|
||||||
|
## -------------------------- ##
|
||||||
|
## syntax-checks exceptions. ##
|
||||||
|
## -------------------------- ##
|
||||||
|
|
||||||
exclude = \
|
exclude = \
|
||||||
$(foreach a,$(1),$(eval $(subst $$,$$$$,exclude_file_name_regexp--sc_$(a))))
|
$(foreach a,$(1),$(eval $(subst $$,$$$$,exclude_file_name_regexp--sc_$(a))))
|
||||||
$(call exclude, \
|
$(call exclude, \
|
||||||
bindtextdomain=^lib/main.c$$ \
|
bindtextdomain=^lib/main.c$$ \
|
||||||
program_name=^lib/main.c$$ \
|
preprocessor_indentation=^data/|^lib/|^src/parse-gram.[ch]$$ \
|
||||||
prohibit_always-defined_macros=^data/yacc.c|^djgpp/ \
|
program_name=^lib/main.c$$ \
|
||||||
prohibit_always-defined_macros+=?|^lib/timevar.c$$ \
|
prohibit_always-defined_macros=^data/yacc.c$$|^djgpp/ \
|
||||||
prohibit_always-defined_macros+=?|^src/(parse-gram.c|system.h)$$ \
|
prohibit_always-defined_macros+=?|^lib/timevar.c$$ \
|
||||||
prohibit_always-defined_macros+=?|^tests/regression.at$$ \
|
prohibit_always-defined_macros+=?|^src/(parse-gram.c|system.h)$$ \
|
||||||
prohibit_defined_have_decl_tests=?|^lib/timevar.c$$ \
|
prohibit_always-defined_macros+=?|^tests/regression.at$$ \
|
||||||
prohibit_empty_lines_at_EOF=^src/parse-gram.h$$ \
|
prohibit_always_true_header_tests=^djgpp/subpipe.h$$|^lib/timevar.c$$ \
|
||||||
prohibit_strcmp=^doc/bison\.texi$$ \
|
prohibit_always_true_header_tests+=?|^m4/timevar.m4$$ \
|
||||||
require_config_h_first=^(lib/yyerror|data/(glr|yacc))\.c$$ \
|
prohibit_defined_have_decl_tests=?|^lib/timevar.c$$ \
|
||||||
space_tab=^tests/(input|c\+\+)\.at$$ \
|
prohibit_doubled_word=^tests/named-refs.at$$ \
|
||||||
unmarked_diagnostics=^(djgpp/|doc/bison.texi$$) \
|
prohibit_magic_number_exit=^doc/bison.texi$$ \
|
||||||
|
prohibit_magic_number_exit+=?|^tests/(conflicts|regression).at$$ \
|
||||||
|
prohibit_strcmp=^doc/bison\.texi|tests/local\.at$$ \
|
||||||
|
prohibit_tab_based_indentation=\.(am|mk)$$|^djgpp/|^\.git|Makefile$$ \
|
||||||
|
require_config_h_first=^(lib/yyerror|data/(glr|yacc))\.c$$ \
|
||||||
|
space_before_open_paren=^(data/|djgpp/) \
|
||||||
|
two_space_separator_in_usage=^(bootstrap) \
|
||||||
|
unmarked_diagnostics=^(djgpp/|doc/bison.texi$$|tests/c\+\+\.at$$) \
|
||||||
)
|
)
|
||||||
|
|||||||
+100
-46
@@ -1,6 +1,6 @@
|
|||||||
# Configure template for GNU Bison. -*-Autoconf-*-
|
# Configure template for GNU Bison. -*-Autoconf-*-
|
||||||
#
|
#
|
||||||
# Copyright (C) 2001-2012 Free Software Foundation, Inc.
|
# Copyright (C) 2001-2015, 2018 Free Software Foundation, Inc.
|
||||||
#
|
#
|
||||||
# This program is free software: you can redistribute it and/or modify
|
# 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
|
# it under the terms of the GNU General Public License as published by
|
||||||
@@ -18,7 +18,7 @@
|
|||||||
# In order for some versions of Sun Studio to compile our C++ test cases
|
# In order for some versions of Sun Studio to compile our C++ test cases
|
||||||
# correctly, we need Autoconf 2.64 or better to handle the restrict
|
# correctly, we need Autoconf 2.64 or better to handle the restrict
|
||||||
# keyword in at least string.h from gnulib. We need Autoconf 2.68 or
|
# keyword in at least string.h from gnulib. We need Autoconf 2.68 or
|
||||||
# better to avoid a typo in the `configure --help' entry for the YACC
|
# better to avoid a typo in the 'configure --help' entry for the YACC
|
||||||
# environment variable.
|
# environment variable.
|
||||||
AC_PREREQ([2.68])
|
AC_PREREQ([2.68])
|
||||||
m4_pattern_forbid([^gl_[A-Z]])
|
m4_pattern_forbid([^gl_[A-Z]])
|
||||||
@@ -26,18 +26,14 @@ m4_pattern_forbid([^gl_[A-Z]])
|
|||||||
AC_INIT([GNU Bison],
|
AC_INIT([GNU Bison],
|
||||||
m4_esyscmd([build-aux/git-version-gen .tarball-version]),
|
m4_esyscmd([build-aux/git-version-gen .tarball-version]),
|
||||||
[[email protected]])
|
[[email protected]])
|
||||||
AC_SUBST([PACKAGE_COPYRIGHT_YEAR], [2012])
|
AC_SUBST([PACKAGE_COPYRIGHT_YEAR], [2018])
|
||||||
AC_DEFINE_UNQUOTED([PACKAGE_COPYRIGHT_YEAR], [$PACKAGE_COPYRIGHT_YEAR],
|
AC_DEFINE_UNQUOTED([PACKAGE_COPYRIGHT_YEAR], [$PACKAGE_COPYRIGHT_YEAR],
|
||||||
[The copyright year for this package])
|
[The copyright year for this package])
|
||||||
|
|
||||||
AC_CONFIG_AUX_DIR([build-aux])
|
AC_CONFIG_AUX_DIR([build-aux])
|
||||||
AC_CONFIG_MACRO_DIR([m4])
|
AC_CONFIG_MACRO_DIR([m4])
|
||||||
|
|
||||||
# Automake 1.10.3 and 1.11.1 fix a security flaw discussed here:
|
# We use Automake 1.14's %D% and %C%.
|
||||||
#
|
|
||||||
# http://thread.gmane.org/gmane.comp.sysutils.autotools.announce/131
|
|
||||||
#
|
|
||||||
# To avoid 1.11, we make 1.11.1 the minimum version.
|
|
||||||
#
|
#
|
||||||
# We want gnits strictness only when rolling a stable release. For
|
# We want gnits strictness only when rolling a stable release. For
|
||||||
# release candidates, we use version strings like 2.4.3_rc1, but gnits
|
# release candidates, we use version strings like 2.4.3_rc1, but gnits
|
||||||
@@ -45,7 +41,7 @@ AC_CONFIG_MACRO_DIR([m4])
|
|||||||
# releases, we want to be able run make dist without being required to
|
# releases, we want to be able run make dist without being required to
|
||||||
# add a bogus NEWS entry. In that case, the version string
|
# add a bogus NEWS entry. In that case, the version string
|
||||||
# automatically contains a dash, which we also let disable gnits.
|
# automatically contains a dash, which we also let disable gnits.
|
||||||
AM_INIT_AUTOMAKE([1.11.1 dist-xz nostdinc
|
AM_INIT_AUTOMAKE([1.14 dist-xz nostdinc
|
||||||
color-tests parallel-tests
|
color-tests parallel-tests
|
||||||
silent-rules]
|
silent-rules]
|
||||||
m4_bmatch(m4_defn([AC_PACKAGE_VERSION]), [[-_]],
|
m4_bmatch(m4_defn([AC_PACKAGE_VERSION]), [[-_]],
|
||||||
@@ -60,32 +56,84 @@ AC_PROG_CXX
|
|||||||
# Gnulib (early checks).
|
# Gnulib (early checks).
|
||||||
gl_EARLY
|
gl_EARLY
|
||||||
|
|
||||||
|
# Gnulib uses '#pragma GCC diagnostic push' to silence some
|
||||||
|
# warnings, but older gcc doesn't support this.
|
||||||
|
AC_CACHE_CHECK([whether pragma GCC diagnostic push works],
|
||||||
|
[lv_cv_gcc_pragma_push_works], [
|
||||||
|
save_CFLAGS=$CFLAGS
|
||||||
|
CFLAGS='-Wunknown-pragmas -Werror'
|
||||||
|
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
|
||||||
|
#pragma GCC diagnostic push
|
||||||
|
#pragma GCC diagnostic pop
|
||||||
|
]])],
|
||||||
|
[lv_cv_gcc_pragma_push_works=yes],
|
||||||
|
[lv_cv_gcc_pragma_push_works=no])
|
||||||
|
CFLAGS=$save_CFLAGS])
|
||||||
|
|
||||||
AC_ARG_ENABLE([gcc-warnings],
|
AC_ARG_ENABLE([gcc-warnings],
|
||||||
[ --enable-gcc-warnings turn on lots of GCC warnings (not recommended)],
|
[ --enable-gcc-warnings turn on lots of GCC warnings (not recommended).
|
||||||
|
Also, issue synclines from the examples/ to
|
||||||
|
the corresponding source in the Texinfo doc.],
|
||||||
[case $enable_gcc_warnings in
|
[case $enable_gcc_warnings in
|
||||||
yes|no) ;;
|
yes|no) ;;
|
||||||
*) AC_MSG_ERROR([invalid value for --gcc-warnings: $enable_gcc_warnings]);;
|
*) AC_MSG_ERROR([invalid value for --gcc-warnings: $enable_gcc_warnings]);;
|
||||||
esac],
|
esac],
|
||||||
[enable_gcc_warnings=no])
|
[enable_gcc_warnings=no])
|
||||||
|
AM_CONDITIONAL([ENABLE_GCC_WARNINGS], [test "$enable_gcc_warnings" = yes])
|
||||||
if test "$enable_gcc_warnings" = yes; then
|
if test "$enable_gcc_warnings" = yes; then
|
||||||
warn_common='-Wall -Wextra -Wno-sign-compare -Wcast-align
|
warn_common='-Wall -Wextra -Wno-sign-compare -Wcast-align -Wdocumentation
|
||||||
-Wcast-qual -Wformat -Wpointer-arith -Wwrite-strings'
|
-Wformat -Wnull-dereference -Wpointer-arith -Wwrite-strings'
|
||||||
warn_c='-Wbad-function-cast -Wmissing-declarations -Wmissing-prototypes
|
warn_c='-Wbad-function-cast -Wshadow -Wstrict-prototypes'
|
||||||
-Wshadow -Wstrict-prototypes'
|
|
||||||
warn_cxx='-Wnoexcept'
|
warn_cxx='-Wnoexcept'
|
||||||
|
# Warnings for the test suite only.
|
||||||
|
#
|
||||||
|
# -fno-color-diagnostics: Clang's use of colors in the error
|
||||||
|
# messages is confusing the tests looking at the compiler's output
|
||||||
|
# (e.g., synclines.at).
|
||||||
|
#
|
||||||
|
# -Wno-keyword-macro: We use the "#define private public" dirty
|
||||||
|
# trick in the test suite to check some private implementation
|
||||||
|
# details for lalr1.cc.
|
||||||
|
warn_tests='-Wundef -pedantic -Wdeprecated -Wsign-compare -fno-color-diagnostics
|
||||||
|
-Wno-keyword-macro'
|
||||||
|
|
||||||
AC_LANG_PUSH([C])
|
AC_LANG_PUSH([C])
|
||||||
|
# Clang supports many of GCC's -W options, but only issues warnings
|
||||||
|
# on the ones it does not recognize. In that case, gl_WARN_ADD
|
||||||
|
# thinks the option is supported, and unknown options are then added
|
||||||
|
# to CFLAGS. But then, when -Werror is added in the test suite for
|
||||||
|
# instance, the warning about the unknown option turns into an
|
||||||
|
# error.
|
||||||
|
#
|
||||||
|
# This should be addressed by gnulib's gl_WARN_ADD, but in the
|
||||||
|
# meanwhile, turn warnings about unknown options into errors in
|
||||||
|
# CFLAGS, and restore CFLAGS after the tests.
|
||||||
|
save_CFLAGS=$CFLAGS
|
||||||
|
gl_WARN_ADD([-Werror=unknown-warning-option], [CFLAGS])
|
||||||
for i in $warn_common $warn_c;
|
for i in $warn_common $warn_c;
|
||||||
do
|
do
|
||||||
gl_WARN_ADD([$i], [WARN_CFLAGS])
|
gl_WARN_ADD([$i], [WARN_CFLAGS])
|
||||||
done
|
done
|
||||||
gl_WARN_ADD([-Werror], [WERROR_CFLAGS])
|
gl_WARN_ADD([-Werror], [WERROR_CFLAGS])
|
||||||
|
|
||||||
|
# Warnings for the test suite, and maybe for bison if GCC is modern
|
||||||
|
# enough.
|
||||||
|
gl_WARN_ADD([-Wmissing-declarations], [WARN_CFLAGS_TEST])
|
||||||
|
gl_WARN_ADD([-Wmissing-prototypes], [WARN_CFLAGS_TEST])
|
||||||
|
test $lv_cv_gcc_pragma_push_works = yes &&
|
||||||
|
AS_VAR_APPEND([WARN_CFLAGS], [" $WARN_CFLAGS_TEST"])
|
||||||
|
|
||||||
# Warnings for the test suite only.
|
# Warnings for the test suite only.
|
||||||
gl_WARN_ADD([-Wundef], [WARN_CFLAGS_TEST])
|
for i in $warn_tests;
|
||||||
gl_WARN_ADD([-pedantic], [WARN_CFLAGS_TEST])
|
do
|
||||||
|
gl_WARN_ADD([$i], [WARN_CFLAGS_TEST])
|
||||||
|
done
|
||||||
|
CFLAGS=$save_CFLAGS
|
||||||
AC_LANG_POP([C])
|
AC_LANG_POP([C])
|
||||||
|
|
||||||
AC_LANG_PUSH([C++])
|
AC_LANG_PUSH([C++])
|
||||||
|
save_CXXFLAGS=$CXXFLAGS
|
||||||
|
gl_WARN_ADD([-Werror=unknown-warning-option], [CXXFLAGS])
|
||||||
for i in $warn_common $warn_cxx;
|
for i in $warn_common $warn_cxx;
|
||||||
do
|
do
|
||||||
gl_WARN_ADD([$i], [WARN_CXXFLAGS])
|
gl_WARN_ADD([$i], [WARN_CXXFLAGS])
|
||||||
@@ -94,32 +142,41 @@ if test "$enable_gcc_warnings" = yes; then
|
|||||||
[AC_LANG_PROGRAM([], [nullptr])])
|
[AC_LANG_PROGRAM([], [nullptr])])
|
||||||
gl_WARN_ADD([-Werror], [WERROR_CXXFLAGS])
|
gl_WARN_ADD([-Werror], [WERROR_CXXFLAGS])
|
||||||
# Warnings for the test suite only.
|
# Warnings for the test suite only.
|
||||||
gl_WARN_ADD([-Wundef], [WARN_CXXFLAGS_TEST])
|
for i in $warn_tests;
|
||||||
gl_WARN_ADD([-pedantic], [WARN_CXXFLAGS_TEST])
|
do
|
||||||
|
gl_WARN_ADD([$i], [WARN_CXXFLAGS_TEST])
|
||||||
|
done
|
||||||
|
# Clang++ 3.2+ reject C code generated by Flex.
|
||||||
|
gl_WARN_ADD([-Wno-null-conversion], [FLEX_SCANNER_CXXFLAGS])
|
||||||
|
# So does G++ 4.8...
|
||||||
|
gl_WARN_ADD([-Wno-sign-compare], [FLEX_SCANNER_CXXFLAGS])
|
||||||
|
# ... possiby in std=c++11 mode.
|
||||||
|
gl_WARN_ADD([-Wno-zero-as-null-pointer-constant], [FLEX_SCANNER_CXXFLAGS])
|
||||||
|
CXXFLAGS=$save_CXXFLAGS
|
||||||
|
gl_WARN_ADD([-fno-exceptions], [CXXFLAGS_NO_EXCEPTIONS])
|
||||||
AC_LANG_POP([C++])
|
AC_LANG_POP([C++])
|
||||||
fi
|
fi
|
||||||
|
|
||||||
BISON_TEST_FOR_WORKING_C_COMPILER
|
BISON_TEST_FOR_WORKING_C_COMPILER
|
||||||
|
BISON_C_COMPILER_POSIXLY_CORRECT
|
||||||
BISON_TEST_FOR_WORKING_CXX_COMPILER
|
BISON_TEST_FOR_WORKING_CXX_COMPILER
|
||||||
|
BISON_CXX_COMPILER_POSIXLY_CORRECT
|
||||||
|
|
||||||
AC_ARG_ENABLE([yacc],
|
AC_ARG_ENABLE([yacc],
|
||||||
[AC_HELP_STRING([--disable-yacc],
|
[AC_HELP_STRING([--disable-yacc],
|
||||||
[do not build a yacc command or an -ly library])],
|
[do not build a yacc command or an -ly library])],
|
||||||
, [enable_yacc=yes])
|
, [enable_yacc=yes])
|
||||||
case $enable_yacc in
|
AM_CONDITIONAL([ENABLE_YACC], [test "$enable_yacc" = yes])
|
||||||
yes)
|
|
||||||
YACC_SCRIPT=src/yacc
|
|
||||||
YACC_LIBRARY=lib/liby.a;;
|
|
||||||
*)
|
|
||||||
YACC_SCRIPT=
|
|
||||||
YACC_LIBRARY=;;
|
|
||||||
esac
|
|
||||||
AC_SUBST([YACC_SCRIPT])
|
|
||||||
AC_SUBST([YACC_LIBRARY])
|
|
||||||
|
|
||||||
# Checks for programs.
|
# Checks for programs.
|
||||||
|
AM_MISSING_PROG([DOT], [dot])
|
||||||
AC_PROG_LEX
|
AC_PROG_LEX
|
||||||
$LEX_IS_FLEX || AC_MSG_ERROR([Flex is required])
|
$LEX_IS_FLEX || test "X$LEX" = X: || {
|
||||||
|
AC_MSG_WARN([bypassing lex because flex is required])
|
||||||
|
LEX=:
|
||||||
|
}
|
||||||
|
AM_CONDITIONAL([FLEX_CXX_WORKS],
|
||||||
|
[$LEX_IS_FLEX && test $bison_cv_cxx_works = yes])
|
||||||
AC_PROG_YACC
|
AC_PROG_YACC
|
||||||
AC_PROG_RANLIB
|
AC_PROG_RANLIB
|
||||||
AC_PROG_GNU_M4
|
AC_PROG_GNU_M4
|
||||||
@@ -169,17 +226,27 @@ AC_CONFIG_FILES([etc/bench.pl], [chmod +x etc/bench.pl])
|
|||||||
AC_CONFIG_TESTDIR(tests)
|
AC_CONFIG_TESTDIR(tests)
|
||||||
AC_CONFIG_FILES([tests/atlocal])
|
AC_CONFIG_FILES([tests/atlocal])
|
||||||
AC_CONFIG_FILES([tests/bison], [chmod +x tests/bison])
|
AC_CONFIG_FILES([tests/bison], [chmod +x tests/bison])
|
||||||
|
|
||||||
AC_CHECK_PROGS([VALGRIND], [valgrind])
|
AC_CHECK_PROGS([VALGRIND], [valgrind])
|
||||||
case $VALGRIND:$host_os in
|
# Use something simpler that $host_os to select our suppression file.
|
||||||
|
uname=`uname`
|
||||||
|
case $VALGRIND:$uname in
|
||||||
'':*) ;;
|
'':*) ;;
|
||||||
*:darwin*)
|
*:Darwin)
|
||||||
# See README-hacking.
|
# See README-hacking.
|
||||||
# VALGRIND+=' --suppressions=$(abs_top_srcdir)/build-aux/darwin11.4.0.valgrind'
|
|
||||||
VALGRIND=;;
|
VALGRIND=;;
|
||||||
*:*)
|
*:*)
|
||||||
AC_SUBST([VALGRIND_PREBISON], [$VALGRIND -q]);;
|
suppfile=build-aux/$uname.valgrind
|
||||||
|
if test -f "$srcdir/$suppfile"; then
|
||||||
|
AC_SUBST([VALGRIND_OPTS_SUPPRESSION],
|
||||||
|
["--suppressions=\$(abs_top_srcdir)/$suppfile"])
|
||||||
|
fi
|
||||||
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
|
# Whether we cannot run the compiled bison.
|
||||||
|
AM_CONDITIONAL([CROSS_COMPILING], [test "$cross_compiling" = yes])
|
||||||
|
|
||||||
AM_MISSING_PROG([AUTOM4TE], [autom4te])
|
AM_MISSING_PROG([AUTOM4TE], [autom4te])
|
||||||
# Needed by tests/atlocal.in.
|
# Needed by tests/atlocal.in.
|
||||||
AC_SUBST([GCC])
|
AC_SUBST([GCC])
|
||||||
@@ -187,19 +254,6 @@ AC_SUBST([GCC])
|
|||||||
gt_JAVACOMP([1.3], [1.4])
|
gt_JAVACOMP([1.3], [1.4])
|
||||||
gt_JAVAEXEC
|
gt_JAVAEXEC
|
||||||
|
|
||||||
# We use gnulib, but from lib/local.mk instead of lib/Makefile.am.
|
|
||||||
# So prefix paths with lib/. See also etc/prefix-gnulib-mk.
|
|
||||||
gl_LIBOBJS=`echo "$gl_LIBOBJS" | sed -e 's, , lib/,g'`
|
|
||||||
# Listing the names of the variables to prefix is error-prone.
|
|
||||||
# Rather, adjust all the AC_SUBST variables whose name ends in '_H',
|
|
||||||
# and whose content ends in '.h'.
|
|
||||||
for ac_var in $ac_subst_vars
|
|
||||||
do
|
|
||||||
eval "ac_val=\$$ac_var"
|
|
||||||
case $ac_var=$ac_val in
|
|
||||||
(*_H=*.h) eval "$ac_var=lib/\$$ac_var";;
|
|
||||||
esac
|
|
||||||
done
|
|
||||||
AC_CONFIG_FILES([Makefile
|
AC_CONFIG_FILES([Makefile
|
||||||
po/Makefile.in
|
po/Makefile.in
|
||||||
doc/yacc.1])
|
doc/yacc.1])
|
||||||
|
|||||||
+6
-4
@@ -1,5 +1,3 @@
|
|||||||
-*- outline -*-
|
|
||||||
|
|
||||||
This directory contains data needed by Bison.
|
This directory contains data needed by Bison.
|
||||||
|
|
||||||
* Skeletons
|
* Skeletons
|
||||||
@@ -27,7 +25,7 @@ Currently, the supported skeletons are:
|
|||||||
These skeletons are the only ones supported by the Bison team.
|
These skeletons are the only ones supported by the Bison team.
|
||||||
Because the interface between skeletons and the bison program is not
|
Because the interface between skeletons and the bison program is not
|
||||||
finished, *we are not bound to it*. In particular, Bison is not
|
finished, *we are not bound to it*. In particular, Bison is not
|
||||||
mature enough for us to consider that ``foreign skeletons'' are
|
mature enough for us to consider that "foreign skeletons" are
|
||||||
supported.
|
supported.
|
||||||
|
|
||||||
* m4sugar
|
* m4sugar
|
||||||
@@ -52,7 +50,11 @@ into various formats.
|
|||||||
|
|
||||||
-----
|
-----
|
||||||
|
|
||||||
Copyright (C) 2002, 2008-2012 Free Software Foundation, Inc.
|
Local Variables:
|
||||||
|
mode: outline
|
||||||
|
End:
|
||||||
|
|
||||||
|
Copyright (C) 2002, 2008-2015, 2018 Free Software Foundation, Inc.
|
||||||
|
|
||||||
This file is part of GNU Bison.
|
This file is part of GNU Bison.
|
||||||
|
|
||||||
|
|||||||
+293
-106
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
# Language-independent M4 Macros for Bison.
|
# Language-independent M4 Macros for Bison.
|
||||||
|
|
||||||
# Copyright (C) 2002, 2004-2012 Free Software Foundation, Inc.
|
# Copyright (C) 2002, 2004-2015, 2018 Free Software Foundation, Inc.
|
||||||
|
|
||||||
# This program is free software: you can redistribute it and/or modify
|
# 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
|
# it under the terms of the GNU General Public License as published by
|
||||||
@@ -61,6 +61,44 @@ This special exception was added by the Free Software Foundation in
|
|||||||
version 2.2 of Bison.])])
|
version 2.2 of Bison.])])
|
||||||
|
|
||||||
|
|
||||||
|
## -------- ##
|
||||||
|
## Output. ##
|
||||||
|
## -------- ##
|
||||||
|
|
||||||
|
# b4_output_begin(FILE)
|
||||||
|
# ---------------------
|
||||||
|
# Enable output, i.e., send to diversion 0, expand after "#", and
|
||||||
|
# generate the tag to output into FILE. Must be followed by EOL.
|
||||||
|
m4_define([b4_output_begin],
|
||||||
|
[m4_changecom()
|
||||||
|
m4_divert_push(0)dnl
|
||||||
|
@output(m4_unquote([$1])@)@dnl
|
||||||
|
])
|
||||||
|
|
||||||
|
|
||||||
|
# b4_output_end()
|
||||||
|
# ---------------
|
||||||
|
# Output nothing, restore # as comment character (no expansions after #).
|
||||||
|
m4_define([b4_output_end],
|
||||||
|
[m4_divert_pop(0)
|
||||||
|
m4_changecom([#])
|
||||||
|
])
|
||||||
|
|
||||||
|
|
||||||
|
# b4_divert_kill(CODE)
|
||||||
|
# --------------------
|
||||||
|
# Expand CODE for its side effects, discard its output.
|
||||||
|
m4_define([b4_divert_kill],
|
||||||
|
[m4_divert_text([KILL], [$1])])
|
||||||
|
|
||||||
|
|
||||||
|
# b4_define_silent(MACRO, CODE)
|
||||||
|
# -----------------------------
|
||||||
|
# Same as m4_define, but throw away the expansion of CODE.
|
||||||
|
m4_define([b4_define_silent],
|
||||||
|
[m4_define([$1], [b4_divert_kill([$2])])])
|
||||||
|
|
||||||
|
|
||||||
## ---------------- ##
|
## ---------------- ##
|
||||||
## Error handling. ##
|
## Error handling. ##
|
||||||
## ---------------- ##
|
## ---------------- ##
|
||||||
@@ -82,30 +120,16 @@ _m4eof
|
|||||||
])dnl
|
])dnl
|
||||||
m4_if(m4_sysval, [0], [], [m4_fatal([$0: cannot write to stdout])])])
|
m4_if(m4_sysval, [0], [], [m4_fatal([$0: cannot write to stdout])])])
|
||||||
|
|
||||||
# b4_error(KIND, FORMAT, [ARG1], [ARG2], ...)
|
# b4_error(KIND, START, END, FORMAT, [ARG1], [ARG2], ...)
|
||||||
# -------------------------------------------
|
# -------------------------------------------------------
|
||||||
# Write @KIND(FORMAT@,ARG1@,ARG2@,...@) to stdout.
|
# Write @KIND(START@,END@,FORMAT@,ARG1@,ARG2@,...@) to stdout.
|
||||||
#
|
#
|
||||||
# For example:
|
# For example:
|
||||||
#
|
#
|
||||||
# b4_error([[warn]], [[invalid value for '%s': %s]], [[foo]], [[3]])
|
# b4_error([[complain]], [[input.y:2.3]], [[input.y:5.4]],
|
||||||
|
# [[invalid %s]], [[foo]])
|
||||||
m4_define([b4_error],
|
m4_define([b4_error],
|
||||||
[b4_cat([[@]$1[(]$2[]]dnl
|
[b4_cat([[@complain][(]$1[@,]$2[@,]$3[@,]$4[]]dnl
|
||||||
[m4_if([$#], [2], [],
|
|
||||||
[m4_foreach([b4_arg],
|
|
||||||
m4_dquote(m4_shift(m4_shift($@))),
|
|
||||||
[[@,]b4_arg])])[@)]])])
|
|
||||||
|
|
||||||
# b4_error_at(KIND, START, END, FORMAT, [ARG1], [ARG2], ...)
|
|
||||||
# ----------------------------------------------------------
|
|
||||||
# Write @KIND_at(START@,END@,FORMAT@,ARG1@,ARG2@,...@) to stdout.
|
|
||||||
#
|
|
||||||
# For example:
|
|
||||||
#
|
|
||||||
# b4_error_at([[complain]], [[input.y:2.3]], [[input.y:5.4]],
|
|
||||||
# [[invalid %s]], [[foo]])
|
|
||||||
m4_define([b4_error_at],
|
|
||||||
[b4_cat([[@]$1[_at(]$2[@,]$3[@,]$4[]]dnl
|
|
||||||
[m4_if([$#], [4], [],
|
[m4_if([$#], [4], [],
|
||||||
[m4_foreach([b4_arg],
|
[m4_foreach([b4_arg],
|
||||||
m4_dquote(m4_shift(m4_shift(m4_shift(m4_shift($@))))),
|
m4_dquote(m4_shift(m4_shift(m4_shift(m4_shift($@))))),
|
||||||
@@ -125,21 +149,21 @@ m4_define([b4_error_at],
|
|||||||
# m4_define([asdf], [ASDF])
|
# m4_define([asdf], [ASDF])
|
||||||
# m4_define([fsa], [FSA])
|
# m4_define([fsa], [FSA])
|
||||||
# m4_define([fdsa], [FDSA])
|
# m4_define([fdsa], [FDSA])
|
||||||
# b4_warn([[[asdf), asdf]]], [[[fsa), fsa]]], [[[fdsa), fdsa]]])
|
# b4_warn_at([[[asdf), asdf]]], [[[fsa), fsa]]], [[[fdsa), fdsa]]])
|
||||||
# b4_warn([[asdf), asdf]], [[fsa), fsa]], [[fdsa), fdsa]])
|
# b4_warn_at([[asdf), asdf]], [[fsa), fsa]], [[fdsa), fdsa]])
|
||||||
# b4_warn()
|
# b4_warn_at()
|
||||||
# b4_warn(1)
|
# b4_warn_at(1)
|
||||||
# b4_warn(1, 2)
|
# b4_warn_at(1, 2)
|
||||||
#
|
#
|
||||||
# Should produce this without newlines:
|
# Should produce this without newlines:
|
||||||
#
|
#
|
||||||
# @warn([asdf), asdf]@,[fsa), fsa]@,[fdsa), fdsa]@)
|
# @warn_at([asdf), asdf]@,@,@,[fsa), fsa]@,[fdsa), fdsa]@)
|
||||||
# @warn(asdf), asdf@,fsa), fsa@,fdsa), fdsa@)
|
# @warn(asdf), asdf@,@,@,fsa), fsa@,fdsa), fdsa@)
|
||||||
# @warn(@)
|
# @warn(@)
|
||||||
# @warn(1@)
|
# @warn(1@)
|
||||||
# @warn(1@,2@)
|
# @warn(1@,2@)
|
||||||
m4_define([b4_warn],
|
m4_define([b4_warn],
|
||||||
[b4_error([[warn]], $@)])
|
[b4_error([[warn]], [], [], $@)])
|
||||||
|
|
||||||
# b4_warn_at(START, END, FORMAT, [ARG1], [ARG2], ...)
|
# b4_warn_at(START, END, FORMAT, [ARG1], [ARG2], ...)
|
||||||
# ---------------------------------------------------
|
# ---------------------------------------------------
|
||||||
@@ -149,15 +173,15 @@ m4_define([b4_warn],
|
|||||||
#
|
#
|
||||||
# b4_warn_at([[input.y:2.3]], [[input.y:5.4]], [[invalid %s]], [[foo]])
|
# b4_warn_at([[input.y:2.3]], [[input.y:5.4]], [[invalid %s]], [[foo]])
|
||||||
m4_define([b4_warn_at],
|
m4_define([b4_warn_at],
|
||||||
[b4_error_at([[warn]], $@)])
|
[b4_error([[warn]], $@)])
|
||||||
|
|
||||||
# b4_complain(FORMAT, [ARG1], [ARG2], ...)
|
# b4_complain(FORMAT, [ARG1], [ARG2], ...)
|
||||||
# ----------------------------------------
|
# ----------------------------------------
|
||||||
# Write @complain(FORMAT@,ARG1@,ARG2@,...@) to stdout.
|
# Bounce to b4_complain_at.
|
||||||
#
|
#
|
||||||
# See b4_warn example.
|
# See b4_warn example.
|
||||||
m4_define([b4_complain],
|
m4_define([b4_complain],
|
||||||
[b4_error([[complain]], $@)])
|
[b4_error([[complain]], [], [], $@)])
|
||||||
|
|
||||||
# b4_complain_at(START, END, FORMAT, [ARG1], [ARG2], ...)
|
# b4_complain_at(START, END, FORMAT, [ARG1], [ARG2], ...)
|
||||||
# -------------------------------------------------------
|
# -------------------------------------------------------
|
||||||
@@ -165,15 +189,15 @@ m4_define([b4_complain],
|
|||||||
#
|
#
|
||||||
# See b4_warn_at example.
|
# See b4_warn_at example.
|
||||||
m4_define([b4_complain_at],
|
m4_define([b4_complain_at],
|
||||||
[b4_error_at([[complain]], $@)])
|
[b4_error([[complain]], $@)])
|
||||||
|
|
||||||
# b4_fatal(FORMAT, [ARG1], [ARG2], ...)
|
# b4_fatal(FORMAT, [ARG1], [ARG2], ...)
|
||||||
# -------------------------------------
|
# -------------------------------------
|
||||||
# Write @fatal(FORMAT@,ARG1@,ARG2@,...@) to stdout and exit.
|
# Bounce to b4_fatal_at.
|
||||||
#
|
#
|
||||||
# See b4_warn example.
|
# See b4_warn example.
|
||||||
m4_define([b4_fatal],
|
m4_define([b4_fatal],
|
||||||
[b4_error([[fatal]], $@)dnl
|
[b4_error([[fatal]], [], [], $@)dnl
|
||||||
m4_exit(1)])
|
m4_exit(1)])
|
||||||
|
|
||||||
# b4_fatal_at(START, END, FORMAT, [ARG1], [ARG2], ...)
|
# b4_fatal_at(START, END, FORMAT, [ARG1], [ARG2], ...)
|
||||||
@@ -182,7 +206,7 @@ m4_exit(1)])
|
|||||||
#
|
#
|
||||||
# See b4_warn_at example.
|
# See b4_warn_at example.
|
||||||
m4_define([b4_fatal_at],
|
m4_define([b4_fatal_at],
|
||||||
[b4_error_at([[fatal]], $@)dnl
|
[b4_error([[fatal]], $@)dnl
|
||||||
m4_exit(1)])
|
m4_exit(1)])
|
||||||
|
|
||||||
|
|
||||||
@@ -206,23 +230,23 @@ m4_define([b4_subtract],
|
|||||||
[m4_eval([$1 - $2])],
|
[m4_eval([$1 - $2])],
|
||||||
[($1) - ($2)])])
|
[($1) - ($2)])])
|
||||||
|
|
||||||
# b4_args(ARG1, ...)
|
# b4_join(ARG1, ...)
|
||||||
# _b4_args(ARG1, ...)
|
# _b4_join(ARG1, ...)
|
||||||
# -------------------
|
# -------------------
|
||||||
# Join with comma, skipping empty arguments.
|
# Join with comma, skipping empty arguments.
|
||||||
# b4_args calls itself recursively until it sees the first non-empty
|
# b4_join calls itself recursively until it sees the first non-empty
|
||||||
# argument, then calls _b4_args which prepends each non-empty argument
|
# argument, then calls _b4_join which prepends each non-empty argument
|
||||||
# with a comma.
|
# with a comma.
|
||||||
m4_define([b4_args],
|
m4_define([b4_join],
|
||||||
[m4_if([$#$1],
|
[m4_if([$#$1],
|
||||||
[1], [],
|
[1], [],
|
||||||
[m4_ifval([$1],
|
[m4_ifval([$1],
|
||||||
[$1[]_$0(m4_shift($@))],
|
[$1[]_$0(m4_shift($@))],
|
||||||
[$0(m4_shift($@))])])])
|
[$0(m4_shift($@))])])])
|
||||||
|
|
||||||
# _b4_args(ARGS1, ...)
|
# _b4_join(ARGS1, ...)
|
||||||
# --------------------
|
# --------------------
|
||||||
m4_define([_b4_args],
|
m4_define([_b4_join],
|
||||||
[m4_if([$#$1],
|
[m4_if([$#$1],
|
||||||
[1], [],
|
[1], [],
|
||||||
[m4_ifval([$1], [, $1])[]$0(m4_shift($@))])])
|
[m4_ifval([$1], [, $1])[]$0(m4_shift($@))])])
|
||||||
@@ -240,30 +264,30 @@ m4_define([b4_integral_parser_tables_map],
|
|||||||
STATE-NUM.]])
|
STATE-NUM.]])
|
||||||
|
|
||||||
$1([defact], [b4_defact],
|
$1([defact], [b4_defact],
|
||||||
[[YYDEFACT[S] -- default reduction number in state S. Performed when
|
[[YYDEFACT[STATE-NUM] -- Default reduction number in state STATE-NUM.
|
||||||
YYTABLE does not specify something else to do. Zero means the default
|
Performed when YYTABLE does not specify something else to do. Zero
|
||||||
is an error.]])
|
means the default is an error.]])
|
||||||
|
|
||||||
$1([pgoto], [b4_pgoto], [[YYPGOTO[NTERM-NUM].]])
|
$1([pgoto], [b4_pgoto], [[YYPGOTO[NTERM-NUM].]])
|
||||||
|
|
||||||
$1([defgoto], [b4_defgoto], [[YYDEFGOTO[NTERM-NUM].]])
|
$1([defgoto], [b4_defgoto], [[YYDEFGOTO[NTERM-NUM].]])
|
||||||
|
|
||||||
$1([table], [b4_table],
|
$1([table], [b4_table],
|
||||||
[[YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
|
[[YYTABLE[YYPACT[STATE-NUM]] -- What to do in state STATE-NUM. If
|
||||||
positive, shift that token. If negative, reduce the rule which
|
positive, shift that token. If negative, reduce the rule whose
|
||||||
number is the opposite. If YYTABLE_NINF, syntax error.]])
|
number is the opposite. If YYTABLE_NINF, syntax error.]])
|
||||||
|
|
||||||
$1([check], [b4_check])
|
$1([check], [b4_check])
|
||||||
|
|
||||||
$1([stos], [b4_stos],
|
$1([stos], [b4_stos],
|
||||||
[[STOS_[STATE-NUM] -- The (internal number of the) accessing
|
[[YYSTOS[STATE-NUM] -- The (internal number of the) accessing
|
||||||
symbol of state STATE-NUM.]])
|
symbol of state STATE-NUM.]])
|
||||||
|
|
||||||
$1([r1], [b4_r1],
|
$1([r1], [b4_r1],
|
||||||
[[YYR1[YYN] -- Symbol number of symbol that rule YYN derives.]])
|
[[YYR1[YYN] -- Symbol number of symbol that rule YYN derives.]])
|
||||||
|
|
||||||
$1([r2], [b4_r2],
|
$1([r2], [b4_r2],
|
||||||
[[YYR2[YYN] -- Number of symbols composing right hand side of rule YYN.]])
|
[[YYR2[YYN] -- Number of symbols on the right hand side of rule YYN.]])
|
||||||
])
|
])
|
||||||
|
|
||||||
|
|
||||||
@@ -290,7 +314,7 @@ m4_define([b4_flag_if],
|
|||||||
[m4_case(b4_$1_flag,
|
[m4_case(b4_$1_flag,
|
||||||
[0], [$3],
|
[0], [$3],
|
||||||
[1], [$2],
|
[1], [$2],
|
||||||
[m4_fatal([invalid $1 value: ]$1)])])
|
[m4_fatal([invalid $1 value: ]b4_$1_flag)])])
|
||||||
|
|
||||||
|
|
||||||
# b4_define_flag_if(FLAG)
|
# b4_define_flag_if(FLAG)
|
||||||
@@ -303,7 +327,7 @@ m4_define([b4_define_flag_if],
|
|||||||
# _b4_define_flag_if($1, $2, FLAG)
|
# _b4_define_flag_if($1, $2, FLAG)
|
||||||
# --------------------------------
|
# --------------------------------
|
||||||
# Work around the impossibility to define macros inside macros,
|
# Work around the impossibility to define macros inside macros,
|
||||||
# because issuing `[$1]' is not possible in M4. GNU M4 should provide
|
# because issuing '[$1]' is not possible in M4. GNU M4 should provide
|
||||||
# $$1 a la M5/TeX.
|
# $$1 a la M5/TeX.
|
||||||
m4_define([_b4_define_flag_if],
|
m4_define([_b4_define_flag_if],
|
||||||
[m4_if([$1$2], $[1]$[2], [],
|
[m4_if([$1$2], $[1]$[2], [],
|
||||||
@@ -331,6 +355,38 @@ b4_define_flag_if([yacc]) # Whether POSIX Yacc is emulated.
|
|||||||
# macro per (token, field), where field can has_id, id, etc.: see
|
# macro per (token, field), where field can has_id, id, etc.: see
|
||||||
# src/output.c:prepare_symbols_definitions().
|
# src/output.c:prepare_symbols_definitions().
|
||||||
#
|
#
|
||||||
|
# The various FIELDS are:
|
||||||
|
#
|
||||||
|
# - has_id: 0 or 1.
|
||||||
|
# Whether the symbol has an id.
|
||||||
|
# - id: string
|
||||||
|
# If has_id, the id. Guaranteed to be usable as a C identifier.
|
||||||
|
# Prefixed by api.token.prefix if defined.
|
||||||
|
# - tag: string.
|
||||||
|
# A representat of the symbol. Can be 'foo', 'foo.id', '"foo"' etc.
|
||||||
|
# - user_number: integer
|
||||||
|
# The assigned (external) number as used by yylex.
|
||||||
|
# - is_token: 0 or 1
|
||||||
|
# Whether this is a terminal symbol.
|
||||||
|
# - number: integer
|
||||||
|
# The internalized number (used after yytranslate).
|
||||||
|
# - has_type: 0, 1
|
||||||
|
# Whether has a semantic value.
|
||||||
|
# - type_tag: string
|
||||||
|
# When api.value.type=union, the generated name for the union member.
|
||||||
|
# yytype_INT etc. for symbols that has_id, otherwise yytype_1 etc.
|
||||||
|
# - type
|
||||||
|
# If it has a semantic value, its type tag, or, if variant are used,
|
||||||
|
# its type.
|
||||||
|
# In the case of api.value.type=union, type is the real type (e.g. int).
|
||||||
|
# - has_printer: 0, 1
|
||||||
|
# - printer: string
|
||||||
|
# - printer_file: string
|
||||||
|
# - printer_line: integer
|
||||||
|
# If the symbol has a printer, everything about it.
|
||||||
|
# - has_destructor, destructor, destructor_file, destructor_line
|
||||||
|
# Likewise.
|
||||||
|
#
|
||||||
# The following macros provide access to these values.
|
# The following macros provide access to these values.
|
||||||
|
|
||||||
# b4_symbol_(NUM, FIELD)
|
# b4_symbol_(NUM, FIELD)
|
||||||
@@ -344,10 +400,10 @@ m4_define([b4_symbol_],
|
|||||||
# b4_symbol(NUM, FIELD)
|
# b4_symbol(NUM, FIELD)
|
||||||
# ---------------------
|
# ---------------------
|
||||||
# Recover a FIELD about symbol #NUM. Thanks to m4_indir, fails if
|
# Recover a FIELD about symbol #NUM. Thanks to m4_indir, fails if
|
||||||
# undefined. If FIELD = id, prepend the prefix.
|
# undefined. If FIELD = id, prepend the token prefix.
|
||||||
m4_define([b4_symbol],
|
m4_define([b4_symbol],
|
||||||
[m4_case([$2],
|
[m4_case([$2],
|
||||||
[id], [m4_do([b4_percent_define_get([api.tokens.prefix])],
|
[id], [m4_do([b4_percent_define_get([api.token.prefix])],
|
||||||
[b4_symbol_([$1], [id])])],
|
[b4_symbol_([$1], [id])])],
|
||||||
[b4_symbol_($@)])])
|
[b4_symbol_($@)])])
|
||||||
|
|
||||||
@@ -363,6 +419,14 @@ m4_define([b4_symbol_if],
|
|||||||
[m4_fatal([$0: field $2 of $1 is not a Boolean:] b4_symbol([$1], [$2]))])])
|
[m4_fatal([$0: field $2 of $1 is not a Boolean:] b4_symbol([$1], [$2]))])])
|
||||||
|
|
||||||
|
|
||||||
|
# b4_symbol_tag_comment(SYMBOL-NUM)
|
||||||
|
# ---------------------------------
|
||||||
|
# Issue a comment giving the tag of symbol NUM.
|
||||||
|
m4_define([b4_symbol_tag_comment],
|
||||||
|
[b4_comment([b4_symbol([$1], [tag])])
|
||||||
|
])
|
||||||
|
|
||||||
|
|
||||||
# b4_symbol_action_location(SYMBOL-NUM, KIND)
|
# b4_symbol_action_location(SYMBOL-NUM, KIND)
|
||||||
# -------------------------------------------
|
# -------------------------------------------
|
||||||
# Report the location of the KIND action as FILE:LINE.
|
# Report the location of the KIND action as FILE:LINE.
|
||||||
@@ -373,22 +437,19 @@ m4_define([b4_symbol_action_location],
|
|||||||
# b4_symbol_action(SYMBOL-NUM, KIND)
|
# b4_symbol_action(SYMBOL-NUM, KIND)
|
||||||
# ----------------------------------
|
# ----------------------------------
|
||||||
# Run the action KIND (destructor or printer) for SYMBOL-NUM.
|
# Run the action KIND (destructor or printer) for SYMBOL-NUM.
|
||||||
# Same as in C, but using references instead of pointers.
|
|
||||||
m4_define([b4_symbol_action],
|
m4_define([b4_symbol_action],
|
||||||
[b4_symbol_if([$1], [has_$2],
|
[b4_symbol_if([$1], [has_$2],
|
||||||
[m4_pushdef([b4_dollar_dollar],
|
[b4_dollar_pushdef([(*yyvaluep)],
|
||||||
[b4_symbol_value([(*yyvaluep)],
|
b4_symbol_if([$1], [has_type],
|
||||||
b4_symbol_if([$1], [has_type],
|
[m4_dquote(b4_symbol([$1], [type]))]),
|
||||||
[b4_symbol([$1], [type])]))])dnl
|
[(*yylocationp)])dnl
|
||||||
m4_pushdef([b4_at_dollar], [(*yylocationp)])dnl
|
b4_symbol_case_([$1])[]dnl
|
||||||
b4_symbol_case_([$1])
|
b4_syncline([b4_symbol([$1], [$2_line])], [b4_symbol([$1], [$2_file])])
|
||||||
b4_syncline([b4_symbol([$1], [$2_line])], ["b4_symbol([$1], [$2_file])"])
|
b4_symbol([$1], [$2])
|
||||||
b4_symbol([$1], [$2])
|
|
||||||
b4_syncline([@oline@], [@ofile@])
|
b4_syncline([@oline@], [@ofile@])
|
||||||
break;
|
break;
|
||||||
|
|
||||||
m4_popdef([b4_at_dollar])dnl
|
b4_dollar_popdef[]dnl
|
||||||
m4_popdef([b4_dollar_dollar])dnl
|
|
||||||
])])
|
])])
|
||||||
|
|
||||||
|
|
||||||
@@ -399,11 +460,29 @@ m4_define([b4_symbol_destructor], [b4_symbol_action([$1], [destructor])])
|
|||||||
m4_define([b4_symbol_printer], [b4_symbol_action([$1], [printer])])
|
m4_define([b4_symbol_printer], [b4_symbol_action([$1], [printer])])
|
||||||
|
|
||||||
|
|
||||||
|
# b4_symbol_actions(KIND, [TYPE = yytype])
|
||||||
|
# ----------------------------------------
|
||||||
|
# Emit the symbol actions for KIND ("printer" or "destructor").
|
||||||
|
# Dispatch on TYPE.
|
||||||
|
m4_define([b4_symbol_actions],
|
||||||
|
[m4_pushdef([b4_actions_], m4_expand([b4_symbol_foreach([b4_symbol_$1])]))dnl
|
||||||
|
m4_ifval(m4_defn([b4_actions_]),
|
||||||
|
[switch (m4_default([$2], [yytype]))
|
||||||
|
{
|
||||||
|
m4_defn([b4_actions_])
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}dnl
|
||||||
|
],
|
||||||
|
[YYUSE (m4_default([$2], [yytype]));])dnl
|
||||||
|
m4_popdef([b4_actions_])dnl
|
||||||
|
])
|
||||||
|
|
||||||
# b4_symbol_case_(SYMBOL-NUM)
|
# b4_symbol_case_(SYMBOL-NUM)
|
||||||
# ---------------------------
|
# ---------------------------
|
||||||
# Issue a "case NUM" for SYMBOL-NUM.
|
# Issue a "case NUM" for SYMBOL-NUM.
|
||||||
m4_define([b4_symbol_case_],
|
m4_define([b4_symbol_case_],
|
||||||
[ case b4_symbol([$1], [number]): // b4_symbol([$1], [tag])
|
[case b4_symbol([$1], [number]): b4_symbol_tag_comment([$1])])
|
||||||
])
|
])
|
||||||
|
|
||||||
|
|
||||||
@@ -461,9 +540,12 @@ m4_define([b4_token_format],
|
|||||||
# ---------------------
|
# ---------------------
|
||||||
# Run actions for the symbol NUMS that all have the same type-name.
|
# Run actions for the symbol NUMS that all have the same type-name.
|
||||||
# Skip NUMS that have no type-name.
|
# Skip NUMS that have no type-name.
|
||||||
|
#
|
||||||
|
# To specify the action to run, define b4_dollar_dollar(NUMBER,
|
||||||
|
# TAG, TYPE).
|
||||||
m4_define([b4_type_action_],
|
m4_define([b4_type_action_],
|
||||||
[b4_symbol_if([$1], [has_type],
|
[b4_symbol_if([$1], [has_type],
|
||||||
[m4_map_args([b4_symbol_case_], $@)[]dnl
|
[m4_map([ b4_symbol_case_], [$@])[]dnl
|
||||||
b4_dollar_dollar([b4_symbol([$1], [number])],
|
b4_dollar_dollar([b4_symbol([$1], [number])],
|
||||||
[b4_symbol([$1], [tag])],
|
[b4_symbol([$1], [tag])],
|
||||||
[b4_symbol([$1], [type])]);
|
[b4_symbol([$1], [type])]);
|
||||||
@@ -495,11 +577,21 @@ m4_define([b4_basename],
|
|||||||
# -----------------------
|
# -----------------------
|
||||||
m4_define([b4_syncline],
|
m4_define([b4_syncline],
|
||||||
[b4_flag_if([synclines],
|
[b4_flag_if([synclines],
|
||||||
[b4_sync_end([__line__], [b4_basename(m4_quote(__file__))])
|
[b4_sync_start([$1], [$2]) b4_sync_end([__line__],
|
||||||
b4_sync_start([$1], [$2])])])
|
[b4_basename(m4_quote(__file__))])[]dnl
|
||||||
|
])])
|
||||||
|
|
||||||
|
# b4_sync_start(LINE, FILE)
|
||||||
|
# -----------------------
|
||||||
|
# Syncline for the new place. Typically a directive for the compiler.
|
||||||
|
m4_define([b4_sync_start], [b4_comment([$2:$1])])
|
||||||
|
|
||||||
|
# b4_sync_end(LINE, FILE)
|
||||||
|
# -----------------------
|
||||||
|
# Syncline for the current place, which ends. Typically a comment
|
||||||
|
# left for the reader.
|
||||||
|
m4_define([b4_sync_end], [b4_comment([$2:$1])])
|
||||||
|
|
||||||
m4_define([b4_sync_end], [b4_comment([Line $1 of $2])])
|
|
||||||
m4_define([b4_sync_start], [b4_comment([Line $1 of $2])])
|
|
||||||
|
|
||||||
# b4_user_code(USER-CODE)
|
# b4_user_code(USER-CODE)
|
||||||
# -----------------------
|
# -----------------------
|
||||||
@@ -521,14 +613,14 @@ m4_define([b4_define_user_code],
|
|||||||
# b4_user_initial_action
|
# b4_user_initial_action
|
||||||
# b4_user_post_prologue
|
# b4_user_post_prologue
|
||||||
# b4_user_pre_prologue
|
# b4_user_pre_prologue
|
||||||
# b4_user_stype
|
# b4_user_union_members
|
||||||
# ----------------------
|
# ----------------------
|
||||||
# Macros that issue user code, ending with synclines.
|
# Macros that issue user code, ending with synclines.
|
||||||
b4_define_user_code([actions])
|
b4_define_user_code([actions])
|
||||||
b4_define_user_code([initial_action])
|
b4_define_user_code([initial_action])
|
||||||
b4_define_user_code([post_prologue])
|
b4_define_user_code([post_prologue])
|
||||||
b4_define_user_code([pre_prologue])
|
b4_define_user_code([pre_prologue])
|
||||||
b4_define_user_code([stype])
|
b4_define_user_code([union_members])
|
||||||
|
|
||||||
|
|
||||||
# b4_check_user_names(WHAT, USER-LIST, BISON-NAMESPACE)
|
# b4_check_user_names(WHAT, USER-LIST, BISON-NAMESPACE)
|
||||||
@@ -609,9 +701,9 @@ m4_define([b4_percent_define_use],
|
|||||||
# b4_percent_define_get([[foo]])
|
# b4_percent_define_get([[foo]])
|
||||||
m4_define([b4_percent_define_get],
|
m4_define([b4_percent_define_get],
|
||||||
[b4_percent_define_use([$1])dnl
|
[b4_percent_define_use([$1])dnl
|
||||||
m4_ifdef([b4_percent_define(]$1[)],
|
b4_percent_define_ifdef_([$1],
|
||||||
[m4_indir([b4_percent_define(]$1[)])],
|
[m4_indir([b4_percent_define(]$1[)])],
|
||||||
[$2])])
|
[$2])])
|
||||||
|
|
||||||
# b4_percent_define_get_loc(VARIABLE)
|
# b4_percent_define_get_loc(VARIABLE)
|
||||||
# -----------------------------------
|
# -----------------------------------
|
||||||
@@ -630,7 +722,21 @@ m4_define([b4_percent_define_get_loc],
|
|||||||
[m4_pushdef([b4_loc], m4_indir([b4_percent_define_loc(]$1[)]))dnl
|
[m4_pushdef([b4_loc], m4_indir([b4_percent_define_loc(]$1[)]))dnl
|
||||||
b4_loc[]dnl
|
b4_loc[]dnl
|
||||||
m4_popdef([b4_loc])],
|
m4_popdef([b4_loc])],
|
||||||
[b4_fatal([[b4_percent_define_get_loc: undefined %%define variable '%s']], [$1])])])
|
[b4_fatal([[$0: undefined %%define variable '%s']], [$1])])])
|
||||||
|
|
||||||
|
# b4_percent_define_get_kind(VARIABLE)
|
||||||
|
# ------------------------------------
|
||||||
|
# Get the kind (code, keyword, string) of VARIABLE, i.e., how its
|
||||||
|
# value was defined (braces, not delimiters, quotes).
|
||||||
|
#
|
||||||
|
# If the %define variable VARIABLE is undefined, complain fatally
|
||||||
|
# since that's a Bison or skeleton error. Don't record this as a
|
||||||
|
# Bison usage of VARIABLE as there's no reason to suspect that the
|
||||||
|
# user-supplied value has yet influenced the output.
|
||||||
|
m4_define([b4_percent_define_get_kind],
|
||||||
|
[m4_ifdef([b4_percent_define_kind(]$1[)],
|
||||||
|
[m4_indir([b4_percent_define_kind(]$1[)])],
|
||||||
|
[b4_fatal([[$0: undefined %%define variable '%s']], [$1])])])
|
||||||
|
|
||||||
# b4_percent_define_get_syncline(VARIABLE)
|
# b4_percent_define_get_syncline(VARIABLE)
|
||||||
# ----------------------------------------
|
# ----------------------------------------
|
||||||
@@ -647,7 +753,20 @@ m4_popdef([b4_loc])],
|
|||||||
m4_define([b4_percent_define_get_syncline],
|
m4_define([b4_percent_define_get_syncline],
|
||||||
[m4_ifdef([b4_percent_define_syncline(]$1[)],
|
[m4_ifdef([b4_percent_define_syncline(]$1[)],
|
||||||
[m4_indir([b4_percent_define_syncline(]$1[)])],
|
[m4_indir([b4_percent_define_syncline(]$1[)])],
|
||||||
[b4_fatal([[b4_percent_define_get_syncline: undefined %%define variable '%s']], [$1])])])
|
[b4_fatal([[$0: undefined %%define variable '%s']], [$1])])])
|
||||||
|
|
||||||
|
# b4_percent_define_ifdef_(VARIABLE, IF-TRUE, [IF-FALSE])
|
||||||
|
# ------------------------------------------------------
|
||||||
|
# If the %define variable VARIABLE is defined, expand IF-TRUE, else expand
|
||||||
|
# IF-FALSE. Don't record usage of VARIABLE.
|
||||||
|
#
|
||||||
|
# For example:
|
||||||
|
#
|
||||||
|
# b4_percent_define_ifdef_([[foo]], [[it's defined]], [[it's undefined]])
|
||||||
|
m4_define([b4_percent_define_ifdef_],
|
||||||
|
[m4_ifdef([b4_percent_define(]$1[)],
|
||||||
|
[$2],
|
||||||
|
[$3])])
|
||||||
|
|
||||||
# b4_percent_define_ifdef(VARIABLE, IF-TRUE, [IF-FALSE])
|
# b4_percent_define_ifdef(VARIABLE, IF-TRUE, [IF-FALSE])
|
||||||
# ------------------------------------------------------
|
# ------------------------------------------------------
|
||||||
@@ -660,9 +779,9 @@ m4_define([b4_percent_define_get_syncline],
|
|||||||
#
|
#
|
||||||
# b4_percent_define_ifdef([[foo]], [[it's defined]], [[it's undefined]])
|
# b4_percent_define_ifdef([[foo]], [[it's defined]], [[it's undefined]])
|
||||||
m4_define([b4_percent_define_ifdef],
|
m4_define([b4_percent_define_ifdef],
|
||||||
[m4_ifdef([b4_percent_define(]$1[)],
|
[b4_percent_define_ifdef_([$1],
|
||||||
[b4_percent_define_use([$1])$2],
|
[b4_percent_define_use([$1])$2],
|
||||||
[$3])])
|
[$3])])
|
||||||
|
|
||||||
|
|
||||||
## --------- ##
|
## --------- ##
|
||||||
@@ -691,11 +810,11 @@ m4_define([b4_percent_define_flag_if],
|
|||||||
[[invalid value for %%define Boolean variable '%s']],
|
[[invalid value for %%define Boolean variable '%s']],
|
||||||
[$1])],
|
[$1])],
|
||||||
[[b4_percent_define_flag_if($1)]])])],
|
[[b4_percent_define_flag_if($1)]])])],
|
||||||
[b4_fatal([[b4_percent_define_flag_if: undefined %%define variable '%s']], [$1])])])
|
[b4_fatal([[$0: undefined %%define variable '%s']], [$1])])])
|
||||||
|
|
||||||
|
|
||||||
# b4_percent_define_default(VARIABLE, DEFAULT)
|
# b4_percent_define_default(VARIABLE, DEFAULT, [KIND = keyword])
|
||||||
# --------------------------------------------
|
# --------------------------------------------------------------
|
||||||
# Mimic muscle_percent_define_default in ../src/muscle-tab.h exactly. That is,
|
# Mimic muscle_percent_define_default in ../src/muscle-tab.h exactly. That is,
|
||||||
# if the %define variable VARIABLE is undefined, set its value to DEFAULT.
|
# if the %define variable VARIABLE is undefined, set its value to DEFAULT.
|
||||||
# Don't record this as a Bison usage of VARIABLE as there's no reason to
|
# Don't record this as a Bison usage of VARIABLE as there's no reason to
|
||||||
@@ -705,25 +824,43 @@ m4_define([b4_percent_define_flag_if],
|
|||||||
#
|
#
|
||||||
# b4_percent_define_default([[foo]], [[default value]])
|
# b4_percent_define_default([[foo]], [[default value]])
|
||||||
m4_define([b4_percent_define_default],
|
m4_define([b4_percent_define_default],
|
||||||
[m4_ifndef([b4_percent_define(]$1[)],
|
[b4_percent_define_ifdef_([$1], [],
|
||||||
[m4_define([b4_percent_define(]$1[)], [$2])dnl
|
[m4_define([b4_percent_define(]$1[)], [$2])dnl
|
||||||
|
m4_define([b4_percent_define_kind(]$1[)],
|
||||||
|
[m4_default([$3], [keyword])])dnl
|
||||||
m4_define([b4_percent_define_loc(]$1[)],
|
m4_define([b4_percent_define_loc(]$1[)],
|
||||||
[[[[<skeleton default value>:-1.-1]],
|
[[[[<skeleton default value>:-1.-1]],
|
||||||
[[<skeleton default value>:-1.-1]]]])dnl
|
[[<skeleton default value>:-1.-1]]]])dnl
|
||||||
m4_define([b4_percent_define_syncline(]$1[)], [[]])])])
|
m4_define([b4_percent_define_syncline(]$1[)], [[]])])])
|
||||||
|
|
||||||
|
|
||||||
# b4_percent_define_if_define(VARIABLE)
|
# b4_percent_define_if_define(NAME, [VARIABLE = NAME])
|
||||||
# -------------------------------------
|
# ----------------------------------------------------
|
||||||
# Define b4_VARIABLE_if that executes its $1 or $2 depending whether
|
# Define b4_NAME_if that executes its $1 or $2 depending whether
|
||||||
# VARIABLE was %defined. The characters `.' and `-' in VARIABLE are mapped
|
# VARIABLE was %defined. The characters '.' and `-' in VARIABLE are mapped
|
||||||
# to `_'.
|
# to '_'.
|
||||||
m4_define([b4_percent_define_if_define_],
|
m4_define([b4_percent_define_if_define_],
|
||||||
[m4_define(m4_bpatsubst([b4_$1_if], [[-.]], [_]),
|
[m4_define(m4_bpatsubst([b4_$1_if], [[-.]], [_]),
|
||||||
[b4_percent_define_flag_if([$1], [$2], [$3])])])
|
[b4_percent_define_flag_if(m4_default([$2], [$1]),
|
||||||
|
[$3], [$4])])])
|
||||||
m4_define([b4_percent_define_if_define],
|
m4_define([b4_percent_define_if_define],
|
||||||
[b4_percent_define_default([[$1]], [[false]])
|
[b4_percent_define_default([m4_default([$2], [$1])], [[false]])
|
||||||
b4_percent_define_if_define_([$1], $[1], $[2])])
|
b4_percent_define_if_define_([$1], [$2], $[1], $[2])])
|
||||||
|
|
||||||
|
|
||||||
|
# b4_percent_define_check_kind(VARIABLE, KIND, [DIAGNOSTIC = complain])
|
||||||
|
# ---------------------------------------------------------------------
|
||||||
|
m4_define([b4_percent_define_check_kind],
|
||||||
|
[b4_percent_define_ifdef_([$1],
|
||||||
|
[m4_if(b4_percent_define_get_kind([$1]), [$2], [],
|
||||||
|
[b4_error([m4_default([$3], [complain])],
|
||||||
|
b4_percent_define_get_loc([$1]),
|
||||||
|
[m4_case([$2],
|
||||||
|
[code], [[%%define variable '%s' requires '{...}' values]],
|
||||||
|
[keyword], [[%%define variable '%s' requires keyword values]],
|
||||||
|
[string], [[%%define variable '%s' requires '"..."' values]])],
|
||||||
|
[$1])])])dnl
|
||||||
|
])
|
||||||
|
|
||||||
|
|
||||||
# b4_percent_define_check_values(VALUES)
|
# b4_percent_define_check_values(VALUES)
|
||||||
@@ -747,8 +884,9 @@ m4_define([b4_percent_define_check_values],
|
|||||||
[_b4_percent_define_check_values(b4_sublist)])])
|
[_b4_percent_define_check_values(b4_sublist)])])
|
||||||
|
|
||||||
m4_define([_b4_percent_define_check_values],
|
m4_define([_b4_percent_define_check_values],
|
||||||
[m4_ifdef([b4_percent_define(]$1[)],
|
[b4_percent_define_ifdef_([$1],
|
||||||
[m4_pushdef([b4_good_value], [0])dnl
|
[b4_percent_define_check_kind(]$1[, [keyword], [deprecated])dnl
|
||||||
|
m4_pushdef([b4_good_value], [0])dnl
|
||||||
m4_if($#, 1, [],
|
m4_if($#, 1, [],
|
||||||
[m4_foreach([b4_value], m4_dquote(m4_shift($@)),
|
[m4_foreach([b4_value], m4_dquote(m4_shift($@)),
|
||||||
[m4_if(m4_indir([b4_percent_define(]$1[)]), b4_value,
|
[m4_if(m4_indir([b4_percent_define(]$1[)]), b4_value,
|
||||||
@@ -759,11 +897,11 @@ m4_define([_b4_percent_define_check_values],
|
|||||||
[$1],
|
[$1],
|
||||||
m4_dquote(m4_indir([b4_percent_define(]$1[)])))
|
m4_dquote(m4_indir([b4_percent_define(]$1[)])))
|
||||||
m4_foreach([b4_value], m4_dquote(m4_shift($@)),
|
m4_foreach([b4_value], m4_dquote(m4_shift($@)),
|
||||||
[b4_complain_at(b4_percent_define_get_loc([$1]),
|
[b4_error([[note]], b4_percent_define_get_loc([$1]), []
|
||||||
[[accepted value: '%s']],
|
[[accepted value: '%s']],
|
||||||
m4_dquote(b4_value))])])dnl
|
m4_dquote(b4_value))])])dnl
|
||||||
m4_popdef([b4_good_value])],
|
m4_popdef([b4_good_value])],
|
||||||
[b4_fatal([[b4_percent_define_check_values: undefined %%define variable '%s']], [$1])])])
|
[b4_fatal([[$0: undefined %%define variable '%s']], [$1])])])
|
||||||
|
|
||||||
# b4_percent_code_get([QUALIFIER])
|
# b4_percent_code_get([QUALIFIER])
|
||||||
# --------------------------------
|
# --------------------------------
|
||||||
@@ -804,21 +942,23 @@ m4_define([b4_percent_code_ifdef],
|
|||||||
## Common variables. ##
|
## Common variables. ##
|
||||||
## ------------------ ##
|
## ------------------ ##
|
||||||
|
|
||||||
# Default values for %define.
|
|
||||||
# ---------------------------
|
|
||||||
# If the api.tokens.prefix, it is empty.
|
|
||||||
m4_percent_define_default([[api.tokens.prefix]], [[]])
|
|
||||||
|
|
||||||
# b4_parse_assert_if([IF-ASSERTIONS-ARE-USED], [IF-NOT])
|
# b4_parse_assert_if([IF-ASSERTIONS-ARE-USED], [IF-NOT])
|
||||||
# b4_parse_trace_if([IF-DEBUG-TRACES-ARE-ENABLED], [IF-NOT])
|
# b4_parse_trace_if([IF-DEBUG-TRACES-ARE-ENABLED], [IF-NOT])
|
||||||
# b4_lex_symbol_if([IF-YYLEX-RETURNS-A-COMPLETE-SYMBOL], [IF-NOT])
|
# b4_token_ctor_if([IF-YYLEX-RETURNS-A-TOKEN], [IF-NOT])
|
||||||
# b4_variant_if([IF-VARIANT-ARE-USED], [IF-NOT])
|
|
||||||
# ----------------------------------------------
|
# ----------------------------------------------
|
||||||
b4_percent_define_if_define([lex_symbol])
|
b4_percent_define_if_define([token_ctor], [api.token.constructor])
|
||||||
b4_percent_define_if_define([locations]) # Whether locations are tracked.
|
b4_percent_define_if_define([locations]) # Whether locations are tracked.
|
||||||
b4_percent_define_if_define([parse.assert])
|
b4_percent_define_if_define([parse.assert])
|
||||||
b4_percent_define_if_define([parse.trace])
|
b4_percent_define_if_define([parse.trace])
|
||||||
b4_percent_define_if_define([variant])
|
|
||||||
|
|
||||||
|
# b4_bison_locations_if([IF-TRUE])
|
||||||
|
# --------------------------------
|
||||||
|
# Expand IF-TRUE if using locations, and using the default location
|
||||||
|
# type.
|
||||||
|
m4_define([b4_bison_locations_if],
|
||||||
|
[b4_locations_if([b4_percent_define_ifdef([[api.location.type]], [], [$1])])])
|
||||||
|
|
||||||
|
|
||||||
# b4_error_verbose_if([IF-ERRORS-ARE-VERBOSE], [IF-NOT])
|
# b4_error_verbose_if([IF-ERRORS-ARE-VERBOSE], [IF-NOT])
|
||||||
@@ -838,6 +978,17 @@ b4_define_flag_if([error_verbose])
|
|||||||
b4_error_verbose_if([m4_define([b4_token_table_flag], [1])])
|
b4_error_verbose_if([m4_define([b4_token_table_flag], [1])])
|
||||||
|
|
||||||
|
|
||||||
|
# b4_variant_if([IF-VARIANT-ARE-USED], [IF-NOT])
|
||||||
|
# ----------------------------------------------
|
||||||
|
b4_percent_define_if_define([variant])
|
||||||
|
m4_define([b4_variant_flag], [[0]])
|
||||||
|
b4_percent_define_ifdef([[api.value.type]],
|
||||||
|
[m4_case(b4_percent_define_get_kind([[api.value.type]]), [keyword],
|
||||||
|
[m4_case(b4_percent_define_get([[api.value.type]]), [variant],
|
||||||
|
[m4_define([b4_variant_flag], [[1]])])])])
|
||||||
|
b4_define_flag_if([variant])
|
||||||
|
|
||||||
|
|
||||||
## ----------------------------------------------------------- ##
|
## ----------------------------------------------------------- ##
|
||||||
## After processing the skeletons, check that all the user's ##
|
## After processing the skeletons, check that all the user's ##
|
||||||
## %define variables and %code qualifiers were used by Bison. ##
|
## %define variables and %code qualifiers were used by Bison. ##
|
||||||
@@ -869,10 +1020,46 @@ m4_define_default([b4_parse_param], [])
|
|||||||
m4_define_default([b4_location_initial_column], [1])
|
m4_define_default([b4_location_initial_column], [1])
|
||||||
m4_define_default([b4_location_initial_line], [1])
|
m4_define_default([b4_location_initial_line], [1])
|
||||||
|
|
||||||
# Sanity checks.
|
|
||||||
|
## --------------- ##
|
||||||
|
## Sanity checks. ##
|
||||||
|
## --------------- ##
|
||||||
|
|
||||||
|
# api.location.prefix={...} (Java and C++).
|
||||||
|
b4_percent_define_check_kind([api.location.type], [code], [deprecated])
|
||||||
|
|
||||||
|
# api.position.prefix={...} (Java).
|
||||||
|
b4_percent_define_check_kind([api.position.type], [code], [deprecated])
|
||||||
|
|
||||||
|
# api.prefix >< %name-prefix.
|
||||||
|
b4_percent_define_check_kind([api.prefix], [code], [deprecated])
|
||||||
b4_percent_define_ifdef([api.prefix],
|
b4_percent_define_ifdef([api.prefix],
|
||||||
[m4_ifdef([b4_prefix],
|
[m4_ifdef([b4_prefix],
|
||||||
[b4_complain_at(b4_percent_define_get_loc([api.prefix]),
|
[b4_complain_at(b4_percent_define_get_loc([api.prefix]),
|
||||||
[['%s' and '%s' cannot be used together]],
|
[['%s' and '%s' cannot be used together]],
|
||||||
[%name-prefix],
|
[%name-prefix],
|
||||||
[%define api.prefix])])])
|
[%define api.prefix])])])
|
||||||
|
|
||||||
|
# api.token.prefix={...}
|
||||||
|
# Make it a warning for those who used betas of Bison 3.0.
|
||||||
|
b4_percent_define_check_kind([api.token.prefix], [code], [deprecated])
|
||||||
|
|
||||||
|
# api.value.type >< %union.
|
||||||
|
b4_percent_define_ifdef([api.value.type],
|
||||||
|
[m4_ifdef([b4_union_members],
|
||||||
|
[b4_complain_at(b4_percent_define_get_loc([api.value.type]),
|
||||||
|
[['%s' and '%s' cannot be used together]],
|
||||||
|
[%union],
|
||||||
|
[%define api.value.type])])])
|
||||||
|
|
||||||
|
# api.value.type=union >< %yacc.
|
||||||
|
b4_percent_define_ifdef([api.value.type],
|
||||||
|
[m4_if(b4_percent_define_get([api.value.type]), [union],
|
||||||
|
[b4_yacc_if(dnl
|
||||||
|
[b4_complain_at(b4_percent_define_get_loc([api.value.type]),
|
||||||
|
[['%s' and '%s' cannot be used together]],
|
||||||
|
[%yacc],
|
||||||
|
[%define api.value.type "union"])])])])
|
||||||
|
|
||||||
|
# api.value.union.name.
|
||||||
|
b4_percent_define_check_kind([api.value.union.name], [keyword])
|
||||||
|
|||||||
+2
-1
@@ -2,7 +2,8 @@
|
|||||||
|
|
||||||
# C++ skeleton dispatching for Bison.
|
# C++ skeleton dispatching for Bison.
|
||||||
|
|
||||||
# Copyright (C) 2006-2007, 2009-2012 Free Software Foundation, Inc.
|
# Copyright (C) 2006-2007, 2009-2015, 2018 Free Software Foundation,
|
||||||
|
# Inc.
|
||||||
|
|
||||||
# This program is free software: you can redistribute it and/or modify
|
# 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
|
# it under the terms of the GNU General Public License as published by
|
||||||
|
|||||||
+253
-133
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
# C++ skeleton for Bison
|
# C++ skeleton for Bison
|
||||||
|
|
||||||
# Copyright (C) 2002-2012 Free Software Foundation, Inc.
|
# Copyright (C) 2002-2018 Free Software Foundation, Inc.
|
||||||
|
|
||||||
# This program is free software: you can redistribute it and/or modify
|
# 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
|
# it under the terms of the GNU General Public License as published by
|
||||||
@@ -17,8 +17,36 @@
|
|||||||
# You should have received a copy of the GNU General Public License
|
# You should have received a copy of the GNU General Public License
|
||||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
# Sanity checks, before defaults installed by c.m4.
|
||||||
|
b4_percent_define_ifdef([[api.value.union.name]],
|
||||||
|
[b4_complain_at(b4_percent_define_get_loc([[api.value.union.name]]),
|
||||||
|
[named %union is invalid in C++])])
|
||||||
|
|
||||||
m4_include(b4_pkgdatadir/[c.m4])
|
m4_include(b4_pkgdatadir/[c.m4])
|
||||||
|
|
||||||
|
# b4_comment(TEXT, [PREFIX])
|
||||||
|
# --------------------------
|
||||||
|
# Put TEXT in comment. Prefix all the output lines with PREFIX.
|
||||||
|
m4_define([b4_comment],
|
||||||
|
[b4_comment_([$1], [$2// ], [$2// ])])
|
||||||
|
|
||||||
|
# b4_inline(hh|cc)
|
||||||
|
# ----------------
|
||||||
|
# Expand to `inline\n ` if $1 is hh.
|
||||||
|
m4_define([b4_inline],
|
||||||
|
[m4_case([$1],
|
||||||
|
[cc], [],
|
||||||
|
[hh], [[inline
|
||||||
|
]],
|
||||||
|
[m4_fatal([$0: invalid argument: $1])])])
|
||||||
|
|
||||||
|
## -------- ##
|
||||||
|
## Checks. ##
|
||||||
|
## -------- ##
|
||||||
|
|
||||||
|
b4_percent_define_check_kind([api.namespace], [code], [deprecated])
|
||||||
|
b4_percent_define_check_kind([parser_class_name], [code], [deprecated])
|
||||||
|
|
||||||
## ---------------- ##
|
## ---------------- ##
|
||||||
## Default values. ##
|
## Default values. ##
|
||||||
## ---------------- ##
|
## ---------------- ##
|
||||||
@@ -28,9 +56,10 @@ b4_percent_define_default([[parser_class_name]], [[parser]])
|
|||||||
# Don't do that so that we remember whether we're using a user
|
# Don't do that so that we remember whether we're using a user
|
||||||
# request, or the default value.
|
# request, or the default value.
|
||||||
#
|
#
|
||||||
# b4_percent_define_default([[location_type]], [[location]])
|
# b4_percent_define_default([[api.location.type]], [[location]])
|
||||||
|
|
||||||
b4_percent_define_default([[filename_type]], [[std::string]])
|
b4_percent_define_default([[filename_type]], [[std::string]])
|
||||||
|
# Make it a warning for those who used betas of Bison 3.0.
|
||||||
b4_percent_define_default([[api.namespace]], m4_defn([b4_prefix]))
|
b4_percent_define_default([[api.namespace]], m4_defn([b4_prefix]))
|
||||||
|
|
||||||
b4_percent_define_default([[global_tokens_and_yystype]], [[false]])
|
b4_percent_define_default([[global_tokens_and_yystype]], [[false]])
|
||||||
@@ -47,8 +76,8 @@ b4_percent_define_default([[define_location_comparison]],
|
|||||||
m4_define([b4_namespace_ref], [b4_percent_define_get([[api.namespace]])])
|
m4_define([b4_namespace_ref], [b4_percent_define_get([[api.namespace]])])
|
||||||
|
|
||||||
|
|
||||||
# Don't permit an empty b4_namespace_ref. Any `::parser::foo' appended to it
|
# Don't permit an empty b4_namespace_ref. Any '::parser::foo' appended to it
|
||||||
# would compile as an absolute reference with `parser' in the global namespace.
|
# would compile as an absolute reference with 'parser' in the global namespace.
|
||||||
# b4_namespace_open would open an anonymous namespace and thus establish
|
# b4_namespace_open would open an anonymous namespace and thus establish
|
||||||
# internal linkage. This would compile. However, it's cryptic, and internal
|
# internal linkage. This would compile. However, it's cryptic, and internal
|
||||||
# linkage for the parser would be specified in all translation units that
|
# linkage for the parser would be specified in all translation units that
|
||||||
@@ -90,13 +119,13 @@ m4_bpatsubst(m4_dquote(m4_bpatsubst(m4_dquote(b4_namespace_ref[ ]),
|
|||||||
# --------------
|
# --------------
|
||||||
# Output the definition of the tokens as enums.
|
# Output the definition of the tokens as enums.
|
||||||
m4_define([b4_token_enums],
|
m4_define([b4_token_enums],
|
||||||
[[/* Tokens. */
|
[[enum yytokentype
|
||||||
enum yytokentype {
|
{
|
||||||
]m4_join([,
|
]m4_join([,
|
||||||
],
|
],
|
||||||
b4_symbol_map([b4_token_enum]))[
|
b4_symbol_map([b4_token_enum]))[
|
||||||
};
|
};]dnl
|
||||||
]])
|
])
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -105,18 +134,24 @@ m4_define([b4_token_enums],
|
|||||||
## Semantic Values. ##
|
## Semantic Values. ##
|
||||||
## ----------------- ##
|
## ----------------- ##
|
||||||
|
|
||||||
# b4_semantic_type_declare
|
|
||||||
# ------------------------
|
|
||||||
|
# b4_value_type_declare
|
||||||
|
# ---------------------
|
||||||
# Declare semantic_type.
|
# Declare semantic_type.
|
||||||
m4_define([b4_semantic_type_declare],
|
m4_define([b4_value_type_declare],
|
||||||
|
[b4_value_type_setup[]dnl
|
||||||
[ /// Symbol semantic values.
|
[ /// Symbol semantic values.
|
||||||
m4_ifdef([b4_stype],
|
]m4_bmatch(b4_percent_define_get_kind([[api.value.type]]),
|
||||||
[ union semantic_type
|
[code],
|
||||||
{b4_user_stype
|
[[ typedef ]b4_percent_define_get([[api.value.type]])[ semantic_type;]],
|
||||||
};],
|
[m4_bmatch(b4_percent_define_get([[api.value.type]]),
|
||||||
[m4_if(b4_tag_seen_flag, 0,
|
[union\|union-directive],
|
||||||
[[ typedef int semantic_type;]],
|
[[ union semantic_type
|
||||||
[[ typedef ]b4_api_PREFIX[STYPE semantic_type;]])])])
|
{
|
||||||
|
]b4_user_union_members[
|
||||||
|
};]])])dnl
|
||||||
|
])
|
||||||
|
|
||||||
|
|
||||||
# b4_public_types_declare
|
# b4_public_types_declare
|
||||||
@@ -125,12 +160,12 @@ m4_ifdef([b4_stype],
|
|||||||
# Depending on %define token_lex, may be output in the header or source file.
|
# Depending on %define token_lex, may be output in the header or source file.
|
||||||
m4_define([b4_public_types_declare],
|
m4_define([b4_public_types_declare],
|
||||||
[[#ifndef ]b4_api_PREFIX[STYPE
|
[[#ifndef ]b4_api_PREFIX[STYPE
|
||||||
]b4_semantic_type_declare[
|
]b4_value_type_declare[
|
||||||
#else
|
#else
|
||||||
typedef ]b4_api_PREFIX[STYPE semantic_type;
|
typedef ]b4_api_PREFIX[STYPE semantic_type;
|
||||||
#endif]b4_locations_if([
|
#endif]b4_locations_if([
|
||||||
/// Symbol locations.
|
/// Symbol locations.
|
||||||
typedef b4_percent_define_get([[location_type]],
|
typedef b4_percent_define_get([[api.location.type]],
|
||||||
[[location]]) location_type;])[
|
[[location]]) location_type;])[
|
||||||
|
|
||||||
/// Syntax errors thrown from user actions.
|
/// Syntax errors thrown from user actions.
|
||||||
@@ -146,164 +181,239 @@ m4_define([b4_public_types_declare],
|
|||||||
]b4_token_enums[
|
]b4_token_enums[
|
||||||
};
|
};
|
||||||
|
|
||||||
/// Token type.
|
/// (External) token type, as returned by yylex.
|
||||||
typedef token::yytokentype token_type;
|
typedef token::yytokentype token_type;
|
||||||
|
|
||||||
/// A complete symbol, with its type.
|
/// Symbol type: an internal symbol number.
|
||||||
template <typename Exact>
|
typedef int symbol_number_type;
|
||||||
struct symbol_base_type
|
|
||||||
|
/// The symbol type number to denote an empty symbol.
|
||||||
|
enum { empty_symbol = -2 };
|
||||||
|
|
||||||
|
/// Internal symbol number for tokens (subsumed by symbol_number_type).
|
||||||
|
typedef ]b4_int_type_for([b4_translate])[ token_number_type;
|
||||||
|
|
||||||
|
/// A complete symbol.
|
||||||
|
///
|
||||||
|
/// Expects its Base type to provide access to the symbol type
|
||||||
|
/// via type_get().
|
||||||
|
///
|
||||||
|
/// Provide access to semantic value]b4_locations_if([ and location])[.
|
||||||
|
template <typename Base>
|
||||||
|
struct basic_symbol : Base
|
||||||
{
|
{
|
||||||
|
/// Alias to Base.
|
||||||
|
typedef Base super_type;
|
||||||
|
|
||||||
/// Default constructor.
|
/// Default constructor.
|
||||||
inline symbol_base_type ();
|
basic_symbol ();
|
||||||
|
|
||||||
/// Constructor.]b4_locations_if([
|
/// Copy constructor.
|
||||||
inline symbol_base_type (const location_type& l)])[;
|
basic_symbol (const basic_symbol& other);
|
||||||
inline symbol_base_type (]b4_args(
|
]b4_variant_if([[
|
||||||
[const semantic_type& v],
|
/// Constructor for valueless symbols, and symbols from each type.
|
||||||
b4_locations_if([const location_type& l]))[);
|
]b4_type_foreach([b4_basic_symbol_constructor_declare])], [[
|
||||||
|
/// Constructor for valueless symbols.
|
||||||
|
basic_symbol (typename Base::kind_type t]b4_locations_if([,
|
||||||
|
const location_type& l])[);]])[
|
||||||
|
|
||||||
/// Return this with its exact type.
|
/// Constructor for symbols with semantic value.
|
||||||
const Exact& self () const;
|
basic_symbol (typename Base::kind_type t,
|
||||||
Exact& self ();
|
const semantic_type& v]b4_locations_if([,
|
||||||
|
const location_type& l])[);
|
||||||
|
|
||||||
/// Return the type of this symbol.
|
/// Destroy the symbol.
|
||||||
int type_get () const;
|
~basic_symbol ();
|
||||||
|
|
||||||
|
/// Destroy contents, and record that is empty.
|
||||||
|
void clear ();
|
||||||
|
|
||||||
|
/// Whether empty.
|
||||||
|
bool empty () const;
|
||||||
|
|
||||||
|
/// Destructive move, \a s is emptied into this.
|
||||||
|
void move (basic_symbol& s);
|
||||||
|
|
||||||
/// The semantic value.
|
/// The semantic value.
|
||||||
semantic_type value;]b4_locations_if([
|
semantic_type value;]b4_locations_if([
|
||||||
|
|
||||||
/// The location.
|
/// The location.
|
||||||
location_type location;])[
|
location_type location;])[
|
||||||
|
|
||||||
|
private:
|
||||||
|
/// Assignment operator.
|
||||||
|
basic_symbol& operator= (const basic_symbol& other);
|
||||||
};
|
};
|
||||||
|
|
||||||
/// External form of a symbol: its type and attributes.
|
/// Type access provider for token (enum) based symbols.
|
||||||
struct symbol_type : symbol_base_type<symbol_type>
|
struct by_type
|
||||||
{
|
{
|
||||||
/// The parent class.
|
|
||||||
typedef symbol_base_type<symbol_type> super_type;
|
|
||||||
|
|
||||||
/// Default constructor.
|
/// Default constructor.
|
||||||
inline symbol_type ();
|
by_type ();
|
||||||
|
|
||||||
/// Constructor for tokens with semantic value.
|
/// Copy constructor.
|
||||||
inline symbol_type (]b4_args([token_type t],
|
by_type (const by_type& other);
|
||||||
[const semantic_type& v],
|
|
||||||
b4_locations_if([const location_type& l]))[);
|
|
||||||
|
|
||||||
/// Constructor for valueless tokens.
|
/// The symbol type as needed by the constructor.
|
||||||
inline symbol_type (]b4_args([token_type t],
|
typedef token_type kind_type;
|
||||||
b4_locations_if([const location_type& l]))[);
|
|
||||||
|
|
||||||
/// The symbol type.
|
/// Constructor from (external) token numbers.
|
||||||
int type;
|
by_type (kind_type t);
|
||||||
|
|
||||||
/// The symbol type.
|
/// Record that this symbol is empty.
|
||||||
inline int type_get_ () const;
|
void clear ();
|
||||||
|
|
||||||
|
/// Steal the symbol type from \a that.
|
||||||
|
void move (by_type& that);
|
||||||
|
|
||||||
|
/// The (internal) type number (corresponding to \a type).
|
||||||
|
/// \a empty when empty.
|
||||||
|
symbol_number_type type_get () const;
|
||||||
|
|
||||||
/// The token.
|
/// The token.
|
||||||
inline token_type token () const;
|
token_type token () const;
|
||||||
|
|
||||||
|
/// The symbol type.
|
||||||
|
/// \a empty_symbol when empty.
|
||||||
|
/// An int, not token_number_type, to be able to store empty_symbol.
|
||||||
|
int type;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/// "External" symbols: returned by the scanner.
|
||||||
|
typedef basic_symbol<by_type> symbol_type;
|
||||||
|
|
||||||
]b4_symbol_constructor_declare])
|
]b4_symbol_constructor_declare])
|
||||||
|
|
||||||
|
|
||||||
# b4_public_types_define
|
# b4_public_types_define(hh|cc)
|
||||||
# ----------------------
|
# -----------------------------
|
||||||
# Provide the implementation needed by the public types.
|
# Provide the implementation needed by the public types.
|
||||||
m4_define([b4_public_types_define],
|
m4_define([b4_public_types_define],
|
||||||
[[ inline
|
[ b4_inline([$1])b4_parser_class_name[::syntax_error::syntax_error (]b4_locations_if([const location_type& l, ])[const std::string& m)
|
||||||
]b4_parser_class_name[::syntax_error::syntax_error (]b4_locations_if([const location_type& l, ])[const std::string& m)
|
|
||||||
: std::runtime_error (m)]b4_locations_if([
|
: std::runtime_error (m)]b4_locations_if([
|
||||||
, location (l)])[
|
, location (l)])[
|
||||||
{}
|
{}
|
||||||
|
|
||||||
// symbol_base_type.
|
// basic_symbol.
|
||||||
template <typename Exact>
|
template <typename Base>
|
||||||
inline
|
]b4_parser_class_name[::basic_symbol<Base>::basic_symbol ()
|
||||||
]b4_parser_class_name[::symbol_base_type<Exact>::symbol_base_type ()
|
: value ()]b4_locations_if([
|
||||||
: value()]b4_locations_if([
|
, location ()])[
|
||||||
, location()])[
|
{}
|
||||||
{
|
|
||||||
}]b4_locations_if([[
|
|
||||||
|
|
||||||
template <typename Exact>
|
template <typename Base>
|
||||||
inline
|
]b4_parser_class_name[::basic_symbol<Base>::basic_symbol (const basic_symbol& other)
|
||||||
]b4_parser_class_name[::symbol_base_type<Exact>::symbol_base_type (const location_type& l)
|
: Base (other)
|
||||||
: value()
|
, value (]b4_variant_if([], [other.value])[)]b4_locations_if([
|
||||||
, location(l)
|
, location (other.location)])[
|
||||||
{
|
{]b4_variant_if([
|
||||||
}]])[
|
b4_symbol_variant([other.type_get ()], [value], [copy],
|
||||||
|
[other.value])])[
|
||||||
|
}
|
||||||
|
|
||||||
template <typename Exact>
|
template <typename Base>
|
||||||
inline
|
]b4_parser_class_name[::basic_symbol<Base>::basic_symbol (]b4_join(
|
||||||
]b4_parser_class_name[::symbol_base_type<Exact>::symbol_base_type (]b4_args(
|
[typename Base::kind_type t],
|
||||||
[const semantic_type& v],
|
[const semantic_type& v],
|
||||||
b4_locations_if([const location_type& l]))[)
|
b4_locations_if([const location_type& l]))[)
|
||||||
: value(v)]b4_locations_if([
|
: Base (t)
|
||||||
, location(l)])[
|
, value (]b4_variant_if([], [v])[)]b4_locations_if([
|
||||||
|
, location (l)])[
|
||||||
|
{]b4_variant_if([[
|
||||||
|
(void) v;
|
||||||
|
]b4_symbol_variant([this->type_get ()], [value], [copy], [v])])[}
|
||||||
|
|
||||||
|
]b4_variant_if([[
|
||||||
|
// Implementation of basic_symbol constructor for each type.
|
||||||
|
]b4_type_foreach([b4_basic_symbol_constructor_define])], [[
|
||||||
|
/// Constructor for valueless symbols.
|
||||||
|
template <typename Base>
|
||||||
|
]b4_parser_class_name[::basic_symbol<Base>::basic_symbol (]b4_join(
|
||||||
|
[typename Base::kind_type t],
|
||||||
|
b4_locations_if([const location_type& l]))[)
|
||||||
|
: Base (t)
|
||||||
|
, value ()]b4_locations_if([
|
||||||
|
, location (l)])[
|
||||||
|
{}]])[
|
||||||
|
|
||||||
|
template <typename Base>
|
||||||
|
]b4_parser_class_name[::basic_symbol<Base>::~basic_symbol ()
|
||||||
{
|
{
|
||||||
|
clear ();
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename Exact>
|
template <typename Base>
|
||||||
inline
|
void
|
||||||
const Exact&
|
]b4_parser_class_name[::basic_symbol<Base>::clear ()
|
||||||
]b4_parser_class_name[::symbol_base_type<Exact>::self () const
|
{]b4_variant_if([[
|
||||||
{
|
// User destructor.
|
||||||
return static_cast<const Exact&>(*this);
|
symbol_number_type yytype = this->type_get ();
|
||||||
|
basic_symbol<Base>& yysym = *this;
|
||||||
|
(void) yysym;
|
||||||
|
switch (yytype)
|
||||||
|
{
|
||||||
|
]b4_symbol_foreach([b4_symbol_destructor])dnl
|
||||||
|
[ default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Type destructor.
|
||||||
|
]b4_symbol_variant([[yytype]], [[value]], [[template destroy]])])[
|
||||||
|
Base::clear ();
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename Exact>
|
template <typename Base>
|
||||||
inline
|
bool
|
||||||
Exact&
|
]b4_parser_class_name[::basic_symbol<Base>::empty () const
|
||||||
]b4_parser_class_name[::symbol_base_type<Exact>::self ()
|
|
||||||
{
|
{
|
||||||
return static_cast<Exact&>(*this);
|
return Base::type_get () == empty_symbol;
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename Exact>
|
template <typename Base>
|
||||||
inline
|
void
|
||||||
int
|
]b4_parser_class_name[::basic_symbol<Base>::move (basic_symbol& s)
|
||||||
]b4_parser_class_name[::symbol_base_type<Exact>::type_get () const
|
|
||||||
{
|
{
|
||||||
return self ().type_get_ ();
|
super_type::move (s);
|
||||||
|
]b4_variant_if([b4_symbol_variant([this->type_get ()], [value], [move],
|
||||||
|
[s.value])],
|
||||||
|
[value = s.value;])[]b4_locations_if([
|
||||||
|
location = s.location;])[
|
||||||
}
|
}
|
||||||
|
|
||||||
// symbol_type.
|
// by_type.
|
||||||
inline
|
]b4_inline([$1])b4_parser_class_name[::by_type::by_type ()
|
||||||
]b4_parser_class_name[::symbol_type::symbol_type ()
|
: type (empty_symbol)
|
||||||
: super_type ()
|
{}
|
||||||
, type ()
|
|
||||||
|
]b4_inline([$1])b4_parser_class_name[::by_type::by_type (const by_type& other)
|
||||||
|
: type (other.type)
|
||||||
|
{}
|
||||||
|
|
||||||
|
]b4_inline([$1])b4_parser_class_name[::by_type::by_type (token_type t)
|
||||||
|
: type (yytranslate_ (t))
|
||||||
|
{}
|
||||||
|
|
||||||
|
]b4_inline([$1])[void
|
||||||
|
]b4_parser_class_name[::by_type::clear ()
|
||||||
{
|
{
|
||||||
|
type = empty_symbol;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline
|
]b4_inline([$1])[void
|
||||||
]b4_parser_class_name[::symbol_type::symbol_type (]b4_args(
|
]b4_parser_class_name[::by_type::move (by_type& that)
|
||||||
[token_type t],
|
|
||||||
b4_locations_if([const location_type& l]))[)
|
|
||||||
: super_type (]b4_locations_if([l])[)
|
|
||||||
, type (yytranslate_ (t))
|
|
||||||
{
|
{
|
||||||
|
type = that.type;
|
||||||
|
that.clear ();
|
||||||
}
|
}
|
||||||
|
|
||||||
inline
|
]b4_inline([$1])[int
|
||||||
]b4_parser_class_name[::symbol_type::symbol_type (]b4_args(
|
]b4_parser_class_name[::by_type::type_get () const
|
||||||
[token_type t],
|
|
||||||
[const semantic_type& v],
|
|
||||||
b4_locations_if([const location_type& l]))[)
|
|
||||||
: super_type (v]b4_locations_if([, l])[)
|
|
||||||
, type (yytranslate_ (t))
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
inline
|
|
||||||
int
|
|
||||||
]b4_parser_class_name[::symbol_type::type_get_ () const
|
|
||||||
{
|
{
|
||||||
return type;
|
return type;
|
||||||
}
|
}
|
||||||
]b4_lex_symbol_if([[
|
]b4_token_ctor_if([[
|
||||||
inline
|
]b4_inline([$1])b4_parser_class_name[::token_type
|
||||||
]b4_parser_class_name[::token_type
|
]b4_parser_class_name[::by_type::token () const
|
||||||
]b4_parser_class_name[::symbol_type::token () const
|
|
||||||
{
|
{
|
||||||
// YYTOKNUM[NUM] -- (External) token number corresponding to the
|
// YYTOKNUM[NUM] -- (External) token number corresponding to the
|
||||||
// (internal) symbol number NUM (which must be that of a token). */
|
// (internal) symbol number NUM (which must be that of a token). */
|
||||||
@@ -328,14 +438,14 @@ m4_define([b4_symbol_constructor_declare], [])
|
|||||||
m4_define([b4_symbol_constructor_define], [])
|
m4_define([b4_symbol_constructor_define], [])
|
||||||
|
|
||||||
|
|
||||||
# b4_yytranslate_define
|
# b4_yytranslate_define(cc|hh)
|
||||||
# ---------------------
|
# ----------------------------
|
||||||
# Define yytranslate_. Sometimes used in the header file,
|
# Define yytranslate_. Sometimes used in the header file ($1=hh),
|
||||||
# sometimes in the cc file.
|
# sometimes in the cc file.
|
||||||
m4_define([b4_yytranslate_define],
|
m4_define([b4_yytranslate_define],
|
||||||
[[ // Symbol number corresponding to token number t.
|
[[ // Symbol number corresponding to token number t.
|
||||||
]b4_parser_class_name[::token_number_type
|
]b4_inline([$1])b4_parser_class_name[::token_number_type
|
||||||
]b4_parser_class_name[::yytranslate_ (]b4_lex_symbol_if([token_type],
|
]b4_parser_class_name[::yytranslate_ (]b4_token_ctor_if([token_type],
|
||||||
[int])[ t)
|
[int])[ t)
|
||||||
{
|
{
|
||||||
static
|
static
|
||||||
@@ -344,12 +454,12 @@ m4_define([b4_yytranslate_define],
|
|||||||
{
|
{
|
||||||
]b4_translate[
|
]b4_translate[
|
||||||
};
|
};
|
||||||
const unsigned int user_token_number_max_ = ]b4_user_token_number_max[;
|
const unsigned user_token_number_max_ = ]b4_user_token_number_max[;
|
||||||
const token_number_type undef_token_ = ]b4_undef_token_number[;
|
const token_number_type undef_token_ = ]b4_undef_token_number[;
|
||||||
|
|
||||||
if (static_cast<int>(t) <= yyeof_)
|
if (static_cast<int> (t) <= yyeof_)
|
||||||
return yyeof_;
|
return yyeof_;
|
||||||
else if (static_cast<unsigned int> (t) <= user_token_number_max_)
|
else if (static_cast<unsigned> (t) <= user_token_number_max_)
|
||||||
return translate_table[t];
|
return translate_table[t];
|
||||||
else
|
else
|
||||||
return undef_token_;
|
return undef_token_;
|
||||||
@@ -421,7 +531,7 @@ m4_define([b4_cc_constructor_call],
|
|||||||
m4_define([b4_parse_param_vars],
|
m4_define([b4_parse_param_vars],
|
||||||
[m4_ifset([b4_parse_param],
|
[m4_ifset([b4_parse_param],
|
||||||
[
|
[
|
||||||
/* User arguments. */
|
// User arguments.
|
||||||
b4_cc_var_decls(b4_parse_param)])])
|
b4_cc_var_decls(b4_parse_param)])])
|
||||||
m4_define([b4_cc_var_decls],
|
m4_define([b4_cc_var_decls],
|
||||||
[m4_map_sep([b4_cc_var_decl], [
|
[m4_map_sep([b4_cc_var_decl], [
|
||||||
@@ -457,3 +567,13 @@ m4_define([b4_yylloc_default_define],
|
|||||||
while (/*CONSTCOND*/ false)
|
while (/*CONSTCOND*/ false)
|
||||||
# endif
|
# endif
|
||||||
]])
|
]])
|
||||||
|
|
||||||
|
## -------- ##
|
||||||
|
## Checks. ##
|
||||||
|
## -------- ##
|
||||||
|
|
||||||
|
b4_token_ctor_if([b4_variant_if([],
|
||||||
|
[b4_fatal_at(b4_percent_define_get_loc(api.token.constructor),
|
||||||
|
[cannot use '%s' without '%s'],
|
||||||
|
[%define api.token.constructor],
|
||||||
|
[%define api.value.type variant]))])])
|
||||||
|
|||||||
@@ -0,0 +1,65 @@
|
|||||||
|
-*- Autoconf -*-
|
||||||
|
|
||||||
|
# Common code for C-like languages (C, C++, Java, etc.)
|
||||||
|
|
||||||
|
# Copyright (C) 2012-2015, 2018 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 3 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, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
# b4_comment_(TEXT, OPEN, CONTINUE, END)
|
||||||
|
# --------------------------------------
|
||||||
|
# Put TEXT in comment. Avoid trailing spaces: don't indent empty lines.
|
||||||
|
# Avoid adding indentation to the first line, as the indentation comes
|
||||||
|
# from OPEN. That's why we don't patsubst([$1], [^\(.\)], [ \1]).
|
||||||
|
#
|
||||||
|
# Prefix all the output lines with PREFIX.
|
||||||
|
m4_define([b4_comment_],
|
||||||
|
[$2[]m4_bpatsubst(m4_expand([[$1]]), [
|
||||||
|
\(.\)], [
|
||||||
|
$3\1])$4])
|
||||||
|
|
||||||
|
|
||||||
|
# b4_comment(TEXT, [PREFIX])
|
||||||
|
# --------------------------
|
||||||
|
# Put TEXT in comment. Prefix all the output lines with PREFIX.
|
||||||
|
m4_define([b4_comment],
|
||||||
|
[b4_comment_([$1], [$2/* ], [$2 ], [ */])])
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# b4_dollar_dollar_(VALUE, FIELD, DEFAULT-FIELD)
|
||||||
|
# ----------------------------------------------
|
||||||
|
# If FIELD (or DEFAULT-FIELD) is non-null, return "VALUE.FIELD",
|
||||||
|
# otherwise just VALUE. Be sure to pass "(VALUE)" is VALUE is a
|
||||||
|
# pointer.
|
||||||
|
m4_define([b4_dollar_dollar_],
|
||||||
|
[b4_symbol_value([$1],
|
||||||
|
m4_if([$2], [[]],
|
||||||
|
[[$3]], [[$2]]))])
|
||||||
|
|
||||||
|
# b4_dollar_pushdef(VALUE-POINTER, DEFAULT-FIELD, LOCATION)
|
||||||
|
# b4_dollar_popdef
|
||||||
|
# ---------------------------------------------------------
|
||||||
|
# Define b4_dollar_dollar for VALUE and DEFAULT-FIELD,
|
||||||
|
# and b4_at_dollar for LOCATION.
|
||||||
|
m4_define([b4_dollar_pushdef],
|
||||||
|
[m4_pushdef([b4_dollar_dollar],
|
||||||
|
[b4_dollar_dollar_([$1], m4_dquote($][1), [$2])])dnl
|
||||||
|
m4_pushdef([b4_at_dollar], [$3])dnl
|
||||||
|
])
|
||||||
|
m4_define([b4_dollar_popdef],
|
||||||
|
[m4_popdef([b4_at_dollar])dnl
|
||||||
|
m4_popdef([b4_dollar_dollar])dnl
|
||||||
|
])
|
||||||
+2
-1
@@ -2,7 +2,8 @@
|
|||||||
|
|
||||||
# C skeleton dispatching for Bison.
|
# C skeleton dispatching for Bison.
|
||||||
|
|
||||||
# Copyright (C) 2006-2007, 2009-2012 Free Software Foundation, Inc.
|
# Copyright (C) 2006-2007, 2009-2015, 2018 Free Software Foundation,
|
||||||
|
# Inc.
|
||||||
|
|
||||||
# This program is free software: you can redistribute it and/or modify
|
# 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
|
# it under the terms of the GNU General Public License as published by
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
# C M4 Macros for Bison.
|
# C M4 Macros for Bison.
|
||||||
|
|
||||||
# Copyright (C) 2002, 2004-2012 Free Software Foundation, Inc.
|
# Copyright (C) 2002, 2004-2015, 2018 Free Software Foundation, Inc.
|
||||||
|
|
||||||
# This program is free software: you can redistribute it and/or modify
|
# 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
|
# it under the terms of the GNU General Public License as published by
|
||||||
@@ -17,6 +17,7 @@
|
|||||||
# You should have received a copy of the GNU General Public License
|
# You should have received a copy of the GNU General Public License
|
||||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
m4_include(b4_pkgdatadir/[c-like.m4])
|
||||||
|
|
||||||
# b4_tocpp(STRING)
|
# b4_tocpp(STRING)
|
||||||
# ----------------
|
# ----------------
|
||||||
@@ -29,54 +30,27 @@ m4_define([b4_tocpp],
|
|||||||
# ------------------
|
# ------------------
|
||||||
# A valid C macro name to use as a CPP header guard for FILE.
|
# A valid C macro name to use as a CPP header guard for FILE.
|
||||||
m4_define([b4_cpp_guard],
|
m4_define([b4_cpp_guard],
|
||||||
[b4_tocpp(m4_defn([b4_prefix])/[$1])])
|
[[YY_]b4_tocpp(m4_defn([b4_prefix])/[$1])[_INCLUDED]])
|
||||||
|
|
||||||
|
|
||||||
# b4_cpp_guard_open(FILE)
|
# b4_cpp_guard_open(FILE)
|
||||||
# b4_cpp_guard_close(FILE)
|
# b4_cpp_guard_close(FILE)
|
||||||
# ------------------------
|
# ------------------------
|
||||||
# Open/close CPP inclusion guards for FILE.
|
# If FILE does not expand to nothing, open/close CPP inclusion guards for FILE.
|
||||||
m4_define([b4_cpp_guard_open],
|
m4_define([b4_cpp_guard_open],
|
||||||
|
[m4_ifval(m4_quote($1),
|
||||||
[#ifndef b4_cpp_guard([$1])
|
[#ifndef b4_cpp_guard([$1])
|
||||||
# define b4_cpp_guard([$1])])
|
# define b4_cpp_guard([$1])])])
|
||||||
|
|
||||||
m4_define([b4_cpp_guard_close],
|
m4_define([b4_cpp_guard_close],
|
||||||
[#endif b4_comment([!b4_cpp_guard([$1])])])
|
[m4_ifval(m4_quote($1),
|
||||||
|
[#endif b4_comment([!b4_cpp_guard([$1])])])])
|
||||||
|
|
||||||
|
|
||||||
## ---------------- ##
|
## ---------------- ##
|
||||||
## Identification. ##
|
## Identification. ##
|
||||||
## ---------------- ##
|
## ---------------- ##
|
||||||
|
|
||||||
# b4_comment_(TEXT, OPEN, CONTINUE, END)
|
|
||||||
# -------------------------------------
|
|
||||||
# Put TEXT in comment. Avoid trailing spaces: don't indent empty lines.
|
|
||||||
# Avoid adding indentation to the first line, as the indentation comes
|
|
||||||
# from OPEN. That's why we don't patsubst([$1], [^\(.\)], [ \1]).
|
|
||||||
#
|
|
||||||
# Prefix all the output lines with PREFIX.
|
|
||||||
m4_define([b4_comment_], [$2[]m4_bpatsubst([$1], [
|
|
||||||
\(.\)], [
|
|
||||||
$3\1])$4])
|
|
||||||
|
|
||||||
|
|
||||||
# b4_c_comment(TEXT, [PREFIX])
|
|
||||||
# ----------------------------
|
|
||||||
# Put TEXT in comment. Avoid trailing spaces: don't indent empty lines.
|
|
||||||
# Avoid adding indentation to the first line, as the indentation comes
|
|
||||||
# from "/*". That's why we don't patsubst([$1], [^\(.\)], [ \1]).
|
|
||||||
#
|
|
||||||
# Prefix all the output lines with PREFIX.
|
|
||||||
m4_define([b4_c_comment],
|
|
||||||
[b4_comment_([$1], [$2/* ], [$2 ], [$2 */])])
|
|
||||||
|
|
||||||
|
|
||||||
# b4_comment(TEXT, [PREFIX])
|
|
||||||
# --------------------------
|
|
||||||
# By default, C comments.
|
|
||||||
m4_define([b4_comment], [b4_c_comment($@)])
|
|
||||||
|
|
||||||
|
|
||||||
# b4_identification
|
# b4_identification
|
||||||
# -----------------
|
# -----------------
|
||||||
# Depends on individual skeletons to define b4_pure_flag, b4_push_flag, or
|
# Depends on individual skeletons to define b4_pure_flag, b4_push_flag, or
|
||||||
@@ -123,17 +97,35 @@ m4_define([b4_api_PREFIX],
|
|||||||
m4_define_default([b4_prefix], [b4_api_prefix])
|
m4_define_default([b4_prefix], [b4_api_prefix])
|
||||||
|
|
||||||
# If the %union is not named, its name is YYSTYPE.
|
# If the %union is not named, its name is YYSTYPE.
|
||||||
m4_define_default([b4_union_name], [b4_api_PREFIX[]STYPE])
|
b4_percent_define_default([[api.value.union.name]],
|
||||||
|
[b4_api_PREFIX[][STYPE]])
|
||||||
|
|
||||||
|
|
||||||
## ------------------------ ##
|
## ------------------------ ##
|
||||||
## Pure/impure interfaces. ##
|
## Pure/impure interfaces. ##
|
||||||
## ------------------------ ##
|
## ------------------------ ##
|
||||||
|
|
||||||
|
# b4_lex_formals
|
||||||
|
# --------------
|
||||||
|
# All the yylex formal arguments.
|
||||||
|
# b4_lex_param arrives quoted twice, but we want to keep only one level.
|
||||||
|
m4_define([b4_lex_formals],
|
||||||
|
[b4_pure_if([[[[YYSTYPE *yylvalp]], [[&yylval]]][]dnl
|
||||||
|
b4_locations_if([, [[YYLTYPE *yyllocp], [&yylloc]]])])dnl
|
||||||
|
m4_ifdef([b4_lex_param], [, ]b4_lex_param)])
|
||||||
|
|
||||||
|
|
||||||
|
# b4_lex
|
||||||
|
# ------
|
||||||
|
# Call yylex.
|
||||||
|
m4_define([b4_lex],
|
||||||
|
[b4_function_call([yylex], [int], b4_lex_formals)])
|
||||||
|
|
||||||
|
|
||||||
# b4_user_args
|
# b4_user_args
|
||||||
# ------------
|
# ------------
|
||||||
m4_define([b4_user_args],
|
m4_define([b4_user_args],
|
||||||
[m4_ifset([b4_parse_param], [, b4_c_args(b4_parse_param)])])
|
[m4_ifset([b4_parse_param], [, b4_args(b4_parse_param)])])
|
||||||
|
|
||||||
|
|
||||||
# b4_parse_param
|
# b4_parse_param
|
||||||
@@ -159,9 +151,9 @@ m4_popdef([$1])dnl
|
|||||||
|
|
||||||
# b4_parse_param_use([VAL], [LOC])
|
# b4_parse_param_use([VAL], [LOC])
|
||||||
# --------------------------------
|
# --------------------------------
|
||||||
# `YYUSE' VAL, LOC if locations are enabled, and all the parse-params.
|
# 'YYUSE' VAL, LOC if locations are enabled, and all the parse-params.
|
||||||
m4_define([b4_parse_param_use],
|
m4_define([b4_parse_param_use],
|
||||||
[m4_ifvaln([$1], [ YYUSE([$1]);])dnl
|
[m4_ifvaln([$1], [ YYUSE ([$1]);])dnl
|
||||||
b4_locations_if([m4_ifvaln([$2], [ YYUSE ([$2]);])])dnl
|
b4_locations_if([m4_ifvaln([$2], [ YYUSE ([$2]);])])dnl
|
||||||
b4_parse_param_for([Decl], [Formal], [ YYUSE (Formal);
|
b4_parse_param_for([Decl], [Formal], [ YYUSE (Formal);
|
||||||
])dnl
|
])dnl
|
||||||
@@ -180,10 +172,10 @@ m4_define([b4_int_type],
|
|||||||
[m4_if(b4_ints_in($@, [0], [255]), [1], [unsigned char],
|
[m4_if(b4_ints_in($@, [0], [255]), [1], [unsigned char],
|
||||||
b4_ints_in($@, [-128], [127]), [1], [signed char],
|
b4_ints_in($@, [-128], [127]), [1], [signed char],
|
||||||
|
|
||||||
b4_ints_in($@, [0], [65535]), [1], [unsigned short int],
|
b4_ints_in($@, [0], [65535]), [1], [unsigned short],
|
||||||
b4_ints_in($@, [-32768], [32767]), [1], [short int],
|
b4_ints_in($@, [-32768], [32767]), [1], [short],
|
||||||
|
|
||||||
m4_eval([0 <= $1]), [1], [unsigned int],
|
m4_eval([0 <= $1]), [1], [unsigned],
|
||||||
|
|
||||||
[int])])
|
[int])])
|
||||||
|
|
||||||
@@ -191,7 +183,7 @@ m4_define([b4_int_type],
|
|||||||
# b4_int_type_for(NAME)
|
# b4_int_type_for(NAME)
|
||||||
# ---------------------
|
# ---------------------
|
||||||
# Return the smallest int type able to handle numbers ranging from
|
# Return the smallest int type able to handle numbers ranging from
|
||||||
# `NAME_min' to `NAME_max' (included).
|
# 'NAME_min' to 'NAME_max' (included).
|
||||||
m4_define([b4_int_type_for],
|
m4_define([b4_int_type_for],
|
||||||
[b4_int_type($1_min, $1_max)])
|
[b4_int_type($1_min, $1_max)])
|
||||||
|
|
||||||
@@ -200,13 +192,75 @@ m4_define([b4_int_type_for],
|
|||||||
# --------------------------------------------
|
# --------------------------------------------
|
||||||
# Without inducing a comparison warning from the compiler, check if the
|
# Without inducing a comparison warning from the compiler, check if the
|
||||||
# literal value LITERAL equals VALUE from table TABLE, which must have
|
# literal value LITERAL equals VALUE from table TABLE, which must have
|
||||||
# TABLE_min and TABLE_max defined. YYID must be defined as an identity
|
# TABLE_min and TABLE_max defined.
|
||||||
# function that suppresses warnings about constant conditions.
|
|
||||||
m4_define([b4_table_value_equals],
|
m4_define([b4_table_value_equals],
|
||||||
[m4_if(m4_eval($3 < m4_indir([b4_]$1[_min])
|
[m4_if(m4_eval($3 < m4_indir([b4_]$1[_min])
|
||||||
|| m4_indir([b4_]$1[_max]) < $3), [1],
|
|| m4_indir([b4_]$1[_max]) < $3), [1],
|
||||||
[[YYID (0)]],
|
[[0]],
|
||||||
[[((]$2[) == (]$3[))]])])
|
[(!!(($2) == ($3)))])])
|
||||||
|
|
||||||
|
|
||||||
|
## ----------------- ##
|
||||||
|
## Compiler issues. ##
|
||||||
|
## ----------------- ##
|
||||||
|
|
||||||
|
# b4_attribute_define
|
||||||
|
# -------------------
|
||||||
|
# Provide portable compiler "attributes".
|
||||||
|
m4_define([b4_attribute_define],
|
||||||
|
[#ifndef YY_ATTRIBUTE
|
||||||
|
# if (defined __GNUC__ \
|
||||||
|
&& (2 < __GNUC__ || (__GNUC__ == 2 && 96 <= __GNUC_MINOR__))) \
|
||||||
|
|| defined __SUNPRO_C && 0x5110 <= __SUNPRO_C
|
||||||
|
# define YY_ATTRIBUTE(Spec) __attribute__(Spec)
|
||||||
|
# else
|
||||||
|
# define YY_ATTRIBUTE(Spec) /* empty */
|
||||||
|
# endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef YY_ATTRIBUTE_PURE
|
||||||
|
# define YY_ATTRIBUTE_PURE YY_ATTRIBUTE ((__pure__))
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef YY_ATTRIBUTE_UNUSED
|
||||||
|
# define YY_ATTRIBUTE_UNUSED YY_ATTRIBUTE ((__unused__))
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if !defined _Noreturn \
|
||||||
|
&& (!defined __STDC_VERSION__ || __STDC_VERSION__ < 201112)
|
||||||
|
# if defined _MSC_VER && 1200 <= _MSC_VER
|
||||||
|
# define _Noreturn __declspec (noreturn)
|
||||||
|
# else
|
||||||
|
# define _Noreturn YY_ATTRIBUTE ((__noreturn__))
|
||||||
|
# endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Suppress unused-variable warnings by "using" E. */
|
||||||
|
#if ! defined lint || defined __GNUC__
|
||||||
|
# define YYUSE(E) ((void) (E))
|
||||||
|
#else
|
||||||
|
# define YYUSE(E) /* empty */
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined __GNUC__ && ! defined __ICC && 407 <= __GNUC__ * 100 + __GNUC_MINOR__
|
||||||
|
/* Suppress an incorrect diagnostic about yylval being uninitialized. */
|
||||||
|
# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \
|
||||||
|
_Pragma ("GCC diagnostic push") \
|
||||||
|
_Pragma ("GCC diagnostic ignored \"-Wuninitialized\"")\
|
||||||
|
_Pragma ("GCC diagnostic ignored \"-Wmaybe-uninitialized\"")
|
||||||
|
# define YY_IGNORE_MAYBE_UNINITIALIZED_END \
|
||||||
|
_Pragma ("GCC diagnostic pop")
|
||||||
|
#else
|
||||||
|
# define YY_INITIAL_VALUE(Value) Value
|
||||||
|
#endif
|
||||||
|
#ifndef YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
|
||||||
|
# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
|
||||||
|
# define YY_IGNORE_MAYBE_UNINITIALIZED_END
|
||||||
|
#endif
|
||||||
|
#ifndef YY_INITIAL_VALUE
|
||||||
|
# define YY_INITIAL_VALUE(Value) /* Nothing. */
|
||||||
|
#endif
|
||||||
|
])
|
||||||
|
|
||||||
|
|
||||||
## ---------##
|
## ---------##
|
||||||
@@ -216,14 +270,14 @@ m4_define([b4_table_value_equals],
|
|||||||
|
|
||||||
# b4_null_define
|
# b4_null_define
|
||||||
# --------------
|
# --------------
|
||||||
# Portability issues: define a YY_NULL appropriate for the current
|
# Portability issues: define a YY_NULLPTR appropriate for the current
|
||||||
# language (C, C++98, or C++11).
|
# language (C, C++98, or C++11).
|
||||||
m4_define([b4_null_define],
|
m4_define([b4_null_define],
|
||||||
[# ifndef YY_NULL
|
[# ifndef YY_NULLPTR
|
||||||
# if defined __cplusplus && 201103L <= __cplusplus
|
# if defined __cplusplus && 201103L <= __cplusplus
|
||||||
# define YY_NULL nullptr
|
# define YY_NULLPTR nullptr
|
||||||
# else
|
# else
|
||||||
# define YY_NULL 0
|
# define YY_NULLPTR 0
|
||||||
# endif
|
# endif
|
||||||
# endif[]dnl
|
# endif[]dnl
|
||||||
])
|
])
|
||||||
@@ -232,13 +286,13 @@ m4_define([b4_null_define],
|
|||||||
# b4_null
|
# b4_null
|
||||||
# -------
|
# -------
|
||||||
# Return a null pointer constant.
|
# Return a null pointer constant.
|
||||||
m4_define([b4_null], [YY_NULL])
|
m4_define([b4_null], [YY_NULLPTR])
|
||||||
|
|
||||||
# b4_integral_parser_table_define(TABLE-NAME, CONTENT, COMMENT)
|
# b4_integral_parser_table_define(TABLE-NAME, CONTENT, COMMENT)
|
||||||
# -------------------------------------------------------------
|
# -------------------------------------------------------------
|
||||||
# Define "yy<TABLE-NAME>" which contents is CONTENT.
|
# Define "yy<TABLE-NAME>" whose contents is CONTENT.
|
||||||
m4_define([b4_integral_parser_table_define],
|
m4_define([b4_integral_parser_table_define],
|
||||||
[m4_ifvaln([$3], [b4_c_comment([$3], [ ])])dnl
|
[m4_ifvaln([$3], [b4_comment([$3], [ ])])dnl
|
||||||
static const b4_int_type_for([$2]) yy$1[[]] =
|
static const b4_int_type_for([$2]) yy$1[[]] =
|
||||||
{
|
{
|
||||||
$2
|
$2
|
||||||
@@ -262,29 +316,29 @@ m4_define([b4_token_define],
|
|||||||
m4_define([b4_token_defines],
|
m4_define([b4_token_defines],
|
||||||
[b4_any_token_visible_if([/* Tokens. */
|
[b4_any_token_visible_if([/* Tokens. */
|
||||||
m4_join([
|
m4_join([
|
||||||
], b4_symbol_map([b4_token_define]))])])
|
], b4_symbol_map([b4_token_define]))
|
||||||
|
])])
|
||||||
|
|
||||||
|
|
||||||
# b4_token_enum(TOKEN-NUM)
|
# b4_token_enum(TOKEN-NUM)
|
||||||
# ------------------------
|
# ------------------------
|
||||||
# Output the definition of this token as an enum.
|
# Output the definition of this token as an enum.
|
||||||
m4_define([b4_token_enum],
|
m4_define([b4_token_enum],
|
||||||
[b4_token_format([ %s = %s], [$1])])
|
[b4_token_format([%s = %s], [$1])])
|
||||||
|
|
||||||
|
|
||||||
# b4_token_enums
|
# b4_token_enums
|
||||||
# --------------
|
# --------------
|
||||||
# Output the definition of the tokens (if there are) as enums.
|
# Output the definition of the tokens (if there are) as enums.
|
||||||
m4_define([b4_token_enums],
|
m4_define([b4_token_enums],
|
||||||
[b4_any_token_visible_if([[/* Tokens. */
|
[b4_any_token_visible_if([[/* Token type. */
|
||||||
#ifndef ]b4_api_PREFIX[TOKENTYPE
|
#ifndef ]b4_api_PREFIX[TOKENTYPE
|
||||||
# define ]b4_api_PREFIX[TOKENTYPE
|
# define ]b4_api_PREFIX[TOKENTYPE
|
||||||
/* Put the tokens into the symbol table, so that GDB and other debuggers
|
enum ]b4_api_prefix[tokentype
|
||||||
know about them. */
|
{
|
||||||
enum ]b4_api_prefix[tokentype {
|
]m4_join([,
|
||||||
]m4_join([,
|
],
|
||||||
],
|
b4_symbol_map([b4_token_enum]))[
|
||||||
b4_symbol_map([b4_token_enum]))[
|
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
]])])
|
]])])
|
||||||
@@ -314,106 +368,43 @@ m4_define([b4_symbol_value],
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
## --------------------------------------------- ##
|
## ---------------------- ##
|
||||||
## Defining C functions in both K&R and ANSI-C. ##
|
## Defining C functions. ##
|
||||||
## --------------------------------------------- ##
|
## ---------------------- ##
|
||||||
|
|
||||||
|
|
||||||
# b4_modern_c
|
# b4_function_define(NAME, RETURN-VALUE, [DECL1, NAME1], ...)
|
||||||
# -----------
|
# -----------------------------------------------------------
|
||||||
# A predicate useful in #if to determine whether C is ancient or modern.
|
# Declare the function NAME in C.
|
||||||
#
|
m4_define([b4_function_define],
|
||||||
# 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 b4_c_modern
|
|
||||||
b4_c_ansi_function_def($@)
|
|
||||||
#else
|
|
||||||
$2
|
|
||||||
$1 (b4_c_knr_formal_names(m4_shift2($@)))
|
|
||||||
b4_c_knr_formal_decls(m4_shift2($@))
|
|
||||||
#endif[]dnl
|
|
||||||
])
|
|
||||||
|
|
||||||
|
|
||||||
# b4_c_ansi_function_def(NAME, RETURN-VALUE, [DECL1, NAME1], ...)
|
|
||||||
# ---------------------------------------------------------------
|
|
||||||
# Declare the function NAME in ANSI.
|
|
||||||
m4_define([b4_c_ansi_function_def],
|
|
||||||
[$2
|
[$2
|
||||||
$1 (b4_c_ansi_formals(m4_shift2($@)))[]dnl
|
$1 (b4_formals(m4_shift2($@)))[]dnl
|
||||||
])
|
])
|
||||||
|
|
||||||
|
|
||||||
# b4_c_ansi_formals([DECL1, NAME1], ...)
|
# b4_formals([DECL1, NAME1], ...)
|
||||||
# --------------------------------------
|
# -------------------------------
|
||||||
# Output the arguments ANSI-C definition.
|
# The formal arguments of a C function definition.
|
||||||
m4_define([b4_c_ansi_formals],
|
m4_define([b4_formals],
|
||||||
[m4_if([$#], [0], [void],
|
[m4_if([$#], [0], [void],
|
||||||
[$#$1], [1], [void],
|
[$#$1], [1], [void],
|
||||||
[m4_map_sep([b4_c_ansi_formal], [, ], [$@])])])
|
[m4_map_sep([b4_formal], [, ], [$@])])])
|
||||||
|
|
||||||
m4_define([b4_c_ansi_formal],
|
m4_define([b4_formal],
|
||||||
[$1])
|
[$1])
|
||||||
|
|
||||||
|
|
||||||
# b4_c_knr_formal_names([DECL1, NAME1], ...)
|
|
||||||
# ------------------------------------------
|
|
||||||
# Output the argument names.
|
|
||||||
m4_define([b4_c_knr_formal_names],
|
|
||||||
[m4_map_sep([b4_c_knr_formal_name], [, ], [$@])])
|
|
||||||
|
|
||||||
m4_define([b4_c_knr_formal_name],
|
## ----------------------- ##
|
||||||
[$2])
|
## Declaring C functions. ##
|
||||||
|
## ----------------------- ##
|
||||||
|
|
||||||
|
|
||||||
# b4_c_knr_formal_decls([DECL1, NAME1], ...)
|
# b4_function_declare(NAME, RETURN-VALUE, [DECL1, NAME1], ...)
|
||||||
# ------------------------------------------
|
# ------------------------------------------------------------
|
||||||
# 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;])
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
## ------------------------------------------------------------ ##
|
|
||||||
## Declaring (prototyping) C functions in both K&R and ANSI-C. ##
|
|
||||||
## ------------------------------------------------------------ ##
|
|
||||||
|
|
||||||
|
|
||||||
# b4_c_function_decl(NAME, RETURN-VALUE, [DECL1, NAME1], ...)
|
|
||||||
# -----------------------------------------------------------
|
|
||||||
# Declare the function NAME.
|
# Declare the function NAME.
|
||||||
m4_define([b4_c_function_decl],
|
m4_define([b4_function_declare],
|
||||||
[#if b4_c_modern
|
[$2 $1 (b4_formals(m4_shift2($@)));[]dnl
|
||||||
b4_c_ansi_function_decl($@)
|
|
||||||
#else
|
|
||||||
$2 $1 ();
|
|
||||||
#endif[]dnl
|
|
||||||
])
|
|
||||||
|
|
||||||
|
|
||||||
# b4_c_ansi_function_decl(NAME, RETURN-VALUE, [DECL1, NAME1], ...)
|
|
||||||
# ----------------------------------------------------------------
|
|
||||||
# Declare the function NAME.
|
|
||||||
m4_define([b4_c_ansi_function_decl],
|
|
||||||
[$2 $1 (b4_c_ansi_formals(m4_shift2($@)));[]dnl
|
|
||||||
])
|
])
|
||||||
|
|
||||||
|
|
||||||
@@ -424,21 +415,21 @@ m4_define([b4_c_ansi_function_decl],
|
|||||||
## --------------------- ##
|
## --------------------- ##
|
||||||
|
|
||||||
|
|
||||||
# b4_c_function_call(NAME, RETURN-VALUE, [DECL1, NAME1], ...)
|
# b4_function_call(NAME, RETURN-VALUE, [DECL1, NAME1], ...)
|
||||||
# -----------------------------------------------------------
|
# -----------------------------------------------------------
|
||||||
# Call the function NAME with arguments NAME1, NAME2 etc.
|
# Call the function NAME with arguments NAME1, NAME2 etc.
|
||||||
m4_define([b4_c_function_call],
|
m4_define([b4_function_call],
|
||||||
[$1 (b4_c_args(m4_shift2($@)))[]dnl
|
[$1 (b4_args(m4_shift2($@)))[]dnl
|
||||||
])
|
])
|
||||||
|
|
||||||
|
|
||||||
# b4_c_args([DECL1, NAME1], ...)
|
# b4_args([DECL1, NAME1], ...)
|
||||||
# ------------------------------
|
# ----------------------------
|
||||||
# Output the arguments NAME1, NAME2...
|
# Output the arguments NAME1, NAME2...
|
||||||
m4_define([b4_c_args],
|
m4_define([b4_args],
|
||||||
[m4_map_sep([b4_c_arg], [, ], [$@])])
|
[m4_map_sep([b4_arg], [, ], [$@])])
|
||||||
|
|
||||||
m4_define([b4_c_arg],
|
m4_define([b4_arg],
|
||||||
[$2])
|
[$2])
|
||||||
|
|
||||||
|
|
||||||
@@ -447,7 +438,7 @@ m4_define([b4_c_arg],
|
|||||||
## ----------- ##
|
## ----------- ##
|
||||||
|
|
||||||
# b4_sync_start(LINE, FILE)
|
# b4_sync_start(LINE, FILE)
|
||||||
# -----------------------
|
# -------------------------
|
||||||
m4_define([b4_sync_start], [[#]line $1 $2])
|
m4_define([b4_sync_start], [[#]line $1 $2])
|
||||||
|
|
||||||
|
|
||||||
@@ -468,23 +459,21 @@ b4_syncline([@oline@], [@ofile@])
|
|||||||
# ------------------------------------
|
# ------------------------------------
|
||||||
m4_define([b4_predicate_case],
|
m4_define([b4_predicate_case],
|
||||||
[ case $1:
|
[ case $1:
|
||||||
if (! ($2)) YYERROR;
|
if (! (
|
||||||
|
$2)) YYERROR;
|
||||||
b4_syncline([@oline@], [@ofile@])
|
b4_syncline([@oline@], [@ofile@])
|
||||||
break;])
|
break;])
|
||||||
|
|
||||||
|
|
||||||
# b4_yydestruct_generate(FUNCTION-DECLARATOR)
|
# b4_yydestruct_define
|
||||||
# -------------------------------------------
|
# --------------------
|
||||||
# Generate the "yydestruct" function, which declaration is issued using
|
# Define the "yydestruct" function.
|
||||||
# FUNCTION-DECLARATOR, which may be "b4_c_ansi_function_def" for ISO C
|
m4_define_default([b4_yydestruct_define],
|
||||||
# or "b4_c_function_def" for K&R.
|
|
||||||
m4_define_default([b4_yydestruct_generate],
|
|
||||||
[[/*-----------------------------------------------.
|
[[/*-----------------------------------------------.
|
||||||
| Release the memory associated to this symbol. |
|
| Release the memory associated to this symbol. |
|
||||||
`-----------------------------------------------*/
|
`-----------------------------------------------*/
|
||||||
|
|
||||||
/*ARGSUSED*/
|
]b4_function_define([yydestruct],
|
||||||
]$1([yydestruct],
|
|
||||||
[static void],
|
[static void],
|
||||||
[[const char *yymsg], [yymsg]],
|
[[const char *yymsg], [yymsg]],
|
||||||
[[int yytype], [yytype]],
|
[[int yytype], [yytype]],
|
||||||
@@ -497,29 +486,23 @@ m4_ifset([b4_parse_param], [, b4_parse_param]))[
|
|||||||
yymsg = "Deleting";
|
yymsg = "Deleting";
|
||||||
YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);
|
YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);
|
||||||
|
|
||||||
switch (yytype)
|
YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
|
||||||
{
|
]b4_symbol_actions([destructor])[
|
||||||
]b4_symbol_foreach([b4_symbol_destructor])dnl
|
YY_IGNORE_MAYBE_UNINITIALIZED_END
|
||||||
[ default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}]dnl
|
}]dnl
|
||||||
])
|
])
|
||||||
|
|
||||||
|
|
||||||
# b4_yy_symbol_print_generate(FUNCTION-DECLARATOR)
|
# b4_yy_symbol_print_define
|
||||||
# ------------------------------------------------
|
# -------------------------
|
||||||
# Generate the "yy_symbol_print" function, which declaration is issued using
|
# Define the "yy_symbol_print" function.
|
||||||
# FUNCTION-DECLARATOR, which may be "b4_c_ansi_function_def" for ISO C
|
m4_define_default([b4_yy_symbol_print_define],
|
||||||
# or "b4_c_function_def" for K&R.
|
|
||||||
m4_define_default([b4_yy_symbol_print_generate],
|
|
||||||
[[
|
[[
|
||||||
/*--------------------------------.
|
/*----------------------------------------.
|
||||||
| Print this symbol on YYOUTPUT. |
|
| Print this symbol's value on YYOUTPUT. |
|
||||||
`--------------------------------*/
|
`----------------------------------------*/
|
||||||
|
|
||||||
/*ARGSUSED*/
|
]b4_function_define([yy_symbol_value_print],
|
||||||
]$1([yy_symbol_value_print],
|
|
||||||
[static void],
|
[static void],
|
||||||
[[FILE *yyoutput], [yyoutput]],
|
[[FILE *yyoutput], [yyoutput]],
|
||||||
[[int yytype], [yytype]],
|
[[int yytype], [yytype]],
|
||||||
@@ -538,12 +521,7 @@ m4_if(b4_skeleton, ["yacc.c"],
|
|||||||
YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
|
YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
|
||||||
# endif
|
# endif
|
||||||
]])dnl
|
]])dnl
|
||||||
[ switch (yytype)
|
b4_symbol_actions([printer])[
|
||||||
{
|
|
||||||
]b4_symbol_foreach([b4_symbol_printer])dnl
|
|
||||||
[ default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -551,7 +529,7 @@ m4_if(b4_skeleton, ["yacc.c"],
|
|||||||
| Print this symbol on YYOUTPUT. |
|
| Print this symbol on YYOUTPUT. |
|
||||||
`--------------------------------*/
|
`--------------------------------*/
|
||||||
|
|
||||||
]$1([yy_symbol_print],
|
]b4_function_define([yy_symbol_print],
|
||||||
[static void],
|
[static void],
|
||||||
[[FILE *yyoutput], [yyoutput]],
|
[[FILE *yyoutput], [yyoutput]],
|
||||||
[[int yytype], [yytype]],
|
[[int yytype], [yytype]],
|
||||||
@@ -559,10 +537,8 @@ m4_if(b4_skeleton, ["yacc.c"],
|
|||||||
b4_locations_if([, [[YYLTYPE const * const yylocationp], [yylocationp]]])[]dnl
|
b4_locations_if([, [[YYLTYPE const * const yylocationp], [yylocationp]]])[]dnl
|
||||||
m4_ifset([b4_parse_param], [, b4_parse_param]))[
|
m4_ifset([b4_parse_param], [, b4_parse_param]))[
|
||||||
{
|
{
|
||||||
if (yytype < YYNTOKENS)
|
YYFPRINTF (yyoutput, "%s %s (",
|
||||||
YYFPRINTF (yyoutput, "token %s (", yytname[yytype]);
|
yytype < YYNTOKENS ? "token" : "nterm", yytname[yytype]);
|
||||||
else
|
|
||||||
YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]);
|
|
||||||
|
|
||||||
]b4_locations_if([ YY_LOCATION_PRINT (yyoutput, *yylocationp);
|
]b4_locations_if([ YY_LOCATION_PRINT (yyoutput, *yylocationp);
|
||||||
YYFPRINTF (yyoutput, ": ");
|
YYFPRINTF (yyoutput, ": ");
|
||||||
@@ -573,50 +549,193 @@ b4_locations_if([, yylocationp])[]b4_user_args[);
|
|||||||
}]dnl
|
}]dnl
|
||||||
])
|
])
|
||||||
|
|
||||||
|
|
||||||
|
## ---------------- ##
|
||||||
|
## api.value.type. ##
|
||||||
|
## ---------------- ##
|
||||||
|
|
||||||
|
|
||||||
|
# ---------------------- #
|
||||||
|
# api.value.type=union. #
|
||||||
|
# ---------------------- #
|
||||||
|
|
||||||
|
# b4_symbol_type_register(SYMBOL-NUM)
|
||||||
|
# -----------------------------------
|
||||||
|
# Symbol SYMBOL-NUM has a type (for variant) instead of a type-tag.
|
||||||
|
# Extend the definition of %union's body (b4_union_members) with a
|
||||||
|
# field of that type, and extend the symbol's "type" field to point to
|
||||||
|
# the field name, instead of the type name.
|
||||||
|
m4_define([b4_symbol_type_register],
|
||||||
|
[m4_define([b4_symbol($1, type_tag)],
|
||||||
|
[b4_symbol_if([$1], [has_id],
|
||||||
|
[b4_symbol([$1], [id])],
|
||||||
|
[yytype_[]b4_symbol([$1], [number])])])dnl
|
||||||
|
m4_append([b4_union_members],
|
||||||
|
m4_expand([
|
||||||
|
b4_symbol_tag_comment([$1])dnl
|
||||||
|
b4_symbol([$1], [type]) b4_symbol([$1], [type_tag]);]))
|
||||||
|
])
|
||||||
|
|
||||||
|
|
||||||
|
# b4_type_define_tag(SYMBOL1-NUM, ...)
|
||||||
|
# ------------------------------------
|
||||||
|
# For the batch of symbols SYMBOL1-NUM... (which all have the same
|
||||||
|
# type), enhance the %union definition for each of them, and set
|
||||||
|
# there "type" field to the field tag name, instead of the type name.
|
||||||
|
m4_define([b4_type_define_tag],
|
||||||
|
[b4_symbol_if([$1], [has_type],
|
||||||
|
[m4_map([b4_symbol_type_register], [$@])])
|
||||||
|
])
|
||||||
|
|
||||||
|
|
||||||
|
# b4_symbol_value_union(VAL, [TYPE])
|
||||||
|
# ----------------------------------
|
||||||
|
# Same of b4_symbol_value, but when api.value.type=union.
|
||||||
|
m4_define([b4_symbol_value_union],
|
||||||
|
[m4_ifval([$2],
|
||||||
|
[(*($2*)(&$1))],
|
||||||
|
[$1])])
|
||||||
|
])
|
||||||
|
|
||||||
|
|
||||||
|
# b4_value_type_setup_union
|
||||||
|
# -------------------------
|
||||||
|
# Setup support for api.value.type=union. Symbols are defined with a
|
||||||
|
# type instead of a union member name: build the corresponding union,
|
||||||
|
# and give the symbols their tag.
|
||||||
|
m4_define([b4_value_type_setup_union],
|
||||||
|
[m4_define([b4_union_members])
|
||||||
|
b4_type_foreach([b4_type_define_tag])
|
||||||
|
m4_copy_force([b4_symbol_value_union], [b4_symbol_value])
|
||||||
|
])
|
||||||
|
|
||||||
|
|
||||||
|
# -------------------------- #
|
||||||
|
# api.value.type = variant. #
|
||||||
|
# -------------------------- #
|
||||||
|
|
||||||
|
# b4_value_type_setup_variant
|
||||||
|
# ---------------------------
|
||||||
|
# Setup support for api.value.type=variant. By default, fail, specialized
|
||||||
|
# by other skeletons.
|
||||||
|
m4_define([b4_value_type_setup_variant],
|
||||||
|
[b4_complain_at(b4_percent_define_get_loc([[api.value.type]]),
|
||||||
|
[['%s' does not support '%s']],
|
||||||
|
[b4_skeleton],
|
||||||
|
[%define api.value.type variant])])
|
||||||
|
|
||||||
|
|
||||||
|
# _b4_value_type_setup_keyword
|
||||||
|
# ----------------------------
|
||||||
|
# api.value.type is defined with a keyword/string syntax. Check if
|
||||||
|
# that is properly defined, and prepare its use.
|
||||||
|
m4_define([_b4_value_type_setup_keyword],
|
||||||
|
[b4_percent_define_check_values([[[[api.value.type]],
|
||||||
|
[[none]],
|
||||||
|
[[union]],
|
||||||
|
[[union-directive]],
|
||||||
|
[[variant]],
|
||||||
|
[[yystype]]]])dnl
|
||||||
|
m4_case(b4_percent_define_get([[api.value.type]]),
|
||||||
|
[union], [b4_value_type_setup_union],
|
||||||
|
[variant], [b4_value_type_setup_variant])])
|
||||||
|
|
||||||
|
|
||||||
|
# b4_value_type_setup
|
||||||
|
# -------------------
|
||||||
|
# Check if api.value.type is properly defined, and possibly prepare
|
||||||
|
# its use.
|
||||||
|
b4_define_silent([b4_value_type_setup],
|
||||||
|
[# Define default value.
|
||||||
|
b4_percent_define_ifdef([[api.value.type]], [],
|
||||||
|
[# %union => api.value.type=union-directive
|
||||||
|
m4_ifdef([b4_union_members],
|
||||||
|
[m4_define([b4_percent_define_kind(api.value.type)], [keyword])
|
||||||
|
m4_define([b4_percent_define(api.value.type)], [union-directive])],
|
||||||
|
[# no tag seen => api.value.type={int}
|
||||||
|
m4_if(b4_tag_seen_flag, 0,
|
||||||
|
[m4_define([b4_percent_define_kind(api.value.type)], [code])
|
||||||
|
m4_define([b4_percent_define(api.value.type)], [int])],
|
||||||
|
[# otherwise api.value.type=yystype
|
||||||
|
m4_define([b4_percent_define_kind(api.value.type)], [keyword])
|
||||||
|
m4_define([b4_percent_define(api.value.type)], [yystype])])])])
|
||||||
|
|
||||||
|
# Set up.
|
||||||
|
m4_bmatch(b4_percent_define_get_kind([[api.value.type]]),
|
||||||
|
[keyword\|string], [_b4_value_type_setup_keyword])
|
||||||
|
])
|
||||||
|
|
||||||
|
|
||||||
## -------------- ##
|
## -------------- ##
|
||||||
## Declarations. ##
|
## Declarations. ##
|
||||||
## -------------- ##
|
## -------------- ##
|
||||||
|
|
||||||
|
|
||||||
|
# b4_value_type_define
|
||||||
|
# --------------------
|
||||||
|
m4_define([b4_value_type_define],
|
||||||
|
[b4_value_type_setup[]dnl
|
||||||
|
/* Value type. */
|
||||||
|
m4_bmatch(b4_percent_define_get_kind([[api.value.type]]),
|
||||||
|
[code],
|
||||||
|
[[#if ! defined ]b4_api_PREFIX[STYPE && ! defined ]b4_api_PREFIX[STYPE_IS_DECLARED
|
||||||
|
typedef ]b4_percent_define_get([[api.value.type]])[ ]b4_api_PREFIX[STYPE;
|
||||||
|
# define ]b4_api_PREFIX[STYPE_IS_TRIVIAL 1
|
||||||
|
# define ]b4_api_PREFIX[STYPE_IS_DECLARED 1
|
||||||
|
#endif
|
||||||
|
]],
|
||||||
|
[m4_bmatch(b4_percent_define_get([[api.value.type]]),
|
||||||
|
[union\|union-directive],
|
||||||
|
[[#if ! defined ]b4_api_PREFIX[STYPE && ! defined ]b4_api_PREFIX[STYPE_IS_DECLARED
|
||||||
|
]b4_percent_define_get_syncline([[api.value.union.name]])[
|
||||||
|
union ]b4_percent_define_get([[api.value.union.name]])[
|
||||||
|
{
|
||||||
|
]b4_user_union_members[
|
||||||
|
};
|
||||||
|
]b4_percent_define_get_syncline([[api.value.union.name]])[
|
||||||
|
typedef union ]b4_percent_define_get([[api.value.union.name]])[ ]b4_api_PREFIX[STYPE;
|
||||||
|
# define ]b4_api_PREFIX[STYPE_IS_TRIVIAL 1
|
||||||
|
# define ]b4_api_PREFIX[STYPE_IS_DECLARED 1
|
||||||
|
#endif
|
||||||
|
]])])])
|
||||||
|
|
||||||
|
|
||||||
|
# b4_location_type_define
|
||||||
|
# -----------------------
|
||||||
|
m4_define([b4_location_type_define],
|
||||||
|
[[/* Location type. */
|
||||||
|
#if ! defined ]b4_api_PREFIX[LTYPE && ! defined ]b4_api_PREFIX[LTYPE_IS_DECLARED
|
||||||
|
typedef struct ]b4_api_PREFIX[LTYPE ]b4_api_PREFIX[LTYPE;
|
||||||
|
struct ]b4_api_PREFIX[LTYPE
|
||||||
|
{
|
||||||
|
int first_line;
|
||||||
|
int first_column;
|
||||||
|
int last_line;
|
||||||
|
int last_column;
|
||||||
|
};
|
||||||
|
# define ]b4_api_PREFIX[LTYPE_IS_DECLARED 1
|
||||||
|
# define ]b4_api_PREFIX[LTYPE_IS_TRIVIAL 1
|
||||||
|
#endif
|
||||||
|
]])
|
||||||
|
|
||||||
|
|
||||||
# b4_declare_yylstype
|
# b4_declare_yylstype
|
||||||
# -------------------
|
# -------------------
|
||||||
# Declarations that might either go into the header (if --defines) or
|
# Declarations that might either go into the header (if --defines) or
|
||||||
# in the parser body. Declare YYSTYPE/YYLTYPE, and yylval/yylloc.
|
# in the parser body. Declare YYSTYPE/YYLTYPE, and yylval/yylloc.
|
||||||
m4_define([b4_declare_yylstype],
|
m4_define([b4_declare_yylstype],
|
||||||
[[#if ! defined ]b4_api_PREFIX[STYPE && ! defined ]b4_api_PREFIX[STYPE_IS_DECLARED
|
[b4_value_type_define[]b4_locations_if([
|
||||||
]m4_ifdef([b4_stype],
|
b4_location_type_define])
|
||||||
[[typedef union ]b4_union_name[
|
|
||||||
{
|
|
||||||
]b4_user_stype[
|
|
||||||
} ]b4_api_PREFIX[STYPE;
|
|
||||||
# define ]b4_api_PREFIX[STYPE_IS_TRIVIAL 1]],
|
|
||||||
[m4_if(b4_tag_seen_flag, 0,
|
|
||||||
[[typedef int ]b4_api_PREFIX[STYPE;
|
|
||||||
# define ]b4_api_PREFIX[STYPE_IS_TRIVIAL 1]])])[
|
|
||||||
# define ]b4_api_prefix[stype ]b4_api_PREFIX[STYPE /* obsolescent; will be withdrawn */
|
|
||||||
# define ]b4_api_PREFIX[STYPE_IS_DECLARED 1
|
|
||||||
#endif]b4_locations_if([[
|
|
||||||
|
|
||||||
#if ! defined ]b4_api_PREFIX[LTYPE && ! defined ]b4_api_PREFIX[LTYPE_IS_DECLARED
|
|
||||||
typedef struct ]b4_api_PREFIX[LTYPE
|
|
||||||
{
|
|
||||||
int first_line;
|
|
||||||
int first_column;
|
|
||||||
int last_line;
|
|
||||||
int last_column;
|
|
||||||
} ]b4_api_PREFIX[LTYPE;
|
|
||||||
# define ]b4_api_prefix[ltype ]b4_api_PREFIX[LTYPE /* obsolescent; will be withdrawn */
|
|
||||||
# define ]b4_api_PREFIX[LTYPE_IS_DECLARED 1
|
|
||||||
# define ]b4_api_PREFIX[LTYPE_IS_TRIVIAL 1
|
|
||||||
#endif]])
|
|
||||||
|
|
||||||
b4_pure_if([], [[extern ]b4_api_PREFIX[STYPE ]b4_prefix[lval;
|
b4_pure_if([], [[extern ]b4_api_PREFIX[STYPE ]b4_prefix[lval;
|
||||||
]b4_locations_if([[extern ]b4_api_PREFIX[LTYPE ]b4_prefix[lloc;]])])[]dnl
|
]b4_locations_if([[extern ]b4_api_PREFIX[LTYPE ]b4_prefix[lloc;]])])[]dnl
|
||||||
])
|
])
|
||||||
|
|
||||||
|
|
||||||
# b4_YYDEBUG_define
|
# b4_YYDEBUG_define
|
||||||
# ------------------
|
# -----------------
|
||||||
m4_define([b4_YYDEBUG_define],
|
m4_define([b4_YYDEBUG_define],
|
||||||
[[/* Enabling traces. */
|
[[/* Debug traces. */
|
||||||
]m4_if(b4_api_prefix, [yy],
|
]m4_if(b4_api_prefix, [yy],
|
||||||
[[#ifndef YYDEBUG
|
[[#ifndef YYDEBUG
|
||||||
# define YYDEBUG ]b4_parse_trace_if([1], [0])[
|
# define YYDEBUG ]b4_parse_trace_if([1], [0])[
|
||||||
@@ -630,7 +749,7 @@ m4_define([b4_YYDEBUG_define],
|
|||||||
# endif
|
# endif
|
||||||
# else /* ! defined YYDEBUG */
|
# else /* ! defined YYDEBUG */
|
||||||
# define ]b4_api_PREFIX[DEBUG ]b4_parse_trace_if([1], [0])[
|
# define ]b4_api_PREFIX[DEBUG ]b4_parse_trace_if([1], [0])[
|
||||||
# endif /* ! defined ]b4_api_PREFIX[DEBUG */
|
# endif /* ! defined YYDEBUG */
|
||||||
#endif /* ! defined ]b4_api_PREFIX[DEBUG */]])[]dnl
|
#endif /* ! defined ]b4_api_PREFIX[DEBUG */]])[]dnl
|
||||||
])
|
])
|
||||||
|
|
||||||
@@ -654,7 +773,7 @@ m4_define([b4_yylloc_default_define],
|
|||||||
#ifndef YYLLOC_DEFAULT
|
#ifndef YYLLOC_DEFAULT
|
||||||
# define YYLLOC_DEFAULT(Current, Rhs, N) \
|
# define YYLLOC_DEFAULT(Current, Rhs, N) \
|
||||||
do \
|
do \
|
||||||
if (YYID (N)) \
|
if (N) \
|
||||||
{ \
|
{ \
|
||||||
(Current).first_line = YYRHSLOC (Rhs, 1).first_line; \
|
(Current).first_line = YYRHSLOC (Rhs, 1).first_line; \
|
||||||
(Current).first_column = YYRHSLOC (Rhs, 1).first_column; \
|
(Current).first_column = YYRHSLOC (Rhs, 1).first_column; \
|
||||||
@@ -668,6 +787,75 @@ m4_define([b4_yylloc_default_define],
|
|||||||
(Current).first_column = (Current).last_column = \
|
(Current).first_column = (Current).last_column = \
|
||||||
YYRHSLOC (Rhs, 0).last_column; \
|
YYRHSLOC (Rhs, 0).last_column; \
|
||||||
} \
|
} \
|
||||||
while (YYID (0))
|
while (0)
|
||||||
#endif
|
#endif
|
||||||
]])
|
]])
|
||||||
|
|
||||||
|
# b4_yy_location_print_define
|
||||||
|
# ---------------------------
|
||||||
|
# Define YY_LOCATION_PRINT.
|
||||||
|
m4_define([b4_yy_location_print_define],
|
||||||
|
[b4_locations_if([[
|
||||||
|
/* YY_LOCATION_PRINT -- Print the location on the stream.
|
||||||
|
This macro was not mandated originally: define only if we know
|
||||||
|
we won't break user code: when these are the locations we know. */
|
||||||
|
|
||||||
|
#ifndef YY_LOCATION_PRINT
|
||||||
|
# if defined ]b4_api_PREFIX[LTYPE_IS_TRIVIAL && ]b4_api_PREFIX[LTYPE_IS_TRIVIAL
|
||||||
|
|
||||||
|
/* Print *YYLOCP on YYO. Private, do not rely on its existence. */
|
||||||
|
|
||||||
|
YY_ATTRIBUTE_UNUSED
|
||||||
|
]b4_function_define([yy_location_print_],
|
||||||
|
[static unsigned],
|
||||||
|
[[FILE *yyo], [yyo]],
|
||||||
|
[[YYLTYPE const * const yylocp], [yylocp]])[
|
||||||
|
{
|
||||||
|
unsigned res = 0;
|
||||||
|
int end_col = 0 != yylocp->last_column ? yylocp->last_column - 1 : 0;
|
||||||
|
if (0 <= yylocp->first_line)
|
||||||
|
{
|
||||||
|
res += YYFPRINTF (yyo, "%d", yylocp->first_line);
|
||||||
|
if (0 <= yylocp->first_column)
|
||||||
|
res += YYFPRINTF (yyo, ".%d", yylocp->first_column);
|
||||||
|
}
|
||||||
|
if (0 <= yylocp->last_line)
|
||||||
|
{
|
||||||
|
if (yylocp->first_line < yylocp->last_line)
|
||||||
|
{
|
||||||
|
res += YYFPRINTF (yyo, "-%d", yylocp->last_line);
|
||||||
|
if (0 <= end_col)
|
||||||
|
res += YYFPRINTF (yyo, ".%d", end_col);
|
||||||
|
}
|
||||||
|
else if (0 <= end_col && yylocp->first_column < end_col)
|
||||||
|
res += YYFPRINTF (yyo, "-%d", end_col);
|
||||||
|
}
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
|
# define YY_LOCATION_PRINT(File, Loc) \
|
||||||
|
yy_location_print_ (File, &(Loc))
|
||||||
|
|
||||||
|
# else
|
||||||
|
# define YY_LOCATION_PRINT(File, Loc) ((void) 0)
|
||||||
|
# endif
|
||||||
|
#endif]],
|
||||||
|
[[/* This macro is provided for backward compatibility. */
|
||||||
|
#ifndef YY_LOCATION_PRINT
|
||||||
|
# define YY_LOCATION_PRINT(File, Loc) ((void) 0)
|
||||||
|
#endif]])
|
||||||
|
])
|
||||||
|
|
||||||
|
# b4_yyloc_default
|
||||||
|
# ----------------
|
||||||
|
# Expand to a possible default value for yylloc.
|
||||||
|
m4_define([b4_yyloc_default],
|
||||||
|
[[
|
||||||
|
# if defined ]b4_api_PREFIX[LTYPE_IS_TRIVIAL && ]b4_api_PREFIX[LTYPE_IS_TRIVIAL
|
||||||
|
= { ]m4_join([, ],
|
||||||
|
m4_defn([b4_location_initial_line]),
|
||||||
|
m4_defn([b4_location_initial_column]),
|
||||||
|
m4_defn([b4_location_initial_line]),
|
||||||
|
m4_defn([b4_location_initial_column]))[ }
|
||||||
|
# endif
|
||||||
|
]])
|
||||||
|
|||||||
+270
-304
File diff suppressed because it is too large
Load Diff
+112
-82
@@ -1,6 +1,6 @@
|
|||||||
# C++ GLR skeleton for Bison
|
# C++ GLR skeleton for Bison
|
||||||
|
|
||||||
# Copyright (C) 2002-2012 Free Software Foundation, Inc.
|
# Copyright (C) 2002-2015, 2018 Free Software Foundation, Inc.
|
||||||
|
|
||||||
# This program is free software: you can redistribute it and/or modify
|
# 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
|
# it under the terms of the GNU General Public License as published by
|
||||||
@@ -43,17 +43,11 @@
|
|||||||
# user must initialize the first positions (in particular the
|
# user must initialize the first positions (in particular the
|
||||||
# filename member).
|
# filename member).
|
||||||
|
|
||||||
# We require a pure interface using locations.
|
# We require a pure interface.
|
||||||
m4_define([b4_percent_define(locations)], [])
|
|
||||||
m4_define([b4_pure_flag], [1])
|
m4_define([b4_pure_flag], [1])
|
||||||
|
|
||||||
# The header is mandatory.
|
|
||||||
b4_defines_if([],
|
|
||||||
[b4_fatal([b4_skeleton[: using %%defines is mandatory]])])
|
|
||||||
|
|
||||||
m4_include(b4_pkgdatadir/[c++.m4])
|
m4_include(b4_pkgdatadir/[c++.m4])
|
||||||
b4_percent_define_ifdef([[location_type]], [],
|
b4_bison_locations_if([m4_include(b4_pkgdatadir/[location.cc])])
|
||||||
[m4_include(b4_pkgdatadir/[location.cc])])
|
|
||||||
|
|
||||||
m4_define([b4_parser_class_name],
|
m4_define([b4_parser_class_name],
|
||||||
[b4_percent_define_get([[parser_class_name]])])
|
[b4_percent_define_get([[parser_class_name]])])
|
||||||
@@ -61,69 +55,103 @@ m4_define([b4_parser_class_name],
|
|||||||
# Save the parse parameters.
|
# Save the parse parameters.
|
||||||
m4_define([b4_parse_param_orig], m4_defn([b4_parse_param]))
|
m4_define([b4_parse_param_orig], m4_defn([b4_parse_param]))
|
||||||
|
|
||||||
|
# b4_parse_param_wrap
|
||||||
|
# -------------------
|
||||||
|
# New ones.
|
||||||
|
m4_ifset([b4_parse_param],
|
||||||
|
[m4_define([b4_parse_param_wrap],
|
||||||
|
[[b4_namespace_ref::b4_parser_class_name[& yyparser], [[yyparser]]],]
|
||||||
|
m4_defn([b4_parse_param]))],
|
||||||
|
[m4_define([b4_parse_param_wrap],
|
||||||
|
[[b4_namespace_ref::b4_parser_class_name[& yyparser], [[yyparser]]]])
|
||||||
|
])
|
||||||
|
|
||||||
# b4_yy_symbol_print_generate
|
|
||||||
# ---------------------------
|
# b4_yy_symbol_print_define
|
||||||
|
# -------------------------
|
||||||
# Bypass the default implementation to generate the "yy_symbol_print"
|
# Bypass the default implementation to generate the "yy_symbol_print"
|
||||||
# and "yy_symbol_value_print" functions.
|
# and "yy_symbol_value_print" functions.
|
||||||
m4_define([b4_yy_symbol_print_generate],
|
m4_define([b4_yy_symbol_print_define],
|
||||||
[[
|
[[
|
||||||
/*--------------------.
|
/*--------------------.
|
||||||
| Print this symbol. |
|
| Print this symbol. |
|
||||||
`--------------------*/
|
`--------------------*/
|
||||||
|
|
||||||
]b4_c_ansi_function_def([yy_symbol_print],
|
]b4_function_define([yy_symbol_print],
|
||||||
[static void],
|
[static void],
|
||||||
[[FILE *], []],
|
[[FILE *], []],
|
||||||
[[int yytype], [yytype]],
|
[[int yytype], [yytype]],
|
||||||
[[const ]b4_namespace_ref::b4_parser_class_name[::semantic_type *yyvaluep],
|
[[const ]b4_namespace_ref::b4_parser_class_name[::semantic_type *yyvaluep],
|
||||||
[yyvaluep]],
|
[yyvaluep]][]dnl
|
||||||
|
b4_locations_if([,
|
||||||
[[const ]b4_namespace_ref::b4_parser_class_name[::location_type *yylocationp],
|
[[const ]b4_namespace_ref::b4_parser_class_name[::location_type *yylocationp],
|
||||||
[yylocationp]],
|
[yylocationp]]]),
|
||||||
b4_parse_param)[
|
b4_parse_param)[
|
||||||
{
|
{
|
||||||
]b4_parse_param_use[]dnl
|
]b4_parse_param_use[]dnl
|
||||||
[ yyparser.yy_symbol_print_ (yytype, yyvaluep]b4_locations_if([, yylocationp])[);
|
[ yyparser.yy_symbol_print_ (yytype, yyvaluep]b4_locations_if([, yylocationp])[);
|
||||||
}
|
}
|
||||||
]])
|
]])[
|
||||||
|
|
||||||
|
# Hijack the initial action to initialize the locations.
|
||||||
|
]b4_bison_locations_if([m4_define([b4_initial_action],
|
||||||
|
[yylloc.initialize ();]m4_ifdef([b4_initial_action], [
|
||||||
|
m4_defn([b4_initial_action])]))])[
|
||||||
|
|
||||||
# Hijack the post prologue to insert early definition of YYLLOC_DEFAULT
|
# Hijack the post prologue to insert early definition of YYLLOC_DEFAULT
|
||||||
# and declaration of yyerror.
|
# and declaration of yyerror.
|
||||||
m4_append([b4_post_prologue],
|
]m4_append([b4_post_prologue],
|
||||||
[b4_syncline([@oline@], [@ofile@])[
|
[b4_syncline([@oline@], [@ofile@])[
|
||||||
]b4_yylloc_default_define[
|
]b4_yylloc_default_define[
|
||||||
#define YYRHSLOC(Rhs, K) ((Rhs)[K].yystate.yyloc)
|
#define YYRHSLOC(Rhs, K) ((Rhs)[K].yystate.yyloc)
|
||||||
]b4_c_ansi_function_decl([yyerror],
|
]b4_function_declare([yyerror],
|
||||||
[static void],
|
[static void],b4_locations_if([
|
||||||
[[const ]b4_namespace_ref::b4_parser_class_name[::location_type *yylocationp],
|
[[const ]b4_namespace_ref::b4_parser_class_name[::location_type *yylocationp],
|
||||||
[yylocationp]],
|
[yylocationp]],])
|
||||||
b4_parse_param,
|
b4_parse_param,
|
||||||
[[const char* msg], [msg]])])
|
[[const char* msg], [msg]])])
|
||||||
|
|
||||||
|
|
||||||
|
#undef yynerrs
|
||||||
|
#undef yychar
|
||||||
|
#undef yylval]b4_locations_if([
|
||||||
|
#undef yylloc])
|
||||||
|
|
||||||
|
m4_if(b4_prefix, [yy], [],
|
||||||
|
[[/* Substitute the variable and function names. */
|
||||||
|
#define yyparse ]b4_prefix[parse
|
||||||
|
#define yylex ]b4_prefix[lex
|
||||||
|
#define yyerror ]b4_prefix[error
|
||||||
|
#define yydebug ]b4_prefix[debug
|
||||||
|
]]b4_pure_if([], [[
|
||||||
|
#define yylval ]b4_prefix[lval
|
||||||
|
#define yychar ]b4_prefix[char
|
||||||
|
#define yynerrs ]b4_prefix[nerrs]b4_locations_if([[
|
||||||
|
#define yylloc ]b4_prefix[lloc]])]))
|
||||||
|
|
||||||
# Hijack the epilogue to define implementations (yyerror, parser member
|
# Hijack the epilogue to define implementations (yyerror, parser member
|
||||||
# functions etc.).
|
# functions etc.).
|
||||||
m4_append([b4_epilogue],
|
m4_append([b4_epilogue],
|
||||||
[b4_syncline([@oline@], [@ofile@])[
|
[b4_syncline([@oline@], [@ofile@])[
|
||||||
|
|
||||||
/*------------------.
|
/*------------------.
|
||||||
| Report an error. |
|
| Report an error. |
|
||||||
`------------------*/
|
`------------------*/
|
||||||
|
|
||||||
]b4_c_ansi_function_def([yyerror],
|
]b4_function_define([yyerror],
|
||||||
[static void],
|
[static void],b4_locations_if([
|
||||||
[[const ]b4_namespace_ref::b4_parser_class_name[::location_type *yylocationp],
|
[[const ]b4_namespace_ref::b4_parser_class_name[::location_type *yylocationp],
|
||||||
[yylocationp]],
|
[yylocationp]],])
|
||||||
b4_parse_param,
|
b4_parse_param,
|
||||||
[[const char* msg], [msg]])[
|
[[const char* msg], [msg]])[
|
||||||
{
|
{
|
||||||
]b4_parse_param_use[]dnl
|
]b4_parse_param_use[]dnl
|
||||||
[ yyparser.error (*yylocationp, msg);
|
[ yyparser.error (]b4_locations_if([[*yylocationp, ]])[msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
]b4_namespace_open[
|
]b4_namespace_open[
|
||||||
]dnl In this section, the parse param are the original parse_params.
|
]dnl In this section, the parse params are the original parse_params.
|
||||||
m4_pushdef([b4_parse_param], m4_defn([b4_parse_param_orig]))dnl
|
m4_pushdef([b4_parse_param], m4_defn([b4_parse_param_orig]))dnl
|
||||||
[ /// Build a parser object.
|
[ /// Build a parser object.
|
||||||
]b4_parser_class_name::b4_parser_class_name[ (]b4_parse_param_decl[)]m4_ifset([b4_parse_param], [
|
]b4_parser_class_name::b4_parser_class_name[ (]b4_parse_param_decl[)]m4_ifset([b4_parse_param], [
|
||||||
@@ -149,34 +177,29 @@ m4_pushdef([b4_parse_param], m4_defn([b4_parse_param_orig]))dnl
|
|||||||
| Print this symbol. |
|
| Print this symbol. |
|
||||||
`--------------------*/
|
`--------------------*/
|
||||||
|
|
||||||
inline void
|
void
|
||||||
]b4_parser_class_name[::yy_symbol_value_print_ (int yytype,
|
]b4_parser_class_name[::yy_symbol_value_print_ (int yytype,
|
||||||
const semantic_type* yyvaluep,
|
const semantic_type* yyvaluep]b4_locations_if([[,
|
||||||
const location_type* yylocationp)
|
const location_type* yylocationp]])[)
|
||||||
{
|
{]b4_locations_if([[
|
||||||
YYUSE (yylocationp);
|
YYUSE (yylocationp);]])[
|
||||||
YYUSE (yyvaluep);
|
YYUSE (yyvaluep);
|
||||||
std::ostream& yyoutput = debug_stream ();
|
std::ostream& yyoutput = debug_stream ();
|
||||||
std::ostream& yyo = yyoutput;
|
std::ostream& yyo = yyoutput;
|
||||||
YYUSE (yyo);
|
YYUSE (yyo);
|
||||||
switch (yytype)
|
]b4_symbol_actions([printer])[
|
||||||
{
|
|
||||||
]b4_symbol_foreach([b4_symbol_printer])dnl
|
|
||||||
[ default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
]b4_parser_class_name[::yy_symbol_print_ (int yytype,
|
]b4_parser_class_name[::yy_symbol_print_ (int yytype,
|
||||||
const semantic_type* yyvaluep,
|
const semantic_type* yyvaluep]b4_locations_if([[,
|
||||||
const location_type* yylocationp)
|
const location_type* yylocationp]])[)
|
||||||
{
|
{
|
||||||
*yycdebug_ << (yytype < YYNTOKENS ? "token" : "nterm")
|
*yycdebug_ << (yytype < YYNTOKENS ? "token" : "nterm")
|
||||||
<< ' ' << yytname[yytype] << " ("
|
<< ' ' << yytname[yytype] << " ("]b4_locations_if([[
|
||||||
<< *yylocationp << ": ";
|
<< *yylocationp << ": "]])[;
|
||||||
yy_symbol_value_print_ (yytype, yyvaluep, yylocationp);
|
yy_symbol_value_print_ (yytype, yyvaluep]b4_locations_if([[, yylocationp]])[);
|
||||||
*yycdebug_ << ')';
|
*yycdebug_ << ')';
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -202,46 +225,35 @@ m4_pushdef([b4_parse_param], m4_defn([b4_parse_param_orig]))dnl
|
|||||||
void
|
void
|
||||||
]b4_parser_class_name[::set_debug_level (debug_level_type l)
|
]b4_parser_class_name[::set_debug_level (debug_level_type l)
|
||||||
{
|
{
|
||||||
|
// Actually, it is yydebug which is really used.
|
||||||
yydebug = l;
|
yydebug = l;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
]m4_popdef([b4_parse_param])dnl
|
]m4_popdef([b4_parse_param])dnl
|
||||||
b4_namespace_close[
|
b4_namespace_close
|
||||||
]])
|
|
||||||
|
|
||||||
|
|
||||||
# Let glr.c believe that the user arguments include the parser itself.
|
|
||||||
m4_ifset([b4_parse_param],
|
|
||||||
[m4_pushdef([b4_parse_param],
|
|
||||||
[[b4_namespace_ref::b4_parser_class_name[& yyparser], [[yyparser]]],]
|
|
||||||
m4_defn([b4_parse_param]))],
|
|
||||||
[m4_pushdef([b4_parse_param],
|
|
||||||
[[b4_namespace_ref::b4_parser_class_name[& yyparser], [[yyparser]]]])
|
|
||||||
])
|
])
|
||||||
m4_include(b4_pkgdatadir/[glr.c])
|
|
||||||
m4_popdef([b4_parse_param])
|
|
||||||
|
|
||||||
m4_divert_push(0)
|
# b4_shared_declarations
|
||||||
@output(b4_spec_defines_file@)@
|
# ----------------------
|
||||||
b4_copyright([Skeleton interface for Bison GLR parsers in C++],
|
# Declaration that might either go into the header (if --defines)
|
||||||
[2002-2012])[
|
# or open coded in the parser body.
|
||||||
|
m4_define([b4_shared_declarations],
|
||||||
/* C++ GLR parser skeleton written by Akim Demaille. */
|
[m4_pushdef([b4_parse_param], m4_defn([b4_parse_param_orig]))dnl
|
||||||
|
b4_percent_code_get([[requires]])[
|
||||||
]b4_cpp_guard_open([b4_spec_defines_file])[
|
|
||||||
|
|
||||||
]b4_percent_code_get([[requires]])[
|
|
||||||
|
|
||||||
#include <stdexcept>
|
#include <stdexcept>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <iostream>
|
#include <iostream>]b4_defines_if([
|
||||||
]b4_percent_define_ifdef([[location_type]], [],
|
b4_bison_locations_if([[#include "location.hh"]])])[
|
||||||
[[#include "location.hh"]])[
|
|
||||||
|
|
||||||
]b4_YYDEBUG_define[
|
]b4_YYDEBUG_define[
|
||||||
|
|
||||||
]b4_namespace_open[
|
]b4_namespace_open[
|
||||||
|
]b4_defines_if([],
|
||||||
|
[b4_bison_locations_if([b4_position_define
|
||||||
|
b4_location_define])])[
|
||||||
|
|
||||||
/// A Bison parser.
|
/// A Bison parser.
|
||||||
class ]b4_parser_class_name[
|
class ]b4_parser_class_name[
|
||||||
{
|
{
|
||||||
@@ -269,29 +281,29 @@ b4_copyright([Skeleton interface for Bison GLR parsers in C++],
|
|||||||
void set_debug_level (debug_level_type l);
|
void set_debug_level (debug_level_type l);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
/// Report a syntax error.
|
/// Report a syntax error.]b4_locations_if([[
|
||||||
/// \param loc where the syntax error is found.
|
/// \param loc where the syntax error is found.]])[
|
||||||
/// \param msg a description of the syntax error.
|
/// \param msg a description of the syntax error.
|
||||||
virtual void error (const location_type& loc, const std::string& msg);
|
virtual void error (]b4_locations_if([[const location_type& loc, ]])[const std::string& msg);
|
||||||
|
|
||||||
# if ]b4_api_PREFIX[DEBUG
|
# if ]b4_api_PREFIX[DEBUG
|
||||||
public:
|
public:
|
||||||
/// \brief Report a symbol value on the debug stream.
|
/// \brief Report a symbol value on the debug stream.
|
||||||
/// \param yytype The token type.
|
/// \param yytype The token type.
|
||||||
/// \param yyvaluep Its semantic value.
|
/// \param yyvaluep Its semantic value.]b4_locations_if([[
|
||||||
/// \param yylocationp Its location.
|
/// \param yylocationp Its location.]])[
|
||||||
virtual void yy_symbol_value_print_ (int yytype,
|
virtual void yy_symbol_value_print_ (int yytype,
|
||||||
const semantic_type* yyvaluep,
|
const semantic_type* yyvaluep]b4_locations_if([[,
|
||||||
const location_type* yylocationp);
|
const location_type* yylocationp]])[);
|
||||||
/// \brief Report a symbol on the debug stream.
|
/// \brief Report a symbol on the debug stream.
|
||||||
/// \param yytype The token type.
|
/// \param yytype The token type.
|
||||||
/// \param yyvaluep Its semantic value.
|
/// \param yyvaluep Its semantic value.]b4_locations_if([[
|
||||||
/// \param yylocationp Its location.
|
/// \param yylocationp Its location.]])[
|
||||||
virtual void yy_symbol_print_ (int yytype,
|
virtual void yy_symbol_print_ (int yytype,
|
||||||
const semantic_type* yyvaluep,
|
const semantic_type* yyvaluep]b4_locations_if([[,
|
||||||
const location_type* yylocationp);
|
const location_type* yylocationp]])[);
|
||||||
private:
|
private:
|
||||||
/* Debugging. */
|
// Debugging.
|
||||||
std::ostream* yycdebug_;
|
std::ostream* yycdebug_;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -311,5 +323,23 @@ b4_percent_define_flag_if([[global_tokens_and_yystype]],
|
|||||||
|
|
||||||
]b4_namespace_close[
|
]b4_namespace_close[
|
||||||
]b4_percent_code_get([[provides]])[
|
]b4_percent_code_get([[provides]])[
|
||||||
|
]m4_popdef([b4_parse_param])dnl
|
||||||
|
])
|
||||||
|
|
||||||
|
b4_defines_if(
|
||||||
|
[b4_output_begin([b4_spec_defines_file])
|
||||||
|
b4_copyright([Skeleton interface for Bison GLR parsers in C++],
|
||||||
|
[2002-2015, 2018])[
|
||||||
|
|
||||||
|
// C++ GLR parser skeleton written by Akim Demaille.
|
||||||
|
|
||||||
|
]b4_cpp_guard_open([b4_spec_defines_file])[
|
||||||
|
]b4_shared_declarations[
|
||||||
]b4_cpp_guard_close([b4_spec_defines_file])[
|
]b4_cpp_guard_close([b4_spec_defines_file])[
|
||||||
]m4_divert_pop(0)
|
]b4_output_end()])
|
||||||
|
|
||||||
|
# Let glr.c (and b4_shared_declarations) believe that the user
|
||||||
|
# arguments include the parser itself.
|
||||||
|
m4_pushdef([b4_parse_param], m4_defn([b4_parse_param_wrap]))
|
||||||
|
m4_include(b4_pkgdatadir/[glr.c])
|
||||||
|
m4_popdef([b4_parse_param])
|
||||||
|
|||||||
+1
-1
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
# Java skeleton dispatching for Bison.
|
# Java skeleton dispatching for Bison.
|
||||||
|
|
||||||
# Copyright (C) 2007, 2009-2012 Free Software Foundation, Inc.
|
# Copyright (C) 2007, 2009-2015, 2018 Free Software Foundation, Inc.
|
||||||
|
|
||||||
# This program is free software: you can redistribute it and/or modify
|
# 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
|
# it under the terms of the GNU General Public License as published by
|
||||||
|
|||||||
+29
-18
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
# Java language support for Bison
|
# Java language support for Bison
|
||||||
|
|
||||||
# Copyright (C) 2007-2012 Free Software Foundation, Inc.
|
# Copyright (C) 2007-2015, 2018 Free Software Foundation, Inc.
|
||||||
|
|
||||||
# This program is free software: you can redistribute it and/or modify
|
# 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
|
# it under the terms of the GNU General Public License as published by
|
||||||
@@ -17,16 +17,11 @@
|
|||||||
# You should have received a copy of the GNU General Public License
|
# You should have received a copy of the GNU General Public License
|
||||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
m4_include(b4_pkgdatadir/[c-like.m4])
|
||||||
# b4_comment(TEXT)
|
|
||||||
# ----------------
|
|
||||||
m4_define([b4_comment], [/* m4_bpatsubst([$1], [
|
|
||||||
], [
|
|
||||||
]) */])
|
|
||||||
|
|
||||||
|
|
||||||
# b4_list2(LIST1, LIST2)
|
# b4_list2(LIST1, LIST2)
|
||||||
# --------------------------
|
# ----------------------
|
||||||
# Join two lists with a comma if necessary.
|
# Join two lists with a comma if necessary.
|
||||||
m4_define([b4_list2],
|
m4_define([b4_list2],
|
||||||
[$1[]m4_ifval(m4_quote($1), [m4_ifval(m4_quote($2), [[, ]])])[]$2])
|
[$1[]m4_ifval(m4_quote($1), [m4_ifval(m4_quote($2), [[, ]])])[]$2])
|
||||||
@@ -108,7 +103,7 @@ m4_define([b4_int_type],
|
|||||||
# b4_int_type_for(NAME)
|
# b4_int_type_for(NAME)
|
||||||
# ---------------------
|
# ---------------------
|
||||||
# Return the smallest int type able to handle numbers ranging from
|
# Return the smallest int type able to handle numbers ranging from
|
||||||
# `NAME_min' to `NAME_max' (included).
|
# 'NAME_min' to 'NAME_max' (included).
|
||||||
m4_define([b4_int_type_for],
|
m4_define([b4_int_type_for],
|
||||||
[b4_int_type($1_min, $1_max)])
|
[b4_int_type($1_min, $1_max)])
|
||||||
|
|
||||||
@@ -174,12 +169,28 @@ m4_define([b4_predicate_case], [ case $1:
|
|||||||
])
|
])
|
||||||
|
|
||||||
|
|
||||||
|
## -------- ##
|
||||||
|
## Checks. ##
|
||||||
|
## -------- ##
|
||||||
|
|
||||||
|
b4_percent_define_check_kind([[api.value.type]], [code], [deprecated])
|
||||||
|
|
||||||
|
b4_percent_define_check_kind([[annotations]], [code], [deprecated])
|
||||||
|
b4_percent_define_check_kind([[extends]], [code], [deprecated])
|
||||||
|
b4_percent_define_check_kind([[implements]], [code], [deprecated])
|
||||||
|
b4_percent_define_check_kind([[init_throws]], [code], [deprecated])
|
||||||
|
b4_percent_define_check_kind([[lex_throws]], [code], [deprecated])
|
||||||
|
b4_percent_define_check_kind([[parser_class_name]], [code], [deprecated])
|
||||||
|
b4_percent_define_check_kind([[throws]], [code], [deprecated])
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
## ---------------- ##
|
## ---------------- ##
|
||||||
## Default values. ##
|
## Default values. ##
|
||||||
## ---------------- ##
|
## ---------------- ##
|
||||||
|
|
||||||
m4_define([b4_yystype], [b4_percent_define_get([[stype]])])
|
m4_define([b4_yystype], [b4_percent_define_get([[api.value.type]])])
|
||||||
b4_percent_define_default([[stype]], [[Object]])
|
b4_percent_define_default([[api.value.type]], [[Object]])
|
||||||
|
|
||||||
# %name-prefix
|
# %name-prefix
|
||||||
m4_define_default([b4_prefix], [[YY]])
|
m4_define_default([b4_prefix], [[YY]])
|
||||||
@@ -196,11 +207,11 @@ m4_define([b4_throws], [b4_percent_define_get([[throws]])])
|
|||||||
b4_percent_define_default([[init_throws]], [])
|
b4_percent_define_default([[init_throws]], [])
|
||||||
m4_define([b4_init_throws], [b4_percent_define_get([[init_throws]])])
|
m4_define([b4_init_throws], [b4_percent_define_get([[init_throws]])])
|
||||||
|
|
||||||
b4_percent_define_default([[location_type]], [Location])
|
b4_percent_define_default([[api.location.type]], [Location])
|
||||||
m4_define([b4_location_type], [b4_percent_define_get([[location_type]])])
|
m4_define([b4_location_type], [b4_percent_define_get([[api.location.type]])])
|
||||||
|
|
||||||
b4_percent_define_default([[position_type]], [Position])
|
b4_percent_define_default([[api.position.type]], [Position])
|
||||||
m4_define([b4_position_type], [b4_percent_define_get([[position_type]])])
|
m4_define([b4_position_type], [b4_percent_define_get([[api.position.type]])])
|
||||||
|
|
||||||
|
|
||||||
## ----------------- ##
|
## ----------------- ##
|
||||||
@@ -260,7 +271,7 @@ m4_define([b4_lex_param_decl],
|
|||||||
[$1])])
|
[$1])])
|
||||||
|
|
||||||
m4_define([b4_param_decls],
|
m4_define([b4_param_decls],
|
||||||
[m4_map_args([b4_param_decl], $@)])
|
[m4_map([b4_param_decl], [$@])])
|
||||||
m4_define([b4_param_decl], [, $1])
|
m4_define([b4_param_decl], [, $1])
|
||||||
|
|
||||||
m4_define([b4_remove_comma], [m4_ifval(m4_quote($1), [$1, ], [])m4_shift2($@)])
|
m4_define([b4_remove_comma], [m4_ifval(m4_quote($1), [$1, ], [])m4_shift2($@)])
|
||||||
@@ -287,7 +298,7 @@ m4_define([b4_lex_param_call],
|
|||||||
b4_param_calls(b4_lex_param))],
|
b4_param_calls(b4_lex_param))],
|
||||||
[$1])])
|
[$1])])
|
||||||
m4_define([b4_param_calls],
|
m4_define([b4_param_calls],
|
||||||
[m4_map_args([b4_param_call], $@)])
|
[m4_map([b4_param_call], [$@])])
|
||||||
m4_define([b4_param_call], [, $2])
|
m4_define([b4_param_call], [, $2])
|
||||||
|
|
||||||
|
|
||||||
@@ -300,7 +311,7 @@ m4_define([b4_parse_param_cons],
|
|||||||
[b4_constructor_calls(b4_parse_param)])])
|
[b4_constructor_calls(b4_parse_param)])])
|
||||||
|
|
||||||
m4_define([b4_constructor_calls],
|
m4_define([b4_constructor_calls],
|
||||||
[m4_map_args([b4_constructor_call], $@)])
|
[m4_map([b4_constructor_call], [$@])])
|
||||||
m4_define([b4_constructor_call],
|
m4_define([b4_constructor_call],
|
||||||
[this.$2 = $2;
|
[this.$2 = $2;
|
||||||
])
|
])
|
||||||
|
|||||||
+413
-337
File diff suppressed because it is too large
Load Diff
+282
-95
@@ -1,6 +1,6 @@
|
|||||||
# Java skeleton for Bison -*- autoconf -*-
|
# Java skeleton for Bison -*- autoconf -*-
|
||||||
|
|
||||||
# Copyright (C) 2007-2012 Free Software Foundation, Inc.
|
# Copyright (C) 2007-2015, 2018 Free Software Foundation, Inc.
|
||||||
|
|
||||||
# This program is free software: you can redistribute it and/or modify
|
# 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
|
# it under the terms of the GNU General Public License as published by
|
||||||
@@ -20,7 +20,8 @@ m4_include(b4_pkgdatadir/[java.m4])
|
|||||||
b4_defines_if([b4_fatal([%s: %%defines does not make sense in Java],
|
b4_defines_if([b4_fatal([%s: %%defines does not make sense in Java],
|
||||||
[b4_skeleton])])
|
[b4_skeleton])])
|
||||||
|
|
||||||
# We don't depend on %debug in Java, but pacify warnings about non-used flags.
|
# We do not depend on %debug in Java, but pacify warnings about
|
||||||
|
# non-used flags.
|
||||||
b4_parse_trace_if([0], [0])
|
b4_parse_trace_if([0], [0])
|
||||||
|
|
||||||
m4_define([b4_symbol_no_destructor_assert],
|
m4_define([b4_symbol_no_destructor_assert],
|
||||||
@@ -30,10 +31,60 @@ m4_define([b4_symbol_no_destructor_assert],
|
|||||||
[b4_symbol_action_location([$1], [destructor])])])])
|
[b4_symbol_action_location([$1], [destructor])])])])
|
||||||
b4_symbol_foreach([b4_symbol_no_destructor_assert])
|
b4_symbol_foreach([b4_symbol_no_destructor_assert])
|
||||||
|
|
||||||
m4_divert_push(0)dnl
|
# Setup some macros for api.push-pull.
|
||||||
@output(b4_parser_file_name@)@
|
b4_percent_define_default([[api.push-pull]], [[pull]])
|
||||||
|
b4_percent_define_check_values([[[[api.push-pull]],
|
||||||
|
[[pull]], [[push]], [[both]]]])
|
||||||
|
|
||||||
|
# Define m4 conditional macros that encode the value
|
||||||
|
# of the api.push-pull flag.
|
||||||
|
b4_define_flag_if([pull]) m4_define([b4_pull_flag], [[1]])
|
||||||
|
b4_define_flag_if([push]) m4_define([b4_push_flag], [[1]])
|
||||||
|
m4_case(b4_percent_define_get([[api.push-pull]]),
|
||||||
|
[pull], [m4_define([b4_push_flag], [[0]])],
|
||||||
|
[push], [m4_define([b4_pull_flag], [[0]])])
|
||||||
|
|
||||||
|
# Define a macro to be true when api.push-pull has the value "both".
|
||||||
|
m4_define([b4_both_if],[b4_push_if([b4_pull_if([$1],[$2])],[$2])])
|
||||||
|
|
||||||
|
# Handle BISON_USE_PUSH_FOR_PULL for the test suite. So that push parsing
|
||||||
|
# tests function as written, do not let BISON_USE_PUSH_FOR_PULL modify the
|
||||||
|
# behavior of Bison at all when push parsing is already requested.
|
||||||
|
b4_define_flag_if([use_push_for_pull])
|
||||||
|
b4_use_push_for_pull_if([
|
||||||
|
b4_push_if([m4_define([b4_use_push_for_pull_flag], [[0]])],
|
||||||
|
[m4_define([b4_push_flag], [[1]])])])
|
||||||
|
|
||||||
|
# Define a macro to encapsulate the parse state variables.
|
||||||
|
# This allows them to be defined either in parse() when doing
|
||||||
|
# pull parsing, or as class instance variable when doing push parsing.
|
||||||
|
m4_define([b4_define_state],[[
|
||||||
|
/* Lookahead and lookahead in internal form. */
|
||||||
|
int yychar = yyempty_;
|
||||||
|
int yytoken = 0;
|
||||||
|
|
||||||
|
/* State. */
|
||||||
|
int yyn = 0;
|
||||||
|
int yylen = 0;
|
||||||
|
int yystate = 0;
|
||||||
|
YYStack yystack = new YYStack ();
|
||||||
|
int label = YYNEWSTATE;
|
||||||
|
|
||||||
|
/* Error handling. */
|
||||||
|
int yynerrs_ = 0;
|
||||||
|
]b4_locations_if([/* The location where the error started. */
|
||||||
|
b4_location_type yyerrloc = null;
|
||||||
|
|
||||||
|
/* Location. */
|
||||||
|
b4_location_type yylloc = new b4_location_type (null, null);])[
|
||||||
|
|
||||||
|
/* Semantic value of the lookahead. */
|
||||||
|
]b4_yystype[ yylval = null;
|
||||||
|
]])
|
||||||
|
|
||||||
|
b4_output_begin([b4_parser_file_name])
|
||||||
b4_copyright([Skeleton implementation for Bison LALR(1) parsers in Java],
|
b4_copyright([Skeleton implementation for Bison LALR(1) parsers in Java],
|
||||||
[2007-2012])
|
[2007-2015, 2018])
|
||||||
|
|
||||||
b4_percent_define_ifdef([package], [package b4_percent_define_get([package]);
|
b4_percent_define_ifdef([package], [package b4_percent_define_get([package]);
|
||||||
])[/* First part of user declarations. */
|
])[/* First part of user declarations. */
|
||||||
@@ -56,7 +107,9 @@ b4_percent_define_get3([implements], [ implements ])[
|
|||||||
{
|
{
|
||||||
]b4_identification[
|
]b4_identification[
|
||||||
]b4_error_verbose_if([[
|
]b4_error_verbose_if([[
|
||||||
/** True if verbose error messages are enabled. */
|
/**
|
||||||
|
* True if verbose error messages are enabled.
|
||||||
|
*/
|
||||||
private boolean yyErrorVerbose = true;
|
private boolean yyErrorVerbose = true;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -77,18 +130,24 @@ b4_locations_if([[
|
|||||||
* A class defining a pair of positions. Positions, defined by the
|
* A class defining a pair of positions. Positions, defined by the
|
||||||
* <code>]b4_position_type[</code> class, denote a point in the input.
|
* <code>]b4_position_type[</code> class, denote a point in the input.
|
||||||
* Locations represent a part of the input through the beginning
|
* Locations represent a part of the input through the beginning
|
||||||
* and ending positions. */
|
* and ending positions.
|
||||||
|
*/
|
||||||
public class ]b4_location_type[ {
|
public class ]b4_location_type[ {
|
||||||
/** The first, inclusive, position in the range. */
|
/**
|
||||||
|
* The first, inclusive, position in the range.
|
||||||
|
*/
|
||||||
public ]b4_position_type[ begin;
|
public ]b4_position_type[ begin;
|
||||||
|
|
||||||
/** The first position beyond the range. */
|
/**
|
||||||
|
* The first position beyond the range.
|
||||||
|
*/
|
||||||
public ]b4_position_type[ end;
|
public ]b4_position_type[ end;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a <code>]b4_location_type[</code> denoting an empty range located at
|
* Create a <code>]b4_location_type[</code> denoting an empty range located at
|
||||||
* a given point.
|
* a given point.
|
||||||
* @@param loc The position at which the range is anchored. */
|
* @@param loc The position at which the range is anchored.
|
||||||
|
*/
|
||||||
public ]b4_location_type[ (]b4_position_type[ loc) {
|
public ]b4_location_type[ (]b4_position_type[ loc) {
|
||||||
this.begin = this.end = loc;
|
this.begin = this.end = loc;
|
||||||
}
|
}
|
||||||
@@ -96,7 +155,8 @@ b4_locations_if([[
|
|||||||
/**
|
/**
|
||||||
* Create a <code>]b4_location_type[</code> from the endpoints of the range.
|
* Create a <code>]b4_location_type[</code> from the endpoints of the range.
|
||||||
* @@param begin The first position included in the range.
|
* @@param begin The first position included in the range.
|
||||||
* @@param end The first position beyond the range. */
|
* @@param end The first position beyond the range.
|
||||||
|
*/
|
||||||
public ]b4_location_type[ (]b4_position_type[ begin, ]b4_position_type[ end) {
|
public ]b4_location_type[ (]b4_position_type[ begin, ]b4_position_type[ end) {
|
||||||
this.begin = begin;
|
this.begin = begin;
|
||||||
this.end = end;
|
this.end = end;
|
||||||
@@ -105,7 +165,8 @@ b4_locations_if([[
|
|||||||
/**
|
/**
|
||||||
* Print a representation of the location. For this to be correct,
|
* Print a representation of the location. For this to be correct,
|
||||||
* <code>]b4_position_type[</code> should override the <code>equals</code>
|
* <code>]b4_position_type[</code> should override the <code>equals</code>
|
||||||
* method. */
|
* method.
|
||||||
|
*/
|
||||||
public String toString () {
|
public String toString () {
|
||||||
if (begin.equals (end))
|
if (begin.equals (end))
|
||||||
return begin.toString ();
|
return begin.toString ();
|
||||||
@@ -137,24 +198,28 @@ b4_locations_if([[
|
|||||||
|
|
||||||
]b4_locations_if([[/**
|
]b4_locations_if([[/**
|
||||||
* Method to retrieve the beginning position of the last scanned token.
|
* Method to retrieve the beginning position of the last scanned token.
|
||||||
* @@return the position at which the last scanned token starts. */
|
* @@return the position at which the last scanned token starts.
|
||||||
|
*/
|
||||||
]b4_position_type[ getStartPos ();
|
]b4_position_type[ getStartPos ();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Method to retrieve the ending position of the last scanned token.
|
* Method to retrieve the ending position of the last scanned token.
|
||||||
* @@return the first position beyond the last scanned token. */
|
* @@return the first position beyond the last scanned token.
|
||||||
|
*/
|
||||||
]b4_position_type[ getEndPos ();]])[
|
]b4_position_type[ getEndPos ();]])[
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Method to retrieve the semantic value of the last scanned token.
|
* Method to retrieve the semantic value of the last scanned token.
|
||||||
* @@return the semantic value of the last scanned token. */
|
* @@return the semantic value of the last scanned token.
|
||||||
|
*/
|
||||||
]b4_yystype[ getLVal ();
|
]b4_yystype[ getLVal ();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Entry point for the scanner. Returns the token identifier corresponding
|
* Entry point for the scanner. Returns the token identifier corresponding
|
||||||
* to the next token and prepares to return the semantic value
|
* to the next token and prepares to return the semantic value
|
||||||
* ]b4_locations_if([and beginning/ending positions ])[of the token.
|
* ]b4_locations_if([and beginning/ending positions ])[of the token.
|
||||||
* @@return the token identifier corresponding to the next token. */
|
* @@return the token identifier corresponding to the next token.
|
||||||
|
*/
|
||||||
int yylex () ]b4_maybe_throws([b4_lex_throws])[;
|
int yylex () ]b4_maybe_throws([b4_lex_throws])[;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -163,7 +228,8 @@ b4_locations_if([[
|
|||||||
*
|
*
|
||||||
* ]b4_locations_if([[@@param loc The location of the element to which the
|
* ]b4_locations_if([[@@param loc The location of the element to which the
|
||||||
* error message is related]])[
|
* error message is related]])[
|
||||||
* @@param msg The string for the error message. */
|
* @@param msg The string for the error message.
|
||||||
|
*/
|
||||||
void yyerror (]b4_locations_if([b4_location_type[ loc, ]])[String msg);]
|
void yyerror (]b4_locations_if([b4_location_type[ loc, ]])[String msg);]
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -171,7 +237,9 @@ b4_locations_if([[
|
|||||||
]b4_percent_code_get([[lexer]])[
|
]b4_percent_code_get([[lexer]])[
|
||||||
}
|
}
|
||||||
|
|
||||||
]])[/** The object doing lexical analysis for us. */
|
]])[/**
|
||||||
|
* The object doing lexical analysis for us.
|
||||||
|
*/
|
||||||
private Lexer yylexer;
|
private Lexer yylexer;
|
||||||
]
|
]
|
||||||
b4_parse_param_vars
|
b4_parse_param_vars
|
||||||
@@ -337,46 +405,74 @@ b4_lexer_if([[
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Returned by a Bison action in order to stop the parsing process and
|
* Returned by a Bison action in order to stop the parsing process and
|
||||||
* return success (<tt>true</tt>). */
|
* return success (<tt>true</tt>).
|
||||||
|
*/
|
||||||
public static final int YYACCEPT = 0;
|
public static final int YYACCEPT = 0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returned by a Bison action in order to stop the parsing process and
|
* Returned by a Bison action in order to stop the parsing process and
|
||||||
* return failure (<tt>false</tt>). */
|
* return failure (<tt>false</tt>).
|
||||||
|
*/
|
||||||
public static final int YYABORT = 1;
|
public static final int YYABORT = 1;
|
||||||
|
|
||||||
|
]b4_push_if([
|
||||||
|
/**
|
||||||
|
* Returned by a Bison action in order to request a new token.
|
||||||
|
*/
|
||||||
|
public static final int YYPUSH_MORE = 4;])[
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returned by a Bison action in order to start error recovery without
|
* Returned by a Bison action in order to start error recovery without
|
||||||
* printing an error message. */
|
* printing an error message.
|
||||||
|
*/
|
||||||
public static final int YYERROR = 2;
|
public static final int YYERROR = 2;
|
||||||
|
|
||||||
// Internal return codes that are not supported for user semantic
|
/**
|
||||||
// actions.
|
* Internal return codes that are not supported for user semantic
|
||||||
|
* actions.
|
||||||
|
*/
|
||||||
private static final int YYERRLAB = 3;
|
private static final int YYERRLAB = 3;
|
||||||
private static final int YYNEWSTATE = 4;
|
private static final int YYNEWSTATE = 4;
|
||||||
private static final int YYDEFAULT = 5;
|
private static final int YYDEFAULT = 5;
|
||||||
private static final int YYREDUCE = 6;
|
private static final int YYREDUCE = 6;
|
||||||
private static final int YYERRLAB1 = 7;
|
private static final int YYERRLAB1 = 7;
|
||||||
private static final int YYRETURN = 8;
|
private static final int YYRETURN = 8;
|
||||||
|
]b4_push_if([[ private static final int YYGETTOKEN = 9; /* Signify that a new token is expected when doing push-parsing. */]])[
|
||||||
|
|
||||||
private int yyerrstatus_ = 0;
|
private int yyerrstatus_ = 0;
|
||||||
|
|
||||||
|
]b4_push_if([dnl
|
||||||
|
b4_define_state])[
|
||||||
/**
|
/**
|
||||||
* Return whether error recovery is being done. In this state, the parser
|
* Return whether error recovery is being done. In this state, the parser
|
||||||
* reads token until it reaches a known state, and then restarts normal
|
* reads token until it reaches a known state, and then restarts normal
|
||||||
* operation. */
|
* operation.
|
||||||
|
*/
|
||||||
public final boolean recovering ()
|
public final boolean recovering ()
|
||||||
{
|
{
|
||||||
return yyerrstatus_ == 0;
|
return yyerrstatus_ == 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** Compute post-reduction state.
|
||||||
|
* @@param yystate the current state
|
||||||
|
* @@param yysym the nonterminal to push on the stack
|
||||||
|
*/
|
||||||
|
private int yy_lr_goto_state_ (int yystate, int yysym)
|
||||||
|
{
|
||||||
|
int yyr = yypgoto_[yysym - yyntokens_] + yystate;
|
||||||
|
if (0 <= yyr && yyr <= yylast_ && yycheck_[yyr] == yystate)
|
||||||
|
return yytable_[yyr];
|
||||||
|
else
|
||||||
|
return yydefgoto_[yysym - yyntokens_];
|
||||||
|
}
|
||||||
|
|
||||||
private int yyaction (int yyn, YYStack yystack, int yylen) ]b4_maybe_throws([b4_throws])[
|
private int yyaction (int yyn, YYStack yystack, int yylen) ]b4_maybe_throws([b4_throws])[
|
||||||
{
|
{
|
||||||
]b4_yystype[ yyval;
|
]b4_yystype[ yyval;
|
||||||
]b4_locations_if([b4_location_type[ yyloc = yylloc (yystack, yylen);]])[
|
]b4_locations_if([b4_location_type[ yyloc = yylloc (yystack, yylen);]])[
|
||||||
|
|
||||||
/* If YYLEN is nonzero, implement the default value of the action:
|
/* If YYLEN is nonzero, implement the default value of the action:
|
||||||
`$$ = $1'. Otherwise, use the top of the stack.
|
'$$ = $1'. Otherwise, use the top of the stack.
|
||||||
|
|
||||||
Otherwise, the following line sets YYVAL to garbage.
|
Otherwise, the following line sets YYVAL to garbage.
|
||||||
This behavior is undocumented and Bison
|
This behavior is undocumented and Bison
|
||||||
@@ -400,14 +496,7 @@ b4_lexer_if([[
|
|||||||
yylen = 0;
|
yylen = 0;
|
||||||
|
|
||||||
/* Shift the result of the reduction. */
|
/* Shift the result of the reduction. */
|
||||||
yyn = yyr1_[yyn];
|
int yystate = yy_lr_goto_state_ (yystack.stateAt (0), yyr1_[yyn]);
|
||||||
int yystate = yypgoto_[yyn - yyntokens_] + yystack.stateAt (0);
|
|
||||||
if (0 <= yystate && yystate <= yylast_
|
|
||||||
&& yycheck_[yystate] == yystack.stateAt (0))
|
|
||||||
yystate = yytable_[yystate];
|
|
||||||
else
|
|
||||||
yystate = yydefgoto_[yyn - yyntokens_];
|
|
||||||
|
|
||||||
yystack.push (yystate, yyval]b4_locations_if([, yyloc])[);
|
yystack.push (yystate, yyval]b4_locations_if([, yyloc])[);
|
||||||
return YYNEWSTATE;
|
return YYNEWSTATE;
|
||||||
}
|
}
|
||||||
@@ -464,6 +553,7 @@ b4_lexer_if([[
|
|||||||
+ (yyvaluep == null ? "(null)" : yyvaluep.toString ()) + ")");
|
+ (yyvaluep == null ? "(null)" : yyvaluep.toString ()) + ")");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
]b4_push_if([],[[
|
||||||
/**
|
/**
|
||||||
* Parse input from the scanner that was specified at object construction
|
* Parse input from the scanner that was specified at object construction
|
||||||
* time. Return whether the end of the input was reached successfully.
|
* time. Return whether the end of the input was reached successfully.
|
||||||
@@ -471,48 +561,53 @@ b4_lexer_if([[
|
|||||||
* @@return <tt>true</tt> if the parsing succeeds. Note that this does not
|
* @@return <tt>true</tt> if the parsing succeeds. Note that this does not
|
||||||
* imply that there were no syntax errors.
|
* imply that there were no syntax errors.
|
||||||
*/
|
*/
|
||||||
public boolean parse () ]b4_maybe_throws([b4_list2([b4_lex_throws], [b4_throws])])[
|
public boolean parse () ]b4_maybe_throws([b4_list2([b4_lex_throws], [b4_throws])])[]])[
|
||||||
|
]b4_push_if([
|
||||||
|
/**
|
||||||
|
* Push Parse input from external lexer
|
||||||
|
*
|
||||||
|
* @@param yylextoken current token
|
||||||
|
* @@param yylexval current lval
|
||||||
|
]b4_locations_if([ * @@param yylexloc current position])[
|
||||||
|
*
|
||||||
|
* @@return <tt>YYACCEPT, YYABORT, YYPUSH_MORE</tt>
|
||||||
|
*/
|
||||||
|
public int push_parse (int yylextoken, b4_yystype yylexval[]b4_locations_if([, b4_location_type yylexloc]))
|
||||||
|
b4_maybe_throws([b4_list2([b4_lex_throws], [b4_throws])])])[
|
||||||
{
|
{
|
||||||
/// Lookahead and lookahead in internal form.
|
]b4_locations_if([/* @@$. */
|
||||||
int yychar = yyempty_;
|
b4_location_type yyloc;])[
|
||||||
int yytoken = 0;
|
]b4_push_if([],[[
|
||||||
|
]b4_define_state[
|
||||||
/* State. */
|
|
||||||
int yyn = 0;
|
|
||||||
int yylen = 0;
|
|
||||||
int yystate = 0;
|
|
||||||
|
|
||||||
YYStack yystack = new YYStack ();
|
|
||||||
|
|
||||||
/* Error handling. */
|
|
||||||
int yynerrs_ = 0;
|
|
||||||
]b4_locations_if([/// The location where the error started.
|
|
||||||
]b4_location_type[ yyerrloc = null;
|
|
||||||
|
|
||||||
/// ]b4_location_type[ of the lookahead.
|
|
||||||
]b4_location_type[ yylloc = new ]b4_location_type[ (null, null);
|
|
||||||
|
|
||||||
/// @@$.
|
|
||||||
]b4_location_type[ yyloc;])
|
|
||||||
|
|
||||||
/// Semantic value of the lookahead.
|
|
||||||
b4_yystype[ yylval = null;
|
|
||||||
|
|
||||||
yycdebug ("Starting parse\n");
|
yycdebug ("Starting parse\n");
|
||||||
yyerrstatus_ = 0;
|
yyerrstatus_ = 0;
|
||||||
|
|
||||||
|
/* Initialize the stack. */
|
||||||
|
yystack.push (yystate, yylval ]b4_locations_if([, yylloc])[);
|
||||||
]m4_ifdef([b4_initial_action], [
|
]m4_ifdef([b4_initial_action], [
|
||||||
m4_pushdef([b4_at_dollar], [yylloc])dnl
|
b4_dollar_pushdef([yylval], [], [yylloc])dnl
|
||||||
m4_pushdef([b4_dollar_dollar], [yylval])dnl
|
|
||||||
/* User initialization code. */
|
/* User initialization code. */
|
||||||
b4_user_initial_action
|
b4_user_initial_action
|
||||||
m4_popdef([b4_dollar_dollar])dnl
|
b4_dollar_popdef[]dnl
|
||||||
m4_popdef([b4_at_dollar])])dnl
|
])[
|
||||||
|
]])[
|
||||||
|
]b4_push_if([[
|
||||||
|
if (!this.push_parse_initialized)
|
||||||
|
{
|
||||||
|
push_parse_initialize ();
|
||||||
|
]m4_ifdef([b4_initial_action], [
|
||||||
|
b4_dollar_pushdef([yylval], [], [yylloc])dnl
|
||||||
|
/* User initialization code. */
|
||||||
|
b4_user_initial_action
|
||||||
|
b4_dollar_popdef[]dnl
|
||||||
|
])[
|
||||||
|
yycdebug ("Starting parse\n");
|
||||||
|
yyerrstatus_ = 0;
|
||||||
|
} else
|
||||||
|
label = YYGETTOKEN;
|
||||||
|
|
||||||
[ /* Initialize the stack. */
|
boolean push_token_consumed = true;
|
||||||
yystack.push (yystate, yylval]b4_locations_if([, yylloc])[);
|
]])[
|
||||||
|
|
||||||
int label = YYNEWSTATE;
|
|
||||||
for (;;)
|
for (;;)
|
||||||
switch (label)
|
switch (label)
|
||||||
{
|
{
|
||||||
@@ -525,7 +620,8 @@ m4_popdef([b4_at_dollar])])dnl
|
|||||||
|
|
||||||
/* Accept? */
|
/* Accept? */
|
||||||
if (yystate == yyfinal_)
|
if (yystate == yyfinal_)
|
||||||
return true;
|
]b4_push_if([{label = YYACCEPT; break;}],
|
||||||
|
[return true;])[
|
||||||
|
|
||||||
/* Take a decision. First try without lookahead. */
|
/* Take a decision. First try without lookahead. */
|
||||||
yyn = yypact_[yystate];
|
yyn = yypact_[yystate];
|
||||||
@@ -534,16 +630,27 @@ m4_popdef([b4_at_dollar])])dnl
|
|||||||
label = YYDEFAULT;
|
label = YYDEFAULT;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
]b4_push_if([ /* Fall Through */
|
||||||
|
|
||||||
|
case YYGETTOKEN:])[
|
||||||
/* Read a lookahead token. */
|
/* Read a lookahead token. */
|
||||||
if (yychar == yyempty_)
|
if (yychar == yyempty_)
|
||||||
{
|
{
|
||||||
|
]b4_push_if([[
|
||||||
|
if (!push_token_consumed)
|
||||||
|
return YYPUSH_MORE;
|
||||||
yycdebug ("Reading a token: ");
|
yycdebug ("Reading a token: ");
|
||||||
yychar = yylexer.yylex ();]
|
yychar = yylextoken;
|
||||||
b4_locations_if([[
|
yylval = yylexval;]b4_locations_if([
|
||||||
yylloc = new ]b4_location_type[(yylexer.getStartPos (),
|
yylloc = yylexloc;])[
|
||||||
yylexer.getEndPos ());]])
|
push_token_consumed = false;]])[
|
||||||
yylval = yylexer.getLVal ();[
|
]b4_push_if([],[[
|
||||||
|
yycdebug ("Reading a token: ");
|
||||||
|
yychar = yylexer.yylex ();
|
||||||
|
yylval = yylexer.getLVal ();]b4_locations_if([
|
||||||
|
yylloc = new b4_location_type (yylexer.getStartPos (),
|
||||||
|
yylexer.getEndPos ());])[
|
||||||
|
]])[
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Convert token to internal form. */
|
/* Convert token to internal form. */
|
||||||
@@ -640,10 +747,10 @@ m4_popdef([b4_at_dollar])])dnl
|
|||||||
{
|
{
|
||||||
/* Return failure if at end of input. */
|
/* Return failure if at end of input. */
|
||||||
if (yychar == Lexer.EOF)
|
if (yychar == Lexer.EOF)
|
||||||
return false;
|
]b4_push_if([{label = YYABORT; break;}],[return false;])[
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
yychar = yyempty_;
|
yychar = yyempty_;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Else will try to reuse lookahead token after shifting the error
|
/* Else will try to reuse lookahead token after shifting the error
|
||||||
@@ -651,9 +758,9 @@ m4_popdef([b4_at_dollar])])dnl
|
|||||||
label = YYERRLAB1;
|
label = YYERRLAB1;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
/*---------------------------------------------------.
|
/*-------------------------------------------------.
|
||||||
| errorlab -- error raised explicitly by YYERROR. |
|
| errorlab -- error raised explicitly by YYERROR. |
|
||||||
`---------------------------------------------------*/
|
`-------------------------------------------------*/
|
||||||
case YYERROR:
|
case YYERROR:
|
||||||
|
|
||||||
]b4_locations_if([yyerrloc = yystack.locationAt (yylen - 1);])[
|
]b4_locations_if([yyerrloc = yystack.locationAt (yylen - 1);])[
|
||||||
@@ -685,9 +792,10 @@ m4_popdef([b4_at_dollar])])dnl
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Pop the current state because it cannot handle the error token. */
|
/* Pop the current state because it cannot handle the
|
||||||
|
* error token. */
|
||||||
if (yystack.height == 0)
|
if (yystack.height == 0)
|
||||||
return false;
|
]b4_push_if([{label = YYABORT; break;}],[return false;])[
|
||||||
|
|
||||||
]b4_locations_if([yyerrloc = yystack.locationAt (0);])[
|
]b4_locations_if([yyerrloc = yystack.locationAt (0);])[
|
||||||
yystack.pop ();
|
yystack.pop ();
|
||||||
@@ -696,7 +804,11 @@ m4_popdef([b4_at_dollar])])dnl
|
|||||||
yystack.print (yyDebugStream);
|
yystack.print (yyDebugStream);
|
||||||
}
|
}
|
||||||
|
|
||||||
]b4_locations_if([
|
if (label == YYABORT)
|
||||||
|
/* Leave the switch. */
|
||||||
|
break;
|
||||||
|
|
||||||
|
]b4_locations_if([
|
||||||
/* Muck with the stack to setup for yylloc. */
|
/* Muck with the stack to setup for yylloc. */
|
||||||
yystack.push (0, null, yylloc);
|
yystack.push (0, null, yylloc);
|
||||||
yystack.push (0, null, yyerrloc);
|
yystack.push (0, null, yyerrloc);
|
||||||
@@ -714,13 +826,91 @@ m4_popdef([b4_at_dollar])])dnl
|
|||||||
|
|
||||||
/* Accept. */
|
/* Accept. */
|
||||||
case YYACCEPT:
|
case YYACCEPT:
|
||||||
return true;
|
]b4_push_if([this.push_parse_initialized = false; return YYACCEPT;],
|
||||||
|
[return true;])[
|
||||||
|
|
||||||
/* Abort. */
|
/* Abort. */
|
||||||
case YYABORT:
|
case YYABORT:
|
||||||
return false;
|
]b4_push_if([this.push_parse_initialized = false; return YYABORT;],
|
||||||
|
[return false;])[
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
]b4_push_if([[
|
||||||
|
boolean push_parse_initialized = false;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* (Re-)Initialize the state of the push parser.
|
||||||
|
*/
|
||||||
|
public void push_parse_initialize()
|
||||||
|
{
|
||||||
|
/* Lookahead and lookahead in internal form. */
|
||||||
|
this.yychar = yyempty_;
|
||||||
|
this.yytoken = 0;
|
||||||
|
|
||||||
|
/* State. */
|
||||||
|
this.yyn = 0;
|
||||||
|
this.yylen = 0;
|
||||||
|
this.yystate = 0;
|
||||||
|
this.yystack = new YYStack ();
|
||||||
|
this.label = YYNEWSTATE;
|
||||||
|
|
||||||
|
/* Error handling. */
|
||||||
|
this.yynerrs_ = 0;
|
||||||
|
]b4_locations_if([/* The location where the error started. */
|
||||||
|
this.yyerrloc = null;
|
||||||
|
this.yylloc = new b4_location_type (null, null);])[
|
||||||
|
|
||||||
|
/* Semantic value of the lookahead. */
|
||||||
|
this.yylval = null;
|
||||||
|
|
||||||
|
yystack.push (this.yystate, this.yylval]b4_locations_if([, this.yylloc])[);
|
||||||
|
|
||||||
|
this.push_parse_initialized = true;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
]b4_locations_if([
|
||||||
|
/**
|
||||||
|
* Push parse given input from an external lexer.
|
||||||
|
*
|
||||||
|
* @@param yylextoken current token
|
||||||
|
* @@param yylexval current lval
|
||||||
|
* @@param yyylexpos current position
|
||||||
|
*
|
||||||
|
* @@return <tt>YYACCEPT, YYABORT, YYPUSH_MORE</tt>
|
||||||
|
*/
|
||||||
|
public int push_parse (int yylextoken, b4_yystype yylexval, b4_position_type yylexpos)
|
||||||
|
b4_maybe_throws([b4_list2([b4_lex_throws], [b4_throws])])
|
||||||
|
{
|
||||||
|
return push_parse (yylextoken, yylexval, new b4_location_type (yylexpos));
|
||||||
|
}
|
||||||
|
])[]])
|
||||||
|
|
||||||
|
b4_both_if([[
|
||||||
|
/**
|
||||||
|
* Parse input from the scanner that was specified at object construction
|
||||||
|
* time. Return whether the end of the input was reached successfully.
|
||||||
|
* This version of parse () is defined only when api.push-push=both.
|
||||||
|
*
|
||||||
|
* @@return <tt>true</tt> if the parsing succeeds. Note that this does not
|
||||||
|
* imply that there were no syntax errors.
|
||||||
|
*/
|
||||||
|
public boolean parse () ]b4_maybe_throws([b4_list2([b4_lex_throws], [b4_throws])])[
|
||||||
|
{
|
||||||
|
if (yylexer == null)
|
||||||
|
throw new NullPointerException("Null Lexer");
|
||||||
|
int status;
|
||||||
|
do {
|
||||||
|
int token = yylexer.yylex();
|
||||||
|
]b4_yystype[ lval = yylexer.getLVal();
|
||||||
|
]b4_locations_if([dnl
|
||||||
|
b4_location_type yyloc = new b4_location_type (yylexer.getStartPos (),
|
||||||
|
yylexer.getEndPos ());])[
|
||||||
|
]b4_locations_if([status = push_parse(token,lval,yyloc);],[
|
||||||
|
status = push_parse(token,lval);])[
|
||||||
|
} while (status == YYPUSH_MORE);
|
||||||
|
return (status == YYACCEPT);
|
||||||
|
}
|
||||||
|
]])[
|
||||||
|
|
||||||
// Generate an error message.
|
// Generate an error message.
|
||||||
private String yysyntax_error (int yystate, int tok)
|
private String yysyntax_error (int yystate, int tok)
|
||||||
@@ -728,11 +918,6 @@ m4_popdef([b4_at_dollar])])dnl
|
|||||||
if (yyErrorVerbose)
|
if (yyErrorVerbose)
|
||||||
{
|
{
|
||||||
/* There are many possibilities here to consider:
|
/* There are many possibilities here to consider:
|
||||||
- Assume YYFAIL is not used. It's too flawed to consider.
|
|
||||||
See
|
|
||||||
<http://lists.gnu.org/archive/html/bison-patches/2009-12/msg00024.html>
|
|
||||||
for details. YYERROR is fine as it does not invoke this
|
|
||||||
function.
|
|
||||||
- If this state is a consistent state with a default action,
|
- If this state is a consistent state with a default action,
|
||||||
then the only way this function was invoked is if the
|
then the only way this function was invoked is if the
|
||||||
default action is an error action. In that case, don't
|
default action is an error action. In that case, don't
|
||||||
@@ -760,8 +945,8 @@ m4_popdef([b4_at_dollar])])dnl
|
|||||||
*/
|
*/
|
||||||
if (tok != yyempty_)
|
if (tok != yyempty_)
|
||||||
{
|
{
|
||||||
// FIXME: This method of building the message is not compatible
|
/* FIXME: This method of building the message is not compatible
|
||||||
// with internationalization.
|
with internationalization. */
|
||||||
StringBuffer res =
|
StringBuffer res =
|
||||||
new StringBuffer ("syntax error, unexpected ");
|
new StringBuffer ("syntax error, unexpected ");
|
||||||
res.append (yytnamerr_ (yytname_[tok]));
|
res.append (yytnamerr_ (yytname_[tok]));
|
||||||
@@ -810,8 +995,9 @@ m4_popdef([b4_at_dollar])])dnl
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Whether the given <code>yytable_</code> value indicates a syntax error.
|
* Whether the given <code>yytable_</code>
|
||||||
* @@param yyvalue the value to check
|
* value indicates a syntax error.
|
||||||
|
* @@param yyvalue the value to check
|
||||||
*/
|
*/
|
||||||
private static boolean yy_table_value_is_error_ (int yyvalue)
|
private static boolean yy_table_value_is_error_ (int yyvalue)
|
||||||
{
|
{
|
||||||
@@ -823,15 +1009,16 @@ m4_popdef([b4_at_dollar])])dnl
|
|||||||
|
|
||||||
]b4_parser_tables_define[
|
]b4_parser_tables_define[
|
||||||
]b4_integral_parser_table_define([token_number], [b4_toknum],
|
]b4_integral_parser_table_define([token_number], [b4_toknum],
|
||||||
[TOKEN_NUMBER_[YYLEX-NUM] -- Internal symbol number corresponding
|
[[YYTOKEN_NUMBER[YYLEX-NUM] -- Internal symbol number corresponding
|
||||||
to YYLEX-NUM.])[
|
to YYLEX-NUM.]])[
|
||||||
|
|
||||||
/* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
|
/* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
|
||||||
First, the terminals, then, starting at \a yyntokens_, nonterminals. */
|
First, the terminals, then, starting at \a yyntokens_, nonterminals. */
|
||||||
]b4_typed_parser_table_define([String], [tname], [b4_tname])[
|
]b4_typed_parser_table_define([String], [tname], [b4_tname])[
|
||||||
|
|
||||||
]b4_integral_parser_table_define([rline], [b4_rline],
|
]b4_integral_parser_table_define([rline], [b4_rline],
|
||||||
[YYRLINE[YYN] -- Source line where rule number YYN was defined.])[
|
[[YYRLINE[YYN] -- Source line where rule number YYN was defined.]])[
|
||||||
|
|
||||||
|
|
||||||
// Report on the debug stream that the rule yyrule is going to be reduced.
|
// Report on the debug stream that the rule yyrule is going to be reduced.
|
||||||
private void yy_reduce_print (int yyrule, YYStack yystack)
|
private void yy_reduce_print (int yyrule, YYStack yystack)
|
||||||
@@ -881,4 +1068,4 @@ b4_percent_code_get[]dnl
|
|||||||
}
|
}
|
||||||
|
|
||||||
b4_epilogue[]dnl
|
b4_epilogue[]dnl
|
||||||
m4_divert_pop(0)dnl
|
b4_output_end()
|
||||||
|
|||||||
+2
-1
@@ -1,4 +1,4 @@
|
|||||||
## Copyright (C) 2002, 2005-2012 Free Software Foundation, Inc.
|
## Copyright (C) 2002, 2005-2015, 2018 Free Software Foundation, Inc.
|
||||||
|
|
||||||
## This program is free software: you can redistribute it and/or modify
|
## 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
|
## it under the terms of the GNU General Public License as published by
|
||||||
@@ -18,6 +18,7 @@ dist_pkgdata_DATA = \
|
|||||||
data/bison.m4 \
|
data/bison.m4 \
|
||||||
data/c++-skel.m4 \
|
data/c++-skel.m4 \
|
||||||
data/c++.m4 \
|
data/c++.m4 \
|
||||||
|
data/c-like.m4 \
|
||||||
data/c-skel.m4 \
|
data/c-skel.m4 \
|
||||||
data/c.m4 \
|
data/c.m4 \
|
||||||
data/glr.c \
|
data/glr.c \
|
||||||
|
|||||||
+141
-107
@@ -1,6 +1,6 @@
|
|||||||
# C++ skeleton for Bison
|
# C++ skeleton for Bison
|
||||||
|
|
||||||
# Copyright (C) 2002-2012 Free Software Foundation, Inc.
|
# Copyright (C) 2002-2015, 2018 Free Software Foundation, Inc.
|
||||||
|
|
||||||
# This program is free software: you can redistribute it and/or modify
|
# 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
|
# it under the terms of the GNU General Public License as published by
|
||||||
@@ -16,48 +16,30 @@
|
|||||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
m4_pushdef([b4_copyright_years],
|
m4_pushdef([b4_copyright_years],
|
||||||
[2002-2012])
|
[2002-2015, 2018])
|
||||||
|
|
||||||
# We do want M4 expansion after # for CPP macros.
|
# b4_position_define
|
||||||
m4_changecom()
|
# ------------------
|
||||||
m4_divert_push(0)dnl
|
# Define class position.
|
||||||
@output(b4_dir_prefix[]position.hh@)@
|
m4_define([b4_position_define],
|
||||||
b4_copyright([Positions for Bison parsers in C++])[
|
[[ /// Abstract a position.
|
||||||
|
|
||||||
/**
|
|
||||||
** \file ]b4_dir_prefix[position.hh
|
|
||||||
** Define the ]b4_namespace_ref[::position class.
|
|
||||||
*/
|
|
||||||
|
|
||||||
]b4_cpp_guard_open([b4_dir_prefix[]position.hh])[
|
|
||||||
|
|
||||||
# include <algorithm> // std::max
|
|
||||||
# include <iosfwd>
|
|
||||||
# include <string>
|
|
||||||
|
|
||||||
]b4_null_define[
|
|
||||||
|
|
||||||
]b4_namespace_open[
|
|
||||||
/// Abstract a position.
|
|
||||||
class position
|
class position
|
||||||
{
|
{
|
||||||
public:
|
public:]m4_ifdef([b4_location_constructors], [[
|
||||||
]m4_ifdef([b4_location_constructors], [[
|
|
||||||
/// Construct a position.
|
/// Construct a position.
|
||||||
explicit position (]b4_percent_define_get([[filename_type]])[* f = YY_NULL,
|
explicit position (]b4_percent_define_get([[filename_type]])[* f = YY_NULLPTR,
|
||||||
unsigned int l = ]b4_location_initial_line[u,
|
unsigned l = ]b4_location_initial_line[u,
|
||||||
unsigned int c = ]b4_location_initial_column[u)
|
unsigned c = ]b4_location_initial_column[u)
|
||||||
: filename (f)
|
: filename (f)
|
||||||
, line (l)
|
, line (l)
|
||||||
, column (c)
|
, column (c)
|
||||||
{
|
{}
|
||||||
}
|
|
||||||
|
|
||||||
]])[
|
]])[
|
||||||
/// Initialization.
|
/// Initialization.
|
||||||
void initialize (]b4_percent_define_get([[filename_type]])[* fn = YY_NULL,
|
void initialize (]b4_percent_define_get([[filename_type]])[* fn = YY_NULLPTR,
|
||||||
unsigned int l = ]b4_location_initial_line[u,
|
unsigned l = ]b4_location_initial_line[u,
|
||||||
unsigned int c = ]b4_location_initial_column[u)
|
unsigned c = ]b4_location_initial_column[u)
|
||||||
{
|
{
|
||||||
filename = fn;
|
filename = fn;
|
||||||
line = l;
|
line = l;
|
||||||
@@ -69,53 +51,62 @@ b4_copyright([Positions for Bison parsers in C++])[
|
|||||||
/// (line related) Advance to the COUNT next lines.
|
/// (line related) Advance to the COUNT next lines.
|
||||||
void lines (int count = 1)
|
void lines (int count = 1)
|
||||||
{
|
{
|
||||||
column = ]b4_location_initial_column[u;
|
if (count)
|
||||||
line += count;
|
{
|
||||||
|
column = ]b4_location_initial_column[u;
|
||||||
|
line = add_ (line, count, ]b4_location_initial_line[);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// (column related) Advance to the COUNT next columns.
|
/// (column related) Advance to the COUNT next columns.
|
||||||
void columns (int count = 1)
|
void columns (int count = 1)
|
||||||
{
|
{
|
||||||
column = std::max (]b4_location_initial_column[u, column + count);
|
column = add_ (column, count, ]b4_location_initial_column[);
|
||||||
}
|
}
|
||||||
/** \} */
|
/** \} */
|
||||||
|
|
||||||
/// File name to which this position refers.
|
/// File name to which this position refers.
|
||||||
]b4_percent_define_get([[filename_type]])[* filename;
|
]b4_percent_define_get([[filename_type]])[* filename;
|
||||||
/// Current line number.
|
/// Current line number.
|
||||||
unsigned int line;
|
unsigned line;
|
||||||
/// Current column number.
|
/// Current column number.
|
||||||
unsigned int column;
|
unsigned column;
|
||||||
|
|
||||||
|
private:
|
||||||
|
/// Compute max(min, lhs+rhs).
|
||||||
|
static unsigned add_ (unsigned lhs, int rhs, int min)
|
||||||
|
{
|
||||||
|
return static_cast<unsigned>(std::max(min, static_cast<int>(lhs) + rhs));
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
/// Add and assign a position.
|
/// Add \a width columns, in place.
|
||||||
inline const position&
|
inline position&
|
||||||
operator+= (position& res, const int width)
|
operator+= (position& res, int width)
|
||||||
{
|
{
|
||||||
res.columns (width);
|
res.columns (width);
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Add two position objects.
|
/// Add \a width columns.
|
||||||
inline const position
|
inline position
|
||||||
operator+ (const position& begin, const int width)
|
operator+ (position res, int width)
|
||||||
{
|
{
|
||||||
position res = begin;
|
|
||||||
return res += width;
|
return res += width;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Add and assign a position.
|
/// Subtract \a width columns, in place.
|
||||||
inline const position&
|
inline position&
|
||||||
operator-= (position& res, const int width)
|
operator-= (position& res, int width)
|
||||||
{
|
{
|
||||||
return res += -width;
|
return res += -width;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Add two position objects.
|
/// Subtract \a width columns.
|
||||||
inline const position
|
inline position
|
||||||
operator- (const position& begin, const int width)
|
operator- (position res, int width)
|
||||||
{
|
{
|
||||||
return begin + -width;
|
return res -= width;
|
||||||
}
|
}
|
||||||
]b4_percent_define_flag_if([[define_location_comparison]], [[
|
]b4_percent_define_flag_if([[define_location_comparison]], [[
|
||||||
/// Compare two position objects.
|
/// Compare two position objects.
|
||||||
@@ -140,33 +131,21 @@ b4_copyright([Positions for Bison parsers in C++])[
|
|||||||
** \param ostr the destination output stream
|
** \param ostr the destination output stream
|
||||||
** \param pos a reference to the position to redirect
|
** \param pos a reference to the position to redirect
|
||||||
*/
|
*/
|
||||||
inline std::ostream&
|
template <typename YYChar>
|
||||||
operator<< (std::ostream& ostr, const position& pos)
|
std::basic_ostream<YYChar>&
|
||||||
|
operator<< (std::basic_ostream<YYChar>& ostr, const position& pos)
|
||||||
{
|
{
|
||||||
if (pos.filename)
|
if (pos.filename)
|
||||||
ostr << *pos.filename << ':';
|
ostr << *pos.filename << ':';
|
||||||
return ostr << pos.line << '.' << pos.column;
|
return ostr << pos.line << '.' << pos.column;
|
||||||
}
|
}
|
||||||
|
]])
|
||||||
|
|
||||||
]b4_namespace_close[
|
|
||||||
]b4_cpp_guard_close([b4_dir_prefix[]position.hh])
|
|
||||||
@output(b4_dir_prefix[]location.hh@)@
|
|
||||||
b4_copyright([Locations for Bison parsers in C++])[
|
|
||||||
|
|
||||||
/**
|
# b4_location_define
|
||||||
** \file ]b4_dir_prefix[location.hh
|
# ------------------
|
||||||
** Define the ]b4_namespace_ref[::location class.
|
m4_define([b4_location_define],
|
||||||
*/
|
[[ /// Abstract a location.
|
||||||
|
|
||||||
]b4_cpp_guard_open([b4_dir_prefix[]location.hh])[
|
|
||||||
|
|
||||||
# include <iostream>
|
|
||||||
# include <string>
|
|
||||||
# include "position.hh"
|
|
||||||
|
|
||||||
]b4_namespace_open[
|
|
||||||
|
|
||||||
/// Abstract a location.
|
|
||||||
class location
|
class location
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
@@ -175,30 +154,27 @@ b4_copyright([Locations for Bison parsers in C++])[
|
|||||||
location (const position& b, const position& e)
|
location (const position& b, const position& e)
|
||||||
: begin (b)
|
: begin (b)
|
||||||
, end (e)
|
, end (e)
|
||||||
{
|
{}
|
||||||
}
|
|
||||||
|
|
||||||
/// Construct a 0-width location in \a p.
|
/// Construct a 0-width location in \a p.
|
||||||
explicit location (const position& p = position ())
|
explicit location (const position& p = position ())
|
||||||
: begin (p)
|
: begin (p)
|
||||||
, end (p)
|
, end (p)
|
||||||
{
|
{}
|
||||||
}
|
|
||||||
|
|
||||||
/// Construct a 0-width location in \a f, \a l, \a c.
|
/// Construct a 0-width location in \a f, \a l, \a c.
|
||||||
explicit location (]b4_percent_define_get([[filename_type]])[* f,
|
explicit location (]b4_percent_define_get([[filename_type]])[* f,
|
||||||
unsigned int l = ]b4_location_initial_line[u,
|
unsigned l = ]b4_location_initial_line[u,
|
||||||
unsigned int c = ]b4_location_initial_column[u)
|
unsigned c = ]b4_location_initial_column[u)
|
||||||
: begin (f, l, c)
|
: begin (f, l, c)
|
||||||
, end (f, l, c)
|
, end (f, l, c)
|
||||||
{
|
{}
|
||||||
}
|
|
||||||
|
|
||||||
])[
|
])[
|
||||||
/// Initialization.
|
/// Initialization.
|
||||||
void initialize (]b4_percent_define_get([[filename_type]])[* f = YY_NULL,
|
void initialize (]b4_percent_define_get([[filename_type]])[* f = YY_NULLPTR,
|
||||||
unsigned int l = ]b4_location_initial_line[u,
|
unsigned l = ]b4_location_initial_line[u,
|
||||||
unsigned int c = ]b4_location_initial_column[u)
|
unsigned c = ]b4_location_initial_column[u)
|
||||||
{
|
{
|
||||||
begin.initialize (f, l, c);
|
begin.initialize (f, l, c);
|
||||||
end = begin;
|
end = begin;
|
||||||
@@ -214,13 +190,13 @@ b4_copyright([Locations for Bison parsers in C++])[
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Extend the current location to the COUNT next columns.
|
/// Extend the current location to the COUNT next columns.
|
||||||
void columns (unsigned int count = 1)
|
void columns (int count = 1)
|
||||||
{
|
{
|
||||||
end += count;
|
end += count;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Extend the current location to the COUNT next lines.
|
/// Extend the current location to the COUNT next lines.
|
||||||
void lines (unsigned int count = 1)
|
void lines (int count = 1)
|
||||||
{
|
{
|
||||||
end.lines (count);
|
end.lines (count);
|
||||||
}
|
}
|
||||||
@@ -234,27 +210,42 @@ b4_copyright([Locations for Bison parsers in C++])[
|
|||||||
position end;
|
position end;
|
||||||
};
|
};
|
||||||
|
|
||||||
/// Join two location objects to create a location.
|
/// Join two locations, in place.
|
||||||
inline const location operator+ (const location& begin, const location& end)
|
inline location& operator+= (location& res, const location& end)
|
||||||
{
|
{
|
||||||
location res = begin;
|
|
||||||
res.end = end.end;
|
res.end = end.end;
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Add two location objects.
|
/// Join two locations.
|
||||||
inline const location operator+ (const location& begin, unsigned int width)
|
inline location operator+ (location res, const location& end)
|
||||||
|
{
|
||||||
|
return res += end;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Add \a width columns to the end position, in place.
|
||||||
|
inline location& operator+= (location& res, int width)
|
||||||
{
|
{
|
||||||
location res = begin;
|
|
||||||
res.columns (width);
|
res.columns (width);
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Add and assign a location.
|
/// Add \a width columns to the end position.
|
||||||
inline location& operator+= (location& res, unsigned int width)
|
inline location operator+ (location res, int width)
|
||||||
{
|
{
|
||||||
res.columns (width);
|
return res += width;
|
||||||
return res;
|
}
|
||||||
|
|
||||||
|
/// Subtract \a width columns to the end position, in place.
|
||||||
|
inline location& operator-= (location& res, int width)
|
||||||
|
{
|
||||||
|
return res += -width;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Subtract \a width columns to the end position.
|
||||||
|
inline location operator- (location res, int width)
|
||||||
|
{
|
||||||
|
return res -= width;
|
||||||
}
|
}
|
||||||
]b4_percent_define_flag_if([[define_location_comparison]], [[
|
]b4_percent_define_flag_if([[define_location_comparison]], [[
|
||||||
/// Compare two location objects.
|
/// Compare two location objects.
|
||||||
@@ -277,24 +268,67 @@ b4_copyright([Locations for Bison parsers in C++])[
|
|||||||
**
|
**
|
||||||
** Avoid duplicate information.
|
** Avoid duplicate information.
|
||||||
*/
|
*/
|
||||||
inline std::ostream& operator<< (std::ostream& ostr, const location& loc)
|
template <typename YYChar>
|
||||||
|
std::basic_ostream<YYChar>&
|
||||||
|
operator<< (std::basic_ostream<YYChar>& ostr, const location& loc)
|
||||||
{
|
{
|
||||||
position last = loc.end - 1;
|
unsigned end_col = 0 < loc.end.column ? loc.end.column - 1 : 0;
|
||||||
ostr << loc.begin;
|
ostr << loc.begin;
|
||||||
if (last.filename
|
if (loc.end.filename
|
||||||
&& (!loc.begin.filename
|
&& (!loc.begin.filename
|
||||||
|| *loc.begin.filename != *last.filename))
|
|| *loc.begin.filename != *loc.end.filename))
|
||||||
ostr << '-' << last;
|
ostr << '-' << loc.end.filename << ':' << loc.end.line << '.' << end_col;
|
||||||
else if (loc.begin.line != last.line)
|
else if (loc.begin.line < loc.end.line)
|
||||||
ostr << '-' << last.line << '.' << last.column;
|
ostr << '-' << loc.end.line << '.' << end_col;
|
||||||
else if (loc.begin.column != last.column)
|
else if (loc.begin.column < end_col)
|
||||||
ostr << '-' << last.column;
|
ostr << '-' << end_col;
|
||||||
return ostr;
|
return ostr;
|
||||||
}
|
}
|
||||||
|
]])
|
||||||
|
|
||||||
|
|
||||||
|
b4_defines_if([
|
||||||
|
b4_output_begin([b4_dir_prefix[]position.hh])
|
||||||
|
b4_copyright([Positions for Bison parsers in C++])[
|
||||||
|
|
||||||
|
/**
|
||||||
|
** \file ]b4_dir_prefix[position.hh
|
||||||
|
** Define the ]b4_namespace_ref[::position class.
|
||||||
|
*/
|
||||||
|
|
||||||
|
]b4_cpp_guard_open([b4_dir_prefix[]position.hh])[
|
||||||
|
|
||||||
|
# include <algorithm> // std::max
|
||||||
|
# include <iostream>
|
||||||
|
# include <string>
|
||||||
|
|
||||||
|
]b4_null_define[
|
||||||
|
|
||||||
|
]b4_namespace_open[
|
||||||
|
]b4_position_define[
|
||||||
]b4_namespace_close[
|
]b4_namespace_close[
|
||||||
|
]b4_cpp_guard_close([b4_dir_prefix[]position.hh])
|
||||||
|
b4_output_end()
|
||||||
|
|
||||||
|
|
||||||
|
b4_output_begin([b4_dir_prefix[]location.hh])
|
||||||
|
b4_copyright([Locations for Bison parsers in C++])[
|
||||||
|
|
||||||
|
/**
|
||||||
|
** \file ]b4_dir_prefix[location.hh
|
||||||
|
** Define the ]b4_namespace_ref[::location class.
|
||||||
|
*/
|
||||||
|
|
||||||
|
]b4_cpp_guard_open([b4_dir_prefix[]location.hh])[
|
||||||
|
|
||||||
|
# include "position.hh"
|
||||||
|
|
||||||
|
]b4_namespace_open[
|
||||||
|
]b4_location_define[
|
||||||
|
]b4_namespace_close[
|
||||||
]b4_cpp_guard_close([b4_dir_prefix[]location.hh])
|
]b4_cpp_guard_close([b4_dir_prefix[]location.hh])
|
||||||
m4_divert_pop(0)
|
b4_output_end()
|
||||||
m4_popdef([b4_copyright_years])dnl
|
])
|
||||||
m4_changecom([#])
|
|
||||||
|
|
||||||
|
m4_popdef([b4_copyright_years])
|
||||||
|
|||||||
+64
-48
@@ -1,6 +1,6 @@
|
|||||||
# C++ skeleton for Bison
|
# C++ skeleton for Bison
|
||||||
|
|
||||||
# Copyright (C) 2002-2012 Free Software Foundation, Inc.
|
# Copyright (C) 2002-2015, 2018 Free Software Foundation, Inc.
|
||||||
|
|
||||||
# This program is free software: you can redistribute it and/or modify
|
# 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
|
# it under the terms of the GNU General Public License as published by
|
||||||
@@ -16,86 +16,83 @@
|
|||||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
m4_pushdef([b4_copyright_years],
|
m4_pushdef([b4_copyright_years],
|
||||||
[2002-2012])
|
[2002-2015, 2018])
|
||||||
|
|
||||||
# We do want M4 expansion after # for CPP macros.
|
# b4_stack_define
|
||||||
m4_changecom()
|
# ---------------
|
||||||
m4_divert_push(0)dnl
|
m4_define([b4_stack_define],
|
||||||
@output(b4_dir_prefix[]stack.hh@)@
|
[[ /// A stack with random access from its top.
|
||||||
b4_copyright([Stack handling for Bison parsers in C++])[
|
template <class T, class S = std::vector<T> >
|
||||||
|
|
||||||
/**
|
|
||||||
** \file ]b4_dir_prefix[stack.hh
|
|
||||||
** Define the ]b4_namespace_ref[::stack class.
|
|
||||||
*/
|
|
||||||
|
|
||||||
]b4_cpp_guard_open([b4_dir_prefix[]stack.hh])[
|
|
||||||
|
|
||||||
# include <deque>
|
|
||||||
|
|
||||||
]b4_namespace_open[
|
|
||||||
template <class T, class S = std::deque<T> >
|
|
||||||
class stack
|
class stack
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
// Hide our reversed order.
|
// Hide our reversed order.
|
||||||
typedef typename S::reverse_iterator iterator;
|
typedef typename S::reverse_iterator iterator;
|
||||||
typedef typename S::const_reverse_iterator const_iterator;
|
typedef typename S::const_reverse_iterator const_iterator;
|
||||||
|
typedef typename S::size_type size_type;
|
||||||
|
|
||||||
stack ()
|
stack ()
|
||||||
: seq_ ()
|
|
||||||
{
|
{
|
||||||
|
seq_.reserve (200);
|
||||||
}
|
}
|
||||||
|
|
||||||
stack (unsigned int n)
|
stack (size_type n)
|
||||||
: seq_ (n)
|
: seq_ (n)
|
||||||
{
|
{}
|
||||||
}
|
|
||||||
|
|
||||||
inline
|
/// Random access.
|
||||||
|
///
|
||||||
|
/// Index 0 returns the topmost element.
|
||||||
T&
|
T&
|
||||||
operator [] (unsigned int i)
|
operator[] (size_type i)
|
||||||
{
|
{
|
||||||
return seq_[i];
|
return seq_[seq_.size () - 1 - i];
|
||||||
}
|
}
|
||||||
|
|
||||||
inline
|
/// Random access.
|
||||||
|
///
|
||||||
|
/// Index 0 returns the topmost element.
|
||||||
const T&
|
const T&
|
||||||
operator [] (unsigned int i) const
|
operator[] (size_type i) const
|
||||||
{
|
{
|
||||||
return seq_[i];
|
return seq_[seq_.size () - 1 - i];
|
||||||
}
|
}
|
||||||
|
|
||||||
inline
|
/// Steal the contents of \a t.
|
||||||
|
///
|
||||||
|
/// Close to move-semantics.
|
||||||
void
|
void
|
||||||
push (const T& t)
|
push (T& t)
|
||||||
{
|
{
|
||||||
seq_.push_front (t);
|
seq_.push_back (T());
|
||||||
|
operator[](0).move (t);
|
||||||
}
|
}
|
||||||
|
|
||||||
inline
|
|
||||||
void
|
void
|
||||||
pop (unsigned int n = 1)
|
pop (size_type n = 1)
|
||||||
{
|
{
|
||||||
for (; n; --n)
|
for (; n; --n)
|
||||||
seq_.pop_front ();
|
seq_.pop_back ();
|
||||||
}
|
}
|
||||||
|
|
||||||
inline
|
void
|
||||||
typename S::size_type
|
clear ()
|
||||||
|
{
|
||||||
|
seq_.clear ();
|
||||||
|
}
|
||||||
|
|
||||||
|
size_type
|
||||||
size () const
|
size () const
|
||||||
{
|
{
|
||||||
return seq_.size ();
|
return seq_.size ();
|
||||||
}
|
}
|
||||||
|
|
||||||
inline
|
|
||||||
const_iterator
|
const_iterator
|
||||||
begin () const
|
begin () const
|
||||||
{
|
{
|
||||||
return seq_.rbegin ();
|
return seq_.rbegin ();
|
||||||
}
|
}
|
||||||
|
|
||||||
inline
|
|
||||||
const_iterator
|
const_iterator
|
||||||
end () const
|
end () const
|
||||||
{
|
{
|
||||||
@@ -103,6 +100,8 @@ b4_copyright([Stack handling for Bison parsers in C++])[
|
|||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
stack (const stack&);
|
||||||
|
stack& operator= (const stack&);
|
||||||
/// The wrapped container.
|
/// The wrapped container.
|
||||||
S seq_;
|
S seq_;
|
||||||
};
|
};
|
||||||
@@ -112,26 +111,43 @@ b4_copyright([Stack handling for Bison parsers in C++])[
|
|||||||
class slice
|
class slice
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
slice (const S& stack, unsigned int range)
|
typedef typename S::size_type size_type;
|
||||||
|
slice (const S& stack, size_type range)
|
||||||
: stack_ (stack)
|
: stack_ (stack)
|
||||||
, range_ (range)
|
, range_ (range)
|
||||||
{
|
{}
|
||||||
}
|
|
||||||
|
|
||||||
inline
|
|
||||||
const T&
|
const T&
|
||||||
operator [] (unsigned int i) const
|
operator[] (size_type i) const
|
||||||
{
|
{
|
||||||
return stack_[range_ - i];
|
return stack_[range_ - i];
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
const S& stack_;
|
const S& stack_;
|
||||||
unsigned int range_;
|
size_type range_;
|
||||||
};
|
};
|
||||||
|
]])
|
||||||
|
|
||||||
|
b4_defines_if(
|
||||||
|
[b4_output_begin([b4_dir_prefix[]stack.hh])
|
||||||
|
b4_copyright([Stack handling for Bison parsers in C++])[
|
||||||
|
|
||||||
|
/**
|
||||||
|
** \file ]b4_dir_prefix[stack.hh
|
||||||
|
** Define the ]b4_namespace_ref[::stack class.
|
||||||
|
*/
|
||||||
|
|
||||||
|
]b4_cpp_guard_open([b4_dir_prefix[]stack.hh])[
|
||||||
|
|
||||||
|
# include <vector>
|
||||||
|
|
||||||
|
]b4_namespace_open[
|
||||||
|
]b4_stack_define[
|
||||||
]b4_namespace_close[
|
]b4_namespace_close[
|
||||||
|
|
||||||
]b4_cpp_guard_close([b4_dir_prefix[]stack.hh])
|
]b4_cpp_guard_close([b4_dir_prefix[]stack.hh])
|
||||||
m4_divert_pop(0)
|
b4_output_end()
|
||||||
m4_popdef([b4_copyright_years])dnl
|
])
|
||||||
m4_changecom([#])
|
|
||||||
|
m4_popdef([b4_copyright_years])
|
||||||
|
|||||||
+161
-75
@@ -1,6 +1,6 @@
|
|||||||
# C++ skeleton for Bison
|
# C++ skeleton for Bison
|
||||||
|
|
||||||
# Copyright (C) 2002-2012 Free Software Foundation, Inc.
|
# Copyright (C) 2002-2015, 2018 Free Software Foundation, Inc.
|
||||||
|
|
||||||
# This program is free software: you can redistribute it and/or modify
|
# 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
|
# it under the terms of the GNU General Public License as published by
|
||||||
@@ -26,8 +26,8 @@
|
|||||||
# YYTYPE.
|
# YYTYPE.
|
||||||
m4_define([b4_symbol_variant],
|
m4_define([b4_symbol_variant],
|
||||||
[m4_pushdef([b4_dollar_dollar],
|
[m4_pushdef([b4_dollar_dollar],
|
||||||
[$2.$3< $][3 >(m4_shift3($@))])dnl
|
[$2.$3< $][3 > (m4_shift3($@))])dnl
|
||||||
switch ($1)
|
switch ($1)
|
||||||
{
|
{
|
||||||
b4_type_foreach([b4_type_action_])[]dnl
|
b4_type_foreach([b4_type_action_])[]dnl
|
||||||
default:
|
default:
|
||||||
@@ -51,13 +51,6 @@ m4_define([_b4_char_sizeof_dummy],
|
|||||||
dummy[]_b4_char_sizeof_counter])
|
dummy[]_b4_char_sizeof_counter])
|
||||||
|
|
||||||
|
|
||||||
# b4_char_sizeof_(SYMBOL-NUM)
|
|
||||||
# ---------------------------
|
|
||||||
# A comment describing this symbol.
|
|
||||||
m4_define([b4_char_sizeof_],
|
|
||||||
[ // b4_symbol([$1], [tag])
|
|
||||||
])
|
|
||||||
|
|
||||||
# b4_char_sizeof(SYMBOL-NUMS)
|
# b4_char_sizeof(SYMBOL-NUMS)
|
||||||
# ---------------------------
|
# ---------------------------
|
||||||
# To be mapped on the list of type names to produce:
|
# To be mapped on the list of type names to produce:
|
||||||
@@ -69,116 +62,181 @@ m4_define([b4_char_sizeof_],
|
|||||||
m4_define([b4_char_sizeof],
|
m4_define([b4_char_sizeof],
|
||||||
[b4_symbol_if([$1], [has_type],
|
[b4_symbol_if([$1], [has_type],
|
||||||
[
|
[
|
||||||
m4_map_args([b4_char_sizeof_], $@)dnl
|
m4_map([ b4_symbol_tag_comment], [$@])dnl
|
||||||
char _b4_char_sizeof_dummy@{sizeof([b4_symbol([$1], [type])])@};
|
char _b4_char_sizeof_dummy@{sizeof(b4_symbol([$1], [type]))@};
|
||||||
])])
|
])])
|
||||||
|
|
||||||
|
|
||||||
|
# b4_variant_includes
|
||||||
|
# -------------------
|
||||||
|
# The needed includes for variants support.
|
||||||
|
m4_define([b4_variant_includes],
|
||||||
|
[b4_parse_assert_if([[#include <typeinfo>]])[
|
||||||
|
#ifndef YYASSERT
|
||||||
|
# include <cassert>
|
||||||
|
# define YYASSERT assert
|
||||||
|
#endif
|
||||||
|
]])
|
||||||
|
|
||||||
# b4_variant_define
|
# b4_variant_define
|
||||||
# -----------------
|
# -----------------
|
||||||
# Define "variant".
|
# Define "variant".
|
||||||
m4_define([b4_variant_define],
|
m4_define([b4_variant_define],
|
||||||
[[
|
[[ /// A char[S] buffer to store and retrieve objects.
|
||||||
/// A char[S] buffer to store and retrieve objects.
|
|
||||||
///
|
///
|
||||||
/// Sort of a variant, but does not keep track of the nature
|
/// Sort of a variant, but does not keep track of the nature
|
||||||
/// of the stored data, since that knowledge is available
|
/// of the stored data, since that knowledge is available
|
||||||
/// via the current state.
|
/// via the current state.
|
||||||
template <size_t S>
|
template <size_t S>
|
||||||
struct variant
|
struct variant
|
||||||
{]b4_parse_assert_if([
|
{
|
||||||
/// Whether something is contained.
|
/// Type of *this.
|
||||||
bool built;
|
typedef variant<S> self_type;
|
||||||
])[
|
|
||||||
/// Empty construction.
|
/// Empty construction.
|
||||||
inline
|
variant ()
|
||||||
variant ()]b4_parse_assert_if([
|
: yybuffer_ ()]b4_parse_assert_if([
|
||||||
: built (false)])[
|
, yytypeid_ (YY_NULLPTR)])[
|
||||||
{}
|
{}
|
||||||
|
|
||||||
/// Instantiate a \a T in here.
|
/// Construct and fill.
|
||||||
template <typename T>
|
template <typename T>
|
||||||
inline T&
|
variant (const T& t)]b4_parse_assert_if([
|
||||||
|
: yytypeid_ (&typeid (T))])[
|
||||||
|
{
|
||||||
|
YYASSERT (sizeof (T) <= S);
|
||||||
|
new (yyas_<T> ()) T (t);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Destruction, allowed only if empty.
|
||||||
|
~variant ()
|
||||||
|
{]b4_parse_assert_if([
|
||||||
|
YYASSERT (!yytypeid_);
|
||||||
|
])[}
|
||||||
|
|
||||||
|
/// Instantiate an empty \a T in here.
|
||||||
|
template <typename T>
|
||||||
|
T&
|
||||||
build ()
|
build ()
|
||||||
{]b4_parse_assert_if([
|
{]b4_parse_assert_if([
|
||||||
assert (!built);
|
YYASSERT (!yytypeid_);
|
||||||
built = true;])[
|
YYASSERT (sizeof (T) <= S);
|
||||||
return *new (buffer.raw) T;
|
yytypeid_ = & typeid (T);])[
|
||||||
|
return *new (yyas_<T> ()) T ();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Instantiate a \a T in here from \a t.
|
/// Instantiate a \a T in here from \a t.
|
||||||
template <typename T>
|
template <typename T>
|
||||||
inline T&
|
T&
|
||||||
build (const T& t)
|
build (const T& t)
|
||||||
{]b4_parse_assert_if([
|
{]b4_parse_assert_if([
|
||||||
assert(!built);
|
YYASSERT (!yytypeid_);
|
||||||
built = true;])[
|
YYASSERT (sizeof (T) <= S);
|
||||||
return *new (buffer.raw) T(t);
|
yytypeid_ = & typeid (T);])[
|
||||||
}
|
return *new (yyas_<T> ()) T (t);
|
||||||
|
|
||||||
/// Construct and fill.
|
|
||||||
template <typename T>
|
|
||||||
inline
|
|
||||||
variant (const T& t)]b4_parse_assert_if([
|
|
||||||
: built (true)])[
|
|
||||||
{
|
|
||||||
new (buffer.raw) T(t);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Accessor to a built \a T.
|
/// Accessor to a built \a T.
|
||||||
template <typename T>
|
template <typename T>
|
||||||
inline T&
|
T&
|
||||||
as ()
|
as ()
|
||||||
{]b4_parse_assert_if([
|
{]b4_parse_assert_if([
|
||||||
assert (built);])[
|
YYASSERT (yytypeid_);
|
||||||
return reinterpret_cast<T&>(buffer.raw);
|
YYASSERT (*yytypeid_ == typeid (T));
|
||||||
|
YYASSERT (sizeof (T) <= S);])[
|
||||||
|
return *yyas_<T> ();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Const accessor to a built \a T (for %printer).
|
/// Const accessor to a built \a T (for %printer).
|
||||||
template <typename T>
|
template <typename T>
|
||||||
inline const T&
|
const T&
|
||||||
as () const
|
as () const
|
||||||
{]b4_parse_assert_if([
|
{]b4_parse_assert_if([
|
||||||
assert(built);])[
|
YYASSERT (yytypeid_);
|
||||||
return reinterpret_cast<const T&>(buffer.raw);
|
YYASSERT (*yytypeid_ == typeid (T));
|
||||||
|
YYASSERT (sizeof (T) <= S);])[
|
||||||
|
return *yyas_<T> ();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Swap the content with \a other.
|
/// Swap the content with \a other, of same type.
|
||||||
|
///
|
||||||
|
/// Both variants must be built beforehand, because swapping the actual
|
||||||
|
/// data requires reading it (with as()), and this is not possible on
|
||||||
|
/// unconstructed variants: it would require some dynamic testing, which
|
||||||
|
/// should not be the variant's responsability.
|
||||||
|
/// Swapping between built and (possibly) non-built is done with
|
||||||
|
/// variant::move ().
|
||||||
template <typename T>
|
template <typename T>
|
||||||
inline void
|
void
|
||||||
swap (variant<S>& other)
|
swap (self_type& other)
|
||||||
{
|
{]b4_parse_assert_if([
|
||||||
std::swap (as<T>(), other.as<T>());
|
YYASSERT (yytypeid_);
|
||||||
|
YYASSERT (*yytypeid_ == *other.yytypeid_);])[
|
||||||
|
std::swap (as<T> (), other.as<T> ());
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Assign the content of \a other to this.
|
/// Move the content of \a other to this.
|
||||||
|
///
|
||||||
/// Destroys \a other.
|
/// Destroys \a other.
|
||||||
template <typename T>
|
template <typename T>
|
||||||
inline void
|
void
|
||||||
build (variant<S>& other)
|
move (self_type& other)
|
||||||
{
|
{
|
||||||
build<T>();
|
build<T> ();
|
||||||
swap<T>(other);
|
swap<T> (other);
|
||||||
other.destroy<T>();
|
other.destroy<T> ();
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Copy the content of \a other to this.
|
||||||
|
template <typename T>
|
||||||
|
void
|
||||||
|
copy (const self_type& other)
|
||||||
|
{
|
||||||
|
build<T> (other.as<T> ());
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Destroy the stored \a T.
|
/// Destroy the stored \a T.
|
||||||
template <typename T>
|
template <typename T>
|
||||||
inline void
|
void
|
||||||
destroy ()
|
destroy ()
|
||||||
{
|
{
|
||||||
as<T>().~T();]b4_parse_assert_if([
|
as<T> ().~T ();]b4_parse_assert_if([
|
||||||
built = false;])[
|
yytypeid_ = YY_NULLPTR;])[
|
||||||
}
|
}
|
||||||
|
|
||||||
/// A buffer large enough to store any of the semantic values.
|
private:
|
||||||
/// Long double is chosen as it has the strongest alignment
|
/// Prohibit blind copies.
|
||||||
/// constraints.
|
self_type& operator=(const self_type&);
|
||||||
|
variant (const self_type&);
|
||||||
|
|
||||||
|
/// Accessor to raw memory as \a T.
|
||||||
|
template <typename T>
|
||||||
|
T*
|
||||||
|
yyas_ ()
|
||||||
|
{
|
||||||
|
void *yyp = yybuffer_.yyraw;
|
||||||
|
return static_cast<T*> (yyp);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Const accessor to raw memory as \a T.
|
||||||
|
template <typename T>
|
||||||
|
const T*
|
||||||
|
yyas_ () const
|
||||||
|
{
|
||||||
|
const void *yyp = yybuffer_.yyraw;
|
||||||
|
return static_cast<const T*> (yyp);
|
||||||
|
}
|
||||||
|
|
||||||
union
|
union
|
||||||
{
|
{
|
||||||
long double align_me;
|
/// Strongest alignment constraints.
|
||||||
char raw[S];
|
long double yyalign_me;
|
||||||
} buffer;
|
/// A buffer large enough to store any of the semantic values.
|
||||||
|
char yyraw[S];
|
||||||
|
} yybuffer_;]b4_parse_assert_if([
|
||||||
|
|
||||||
|
/// Whether the content is built: if defined, the name of the stored type.
|
||||||
|
const std::type_info *yytypeid_;])[
|
||||||
};
|
};
|
||||||
]])
|
]])
|
||||||
|
|
||||||
@@ -188,16 +246,17 @@ m4_define([b4_variant_define],
|
|||||||
## -------------------------- ##
|
## -------------------------- ##
|
||||||
|
|
||||||
|
|
||||||
# b4_semantic_type_declare
|
# b4_value_type_declare
|
||||||
# ------------------------
|
# ---------------------
|
||||||
# Declare semantic_type.
|
# Declare semantic_type.
|
||||||
m4_define([b4_semantic_type_declare],
|
m4_define([b4_value_type_declare],
|
||||||
[ /// An auxiliary type to compute the largest semantic type.
|
[[ /// An auxiliary type to compute the largest semantic type.
|
||||||
union union_type
|
union union_type
|
||||||
{]b4_type_foreach([b4_char_sizeof])[};
|
{]b4_type_foreach([b4_char_sizeof])[};
|
||||||
|
|
||||||
/// Symbol semantic values.
|
/// Symbol semantic values.
|
||||||
typedef variant<sizeof(union_type)> semantic_type;])
|
typedef variant<sizeof(union_type)> semantic_type;][]dnl
|
||||||
|
])
|
||||||
|
|
||||||
|
|
||||||
# How the semantic value is extracted when using variants.
|
# How the semantic value is extracted when using variants.
|
||||||
@@ -206,7 +265,7 @@ m4_define([b4_semantic_type_declare],
|
|||||||
# ----------------------------
|
# ----------------------------
|
||||||
m4_define([b4_symbol_value],
|
m4_define([b4_symbol_value],
|
||||||
[m4_ifval([$2],
|
[m4_ifval([$2],
|
||||||
[$1.as< $2 >()],
|
[$1.as< $2 > ()],
|
||||||
[$1])])
|
[$1])])
|
||||||
|
|
||||||
# b4_symbol_value_template(VAL, [TYPE])
|
# b4_symbol_value_template(VAL, [TYPE])
|
||||||
@@ -214,7 +273,7 @@ m4_define([b4_symbol_value],
|
|||||||
# Same as b4_symbol_value, but used in a template method.
|
# Same as b4_symbol_value, but used in a template method.
|
||||||
m4_define([b4_symbol_value_template],
|
m4_define([b4_symbol_value_template],
|
||||||
[m4_ifval([$2],
|
[m4_ifval([$2],
|
||||||
[$1.template as< $2 >()],
|
[$1.template as< $2 > ()],
|
||||||
[$1])])
|
[$1])])
|
||||||
|
|
||||||
|
|
||||||
@@ -233,7 +292,7 @@ m4_define([b4_symbol_constructor_declare_],
|
|||||||
[ static inline
|
[ static inline
|
||||||
symbol_type
|
symbol_type
|
||||||
make_[]b4_symbol_([$1], [id]) (dnl
|
make_[]b4_symbol_([$1], [id]) (dnl
|
||||||
b4_args(b4_symbol_if([$1], [has_type],
|
b4_join(b4_symbol_if([$1], [has_type],
|
||||||
[const b4_symbol([$1], [type])& v]),
|
[const b4_symbol([$1], [type])& v]),
|
||||||
b4_locations_if([const location_type& l])));
|
b4_locations_if([const location_type& l])));
|
||||||
|
|
||||||
@@ -257,11 +316,11 @@ m4_define([b4_symbol_constructor_define_],
|
|||||||
[b4_symbol_if([$1], [is_token], [b4_symbol_if([$1], [has_id],
|
[b4_symbol_if([$1], [is_token], [b4_symbol_if([$1], [has_id],
|
||||||
[ b4_parser_class_name::symbol_type
|
[ b4_parser_class_name::symbol_type
|
||||||
b4_parser_class_name::make_[]b4_symbol_([$1], [id]) (dnl
|
b4_parser_class_name::make_[]b4_symbol_([$1], [id]) (dnl
|
||||||
b4_args(b4_symbol_if([$1], [has_type],
|
b4_join(b4_symbol_if([$1], [has_type],
|
||||||
[const b4_symbol([$1], [type])& v]),
|
[const b4_symbol([$1], [type])& v]),
|
||||||
b4_locations_if([const location_type& l])))
|
b4_locations_if([const location_type& l])))
|
||||||
{
|
{
|
||||||
return symbol_type (b4_args([token::b4_symbol([$1], [id])],
|
return symbol_type (b4_join([token::b4_symbol([$1], [id])],
|
||||||
b4_symbol_if([$1], [has_type], [v]),
|
b4_symbol_if([$1], [has_type], [v]),
|
||||||
b4_locations_if([l])));
|
b4_locations_if([l])));
|
||||||
}
|
}
|
||||||
@@ -269,6 +328,33 @@ b4_args(b4_symbol_if([$1], [has_type],
|
|||||||
])])])
|
])])])
|
||||||
|
|
||||||
|
|
||||||
|
# b4_basic_symbol_constructor_declare
|
||||||
|
# -----------------------------------
|
||||||
|
# Generate a constructor declaration for basic_symbol from given type.
|
||||||
|
m4_define([b4_basic_symbol_constructor_declare],
|
||||||
|
[[
|
||||||
|
basic_symbol (]b4_join(
|
||||||
|
[typename Base::kind_type t],
|
||||||
|
b4_symbol_if([$1], [has_type], const b4_symbol([$1], [type])[& v]),
|
||||||
|
b4_locations_if([const location_type& l]))[);
|
||||||
|
]])
|
||||||
|
|
||||||
|
# b4_basic_symbol_constructor_define
|
||||||
|
# ----------------------------------
|
||||||
|
# Generate a constructor implementation for basic_symbol from given type.
|
||||||
|
m4_define([b4_basic_symbol_constructor_define],
|
||||||
|
[[
|
||||||
|
template <typename Base>
|
||||||
|
]b4_parser_class_name[::basic_symbol<Base>::basic_symbol (]b4_join(
|
||||||
|
[typename Base::kind_type t],
|
||||||
|
b4_symbol_if([$1], [has_type], const b4_symbol([$1], [type])[& v]),
|
||||||
|
b4_locations_if([const location_type& l]))[)
|
||||||
|
: Base (t)]b4_symbol_if([$1], [has_type], [
|
||||||
|
, value (v)])[]b4_locations_if([
|
||||||
|
, location (l)])[
|
||||||
|
{}
|
||||||
|
]])
|
||||||
|
|
||||||
# b4_symbol_constructor_define
|
# b4_symbol_constructor_define
|
||||||
# ----------------------------
|
# ----------------------------
|
||||||
# Define the overloaded versions of make_symbol for all the value types.
|
# Define the overloaded versions of make_symbol for all the value types.
|
||||||
|
|||||||
+13
-1
@@ -3,7 +3,7 @@
|
|||||||
<!--
|
<!--
|
||||||
bison.xsl - common templates for Bison XSLT.
|
bison.xsl - common templates for Bison XSLT.
|
||||||
|
|
||||||
Copyright (C) 2007-2012 Free Software Foundation, Inc.
|
Copyright (C) 2007-2015, 2018 Free Software Foundation, Inc.
|
||||||
|
|
||||||
This file is part of Bison, the GNU Compiler Compiler.
|
This file is part of Bison, the GNU Compiler Compiler.
|
||||||
|
|
||||||
@@ -90,4 +90,16 @@
|
|||||||
<xsl:value-of select="string-length(translate($conflict-data, 's', ''))"/>
|
<xsl:value-of select="string-length(translate($conflict-data, 's', ''))"/>
|
||||||
</xsl:template>
|
</xsl:template>
|
||||||
|
|
||||||
|
<xsl:template name="space">
|
||||||
|
<xsl:param name="repeat">0</xsl:param>
|
||||||
|
<xsl:param name="fill" select="' '"/>
|
||||||
|
<xsl:if test="number($repeat) >= 1">
|
||||||
|
<xsl:call-template name="space">
|
||||||
|
<xsl:with-param name="repeat" select="$repeat - 1"/>
|
||||||
|
<xsl:with-param name="fill" select="$fill"/>
|
||||||
|
</xsl:call-template>
|
||||||
|
<xsl:value-of select="$fill"/>
|
||||||
|
</xsl:if>
|
||||||
|
</xsl:template>
|
||||||
|
|
||||||
</xsl:stylesheet>
|
</xsl:stylesheet>
|
||||||
|
|||||||
+188
-9
@@ -3,7 +3,7 @@
|
|||||||
<!--
|
<!--
|
||||||
xml2dot.xsl - transform Bison XML Report into DOT.
|
xml2dot.xsl - transform Bison XML Report into DOT.
|
||||||
|
|
||||||
Copyright (C) 2007-2012 Free Software Foundation, Inc.
|
Copyright (C) 2007-2015, 2018 Free Software Foundation, Inc.
|
||||||
|
|
||||||
This file is part of Bison, the GNU Compiler Compiler.
|
This file is part of Bison, the GNU Compiler Compiler.
|
||||||
|
|
||||||
@@ -55,7 +55,11 @@
|
|||||||
<xsl:call-template name="escape">
|
<xsl:call-template name="escape">
|
||||||
<xsl:with-param name="subject" select="$filename"/>
|
<xsl:with-param name="subject" select="$filename"/>
|
||||||
</xsl:call-template>
|
</xsl:call-template>
|
||||||
<xsl:text>" { </xsl:text>
|
<xsl:text>" {
|
||||||
|
node [fontname = courier, shape = box, colorscheme = paired6]
|
||||||
|
edge [fontname = courier]
|
||||||
|
|
||||||
|
</xsl:text>
|
||||||
<xsl:apply-templates select="state"/>
|
<xsl:apply-templates select="state"/>
|
||||||
<xsl:text>} </xsl:text>
|
<xsl:text>} </xsl:text>
|
||||||
</xsl:template>
|
</xsl:template>
|
||||||
@@ -64,11 +68,87 @@
|
|||||||
<xsl:call-template name="output-node">
|
<xsl:call-template name="output-node">
|
||||||
<xsl:with-param name="number" select="@number"/>
|
<xsl:with-param name="number" select="@number"/>
|
||||||
<xsl:with-param name="label">
|
<xsl:with-param name="label">
|
||||||
<xsl:value-of select="@number"/>
|
|
||||||
<xsl:apply-templates select="itemset/item"/>
|
<xsl:apply-templates select="itemset/item"/>
|
||||||
</xsl:with-param>
|
</xsl:with-param>
|
||||||
</xsl:call-template>
|
</xsl:call-template>
|
||||||
<xsl:apply-templates select="actions/transitions"/>
|
<xsl:apply-templates select="actions/transitions"/>
|
||||||
|
<xsl:apply-templates select="actions/reductions">
|
||||||
|
<xsl:with-param name="staten">
|
||||||
|
<xsl:value-of select="@number"/>
|
||||||
|
</xsl:with-param>
|
||||||
|
</xsl:apply-templates>
|
||||||
|
</xsl:template>
|
||||||
|
|
||||||
|
<xsl:template match="actions/reductions">
|
||||||
|
<xsl:param name="staten"/>
|
||||||
|
<xsl:for-each select='reduction'>
|
||||||
|
<!-- These variables are needed because the current context can't be
|
||||||
|
refered to directly in XPath expressions. -->
|
||||||
|
<xsl:variable name="rul">
|
||||||
|
<xsl:value-of select="@rule"/>
|
||||||
|
</xsl:variable>
|
||||||
|
<xsl:variable name="ena">
|
||||||
|
<xsl:value-of select="@enabled"/>
|
||||||
|
</xsl:variable>
|
||||||
|
<!-- The foreach's body is protected by this, so that we are actually
|
||||||
|
going to iterate once per reduction rule, and not per lookahead. -->
|
||||||
|
<xsl:if test='not(preceding-sibling::*[@rule=$rul and @enabled=$ena])'>
|
||||||
|
<xsl:variable name="rule">
|
||||||
|
<xsl:choose>
|
||||||
|
<!-- The acceptation state is refered to as 'accept' in the XML, but
|
||||||
|
just as '0' in the DOT. -->
|
||||||
|
<xsl:when test="@rule='accept'">
|
||||||
|
<xsl:text>0</xsl:text>
|
||||||
|
</xsl:when>
|
||||||
|
<xsl:otherwise>
|
||||||
|
<xsl:value-of select="@rule"/>
|
||||||
|
</xsl:otherwise>
|
||||||
|
</xsl:choose>
|
||||||
|
</xsl:variable>
|
||||||
|
|
||||||
|
<!-- The edge's beginning -->
|
||||||
|
<xsl:call-template name="reduction-edge-start">
|
||||||
|
<xsl:with-param name="state" select="$staten"/>
|
||||||
|
<xsl:with-param name="rule" select="$rule"/>
|
||||||
|
<xsl:with-param name="enabled" select="@enabled"/>
|
||||||
|
</xsl:call-template>
|
||||||
|
|
||||||
|
<!-- The edge's tokens -->
|
||||||
|
<!-- Don't show labels for the default action. In other cases, there will
|
||||||
|
always be at least one token, so 'label="[]"' will not occur. -->
|
||||||
|
<xsl:if test='$rule!=0 and not(../reduction[@enabled=$ena and @rule=$rule and @symbol="$default"])'>
|
||||||
|
<xsl:text>label="[</xsl:text>
|
||||||
|
<xsl:for-each select='../reduction[@enabled=$ena and @rule=$rule]'>
|
||||||
|
<xsl:call-template name="escape">
|
||||||
|
<xsl:with-param name="subject" select="@symbol"/>
|
||||||
|
</xsl:call-template>
|
||||||
|
<xsl:if test="position() != last ()">
|
||||||
|
<xsl:text>, </xsl:text>
|
||||||
|
</xsl:if>
|
||||||
|
</xsl:for-each>
|
||||||
|
<xsl:text>]", </xsl:text>
|
||||||
|
</xsl:if>
|
||||||
|
|
||||||
|
<!-- The edge's end -->
|
||||||
|
<xsl:text>style=solid] </xsl:text>
|
||||||
|
|
||||||
|
<!-- The diamond representing the reduction -->
|
||||||
|
<xsl:call-template name="reduction-node">
|
||||||
|
<xsl:with-param name="state" select="$staten"/>
|
||||||
|
<xsl:with-param name="rule" select="$rule"/>
|
||||||
|
<xsl:with-param name="color">
|
||||||
|
<xsl:choose>
|
||||||
|
<xsl:when test='@enabled="true"'>
|
||||||
|
<xsl:text>3</xsl:text>
|
||||||
|
</xsl:when>
|
||||||
|
<xsl:otherwise>
|
||||||
|
<xsl:text>5</xsl:text>
|
||||||
|
</xsl:otherwise>
|
||||||
|
</xsl:choose>
|
||||||
|
</xsl:with-param>
|
||||||
|
</xsl:call-template>
|
||||||
|
</xsl:if>
|
||||||
|
</xsl:for-each>
|
||||||
</xsl:template>
|
</xsl:template>
|
||||||
|
|
||||||
<xsl:template match="actions/transitions">
|
<xsl:template match="actions/transitions">
|
||||||
@@ -76,20 +156,53 @@
|
|||||||
</xsl:template>
|
</xsl:template>
|
||||||
|
|
||||||
<xsl:template match="item">
|
<xsl:template match="item">
|
||||||
|
<xsl:param name="prev-rule-number"
|
||||||
|
select="preceding-sibling::item[1]/@rule-number"/>
|
||||||
<xsl:apply-templates select="key('bison:ruleByNumber', @rule-number)">
|
<xsl:apply-templates select="key('bison:ruleByNumber', @rule-number)">
|
||||||
<xsl:with-param name="point" select="@point"/>
|
<xsl:with-param name="point" select="@point"/>
|
||||||
|
<xsl:with-param name="num" select="@rule-number"/>
|
||||||
|
<xsl:with-param name="prev-lhs"
|
||||||
|
select="key('bison:ruleByNumber', $prev-rule-number)/lhs[text()]"
|
||||||
|
/>
|
||||||
</xsl:apply-templates>
|
</xsl:apply-templates>
|
||||||
<xsl:apply-templates select="lookaheads"/>
|
<xsl:apply-templates select="lookaheads"/>
|
||||||
</xsl:template>
|
</xsl:template>
|
||||||
|
|
||||||
<xsl:template match="rule">
|
<xsl:template match="rule">
|
||||||
<xsl:param name="point"/>
|
<xsl:param name="point"/>
|
||||||
|
<xsl:param name="num"/>
|
||||||
|
<xsl:param name="prev-lhs"/>
|
||||||
<xsl:text> </xsl:text>
|
<xsl:text> </xsl:text>
|
||||||
<xsl:value-of select="lhs"/>
|
<xsl:choose>
|
||||||
<xsl:text> -></xsl:text>
|
<xsl:when test="$num < 10">
|
||||||
|
<xsl:text> </xsl:text>
|
||||||
|
</xsl:when>
|
||||||
|
<xsl:when test="$num < 100">
|
||||||
|
<xsl:text> </xsl:text>
|
||||||
|
</xsl:when>
|
||||||
|
<xsl:otherwise>
|
||||||
|
<xsl:text></xsl:text>
|
||||||
|
</xsl:otherwise>
|
||||||
|
</xsl:choose>
|
||||||
|
<xsl:value-of select="$num"/>
|
||||||
|
<xsl:text> </xsl:text>
|
||||||
|
<xsl:choose>
|
||||||
|
<xsl:when test="$prev-lhs = lhs[text()]">
|
||||||
|
<xsl:call-template name="lpad">
|
||||||
|
<xsl:with-param name="str" select="'|'"/>
|
||||||
|
<xsl:with-param name="pad" select="number(string-length(lhs[text()])) + 1"/>
|
||||||
|
</xsl:call-template>
|
||||||
|
</xsl:when>
|
||||||
|
<xsl:otherwise>
|
||||||
|
<xsl:value-of select="lhs"/>
|
||||||
|
<xsl:text>:</xsl:text>
|
||||||
|
</xsl:otherwise>
|
||||||
|
</xsl:choose>
|
||||||
<xsl:if test="$point = 0">
|
<xsl:if test="$point = 0">
|
||||||
<xsl:text> .</xsl:text>
|
<xsl:text> .</xsl:text>
|
||||||
</xsl:if>
|
</xsl:if>
|
||||||
|
|
||||||
|
<!-- RHS -->
|
||||||
<xsl:for-each select="rhs/symbol|rhs/empty">
|
<xsl:for-each select="rhs/symbol|rhs/empty">
|
||||||
<xsl:apply-templates select="."/>
|
<xsl:apply-templates select="."/>
|
||||||
<xsl:if test="$point = position()">
|
<xsl:if test="$point = position()">
|
||||||
@@ -103,10 +216,12 @@
|
|||||||
<xsl:value-of select="."/>
|
<xsl:value-of select="."/>
|
||||||
</xsl:template>
|
</xsl:template>
|
||||||
|
|
||||||
<xsl:template match="empty"/>
|
<xsl:template match="empty">
|
||||||
|
<xsl:text> %empty</xsl:text>
|
||||||
|
</xsl:template>
|
||||||
|
|
||||||
<xsl:template match="lookaheads">
|
<xsl:template match="lookaheads">
|
||||||
<xsl:text>[</xsl:text>
|
<xsl:text> [</xsl:text>
|
||||||
<xsl:apply-templates select="symbol"/>
|
<xsl:apply-templates select="symbol"/>
|
||||||
<xsl:text>]</xsl:text>
|
<xsl:text>]</xsl:text>
|
||||||
</xsl:template>
|
</xsl:template>
|
||||||
@@ -118,6 +233,50 @@
|
|||||||
</xsl:if>
|
</xsl:if>
|
||||||
</xsl:template>
|
</xsl:template>
|
||||||
|
|
||||||
|
<xsl:template name="reduction-edge-start">
|
||||||
|
<xsl:param name="state"/>
|
||||||
|
<xsl:param name="rule"/>
|
||||||
|
<xsl:param name="enabled"/>
|
||||||
|
|
||||||
|
<xsl:text> </xsl:text>
|
||||||
|
<xsl:value-of select="$state"/>
|
||||||
|
<xsl:text> -> "</xsl:text>
|
||||||
|
<xsl:value-of select="$state"/>
|
||||||
|
<xsl:text>R</xsl:text>
|
||||||
|
<xsl:value-of select="$rule"/>
|
||||||
|
<xsl:if test='$enabled = "false"'>
|
||||||
|
<xsl:text>d</xsl:text>
|
||||||
|
</xsl:if>
|
||||||
|
<xsl:text>" [</xsl:text>
|
||||||
|
</xsl:template>
|
||||||
|
|
||||||
|
<xsl:template name="reduction-node">
|
||||||
|
<xsl:param name="state"/>
|
||||||
|
<xsl:param name="rule"/>
|
||||||
|
<xsl:param name="color"/>
|
||||||
|
|
||||||
|
<xsl:text> "</xsl:text>
|
||||||
|
<xsl:value-of select="$state"/>
|
||||||
|
<xsl:text>R</xsl:text>
|
||||||
|
<xsl:value-of select="$rule"/>
|
||||||
|
<xsl:if test="$color = 5">
|
||||||
|
<xsl:text>d</xsl:text>
|
||||||
|
</xsl:if>
|
||||||
|
<xsl:text>" [label="</xsl:text>
|
||||||
|
<xsl:choose>
|
||||||
|
<xsl:when test="$rule = 0">
|
||||||
|
<xsl:text>Acc", fillcolor=1</xsl:text>
|
||||||
|
</xsl:when>
|
||||||
|
<xsl:otherwise>
|
||||||
|
<xsl:text>R</xsl:text>
|
||||||
|
<xsl:value-of select="$rule"/>
|
||||||
|
<xsl:text>", fillcolor=</xsl:text>
|
||||||
|
<xsl:value-of select="$color"/>
|
||||||
|
</xsl:otherwise>
|
||||||
|
</xsl:choose>
|
||||||
|
<xsl:text>, shape=diamond, style=filled] </xsl:text>
|
||||||
|
</xsl:template>
|
||||||
|
|
||||||
<xsl:template match="transition">
|
<xsl:template match="transition">
|
||||||
<xsl:call-template name="output-edge">
|
<xsl:call-template name="output-edge">
|
||||||
<xsl:with-param name="src" select="../../../@number"/>
|
<xsl:with-param name="src" select="../../../@number"/>
|
||||||
@@ -149,10 +308,13 @@
|
|||||||
<xsl:text> </xsl:text>
|
<xsl:text> </xsl:text>
|
||||||
<xsl:value-of select="$number"/>
|
<xsl:value-of select="$number"/>
|
||||||
<xsl:text> [label="</xsl:text>
|
<xsl:text> [label="</xsl:text>
|
||||||
|
<xsl:text>State </xsl:text>
|
||||||
|
<xsl:value-of select="$number"/>
|
||||||
|
<xsl:text>\n</xsl:text>
|
||||||
<xsl:call-template name="escape">
|
<xsl:call-template name="escape">
|
||||||
<xsl:with-param name="subject" select="$label"/>
|
<xsl:with-param name="subject" select="$label"/>
|
||||||
</xsl:call-template>
|
</xsl:call-template>
|
||||||
<xsl:text>"] </xsl:text>
|
<xsl:text>\l"] </xsl:text>
|
||||||
</xsl:template>
|
</xsl:template>
|
||||||
|
|
||||||
<xsl:template name="output-edge">
|
<xsl:template name="output-edge">
|
||||||
@@ -193,7 +355,7 @@
|
|||||||
</xsl:call-template>
|
</xsl:call-template>
|
||||||
</xsl:with-param>
|
</xsl:with-param>
|
||||||
<xsl:with-param name="search" select="' '"/>
|
<xsl:with-param name="search" select="' '"/>
|
||||||
<xsl:with-param name="replace" select="'\n'"/>
|
<xsl:with-param name="replace" select="'\l'"/>
|
||||||
</xsl:call-template>
|
</xsl:call-template>
|
||||||
</xsl:template>
|
</xsl:template>
|
||||||
|
|
||||||
@@ -219,4 +381,21 @@
|
|||||||
</xsl:choose>
|
</xsl:choose>
|
||||||
</xsl:template>
|
</xsl:template>
|
||||||
|
|
||||||
|
<xsl:template name="lpad">
|
||||||
|
<xsl:param name="str" select="''"/>
|
||||||
|
<xsl:param name="pad" select="0"/>
|
||||||
|
<xsl:variable name="diff" select="$pad - string-length($str)" />
|
||||||
|
<xsl:choose>
|
||||||
|
<xsl:when test="$diff < 0">
|
||||||
|
<xsl:value-of select="$str"/>
|
||||||
|
</xsl:when>
|
||||||
|
<xsl:otherwise>
|
||||||
|
<xsl:call-template name="space">
|
||||||
|
<xsl:with-param name="repeat" select="$diff"/>
|
||||||
|
</xsl:call-template>
|
||||||
|
<xsl:value-of select="$str"/>
|
||||||
|
</xsl:otherwise>
|
||||||
|
</xsl:choose>
|
||||||
|
</xsl:template>
|
||||||
|
|
||||||
</xsl:stylesheet>
|
</xsl:stylesheet>
|
||||||
|
|||||||
+4
-21
@@ -3,7 +3,7 @@
|
|||||||
<!--
|
<!--
|
||||||
xml2text.xsl - transform Bison XML Report into plain text.
|
xml2text.xsl - transform Bison XML Report into plain text.
|
||||||
|
|
||||||
Copyright (C) 2007-2012 Free Software Foundation, Inc.
|
Copyright (C) 2007-2015, 2018 Free Software Foundation, Inc.
|
||||||
|
|
||||||
This file is part of Bison, the GNU Compiler Compiler.
|
This file is part of Bison, the GNU Compiler Compiler.
|
||||||
|
|
||||||
@@ -230,7 +230,7 @@
|
|||||||
<xsl:template match="automaton/state">
|
<xsl:template match="automaton/state">
|
||||||
<xsl:param name="pad"/>
|
<xsl:param name="pad"/>
|
||||||
<xsl:text> </xsl:text>
|
<xsl:text> </xsl:text>
|
||||||
<xsl:text>state </xsl:text>
|
<xsl:text>State </xsl:text>
|
||||||
<xsl:value-of select="@number"/>
|
<xsl:value-of select="@number"/>
|
||||||
<xsl:text> </xsl:text>
|
<xsl:text> </xsl:text>
|
||||||
<xsl:apply-templates select="itemset/item">
|
<xsl:apply-templates select="itemset/item">
|
||||||
@@ -350,12 +350,7 @@
|
|||||||
<xsl:if test="position() = $point + 1">
|
<xsl:if test="position() = $point + 1">
|
||||||
<xsl:text> .</xsl:text>
|
<xsl:text> .</xsl:text>
|
||||||
</xsl:if>
|
</xsl:if>
|
||||||
<xsl:if test="$itemset = 'true' and name(.) != 'empty'">
|
<xsl:apply-templates select="."/>
|
||||||
<xsl:apply-templates select="."/>
|
|
||||||
</xsl:if>
|
|
||||||
<xsl:if test="$itemset != 'true'">
|
|
||||||
<xsl:apply-templates select="."/>
|
|
||||||
</xsl:if>
|
|
||||||
<xsl:if test="position() = last() and position() = $point">
|
<xsl:if test="position() = last() and position() = $point">
|
||||||
<xsl:text> .</xsl:text>
|
<xsl:text> .</xsl:text>
|
||||||
</xsl:if>
|
</xsl:if>
|
||||||
@@ -373,7 +368,7 @@
|
|||||||
</xsl:template>
|
</xsl:template>
|
||||||
|
|
||||||
<xsl:template match="empty">
|
<xsl:template match="empty">
|
||||||
<xsl:text> /* empty */</xsl:text>
|
<xsl:text> %empty</xsl:text>
|
||||||
</xsl:template>
|
</xsl:template>
|
||||||
|
|
||||||
<xsl:template match="lookaheads">
|
<xsl:template match="lookaheads">
|
||||||
@@ -522,18 +517,6 @@
|
|||||||
</xsl:choose>
|
</xsl:choose>
|
||||||
</xsl:template>
|
</xsl:template>
|
||||||
|
|
||||||
<xsl:template name="space">
|
|
||||||
<xsl:param name="repeat">0</xsl:param>
|
|
||||||
<xsl:param name="fill" select="' '"/>
|
|
||||||
<xsl:if test="number($repeat) >= 1">
|
|
||||||
<xsl:call-template name="space">
|
|
||||||
<xsl:with-param name="repeat" select="$repeat - 1"/>
|
|
||||||
<xsl:with-param name="fill" select="$fill"/>
|
|
||||||
</xsl:call-template>
|
|
||||||
<xsl:value-of select="$fill"/>
|
|
||||||
</xsl:if>
|
|
||||||
</xsl:template>
|
|
||||||
|
|
||||||
<xsl:template name="line-wrap">
|
<xsl:template name="line-wrap">
|
||||||
<xsl:param name="line-length"/> <!-- required -->
|
<xsl:param name="line-length"/> <!-- required -->
|
||||||
<xsl:param name="first-line-length" select="$line-length"/>
|
<xsl:param name="first-line-length" select="$line-length"/>
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
<!--
|
<!--
|
||||||
xml2html.xsl - transform Bison XML Report into XHTML.
|
xml2html.xsl - transform Bison XML Report into XHTML.
|
||||||
|
|
||||||
Copyright (C) 2007-2012 Free Software Foundation, Inc.
|
Copyright (C) 2007-2015, 2018 Free Software Foundation, Inc.
|
||||||
|
|
||||||
This file is part of Bison, the GNU Compiler Compiler.
|
This file is part of Bison, the GNU Compiler Compiler.
|
||||||
|
|
||||||
@@ -532,12 +532,7 @@
|
|||||||
<xsl:text> </xsl:text>
|
<xsl:text> </xsl:text>
|
||||||
<span class="point">.</span>
|
<span class="point">.</span>
|
||||||
</xsl:if>
|
</xsl:if>
|
||||||
<xsl:if test="$itemset = 'true' and name(.) != 'empty'">
|
<xsl:apply-templates select="."/>
|
||||||
<xsl:apply-templates select="."/>
|
|
||||||
</xsl:if>
|
|
||||||
<xsl:if test="$itemset != 'true'">
|
|
||||||
<xsl:apply-templates select="."/>
|
|
||||||
</xsl:if>
|
|
||||||
<xsl:if test="position() = last() and position() = $point">
|
<xsl:if test="position() = last() and position() = $point">
|
||||||
<xsl:text> </xsl:text>
|
<xsl:text> </xsl:text>
|
||||||
<span class="point">.</span>
|
<span class="point">.</span>
|
||||||
@@ -563,7 +558,7 @@
|
|||||||
</xsl:template>
|
</xsl:template>
|
||||||
|
|
||||||
<xsl:template match="empty">
|
<xsl:template match="empty">
|
||||||
<xsl:text> ε</xsl:text>
|
<xsl:text> %empty</xsl:text>
|
||||||
</xsl:template>
|
</xsl:template>
|
||||||
|
|
||||||
<xsl:template match="lookaheads">
|
<xsl:template match="lookaheads">
|
||||||
|
|||||||
+175
-245
@@ -1,11 +1,11 @@
|
|||||||
-*- C -*-
|
-*- C -*-
|
||||||
# Yacc compatible skeleton for Bison
|
# Yacc compatible skeleton for Bison
|
||||||
|
|
||||||
# Copyright (C) 1984, 1989-1990, 2000-2012 Free Software Foundation,
|
# Copyright (C) 1984, 1989-1990, 2000-2015, 2018 Free Software
|
||||||
# Inc.
|
# Foundation, Inc.
|
||||||
|
|
||||||
m4_pushdef([b4_copyright_years],
|
m4_pushdef([b4_copyright_years],
|
||||||
[1984, 1989-1990, 2000-2012])
|
[1984, 1989-1990, 2000-2015, 2018])
|
||||||
|
|
||||||
# This program is free software: you can redistribute it and/or modify
|
# 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
|
# it under the terms of the GNU General Public License as published by
|
||||||
@@ -67,36 +67,39 @@ m4_define_default([b4_stack_depth_init], [200])
|
|||||||
## ------------------------ ##
|
## ------------------------ ##
|
||||||
|
|
||||||
b4_percent_define_default([[api.pure]], [[false]])
|
b4_percent_define_default([[api.pure]], [[false]])
|
||||||
b4_define_flag_if([pure])
|
b4_percent_define_check_values([[[[api.pure]],
|
||||||
m4_define([b4_pure_flag],
|
[[false]], [[true]], [[]], [[full]]]])
|
||||||
[b4_percent_define_flag_if([[api.pure]], [[1]], [[0]])])
|
|
||||||
|
|
||||||
# b4_yacc_pure_if(IF-TRUE, IF-FALSE)
|
m4_define([b4_pure_flag], [[0]])
|
||||||
# ----------------------------------
|
m4_case(b4_percent_define_get([[api.pure]]),
|
||||||
# Expand IF-TRUE, if %pure-parser and %parse-param, IF-FALSE otherwise.
|
[false], [m4_define([b4_pure_flag], [[0]])],
|
||||||
m4_define([b4_yacc_pure_if],
|
[true], [m4_define([b4_pure_flag], [[1]])],
|
||||||
[b4_pure_if([m4_ifset([b4_parse_param],
|
[], [m4_define([b4_pure_flag], [[1]])],
|
||||||
[$1], [$2])],
|
[full], [m4_define([b4_pure_flag], [[2]])])
|
||||||
[$2])])
|
|
||||||
|
|
||||||
|
m4_define([b4_pure_if],
|
||||||
|
[m4_case(b4_pure_flag,
|
||||||
|
[0], [$2],
|
||||||
|
[1], [$1],
|
||||||
|
[2], [$1])])
|
||||||
|
[m4_fatal([invalid api.pure value: ]$1)])])
|
||||||
|
|
||||||
|
# b4_yyerror_arg_loc_if(ARG)
|
||||||
|
# --------------------------
|
||||||
|
# Expand ARG iff yyerror is to be given a location as argument.
|
||||||
|
m4_define([b4_yyerror_arg_loc_if],
|
||||||
|
[b4_locations_if([m4_case(b4_pure_flag,
|
||||||
|
[1], [m4_ifset([b4_parse_param], [$1])],
|
||||||
|
[2], [$1])])])
|
||||||
|
|
||||||
# b4_yyerror_args
|
# b4_yyerror_args
|
||||||
# ---------------
|
# ---------------
|
||||||
# Arguments passed to yyerror: user args plus yylloc.
|
# Arguments passed to yyerror: user args plus yylloc.
|
||||||
m4_define([b4_yyerror_args],
|
m4_define([b4_yyerror_args],
|
||||||
[b4_yacc_pure_if([b4_locations_if([&yylloc, ])])dnl
|
[b4_yyerror_arg_loc_if([&yylloc, ])dnl
|
||||||
m4_ifset([b4_parse_param], [b4_c_args(b4_parse_param), ])])
|
m4_ifset([b4_parse_param], [b4_args(b4_parse_param), ])])
|
||||||
|
|
||||||
|
|
||||||
# b4_lex_param
|
|
||||||
# ------------
|
|
||||||
# Accumulate in b4_lex_param all the yylex arguments.
|
|
||||||
# b4_lex_param arrives quoted twice, but we want to keep only one level.
|
|
||||||
m4_define([b4_lex_param],
|
|
||||||
m4_dquote(b4_pure_if([[[[YYSTYPE *]], [[&yylval]]][]dnl
|
|
||||||
b4_locations_if([, [[YYLTYPE *], [&yylloc]]])m4_ifdef([b4_lex_param], [, ])])dnl
|
|
||||||
m4_ifdef([b4_lex_param], b4_lex_param)))
|
|
||||||
|
|
||||||
|
|
||||||
## ------------ ##
|
## ------------ ##
|
||||||
## Data Types. ##
|
## Data Types. ##
|
||||||
@@ -115,7 +118,7 @@ m4_define([b4_int_type],
|
|||||||
b4_ints_in($@, [0], [65535]), [1], [yytype_uint16],
|
b4_ints_in($@, [0], [65535]), [1], [yytype_uint16],
|
||||||
b4_ints_in($@, [-32768], [32767]), [1], [yytype_int16],
|
b4_ints_in($@, [-32768], [32767]), [1], [yytype_int16],
|
||||||
|
|
||||||
m4_eval([0 <= $1]), [1], [unsigned int],
|
m4_eval([0 <= $1]), [1], [unsigned],
|
||||||
|
|
||||||
[int])])
|
[int])])
|
||||||
|
|
||||||
@@ -140,7 +143,6 @@ m4_define([b4_rhs_value],
|
|||||||
[b4_symbol_value([yyvsp@{b4_subtract([$2], [$1])@}], [$3])])
|
[b4_symbol_value([yyvsp@{b4_subtract([$2], [$1])@}], [$3])])
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
## ----------- ##
|
## ----------- ##
|
||||||
## Locations. ##
|
## Locations. ##
|
||||||
## ----------- ##
|
## ----------- ##
|
||||||
@@ -172,12 +174,20 @@ m4_define([b4_declare_scanner_communication_variables], [[
|
|||||||
/* The lookahead symbol. */
|
/* The lookahead symbol. */
|
||||||
int yychar;
|
int yychar;
|
||||||
|
|
||||||
|
]b4_pure_if([[
|
||||||
/* The semantic value of the lookahead symbol. */
|
/* The semantic value of the lookahead symbol. */
|
||||||
YYSTYPE yylval;]b4_locations_if([[
|
/* Default value used for initialization, for pacifying older GCCs
|
||||||
|
or non-GCC compilers. */
|
||||||
|
YY_INITIAL_VALUE (static YYSTYPE yyval_default;)
|
||||||
|
YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default);]b4_locations_if([[
|
||||||
|
|
||||||
/* Location data for the lookahead symbol. */
|
/* Location data for the lookahead symbol. */
|
||||||
YYLTYPE yylloc;]])b4_pure_if([], [[
|
static YYLTYPE yyloc_default]b4_yyloc_default[;
|
||||||
|
YYLTYPE yylloc = yyloc_default;]])],
|
||||||
|
[[/* The semantic value of the lookahead symbol. */
|
||||||
|
YYSTYPE yylval;]b4_locations_if([[
|
||||||
|
/* Location data for the lookahead symbol. */
|
||||||
|
YYLTYPE yylloc]b4_yyloc_default[;]])[
|
||||||
/* Number of syntax errors so far. */
|
/* Number of syntax errors so far. */
|
||||||
int yynerrs;]])])
|
int yynerrs;]])])
|
||||||
|
|
||||||
@@ -195,9 +205,9 @@ m4_define([b4_declare_parser_state_variables], [b4_pure_if([[
|
|||||||
int yyerrstatus;
|
int yyerrstatus;
|
||||||
|
|
||||||
/* The stacks and their tools:
|
/* The stacks and their tools:
|
||||||
`yyss': related to states.
|
'yyss': related to states.
|
||||||
`yyvs': related to semantic values.]b4_locations_if([[
|
'yyvs': related to semantic values.]b4_locations_if([[
|
||||||
`yyls': related to locations.]])[
|
'yyls': related to locations.]])[
|
||||||
|
|
||||||
Refer to the stacks through separate pointers, to allow yyoverflow
|
Refer to the stacks through separate pointers, to allow yyoverflow
|
||||||
to reallocate them elsewhere. */
|
to reallocate them elsewhere. */
|
||||||
@@ -239,19 +249,19 @@ enum { YYPUSH_MORE = 4 };
|
|||||||
|
|
||||||
typedef struct ]b4_prefix[pstate ]b4_prefix[pstate;
|
typedef struct ]b4_prefix[pstate ]b4_prefix[pstate;
|
||||||
|
|
||||||
]b4_pull_if([b4_c_function_decl([b4_prefix[parse]], [[int]], b4_parse_param)
|
]b4_pull_if([b4_function_declare([b4_prefix[parse]], [[int]], b4_parse_param)
|
||||||
])b4_c_function_decl([b4_prefix[push_parse]], [[int]],
|
])b4_function_declare([b4_prefix[push_parse]], [[int]],
|
||||||
[[b4_prefix[pstate *ps]], [[ps]]]b4_pure_if([,
|
[[b4_prefix[pstate *ps]], [[ps]]]b4_pure_if([,
|
||||||
[[[int pushed_char]], [[pushed_char]]],
|
[[[int pushed_char]], [[pushed_char]]],
|
||||||
[[b4_api_PREFIX[STYPE const *pushed_val]], [[pushed_val]]]b4_locations_if([,
|
[[b4_api_PREFIX[STYPE const *pushed_val]], [[pushed_val]]]b4_locations_if([,
|
||||||
[[b4_api_PREFIX[LTYPE const *pushed_loc]], [[pushed_loc]]]])])m4_ifset([b4_parse_param], [,
|
[[b4_api_PREFIX[LTYPE *pushed_loc]], [[pushed_loc]]]])])m4_ifset([b4_parse_param], [,
|
||||||
b4_parse_param]))
|
b4_parse_param]))
|
||||||
b4_pull_if([b4_c_function_decl([b4_prefix[pull_parse]], [[int]],
|
b4_pull_if([b4_function_declare([b4_prefix[pull_parse]], [[int]],
|
||||||
[[b4_prefix[pstate *ps]], [[ps]]]m4_ifset([b4_parse_param], [,
|
[[b4_prefix[pstate *ps]], [[ps]]]m4_ifset([b4_parse_param], [,
|
||||||
b4_parse_param]))])
|
b4_parse_param]))])
|
||||||
b4_c_function_decl([b4_prefix[pstate_new]], [b4_prefix[pstate *]],
|
b4_function_declare([b4_prefix[pstate_new]], [b4_prefix[pstate *]],
|
||||||
[[[void]], []])
|
[[[void]], []])
|
||||||
b4_c_function_decl([b4_prefix[pstate_delete]], [[void]],
|
b4_function_declare([b4_prefix[pstate_delete]], [[void]],
|
||||||
[[b4_prefix[pstate *ps]], [[ps]]])dnl
|
[[b4_prefix[pstate *ps]], [[ps]]])dnl
|
||||||
])
|
])
|
||||||
|
|
||||||
@@ -259,13 +269,7 @@ b4_c_function_decl([b4_prefix[pstate_delete]], [[void]],
|
|||||||
# -------------------
|
# -------------------
|
||||||
# When not the push parser.
|
# When not the push parser.
|
||||||
m4_define([b4_declare_yyparse_],
|
m4_define([b4_declare_yyparse_],
|
||||||
[[#ifdef YYPARSE_PARAM
|
[b4_function_declare(b4_prefix[parse], [int], b4_parse_param)])
|
||||||
]b4_c_function_decl(b4_prefix[parse], [int],
|
|
||||||
[[void *YYPARSE_PARAM], [YYPARSE_PARAM]])[
|
|
||||||
#else /* ! YYPARSE_PARAM */
|
|
||||||
]b4_c_function_decl(b4_prefix[parse], [int], b4_parse_param)[
|
|
||||||
#endif /* ! YYPARSE_PARAM */]dnl
|
|
||||||
])
|
|
||||||
|
|
||||||
|
|
||||||
# b4_declare_yyparse
|
# b4_declare_yyparse
|
||||||
@@ -295,10 +299,7 @@ m4_define([b4_shared_declarations],
|
|||||||
## Output files. ##
|
## Output files. ##
|
||||||
## -------------- ##
|
## -------------- ##
|
||||||
|
|
||||||
# We do want M4 expansion after # for CPP macros.
|
b4_output_begin([b4_parser_file_name])
|
||||||
m4_changecom()
|
|
||||||
m4_divert_push(0)dnl
|
|
||||||
@output(b4_parser_file_name@)@
|
|
||||||
b4_copyright([Bison implementation for Yacc-like parsers in C])[
|
b4_copyright([Bison implementation for Yacc-like parsers in C])[
|
||||||
|
|
||||||
/* C LALR(1) parser skeleton written by Richard Stallman, by
|
/* C LALR(1) parser skeleton written by Richard Stallman, by
|
||||||
@@ -327,11 +328,12 @@ m4_if(b4_api_prefix, [yy], [],
|
|||||||
#define yypstate ]b4_prefix[pstate]])[
|
#define yypstate ]b4_prefix[pstate]])[
|
||||||
#define yylex ]b4_prefix[lex
|
#define yylex ]b4_prefix[lex
|
||||||
#define yyerror ]b4_prefix[error
|
#define yyerror ]b4_prefix[error
|
||||||
#define yylval ]b4_prefix[lval
|
|
||||||
#define yychar ]b4_prefix[char
|
|
||||||
#define yydebug ]b4_prefix[debug
|
#define yydebug ]b4_prefix[debug
|
||||||
#define yynerrs ]b4_prefix[nerrs]b4_locations_if([[
|
#define yynerrs ]b4_prefix[nerrs
|
||||||
#define yylloc ]b4_prefix[lloc]])])[
|
]]b4_pure_if([], [[
|
||||||
|
#define yylval ]b4_prefix[lval
|
||||||
|
#define yychar ]b4_prefix[char]b4_locations_if([[
|
||||||
|
#define yylloc ]b4_prefix[lloc]])]))[
|
||||||
|
|
||||||
/* Copy the first part of user declarations. */
|
/* Copy the first part of user declarations. */
|
||||||
]b4_user_pre_prologue[
|
]b4_user_pre_prologue[
|
||||||
@@ -346,9 +348,11 @@ m4_if(b4_api_prefix, [yy], [],
|
|||||||
# define YYERROR_VERBOSE ]b4_error_verbose_if([1], [0])[
|
# define YYERROR_VERBOSE ]b4_error_verbose_if([1], [0])[
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* In a future release of Bison, this section will be replaced
|
]m4_ifval(m4_quote(b4_spec_defines_file),
|
||||||
|
[[/* In a future release of Bison, this section will be replaced
|
||||||
by #include "@basename(]b4_spec_defines_file[@)". */
|
by #include "@basename(]b4_spec_defines_file[@)". */
|
||||||
]b4_shared_declarations[
|
]])dnl
|
||||||
|
b4_shared_declarations[
|
||||||
|
|
||||||
/* Copy the second part of user declarations. */
|
/* Copy the second part of user declarations. */
|
||||||
]b4_user_post_prologue
|
]b4_user_post_prologue
|
||||||
@@ -366,22 +370,20 @@ typedef unsigned char yytype_uint8;
|
|||||||
|
|
||||||
#ifdef YYTYPE_INT8
|
#ifdef YYTYPE_INT8
|
||||||
typedef YYTYPE_INT8 yytype_int8;
|
typedef YYTYPE_INT8 yytype_int8;
|
||||||
#elif ]b4_c_modern[
|
|
||||||
typedef signed char yytype_int8;
|
|
||||||
#else
|
#else
|
||||||
typedef short int yytype_int8;
|
typedef signed char yytype_int8;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef YYTYPE_UINT16
|
#ifdef YYTYPE_UINT16
|
||||||
typedef YYTYPE_UINT16 yytype_uint16;
|
typedef YYTYPE_UINT16 yytype_uint16;
|
||||||
#else
|
#else
|
||||||
typedef unsigned short int yytype_uint16;
|
typedef unsigned short yytype_uint16;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef YYTYPE_INT16
|
#ifdef YYTYPE_INT16
|
||||||
typedef YYTYPE_INT16 yytype_int16;
|
typedef YYTYPE_INT16 yytype_int16;
|
||||||
#else
|
#else
|
||||||
typedef short int yytype_int16;
|
typedef short yytype_int16;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef YYSIZE_T
|
#ifndef YYSIZE_T
|
||||||
@@ -389,11 +391,11 @@ typedef short int yytype_int16;
|
|||||||
# define YYSIZE_T __SIZE_TYPE__
|
# define YYSIZE_T __SIZE_TYPE__
|
||||||
# elif defined size_t
|
# elif defined size_t
|
||||||
# define YYSIZE_T size_t
|
# define YYSIZE_T size_t
|
||||||
# elif ! defined YYSIZE_T && ]b4_c_modern[
|
# elif ! defined YYSIZE_T
|
||||||
# include <stddef.h> /* INFRINGES ON USER NAME SPACE */
|
# include <stddef.h> /* INFRINGES ON USER NAME SPACE */
|
||||||
# define YYSIZE_T size_t
|
# define YYSIZE_T size_t
|
||||||
# else
|
# else
|
||||||
# define YYSIZE_T unsigned int
|
# define YYSIZE_T unsigned
|
||||||
# endif
|
# endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -403,30 +405,15 @@ typedef short int yytype_int16;
|
|||||||
# if defined YYENABLE_NLS && YYENABLE_NLS
|
# if defined YYENABLE_NLS && YYENABLE_NLS
|
||||||
# if ENABLE_NLS
|
# if ENABLE_NLS
|
||||||
# include <libintl.h> /* INFRINGES ON USER NAME SPACE */
|
# include <libintl.h> /* INFRINGES ON USER NAME SPACE */
|
||||||
# define YY_(msgid) dgettext ("bison-runtime", msgid)
|
# define YY_(Msgid) dgettext ("bison-runtime", Msgid)
|
||||||
# endif
|
# endif
|
||||||
# endif
|
# endif
|
||||||
# ifndef YY_
|
# ifndef YY_
|
||||||
# define YY_(msgid) msgid
|
# define YY_(Msgid) Msgid
|
||||||
# endif
|
# endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Suppress unused-variable warnings by "using" E. */
|
]b4_attribute_define[
|
||||||
#if ! defined lint || defined __GNUC__
|
|
||||||
# define YYUSE(e) ((void) (e))
|
|
||||||
#else
|
|
||||||
# define YYUSE(e) /* empty */
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Identity function, used to suppress warnings about constant conditions. */
|
|
||||||
#ifndef lint
|
|
||||||
# define YYID(n) (n)
|
|
||||||
#else
|
|
||||||
]b4_c_function_def([YYID], [static int], [[int yyi], [yyi]])[
|
|
||||||
{
|
|
||||||
return yyi;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if ]b4_lac_if([[1]], [[! defined yyoverflow || YYERROR_VERBOSE]])[
|
#if ]b4_lac_if([[1]], [[! defined yyoverflow || YYERROR_VERBOSE]])[
|
||||||
|
|
||||||
@@ -446,7 +433,7 @@ b4_push_if([], [b4_lac_if([], [[
|
|||||||
# define alloca _alloca
|
# define alloca _alloca
|
||||||
# else
|
# else
|
||||||
# define YYSTACK_ALLOC alloca
|
# define YYSTACK_ALLOC alloca
|
||||||
# if ! defined _ALLOCA_H && ! defined EXIT_SUCCESS && ]b4_c_modern[
|
# if ! defined _ALLOCA_H && ! defined EXIT_SUCCESS
|
||||||
# include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
|
# include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
|
||||||
/* Use EXIT_SUCCESS as a witness for stdlib.h. */
|
/* Use EXIT_SUCCESS as a witness for stdlib.h. */
|
||||||
# ifndef EXIT_SUCCESS
|
# ifndef EXIT_SUCCESS
|
||||||
@@ -458,8 +445,8 @@ b4_push_if([], [b4_lac_if([], [[
|
|||||||
# endif]])])[
|
# endif]])])[
|
||||||
|
|
||||||
# ifdef YYSTACK_ALLOC
|
# ifdef YYSTACK_ALLOC
|
||||||
/* Pacify GCC's `empty if-body' warning. */
|
/* Pacify GCC's 'empty if-body' warning. */
|
||||||
# define YYSTACK_FREE(Ptr) do { /* empty */; } while (YYID (0))
|
# define YYSTACK_FREE(Ptr) do { /* empty */; } while (0)
|
||||||
# ifndef YYSTACK_ALLOC_MAXIMUM
|
# ifndef YYSTACK_ALLOC_MAXIMUM
|
||||||
/* The OS might guarantee only one guard page at the bottom of the stack,
|
/* The OS might guarantee only one guard page at the bottom of the stack,
|
||||||
and a page size can be as small as 4096 bytes. So we cannot safely
|
and a page size can be as small as 4096 bytes. So we cannot safely
|
||||||
@@ -483,13 +470,13 @@ b4_push_if([], [b4_lac_if([], [[
|
|||||||
# endif
|
# endif
|
||||||
# ifndef YYMALLOC
|
# ifndef YYMALLOC
|
||||||
# define YYMALLOC malloc
|
# define YYMALLOC malloc
|
||||||
# if ! defined malloc && ! defined EXIT_SUCCESS && ]b4_c_modern[
|
# if ! defined malloc && ! defined EXIT_SUCCESS
|
||||||
void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */
|
void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */
|
||||||
# endif
|
# endif
|
||||||
# endif
|
# endif
|
||||||
# ifndef YYFREE
|
# ifndef YYFREE
|
||||||
# define YYFREE free
|
# define YYFREE free
|
||||||
# if ! defined free && ! defined EXIT_SUCCESS && ]b4_c_modern[
|
# if ! defined free && ! defined EXIT_SUCCESS
|
||||||
void free (void *); /* INFRINGES ON USER NAME SPACE */
|
void free (void *); /* INFRINGES ON USER NAME SPACE */
|
||||||
# endif
|
# endif
|
||||||
# endif
|
# endif
|
||||||
@@ -540,7 +527,7 @@ union yyalloc
|
|||||||
yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
|
yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
|
||||||
yyptr += yynewbytes / sizeof (*yyptr); \
|
yyptr += yynewbytes / sizeof (*yyptr); \
|
||||||
} \
|
} \
|
||||||
while (YYID (0))
|
while (0)
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -559,7 +546,7 @@ union yyalloc
|
|||||||
for (yyi = 0; yyi < (Count); yyi++) \
|
for (yyi = 0; yyi < (Count); yyi++) \
|
||||||
(Dst)[yyi] = (Src)[yyi]; \
|
(Dst)[yyi] = (Src)[yyi]; \
|
||||||
} \
|
} \
|
||||||
while (YYID (0))
|
while (0)
|
||||||
# endif
|
# endif
|
||||||
# endif
|
# endif
|
||||||
#endif /* !YYCOPY_NEEDED */
|
#endif /* !YYCOPY_NEEDED */
|
||||||
@@ -584,7 +571,7 @@ union yyalloc
|
|||||||
#define YYMAXUTOK ]b4_user_token_number_max[
|
#define YYMAXUTOK ]b4_user_token_number_max[
|
||||||
|
|
||||||
#define YYTRANSLATE(YYX) \
|
#define YYTRANSLATE(YYX) \
|
||||||
((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
|
((unsigned) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
|
||||||
|
|
||||||
/* YYTRANSLATE[TOKEN-NUM] -- Symbol number corresponding to TOKEN-NUM
|
/* YYTRANSLATE[TOKEN-NUM] -- Symbol number corresponding to TOKEN-NUM
|
||||||
as returned by yylex, without out-of-bounds checking. */
|
as returned by yylex, without out-of-bounds checking. */
|
||||||
@@ -595,7 +582,7 @@ static const ]b4_int_type_for([b4_translate])[ yytranslate[] =
|
|||||||
|
|
||||||
#if ]b4_api_PREFIX[DEBUG
|
#if ]b4_api_PREFIX[DEBUG
|
||||||
]b4_integral_parser_table_define([rline], [b4_rline],
|
]b4_integral_parser_table_define([rline], [b4_rline],
|
||||||
[YYRLINE[YYN] -- Source line where rule number YYN was defined.])[
|
[[YYRLINE[YYN] -- Source line where rule number YYN was defined.]])[
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if ]b4_api_PREFIX[DEBUG || YYERROR_VERBOSE || ]b4_token_table_flag[
|
#if ]b4_api_PREFIX[DEBUG || YYERROR_VERBOSE || ]b4_token_table_flag[
|
||||||
@@ -618,13 +605,13 @@ static const ]b4_int_type_for([b4_toknum])[ yytoknum[] =
|
|||||||
|
|
||||||
#define YYPACT_NINF ]b4_pact_ninf[
|
#define YYPACT_NINF ]b4_pact_ninf[
|
||||||
|
|
||||||
#define yypact_value_is_default(yystate) \
|
#define yypact_value_is_default(Yystate) \
|
||||||
]b4_table_value_equals([[pact]], [[yystate]], [b4_pact_ninf])[
|
]b4_table_value_equals([[pact]], [[Yystate]], [b4_pact_ninf])[
|
||||||
|
|
||||||
#define YYTABLE_NINF ]b4_table_ninf[
|
#define YYTABLE_NINF ]b4_table_ninf[
|
||||||
|
|
||||||
#define yytable_value_is_error(yytable_value) \
|
#define yytable_value_is_error(Yytable_value) \
|
||||||
]b4_table_value_equals([[table]], [[yytable_value]], [b4_table_ninf])[
|
]b4_table_value_equals([[table]], [[Yytable_value]], [b4_table_ninf])[
|
||||||
|
|
||||||
]b4_parser_tables_define[
|
]b4_parser_tables_define[
|
||||||
|
|
||||||
@@ -638,21 +625,6 @@ static const ]b4_int_type_for([b4_toknum])[ yytoknum[] =
|
|||||||
#define YYERROR goto yyerrorlab
|
#define YYERROR goto yyerrorlab
|
||||||
|
|
||||||
|
|
||||||
/* Like YYERROR except do call yyerror. This remains here temporarily
|
|
||||||
to ease the transition to the new meaning of YYERROR, for GCC.
|
|
||||||
Once GCC version 2 has supplanted version 1, this can go. However,
|
|
||||||
YYFAIL appears to be in use. Nevertheless, it is formally deprecated
|
|
||||||
in Bison 2.4.2's NEWS entry, where a plan to phase it out is
|
|
||||||
discussed. */
|
|
||||||
|
|
||||||
#define YYFAIL goto yyerrlab
|
|
||||||
#if defined YYFAIL
|
|
||||||
/* This is here to suppress warnings from the GCC cpp's
|
|
||||||
-Wunused-macros. Normally we don't worry about that warning, but
|
|
||||||
some users do, and we want to make it easy for users to remove
|
|
||||||
YYFAIL uses, which will produce warnings from Bison 2.5. */
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#define YYRECOVERING() (!!yyerrstatus)
|
#define YYRECOVERING() (!!yyerrstatus)
|
||||||
|
|
||||||
#define YYBACKUP(Token, Value) \
|
#define YYBACKUP(Token, Value) \
|
||||||
@@ -671,46 +643,16 @@ do \
|
|||||||
yyerror (]b4_yyerror_args[YY_("syntax error: cannot back up")); \
|
yyerror (]b4_yyerror_args[YY_("syntax error: cannot back up")); \
|
||||||
YYERROR; \
|
YYERROR; \
|
||||||
} \
|
} \
|
||||||
while (YYID (0))
|
while (0)
|
||||||
|
|
||||||
|
|
||||||
|
/* Error token number */
|
||||||
#define YYTERROR 1
|
#define YYTERROR 1
|
||||||
#define YYERRCODE 256
|
#define YYERRCODE 256
|
||||||
|
|
||||||
]b4_locations_if([[
|
]b4_locations_if([[
|
||||||
]b4_yylloc_default_define[
|
]b4_yylloc_default_define[
|
||||||
#define YYRHSLOC(Rhs, K) ((Rhs)[K])
|
#define YYRHSLOC(Rhs, K) ((Rhs)[K])
|
||||||
|
]])[
|
||||||
/* YY_LOCATION_PRINT -- Print the location on the stream.
|
|
||||||
This macro was not mandated originally: define only if we know
|
|
||||||
we won't break user code: when these are the locations we know. */
|
|
||||||
|
|
||||||
#ifndef YY_LOCATION_PRINT
|
|
||||||
# if defined ]b4_api_PREFIX[LTYPE_IS_TRIVIAL && ]b4_api_PREFIX[LTYPE_IS_TRIVIAL
|
|
||||||
# define YY_LOCATION_PRINT(File, Loc) \
|
|
||||||
fprintf (File, "%d.%d-%d.%d", \
|
|
||||||
(Loc).first_line, (Loc).first_column, \
|
|
||||||
(Loc).last_line, (Loc).last_column)
|
|
||||||
# else
|
|
||||||
# define YY_LOCATION_PRINT(File, Loc) ((void) 0)
|
|
||||||
# endif
|
|
||||||
#endif]], [[
|
|
||||||
|
|
||||||
|
|
||||||
/* This macro is provided for backward compatibility. */
|
|
||||||
|
|
||||||
#ifndef YY_LOCATION_PRINT
|
|
||||||
# define YY_LOCATION_PRINT(File, Loc) ((void) 0)
|
|
||||||
#endif]])[
|
|
||||||
|
|
||||||
|
|
||||||
/* YYLEX -- calling `yylex' with the right arguments. */
|
|
||||||
|
|
||||||
#ifdef YYLEX_PARAM
|
|
||||||
# define YYLEX yylex (]b4_pure_if([&yylval[]b4_locations_if([, &yylloc]), ])[YYLEX_PARAM)
|
|
||||||
#else
|
|
||||||
# define YYLEX ]b4_c_function_call([yylex], [int], b4_lex_param)[
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Enable debugging if requested. */
|
/* Enable debugging if requested. */
|
||||||
#if ]b4_api_PREFIX[DEBUG
|
#if ]b4_api_PREFIX[DEBUG
|
||||||
@@ -724,7 +666,9 @@ while (YYID (0))
|
|||||||
do { \
|
do { \
|
||||||
if (yydebug) \
|
if (yydebug) \
|
||||||
YYFPRINTF Args; \
|
YYFPRINTF Args; \
|
||||||
} while (YYID (0))
|
} while (0)
|
||||||
|
|
||||||
|
]b4_yy_location_print_define[
|
||||||
|
|
||||||
# define YY_SYMBOL_PRINT(Title, Type, Value, Location) \
|
# define YY_SYMBOL_PRINT(Title, Type, Value, Location) \
|
||||||
do { \
|
do { \
|
||||||
@@ -735,16 +679,16 @@ do { \
|
|||||||
Type, Value]b4_locations_if([, Location])[]b4_user_args[); \
|
Type, Value]b4_locations_if([, Location])[]b4_user_args[); \
|
||||||
YYFPRINTF (stderr, "\n"); \
|
YYFPRINTF (stderr, "\n"); \
|
||||||
} \
|
} \
|
||||||
} while (YYID (0))
|
} while (0)
|
||||||
|
|
||||||
]b4_yy_symbol_print_generate([b4_c_function_def])[
|
]b4_yy_symbol_print_define[
|
||||||
|
|
||||||
/*------------------------------------------------------------------.
|
/*------------------------------------------------------------------.
|
||||||
| yy_stack_print -- Print the state stack from its BOTTOM up to its |
|
| yy_stack_print -- Print the state stack from its BOTTOM up to its |
|
||||||
| TOP (included). |
|
| TOP (included). |
|
||||||
`------------------------------------------------------------------*/
|
`------------------------------------------------------------------*/
|
||||||
|
|
||||||
]b4_c_function_def([yy_stack_print], [static void],
|
]b4_function_define([yy_stack_print], [static void],
|
||||||
[[yytype_int16 *yybottom], [yybottom]],
|
[[yytype_int16 *yybottom], [yybottom]],
|
||||||
[[yytype_int16 *yytop], [yytop]])[
|
[[yytype_int16 *yytop], [yytop]])[
|
||||||
{
|
{
|
||||||
@@ -761,21 +705,21 @@ do { \
|
|||||||
do { \
|
do { \
|
||||||
if (yydebug) \
|
if (yydebug) \
|
||||||
yy_stack_print ((Bottom), (Top)); \
|
yy_stack_print ((Bottom), (Top)); \
|
||||||
} while (YYID (0))
|
} while (0)
|
||||||
|
|
||||||
|
|
||||||
/*------------------------------------------------.
|
/*------------------------------------------------.
|
||||||
| Report that the YYRULE is going to be reduced. |
|
| Report that the YYRULE is going to be reduced. |
|
||||||
`------------------------------------------------*/
|
`------------------------------------------------*/
|
||||||
|
|
||||||
]b4_c_function_def([yy_reduce_print], [static void],
|
]b4_function_define([yy_reduce_print], [static void],
|
||||||
[[yytype_int16 *yyssp], [yyssp]],
|
[[yytype_int16 *yyssp], [yyssp]],
|
||||||
[[YYSTYPE *yyvsp], [yyvsp]],
|
[[YYSTYPE *yyvsp], [yyvsp]],
|
||||||
b4_locations_if([[[YYLTYPE *yylsp], [yylsp]],
|
b4_locations_if([[[YYLTYPE *yylsp], [yylsp]],
|
||||||
])[[int yyrule], [yyrule]]m4_ifset([b4_parse_param], [,
|
])[[int yyrule], [yyrule]]m4_ifset([b4_parse_param], [,
|
||||||
b4_parse_param]))[
|
b4_parse_param]))[
|
||||||
{
|
{
|
||||||
unsigned long int yylno = yyrline[yyrule];
|
unsigned long yylno = yyrline[yyrule];
|
||||||
int yynrhs = yyr2[yyrule];
|
int yynrhs = yyr2[yyrule];
|
||||||
int yyi;
|
int yyi;
|
||||||
YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n",
|
YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n",
|
||||||
@@ -797,7 +741,7 @@ do { \
|
|||||||
do { \
|
do { \
|
||||||
if (yydebug) \
|
if (yydebug) \
|
||||||
yy_reduce_print (yyssp, yyvsp, ]b4_locations_if([yylsp, ])[Rule]b4_user_args[); \
|
yy_reduce_print (yyssp, yyvsp, ]b4_locations_if([yylsp, ])[Rule]b4_user_args[); \
|
||||||
} while (YYID (0))
|
} while (0)
|
||||||
|
|
||||||
/* Nonzero means print parse trace. It is left uninitialized so that
|
/* Nonzero means print parse trace. It is left uninitialized so that
|
||||||
multiple parsers can coexist. */
|
multiple parsers can coexist. */
|
||||||
@@ -883,7 +827,7 @@ yy_lac_stack_realloc (YYSIZE_T *yycapacity, YYSIZE_T yyadd,
|
|||||||
*yycapacity = yyalloc;]m4_if(b4_percent_define_get([[parse.lac.memory-trace]]),
|
*yycapacity = yyalloc;]m4_if(b4_percent_define_get([[parse.lac.memory-trace]]),
|
||||||
[full], [[
|
[full], [[
|
||||||
YYDPRINTF ((stderr, "%srealloc to %lu%s", yydebug_prefix,
|
YYDPRINTF ((stderr, "%srealloc to %lu%s", yydebug_prefix,
|
||||||
(unsigned long int) yyalloc, yydebug_suffix));]])[
|
(unsigned long) yyalloc, yydebug_suffix));]])[
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@@ -931,7 +875,7 @@ do { \
|
|||||||
goto yyerrlab; \
|
goto yyerrlab; \
|
||||||
} \
|
} \
|
||||||
} \
|
} \
|
||||||
} while (YYID (0))
|
} while (0)
|
||||||
|
|
||||||
/* Discard any previous initial lookahead context because of Event,
|
/* Discard any previous initial lookahead context because of Event,
|
||||||
which may be a lookahead change or an invalidation of the currently
|
which may be a lookahead change or an invalidation of the currently
|
||||||
@@ -954,7 +898,7 @@ do { \
|
|||||||
Event "\n"); \
|
Event "\n"); \
|
||||||
yy_lac_established = 0; \
|
yy_lac_established = 0; \
|
||||||
} \
|
} \
|
||||||
} while (YYID (0))
|
} while (0)
|
||||||
#else
|
#else
|
||||||
# define YY_LAC_DISCARD(Event) yy_lac_established = 0
|
# define YY_LAC_DISCARD(Event) yy_lac_established = 0
|
||||||
#endif
|
#endif
|
||||||
@@ -1070,7 +1014,7 @@ yy_lac (yytype_int16 *yyesa, yytype_int16 **yyes,
|
|||||||
# define yystrlen strlen
|
# define yystrlen strlen
|
||||||
# else
|
# else
|
||||||
/* Return the length of YYSTR. */
|
/* Return the length of YYSTR. */
|
||||||
]b4_c_function_def([yystrlen], [static YYSIZE_T],
|
]b4_function_define([yystrlen], [static YYSIZE_T],
|
||||||
[[const char *yystr], [yystr]])[
|
[[const char *yystr], [yystr]])[
|
||||||
{
|
{
|
||||||
YYSIZE_T yylen;
|
YYSIZE_T yylen;
|
||||||
@@ -1087,7 +1031,7 @@ yy_lac (yytype_int16 *yyesa, yytype_int16 **yyes,
|
|||||||
# else
|
# else
|
||||||
/* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
|
/* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
|
||||||
YYDEST. */
|
YYDEST. */
|
||||||
]b4_c_function_def([yystpcpy], [static char *],
|
]b4_function_define([yystpcpy], [static char *],
|
||||||
[[char *yydest], [yydest]], [[const char *yysrc], [yysrc]])[
|
[[char *yydest], [yydest]], [[const char *yysrc], [yysrc]])[
|
||||||
{
|
{
|
||||||
char *yyd = yydest;
|
char *yyd = yydest;
|
||||||
@@ -1164,12 +1108,11 @@ yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg,
|
|||||||
]b4_lac_if([[yytype_int16 *yyesa, yytype_int16 **yyes,
|
]b4_lac_if([[yytype_int16 *yyesa, yytype_int16 **yyes,
|
||||||
YYSIZE_T *yyes_capacity, ]])[yytype_int16 *yyssp, int yytoken)
|
YYSIZE_T *yyes_capacity, ]])[yytype_int16 *yyssp, int yytoken)
|
||||||
{
|
{
|
||||||
YYSIZE_T yysize0 = yytnamerr (YY_NULL, yytname[yytoken]);
|
YYSIZE_T yysize0 = yytnamerr (YY_NULLPTR, yytname[yytoken]);
|
||||||
YYSIZE_T yysize = yysize0;
|
YYSIZE_T yysize = yysize0;
|
||||||
YYSIZE_T yysize1;
|
|
||||||
enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
|
enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
|
||||||
/* Internationalized format string. */
|
/* Internationalized format string. */
|
||||||
const char *yyformat = YY_NULL;
|
const char *yyformat = YY_NULLPTR;
|
||||||
/* Arguments of yyformat. */
|
/* Arguments of yyformat. */
|
||||||
char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
|
char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
|
||||||
/* Number of reported tokens (one for the "unexpected", one per
|
/* Number of reported tokens (one for the "unexpected", one per
|
||||||
@@ -1177,10 +1120,6 @@ yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg,
|
|||||||
int yycount = 0;
|
int yycount = 0;
|
||||||
|
|
||||||
/* There are many possibilities here to consider:
|
/* There are many possibilities here to consider:
|
||||||
- Assume YYFAIL is not used. It's too flawed to consider. See
|
|
||||||
<http://lists.gnu.org/archive/html/bison-patches/2009-12/msg00024.html>
|
|
||||||
for details. YYERROR is fine as it does not invoke this
|
|
||||||
function.
|
|
||||||
- If this state is a consistent state with a default action, then
|
- If this state is a consistent state with a default action, then
|
||||||
the only way this function was invoked is if the default action
|
the only way this function was invoked is if the default action
|
||||||
is an error action. In that case, don't check for expected
|
is an error action. In that case, don't check for expected
|
||||||
@@ -1247,11 +1186,13 @@ yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg,
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
yyarg[yycount++] = yytname[yyx];
|
yyarg[yycount++] = yytname[yyx];
|
||||||
yysize1 = yysize + yytnamerr (YY_NULL, yytname[yyx]);
|
{
|
||||||
if (! (yysize <= yysize1
|
YYSIZE_T yysize1 = yysize + yytnamerr (YY_NULLPTR, yytname[yyx]);
|
||||||
&& yysize1 <= YYSTACK_ALLOC_MAXIMUM))
|
if (! (yysize <= yysize1
|
||||||
return 2;
|
&& yysize1 <= YYSTACK_ALLOC_MAXIMUM))
|
||||||
yysize = yysize1;
|
return 2;
|
||||||
|
yysize = yysize1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}]b4_lac_if([[
|
}]b4_lac_if([[
|
||||||
# if ]b4_api_PREFIX[DEBUG
|
# if ]b4_api_PREFIX[DEBUG
|
||||||
@@ -1266,6 +1207,7 @@ yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg,
|
|||||||
case N: \
|
case N: \
|
||||||
yyformat = S; \
|
yyformat = S; \
|
||||||
break
|
break
|
||||||
|
default: /* Avoid compiler warnings. */
|
||||||
YYCASE_(0, YY_("syntax error"));
|
YYCASE_(0, YY_("syntax error"));
|
||||||
YYCASE_(1, YY_("syntax error, unexpected %s"));
|
YYCASE_(1, YY_("syntax error, unexpected %s"));
|
||||||
YYCASE_(2, YY_("syntax error, unexpected %s, expecting %s"));
|
YYCASE_(2, YY_("syntax error, unexpected %s, expecting %s"));
|
||||||
@@ -1275,10 +1217,12 @@ yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg,
|
|||||||
# undef YYCASE_
|
# undef YYCASE_
|
||||||
}
|
}
|
||||||
|
|
||||||
yysize1 = yysize + yystrlen (yyformat);
|
{
|
||||||
if (! (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM))
|
YYSIZE_T yysize1 = yysize + yystrlen (yyformat);
|
||||||
return 2;
|
if (! (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM))
|
||||||
yysize = yysize1;
|
return 2;
|
||||||
|
yysize = yysize1;
|
||||||
|
}
|
||||||
|
|
||||||
if (*yymsg_alloc < yysize)
|
if (*yymsg_alloc < yysize)
|
||||||
{
|
{
|
||||||
@@ -1311,7 +1255,7 @@ yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg,
|
|||||||
}
|
}
|
||||||
#endif /* YYERROR_VERBOSE */
|
#endif /* YYERROR_VERBOSE */
|
||||||
|
|
||||||
]b4_yydestruct_generate([b4_c_function_def])[
|
]b4_yydestruct_define[
|
||||||
|
|
||||||
]b4_pure_if([], [
|
]b4_pure_if([], [
|
||||||
|
|
||||||
@@ -1326,13 +1270,13 @@ struct yypstate
|
|||||||
|
|
||||||
static char yypstate_allocated = 0;]])b4_pull_if([
|
static char yypstate_allocated = 0;]])b4_pull_if([
|
||||||
|
|
||||||
b4_c_function_def([[yyparse]], [[int]], b4_parse_param)[
|
b4_function_define([[yyparse]], [[int]], b4_parse_param)[
|
||||||
{
|
{
|
||||||
return yypull_parse (YY_NULL]m4_ifset([b4_parse_param],
|
return yypull_parse (YY_NULLPTR]m4_ifset([b4_parse_param],
|
||||||
[[, ]b4_c_args(b4_parse_param)])[);
|
[[, ]b4_args(b4_parse_param)])[);
|
||||||
}
|
}
|
||||||
|
|
||||||
]b4_c_function_def([[yypull_parse]], [[int]],
|
]b4_function_define([[yypull_parse]], [[int]],
|
||||||
[[[yypstate *yyps]], [[yyps]]]m4_ifset([b4_parse_param], [,
|
[[[yypstate *yyps]], [[yyps]]]m4_ifset([b4_parse_param], [,
|
||||||
b4_parse_param]))[
|
b4_parse_param]))[
|
||||||
{
|
{
|
||||||
@@ -1340,7 +1284,8 @@ b4_c_function_def([[yyparse]], [[int]], b4_parse_param)[
|
|||||||
yypstate *yyps_local;]b4_pure_if([[
|
yypstate *yyps_local;]b4_pure_if([[
|
||||||
int yychar;
|
int yychar;
|
||||||
YYSTYPE yylval;]b4_locations_if([[
|
YYSTYPE yylval;]b4_locations_if([[
|
||||||
YYLTYPE yylloc;]])])[
|
static YYLTYPE yyloc_default][]b4_yyloc_default[;
|
||||||
|
YYLTYPE yylloc = yyloc_default;]])])[
|
||||||
if (yyps)
|
if (yyps)
|
||||||
yyps_local = yyps;
|
yyps_local = yyps;
|
||||||
else
|
else
|
||||||
@@ -1355,9 +1300,9 @@ b4_c_function_def([[yyparse]], [[int]], b4_parse_param)[
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
do {
|
do {
|
||||||
yychar = YYLEX;
|
yychar = ]b4_lex[;
|
||||||
yystatus =
|
yystatus =
|
||||||
yypush_parse (yyps_local]b4_pure_if([[, yychar, &yylval]b4_locations_if([[, &yylloc]])])m4_ifset([b4_parse_param], [, b4_c_args(b4_parse_param)])[);
|
yypush_parse (yyps_local]b4_pure_if([[, yychar, &yylval]b4_locations_if([[, &yylloc]])])m4_ifset([b4_parse_param], [, b4_args(b4_parse_param)])[);
|
||||||
} while (yystatus == YYPUSH_MORE);
|
} while (yystatus == YYPUSH_MORE);
|
||||||
if (!yyps)
|
if (!yyps)
|
||||||
yypstate_delete (yyps_local);
|
yypstate_delete (yyps_local);
|
||||||
@@ -1365,32 +1310,35 @@ b4_c_function_def([[yyparse]], [[int]], b4_parse_param)[
|
|||||||
}]])[
|
}]])[
|
||||||
|
|
||||||
/* Initialize the parser data structure. */
|
/* Initialize the parser data structure. */
|
||||||
]b4_c_function_def([[yypstate_new]], [[yypstate *]])[
|
]b4_function_define([[yypstate_new]], [[yypstate *]])[
|
||||||
{
|
{
|
||||||
yypstate *yyps;]b4_pure_if([], [[
|
yypstate *yyps;]b4_pure_if([], [[
|
||||||
if (yypstate_allocated)
|
if (yypstate_allocated)
|
||||||
return YY_NULL;]])[
|
return YY_NULLPTR;]])[
|
||||||
yyps = (yypstate *) malloc (sizeof *yyps);
|
yyps = (yypstate *) malloc (sizeof *yyps);
|
||||||
if (!yyps)
|
if (!yyps)
|
||||||
return YY_NULL;
|
return YY_NULLPTR;
|
||||||
yyps->yynew = 1;]b4_pure_if([], [[
|
yyps->yynew = 1;]b4_pure_if([], [[
|
||||||
yypstate_allocated = 1;]])[
|
yypstate_allocated = 1;]])[
|
||||||
return yyps;
|
return yyps;
|
||||||
}
|
}
|
||||||
|
|
||||||
]b4_c_function_def([[yypstate_delete]], [[void]],
|
]b4_function_define([[yypstate_delete]], [[void]],
|
||||||
[[[yypstate *yyps]], [[yyps]]])[
|
[[[yypstate *yyps]], [[yyps]]])[
|
||||||
{
|
{
|
||||||
|
if (yyps)
|
||||||
|
{
|
||||||
#ifndef yyoverflow
|
#ifndef yyoverflow
|
||||||
/* If the stack was reallocated but the parse did not complete, then the
|
/* If the stack was reallocated but the parse did not complete, then the
|
||||||
stack still needs to be freed. */
|
stack still needs to be freed. */
|
||||||
if (!yyps->yynew && yyps->yyss != yyps->yyssa)
|
if (!yyps->yynew && yyps->yyss != yyps->yyssa)
|
||||||
YYSTACK_FREE (yyps->yyss);
|
YYSTACK_FREE (yyps->yyss);
|
||||||
#endif]b4_lac_if([[
|
#endif]b4_lac_if([[
|
||||||
if (!yyps->yynew && yyps->yyes != yyps->yyesa)
|
if (!yyps->yynew && yyps->yyes != yyps->yyesa)
|
||||||
YYSTACK_FREE (yyps->yyes);]])[
|
YYSTACK_FREE (yyps->yyes);]])[
|
||||||
free (yyps);]b4_pure_if([], [[
|
free (yyps);]b4_pure_if([], [[
|
||||||
yypstate_allocated = 0;]])[
|
yypstate_allocated = 0;]])[
|
||||||
|
}
|
||||||
}
|
}
|
||||||
]b4_pure_if([[
|
]b4_pure_if([[
|
||||||
#define ]b4_prefix[nerrs yyps->]b4_prefix[nerrs]])[
|
#define ]b4_prefix[nerrs yyps->]b4_prefix[nerrs]])[
|
||||||
@@ -1416,11 +1364,11 @@ b4_c_function_def([[yyparse]], [[int]], b4_parse_param)[
|
|||||||
| yypush_parse. |
|
| yypush_parse. |
|
||||||
`---------------*/
|
`---------------*/
|
||||||
|
|
||||||
]b4_c_function_def([[yypush_parse]], [[int]],
|
]b4_function_define([[yypush_parse]], [[int]],
|
||||||
[[[yypstate *yyps]], [[yyps]]]b4_pure_if([,
|
[[[yypstate *yyps]], [[yyps]]]b4_pure_if([,
|
||||||
[[[int yypushed_char]], [[yypushed_char]]],
|
[[[int yypushed_char]], [[yypushed_char]]],
|
||||||
[[[YYSTYPE const *yypushed_val]], [[yypushed_val]]]b4_locations_if([,
|
[[[YYSTYPE const *yypushed_val]], [[yypushed_val]]]b4_locations_if([,
|
||||||
[[[YYLTYPE const *yypushed_loc]], [[yypushed_loc]]]])])m4_ifset([b4_parse_param], [,
|
[[[YYLTYPE *yypushed_loc]], [[yypushed_loc]]]])])m4_ifset([b4_parse_param], [,
|
||||||
b4_parse_param]))], [[
|
b4_parse_param]))], [[
|
||||||
|
|
||||||
|
|
||||||
@@ -1428,12 +1376,7 @@ b4_c_function_def([[yyparse]], [[int]], b4_parse_param)[
|
|||||||
| yyparse. |
|
| yyparse. |
|
||||||
`----------*/
|
`----------*/
|
||||||
|
|
||||||
#ifdef YYPARSE_PARAM
|
]b4_function_define([yyparse], [int], b4_parse_param)])[
|
||||||
]b4_c_function_def([yyparse], [int],
|
|
||||||
[[void *YYPARSE_PARAM], [YYPARSE_PARAM]])[
|
|
||||||
#else /* ! YYPARSE_PARAM */
|
|
||||||
]b4_c_function_def([yyparse], [int], b4_parse_param)[
|
|
||||||
#endif]])[
|
|
||||||
{]b4_pure_if([b4_declare_scanner_communication_variables
|
{]b4_pure_if([b4_declare_scanner_communication_variables
|
||||||
])b4_push_if([b4_pure_if([], [[
|
])b4_push_if([b4_pure_if([], [[
|
||||||
int yypushed_char = yychar;
|
int yypushed_char = yychar;
|
||||||
@@ -1446,7 +1389,7 @@ b4_c_function_def([[yyparse]], [[int]], b4_parse_param)[
|
|||||||
int yyn;
|
int yyn;
|
||||||
int yyresult;
|
int yyresult;
|
||||||
/* Lookahead token as an internal (translated) token number. */
|
/* Lookahead token as an internal (translated) token number. */
|
||||||
int yytoken;
|
int yytoken = 0;
|
||||||
/* The variables used to return semantic value and location from the
|
/* The variables used to return semantic value and location from the
|
||||||
action routines. */
|
action routines. */
|
||||||
YYSTYPE yyval;]b4_locations_if([[
|
YYSTYPE yyval;]b4_locations_if([[
|
||||||
@@ -1471,10 +1414,9 @@ b4_c_function_def([[yyparse]], [[int]], b4_parse_param)[
|
|||||||
goto yyread_pushed_token;
|
goto yyread_pushed_token;
|
||||||
}]])[
|
}]])[
|
||||||
|
|
||||||
yytoken = 0;
|
yyssp = yyss = yyssa;
|
||||||
yyss = yyssa;
|
yyvsp = yyvs = yyvsa;]b4_locations_if([[
|
||||||
yyvs = yyvsa;]b4_locations_if([[
|
yylsp = yyls = yylsa;]])[
|
||||||
yyls = yylsa;]])[
|
|
||||||
yystacksize = YYINITDEPTH;]b4_lac_if([[
|
yystacksize = YYINITDEPTH;]b4_lac_if([[
|
||||||
|
|
||||||
yyes = yyesa;
|
yyes = yyesa;
|
||||||
@@ -1488,32 +1430,17 @@ b4_c_function_def([[yyparse]], [[int]], b4_parse_param)[
|
|||||||
yyerrstatus = 0;
|
yyerrstatus = 0;
|
||||||
yynerrs = 0;
|
yynerrs = 0;
|
||||||
yychar = YYEMPTY; /* Cause a token to be read. */
|
yychar = YYEMPTY; /* Cause a token to be read. */
|
||||||
|
]m4_ifdef([b4_initial_action], [
|
||||||
/* Initialize stack pointers.
|
b4_dollar_pushdef([m4_define([b4_dollar_dollar_used])yylval], [],
|
||||||
Waste one element of value and location stack
|
[b4_push_if([b4_pure_if([*])yypushed_loc], [yylloc])])dnl
|
||||||
so that they stay on the same level as the state stack.
|
|
||||||
The wasted elements are never initialized. */
|
|
||||||
yyssp = yyss;
|
|
||||||
yyvsp = yyvs;]b4_locations_if([[
|
|
||||||
yylsp = yyls;
|
|
||||||
|
|
||||||
#if defined ]b4_api_PREFIX[LTYPE_IS_TRIVIAL && ]b4_api_PREFIX[LTYPE_IS_TRIVIAL
|
|
||||||
/* Initialize the default location before parsing starts. */
|
|
||||||
yylloc.first_line = yylloc.last_line = ]b4_location_initial_line[;
|
|
||||||
yylloc.first_column = yylloc.last_column = ]b4_location_initial_column[;
|
|
||||||
#endif]])
|
|
||||||
m4_ifdef([b4_initial_action],[
|
|
||||||
m4_pushdef([b4_at_dollar], [m4_define([b4_at_dollar_used])yylloc])dnl
|
|
||||||
m4_pushdef([b4_dollar_dollar], [m4_define([b4_dollar_dollar_used])yylval])dnl
|
|
||||||
/* User initialization code. */
|
/* User initialization code. */
|
||||||
b4_user_initial_action
|
b4_user_initial_action
|
||||||
m4_popdef([b4_dollar_dollar])dnl
|
b4_dollar_popdef[]dnl
|
||||||
m4_popdef([b4_at_dollar])])dnl
|
|
||||||
m4_ifdef([b4_dollar_dollar_used],[[ yyvsp[0] = yylval;
|
m4_ifdef([b4_dollar_dollar_used],[[ yyvsp[0] = yylval;
|
||||||
|
]])])dnl
|
||||||
|
b4_locations_if([[ yylsp[0] = ]b4_push_if([b4_pure_if([*])yypushed_loc], [yylloc])[;
|
||||||
]])dnl
|
]])dnl
|
||||||
m4_ifdef([b4_at_dollar_used], [[ yylsp[0] = yylloc;
|
[ goto yysetstate;
|
||||||
]])[
|
|
||||||
goto yysetstate;
|
|
||||||
|
|
||||||
/*------------------------------------------------------------.
|
/*------------------------------------------------------------.
|
||||||
| yynewstate -- Push a new state, which is found in yystate. |
|
| yynewstate -- Push a new state, which is found in yystate. |
|
||||||
@@ -1586,7 +1513,7 @@ m4_ifdef([b4_at_dollar_used], [[ yylsp[0] = yylloc;
|
|||||||
yylsp = yyls + yysize - 1;])[
|
yylsp = yyls + yysize - 1;])[
|
||||||
|
|
||||||
YYDPRINTF ((stderr, "Stack size increased to %lu\n",
|
YYDPRINTF ((stderr, "Stack size increased to %lu\n",
|
||||||
(unsigned long int) yystacksize));
|
(unsigned long) yystacksize));
|
||||||
|
|
||||||
if (yyss + yystacksize - 1 <= yyssp)
|
if (yyss + yystacksize - 1 <= yyssp)
|
||||||
YYABORT;
|
YYABORT;
|
||||||
@@ -1637,7 +1564,7 @@ yyread_pushed_token:]])[
|
|||||||
yylval = *yypushed_val;]b4_locations_if([[
|
yylval = *yypushed_val;]b4_locations_if([[
|
||||||
if (yypushed_loc)
|
if (yypushed_loc)
|
||||||
yylloc = *yypushed_loc;]])])], [[
|
yylloc = *yypushed_loc;]])])], [[
|
||||||
yychar = YYLEX;]])[
|
yychar = ]b4_lex[;]])[
|
||||||
}
|
}
|
||||||
|
|
||||||
if (yychar <= YYEOF)
|
if (yychar <= YYEOF)
|
||||||
@@ -1683,7 +1610,9 @@ yyread_pushed_token:]])[
|
|||||||
YY_LAC_DISCARD ("shift");]])[
|
YY_LAC_DISCARD ("shift");]])[
|
||||||
|
|
||||||
yystate = yyn;
|
yystate = yyn;
|
||||||
|
YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
|
||||||
*++yyvsp = yylval;
|
*++yyvsp = yylval;
|
||||||
|
YY_IGNORE_MAYBE_UNINITIALIZED_END
|
||||||
]b4_locations_if([ *++yylsp = yylloc;])[
|
]b4_locations_if([ *++yylsp = yylloc;])[
|
||||||
goto yynewstate;
|
goto yynewstate;
|
||||||
|
|
||||||
@@ -1706,7 +1635,7 @@ yyreduce:
|
|||||||
yylen = yyr2[yyn];
|
yylen = yyr2[yyn];
|
||||||
|
|
||||||
/* If YYLEN is nonzero, implement the default value of the action:
|
/* If YYLEN is nonzero, implement the default value of the action:
|
||||||
`$$ = $1'.
|
'$$ = $1'.
|
||||||
|
|
||||||
Otherwise, the following line sets YYVAL to garbage.
|
Otherwise, the following line sets YYVAL to garbage.
|
||||||
This behavior is undocumented and Bison
|
This behavior is undocumented and Bison
|
||||||
@@ -1716,8 +1645,9 @@ yyreduce:
|
|||||||
yyval = yyvsp[1-yylen];
|
yyval = yyvsp[1-yylen];
|
||||||
|
|
||||||
]b4_locations_if(
|
]b4_locations_if(
|
||||||
[[ /* Default location. */
|
[[ /* Default location. */
|
||||||
YYLLOC_DEFAULT (yyloc, (yylsp - yylen), yylen);]])[
|
YYLLOC_DEFAULT (yyloc, (yylsp - yylen), yylen);
|
||||||
|
yyerror_range[1] = yyloc;]])[
|
||||||
YY_REDUCE_PRINT (yyn);]b4_lac_if([[
|
YY_REDUCE_PRINT (yyn);]b4_lac_if([[
|
||||||
{
|
{
|
||||||
int yychar_backup = yychar;
|
int yychar_backup = yychar;
|
||||||
@@ -1754,7 +1684,7 @@ yyreduce:
|
|||||||
*++yyvsp = yyval;]b4_locations_if([
|
*++yyvsp = yyval;]b4_locations_if([
|
||||||
*++yylsp = yyloc;])[
|
*++yylsp = yyloc;])[
|
||||||
|
|
||||||
/* Now `shift' the result of the reduction. Determine what state
|
/* Now 'shift' the result of the reduction. Determine what state
|
||||||
that goes to, based on the state we popped back to and the rule
|
that goes to, based on the state we popped back to and the rule
|
||||||
number reduced by. */
|
number reduced by. */
|
||||||
|
|
||||||
@@ -1769,9 +1699,9 @@ yyreduce:
|
|||||||
goto yynewstate;
|
goto yynewstate;
|
||||||
|
|
||||||
|
|
||||||
/*------------------------------------.
|
/*--------------------------------------.
|
||||||
| yyerrlab -- here on detecting error |
|
| yyerrlab -- here on detecting error. |
|
||||||
`------------------------------------*/
|
`--------------------------------------*/
|
||||||
yyerrlab:
|
yyerrlab:
|
||||||
/* Make sure we have latest lookahead translation. See comments at
|
/* Make sure we have latest lookahead translation. See comments at
|
||||||
user semantic actions for why this is necessary. */
|
user semantic actions for why this is necessary. */
|
||||||
@@ -1857,8 +1787,7 @@ yyerrorlab:
|
|||||||
if (/*CONSTCOND*/ 0)
|
if (/*CONSTCOND*/ 0)
|
||||||
goto yyerrorlab;
|
goto yyerrorlab;
|
||||||
|
|
||||||
]b4_locations_if([[ yyerror_range[1] = yylsp[1-yylen];
|
/* Do not reclaim the symbols of the rule whose action triggered
|
||||||
]])[ /* Do not reclaim the symbols of the rule which action triggered
|
|
||||||
this YYERROR. */
|
this YYERROR. */
|
||||||
YYPOPSTACK (yylen);
|
YYPOPSTACK (yylen);
|
||||||
yylen = 0;
|
yylen = 0;
|
||||||
@@ -1903,7 +1832,9 @@ yyerrlab1:
|
|||||||
current lookahead token, the shift below will for sure. */
|
current lookahead token, the shift below will for sure. */
|
||||||
YY_LAC_DISCARD ("error recovery");]])[
|
YY_LAC_DISCARD ("error recovery");]])[
|
||||||
|
|
||||||
|
YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
|
||||||
*++yyvsp = yylval;
|
*++yyvsp = yylval;
|
||||||
|
YY_IGNORE_MAYBE_UNINITIALIZED_END
|
||||||
]b4_locations_if([[
|
]b4_locations_if([[
|
||||||
yyerror_range[2] = yylloc;
|
yyerror_range[2] = yylloc;
|
||||||
/* Using YYLLOC is tempting, but would change the location of
|
/* Using YYLLOC is tempting, but would change the location of
|
||||||
@@ -1951,7 +1882,7 @@ yyreturn:
|
|||||||
yydestruct ("Cleanup: discarding lookahead",
|
yydestruct ("Cleanup: discarding lookahead",
|
||||||
yytoken, &yylval]b4_locations_if([, &yylloc])[]b4_user_args[);
|
yytoken, &yylval]b4_locations_if([, &yylloc])[]b4_user_args[);
|
||||||
}
|
}
|
||||||
/* Do not reclaim the symbols of the rule which action triggered
|
/* Do not reclaim the symbols of the rule whose action triggered
|
||||||
this YYABORT or YYACCEPT. */
|
this YYABORT or YYACCEPT. */
|
||||||
YYPOPSTACK (yylen);
|
YYPOPSTACK (yylen);
|
||||||
YY_STACK_PRINT (yyss, yyssp);
|
YY_STACK_PRINT (yyss, yyssp);
|
||||||
@@ -1974,16 +1905,15 @@ yypushreturn:]])[
|
|||||||
if (yymsg != yymsgbuf)
|
if (yymsg != yymsgbuf)
|
||||||
YYSTACK_FREE (yymsg);
|
YYSTACK_FREE (yymsg);
|
||||||
#endif
|
#endif
|
||||||
/* Make sure YYID is used. */
|
return yyresult;
|
||||||
return YYID (yyresult);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
]b4_epilogue[]dnl
|
]b4_epilogue[]dnl
|
||||||
|
b4_output_end()
|
||||||
|
|
||||||
b4_defines_if(
|
b4_defines_if(
|
||||||
[@output(b4_spec_defines_file@)@
|
[b4_output_begin([b4_spec_defines_file])[
|
||||||
b4_copyright([Bison interface for Yacc-like parsers in C])[
|
]b4_copyright([Bison interface for Yacc-like parsers in C])[
|
||||||
|
|
||||||
]b4_shared_declarations[
|
]b4_shared_declarations[
|
||||||
]])dnl b4_defines_if
|
]b4_output_end()
|
||||||
m4_divert_pop(0)
|
])# b4_defines_if
|
||||||
m4_popdef([b4_copyright_years])
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
# DJGPP Maintainer's Makefile -*-Makefile-*-
|
# DJGPP Maintainer's Makefile -*-Makefile-*-
|
||||||
# Requires GNU sed
|
# Requires GNU sed
|
||||||
|
|
||||||
## Copyright (C) 2005-2012 Free Software Foundation, Inc.
|
## Copyright (C) 2005-2015, 2018 Free Software Foundation, Inc.
|
||||||
|
|
||||||
# This program is free software: you can redistribute it and/or modify
|
# 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
|
# it under the terms of the GNU General Public License as published by
|
||||||
|
|||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
This is a port of GNU Bison @VERSION@ to MSDOS/DJGPP.
|
This is a port of GNU Bison @VERSION@ to MSDOS/DJGPP.
|
||||||
|
|
||||||
Copyright (C) 2005-2012 Free Software Foundation, Inc.
|
Copyright (C) 2005-2015, 2018 Free Software Foundation, Inc.
|
||||||
|
|
||||||
This program is free software: you can redistribute it and/or modify
|
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
|
it under the terms of the GNU General Public License as published by
|
||||||
|
|||||||
+1
-1
@@ -4,7 +4,7 @@ Rem Configure Bison for DJGPP.
|
|||||||
Rem WARNING WARNING WARNING: This file needs to have DOS CRLF end-of-line
|
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 format, or else stock DOS/Windows shells will refuse to run it.
|
||||||
|
|
||||||
Rem Copyright (C) 2005-2012 Free Software Foundation, Inc.
|
Rem Copyright (C) 2005-2015, 2018 Free Software Foundation, Inc.
|
||||||
|
|
||||||
Rem This program is free software: you can redistribute it and/or modify
|
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 it under the terms of the GNU General Public License as published by
|
||||||
|
|||||||
+1
-1
@@ -2,7 +2,7 @@
|
|||||||
# Sed script for additional DJGPP specific editing
|
# Sed script for additional DJGPP specific editing
|
||||||
# of the configure script generated by autoconf 2.62.
|
# of the configure script generated by autoconf 2.62.
|
||||||
|
|
||||||
# Copyright (C) 2005-2012 Free Software Foundation, Inc.
|
# Copyright (C) 2005-2015, 2018 Free Software Foundation, Inc.
|
||||||
|
|
||||||
# This program is free software: you can redistribute it and/or modify
|
# 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
|
# it under the terms of the GNU General Public License as published by
|
||||||
|
|||||||
+1
-1
@@ -3,7 +3,7 @@
|
|||||||
# This is the config.site file for configuring GNU packages
|
# This is the config.site file for configuring GNU packages
|
||||||
# which are to be built with DJGPP tools.
|
# which are to be built with DJGPP tools.
|
||||||
|
|
||||||
# Copyright (C) 2005-2012 Free Software Foundation, Inc.
|
# Copyright (C) 2005-2015, 2018 Free Software Foundation, Inc.
|
||||||
|
|
||||||
# This program is free software: you can redistribute it and/or modify
|
# 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
|
# it under the terms of the GNU General Public License as published by
|
||||||
|
|||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
# sed script for DJGPP specific editing of config.hin
|
# sed script for DJGPP specific editing of config.hin
|
||||||
|
|
||||||
# Copyright (C) 2005-2012 Free Software Foundation, Inc.
|
# Copyright (C) 2005-2015, 2018 Free Software Foundation, Inc.
|
||||||
|
|
||||||
# This program is free software: you can redistribute it and/or modify
|
# 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
|
# it under the terms of the GNU General Public License as published by
|
||||||
|
|||||||
+1
-1
@@ -7,7 +7,7 @@ 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 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 with other file names after truncation to DOS 8+3 namespace.
|
||||||
Rem
|
Rem
|
||||||
Rem Copyright (C) 2005-2012 Free Software Foundation, Inc.
|
Rem Copyright (C) 2005-2015, 2018 Free Software Foundation, Inc.
|
||||||
Rem
|
Rem
|
||||||
Rem This program is free software: you can redistribute it and/or modify
|
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 it under the terms of the GNU General Public License as published by
|
||||||
|
|||||||
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
## Copyright (C) 2008-2012 Free Software Foundation, Inc.
|
## Copyright (C) 2008-2015, 2018 Free Software Foundation, Inc.
|
||||||
|
|
||||||
## This program is free software: you can redistribute it and/or modify
|
## 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
|
## it under the terms of the GNU General Public License as published by
|
||||||
|
|||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
/* Subprocesses with pipes.
|
/* Subprocesses with pipes.
|
||||||
|
|
||||||
Copyright (C) 2005-2012 Free Software Foundation, Inc.
|
Copyright (C) 2005-2015, 2018 Free Software Foundation, Inc.
|
||||||
|
|
||||||
This program is free software: you can redistribute it and/or modify
|
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
|
it under the terms of the GNU General Public License as published by
|
||||||
|
|||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
/* Subprocesses with pipes.
|
/* Subprocesses with pipes.
|
||||||
|
|
||||||
Copyright (C) 2005-2012 Free Software Foundation, Inc.
|
Copyright (C) 2005-2015, 2018 Free Software Foundation, Inc.
|
||||||
|
|
||||||
This program is free software: you can redistribute it and/or modify
|
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
|
it under the terms of the GNU General Public License as published by
|
||||||
|
|||||||
+1
-1
@@ -2,7 +2,7 @@
|
|||||||
# Sed script for additional DJGPP specific editing
|
# Sed script for additional DJGPP specific editing
|
||||||
# of the testsuite script generated by autoconf 2.61.
|
# of the testsuite script generated by autoconf 2.61.
|
||||||
|
|
||||||
# Copyright (C) 2007-2012 Free Software Foundation, Inc.
|
# Copyright (C) 2007-2015, 2018 Free Software Foundation, Inc.
|
||||||
|
|
||||||
# This program is free software: you can redistribute it and/or modify
|
# 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
|
# it under the terms of the GNU General Public License as published by
|
||||||
|
|||||||
+2
-1
@@ -1,4 +1,3 @@
|
|||||||
/*.info*
|
|
||||||
/*~
|
/*~
|
||||||
/.dirstamp
|
/.dirstamp
|
||||||
/bison.1
|
/bison.1
|
||||||
@@ -9,6 +8,7 @@
|
|||||||
/bison.fn
|
/bison.fn
|
||||||
/bison.help
|
/bison.help
|
||||||
/bison.html
|
/bison.html
|
||||||
|
/bison.info
|
||||||
/bison.ky
|
/bison.ky
|
||||||
/bison.log
|
/bison.log
|
||||||
/bison.pdf
|
/bison.pdf
|
||||||
@@ -27,3 +27,4 @@
|
|||||||
/stamp-vti
|
/stamp-vti
|
||||||
/version.texi
|
/version.texi
|
||||||
/yacc.1
|
/yacc.1
|
||||||
|
/gendocs_template_min
|
||||||
|
|||||||
+1450
-938
File diff suppressed because it is too large
Load Diff
+2036
-951
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,11 @@
|
|||||||
|
digraph "reduce.y"
|
||||||
|
{
|
||||||
|
node [fontname=courier shape=box]
|
||||||
|
edge [fontname=courier]
|
||||||
|
|
||||||
|
1 [label="State 1\n 3 a: \"0\" . [\".\"]\l 4 b: \"0\" . [\";\"]\l"]
|
||||||
|
1 -> "1R3" [label="" style=solid]
|
||||||
|
"1R3" [style=filled shape=diamond fillcolor=yellowgreen label="R3"]
|
||||||
|
1 -> "1R4" [label="[\";\"]" style=solid]
|
||||||
|
"1R4" [style=filled shape=diamond fillcolor=yellowgreen label="R4"]
|
||||||
|
}
|
||||||
@@ -0,0 +1,13 @@
|
|||||||
|
.------------------.
|
||||||
|
| State 1 |
|
||||||
|
| 3 a: "0" . [";"] |
|
||||||
|
| 4 b: "0" . ["."] |
|
||||||
|
`------------------'
|
||||||
|
/ \
|
||||||
|
/ \ ["."]
|
||||||
|
/ \
|
||||||
|
v v
|
||||||
|
/ \ / \
|
||||||
|
/ R \ / R \
|
||||||
|
(green) \ 3 / \ 4 / (green)
|
||||||
|
\ / \ /
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
digraph "shift.y"
|
||||||
|
{
|
||||||
|
node [fontname=courier shape=box]
|
||||||
|
edge [fontname=courier]
|
||||||
|
|
||||||
|
3 [label="State 3\n 1 exp: a . \".\"\l"]
|
||||||
|
3 -> 6 [style=solid label="\".\""]
|
||||||
|
6 [label="State 6\n 1 exp: a \".\" .\l"]
|
||||||
|
}
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
.----------------.
|
||||||
|
| State 3 |
|
||||||
|
| 1 exp: a . ";" |
|
||||||
|
`----------------'
|
||||||
|
|
|
||||||
|
| ";"
|
||||||
|
|
|
||||||
|
v
|
||||||
|
.----------------.
|
||||||
|
| State 6 |
|
||||||
|
| 1 exp: a ";" . |
|
||||||
|
`----------------'
|
||||||
@@ -0,0 +1,35 @@
|
|||||||
|
// Generated by GNU Bison 2.6.90.
|
||||||
|
// Report bugs to <[email protected]>.
|
||||||
|
// Home page: <http://www.gnu.org/software/bison/>.
|
||||||
|
|
||||||
|
digraph "/tmp/fo.y"
|
||||||
|
{
|
||||||
|
node [fontname = courier, shape = box, colorscheme = paired6]
|
||||||
|
edge [fontname = courier]
|
||||||
|
|
||||||
|
0 [label="State 0\n\l 0 $accept: . exp $end\l 1 exp: . a \";\"\l 2 | . b \".\"\l 3 a: . \"0\"\l 4 b: . \"0\"\l"]
|
||||||
|
0 -> 1 [style=solid label="\"0\""]
|
||||||
|
0 -> 2 [style=dashed label="exp"]
|
||||||
|
0 -> 3 [style=dashed label="a"]
|
||||||
|
0 -> 4 [style=dashed label="b"]
|
||||||
|
1 [label="State 1\n\l 3 a: \"0\" . [\";\"]\l 4 b: \"0\" . [\".\"]\l"]
|
||||||
|
1 -> "1R3" [style=solid]
|
||||||
|
"1R3" [label="R3", fillcolor=3, shape=diamond, style=filled]
|
||||||
|
1 -> "1R4" [label="[\".\"]", style=solid]
|
||||||
|
"1R4" [label="R4", fillcolor=3, shape=diamond, style=filled]
|
||||||
|
2 [label="State 2\n\l 0 $accept: exp . $end\l"]
|
||||||
|
2 -> 5 [style=solid label="$end"]
|
||||||
|
3 [label="State 3\n\l 1 exp: a . \";\"\l"]
|
||||||
|
3 -> 6 [style=solid label="\";\""]
|
||||||
|
4 [label="State 4\n\l 2 exp: b . \".\"\l"]
|
||||||
|
4 -> 7 [style=solid label="\".\""]
|
||||||
|
5 [label="State 5\n\l 0 $accept: exp $end .\l"]
|
||||||
|
5 -> "5R0" [style=solid]
|
||||||
|
"5R0" [label="Acc", fillcolor=1, shape=diamond, style=filled]
|
||||||
|
6 [label="State 6\n\l 1 exp: a \";\" .\l"]
|
||||||
|
6 -> "6R1" [style=solid]
|
||||||
|
"6R1" [label="R1", fillcolor=3, shape=diamond, style=filled]
|
||||||
|
7 [label="State 7\n\l 2 exp: b \".\" .\l"]
|
||||||
|
7 -> "7R2" [style=solid]
|
||||||
|
"7R2" [label="R2", fillcolor=3, shape=diamond, style=filled]
|
||||||
|
}
|
||||||
@@ -0,0 +1,2 @@
|
|||||||
|
This file is a stub, not used by the documentation. If you feel like
|
||||||
|
contributing ASCII art for example.gv, please step forward!
|
||||||
@@ -0,0 +1,4 @@
|
|||||||
|
%%
|
||||||
|
exp: a ";" | b ".";
|
||||||
|
a: "0";
|
||||||
|
b: "0";
|
||||||
+49
-4
@@ -1,4 +1,5 @@
|
|||||||
## Copyright (C) 2001-2003, 2005-2012 Free Software Foundation, Inc.
|
## Copyright (C) 2001-2003, 2005-2015, 2018 Free Software Foundation,
|
||||||
|
## Inc.
|
||||||
|
|
||||||
## This program is free software: you can redistribute it and/or modify
|
## 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
|
## it under the terms of the GNU General Public License as published by
|
||||||
@@ -20,7 +21,15 @@ doc_bison_TEXINFOS = \
|
|||||||
doc/fdl.texi \
|
doc/fdl.texi \
|
||||||
doc/gpl-3.0.texi
|
doc/gpl-3.0.texi
|
||||||
|
|
||||||
TEXI2DVI = texi2dvi --build-dir=doc/bison.t2d
|
# Cannot express dependencies directly on file names because of Automake.
|
||||||
|
# Obfuscate with a variable.
|
||||||
|
doc_bison = doc/bison
|
||||||
|
$(doc_bison).dvi: $(FIGS_GV:.gv=.eps)
|
||||||
|
$(doc_bison).info: $(FIGS_GV:.gv=.txt)
|
||||||
|
$(doc_bison).pdf: $(FIGS_GV:.gv=.pdf)
|
||||||
|
$(doc_bison).html: $(FIGS_GV:.gv=.png)
|
||||||
|
|
||||||
|
TEXI2DVI = texi2dvi --build-dir=doc/bison.t2d -I doc
|
||||||
CLEANDIRS = doc/bison.t2d
|
CLEANDIRS = doc/bison.t2d
|
||||||
clean-local:
|
clean-local:
|
||||||
rm -rf $(CLEANDIRS)
|
rm -rf $(CLEANDIRS)
|
||||||
@@ -30,7 +39,7 @@ MOSTLYCLEANFILES += $(top_srcdir)/doc/*.t
|
|||||||
CROSS_OPTIONS_PL = $(top_srcdir)/build-aux/cross-options.pl
|
CROSS_OPTIONS_PL = $(top_srcdir)/build-aux/cross-options.pl
|
||||||
CROSS_OPTIONS_TEXI = $(top_srcdir)/doc/cross-options.texi
|
CROSS_OPTIONS_TEXI = $(top_srcdir)/doc/cross-options.texi
|
||||||
$(CROSS_OPTIONS_TEXI): doc/bison.help $(CROSS_OPTIONS_PL)
|
$(CROSS_OPTIONS_TEXI): doc/bison.help $(CROSS_OPTIONS_PL)
|
||||||
# Create $@~ which is the previous contents. Don't use `mv' here so
|
# Create $@~ which is the previous contents. Don't use 'mv' here so
|
||||||
# that even if we are interrupted, the file is still available for
|
# that even if we are interrupted, the file is still available for
|
||||||
# diff in the next run. Note that $@ might not exist yet.
|
# diff in the next run. Note that $@ might not exist yet.
|
||||||
$(AM_V_GEN){ test ! -f $@ || cat $@; } >$@~
|
$(AM_V_GEN){ test ! -f $@ || cat $@; } >$@~
|
||||||
@@ -77,11 +86,13 @@ doc/refcard.pdf: doc/refcard.tex
|
|||||||
# repeated builds of bison.help.
|
# repeated builds of bison.help.
|
||||||
|
|
||||||
EXTRA_DIST += $(top_srcdir)/doc/bison.help
|
EXTRA_DIST += $(top_srcdir)/doc/bison.help
|
||||||
|
if ! CROSS_COMPILING
|
||||||
MAINTAINERCLEANFILES += $(top_srcdir)/doc/bison.help
|
MAINTAINERCLEANFILES += $(top_srcdir)/doc/bison.help
|
||||||
$(top_srcdir)/doc/bison.help: src/bison$(EXEEXT)
|
$(top_srcdir)/doc/bison.help: src/bison$(EXEEXT)
|
||||||
$(AM_V_GEN)src/bison$(EXEEXT) --version >doc/bison.help.tmp
|
$(AM_V_GEN)src/bison$(EXEEXT) --version >doc/bison.help.tmp
|
||||||
$(AM_V_at) src/bison$(EXEEXT) --help >>doc/bison.help.tmp
|
$(AM_V_at) src/bison$(EXEEXT) --help >>doc/bison.help.tmp
|
||||||
$(AM_V_at)$(top_srcdir)/build-aux/move-if-change doc/bison.help.tmp $@
|
$(AM_V_at)$(top_srcdir)/build-aux/move-if-change doc/bison.help.tmp $@
|
||||||
|
endif ! CROSS_COMPILING
|
||||||
|
|
||||||
|
|
||||||
## ----------- ##
|
## ----------- ##
|
||||||
@@ -98,7 +109,11 @@ remove_time_stamp = \
|
|||||||
sed 's/^\(\.TH[^"]*"[^"]*"[^"]*\)"[^"]*"/\1/'
|
sed 's/^\(\.TH[^"]*"[^"]*"[^"]*\)"[^"]*"/\1/'
|
||||||
|
|
||||||
# Depend on configure to get version number changes.
|
# Depend on configure to get version number changes.
|
||||||
$(top_srcdir)/doc/bison.1: doc/bison.help doc/bison.x $(top_srcdir)/configure
|
if ! CROSS_COMPILING
|
||||||
|
MAN_DEPS = doc/bison.help doc/bison.x $(top_srcdir)/configure
|
||||||
|
endif
|
||||||
|
|
||||||
|
$(top_srcdir)/doc/bison.1: $(MAN_DEPS)
|
||||||
$(AM_V_GEN)$(HELP2MAN) \
|
$(AM_V_GEN)$(HELP2MAN) \
|
||||||
--include=$(top_srcdir)/doc/bison.x \
|
--include=$(top_srcdir)/doc/bison.x \
|
||||||
--output=$@.t src/bison$(EXEEXT)
|
--output=$@.t src/bison$(EXEEXT)
|
||||||
@@ -110,7 +125,37 @@ $(top_srcdir)/doc/bison.1: doc/bison.help doc/bison.x $(top_srcdir)/configure
|
|||||||
fi
|
fi
|
||||||
$(AM_V_at)rm -f $@*.t
|
$(AM_V_at)rm -f $@*.t
|
||||||
|
|
||||||
|
if ENABLE_YACC
|
||||||
nodist_man_MANS = doc/yacc.1
|
nodist_man_MANS = doc/yacc.1
|
||||||
|
endif
|
||||||
|
|
||||||
|
## ----------------------------- ##
|
||||||
|
## Graphviz examples generation. ##
|
||||||
|
## ----------------------------- ##
|
||||||
|
|
||||||
|
CLEANFILES += $(FIGS_GV:.gv=.eps) $(FIGS_GV:.gv=.pdf) $(FIGS_GV:.gv=.png)
|
||||||
|
FIGS_GV = \
|
||||||
|
doc/figs/example.gv \
|
||||||
|
doc/figs/example-reduce.gv doc/figs/example-shift.gv
|
||||||
|
EXTRA_DIST += \
|
||||||
|
$(FIGS_GV) $(FIGS_GV:.gv=.txt) \
|
||||||
|
$(FIGS_GV:.gv=.eps) $(FIGS_GV:.gv=.pdf) $(FIGS_GV:.gv=.png)
|
||||||
|
SUFFIXES += .gv .eps .pdf .png
|
||||||
|
|
||||||
|
.gv.eps:
|
||||||
|
$(AM_V_GEN) $(MKDIR_P) `echo "./$@" | sed -e 's,/[^/]*$$,,'`
|
||||||
|
$(AM_V_at) $(DOT) -Gmargin=0 -Teps $< >$@.tmp
|
||||||
|
$(AM_V_at) mv $@.tmp $@
|
||||||
|
|
||||||
|
.gv.pdf:
|
||||||
|
$(AM_V_GEN) $(MKDIR_P) `echo "./$@" | sed -e 's,/[^/]*$$,,'`
|
||||||
|
$(AM_V_at) $(DOT) -Gmargin=0 -Tpdf $< >$@.tmp
|
||||||
|
$(AM_V_at) mv $@.tmp $@
|
||||||
|
|
||||||
|
.gv.png:
|
||||||
|
$(AM_V_GEN) $(MKDIR_P) `echo "./$@" | sed -e 's,/[^/]*$$,,'`
|
||||||
|
$(AM_V_at) $(DOT) -Gmargin=0 -Tpng $< >$@.tmp
|
||||||
|
$(AM_V_at) mv $@.tmp $@
|
||||||
|
|
||||||
## -------------- ##
|
## -------------- ##
|
||||||
## Doxygenation. ##
|
## Doxygenation. ##
|
||||||
|
|||||||
+2
-1
@@ -19,7 +19,8 @@
|
|||||||
\def\finalout{\overfullrule=0pt}
|
\def\finalout{\overfullrule=0pt}
|
||||||
%\finalout
|
%\finalout
|
||||||
|
|
||||||
% Copyright (c) 1998, 2001, 2009-2012 Free Software Foundation, Inc.
|
% Copyright (c) 1998, 2001, 2009-2015, 2018 Free Software Foundation,
|
||||||
|
% Inc.
|
||||||
%
|
%
|
||||||
% This file is part of Bison.
|
% This file is part of Bison.
|
||||||
%
|
%
|
||||||
|
|||||||
+1
-1
@@ -16,7 +16,7 @@ straightforward use of _build/src/bison would.)
|
|||||||
|
|
||||||
--
|
--
|
||||||
|
|
||||||
Copyright (C) 2006, 2009-2012 Free Software Foundation, Inc.
|
Copyright (C) 2006, 2009-2015, 2018 Free Software Foundation, Inc.
|
||||||
|
|
||||||
This file is part of Bison, the GNU Compiler Compiler.
|
This file is part of Bison, the GNU Compiler Compiler.
|
||||||
|
|
||||||
|
|||||||
+34
-26
@@ -1,6 +1,6 @@
|
|||||||
#! /usr/bin/perl -w
|
#! /usr/bin/perl -w
|
||||||
|
|
||||||
# Copyright (C) 2006, 2008-2012 Free Software Foundation, Inc.
|
# Copyright (C) 2006, 2008-2015, 2018 Free Software Foundation, Inc.
|
||||||
#
|
#
|
||||||
# This file is part of Bison, the GNU Compiler Compiler.
|
# This file is part of Bison, the GNU Compiler Compiler.
|
||||||
#
|
#
|
||||||
@@ -35,6 +35,7 @@ I<directives>:
|
|||||||
| directives & directives -- Concatenation
|
| directives & directives -- Concatenation
|
||||||
| [ directives> ] -- Optional
|
| [ directives> ] -- Optional
|
||||||
| ( directives> ) -- Parentheses
|
| ( directives> ) -- Parentheses
|
||||||
|
| %b PATH -- Use bison at PATH for this bench
|
||||||
| #d NAME[=VALUE] -- %code { #define NAME [VALUE] }
|
| #d NAME[=VALUE] -- %code { #define NAME [VALUE] }
|
||||||
| %d NAME[=VALUE] -- %define NAME ["VALUE"]
|
| %d NAME[=VALUE] -- %define NAME ["VALUE"]
|
||||||
| %s skeleton -- %skeleton "skeleton"
|
| %s skeleton -- %skeleton "skeleton"
|
||||||
@@ -203,9 +204,9 @@ Format the list of directives for Bison for bench named C<$bench>.
|
|||||||
sub directives($@)
|
sub directives($@)
|
||||||
{
|
{
|
||||||
my ($bench, @directive) = @_;
|
my ($bench, @directive) = @_;
|
||||||
my $res = "/* Directives for bench `$bench'. */\n";
|
my $res = "/* Directives for bench '$bench'. */\n";
|
||||||
$res .= join ("\n", @directive) . "\n";
|
$res .= join ("\n", @directive) . "\n";
|
||||||
$res .= "/* End of directives for bench `$bench'. */\n";
|
$res .= "/* End of directives for bench '$bench'. */\n";
|
||||||
return $res;
|
return $res;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -579,7 +580,7 @@ sub generate_grammar_list ($$@)
|
|||||||
my ($base, $max, @directive) = @_;
|
my ($base, $max, @directive) = @_;
|
||||||
my $directives = directives ($base, @directive);
|
my $directives = directives ($base, @directive);
|
||||||
my $variant = grep { /%define "?variant"?/ } @directive;
|
my $variant = grep { /%define "?variant"?/ } @directive;
|
||||||
my $lex_symbol = grep { /%define "?lex_symbol"?/ } @directive;
|
my $token_ctor = grep { /%define "?api.token.constructor"?/ } @directive;
|
||||||
my $out = new IO::File ">$base.y"
|
my $out = new IO::File ">$base.y"
|
||||||
or die;
|
or die;
|
||||||
print $out <<EOF;
|
print $out <<EOF;
|
||||||
@@ -601,16 +602,16 @@ $directives
|
|||||||
|
|
||||||
#define STAGE_MAX ($max * 10) // max = $max
|
#define STAGE_MAX ($max * 10) // max = $max
|
||||||
|
|
||||||
#define USE_LEX_SYMBOL $lex_symbol
|
#define USE_TOKEN_CTOR $token_ctor
|
||||||
#define USE_VARIANTS $variant
|
#define USE_VARIANTS $variant
|
||||||
|
|
||||||
// Prototype of the yylex function providing subsequent tokens.
|
// Prototype of the yylex function providing subsequent tokens.
|
||||||
static
|
static
|
||||||
#if USE_LEX_SYMBOL
|
#if USE_TOKEN_CTOR
|
||||||
yy::parser::symbol_type yylex();
|
yy::parser::symbol_type yylex();
|
||||||
#else
|
#else
|
||||||
yy::parser::token_type yylex(yy::parser::semantic_type* yylval,
|
yy::parser::token_type yylex(yy::parser::semantic_type* yylvalp,
|
||||||
yy::parser::location_type* yylloc);
|
yy::parser::location_type* yyllocp);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Conversion to string.
|
// Conversion to string.
|
||||||
@@ -678,11 +679,11 @@ EOF
|
|||||||
#
|
#
|
||||||
|
|
||||||
static
|
static
|
||||||
#if USE_LEX_SYMBOL
|
#if USE_TOKEN_CTOR
|
||||||
yy::parser::symbol_type yylex()
|
yy::parser::symbol_type yylex()
|
||||||
#else
|
#else
|
||||||
yy::parser::token_type yylex(yy::parser::semantic_type* yylval,
|
yy::parser::token_type yylex(yy::parser::semantic_type* yylvalp,
|
||||||
yy::parser::location_type* yylloc)
|
yy::parser::location_type* yyllocp)
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
typedef yy::parser::location_type location_type;
|
typedef yy::parser::location_type location_type;
|
||||||
@@ -691,42 +692,42 @@ yy::parser::token_type yylex(yy::parser::semantic_type* yylval,
|
|||||||
++stage;
|
++stage;
|
||||||
if (stage == STAGE_MAX)
|
if (stage == STAGE_MAX)
|
||||||
{
|
{
|
||||||
#if USE_LEX_SYMBOL
|
#if USE_TOKEN_CTOR
|
||||||
return yy::parser::make_END_OF_FILE (location_type ());
|
return yy::parser::make_END_OF_FILE (location_type ());
|
||||||
#else
|
#else
|
||||||
*yylloc = location_type ();
|
*yyllocp = location_type ();
|
||||||
return token::END_OF_FILE;
|
return token::END_OF_FILE;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
else if (stage % 2)
|
else if (stage % 2)
|
||||||
{
|
{
|
||||||
#if USE_LEX_SYMBOL
|
#if USE_TOKEN_CTOR
|
||||||
return yy::parser::make_NUMBER (stage, location_type ());
|
return yy::parser::make_NUMBER (stage, location_type ());
|
||||||
#else
|
#else
|
||||||
# if defined ONE_STAGE_BUILD
|
# if defined ONE_STAGE_BUILD
|
||||||
yylval->build(stage);
|
yylvalp->build(stage);
|
||||||
# elif USE_VARIANTS
|
# elif USE_VARIANTS
|
||||||
yylval->build<int>() = stage;
|
yylvalp->build<int>() = stage;
|
||||||
# else
|
# else
|
||||||
yylval->ival = stage;
|
yylvalp->ival = stage;
|
||||||
# endif
|
# endif
|
||||||
*yylloc = location_type ();
|
*yyllocp = location_type ();
|
||||||
return token::NUMBER;
|
return token::NUMBER;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
#if USE_LEX_SYMBOL
|
#if USE_TOKEN_CTOR
|
||||||
return yy::parser::make_TEXT ("A string.", location_type ());
|
return yy::parser::make_TEXT ("A string.", location_type ());
|
||||||
#else
|
#else
|
||||||
# if defined ONE_STAGE_BUILD
|
# if defined ONE_STAGE_BUILD
|
||||||
yylval->build(std::string("A string."));
|
yylvalp->build(std::string("A string."));
|
||||||
# elif USE_VARIANTS
|
# elif USE_VARIANTS
|
||||||
yylval->build<std::string>() = std::string("A string.");
|
yylvalp->build<std::string>() = std::string("A string.");
|
||||||
# else
|
# else
|
||||||
yylval->sval = new std::string("A string.");
|
yylvalp->sval = new std::string("A string.");
|
||||||
# endif
|
# endif
|
||||||
*yylloc = location_type ();
|
*yyllocp = location_type ();
|
||||||
return token::TEXT;
|
return token::TEXT;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
@@ -737,7 +738,7 @@ yy::parser::token_type yylex(yy::parser::semantic_type* yylval,
|
|||||||
void
|
void
|
||||||
yy::parser::error(const yy::parser::location_type& loc, const std::string& msg)
|
yy::parser::error(const yy::parser::location_type& loc, const std::string& msg)
|
||||||
{
|
{
|
||||||
std::cerr << loc << ": " << msg << std::endl;
|
std::cerr << loc << ": " << msg << '\n';
|
||||||
}
|
}
|
||||||
|
|
||||||
int main(int argc, char *argv[])
|
int main(int argc, char *argv[])
|
||||||
@@ -806,7 +807,8 @@ sub compile ($)
|
|||||||
|
|
||||||
my $compiler = $language eq 'C++' ? $cxx : $cc;
|
my $compiler = $language eq 'C++' ? $cxx : $cc;
|
||||||
|
|
||||||
run "$bison $base.y -o $base.c";
|
my $my_bison = `sed -ne '/%bison "\\(.*\\)"/{s//\\1/;p;q;}' $base.y`;
|
||||||
|
run ((length $my_bison ? $my_bison : $bison) . " $base.y -o $base.c");
|
||||||
run "$compiler -o $base $cflags $base.c";
|
run "$compiler -o $base $cflags $base.c";
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -914,7 +916,7 @@ sub bench_variant_parser ()
|
|||||||
[
|
[
|
||||||
%d variant
|
%d variant
|
||||||
&
|
&
|
||||||
[ #d ONE_STAGE_BUILD | %d lex_symbol ]
|
[ #d ONE_STAGE_BUILD | %d api.token.constructor ]
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
@@ -1048,6 +1050,12 @@ sub parse_dirs ()
|
|||||||
@res = ("%skeleton \"$token[0]\"");
|
@res = ("%skeleton \"$token[0]\"");
|
||||||
shift @token;
|
shift @token;
|
||||||
}
|
}
|
||||||
|
elsif ($token[0] eq '%b')
|
||||||
|
{
|
||||||
|
shift @token;
|
||||||
|
@res = ("/*\n%bison \"$token[0]\"\\\n*/");
|
||||||
|
shift @token;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@res = $token[0];
|
@res = $token[0];
|
||||||
|
|||||||
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
## Copyright (C) 2006, 2008-2012 Free Software Foundation, Inc.
|
## Copyright (C) 2006, 2008-2015, 2018 Free Software Foundation, Inc.
|
||||||
|
|
||||||
## This program is free software: you can redistribute it and/or modify
|
## 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
|
## it under the terms of the GNU General Public License as published by
|
||||||
|
|||||||
@@ -1,220 +0,0 @@
|
|||||||
#! /usr/bin/perl -w
|
|
||||||
|
|
||||||
use strict;
|
|
||||||
use IO::File;
|
|
||||||
use Getopt::Long;
|
|
||||||
use File::Basename; # for dirname
|
|
||||||
|
|
||||||
my $VERSION = '2012-01-21 17:13'; # UTC
|
|
||||||
(my $ME = $0) =~ s|.*/||;
|
|
||||||
|
|
||||||
my $prefix;
|
|
||||||
my $lib_name;
|
|
||||||
|
|
||||||
sub usage ($)
|
|
||||||
{
|
|
||||||
my ($exit_code) = @_;
|
|
||||||
my $STREAM = ($exit_code == 0 ? *STDOUT : *STDERR);
|
|
||||||
if ($exit_code != 0)
|
|
||||||
{
|
|
||||||
print $STREAM "Try '$ME --help' for more information.\n";
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
print $STREAM <<EOF;
|
|
||||||
Usage: $ME --lib-name=NAME FILE
|
|
||||||
or: $ME [--help|--version]
|
|
||||||
Rewrite a gnulib-tool-generated FILE like lib/gnulib.mk to work with
|
|
||||||
automake's subdir-objects.
|
|
||||||
|
|
||||||
OPTIONS:
|
|
||||||
|
|
||||||
This option must be specified:
|
|
||||||
|
|
||||||
--lib-name=NAME library name, often "lib\$project"
|
|
||||||
|
|
||||||
The following are optional:
|
|
||||||
|
|
||||||
--help display this help and exit
|
|
||||||
--version output version information and exit
|
|
||||||
|
|
||||||
EOF
|
|
||||||
}
|
|
||||||
exit $exit_code;
|
|
||||||
}
|
|
||||||
|
|
||||||
# contents ($FILE_NAME)
|
|
||||||
# ---------------------
|
|
||||||
sub contents ($)
|
|
||||||
{
|
|
||||||
my ($file) = @_;
|
|
||||||
local $/; # Turn on slurp-mode.
|
|
||||||
my $f = new IO::File "< $file" or die "$file";
|
|
||||||
my $contents = $f->getline or die "$file";
|
|
||||||
$f->close;
|
|
||||||
return $contents;
|
|
||||||
}
|
|
||||||
|
|
||||||
# prefix_word ($WORD)
|
|
||||||
# -------------------
|
|
||||||
# Do not prefix special words such as variable dereferences. Also,
|
|
||||||
# "Makefile" is really "Makefile", since precisely there is no
|
|
||||||
# lib/Makefile.
|
|
||||||
sub prefix_word ($)
|
|
||||||
{
|
|
||||||
local ($_) = @_;
|
|
||||||
$_ = $prefix . $_
|
|
||||||
unless /^-/ || m{^\$\(\w+\)} || $_ eq "Makefile" || $_ eq '\\';
|
|
||||||
return $_;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
# prefix_words ($TEXT)
|
|
||||||
# --------------------
|
|
||||||
sub prefix_words ($)
|
|
||||||
{
|
|
||||||
local ($_) = @_;
|
|
||||||
s{(\S+)}{prefix_word($1)}gem;
|
|
||||||
return $_;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
# prefix_assignment ($LHS-AND-ASSIGN-OP, $RHS)
|
|
||||||
# --------------------------------------------
|
|
||||||
sub prefix_assignment ($$)
|
|
||||||
{
|
|
||||||
my ($lhs_and_assign_op, $rhs) = @_;
|
|
||||||
my $res;
|
|
||||||
|
|
||||||
# Some variables are initialized by gnulib.mk, and we don't want
|
|
||||||
# that. Change '=' to '+='.
|
|
||||||
if ($lhs_and_assign_op =~ /^(SUBDIRS|EXTRA_DIST|BUILT_SOURCES|SUFFIXES|MOSTLYCLEANFILES|CLEANFILES|DISTCLEANFILES|MAINTAINERCLEANFILES|AM_CFLAGS|AM_CPPFLAGS|AM_GNU_GETTEXT) =/)
|
|
||||||
{
|
|
||||||
$lhs_and_assign_op =~ s/=/+=/;
|
|
||||||
}
|
|
||||||
# We don't want to inherit gnulib's AUTOMAKE_OPTIONS, comment them.
|
|
||||||
elsif ($lhs_and_assign_op =~ /^AUTOMAKE_OPTIONS =/)
|
|
||||||
{
|
|
||||||
$lhs_and_assign_op =~ s/^/# /;
|
|
||||||
}
|
|
||||||
# Don't touch suffixes.
|
|
||||||
elsif ($lhs_and_assign_op =~ /^SUFFIXES /)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
# The words are (probably) paths to files in lib/: prefix them.
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$rhs = prefix_words($rhs)
|
|
||||||
}
|
|
||||||
|
|
||||||
# Variables which name depend on the location: libbison_a_SOURCES =>
|
|
||||||
# lib_libbison_a_SOURCES.
|
|
||||||
$lhs_and_assign_op =~ s/($lib_name)/lib_$1/g;
|
|
||||||
|
|
||||||
return $lhs_and_assign_op . $rhs;
|
|
||||||
}
|
|
||||||
|
|
||||||
# prefix $CONTENTS
|
|
||||||
# ----------------
|
|
||||||
# $CONTENTS is a Makefile content. Post-process it so that each file-name
|
|
||||||
# is prefixed with $prefix (e.g., "lib/").
|
|
||||||
#
|
|
||||||
# Relies heavily on the regularity of the file generated by gnulib-tool.
|
|
||||||
sub prefix ($)
|
|
||||||
{
|
|
||||||
# Work on $_.
|
|
||||||
local ($_) = @_;
|
|
||||||
|
|
||||||
# Prefix all the occurrence of files in rules. If there is nothing
|
|
||||||
# after in the :, it's probably a phony target, or a suffix rule.
|
|
||||||
# Don't touch it.
|
|
||||||
s{^([-\w+/]+\.[-\w.]+ *: *\S.*)$}
|
|
||||||
{prefix_words($1)}gem;
|
|
||||||
|
|
||||||
# Prefix files in variables.
|
|
||||||
s{^([\w.]+\s*\+?=)(.*)$}
|
|
||||||
{prefix_assignment($1, $2)}gem;
|
|
||||||
|
|
||||||
# These three guys escape all the other regular rules.
|
|
||||||
s{(charset\.alias|ref-add\.sed|ref-del\.sed)}{$prefix$1}g;
|
|
||||||
# Unfortunately, as a result we sometimes have lib/lib.
|
|
||||||
s{($prefix){2}}{$1}g;
|
|
||||||
|
|
||||||
# $(srcdir) is actually $(top_srcdir)/lib.
|
|
||||||
s{\$\(srcdir\)}{\$(top_srcdir)/lib}g;
|
|
||||||
|
|
||||||
# Sometimes, t-$@ is used instead of $@-t, which, of course, does
|
|
||||||
# not work when we have a $@ with a directory in it.
|
|
||||||
s{t-\$\@}{\$\@-t}g;
|
|
||||||
|
|
||||||
# Some AC_SUBST patterns remain and would better be Make macros.
|
|
||||||
s{\@(MKDIR_P)\@}{\$($1)}g;
|
|
||||||
|
|
||||||
# Adjust paths in mkdir.
|
|
||||||
s{(\$\(MKDIR_P\))\s*(\w+)}{$1 $prefix$2}g;
|
|
||||||
|
|
||||||
return $_;
|
|
||||||
}
|
|
||||||
|
|
||||||
# process ($IN)
|
|
||||||
# -------------
|
|
||||||
sub process ($)
|
|
||||||
{
|
|
||||||
my ($file) = @_;
|
|
||||||
my ($bak) = "$file.bak";
|
|
||||||
rename ($file, $bak) or die;
|
|
||||||
my $contents = contents ($bak);
|
|
||||||
$contents = prefix ($contents);
|
|
||||||
my $out = new IO::File(">$file") or die;
|
|
||||||
print $out $contents;
|
|
||||||
}
|
|
||||||
|
|
||||||
{
|
|
||||||
GetOptions
|
|
||||||
(
|
|
||||||
'lib-name=s' => \$lib_name,
|
|
||||||
help => sub { usage 0 },
|
|
||||||
version => sub { print "$ME version $VERSION\n"; exit },
|
|
||||||
) or usage 1;
|
|
||||||
|
|
||||||
my $fail = 0;
|
|
||||||
defined $lib_name
|
|
||||||
or (warn "$ME: no library name; use --lib-name=NAME\n"), $fail = 1;
|
|
||||||
|
|
||||||
# There must be exactly one argument.
|
|
||||||
@ARGV == 0
|
|
||||||
and (warn "$ME: missing FILE argument\n"), $fail = 1;
|
|
||||||
1 < @ARGV
|
|
||||||
and (warn "$ME: too many arguments:\n", join ("\n", @ARGV), "\n"),
|
|
||||||
$fail = 1;
|
|
||||||
$fail
|
|
||||||
and usage 1;
|
|
||||||
|
|
||||||
my $file = $ARGV[0];
|
|
||||||
$prefix = (dirname $file) . '/';
|
|
||||||
warn "prefix=$prefix\n";
|
|
||||||
|
|
||||||
process $file;
|
|
||||||
}
|
|
||||||
|
|
||||||
### Setup "GNU" style for perl-mode and cperl-mode.
|
|
||||||
## Local Variables:
|
|
||||||
## perl-indent-level: 2
|
|
||||||
## perl-continued-statement-offset: 2
|
|
||||||
## perl-continued-brace-offset: 0
|
|
||||||
## perl-brace-offset: 0
|
|
||||||
## perl-brace-imaginary-offset: 0
|
|
||||||
## perl-label-offset: -2
|
|
||||||
## cperl-indent-level: 2
|
|
||||||
## cperl-brace-offset: 0
|
|
||||||
## cperl-continued-brace-offset: 0
|
|
||||||
## cperl-label-offset: -2
|
|
||||||
## cperl-extra-newline-before-brace: t
|
|
||||||
## cperl-merge-trailing-else: nil
|
|
||||||
## cperl-continued-statement-offset: 2
|
|
||||||
## eval: (add-hook 'write-file-hooks 'time-stamp)
|
|
||||||
## time-stamp-start: "my $VERSION = '"
|
|
||||||
## time-stamp-format: "%:y-%02m-%02d %02H:%02M"
|
|
||||||
## time-stamp-time-zone: "UTC"
|
|
||||||
## time-stamp-end: "'; # UTC"
|
|
||||||
## End:
|
|
||||||
@@ -0,0 +1,40 @@
|
|||||||
|
This directory contains examples of Bison grammar files.
|
||||||
|
|
||||||
|
* mfcalc
|
||||||
|
A C example of a multi-function calculator. Extracted from the
|
||||||
|
documentation.
|
||||||
|
|
||||||
|
* calc++
|
||||||
|
A C++ version of the canonical example for parsers: a calculator. Also uses
|
||||||
|
Flex for the scanner. Extracted from the documentation.
|
||||||
|
|
||||||
|
* variant.yy
|
||||||
|
A C++ example that uses variants (they allow to use any C++ type as semantic
|
||||||
|
value type) and symbol constructors (they ensure consistency between
|
||||||
|
declared token type and effective semantic value).
|
||||||
|
|
||||||
|
-----
|
||||||
|
|
||||||
|
Local Variables:
|
||||||
|
mode: outline
|
||||||
|
fill-column: 76
|
||||||
|
End:
|
||||||
|
|
||||||
|
Copyright (C) 2018 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 3 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, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
# LocalWords: mfcalc calc parsers yy
|
||||||
@@ -2,18 +2,18 @@
|
|||||||
/*.tmp
|
/*.tmp
|
||||||
/.deps
|
/.deps
|
||||||
/calc++
|
/calc++
|
||||||
/calc++-driver.cc
|
|
||||||
/calc++-driver.hh
|
|
||||||
/calc++-parser.cc
|
|
||||||
/calc++-parser.hh
|
|
||||||
/calc++-parser.output
|
|
||||||
/calc++-parser.stamp
|
|
||||||
/calc++-parser.yy
|
|
||||||
/calc++-scanner.cc
|
|
||||||
/calc++-scanner.ll
|
|
||||||
/calc++.cc
|
/calc++.cc
|
||||||
/calc++.exe
|
/calc++.exe
|
||||||
/calc.stamp
|
/calc.stamp
|
||||||
|
/driver.cc
|
||||||
|
/driver.hh
|
||||||
/location.hh
|
/location.hh
|
||||||
|
/parser.cc
|
||||||
|
/parser.hh
|
||||||
|
/parser.output
|
||||||
|
/parser.stamp
|
||||||
|
/parser.yy
|
||||||
/position.hh
|
/position.hh
|
||||||
|
/scanner.cc
|
||||||
|
/scanner.ll
|
||||||
/stack.hh
|
/stack.hh
|
||||||
|
|||||||
@@ -0,0 +1,27 @@
|
|||||||
|
# This Makefile is designed to be simple and readable. It does not
|
||||||
|
# aim at portability. It requires GNU Make.
|
||||||
|
|
||||||
|
BISON = bison
|
||||||
|
CXX = g++
|
||||||
|
FLEX = flex
|
||||||
|
|
||||||
|
all: calc++
|
||||||
|
|
||||||
|
%.cc %.hh: %.yy
|
||||||
|
$(BISON) $(BISONFLAGS) -o $*.cc $<
|
||||||
|
|
||||||
|
%.cc: %.ll
|
||||||
|
$(FLEX) $(FLEXFLAGS) -o$@ $<
|
||||||
|
|
||||||
|
%.o: %.cc
|
||||||
|
$(CXX) $(CXXFLAGS) -c -o$@ $<
|
||||||
|
|
||||||
|
calc++: calc++.o driver.o parser.o scanner.o
|
||||||
|
$(CXX) -o $@ $^
|
||||||
|
|
||||||
|
calc++.o: parser.hh
|
||||||
|
parser.o: parser.hh
|
||||||
|
scanner.o: parser.hh
|
||||||
|
|
||||||
|
clean:
|
||||||
|
rm -f calc++ *.o parser.hh parser.cc scanner.cc
|
||||||
@@ -0,0 +1,51 @@
|
|||||||
|
This directory contains calc++, a simple Bison grammar file in C++.
|
||||||
|
|
||||||
|
Please, read the corresponding chapter in the documentation: "A Complete C++
|
||||||
|
Example". It is also available on line (maybe with a different version of
|
||||||
|
Bison):
|
||||||
|
https://www.gnu.org/software/bison/manual/html_node/A-Complete-C_002b_002b-Example.html
|
||||||
|
|
||||||
|
To use it, copy this directory into some work directory, and run `make` to
|
||||||
|
compile the executable, and try it. It is a simple calculator which accepts
|
||||||
|
several variable definitions, one per line, and then a single expression to
|
||||||
|
evaluate.
|
||||||
|
|
||||||
|
The program calc++ expects the file to parse as argument; pass `-` to read
|
||||||
|
the standard input (and then hit <Ctrl-d>, control-d, to end your input).
|
||||||
|
|
||||||
|
$ ./calc++ -
|
||||||
|
one := 1
|
||||||
|
two := 2
|
||||||
|
three := 3
|
||||||
|
(one + two * three) * two * three
|
||||||
|
<Ctrl-d>
|
||||||
|
42
|
||||||
|
|
||||||
|
You may pass `-p` to activate the parser debug traces, and `-s` to activate
|
||||||
|
the scanner's.
|
||||||
|
|
||||||
|
-----
|
||||||
|
|
||||||
|
Local Variables:
|
||||||
|
mode: outline
|
||||||
|
fill-column: 76
|
||||||
|
End:
|
||||||
|
|
||||||
|
Copyright (C) 2018 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 3 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, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
# LocalWords: mfcalc calc parsers yy MERCHANTABILITY
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
#! /bin/sh
|
#! /bin/sh
|
||||||
|
|
||||||
# Copyright (C) 2005-2012 Free Software Foundation, Inc.
|
# Copyright (C) 2005-2015, 2018 Free Software Foundation, Inc.
|
||||||
#
|
#
|
||||||
# This program is free software: you can redistribute it and/or modify
|
# 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
|
# it under the terms of the GNU General Public License as published by
|
||||||
|
|||||||
+48
-35
@@ -1,4 +1,5 @@
|
|||||||
# Copyright (C) 2005-2006, 2008-2012 Free Software Foundation, Inc.
|
# Copyright (C) 2005-2006, 2008-2015, 2018 Free Software Foundation,
|
||||||
|
# Inc.
|
||||||
#
|
#
|
||||||
# This program is free software: you can redistribute it and/or modify
|
# 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
|
# it under the terms of the GNU General Public License as published by
|
||||||
@@ -19,7 +20,7 @@
|
|||||||
|
|
||||||
# Don't depend on $(BISON) otherwise we would rebuild these files
|
# Don't depend on $(BISON) otherwise we would rebuild these files
|
||||||
# in srcdir, including during distcheck, which is forbidden.
|
# in srcdir, including during distcheck, which is forbidden.
|
||||||
examples/calc++/calc++-parser.stamp: $(BISON_IN)
|
%D%/parser.stamp: $(BISON_IN)
|
||||||
SUFFIXES += .yy .stamp
|
SUFFIXES += .yy .stamp
|
||||||
.yy.stamp:
|
.yy.stamp:
|
||||||
$(AM_V_YACC)rm -f $@
|
$(AM_V_YACC)rm -f $@
|
||||||
@@ -27,14 +28,14 @@ SUFFIXES += .yy .stamp
|
|||||||
$(AM_V_at)$(YACCCOMPILE) -o $*.cc $<
|
$(AM_V_at)$(YACCCOMPILE) -o $*.cc $<
|
||||||
$(AM_V_at)mv -f $@.tmp $@
|
$(AM_V_at)mv -f $@.tmp $@
|
||||||
|
|
||||||
$(calc_sources_generated): examples/calc++/calc++-parser.stamp
|
$(calcxx_sources_generated): %D%/parser.stamp
|
||||||
@test -f $@ || rm -f examples/calc++/calc++-parser.stamp
|
@test -f $@ || rm -f %D%/parser.stamp
|
||||||
@test -f $@ || $(MAKE) $(AM_MAKEFLAGS) examples/calc++/calc++-parser.stamp
|
@test -f $@ || $(MAKE) $(AM_MAKEFLAGS) %D%/parser.stamp
|
||||||
CLEANFILES += \
|
CLEANFILES += \
|
||||||
$(calc_sources_generated) \
|
$(calcxx_sources_generated) \
|
||||||
examples/calc++/calc++-parser.output \
|
%D%/parser.output \
|
||||||
examples/calc++/calc++-parser.stamp \
|
%D%/parser.stamp \
|
||||||
examples/calc++/calc++-scanner.cc
|
%D%/scanner.cc
|
||||||
|
|
||||||
|
|
||||||
## -------------------- ##
|
## -------------------- ##
|
||||||
@@ -42,32 +43,44 @@ CLEANFILES += \
|
|||||||
## -------------------- ##
|
## -------------------- ##
|
||||||
|
|
||||||
# Avoid using BUILT_SOURCES which is too global.
|
# Avoid using BUILT_SOURCES which is too global.
|
||||||
$(examples_calc___calc___OBJECTS): $(calc_sources_generated)
|
$(%C%_calc___OBJECTS): $(calcxx_sources_generated)
|
||||||
|
|
||||||
calc_sources_extracted = \
|
calcxx_sources_extracted = \
|
||||||
examples/calc++/calc++-driver.cc \
|
%D%/driver.cc \
|
||||||
examples/calc++/calc++-driver.hh \
|
%D%/driver.hh \
|
||||||
examples/calc++/calc++-scanner.ll \
|
%D%/scanner.ll \
|
||||||
examples/calc++/calc++.cc
|
%D%/calc++.cc
|
||||||
calc_extracted = \
|
calcxx_extracted = \
|
||||||
$(calc_sources_extracted) \
|
$(calcxx_sources_extracted) \
|
||||||
examples/calc++/calc++-parser.yy
|
%D%/parser.yy
|
||||||
extracted += $(calc_extracted)
|
extracted += $(calcxx_extracted)
|
||||||
calc_sources_generated = \
|
calcxx_sources_generated = \
|
||||||
examples/calc++/calc++-parser.cc \
|
%D%/parser.cc \
|
||||||
examples/calc++/calc++-parser.hh \
|
%D%/parser.hh \
|
||||||
examples/calc++/location.hh \
|
%D%/location.hh \
|
||||||
examples/calc++/position.hh \
|
%D%/position.hh \
|
||||||
examples/calc++/stack.hh
|
%D%/stack.hh
|
||||||
calc_sources = \
|
calcxx_sources = \
|
||||||
$(calc_sources_extracted) \
|
$(calcxx_sources_extracted) \
|
||||||
$(calc_sources_generated)
|
$(calcxx_sources_generated)
|
||||||
|
|
||||||
if BISON_CXX_WORKS
|
if FLEX_CXX_WORKS
|
||||||
check_PROGRAMS += examples/calc++/calc++
|
check_PROGRAMS += %D%/calc++
|
||||||
nodist_examples_calc___calc___SOURCES = \
|
nodist_%C%_calc___SOURCES = \
|
||||||
$(calc_sources)
|
$(calcxx_sources)
|
||||||
|
|
||||||
examples_calc___calc___CPPFLAGS = -I$(top_builddir)/examples/calc++
|
%C%_calc___CPPFLAGS = -I$(top_builddir)/%D%
|
||||||
dist_TESTS += examples/calc++/calc++.test
|
%C%_calc___CXXFLAGS = $(AM_CXXFLAGS) $(FLEX_SCANNER_CXXFLAGS)
|
||||||
|
dist_TESTS += %D%/calc++.test
|
||||||
|
else
|
||||||
|
EXTRA_DIST += %D%/calc++.test
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
|
||||||
|
## ------------ ##
|
||||||
|
## Installing. ##
|
||||||
|
## ------------ ##
|
||||||
|
|
||||||
|
calcxxdir = $(docdir)/examples/calc++
|
||||||
|
calcxx_DATA = $(calcxx_extracted)
|
||||||
|
dist_calcxx_DATA = %D%/README %D%/Makefile
|
||||||
|
|||||||
@@ -1,6 +0,0 @@
|
|||||||
// Work around an Automake 1.11.2 bug: it asks for the creation of
|
|
||||||
// y.tab.c and y.tab.h and then renames them as calc++-parser.cc and
|
|
||||||
// calc++-parser.h, but in the former it does not convert the
|
|
||||||
// #include "y.tab.h". We don't want this to show in the
|
|
||||||
// documentation.
|
|
||||||
#include "calc++-parser.hh"
|
|
||||||
+33
-14
@@ -3,8 +3,8 @@
|
|||||||
|
|
||||||
# This file is part of GNU Bison
|
# This file is part of GNU Bison
|
||||||
|
|
||||||
# Copyright (C) 1992, 2000-2001, 2005-2006, 2009-2012 Free Software
|
# Copyright (C) 1992, 2000-2001, 2005-2006, 2009-2015, 2018 Free
|
||||||
# Foundation, Inc.
|
# Software Foundation, Inc.
|
||||||
#
|
#
|
||||||
# This program is free software: you can redistribute it and/or modify
|
# 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
|
# it under the terms of the GNU General Public License as published by
|
||||||
@@ -19,7 +19,7 @@
|
|||||||
# You should have received a copy of the GNU General Public License
|
# You should have received a copy of the GNU General Public License
|
||||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
# Usage: extexi input-file.texi ... -- [FILES to extract]
|
# Usage: extexi [OPTION...] input-file.texi ... -- [FILES to extract]
|
||||||
|
|
||||||
# Look for @example environments preceded with lines such as:
|
# Look for @example environments preceded with lines such as:
|
||||||
#
|
#
|
||||||
@@ -35,6 +35,9 @@
|
|||||||
|
|
||||||
use strict;
|
use strict;
|
||||||
|
|
||||||
|
# Whether we generate synclines.
|
||||||
|
my $synclines = 0;
|
||||||
|
|
||||||
# normalize($block)
|
# normalize($block)
|
||||||
# -----------------
|
# -----------------
|
||||||
# Remove Texinfo mark up.
|
# Remove Texinfo mark up.
|
||||||
@@ -42,7 +45,7 @@ sub normalize($)
|
|||||||
{
|
{
|
||||||
local ($_) = @_;
|
local ($_) = @_;
|
||||||
|
|
||||||
s/^\@(c |comment|dots|end (ignore|group)|ignore|group).*//mg;
|
s/^\@(c |comment|dots|end (ignore|group)|ignore|group).*\n//mg;
|
||||||
s/\@value\{VERSION\}/$ENV{VERSION}/g;
|
s/\@value\{VERSION\}/$ENV{VERSION}/g;
|
||||||
s/^\@(error|result)\{\}//mg;
|
s/^\@(error|result)\{\}//mg;
|
||||||
s/\@([{}@])/$1/g;
|
s/\@([{}@])/$1/g;
|
||||||
@@ -62,8 +65,21 @@ sub message($)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
# basename => full file name for files we should extract.
|
# The list of files we should extract.
|
||||||
my %file_wanted;
|
my @file_wanted;
|
||||||
|
|
||||||
|
# Whether we should extract that file, and then under which path.
|
||||||
|
sub file_wanted ($)
|
||||||
|
{
|
||||||
|
my ($f) = @_;
|
||||||
|
for my $file (@file_wanted)
|
||||||
|
{
|
||||||
|
# No endswith in Perl 5...
|
||||||
|
return $file if $f eq substr($file, -length($f));
|
||||||
|
}
|
||||||
|
undef
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
sub process ($)
|
sub process ($)
|
||||||
{
|
{
|
||||||
@@ -86,9 +102,9 @@ sub process ($)
|
|||||||
{
|
{
|
||||||
my $f = $1;
|
my $f = $1;
|
||||||
$block = $2 || 1;
|
$block = $2 || 1;
|
||||||
if ($file_wanted{$f})
|
if (file_wanted($f))
|
||||||
{
|
{
|
||||||
$file = $file_wanted{$f};
|
$file = file_wanted($f);
|
||||||
message(" GEN $file");
|
message(" GEN $file");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -102,14 +118,14 @@ sub process ($)
|
|||||||
{
|
{
|
||||||
# Bison supports synclines, but not Flex.
|
# Bison supports synclines, but not Flex.
|
||||||
$input .= sprintf ("#line %s \"$in\"\n", $. + 1)
|
$input .= sprintf ("#line %s \"$in\"\n", $. + 1)
|
||||||
if $file =~ /\.[chy]*$/;
|
if $synclines && $file =~ /\.[chy]*$/;
|
||||||
next;
|
|
||||||
}
|
}
|
||||||
elsif (/^\@end (small)?example$/)
|
elsif (/^\@end (small)?example$/)
|
||||||
{
|
{
|
||||||
die "no contents: $file"
|
die "no contents: $file"
|
||||||
if $input eq "";
|
if $input eq "";
|
||||||
|
|
||||||
|
$file{$file}{$block} .= "\n" if defined $file{$file}{$block};
|
||||||
$file{$file}{$block} .= normalize($input);
|
$file{$file}{$block} .= normalize($input);
|
||||||
$file = $input = undef;
|
$file = $input = undef;
|
||||||
++$block;
|
++$block;
|
||||||
@@ -136,14 +152,17 @@ my @input;
|
|||||||
my $seen_dash = 0;
|
my $seen_dash = 0;
|
||||||
for my $arg (@ARGV)
|
for my $arg (@ARGV)
|
||||||
{
|
{
|
||||||
if ($arg eq '--')
|
if ($seen_dash)
|
||||||
|
{
|
||||||
|
push @file_wanted, $arg;
|
||||||
|
}
|
||||||
|
elsif ($arg eq '--')
|
||||||
{
|
{
|
||||||
$seen_dash = 1;
|
$seen_dash = 1;
|
||||||
}
|
}
|
||||||
elsif ($seen_dash)
|
elsif ($arg eq '--synclines')
|
||||||
{
|
{
|
||||||
use File::Basename;
|
$synclines = 1;
|
||||||
$file_wanted{basename($arg)} = $arg;
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
+32
-13
@@ -1,4 +1,4 @@
|
|||||||
# Copyright (C) 2005, 2008-2012 Free Software Foundation, Inc.
|
# Copyright (C) 2005, 2008-2015, 2018 Free Software Foundation, Inc.
|
||||||
#
|
#
|
||||||
# This program is free software: you can redistribute it and/or modify
|
# 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
|
# it under the terms of the GNU General Public License as published by
|
||||||
@@ -13,28 +13,47 @@
|
|||||||
# You should have received a copy of the GNU General Public License
|
# You should have received a copy of the GNU General Public License
|
||||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
dist_noinst_SCRIPTS = examples/extexi examples/test
|
dist_noinst_SCRIPTS = %D%/extexi %D%/test
|
||||||
TEST_LOG_COMPILER = $(top_srcdir)/examples/test
|
TEST_LOG_COMPILER = $(top_srcdir)/%D%/test
|
||||||
|
|
||||||
|
AM_CXXFLAGS = \
|
||||||
|
$(WARN_CXXFLAGS) $(WARN_CXXFLAGS_TEST) $(WERROR_CXXFLAGS)
|
||||||
|
|
||||||
## ------------ ##
|
## ------------ ##
|
||||||
## Extracting. ##
|
## Extracting. ##
|
||||||
## ------------ ##
|
## ------------ ##
|
||||||
|
|
||||||
doc = $(top_srcdir)/doc/bison.texi
|
doc = $(top_srcdir)/doc/bison.texi
|
||||||
extexi = $(top_srcdir)/examples/extexi
|
extexi = $(top_srcdir)/%D%/extexi
|
||||||
extract = VERSION="$(VERSION)" $(PERL) -f $(extexi) $(doc) --
|
if ENABLE_GCC_WARNINGS
|
||||||
|
EXTEXIFLAGS = --synclines
|
||||||
|
endif
|
||||||
|
extract = VERSION="$(VERSION)" $(PERL) $(extexi) $(EXTEXIFLAGS) $(doc) --
|
||||||
extracted =
|
extracted =
|
||||||
CLEANFILES += $(extracted) examples/extracted.stamp
|
CLEANFILES += $(extracted) %D%/extracted.stamp
|
||||||
examples/extracted.stamp: $(doc) $(extexi)
|
%D%/extracted.stamp: $(doc) $(extexi)
|
||||||
$(AM_V_GEN)rm -f $@ $@.tmp
|
$(AM_V_GEN)rm -f $@ $@.tmp
|
||||||
$(AM_V_at)touch $@.tmp
|
$(AM_V_at)touch $@.tmp
|
||||||
$(AM_V_at)$(extract) $(extracted)
|
$(AM_V_at)$(extract) $(extracted)
|
||||||
$(AM_V_at)mv $@.tmp $@
|
$(AM_V_at)mv $@.tmp $@
|
||||||
|
|
||||||
$(extracted): examples/extracted.stamp
|
$(extracted): %D%/extracted.stamp
|
||||||
@test -f $@ || rm -f examples/extracted.stamp
|
@test -f $@ || rm -f %D%/extracted.stamp
|
||||||
@test -f $@ || $(MAKE) $(AM_MAKEFLAGS) examples/extracted.stamp
|
@test -f $@ || $(MAKE) $(AM_MAKEFLAGS) %D%/extracted.stamp
|
||||||
|
|
||||||
include examples/calc++/local.mk
|
## ---------- ##
|
||||||
include examples/mfcalc/local.mk
|
## Examples. ##
|
||||||
include examples/rpcalc/local.mk
|
## ---------- ##
|
||||||
|
|
||||||
|
examplesdir = $(docdir)/examples
|
||||||
|
dist_examples_DATA = %D%/README %D%/variant.yy
|
||||||
|
|
||||||
|
check_PROGRAMS += %D%/variant
|
||||||
|
nodist_%C%_variant_SOURCES = %D%/variant.yy
|
||||||
|
%C%_variant_CPPFLAGS = -I$(top_builddir)
|
||||||
|
dist_TESTS += %D%/variant.test
|
||||||
|
|
||||||
|
|
||||||
|
include %D%/calc++/local.mk
|
||||||
|
include %D%/mfcalc/local.mk
|
||||||
|
include %D%/rpcalc/local.mk
|
||||||
|
|||||||
+17
-13
@@ -1,4 +1,5 @@
|
|||||||
# Copyright (C) 2005-2006, 2008-2012 Free Software Foundation, Inc.
|
# Copyright (C) 2005-2006, 2008-2015, 2018 Free Software Foundation,
|
||||||
|
# Inc.
|
||||||
#
|
#
|
||||||
# This program is free software: you can redistribute it and/or modify
|
# 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
|
# it under the terms of the GNU General Public License as published by
|
||||||
@@ -18,19 +19,22 @@
|
|||||||
## -------------------- ##
|
## -------------------- ##
|
||||||
|
|
||||||
BUILT_SOURCES += $(mfcalc_sources)
|
BUILT_SOURCES += $(mfcalc_sources)
|
||||||
CLEANFILES += examples/mfcalc/mfcalc.[ch] examples/mfcalc/mfcalc.output
|
CLEANFILES += %D%/mfcalc.[ch] %D%/mfcalc.output
|
||||||
|
|
||||||
mfcalc_extracted = \
|
mfcalc_extracted = %D%/calc.h %D%/mfcalc.y
|
||||||
examples/mfcalc/calc.h \
|
mfcalc_sources = $(mfcalc_extracted)
|
||||||
examples/mfcalc/mfcalc.y
|
|
||||||
mfcalc_sources = \
|
|
||||||
$(mfcalc_extracted)
|
|
||||||
extracted += $(mfcalc_extracted)
|
extracted += $(mfcalc_extracted)
|
||||||
|
|
||||||
check_PROGRAMS += examples/mfcalc/mfcalc
|
check_PROGRAMS += %D%/mfcalc
|
||||||
examples_mfcalc_mfcalc_LDADD = -lm
|
nodist_%C%_mfcalc_SOURCES = $(mfcalc_sources)
|
||||||
nodist_examples_mfcalc_mfcalc_SOURCES = \
|
%C%_mfcalc_CPPFLAGS = -I$(top_builddir)/%D%
|
||||||
$(mfcalc_sources)
|
%C%_mfcalc_LDADD = -lm
|
||||||
|
|
||||||
examples_mfcalc_mfcalc_CPPFLAGS = -I$(top_builddir)/examples/mfcalc
|
dist_TESTS += %D%/mfcalc.test
|
||||||
dist_TESTS += examples/mfcalc/mfcalc.test
|
|
||||||
|
## ------------ ##
|
||||||
|
## Installing. ##
|
||||||
|
## ------------ ##
|
||||||
|
|
||||||
|
mfcalcdir = $(docdir)/examples/mfcalc
|
||||||
|
mfcalc_DATA = $(mfcalc_extracted)
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
#! /bin/sh
|
#! /bin/sh
|
||||||
|
|
||||||
# Copyright (C) 2005-2012 Free Software Foundation, Inc.
|
# Copyright (C) 2005-2015, 2018 Free Software Foundation, Inc.
|
||||||
#
|
#
|
||||||
# This program is free software: you can redistribute it and/or modify
|
# 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
|
# it under the terms of the GNU General Public License as published by
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
/calc.h
|
/calc.h
|
||||||
|
/rpcalc
|
||||||
/rpcalc.c
|
/rpcalc.c
|
||||||
/rpcalc.h
|
/rpcalc.h
|
||||||
/rpcalc.output
|
/rpcalc.output
|
||||||
|
|||||||
+17
-12
@@ -1,4 +1,5 @@
|
|||||||
# Copyright (C) 2005-2006, 2008-2012 Free Software Foundation, Inc.
|
# Copyright (C) 2005-2006, 2008-2015, 2018 Free Software Foundation,
|
||||||
|
# Inc.
|
||||||
#
|
#
|
||||||
# This program is free software: you can redistribute it and/or modify
|
# 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
|
# it under the terms of the GNU General Public License as published by
|
||||||
@@ -18,18 +19,22 @@
|
|||||||
## -------------------- ##
|
## -------------------- ##
|
||||||
|
|
||||||
BUILT_SOURCES += $(rpcalc_sources)
|
BUILT_SOURCES += $(rpcalc_sources)
|
||||||
CLEANFILES += examples/rpcalc/rpcalc.[ch] examples/rpcalc/rpcalc.output
|
CLEANFILES += %D%/rpcalc.[ch] %D%/rpcalc.output
|
||||||
|
|
||||||
rpcalc_extracted = \
|
rpcalc_extracted = %D%/rpcalc.y
|
||||||
examples/rpcalc/rpcalc.y
|
rpcalc_sources = $(rpcalc_extracted)
|
||||||
rpcalc_sources = \
|
|
||||||
$(rpcalc_extracted)
|
|
||||||
extracted += $(rpcalc_extracted)
|
extracted += $(rpcalc_extracted)
|
||||||
|
|
||||||
check_PROGRAMS += examples/rpcalc/rpcalc
|
check_PROGRAMS += %D%/rpcalc
|
||||||
examples_rpcalc_rpcalc_LDADD = -lm
|
nodist_%C%_rpcalc_SOURCES = $(rpcalc_sources)
|
||||||
nodist_examples_rpcalc_rpcalc_SOURCES = \
|
%C%_rpcalc_CPPFLAGS = -I$(top_builddir)/%D%
|
||||||
$(rpcalc_sources)
|
%C%_rpcalc_LDADD = -lm
|
||||||
|
|
||||||
examples_rpcalc_rpcalc_CPPFLAGS = -I$(top_builddir)/examples/rpcalc
|
dist_TESTS += %D%/rpcalc.test
|
||||||
dist_TESTS += examples/rpcalc/rpcalc.test
|
|
||||||
|
## ------------ ##
|
||||||
|
## Installing. ##
|
||||||
|
## ------------ ##
|
||||||
|
|
||||||
|
rpcalcdir = $(docdir)/examples/rpcalc
|
||||||
|
rpcalc_DATA = $(rpcalc_extracted)
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
#! /bin/sh
|
#! /bin/sh
|
||||||
|
|
||||||
# Copyright (C) 2005-2012 Free Software Foundation, Inc.
|
# Copyright (C) 2005-2015, 2018 Free Software Foundation, Inc.
|
||||||
#
|
#
|
||||||
# This program is free software: you can redistribute it and/or modify
|
# 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
|
# it under the terms of the GNU General Public License as published by
|
||||||
|
|||||||
+15
-4
@@ -1,6 +1,6 @@
|
|||||||
#! /bin/sh
|
#! /bin/sh
|
||||||
|
|
||||||
# Copyright (C) 2005-2012 Free Software Foundation, Inc.
|
# Copyright (C) 2005-2015, 2018 Free Software Foundation, Inc.
|
||||||
#
|
#
|
||||||
# This program is free software: you can redistribute it and/or modify
|
# 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
|
# it under the terms of the GNU General Public License as published by
|
||||||
@@ -27,7 +27,18 @@ exit=true
|
|||||||
cwd=`pwd`
|
cwd=`pwd`
|
||||||
|
|
||||||
# The exercised program.
|
# The exercised program.
|
||||||
prog=$cwd/examples/$me/$me
|
for p in $cwd/examples/$me/$me $cwd/examples/$me
|
||||||
|
do
|
||||||
|
if test -x "$p"; then
|
||||||
|
prog=$p
|
||||||
|
break
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
if test x"$prog" = x; then
|
||||||
|
echo "$me: ERROR: cannot find program to exercise"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
# cleanup
|
# cleanup
|
||||||
# -------
|
# -------
|
||||||
@@ -54,9 +65,9 @@ run ()
|
|||||||
# Expected output.
|
# Expected output.
|
||||||
local out_exp=$1
|
local out_exp=$1
|
||||||
shift
|
shift
|
||||||
$prog "$@" - <input >out_eff
|
|
||||||
# Effective exit status.
|
# Effective exit status.
|
||||||
local sta_eff=$?
|
local sta_eff=0
|
||||||
|
$prog "$@" - <input >out_eff || sta_eff=$?
|
||||||
# Effective output.
|
# Effective output.
|
||||||
local out_eff=`cat out_eff`
|
local out_eff=`cat out_eff`
|
||||||
if test $sta_eff -eq $sta_exp; then
|
if test $sta_eff -eq $sta_exp; then
|
||||||
|
|||||||
@@ -0,0 +1,19 @@
|
|||||||
|
#! /bin/sh
|
||||||
|
|
||||||
|
# Copyright (C) 2018 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 3 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, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
: >input
|
||||||
|
run 0 "{I have three numbers for you., 1, 2, 3, And that's all!}"
|
||||||
+63
-53
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
Copyright (C) 2008-2012 Free Software Foundation, Inc.
|
Copyright (C) 2008-2015, 2018 Free Software Foundation, Inc.
|
||||||
|
|
||||||
This program is free software: you can redistribute it and/or modify
|
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
|
it under the terms of the GNU General Public License as published by
|
||||||
@@ -16,18 +16,18 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
%debug
|
%debug
|
||||||
%skeleton "lalr1.cc"
|
%language "c++"
|
||||||
%defines
|
%defines
|
||||||
|
%define api.token.constructor
|
||||||
|
%define api.value.type variant
|
||||||
%define parse.assert
|
%define parse.assert
|
||||||
%define variant
|
|
||||||
%define lex_symbol
|
|
||||||
%locations
|
%locations
|
||||||
|
|
||||||
%code requires // *.hh
|
%code requires // *.hh
|
||||||
{
|
{
|
||||||
#include <list>
|
|
||||||
#include <string>
|
#include <string>
|
||||||
typedef std::list<std::string> strings_type;
|
#include <vector>
|
||||||
|
typedef std::vector<std::string> strings_type;
|
||||||
}
|
}
|
||||||
|
|
||||||
%code // *.cc
|
%code // *.cc
|
||||||
@@ -38,24 +38,32 @@ typedef std::list<std::string> strings_type;
|
|||||||
#include <sstream>
|
#include <sstream>
|
||||||
|
|
||||||
// Prototype of the yylex function providing subsequent tokens.
|
// Prototype of the yylex function providing subsequent tokens.
|
||||||
static yy::parser::symbol_type yylex ();
|
namespace yy
|
||||||
|
{
|
||||||
|
static parser::symbol_type yylex ();
|
||||||
|
}
|
||||||
|
|
||||||
// Printing a list of strings.
|
// Printing a vector of strings.
|
||||||
// Koening look up will look into std, since that's an std::list.
|
// Koening look up will look into std, since that's an std::vector.
|
||||||
namespace std
|
namespace std
|
||||||
{
|
{
|
||||||
std::ostream&
|
std::ostream&
|
||||||
operator<< (std::ostream& o, const strings_type& s)
|
operator<< (std::ostream& o, const strings_type& ss)
|
||||||
{
|
{
|
||||||
std::copy (s.begin (), s.end (),
|
o << '{';
|
||||||
std::ostream_iterator<strings_type::value_type> (o, "\n"));
|
const char *sep = "";
|
||||||
return o;
|
for (strings_type::const_iterator i = ss.begin(), end = ss.end();
|
||||||
|
i != end; ++i)
|
||||||
|
{
|
||||||
|
o << sep << *i;
|
||||||
|
sep = ", ";
|
||||||
|
}
|
||||||
|
return o << '}';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Conversion to string.
|
// Conversion to string.
|
||||||
template <typename T>
|
template <typename T>
|
||||||
inline
|
|
||||||
std::string
|
std::string
|
||||||
string_cast (const T& t)
|
string_cast (const T& t)
|
||||||
{
|
{
|
||||||
@@ -67,65 +75,67 @@ typedef std::list<std::string> strings_type;
|
|||||||
|
|
||||||
%token <::std::string> TEXT;
|
%token <::std::string> TEXT;
|
||||||
%token <int> NUMBER;
|
%token <int> NUMBER;
|
||||||
%printer { debug_stream () << $$; }
|
%printer { yyo << '(' << &$$ << ") " << $$; } <*>;
|
||||||
<int> <::std::string> <::std::list<std::string>>;
|
|
||||||
%token END_OF_FILE 0;
|
%token END_OF_FILE 0;
|
||||||
|
|
||||||
%type <::std::string> item;
|
%type <::std::string> item;
|
||||||
%type <::std::list<std::string>> list;
|
%type <::std::vector<std::string>> list;
|
||||||
|
|
||||||
%%
|
%%
|
||||||
|
|
||||||
result:
|
result:
|
||||||
list { std::cout << $1 << std::endl; }
|
list { std::cout << $1 << '\n'; }
|
||||||
;
|
;
|
||||||
|
|
||||||
list:
|
list:
|
||||||
/* nothing */ { /* Generates an empty string list */ }
|
%empty { /* Generates an empty string list */ }
|
||||||
| list item { std::swap ($$, $1); $$.push_back ($2); }
|
| list item { std::swap ($$, $1); $$.push_back ($2); }
|
||||||
;
|
;
|
||||||
|
|
||||||
item:
|
item:
|
||||||
TEXT { std::swap ($$, $1); }
|
TEXT { std::swap ($$, $1); }
|
||||||
| NUMBER { $$ = string_cast ($1); }
|
| NUMBER { $$ = string_cast ($1); }
|
||||||
;
|
;
|
||||||
%%
|
%%
|
||||||
|
|
||||||
// The yylex function providing subsequent tokens:
|
namespace yy
|
||||||
// TEXT "I have three numbers for you:"
|
|
||||||
// NUMBER 1
|
|
||||||
// NUMBER 2
|
|
||||||
// NUMBER 3
|
|
||||||
// TEXT " and that's all!"
|
|
||||||
// END_OF_FILE
|
|
||||||
|
|
||||||
static
|
|
||||||
yy::parser::symbol_type
|
|
||||||
yylex ()
|
|
||||||
{
|
{
|
||||||
static int stage = -1;
|
// The yylex function providing subsequent tokens:
|
||||||
++stage;
|
// TEXT "I have three numbers for you."
|
||||||
yy::parser::location_type loc(0, stage + 1, stage + 1);
|
// NUMBER 1
|
||||||
switch (stage)
|
// NUMBER 2
|
||||||
|
// NUMBER 3
|
||||||
|
// TEXT "And that's all!"
|
||||||
|
// END_OF_FILE
|
||||||
|
|
||||||
|
static
|
||||||
|
parser::symbol_type
|
||||||
|
yylex ()
|
||||||
{
|
{
|
||||||
case 0:
|
static int stage = -1;
|
||||||
return yy::parser::make_TEXT ("I have three numbers for you.", loc);
|
++stage;
|
||||||
case 1:
|
parser::location_type loc(YY_NULLPTR, stage + 1, stage + 1);
|
||||||
case 2:
|
switch (stage)
|
||||||
case 3:
|
{
|
||||||
return yy::parser::make_NUMBER (stage, loc);
|
case 0:
|
||||||
case 4:
|
return parser::make_TEXT ("I have three numbers for you.", loc);
|
||||||
return yy::parser::make_TEXT ("And that's all!", loc);
|
case 1:
|
||||||
default:
|
case 2:
|
||||||
return yy::parser::make_END_OF_FILE (loc);
|
case 3:
|
||||||
|
return parser::make_NUMBER (stage, loc);
|
||||||
|
case 4:
|
||||||
|
return parser::make_TEXT ("And that's all!", loc);
|
||||||
|
default:
|
||||||
|
return parser::make_END_OF_FILE (loc);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
// Mandatory error function
|
// Mandatory error function
|
||||||
void
|
void
|
||||||
yy::parser::error (const yy::parser::location_type& loc, const std::string& msg)
|
parser::error (const parser::location_type& loc, const std::string& msg)
|
||||||
{
|
{
|
||||||
std::cerr << loc << ": " << msg << std::endl;
|
std::cerr << loc << ": " << msg << '\n';
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
|
|||||||
Vendored
-1
@@ -1 +0,0 @@
|
|||||||
external: gnulib
|
|
||||||
+1
-1
Submodule gnulib updated: 2f67aa79c6...a05181f4bd
+36
-33
@@ -4,8 +4,7 @@
|
|||||||
/*~
|
/*~
|
||||||
/.deps
|
/.deps
|
||||||
/.dirstamp
|
/.dirstamp
|
||||||
/Makefile
|
/_Noreturn.h
|
||||||
/Makefile.in
|
|
||||||
/alignof.h
|
/alignof.h
|
||||||
/alloca.h
|
/alloca.h
|
||||||
/alloca.in.h
|
/alloca.in.h
|
||||||
@@ -15,7 +14,9 @@
|
|||||||
/asnprintf.c
|
/asnprintf.c
|
||||||
/basename-lgpl.c
|
/basename-lgpl.c
|
||||||
/basename.c
|
/basename.c
|
||||||
|
/binary-io.c
|
||||||
/binary-io.h
|
/binary-io.h
|
||||||
|
/bitrotate.c
|
||||||
/bitrotate.h
|
/bitrotate.h
|
||||||
/c++defs.h
|
/c++defs.h
|
||||||
/c-ctype.c
|
/c-ctype.c
|
||||||
@@ -28,14 +29,13 @@
|
|||||||
/charset.alias
|
/charset.alias
|
||||||
/cloexec.c
|
/cloexec.c
|
||||||
/cloexec.h
|
/cloexec.h
|
||||||
/close-hook.c
|
|
||||||
/close-hook.h
|
|
||||||
/close-stream.c
|
/close-stream.c
|
||||||
/close-stream.h
|
/close-stream.h
|
||||||
/close.c
|
/close.c
|
||||||
/closeout.c
|
/closeout.c
|
||||||
/closeout.h
|
/closeout.h
|
||||||
/config.charset
|
/concat-filename.c
|
||||||
|
/concat-filename.h
|
||||||
/config.h
|
/config.h
|
||||||
/config.in.h
|
/config.in.h
|
||||||
/configmake.h
|
/configmake.h
|
||||||
@@ -54,7 +54,6 @@
|
|||||||
/exitfail.h
|
/exitfail.h
|
||||||
/fatal-signal.c
|
/fatal-signal.c
|
||||||
/fatal-signal.h
|
/fatal-signal.h
|
||||||
/fclose.c
|
|
||||||
/fcntl.c
|
/fcntl.c
|
||||||
/fcntl.h
|
/fcntl.h
|
||||||
/fcntl.in.h
|
/fcntl.in.h
|
||||||
@@ -62,6 +61,7 @@
|
|||||||
/fd-hook.h
|
/fd-hook.h
|
||||||
/fd-safer-flag.c
|
/fd-safer-flag.c
|
||||||
/fd-safer.c
|
/fd-safer.c
|
||||||
|
/filename.h
|
||||||
/float+.h
|
/float+.h
|
||||||
/float.c
|
/float.c
|
||||||
/float.h
|
/float.h
|
||||||
@@ -78,19 +78,27 @@
|
|||||||
/fseterr.h
|
/fseterr.h
|
||||||
/fstat.c
|
/fstat.c
|
||||||
/getdtablesize.c
|
/getdtablesize.c
|
||||||
|
/getopt-cdefs.in.h
|
||||||
|
/getopt-core.h
|
||||||
|
/getopt-ext.h
|
||||||
|
/getopt-pfx-core.h
|
||||||
|
/getopt-pfx-ext.h
|
||||||
/getopt.c
|
/getopt.c
|
||||||
/getopt.h
|
/getopt.h
|
||||||
/getopt.in.h
|
/getopt.in.h
|
||||||
/getopt1.c
|
/getopt1.c
|
||||||
/getopt_int.h
|
/getopt_int.h
|
||||||
|
/getprogname.c
|
||||||
|
/getprogname.h
|
||||||
/gettext.h
|
/gettext.h
|
||||||
/gnulib.mk
|
/gnulib.mk
|
||||||
|
/hard-locale.c
|
||||||
|
/hard-locale.h
|
||||||
/hash.c
|
/hash.c
|
||||||
/hash.h
|
/hash.h
|
||||||
/intprops.h
|
/intprops.h
|
||||||
/inttypes.h
|
/inttypes.h
|
||||||
/inttypes.in.h
|
/inttypes.in.h
|
||||||
/ioctl.c
|
|
||||||
/isnan.c
|
/isnan.c
|
||||||
/isnand-nolibm.h
|
/isnand-nolibm.h
|
||||||
/isnand.c
|
/isnand.c
|
||||||
@@ -98,31 +106,33 @@
|
|||||||
/isnanf.c
|
/isnanf.c
|
||||||
/isnanl-nolibm.h
|
/isnanl-nolibm.h
|
||||||
/isnanl.c
|
/isnanl.c
|
||||||
/iswblank.c
|
|
||||||
/itold.c
|
/itold.c
|
||||||
/ldexpl.c
|
/ldexpl.c
|
||||||
|
/limits.h
|
||||||
|
/limits.in.h
|
||||||
/localcharset.c
|
/localcharset.c
|
||||||
/localcharset.h
|
/localcharset.h
|
||||||
|
/lstat.c
|
||||||
/malloc.c
|
/malloc.c
|
||||||
|
/malloca.c
|
||||||
|
/malloca.h
|
||||||
|
/math.c
|
||||||
/math.h
|
/math.h
|
||||||
/math.in.h
|
/math.in.h
|
||||||
/mbchar.c
|
|
||||||
/mbchar.h
|
|
||||||
/mbrtowc.c
|
/mbrtowc.c
|
||||||
/mbsinit.c
|
/mbsinit.c
|
||||||
/mbswidth.c
|
/mbswidth.c
|
||||||
/mbswidth.h
|
/mbswidth.h
|
||||||
/mbuiter.h
|
|
||||||
/memchr.c
|
/memchr.c
|
||||||
/memchr.valgrind
|
/memchr.valgrind
|
||||||
|
/minmax.h
|
||||||
/msvc-inval.c
|
/msvc-inval.c
|
||||||
/msvc-inval.h
|
/msvc-inval.h
|
||||||
/msvc-nothrow.c
|
/msvc-nothrow.c
|
||||||
/msvc-nothrow.h
|
/msvc-nothrow.h
|
||||||
/nonblocking.c
|
|
||||||
/nonblocking.h
|
|
||||||
/obstack.c
|
/obstack.c
|
||||||
/obstack.h
|
/obstack.h
|
||||||
|
/obstack_printf.c
|
||||||
/open.c
|
/open.c
|
||||||
/pathmax.h
|
/pathmax.h
|
||||||
/perror.c
|
/perror.c
|
||||||
@@ -140,7 +150,6 @@
|
|||||||
/printf.c
|
/printf.c
|
||||||
/progname.c
|
/progname.c
|
||||||
/progname.h
|
/progname.h
|
||||||
/quote.c
|
|
||||||
/quote.h
|
/quote.h
|
||||||
/quotearg.c
|
/quotearg.c
|
||||||
/quotearg.h
|
/quotearg.h
|
||||||
@@ -149,11 +158,10 @@
|
|||||||
/rawmemchr.valgrind
|
/rawmemchr.valgrind
|
||||||
/realloc.c
|
/realloc.c
|
||||||
/ref-add.sed
|
/ref-add.sed
|
||||||
/ref-add.sin
|
|
||||||
/ref-del.sed
|
/ref-del.sed
|
||||||
/ref-del.sin
|
|
||||||
/sched.h
|
/sched.h
|
||||||
/sched.in.h
|
/sched.in.h
|
||||||
|
/sig-handler.c
|
||||||
/sig-handler.h
|
/sig-handler.h
|
||||||
/sigaction.c
|
/sigaction.c
|
||||||
/signal.h
|
/signal.h
|
||||||
@@ -182,6 +190,8 @@
|
|||||||
/spawnp.c
|
/spawnp.c
|
||||||
/sprintf.c
|
/sprintf.c
|
||||||
/stamp-h1
|
/stamp-h1
|
||||||
|
/stat-w32.c
|
||||||
|
/stat-w32.h
|
||||||
/stat.c
|
/stat.c
|
||||||
/stdbool.h
|
/stdbool.h
|
||||||
/stdbool.in.h
|
/stdbool.in.h
|
||||||
@@ -192,7 +202,6 @@
|
|||||||
/stdio--.h
|
/stdio--.h
|
||||||
/stdio-impl.h
|
/stdio-impl.h
|
||||||
/stdio-safer.h
|
/stdio-safer.h
|
||||||
/stdio-write.c
|
|
||||||
/stdio.h
|
/stdio.h
|
||||||
/stdio.in.h
|
/stdio.in.h
|
||||||
/stdlib.h
|
/stdlib.h
|
||||||
@@ -211,25 +220,19 @@
|
|||||||
/stripslash.c
|
/stripslash.c
|
||||||
/strndup.c
|
/strndup.c
|
||||||
/strnlen.c
|
/strnlen.c
|
||||||
/strnlen1.c
|
|
||||||
/strnlen1.h
|
|
||||||
/strtol.c
|
|
||||||
/strtoul.c
|
|
||||||
/strverscmp.c
|
/strverscmp.c
|
||||||
/sys
|
/sys
|
||||||
/sys_ioctl.h
|
|
||||||
/sys_ioctl.in.h
|
/sys_ioctl.in.h
|
||||||
/sys_socket.h
|
|
||||||
/sys_socket.in.h
|
/sys_socket.in.h
|
||||||
/sys_stat.h
|
|
||||||
/sys_stat.in.h
|
/sys_stat.in.h
|
||||||
/sys_wait.h
|
/sys_types.in.h
|
||||||
/sys_wait.in.h
|
/sys_wait.in.h
|
||||||
/sysexits.in.h
|
/sysexits.in.h
|
||||||
/time.h
|
/time.h
|
||||||
/time.in.h
|
/time.in.h
|
||||||
/unistd--.h
|
/unistd--.h
|
||||||
/unistd-safer.h
|
/unistd-safer.h
|
||||||
|
/unistd.c
|
||||||
/unistd.h
|
/unistd.h
|
||||||
/unistd.in.h
|
/unistd.in.h
|
||||||
/unitypes.h
|
/unitypes.h
|
||||||
@@ -237,6 +240,7 @@
|
|||||||
/uniwidth
|
/uniwidth
|
||||||
/uniwidth.h
|
/uniwidth.h
|
||||||
/uniwidth.in.h
|
/uniwidth.in.h
|
||||||
|
/unlink.c
|
||||||
/unlocked-io.h
|
/unlocked-io.h
|
||||||
/unsetenv.c
|
/unsetenv.c
|
||||||
/vasnprintf.c
|
/vasnprintf.c
|
||||||
@@ -245,7 +249,6 @@
|
|||||||
/vfprintf.c
|
/vfprintf.c
|
||||||
/vsnprintf.c
|
/vsnprintf.c
|
||||||
/vsprintf.c
|
/vsprintf.c
|
||||||
/w32sock.h
|
|
||||||
/w32spawn.h
|
/w32spawn.h
|
||||||
/wait-process.c
|
/wait-process.c
|
||||||
/wait-process.h
|
/wait-process.h
|
||||||
@@ -253,20 +256,20 @@
|
|||||||
/warn-on-use.h
|
/warn-on-use.h
|
||||||
/wchar.h
|
/wchar.h
|
||||||
/wchar.in.h
|
/wchar.in.h
|
||||||
|
/wctype-h.c
|
||||||
/wctype.h
|
/wctype.h
|
||||||
/wctype.in.h
|
/wctype.in.h
|
||||||
/wcwidth.c
|
/wcwidth.c
|
||||||
/xalloc-die.c
|
/xalloc-die.c
|
||||||
/xalloc-oversized.h
|
/xalloc-oversized.h
|
||||||
/xalloc.h
|
/xalloc.h
|
||||||
|
/xconcat-filename.c
|
||||||
/xmalloc.c
|
/xmalloc.c
|
||||||
|
/xmemdup0.c
|
||||||
|
/xmemdup0.h
|
||||||
|
/xsize.c
|
||||||
/xsize.h
|
/xsize.h
|
||||||
/xstrndup.c
|
/xstrndup.c
|
||||||
/xstrndup.h
|
/xstrndup.h
|
||||||
/xmemdup0.c
|
/stat-time.c
|
||||||
/xmemdup0.h
|
/stat-time.h
|
||||||
/sys_types.in.h
|
|
||||||
/concat-filename.c
|
|
||||||
/concat-filename.h
|
|
||||||
/filename.h
|
|
||||||
/xconcat-filename.c
|
|
||||||
|
|||||||
+4
-4
@@ -1,7 +1,7 @@
|
|||||||
/* Array bitsets.
|
/* Array bitsets.
|
||||||
|
|
||||||
Copyright (C) 2002-2003, 2006, 2009-2012 Free Software Foundation,
|
Copyright (C) 2002-2003, 2006, 2009-2015, 2018 Free Software
|
||||||
Inc.
|
Foundation, Inc.
|
||||||
|
|
||||||
Contributed by Michael Hayes (m.hayes@elec.canterbury.ac.nz).
|
Contributed by Michael Hayes (m.hayes@elec.canterbury.ac.nz).
|
||||||
|
|
||||||
@@ -146,7 +146,7 @@ abitset_list_reverse (bitset src, bitset_bindex *list,
|
|||||||
bitset_bindex rbitno;
|
bitset_bindex rbitno;
|
||||||
bitset_bindex count;
|
bitset_bindex count;
|
||||||
bitset_windex windex;
|
bitset_windex windex;
|
||||||
unsigned int bitcnt;
|
unsigned bitcnt;
|
||||||
bitset_bindex bitoff;
|
bitset_bindex bitoff;
|
||||||
bitset_word *srcp = ABITSET_WORDS (src);
|
bitset_word *srcp = ABITSET_WORDS (src);
|
||||||
bitset_bindex n_bits = BITSET_SIZE_ (src);
|
bitset_bindex n_bits = BITSET_SIZE_ (src);
|
||||||
@@ -302,7 +302,7 @@ abitset_list (bitset src, bitset_bindex *list,
|
|||||||
static inline void
|
static inline void
|
||||||
abitset_unused_clear (bitset dst)
|
abitset_unused_clear (bitset dst)
|
||||||
{
|
{
|
||||||
unsigned int last_bit;
|
unsigned last_bit;
|
||||||
|
|
||||||
last_bit = BITSET_SIZE_ (dst) % BITSET_WORD_BITS;
|
last_bit = BITSET_SIZE_ (dst) % BITSET_WORD_BITS;
|
||||||
if (last_bit)
|
if (last_bit)
|
||||||
|
|||||||
+2
-1
@@ -1,6 +1,7 @@
|
|||||||
/* Functions to support abitsets.
|
/* Functions to support abitsets.
|
||||||
|
|
||||||
Copyright (C) 2002, 2004, 2009-2012 Free Software Foundation, Inc.
|
Copyright (C) 2002, 2004, 2009-2015, 2018 Free Software Foundation,
|
||||||
|
Inc.
|
||||||
|
|
||||||
Contributed by Michael Hayes (m.hayes@elec.canterbury.ac.nz).
|
Contributed by Michael Hayes (m.hayes@elec.canterbury.ac.nz).
|
||||||
|
|
||||||
|
|||||||
+4
-4
@@ -1,7 +1,7 @@
|
|||||||
/* Base bitset stuff.
|
/* Base bitset stuff.
|
||||||
|
|
||||||
Copyright (C) 2002-2004, 2006, 2009-2012 Free Software Foundation,
|
Copyright (C) 2002-2004, 2006, 2009-2015, 2018 Free Software
|
||||||
Inc.
|
Foundation, Inc.
|
||||||
|
|
||||||
Contributed by Michael Hayes (m.hayes@elec.canterbury.ac.nz).
|
Contributed by Michael Hayes (m.hayes@elec.canterbury.ac.nz).
|
||||||
|
|
||||||
@@ -50,8 +50,8 @@ extern const char * const bitset_type_names[];
|
|||||||
enum bitset_alloc_type {BITSET_MALLOC, BITSET_OBALLOC};
|
enum bitset_alloc_type {BITSET_MALLOC, BITSET_OBALLOC};
|
||||||
|
|
||||||
/* Data type used to store a word of bits. */
|
/* Data type used to store a word of bits. */
|
||||||
typedef unsigned long int bitset_word;
|
typedef unsigned long bitset_word;
|
||||||
#define BITSET_WORD_BITS ((unsigned int) (CHAR_BIT * sizeof (bitset_word)))
|
#define BITSET_WORD_BITS ((unsigned) (CHAR_BIT * sizeof (bitset_word)))
|
||||||
|
|
||||||
/* Bit index. In theory we might need a type wider than size_t, but
|
/* Bit index. In theory we might need a type wider than size_t, but
|
||||||
in practice we lose at most a factor of CHAR_BIT by going with
|
in practice we lose at most a factor of CHAR_BIT by going with
|
||||||
|
|||||||
+7
-6
@@ -1,6 +1,7 @@
|
|||||||
/* General bitsets.
|
/* General bitsets.
|
||||||
|
|
||||||
Copyright (C) 2002-2006, 2009-2012 Free Software Foundation, Inc.
|
Copyright (C) 2002-2006, 2009-2015, 2018 Free Software Foundation,
|
||||||
|
Inc.
|
||||||
|
|
||||||
Contributed by Michael Hayes (m.hayes@elec.canterbury.ac.nz).
|
Contributed by Michael Hayes (m.hayes@elec.canterbury.ac.nz).
|
||||||
|
|
||||||
@@ -100,7 +101,7 @@ bitset_init (bitset bset, bitset_bindex n_bits, enum bitset_type type)
|
|||||||
specified by ATTR. For variable size bitsets, N_BITS is only a
|
specified by ATTR. For variable size bitsets, N_BITS is only a
|
||||||
hint and may be zero. */
|
hint and may be zero. */
|
||||||
enum bitset_type
|
enum bitset_type
|
||||||
bitset_type_choose (bitset_bindex n_bits ATTRIBUTE_UNUSED, unsigned int attr)
|
bitset_type_choose (bitset_bindex n_bits ATTRIBUTE_UNUSED, unsigned attr)
|
||||||
{
|
{
|
||||||
/* Check attributes. */
|
/* Check attributes. */
|
||||||
if (attr & BITSET_FIXED && attr & BITSET_VARIABLE)
|
if (attr & BITSET_FIXED && attr & BITSET_VARIABLE)
|
||||||
@@ -168,7 +169,7 @@ bitset_obstack_alloc (struct obstack *bobstack,
|
|||||||
/* Create a bitset of N_BITS and with attribute hints specified by
|
/* Create a bitset of N_BITS and with attribute hints specified by
|
||||||
ATTR. */
|
ATTR. */
|
||||||
bitset
|
bitset
|
||||||
bitset_create (bitset_bindex n_bits, unsigned int attr)
|
bitset_create (bitset_bindex n_bits, unsigned attr)
|
||||||
{
|
{
|
||||||
enum bitset_type type;
|
enum bitset_type type;
|
||||||
|
|
||||||
@@ -290,13 +291,13 @@ bitset_only_set_p (bitset src, bitset_bindex bitno)
|
|||||||
static void
|
static void
|
||||||
bitset_print (FILE *file, bitset bset, bool verbose)
|
bitset_print (FILE *file, bitset bset, bool verbose)
|
||||||
{
|
{
|
||||||
unsigned int pos;
|
unsigned pos;
|
||||||
bitset_bindex i;
|
bitset_bindex i;
|
||||||
bitset_iterator iter;
|
bitset_iterator iter;
|
||||||
|
|
||||||
if (verbose)
|
if (verbose)
|
||||||
fprintf (file, "n_bits = %lu, set = {",
|
fprintf (file, "n_bits = %lu, set = {",
|
||||||
(unsigned long int) bitset_size (bset));
|
(unsigned long) bitset_size (bset));
|
||||||
|
|
||||||
pos = 30;
|
pos = 30;
|
||||||
BITSET_FOR_EACH (iter, bset, i, 0)
|
BITSET_FOR_EACH (iter, bset, i, 0)
|
||||||
@@ -307,7 +308,7 @@ bitset_print (FILE *file, bitset bset, bool verbose)
|
|||||||
pos = 0;
|
pos = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
fprintf (file, "%lu ", (unsigned long int) i);
|
fprintf (file, "%lu ", (unsigned long) i);
|
||||||
pos += 1 + (i >= 10) + (i >= 100);
|
pos += 1 + (i >= 10) + (i >= 100);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
+5
-4
@@ -1,6 +1,7 @@
|
|||||||
/* Generic bitsets.
|
/* Generic bitsets.
|
||||||
|
|
||||||
Copyright (C) 2002-2004, 2009-2012 Free Software Foundation, Inc.
|
Copyright (C) 2002-2004, 2009-2015, 2018 Free Software Foundation,
|
||||||
|
Inc.
|
||||||
|
|
||||||
Contributed by Michael Hayes (m.hayes@elec.canterbury.ac.nz).
|
Contributed by Michael Hayes (m.hayes@elec.canterbury.ac.nz).
|
||||||
|
|
||||||
@@ -39,7 +40,7 @@ enum bitset_attr {BITSET_FIXED = 1, /* Bitset size fixed. */
|
|||||||
BITSET_FRUGAL = 16, /* Prefer most compact. */
|
BITSET_FRUGAL = 16, /* Prefer most compact. */
|
||||||
BITSET_GREEDY = 32}; /* Prefer fastest at memory expense. */
|
BITSET_GREEDY = 32}; /* Prefer fastest at memory expense. */
|
||||||
|
|
||||||
typedef unsigned int bitset_attrs;
|
typedef unsigned bitset_attrs;
|
||||||
|
|
||||||
/* The contents of the union should be considered to be private.
|
/* The contents of the union should be considered to be private.
|
||||||
While I would like to make this union opaque, it needs to be
|
While I would like to make this union opaque, it needs to be
|
||||||
@@ -309,7 +310,7 @@ extern void bitset_dump (FILE *, bitset);
|
|||||||
|
|
||||||
BITSET_FOR_EACH (iter, src, i, 0)
|
BITSET_FOR_EACH (iter, src, i, 0)
|
||||||
{
|
{
|
||||||
printf ("%lu ", (unsigned long int) i);
|
printf ("%lu ", (unsigned long) i);
|
||||||
};
|
};
|
||||||
*/
|
*/
|
||||||
#define BITSET_FOR_EACH(ITER, BSET, INDEX, MIN) \
|
#define BITSET_FOR_EACH(ITER, BSET, INDEX, MIN) \
|
||||||
@@ -331,7 +332,7 @@ extern void bitset_dump (FILE *, bitset);
|
|||||||
|
|
||||||
BITSET_FOR_EACH_REVERSE (iter, src, i, 0)
|
BITSET_FOR_EACH_REVERSE (iter, src, i, 0)
|
||||||
{
|
{
|
||||||
printf ("%lu ", (unsigned long int) i);
|
printf ("%lu ", (unsigned long) i);
|
||||||
};
|
};
|
||||||
*/
|
*/
|
||||||
#define BITSET_FOR_EACH_REVERSE(ITER, BSET, INDEX, MIN) \
|
#define BITSET_FOR_EACH_REVERSE(ITER, BSET, INDEX, MIN) \
|
||||||
|
|||||||
+24
-23
@@ -1,6 +1,7 @@
|
|||||||
/* Bitset statistics.
|
/* Bitset statistics.
|
||||||
|
|
||||||
Copyright (C) 2002-2006, 2009-2012 Free Software Foundation, Inc.
|
Copyright (C) 2002-2006, 2009-2015, 2018 Free Software Foundation,
|
||||||
|
Inc.
|
||||||
|
|
||||||
Contributed by Michael Hayes (m.hayes@elec.canterbury.ac.nz).
|
Contributed by Michael Hayes (m.hayes@elec.canterbury.ac.nz).
|
||||||
|
|
||||||
@@ -76,23 +77,23 @@
|
|||||||
|
|
||||||
struct bitset_type_info_struct
|
struct bitset_type_info_struct
|
||||||
{
|
{
|
||||||
unsigned int allocs;
|
unsigned allocs;
|
||||||
unsigned int frees;
|
unsigned frees;
|
||||||
unsigned int lists;
|
unsigned lists;
|
||||||
unsigned int sets;
|
unsigned sets;
|
||||||
unsigned int cache_sets;
|
unsigned cache_sets;
|
||||||
unsigned int resets;
|
unsigned resets;
|
||||||
unsigned int cache_resets;
|
unsigned cache_resets;
|
||||||
unsigned int tests;
|
unsigned tests;
|
||||||
unsigned int cache_tests;
|
unsigned cache_tests;
|
||||||
unsigned int list_counts[BITSET_LOG_COUNT_BINS];
|
unsigned list_counts[BITSET_LOG_COUNT_BINS];
|
||||||
unsigned int list_sizes[BITSET_LOG_SIZE_BINS];
|
unsigned list_sizes[BITSET_LOG_SIZE_BINS];
|
||||||
unsigned int list_density[BITSET_DENSITY_BINS];
|
unsigned list_density[BITSET_DENSITY_BINS];
|
||||||
};
|
};
|
||||||
|
|
||||||
struct bitset_stats_info_struct
|
struct bitset_stats_info_struct
|
||||||
{
|
{
|
||||||
unsigned int runs;
|
unsigned runs;
|
||||||
struct bitset_type_info_struct types[BITSET_TYPE_NUM];
|
struct bitset_type_info_struct types[BITSET_TYPE_NUM];
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -105,10 +106,10 @@ bool bitset_stats_enabled = false;
|
|||||||
/* Print a percentage histogram with message MSG to FILE. */
|
/* Print a percentage histogram with message MSG to FILE. */
|
||||||
static void
|
static void
|
||||||
bitset_percent_histogram_print (FILE *file, const char *name, const char *msg,
|
bitset_percent_histogram_print (FILE *file, const char *name, const char *msg,
|
||||||
unsigned int n_bins, unsigned int *bins)
|
unsigned n_bins, unsigned *bins)
|
||||||
{
|
{
|
||||||
unsigned int i;
|
unsigned i;
|
||||||
unsigned int total;
|
unsigned total;
|
||||||
|
|
||||||
total = 0;
|
total = 0;
|
||||||
for (i = 0; i < n_bins; i++)
|
for (i = 0; i < n_bins; i++)
|
||||||
@@ -129,11 +130,11 @@ bitset_percent_histogram_print (FILE *file, const char *name, const char *msg,
|
|||||||
/* Print a log histogram with message MSG to FILE. */
|
/* Print a log histogram with message MSG to FILE. */
|
||||||
static void
|
static void
|
||||||
bitset_log_histogram_print (FILE *file, const char *name, const char *msg,
|
bitset_log_histogram_print (FILE *file, const char *name, const char *msg,
|
||||||
unsigned int n_bins, unsigned int *bins)
|
unsigned n_bins, unsigned *bins)
|
||||||
{
|
{
|
||||||
unsigned int i;
|
unsigned i;
|
||||||
unsigned int total;
|
unsigned total;
|
||||||
unsigned int max_width;
|
unsigned max_width;
|
||||||
|
|
||||||
total = 0;
|
total = 0;
|
||||||
for (i = 0; i < n_bins; i++)
|
for (i = 0; i < n_bins; i++)
|
||||||
@@ -148,7 +149,7 @@ bitset_log_histogram_print (FILE *file, const char *name, const char *msg,
|
|||||||
n_bins = i;
|
n_bins = i;
|
||||||
|
|
||||||
/* 2 * ceil (log10 (2) * (N - 1)) + 1. */
|
/* 2 * ceil (log10 (2) * (N - 1)) + 1. */
|
||||||
max_width = 2 * (unsigned int) (0.30103 * (n_bins - 1) + 0.9999) + 1;
|
max_width = 2 * (unsigned) (0.30103 * (n_bins - 1) + 0.9999) + 1;
|
||||||
|
|
||||||
fprintf (file, "%s %s", name, msg);
|
fprintf (file, "%s %s", name, msg);
|
||||||
for (i = 0; i < 2; i++)
|
for (i = 0; i < 2; i++)
|
||||||
@@ -157,7 +158,7 @@ bitset_log_histogram_print (FILE *file, const char *name, const char *msg,
|
|||||||
|
|
||||||
for (; i < n_bins; i++)
|
for (; i < n_bins; i++)
|
||||||
fprintf (file, "%*lu-%lu\t%8u (%5.1f%%)\n",
|
fprintf (file, "%*lu-%lu\t%8u (%5.1f%%)\n",
|
||||||
max_width - ((unsigned int) (0.30103 * (i) + 0.9999) + 1),
|
max_width - ((unsigned) (0.30103 * (i) + 0.9999) + 1),
|
||||||
1UL << (i - 1),
|
1UL << (i - 1),
|
||||||
(1UL << i) - 1,
|
(1UL << i) - 1,
|
||||||
bins[i],
|
bins[i],
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user