mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-08-08 10:15:14 +00:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f520e150eb | ||
|
|
75db37c564 | ||
|
|
886b503e4b | ||
|
|
a2f0444c6e | ||
|
|
66100b640f | ||
|
|
de5207244b | ||
|
|
cae8132690 | ||
|
|
a1a847bfb5 | ||
|
|
3ac95de01a | ||
|
|
da7af36a13 | ||
|
|
3f25104caf | ||
|
|
6b1933d992 | ||
|
|
5163803a63 | ||
|
|
fee7c78a83 | ||
|
|
8fc544b03c | ||
|
|
d62d5c4b33 | ||
|
|
ab3eaff7c4 | ||
|
|
85e83ea968 | ||
|
|
0269c6fb03 | ||
|
|
23e536af49 | ||
|
|
cd56929097 | ||
|
|
7aa38561f7 | ||
|
|
22a00cfbf2 | ||
|
|
8c06cb9130 | ||
|
|
b5233ba323 | ||
|
|
013720f0e7 | ||
|
|
365b4d95a4 | ||
|
|
5bb44cca81 | ||
|
|
15f9f8c853 | ||
|
|
04676a5085 | ||
|
|
cf44351dd7 | ||
|
|
614e0bbe23 | ||
|
|
3eb7b0ee78 | ||
|
|
02a1600994 | ||
|
|
f6868c5a77 | ||
|
|
f92f2f8afe | ||
|
|
0cc04eaa2a | ||
|
|
57290d63fd | ||
|
|
33b246a624 | ||
|
|
dc5ce5989f | ||
|
|
7ea108fa67 | ||
|
|
386cf25088 | ||
|
|
a514c51e55 | ||
|
|
91b8f3f171 | ||
|
|
8f5d475079 | ||
|
|
f5a4e279bc | ||
|
|
571447afe8 | ||
|
|
9260e5ca4f | ||
|
|
971e72514f | ||
|
|
0ee5ac5367 | ||
|
|
935d119c82 | ||
|
|
01fe32ee53 | ||
|
|
19ea6b1405 | ||
|
|
a4d33cdf48 | ||
|
|
a992a3cb9e | ||
|
|
95d688957f | ||
|
|
a9b350fb3a | ||
|
|
afe7dfd3b9 | ||
|
|
6b6c3de2ae | ||
|
|
1b70f687fa | ||
|
|
520d474ec6 | ||
|
|
deec7ca65c | ||
|
|
dff7454371 | ||
|
|
e50eedf3c5 | ||
|
|
341776b03b | ||
|
|
79f7afb125 | ||
|
|
2f3d9717ee | ||
|
|
9ad7524659 | ||
|
|
4ec413da32 | ||
|
|
61d53e606d | ||
|
|
d67b7daa1d | ||
|
|
2ab70cf0c6 | ||
|
|
99664706e2 | ||
|
|
a745041b7d | ||
|
|
0dd97f7c87 | ||
|
|
69a823c72d | ||
|
|
0f193d2d21 | ||
|
|
9832fdd6ef | ||
|
|
507c679b9b | ||
|
|
0b42cf8a36 | ||
|
|
10175e4a65 | ||
|
|
18831f985c | ||
|
|
6d4e6bf118 | ||
|
|
a8558bc5a6 | ||
|
|
bbf37f2534 | ||
|
|
d332ff3c77 | ||
|
|
eb92ec3dc6 | ||
|
|
dee8fbbc1e | ||
|
|
75303c61d8 | ||
|
|
af99826ef4 | ||
|
|
af1c6f973a | ||
|
|
b5cd777ad6 | ||
|
|
ae91c3cce3 | ||
|
|
5de4e79fc8 | ||
|
|
4d34b06fb3 | ||
|
|
22a413ce9f | ||
|
|
01855ca328 | ||
|
|
225bc5836a | ||
|
|
941cdf921d | ||
|
|
58ae95670b | ||
|
|
4e19ab9fcd | ||
|
|
6cb612e7e3 | ||
|
|
35add841ee | ||
|
|
f6e38d7ac9 | ||
|
|
855fbf1c11 | ||
|
|
e5ec21215e | ||
|
|
91bbf4219d | ||
|
|
f4c1586454 | ||
|
|
9a71d9d1c6 | ||
|
|
bb0310a353 | ||
|
|
f8408562f8 | ||
|
|
8eac78f8ef | ||
|
|
d57751d2fb | ||
|
|
e062b9f70d | ||
|
|
c837141832 | ||
|
|
a415a78d71 | ||
|
|
5255b919ae | ||
|
|
b12f9c76e2 | ||
|
|
575b814119 | ||
|
|
661bbacfc7 | ||
|
|
d04962f788 | ||
|
|
ec8142391a | ||
|
|
59bec5fade | ||
|
|
5230e610fc | ||
|
|
b81419a9fd | ||
|
|
2b9ee006d8 | ||
|
|
609b40f1a1 | ||
|
|
1e76448ced | ||
|
|
967a59d2c0 | ||
|
|
fbf94ac900 | ||
|
|
a11c144609 | ||
|
|
4848092bf8 | ||
|
|
948f3decb4 | ||
|
|
7d6747cec9 | ||
|
|
420e7b03ec | ||
|
|
b31015a927 | ||
|
|
bd55d43333 | ||
|
|
98020cedf7 | ||
|
|
cbf213915c | ||
|
|
93371999ee | ||
|
|
6289d673a0 | ||
|
|
0adda755a2 | ||
|
|
0782ed3274 | ||
|
|
d7ec136ffb | ||
|
|
dbdf2878ab | ||
|
|
8654fca058 | ||
|
|
05a8097779 | ||
|
|
c06ec1f132 | ||
|
|
fb83319d9c | ||
|
|
e42a7a1862 | ||
|
|
8cbf3ce22c | ||
|
|
1997093e21 | ||
|
|
f23b879ff5 | ||
|
|
8b2d233283 | ||
|
|
40fc688765 | ||
|
|
30f61b0549 | ||
|
|
ad7d8af6d1 | ||
|
|
f293345aa8 | ||
|
|
e18ad5a96b | ||
|
|
dd232b95b7 | ||
|
|
51861998c7 | ||
|
|
e346210c03 | ||
|
|
0d44f83fcc | ||
|
|
40b5f89ee0 | ||
|
|
eed9550993 | ||
|
|
cf96d1b0af | ||
|
|
3d25b52a10 | ||
|
|
437f6250c5 | ||
|
|
334cb8f222 | ||
|
|
03878edf77 | ||
|
|
cacdfc2f6e | ||
|
|
56c00ed1ea | ||
|
|
513d2f723f | ||
|
|
48429252c1 | ||
|
|
d459a5b8e6 | ||
|
|
9566232422 | ||
|
|
dc654a925c | ||
|
|
76366e8e5c | ||
|
|
31788ed4c7 | ||
|
|
781d2b02de | ||
|
|
8b5fc2143f | ||
|
|
5670677cb6 | ||
|
|
32b9dcecc7 | ||
|
|
ac12b725ea | ||
|
|
e1783bc686 | ||
|
|
c4f143eb96 | ||
|
|
94054924a9 | ||
|
|
c639611002 | ||
|
|
69061fed82 | ||
|
|
3075d96d44 | ||
|
|
7fec997ecf | ||
|
|
7355a35e4b | ||
|
|
e585377e68 | ||
|
|
9cd7bd4d5f | ||
|
|
a108d84f88 | ||
|
|
1e83dd2229 | ||
|
|
d02ca923e2 | ||
|
|
f82f7eb1d8 | ||
|
|
0d472b29ec | ||
|
|
7a21067bb9 | ||
|
|
ed02d34fbc | ||
|
|
8b0b295569 | ||
|
|
59a108c0a6 | ||
|
|
83ebc8bdb6 | ||
|
|
21a7fa8063 | ||
|
|
83463dfbee | ||
|
|
c3c50c0030 | ||
|
|
e85ab7ac9b | ||
|
|
a11463a02f | ||
|
|
8023b3153a | ||
|
|
b23ca37ed2 | ||
|
|
bb5e4b659b | ||
|
|
bc8ec1d7bf | ||
|
|
665c5d688c | ||
|
|
53d379b905 | ||
|
|
aa85bfe3a7 | ||
|
|
5ec9c99662 | ||
|
|
36cae8e752 | ||
|
|
7498ede3ab | ||
|
|
27104acdbe | ||
|
|
7b3368a155 | ||
|
|
ec08b369ec | ||
|
|
05b70f47e8 | ||
|
|
626d2f2dca | ||
|
|
5c797b1627 | ||
|
|
ac692b572a | ||
|
|
2f208ee43a | ||
|
|
013a695add | ||
|
|
54ed577da0 | ||
|
|
4a690d3d19 | ||
|
|
cd1a9f076c | ||
|
|
7a0f681cb8 | ||
|
|
eb0f3e79e0 | ||
|
|
25b7421c40 | ||
|
|
e86adac52d | ||
|
|
5879c8dc5a | ||
|
|
d5d148630a | ||
|
|
b443932991 | ||
|
|
f5a646c390 | ||
|
|
f038f0b12f | ||
|
|
b6b397b7f0 | ||
|
|
2c8fb4d126 | ||
|
|
169fe80c7f | ||
|
|
b7e0d3131d | ||
|
|
a634aad9e6 | ||
|
|
ad326ada91 | ||
|
|
a049509d04 | ||
|
|
7c5e508b39 | ||
|
|
55bf52860e | ||
|
|
8575bd06ae | ||
|
|
7c63cc1f6b | ||
|
|
4a41a8ec51 | ||
|
|
ba469451d8 | ||
|
|
8580b268c3 | ||
|
|
41aaa8374c | ||
|
|
79e79be298 | ||
|
|
ffe2e4aaec | ||
|
|
dad14ec3e4 | ||
|
|
a7ff1c75be | ||
|
|
8c3a7687e4 | ||
|
|
72c488aa62 | ||
|
|
a88f8117b0 | ||
|
|
3551d51dd9 | ||
|
|
38b17c36da | ||
|
|
f9db426de6 | ||
|
|
c927c955c8 | ||
|
|
475fd79c8e | ||
|
|
586e2ab0c8 | ||
|
|
7e617dd847 | ||
|
|
3355ee32f0 | ||
|
|
7d545fd23f | ||
|
|
70a4b97daf | ||
|
|
c314b5509f | ||
|
|
f0d7f71a64 | ||
|
|
c8ee05c2b2 | ||
|
|
d3801ad2d1 | ||
|
|
8b717ca5ae | ||
|
|
b7ddb1f224 | ||
|
|
2471733f1a | ||
|
|
c0c45cfa38 | ||
|
|
230d6c5160 | ||
|
|
eb2b5aef0a | ||
|
|
df732955ff | ||
|
|
84276bc3d5 | ||
|
|
b90675e67a | ||
|
|
9ec93d4e34 | ||
|
|
9f81497a0c | ||
|
|
890ee8a1fd | ||
|
|
092b787198 | ||
|
|
6d9818b0cf | ||
|
|
80ef7e7639 | ||
|
|
5be47a73e8 | ||
|
|
0dfad676e3 | ||
|
|
d05b8f181e | ||
|
|
86cb2e72fd | ||
|
|
d07564af63 | ||
|
|
90a8537e62 | ||
|
|
6653c912da | ||
|
|
5bcd4292bb | ||
|
|
9a110873a0 | ||
|
|
7ff7ef678c | ||
|
|
597600fd83 | ||
|
|
4d7df9aec7 | ||
|
|
7c25df547e | ||
|
|
f773e6ead5 | ||
|
|
0dc44adbf6 | ||
|
|
7938ab53ff | ||
|
|
5fb0d276b3 | ||
|
|
50285ff066 | ||
|
|
f44fcd30ea | ||
|
|
a4ede8f85b | ||
|
|
53f1a0b114 | ||
|
|
ac0a0f5491 | ||
|
|
112ccb5ed7 | ||
|
|
0a4ddce822 | ||
|
|
10591c8879 | ||
|
|
807bf60cfc | ||
|
|
45cd7dfb7f | ||
|
|
9858165c52 | ||
|
|
777b0163de | ||
|
|
0978148763 | ||
|
|
e5780041b9 | ||
|
|
1f4dd2671a | ||
|
|
34c52d10ac | ||
|
|
a8e66fc010 | ||
|
|
6e9f9fcafc | ||
|
|
b04492cc5f | ||
|
|
98d199ccc8 | ||
|
|
93cc1fa6e8 | ||
|
|
1099b8dc26 | ||
|
|
8e5b1f40ae | ||
|
|
25b9eada8c | ||
|
|
dbe499e936 | ||
|
|
1d5956f87f | ||
|
|
fdceb6330f | ||
|
|
bc31dee0f7 | ||
|
|
465a47d46b | ||
|
|
953a95695a | ||
|
|
aadf6c0bf3 | ||
|
|
dbb855895f | ||
|
|
d68f05d75c | ||
|
|
b05aa7be2e | ||
|
|
20b0746793 | ||
|
|
afdefecab6 | ||
|
|
81dbd0d82e | ||
|
|
d657da9fb4 | ||
|
|
4cbdcaa572 | ||
|
|
85d303b713 | ||
|
|
1e6a68858a | ||
|
|
17730b0287 | ||
|
|
157f12c483 | ||
|
|
e1a843cc69 | ||
|
|
fe97793659 | ||
|
|
401afe5cc2 | ||
|
|
10e3ccac05 | ||
|
|
3d5059f431 | ||
|
|
9a5c12f160 | ||
|
|
156140dfc3 | ||
|
|
4176584062 | ||
|
|
cfd682f46d | ||
|
|
f15382f7d7 | ||
|
|
0ebcae4a54 | ||
|
|
22b2c286ff | ||
|
|
4a42a4f911 | ||
|
|
c20dd6279f | ||
|
|
999277ddd8 | ||
|
|
f539a56620 | ||
|
|
c44a782a4e | ||
|
|
e40db8976c | ||
|
|
d527b2d0f1 | ||
|
|
1a27d0bf28 | ||
|
|
e76a934853 | ||
|
|
7d823c505e | ||
|
|
6ef788f810 | ||
|
|
cc422ce677 | ||
|
|
d2386a35f5 | ||
|
|
3422ee7435 | ||
|
|
e1094c4c09 | ||
|
|
060da943bd | ||
|
|
b7577ea6f6 | ||
|
|
6220e96e76 | ||
|
|
2c6b7c8b2c | ||
|
|
36e587b1f6 | ||
|
|
b1d6c42ae5 | ||
|
|
8e092082cb | ||
|
|
2c5e933672 | ||
|
|
d92ed9d9f7 | ||
|
|
ebe9b20841 | ||
|
|
23e022718b | ||
|
|
0e9eade009 | ||
|
|
9686b585e7 | ||
|
|
4bddd33439 | ||
|
|
4ad877fdab | ||
|
|
9476783307 | ||
|
|
e1c55d83f8 | ||
|
|
647bf48797 | ||
|
|
bcecfbafab | ||
|
|
deb2fc1dfc | ||
|
|
3a203e2e56 | ||
|
|
709c87bb41 | ||
|
|
9ffed56cd9 | ||
|
|
cc050fd321 | ||
|
|
660811a6c5 | ||
|
|
7ded5bb764 | ||
|
|
ad0b4661d1 | ||
|
|
260ae5481c | ||
|
|
e51fd547ca | ||
|
|
4ebebcc438 | ||
|
|
2b2556b41c | ||
|
|
b34b12c4f9 | ||
|
|
487a2a9eca | ||
|
|
559114c3cb | ||
|
|
dee62718ae | ||
|
|
bee10f5774 | ||
|
|
7795db64d1 | ||
|
|
6bc54a934e | ||
|
|
ebb92c0545 | ||
|
|
e0de1020ea | ||
|
|
4e510c69b1 | ||
|
|
b72d654fa2 | ||
|
|
77086ab57d | ||
|
|
8474dbc09e | ||
|
|
8eb1d79333 | ||
|
|
7bd7644702 | ||
|
|
037eff335b | ||
|
|
7adeb80765 | ||
|
|
a52723e3e8 | ||
|
|
e4fd17bffa | ||
|
|
8ff6ff3ab0 | ||
|
|
868ea55b7c | ||
|
|
4810ed8107 | ||
|
|
35b8e0e947 | ||
|
|
be7c620d65 | ||
|
|
7928c3e6fb | ||
|
|
8d454b843c | ||
|
|
7823c65ee9 | ||
|
|
e4ee138f64 | ||
|
|
7d1b1133d0 | ||
|
|
2deb687446 | ||
|
|
3d601616da | ||
|
|
bda2bed459 | ||
|
|
3ae81aa338 | ||
|
|
c239e53bab | ||
|
|
eee37354b5 | ||
|
|
be737c3dd6 | ||
|
|
a91873a1b9 | ||
|
|
b590ad0292 | ||
|
|
05e70adf22 | ||
|
|
7efe0b5da3 | ||
|
|
351e3630bb | ||
|
|
4fd1fc70e0 | ||
|
|
e02ce4c7f0 | ||
|
|
7cab285eda | ||
|
|
86efe28222 | ||
|
|
cf1446dc9e | ||
|
|
e93c40b33d | ||
|
|
eff6739124 | ||
|
|
5a0d7802f4 | ||
|
|
f1e0839c9e | ||
|
|
3bf429aed8 | ||
|
|
f8cadc731b | ||
|
|
bd7aebb8b0 | ||
|
|
ca8039e612 | ||
|
|
5d07f4f726 | ||
|
|
e605ad9679 | ||
|
|
50fac71d46 | ||
|
|
a8455b072a | ||
|
|
a9d6e16e0a | ||
|
|
bd0cf11e00 | ||
|
|
c8512e09e7 | ||
|
|
96f503e197 | ||
|
|
9912dd28ca | ||
|
|
22aaad0c45 | ||
|
|
a45ed4ecc1 | ||
|
|
fef272bdf3 | ||
|
|
d1f57a4ae5 | ||
|
|
5d5f12fb0d | ||
|
|
9f6013a0fd | ||
|
|
fad0f9231b | ||
|
|
81df326649 | ||
|
|
01c5b6ab0f | ||
|
|
c45f86d286 | ||
|
|
1664d1c5ed | ||
|
|
71758d854a | ||
|
|
3751d50e70 | ||
|
|
3f5e6905da | ||
|
|
719782e6ba | ||
|
|
ee175dfd00 | ||
|
|
f3110c9b9a | ||
|
|
18743948b5 | ||
|
|
849d91bc02 | ||
|
|
73a822e636 | ||
|
|
5b879c8980 | ||
|
|
8fd5f0d5a5 | ||
|
|
a4dce889a4 | ||
|
|
7c4b40de61 | ||
|
|
f9bba892bd | ||
|
|
facfd9c406 | ||
|
|
0308dfb039 | ||
|
|
9d8fc7fd3e | ||
|
|
b5515215c1 | ||
|
|
ab3dc5415c | ||
|
|
06f3245fa4 | ||
|
|
05d702422a | ||
|
|
121da2cbdb | ||
|
|
7a45fc35bf | ||
|
|
ae1e65a285 | ||
|
|
ba9db64745 | ||
|
|
b4b8666e4a | ||
|
|
0021bc3e28 | ||
|
|
4b0efdeb28 | ||
|
|
73917e9e6f | ||
|
|
ba29791773 | ||
|
|
a7842d1bc0 | ||
|
|
81a9580622 | ||
|
|
85f7c08036 | ||
|
|
098f5084a0 | ||
|
|
07a4b32f4d | ||
|
|
3ead69b1c1 | ||
|
|
42f0b949ec | ||
|
|
e7b709ab0b | ||
|
|
35068fbe66 | ||
|
|
16d34d8036 | ||
|
|
bfbd73f3e0 | ||
|
|
602f8e2a77 | ||
|
|
ace93397c1 | ||
|
|
d2192653db | ||
|
|
83a832618d | ||
|
|
0e0d7d2975 | ||
|
|
5abbc66fe4 | ||
|
|
bf338b7cd2 | ||
|
|
3967e46a2d | ||
|
|
b994c3bf78 | ||
|
|
03a13ce793 | ||
|
|
f5fc21240f | ||
|
|
ebddc0a0d2 | ||
|
|
8359341013 | ||
|
|
c7fe52e514 | ||
|
|
5cdbc97c9d | ||
|
|
9017924783 | ||
|
|
e3fdc37049 | ||
|
|
a99b4f45bb | ||
|
|
ea31f21fd8 | ||
|
|
2b0a9c69df | ||
|
|
c69944ff8b | ||
|
|
01898726e2 | ||
|
|
20a6c3175f | ||
|
|
45ef3d92a1 | ||
|
|
fa386893aa | ||
|
|
dc73dc4fb2 | ||
|
|
677a91aef2 | ||
|
|
dab2ee0f74 | ||
|
|
7f49dc7d1d | ||
|
|
5f26baa748 | ||
|
|
80752c0dc1 | ||
|
|
f8c9c7acae | ||
|
|
7d324cf00c | ||
|
|
98364385a6 | ||
|
|
b5197d5770 | ||
|
|
e9b69f8655 | ||
|
|
099339df0a | ||
|
|
8e4ca87228 | ||
|
|
72e2a94d5f | ||
|
|
059cb26ca2 | ||
|
|
c3d32f4a9a | ||
|
|
74484f42f3 | ||
|
|
6565b9a566 | ||
|
|
b8351d06f1 | ||
|
|
67521bc0e8 | ||
|
|
4fb70e4dd3 | ||
|
|
3ac6af879d | ||
|
|
f3d09f3108 | ||
|
|
1cb6c26b4f | ||
|
|
c164fc0822 | ||
|
|
25347d885c | ||
|
|
fa264a0687 | ||
|
|
5fe636c7ee | ||
|
|
50b8d4ba5a | ||
|
|
57d69b04b2 | ||
|
|
3e6a075f7f | ||
|
|
29b1da4e18 | ||
|
|
667588ee8a | ||
|
|
b122a71c83 | ||
|
|
1a0b3bf83b | ||
|
|
53bde230c6 | ||
|
|
fd3c17995e | ||
|
|
d13a7fdb0a | ||
|
|
a61a84ec6a | ||
|
|
394c1aa6f2 | ||
|
|
5281d09af7 | ||
|
|
0299b699bb | ||
|
|
cff8d06e51 | ||
|
|
45372aed4e | ||
|
|
b89b6517f2 | ||
|
|
cd45c269e2 | ||
|
|
44cad07704 | ||
|
|
f612071298 | ||
|
|
a7694cedf9 | ||
|
|
2fead9abdb | ||
|
|
d573ef0d69 | ||
|
|
6cdd3287dd | ||
|
|
2d60a624c9 | ||
|
|
5d4bd04588 | ||
|
|
47f92cb354 | ||
|
|
715fdcffbf | ||
|
|
153df66692 | ||
|
|
ce9d542a78 | ||
|
|
c66e591fa5 | ||
|
|
2495c49077 | ||
|
|
6c3b482891 | ||
|
|
5ec892c480 | ||
|
|
9188385b55 | ||
|
|
1bf3e2860b | ||
|
|
7d8d1c3f92 | ||
|
|
694c6234f9 | ||
|
|
13b70e2218 | ||
|
|
fa55bfa71f | ||
|
|
93d2986bba | ||
|
|
75964cf0df | ||
|
|
3c2b71cde6 | ||
|
|
37c6dbb8ad | ||
|
|
0883e6591f | ||
|
|
a538d0d8aa | ||
|
|
2645ee3519 | ||
|
|
ad15cd977a | ||
|
|
4e97614f5a | ||
|
|
82c36f0f0b | ||
|
|
ee1bcce627 | ||
|
|
8347aabe14 | ||
|
|
25bdc41ee0 | ||
|
|
57e3f5a80c | ||
|
|
8c3eae0d44 | ||
|
|
6fe281271c | ||
|
|
23a37cc1c5 | ||
|
|
eb1b04fa00 | ||
|
|
cdc252ace9 | ||
|
|
95b55cc5c4 | ||
|
|
e96d567a27 | ||
|
|
b62b690ccf | ||
|
|
7d687eaee3 | ||
|
|
a2ab59fa18 | ||
|
|
777226dd9f | ||
|
|
95e1b48e20 | ||
|
|
bb077f38f7 | ||
|
|
a6316700e8 | ||
|
|
795f7e32cc | ||
|
|
c721eb9e28 | ||
|
|
3aed6a21f5 | ||
|
|
b6d3f107fe | ||
|
|
704a04512c | ||
|
|
2586398fcc | ||
|
|
d9b37a62ff | ||
|
|
3d2bf2a8e3 | ||
|
|
a3ced22c06 | ||
|
|
a2b6281b39 | ||
|
|
cf4600ca45 | ||
|
|
8d64416e8c | ||
|
|
26859f6d61 | ||
|
|
f84a8e96d1 | ||
|
|
4247df921b | ||
|
|
9bdff3d271 | ||
|
|
d03b1a7e8c | ||
|
|
973c456f63 | ||
|
|
2d07940325 | ||
|
|
13cdb2d397 | ||
|
|
b2a3a302e6 | ||
|
|
8c4a1163ee | ||
|
|
cf4e3eecef | ||
|
|
2eaa7ed946 | ||
|
|
e198269f40 | ||
|
|
6181f05630 | ||
|
|
a4ba0d21a1 | ||
|
|
5d0764d23b | ||
|
|
41ded58286 | ||
|
|
5649888686 | ||
|
|
e40a3eed34 | ||
|
|
6537a59c98 | ||
|
|
154bc7ddac | ||
|
|
a990213582 | ||
|
|
9dfd46a5d5 | ||
|
|
984d8cc72c | ||
|
|
896b2f75c5 | ||
|
|
3ce67fa673 | ||
|
|
889dea0275 | ||
|
|
ab3ec56ffe | ||
|
|
c8da23c372 | ||
|
|
69720f1231 | ||
|
|
100f8696c7 | ||
|
|
8c6b06df1f | ||
|
|
6d9aafc5ad | ||
|
|
878dc0a172 | ||
|
|
a874011e37 | ||
|
|
3eb9042a30 | ||
|
|
aa5de5728c | ||
|
|
21eeee46e9 | ||
|
|
db025a6fb7 | ||
|
|
ca822faeec | ||
|
|
ae915ab8e7 | ||
|
|
27630864e7 | ||
|
|
857be0e10f | ||
|
|
bbfa419b89 | ||
|
|
b7613423ce | ||
|
|
49dc1b5bf1 | ||
|
|
f475105c2f | ||
|
|
a60a9e3071 | ||
|
|
c53d599df4 | ||
|
|
9458250968 | ||
|
|
8cbc235723 | ||
|
|
9a377eb0a8 | ||
|
|
09aa05d89c | ||
|
|
2b7dca1c86 | ||
|
|
3367d8dd5c | ||
|
|
8da0cef821 | ||
|
|
fb1e27cf47 | ||
|
|
65fa634cdc | ||
|
|
7c64b1f4ff | ||
|
|
9611baf855 | ||
|
|
2559f4cec5 | ||
|
|
d4fbda2a94 | ||
|
|
84dcd7991b | ||
|
|
50910389c9 | ||
|
|
6cc69f4d14 | ||
|
|
46532a9d3b | ||
|
|
5603f0bdf2 | ||
|
|
ce99bc67b8 | ||
|
|
9ff76cdda8 | ||
|
|
84744e5f63 | ||
|
|
09bc1b99c9 | ||
|
|
f19ecae3b2 | ||
|
|
e3257f88e2 | ||
|
|
b4ea71a8b2 | ||
|
|
c85418ba07 | ||
|
|
0e38617ad7 | ||
|
|
493182f70e | ||
|
|
ed2c9a69d3 | ||
|
|
333bcd2ee3 | ||
|
|
04705b9370 | ||
|
|
79331541ae | ||
|
|
d6fb1813ee | ||
|
|
7194099027 | ||
|
|
171b6bacb9 | ||
|
|
e1c33f04d1 | ||
|
|
3c22b260b1 | ||
|
|
e5000890a4 | ||
|
|
ea0db44fed | ||
|
|
ec99c418a7 | ||
|
|
a807cfa6eb | ||
|
|
41c43ef3d7 | ||
|
|
1dac131ec4 | ||
|
|
9268d9aceb | ||
|
|
bb5603c2f0 | ||
|
|
2c29a70819 | ||
|
|
cf31256f9a | ||
|
|
7132650bba | ||
|
|
d908fb3f18 | ||
|
|
d023679818 | ||
|
|
d87c8ac79a | ||
|
|
a7e46f6e41 | ||
|
|
2d7e743802 | ||
|
|
50fb434689 | ||
|
|
b5d4eb8913 | ||
|
|
2116ad3a28 | ||
|
|
15233a3728 | ||
|
|
b476c143c0 | ||
|
|
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 |
+11
-1
@@ -1,7 +1,17 @@
|
||||
/ABOUT-NLS~
|
||||
*.eps
|
||||
*.log
|
||||
*.o
|
||||
*.pdf
|
||||
*.png
|
||||
*.stamp
|
||||
*.trs
|
||||
*~
|
||||
.deps
|
||||
.dirstamp
|
||||
/*.cache
|
||||
/*.flc
|
||||
/*.prj
|
||||
/*~
|
||||
/.tarball-version
|
||||
/.version
|
||||
/ABOUT-NLS
|
||||
|
||||
+1
-1
@@ -1 +1 @@
|
||||
2.7.1
|
||||
3.3.91
|
||||
|
||||
+429
@@ -0,0 +1,429 @@
|
||||
# Travis defines and exports CC and CXX *after* we have defined our
|
||||
# environment variables via 'env'. So, do not use 'env' to define
|
||||
# them. Instead, put their definitions in MATRIX_EVAL, which we eval
|
||||
# after the definitions from Travis.
|
||||
|
||||
language: cpp
|
||||
|
||||
env:
|
||||
global:
|
||||
# ICC serial number.
|
||||
# See https://github.com/nemequ/icc-travis.
|
||||
secure: B3manbbi0anCAGDJTdAa9TlodzRHeiYD87FKmFzS877dPm8Cm0BDvtUhKBUpBvP8+nbHOWFGrgDmLugSZjTGU+mAxtuQpamUFHvinu0BIk3qtjlqouwvbtIqUu8iiZ3Uqu+xKeAANKRy0YVZGLlEb9F3N119tJ/Fxp1p9bXL1qph+CZ25OFbUgZ2s4F+/AyHMUxJlNXKFe3Qean65hC6edhU3zoaKzr/g/wtbhRmcyWbkOa1dJqzr2yKotcPvrnApGhDzgMKFtohg/t7xfMADDVv6sGS5XNpt25Z+MUCmLg4Z9eD7u109jvRV1eu/jgVafqsthWEhXbuMiFgFhKBKGCNZ0dACIfKZSkFZI6FdM7ovJ6aNhSlxZ2169Ybd22rN1UTHeCQWySPcVVOg5taLVpqe+E8Xhnv4hBO5NrzElWwCMLxIdPUSwVStYvtDr8ZytHWzfot50vSnFKIFpTOr9hP4+AJMVmmqJfaJo2MLBft/q2xkztrMv3lQSj3m4+ma9kPDwXIu9uCutjlnhc00jNx9qegi5VfpAjxcG1R+pX4T20az6ByHk/7LPQsANkT31RJq/jAeD9LEuMOy8miha83q4QuvbFaqPK3PY0el/O1LZaXqLsV2aQ0uqH8YX0l4r5NzHdhb+3lYgvpMBO5ytr/EWJiEyNYV518050IUDE=
|
||||
|
||||
# Run in two steps:
|
||||
# 1. Build the tarball
|
||||
# On a modern distro, with all the needed dependencies, including the whole git history.
|
||||
# 2. Check it on various environments.
|
||||
# Less dependencies, and little git content (we would like to have none, but it's not
|
||||
# an option on Travis).
|
||||
stages:
|
||||
- compile
|
||||
- test
|
||||
|
||||
# matrix.include and jobs.include are aliases (https://docs.travis-ci.com/user/conditional-builds-stages-jobs/).
|
||||
jobs:
|
||||
include:
|
||||
- stage: "compile"
|
||||
dist: xenial
|
||||
script:
|
||||
- sudo apt-get update -qq
|
||||
- sudo apt-get install -qq autoconf automake autopoint flex gettext graphviz help2man m4 texinfo
|
||||
- autoconf --version
|
||||
- automake --version
|
||||
- autopoint --version
|
||||
- dot -V
|
||||
- gettext --version
|
||||
- help2man --version
|
||||
- makeinfo --version
|
||||
- m4 --version
|
||||
- git tag -l
|
||||
# For some reasons, sometimes the checkout does not have any tags,
|
||||
# so `git describe` fails, so bootstrap fails.
|
||||
- git describe || git tag v3.0 -m "Fake version 3.0."
|
||||
- git describe
|
||||
|
||||
# Appears to be needed for the following command (https://github.com/AppImage/AppImageKit/issues/511).
|
||||
- git submodule sync
|
||||
# Travis makes a shallow clone, but we need it in full to build the ChangeLog and apply the fixes in git-log-fix.
|
||||
- git fetch --unshallow || true
|
||||
|
||||
- ./bootstrap
|
||||
- if [[ -f ~/.bashrc ]]; then source ~/.bashrc; fi
|
||||
- ./configure --enable-gcc-warnings CC="$CC" CXX="$CXX" $CONFIGUREFLAGS || { cat config.log && false; }
|
||||
- make -j2
|
||||
- make -j2 dist
|
||||
- dist=$(echo bison*.xz)
|
||||
# Unfortunately we cannot deterministically know the name of the tarball without the full
|
||||
# git history (because git describe --abbrev=4 may use more than 4 characters if there are
|
||||
# conflicts). Besides, one day we would like not to depend on the repository at all in the
|
||||
# 'test' jobs. So also expose this tarball on a name that only depends on the Travis build
|
||||
# number.
|
||||
- sftp [email protected] <<< "put $dist"$'\n'"ln -s $dist bison-$TRAVIS_BUILD_NUMBER.tar.xz"
|
||||
|
||||
## ------- ##
|
||||
## First. ##
|
||||
## ------- ##
|
||||
|
||||
# Start with three completely different environments, to get
|
||||
# errors asap.
|
||||
|
||||
- name: "GCC 7 -O3"
|
||||
stage: test
|
||||
os: linux
|
||||
dist: xenial
|
||||
addons:
|
||||
apt:
|
||||
sources:
|
||||
- ubuntu-toolchain-r-test
|
||||
packages:
|
||||
- g++-7
|
||||
env:
|
||||
- MATRIX_EVAL="CC=gcc-7 && CXX=g++-7 && CONFIGUREFLAGS='CPPFLAGS=-DNDEBUG CFLAGS=-O3 CXXFLAGS=-O3'"
|
||||
|
||||
# ASAN is time consuming, and we timeout the 50min granted by
|
||||
# Travis if we run all the tests in one go. Run in two parts.
|
||||
- name: "Clang 7 libc++ and ASAN part 1"
|
||||
stage: test
|
||||
os: linux
|
||||
dist: xenial
|
||||
addons:
|
||||
apt:
|
||||
sources:
|
||||
- llvm-toolchain-xenial-7
|
||||
- ubuntu-toolchain-r-test
|
||||
packages:
|
||||
- clang-7
|
||||
- libc++-7-dev
|
||||
- libc++abi-7-dev
|
||||
env:
|
||||
# Do not use ASAN with ubuntu's libc++: https://bugs.llvm.org/show_bug.cgi?id=17379
|
||||
- MATRIX_EVAL="PART=1 CC='clang-7 -fsanitize=address' CXX='clang++-7 -fsanitize=address -stdlib=libc++'"
|
||||
|
||||
- name: "Clang 7 libc++ and ASAN part 2"
|
||||
stage: test
|
||||
os: linux
|
||||
dist: xenial
|
||||
addons:
|
||||
apt:
|
||||
sources:
|
||||
- llvm-toolchain-xenial-7
|
||||
- ubuntu-toolchain-r-test
|
||||
packages:
|
||||
- clang-7
|
||||
- libc++-7-dev
|
||||
- libc++abi-7-dev
|
||||
env:
|
||||
# Do not use ASAN with ubuntu's libc++: https://bugs.llvm.org/show_bug.cgi?id=17379
|
||||
- MATRIX_EVAL="PART=2 CC='clang-7 -fsanitize=address' CXX='clang++-7 -fsanitize=address -stdlib=libc++'"
|
||||
|
||||
- name: "ICC"
|
||||
stage: test
|
||||
os: linux
|
||||
dist: xenial
|
||||
env:
|
||||
# ICC's warnings are often very wrong (e.g., it thinks foo ?
|
||||
# "bar" : "baz" is char* instead of const char*), so don't try
|
||||
# to work around the, and obviously, don't die on them.
|
||||
- MATRIX_EVAL="CC=icc && CXX=icpc"
|
||||
- MAKE_ARGS='WERROR_CFLAGS= WERROR_CXXFLAGS='
|
||||
|
||||
|
||||
## ----- ##
|
||||
## GCC. ##
|
||||
## ----- ##
|
||||
|
||||
#- name: "GCC 8 with sanitizers"
|
||||
# os: linux
|
||||
# dist: xenial
|
||||
# addons:
|
||||
# apt:
|
||||
# sources:
|
||||
# - ubuntu-toolchain-r-test
|
||||
# packages:
|
||||
# - g++-8
|
||||
# env:
|
||||
# # Can't use UBSAN: I get:
|
||||
# # configure:4951: gcc-8 -fsanitize=undefined,address -fno-omit-frame-pointer conftest.c
|
||||
# # /usr/bin/ld: unrecognized option '--push-state' (on trusty)
|
||||
# # /usr/bin/ld: unrecognized option '--push-state--no-as-needed' (on xenial)
|
||||
# #
|
||||
# # https://stackoverflow.com/questions/50024731/ suggests using the gold linker.
|
||||
# - MATRIX_EVAL="CC='gcc-8 -fsanitize=undefined,address -fno-omit-frame-pointer' CXX='g++-8 -fsanitize=undefined,address -fno-omit-frame-pointer'"
|
||||
|
||||
- name: "GCC 6"
|
||||
stage: test
|
||||
os: linux
|
||||
dist: xenial
|
||||
addons:
|
||||
apt:
|
||||
sources:
|
||||
- ubuntu-toolchain-r-test
|
||||
packages:
|
||||
- g++-6
|
||||
env:
|
||||
- MATRIX_EVAL="CC=gcc-6 && CXX=g++-6"
|
||||
|
||||
- name: "GCC 5"
|
||||
stage: test
|
||||
os: linux
|
||||
dist: xenial
|
||||
addons:
|
||||
apt:
|
||||
sources:
|
||||
- ubuntu-toolchain-r-test
|
||||
packages:
|
||||
- g++-5
|
||||
env:
|
||||
- MATRIX_EVAL="CC=gcc-5 && CXX=g++-5"
|
||||
|
||||
- name: "GCC 4.9"
|
||||
stage: test
|
||||
os: linux
|
||||
dist: xenial
|
||||
addons:
|
||||
apt:
|
||||
sources:
|
||||
- ubuntu-toolchain-r-test
|
||||
packages:
|
||||
- g++-4.9
|
||||
env:
|
||||
- MATRIX_EVAL="CC=gcc-4.9 && CXX=g++-4.9"
|
||||
|
||||
- name: "GCC 4.8"
|
||||
stage: test
|
||||
os: linux
|
||||
dist: xenial
|
||||
addons:
|
||||
apt:
|
||||
sources:
|
||||
- ubuntu-toolchain-r-test
|
||||
packages:
|
||||
- g++-4.8
|
||||
env:
|
||||
- MATRIX_EVAL="CC=gcc-4.8 && CXX=g++-4.8"
|
||||
|
||||
- name: "GCC 4.7"
|
||||
stage: test
|
||||
os: linux
|
||||
dist: xenial
|
||||
addons:
|
||||
apt:
|
||||
sources:
|
||||
- ubuntu-toolchain-r-test
|
||||
packages:
|
||||
- g++-4.7
|
||||
env:
|
||||
- MATRIX_EVAL="CC=gcc-4.7 && CXX=g++-4.7"
|
||||
|
||||
- name: "GCC 4.6"
|
||||
stage: test
|
||||
os: linux
|
||||
dist: xenial
|
||||
addons:
|
||||
apt:
|
||||
sources:
|
||||
- ubuntu-toolchain-r-test
|
||||
packages:
|
||||
- g++-4.6
|
||||
env:
|
||||
- MATRIX_EVAL="CC=gcc-4.6 && CXX=g++-4.6"
|
||||
|
||||
## ------- ##
|
||||
## Clang. ##
|
||||
## ------- ##
|
||||
|
||||
- name: "Clang 6 -O3 and libc++"
|
||||
stage: test
|
||||
os: linux
|
||||
dist: xenial
|
||||
addons:
|
||||
apt:
|
||||
sources:
|
||||
- llvm-toolchain-xenial-6.0
|
||||
- ubuntu-toolchain-r-test
|
||||
packages:
|
||||
- clang-6.0
|
||||
- libc++-dev
|
||||
env:
|
||||
- MATRIX_EVAL="CC=clang-6.0 && CXX='clang++-6.0 -stdlib=libc++'"
|
||||
- CONFIGUREFLAGS='CPPFLAGS=-DNDEBUG CFLAGS=-O3 CXXFLAGS=-O3'
|
||||
|
||||
- name: "Clang 5"
|
||||
stage: test
|
||||
os: linux
|
||||
dist: xenial
|
||||
addons:
|
||||
apt:
|
||||
sources:
|
||||
- llvm-toolchain-xenial-5.0
|
||||
packages:
|
||||
- clang-5.0
|
||||
- libc++-dev
|
||||
env:
|
||||
- MATRIX_EVAL="CC='clang-5.0' CXX='clang++-5.0'"
|
||||
|
||||
- name: "Clang 4"
|
||||
stage: test
|
||||
os: linux
|
||||
dist: xenial
|
||||
addons:
|
||||
apt:
|
||||
sources:
|
||||
- llvm-toolchain-xenial-4.0
|
||||
packages:
|
||||
- clang-4.0
|
||||
env:
|
||||
- MATRIX_EVAL="CC=clang-4.0 && CXX=clang++-4.0"
|
||||
|
||||
- name: "Clang 3.9"
|
||||
stage: test
|
||||
os: linux
|
||||
dist: xenial
|
||||
addons:
|
||||
apt:
|
||||
sources:
|
||||
- llvm-toolchain-xenial-3.9
|
||||
packages:
|
||||
- clang-3.9
|
||||
env:
|
||||
- MATRIX_EVAL="CC=clang-3.9 && CXX=clang++-3.9"
|
||||
|
||||
- name: "Clang 3.8"
|
||||
stage: test
|
||||
os: linux
|
||||
dist: xenial
|
||||
addons:
|
||||
apt:
|
||||
sources:
|
||||
- ubuntu-toolchain-r-test
|
||||
- llvm-toolchain-precise-3.8
|
||||
packages:
|
||||
- clang-3.8
|
||||
env:
|
||||
- MATRIX_EVAL="CC=clang-3.8 && CXX=clang++-3.8"
|
||||
|
||||
- name: "CLang 3.7"
|
||||
stage: test
|
||||
os: linux
|
||||
dist: xenial
|
||||
addons:
|
||||
apt:
|
||||
sources:
|
||||
- ubuntu-toolchain-r-test
|
||||
- llvm-toolchain-precise-3.7
|
||||
packages:
|
||||
- clang-3.7
|
||||
env:
|
||||
- MATRIX_EVAL="CC=clang-3.7 && CXX=clang++-3.7"
|
||||
|
||||
- name: "Clang 3.6"
|
||||
stage: test
|
||||
os: linux
|
||||
dist: xenial
|
||||
addons:
|
||||
apt:
|
||||
sources:
|
||||
- ubuntu-toolchain-r-test
|
||||
- llvm-toolchain-precise-3.6
|
||||
packages:
|
||||
- clang-3.6
|
||||
env:
|
||||
- MATRIX_EVAL="CC=clang-3.6 && CXX=clang++-3.6"
|
||||
|
||||
- name: "Clang 3.5"
|
||||
stage: test
|
||||
os: linux
|
||||
dist: xenial
|
||||
addons:
|
||||
apt:
|
||||
sources:
|
||||
- ubuntu-toolchain-r-test
|
||||
- llvm-toolchain-precise-3.5
|
||||
packages:
|
||||
- clang-3.5
|
||||
env:
|
||||
- MATRIX_EVAL="CC=clang-3.5 && CXX=clang++-3.5"
|
||||
|
||||
- name: "Clang 3.4"
|
||||
stage: test
|
||||
os: linux
|
||||
# Not available on Xenial.
|
||||
dist: trusty
|
||||
addons:
|
||||
apt:
|
||||
packages:
|
||||
- clang-3.4
|
||||
env:
|
||||
# No versioned name installed, but beware that Travis installs
|
||||
# a more modern clang earlier in the default PATH.
|
||||
- MATRIX_EVAL='CC=/usr/bin/clang && CXX=/usr/bin/clang++'
|
||||
|
||||
- name: "Clang 3.3"
|
||||
stage: test
|
||||
os: linux
|
||||
# Not available on Xenial.
|
||||
dist: trusty
|
||||
addons:
|
||||
apt:
|
||||
packages:
|
||||
- clang-3.3
|
||||
env:
|
||||
# See comment for 3.4.
|
||||
- MATRIX_EVAL='CC=/usr/bin/clang && CXX=/usr/bin/clang++'
|
||||
|
||||
## From https://docs.gitlab.com/ce/ci/ssh_keys/#ssh-keys-when-using-the-docker-executor.
|
||||
## Applies to Travis too. Applied to all the 'script's (of all the jobs).
|
||||
before_script:
|
||||
- 'which ssh-agent || ( apt-get update -y && apt-get install openssh-client -y )'
|
||||
- eval "$(ssh-agent -s)"
|
||||
# $SSH_PRIVATE_KEY is multiline. Use $'...' to register its value: $'-----BEGIN OPENSSH PRIVATE KEY-----\nXXXXX...\n...==\n-----END OPENSSH PRIVATE KEY-----'.
|
||||
- echo "$SSH_PRIVATE_KEY" >/tmp/key.id_rsa
|
||||
- chmod 600 /tmp/key.id_rsa
|
||||
- ssh-add /tmp/key.id_rsa </dev/null
|
||||
- mkdir -p ~/.ssh
|
||||
- chmod 700 ~/.ssh
|
||||
- echo '|1|bpc51UGxoDZjCPiwRlCStW32trI=|rfh6mLoLZv/vAvOVrpZXI1hTLxg= ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBIR+ckMoJTNXHvAQLHWSfrRnrNJGW2ZR6kr5pBVDGCkz1v1RcQ5rleq0NAt9kS3v4hgnuLiEVnK7KDRzcEH3ikc=' >>~/.ssh/known_hosts
|
||||
- chmod 600 ~/.ssh/known_hosts
|
||||
|
||||
# Applies only to the jobs that don't have a 'script', i.e., applies to all the 'test' jobs, but not the 'compile' one.
|
||||
script:
|
||||
- eval "$MATRIX_EVAL"
|
||||
# Beware not too leak $SSH_PRIVATE_KEY.
|
||||
# - env
|
||||
- sudo apt-get update -qq
|
||||
- sudo apt-get install -qq doxygen flex m4
|
||||
# Install and activate ICC.
|
||||
- if [[ $CC == "icc" ]]; then build-aux/install-icc.sh; fi
|
||||
- if [[ -f ~/.bashrc ]]; then source ~/.bashrc; fi
|
||||
# Install and activate dmd.
|
||||
- mkdir -p ~/dlang && wget https://dlang.org/install.sh -O ~/dlang/install.sh
|
||||
- source $(source ~/dlang/install.sh dmd -a)
|
||||
|
||||
- $CC --version
|
||||
- $CXX --version
|
||||
- dmd --version
|
||||
- doxygen --version
|
||||
- flex --version
|
||||
- ld --version
|
||||
- m4 --version
|
||||
|
||||
- if [[ -f ~/.bashrc ]]; then source ~/.bashrc; fi
|
||||
# Unset this variable, otherwise, Java programs' stderr is cluttered
|
||||
# with `Picked up _JAVA_OPTIONS: -Xmx2048m -Xms512m`, which makes
|
||||
# the test suite fail.
|
||||
- unset _JAVA_OPTIONS
|
||||
- sftp [email protected]:bison-$TRAVIS_BUILD_NUMBER.tar.xz
|
||||
- tar xf bison-$TRAVIS_BUILD_NUMBER.tar.xz
|
||||
- dir=$(tar tf bison-$TRAVIS_BUILD_NUMBER.tar.xz | sed 1q)
|
||||
- cd $dir
|
||||
- mkdir _build
|
||||
- cd _build
|
||||
- ../configure --enable-gcc-warnings CC="$CC" CXX="$CXX" $CONFIGUREFLAGS || { cat config.log && false; }
|
||||
- make -j2 $MAKE_ARGS
|
||||
- if test ${PART-1} = 1; then make check VERBOSE=1 TESTSUITEFLAGS=-j2 || { cat test-suite.log && cat tests/testsuite.log && false; }; fi
|
||||
- if test ${PART-1} = 1; then make maintainer-check-posix VERBOSE=1 TESTSUITEFLAGS=-j2 || { cat tests/testsuite.log && false; }; fi
|
||||
- if test ${PART-2} = 2; then make maintainer-check-g++ VERBOSE=1 TESTSUITEFLAGS=-j2 || { cat tests/testsuite.log && false; }; fi
|
||||
|
||||
after_script:
|
||||
- if [[ $CC == "icc" ]]; then uninstall_intel_software; fi
|
||||
@@ -24,7 +24,7 @@ and nasty bugs.
|
||||
|
||||
-----
|
||||
|
||||
Copyright (C) 1998-2013 Free Software Foundation, Inc.
|
||||
Copyright (C) 1998-2015, 2018-2019 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of Bison, the GNU Compiler Compiler.
|
||||
|
||||
|
||||
+45
-45
@@ -3671,12 +3671,12 @@
|
||||
2009-02-25 Akim Demaille <[email protected]>
|
||||
|
||||
Copyright years.
|
||||
* data/glr.c: Add 2007 and 2008 here, consistenly with the comments.
|
||||
* data/glr.c: Add 2007 and 2008 here, consistently with the comments.
|
||||
|
||||
2009-02-25 Akim Demaille <[email protected]>
|
||||
|
||||
Style changes.
|
||||
* etc/bench.pl.in (generate_grammar_list): Consitently use
|
||||
* etc/bench.pl.in (generate_grammar_list): Consistently use
|
||||
location_type, not yy::location.
|
||||
|
||||
2009-02-25 Akim Demaille <[email protected]>
|
||||
@@ -3702,7 +3702,7 @@
|
||||
Remove trailing blanks.
|
||||
The epilogue has its own ending \n, no need to add another.
|
||||
|
||||
* data/glr.c, data/lalr1.java, data/yacc.c: dnl when outputing the
|
||||
* data/glr.c, data/lalr1.java, data/yacc.c: dnl when outputting the
|
||||
epilogue.
|
||||
* data/glr.cc: dnl when extending the epilogue.
|
||||
Remove stray "private:".
|
||||
@@ -3764,7 +3764,7 @@
|
||||
2008-12-11 Akim Demaille <[email protected]>
|
||||
|
||||
Pass the token type to yysyntax_error.
|
||||
* data/yacc.c (yysyntax_error): Take the transated token instead
|
||||
* data/yacc.c (yysyntax_error): Take the translated token instead
|
||||
of the raw number.
|
||||
Adjust callers.
|
||||
* TODO: Update.
|
||||
@@ -5019,7 +5019,7 @@
|
||||
|
||||
Now instead of monolithic tables, we define one macro per cell. For
|
||||
instance "b4_symbol(0, tag)" is a macro name which contents is
|
||||
self-decriptive. The macro "b4_symbol" provides easier access to
|
||||
self-descriptive. The macro "b4_symbol" provides easier access to
|
||||
these cells.
|
||||
|
||||
* src/output.c (type_names_output): Remove.
|
||||
@@ -5200,7 +5200,7 @@
|
||||
|
||||
2008-11-09 Akim Demaille <[email protected]>
|
||||
|
||||
Agregate yylval and yylloc.
|
||||
Aggregate yylval and yylloc.
|
||||
* data/lalr1.cc (parser::yylval, parser::yylloc): Replace by...
|
||||
(parser::yyla): this.
|
||||
|
||||
@@ -5815,7 +5815,7 @@
|
||||
of members. Document that token names are added as fields.
|
||||
Document constructors accurately. Remove error method.
|
||||
(Java Scanner Interface): Move note on %pure-parser to Java Bison
|
||||
Interface. Describe %code lexer and yylex accutately.
|
||||
Interface. Describe %code lexer and yylex accurately.
|
||||
Remove documentation that does not match the code.
|
||||
(Java Action Features): New.
|
||||
(Java Differences): Add reference. Add item on semantic values.
|
||||
@@ -6432,7 +6432,7 @@
|
||||
* djgpp/config.site: Copyright timestamp adjusted.
|
||||
* djgpp/config_h.sed: Copyright timestamp adjusted.
|
||||
* djgpp/djunpack.bat: Copyright timestamp adjusted.
|
||||
* djgpp/fnchnage.lst: Add filenames that are not 8.3 clean to the
|
||||
* djgpp/fnchange.lst: Add filenames that are not 8.3 clean to the
|
||||
filename translation list.
|
||||
* djgpp/subpipe.c (init_subpipe): Check the environment variables
|
||||
TMPDIR, TMP and TEMP, in that order, to determinate where the temp
|
||||
@@ -7588,7 +7588,7 @@
|
||||
2007-03-07 Juan Manuel Guerrero <[email protected]>
|
||||
|
||||
DJGPP spefic issue. Inhibit the use of disallowed characters for
|
||||
file name genertion on Win98, WinXP, etc. These are |<>":?*\
|
||||
file name generation on Win98, WinXP, etc. These are |<>":?*\
|
||||
and concern testsuite case 46.
|
||||
* Makefile.am: djgpp/testsuite.sed added to EXTRA_DIST
|
||||
* djgpp/testsuite.sed: Inhibit the use of disallowed characters.
|
||||
@@ -8796,7 +8796,7 @@
|
||||
2006-12-13 Paul Eggert <[email protected]>
|
||||
|
||||
* TODO: Add pointer to Sylvain Schmitz's work on static detection
|
||||
of potential ambiguities in GLR grammers.
|
||||
of potential ambiguities in GLR grammars.
|
||||
|
||||
2006-12-12 Joel E. Denny <[email protected]>
|
||||
|
||||
@@ -9059,7 +9059,7 @@
|
||||
* src/scan-gram.l (<SC_BRACED_CODE>): Use val->code for BRACED_CODE,
|
||||
which is "{...}" in the parser.
|
||||
* tests/Makefile.am (maintainer-check-valgrind): Set
|
||||
VALGRIND_OPTS='--leak-check=full --show-reacheable=yes' before invoking
|
||||
VALGRIND_OPTS='--leak-check=full --show-reachable=yes' before invoking
|
||||
Valgrind.
|
||||
* tests/calc.at (_AT_DATA_CALC_Y): fclose the FILE* so Valgrind doesn't
|
||||
complain.
|
||||
@@ -12349,7 +12349,7 @@
|
||||
* data/lalr1.cc: here.
|
||||
(location.hh): Include it after the user prologue, in case the
|
||||
filename type is defined by the user.
|
||||
Forward declation location and position before the pre-prologue.
|
||||
Forward declaration location and position before the pre-prologue.
|
||||
(yyresult_): Rename as...
|
||||
(yyresult): this, it's a local variable, not an attribute.
|
||||
* data/Makefile.am (dist_pkgdata_DATA): Adjust.
|
||||
@@ -12439,8 +12439,8 @@
|
||||
(Table of Symbols): Under YYSTACK_USE_ALLOCA, Don't claim that the
|
||||
user must declare alloca.
|
||||
|
||||
* HACKING (release): Forwarn the Translation Project about
|
||||
stable releses.
|
||||
* HACKING (release): Forewarn the Translation Project about
|
||||
stable releases.
|
||||
|
||||
2005-09-20 Akim Demaille <[email protected]>
|
||||
|
||||
@@ -13165,7 +13165,7 @@
|
||||
not GNU M4, and that it works with any POSIX-compatible Awk.
|
||||
* examples/calc++/Makefile.am (run_extexi): Remove; not used.
|
||||
($(calc_extracted)): Renamed from $(calc_sources_extracted),
|
||||
so that we also get calc++-parser.yy. Geneate it.
|
||||
so that we also get calc++-parser.yy. Generate it.
|
||||
Use $(AWK), not gawk, since any conforming Awk will do.
|
||||
Put comment before action, since older 'make' can't handle comment
|
||||
in action.
|
||||
@@ -13993,7 +13993,7 @@
|
||||
* src/LR0.c (allocate_itemsets): Use xnmalloc, not xcalloc,
|
||||
to allocate kernel_base, kernel_items, kernel_size, since
|
||||
they needn't be initialized to 0.
|
||||
(allocate_storgae): Likewise, for shiftset, redset, shift_symbol.
|
||||
(allocate_storage): Likewise, for shiftset, redset, shift_symbol.
|
||||
* src/closure.c (new_closure): Likewise, for itemset.
|
||||
* src/derives.c (derives_compute): Likewise, for delts, derives, q.
|
||||
* src/lalr.c (set_goto_map): Likewise, for temp_map.
|
||||
@@ -14181,7 +14181,7 @@
|
||||
2004-10-05 Akim Demaille <[email protected]>
|
||||
|
||||
In Bison 1.875's yacc.c, YYLLOC_DEFAULT was called regardless
|
||||
whether the reducion was empty or not. This leaves room to
|
||||
whether the reduction was empty or not. This leaves room to
|
||||
improve the use of YYLLOC_DEFAULT in such a case.
|
||||
lalr1.cc is still experimental, so changing this is acceptable.
|
||||
And finally, there are probably not many users who changed the
|
||||
@@ -16524,7 +16524,7 @@
|
||||
(struct state): Renamed from struct state_s.
|
||||
(state): Renamed from state_t.
|
||||
(transitions): Renamed from transitions_t. Unused (and
|
||||
misspelled) transtion_s tag removed.
|
||||
misspelled) transition_s tag removed.
|
||||
(errs): Renamed from errs_t. Unused errs_s tag removed.
|
||||
(reductions): Renamed from reductions_t. Unused tag
|
||||
reductions_s removed.
|
||||
@@ -16612,9 +16612,9 @@
|
||||
|
||||
|
||||
Fix misspelling in names.
|
||||
* src/vcg.h (enum_alignment_e): Renamed from enum_alignement_e.
|
||||
* src/vcg.h (enum_alignment_e): Renamed from enum_alignment_e.
|
||||
* src/vcg_defaults.h (G_NODE_ALIGNMENT): Renamed from
|
||||
G_NODE_ALIGNEMENT.
|
||||
G_NODE_ALIGNMENT.
|
||||
|
||||
|
||||
* lib/timevar.c (timevar_report): Renamed from time_report,
|
||||
@@ -16866,7 +16866,7 @@
|
||||
* src/tables.c (conflict_row, pack_vector): Likewise.
|
||||
* src/vcg.c (get_color_str, get_textmode_str, get_shape_str,
|
||||
get_layoutalgorithm_str, get_decision_str, get_orientation_str,
|
||||
get_node_alignement_str, get_arrow_mode_str, get_crossing_type_str,
|
||||
get_node_alignment_str, get_arrow_mode_str, get_crossing_type_str,
|
||||
get_view_str, get_linestyle_str, get_arrowstyle_str): Likewise.
|
||||
|
||||
* lib/argmatch.h (ARRAY_CARDINALITY): Do not bother to #undef.
|
||||
@@ -17365,7 +17365,7 @@
|
||||
(scanner_last_string_free): Remove; not used.
|
||||
(percent_percent_count): Move decl to just before use.
|
||||
(SC_ESCAPED_CHARACTER): Return ID at unexpected end of file,
|
||||
not the (never otherwised-used) CHARACTER.
|
||||
not the (never otherwise-used) CHARACTER.
|
||||
|
||||
2002-11-07 Akim Demaille <[email protected]>
|
||||
|
||||
@@ -18052,7 +18052,7 @@
|
||||
suite using a GLR parser driven by LALR tables. It fails with -O2
|
||||
because `struct stat' gives two different answers on my machine:
|
||||
88 (definition of an auto var) and later 96 (memset on this var).
|
||||
Hence the stack is badly corrumpted. The headers inclusion is to
|
||||
Hence the stack is badly corrupted. The headers inclusion is to
|
||||
blame: if I move the awk.h inclusion before GLR's system header
|
||||
inclusion, the two struct stat have the same size.
|
||||
|
||||
@@ -18962,7 +18962,7 @@
|
||||
|
||||
2002-07-16 Akim Demaille <[email protected]>
|
||||
|
||||
* src/assoc.c, src/asssoc.h (assoc_t, assoc_to_string): New.
|
||||
* src/assoc.c, src/assoc.h (assoc_t, assoc_to_string): New.
|
||||
Adjust all former `associativity' dependencies.
|
||||
* src/symtab.c (symbol_new): Default associativity is `undef', not
|
||||
`right'.
|
||||
@@ -20105,7 +20105,7 @@
|
||||
|
||||
* data/bison.c++: Catch up with bison.simple:
|
||||
2002-05-24 Paul Hilfinger <[email protected]>
|
||||
and Paul Eggert <[email protected]>: `error' handing.
|
||||
and Paul Eggert <[email protected]>: `error' handling.
|
||||
2002-05-26 Akim Demaille <[email protected]>: stos_, token_number_,
|
||||
and popping traces.
|
||||
|
||||
@@ -20455,7 +20455,7 @@
|
||||
single characters while replacing `[' and `]' with quadrigraphs, to
|
||||
avoid troubles with M4 quotes.
|
||||
(copy_comment): Output characters with copy_character.
|
||||
(read_additionnal_code): Likewise.
|
||||
(read_additional_code): Likewise.
|
||||
(copy_string2): Likewise.
|
||||
(copy_definition): Likewise.
|
||||
|
||||
@@ -20638,7 +20638,7 @@
|
||||
* data/bison.simple, data/bison.c++: Adjust.
|
||||
* tests/torture.at (Big triangle): Move the limit from 254 to
|
||||
500.
|
||||
* tests/regression.at (Web2c Actions): Ajust.
|
||||
* tests/regression.at (Web2c Actions): Adjust.
|
||||
|
||||
Trying with bigger grammars shows various phenomena: at 3000 (28Mb
|
||||
of grammar file) bison is killed by my system, at 2000 (12Mb) bison
|
||||
@@ -20949,7 +20949,7 @@
|
||||
|
||||
2002-03-05 Robert Anisko <[email protected]>
|
||||
|
||||
* src/reader.c (read_additionnal_code): `c' should be an integer, not
|
||||
* src/reader.c (read_additional_code): `c' should be an integer, not
|
||||
a character.
|
||||
Reported by Nicolas Tisserand and Nicolas Burrus.
|
||||
|
||||
@@ -21070,7 +21070,7 @@
|
||||
|
||||
* src/L0.c, src/LR0.h (nstates): Be size_t.
|
||||
Adjust comparisons (signed vs unsigned).
|
||||
* src/conflics.c, src/lalr.c, src/lalr.h, src/output.c (LA): Now a
|
||||
* src/conflicts.c, src/lalr.c, src/lalr.h, src/output.c (LA): Now a
|
||||
bitset*.
|
||||
Adjust all dependencies.
|
||||
|
||||
@@ -22337,7 +22337,7 @@
|
||||
|
||||
* src/bison.simple: Remove #line just before %%epilogue. It
|
||||
is now handled in ...
|
||||
* src/reader.c (read_additionnal_code): Add the output of a
|
||||
* src/reader.c (read_additional_code): Add the output of a
|
||||
#line for the epilogue.
|
||||
|
||||
2001-12-10 Marc Autret <[email protected]>
|
||||
@@ -22797,7 +22797,7 @@
|
||||
on user names when possible.
|
||||
|
||||
(YYSTACK_USE_ALLOCA): Do not define; just use any existing defn.
|
||||
Simplify test for whather <alloca.h> exists.
|
||||
Simplify test for whether <alloca.h> exists.
|
||||
|
||||
(<stdlib.h>): Include if we will use malloc, and if standard C or C++.
|
||||
|
||||
@@ -23563,7 +23563,7 @@
|
||||
|
||||
2001-10-04 Akim Demaille <[email protected]>
|
||||
|
||||
* src/reader.c (parse_union_decl): Push the caracters in
|
||||
* src/reader.c (parse_union_decl): Push the characters in
|
||||
union_obstack, not attrs_obstack.
|
||||
|
||||
2001-10-04 Akim Demaille <[email protected]>
|
||||
@@ -23844,7 +23844,7 @@
|
||||
|
||||
* src/vcg.h (graph_s): color, textcolor, bordercolor are now
|
||||
enum color_e.
|
||||
* src/print_graph.c (print_graph): Initalize graph.layoutalgorithm
|
||||
* src/print_graph.c (print_graph): Initialize graph.layoutalgorithm
|
||||
to `normal'.
|
||||
* src/reader.c (parse_token_decl): Initialize token with tok_eof.
|
||||
* src/lex.h: Adjust prototype.
|
||||
@@ -23999,7 +23999,7 @@
|
||||
|
||||
* src/vcg.c: Remove includes of `complain.h' and `xalloc.h'.
|
||||
(get_xxxx_str): Use assert () instead of complain ().
|
||||
Remove return invokations in default cases.
|
||||
Remove return invocations in default cases.
|
||||
(get_decision_str): Modify default behaviour. Remove second argument.
|
||||
Echo modifications on calls.
|
||||
(output_graph): Fix.
|
||||
@@ -24030,7 +24030,7 @@
|
||||
informations about %union.
|
||||
(parse_union_decl): Copy the union_obstack in the muscle stype.
|
||||
* src/bison.simple: Add new #line directive.
|
||||
Add typdef %%stype YYSTYPE.
|
||||
Add typedef %%stype YYSTYPE.
|
||||
|
||||
2001-09-23 Pascal Bart <[email protected]>
|
||||
|
||||
@@ -24115,7 +24115,7 @@
|
||||
(parse_union_decl): Update.
|
||||
(parse_macro_decl): Rename parse_muscle_decl.
|
||||
Update to use renamed functions and variable.
|
||||
(read_declarations, copy_action, read_additionnal_code, : Updated
|
||||
(read_declarations, copy_action, read_additional_code, : Updated
|
||||
with correct variables and functions names.
|
||||
(packsymbols, reader): Likewise.
|
||||
|
||||
@@ -24196,7 +24196,7 @@
|
||||
|
||||
2001-08-31 Pascal Bart <[email protected]>, Marc Autret <[email protected]>
|
||||
|
||||
* src/reader.c (read_additionnal_code): Rename %%user_code to
|
||||
* src/reader.c (read_additional_code): Rename %%user_code to
|
||||
%%epilogue.
|
||||
* src/output.c (output): Rename %%declarations to %%prologue.
|
||||
* src/bison.simple: Echo modifications.
|
||||
@@ -24240,7 +24240,7 @@
|
||||
2001-08-29 Marc Autret <[email protected]>
|
||||
|
||||
* src/bison.simple: Add %%user_code directive at the end.
|
||||
* src/reader.c (read_additionnal_code): New.
|
||||
* src/reader.c (read_additional_code): New.
|
||||
(reader): Use it.
|
||||
* src/output.c (output_program): Remove.
|
||||
(output): Update.
|
||||
@@ -24303,7 +24303,7 @@
|
||||
(readgram): Disable a piece of code that was writing a default
|
||||
definition for 'YYSTYPE'.
|
||||
(reader_output_yylsp): Remove.
|
||||
(packsymbols): Output token defintions to a macro.
|
||||
(packsymbols): Output token definitions to a macro.
|
||||
(copy_definition): Disable C output.
|
||||
|
||||
* src/reader.c (parse_macro_decl): New function used to parse macro
|
||||
@@ -24641,7 +24641,7 @@
|
||||
|
||||
2001-07-08 Pascal Bart <[email protected]>
|
||||
|
||||
* src/bison.simple (yyparse): Suppress warning `comparaison
|
||||
* src/bison.simple (yyparse): Suppress warning `comparison
|
||||
between signed and unsigned'.
|
||||
|
||||
2001-07-05 Pascal Bart <[email protected]>
|
||||
@@ -25128,7 +25128,7 @@
|
||||
* tests/calc.m4: Test it.
|
||||
|
||||
For regularity of the names, replace each
|
||||
(nolineflag, toknumflag, rawtokenumflag, noparserflag): with...
|
||||
(nolineflag, toknumflag, rawtoknumflag, noparserflag): with...
|
||||
(no_lineflag, token_tableflag, rawflag, no_parserflag): this.
|
||||
In addition replace each `flag' with `_flag'.
|
||||
|
||||
@@ -25731,7 +25731,7 @@
|
||||
|
||||
* src/getargs.c, src/Makefile.am, src/reader.c, src/version.c:
|
||||
Have configure build version string instead of relying on ANSI string
|
||||
concatentation.
|
||||
concatenation.
|
||||
|
||||
1999-06-14 Jesse Thilo <[email protected]>
|
||||
|
||||
@@ -25741,7 +25741,7 @@
|
||||
|
||||
* acconfig.h, configure.in:
|
||||
Have configure build version string instead of relying on ANSI string
|
||||
concatentation.
|
||||
concatenation.
|
||||
|
||||
1999-06-08 Jesse Thilo <[email protected]>
|
||||
|
||||
@@ -26733,8 +26733,8 @@
|
||||
|
||||
-----
|
||||
|
||||
Copyright (C) 1987-1988, 1991-2013 Free Software Foundation,
|
||||
Inc.
|
||||
Copyright (C) 1987-1988, 1991-2015, 2018-2019 Free Software
|
||||
Foundation, Inc.
|
||||
|
||||
Copying and distribution of this file, with or without
|
||||
modification, are permitted provided the copyright notice and this
|
||||
|
||||
+37
-9
@@ -1,6 +1,6 @@
|
||||
## Process this file with automake to produce Makefile.in.
|
||||
|
||||
# Copyright (C) 2001-2013 Free Software Foundation, Inc.
|
||||
# Copyright (C) 2001-2015, 2018-2019 Free Software Foundation, Inc.
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
@@ -18,14 +18,23 @@
|
||||
AUTOMAKE_OPTIONS = subdir-objects
|
||||
ACLOCAL_AMFLAGS = -I m4
|
||||
|
||||
SUBDIRS = po runtime-po .
|
||||
SUBDIRS = po runtime-po gnulib-po .
|
||||
|
||||
# Files installed for use by Automake.
|
||||
aclocaldir = @aclocaldir@
|
||||
aclocal_DATA = m4/bison-i18n.m4
|
||||
|
||||
EXTRA_DIST = .prev-version .version \
|
||||
cfg.mk ChangeLog-1998 ChangeLog-2012 PACKAGING
|
||||
EXTRA_DIST = .prev-version .version cfg.mk PACKAGING \
|
||||
ChangeLog-1998 ChangeLog-2012 ChangeLog
|
||||
|
||||
dist_doc_DATA = AUTHORS COPYING NEWS README THANKS TODO
|
||||
|
||||
# Let generated files (e.g., from examples/) depend on this variable,
|
||||
# to make sure they are regenerated when there are changes in Bison.
|
||||
#
|
||||
# Don't depend on $(BISON) otherwise we would rebuild these files
|
||||
# in srcdir, including during distcheck, which is forbidden.
|
||||
dependencies = $(BISON_IN) $(src_bison_SOURCES) $(dist_skeletons_DATA)
|
||||
|
||||
## 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
|
||||
@@ -33,13 +42,16 @@ EXTRA_DIST = .prev-version .version \
|
||||
BISON = $(top_builddir)/tests/bison
|
||||
BISON_IN = $(top_srcdir)/tests/bison.in
|
||||
YACC = $(BISON) -o y.tab.c
|
||||
AM_YFLAGS = -d -v -Werror -Wall -Wno-yacc --report=all
|
||||
AM_YFLAGS_WITH_LINES = --defines -Werror -Wall --report=all
|
||||
AM_YFLAGS = $(AM_YFLAGS_WITH_LINES) --no-lines
|
||||
|
||||
# Initialization before completion by local.mk's.
|
||||
AM_CFLAGS = $(WARN_CFLAGS)
|
||||
# Find builddir/src/scan-code.c etc.
|
||||
AM_CPPFLAGS = -I. -Ilib -I$(top_srcdir) -I$(top_srcdir)/lib
|
||||
# Find builddir/src/scan-code.c etc. For some reason "-I./lib"
|
||||
# instead of "-Ilib" avoids infinite recursions on #include_next.
|
||||
AM_CPPFLAGS = -I. -I./lib -I$(top_srcdir) -I$(top_srcdir)/lib
|
||||
BUILT_SOURCES =
|
||||
CLEANDIRS =
|
||||
CLEANFILES =
|
||||
DISTCLEANFILES =
|
||||
EXTRA_DIST += $(dist_TESTS)
|
||||
@@ -48,12 +60,12 @@ MOSTLYCLEANFILES =
|
||||
SUFFIXES =
|
||||
TESTS = $(dist_TESTS)
|
||||
check_PROGRAMS =
|
||||
check_SCRIPTS =
|
||||
dist_TESTS =
|
||||
noinst_LIBRARIES =
|
||||
|
||||
include build-aux/local.mk
|
||||
include data/local.mk
|
||||
include djgpp/local.mk
|
||||
include doc/local.mk
|
||||
include etc/local.mk
|
||||
include examples/local.mk
|
||||
@@ -61,6 +73,9 @@ include lib/local.mk
|
||||
include src/local.mk
|
||||
include tests/local.mk
|
||||
|
||||
clean-local:
|
||||
rm -rf $(CLEANDIRS)
|
||||
|
||||
# See comments in build-aux/git-version-gen. However, we make .version depend
|
||||
# on configure so that .version and VERSION/PACKAGE_VERSION stay in sync in the
|
||||
# working copy (for example, when you run autoreconf && make). Allowing these
|
||||
@@ -73,9 +88,22 @@ include tests/local.mk
|
||||
BUILT_SOURCES += $(top_srcdir)/.version
|
||||
$(top_srcdir)/.version: configure
|
||||
echo $(VERSION) > $@-t && mv $@-t $@
|
||||
dist-hook: gen-ChangeLog
|
||||
dist-hook: gen-ChangeLog gen-synclines
|
||||
echo $(VERSION) > $(distdir)/.tarball-version
|
||||
|
||||
# When generating a release, include the #lines in Bison's parser. Do it
|
||||
# only if needed. In particular, distcheck runs dist with read-only
|
||||
# sources, so don't try to update src/parse-gram.c: we don't have the
|
||||
# permissions.
|
||||
.PHONY: gen-synclines
|
||||
gen-synclines:
|
||||
cd $(distdir) && \
|
||||
if ! grep '#line' src/parse-gram.c >/dev/null 2>&1; then \
|
||||
$(abs_top_builddir)/tests/bison \
|
||||
$(AM_YFLAGS_WITH_LINES) src/parse-gram.y \
|
||||
-o src/parse-gram.c; \
|
||||
fi
|
||||
|
||||
.PHONY: update-b4-copyright update-package-copyright-year
|
||||
update-b4-copyright:
|
||||
$(AM_V_GEN)find $(srcdir)/data -type f \
|
||||
|
||||
@@ -36,7 +36,8 @@ to the bison package.
|
||||
|
||||
-----
|
||||
|
||||
Copyright (C) 2002, 2005, 2009-2013 Free Software Foundation, Inc.
|
||||
Copyright (C) 2002, 2005, 2009-2015, 2018-2019 Free Software Foundation,
|
||||
Inc.
|
||||
|
||||
This file is part of Bison, the GNU Compiler Compiler.
|
||||
|
||||
|
||||
@@ -1,53 +1,74 @@
|
||||
This package contains the GNU Bison parser generator.
|
||||
|
||||
* Installation
|
||||
** Build
|
||||
See the file INSTALL for generic compilation and installation
|
||||
instructions.
|
||||
** Build from git
|
||||
Here are basic installation instructions for a repository checkout:
|
||||
|
||||
$ git submodules update --init
|
||||
$ ./bootstrap
|
||||
|
||||
then proceed with the usual 'configure && make' steps.
|
||||
|
||||
README-hacking contains more information about building and modifying the
|
||||
software.
|
||||
|
||||
** Build for tarball
|
||||
See the file INSTALL for generic compilation and installation instructions.
|
||||
|
||||
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
|
||||
|
||||
** Relocatability
|
||||
If you pass '--enable-relocatable' to 'configure', Bison is relocatable.
|
||||
|
||||
A relocatable program can be moved or copied to a different location on the
|
||||
file system. It can also be used through mount points for network sharing.
|
||||
It is possible to make symlinks to the installed and moved programs, and
|
||||
invoke them through the symlink.
|
||||
|
||||
See "Enabling Relocatability" in the documentation.
|
||||
|
||||
** Internationalization
|
||||
Bison supports two catalogues: one for Bison itself (i.e., for the
|
||||
maintainer-side parser generation), and one for the generated parsers
|
||||
(i.e., for the user-side parser execution). The requirements between
|
||||
both differ: bison needs ngettext, the generated parsers do not. To
|
||||
simplify the build system, neither are installed if ngettext is not
|
||||
supported, even if generated parsers could have been localized. See
|
||||
http://lists.gnu.org/archive/html/bug-bison/2009-08/msg00006.html for
|
||||
more details.
|
||||
Bison supports two catalogs: one for Bison itself (i.e., for the
|
||||
maintainer-side parser generation), and one for the generated parsers (i.e.,
|
||||
for the user-side parser execution). The requirements between both differ:
|
||||
bison needs ngettext, the generated parsers do not. To simplify the build
|
||||
system, neither are installed if ngettext is not supported, even if
|
||||
generated parsers could have been localized. See
|
||||
http://lists.gnu.org/archive/html/bug-bison/2009-08/msg00006.html for more
|
||||
details.
|
||||
|
||||
* Questions
|
||||
See the section FAQ in the documentation (doc/bison.info) for
|
||||
frequently asked questions. The documentation is also available in
|
||||
PDF and HTML, provided you have a recent version of Texinfo installed:
|
||||
run "make pdf" or "make html".
|
||||
See the section FAQ in the documentation (doc/bison.info) for frequently
|
||||
asked questions. The documentation is also available in PDF and HTML,
|
||||
provided you have a recent version of Texinfo installed: run "make pdf" or
|
||||
"make html".
|
||||
|
||||
If you have questions about using Bison and the documentation does
|
||||
not answer them, please send mail to <[email protected]>.
|
||||
If you have questions about using Bison and the documentation does not
|
||||
answer them, please send mail to <[email protected]>.
|
||||
|
||||
* Bug reports
|
||||
Please send bug reports to <[email protected]>. Please include the
|
||||
version number from 'bison --version', and a complete, self-contained
|
||||
test case in each bug report.
|
||||
Please send bug reports to <[email protected]>. Be sure to include the
|
||||
version number from 'bison --version', and a complete, self-contained test
|
||||
case in each bug report.
|
||||
|
||||
* Copyright statements
|
||||
For any copyright year range specified as YYYY-ZZZZ in this package,
|
||||
note that the range specifies every single year in that closed interval.
|
||||
|
||||
|
||||
Local Variables:
|
||||
mode: outline
|
||||
End:
|
||||
For any copyright year range specified as YYYY-ZZZZ in this package, note
|
||||
that the range specifies every single year in that closed interval.
|
||||
|
||||
-----
|
||||
|
||||
Copyright (C) 1992, 1998-1999, 2003-2005, 2008-2013 Free Software
|
||||
Foundation, Inc.
|
||||
Local Variables:
|
||||
mode: outline
|
||||
fill-column: 76
|
||||
ispell-dictionary: "american"
|
||||
End:
|
||||
|
||||
This file is part of Bison, the GNU Compiler Compiler.
|
||||
Copyright (C) 1992, 1998-1999, 2003-2005, 2008-2015, 2018-2019 Free
|
||||
Software Foundation, Inc.
|
||||
|
||||
This file is part of GNU 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
|
||||
@@ -61,3 +82,6 @@ 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: parsers ngettext Texinfo pdf html YYYY ZZZZ ispell american
|
||||
# LocalWords: MERCHANTABILITY
|
||||
|
||||
+2
-1
@@ -12,7 +12,8 @@ the problems you encounter.
|
||||
|
||||
-----
|
||||
|
||||
Copyright (C) 2002, 2004, 2009-2013 Free Software Foundation, Inc.
|
||||
Copyright (C) 2002, 2004, 2009-2015, 2018-2019 Free Software Foundation,
|
||||
Inc.
|
||||
|
||||
This file is part of GNU Bison.
|
||||
|
||||
|
||||
+166
-124
@@ -9,19 +9,19 @@ Everything related to the development of Bison is on Savannah:
|
||||
* Administrivia
|
||||
|
||||
** If you incorporate a change from somebody on the net:
|
||||
First, if it is a large change, you must make sure they have signed
|
||||
the appropriate paperwork. Second, be sure to add their name and
|
||||
email address to THANKS.
|
||||
First, if it is a large change, you must make sure they have signed the
|
||||
appropriate paperwork. Second, be sure to add their name and email address
|
||||
to THANKS.
|
||||
|
||||
** If a change fixes a test, mention the test in the commit message.
|
||||
|
||||
** Bug reports
|
||||
If somebody reports a new bug, mention his name in the commit message
|
||||
and in the test case you write. Put him into THANKS.
|
||||
If somebody reports a new bug, mention his name in the commit message and in
|
||||
the test case you write. Put him into THANKS.
|
||||
|
||||
The correct response to most actual bugs is to write a new test case
|
||||
which demonstrates the bug. Then fix the bug, re-run the test suite,
|
||||
and check everything in.
|
||||
The correct response to most actual bugs is to write a new test case which
|
||||
demonstrates the bug. Then fix the bug, re-run the test suite, and check
|
||||
everything in.
|
||||
|
||||
|
||||
* Hacking
|
||||
@@ -30,17 +30,17 @@ and check everything in.
|
||||
Which include serious bug fixes, must be mentioned in NEWS.
|
||||
|
||||
** Translations
|
||||
Only user visible strings are to be translated: error messages, bits
|
||||
of the .output file etc. This excludes impossible error messages
|
||||
(comparable to assert/abort), and all the --trace output which is
|
||||
meant for the maintainers only.
|
||||
Only user visible strings are to be translated: error messages, bits of the
|
||||
.output file etc. This excludes impossible error messages (comparable to
|
||||
assert/abort), and all the --trace output which is meant for the maintainers
|
||||
only.
|
||||
|
||||
** Horizontal tabs
|
||||
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.
|
||||
However, make files, ChangeLog, and some regular expressions require
|
||||
tabs. Also, test cases might need to contain tabs to check that Bison
|
||||
properly processes tabs in its input.
|
||||
However, make files, ChangeLog, and some regular expressions require tabs.
|
||||
Also, test cases might need to contain tabs to check that Bison properly
|
||||
processes tabs in its input.
|
||||
|
||||
|
||||
* Working from the repository
|
||||
@@ -62,13 +62,22 @@ tools we depend upon, including:
|
||||
- Gettext <http://www.gnu.org/software/gettext/>
|
||||
- Graphviz <http://www.graphviz.org>
|
||||
- Gzip <http://www.gnu.org/software/gzip/>
|
||||
- Help2man <http://www.gnu.org/software/help2man/>
|
||||
- Perl <http://www.cpan.org/>
|
||||
- Rsync <http://samba.anu.edu.au/rsync/>
|
||||
- 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
|
||||
your architecture.
|
||||
|
||||
If you're using a GNU/Linux distribution, the easiest way to install the
|
||||
above packages depends on your system. The following shell command should
|
||||
work for Debian-based systems such as Ubuntu:
|
||||
|
||||
sudo apt-get install \
|
||||
autoconf automake autopoint flex graphviz help2man texinfo valgrind
|
||||
|
||||
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
|
||||
@@ -82,34 +91,39 @@ might be needed.
|
||||
|
||||
** First checkout
|
||||
|
||||
Obviously, if you are reading these notes, you did manage to check out
|
||||
this package from the repository. For the record, you will find all the
|
||||
relevant information on:
|
||||
Obviously, if you are reading these notes, you did manage to check out this
|
||||
package from the repository. For the record, you will find all the relevant
|
||||
information on:
|
||||
|
||||
http://savannah.gnu.org/git/?group=bison
|
||||
|
||||
Bison uses Git submodules: subscriptions to other Git repositories.
|
||||
In particular it uses gnulib, the GNU portability library. To ask Git
|
||||
to perform the first checkout of the submodules, run
|
||||
Bison uses Git submodules: subscriptions to other Git repositories. In
|
||||
particular it uses gnulib, the GNU portability library. To ask Git 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
|
||||
extracted from other source packages:
|
||||
The next step is to get other files needed to build, which are extracted
|
||||
from other source packages:
|
||||
|
||||
$ ./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. To recover from it, run `git reset --hard HEAD`, and
|
||||
restart with the submodule initialization. Otherwise, there you are! Just
|
||||
|
||||
$ ./configure
|
||||
$ make
|
||||
$ make check
|
||||
|
||||
At this point, there should be no difference between your local copy,
|
||||
and the master copy:
|
||||
At this point, there should be no difference between your local copy, and
|
||||
the master copy:
|
||||
|
||||
$ git diff
|
||||
|
||||
@@ -119,20 +133,25 @@ Enjoy!
|
||||
|
||||
** Updating
|
||||
|
||||
The use of submodules make things somewhat different because git does
|
||||
not support recursive operations: submodules must be taken care of
|
||||
explicitly by the user.
|
||||
If you have git at version 1.8.2 or later, the command
|
||||
|
||||
$ git submodule update --recursive --remote
|
||||
|
||||
will be useful for updating to the latest version of all submodules.
|
||||
|
||||
Under earlier versions, use of submodules make things somewhat different
|
||||
because git does not yet support recursive operations: submodules must be
|
||||
taken care of explicitly.
|
||||
|
||||
*** Updating Bison
|
||||
|
||||
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
|
||||
reveal if the current version of the submodule (i.e., the actual
|
||||
contents of the gnulib directory) and the current request from the
|
||||
subscriber (i.e., the reference of the version of gnulib that the
|
||||
Bison repository requests) differ. To upgrade the submodules (i.e.,
|
||||
to check out the version that is actually requested by the subscriber,
|
||||
run "git submodule update".
|
||||
import requests for updated submodules. A simple "git diff" will reveal if
|
||||
the current version of the submodule (i.e., the actual contents of the
|
||||
gnulib directory) and the current request from the subscriber (i.e., the
|
||||
reference of the version of gnulib that the Bison repository requests)
|
||||
differ. To upgrade the submodules (i.e., to check out the version that is
|
||||
actually requested by the subscriber, run "git submodule update".
|
||||
|
||||
$ git pull
|
||||
$ git submodule update
|
||||
@@ -156,8 +175,8 @@ Register your changes.
|
||||
|
||||
$ git checkin ...
|
||||
|
||||
For a suggestion of what gnulib commit might be stable enough for a
|
||||
formal release, see the ChangeLog in the latest gnulib snapshot at:
|
||||
For a suggestion of what gnulib commit might be stable enough for a formal
|
||||
release, see the ChangeLog in the latest gnulib snapshot at:
|
||||
|
||||
http://erislabs.net/ianb/projects/gnulib/
|
||||
|
||||
@@ -167,23 +186,31 @@ The Autoconf files we use are currently:
|
||||
lib/m4sugar/m4sugar.m4
|
||||
lib/m4sugar/foreach.m4
|
||||
|
||||
These files don't change very often in Autoconf, so it should be
|
||||
relatively straight-forward to examine the differences in order to
|
||||
decide whether to update.
|
||||
These files don't change very often in Autoconf, so it should be relatively
|
||||
straight-forward to examine the differences in order to decide whether to
|
||||
update.
|
||||
|
||||
* Test suite
|
||||
|
||||
** make check
|
||||
Use liberally.
|
||||
|
||||
** Updating the expectations
|
||||
Sometimes some changes have a large impact on the test suite (e.g., when we
|
||||
added the "[-Wother]" part to all the warnings). Part of the update can be
|
||||
done with a crude tool: tests/update-test. Read it for more information.
|
||||
|
||||
** 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:
|
||||
To run just the testsuite (not the tests related to the examples), run `make
|
||||
check-local`.
|
||||
|
||||
The default is for make check-local to run all tests sequentially. This can
|
||||
be very time consuming 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'
|
||||
$ make check-local TESTSUITEFLAGS='-j8'
|
||||
|
||||
Running only the tests of a certain category, as specified in the AT files
|
||||
with AT_KEYWORDS([[category]]). Categories include:
|
||||
@@ -194,7 +221,7 @@ with AT_KEYWORDS([[category]]). Categories include:
|
||||
- report, for automaton dumps
|
||||
|
||||
To run a specific set of tests, use -k (for "keyword"). For example:
|
||||
$ make check TESTSUITEFLAGS='-k c++'
|
||||
$ make check-local TESTSUITEFLAGS='-k c++'
|
||||
|
||||
Both can be combined.
|
||||
|
||||
@@ -232,102 +259,114 @@ 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
|
||||
release:
|
||||
|
||||
- Configure the package with --enable-gcc-warnings, so that one checks
|
||||
that 1. Bison compiles cleanly, 2. the parsers it produces compile
|
||||
cleanly too.
|
||||
- Configure the package with --enable-gcc-warnings, so that one checks that
|
||||
1. Bison compiles cleanly, 2. the parsers it produces compile cleanly too.
|
||||
|
||||
- Maybe build with -DGNULIB_POSIXCHECK, which suggests gnulib modules
|
||||
that can fix portability issues. See if you really want to pay
|
||||
attention to its warnings; there's no need to obey blindly to it
|
||||
- Maybe build with -DGNULIB_POSIXCHECK, which suggests gnulib modules that
|
||||
can fix portability issues. See if you really want to pay attention to
|
||||
its warnings; there's no need to obey blindly to it
|
||||
(<http://lists.gnu.org/archive/html/bison-patches/2012-05/msg00057.html>).
|
||||
|
||||
- Check with "make syntax-check" if there are issues diagnosed by
|
||||
gnulib.
|
||||
- Check with "make syntax-check" if there are issues diagnosed by gnulib.
|
||||
|
||||
- run "make maintainer-check" which:
|
||||
- runs "valgrind -q bison" to run Bison under Valgrind.
|
||||
- runs the parsers under Valgrind.
|
||||
- runs the test suite with G++ as C compiler...
|
||||
|
||||
- run "make maintainer-push-check", which runs "make maintainer-check"
|
||||
while activating the push implementation and its pull interface wrappers
|
||||
in many test cases that were originally written to exercise only the
|
||||
pull implementation. This makes certain the push implementation can
|
||||
perform every task the pull implementation can.
|
||||
- run "make maintainer-check-push", which runs "make maintainer-check" while
|
||||
activating the push implementation and its pull interface wrappers in many
|
||||
test cases that were originally written to exercise only the pull
|
||||
implementation. This makes certain the push implementation can perform
|
||||
every task the pull implementation can.
|
||||
|
||||
- run "make maintainer-xml-check", which runs "make maintainer-check"
|
||||
while checking Bison's XML automaton report for every working grammar
|
||||
passed to Bison in the test suite. The check just diffs the output of
|
||||
Bison's included XSLT style sheets with the output of --report=all and
|
||||
--graph.
|
||||
- run "make maintainer-check-xml", which runs "make maintainer-check" while
|
||||
checking Bison's XML automaton report for every working grammar passed to
|
||||
Bison in the test suite. The check just diffs the output of Bison's
|
||||
included XSLT style sheets with the output of --report=all and --graph.
|
||||
|
||||
- running "make maintainer-release-check" takes care of running
|
||||
maintainer-check, maintainer-push-check and maintainer-xml-check.
|
||||
- running "make maintainer-check-release" takes care of running
|
||||
maintainer-check, maintainer-check-push and maintainer-check-xml.
|
||||
|
||||
- Change tests/atlocal/CFLAGS to add your preferred options. For
|
||||
instance, "-traditional" to check that the parsers are K&R. Note
|
||||
that it does not make sense for glr.c, which should be ANSI, but
|
||||
currently is actually GNU C, nor for lalr1.cc.
|
||||
- Change tests/atlocal/CFLAGS to add your preferred options.
|
||||
|
||||
- Test with a very recent version of GCC for both C and C++. Testing
|
||||
with older versions that are still in use is nice too.
|
||||
- Test with a very recent version of GCC for both C and C++. Testing with
|
||||
older versions that are still in use is nice too.
|
||||
|
||||
** gnulib
|
||||
To run tests on gnulib components (e.g., on bitset):
|
||||
|
||||
cd gnulib
|
||||
./gnulib-tool --test bitset-tests
|
||||
|
||||
possibly within a specified environment:
|
||||
|
||||
CC='gcc-mp-8 -fsanitize=undefined' ./gnulib-tool --test bitset-tests
|
||||
|
||||
To be able to run the tests several times, and to use symlinks instead of
|
||||
copies so that one can update the origin gnulib directory and immediately
|
||||
re-run the tests, run:
|
||||
|
||||
./gnulib-tool --symlink --create-test --dir=/tmp/gnutest bitset-tests
|
||||
cd /tmp/gnutest
|
||||
./configure CC='gcc-mp-8 -fsanitize=undefined'
|
||||
make check
|
||||
|
||||
* Release Procedure
|
||||
This section needs to be updated to take into account features from
|
||||
gnulib. In particular, be sure to read README-release.
|
||||
This section needs to be updated to take into account features from gnulib.
|
||||
In particular, be sure to read README-release.
|
||||
|
||||
** Update the submodules. See above.
|
||||
|
||||
** Update maintainer tools, such as Autoconf. See above.
|
||||
|
||||
** 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.
|
||||
Before generating the *.pot files, make sure that po/POTFILES.in and
|
||||
runtime-po/POTFILES.in list all files with translatable strings.
|
||||
This helps: grep -l '\<_(' *
|
||||
week before a stable release, to give them time to translate them. Before
|
||||
generating the *.pot files, make sure that po/POTFILES.in and
|
||||
runtime-po/POTFILES.in list all files with translatable strings. This
|
||||
helps: grep -l '\<_(' *.
|
||||
|
||||
** Tests
|
||||
See above.
|
||||
|
||||
** Update the foreign files
|
||||
Running "./bootstrap" in the top level should update them all for you.
|
||||
This covers PO files too. Sometimes a PO file contains problems that
|
||||
causes it to be rejected by recent Gettext releases; please report
|
||||
these to the Translation Project.
|
||||
Running "./bootstrap" in the top level should update them all for you. This
|
||||
covers PO files too. Sometimes a PO file contains problems that causes it
|
||||
to be rejected by recent Gettext releases; please report these to the
|
||||
Translation Project.
|
||||
|
||||
** Update README
|
||||
Make sure the information in README is current. Most notably, make sure
|
||||
it recommends a version of GNU M4 that is compatible with the latest
|
||||
Bison sources.
|
||||
Make sure the information in README is current. Most notably, make sure it
|
||||
recommends a version of GNU M4 that is compatible with the latest Bison
|
||||
sources.
|
||||
|
||||
** Check copyright years.
|
||||
We update years in copyright statements throughout Bison once at the
|
||||
start of every year by running "make update-copyright". However, before
|
||||
a release, it's good to verify that it's actually been run. Besides the
|
||||
copyright statement for each Bison file, check the copyright statements
|
||||
that the skeletons insert into generated parsers, and check all
|
||||
occurrences of PACKAGE_COPYRIGHT_YEAR in configure.ac.
|
||||
We update years in copyright statements throughout Bison once at the start
|
||||
of every year by running "make update-copyright". However, before a
|
||||
release, it's good to verify that it's actually been run. Besides the
|
||||
copyright statement for each Bison file, check the copyright statements that
|
||||
the skeletons insert into generated parsers, and check all occurrences of
|
||||
PACKAGE_COPYRIGHT_YEAR in configure.ac.
|
||||
|
||||
** Update NEWS, commit and tag.
|
||||
See do-release-commit-and-tag in README-release. For a while, we used
|
||||
beta names such as "2.6_rc1". Now that we use gnulib in the release
|
||||
procedure, we must use "2.5.90", which has the additional benefit of
|
||||
being properly sorted in "git tag -l".
|
||||
See do-release-commit-and-tag in README-release. For a while, we used beta
|
||||
names such as "2.6_rc1". Now that we use gnulib in the release procedure,
|
||||
we must use "2.5.90", which has the additional benefit of being properly
|
||||
sorted in "git tag -l".
|
||||
|
||||
** make alpha, beta, or stable
|
||||
See README-release.
|
||||
|
||||
** Upload
|
||||
There are two ways to upload the tarballs to the GNU servers: using
|
||||
gnupload (from gnulib), or by hand. Obviously prefer the former. But
|
||||
in either case, be sure to read the following paragraph.
|
||||
There are two ways to upload the tarballs to the GNU servers: using gnupload
|
||||
(from gnulib), or by hand. Obviously prefer the former. But in either
|
||||
case, be sure to read the following paragraph.
|
||||
|
||||
*** Setup
|
||||
You need "gnupg".
|
||||
|
||||
Make sure your public key has been uploaded at least to
|
||||
keys.gnupg.net. You can upload it with:
|
||||
Make sure your public key has been uploaded at least to keys.gnupg.net. You
|
||||
can upload it with:
|
||||
|
||||
gpg --keyserver keys.gnupg.net --send-keys F125BDF3
|
||||
|
||||
@@ -336,8 +375,8 @@ where F125BDF3 should be replaced with your key ID.
|
||||
*** Using gnupload
|
||||
You need "ncftp".
|
||||
|
||||
At the end "make stable" (or alpha/beta) will display the procedure to
|
||||
run. Just copy and paste it in your shell.
|
||||
At the end "make stable" (or alpha/beta) will display the procedure to run.
|
||||
Just copy and paste it in your shell.
|
||||
|
||||
*** By hand
|
||||
|
||||
@@ -368,6 +407,13 @@ Here's a brief reminder of how to roll the tarballs and upload them:
|
||||
|
||||
** Update Bison manual on www.gnu.org.
|
||||
|
||||
The instructions below are obsolete, and left in case one would like to run
|
||||
the commands by hand. Today, one just needs to run
|
||||
|
||||
$ make web-manual-update
|
||||
|
||||
See README-release.
|
||||
|
||||
*** You need a non-anonymous checkout of the web pages directory.
|
||||
|
||||
$ cvs -d [email protected]:/web/bison checkout bison
|
||||
@@ -399,16 +445,12 @@ sections that have been removed or renamed):
|
||||
$ ls -lt
|
||||
|
||||
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
|
||||
hyperlinks to the removed files will redirect to the entire manual; this
|
||||
is better than a 404 error.
|
||||
|
||||
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
|
||||
issue.
|
||||
files, add a line to the file .symlinks. This will ensure that hyperlinks
|
||||
to the removed files will redirect to the entire manual; this is better than
|
||||
a 404 error.
|
||||
|
||||
** Announce
|
||||
The "make stable" (or alpha/beta) command just created a template,
|
||||
The "make release" command just created a template,
|
||||
$HOME/announce-bison-X.Y. Otherwise, to generate it, run:
|
||||
|
||||
make RELEASE_TYPE=alpha gpg_key_ID=F125BDF3 announcement
|
||||
@@ -420,19 +462,18 @@ Complete/fix the announcement file. The generated list of recipients
|
||||
([email protected], [email protected], [email protected],
|
||||
[email protected], and [email protected]) is
|
||||
appropriate for a stable release or a "serious beta". For any other
|
||||
release, drop at least [email protected]. For an example of how to
|
||||
fill out the rest of the template, search the mailing list archives
|
||||
for the most recent release announcement.
|
||||
release, drop at least [email protected]. For an example of how to fill out
|
||||
the rest of the template, search the mailing list archives for the most
|
||||
recent release announcement.
|
||||
|
||||
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
|
||||
the moderator will throw away anything cross-posted or Cc'ed. It really
|
||||
needs to be a separate message.
|
||||
newsgroup by sending email to [email protected]. Do not make any Cc as the
|
||||
moderator will throw away anything cross-posted or Cc'ed. It really needs
|
||||
to be a separate message.
|
||||
|
||||
** Prepare NEWS
|
||||
So that developers don't accidentally add new items to the old NEWS
|
||||
entry, create a new empty entry in line 3 (without the two leading
|
||||
spaces):
|
||||
So that developers don't accidentally add new items to the old NEWS entry,
|
||||
create a new empty entry in line 3 (without the two leading spaces):
|
||||
|
||||
* Noteworthy changes in release ?.? (????-??-??) [?]
|
||||
|
||||
@@ -440,7 +481,8 @@ Push these changes.
|
||||
|
||||
-----
|
||||
|
||||
Copyright (C) 2002-2005, 2007-2013 Free Software Foundation, Inc.
|
||||
Copyright (C) 2002-2005, 2007-2015, 2018-2019 Free Software Foundation,
|
||||
Inc.
|
||||
|
||||
This file is part of GNU Bison.
|
||||
|
||||
|
||||
-33
@@ -1,33 +0,0 @@
|
||||
From phr Tue Jul 8 10:36:19 1986
|
||||
Date: Tue, 8 Jul 86 00:52:24 EDT
|
||||
From: phr (Paul Rubin)
|
||||
To: riferguson%[email protected], tower
|
||||
Subject: Re: Bison documentation?
|
||||
|
||||
The main difference between Bison and Yacc that I know of is that
|
||||
Bison supports the @N construction, which gives you access to
|
||||
the starting and ending line number and character number associated
|
||||
with any of the symbols in the current rule.
|
||||
|
||||
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
|
||||
conflicts.
|
||||
|
||||
The differences in the algorithms stem mainly from the horrible
|
||||
kludges that Johnson had to perpetrate to make Yacc fit in a PDP-11.
|
||||
|
||||
Also, Bison uses a faster but less space-efficient encoding for the
|
||||
parse tables (see Corbett's PhD thesis from Berkeley, "Static
|
||||
Semantics in Compiler Error Recovery", June 1985, Report No. UCB/CSD
|
||||
85/251), and more modern technique for generating the lookahead sets.
|
||||
(See Frank DeRemer and Thomas Pennello, "Efficient Computation of
|
||||
LALR(1) Look-Ahead Sets", ACM Transactions on Programming Languages
|
||||
and Systems (TOPLAS) 4, 4 (October 1982), 615-649. Their
|
||||
technique is the standard one now.)
|
||||
|
||||
paul rubin
|
||||
free software foundation
|
||||
|
||||
|
||||
[DeRemer-Pennello reference corrected by Paul Eggert <[email protected]>,
|
||||
2004-06-21.]
|
||||
@@ -1,39 +1,55 @@
|
||||
Bison was originally written by Robert Corbett. It would not be what
|
||||
it is today without the invaluable help of these people:
|
||||
|
||||
Аскар Сафин [email protected]
|
||||
Aaro Koskinen [email protected]
|
||||
Аскар Сафин [email protected]
|
||||
Adam Sampson [email protected]
|
||||
Airy Andre [email protected]
|
||||
Akim Demaille [email protected]
|
||||
Albert Chin-A-Young [email protected]
|
||||
Alexander Belopolsky [email protected]
|
||||
Alexandre Duret-Lutz [email protected]
|
||||
Andre da Costa Barros [email protected]
|
||||
Andreas Schwab [email protected]
|
||||
Andrew Suffield [email protected]
|
||||
Angelo Borsotti [email protected]
|
||||
Anthony Heading [email protected]
|
||||
Antonio Silva Correia [email protected]
|
||||
Arnold Robbins [email protected]
|
||||
Art Haas [email protected]
|
||||
Askar Safin [email protected]
|
||||
Balázs Scheidler [email protected]
|
||||
Baron Schwartz [email protected]
|
||||
Ben Pfaff [email protected]
|
||||
Benoit Perrot [email protected]
|
||||
Bernd Edlinger [email protected]
|
||||
Bernd Kiefer [email protected]
|
||||
Bert Deknuydt [email protected]
|
||||
Bill Allombert [email protected]
|
||||
Bob Rossi [email protected]
|
||||
Brandon Lucia [email protected]
|
||||
Brooks Moses [email protected]
|
||||
Bruce Lilly [email protected]
|
||||
Bruno Haible [email protected]
|
||||
Charles-Henri de Boysson [email protected]
|
||||
Christian Burger [email protected]
|
||||
Clément Démoulins [email protected]
|
||||
Colin Daley [email protected]
|
||||
Cris Bailiff [email protected]
|
||||
Cris van Pelt [email protected]
|
||||
Csaba Raduly [email protected]
|
||||
Dagobert Michelsen [email protected]
|
||||
Daniel Frużyński [email protected]
|
||||
Daniel Galloway [email protected]
|
||||
Daniel Hagerty [email protected]
|
||||
David Barto [email protected]
|
||||
David J. MacKenzie [email protected]
|
||||
David Kastrup [email protected]
|
||||
David Michael [email protected]
|
||||
Dengke Du [email protected]
|
||||
Denis Excoffier [email protected]
|
||||
Dennis Clarke [email protected]
|
||||
Derek Clegg [email protected]
|
||||
Derek M. Jones [email protected]
|
||||
Di-an Jan [email protected]
|
||||
Dick Streefland [email protected]
|
||||
@@ -41,31 +57,42 @@ Didier Godefroy [email protected]
|
||||
Efi Fogel [email protected]
|
||||
Enrico Scholz [email protected]
|
||||
Eric Blake [email protected]
|
||||
Eric S. Raymond [email protected]
|
||||
Étienne Renault [email protected]
|
||||
Evgeny Stambulchik [email protected]
|
||||
Fabrice Bauzac [email protected]
|
||||
Ferdinand Thiessen [email protected]
|
||||
Florian Krohm [email protected]
|
||||
Frank Heckenbach [email protected]
|
||||
Frans Englich [email protected]
|
||||
Gabriel Rassoul [email protected]
|
||||
Gary L Peskin [email protected]
|
||||
Gavin Smith [email protected]
|
||||
Georg Sauthoff [email protected]
|
||||
George Neuner [email protected]
|
||||
Gilles Espinasse [email protected]
|
||||
Goran Uddeborg [email protected]
|
||||
Guido Trentalancia [email protected]
|
||||
H. Merijn Brand [email protected]
|
||||
Hans Aberg haberg@matematik.su.se
|
||||
Hans Åberg haberg[email protected]
|
||||
Horst Von Brand [email protected]
|
||||
Jan Nieuwenhuizen [email protected]
|
||||
Jannick [email protected]
|
||||
Jerry Quinn [email protected]
|
||||
Jesse Thilo [email protected]
|
||||
Jim Kent [email protected]
|
||||
Jim Meyering [email protected]
|
||||
Joel E. Denny [email protected]
|
||||
Johan van Selst [email protected]
|
||||
John Horigan [email protected]
|
||||
Jonathan Fabrizio [email protected]
|
||||
Jonathan Nieder [email protected]
|
||||
Josh Soref [email protected]
|
||||
Juan Manuel Guerrero [email protected]
|
||||
Kees Zeelenberg [email protected]
|
||||
Keith Browne [email protected]
|
||||
Ken Moffat [email protected]
|
||||
Kiyoshi Kanazawa [email protected]
|
||||
Laurent Mascherpa [email protected]
|
||||
Lie Yan [email protected]
|
||||
Magnus Fromreide [email protected]
|
||||
@@ -77,22 +104,33 @@ Martin Mokrejs [email protected]
|
||||
Martin Nylin [email protected]
|
||||
Matt Kraai [email protected]
|
||||
Matt Rosing [email protected]
|
||||
Maxim Prohorenko [email protected]
|
||||
Michael Catanzaro [email protected]
|
||||
Michael Felt [email protected]
|
||||
Michael Hayes [email protected]
|
||||
Michael Raskin [email protected]
|
||||
Michel d'Hooge [email protected]
|
||||
Michiel De Wilde [email protected]
|
||||
Mickael Labau [email protected]
|
||||
Mike Castle [email protected]
|
||||
Mike Frysinger [email protected]
|
||||
Mike Sullivan [email protected]
|
||||
Nate Guerin [email protected]
|
||||
Neil Booth [email protected]
|
||||
Nelson H. F. Beebe [email protected]
|
||||
Nick Bowler [email protected]
|
||||
Nicolas Bedon [email protected]
|
||||
Nicolas Burrus [email protected]
|
||||
Nicolas Tisserand [email protected]
|
||||
Noah Friedman [email protected]
|
||||
Odd Arild Olsen [email protected]
|
||||
Oleg Smolsky [email protected]
|
||||
Oleksii Taran [email protected]
|
||||
Oliver Mangold [email protected]
|
||||
Paolo Bonzini [email protected]
|
||||
Paolo Simone Gasparello [email protected]
|
||||
Pascal Bart [email protected]
|
||||
Patrice Dumas [email protected]
|
||||
Paul Eggert [email protected]
|
||||
Paul Hilfinger [email protected]
|
||||
Per Allansson [email protected]
|
||||
@@ -101,46 +139,63 @@ Peter Fales [email protected]
|
||||
Peter Hamorsky [email protected]
|
||||
Peter Simons [email protected]
|
||||
Petr Machata [email protected]
|
||||
Pho [email protected]
|
||||
Piotr Gackiewicz [email protected]
|
||||
Piotr Marcińczyk [email protected]
|
||||
Quentin Hocquet [email protected]
|
||||
Quoc Peyrot [email protected]
|
||||
R Blake [email protected]
|
||||
Raja R Harinath [email protected]
|
||||
Ralf Wildenhues [email protected]
|
||||
Rich Wilson [email protected]
|
||||
Richard Stallman [email protected]
|
||||
Rici Lake [email protected]
|
||||
Rob Conde [email protected]
|
||||
Rob Vermaas [email protected]
|
||||
Robert Anisko [email protected]
|
||||
Rob Conde rob.conde@ai-solutions.com
|
||||
Robert Yang liezhi.yang@windriver.com
|
||||
Roland Levillain [email protected]
|
||||
Satya Kiran Popuri [email protected]
|
||||
Sebastian Setzer [email protected]
|
||||
Sebastien Fricker [email protected]
|
||||
Sébastien Villemot [email protected]
|
||||
Sergei Steshenko [email protected]
|
||||
Shura [email protected]
|
||||
Simon Sobisch [email protected]
|
||||
Stefano Lattarini [email protected]
|
||||
Stephen Cameron [email protected]
|
||||
Steve Murphy [email protected]
|
||||
Sum Wu [email protected]
|
||||
Théophile Ranquet [email protected]
|
||||
Thiru Ramakrishnan [email protected]
|
||||
Thomas Jahns [email protected]
|
||||
Tim Josling [email protected]
|
||||
Tim Landscheidt [email protected]
|
||||
Tim Van Holder [email protected]
|
||||
Tobias Frost [email protected]
|
||||
Todd Freed [email protected]
|
||||
Tom Lane [email protected]
|
||||
Tom Tromey [email protected]
|
||||
Tommy Nordgren [email protected]
|
||||
Troy A. Johnson [email protected]
|
||||
Tys Lefering [email protected]
|
||||
Uxio Prego [email protected]
|
||||
Valentin Tolmer [email protected]
|
||||
wcventure [email protected]
|
||||
Victor Khomenko [email protected]
|
||||
Victor Zverovich [email protected]
|
||||
Vin Shelton [email protected]
|
||||
W.C.A. Wijngaards [email protected]
|
||||
Wayne Green [email protected]
|
||||
Wei Song [email protected]
|
||||
Wojciech Polak [email protected]
|
||||
Wolfgang S. Kechel [email protected]
|
||||
Wolfgang Thaller [email protected]
|
||||
Wolfram Wagner [email protected]
|
||||
Wwp [email protected]
|
||||
xolodho [email protected]
|
||||
Zack Weinberg [email protected]
|
||||
長田偉伸 [email protected]
|
||||
|
||||
Many people are not named here because we lost track of them. We
|
||||
thank them! Please, help us keeping this list up to date.
|
||||
@@ -152,7 +207,7 @@ End:
|
||||
|
||||
-----
|
||||
|
||||
Copyright (C) 2000-2013 Free Software Foundation, Inc.
|
||||
Copyright (C) 2000-2015, 2018-2019 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of Bison, the GNU Parser Generator.
|
||||
|
||||
|
||||
@@ -1,4 +1,159 @@
|
||||
* Bison 3.4
|
||||
** bad diagnostics
|
||||
%token <val> NUM
|
||||
%type <val> expr term fact
|
||||
|
||||
%%
|
||||
|
||||
res: expr { printf ("%d\n", $1); };
|
||||
expr: expr '+' term { $$ = $1 + $3; } | term;
|
||||
term: NUM | { $$ = 0; };
|
||||
|
||||
The second warning about fact is... useless.
|
||||
|
||||
$ bison /tmp/bar.y
|
||||
/tmp/bar.y:2.24-27: warning: symbol fact is used, but is not defined as a token and has no rules [-Wother]
|
||||
%type <val> expr term fact
|
||||
^~~~
|
||||
/tmp/bar.y: warning: 1 nonterminal useless in grammar [-Wother]
|
||||
/tmp/bar.y:2.24-27: warning: nonterminal useless in grammar: fact [-Wother]
|
||||
%type <val> expr term fact
|
||||
^~~~
|
||||
|
||||
* Bison 3.5
|
||||
** doc
|
||||
I feel its ugly to use the GNU style to declare functions in the doc. It
|
||||
generates tons of white space in the page, and may contribute to bad page
|
||||
breaks.
|
||||
|
||||
Also, we seem to teach YYPRINT very early on, although it should be
|
||||
considered deprecated: %printer is superior.
|
||||
|
||||
** glr.cc
|
||||
move glr.c into the yy namespace
|
||||
|
||||
** improve syntax errors (UTF-8, internationalization)
|
||||
Bison depends on the current locale. For instance:
|
||||
|
||||
%define parse.error verbose
|
||||
%code top {
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
void yyerror(const char* msg) { fprintf(stderr, "%s\n", msg); }
|
||||
int yylex() { return 0; }
|
||||
}
|
||||
%%
|
||||
exp: "↦" | "🎅🐃" | '\n'
|
||||
%%
|
||||
int main() { return yyparse(); }
|
||||
|
||||
gives different results with/without LC_ALL=C.
|
||||
|
||||
$ LC_ALL=C /opt/local/bin/bison /tmp/mangle.y -o ascii.c
|
||||
$ /opt/local/bin/bison /tmp/mangle.y -o utf8.c
|
||||
$ diff -u ascii.c utf8.c -I#line
|
||||
--- ascii.c 2019-01-12 08:15:35.878010093 +0100
|
||||
+++ utf8.c 2019-01-12 08:15:38.856495929 +0100
|
||||
@@ -415,9 +415,8 @@
|
||||
First, the terminals, then, starting at YYNTOKENS, nonterminals. */
|
||||
static const char *const yytname[] =
|
||||
{
|
||||
- "$end", "error", "$undefined", "\"\\342\\206\\246\"",
|
||||
- "\"\\360\\237\\216\\205\\360\\237\\220\\203\"", "'\\n'", "$accept",
|
||||
- "exp", YY_NULLPTR
|
||||
+ "$end", "error", "$undefined", "\"↦\"", "\"🎅🐃\"", "'\\n'",
|
||||
+ "$accept", "exp", YY_NULLPTR
|
||||
};
|
||||
#endif
|
||||
|
||||
$ gcc ascii.c -o ascii && ./ascii
|
||||
syntax error, unexpected $end, expecting "\342\206\246" or "\360\237\216\205\360\237\220\203" or '\n'
|
||||
$ gcc utf8.c -o utf8 && ./utf8
|
||||
syntax error, unexpected $end, expecting ↦ or 🎅🐃 or '\n'
|
||||
|
||||
|
||||
While at it, we should stop using "$end" by default, in favor of "end of
|
||||
file", or "end of input", whatever.
|
||||
|
||||
* Bison 3.6
|
||||
** Unit rules
|
||||
Maybe we could expand unit rules (or "injections", see
|
||||
https://homepages.cwi.nl/~daybuild/daily-books/syntax/2-sdf/sdf.html), i.e.,
|
||||
transform
|
||||
|
||||
exp: arith | bool;
|
||||
arith: exp '+' exp;
|
||||
bool: exp '&' exp;
|
||||
|
||||
into
|
||||
|
||||
exp: exp '+' exp | exp '&' exp;
|
||||
|
||||
when there are no actions. This can significantly speed up some grammars.
|
||||
I can't find the papers. In particular the book 'LR parsing: Theory and
|
||||
Practice' is impossible to find, but according to 'Parsing Techniques: a
|
||||
Practical Guide', it includes information about this issue. Does anybody
|
||||
have it?
|
||||
|
||||
** Injection rules
|
||||
See above.
|
||||
|
||||
** clean up
|
||||
*** lalr.c
|
||||
Introduce a goto struct, and use it in place of from_state/to_state.
|
||||
Rename states1 as path, length as pathlen.
|
||||
Introduce inline functions for things such as nullable[*rp - ntokens]
|
||||
where we need to map from symbol number to nterm number.
|
||||
|
||||
There are probably a significant part of the relations management that
|
||||
should be migrated on top of a bitsetv.
|
||||
|
||||
*** closure
|
||||
It should probably take a "state*" instead of two arguments.
|
||||
|
||||
*** traces
|
||||
The "automaton" and "set" categories are not so useful. We should probably
|
||||
introduce lr(0) and lalr, just the way we have ielr categories. The
|
||||
"closure" function is too verbose, it should probably have its own category.
|
||||
|
||||
"set" can still be used for summariring the important sets. That would make
|
||||
tests easy to maintain.
|
||||
|
||||
|
||||
|
||||
* Completion
|
||||
Several features are not available in all the backends.
|
||||
|
||||
- push parsers: glr.cc, lalr1.cc
|
||||
- ielr: C++ and Java
|
||||
- glr: Java
|
||||
- token constructors: Java and C
|
||||
|
||||
* Bugs
|
||||
** Autotest has quotation issues
|
||||
tests/input.at:1730:AT_SETUP([%define errors])
|
||||
|
||||
->
|
||||
|
||||
$ ./tests/testsuite -l | grep errors | sed q
|
||||
38: input.at:1730 errors
|
||||
|
||||
* Short term
|
||||
** consistency
|
||||
token vs terminal
|
||||
|
||||
** C++
|
||||
Move to int everywhere instead of unsigned? stack_size, etc. The parser
|
||||
itself uses int (for yylen for instance), yet stack is based on size_t.
|
||||
|
||||
Maybe locations should also move to ints.
|
||||
|
||||
** C
|
||||
Introduce state_type rather than spreading yytype_int16 everywhere?
|
||||
|
||||
** glr.c
|
||||
yyspaceLeft should probably be a pointer diff.
|
||||
|
||||
** Graphviz display code thoughts
|
||||
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
|
||||
@@ -54,11 +209,6 @@ back-ported.
|
||||
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: ...]
|
||||
Possibly as simple as checking whether the column number is nonnegative.
|
||||
|
||||
@@ -82,10 +232,12 @@ class in the printers/destructors, which is not good for an operator<<
|
||||
since it is no longer bound to a particular parser, it's just a
|
||||
(standalone symbol).
|
||||
|
||||
** Rename LR0.cc
|
||||
as lr0.cc, why upper case?
|
||||
|
||||
* Various
|
||||
** Rewrite glr.cc in C++
|
||||
As a matter of fact, it would be very interesting to see how much we can
|
||||
share between lalr1.cc and glr.cc. Most of the skeletons should be common.
|
||||
It would be a very nice source of inspiration for the other languages.
|
||||
|
||||
** YYERRCODE
|
||||
Defined to 256, but not used, not documented. Probably the token
|
||||
number for the error token, which POSIX wants to be 256, but which
|
||||
@@ -112,7 +264,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
|
||||
toknum:
|
||||
|
||||
const unsigned short int
|
||||
const unsigned short
|
||||
parser::yytoken_number_[] =
|
||||
{
|
||||
0, 256, 257, 258, 259, 260, 261, 262, 263, 264,
|
||||
@@ -169,7 +321,7 @@ grammars she is working on. We should probably also include some
|
||||
information about the variables (I'm not sure for instance we even
|
||||
specify what LR variant was used).
|
||||
|
||||
** GLR
|
||||
** GLR
|
||||
How would Paul like to display the conflicted actions? In particular,
|
||||
what when two reductions are possible on a given lookahead token, but one is
|
||||
part of $default. Should we make the two reductions explicit, or just
|
||||
@@ -191,11 +343,37 @@ Provide better assistance for understanding the conflicts by providing
|
||||
a sample text exhibiting the (LALR) ambiguity. See the paper from
|
||||
DeRemer and Penello: they already provide the algorithm.
|
||||
|
||||
** Statically check for potential ambiguities in GLR grammars. See
|
||||
<http://www.i3s.unice.fr/~schmitz/papers.html#expamb> for an approach.
|
||||
|
||||
** Statically check for potential ambiguities in GLR grammars
|
||||
See <http://www.lsv.fr/~schmitz/pub/expamb.pdf> for an approach.
|
||||
An Experimental Ambiguity Detection Tool ∗ Sylvain Schmitz
|
||||
LORIA, INRIA Nancy - Grand Est, Nancy, France
|
||||
|
||||
* Extensions
|
||||
** Multiple start symbols
|
||||
Would be very useful when parsing closely related languages.
|
||||
|
||||
** Better error messages
|
||||
The users are not provided with enough tools to forge their error messages.
|
||||
See for instance "Is there an option to change the message produced by
|
||||
YYERROR_VERBOSE?" by Simon Sobisch, on bison-help.
|
||||
|
||||
See also
|
||||
https://www.cs.tufts.edu/~nr/cs257/archive/clinton-jefferey/lr-error-messages.pdf
|
||||
and https://research.swtch.com/yyerror.
|
||||
|
||||
** %include
|
||||
This is a popular demand. We already made many changes in the parser that
|
||||
should make this reasonably easy to implement.
|
||||
|
||||
Bruce Mardle <[email protected]>
|
||||
https://lists.gnu.org/archive/html/bison-patches/2015-09/msg00000.html
|
||||
|
||||
** Push parsers
|
||||
There is demand for push parsers in Java and C++. And GLR I guess.
|
||||
|
||||
** Generate code instead of tables
|
||||
This is certainly quite a lot of work. See
|
||||
http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.50.4539.
|
||||
|
||||
** $-1
|
||||
We should find a means to provide an access to values deep in the
|
||||
@@ -231,30 +409,9 @@ XML output for GNU Bison and gcc
|
||||
XML output for GNU Bison
|
||||
http://yaxx.sourceforge.net/
|
||||
|
||||
* Unit rules
|
||||
Maybe we could expand unit rules, i.e., transform
|
||||
|
||||
exp: arith | bool;
|
||||
arith: exp '+' exp;
|
||||
bool: exp '&' exp;
|
||||
|
||||
into
|
||||
|
||||
exp: exp '+' exp | exp '&' exp;
|
||||
|
||||
when there are no actions. This can significantly speed up some
|
||||
grammars. I can't find the papers. In particular the book 'LR
|
||||
parsing: Theory and Practice' is impossible to find, but according to
|
||||
'Parsing Techniques: a Practical Guide', it includes information about
|
||||
this issue. Does anybody have it?
|
||||
|
||||
|
||||
|
||||
* Documentation
|
||||
|
||||
** History/Bibliography
|
||||
Some history of Bison and some bibliography would be most welcome.
|
||||
Are there any Texinfo standards for bibliography?
|
||||
** Counterexample generation
|
||||
https://lists.gnu.org/archive/html/bug-bison/2016-06/msg00000.html
|
||||
http://www.cs.cornell.edu/andru/papers/cupex/
|
||||
|
||||
* Coding system independence
|
||||
Paul notes:
|
||||
@@ -285,10 +442,6 @@ It is unfortunate that there is a total order for precedence. It
|
||||
makes it impossible to have modular precedence information. We should
|
||||
move to partial orders (sounds like series/parallel orders to me).
|
||||
|
||||
** RR conflicts
|
||||
See if we can use precedence between rules to solve RR conflicts. See
|
||||
what POSIX says.
|
||||
|
||||
|
||||
* $undefined
|
||||
From Hans:
|
||||
@@ -299,20 +452,6 @@ addition to the $undefined value.
|
||||
Suggest: Change the name $undefined to undefined; looks better in outputs.
|
||||
|
||||
|
||||
* Default Action
|
||||
From Hans:
|
||||
- For use with my C++ parser, I transported the "switch (yyn)" statement
|
||||
that Bison writes to the bison.simple skeleton file. This way, I can remove
|
||||
the current default rule $$ = $1 implementation, which causes a double
|
||||
assignment to $$ which may not be OK under C++, replacing it with a
|
||||
"default:" part within the switch statement.
|
||||
|
||||
Note that the default rule $$ = $1, when typed, is perfectly OK under C,
|
||||
but in the C++ implementation I made, this rule is different from
|
||||
$<type_name>$ = $<type_name>1. I therefore think that one should implement
|
||||
a Bison option where every typed default rule is explicitly written out
|
||||
(same typed ruled can of course be grouped together).
|
||||
|
||||
* Pre and post actions.
|
||||
From: Florian Krohm <[email protected]>
|
||||
Subject: YYACT_EPILOGUE
|
||||
@@ -365,11 +504,13 @@ Here's a proposal for how a new implementation might look:
|
||||
Local Variables:
|
||||
mode: outline
|
||||
coding: utf-8
|
||||
fill-column: 76
|
||||
End:
|
||||
|
||||
-----
|
||||
|
||||
Copyright (C) 2001-2004, 2006, 2008-2013 Free Software Foundation, Inc.
|
||||
Copyright (C) 2001-2004, 2006, 2008-2015, 2018-2019 Free Software
|
||||
Foundation, Inc.
|
||||
|
||||
This file is part of Bison, the GNU Compiler Compiler.
|
||||
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
#! /bin/sh
|
||||
# Print a version string.
|
||||
scriptversion=2013-05-08.20; # UTC
|
||||
scriptversion=2019-01-04.17; # UTC
|
||||
|
||||
# Bootstrap this package from checked-out sources.
|
||||
|
||||
# Copyright (C) 2003-2013 Free Software Foundation, Inc.
|
||||
# Copyright (C) 2003-2019 Free Software Foundation, Inc.
|
||||
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
@@ -17,7 +17,7 @@ scriptversion=2013-05-08.20; # UTC
|
||||
# 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/>.
|
||||
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
# Originally written by Paul Eggert. The canonical version of this
|
||||
# script is maintained as build-aux/bootstrap in gnulib, however, to
|
||||
@@ -42,8 +42,13 @@ export LC_ALL
|
||||
|
||||
local_gl_dir=gl
|
||||
|
||||
# Honor $PERL, but work even if there is none.
|
||||
PERL="${PERL-perl}"
|
||||
|
||||
me=$0
|
||||
|
||||
default_gnulib_url=git://git.sv.gnu.org/gnulib
|
||||
|
||||
usage() {
|
||||
cat <<EOF
|
||||
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
|
||||
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.
|
||||
EOF
|
||||
}
|
||||
@@ -126,19 +162,12 @@ bootstrap_post_import_hook() { :; }
|
||||
# Override it via your own definition in bootstrap.conf.
|
||||
bootstrap_epilogue() { :; }
|
||||
|
||||
# The command to download all .po files for a specified domain into
|
||||
# a specified directory. Fill in the first %s is the domain name, and
|
||||
# the second with the destination directory. Use rsync's -L and -r
|
||||
# options because the latest/%s directory and the .po files within are
|
||||
# all symlinks.
|
||||
# The command to download all .po files for a specified domain into a
|
||||
# specified directory. Fill in the first %s with the destination
|
||||
# directory and the second with the domain name.
|
||||
po_download_command_format=\
|
||||
"rsync --delete --exclude '*.s1' -Lrtvz \
|
||||
'translationproject.org::tp/latest/%s/' '%s'"
|
||||
|
||||
# Fallback for downloading .po files (if rsync fails).
|
||||
po_download_command_format2=\
|
||||
"wget --mirror -nd -q -np -A.po -P '%s' \
|
||||
http://translationproject.org/latest/%s/"
|
||||
"wget --mirror --level=1 -nd -q -A.po -P '%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)
|
||||
@@ -167,7 +196,15 @@ source_base=lib
|
||||
m4_base=m4
|
||||
doc_base=doc
|
||||
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.
|
||||
gnulib_tool_option_extras=
|
||||
@@ -209,12 +246,26 @@ bootstrap_sync=false
|
||||
# Use git to update gnulib sources
|
||||
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...
|
||||
# -------------------------
|
||||
# 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.,
|
||||
# supports --version). If found, set ENVVAR to the program name,
|
||||
# die otherwise.
|
||||
# otherwise find the first of the NAMES that can be run.
|
||||
# If found, set ENVVAR to the program name, die otherwise.
|
||||
#
|
||||
# FIXME: code duplication, see also gnu-web-doc-update.
|
||||
find_tool ()
|
||||
@@ -224,27 +275,21 @@ find_tool ()
|
||||
find_tool_names=$@
|
||||
eval "find_tool_res=\$$find_tool_envvar"
|
||||
if test x"$find_tool_res" = x; then
|
||||
for i
|
||||
do
|
||||
if ($i --version </dev/null) >/dev/null 2>&1; then
|
||||
find_tool_res=$i
|
||||
break
|
||||
for i; do
|
||||
if check_exists $i; then
|
||||
find_tool_res=$i
|
||||
break
|
||||
fi
|
||||
done
|
||||
else
|
||||
find_tool_error_prefix="\$$find_tool_envvar: "
|
||||
fi
|
||||
test x"$find_tool_res" != x \
|
||||
|| die "one of these is required: $find_tool_names"
|
||||
($find_tool_res --version </dev/null) >/dev/null 2>&1 \
|
||||
|| die "${find_tool_error_prefix}cannot run $find_tool_res --version"
|
||||
if test x"$find_tool_res" = x; then
|
||||
warn_ "one of these is required: $find_tool_names;"
|
||||
die "alternatively set $find_tool_envvar to a compatible tool"
|
||||
fi
|
||||
eval "$find_tool_envvar=\$find_tool_res"
|
||||
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.
|
||||
# Make sure that bootstrap.conf is sourced from the current directory
|
||||
# if we were invoked as "sh bootstrap".
|
||||
@@ -253,24 +298,18 @@ case "$0" in
|
||||
*) test -r "$0.conf" && . ./"$0.conf" ;;
|
||||
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
|
||||
vc_ignore=
|
||||
test -d .git && vc_ignore=.gitignore
|
||||
test -d CVS && vc_ignore="$vc_ignore .cvsignore"
|
||||
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.
|
||||
|
||||
# Parse options.
|
||||
@@ -326,7 +365,7 @@ insert_if_absent() {
|
||||
die "Error: Duplicate entries in $file: " $duplicate_entries
|
||||
fi
|
||||
linesold=$(gitignore_entries $file | wc -l)
|
||||
linesnew=$(echo "$str" | gitignore_entries - $file | sort -u | 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"
|
||||
@@ -407,28 +446,30 @@ sort_ver() { # sort -V is not generally available
|
||||
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() {
|
||||
app=$1
|
||||
|
||||
$app --version >/dev/null 2>&1 || return 1
|
||||
$app --version >/dev/null 2>&1 || { $app --version; return 1; }
|
||||
|
||||
$app --version 2>&1 |
|
||||
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'
|
||||
$app --version 2>&1 | sed -n "$get_version_sed"
|
||||
}
|
||||
|
||||
check_versions() {
|
||||
@@ -448,6 +489,7 @@ check_versions() {
|
||||
test "$appvar" = TAR && appvar=AMTAR
|
||||
case $appvar in
|
||||
GZIP) ;; # Do not use $GZIP: it contains gzip options.
|
||||
PERL::*) ;; # Keep perl modules as-is
|
||||
*) eval "app=\${$appvar-$app}" ;;
|
||||
esac
|
||||
|
||||
@@ -465,12 +507,22 @@ check_versions() {
|
||||
ret=1
|
||||
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
|
||||
if [ "$req_ver" = "-" ]; then
|
||||
# Merely require app to exist; not all prereq apps are well-behaved
|
||||
# so we have to rely on $? rather than get_version.
|
||||
$app --version >/dev/null 2>&1
|
||||
if [ 126 -le $? ]; then
|
||||
if ! check_exists --verbose $app; then
|
||||
warn_ "Error: '$app' not found"
|
||||
ret=1
|
||||
fi
|
||||
@@ -503,6 +555,12 @@ print_versions() {
|
||||
# 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
|
||||
# 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,
|
||||
@@ -548,13 +606,21 @@ if ! printf "$buildreq" | check_versions; then
|
||||
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..."
|
||||
|
||||
# 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
|
||||
:
|
||||
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"
|
||||
git config merge.merge-changelog.name 'GNU-style ChangeLog merge driver'
|
||||
git config merge.merge-changelog.driver 'git-merge-changelog %O %A %B'
|
||||
@@ -574,87 +640,101 @@ git_modules_config () {
|
||||
test -f .gitmodules && git config --file .gitmodules "$@"
|
||||
}
|
||||
|
||||
gnulib_path=$(git_modules_config submodule.gnulib.path)
|
||||
test -z "$gnulib_path" && gnulib_path=gnulib
|
||||
|
||||
# Get gnulib files.
|
||||
|
||||
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
|
||||
if $use_gnulib; then
|
||||
if $use_git; then
|
||||
gnulib_path=$(git_modules_config submodule.gnulib.path)
|
||||
test -z "$gnulib_path" && gnulib_path=gnulib
|
||||
fi
|
||||
GNULIB_SRCDIR=$gnulib_path
|
||||
;;
|
||||
*)
|
||||
# Use GNULIB_SRCDIR as a reference.
|
||||
if 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 || 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 && git submodule update \
|
||||
|| exit $?
|
||||
|
||||
# Get gnulib files. Populate $GNULIB_SRCDIR, possibly updating a
|
||||
# submodule, for use in the rest of the script.
|
||||
|
||||
case ${GNULIB_SRCDIR--} in
|
||||
-)
|
||||
# Note that $use_git is necessarily true in this case.
|
||||
if git_modules_config submodule.gnulib.url >/dev/null; then
|
||||
echo "$0: getting gnulib files..."
|
||||
git submodule init -- "$gnulib_path" || exit $?
|
||||
git submodule update -- "$gnulib_path" || exit $?
|
||||
|
||||
elif [ ! -d "$gnulib_path" ]; then
|
||||
echo "$0: getting gnulib files..."
|
||||
|
||||
trap cleanup_gnulib 1 2 13 15
|
||||
|
||||
shallow=
|
||||
if test -z "$GNULIB_REVISION"; then
|
||||
git clone -h 2>&1 | grep -- --depth > /dev/null && shallow='--depth 2'
|
||||
fi
|
||||
git clone $shallow ${GNULIB_URL:-$default_gnulib_url} "$gnulib_path" \
|
||||
|| cleanup_gnulib
|
||||
|
||||
trap - 1 2 13 15
|
||||
fi
|
||||
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
|
||||
;;
|
||||
esac
|
||||
|
||||
if $bootstrap_sync; then
|
||||
cmp -s "$0" "$GNULIB_SRCDIR/build-aux/bootstrap" || {
|
||||
echo "$0: updating bootstrap and restarting..."
|
||||
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
|
||||
}
|
||||
# $GNULIB_SRCDIR now points to the version of gnulib to use, and
|
||||
# we no longer need to use git or $gnulib_path below here.
|
||||
|
||||
if $bootstrap_sync; then
|
||||
cmp -s "$0" "$GNULIB_SRCDIR/build-aux/bootstrap" || {
|
||||
echo "$0: updating bootstrap and restarting..."
|
||||
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
|
||||
|
||||
gnulib_tool=$GNULIB_SRCDIR/gnulib-tool
|
||||
<$gnulib_tool || exit $?
|
||||
|
||||
# Get translations.
|
||||
|
||||
download_po_files() {
|
||||
subdir=$1
|
||||
domain=$2
|
||||
echo "$me: getting translations into $subdir for $domain..."
|
||||
cmd=$(printf "$po_download_command_format" "$domain" "$subdir")
|
||||
eval "$cmd" && return
|
||||
# Fallback to HTTP.
|
||||
cmd=$(printf "$po_download_command_format2" "$subdir" "$domain")
|
||||
cmd=$(printf "$po_download_command_format" "$subdir" "$domain")
|
||||
eval "$cmd"
|
||||
}
|
||||
|
||||
@@ -685,11 +765,10 @@ update_po_files() {
|
||||
cksum_file="$ref_po_dir/$po.s1"
|
||||
if ! test -f "$cksum_file" ||
|
||||
! test -f "$po_dir/$po.po" ||
|
||||
! $SHA1SUM -c --status "$cksum_file" \
|
||||
< "$new_po" > /dev/null; then
|
||||
! $SHA1SUM -c "$cksum_file" < "$new_po" > /dev/null 2>&1; then
|
||||
echo "$me: updated $po_dir/$po.po..."
|
||||
cp "$new_po" "$po_dir/$po.po" \
|
||||
&& $SHA1SUM < "$new_po" > "$cksum_file"
|
||||
&& $SHA1SUM < "$new_po" > "$cksum_file" || return
|
||||
fi
|
||||
done
|
||||
}
|
||||
@@ -745,9 +824,9 @@ symlink_to_dir()
|
||||
# Leave any existing symlink alone, if it already points to the source,
|
||||
# so that broken build tools that care about symlink times
|
||||
# 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
|
||||
# <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" &&
|
||||
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 &&
|
||||
@@ -853,35 +932,47 @@ fi
|
||||
|
||||
# Import from gnulib.
|
||||
|
||||
gnulib_tool_options="\
|
||||
--import\
|
||||
--no-changelog\
|
||||
--aux-dir $build_aux\
|
||||
--doc-base $doc_base\
|
||||
--lib $gnulib_name\
|
||||
--m4-base $m4_base/\
|
||||
--source-base $source_base/\
|
||||
--tests-base $tests_base\
|
||||
--local-dir $local_gl_dir\
|
||||
$gnulib_tool_option_extras\
|
||||
"
|
||||
if test $use_libtool = 1; then
|
||||
case "$gnulib_tool_options " in
|
||||
*' --libtool '*) ;;
|
||||
*) gnulib_tool_options="$gnulib_tool_options --libtool" ;;
|
||||
esac
|
||||
fi
|
||||
echo "$0: $gnulib_tool $gnulib_tool_options --import ..."
|
||||
$gnulib_tool $gnulib_tool_options --import $gnulib_modules &&
|
||||
if $use_gnulib; then
|
||||
gnulib_tool_options="\
|
||||
--no-changelog\
|
||||
--aux-dir=$build_aux\
|
||||
--doc-base=$doc_base\
|
||||
--lib=$gnulib_name\
|
||||
--m4-base=$m4_base/\
|
||||
--source-base=$source_base/\
|
||||
--tests-base=$tests_base\
|
||||
--local-dir=$local_gl_dir\
|
||||
$gnulib_tool_option_extras\
|
||||
"
|
||||
if test $use_libtool = 1; then
|
||||
case "$gnulib_tool_options " in
|
||||
*' --libtool '*) ;;
|
||||
*) gnulib_tool_options="$gnulib_tool_options --libtool" ;;
|
||||
esac
|
||||
fi
|
||||
echo "$0: $gnulib_tool $gnulib_tool_options --import ..."
|
||||
$gnulib_tool $gnulib_tool_options --import $gnulib_modules \
|
||||
|| die "gnulib-tool failed"
|
||||
|
||||
for file in $gnulib_files; do
|
||||
symlink_to_dir "$GNULIB_SRCDIR" $file \
|
||||
|| die "failed to symlink $file"
|
||||
done
|
||||
for file in $gnulib_files; do
|
||||
symlink_to_dir "$GNULIB_SRCDIR" $file \
|
||||
|| die "failed to symlink $file"
|
||||
done
|
||||
fi
|
||||
|
||||
bootstrap_post_import_hook \
|
||||
|| die "bootstrap_post_import_hook failed"
|
||||
|
||||
# Don't proceed if there are uninitialized submodules. In particular,
|
||||
# the next step will remove dangling links, which might be links into
|
||||
# uninitialized submodules.
|
||||
#
|
||||
# Uninitialized submodules are listed with an initial dash.
|
||||
if $use_git && git submodule | grep '^-' >/dev/null; then
|
||||
die "some git submodules are not initialized. " \
|
||||
"Run 'git submodule init' and bootstrap again."
|
||||
fi
|
||||
|
||||
# Remove any dangling symlink matching "*.m4" or "*.[ch]" in some
|
||||
# gnulib-populated directories. Such .m4 files would cause aclocal to fail.
|
||||
# The following requires GNU find 4.2.3 or newer. Considering the usual
|
||||
@@ -974,9 +1065,9 @@ bootstrap_epilogue
|
||||
echo "$0: done. Now you can run './configure'."
|
||||
|
||||
# Local variables:
|
||||
# eval: (add-hook 'write-file-hooks 'time-stamp)
|
||||
# eval: (add-hook 'before-save-hook 'time-stamp)
|
||||
# time-stamp-start: "scriptversion="
|
||||
# time-stamp-format: "%:y-%02m-%02d.%02H"
|
||||
# time-stamp-time-zone: "UTC"
|
||||
# time-stamp-time-zone: "UTC0"
|
||||
# time-stamp-end: "; # UTC"
|
||||
# End:
|
||||
|
||||
+18
-25
@@ -1,6 +1,6 @@
|
||||
# Bootstrap configuration.
|
||||
|
||||
# Copyright (C) 2006-2013 Free Software Foundation, Inc.
|
||||
# Copyright (C) 2006-2015, 2018-2019 Free Software Foundation, Inc.
|
||||
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
@@ -17,14 +17,19 @@
|
||||
|
||||
# gnulib modules used by this package.
|
||||
gnulib_modules='
|
||||
argmatch assert calloc-posix close closeout config-h c-strcase
|
||||
argmatch array-list assert assure
|
||||
bitsetv
|
||||
calloc-posix close closeout config-h c-strcase
|
||||
configmake
|
||||
dirname
|
||||
error extensions fdl fopen-safer
|
||||
getopt-gnu
|
||||
gettext git-version-gen gitlog-to-changelog
|
||||
gettext-h git-version-gen gitlog-to-changelog
|
||||
gpl-3.0 hash inttypes isnan javacomp-script
|
||||
javaexec-script ldexpl malloc-gnu
|
||||
javaexec-script
|
||||
ldexpl
|
||||
libtextstyle-optional
|
||||
malloc-gnu
|
||||
mbswidth
|
||||
non-recursive-gnulib-prefix-hack
|
||||
obstack
|
||||
@@ -33,12 +38,17 @@ gnulib_modules='
|
||||
quote quotearg
|
||||
readme-release
|
||||
realloc-posix
|
||||
spawn-pipe stdbool stpcpy strdup-posix strerror strtoul strverscmp
|
||||
unistd unistd-safer unlocked-io update-copyright unsetenv verify
|
||||
relocatable-prog relocatable-script
|
||||
rename
|
||||
spawn-pipe stdbool stpcpy strdup-posix strerror strverscmp
|
||||
timevar
|
||||
unistd unistd-safer unlink unlocked-io
|
||||
update-copyright unsetenv verify
|
||||
warnings
|
||||
xalloc
|
||||
xalloc-die
|
||||
xconcat-filename
|
||||
xlist
|
||||
xmemdup0
|
||||
xstrndup
|
||||
|
||||
@@ -58,29 +68,12 @@ XGETTEXT_OPTIONS_RUNTIME=$XGETTEXT_OPTIONS'\\\
|
||||
--keyword=YY_ \\\
|
||||
'
|
||||
|
||||
# Gettext supplies these files, but we don't need them since
|
||||
# we don't have an intl subdirectory.
|
||||
excluded_files='
|
||||
m4/glibc2.m4
|
||||
m4/intdiv0.m4
|
||||
m4/intl.m4
|
||||
m4/intldir.m4
|
||||
m4/intmax.m4
|
||||
m4/lcmessage.m4
|
||||
m4/lock.m4
|
||||
m4/longdouble.m4
|
||||
m4/signed.m4
|
||||
m4/uintmax_t.m4
|
||||
m4/ulonglong.m4
|
||||
m4/visibility.m4
|
||||
'
|
||||
|
||||
gnulib_tool_option_extras='--symlink --makefile-name=gnulib.mk'
|
||||
gnulib_tool_option_extras='--symlink --conditional-dependencies --makefile-name=gnulib.mk --po-base=gnulib-po --po-domain=bison'
|
||||
|
||||
bootstrap_post_import_hook()
|
||||
{
|
||||
# Massage lib/gnulib.mk before using it later in the bootstrapping process.
|
||||
build-aux/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.
|
||||
test -f ChangeLog || touch ChangeLog
|
||||
|
||||
@@ -1,6 +1,4 @@
|
||||
/announce-gen
|
||||
/arg-nonnull.h
|
||||
/c++defs.h
|
||||
/compile
|
||||
/config.guess
|
||||
/config.rpath
|
||||
@@ -16,14 +14,17 @@
|
||||
/install-sh
|
||||
/javacomp.sh.in
|
||||
/javaexec.sh.in
|
||||
/link-warning.h
|
||||
/mdate-sh
|
||||
/missing
|
||||
/prefix-gnulib-mk
|
||||
/test-driver
|
||||
/texinfo.tex
|
||||
/update-copyright
|
||||
/useless-if-before-free
|
||||
/vc-list-files
|
||||
/warn-on-use.h
|
||||
/ylwrap
|
||||
/prefix-gnulib-mk
|
||||
/config.libpath
|
||||
/install-reloc
|
||||
/reloc-ldflags
|
||||
/relocatable.sh.in
|
||||
/libtool-reloc
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
# Copyright (C) 2012-2013 Free Software Foundation, Inc.
|
||||
# Copyright (C) 2012-2015, 2018-2019 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
|
||||
@@ -0,0 +1,61 @@
|
||||
# Copyright (C) 2012-2015, 2018-2019 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.
|
||||
|
||||
# Travis Trusty, 2018-09-07.
|
||||
{
|
||||
libstdcxx_init
|
||||
Memcheck:Leak
|
||||
match-leak-kinds: reachable
|
||||
fun:malloc
|
||||
obj:/usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.25
|
||||
fun:call_init.part.0
|
||||
fun:call_init
|
||||
fun:_dl_init
|
||||
obj:/lib/x86_64-linux-gnu/ld-2.19.so
|
||||
}
|
||||
|
||||
# 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
|
||||
}
|
||||
@@ -35,7 +35,7 @@ while (<STDIN>)
|
||||
$arg =~ s/^=//;
|
||||
$arg = lc ($arg);
|
||||
my $dir_arg = $arg;
|
||||
# If the argument is compite (e.g., for --define[=NAME[=VALUE]]),
|
||||
# If the argument is complete (e.g., for --define[=NAME[=VALUE]]),
|
||||
# put each word in @var, to build @var{name}[=@var{value}], not
|
||||
# @var{name[=value]}].
|
||||
$arg =~ s/(\w+)/\@var{$1}/g;
|
||||
@@ -48,7 +48,11 @@ while (<STDIN>)
|
||||
# are strings and have the same syntax as on the command line.
|
||||
if ($dir_arg eq 'name[=value]')
|
||||
{
|
||||
$dir_arg = '@var{name} ["@var{value}"]';
|
||||
# -D/-F do not add quotes to the argument.
|
||||
$dir_arg =
|
||||
$dir eq "%define"
|
||||
? '@var{name} [@var{value}]'
|
||||
: '@var{name} ["@var{value}"]';
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -2,6 +2,9 @@
|
||||
# option. It specifies what changes to make to each given SHA1's commit
|
||||
# log and metadata, using Perl-eval'able expressions.
|
||||
|
||||
975bb564319aa4f4204c48aba265757ba207a80f
|
||||
s/Edligner/Edlinger/;
|
||||
|
||||
0db2648930e3b6c376a539aabe368aade83ee29a
|
||||
s/--flags/--feature/;
|
||||
s/flag_flag/feature_flag/;
|
||||
|
||||
Executable
+234
@@ -0,0 +1,234 @@
|
||||
#!/bin/sh
|
||||
|
||||
# Install Intel Parallel Studio on Travis CI
|
||||
# https://github.com/nemequ/icc-travis
|
||||
#
|
||||
# Originally written for Squash <https://github.com/quixdb/squash> by
|
||||
# Evan Nemerson. For documentation, bug reports, support requests,
|
||||
# etc. please use <https://github.com/nemequ/icc-travis>.
|
||||
#
|
||||
# To the extent possible under law, the author(s) of this script have
|
||||
# waived all copyright and related or neighboring rights to this work.
|
||||
# See <https://creativecommons.org/publicdomain/zero/1.0/> for
|
||||
# details.
|
||||
|
||||
# Tools - Not very useful in non-interactive mode.
|
||||
COMPONENTS_VTUNE="intel-vtune-amplifier-xe-2016-cli__x86_64;intel-vtune-amplifier-xe-2016-common__noarch;intel-vtune-amplifier-xe-2016-cli-common__noarch;intel-vtune-amplifier-xe-2016-collector-64linux__x86_64;intel-vtune-amplifier-xe-2016-sep__noarch;intel-vtune-amplifier-xe-2016-gui-common__noarch;intel-vtune-amplifier-xe-2016-gui__x86_64;intel-vtune-amplifier-xe-2016-common-pset__noarch"
|
||||
COMPONENTS_INSPECTOR="intel-inspector-xe-2016-cli__x86_64;intel-inspector-xe-2016-cli-common__noarch;intel-inspector-xe-2016-gui-common__noarch;intel-inspector-xe-2016-gui__x86_64;intel-inspector-xe-2016-cli-pset__noarch"
|
||||
COMPONENTS_ADVISOR="intel-advisor-xe-2016-cli__x86_64;intel-advisor-xe-2016-cli-common__noarch;intel-advisor-xe-2016-gui-common__noarch;intel-advisor-xe-2016-gui__x86_64;intel-advisor-xe-2016-cli-pset__noarch"
|
||||
COMPONENTS_GDB="intel-gdb-gt__x86_64;intel-gdb-gt-src__noarch;intel-gdb-gt-libelfdwarf__x86_64;intel-gdb-gt-devel__x86_64;intel-gdb-gt-common__noarch;intel-gdb-ps-cdt__x86_64;intel-gdb-ps-cdt-source__x86_64;intel-gdb-ps-mic__x86_64;intel-gdb-ps-mpm__x86_64;intel-gdb__x86_64;intel-gdb-source__noarch;intel-gdb-python-source__noarch;intel-gdb-common__noarch;intel-gdb-ps-common__noarch"
|
||||
|
||||
# Parallel libraries
|
||||
COMPONENTS_MPI="intel-mpi-rt-core__x86_64;intel-mpi-rt-mic__x86_64;intel-mpi-sdk-core__x86_64;intel-mpi-sdk-mic__x86_64;intel-mpi-psxe__x86_64;intel-mpi-rt-psxe__x86_64"
|
||||
COMPONENTS_TBB="intel-tbb-libs__noarch;intel-mkl-ps-tbb__x86_64;intel-mkl-ps-tbb-devel__x86_64;intel-mkl-ps-tbb-mic__x86_64;intel-mkl-ps-tbb-mic-devel__x86_64;intel-tbb-source__noarch;intel-tbb-devel__noarch;intel-tbb-common__noarch;intel-tbb-ps-common__noarch;intel-tbb-psxe__noarch"
|
||||
COMPONENTS_MKL="intel-mkl__x86_64;intel-mkl-ps__x86_64;intel-mkl-common__noarch;intel-mkl-ps-common__noarch;intel-mkl-devel__x86_64;intel-mkl-ps-mic-devel__x86_64;intel-mkl-ps-f95-devel__x86_64;intel-mkl-gnu-devel__x86_64;intel-mkl-ps-gnu-devel__x86_64;intel-mkl-ps-pgi-devel__x86_64;intel-mkl-sp2dp-devel__x86_64;intel-mkl-ps-cluster-devel__x86_64;intel-mkl-ps-cluster-common__noarch;intel-mkl-ps-f95-common__noarch;intel-mkl-ps-cluster__x86_64;intel-mkl-gnu__x86_64;intel-mkl-ps-gnu__x86_64;intel-mkl-ps-pgi__x86_64;intel-mkl-sp2dp__x86_64;intel-mkl-ps-mic__x86_64;intel-mkl-ps-tbb__x86_64;intel-mkl-ps-tbb-devel__x86_64;intel-mkl-ps-tbb-mic__x86_64;intel-mkl-ps-tbb-mic-devel__x86_64;intel-mkl-psxe__noarch"
|
||||
COMPONENTS_IPP="intel-ipp-l-common__noarch;intel-ipp-l-ps-common__noarch;intel-ipp-l-st__x86_64;intel-ipp-l-mt__x86_64;intel-ipp-l-st-devel__x86_64;intel-ipp-l-ps-st-devel__x86_64;intel-ipp-l-mt-devel__x86_64;intel-ipp-psxe__noarch"
|
||||
COMPONENTS_IPP_CRYPTO="intel-crypto-ipp-st-devel__x86_64;intel-crypto-ipp-ps-st-devel__x86_64;intel-crypto-ipp-st__x86_64;intel-crypto-ipp-mt-devel__x86_64;intel-crypto-ipp-mt__x86_64;intel-crypto-ipp-ss-st-devel__x86_64;intel-crypto-ipp-common__noarch"
|
||||
COMPONENTS_DAAL="intel-daal__x86_64;intel-daal-common__noarch"
|
||||
|
||||
# Compilers
|
||||
COMPONENTS_OPENMP="intel-openmp-l-all__x86_64;intel-openmp-l-ps-mic__x86_64;intel-openmp-l-ps__x86_64;intel-openmp-l-ps-ss__x86_64;intel-openmp-l-all-devel__x86_64;intel-openmp-l-ps-mic-devel__x86_64;intel-openmp-l-ps-devel__x86_64;intel-openmp-l-ps-ss-devel__x86_64"
|
||||
COMPONENTS_COMPILER_COMMON="intel-comp-l-all-vars__noarch;intel-comp-l-all-common;intel-comp-l-ps-common;intel-comp-l-all-devel;intel-comp-l-ps-ss-devel;intel-comp-l-ps-ss-wrapper;intel-comp-l-all-devel;intel-comp-l-ps-devel__x86_64;intel-comp-l-ps-ss-devel__x86_64;intel-psf-intel__x86_64;intel-icsxe-pset;intel-ipsf__noarch;intel-ccompxe__noarch;${COMPONENTS_OPENMP}"
|
||||
COMPONENTS_IFORT="intel-ifort-l-ps__x86_64;intel-ifort-l-ps-vars__noarch;intel-ifort-l-ps-common__noarch;intel-ifort-l-ps-devel__x86_64;${COMPONENTS_COMPILER_COMMON}"
|
||||
COMPONENTS_ICC="intel-icc-l-all__x86_64;intel-icc-l-ps-ss__x86_64;intel-icc-l-all-vars__noarch;intel-icc-l-all-common__noarch;intel-icc-l-ps-common__noarch;intel-icc-l-all-devel__x86_64;intel-icc-l-ps-devel__x86_64;intel-icc-l-ps-ss-devel__x86_64;${COMPONENTS_COMPILER_COMMON}"
|
||||
|
||||
DESTINATION="${HOME}/intel"
|
||||
TEMPORARY_FILES="/tmp"
|
||||
PHONE_INTEL="no"
|
||||
COMPONENTS=""
|
||||
|
||||
add_components() {
|
||||
if [ ! -z "${COMPONENTS}" ]; then
|
||||
COMPONENTS="${COMPONENTS};$1"
|
||||
else
|
||||
COMPONENTS="$1"
|
||||
fi
|
||||
}
|
||||
|
||||
while [ $# != 0 ]; do
|
||||
case "$1" in
|
||||
"--dest")
|
||||
DESTINATION="$(realpath "$2")"; shift
|
||||
;;
|
||||
"--tmpdir")
|
||||
TEMPORARY_FILES="$2"; shift
|
||||
;;
|
||||
"--components")
|
||||
shift
|
||||
OLD_IFS="${IFS}"
|
||||
IFS=","
|
||||
for component in $1; do
|
||||
case "$component" in
|
||||
"icc")
|
||||
add_components "${COMPONENTS_ICC}"
|
||||
;;
|
||||
"mpi")
|
||||
add_components "${COMPONENTS_MPI}"
|
||||
;;
|
||||
"vtune")
|
||||
add_components "${COMPONENTS_VTUNE}"
|
||||
;;
|
||||
"inspector")
|
||||
add_components "${COMPONENTS_INSPECTOR}"
|
||||
;;
|
||||
"advisor")
|
||||
add_components "${COMPONENTS_ADVISOR}"
|
||||
;;
|
||||
"tbb")
|
||||
add_components "${COMPONENTS_TBB}"
|
||||
;;
|
||||
"ifort")
|
||||
add_components "${COMPONENTS_IFORT}"
|
||||
;;
|
||||
"mkl")
|
||||
add_components "${COMPONENTS_MKL}"
|
||||
;;
|
||||
"openmp")
|
||||
# Noop, here for compatability. OpenMP is installed with icc and ifort now.
|
||||
;;
|
||||
"ipp")
|
||||
add_components "${COMPONENTS_IPP}"
|
||||
;;
|
||||
"ipp-crypto")
|
||||
add_components "${COMPONENTS_IPP_CRYPTO}"
|
||||
;;
|
||||
"gdb")
|
||||
add_components "${COMPONENTS_GDB}"
|
||||
;;
|
||||
"daal")
|
||||
add_components "${COMPONENTS_DAAL}"
|
||||
;;
|
||||
*)
|
||||
echo "Unknown component '$component'"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
done
|
||||
IFS="${OLD_IFS}"
|
||||
;;
|
||||
*)
|
||||
echo "Unrecognized argument '$1'"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
shift
|
||||
done
|
||||
|
||||
if [ -z "${COMPONENTS}" ]; then
|
||||
COMPONENTS="${COMPONENTS_ICC}"
|
||||
fi
|
||||
|
||||
INSTALLER_SCRIPT="parallel_studio_xe_2016_update3_online.sh"
|
||||
INSTALLER="${TEMPORARY_FILES}/${INSTALLER_SCRIPT}"
|
||||
INSTALLER_URL="http://registrationcenter-download.intel.com/akdlm/irc_nas/9061/${INSTALLER_SCRIPT}"
|
||||
SILENT_CFG="${TEMPORARY_FILES}/silent.cfg"
|
||||
SUCCESS_INDICATOR="${TEMPORARY_FILES}/icc-travis-success"
|
||||
|
||||
if [ ! -e "${TEMPORARY_FILES}" ]; then
|
||||
echo "${TEMPORARY_FILES} does not exist, creating..."
|
||||
mkdir -p "${TEMPORARY_FILES}" || (sudo mkdir -p "${TEMPORARY_FILES}" && sudo chown -R "${USER}:${USER}" "${TEMPORARY_FILES}")
|
||||
fi
|
||||
|
||||
if [ ! -e "${DESTINATION}" ]; then
|
||||
echo "${DESTINATION} does not exist, creating..."
|
||||
mkdir -p "${DESTINATION}" || (sudo mkdir -p "${DESTINATION}" && sudo chown -R "${USER}:${USER}" "${DESTINATION}")
|
||||
fi
|
||||
|
||||
if [ ! -e "${INSTALLER}" ]; then
|
||||
wget -O "${INSTALLER}" "${INSTALLER_URL}" || exit 1
|
||||
fi
|
||||
chmod u+x "${INSTALLER}"
|
||||
|
||||
# See https://software.intel.com/en-us/articles/intel-composer-xe-2015-silent-installation-guide
|
||||
echo "# Generated silent configuration file" > "${SILENT_CFG}"
|
||||
echo "ACCEPT_EULA=accept" >> "${SILENT_CFG}"
|
||||
echo "INSTALL_MODE=NONRPM" >> "${SILENT_CFG}"
|
||||
echo "CONTINUE_WITH_OPTIONAL_ERROR=yes" >> "${SILENT_CFG}"
|
||||
echo "PSET_INSTALL_DIR=${DESTINATION}" >> "${SILENT_CFG}"
|
||||
echo "CONTINUE_WITH_INSTALLDIR_OVERWRITE=yes" >> "${SILENT_CFG}"
|
||||
echo "COMPONENTS=${COMPONENTS}" >> "${SILENT_CFG}"
|
||||
echo "PSET_MODE=install" >> "${SILENT_CFG}"
|
||||
echo "PHONEHOME_SEND_USAGE_DATA=${PHONE_INTEL}" >> "${SILENT_CFG}"
|
||||
if [ "x" != "x${INTEL_SERIAL_NUMBER}" ]; then
|
||||
echo "ACTIVATION_SERIAL_NUMBER=${INTEL_SERIAL_NUMBER}" >> "${SILENT_CFG}"
|
||||
echo "ACTIVATION_TYPE=serial_number" >> "${SILENT_CFG}"
|
||||
else
|
||||
echo "ACTIVATION_TYPE=trial_lic" >> "${SILENT_CFG}"
|
||||
fi
|
||||
|
||||
attempt=1;
|
||||
while [ $attempt -le 3 ]; do
|
||||
if [ ! -e "${TEMPORARY_FILES}/parallel-studio-install-data" ]; then
|
||||
mkdir -p "${TEMPORARY_FILES}/parallel-studio-install-data" || (sudo mkdir -p "${TEMPORARY_FILES}/parallel-studio-install-data" && sudo chown -R "${USER}:${USER}" "${TEMPORARY_FILES}")
|
||||
fi
|
||||
|
||||
("${INSTALLER}" \
|
||||
-t "${TEMPORARY_FILES}/parallel-studio-install-data" \
|
||||
-s "${SILENT_CFG}" \
|
||||
--cli-mode \
|
||||
--user-mode && \
|
||||
touch "${SUCCESS_INDICATOR}") &
|
||||
|
||||
# So Travis doesn't die in case of a long download/installation.
|
||||
#
|
||||
# NOTE: a watched script never terminates.
|
||||
elapsed=0;
|
||||
while kill -0 $! 2>/dev/null; do
|
||||
sleep 1
|
||||
elapsed=$(expr $elapsed + 1)
|
||||
if [ $(expr $elapsed % 60) -eq 0 ]; then
|
||||
mins_elapsed=$(expr $elapsed / 60)
|
||||
if [ $mins_elapsed = 1 ]; then
|
||||
minute_string="minute"
|
||||
else
|
||||
minute_string="minutes"
|
||||
fi
|
||||
echo "Still running... (about $(expr $elapsed / 60) ${minute_string} so far)."
|
||||
fi
|
||||
done
|
||||
|
||||
if [ ! -e "${SUCCESS_INDICATOR}" ]; then
|
||||
echo "Installation failed."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ ! -e "${DESTINATION}/bin/compilervars.sh" ]; then
|
||||
# Sometimes the installer returns successfully without actually
|
||||
# installing anything. Let's try again…
|
||||
echo "Installation attempt #${attempt} completed, but unable to find compilervars.sh."
|
||||
find "${DESTINATION}"
|
||||
else
|
||||
break
|
||||
fi
|
||||
|
||||
rm -vrf "${TEMPORARY_FILES}/parallel-studio-install-data"
|
||||
echo "Trying again..."
|
||||
|
||||
attempt=$(expr $attempt + 1)
|
||||
done
|
||||
|
||||
if [ ! -e "${DESTINATION}/bin/compilervars.sh" ]; then
|
||||
echo "Installation failed."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Apparently the installer drops the license file in a location it
|
||||
# doesn't know to check.
|
||||
ln -s "${DESTINATION}"/licenses ~/Licenses
|
||||
|
||||
# Add configuration information to ~/.bashrc. Unfortunately this will
|
||||
# not be picked up automatically by Travis, so you'll still need to
|
||||
# source ~/.bashrc in your .travis.yml
|
||||
#
|
||||
# Container-based builds include a `[ -z "$PS1" ] && return` near the
|
||||
# beginning of the file, so appending won't work, we'll need to
|
||||
# prepend.
|
||||
echo "export INTEL_INSTALL_PATH=\"${DESTINATION}\"" >> ~/.bashrc-intel
|
||||
echo ". \"\${INTEL_INSTALL_PATH}/bin/compilervars.sh\" intel64" >> ~/.bashrc-intel
|
||||
echo "export LD_LIBRARY_PATH=\"\${INTEL_INSTALL_PATH}/ism/bin/intel64:\${INTEL_INSTALL_PATH}/lib/intel64_lin:\$LD_LIBRARY_PATH\"" >> ~/.bashrc-intel
|
||||
echo "export PATH=\"\${INTEL_INSTALL_PATH}/bin:\$PATH\"" >> ~/.bashrc-intel
|
||||
echo "function uninstall_intel_software {" >> ~/.bashrc-intel
|
||||
echo " find \"\${INTEL_INSTALL_PATH}\" -name 'uninstall.sh' -not -path '*/ism/uninstall.sh' -exec {} -s \;" >> ~/.bashrc-intel
|
||||
echo "}" >> ~/.bashrc-intel
|
||||
cat ~/.bashrc >> ~/.bashrc-intel
|
||||
mv ~/.bashrc-intel ~/.bashrc
|
||||
+20
-19
@@ -1,21 +1,22 @@
|
||||
# Copyright (C) 2000-2013 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/>.
|
||||
## Copyright (C) 2000-2015, 2018-2019 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/>.
|
||||
|
||||
EXTRA_DIST += \
|
||||
build-aux/cross-options.pl \
|
||||
build-aux/darwin11.4.0.valgrind \
|
||||
build-aux/move-if-change \
|
||||
build-aux/prev-version.txt \
|
||||
EXTRA_DIST += \
|
||||
build-aux/Darwin.valgrind \
|
||||
build-aux/Linux.valgrind \
|
||||
build-aux/cross-options.pl \
|
||||
build-aux/move-if-change \
|
||||
build-aux/prev-version.txt \
|
||||
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
|
||||
# include the current year.
|
||||
|
||||
# Copyright (C) 2009-2013 Free Software Foundation, Inc.
|
||||
# Copyright (C) 2009-2015, 2018-2019 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
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
# In configure.ac, update PACKAGE_COPYRIGHT_YEAR to the current year.
|
||||
|
||||
# Copyright (C) 2010-2013 Free Software Foundation, Inc.
|
||||
# Copyright (C) 2010-2015, 2018-2019 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
|
||||
|
||||
Executable
+93
@@ -0,0 +1,93 @@
|
||||
#! /usr/bin/env python
|
||||
|
||||
# usage:
|
||||
# update-test _build/8d/tests/testsuite.dir/*.testsuite.log
|
||||
|
||||
import argparse
|
||||
import os
|
||||
import re
|
||||
|
||||
|
||||
def getargs():
|
||||
p = argparse.ArgumentParser(description='Update test cases.')
|
||||
opt = p.add_argument
|
||||
opt('tests', metavar='test', nargs='+', type=str, default=None,
|
||||
help='test files to update')
|
||||
opt('-v', '--verbose', action='store_true',
|
||||
help='Be verbose')
|
||||
return p.parse_args()
|
||||
|
||||
args = getargs()
|
||||
subst = dict()
|
||||
|
||||
|
||||
def log(*args_):
|
||||
if args.verbose:
|
||||
print(*args_)
|
||||
|
||||
|
||||
def contents(file):
|
||||
'''The contents of a file.'''
|
||||
log(file)
|
||||
f = open(file)
|
||||
return f.read()
|
||||
|
||||
|
||||
def diff_to_re(match):
|
||||
'''Convert a portion of patch into a regex substitution to perform.
|
||||
No longer used, we now use the expected/effective parts.
|
||||
'''
|
||||
frm = []
|
||||
to = []
|
||||
is_diff = False
|
||||
for l in match.group(1).splitlines():
|
||||
print(l)
|
||||
# t in [-+ ]
|
||||
t = l[0]
|
||||
l = l[1:]
|
||||
if t in ['-', ' ']:
|
||||
is_diff = True
|
||||
frm.append(l)
|
||||
if t in ['+', ' ']:
|
||||
is_diff = True
|
||||
to.append(l)
|
||||
if is_diff:
|
||||
frm = "\n".join(frm)
|
||||
to = "\n".join(to)
|
||||
subst[frm] = to
|
||||
|
||||
|
||||
def update(at_file, logfile):
|
||||
test = contents(at_file)
|
||||
if os.path.isfile(logfile):
|
||||
log("LOG: ", logfile)
|
||||
l = contents(logfile)
|
||||
log("LOG: ", l)
|
||||
global subst
|
||||
subst = {}
|
||||
re.sub(r'(?:^@@.*\n)((?:^[-+ ].*\n)+)',
|
||||
diff_to_re, l, flags = re.MULTILINE)
|
||||
print(subst)
|
||||
if subst:
|
||||
# Turn "subst{frm} -> to" into a large RE.
|
||||
frm = '|'.join([re.escape(x) for x in subst])
|
||||
log("FROM:", frm)
|
||||
test = re.sub("(" + frm + ")",
|
||||
lambda m: subst[m.group(1)],
|
||||
test, flags=re.MULTILINE)
|
||||
open(at_file, 'w').write(test)
|
||||
|
||||
|
||||
def process(logfile):
|
||||
log = contents(logfile)
|
||||
# Look for the file to update.
|
||||
m = re.search(r'^\d+\. (\w+\.at):\d+: ', log, re.MULTILINE)
|
||||
if not m:
|
||||
return
|
||||
at_file = 'tests/' + m.group(1)
|
||||
print(at_file)
|
||||
update(at_file, logfile)
|
||||
|
||||
for t in args.tests:
|
||||
log("FILE:", t)
|
||||
process(t)
|
||||
@@ -1,18 +1,18 @@
|
||||
# Customize maint.mk -*- makefile -*-
|
||||
# Copyright (C) 2008-2013 Free Software Foundation, Inc.
|
||||
## Customize maint.mk -*- makefile -*-
|
||||
## Copyright (C) 2008-2015, 2018-2019 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 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.
|
||||
## 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/>.
|
||||
## You should have received a copy of the GNU General Public License
|
||||
## along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
# Update version, then recompile so that tests/bison --version be
|
||||
# up-to-date, then compile our parser again with our up-to-date bison.
|
||||
@@ -26,15 +26,15 @@ regen: _version
|
||||
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,
|
||||
# override the _is-dist-target from GNUmakefile so that maintainer-*check*
|
||||
# override the _is-dist-target from GNUmakefile so that maintainer-check*
|
||||
# targets are filtered out.
|
||||
_is-dist-target = $(filter-out %clean maintainer-check% maintainer-%-check, \
|
||||
_is-dist-target = $(filter-out %clean maintainer-check%, \
|
||||
$(filter maintainer-% dist% alpha beta major,$(MAKECMDGOALS)))
|
||||
|
||||
url_dir_list = \
|
||||
ftp://$(gnu_rel_host)/gnu/bison
|
||||
https://$(gnu_rel_host)/gnu/bison
|
||||
|
||||
# Tests not to run as part of "make distcheck".
|
||||
local-checks-to-skip = \
|
||||
@@ -60,18 +60,6 @@ update-copyright-env = \
|
||||
## 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:
|
||||
@@ -156,25 +144,29 @@ sc_space_before_open_paren:
|
||||
## syntax-checks exceptions. ##
|
||||
## -------------------------- ##
|
||||
|
||||
# po-check: we use gnulib-po, so we don't need/want them in our POTFILE.
|
||||
generated_files =
|
||||
|
||||
exclude = \
|
||||
$(foreach a,$(1),$(eval $(subst $$,$$$$,exclude_file_name_regexp--sc_$(a))))
|
||||
$(call exclude, \
|
||||
bindtextdomain=^lib/main.c$$ \
|
||||
preprocessor_indentation=^data/|^lib/|^src/parse-gram.[ch]$$ \
|
||||
program_name=^lib/main.c$$ \
|
||||
prohibit_always-defined_macros=^data/yacc.c$$|^djgpp/ \
|
||||
prohibit_always-defined_macros+=?|^lib/timevar.c$$ \
|
||||
prohibit_always-defined_macros+=?|^src/(parse-gram.c|system.h)$$ \
|
||||
prohibit_always-defined_macros+=?|^tests/regression.at$$ \
|
||||
prohibit_always_true_header_tests=^djgpp/subpipe.h$$|^lib/timevar.c$$ \
|
||||
prohibit_always_true_header_tests+=?|^m4/timevar.m4$$ \
|
||||
prohibit_defined_have_decl_tests=?|^lib/timevar.c$$ \
|
||||
prohibit_doubled_word=^tests/named-refs.at$$ \
|
||||
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 \
|
||||
require_config_h_first=^(lib/yyerror|data/(glr|yacc))\.c$$ \
|
||||
space_before_open_paren=^(data/|djgpp/) \
|
||||
unmarked_diagnostics=^(djgpp/|doc/bison.texi$$|tests/c\+\+\.at$$) \
|
||||
|
||||
$(call exclude, \
|
||||
bindtextdomain=^lib/main.c$$ \
|
||||
cast_of_argument_to_free=^src/muscle-tab.c$$ \
|
||||
po_check=^po/POTFILES.in$$ \
|
||||
preprocessor_indentation=^data/|^lib/|^src/parse-gram.[ch]$$ \
|
||||
program_name=^lib/main.c$$ \
|
||||
prohibit_always-defined_macros=^data/skeletons/yacc.c$$ \
|
||||
prohibit_always-defined_macros+=?|^src/(parse-gram.c|system.h)$$ \
|
||||
prohibit_always-defined_macros+=?|^tests/regression.at$$ \
|
||||
prohibit_doubled_word=^tests/named-refs.at$$ \
|
||||
prohibit_magic_number_exit=^doc/bison.texi$$ \
|
||||
prohibit_magic_number_exit+=?|^tests/(conflicts|regression).at$$ \
|
||||
prohibit_strcmp=^doc/bison\.texi|examples|tests/local\.at$$ \
|
||||
prohibit_tab_based_indentation=install-icc.sh|\.(am|mk)$$|^\.git|tests/input.at|Makefile$$ \
|
||||
require_config_h=^(lib/yyerror|data/skeletons/(glr|yacc))\.c$$ \
|
||||
require_config_h_first=^(lib/yyerror|data/skeletons/(glr|yacc))\.c$$ \
|
||||
space_before_open_paren=^data/skeletons/ \
|
||||
two_space_separator_in_usage=^(bootstrap|build-aux/install-icc.sh) \
|
||||
unmarked_diagnostics=^(doc/bison.texi$$|tests/c\+\+\.at$$) \
|
||||
)
|
||||
|
||||
+91
-41
@@ -1,6 +1,6 @@
|
||||
# Configure template for GNU Bison. -*-Autoconf-*-
|
||||
#
|
||||
# Copyright (C) 2001-2013 Free Software Foundation, Inc.
|
||||
# Copyright (C) 2001-2015, 2018-2019 Free Software Foundation, Inc.
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
@@ -21,23 +21,20 @@
|
||||
# better to avoid a typo in the 'configure --help' entry for the YACC
|
||||
# environment variable.
|
||||
AC_PREREQ([2.68])
|
||||
m4_pattern_forbid([^gl_[A-Z]])
|
||||
m4_pattern_forbid([^_?(gl_[A-Z]|AX_|BISON_)])
|
||||
m4_pattern_allow([^BISON_USE_NLS$])
|
||||
|
||||
AC_INIT([GNU Bison],
|
||||
m4_esyscmd([build-aux/git-version-gen .tarball-version]),
|
||||
[[email protected]])
|
||||
AC_SUBST([PACKAGE_COPYRIGHT_YEAR], [2013])
|
||||
AC_SUBST([PACKAGE_COPYRIGHT_YEAR], [2019])
|
||||
AC_DEFINE_UNQUOTED([PACKAGE_COPYRIGHT_YEAR], [$PACKAGE_COPYRIGHT_YEAR],
|
||||
[The copyright year for this package])
|
||||
|
||||
AC_CONFIG_AUX_DIR([build-aux])
|
||||
AC_CONFIG_MACRO_DIR([m4])
|
||||
|
||||
# Automake 1.10.3 and 1.11.1 fix a security flaw discussed here:
|
||||
#
|
||||
# http://thread.gmane.org/gmane.comp.sysutils.autotools.announce/131
|
||||
#
|
||||
# To avoid 1.11, we make 1.11.1 the minimum version.
|
||||
# We use Automake 1.14's %D% and %C%.
|
||||
#
|
||||
# We want gnits strictness only when rolling a stable release. For
|
||||
# release candidates, we use version strings like 2.4.3_rc1, but gnits
|
||||
@@ -45,7 +42,7 @@ AC_CONFIG_MACRO_DIR([m4])
|
||||
# releases, we want to be able run make dist without being required to
|
||||
# add a bogus NEWS entry. In that case, the version string
|
||||
# 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
|
||||
silent-rules]
|
||||
m4_bmatch(m4_defn([AC_PACKAGE_VERSION]), [[-_]],
|
||||
@@ -74,24 +71,50 @@ AC_CACHE_CHECK([whether pragma GCC diagnostic push works],
|
||||
[lv_cv_gcc_pragma_push_works=no])
|
||||
CFLAGS=$save_CFLAGS])
|
||||
|
||||
AC_LANG_PUSH([C++])
|
||||
gl_WARN_ADD([-fno-exceptions], [NO_EXCEPTIONS_CXXFLAGS])
|
||||
BISON_CXXSTD([98])
|
||||
BISON_CXXSTD([03])
|
||||
BISON_CXXSTD([11])
|
||||
BISON_CXXSTD([14])
|
||||
BISON_CXXSTD([17])
|
||||
BISON_CXXSTD([2a])
|
||||
AM_CONDITIONAL([ENABLE_CXX11], [test x"$CXX11_CXXFLAGS" != x])
|
||||
AM_CONDITIONAL([ENABLE_CXX14], [test x"$CXX14_CXXFLAGS" != x])
|
||||
AC_LANG_POP([C++])
|
||||
|
||||
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
|
||||
yes|no) ;;
|
||||
*) AC_MSG_ERROR([invalid value for --gcc-warnings: $enable_gcc_warnings]);;
|
||||
esac],
|
||||
[enable_gcc_warnings=no])
|
||||
AM_CONDITIONAL([ENABLE_GCC_WARNINGS], [test "$enable_gcc_warnings" = yes])
|
||||
if test "$enable_gcc_warnings" = yes; then
|
||||
warn_common='-Wall -Wextra -Wno-sign-compare -Wcast-align
|
||||
-Wformat -Wpointer-arith -Wwrite-strings'
|
||||
warn_c='-Wbad-function-cast -Wshadow -Wstrict-prototypes'
|
||||
warn_cxx='-Wnoexcept'
|
||||
-fparse-all-comments -Wdocumentation
|
||||
-Wformat -Wimplicit-fallthrough -Wnull-dereference
|
||||
-Wpointer-arith -Wshadow
|
||||
-Wwrite-strings'
|
||||
warn_c='-Wbad-function-cast -Wstrict-prototypes'
|
||||
warn_cxx='-Wextra-semi -Wnoexcept -Wundefined-func-template -Wweak-vtables'
|
||||
# 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).
|
||||
warn_tests='-Wundef -pedantic -Wsign-compare -fno-color-diagnostics'
|
||||
#
|
||||
# -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 -Wconversion
|
||||
-Wdeprecated -Wsign-compare -Wsign-conversion
|
||||
-fno-color-diagnostics
|
||||
-Wno-keyword-macro'
|
||||
|
||||
|
||||
AC_LANG_PUSH([C])
|
||||
# Clang supports many of GCC's -W options, but only issues warnings
|
||||
@@ -106,6 +129,11 @@ if test "$enable_gcc_warnings" = yes; then
|
||||
# CFLAGS, and restore CFLAGS after the tests.
|
||||
save_CFLAGS=$CFLAGS
|
||||
gl_WARN_ADD([-Werror=unknown-warning-option], [CFLAGS])
|
||||
# Accept this warning only if it is not too touchy (e.g., clang 3.3
|
||||
# and 3.4).
|
||||
gl_WARN_ADD([-Wunreachable-code], [WARN_CFLAGS],
|
||||
[AC_LANG_PROGRAM([],
|
||||
[[if (sizeof (long) < sizeof (int)) return 1;]])])
|
||||
for i in $warn_common $warn_c;
|
||||
do
|
||||
gl_WARN_ADD([$i], [WARN_CFLAGS])
|
||||
@@ -120,13 +148,14 @@ if test "$enable_gcc_warnings" = yes; then
|
||||
AS_VAR_APPEND([WARN_CFLAGS], [" $WARN_CFLAGS_TEST"])
|
||||
|
||||
# Warnings for the test suite only.
|
||||
for i in $warn_tests;
|
||||
for i in $warn_tests -Wincompatible-pointer-types;
|
||||
do
|
||||
gl_WARN_ADD([$i], [WARN_CFLAGS_TEST])
|
||||
done
|
||||
CFLAGS=$save_CFLAGS
|
||||
AC_LANG_POP([C])
|
||||
|
||||
|
||||
AC_LANG_PUSH([C++])
|
||||
save_CXXFLAGS=$CXXFLAGS
|
||||
gl_WARN_ADD([-Werror=unknown-warning-option], [CXXFLAGS])
|
||||
@@ -134,6 +163,11 @@ if test "$enable_gcc_warnings" = yes; then
|
||||
do
|
||||
gl_WARN_ADD([$i], [WARN_CXXFLAGS])
|
||||
done
|
||||
# Accept this warning only if it is not too touchy (e.g., clang 3.3
|
||||
# and 3.4).
|
||||
gl_WARN_ADD([-Wunreachable-code], [WARN_CXXFLAGS],
|
||||
[AC_LANG_PROGRAM([],
|
||||
[[if (sizeof (long) < sizeof (int)) return 1;]])])
|
||||
gl_WARN_ADD([-Wzero-as-null-pointer-constant], [WARN_CXXFLAGS],
|
||||
[AC_LANG_PROGRAM([], [nullptr])])
|
||||
gl_WARN_ADD([-Werror], [WERROR_CXXFLAGS])
|
||||
@@ -142,40 +176,47 @@ if test "$enable_gcc_warnings" = yes; then
|
||||
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])
|
||||
# Too many compilers complain about Flex generated code.
|
||||
gl_WARN_ADD([-Wno-error], [FLEX_SCANNER_CXXFLAGS])
|
||||
# Clang++ deprecates compiling C.
|
||||
gl_WARN_ADD([-Wno-deprecated], [WNO_DEPRECATED_CXXFLAGS])
|
||||
CXXFLAGS=$save_CXXFLAGS
|
||||
AC_LANG_POP([C++])
|
||||
fi
|
||||
|
||||
|
||||
BISON_TEST_FOR_WORKING_C_COMPILER
|
||||
BISON_C_COMPILER_POSIXLY_CORRECT
|
||||
BISON_TEST_FOR_WORKING_CXX_COMPILER
|
||||
BISON_CXX_COMPILER_POSIXLY_CORRECT
|
||||
|
||||
# D.
|
||||
AC_CHECK_PROGS([DC], [dmd])
|
||||
AC_CHECK_PROGS([DCFLAGS], [])
|
||||
AM_CONDITIONAL([ENABLE_D], [test x"$DC" != x])
|
||||
|
||||
# Java.
|
||||
gt_JAVACOMP([1.7], [1.7])
|
||||
gt_JAVAEXEC
|
||||
AM_CONDITIONAL([ENABLE_JAVA], [test x"$CONF_JAVAC" != x && test x"$CONF_JAVA" != x])
|
||||
|
||||
|
||||
AC_ARG_ENABLE([yacc],
|
||||
[AC_HELP_STRING([--disable-yacc],
|
||||
[do not build a yacc command or an -ly library])],
|
||||
, [enable_yacc=yes])
|
||||
case $enable_yacc in
|
||||
yes)
|
||||
YACC_SCRIPT=src/yacc
|
||||
YACC_LIBRARY=lib/liby.a;;
|
||||
*)
|
||||
YACC_SCRIPT=
|
||||
YACC_LIBRARY=;;
|
||||
esac
|
||||
AC_SUBST([YACC_SCRIPT])
|
||||
AC_SUBST([YACC_LIBRARY])
|
||||
AM_CONDITIONAL([ENABLE_YACC], [test "$enable_yacc" = yes])
|
||||
AC_CONFIG_FILES([src/yacc], [chmod +x src/yacc])
|
||||
|
||||
# Checks for programs.
|
||||
AM_MISSING_PROG([DOT], [dot])
|
||||
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_RANLIB
|
||||
AC_PROG_GNU_M4
|
||||
@@ -203,14 +244,14 @@ gl_INIT
|
||||
# Checks for library functions.
|
||||
AC_CHECK_FUNCS_ONCE([setlocale])
|
||||
AM_WITH_DMALLOC
|
||||
BISON_PREREQ_TIMEVAR
|
||||
|
||||
# Gettext.
|
||||
# We use gnulib, which is only guaranteed to work properly with the
|
||||
# latest Gettext.
|
||||
AM_GNU_GETTEXT([external], [need-ngettext])
|
||||
AM_GNU_GETTEXT_VERSION([0.18])
|
||||
AM_GNU_GETTEXT_VERSION([0.19])
|
||||
BISON_I18N
|
||||
AC_CONFIG_FILES([gnulib-po/Makefile.in])
|
||||
|
||||
# Internationalized parsers.
|
||||
AC_CONFIG_FILES([runtime-po/Makefile.in])
|
||||
@@ -225,24 +266,33 @@ AC_CONFIG_FILES([etc/bench.pl], [chmod +x etc/bench.pl])
|
||||
AC_CONFIG_TESTDIR(tests)
|
||||
AC_CONFIG_FILES([tests/atlocal])
|
||||
AC_CONFIG_FILES([tests/bison], [chmod +x tests/bison])
|
||||
|
||||
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.
|
||||
# VALGRIND+=' --suppressions=$(abs_top_srcdir)/build-aux/darwin11.4.0.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
|
||||
AC_MSG_CHECKING([Valgrind suppression file])
|
||||
AC_MSG_RESULT([$suppfile])
|
||||
|
||||
# Whether we cannot run the compiled bison.
|
||||
AM_CONDITIONAL([CROSS_COMPILING], [test "$cross_compiling" = yes])
|
||||
|
||||
AM_MISSING_PROG([AUTOM4TE], [autom4te])
|
||||
# Needed by tests/atlocal.in.
|
||||
AC_SUBST([GCC])
|
||||
|
||||
gt_JAVACOMP([1.3], [1.4])
|
||||
gt_JAVAEXEC
|
||||
|
||||
AC_CONFIG_FILES([Makefile
|
||||
po/Makefile.in
|
||||
doc/yacc.1])
|
||||
|
||||
-70
@@ -1,70 +0,0 @@
|
||||
-*- outline -*-
|
||||
|
||||
This directory contains data needed by Bison.
|
||||
|
||||
* Skeletons
|
||||
Bison skeletons: the general shapes of the different parser kinds,
|
||||
that are specialized for specific grammars by the bison program.
|
||||
|
||||
Currently, the supported skeletons are:
|
||||
|
||||
- yacc.c
|
||||
It used to be named bison.simple: it corresponds to C Yacc
|
||||
compatible LALR(1) parsers.
|
||||
|
||||
- lalr1.cc
|
||||
Produces a C++ parser class.
|
||||
|
||||
- lalr1.java
|
||||
Produces a Java parser class.
|
||||
|
||||
- glr.c
|
||||
A Generalized LR C parser based on Bison's LALR(1) tables.
|
||||
|
||||
- glr.cc
|
||||
A Generalized LR C++ parser. Actually a C++ wrapper around glr.c.
|
||||
|
||||
These skeletons are the only ones supported by the Bison team.
|
||||
Because the interface between skeletons and the bison program is not
|
||||
finished, *we are not bound to it*. In particular, Bison is not
|
||||
mature enough for us to consider that "foreign skeletons" are
|
||||
supported.
|
||||
|
||||
* m4sugar
|
||||
This directory contains M4sugar, sort of an extended library for M4,
|
||||
which is used by Bison to instantiate the skeletons.
|
||||
|
||||
* xslt
|
||||
This directory contains XSLT programs that transform Bison's XML output
|
||||
into various formats.
|
||||
|
||||
- bison.xsl
|
||||
A library of routines used by the other XSLT programs.
|
||||
|
||||
- xml2dot.xsl
|
||||
Conversion into GraphViz's dot format.
|
||||
|
||||
- xml2text.xsl
|
||||
Conversion into text.
|
||||
|
||||
- xml2xhtml.xsl
|
||||
Conversion into XHTML.
|
||||
|
||||
-----
|
||||
|
||||
Copyright (C) 2002, 2008-2013 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GNU Bison.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 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/>.
|
||||
+192
@@ -0,0 +1,192 @@
|
||||
This directory contains data needed by Bison.
|
||||
|
||||
# Directory content
|
||||
## Skeletons
|
||||
Bison skeletons: the general shapes of the different parser kinds, that are
|
||||
specialized for specific grammars by the bison program.
|
||||
|
||||
Currently, the supported skeletons are:
|
||||
|
||||
- yacc.c
|
||||
It used to be named bison.simple: it corresponds to C Yacc
|
||||
compatible LALR(1) parsers.
|
||||
|
||||
- lalr1.cc
|
||||
Produces a C++ parser class.
|
||||
|
||||
- lalr1.java
|
||||
Produces a Java parser class.
|
||||
|
||||
- glr.c
|
||||
A Generalized LR C parser based on Bison's LALR(1) tables.
|
||||
|
||||
- glr.cc
|
||||
A Generalized LR C++ parser. Actually a C++ wrapper around glr.c.
|
||||
|
||||
These skeletons are the only ones supported by the Bison team. Because the
|
||||
interface between skeletons and the bison program is not finished, *we are
|
||||
not bound to it*. In particular, Bison is not mature enough for us to
|
||||
consider that "foreign skeletons" are supported.
|
||||
|
||||
## m4sugar
|
||||
This directory contains M4sugar, sort of an extended library for M4, which
|
||||
is used by Bison to instantiate the skeletons.
|
||||
|
||||
## xslt
|
||||
This directory contains XSLT programs that transform Bison's XML output into
|
||||
various formats.
|
||||
|
||||
- bison.xsl
|
||||
A library of routines used by the other XSLT programs.
|
||||
|
||||
- xml2dot.xsl
|
||||
Conversion into GraphViz's dot format.
|
||||
|
||||
- xml2text.xsl
|
||||
Conversion into text.
|
||||
|
||||
- xml2xhtml.xsl
|
||||
Conversion into XHTML.
|
||||
|
||||
# Implementation note about the skeletons
|
||||
|
||||
"Skeleton" in Bison parlance means "backend": a skeleton is fed by the bison
|
||||
executable with LR tables, facts about the symbols, etc. and they generate
|
||||
the output (say parser.cc, parser.hh, location.hh, etc.). They are only in
|
||||
charge of generating the parser and its auxiliary files, they do not
|
||||
generate the XML output, the parser.output reports, nor the graphical
|
||||
rendering.
|
||||
|
||||
The bits of information passing from bison to the backend is named
|
||||
"muscles". Muscles are passed to M4 via its standard input: it's a set of
|
||||
m4 definitions. To see them, use `--trace=muscles`.
|
||||
|
||||
Except for muscles, whose names are generated by bison, the skeletons have
|
||||
no constraint at all on the macro names: there is no technical/theoretical
|
||||
limitation, as long as you generate the output, you can do what you want.
|
||||
However, of course, that would be a bad idea if, say, the C and C++
|
||||
skeletons used different approaches and had completely different
|
||||
implementations. That would be a maintenance nightmare.
|
||||
|
||||
Below, we document some of the macros that we use in several of the
|
||||
skeletons. If you are to write a new skeleton, please, implement them for
|
||||
your language. Overall, be sure to follow the same patterns as the existing
|
||||
skeletons.
|
||||
|
||||
## Symbols
|
||||
|
||||
### `b4_symbol(NUM, FIELD)`
|
||||
In order to unify the handling of the various aspects of symbols (tag, type
|
||||
name, whether terminal, etc.), bison.exe defines one macro per (token,
|
||||
field), where field can `has_id`, `id`, etc.: see
|
||||
`prepare_symbols_definitions()` in `src/output.c`.
|
||||
|
||||
The macro `b4_symbol(NUM, FIELD)` gives access to the following FIELDS:
|
||||
|
||||
- `has_id`: 0 or 1.
|
||||
|
||||
Whether the symbol has an id.
|
||||
|
||||
- `id`: string
|
||||
If has_id, the id (prefixed by api.token.prefix if defined), otherwise
|
||||
defined as empty. Guaranteed to be usable as a C identifier.
|
||||
|
||||
- `tag`: string.
|
||||
A representation of the symbol. Can be 'foo', 'foo.id', '"foo"' etc.
|
||||
|
||||
- `user_number`: integer
|
||||
The external number as used by yylex. Can be ASCII code when a character,
|
||||
some number chosen by bison, or some user number in the case of
|
||||
%token FOO <NUM>. Corresponds to yychar in yacc.c.
|
||||
|
||||
- `is_token`: 0 or 1
|
||||
Whether this is a terminal symbol.
|
||||
|
||||
- `number`: integer
|
||||
The internal number (computed from the external number by yytranslate).
|
||||
Corresponds to yytoken in yacc.c. This is the same number that serves as
|
||||
key in b4_symbol(NUM, FIELD).
|
||||
|
||||
In bison, symbols are first assigned increasing numbers in order of
|
||||
appearance (but tokens first, then nterms). After grammar reduction,
|
||||
unused nterms are then renumbered to appear last (i.e., first tokens, then
|
||||
used nterms and finally unused nterms). This final number NUM is the one
|
||||
contained in this field, and it is the one used as key in `b4_symbol(NUM,
|
||||
FIELD)`.
|
||||
|
||||
The code of the rule actions, however, is emitted before we know what
|
||||
symbols are unused, so they use the original numbers. To avoid confusion,
|
||||
they actually use "orig NUM" instead of just "NUM". bison also emits
|
||||
definitions for `b4_symbol(orig NUM, number)` that map from original
|
||||
numbers to the new ones. `b4_symbol` actually resolves `orig NUM` in the
|
||||
other case, i.e., `b4_symbol(orig 42, tag)` would return the tag of the
|
||||
symbols whose original number was 42.
|
||||
|
||||
- `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
|
||||
- `printer_loc`: location
|
||||
If the symbol has a printer, everything about it.
|
||||
|
||||
- `has_destructor`, `destructor`, `destructor_file`, `destructor_line`, `destructor_loc`
|
||||
Likewise.
|
||||
|
||||
### `b4_symbol_value(VAL, [SYMBOL-NUM], [TYPE-TAG])`
|
||||
Expansion of $$, $1, $<TYPE-TAG>3, etc.
|
||||
|
||||
The semantic value from a given VAL.
|
||||
- `VAL`: some semantic value storage (typically a union). e.g., `yylval`
|
||||
- `SYMBOL-NUM`: the symbol number from which we extract the type tag.
|
||||
- `TYPE-TAG`, the user forced the `<TYPE-TAG>`.
|
||||
|
||||
The result can be used safely, it is put in parens to avoid nasty precedence
|
||||
issues.
|
||||
|
||||
### `b4_lhs_value(SYMBOL-NUM, [TYPE])`
|
||||
Expansion of `$$` or `$<TYPE>$`, for symbol `SYMBOL-NUM`.
|
||||
|
||||
### `b4_rhs_data(RULE-LENGTH, POS)`
|
||||
The data corresponding to the symbol `#POS`, where the current rule has
|
||||
`RULE-LENGTH` symbols on RHS.
|
||||
|
||||
### `b4_rhs_value(RULE-LENGTH, POS, SYMBOL-NUM, [TYPE])`
|
||||
Expansion of `$<TYPE>POS`, where the current rule has `RULE-LENGTH` symbols
|
||||
on RHS.
|
||||
|
||||
-----
|
||||
|
||||
Local Variables:
|
||||
mode: markdown
|
||||
fill-column: 76
|
||||
ispell-dictionary: "american"
|
||||
End:
|
||||
|
||||
Copyright (C) 2002, 2008-2015, 2018-2019 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GNU Bison.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 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/>.
|
||||
@@ -0,0 +1,24 @@
|
||||
/* Default styling rules for Bison when doing terminal output.
|
||||
Copyright (C) 2019 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 <https://www.gnu.org/licenses/>. */
|
||||
|
||||
/* This is an experimental feature. The class names may change in the
|
||||
future. */
|
||||
|
||||
.warning { color: purple; }
|
||||
.error { color: red; }
|
||||
.note { color: cyan; }
|
||||
/* Semantic values in Bison's own parser traces. */
|
||||
.value { color: green; }
|
||||
+30
-18
@@ -1,4 +1,5 @@
|
||||
## Copyright (C) 2002, 2005-2013 Free Software Foundation, Inc.
|
||||
## Copyright (C) 2002, 2005-2015, 2018-2019 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
|
||||
@@ -14,23 +15,34 @@
|
||||
## along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
dist_pkgdata_DATA = \
|
||||
data/README \
|
||||
data/bison.m4 \
|
||||
data/c++-skel.m4 \
|
||||
data/c++.m4 \
|
||||
data/c-like.m4 \
|
||||
data/c-skel.m4 \
|
||||
data/c.m4 \
|
||||
data/glr.c \
|
||||
data/glr.cc \
|
||||
data/java-skel.m4 \
|
||||
data/java.m4 \
|
||||
data/lalr1.cc \
|
||||
data/lalr1.java \
|
||||
data/location.cc \
|
||||
data/stack.hh \
|
||||
data/variant.hh \
|
||||
data/yacc.c
|
||||
data/README.md \
|
||||
data/bison-default.css
|
||||
|
||||
skeletonsdir = $(pkgdatadir)/skeletons
|
||||
dist_skeletons_DATA = \
|
||||
data/skeletons/bison.m4 \
|
||||
data/skeletons/c++-skel.m4 \
|
||||
data/skeletons/c++.m4 \
|
||||
data/skeletons/c-like.m4 \
|
||||
data/skeletons/c-skel.m4 \
|
||||
data/skeletons/c.m4 \
|
||||
data/skeletons/glr.c \
|
||||
data/skeletons/glr.cc \
|
||||
data/skeletons/java-skel.m4 \
|
||||
data/skeletons/java.m4 \
|
||||
data/skeletons/lalr1.cc \
|
||||
data/skeletons/lalr1.java \
|
||||
data/skeletons/location.cc \
|
||||
data/skeletons/stack.hh \
|
||||
data/skeletons/variant.hh \
|
||||
data/skeletons/yacc.c
|
||||
|
||||
# Experimental support for the D language.
|
||||
dist_skeletons_DATA += \
|
||||
data/skeletons/README-D.txt \
|
||||
data/skeletons/d-skel.m4 \
|
||||
data/skeletons/d.m4 \
|
||||
data/skeletons/lalr1.d
|
||||
|
||||
m4sugardir = $(pkgdatadir)/m4sugar
|
||||
dist_m4sugar_DATA = \
|
||||
|
||||
@@ -0,0 +1,60 @@
|
||||
Some usage notes for the D Parser:
|
||||
|
||||
- it is a port of the Java parser, so interface is very similar.
|
||||
|
||||
- the lexer class needs to implement the interface 'Lexer' (similar to
|
||||
java). It typically (depending on options) looks like this:
|
||||
|
||||
public interface Lexer
|
||||
{
|
||||
/**
|
||||
* Method to retrieve the beginning position of the last scanned token.
|
||||
* @return the position at which the last scanned token starts. */
|
||||
@property YYPosition startPos ();
|
||||
|
||||
/**
|
||||
* Method to retrieve the ending position of the last scanned token.
|
||||
* @return the first position beyond the last scanned token. */
|
||||
@property YYPosition endPos ();
|
||||
|
||||
/**
|
||||
* Method to retrieve the semantic value of the last scanned token.
|
||||
* @return the semantic value of the last scanned token. */
|
||||
@property YYSemanticType semanticVal ();
|
||||
|
||||
/**
|
||||
* Entry point for the scanner. Returns the token identifier corresponding
|
||||
* to the next token and prepares to return the semantic value
|
||||
* and beginning/ending positions of the token.
|
||||
* @return the token identifier corresponding to the next token. */
|
||||
YYTokenType yylex ();
|
||||
|
||||
/**
|
||||
* Entry point for error reporting. Emits an error
|
||||
* referring to the given location in a user-defined way.
|
||||
*
|
||||
* @param loc The location of the element to which the
|
||||
* error message is related
|
||||
* @param s The string for the error message. */
|
||||
void yyerror (YYLocation loc, string s);
|
||||
}
|
||||
|
||||
- semantic types are handled by D usions (same as for C/C++ parsers)
|
||||
|
||||
- the following (non-standard) %defines are supported:
|
||||
|
||||
%define package "<package_name>"
|
||||
%define api.parser.class "my_class_name>"
|
||||
%define position_type "my_position_type"
|
||||
%define location_type "my_location_type"
|
||||
|
||||
- the following declarations basically work like in C/C++:
|
||||
|
||||
%locations
|
||||
%error-verbose
|
||||
%parse-param
|
||||
%initial-action
|
||||
%code
|
||||
%union
|
||||
|
||||
- %destructor is not yet supported
|
||||
@@ -2,7 +2,8 @@
|
||||
|
||||
# Language-independent M4 Macros for Bison.
|
||||
|
||||
# Copyright (C) 2002, 2004-2013 Free Software Foundation, Inc.
|
||||
# Copyright (C) 2002, 2004-2015, 2018-2019 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
|
||||
@@ -22,12 +23,17 @@
|
||||
## Identification. ##
|
||||
## ---------------- ##
|
||||
|
||||
# b4_generated_by
|
||||
# ---------------
|
||||
m4_define([b4_generated_by],
|
||||
[b4_comment([A Bison parser, made by GNU Bison b4_version.])
|
||||
])
|
||||
|
||||
# b4_copyright(TITLE, [YEARS])
|
||||
# ----------------------------
|
||||
# If YEARS are not defined, use b4_copyright_years.
|
||||
m4_define([b4_copyright],
|
||||
[b4_comment([A Bison parser, made by GNU Bison b4_version.])
|
||||
|
||||
[b4_generated_by
|
||||
b4_comment([$1
|
||||
|
||||
]m4_dquote(m4_text_wrap([Copyright (C)
|
||||
@@ -58,26 +64,49 @@ Bison output files to be licensed under the GNU General Public
|
||||
License without this special exception.
|
||||
|
||||
This special exception was added by the Free Software Foundation in
|
||||
version 2.2 of Bison.])])
|
||||
version 2.2 of Bison.])
|
||||
])
|
||||
|
||||
|
||||
# b4_disclaimer
|
||||
# -------------
|
||||
# Issue a warning about private implementation details.
|
||||
m4_define([b4_disclaimer],
|
||||
[b4_comment([Undocumented macros, especially those whose name start with YY_,
|
||||
are private implementation details. Do not rely on them.])
|
||||
])
|
||||
|
||||
|
||||
|
||||
# b4_required_version_if(VERSION, IF_NEWER, IF_OLDER)
|
||||
# ---------------------------------------------------
|
||||
# If the version %require'd by the user is VERSION (or newer) expand
|
||||
# IF_NEWER, otherwise IF_OLDER. VERSION should be an integer, e.g.,
|
||||
# 302 for 3.2.
|
||||
m4_define([b4_required_version_if],
|
||||
[m4_if(m4_eval($1 <= b4_required_version),
|
||||
[1], [$2], [$3])])
|
||||
|
||||
|
||||
## -------- ##
|
||||
## Output. ##
|
||||
## -------- ##
|
||||
|
||||
# b4_output_begin(FILE)
|
||||
# ---------------------
|
||||
# b4_output_begin(FILE1, FILE2)
|
||||
# -----------------------------
|
||||
# Enable output, i.e., send to diversion 0, expand after "#", and
|
||||
# generate the tag to output into FILE. Must be followed by EOL.
|
||||
# FILE is FILE1 concatenated to FILE2. FILE2 can be empty, or be
|
||||
# absolute: do the right thing.
|
||||
m4_define([b4_output_begin],
|
||||
[m4_changecom()
|
||||
m4_divert_push(0)dnl
|
||||
@output(m4_unquote([$1])@)@dnl
|
||||
@output(m4_unquote([$1])@,m4_unquote([$2])@)@dnl
|
||||
])
|
||||
|
||||
|
||||
# b4_output_end()
|
||||
# ---------------
|
||||
# b4_output_end
|
||||
# -------------
|
||||
# Output nothing, restore # as comment character (no expansions after #).
|
||||
m4_define([b4_output_end],
|
||||
[m4_divert_pop(0)
|
||||
@@ -235,8 +264,8 @@ m4_define([b4_subtract],
|
||||
# -------------------
|
||||
# Join with comma, skipping empty arguments.
|
||||
# b4_join calls itself recursively until it sees the first non-empty
|
||||
# argument, then calls _b4_join which prepends each non-empty argument
|
||||
# with a comma.
|
||||
# argument, then calls _b4_join (i.e., `_$0`) which prepends each
|
||||
# non-empty argument with a comma.
|
||||
m4_define([b4_join],
|
||||
[m4_if([$#$1],
|
||||
[1], [],
|
||||
@@ -346,66 +375,48 @@ b4_define_flag_if([token_table]) # Whether yytoken_table is demanded.
|
||||
b4_define_flag_if([yacc]) # Whether POSIX Yacc is emulated.
|
||||
|
||||
|
||||
# b4_glr_cc_if([IF-TRUE], [IF-FALSE])
|
||||
# -----------------------------------
|
||||
m4_define([b4_glr_cc_if],
|
||||
[m4_if(b4_skeleton, ["glr.cc"], $@)])
|
||||
|
||||
|
||||
## --------- ##
|
||||
## Symbols. ##
|
||||
## --------- ##
|
||||
|
||||
# In order to unify the handling of the various aspects of symbols
|
||||
# (tag, type_name, whether terminal, etc.), bison.exe defines one
|
||||
# macro per (token, field), where field can has_id, id, etc.: see
|
||||
# src/output.c:prepare_symbols_definitions().
|
||||
# For a description of the Symbol handling, see README.
|
||||
#
|
||||
# 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 symbol related values.
|
||||
|
||||
# b4_symbol_(NUM, FIELD)
|
||||
# ----------------------
|
||||
# __b4_symbol(NUM, FIELD)
|
||||
# -----------------------
|
||||
# Recover a FIELD about symbol #NUM. Thanks to m4_indir, fails if
|
||||
# undefined.
|
||||
m4_define([b4_symbol_],
|
||||
m4_define([__b4_symbol],
|
||||
[m4_indir([b4_symbol($1, $2)])])
|
||||
|
||||
|
||||
# _b4_symbol(NUM, FIELD)
|
||||
# ----------------------
|
||||
# Recover a FIELD about symbol #NUM (or "orig NUM"). Fails if
|
||||
# undefined.
|
||||
m4_define([_b4_symbol],
|
||||
[m4_ifdef([b4_symbol($1, number)],
|
||||
[__b4_symbol(m4_indir([b4_symbol($1, number)]), $2)],
|
||||
[__b4_symbol([$1], [$2])])])
|
||||
|
||||
|
||||
|
||||
# b4_symbol(NUM, FIELD)
|
||||
# ---------------------
|
||||
# Recover a FIELD about symbol #NUM. Thanks to m4_indir, fails if
|
||||
# Recover a FIELD about symbol #NUM (or "orig NUM"). Fails if
|
||||
# undefined. If FIELD = id, prepend the token prefix.
|
||||
m4_define([b4_symbol],
|
||||
[m4_case([$2],
|
||||
[id], [m4_do([b4_percent_define_get([api.token.prefix])],
|
||||
[b4_symbol_([$1], [id])])],
|
||||
[b4_symbol_($@)])])
|
||||
[_b4_symbol([$1], [id])])],
|
||||
[_b4_symbol($@)])])
|
||||
|
||||
|
||||
# b4_symbol_if(NUM, FIELD, IF-TRUE, IF-FALSE)
|
||||
@@ -427,27 +438,19 @@ m4_define([b4_symbol_tag_comment],
|
||||
])
|
||||
|
||||
|
||||
# b4_symbol_action_location(SYMBOL-NUM, KIND)
|
||||
# -------------------------------------------
|
||||
# Report the location of the KIND action as FILE:LINE.
|
||||
m4_define([b4_symbol_action_location],
|
||||
[b4_symbol([$1], [$2_file]):b4_syncline([b4_symbol([$1], [$2_line])])])
|
||||
|
||||
|
||||
# b4_symbol_action(SYMBOL-NUM, KIND)
|
||||
# ----------------------------------
|
||||
# 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],
|
||||
[b4_symbol_if([$1], [has_$2],
|
||||
[b4_dollar_pushdef([(*yyvaluep)],
|
||||
b4_symbol_if([$1], [has_type],
|
||||
[m4_dquote(b4_symbol([$1], [type]))]),
|
||||
[$1],
|
||||
[],
|
||||
[(*yylocationp)])dnl
|
||||
b4_symbol_case_([$1])[]dnl
|
||||
b4_syncline([b4_symbol([$1], [$2_line])], ["b4_symbol([$1], [$2_file])"])
|
||||
_b4_symbol_case([$1])[]dnl
|
||||
b4_syncline([b4_symbol([$1], [$2_line])], [b4_symbol([$1], [$2_file])])dnl
|
||||
b4_symbol([$1], [$2])
|
||||
b4_syncline([@oline@], [@ofile@])
|
||||
b4_syncline([@oline@], [@ofile@])dnl
|
||||
break;
|
||||
|
||||
b4_dollar_popdef[]dnl
|
||||
@@ -470,7 +473,7 @@ m4_define([b4_symbol_actions],
|
||||
m4_ifval(m4_defn([b4_actions_]),
|
||||
[switch (m4_default([$2], [yytype]))
|
||||
{
|
||||
m4_defn([b4_actions_])
|
||||
m4_defn([b4_actions_])[]dnl
|
||||
default:
|
||||
break;
|
||||
}dnl
|
||||
@@ -479,10 +482,12 @@ m4_ifval(m4_defn([b4_actions_]),
|
||||
m4_popdef([b4_actions_])dnl
|
||||
])
|
||||
|
||||
# b4_symbol_case_(SYMBOL-NUM)
|
||||
# _b4_symbol_case(SYMBOL-NUM)
|
||||
# ---------------------------
|
||||
# Issue a "case NUM" for SYMBOL-NUM.
|
||||
m4_define([b4_symbol_case_],
|
||||
# Issue a "case NUM" for SYMBOL-NUM. Ends with its EOL to make it
|
||||
# easier to use with m4_map, but then, use []dnl to suppress the last
|
||||
# one.
|
||||
m4_define([_b4_symbol_case],
|
||||
[case b4_symbol([$1], [number]): b4_symbol_tag_comment([$1])])
|
||||
])
|
||||
|
||||
@@ -537,16 +542,16 @@ m4_define([b4_token_format],
|
||||
## Types. ##
|
||||
## ------- ##
|
||||
|
||||
# b4_type_action_(NUMS)
|
||||
# _b4_type_action(NUMS)
|
||||
# ---------------------
|
||||
# Run actions for the symbol NUMS that all have the same type-name.
|
||||
# Skip NUMS that have no type-name.
|
||||
#
|
||||
# To specify the action to run, define b4_dollar_dollar(NUMBER,
|
||||
# To specify the action to run, define b4_dollar_dollar(SYMBOL-NUM,
|
||||
# TAG, TYPE).
|
||||
m4_define([b4_type_action_],
|
||||
m4_define([_b4_type_action],
|
||||
[b4_symbol_if([$1], [has_type],
|
||||
[m4_map([ b4_symbol_case_], [$@])[]dnl
|
||||
[m4_map([ _b4_symbol_case], [$@])[]dnl
|
||||
b4_dollar_dollar([b4_symbol([$1], [number])],
|
||||
[b4_symbol([$1], [tag])],
|
||||
[b4_symbol([$1], [type])]);
|
||||
@@ -574,12 +579,15 @@ m4_define([b4_basename],
|
||||
[m4_bpatsubst([$1], [^.*/\([^/]+\)/*$], [\1])])
|
||||
|
||||
|
||||
# b4_syncline(LINE, FILE)
|
||||
# -----------------------
|
||||
# b4_syncline(LINE, FILE)dnl
|
||||
# --------------------------
|
||||
# Should always be following by a dnl.
|
||||
#
|
||||
# Emit "#line LINE FILE /* __LINE__ __FILE__ */".
|
||||
m4_define([b4_syncline],
|
||||
[b4_flag_if([synclines],
|
||||
[b4_sync_start([$1], [$2]) b4_sync_end([__line__],
|
||||
[b4_basename(m4_quote(__file__))])[]dnl
|
||||
[b4_sync_start([$1], [$2])[]dnl
|
||||
b4_sync_end([__line__], [b4_basename(m4_quote(__file__))])
|
||||
])])
|
||||
|
||||
# b4_sync_start(LINE, FILE)
|
||||
@@ -591,7 +599,17 @@ m4_define([b4_sync_start], [b4_comment([$2:$1])])
|
||||
# -----------------------
|
||||
# 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([$2:$1])]
|
||||
)
|
||||
# This generates dependencies on the Bison skeletons hence lots of
|
||||
# useless 'git diff'. This location is useless for the regular
|
||||
# user (who does not care about the skeletons) and is actually not
|
||||
# useful for Bison developpers too (I, Akim, never used this to locate
|
||||
# the code in skeletons that generated output). So disable it
|
||||
# completely. If someone thinks this was actually useful, a %define
|
||||
# variable should be provided to control the level of verbosity of
|
||||
# '#line', in replacement of --no-lines.
|
||||
m4_define([b4_sync_end])
|
||||
|
||||
|
||||
# b4_user_code(USER-CODE)
|
||||
@@ -602,13 +620,15 @@ m4_define([b4_user_code],
|
||||
b4_syncline([@oline@], [@ofile@])])
|
||||
|
||||
|
||||
# b4_define_user_code(MACRO)
|
||||
# --------------------------
|
||||
# From b4_MACRO, build b4_user_MACRO that includes the synclines.
|
||||
# b4_define_user_code(MACRO, COMMENT)
|
||||
# -----------------------------------
|
||||
# From b4_MACRO, if defined, build b4_user_MACRO that includes the synclines.
|
||||
m4_define([b4_define_user_code],
|
||||
[m4_define([b4_user_$1],
|
||||
[b4_user_code([b4_$1])])])
|
||||
|
||||
[m4_ifdef([b4_$1],
|
||||
[m4_ifval([$2],
|
||||
[b4_comment([$2])
|
||||
])b4_user_code([b4_$1])])])])
|
||||
|
||||
# b4_user_actions
|
||||
# b4_user_initial_action
|
||||
@@ -618,9 +638,9 @@ m4_define([b4_define_user_code],
|
||||
# ----------------------
|
||||
# Macros that issue user code, ending with synclines.
|
||||
b4_define_user_code([actions])
|
||||
b4_define_user_code([initial_action])
|
||||
b4_define_user_code([post_prologue])
|
||||
b4_define_user_code([pre_prologue])
|
||||
b4_define_user_code([initial_action], [User initialization code.])
|
||||
b4_define_user_code([post_prologue], [Second part of user prologue.])
|
||||
b4_define_user_code([pre_prologue], [First part of user prologue.])
|
||||
b4_define_user_code([union_members])
|
||||
|
||||
|
||||
@@ -702,7 +722,7 @@ m4_define([b4_percent_define_use],
|
||||
# b4_percent_define_get([[foo]])
|
||||
m4_define([b4_percent_define_get],
|
||||
[b4_percent_define_use([$1])dnl
|
||||
b4_percent_define_ifdef_([$1],
|
||||
_b4_percent_define_ifdef([$1],
|
||||
[m4_indir([b4_percent_define(]$1[)])],
|
||||
[$2])])
|
||||
|
||||
@@ -711,7 +731,7 @@ b4_percent_define_ifdef_([$1],
|
||||
# Mimic muscle_percent_define_get_loc in ../src/muscle-tab.h exactly. That is,
|
||||
# if the %define variable VARIABLE is undefined, complain fatally since that's
|
||||
# a Bison or skeleton error. Otherwise, return its definition location in a
|
||||
# form approriate for the first two arguments of b4_warn_at, b4_complain_at, or
|
||||
# form appropriate for the first two arguments of b4_warn_at, b4_complain_at, or
|
||||
# b4_fatal_at. 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.
|
||||
#
|
||||
@@ -739,8 +759,10 @@ m4_define([b4_percent_define_get_kind],
|
||||
[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)dnl
|
||||
# -------------------------------------------
|
||||
# Should always be following by a dnl.
|
||||
#
|
||||
# Mimic muscle_percent_define_get_syncline in ../src/muscle-tab.h exactly.
|
||||
# That is, if the %define variable VARIABLE is undefined, complain fatally
|
||||
# since that's a Bison or skeleton error. Otherwise, return its definition
|
||||
@@ -756,15 +778,15 @@ m4_define([b4_percent_define_get_syncline],
|
||||
[m4_indir([b4_percent_define_syncline(]$1[)])],
|
||||
[b4_fatal([[$0: undefined %%define variable '%s']], [$1])])])
|
||||
|
||||
# b4_percent_define_ifdef_(VARIABLE, IF-TRUE, [IF-FALSE])
|
||||
# _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_],
|
||||
# _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])])
|
||||
@@ -780,11 +802,44 @@ m4_define([b4_percent_define_ifdef_],
|
||||
#
|
||||
# b4_percent_define_ifdef([[foo]], [[it's defined]], [[it's undefined]])
|
||||
m4_define([b4_percent_define_ifdef],
|
||||
[b4_percent_define_ifdef_([$1],
|
||||
[_b4_percent_define_ifdef([$1],
|
||||
[b4_percent_define_use([$1])$2],
|
||||
[$3])])
|
||||
|
||||
|
||||
# b4_percent_define_check_file_complain(VARIABLE)
|
||||
# -----------------------------------------------
|
||||
# Warn about %define variable VARIABLE having an incorrect
|
||||
# value.
|
||||
m4_define([b4_percent_define_check_file_complain],
|
||||
[b4_complain_at(b4_percent_define_get_loc([$1]),
|
||||
[[%%define variable '%s' requires 'none' or '"..."' values]],
|
||||
[$1])])
|
||||
|
||||
|
||||
# b4_percent_define_check_file(MACRO, VARIABLE, DEFAULT)
|
||||
# ------------------------------------------------------
|
||||
# If the %define variable VARIABLE:
|
||||
# - is undefined, then if DEFAULT is non-empty, define MACRO to DEFAULT
|
||||
# - is a string, define MACRO to its value
|
||||
# - is the keyword 'none', do nothing
|
||||
# - otherwise, warn about the incorrect value.
|
||||
m4_define([b4_percent_define_check_file],
|
||||
[b4_percent_define_ifdef([$2],
|
||||
[m4_case(b4_percent_define_get_kind([$2]),
|
||||
[string],
|
||||
[m4_define([$1], b4_percent_define_get([$2]))],
|
||||
[keyword],
|
||||
[m4_if(b4_percent_define_get([$2]), [none], [],
|
||||
[b4_percent_define_check_file_complain([$2])])],
|
||||
[b4_percent_define_check_file_complain([$2])])
|
||||
],
|
||||
[m4_ifval([$3],
|
||||
[m4_define([$1], [$3])])])
|
||||
])
|
||||
|
||||
|
||||
|
||||
## --------- ##
|
||||
## Options. ##
|
||||
## --------- ##
|
||||
@@ -825,7 +880,7 @@ m4_define([b4_percent_define_flag_if],
|
||||
#
|
||||
# b4_percent_define_default([[foo]], [[default value]])
|
||||
m4_define([b4_percent_define_default],
|
||||
[b4_percent_define_ifdef_([$1], [],
|
||||
[_b4_percent_define_ifdef([$1], [],
|
||||
[m4_define([b4_percent_define(]$1[)], [$2])dnl
|
||||
m4_define([b4_percent_define_kind(]$1[)],
|
||||
[m4_default([$3], [keyword])])dnl
|
||||
@@ -840,26 +895,26 @@ m4_define([b4_percent_define_default],
|
||||
# Define b4_NAME_if that executes its $1 or $2 depending whether
|
||||
# VARIABLE was %defined. The characters '.' and `-' in VARIABLE are mapped
|
||||
# to '_'.
|
||||
m4_define([b4_percent_define_if_define_],
|
||||
m4_define([_b4_percent_define_if_define],
|
||||
[m4_define(m4_bpatsubst([b4_$1_if], [[-.]], [_]),
|
||||
[b4_percent_define_flag_if(m4_default([$2], [$1]),
|
||||
[$3], [$4])])])
|
||||
m4_define([b4_percent_define_if_define],
|
||||
[b4_percent_define_default([m4_default([$2], [$1])], [[false]])
|
||||
b4_percent_define_if_define_([$1], [$2], $[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],
|
||||
[_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]],
|
||||
[code], [[%%define variable '%s' requires '{...}' values]],
|
||||
[keyword], [[%%define variable '%s' requires keyword values]],
|
||||
[string], [[%%define variable '%s' requires '"..."' values]])],
|
||||
[string], [[%%define variable '%s' requires '"..."' values]])],
|
||||
[$1])])])dnl
|
||||
])
|
||||
|
||||
@@ -885,7 +940,7 @@ m4_define([b4_percent_define_check_values],
|
||||
[_b4_percent_define_check_values(b4_sublist)])])
|
||||
|
||||
m4_define([_b4_percent_define_check_values],
|
||||
[b4_percent_define_ifdef_([$1],
|
||||
[_b4_percent_define_ifdef([$1],
|
||||
[b4_percent_define_check_kind(]$1[, [keyword], [deprecated])dnl
|
||||
m4_pushdef([b4_good_value], [0])dnl
|
||||
m4_if($#, 1, [],
|
||||
@@ -923,8 +978,7 @@ m4_ifval([$1], [m4_define([b4_percent_code_bison_qualifiers(]$1[)])])dnl
|
||||
m4_ifdef(b4_macro_name,
|
||||
[b4_comment([m4_if([$#], [0], [[Unqualified %code]],
|
||||
[["%code ]$1["]])[ blocks.]])
|
||||
b4_user_code([m4_indir(b4_macro_name)])
|
||||
])dnl
|
||||
b4_user_code([m4_indir(b4_macro_name)])])dnl
|
||||
m4_popdef([b4_macro_name])])
|
||||
|
||||
# b4_percent_code_ifdef(QUALIFIER, IF-TRUE, [IF-FALSE])
|
||||
@@ -947,7 +1001,7 @@ m4_define([b4_percent_code_ifdef],
|
||||
# b4_parse_assert_if([IF-ASSERTIONS-ARE-USED], [IF-NOT])
|
||||
# b4_parse_trace_if([IF-DEBUG-TRACES-ARE-ENABLED], [IF-NOT])
|
||||
# b4_token_ctor_if([IF-YYLEX-RETURNS-A-TOKEN], [IF-NOT])
|
||||
# ----------------------------------------------
|
||||
# ----------------------------------------------------------
|
||||
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([parse.assert])
|
||||
@@ -1012,8 +1066,6 @@ b4_check_user_names_wrap([[code]], [[qualifier]])
|
||||
## ---------------- ##
|
||||
|
||||
# m4_define_default([b4_lex_param], []) dnl breaks other skeletons
|
||||
m4_define_default([b4_pre_prologue], [])
|
||||
m4_define_default([b4_post_prologue], [])
|
||||
m4_define_default([b4_epilogue], [])
|
||||
m4_define_default([b4_parse_param], [])
|
||||
|
||||
@@ -1026,10 +1078,10 @@ m4_define_default([b4_location_initial_line], [1])
|
||||
## Sanity checks. ##
|
||||
## --------------- ##
|
||||
|
||||
# api.location.prefix={...} (Java and C++).
|
||||
# api.location.type={...} (C, C++ and Java).
|
||||
b4_percent_define_check_kind([api.location.type], [code], [deprecated])
|
||||
|
||||
# api.position.prefix={...} (Java).
|
||||
# api.position.type={...} (Java).
|
||||
b4_percent_define_check_kind([api.position.type], [code], [deprecated])
|
||||
|
||||
# api.prefix >< %name-prefix.
|
||||
@@ -1061,3 +1113,6 @@ b4_percent_define_ifdef([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,7 +2,8 @@
|
||||
|
||||
# C++ skeleton dispatching for Bison.
|
||||
|
||||
# Copyright (C) 2006-2007, 2009-2013 Free Software Foundation, Inc.
|
||||
# Copyright (C) 2006-2007, 2009-2015, 2018-2019 Free Software
|
||||
# Foundation, Inc.
|
||||
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
@@ -17,10 +18,10 @@
|
||||
# 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_glr_if( [m4_define([b4_used_skeleton], [b4_pkgdatadir/[glr.cc]])])
|
||||
b4_nondeterministic_if([m4_define([b4_used_skeleton], [b4_pkgdatadir/[glr.cc]])])
|
||||
b4_glr_if( [m4_define([b4_used_skeleton], [b4_skeletonsdir/[glr.cc]])])
|
||||
b4_nondeterministic_if([m4_define([b4_used_skeleton], [b4_skeletonsdir/[glr.cc]])])
|
||||
|
||||
m4_define_default([b4_used_skeleton], [b4_pkgdatadir/[lalr1.cc]])
|
||||
m4_define_default([b4_used_skeleton], [b4_skeletonsdir/[lalr1.cc]])
|
||||
m4_define_default([b4_skeleton], ["b4_basename(b4_used_skeleton)"])
|
||||
|
||||
m4_include(b4_used_skeleton)
|
||||
+262
-143
@@ -2,7 +2,7 @@
|
||||
|
||||
# C++ skeleton for Bison
|
||||
|
||||
# Copyright (C) 2002-2013 Free Software Foundation, Inc.
|
||||
# Copyright (C) 2002-2019 Free Software Foundation, Inc.
|
||||
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
@@ -17,26 +17,86 @@
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
m4_include(b4_pkgdatadir/[c.m4])
|
||||
# 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_skeletonsdir/[c.m4])
|
||||
|
||||
b4_percent_define_check_kind([api.namespace], [code], [deprecated])
|
||||
b4_percent_define_check_kind([api.parser.class], [code], [deprecated])
|
||||
|
||||
|
||||
## ----- ##
|
||||
## C++. ##
|
||||
## ----- ##
|
||||
|
||||
# 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_comment([$1], [$2// ], [$2// ])])
|
||||
|
||||
## -------- ##
|
||||
## Checks. ##
|
||||
## -------- ##
|
||||
|
||||
b4_percent_define_check_kind([api.namespace], [code], [deprecated])
|
||||
b4_percent_define_check_kind([parser_class_name], [code], [deprecated])
|
||||
# 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])])])
|
||||
|
||||
|
||||
# b4_cxx_portability
|
||||
# ------------------
|
||||
m4_define([b4_cxx_portability],
|
||||
[#if defined __cplusplus
|
||||
# define YY_CPLUSPLUS __cplusplus
|
||||
#else
|
||||
# define YY_CPLUSPLUS 199711L
|
||||
#endif
|
||||
|
||||
// Support move semantics when possible.
|
||||
#if 201103L <= YY_CPLUSPLUS
|
||||
# define YY_MOVE std::move
|
||||
# define YY_MOVE_OR_COPY move
|
||||
# define YY_MOVE_REF(Type) Type&&
|
||||
# define YY_RVREF(Type) Type&&
|
||||
# define YY_COPY(Type) Type
|
||||
#else
|
||||
# define YY_MOVE
|
||||
# define YY_MOVE_OR_COPY copy
|
||||
# define YY_MOVE_REF(Type) Type&
|
||||
# define YY_RVREF(Type) const Type&
|
||||
# define YY_COPY(Type) const Type&
|
||||
#endif
|
||||
|
||||
// Support noexcept when possible.
|
||||
#if 201103L <= YY_CPLUSPLUS
|
||||
# define YY_NOEXCEPT noexcept
|
||||
# define YY_NOTHROW
|
||||
#else
|
||||
# define YY_NOEXCEPT
|
||||
# define YY_NOTHROW throw ()
|
||||
#endif
|
||||
|
||||
// Support constexpr when possible.
|
||||
#if 201703 <= YY_CPLUSPLUS
|
||||
# define YY_CONSTEXPR constexpr
|
||||
#else
|
||||
# define YY_CONSTEXPR
|
||||
#endif[]dnl
|
||||
])
|
||||
|
||||
|
||||
## ---------------- ##
|
||||
## Default values. ##
|
||||
## ---------------- ##
|
||||
|
||||
b4_percent_define_default([[parser_class_name]], [[parser]])
|
||||
b4_percent_define_default([[api.parser.class]], [[parser]])
|
||||
|
||||
# Don't do that so that we remember whether we're using a user
|
||||
# request, or the default value.
|
||||
@@ -73,7 +133,7 @@ m4_if(m4_bregexp(b4_namespace_ref, [^[ ]*$]), [-1], [],
|
||||
[[namespace reference is empty]])])
|
||||
|
||||
# Instead of assuming the C++ compiler will do it, Bison should reject any
|
||||
# invalid b4_namepsace_ref that would be converted to a valid
|
||||
# invalid b4_namespace_ref that would be converted to a valid
|
||||
# b4_namespace_open. The problem is that Bison doesn't always output
|
||||
# b4_namespace_ref to uncommented code but should reserve the ability to do so
|
||||
# in future releases without risking breaking any existing user grammars.
|
||||
@@ -87,13 +147,13 @@ m4_if(m4_bregexp(b4_namespace_ref, [::[ ]*$]), [-1], [],
|
||||
[[namespace reference has a trailing "::"]])])
|
||||
|
||||
m4_define([b4_namespace_open],
|
||||
[b4_user_code([b4_percent_define_get_syncline([[api.namespace]])
|
||||
[b4_user_code([b4_percent_define_get_syncline([[api.namespace]])dnl
|
||||
[namespace ]m4_bpatsubst(m4_dquote(m4_bpatsubst(m4_dquote(b4_namespace_ref),
|
||||
[^\(.\)[ ]*::], [\1])),
|
||||
[::], [ { namespace ])[ {]])])
|
||||
|
||||
m4_define([b4_namespace_close],
|
||||
[b4_user_code([b4_percent_define_get_syncline([[api.namespace]])
|
||||
[b4_user_code([b4_percent_define_get_syncline([[api.namespace]])dnl
|
||||
m4_bpatsubst(m4_dquote(m4_bpatsubst(m4_dquote(b4_namespace_ref[ ]),
|
||||
[^\(.\)[ ]*\(::\)?\([^][:]\|:[^:]\)*],
|
||||
[\1])),
|
||||
@@ -134,7 +194,7 @@ m4_define([b4_value_type_declare],
|
||||
[union\|union-directive],
|
||||
[[ union semantic_type
|
||||
{
|
||||
]b4_user_union_members[
|
||||
]b4_user_union_members[
|
||||
};]])])dnl
|
||||
])
|
||||
|
||||
@@ -156,7 +216,18 @@ m4_define([b4_public_types_declare],
|
||||
/// Syntax errors thrown from user actions.
|
||||
struct syntax_error : std::runtime_error
|
||||
{
|
||||
syntax_error (]b4_locations_if([const location_type& l, ])[const std::string& m);]b4_locations_if([
|
||||
syntax_error (]b4_locations_if([const location_type& l, ])[const std::string& m)
|
||||
: std::runtime_error (m)]b4_locations_if([
|
||||
, location (l)])[
|
||||
{}
|
||||
|
||||
syntax_error (const syntax_error& s)
|
||||
: std::runtime_error (s.what ())]b4_locations_if([
|
||||
, location (s.location)])[
|
||||
{}
|
||||
|
||||
~syntax_error () YY_NOEXCEPT YY_NOTHROW;]b4_locations_if([
|
||||
|
||||
location_type location;])[
|
||||
};
|
||||
|
||||
@@ -169,16 +240,26 @@ m4_define([b4_public_types_declare],
|
||||
/// (External) token type, as returned by yylex.
|
||||
typedef token::yytokentype token_type;
|
||||
|
||||
/// Internal symbol number.
|
||||
/// Symbol type: an internal symbol number.
|
||||
typedef int symbol_number_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.
|
||||
|
||||
# b4_symbol_type_define
|
||||
# ---------------------
|
||||
# Define symbol_type, the external type for symbols used for symbol
|
||||
# constructors.
|
||||
m4_define([b4_symbol_type_define],
|
||||
[[ /// A complete symbol.
|
||||
///
|
||||
/// Expects its Base type to provide access to the symbol type
|
||||
/// via type_get().
|
||||
/// via type_get ().
|
||||
///
|
||||
/// Provide access to semantic value]b4_locations_if([ and location])[.
|
||||
template <typename Base>
|
||||
@@ -188,23 +269,57 @@ m4_define([b4_public_types_declare],
|
||||
typedef Base super_type;
|
||||
|
||||
/// Default constructor.
|
||||
basic_symbol ();
|
||||
basic_symbol ()
|
||||
: value ()]b4_locations_if([
|
||||
, location ()])[
|
||||
{}
|
||||
|
||||
#if 201103L <= YY_CPLUSPLUS
|
||||
/// Move constructor.
|
||||
basic_symbol (basic_symbol&& that);
|
||||
#endif
|
||||
|
||||
/// Copy constructor.
|
||||
basic_symbol (const basic_symbol& other);
|
||||
]b4_variant_if([[
|
||||
basic_symbol (const basic_symbol& that);]b4_variant_if([[
|
||||
|
||||
/// Constructor for valueless symbols, and symbols from each type.
|
||||
]b4_type_foreach([b4_basic_symbol_constructor_declare])], [[
|
||||
]b4_type_foreach([b4_basic_symbol_constructor_define])], [[
|
||||
/// Constructor for valueless symbols.
|
||||
basic_symbol (typename Base::kind_type t]b4_locations_if([,
|
||||
const location_type& l])[);]])[
|
||||
YY_MOVE_REF (location_type) l])[);
|
||||
|
||||
/// Constructor for symbols with semantic value.
|
||||
basic_symbol (typename Base::kind_type t,
|
||||
const semantic_type& v]b4_locations_if([,
|
||||
const location_type& l])[);
|
||||
YY_RVREF (semantic_type) v]b4_locations_if([,
|
||||
YY_RVREF (location_type) l])[);
|
||||
]])[
|
||||
/// Destroy the symbol.
|
||||
~basic_symbol ()
|
||||
{
|
||||
clear ();
|
||||
}
|
||||
|
||||
~basic_symbol ();
|
||||
/// Destroy contents, and record that is empty.
|
||||
void clear ()
|
||||
{]b4_variant_if([[
|
||||
// User destructor.
|
||||
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 ();
|
||||
}
|
||||
|
||||
/// Whether empty.
|
||||
bool empty () const YY_NOEXCEPT;
|
||||
|
||||
/// Destructive move, \a s is emptied into this.
|
||||
void move (basic_symbol& s);
|
||||
@@ -216,8 +331,10 @@ m4_define([b4_public_types_declare],
|
||||
location_type location;])[
|
||||
|
||||
private:
|
||||
#if YY_CPLUSPLUS < 201103L
|
||||
/// Assignment operator.
|
||||
basic_symbol& operator= (const basic_symbol& other);
|
||||
basic_symbol& operator= (const basic_symbol& that);
|
||||
#endif
|
||||
};
|
||||
|
||||
/// Type access provider for token (enum) based symbols.
|
||||
@@ -226,8 +343,13 @@ m4_define([b4_public_types_declare],
|
||||
/// Default constructor.
|
||||
by_type ();
|
||||
|
||||
#if 201103L <= YY_CPLUSPLUS
|
||||
/// Move constructor.
|
||||
by_type (by_type&& that);
|
||||
#endif
|
||||
|
||||
/// Copy constructor.
|
||||
by_type (const by_type& other);
|
||||
by_type (const by_type& that);
|
||||
|
||||
/// The symbol type as needed by the constructor.
|
||||
typedef token_type kind_type;
|
||||
@@ -235,149 +357,150 @@ m4_define([b4_public_types_declare],
|
||||
/// Constructor from (external) token numbers.
|
||||
by_type (kind_type t);
|
||||
|
||||
/// Record that this symbol is empty.
|
||||
void clear ();
|
||||
|
||||
/// Steal the symbol type from \a that.
|
||||
void move (by_type& that);
|
||||
|
||||
/// The (internal) type number (corresponding to \a type).
|
||||
/// -1 when this symbol is empty.
|
||||
symbol_number_type type_get () const;
|
||||
/// \a empty when empty.
|
||||
symbol_number_type type_get () const YY_NOEXCEPT;
|
||||
|
||||
/// The token.
|
||||
token_type token () const;
|
||||
|
||||
enum { empty = 0 };
|
||||
token_type token () const YY_NOEXCEPT;
|
||||
|
||||
/// The symbol type.
|
||||
/// -1 when this symbol is empty.
|
||||
token_number_type 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;
|
||||
struct symbol_type : basic_symbol<by_type>
|
||||
{]b4_variant_if([[
|
||||
/// Superclass.
|
||||
typedef basic_symbol<by_type> super_type;
|
||||
|
||||
]b4_symbol_constructor_declare])
|
||||
/// Empty symbol.
|
||||
symbol_type () {}
|
||||
|
||||
/// Constructor for valueless symbols, and symbols from each type.
|
||||
]b4_type_foreach([_b4_token_constructor_define])dnl
|
||||
])[};
|
||||
]])
|
||||
|
||||
|
||||
# b4_public_types_define
|
||||
# ----------------------
|
||||
# b4_public_types_define(hh|cc)
|
||||
# -----------------------------
|
||||
# Provide the implementation needed by the public types.
|
||||
m4_define([b4_public_types_define],
|
||||
[[ inline
|
||||
]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([
|
||||
, location (l)])[
|
||||
{}
|
||||
|
||||
// basic_symbol.
|
||||
[[ // basic_symbol.
|
||||
#if 201103L <= YY_CPLUSPLUS
|
||||
template <typename Base>
|
||||
inline
|
||||
]b4_parser_class_name[::basic_symbol<Base>::basic_symbol ()
|
||||
: value ()
|
||||
{}
|
||||
]b4_parser_class[::basic_symbol<Base>::basic_symbol (basic_symbol&& that)
|
||||
: Base (std::move (that))
|
||||
, value (]b4_variant_if([], [std::move (that.value)]))b4_locations_if([
|
||||
, location (std::move (that.location))])[
|
||||
{]b4_variant_if([
|
||||
b4_symbol_variant([this->type_get ()], [value], [move],
|
||||
[std::move (that.value)])
|
||||
])[}
|
||||
#endif
|
||||
|
||||
template <typename Base>
|
||||
inline
|
||||
]b4_parser_class_name[::basic_symbol<Base>::basic_symbol (const basic_symbol& other)
|
||||
: Base (other)
|
||||
, value ()]b4_locations_if([
|
||||
, location (other.location)])[
|
||||
{
|
||||
]b4_variant_if([b4_symbol_variant([other.type_get ()], [value], [copy],
|
||||
[other.value])],
|
||||
[value = other.value;])[
|
||||
}
|
||||
]b4_parser_class[::basic_symbol<Base>::basic_symbol (const basic_symbol& that)
|
||||
: Base (that)
|
||||
, value (]b4_variant_if([], [that.value]))b4_locations_if([
|
||||
, location (that.location)])[
|
||||
{]b4_variant_if([
|
||||
b4_symbol_variant([this->type_get ()], [value], [copy],
|
||||
[YY_MOVE (that.value)])
|
||||
])[}
|
||||
|
||||
|
||||
template <typename Base>
|
||||
inline
|
||||
]b4_parser_class_name[::basic_symbol<Base>::basic_symbol (]b4_join(
|
||||
[typename Base::kind_type t],
|
||||
[const semantic_type& v],
|
||||
b4_locations_if([const location_type& l]))[)
|
||||
: Base (t)
|
||||
, 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])], [[
|
||||
]b4_variant_if([], [[
|
||||
/// Constructor for valueless symbols.
|
||||
template <typename Base>
|
||||
inline
|
||||
]b4_parser_class_name[::basic_symbol<Base>::basic_symbol (]b4_join(
|
||||
]b4_parser_class[::basic_symbol<Base>::basic_symbol (]b4_join(
|
||||
[typename Base::kind_type t],
|
||||
b4_locations_if([const location_type& l]))[)
|
||||
b4_locations_if([YY_MOVE_REF (location_type) l]))[)
|
||||
: Base (t)
|
||||
, value ()]b4_locations_if([
|
||||
, location (l)])[
|
||||
{}]])[
|
||||
{}
|
||||
|
||||
template <typename Base>
|
||||
inline
|
||||
]b4_parser_class_name[::basic_symbol<Base>::~basic_symbol ()
|
||||
]b4_parser_class[::basic_symbol<Base>::basic_symbol (]b4_join(
|
||||
[typename Base::kind_type t],
|
||||
[YY_RVREF (semantic_type) v],
|
||||
b4_locations_if([YY_RVREF (location_type) l]))[)
|
||||
: Base (t)
|
||||
, value (]b4_variant_if([], [YY_MOVE (v)])[)]b4_locations_if([
|
||||
, location (YY_MOVE (l))])[
|
||||
{]b4_variant_if([[
|
||||
// User destructor.
|
||||
symbol_number_type yytype = this->type_get ();
|
||||
switch (yytype)
|
||||
{
|
||||
]b4_symbol_foreach([b4_symbol_destructor])dnl
|
||||
[ default:
|
||||
break;
|
||||
}
|
||||
(void) v;
|
||||
]b4_symbol_variant([this->type_get ()], [value], [YY_MOVE_OR_COPY], [YY_MOVE (v)])])[}]])[
|
||||
|
||||
// Type destructor.
|
||||
]b4_symbol_variant([[yytype]], [[value]], [[template destroy]])])[
|
||||
template <typename Base>
|
||||
bool
|
||||
]b4_parser_class[::basic_symbol<Base>::empty () const YY_NOEXCEPT
|
||||
{
|
||||
return Base::type_get () == empty_symbol;
|
||||
}
|
||||
|
||||
template <typename Base>
|
||||
inline
|
||||
void
|
||||
]b4_parser_class_name[::basic_symbol<Base>::move (basic_symbol& s)
|
||||
]b4_parser_class[::basic_symbol<Base>::move (basic_symbol& s)
|
||||
{
|
||||
super_type::move(s);
|
||||
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;])[
|
||||
[YY_MOVE (s.value)])],
|
||||
[value = YY_MOVE (s.value);])[]b4_locations_if([
|
||||
location = YY_MOVE (s.location);])[
|
||||
}
|
||||
|
||||
// by_type.
|
||||
inline
|
||||
]b4_parser_class_name[::by_type::by_type ()
|
||||
: type (empty)
|
||||
]b4_inline([$1])b4_parser_class[::by_type::by_type ()
|
||||
: type (empty_symbol)
|
||||
{}
|
||||
|
||||
inline
|
||||
]b4_parser_class_name[::by_type::by_type (const by_type& other)
|
||||
: type (other.type)
|
||||
#if 201103L <= YY_CPLUSPLUS
|
||||
]b4_inline([$1])b4_parser_class[::by_type::by_type (by_type&& that)
|
||||
: type (that.type)
|
||||
{
|
||||
that.clear ();
|
||||
}
|
||||
#endif
|
||||
|
||||
]b4_inline([$1])b4_parser_class[::by_type::by_type (const by_type& that)
|
||||
: type (that.type)
|
||||
{}
|
||||
|
||||
inline
|
||||
]b4_parser_class_name[::by_type::by_type (token_type t)
|
||||
]b4_inline([$1])b4_parser_class[::by_type::by_type (token_type t)
|
||||
: type (yytranslate_ (t))
|
||||
{}
|
||||
|
||||
inline
|
||||
void
|
||||
]b4_parser_class_name[::by_type::move (by_type& that)
|
||||
]b4_inline([$1])[void
|
||||
]b4_parser_class[::by_type::clear ()
|
||||
{
|
||||
type = that.type;
|
||||
that.type = empty;
|
||||
type = empty_symbol;
|
||||
}
|
||||
|
||||
inline
|
||||
int
|
||||
]b4_parser_class_name[::by_type::type_get () const
|
||||
]b4_inline([$1])[void
|
||||
]b4_parser_class[::by_type::move (by_type& that)
|
||||
{
|
||||
type = that.type;
|
||||
that.clear ();
|
||||
}
|
||||
|
||||
]b4_inline([$1])[int
|
||||
]b4_parser_class[::by_type::type_get () const YY_NOEXCEPT
|
||||
{
|
||||
return type;
|
||||
}
|
||||
]b4_token_ctor_if([[
|
||||
inline
|
||||
]b4_parser_class_name[::token_type
|
||||
]b4_parser_class_name[::by_type::token () const
|
||||
]b4_inline([$1])b4_parser_class[::token_type
|
||||
]b4_parser_class[::by_type::token () const YY_NOEXCEPT
|
||||
{
|
||||
// YYTOKNUM[NUM] -- (External) token number corresponding to the
|
||||
// (internal) symbol number NUM (which must be that of a token). */
|
||||
@@ -387,44 +510,42 @@ m4_define([b4_public_types_define],
|
||||
{
|
||||
]b4_toknum[
|
||||
};
|
||||
return static_cast<token_type> (yytoken_number_[type]);
|
||||
return token_type (yytoken_number_[type]);
|
||||
}
|
||||
]])[]dnl
|
||||
b4_symbol_constructor_define])
|
||||
])
|
||||
|
||||
|
||||
# b4_symbol_constructor_declare
|
||||
# b4_symbol_constructor_define
|
||||
# -----------------------------
|
||||
# Declare/define symbol constructors for all the value types.
|
||||
# b4_token_constructor_define
|
||||
# ----------------------------
|
||||
# Define symbol constructors for all the value types.
|
||||
# Use at class-level. Redefined in variant.hh.
|
||||
m4_define([b4_symbol_constructor_declare], [])
|
||||
m4_define([b4_symbol_constructor_define], [])
|
||||
m4_define([b4_token_constructor_define], [])
|
||||
|
||||
|
||||
# b4_yytranslate_define
|
||||
# ---------------------
|
||||
# Define yytranslate_. Sometimes used in the header file,
|
||||
# b4_yytranslate_define(cc|hh)
|
||||
# ----------------------------
|
||||
# Define yytranslate_. Sometimes used in the header file ($1=hh),
|
||||
# sometimes in the cc file.
|
||||
m4_define([b4_yytranslate_define],
|
||||
[[ // Symbol number corresponding to token number t.
|
||||
inline
|
||||
]b4_parser_class_name[::token_number_type
|
||||
]b4_parser_class_name[::yytranslate_ (]b4_token_ctor_if([token_type],
|
||||
[ b4_inline([$1])b4_parser_class[::token_number_type
|
||||
]b4_parser_class[::yytranslate_ (]b4_token_ctor_if([token_type],
|
||||
[int])[ t)
|
||||
{
|
||||
// YYTRANSLATE[TOKEN-NUM] -- Symbol number corresponding to
|
||||
// TOKEN-NUM as returned by yylex.
|
||||
static
|
||||
const token_number_type
|
||||
translate_table[] =
|
||||
{
|
||||
]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[;
|
||||
|
||||
if (static_cast<int>(t) <= yyeof_)
|
||||
if (static_cast<int> (t) <= 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];
|
||||
else
|
||||
return undef_token_;
|
||||
@@ -434,15 +555,13 @@ m4_define([b4_yytranslate_define],
|
||||
|
||||
# b4_lhs_value([TYPE])
|
||||
# --------------------
|
||||
# Expansion of $<TYPE>$.
|
||||
m4_define([b4_lhs_value],
|
||||
[b4_symbol_value([yyval], [$1])])
|
||||
|
||||
|
||||
# b4_rhs_value(RULE-LENGTH, NUM, [TYPE])
|
||||
# b4_rhs_value(RULE-LENGTH, POS, [TYPE])
|
||||
# --------------------------------------
|
||||
# Expansion of $<TYPE>NUM, where the current rule has RULE-LENGTH
|
||||
# symbols on RHS.
|
||||
# FIXME: Dead code.
|
||||
m4_define([b4_rhs_value],
|
||||
[b4_symbol_value([yysemantic_stack_@{($1) - ($2)@}], [$3])])
|
||||
|
||||
@@ -454,9 +573,9 @@ m4_define([b4_lhs_location],
|
||||
[(yyloc)])
|
||||
|
||||
|
||||
# b4_rhs_location(RULE-LENGTH, NUM)
|
||||
# b4_rhs_location(RULE-LENGTH, POS)
|
||||
# ---------------------------------
|
||||
# Expansion of @NUM, where the current rule has RULE-LENGTH symbols
|
||||
# Expansion of @POS, where the current rule has RULE-LENGTH symbols
|
||||
# on RHS.
|
||||
m4_define([b4_rhs_location],
|
||||
[(yylocation_stack_@{($1) - ($2)@})])
|
||||
@@ -529,7 +648,7 @@ m4_define([b4_yylloc_default_define],
|
||||
{ \
|
||||
(Current).begin = (Current).end = YYRHSLOC (Rhs, 0).end; \
|
||||
} \
|
||||
while (/*CONSTCOND*/ false)
|
||||
while (false)
|
||||
# endif
|
||||
]])
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
# Common code for C-like languages (C, C++, Java, etc.)
|
||||
|
||||
# Copyright (C) 2012-2013 Free Software Foundation, Inc.
|
||||
# Copyright (C) 2012-2015, 2018-2019 Free Software Foundation, Inc.
|
||||
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
@@ -17,14 +17,14 @@
|
||||
# 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)
|
||||
# _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_],
|
||||
m4_define([_b4_comment],
|
||||
[$2[]m4_bpatsubst(m4_expand([[$1]]), [
|
||||
\(.\)], [
|
||||
$3\1])$4])
|
||||
@@ -34,30 +34,31 @@ $3\1])$4])
|
||||
# --------------------------
|
||||
# Put TEXT in comment. Prefix all the output lines with PREFIX.
|
||||
m4_define([b4_comment],
|
||||
[b4_comment_([$1], [$2/* ], [$2 ], [ */])])
|
||||
[_b4_comment([$1], [$2/* ], [$2 ], [ */])])
|
||||
|
||||
|
||||
|
||||
|
||||
# b4_dollar_dollar_(VALUE, FIELD, DEFAULT-FIELD)
|
||||
# ----------------------------------------------
|
||||
# _b4_dollar_dollar(VALUE, SYMBOL-NUM, 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
|
||||
# otherwise just VALUE. Be sure to pass "(VALUE)" if VALUE is a
|
||||
# pointer.
|
||||
m4_define([b4_dollar_dollar_],
|
||||
m4_define([_b4_dollar_dollar],
|
||||
[b4_symbol_value([$1],
|
||||
m4_if([$2], [[]],
|
||||
[[$3]], [[$2]]))])
|
||||
[$2],
|
||||
m4_if([$3], [[]],
|
||||
[[$4]], [[$3]]))])
|
||||
|
||||
# b4_dollar_pushdef(VALUE-POINTER, DEFAULT-FIELD, LOCATION)
|
||||
# b4_dollar_pushdef(VALUE-POINTER, SYMBOL-NUM, [TYPE_TAG], LOCATION)
|
||||
# b4_dollar_popdef
|
||||
# ---------------------------------------------------------
|
||||
# Define b4_dollar_dollar for VALUE and DEFAULT-FIELD,
|
||||
# ------------------------------------------------------------------
|
||||
# Define b4_dollar_dollar for VALUE-POINTER 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
|
||||
[_b4_dollar_dollar([$1], [$2], m4_dquote($][1), [$3])])dnl
|
||||
m4_pushdef([b4_at_dollar], [$4])dnl
|
||||
])
|
||||
m4_define([b4_dollar_popdef],
|
||||
[m4_popdef([b4_at_dollar])dnl
|
||||
@@ -2,7 +2,8 @@
|
||||
|
||||
# C skeleton dispatching for Bison.
|
||||
|
||||
# Copyright (C) 2006-2007, 2009-2013 Free Software Foundation, Inc.
|
||||
# Copyright (C) 2006-2007, 2009-2015, 2018-2019 Free Software
|
||||
# Foundation, Inc.
|
||||
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
@@ -17,10 +18,10 @@
|
||||
# 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_glr_if( [m4_define([b4_used_skeleton], [b4_pkgdatadir/[glr.c]])])
|
||||
b4_nondeterministic_if([m4_define([b4_used_skeleton], [b4_pkgdatadir/[glr.c]])])
|
||||
b4_glr_if( [m4_define([b4_used_skeleton], [b4_skeletonsdir/[glr.c]])])
|
||||
b4_nondeterministic_if([m4_define([b4_used_skeleton], [b4_skeletonsdir/[glr.c]])])
|
||||
|
||||
m4_define_default([b4_used_skeleton], [b4_pkgdatadir/[yacc.c]])
|
||||
m4_define_default([b4_used_skeleton], [b4_skeletonsdir/[yacc.c]])
|
||||
m4_define_default([b4_skeleton], ["b4_basename(b4_used_skeleton)"])
|
||||
|
||||
m4_include(b4_used_skeleton)
|
||||
+150
-76
@@ -2,7 +2,8 @@
|
||||
|
||||
# C M4 Macros for Bison.
|
||||
|
||||
# Copyright (C) 2002, 2004-2013 Free Software Foundation, Inc.
|
||||
# Copyright (C) 2002, 2004-2015, 2018-2019 Free Software Foundation,
|
||||
# Inc.
|
||||
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
@@ -17,7 +18,7 @@
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
m4_include(b4_pkgdatadir/[c-like.m4])
|
||||
m4_include(b4_skeletonsdir/[c-like.m4])
|
||||
|
||||
# b4_tocpp(STRING)
|
||||
# ----------------
|
||||
@@ -97,7 +98,8 @@ m4_define([b4_api_PREFIX],
|
||||
m4_define_default([b4_prefix], [b4_api_prefix])
|
||||
|
||||
# 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]])
|
||||
|
||||
|
||||
## ------------------------ ##
|
||||
@@ -171,10 +173,10 @@ m4_define([b4_int_type],
|
||||
[m4_if(b4_ints_in($@, [0], [255]), [1], [unsigned char],
|
||||
b4_ints_in($@, [-128], [127]), [1], [signed char],
|
||||
|
||||
b4_ints_in($@, [0], [65535]), [1], [unsigned short int],
|
||||
b4_ints_in($@, [-32768], [32767]), [1], [short int],
|
||||
b4_ints_in($@, [0], [65535]), [1], [unsigned short],
|
||||
b4_ints_in($@, [-32768], [32767]), [1], [short],
|
||||
|
||||
m4_eval([0 <= $1]), [1], [unsigned int],
|
||||
m4_eval([0 <= $1]), [1], [unsigned],
|
||||
|
||||
[int])])
|
||||
|
||||
@@ -203,42 +205,94 @@ m4_define([b4_table_value_equals],
|
||||
## Compiler issues. ##
|
||||
## ----------------- ##
|
||||
|
||||
# b4_attribute_define
|
||||
# -------------------
|
||||
# Provide portability for __attribute__.
|
||||
# b4_attribute_define([noreturn])
|
||||
# -------------------------------
|
||||
# Provide portable compiler "attributes". If "noreturn" is passed, define
|
||||
# _Noreturn.
|
||||
m4_define([b4_attribute_define],
|
||||
[#ifndef __attribute__
|
||||
/* This feature is available in gcc versions 2.5 and later. */
|
||||
# if (! defined __GNUC__ || __GNUC__ < 2 \
|
||||
|| (__GNUC__ == 2 && __GNUC_MINOR__ < 5))
|
||||
# define __attribute__(Spec) /* empty */
|
||||
[[#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
|
||||
|
||||
/* Suppress unused-variable warnings by "using" E. */
|
||||
#ifndef YY_ATTRIBUTE_PURE
|
||||
# define YY_ATTRIBUTE_PURE YY_ATTRIBUTE ((__pure__))
|
||||
#endif
|
||||
|
||||
#ifndef YY_ATTRIBUTE_UNUSED
|
||||
# define YY_ATTRIBUTE_UNUSED YY_ATTRIBUTE ((__unused__))
|
||||
#endif
|
||||
|
||||
]m4_bmatch([$1], [\bnoreturn\b], [[/* The _Noreturn keyword of C11. */
|
||||
]dnl This is an exact copy of lib/_Noreturn.h.
|
||||
[#ifndef _Noreturn
|
||||
# if (defined __cplusplus \
|
||||
&& ((201103 <= __cplusplus && !(__GNUC__ == 4 && __GNUC_MINOR__ == 7)) \
|
||||
|| (defined _MSC_VER && 1900 <= _MSC_VER)))
|
||||
# define _Noreturn [[noreturn]]
|
||||
# elif ((!defined __cplusplus || defined __clang__) \
|
||||
&& (201112 <= (defined __STDC_VERSION__ ? __STDC_VERSION__ : 0) \
|
||||
|| 4 < __GNUC__ + (7 <= __GNUC_MINOR__)))
|
||||
/* _Noreturn works as-is. */
|
||||
# elif 2 < __GNUC__ + (8 <= __GNUC_MINOR__) || 0x5110 <= __SUNPRO_C
|
||||
# define _Noreturn __attribute__ ((__noreturn__))
|
||||
# elif 1200 <= (defined _MSC_VER ? _MSC_VER : 0)
|
||||
# define _Noreturn __declspec (noreturn)
|
||||
# else
|
||||
# define _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
|
||||
])
|
||||
|
||||
|
||||
## ---------##
|
||||
## Values. ##
|
||||
## ---------##
|
||||
#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
|
||||
]])
|
||||
|
||||
|
||||
# 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).
|
||||
#
|
||||
# In C++ pre C++11 it is standard practice to use 0 (not NULL) for the
|
||||
# null pointer. In C, prefer ((void*)0) to avoid having to include stdlib.h.
|
||||
m4_define([b4_null_define],
|
||||
[# ifndef YY_NULL
|
||||
# if defined __cplusplus && 201103L <= __cplusplus
|
||||
# define YY_NULL nullptr
|
||||
[# ifndef YY_NULLPTR
|
||||
# if defined __cplusplus
|
||||
# if 201103L <= __cplusplus
|
||||
# define YY_NULLPTR nullptr
|
||||
# else
|
||||
# define YY_NULLPTR 0
|
||||
# endif
|
||||
# else
|
||||
# define YY_NULL 0
|
||||
# define YY_NULLPTR ((void*)0)
|
||||
# endif
|
||||
# endif[]dnl
|
||||
])
|
||||
@@ -247,7 +301,13 @@ m4_define([b4_null_define],
|
||||
# b4_null
|
||||
# -------
|
||||
# Return a null pointer constant.
|
||||
m4_define([b4_null], [YY_NULL])
|
||||
m4_define([b4_null], [YY_NULLPTR])
|
||||
|
||||
|
||||
|
||||
## ---------##
|
||||
## Values. ##
|
||||
## ---------##
|
||||
|
||||
# b4_integral_parser_table_define(TABLE-NAME, CONTENT, COMMENT)
|
||||
# -------------------------------------------------------------
|
||||
@@ -318,15 +378,17 @@ m4_define([b4_token_enums_defines],
|
||||
## ----------------- ##
|
||||
|
||||
|
||||
# b4_symbol_value(VAL, [TYPE])
|
||||
# ----------------------------
|
||||
# Given a semantic value VAL ($$, $1 etc.), extract its value of type
|
||||
# TYPE if TYPE is given, otherwise just return VAL. The result can be
|
||||
# used safetly, it is put in parens to avoid nasty precedence issues.
|
||||
# TYPE is *not* put in braces, provide some if needed.
|
||||
# b4_symbol_value(VAL, [SYMBOL-NUM], [TYPE-TAG])
|
||||
# ----------------------------------------------
|
||||
# See README.
|
||||
m4_define([b4_symbol_value],
|
||||
[($1[]m4_ifval([$2], [.$2]))])
|
||||
|
||||
[m4_ifval([$3],
|
||||
[($1.$3)],
|
||||
[m4_ifval([$2],
|
||||
[b4_symbol_if([$2], [has_type],
|
||||
[($1.b4_symbol([$2], [type]))],
|
||||
[$1])],
|
||||
[$1])])])
|
||||
|
||||
|
||||
## ---------------------- ##
|
||||
@@ -412,7 +474,7 @@ m4_define([b4_sync_start], [[#]line $1 $2])
|
||||
m4_define([b4_case],
|
||||
[ case $1:
|
||||
$2
|
||||
b4_syncline([@oline@], [@ofile@])
|
||||
b4_syncline([@oline@], [@ofile@])dnl
|
||||
break;])
|
||||
|
||||
|
||||
@@ -420,8 +482,9 @@ b4_syncline([@oline@], [@ofile@])
|
||||
# ------------------------------------
|
||||
m4_define([b4_predicate_case],
|
||||
[ case $1:
|
||||
if (! ($2)) YYERROR;
|
||||
b4_syncline([@oline@], [@ofile@])
|
||||
if (! (
|
||||
$2)) YYERROR;
|
||||
b4_syncline([@oline@], [@ofile@])dnl
|
||||
break;])
|
||||
|
||||
|
||||
@@ -446,7 +509,9 @@ m4_ifset([b4_parse_param], [, b4_parse_param]))[
|
||||
yymsg = "Deleting";
|
||||
YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);
|
||||
|
||||
YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
|
||||
]b4_symbol_actions([destructor])[
|
||||
YY_IGNORE_MAYBE_UNINITIALIZED_END
|
||||
}]dnl
|
||||
])
|
||||
|
||||
@@ -456,54 +521,56 @@ m4_ifset([b4_parse_param], [, b4_parse_param]))[
|
||||
# Define the "yy_symbol_print" function.
|
||||
m4_define_default([b4_yy_symbol_print_define],
|
||||
[[
|
||||
/*--------------------------------.
|
||||
| Print this symbol on YYOUTPUT. |
|
||||
`--------------------------------*/
|
||||
/*-----------------------------------.
|
||||
| Print this symbol's value on YYO. |
|
||||
`-----------------------------------*/
|
||||
|
||||
]b4_function_define([yy_symbol_value_print],
|
||||
[static void],
|
||||
[[FILE *yyoutput], [yyoutput]],
|
||||
[[FILE *yyo], [yyo]],
|
||||
[[int yytype], [yytype]],
|
||||
[[YYSTYPE const * const yyvaluep], [yyvaluep]][]dnl
|
||||
b4_locations_if([, [[YYLTYPE const * const yylocationp], [yylocationp]]])[]dnl
|
||||
m4_ifset([b4_parse_param], [, b4_parse_param]))[
|
||||
{
|
||||
FILE *yyo = yyoutput;
|
||||
]b4_parse_param_use([yyo], [yylocationp])dnl
|
||||
FILE *yyoutput = yyo;
|
||||
]b4_parse_param_use([yyoutput], [yylocationp])dnl
|
||||
[ if (!yyvaluep)
|
||||
return;]
|
||||
dnl glr.c does not feature yytoknum.
|
||||
m4_if(b4_skeleton, ["yacc.c"],
|
||||
[[# ifdef YYPRINT
|
||||
if (yytype < YYNTOKENS)
|
||||
YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
|
||||
YYPRINT (yyo, yytoknum[yytype], *yyvaluep);
|
||||
# endif
|
||||
]])dnl
|
||||
b4_symbol_actions([printer])[
|
||||
}
|
||||
b4_percent_code_get([[pre-printer]])dnl
|
||||
b4_symbol_actions([printer])
|
||||
b4_percent_code_get([[post-printer]])dnl
|
||||
[}
|
||||
|
||||
|
||||
/*--------------------------------.
|
||||
| Print this symbol on YYOUTPUT. |
|
||||
`--------------------------------*/
|
||||
/*---------------------------.
|
||||
| Print this symbol on YYO. |
|
||||
`---------------------------*/
|
||||
|
||||
]b4_function_define([yy_symbol_print],
|
||||
[static void],
|
||||
[[FILE *yyoutput], [yyoutput]],
|
||||
[[FILE *yyo], [yyo]],
|
||||
[[int yytype], [yytype]],
|
||||
[[YYSTYPE const * const yyvaluep], [yyvaluep]][]dnl
|
||||
b4_locations_if([, [[YYLTYPE const * const yylocationp], [yylocationp]]])[]dnl
|
||||
m4_ifset([b4_parse_param], [, b4_parse_param]))[
|
||||
{
|
||||
YYFPRINTF (yyoutput, "%s %s (",
|
||||
YYFPRINTF (yyo, "%s %s (",
|
||||
yytype < YYNTOKENS ? "token" : "nterm", yytname[yytype]);
|
||||
|
||||
]b4_locations_if([ YY_LOCATION_PRINT (yyoutput, *yylocationp);
|
||||
YYFPRINTF (yyoutput, ": ");
|
||||
]b4_locations_if([ YY_LOCATION_PRINT (yyo, *yylocationp);
|
||||
YYFPRINTF (yyo, ": ");
|
||||
])dnl
|
||||
[ yy_symbol_value_print (yyoutput, yytype, yyvaluep]dnl
|
||||
[ yy_symbol_value_print (yyo, yytype, yyvaluep]dnl
|
||||
b4_locations_if([, yylocationp])[]b4_user_args[);
|
||||
YYFPRINTF (yyoutput, ")");
|
||||
YYFPRINTF (yyo, ")");
|
||||
}]dnl
|
||||
])
|
||||
|
||||
@@ -520,15 +587,15 @@ b4_locations_if([, yylocationp])[]b4_user_args[);
|
||||
# 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 with a field of that type,
|
||||
# and extend the symbol's "type" field to point to the field name,
|
||||
# instead of the type name.
|
||||
# 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_user_union_members],
|
||||
m4_append([b4_union_members],
|
||||
m4_expand([
|
||||
b4_symbol_tag_comment([$1])dnl
|
||||
b4_symbol([$1], [type]) b4_symbol([$1], [type_tag]);]))
|
||||
@@ -546,14 +613,17 @@ m4_define([b4_type_define_tag],
|
||||
])
|
||||
|
||||
|
||||
# b4_symbol_value_union(VAL, [TYPE])
|
||||
# ----------------------------------
|
||||
# b4_symbol_value_union(VAL, SYMBOL-NUM, [TYPE])
|
||||
# ----------------------------------------------
|
||||
# Same of b4_symbol_value, but when api.value.type=union.
|
||||
m4_define([b4_symbol_value_union],
|
||||
[m4_ifval([$2],
|
||||
[(*($2*)(&$1))],
|
||||
[$1])])
|
||||
])
|
||||
[m4_ifval([$3],
|
||||
[(*($3*)(&$1))],
|
||||
[m4_ifval([$2],
|
||||
[b4_symbol_if([$2], [has_type],
|
||||
[($1.b4_symbol([$2], [type_tag]))],
|
||||
[$1])],
|
||||
[$1])])])
|
||||
|
||||
|
||||
# b4_value_type_setup_union
|
||||
@@ -568,10 +638,9 @@ m4_copy_force([b4_symbol_value_union], [b4_symbol_value])
|
||||
])
|
||||
|
||||
|
||||
# ---------------- #
|
||||
# api.value.type. #
|
||||
# ---------------- #
|
||||
|
||||
# -------------------------- #
|
||||
# api.value.type = variant. #
|
||||
# -------------------------- #
|
||||
|
||||
# b4_value_type_setup_variant
|
||||
# ---------------------------
|
||||
@@ -646,11 +715,13 @@ typedef ]b4_percent_define_get([[api.value.type]])[ ]b4_api_PREFIX[STYPE;
|
||||
[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
|
||||
typedef union ]b4_union_name[ ]b4_api_PREFIX[STYPE;
|
||||
union ]b4_union_name[
|
||||
]b4_percent_define_get_syncline([[api.value.union.name]])dnl
|
||||
[union ]b4_percent_define_get([[api.value.union.name]])[
|
||||
{
|
||||
]b4_user_union_members[
|
||||
};
|
||||
]b4_percent_define_get_syncline([[api.value.union.name]])dnl
|
||||
[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
|
||||
@@ -661,7 +732,10 @@ union ]b4_union_name[
|
||||
# -----------------------
|
||||
m4_define([b4_location_type_define],
|
||||
[[/* Location type. */
|
||||
#if ! defined ]b4_api_PREFIX[LTYPE && ! defined ]b4_api_PREFIX[LTYPE_IS_DECLARED
|
||||
]b4_percent_define_ifdef([[api.location.type]],
|
||||
[[typedef ]b4_percent_define_get([[api.location.type]])[ ]b4_api_PREFIX[LTYPE;
|
||||
]],
|
||||
[[#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
|
||||
{
|
||||
@@ -673,7 +747,7 @@ struct ]b4_api_PREFIX[LTYPE
|
||||
# define ]b4_api_PREFIX[LTYPE_IS_DECLARED 1
|
||||
# define ]b4_api_PREFIX[LTYPE_IS_TRIVIAL 1
|
||||
#endif
|
||||
]])
|
||||
]])])
|
||||
|
||||
|
||||
# b4_declare_yylstype
|
||||
@@ -762,13 +836,13 @@ m4_define([b4_yy_location_print_define],
|
||||
|
||||
/* Print *YYLOCP on YYO. Private, do not rely on its existence. */
|
||||
|
||||
__attribute__((__unused__))
|
||||
YY_ATTRIBUTE_UNUSED
|
||||
]b4_function_define([yy_location_print_],
|
||||
[static unsigned],
|
||||
[static int],
|
||||
[[FILE *yyo], [yyo]],
|
||||
[[YYLTYPE const * const yylocp], [yylocp]])[
|
||||
{
|
||||
unsigned res = 0;
|
||||
int res = 0;
|
||||
int end_col = 0 != yylocp->last_column ? yylocp->last_column - 1 : 0;
|
||||
if (0 <= yylocp->first_line)
|
||||
{
|
||||
@@ -0,0 +1,26 @@
|
||||
-*- Autoconf -*-
|
||||
|
||||
# D skeleton dispatching for Bison.
|
||||
|
||||
# Copyright (C) 2018-2019 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_glr_if( [b4_complain([%%glr-parser not supported for D])])
|
||||
b4_nondeterministic_if([b4_complain([%%nondeterministic-parser not supported for D])])
|
||||
|
||||
m4_define_default([b4_used_skeleton], [b4_skeletonsdir/[lalr1.d]])
|
||||
m4_define_default([b4_skeleton], ["b4_basename(b4_used_skeleton)"])
|
||||
|
||||
m4_include(b4_used_skeleton)
|
||||
@@ -0,0 +1,333 @@
|
||||
-*- Autoconf -*-
|
||||
|
||||
# D language support for Bison
|
||||
|
||||
# Copyright (C) 2018-2019 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_list2(LIST1, LIST2)
|
||||
# ----------------------
|
||||
# Join two lists with a comma if necessary.
|
||||
m4_define([b4_list2],
|
||||
[$1[]m4_ifval(m4_quote($1), [m4_ifval(m4_quote($2), [[, ]])])[]$2])
|
||||
|
||||
|
||||
# b4_percent_define_get3(DEF, PRE, POST, NOT)
|
||||
# -------------------------------------------
|
||||
# Expand to the value of DEF surrounded by PRE and POST if it's %define'ed,
|
||||
# otherwise NOT.
|
||||
m4_define([b4_percent_define_get3],
|
||||
[m4_ifval(m4_quote(b4_percent_define_get([$1])),
|
||||
[$2[]b4_percent_define_get([$1])[]$3], [$4])])
|
||||
|
||||
|
||||
# b4_flag_value(BOOLEAN-FLAG)
|
||||
# ---------------------------
|
||||
m4_define([b4_flag_value], [b4_flag_if([$1], [true], [false])])
|
||||
|
||||
|
||||
# b4_parser_class_declaration
|
||||
# ---------------------------
|
||||
# The declaration of the parser class ("class YYParser"), with all its
|
||||
# qualifiers/annotations.
|
||||
b4_percent_define_default([[api.parser.abstract]], [[false]])
|
||||
b4_percent_define_default([[api.parser.final]], [[false]])
|
||||
b4_percent_define_default([[api.parser.public]], [[false]])
|
||||
|
||||
m4_define([b4_parser_class_declaration],
|
||||
[b4_percent_define_get3([api.parser.annotations], [], [ ])dnl
|
||||
b4_percent_define_flag_if([api.parser.public], [public ])dnl
|
||||
b4_percent_define_flag_if([api.parser.abstract], [abstract ])dnl
|
||||
b4_percent_define_flag_if([api.parser.final], [final ])dnl
|
||||
[class ]b4_parser_class[]dnl
|
||||
b4_percent_define_get3([api.parser.extends], [ extends ])dnl
|
||||
b4_percent_define_get3([api.parser.implements], [ implements ])])
|
||||
|
||||
|
||||
# b4_lexer_if(TRUE, FALSE)
|
||||
# ------------------------
|
||||
m4_define([b4_lexer_if],
|
||||
[b4_percent_code_ifdef([[lexer]], [$1], [$2])])
|
||||
|
||||
|
||||
# b4_position_type_if(TRUE, FALSE)
|
||||
# --------------------------------
|
||||
m4_define([b4_position_type_if],
|
||||
[b4_percent_define_ifdef([[position_type]], [$1], [$2])])
|
||||
|
||||
|
||||
# b4_location_type_if(TRUE, FALSE)
|
||||
# --------------------------------
|
||||
m4_define([b4_location_type_if],
|
||||
[b4_percent_define_ifdef([[location_type]], [$1], [$2])])
|
||||
|
||||
|
||||
# b4_locations_if(TRUE, FALSE)
|
||||
# ----------------------------
|
||||
m4_define([b4_locations_if],
|
||||
[m4_if(b4_locations_flag, 1, [$1], [$2])])
|
||||
|
||||
|
||||
# b4_identification
|
||||
# -----------------
|
||||
m4_define([b4_identification],
|
||||
[/** Version number for the Bison executable that generated this parser. */
|
||||
public static immutable string yy_bison_version = "b4_version";
|
||||
|
||||
/** Name of the skeleton that generated this parser. */
|
||||
public static immutable string yy_bison_skeleton = b4_skeleton;
|
||||
])
|
||||
|
||||
|
||||
## ------------ ##
|
||||
## Data types. ##
|
||||
## ------------ ##
|
||||
|
||||
# b4_int_type(MIN, MAX)
|
||||
# ---------------------
|
||||
# Return the smallest int type able to handle numbers ranging from
|
||||
# MIN to MAX (included).
|
||||
m4_define([b4_int_type],
|
||||
[m4_if(b4_ints_in($@, [-128], [127]), [1], [byte],
|
||||
b4_ints_in($@, [-32768], [32767]), [1], [short],
|
||||
[int])])
|
||||
|
||||
# b4_int_type_for(NAME)
|
||||
# ---------------------
|
||||
# Return the smallest int type able to handle numbers ranging from
|
||||
# `NAME_min' to `NAME_max' (included).
|
||||
m4_define([b4_int_type_for],
|
||||
[b4_int_type($1_min, $1_max)])
|
||||
|
||||
# b4_null
|
||||
# -------
|
||||
m4_define([b4_null], [null])
|
||||
|
||||
|
||||
# b4_integral_parser_table_define(NAME, DATA, COMMENT)
|
||||
#-----------------------------------------------------
|
||||
# Define "yy<TABLE-NAME>" whose contents is CONTENT.
|
||||
m4_define([b4_integral_parser_table_define],
|
||||
[m4_ifvaln([$3], [b4_comment([$3], [ ])])dnl
|
||||
private static immutable b4_int_type_for([$2])[[]] yy$1_ =
|
||||
@{
|
||||
$2
|
||||
@};dnl
|
||||
])
|
||||
|
||||
|
||||
## ------------------------- ##
|
||||
## Assigning token numbers. ##
|
||||
## ------------------------- ##
|
||||
|
||||
# b4_token_enum(TOKEN-NAME, TOKEN-NUMBER)
|
||||
# ---------------------------------------
|
||||
# Output the definition of this token as an enum.
|
||||
m4_define([b4_token_enum],
|
||||
[b4_token_format([ %s = %s,
|
||||
], [$1])])
|
||||
|
||||
# b4_token_enums(LIST-OF-PAIRS-TOKEN-NAME-TOKEN-NUMBER)
|
||||
# -----------------------------------------------------
|
||||
# Output the definition of the tokens as enums.
|
||||
m4_define([b4_token_enums],
|
||||
[/* Tokens. */
|
||||
public enum YYTokenType {
|
||||
|
||||
/** Token returned by the scanner to signal the end of its input. */
|
||||
EOF = 0,
|
||||
b4_symbol_foreach([b4_token_enum])
|
||||
}
|
||||
])
|
||||
|
||||
# b4-case(ID, CODE)
|
||||
# -----------------
|
||||
m4_define([b4_case], [ case $1:
|
||||
$2
|
||||
break;])
|
||||
|
||||
|
||||
## ---------------- ##
|
||||
## Default values. ##
|
||||
## ---------------- ##
|
||||
|
||||
m4_define([b4_yystype], [b4_percent_define_get([[stype]])])
|
||||
b4_percent_define_default([[stype]], [[YYSemanticType]])])
|
||||
|
||||
# %name-prefix
|
||||
m4_define_default([b4_prefix], [[YY]])
|
||||
|
||||
b4_percent_define_default([[api.parser.class]], [b4_prefix[]Parser])])
|
||||
m4_define([b4_parser_class], [b4_percent_define_get([[api.parser.class]])])
|
||||
|
||||
#b4_percent_define_default([[location_type]], [Location])])
|
||||
m4_define([b4_location_type], b4_percent_define_ifdef([[location_type]],[b4_percent_define_get([[location_type]])],[YYLocation]))
|
||||
|
||||
#b4_percent_define_default([[position_type]], [Position])])
|
||||
m4_define([b4_position_type], b4_percent_define_ifdef([[position_type]],[b4_percent_define_get([[position_type]])],[YYPosition]))
|
||||
|
||||
|
||||
## ----------------- ##
|
||||
## Semantic Values. ##
|
||||
## ----------------- ##
|
||||
|
||||
|
||||
# b4_symbol_value(VAL, [SYMBOL-NUM], [TYPE-TAG])
|
||||
# ----------------------------------------------
|
||||
# See README. FIXME: factor in c-like?
|
||||
m4_define([b4_symbol_value],
|
||||
[m4_ifval([$3],
|
||||
[($1.$3)],
|
||||
[m4_ifval([$2],
|
||||
[b4_symbol_if([$2], [has_type],
|
||||
[($1.b4_symbol([$2], [type]))],
|
||||
[$1])],
|
||||
[$1])])])
|
||||
|
||||
# b4_lhs_value(SYMBOL-NUM, [TYPE])
|
||||
# --------------------------------
|
||||
# See README.
|
||||
m4_define([b4_lhs_value],
|
||||
[b4_symbol_value([yyval], [$1], [$2])])
|
||||
|
||||
|
||||
# b4_rhs_value(RULE-LENGTH, POS, SYMBOL-NUM, [TYPE])
|
||||
# --------------------------------------------------
|
||||
# See README.
|
||||
#
|
||||
# In this simple implementation, %token and %type have class names
|
||||
# between the angle brackets.
|
||||
m4_define([b4_rhs_value],
|
||||
[b4_symbol_value([(yystack.valueAt (b4_subtract([$1], [$2])))], [$3], [$4])])
|
||||
|
||||
|
||||
# b4_lhs_location()
|
||||
# -----------------
|
||||
# Expansion of @$.
|
||||
m4_define([b4_lhs_location],
|
||||
[(yyloc)])
|
||||
|
||||
|
||||
# b4_rhs_location(RULE-LENGTH, POS)
|
||||
# ---------------------------------
|
||||
# Expansion of @POS, where the current rule has RULE-LENGTH symbols
|
||||
# on RHS.
|
||||
m4_define([b4_rhs_location],
|
||||
[yystack.locationAt ([$1], [$2])])
|
||||
|
||||
|
||||
# b4_lex_param
|
||||
# b4_parse_param
|
||||
# --------------
|
||||
# If defined, b4_lex_param arrives double quoted, but below we prefer
|
||||
# it to be single quoted. Same for b4_parse_param.
|
||||
|
||||
# TODO: should be in bison.m4
|
||||
m4_define_default([b4_lex_param], [[]]))
|
||||
m4_define([b4_lex_param], b4_lex_param))
|
||||
m4_define([b4_parse_param], b4_parse_param))
|
||||
|
||||
# b4_lex_param_decl
|
||||
# -------------------
|
||||
# Extra formal arguments of the constructor.
|
||||
m4_define([b4_lex_param_decl],
|
||||
[m4_ifset([b4_lex_param],
|
||||
[b4_remove_comma([$1],
|
||||
b4_param_decls(b4_lex_param))],
|
||||
[$1])])
|
||||
|
||||
m4_define([b4_param_decls],
|
||||
[m4_map([b4_param_decl], [$@])])
|
||||
m4_define([b4_param_decl], [, $1])
|
||||
|
||||
m4_define([b4_remove_comma], [m4_ifval(m4_quote($1), [$1, ], [])m4_shift2($@)])
|
||||
|
||||
|
||||
|
||||
# b4_parse_param_decl
|
||||
# -------------------
|
||||
# Extra formal arguments of the constructor.
|
||||
m4_define([b4_parse_param_decl],
|
||||
[m4_ifset([b4_parse_param],
|
||||
[b4_remove_comma([$1],
|
||||
b4_param_decls(b4_parse_param))],
|
||||
[$1])])
|
||||
|
||||
|
||||
|
||||
# b4_lex_param_call
|
||||
# -------------------
|
||||
# Delegating the lexer parameters to the lexer constructor.
|
||||
m4_define([b4_lex_param_call],
|
||||
[m4_ifset([b4_lex_param],
|
||||
[b4_remove_comma([$1],
|
||||
b4_param_calls(b4_lex_param))],
|
||||
[$1])])
|
||||
m4_define([b4_param_calls],
|
||||
[m4_map([b4_param_call], [$@])])
|
||||
m4_define([b4_param_call], [, $2])
|
||||
|
||||
|
||||
|
||||
# b4_parse_param_cons
|
||||
# -------------------
|
||||
# Extra initialisations of the constructor.
|
||||
m4_define([b4_parse_param_cons],
|
||||
[m4_ifset([b4_parse_param],
|
||||
[b4_constructor_calls(b4_parse_param)])])
|
||||
|
||||
m4_define([b4_constructor_calls],
|
||||
[m4_map([b4_constructor_call], [$@])])
|
||||
m4_define([b4_constructor_call],
|
||||
[this.$2 = $2;
|
||||
])
|
||||
|
||||
|
||||
|
||||
# b4_parse_param_vars
|
||||
# -------------------
|
||||
# Extra instance variables.
|
||||
m4_define([b4_parse_param_vars],
|
||||
[m4_ifset([b4_parse_param],
|
||||
[
|
||||
/* User arguments. */
|
||||
b4_var_decls(b4_parse_param)])])
|
||||
|
||||
m4_define([b4_var_decls],
|
||||
[m4_map_sep([b4_var_decl], [
|
||||
], [$@])])
|
||||
m4_define([b4_var_decl],
|
||||
[ protected $1;])
|
||||
+334
-293
File diff suppressed because it is too large
Load Diff
@@ -1,6 +1,6 @@
|
||||
# C++ GLR skeleton for Bison
|
||||
|
||||
# Copyright (C) 2002-2013 Free Software Foundation, Inc.
|
||||
# Copyright (C) 2002-2015, 2018-2019 Free Software Foundation, Inc.
|
||||
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
@@ -44,13 +44,13 @@
|
||||
# filename member).
|
||||
|
||||
# We require a pure interface.
|
||||
m4_define([b4_pure_flag], [1])
|
||||
m4_define([b4_pure_flag], [1])
|
||||
|
||||
m4_include(b4_pkgdatadir/[c++.m4])
|
||||
b4_bison_locations_if([m4_include(b4_pkgdatadir/[location.cc])])
|
||||
m4_include(b4_skeletonsdir/[c++.m4])
|
||||
b4_bison_locations_if([m4_include(b4_skeletonsdir/[location.cc])])
|
||||
|
||||
m4_define([b4_parser_class_name],
|
||||
[b4_percent_define_get([[parser_class_name]])])
|
||||
m4_define([b4_parser_class],
|
||||
[b4_percent_define_get([[api.parser.class]])])
|
||||
|
||||
# Save the parse parameters.
|
||||
m4_define([b4_parse_param_orig], m4_defn([b4_parse_param]))
|
||||
@@ -60,10 +60,10 @@ m4_define([b4_parse_param_orig], m4_defn([b4_parse_param]))
|
||||
# New ones.
|
||||
m4_ifset([b4_parse_param],
|
||||
[m4_define([b4_parse_param_wrap],
|
||||
[[b4_namespace_ref::b4_parser_class_name[& yyparser], [[yyparser]]],]
|
||||
[[b4_namespace_ref::b4_parser_class[& yyparser], [[yyparser]]],]
|
||||
m4_defn([b4_parse_param]))],
|
||||
[m4_define([b4_parse_param_wrap],
|
||||
[[b4_namespace_ref::b4_parser_class_name[& yyparser], [[yyparser]]]])
|
||||
[[b4_namespace_ref::b4_parser_class[& yyparser], [[yyparser]]]])
|
||||
])
|
||||
|
||||
|
||||
@@ -81,10 +81,10 @@ m4_define([b4_yy_symbol_print_define],
|
||||
[static void],
|
||||
[[FILE *], []],
|
||||
[[int yytype], [yytype]],
|
||||
[[const ]b4_namespace_ref::b4_parser_class_name[::semantic_type *yyvaluep],
|
||||
[[const ]b4_namespace_ref::b4_parser_class[::semantic_type *yyvaluep],
|
||||
[yyvaluep]][]dnl
|
||||
b4_locations_if([,
|
||||
[[const ]b4_namespace_ref::b4_parser_class_name[::location_type *yylocationp],
|
||||
[[const ]b4_namespace_ref::b4_parser_class[::location_type *yylocationp],
|
||||
[yylocationp]]]),
|
||||
b4_parse_param)[
|
||||
{
|
||||
@@ -98,18 +98,15 @@ b4_locations_if([,
|
||||
[yylloc.initialize ();]m4_ifdef([b4_initial_action], [
|
||||
m4_defn([b4_initial_action])]))])[
|
||||
|
||||
# Hijack the post prologue to insert early definition of YYLLOC_DEFAULT
|
||||
# and declaration of yyerror.
|
||||
# Hijack the post prologue to declare yyerror.
|
||||
]m4_append([b4_post_prologue],
|
||||
[b4_syncline([@oline@], [@ofile@])[
|
||||
]b4_yylloc_default_define[
|
||||
#define YYRHSLOC(Rhs, K) ((Rhs)[K].yystate.yyloc)
|
||||
]b4_function_declare([yyerror],
|
||||
[b4_syncline([@oline@], [@ofile@])dnl
|
||||
b4_function_declare([yyerror],
|
||||
[static void],b4_locations_if([
|
||||
[[const ]b4_namespace_ref::b4_parser_class_name[::location_type *yylocationp],
|
||||
[[const ]b4_namespace_ref::b4_parser_class[::location_type *yylocationp],
|
||||
[yylocationp]],])
|
||||
b4_parse_param,
|
||||
[[const char* msg], [msg]])])
|
||||
[[const char* msg], [msg]])])[
|
||||
|
||||
|
||||
#undef yynerrs
|
||||
@@ -122,8 +119,7 @@ m4_if(b4_prefix, [yy], [],
|
||||
#define yyparse ]b4_prefix[parse
|
||||
#define yylex ]b4_prefix[lex
|
||||
#define yyerror ]b4_prefix[error
|
||||
#define yydebug ]b4_prefix[debug
|
||||
]]b4_pure_if([], [[
|
||||
#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([[
|
||||
@@ -132,15 +128,15 @@ m4_if(b4_prefix, [yy], [],
|
||||
# Hijack the epilogue to define implementations (yyerror, parser member
|
||||
# functions etc.).
|
||||
m4_append([b4_epilogue],
|
||||
[b4_syncline([@oline@], [@ofile@])[
|
||||
|
||||
[b4_syncline([@oline@], [@ofile@])dnl
|
||||
[
|
||||
/*------------------.
|
||||
| Report an error. |
|
||||
`------------------*/
|
||||
|
||||
]b4_function_define([yyerror],
|
||||
[static void],b4_locations_if([
|
||||
[[const ]b4_namespace_ref::b4_parser_class_name[::location_type *yylocationp],
|
||||
[[const ]b4_namespace_ref::b4_parser_class[::location_type *yylocationp],
|
||||
[yylocationp]],])
|
||||
b4_parse_param,
|
||||
[[const char* msg], [msg]])[
|
||||
@@ -154,20 +150,27 @@ m4_append([b4_epilogue],
|
||||
]dnl In this section, the parse params are the original parse_params.
|
||||
m4_pushdef([b4_parse_param], m4_defn([b4_parse_param_orig]))dnl
|
||||
[ /// Build a parser object.
|
||||
]b4_parser_class_name::b4_parser_class_name[ (]b4_parse_param_decl[)]m4_ifset([b4_parse_param], [
|
||||
]b4_parser_class::b4_parser_class[ (]b4_parse_param_decl[)]m4_ifset([b4_parse_param], [
|
||||
:])[
|
||||
#if ]b4_api_PREFIX[DEBUG
|
||||
]m4_ifset([b4_parse_param], [ ], [ :])[yycdebug_ (&std::cerr)]m4_ifset([b4_parse_param], [,])[
|
||||
#endif]b4_parse_param_cons[
|
||||
{
|
||||
}
|
||||
{}
|
||||
|
||||
]b4_parser_class_name::~b4_parser_class_name[ ()
|
||||
]b4_parser_class::~b4_parser_class[ ()
|
||||
{}
|
||||
|
||||
]b4_parser_class[::syntax_error::~syntax_error () YY_NOEXCEPT YY_NOTHROW
|
||||
{}
|
||||
|
||||
int
|
||||
]b4_parser_class[::operator() ()
|
||||
{
|
||||
return parse ();
|
||||
}
|
||||
|
||||
int
|
||||
]b4_parser_class_name[::parse ()
|
||||
]b4_parser_class[::parse ()
|
||||
{
|
||||
return ::yyparse (*this]b4_user_args[);
|
||||
}
|
||||
@@ -177,22 +180,22 @@ m4_pushdef([b4_parse_param], m4_defn([b4_parse_param_orig]))dnl
|
||||
| Print this symbol. |
|
||||
`--------------------*/
|
||||
|
||||
inline void
|
||||
]b4_parser_class_name[::yy_symbol_value_print_ (int yytype,
|
||||
void
|
||||
]b4_parser_class[::yy_symbol_value_print_ (int yytype,
|
||||
const semantic_type* yyvaluep]b4_locations_if([[,
|
||||
const location_type* yylocationp]])[)
|
||||
{]b4_locations_if([[
|
||||
YYUSE (yylocationp);]])[
|
||||
YYUSE (yyvaluep);
|
||||
std::ostream& yyoutput = debug_stream ();
|
||||
std::ostream& yyo = yyoutput;
|
||||
YYUSE (yyo);
|
||||
std::ostream& yyo = debug_stream ();
|
||||
std::ostream& yyoutput = yyo;
|
||||
YYUSE (yyoutput);
|
||||
]b4_symbol_actions([printer])[
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
]b4_parser_class_name[::yy_symbol_print_ (int yytype,
|
||||
]b4_parser_class[::yy_symbol_print_ (int yytype,
|
||||
const semantic_type* yyvaluep]b4_locations_if([[,
|
||||
const location_type* yylocationp]])[)
|
||||
{
|
||||
@@ -204,26 +207,26 @@ m4_pushdef([b4_parse_param], m4_defn([b4_parse_param_orig]))dnl
|
||||
}
|
||||
|
||||
std::ostream&
|
||||
]b4_parser_class_name[::debug_stream () const
|
||||
]b4_parser_class[::debug_stream () const
|
||||
{
|
||||
return *yycdebug_;
|
||||
}
|
||||
|
||||
void
|
||||
]b4_parser_class_name[::set_debug_stream (std::ostream& o)
|
||||
]b4_parser_class[::set_debug_stream (std::ostream& o)
|
||||
{
|
||||
yycdebug_ = &o;
|
||||
}
|
||||
|
||||
|
||||
]b4_parser_class_name[::debug_level_type
|
||||
]b4_parser_class_name[::debug_level () const
|
||||
]b4_parser_class[::debug_level_type
|
||||
]b4_parser_class[::debug_level () const
|
||||
{
|
||||
return yydebug;
|
||||
}
|
||||
|
||||
void
|
||||
]b4_parser_class_name[::set_debug_level (debug_level_type l)
|
||||
]b4_parser_class[::set_debug_level (debug_level_type l)
|
||||
{
|
||||
// Actually, it is yydebug which is really used.
|
||||
yydebug = l;
|
||||
@@ -231,43 +234,64 @@ m4_pushdef([b4_parse_param], m4_defn([b4_parse_param_orig]))dnl
|
||||
|
||||
#endif
|
||||
]m4_popdef([b4_parse_param])dnl
|
||||
b4_namespace_close
|
||||
b4_namespace_close[]dnl
|
||||
])
|
||||
|
||||
# b4_shared_declarations
|
||||
# ----------------------
|
||||
# Declaration that might either go into the header (if --defines)
|
||||
# or open coded in the parser body.
|
||||
|
||||
# b4_shared_declarations(hh|cc)
|
||||
# -----------------------------
|
||||
# Declaration that might either go into the header (if --defines, $1 = hh)
|
||||
# or in the implementation file.
|
||||
m4_define([b4_shared_declarations],
|
||||
[m4_pushdef([b4_parse_param], m4_defn([b4_parse_param_orig]))dnl
|
||||
b4_percent_code_get([[requires]])[
|
||||
|
||||
#include <iostream>
|
||||
#include <stdexcept>
|
||||
#include <string>
|
||||
#include <iostream>]b4_defines_if([
|
||||
b4_bison_locations_if([[#include "location.hh"]])])[
|
||||
|
||||
]b4_cxx_portability[
|
||||
]m4_ifdef([b4_location_include],
|
||||
[[# include ]b4_location_include])[
|
||||
]b4_variant_if([b4_variant_includes])[
|
||||
|
||||
]b4_attribute_define[
|
||||
]b4_null_define[
|
||||
|
||||
// Whether we are compiled with exception support.
|
||||
#ifndef YY_EXCEPTIONS
|
||||
# if defined __GNUC__ && !defined __EXCEPTIONS
|
||||
# define YY_EXCEPTIONS 0
|
||||
# else
|
||||
# define YY_EXCEPTIONS 1
|
||||
# endif
|
||||
#endif
|
||||
|
||||
]b4_YYDEBUG_define[
|
||||
|
||||
]b4_namespace_open[
|
||||
]b4_defines_if([],
|
||||
[b4_bison_locations_if([b4_position_define
|
||||
b4_location_define])])[
|
||||
|
||||
]b4_bison_locations_if([m4_ifndef([b4_location_file],
|
||||
[b4_location_define])])[
|
||||
|
||||
/// A Bison parser.
|
||||
class ]b4_parser_class_name[
|
||||
class ]b4_parser_class[
|
||||
{
|
||||
public:
|
||||
]b4_public_types_declare[
|
||||
|
||||
/// Build a parser object.
|
||||
]b4_parser_class_name[ (]b4_parse_param_decl[);
|
||||
virtual ~]b4_parser_class_name[ ();
|
||||
]b4_parser_class[ (]b4_parse_param_decl[);
|
||||
virtual ~]b4_parser_class[ ();
|
||||
|
||||
/// Parse. An alias for parse ().
|
||||
/// \returns 0 iff parsing succeeded.
|
||||
int operator() ();
|
||||
|
||||
/// Parse.
|
||||
/// \returns 0 iff parsing succeeded.
|
||||
virtual int parse ();
|
||||
|
||||
#if ]b4_api_PREFIX[DEBUG
|
||||
/// The current debugging stream.
|
||||
std::ostream& debug_stream () const;
|
||||
/// Set the current debugging stream.
|
||||
@@ -279,8 +303,8 @@ b4_location_define])])[
|
||||
debug_level_type debug_level () const;
|
||||
/// Set the current debugging level.
|
||||
void set_debug_level (debug_level_type l);
|
||||
#endif
|
||||
|
||||
public:
|
||||
/// Report a syntax error.]b4_locations_if([[
|
||||
/// \param loc where the syntax error is found.]])[
|
||||
/// \param msg a description of the syntax error.
|
||||
@@ -315,10 +339,10 @@ b4_percent_define_flag_if([[global_tokens_and_yystype]],
|
||||
[b4_token_defines])
|
||||
[
|
||||
#ifndef ]b4_api_PREFIX[STYPE
|
||||
# define ]b4_api_PREFIX[STYPE ]b4_namespace_ref[::]b4_parser_class_name[::semantic_type
|
||||
# define ]b4_api_PREFIX[STYPE ]b4_namespace_ref[::]b4_parser_class[::semantic_type
|
||||
#endif
|
||||
#ifndef ]b4_api_PREFIX[LTYPE
|
||||
# define ]b4_api_PREFIX[LTYPE ]b4_namespace_ref[::]b4_parser_class_name[::location_type
|
||||
# define ]b4_api_PREFIX[LTYPE ]b4_namespace_ref[::]b4_parser_class[::location_type
|
||||
#endif
|
||||
|
||||
]b4_namespace_close[
|
||||
@@ -327,19 +351,19 @@ b4_percent_define_flag_if([[global_tokens_and_yystype]],
|
||||
])
|
||||
|
||||
b4_defines_if(
|
||||
[b4_output_begin([b4_spec_defines_file])
|
||||
[b4_output_begin([b4_spec_header_file])
|
||||
b4_copyright([Skeleton interface for Bison GLR parsers in C++],
|
||||
[2002-2013])[
|
||||
|
||||
[2002-2015, 2018-2019])[
|
||||
// C++ GLR parser skeleton written by Akim Demaille.
|
||||
|
||||
]b4_cpp_guard_open([b4_spec_defines_file])[
|
||||
]b4_disclaimer[
|
||||
]b4_cpp_guard_open([b4_spec_header_file])[
|
||||
]b4_shared_declarations[
|
||||
]b4_cpp_guard_close([b4_spec_defines_file])[
|
||||
]b4_output_end()])
|
||||
]b4_cpp_guard_close([b4_spec_header_file])[
|
||||
]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_include(b4_skeletonsdir/[glr.c])
|
||||
m4_popdef([b4_parse_param])
|
||||
@@ -2,7 +2,8 @@
|
||||
|
||||
# Java skeleton dispatching for Bison.
|
||||
|
||||
# Copyright (C) 2007, 2009-2013 Free Software Foundation, Inc.
|
||||
# Copyright (C) 2007, 2009-2015, 2018-2019 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
|
||||
@@ -20,7 +21,7 @@
|
||||
b4_glr_if( [b4_complain([%%glr-parser not supported for Java])])
|
||||
b4_nondeterministic_if([b4_complain([%%nondeterministic-parser not supported for Java])])
|
||||
|
||||
m4_define_default([b4_used_skeleton], [b4_pkgdatadir/[lalr1.java]])
|
||||
m4_define_default([b4_used_skeleton], [b4_skeletonsdir/[lalr1.java]])
|
||||
m4_define_default([b4_skeleton], ["b4_basename(b4_used_skeleton)"])
|
||||
|
||||
m4_include(b4_used_skeleton)
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
# Java language support for Bison
|
||||
|
||||
# Copyright (C) 2007-2013 Free Software Foundation, Inc.
|
||||
# Copyright (C) 2007-2015, 2018-2019 Free Software Foundation, Inc.
|
||||
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
@@ -17,7 +17,7 @@
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
m4_include(b4_pkgdatadir/[c-like.m4])
|
||||
m4_include(b4_skeletonsdir/[c-like.m4])
|
||||
|
||||
|
||||
# b4_list2(LIST1, LIST2)
|
||||
@@ -42,32 +42,24 @@ m4_define([b4_percent_define_get3],
|
||||
m4_define([b4_flag_value], [b4_flag_if([$1], [true], [false])])
|
||||
|
||||
|
||||
# b4_public_if(TRUE, FALSE)
|
||||
# -------------------------
|
||||
b4_percent_define_default([[public]], [[false]])
|
||||
m4_define([b4_public_if],
|
||||
[b4_percent_define_flag_if([public], [$1], [$2])])
|
||||
|
||||
|
||||
# b4_abstract_if(TRUE, FALSE)
|
||||
# b4_parser_class_declaration
|
||||
# ---------------------------
|
||||
b4_percent_define_default([[abstract]], [[false]])
|
||||
m4_define([b4_abstract_if],
|
||||
[b4_percent_define_flag_if([abstract], [$1], [$2])])
|
||||
# The declaration of the parser class ("class YYParser"), with all its
|
||||
# qualifiers/annotations.
|
||||
b4_percent_define_default([[api.parser.abstract]], [[false]])
|
||||
b4_percent_define_default([[api.parser.final]], [[false]])
|
||||
b4_percent_define_default([[api.parser.public]], [[false]])
|
||||
b4_percent_define_default([[api.parser.strictfp]], [[false]])
|
||||
|
||||
|
||||
# b4_final_if(TRUE, FALSE)
|
||||
# ---------------------------
|
||||
b4_percent_define_default([[final]], [[false]])
|
||||
m4_define([b4_final_if],
|
||||
[b4_percent_define_flag_if([final], [$1], [$2])])
|
||||
|
||||
|
||||
# b4_strictfp_if(TRUE, FALSE)
|
||||
# ---------------------------
|
||||
b4_percent_define_default([[strictfp]], [[false]])
|
||||
m4_define([b4_strictfp_if],
|
||||
[b4_percent_define_flag_if([strictfp], [$1], [$2])])
|
||||
m4_define([b4_parser_class_declaration],
|
||||
[b4_percent_define_get3([api.parser.annotations], [], [ ])dnl
|
||||
b4_percent_define_flag_if([api.parser.public], [public ])dnl
|
||||
b4_percent_define_flag_if([api.parser.abstract], [abstract ])dnl
|
||||
b4_percent_define_flag_if([api.parser.final], [final ])dnl
|
||||
b4_percent_define_flag_if([api.parser.strictfp], [strictfp ])dnl
|
||||
[class ]b4_parser_class[]dnl
|
||||
b4_percent_define_get3([api.parser.extends], [ extends ])dnl
|
||||
b4_percent_define_get3([api.parser.implements], [ implements ])])
|
||||
|
||||
|
||||
# b4_lexer_if(TRUE, FALSE)
|
||||
@@ -180,7 +172,7 @@ 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([[api.parser.class]], [code], [deprecated])
|
||||
b4_percent_define_check_kind([[throws]], [code], [deprecated])
|
||||
|
||||
|
||||
@@ -195,8 +187,8 @@ b4_percent_define_default([[api.value.type]], [[Object]])
|
||||
# %name-prefix
|
||||
m4_define_default([b4_prefix], [[YY]])
|
||||
|
||||
b4_percent_define_default([[parser_class_name]], [b4_prefix[]Parser])
|
||||
m4_define([b4_parser_class_name], [b4_percent_define_get([[parser_class_name]])])
|
||||
b4_percent_define_default([[api.parser.class]], [b4_prefix[]Parser])
|
||||
m4_define([b4_parser_class], [b4_percent_define_get([[api.parser.class]])])
|
||||
|
||||
b4_percent_define_default([[lex_throws]], [[java.io.IOException]])
|
||||
m4_define([b4_lex_throws], [b4_percent_define_get([[lex_throws]])])
|
||||
@@ -219,21 +211,40 @@ m4_define([b4_position_type], [b4_percent_define_get([[api.position.type]])])
|
||||
## ----------------- ##
|
||||
|
||||
|
||||
# b4_lhs_value([TYPE])
|
||||
# --------------------
|
||||
# Expansion of $<TYPE>$.
|
||||
# b4_symbol_value(VAL, [SYMBOL-NUM], [TYPE-TAG])
|
||||
# ----------------------------------------------
|
||||
# See README.
|
||||
m4_define([b4_symbol_value],
|
||||
[m4_ifval([$3],
|
||||
[(($3)($1))],
|
||||
[m4_ifval([$2],
|
||||
[b4_symbol_if([$2], [has_type],
|
||||
[((b4_symbol([$2], [type]))($1))],
|
||||
[$1])],
|
||||
[$1])])])
|
||||
|
||||
|
||||
# b4_lhs_value([SYMBOL-NUM], [TYPE])
|
||||
# ----------------------------------
|
||||
# See README.
|
||||
m4_define([b4_lhs_value], [yyval])
|
||||
|
||||
|
||||
# b4_rhs_value(RULE-LENGTH, NUM, [TYPE])
|
||||
# --------------------------------------
|
||||
# Expansion of $<TYPE>NUM, where the current rule has RULE-LENGTH
|
||||
# symbols on RHS.
|
||||
# b4_rhs_data(RULE-LENGTH, POS)
|
||||
# -----------------------------
|
||||
# See README.
|
||||
m4_define([b4_rhs_data],
|
||||
[yystack.valueAt (b4_subtract($@))])
|
||||
|
||||
# b4_rhs_value(RULE-LENGTH, POS, SYMBOL-NUM, [TYPE])
|
||||
# --------------------------------------------------
|
||||
# See README.
|
||||
#
|
||||
# In this simple implementation, %token and %type have class names
|
||||
# between the angle brackets.
|
||||
m4_define([b4_rhs_value],
|
||||
[(m4_ifval($3, [($3)])[](yystack.valueAt ($1-($2))))])
|
||||
[b4_symbol_value([b4_rhs_data([$1], [$2])], [$3], [$4])])
|
||||
|
||||
|
||||
# b4_lhs_location()
|
||||
# -----------------
|
||||
@@ -242,12 +253,12 @@ m4_define([b4_lhs_location],
|
||||
[(yyloc)])
|
||||
|
||||
|
||||
# b4_rhs_location(RULE-LENGTH, NUM)
|
||||
# b4_rhs_location(RULE-LENGTH, POS)
|
||||
# ---------------------------------
|
||||
# Expansion of @NUM, where the current rule has RULE-LENGTH symbols
|
||||
# Expansion of @POS, where the current rule has RULE-LENGTH symbols
|
||||
# on RHS.
|
||||
m4_define([b4_rhs_location],
|
||||
[yystack.locationAt ($1-($2))])
|
||||
[yystack.locationAt (b4_subtract($@))])
|
||||
|
||||
|
||||
# b4_lex_param
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,896 @@
|
||||
# Java skeleton for Bison -*- autoconf -*-
|
||||
|
||||
# Copyright (C) 2007-2011, 2019 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/>.
|
||||
|
||||
m4_include(b4_skeletonsdir/[d.m4])
|
||||
|
||||
|
||||
m4_divert_push(0)dnl
|
||||
@output(b4_parser_file_name@)@
|
||||
b4_copyright([Skeleton implementation for Bison LALR(1) parsers in D],
|
||||
[2007-2012, 2019])
|
||||
|
||||
b4_percent_define_ifdef([package], [module b4_percent_define_get([package]);
|
||||
])[
|
||||
version(D_Version2) {
|
||||
} else {
|
||||
static assert(false, "need compiler for D Version 2");
|
||||
}
|
||||
|
||||
]b4_user_pre_prologue[
|
||||
]b4_user_post_prologue[
|
||||
]b4_percent_code_get([[imports]])[
|
||||
import std.format;
|
||||
|
||||
/**
|
||||
* A Bison parser, automatically generated from <tt>]m4_bpatsubst(b4_file_name, [^"\(.*\)"$], [\1])[</tt>.
|
||||
*
|
||||
* @@author LALR (1) parser skeleton written by Paolo Bonzini.
|
||||
* Port to D language was done by Oliver Mangold.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Communication interface between the scanner and the Bison-generated
|
||||
* parser <tt>]b4_parser_class[</tt>.
|
||||
*/
|
||||
public interface Lexer
|
||||
{]b4_locations_if([[
|
||||
/**
|
||||
* Method to retrieve the beginning position of the last scanned token.
|
||||
* @@return the position at which the last scanned token starts. */
|
||||
@@property ]b4_position_type[ startPos ();
|
||||
|
||||
/**
|
||||
* Method to retrieve the ending position of the last scanned token.
|
||||
* @@return the first position beyond the last scanned token. */
|
||||
@@property ]b4_position_type[ endPos ();
|
||||
|
||||
]])[
|
||||
/**
|
||||
* Method to retrieve the semantic value of the last scanned token.
|
||||
* @@return the semantic value of the last scanned token. */
|
||||
@@property ]b4_yystype[ semanticVal ();
|
||||
|
||||
/**
|
||||
* Entry point for the scanner. Returns the token identifier corresponding
|
||||
* to the next token and prepares to return the semantic value
|
||||
* ]b4_locations_if([and beginning/ending positions ])[of the token.
|
||||
* @@return the token identifier corresponding to the next token. */
|
||||
int yylex ();
|
||||
|
||||
/**
|
||||
* Entry point for error reporting. Emits an error
|
||||
* ]b4_locations_if([referring to the given location ])[in a user-defined way.
|
||||
*]b4_locations_if([[
|
||||
* @@param loc The location of the element to which the
|
||||
* error message is related]])[
|
||||
* @@param s The string for the error message. */
|
||||
void yyerror (]b4_locations_if([b4_location_type[ loc, ]])[string s);
|
||||
}
|
||||
|
||||
private final struct YYStackElement{
|
||||
int state;
|
||||
]b4_yystype[ value;]b4_locations_if(
|
||||
b4_location_type[[] location;])[
|
||||
}
|
||||
|
||||
private final struct YYStack {
|
||||
private YYStackElement[] stack = [];
|
||||
|
||||
public final @@property ulong height()
|
||||
{
|
||||
return stack.length;
|
||||
}
|
||||
|
||||
public final void push (int state, ]b4_yystype[ value]dnl
|
||||
b4_locations_if([, ref ]b4_location_type[ loc])[)
|
||||
{
|
||||
stack ~= YYStackElement(state, value]b4_locations_if([, loc])[);
|
||||
}
|
||||
|
||||
public final void pop ()
|
||||
{
|
||||
pop (1);
|
||||
}
|
||||
|
||||
public final void pop (int num)
|
||||
{
|
||||
stack.length -= num;
|
||||
}
|
||||
|
||||
public final int stateAt (int i)
|
||||
{
|
||||
return stack[$-i-1].state;
|
||||
}
|
||||
|
||||
]b4_locations_if([[public final ref ]b4_location_type[ locationAt (int i)
|
||||
{
|
||||
return stack[$-i-1].location;
|
||||
}
|
||||
|
||||
]])[public final ref ]b4_yystype[ valueAt (int i)
|
||||
{
|
||||
return stack[$-i-1].value;
|
||||
}
|
||||
|
||||
// Print the state stack on the debug stream.
|
||||
public final void print (File stream)
|
||||
{
|
||||
stream.write ("Stack now");
|
||||
for (int i = 0; i < stack.length; i++)
|
||||
stream.write (" %d", stack[i].state);
|
||||
stream.writeln ();
|
||||
}
|
||||
}
|
||||
]b4_locations_if(b4_position_type_if([[[
|
||||
static assert(__traits(compiles,
|
||||
(new ]b4_position_type[[1])[0]=(new ]b4_position_type[[1])[0]),
|
||||
"struct/class ]b4_position_type[ must be default-constructible "
|
||||
"and assignable");
|
||||
static assert(__traits(compiles, (new string[1])[0]=(new ]b4_position_type[).toString()),
|
||||
"error: struct/class ]b4_position_type[ must have toString method");
|
||||
]]], [[
|
||||
/**
|
||||
* A struct denoting a point in the input.*/
|
||||
public struct ]b4_position_type[ {
|
||||
|
||||
/** The column index within the line of input. */
|
||||
public int column = 1;
|
||||
/** The line number within an input file. */
|
||||
public int line = 1;
|
||||
/** The name of the input file. */
|
||||
public string filename = "(unspecified file)";
|
||||
|
||||
/**
|
||||
* Return a string representation of the position. */
|
||||
public string toString() const {
|
||||
return format("%s:%d.%d", filename, line, column);
|
||||
}
|
||||
}
|
||||
]])b4_location_type_if([[[
|
||||
static assert(__traits(compiles, (new ]b4_location_type[((new ]b4_position_type[[1])[0]))) &&
|
||||
__traits(compiles, (new ]b4_location_type[((new ]b4_position_type[[1])[0], (new ]b4_position_type[[1])[0]))),
|
||||
"error: struct/class ]b4_location_type[ must have "
|
||||
"default constructor and constructors this(]b4_position_type[) and this(]b4_position_type[, ]b4_position_type[).");
|
||||
static assert(__traits(compiles, (new ]b4_location_type[[1])[0].begin=(new ]b4_location_type[[1])[0].begin) &&
|
||||
__traits(compiles, (new ]b4_location_type[[1])[0].begin=(new ]b4_location_type[[1])[0].end) &&
|
||||
__traits(compiles, (new ]b4_location_type[[1])[0].end=(new ]b4_location_type[[1])[0].begin) &&
|
||||
__traits(compiles, (new ]b4_location_type[[1])[0].end=(new ]b4_location_type[[1])[0].end),
|
||||
"error: struct/class ]b4_location_type[ must have assignment-compatible "
|
||||
"members/properties 'begin' and 'end'.");
|
||||
static assert(__traits(compiles, (new string[1])[0]=(new ]b4_location_type[[1])[0].toString()),
|
||||
"error: struct/class ]b4_location_type[ must have toString method.");
|
||||
|
||||
private immutable bool yy_location_is_class = !__traits(compiles, *(new ]b4_location_type[((new ]b4_position_type[[1])[0])));]]], [[
|
||||
/**
|
||||
* A class defining a pair of positions. Positions, defined by the
|
||||
* <code>]b4_position_type[</code> class, denote a point in the input.
|
||||
* Locations represent a part of the input through the beginning
|
||||
* and ending positions. */
|
||||
public class ]b4_location_type[
|
||||
{
|
||||
/** The first, inclusive, position in the range. */
|
||||
public ]b4_position_type[ begin;
|
||||
|
||||
/** The first position beyond the range. */
|
||||
public ]b4_position_type[ end;
|
||||
|
||||
/**
|
||||
* Create a <code>]b4_location_type[</code> denoting an empty range located at
|
||||
* a given point.
|
||||
* @@param loc The position at which the range is anchored. */
|
||||
public this (]b4_position_type[ loc) {
|
||||
this.begin = this.end = loc;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a <code>]b4_location_type[</code> from the endpoints of the range.
|
||||
* @@param begin The first position included in the range.
|
||||
* @@param end The first position beyond the range. */
|
||||
public this (]b4_position_type[ begin, ]b4_position_type[ end)
|
||||
{
|
||||
this.begin = begin;
|
||||
this.end = end;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return a representation of the location. For this to be correct,
|
||||
* <code>]b4_position_type[</code> should override the <code>toString</code>
|
||||
* method. */
|
||||
public const string toString () const {
|
||||
if (begin==end)
|
||||
return begin.toString ();
|
||||
else
|
||||
return begin.toString () ~ "-" ~ end.toString ();
|
||||
}
|
||||
}
|
||||
|
||||
private immutable bool yy_location_is_class = true;
|
||||
|
||||
]]))m4_ifdef([b4_user_union_members], [private union YYSemanticType
|
||||
{
|
||||
b4_user_union_members
|
||||
};],
|
||||
[m4_if(b4_tag_seen_flag, 0,
|
||||
[[private alias int YYSemanticType;]])])[
|
||||
]b4_token_enums(b4_tokens)[
|
||||
]b4_parser_class_declaration[
|
||||
{
|
||||
]b4_identification[
|
||||
|
||||
/** True if verbose error messages are enabled. */
|
||||
public bool errorVerbose = ]b4_flag_value([error_verbose])[;
|
||||
|
||||
]b4_locations_if([[
|
||||
private final ]b4_location_type[ yylloc_from_stack (ref YYStack rhs, int n)
|
||||
{
|
||||
static if (yy_location_is_class) {
|
||||
if (n > 0)
|
||||
return new ]b4_location_type[ (rhs.locationAt (n-1).begin, rhs.locationAt (0).end);
|
||||
else
|
||||
return new ]b4_location_type[ (rhs.locationAt (0).end);
|
||||
} else {
|
||||
if (n > 0)
|
||||
return ]b4_location_type[ (rhs.locationAt (n-1).begin, rhs.locationAt (0).end);
|
||||
else
|
||||
return ]b4_location_type[ (rhs.locationAt (0).end);
|
||||
}
|
||||
}]])[
|
||||
|
||||
]b4_lexer_if([[ private class YYLexer implements Lexer {
|
||||
]b4_percent_code_get([[lexer]])[
|
||||
}
|
||||
]])[
|
||||
/** The object doing lexical analysis for us. */
|
||||
private Lexer yylexer;
|
||||
|
||||
]b4_parse_param_vars[
|
||||
|
||||
]b4_lexer_if([[
|
||||
/**
|
||||
* Instantiates the Bison-generated parser.
|
||||
*/
|
||||
public this] (b4_parse_param_decl([b4_lex_param_decl])[) {
|
||||
this.yylexer = new YYLexer(]b4_lex_param_call[);
|
||||
this.yyDebugStream = stderr;
|
||||
]b4_parse_param_cons[
|
||||
}
|
||||
]])[
|
||||
|
||||
/**
|
||||
* Instantiates the Bison-generated parser.
|
||||
* @@param yylexer The scanner that will supply tokens to the parser.
|
||||
*/
|
||||
]b4_lexer_if([[protected]], [[public]]) [this (]b4_parse_param_decl([[Lexer yylexer]])[) {
|
||||
this.yylexer = yylexer;
|
||||
this.yyDebugStream = stderr;
|
||||
]b4_parse_param_cons[
|
||||
}
|
||||
|
||||
private File yyDebugStream;
|
||||
|
||||
/**
|
||||
* Return the <tt>File</tt> on which the debugging output is
|
||||
* printed.
|
||||
*/
|
||||
public File getDebugStream () { return yyDebugStream; }
|
||||
|
||||
/**
|
||||
* Set the <tt>std.File</tt> on which the debug output is printed.
|
||||
* @@param s The stream that is used for debugging output.
|
||||
*/
|
||||
public final void setDebugStream(File s) { yyDebugStream = s; }
|
||||
|
||||
private int yydebug = 0;
|
||||
|
||||
/**
|
||||
* Answer the verbosity of the debugging output; 0 means that all kinds of
|
||||
* output from the parser are suppressed.
|
||||
*/
|
||||
public final int getDebugLevel() { return yydebug; }
|
||||
|
||||
/**
|
||||
* Set the verbosity of the debugging output; 0 means that all kinds of
|
||||
* output from the parser are suppressed.
|
||||
* @@param level The verbosity level for debugging output.
|
||||
*/
|
||||
public final void setDebugLevel(int level) { yydebug = level; }
|
||||
|
||||
private final int yylex () {
|
||||
return yylexer.yylex ();
|
||||
}
|
||||
protected final void yyerror (]b4_locations_if(ref [b4_location_type[ loc, ]])[string s) {
|
||||
yylexer.yyerror (]b4_locations_if([loc, ])[s);
|
||||
}]
|
||||
|
||||
[protected final void yycdebug (string s) {
|
||||
if (yydebug > 0)
|
||||
yyDebugStream.writeln (s);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returned by a Bison action in order to stop the parsing process and
|
||||
* return success (<tt>true</tt>). */
|
||||
public static immutable int YYACCEPT = 0;
|
||||
|
||||
/**
|
||||
* Returned by a Bison action in order to stop the parsing process and
|
||||
* return failure (<tt>false</tt>). */
|
||||
public static immutable int YYABORT = 1;
|
||||
|
||||
/**
|
||||
* Returned by a Bison action in order to start error recovery without
|
||||
* printing an error message. */
|
||||
public static immutable int YYERROR = 2;
|
||||
|
||||
// Internal return codes that are not supported for user semantic
|
||||
// actions.
|
||||
private static immutable int YYERRLAB = 3;
|
||||
private static immutable int YYNEWSTATE = 4;
|
||||
private static immutable int YYDEFAULT = 5;
|
||||
private static immutable int YYREDUCE = 6;
|
||||
private static immutable int YYERRLAB1 = 7;
|
||||
private static immutable int YYRETURN = 8;
|
||||
]b4_locations_if([
|
||||
private static immutable YYSemanticType yy_semantic_null = cast(YYSemanticType)null;])[
|
||||
private int yyerrstatus_ = 0;
|
||||
|
||||
/**
|
||||
* Return whether error recovery is being done. In this state, the parser
|
||||
* reads token until it reaches a known state, and then restarts normal
|
||||
* operation. */
|
||||
public final bool recovering ()
|
||||
{
|
||||
return yyerrstatus_ == 0;
|
||||
}
|
||||
|
||||
private int yyaction (int yyn, ref YYStack yystack, int yylen)
|
||||
{
|
||||
]b4_yystype[ yyval;]b4_locations_if([[
|
||||
]b4_location_type[ yyloc = yylloc_from_stack (yystack, yylen);]])[
|
||||
|
||||
/* If YYLEN is nonzero, implement the default value of the action:
|
||||
`$$ = $1'. Otherwise, use the top of the stack.
|
||||
|
||||
Otherwise, the following line sets YYVAL to garbage.
|
||||
This behavior is undocumented and Bison
|
||||
users should not rely upon it. */
|
||||
if (yylen > 0)
|
||||
yyval = yystack.valueAt (yylen - 1);
|
||||
else
|
||||
yyval = yystack.valueAt (0);
|
||||
|
||||
yy_reduce_print (yyn, yystack);
|
||||
|
||||
switch (yyn)
|
||||
{
|
||||
]b4_user_actions[
|
||||
default: break;
|
||||
}
|
||||
|
||||
yy_symbol_print ("-> $$ =", yyr1_[yyn], yyval]b4_locations_if([, yyloc])[);
|
||||
|
||||
yystack.pop (yylen);
|
||||
yylen = 0;
|
||||
|
||||
/* Shift the result of the reduction. */
|
||||
yyn = 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])[);
|
||||
return YYNEWSTATE;
|
||||
}
|
||||
|
||||
/* Return YYSTR after stripping away unnecessary quotes and
|
||||
backslashes, so that it's suitable for yyerror. The heuristic is
|
||||
that double-quoting is unnecessary unless the string contains an
|
||||
apostrophe, a comma, or backslash (other than backslash-backslash).
|
||||
YYSTR is taken from yytname. */
|
||||
private final string yytnamerr_ (string yystr)
|
||||
{
|
||||
if (yystr[0] == '"')
|
||||
{
|
||||
string yyr;
|
||||
strip_quotes:
|
||||
for (int i = 1; i < yystr.length; i++)
|
||||
switch (yystr[i])
|
||||
{
|
||||
case '\'':
|
||||
case ',':
|
||||
break strip_quotes;
|
||||
|
||||
case '\\':
|
||||
if (yystr[++i] != '\\')
|
||||
break strip_quotes;
|
||||
goto default;
|
||||
default:
|
||||
yyr ~= yystr[i];
|
||||
break;
|
||||
|
||||
case '"':
|
||||
return yyr;
|
||||
}
|
||||
}
|
||||
else if (yystr=="$end")
|
||||
return "end of input";
|
||||
|
||||
return yystr;
|
||||
}
|
||||
|
||||
/*--------------------------------.
|
||||
| Print this symbol on YYOUTPUT. |
|
||||
`--------------------------------*/
|
||||
|
||||
private final void yy_symbol_print (string s, int yytype,
|
||||
ref ]b4_yystype[ yyvaluep]dnl
|
||||
b4_locations_if([, ref ]b4_location_type[ yylocationp])[)
|
||||
{
|
||||
if (yydebug > 0) {
|
||||
string message = s ~ (yytype < yyntokens_ ? " token " : " nterm ")
|
||||
~ yytname_[yytype] ~ " ("]b4_locations_if([
|
||||
~ yylocationp.toString() ~ ": "])[;
|
||||
static if (__traits(compiles, message~=yyvaluep.toString ()))
|
||||
message ~= yyvaluep.toString ();
|
||||
else
|
||||
message ~= format ("%s", &yyvaluep);
|
||||
message ~= ")";
|
||||
yycdebug (message);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Parse input from the scanner that was specified at object construction
|
||||
* time. Return whether the end of the input was reached successfully.
|
||||
*
|
||||
* @@return <tt>true</tt> if the parsing succeeds. Note that this does not
|
||||
* imply that there were no syntax errors.
|
||||
*/
|
||||
public bool parse ()
|
||||
{
|
||||
/// Lookahead and lookahead in internal form.
|
||||
int yychar = yyempty_;
|
||||
int yytoken = 0;
|
||||
|
||||
/* State. */
|
||||
int yyn = 0;
|
||||
int yylen = 0;
|
||||
int yystate = 0;
|
||||
|
||||
YYStack 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;
|
||||
|
||||
/// @@$.
|
||||
]b4_location_type[ yyloc;]])[
|
||||
|
||||
/// Semantic value of the lookahead.
|
||||
]b4_yystype[ yylval;
|
||||
|
||||
int yyresult;
|
||||
|
||||
yycdebug ("Starting parse\n");
|
||||
yyerrstatus_ = 0;
|
||||
|
||||
]m4_ifdef([b4_initial_action], [
|
||||
m4_pushdef([b4_at_dollar], [yylloc])dnl
|
||||
m4_pushdef([b4_dollar_dollar], [yylval])dnl
|
||||
/* User initialization code. */
|
||||
b4_user_initial_action
|
||||
m4_popdef([b4_dollar_dollar])dnl
|
||||
m4_popdef([b4_at_dollar])])dnl
|
||||
|
||||
[ /* Initialize the stack. */
|
||||
yystack.push (yystate, yylval]b4_locations_if([, yylloc])[);
|
||||
|
||||
int label = YYNEWSTATE;
|
||||
for (;;)
|
||||
final switch (label)
|
||||
{
|
||||
/* New state. Unlike in the C/C++ skeletons, the state is already
|
||||
pushed when we come here. */
|
||||
case YYNEWSTATE:
|
||||
yycdebug (format("Entering state %d\n", yystate));
|
||||
if (yydebug > 0)
|
||||
yystack.print (yyDebugStream);
|
||||
|
||||
/* Accept? */
|
||||
if (yystate == yyfinal_)
|
||||
return true;
|
||||
|
||||
/* Take a decision. First try without lookahead. */
|
||||
yyn = yypact_[yystate];
|
||||
if (yy_pact_value_is_default_ (yyn))
|
||||
{
|
||||
label = YYDEFAULT;
|
||||
break;
|
||||
}
|
||||
|
||||
/* Read a lookahead token. */
|
||||
if (yychar == yyempty_)
|
||||
{
|
||||
yycdebug ("Reading a token: ");
|
||||
yychar = yylex ();]b4_locations_if([[
|
||||
static if (yy_location_is_class) {
|
||||
yylloc = new ]b4_location_type[(yylexer.startPos, yylexer.endPos);
|
||||
} else {
|
||||
yylloc = ]b4_location_type[(yylexer.startPos, yylexer.endPos);
|
||||
}]])
|
||||
yylval = yylexer.semanticVal;[
|
||||
}
|
||||
|
||||
/* Convert token to internal form. */
|
||||
if (yychar <= YYTokenType.EOF)
|
||||
{
|
||||
yychar = yytoken = YYTokenType.EOF;
|
||||
yycdebug ("Now at end of input.\n");
|
||||
}
|
||||
else
|
||||
{
|
||||
yytoken = yytranslate_ (yychar);
|
||||
yy_symbol_print ("Next token is",
|
||||
yytoken, yylval]b4_locations_if([, yylloc])[);
|
||||
}
|
||||
|
||||
/* If the proper action on seeing token YYTOKEN is to reduce or to
|
||||
detect an error, take that action. */
|
||||
yyn += yytoken;
|
||||
if (yyn < 0 || yylast_ < yyn || yycheck_[yyn] != yytoken)
|
||||
label = YYDEFAULT;
|
||||
|
||||
/* <= 0 means reduce or error. */
|
||||
else if ((yyn = yytable_[yyn]) <= 0)
|
||||
{
|
||||
if (yy_table_value_is_error_ (yyn))
|
||||
label = YYERRLAB;
|
||||
else
|
||||
{
|
||||
yyn = -yyn;
|
||||
label = YYREDUCE;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Shift the lookahead token. */
|
||||
yy_symbol_print ("Shifting", yytoken,
|
||||
yylval]b4_locations_if([, yylloc])[);
|
||||
|
||||
/* Discard the token being shifted. */
|
||||
yychar = yyempty_;
|
||||
|
||||
/* Count tokens shifted since error; after three, turn off error
|
||||
* status. */
|
||||
if (yyerrstatus_ > 0)
|
||||
--yyerrstatus_;
|
||||
|
||||
yystate = yyn;
|
||||
yystack.push (yystate, yylval]b4_locations_if([, yylloc])[);
|
||||
label = YYNEWSTATE;
|
||||
}
|
||||
break;
|
||||
|
||||
/*-----------------------------------------------------------.
|
||||
| yydefault -- do the default action for the current state. |
|
||||
`-----------------------------------------------------------*/
|
||||
case YYDEFAULT:
|
||||
yyn = yydefact_[yystate];
|
||||
if (yyn == 0)
|
||||
label = YYERRLAB;
|
||||
else
|
||||
label = YYREDUCE;
|
||||
break;
|
||||
|
||||
/*-----------------------------.
|
||||
| yyreduce -- Do a reduction. |
|
||||
`-----------------------------*/
|
||||
case YYREDUCE:
|
||||
yylen = yyr2_[yyn];
|
||||
label = yyaction (yyn, yystack, yylen);
|
||||
yystate = yystack.stateAt (0);
|
||||
break;
|
||||
|
||||
/*------------------------------------.
|
||||
| yyerrlab -- here on detecting error |
|
||||
`------------------------------------*/
|
||||
case YYERRLAB:
|
||||
/* If not already recovering from an error, report this error. */
|
||||
if (yyerrstatus_ == 0)
|
||||
{
|
||||
++yynerrs_;
|
||||
if (yychar == yyempty_)
|
||||
yytoken = yyempty_;
|
||||
yyerror (]b4_locations_if([yylloc, ])[yysyntax_error (yystate, yytoken));
|
||||
}
|
||||
|
||||
]b4_locations_if([ yyerrloc = yylloc;])[
|
||||
if (yyerrstatus_ == 3)
|
||||
{
|
||||
/* If just tried and failed to reuse lookahead token after an
|
||||
* error, discard it. */
|
||||
|
||||
if (yychar <= YYTokenType.EOF)
|
||||
{
|
||||
/* Return failure if at end of input. */
|
||||
if (yychar == YYTokenType.EOF)
|
||||
return false;
|
||||
}
|
||||
else
|
||||
yychar = yyempty_;
|
||||
}
|
||||
|
||||
/* Else will try to reuse lookahead token after shifting the error
|
||||
* token. */
|
||||
label = YYERRLAB1;
|
||||
break;
|
||||
|
||||
/*-------------------------------------------------.
|
||||
| errorlab -- error raised explicitly by YYERROR. |
|
||||
`-------------------------------------------------*/
|
||||
case YYERROR:]b4_locations_if([
|
||||
yyerrloc = yystack.locationAt (yylen - 1);])[
|
||||
/* Do not reclaim the symbols of the rule which action triggered
|
||||
this YYERROR. */
|
||||
yystack.pop (yylen);
|
||||
yylen = 0;
|
||||
yystate = yystack.stateAt (0);
|
||||
label = YYERRLAB1;
|
||||
break;
|
||||
|
||||
/*-------------------------------------------------------------.
|
||||
| yyerrlab1 -- common code for both syntax error and YYERROR. |
|
||||
`-------------------------------------------------------------*/
|
||||
case YYERRLAB1:
|
||||
yyerrstatus_ = 3; /* Each real token shifted decrements this. */
|
||||
|
||||
for (;;)
|
||||
{
|
||||
yyn = yypact_[yystate];
|
||||
if (!yy_pact_value_is_default_ (yyn))
|
||||
{
|
||||
yyn += yyterror_;
|
||||
if (0 <= yyn && yyn <= yylast_ && yycheck_[yyn] == yyterror_)
|
||||
{
|
||||
yyn = yytable_[yyn];
|
||||
if (0 < yyn)
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/* Pop the current state because it cannot handle the error token. */
|
||||
if (yystack.height == 1)
|
||||
return false;
|
||||
|
||||
]b4_locations_if([ yyerrloc = yystack.locationAt (0);])[
|
||||
yystack.pop ();
|
||||
yystate = yystack.stateAt (0);
|
||||
if (yydebug > 0)
|
||||
yystack.print (yyDebugStream);
|
||||
}
|
||||
|
||||
]b4_locations_if([
|
||||
/* Muck with the stack to setup for yylloc. */
|
||||
yystack.push (0, yy_semantic_null, yylloc);
|
||||
yystack.push (0, yy_semantic_null, yyerrloc);
|
||||
yyloc = yylloc_from_stack (yystack, 2);
|
||||
yystack.pop (2);])[
|
||||
|
||||
/* Shift the error token. */
|
||||
yy_symbol_print ("Shifting", yystos_[yyn],
|
||||
yylval]b4_locations_if([, yyloc])[);
|
||||
|
||||
yystate = yyn;
|
||||
yystack.push (yyn, yylval]b4_locations_if([, yyloc])[);
|
||||
label = YYNEWSTATE;
|
||||
break;
|
||||
|
||||
/* Accept. */
|
||||
case YYACCEPT:
|
||||
return true;
|
||||
|
||||
/* Abort. */
|
||||
case YYABORT:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
// Generate an error message.
|
||||
private final string yysyntax_error (int yystate, int tok)
|
||||
{
|
||||
if (errorVerbose)
|
||||
{
|
||||
/* 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 the only way this function was invoked is if the
|
||||
default action is an error action. In that case, don't
|
||||
check for expected tokens because there are none.
|
||||
- The only way there can be no lookahead present (in tok) is
|
||||
if this state is a consistent state with a default action.
|
||||
Thus, detecting the absence of a lookahead is sufficient to
|
||||
determine that there is no unexpected or expected token to
|
||||
report. In that case, just report a simple "syntax error".
|
||||
- Don't assume there isn't a lookahead just because this
|
||||
state is a consistent state with a default action. There
|
||||
might have been a previous inconsistent state, consistent
|
||||
state with a non-default action, or user semantic action
|
||||
that manipulated yychar. (However, yychar is currently out
|
||||
of scope during semantic actions.)
|
||||
- Of course, the expected token list depends on states to
|
||||
have correct lookahead information, and it depends on the
|
||||
parser not to perform extra reductions after fetching a
|
||||
lookahead from the scanner and before detecting a syntax
|
||||
error. Thus, state merging (from LALR or IELR) and default
|
||||
reductions corrupt the expected token list. However, the
|
||||
list is correct for canonical LR with one exception: it
|
||||
will still contain any token that will not be accepted due
|
||||
to an error action in a later state.
|
||||
*/
|
||||
if (tok != yyempty_)
|
||||
{
|
||||
// FIXME: This method of building the message is not compatible
|
||||
// with internationalization.
|
||||
string res = "syntax error, unexpected ";
|
||||
res ~= yytnamerr_ (yytname_[tok]);
|
||||
int yyn = yypact_[yystate];
|
||||
if (!yy_pact_value_is_default_ (yyn))
|
||||
{
|
||||
/* Start YYX at -YYN if negative to avoid negative
|
||||
indexes in YYCHECK. In other words, skip the first
|
||||
-YYN actions for this state because they are default
|
||||
actions. */
|
||||
int yyxbegin = yyn < 0 ? -yyn : 0;
|
||||
/* Stay within bounds of both yycheck and yytname. */
|
||||
int yychecklim = yylast_ - yyn + 1;
|
||||
int yyxend = yychecklim < yyntokens_ ? yychecklim : yyntokens_;
|
||||
int count = 0;
|
||||
for (int x = yyxbegin; x < yyxend; ++x)
|
||||
if (yycheck_[x + yyn] == x && x != yyterror_
|
||||
&& !yy_table_value_is_error_ (yytable_[x + yyn]))
|
||||
++count;
|
||||
if (count < 5)
|
||||
{
|
||||
count = 0;
|
||||
for (int x = yyxbegin; x < yyxend; ++x)
|
||||
if (yycheck_[x + yyn] == x && x != yyterror_
|
||||
&& !yy_table_value_is_error_ (yytable_[x + yyn]))
|
||||
{
|
||||
res ~= count++ == 0 ? ", expecting " : " or ";
|
||||
res ~= yytnamerr_ (yytname_[x]);
|
||||
}
|
||||
}
|
||||
}
|
||||
return res;
|
||||
}
|
||||
}
|
||||
|
||||
return "syntax error";
|
||||
}
|
||||
|
||||
/**
|
||||
* Whether the given <code>yypact_</code> value indicates a defaulted state.
|
||||
* @@param yyvalue the value to check
|
||||
*/
|
||||
private static bool yy_pact_value_is_default_ (int yyvalue)
|
||||
{
|
||||
return yyvalue == yypact_ninf_;
|
||||
}
|
||||
|
||||
/**
|
||||
* Whether the given <code>yytable_</code> value indicates a syntax error.
|
||||
* @@param yyvalue the value to check
|
||||
*/
|
||||
private static bool yy_table_value_is_error_ (int yyvalue)
|
||||
{
|
||||
return yyvalue == yytable_ninf_;
|
||||
}
|
||||
|
||||
/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
|
||||
STATE-NUM. */
|
||||
private static immutable ]b4_int_type_for([b4_pact])[ yypact_ninf_ = ]b4_pact_ninf[;
|
||||
|
||||
/* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
|
||||
positive, shift that token. If negative, reduce the rule which
|
||||
number is the opposite. If YYTABLE_NINF_, syntax error. */
|
||||
private static immutable ]b4_int_type_for([b4_table])[ yytable_ninf_ = ]b4_table_ninf[;
|
||||
|
||||
]b4_parser_tables_define[
|
||||
|
||||
/* TOKEN_NUMBER_[YYLEX-NUM] -- Internal symbol number corresponding
|
||||
to YYLEX-NUM. */
|
||||
private static immutable ]b4_int_type_for([b4_toknum])[[]
|
||||
yytoken_number_ =
|
||||
@{
|
||||
]b4_toknum[
|
||||
@};
|
||||
|
||||
/* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
|
||||
First, the terminals, then, starting at \a yyntokens_, nonterminals. */
|
||||
private static immutable string[] yytname_ =
|
||||
@{
|
||||
]b4_tname[
|
||||
@};
|
||||
|
||||
/* YYRLINE[YYN] -- Source line where rule number YYN was defined. */
|
||||
private static immutable ]b4_int_type_for([b4_rline])[[] yyrline_ =
|
||||
@{
|
||||
]b4_rline[
|
||||
@};
|
||||
|
||||
// Report on the debug stream that the rule yyrule is going to be reduced.
|
||||
private final void yy_reduce_print (int yyrule, ref YYStack yystack)
|
||||
{
|
||||
if (yydebug == 0)
|
||||
return;
|
||||
|
||||
int yylno = yyrline_[yyrule];
|
||||
int yynrhs = yyr2_[yyrule];
|
||||
/* Print the symbols being reduced, and their result. */
|
||||
yycdebug (format("Reducing stack by rule %d (line %d), ",
|
||||
yyrule - 1, yylno));
|
||||
|
||||
/* The symbols being reduced. */
|
||||
for (int yyi = 0; yyi < yynrhs; yyi++)
|
||||
yy_symbol_print (format(" $%d =", yyi + 1),
|
||||
yystos_[yystack.stateAt(yynrhs - (yyi + 1))],
|
||||
]b4_rhs_value(yynrhs, yyi + 1)b4_locations_if([,
|
||||
b4_rhs_location(yynrhs, yyi + 1)])[);
|
||||
}
|
||||
|
||||
/* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
|
||||
private static immutable ]b4_int_type_for([b4_translate])[[] yytranslate_table_ =
|
||||
@{
|
||||
]b4_translate[
|
||||
@};
|
||||
|
||||
private static ]b4_int_type_for([b4_translate])[ yytranslate_ (int t)
|
||||
{
|
||||
if (t >= 0 && t <= yyuser_token_number_max_)
|
||||
return yytranslate_table_[t];
|
||||
else
|
||||
return yyundef_token_;
|
||||
}
|
||||
|
||||
private static immutable int yylast_ = ]b4_last[;
|
||||
private static immutable int yynnts_ = ]b4_nterms_number[;
|
||||
private static immutable int yyempty_ = -2;
|
||||
private static immutable int yyfinal_ = ]b4_final_state_number[;
|
||||
private static immutable int yyterror_ = 1;
|
||||
private static immutable int yyerrcode_ = 256;
|
||||
private static immutable int yyntokens_ = ]b4_tokens_number[;
|
||||
|
||||
private static immutable int yyuser_token_number_max_ = ]b4_user_token_number_max[;
|
||||
private static immutable int yyundef_token_ = ]b4_undef_token_number[;
|
||||
|
||||
]/* User implementation code. */
|
||||
b4_percent_code_get[]dnl
|
||||
|
||||
}
|
||||
b4_epilogue[]dnl
|
||||
m4_divert_pop(0)dnl
|
||||
@@ -1,6 +1,6 @@
|
||||
# Java skeleton for Bison -*- autoconf -*-
|
||||
|
||||
# Copyright (C) 2007-2013 Free Software Foundation, Inc.
|
||||
# Copyright (C) 2007-2015, 2018-2019 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
|
||||
@@ -15,47 +15,91 @@
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
m4_include(b4_pkgdatadir/[java.m4])
|
||||
m4_include(b4_skeletonsdir/[java.m4])
|
||||
|
||||
b4_defines_if([b4_fatal([%s: %%defines does not make sense in Java],
|
||||
[b4_skeleton])])
|
||||
b4_defines_if([b4_complain([%defines does not make sense in Java])])
|
||||
|
||||
# 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])
|
||||
|
||||
m4_define([b4_symbol_no_destructor_assert],
|
||||
[b4_symbol_if([$1], [has_destructor],
|
||||
[b4_fatal([%s: %s: %%destructor does not make sense in Java],
|
||||
[b4_skeleton],
|
||||
[b4_symbol_action_location([$1], [destructor])])])])
|
||||
[b4_complain_at(m4_unquote(b4_symbol([$1], [destructor_loc])),
|
||||
[%destructor does not make sense in Java])])])
|
||||
b4_symbol_foreach([b4_symbol_no_destructor_assert])
|
||||
|
||||
b4_output_begin([b4_parser_file_name])
|
||||
b4_copyright([Skeleton implementation for Bison LALR(1) parsers in Java],
|
||||
[2007-2013])
|
||||
# Setup some macros for api.push-pull.
|
||||
b4_percent_define_default([[api.push-pull]], [[pull]])
|
||||
b4_percent_define_check_values([[[[api.push-pull]],
|
||||
[[pull]], [[push]], [[both]]]])
|
||||
|
||||
b4_percent_define_ifdef([package], [package b4_percent_define_get([package]);
|
||||
])[/* First part of user declarations. */
|
||||
]b4_user_pre_prologue
|
||||
b4_user_post_prologue
|
||||
b4_percent_code_get([[imports]])
|
||||
[/**
|
||||
# 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],
|
||||
[2007-2015, 2018])[
|
||||
]b4_percent_define_ifdef([package], [package b4_percent_define_get([package]);[
|
||||
]])[
|
||||
]b4_user_pre_prologue[
|
||||
]b4_user_post_prologue[
|
||||
]b4_percent_code_get([[imports]])[
|
||||
/**
|
||||
* A Bison parser, automatically generated from <tt>]m4_bpatsubst(b4_file_name, [^"\(.*\)"$], [\1])[</tt>.
|
||||
*
|
||||
* @@author LALR (1) parser skeleton written by Paolo Bonzini.
|
||||
*/
|
||||
]b4_percent_define_get3([annotations], [], [ ])dnl
|
||||
b4_public_if([public ])dnl
|
||||
b4_abstract_if([abstract ])dnl
|
||||
b4_final_if([final ])dnl
|
||||
b4_strictfp_if([strictfp ])dnl
|
||||
[class ]b4_parser_class_name[]dnl
|
||||
b4_percent_define_get3([extends], [ extends ])dnl
|
||||
b4_percent_define_get3([implements], [ implements ])[
|
||||
]b4_parser_class_declaration[
|
||||
{
|
||||
]b4_identification[
|
||||
]b4_error_verbose_if([[
|
||||
/** True if verbose error messages are enabled. */
|
||||
/**
|
||||
* True if verbose error messages are enabled.
|
||||
*/
|
||||
private boolean yyErrorVerbose = true;
|
||||
|
||||
/**
|
||||
@@ -76,18 +120,24 @@ b4_locations_if([[
|
||||
* A class defining a pair of positions. Positions, defined by the
|
||||
* <code>]b4_position_type[</code> class, denote a point in the input.
|
||||
* Locations represent a part of the input through the beginning
|
||||
* and ending positions. */
|
||||
* and ending positions.
|
||||
*/
|
||||
public class ]b4_location_type[ {
|
||||
/** The first, inclusive, position in the range. */
|
||||
/**
|
||||
* The first, inclusive, position in the range.
|
||||
*/
|
||||
public ]b4_position_type[ begin;
|
||||
|
||||
/** The first position beyond the range. */
|
||||
/**
|
||||
* The first position beyond the range.
|
||||
*/
|
||||
public ]b4_position_type[ end;
|
||||
|
||||
/**
|
||||
* Create a <code>]b4_location_type[</code> denoting an empty range located at
|
||||
* 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) {
|
||||
this.begin = this.end = loc;
|
||||
}
|
||||
@@ -95,7 +145,8 @@ b4_locations_if([[
|
||||
/**
|
||||
* Create a <code>]b4_location_type[</code> from the endpoints of 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) {
|
||||
this.begin = begin;
|
||||
this.end = end;
|
||||
@@ -104,7 +155,8 @@ b4_locations_if([[
|
||||
/**
|
||||
* Print a representation of the location. For this to be correct,
|
||||
* <code>]b4_position_type[</code> should override the <code>equals</code>
|
||||
* method. */
|
||||
* method.
|
||||
*/
|
||||
public String toString () {
|
||||
if (begin.equals (end))
|
||||
return begin.toString ();
|
||||
@@ -126,7 +178,7 @@ b4_locations_if([[
|
||||
|
||||
/**
|
||||
* Communication interface between the scanner and the Bison-generated
|
||||
* parser <tt>]b4_parser_class_name[</tt>.
|
||||
* parser <tt>]b4_parser_class[</tt>.
|
||||
*/
|
||||
public interface Lexer {
|
||||
/** Token returned by the scanner to signal the end of its input. */
|
||||
@@ -136,24 +188,28 @@ b4_locations_if([[
|
||||
|
||||
]b4_locations_if([[/**
|
||||
* 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 ();
|
||||
|
||||
/**
|
||||
* 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 ();]])[
|
||||
|
||||
/**
|
||||
* 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 ();
|
||||
|
||||
/**
|
||||
* Entry point for the scanner. Returns the token identifier corresponding
|
||||
* to the next token and prepares to return the semantic value
|
||||
* ]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])[;
|
||||
|
||||
/**
|
||||
@@ -162,7 +218,8 @@ b4_locations_if([[
|
||||
*
|
||||
* ]b4_locations_if([[@@param loc The location of the element to which the
|
||||
* 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);]
|
||||
}
|
||||
|
||||
@@ -170,7 +227,9 @@ b4_locations_if([[
|
||||
]b4_percent_code_get([[lexer]])[
|
||||
}
|
||||
|
||||
]])[/** The object doing lexical analysis for us. */
|
||||
]])[/**
|
||||
* The object doing lexical analysis for us.
|
||||
*/
|
||||
private Lexer yylexer;
|
||||
]
|
||||
b4_parse_param_vars
|
||||
@@ -179,7 +238,7 @@ b4_lexer_if([[
|
||||
/**
|
||||
* Instantiates the Bison-generated parser.
|
||||
*/
|
||||
public ]b4_parser_class_name (b4_parse_param_decl([b4_lex_param_decl])[) ]b4_maybe_throws([b4_init_throws])[
|
||||
public ]b4_parser_class (b4_parse_param_decl([b4_lex_param_decl])[) ]b4_maybe_throws([b4_init_throws])[
|
||||
{
|
||||
]b4_percent_code_get([[init]])[
|
||||
this.yylexer = new YYLexer(]b4_lex_param_call[);
|
||||
@@ -191,7 +250,7 @@ b4_lexer_if([[
|
||||
* Instantiates the Bison-generated parser.
|
||||
* @@param yylexer The scanner that will supply tokens to the parser.
|
||||
*/
|
||||
b4_lexer_if([[protected]], [[public]]) b4_parser_class_name[ (]b4_parse_param_decl([[Lexer yylexer]])[) ]b4_maybe_throws([b4_init_throws])[
|
||||
b4_lexer_if([[protected]], [[public]]) b4_parser_class[ (]b4_parse_param_decl([[Lexer yylexer]])[) ]b4_maybe_throws([b4_init_throws])[
|
||||
{
|
||||
]b4_percent_code_get([[init]])[
|
||||
this.yylexer = yylexer;
|
||||
@@ -321,8 +380,7 @@ b4_lexer_if([[
|
||||
}
|
||||
|
||||
// Print the state stack on the debug stream.
|
||||
public void print (java.io.PrintStream out)
|
||||
{
|
||||
public void print (java.io.PrintStream out) {
|
||||
out.print ("Stack now");
|
||||
|
||||
for (int i = 0; i <= height; i++)
|
||||
@@ -336,39 +394,67 @@ b4_lexer_if([[
|
||||
|
||||
/**
|
||||
* 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;
|
||||
|
||||
/**
|
||||
* 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;
|
||||
|
||||
]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
|
||||
* printing an error message. */
|
||||
* printing an error message.
|
||||
*/
|
||||
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 YYNEWSTATE = 4;
|
||||
private static final int YYDEFAULT = 5;
|
||||
private static final int YYREDUCE = 6;
|
||||
private static final int YYERRLAB1 = 7;
|
||||
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;
|
||||
|
||||
]b4_push_if([dnl
|
||||
b4_define_state])[
|
||||
/**
|
||||
* Return whether error recovery is being done. In this state, the parser
|
||||
* reads token until it reaches a known state, and then restarts normal
|
||||
* operation. */
|
||||
* operation.
|
||||
*/
|
||||
public final boolean recovering ()
|
||||
{
|
||||
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])[
|
||||
{
|
||||
]b4_yystype[ yyval;
|
||||
@@ -399,14 +485,7 @@ b4_lexer_if([[
|
||||
yylen = 0;
|
||||
|
||||
/* Shift the result of the reduction. */
|
||||
yyn = 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_];
|
||||
|
||||
int yystate = yy_lr_goto_state_ (yystack.stateAt (0), yyr1_[yyn]);
|
||||
yystack.push (yystate, yyval]b4_locations_if([, yyloc])[);
|
||||
return YYNEWSTATE;
|
||||
}
|
||||
@@ -463,6 +542,7 @@ b4_lexer_if([[
|
||||
+ (yyvaluep == null ? "(null)" : yyvaluep.toString ()) + ")");
|
||||
}
|
||||
|
||||
]b4_push_if([],[[
|
||||
/**
|
||||
* Parse input from the scanner that was specified at object construction
|
||||
* time. Return whether the end of the input was reached successfully.
|
||||
@@ -470,46 +550,51 @@ b4_lexer_if([[
|
||||
* @@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])])[
|
||||
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.
|
||||
int yychar = yyempty_;
|
||||
int yytoken = 0;
|
||||
|
||||
/* 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;
|
||||
|
||||
]b4_locations_if([/* @@$. */
|
||||
b4_location_type yyloc;])[
|
||||
]b4_push_if([],[[
|
||||
]b4_define_state[
|
||||
yycdebug ("Starting parse\n");
|
||||
yyerrstatus_ = 0;
|
||||
|
||||
/* Initialize the stack. */
|
||||
yystack.push (yystate, yylval ]b4_locations_if([, yylloc])[);
|
||||
]m4_ifdef([b4_initial_action], [
|
||||
b4_dollar_pushdef([yylval], [], [yylloc])dnl
|
||||
/* User initialization code. */
|
||||
b4_dollar_pushdef([yylval], [], [], [yylloc])dnl
|
||||
b4_user_initial_action
|
||||
b4_dollar_popdef])[]dnl
|
||||
b4_dollar_popdef[]dnl
|
||||
])[
|
||||
]])[
|
||||
]b4_push_if([[
|
||||
if (!this.push_parse_initialized)
|
||||
{
|
||||
push_parse_initialize ();
|
||||
]m4_ifdef([b4_initial_action], [
|
||||
b4_dollar_pushdef([yylval], [], [], [yylloc])dnl
|
||||
b4_user_initial_action
|
||||
b4_dollar_popdef[]dnl
|
||||
])[
|
||||
yycdebug ("Starting parse\n");
|
||||
yyerrstatus_ = 0;
|
||||
} else
|
||||
label = YYGETTOKEN;
|
||||
|
||||
[ /* Initialize the stack. */
|
||||
yystack.push (yystate, yylval]b4_locations_if([, yylloc])[);
|
||||
|
||||
int label = YYNEWSTATE;
|
||||
boolean push_token_consumed = true;
|
||||
]])[
|
||||
for (;;)
|
||||
switch (label)
|
||||
{
|
||||
@@ -522,7 +607,8 @@ b4_dollar_popdef])[]dnl
|
||||
|
||||
/* Accept? */
|
||||
if (yystate == yyfinal_)
|
||||
return true;
|
||||
]b4_push_if([{label = YYACCEPT; break;}],
|
||||
[return true;])[
|
||||
|
||||
/* Take a decision. First try without lookahead. */
|
||||
yyn = yypact_[yystate];
|
||||
@@ -531,16 +617,27 @@ b4_dollar_popdef])[]dnl
|
||||
label = YYDEFAULT;
|
||||
break;
|
||||
}
|
||||
]b4_push_if([ /* Fall Through */
|
||||
|
||||
case YYGETTOKEN:])[
|
||||
/* Read a lookahead token. */
|
||||
if (yychar == yyempty_)
|
||||
{
|
||||
]b4_push_if([[
|
||||
if (!push_token_consumed)
|
||||
return YYPUSH_MORE;
|
||||
yycdebug ("Reading a token: ");
|
||||
yychar = yylexer.yylex ();]
|
||||
b4_locations_if([[
|
||||
yylloc = new ]b4_location_type[(yylexer.getStartPos (),
|
||||
yylexer.getEndPos ());]])
|
||||
yylval = yylexer.getLVal ();[
|
||||
yychar = yylextoken;
|
||||
yylval = yylexval;]b4_locations_if([
|
||||
yylloc = yylexloc;])[
|
||||
push_token_consumed = false;]])[
|
||||
]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. */
|
||||
@@ -637,10 +734,10 @@ b4_dollar_popdef])[]dnl
|
||||
{
|
||||
/* Return failure if at end of input. */
|
||||
if (yychar == Lexer.EOF)
|
||||
return false;
|
||||
]b4_push_if([{label = YYABORT; break;}],[return false;])[
|
||||
}
|
||||
else
|
||||
yychar = yyempty_;
|
||||
yychar = yyempty_;
|
||||
}
|
||||
|
||||
/* Else will try to reuse lookahead token after shifting the error
|
||||
@@ -648,9 +745,9 @@ b4_dollar_popdef])[]dnl
|
||||
label = YYERRLAB1;
|
||||
break;
|
||||
|
||||
/*---------------------------------------------------.
|
||||
/*-------------------------------------------------.
|
||||
| errorlab -- error raised explicitly by YYERROR. |
|
||||
`---------------------------------------------------*/
|
||||
`-------------------------------------------------*/
|
||||
case YYERROR:
|
||||
|
||||
]b4_locations_if([yyerrloc = yystack.locationAt (yylen - 1);])[
|
||||
@@ -682,9 +779,10 @@ b4_dollar_popdef])[]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)
|
||||
return false;
|
||||
]b4_push_if([{label = YYABORT; break;}],[return false;])[
|
||||
|
||||
]b4_locations_if([yyerrloc = yystack.locationAt (0);])[
|
||||
yystack.pop ();
|
||||
@@ -693,7 +791,11 @@ b4_dollar_popdef])[]dnl
|
||||
yystack.print (yyDebugStream);
|
||||
}
|
||||
|
||||
]b4_locations_if([
|
||||
if (label == YYABORT)
|
||||
/* Leave the switch. */
|
||||
break;
|
||||
|
||||
]b4_locations_if([
|
||||
/* Muck with the stack to setup for yylloc. */
|
||||
yystack.push (0, null, yylloc);
|
||||
yystack.push (0, null, yyerrloc);
|
||||
@@ -711,13 +813,91 @@ b4_dollar_popdef])[]dnl
|
||||
|
||||
/* Accept. */
|
||||
case YYACCEPT:
|
||||
return true;
|
||||
]b4_push_if([this.push_parse_initialized = false; return YYACCEPT;],
|
||||
[return true;])[
|
||||
|
||||
/* Abort. */
|
||||
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.
|
||||
private String yysyntax_error (int yystate, int tok)
|
||||
@@ -752,8 +932,8 @@ b4_dollar_popdef])[]dnl
|
||||
*/
|
||||
if (tok != yyempty_)
|
||||
{
|
||||
// FIXME: This method of building the message is not compatible
|
||||
// with internationalization.
|
||||
/* FIXME: This method of building the message is not compatible
|
||||
with internationalization. */
|
||||
StringBuffer res =
|
||||
new StringBuffer ("syntax error, unexpected ");
|
||||
res.append (yytnamerr_ (yytname_[tok]));
|
||||
@@ -802,8 +982,9 @@ b4_dollar_popdef])[]dnl
|
||||
}
|
||||
|
||||
/**
|
||||
* Whether the given <code>yytable_</code> value indicates a syntax error.
|
||||
* @@param yyvalue the value to check
|
||||
* Whether the given <code>yytable_</code>
|
||||
* value indicates a syntax error.
|
||||
* @@param yyvalue the value to check
|
||||
*/
|
||||
private static boolean yy_table_value_is_error_ (int yyvalue)
|
||||
{
|
||||
@@ -825,6 +1006,7 @@ b4_dollar_popdef])[]dnl
|
||||
]b4_integral_parser_table_define([rline], [b4_rline],
|
||||
[[YYRLINE[YYN] -- Source line where rule number YYN was defined.]])[
|
||||
|
||||
|
||||
// Report on the debug stream that the rule yyrule is going to be reduced.
|
||||
private void yy_reduce_print (int yyrule, YYStack yystack)
|
||||
{
|
||||
@@ -841,11 +1023,12 @@ b4_dollar_popdef])[]dnl
|
||||
for (int yyi = 0; yyi < yynrhs; yyi++)
|
||||
yy_symbol_print (" $" + (yyi + 1) + " =",
|
||||
yystos_[yystack.stateAt(yynrhs - (yyi + 1))],
|
||||
]b4_rhs_value(yynrhs, yyi + 1)b4_locations_if([,
|
||||
]b4_rhs_data(yynrhs, yyi + 1)b4_locations_if([,
|
||||
b4_rhs_location(yynrhs, yyi + 1)])[);
|
||||
}
|
||||
|
||||
/* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
|
||||
/* YYTRANSLATE(TOKEN-NUM) -- Symbol number corresponding to TOKEN-NUM
|
||||
as returned by yylex, with out-of-bounds checking. */
|
||||
]b4_integral_parser_table_define([translate_table], [b4_translate])[
|
||||
|
||||
private static final ]b4_int_type_for([b4_translate])[ yytranslate_ (int t)
|
||||
@@ -873,4 +1056,4 @@ b4_percent_code_get[]dnl
|
||||
}
|
||||
|
||||
b4_epilogue[]dnl
|
||||
b4_output_end()
|
||||
b4_output_end
|
||||
@@ -1,6 +1,6 @@
|
||||
# C++ skeleton for Bison
|
||||
|
||||
# Copyright (C) 2002-2013 Free Software Foundation, Inc.
|
||||
# Copyright (C) 2002-2015, 2018-2019 Free Software Foundation, Inc.
|
||||
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
@@ -16,31 +16,67 @@
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
m4_pushdef([b4_copyright_years],
|
||||
[2002-2013])
|
||||
[2002-2015, 2018-2019])
|
||||
|
||||
# b4_position_define
|
||||
|
||||
# b4_position_file
|
||||
# ----------------
|
||||
# Name of the file containing the position class, if we want this file.
|
||||
b4_defines_if([b4_required_version_if([302], [],
|
||||
[m4_define([b4_position_file], [position.hh])])])])
|
||||
|
||||
|
||||
# b4_location_file
|
||||
# ----------------
|
||||
# Name of the file containing the position/location class,
|
||||
# if we want this file.
|
||||
b4_percent_define_check_file([b4_location_file],
|
||||
[[api.location.file]],
|
||||
b4_defines_if([[location.hh]]))
|
||||
|
||||
# b4_location_include
|
||||
# -------------------
|
||||
# If location.hh is to be generated, the name under which should it be
|
||||
# included.
|
||||
#
|
||||
# b4_location_path
|
||||
# ----------------
|
||||
# The path to use for the CPP guard.
|
||||
m4_ifdef([b4_location_file],
|
||||
[m4_define([b4_location_include],
|
||||
[b4_percent_define_get([[api.location.include]],
|
||||
["b4_location_file"])])
|
||||
m4_define([b4_location_path],
|
||||
b4_percent_define_get([[api.location.include]],
|
||||
["b4_dir_prefix[]b4_location_file"]))
|
||||
m4_define([b4_location_path],
|
||||
m4_substr(m4_defn([b4_location_path]), 1, m4_eval(m4_len(m4_defn([b4_location_path])) - 2)))
|
||||
])
|
||||
|
||||
|
||||
|
||||
# b4_location_define
|
||||
# ------------------
|
||||
# Define class position.
|
||||
m4_define([b4_position_define],
|
||||
[[ /// Abstract a position.
|
||||
# Define the position and location classes.
|
||||
m4_define([b4_location_define],
|
||||
[[ /// A point in a source file.
|
||||
class position
|
||||
{
|
||||
public:]m4_ifdef([b4_location_constructors], [[
|
||||
/// Construct a position.
|
||||
explicit position (]b4_percent_define_get([[filename_type]])[* f = YY_NULL,
|
||||
unsigned int l = ]b4_location_initial_line[u,
|
||||
unsigned int c = ]b4_location_initial_column[u)
|
||||
explicit position (]b4_percent_define_get([[filename_type]])[* f = YY_NULLPTR,
|
||||
unsigned l = ]b4_location_initial_line[u,
|
||||
unsigned c = ]b4_location_initial_column[u)
|
||||
: filename (f)
|
||||
, line (l)
|
||||
, column (c)
|
||||
{
|
||||
}
|
||||
{}
|
||||
|
||||
]])[
|
||||
/// Initialization.
|
||||
void initialize (]b4_percent_define_get([[filename_type]])[* fn = YY_NULL,
|
||||
unsigned int l = ]b4_location_initial_line[u,
|
||||
unsigned int c = ]b4_location_initial_column[u)
|
||||
void initialize (]b4_percent_define_get([[filename_type]])[* fn = YY_NULLPTR,
|
||||
unsigned l = ]b4_location_initial_line[u,
|
||||
unsigned c = ]b4_location_initial_column[u)
|
||||
{
|
||||
filename = fn;
|
||||
line = l;
|
||||
@@ -69,21 +105,20 @@ m4_define([b4_position_define],
|
||||
/// File name to which this position refers.
|
||||
]b4_percent_define_get([[filename_type]])[* filename;
|
||||
/// Current line number.
|
||||
unsigned int line;
|
||||
unsigned line;
|
||||
/// Current column number.
|
||||
unsigned int column;
|
||||
unsigned column;
|
||||
|
||||
private:
|
||||
/// Compute max(min, lhs+rhs) (provided min <= lhs).
|
||||
static unsigned int add_ (unsigned int lhs, int rhs, unsigned int min)
|
||||
/// Compute max (min, lhs+rhs).
|
||||
static unsigned add_ (unsigned lhs, int rhs, int min)
|
||||
{
|
||||
return (0 < rhs || -static_cast<unsigned int>(rhs) < lhs
|
||||
? rhs + lhs
|
||||
: 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 position&
|
||||
operator+= (position& res, int width)
|
||||
{
|
||||
@@ -91,21 +126,21 @@ m4_define([b4_position_define],
|
||||
return res;
|
||||
}
|
||||
|
||||
/// Add two position objects.
|
||||
/// Add \a width columns.
|
||||
inline position
|
||||
operator+ (position res, int width)
|
||||
{
|
||||
return res += width;
|
||||
}
|
||||
|
||||
/// Add and assign a position.
|
||||
/// Subtract \a width columns, in place.
|
||||
inline position&
|
||||
operator-= (position& res, int width)
|
||||
{
|
||||
return res += -width;
|
||||
}
|
||||
|
||||
/// Add two position objects.
|
||||
/// Subtract \a width columns.
|
||||
inline position
|
||||
operator- (position res, int width)
|
||||
{
|
||||
@@ -135,20 +170,15 @@ m4_define([b4_position_define],
|
||||
** \param pos a reference to the position to redirect
|
||||
*/
|
||||
template <typename YYChar>
|
||||
inline std::basic_ostream<YYChar>&
|
||||
std::basic_ostream<YYChar>&
|
||||
operator<< (std::basic_ostream<YYChar>& ostr, const position& pos)
|
||||
{
|
||||
if (pos.filename)
|
||||
ostr << *pos.filename << ':';
|
||||
return ostr << pos.line << '.' << pos.column;
|
||||
}
|
||||
]])
|
||||
|
||||
|
||||
# b4_location_define
|
||||
# ------------------
|
||||
m4_define([b4_location_define],
|
||||
[[ /// Abstract a location.
|
||||
/// Two points in a source file.
|
||||
class location
|
||||
{
|
||||
public:
|
||||
@@ -157,30 +187,27 @@ m4_define([b4_location_define],
|
||||
location (const position& b, const position& e)
|
||||
: begin (b)
|
||||
, end (e)
|
||||
{
|
||||
}
|
||||
{}
|
||||
|
||||
/// Construct a 0-width location in \a p.
|
||||
explicit location (const position& p = position ())
|
||||
: begin (p)
|
||||
, end (p)
|
||||
{
|
||||
}
|
||||
{}
|
||||
|
||||
/// Construct a 0-width location in \a f, \a l, \a c.
|
||||
explicit location (]b4_percent_define_get([[filename_type]])[* f,
|
||||
unsigned int l = ]b4_location_initial_line[u,
|
||||
unsigned int c = ]b4_location_initial_column[u)
|
||||
unsigned l = ]b4_location_initial_line[u,
|
||||
unsigned c = ]b4_location_initial_column[u)
|
||||
: begin (f, l, c)
|
||||
, end (f, l, c)
|
||||
{
|
||||
}
|
||||
{}
|
||||
|
||||
])[
|
||||
/// Initialization.
|
||||
void initialize (]b4_percent_define_get([[filename_type]])[* f = YY_NULL,
|
||||
unsigned int l = ]b4_location_initial_line[u,
|
||||
unsigned int c = ]b4_location_initial_column[u)
|
||||
void initialize (]b4_percent_define_get([[filename_type]])[* f = YY_NULLPTR,
|
||||
unsigned l = ]b4_location_initial_line[u,
|
||||
unsigned c = ]b4_location_initial_column[u)
|
||||
{
|
||||
begin.initialize (f, l, c);
|
||||
end = begin;
|
||||
@@ -216,36 +243,42 @@ m4_define([b4_location_define],
|
||||
position end;
|
||||
};
|
||||
|
||||
/// Join two location objects to create a location.
|
||||
inline location operator+ (location res, const location& end)
|
||||
/// Join two locations, in place.
|
||||
inline location& operator+= (location& res, const location& end)
|
||||
{
|
||||
res.end = end.end;
|
||||
return res;
|
||||
}
|
||||
|
||||
/// Change end position in place.
|
||||
/// Join two locations.
|
||||
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)
|
||||
{
|
||||
res.columns (width);
|
||||
return res;
|
||||
}
|
||||
|
||||
/// Change end position.
|
||||
/// Add \a width columns to the end position.
|
||||
inline location operator+ (location res, int width)
|
||||
{
|
||||
return res += width;
|
||||
}
|
||||
|
||||
/// Change end position in place.
|
||||
/// Subtract \a width columns to the end position, in place.
|
||||
inline location& operator-= (location& res, int width)
|
||||
{
|
||||
return res += -width;
|
||||
}
|
||||
|
||||
/// Change end position.
|
||||
inline location operator- (const location& begin, int width)
|
||||
/// Subtract \a width columns to the end position.
|
||||
inline location operator- (location res, int width)
|
||||
{
|
||||
return begin + -width;
|
||||
return res -= width;
|
||||
}
|
||||
]b4_percent_define_flag_if([[define_location_comparison]], [[
|
||||
/// Compare two location objects.
|
||||
@@ -269,12 +302,11 @@ m4_define([b4_location_define],
|
||||
** Avoid duplicate information.
|
||||
*/
|
||||
template <typename YYChar>
|
||||
inline std::basic_ostream<YYChar>&
|
||||
std::basic_ostream<YYChar>&
|
||||
operator<< (std::basic_ostream<YYChar>& ostr, const location& loc)
|
||||
{
|
||||
unsigned int end_col = 0 < loc.end.column ? loc.end.column - 1 : 0;
|
||||
ostr << loc.begin// << "(" << loc.end << ") "
|
||||
;
|
||||
unsigned end_col = 0 < loc.end.column ? loc.end.column - 1 : 0;
|
||||
ostr << loc.begin;
|
||||
if (loc.end.filename
|
||||
&& (!loc.begin.filename
|
||||
|| *loc.begin.filename != *loc.end.filename))
|
||||
@@ -288,16 +320,31 @@ m4_define([b4_location_define],
|
||||
]])
|
||||
|
||||
|
||||
b4_defines_if([
|
||||
b4_output_begin([b4_dir_prefix[]position.hh])
|
||||
b4_copyright([Positions for Bison parsers in C++])[
|
||||
m4_ifdef([b4_position_file], [[
|
||||
]b4_output_begin([b4_dir_prefix], [b4_position_file])[
|
||||
]b4_generated_by[
|
||||
// Starting with Bison 3.2, this file is useless: the structure it
|
||||
// used to define is now defined in "]b4_location_file[".
|
||||
//
|
||||
// To get rid of this file:
|
||||
// 1. add 'require "3.2"' (or newer) to your grammar file
|
||||
// 2. remove references to this file from your build system
|
||||
// 3. if you used to include it, include "]b4_location_file[" instead.
|
||||
|
||||
#include ]b4_location_include[
|
||||
]b4_output_end[
|
||||
]])
|
||||
|
||||
|
||||
m4_ifdef([b4_location_file], [[
|
||||
]b4_output_begin([b4_dir_prefix], [b4_location_file])[
|
||||
]b4_copyright([Locations for Bison parsers in C++])[
|
||||
/**
|
||||
** \file ]b4_dir_prefix[position.hh
|
||||
** Define the ]b4_namespace_ref[::position class.
|
||||
** \file ]b4_location_path[
|
||||
** Define the ]b4_namespace_ref[::location class.
|
||||
*/
|
||||
|
||||
]b4_cpp_guard_open([b4_dir_prefix[]position.hh])[
|
||||
]b4_cpp_guard_open([b4_location_path])[
|
||||
|
||||
# include <algorithm> // std::max
|
||||
# include <iostream>
|
||||
@@ -305,31 +352,12 @@ b4_copyright([Positions for Bison parsers in C++])[
|
||||
|
||||
]b4_null_define[
|
||||
|
||||
]b4_namespace_open[
|
||||
]b4_position_define[
|
||||
]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_output_end()
|
||||
])
|
||||
]b4_cpp_guard_close([b4_location_path])[
|
||||
]b4_output_end[
|
||||
]])
|
||||
|
||||
|
||||
m4_popdef([b4_copyright_years])
|
||||
@@ -0,0 +1,163 @@
|
||||
# C++ skeleton for Bison
|
||||
|
||||
# Copyright (C) 2002-2015, 2018-2019 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_stack_file
|
||||
# -------------
|
||||
# Name of the file containing the stack class, if we want this file.
|
||||
b4_defines_if([b4_required_version_if([302], [],
|
||||
[m4_define([b4_stack_file], [stack.hh])])])
|
||||
|
||||
|
||||
# b4_stack_define
|
||||
# ---------------
|
||||
m4_define([b4_stack_define],
|
||||
[[ /// A stack with random access from its top.
|
||||
template <typename T, typename S = std::vector<T> >
|
||||
class stack
|
||||
{
|
||||
public:
|
||||
// Hide our reversed order.
|
||||
typedef typename S::reverse_iterator iterator;
|
||||
typedef typename S::const_reverse_iterator const_iterator;
|
||||
typedef typename S::size_type size_type;
|
||||
|
||||
stack (size_type n = 200)
|
||||
: seq_ (n)
|
||||
{}
|
||||
|
||||
/// Random access.
|
||||
///
|
||||
/// Index 0 returns the topmost element.
|
||||
T&
|
||||
operator[] (size_type i)
|
||||
{
|
||||
return seq_[size () - 1 - i];
|
||||
}
|
||||
|
||||
/// Random access.
|
||||
///
|
||||
/// Index 0 returns the topmost element.
|
||||
T&
|
||||
operator[] (int i)
|
||||
{
|
||||
return operator[] (size_type (i));
|
||||
}
|
||||
|
||||
/// Random access.
|
||||
///
|
||||
/// Index 0 returns the topmost element.
|
||||
const T&
|
||||
operator[] (size_type i) const
|
||||
{
|
||||
return seq_[size () - 1 - i];
|
||||
}
|
||||
|
||||
/// Random access.
|
||||
///
|
||||
/// Index 0 returns the topmost element.
|
||||
const T&
|
||||
operator[] (int i) const
|
||||
{
|
||||
return operator[] (size_type (i));
|
||||
}
|
||||
|
||||
/// Steal the contents of \a t.
|
||||
///
|
||||
/// Close to move-semantics.
|
||||
void
|
||||
push (YY_MOVE_REF (T) t)
|
||||
{
|
||||
seq_.push_back (T ());
|
||||
operator[] (0).move (t);
|
||||
}
|
||||
|
||||
/// Pop elements from the stack.
|
||||
void
|
||||
pop (int n = 1) YY_NOEXCEPT
|
||||
{
|
||||
for (; 0 < n; --n)
|
||||
seq_.pop_back ();
|
||||
}
|
||||
|
||||
/// Pop all elements from the stack.
|
||||
void
|
||||
clear () YY_NOEXCEPT
|
||||
{
|
||||
seq_.clear ();
|
||||
}
|
||||
|
||||
/// Number of elements on the stack.
|
||||
size_type
|
||||
size () const YY_NOEXCEPT
|
||||
{
|
||||
return seq_.size ();
|
||||
}
|
||||
|
||||
/// Iterator on top of the stack (going downwards).
|
||||
const_iterator
|
||||
begin () const YY_NOEXCEPT
|
||||
{
|
||||
return seq_.rbegin ();
|
||||
}
|
||||
|
||||
/// Bottom of the stack.
|
||||
const_iterator
|
||||
end () const YY_NOEXCEPT
|
||||
{
|
||||
return seq_.rend ();
|
||||
}
|
||||
|
||||
/// Present a slice of the top of a stack.
|
||||
class slice
|
||||
{
|
||||
public:
|
||||
slice (const stack& stack, int range)
|
||||
: stack_ (stack)
|
||||
, range_ (range)
|
||||
{}
|
||||
|
||||
const T&
|
||||
operator[] (int i) const
|
||||
{
|
||||
return stack_[range_ - i];
|
||||
}
|
||||
|
||||
private:
|
||||
const stack& stack_;
|
||||
int range_;
|
||||
};
|
||||
|
||||
private:
|
||||
stack (const stack&);
|
||||
stack& operator= (const stack&);
|
||||
/// The wrapped container.
|
||||
S seq_;
|
||||
};
|
||||
]])
|
||||
|
||||
m4_ifdef([b4_stack_file],
|
||||
[b4_output_begin([b4_dir_prefix], [b4_stack_file])[
|
||||
]b4_generated_by[
|
||||
// Starting with Bison 3.2, this file is useless: the structure it
|
||||
// used to define is now defined with the parser itself.
|
||||
//
|
||||
// To get rid of this file:
|
||||
// 1. add 'require "3.2"' (or newer) to your grammar file
|
||||
// 2. remove references to this file from your build system.
|
||||
]b4_output_end[
|
||||
]])
|
||||
@@ -0,0 +1,453 @@
|
||||
# C++ skeleton for Bison
|
||||
|
||||
# Copyright (C) 2002-2015, 2018-2019 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/>.
|
||||
|
||||
|
||||
## --------- ##
|
||||
## variant. ##
|
||||
## --------- ##
|
||||
|
||||
# b4_symbol_variant(YYTYPE, YYVAL, ACTION, [ARGS])
|
||||
# ------------------------------------------------
|
||||
# Run some ACTION ("build", or "destroy") on YYVAL of symbol type
|
||||
# YYTYPE.
|
||||
m4_define([b4_symbol_variant],
|
||||
[m4_pushdef([b4_dollar_dollar],
|
||||
[$2.$3< $][3 > (m4_shift3($@))])dnl
|
||||
switch ($1)
|
||||
{
|
||||
b4_type_foreach([_b4_type_action])[]dnl
|
||||
default:
|
||||
break;
|
||||
}
|
||||
m4_popdef([b4_dollar_dollar])dnl
|
||||
])
|
||||
|
||||
|
||||
# _b4_char_sizeof_counter
|
||||
# -----------------------
|
||||
# A counter used by _b4_char_sizeof_dummy to create fresh symbols.
|
||||
m4_define([_b4_char_sizeof_counter],
|
||||
[0])
|
||||
|
||||
# _b4_char_sizeof_dummy
|
||||
# ---------------------
|
||||
# At each call return a new C++ identifier.
|
||||
m4_define([_b4_char_sizeof_dummy],
|
||||
[m4_define([_b4_char_sizeof_counter], m4_incr(_b4_char_sizeof_counter))dnl
|
||||
dummy[]_b4_char_sizeof_counter])
|
||||
|
||||
|
||||
# b4_char_sizeof(SYMBOL-NUMS)
|
||||
# ---------------------------
|
||||
# To be mapped on the list of type names to produce:
|
||||
#
|
||||
# char dummy1[sizeof (type_name_1)];
|
||||
# char dummy2[sizeof (type_name_2)];
|
||||
#
|
||||
# for defined type names.
|
||||
m4_define([b4_char_sizeof],
|
||||
[b4_symbol_if([$1], [has_type],
|
||||
[
|
||||
m4_map([ b4_symbol_tag_comment], [$@])dnl
|
||||
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
|
||||
]])
|
||||
|
||||
|
||||
|
||||
## -------------------------- ##
|
||||
## Adjustments for variants. ##
|
||||
## -------------------------- ##
|
||||
|
||||
|
||||
# b4_value_type_declare
|
||||
# ---------------------
|
||||
# Define semantic_type.
|
||||
m4_define([b4_value_type_declare],
|
||||
[[ /// A buffer to store and retrieve objects.
|
||||
///
|
||||
/// Sort of a variant, but does not keep track of the nature
|
||||
/// of the stored data, since that knowledge is available
|
||||
/// via the current parser state.
|
||||
class semantic_type
|
||||
{
|
||||
public:
|
||||
/// Type of *this.
|
||||
typedef semantic_type self_type;
|
||||
|
||||
/// Empty construction.
|
||||
semantic_type () YY_NOEXCEPT
|
||||
: yybuffer_ ()]b4_parse_assert_if([
|
||||
, yytypeid_ (YY_NULLPTR)])[
|
||||
{}
|
||||
|
||||
/// Construct and fill.
|
||||
template <typename T>
|
||||
semantic_type (YY_RVREF (T) t)]b4_parse_assert_if([
|
||||
: yytypeid_ (&typeid (T))])[
|
||||
{
|
||||
YYASSERT (sizeof (T) <= size);
|
||||
new (yyas_<T> ()) T (YY_MOVE (t));
|
||||
}
|
||||
|
||||
/// Destruction, allowed only if empty.
|
||||
~semantic_type () YY_NOEXCEPT
|
||||
{]b4_parse_assert_if([
|
||||
YYASSERT (!yytypeid_);
|
||||
])[}
|
||||
|
||||
# if 201103L <= YY_CPLUSPLUS
|
||||
/// Instantiate a \a T in here from \a t.
|
||||
template <typename T, typename... U>
|
||||
T&
|
||||
emplace (U&&... u)
|
||||
{]b4_parse_assert_if([
|
||||
YYASSERT (!yytypeid_);
|
||||
YYASSERT (sizeof (T) <= size);
|
||||
yytypeid_ = & typeid (T);])[
|
||||
return *new (yyas_<T> ()) T (std::forward <U>(u)...);
|
||||
}
|
||||
# else
|
||||
/// Instantiate an empty \a T in here.
|
||||
template <typename T>
|
||||
T&
|
||||
emplace ()
|
||||
{]b4_parse_assert_if([
|
||||
YYASSERT (!yytypeid_);
|
||||
YYASSERT (sizeof (T) <= size);
|
||||
yytypeid_ = & typeid (T);])[
|
||||
return *new (yyas_<T> ()) T ();
|
||||
}
|
||||
|
||||
/// Instantiate a \a T in here from \a t.
|
||||
template <typename T>
|
||||
T&
|
||||
emplace (const T& t)
|
||||
{]b4_parse_assert_if([
|
||||
YYASSERT (!yytypeid_);
|
||||
YYASSERT (sizeof (T) <= size);
|
||||
yytypeid_ = & typeid (T);])[
|
||||
return *new (yyas_<T> ()) T (t);
|
||||
}
|
||||
# endif
|
||||
|
||||
/// Instantiate an empty \a T in here.
|
||||
/// Obsolete, use emplace.
|
||||
template <typename T>
|
||||
T&
|
||||
build ()
|
||||
{
|
||||
return emplace<T> ();
|
||||
}
|
||||
|
||||
/// Instantiate a \a T in here from \a t.
|
||||
/// Obsolete, use emplace.
|
||||
template <typename T>
|
||||
T&
|
||||
build (const T& t)
|
||||
{
|
||||
return emplace<T> (t);
|
||||
}
|
||||
|
||||
/// Accessor to a built \a T.
|
||||
template <typename T>
|
||||
T&
|
||||
as () YY_NOEXCEPT
|
||||
{]b4_parse_assert_if([
|
||||
YYASSERT (yytypeid_);
|
||||
YYASSERT (*yytypeid_ == typeid (T));
|
||||
YYASSERT (sizeof (T) <= size);])[
|
||||
return *yyas_<T> ();
|
||||
}
|
||||
|
||||
/// Const accessor to a built \a T (for %printer).
|
||||
template <typename T>
|
||||
const T&
|
||||
as () const YY_NOEXCEPT
|
||||
{]b4_parse_assert_if([
|
||||
YYASSERT (yytypeid_);
|
||||
YYASSERT (*yytypeid_ == typeid (T));
|
||||
YYASSERT (sizeof (T) <= size);])[
|
||||
return *yyas_<T> ();
|
||||
}
|
||||
|
||||
/// Swap the content with \a that, 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 responsibility.
|
||||
/// Swapping between built and (possibly) non-built is done with
|
||||
/// self_type::move ().
|
||||
template <typename T>
|
||||
void
|
||||
swap (self_type& that) YY_NOEXCEPT
|
||||
{]b4_parse_assert_if([
|
||||
YYASSERT (yytypeid_);
|
||||
YYASSERT (*yytypeid_ == *that.yytypeid_);])[
|
||||
std::swap (as<T> (), that.as<T> ());
|
||||
}
|
||||
|
||||
/// Move the content of \a that to this.
|
||||
///
|
||||
/// Destroys \a that.
|
||||
template <typename T>
|
||||
void
|
||||
move (self_type& that)
|
||||
{
|
||||
# if 201103L <= YY_CPLUSPLUS
|
||||
emplace<T> (std::move (that.as<T> ()));
|
||||
# else
|
||||
emplace<T> ();
|
||||
swap<T> (that);
|
||||
# endif
|
||||
that.destroy<T> ();
|
||||
}
|
||||
|
||||
# if 201103L <= YY_CPLUSPLUS
|
||||
/// Move the content of \a that to this.
|
||||
template <typename T>
|
||||
void
|
||||
move (self_type&& that)
|
||||
{
|
||||
emplace<T> (std::move (that.as<T> ()));
|
||||
that.destroy<T> ();
|
||||
}
|
||||
#endif
|
||||
|
||||
/// Copy the content of \a that to this.
|
||||
template <typename T>
|
||||
void
|
||||
copy (const self_type& that)
|
||||
{
|
||||
emplace<T> (that.as<T> ());
|
||||
}
|
||||
|
||||
/// Destroy the stored \a T.
|
||||
template <typename T>
|
||||
void
|
||||
destroy ()
|
||||
{
|
||||
as<T> ().~T ();]b4_parse_assert_if([
|
||||
yytypeid_ = YY_NULLPTR;])[
|
||||
}
|
||||
|
||||
private:
|
||||
/// Prohibit blind copies.
|
||||
self_type& operator= (const self_type&);
|
||||
semantic_type (const self_type&);
|
||||
|
||||
/// Accessor to raw memory as \a T.
|
||||
template <typename T>
|
||||
T*
|
||||
yyas_ () YY_NOEXCEPT
|
||||
{
|
||||
void *yyp = yybuffer_.yyraw;
|
||||
return static_cast<T*> (yyp);
|
||||
}
|
||||
|
||||
/// Const accessor to raw memory as \a T.
|
||||
template <typename T>
|
||||
const T*
|
||||
yyas_ () const YY_NOEXCEPT
|
||||
{
|
||||
const void *yyp = yybuffer_.yyraw;
|
||||
return static_cast<const T*> (yyp);
|
||||
}
|
||||
|
||||
/// An auxiliary type to compute the largest semantic type.
|
||||
union union_type
|
||||
{]b4_type_foreach([b4_char_sizeof])[ };
|
||||
|
||||
/// The size of the largest semantic type.
|
||||
enum { size = sizeof (union_type) };
|
||||
|
||||
/// A buffer to store semantic values.
|
||||
union
|
||||
{
|
||||
/// Strongest alignment constraints.
|
||||
long double yyalign_me;
|
||||
/// A buffer large enough to store any of the semantic values.
|
||||
char yyraw[size];
|
||||
} yybuffer_;]b4_parse_assert_if([
|
||||
|
||||
/// Whether the content is built: if defined, the name of the stored type.
|
||||
const std::type_info *yytypeid_;])[
|
||||
};
|
||||
]])
|
||||
|
||||
|
||||
# How the semantic value is extracted when using variants.
|
||||
|
||||
# b4_symbol_value(VAL, SYMBOL-NUM, [TYPE])
|
||||
# ----------------------------------------
|
||||
# See README.
|
||||
m4_define([b4_symbol_value],
|
||||
[m4_ifval([$3],
|
||||
[$1.as< $3 > ()],
|
||||
[m4_ifval([$2],
|
||||
[b4_symbol_if([$2], [has_type],
|
||||
[$1.as < b4_symbol([$2], [type]) > ()],
|
||||
[$1])],
|
||||
[$1])])])
|
||||
|
||||
# b4_symbol_value_template(VAL, SYMBOL-NUM, [TYPE])
|
||||
# -------------------------------------------------
|
||||
# Same as b4_symbol_value, but used in a template method.
|
||||
m4_define([b4_symbol_value_template],
|
||||
[m4_ifval([$3],
|
||||
[$1.template as< $3 > ()],
|
||||
[m4_ifval([$2],
|
||||
[b4_symbol_if([$2], [has_type],
|
||||
[$1.template as < b4_symbol([$2], [type]) > ()],
|
||||
[$1])],
|
||||
[$1])])])
|
||||
|
||||
|
||||
|
||||
## ------------- ##
|
||||
## make_SYMBOL. ##
|
||||
## ------------- ##
|
||||
|
||||
|
||||
# _b4_includes_tokens(SYMBOL-NUM...)
|
||||
# ----------------------------------
|
||||
# Expands to non-empty iff one of the SYMBOL-NUM denotes
|
||||
# a token.
|
||||
m4_define([_b4_is_token],
|
||||
[b4_symbol_if([$1], [is_token], [1])])
|
||||
m4_define([_b4_includes_tokens],
|
||||
[m4_map([_b4_is_token], [$@])])
|
||||
|
||||
|
||||
# _b4_token_maker_define(SYMBOL-NUM)
|
||||
# ----------------------------------
|
||||
# Declare make_SYMBOL for SYMBOL-NUM. Use at class-level.
|
||||
m4_define([_b4_token_maker_define],
|
||||
[b4_token_visible_if([$1],
|
||||
[#if 201103L <= YY_CPLUSPLUS
|
||||
static
|
||||
symbol_type
|
||||
make_[]_b4_symbol([$1], [id]) (b4_join(
|
||||
b4_symbol_if([$1], [has_type],
|
||||
[b4_symbol([$1], [type]) v]),
|
||||
b4_locations_if([location_type l])))
|
||||
{
|
||||
return symbol_type (b4_join([token::b4_symbol([$1], [id])],
|
||||
b4_symbol_if([$1], [has_type], [std::move (v)]),
|
||||
b4_locations_if([std::move (l)])));
|
||||
}
|
||||
#else
|
||||
static
|
||||
symbol_type
|
||||
make_[]_b4_symbol([$1], [id]) (b4_join(
|
||||
b4_symbol_if([$1], [has_type],
|
||||
[const b4_symbol([$1], [type])& v]),
|
||||
b4_locations_if([const location_type& l])))
|
||||
{
|
||||
return symbol_type (b4_join([token::b4_symbol([$1], [id])],
|
||||
b4_symbol_if([$1], [has_type], [v]),
|
||||
b4_locations_if([l])));
|
||||
}
|
||||
#endif
|
||||
])])
|
||||
|
||||
|
||||
m4_define([_b4_type_clause],
|
||||
[b4_symbol_if([$1], [is_token],
|
||||
[b4_symbol_if([$1], [has_id],
|
||||
[tok == token::b4_symbol([$1], [id])],
|
||||
[tok == b4_symbol([$1], [user_number])])])])
|
||||
|
||||
|
||||
# _b4_token_constructor_define(SYMBOL-NUM...)
|
||||
# -------------------------------------------
|
||||
# Define a unique make_symbol for all the SYMBOL-NUM (they
|
||||
# have the same type). Use at class-level.
|
||||
m4_define([_b4_token_constructor_define],
|
||||
[m4_ifval(_b4_includes_tokens($@),
|
||||
[[#if 201103L <= YY_CPLUSPLUS
|
||||
symbol_type (]b4_join(
|
||||
[int tok],
|
||||
b4_symbol_if([$1], [has_type],
|
||||
[b4_symbol([$1], [type]) v]),
|
||||
b4_locations_if([location_type l]))[)
|
||||
: super_type(]b4_join([token_type (tok)],
|
||||
b4_symbol_if([$1], [has_type], [std::move (v)]),
|
||||
b4_locations_if([std::move (l)]))[)
|
||||
{
|
||||
YYASSERT (]m4_join([ || ], m4_map_sep([_b4_type_clause], [, ], [$@]))[);
|
||||
}
|
||||
#else
|
||||
symbol_type (]b4_join(
|
||||
[int tok],
|
||||
b4_symbol_if([$1], [has_type],
|
||||
[const b4_symbol([$1], [type])& v]),
|
||||
b4_locations_if([const location_type& l]))[)
|
||||
: super_type(]b4_join([token_type (tok)],
|
||||
b4_symbol_if([$1], [has_type], [v]),
|
||||
b4_locations_if([l]))[)
|
||||
{
|
||||
YYASSERT (]m4_join([ || ], m4_map_sep([_b4_type_clause], [, ], [$@]))[);
|
||||
}
|
||||
#endif
|
||||
]])])
|
||||
|
||||
|
||||
# b4_basic_symbol_constructor_define(SYMBOL-NUM)
|
||||
# ----------------------------------------------
|
||||
# Generate a constructor for basic_symbol from given type.
|
||||
m4_define([b4_basic_symbol_constructor_define],
|
||||
[[#if 201103L <= YY_CPLUSPLUS
|
||||
basic_symbol (]b4_join(
|
||||
[typename Base::kind_type t],
|
||||
b4_symbol_if([$1], [has_type], [b4_symbol([$1], [type])&& v]),
|
||||
b4_locations_if([location_type&& l]))[)
|
||||
: Base (t)]b4_symbol_if([$1], [has_type], [
|
||||
, value (std::move (v))])[]b4_locations_if([
|
||||
, location (std::move (l))])[
|
||||
{}
|
||||
#else
|
||||
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)])[
|
||||
{}
|
||||
#endif
|
||||
]])
|
||||
|
||||
|
||||
# b4_token_constructor_define
|
||||
# ---------------------------
|
||||
# Define the overloaded versions of make_symbol for all the value types.
|
||||
m4_define([b4_token_constructor_define],
|
||||
[ // Implementation of make_symbol for each symbol type.
|
||||
b4_symbol_foreach([_b4_token_maker_define])])
|
||||
+207
-183
@@ -1,11 +1,11 @@
|
||||
-*- C -*-
|
||||
# Yacc compatible skeleton for Bison
|
||||
|
||||
# Copyright (C) 1984, 1989-1990, 2000-2013 Free Software Foundation,
|
||||
# Inc.
|
||||
# Copyright (C) 1984, 1989-1990, 2000-2015, 2018-2019 Free Software
|
||||
# Foundation, Inc.
|
||||
|
||||
m4_pushdef([b4_copyright_years],
|
||||
[1984, 1989-1990, 2000-2013])
|
||||
[1984, 1989-1990, 2000-2015, 2018-2019])
|
||||
|
||||
# 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
|
||||
@@ -51,7 +51,7 @@ m4_define([b4_lac_flag],
|
||||
[m4_if(b4_percent_define_get([[parse.lac]]),
|
||||
[none], [[0]], [[1]])])
|
||||
|
||||
m4_include(b4_pkgdatadir/[c.m4])
|
||||
m4_include(b4_skeletonsdir/[c.m4])
|
||||
|
||||
## ---------------- ##
|
||||
## Default values. ##
|
||||
@@ -118,7 +118,7 @@ m4_define([b4_int_type],
|
||||
b4_ints_in($@, [0], [65535]), [1], [yytype_uint16],
|
||||
b4_ints_in($@, [-32768], [32767]), [1], [yytype_int16],
|
||||
|
||||
m4_eval([0 <= $1]), [1], [unsigned int],
|
||||
m4_eval([0 <= $1]), [1], [unsigned],
|
||||
|
||||
[int])])
|
||||
|
||||
@@ -128,19 +128,18 @@ m4_define([b4_int_type],
|
||||
## ----------------- ##
|
||||
|
||||
|
||||
# b4_lhs_value([TYPE])
|
||||
# --------------------
|
||||
# Expansion of $<TYPE>$.
|
||||
# b4_lhs_value(SYMBOL-NUM, [TYPE])
|
||||
# --------------------------------
|
||||
# See README.
|
||||
m4_define([b4_lhs_value],
|
||||
[b4_symbol_value(yyval, [$1])])
|
||||
[b4_symbol_value(yyval, [$1], [$2])])
|
||||
|
||||
|
||||
# b4_rhs_value(RULE-LENGTH, NUM, [TYPE])
|
||||
# --------------------------------------
|
||||
# Expansion of $<TYPE>NUM, where the current rule has RULE-LENGTH
|
||||
# symbols on RHS.
|
||||
# b4_rhs_value(RULE-LENGTH, POS, [SYMBOL-NUM], [TYPE])
|
||||
# ----------------------------------------------------
|
||||
# See README.
|
||||
m4_define([b4_rhs_value],
|
||||
[b4_symbol_value([yyvsp@{b4_subtract([$2], [$1])@}], [$3])])
|
||||
[b4_symbol_value([yyvsp@{b4_subtract([$2], [$1])@}], [$3], [$4])])
|
||||
|
||||
|
||||
## ----------- ##
|
||||
@@ -154,12 +153,12 @@ m4_define([b4_lhs_location],
|
||||
[(yyloc)])
|
||||
|
||||
|
||||
# b4_rhs_location(RULE-LENGTH, NUM)
|
||||
# b4_rhs_location(RULE-LENGTH, POS)
|
||||
# ---------------------------------
|
||||
# Expansion of @NUM, where the current rule has RULE-LENGTH symbols
|
||||
# Expansion of @POS, where the current rule has RULE-LENGTH symbols
|
||||
# on RHS.
|
||||
m4_define([b4_rhs_location],
|
||||
[(yylsp@{b4_subtract([$2], [$1])@})])
|
||||
[(yylsp@{b4_subtract([$2], [$1])@})])
|
||||
|
||||
|
||||
## -------------- ##
|
||||
@@ -175,36 +174,19 @@ m4_define([b4_declare_scanner_communication_variables], [[
|
||||
int yychar;
|
||||
|
||||
]b4_pure_if([[
|
||||
#if defined __GNUC__ && 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
|
||||
/* The semantic value of the lookahead symbol. */
|
||||
/* Default value used for initialization, for pacifying older GCCs
|
||||
or non-GCC compilers. */
|
||||
static YYSTYPE yyval_default;
|
||||
# define YY_INITIAL_VALUE(Value) = Value
|
||||
#endif]b4_locations_if([[
|
||||
static YYLTYPE yyloc_default][]b4_yyloc_default[;]])])[
|
||||
#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
|
||||
|
||||
/* The semantic value of the lookahead symbol. */
|
||||
YYSTYPE yylval YY_INITIAL_VALUE (yyval_default);]b4_locations_if([[
|
||||
YY_INITIAL_VALUE (static YYSTYPE yyval_default;)
|
||||
YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default);]b4_locations_if([[
|
||||
|
||||
/* Location data for the lookahead symbol. */
|
||||
YYLTYPE yylloc]b4_pure_if([ = yyloc_default], [b4_yyloc_default])[;
|
||||
]])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. */
|
||||
int yynerrs;]])])
|
||||
|
||||
@@ -254,11 +236,11 @@ m4_define([b4_declare_parser_state_variables], [b4_pure_if([[
|
||||
YYSIZE_T yyes_capacity;]])])
|
||||
|
||||
|
||||
# b4_declare_yyparse_push_
|
||||
# _b4_declare_yyparse_push
|
||||
# ------------------------
|
||||
# Declaration of yyparse (and dependencies) when using the push parser
|
||||
# (including in pull mode).
|
||||
m4_define([b4_declare_yyparse_push_],
|
||||
m4_define([_b4_declare_yyparse_push],
|
||||
[[#ifndef YYPUSH_MORE_DEFINED
|
||||
# define YYPUSH_MORE_DEFINED
|
||||
enum { YYPUSH_MORE = 4 };
|
||||
@@ -282,18 +264,18 @@ b4_function_declare([b4_prefix[pstate_delete]], [[void]],
|
||||
[[b4_prefix[pstate *ps]], [[ps]]])dnl
|
||||
])
|
||||
|
||||
# b4_declare_yyparse_
|
||||
# _b4_declare_yyparse
|
||||
# -------------------
|
||||
# When not the push parser.
|
||||
m4_define([b4_declare_yyparse_],
|
||||
m4_define([_b4_declare_yyparse],
|
||||
[b4_function_declare(b4_prefix[parse], [int], b4_parse_param)])
|
||||
|
||||
|
||||
# b4_declare_yyparse
|
||||
# ------------------
|
||||
m4_define([b4_declare_yyparse],
|
||||
[b4_push_if([b4_declare_yyparse_push_],
|
||||
[b4_declare_yyparse_])[]dnl
|
||||
[b4_push_if([_b4_declare_yyparse_push],
|
||||
[_b4_declare_yyparse])[]dnl
|
||||
])
|
||||
|
||||
|
||||
@@ -302,23 +284,50 @@ m4_define([b4_declare_yyparse],
|
||||
# Declaration that might either go into the header (if --defines)
|
||||
# or open coded in the parser body.
|
||||
m4_define([b4_shared_declarations],
|
||||
[b4_cpp_guard_open([b4_spec_defines_file])[
|
||||
[b4_cpp_guard_open([b4_spec_header_file])[
|
||||
]b4_declare_yydebug[
|
||||
]b4_percent_code_get([[requires]])[
|
||||
]b4_token_enums_defines[
|
||||
]b4_declare_yylstype[
|
||||
]b4_declare_yyparse[
|
||||
]b4_percent_code_get([[provides]])[
|
||||
]b4_cpp_guard_close([b4_spec_defines_file])[]dnl
|
||||
]b4_cpp_guard_close([b4_spec_header_file])[]dnl
|
||||
])
|
||||
|
||||
|
||||
# b4_header_include_if(IF-TRUE, IF-FALSE)
|
||||
# ---------------------------------------
|
||||
# Run IF-TRUE if we generate an output file and api.header.include
|
||||
# is defined.
|
||||
m4_define([b4_header_include_if],
|
||||
[m4_ifval(m4_quote(b4_spec_header_file),
|
||||
[b4_percent_define_ifdef([[api.header.include]],
|
||||
[$1],
|
||||
[$2])],
|
||||
[$2])])
|
||||
|
||||
m4_if(b4_spec_header_file, [[y.tab.h]],
|
||||
[b4_percent_define_default([[api.header.include]],
|
||||
[["@basename(]b4_spec_header_file[@)"]])])
|
||||
|
||||
|
||||
|
||||
|
||||
## -------------- ##
|
||||
## Output files. ##
|
||||
## -------------- ##
|
||||
|
||||
b4_output_begin([b4_parser_file_name])
|
||||
b4_copyright([Bison implementation for Yacc-like parsers in C])[
|
||||
|
||||
b4_defines_if([[
|
||||
]b4_output_begin([b4_spec_header_file])[
|
||||
]b4_copyright([Bison interface for Yacc-like parsers in C])[
|
||||
]b4_disclaimer[
|
||||
]b4_shared_declarations[
|
||||
]b4_output_end[
|
||||
]])# b4_defines_if
|
||||
|
||||
b4_output_begin([b4_parser_file_name])[
|
||||
]b4_copyright([Bison implementation for Yacc-like parsers in C])[
|
||||
/* C LALR(1) parser skeleton written by Richard Stallman, by
|
||||
simplifying the original so-called "semantic" parser. */
|
||||
|
||||
@@ -329,8 +338,9 @@ b4_copyright([Bison implementation for Yacc-like parsers in C])[
|
||||
define necessary library symbols; they are noted "INFRINGES ON
|
||||
USER NAME SPACE" below. */
|
||||
|
||||
]b4_identification
|
||||
b4_percent_code_get([[top]])[]dnl
|
||||
]b4_disclaimer[
|
||||
]b4_identification[
|
||||
]b4_percent_code_get([[top]])[]dnl
|
||||
m4_if(b4_api_prefix, [yy], [],
|
||||
[[/* Substitute the type names. */
|
||||
#define YYSTYPE ]b4_api_PREFIX[STYPE]b4_locations_if([[
|
||||
@@ -352,9 +362,7 @@ m4_if(b4_api_prefix, [yy], [],
|
||||
#define yychar ]b4_prefix[char]b4_locations_if([[
|
||||
#define yylloc ]b4_prefix[lloc]])]))[
|
||||
|
||||
/* Copy the first part of user declarations. */
|
||||
]b4_user_pre_prologue[
|
||||
|
||||
]b4_null_define[
|
||||
|
||||
/* Enabling verbose error messages. */
|
||||
@@ -365,15 +373,14 @@ m4_if(b4_api_prefix, [yy], [],
|
||||
# define YYERROR_VERBOSE ]b4_error_verbose_if([1], [0])[
|
||||
#endif
|
||||
|
||||
]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[@)". */
|
||||
]])dnl
|
||||
b4_shared_declarations[
|
||||
]b4_header_include_if([[#include ]b4_percent_define_get([[api.header.include]])],
|
||||
[m4_ifval(m4_quote(b4_spec_header_file),
|
||||
[/* Use api.header.include to #include this header
|
||||
instead of duplicating it here. */
|
||||
])b4_shared_declarations])[
|
||||
|
||||
/* Copy the second part of user declarations. */
|
||||
]b4_user_post_prologue
|
||||
b4_percent_code_get[]dnl
|
||||
]b4_user_post_prologue[
|
||||
]b4_percent_code_get[]dnl
|
||||
|
||||
[#ifdef short
|
||||
# undef short
|
||||
@@ -394,13 +401,13 @@ typedef signed char yytype_int8;
|
||||
#ifdef YYTYPE_UINT16
|
||||
typedef YYTYPE_UINT16 yytype_uint16;
|
||||
#else
|
||||
typedef unsigned short int yytype_uint16;
|
||||
typedef unsigned short yytype_uint16;
|
||||
#endif
|
||||
|
||||
#ifdef YYTYPE_INT16
|
||||
typedef YYTYPE_INT16 yytype_int16;
|
||||
#else
|
||||
typedef short int yytype_int16;
|
||||
typedef short yytype_int16;
|
||||
#endif
|
||||
|
||||
#ifndef YYSIZE_T
|
||||
@@ -412,7 +419,7 @@ typedef short int yytype_int16;
|
||||
# include <stddef.h> /* INFRINGES ON USER NAME SPACE */
|
||||
# define YYSIZE_T size_t
|
||||
# else
|
||||
# define YYSIZE_T unsigned int
|
||||
# define YYSIZE_T unsigned
|
||||
# endif
|
||||
#endif
|
||||
|
||||
@@ -432,6 +439,15 @@ typedef short int yytype_int16;
|
||||
|
||||
]b4_attribute_define[
|
||||
|
||||
]b4_parse_assert_if([[#ifdef NDEBUG
|
||||
# define YY_ASSERT(E) ((void) (0 && (E)))
|
||||
#else
|
||||
# include <assert.h> /* INFRINGES ON USER NAME SPACE */
|
||||
# define YY_ASSERT(E) assert (E)
|
||||
#endif
|
||||
]],
|
||||
[[#define YY_ASSERT(E) ((void) (0 && (E)))]])[
|
||||
|
||||
#if ]b4_lac_if([[1]], [[! defined yyoverflow || YYERROR_VERBOSE]])[
|
||||
|
||||
/* The parser invokes alloca or malloc; define the necessary symbols. */]dnl
|
||||
@@ -582,16 +598,16 @@ union yyalloc
|
||||
/* YYNSTATES -- Number of states. */
|
||||
#define YYNSTATES ]b4_states_number[
|
||||
|
||||
/* YYTRANSLATE[YYX] -- Symbol number corresponding to YYX as returned
|
||||
by yylex, with out-of-bounds checking. */
|
||||
#define YYUNDEFTOK ]b4_undef_token_number[
|
||||
#define YYMAXUTOK ]b4_user_token_number_max[
|
||||
|
||||
/* YYTRANSLATE(TOKEN-NUM) -- Symbol number corresponding to TOKEN-NUM
|
||||
as returned by yylex, with out-of-bounds checking. */
|
||||
#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
|
||||
as returned by yylex, without out-of-bounds checking. */
|
||||
as returned by yylex. */
|
||||
static const ]b4_int_type_for([b4_translate])[ yytranslate[] =
|
||||
{
|
||||
]b4_translate[
|
||||
@@ -644,23 +660,23 @@ static const ]b4_int_type_for([b4_toknum])[ yytoknum[] =
|
||||
|
||||
#define YYRECOVERING() (!!yyerrstatus)
|
||||
|
||||
#define YYBACKUP(Token, Value) \
|
||||
do \
|
||||
if (yychar == YYEMPTY) \
|
||||
{ \
|
||||
yychar = (Token); \
|
||||
yylval = (Value); \
|
||||
YYPOPSTACK (yylen); \
|
||||
yystate = *yyssp; \]b4_lac_if([[
|
||||
YY_LAC_DISCARD ("YYBACKUP"); \]])[
|
||||
goto yybackup; \
|
||||
} \
|
||||
else \
|
||||
{ \
|
||||
yyerror (]b4_yyerror_args[YY_("syntax error: cannot back up")); \
|
||||
YYERROR; \
|
||||
} \
|
||||
while (0)
|
||||
#define YYBACKUP(Token, Value) \
|
||||
do \
|
||||
if (yychar == YYEMPTY) \
|
||||
{ \
|
||||
yychar = (Token); \
|
||||
yylval = (Value); \
|
||||
YYPOPSTACK (yylen); \
|
||||
yystate = *yyssp; \]b4_lac_if([[
|
||||
YY_LAC_DISCARD ("YYBACKUP"); \]])[
|
||||
goto yybackup; \
|
||||
} \
|
||||
else \
|
||||
{ \
|
||||
yyerror (]b4_yyerror_args[YY_("syntax error: cannot back up")); \
|
||||
YYERROR; \
|
||||
} \
|
||||
while (0)
|
||||
|
||||
/* Error token number */
|
||||
#define YYTERROR 1
|
||||
@@ -736,7 +752,7 @@ do { \
|
||||
])[[int yyrule], [yyrule]]m4_ifset([b4_parse_param], [,
|
||||
b4_parse_param]))[
|
||||
{
|
||||
unsigned long int yylno = yyrline[yyrule];
|
||||
unsigned long yylno = yyrline[yyrule];
|
||||
int yynrhs = yyr2[yyrule];
|
||||
int yyi;
|
||||
YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n",
|
||||
@@ -808,7 +824,7 @@ yy_lac_stack_realloc (YYSIZE_T *yycapacity, YYSIZE_T yyadd,
|
||||
yytype_int16 **yytop, yytype_int16 *yytop_empty)
|
||||
{
|
||||
YYSIZE_T yysize_old =
|
||||
*yytop == yytop_empty ? 0 : *yytop - *yybottom + 1;
|
||||
(YYSIZE_T) (*yytop == yytop_empty ? 0 : *yytop - *yybottom + 1);
|
||||
YYSIZE_T yysize_new = yysize_old + yyadd;
|
||||
if (*yycapacity < yysize_new)
|
||||
{
|
||||
@@ -844,7 +860,7 @@ yy_lac_stack_realloc (YYSIZE_T *yycapacity, YYSIZE_T yyadd,
|
||||
*yycapacity = yyalloc;]m4_if(b4_percent_define_get([[parse.lac.memory-trace]]),
|
||||
[full], [[
|
||||
YYDPRINTF ((stderr, "%srealloc to %lu%s", yydebug_prefix,
|
||||
(unsigned long int) yyalloc, yydebug_suffix));]])[
|
||||
(unsigned long) yyalloc, yydebug_suffix));]])[
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
@@ -974,7 +990,7 @@ yy_lac (yytype_int16 *yyesa, yytype_int16 **yyes,
|
||||
YYDPRINTF ((stderr, " R%d", yyrule - 1));
|
||||
if (yyesp != yyes_prev)
|
||||
{
|
||||
YYSIZE_T yysize = yyesp - *yyes + 1;
|
||||
YYSIZE_T yysize = (YYSIZE_T) (yyesp - *yyes + 1);
|
||||
if (yylen < yysize)
|
||||
{
|
||||
yyesp -= yylen;
|
||||
@@ -990,15 +1006,14 @@ yy_lac (yytype_int16 *yyesa, yytype_int16 **yyes,
|
||||
yyesp = yyes_prev -= yylen;
|
||||
}
|
||||
{
|
||||
int yystate;
|
||||
yytype_int16 yystate;
|
||||
{
|
||||
int yylhs = yyr1[yyrule] - YYNTOKENS;
|
||||
yystate = yypgoto[yylhs] + *yyesp;
|
||||
if (yystate < 0 || YYLAST < yystate
|
||||
|| yycheck[yystate] != *yyesp)
|
||||
yystate = yydefgoto[yylhs];
|
||||
else
|
||||
yystate = yytable[yystate];
|
||||
const int yylhs = yyr1[yyrule] - YYNTOKENS;
|
||||
const int yyi = yypgoto[yylhs] + *yyesp;
|
||||
yystate = ((yytype_int16)
|
||||
(0 <= yyi && yyi <= YYLAST && yycheck[yyi] == *yyesp
|
||||
? yytable[yyi]
|
||||
: yydefgoto[yylhs]));
|
||||
}
|
||||
if (yyesp == yyes_prev)
|
||||
{
|
||||
@@ -1018,7 +1033,7 @@ yy_lac (yytype_int16 *yyesa, yytype_int16 **yyes,
|
||||
}
|
||||
*++yyesp = yystate;
|
||||
}
|
||||
YYDPRINTF ((stderr, " G%d", yystate));
|
||||
YYDPRINTF ((stderr, " G%d", (int) yystate));
|
||||
}
|
||||
}
|
||||
}]])[
|
||||
@@ -1088,7 +1103,10 @@ yytnamerr (char *yyres, const char *yystr)
|
||||
case '\\':
|
||||
if (*++yyp != '\\')
|
||||
goto do_not_strip_quotes;
|
||||
/* Fall through. */
|
||||
else
|
||||
goto append;
|
||||
|
||||
append:
|
||||
default:
|
||||
if (yyres)
|
||||
yyres[yyn] = *yyp;
|
||||
@@ -1106,7 +1124,7 @@ yytnamerr (char *yyres, const char *yystr)
|
||||
if (! yyres)
|
||||
return yystrlen (yystr);
|
||||
|
||||
return yystpcpy (yyres, yystr) - yyres;
|
||||
return (YYSIZE_T) (yystpcpy (yyres, yystr) - yyres);
|
||||
}
|
||||
# endif
|
||||
|
||||
@@ -1125,11 +1143,11 @@ yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg,
|
||||
]b4_lac_if([[yytype_int16 *yyesa, yytype_int16 **yyes,
|
||||
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;
|
||||
enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
|
||||
/* Internationalized format string. */
|
||||
const char *yyformat = YY_NULL;
|
||||
const char *yyformat = YY_NULLPTR;
|
||||
/* Arguments of yyformat. */
|
||||
char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
|
||||
/* Number of reported tokens (one for the "unexpected", one per
|
||||
@@ -1204,11 +1222,11 @@ yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg,
|
||||
}
|
||||
yyarg[yycount++] = yytname[yyx];
|
||||
{
|
||||
YYSIZE_T yysize1 = yysize + yytnamerr (YY_NULL, yytname[yyx]);
|
||||
if (! (yysize <= yysize1
|
||||
&& yysize1 <= YYSTACK_ALLOC_MAXIMUM))
|
||||
YYSIZE_T yysize1 = yysize + yytnamerr (YY_NULLPTR, yytname[yyx]);
|
||||
if (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM)
|
||||
yysize = yysize1;
|
||||
else
|
||||
return 2;
|
||||
yysize = yysize1;
|
||||
}
|
||||
}
|
||||
}]b4_lac_if([[
|
||||
@@ -1224,6 +1242,7 @@ yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg,
|
||||
case N: \
|
||||
yyformat = S; \
|
||||
break
|
||||
default: /* Avoid compiler warnings. */
|
||||
YYCASE_(0, YY_("syntax error"));
|
||||
YYCASE_(1, YY_("syntax error, unexpected %s"));
|
||||
YYCASE_(2, YY_("syntax error, unexpected %s, expecting %s"));
|
||||
@@ -1235,9 +1254,10 @@ yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg,
|
||||
|
||||
{
|
||||
YYSIZE_T yysize1 = yysize + yystrlen (yyformat);
|
||||
if (! (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM))
|
||||
if (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM)
|
||||
yysize = yysize1;
|
||||
else
|
||||
return 2;
|
||||
yysize = yysize1;
|
||||
}
|
||||
|
||||
if (*yymsg_alloc < yysize)
|
||||
@@ -1288,20 +1308,17 @@ static char yypstate_allocated = 0;]])b4_pull_if([
|
||||
|
||||
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_args(b4_parse_param)])[);
|
||||
}
|
||||
|
||||
]b4_function_define([[yypull_parse]], [[int]],
|
||||
[[[yypstate *yyps]], [[yyps]]]m4_ifset([b4_parse_param], [,
|
||||
b4_parse_param]))[
|
||||
{
|
||||
int yystatus;
|
||||
yypstate *yyps_local;]b4_pure_if([[
|
||||
int yychar;
|
||||
YYSTYPE yylval;]b4_locations_if([[
|
||||
{]b4_pure_if([b4_locations_if([[
|
||||
static YYLTYPE yyloc_default][]b4_yyloc_default[;
|
||||
YYLTYPE yylloc = yyloc_default;]])])[
|
||||
yypstate *yyps_local;
|
||||
if (yyps)
|
||||
yyps_local = yyps;
|
||||
else
|
||||
@@ -1315,8 +1332,10 @@ b4_function_define([[yyparse]], [[int]], b4_parse_param)[
|
||||
return 2;
|
||||
}
|
||||
}
|
||||
do {
|
||||
yychar = ]b4_lex[;
|
||||
int yystatus;
|
||||
do {]b4_pure_if([[
|
||||
YYSTYPE yylval;
|
||||
int ]])[yychar = ]b4_lex[;
|
||||
yystatus =
|
||||
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);
|
||||
@@ -1330,10 +1349,10 @@ b4_function_define([[yyparse]], [[int]], b4_parse_param)[
|
||||
{
|
||||
yypstate *yyps;]b4_pure_if([], [[
|
||||
if (yypstate_allocated)
|
||||
return YY_NULL;]])[
|
||||
return YY_NULLPTR;]])[
|
||||
yyps = (yypstate *) malloc (sizeof *yyps);
|
||||
if (!yyps)
|
||||
return YY_NULL;
|
||||
return YY_NULLPTR;
|
||||
yyps->yynew = 1;]b4_pure_if([], [[
|
||||
yypstate_allocated = 1;]])[
|
||||
return yyps;
|
||||
@@ -1342,16 +1361,19 @@ b4_function_define([[yyparse]], [[int]], b4_parse_param)[
|
||||
]b4_function_define([[yypstate_delete]], [[void]],
|
||||
[[[yypstate *yyps]], [[yyps]]])[
|
||||
{
|
||||
if (yyps)
|
||||
{
|
||||
#ifndef yyoverflow
|
||||
/* If the stack was reallocated but the parse did not complete, then the
|
||||
stack still needs to be freed. */
|
||||
if (!yyps->yynew && yyps->yyss != yyps->yyssa)
|
||||
YYSTACK_FREE (yyps->yyss);
|
||||
/* If the stack was reallocated but the parse did not complete, then the
|
||||
stack still needs to be freed. */
|
||||
if (!yyps->yynew && yyps->yyss != yyps->yyssa)
|
||||
YYSTACK_FREE (yyps->yyss);
|
||||
#endif]b4_lac_if([[
|
||||
if (!yyps->yynew && yyps->yyes != yyps->yyesa)
|
||||
YYSTACK_FREE (yyps->yyes);]])[
|
||||
free (yyps);]b4_pure_if([], [[
|
||||
yypstate_allocated = 0;]])[
|
||||
if (!yyps->yynew && yyps->yyes != yyps->yyesa)
|
||||
YYSTACK_FREE (yyps->yyes);]])[
|
||||
free (yyps);]b4_pure_if([], [[
|
||||
yypstate_allocated = 0;]])[
|
||||
}
|
||||
}
|
||||
]b4_pure_if([[
|
||||
#define ]b4_prefix[nerrs yyps->]b4_prefix[nerrs]])[
|
||||
@@ -1444,9 +1466,8 @@ b4_function_define([[yyparse]], [[int]], b4_parse_param)[
|
||||
yynerrs = 0;
|
||||
yychar = YYEMPTY; /* Cause a token to be read. */
|
||||
]m4_ifdef([b4_initial_action], [
|
||||
b4_dollar_pushdef([m4_define([b4_dollar_dollar_used])yylval], [],
|
||||
b4_dollar_pushdef([m4_define([b4_dollar_dollar_used])yylval], [], [],
|
||||
[b4_push_if([b4_pure_if([*])yypushed_loc], [yylloc])])dnl
|
||||
/* User initialization code. */
|
||||
b4_user_initial_action
|
||||
b4_dollar_popdef[]dnl
|
||||
m4_ifdef([b4_dollar_dollar_used],[[ yyvsp[0] = yylval;
|
||||
@@ -1455,23 +1476,33 @@ b4_locations_if([[ yylsp[0] = ]b4_push_if([b4_pure_if([*])yypushed_loc], [yyllo
|
||||
]])dnl
|
||||
[ goto yysetstate;
|
||||
|
||||
|
||||
/*------------------------------------------------------------.
|
||||
| yynewstate -- Push a new state, which is found in yystate. |
|
||||
| yynewstate -- push a new state, which is found in yystate. |
|
||||
`------------------------------------------------------------*/
|
||||
yynewstate:
|
||||
yynewstate:
|
||||
/* In all cases, when you get here, the value and location stacks
|
||||
have just been pushed. So pushing a state here evens the stacks. */
|
||||
yyssp++;
|
||||
|
||||
yysetstate:
|
||||
*yyssp = yystate;
|
||||
|
||||
/*--------------------------------------------------------------------.
|
||||
| yynewstate -- set current state (the top of the stack) to yystate. |
|
||||
`--------------------------------------------------------------------*/
|
||||
yysetstate:
|
||||
YYDPRINTF ((stderr, "Entering state %d\n", yystate));
|
||||
YY_ASSERT (0 <= yystate && yystate < YYNSTATES);
|
||||
*yyssp = (yytype_int16) yystate;
|
||||
|
||||
if (yyss + yystacksize - 1 <= yyssp)
|
||||
#if !defined yyoverflow && !defined YYSTACK_RELOCATE
|
||||
goto yyexhaustedlab;
|
||||
#else
|
||||
{
|
||||
/* Get the current used size of the three stacks, in elements. */
|
||||
YYSIZE_T yysize = yyssp - yyss + 1;
|
||||
YYSIZE_T yysize = (YYSIZE_T) (yyssp - yyss + 1);
|
||||
|
||||
#ifdef yyoverflow
|
||||
# if defined yyoverflow
|
||||
{
|
||||
/* Give user a chance to reallocate the stack. Use copies of
|
||||
these so that the &'s don't force the real ones into
|
||||
@@ -1489,15 +1520,11 @@ b4_locations_if([[ yylsp[0] = ]b4_push_if([b4_pure_if([*])yypushed_loc], [yyllo
|
||||
&yyvs1, yysize * sizeof (*yyvsp),]b4_locations_if([
|
||||
&yyls1, yysize * sizeof (*yylsp),])[
|
||||
&yystacksize);
|
||||
]b4_locations_if([
|
||||
yyls = yyls1;])[
|
||||
yyss = yyss1;
|
||||
yyvs = yyvs1;
|
||||
yyvs = yyvs1;]b4_locations_if([
|
||||
yyls = yyls1;])[
|
||||
}
|
||||
#else /* no yyoverflow */
|
||||
# ifndef YYSTACK_RELOCATE
|
||||
goto yyexhaustedlab;
|
||||
# else
|
||||
# else /* defined YYSTACK_RELOCATE */
|
||||
/* Extend the stack our own way. */
|
||||
if (YYMAXDEPTH <= yystacksize)
|
||||
goto yyexhaustedlab;
|
||||
@@ -1514,36 +1541,34 @@ b4_locations_if([[ yylsp[0] = ]b4_push_if([b4_pure_if([*])yypushed_loc], [yyllo
|
||||
YYSTACK_RELOCATE (yyss_alloc, yyss);
|
||||
YYSTACK_RELOCATE (yyvs_alloc, yyvs);]b4_locations_if([
|
||||
YYSTACK_RELOCATE (yyls_alloc, yyls);])[
|
||||
# undef YYSTACK_RELOCATE
|
||||
# undef YYSTACK_RELOCATE
|
||||
if (yyss1 != yyssa)
|
||||
YYSTACK_FREE (yyss1);
|
||||
}
|
||||
# endif
|
||||
#endif /* no yyoverflow */
|
||||
|
||||
yyssp = yyss + yysize - 1;
|
||||
yyvsp = yyvs + yysize - 1;]b4_locations_if([
|
||||
yylsp = yyls + yysize - 1;])[
|
||||
|
||||
YYDPRINTF ((stderr, "Stack size increased to %lu\n",
|
||||
(unsigned long int) yystacksize));
|
||||
(unsigned long) yystacksize));
|
||||
|
||||
if (yyss + yystacksize - 1 <= yyssp)
|
||||
YYABORT;
|
||||
}
|
||||
|
||||
YYDPRINTF ((stderr, "Entering state %d\n", yystate));
|
||||
#endif /* !defined yyoverflow && !defined YYSTACK_RELOCATE */
|
||||
|
||||
if (yystate == YYFINAL)
|
||||
YYACCEPT;
|
||||
|
||||
goto yybackup;
|
||||
|
||||
|
||||
/*-----------.
|
||||
| yybackup. |
|
||||
`-----------*/
|
||||
yybackup:
|
||||
|
||||
/* Do appropriate processing given the current state. Read a
|
||||
lookahead token if we need one and don't already have one. */
|
||||
|
||||
@@ -1625,8 +1650,8 @@ yyread_pushed_token:]])[
|
||||
yystate = yyn;
|
||||
YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
|
||||
*++yyvsp = yylval;
|
||||
YY_IGNORE_MAYBE_UNINITIALIZED_END
|
||||
]b4_locations_if([ *++yylsp = yylloc;])[
|
||||
YY_IGNORE_MAYBE_UNINITIALIZED_END]b4_locations_if([
|
||||
*++yylsp = yylloc;])[
|
||||
goto yynewstate;
|
||||
|
||||
|
||||
@@ -1641,7 +1666,7 @@ yydefault:
|
||||
|
||||
|
||||
/*-----------------------------.
|
||||
| yyreduce -- Do a reduction. |
|
||||
| yyreduce -- do a reduction. |
|
||||
`-----------------------------*/
|
||||
yyreduce:
|
||||
/* yyn is the number of a rule to reduce with. */
|
||||
@@ -1658,14 +1683,15 @@ yyreduce:
|
||||
yyval = yyvsp[1-yylen];
|
||||
|
||||
]b4_locations_if(
|
||||
[[ /* Default location. */
|
||||
YYLLOC_DEFAULT (yyloc, (yylsp - yylen), yylen);]])[
|
||||
[[ /* Default location. */
|
||||
YYLLOC_DEFAULT (yyloc, (yylsp - yylen), yylen);
|
||||
yyerror_range[1] = yyloc;]])[
|
||||
YY_REDUCE_PRINT (yyn);]b4_lac_if([[
|
||||
{
|
||||
int yychar_backup = yychar;
|
||||
switch (yyn)
|
||||
{
|
||||
]b4_user_actions[
|
||||
]b4_user_actions[
|
||||
default: break;
|
||||
}
|
||||
if (yychar_backup != yychar)
|
||||
@@ -1673,7 +1699,7 @@ yyreduce:
|
||||
}]], [[
|
||||
switch (yyn)
|
||||
{
|
||||
]b4_user_actions[
|
||||
]b4_user_actions[
|
||||
default: break;
|
||||
}]])[
|
||||
/* User semantic actions sometimes alter yychar, and that requires
|
||||
@@ -1699,14 +1725,13 @@ yyreduce:
|
||||
/* Now 'shift' the result of the reduction. Determine what state
|
||||
that goes to, based on the state we popped back to and the rule
|
||||
number reduced by. */
|
||||
|
||||
yyn = yyr1[yyn];
|
||||
|
||||
yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
|
||||
if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)
|
||||
yystate = yytable[yystate];
|
||||
else
|
||||
yystate = yydefgoto[yyn - YYNTOKENS];
|
||||
{
|
||||
const int yylhs = yyr1[yyn] - YYNTOKENS;
|
||||
const int yyi = yypgoto[yylhs] + *yyssp;
|
||||
yystate = (0 <= yyi && yyi <= YYLAST && yycheck[yyi] == *yyssp
|
||||
? yytable[yyi]
|
||||
: yydefgoto[yylhs]);
|
||||
}
|
||||
|
||||
goto yynewstate;
|
||||
|
||||
@@ -1792,15 +1817,12 @@ yyerrlab:
|
||||
| yyerrorlab -- error raised explicitly by YYERROR. |
|
||||
`---------------------------------------------------*/
|
||||
yyerrorlab:
|
||||
/* Pacify compilers when the user code never invokes YYERROR and the
|
||||
label yyerrorlab therefore never appears in user code. */
|
||||
if (0)
|
||||
YYERROR;
|
||||
|
||||
/* Pacify compilers like GCC when the user code never invokes
|
||||
YYERROR and the label yyerrorlab therefore never appears in user
|
||||
code. */
|
||||
if (/*CONSTCOND*/ 0)
|
||||
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 whose action triggered
|
||||
this YYERROR. */
|
||||
YYPOPSTACK (yylen);
|
||||
yylen = 0;
|
||||
@@ -1869,6 +1891,7 @@ yyacceptlab:
|
||||
yyresult = 0;
|
||||
goto yyreturn;
|
||||
|
||||
|
||||
/*-----------------------------------.
|
||||
| yyabortlab -- YYABORT comes here. |
|
||||
`-----------------------------------*/
|
||||
@@ -1876,6 +1899,7 @@ yyabortlab:
|
||||
yyresult = 1;
|
||||
goto yyreturn;
|
||||
|
||||
|
||||
#if ]b4_lac_if([[1]], [[!defined yyoverflow || YYERROR_VERBOSE]])[
|
||||
/*-------------------------------------------------.
|
||||
| yyexhaustedlab -- memory exhaustion comes here. |
|
||||
@@ -1886,6 +1910,10 @@ yyexhaustedlab:
|
||||
/* Fall through. */
|
||||
#endif
|
||||
|
||||
|
||||
/*-----------------------------------------------------.
|
||||
| yyreturn -- parsing is finished, return the result. |
|
||||
`-----------------------------------------------------*/
|
||||
yyreturn:
|
||||
if (yychar != YYEMPTY)
|
||||
{
|
||||
@@ -1913,6 +1941,10 @@ yyreturn:
|
||||
YYSTACK_FREE (yyes);]])b4_push_if([[
|
||||
yyps->yynew = 1;
|
||||
|
||||
|
||||
/*-----------------------------------------.
|
||||
| yypushreturn -- ask for the next token. |
|
||||
`-----------------------------------------*/
|
||||
yypushreturn:]])[
|
||||
#if YYERROR_VERBOSE
|
||||
if (yymsg != yymsgbuf)
|
||||
@@ -1921,12 +1953,4 @@ yypushreturn:]])[
|
||||
return yyresult;
|
||||
}
|
||||
]b4_epilogue[]dnl
|
||||
b4_output_end()
|
||||
|
||||
b4_defines_if(
|
||||
[b4_output_begin([b4_spec_defines_file])[
|
||||
]b4_copyright([Bison interface for Yacc-like parsers in C])[
|
||||
|
||||
]b4_shared_declarations[
|
||||
]b4_output_end()
|
||||
])# b4_defines_if
|
||||
b4_output_end
|
||||
-154
@@ -1,154 +0,0 @@
|
||||
# C++ skeleton for Bison
|
||||
|
||||
# Copyright (C) 2002-2013 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/>.
|
||||
|
||||
m4_pushdef([b4_copyright_years],
|
||||
[2002-2013])
|
||||
|
||||
# b4_stack_define
|
||||
# ---------------
|
||||
m4_define([b4_stack_define],
|
||||
[[ template <class T, class S = std::vector<T> >
|
||||
class stack
|
||||
{
|
||||
public:
|
||||
// Hide our reversed order.
|
||||
typedef typename S::reverse_iterator iterator;
|
||||
typedef typename S::const_reverse_iterator const_iterator;
|
||||
|
||||
stack ()
|
||||
: seq_ ()
|
||||
{
|
||||
}
|
||||
|
||||
stack (unsigned int n)
|
||||
: seq_ (n)
|
||||
{
|
||||
}
|
||||
|
||||
inline
|
||||
T&
|
||||
operator[] (unsigned int i)
|
||||
{
|
||||
return seq_[seq_.size () - 1 - i];
|
||||
}
|
||||
|
||||
inline
|
||||
const T&
|
||||
operator[] (unsigned int i) const
|
||||
{
|
||||
return seq_[seq_.size () - 1 - i];
|
||||
}
|
||||
|
||||
/// Steal the contents of \a t.
|
||||
///
|
||||
/// Close to move-semantics.
|
||||
inline
|
||||
void
|
||||
push (T& t)
|
||||
{
|
||||
seq_.push_back (T());
|
||||
operator[](0).move (t);
|
||||
}
|
||||
|
||||
inline
|
||||
void
|
||||
pop (unsigned int n = 1)
|
||||
{
|
||||
for (; n; --n)
|
||||
seq_.pop_back ();
|
||||
}
|
||||
|
||||
void
|
||||
clear ()
|
||||
{
|
||||
seq_.clear ();
|
||||
}
|
||||
|
||||
inline
|
||||
typename S::size_type
|
||||
size () const
|
||||
{
|
||||
return seq_.size ();
|
||||
}
|
||||
|
||||
inline
|
||||
const_iterator
|
||||
begin () const
|
||||
{
|
||||
return seq_.rbegin ();
|
||||
}
|
||||
|
||||
inline
|
||||
const_iterator
|
||||
end () const
|
||||
{
|
||||
return seq_.rend ();
|
||||
}
|
||||
|
||||
private:
|
||||
stack (const stack&);
|
||||
stack& operator= (const stack&);
|
||||
/// The wrapped container.
|
||||
S seq_;
|
||||
};
|
||||
|
||||
/// Present a slice of the top of a stack.
|
||||
template <class T, class S = stack<T> >
|
||||
class slice
|
||||
{
|
||||
public:
|
||||
slice (const S& stack, unsigned int range)
|
||||
: stack_ (stack)
|
||||
, range_ (range)
|
||||
{
|
||||
}
|
||||
|
||||
inline
|
||||
const T&
|
||||
operator [] (unsigned int i) const
|
||||
{
|
||||
return stack_[range_ - i];
|
||||
}
|
||||
|
||||
private:
|
||||
const S& stack_;
|
||||
unsigned int 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_cpp_guard_close([b4_dir_prefix[]stack.hh])
|
||||
b4_output_end()
|
||||
])
|
||||
|
||||
m4_popdef([b4_copyright_years])
|
||||
-362
@@ -1,362 +0,0 @@
|
||||
# C++ skeleton for Bison
|
||||
|
||||
# Copyright (C) 2002-2013 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/>.
|
||||
|
||||
|
||||
## --------- ##
|
||||
## variant. ##
|
||||
## --------- ##
|
||||
|
||||
# b4_symbol_variant(YYTYPE, YYVAL, ACTION, [ARGS])
|
||||
# ------------------------------------------------
|
||||
# Run some ACTION ("build", or "destroy") on YYVAL of symbol type
|
||||
# YYTYPE.
|
||||
m4_define([b4_symbol_variant],
|
||||
[m4_pushdef([b4_dollar_dollar],
|
||||
[$2.$3< $][3 > (m4_shift3($@))])dnl
|
||||
switch ($1)
|
||||
{
|
||||
b4_type_foreach([b4_type_action_])[]dnl
|
||||
default:
|
||||
break;
|
||||
}
|
||||
m4_popdef([b4_dollar_dollar])dnl
|
||||
])
|
||||
|
||||
|
||||
# _b4_char_sizeof_counter
|
||||
# -----------------------
|
||||
# A counter used by _b4_char_sizeof_dummy to create fresh symbols.
|
||||
m4_define([_b4_char_sizeof_counter],
|
||||
[0])
|
||||
|
||||
# _b4_char_sizeof_dummy
|
||||
# ---------------------
|
||||
# At each call return a new C++ identifier.
|
||||
m4_define([_b4_char_sizeof_dummy],
|
||||
[m4_define([_b4_char_sizeof_counter], m4_incr(_b4_char_sizeof_counter))dnl
|
||||
dummy[]_b4_char_sizeof_counter])
|
||||
|
||||
|
||||
# b4_char_sizeof(SYMBOL-NUMS)
|
||||
# ---------------------------
|
||||
# To be mapped on the list of type names to produce:
|
||||
#
|
||||
# char dummy1[sizeof(type_name_1)];
|
||||
# char dummy2[sizeof(type_name_2)];
|
||||
#
|
||||
# for defined type names.
|
||||
m4_define([b4_char_sizeof],
|
||||
[b4_symbol_if([$1], [has_type],
|
||||
[
|
||||
m4_map([ b4_symbol_tag_comment], [$@])dnl
|
||||
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
|
||||
# -----------------
|
||||
# Define "variant".
|
||||
m4_define([b4_variant_define],
|
||||
[[ /// A char[S] buffer to store and retrieve objects.
|
||||
///
|
||||
/// Sort of a variant, but does not keep track of the nature
|
||||
/// of the stored data, since that knowledge is available
|
||||
/// via the current state.
|
||||
template <size_t S>
|
||||
struct variant
|
||||
{
|
||||
/// Type of *this.
|
||||
typedef variant<S> self_type;
|
||||
|
||||
/// Empty construction.
|
||||
variant ()]b4_parse_assert_if([
|
||||
: yytname_ (YY_NULL)])[
|
||||
{}
|
||||
|
||||
/// Construct and fill.
|
||||
template <typename T>
|
||||
variant (const T& t)]b4_parse_assert_if([
|
||||
: yytname_ (typeid (T).name ())])[
|
||||
{
|
||||
YYASSERT (sizeof (T) <= S);
|
||||
new (yyas_<T> ()) T (t);
|
||||
}
|
||||
|
||||
/// Destruction, allowed only if empty.
|
||||
~variant ()
|
||||
{]b4_parse_assert_if([
|
||||
YYASSERT (!yytname_);
|
||||
])[}
|
||||
|
||||
/// Instantiate an empty \a T in here.
|
||||
template <typename T>
|
||||
T&
|
||||
build ()
|
||||
{]b4_parse_assert_if([
|
||||
YYASSERT (!yytname_);
|
||||
YYASSERT (sizeof (T) <= S);
|
||||
yytname_ = typeid (T).name ();])[
|
||||
return *new (yyas_<T> ()) T;
|
||||
}
|
||||
|
||||
/// Instantiate a \a T in here from \a t.
|
||||
template <typename T>
|
||||
T&
|
||||
build (const T& t)
|
||||
{]b4_parse_assert_if([
|
||||
YYASSERT (!yytname_);
|
||||
YYASSERT (sizeof (T) <= S);
|
||||
yytname_ = typeid (T).name ();])[
|
||||
return *new (yyas_<T> ()) T (t);
|
||||
}
|
||||
|
||||
/// Accessor to a built \a T.
|
||||
template <typename T>
|
||||
T&
|
||||
as ()
|
||||
{]b4_parse_assert_if([
|
||||
YYASSERT (yytname_ == typeid (T).name ());
|
||||
YYASSERT (sizeof (T) <= S);])[
|
||||
return *yyas_<T> ();
|
||||
}
|
||||
|
||||
/// Const accessor to a built \a T (for %printer).
|
||||
template <typename T>
|
||||
const T&
|
||||
as () const
|
||||
{]b4_parse_assert_if([
|
||||
YYASSERT (yytname_ == typeid (T).name ());
|
||||
YYASSERT (sizeof (T) <= S);])[
|
||||
return *yyas_<T> ();
|
||||
}
|
||||
|
||||
/// 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>
|
||||
void
|
||||
swap (self_type& other)
|
||||
{]b4_parse_assert_if([
|
||||
YYASSERT (yytname_);
|
||||
YYASSERT (yytname_ == other.yytname_);])[
|
||||
std::swap (as<T> (), other.as<T> ());
|
||||
}
|
||||
|
||||
/// Move the content of \a other to this.
|
||||
///
|
||||
/// Destroys \a other.
|
||||
template <typename T>
|
||||
void
|
||||
move (self_type& other)
|
||||
{]b4_parse_assert_if([
|
||||
YYASSERT (!yytname_);])[
|
||||
build<T> ();
|
||||
swap<T> (other);
|
||||
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.
|
||||
template <typename T>
|
||||
void
|
||||
destroy ()
|
||||
{
|
||||
as<T> ().~T ();]b4_parse_assert_if([
|
||||
yytname_ = YY_NULL;])[
|
||||
}
|
||||
|
||||
private:
|
||||
/// Prohibit blind copies.
|
||||
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
|
||||
{
|
||||
/// Strongest alignment constraints.
|
||||
long double yyalign_me;
|
||||
/// 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 char *yytname_;])[
|
||||
};
|
||||
]])
|
||||
|
||||
|
||||
## -------------------------- ##
|
||||
## Adjustments for variants. ##
|
||||
## -------------------------- ##
|
||||
|
||||
|
||||
# b4_value_type_declare
|
||||
# ---------------------
|
||||
# Declare semantic_type.
|
||||
m4_define([b4_value_type_declare],
|
||||
[[ /// An auxiliary type to compute the largest semantic type.
|
||||
union union_type
|
||||
{]b4_type_foreach([b4_char_sizeof])[};
|
||||
|
||||
/// Symbol semantic values.
|
||||
typedef variant<sizeof(union_type)> semantic_type;][]dnl
|
||||
])
|
||||
|
||||
|
||||
# How the semantic value is extracted when using variants.
|
||||
|
||||
# b4_symbol_value(VAL, [TYPE])
|
||||
# ----------------------------
|
||||
m4_define([b4_symbol_value],
|
||||
[m4_ifval([$2],
|
||||
[$1.as< $2 > ()],
|
||||
[$1])])
|
||||
|
||||
# b4_symbol_value_template(VAL, [TYPE])
|
||||
# -------------------------------------
|
||||
# Same as b4_symbol_value, but used in a template method.
|
||||
m4_define([b4_symbol_value_template],
|
||||
[m4_ifval([$2],
|
||||
[$1.template as< $2 > ()],
|
||||
[$1])])
|
||||
|
||||
|
||||
|
||||
## ------------- ##
|
||||
## make_SYMBOL. ##
|
||||
## ------------- ##
|
||||
|
||||
|
||||
# b4_symbol_constructor_declare_(SYMBOL-NUMBER)
|
||||
# ---------------------------------------------
|
||||
# Declare the overloaded version of make_symbol for the (common) type of
|
||||
# these SYMBOL-NUMBERS. Use at class-level.
|
||||
m4_define([b4_symbol_constructor_declare_],
|
||||
[b4_symbol_if([$1], [is_token], [b4_symbol_if([$1], [has_id],
|
||||
[ static inline
|
||||
symbol_type
|
||||
make_[]b4_symbol_([$1], [id]) (dnl
|
||||
b4_join(b4_symbol_if([$1], [has_type],
|
||||
[const b4_symbol([$1], [type])& v]),
|
||||
b4_locations_if([const location_type& l])));
|
||||
|
||||
])])])
|
||||
|
||||
|
||||
# b4_symbol_constructor_declare
|
||||
# -----------------------------
|
||||
# Declare symbol constructors for all the value types.
|
||||
# Use at class-level.
|
||||
m4_define([b4_symbol_constructor_declare],
|
||||
[ // Symbol constructors declarations.
|
||||
b4_symbol_foreach([b4_symbol_constructor_declare_])])
|
||||
|
||||
|
||||
|
||||
# b4_symbol_constructor_define_(SYMBOL-NUMBER)
|
||||
# --------------------------------------------
|
||||
# Define symbol constructor for this SYMBOL-NUMBER.
|
||||
m4_define([b4_symbol_constructor_define_],
|
||||
[b4_symbol_if([$1], [is_token], [b4_symbol_if([$1], [has_id],
|
||||
[ b4_parser_class_name::symbol_type
|
||||
b4_parser_class_name::make_[]b4_symbol_([$1], [id]) (dnl
|
||||
b4_join(b4_symbol_if([$1], [has_type],
|
||||
[const b4_symbol([$1], [type])& v]),
|
||||
b4_locations_if([const location_type& l])))
|
||||
{
|
||||
return symbol_type (b4_join([token::b4_symbol([$1], [id])],
|
||||
b4_symbol_if([$1], [has_type], [v]),
|
||||
b4_locations_if([l])));
|
||||
|
||||
}
|
||||
|
||||
])])])
|
||||
|
||||
|
||||
# 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)
|
||||
, value (]b4_symbol_if([$1], [has_type], [v])[)]b4_locations_if([
|
||||
, location (l)])[
|
||||
{}
|
||||
]])
|
||||
|
||||
# b4_symbol_constructor_define
|
||||
# ----------------------------
|
||||
# Define the overloaded versions of make_symbol for all the value types.
|
||||
m4_define([b4_symbol_constructor_define],
|
||||
[ // Implementation of make_symbol for each symbol type.
|
||||
b4_symbol_foreach([b4_symbol_constructor_define_])])
|
||||
+1
-1
@@ -3,7 +3,7 @@
|
||||
<!--
|
||||
bison.xsl - common templates for Bison XSLT.
|
||||
|
||||
Copyright (C) 2007-2013 Free Software Foundation, Inc.
|
||||
Copyright (C) 2007-2015, 2018-2019 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of Bison, the GNU Compiler Compiler.
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<!--
|
||||
xml2dot.xsl - transform Bison XML Report into DOT.
|
||||
|
||||
Copyright (C) 2007-2013 Free Software Foundation, Inc.
|
||||
Copyright (C) 2007-2015, 2018-2019 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of Bison, the GNU Compiler Compiler.
|
||||
|
||||
@@ -83,7 +83,7 @@
|
||||
<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. -->
|
||||
referred to directly in XPath expressions. -->
|
||||
<xsl:variable name="rul">
|
||||
<xsl:value-of select="@rule"/>
|
||||
</xsl:variable>
|
||||
@@ -95,7 +95,7 @@
|
||||
<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
|
||||
<!-- The acceptation state is referred to as 'accept' in the XML, but
|
||||
just as '0' in the DOT. -->
|
||||
<xsl:when test="@rule='accept'">
|
||||
<xsl:text>0</xsl:text>
|
||||
@@ -201,6 +201,8 @@
|
||||
<xsl:if test="$point = 0">
|
||||
<xsl:text> .</xsl:text>
|
||||
</xsl:if>
|
||||
|
||||
<!-- RHS -->
|
||||
<xsl:for-each select="rhs/symbol|rhs/empty">
|
||||
<xsl:apply-templates select="."/>
|
||||
<xsl:if test="$point = position()">
|
||||
@@ -214,7 +216,9 @@
|
||||
<xsl:value-of select="."/>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="empty"/>
|
||||
<xsl:template match="empty">
|
||||
<xsl:text> %empty</xsl:text>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="lookaheads">
|
||||
<xsl:text> [</xsl:text>
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<!--
|
||||
xml2text.xsl - transform Bison XML Report into plain text.
|
||||
|
||||
Copyright (C) 2007-2013 Free Software Foundation, Inc.
|
||||
Copyright (C) 2007-2015, 2018-2019 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of Bison, the GNU Compiler Compiler.
|
||||
|
||||
@@ -350,12 +350,7 @@
|
||||
<xsl:if test="position() = $point + 1">
|
||||
<xsl:text> .</xsl:text>
|
||||
</xsl:if>
|
||||
<xsl:if test="$itemset = 'true' and name(.) != 'empty'">
|
||||
<xsl:apply-templates select="."/>
|
||||
</xsl:if>
|
||||
<xsl:if test="$itemset != 'true'">
|
||||
<xsl:apply-templates select="."/>
|
||||
</xsl:if>
|
||||
<xsl:apply-templates select="."/>
|
||||
<xsl:if test="position() = last() and position() = $point">
|
||||
<xsl:text> .</xsl:text>
|
||||
</xsl:if>
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<!--
|
||||
xml2html.xsl - transform Bison XML Report into XHTML.
|
||||
|
||||
Copyright (C) 2007-2013 Free Software Foundation, Inc.
|
||||
Copyright (C) 2007-2015, 2018-2019 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of Bison, the GNU Compiler Compiler.
|
||||
|
||||
@@ -38,6 +38,7 @@
|
||||
<xsl:template match="/">
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html;charset=UTF-8"/>
|
||||
<title>
|
||||
<xsl:value-of select="bison-xml-report/filename"/>
|
||||
<xsl:text> - GNU Bison XML Automaton Report</xsl:text>
|
||||
@@ -532,12 +533,7 @@
|
||||
<xsl:text> </xsl:text>
|
||||
<span class="point">.</span>
|
||||
</xsl:if>
|
||||
<xsl:if test="$itemset = 'true' and name(.) != 'empty'">
|
||||
<xsl:apply-templates select="."/>
|
||||
</xsl:if>
|
||||
<xsl:if test="$itemset != 'true'">
|
||||
<xsl:apply-templates select="."/>
|
||||
</xsl:if>
|
||||
<xsl:apply-templates select="."/>
|
||||
<xsl:if test="position() = last() and position() = $point">
|
||||
<xsl:text> </xsl:text>
|
||||
<span class="point">.</span>
|
||||
@@ -563,7 +559,7 @@
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="empty">
|
||||
<xsl:text> ε</xsl:text>
|
||||
<xsl:text> %empty</xsl:text>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="lookaheads">
|
||||
|
||||
@@ -1,37 +0,0 @@
|
||||
# DJGPP Maintainer's Makefile -*-Makefile-*-
|
||||
# Requires GNU sed
|
||||
|
||||
## Copyright (C) 2005-2013 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/>.
|
||||
|
||||
top_srcdir = ..
|
||||
srcdir = .
|
||||
|
||||
SHELL = /bin/sh
|
||||
|
||||
all: README
|
||||
|
||||
README: README.in $(top_srcdir)/configure
|
||||
PACKAGE=`grep "^[ ]*PACKAGE=" $(top_srcdir)/configure | sed -e 's/^[ ]*PACKAGE=//' -e s/[\"\']//g`; \
|
||||
VERSION=`grep "^[ ]*VERSION=" $(top_srcdir)/configure | sed -e 's/^[ ]*VERSION=//' -e s/[\"\']//g`; \
|
||||
package_version=`echo "$${VERSION}" | sed 's/\.//g'`; \
|
||||
tree_version=`echo "$${VERSION}" | sed 's/\.//2g'`; \
|
||||
sed \
|
||||
-e "s/@V@/$${PACKAGE}-$${VERSION}/g" \
|
||||
-e "s/@VERSION@/$${VERSION}/g" \
|
||||
-e "s/@PACKAGE_VERSION@/$$package_version/g" \
|
||||
-e "s/@TREE_VERSION@/$$tree_version/g" \
|
||||
$(srcdir)/README.in > t-$@
|
||||
mv t-$@ $@
|
||||
-195
@@ -1,195 +0,0 @@
|
||||
This is a port of GNU Bison @VERSION@ to MSDOS/DJGPP.
|
||||
|
||||
Copyright (C) 2005-2013 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/>.
|
||||
|
||||
|
||||
1.: DJGPP specific changes.
|
||||
=======================
|
||||
|
||||
The DJGPP port of Bison offers LFN and SFN support depending on which
|
||||
OS it is running. If LFN support is available or not is determinated at
|
||||
run time. If LFN support is available (DOS session under Win9X, Win2K,
|
||||
WinXP, etc.) the standard posix file name extensions will be used.
|
||||
These are: y.tab.c, y.tab.c++, y.tab.h, y.output, etc. If only SFN
|
||||
support is available (plain DOS), then the standard MSDOS short file
|
||||
names will be used. These are: y_tab.c, y_tab.h, y.out, etc.
|
||||
It should be noticed that this bison version needs the m4 program as
|
||||
back end to generate the parser file (y.tab.c etc.) from the skeleton
|
||||
files. This implies that m4 must always be installed to get bison
|
||||
working. m4 will use a couple of m4 scripts that will be installed in
|
||||
/dev/env/DJDIR/share/bison and shall not be removed.
|
||||
It should also be noticed that the skeleton files bison.simple and
|
||||
bison.hairy are no longer supported. This applies also to the environ-
|
||||
ment variables BISON_HAIRY and BISON_SIMPLE. Those variables are *no*
|
||||
longer honored at all.
|
||||
The kind of skeleton file bison.hairy is no longer supported at all.
|
||||
The skeleton file bison.simple is now called yacc.c and is an m4 script.
|
||||
The other two skeleton files supported by this bison version are glr.c
|
||||
and lalr1.cc. The first one is a generalized LR C parser based on
|
||||
Bison's LALR(1) tables and the second one is a experimental C++ parser
|
||||
class.
|
||||
As has been told before, bison uses m4 to generate the parser file.
|
||||
This is done by forking and using pipes for the IPC. MSDOS does not
|
||||
support this functionality so this has been reproduced in the usual
|
||||
way by redirecting stdin and stdout of bison and m4 to temporary files
|
||||
and processing these files in sequence.
|
||||
It should be noticed that due to the great amount of file names that do
|
||||
not cleanly map to 8.3 file names, you will need an OS with LFN support
|
||||
to configure and compile the sources. On Win98 this implies that the
|
||||
generation of numeric tails for 8.3 file name aliases must be enabled
|
||||
or the compilation will fail.
|
||||
|
||||
|
||||
Please **read** the docs.
|
||||
|
||||
|
||||
2.: Installing the binary package.
|
||||
==============================
|
||||
|
||||
2.1.: Copy the binary distribution into the top DJGPP installation directory,
|
||||
just unzip it preserving the directory structure running *ONE* of the
|
||||
following commands:
|
||||
unzip32 bsn@[email protected] or
|
||||
djtarx bsn@[email protected] or
|
||||
pkunzip -d bsn@[email protected]
|
||||
|
||||
|
||||
|
||||
3.: Building the binaries from sources.
|
||||
===================================
|
||||
|
||||
3.1.: Create a temporary directory and copy the source package into the
|
||||
directory. If you download the source distribution from one of the
|
||||
DJGPP sites, just unzip it preserving the directory structure
|
||||
running *ONE* of the following commands:
|
||||
unzip32 bsn@[email protected] or
|
||||
djtarx bsn@[email protected] or
|
||||
pkunzip -d bsn@[email protected]
|
||||
and proceed to the paragraph 3.3, below.
|
||||
|
||||
3.2.: Source distributions downloaded from one of the GNU FTP sites need
|
||||
some more work to unpack, if LFN support is not available. If LFN is
|
||||
available then you can extract the source files from the archive with
|
||||
any unzip program and proceed to the paragraph 3.3, below. Any file
|
||||
name issue will be handled by the DJGPP configuration files.
|
||||
To unpack the source distribution on SFN systems, first, you MUST use
|
||||
the `djunpack' batch file to unzip the package. That is because some
|
||||
file names in the official distributions need to be changed to avoid
|
||||
problems on the various platforms supported by DJGPP.
|
||||
`djunpack' invokes the `djtar' program (that is part of the basic DJGPP
|
||||
development kit) to rename these files on the fly given a file with
|
||||
name mappings; the distribution includes a file `djgpp/fnchange.lst'
|
||||
with the necessary mappings. So you need first to retrieve that batch
|
||||
file, and then invoke it to unpack the distribution. Here's how:
|
||||
|
||||
djtar -x -p -o bison-@VERSION@/djgpp/djunpack.bat bison-@[email protected] > djunpack.bat
|
||||
djunpack bison-@[email protected]
|
||||
|
||||
(The name of the distribution archive and the leading directory of the
|
||||
path to `djunpack.bat' in the distribution will be different for
|
||||
versions of Bison other than @VERSION@.)
|
||||
|
||||
If the argument to `djunpack.bat' include leading directories, it MUST
|
||||
be given with the DOS-style backslashes; Unix-style forward slashes
|
||||
will NOT work.
|
||||
|
||||
If the distribution comes as a .tar.bz2 archive, and your version of
|
||||
`djtar' doesn't support bzip2 decompression, you need to unpack it as
|
||||
follows:
|
||||
|
||||
bnzip2 bison-@[email protected]
|
||||
djtar -x -p -o bison-@VERSION@/djgpp/djunpack.bat bison-@[email protected] > djunpack.bat
|
||||
djunpack bison-@[email protected]
|
||||
|
||||
3.3.: To build the binaries you will need the following binary packages:
|
||||
djdev203.zip (or a later but NOT a prior version)
|
||||
bsh204b.zip (or a later but NOT a prior version)
|
||||
gccNNNb.zip, gppNNN.zip, bnuNNNb.zip, makNNNb.zip, filNNNb.zip,
|
||||
perlNNNb.zip, shlNNNb.zip, txtNNNb.zip, txiNNNb.zip, grepNNNb.zip,
|
||||
sedNNNb.zip and m4NNN.zip
|
||||
|
||||
If you want to run the check you will need also:
|
||||
difNNNb.zip
|
||||
|
||||
NNN represents the latest version number of the binary packages. All
|
||||
this packages can be found in the /v2gnu directory of any
|
||||
ftp.delorie.com mirror.
|
||||
You will need bsh204b.zip or later and *NOT* a prior version or
|
||||
the build will fail. The same applies to djdev203.zip. Please note
|
||||
that Bison requires m4-144b.zip or later to work properly.
|
||||
|
||||
3.4.: If for some reason you want to reconfigure the package cd into the top
|
||||
srcdir (bison-@TREE_VERSION@) and run the following commands:
|
||||
del djgpp\config.cache
|
||||
make clean
|
||||
djgpp\config
|
||||
|
||||
Please note that you *MUST* delete the config.cache file in the djgpp
|
||||
subdir or you will not really reconfigure the sources because the
|
||||
configuration informations will be read from the cache file instead
|
||||
of being newly computed.
|
||||
To build the programs in a directory other than where the sources are,
|
||||
you must add the parameter that specifies the source directory,
|
||||
e.g:
|
||||
x:\src\gnu\bison-@TREE_VERSION@\djgpp\config x:/src/gnu/bison-@TREE_VERSION@
|
||||
|
||||
Lets assume you want to build the binaries in a directory placed on a
|
||||
different drive (z:\build in this case) from where the sources are,
|
||||
then you will run the following commands:
|
||||
z:
|
||||
md \build
|
||||
cd \build
|
||||
x:\src\gnu\bison-@TREE_VERSION@\djgpp\config x:/src/gnu/bison-@TREE_VERSION@
|
||||
|
||||
The order of the options and the srcdir option does not matter. You
|
||||
*MUST* use forward slashes to specify the source directory.
|
||||
|
||||
The batch file will set same environment variables, make MSDOS specific
|
||||
modifications to the Makefile.in's and supply all other needed options
|
||||
to the configure script.
|
||||
|
||||
3.5.: To compile the package run from the top srcdir the command:
|
||||
make
|
||||
|
||||
3.6.: Now you can run the tests if you like. From the top srcdir run the
|
||||
command:
|
||||
make check
|
||||
|
||||
No test should fail but the tests #131 (Doxygen Public Documentation)
|
||||
and #132 (Doxygen Private Documentation) will be skipped. Please note
|
||||
that the testsuite only works with LFN available. On plain DOS, most
|
||||
of the tests will fail due to invalid DOS names.
|
||||
|
||||
3.7.: To install the binaries, header, library, catalogs, and info docs
|
||||
run the following command from the top srcdir:
|
||||
make install
|
||||
|
||||
This will install the products into your DJGPP installation tree given
|
||||
by the default prefix "/dev/env/DJDIR". If you prefer to install them
|
||||
into some other directory you will have to set prefix to the appropriate
|
||||
value:
|
||||
make install prefix=z:/some/other/place
|
||||
|
||||
|
||||
|
||||
Send GNU bison specific bug reports to <[email protected]>.
|
||||
Send suggestions and bug reports concerning the DJGPP port to
|
||||
comp.os.msdos.djgpp or <[email protected]>.
|
||||
|
||||
|
||||
Enjoy.
|
||||
|
||||
Guerrero, Juan Manuel <[email protected]>
|
||||
@@ -1,547 +0,0 @@
|
||||
@echo off
|
||||
Rem Configure Bison for DJGPP.
|
||||
|
||||
Rem WARNING WARNING WARNING: This file needs to have DOS CRLF end-of-line
|
||||
Rem format, or else stock DOS/Windows shells will refuse to run it.
|
||||
|
||||
Rem Copyright (C) 2005-2013 Free Software Foundation, Inc.
|
||||
|
||||
Rem This program is free software: you can redistribute it and/or modify
|
||||
Rem it under the terms of the GNU General Public License as published by
|
||||
Rem the Free Software Foundation, either version 3 of the License, or
|
||||
Rem (at your option) any later version.
|
||||
Rem
|
||||
Rem This program is distributed in the hope that it will be useful,
|
||||
Rem but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
Rem MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
Rem GNU General Public License for more details.
|
||||
Rem
|
||||
Rem You should have received a copy of the GNU General Public License
|
||||
Rem along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
echo Configuring Bison for DJGPP v2.x...
|
||||
|
||||
Rem The SmallEnv tests protect against fixed and too small size
|
||||
Rem of the environment in stock DOS shell.
|
||||
|
||||
Rem Find out if NLS is wanted or not,
|
||||
Rem if dependency-tracking is wanted or not,
|
||||
Rem if caching is wanted or not
|
||||
Rem and where the sources are.
|
||||
Rem We always default to NLS support,
|
||||
Rem no dependency tracking
|
||||
Rem and to in place configuration.
|
||||
set ARGS=
|
||||
set NLS=enabled
|
||||
if not "%NLS%" == "enabled" goto SmallEnv
|
||||
set CACHING=enabled
|
||||
if not "%CACHING%" == "enabled" goto SmallEnv
|
||||
set DEPENDENCY_TRACKING=disabled
|
||||
if not "%DEPENDENCY_TRACKING%" == "disabled" goto SmallEnv
|
||||
set LIBICONV_PREFIX=disabled
|
||||
if not "%LIBICONV_PREFIX%" == "disabled" goto SmallEnv
|
||||
set LIBINTL_PREFIX=disabled
|
||||
if not "%LIBINTL_PREFIX%" == "disabled" goto SmallEnv
|
||||
set HTML=enabled
|
||||
if not "%HTML%" == "enabled" goto SmallEnv
|
||||
set XSRC=.
|
||||
if not "%XSRC%" == "." goto SmallEnv
|
||||
|
||||
Rem Loop over all arguments.
|
||||
Rem Special arguments are: NLS, XSRC, CACHE, STATIC_LIBS, LIBICONV_PREFIX, LIBINTL_PREFIX and DEPS.
|
||||
Rem All other arguments are stored into ARGS.
|
||||
:ArgLoop
|
||||
if "%1" == "nls" goto NextArgument
|
||||
if "%1" == "NLS" goto NextArgument
|
||||
if "%1" == "no-nls" goto NoNLS
|
||||
if "%1" == "no-NLS" goto NoNLS
|
||||
if "%1" == "NO-NLS" goto NoNLS
|
||||
goto CachingOption
|
||||
:NoNLS
|
||||
if "%1" == "no-nls" set NLS=disabled
|
||||
if "%1" == "no-NLS" set NLS=disabled
|
||||
if "%1" == "NO-NLS" set NLS=disabled
|
||||
if not "%NLS%" == "disabled" goto SmallEnv
|
||||
goto NextArgument
|
||||
:CachingOption
|
||||
if "%1" == "cache" goto NextArgument
|
||||
if "%1" == "CACHE" goto NextArgument
|
||||
if "%1" == "no-cache" goto NoCaching
|
||||
if "%1" == "no-CACHE" goto NoCaching
|
||||
if "%1" == "NO-CACHE" goto NoCaching
|
||||
goto DependencyOption
|
||||
:NoCaching
|
||||
if "%1" == "no-cache" set CACHING=disabled
|
||||
if "%1" == "no-CACHE" set CACHING=disabled
|
||||
if "%1" == "NO-CACHE" set CACHING=disabled
|
||||
if not "%CACHING%" == "disabled" goto SmallEnv
|
||||
goto NextArgument
|
||||
:DependencyOption
|
||||
if "%1" == "no-dep" goto NextArgument
|
||||
if "%1" == "no-DEP" goto NextArgument
|
||||
if "%1" == "NO-DEP" goto NextArgument
|
||||
if "%1" == "dep" goto DependecyTraking
|
||||
if "%1" == "DEP" goto DependecyTraking
|
||||
goto LibiconvPrefixOption
|
||||
:DependecyTraking
|
||||
if "%1" == "dep" set DEPENDENCY_TRACKING=enabled
|
||||
if "%1" == "DEP" set DEPENDENCY_TRACKING=enabled
|
||||
if not "%DEPENDENCY_TRACKING%" == "enabled" goto SmallEnv
|
||||
goto NextArgument
|
||||
:LibiconvPrefixOption
|
||||
if "%1" == "no-libiconvprefix" goto NextArgument
|
||||
if "%1" == "no-LIBICONVPREFIX" goto NextArgument
|
||||
if "%1" == "NO-LIBICONVPREFIX" goto NextArgument
|
||||
if "%1" == "libiconvprefix" goto WithLibiconvPrefix
|
||||
if "%1" == "LIBICONVPREFIX" goto WithLibiconvPrefix
|
||||
goto LibintlPrefixOption
|
||||
:WithLibiconvPrefix
|
||||
if "%1" == "libiconvprefix" set LIBICONV_PREFIX=enabled
|
||||
if "%1" == "LIBICONVPREFIX" set LIBICONV_PREFIX=enabled
|
||||
if not "%LIBICONV_PREFIX%" == "enabled" goto SmallEnv
|
||||
goto NextArgument
|
||||
:LibintlPrefixOption
|
||||
if "%1" == "no-libiconvprefix" goto NextArgument
|
||||
if "%1" == "no-LIBICONVPREFIX" goto NextArgument
|
||||
if "%1" == "NO-LIBICONVPREFIX" goto NextArgument
|
||||
if "%1" == "libintlprefix" goto _WithLibintlPrefix
|
||||
if "%1" == "LIBINTLPREFIX" goto _WithLibintlPrefix
|
||||
goto HTMLOption
|
||||
:_WithLibintlPrefix
|
||||
if "%1" == "libintlprefix" set LIBINTL_PREFIX=enabled
|
||||
if "%1" == "LIBINTLPREFIX" set LIBINTL_PREFIX=enabled
|
||||
if not "%LIBINTL_PREFIX%" == "enabled" goto SmallEnv
|
||||
:HTMLOption
|
||||
if "%1" == "withhtml" goto NextArgument
|
||||
if "%1" == "withHTML" goto NextArgument
|
||||
if "%1" == "WITHHTML" goto NextArgument
|
||||
if "%1" == "withouthtml" goto _WithoutHTML
|
||||
if "%1" == "withoutHTML" goto _WithoutHTML
|
||||
if "%1" == "WITHOUTHTML" goto _WithoutHTML
|
||||
goto SrcDirOption
|
||||
:_WithoutHTML
|
||||
if "%1" == "withouthtml" set HTML=disabled
|
||||
if "%1" == "withoutHTML" set HTML=disabled
|
||||
if "%1" == "WITHOUTHTML" set HTML=disabled
|
||||
if not "%HTML%" == "disabled" goto SmallEnv
|
||||
goto NextArgument
|
||||
:SrcDirOption
|
||||
echo %1 | grep -q "/"
|
||||
if errorlevel 1 goto CollectArgument
|
||||
set XSRC=%1
|
||||
if not "%XSRC%" == "%1" goto SmallEnv
|
||||
goto NextArgument
|
||||
:CollectArgument
|
||||
set _ARGS=%ARGS% %1
|
||||
if not "%_ARGS%" == "%ARGS% %1" if not "%_ARGS%" == "%ARGS%%1" goto SmallEnv
|
||||
echo %_ARGS% | grep -q "[^ ]"
|
||||
if not errorlevel 0 set ARGS=%_ARGS%
|
||||
set _ARGS=
|
||||
:NextArgument
|
||||
shift
|
||||
if not "%1" == "" goto ArgLoop
|
||||
|
||||
Rem Create an arguments file for the configure script.
|
||||
echo --srcdir=%XSRC% > args
|
||||
if "%CACHING%" == "enabled" echo --cache-file=%XSRC%/djgpp/config.cache >> args
|
||||
if "%DEPENDENCY_TRACKING%" == "enabled" echo --enable-dependency-tracking >> args
|
||||
if "%DEPENDENCY_TRACKING%" == "disabled" echo --disable-dependency-tracking >> args
|
||||
if "%LIBICONV_PREFIX%" == "enabled" echo --with-libiconv-prefix >> args
|
||||
if "%LIBICONV_PREFIX%" == "disabled" echo --without-libiconv-prefix >> args
|
||||
if "%LIBINTL_PREFIX%" == "enabled" echo --with-libintl-prefix >> args
|
||||
if "%LIBINTL_PREFIX%" == "disabled" echo --without-libintl-prefix >> args
|
||||
if "%HTML%" == "enabled" echo --enable-html >> args
|
||||
if "%HTML%" == "disabled" echo --disable-html >> args
|
||||
if not "%ARGS%" == "" echo %ARGS% >> args
|
||||
set ARGS=
|
||||
set CACHING=
|
||||
set DEPENDENCY_TRACKING=
|
||||
set LIBICONV_PREFIX=
|
||||
set LIBINTL_PREFIX=
|
||||
set HTML=
|
||||
|
||||
if "%XSRC%" == "." goto InPlace
|
||||
|
||||
:NotInPlace
|
||||
redir -e /dev/null update %XSRC%/configure.org ./configure
|
||||
test -f ./configure
|
||||
if errorlevel 1 update %XSRC%/configure ./configure
|
||||
|
||||
:InPlace
|
||||
Rem Update configuration files
|
||||
echo Updating configuration scripts...
|
||||
test -f ./configure.org
|
||||
if errorlevel 1 update configure configure.org
|
||||
sed -f %XSRC%/djgpp/config.sed configure.org > configure
|
||||
if errorlevel 1 goto SedError
|
||||
|
||||
Rem Make sure they have a config.site file
|
||||
set CONFIG_SITE=%XSRC%/djgpp/config.site
|
||||
if not "%CONFIG_SITE%" == "%XSRC%/djgpp/config.site" goto SmallEnv
|
||||
|
||||
Rem inttypes_.h and inttypes.h map to the same 8.3 alias.
|
||||
test -f %XSRC%/lib/inttypes_.h
|
||||
if not errorlevel 1 mv -f %XSRC%/lib/inttypes_.h %XSRC%/lib/_inttypes.h
|
||||
|
||||
Rem Make sure crucial file names are not munged by unpacking
|
||||
test -f %XSRC%/po/Makefile.in.in
|
||||
if not errorlevel 1 mv -f %XSRC%/po/Makefile.in.in %XSRC%/po/Makefile.in-in
|
||||
test -f %XSRC%/po/Makefile.in-in
|
||||
if errorlevel 1 mv -f %XSRC%/po/Makefile.in %XSRC%/po/Makefile.in-in
|
||||
test -f %XSRC%/po/Makefile.in-in
|
||||
if errorlevel 1 mv -f %XSRC%/po/Makefile.inin %XSRC%/po/Makefile.in-in
|
||||
test -f %XSRC%/po/Makefile.in-in
|
||||
if errorlevel 1 mv -f %XSRC%/po/Makefile.in_in %XSRC%/po/Makefile.in-in
|
||||
test -f %XSRC%/po/Makefile.in-in
|
||||
if errorlevel 1 mv -f %XSRC%/po/Makefile_in.in %XSRC%/po/Makefile.in-in
|
||||
test -f %XSRC%/runtime-po/Makefile.in.in
|
||||
if not errorlevel 1 mv -f %XSRC%/runtime-po/Makefile.in.in %XSRC%/runtime-po/Makefile.in-in
|
||||
test -f %XSRC%/runtime-po/Makefile.in-in
|
||||
if errorlevel 1 mv -f %XSRC%/runtime-po/Makefile.in %XSRC%/runtime-po/Makefile.in-in
|
||||
test -f %XSRC%/runtime-po/Makefile.in-in
|
||||
if errorlevel 1 mv -f %XSRC%/runtime-po/Makefile.inin %XSRC%/runtime-po/Makefile.in-in
|
||||
test -f %XSRC%/runtime-po/Makefile.in-in
|
||||
if errorlevel 1 mv -f %XSRC%/runtime-po/Makefile.in_in %XSRC%/runtime-po/Makefile.in-in
|
||||
test -f %XSRC%/runtime-po/Makefile.in-in
|
||||
if errorlevel 1 mv -f %XSRC%/runtime-po/Makefile_in.in %XSRC%/runtime-po/Makefile.in-in
|
||||
test -f %XSRC%/data/c++.m4
|
||||
if not errorlevel 1 mv -f %XSRC%/data/c++.m4 %XSRC%/data/cxx.m4
|
||||
test -f %XSRC%/data/cxx.m4
|
||||
if errorlevel 1 mv -f %XSRC%/data/cpp.m4 %XSRC%/data/cxx.m4
|
||||
test -f %XSRC%/data/c++-skel.m4
|
||||
if not errorlevel 1 mv -f %XSRC%/data/c++-skel.m4 %XSRC%/data/cxx-skel.m4
|
||||
test -f %XSRC%/data/cxx-skel.m4
|
||||
if errorlevel 1 mv -f %XSRC%/data/cpp-skel.m4 %XSRC%/data/cxx-skel.m4
|
||||
test -f %XSRC%/build-aux/javacomp.sh.in
|
||||
if not errorlevel 1 mv -f %XSRC%/build-aux/javacomp.sh.in %XSRC%/build-aux/javacomp.sh-in
|
||||
test -f %XSRC%/build-aux/javacomp.sh-in
|
||||
if errorlevel 1 mv -f %XSRC%/build-aux/javacomp.sh %XSRC%/build-aux/javacomp.sh-in
|
||||
test -f %XSRC%/build-aux/javacomp.sh-in
|
||||
if errorlevel 1 mv -f %XSRC%/build-aux/javacomp.shin %XSRC%/build-aux/javacomp.sh-in
|
||||
test -f %XSRC%/build-aux/javacomp.sh-in
|
||||
if errorlevel 1 mv -f %XSRC%/build-aux/javacomp.sh_in %XSRC%/build-aux/javacomp.sh-in
|
||||
test -f %XSRC%/build-aux/javacomp.sh-in
|
||||
if errorlevel 1 mv -f %XSRC%/build-aux/javacomp.sh.in %XSRC%/build-aux/javacomp.sh-in
|
||||
test -f %XSRC%/build-aux/javaexec.sh.in
|
||||
if not errorlevel 1 mv -f %XSRC%/build-aux/javaexec.sh.in %XSRC%/build-aux/javaexec.sh-in
|
||||
test -f %XSRC%/build-aux/javaexec.sh-in
|
||||
if errorlevel 1 mv -f %XSRC%/build-aux/javaexec.sh %XSRC%/build-aux/javaexec.sh-in
|
||||
test -f %XSRC%/build-aux/javaexec.sh-in
|
||||
if errorlevel 1 mv -f %XSRC%/build-aux/javaexec.shin %XSRC%/build-aux/javaexec.sh-in
|
||||
test -f %XSRC%/build-aux/javaexec.sh-in
|
||||
if errorlevel 1 mv -f %XSRC%/build-aux/javaexec.sh_in %XSRC%/build-aux/javaexec.sh-in
|
||||
test -f %XSRC%/build-aux/javaexec.sh-in
|
||||
if errorlevel 1 mv -f %XSRC%/build-aux/javaexec_sh.in %XSRC%/build-aux/javaexec.sh-in
|
||||
test -f %XSRC%/doc/yacc.1.in
|
||||
if not errorlevel 1 mv -f %XSRC%/doc/yacc.1.in %XSRC%/doc/yacc.1-in
|
||||
test -f %XSRC%/doc/yacc.1-in
|
||||
if errorlevel 1 mv -f %XSRC%/doc/yacc.1 %XSRC%/doc/yacc.1-in
|
||||
test -f %XSRC%/doc/yacc.1-in
|
||||
if errorlevel 1 mv -f %XSRC%/doc/yacc.1in %XSRC%/doc/yacc.1-in
|
||||
test -f %XSRC%/doc/yacc.1-in
|
||||
if errorlevel 1 mv -f %XSRC%/doc/yacc.1_in %XSRC%/doc/yacc.1-in
|
||||
test -f %XSRC%/doc/yacc.1-in
|
||||
if errorlevel 1 mv -f %XSRC%/doc/yacc_1.in %XSRC%/doc/yacc.1-in
|
||||
test -f %XSRC%/etc/bench.pl.in
|
||||
if not errorlevel 1 mv -f %XSRC%/etc/bench.pl.in %XSRC%/etc/bench.pl-in
|
||||
test -f %XSRC%/etc/bench.pl-in
|
||||
if errorlevel 1 mv -f %XSRC%/etc/bench.pl %XSRC%/etc/bench.pl-in
|
||||
test -f %XSRC%/etc/bench.pl-in
|
||||
if errorlevel 1 mv -f %XSRC%/etc/bench.plin %XSRC%/etc/bench.pl-in
|
||||
test -f %XSRC%/etc/bench.pl-in
|
||||
if errorlevel 1 mv -f %XSRC%/etc/bench.pl_in %XSRC%/etc/bench.pl-in
|
||||
test -f %XSRC%/etc/bench.pl-in
|
||||
if errorlevel 1 mv -f %XSRC%/etc/bench_pl.in %XSRC%/etc/bench.pl-in
|
||||
|
||||
:scan_gram_c_Test
|
||||
test -f %XSRC%/src/c-scan-gram.c
|
||||
if not errorlevel 1 goto scan_skel_c_Test
|
||||
test -f %XSRC%/src/scan-gram-c.c
|
||||
if not errorlevel 1 mv -f %XSRC%/src/scan-gram-c.c %XSRC%/src/c-scan-gram.c
|
||||
:scan_skel_c_Test
|
||||
test -f %XSRC%/src/c-scan-skel.c
|
||||
if not errorlevel 1 goto FixFiles
|
||||
test -f %XSRC%/src/scan-skel-c.c
|
||||
if not errorlevel 1 mv -f %XSRC%/src/scan-skel-c.c %XSRC%/src/c-scan-skel.c
|
||||
|
||||
:FixFiles
|
||||
Rem Fix data/lalr1.cc and data/location.cc to reflect the renaming of c++.m4
|
||||
sed "s/c++\.m4/cxx.m4/" %XSRC%/data/lalr1.cc > lalr1.cc
|
||||
if errorlevel 1 goto lalr1_ccFileError
|
||||
mv ./lalr1.cc %XSRC%/data/lalr1.cc
|
||||
sed "s/c++\.m4/cxx.m4/" %XSRC%/data/location.cc > location.cc
|
||||
if errorlevel 1 goto location_ccFileError
|
||||
mv ./location.cc %XSRC%/data/location.cc
|
||||
sed "s/c++\.m4/cxx.m4/" %XSRC%/data/glr.cc > glr.cc
|
||||
if errorlevel 1 goto glr_ccFileError
|
||||
mv ./glr.cc %XSRC%/data/glr.cc
|
||||
|
||||
Rem Fix src/getargs.c to reflect the renaming of c++-skel.m4
|
||||
sed "s/c++-skel\.m4/cxx-skel.m4/" %XSRC%/src/getargs.c > getargs.c
|
||||
if errorlevel 1 goto getargs_cFileError
|
||||
mv ./getargs.c %XSRC%/src/getargs.c
|
||||
|
||||
Rem Define DJGPP specific defs in config.hin
|
||||
echo Editing config.hin...
|
||||
test -f %XSRC%/lib/config_h.org
|
||||
if errorlevel 1 update %XSRC%/lib/config.hin %XSRC%/lib/config_h.org
|
||||
sed -f %XSRC%/djgpp/config_h.sed %XSRC%/lib/config_h.org > config.hin
|
||||
if errorlevel 1 goto SedError2
|
||||
mv -f config.hin %XSRC%/lib/config.hin
|
||||
|
||||
|
||||
Rem Fixing ilicit testsuite file name.
|
||||
test -f %XSRC%/tests/c++.at
|
||||
if not errorlevel 1 mv -f %XSRC%/tests/c++.at %XSRC%/tests/cxx.at
|
||||
|
||||
test -f %XSRC%/tests/testsuite.org
|
||||
if errorlevel 1 update %XSRC%/tests/testsuite %XSRC%/tests/testsuite.org
|
||||
sed -f %XSRC%/djgpp/testsuite.sed %XSRC%/tests/testsuite.org > testsuite.tmp
|
||||
if errorlevel 1 goto SedError3
|
||||
mv -f ./testsuite.tmp %XSRC%/tests/testsuite
|
||||
|
||||
Rem Fixing ilicit calc++ file names in the calc++ directory.
|
||||
test -d %XSRC%/examples/calc++
|
||||
if not errorlevel 1 mv -f %XSRC%/examples/calc++ %XSRC%/examples/calcxx
|
||||
test -d %XSRC%/examples/calcxx
|
||||
if errorlevel 1 mv -f %XSRC%/examples/calcpp %XSRC%/examples/calcxx
|
||||
test -f %XSRC%/examples/calcxx/calc++-scanner.cc
|
||||
if not errorlevel 1 mv -f %XSRC%/examples/calcxx/calc++-scanner.cc %XSRC%/examples/calcxx/calcxx-scanner.cc
|
||||
test -f %XSRC%/examples/calcxx/calcxx-scanner.cc
|
||||
if errorlevel 1 mv -f %XSRC%/examples/calcxx/calcpp-scanner.cc %XSRC%/examples/calcxx/calcxx-scanner.cc
|
||||
test -f %XSRC%/examples/calcxx/calc++-scanner.ll
|
||||
if not errorlevel 1 mv -f %XSRC%/examples/calcxx/calc++-scanner.ll %XSRC%/examples/calcxx/calcxx-scanner.ll
|
||||
test -f %XSRC%/examples/calcxx/calcxx-scanner.ll
|
||||
if errorlevel 1 mv -f %XSRC%/examples/calcxx/calcpp-scanner.ll %XSRC%/examples/calcxx/calcxx-scanner.ll
|
||||
test -f %XSRC%/examples/calcxx/calc++-driver.cc
|
||||
if not errorlevel 1 mv -f %XSRC%/examples/calcxx/calc++-driver.cc %XSRC%/examples/calcxx/calcxx-driver.cc
|
||||
test -f %XSRC%/examples/calcxx/calcxx-driver.cc
|
||||
if errorlevel 1 mv -f %XSRC%/examples/calcxx/calcpp-driver.cc %XSRC%/examples/calcxx/calcxx-driver.cc
|
||||
test -f %XSRC%/examples/calcxx/calc++-driver.hh
|
||||
if not errorlevel 1 mv -f %XSRC%/examples/calcxx/calc++-driver.hh %XSRC%/examples/calcxx/calcxx-driver.hh
|
||||
test -f %XSRC%/examples/calcxx/calcxx-driver.hh
|
||||
if errorlevel 1 mv -f %XSRC%/examples/calcxx/calcpp-driver.hh %XSRC%/examples/calcxx/calcxx-driver.hh
|
||||
test -f %XSRC%/examples/calcxx/calc++-parser.cc
|
||||
if not errorlevel 1 mv -f %XSRC%/examples/calcxx/calc++-parser.cc %XSRC%/examples/calcxx/calcxx-parser.cc
|
||||
test -f %XSRC%/examples/calcxx/calcxx-parser.cc
|
||||
if errorlevel 1 mv -f %XSRC%/examples/calcxx/calcpp-parser.cc %XSRC%/examples/calcxx/calcxx-parser.cc
|
||||
test -f %XSRC%/examples/calcxx/calc++-parser.hh
|
||||
if not errorlevel 1 mv -f %XSRC%/examples/calcxx/calc++-parser.hh %XSRC%/examples/calcxx/calcxx-parser.hh
|
||||
test -f %XSRC%/examples/calcxx/calcxx-parser.hh
|
||||
if errorlevel 1 mv -f %XSRC%/examples/calcxx/calcpp-parser.hh %XSRC%/examples/calcxx/calcxx-parser.hh
|
||||
test -f %XSRC%/examples/calcxx/calc++-parser.stamp
|
||||
if not errorlevel 1 mv -f %XSRC%/examples/calcxx/calc++-parser.stamp %XSRC%/examples/calcxx/calcxx-parser.stamp
|
||||
test -f %XSRC%/examples/calcxx/calcxx-parser.stamp
|
||||
if errorlevel 1 mv -f %XSRC%/examples/calcxx/calcpp-parser.stamp %XSRC%/examples/calcxx/calcxx-parser.stamp
|
||||
test -f %XSRC%/examples/calcxx/calc++-parser.yy
|
||||
if not errorlevel 1 mv -f %XSRC%/examples/calcxx/calc++-parser.yy %XSRC%/examples/calcxx/calcxx-parser.yy
|
||||
test -f %XSRC%/examples/calcxx/calcxx-parser.yy
|
||||
if errorlevel 1 mv -f %XSRC%/examples/calcxx/calcpp-parser.yy %XSRC%/examples/calcxx/calcxx-parser.yy
|
||||
test -f %XSRC%/examples/calcxx/calc++.cc
|
||||
if not errorlevel 1 mv -f %XSRC%/examples/calcxx/calc++.cc %XSRC%/examples/calcxx/calcxx.cc
|
||||
test -f %XSRC%/examples/calcxx/calcxx.cc
|
||||
if errorlevel 1 mv -f %XSRC%/examples/calcxx/calcpp.cc %XSRC%/examples/calcxx/calcxx.cc
|
||||
|
||||
Rem Fixing #include lines in calcxx files.
|
||||
sed "/#[ ]*include/s/++/xx/" %XSRC%/examples/calcxx/calcxx.cc > calcxx.cc
|
||||
if errorlevel 1 goto calcxxFileError
|
||||
mv ./calcxx.cc %XSRC%/examples/calcxx/calcxx.cc
|
||||
sed "/#[ ]*include/s/++/xx/" %XSRC%/examples/calcxx/calcxx-driver.cc > calcxx-driver.cc
|
||||
if errorlevel 1 goto calcxxFileError
|
||||
mv ./calcxx-driver.cc %XSRC%/examples/calcxx/calcxx-driver.cc
|
||||
sed "/#[ ]*include/s/++/xx/" %XSRC%/examples/calcxx/calcxx-driver.hh > calcxx-driver.hh
|
||||
if errorlevel 1 goto calcxxFileError
|
||||
mv ./calcxx-driver.hh %XSRC%/examples/calcxx/calcxx-driver.hh
|
||||
sed "/#[ ]*include/s/++/xx/" %XSRC%/examples/calcxx/calcxx-parser.cc > calcxx-parser.cc
|
||||
if errorlevel 1 goto calcxxFileError
|
||||
mv ./calcxx-parser.cc %XSRC%/examples/calcxx/calcxx-parser.cc
|
||||
sed "/#[ ]*include/s/++/xx/" %XSRC%/examples/calcxx/calcxx-parser.hh > calcxx-parser.hh
|
||||
if errorlevel 1 goto calcxxFileError
|
||||
mv ./calcxx-parser.hh %XSRC%/examples/calcxx/calcxx-parser.hh
|
||||
:sed "/#[ ]*include/s/++/xx/" %XSRC%/examples/calcxx/calcxx-parser.yy > calcxx-parser.yy
|
||||
:if errorlevel 1 goto calcxxFileError
|
||||
:mv ./calcxx-parser.yy %XSRC%/examples/calcxx/calcxx-parser.yy
|
||||
sed "/#[ ]*include/s/++/xx/" %XSRC%/examples/calcxx/calcxx-scanner.cc > calcxx-scanner.cc
|
||||
if errorlevel 1 goto calcxxFileError
|
||||
mv ./calcxx-scanner.cc %XSRC%/examples/calcxx/calcxx-scanner.cc
|
||||
:sed "/#[ ]*include/s/++/xx/" %XSRC%/examples/calcxx/calcxx-scanner.ll > calcxx-scanner.ll
|
||||
:if errorlevel 1 goto calcxxFileError
|
||||
:mv ./calcxx-scanner.ll %XSRC%/examples/calcxx/calcxx-scanner.ll
|
||||
sed "s/calc++/calcxx/" %XSRC%/examples/calcxx/test > test
|
||||
if errorlevel 1 goto calcxxFileError
|
||||
mv ./test %XSRC%/examples/calcxx/test
|
||||
|
||||
|
||||
Rem Fixing the scanner files to make file names 8.3 valid.
|
||||
Rem Use only if you want to change the scan-gram.l and scan-skel.l files.
|
||||
: sed "/outfile=/s/\.yy/yy/" %XSRC%/src/scan-gram.l > scan-gram.l
|
||||
: if errorlevel 1 goto ScannerFileError
|
||||
: mv ./scan-gram.l %XSRC%/src/scan-gram.l
|
||||
: sed "/outfile=/s/\.yy/yy/" %XSRC%/src/scan-skel.l > scan-skel.l
|
||||
: if errorlevel 1 goto ScannerFileError
|
||||
: mv ./scan-skel.l %XSRC%/src/scan-skel.l
|
||||
|
||||
|
||||
Rem This is required because DOS/Windows are case-insensitive
|
||||
Rem to file names, and "make install" will do nothing if Make
|
||||
Rem finds a file called `install'.
|
||||
if exist INSTALL ren INSTALL INSTALL.txt
|
||||
|
||||
Rem Set SHELL to a sane default or some configure tests stop working
|
||||
Rem if the package is configured across partitions.
|
||||
if not "%SHELL%" == "" goto HomeName
|
||||
set SHELL=/bin/sh
|
||||
if not "%SHELL%" == "/bin/sh" goto SmallEnv
|
||||
echo No SHELL found in the environment, using default value
|
||||
|
||||
:HomeName
|
||||
Rem Set HOME to a sane default so configure stops complaining.
|
||||
if not "%HOME%" == "" goto HostName
|
||||
set HOME=%XSRC%/djgpp
|
||||
if not "%HOME%" == "%XSRC%/djgpp" goto SmallEnv
|
||||
echo No HOME found in the environment, using default value
|
||||
|
||||
:HostName
|
||||
Rem Set HOSTNAME so it shows in config.status
|
||||
if not "%HOSTNAME%" == "" goto hostdone
|
||||
if "%windir%" == "" goto msdos
|
||||
set OS=MS-Windows
|
||||
if not "%OS%" == "MS-Windows" goto SmallEnv
|
||||
goto haveos
|
||||
:msdos
|
||||
set OS=MS-DOS
|
||||
if not "%OS%" == "MS-DOS" goto SmallEnv
|
||||
:haveos
|
||||
if not "%USERNAME%" == "" goto haveuname
|
||||
if not "%USER%" == "" goto haveuser
|
||||
echo No USERNAME and no USER found in the environment, using default values
|
||||
set HOSTNAME=Unknown PC
|
||||
if not "%HOSTNAME%" == "Unknown PC" goto SmallEnv
|
||||
goto userdone
|
||||
:haveuser
|
||||
set HOSTNAME=%USER%'s PC
|
||||
if not "%HOSTNAME%" == "%USER%'s PC" goto SmallEnv
|
||||
goto userdone
|
||||
:haveuname
|
||||
set HOSTNAME=%USERNAME%'s PC
|
||||
if not "%HOSTNAME%" == "%USERNAME%'s PC" goto SmallEnv
|
||||
:userdone
|
||||
set _HOSTNAME=%HOSTNAME%, %OS%
|
||||
if not "%_HOSTNAME%" == "%HOSTNAME%, %OS%" goto SmallEnv
|
||||
set HOSTNAME=%_HOSTNAME%
|
||||
:hostdone
|
||||
set _HOSTNAME=
|
||||
set OS=
|
||||
|
||||
Rem install-sh is required by the configure script but clashes with the
|
||||
Rem various Makefile install-foo targets, so we MUST have it before the
|
||||
Rem script runs and rename it afterwards
|
||||
test -f %XSRC%/install-sh
|
||||
if not errorlevel 1 goto NoRen0
|
||||
test -f %XSRC%/install-sh.sh
|
||||
if not errorlevel 1 mv -f %XSRC%/install-sh.sh %XSRC%/install-sh
|
||||
:NoRen0
|
||||
|
||||
if "%NLS%" == "disabled" goto WithoutNLS
|
||||
|
||||
:WithNLS
|
||||
Rem Check for the needed libraries and binaries.
|
||||
test -x /dev/env/DJDIR/bin/msgfmt.exe
|
||||
if errorlevel 1 goto MissingNLSTools
|
||||
test -x /dev/env/DJDIR/bin/xgettext.exe
|
||||
if errorlevel 1 goto MissingNLSTools
|
||||
test -f /dev/env/DJDIR/include/libcharset.h
|
||||
if errorlevel 1 goto MissingNLSTools
|
||||
test -f /dev/env/DJDIR/lib/libcharset.a
|
||||
if errorlevel 1 goto MissingNLSTools
|
||||
test -f /dev/env/DJDIR/include/iconv.h
|
||||
if errorlevel 1 goto MissingNLSTools
|
||||
test -f /dev/env/DJDIR/lib/libiconv.a
|
||||
if errorlevel 1 goto MissingNLSTools
|
||||
test -f /dev/env/DJDIR/include/libintl.h
|
||||
if errorlevel 1 goto MissingNLSTools
|
||||
test -f /dev/env/DJDIR/lib/libintl.a
|
||||
if errorlevel 1 goto MissingNLSTools
|
||||
|
||||
Rem Recreate the files in the %XSRC%/po subdir with our ported tools.
|
||||
redir -e /dev/null rm %XSRC%/po/*.gmo
|
||||
redir -e /dev/null rm %XSRC%/po/bison.pot
|
||||
redir -e /dev/null rm %XSRC%/po/cat-id-tbl.c
|
||||
redir -e /dev/null rm %XSRC%/po/stamp-cat-id
|
||||
|
||||
Rem Update the arguments file for the configure script.
|
||||
Rem We prefer without-included-gettext because libintl.a from gettext package
|
||||
Rem is the only one that is guaranteed to have been ported to DJGPP.
|
||||
echo --enable-nls --without-included-gettext >> args
|
||||
goto ConfigurePackage
|
||||
|
||||
:MissingNLSTools
|
||||
echo Needed libs/tools for NLS not found. Configuring without NLS.
|
||||
:WithoutNLS
|
||||
Rem Update the arguments file for the configure script.
|
||||
echo --disable-nls >> args
|
||||
|
||||
:ConfigurePackage
|
||||
echo Running the ./configure script...
|
||||
sh ./configure @args
|
||||
if errorlevel 1 goto CfgError
|
||||
rm args
|
||||
echo Done.
|
||||
goto End
|
||||
|
||||
:lalr1_ccFileError
|
||||
echo ./data/lalr1.cc file editing failed!
|
||||
goto End
|
||||
|
||||
:glr_ccFileError
|
||||
echo ./data/glr.cc file editing failed!
|
||||
goto End
|
||||
|
||||
:getargs_cFileError
|
||||
echo ./src/getargs.c file editing failed!
|
||||
goto End
|
||||
|
||||
:location_ccFileError
|
||||
echo ./data/location.cc file editing failed!
|
||||
goto End
|
||||
|
||||
:calcxxFileError
|
||||
echo ./examples/calcxx file editing failed!
|
||||
goto End
|
||||
|
||||
:ScannerFileError
|
||||
echo ./scanner file editing failed!
|
||||
goto End
|
||||
|
||||
:SedError
|
||||
echo ./configure script editing failed!
|
||||
goto End
|
||||
|
||||
:SedError2
|
||||
echo ./lib/config.hin editing failed!
|
||||
goto End
|
||||
|
||||
:SedError3
|
||||
echo ./tests/testsuite editing failed!
|
||||
goto End
|
||||
|
||||
:CfgError
|
||||
echo ./configure script exited abnormally!
|
||||
goto End
|
||||
|
||||
:SmallEnv
|
||||
echo Your environment size is too small. Enlarge it and run me again.
|
||||
echo Configuration NOT done!
|
||||
|
||||
:End
|
||||
test -f %XSRC%/install-sh.sh
|
||||
if not errorlevel 1 goto NoRen1
|
||||
test -f %XSRC%/install-sh
|
||||
if not errorlevel 1 mv -f %XSRC%/install-sh %XSRC%/install-sh.sh
|
||||
:NoRen1
|
||||
if "%SHELL%" == "/bin/sh" set SHELL=
|
||||
if "%HOME%" == "%XSRC%/djgpp" set HOME=
|
||||
set CONFIG_SITE=
|
||||
set HOSTNAME=
|
||||
set NLS=
|
||||
set XSRC=
|
||||
@@ -1,190 +0,0 @@
|
||||
# DJGPP specific configuration file.
|
||||
# Sed script for additional DJGPP specific editing
|
||||
# of the configure script generated by autoconf 2.62.
|
||||
|
||||
# Copyright (C) 2005-2013 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/>.
|
||||
|
||||
|
||||
# Additional editing of Makefiles
|
||||
/^eval sed.*ac_file_inputs.*tmp\/out \\$/ {
|
||||
:loop
|
||||
n
|
||||
/^$/!b loop
|
||||
a\
|
||||
cat > "$tmp/subs-djgpp.sed" << eof_djgpp\
|
||||
# DJGPP specific Makefile changes.\
|
||||
s,\\.deps,_deps,g\
|
||||
s,\\.libs,_libs,g\
|
||||
s,\\.new\\.,_new.,g\
|
||||
s,\\.old\\.,_old.,g\
|
||||
s,\\.tab\\.,_tab.,g\
|
||||
s,c++\\.at,cxx.at,g\
|
||||
s,c++\\.m4,cxx.m4,g\
|
||||
s,c++-skel\\.m4,cxx-skel.m4,g\
|
||||
s,calc++,calcxx,g\
|
||||
s,scan-gram-c,c-scan-gram,g\
|
||||
s,scan-skel-c,c-scan-skel,g\
|
||||
s,inttypes_,_inttypes,g\
|
||||
s,javacomp\\.sh\\.in,javacomp.sh-in,g\
|
||||
s,javaexec\\.sh\\.in,javaexec.sh-in,g\
|
||||
s,yacc\\.1\\.in,yacc.1-in,g\
|
||||
s,bench\\.pl\\.in,bench.pl-in,g\
|
||||
s,Makefile\\.am\\.in,Makefile.am-in,g\
|
||||
s,Makefile\\.in\\.in,Makefile.in-in,g\
|
||||
/^\\.y\\.c:/,/^$/ {\
|
||||
/\\\$(YACCCOMPILE)/ {\
|
||||
a\\\\\
|
||||
-@test -f y.tab.c && mv -f y.tab.c y_tab.c\\\\\
|
||||
-@test -f y.tab.h && mv -f y.tab.h y_tab.h\
|
||||
}\
|
||||
}\
|
||||
/^libbison.a:/ i\\\\\
|
||||
\\$(top_srcdir)/djgpp/subpipe.c: \\$(top_srcdir)/djgpp/subpipe.h\\\\\
|
||||
subpipe.o: \\$(top_srcdir)/djgpp/subpipe.c \\$(top_srcdir)/djgpp/subpipe.h\\\\\
|
||||
\\$(COMPILE) -c \\$<\
|
||||
/^yacc:/ i\\\\\
|
||||
yacc.bat:\\\\\
|
||||
echo "bison\\$(EXEEXT) -y %1 %2 %3 %4 %5 %6 %7 %8 %9" >\\$@\
|
||||
/^bin_SCRIPTS =/s/$/ yacc.bat/\
|
||||
/^MOSTLYCLEANFILES = yacc/s/$/ yacc.bat/\
|
||||
/cross-options.texi:/,/^$/ s|bison|&.exe|g\
|
||||
/^\\.x\\.1:/,/^$/ s|\\$program|&.exe|g\
|
||||
eof_djgpp\
|
||||
sed -f "\$tmp/subs-djgpp.sed" \$tmp/out > \$tmp/out.djgpp\
|
||||
mv -f \$tmp/out.djgpp \$tmp/out
|
||||
}
|
||||
|
||||
# Makefile.in.in is renamed to Makefile.in-in.
|
||||
/ac_config_files=/ {
|
||||
/runtime-po/!s|po/Makefile\.in|&:po/Makefile.in-in|
|
||||
s|runtime-po/Makefile\.in|&:runtime-po/Makefile.in-in|
|
||||
s|javacomp\.sh\.in|javacomp.sh-in|
|
||||
s|javaexec\.sh\.in|javaexec.sh-in|
|
||||
s|doc/yacc\.1|&:doc/yacc.1-in|
|
||||
s|etc/bench.pl|&:etc/bench.pl-in|
|
||||
}
|
||||
|
||||
/CONFIG_FILES=/ {
|
||||
/runtime-po/!s|po/Makefile\.in|&:po/Makefile.in-in|2
|
||||
s|runtime-po/Makefile\.in|&:runtime-po/Makefile.in-in|2
|
||||
s|javacomp\.sh\.in|javacomp.sh-in|
|
||||
s|javaexec\.sh\.in|javaexec.sh-in|
|
||||
s|doc/yacc\.1|&:doc/yacc.1-in|2
|
||||
s|etc/bench\.pl|&:etc/bench.pl-in|2
|
||||
}
|
||||
|
||||
# We always use _deps and _libs instead of .deps and .libs, because
|
||||
# the latter is an invalid name on 8+3 MS-DOS file system. This makes
|
||||
# the generated Makefiles good for every DJGPP installation, not only
|
||||
# the one where the package was configured (which could happen to be
|
||||
# a Windows box, where leading dots in file names are allowed).
|
||||
/^rmdir[ ]*\.tst/ i\
|
||||
am__leading_dot=_
|
||||
|
||||
# Replace (command) > /dev/null with `command > /dev/null`, since
|
||||
# parenthesized commands always return zero status in the ported Bash,
|
||||
# even if the named command doesn't exist
|
||||
/if ([^|;`]*null/{
|
||||
s,(,`,
|
||||
s,),,
|
||||
/null[ ]*2>&1/ s,2>&1,&`,
|
||||
/null.*null/ s,null.*null,&`,
|
||||
/null.*null/ !{
|
||||
/null[ ]*2>&1/ !s,null,&`,
|
||||
}
|
||||
}
|
||||
|
||||
# DOS-style absolute file names should be supported as well
|
||||
/\*) top_srcdir=/s,/\*,[\\\\/]* | ?:[\\\\/]*,
|
||||
|
||||
# The following two items are changes needed for configuring
|
||||
# and compiling across partitions.
|
||||
# 1) The given srcdir value is always translated from the
|
||||
# "x:" syntax into "/dev/x" syntax while we run configure.
|
||||
/^[ ]*-srcdir=\*.*$/ a\
|
||||
ac_optarg=`echo "$ac_optarg" | sed "s,^\\([A-Za-z]\\):,/dev/\\1,"`
|
||||
/set X `ls -Lt \$srcdir/ i\
|
||||
if `echo $srcdir | grep "^/dev/" - > /dev/null`; then\
|
||||
srcdir=`echo "$srcdir" | sed -e "s%^/dev/%%" -e "s%/%:/%"`\
|
||||
fi
|
||||
|
||||
# Autoconf 2.52e generated configure scripts
|
||||
# write absolute paths into Makefiles and bison.in
|
||||
# making them useless for DJGPP installations for
|
||||
# which the package has not been configured for.
|
||||
/MISSING=/,/^$/ {
|
||||
/^fi$/ a\
|
||||
am_missing_run=`echo "$am_missing_run" | sed 's%/dev/.*/bison[-_0-9]\\{1,1\\}[-.0-9A-Za-z+]*%${top_srcdir}%;s%.:.*/bison[-_0-9]\\{1,1\\}[-.0-9A-Za-z+]*%${top_srcdir}%'`
|
||||
}
|
||||
/^install_sh=/a\
|
||||
install_sh=`echo "$install_sh" | sed 's%/dev/.*/bison[-_0-9]\\{1,1\\}[-.0-9A-Za-z+]*%${top_srcdir}%;s%.:.*/bison[-_0-9]\\{1,1\\}[-.0-9A-Za-z+]*%${top_srcdir}%'`
|
||||
|
||||
# This will only work if the assumption that the
|
||||
# testsuite is ran from the following path:
|
||||
# ${top_srcdir}/tests/testsuite.dir
|
||||
# holds. The explicit names are of no importance.
|
||||
# ../../. == ${top_srcdir}
|
||||
#/^esac$/,/^ac_abs_srcdir=/ {
|
||||
/^ac_abs_srcdir=/ i\
|
||||
ac_abs_builddir=`echo "$ac_abs_builddir" | sed "s%/dev/.*/bison[-_0-9]\\{1,1\\}[-.0-9A-Za-z+]*%../../.%;s%.:.*/bison[-_0-9]\\{1,1\\}[-.0-9A-Za-z+]*%../../.%"`\
|
||||
ac_abs_top_builddir=`echo "$ac_abs_top_builddir" | sed "s%/dev/.*/bison[-_0-9]\\{1,1\\}[-.0-9A-Za-z+]*%../../..%;s%.:.*/bison[-_0-9]\\{1,1\\}[-.0-9A-Za-z+]*%../../..%"`\
|
||||
ac_abs_top_srcdir=`echo "$ac_abs_top_srcdir" | sed "s%/dev/.*/bison[-_0-9]\\{1,1\\}[-.0-9A-Za-z+]*%../../..%;s%.:.*/bison[-_0-9]\\{1,1\\}[-.0-9A-Za-z+]*%../../..%"`
|
||||
#ac_abs_srcdir=`echo "$ac_abs_srcdir" | sed "s%/dev/.*/bison[-_0-9]\\{1,1\\}[-.0-9A-Za-z+]*%../../.%;s%.:.*/bison[-_0-9]\\{1,1\\}[-.0-9A-Za-z+]*%../../.%"`
|
||||
/^ac_abs_srcdir=/ a\
|
||||
for dj_dir in $ac_abs_builddir $ac_abs_top_builddir $ac_abs_top_srcdir $ac_abs_srcdir\
|
||||
do\
|
||||
ac_abs_builddir=`echo "$ac_abs_builddir" | sed "s%//%/%g"`\
|
||||
ac_abs_top_builddir=`echo "$ac_abs_top_builddir" | sed "s%//%/%g"`\
|
||||
ac_abs_top_srcdir=`echo "$ac_abs_top_srcdir" | sed "s%//%/%g"`\
|
||||
ac_abs_srcdir=`echo "$ac_abs_srcdir" | sed "s%//%/%g"`\
|
||||
done
|
||||
|
||||
# Add DJGPP version information.
|
||||
/^#define VERSION/ s/\$VERSION/& (DJGPP port (r1))/
|
||||
|
||||
# We need makeinfo to make the html formated docs.
|
||||
/\$am_missing_run[ ]*makeinfo/ s,\$am_missing_run,,
|
||||
|
||||
# The path to the FORTRAN compiler and libraries
|
||||
# shall contain no absolute path reference so it
|
||||
# will be good for all djgpp installations.
|
||||
/^FLIBS="\$ac_cv_flibs"/ i\
|
||||
ac_djgpp_path=`echo "$DJDIR" | sed 's%\\\\\\%/%g' | tr $as_cr_LETTERS $as_cr_letters`\
|
||||
ac_cv_flibs=`echo "$ac_cv_flibs" | sed "s%-L$ac_djgpp_path%-L/dev/env/DJDIR%g"`
|
||||
|
||||
# Autoconf generated configure scripts write absolute
|
||||
# paths of certain header files into Makefiles making
|
||||
# them useless for DJGPP installations for which the
|
||||
# package has not been configured for.
|
||||
/^.*echo "\$as_me:\$LINENO: result: \$gl_cv_absolute_.*$/ {
|
||||
h
|
||||
s,^.*\(gl_cv_absolute_\)\([a-z0-9_]*\)\(_h\).*$,\1\2\3=`echo $\1\2\3 | sed "s%[^:]:.*/include/%/dev/env/DJDIR/include/%"`,
|
||||
G
|
||||
}
|
||||
/^.*echo "\$as_me:\$LINENO: result: \$gl_cv_full_.*$/ {
|
||||
h
|
||||
s,^.*\(gl_cv_full_\)\([a-z0-9_]*\)\(_h\).*$,\1\2\3=`echo $\1\2\3 | sed "s%[^:]:.*/include/%/dev/env/DJDIR/include/%"`,
|
||||
G
|
||||
}
|
||||
|
||||
# The following is not a valid DOS file name
|
||||
s/calc++/calcxx/g
|
||||
|
||||
# The CR test for awk does not work for DJGPP.
|
||||
/^ac_cs_awk_cr=/,/^$/ {
|
||||
/^fi$/ a\
|
||||
ac_cs_awk_cr=$ac_cr
|
||||
}
|
||||
@@ -1,85 +0,0 @@
|
||||
#! /bin/sh
|
||||
|
||||
# This is the config.site file for configuring GNU packages
|
||||
# which are to be built with DJGPP tools.
|
||||
|
||||
# Copyright (C) 2005-2013 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/>.
|
||||
|
||||
|
||||
# Include the djgpp subdirectory in PATH, so that getconf is found
|
||||
PATH="$srcdir/djgpp:$PATH"
|
||||
|
||||
# These two variables are required, otherwise looking for
|
||||
# programs along the PATH will not work.
|
||||
PATH_SEPARATOR=:
|
||||
PATH_EXPAND=y
|
||||
|
||||
# This is required in for "test -f foo" to find foo.exe
|
||||
export TEST_FINDS_EXE=y
|
||||
|
||||
# The root of the DJGPP tree serves as the default prefix
|
||||
test "x$prefix" = xNONE && prefix='/dev/env/DJDIR'
|
||||
|
||||
# This is required for config.status script to be run, since
|
||||
# ./configure runs it by invoking ${CONFIG_SHELL-/bin/sh}
|
||||
CONFIG_SHELL=${CONFIG_SHELL='sh'}
|
||||
|
||||
# These are set here so the generated Makefile's will be good
|
||||
# for every DJGPP installation, not only the one where the
|
||||
# package was configured.
|
||||
# $INSTALL must be an absolute path name, otherwise config.status
|
||||
# will try to prepend ./ and ../ to it when it goes into subdirs.
|
||||
INSTALL=${INSTALL='/dev/env/DJDIR/bin/ginstall -c'}
|
||||
RANLIB=${RANLIB='ranlib'}
|
||||
GMSGFMT=${GMSGFMT='/dev/env/DJDIR/bin/msgfmt'}
|
||||
MSGFMT=${MSGFMT='/dev/env/DJDIR/bin/msgfmt'}
|
||||
XGETTEXT=${XGETTEXT='/dev/env/DJDIR/bin/xgettext'}
|
||||
AWK=${AWK='gawk'}
|
||||
|
||||
# A sane default for emacs.
|
||||
ac_cv_path_EMACS=${EMACS='/dev/env/DJDIR/gnu/emacs/bin/emacs'}
|
||||
|
||||
# A sane default for m4.
|
||||
ac_cv_path_M4=${M4='/dev/env/DJDIR/bin/m4'}
|
||||
|
||||
# A sane default for grep.
|
||||
ac_cv_path_GREP=${GREP='/dev/env/DJDIR/bin/grep'}
|
||||
|
||||
# A sane default for egrep.
|
||||
ac_cv_path_EGREP=${EGREP='/dev/env/DJDIR/bin/egrep'}
|
||||
|
||||
# A sane default for fgrep.
|
||||
ac_cv_path_FGREP=${FGREP='/dev/env/DJDIR/bin/fgrep'}
|
||||
|
||||
# A sane default for sed.
|
||||
ac_cv_path_SED=${SED='/dev/env/DJDIR/bin/sed'}
|
||||
|
||||
# A sane default for mkdir.
|
||||
ac_cv_path_mkdir=${MKDIR_P='/dev/env/DJDIR/bin/mkdir -p'}
|
||||
|
||||
# These are set here so the generated libtool will be good
|
||||
# for every DJGPP installation, not only the one where the
|
||||
# package was configured.
|
||||
NM=${NM='nm'}
|
||||
LD=${LD='ld'}
|
||||
|
||||
# Force the test for 'ln -s' to report 'cp -pf'.
|
||||
ac_cv_prog_LN_S='cp -pf'
|
||||
|
||||
# There is no fork and vfork functionality.
|
||||
ac_cv_func_fork=no
|
||||
ac_cv_func_vfork=no
|
||||
ac_cv_func_pipe=no
|
||||
@@ -1,87 +0,0 @@
|
||||
@echo off
|
||||
Rem
|
||||
Rem WARNING WARNING WARNING: This file needs to have DOS CRLF end-of-line
|
||||
Rem format, or else stock DOS/Windows shells will refuse to run it.
|
||||
Rem
|
||||
Rem This batch file unpacks the Bison distribution while simultaneously
|
||||
Rem renaming some of the files whose names are invalid on DOS or conflict
|
||||
Rem with other file names after truncation to DOS 8+3 namespace.
|
||||
Rem
|
||||
Rem Copyright (C) 2005-2013 Free Software Foundation, Inc.
|
||||
Rem
|
||||
Rem This program is free software: you can redistribute it and/or modify
|
||||
Rem it under the terms of the GNU General Public License as published by
|
||||
Rem the Free Software Foundation, either version 3 of the License, or
|
||||
Rem (at your option) any later version.
|
||||
Rem
|
||||
Rem This program is distributed in the hope that it will be useful,
|
||||
Rem but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
Rem MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
Rem GNU General Public License for more details.
|
||||
Rem
|
||||
Rem You should have received a copy of the GNU General Public License
|
||||
Rem along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
Rem
|
||||
Rem
|
||||
Rem Invoke like this:
|
||||
Rem
|
||||
Rem djunpack bison-XYZ.tar.gz
|
||||
Rem or
|
||||
Rem djunpack bison-XYZ.tar.bz2
|
||||
Rem
|
||||
Rem where XYZ is the version number. If the argument includes leading
|
||||
Rem directories, it MUST use backslashes, not forward slashes.
|
||||
Rem
|
||||
|
||||
set ENVIRONMENT_SIZE_TEST_STRING=ENVIRONMENT_SIZE_TEST_STRING
|
||||
if "%ENVIRONMENT_SIZE_TEST_STRING%"=="ENVIRONMENT_SIZE_TEST_STRING" GoTo EnvOk
|
||||
Rem If their environment space is too small, re-exec with a larger one
|
||||
command.com /e:4096 /c %0 %1
|
||||
GoTo End
|
||||
|
||||
:EnvOk
|
||||
set ENVIRONMENT_SIZE_TEST_STRING=
|
||||
if "%1" == "" GoTo NoArgument
|
||||
if not exist %1 GoTo NoArchive
|
||||
Rem Extract top src dir from archive file.
|
||||
djtar -t %1 > top_src.dir
|
||||
Rem The following uses a feature of COPY whereby it does not copy
|
||||
Rem empty files. We need that because the previous line will create
|
||||
Rem an empty fnchange.tmp even if the command failed for some reason.
|
||||
copy top_src.dir junk.tmp > nul
|
||||
if not exist junk.tmp GoTo NoDjTar
|
||||
del junk.tmp
|
||||
sed "1{s/^.*bison-/djtar -x -p -o bison-/;s|$|djgpp/fnchange.lst %%1 > fnchange.tmp|};2,$d" top_src.dir > ext_list.bat
|
||||
Rem See the comment above about the reason for using COPY.
|
||||
copy ext_list.bat junk.tmp > nul
|
||||
if not exist junk.tmp GoTo NoSed
|
||||
del junk.tmp
|
||||
Rem Extract fnchange.lst from archive.
|
||||
call ext_list.bat %1
|
||||
del ext_list.bat
|
||||
sed "1{s|^.*bison-|s/@V@/bison-|;s|$|g|};2,$d" top_src.dir > version.sed
|
||||
sed -f version.sed < fnchange.tmp > fnchange.lst
|
||||
del version.sed
|
||||
del fnchange.tmp
|
||||
del top_src.dir
|
||||
Rem unpack the source distribution
|
||||
djtar -x -n fnchange.lst %1
|
||||
del fnchange.lst
|
||||
GoTo End
|
||||
|
||||
:NoSed
|
||||
del junk.tmp
|
||||
echo FAIL: Sed is not available.
|
||||
GoTo End
|
||||
:NoDjTar
|
||||
del junk.tmp
|
||||
echo FAIL: DJTAR is not available or no fnchange.lst file in %1.
|
||||
GoTo End
|
||||
:NoArchive
|
||||
echo FAIL: the file %1 does not seem to exist.
|
||||
echo Remember that %1 cannot use forward slashes, only backslashes.
|
||||
GoTo End
|
||||
:NoArgument
|
||||
echo FAIL: no archive file has been specified.
|
||||
echo Remember that the file name cannot use forward slashes, only backslashes.
|
||||
:End
|
||||
@@ -1,27 +0,0 @@
|
||||
@V@/build-aux/javacomp.sh.in @V@/build-aux/javacomp.sh-in
|
||||
@V@/build-aux/javaexec.sh.in @V@/build-aux/javaexec.sh-in
|
||||
@V@/data/c++-skel.m4 @V@/data/cxx-skel.m4
|
||||
@V@/data/c++.m4 @V@/data/cxx.m4
|
||||
@V@/doc/yacc.1.in @V@/doc/yacc.1-in
|
||||
@V@/etc/bench.pl.in @V@/etc/bench.pl-in
|
||||
@V@/examples/calc++/ @V@/examples/calcxx/
|
||||
@V@/examples/calc++/Makefile.am @V@/examples/calcxx/Makefile.am
|
||||
@V@/examples/calc++/Makefile.in @V@/examples/calcxx/Makefile.in
|
||||
@V@/examples/calc++/calc++-scanner.cc @V@/examples/calcxx/calcxx-scanner.cc
|
||||
@V@/examples/calc++/calc++-scanner.ll @V@/examples/calcxx/calcxx-scanner.ll
|
||||
@V@/examples/calc++/calc++.cc @V@/examples/calcxx/calcxx.cc
|
||||
@V@/examples/calc++/calc++-driver.hh @V@/examples/calcxx/calcxx-driver.hh
|
||||
@V@/examples/calc++/calc++-driver.cc @V@/examples/calcxx/calcxx-driver.cc
|
||||
@V@/examples/calc++/stack.hh @V@/examples/calcxx/stack.hh
|
||||
@V@/examples/calc++/position.hh @V@/examples/calcxx/position.hh
|
||||
@V@/examples/calc++/location.hh @V@/examples/calcxx/location.hh
|
||||
@V@/examples/calc++/calc++-parser.hh @V@/examples/calcxx/calcxx-parser.hh
|
||||
@V@/examples/calc++/calc++-parser.cc @V@/examples/calcxx/calcxx-parser.cc
|
||||
@V@/examples/calc++/calc++-parser.stamp @V@/examples/calcxx/calcxx-parser.stamp
|
||||
@V@/examples/calc++/calc++-parser.yy @V@/examples/calcxx/calcxx-parser.yy
|
||||
@V@/examples/calc++/test @V@/examples/calcxx/test
|
||||
@V@/po/Makefile.in.in @V@/po/Makefile.in-in
|
||||
@V@/runtime-po/Makefile.in.in @V@/runtime-po/Makefile.in-in
|
||||
@V@/src/scan-gram-c.c @V@/src/c-scan-gram.c
|
||||
@V@/src/scan-skel-c.c @V@/src/c-scan-skel.c
|
||||
@V@/tests/c++.at @V@/tests/cxx.at
|
||||
-293
@@ -1,293 +0,0 @@
|
||||
/* Subprocesses with pipes.
|
||||
|
||||
Copyright (C) 2005-2013 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/>. */
|
||||
|
||||
/* Written by Juan Manuel Guerrero <[email protected]>. */
|
||||
|
||||
|
||||
#include <config.h>
|
||||
|
||||
#include "subpipe.h"
|
||||
|
||||
#include <errno.h>
|
||||
#include <fcntl.h>
|
||||
#include <sys/stat.h>
|
||||
#include <process.h>
|
||||
#include <signal.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
#include "xalloc.h"
|
||||
|
||||
|
||||
#ifndef STDIN_FILENO
|
||||
# define STDIN_FILENO 0
|
||||
#endif
|
||||
#ifndef STDOUT_FILENO
|
||||
# define STDOUT_FILENO 1
|
||||
#endif
|
||||
|
||||
|
||||
#include "error.h"
|
||||
|
||||
#include "gettext.h"
|
||||
#define _(Msgid) gettext (Msgid)
|
||||
|
||||
|
||||
/* Initialize this module. */
|
||||
|
||||
|
||||
static int old_stdin;
|
||||
static int old_stdout;
|
||||
static char **arguments;
|
||||
static char tmp_file_name[2][L_tmpnam];
|
||||
|
||||
#define remove_tmp_file(fd, name) \
|
||||
do { \
|
||||
close ((fd)); \
|
||||
if (unlink ((name))) \
|
||||
error (EXIT_FAILURE, 0, _("removing of '%s' failed"), (name)); \
|
||||
} while (0)
|
||||
|
||||
|
||||
void
|
||||
init_subpipe(void)
|
||||
{
|
||||
char *tmpdir;
|
||||
int fd;
|
||||
|
||||
tmpdir = getenv("TMPDIR");
|
||||
if (tmpdir == NULL)
|
||||
tmpdir = getenv("TMP");
|
||||
if (tmpdir == NULL)
|
||||
tmpdir = getenv("TEMP");
|
||||
if (access(tmpdir, D_OK))
|
||||
tmpdir = ".";
|
||||
|
||||
strcpy(tmp_file_name[0], tmpdir);
|
||||
strcat(tmp_file_name[0], "/bnXXXXXX");
|
||||
fd = mkstemp(tmp_file_name[0]);
|
||||
if (fd < 0)
|
||||
error(EXIT_FAILURE, 0, _("creation of a temporary file failed"));
|
||||
close (fd);
|
||||
|
||||
strcpy(tmp_file_name[1], tmpdir);
|
||||
strcat(tmp_file_name[1], "/bnXXXXXX");
|
||||
fd = mkstemp(tmp_file_name[1]);
|
||||
if (fd < 0)
|
||||
error(EXIT_FAILURE, 0, _("creation of a temporary file failed"));
|
||||
close (fd);
|
||||
}
|
||||
|
||||
|
||||
/* Create a subprocess that is run as a filter. ARGV is the
|
||||
NULL-terminated argument vector for the subprocess. Store read and
|
||||
write file descriptors for communication with the subprocess into
|
||||
FD[0] and FD[1]: input meant for the process can be written into
|
||||
FD[0], and output from the process can be read from FD[1]. Return
|
||||
the subprocess id.
|
||||
|
||||
Because DOS has neither fork nor pipe functionality to run the subprocess
|
||||
as a filter, the filter is reproduced using temporary files. First bison's
|
||||
stdout is redirected to a temporary file. After bison has produced all of
|
||||
is output, this file is closed and connected to m4's stdin. All m4's output
|
||||
is redirected from m4's stdout to a second temporary file and reopened as
|
||||
bison's stdin. */
|
||||
|
||||
pid_t
|
||||
create_subpipe(char const *const *argv, int fd[2])
|
||||
{
|
||||
int argc;
|
||||
int from_in_fd; /* pipe from bison to m4. */
|
||||
pid_t pid;
|
||||
|
||||
|
||||
pid = getpid();
|
||||
|
||||
/*
|
||||
* Save original stdin and stdout
|
||||
* for later restauration.
|
||||
*/
|
||||
old_stdin = dup(STDIN_FILENO);
|
||||
if (old_stdin < 0)
|
||||
error(EXIT_FAILURE, 0, _("saving stdin failed"));
|
||||
|
||||
old_stdout = dup(STDOUT_FILENO);
|
||||
if (old_stdout < 0)
|
||||
error(EXIT_FAILURE, 0, _("saving stdout failed"));
|
||||
|
||||
/*
|
||||
* Save argv for later use.
|
||||
*/
|
||||
for (argc = 0; argv[argc]; argc++)
|
||||
;
|
||||
argc++;
|
||||
arguments = xmalloc(argc * sizeof(arguments[0]));
|
||||
for (argc = 0; argv[argc]; argc++)
|
||||
{
|
||||
arguments[argc] = xmalloc((strlen(argv[argc]) + 1) * sizeof(arguments[0][0]));
|
||||
strcpy(arguments[argc], argv[argc]);
|
||||
}
|
||||
arguments[argc] = NULL;
|
||||
|
||||
/*
|
||||
* All bison's output will be gathered in this temporary file
|
||||
* and will be redirected to m4's stdin.
|
||||
*/
|
||||
from_in_fd = open(tmp_file_name[0], O_WRONLY | O_CREAT | O_TRUNC, S_IWUSR);
|
||||
if (from_in_fd < 0)
|
||||
error(EXIT_FAILURE, 0, _("opening of tmpfile failed"));
|
||||
if (dup2(from_in_fd, STDOUT_FILENO) < 0)
|
||||
{
|
||||
remove_tmp_file(from_in_fd, tmp_file_name[0]);
|
||||
error(EXIT_FAILURE, 0, _("redirecting bison's stdout to the temporary file failed"));
|
||||
}
|
||||
close(from_in_fd);
|
||||
|
||||
|
||||
fd[0] = STDOUT_FILENO;
|
||||
return pid;
|
||||
}
|
||||
|
||||
|
||||
/* A signal handler that just records that a signal has happened. */
|
||||
static int child_interrupted;
|
||||
|
||||
static void
|
||||
signal_catcher(int signo)
|
||||
{
|
||||
child_interrupted++;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
end_of_output_subpipe(pid_t pid, int fd[2])
|
||||
{
|
||||
char *program;
|
||||
int from_out_fd = open(tmp_file_name[0], O_RDONLY, S_IRUSR); /* pipe from bison to m4. */
|
||||
int to_in_fd = open(tmp_file_name[1], O_WRONLY | O_CREAT | O_TRUNC, S_IWUSR); /* pipe from m4 to bison. */
|
||||
int status;
|
||||
void (*previous_handler)(int);
|
||||
|
||||
|
||||
program = strrchr(arguments[0], '/');
|
||||
if (program)
|
||||
program++;
|
||||
else
|
||||
program = arguments[0];
|
||||
|
||||
/*
|
||||
* Redirect bison's output to m4's stdin.
|
||||
*/
|
||||
if (from_out_fd < 0)
|
||||
error(EXIT_FAILURE, 0, _("opening of tmpfile failed"));
|
||||
if (dup2(from_out_fd, STDIN_FILENO) < 0)
|
||||
{
|
||||
remove_tmp_file(from_out_fd, tmp_file_name[0]);
|
||||
error(EXIT_FAILURE, 0, _("redirecting m4's stdin from the temporary file failed"));
|
||||
}
|
||||
close(from_out_fd);
|
||||
|
||||
/*
|
||||
* All m4's output will be gathered in this temporary file
|
||||
* and will be redirected to bison's stdin.
|
||||
*/
|
||||
if (to_in_fd < 0)
|
||||
{
|
||||
remove_tmp_file(STDIN_FILENO, tmp_file_name[0]);
|
||||
error(EXIT_FAILURE, 0, _("opening of a temporary file failed"));
|
||||
}
|
||||
if (dup2(to_in_fd, STDOUT_FILENO) < 0)
|
||||
{
|
||||
remove_tmp_file(STDIN_FILENO, tmp_file_name[0]);
|
||||
remove_tmp_file(to_in_fd, tmp_file_name[1]);
|
||||
error(EXIT_FAILURE, 0, _("redirecting m4's stdout to a temporary file failed"));
|
||||
}
|
||||
close(to_in_fd);
|
||||
|
||||
/*
|
||||
* Run m4.
|
||||
*/
|
||||
child_interrupted = 0;
|
||||
errno = 0;
|
||||
previous_handler = signal(SIGINT, signal_catcher);
|
||||
status = spawnvp(P_WAIT, program, arguments);
|
||||
signal(SIGINT, previous_handler);
|
||||
if (child_interrupted)
|
||||
{
|
||||
remove_tmp_file(STDIN_FILENO, tmp_file_name[0]);
|
||||
remove_tmp_file(STDOUT_FILENO, tmp_file_name[1]);
|
||||
error(EXIT_FAILURE, 0, _("subsidiary program '%s' interrupted"), program);
|
||||
}
|
||||
if (status)
|
||||
{
|
||||
remove_tmp_file(STDIN_FILENO, tmp_file_name[0]);
|
||||
remove_tmp_file(STDOUT_FILENO, tmp_file_name[1]);
|
||||
error(EXIT_FAILURE, 0, _(errno == ENOENT
|
||||
? "subsidiary program '%s' not found"
|
||||
: status < 1
|
||||
? "subsidiary program '%s' failed"
|
||||
: "subsidiary program '%s' failed (status=%i, errno=%i)"), program, status, errno);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Redirect m4's output to bison's stdin.
|
||||
*/
|
||||
if (dup2(old_stdout, STDOUT_FILENO) < 0)
|
||||
error(EXIT_FAILURE, 0, "restore of bison's stdout failed");
|
||||
close(old_stdout);
|
||||
to_in_fd = open(tmp_file_name[1], O_RDONLY, S_IRUSR); /* pipe from m4 to bison. */
|
||||
if (to_in_fd < 0)
|
||||
{
|
||||
remove_tmp_file(STDIN_FILENO, tmp_file_name[0]);
|
||||
error(EXIT_FAILURE, 0, _("opening of tmpfile failed"));
|
||||
}
|
||||
if (dup2(to_in_fd, STDIN_FILENO) < 0)
|
||||
{
|
||||
remove_tmp_file(STDIN_FILENO, tmp_file_name[0]);
|
||||
remove_tmp_file(to_in_fd, tmp_file_name[1]);
|
||||
error(EXIT_FAILURE, -1, "dup2");
|
||||
error(EXIT_FAILURE, 0, _("redirecting bison's stdin from the temporary file failed"));
|
||||
}
|
||||
close(to_in_fd);
|
||||
|
||||
|
||||
fd[1] = STDIN_FILENO;
|
||||
}
|
||||
|
||||
|
||||
/* Free resources, unlink temporary files and restore stdin and stdout. */
|
||||
|
||||
void
|
||||
reap_subpipe(pid_t pid, char const *program)
|
||||
{
|
||||
int argc;
|
||||
|
||||
for (argc = 0; arguments[argc]; argc++)
|
||||
free(arguments[argc]);
|
||||
free(arguments);
|
||||
|
||||
if (unlink(tmp_file_name[0]))
|
||||
error(EXIT_FAILURE, 0, _("removing of '%s' failed"), tmp_file_name[0]);
|
||||
if (unlink(tmp_file_name[1]))
|
||||
error(EXIT_FAILURE, 0, _("removing of '%s' failed"), tmp_file_name[1]);
|
||||
|
||||
if (dup2(old_stdin, STDIN_FILENO) < 0)
|
||||
error(EXIT_FAILURE, 0, "restore of bison's stdin failed");
|
||||
close(old_stdin);
|
||||
}
|
||||
@@ -1,27 +0,0 @@
|
||||
/* Subprocesses with pipes.
|
||||
|
||||
Copyright (C) 2005-2013 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/>. */
|
||||
|
||||
/* Written by Juan Manuel Guerrero <[email protected]>. */
|
||||
|
||||
#if HAVE_SYS_TYPES_H
|
||||
# include <sys/types.h>
|
||||
#endif
|
||||
|
||||
void init_subpipe(void);
|
||||
pid_t create_subpipe(char const * const *, int[2]);
|
||||
void end_of_output_subpipe(pid_t, int[2]);
|
||||
void reap_subpipe(pid_t, char const *);
|
||||
+13
-9
@@ -1,25 +1,28 @@
|
||||
# Do not ignore these. The release procedure (web-manual-update)
|
||||
# works in the src tree (even when run from the build tree) and leaves
|
||||
# these files around. Since they take precedence over the files in
|
||||
# the build tree, locally built manuals use obsolete auxiliary files.
|
||||
#
|
||||
# So don't hide them, give the maintainer a chance to clean them.
|
||||
#/bison.aux
|
||||
#/bison.cp
|
||||
#/bison.cps
|
||||
#/bison.toc
|
||||
|
||||
/*~
|
||||
/.dirstamp
|
||||
/bison.1
|
||||
/bison.aux
|
||||
/bison.cp
|
||||
/bison.cps
|
||||
/bison.dvi
|
||||
/bison.fn
|
||||
/bison.help
|
||||
/bison.html
|
||||
/bison.info
|
||||
/bison.ky
|
||||
/bison.log
|
||||
/bison.pdf
|
||||
/bison.pg
|
||||
/bison.ps
|
||||
/bison.toc
|
||||
/bison.tp
|
||||
/bison.vr
|
||||
/cross-options.texi
|
||||
/fdl.texi
|
||||
/gendocs_template
|
||||
/gendocs_template_min
|
||||
/gpl-3.0.texi
|
||||
/refcard.dvi
|
||||
/refcard.log
|
||||
@@ -27,3 +30,4 @@
|
||||
/stamp-vti
|
||||
/version.texi
|
||||
/yacc.1
|
||||
/relocatable.texi
|
||||
|
||||
+1406
-961
File diff suppressed because it is too large
Load Diff
+2365
-1250
File diff suppressed because it is too large
Load Diff
@@ -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!
|
||||
+56
-37
@@ -1,4 +1,5 @@
|
||||
## Copyright (C) 2001-2003, 2005-2013 Free Software Foundation, Inc.
|
||||
## Copyright (C) 2001-2003, 2005-2015, 2018-2019 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
|
||||
@@ -13,26 +14,31 @@
|
||||
## You should have received a copy of the GNU General Public License
|
||||
## along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
AM_MAKEINFOFLAGS = --no-split
|
||||
AM_MAKEINFOFLAGS = \
|
||||
--no-split \
|
||||
--set-customization-variable=SECTION_NAME_IN_TITLE=true \
|
||||
--set-customization-variable=AVOID_MENU_REDUNDANCY=true \
|
||||
--set-customization-variable=ICONS=true
|
||||
|
||||
info_TEXINFOS = doc/bison.texi
|
||||
doc_bison_TEXINFOS = \
|
||||
$(CROSS_OPTIONS_TEXI) \
|
||||
doc/fdl.texi \
|
||||
doc/gpl-3.0.texi
|
||||
doc/gpl-3.0.texi \
|
||||
doc/relocatable.texi
|
||||
|
||||
# Cannot express dependencies directly on file names because of Automake.
|
||||
# Obfuscate with a variable.
|
||||
doc_bison = doc/bison
|
||||
$(doc_bison).dvi: $(FIGS_DOT:.dot=.eps)
|
||||
$(doc_bison).pdf: $(FIGS_DOT:.dot=.pdf)
|
||||
$(doc_bison).html: $(FIGS_DOT:.dot=.png)
|
||||
$(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=.svg)
|
||||
|
||||
TEXI2DVI = texi2dvi --build-dir=doc/bison.t2d -I doc
|
||||
CLEANDIRS = doc/bison.t2d
|
||||
clean-local:
|
||||
rm -rf $(CLEANDIRS)
|
||||
CLEANDIRS += doc/bison.t2d
|
||||
|
||||
MOSTLYCLEANFILES += $(top_srcdir)/doc/*.t
|
||||
MOSTLYCLEANFILES += $(top_srcdir)/doc/*.tmp
|
||||
|
||||
CROSS_OPTIONS_PL = $(top_srcdir)/build-aux/cross-options.pl
|
||||
CROSS_OPTIONS_TEXI = $(top_srcdir)/doc/cross-options.texi
|
||||
@@ -42,8 +48,8 @@ $(CROSS_OPTIONS_TEXI): doc/bison.help $(CROSS_OPTIONS_PL)
|
||||
# diff in the next run. Note that $@ might not exist yet.
|
||||
$(AM_V_GEN){ test ! -f $@ || cat $@; } >$@~
|
||||
$(AM_V_at)test ! -f $@.tmp || rm -f $@.tmp
|
||||
$(AM_V_at)src/bison$(EXEEXT) --help | \
|
||||
$(PERL) $(CROSS_OPTIONS_PL) $(top_srcdir)/src/scan-gram.l >$@.tmp
|
||||
$(AM_V_at)$(PERL) $(CROSS_OPTIONS_PL) $(top_srcdir)/src/scan-gram.l \
|
||||
<$(top_srcdir)/doc/bison.help >$@.tmp
|
||||
$(AM_V_at)diff -u $@~ $@.tmp || true
|
||||
$(AM_V_at)mv $@.tmp $@
|
||||
MAINTAINERCLEANFILES = $(CROSS_OPTIONS_TEXI)
|
||||
@@ -64,9 +70,9 @@ doc/refcard.pdf: doc/refcard.tex
|
||||
## doc/bison.help. ##
|
||||
## ---------------- ##
|
||||
|
||||
# Some of our targets (cross-option.texi, bison.1) use "bison --help".
|
||||
# Some of our targets (cross-options.texi, bison.1) use "bison --help".
|
||||
# Since we want to ship the generated file to avoid additional
|
||||
# requirements over the user environment, we used not depend on
|
||||
# requirements over the user environment, we used to not depend on
|
||||
# src/bison itself, but on src/getargs.c and other files. Yet, we
|
||||
# need "bison --help" to work to make help2man happy, so we used to
|
||||
# include "make src/bison" in the commands. Then we may have a
|
||||
@@ -80,15 +86,22 @@ doc/refcard.pdf: doc/refcard.tex
|
||||
# bison.help, which contains --version then --help. This file can
|
||||
# depend on bison, which ensures its correctness. But update it
|
||||
# *only* if needed (content changes). This way, we avoid useless
|
||||
# compilations of cross-option.texi and bison.1. At the cost of
|
||||
# compilations of cross-options.texi and bison.1. At the cost of
|
||||
# repeated builds of bison.help.
|
||||
|
||||
EXTRA_DIST += $(top_srcdir)/doc/bison.help
|
||||
if ! CROSS_COMPILING
|
||||
MAINTAINERCLEANFILES += $(top_srcdir)/doc/bison.help
|
||||
$(top_srcdir)/doc/bison.help: src/bison$(EXEEXT)
|
||||
$(AM_V_GEN)src/bison$(EXEEXT) --version >doc/bison.help.tmp
|
||||
$(AM_V_at) src/bison$(EXEEXT) --help >>doc/bison.help.tmp
|
||||
$(AM_V_GEN)LC_ALL=C tests/bison --version >doc/bison.help.tmp
|
||||
$(AM_V_at) LC_ALL=C tests/bison --help | \
|
||||
## Avoid depending on the path to Bison.
|
||||
sed -e 's,^Usage: .*/bison \[OPTION\],Usage: bison [OPTION],g' \
|
||||
## Avoid variations in the output depending on whether we are
|
||||
## on a glibc system.
|
||||
-e '/translation bugs/d' >>doc/bison.help.tmp
|
||||
$(AM_V_at)$(top_srcdir)/build-aux/move-if-change doc/bison.help.tmp $@
|
||||
endif ! CROSS_COMPILING
|
||||
|
||||
|
||||
## ----------- ##
|
||||
@@ -105,46 +118,52 @@ remove_time_stamp = \
|
||||
sed 's/^\(\.TH[^"]*"[^"]*"[^"]*\)"[^"]*"/\1/'
|
||||
|
||||
# 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) \
|
||||
--include=$(top_srcdir)/doc/bison.x \
|
||||
--output=$@.t src/bison$(EXEEXT)
|
||||
$(AM_V_at)if $(remove_time_stamp) $@ >$@a.t 2>/dev/null && \
|
||||
$(remove_time_stamp) $@.t | cmp $@a.t - >/dev/null 2>&1; then \
|
||||
touch $@; \
|
||||
else \
|
||||
mv $@.t $@; \
|
||||
--output=$@.tmp tests/bison
|
||||
$(AM_V_at)if $(remove_time_stamp) $@ >$@a.tmp 2>/dev/null && \
|
||||
$(remove_time_stamp) $@.tmp | cmp $@a.tmp - >/dev/null 2>&1; then \
|
||||
touch $@; \
|
||||
else \
|
||||
mv $@.tmp $@; \
|
||||
fi
|
||||
$(AM_V_at)rm -f $@*.t
|
||||
$(AM_V_at)rm -f $@*.tmp
|
||||
|
||||
if ENABLE_YACC
|
||||
nodist_man_MANS = doc/yacc.1
|
||||
endif
|
||||
|
||||
## ----------------------------- ##
|
||||
## Graphviz examples generation. ##
|
||||
## ----------------------------- ##
|
||||
|
||||
CLEANDIRS += doc/figs
|
||||
FIGS_DOT = \
|
||||
doc/figs/example.dot \
|
||||
doc/figs/example-reduce.dot doc/figs/example-shift.dot
|
||||
EXTRA_DIST += \
|
||||
$(FIGS_DOT) \
|
||||
$(FIGS_DOT:.dot=.eps) $(FIGS_DOT:.dot=.pdf) $(FIGS_DOT:.dot=.png)
|
||||
SUFFIXES += .dot .eps .pdf .png
|
||||
CLEANFILES += $(FIGS_GV:.gv=.eps) $(FIGS_GV:.gv=.pdf) $(FIGS_GV:.gv=.svg)
|
||||
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=.svg)
|
||||
SUFFIXES += .gv .eps .pdf .svg
|
||||
|
||||
.dot.eps:
|
||||
.gv.eps:
|
||||
$(AM_V_GEN) $(MKDIR_P) `echo "./$@" | sed -e 's,/[^/]*$$,,'`
|
||||
$(AM_V_at) $(DOT) -Gmargin=0 -Teps $< >$@.tmp
|
||||
$(AM_V_at) mv $@.tmp $@
|
||||
|
||||
.dot.pdf:
|
||||
.gv.pdf:
|
||||
$(AM_V_GEN) $(MKDIR_P) `echo "./$@" | sed -e 's,/[^/]*$$,,'`
|
||||
$(AM_V_at) $(DOT) -Gmargin=0 -Tpdf $< >$@.tmp
|
||||
$(AM_V_at) mv $@.tmp $@
|
||||
|
||||
.dot.png:
|
||||
.gv.svg:
|
||||
$(AM_V_GEN) $(MKDIR_P) `echo "./$@" | sed -e 's,/[^/]*$$,,'`
|
||||
$(AM_V_at) $(DOT) -Gmargin=0 -Tpng $< >$@.tmp
|
||||
$(AM_V_at) $(DOT) -Gmargin=0 -Tsvg $< >$@.tmp
|
||||
$(AM_V_at) mv $@.tmp $@
|
||||
|
||||
## -------------- ##
|
||||
|
||||
+9
-8
@@ -19,7 +19,8 @@
|
||||
\def\finalout{\overfullrule=0pt}
|
||||
%\finalout
|
||||
|
||||
% Copyright (c) 1998, 2001, 2009-2013 Free Software Foundation, Inc.
|
||||
% Copyright (c) 1998, 2001, 2009-2015, 2018-2019 Free Software
|
||||
% Foundation, Inc.
|
||||
%
|
||||
% This file is part of Bison.
|
||||
%
|
||||
@@ -357,7 +358,7 @@ otherwise it will have the format {\tt {\it name}.tab.h}, where
|
||||
|
||||
In the above, {\it t} is a {\it type} defined in the {\tt \%union}
|
||||
definition, {\it n} is a {\it terminal} symbol name, {\it m} is a
|
||||
{\it non-terminal} symbol name, and {\it association} can be one of
|
||||
{\it nonterminal} symbol name, and {\it association} can be one of
|
||||
{\tt \%left}, {\tt \%right}, or {\tt \%nonassoc}.
|
||||
|
||||
\vskip .10truein
|
||||
@@ -400,16 +401,16 @@ Rules take the form:
|
||||
|
||||
\vskip -\baselineskip
|
||||
\beginexample
|
||||
non-terminal : {\it statement} 1
|
||||
| {\it statement} 2
|
||||
\vdots
|
||||
| {\it statement n}
|
||||
;
|
||||
nonterminal : {\it statement} 1
|
||||
| {\it statement} 2
|
||||
\vdots
|
||||
| {\it statement n}
|
||||
;
|
||||
\endexample
|
||||
|
||||
Where {\it statements} can be either empty, or contain
|
||||
a mixture of C code (enclosed in {\tt \{...\}}), and the
|
||||
symbols that make up the non-terminal. For example:
|
||||
symbols that make up the nonterminal. For example:
|
||||
|
||||
\vskip -\baselineskip
|
||||
\beginexample
|
||||
|
||||
+1
-1
@@ -16,7 +16,7 @@ straightforward use of _build/src/bison would.)
|
||||
|
||||
--
|
||||
|
||||
Copyright (C) 2006, 2009-2013 Free Software Foundation, Inc.
|
||||
Copyright (C) 2006, 2009-2015, 2018-2019 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of Bison, the GNU Compiler Compiler.
|
||||
|
||||
|
||||
+4
-3
@@ -1,6 +1,7 @@
|
||||
#! /usr/bin/perl -w
|
||||
|
||||
# Copyright (C) 2006, 2008-2013 Free Software Foundation, Inc.
|
||||
# Copyright (C) 2006, 2008-2015, 2018-2019 Free Software Foundation,
|
||||
# Inc.
|
||||
#
|
||||
# This file is part of Bison, the GNU Compiler Compiler.
|
||||
#
|
||||
@@ -53,7 +54,7 @@ will generate eight different cases.
|
||||
|
||||
=item B<-b>, B<--bench>
|
||||
|
||||
Predefined benches, that is, combimation between a grammar and a I<directives>
|
||||
Predefined benches, that is, combination between a grammar and a I<directives>
|
||||
request.
|
||||
|
||||
=over 4
|
||||
@@ -738,7 +739,7 @@ yy::parser::token_type yylex(yy::parser::semantic_type* yylvalp,
|
||||
void
|
||||
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[])
|
||||
|
||||
+2
-1
@@ -1,4 +1,5 @@
|
||||
## Copyright (C) 2006, 2008-2013 Free Software Foundation, Inc.
|
||||
## Copyright (C) 2006, 2008-2015, 2018-2019 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
|
||||
|
||||
@@ -0,0 +1,28 @@
|
||||
This directory contains examples of Bison grammar files, sorted per
|
||||
language.
|
||||
|
||||
Several of them come from the documentation, which should be installed
|
||||
together with Bison. The URLs are provided for convenience.
|
||||
|
||||
These examples come with a README and a Makefile. Not only can they be used
|
||||
to toy with Bison, they can also be starting points for your own grammars.
|
||||
|
||||
Please, be sure to read the C examples before looking at the other
|
||||
languages, as these examples are simpler.
|
||||
|
||||
<!---
|
||||
|
||||
Local Variables:
|
||||
fill-column: 76
|
||||
ispell-dictionary: "american"
|
||||
End:
|
||||
|
||||
Copyright (C) 2018-2019 Free Software Foundation, Inc.
|
||||
|
||||
Permission is granted to copy, distribute and/or modify this document
|
||||
under the terms of the GNU Free Documentation License, Version 1.3 or
|
||||
any later version published by the Free Software Foundation; with no
|
||||
Invariant Sections, with no Front-Cover Texts, and with no Back-Cover
|
||||
Texts. A copy of the license is included in the "GNU Free
|
||||
Documentation License" file as part of this distribution.
|
||||
--->
|
||||
@@ -0,0 +1,21 @@
|
||||
# This Makefile is designed to be simple and readable. It does not
|
||||
# aim at portability. It requires GNU Make.
|
||||
|
||||
BISON = bison
|
||||
CXX = g++
|
||||
CXXFLAGS =
|
||||
PROGS = simple variant variant-11
|
||||
|
||||
simple: CXXFLAGS = -std=c++14
|
||||
variant-11: CXXFLAGS = -std=c++11
|
||||
|
||||
all: $(PROGS)
|
||||
|
||||
%.cc %.hh: %.yy
|
||||
$(BISON) $(BISONFLAGS) -o $*.cc $<
|
||||
|
||||
%: %.cc
|
||||
$(CXX) $(CXXFLAGS) -o$@ $<
|
||||
|
||||
clean:
|
||||
rm -f $(PROGS:=.cc) $(PROGS)
|
||||
@@ -0,0 +1,59 @@
|
||||
# Examples in C++
|
||||
|
||||
This directory contains examples of Bison grammar files in C++.
|
||||
|
||||
You can run `make` to compile these examples. And `make clean` to tidy
|
||||
afterwards.
|
||||
|
||||
## simple.yy - Simple example in C++14
|
||||
A very simple example in C++, based on variants and symbol constructors.
|
||||
Variants allow to use any C++ type as semantic value type, and symbol
|
||||
constructors ensure consistency between declared token type and effective
|
||||
semantic value.
|
||||
|
||||
Run as `./simple`.
|
||||
|
||||
Extracted from the documentation: "A Simple C++ Example".
|
||||
https://www.gnu.org/software/bison/manual/html_node/A-Simple-C_002b_002b-Example.html
|
||||
|
||||
## variant.yy - Self-contained example in C++98
|
||||
A variation of simple.yy, in C++98.
|
||||
|
||||
Run as `./variant`.
|
||||
|
||||
## variant-11.yy - Self-contained example in modern C++
|
||||
Another variation of simple.yy, closely related to the previous one, but
|
||||
exhibiting support for C++11's move semantics.
|
||||
|
||||
Run as `./variant` or `./variant NUMBER`.
|
||||
|
||||
## calc++ - A Complete C++ Example
|
||||
A fully featured C++ version of the canonical example for parsers: a
|
||||
calculator. Also uses Flex for the scanner.
|
||||
|
||||
Don't look at this example first: it is fully featured and can serve as a
|
||||
starting point for a clean parser in C++. The previous examples are better
|
||||
introductory examples, and the C examples are also useful introductory
|
||||
examples.
|
||||
|
||||
Extracted from the documentation: "A Complete C++ Example".
|
||||
https://www.gnu.org/software/bison/manual/html_node/A-Complete-C_002b_002b-Example.html
|
||||
|
||||
<!---
|
||||
|
||||
Local Variables:
|
||||
fill-column: 76
|
||||
ispell-dictionary: "american"
|
||||
End:
|
||||
|
||||
Copyright (C) 2018-2019 Free Software Foundation, Inc.
|
||||
|
||||
Permission is granted to copy, distribute and/or modify this document
|
||||
under the terms of the GNU Free Documentation License, Version 1.3 or
|
||||
any later version published by the Free Software Foundation; with no
|
||||
Invariant Sections, with no Front-Cover Texts, and with no Back-Cover
|
||||
Texts. A copy of the license is included in the "GNU Free
|
||||
Documentation License" file as part of this distribution.
|
||||
|
||||
# LocalWords: mfcalc calc parsers yy ispell american
|
||||
--->
|
||||
@@ -0,0 +1,19 @@
|
||||
/*.o
|
||||
/*.tmp
|
||||
/.deps
|
||||
/calc++
|
||||
/calc++.cc
|
||||
/calc++.exe
|
||||
/calc.stamp
|
||||
/driver.cc
|
||||
/driver.hh
|
||||
/location.hh
|
||||
/parser.cc
|
||||
/parser.hh
|
||||
/parser.output
|
||||
/parser.stamp
|
||||
/parser.yy
|
||||
/position.hh
|
||||
/scanner.cc
|
||||
/scanner.ll
|
||||
/stack.hh
|
||||
@@ -0,0 +1,41 @@
|
||||
# This Makefile is designed to be simple and readable. It does not
|
||||
# aim at portability. It requires GNU Make.
|
||||
|
||||
BASE = calc++
|
||||
BISON = bison
|
||||
CXX = g++
|
||||
FLEX = flex
|
||||
XSLTPROC = xsltproc
|
||||
|
||||
all: $(BASE)
|
||||
|
||||
%.cc %.hh %.xml %.gv: %.yy
|
||||
$(BISON) $(BISONFLAGS) --xml --graph=$*.gv -o $*.cc $<
|
||||
|
||||
%.cc: %.ll
|
||||
$(FLEX) $(FLEXFLAGS) -o$@ $<
|
||||
|
||||
%.o: %.cc
|
||||
$(CXX) $(CXXFLAGS) -c -o$@ $<
|
||||
|
||||
$(BASE): $(BASE).o driver.o parser.o scanner.o
|
||||
$(CXX) -o $@ $^
|
||||
|
||||
$(BASE).o: parser.hh
|
||||
parser.o: parser.hh
|
||||
scanner.o: parser.hh
|
||||
|
||||
run: $(BASE)
|
||||
@echo "Type arithmetic expressions. Quit with ctrl-d."
|
||||
./$< -
|
||||
|
||||
html: parser.html
|
||||
%.html: %.xml
|
||||
$(XSLTPROC) $(XSLTPROCFLAGS) -o $@ $$($(BISON) --print-datadir)/xslt/xml2xhtml.xsl $<
|
||||
|
||||
CLEANFILES = \
|
||||
$(BASE) *.o \
|
||||
parser.hh parser.cc parser.output parser.xml parser.html parser.gv location.hh \
|
||||
scanner.cc
|
||||
clean:
|
||||
rm -f $(CLEANFILES)
|
||||
@@ -0,0 +1,57 @@
|
||||
# calc++ - A Flex+Bison calculator
|
||||
|
||||
This directory contains calc++, a Bison grammar file in C++. If you never
|
||||
saw the traditional implementation in C, please first read
|
||||
examples/c/lexcalc, which can be seen as a C precursor of this example.
|
||||
|
||||
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:
|
||||
fill-column: 76
|
||||
ispell-dictionary: "american"
|
||||
End:
|
||||
|
||||
Copyright (C) 2018-2019 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: calc parsers yy MERCHANTABILITY Ctrl ispell american
|
||||
--->
|
||||
Executable
+58
@@ -0,0 +1,58 @@
|
||||
#! /bin/sh
|
||||
|
||||
# Copyright (C) 2005-2015, 2018-2019 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/>.
|
||||
|
||||
cat >input <<EOF
|
||||
toto := 1
|
||||
toto
|
||||
EOF
|
||||
run 0 1
|
||||
run -noerr 0 1 -s
|
||||
|
||||
|
||||
cat >input <<EOF
|
||||
a := 1
|
||||
b := 2
|
||||
c := 3
|
||||
d := a + b * c
|
||||
d
|
||||
EOF
|
||||
run 0 7
|
||||
run -noerr 0 7 -p
|
||||
|
||||
|
||||
cat >input <<EOF
|
||||
a := 1
|
||||
b := 2
|
||||
c := 3
|
||||
d := (a + b) * c
|
||||
d
|
||||
EOF
|
||||
run 0 9
|
||||
|
||||
|
||||
cat >input <<EOF
|
||||
a := 1
|
||||
d := a + b * c
|
||||
EOF
|
||||
run 1 'err: -:3.1: syntax error, unexpected end of file, expecting ( or identifier or number'
|
||||
|
||||
|
||||
cat >input <<EOF
|
||||
a := 072101108108111044032119111114108100033
|
||||
a
|
||||
EOF
|
||||
run 1 'err: -:1.6-44: integer is out of range: 072101108108111044032119111114108100033'
|
||||
@@ -0,0 +1,83 @@
|
||||
## Copyright (C) 2005-2006, 2008-2015, 2018-2019 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/>.
|
||||
|
||||
## ------------------- ##
|
||||
## Parser generation. ##
|
||||
## ------------------- ##
|
||||
|
||||
%D%/parser.stamp: $(dependencies)
|
||||
SUFFIXES += .yy .stamp
|
||||
.yy.stamp:
|
||||
$(AM_V_YACC)rm -f $@
|
||||
$(AM_V_at)touch $@.tmp
|
||||
$(AM_V_at)$(YACCCOMPILE) -o $*.cc $<
|
||||
$(AM_V_at)mv -f $@.tmp $@
|
||||
|
||||
$(calcxx_sources_generated): %D%/parser.stamp
|
||||
@test -f $@ || rm -f %D%/parser.stamp
|
||||
@test -f $@ || $(MAKE) $(AM_MAKEFLAGS) %D%/parser.stamp
|
||||
CLEANFILES += \
|
||||
$(calcxx_sources_generated) \
|
||||
%D%/parser.dot \
|
||||
%D%/parser.output \
|
||||
%D%/parser.stamp \
|
||||
%D%/scanner.cc
|
||||
CLEANDIRS += %D%/*.dSYM
|
||||
|
||||
## -------------------- ##
|
||||
## Building & testing. ##
|
||||
## -------------------- ##
|
||||
|
||||
# Avoid using BUILT_SOURCES which is too global.
|
||||
$(%C%_calc___OBJECTS): $(calcxx_sources_generated)
|
||||
|
||||
calcxx_sources_extracted = \
|
||||
%D%/driver.cc \
|
||||
%D%/driver.hh \
|
||||
%D%/scanner.ll \
|
||||
%D%/calc++.cc
|
||||
calcxx_extracted = \
|
||||
$(calcxx_sources_extracted) \
|
||||
%D%/parser.yy
|
||||
extracted += $(calcxx_extracted)
|
||||
calcxx_sources_generated = \
|
||||
%D%/parser.cc \
|
||||
%D%/parser.hh \
|
||||
%D%/location.hh
|
||||
calcxx_sources = \
|
||||
$(calcxx_sources_extracted) \
|
||||
$(calcxx_sources_generated)
|
||||
|
||||
if FLEX_CXX_WORKS
|
||||
if ENABLE_CXX
|
||||
check_PROGRAMS += %D%/calc++
|
||||
nodist_%C%_calc___SOURCES = $(calcxx_sources)
|
||||
# Don't use gnulib's system headers.
|
||||
%C%_calc___CPPFLAGS = -I$(top_srcdir)/%D% -I$(top_builddir)/%D%
|
||||
%C%_calc___CXXFLAGS = $(AM_CXXFLAGS) $(FLEX_SCANNER_CXXFLAGS)
|
||||
TESTS += %D%/calc++.test
|
||||
endif ENABLE_CXX
|
||||
endif FLEX_CXX_WORKS
|
||||
EXTRA_DIST += %D%/calc++.test
|
||||
|
||||
|
||||
## ------------ ##
|
||||
## Installing. ##
|
||||
## ------------ ##
|
||||
|
||||
calcxxdir = $(docdir)/%D%
|
||||
calcxx_DATA = $(calcxx_extracted)
|
||||
dist_calcxx_DATA = %D%/README.md %D%/Makefile
|
||||
@@ -0,0 +1,73 @@
|
||||
## Copyright (C) 2018-2019 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/>.
|
||||
|
||||
cxxdir = $(docdir)/%D%
|
||||
include %D%/calc++/local.mk
|
||||
|
||||
## -------- ##
|
||||
## Simple. ##
|
||||
## -------- ##
|
||||
|
||||
BUILT_SOURCES += $(simple_sources)
|
||||
CLEANFILES += %D%/simple.[ch] %D%/simple.output
|
||||
CLEANDIRS += %D%/*.dSYM
|
||||
cxx_DATA = $(simple_extracted)
|
||||
|
||||
simple_extracted = %D%/simple.yy
|
||||
simple_sources = $(simple_extracted)
|
||||
extracted += $(simple_extracted)
|
||||
|
||||
if ENABLE_CXX14
|
||||
check_PROGRAMS += %D%/simple
|
||||
nodist_%C%_simple_SOURCES = $(simple_sources)
|
||||
|
||||
%C%_simple_CXXFLAGS = $(CXX11_CXXFLAGS) $(WARN_CXXFLAGS_TEST)
|
||||
# Don't use gnulib's system headers.
|
||||
%C%_simple_CPPFLAGS = -I$(top_builddir)
|
||||
TESTS += %D%/simple.test
|
||||
%D%/simple.cc: $(dependencies)
|
||||
endif
|
||||
EXTRA_DIST += %D%/simple.test
|
||||
|
||||
|
||||
## ---------- ##
|
||||
## Variants. ##
|
||||
## ---------- ##
|
||||
|
||||
if ENABLE_CXX
|
||||
check_PROGRAMS += %D%/variant
|
||||
nodist_%C%_variant_SOURCES = %D%/variant.yy
|
||||
# Don't use gnulib's system headers.
|
||||
%C%_variant_CPPFLAGS = -I$(top_builddir)
|
||||
TESTS += %D%/variant.test
|
||||
%D%/variant.cc: $(dependencies)
|
||||
endif
|
||||
EXTRA_DIST += %D%/variant.test
|
||||
|
||||
if ENABLE_CXX11
|
||||
check_PROGRAMS += %D%/variant-11
|
||||
nodist_%C%_variant_11_SOURCES = %D%/variant-11.yy
|
||||
%C%_variant_11_CXXFLAGS = $(CXX11_CXXFLAGS) $(WARN_CXXFLAGS_TEST)
|
||||
# Don't use gnulib's system headers.
|
||||
%C%_variant_11_CPPFLAGS = -I$(top_builddir)
|
||||
TESTS += %D%/variant-11.test
|
||||
%D%/variant-11.cc: $(dependencies)
|
||||
endif
|
||||
EXTRA_DIST += %D%/variant-11.test
|
||||
|
||||
dist_cxx_DATA = %D%/README.md %D%/Makefile %D%/variant.yy %D%/variant-11.yy
|
||||
CLEANFILES += \
|
||||
%D%/simple.output %D%/variant.output %D%/variant-11.output \
|
||||
%D%/simple.hh %D%/variant.hh %D%/variant-11.hh
|
||||
@@ -0,0 +1,4 @@
|
||||
#! /bin/sh
|
||||
|
||||
: >input
|
||||
run 0 "{I have three numbers for you., 1, 2, 3, And that's all!}"
|
||||
@@ -0,0 +1,21 @@
|
||||
#! /bin/sh
|
||||
|
||||
# Copyright (C) 2018-2019 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 numbers for you., 1, 2, 3, And that's all!}" 4
|
||||
|
||||
run 0 "{I have numbers for you., 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255, 256, 257, 258, 259, 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, 285, 286, 287, 288, 289, 290, 291, 292, 293, 294, 295, 296, 297, 298, 299, 300, 301, 302, 303, 304, 305, 306, 307, 308, 309, 310, 311, 312, 313, 314, 315, 316, 317, 318, 319, 320, 321, 322, 323, 324, 325, 326, 327, 328, 329, 330, 331, 332, 333, 334, 335, 336, 337, 338, 339, 340, 341, 342, 343, 344, 345, 346, 347, 348, 349, 350, 351, 352, 353, 354, 355, 356, 357, 358, 359, 360, 361, 362, 363, 364, 365, 366, 367, 368, 369, 370, 371, 372, 373, 374, 375, 376, 377, 378, 379, 380, 381, 382, 383, 384, 385, 386, 387, 388, 389, 390, 391, 392, 393, 394, 395, 396, 397, 398, 399, 400, 401, 402, 403, 404, 405, 406, 407, 408, 409, 410, 411, 412, 413, 414, 415, 416, 417, 418, 419, 420, 421, 422, 423, 424, 425, 426, 427, 428, 429, 430, 431, 432, 433, 434, 435, 436, 437, 438, 439, 440, 441, 442, 443, 444, 445, 446, 447, 448, 449, 450, 451, 452, 453, 454, 455, 456, 457, 458, 459, 460, 461, 462, 463, 464, 465, 466, 467, 468, 469, 470, 471, 472, 473, 474, 475, 476, 477, 478, 479, 480, 481, 482, 483, 484, 485, 486, 487, 488, 489, 490, 491, 492, 493, 494, 495, 496, 497, 498, 499, 500, 501, 502, 503, 504, 505, 506, 507, 508, 509, 510, 511, 512, 513, 514, 515, 516, 517, 518, 519, 520, 521, 522, 523, 524, 525, 526, 527, 528, 529, 530, 531, 532, 533, 534, 535, 536, 537, 538, 539, 540, 541, 542, 543, 544, 545, 546, 547, 548, 549, 550, 551, 552, 553, 554, 555, 556, 557, 558, 559, 560, 561, 562, 563, 564, 565, 566, 567, 568, 569, 570, 571, 572, 573, 574, 575, 576, 577, 578, 579, 580, 581, 582, 583, 584, 585, 586, 587, 588, 589, 590, 591, 592, 593, 594, 595, 596, 597, 598, 599, 600, 601, 602, 603, 604, 605, 606, 607, 608, 609, 610, 611, 612, 613, 614, 615, 616, 617, 618, 619, 620, 621, 622, 623, 624, 625, 626, 627, 628, 629, 630, 631, 632, 633, 634, 635, 636, 637, 638, 639, 640, 641, 642, 643, 644, 645, 646, 647, 648, 649, 650, 651, 652, 653, 654, 655, 656, 657, 658, 659, 660, 661, 662, 663, 664, 665, 666, 667, 668, 669, 670, 671, 672, 673, 674, 675, 676, 677, 678, 679, 680, 681, 682, 683, 684, 685, 686, 687, 688, 689, 690, 691, 692, 693, 694, 695, 696, 697, 698, 699, 700, 701, 702, 703, 704, 705, 706, 707, 708, 709, 710, 711, 712, 713, 714, 715, 716, 717, 718, 719, 720, 721, 722, 723, 724, 725, 726, 727, 728, 729, 730, 731, 732, 733, 734, 735, 736, 737, 738, 739, 740, 741, 742, 743, 744, 745, 746, 747, 748, 749, 750, 751, 752, 753, 754, 755, 756, 757, 758, 759, 760, 761, 762, 763, 764, 765, 766, 767, 768, 769, 770, 771, 772, 773, 774, 775, 776, 777, 778, 779, 780, 781, 782, 783, 784, 785, 786, 787, 788, 789, 790, 791, 792, 793, 794, 795, 796, 797, 798, 799, 800, 801, 802, 803, 804, 805, 806, 807, 808, 809, 810, 811, 812, 813, 814, 815, 816, 817, 818, 819, 820, 821, 822, 823, 824, 825, 826, 827, 828, 829, 830, 831, 832, 833, 834, 835, 836, 837, 838, 839, 840, 841, 842, 843, 844, 845, 846, 847, 848, 849, 850, 851, 852, 853, 854, 855, 856, 857, 858, 859, 860, 861, 862, 863, 864, 865, 866, 867, 868, 869, 870, 871, 872, 873, 874, 875, 876, 877, 878, 879, 880, 881, 882, 883, 884, 885, 886, 887, 888, 889, 890, 891, 892, 893, 894, 895, 896, 897, 898, 899, 900, 901, 902, 903, 904, 905, 906, 907, 908, 909, 910, 911, 912, 913, 914, 915, 916, 917, 918, 919, 920, 921, 922, 923, 924, 925, 926, 927, 928, 929, 930, 931, 932, 933, 934, 935, 936, 937, 938, 939, 940, 941, 942, 943, 944, 945, 946, 947, 948, 949, 950, 951, 952, 953, 954, 955, 956, 957, 958, 959, 960, 961, 962, 963, 964, 965, 966, 967, 968, 969, 970, 971, 972, 973, 974, 975, 976, 977, 978, 979, 980, 981, 982, 983, 984, 985, 986, 987, 988, 989, 990, 991, 992, 993, 994, 995, 996, 997, 998, 999, And that's all!}" 1000
|
||||
@@ -0,0 +1,154 @@
|
||||
/*
|
||||
Copyright (C) 2008-2015, 2018-2019 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/>.
|
||||
*/
|
||||
|
||||
%require "3.2"
|
||||
%debug
|
||||
%language "c++"
|
||||
%define api.token.constructor
|
||||
%define api.value.type variant
|
||||
%define api.value.automove
|
||||
%define api.location.file none
|
||||
%define parse.assert
|
||||
%locations
|
||||
|
||||
%code requires // *.hh
|
||||
{
|
||||
#include <memory> // std::unique_ptr
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
using string_uptr = std::unique_ptr<std::string>;
|
||||
using string_uptrs = std::vector<string_uptr>;
|
||||
}
|
||||
|
||||
%code // *.cc
|
||||
{
|
||||
#include <climits> // INT_MIN, INT_MAX
|
||||
#include <iostream>
|
||||
#include <sstream>
|
||||
|
||||
namespace yy
|
||||
{
|
||||
// Prototype of the yylex function providing subsequent tokens.
|
||||
static parser::symbol_type yylex ();
|
||||
|
||||
// Print a vector of strings.
|
||||
std::ostream&
|
||||
operator<< (std::ostream& o, const string_uptrs& ss)
|
||||
{
|
||||
o << '{';
|
||||
const char *sep = "";
|
||||
for (const auto& s: ss)
|
||||
{
|
||||
o << sep << *s;
|
||||
sep = ", ";
|
||||
}
|
||||
return o << '}';
|
||||
}
|
||||
}
|
||||
|
||||
template <typename... Args>
|
||||
string_uptr
|
||||
make_string_uptr (Args&&... args)
|
||||
{
|
||||
// std::make_unique is C++14.
|
||||
return string_uptr (new std::string{std::forward<Args> (args)...});
|
||||
}
|
||||
}
|
||||
|
||||
%token <string_uptr> TEXT;
|
||||
%token <int> NUMBER;
|
||||
%printer { yyo << '(' << &$$ << ") " << $$; } <*>;
|
||||
%printer { yyo << *$$; } <string_uptr>;
|
||||
%token END_OF_FILE 0;
|
||||
|
||||
%type <string_uptr> item;
|
||||
%type <string_uptrs> list;
|
||||
|
||||
%%
|
||||
|
||||
result:
|
||||
list { std::cout << $1 << '\n'; }
|
||||
;
|
||||
|
||||
list:
|
||||
%empty { /* Generates an empty string list */ }
|
||||
| list item { $$ = $1; $$.emplace_back ($2); }
|
||||
;
|
||||
|
||||
item:
|
||||
TEXT
|
||||
| NUMBER { $$ = make_string_uptr (std::to_string ($1)); }
|
||||
;
|
||||
%%
|
||||
|
||||
// The last number return by the scanner is max - 1.
|
||||
int max = 4;
|
||||
|
||||
namespace yy
|
||||
{
|
||||
// The yylex function providing subsequent tokens:
|
||||
// TEXT "I have three numbers for you."
|
||||
// NUMBER 1
|
||||
// NUMBER 2
|
||||
// NUMBER ...
|
||||
// NUMBER max - 1
|
||||
// TEXT "And that's all!"
|
||||
// END_OF_FILE
|
||||
|
||||
static
|
||||
parser::symbol_type
|
||||
yylex ()
|
||||
{
|
||||
static int count = 0;
|
||||
const int stage = count;
|
||||
++count;
|
||||
auto loc = parser::location_type{nullptr, unsigned (stage + 1), unsigned (stage + 1)};
|
||||
if (stage == 0)
|
||||
return parser::make_TEXT (make_string_uptr ("I have numbers for you."), std::move (loc));
|
||||
else if (stage < max)
|
||||
return parser::make_NUMBER (stage, std::move (loc));
|
||||
else if (stage == max)
|
||||
return parser::make_TEXT (make_string_uptr ("And that's all!"), std::move (loc));
|
||||
else
|
||||
return parser::make_END_OF_FILE (std::move (loc));
|
||||
}
|
||||
|
||||
// Mandatory error function
|
||||
void
|
||||
parser::error (const parser::location_type& loc, const std::string& msg)
|
||||
{
|
||||
std::cerr << loc << ": " << msg << '\n';
|
||||
}
|
||||
}
|
||||
|
||||
int
|
||||
main (int argc, const char *argv[])
|
||||
{
|
||||
if (2 <= argc && isdigit (*argv[1]))
|
||||
{
|
||||
auto maxl = strtol (argv[1], nullptr, 10);
|
||||
max = INT_MIN <= maxl && maxl <= INT_MAX ? int(maxl) : 4;
|
||||
}
|
||||
auto&& p = yy::parser{};
|
||||
p.set_debug_level (!!getenv ("YYDEBUG"));
|
||||
return p.parse ();
|
||||
}
|
||||
|
||||
// Local Variables:
|
||||
// mode: C++
|
||||
// End:
|
||||
@@ -0,0 +1,19 @@
|
||||
#! /bin/sh
|
||||
|
||||
# Copyright (C) 2018-2019 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!}"
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
Copyright (C) 2008-2013 Free Software Foundation, Inc.
|
||||
Copyright (C) 2008-2015, 2018-2019 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
|
||||
@@ -15,52 +15,52 @@
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
%require "3.2"
|
||||
%debug
|
||||
%skeleton "lalr1.cc"
|
||||
%defines
|
||||
%language "c++"
|
||||
%define api.token.constructor
|
||||
%define api.value.type variant
|
||||
%define api.location.file none
|
||||
%define parse.assert
|
||||
%locations
|
||||
|
||||
%code requires // *.hh
|
||||
{
|
||||
#include <list>
|
||||
#include <string>
|
||||
typedef std::list<std::string> strings_type;
|
||||
#include <vector>
|
||||
typedef std::vector<std::string> strings_type;
|
||||
}
|
||||
|
||||
%code // *.cc
|
||||
{
|
||||
#include <algorithm>
|
||||
#include <iostream>
|
||||
#include <iterator>
|
||||
#include <sstream>
|
||||
|
||||
// Prototype of the yylex function providing subsequent tokens.
|
||||
namespace yy
|
||||
{
|
||||
// Prototype of the yylex function providing subsequent tokens.
|
||||
static parser::symbol_type yylex ();
|
||||
}
|
||||
|
||||
// Printing a list of strings.
|
||||
// Koening look up will look into std, since that's an std::list.
|
||||
namespace std
|
||||
{
|
||||
// Print a vector of strings.
|
||||
std::ostream&
|
||||
operator<< (std::ostream& o, const strings_type& s)
|
||||
operator<< (std::ostream& o, const strings_type& ss)
|
||||
{
|
||||
std::copy (s.begin (), s.end (),
|
||||
std::ostream_iterator<strings_type::value_type> (o, "\n"));
|
||||
return o;
|
||||
o << '{';
|
||||
const char *sep = "";
|
||||
for (strings_type::const_iterator i = ss.begin (), end = ss.end ();
|
||||
i != end; ++i)
|
||||
{
|
||||
o << sep << *i;
|
||||
sep = ", ";
|
||||
}
|
||||
return o << '}';
|
||||
}
|
||||
}
|
||||
|
||||
// Conversion to string.
|
||||
// Convert to string.
|
||||
template <typename T>
|
||||
inline
|
||||
std::string
|
||||
string_cast (const T& t)
|
||||
to_string (const T& t)
|
||||
{
|
||||
std::ostringstream o;
|
||||
o << t;
|
||||
@@ -70,31 +70,38 @@ typedef std::list<std::string> strings_type;
|
||||
|
||||
%token <::std::string> TEXT;
|
||||
%token <int> NUMBER;
|
||||
%printer { yyoutput << $$; } <*>;
|
||||
%printer { yyo << '(' << &$$ << ") " << $$; } <*>;
|
||||
%token END_OF_FILE 0;
|
||||
|
||||
%type <::std::string> item;
|
||||
%type <::std::list<std::string>> list;
|
||||
%type <::std::vector<std::string>> list;
|
||||
|
||||
%%
|
||||
|
||||
result:
|
||||
list { std::cout << $1 << std::endl; }
|
||||
list { std::cout << $1 << '\n'; }
|
||||
;
|
||||
|
||||
list:
|
||||
/* nothing */ { /* Generates an empty string list */ }
|
||||
| list item { std::swap ($$, $1); $$.push_back ($2); }
|
||||
%empty { /* Generates an empty string list */ }
|
||||
| list item { std::swap ($$, $1); $$.push_back ($2); }
|
||||
;
|
||||
|
||||
item:
|
||||
TEXT { std::swap ($$, $1); }
|
||||
| NUMBER { $$ = string_cast ($1); }
|
||||
TEXT
|
||||
| NUMBER { $$ = to_string ($1); }
|
||||
;
|
||||
%%
|
||||
|
||||
namespace yy
|
||||
{
|
||||
// Use nullptr with pre-C++11.
|
||||
#if !defined __cplusplus || __cplusplus < 201103L
|
||||
# define NULLPTR 0
|
||||
#else
|
||||
# define NULLPTR nullptr
|
||||
#endif
|
||||
|
||||
// The yylex function providing subsequent tokens:
|
||||
// TEXT "I have three numbers for you."
|
||||
// NUMBER 1
|
||||
@@ -107,9 +114,10 @@ namespace yy
|
||||
parser::symbol_type
|
||||
yylex ()
|
||||
{
|
||||
static int stage = -1;
|
||||
++stage;
|
||||
parser::location_type loc(0, stage + 1, stage + 1);
|
||||
static int count = 0;
|
||||
const int stage = count;
|
||||
++count;
|
||||
parser::location_type loc (NULLPTR, unsigned (stage + 1), unsigned (stage + 1));
|
||||
switch (stage)
|
||||
{
|
||||
case 0:
|
||||
@@ -129,7 +137,7 @@ namespace yy
|
||||
void
|
||||
parser::error (const parser::location_type& loc, const std::string& msg)
|
||||
{
|
||||
std::cerr << loc << ": " << msg << std::endl;
|
||||
std::cerr << loc << ": " << msg << '\n';
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,59 @@
|
||||
# Examples in C
|
||||
|
||||
This directory contains simple examples of Bison grammar files in C.
|
||||
|
||||
Some of them come from the documentation, which should be installed together
|
||||
with Bison. The URLs are provided for convenience.
|
||||
|
||||
## rpcalc - Reverse Polish Notation Calculator
|
||||
The first example is that of a simple double-precision Reverse Polish
|
||||
Notation calculator (a calculator using postfix operators). This example
|
||||
provides a good starting point, since operator precedence is not an issue.
|
||||
|
||||
Extracted from the documentation: "Reverse Polish Notation Calculator"
|
||||
https://www.gnu.org/software/bison/manual/html_node/RPN-Calc.html
|
||||
|
||||
## calc - Simple Calculator
|
||||
This example is slightly more complex than rpcalc: it features infix
|
||||
operators (`1 + 2`, instead of `1 2 +` in rpcalc), but it does so using a
|
||||
unambiguous grammar of the arithmetic instead of using precedence
|
||||
directives (%left, etc.).
|
||||
|
||||
## mfcalc - Multi-Function Calculator
|
||||
A more complete C example: a multi-function calculator. More complex than
|
||||
the previous example. Using precedence directives to support infix
|
||||
operators.
|
||||
|
||||
Extracted from the documentation: "Multi-Function Calculator: mfcalc".
|
||||
https://www.gnu.org/software/bison/manual/html_node/Multi_002dfunction-Calc.html
|
||||
|
||||
## lexcalc - calculator with Flex and Bison
|
||||
The calculator, redux. This time using a scanner generated by Flex.
|
||||
|
||||
## reccalc - recursive calculator with Flex and Bison
|
||||
The example builds on top of the previous one to provide a reentrant parser.
|
||||
Such parsers can be called concurrently in different threads, or even
|
||||
recursively. To demonstrate this feature, expressions in parentheses are
|
||||
tokenized as strings, and then recursively parsed from the parser. So
|
||||
`(((1)+(2))*((3)+(4)))` uses eight parsers, with a depth of four.
|
||||
|
||||
|
||||
<!---
|
||||
|
||||
Local Variables:
|
||||
fill-column: 76
|
||||
ispell-dictionary: "american"
|
||||
End:
|
||||
|
||||
Copyright (C) 2018-2019 Free Software Foundation, Inc.
|
||||
|
||||
Permission is granted to copy, distribute and/or modify this document
|
||||
under the terms of the GNU Free Documentation License, Version 1.3 or
|
||||
any later version published by the Free Software Foundation; with no
|
||||
Invariant Sections, with no Front-Cover Texts, and with no Back-Cover
|
||||
Texts. A copy of the license is included in the "GNU Free
|
||||
Documentation License" file as part of this distribution.
|
||||
|
||||
# LocalWords: mfcalc calc parsers yy rpcalc lexcalc redux reccalc ispell
|
||||
# LocalWords: reentrant tokenized american postfix
|
||||
--->
|
||||
@@ -0,0 +1,28 @@
|
||||
# This Makefile is designed to be simple and readable. It does not
|
||||
# aim at portability. It requires GNU Make.
|
||||
|
||||
BASE = calc
|
||||
BISON = bison
|
||||
XSLTPROC = xsltproc
|
||||
|
||||
all: $(BASE)
|
||||
|
||||
%.c %.h %.xml %.gv: %.y
|
||||
$(BISON) $(BISONFLAGS) --defines --xml --graph=$*.gv -o $*.c $<
|
||||
|
||||
$(BASE): $(BASE).o
|
||||
$(CC) $(CFLAGS) -o $@ $^
|
||||
|
||||
run: $(BASE)
|
||||
@echo "Type arithmetic expressions. Quit with ctrl-d."
|
||||
./$<
|
||||
|
||||
html: $(BASE).html
|
||||
%.html: %.xml
|
||||
$(XSLTPROC) $(XSLTPROCFLAGS) -o $@ $$($(BISON) --print-datadir)/xslt/xml2xhtml.xsl $<
|
||||
|
||||
CLEANFILES = \
|
||||
$(BASE) *.o $(BASE).[ch] $(BASE).output $(BASE).xml $(BASE).html $(BASE).gv
|
||||
|
||||
clean:
|
||||
rm -f $(CLEANFILES)
|
||||
@@ -0,0 +1,28 @@
|
||||
# calc - calculator with Bison
|
||||
|
||||
This directory contains calc, the traditional example of using Bison to
|
||||
build a simple calculator.
|
||||
|
||||
<!---
|
||||
Local Variables:
|
||||
fill-column: 76
|
||||
ispell-dictionary: "american"
|
||||
End:
|
||||
|
||||
Copyright (C) 2019 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/>.
|
||||
--->
|
||||
Executable → Regular
+14
-27
@@ -1,6 +1,6 @@
|
||||
#! /bin/sh
|
||||
|
||||
# Copyright (C) 2005-2013 Free Software Foundation, Inc.
|
||||
# Copyright (C) 2019 Free Software Foundation, Inc.
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
@@ -16,35 +16,22 @@
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
cat >input <<EOF
|
||||
toto := 1
|
||||
toto
|
||||
EOF
|
||||
run 0 1 -s
|
||||
|
||||
|
||||
cat >input <<EOF
|
||||
a := 1
|
||||
b := 2
|
||||
c := 3
|
||||
d := a + b * c
|
||||
d
|
||||
1+2*3
|
||||
EOF
|
||||
run 0 7
|
||||
run 0 7 -p
|
||||
|
||||
|
||||
cat >input <<EOF
|
||||
a := 1
|
||||
b := 2
|
||||
c := 3
|
||||
d := (a + b) * c
|
||||
d
|
||||
1 - 2 - 3
|
||||
EOF
|
||||
run 0 -4
|
||||
|
||||
cat >input <<EOF
|
||||
8 / 2 / 2
|
||||
EOF
|
||||
run 0 2
|
||||
|
||||
cat >input <<EOF
|
||||
(1+2) * 3
|
||||
EOF
|
||||
run 0 9
|
||||
|
||||
|
||||
cat >input <<EOF
|
||||
a := 1
|
||||
d := a + b * c
|
||||
EOF
|
||||
run 1 ''
|
||||
run -noerr 0 9 -p
|
||||
@@ -0,0 +1,93 @@
|
||||
%code top {
|
||||
#include <ctype.h> /* isdigit. */
|
||||
#include <stdio.h> /* For printf, etc. */
|
||||
#include <string.h> /* strcmp. */
|
||||
|
||||
int yylex (void);
|
||||
void yyerror (char const *);
|
||||
}
|
||||
|
||||
%define api.header.include {"calc.h"}
|
||||
%define api.value.type union /* Generate YYSTYPE from these types: */
|
||||
%token <double> NUM "number"
|
||||
%type <double> expr term fact
|
||||
|
||||
/* Generate the parser description file. */
|
||||
%verbose
|
||||
/* Enable run-time traces (yydebug). */
|
||||
%define parse.trace
|
||||
|
||||
/* Formatting semantic values. */
|
||||
%printer { fprintf (yyo, "%g", $$); } <double>;
|
||||
|
||||
%% /* The grammar follows. */
|
||||
input:
|
||||
%empty
|
||||
| input line
|
||||
;
|
||||
|
||||
line:
|
||||
'\n'
|
||||
| expr '\n' { printf ("%.10g\n", $1); }
|
||||
| error '\n' { yyerrok; }
|
||||
;
|
||||
|
||||
expr:
|
||||
expr '+' term { $$ = $1 + $3; }
|
||||
| expr '-' term { $$ = $1 - $3; }
|
||||
| term
|
||||
;
|
||||
|
||||
term:
|
||||
term '*' fact { $$ = $1 * $3; }
|
||||
| term '/' fact { $$ = $1 / $3; }
|
||||
| fact
|
||||
;
|
||||
|
||||
fact:
|
||||
"number"
|
||||
| '(' expr ')' { $$ = $2; }
|
||||
;
|
||||
|
||||
%%
|
||||
|
||||
int
|
||||
yylex (void)
|
||||
{
|
||||
int c;
|
||||
|
||||
/* Ignore white space, get first nonwhite character. */
|
||||
while ((c = getchar ()) == ' ' || c == '\t')
|
||||
continue;
|
||||
|
||||
if (c == EOF)
|
||||
return 0;
|
||||
|
||||
/* Char starts a number => parse the number. */
|
||||
if (c == '.' || isdigit (c))
|
||||
{
|
||||
ungetc (c, stdin);
|
||||
scanf ("%lf", &yylval.NUM);
|
||||
return NUM;
|
||||
}
|
||||
|
||||
/* Any other character is a token by itself. */
|
||||
return c;
|
||||
}
|
||||
|
||||
/* Called by yyparse on error. */
|
||||
void
|
||||
yyerror (char const *s)
|
||||
{
|
||||
fprintf (stderr, "%s\n", s);
|
||||
}
|
||||
|
||||
int
|
||||
main (int argc, char const* argv[])
|
||||
{
|
||||
/* Enable parse traces on option -p. */
|
||||
for (int i = 1; i < argc; ++i)
|
||||
if (!strcmp (argv[i], "-p"))
|
||||
yydebug = 1;
|
||||
return yyparse ();
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
## Copyright (C) 2019 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/>.
|
||||
|
||||
calcdir = $(docdir)/%D%
|
||||
|
||||
## ------ ##
|
||||
## Calc. ##
|
||||
## ------ ##
|
||||
|
||||
check_PROGRAMS += %D%/calc
|
||||
TESTS += %D%/calc.test
|
||||
EXTRA_DIST += %D%/calc.test
|
||||
nodist_%C%_calc_SOURCES = %D%/calc.y
|
||||
%D%/calc.c: $(dependencies)
|
||||
|
||||
# Don't use gnulib's system headers.
|
||||
%C%_calc_CPPFLAGS = -I$(top_srcdir)/%D% -I$(top_builddir)/%D%
|
||||
|
||||
dist_calc_DATA = %D%/calc.y %D%/Makefile %D%/README.md
|
||||
CLEANFILES += %D%/calc.[ch] %D%/calc.output %D%/scan.c
|
||||
CLEANDIRS += %D%/*.dSYM
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user