mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-08-11 03:35:15 +00:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ec3375ab4e | ||
|
|
12c8e427c7 | ||
|
|
9f8f3d2e77 | ||
|
|
108724c2e7 | ||
|
|
da0f993fb9 | ||
|
|
075a879052 | ||
|
|
a7ded4284e | ||
|
|
a5c55bb758 | ||
|
|
bc5aa8e274 | ||
|
|
0a82bf5c07 | ||
|
|
a70e75b8a4 | ||
|
|
3afa9757da | ||
|
|
36f37568ba | ||
|
|
f2c568d3ef | ||
|
|
bb7860d208 | ||
|
|
8bb81e2048 | ||
|
|
84059ea508 | ||
|
|
024f00fd11 | ||
|
|
0af06e091b | ||
|
|
1d291901b4 | ||
|
|
f387ffc1d3 | ||
|
|
9307c173c7 | ||
|
|
15ba35a51b | ||
|
|
db66acc5d0 | ||
|
|
3477ced42b | ||
|
|
348b5039fd | ||
|
|
07cdeda9f8 | ||
|
|
c2ba260487 | ||
|
|
e4e3cbce77 | ||
|
|
b2a00ed5dd | ||
|
|
3c5f73fe51 | ||
|
|
dabde7c560 | ||
|
|
272da17cfd | ||
|
|
4b802d6417 | ||
|
|
7f1e9249d0 | ||
|
|
6d86d26b33 | ||
|
|
80db1029e6 | ||
|
|
6118406c3e | ||
|
|
a83202a436 | ||
|
|
9de593aba7 | ||
|
|
6fc9f13aef | ||
|
|
d4b195ece6 | ||
|
|
85032e9630 | ||
|
|
7e16706f7b | ||
|
|
b7d2b854be | ||
|
|
93f9e527ca | ||
|
|
0c0cf6f5a4 | ||
|
|
413d318940 | ||
|
|
cb7bdc251d | ||
|
|
e814ddc92f | ||
|
|
b293d4fbca | ||
|
|
952479fca7 | ||
|
|
e14825ecb7 | ||
|
|
98823ea402 | ||
|
|
ad40c80a03 | ||
|
|
3c7cc7dc4f | ||
|
|
410d37b994 | ||
|
|
9b6065303b | ||
|
|
5325292e5d | ||
|
|
ca403f672c | ||
|
|
5c554ea8a3 | ||
|
|
7eee2ccbd2 | ||
|
|
f99314765b | ||
|
|
9ba3c5ceb9 | ||
|
|
4bd4cdf377 | ||
|
|
ae0889d805 | ||
|
|
a9c2549c27 | ||
|
|
fb032a28df | ||
|
|
59a2053c83 | ||
|
|
e1caae6b48 | ||
|
|
c4cf4cc2f5 | ||
|
|
b458b34f94 | ||
|
|
09a22da8c8 | ||
|
|
cf899f7a7c | ||
|
|
a774839ca8 | ||
|
|
15c61fb712 | ||
|
|
f6eb1ac87b | ||
|
|
b96528b48c | ||
|
|
4511e43245 | ||
|
|
306fc3ec00 | ||
|
|
f08110cb50 | ||
|
|
c61b282d77 | ||
|
|
2d1d2f87f9 | ||
|
|
f50fff58d1 | ||
|
|
e0ab5c324a | ||
|
|
c80b404dfa | ||
|
|
96b881094b | ||
|
|
fdba54a961 | ||
|
|
d50a3e450e | ||
|
|
47186ec460 | ||
|
|
1efe31185f | ||
|
|
9acc9d2aee | ||
|
|
dc8fe0678a | ||
|
|
a70e21215a | ||
|
|
638de51289 | ||
|
|
b46afca5be | ||
|
|
0dc20612c0 | ||
|
|
6dc09317fb | ||
|
|
fc0dbb3bba | ||
|
|
de93a0728b | ||
|
|
689b184983 | ||
|
|
ef3adfa0fb | ||
|
|
b4582f1918 | ||
|
|
77a8b84fc8 | ||
|
|
b27bba5ced | ||
|
|
7a525fa06f | ||
|
|
c7037bfcb0 | ||
|
|
874e75975b | ||
|
|
51f12cffd2 | ||
|
|
c94456986d | ||
|
|
4083ee52b5 | ||
|
|
3c47ed0fe6 | ||
|
|
1ff6bcb2f1 | ||
|
|
2fac23b9dd | ||
|
|
c22902e360 | ||
|
|
2c294c1325 | ||
|
|
236b85dd28 | ||
|
|
4109d56aa9 | ||
|
|
003ca0498d | ||
|
|
3abad26a2d | ||
|
|
1bac4ecc44 | ||
|
|
84b00b6bf0 | ||
|
|
a26f7cf98f | ||
|
|
0317055bb0 | ||
|
|
c73dcd6958 | ||
|
|
11f6839645 | ||
|
|
4910c02579 | ||
|
|
83bc889536 | ||
|
|
2f554e6260 | ||
|
|
7a31b6bb7f | ||
|
|
8320691a63 | ||
|
|
3b03c62e49 | ||
|
|
a700a13822 | ||
|
|
1d3df34671 | ||
|
|
89d2b69c1b | ||
|
|
1e0b087244 | ||
|
|
4744faf205 | ||
|
|
1ac973aa56 | ||
|
|
8358090292 | ||
|
|
fb144c021c | ||
|
|
5aaa93ae72 | ||
|
|
cd99a1a923 | ||
|
|
d53bbd5f06 | ||
|
|
615bad4186 | ||
|
|
4f6d1f5fdc | ||
|
|
4fd2e5c22a | ||
|
|
7e0b792d12 | ||
|
|
d7e8aaa271 | ||
|
|
30a8d580fa | ||
|
|
119dedb591 | ||
|
|
d85ea95d6f | ||
|
|
a9911528e0 | ||
|
|
17fb1d0377 | ||
|
|
a9f9f317b5 | ||
|
|
4524e17616 | ||
|
|
c93aec904a | ||
|
|
3a9529eaed | ||
|
|
c1494a7871 | ||
|
|
0923da74e8 | ||
|
|
0a4a7178c8 | ||
|
|
da4d38f830 | ||
|
|
769322e01e | ||
|
|
19418cfc75 | ||
|
|
42d5a16f8d | ||
|
|
118c4bd3a1 | ||
|
|
82133a6103 | ||
|
|
cca770a156 | ||
|
|
430ca0fc63 | ||
|
|
983364d76a | ||
|
|
6833b1be47 | ||
|
|
4aa731d110 | ||
|
|
3ad6d862b7 | ||
|
|
3fa59c32fc | ||
|
|
47612d987b | ||
|
|
3a98be5284 | ||
|
|
fbdff2bc38 | ||
|
|
3bcc090758 | ||
|
|
5433b0a84b | ||
|
|
21c812e2f0 | ||
|
|
442c8d85aa | ||
|
|
428999c117 | ||
|
|
b52a2172a1 | ||
|
|
8d01c60e9c | ||
|
|
c13b3c02d3 | ||
|
|
f859462658 | ||
|
|
dc8b16424a | ||
|
|
5bac3ddcee | ||
|
|
594cae57ca | ||
|
|
e51e89856a | ||
|
|
c2a06bf791 | ||
|
|
8733959954 | ||
|
|
31b8b8f179 | ||
|
|
e2199d0fb2 | ||
|
|
c1884d3002 | ||
|
|
ab1208e263 | ||
|
|
74d1e881a7 | ||
|
|
f30067ed51 | ||
|
|
630448ba6b | ||
|
|
1283dc7243 | ||
|
|
e3d4b42f58 | ||
|
|
f67c1ce937 | ||
|
|
5a4e606275 | ||
|
|
83f2eb3737 | ||
|
|
3911aba39a | ||
|
|
8bc45673d5 | ||
|
|
fbe5abd23d | ||
|
|
c09f2e4c7b | ||
|
|
ac3d5b76f7 | ||
|
|
edfcca8481 | ||
|
|
92e943bd24 | ||
|
|
e40da7b6b3 | ||
|
|
70b3c8fb20 | ||
|
|
e9b7641cca | ||
|
|
321fac2193 | ||
|
|
2777b73166 | ||
|
|
89296e3962 | ||
|
|
bb97a2a37b | ||
|
|
8a22b557b9 | ||
|
|
92dc8bf23b | ||
|
|
c18dbfcb06 | ||
|
|
94701b4e5e | ||
|
|
3e6826aff1 | ||
|
|
9466c734c5 | ||
|
|
b9a533d63e | ||
|
|
d0e44162b5 | ||
|
|
8db99c54f4 | ||
|
|
2157ced3dd | ||
|
|
59653c8efd | ||
|
|
2a07cb0f2d | ||
|
|
734ce73bf2 | ||
|
|
baea8cf9fa | ||
|
|
636c9a8042 | ||
|
|
7dc942dca3 | ||
|
|
32bb53870b | ||
|
|
27109d9d4a | ||
|
|
2b4451c4af | ||
|
|
c0f3b55b25 | ||
|
|
20d657c1dd | ||
|
|
b00fa62e95 | ||
|
|
8e44b24ba8 | ||
|
|
6692df8992 | ||
|
|
cc04459cfe | ||
|
|
ee4ec08513 | ||
|
|
13bb2b78b3 | ||
|
|
848a17fa33 | ||
|
|
c6a39f8409 | ||
|
|
df34ad7c6e | ||
|
|
0a82316e54 | ||
|
|
611348e67b | ||
|
|
fe0102d4d5 | ||
|
|
718cb1ab38 | ||
|
|
08f657f4a4 | ||
|
|
7292ed6e64 | ||
|
|
3f473dd2d7 | ||
|
|
03d33fd3a4 | ||
|
|
0a6c2e6400 | ||
|
|
640b1313d7 | ||
|
|
66706a7c19 | ||
|
|
80664353b2 | ||
|
|
d6fbeb2798 | ||
|
|
b33817f8bb | ||
|
|
c97dbc46af | ||
|
|
b2d35f5cb8 | ||
|
|
855d46678a | ||
|
|
178a033e8b | ||
|
|
c8006f4637 | ||
|
|
5b65b3d543 | ||
|
|
2b52bd1644 | ||
|
|
9ee51ece65 | ||
|
|
2313f891bd | ||
|
|
42fe808292 | ||
|
|
4beefee4bf | ||
|
|
3301849f0f | ||
|
|
349ea900f5 | ||
|
|
1b85ac4586 | ||
|
|
2ec6df3b07 | ||
|
|
e72eda7aee | ||
|
|
4f24f5f304 | ||
|
|
12b5924939 | ||
|
|
d4188398f1 | ||
|
|
8ab625e517 | ||
|
|
edf6aa7d3b | ||
|
|
4aec17af93 | ||
|
|
c98b8856e6 | ||
|
|
4ec49a8585 | ||
|
|
627d275a3a | ||
|
|
84a84560c3 | ||
|
|
0e78a9028e | ||
|
|
24233748ec | ||
|
|
9840e5b621 | ||
|
|
8eede447db | ||
|
|
5b19f91ccf | ||
|
|
7fe9205b9f | ||
|
|
d798851e48 | ||
|
|
5af04b99dd | ||
|
|
38cdb2aba2 | ||
|
|
5629305131 | ||
|
|
e5854bbddd | ||
|
|
10305f3e94 | ||
|
|
2ca158c893 | ||
|
|
336089123f | ||
|
|
593724366f | ||
|
|
0e51f6146a | ||
|
|
5945da031e | ||
|
|
0364dbacbf | ||
|
|
7a11a9308c | ||
|
|
b9b13602ed | ||
|
|
23472033ee | ||
|
|
d8cc6b073e | ||
|
|
0264b4bca0 | ||
|
|
8b424b865e | ||
|
|
f4431ea115 | ||
|
|
fe8c36ddca | ||
|
|
d0ea78ca47 | ||
|
|
21c147b6e5 | ||
|
|
d3c575a6c6 | ||
|
|
d8b49e2b73 | ||
|
|
14c65a35f0 | ||
|
|
c47bb87f9f | ||
|
|
98c35e0025 | ||
|
|
7cc9107053 | ||
|
|
25ded505a3 | ||
|
|
6c0ba6089a | ||
|
|
70ee8c77a8 | ||
|
|
e9a43ed4ae | ||
|
|
a38d0b9145 | ||
|
|
4b0cd01fb7 | ||
|
|
0328cbad64 | ||
|
|
3b80811cfa | ||
|
|
10eb13007e | ||
|
|
dc15b62a7c | ||
|
|
4252134ba4 | ||
|
|
5a31cda4c3 | ||
|
|
34e6e8815a | ||
|
|
b5aee13b82 | ||
|
|
660f3d4732 | ||
|
|
abf5f7f90e | ||
|
|
d49da0101a | ||
|
|
fa8aca1ed4 | ||
|
|
829ac9caed | ||
|
|
f7a7310433 | ||
|
|
d156910453 | ||
|
|
1995d9e2f2 | ||
|
|
c223baee63 | ||
|
|
787052f074 | ||
|
|
042b916c0e | ||
|
|
57848d9262 | ||
|
|
bd6b046ce7 | ||
|
|
7c6e7bd300 | ||
|
|
8d7cd5e84d | ||
|
|
0cd16ae964 | ||
|
|
98691fcd2d | ||
|
|
3cba59dd7f | ||
|
|
a15879c623 | ||
|
|
5d501ee728 | ||
|
|
bc5e4541da | ||
|
|
567d1eaa19 | ||
|
|
2347e959d4 | ||
|
|
36143b5ecc | ||
|
|
7cd195b30a | ||
|
|
e66673aa64 | ||
|
|
3829bd6262 | ||
|
|
72360b51a5 | ||
|
|
4bbda69f1e | ||
|
|
4855b98554 | ||
|
|
cd40ec9526 | ||
|
|
a7daa63cb7 | ||
|
|
2e5592b3ab | ||
|
|
9b18cac96b | ||
|
|
c19c1e7ec5 | ||
|
|
15cf0095d3 | ||
|
|
3ff7db34a2 | ||
|
|
d441a34791 | ||
|
|
f4d33ff4b4 | ||
|
|
683040b324 | ||
|
|
d9cf99b6a5 | ||
|
|
a6805bb8d9 | ||
|
|
a0b044186b | ||
|
|
01af4ad9c3 | ||
|
|
ed324578a2 | ||
|
|
05d6b54703 | ||
|
|
78d0e5e671 | ||
|
|
85ccc1bab3 | ||
|
|
4646be7db4 | ||
|
|
8eaddf326b | ||
|
|
db68f61595 | ||
|
|
7eca26e87b | ||
|
|
e50ec28153 | ||
|
|
f7f2c99c28 | ||
|
|
c08e0863be | ||
|
|
f9b360663b | ||
|
|
3add9ffbde | ||
|
|
f296669c0f | ||
|
|
de638df104 | ||
|
|
8dc60543c8 | ||
|
|
f8cd049ecc | ||
|
|
72946549ed | ||
|
|
bad4fc09a7 | ||
|
|
aac79ca103 | ||
|
|
843f99886c | ||
|
|
647453a614 | ||
|
|
d4ffb69424 | ||
|
|
0711dca9d9 | ||
|
|
f5d4b64909 | ||
|
|
b327f38832 | ||
|
|
75c3746ce2 | ||
|
|
b329f0b5df | ||
|
|
12a5cc07e0 | ||
|
|
27b5d92563 | ||
|
|
34476c449a | ||
|
|
795a59aba4 | ||
|
|
243fa94ce2 | ||
|
|
11995fec50 | ||
|
|
c654eb481c | ||
|
|
5c37f5994d | ||
|
|
952a61b62e | ||
|
|
cf8f805d36 | ||
|
|
2bc886dc02 | ||
|
|
b5e6d9c4ca | ||
|
|
3ae2a22a05 | ||
|
|
146a8eb101 | ||
|
|
4428e8e8b3 | ||
|
|
00e47b11d2 | ||
|
|
cf8723de0d | ||
|
|
8bfc319f8e | ||
|
|
1c5b05ad31 | ||
|
|
b7e2cac2aa | ||
|
|
93d6a5ba4d | ||
|
|
5d711972b8 | ||
|
|
541943ee04 | ||
|
|
dcdd119f69 | ||
|
|
a0bc06b703 | ||
|
|
5e33dfe59d | ||
|
|
2a4e9a358f | ||
|
|
f7b642cff7 | ||
|
|
0d8407440c | ||
|
|
1df4b746da | ||
|
|
f3f7f6e1dc | ||
|
|
38abe1e1b7 | ||
|
|
6e1d83c8a8 | ||
|
|
8032dde383 | ||
|
|
3da17724ad | ||
|
|
f3bcb3de0e | ||
|
|
325ec7d324 | ||
|
|
82d913741b | ||
|
|
3c36d871fa | ||
|
|
2becdace96 | ||
|
|
115a947f08 | ||
|
|
68e3e442f9 | ||
|
|
e432619d11 | ||
|
|
b63e3a3352 | ||
|
|
ef09bf065a | ||
|
|
a1b7fef045 | ||
|
|
067e35a8be | ||
|
|
0522047c96 | ||
|
|
3724b50ef9 | ||
|
|
b801b7b670 | ||
|
|
b7aab2dbad | ||
|
|
89e42ffb4b | ||
|
|
6aae4a7378 | ||
|
|
7d4a4300c2 | ||
|
|
31d4ec28bd | ||
|
|
0a5bfb4fda | ||
|
|
12d0b15679 | ||
|
|
cb7dcb011e | ||
|
|
71579c7219 | ||
|
|
2f8a874215 | ||
|
|
ad6f600bb1 | ||
|
|
de4f41eab7 | ||
|
|
e73f086b0d | ||
|
|
8cf098415e | ||
|
|
977e19840d | ||
|
|
d975c2f76e | ||
|
|
0676801b8c | ||
|
|
82aa96e9b1 | ||
|
|
cb65553449 | ||
|
|
f47a1bd622 | ||
|
|
205d372c68 | ||
|
|
07a1243b40 | ||
|
|
ece343d2c2 | ||
|
|
be95a4fe29 | ||
|
|
6accee7716 | ||
|
|
e63f22703e | ||
|
|
fa390dc311 | ||
|
|
17fdf5eca2 | ||
|
|
72b3c1a673 | ||
|
|
6675d36e25 | ||
|
|
d0bec3175f | ||
|
|
79e68b6c4d | ||
|
|
5cb74cacd8 | ||
|
|
9c8e6e05b6 | ||
|
|
431774d1f6 | ||
|
|
7d5474e979 | ||
|
|
6b78e50cef | ||
|
|
28769d608e | ||
|
|
a22588bcb9 | ||
|
|
b8c5e5609f | ||
|
|
b81229e1f9 | ||
|
|
815a76f558 | ||
|
|
ea138cd1f1 | ||
|
|
9922f1f877 | ||
|
|
1438b79e80 | ||
|
|
01f3e2969b | ||
|
|
744da03955 | ||
|
|
b28d67b6b0 | ||
|
|
cf890692f1 | ||
|
|
6932023f4d | ||
|
|
fff17fe8fe | ||
|
|
5544615a59 | ||
|
|
346ba14f15 | ||
|
|
4d18195ebc | ||
|
|
dd3e7b3895 | ||
|
|
64a3b6546a | ||
|
|
bad07a7f66 | ||
|
|
88bd814bf1 | ||
|
|
4f9ae5de07 | ||
|
|
78f72a4516 | ||
|
|
c04693d651 | ||
|
|
12191911ba | ||
|
|
d7f27477f4 | ||
|
|
5bad15d7ea | ||
|
|
cd099edf2d | ||
|
|
1e12219775 | ||
|
|
d8c2af56c1 | ||
|
|
cc11bb037c | ||
|
|
121dd98508 | ||
|
|
2eddbd0ac4 | ||
|
|
ee86ea8839 | ||
|
|
a2ad33dca6 | ||
|
|
5b2b7b1ffb | ||
|
|
dc72b3566d | ||
|
|
c47e1174d4 | ||
|
|
093eeb27e9 | ||
|
|
dab23c4a21 | ||
|
|
38a169bec1 | ||
|
|
dc77d6500f | ||
|
|
8262c7dc22 | ||
|
|
44f28d10ee | ||
|
|
44ad466a32 | ||
|
|
a839f4c461 | ||
|
|
9a51c6a128 | ||
|
|
2608b0cf12 | ||
|
|
aa766d1560 | ||
|
|
a7ed13b25f | ||
|
|
2d90916067 | ||
|
|
91e5a23ff2 | ||
|
|
d4ae66c371 | ||
|
|
70fb574717 | ||
|
|
0820f16ca8 | ||
|
|
49f1e5f428 | ||
|
|
238692ad77 | ||
|
|
5f95583da7 | ||
|
|
964fb2aa6f | ||
|
|
7c0d36b760 | ||
|
|
b4d18c7fc6 | ||
|
|
3e6e51cf5c | ||
|
|
d309bd9f9f | ||
|
|
203f7230ec | ||
|
|
156e548341 | ||
|
|
526ef45f30 | ||
|
|
d7f7fcd9c7 | ||
|
|
0fd542c3e0 | ||
|
|
413908e5a4 | ||
|
|
84ef175287 | ||
|
|
5234c8390f | ||
|
|
21f7690570 | ||
|
|
edb39c29a2 | ||
|
|
1247d94ba6 | ||
|
|
ed9a821caa | ||
|
|
330552ea49 | ||
|
|
7c609859ee | ||
|
|
ed10c308fa | ||
|
|
b91566edd1 | ||
|
|
29520abb3b | ||
|
|
2491de1eef | ||
|
|
ec207d1bb2 | ||
|
|
688b3404a2 | ||
|
|
cd6ef1e7d7 | ||
|
|
2b518d621f | ||
|
|
1ae4f1d329 | ||
|
|
160df55c56 | ||
|
|
e0b0a67b86 | ||
|
|
0e5cbd38b2 | ||
|
|
feb0bb0a59 | ||
|
|
d796e11f8f | ||
|
|
0895858d8e | ||
|
|
4efb2f7bd2 | ||
|
|
eeafc706e8 | ||
|
|
cf6d8d0631 | ||
|
|
8f44164443 | ||
|
|
1001f48416 | ||
|
|
3be228f64c | ||
|
|
670c7e7a75 | ||
|
|
c4b1a2b68f | ||
|
|
b65bd16e45 | ||
|
|
0f120354b6 | ||
|
|
69e3b405d9 | ||
|
|
3dd8f2305a | ||
|
|
9e75066819 | ||
|
|
efb65daa36 | ||
|
|
e077bf1ebc | ||
|
|
c35e829a76 | ||
|
|
d4f854e5b2 | ||
|
|
35c0fe6789 | ||
|
|
22f62414f9 | ||
|
|
9206b15c4e | ||
|
|
5edac5e15a | ||
|
|
1c3189734c | ||
|
|
c662b23735 | ||
|
|
627fecb19e | ||
|
|
2a069f22c6 | ||
|
|
3f4ffea6f2 | ||
|
|
251e1b137f | ||
|
|
efbcadeca7 | ||
|
|
e4d33cf579 | ||
|
|
5855da4722 | ||
|
|
5d5e1df1dc | ||
|
|
cef13e11f5 | ||
|
|
b7fbfd050e | ||
|
|
e088b4f90f | ||
|
|
c857ed4f72 | ||
|
|
1998606a90 | ||
|
|
b0bb4cde2e | ||
|
|
d2acc4b401 | ||
|
|
a53c6026cd | ||
|
|
ae5edcc23b | ||
|
|
296e2f90ab | ||
|
|
1ccb4be02b | ||
|
|
421662ec88 | ||
|
|
39be113b1f | ||
|
|
2101b0e210 | ||
|
|
b1327c56f7 | ||
|
|
ae03b16785 | ||
|
|
7e16bd2cae | ||
|
|
508ac09939 | ||
|
|
94f7606db6 | ||
|
|
de5be4a693 | ||
|
|
03a6b439f6 | ||
|
|
742910838e | ||
|
|
bb311cfbed | ||
|
|
518dc6ca26 | ||
|
|
6a1a681fd2 | ||
|
|
dd878d1851 | ||
|
|
6ed813c122 | ||
|
|
1ec93ca2a2 | ||
|
|
f32ba07f94 | ||
|
|
50cd3f16de | ||
|
|
37da3c4b42 | ||
|
|
79bae4d6bb | ||
|
|
23f7554188 | ||
|
|
3ff248ebfe | ||
|
|
4e1a5aae96 | ||
|
|
8e70880af1 | ||
|
|
3fea8fade8 | ||
|
|
e7aff57122 | ||
|
|
339d11badf | ||
|
|
99260caef9 | ||
|
|
c19af5cbb4 | ||
|
|
b54181ff9b | ||
|
|
86c45be582 | ||
|
|
b5e0351c3e | ||
|
|
150b2318ed | ||
|
|
35c4a8e65e | ||
|
|
fc39ccab6b | ||
|
|
9a33fb9317 | ||
|
|
866bc6a49f | ||
|
|
e8619330e8 | ||
|
|
193dc86965 | ||
|
|
51fa2ab0a2 | ||
|
|
2d8c3edbf8 | ||
|
|
4590071287 | ||
|
|
ac3b6c18a5 | ||
|
|
f3ef847539 | ||
|
|
16f2353723 | ||
|
|
da5317cc9d | ||
|
|
e0cb91a922 | ||
|
|
482b370540 | ||
|
|
66283fb625 | ||
|
|
93c849ef0d | ||
|
|
6279945003 | ||
|
|
dcb6c972a2 | ||
|
|
af0441cfd2 | ||
|
|
bbb63b1ca9 | ||
|
|
ac54d19eba | ||
|
|
5807dd9279 | ||
|
|
94bfdf3b4b | ||
|
|
ed7d5c2b5b | ||
|
|
1ce02e13c3 | ||
|
|
8ef0b12eb7 | ||
|
|
e6d83116ae | ||
|
|
22c3839168 | ||
|
|
4619b32dc0 | ||
|
|
ad921890c1 | ||
|
|
14ce500508 | ||
|
|
acba58ac59 | ||
|
|
9c21da3363 | ||
|
|
febf6115a0 | ||
|
|
11b5bac7bf | ||
|
|
b61bf2f0e8 | ||
|
|
19f45df02b | ||
|
|
2ab4058de0 | ||
|
|
f2277c3fec | ||
|
|
fb49a10e2c | ||
|
|
f049a57eec |
+2
-1
@@ -1 +1,2 @@
|
|||||||
|
*.at diff=autotest
|
||||||
|
*.texi diff=texinfo
|
||||||
|
|||||||
+12
@@ -0,0 +1,12 @@
|
|||||||
|
# To use this gitconfig file, run
|
||||||
|
#
|
||||||
|
# git config --local include.path ../.gitconfig
|
||||||
|
#
|
||||||
|
# It adds an `[include]` section in .git/config.
|
||||||
|
# See <https://git-scm.com/docs/git-config#_includes>.
|
||||||
|
|
||||||
|
[diff "autotest"]
|
||||||
|
xfuncname = "^((m4_define|m4_pushdef|AT_SETUP).*)$"
|
||||||
|
|
||||||
|
[diff "texinfo"]
|
||||||
|
xfuncname = "^@node .*$"
|
||||||
+1
-1
@@ -1 +1 @@
|
|||||||
3.6.2
|
3.7.91
|
||||||
|
|||||||
+92
-45
@@ -29,12 +29,13 @@ jobs:
|
|||||||
clone: true
|
clone: true
|
||||||
dist: bionic
|
dist: bionic
|
||||||
script:
|
script:
|
||||||
- sudo apt-get install -qq autoconf automake autopoint flex gettext graphviz help2man m4 texinfo
|
- sudo apt-get install -qq autoconf automake autopoint flex gettext gperf graphviz help2man m4 texinfo
|
||||||
- autoconf --version
|
- autoconf --version
|
||||||
- automake --version
|
- automake --version
|
||||||
- autopoint --version
|
- autopoint --version
|
||||||
- dot -V
|
- dot -V
|
||||||
- gettext --version
|
- gettext --version
|
||||||
|
- gperf --version
|
||||||
- help2man --version
|
- help2man --version
|
||||||
- makeinfo --version
|
- makeinfo --version
|
||||||
- m4 --version
|
- m4 --version
|
||||||
@@ -43,12 +44,15 @@ jobs:
|
|||||||
- git fetch --unshallow || true
|
- git fetch --unshallow || true
|
||||||
- git submodule update --init --recursive
|
- git submodule update --init --recursive
|
||||||
|
|
||||||
|
# As of 2021-08, we don't have Autoconf 2.71 on Ubuntu.
|
||||||
|
- sed -i 's/AC_PREREQ(\[2\.71\])/AC_PREREQ([2.69])/g' configure.ac
|
||||||
- ./bootstrap
|
- ./bootstrap
|
||||||
- ./configure --enable-gcc-warnings || { cat config.log && false; }
|
- ./configure --enable-gcc-warnings || { cat config.log && false; }
|
||||||
- make -j2
|
- make -j2
|
||||||
- make -j2 dist-xz
|
- make -j2 dist-xz
|
||||||
# Can help understanding why we get "dirty" tarballs.
|
# Can help understanding why we get "dirty" tarballs.
|
||||||
- git status
|
- git status
|
||||||
|
- git diff
|
||||||
- dist=$(echo bison*.xz)
|
- dist=$(echo bison*.xz)
|
||||||
|
|
||||||
# Unfortunately we cannot deterministically know the name of the tarball without the full
|
# Unfortunately we cannot deterministically know the name of the tarball without the full
|
||||||
@@ -69,55 +73,57 @@ jobs:
|
|||||||
|
|
||||||
# Start with three completely different environments, to get errors asap.
|
# Start with three completely different environments, to get errors asap.
|
||||||
|
|
||||||
- name: "GCC 10 -O3"
|
- name: "GCC 11 -O3"
|
||||||
stage: check
|
stage: check
|
||||||
os: linux
|
os: linux
|
||||||
dist: bionic
|
dist: bionic
|
||||||
addons: &gcc10
|
addons: &gcc11
|
||||||
apt:
|
apt:
|
||||||
sources:
|
sources:
|
||||||
# See https://github.com/travis-ci/apt-source-safelist/issues/410.
|
# See https://github.com/travis-ci/apt-source-safelist/issues/410.
|
||||||
- sourceline: 'ppa:ubuntu-toolchain-r/test'
|
- sourceline: 'ppa:ubuntu-toolchain-r/test'
|
||||||
packages: g++-10
|
packages: g++-11
|
||||||
env:
|
env:
|
||||||
- CC=gcc-10
|
- CC=gcc-11
|
||||||
- CXX=g++-10
|
- CXX=g++-11
|
||||||
- CONFIGUREFLAGS='CPPFLAGS=-DNDEBUG CFLAGS=-O3 CXXFLAGS=-O3'
|
- CONFIGUREFLAGS='CPPFLAGS=-DNDEBUG CFLAGS=-O3 CXXFLAGS=-O3'
|
||||||
|
|
||||||
# ASAN is time consuming, and we timeout the 50min granted by
|
# 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.
|
# Travis if we run all the tests in one go. Run in two parts.
|
||||||
- name: "Clang 10 libc++ and ASAN part 1"
|
- name: "Clang 11 libc++ and ASAN part 1"
|
||||||
stage: check
|
stage: check
|
||||||
os: linux
|
os: linux
|
||||||
dist: bionic
|
dist: bionic
|
||||||
addons: &clang10
|
addons: &clang11
|
||||||
apt:
|
apt:
|
||||||
sources:
|
sources:
|
||||||
# See https://github.com/travis-ci/apt-source-safelist/issues/410.
|
# See https://github.com/travis-ci/apt-source-safelist/issues/410.
|
||||||
- sourceline: 'ppa:ubuntu-toolchain-r/test'
|
- sourceline: 'ppa:ubuntu-toolchain-r/test'
|
||||||
- sourceline: 'deb http://apt.llvm.org/bionic/ llvm-toolchain-bionic-10 main'
|
- sourceline: 'deb http://apt.llvm.org/bionic/ llvm-toolchain-bionic-11 main'
|
||||||
key_url: 'https://apt.llvm.org/llvm-snapshot.gpg.key'
|
key_url: 'https://apt.llvm.org/llvm-snapshot.gpg.key'
|
||||||
packages:
|
packages:
|
||||||
- clang-10
|
- clang-11
|
||||||
- libc++-10-dev
|
- libc++-11-dev
|
||||||
- libc++abi-10-dev
|
- libc++abi-11-dev
|
||||||
env:
|
env:
|
||||||
# Do not use ASAN with ubuntu's libc++: https://bugs.llvm.org/show_bug.cgi?id=17379
|
# Do not use ASAN with ubuntu's libc++: https://bugs.llvm.org/show_bug.cgi?id=17379
|
||||||
- CC='clang-10 -fsanitize=address'
|
- CC='clang-11 -fsanitize=address'
|
||||||
- CXX='clang++-10 -fsanitize=address -stdlib=libc++'
|
- CXX='clang++-11 -fsanitize=address -stdlib=libc++'
|
||||||
- PART=1
|
- PART=1
|
||||||
|
|
||||||
- name: "Clang 10 libc++ and ASAN part 2"
|
- name: "Clang 11 libc++ and ASAN part 2"
|
||||||
stage: check
|
stage: check
|
||||||
os: linux
|
os: linux
|
||||||
dist: bionic
|
dist: bionic
|
||||||
addons: *clang10
|
addons: *clang11
|
||||||
env:
|
env:
|
||||||
# Do not use ASAN with ubuntu's libc++: https://bugs.llvm.org/show_bug.cgi?id=17379
|
# Do not use ASAN with ubuntu's libc++: https://bugs.llvm.org/show_bug.cgi?id=17379
|
||||||
- CC='clang-10 -fsanitize=address'
|
- CC='clang-11 -fsanitize=address'
|
||||||
- CXX='clang++-10 -fsanitize=address -stdlib=libc++'
|
- CXX='clang++-11 -fsanitize=address -stdlib=libc++'
|
||||||
- PART=2
|
- PART=2
|
||||||
|
|
||||||
|
# See https://github.com/simd-everywhere/simde/blob/master/.travis.yml
|
||||||
|
# and https://software.intel.com/content/www/us/en/develop/documentation/get-started-with-intel-oneapi-render-linux/top/configure-your-system.html.
|
||||||
- name: "ICC"
|
- name: "ICC"
|
||||||
stage: check
|
stage: check
|
||||||
os: linux
|
os: linux
|
||||||
@@ -126,7 +132,7 @@ jobs:
|
|||||||
- CC=icc
|
- CC=icc
|
||||||
- CXX=icpc
|
- CXX=icpc
|
||||||
install:
|
install:
|
||||||
- source /opt/intel/inteloneapi/compiler/latest/env/vars.sh
|
- source /opt/intel/oneapi/compiler/latest/env/vars.sh
|
||||||
addons:
|
addons:
|
||||||
apt:
|
apt:
|
||||||
sources:
|
sources:
|
||||||
@@ -135,49 +141,69 @@ jobs:
|
|||||||
packages:
|
packages:
|
||||||
- intel-oneapi-icc
|
- intel-oneapi-icc
|
||||||
|
|
||||||
- name: "ARM64: GCC 10 -O3 part 1"
|
- name: "ARM64: GCC 11 -O2 part 1"
|
||||||
stage: check
|
stage: check
|
||||||
os: linux
|
os: linux
|
||||||
arch: arm64
|
arch: arm64
|
||||||
dist: bionic
|
dist: bionic
|
||||||
addons: *gcc10
|
addons: *gcc11
|
||||||
env:
|
env:
|
||||||
- CC=gcc-10
|
- CC=gcc-11
|
||||||
- CXX=g++-10
|
- CXX=g++-11
|
||||||
- CONFIGUREFLAGS='CPPFLAGS=-DNDEBUG CFLAGS=-O3 CXXFLAGS=-O3'
|
- CONFIGUREFLAGS='CPPFLAGS=-DNDEBUG CFLAGS=-O2 CXXFLAGS=-O2'
|
||||||
- PART=1
|
- PART=1
|
||||||
|
|
||||||
# GCC10 on PPC seems to be buggy.
|
- name: "PPC64le: GCC 11 -O2 part 1"
|
||||||
# E.g., https://travis-ci.org/github/akimd/bison/jobs/687812428.
|
|
||||||
- name: "PPC64le: GCC 9 part 1"
|
|
||||||
stage: check
|
stage: check
|
||||||
os: linux
|
os: linux
|
||||||
arch: ppc64le
|
arch: ppc64le
|
||||||
dist: bionic
|
dist: bionic
|
||||||
addons: *gcc10
|
addons:
|
||||||
|
apt:
|
||||||
|
sources:
|
||||||
|
# See https://github.com/travis-ci/apt-source-safelist/issues/410.
|
||||||
|
- sourceline: 'ppa:ubuntu-toolchain-r/test'
|
||||||
|
packages: g++-11
|
||||||
env:
|
env:
|
||||||
- CC=gcc-9
|
- CC=gcc-11
|
||||||
- CXX=g++-9
|
- CXX=g++-11
|
||||||
- CONFIGUREFLAGS='CFLAGS=-O3 CXXFLAGS=-O3'
|
- CONFIGUREFLAGS='CFLAGS=-O2 CXXFLAGS=-O2'
|
||||||
- PART=1
|
- PART=1
|
||||||
|
|
||||||
- name: "s390x: GCC 10 part 1"
|
- name: "s390x: GCC 11 -O2 part 1"
|
||||||
stage: check
|
stage: check
|
||||||
os: linux
|
os: linux
|
||||||
arch: s390x
|
arch: s390x
|
||||||
dist: bionic
|
dist: bionic
|
||||||
addons: *gcc10
|
addons: *gcc11
|
||||||
env:
|
env:
|
||||||
- CC=gcc-10
|
- CC=gcc-11
|
||||||
- CXX=g++-10
|
- CXX=g++-11
|
||||||
- CONFIGUREFLAGS='CFLAGS=-O3 CXXFLAGS=-O3'
|
- CONFIGUREFLAGS='CFLAGS=-O2 CXXFLAGS=-O2'
|
||||||
- PART=1
|
- PART=1
|
||||||
|
|
||||||
## ----- ##
|
## ----- ##
|
||||||
## GCC. ##
|
## GCC. ##
|
||||||
## ----- ##
|
## ----- ##
|
||||||
|
|
||||||
- name: "GCC 9 with sanitizers part 1"
|
- name: "GCC 10 with sanitizers part 1"
|
||||||
|
stage: check
|
||||||
|
os: linux
|
||||||
|
dist: bionic
|
||||||
|
addons:
|
||||||
|
apt:
|
||||||
|
sources:
|
||||||
|
# See https://github.com/travis-ci/apt-source-safelist/issues/410.
|
||||||
|
- sourceline: 'ppa:ubuntu-toolchain-r/test'
|
||||||
|
packages: g++-10
|
||||||
|
env:
|
||||||
|
- CC='gcc-10 -fsanitize=undefined,address -fno-omit-frame-pointer'
|
||||||
|
- CXX='g++-10 -fsanitize=undefined,address -fno-omit-frame-pointer'
|
||||||
|
- CONFIGUREFLAGS='CFLAGS=-O1 CXXFLAGS=-O1'
|
||||||
|
- PART=1
|
||||||
|
|
||||||
|
# With glr2.cc, we run out of time with the full test suite.
|
||||||
|
- name: "GCC 9 part 1"
|
||||||
stage: check
|
stage: check
|
||||||
os: linux
|
os: linux
|
||||||
dist: bionic
|
dist: bionic
|
||||||
@@ -188,12 +214,12 @@ jobs:
|
|||||||
- sourceline: 'ppa:ubuntu-toolchain-r/test'
|
- sourceline: 'ppa:ubuntu-toolchain-r/test'
|
||||||
packages: g++-9
|
packages: g++-9
|
||||||
env:
|
env:
|
||||||
- CC='gcc-9 -fsanitize=undefined,address -fno-omit-frame-pointer'
|
- CC=gcc-9
|
||||||
- CXX='g++-9 -fsanitize=undefined,address -fno-omit-frame-pointer'
|
- CXX=g++-9
|
||||||
- CONFIGUREFLAGS='CFLAGS=-O1 CXXFLAGS=-O1'
|
|
||||||
- PART=1
|
- PART=1
|
||||||
|
|
||||||
- name: "GCC 8"
|
# With glr2.cc, we run out of time with the full test suite.
|
||||||
|
- name: "GCC 8 part 1"
|
||||||
stage: check
|
stage: check
|
||||||
os: linux
|
os: linux
|
||||||
dist: bionic
|
dist: bionic
|
||||||
@@ -203,6 +229,7 @@ jobs:
|
|||||||
env:
|
env:
|
||||||
- CC=gcc-8
|
- CC=gcc-8
|
||||||
- CXX=g++-8
|
- CXX=g++-8
|
||||||
|
- PART=1
|
||||||
|
|
||||||
- name: "GCC 7"
|
- name: "GCC 7"
|
||||||
stage: check
|
stage: check
|
||||||
@@ -291,7 +318,28 @@ jobs:
|
|||||||
## Clang. ##
|
## Clang. ##
|
||||||
## ------- ##
|
## ------- ##
|
||||||
|
|
||||||
- name: "Clang 9 -O3"
|
- name: "Clang 10 -O3, libc++, part 1"
|
||||||
|
stage: check
|
||||||
|
os: linux
|
||||||
|
dist: bionic
|
||||||
|
addons:
|
||||||
|
apt:
|
||||||
|
sources:
|
||||||
|
# See https://github.com/travis-ci/apt-source-safelist/issues/410.
|
||||||
|
- sourceline: 'ppa:ubuntu-toolchain-r/test'
|
||||||
|
- sourceline: 'deb http://apt.llvm.org/bionic/ llvm-toolchain-bionic-10 main'
|
||||||
|
key_url: 'https://apt.llvm.org/llvm-snapshot.gpg.key'
|
||||||
|
packages:
|
||||||
|
- clang-10
|
||||||
|
- libc++-10-dev
|
||||||
|
- libc++abi-10-dev
|
||||||
|
env:
|
||||||
|
- CC='clang-10'
|
||||||
|
- CXX='clang++-10 -stdlib=libc++'
|
||||||
|
- CONFIGUREFLAGS='CPPFLAGS=-DNDEBUG CFLAGS=-O3 CXXFLAGS=-O3'
|
||||||
|
- PART=1
|
||||||
|
|
||||||
|
- name: "Clang 9 and libc++"
|
||||||
stage: check
|
stage: check
|
||||||
os: linux
|
os: linux
|
||||||
dist: bionic
|
dist: bionic
|
||||||
@@ -309,9 +357,8 @@ jobs:
|
|||||||
env:
|
env:
|
||||||
- CC='clang-9'
|
- CC='clang-9'
|
||||||
- CXX='clang++-9 -stdlib=libc++'
|
- CXX='clang++-9 -stdlib=libc++'
|
||||||
- CONFIGUREFLAGS='CPPFLAGS=-DNDEBUG CFLAGS=-O3 CXXFLAGS=-O3'
|
|
||||||
|
|
||||||
- name: "Clang 8"
|
- name: "Clang 8 and libc++"
|
||||||
stage: check
|
stage: check
|
||||||
os: linux
|
os: linux
|
||||||
dist: bionic
|
dist: bionic
|
||||||
@@ -325,7 +372,7 @@ jobs:
|
|||||||
- CC=clang-8
|
- CC=clang-8
|
||||||
- CXX='clang++-8 -stdlib=libc++'
|
- CXX='clang++-8 -stdlib=libc++'
|
||||||
|
|
||||||
- name: "Clang 7"
|
- name: "Clang 7 and libc++"
|
||||||
stage: check
|
stage: check
|
||||||
os: linux
|
os: linux
|
||||||
dist: bionic
|
dist: bionic
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ and nasty bugs.
|
|||||||
|
|
||||||
-----
|
-----
|
||||||
|
|
||||||
Copyright (C) 1998-2015, 2018-2020 Free Software Foundation, Inc.
|
Copyright (C) 1998-2015, 2018-2021 Free Software Foundation, Inc.
|
||||||
|
|
||||||
This file is part of Bison, the GNU Compiler Compiler.
|
This file is part of Bison, the GNU Compiler Compiler.
|
||||||
|
|
||||||
@@ -39,4 +39,4 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|||||||
GNU General Public License for more details.
|
GNU General Public License for more details.
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
You should have received a copy of the GNU General Public License
|
||||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
GNU GENERAL PUBLIC LICENSE
|
GNU GENERAL PUBLIC LICENSE
|
||||||
Version 3, 29 June 2007
|
Version 3, 29 June 2007
|
||||||
|
|
||||||
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
|
Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
|
||||||
Everyone is permitted to copy and distribute verbatim copies
|
Everyone is permitted to copy and distribute verbatim copies
|
||||||
of this license document, but changing it is not allowed.
|
of this license document, but changing it is not allowed.
|
||||||
|
|
||||||
@@ -645,7 +645,7 @@ the "copyright" line and a pointer to where the full notice is found.
|
|||||||
GNU General Public License for more details.
|
GNU General Public License for more details.
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
You should have received a copy of the GNU General Public License
|
||||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
Also add information on how to contact you by electronic and paper mail.
|
Also add information on how to contact you by electronic and paper mail.
|
||||||
|
|
||||||
@@ -664,11 +664,11 @@ might be different; for a GUI interface, you would use an "about box".
|
|||||||
You should also get your employer (if you work as a programmer) or school,
|
You should also get your employer (if you work as a programmer) or school,
|
||||||
if any, to sign a "copyright disclaimer" for the program, if necessary.
|
if any, to sign a "copyright disclaimer" for the program, if necessary.
|
||||||
For more information on this, and how to apply and follow the GNU GPL, see
|
For more information on this, and how to apply and follow the GNU GPL, see
|
||||||
<http://www.gnu.org/licenses/>.
|
<https://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
The GNU General Public License does not permit incorporating your program
|
The GNU General Public License does not permit incorporating your program
|
||||||
into proprietary programs. If your program is a subroutine library, you
|
into proprietary programs. If your program is a subroutine library, you
|
||||||
may consider it more useful to permit linking proprietary applications with
|
may consider it more useful to permit linking proprietary applications with
|
||||||
the library. If this is what you want to do, use the GNU Lesser General
|
the library. If this is what you want to do, use the GNU Lesser General
|
||||||
Public License instead of this License. But first, please read
|
Public License instead of this License. But first, please read
|
||||||
<http://www.gnu.org/philosophy/why-not-lgpl.html>.
|
<https://www.gnu.org/licenses/why-not-lgpl.html>.
|
||||||
|
|||||||
+209
-210
File diff suppressed because it is too large
Load Diff
+18
-2
@@ -1,6 +1,6 @@
|
|||||||
## Process this file with automake to produce Makefile.in.
|
## Process this file with automake to produce Makefile.in.
|
||||||
|
|
||||||
# Copyright (C) 2001-2015, 2018-2020 Free Software Foundation, Inc.
|
# Copyright (C) 2001-2015, 2018-2021 Free Software Foundation, Inc.
|
||||||
#
|
#
|
||||||
# This program is free software: you can redistribute it and/or modify
|
# This program is free software: you can redistribute it and/or modify
|
||||||
# it under the terms of the GNU General Public License as published by
|
# it under the terms of the GNU General Public License as published by
|
||||||
@@ -13,7 +13,7 @@
|
|||||||
# GNU General Public License for more details.
|
# GNU General Public License for more details.
|
||||||
#
|
#
|
||||||
# You should have received a copy of the GNU General Public License
|
# You should have received a copy of the GNU General Public License
|
||||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
AUTOMAKE_OPTIONS = subdir-objects
|
AUTOMAKE_OPTIONS = subdir-objects
|
||||||
ACLOCAL_AMFLAGS = -I m4
|
ACLOCAL_AMFLAGS = -I m4
|
||||||
@@ -76,6 +76,13 @@ include tests/local.mk
|
|||||||
clean-local:
|
clean-local:
|
||||||
rm -rf $(CLEANDIRS)
|
rm -rf $(CLEANDIRS)
|
||||||
|
|
||||||
|
.PHONY: gitsort
|
||||||
|
gitsort:
|
||||||
|
cd $(srcdir) \
|
||||||
|
&& for i in $$(git ls-files '*.gitignore' | grep -v doc); do \
|
||||||
|
LC_ALL=C sort $$i -o $$i; \
|
||||||
|
done
|
||||||
|
|
||||||
# See comments in build-aux/git-version-gen. However, we make .version depend
|
# 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
|
# 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
|
# working copy (for example, when you run autoreconf && make). Allowing these
|
||||||
@@ -131,3 +138,12 @@ gen-ChangeLog:
|
|||||||
# Useful to debug.
|
# Useful to debug.
|
||||||
.c.i:
|
.c.i:
|
||||||
$(CC) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -o $@ -E $<
|
$(CC) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -o $@ -E $<
|
||||||
|
|
||||||
|
.PHONY: codespell
|
||||||
|
CODESPELL = codespell
|
||||||
|
codespell:
|
||||||
|
$(AM_V_GEN) cd $(srcdir) \
|
||||||
|
&& $(CODESPELL) \
|
||||||
|
--regex "[\\w\\-'’\`]+\+*" \
|
||||||
|
--ignore-words-list "ba,circularly,cloneable,copyable,define'd,dout,froms,iff,ifset,od,ois" \
|
||||||
|
$$(git ls-files data doc lib src tests)
|
||||||
|
|||||||
@@ -36,7 +36,7 @@ to the bison package.
|
|||||||
|
|
||||||
-----
|
-----
|
||||||
|
|
||||||
Copyright (C) 2002, 2005, 2009-2015, 2018-2020 Free Software Foundation,
|
Copyright (C) 2002, 2005, 2009-2015, 2018-2021 Free Software Foundation,
|
||||||
Inc.
|
Inc.
|
||||||
|
|
||||||
This file is part of Bison, the GNU Compiler Compiler.
|
This file is part of Bison, the GNU Compiler Compiler.
|
||||||
@@ -52,4 +52,4 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|||||||
GNU General Public License for more details.
|
GNU General Public License for more details.
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
You should have received a copy of the GNU General Public License
|
||||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ simple desk calculators to complex programming languages.
|
|||||||
|
|
||||||
Bison is upward compatible with Yacc: all properly-written Yacc grammars
|
Bison is upward compatible with Yacc: all properly-written Yacc grammars
|
||||||
work with Bison with no change. Anyone familiar with Yacc should be able to
|
work with Bison with no change. Anyone familiar with Yacc should be able to
|
||||||
use Bison with little trouble. You need to be fluent in C, C++ or Java
|
use Bison with little trouble. You need to be fluent in C, C++, D or Java
|
||||||
programming in order to use Bison.
|
programming in order to use Bison.
|
||||||
|
|
||||||
Bison and the parsers it generates are portable, they do not require any
|
Bison and the parsers it generates are portable, they do not require any
|
||||||
@@ -17,17 +17,18 @@ GNU Bison's home page is https://gnu.org/software/bison/.
|
|||||||
|
|
||||||
# Installation
|
# Installation
|
||||||
## Build from git
|
## Build from git
|
||||||
Here are basic installation instructions for a repository checkout:
|
The [README-hacking.md file](README-hacking.md) is about building, modifying
|
||||||
|
and checking Bison. See its "Working from the Repository" section to build
|
||||||
|
Bison from the git repo. Roughly, run:
|
||||||
|
|
||||||
$ git submodule update --init
|
$ git submodule update --init
|
||||||
$ ./bootstrap
|
$ ./bootstrap
|
||||||
|
|
||||||
then proceed with the usual `configure && make` steps.
|
then proceed with the usual `configure && make` steps.
|
||||||
|
|
||||||
The file README-hacking.md is about building, modifying and checking Bison.
|
|
||||||
|
|
||||||
## Build from tarball
|
## Build from tarball
|
||||||
See the file INSTALL for generic compilation and installation instructions.
|
See the [INSTALL file](INSTALL) for generic compilation and installation
|
||||||
|
instructions.
|
||||||
|
|
||||||
Bison requires GNU m4 1.4.6 or later. See
|
Bison requires GNU m4 1.4.6 or later. See
|
||||||
https://ftp.gnu.org/gnu/m4/m4-1.4.6.tar.gz.
|
https://ftp.gnu.org/gnu/m4/m4-1.4.6.tar.gz.
|
||||||
@@ -41,9 +42,11 @@ installing it. In that case, do not use `src/bison`: it would use the
|
|||||||
As an experimental feature, diagnostics are now colored, controlled by the
|
As an experimental feature, diagnostics are now colored, controlled by the
|
||||||
`--color` and `--style` options.
|
`--color` and `--style` options.
|
||||||
|
|
||||||
To use them, install the libtextstyle library before configuring Bison. It
|
To use them, install the libtextstyle library, 0.20.5 or newer, before
|
||||||
is available from https://alpha.gnu.org/gnu/gettext/, for instance
|
configuring Bison. It is available from https://alpha.gnu.org/gnu/gettext/,
|
||||||
https://alpha.gnu.org/pub/gnu/gettext/libtextstyle-0.20.5.tar.gz.
|
for instance https://alpha.gnu.org/gnu/gettext/libtextstyle-0.20.5.tar.gz,
|
||||||
|
or as part of Gettext 0.21 or newer, for instance
|
||||||
|
https://ftp.gnu.org/gnu/gettext/gettext-0.21.tar.gz.
|
||||||
|
|
||||||
The option --color supports the following arguments:
|
The option --color supports the following arguments:
|
||||||
- always, yes: Enable colors.
|
- always, yes: Enable colors.
|
||||||
@@ -60,6 +63,13 @@ To customize the styles, create a CSS file, say `bison-bw.css`, similar to
|
|||||||
then invoke bison with `--style=bison-bw.css`, or set the `BISON_STYLE`
|
then invoke bison with `--style=bison-bw.css`, or set the `BISON_STYLE`
|
||||||
environment variable to `bison-bw.css`.
|
environment variable to `bison-bw.css`.
|
||||||
|
|
||||||
|
In some diagnostics, bison uses libtextstyle to emit special escapes to
|
||||||
|
generate clickable hyperlinks. The environment variable
|
||||||
|
`NO_TERM_HYPERLINKS` can be used to suppress them. This may be useful for
|
||||||
|
terminal emulators which produce garbage output when they receive the escape
|
||||||
|
sequence for a hyperlink. Currently (as of 2020), this affects some versions
|
||||||
|
of emacs, guake, konsole, lxterminal, rxvt, yakuake.
|
||||||
|
|
||||||
## Relocatability
|
## Relocatability
|
||||||
If you pass `--enable-relocatable` to `configure`, Bison is relocatable.
|
If you pass `--enable-relocatable` to `configure`, Bison is relocatable.
|
||||||
|
|
||||||
@@ -77,7 +87,7 @@ for the user-side parser execution). The requirements between both differ:
|
|||||||
bison needs ngettext, the generated parsers do not. To simplify the build
|
bison needs ngettext, the generated parsers do not. To simplify the build
|
||||||
system, neither are installed if ngettext is not supported, even if
|
system, neither are installed if ngettext is not supported, even if
|
||||||
generated parsers could have been localized. See
|
generated parsers could have been localized. See
|
||||||
http://lists.gnu.org/archive/html/bug-bison/2009-08/msg00006.html for more
|
https://lists.gnu.org/r/bug-bison/2009-08/msg00006.html for more
|
||||||
details.
|
details.
|
||||||
|
|
||||||
# Questions
|
# Questions
|
||||||
@@ -100,7 +110,17 @@ that the range specifies every single year in that closed interval.
|
|||||||
|
|
||||||
<!--
|
<!--
|
||||||
|
|
||||||
Copyright (C) 1992, 1998-1999, 2003-2005, 2008-2015, 2018-2020 Free
|
LocalWords: parsers ngettext Texinfo pdf html YYYY ZZZZ ispell american md
|
||||||
|
LocalWords: MERCHANTABILITY GLR LALR IELR submodule init README src bw
|
||||||
|
LocalWords: Relocatability symlinks symlink
|
||||||
|
|
||||||
|
Local Variables:
|
||||||
|
mode: markdown
|
||||||
|
fill-column: 76
|
||||||
|
ispell-dictionary: "american"
|
||||||
|
End:
|
||||||
|
|
||||||
|
Copyright (C) 1992, 1998-1999, 2003-2005, 2008-2015, 2018-2021 Free
|
||||||
Software Foundation, Inc.
|
Software Foundation, Inc.
|
||||||
|
|
||||||
This file is part of GNU bison, the GNU Compiler Compiler.
|
This file is part of GNU bison, the GNU Compiler Compiler.
|
||||||
@@ -112,14 +132,4 @@ Invariant Sections, with no Front-Cover Texts, and with no Back-Cover
|
|||||||
Texts. A copy of the license is included in the "GNU Free
|
Texts. A copy of the license is included in the "GNU Free
|
||||||
Documentation License" file as part of this distribution.
|
Documentation License" file as part of this distribution.
|
||||||
|
|
||||||
Local Variables:
|
|
||||||
mode: markdown
|
|
||||||
fill-column: 76
|
|
||||||
ispell-dictionary: "american"
|
|
||||||
End:
|
|
||||||
|
|
||||||
LocalWords: parsers ngettext Texinfo pdf html YYYY ZZZZ ispell american md
|
|
||||||
LocalWords: MERCHANTABILITY GLR LALR IELR submodule init README src bw
|
|
||||||
LocalWords: Relocatability symlinks symlink
|
|
||||||
|
|
||||||
-->
|
-->
|
||||||
|
|||||||
+2
-2
@@ -12,7 +12,7 @@ the problems you encounter.
|
|||||||
|
|
||||||
-----
|
-----
|
||||||
|
|
||||||
Copyright (C) 2002, 2004, 2009-2015, 2018-2020 Free Software Foundation,
|
Copyright (C) 2002, 2004, 2009-2015, 2018-2021 Free Software Foundation,
|
||||||
Inc.
|
Inc.
|
||||||
|
|
||||||
This file is part of GNU Bison.
|
This file is part of GNU Bison.
|
||||||
@@ -28,4 +28,4 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|||||||
GNU General Public License for more details.
|
GNU General Public License for more details.
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
You should have received a copy of the GNU General Public License
|
||||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
|||||||
+339
-191
@@ -2,152 +2,7 @@ This file attempts to describe the rules to use when hacking Bison.
|
|||||||
Don't put this file into the distribution.
|
Don't put this file into the distribution.
|
||||||
|
|
||||||
Everything related to the development of Bison is on Savannah:
|
Everything related to the development of Bison is on Savannah:
|
||||||
http://savannah.gnu.org/projects/bison/.
|
https://savannah.gnu.org/projects/bison/.
|
||||||
|
|
||||||
|
|
||||||
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.
|
|
||||||
|
|
||||||
## 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.
|
|
||||||
|
|
||||||
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
|
|
||||||
=======
|
|
||||||
|
|
||||||
## Visible Changes
|
|
||||||
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.
|
|
||||||
|
|
||||||
## Syntax highlighting
|
|
||||||
It's quite nice to be in C++ mode when editing lalr1.cc for instance.
|
|
||||||
However tools such as Emacs will be fooled by the fact that braces and
|
|
||||||
parens do not nest, as in `[[}]]`. As a consequence you might be misguided
|
|
||||||
by its visual pairing to parens. The m4-mode is safer. Unfortunately the
|
|
||||||
m4-mode is also fooled by `#` which is sees as a comment, stops pairing with
|
|
||||||
parens/brackets that are inside...
|
|
||||||
|
|
||||||
## Coding Style
|
|
||||||
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.
|
|
||||||
|
|
||||||
Prefer "res" as the name of the local variable that will be "return"ed by
|
|
||||||
the function.
|
|
||||||
|
|
||||||
### Bison
|
|
||||||
Follow the GNU Coding Standards.
|
|
||||||
|
|
||||||
Don't reinvent the wheel: we use gnulib, which features many components.
|
|
||||||
Actually, Bison has legacy code that we should replace with gnulib modules
|
|
||||||
(e.g., many ad hoc implementations of lists).
|
|
||||||
|
|
||||||
### Skeletons
|
|
||||||
We try to use the "typical" coding style for each language.
|
|
||||||
|
|
||||||
#### CPP
|
|
||||||
We indent the CPP directives this way:
|
|
||||||
|
|
||||||
```
|
|
||||||
#if FOO
|
|
||||||
# if BAR
|
|
||||||
# define BAZ
|
|
||||||
# endif
|
|
||||||
#endif
|
|
||||||
```
|
|
||||||
|
|
||||||
Don't indent with leading spaces in the skeletons (it's ok in the grammar
|
|
||||||
files though, e.g., in `%code {...}` blocks).
|
|
||||||
|
|
||||||
On occasions, use `cppi -c` to see where we stand. We don't aim at full
|
|
||||||
correctness: depending `-d`, some bits can be in the *.c file, or the *.h
|
|
||||||
file within the double-inclusion cpp-guards. In that case, favor the case
|
|
||||||
of the *.h file, but don't waste time on this.
|
|
||||||
|
|
||||||
Don't hesitate to leave a comment on the `#endif` (e.g., `#endif /* FOO
|
|
||||||
*/`), especially for long blocks.
|
|
||||||
|
|
||||||
There is no conistency on `! defined` vs. `!defined`. The day gnulib
|
|
||||||
decides, we'll follow them.
|
|
||||||
|
|
||||||
#### C/C++
|
|
||||||
Follow the GNU Coding Standards.
|
|
||||||
|
|
||||||
The `glr.c` skeleton was implemented with `camlCase`. We are migrating it
|
|
||||||
to `snake_case`. Because we are standardizing the code, it is currently
|
|
||||||
inconsistent.
|
|
||||||
|
|
||||||
Use `YYFOO` and `yyfoo` for entities that are exposed to the user. They are
|
|
||||||
part of our contract with the users wrt backward compatibility.
|
|
||||||
|
|
||||||
Use `YY_FOO` and `yy_foo` for private matters. Users should not use them,
|
|
||||||
we are free to change them without fear of backward compatibility issues.
|
|
||||||
|
|
||||||
Use `*_t` for types, especially for `yy*_t` in which case we shouldn't worry
|
|
||||||
about the C standard introducing such a name.
|
|
||||||
|
|
||||||
#### C++
|
|
||||||
Follow the C++ Core Guidelines
|
|
||||||
(http://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines). The Google
|
|
||||||
ones may be interesting too
|
|
||||||
(https://google.github.io/styleguide/cppguide.html).
|
|
||||||
|
|
||||||
Our enumerators, such as the kinds (symbol and token kinds), should be lower
|
|
||||||
case, but it was too late to follow that track for token kinds, and symbol
|
|
||||||
kind enumerators are made to be consistent with them.
|
|
||||||
|
|
||||||
Use `*_type` for type aliases. Use `foo_get()` and `foo_set(v)` for
|
|
||||||
accessors, or simply `foo()` and `foo(v)`.
|
|
||||||
|
|
||||||
Use the `yy` prefix for private stuff, but there's no need for it in the
|
|
||||||
public API. The `yy` prefix is already taken care of via the namespace.
|
|
||||||
|
|
||||||
#### Java
|
|
||||||
We follow https://www.oracle.com/technetwork/java/codeconventions-150003.pdf
|
|
||||||
and https://google.github.io/styleguide/javaguide.html. Unfortunately at
|
|
||||||
some point some GNU Coding Style was installed in Java, but it's an error.
|
|
||||||
So we should for instance stop putting spaces in function calls. Because we
|
|
||||||
are standardizing the code, it is currently inconsistent.
|
|
||||||
|
|
||||||
Use a 2-space indentation (Google) rather than 4 (Oracle).
|
|
||||||
|
|
||||||
Don't use the "yy" prefix for public members: "getExpectedTokens", not
|
|
||||||
"yyexpectedTokens" or "yygetExpectedTokens".
|
|
||||||
|
|
||||||
## Commit Messages
|
|
||||||
Imitate the style we use. Use `git log` to get sources of inspiration.
|
|
||||||
|
|
||||||
If the changes have a small impact on Bison's generated parser, embed these
|
|
||||||
changes in the commit itself. If the impact is large, first push all the
|
|
||||||
changes except those about src/parse-gram.[ch], and then another commit
|
|
||||||
named "regen" which is only about them.
|
|
||||||
|
|
||||||
## Debugging
|
|
||||||
Bison supports tracing of its various steps, via the `--trace` option.
|
|
||||||
Since it is not meant for the end user, it is not displayed by `bison
|
|
||||||
--help`, nor is it documented in the manual. Instead, run `bison
|
|
||||||
--trace=help`.
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Working from the Repository
|
Working from the Repository
|
||||||
@@ -164,27 +19,28 @@ requirements on anyone wishing to build from the just-checked-out sources.
|
|||||||
For example, you have to use the latest stable versions of the maintainer
|
For example, you have to use the latest stable versions of the maintainer
|
||||||
tools we depend upon, including:
|
tools we depend upon, including:
|
||||||
|
|
||||||
- Autoconf <http://www.gnu.org/software/autoconf/>
|
- Autoconf <https://www.gnu.org/software/autoconf/>
|
||||||
- Automake <http://www.gnu.org/software/automake/>
|
- Automake <https://www.gnu.org/software/automake/>
|
||||||
- Flex <http://www.gnu.org/software/flex/>
|
- Flex <https://www.gnu.org/software/flex/>
|
||||||
- Gettext <http://www.gnu.org/software/gettext/>
|
- Gettext <https://www.gnu.org/software/gettext/>
|
||||||
- Graphviz <http://www.graphviz.org>
|
- Gperf <https://www.gnu.org/software/gperf/>
|
||||||
- Gzip <http://www.gnu.org/software/gzip/>
|
- Graphviz <https://www.graphviz.org>
|
||||||
- Help2man <http://www.gnu.org/software/help2man/>
|
- Gzip <https://www.gnu.org/software/gzip/>
|
||||||
- Perl <http://www.cpan.org/>
|
- Help2man <https://www.gnu.org/software/help2man/>
|
||||||
- Rsync <http://samba.anu.edu.au/rsync/>
|
- Perl <https://www.cpan.org/>
|
||||||
- Tar <http://www.gnu.org/software/tar/>
|
- Rsync <https://rsync.samba.org/>
|
||||||
- Texinfo <http://www.gnu.org/software/texinfo/>
|
- Tar <https://www.gnu.org/software/tar/>
|
||||||
|
- Texinfo <https://www.gnu.org/software/texinfo/>
|
||||||
|
|
||||||
Valgrind <http://valgrind.org/> is also highly recommended, if it supports
|
Valgrind <https://www.valgrind.org/> is also highly recommended, if it
|
||||||
your architecture.
|
supports your architecture.
|
||||||
|
|
||||||
If you're using a GNU/Linux distribution, the easiest way to install the
|
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
|
above packages depends on your system. The following shell command should
|
||||||
work for Debian-based systems such as Ubuntu:
|
work for Debian-based systems such as Ubuntu:
|
||||||
|
|
||||||
sudo apt-get install \
|
sudo apt-get install \
|
||||||
autoconf automake autopoint flex graphviz help2man texinfo valgrind
|
autoconf automake autopoint flex gperf graphviz help2man texinfo valgrind
|
||||||
|
|
||||||
Bison is written using Bison grammars, so there are bootstrapping issues.
|
Bison is written using Bison grammars, so there are bootstrapping issues.
|
||||||
The bootstrap script attempts to discover when the C code generated from the
|
The bootstrap script attempts to discover when the C code generated from the
|
||||||
@@ -201,7 +57,7 @@ might be needed.
|
|||||||
|
|
||||||
Obviously, if you are reading these notes, you did manage to check out this
|
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
|
package from the repository. For the record, you will find all the relevant
|
||||||
information on http://savannah.gnu.org/git/?group=bison.
|
information on https://savannah.gnu.org/git/?group=bison.
|
||||||
|
|
||||||
Bison uses Git submodules: subscriptions to other Git repositories. In
|
Bison uses Git submodules: subscriptions to other Git repositories. In
|
||||||
particular it uses gnulib, the GNU portability library. To ask Git to
|
particular it uses gnulib, the GNU portability library. To ask Git to
|
||||||
@@ -283,7 +139,7 @@ Register your changes.
|
|||||||
|
|
||||||
For a suggestion of what gnulib commit might be stable enough for a formal
|
For a suggestion of what gnulib commit might be stable enough for a formal
|
||||||
release, see the ChangeLog in the latest gnulib snapshot at
|
release, see the ChangeLog in the latest gnulib snapshot at
|
||||||
http://erislabs.net/ianb/projects/gnulib/.
|
https://erislabs.net/ianb/projects/gnulib/.
|
||||||
|
|
||||||
The Autoconf files we use are currently:
|
The Autoconf files we use are currently:
|
||||||
- m4/m4.m4
|
- m4/m4.m4
|
||||||
@@ -322,6 +178,203 @@ version, compile bison, then force it to recreate the files:
|
|||||||
$ make -C _build
|
$ make -C _build
|
||||||
|
|
||||||
|
|
||||||
|
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.
|
||||||
|
|
||||||
|
## 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.
|
||||||
|
|
||||||
|
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
|
||||||
|
=======
|
||||||
|
|
||||||
|
## Visible Changes
|
||||||
|
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.
|
||||||
|
|
||||||
|
## Vocabulary
|
||||||
|
- "lookahead", not "look-ahead".
|
||||||
|
- "midrule", not "mid-rule".
|
||||||
|
- "nonterminal", not "variable" or "non-terminal" or "non terminal".
|
||||||
|
Abbreviated as "nterm".
|
||||||
|
- "shift/reduce" and "reduce/reduce", not "shift-reduce" or "shift reduce",
|
||||||
|
etc.
|
||||||
|
|
||||||
|
## Syntax Highlighting
|
||||||
|
It's quite nice to be in C++ mode when editing lalr1.cc for instance.
|
||||||
|
However tools such as Emacs will be fooled by the fact that braces and
|
||||||
|
parens do not nest, as in `[[}]]`. As a consequence you might be misguided
|
||||||
|
by its visual pairing to parens. The m4-mode is safer. Unfortunately the
|
||||||
|
m4-mode is also fooled by `#` which is sees as a comment, stops pairing with
|
||||||
|
parens/brackets that are inside...
|
||||||
|
|
||||||
|
## Implementation Notes
|
||||||
|
There are several places with interesting details about the implementation:
|
||||||
|
- [Understanding C parsers generated by GNU
|
||||||
|
Bison](https://www.cs.uic.edu/~spopuri/cparser.html) by Satya Kiran Popuri,
|
||||||
|
is a wonderful piece of work that explains the implementation of Bison,
|
||||||
|
- [src/gram.h](src/gram.h) documents the way the grammar is represented
|
||||||
|
- [src/tables.h](src/tables.h) documents the generated tables
|
||||||
|
- [data/README.md](data/README.md) contains details about the m4 implementation
|
||||||
|
|
||||||
|
## Coding Style
|
||||||
|
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.
|
||||||
|
|
||||||
|
Prefer `res` as the name of the local variable that will be "return"ed by
|
||||||
|
the function.
|
||||||
|
|
||||||
|
In writing arithmetic comparisons, use "<" and "<=" rather than ">" and ">="
|
||||||
|
<https://public-inbox.org/git/7vfyw7yebj.fsf_-_@assigned-by-dhcp.cox.net/>.
|
||||||
|
|
||||||
|
### Bison
|
||||||
|
Follow the GNU Coding Standards.
|
||||||
|
|
||||||
|
Don't reinvent the wheel: we use gnulib, which features many components.
|
||||||
|
Actually, Bison has legacy code that we should replace with gnulib modules
|
||||||
|
(e.g., many ad hoc implementations of lists).
|
||||||
|
|
||||||
|
#### Includes
|
||||||
|
The `#include` directives follow an order:
|
||||||
|
- first section for *.c files is `<config.h>`. Don't include it in header
|
||||||
|
files
|
||||||
|
- then, for *.c files, the corresponding *.h file
|
||||||
|
- then possibly the `"system.h"` header
|
||||||
|
- then the system headers.
|
||||||
|
Consider headers from `lib/` like system headers (i.e., `#include
|
||||||
|
<verify.h>`, not `#include "verify.h"`).
|
||||||
|
- then headers from src/ with double quotes (`#include "getargs.h"`).
|
||||||
|
|
||||||
|
Keep headers sorted alphabetically in each section.
|
||||||
|
|
||||||
|
See also the [Header
|
||||||
|
files](https://www.gnu.org/software/gnulib/manual/html_node/Header-files.html)
|
||||||
|
and the [Implementation
|
||||||
|
files](https://www.gnu.org/software/gnulib/manual/html_node/Implementation-files.html#Implementation-files)
|
||||||
|
nodes of the gnulib documentation.
|
||||||
|
|
||||||
|
Some source files are in the build tree (e.g., `src/scan-gram.c` made from
|
||||||
|
`src/scan-gram.l`). For them to find the headers from `src/`, we actually
|
||||||
|
use `#include "src/getargs.h"` instead of `#include "getargs.h"`---that
|
||||||
|
saves us from additional `-I` flags.
|
||||||
|
|
||||||
|
### Skeletons
|
||||||
|
We try to use the "typical" coding style for each language.
|
||||||
|
|
||||||
|
#### CPP
|
||||||
|
We indent the CPP directives this way:
|
||||||
|
|
||||||
|
```
|
||||||
|
#if FOO
|
||||||
|
# if BAR
|
||||||
|
# define BAZ
|
||||||
|
# endif
|
||||||
|
#endif
|
||||||
|
```
|
||||||
|
|
||||||
|
Don't indent with leading spaces in the skeletons (it's OK in the grammar
|
||||||
|
files though, e.g., in `%code {...}` blocks).
|
||||||
|
|
||||||
|
On occasions, use `cppi -c` to see where we stand. We don't aim at full
|
||||||
|
correctness: depending `-d`, some bits can be in the *.c file, or the *.h
|
||||||
|
file within the double-inclusion cpp-guards. In that case, favor the case
|
||||||
|
of the *.h file, but don't waste time on this.
|
||||||
|
|
||||||
|
Don't hesitate to leave a comment on the `#endif` (e.g., `#endif /* FOO
|
||||||
|
*/`), especially for long blocks.
|
||||||
|
|
||||||
|
There is no consistency on `! defined` vs. `!defined`. The day gnulib
|
||||||
|
decides, we'll follow them.
|
||||||
|
|
||||||
|
#### C/C++
|
||||||
|
Follow the GNU Coding Standards.
|
||||||
|
|
||||||
|
The `glr.c` skeleton was implemented with `camlCase`. We are migrating it
|
||||||
|
to `snake_case`. Because we are gradually standardizing the code, it is
|
||||||
|
currently inconsistent.
|
||||||
|
|
||||||
|
Use `YYFOO` and `yyfoo` for entities that are exposed to the user. They are
|
||||||
|
part of our contract with the users wrt backward compatibility.
|
||||||
|
|
||||||
|
Use `YY_FOO` and `yy_foo` for private matters. Users should not use them,
|
||||||
|
we are free to change them without fear of backward compatibility issues.
|
||||||
|
|
||||||
|
Use `*_t` for types, especially for `yy*_t` in which case we shouldn't worry
|
||||||
|
about the C standard introducing such a name.
|
||||||
|
|
||||||
|
#### C++
|
||||||
|
Follow the [C++ Core
|
||||||
|
Guidelines](https://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines).
|
||||||
|
The [Google ones](https://google.github.io/styleguide/cppguide.html) may be
|
||||||
|
interesting too.
|
||||||
|
|
||||||
|
Our enumerators, such as the kinds (symbol and token kinds), should be lower
|
||||||
|
case, but it was too late to follow that track for token kinds, and symbol
|
||||||
|
kind enumerators are made to be consistent with them.
|
||||||
|
|
||||||
|
Use `*_type` for type aliases. Use `foo_get()` and `foo_set(v)` for
|
||||||
|
accessors, or simply `foo()` and `foo(v)`.
|
||||||
|
|
||||||
|
Use the `yy` prefix for private stuff, but there's no need for it in the
|
||||||
|
public API. The `yy` prefix is already taken care of via the namespace.
|
||||||
|
|
||||||
|
#### Java
|
||||||
|
We follow the [Java Code
|
||||||
|
Conventions](https://www.oracle.com/technetwork/java/codeconventions-150003.pdf)
|
||||||
|
and [Google Java Style
|
||||||
|
Guide](https://google.github.io/styleguide/javaguide.html). Unfortunately
|
||||||
|
at some point some GNU Coding Style was installed in Java, but it's an
|
||||||
|
error. So we should for instance stop putting spaces in function calls.
|
||||||
|
Because we are standardizing the code, it is currently inconsistent. Treat
|
||||||
|
acronyms as words: `YYLacStack`, not `YYLACStack`.
|
||||||
|
|
||||||
|
Use a 2-space indentation (Google) rather than 4 (Oracle).
|
||||||
|
|
||||||
|
Don't use the `yy` prefix for public members: `getExpectedTokens`, not
|
||||||
|
`yyexpectedTokens` or `yygetExpectedTokens`. Keep the `yy` prefix though
|
||||||
|
for private details.
|
||||||
|
|
||||||
|
## Commit Messages
|
||||||
|
Imitate the style we use. Use `git log` to get sources of inspiration.
|
||||||
|
|
||||||
|
If the changes have a small impact on Bison's generated parser, embed these
|
||||||
|
changes in the commit itself. If the impact is large, first push all the
|
||||||
|
changes except those about src/parse-gram.[ch], and then another commit
|
||||||
|
named "regen" which is only about them.
|
||||||
|
|
||||||
|
## Debugging
|
||||||
|
Bison supports tracing of its various steps, via the `--trace` option.
|
||||||
|
Since it is not meant for the end user, it is not displayed by `bison
|
||||||
|
--help`, nor is it documented in the manual. Instead, run `bison
|
||||||
|
--trace=help`.
|
||||||
|
|
||||||
|
## Documentation
|
||||||
|
Use `@option` for options and options with their argument if they have no
|
||||||
|
space (e.g., `@option{-Dfoo=bar}`). However, use `@samp` elsewhere (e.g.,
|
||||||
|
`@samp{-I foo}`).
|
||||||
|
|
||||||
|
|
||||||
Test Suite
|
Test Suite
|
||||||
==========
|
==========
|
||||||
|
|
||||||
@@ -331,9 +384,14 @@ examples, and the main test suite.
|
|||||||
|
|
||||||
### The Examples
|
### The Examples
|
||||||
In examples/, there is a number of ready-to-use examples (see
|
In examples/, there is a number of ready-to-use examples (see
|
||||||
examples/README.md). These examples have small test suites run by `make
|
[examples/README.md](examples/README.md)). These examples have small test
|
||||||
check`. The test results are in local `*.log` files (e.g.,
|
suites run by `make check`. The test results are in local `*.log` files
|
||||||
`$build/examples/c/calc/calc.log`).
|
(e.g., `$build/examples/c/calc/calc.log`).
|
||||||
|
|
||||||
|
To check only the examples, run `make check-examples`. To check just one
|
||||||
|
example,
|
||||||
|
|
||||||
|
make check-examples TESTS='examples/c/bistromathic/bistromathic.test'
|
||||||
|
|
||||||
### The Main Test Suite
|
### The Main Test Suite
|
||||||
The main test suite, in tests/, is written on top of GNU Autotest, which is
|
The main test suite, in tests/, is written on top of GNU Autotest, which is
|
||||||
@@ -348,28 +406,23 @@ contains lots of details that should help diagnosing issues, including build
|
|||||||
issues. The per-test logs are more convenient when working locally.
|
issues. The per-test logs are more convenient when working locally.
|
||||||
|
|
||||||
#### TESTSUITEFLAGS
|
#### TESTSUITEFLAGS
|
||||||
To run just the main test suite, run `make check-local`.
|
To run just the main test suite, run `make check-tests`.
|
||||||
|
|
||||||
The default is for make check-local to run all tests sequentially. This can
|
The default is for `make check-tests` to run all tests sequentially. This
|
||||||
be very time consuming when checking repeatedly or on slower setups. This
|
can be very time consuming when checking repeatedly or on slower setups.
|
||||||
can be sped up in two ways:
|
This can be sped up in two ways.
|
||||||
|
|
||||||
Using -j, in a make-like fashion, for example:
|
1. Using -j, in a make-like fashion, for example:
|
||||||
|
|
||||||
$ make check-local TESTSUITEFLAGS='-j8'
|
$ make check-tests TESTSUITEFLAGS='-j8'
|
||||||
|
|
||||||
Actually, when using GNU Make, TESTSUITEFLAGS defaults to the -jN passed to
|
When using GNU Make, TESTSUITEFLAGS defaults to the -jN passed to it, so you
|
||||||
it, so you may simply run
|
may simply run
|
||||||
|
|
||||||
$ make check-local -j8
|
$ make check-tests -j8
|
||||||
|
|
||||||
Running only the tests of a certain category, as specified in the AT files
|
2. Running only the tests of a certain category. See
|
||||||
with AT_KEYWORDS([[category]]). Categories include:
|
[tests/README.md](tests/README.md#keywords) for the list of categories.
|
||||||
- c++, for c++ parsers
|
|
||||||
- deprec, for tests concerning deprecated constructs.
|
|
||||||
- glr, for glr parsers
|
|
||||||
- java, for java parsers
|
|
||||||
- report, for automaton dumps
|
|
||||||
|
|
||||||
To get a list of all the tests (and their keywords for -k), run
|
To get a list of all the tests (and their keywords for -k), run
|
||||||
|
|
||||||
@@ -377,11 +430,11 @@ To get a list of all the tests (and their keywords for -k), run
|
|||||||
|
|
||||||
To run a specific set of tests, use -k (for "keyword"). For example:
|
To run a specific set of tests, use -k (for "keyword"). For example:
|
||||||
|
|
||||||
$ make check-local TESTSUITEFLAGS='-k c++'
|
$ make check-tests TESTSUITEFLAGS='-k c++'
|
||||||
|
|
||||||
Both can be combined.
|
Both can be combined.
|
||||||
|
|
||||||
$ make check-local TESTSUITEFLAGS='-j8 -k c++'
|
$ make check-tests TESTSUITEFLAGS='-j8 -k c++'
|
||||||
|
|
||||||
To rerun the tests that failed:
|
To rerun the tests that failed:
|
||||||
|
|
||||||
@@ -393,7 +446,7 @@ added the `[-Wother]` part to all the warnings). Part of the update can be
|
|||||||
done with a crude tool: `build-aux/update-test`.
|
done with a crude tool: `build-aux/update-test`.
|
||||||
|
|
||||||
Once you ran the test suite, and therefore have many `testsuite.log` files,
|
Once you ran the test suite, and therefore have many `testsuite.log` files,
|
||||||
run, from the source tree:
|
run `make update-tests`. Or, by hand, from the *source* tree:
|
||||||
|
|
||||||
$ ./build-aux/update-test $build/tests/testsuite.dir/*/testsuite.log
|
$ ./build-aux/update-test $build/tests/testsuite.dir/*/testsuite.log
|
||||||
|
|
||||||
@@ -409,6 +462,58 @@ Use the `javaexec.sh` script. For instance to run the parser of test case
|
|||||||
|
|
||||||
$ sh ./_build/javaexec.sh -cp ./_build/tests/testsuite.dir/504 Calc
|
$ sh ./_build/javaexec.sh -cp ./_build/tests/testsuite.dir/504 Calc
|
||||||
|
|
||||||
|
## Using Sanitizers
|
||||||
|
Address sanitizer (ASAN) and undefined-behavior sanitizer (UBSAN) are very
|
||||||
|
useful. Here's one way to set them up with GCC 10 on Mac Ports
|
||||||
|
|
||||||
|
1. Configure with
|
||||||
|
```
|
||||||
|
$ ./configure -C --enable-gcc-warnings \
|
||||||
|
CPPFLAGS='-isystem /opt/local/include' \
|
||||||
|
CC='gcc-mp-10 -fsanitize=address -fsanitize=undefined' \
|
||||||
|
CFLAGS='-ggdb' \
|
||||||
|
CXX='g++-mp-10.0 -fsanitize=address -fsanitize=undefined' \
|
||||||
|
CXXFLAGS='-ggdb' \
|
||||||
|
LDFLAGS='-L/opt/local/lib'
|
||||||
|
```
|
||||||
|
|
||||||
|
2. Compile
|
||||||
|
|
||||||
|
3. Generate debug symbols:
|
||||||
|
|
||||||
|
```
|
||||||
|
$ dsymutil src/bison
|
||||||
|
```
|
||||||
|
|
||||||
|
4. Run the tests with leak detection enabled
|
||||||
|
(`ASAN_OPTIONS=detect_leaks=1`). E.g. for counterexamples:
|
||||||
|
```
|
||||||
|
$ make check-tests TESTSUITEFLAGS='-j5 -k cex' ASAN_OPTIONS=detect_leaks=1
|
||||||
|
```
|
||||||
|
|
||||||
|
5. You might need a suppression file. See
|
||||||
|
https://github.com/google/sanitizers/wiki/AddressSanitizerLeakSanitizer#suppressions.
|
||||||
|
With G++ on a Mac, you might need a suppression file (say `leak.supp`)
|
||||||
|
that contains:
|
||||||
|
|
||||||
|
```
|
||||||
|
leak:std::clog
|
||||||
|
```
|
||||||
|
|
||||||
|
and pass the additional flags
|
||||||
|
`LSAN_OPTIONS=suppressions=$PWD/leak.supp,print_suppressions=0`
|
||||||
|
|
||||||
|
6. To run the debugger, you might want something like this:
|
||||||
|
```
|
||||||
|
$ YYDEBUG=1 \
|
||||||
|
UBSAN_OPTIONS=print_stacktrace=1 \
|
||||||
|
LSAN_OPTIONS=suppressions=$PWD/leak.supp,print_suppressions=0 \
|
||||||
|
ASAN_OPTIONS=detect_leaks=1 \
|
||||||
|
lldb -- ./_build/tests/testsuite.dir/712/glr-regr2a ./_build/tests/testsuite.dir/712/input1.txt
|
||||||
|
```
|
||||||
|
|
||||||
|
In lldb to set a break on ubsan, try `rbreak ^__ubsan_handle_`.
|
||||||
|
|
||||||
## make maintainer-check-valgrind
|
## make maintainer-check-valgrind
|
||||||
This target uses valgrind both to check bison, and the generated parsers.
|
This target uses valgrind both to check bison, and the generated parsers.
|
||||||
|
|
||||||
@@ -436,7 +541,7 @@ release:
|
|||||||
- Maybe build with -DGNULIB_POSIXCHECK, which suggests gnulib modules that
|
- Maybe build with -DGNULIB_POSIXCHECK, which suggests gnulib modules that
|
||||||
can fix portability issues. See if you really want to pay attention to
|
can fix portability issues. See if you really want to pay attention to
|
||||||
its warnings; there's no need to obey blindly to it
|
its warnings; there's no need to obey blindly to it
|
||||||
(<http://lists.gnu.org/archive/html/bison-patches/2012-05/msg00057.html>).
|
(<https://lists.gnu.org/r/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.
|
||||||
|
|
||||||
@@ -484,15 +589,56 @@ re-run the tests, run:
|
|||||||
make check
|
make check
|
||||||
|
|
||||||
|
|
||||||
|
## Docker
|
||||||
|
|
||||||
|
Running old compilers is not very easy. Docker can be used for some of
|
||||||
|
them. Have a look at .travis.yml for setups. Move the tarball in `/tmp`
|
||||||
|
and run, for instance:
|
||||||
|
|
||||||
|
```
|
||||||
|
docker run -v /tmp:/tmp -it ubuntu:xenial
|
||||||
|
```
|
||||||
|
|
||||||
|
This way, the host and guest machines share `/tmp`.
|
||||||
|
|
||||||
|
### GCC 4.6
|
||||||
|
On Ubuntu Xenial.
|
||||||
|
|
||||||
|
```
|
||||||
|
apt-get update
|
||||||
|
apt-get install software-properties-common
|
||||||
|
apt-add-repository -y "ppa:ubuntu-toolchain-r/test"
|
||||||
|
apt-get update
|
||||||
|
apt-get install -y gcc-4.6 g++-4.6 m4 make
|
||||||
|
```
|
||||||
|
|
||||||
|
## Stow
|
||||||
|
|
||||||
|
If you want to install several versions of Bison using GNU Stow, do
|
||||||
|
something like this:
|
||||||
|
|
||||||
|
```
|
||||||
|
for v in 3.7 3.7.1
|
||||||
|
do
|
||||||
|
cd /tmp
|
||||||
|
wget https://ftp.gnu.org/gnu/bison/bison-$v.tar.xz
|
||||||
|
tar xf bison-$v.tar.xz
|
||||||
|
cd bison-$v
|
||||||
|
./configure --prefix /usr/local/stow/bison-$v
|
||||||
|
make -j4
|
||||||
|
sudo make install
|
||||||
|
done
|
||||||
|
```
|
||||||
|
|
||||||
Release Procedure
|
Release Procedure
|
||||||
=================
|
=================
|
||||||
|
|
||||||
See README-release.
|
See the [README-release file](README-release), created when the package is
|
||||||
|
bootstrapped.
|
||||||
|
|
||||||
<!--
|
<!--
|
||||||
|
|
||||||
Copyright (C) 2002-2005, 2007-2015, 2018-2020 Free Software Foundation,
|
Copyright (C) 2002-2005, 2007-2015, 2018-2021 Free Software Foundation,
|
||||||
Inc.
|
Inc.
|
||||||
|
|
||||||
This file is part of GNU Bison.
|
This file is part of GNU Bison.
|
||||||
@@ -508,7 +654,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|||||||
GNU General Public License for more details.
|
GNU General Public License for more details.
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
You should have received a copy of the GNU General Public License
|
||||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
Local Variables:
|
Local Variables:
|
||||||
mode: markdown
|
mode: markdown
|
||||||
@@ -524,8 +670,10 @@ LocalWords: symlinks vti html lt POSIX Cc'ed Graphviz Texinfo autoconf jN
|
|||||||
LocalWords: automake autopoint graphviz texinfo PROG Wother parsers YYFOO
|
LocalWords: automake autopoint graphviz texinfo PROG Wother parsers YYFOO
|
||||||
LocalWords: TESTSUITEFLAGS deprec struct gnulib's getopt config ggdb yyfoo
|
LocalWords: TESTSUITEFLAGS deprec struct gnulib's getopt config ggdb yyfoo
|
||||||
LocalWords: bitset fsanitize symlink CFLAGS MERCHANTABILITY ispell wrt YY
|
LocalWords: bitset fsanitize symlink CFLAGS MERCHANTABILITY ispell wrt YY
|
||||||
LocalWords: american Administrivia camlCase yy accessors namespace src
|
LocalWords: american Administrivia camlCase yy accessors namespace src hoc
|
||||||
LocalWords: getExpectedTokens yyexpectedTokens yygetExpectedTokens
|
LocalWords: getExpectedTokens yyexpectedTokens yygetExpectedTokens parens
|
||||||
LocalWords: regen dogfooding Autotest testsuite
|
LocalWords: regen dogfooding Autotest testsuite getargs CPP BAZ endif cppi
|
||||||
|
LocalWords: cpp javaexec cp Calc ASAN UBSAN CPPFLAGS isystem CXX cex Gperf
|
||||||
|
LocalWords: CXXFLAGS LDFLAGS dsymutil gperf
|
||||||
|
|
||||||
-->
|
-->
|
||||||
|
|||||||
@@ -34,6 +34,7 @@ Bob Rossi [email protected]
|
|||||||
Brandon Lucia [email protected]
|
Brandon Lucia [email protected]
|
||||||
Brooks Moses [email protected]
|
Brooks Moses [email protected]
|
||||||
Bruce Lilly [email protected]
|
Bruce Lilly [email protected]
|
||||||
|
Bruno Belanyi [email protected]
|
||||||
Bruno Haible [email protected]
|
Bruno Haible [email protected]
|
||||||
Charles-Henri de Boysson [email protected]
|
Charles-Henri de Boysson [email protected]
|
||||||
Christian Burger [email protected]
|
Christian Burger [email protected]
|
||||||
@@ -45,6 +46,7 @@ Csaba Raduly [email protected]
|
|||||||
Dagobert Michelsen [email protected]
|
Dagobert Michelsen [email protected]
|
||||||
Daniel Frużyński [email protected]
|
Daniel Frużyński [email protected]
|
||||||
Daniel Galloway [email protected]
|
Daniel Galloway [email protected]
|
||||||
|
Daniela Becker [email protected]
|
||||||
Daniel Hagerty [email protected]
|
Daniel Hagerty [email protected]
|
||||||
David Barto [email protected]
|
David Barto [email protected]
|
||||||
David J. MacKenzie [email protected]
|
David J. MacKenzie [email protected]
|
||||||
@@ -59,6 +61,7 @@ Di-an Jan [email protected]
|
|||||||
Dick Streefland [email protected]
|
Dick Streefland [email protected]
|
||||||
Didier Godefroy [email protected]
|
Didier Godefroy [email protected]
|
||||||
Don Macpherson [email protected]
|
Don Macpherson [email protected]
|
||||||
|
Dwight Guth [email protected]
|
||||||
Efi Fogel [email protected]
|
Efi Fogel [email protected]
|
||||||
Enrico Scholz [email protected]
|
Enrico Scholz [email protected]
|
||||||
Eric Blake [email protected]
|
Eric Blake [email protected]
|
||||||
@@ -83,6 +86,7 @@ Guido Trentalancia [email protected]
|
|||||||
H. Merijn Brand [email protected]
|
H. Merijn Brand [email protected]
|
||||||
Hans Åberg [email protected]
|
Hans Åberg [email protected]
|
||||||
Horst Von Brand [email protected]
|
Horst Von Brand [email protected]
|
||||||
|
Jacob L. Mandelson [email protected]
|
||||||
Jan Nieuwenhuizen [email protected]
|
Jan Nieuwenhuizen [email protected]
|
||||||
Jannick [email protected]
|
Jannick [email protected]
|
||||||
Jeff Hammond [email protected]
|
Jeff Hammond [email protected]
|
||||||
@@ -103,14 +107,17 @@ Keith Browne [email protected]
|
|||||||
Ken Moffat [email protected]
|
Ken Moffat [email protected]
|
||||||
Kiyoshi Kanazawa [email protected]
|
Kiyoshi Kanazawa [email protected]
|
||||||
Lars Maier [email protected]
|
Lars Maier [email protected]
|
||||||
|
Lars Wendler [email protected]
|
||||||
László Várady [email protected]
|
László Várady [email protected]
|
||||||
Laurent Mascherpa [email protected]
|
Laurent Mascherpa [email protected]
|
||||||
Lie Yan [email protected]
|
Lie Yan [email protected]
|
||||||
|
Maarten De Braekeleer [email protected]
|
||||||
Magnus Fromreide [email protected]
|
Magnus Fromreide [email protected]
|
||||||
Marc Autret [email protected]
|
Marc Autret [email protected]
|
||||||
Marc Mendiola [email protected]
|
Marc Mendiola [email protected]
|
||||||
Marc Schönefeld [email protected]
|
Marc Schönefeld [email protected]
|
||||||
Mark Boyall [email protected]
|
Mark Boyall [email protected]
|
||||||
|
Martin Blais [email protected]
|
||||||
Martin Jacobs [email protected]
|
Martin Jacobs [email protected]
|
||||||
Martin Mokrejs [email protected]
|
Martin Mokrejs [email protected]
|
||||||
Martin Nylin [email protected]
|
Martin Nylin [email protected]
|
||||||
@@ -181,6 +188,7 @@ Simon Sobisch [email protected]
|
|||||||
Stefano Lattarini [email protected]
|
Stefano Lattarini [email protected]
|
||||||
Stephen Cameron [email protected]
|
Stephen Cameron [email protected]
|
||||||
Steve Murphy [email protected]
|
Steve Murphy [email protected]
|
||||||
|
Suhwan Song [email protected]
|
||||||
Sum Wu [email protected]
|
Sum Wu [email protected]
|
||||||
Théophile Ranquet [email protected]
|
Théophile Ranquet [email protected]
|
||||||
Thiru Ramakrishnan [email protected]
|
Thiru Ramakrishnan [email protected]
|
||||||
@@ -214,6 +222,7 @@ Wolfram Wagner [email protected]
|
|||||||
Wwp [email protected]
|
Wwp [email protected]
|
||||||
xolodho [email protected]
|
xolodho [email protected]
|
||||||
Yuichiro Kaneko [email protected]
|
Yuichiro Kaneko [email protected]
|
||||||
|
Yuriy Solodkyy [email protected]
|
||||||
Zack Weinberg [email protected]
|
Zack Weinberg [email protected]
|
||||||
江 祖铭 [email protected]
|
江 祖铭 [email protected]
|
||||||
長田偉伸 [email protected]
|
長田偉伸 [email protected]
|
||||||
@@ -229,7 +238,7 @@ End:
|
|||||||
|
|
||||||
-----
|
-----
|
||||||
|
|
||||||
Copyright (C) 2000-2015, 2018-2020 Free Software Foundation, Inc.
|
Copyright (C) 2000-2015, 2018-2021 Free Software Foundation, Inc.
|
||||||
|
|
||||||
This file is part of Bison, the GNU Parser Generator.
|
This file is part of Bison, the GNU Parser Generator.
|
||||||
|
|
||||||
@@ -244,4 +253,4 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|||||||
GNU General Public License for more details.
|
GNU General Public License for more details.
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
You should have received a copy of the GNU General Public License
|
||||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
|||||||
@@ -1,15 +1,79 @@
|
|||||||
* Bison 3.7
|
* Soon
|
||||||
|
** scan-code
|
||||||
|
The default case is scanning char-per-char.
|
||||||
|
|
||||||
|
/* By default, grow the string obstack with the input. */
|
||||||
|
.|\n STRING_GROW ();
|
||||||
|
|
||||||
|
make it more eager?
|
||||||
|
|
||||||
|
** Missing tests
|
||||||
|
commit 2c294c132528ede23d8ae4959783a67e9ff05ac5
|
||||||
|
Author: Vincent Imbimbo <[email protected]>
|
||||||
|
Date: Sat Jan 23 13:25:18 2021 -0500
|
||||||
|
|
||||||
|
cex: fix state-item pruning
|
||||||
|
|
||||||
|
See https://lists.gnu.org/r/bug-bison/2021-01/msg00002.html
|
||||||
|
|
||||||
|
** pos_set_set
|
||||||
|
The current approach is correct, but with poor performances. Bitsets need
|
||||||
|
to support 'assign' and 'shift'. And instead of extending POS_SET just for
|
||||||
|
the out-of-range new values, we need something like doubling the size.
|
||||||
|
|
||||||
|
** glr
|
||||||
|
There is no test with "Parse on stack %ld rejected by rule %d" in it.
|
||||||
|
|
||||||
|
** yyrline etc.
|
||||||
|
Clarify that rule numbers in the skeletons are 1-based.
|
||||||
|
|
||||||
|
** Macros in C++
|
||||||
|
There are many macros that should obey api.prefix: YY_CPLUSPLUS, YY_MOVE,
|
||||||
|
etc.
|
||||||
|
|
||||||
|
** yyerrok in Java
|
||||||
|
And add tests in calc.at, to prepare work for D.
|
||||||
|
|
||||||
|
** YYERROR and yynerrs
|
||||||
|
We are missing some cases. Write a test case, and check all the skeletons.
|
||||||
|
|
||||||
|
** Cex
|
||||||
|
*** Improve gnulib
|
||||||
|
Don't do this (counterexample.c):
|
||||||
|
|
||||||
|
// This is the fastest way to get the tail node from the gl_list API.
|
||||||
|
gl_list_node_t
|
||||||
|
list_get_end (gl_list_t list)
|
||||||
|
{
|
||||||
|
gl_list_node_t sentinel = gl_list_add_last (list, NULL);
|
||||||
|
gl_list_node_t res = gl_list_previous_node (list, sentinel);
|
||||||
|
gl_list_remove_node (list, sentinel);
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
|
*** Ambiguous rewriting
|
||||||
|
If the user is stupid enough to have equal rules, then the derivations are
|
||||||
|
harder to read:
|
||||||
|
|
||||||
|
Reduce/reduce conflict on tokens $end, "+", "⊕":
|
||||||
|
2 exp: exp "+" exp .
|
||||||
|
3 exp: exp "+" exp .
|
||||||
|
Example exp "+" exp •
|
||||||
|
First derivation exp ::=[ exp "+" exp • ]
|
||||||
|
Example exp "+" exp •
|
||||||
|
Second derivation exp ::=[ exp "+" exp • ]
|
||||||
|
|
||||||
|
Do we care about this? In color, we use twice the same color here, but we
|
||||||
|
could try to use the same color for the same rule.
|
||||||
|
|
||||||
|
*** XML reports
|
||||||
|
Show the counterexamples. This is going to be really hard and/or painful.
|
||||||
|
Unless we play it dumb (little structure).
|
||||||
|
|
||||||
** Bistromathic
|
** Bistromathic
|
||||||
- Hitting tab on a line with a syntax error is ugly
|
|
||||||
|
|
||||||
- Be robust to existing ~/.inputrc
|
|
||||||
|
|
||||||
- How about not evaluating incomplete lines when the text is not finished
|
- How about not evaluating incomplete lines when the text is not finished
|
||||||
(as shells do).
|
(as shells do).
|
||||||
|
|
||||||
** Doc
|
|
||||||
*** api.header.include
|
|
||||||
|
|
||||||
** Questions
|
** Questions
|
||||||
*** Java
|
*** Java
|
||||||
- Should i18n be part of the Lexer? Currently it's a static method of
|
- Should i18n be part of the Lexer? Currently it's a static method of
|
||||||
@@ -22,13 +86,6 @@
|
|||||||
|
|
||||||
- promote YYEOF rather than EOF.
|
- promote YYEOF rather than EOF.
|
||||||
|
|
||||||
*** D
|
|
||||||
- is there a way to attach yysymbol_name to the enum itself? As we did
|
|
||||||
in Java.
|
|
||||||
|
|
||||||
- It would be better to have TokenKind as return value. Can we use
|
|
||||||
reflection to support both output types?
|
|
||||||
|
|
||||||
** YYerror
|
** YYerror
|
||||||
https://git.savannah.gnu.org/gitweb/?p=gettext.git;a=blob;f=gettext-runtime/intl/plural.y;h=a712255af4f2f739c93336d4ff6556d932a426a5;hb=HEAD
|
https://git.savannah.gnu.org/gitweb/?p=gettext.git;a=blob;f=gettext-runtime/intl/plural.y;h=a712255af4f2f739c93336d4ff6556d932a426a5;hb=HEAD
|
||||||
|
|
||||||
@@ -39,34 +96,13 @@ enough.
|
|||||||
*** calc.at
|
*** calc.at
|
||||||
Stop hard-coding "Calc". Adjust local.at (look for FIXME).
|
Stop hard-coding "Calc". Adjust local.at (look for FIXME).
|
||||||
|
|
||||||
** Counter example generation
|
|
||||||
See https://github.com/akimd/bison/pull/15.
|
|
||||||
|
|
||||||
** Clean up
|
|
||||||
Rename user_token_number for tokens as "code". It's not a "user number",
|
|
||||||
it's the token code, and the user can control it, but this code always
|
|
||||||
exists.
|
|
||||||
|
|
||||||
See also USER_NUMBER_UNDEFINED and NUMBER_UNDEFINED.
|
|
||||||
|
|
||||||
Rename endtoken as eoftoken.
|
|
||||||
|
|
||||||
Also do it in data/skeletons.
|
|
||||||
|
|
||||||
Don't rename in Bison 3.6 (it would be logical to do so) because that
|
|
||||||
would probably create many conflicts in Vincent's work (see previous point).
|
|
||||||
|
|
||||||
** A dev warning for b4_
|
|
||||||
Maybe we should check for m4_ and b4_ leaking out of the m4 processing, as
|
|
||||||
Autoconf does. It would have caught overquotation issues.
|
|
||||||
|
|
||||||
** doc
|
** doc
|
||||||
I feel it's ugly to use the GNU style to declare functions in the doc. It
|
I feel it's 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
|
generates tons of white space in the page, and may contribute to bad page
|
||||||
breaks.
|
breaks.
|
||||||
|
|
||||||
** consistency
|
** consistency
|
||||||
token vs terminal, variable vs non terminal.
|
token vs terminal.
|
||||||
|
|
||||||
** api.token.raw
|
** api.token.raw
|
||||||
The YYUNDEFTOK could be assigned a semantic value so that yyerror could be
|
The YYUNDEFTOK could be assigned a semantic value so that yyerror could be
|
||||||
@@ -79,7 +115,7 @@ push parsers on top of pull parser. Which is currently not relevant, since
|
|||||||
push parsers are measurably slower.
|
push parsers are measurably slower.
|
||||||
|
|
||||||
** %define parse.error formatted
|
** %define parse.error formatted
|
||||||
How about pushing bistromathics' yyreport_syntax_error as another standard
|
How about pushing Bistromathic's yyreport_syntax_error as another standard
|
||||||
way to generate the error message, and leave to the user the task of
|
way to generate the error message, and leave to the user the task of
|
||||||
providing the message formats? Currently in bistro, it reads:
|
providing the message formats? Currently in bistro, it reads:
|
||||||
|
|
||||||
@@ -147,7 +183,48 @@ Les catégories d'avertissements incluent :
|
|||||||
|
|
||||||
Line -1 and -3 should mention CATEGORIE, not CATEGORY.
|
Line -1 and -3 should mention CATEGORIE, not CATEGORY.
|
||||||
|
|
||||||
* Bison 3.8
|
* Bison 3.9
|
||||||
|
** Rewrite glr.cc (currently glr2.cc)
|
||||||
|
*** custom error messages
|
||||||
|
|
||||||
|
*** Remove jumps
|
||||||
|
We can probably replace setjmp/longjmp with exceptions. That would help
|
||||||
|
tremendously other languages such as D and Java that probably have no
|
||||||
|
similar feature. If we remove jumps, we probably no longer need _Noreturn,
|
||||||
|
so simplify `b4_attribute_define([noreturn])` into `b4_attribute_define`.
|
||||||
|
|
||||||
|
After discussing with Valentin, it was decided that it's better to stay with
|
||||||
|
jumps, since in some places exceptions are ruled out from C++.
|
||||||
|
|
||||||
|
*** Coding style
|
||||||
|
Move to our coding conventions. In particular names such as yy_glr_stack,
|
||||||
|
not yyGLRStack.
|
||||||
|
|
||||||
|
*** yydebug
|
||||||
|
It should be a member of the parser object, see lalr1.cc. Let the parser
|
||||||
|
object decide what the debug stream is, rather than open coding std::cerr.
|
||||||
|
|
||||||
|
*** Avoid pointers
|
||||||
|
There are many places where pointers should be replaced with references.
|
||||||
|
Some occurrences were fixed, but now some have improper names:
|
||||||
|
|
||||||
|
-yygetToken (int *yycharp, ]b4_namespace_ref[::]b4_parser_class[& yyparser][]b4_pure_if([, glr_stack* yystackp])[]b4_user_formals[)
|
||||||
|
+yygetToken (int& yycharp, ]b4_namespace_ref[::]b4_parser_class[& yyparser][]b4_pure_if([, glr_stack* yystackp])[]b4_user_formals[)
|
||||||
|
|
||||||
|
yycharp is no longer a Pointer. And yystackp should probably also be a reference.
|
||||||
|
|
||||||
|
*** parse.assert
|
||||||
|
Currently all the assertions are enabled. Once we are confident in glr2.cc,
|
||||||
|
let parse.assert use the same approach as in lalr1.cc.
|
||||||
|
|
||||||
|
*** debug_stream
|
||||||
|
Stop using std::cerr everywhere.
|
||||||
|
|
||||||
|
*** glr.c
|
||||||
|
When glr2.cc fully replaces glr.cc, get rid of the glr.cc scaffolding in
|
||||||
|
glr.c.
|
||||||
|
|
||||||
|
* Chains
|
||||||
** Unit rules / Injection rules (Akim Demaille)
|
** Unit rules / Injection rules (Akim Demaille)
|
||||||
Maybe we could expand unit rules (or "injections", see
|
Maybe we could expand unit rules (or "injections", see
|
||||||
https://homepages.cwi.nl/~daybuild/daily-books/syntax/2-sdf/sdf.html), i.e.,
|
https://homepages.cwi.nl/~daybuild/daily-books/syntax/2-sdf/sdf.html), i.e.,
|
||||||
@@ -190,18 +267,54 @@ 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
|
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.
|
"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
|
"set" can still be used for summarizing the important sets. That would make
|
||||||
tests easy to maintain.
|
tests easy to maintain.
|
||||||
|
|
||||||
*** complain.*
|
*** complain.*
|
||||||
Rename these guys as "diagnostics.*" (or "diagnose.*"), since that's the
|
Rename these guys as "diagnostics.*" (or "diagnose.*"), since that's the
|
||||||
name they have in gcc, clang, etc. Likewise for the complain_* series of
|
name they have in GCC, clang, etc. Likewise for the complain_* series of
|
||||||
functions.
|
functions.
|
||||||
|
|
||||||
*** ritem
|
*** ritem
|
||||||
states/nstates, rules/nrules, ..., ritem/nritems
|
states/nstates, rules/nrules, ..., ritem/nritems
|
||||||
Fix the latter.
|
Fix the latter.
|
||||||
|
|
||||||
|
*** m4: slot, type, type_tag
|
||||||
|
The meaning of type_tag varies depending on api.value.type. We should avoid
|
||||||
|
that and using clear definitions with stable semantics.
|
||||||
|
|
||||||
|
* D programming language
|
||||||
|
There's a number of features that are missing, here sorted in _suggested_
|
||||||
|
order of implementation.
|
||||||
|
|
||||||
|
When copying code from other skeletons, keep the comments exactly as they
|
||||||
|
are. Keep the same variable names. If you change the wording in one place,
|
||||||
|
do it in the others too. In other words: make sure to keep the
|
||||||
|
maintenance *simple* by avoiding any gratuitous difference.
|
||||||
|
|
||||||
|
** CI
|
||||||
|
Check when gdc and ldc.
|
||||||
|
|
||||||
|
** GLR Parser
|
||||||
|
This is very ambitious. That's the final boss. There are currently no
|
||||||
|
"clean" implementation to get inspiration from.
|
||||||
|
|
||||||
|
glr.c is very clean but:
|
||||||
|
- is low-level C
|
||||||
|
- is a different skeleton from yacc.c
|
||||||
|
|
||||||
|
glr.cc is (currently) an ugly hack: a C++ shell around glr.c. Valentin
|
||||||
|
Tolmer is currently rewriting glr.cc to be clean C++, but he is not
|
||||||
|
finished. There will be a lot a common code between lalr1.cc and glr.cc, so
|
||||||
|
eventually I would like them to be fused into a single skeleton, supporting
|
||||||
|
both deterministic and generalized parsing.
|
||||||
|
|
||||||
|
It would be great for D to also support this.
|
||||||
|
|
||||||
|
The basic ideas of GLR are explained here:
|
||||||
|
|
||||||
|
https://www.codeproject.com/Articles/5259825/GLR-Parsing-in-Csharp-How-to-Use-The-Most-Powerful
|
||||||
|
|
||||||
* Better error messages
|
* Better error messages
|
||||||
The users are not provided with enough tools to forge their 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
|
See for instance "Is there an option to change the message produced by
|
||||||
@@ -219,9 +332,8 @@ and older C++ compilers. Currently the code defaults to defining it to
|
|||||||
define it to the same type as the C ptrdiff_t type.
|
define it to the same type as the C ptrdiff_t type.
|
||||||
|
|
||||||
* Completion
|
* Completion
|
||||||
Several features are not available in all the backends.
|
Several features are not available in all the back-ends.
|
||||||
|
|
||||||
- lac: D, Java (easy)
|
|
||||||
- push parsers: glr.c, glr.cc, lalr1.cc (not very difficult)
|
- push parsers: glr.c, glr.cc, lalr1.cc (not very difficult)
|
||||||
- token constructors: Java, C, D (a bit difficult)
|
- token constructors: Java, C, D (a bit difficult)
|
||||||
- glr: D, Java (super difficult)
|
- glr: D, Java (super difficult)
|
||||||
@@ -236,9 +348,6 @@ $ ./tests/testsuite -l | grep errors | sed q
|
|||||||
38: input.at:1730 errors
|
38: input.at:1730 errors
|
||||||
|
|
||||||
* Short term
|
* Short term
|
||||||
** Get rid of YYPRINT and b4_toknum
|
|
||||||
Besides yytoknum is wrong when api.token.raw is defined.
|
|
||||||
|
|
||||||
** Better design for diagnostics
|
** Better design for diagnostics
|
||||||
The current implementation of diagnostics is ad hoc, it grew organically.
|
The current implementation of diagnostics is ad hoc, it grew organically.
|
||||||
It works as a series of calls to several functions, with dependency of the
|
It works as a series of calls to several functions, with dependency of the
|
||||||
@@ -289,7 +398,7 @@ opposite side we have some use of \l, which is graphviz-specific, in what
|
|||||||
should be generic code.
|
should be generic code.
|
||||||
|
|
||||||
Little effort seems to have been given to factoring these files and their
|
Little effort seems to have been given to factoring these files and their
|
||||||
rint{,-xml} counterpart. We would very much like to re-use the pretty format
|
print{,-xml} counterpart. We would very much like to re-use the pretty format
|
||||||
of states from .output for the graphs, etc.
|
of states from .output for the graphs, etc.
|
||||||
|
|
||||||
Since graphviz dies on medium-to-big grammars, maybe consider an other tool?
|
Since graphviz dies on medium-to-big grammars, maybe consider an other tool?
|
||||||
@@ -356,23 +465,6 @@ It would be a very nice source of inspiration for the other languages.
|
|||||||
|
|
||||||
Valentin Tolmer is working on this.
|
Valentin Tolmer is working on this.
|
||||||
|
|
||||||
** yychar == YYEMPTY
|
|
||||||
The code in yyerrlab reads:
|
|
||||||
|
|
||||||
if (yychar <= YYEOF)
|
|
||||||
{
|
|
||||||
/* Return failure if at end of input. */
|
|
||||||
if (yychar == YYEOF)
|
|
||||||
YYABORT;
|
|
||||||
}
|
|
||||||
|
|
||||||
There are only two yychar that can be <= YYEOF: YYEMPTY and YYEOF.
|
|
||||||
But I can't produce the situation where yychar is YYEMPTY here, is it
|
|
||||||
really possible? The test suite does not exercise this case.
|
|
||||||
|
|
||||||
This shows that it would be interesting to manage to install skeleton
|
|
||||||
coverage analysis to the test suite.
|
|
||||||
|
|
||||||
* From lalr1.cc to yacc.c
|
* From lalr1.cc to yacc.c
|
||||||
** Single stack
|
** Single stack
|
||||||
Merging the three stacks in lalr1.cc simplified the code, prompted for
|
Merging the three stacks in lalr1.cc simplified the code, prompted for
|
||||||
@@ -414,16 +506,6 @@ undocumented ''features''. Maybe an empty action ought to be
|
|||||||
presented too. Shall we try to make a single grammar with all these
|
presented too. Shall we try to make a single grammar with all these
|
||||||
features, or should we have several very small grammars?
|
features, or should we have several very small grammars?
|
||||||
|
|
||||||
** --report=conflict-path
|
|
||||||
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.lsv.fr/~schmitz/pub/expamb.pdf> for an approach.
|
|
||||||
An Experimental Ambiguity Detection Tool ∗ Sylvain Schmitz
|
|
||||||
LORIA, INRIA Nancy - Grand Est, Nancy, France
|
|
||||||
|
|
||||||
* Extensions
|
* Extensions
|
||||||
** More languages?
|
** More languages?
|
||||||
Well, only if there is really some demand for it.
|
Well, only if there is really some demand for it.
|
||||||
@@ -435,6 +517,9 @@ https://github.com/scfc/bison-php/blob/master/data/lalr1.php
|
|||||||
https://lists.gnu.org/r/bison-patches/2013-09/msg00000.html and following
|
https://lists.gnu.org/r/bison-patches/2013-09/msg00000.html and following
|
||||||
|
|
||||||
** Multiple start symbols
|
** Multiple start symbols
|
||||||
|
Revert a70e75b8a41755ab96ab211a0ea111ac68a4aadd.
|
||||||
|
Revert tests: disable "Multistart reports".
|
||||||
|
|
||||||
Would be very useful when parsing closely related languages. The idea is to
|
Would be very useful when parsing closely related languages. The idea is to
|
||||||
declare several start symbols, for instance
|
declare several start symbols, for instance
|
||||||
|
|
||||||
@@ -456,12 +541,27 @@ happen with yy_start: stmt | expr). Then adjust the skeletons so that this
|
|||||||
initial token (YY_START_STMT, YY_START_EXPR) be shifted first in the
|
initial token (YY_START_STMT, YY_START_EXPR) be shifted first in the
|
||||||
corresponding parse function.
|
corresponding parse function.
|
||||||
|
|
||||||
|
*** Number of useless symbols
|
||||||
|
AT_TEST(
|
||||||
|
[[%start exp;
|
||||||
|
exp: exp;]],
|
||||||
|
[[input.y: warning: 2 nonterminals useless in grammar [-Wother]
|
||||||
|
input.y: warning: 2 rules useless in grammar [-Wother]
|
||||||
|
input.y:2.8-10: error: start symbol exp does not derive any sentence]])
|
||||||
|
|
||||||
|
We should say "1 nonterminal": the other one is $accept, which should not
|
||||||
|
participate in the count.
|
||||||
|
|
||||||
|
*** Tokens
|
||||||
|
Do we want to disallow terminal start symbols? The limitation is not
|
||||||
|
technical. Can it be useful to someone to "parse" a token?
|
||||||
|
|
||||||
** %include
|
** %include
|
||||||
This is a popular demand. We already made many changes in the parser that
|
This is a popular demand. We already made many changes in the parser that
|
||||||
should make this reasonably easy to implement.
|
should make this reasonably easy to implement.
|
||||||
|
|
||||||
Bruce Mardle <[email protected]>
|
Bruce Mardle <[email protected]>
|
||||||
https://lists.gnu.org/archive/html/bison-patches/2015-09/msg00000.html
|
https://lists.gnu.org/r/bison-patches/2015-09/msg00000.html
|
||||||
|
|
||||||
However, there are many other things to do before having such a feature,
|
However, there are many other things to do before having such a feature,
|
||||||
because I don't want a % equivalent to #include (which we all learned to
|
because I don't want a % equivalent to #include (which we all learned to
|
||||||
@@ -470,11 +570,11 @@ them together, paying attention to keep separate bits separated, in pseudo
|
|||||||
name spaces.
|
name spaces.
|
||||||
|
|
||||||
** Push parsers
|
** Push parsers
|
||||||
There is demand for push parsers in Java and C++. And GLR I guess.
|
There is demand for push parsers in C++.
|
||||||
|
|
||||||
** Generate code instead of tables
|
** Generate code instead of tables
|
||||||
This is certainly quite a lot of work. See
|
This is certainly quite a lot of work. See
|
||||||
http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.50.4539.
|
https://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.50.4539.
|
||||||
|
|
||||||
** $-1
|
** $-1
|
||||||
We should find a means to provide an access to values deep in the
|
We should find a means to provide an access to values deep in the
|
||||||
@@ -514,13 +614,6 @@ XML output for GNU Bison and gcc
|
|||||||
XML output for GNU Bison
|
XML output for GNU Bison
|
||||||
http://yaxx.sourceforge.net/
|
http://yaxx.sourceforge.net/
|
||||||
|
|
||||||
** Counterexample generation
|
|
||||||
https://lists.gnu.org/archive/html/bug-bison/2016-06/msg00000.html
|
|
||||||
http://www.cs.cornell.edu/andru/papers/cupex/
|
|
||||||
|
|
||||||
Andrew Myers and Vincent Imbimbo are working on this item, see
|
|
||||||
https://github.com/akimd/bison/issues/12
|
|
||||||
|
|
||||||
* Coding system independence
|
* Coding system independence
|
||||||
Paul notes:
|
Paul notes:
|
||||||
|
|
||||||
@@ -584,28 +677,47 @@ to bison. If you're interested, I'll work on a patch.
|
|||||||
Equip the parser with a means to create the (visual) parse tree.
|
Equip the parser with a means to create the (visual) parse tree.
|
||||||
|
|
||||||
|
|
||||||
|
-----
|
||||||
|
|
||||||
|
# LocalWords: Cex gnulib gl Bistromathic TokenKinds yylex enum YYEOF EOF
|
||||||
|
# LocalWords: YYerror gettext af hb YYERRCODE undef calc FIXME dev yyerror
|
||||||
|
# LocalWords: Autoconf YYUNDEFTOK lexemes parsers Bistromathic's yyreport
|
||||||
|
# LocalWords: const argc yacc yyclearin lookahead destructor Rici incluent
|
||||||
|
# LocalWords: yydestruct yydiscardin catégories d'avertissements sr activé
|
||||||
|
# LocalWords: conflits défaut rr l'alias chaîne n'est attaché un symbole
|
||||||
|
# LocalWords: obsolète règle vide midrule valeurs de intermédiaire ou avec
|
||||||
|
# LocalWords: définies inutilisées priorité associativité inutiles POSIX
|
||||||
|
# LocalWords: incompatibilités tous les autres avertissements sauf dans rp
|
||||||
|
# LocalWords: désactiver CATEGORIE traiter comme des erreurs glr Akim bool
|
||||||
|
# LocalWords: Demaille arith lalr goto struct pathlen nullable ntokens lr
|
||||||
|
# LocalWords: nterm bitsetv ielr ritem nstates nrules nritems yysymbol EQ
|
||||||
|
# LocalWords: SymbolKind YYEMPTY YYUNDEF YYTNAME NUM yyntokens yytname sed
|
||||||
|
# LocalWords: nonterminals yykind yycode YYNAMES yynames init getName conv
|
||||||
|
# LocalWords: TokenKind ival yychar yylval yylexer Tolmer hoc
|
||||||
|
# LocalWords: Sobisch YYPTRDIFF ptrdiff Autotest toknum yytoknum
|
||||||
|
# LocalWords: sym Wother stderr FP fixits xgettext fdiagnostics Graphviz
|
||||||
|
# LocalWords: graphviz VCG bitset xml bw maint yytoken YYABORT deps
|
||||||
|
# LocalWords: YYACCEPT yytranslate nonnegative destructors yyerrlab repo
|
||||||
|
# LocalWords: backends stmt expr yy Mardle baz qux Vadim Maslow CPP cpp
|
||||||
|
# LocalWords: yydebug gcc UCHAR EBCDIC gung PDP NUL Pre Florian Krohm utf
|
||||||
|
# LocalWords: YYACT YYLLOC YYLSP yyval yyvsp yylen yyloc yylsp endif
|
||||||
|
# LocalWords: ispell american
|
||||||
|
|
||||||
Local Variables:
|
Local Variables:
|
||||||
mode: outline
|
mode: outline
|
||||||
coding: utf-8
|
coding: utf-8
|
||||||
fill-column: 76
|
fill-column: 76
|
||||||
|
ispell-dictionary: "american"
|
||||||
End:
|
End:
|
||||||
|
|
||||||
-----
|
Copyright (C) 2001-2004, 2006, 2008-2015, 2018-2021 Free Software
|
||||||
|
|
||||||
Copyright (C) 2001-2004, 2006, 2008-2015, 2018-2020 Free Software
|
|
||||||
Foundation, Inc.
|
Foundation, Inc.
|
||||||
|
|
||||||
This file is part of Bison, the GNU Compiler Compiler.
|
This file is part of Bison, the GNU Compiler Compiler.
|
||||||
|
|
||||||
This program is free software: you can redistribute it and/or modify
|
Permission is granted to copy, distribute and/or modify this document
|
||||||
it under the terms of the GNU General Public License as published by
|
under the terms of the GNU Free Documentation License, Version 1.3 or
|
||||||
the Free Software Foundation, either version 3 of the License, or
|
any later version published by the Free Software Foundation; with no
|
||||||
(at your option) any later version.
|
Invariant Sections, with no Front-Cover Texts, and with no Back-Cover
|
||||||
|
Texts. A copy of the license is included in the "GNU Free
|
||||||
This program is distributed in the hope that it will be useful,
|
Documentation License" file as part of this distribution.
|
||||||
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,10 +1,10 @@
|
|||||||
#! /bin/sh
|
#! /bin/sh
|
||||||
# Print a version string.
|
# Print a version string.
|
||||||
scriptversion=2020-04-13.15; # UTC
|
scriptversion=2021-04-11.09; # UTC
|
||||||
|
|
||||||
# Bootstrap this package from checked-out sources.
|
# Bootstrap this package from checked-out sources.
|
||||||
|
|
||||||
# Copyright (C) 2003-2020 Free Software Foundation, Inc.
|
# Copyright (C) 2003-2021 Free Software Foundation, Inc.
|
||||||
|
|
||||||
# This program is free software: you can redistribute it and/or modify
|
# This program is free software: you can redistribute it and/or modify
|
||||||
# it under the terms of the GNU General Public License as published by
|
# it under the terms of the GNU General Public License as published by
|
||||||
@@ -47,7 +47,7 @@ PERL="${PERL-perl}"
|
|||||||
|
|
||||||
me=$0
|
me=$0
|
||||||
|
|
||||||
default_gnulib_url=git://git.sv.gnu.org/gnulib
|
default_gnulib_url=https://git.savannah.gnu.org/git/gnulib.git
|
||||||
|
|
||||||
usage() {
|
usage() {
|
||||||
cat <<EOF
|
cat <<EOF
|
||||||
@@ -71,7 +71,9 @@ Options:
|
|||||||
--no-git do not use git to update gnulib. Requires that
|
--no-git do not use git to update gnulib. Requires that
|
||||||
--gnulib-srcdir point to a correct gnulib snapshot
|
--gnulib-srcdir point to a correct gnulib snapshot
|
||||||
--skip-po do not download po files
|
--skip-po do not download po files
|
||||||
|
EOF
|
||||||
|
bootstrap_print_option_usage_hook
|
||||||
|
cat <<EOF
|
||||||
If the file $me.conf exists in the same directory as this script, its
|
If the file $me.conf exists in the same directory as this script, its
|
||||||
contents are read as shell variables to configure the bootstrap.
|
contents are read as shell variables to configure the bootstrap.
|
||||||
|
|
||||||
@@ -113,6 +115,12 @@ Running without arguments will suffice in most cases.
|
|||||||
EOF
|
EOF
|
||||||
}
|
}
|
||||||
|
|
||||||
|
copyright_year=`echo "$scriptversion" | sed -e 's/[^0-9].*//'`
|
||||||
|
copyright="Copyright (C) ${copyright_year} Free Software Foundation, Inc.
|
||||||
|
License GPLv3+: GNU GPL version 3 or later <https://gnu.org/licenses/gpl.html>.
|
||||||
|
This is free software: you are free to change and redistribute it.
|
||||||
|
There is NO WARRANTY, to the extent permitted by law."
|
||||||
|
|
||||||
# warnf_ FORMAT-STRING ARG1...
|
# warnf_ FORMAT-STRING ARG1...
|
||||||
warnf_ ()
|
warnf_ ()
|
||||||
{
|
{
|
||||||
@@ -154,6 +162,18 @@ gnulib_files=
|
|||||||
: ${AUTOPOINT=autopoint}
|
: ${AUTOPOINT=autopoint}
|
||||||
: ${AUTORECONF=autoreconf}
|
: ${AUTORECONF=autoreconf}
|
||||||
|
|
||||||
|
# A function to be called for each unrecognized option. Returns 0 if
|
||||||
|
# the option in $1 has been processed by the function. Returns 1 if
|
||||||
|
# the option has not been processed by the function. Override it via
|
||||||
|
# your own definition in bootstrap.conf
|
||||||
|
|
||||||
|
bootstrap_option_hook() { return 1; }
|
||||||
|
|
||||||
|
# A function to be called in order to print the --help information
|
||||||
|
# corresponding to user-defined command-line options.
|
||||||
|
|
||||||
|
bootstrap_print_option_usage_hook() { :; }
|
||||||
|
|
||||||
# A function to be called right after gnulib-tool is run.
|
# A function to be called right after gnulib-tool is run.
|
||||||
# Override it via your own definition in bootstrap.conf.
|
# Override it via your own definition in bootstrap.conf.
|
||||||
bootstrap_post_import_hook() { :; }
|
bootstrap_post_import_hook() { :; }
|
||||||
@@ -170,7 +190,7 @@ po_download_command_format=\
|
|||||||
https://translationproject.org/latest/%s/"
|
https://translationproject.org/latest/%s/"
|
||||||
|
|
||||||
# Prefer a non-empty tarname (4th argument of AC_INIT if given), else
|
# Prefer a non-empty tarname (4th argument of AC_INIT if given), else
|
||||||
# fall back to the package name (1st argument with munging)
|
# fall back to the package name (1st argument with munging).
|
||||||
extract_package_name='
|
extract_package_name='
|
||||||
/^AC_INIT(\[*/{
|
/^AC_INIT(\[*/{
|
||||||
s///
|
s///
|
||||||
@@ -187,8 +207,11 @@ extract_package_name='
|
|||||||
p
|
p
|
||||||
}
|
}
|
||||||
'
|
'
|
||||||
package=$(sed -n "$extract_package_name" configure.ac) \
|
package=$(${AUTOCONF:-autoconf} --trace AC_INIT:\$4 configure.ac 2>/dev/null)
|
||||||
|| die 'cannot find package name in configure.ac'
|
if test -z "$package"; then
|
||||||
|
package=$(sed -n "$extract_package_name" configure.ac) \
|
||||||
|
|| die 'cannot find package name in configure.ac'
|
||||||
|
fi
|
||||||
gnulib_name=lib$package
|
gnulib_name=lib$package
|
||||||
|
|
||||||
build_aux=build-aux
|
build_aux=build-aux
|
||||||
@@ -320,6 +343,12 @@ do
|
|||||||
--help)
|
--help)
|
||||||
usage
|
usage
|
||||||
exit;;
|
exit;;
|
||||||
|
--version)
|
||||||
|
set -e
|
||||||
|
echo "bootstrap $scriptversion"
|
||||||
|
echo "$copyright"
|
||||||
|
exit 0
|
||||||
|
;;
|
||||||
--gnulib-srcdir=*)
|
--gnulib-srcdir=*)
|
||||||
GNULIB_SRCDIR=${option#--gnulib-srcdir=};;
|
GNULIB_SRCDIR=${option#--gnulib-srcdir=};;
|
||||||
--skip-po)
|
--skip-po)
|
||||||
@@ -335,7 +364,7 @@ do
|
|||||||
--no-git)
|
--no-git)
|
||||||
use_git=false;;
|
use_git=false;;
|
||||||
*)
|
*)
|
||||||
die "$option: unknown option";;
|
bootstrap_option_hook $option || die "$option: unknown option";;
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
|
|
||||||
|
|||||||
+12
-7
@@ -1,6 +1,6 @@
|
|||||||
# Bootstrap configuration.
|
# Bootstrap configuration.
|
||||||
|
|
||||||
# Copyright (C) 2006-2015, 2018-2020 Free Software Foundation, Inc.
|
# Copyright (C) 2006-2015, 2018-2021 Free Software Foundation, Inc.
|
||||||
|
|
||||||
# This program is free software: you can redistribute it and/or modify
|
# This program is free software: you can redistribute it and/or modify
|
||||||
# it under the terms of the GNU General Public License as published by
|
# it under the terms of the GNU General Public License as published by
|
||||||
@@ -13,23 +13,25 @@
|
|||||||
# GNU General Public License for more details.
|
# GNU General Public License for more details.
|
||||||
#
|
#
|
||||||
# You should have received a copy of the GNU General Public License
|
# You should have received a copy of the GNU General Public License
|
||||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
# gnulib modules used by this package.
|
# gnulib modules used by this package.
|
||||||
gnulib_modules='
|
gnulib_modules='
|
||||||
argmatch array-list assert assure
|
argmatch array-list assert assure attribute
|
||||||
bitsetv
|
bitsetv
|
||||||
calloc-posix close closeout config-h c-strcase
|
calloc-posix close closeout config-h c-strcase
|
||||||
configmake
|
configmake
|
||||||
dirname
|
dirname
|
||||||
error extensions
|
error execute extensions
|
||||||
fdl fopen-safer fstrcmp
|
fdl fopen-safer fstrcmp
|
||||||
getopt-gnu
|
getopt-gnu
|
||||||
gettext-h git-version-gen gitlog-to-changelog
|
gettext-h git-version-gen gitlog-to-changelog
|
||||||
gpl-3.0 intprops inttypes isnan javacomp-script
|
gpl-3.0 intprops inttypes isnan javacomp-script
|
||||||
|
hash-map
|
||||||
javaexec-script
|
javaexec-script
|
||||||
ldexpl
|
ldexpl
|
||||||
libtextstyle-optional
|
libtextstyle-optional
|
||||||
|
linked-list
|
||||||
malloc-gnu
|
malloc-gnu
|
||||||
mbfile mbswidth
|
mbfile mbswidth
|
||||||
non-recursive-gnulib-prefix-hack
|
non-recursive-gnulib-prefix-hack
|
||||||
@@ -37,14 +39,17 @@ gnulib_modules='
|
|||||||
obstack-printf
|
obstack-printf
|
||||||
perror progname
|
perror progname
|
||||||
quote quotearg
|
quote quotearg
|
||||||
|
rbtreehash-list
|
||||||
readline
|
readline
|
||||||
readme-release
|
readme-release
|
||||||
realloc-posix
|
realloc-posix
|
||||||
relocatable-prog relocatable-script
|
relocatable-prog relocatable-script
|
||||||
rename
|
rename
|
||||||
spawn-pipe stdbool stpcpy strdup-posix strerror strverscmp
|
spawn-pipe stdbool stpcpy stpncpy strdup-posix strerror strverscmp
|
||||||
|
sys_ioctl
|
||||||
|
termios
|
||||||
timevar
|
timevar
|
||||||
unistd unistd-safer unlink unlocked-io
|
unicodeio unistd unistd-safer unlink unlocked-io
|
||||||
update-copyright unsetenv verify
|
update-copyright unsetenv verify
|
||||||
warnings
|
warnings
|
||||||
winsz-ioctl
|
winsz-ioctl
|
||||||
@@ -54,7 +59,7 @@ gnulib_modules='
|
|||||||
xconcat-filename
|
xconcat-filename
|
||||||
xhash
|
xhash
|
||||||
xlist
|
xlist
|
||||||
xmemdup0
|
xmap xmemdup0
|
||||||
xstrndup
|
xstrndup
|
||||||
|
|
||||||
fprintf-posix printf-posix snprintf-posix sprintf-posix
|
fprintf-posix printf-posix snprintf-posix sprintf-posix
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
/announce-gen
|
/announce-gen
|
||||||
/compile
|
/compile
|
||||||
/config.guess
|
/config.guess
|
||||||
|
/config.libpath
|
||||||
/config.rpath
|
/config.rpath
|
||||||
/config.rpath~
|
/config.rpath~
|
||||||
/config.sub
|
/config.sub
|
||||||
@@ -11,20 +12,19 @@
|
|||||||
/gitlog-to-changelog
|
/gitlog-to-changelog
|
||||||
/gnu-web-doc-update
|
/gnu-web-doc-update
|
||||||
/gnupload
|
/gnupload
|
||||||
|
/install-reloc
|
||||||
/install-sh
|
/install-sh
|
||||||
/javacomp.sh.in
|
/javacomp.sh.in
|
||||||
/javaexec.sh.in
|
/javaexec.sh.in
|
||||||
|
/libtool-reloc
|
||||||
/mdate-sh
|
/mdate-sh
|
||||||
/missing
|
/missing
|
||||||
/prefix-gnulib-mk
|
/prefix-gnulib-mk
|
||||||
|
/reloc-ldflags
|
||||||
|
/relocatable.sh.in
|
||||||
/test-driver
|
/test-driver
|
||||||
/texinfo.tex
|
/texinfo.tex
|
||||||
/update-copyright
|
/update-copyright
|
||||||
/useless-if-before-free
|
/useless-if-before-free
|
||||||
/vc-list-files
|
/vc-list-files
|
||||||
/ylwrap
|
/ylwrap
|
||||||
/config.libpath
|
|
||||||
/install-reloc
|
|
||||||
/reloc-ldflags
|
|
||||||
/relocatable.sh.in
|
|
||||||
/libtool-reloc
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
# Copyright (C) 2012-2015, 2018-2020 Free Software Foundation, Inc.
|
# Copyright (C) 2012-2015, 2018-2021 Free Software Foundation, Inc.
|
||||||
|
|
||||||
# This program is free software: you can redistribute it and/or modify
|
# This program is free software: you can redistribute it and/or modify
|
||||||
# it under the terms of the GNU General Public License as published by
|
# it under the terms of the GNU General Public License as published by
|
||||||
@@ -11,7 +11,7 @@
|
|||||||
# GNU General Public License for more details.
|
# GNU General Public License for more details.
|
||||||
#
|
#
|
||||||
# You should have received a copy of the GNU General Public License
|
# You should have received a copy of the GNU General Public License
|
||||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
# Valgrind suppression file for Bison.
|
# Valgrind suppression file for Bison.
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
# Copyright (C) 2012-2015, 2018-2020 Free Software Foundation, Inc.
|
# Copyright (C) 2012-2015, 2018-2021 Free Software Foundation, Inc.
|
||||||
|
|
||||||
# This program is free software: you can redistribute it and/or modify
|
# This program is free software: you can redistribute it and/or modify
|
||||||
# it under the terms of the GNU General Public License as published by
|
# it under the terms of the GNU General Public License as published by
|
||||||
@@ -11,7 +11,7 @@
|
|||||||
# GNU General Public License for more details.
|
# GNU General Public License for more details.
|
||||||
#
|
#
|
||||||
# You should have received a copy of the GNU General Public License
|
# You should have received a copy of the GNU General Public License
|
||||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
# Valgrind suppression file for Bison.
|
# Valgrind suppression file for Bison.
|
||||||
|
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
# Generate a release announcement message.
|
# Generate a release announcement message.
|
||||||
|
|
||||||
# Copyright (C) 2007-2020 Free Software Foundation, Inc.
|
# Copyright (C) 2007-2021 Free Software Foundation, Inc.
|
||||||
#
|
#
|
||||||
# This program is free software: you can redistribute it and/or modify
|
# This program is free software: you can redistribute it and/or modify
|
||||||
# it under the terms of the GNU General Public License as published by
|
# it under the terms of the GNU General Public License as published by
|
||||||
|
|||||||
+2
-2
@@ -1,4 +1,4 @@
|
|||||||
## Copyright (C) 2000-2015, 2018-2020 Free Software Foundation, Inc.
|
## Copyright (C) 2000-2015, 2018-2021 Free Software Foundation, Inc.
|
||||||
##
|
##
|
||||||
## This program is free software: you can redistribute it and/or modify
|
## This program is free software: you can redistribute it and/or modify
|
||||||
## it under the terms of the GNU General Public License as published by
|
## it under the terms of the GNU General Public License as published by
|
||||||
@@ -11,7 +11,7 @@
|
|||||||
## GNU General Public License for more details.
|
## GNU General Public License for more details.
|
||||||
##
|
##
|
||||||
## You should have received a copy of the GNU General Public License
|
## You should have received a copy of the GNU General Public License
|
||||||
## along with this program. If not, see <http://www.gnu.org/licenses/>.
|
## along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
EXTRA_DIST += \
|
EXTRA_DIST += \
|
||||||
build-aux/Darwin.valgrind \
|
build-aux/Darwin.valgrind \
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
# Update b4_copyright invocations or b4_copyright_years definitions to
|
# Update b4_copyright invocations or b4_copyright_years definitions to
|
||||||
# include the current year.
|
# include the current year.
|
||||||
|
|
||||||
# Copyright (C) 2009-2015, 2018-2020 Free Software Foundation, Inc.
|
# Copyright (C) 2009-2015, 2018-2021 Free Software Foundation, Inc.
|
||||||
|
|
||||||
# This program is free software; you can redistribute it and/or modify
|
# This program is free software; you can redistribute it and/or modify
|
||||||
# it under the terms of the GNU General Public License as published by
|
# it under the terms of the GNU General Public License as published by
|
||||||
@@ -16,7 +16,7 @@
|
|||||||
# GNU General Public License for more details.
|
# GNU General Public License for more details.
|
||||||
#
|
#
|
||||||
# You should have received a copy of the GNU General Public License
|
# You should have received a copy of the GNU General Public License
|
||||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
use strict;
|
use strict;
|
||||||
use warnings;
|
use warnings;
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
# In configure.ac, update PACKAGE_COPYRIGHT_YEAR to the current year.
|
# In configure.ac, update PACKAGE_COPYRIGHT_YEAR to the current year.
|
||||||
|
|
||||||
# Copyright (C) 2010-2015, 2018-2020 Free Software Foundation, Inc.
|
# Copyright (C) 2010-2015, 2018-2021 Free Software Foundation, Inc.
|
||||||
#
|
#
|
||||||
# This program is free software; you can redistribute it and/or modify
|
# This program is free software; you can redistribute it and/or modify
|
||||||
# it under the terms of the GNU General Public License as published by
|
# it under the terms of the GNU General Public License as published by
|
||||||
@@ -15,7 +15,7 @@
|
|||||||
# GNU General Public License for more details.
|
# GNU General Public License for more details.
|
||||||
#
|
#
|
||||||
# You should have received a copy of the GNU General Public License
|
# You should have received a copy of the GNU General Public License
|
||||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
use strict;
|
use strict;
|
||||||
use warnings;
|
use warnings;
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
# Update expectations in an Autotest test suite.
|
# Update expectations in an Autotest test suite.
|
||||||
|
|
||||||
# Copyright (C) 2019-2020 Free Software Foundation, Inc.
|
# Copyright (C) 2019-2021 Free Software Foundation, Inc.
|
||||||
#
|
#
|
||||||
# This program is free software: you can redistribute it and/or modify
|
# This program is free software: you can redistribute it and/or modify
|
||||||
# it under the terms of the GNU General Public License as published by
|
# it under the terms of the GNU General Public License as published by
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
## Customize maint.mk -*- makefile -*-
|
## Customize maint.mk -*- makefile -*-
|
||||||
## Copyright (C) 2008-2015, 2018-2020 Free Software Foundation, Inc.
|
## Copyright (C) 2008-2015, 2018-2021 Free Software Foundation, Inc.
|
||||||
|
|
||||||
## This program is free software: you can redistribute it and/or modify
|
## This program is free software: you can redistribute it and/or modify
|
||||||
## it under the terms of the GNU General Public License as published by
|
## it under the terms of the GNU General Public License as published by
|
||||||
@@ -12,7 +12,7 @@
|
|||||||
## GNU General Public License for more details.
|
## GNU General Public License for more details.
|
||||||
|
|
||||||
## You should have received a copy of the GNU General Public License
|
## You should have received a copy of the GNU General Public License
|
||||||
## along with this program. If not, see <http://www.gnu.org/licenses/>.
|
## along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
# Update version, then recompile so that tests/bison --version be
|
# Update version, then recompile so that tests/bison --version be
|
||||||
# up-to-date, then compile our parser again with our up-to-date bison.
|
# up-to-date, then compile our parser again with our up-to-date bison.
|
||||||
@@ -126,7 +126,7 @@ _sed_rm_comments_q = $(subst ','\'',$(_sed_remove_comments))
|
|||||||
|
|
||||||
_space_before_paren_exempt =? \\n\\$$
|
_space_before_paren_exempt =? \\n\\$$
|
||||||
_space_before_paren_exempt = \
|
_space_before_paren_exempt = \
|
||||||
(^ *\#|(LA)?LR\([01]\)|percent_(code|define)|b4_syncline|m4_(define|init)|symbol)
|
(^ *\#|(LA)?LR\([01]\)|percent_(code|define)|b4_syncline|m4_(define|init))
|
||||||
# Ensure that there is a space before each open parenthesis in C code.
|
# Ensure that there is a space before each open parenthesis in C code.
|
||||||
sc_space_before_open_paren:
|
sc_space_before_open_paren:
|
||||||
@if $(VC_LIST_EXCEPT) | grep -l '\.[ch]$$' > /dev/null; then \
|
@if $(VC_LIST_EXCEPT) | grep -l '\.[ch]$$' > /dev/null; then \
|
||||||
@@ -156,6 +156,8 @@ exclude = \
|
|||||||
$(call exclude, \
|
$(call exclude, \
|
||||||
bindtextdomain=^lib/main.c$$ \
|
bindtextdomain=^lib/main.c$$ \
|
||||||
cast_of_argument_to_free=^src/muscle-tab.c$$ \
|
cast_of_argument_to_free=^src/muscle-tab.c$$ \
|
||||||
|
error_message_uppercase=etc/bench.pl.in$$ \
|
||||||
|
file_system=^doc/Doxyfile.in$$ \
|
||||||
po_check=^tests|(^po/POTFILES.in|.md)$$ \
|
po_check=^tests|(^po/POTFILES.in|.md)$$ \
|
||||||
preprocessor_indentation=^data/|^lib/|^src/parse-gram.[ch]$$ \
|
preprocessor_indentation=^data/|^lib/|^src/parse-gram.[ch]$$ \
|
||||||
program_name=^lib/main.c$$ \
|
program_name=^lib/main.c$$ \
|
||||||
|
|||||||
+13
-14
@@ -1,6 +1,6 @@
|
|||||||
# Configure template for GNU Bison. -*-Autoconf-*-
|
# Configure template for GNU Bison. -*-Autoconf-*-
|
||||||
#
|
#
|
||||||
# Copyright (C) 2001-2015, 2018-2020 Free Software Foundation, Inc.
|
# Copyright (C) 2001-2015, 2018-2021 Free Software Foundation, Inc.
|
||||||
#
|
#
|
||||||
# This program is free software: you can redistribute it and/or modify
|
# This program is free software: you can redistribute it and/or modify
|
||||||
# it under the terms of the GNU General Public License as published by
|
# it under the terms of the GNU General Public License as published by
|
||||||
@@ -13,14 +13,9 @@
|
|||||||
# GNU General Public License for more details.
|
# GNU General Public License for more details.
|
||||||
#
|
#
|
||||||
# You should have received a copy of the GNU General Public License
|
# You should have received a copy of the GNU General Public License
|
||||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
# In order for some versions of Sun Studio to compile our C++ test cases
|
AC_PREREQ([2.71])
|
||||||
# correctly, we need Autoconf 2.64 or better to handle the restrict
|
|
||||||
# keyword in at least string.h from gnulib. We need Autoconf 2.68 or
|
|
||||||
# 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]|AX_|BISON_)])
|
m4_pattern_forbid([^_?(gl_[A-Z]|AX_|BISON_)])
|
||||||
m4_pattern_allow([^BISON_USE_NLS$])
|
m4_pattern_allow([^BISON_USE_NLS$])
|
||||||
|
|
||||||
@@ -29,7 +24,7 @@ AC_INIT([GNU Bison],
|
|||||||
[[email protected]],
|
[[email protected]],
|
||||||
[],
|
[],
|
||||||
[https://www.gnu.org/software/bison/])
|
[https://www.gnu.org/software/bison/])
|
||||||
AC_SUBST([PACKAGE_COPYRIGHT_YEAR], [2020])
|
AC_SUBST([PACKAGE_COPYRIGHT_YEAR], [2021])
|
||||||
AC_DEFINE_UNQUOTED([PACKAGE_COPYRIGHT_YEAR], [$PACKAGE_COPYRIGHT_YEAR],
|
AC_DEFINE_UNQUOTED([PACKAGE_COPYRIGHT_YEAR], [$PACKAGE_COPYRIGHT_YEAR],
|
||||||
[The copyright year for this package])
|
[The copyright year for this package])
|
||||||
|
|
||||||
@@ -54,12 +49,15 @@ AM_SILENT_RULES([yes])
|
|||||||
AC_CONFIG_HEADERS([lib/config.h:lib/config.in.h])
|
AC_CONFIG_HEADERS([lib/config.h:lib/config.in.h])
|
||||||
|
|
||||||
# Checks for the compiler.
|
# Checks for the compiler.
|
||||||
AC_PROG_CC_STDC
|
AC_PROG_CC
|
||||||
AC_PROG_CXX
|
AC_PROG_CXX
|
||||||
|
|
||||||
# Gnulib (early checks).
|
# Gnulib (early checks).
|
||||||
gl_EARLY
|
gl_EARLY
|
||||||
|
|
||||||
|
# We want ostream_printf and hyperlink support.
|
||||||
|
gl_LIBTEXTSTYLE_OPTIONAL([0.20.5])
|
||||||
|
|
||||||
# Gnulib uses '#pragma GCC diagnostic push' to silence some
|
# Gnulib uses '#pragma GCC diagnostic push' to silence some
|
||||||
# warnings, but older gcc doesn't support this.
|
# warnings, but older gcc doesn't support this.
|
||||||
AC_CACHE_CHECK([whether pragma GCC diagnostic push works],
|
AC_CACHE_CHECK([whether pragma GCC diagnostic push works],
|
||||||
@@ -81,7 +79,8 @@ BISON_CXXSTD([03])
|
|||||||
BISON_CXXSTD([11])
|
BISON_CXXSTD([11])
|
||||||
BISON_CXXSTD([14])
|
BISON_CXXSTD([14])
|
||||||
BISON_CXXSTD([17])
|
BISON_CXXSTD([17])
|
||||||
BISON_CXXSTD([2a])
|
BISON_CXXSTD([20])
|
||||||
|
BISON_CXXSTD([2b])
|
||||||
AM_CONDITIONAL([ENABLE_CXX11], [test x"$CXX11_CXXFLAGS" != x])
|
AM_CONDITIONAL([ENABLE_CXX11], [test x"$CXX11_CXXFLAGS" != x])
|
||||||
AM_CONDITIONAL([ENABLE_CXX14], [test x"$CXX14_CXXFLAGS" != x])
|
AM_CONDITIONAL([ENABLE_CXX14], [test x"$CXX14_CXXFLAGS" != x])
|
||||||
AC_LANG_POP([C++])
|
AC_LANG_POP([C++])
|
||||||
@@ -130,9 +129,9 @@ if test "$enable_gcc_warnings" = yes; then
|
|||||||
warn_common='-Wall -Wextra
|
warn_common='-Wall -Wextra
|
||||||
-Wcast-align -Wchar-subscripts
|
-Wcast-align -Wchar-subscripts
|
||||||
-fparse-all-comments -Wdocumentation
|
-fparse-all-comments -Wdocumentation
|
||||||
-Wformat -Wimplicit-fallthrough -Wnull-dereference
|
-Wformat -Wimplicit-fallthrough -Wmismatched-dealloc -Wnull-dereference
|
||||||
-Wno-sign-compare -Wno-tautological-constant-out-of-range-compare
|
-Wno-sign-compare -Wno-tautological-constant-out-of-range-compare
|
||||||
-Wpointer-arith -Wshadow
|
-Wpointer-arith -Wshadow -Wstrict-aliasing
|
||||||
-Wwrite-strings
|
-Wwrite-strings
|
||||||
-wr188 -wr2259 -wr3179'
|
-wr188 -wr2259 -wr3179'
|
||||||
warn_c='-Wbad-function-cast
|
warn_c='-Wbad-function-cast
|
||||||
@@ -248,7 +247,7 @@ AM_CONDITIONAL([ENABLE_JAVA], [test x"$CONF_JAVAC" != x && test x"$CONF_JAVA" !=
|
|||||||
|
|
||||||
|
|
||||||
AC_ARG_ENABLE([yacc],
|
AC_ARG_ENABLE([yacc],
|
||||||
[AC_HELP_STRING([--disable-yacc],
|
[AS_HELP_STRING([--disable-yacc],
|
||||||
[do not build a yacc command or an -ly library])],
|
[do not build a yacc command or an -ly library])],
|
||||||
, [enable_yacc=yes])
|
, [enable_yacc=yes])
|
||||||
AM_CONDITIONAL([ENABLE_YACC], [test "$enable_yacc" = yes])
|
AM_CONDITIONAL([ENABLE_YACC], [test "$enable_yacc" = yes])
|
||||||
|
|||||||
+49
-21
@@ -1,6 +1,6 @@
|
|||||||
This directory contains data needed by Bison.
|
This directory contains data needed by Bison.
|
||||||
|
|
||||||
# Directory content
|
# Directory Content
|
||||||
## Skeletons
|
## Skeletons
|
||||||
Bison skeletons: the general shapes of the different parser kinds, that are
|
Bison skeletons: the general shapes of the different parser kinds, that are
|
||||||
specialized for specific grammars by the bison program.
|
specialized for specific grammars by the bison program.
|
||||||
@@ -48,7 +48,7 @@ various formats.
|
|||||||
- xml2xhtml.xsl
|
- xml2xhtml.xsl
|
||||||
Conversion into XHTML.
|
Conversion into XHTML.
|
||||||
|
|
||||||
# Implementation note about the skeletons
|
# Implementation Notes About the Skeletons
|
||||||
|
|
||||||
"Skeleton" in Bison parlance means "backend": a skeleton is fed by the bison
|
"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
|
executable with LR tables, facts about the symbols, etc. and they generate
|
||||||
@@ -73,40 +73,60 @@ 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
|
your language. Overall, be sure to follow the same patterns as the existing
|
||||||
skeletons.
|
skeletons.
|
||||||
|
|
||||||
|
## Vocabulary
|
||||||
|
|
||||||
|
We use "formal arguments", or "formals" for short, to denote the declared
|
||||||
|
parameters of a function (e.g., `int argc, const char **argv`). Yes, this
|
||||||
|
is somewhat contradictory with `param` in the `%param` directives.
|
||||||
|
|
||||||
|
We use "effective arguments", or "args" for short, to denote the values
|
||||||
|
passed in function calls (e.g., `argc, argv`).
|
||||||
|
|
||||||
## Symbols
|
## Symbols
|
||||||
|
|
||||||
### `b4_symbol(NUM, FIELD)`
|
### `b4_symbol(NUM, FIELD)`
|
||||||
In order to unify the handling of the various aspects of symbols (tag, type
|
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,
|
name, whether terminal, etc.), bison.exe defines one macro per (token,
|
||||||
field), where field can `has_id`, `id`, etc.: see
|
field), where field can `has_id`, `id`, etc.: see
|
||||||
`prepare_symbols_definitions()` in `src/output.c`.
|
`prepare_symbol_definitions()` in `src/output.c`.
|
||||||
|
|
||||||
The macro `b4_symbol(NUM, FIELD)` gives access to the following FIELDS:
|
NUM can be:
|
||||||
|
- `empty` to denote the "empty" pseudo-symbol when it exists,
|
||||||
|
- `eof`, `error`, or `undef`
|
||||||
|
- a symbol number.
|
||||||
|
|
||||||
|
FIELD can be:
|
||||||
|
|
||||||
- `has_id`: 0 or 1
|
- `has_id`: 0 or 1
|
||||||
Whether the symbol has an id.
|
Whether the symbol has an `id`.
|
||||||
|
|
||||||
- `id`: string
|
- `id`: string (e.g., `exp`, `NUM`, or `TOK_NUM` with api.token.prefix)
|
||||||
If has_id, the id (prefixed by api.token.prefix if defined), otherwise
|
If `has_id`, the name of the token kind (prefixed by api.token.prefix if
|
||||||
defined as empty. Guaranteed to be usable as a C identifier. This is
|
defined), otherwise empty. Guaranteed to be usable as a C identifier.
|
||||||
used to define the token kind (i.e., the enum used by the return value of
|
This is used to define the token kind (i.e., the enum used by the return
|
||||||
yylex).
|
value of yylex). Should be named `token_kind`.
|
||||||
|
|
||||||
- `tag`: string
|
- `tag`: string
|
||||||
A human representation of the symbol. Can be 'foo', 'foo.id', '"foo"' etc.
|
A human readable representation of the symbol. Can be `'foo'`,
|
||||||
|
`'foo.id'`, `'"foo"'` etc.
|
||||||
|
|
||||||
- `user_number`: integer
|
- `code`: integer
|
||||||
The code associated to the `id`.
|
The token code associated to the token kind `id`.
|
||||||
The external number as used by yylex. Can be ASCII code when a character,
|
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
|
some number chosen by bison, or some user number in the case of `%token
|
||||||
%token FOO <NUM>. Corresponds to yychar in yacc.c.
|
FOO <NUM>`. Corresponds to `yychar` in `yacc.c`.
|
||||||
|
|
||||||
- `is_token`: 0 or 1
|
- `is_token`: 0 or 1
|
||||||
Whether this is a terminal symbol.
|
Whether this is a terminal symbol.
|
||||||
|
|
||||||
|
- `kind_base`: string (e.g., `YYSYMBOL_exp`, `YYSYMBOL_NUM`)
|
||||||
|
The base of the symbol kind, i.e., the enumerator of this symbol (token or
|
||||||
|
nonterminal) which is mapped to its `number`.
|
||||||
|
|
||||||
- `kind`: string
|
- `kind`: string
|
||||||
The symbol kind, i.e., the enumerator of this symbol (token or nonterminal)
|
Same as `kind_base`, but possibly with a prefix in some languages. E.g.,
|
||||||
which is mapping to its `number`.
|
EOF's `kind_base` and `kind` are `YYSYMBOL_YYEOF` in C, but are
|
||||||
|
`S_YYEMPTY` and `symbol_kind::S_YYEMPTY` in C++.
|
||||||
|
|
||||||
- `number`: integer
|
- `number`: integer
|
||||||
The code associated to the `kind`.
|
The code associated to the `kind`.
|
||||||
@@ -136,11 +156,17 @@ The macro `b4_symbol(NUM, FIELD)` gives access to the following FIELDS:
|
|||||||
When api.value.type=union, the generated name for the union member.
|
When api.value.type=union, the generated name for the union member.
|
||||||
yytype_INT etc. for symbols that has_id, otherwise yytype_1 etc.
|
yytype_INT etc. for symbols that has_id, otherwise yytype_1 etc.
|
||||||
|
|
||||||
- `type`
|
- `type`: string
|
||||||
If it has a semantic value, its type tag, or, if variant are used,
|
If it has a semantic value, its type tag, or, if variant are used,
|
||||||
its type.
|
its type.
|
||||||
In the case of api.value.type=union, type is the real type (e.g. int).
|
In the case of api.value.type=union, type is the real type (e.g. int).
|
||||||
|
|
||||||
|
- `slot`: string
|
||||||
|
If it has a semantic value, the name of the union member (i.e., bounces to
|
||||||
|
either `type_tag` or `type`). It would be better to fix our mess and
|
||||||
|
always use `type` for the true type of the member, and `type_tag` for the
|
||||||
|
name of the union member.
|
||||||
|
|
||||||
- `has_printer`: 0, 1
|
- `has_printer`: 0, 1
|
||||||
- `printer`: string
|
- `printer`: string
|
||||||
- `printer_file`: string
|
- `printer_file`: string
|
||||||
@@ -173,7 +199,7 @@ The data corresponding to the symbol `#POS`, where the current rule has
|
|||||||
Expansion of `$<TYPE>POS`, where the current rule has `RULE-LENGTH` symbols
|
Expansion of `$<TYPE>POS`, where the current rule has `RULE-LENGTH` symbols
|
||||||
on RHS.
|
on RHS.
|
||||||
|
|
||||||
-----
|
<!--
|
||||||
|
|
||||||
Local Variables:
|
Local Variables:
|
||||||
mode: markdown
|
mode: markdown
|
||||||
@@ -181,7 +207,7 @@ fill-column: 76
|
|||||||
ispell-dictionary: "american"
|
ispell-dictionary: "american"
|
||||||
End:
|
End:
|
||||||
|
|
||||||
Copyright (C) 2002, 2008-2015, 2018-2020 Free Software Foundation, Inc.
|
Copyright (C) 2002, 2008-2015, 2018-2021 Free Software Foundation, Inc.
|
||||||
|
|
||||||
This file is part of GNU Bison.
|
This file is part of GNU Bison.
|
||||||
|
|
||||||
@@ -196,4 +222,6 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|||||||
GNU General Public License for more details.
|
GNU General Public License for more details.
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
You should have received a copy of the GNU General Public License
|
||||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
-->
|
||||||
|
|||||||
+28
-1
@@ -1,5 +1,5 @@
|
|||||||
/* Default styling rules for Bison when doing terminal output.
|
/* Default styling rules for Bison when doing terminal output.
|
||||||
Copyright (C) 2019-2020 Free Software Foundation, Inc.
|
Copyright (C) 2019-2021 Free Software Foundation, Inc.
|
||||||
|
|
||||||
This program is free software: you can redistribute it and/or modify
|
This program is free software: you can redistribute it and/or modify
|
||||||
it under the terms of the GNU General Public License as published by
|
it under the terms of the GNU General Public License as published by
|
||||||
@@ -30,5 +30,32 @@
|
|||||||
/* "Sections" in traces (--trace). */
|
/* "Sections" in traces (--trace). */
|
||||||
.trace0 { color: green; }
|
.trace0 { color: green; }
|
||||||
|
|
||||||
|
/* Syntax error messages. */
|
||||||
.expected { color: green; }
|
.expected { color: green; }
|
||||||
.unexpected { color: red; }
|
.unexpected { color: red; }
|
||||||
|
|
||||||
|
|
||||||
|
/* Counterexamples. */
|
||||||
|
|
||||||
|
/* Cex: point in rule. */
|
||||||
|
.cex-dot { color: red; }
|
||||||
|
|
||||||
|
/* Cex: coloring various rules. */
|
||||||
|
.cex-0 { color: yellow; }
|
||||||
|
.cex-1 { color: green; }
|
||||||
|
.cex-2 { color: blue; }
|
||||||
|
.cex-3 { color: purple; }
|
||||||
|
.cex-4 { color: violet; }
|
||||||
|
.cex-5 { color: orange; }
|
||||||
|
.cex-6 { color: brown; }
|
||||||
|
.cex-7 { color: mauve; }
|
||||||
|
.cex-8 { color: #013220; } /* Dark green. */
|
||||||
|
.cex-9 { color: #e75480; } /* Dark pink. */
|
||||||
|
.cex-10 { color: cyan; }
|
||||||
|
.cex-11 { color: orange; }
|
||||||
|
|
||||||
|
/* Cex: derivation rewriting steps. */
|
||||||
|
.cex-step { font-style: italic; }
|
||||||
|
|
||||||
|
/* Cex: leaves of a derivation. */
|
||||||
|
.cex-leaf { font-weight: 600; }
|
||||||
|
|||||||
+3
-3
@@ -1,4 +1,4 @@
|
|||||||
## Copyright (C) 2002, 2005-2015, 2018-2020 Free Software Foundation,
|
## Copyright (C) 2002, 2005-2015, 2018-2021 Free Software Foundation,
|
||||||
## Inc.
|
## Inc.
|
||||||
|
|
||||||
## This program is free software: you can redistribute it and/or modify
|
## This program is free software: you can redistribute it and/or modify
|
||||||
@@ -12,7 +12,7 @@
|
|||||||
## GNU General Public License for more details.
|
## GNU General Public License for more details.
|
||||||
##
|
##
|
||||||
## You should have received a copy of the GNU General Public License
|
## You should have received a copy of the GNU General Public License
|
||||||
## along with this program. If not, see <http://www.gnu.org/licenses/>.
|
## along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
dist_pkgdata_DATA = \
|
dist_pkgdata_DATA = \
|
||||||
data/README.md \
|
data/README.md \
|
||||||
@@ -28,6 +28,7 @@ dist_skeletons_DATA = \
|
|||||||
data/skeletons/c.m4 \
|
data/skeletons/c.m4 \
|
||||||
data/skeletons/glr.c \
|
data/skeletons/glr.c \
|
||||||
data/skeletons/glr.cc \
|
data/skeletons/glr.cc \
|
||||||
|
data/skeletons/glr2.cc \
|
||||||
data/skeletons/java-skel.m4 \
|
data/skeletons/java-skel.m4 \
|
||||||
data/skeletons/java.m4 \
|
data/skeletons/java.m4 \
|
||||||
data/skeletons/lalr1.cc \
|
data/skeletons/lalr1.cc \
|
||||||
@@ -40,7 +41,6 @@ dist_skeletons_DATA = \
|
|||||||
|
|
||||||
# Experimental support for the D language.
|
# Experimental support for the D language.
|
||||||
dist_skeletons_DATA += \
|
dist_skeletons_DATA += \
|
||||||
data/skeletons/README-D.txt \
|
|
||||||
data/skeletons/d-skel.m4 \
|
data/skeletons/d-skel.m4 \
|
||||||
data/skeletons/d.m4 \
|
data/skeletons/d.m4 \
|
||||||
data/skeletons/lalr1.d
|
data/skeletons/lalr1.d
|
||||||
|
|||||||
@@ -1,60 +0,0 @@
|
|||||||
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. */
|
|
||||||
TokenKind 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 unions (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
|
|
||||||
+84
-41
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
# Language-independent M4 Macros for Bison.
|
# Language-independent M4 Macros for Bison.
|
||||||
|
|
||||||
# Copyright (C) 2002, 2004-2015, 2018-2020 Free Software Foundation,
|
# Copyright (C) 2002, 2004-2015, 2018-2021 Free Software Foundation,
|
||||||
# Inc.
|
# Inc.
|
||||||
|
|
||||||
# This program is free software: you can redistribute it and/or modify
|
# This program is free software: you can redistribute it and/or modify
|
||||||
@@ -16,7 +16,7 @@
|
|||||||
# GNU General Public License for more details.
|
# GNU General Public License for more details.
|
||||||
#
|
#
|
||||||
# You should have received a copy of the GNU General Public License
|
# You should have received a copy of the GNU General Public License
|
||||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -38,6 +38,8 @@ m4_define([b4_gsub],
|
|||||||
[$4], [$5]),
|
[$4], [$5]),
|
||||||
[$6], [$7])])
|
[$6], [$7])])
|
||||||
|
|
||||||
|
# m4_shift2 and m4_shift3 are provided by m4sugar.
|
||||||
|
m4_define([m4_shift4], [m4_shift(m4_shift(m4_shift(m4_shift($@))))])
|
||||||
|
|
||||||
|
|
||||||
## ---------------- ##
|
## ---------------- ##
|
||||||
@@ -47,7 +49,7 @@ m4_define([b4_gsub],
|
|||||||
# b4_generated_by
|
# b4_generated_by
|
||||||
# ---------------
|
# ---------------
|
||||||
m4_define([b4_generated_by],
|
m4_define([b4_generated_by],
|
||||||
[b4_comment([A Bison parser, made by GNU Bison b4_version.])
|
[b4_comment([A Bison parser, made by GNU Bison b4_version_string.])
|
||||||
])
|
])
|
||||||
|
|
||||||
# b4_copyright(TITLE, [YEARS])
|
# b4_copyright(TITLE, [YEARS])
|
||||||
@@ -72,7 +74,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|||||||
GNU General Public License for more details.
|
GNU General Public License for more details.
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
You should have received a copy of the GNU General Public License
|
||||||
along with this program. If not, see <http://www.gnu.org/licenses/>.])
|
along with this program. If not, see <https://www.gnu.org/licenses/>.])
|
||||||
|
|
||||||
b4_comment([As a special exception, you may create a larger work that contains
|
b4_comment([As a special exception, you may create a larger work that contains
|
||||||
part or all of the Bison parser skeleton and distribute that work
|
part or all of the Bison parser skeleton and distribute that work
|
||||||
@@ -183,7 +185,7 @@ m4_define([b4_error],
|
|||||||
[b4_cat([[@complain][(]$1[@,]$2[@,]$3[@,]$4[]]dnl
|
[b4_cat([[@complain][(]$1[@,]$2[@,]$3[@,]$4[]]dnl
|
||||||
[m4_if([$#], [4], [],
|
[m4_if([$#], [4], [],
|
||||||
[m4_foreach([b4_arg],
|
[m4_foreach([b4_arg],
|
||||||
m4_dquote(m4_shift(m4_shift(m4_shift(m4_shift($@))))),
|
m4_dquote(m4_shift4($@)),
|
||||||
[[@,]b4_arg])])[@)]])])
|
[[@,]b4_arg])])[@)]])])
|
||||||
|
|
||||||
# b4_warn(FORMAT, [ARG1], [ARG2], ...)
|
# b4_warn(FORMAT, [ARG1], [ARG2], ...)
|
||||||
@@ -259,6 +261,13 @@ m4_define([b4_fatal_at],
|
|||||||
[b4_error([[fatal]], $@)dnl
|
[b4_error([[fatal]], $@)dnl
|
||||||
m4_exit(1)])
|
m4_exit(1)])
|
||||||
|
|
||||||
|
# b4_canary(MSG)
|
||||||
|
# --------------
|
||||||
|
# Issue a warning on stderr and in the output. Used in the test suite
|
||||||
|
# to catch spurious m4 evaluations.
|
||||||
|
m4_define([b4_canary],
|
||||||
|
[m4_errprintn([dead canary: $1])DEAD CANARY($1)])
|
||||||
|
|
||||||
|
|
||||||
## ------------ ##
|
## ------------ ##
|
||||||
## Data Types. ##
|
## Data Types. ##
|
||||||
@@ -330,14 +339,14 @@ number is the opposite. If YYTABLE_NINF, syntax error.]])
|
|||||||
$1([check], [b4_check])
|
$1([check], [b4_check])
|
||||||
|
|
||||||
$1([stos], [b4_stos],
|
$1([stos], [b4_stos],
|
||||||
[[YYSTOS[STATE-NUM] -- The (internal number of the) accessing
|
[[YYSTOS[STATE-NUM] -- The symbol kind of the accessing symbol of
|
||||||
symbol of state STATE-NUM.]])
|
state STATE-NUM.]])
|
||||||
|
|
||||||
$1([r1], [b4_r1],
|
$1([r1], [b4_r1],
|
||||||
[[YYR1[YYN] -- Symbol number of symbol that rule YYN derives.]])
|
[[YYR1[RULE-NUM] -- Symbol kind of the left-hand side of rule RULE-NUM.]])
|
||||||
|
|
||||||
$1([r2], [b4_r2],
|
$1([r2], [b4_r2],
|
||||||
[[YYR2[YYN] -- Number of symbols on the right hand side of rule YYN.]])
|
[[YYR2[RULE-NUM] -- Number of symbols on the right-hand side of rule RULE-NUM.]])
|
||||||
])
|
])
|
||||||
|
|
||||||
|
|
||||||
@@ -389,9 +398,9 @@ m4_define([b4_$3_if],
|
|||||||
# b4_FLAG_if(IF-TRUE, IF-FALSE)
|
# b4_FLAG_if(IF-TRUE, IF-FALSE)
|
||||||
# -----------------------------
|
# -----------------------------
|
||||||
# Expand IF-TRUE, if FLAG is true, IF-FALSE otherwise.
|
# Expand IF-TRUE, if FLAG is true, IF-FALSE otherwise.
|
||||||
b4_define_flag_if([defines]) # Whether headers are requested.
|
|
||||||
b4_define_flag_if([glr]) # Whether a GLR parser is requested.
|
b4_define_flag_if([glr]) # Whether a GLR parser is requested.
|
||||||
b4_define_flag_if([has_translations]) # Whether some tokens are internationalized.
|
b4_define_flag_if([has_translations]) # Whether some tokens are internationalized.
|
||||||
|
b4_define_flag_if([header]) # Whether a header is requested.
|
||||||
b4_define_flag_if([nondeterministic]) # Whether conflicts should be handled.
|
b4_define_flag_if([nondeterministic]) # Whether conflicts should be handled.
|
||||||
b4_define_flag_if([token_table]) # Whether yytoken_table is demanded.
|
b4_define_flag_if([token_table]) # Whether yytoken_table is demanded.
|
||||||
b4_define_flag_if([yacc]) # Whether POSIX Yacc is emulated.
|
b4_define_flag_if([yacc]) # Whether POSIX Yacc is emulated.
|
||||||
@@ -400,7 +409,7 @@ b4_define_flag_if([yacc]) # Whether POSIX Yacc is emulated.
|
|||||||
# b4_glr_cc_if([IF-TRUE], [IF-FALSE])
|
# b4_glr_cc_if([IF-TRUE], [IF-FALSE])
|
||||||
# -----------------------------------
|
# -----------------------------------
|
||||||
m4_define([b4_glr_cc_if],
|
m4_define([b4_glr_cc_if],
|
||||||
[m4_if(b4_skeleton, ["glr.cc"], $@)])
|
[m4_if(m4_bregexp(b4_skeleton, [^"glr.cc"$]), [0], $@)])
|
||||||
|
|
||||||
|
|
||||||
## --------- ##
|
## --------- ##
|
||||||
@@ -436,14 +445,14 @@ m4_define([b4_symbol_token_kind],
|
|||||||
_b4_symbol([$1], [id])])
|
_b4_symbol([$1], [id])])
|
||||||
|
|
||||||
|
|
||||||
# b4_symbol_kind(NUM)
|
# b4_symbol_kind_base(NUM)
|
||||||
# -------------------
|
# ------------------------
|
||||||
# Build the name of the kind of this symbol. It must always exist,
|
# Build the name of the kind of this symbol. It must always exist,
|
||||||
# otherwise some symbols might not be represented in the enum, which
|
# otherwise some symbols might not be represented in the enum, which
|
||||||
# might be compiled into too small a type to contain all the symbol
|
# might be compiled into too small a type to contain all the symbol
|
||||||
# numbers.
|
# numbers.
|
||||||
m4_define([b4_symbol_prefix], [b4_percent_define_get([api.symbol.prefix])])
|
m4_define([b4_symbol_prefix], [b4_percent_define_get([api.symbol.prefix])])
|
||||||
m4_define([b4_symbol_kind],
|
m4_define([b4_symbol_kind_base],
|
||||||
[b4_percent_define_get([api.symbol.prefix])dnl
|
[b4_percent_define_get([api.symbol.prefix])dnl
|
||||||
m4_case([$1],
|
m4_case([$1],
|
||||||
[-2], [[YYEMPTY]],
|
[-2], [[YYEMPTY]],
|
||||||
@@ -456,16 +465,42 @@ m4_case([$1],
|
|||||||
[m4_bpatsubst([$1-][]_b4_symbol([$1], [tag]), [[^a-zA-Z_0-9]+], [_])])])])])
|
[m4_bpatsubst([$1-][]_b4_symbol([$1], [tag]), [[^a-zA-Z_0-9]+], [_])])])])])
|
||||||
|
|
||||||
|
|
||||||
|
# b4_symbol_kind(NUM)
|
||||||
|
# -------------------
|
||||||
|
# Same as b4_symbol_kind, but possibly with a prefix in some
|
||||||
|
# languages. E.g., EOF's kind_base and kind are YYSYMBOL_YYEOF in C,
|
||||||
|
# but are S_YYEMPTY and symbol_kind::S_YYEMPTY in C++.
|
||||||
|
m4_copy([b4_symbol_kind_base], [b4_symbol_kind])
|
||||||
|
|
||||||
|
|
||||||
|
# b4_symbol_slot(NUM)
|
||||||
|
# -------------------
|
||||||
|
# The name of union member that contains the value of these symbols.
|
||||||
|
# Currently, we are messy, this should actually be type_tag, but type_tag
|
||||||
|
# has several meanings.
|
||||||
|
m4_define([b4_symbol_slot],
|
||||||
|
[m4_case(b4_percent_define_get([[api.value.type]]),
|
||||||
|
[union], [b4_symbol([$1], [type_tag])],
|
||||||
|
[variant], [b4_symbol([$1], [type_tag])],
|
||||||
|
[b4_symbol([$1], [type])])])
|
||||||
|
|
||||||
|
|
||||||
# b4_symbol(NUM, FIELD)
|
# b4_symbol(NUM, FIELD)
|
||||||
# ---------------------
|
# ---------------------
|
||||||
# Fetch FIELD of symbol #NUM (or "orig NUM"). Fail if undefined.
|
# Fetch FIELD of symbol #NUM (or "orig NUM", or "empty"). Fail if undefined.
|
||||||
#
|
#
|
||||||
# If FIELD = id, prepend the token prefix.
|
# If FIELD = id, prepend the token prefix.
|
||||||
m4_define([b4_symbol],
|
m4_define([b4_symbol],
|
||||||
[m4_case([$2],
|
[m4_if([$1], [empty], [b4_symbol([-2], [$2])],
|
||||||
[id], [b4_symbol_token_kind([$1])],
|
[$1], [eof], [b4_symbol([0], [$2])],
|
||||||
[kind], [b4_symbol_kind([$1])],
|
[$1], [error], [b4_symbol([1], [$2])],
|
||||||
[_b4_symbol($@)])])
|
[$1], [undef], [b4_symbol([2], [$2])],
|
||||||
|
[m4_case([$2],
|
||||||
|
[id], [b4_symbol_token_kind([$1])],
|
||||||
|
[kind_base], [b4_symbol_kind_base([$1])],
|
||||||
|
[kind], [b4_symbol_kind([$1])],
|
||||||
|
[slot], [b4_symbol_slot([$1])],
|
||||||
|
[_b4_symbol($@)])])])
|
||||||
|
|
||||||
|
|
||||||
# b4_symbol_if(NUM, FIELD, IF-TRUE, IF-FALSE)
|
# b4_symbol_if(NUM, FIELD, IF-TRUE, IF-FALSE)
|
||||||
@@ -527,7 +562,7 @@ m4_defn([b4_actions_])[]dnl
|
|||||||
break;
|
break;
|
||||||
}dnl
|
}dnl
|
||||||
],
|
],
|
||||||
[YYUSE (m4_default([$2], [yykind]));])dnl
|
[b4_use(m4_default([$2], [yykind]));])dnl
|
||||||
m4_popdef([b4_actions_])dnl
|
m4_popdef([b4_actions_])dnl
|
||||||
])
|
])
|
||||||
|
|
||||||
@@ -537,7 +572,7 @@ m4_popdef([b4_actions_])dnl
|
|||||||
# easier to use with m4_map, but then, use []dnl to suppress the last
|
# easier to use with m4_map, but then, use []dnl to suppress the last
|
||||||
# one.
|
# one.
|
||||||
m4_define([_b4_symbol_case],
|
m4_define([_b4_symbol_case],
|
||||||
[case b4_symbol([$1], [number]): b4_symbol_tag_comment([$1])])
|
[case b4_symbol([$1], [kind]): b4_symbol_tag_comment([$1])])
|
||||||
])
|
])
|
||||||
|
|
||||||
|
|
||||||
@@ -585,8 +620,8 @@ m4_define([b4_any_token_visible_if],
|
|||||||
m4_define([b4_token_format],
|
m4_define([b4_token_format],
|
||||||
[b4_token_visible_if([$2],
|
[b4_token_visible_if([$2],
|
||||||
[m4_format([[$1]],
|
[m4_format([[$1]],
|
||||||
m4_expand(b4_symbol([$2], [id])),
|
b4_symbol([$2], [id]),
|
||||||
m4_expand(b4_symbol([$2], b4_api_token_raw_if([[number]], [[user_number]]))))])])
|
b4_symbol([$2], b4_api_token_raw_if([[number]], [[code]])))])])
|
||||||
|
|
||||||
|
|
||||||
# b4_last_enum_token
|
# b4_last_enum_token
|
||||||
@@ -623,11 +658,11 @@ m4_define([_b4_type_action],
|
|||||||
|
|
||||||
])])
|
])])
|
||||||
|
|
||||||
# b4_type_foreach(MACRO)
|
# b4_type_foreach(MACRO, [SEP])
|
||||||
# ----------------------
|
# -----------------------------
|
||||||
# Invoke MACRO(SYMBOL-NUMS) for each set of SYMBOL-NUMS for each type set.
|
# Invoke MACRO(SYMBOL-NUMS) for each set of SYMBOL-NUMS for each type set.
|
||||||
m4_define([b4_type_foreach],
|
m4_define([b4_type_foreach],
|
||||||
[m4_map([$1], m4_defn([b4_type_names]))])
|
[m4_map_sep([$1], [$2], m4_defn([b4_type_names]))])
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -748,7 +783,7 @@ m4_define([b4_check_user_names],
|
|||||||
[m4_pushdef([b4_occurrence], b4_occurrence)dnl
|
[m4_pushdef([b4_occurrence], b4_occurrence)dnl
|
||||||
m4_pushdef([b4_user_name], m4_car(b4_occurrence))dnl
|
m4_pushdef([b4_user_name], m4_car(b4_occurrence))dnl
|
||||||
m4_pushdef([b4_start], m4_car(m4_shift(b4_occurrence)))dnl
|
m4_pushdef([b4_start], m4_car(m4_shift(b4_occurrence)))dnl
|
||||||
m4_pushdef([b4_end], m4_shift(m4_shift(b4_occurrence)))dnl
|
m4_pushdef([b4_end], m4_shift2(b4_occurrence))dnl
|
||||||
m4_ifndef($3[(]m4_quote(b4_user_name)[)],
|
m4_ifndef($3[(]m4_quote(b4_user_name)[)],
|
||||||
[b4_complain_at([b4_start], [b4_end],
|
[b4_complain_at([b4_start], [b4_end],
|
||||||
[[%s '%s' is not used]],
|
[[%s '%s' is not used]],
|
||||||
@@ -943,15 +978,18 @@ m4_define([b4_percent_define_flag_if],
|
|||||||
# For example:
|
# For example:
|
||||||
#
|
#
|
||||||
# b4_percent_define_default([[foo]], [[default value]])
|
# b4_percent_define_default([[foo]], [[default value]])
|
||||||
|
m4_define([_b4_percent_define_define],
|
||||||
|
[m4_define([b4_percent_define(]$1[)], [$2])dnl
|
||||||
|
m4_define([b4_percent_define_kind(]$1[)],
|
||||||
|
[m4_default([$3], [keyword])])dnl
|
||||||
|
m4_define([b4_percent_define_loc(]$1[)],
|
||||||
|
[[[[<skeleton default value>:-1.-1]],
|
||||||
|
[[<skeleton default value>:-1.-1]]]])dnl
|
||||||
|
m4_define([b4_percent_define_syncline(]$1[)], [[]])])
|
||||||
|
|
||||||
m4_define([b4_percent_define_default],
|
m4_define([b4_percent_define_default],
|
||||||
[_b4_percent_define_ifdef([$1], [],
|
[_b4_percent_define_ifdef([$1], [],
|
||||||
[m4_define([b4_percent_define(]$1[)], [$2])dnl
|
[_b4_percent_define_define($@)])])
|
||||||
m4_define([b4_percent_define_kind(]$1[)],
|
|
||||||
[m4_default([$3], [keyword])])dnl
|
|
||||||
m4_define([b4_percent_define_loc(]$1[)],
|
|
||||||
[[[[<skeleton default value>:-1.-1]],
|
|
||||||
[[<skeleton default value>:-1.-1]]]])dnl
|
|
||||||
m4_define([b4_percent_define_syncline(]$1[)], [[]])])])
|
|
||||||
|
|
||||||
|
|
||||||
# b4_percent_define_if_define(NAME, [VARIABLE = NAME])
|
# b4_percent_define_if_define(NAME, [VARIABLE = NAME])
|
||||||
@@ -961,11 +999,12 @@ m4_define([b4_percent_define_default],
|
|||||||
# to '_'.
|
# to '_'.
|
||||||
m4_define([_b4_percent_define_if_define],
|
m4_define([_b4_percent_define_if_define],
|
||||||
[m4_define(m4_bpatsubst([b4_$1_if], [[-.]], [_]),
|
[m4_define(m4_bpatsubst([b4_$1_if], [[-.]], [_]),
|
||||||
[b4_percent_define_flag_if(m4_default([$2], [$1]),
|
[b4_percent_define_default([m4_default([$2], [$1])], [[false]])dnl
|
||||||
[$3], [$4])])])
|
b4_percent_define_flag_if(m4_default([$2], [$1]),
|
||||||
|
[$3], [$4])])])
|
||||||
|
|
||||||
m4_define([b4_percent_define_if_define],
|
m4_define([b4_percent_define_if_define],
|
||||||
[b4_percent_define_default([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])
|
# b4_percent_define_check_kind(VARIABLE, KIND, [DIAGNOSTIC = complain])
|
||||||
@@ -1100,14 +1139,18 @@ m4_define([b4_parse_error_bmatch],
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# b4_union_if([IF-UNION-ARE-USED], [IF-NOT])
|
||||||
# b4_variant_if([IF-VARIANT-ARE-USED], [IF-NOT])
|
# b4_variant_if([IF-VARIANT-ARE-USED], [IF-NOT])
|
||||||
# ----------------------------------------------
|
# ----------------------------------------------
|
||||||
b4_percent_define_if_define([variant])
|
# Depend on whether api.value.type is union, or variant.
|
||||||
|
m4_define([b4_union_flag], [[0]])
|
||||||
m4_define([b4_variant_flag], [[0]])
|
m4_define([b4_variant_flag], [[0]])
|
||||||
b4_percent_define_ifdef([[api.value.type]],
|
b4_percent_define_ifdef([[api.value.type]],
|
||||||
[m4_case(b4_percent_define_get_kind([[api.value.type]]), [keyword],
|
[m4_case(b4_percent_define_get_kind([[api.value.type]]), [keyword],
|
||||||
[m4_case(b4_percent_define_get([[api.value.type]]), [variant],
|
[m4_case(b4_percent_define_get([[api.value.type]]),
|
||||||
[m4_define([b4_variant_flag], [[1]])])])])
|
[union], [m4_define([b4_union_flag], [[1]])],
|
||||||
|
[variant], [m4_define([b4_variant_flag], [[1]])])])])
|
||||||
|
b4_define_flag_if([union])
|
||||||
b4_define_flag_if([variant])
|
b4_define_flag_if([variant])
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
# C++ skeleton dispatching for Bison.
|
# C++ skeleton dispatching for Bison.
|
||||||
|
|
||||||
# Copyright (C) 2006-2007, 2009-2015, 2018-2020 Free Software
|
# Copyright (C) 2006-2007, 2009-2015, 2018-2021 Free Software
|
||||||
# Foundation, Inc.
|
# Foundation, Inc.
|
||||||
|
|
||||||
# This program is free software: you can redistribute it and/or modify
|
# This program is free software: you can redistribute it and/or modify
|
||||||
@@ -16,7 +16,7 @@
|
|||||||
# GNU General Public License for more details.
|
# GNU General Public License for more details.
|
||||||
#
|
#
|
||||||
# You should have received a copy of the GNU General Public License
|
# You should have received a copy of the GNU General Public License
|
||||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
b4_glr_if( [m4_define([b4_used_skeleton], [b4_skeletonsdir/[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]])])
|
b4_nondeterministic_if([m4_define([b4_used_skeleton], [b4_skeletonsdir/[glr.cc]])])
|
||||||
|
|||||||
+34
-28
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
# C++ skeleton for Bison
|
# C++ skeleton for Bison
|
||||||
|
|
||||||
# Copyright (C) 2002-2020 Free Software Foundation, Inc.
|
# Copyright (C) 2002-2021 Free Software Foundation, Inc.
|
||||||
|
|
||||||
# This program is free software: you can redistribute it and/or modify
|
# This program is free software: you can redistribute it and/or modify
|
||||||
# it under the terms of the GNU General Public License as published by
|
# it under the terms of the GNU General Public License as published by
|
||||||
@@ -15,7 +15,7 @@
|
|||||||
# GNU General Public License for more details.
|
# GNU General Public License for more details.
|
||||||
#
|
#
|
||||||
# You should have received a copy of the GNU General Public License
|
# You should have received a copy of the GNU General Public License
|
||||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
# Sanity checks, before defaults installed by c.m4.
|
# Sanity checks, before defaults installed by c.m4.
|
||||||
b4_percent_define_ifdef([[api.value.union.name]],
|
b4_percent_define_ifdef([[api.value.union.name]],
|
||||||
@@ -105,11 +105,10 @@ b4_percent_define_default([[api.parser.class]], [[parser]])
|
|||||||
#
|
#
|
||||||
# b4_percent_define_default([[api.location.type]], [[location]])
|
# b4_percent_define_default([[api.location.type]], [[location]])
|
||||||
|
|
||||||
b4_percent_define_default([[filename_type]], [[std::string]])
|
b4_percent_define_default([[api.filename.type]], [[const std::string]])
|
||||||
# Make it a warning for those who used betas of Bison 3.0.
|
# Make it a warning for those who used betas of Bison 3.0.
|
||||||
b4_percent_define_default([[api.namespace]], m4_defn([b4_prefix]))
|
b4_percent_define_default([[api.namespace]], m4_defn([b4_prefix]))
|
||||||
|
|
||||||
b4_percent_define_default([[global_tokens_and_yystype]], [[false]])
|
|
||||||
b4_percent_define_default([[define_location_comparison]],
|
b4_percent_define_default([[define_location_comparison]],
|
||||||
[m4_if(b4_percent_define_get([[filename_type]]),
|
[m4_if(b4_percent_define_get([[filename_type]]),
|
||||||
[std::string], [[true]], [[false]])])
|
[std::string], [[true]], [[false]])])
|
||||||
@@ -193,7 +192,7 @@ m4_define([b4_declare_symbol_enum],
|
|||||||
[[enum symbol_kind_type
|
[[enum symbol_kind_type
|
||||||
{
|
{
|
||||||
YYNTOKENS = ]b4_tokens_number[, ///< Number of tokens.
|
YYNTOKENS = ]b4_tokens_number[, ///< Number of tokens.
|
||||||
]b4_symbol_kind([-2])[ = -2,
|
]b4_symbol(empty, kind_base)[ = -2,
|
||||||
]b4_symbol_foreach([ b4_symbol_enum])dnl
|
]b4_symbol_foreach([ b4_symbol_enum])dnl
|
||||||
[ };]])
|
[ };]])
|
||||||
|
|
||||||
@@ -207,16 +206,16 @@ m4_define([b4_declare_symbol_enum],
|
|||||||
|
|
||||||
# b4_value_type_declare
|
# b4_value_type_declare
|
||||||
# ---------------------
|
# ---------------------
|
||||||
# Declare semantic_type.
|
# Declare value_type.
|
||||||
m4_define([b4_value_type_declare],
|
m4_define([b4_value_type_declare],
|
||||||
[b4_value_type_setup[]dnl
|
[b4_value_type_setup[]dnl
|
||||||
[ /// Symbol semantic values.
|
[ /// Symbol semantic values.
|
||||||
]m4_bmatch(b4_percent_define_get_kind([[api.value.type]]),
|
]m4_bmatch(b4_percent_define_get_kind([[api.value.type]]),
|
||||||
[code],
|
[code],
|
||||||
[[ typedef ]b4_percent_define_get([[api.value.type]])[ semantic_type;]],
|
[[ typedef ]b4_percent_define_get([[api.value.type]])[ value_type;]],
|
||||||
[m4_bmatch(b4_percent_define_get([[api.value.type]]),
|
[m4_bmatch(b4_percent_define_get([[api.value.type]]),
|
||||||
[union\|union-directive],
|
[union\|union-directive],
|
||||||
[[ union semantic_type
|
[[ union value_type
|
||||||
{
|
{
|
||||||
]b4_user_union_members[
|
]b4_user_union_members[
|
||||||
};]])])dnl
|
};]])])dnl
|
||||||
@@ -228,11 +227,16 @@ m4_define([b4_value_type_declare],
|
|||||||
# Define the public types: token, semantic value, location, and so forth.
|
# Define the public types: token, semantic value, location, and so forth.
|
||||||
# Depending on %define token_lex, may be output in the header or source file.
|
# Depending on %define token_lex, may be output in the header or source file.
|
||||||
m4_define([b4_public_types_declare],
|
m4_define([b4_public_types_declare],
|
||||||
[[#ifndef ]b4_api_PREFIX[STYPE
|
[[#ifdef ]b4_api_PREFIX[STYPE
|
||||||
]b4_value_type_declare[
|
# ifdef __GNUC__
|
||||||
|
# pragma GCC message "bison: do not #define ]b4_api_PREFIX[STYPE in C++, use %define api.value.type"
|
||||||
|
# endif
|
||||||
|
typedef ]b4_api_PREFIX[STYPE value_type;
|
||||||
#else
|
#else
|
||||||
typedef ]b4_api_PREFIX[STYPE semantic_type;
|
]b4_value_type_declare[
|
||||||
#endif]b4_locations_if([
|
#endif
|
||||||
|
/// Backward compatibility (Bison 3.8).
|
||||||
|
typedef value_type semantic_type;]b4_locations_if([
|
||||||
/// Symbol locations.
|
/// Symbol locations.
|
||||||
typedef b4_percent_define_get([[api.location.type]],
|
typedef b4_percent_define_get([[api.location.type]],
|
||||||
[[location]]) location_type;])[
|
[[location]]) location_type;])[
|
||||||
@@ -321,15 +325,16 @@ m4_define([b4_symbol_type_define],
|
|||||||
/// Copy constructor.
|
/// Copy constructor.
|
||||||
basic_symbol (const basic_symbol& that);]b4_variant_if([[
|
basic_symbol (const basic_symbol& that);]b4_variant_if([[
|
||||||
|
|
||||||
/// Constructor for valueless symbols, and symbols from each type.
|
/// Constructors for typed symbols.
|
||||||
]b4_type_foreach([b4_basic_symbol_constructor_define])], [[
|
]b4_type_foreach([b4_basic_symbol_constructor_define], [
|
||||||
|
])], [[
|
||||||
/// Constructor for valueless symbols.
|
/// Constructor for valueless symbols.
|
||||||
basic_symbol (typename Base::kind_type t]b4_locations_if([,
|
basic_symbol (typename Base::kind_type t]b4_locations_if([,
|
||||||
YY_MOVE_REF (location_type) l])[);
|
YY_MOVE_REF (location_type) l])[);
|
||||||
|
|
||||||
/// Constructor for symbols with semantic value.
|
/// Constructor for symbols with semantic value.
|
||||||
basic_symbol (typename Base::kind_type t,
|
basic_symbol (typename Base::kind_type t,
|
||||||
YY_RVREF (semantic_type) v]b4_locations_if([,
|
YY_RVREF (value_type) v]b4_locations_if([,
|
||||||
YY_RVREF (location_type) l])[);
|
YY_RVREF (location_type) l])[);
|
||||||
]])[
|
]])[
|
||||||
/// Destroy the symbol.
|
/// Destroy the symbol.
|
||||||
@@ -339,7 +344,7 @@ m4_define([b4_symbol_type_define],
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Destroy contents, and record that is empty.
|
/// Destroy contents, and record that is empty.
|
||||||
void clear ()
|
void clear () YY_NOEXCEPT
|
||||||
{]b4_variant_if([[
|
{]b4_variant_if([[
|
||||||
// User destructor.
|
// User destructor.
|
||||||
symbol_kind_type yykind = this->kind ();
|
symbol_kind_type yykind = this->kind ();
|
||||||
@@ -390,7 +395,7 @@ m4_define([b4_symbol_type_define],
|
|||||||
void move (basic_symbol& s);
|
void move (basic_symbol& s);
|
||||||
|
|
||||||
/// The semantic value.
|
/// The semantic value.
|
||||||
semantic_type value;]b4_locations_if([
|
value_type value;]b4_locations_if([
|
||||||
|
|
||||||
/// The location.
|
/// The location.
|
||||||
location_type location;])[
|
location_type location;])[
|
||||||
@@ -423,7 +428,7 @@ m4_define([b4_symbol_type_define],
|
|||||||
by_kind (kind_type t);
|
by_kind (kind_type t);
|
||||||
|
|
||||||
/// Record that this symbol is empty.
|
/// Record that this symbol is empty.
|
||||||
void clear ();
|
void clear () YY_NOEXCEPT;
|
||||||
|
|
||||||
/// Steal the symbol kind from \a that.
|
/// Steal the symbol kind from \a that.
|
||||||
void move (by_kind& that);
|
void move (by_kind& that);
|
||||||
@@ -453,7 +458,7 @@ m4_define([b4_symbol_type_define],
|
|||||||
symbol_type () {}
|
symbol_type () {}
|
||||||
|
|
||||||
/// Constructor for valueless symbols, and symbols from each type.
|
/// Constructor for valueless symbols, and symbols from each type.
|
||||||
]b4_type_foreach([_b4_token_constructor_define])dnl
|
]b4_type_foreach([_b4_symbol_constructor_define])dnl
|
||||||
])[};
|
])[};
|
||||||
]])
|
]])
|
||||||
|
|
||||||
@@ -487,7 +492,7 @@ m4_define([b4_public_types_define],
|
|||||||
template <typename Base>
|
template <typename Base>
|
||||||
]b4_parser_class[::basic_symbol<Base>::basic_symbol (]b4_join(
|
]b4_parser_class[::basic_symbol<Base>::basic_symbol (]b4_join(
|
||||||
[typename Base::kind_type t],
|
[typename Base::kind_type t],
|
||||||
[YY_RVREF (semantic_type) v],
|
[YY_RVREF (value_type) v],
|
||||||
b4_locations_if([YY_RVREF (location_type) l]))[)
|
b4_locations_if([YY_RVREF (location_type) l]))[)
|
||||||
: Base (t)
|
: Base (t)
|
||||||
, value (]b4_variant_if([], [YY_MOVE (v)])[)]b4_locations_if([
|
, value (]b4_variant_if([], [YY_MOVE (v)])[)]b4_locations_if([
|
||||||
@@ -507,7 +512,7 @@ m4_define([b4_public_types_define],
|
|||||||
bool
|
bool
|
||||||
]b4_parser_class[::basic_symbol<Base>::empty () const YY_NOEXCEPT
|
]b4_parser_class[::basic_symbol<Base>::empty () const YY_NOEXCEPT
|
||||||
{
|
{
|
||||||
return this->kind () == symbol_kind::]b4_symbol_prefix[YYEMPTY;
|
return this->kind () == ]b4_symbol(empty, kind)[;
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename Base>
|
template <typename Base>
|
||||||
@@ -523,7 +528,7 @@ m4_define([b4_public_types_define],
|
|||||||
|
|
||||||
// by_kind.
|
// by_kind.
|
||||||
]b4_inline([$1])b4_parser_class[::by_kind::by_kind ()
|
]b4_inline([$1])b4_parser_class[::by_kind::by_kind ()
|
||||||
: kind_ (symbol_kind::]b4_symbol_prefix[YYEMPTY)
|
: kind_ (]b4_symbol(empty, kind)[)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
#if 201103L <= YY_CPLUSPLUS
|
#if 201103L <= YY_CPLUSPLUS
|
||||||
@@ -543,9 +548,9 @@ m4_define([b4_public_types_define],
|
|||||||
{}
|
{}
|
||||||
|
|
||||||
]b4_inline([$1])[void
|
]b4_inline([$1])[void
|
||||||
]b4_parser_class[::by_kind::clear ()
|
]b4_parser_class[::by_kind::clear () YY_NOEXCEPT
|
||||||
{
|
{
|
||||||
kind_ = symbol_kind::]b4_symbol_prefix[YYEMPTY;
|
kind_ = ]b4_symbol(empty, kind)[;
|
||||||
}
|
}
|
||||||
|
|
||||||
]b4_inline([$1])[void
|
]b4_inline([$1])[void
|
||||||
@@ -571,7 +576,7 @@ m4_define([b4_public_types_define],
|
|||||||
|
|
||||||
# b4_token_constructor_define
|
# b4_token_constructor_define
|
||||||
# ----------------------------
|
# ----------------------------
|
||||||
# Define symbol constructors for all the value types.
|
# Define make_FOO for all the token kinds.
|
||||||
# Use at class-level. Redefined in variant.hh.
|
# Use at class-level. Redefined in variant.hh.
|
||||||
m4_define([b4_token_constructor_define], [])
|
m4_define([b4_token_constructor_define], [])
|
||||||
|
|
||||||
@@ -594,12 +599,13 @@ m4_define([b4_yytranslate_define],
|
|||||||
{
|
{
|
||||||
]b4_translate[
|
]b4_translate[
|
||||||
};
|
};
|
||||||
const int user_token_number_max_ = ]b4_user_token_number_max[;
|
// Last valid token kind.
|
||||||
|
const int code_max = ]b4_code_max[;
|
||||||
|
|
||||||
if (t <= 0)
|
if (t <= 0)
|
||||||
return symbol_kind::]b4_symbol_prefix[YYEOF;
|
return symbol_kind::]b4_symbol_prefix[YYEOF;
|
||||||
else if (t <= user_token_number_max_)
|
else if (t <= code_max)
|
||||||
return YY_CAST (symbol_kind_type, translate_table[t]);
|
return static_cast <symbol_kind_type> (translate_table[t]);
|
||||||
else
|
else
|
||||||
return symbol_kind::]b4_symbol_prefix[YYUNDEF;]])[
|
return symbol_kind::]b4_symbol_prefix[YYUNDEF;]])[
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
# Common code for C-like languages (C, C++, Java, etc.)
|
# Common code for C-like languages (C, C++, Java, etc.)
|
||||||
|
|
||||||
# Copyright (C) 2012-2015, 2018-2020 Free Software Foundation, Inc.
|
# Copyright (C) 2012-2015, 2018-2021 Free Software Foundation, Inc.
|
||||||
|
|
||||||
# This program is free software: you can redistribute it and/or modify
|
# This program is free software: you can redistribute it and/or modify
|
||||||
# it under the terms of the GNU General Public License as published by
|
# it under the terms of the GNU General Public License as published by
|
||||||
@@ -15,7 +15,7 @@
|
|||||||
# GNU General Public License for more details.
|
# GNU General Public License for more details.
|
||||||
#
|
#
|
||||||
# You should have received a copy of the GNU General Public License
|
# You should have received a copy of the GNU General Public License
|
||||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
|
||||||
# _b4_comment(TEXT, OPEN, CONTINUE, END)
|
# _b4_comment(TEXT, OPEN, CONTINUE, END)
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
# C skeleton dispatching for Bison.
|
# C skeleton dispatching for Bison.
|
||||||
|
|
||||||
# Copyright (C) 2006-2007, 2009-2015, 2018-2020 Free Software
|
# Copyright (C) 2006-2007, 2009-2015, 2018-2021 Free Software
|
||||||
# Foundation, Inc.
|
# Foundation, Inc.
|
||||||
|
|
||||||
# This program is free software: you can redistribute it and/or modify
|
# This program is free software: you can redistribute it and/or modify
|
||||||
@@ -16,7 +16,7 @@
|
|||||||
# GNU General Public License for more details.
|
# GNU General Public License for more details.
|
||||||
#
|
#
|
||||||
# You should have received a copy of the GNU General Public License
|
# You should have received a copy of the GNU General Public License
|
||||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
b4_glr_if( [m4_define([b4_used_skeleton], [b4_skeletonsdir/[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]])])
|
b4_nondeterministic_if([m4_define([b4_used_skeleton], [b4_skeletonsdir/[glr.c]])])
|
||||||
|
|||||||
+118
-65
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
# C M4 Macros for Bison.
|
# C M4 Macros for Bison.
|
||||||
|
|
||||||
# Copyright (C) 2002, 2004-2015, 2018-2020 Free Software Foundation,
|
# Copyright (C) 2002, 2004-2015, 2018-2021 Free Software Foundation,
|
||||||
# Inc.
|
# Inc.
|
||||||
|
|
||||||
# This program is free software: you can redistribute it and/or modify
|
# This program is free software: you can redistribute it and/or modify
|
||||||
@@ -16,7 +16,7 @@
|
|||||||
# GNU General Public License for more details.
|
# GNU General Public License for more details.
|
||||||
#
|
#
|
||||||
# You should have received a copy of the GNU General Public License
|
# You should have received a copy of the GNU General Public License
|
||||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
m4_include(b4_skeletonsdir/[c-like.m4])
|
m4_include(b4_skeletonsdir/[c-like.m4])
|
||||||
|
|
||||||
@@ -58,11 +58,11 @@ m4_define([b4_cpp_guard_close],
|
|||||||
# b4_pull_flag if they use the values of the %define variables api.pure or
|
# b4_pull_flag if they use the values of the %define variables api.pure or
|
||||||
# api.push-pull.
|
# api.push-pull.
|
||||||
m4_define([b4_identification],
|
m4_define([b4_identification],
|
||||||
[[/* Identify Bison output. */
|
[[/* Identify Bison output, and Bison version. */
|
||||||
#define YYBISON 1
|
#define YYBISON ]b4_version[
|
||||||
|
|
||||||
/* Bison version. */
|
/* Bison version string. */
|
||||||
#define YYBISON_VERSION "]b4_version["
|
#define YYBISON_VERSION "]b4_version_string["
|
||||||
|
|
||||||
/* Skeleton name. */
|
/* Skeleton name. */
|
||||||
#define YYSKELETON_NAME ]b4_skeleton[]m4_ifdef([b4_pure_flag], [[
|
#define YYSKELETON_NAME ]b4_skeleton[]m4_ifdef([b4_pure_flag], [[
|
||||||
@@ -107,27 +107,32 @@ b4_percent_define_default([[api.symbol.prefix]], [[YYSYMBOL_]])
|
|||||||
## Pure/impure interfaces. ##
|
## Pure/impure interfaces. ##
|
||||||
## ------------------------ ##
|
## ------------------------ ##
|
||||||
|
|
||||||
# b4_lex_formals
|
# b4_yylex_formals
|
||||||
# --------------
|
# ----------------
|
||||||
# All the yylex formal arguments.
|
# All the yylex formal arguments.
|
||||||
# b4_lex_param arrives quoted twice, but we want to keep only one level.
|
# b4_lex_param arrives quoted twice, but we want to keep only one level.
|
||||||
m4_define([b4_lex_formals],
|
m4_define([b4_yylex_formals],
|
||||||
[b4_pure_if([[[[YYSTYPE *yylvalp]], [[&yylval]]][]dnl
|
[b4_pure_if([[[b4_api_PREFIX[STYPE *yylvalp]], [[&yylval]]][]dnl
|
||||||
b4_locations_if([, [[YYLTYPE *yyllocp], [&yylloc]]])])dnl
|
b4_locations_if([, [b4_api_PREFIX[LTYPE *yyllocp], [&yylloc]]])])dnl
|
||||||
m4_ifdef([b4_lex_param], [, ]b4_lex_param)])
|
m4_ifdef([b4_lex_param], [, ]b4_lex_param)])
|
||||||
|
|
||||||
|
|
||||||
# b4_lex
|
# b4_yylex
|
||||||
# ------
|
# --------
|
||||||
# Call yylex.
|
# Call yylex.
|
||||||
m4_define([b4_lex],
|
m4_define([b4_yylex],
|
||||||
[b4_function_call([yylex], [int], b4_lex_formals)])
|
[b4_function_call([yylex], [int], b4_yylex_formals)])
|
||||||
|
|
||||||
|
|
||||||
# b4_user_args
|
# b4_user_args
|
||||||
# ------------
|
# ------------
|
||||||
m4_define([b4_user_args],
|
m4_define([b4_user_args],
|
||||||
[m4_ifset([b4_parse_param], [, b4_args(b4_parse_param)])])
|
[m4_ifset([b4_parse_param], [, b4_user_args_no_comma])])
|
||||||
|
|
||||||
|
# b4_user_args_no_comma
|
||||||
|
# ---------------------
|
||||||
|
m4_define([b4_user_args_no_comma],
|
||||||
|
[m4_ifset([b4_parse_param], [b4_args(b4_parse_param)])])
|
||||||
|
|
||||||
|
|
||||||
# b4_user_formals
|
# b4_user_formals
|
||||||
@@ -158,13 +163,20 @@ m4_popdef([$2])dnl
|
|||||||
m4_popdef([$1])dnl
|
m4_popdef([$1])dnl
|
||||||
])])
|
])])
|
||||||
|
|
||||||
|
|
||||||
|
# b4_use(EXPR)
|
||||||
|
# ------------
|
||||||
|
# Pacify the compiler about some maybe unused value.
|
||||||
|
m4_define([b4_use],
|
||||||
|
[YY_USE ($1)])
|
||||||
|
|
||||||
# b4_parse_param_use([VAL], [LOC])
|
# b4_parse_param_use([VAL], [LOC])
|
||||||
# --------------------------------
|
# --------------------------------
|
||||||
# 'YYUSE' VAL, LOC if locations are enabled, and all the parse-params.
|
# 'YY_USE' VAL, LOC if locations are enabled, and all the parse-params.
|
||||||
m4_define([b4_parse_param_use],
|
m4_define([b4_parse_param_use],
|
||||||
[m4_ifvaln([$1], [ YYUSE ([$1]);])dnl
|
[m4_ifvaln([$1], [ b4_use([$1]);])dnl
|
||||||
b4_locations_if([m4_ifvaln([$2], [ YYUSE ([$2]);])])dnl
|
b4_locations_if([m4_ifvaln([$2], [ b4_use([$2]);])])dnl
|
||||||
b4_parse_param_for([Decl], [Formal], [ YYUSE (Formal);
|
b4_parse_param_for([Decl], [Formal], [ b4_use(Formal);
|
||||||
])dnl
|
])dnl
|
||||||
])
|
])
|
||||||
|
|
||||||
@@ -242,6 +254,18 @@ typedef int_least16_t yytype_int16;
|
|||||||
typedef short yytype_int16;
|
typedef short yytype_int16;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/* Work around bug in HP-UX 11.23, which defines these macros
|
||||||
|
incorrectly for preprocessor constants. This workaround can likely
|
||||||
|
be removed in 2023, as HPE has promised support for HP-UX 11.23
|
||||||
|
(aka HP-UX 11i v2) only through the end of 2022; see Table 2 of
|
||||||
|
<https://h20195.www2.hpe.com/V2/getpdf.aspx/4AA4-7673ENW.pdf>. */
|
||||||
|
#ifdef __hpux
|
||||||
|
# undef UINT_LEAST8_MAX
|
||||||
|
# undef UINT_LEAST16_MAX
|
||||||
|
# define UINT_LEAST8_MAX 255
|
||||||
|
# define UINT_LEAST16_MAX 65535
|
||||||
|
#endif
|
||||||
|
|
||||||
#if defined __UINT_LEAST8_MAX__ && __UINT_LEAST8_MAX__ <= __INT_MAX__
|
#if defined __UINT_LEAST8_MAX__ && __UINT_LEAST8_MAX__ <= __INT_MAX__
|
||||||
typedef __UINT_LEAST8_TYPE__ yytype_uint8;
|
typedef __UINT_LEAST8_TYPE__ yytype_uint8;
|
||||||
#elif (!defined __UINT_LEAST8_MAX__ && defined YY_STDINT_H \
|
#elif (!defined __UINT_LEAST8_MAX__ && defined YY_STDINT_H \
|
||||||
@@ -355,17 +379,27 @@ m4_define([b4_attribute_define],
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
]m4_bmatch([$1], [\bnoreturn\b], [[/* The _Noreturn keyword of C11. */
|
]m4_bmatch([$1], [\bnoreturn\b], [[/* The _Noreturn keyword of C11. */
|
||||||
]dnl This is an exact copy of lib/_Noreturn.h.
|
]dnl This is close to lib/_Noreturn.h, except that we do enable
|
||||||
|
dnl the use of [[noreturn]], because _Noreturn is used in places
|
||||||
|
dnl where [[noreturn]] works in C++. We need this in particular
|
||||||
|
dnl because of glr.cc which compiles code from glr.c in C++.
|
||||||
|
dnl And the C++ compiler chokes on _Noreturn. Also, we do not
|
||||||
|
dnl use C' _Noreturn in C++, to avoid -Wc11-extensions warnings.
|
||||||
[#ifndef _Noreturn
|
[#ifndef _Noreturn
|
||||||
# if (defined __cplusplus \
|
# if (defined __cplusplus \
|
||||||
&& ((201103 <= __cplusplus && !(__GNUC__ == 4 && __GNUC_MINOR__ == 7)) \
|
&& ((201103 <= __cplusplus && !(__GNUC__ == 4 && __GNUC_MINOR__ == 7)) \
|
||||||
|| (defined _MSC_VER && 1900 <= _MSC_VER)))
|
|| (defined _MSC_VER && 1900 <= _MSC_VER)))
|
||||||
# define _Noreturn [[noreturn]]
|
# define _Noreturn [[noreturn]]
|
||||||
# elif ((!defined __cplusplus || defined __clang__) \
|
# elif ((!defined __cplusplus || defined __clang__) \
|
||||||
&& (201112 <= (defined __STDC_VERSION__ ? __STDC_VERSION__ : 0) \
|
&& (201112 <= (defined __STDC_VERSION__ ? __STDC_VERSION__ : 0) \
|
||||||
|| 4 < __GNUC__ + (7 <= __GNUC_MINOR__)))
|
|| (!defined __STRICT_ANSI__ \
|
||||||
|
&& (4 < __GNUC__ + (7 <= __GNUC_MINOR__) \
|
||||||
|
|| (defined __apple_build_version__ \
|
||||||
|
? 6000000 <= __apple_build_version__ \
|
||||||
|
: 3 < __clang_major__ + (5 <= __clang_minor__))))))
|
||||||
/* _Noreturn works as-is. */
|
/* _Noreturn works as-is. */
|
||||||
# elif 2 < __GNUC__ + (8 <= __GNUC_MINOR__) || 0x5110 <= __SUNPRO_C
|
# elif (2 < __GNUC__ + (8 <= __GNUC_MINOR__) || defined __clang__ \
|
||||||
|
|| 0x5110 <= __SUNPRO_C)
|
||||||
# define _Noreturn __attribute__ ((__noreturn__))
|
# define _Noreturn __attribute__ ((__noreturn__))
|
||||||
# elif 1200 <= (defined _MSC_VER ? _MSC_VER : 0)
|
# elif 1200 <= (defined _MSC_VER ? _MSC_VER : 0)
|
||||||
# define _Noreturn __declspec (noreturn)
|
# define _Noreturn __declspec (noreturn)
|
||||||
@@ -376,17 +410,23 @@ m4_define([b4_attribute_define],
|
|||||||
|
|
||||||
]])[/* Suppress unused-variable warnings by "using" E. */
|
]])[/* Suppress unused-variable warnings by "using" E. */
|
||||||
#if ! defined lint || defined __GNUC__
|
#if ! defined lint || defined __GNUC__
|
||||||
# define YYUSE(E) ((void) (E))
|
# define YY_USE(E) ((void) (E))
|
||||||
#else
|
#else
|
||||||
# define YYUSE(E) /* empty */
|
# define YY_USE(E) /* empty */
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined __GNUC__ && ! defined __ICC && 407 <= __GNUC__ * 100 + __GNUC_MINOR__
|
|
||||||
/* Suppress an incorrect diagnostic about yylval being uninitialized. */
|
/* Suppress an incorrect diagnostic about yylval being uninitialized. */
|
||||||
# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \
|
#if defined __GNUC__ && ! defined __ICC && 406 <= __GNUC__ * 100 + __GNUC_MINOR__
|
||||||
|
# if __GNUC__ * 100 + __GNUC_MINOR__ < 407
|
||||||
|
# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \
|
||||||
|
_Pragma ("GCC diagnostic push") \
|
||||||
|
_Pragma ("GCC diagnostic ignored \"-Wuninitialized\"")
|
||||||
|
# else
|
||||||
|
# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \
|
||||||
_Pragma ("GCC diagnostic push") \
|
_Pragma ("GCC diagnostic push") \
|
||||||
_Pragma ("GCC diagnostic ignored \"-Wuninitialized\"") \
|
_Pragma ("GCC diagnostic ignored \"-Wuninitialized\"") \
|
||||||
_Pragma ("GCC diagnostic ignored \"-Wmaybe-uninitialized\"")
|
_Pragma ("GCC diagnostic ignored \"-Wmaybe-uninitialized\"")
|
||||||
|
# endif
|
||||||
# define YY_IGNORE_MAYBE_UNINITIALIZED_END \
|
# define YY_IGNORE_MAYBE_UNINITIALIZED_END \
|
||||||
_Pragma ("GCC diagnostic pop")
|
_Pragma ("GCC diagnostic pop")
|
||||||
#else
|
#else
|
||||||
@@ -466,7 +506,7 @@ m4_define([b4_null], [YY_NULLPTR])
|
|||||||
# -------------------------------------------------------------
|
# -------------------------------------------------------------
|
||||||
# Define "yy<TABLE-NAME>" whose contents is CONTENT.
|
# Define "yy<TABLE-NAME>" whose contents is CONTENT.
|
||||||
m4_define([b4_integral_parser_table_define],
|
m4_define([b4_integral_parser_table_define],
|
||||||
[m4_ifvaln([$3], [b4_comment([$3], [ ])])dnl
|
[m4_ifvaln([$3], [b4_comment([$3])])dnl
|
||||||
static const b4_int_type_for([$2]) yy$1[[]] =
|
static const b4_int_type_for([$2]) yy$1[[]] =
|
||||||
{
|
{
|
||||||
$2
|
$2
|
||||||
@@ -485,7 +525,7 @@ static const b4_int_type_for([$2]) yy$1[[]] =
|
|||||||
m4_define([b4_symbol(-2, id)], [b4_api_PREFIX[][EMPTY]])
|
m4_define([b4_symbol(-2, id)], [b4_api_PREFIX[][EMPTY]])
|
||||||
m4_define([b4_symbol(-2, tag)], [[No symbol.]])
|
m4_define([b4_symbol(-2, tag)], [[No symbol.]])
|
||||||
|
|
||||||
m4_if(b4_symbol(0, id), [YYEOF],
|
m4_if(b4_symbol(eof, id), [YYEOF],
|
||||||
[m4_define([b4_symbol(0, id)], [b4_api_PREFIX[][EOF]])])
|
[m4_define([b4_symbol(0, id)], [b4_api_PREFIX[][EOF]])])
|
||||||
m4_define([b4_symbol(1, id)], [b4_api_PREFIX[][error]])
|
m4_define([b4_symbol(1, id)], [b4_api_PREFIX[][error]])
|
||||||
m4_define([b4_symbol(2, id)], [b4_api_PREFIX[][UNDEF]])
|
m4_define([b4_symbol(2, id)], [b4_api_PREFIX[][UNDEF]])
|
||||||
@@ -501,10 +541,11 @@ m4_define([b4_token_define],
|
|||||||
# ----------------
|
# ----------------
|
||||||
# Output the definition of the tokens.
|
# Output the definition of the tokens.
|
||||||
m4_define([b4_token_defines],
|
m4_define([b4_token_defines],
|
||||||
[b4_any_token_visible_if([/* Token kinds. */
|
[[/* Token kinds. */
|
||||||
m4_join([
|
#define ]b4_symbol(empty, [id])[ -2
|
||||||
|
]m4_join([
|
||||||
], b4_symbol_map([b4_token_define]))
|
], b4_symbol_map([b4_token_define]))
|
||||||
])])
|
])
|
||||||
|
|
||||||
|
|
||||||
# b4_token_enum(TOKEN-NUM)
|
# b4_token_enum(TOKEN-NUM)
|
||||||
@@ -515,7 +556,7 @@ m4_define([b4_token_enum],
|
|||||||
[m4_format([ %-30s %s],
|
[m4_format([ %-30s %s],
|
||||||
m4_format([[%s = %s%s%s]],
|
m4_format([[%s = %s%s%s]],
|
||||||
b4_symbol([$1], [id]),
|
b4_symbol([$1], [id]),
|
||||||
b4_symbol([$1], b4_api_token_raw_if([[number]], [[user_number]])),
|
b4_symbol([$1], b4_api_token_raw_if([[number]], [[code]])),
|
||||||
m4_if([$1], b4_last_enum_token, [], [[,]])),
|
m4_if([$1], b4_last_enum_token, [], [[,]])),
|
||||||
[b4_symbol_tag_comment([$1])])])])
|
[b4_symbol_tag_comment([$1])])])])
|
||||||
|
|
||||||
@@ -529,7 +570,7 @@ m4_define([b4_token_enums],
|
|||||||
# define ]b4_api_PREFIX[TOKENTYPE
|
# define ]b4_api_PREFIX[TOKENTYPE
|
||||||
enum ]b4_api_prefix[tokentype
|
enum ]b4_api_prefix[tokentype
|
||||||
{
|
{
|
||||||
]b4_symbol([-2], [id])[ = -2,
|
]b4_symbol(empty, [id])[ = -2,
|
||||||
]b4_symbol_foreach([b4_token_enum])dnl
|
]b4_symbol_foreach([b4_token_enum])dnl
|
||||||
[ };
|
[ };
|
||||||
typedef enum ]b4_api_prefix[tokentype ]b4_api_prefix[token_kind_t;
|
typedef enum ]b4_api_prefix[tokentype ]b4_api_prefix[token_kind_t;
|
||||||
@@ -564,7 +605,7 @@ m4_define([b4_symbol_translate],
|
|||||||
m4_define([b4_symbol_enum],
|
m4_define([b4_symbol_enum],
|
||||||
[m4_format([ %-40s %s],
|
[m4_format([ %-40s %s],
|
||||||
m4_format([[%s = %s%s%s]],
|
m4_format([[%s = %s%s%s]],
|
||||||
b4_symbol([$1], [kind]),
|
b4_symbol([$1], [kind_base]),
|
||||||
[$1],
|
[$1],
|
||||||
m4_if([$1], b4_last_symbol, [], [[,]])),
|
m4_if([$1], b4_last_symbol, [], [[,]])),
|
||||||
[b4_symbol_tag_comment([$1])])])
|
[b4_symbol_tag_comment([$1])])])
|
||||||
@@ -579,7 +620,7 @@ m4_define([b4_declare_symbol_enum],
|
|||||||
[[/* Symbol kind. */
|
[[/* Symbol kind. */
|
||||||
enum yysymbol_kind_t
|
enum yysymbol_kind_t
|
||||||
{
|
{
|
||||||
]b4_symbol_kind([-2])[ = -2,
|
]b4_symbol(empty, [kind_base])[ = -2,
|
||||||
]b4_symbol_foreach([b4_symbol_enum])dnl
|
]b4_symbol_foreach([b4_symbol_enum])dnl
|
||||||
[};
|
[};
|
||||||
typedef enum yysymbol_kind_t yysymbol_kind_t;
|
typedef enum yysymbol_kind_t yysymbol_kind_t;
|
||||||
@@ -621,6 +662,14 @@ m4_define([b4_formal],
|
|||||||
[$1])
|
[$1])
|
||||||
|
|
||||||
|
|
||||||
|
# b4_function_declare(NAME, RETURN-VALUE, [DECL1, NAME1], ...)
|
||||||
|
# ------------------------------------------------------------
|
||||||
|
# Declare the function NAME.
|
||||||
|
m4_define([b4_function_declare],
|
||||||
|
[$2 $1 (b4_formals(m4_shift2($@)));[]dnl
|
||||||
|
])
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
## --------------------- ##
|
## --------------------- ##
|
||||||
## Calling C functions. ##
|
## Calling C functions. ##
|
||||||
@@ -658,10 +707,10 @@ m4_define([b4_sync_start], [[#]line $1 $2])
|
|||||||
## User actions. ##
|
## User actions. ##
|
||||||
## -------------- ##
|
## -------------- ##
|
||||||
|
|
||||||
# b4_case(LABEL, STATEMENTS)
|
# b4_case(LABEL, STATEMENTS, [COMMENTS])
|
||||||
# --------------------------
|
# --------------------------------------
|
||||||
m4_define([b4_case],
|
m4_define([b4_case],
|
||||||
[ case $1:
|
[ case $1:m4_ifval([$3], [ b4_comment([$3])])
|
||||||
$2
|
$2
|
||||||
b4_syncline([@oline@], [@ofile@])dnl
|
b4_syncline([@oline@], [@ofile@])dnl
|
||||||
break;])
|
break;])
|
||||||
@@ -720,13 +769,6 @@ yy_symbol_value_print (FILE *yyo,
|
|||||||
]b4_parse_param_use([yyoutput], [yylocationp])dnl
|
]b4_parse_param_use([yyoutput], [yylocationp])dnl
|
||||||
[ if (!yyvaluep)
|
[ if (!yyvaluep)
|
||||||
return;]
|
return;]
|
||||||
dnl glr.c does not feature yytoknum.
|
|
||||||
m4_if(b4_skeleton, ["yacc.c"],
|
|
||||||
[[# ifdef YYPRINT
|
|
||||||
if (yykind < YYNTOKENS)
|
|
||||||
YYPRINT (yyo, yytoknum[yykind], *yyvaluep);
|
|
||||||
# endif
|
|
||||||
]])dnl
|
|
||||||
b4_percent_code_get([[pre-printer]])dnl
|
b4_percent_code_get([[pre-printer]])dnl
|
||||||
YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
|
YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
|
||||||
b4_symbol_actions([printer])
|
b4_symbol_actions([printer])
|
||||||
@@ -747,7 +789,7 @@ yy_symbol_print (FILE *yyo,
|
|||||||
YYFPRINTF (yyo, "%s %s (",
|
YYFPRINTF (yyo, "%s %s (",
|
||||||
yykind < YYNTOKENS ? "token" : "nterm", yysymbol_name (yykind));
|
yykind < YYNTOKENS ? "token" : "nterm", yysymbol_name (yykind));
|
||||||
|
|
||||||
]b4_locations_if([ YY_LOCATION_PRINT (yyo, *yylocationp);
|
]b4_locations_if([ YYLOCATION_PRINT (yyo, yylocationp);
|
||||||
YYFPRINTF (yyo, ": ");
|
YYFPRINTF (yyo, ": ");
|
||||||
])dnl
|
])dnl
|
||||||
[ yy_symbol_value_print (yyo, yykind, yyvaluep]dnl
|
[ yy_symbol_value_print (yyo, yykind, yyvaluep]dnl
|
||||||
@@ -934,7 +976,7 @@ struct ]b4_api_PREFIX[LTYPE
|
|||||||
|
|
||||||
# b4_declare_yylstype
|
# b4_declare_yylstype
|
||||||
# -------------------
|
# -------------------
|
||||||
# Declarations that might either go into the header (if --defines) or
|
# Declarations that might either go into the header (if --header) or
|
||||||
# in the parser body. Declare YYSTYPE/YYLTYPE, and yylval/yylloc.
|
# in the parser body. Declare YYSTYPE/YYLTYPE, and yylval/yylloc.
|
||||||
m4_define([b4_declare_yylstype],
|
m4_define([b4_declare_yylstype],
|
||||||
[b4_value_type_define[]b4_locations_if([
|
[b4_value_type_define[]b4_locations_if([
|
||||||
@@ -1004,17 +1046,24 @@ m4_define([b4_yylloc_default_define],
|
|||||||
#endif
|
#endif
|
||||||
]])
|
]])
|
||||||
|
|
||||||
# b4_yy_location_print_define
|
# b4_yylocation_print_define
|
||||||
# ---------------------------
|
# --------------------------
|
||||||
# Define YY_LOCATION_PRINT.
|
# Define YYLOCATION_PRINT.
|
||||||
m4_define([b4_yy_location_print_define],
|
m4_define([b4_yylocation_print_define],
|
||||||
[b4_locations_if([[
|
[b4_locations_if([[
|
||||||
/* YY_LOCATION_PRINT -- Print the location on the stream.
|
/* YYLOCATION_PRINT -- Print the location on the stream.
|
||||||
This macro was not mandated originally: define only if we know
|
This macro was not mandated originally: define only if we know
|
||||||
we won't break user code: when these are the locations we know. */
|
we won't break user code: when these are the locations we know. */
|
||||||
|
|
||||||
# ifndef YY_LOCATION_PRINT
|
# ifndef YYLOCATION_PRINT
|
||||||
# if defined ]b4_api_PREFIX[LTYPE_IS_TRIVIAL && ]b4_api_PREFIX[LTYPE_IS_TRIVIAL
|
|
||||||
|
# if defined YY_LOCATION_PRINT
|
||||||
|
|
||||||
|
/* Temporary convenience wrapper in case some people defined the
|
||||||
|
undocumented and private YY_LOCATION_PRINT macros. */
|
||||||
|
# define YYLOCATION_PRINT(File, Loc) YY_LOCATION_PRINT(File, *(Loc))
|
||||||
|
|
||||||
|
# elif defined ]b4_api_PREFIX[LTYPE_IS_TRIVIAL && ]b4_api_PREFIX[LTYPE_IS_TRIVIAL
|
||||||
|
|
||||||
/* Print *YYLOCP on YYO. Private, do not rely on its existence. */
|
/* Print *YYLOCP on YYO. Private, do not rely on its existence. */
|
||||||
|
|
||||||
@@ -1042,19 +1091,23 @@ yy_location_print_ (FILE *yyo, YYLTYPE const * const yylocp)
|
|||||||
res += YYFPRINTF (yyo, "-%d", end_col);
|
res += YYFPRINTF (yyo, "-%d", end_col);
|
||||||
}
|
}
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
# define YY_LOCATION_PRINT(File, Loc) \
|
# define YYLOCATION_PRINT yy_location_print_
|
||||||
yy_location_print_ (File, &(Loc))
|
|
||||||
|
/* Temporary convenience wrapper in case some people defined the
|
||||||
|
undocumented and private YY_LOCATION_PRINT macros. */
|
||||||
|
# define YY_LOCATION_PRINT(File, Loc) YYLOCATION_PRINT(File, &(Loc))
|
||||||
|
|
||||||
# else
|
# else
|
||||||
# define YY_LOCATION_PRINT(File, Loc) ((void) 0)
|
|
||||||
|
# define YYLOCATION_PRINT(File, Loc) ((void) 0)
|
||||||
|
/* Temporary convenience wrapper in case some people defined the
|
||||||
|
undocumented and private YY_LOCATION_PRINT macros. */
|
||||||
|
# define YY_LOCATION_PRINT YYLOCATION_PRINT
|
||||||
|
|
||||||
# endif
|
# endif
|
||||||
# endif /* !defined YY_LOCATION_PRINT */]],
|
# endif /* !defined YYLOCATION_PRINT */]])
|
||||||
[[/* This macro is provided for backward compatibility. */
|
|
||||||
# ifndef YY_LOCATION_PRINT
|
|
||||||
# define YY_LOCATION_PRINT(File, Loc) ((void) 0)
|
|
||||||
# endif]])
|
|
||||||
])
|
])
|
||||||
|
|
||||||
# b4_yyloc_default
|
# b4_yyloc_default
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
# D skeleton dispatching for Bison.
|
# D skeleton dispatching for Bison.
|
||||||
|
|
||||||
# Copyright (C) 2018-2020 Free Software Foundation, Inc.
|
# Copyright (C) 2018-2021 Free Software Foundation, Inc.
|
||||||
|
|
||||||
# This program is free software: you can redistribute it and/or modify
|
# This program is free software: you can redistribute it and/or modify
|
||||||
# it under the terms of the GNU General Public License as published by
|
# it under the terms of the GNU General Public License as published by
|
||||||
@@ -15,7 +15,7 @@
|
|||||||
# GNU General Public License for more details.
|
# GNU General Public License for more details.
|
||||||
#
|
#
|
||||||
# You should have received a copy of the GNU General Public License
|
# You should have received a copy of the GNU General Public License
|
||||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
b4_glr_if( [b4_complain([%%glr-parser not supported for D])])
|
b4_glr_if( [b4_complain([%%glr-parser not supported for D])])
|
||||||
b4_nondeterministic_if([b4_complain([%%nondeterministic-parser not supported for D])])
|
b4_nondeterministic_if([b4_complain([%%nondeterministic-parser not supported for D])])
|
||||||
|
|||||||
+298
-36
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
# D language support for Bison
|
# D language support for Bison
|
||||||
|
|
||||||
# Copyright (C) 2018-2020 Free Software Foundation, Inc.
|
# Copyright (C) 2018-2021 Free Software Foundation, Inc.
|
||||||
|
|
||||||
# This program is free software: you can redistribute it and/or modify
|
# This program is free software: you can redistribute it and/or modify
|
||||||
# it under the terms of the GNU General Public License as published by
|
# it under the terms of the GNU General Public License as published by
|
||||||
@@ -15,27 +15,36 @@
|
|||||||
# GNU General Public License for more details.
|
# GNU General Public License for more details.
|
||||||
#
|
#
|
||||||
# You should have received a copy of the GNU General Public License
|
# You should have received a copy of the GNU General Public License
|
||||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
|
||||||
# _b4_comment(TEXT, OPEN, CONTINUE, END)
|
m4_include(b4_skeletonsdir/[c-like.m4])
|
||||||
# --------------------------------------
|
|
||||||
# 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])
|
# b4_symbol_action(SYMBOL-NUM, ACTION)
|
||||||
# --------------------------
|
# ------------------------------------
|
||||||
# Put TEXT in comment. Prefix all the output lines with PREFIX.
|
# Run the action ACTION ("destructor" or "printer") for SYMBOL-NUM.
|
||||||
m4_define([b4_comment],
|
m4_define([b4_symbol_action],
|
||||||
[_b4_comment([$1], [$2/* ], [$2 ], [ */])])
|
[b4_symbol_if([$1], [has_$2],
|
||||||
|
[b4_dollar_pushdef([yyval],
|
||||||
|
[$1],
|
||||||
|
[],
|
||||||
|
[yyloc])dnl
|
||||||
|
_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@])dnl
|
||||||
|
break;
|
||||||
|
|
||||||
|
b4_dollar_popdef[]dnl
|
||||||
|
])])
|
||||||
|
|
||||||
|
|
||||||
|
# b4_use(EXPR)
|
||||||
|
# ------------
|
||||||
|
# Pacify the compiler about some maybe unused value.
|
||||||
|
m4_define([b4_use],
|
||||||
|
[])
|
||||||
|
|
||||||
|
|
||||||
# b4_sync_start(LINE, FILE)
|
# b4_sync_start(LINE, FILE)
|
||||||
@@ -58,6 +67,23 @@ m4_define([b4_percent_define_get3],
|
|||||||
[m4_ifval(m4_quote(b4_percent_define_get([$1])),
|
[m4_ifval(m4_quote(b4_percent_define_get([$1])),
|
||||||
[$2[]b4_percent_define_get([$1])[]$3], [$4])])
|
[$2[]b4_percent_define_get([$1])[]$3], [$4])])
|
||||||
|
|
||||||
|
# b4_percent_define_if_get2(ARG1, ARG2, DEF, NOT)
|
||||||
|
# -----------------------------------------------
|
||||||
|
# Expand to the value of DEF if ARG1 or ARG2 are %define'ed,
|
||||||
|
# otherwise NOT.
|
||||||
|
m4_define([b4_percent_define_if_get2],
|
||||||
|
[m4_ifval(m4_quote(b4_percent_define_get([$1])),
|
||||||
|
[$3], [m4_ifval(m4_quote(b4_percent_define_get([$2])),
|
||||||
|
[$3], [$4])])])
|
||||||
|
|
||||||
|
# b4_percent_define_class_before_interface(CLASS, INTERFACE)
|
||||||
|
# ----------------------------------------------------------
|
||||||
|
# Expand to a ', ' if both a class and an interface have been %define'ed
|
||||||
|
m4_define([b4_percent_define_class_before_interface],
|
||||||
|
[m4_ifval(m4_quote(b4_percent_define_get([$1])),
|
||||||
|
[m4_ifval(m4_quote(b4_percent_define_get([$2])),
|
||||||
|
[, ])])])
|
||||||
|
|
||||||
|
|
||||||
# b4_flag_value(BOOLEAN-FLAG)
|
# b4_flag_value(BOOLEAN-FLAG)
|
||||||
# ---------------------------
|
# ---------------------------
|
||||||
@@ -78,8 +104,10 @@ 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.abstract], [abstract ])dnl
|
||||||
b4_percent_define_flag_if([api.parser.final], [final ])dnl
|
b4_percent_define_flag_if([api.parser.final], [final ])dnl
|
||||||
[class ]b4_parser_class[]dnl
|
[class ]b4_parser_class[]dnl
|
||||||
b4_percent_define_get3([api.parser.extends], [ extends ])dnl
|
b4_percent_define_if_get2([api.parser.extends], [api.parser.implements], [ : ])dnl
|
||||||
b4_percent_define_get3([api.parser.implements], [ implements ])])
|
b4_percent_define_get([api.parser.extends])dnl
|
||||||
|
b4_percent_define_class_before_interface([api.parser.extends], [api.parser.implements])dnl
|
||||||
|
b4_percent_define_get([api.parser.implements])])
|
||||||
|
|
||||||
|
|
||||||
# b4_lexer_if(TRUE, FALSE)
|
# b4_lexer_if(TRUE, FALSE)
|
||||||
@@ -103,12 +131,12 @@ m4_define([b4_location_type_if],
|
|||||||
# b4_identification
|
# b4_identification
|
||||||
# -----------------
|
# -----------------
|
||||||
m4_define([b4_identification],
|
m4_define([b4_identification],
|
||||||
[/** Version number for the Bison executable that generated this parser. */
|
[[/** Version number for the Bison executable that generated this parser. */
|
||||||
public static immutable string yy_bison_version = "b4_version";
|
public static immutable string yy_bison_version = "]b4_version_string[";
|
||||||
|
|
||||||
/** Name of the skeleton that generated this parser. */
|
/** Name of the skeleton that generated this parser. */
|
||||||
public static immutable string yy_bison_skeleton = b4_skeleton;
|
public static immutable string yy_bison_skeleton = ]b4_skeleton[;
|
||||||
])
|
]])
|
||||||
|
|
||||||
|
|
||||||
## ------------ ##
|
## ------------ ##
|
||||||
@@ -152,6 +180,9 @@ private static immutable b4_int_type_for([$2])[[]] yy$1_ =
|
|||||||
## Token kinds. ##
|
## Token kinds. ##
|
||||||
## ------------- ##
|
## ------------- ##
|
||||||
|
|
||||||
|
m4_define([b4_symbol(-2, id)], [[YYEMPTY]])
|
||||||
|
b4_percent_define_default([[api.token.raw]], [[true]])
|
||||||
|
|
||||||
# b4_token_enum(TOKEN-NAME, TOKEN-NUMBER)
|
# b4_token_enum(TOKEN-NAME, TOKEN-NUMBER)
|
||||||
# ---------------------------------------
|
# ---------------------------------------
|
||||||
# Output the definition of this token as an enum.
|
# Output the definition of this token as an enum.
|
||||||
@@ -165,18 +196,53 @@ m4_define([b4_token_enum],
|
|||||||
m4_define([b4_token_enums],
|
m4_define([b4_token_enums],
|
||||||
[/* Token kinds. */
|
[/* Token kinds. */
|
||||||
public enum TokenKind {
|
public enum TokenKind {
|
||||||
]b4_symbol_kind([-2])[ = -2,
|
]b4_symbol(empty, id)[ = -2,
|
||||||
b4_symbol_foreach([b4_token_enum])dnl
|
b4_symbol_foreach([b4_token_enum])dnl
|
||||||
}
|
}
|
||||||
])
|
])
|
||||||
|
|
||||||
|
# b4_symbol_translate(STRING)
|
||||||
|
# ---------------------------
|
||||||
|
# Used by "bison" in the array of symbol names to mark those that
|
||||||
|
# require translation.
|
||||||
|
m4_define([b4_symbol_translate],
|
||||||
|
[[_($1)]])
|
||||||
|
|
||||||
|
|
||||||
|
# _b4_token_constructor_define(SYMBOL-NUM)
|
||||||
|
# ----------------------------------------
|
||||||
|
# Define Symbol.FOO for SYMBOL-NUM.
|
||||||
|
m4_define([_b4_token_constructor_define],
|
||||||
|
[b4_token_visible_if([$1],
|
||||||
|
[[
|
||||||
|
static auto ]b4_symbol([$1], [id])[(]b4_symbol_if([$1], [has_type],
|
||||||
|
[b4_union_if([b4_symbol([$1], [type]],
|
||||||
|
[[typeof(YYSemanticType.]b4_symbol([$1], [type])[]])) [val]])dnl
|
||||||
|
[]b4_locations_if([b4_symbol_if([$1], [has_type], [[, ]])[Location l]])[)
|
||||||
|
{
|
||||||
|
return Symbol(TokenKind.]b4_symbol([$1], [id])[]b4_symbol_if([$1], [has_type],
|
||||||
|
[[, val]])[]b4_locations_if([[, l]])[);
|
||||||
|
}]])])
|
||||||
|
|
||||||
|
# b4_token_constructor_define
|
||||||
|
# ---------------------------
|
||||||
|
# Define Symbol.FOO for each token kind FOO.
|
||||||
|
m4_define([b4_token_constructor_define],
|
||||||
|
[[
|
||||||
|
/* Implementation of token constructors for each symbol type visible to
|
||||||
|
* the user. The code generates static methods that have the same names
|
||||||
|
* as the TokenKinds.
|
||||||
|
*/]b4_symbol_foreach([_b4_token_constructor_define])dnl
|
||||||
|
])
|
||||||
|
|
||||||
## -------------- ##
|
## -------------- ##
|
||||||
## Symbol kinds. ##
|
## Symbol kinds. ##
|
||||||
## -------------- ##
|
## -------------- ##
|
||||||
|
|
||||||
b4_percent_define_default([[api.symbol.prefix]], [[S_]])
|
# b4_symbol_kind(NUM)
|
||||||
|
# -------------------
|
||||||
|
m4_define([b4_symbol_kind],
|
||||||
|
[SymbolKind.b4_symbol_kind_base($@)])
|
||||||
|
|
||||||
|
|
||||||
# b4_symbol_enum(SYMBOL-NUM)
|
# b4_symbol_enum(SYMBOL-NUM)
|
||||||
@@ -185,7 +251,7 @@ b4_percent_define_default([[api.symbol.prefix]], [[S_]])
|
|||||||
m4_define([b4_symbol_enum],
|
m4_define([b4_symbol_enum],
|
||||||
[m4_format([ %-30s %s],
|
[m4_format([ %-30s %s],
|
||||||
m4_format([[%s = %s,]],
|
m4_format([[%s = %s,]],
|
||||||
b4_symbol([$1], [kind]),
|
b4_symbol([$1], [kind_base]),
|
||||||
[$1]),
|
[$1]),
|
||||||
[b4_symbol_tag_comment([$1])])])
|
[b4_symbol_tag_comment([$1])])])
|
||||||
|
|
||||||
@@ -197,18 +263,48 @@ m4_define([b4_symbol_enum],
|
|||||||
# to use a signed type, which matters for yytoken.
|
# to use a signed type, which matters for yytoken.
|
||||||
m4_define([b4_declare_symbol_enum],
|
m4_define([b4_declare_symbol_enum],
|
||||||
[[ /* Symbol kinds. */
|
[[ /* Symbol kinds. */
|
||||||
public enum SymbolKind
|
struct SymbolKind
|
||||||
{
|
{
|
||||||
]b4_symbol_kind([-2])[ = -2, /* No symbol. */
|
enum
|
||||||
|
{
|
||||||
|
]b4_symbol(empty, kind_base)[ = -2, /* No symbol. */
|
||||||
]b4_symbol_foreach([b4_symbol_enum])dnl
|
]b4_symbol_foreach([b4_symbol_enum])dnl
|
||||||
[ };
|
[ }
|
||||||
]])])
|
|
||||||
|
private int yycode_;
|
||||||
|
alias yycode_ this;
|
||||||
|
|
||||||
|
this(int code)
|
||||||
|
{
|
||||||
|
yycode_ = code;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 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. */
|
||||||
|
final void toString(W)(W sink) const
|
||||||
|
if (isOutputRange!(W, char))
|
||||||
|
{
|
||||||
|
immutable string[] yy_sname = @{
|
||||||
|
]b4_symbol_names[
|
||||||
|
@};]b4_has_translations_if([[
|
||||||
|
/* YYTRANSLATABLE[SYMBOL-NUM] -- Whether YY_SNAME[SYMBOL-NUM] is
|
||||||
|
internationalizable. */
|
||||||
|
immutable ]b4_int_type_for([b4_translatable])[[] yytranslatable = @{
|
||||||
|
]b4_translatable[
|
||||||
|
@};]])[
|
||||||
|
|
||||||
|
put(sink, yy_sname[yycode_]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]])
|
||||||
|
|
||||||
|
|
||||||
|
# b4_case(ID, CODE, [COMMENTS])
|
||||||
# b4-case(ID, CODE)
|
# -----------------------------
|
||||||
# -----------------
|
m4_define([b4_case], [ case $1:m4_ifval([$3], [ b4_comment([$3])])
|
||||||
m4_define([b4_case], [ case $1:
|
|
||||||
$2
|
$2
|
||||||
break;])
|
break;])
|
||||||
|
|
||||||
@@ -233,6 +329,109 @@ m4_define([b4_location_type], b4_percent_define_ifdef([[location_type]],[b4_perc
|
|||||||
m4_define([b4_position_type], b4_percent_define_ifdef([[position_type]],[b4_percent_define_get([[position_type]])],[YYPosition]))
|
m4_define([b4_position_type], b4_percent_define_ifdef([[position_type]],[b4_percent_define_get([[position_type]])],[YYPosition]))
|
||||||
|
|
||||||
|
|
||||||
|
## ---------------- ##
|
||||||
|
## api.value.type. ##
|
||||||
|
## ---------------- ##
|
||||||
|
|
||||||
|
|
||||||
|
# ---------------------- #
|
||||||
|
# api.value.type=union. #
|
||||||
|
# ---------------------- #
|
||||||
|
|
||||||
|
# b4_symbol_type_register(SYMBOL-NUM)
|
||||||
|
# -----------------------------------
|
||||||
|
# Symbol SYMBOL-NUM has a type (for union) instead of a type-tag.
|
||||||
|
# Extend the definition of %union's body (b4_union_members) with a
|
||||||
|
# field of that type, and extend the symbol's "type" field to point to
|
||||||
|
# the field name, instead of the type name.
|
||||||
|
m4_define([b4_symbol_type_register],
|
||||||
|
[m4_define([b4_symbol($1, type_tag)],
|
||||||
|
[b4_symbol_if([$1], [has_id],
|
||||||
|
[b4_symbol([$1], [id])],
|
||||||
|
[yykind_[]b4_symbol([$1], [number])])])dnl
|
||||||
|
m4_append([b4_union_members],
|
||||||
|
m4_expand([m4_format([ %-40s %s],
|
||||||
|
m4_expand([b4_symbol([$1], [type]) b4_symbol([$1], [type_tag]);]),
|
||||||
|
[b4_symbol_tag_comment([$1])])]))
|
||||||
|
])
|
||||||
|
|
||||||
|
|
||||||
|
# b4_type_define_tag(SYMBOL1-NUM, ...)
|
||||||
|
# ------------------------------------
|
||||||
|
# For the batch of symbols SYMBOL1-NUM... (which all have the same
|
||||||
|
# type), enhance the %union definition for each of them, and set
|
||||||
|
# there "type" field to the field tag name, instead of the type name.
|
||||||
|
m4_define([b4_type_define_tag],
|
||||||
|
[b4_symbol_if([$1], [has_type],
|
||||||
|
[m4_map([b4_symbol_type_register], [$@])])
|
||||||
|
])
|
||||||
|
|
||||||
|
|
||||||
|
# b4_symbol_value_union(VAL, SYMBOL-NUM, [TYPE])
|
||||||
|
# ----------------------------------------------
|
||||||
|
# Same of b4_symbol_value, but when api.value.type=union.
|
||||||
|
m4_define([b4_symbol_value_union],
|
||||||
|
[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
|
||||||
|
# -------------------------
|
||||||
|
# Setup support for api.value.type=union. Symbols are defined with a
|
||||||
|
# type instead of a union member name: build the corresponding union,
|
||||||
|
# and give the symbols their tag.
|
||||||
|
m4_define([b4_value_type_setup_union],
|
||||||
|
[m4_define([b4_union_members])
|
||||||
|
b4_type_foreach([b4_type_define_tag])
|
||||||
|
m4_copy_force([b4_symbol_value_union], [b4_symbol_value])
|
||||||
|
])
|
||||||
|
|
||||||
|
|
||||||
|
# _b4_value_type_setup_keyword
|
||||||
|
# ----------------------------
|
||||||
|
# api.value.type is defined with a keyword/string syntax. Check if
|
||||||
|
# that is properly defined, and prepare its use.
|
||||||
|
m4_define([_b4_value_type_setup_keyword],
|
||||||
|
[b4_percent_define_check_values([[[[api.value.type]],
|
||||||
|
[[none]],
|
||||||
|
[[union]],
|
||||||
|
[[union-directive]],
|
||||||
|
[[yystype]]]])dnl
|
||||||
|
m4_case(b4_percent_define_get([[api.value.type]]),
|
||||||
|
[union], [b4_value_type_setup_union])])
|
||||||
|
|
||||||
|
|
||||||
|
# b4_value_type_setup
|
||||||
|
# -------------------
|
||||||
|
# Check if api.value.type is properly defined, and possibly prepare
|
||||||
|
# its use.
|
||||||
|
b4_define_silent([b4_value_type_setup],
|
||||||
|
[
|
||||||
|
# Define default value.
|
||||||
|
b4_percent_define_ifdef([[api.value.type]], [],
|
||||||
|
[# %union => api.value.type=union-directive
|
||||||
|
m4_ifdef([b4_union_members],
|
||||||
|
[m4_define([b4_percent_define_kind(api.value.type)], [keyword])
|
||||||
|
m4_define([b4_percent_define(api.value.type)], [union-directive])],
|
||||||
|
[# no tag seen => api.value.type={int}
|
||||||
|
m4_if(b4_tag_seen_flag, 0,
|
||||||
|
[m4_define([b4_percent_define_kind(api.value.type)], [code])
|
||||||
|
m4_define([b4_percent_define(api.value.type)], [int])],
|
||||||
|
[# otherwise api.value.type=yystype
|
||||||
|
m4_define([b4_percent_define_kind(api.value.type)], [keyword])
|
||||||
|
m4_define([b4_percent_define(api.value.type)], [yystype])])])])
|
||||||
|
|
||||||
|
# Set up.
|
||||||
|
m4_bmatch(b4_percent_define_get_kind([[api.value.type]]),
|
||||||
|
[keyword], [_b4_value_type_setup_keyword])
|
||||||
|
])
|
||||||
|
|
||||||
|
|
||||||
## ----------------- ##
|
## ----------------- ##
|
||||||
## Semantic Values. ##
|
## Semantic Values. ##
|
||||||
## ----------------- ##
|
## ----------------- ##
|
||||||
@@ -279,7 +478,7 @@ m4_define([b4_lhs_location],
|
|||||||
# Expansion of @POS, where the current rule has RULE-LENGTH symbols
|
# Expansion of @POS, where the current rule has RULE-LENGTH symbols
|
||||||
# on RHS.
|
# on RHS.
|
||||||
m4_define([b4_rhs_location],
|
m4_define([b4_rhs_location],
|
||||||
[yystack.locationAt ([$1], [$2])])
|
[yystack.locationAt (b4_subtract($@))])
|
||||||
|
|
||||||
|
|
||||||
# b4_lex_param
|
# b4_lex_param
|
||||||
@@ -364,3 +563,66 @@ m4_define([b4_var_decls],
|
|||||||
], [$@])])
|
], [$@])])
|
||||||
m4_define([b4_var_decl],
|
m4_define([b4_var_decl],
|
||||||
[ protected $1;])
|
[ protected $1;])
|
||||||
|
|
||||||
|
|
||||||
|
# b4_public_types_declare
|
||||||
|
# -----------------------
|
||||||
|
# Define the public types: token, semantic value, location, and so forth.
|
||||||
|
# Depending on %define token_lex, may be output in the header or source file.
|
||||||
|
m4_define([b4_public_types_declare],
|
||||||
|
[[
|
||||||
|
alias Symbol = ]b4_parser_class[.Symbol;
|
||||||
|
alias Value = ]b4_yystype[;]b4_locations_if([[
|
||||||
|
alias Location = ]b4_location_type[;
|
||||||
|
alias Position = ]b4_position_type[;]b4_push_if([[
|
||||||
|
alias PUSH_MORE = ]b4_parser_class[.YYPUSH_MORE;
|
||||||
|
alias ABORT = ]b4_parser_class[.YYABORT;
|
||||||
|
alias ACCEPT = ]b4_parser_class[.YYACCEPT;]])[]])[
|
||||||
|
]])
|
||||||
|
|
||||||
|
|
||||||
|
# b4_basic_symbol_constructor_define
|
||||||
|
# ----------------------------------
|
||||||
|
# Create Symbol struct constructors for all the visible types.
|
||||||
|
m4_define([b4_basic_symbol_constructor_define],
|
||||||
|
[b4_token_visible_if([$1],
|
||||||
|
[[ this(TokenKind token]b4_symbol_if([$1], [has_type],
|
||||||
|
[[, ]b4_union_if([], [[typeof(YYSemanticType.]])b4_symbol([$1], [type])dnl
|
||||||
|
[]b4_union_if([], [[) ]])[ val]])[]b4_locations_if([[, Location loc]])[)
|
||||||
|
{
|
||||||
|
kind = yytranslate_(token);]b4_union_if([b4_symbol_if([$1], [has_type], [[
|
||||||
|
static foreach (member; __traits(allMembers, YYSemanticType))
|
||||||
|
{
|
||||||
|
static if (is(typeof(mixin("value_." ~ member)) == ]b4_symbol([$1], [type])[))
|
||||||
|
{
|
||||||
|
mixin("value_." ~ member ~ " = val;");
|
||||||
|
}
|
||||||
|
}]])], [b4_symbol_if([$1], [has_type], [[
|
||||||
|
value_.]b4_symbol([$1], [type])[ = val;]])])[]b4_locations_if([
|
||||||
|
location_ = loc;])[
|
||||||
|
}
|
||||||
|
]])])
|
||||||
|
|
||||||
|
|
||||||
|
# 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
|
||||||
|
*/
|
||||||
|
struct Symbol
|
||||||
|
{
|
||||||
|
private SymbolKind kind;
|
||||||
|
private Value value_;]b4_locations_if([[
|
||||||
|
private Location location_;]])[
|
||||||
|
|
||||||
|
]b4_type_foreach([b4_basic_symbol_constructor_define])[
|
||||||
|
SymbolKind token() { return kind; }
|
||||||
|
Value value() { return value_; }]b4_locations_if([[
|
||||||
|
Location location() { return location_; }]])[
|
||||||
|
]b4_token_ctor_if([b4_token_constructor_define])[
|
||||||
|
}
|
||||||
|
]])
|
||||||
|
|||||||
+176
-150
@@ -1,8 +1,8 @@
|
|||||||
-*- C -*-
|
# -*- C -*-
|
||||||
|
|
||||||
# GLR skeleton for Bison
|
# GLR skeleton for Bison
|
||||||
|
|
||||||
# Copyright (C) 2002-2015, 2018-2020 Free Software Foundation, Inc.
|
# Copyright (C) 2002-2015, 2018-2021 Free Software Foundation, Inc.
|
||||||
|
|
||||||
# This program is free software: you can redistribute it and/or modify
|
# This program is free software: you can redistribute it and/or modify
|
||||||
# it under the terms of the GNU General Public License as published by
|
# it under the terms of the GNU General Public License as published by
|
||||||
@@ -15,7 +15,7 @@
|
|||||||
# GNU General Public License for more details.
|
# GNU General Public License for more details.
|
||||||
#
|
#
|
||||||
# You should have received a copy of the GNU General Public License
|
# You should have received a copy of the GNU General Public License
|
||||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
|
||||||
# If we are loaded by glr.cc, do not override c++.m4 definitions by
|
# If we are loaded by glr.cc, do not override c++.m4 definitions by
|
||||||
@@ -32,7 +32,9 @@ m4_if(b4_skeleton, ["glr.c"],
|
|||||||
m4_define_default([b4_stack_depth_max], [10000])
|
m4_define_default([b4_stack_depth_max], [10000])
|
||||||
m4_define_default([b4_stack_depth_init], [200])
|
m4_define_default([b4_stack_depth_init], [200])
|
||||||
|
|
||||||
|
# Included header.
|
||||||
|
b4_percent_define_default([[api.header.include]],
|
||||||
|
[["@basename(]b4_spec_header_file[@)"]])
|
||||||
|
|
||||||
## ------------------------ ##
|
## ------------------------ ##
|
||||||
## Pure/impure interfaces. ##
|
## Pure/impure interfaces. ##
|
||||||
@@ -122,7 +124,7 @@ m4_define([b4_rhs_data],
|
|||||||
# --------------------------------------------------
|
# --------------------------------------------------
|
||||||
# Expansion of $$ or $<TYPE>$, for symbol SYMBOL-NUM.
|
# Expansion of $$ or $<TYPE>$, for symbol SYMBOL-NUM.
|
||||||
m4_define([b4_rhs_value],
|
m4_define([b4_rhs_value],
|
||||||
[b4_symbol_value([b4_rhs_data([$1], [$2]).yysemantics.yysval], [$3], [$4])])
|
[b4_symbol_value([b4_rhs_data([$1], [$2]).yysemantics.yyval], [$3], [$4])])
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -145,13 +147,22 @@ m4_define([b4_rhs_location],
|
|||||||
[(b4_rhs_data([$1], [$2]).yyloc)])
|
[(b4_rhs_data([$1], [$2]).yyloc)])
|
||||||
|
|
||||||
|
|
||||||
|
# b4_call_merger(MERGER-NUM, MERGER-NAME, SYMBOL-SUM)
|
||||||
|
# ---------------------------------------------------
|
||||||
|
m4_define([b4_call_merger],
|
||||||
|
[b4_case([$1],
|
||||||
|
[ b4_symbol_if([$3], [has_type],
|
||||||
|
[yy0->b4_symbol($3, slot) = $2 (*yy0, *yy1);],
|
||||||
|
[*yy0 = $2 (*yy0, *yy1);])])])
|
||||||
|
|
||||||
|
|
||||||
## -------------- ##
|
## -------------- ##
|
||||||
## Declarations. ##
|
## Declarations. ##
|
||||||
## -------------- ##
|
## -------------- ##
|
||||||
|
|
||||||
# b4_shared_declarations
|
# b4_shared_declarations
|
||||||
# ----------------------
|
# ----------------------
|
||||||
# Declaration that might either go into the header (if --defines)
|
# Declaration that might either go into the header (if --header)
|
||||||
# or open coded in the parser body. glr.cc has its own definition.
|
# or open coded in the parser body. glr.cc has its own definition.
|
||||||
m4_if(b4_skeleton, ["glr.c"],
|
m4_if(b4_skeleton, ["glr.c"],
|
||||||
[m4_define([b4_shared_declarations],
|
[m4_define([b4_shared_declarations],
|
||||||
@@ -185,13 +196,13 @@ int ]b4_prefix[parse (]m4_ifset([b4_parse_param], [b4_formals(b4_parse_param)],
|
|||||||
|
|
||||||
# glr.cc produces its own header.
|
# glr.cc produces its own header.
|
||||||
b4_glr_cc_if([],
|
b4_glr_cc_if([],
|
||||||
[b4_defines_if(
|
[b4_header_if(
|
||||||
[b4_output_begin([b4_spec_header_file])
|
[b4_output_begin([b4_spec_header_file])
|
||||||
b4_copyright([Skeleton interface for Bison GLR parsers in C],
|
b4_copyright([Skeleton interface for Bison GLR parsers in C],
|
||||||
[2002-2015, 2018-2020])[
|
[2002-2015, 2018-2021])[
|
||||||
]b4_cpp_guard_open([b4_spec_header_file])[
|
]b4_cpp_guard_open([b4_spec_mapped_header_file])[
|
||||||
]b4_shared_declarations[
|
]b4_shared_declarations[
|
||||||
]b4_cpp_guard_close([b4_spec_header_file])[
|
]b4_cpp_guard_close([b4_spec_mapped_header_file])[
|
||||||
]b4_output_end[
|
]b4_output_end[
|
||||||
]])])
|
]])])
|
||||||
|
|
||||||
@@ -202,7 +213,7 @@ b4_copyright([Skeleton interface for Bison GLR parsers in C],
|
|||||||
|
|
||||||
b4_output_begin([b4_parser_file_name])
|
b4_output_begin([b4_parser_file_name])
|
||||||
b4_copyright([Skeleton implementation for Bison GLR parsers in C],
|
b4_copyright([Skeleton implementation for Bison GLR parsers in C],
|
||||||
[2002-2015, 2018-2020])[
|
[2002-2015, 2018-2021])[
|
||||||
/* C GLR parser skeleton written by Paul Hilfinger. */
|
/* C GLR parser skeleton written by Paul Hilfinger. */
|
||||||
|
|
||||||
]b4_disclaimer[
|
]b4_disclaimer[
|
||||||
@@ -215,7 +226,7 @@ b4_copyright([Skeleton implementation for Bison GLR parsers in C],
|
|||||||
#define YYLTYPE ]b4_api_PREFIX[LTYPE]])])[
|
#define YYLTYPE ]b4_api_PREFIX[LTYPE]])])[
|
||||||
]m4_if(b4_prefix, [yy], [],
|
]m4_if(b4_prefix, [yy], [],
|
||||||
[[/* Substitute the variable and function names. */
|
[[/* Substitute the variable and function names. */
|
||||||
#define yyparse ]b4_prefix[parse
|
#define ]b4_glr_cc_if([yy_parse_impl], [yyparse])[ ]b4_prefix[]b4_glr_cc_if([_parse_impl], [parse])[
|
||||||
#define yylex ]b4_prefix[lex
|
#define yylex ]b4_prefix[lex
|
||||||
#define yyerror ]b4_prefix[error
|
#define yyerror ]b4_prefix[error
|
||||||
#define yydebug ]b4_prefix[debug]]b4_pure_if([], [[
|
#define yydebug ]b4_prefix[debug]]b4_pure_if([], [[
|
||||||
@@ -228,9 +239,11 @@ b4_copyright([Skeleton implementation for Bison GLR parsers in C],
|
|||||||
]b4_cast_define[
|
]b4_cast_define[
|
||||||
]b4_null_define[
|
]b4_null_define[
|
||||||
|
|
||||||
]b4_defines_if([[#include "@basename(]b4_spec_header_file[@)"]],
|
]b4_header_if([[#include ]b4_percent_define_get([[api.header.include]])],
|
||||||
[b4_shared_declarations])[
|
[b4_shared_declarations])[
|
||||||
]b4_declare_symbol_enum[
|
|
||||||
|
]b4_glr_cc_if([b4_glr_cc_setup],
|
||||||
|
[b4_declare_symbol_enum])[
|
||||||
|
|
||||||
/* Default (constant) value used for initialization for null
|
/* Default (constant) value used for initialization for null
|
||||||
right-hand sides. Unlike the standard yacc.c template, here we set
|
right-hand sides. Unlike the standard yacc.c template, here we set
|
||||||
@@ -331,8 +344,8 @@ static YYLTYPE yyloc_default][]b4_yyloc_default;])[
|
|||||||
accessed by $0, $-1, etc., in any rule. */
|
accessed by $0, $-1, etc., in any rule. */
|
||||||
#define YYMAXLEFT ]b4_max_left_semantic_context[
|
#define YYMAXLEFT ]b4_max_left_semantic_context[
|
||||||
|
|
||||||
/* YYMAXUTOK -- Last valid token number (for yychar). */
|
/* YYMAXUTOK -- Last valid token kind. */
|
||||||
#define YYMAXUTOK ]b4_user_token_number_max[
|
#define YYMAXUTOK ]b4_code_max[
|
||||||
|
|
||||||
/* YYTRANSLATE(TOKEN-NUM) -- Symbol number corresponding to TOKEN-NUM
|
/* YYTRANSLATE(TOKEN-NUM) -- Symbol number corresponding to TOKEN-NUM
|
||||||
as returned by yylex, with out-of-bounds checking. */
|
as returned by yylex, with out-of-bounds checking. */
|
||||||
@@ -429,7 +442,7 @@ int yychar;])[
|
|||||||
|
|
||||||
enum { YYENOMEM = -2 };
|
enum { YYENOMEM = -2 };
|
||||||
|
|
||||||
typedef enum { yyok, yyaccept, yyabort, yyerr } YYRESULTTAG;
|
typedef enum { yyok, yyaccept, yyabort, yyerr, yynomem } YYRESULTTAG;
|
||||||
|
|
||||||
#define YYCHK(YYE) \
|
#define YYCHK(YYE) \
|
||||||
do { \
|
do { \
|
||||||
@@ -494,10 +507,11 @@ typedef struct yySemanticOption yySemanticOption;
|
|||||||
typedef union yyGLRStackItem yyGLRStackItem;
|
typedef union yyGLRStackItem yyGLRStackItem;
|
||||||
typedef struct yyGLRStack yyGLRStack;
|
typedef struct yyGLRStack yyGLRStack;
|
||||||
|
|
||||||
struct yyGLRState {
|
struct yyGLRState
|
||||||
|
{
|
||||||
/** Type tag: always true. */
|
/** Type tag: always true. */
|
||||||
yybool yyisState;
|
yybool yyisState;
|
||||||
/** Type tag for yysemantics. If true, yysval applies, otherwise
|
/** Type tag for yysemantics. If true, yyval applies, otherwise
|
||||||
* yyfirstVal applies. */
|
* yyfirstVal applies. */
|
||||||
yybool yyresolved;
|
yybool yyresolved;
|
||||||
/** Number of corresponding LALR(1) machine state. */
|
/** Number of corresponding LALR(1) machine state. */
|
||||||
@@ -512,24 +526,26 @@ struct yyGLRState {
|
|||||||
* yynext. */
|
* yynext. */
|
||||||
yySemanticOption* yyfirstVal;
|
yySemanticOption* yyfirstVal;
|
||||||
/** Semantic value for this state. */
|
/** Semantic value for this state. */
|
||||||
YYSTYPE yysval;
|
YYSTYPE yyval;
|
||||||
} yysemantics;]b4_locations_if([[
|
} yysemantics;]b4_locations_if([[
|
||||||
/** Source location for this state. */
|
/** Source location for this state. */
|
||||||
YYLTYPE yyloc;]])[
|
YYLTYPE yyloc;]])[
|
||||||
};
|
};
|
||||||
|
|
||||||
struct yyGLRStateSet {
|
struct yyGLRStateSet
|
||||||
|
{
|
||||||
yyGLRState** yystates;
|
yyGLRState** yystates;
|
||||||
/** During nondeterministic operation, yylookaheadNeeds tracks which
|
/** During nondeterministic operation, yylookaheadNeeds tracks which
|
||||||
* stacks have actually needed the current lookahead. During deterministic
|
* stacks have actually needed the current lookahead. During deterministic
|
||||||
* operation, yylookaheadNeeds[0] is not maintained since it would merely
|
* operation, yylookaheadNeeds[0] is not maintained since it would merely
|
||||||
* duplicate yychar != ]b4_symbol(-2, id)[. */
|
* duplicate yychar != ]b4_symbol(empty, id)[. */
|
||||||
yybool* yylookaheadNeeds;
|
yybool* yylookaheadNeeds;
|
||||||
YYPTRDIFF_T yysize;
|
YYPTRDIFF_T yysize;
|
||||||
YYPTRDIFF_T yycapacity;
|
YYPTRDIFF_T yycapacity;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct yySemanticOption {
|
struct yySemanticOption
|
||||||
|
{
|
||||||
/** Type tag: always false. */
|
/** Type tag: always false. */
|
||||||
yybool yyisState;
|
yybool yyisState;
|
||||||
/** Rule number for this reduction */
|
/** Rule number for this reduction */
|
||||||
@@ -635,6 +651,13 @@ yysymbol_name (yysymbol_kind_t yysymbol)
|
|||||||
}]])[
|
}]])[
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/** Left-hand-side symbol for rule #YYRULE. */
|
||||||
|
static inline yysymbol_kind_t
|
||||||
|
yylhsNonterm (yyRuleNum yyrule)
|
||||||
|
{
|
||||||
|
return YY_CAST (yysymbol_kind_t, yyr1[yyrule]);
|
||||||
|
}
|
||||||
|
|
||||||
#if ]b4_api_PREFIX[DEBUG
|
#if ]b4_api_PREFIX[DEBUG
|
||||||
|
|
||||||
# ifndef YYFPRINTF
|
# ifndef YYFPRINTF
|
||||||
@@ -660,7 +683,7 @@ yysymbol_name (yysymbol_kind_t yysymbol)
|
|||||||
YY_IGNORE_USELESS_CAST_END \
|
YY_IGNORE_USELESS_CAST_END \
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
]b4_yy_location_print_define[
|
]b4_yylocation_print_define[
|
||||||
|
|
||||||
]b4_yy_symbol_print_define[
|
]b4_yy_symbol_print_define[
|
||||||
|
|
||||||
@@ -674,6 +697,16 @@ yysymbol_name (yysymbol_kind_t yysymbol)
|
|||||||
} \
|
} \
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
|
static inline void
|
||||||
|
yy_reduce_print (yybool yynormal, yyGLRStackItem* yyvsp, YYPTRDIFF_T yyk,
|
||||||
|
yyRuleNum yyrule]b4_user_formals[);
|
||||||
|
|
||||||
|
# define YY_REDUCE_PRINT(Args) \
|
||||||
|
do { \
|
||||||
|
if (yydebug) \
|
||||||
|
yy_reduce_print Args; \
|
||||||
|
} while (0)
|
||||||
|
|
||||||
/* Nonzero means print parse trace. It is left uninitialized so that
|
/* Nonzero means print parse trace. It is left uninitialized so that
|
||||||
multiple parsers can coexist. */
|
multiple parsers can coexist. */
|
||||||
int yydebug;
|
int yydebug;
|
||||||
@@ -687,6 +720,7 @@ static void yypdumpstack (yyGLRStack* yystackp)
|
|||||||
|
|
||||||
# define YY_DPRINTF(Args) do {} while (yyfalse)
|
# define YY_DPRINTF(Args) do {} while (yyfalse)
|
||||||
# define YY_SYMBOL_PRINT(Title, Kind, Value, Location)
|
# define YY_SYMBOL_PRINT(Title, Kind, Value, Location)
|
||||||
|
# define YY_REDUCE_PRINT(Args)
|
||||||
|
|
||||||
#endif /* !]b4_api_PREFIX[DEBUG */
|
#endif /* !]b4_api_PREFIX[DEBUG */
|
||||||
|
|
||||||
@@ -789,9 +823,9 @@ yyfillin (yyGLRStackItem *yyvsp, int yylow0, int yylow1)
|
|||||||
#endif
|
#endif
|
||||||
yyvsp[i].yystate.yyresolved = s->yyresolved;
|
yyvsp[i].yystate.yyresolved = s->yyresolved;
|
||||||
if (s->yyresolved)
|
if (s->yyresolved)
|
||||||
yyvsp[i].yystate.yysemantics.yysval = s->yysemantics.yysval;
|
yyvsp[i].yystate.yysemantics.yyval = s->yysemantics.yyval;
|
||||||
else
|
else
|
||||||
/* The effect of using yysval or yyloc (in an immediate rule) is
|
/* The effect of using yyval or yyloc (in an immediate rule) is
|
||||||
* undefined. */
|
* undefined. */
|
||||||
yyvsp[i].yystate.yysemantics.yyfirstVal = YY_NULLPTR;]b4_locations_if([[
|
yyvsp[i].yystate.yysemantics.yyfirstVal = YY_NULLPTR;]b4_locations_if([[
|
||||||
yyvsp[i].yystate.yyloc = s->yyloc;]])[
|
yyvsp[i].yystate.yyloc = s->yyloc;]])[
|
||||||
@@ -807,14 +841,14 @@ yygetToken (int *yycharp][]b4_pure_if([, yyGLRStack* yystackp])[]b4_user_formals
|
|||||||
{
|
{
|
||||||
yysymbol_kind_t yytoken;
|
yysymbol_kind_t yytoken;
|
||||||
]b4_parse_param_use()dnl
|
]b4_parse_param_use()dnl
|
||||||
[ if (*yycharp == ]b4_symbol(-2, id)[)
|
[ if (*yycharp == ]b4_symbol(empty, id)[)
|
||||||
{
|
{
|
||||||
YY_DPRINTF ((stderr, "Reading a token\n"));]b4_glr_cc_if([[
|
YY_DPRINTF ((stderr, "Reading a token\n"));]b4_glr_cc_if([[
|
||||||
#if YY_EXCEPTIONS
|
#if YY_EXCEPTIONS
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
#endif // YY_EXCEPTIONS
|
#endif // YY_EXCEPTIONS
|
||||||
*yycharp = ]b4_lex[;
|
*yycharp = ]b4_yylex[;
|
||||||
#if YY_EXCEPTIONS
|
#if YY_EXCEPTIONS
|
||||||
}
|
}
|
||||||
catch (const ]b4_namespace_ref[::]b4_parser_class[::syntax_error& yyexc)
|
catch (const ]b4_namespace_ref[::]b4_parser_class[::syntax_error& yyexc)
|
||||||
@@ -825,14 +859,14 @@ yygetToken (int *yycharp][]b4_pure_if([, yyGLRStack* yystackp])[]b4_user_formals
|
|||||||
// Map errors caught in the scanner to the undefined token,
|
// Map errors caught in the scanner to the undefined token,
|
||||||
// so that error handling is started. However, record this
|
// so that error handling is started. However, record this
|
||||||
// with this special value of yychar.
|
// with this special value of yychar.
|
||||||
*yycharp = ]b4_symbol(1, id)[;
|
*yycharp = ]b4_symbol(error, id)[;
|
||||||
}
|
}
|
||||||
#endif // YY_EXCEPTIONS]], [[
|
#endif // YY_EXCEPTIONS]], [[
|
||||||
*yycharp = ]b4_lex[;]])[
|
*yycharp = ]b4_yylex[;]])[
|
||||||
}
|
}
|
||||||
if (*yycharp <= ]b4_symbol(0, [id])[)
|
if (*yycharp <= ]b4_symbol(eof, [id])[)
|
||||||
{
|
{
|
||||||
*yycharp = ]b4_symbol(0, [id])[;
|
*yycharp = ]b4_symbol(eof, [id])[;
|
||||||
yytoken = ]b4_symbol_prefix[YYEOF;
|
yytoken = ]b4_symbol_prefix[YYEOF;
|
||||||
YY_DPRINTF ((stderr, "Now at end of input.\n"));
|
YY_DPRINTF ((stderr, "Now at end of input.\n"));
|
||||||
}
|
}
|
||||||
@@ -864,28 +898,31 @@ yyfill (yyGLRStackItem *yyvsp, int *yylow, int yylow1, yybool yynormal)
|
|||||||
* and top stack item YYVSP. YYLVALP points to place to put semantic
|
* and top stack item YYVSP. YYLVALP points to place to put semantic
|
||||||
* value ($$), and yylocp points to place for location information
|
* value ($$), and yylocp points to place for location information
|
||||||
* (@@$). Returns yyok for normal return, yyaccept for YYACCEPT,
|
* (@@$). Returns yyok for normal return, yyaccept for YYACCEPT,
|
||||||
* yyerr for YYERROR, yyabort for YYABORT. */
|
* yyerr for YYERROR, yyabort for YYABORT, yynomem for YYNOMEM. */
|
||||||
static YYRESULTTAG
|
static YYRESULTTAG
|
||||||
yyuserAction (yyRuleNum yyn, int yyrhslen, yyGLRStackItem* yyvsp,
|
yyuserAction (yyRuleNum yyrule, int yyrhslen, yyGLRStackItem* yyvsp,
|
||||||
yyGLRStack* yystackp,
|
yyGLRStack* yystackp, YYPTRDIFF_T yyk,
|
||||||
YYSTYPE* yyvalp]b4_locuser_formals[)
|
YYSTYPE* yyvalp]b4_locuser_formals[)
|
||||||
{
|
{
|
||||||
yybool yynormal YY_ATTRIBUTE_UNUSED = yystackp->yysplitPoint == YY_NULLPTR;
|
const yybool yynormal YY_ATTRIBUTE_UNUSED = yystackp->yysplitPoint == YY_NULLPTR;
|
||||||
int yylow;
|
int yylow = 1;
|
||||||
]b4_parse_param_use([yyvalp], [yylocp])dnl
|
]b4_parse_param_use([yyvalp], [yylocp])dnl
|
||||||
[ YYUSE (yyrhslen);
|
[ YY_USE (yyk);
|
||||||
|
YY_USE (yyrhslen);
|
||||||
# undef yyerrok
|
# undef yyerrok
|
||||||
# define yyerrok (yystackp->yyerrState = 0)
|
# define yyerrok (yystackp->yyerrState = 0)
|
||||||
# undef YYACCEPT
|
# undef YYACCEPT
|
||||||
# define YYACCEPT return yyaccept
|
# define YYACCEPT return yyaccept
|
||||||
# undef YYABORT
|
# undef YYABORT
|
||||||
# define YYABORT return yyabort
|
# define YYABORT return yyabort
|
||||||
|
# undef YYNOMEM
|
||||||
|
# define YYNOMEM return yynomem
|
||||||
# undef YYERROR
|
# undef YYERROR
|
||||||
# define YYERROR return yyerrok, yyerr
|
# define YYERROR return yyerrok, yyerr
|
||||||
# undef YYRECOVERING
|
# undef YYRECOVERING
|
||||||
# define YYRECOVERING() (yystackp->yyerrState != 0)
|
# define YYRECOVERING() (yystackp->yyerrState != 0)
|
||||||
# undef yyclearin
|
# undef yyclearin
|
||||||
# define yyclearin (yychar = ]b4_symbol(-2, id)[)
|
# define yyclearin (yychar = ]b4_symbol(empty, id)[)
|
||||||
# undef YYFILL
|
# undef YYFILL
|
||||||
# define YYFILL(N) yyfill (yyvsp, &yylow, (N), yynormal)
|
# define YYFILL(N) yyfill (yyvsp, &yylow, (N), yynormal)
|
||||||
# undef YYBACKUP
|
# undef YYBACKUP
|
||||||
@@ -893,21 +930,23 @@ yyuserAction (yyRuleNum yyn, int yyrhslen, yyGLRStackItem* yyvsp,
|
|||||||
return yyerror (]b4_yyerror_args[YY_("syntax error: cannot back up")), \
|
return yyerror (]b4_yyerror_args[YY_("syntax error: cannot back up")), \
|
||||||
yyerrok, yyerr
|
yyerrok, yyerr
|
||||||
|
|
||||||
yylow = 1;
|
|
||||||
if (yyrhslen == 0)
|
if (yyrhslen == 0)
|
||||||
*yyvalp = yyval_default;
|
*yyvalp = yyval_default;
|
||||||
else
|
else
|
||||||
*yyvalp = yyvsp[YYFILL (1-yyrhslen)].yystate.yysemantics.yysval;]b4_locations_if([[
|
*yyvalp = yyvsp[YYFILL (1-yyrhslen)].yystate.yysemantics.yyval;]b4_locations_if([[
|
||||||
/* Default location. */
|
/* Default location. */
|
||||||
YYLLOC_DEFAULT ((*yylocp), (yyvsp - yyrhslen), yyrhslen);
|
YYLLOC_DEFAULT ((*yylocp), (yyvsp - yyrhslen), yyrhslen);
|
||||||
yystackp->yyerror_range[1].yystate.yyloc = *yylocp;
|
yystackp->yyerror_range[1].yystate.yyloc = *yylocp;]])[
|
||||||
]])[]b4_glr_cc_if([[
|
/* If yyk == -1, we are running a deferred action on a temporary
|
||||||
|
stack. In that case, YY_REDUCE_PRINT must not play with YYFILL,
|
||||||
|
so pretend the stack is "normal". */
|
||||||
|
YY_REDUCE_PRINT ((yynormal || yyk == -1, yyvsp, yyk, yyrule]b4_user_args[));]b4_glr_cc_if([[
|
||||||
#if YY_EXCEPTIONS
|
#if YY_EXCEPTIONS
|
||||||
typedef ]b4_namespace_ref[::]b4_parser_class[::syntax_error syntax_error;
|
typedef ]b4_namespace_ref[::]b4_parser_class[::syntax_error syntax_error;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
#endif // YY_EXCEPTIONS]])[
|
#endif // YY_EXCEPTIONS]])[
|
||||||
switch (yyn)
|
switch (yyrule)
|
||||||
{
|
{
|
||||||
]b4_user_actions[
|
]b4_user_actions[
|
||||||
default: break;
|
default: break;
|
||||||
@@ -922,11 +961,13 @@ yyuserAction (yyRuleNum yyn, int yyrhslen, yyGLRStackItem* yyvsp,
|
|||||||
YYERROR;
|
YYERROR;
|
||||||
}
|
}
|
||||||
#endif // YY_EXCEPTIONS]])[
|
#endif // YY_EXCEPTIONS]])[
|
||||||
|
YY_SYMBOL_PRINT ("-> $$ =", yylhsNonterm (yyrule), yyvalp, yylocp);
|
||||||
|
|
||||||
return yyok;
|
return yyok;
|
||||||
# undef yyerrok
|
# undef yyerrok
|
||||||
# undef YYABORT
|
# undef YYABORT
|
||||||
# undef YYACCEPT
|
# undef YYACCEPT
|
||||||
|
# undef YYNOMEM
|
||||||
# undef YYERROR
|
# undef YYERROR
|
||||||
# undef YYBACKUP
|
# undef YYBACKUP
|
||||||
# undef yyclearin
|
# undef yyclearin
|
||||||
@@ -937,8 +978,8 @@ yyuserAction (yyRuleNum yyn, int yyrhslen, yyGLRStackItem* yyvsp,
|
|||||||
static void
|
static void
|
||||||
yyuserMerge (int yyn, YYSTYPE* yy0, YYSTYPE* yy1)
|
yyuserMerge (int yyn, YYSTYPE* yy0, YYSTYPE* yy1)
|
||||||
{
|
{
|
||||||
YYUSE (yy0);
|
YY_USE (yy0);
|
||||||
YYUSE (yy1);
|
YY_USE (yy1);
|
||||||
|
|
||||||
switch (yyn)
|
switch (yyn)
|
||||||
{
|
{
|
||||||
@@ -963,7 +1004,7 @@ yydestroyGLRState (char const *yymsg, yyGLRState *yys]b4_user_formals[)
|
|||||||
{
|
{
|
||||||
if (yys->yyresolved)
|
if (yys->yyresolved)
|
||||||
yydestruct (yymsg, yy_accessing_symbol (yys->yylrState),
|
yydestruct (yymsg, yy_accessing_symbol (yys->yylrState),
|
||||||
&yys->yysemantics.yysval]b4_locuser_args([&yys->yyloc])[);
|
&yys->yysemantics.yyval]b4_locuser_args([&yys->yyloc])[);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
#if ]b4_api_PREFIX[DEBUG
|
#if ]b4_api_PREFIX[DEBUG
|
||||||
@@ -990,13 +1031,6 @@ yydestroyGLRState (char const *yymsg, yyGLRState *yys]b4_user_formals[)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Left-hand-side symbol for rule #YYRULE. */
|
|
||||||
static inline yysymbol_kind_t
|
|
||||||
yylhsNonterm (yyRuleNum yyrule)
|
|
||||||
{
|
|
||||||
return YY_CAST (yysymbol_kind_t, yyr1[yyrule]);
|
|
||||||
}
|
|
||||||
|
|
||||||
#define yypact_value_is_default(Yyn) \
|
#define yypact_value_is_default(Yyn) \
|
||||||
]b4_table_value_equals([[pact]], [[Yyn]], [b4_pact_ninf], [YYPACT_NINF])[
|
]b4_table_value_equals([[pact]], [[Yyn]], [b4_pact_ninf], [YYPACT_NINF])[
|
||||||
|
|
||||||
@@ -1030,7 +1064,7 @@ static inline int
|
|||||||
yygetLRActions (yy_state_t yystate, yysymbol_kind_t yytoken, const short** yyconflicts)
|
yygetLRActions (yy_state_t yystate, yysymbol_kind_t yytoken, const short** yyconflicts)
|
||||||
{
|
{
|
||||||
int yyindex = yypact[yystate] + yytoken;
|
int yyindex = yypact[yystate] + yytoken;
|
||||||
if (yytoken == ]b4_symbol(1, kind)[)
|
if (yytoken == ]b4_symbol(error, kind)[)
|
||||||
{
|
{
|
||||||
// This is the error token.
|
// This is the error token.
|
||||||
*yyconflicts = yyconfl;
|
*yyconflicts = yyconfl;
|
||||||
@@ -1117,7 +1151,7 @@ yyaddDeferredAction (yyGLRStack* yystackp, YYPTRDIFF_T yyk, yyGLRState* yystate,
|
|||||||
yynewOption->yyloc = yylloc;])[
|
yynewOption->yyloc = yylloc;])[
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
yynewOption->yyrawchar = ]b4_symbol(-2, id)[;
|
yynewOption->yyrawchar = ]b4_symbol(empty, id)[;
|
||||||
yynewOption->yynext = yystate->yysemantics.yyfirstVal;
|
yynewOption->yynext = yystate->yysemantics.yyfirstVal;
|
||||||
yystate->yysemantics.yyfirstVal = yynewOption;
|
yystate->yysemantics.yyfirstVal = yynewOption;
|
||||||
|
|
||||||
@@ -1338,7 +1372,7 @@ yyglrShift (yyGLRStack* yystackp, YYPTRDIFF_T yyk, yy_state_t yylrState,
|
|||||||
yynewState->yyposn = yyposn;
|
yynewState->yyposn = yyposn;
|
||||||
yynewState->yyresolved = yytrue;
|
yynewState->yyresolved = yytrue;
|
||||||
yynewState->yypred = yystackp->yytops.yystates[yyk];
|
yynewState->yypred = yystackp->yytops.yystates[yyk];
|
||||||
yynewState->yysemantics.yysval = *yyvalp;]b4_locations_if([
|
yynewState->yysemantics.yyval = *yyvalp;]b4_locations_if([
|
||||||
yynewState->yyloc = *yylocp;])[
|
yynewState->yyloc = *yylocp;])[
|
||||||
yystackp->yytops.yystates[yyk] = yynewState;
|
yystackp->yytops.yystates[yyk] = yynewState;
|
||||||
|
|
||||||
@@ -1366,14 +1400,7 @@ yyglrShiftDefer (yyGLRStack* yystackp, YYPTRDIFF_T yyk, yy_state_t yylrState,
|
|||||||
yyaddDeferredAction (yystackp, yyk, yynewState, yyrhs, yyrule);
|
yyaddDeferredAction (yystackp, yyk, yynewState, yyrhs, yyrule);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if !]b4_api_PREFIX[DEBUG
|
#if ]b4_api_PREFIX[DEBUG
|
||||||
# define YY_REDUCE_PRINT(Args)
|
|
||||||
#else
|
|
||||||
# define YY_REDUCE_PRINT(Args) \
|
|
||||||
do { \
|
|
||||||
if (yydebug) \
|
|
||||||
yy_reduce_print Args; \
|
|
||||||
} while (0)
|
|
||||||
|
|
||||||
/*----------------------------------------------------------------------.
|
/*----------------------------------------------------------------------.
|
||||||
| Report that stack #YYK of *YYSTACKP is going to be reduced by YYRULE. |
|
| Report that stack #YYK of *YYSTACKP is going to be reduced by YYRULE. |
|
||||||
@@ -1396,7 +1423,7 @@ yy_reduce_print (yybool yynormal, yyGLRStackItem* yyvsp, YYPTRDIFF_T yyk,
|
|||||||
YY_FPRINTF ((stderr, " $%d = ", yyi + 1));
|
YY_FPRINTF ((stderr, " $%d = ", yyi + 1));
|
||||||
yy_symbol_print (stderr,
|
yy_symbol_print (stderr,
|
||||||
yy_accessing_symbol (yyvsp[yyi - yynrhs + 1].yystate.yylrState),
|
yy_accessing_symbol (yyvsp[yyi - yynrhs + 1].yystate.yylrState),
|
||||||
&yyvsp[yyi - yynrhs + 1].yystate.yysemantics.yysval]b4_locations_if([,
|
&yyvsp[yyi - yynrhs + 1].yystate.yysemantics.yyval]b4_locations_if([,
|
||||||
&]b4_rhs_location(yynrhs, yyi + 1))[]dnl
|
&]b4_rhs_location(yynrhs, yyi + 1))[]dnl
|
||||||
b4_user_args[);
|
b4_user_args[);
|
||||||
if (!yyvsp[yyi - yynrhs + 1].yystate.yyresolved)
|
if (!yyvsp[yyi - yynrhs + 1].yystate.yyresolved)
|
||||||
@@ -1427,8 +1454,7 @@ yydoAction (yyGLRStack* yystackp, YYPTRDIFF_T yyk, yyRuleNum yyrule,
|
|||||||
yystackp->yynextFree -= yynrhs;
|
yystackp->yynextFree -= yynrhs;
|
||||||
yystackp->yyspaceLeft += yynrhs;
|
yystackp->yyspaceLeft += yynrhs;
|
||||||
yystackp->yytops.yystates[0] = & yystackp->yynextFree[-1].yystate;
|
yystackp->yytops.yystates[0] = & yystackp->yynextFree[-1].yystate;
|
||||||
YY_REDUCE_PRINT ((yytrue, yyrhs, yyk, yyrule]b4_user_args[));
|
return yyuserAction (yyrule, yynrhs, yyrhs, yystackp, yyk,
|
||||||
return yyuserAction (yyrule, yynrhs, yyrhs, yystackp,
|
|
||||||
yyvalp]b4_locuser_args[);
|
yyvalp]b4_locuser_args[);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -1447,9 +1473,8 @@ yydoAction (yyGLRStack* yystackp, YYPTRDIFF_T yyk, yyRuleNum yyrule,
|
|||||||
}
|
}
|
||||||
yyupdateSplit (yystackp, yys);
|
yyupdateSplit (yystackp, yys);
|
||||||
yystackp->yytops.yystates[yyk] = yys;
|
yystackp->yytops.yystates[yyk] = yys;
|
||||||
YY_REDUCE_PRINT ((yyfalse, yyrhsVals + YYMAXRHS + YYMAXLEFT - 1, yyk, yyrule]b4_user_args[));
|
|
||||||
return yyuserAction (yyrule, yynrhs, yyrhsVals + YYMAXRHS + YYMAXLEFT - 1,
|
return yyuserAction (yyrule, yynrhs, yyrhsVals + YYMAXRHS + YYMAXLEFT - 1,
|
||||||
yystackp, yyvalp]b4_locuser_args[);
|
yystackp, yyk, yyvalp]b4_locuser_args[);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1472,21 +1497,20 @@ yyglrReduce (yyGLRStack* yystackp, YYPTRDIFF_T yyk, yyRuleNum yyrule,
|
|||||||
|
|
||||||
if (yyforceEval || yystackp->yysplitPoint == YY_NULLPTR)
|
if (yyforceEval || yystackp->yysplitPoint == YY_NULLPTR)
|
||||||
{
|
{
|
||||||
YYSTYPE yysval;]b4_locations_if([[
|
YYSTYPE yyval;]b4_locations_if([[
|
||||||
YYLTYPE yyloc;]])[
|
YYLTYPE yyloc;]])[
|
||||||
|
|
||||||
YYRESULTTAG yyflag = yydoAction (yystackp, yyk, yyrule, &yysval]b4_locuser_args([&yyloc])[);
|
YYRESULTTAG yyflag = yydoAction (yystackp, yyk, yyrule, &yyval]b4_locuser_args([&yyloc])[);
|
||||||
if (yyflag == yyerr && yystackp->yysplitPoint != YY_NULLPTR)
|
if (yyflag == yyerr && yystackp->yysplitPoint != YY_NULLPTR)
|
||||||
YY_DPRINTF ((stderr,
|
YY_DPRINTF ((stderr,
|
||||||
"Parse on stack %ld rejected by rule %d (line %d).\n",
|
"Parse on stack %ld rejected by rule %d (line %d).\n",
|
||||||
YY_CAST (long, yyk), yyrule - 1, yyrline[yyrule - 1]));
|
YY_CAST (long, yyk), yyrule - 1, yyrline[yyrule]));
|
||||||
if (yyflag != yyok)
|
if (yyflag != yyok)
|
||||||
return yyflag;
|
return yyflag;
|
||||||
YY_SYMBOL_PRINT ("-> $$ =", yylhsNonterm (yyrule), &yysval, &yyloc);
|
|
||||||
yyglrShift (yystackp, yyk,
|
yyglrShift (yystackp, yyk,
|
||||||
yyLRgotoState (yystackp->yytops.yystates[yyk]->yylrState,
|
yyLRgotoState (yystackp->yytops.yystates[yyk]->yylrState,
|
||||||
yylhsNonterm (yyrule)),
|
yylhsNonterm (yyrule)),
|
||||||
yyposn, &yysval]b4_locations_if([, &yyloc])[);
|
yyposn, &yyval]b4_locations_if([, &yyloc])[);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -1506,7 +1530,7 @@ yyglrReduce (yyGLRStack* yystackp, YYPTRDIFF_T yyk, yyRuleNum yyrule,
|
|||||||
YY_DPRINTF ((stderr,
|
YY_DPRINTF ((stderr,
|
||||||
"Reduced stack %ld by rule %d (line %d); action deferred. "
|
"Reduced stack %ld by rule %d (line %d); action deferred. "
|
||||||
"Now in state %d.\n",
|
"Now in state %d.\n",
|
||||||
YY_CAST (long, yyk), yyrule - 1, yyrline[yyrule - 1],
|
YY_CAST (long, yyk), yyrule - 1, yyrline[yyrule],
|
||||||
yynewLRState));
|
yynewLRState));
|
||||||
for (yyi = 0; yyi < yystackp->yytops.yysize; yyi += 1)
|
for (yyi = 0; yyi < yystackp->yytops.yysize; yyi += 1)
|
||||||
if (yyi != yyk && yystackp->yytops.yystates[yyi] != YY_NULLPTR)
|
if (yyi != yyk && yystackp->yytops.yystates[yyi] != YY_NULLPTR)
|
||||||
@@ -1617,12 +1641,12 @@ yymergeOptionSets (yySemanticOption* yyy0, yySemanticOption* yyy1)
|
|||||||
else if (yys0->yyresolved)
|
else if (yys0->yyresolved)
|
||||||
{
|
{
|
||||||
yys1->yyresolved = yytrue;
|
yys1->yyresolved = yytrue;
|
||||||
yys1->yysemantics.yysval = yys0->yysemantics.yysval;
|
yys1->yysemantics.yyval = yys0->yysemantics.yyval;
|
||||||
}
|
}
|
||||||
else if (yys1->yyresolved)
|
else if (yys1->yyresolved)
|
||||||
{
|
{
|
||||||
yys0->yyresolved = yytrue;
|
yys0->yyresolved = yytrue;
|
||||||
yys0->yysemantics.yysval = yys1->yysemantics.yysval;
|
yys0->yysemantics.yyval = yys1->yysemantics.yyval;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -1676,8 +1700,8 @@ yypreference (yySemanticOption* y0, yySemanticOption* y1)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static YYRESULTTAG yyresolveValue (yyGLRState* yys,
|
static YYRESULTTAG
|
||||||
yyGLRStack* yystackp]b4_user_formals[);
|
yyresolveValue (yyGLRState* yys, yyGLRStack* yystackp]b4_user_formals[);
|
||||||
|
|
||||||
|
|
||||||
/** Resolve the previous YYN states starting at and including state YYS
|
/** Resolve the previous YYN states starting at and including state YYS
|
||||||
@@ -1733,7 +1757,7 @@ yyresolveAction (yySemanticOption* yyopt, yyGLRStack* yystackp,
|
|||||||
yylloc = yyopt->yyloc;])[
|
yylloc = yyopt->yyloc;])[
|
||||||
yyflag = yyuserAction (yyopt->yyrule, yynrhs,
|
yyflag = yyuserAction (yyopt->yyrule, yynrhs,
|
||||||
yyrhsVals + YYMAXRHS + YYMAXLEFT - 1,
|
yyrhsVals + YYMAXRHS + YYMAXLEFT - 1,
|
||||||
yystackp, yyvalp]b4_locuser_args[);
|
yystackp, -1, yyvalp]b4_locuser_args[);
|
||||||
yychar = yychar_current;
|
yychar = yychar_current;
|
||||||
yylval = yylval_current;]b4_locations_if([
|
yylval = yylval_current;]b4_locations_if([
|
||||||
yylloc = yylloc_current;])[
|
yylloc = yylloc_current;])[
|
||||||
@@ -1793,8 +1817,8 @@ static YYRESULTTAG
|
|||||||
yyreportAmbiguity (yySemanticOption* yyx0,
|
yyreportAmbiguity (yySemanticOption* yyx0,
|
||||||
yySemanticOption* yyx1]b4_pure_formals[)
|
yySemanticOption* yyx1]b4_pure_formals[)
|
||||||
{
|
{
|
||||||
YYUSE (yyx0);
|
YY_USE (yyx0);
|
||||||
YYUSE (yyx1);
|
YY_USE (yyx1);
|
||||||
|
|
||||||
#if ]b4_api_PREFIX[DEBUG
|
#if ]b4_api_PREFIX[DEBUG
|
||||||
YY_FPRINTF ((stderr, "Ambiguity detected.\n"));
|
YY_FPRINTF ((stderr, "Ambiguity detected.\n"));
|
||||||
@@ -1868,7 +1892,7 @@ yyresolveValue (yyGLRState* yys, yyGLRStack* yystackp]b4_user_formals[)
|
|||||||
yySemanticOption* yybest = yyoptionList;
|
yySemanticOption* yybest = yyoptionList;
|
||||||
yySemanticOption** yypp;
|
yySemanticOption** yypp;
|
||||||
yybool yymerge = yyfalse;
|
yybool yymerge = yyfalse;
|
||||||
YYSTYPE yysval;
|
YYSTYPE yyval;
|
||||||
YYRESULTTAG yyflag;]b4_locations_if([
|
YYRESULTTAG yyflag;]b4_locations_if([
|
||||||
YYLTYPE *yylocp = &yys->yyloc;])[
|
YYLTYPE *yylocp = &yys->yyloc;])[
|
||||||
|
|
||||||
@@ -1912,33 +1936,33 @@ yyresolveValue (yyGLRState* yys, yyGLRStack* yystackp]b4_user_formals[)
|
|||||||
{
|
{
|
||||||
yySemanticOption* yyp;
|
yySemanticOption* yyp;
|
||||||
int yyprec = yydprec[yybest->yyrule];
|
int yyprec = yydprec[yybest->yyrule];
|
||||||
yyflag = yyresolveAction (yybest, yystackp, &yysval]b4_locuser_args[);
|
yyflag = yyresolveAction (yybest, yystackp, &yyval]b4_locuser_args[);
|
||||||
if (yyflag == yyok)
|
if (yyflag == yyok)
|
||||||
for (yyp = yybest->yynext; yyp != YY_NULLPTR; yyp = yyp->yynext)
|
for (yyp = yybest->yynext; yyp != YY_NULLPTR; yyp = yyp->yynext)
|
||||||
{
|
{
|
||||||
if (yyprec == yydprec[yyp->yyrule])
|
if (yyprec == yydprec[yyp->yyrule])
|
||||||
{
|
{
|
||||||
YYSTYPE yysval_other;]b4_locations_if([
|
YYSTYPE yyval_other;]b4_locations_if([
|
||||||
YYLTYPE yydummy;])[
|
YYLTYPE yydummy;])[
|
||||||
yyflag = yyresolveAction (yyp, yystackp, &yysval_other]b4_locuser_args([&yydummy])[);
|
yyflag = yyresolveAction (yyp, yystackp, &yyval_other]b4_locuser_args([&yydummy])[);
|
||||||
if (yyflag != yyok)
|
if (yyflag != yyok)
|
||||||
{
|
{
|
||||||
yydestruct ("Cleanup: discarding incompletely merged value for",
|
yydestruct ("Cleanup: discarding incompletely merged value for",
|
||||||
yy_accessing_symbol (yys->yylrState),
|
yy_accessing_symbol (yys->yylrState),
|
||||||
&yysval]b4_locuser_args[);
|
&yyval]b4_locuser_args[);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
yyuserMerge (yymerger[yyp->yyrule], &yysval, &yysval_other);
|
yyuserMerge (yymerger[yyp->yyrule], &yyval, &yyval_other);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
yyflag = yyresolveAction (yybest, yystackp, &yysval]b4_locuser_args([yylocp])[);
|
yyflag = yyresolveAction (yybest, yystackp, &yyval]b4_locuser_args([yylocp])[);
|
||||||
|
|
||||||
if (yyflag == yyok)
|
if (yyflag == yyok)
|
||||||
{
|
{
|
||||||
yys->yyresolved = yytrue;
|
yys->yyresolved = yytrue;
|
||||||
yys->yysemantics.yysval = yysval;
|
yys->yysemantics.yyval = yyval;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
yys->yysemantics.yyfirstVal = YY_NULLPTR;
|
yys->yysemantics.yyfirstVal = YY_NULLPTR;
|
||||||
@@ -1963,18 +1987,24 @@ yyresolveStack (yyGLRStack* yystackp]b4_user_formals[)
|
|||||||
return yyok;
|
return yyok;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** Called when returning to deterministic operation to clean up the extra
|
||||||
|
* stacks. */
|
||||||
static void
|
static void
|
||||||
yycompressStack (yyGLRStack* yystackp)
|
yycompressStack (yyGLRStack* yystackp)
|
||||||
{
|
{
|
||||||
yyGLRState* yyp, *yyq, *yyr;
|
/* yyr is the state after the split point. */
|
||||||
|
yyGLRState *yyr;
|
||||||
|
|
||||||
if (yystackp->yytops.yysize != 1 || yystackp->yysplitPoint == YY_NULLPTR)
|
if (yystackp->yytops.yysize != 1 || yystackp->yysplitPoint == YY_NULLPTR)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
for (yyp = yystackp->yytops.yystates[0], yyq = yyp->yypred, yyr = YY_NULLPTR;
|
{
|
||||||
yyp != yystackp->yysplitPoint;
|
yyGLRState *yyp, *yyq;
|
||||||
yyr = yyp, yyp = yyq, yyq = yyp->yypred)
|
for (yyp = yystackp->yytops.yystates[0], yyq = yyp->yypred, yyr = YY_NULLPTR;
|
||||||
yyp->yypred = yyr;
|
yyp != yystackp->yysplitPoint;
|
||||||
|
yyr = yyp, yyp = yyq, yyq = yyp->yypred)
|
||||||
|
yyp->yypred = yyr;
|
||||||
|
}
|
||||||
|
|
||||||
yystackp->yyspaceLeft += yystackp->yynextFree - yystackp->yyitems;
|
yystackp->yyspaceLeft += yystackp->yynextFree - yystackp->yyitems;
|
||||||
yystackp->yynextFree = YY_REINTERPRET_CAST (yyGLRStackItem*, yystackp->yysplitPoint) + 1;
|
yystackp->yynextFree = YY_REINTERPRET_CAST (yyGLRStackItem*, yystackp->yysplitPoint) + 1;
|
||||||
@@ -2108,7 +2138,7 @@ yypcontext_expected_tokens (const yyGLRStack* yystackp,
|
|||||||
int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
|
int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
|
||||||
int yyx;
|
int yyx;
|
||||||
for (yyx = yyxbegin; yyx < yyxend; ++yyx)
|
for (yyx = yyxbegin; yyx < yyxend; ++yyx)
|
||||||
if (yycheck[yyx + yyn] == yyx && yyx != ]b4_symbol(1, kind)[
|
if (yycheck[yyx + yyn] == yyx && yyx != ]b4_symbol(error, kind)[
|
||||||
&& !yytable_value_is_error (yytable[yyx + yyn]))
|
&& !yytable_value_is_error (yytable[yyx + yyn]))
|
||||||
{
|
{
|
||||||
if (!yyarg)
|
if (!yyarg)
|
||||||
@@ -2120,7 +2150,7 @@ yypcontext_expected_tokens (const yyGLRStack* yystackp,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (yyarg && yycount == 0 && 0 < yyargn)
|
if (yyarg && yycount == 0 && 0 < yyargn)
|
||||||
yyarg[0] = ]b4_symbol(-2, kind)[;
|
yyarg[0] = ]b4_symbol(empty, kind)[;
|
||||||
return yycount;
|
return yycount;
|
||||||
}]])[
|
}]])[
|
||||||
|
|
||||||
@@ -2138,19 +2168,19 @@ yypcontext_token (const yyGLRStack *yystackp) YY_ATTRIBUTE_UNUSED;
|
|||||||
static yysymbol_kind_t
|
static yysymbol_kind_t
|
||||||
yypcontext_token (const yyGLRStack *yystackp)
|
yypcontext_token (const yyGLRStack *yystackp)
|
||||||
{
|
{
|
||||||
YYUSE (yystackp);
|
YY_USE (yystackp);
|
||||||
yysymbol_kind_t yytoken = yychar == ]b4_symbol(-2, id)[ ? ]b4_symbol(-2, kind)[ : YYTRANSLATE (yychar);
|
yysymbol_kind_t yytoken = yychar == ]b4_symbol(empty, id)[ ? ]b4_symbol(empty, kind)[ : YYTRANSLATE (yychar);
|
||||||
return yytoken;
|
return yytoken;
|
||||||
}
|
}
|
||||||
|
|
||||||
]b4_locations_if([[/* The location of the lookahead of this context. */
|
]b4_locations_if([[/* The location of the lookahead of this context. */
|
||||||
static YYLTYPE *
|
static const YYLTYPE *
|
||||||
yypcontext_location (const yyGLRStack *yystackp) YY_ATTRIBUTE_UNUSED;
|
yypcontext_location (const yyGLRStack *yystackp) YY_ATTRIBUTE_UNUSED;
|
||||||
|
|
||||||
static YYLTYPE *
|
static const YYLTYPE *
|
||||||
yypcontext_location (const yyGLRStack *yystackp)
|
yypcontext_location (const yyGLRStack *yystackp)
|
||||||
{
|
{
|
||||||
YYUSE (yystackp);
|
YY_USE (yystackp);
|
||||||
return &yylloc;
|
return &yylloc;
|
||||||
}]])],
|
}]])],
|
||||||
[detailed\|verbose],
|
[detailed\|verbose],
|
||||||
@@ -2158,7 +2188,7 @@ yypcontext_location (const yyGLRStack *yystackp)
|
|||||||
yy_syntax_error_arguments (const yyGLRStack* yystackp,
|
yy_syntax_error_arguments (const yyGLRStack* yystackp,
|
||||||
yysymbol_kind_t yyarg[], int yyargn)
|
yysymbol_kind_t yyarg[], int yyargn)
|
||||||
{
|
{
|
||||||
yysymbol_kind_t yytoken = yychar == ]b4_symbol(-2, id)[ ? ]b4_symbol(-2, kind)[ : YYTRANSLATE (yychar);
|
yysymbol_kind_t yytoken = yychar == ]b4_symbol(empty, id)[ ? ]b4_symbol(empty, kind)[ : YYTRANSLATE (yychar);
|
||||||
/* Actual size of YYARG. */
|
/* Actual size of YYARG. */
|
||||||
int yycount = 0;
|
int yycount = 0;
|
||||||
/* There are many possibilities here to consider:
|
/* There are many possibilities here to consider:
|
||||||
@@ -2174,12 +2204,7 @@ yy_syntax_error_arguments (const yyGLRStack* yystackp,
|
|||||||
- Don't assume there isn't a lookahead just because this state is a
|
- 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
|
consistent state with a default action. There might have been a
|
||||||
previous inconsistent state, consistent state with a non-default
|
previous inconsistent state, consistent state with a non-default
|
||||||
action, or user semantic action that manipulated yychar.]b4_lac_if([[
|
action, or user semantic action that manipulated yychar.
|
||||||
In the first two cases, it might appear that the current syntax
|
|
||||||
error should have been detected in the previous state when yy_lac
|
|
||||||
was invoked. However, at that time, there might have been a
|
|
||||||
different syntax error that discarded a different initial context
|
|
||||||
during error recovery, leaving behind the current lookahead.]], [[
|
|
||||||
- Of course, the expected token list depends on states to have
|
- Of course, the expected token list depends on states to have
|
||||||
correct lookahead information, and it depends on the parser not
|
correct lookahead information, and it depends on the parser not
|
||||||
to perform extra reductions after fetching a lookahead from the
|
to perform extra reductions after fetching a lookahead from the
|
||||||
@@ -2187,9 +2212,9 @@ yy_syntax_error_arguments (const yyGLRStack* yystackp,
|
|||||||
(from LALR or IELR) and default reductions corrupt the expected
|
(from LALR or IELR) and default reductions corrupt the expected
|
||||||
token list. However, the list is correct for canonical LR with
|
token list. However, the list is correct for canonical LR with
|
||||||
one exception: it will still contain any token that will not be
|
one exception: it will still contain any token that will not be
|
||||||
accepted due to an error action in a later state.]])[
|
accepted due to an error action in a later state.
|
||||||
*/
|
*/
|
||||||
if (yytoken != ]b4_symbol(-2, kind)[)
|
if (yytoken != ]b4_symbol(empty, kind)[)
|
||||||
{
|
{
|
||||||
int yyn;
|
int yyn;
|
||||||
if (yyarg)
|
if (yyarg)
|
||||||
@@ -2316,9 +2341,9 @@ yyrecoverSyntaxError (yyGLRStack* yystackp]b4_user_formals[)
|
|||||||
{
|
{
|
||||||
yysymbol_kind_t yytoken;
|
yysymbol_kind_t yytoken;
|
||||||
int yyj;
|
int yyj;
|
||||||
if (yychar == ]b4_symbol(0, [id])[)
|
if (yychar == ]b4_symbol(eof, [id])[)
|
||||||
yyFail (yystackp][]b4_lpure_args[, YY_NULLPTR);
|
yyFail (yystackp][]b4_lpure_args[, YY_NULLPTR);
|
||||||
if (yychar != ]b4_symbol(-2, id)[)
|
if (yychar != ]b4_symbol(empty, id)[)
|
||||||
{]b4_locations_if([[
|
{]b4_locations_if([[
|
||||||
/* We throw away the lookahead, but the error range
|
/* We throw away the lookahead, but the error range
|
||||||
of the shifted error token must take it into account. */
|
of the shifted error token must take it into account. */
|
||||||
@@ -2330,7 +2355,7 @@ yyrecoverSyntaxError (yyGLRStack* yystackp]b4_user_formals[)
|
|||||||
yytoken = YYTRANSLATE (yychar);
|
yytoken = YYTRANSLATE (yychar);
|
||||||
yydestruct ("Error: discarding",
|
yydestruct ("Error: discarding",
|
||||||
yytoken, &yylval]b4_locuser_args([&yylloc])[);
|
yytoken, &yylval]b4_locuser_args([&yylloc])[);
|
||||||
yychar = ]b4_symbol(-2, id)[;
|
yychar = ]b4_symbol(empty, id)[;
|
||||||
}
|
}
|
||||||
yytoken = ]b4_yygetToken_call[;
|
yytoken = ]b4_yygetToken_call[;
|
||||||
yyj = yypact[yystackp->yytops.yystates[0]->yylrState];
|
yyj = yypact[yystackp->yytops.yystates[0]->yylrState];
|
||||||
@@ -2368,8 +2393,8 @@ yyrecoverSyntaxError (yyGLRStack* yystackp]b4_user_formals[)
|
|||||||
int yyj = yypact[yys->yylrState];
|
int yyj = yypact[yys->yylrState];
|
||||||
if (! yypact_value_is_default (yyj))
|
if (! yypact_value_is_default (yyj))
|
||||||
{
|
{
|
||||||
yyj += ]b4_symbol(1, kind)[;
|
yyj += ]b4_symbol(error, kind)[;
|
||||||
if (0 <= yyj && yyj <= YYLAST && yycheck[yyj] == ]b4_symbol(1, kind)[
|
if (0 <= yyj && yyj <= YYLAST && yycheck[yyj] == ]b4_symbol(error, kind)[
|
||||||
&& yyisShiftAction (yytable[yyj]))
|
&& yyisShiftAction (yytable[yyj]))
|
||||||
{
|
{
|
||||||
/* Shift the error token. */
|
/* Shift the error token. */
|
||||||
@@ -2397,20 +2422,16 @@ yyrecoverSyntaxError (yyGLRStack* yystackp]b4_user_formals[)
|
|||||||
yyFail (yystackp][]b4_lpure_args[, YY_NULLPTR);
|
yyFail (yystackp][]b4_lpure_args[, YY_NULLPTR);
|
||||||
}
|
}
|
||||||
|
|
||||||
#define YYCHK1(YYE) \
|
#define YYCHK1(YYE) \
|
||||||
do { \
|
do { \
|
||||||
switch (YYE) { \
|
switch (YYE) { \
|
||||||
case yyok: \
|
case yyok: break; \
|
||||||
break; \
|
case yyabort: goto yyabortlab; \
|
||||||
case yyabort: \
|
case yyaccept: goto yyacceptlab; \
|
||||||
goto yyabortlab; \
|
case yyerr: goto yyuser_error; \
|
||||||
case yyaccept: \
|
case yynomem: goto yyexhaustedlab; \
|
||||||
goto yyacceptlab; \
|
default: goto yybuglab; \
|
||||||
case yyerr: \
|
} \
|
||||||
goto yyuser_error; \
|
|
||||||
default: \
|
|
||||||
goto yybuglab; \
|
|
||||||
} \
|
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
/*----------.
|
/*----------.
|
||||||
@@ -2418,7 +2439,7 @@ yyrecoverSyntaxError (yyGLRStack* yystackp]b4_user_formals[)
|
|||||||
`----------*/
|
`----------*/
|
||||||
|
|
||||||
int
|
int
|
||||||
yyparse (]m4_ifset([b4_parse_param], [b4_formals(b4_parse_param)], [void])[)
|
]b4_glr_cc_if([yy_parse_impl], [yyparse])[ (]m4_ifset([b4_parse_param], [b4_formals(b4_parse_param)], [void])[)
|
||||||
{
|
{
|
||||||
int yyresult;
|
int yyresult;
|
||||||
yyGLRStack yystack;
|
yyGLRStack yystack;
|
||||||
@@ -2427,7 +2448,7 @@ yyparse (]m4_ifset([b4_parse_param], [b4_formals(b4_parse_param)], [void])[)
|
|||||||
|
|
||||||
YY_DPRINTF ((stderr, "Starting parse\n"));
|
YY_DPRINTF ((stderr, "Starting parse\n"));
|
||||||
|
|
||||||
yychar = ]b4_symbol(-2, id)[;
|
yychar = ]b4_symbol(empty, id)[;
|
||||||
yylval = yyval_default;]b4_locations_if([
|
yylval = yyval_default;]b4_locations_if([
|
||||||
yylloc = yyloc_default;])[
|
yylloc = yyloc_default;])[
|
||||||
]m4_ifdef([b4_initial_action], [
|
]m4_ifdef([b4_initial_action], [
|
||||||
@@ -2481,7 +2502,7 @@ b4_dollar_popdef])[]dnl
|
|||||||
if (yyisShiftAction (yyaction))
|
if (yyisShiftAction (yyaction))
|
||||||
{
|
{
|
||||||
YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
|
YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
|
||||||
yychar = ]b4_symbol(-2, id)[;
|
yychar = ]b4_symbol(empty, id)[;
|
||||||
yyposn += 1;
|
yyposn += 1;
|
||||||
yyglrShift (&yystack, 0, yyaction, yyposn, &yylval]b4_locations_if([, &yylloc])[);
|
yyglrShift (&yystack, 0, yyaction, yyposn, &yylval]b4_locations_if([, &yylloc])[);
|
||||||
if (0 < yystack.yyerrState)
|
if (0 < yystack.yyerrState)
|
||||||
@@ -2492,7 +2513,7 @@ b4_dollar_popdef])[]dnl
|
|||||||
yystack.yyerror_range[1].yystate.yyloc = yylloc;]])[
|
yystack.yyerror_range[1].yystate.yyloc = yylloc;]])[
|
||||||
/* Issue an error message unless the scanner already
|
/* Issue an error message unless the scanner already
|
||||||
did. */
|
did. */
|
||||||
if (yychar != ]b4_symbol(1, id)[)
|
if (yychar != ]b4_symbol(error, id)[)
|
||||||
yyreportSyntaxError (&yystack]b4_user_args[);
|
yyreportSyntaxError (&yystack]b4_user_args[);
|
||||||
goto yyuser_error;
|
goto yyuser_error;
|
||||||
}
|
}
|
||||||
@@ -2508,7 +2529,7 @@ b4_dollar_popdef])[]dnl
|
|||||||
YYPTRDIFF_T yys;
|
YYPTRDIFF_T yys;
|
||||||
|
|
||||||
for (yys = 0; yys < yystack.yytops.yysize; yys += 1)
|
for (yys = 0; yys < yystack.yytops.yysize; yys += 1)
|
||||||
yystackp->yytops.yylookaheadNeeds[yys] = yychar != ]b4_symbol(-2, id)[;
|
yystackp->yytops.yylookaheadNeeds[yys] = yychar != ]b4_symbol(empty, id)[;
|
||||||
|
|
||||||
/* yyprocessOneStack returns one of three things:
|
/* yyprocessOneStack returns one of three things:
|
||||||
|
|
||||||
@@ -2546,11 +2567,11 @@ b4_dollar_popdef])[]dnl
|
|||||||
|
|
||||||
/* If any yyglrShift call fails, it will fail after shifting. Thus,
|
/* If any yyglrShift call fails, it will fail after shifting. Thus,
|
||||||
a copy of yylval will already be on stack 0 in the event of a
|
a copy of yylval will already be on stack 0 in the event of a
|
||||||
failure in the following loop. Thus, yychar is set to ]b4_symbol(-2, id)[
|
failure in the following loop. Thus, yychar is set to ]b4_symbol(empty, id)[
|
||||||
before the loop to make sure the user destructor for yylval isn't
|
before the loop to make sure the user destructor for yylval isn't
|
||||||
called twice. */
|
called twice. */
|
||||||
yytoken_to_shift = YYTRANSLATE (yychar);
|
yytoken_to_shift = YYTRANSLATE (yychar);
|
||||||
yychar = ]b4_symbol(-2, id)[;
|
yychar = ]b4_symbol(empty, id)[;
|
||||||
yyposn += 1;
|
yyposn += 1;
|
||||||
for (yys = 0; yys < yystack.yytops.yysize; yys += 1)
|
for (yys = 0; yys < yystack.yytops.yysize; yys += 1)
|
||||||
{
|
{
|
||||||
@@ -2563,7 +2584,7 @@ b4_dollar_popdef])[]dnl
|
|||||||
YY_SYMBOL_PRINT ("shifting", yytoken_to_shift, &yylval, &yylloc);
|
YY_SYMBOL_PRINT ("shifting", yytoken_to_shift, &yylval, &yylloc);
|
||||||
yyglrShift (&yystack, yys, yyaction, yyposn,
|
yyglrShift (&yystack, yys, yyaction, yyposn,
|
||||||
&yylval]b4_locations_if([, &yylloc])[);
|
&yylval]b4_locations_if([, &yylloc])[);
|
||||||
YY_DPRINTF ((stderr, "Stack %ld now in state #%d\n",
|
YY_DPRINTF ((stderr, "Stack %ld now in state %d\n",
|
||||||
YY_CAST (long, yys),
|
YY_CAST (long, yys),
|
||||||
yystack.yytops.yystates[yys]->yylrState));
|
yystack.yytops.yystates[yys]->yylrState));
|
||||||
}
|
}
|
||||||
@@ -2584,7 +2605,7 @@ b4_dollar_popdef])[]dnl
|
|||||||
|
|
||||||
yyacceptlab:
|
yyacceptlab:
|
||||||
yyresult = 0;
|
yyresult = 0;
|
||||||
goto yyreturn;
|
goto yyreturnlab;
|
||||||
|
|
||||||
yybuglab:
|
yybuglab:
|
||||||
YY_ASSERT (yyfalse);
|
YY_ASSERT (yyfalse);
|
||||||
@@ -2592,15 +2613,15 @@ b4_dollar_popdef])[]dnl
|
|||||||
|
|
||||||
yyabortlab:
|
yyabortlab:
|
||||||
yyresult = 1;
|
yyresult = 1;
|
||||||
goto yyreturn;
|
goto yyreturnlab;
|
||||||
|
|
||||||
yyexhaustedlab:
|
yyexhaustedlab:
|
||||||
yyerror (]b4_lyyerror_args[YY_("memory exhausted"));
|
yyerror (]b4_lyyerror_args[YY_("memory exhausted"));
|
||||||
yyresult = 2;
|
yyresult = 2;
|
||||||
goto yyreturn;
|
goto yyreturnlab;
|
||||||
|
|
||||||
yyreturn:
|
yyreturnlab:
|
||||||
if (yychar != ]b4_symbol(-2, id)[)
|
if (yychar != ]b4_symbol(empty, id)[)
|
||||||
yydestruct ("Cleanup: discarding lookahead",
|
yydestruct ("Cleanup: discarding lookahead",
|
||||||
YYTRANSLATE (yychar), &yylval]b4_locuser_args([&yylloc])[);
|
YYTRANSLATE (yychar), &yylval]b4_locuser_args([&yylloc])[);
|
||||||
|
|
||||||
@@ -2638,6 +2659,7 @@ b4_dollar_popdef])[]dnl
|
|||||||
|
|
||||||
/* DEBUGGING ONLY */
|
/* DEBUGGING ONLY */
|
||||||
#if ]b4_api_PREFIX[DEBUG
|
#if ]b4_api_PREFIX[DEBUG
|
||||||
|
/* Print *YYS and its predecessors. */
|
||||||
static void
|
static void
|
||||||
yy_yypstack (yyGLRState* yys)
|
yy_yypstack (yyGLRState* yys)
|
||||||
{
|
{
|
||||||
@@ -2649,22 +2671,25 @@ yy_yypstack (yyGLRState* yys)
|
|||||||
YY_FPRINTF ((stderr, "%d@@%ld", yys->yylrState, YY_CAST (long, yys->yyposn)));
|
YY_FPRINTF ((stderr, "%d@@%ld", yys->yylrState, YY_CAST (long, yys->yyposn)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Print YYS (possibly NULL) and its predecessors. */
|
||||||
static void
|
static void
|
||||||
yypstates (yyGLRState* yyst)
|
yypstates (yyGLRState* yys)
|
||||||
{
|
{
|
||||||
if (yyst == YY_NULLPTR)
|
if (yys == YY_NULLPTR)
|
||||||
YY_FPRINTF ((stderr, "<null>"));
|
YY_FPRINTF ((stderr, "<null>"));
|
||||||
else
|
else
|
||||||
yy_yypstack (yyst);
|
yy_yypstack (yys);
|
||||||
YY_FPRINTF ((stderr, "\n"));
|
YY_FPRINTF ((stderr, "\n"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Print the stack #YYK. */
|
||||||
static void
|
static void
|
||||||
yypstack (yyGLRStack* yystackp, YYPTRDIFF_T yyk)
|
yypstack (yyGLRStack* yystackp, YYPTRDIFF_T yyk)
|
||||||
{
|
{
|
||||||
yypstates (yystackp->yytops.yystates[yyk]);
|
yypstates (yystackp->yytops.yystates[yyk]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Print all the stacks. */
|
||||||
static void
|
static void
|
||||||
yypdumpstack (yyGLRStack* yystackp)
|
yypdumpstack (yyGLRStack* yystackp)
|
||||||
{
|
{
|
||||||
@@ -2731,7 +2756,8 @@ m4_if(b4_prefix, [yy], [],
|
|||||||
#define yynerrs ]b4_prefix[nerrs]b4_locations_if([[
|
#define yynerrs ]b4_prefix[nerrs]b4_locations_if([[
|
||||||
#define yylloc ]b4_prefix[lloc]])])[
|
#define yylloc ]b4_prefix[lloc]])])[
|
||||||
|
|
||||||
]m4_ifdef([b4_pre_epilogue], [b4_pre_epilogue])[]dnl This is a hack for glr.cc. To remove when we have a better glr.cc.
|
]b4_glr_cc_if([b4_glr_cc_pre_epilogue
|
||||||
b4_percent_code_get([[epilogue]])[]dnl
|
b4_glr_cc_cleanup])[
|
||||||
|
]b4_percent_code_get([[epilogue]])[]dnl
|
||||||
b4_epilogue[]dnl
|
b4_epilogue[]dnl
|
||||||
b4_output_end
|
b4_output_end
|
||||||
|
|||||||
+86
-73
@@ -1,6 +1,6 @@
|
|||||||
# C++ GLR skeleton for Bison
|
# C++ GLR skeleton for Bison
|
||||||
|
|
||||||
# Copyright (C) 2002-2015, 2018-2020 Free Software Foundation, Inc.
|
# Copyright (C) 2002-2015, 2018-2021 Free Software Foundation, Inc.
|
||||||
|
|
||||||
# This program is free software: you can redistribute it and/or modify
|
# This program is free software: you can redistribute it and/or modify
|
||||||
# it under the terms of the GNU General Public License as published by
|
# it under the terms of the GNU General Public License as published by
|
||||||
@@ -13,7 +13,7 @@
|
|||||||
# GNU General Public License for more details.
|
# GNU General Public License for more details.
|
||||||
#
|
#
|
||||||
# You should have received a copy of the GNU General Public License
|
# You should have received a copy of the GNU General Public License
|
||||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
|
||||||
# This skeleton produces a C++ class that encapsulates a C glr parser.
|
# This skeleton produces a C++ class that encapsulates a C glr parser.
|
||||||
@@ -66,12 +66,6 @@ m4_defn([b4_parse_param]))],
|
|||||||
[[b4_namespace_ref::b4_parser_class[& yyparser], [[yyparser]]]])
|
[[b4_namespace_ref::b4_parser_class[& yyparser], [[yyparser]]]])
|
||||||
])
|
])
|
||||||
|
|
||||||
# b4_declare_symbol_enum
|
|
||||||
# ----------------------
|
|
||||||
m4_append([b4_declare_symbol_enum],
|
|
||||||
[[typedef symbol_kind_type yysymbol_kind_t;
|
|
||||||
]])
|
|
||||||
|
|
||||||
|
|
||||||
# b4_yy_symbol_print_define
|
# b4_yy_symbol_print_define
|
||||||
# -------------------------
|
# -------------------------
|
||||||
@@ -84,7 +78,7 @@ m4_define([b4_yy_symbol_print_define],
|
|||||||
|
|
||||||
static void
|
static void
|
||||||
yy_symbol_print (FILE *, ]b4_namespace_ref::b4_parser_class[::symbol_kind_type yytoken,
|
yy_symbol_print (FILE *, ]b4_namespace_ref::b4_parser_class[::symbol_kind_type yytoken,
|
||||||
const ]b4_namespace_ref::b4_parser_class[::semantic_type *yyvaluep]b4_locations_if([[,
|
const ]b4_namespace_ref::b4_parser_class[::value_type *yyvaluep]b4_locations_if([[,
|
||||||
const ]b4_namespace_ref::b4_parser_class[::location_type *yylocationp]])[]b4_user_formals[)
|
const ]b4_namespace_ref::b4_parser_class[::location_type *yylocationp]])[]b4_user_formals[)
|
||||||
{
|
{
|
||||||
]b4_parse_param_use[]dnl
|
]b4_parse_param_use[]dnl
|
||||||
@@ -105,15 +99,9 @@ yyerror (]b4_locations_if([[const ]b4_namespace_ref::b4_parser_class[::location_
|
|||||||
]])[]m4_ifset([b4_parse_param], [b4_formals(b4_parse_param),
|
]])[]m4_ifset([b4_parse_param], [b4_formals(b4_parse_param),
|
||||||
])[const char* msg);]])[
|
])[const char* msg);]])[
|
||||||
|
|
||||||
]b4_percent_define_flag_if([[global_tokens_and_yystype]], [],
|
# Inserted before the epilogue to define implementations (yyerror, parser member
|
||||||
[m4_define([b4_pre_epilogue],
|
|
||||||
[[/* The user is using the C++ token kind, not the C one. */
|
|
||||||
#undef ]b4_symbol(0, [id])
|
|
||||||
])])[
|
|
||||||
|
|
||||||
# Hijack the epilogue to define implementations (yyerror, parser member
|
|
||||||
# functions etc.).
|
# functions etc.).
|
||||||
]m4_append([b4_epilogue],
|
]m4_define([b4_glr_cc_pre_epilogue],
|
||||||
[b4_syncline([@oline@], [@ofile@])dnl
|
[b4_syncline([@oline@], [@ofile@])dnl
|
||||||
[
|
[
|
||||||
/*------------------.
|
/*------------------.
|
||||||
@@ -156,7 +144,7 @@ m4_pushdef([b4_parse_param], m4_defn([b4_parse_param_orig]))dnl
|
|||||||
int
|
int
|
||||||
]b4_parser_class[::parse ()
|
]b4_parser_class[::parse ()
|
||||||
{
|
{
|
||||||
return ::yyparse (*this]b4_user_args[);
|
return ::yy_parse_impl (*this]b4_user_args[);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if ]b4_api_PREFIX[DEBUG
|
#if ]b4_api_PREFIX[DEBUG
|
||||||
@@ -166,25 +154,25 @@ m4_pushdef([b4_parse_param], m4_defn([b4_parse_param_orig]))dnl
|
|||||||
|
|
||||||
void
|
void
|
||||||
]b4_parser_class[::yy_symbol_value_print_ (symbol_kind_type yykind,
|
]b4_parser_class[::yy_symbol_value_print_ (symbol_kind_type yykind,
|
||||||
const semantic_type* yyvaluep]b4_locations_if([[,
|
const value_type* yyvaluep]b4_locations_if([[,
|
||||||
const location_type* yylocationp]])[) const
|
const location_type* yylocationp]])[) const
|
||||||
{]b4_locations_if([[
|
{]b4_locations_if([[
|
||||||
YYUSE (yylocationp);]])[
|
YY_USE (yylocationp);]])[
|
||||||
YYUSE (yyvaluep);
|
YY_USE (yyvaluep);
|
||||||
std::ostream& yyo = debug_stream ();
|
std::ostream& yyo = debug_stream ();
|
||||||
std::ostream& yyoutput = yyo;
|
std::ostream& yyoutput = yyo;
|
||||||
YYUSE (yyoutput);
|
YY_USE (yyoutput);
|
||||||
]b4_symbol_actions([printer])[
|
]b4_symbol_actions([printer])[
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
]b4_parser_class[::yy_symbol_print_ (symbol_kind_type yykind,
|
]b4_parser_class[::yy_symbol_print_ (symbol_kind_type yykind,
|
||||||
const semantic_type* yyvaluep]b4_locations_if([[,
|
const value_type* yyvaluep]b4_locations_if([[,
|
||||||
const location_type* yylocationp]])[) const
|
const location_type* yylocationp]])[) const
|
||||||
{
|
{
|
||||||
*yycdebug_ << (yykind < YYNTOKENS ? "token" : "nterm")
|
*yycdebug_ << (yykind < YYNTOKENS ? "token" : "nterm")
|
||||||
<< ' ' << yytname[yykind] << " ("]b4_locations_if([[
|
<< ' ' << yysymbol_name (yykind) << " ("]b4_locations_if([[
|
||||||
<< *yylocationp << ": "]])[;
|
<< *yylocationp << ": "]])[;
|
||||||
yy_symbol_value_print_ (yykind, yyvaluep]b4_locations_if([[, yylocationp]])[);
|
yy_symbol_value_print_ (yykind, yyvaluep]b4_locations_if([[, yylocationp]])[);
|
||||||
*yycdebug_ << ')';
|
*yycdebug_ << ')';
|
||||||
@@ -222,23 +210,18 @@ b4_namespace_close[]dnl
|
|||||||
])
|
])
|
||||||
|
|
||||||
|
|
||||||
# b4_shared_declarations(hh|cc)
|
m4_define([b4_define_symbol_kind],
|
||||||
# -----------------------------
|
[m4_format([#define %-15s %s],
|
||||||
# Declaration that might either go into the header (if --defines, $1 = hh)
|
b4_symbol($][1, kind_base),
|
||||||
# or in the implementation file.
|
b4_namespace_ref[::]b4_parser_class[::symbol_kind::]b4_symbol($1, kind_base))
|
||||||
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>
|
|
||||||
|
|
||||||
]b4_cxx_portability[
|
# b4_glr_cc_setup
|
||||||
]m4_ifdef([b4_location_include],
|
# ---------------
|
||||||
[[# include ]b4_location_include])[
|
# Setup redirections for glr.c: Map the names used in c.m4 to the ones used
|
||||||
]b4_variant_if([b4_variant_includes])[
|
# in c++.m4.
|
||||||
|
m4_define([b4_glr_cc_setup],
|
||||||
]b4_attribute_define[
|
[[]b4_attribute_define[
|
||||||
]b4_null_define[
|
]b4_null_define[
|
||||||
|
|
||||||
// This skeleton is based on C, yet compiles it as C++.
|
// This skeleton is based on C, yet compiles it as C++.
|
||||||
@@ -256,6 +239,62 @@ b4_percent_code_get([[requires]])[
|
|||||||
# pragma clang diagnostic ignored "-Wc++11-long-long"
|
# pragma clang diagnostic ignored "-Wc++11-long-long"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#undef ]b4_symbol(empty, [id])[
|
||||||
|
#define ]b4_symbol(empty, [id])[ ]b4_namespace_ref[::]b4_parser_class[::token::]b4_symbol(empty, [id])[
|
||||||
|
#undef ]b4_symbol(eof, [id])[
|
||||||
|
#define ]b4_symbol(eof, [id])[ ]b4_namespace_ref[::]b4_parser_class[::token::]b4_symbol(eof, [id])[
|
||||||
|
#undef ]b4_symbol(error, [id])[
|
||||||
|
#define ]b4_symbol(error, [id])[ ]b4_namespace_ref[::]b4_parser_class[::token::]b4_symbol(error, [id])[
|
||||||
|
|
||||||
|
#ifndef ]b4_api_PREFIX[STYPE
|
||||||
|
# define ]b4_api_PREFIX[STYPE ]b4_namespace_ref[::]b4_parser_class[::value_type
|
||||||
|
#endif
|
||||||
|
#ifndef ]b4_api_PREFIX[LTYPE
|
||||||
|
# define ]b4_api_PREFIX[LTYPE ]b4_namespace_ref[::]b4_parser_class[::location_type
|
||||||
|
#endif
|
||||||
|
|
||||||
|
typedef ]b4_namespace_ref[::]b4_parser_class[::symbol_kind_type yysymbol_kind_t;
|
||||||
|
|
||||||
|
// Expose C++ symbol kinds to C.
|
||||||
|
]b4_define_symbol_kind(-2)dnl
|
||||||
|
b4_symbol_foreach([b4_define_symbol_kind])])[
|
||||||
|
]])
|
||||||
|
|
||||||
|
|
||||||
|
m4_define([b4_undef_symbol_kind],
|
||||||
|
[[#undef ]b4_symbol($1, kind_base)[
|
||||||
|
]])
|
||||||
|
|
||||||
|
|
||||||
|
# b4_glr_cc_cleanup
|
||||||
|
# -----------------
|
||||||
|
# Remove redirections for glr.c.
|
||||||
|
m4_define([b4_glr_cc_cleanup],
|
||||||
|
[[#undef ]b4_symbol(empty, [id])[
|
||||||
|
#undef ]b4_symbol(eof, [id])[
|
||||||
|
#undef ]b4_symbol(error, [id])[
|
||||||
|
|
||||||
|
]b4_undef_symbol_kind(-2)dnl
|
||||||
|
b4_symbol_foreach([b4_undef_symbol_kind])dnl
|
||||||
|
])
|
||||||
|
|
||||||
|
|
||||||
|
# b4_shared_declarations(hh|cc)
|
||||||
|
# -----------------------------
|
||||||
|
# Declaration that might either go into the header (if --header, $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>
|
||||||
|
|
||||||
|
]b4_cxx_portability[
|
||||||
|
]m4_ifdef([b4_location_include],
|
||||||
|
[[# include ]b4_location_include])[
|
||||||
|
]b4_variant_if([b4_variant_includes])[
|
||||||
|
|
||||||
// Whether we are compiled with exception support.
|
// Whether we are compiled with exception support.
|
||||||
#ifndef YY_EXCEPTIONS
|
#ifndef YY_EXCEPTIONS
|
||||||
# if defined __GNUC__ && !defined __EXCEPTIONS
|
# if defined __GNUC__ && !defined __EXCEPTIONS
|
||||||
@@ -316,14 +355,14 @@ b4_percent_code_get([[requires]])[
|
|||||||
/// \param yyvaluep Its semantic value.]b4_locations_if([[
|
/// \param yyvaluep Its semantic value.]b4_locations_if([[
|
||||||
/// \param yylocationp Its location.]])[
|
/// \param yylocationp Its location.]])[
|
||||||
virtual void yy_symbol_value_print_ (symbol_kind_type yykind,
|
virtual void yy_symbol_value_print_ (symbol_kind_type yykind,
|
||||||
const semantic_type* yyvaluep]b4_locations_if([[,
|
const value_type* yyvaluep]b4_locations_if([[,
|
||||||
const location_type* yylocationp]])[) const;
|
const location_type* yylocationp]])[) const;
|
||||||
/// \brief Report a symbol on the debug stream.
|
/// \brief Report a symbol on the debug stream.
|
||||||
/// \param yykind The symbol kind.
|
/// \param yykind The symbol kind.
|
||||||
/// \param yyvaluep Its semantic value.]b4_locations_if([[
|
/// \param yyvaluep Its semantic value.]b4_locations_if([[
|
||||||
/// \param yylocationp Its location.]])[
|
/// \param yylocationp Its location.]])[
|
||||||
virtual void yy_symbol_print_ (symbol_kind_type yykind,
|
virtual void yy_symbol_print_ (symbol_kind_type yykind,
|
||||||
const semantic_type* yyvaluep]b4_locations_if([[,
|
const value_type* yyvaluep]b4_locations_if([[,
|
||||||
const location_type* yylocationp]])[) const;
|
const location_type* yylocationp]])[) const;
|
||||||
private:
|
private:
|
||||||
/// Debug stream.
|
/// Debug stream.
|
||||||
@@ -333,48 +372,22 @@ b4_percent_code_get([[requires]])[
|
|||||||
]b4_parse_param_vars[
|
]b4_parse_param_vars[
|
||||||
};
|
};
|
||||||
|
|
||||||
]dnl Redirections for glr.c.
|
|
||||||
b4_percent_define_flag_if([[global_tokens_and_yystype]],
|
|
||||||
[b4_token_defines
|
|
||||||
])[
|
|
||||||
]b4_namespace_close[
|
]b4_namespace_close[
|
||||||
|
|
||||||
]dnl Map the name used in c.m4 to the one used in c++.m4.
|
|
||||||
[#undef ]b4_symbol(-2, [id])[
|
|
||||||
#define ]b4_symbol(-2, [id])[ ]b4_namespace_ref[::]b4_parser_class[::token::]b4_symbol(-2, [id])[
|
|
||||||
#undef ]b4_symbol(0, [id])[
|
|
||||||
#define ]b4_symbol(0, [id])[ ]b4_namespace_ref[::]b4_parser_class[::token::]b4_symbol(0, [id])[
|
|
||||||
#undef ]b4_symbol(1, [id])[
|
|
||||||
#define ]b4_symbol(1, [id])[ ]b4_namespace_ref[::]b4_parser_class[::token::]b4_symbol(1, [id])[
|
|
||||||
|
|
||||||
#ifndef ]b4_api_PREFIX[STYPE
|
|
||||||
# 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[::location_type
|
|
||||||
#endif
|
|
||||||
|
|
||||||
]m4_define([b4_declare_symbol_enum],
|
|
||||||
[[typedef ]b4_namespace_ref[::]b4_parser_class[::symbol_kind_type yysymbol_kind_t;
|
|
||||||
#define ]b4_symbol_prefix[YYEMPTY ]b4_namespace_ref[::]b4_parser_class[::symbol_kind::]b4_symbol_prefix[YYEMPTY
|
|
||||||
#define ]b4_symbol_prefix[YYerror ]b4_namespace_ref[::]b4_parser_class[::symbol_kind::]b4_symbol_prefix[YYerror
|
|
||||||
#define ]b4_symbol_prefix[YYEOF ]b4_namespace_ref[::]b4_parser_class[::symbol_kind::]b4_symbol_prefix[YYEOF
|
|
||||||
#define ]b4_symbol_prefix[YYUNDEF ]b4_namespace_ref[::]b4_parser_class[::symbol_kind::]b4_symbol_prefix[YYUNDEF
|
|
||||||
]])[
|
|
||||||
]b4_percent_code_get([[provides]])[
|
]b4_percent_code_get([[provides]])[
|
||||||
]m4_popdef([b4_parse_param])dnl
|
]m4_popdef([b4_parse_param])dnl
|
||||||
])
|
])[
|
||||||
|
|
||||||
b4_defines_if(
|
]b4_header_if(
|
||||||
[b4_output_begin([b4_spec_header_file])
|
[b4_output_begin([b4_spec_header_file])
|
||||||
b4_copyright([Skeleton interface for Bison GLR parsers in C++],
|
b4_copyright([Skeleton interface for Bison GLR parsers in C++],
|
||||||
[2002-2015, 2018-2020])[
|
[2002-2015, 2018-2021])[
|
||||||
// C++ GLR parser skeleton written by Akim Demaille.
|
// C++ GLR parser skeleton written by Akim Demaille.
|
||||||
|
|
||||||
]b4_disclaimer[
|
]b4_disclaimer[
|
||||||
]b4_cpp_guard_open([b4_spec_header_file])[
|
]b4_cpp_guard_open([b4_spec_mapped_header_file])[
|
||||||
]b4_shared_declarations[
|
]b4_shared_declarations[
|
||||||
]b4_cpp_guard_close([b4_spec_header_file])[
|
]b4_cpp_guard_close([b4_spec_mapped_header_file])[
|
||||||
]b4_output_end])
|
]b4_output_end])
|
||||||
|
|
||||||
# Let glr.c (and b4_shared_declarations) believe that the user
|
# Let glr.c (and b4_shared_declarations) believe that the user
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
# Java skeleton dispatching for Bison.
|
# Java skeleton dispatching for Bison.
|
||||||
|
|
||||||
# Copyright (C) 2007, 2009-2015, 2018-2020 Free Software Foundation,
|
# Copyright (C) 2007, 2009-2015, 2018-2021 Free Software Foundation,
|
||||||
# Inc.
|
# Inc.
|
||||||
|
|
||||||
# This program is free software: you can redistribute it and/or modify
|
# This program is free software: you can redistribute it and/or modify
|
||||||
@@ -16,7 +16,7 @@
|
|||||||
# GNU General Public License for more details.
|
# GNU General Public License for more details.
|
||||||
#
|
#
|
||||||
# You should have received a copy of the GNU General Public License
|
# You should have received a copy of the GNU General Public License
|
||||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
b4_glr_if( [b4_complain([%%glr-parser not supported for Java])])
|
b4_glr_if( [b4_complain([%%glr-parser not supported for Java])])
|
||||||
b4_nondeterministic_if([b4_complain([%%nondeterministic-parser not supported for Java])])
|
b4_nondeterministic_if([b4_complain([%%nondeterministic-parser not supported for Java])])
|
||||||
|
|||||||
+18
-11
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
# Java language support for Bison
|
# Java language support for Bison
|
||||||
|
|
||||||
# Copyright (C) 2007-2015, 2018-2020 Free Software Foundation, Inc.
|
# Copyright (C) 2007-2015, 2018-2021 Free Software Foundation, Inc.
|
||||||
|
|
||||||
# This program is free software: you can redistribute it and/or modify
|
# This program is free software: you can redistribute it and/or modify
|
||||||
# it under the terms of the GNU General Public License as published by
|
# it under the terms of the GNU General Public License as published by
|
||||||
@@ -15,7 +15,7 @@
|
|||||||
# GNU General Public License for more details.
|
# GNU General Public License for more details.
|
||||||
#
|
#
|
||||||
# You should have received a copy of the GNU General Public License
|
# You should have received a copy of the GNU General Public License
|
||||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
m4_include(b4_skeletonsdir/[c-like.m4])
|
m4_include(b4_skeletonsdir/[c-like.m4])
|
||||||
|
|
||||||
@@ -71,12 +71,12 @@ m4_define([b4_lexer_if],
|
|||||||
# b4_identification
|
# b4_identification
|
||||||
# -----------------
|
# -----------------
|
||||||
m4_define([b4_identification],
|
m4_define([b4_identification],
|
||||||
[ /** Version number for the Bison executable that generated this parser. */
|
[[ /** Version number for the Bison executable that generated this parser. */
|
||||||
public static final String bisonVersion = "b4_version";
|
public static final String bisonVersion = "]b4_version_string[";
|
||||||
|
|
||||||
/** Name of the skeleton that generated this parser. */
|
/** Name of the skeleton that generated this parser. */
|
||||||
public static final String bisonSkeleton = b4_skeleton;
|
public static final String bisonSkeleton = ]b4_skeleton[;
|
||||||
])
|
]])
|
||||||
|
|
||||||
|
|
||||||
## ------------ ##
|
## ------------ ##
|
||||||
@@ -143,7 +143,7 @@ m4_define([b4_token_enum],
|
|||||||
]],
|
]],
|
||||||
b4_symbol([$1], [tag]),
|
b4_symbol([$1], [tag]),
|
||||||
b4_symbol([$1], [id]),
|
b4_symbol([$1], [id]),
|
||||||
b4_symbol([$1], b4_api_token_raw_if([[number]], [[user_number]])))])])
|
b4_symbol([$1], b4_api_token_raw_if([[number]], [[code]])))])])
|
||||||
|
|
||||||
|
|
||||||
# b4_token_enums
|
# b4_token_enums
|
||||||
@@ -159,13 +159,20 @@ b4_symbol_foreach([b4_token_enum])])])
|
|||||||
## Symbol kinds. ##
|
## Symbol kinds. ##
|
||||||
## -------------- ##
|
## -------------- ##
|
||||||
|
|
||||||
|
|
||||||
|
# b4_symbol_kind(NUM)
|
||||||
|
# -------------------
|
||||||
|
m4_define([b4_symbol_kind],
|
||||||
|
[SymbolKind.b4_symbol_kind_base($@)])
|
||||||
|
|
||||||
|
|
||||||
# b4_symbol_enum(SYMBOL-NUM)
|
# b4_symbol_enum(SYMBOL-NUM)
|
||||||
# --------------------------
|
# --------------------------
|
||||||
# Output the definition of this symbol as an enum.
|
# Output the definition of this symbol as an enum.
|
||||||
m4_define([b4_symbol_enum],
|
m4_define([b4_symbol_enum],
|
||||||
[m4_format([ %-30s %s],
|
[m4_format([ %-30s %s],
|
||||||
m4_format([[%s(%s)%s]],
|
m4_format([[%s(%s)%s]],
|
||||||
b4_symbol([$1], [kind]),
|
b4_symbol([$1], [kind_base]),
|
||||||
[$1],
|
[$1],
|
||||||
m4_if([$1], b4_last_symbol, [[;]], [[,]])),
|
m4_if([$1], b4_last_symbol, [[;]], [[,]])),
|
||||||
[b4_symbol_tag_comment([$1])])])
|
[b4_symbol_tag_comment([$1])])])
|
||||||
@@ -255,11 +262,11 @@ m4_define([b4_declare_symbol_enum],
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
# b4_case(ID, CODE)
|
# b4_case(ID, CODE, [COMMENTS])
|
||||||
# -----------------
|
# -----------------------------
|
||||||
# We need to fool Java's stupid unreachable code detection.
|
# We need to fool Java's stupid unreachable code detection.
|
||||||
m4_define([b4_case],
|
m4_define([b4_case],
|
||||||
[ case $1:
|
[ case $1:m4_ifval([$3], [ b4_comment([$3])])
|
||||||
if (yyn == $1)
|
if (yyn == $1)
|
||||||
$2;
|
$2;
|
||||||
break;
|
break;
|
||||||
|
|||||||
+79
-68
@@ -1,6 +1,6 @@
|
|||||||
# C++ skeleton for Bison
|
# C++ skeleton for Bison
|
||||||
|
|
||||||
# Copyright (C) 2002-2015, 2018-2020 Free Software Foundation, Inc.
|
# Copyright (C) 2002-2015, 2018-2021 Free Software Foundation, Inc.
|
||||||
|
|
||||||
# This program is free software: you can redistribute it and/or modify
|
# This program is free software: you can redistribute it and/or modify
|
||||||
# it under the terms of the GNU General Public License as published by
|
# it under the terms of the GNU General Public License as published by
|
||||||
@@ -13,15 +13,14 @@
|
|||||||
# GNU General Public License for more details.
|
# GNU General Public License for more details.
|
||||||
#
|
#
|
||||||
# You should have received a copy of the GNU General Public License
|
# You should have received a copy of the GNU General Public License
|
||||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
m4_include(b4_skeletonsdir/[c++.m4])
|
m4_include(b4_skeletonsdir/[c++.m4])
|
||||||
|
|
||||||
# api.value.type=variant is valid.
|
# api.value.type=variant is valid.
|
||||||
m4_define([b4_value_type_setup_variant])
|
m4_define([b4_value_type_setup_variant])
|
||||||
|
|
||||||
# Check the value of %define parse.lac, where LAC stands for lookahead
|
# parse.lac
|
||||||
# correction.
|
|
||||||
b4_percent_define_default([[parse.lac]], [[none]])
|
b4_percent_define_default([[parse.lac]], [[none]])
|
||||||
b4_percent_define_check_values([[[[parse.lac]], [[full]], [[none]]]])
|
b4_percent_define_check_values([[[[parse.lac]], [[full]], [[none]]]])
|
||||||
b4_define_flag_if([lac])
|
b4_define_flag_if([lac])
|
||||||
@@ -59,6 +58,13 @@ m4_define([b4_integral_parser_table_define],
|
|||||||
};dnl
|
};dnl
|
||||||
])
|
])
|
||||||
|
|
||||||
|
|
||||||
|
# b4_symbol_kind(NUM)
|
||||||
|
# -------------------
|
||||||
|
m4_define([b4_symbol_kind],
|
||||||
|
[symbol_kind::b4_symbol_kind_base($@)])
|
||||||
|
|
||||||
|
|
||||||
# b4_symbol_value_template(VAL, SYMBOL-NUM, [TYPE])
|
# b4_symbol_value_template(VAL, SYMBOL-NUM, [TYPE])
|
||||||
# -------------------------------------------------
|
# -------------------------------------------------
|
||||||
# Same as b4_symbol_value, but used in a template method. It makes
|
# Same as b4_symbol_value, but used in a template method. It makes
|
||||||
@@ -139,21 +145,21 @@ b4_dollar_popdef[]dnl
|
|||||||
])])
|
])])
|
||||||
|
|
||||||
|
|
||||||
# b4_lex
|
# b4_yylex
|
||||||
# ------
|
# --------
|
||||||
# Call yylex.
|
# Call yylex.
|
||||||
m4_define([b4_lex],
|
m4_define([b4_yylex],
|
||||||
[b4_token_ctor_if(
|
[b4_token_ctor_if(
|
||||||
[b4_function_call([yylex],
|
[b4_function_call([yylex],
|
||||||
[symbol_type], m4_ifdef([b4_lex_param], b4_lex_param))],
|
[symbol_type], m4_ifdef([b4_lex_param], b4_lex_param))],
|
||||||
[b4_function_call([yylex], [int],
|
[b4_function_call([yylex], [int],
|
||||||
[b4_api_PREFIX[STYPE*], [&yyla.value]][]dnl
|
[[value_type *], [&yyla.value]][]dnl
|
||||||
b4_locations_if([, [[location*], [&yyla.location]]])dnl
|
b4_locations_if([, [[location_type *], [&yyla.location]]])dnl
|
||||||
m4_ifdef([b4_lex_param], [, ]b4_lex_param))])])
|
m4_ifdef([b4_lex_param], [, ]b4_lex_param))])])
|
||||||
|
|
||||||
|
|
||||||
m4_pushdef([b4_copyright_years],
|
m4_pushdef([b4_copyright_years],
|
||||||
[2002-2015, 2018-2020])
|
[2002-2015, 2018-2021])
|
||||||
|
|
||||||
m4_define([b4_parser_class],
|
m4_define([b4_parser_class],
|
||||||
[b4_percent_define_get([[api.parser.class]])])
|
[b4_percent_define_get([[api.parser.class]])])
|
||||||
@@ -167,7 +173,7 @@ b4_variant_if([m4_include(b4_skeletonsdir/[variant.hh])])
|
|||||||
|
|
||||||
# b4_shared_declarations(hh|cc)
|
# b4_shared_declarations(hh|cc)
|
||||||
# -----------------------------
|
# -----------------------------
|
||||||
# Declaration that might either go into the header (if --defines, $1 = hh)
|
# Declaration that might either go into the header (if --header, $1 = hh)
|
||||||
# or in the implementation file.
|
# or in the implementation file.
|
||||||
m4_define([b4_shared_declarations],
|
m4_define([b4_shared_declarations],
|
||||||
[b4_percent_code_get([[requires]])[
|
[b4_percent_code_get([[requires]])[
|
||||||
@@ -264,9 +270,9 @@ m4_define([b4_shared_declarations],
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
context (const ]b4_parser_class[& yyparser, const symbol_type& yyla);
|
context (const ]b4_parser_class[& yyparser, const symbol_type& yyla);
|
||||||
const symbol_type& lookahead () const { return yyla_; }
|
const symbol_type& lookahead () const YY_NOEXCEPT { return yyla_; }
|
||||||
symbol_kind_type token () const { return yyla_.kind (); }]b4_locations_if([[
|
symbol_kind_type token () const YY_NOEXCEPT { return yyla_.kind (); }]b4_locations_if([[
|
||||||
const location_type& location () const { return yyla_.location; }
|
const location_type& location () const YY_NOEXCEPT { return yyla_.location; }
|
||||||
]])[
|
]])[
|
||||||
/// Put in YYARG at most YYARGN of the expected tokens, and return the
|
/// Put in YYARG at most YYARGN of the expected tokens, and return the
|
||||||
/// number of tokens stored in YYARG. If YYARG is null, return the
|
/// number of tokens stored in YYARG. If YYARG is null, return the
|
||||||
@@ -300,11 +306,11 @@ m4_define([b4_shared_declarations],
|
|||||||
/// Stored state numbers (used for stacks).
|
/// Stored state numbers (used for stacks).
|
||||||
typedef ]b4_int_type(0, m4_eval(b4_states_number - 1))[ state_type;
|
typedef ]b4_int_type(0, m4_eval(b4_states_number - 1))[ state_type;
|
||||||
]b4_parse_error_bmatch(
|
]b4_parse_error_bmatch(
|
||||||
[custom], [[
|
[custom], [[
|
||||||
/// Report a syntax error
|
/// Report a syntax error
|
||||||
/// \param yyctx the context in which the error occurred.
|
/// \param yyctx the context in which the error occurred.
|
||||||
void report_syntax_error (const context& yyctx) const;]],
|
void report_syntax_error (const context& yyctx) const;]],
|
||||||
[detailed\|verbose], [[
|
[detailed\|verbose], [[
|
||||||
/// The arguments of the error message.
|
/// The arguments of the error message.
|
||||||
int yy_syntax_error_arguments_ (const context& yyctx,
|
int yy_syntax_error_arguments_ (const context& yyctx,
|
||||||
symbol_kind_type yyarg[], int yyargn) const;
|
symbol_kind_type yyarg[], int yyargn) const;
|
||||||
@@ -401,7 +407,7 @@ m4_define([b4_shared_declarations],
|
|||||||
void move (by_state& that);
|
void move (by_state& that);
|
||||||
|
|
||||||
/// The symbol kind (corresponding to \a state).
|
/// The symbol kind (corresponding to \a state).
|
||||||
/// \a ]b4_symbol(-2, kind)[ when empty.
|
/// \a ]b4_symbol(empty, kind)[ when empty.
|
||||||
symbol_kind_type kind () const YY_NOEXCEPT;
|
symbol_kind_type kind () const YY_NOEXCEPT;
|
||||||
|
|
||||||
/// The state number used to denote an empty symbol.
|
/// The state number used to denote an empty symbol.
|
||||||
@@ -486,41 +492,42 @@ m4_define([b4_shared_declarations],
|
|||||||
]b4_public_types_define([$1])])[
|
]b4_public_types_define([$1])])[
|
||||||
]b4_namespace_close[
|
]b4_namespace_close[
|
||||||
|
|
||||||
]b4_percent_define_flag_if([[global_tokens_and_yystype]],
|
|
||||||
[b4_token_defines
|
|
||||||
|
|
||||||
#ifndef ]b4_api_PREFIX[STYPE
|
|
||||||
// Redirection for backward compatibility.
|
|
||||||
# define ]b4_api_PREFIX[STYPE b4_namespace_ref::b4_parser_class::semantic_type
|
|
||||||
#endif
|
|
||||||
])[
|
|
||||||
]b4_percent_code_get([[provides]])[
|
]b4_percent_code_get([[provides]])[
|
||||||
]])
|
]])[
|
||||||
|
|
||||||
|
|
||||||
## -------------- ##
|
## -------------- ##
|
||||||
## Output files. ##
|
## Output files. ##
|
||||||
## -------------- ##
|
## -------------- ##
|
||||||
|
|
||||||
b4_defines_if(
|
# ------------- #
|
||||||
[b4_output_begin([b4_spec_header_file])
|
# Header file. #
|
||||||
b4_copyright([Skeleton interface for Bison LALR(1) parsers in C++])
|
# ------------- #
|
||||||
[
|
|
||||||
|
]b4_header_if([[
|
||||||
|
]b4_output_begin([b4_spec_header_file])[
|
||||||
|
]b4_copyright([Skeleton interface for Bison LALR(1) parsers in C++])[
|
||||||
|
|
||||||
/**
|
/**
|
||||||
** \file ]b4_spec_header_file[
|
** \file ]b4_spec_mapped_header_file[
|
||||||
** Define the ]b4_namespace_ref[::parser class.
|
** Define the ]b4_namespace_ref[::parser class.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// C++ LALR(1) parser skeleton written by Akim Demaille.
|
// C++ LALR(1) parser skeleton written by Akim Demaille.
|
||||||
|
|
||||||
]b4_disclaimer[
|
]b4_disclaimer[
|
||||||
]b4_cpp_guard_open([b4_spec_header_file])[
|
]b4_cpp_guard_open([b4_spec_mapped_header_file])[
|
||||||
]b4_shared_declarations(hh)[
|
]b4_shared_declarations(hh)[
|
||||||
]b4_cpp_guard_close([b4_spec_header_file])[
|
]b4_cpp_guard_close([b4_spec_mapped_header_file])[
|
||||||
]b4_output_end[
|
]b4_output_end[
|
||||||
]])
|
]])[
|
||||||
|
|
||||||
|
|
||||||
b4_output_begin([b4_parser_file_name])[
|
# --------------------- #
|
||||||
|
# Implementation file. #
|
||||||
|
# --------------------- #
|
||||||
|
|
||||||
|
]b4_output_begin([b4_parser_file_name])[
|
||||||
]b4_copyright([Skeleton implementation for Bison LALR(1) parsers in C++])[
|
]b4_copyright([Skeleton implementation for Bison LALR(1) parsers in C++])[
|
||||||
]b4_disclaimer[
|
]b4_disclaimer[
|
||||||
]b4_percent_code_get([[top]])[]dnl
|
]b4_percent_code_get([[top]])[]dnl
|
||||||
@@ -531,7 +538,7 @@ m4_if(b4_prefix, [yy], [],
|
|||||||
|
|
||||||
]b4_user_pre_prologue[
|
]b4_user_pre_prologue[
|
||||||
|
|
||||||
]b4_defines_if([[#include "@basename(]b4_spec_header_file[@)"]],
|
]b4_header_if([[#include "@basename(]b4_spec_header_file[@)"]],
|
||||||
[b4_shared_declarations([cc])])[
|
[b4_shared_declarations([cc])])[
|
||||||
|
|
||||||
]b4_user_post_prologue[
|
]b4_user_post_prologue[
|
||||||
@@ -598,7 +605,7 @@ m4_if(b4_prefix, [yy], [],
|
|||||||
#else // !]b4_api_PREFIX[DEBUG
|
#else // !]b4_api_PREFIX[DEBUG
|
||||||
|
|
||||||
# define YYCDEBUG if (false) std::cerr
|
# define YYCDEBUG if (false) std::cerr
|
||||||
# define YY_SYMBOL_PRINT(Title, Symbol) YYUSE (Symbol)
|
# define YY_SYMBOL_PRINT(Title, Symbol) YY_USE (Symbol)
|
||||||
# define YY_REDUCE_PRINT(Rule) static_cast<void> (0)
|
# define YY_REDUCE_PRINT(Rule) static_cast<void> (0)
|
||||||
# define YY_STACK_PRINT() static_cast<void> (0)
|
# define YY_STACK_PRINT() static_cast<void> (0)
|
||||||
|
|
||||||
@@ -666,7 +673,7 @@ m4_if(b4_prefix, [yy], [],
|
|||||||
]b4_parser_class[::by_state::kind () const YY_NOEXCEPT
|
]b4_parser_class[::by_state::kind () const YY_NOEXCEPT
|
||||||
{
|
{
|
||||||
if (state == empty_state)
|
if (state == empty_state)
|
||||||
return symbol_kind::]b4_symbol(-2, kind)[;
|
return ]b4_symbol(empty, kind)[;
|
||||||
else
|
else
|
||||||
return YY_CAST (symbol_kind_type, yystos_[+state]);
|
return YY_CAST (symbol_kind_type, yystos_[+state]);
|
||||||
}
|
}
|
||||||
@@ -691,7 +698,7 @@ m4_if(b4_prefix, [yy], [],
|
|||||||
b4_symbol_variant([that.kind ()],
|
b4_symbol_variant([that.kind ()],
|
||||||
[value], [move], [YY_MOVE (that.value)])])[
|
[value], [move], [YY_MOVE (that.value)])])[
|
||||||
// that is emptied.
|
// that is emptied.
|
||||||
that.kind_ = symbol_kind::]b4_symbol(-2, kind)[;
|
that.kind_ = ]b4_symbol(empty, kind)[;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if YY_CPLUSPLUS < 201103L
|
#if YY_CPLUSPLUS < 201103L
|
||||||
@@ -737,7 +744,7 @@ m4_if(b4_prefix, [yy], [],
|
|||||||
]b4_parser_class[::yy_print_ (std::ostream& yyo, const basic_symbol<Base>& yysym) const
|
]b4_parser_class[::yy_print_ (std::ostream& yyo, const basic_symbol<Base>& yysym) const
|
||||||
{
|
{
|
||||||
std::ostream& yyoutput = yyo;
|
std::ostream& yyoutput = yyo;
|
||||||
YYUSE (yyoutput);
|
YY_USE (yyoutput);
|
||||||
if (yysym.empty ())
|
if (yysym.empty ())
|
||||||
yyo << "empty symbol";
|
yyo << "empty symbol";
|
||||||
else
|
else
|
||||||
@@ -852,8 +859,8 @@ m4_if(b4_prefix, [yy], [],
|
|||||||
/// The return value of parse ().
|
/// The return value of parse ().
|
||||||
int yyresult;]b4_lac_if([[
|
int yyresult;]b4_lac_if([[
|
||||||
|
|
||||||
/// Discard the LAC context in case there still is one left from a
|
// Discard the LAC context in case there still is one left from a
|
||||||
/// previous invocation.
|
// previous invocation.
|
||||||
yy_lac_discard_ ("init");]])[
|
yy_lac_discard_ ("init");]])[
|
||||||
|
|
||||||
#if YY_EXCEPTIONS
|
#if YY_EXCEPTIONS
|
||||||
@@ -905,9 +912,9 @@ b4_dollar_popdef])[]dnl
|
|||||||
try
|
try
|
||||||
#endif // YY_EXCEPTIONS
|
#endif // YY_EXCEPTIONS
|
||||||
{]b4_token_ctor_if([[
|
{]b4_token_ctor_if([[
|
||||||
symbol_type yylookahead (]b4_lex[);
|
symbol_type yylookahead (]b4_yylex[);
|
||||||
yyla.move (yylookahead);]], [[
|
yyla.move (yylookahead);]], [[
|
||||||
yyla.kind_ = yytranslate_ (]b4_lex[);]])[
|
yyla.kind_ = yytranslate_ (]b4_yylex[);]])[
|
||||||
}
|
}
|
||||||
#if YY_EXCEPTIONS
|
#if YY_EXCEPTIONS
|
||||||
catch (const syntax_error& yyexc)
|
catch (const syntax_error& yyexc)
|
||||||
@@ -920,13 +927,13 @@ b4_dollar_popdef])[]dnl
|
|||||||
}
|
}
|
||||||
YY_SYMBOL_PRINT ("Next token is", yyla);
|
YY_SYMBOL_PRINT ("Next token is", yyla);
|
||||||
|
|
||||||
if (yyla.kind () == ]symbol_kind::b4_symbol(1, kind)[)
|
if (yyla.kind () == ]b4_symbol(error, kind)[)
|
||||||
{
|
{
|
||||||
// The scanner already issued an error message, process directly
|
// The scanner already issued an error message, process directly
|
||||||
// to error recovery. But do not keep the error token as
|
// to error recovery. But do not keep the error token as
|
||||||
// lookahead, it is too special and may lead us to an endless
|
// lookahead, it is too special and may lead us to an endless
|
||||||
// loop in error recovery. */
|
// loop in error recovery. */
|
||||||
yyla.kind_ = ]symbol_kind::b4_symbol(2, kind)[;
|
yyla.kind_ = ]b4_symbol(undef, kind)[;
|
||||||
goto yyerrlab1;
|
goto yyerrlab1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -936,7 +943,7 @@ b4_dollar_popdef])[]dnl
|
|||||||
if (yyn < 0 || yylast_ < yyn || yycheck_[yyn] != yyla.kind ())
|
if (yyn < 0 || yylast_ < yyn || yycheck_[yyn] != yyla.kind ())
|
||||||
{]b4_lac_if([[
|
{]b4_lac_if([[
|
||||||
if (!yy_lac_establish_ (yyla.kind ()))
|
if (!yy_lac_establish_ (yyla.kind ()))
|
||||||
goto yyerrlab;]])[
|
goto yyerrlab;]])[
|
||||||
goto yydefault;
|
goto yydefault;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -947,7 +954,7 @@ b4_dollar_popdef])[]dnl
|
|||||||
if (yy_table_value_is_error_ (yyn))
|
if (yy_table_value_is_error_ (yyn))
|
||||||
goto yyerrlab;]b4_lac_if([[
|
goto yyerrlab;]b4_lac_if([[
|
||||||
if (!yy_lac_establish_ (yyla.kind ()))
|
if (!yy_lac_establish_ (yyla.kind ()))
|
||||||
goto yyerrlab;
|
goto yyerrlab;
|
||||||
]])[
|
]])[
|
||||||
yyn = -yyn;
|
yyn = -yyn;
|
||||||
goto yyreduce;
|
goto yyreduce;
|
||||||
@@ -980,11 +987,11 @@ b4_dollar_popdef])[]dnl
|
|||||||
yylen = yyr2_[yyn];
|
yylen = yyr2_[yyn];
|
||||||
{
|
{
|
||||||
stack_symbol_type yylhs;
|
stack_symbol_type yylhs;
|
||||||
yylhs.state = yy_lr_goto_state_ (yystack_[yylen].state, yyr1_[yyn]);]b4_variant_if([
|
yylhs.state = yy_lr_goto_state_ (yystack_[yylen].state, yyr1_[yyn]);]b4_variant_if([[
|
||||||
/* Variants are always initialized to an empty instance of the
|
/* Variants are always initialized to an empty instance of the
|
||||||
correct type. The default '$$ = $1' action is NOT applied
|
correct type. The default '$$ = $1' action is NOT applied
|
||||||
when using variants. */
|
when using variants. */
|
||||||
b4_symbol_variant([[yyr1_@{yyn@}]], [yylhs.value], [emplace])], [
|
]b4_symbol_variant([[yyr1_@{yyn@}]], [yylhs.value], [emplace])], [[
|
||||||
/* If YYLEN is nonzero, implement the default value of the
|
/* If YYLEN is nonzero, implement the default value of the
|
||||||
action: '$$ = $1'. Otherwise, use the top of the stack.
|
action: '$$ = $1'. Otherwise, use the top of the stack.
|
||||||
|
|
||||||
@@ -994,7 +1001,7 @@ b4_dollar_popdef])[]dnl
|
|||||||
if (yylen)
|
if (yylen)
|
||||||
yylhs.value = yystack_@{yylen - 1@}.value;
|
yylhs.value = yystack_@{yylen - 1@}.value;
|
||||||
else
|
else
|
||||||
yylhs.value = yystack_@{0@}.value;])[
|
yylhs.value = yystack_@{0@}.value;]])[
|
||||||
]b4_locations_if([dnl
|
]b4_locations_if([dnl
|
||||||
[
|
[
|
||||||
// Default location.
|
// Default location.
|
||||||
@@ -1063,7 +1070,7 @@ b4_dollar_popdef])[]dnl
|
|||||||
error, discard it. */
|
error, discard it. */
|
||||||
|
|
||||||
// Return failure if at end of input.
|
// Return failure if at end of input.
|
||||||
if (yyla.kind () == symbol_kind::]b4_symbol_prefix[YYEOF)
|
if (yyla.kind () == ]b4_symbol(eof, kind)[)
|
||||||
YYABORT;
|
YYABORT;
|
||||||
else if (!yyla.empty ())
|
else if (!yyla.empty ())
|
||||||
{
|
{
|
||||||
@@ -1104,9 +1111,9 @@ b4_dollar_popdef])[]dnl
|
|||||||
yyn = yypact_[+yystack_[0].state];
|
yyn = yypact_[+yystack_[0].state];
|
||||||
if (!yy_pact_value_is_default_ (yyn))
|
if (!yy_pact_value_is_default_ (yyn))
|
||||||
{
|
{
|
||||||
yyn += symbol_kind::]b4_symbol(1, kind)[;
|
yyn += ]b4_symbol(error, kind)[;
|
||||||
if (0 <= yyn && yyn <= yylast_
|
if (0 <= yyn && yyn <= yylast_
|
||||||
&& yycheck_[yyn] == symbol_kind::]b4_symbol(1, kind)[)
|
&& yycheck_[yyn] == ]b4_symbol(error, kind)[)
|
||||||
{
|
{
|
||||||
yyn = yytable_[yyn];
|
yyn = yytable_[yyn];
|
||||||
if (0 < yyn)
|
if (0 < yyn)
|
||||||
@@ -1298,8 +1305,8 @@ b4_dollar_popdef])[]dnl
|
|||||||
for (int yyx = 0; yyx < YYNTOKENS; ++yyx)
|
for (int yyx = 0; yyx < YYNTOKENS; ++yyx)
|
||||||
{
|
{
|
||||||
symbol_kind_type yysym = YY_CAST (symbol_kind_type, yyx);
|
symbol_kind_type yysym = YY_CAST (symbol_kind_type, yyx);
|
||||||
if (yysym != symbol_kind::]b4_symbol(1, kind)[
|
if (yysym != ]b4_symbol(error, kind)[
|
||||||
&& yysym != symbol_kind::]b4_symbol_prefix[YYUNDEF
|
&& yysym != ]b4_symbol(undef, kind)[
|
||||||
&& yyparser_.yy_lac_check_ (yysym))
|
&& yyparser_.yy_lac_check_ (yysym))
|
||||||
{
|
{
|
||||||
if (!yyarg)
|
if (!yyarg)
|
||||||
@@ -1310,18 +1317,18 @@ b4_dollar_popdef])[]dnl
|
|||||||
yyarg[yycount++] = yysym;
|
yyarg[yycount++] = yysym;
|
||||||
}
|
}
|
||||||
}]], [[
|
}]], [[
|
||||||
int yyn = yypact_[+yyparser_.yystack_[0].state];
|
const int yyn = yypact_[+yyparser_.yystack_[0].state];
|
||||||
if (!yy_pact_value_is_default_ (yyn))
|
if (!yy_pact_value_is_default_ (yyn))
|
||||||
{
|
{
|
||||||
/* Start YYX at -YYN if negative to avoid negative indexes in
|
/* Start YYX at -YYN if negative to avoid negative indexes in
|
||||||
YYCHECK. In other words, skip the first -YYN actions for
|
YYCHECK. In other words, skip the first -YYN actions for
|
||||||
this state because they are default actions. */
|
this state because they are default actions. */
|
||||||
int yyxbegin = yyn < 0 ? -yyn : 0;
|
const int yyxbegin = yyn < 0 ? -yyn : 0;
|
||||||
// Stay within bounds of both yycheck and yytname.
|
// Stay within bounds of both yycheck and yytname.
|
||||||
int yychecklim = yylast_ - yyn + 1;
|
const int yychecklim = yylast_ - yyn + 1;
|
||||||
int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
|
const int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
|
||||||
for (int yyx = yyxbegin; yyx < yyxend; ++yyx)
|
for (int yyx = yyxbegin; yyx < yyxend; ++yyx)
|
||||||
if (yycheck_[yyx + yyn] == yyx && yyx != symbol_kind::]b4_symbol(1, kind)[
|
if (yycheck_[yyx + yyn] == yyx && yyx != ]b4_symbol(error, kind)[
|
||||||
&& !yy_table_value_is_error_ (yytable_[yyx + yyn]))
|
&& !yy_table_value_is_error_ (yytable_[yyx + yyn]))
|
||||||
{
|
{
|
||||||
if (!yyarg)
|
if (!yyarg)
|
||||||
@@ -1334,11 +1341,13 @@ b4_dollar_popdef])[]dnl
|
|||||||
}
|
}
|
||||||
]])[
|
]])[
|
||||||
if (yyarg && yycount == 0 && 0 < yyargn)
|
if (yyarg && yycount == 0 && 0 < yyargn)
|
||||||
yyarg[0] = symbol_kind::]b4_symbol(-2, kind)[;
|
yyarg[0] = ]b4_symbol(empty, kind)[;
|
||||||
return yycount;
|
return yycount;
|
||||||
}
|
}
|
||||||
|
|
||||||
]])b4_lac_if([[
|
]])[
|
||||||
|
|
||||||
|
]b4_lac_if([[
|
||||||
bool
|
bool
|
||||||
]b4_parser_class[::yy_lac_check_ (symbol_kind_type yytoken) const
|
]b4_parser_class[::yy_lac_check_ (symbol_kind_type yytoken) const
|
||||||
{
|
{
|
||||||
@@ -1443,7 +1452,9 @@ b4_dollar_popdef])[]dnl
|
|||||||
follows. If no initial context is currently established for the
|
follows. If no initial context is currently established for the
|
||||||
current lookahead, then check if that lookahead can eventually be
|
current lookahead, then check if that lookahead can eventually be
|
||||||
shifted if syntactic actions continue from the current context. */
|
shifted if syntactic actions continue from the current context. */
|
||||||
if (!yy_lac_established_)
|
if (yy_lac_established_)
|
||||||
|
return true;
|
||||||
|
else
|
||||||
{
|
{
|
||||||
#if ]b4_api_PREFIX[DEBUG
|
#if ]b4_api_PREFIX[DEBUG
|
||||||
YYCDEBUG << "LAC: initial context established for "
|
YYCDEBUG << "LAC: initial context established for "
|
||||||
@@ -1452,12 +1463,11 @@ b4_dollar_popdef])[]dnl
|
|||||||
yy_lac_established_ = true;
|
yy_lac_established_ = true;
|
||||||
return yy_lac_check_ (yytoken);
|
return yy_lac_check_ (yytoken);
|
||||||
}
|
}
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Discard any previous initial lookahead context.
|
// Discard any previous initial lookahead context.
|
||||||
void
|
void
|
||||||
]b4_parser_class[::yy_lac_discard_ (const char* evt)
|
]b4_parser_class[::yy_lac_discard_ (const char* event)
|
||||||
{
|
{
|
||||||
/* Discard any previous initial lookahead context because of Event,
|
/* Discard any previous initial lookahead context because of Event,
|
||||||
which may be a lookahead change or an invalidation of the currently
|
which may be a lookahead change or an invalidation of the currently
|
||||||
@@ -1473,11 +1483,12 @@ b4_dollar_popdef])[]dnl
|
|||||||
if (yy_lac_established_)
|
if (yy_lac_established_)
|
||||||
{
|
{
|
||||||
YYCDEBUG << "LAC: initial context discarded due to "
|
YYCDEBUG << "LAC: initial context discarded due to "
|
||||||
<< evt << '\n';
|
<< event << '\n';
|
||||||
yy_lac_established_ = false;
|
yy_lac_established_ = false;
|
||||||
}
|
}
|
||||||
}]])b4_parse_error_bmatch([detailed\|verbose], [[
|
}]])[
|
||||||
|
|
||||||
|
]b4_parse_error_bmatch([detailed\|verbose], [[
|
||||||
int
|
int
|
||||||
]b4_parser_class[::yy_syntax_error_arguments_ (const context& yyctx,
|
]b4_parser_class[::yy_syntax_error_arguments_ (const context& yyctx,
|
||||||
symbol_kind_type yyarg[], int yyargn) const
|
symbol_kind_type yyarg[], int yyargn) const
|
||||||
|
|||||||
+671
-266
File diff suppressed because it is too large
Load Diff
+318
-123
@@ -1,6 +1,6 @@
|
|||||||
# Java skeleton for Bison -*- autoconf -*-
|
# Java skeleton for Bison -*- java -*-
|
||||||
|
|
||||||
# Copyright (C) 2007-2015, 2018-2020 Free Software Foundation, Inc.
|
# Copyright (C) 2007-2015, 2018-2021 Free Software Foundation, Inc.
|
||||||
|
|
||||||
# This program is free software: you can redistribute it and/or modify
|
# This program is free software: you can redistribute it and/or modify
|
||||||
# it under the terms of the GNU General Public License as published by
|
# it under the terms of the GNU General Public License as published by
|
||||||
@@ -13,11 +13,11 @@
|
|||||||
# GNU General Public License for more details.
|
# GNU General Public License for more details.
|
||||||
#
|
#
|
||||||
# You should have received a copy of the GNU General Public License
|
# You should have received a copy of the GNU General Public License
|
||||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
m4_include(b4_skeletonsdir/[java.m4])
|
m4_include(b4_skeletonsdir/[java.m4])
|
||||||
|
|
||||||
b4_defines_if([b4_complain([%defines does not make sense in Java])])
|
b4_header_if([b4_complain([%header/%defines does not make sense in Java])])
|
||||||
|
|
||||||
m4_define([b4_symbol_no_destructor_assert],
|
m4_define([b4_symbol_no_destructor_assert],
|
||||||
[b4_symbol_if([$1], [has_destructor],
|
[b4_symbol_if([$1], [has_destructor],
|
||||||
@@ -25,7 +25,10 @@ m4_define([b4_symbol_no_destructor_assert],
|
|||||||
[%destructor does not make sense in Java])])])
|
[%destructor does not make sense in Java])])])
|
||||||
b4_symbol_foreach([b4_symbol_no_destructor_assert])
|
b4_symbol_foreach([b4_symbol_no_destructor_assert])
|
||||||
|
|
||||||
# Setup some macros for api.push-pull.
|
## --------------- ##
|
||||||
|
## api.push-pull. ##
|
||||||
|
## --------------- ##
|
||||||
|
|
||||||
b4_percent_define_default([[api.push-pull]], [[pull]])
|
b4_percent_define_default([[api.push-pull]], [[pull]])
|
||||||
b4_percent_define_check_values([[[[api.push-pull]],
|
b4_percent_define_check_values([[[[api.push-pull]],
|
||||||
[[pull]], [[push]], [[both]]]])
|
[[pull]], [[push]], [[both]]]])
|
||||||
@@ -52,9 +55,11 @@ b4_use_push_for_pull_if([
|
|||||||
# Define a macro to encapsulate the parse state variables. This
|
# Define a macro to encapsulate the parse state variables. This
|
||||||
# allows them to be defined either in parse() when doing pull parsing,
|
# allows them to be defined either in parse() when doing pull parsing,
|
||||||
# or as class instance variable when doing push parsing.
|
# or as class instance variable when doing push parsing.
|
||||||
m4_define([b4_define_state],[[
|
m4_define([b4_define_state],
|
||||||
/* Lookahead and lookahead in internal form. */
|
[[
|
||||||
|
/* Lookahead token kind. */
|
||||||
int yychar = YYEMPTY_;
|
int yychar = YYEMPTY_;
|
||||||
|
/* Lookahead symbol kind. */
|
||||||
SymbolKind yytoken = null;
|
SymbolKind yytoken = null;
|
||||||
|
|
||||||
/* State. */
|
/* State. */
|
||||||
@@ -73,17 +78,31 @@ m4_define([b4_define_state],[[
|
|||||||
|
|
||||||
/* Semantic value of the lookahead. */
|
/* Semantic value of the lookahead. */
|
||||||
]b4_yystype[ yylval = null;
|
]b4_yystype[ yylval = null;
|
||||||
]])[
|
]])
|
||||||
|
|
||||||
]b4_output_begin([b4_parser_file_name])[
|
# parse.lac
|
||||||
|
b4_percent_define_default([[parse.lac]], [[none]])
|
||||||
|
b4_percent_define_check_values([[[[parse.lac]], [[full]], [[none]]]])
|
||||||
|
b4_define_flag_if([lac])
|
||||||
|
m4_define([b4_lac_flag],
|
||||||
|
[m4_if(b4_percent_define_get([[parse.lac]]),
|
||||||
|
[none], [[0]], [[1]])])
|
||||||
|
|
||||||
|
|
||||||
|
## ------------- ##
|
||||||
|
## Parser File. ##
|
||||||
|
## ------------- ##
|
||||||
|
|
||||||
|
b4_output_begin([b4_parser_file_name])[
|
||||||
]b4_copyright([Skeleton implementation for Bison LALR(1) parsers in Java],
|
]b4_copyright([Skeleton implementation for Bison LALR(1) parsers in Java],
|
||||||
[2007-2015, 2018-2020])[
|
[2007-2015, 2018-2021])[
|
||||||
]b4_disclaimer[
|
]b4_disclaimer[
|
||||||
]b4_percent_define_ifdef([package], [package b4_percent_define_get([package]);[
|
]b4_percent_define_ifdef([api.package], [package b4_percent_define_get([api.package]);[
|
||||||
]])[
|
]])[
|
||||||
]b4_user_pre_prologue[
|
]b4_user_pre_prologue[
|
||||||
]b4_user_post_prologue[
|
]b4_user_post_prologue[
|
||||||
import java.text.MessageFormat;
|
import java.text.MessageFormat;
|
||||||
|
import java.util.ArrayList;
|
||||||
]b4_percent_code_get([[imports]])[
|
]b4_percent_code_get([[imports]])[
|
||||||
/**
|
/**
|
||||||
* A Bison parser, automatically generated from <tt>]m4_bpatsubst(b4_file_name, [^"\(.*\)"$], [\1])[</tt>.
|
* A Bison parser, automatically generated from <tt>]m4_bpatsubst(b4_file_name, [^"\(.*\)"$], [\1])[</tt>.
|
||||||
@@ -156,11 +175,11 @@ import java.text.MessageFormat;
|
|||||||
* <code>]b4_position_type[</code> should override the <code>equals</code>
|
* <code>]b4_position_type[</code> should override the <code>equals</code>
|
||||||
* method.
|
* method.
|
||||||
*/
|
*/
|
||||||
public String toString () {
|
public String toString() {
|
||||||
if (begin.equals (end))
|
if (begin.equals (end))
|
||||||
return begin.toString ();
|
return begin.toString();
|
||||||
else
|
else
|
||||||
return begin.toString () + "-" + end.toString ();
|
return begin.toString() + "-" + end.toString();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -180,8 +199,8 @@ import java.text.MessageFormat;
|
|||||||
*/
|
*/
|
||||||
public interface Lexer {
|
public interface Lexer {
|
||||||
]b4_token_enums[
|
]b4_token_enums[
|
||||||
/** Deprecated, use ]b4_symbol(0, id)[ instead. */
|
/** Deprecated, use ]b4_symbol(eof, id)[ instead. */
|
||||||
public static final int EOF = ]b4_symbol(0, id)[;
|
public static final int EOF = ]b4_symbol(eof, id)[;
|
||||||
]b4_pull_if([b4_locations_if([[
|
]b4_pull_if([b4_locations_if([[
|
||||||
/**
|
/**
|
||||||
* Method to retrieve the beginning position of the last scanned token.
|
* Method to retrieve the beginning position of the last scanned token.
|
||||||
@@ -225,7 +244,7 @@ import java.text.MessageFormat;
|
|||||||
*
|
*
|
||||||
* @@param ctx The context of the error.
|
* @@param ctx The context of the error.
|
||||||
*/
|
*/
|
||||||
void reportSyntaxError (][Context ctx);
|
void reportSyntaxError(Context ctx);
|
||||||
]])[
|
]])[
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -246,10 +265,12 @@ import java.text.MessageFormat;
|
|||||||
/**
|
/**
|
||||||
* Instantiates the Bison-generated parser.
|
* Instantiates the Bison-generated parser.
|
||||||
*/
|
*/
|
||||||
public ]b4_parser_class (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]])[
|
]b4_percent_code_get([[init]])[]b4_lac_if([[
|
||||||
this.yylexer = new YYLexer (]b4_lex_param_call[);
|
this.yylacStack = new ArrayList<Integer>();
|
||||||
|
this.yylacEstablished = false;]])[
|
||||||
|
this.yylexer = new YYLexer(]b4_lex_param_call[);
|
||||||
]b4_parse_param_cons[
|
]b4_parse_param_cons[
|
||||||
}
|
}
|
||||||
]])[
|
]])[
|
||||||
@@ -258,9 +279,11 @@ import java.text.MessageFormat;
|
|||||||
* Instantiates the Bison-generated parser.
|
* Instantiates the Bison-generated parser.
|
||||||
* @@param yylexer The scanner that will supply tokens to the parser.
|
* @@param yylexer The scanner that will supply tokens to the parser.
|
||||||
*/
|
*/
|
||||||
]b4_lexer_if([[protected]], [[public]]) b4_parser_class[ (]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]])[
|
]b4_percent_code_get([[init]])[]b4_lac_if([[
|
||||||
|
this.yylacStack = new ArrayList<Integer>();
|
||||||
|
this.yylacEstablished = false;]])[
|
||||||
this.yylexer = yylexer;
|
this.yylexer = yylexer;
|
||||||
]b4_parse_param_cons[
|
]b4_parse_param_cons[
|
||||||
}
|
}
|
||||||
@@ -271,13 +294,13 @@ import java.text.MessageFormat;
|
|||||||
/**
|
/**
|
||||||
* The <tt>PrintStream</tt> on which the debugging output is printed.
|
* The <tt>PrintStream</tt> on which the debugging output is printed.
|
||||||
*/
|
*/
|
||||||
public final java.io.PrintStream getDebugStream () { return yyDebugStream; }
|
public final java.io.PrintStream getDebugStream() { return yyDebugStream; }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the <tt>PrintStream</tt> on which the debug output is printed.
|
* Set the <tt>PrintStream</tt> on which the debug output is printed.
|
||||||
* @@param s The stream that is used for debugging output.
|
* @@param s The stream that is used for debugging output.
|
||||||
*/
|
*/
|
||||||
public final void setDebugStream (java.io.PrintStream s) { yyDebugStream = s; }
|
public final void setDebugStream(java.io.PrintStream s) { yyDebugStream = s; }
|
||||||
|
|
||||||
private int yydebug = 0;
|
private int yydebug = 0;
|
||||||
|
|
||||||
@@ -285,14 +308,14 @@ import java.text.MessageFormat;
|
|||||||
* Answer the verbosity of the debugging output; 0 means that all kinds of
|
* Answer the verbosity of the debugging output; 0 means that all kinds of
|
||||||
* output from the parser are suppressed.
|
* output from the parser are suppressed.
|
||||||
*/
|
*/
|
||||||
public final int getDebugLevel () { return yydebug; }
|
public final int getDebugLevel() { return yydebug; }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the verbosity of the debugging output; 0 means that all kinds of
|
* Set the verbosity of the debugging output; 0 means that all kinds of
|
||||||
* output from the parser are suppressed.
|
* output from the parser are suppressed.
|
||||||
* @@param level The verbosity level for debugging output.
|
* @@param level The verbosity level for debugging output.
|
||||||
*/
|
*/
|
||||||
public final void setDebugLevel (int level) { yydebug = level; }
|
public final void setDebugLevel(int level) { yydebug = level; }
|
||||||
]])[
|
]])[
|
||||||
|
|
||||||
private int yynerrs = 0;
|
private int yynerrs = 0;
|
||||||
@@ -300,7 +323,7 @@ import java.text.MessageFormat;
|
|||||||
/**
|
/**
|
||||||
* The number of syntax errors so far.
|
* The number of syntax errors so far.
|
||||||
*/
|
*/
|
||||||
public final int getNumberOfErrors () { return yynerrs; }
|
public final int getNumberOfErrors() { return yynerrs; }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Print an error message via the lexer.
|
* Print an error message via the lexer.
|
||||||
@@ -329,9 +352,14 @@ import java.text.MessageFormat;
|
|||||||
yylexer.yyerror(new ]b4_location_type[ (pos), msg);
|
yylexer.yyerror(new ]b4_location_type[ (pos), msg);
|
||||||
}]])[
|
}]])[
|
||||||
]b4_parse_trace_if([[
|
]b4_parse_trace_if([[
|
||||||
protected final void yycdebug (String s) {
|
protected final void yycdebugNnl(String s) {
|
||||||
if (0 < yydebug)
|
if (0 < yydebug)
|
||||||
yyDebugStream.println (s);
|
yyDebugStream.print(s);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected final void yycdebug(String s) {
|
||||||
|
if (0 < yydebug)
|
||||||
|
yyDebugStream.println(s);
|
||||||
}]])[
|
}]])[
|
||||||
|
|
||||||
private final class YYStack {
|
private final class YYStack {
|
||||||
@@ -342,65 +370,63 @@ import java.text.MessageFormat;
|
|||||||
public int size = 16;
|
public int size = 16;
|
||||||
public int height = -1;
|
public int height = -1;
|
||||||
|
|
||||||
public final void push (int state, ]b4_yystype[ value]b4_locations_if([, ]b4_location_type[ loc])[) {
|
public final void push(int state, ]b4_yystype[ value]b4_locations_if([, ]b4_location_type[ loc])[) {
|
||||||
height++;
|
height++;
|
||||||
if (size == height)
|
if (size == height) {
|
||||||
{
|
int[] newStateStack = new int[size * 2];
|
||||||
int[] newStateStack = new int[size * 2];
|
System.arraycopy(stateStack, 0, newStateStack, 0, height);
|
||||||
System.arraycopy (stateStack, 0, newStateStack, 0, height);
|
stateStack = newStateStack;]b4_locations_if([[
|
||||||
stateStack = newStateStack;]b4_locations_if([[
|
]b4_location_type[[] newLocStack = new ]b4_location_type[[size * 2];
|
||||||
]b4_location_type[[] newLocStack = new ]b4_location_type[[size * 2];
|
System.arraycopy(locStack, 0, newLocStack, 0, height);
|
||||||
System.arraycopy (locStack, 0, newLocStack, 0, height);
|
locStack = newLocStack;]])
|
||||||
locStack = newLocStack;]])
|
|
||||||
|
|
||||||
b4_yystype[[] newValueStack = new ]b4_yystype[[size * 2];
|
b4_yystype[[] newValueStack = new ]b4_yystype[[size * 2];
|
||||||
System.arraycopy (valueStack, 0, newValueStack, 0, height);
|
System.arraycopy(valueStack, 0, newValueStack, 0, height);
|
||||||
valueStack = newValueStack;
|
valueStack = newValueStack;
|
||||||
|
|
||||||
size *= 2;
|
size *= 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
stateStack[height] = state;]b4_locations_if([[
|
stateStack[height] = state;]b4_locations_if([[
|
||||||
locStack[height] = loc;]])[
|
locStack[height] = loc;]])[
|
||||||
valueStack[height] = value;
|
valueStack[height] = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
public final void pop () {
|
public final void pop() {
|
||||||
pop (1);
|
pop(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
public final void pop (int num) {
|
public final void pop(int num) {
|
||||||
// Avoid memory leaks... garbage collection is a white lie!
|
// Avoid memory leaks... garbage collection is a white lie!
|
||||||
if (0 < num) {
|
if (0 < num) {
|
||||||
java.util.Arrays.fill (valueStack, height - num + 1, height + 1, null);]b4_locations_if([[
|
java.util.Arrays.fill(valueStack, height - num + 1, height + 1, null);]b4_locations_if([[
|
||||||
java.util.Arrays.fill (locStack, height - num + 1, height + 1, null);]])[
|
java.util.Arrays.fill(locStack, height - num + 1, height + 1, null);]])[
|
||||||
}
|
}
|
||||||
height -= num;
|
height -= num;
|
||||||
}
|
}
|
||||||
|
|
||||||
public final int stateAt (int i) {
|
public final int stateAt(int i) {
|
||||||
return stateStack[height - i];
|
return stateStack[height - i];
|
||||||
}
|
}
|
||||||
]b4_locations_if([[
|
]b4_locations_if([[
|
||||||
|
|
||||||
public final ]b4_location_type[ locationAt (int i) {
|
public final ]b4_location_type[ locationAt(int i) {
|
||||||
return locStack[height - i];
|
return locStack[height - i];
|
||||||
}
|
}
|
||||||
]])[
|
]])[
|
||||||
public final ]b4_yystype[ valueAt (int i) {
|
public final ]b4_yystype[ valueAt(int i) {
|
||||||
return valueStack[height - i];
|
return valueStack[height - i];
|
||||||
}
|
}
|
||||||
|
|
||||||
// Print the state stack on the debug stream.
|
// 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");
|
out.print ("Stack now");
|
||||||
|
|
||||||
for (int i = 0; i <= height; i++)
|
for (int i = 0; i <= height; i++) {
|
||||||
{
|
out.print(' ');
|
||||||
out.print (' ');
|
out.print(stateStack[i]);
|
||||||
out.print (stateStack[i]);
|
}
|
||||||
}
|
out.println();
|
||||||
out.println ();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -457,8 +483,7 @@ import java.text.MessageFormat;
|
|||||||
* @@param yystate the current state
|
* @@param yystate the current state
|
||||||
* @@param yysym the nonterminal to push on the stack
|
* @@param yysym the nonterminal to push on the stack
|
||||||
*/
|
*/
|
||||||
private int yyLRGotoState (int yystate, int yysym)
|
private int yyLRGotoState(int yystate, int yysym) {
|
||||||
{
|
|
||||||
int yyr = yypgoto_[yysym - YYNTOKENS_] + yystate;
|
int yyr = yypgoto_[yysym - YYNTOKENS_] + yystate;
|
||||||
if (0 <= yyr && yyr <= YYLAST_ && yycheck_[yyr] == yystate)
|
if (0 <= yyr && yyr <= YYLAST_ && yycheck_[yyr] == yystate)
|
||||||
return yytable_[yyr];
|
return yytable_[yyr];
|
||||||
@@ -535,7 +560,12 @@ import java.text.MessageFormat;
|
|||||||
/* @@$. */
|
/* @@$. */
|
||||||
]b4_location_type[ yyloc;]])[
|
]b4_location_type[ yyloc;]])[
|
||||||
]b4_push_if([],[[
|
]b4_push_if([],[[
|
||||||
]b4_define_state[]b4_parse_trace_if([[
|
]b4_define_state[
|
||||||
|
]b4_lac_if([[
|
||||||
|
// Discard the LAC context in case there still is one left from a
|
||||||
|
// previous invocation.
|
||||||
|
yylacDiscard("init");]])[
|
||||||
|
]b4_parse_trace_if([[
|
||||||
yycdebug ("Starting parse");]])[
|
yycdebug ("Starting parse");]])[
|
||||||
yyerrstatus_ = 0;
|
yyerrstatus_ = 0;
|
||||||
yynerrs = 0;
|
yynerrs = 0;
|
||||||
@@ -602,9 +632,9 @@ b4_dollar_popdef[]dnl
|
|||||||
push_token_consumed = false;]], [b4_parse_trace_if([[
|
push_token_consumed = false;]], [b4_parse_trace_if([[
|
||||||
yycdebug ("Reading a token");]])[
|
yycdebug ("Reading a token");]])[
|
||||||
yychar = yylexer.yylex ();
|
yychar = yylexer.yylex ();
|
||||||
yylval = yylexer.getLVal ();]b4_locations_if([
|
yylval = yylexer.getLVal();]b4_locations_if([[
|
||||||
yylloc = new b4_location_type (yylexer.getStartPos (),
|
yylloc = new ]b4_location_type[(yylexer.getStartPos(),
|
||||||
yylexer.getEndPos ());])[
|
yylexer.getEndPos());]])[
|
||||||
]])[
|
]])[
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -613,14 +643,14 @@ b4_dollar_popdef[]dnl
|
|||||||
yySymbolPrint("Next token is", yytoken,
|
yySymbolPrint("Next token is", yytoken,
|
||||||
yylval]b4_locations_if([, yylloc])[);]])[
|
yylval]b4_locations_if([, yylloc])[);]])[
|
||||||
|
|
||||||
if (yytoken == SymbolKind.]b4_symbol_prefix[YYerror)
|
if (yytoken == ]b4_symbol(error, kind)[)
|
||||||
{
|
{
|
||||||
// The scanner already issued an error message, process directly
|
// The scanner already issued an error message, process directly
|
||||||
// to error recovery. But do not keep the error token as
|
// to error recovery. But do not keep the error token as
|
||||||
// lookahead, it is too special and may lead us to an endless
|
// lookahead, it is too special and may lead us to an endless
|
||||||
// loop in error recovery. */
|
// loop in error recovery. */
|
||||||
yychar = Lexer.]b4_percent_define_get([api.token.prefix])[YYUNDEF;
|
yychar = Lexer.]b4_symbol(undef, id)[;
|
||||||
yytoken = SymbolKind.]b4_symbol_prefix[YYUNDEF;]b4_locations_if([[
|
yytoken = ]b4_symbol(undef, kind)[;]b4_locations_if([[
|
||||||
yyerrloc = yylloc;]])[
|
yyerrloc = yylloc;]])[
|
||||||
label = YYERRLAB1;
|
label = YYERRLAB1;
|
||||||
}
|
}
|
||||||
@@ -628,20 +658,25 @@ b4_dollar_popdef[]dnl
|
|||||||
{
|
{
|
||||||
/* If the proper action on seeing token YYTOKEN is to reduce or to
|
/* If the proper action on seeing token YYTOKEN is to reduce or to
|
||||||
detect an error, take that action. */
|
detect an error, take that action. */
|
||||||
yyn += yytoken.getCode ();
|
yyn += yytoken.getCode();
|
||||||
if (yyn < 0 || YYLAST_ < yyn || yycheck_[yyn] != yytoken.getCode ())
|
if (yyn < 0 || YYLAST_ < yyn || yycheck_[yyn] != yytoken.getCode()) {]b4_lac_if([[
|
||||||
|
if (!yylacEstablish(yystack, yytoken)) {
|
||||||
|
label = YYERRLAB;
|
||||||
|
} else]])[
|
||||||
label = YYDEFAULT;
|
label = YYDEFAULT;
|
||||||
|
}
|
||||||
|
|
||||||
/* <= 0 means reduce or error. */
|
/* <= 0 means reduce or error. */
|
||||||
else if ((yyn = yytable_[yyn]) <= 0)
|
else if ((yyn = yytable_[yyn]) <= 0)
|
||||||
{
|
{
|
||||||
if (yyTableValueIsError (yyn))
|
if (yyTableValueIsError(yyn)) {
|
||||||
label = YYERRLAB;
|
label = YYERRLAB;
|
||||||
else
|
}]b4_lac_if([[ else if (!yylacEstablish(yystack, yytoken)) {
|
||||||
{
|
label = YYERRLAB;
|
||||||
yyn = -yyn;
|
}]])[ else {
|
||||||
label = YYREDUCE;
|
yyn = -yyn;
|
||||||
}
|
label = YYREDUCE;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
else
|
else
|
||||||
@@ -659,7 +694,8 @@ b4_dollar_popdef[]dnl
|
|||||||
--yyerrstatus_;
|
--yyerrstatus_;
|
||||||
|
|
||||||
yystate = yyn;
|
yystate = yyn;
|
||||||
yystack.push (yystate, yylval]b4_locations_if([, yylloc])[);
|
yystack.push(yystate, yylval]b4_locations_if([, yylloc])[);]b4_lac_if([[
|
||||||
|
yylacDiscard("shift");]])[
|
||||||
label = YYNEWSTATE;
|
label = YYNEWSTATE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -682,7 +718,7 @@ b4_dollar_popdef[]dnl
|
|||||||
case YYREDUCE:
|
case YYREDUCE:
|
||||||
yylen = yyr2_[yyn];
|
yylen = yyr2_[yyn];
|
||||||
label = yyaction(yyn, yystack, yylen);
|
label = yyaction(yyn, yystack, yylen);
|
||||||
yystate = yystack.stateAt (0);
|
yystate = yystack.stateAt(0);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
/*------------------------------------.
|
/*------------------------------------.
|
||||||
@@ -695,7 +731,7 @@ b4_dollar_popdef[]dnl
|
|||||||
++yynerrs;
|
++yynerrs;
|
||||||
if (yychar == YYEMPTY_)
|
if (yychar == YYEMPTY_)
|
||||||
yytoken = null;
|
yytoken = null;
|
||||||
yyreportSyntaxError (new Context (yystack, yytoken]b4_locations_if([[, yylloc]])[));
|
yyreportSyntaxError(new Context(this, yystack, yytoken]b4_locations_if([[, yylloc]])[));
|
||||||
}
|
}
|
||||||
]b4_locations_if([[
|
]b4_locations_if([[
|
||||||
yyerrloc = yylloc;]])[
|
yyerrloc = yylloc;]])[
|
||||||
@@ -704,10 +740,10 @@ b4_dollar_popdef[]dnl
|
|||||||
/* If just tried and failed to reuse lookahead token after an
|
/* If just tried and failed to reuse lookahead token after an
|
||||||
error, discard it. */
|
error, discard it. */
|
||||||
|
|
||||||
if (yychar <= Lexer.]b4_symbol(0, id)[)
|
if (yychar <= Lexer.]b4_symbol(eof, id)[)
|
||||||
{
|
{
|
||||||
/* Return failure if at end of input. */
|
/* Return failure if at end of input. */
|
||||||
if (yychar == Lexer.]b4_symbol(0, id)[)
|
if (yychar == Lexer.]b4_symbol(eof, id)[)
|
||||||
]b4_push_if([{label = YYABORT; break;}], [return false;])[
|
]b4_push_if([{label = YYABORT; break;}], [return false;])[
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -728,7 +764,7 @@ b4_dollar_popdef[]dnl
|
|||||||
this YYERROR. */
|
this YYERROR. */
|
||||||
yystack.pop (yylen);
|
yystack.pop (yylen);
|
||||||
yylen = 0;
|
yylen = 0;
|
||||||
yystate = yystack.stateAt (0);
|
yystate = yystack.stateAt(0);
|
||||||
label = YYERRLAB1;
|
label = YYERRLAB1;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@@ -744,9 +780,9 @@ b4_dollar_popdef[]dnl
|
|||||||
yyn = yypact_[yystate];
|
yyn = yypact_[yystate];
|
||||||
if (!yyPactValueIsDefault (yyn))
|
if (!yyPactValueIsDefault (yyn))
|
||||||
{
|
{
|
||||||
yyn += SymbolKind.]b4_symbol(1, kind)[.getCode ();
|
yyn += ]b4_symbol(error, kind)[.getCode();
|
||||||
if (0 <= yyn && yyn <= YYLAST_
|
if (0 <= yyn && yyn <= YYLAST_
|
||||||
&& yycheck_[yyn] == SymbolKind.]b4_symbol(1, kind)[.getCode ())
|
&& yycheck_[yyn] == ]b4_symbol(error, kind)[.getCode())
|
||||||
{
|
{
|
||||||
yyn = yytable_[yyn];
|
yyn = yytable_[yyn];
|
||||||
if (0 < yyn)
|
if (0 < yyn)
|
||||||
@@ -762,7 +798,7 @@ b4_dollar_popdef[]dnl
|
|||||||
]b4_locations_if([[
|
]b4_locations_if([[
|
||||||
yyerrloc = yystack.locationAt (0);]])[
|
yyerrloc = yystack.locationAt (0);]])[
|
||||||
yystack.pop ();
|
yystack.pop ();
|
||||||
yystate = yystack.stateAt (0);]b4_parse_trace_if([[
|
yystate = yystack.stateAt(0);]b4_parse_trace_if([[
|
||||||
if (0 < yydebug)
|
if (0 < yydebug)
|
||||||
yystack.print (yyDebugStream);]])[
|
yystack.print (yyDebugStream);]])[
|
||||||
}
|
}
|
||||||
@@ -778,8 +814,9 @@ b4_dollar_popdef[]dnl
|
|||||||
yyloc = yylloc (yystack, 2);
|
yyloc = yylloc (yystack, 2);
|
||||||
yystack.pop (2);]])[
|
yystack.pop (2);]])[
|
||||||
|
|
||||||
/* Shift the error token. */]b4_parse_trace_if([[
|
/* Shift the error token. */]b4_lac_if([[
|
||||||
yySymbolPrint("Shifting", SymbolKind.get (yystos_[yyn]),
|
yylacDiscard("error recovery");]])[]b4_parse_trace_if([[
|
||||||
|
yySymbolPrint("Shifting", SymbolKind.get(yystos_[yyn]),
|
||||||
yylval]b4_locations_if([, yyloc])[);]])[
|
yylval]b4_locations_if([, yyloc])[);]])[
|
||||||
|
|
||||||
yystate = yyn;
|
yystate = yyn;
|
||||||
@@ -814,7 +851,9 @@ b4_dollar_popdef[]dnl
|
|||||||
this.yyn = 0;
|
this.yyn = 0;
|
||||||
this.yylen = 0;
|
this.yylen = 0;
|
||||||
this.yystate = 0;
|
this.yystate = 0;
|
||||||
this.yystack = new YYStack ();
|
this.yystack = new YYStack();]b4_lac_if([[
|
||||||
|
this.yylacStack = new ArrayList<Integer>();
|
||||||
|
this.yylacEstablished = false;]])[
|
||||||
this.label = YYNEWSTATE;
|
this.label = YYNEWSTATE;
|
||||||
|
|
||||||
/* Error handling. */
|
/* Error handling. */
|
||||||
@@ -874,23 +913,22 @@ b4_dollar_popdef[]dnl
|
|||||||
* Information needed to get the list of expected tokens and to forge
|
* Information needed to get the list of expected tokens and to forge
|
||||||
* a syntax error diagnostic.
|
* a syntax error diagnostic.
|
||||||
*/
|
*/
|
||||||
public static final class Context
|
public static final class Context {
|
||||||
{
|
Context(]b4_parser_class[ parser, YYStack stack, SymbolKind token]b4_locations_if([[, ]b4_location_type[ loc]])[) {
|
||||||
Context (YYStack stack, SymbolKind token]b4_locations_if([[, ]b4_location_type[ loc]])[)
|
yyparser = parser;
|
||||||
{
|
|
||||||
yystack = stack;
|
yystack = stack;
|
||||||
yytoken = token;]b4_locations_if([[
|
yytoken = token;]b4_locations_if([[
|
||||||
yylocation = loc;]])[
|
yylocation = loc;]])[
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private ]b4_parser_class[ yyparser;
|
||||||
private YYStack yystack;
|
private YYStack yystack;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The symbol kind of the lookahead token.
|
* The symbol kind of the lookahead token.
|
||||||
*/
|
*/
|
||||||
public final SymbolKind getToken ()
|
public final SymbolKind getToken() {
|
||||||
{
|
|
||||||
return yytoken;
|
return yytoken;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -899,8 +937,7 @@ b4_dollar_popdef[]dnl
|
|||||||
/**
|
/**
|
||||||
* The location of the lookahead.
|
* The location of the lookahead.
|
||||||
*/
|
*/
|
||||||
public final ]b4_location_type[ getLocation ()
|
public final ]b4_location_type[ getLocation() {
|
||||||
{
|
|
||||||
return yylocation;
|
return yylocation;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -913,16 +950,34 @@ b4_dollar_popdef[]dnl
|
|||||||
* YYARG is null, return the number of expected tokens (guaranteed to
|
* YYARG is null, return the number of expected tokens (guaranteed to
|
||||||
* be less than YYNTOKENS).
|
* be less than YYNTOKENS).
|
||||||
*/
|
*/
|
||||||
int getExpectedTokens (SymbolKind yyarg[], int yyargn)
|
int getExpectedTokens(SymbolKind yyarg[], int yyargn) {
|
||||||
{
|
|
||||||
return getExpectedTokens (yyarg, 0, yyargn);
|
return getExpectedTokens (yyarg, 0, yyargn);
|
||||||
}
|
}
|
||||||
|
|
||||||
int getExpectedTokens (SymbolKind yyarg[], int yyoffset, int yyargn)
|
int getExpectedTokens(SymbolKind yyarg[], int yyoffset, int yyargn) {
|
||||||
{
|
int yycount = yyoffset;]b4_lac_if([b4_parse_trace_if([[
|
||||||
int yycount = yyoffset;
|
// Execute LAC once. We don't care if it is successful, we
|
||||||
int yyn = yypact_[this.yystack.stateAt (0)];
|
// only do it for the sake of debugging output.
|
||||||
if (!yyPactValueIsDefault (yyn))
|
if (!yyparser.yylacEstablished)
|
||||||
|
yyparser.yylacCheck(yystack, yytoken);
|
||||||
|
]])[
|
||||||
|
for (int yyx = 0; yyx < YYNTOKENS_; ++yyx)
|
||||||
|
{
|
||||||
|
SymbolKind yysym = SymbolKind.get(yyx);
|
||||||
|
if (yysym != ]b4_symbol(error, kind)[
|
||||||
|
&& yysym != ]b4_symbol(undef, kind)[
|
||||||
|
&& yyparser.yylacCheck(yystack, yysym))
|
||||||
|
{
|
||||||
|
if (yyarg == null)
|
||||||
|
yycount += 1;
|
||||||
|
else if (yycount == yyargn)
|
||||||
|
return 0;
|
||||||
|
else
|
||||||
|
yyarg[yycount++] = yysym;
|
||||||
|
}
|
||||||
|
}]], [[
|
||||||
|
int yyn = yypact_[this.yystack.stateAt(0)];
|
||||||
|
if (!yyPactValueIsDefault(yyn))
|
||||||
{
|
{
|
||||||
/* Start YYX at -YYN if negative to avoid negative
|
/* Start YYX at -YYN if negative to avoid negative
|
||||||
indexes in YYCHECK. In other words, skip the first
|
indexes in YYCHECK. In other words, skip the first
|
||||||
@@ -933,27 +988,168 @@ b4_dollar_popdef[]dnl
|
|||||||
int yychecklim = YYLAST_ - yyn + 1;
|
int yychecklim = YYLAST_ - yyn + 1;
|
||||||
int yyxend = yychecklim < NTOKENS ? yychecklim : NTOKENS;
|
int yyxend = yychecklim < NTOKENS ? yychecklim : NTOKENS;
|
||||||
for (int yyx = yyxbegin; yyx < yyxend; ++yyx)
|
for (int yyx = yyxbegin; yyx < yyxend; ++yyx)
|
||||||
if (yycheck_[yyx + yyn] == yyx && yyx != SymbolKind.]b4_symbol(1, kind)[.getCode ()
|
if (yycheck_[yyx + yyn] == yyx && yyx != ]b4_symbol(error, kind)[.getCode()
|
||||||
&& !yyTableValueIsError (yytable_[yyx + yyn]))
|
&& !yyTableValueIsError(yytable_[yyx + yyn]))
|
||||||
{
|
{
|
||||||
if (yyarg == null)
|
if (yyarg == null)
|
||||||
yycount += 1;
|
yycount += 1;
|
||||||
else if (yycount == yyargn)
|
else if (yycount == yyargn)
|
||||||
return 0; // FIXME: this is incorrect.
|
return 0; // FIXME: this is incorrect.
|
||||||
else
|
else
|
||||||
yyarg[yycount++] = SymbolKind.get (yyx);
|
yyarg[yycount++] = SymbolKind.get(yyx);
|
||||||
}
|
}
|
||||||
}
|
}]])[
|
||||||
if (yyarg != null && yycount == yyoffset && yyoffset < yyargn)
|
if (yyarg != null && yycount == yyoffset && yyoffset < yyargn)
|
||||||
yyarg[yycount] = null;
|
yyarg[yycount] = null;
|
||||||
return yycount - yyoffset;
|
return yycount - yyoffset;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
]b4_lac_if([[
|
||||||
|
/** Check the lookahead yytoken.
|
||||||
|
* \returns true iff the token will be eventually shifted.
|
||||||
|
*/
|
||||||
|
boolean yylacCheck(YYStack yystack, SymbolKind yytoken)
|
||||||
|
{
|
||||||
|
// Logically, the yylacStack's lifetime is confined to this function.
|
||||||
|
// Clear it, to get rid of potential left-overs from previous call.
|
||||||
|
yylacStack.clear();
|
||||||
|
// Reduce until we encounter a shift and thereby accept the token.
|
||||||
|
yycdebugNnl("LAC: checking lookahead " + yytoken.getName() + ":");
|
||||||
|
int lacTop = 0;
|
||||||
|
while (true)
|
||||||
|
{
|
||||||
|
int topState = (yylacStack.isEmpty()
|
||||||
|
? yystack.stateAt(lacTop)
|
||||||
|
: yylacStack.get(yylacStack.size() - 1));
|
||||||
|
int yyrule = yypact_[topState];
|
||||||
|
if (yyPactValueIsDefault(yyrule)
|
||||||
|
|| (yyrule += yytoken.getCode()) < 0 || YYLAST_ < yyrule
|
||||||
|
|| yycheck_[yyrule] != yytoken.getCode())
|
||||||
|
{
|
||||||
|
// Use the default action.
|
||||||
|
yyrule = yydefact_[+topState];
|
||||||
|
if (yyrule == 0) {
|
||||||
|
yycdebug(" Err");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// Use the action from yytable.
|
||||||
|
yyrule = yytable_[yyrule];
|
||||||
|
if (yyTableValueIsError(yyrule)) {
|
||||||
|
yycdebug(" Err");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (0 < yyrule) {
|
||||||
|
yycdebug(" S" + yyrule);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
yyrule = -yyrule;
|
||||||
|
}
|
||||||
|
// By now we know we have to simulate a reduce.
|
||||||
|
yycdebugNnl(" R" + (yyrule - 1));
|
||||||
|
// Pop the corresponding number of values from the stack.
|
||||||
|
{
|
||||||
|
int yylen = yyr2_[yyrule];
|
||||||
|
// First pop from the LAC stack as many tokens as possible.
|
||||||
|
int lacSize = yylacStack.size();
|
||||||
|
if (yylen < lacSize) {
|
||||||
|
// yylacStack.setSize(lacSize - yylen);
|
||||||
|
for (/* Nothing */; 0 < yylen; yylen -= 1) {
|
||||||
|
yylacStack.remove(yylacStack.size() - 1);
|
||||||
|
}
|
||||||
|
yylen = 0;
|
||||||
|
} else if (lacSize != 0) {
|
||||||
|
yylacStack.clear();
|
||||||
|
yylen -= lacSize;
|
||||||
|
}
|
||||||
|
// Only afterwards look at the main stack.
|
||||||
|
// We simulate popping elements by incrementing lacTop.
|
||||||
|
lacTop += yylen;
|
||||||
|
}
|
||||||
|
// Keep topState in sync with the updated stack.
|
||||||
|
topState = (yylacStack.isEmpty()
|
||||||
|
? yystack.stateAt(lacTop)
|
||||||
|
: yylacStack.get(yylacStack.size() - 1));
|
||||||
|
// Push the resulting state of the reduction.
|
||||||
|
int state = yyLRGotoState(topState, yyr1_[yyrule]);
|
||||||
|
yycdebugNnl(" G" + state);
|
||||||
|
yylacStack.add(state);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Establish the initial context if no initial context currently exists.
|
||||||
|
* \returns true iff the token will be eventually shifted.
|
||||||
|
*/
|
||||||
|
boolean yylacEstablish(YYStack yystack, SymbolKind yytoken) {
|
||||||
|
/* Establish the initial context for the current lookahead if no initial
|
||||||
|
context is currently established.
|
||||||
|
|
||||||
|
We define a context as a snapshot of the parser stacks. We define
|
||||||
|
the initial context for a lookahead as the context in which the
|
||||||
|
parser initially examines that lookahead in order to select a
|
||||||
|
syntactic action. Thus, if the lookahead eventually proves
|
||||||
|
syntactically unacceptable (possibly in a later context reached via a
|
||||||
|
series of reductions), the initial context can be used to determine
|
||||||
|
the exact set of tokens that would be syntactically acceptable in the
|
||||||
|
lookahead's place. Moreover, it is the context after which any
|
||||||
|
further semantic actions would be erroneous because they would be
|
||||||
|
determined by a syntactically unacceptable token.
|
||||||
|
|
||||||
|
yylacEstablish should be invoked when a reduction is about to be
|
||||||
|
performed in an inconsistent state (which, for the purposes of LAC,
|
||||||
|
includes consistent states that don't know they're consistent because
|
||||||
|
their default reductions have been disabled).
|
||||||
|
|
||||||
|
For parse.lac=full, the implementation of yylacEstablish is as
|
||||||
|
follows. If no initial context is currently established for the
|
||||||
|
current lookahead, then check if that lookahead can eventually be
|
||||||
|
shifted if syntactic actions continue from the current context. */
|
||||||
|
if (yylacEstablished) {
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
|
yycdebug("LAC: initial context established for " + yytoken.getName());
|
||||||
|
yylacEstablished = true;
|
||||||
|
return yylacCheck(yystack, yytoken);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Discard any previous initial lookahead context because of event.
|
||||||
|
* \param event the event which caused the lookahead to be discarded.
|
||||||
|
* Only used for debbuging output. */
|
||||||
|
void yylacDiscard(String event) {
|
||||||
|
/* Discard any previous initial lookahead context because of Event,
|
||||||
|
which may be a lookahead change or an invalidation of the currently
|
||||||
|
established initial context for the current lookahead.
|
||||||
|
|
||||||
|
The most common example of a lookahead change is a shift. An example
|
||||||
|
of both cases is syntax error recovery. That is, a syntax error
|
||||||
|
occurs when the lookahead is syntactically erroneous for the
|
||||||
|
currently established initial context, so error recovery manipulates
|
||||||
|
the parser stacks to try to find a new initial context in which the
|
||||||
|
current lookahead is syntactically acceptable. If it fails to find
|
||||||
|
such a context, it discards the lookahead. */
|
||||||
|
if (yylacEstablished) {
|
||||||
|
yycdebug("LAC: initial context discarded due to " + event);
|
||||||
|
yylacEstablished = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/** The stack for LAC.
|
||||||
|
* Logically, the yylacStack's lifetime is confined to the function
|
||||||
|
* yylacCheck. We just store it as a member of this class to hold
|
||||||
|
* on to the memory and to avoid frequent reallocations.
|
||||||
|
*/
|
||||||
|
ArrayList<Integer> yylacStack;
|
||||||
|
/** Whether an initial LAC context was established. */
|
||||||
|
boolean yylacEstablished;
|
||||||
|
]])[
|
||||||
|
|
||||||
]b4_parse_error_bmatch(
|
]b4_parse_error_bmatch(
|
||||||
[detailed\|verbose], [[
|
[detailed\|verbose], [[
|
||||||
private int yysyntaxErrorArguments (Context yyctx, SymbolKind[] yyarg, int yyargn)
|
private int yysyntaxErrorArguments(Context yyctx, SymbolKind[] yyarg, int yyargn) {
|
||||||
{
|
|
||||||
/* There are many possibilities here to consider:
|
/* There are many possibilities here to consider:
|
||||||
- If this state is a consistent state with a default action,
|
- If this state is a consistent state with a default action,
|
||||||
then the only way this function was invoked is if the
|
then the only way this function was invoked is if the
|
||||||
@@ -981,12 +1177,12 @@ b4_dollar_popdef[]dnl
|
|||||||
to an error action in a later state.
|
to an error action in a later state.
|
||||||
*/
|
*/
|
||||||
int yycount = 0;
|
int yycount = 0;
|
||||||
if (yyctx.getToken () != null)
|
if (yyctx.getToken() != null)
|
||||||
{
|
{
|
||||||
if (yyarg != null)
|
if (yyarg != null)
|
||||||
yyarg[yycount] = yyctx.getToken ();
|
yyarg[yycount] = yyctx.getToken();
|
||||||
yycount += 1;
|
yycount += 1;
|
||||||
yycount += yyctx.getExpectedTokens (yyarg, 1, yyargn);
|
yycount += yyctx.getExpectedTokens(yyarg, 1, yyargn);
|
||||||
}
|
}
|
||||||
return yycount;
|
return yycount;
|
||||||
}
|
}
|
||||||
@@ -1031,8 +1227,7 @@ b4_dollar_popdef[]dnl
|
|||||||
* Whether the given <code>yypact_</code> value indicates a defaulted state.
|
* Whether the given <code>yypact_</code> value indicates a defaulted state.
|
||||||
* @@param yyvalue the value to check
|
* @@param yyvalue the value to check
|
||||||
*/
|
*/
|
||||||
private static boolean yyPactValueIsDefault (int yyvalue)
|
private static boolean yyPactValueIsDefault(int yyvalue) {
|
||||||
{
|
|
||||||
return yyvalue == yypact_ninf_;
|
return yyvalue == yypact_ninf_;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1041,8 +1236,7 @@ b4_dollar_popdef[]dnl
|
|||||||
* value indicates a syntax error.
|
* value indicates a syntax error.
|
||||||
* @@param yyvalue the value to check
|
* @@param yyvalue the value to check
|
||||||
*/
|
*/
|
||||||
private static boolean yyTableValueIsError (int yyvalue)
|
private static boolean yyTableValueIsError(int yyvalue) {
|
||||||
{
|
|
||||||
return yyvalue == yytable_ninf_;
|
return yyvalue == yytable_ninf_;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1071,27 +1265,28 @@ b4_dollar_popdef[]dnl
|
|||||||
/* The symbols being reduced. */
|
/* The symbols being reduced. */
|
||||||
for (int yyi = 0; yyi < yynrhs; yyi++)
|
for (int yyi = 0; yyi < yynrhs; yyi++)
|
||||||
yySymbolPrint(" $" + (yyi + 1) + " =",
|
yySymbolPrint(" $" + (yyi + 1) + " =",
|
||||||
SymbolKind.get (yystos_[yystack.stateAt (yynrhs - (yyi + 1))]),
|
SymbolKind.get(yystos_[yystack.stateAt(yynrhs - (yyi + 1))]),
|
||||||
]b4_rhs_data(yynrhs, yyi + 1)b4_locations_if([,
|
]b4_rhs_data(yynrhs, yyi + 1)b4_locations_if([,
|
||||||
b4_rhs_location(yynrhs, yyi + 1)])[);
|
b4_rhs_location(yynrhs, yyi + 1)])[);
|
||||||
}]])[
|
}]])[
|
||||||
|
|
||||||
/* YYTRANSLATE_(TOKEN-NUM) -- Symbol number corresponding to TOKEN-NUM
|
/* YYTRANSLATE_(TOKEN-NUM) -- Symbol number corresponding to TOKEN-NUM
|
||||||
as returned by yylex, with out-of-bounds checking. */
|
as returned by yylex, with out-of-bounds checking. */
|
||||||
private static final SymbolKind yytranslate_ (int t)
|
private static final SymbolKind yytranslate_(int t)
|
||||||
]b4_api_token_raw_if(dnl
|
]b4_api_token_raw_if(dnl
|
||||||
[[ {
|
[[ {
|
||||||
return SymbolKind.get (t);
|
return SymbolKind.get(t);
|
||||||
}
|
}
|
||||||
]],
|
]],
|
||||||
[[ {
|
[[ {
|
||||||
int user_token_number_max_ = ]b4_user_token_number_max[;
|
// Last valid token kind.
|
||||||
|
int code_max = ]b4_code_max[;
|
||||||
if (t <= 0)
|
if (t <= 0)
|
||||||
return SymbolKind.]b4_symbol_prefix[YYEOF;
|
return ]b4_symbol(eof, kind)[;
|
||||||
else if (t <= user_token_number_max_)
|
else if (t <= code_max)
|
||||||
return SymbolKind.get (yytranslate_table_[t]);
|
return SymbolKind.get(yytranslate_table_[t]);
|
||||||
else
|
else
|
||||||
return SymbolKind.]b4_symbol_prefix[YYUNDEF;
|
return ]b4_symbol(undef, kind)[;
|
||||||
}
|
}
|
||||||
]b4_integral_parser_table_define([translate_table], [b4_translate])[
|
]b4_integral_parser_table_define([translate_table], [b4_translate])[
|
||||||
]])[
|
]])[
|
||||||
|
|||||||
+24
-17
@@ -1,6 +1,6 @@
|
|||||||
# C++ skeleton for Bison
|
# C++ skeleton for Bison
|
||||||
|
|
||||||
# Copyright (C) 2002-2015, 2018-2020 Free Software Foundation, Inc.
|
# Copyright (C) 2002-2015, 2018-2021 Free Software Foundation, Inc.
|
||||||
|
|
||||||
# This program is free software: you can redistribute it and/or modify
|
# This program is free software: you can redistribute it and/or modify
|
||||||
# it under the terms of the GNU General Public License as published by
|
# it under the terms of the GNU General Public License as published by
|
||||||
@@ -13,17 +13,10 @@
|
|||||||
# GNU General Public License for more details.
|
# GNU General Public License for more details.
|
||||||
#
|
#
|
||||||
# You should have received a copy of the GNU General Public License
|
# You should have received a copy of the GNU General Public License
|
||||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
m4_pushdef([b4_copyright_years],
|
m4_pushdef([b4_copyright_years],
|
||||||
[2002-2015, 2018-2020])
|
[2002-2015, 2018-2021])
|
||||||
|
|
||||||
|
|
||||||
# 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
|
# b4_location_file
|
||||||
@@ -32,7 +25,7 @@ b4_defines_if([b4_required_version_if([302], [],
|
|||||||
# if we want this file.
|
# if we want this file.
|
||||||
b4_percent_define_check_file([b4_location_file],
|
b4_percent_define_check_file([b4_location_file],
|
||||||
[[api.location.file]],
|
[[api.location.file]],
|
||||||
b4_defines_if([[location.hh]]))
|
b4_header_if([[location.hh]]))
|
||||||
|
|
||||||
# b4_location_include
|
# b4_location_include
|
||||||
# -------------------
|
# -------------------
|
||||||
@@ -48,12 +41,22 @@ m4_ifdef([b4_location_file],
|
|||||||
["b4_location_file"])])
|
["b4_location_file"])])
|
||||||
m4_define([b4_location_path],
|
m4_define([b4_location_path],
|
||||||
b4_percent_define_get([[api.location.include]],
|
b4_percent_define_get([[api.location.include]],
|
||||||
["b4_dir_prefix[]b4_location_file"]))
|
["b4_mapped_dir_prefix[]b4_location_file"]))
|
||||||
m4_define([b4_location_path],
|
m4_define([b4_location_path],
|
||||||
m4_substr(m4_defn([b4_location_path]), 1, m4_eval(m4_len(m4_defn([b4_location_path])) - 2)))
|
m4_substr(m4_defn([b4_location_path]), 1, m4_eval(m4_len(m4_defn([b4_location_path])) - 2)))
|
||||||
])
|
])
|
||||||
|
|
||||||
|
|
||||||
|
# b4_position_file
|
||||||
|
# ----------------
|
||||||
|
# Name of the file containing the position class, if we want this file.
|
||||||
|
b4_header_if(
|
||||||
|
[b4_required_version_if(
|
||||||
|
[30200], [],
|
||||||
|
[m4_ifdef([b4_location_file],
|
||||||
|
[m4_define([b4_position_file], [position.hh])])])])
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# b4_location_define
|
# b4_location_define
|
||||||
# ------------------
|
# ------------------
|
||||||
@@ -63,11 +66,13 @@ m4_define([b4_location_define],
|
|||||||
class position
|
class position
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
/// Type for file name.
|
||||||
|
typedef ]b4_percent_define_get([[api.filename.type]])[ filename_type;
|
||||||
/// Type for line and column numbers.
|
/// Type for line and column numbers.
|
||||||
typedef int counter_type;
|
typedef int counter_type;
|
||||||
]m4_ifdef([b4_location_constructors], [[
|
]m4_ifdef([b4_location_constructors], [[
|
||||||
/// Construct a position.
|
/// Construct a position.
|
||||||
explicit position (]b4_percent_define_get([[filename_type]])[* f = YY_NULLPTR,
|
explicit position (filename_type* f = YY_NULLPTR,
|
||||||
counter_type l = ]b4_location_initial_line[,
|
counter_type l = ]b4_location_initial_line[,
|
||||||
counter_type c = ]b4_location_initial_column[)
|
counter_type c = ]b4_location_initial_column[)
|
||||||
: filename (f)
|
: filename (f)
|
||||||
@@ -77,7 +82,7 @@ m4_define([b4_location_define],
|
|||||||
|
|
||||||
]])[
|
]])[
|
||||||
/// Initialization.
|
/// Initialization.
|
||||||
void initialize (]b4_percent_define_get([[filename_type]])[* fn = YY_NULLPTR,
|
void initialize (filename_type* fn = YY_NULLPTR,
|
||||||
counter_type l = ]b4_location_initial_line[,
|
counter_type l = ]b4_location_initial_line[,
|
||||||
counter_type c = ]b4_location_initial_column[)
|
counter_type c = ]b4_location_initial_column[)
|
||||||
{
|
{
|
||||||
@@ -106,7 +111,7 @@ m4_define([b4_location_define],
|
|||||||
/** \} */
|
/** \} */
|
||||||
|
|
||||||
/// File name to which this position refers.
|
/// File name to which this position refers.
|
||||||
]b4_percent_define_get([[filename_type]])[* filename;
|
filename_type* filename;
|
||||||
/// Current line number.
|
/// Current line number.
|
||||||
counter_type line;
|
counter_type line;
|
||||||
/// Current column number.
|
/// Current column number.
|
||||||
@@ -184,6 +189,8 @@ m4_define([b4_location_define],
|
|||||||
class location
|
class location
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
/// Type for file name.
|
||||||
|
typedef position::filename_type filename_type;
|
||||||
/// Type for line and column numbers.
|
/// Type for line and column numbers.
|
||||||
typedef position::counter_type counter_type;
|
typedef position::counter_type counter_type;
|
||||||
]m4_ifdef([b4_location_constructors], [
|
]m4_ifdef([b4_location_constructors], [
|
||||||
@@ -200,7 +207,7 @@ m4_define([b4_location_define],
|
|||||||
{}
|
{}
|
||||||
|
|
||||||
/// Construct a 0-width location in \a f, \a l, \a c.
|
/// Construct a 0-width location in \a f, \a l, \a c.
|
||||||
explicit location (]b4_percent_define_get([[filename_type]])[* f,
|
explicit location (filename_type* f,
|
||||||
counter_type l = ]b4_location_initial_line[,
|
counter_type l = ]b4_location_initial_line[,
|
||||||
counter_type c = ]b4_location_initial_column[)
|
counter_type c = ]b4_location_initial_column[)
|
||||||
: begin (f, l, c)
|
: begin (f, l, c)
|
||||||
@@ -209,7 +216,7 @@ m4_define([b4_location_define],
|
|||||||
|
|
||||||
])[
|
])[
|
||||||
/// Initialization.
|
/// Initialization.
|
||||||
void initialize (]b4_percent_define_get([[filename_type]])[* f = YY_NULLPTR,
|
void initialize (filename_type* f = YY_NULLPTR,
|
||||||
counter_type l = ]b4_location_initial_line[,
|
counter_type l = ]b4_location_initial_line[,
|
||||||
counter_type c = ]b4_location_initial_column[)
|
counter_type c = ]b4_location_initial_column[)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
# C++ skeleton for Bison
|
# C++ skeleton for Bison
|
||||||
|
|
||||||
# Copyright (C) 2002-2015, 2018-2020 Free Software Foundation, Inc.
|
# Copyright (C) 2002-2015, 2018-2021 Free Software Foundation, Inc.
|
||||||
|
|
||||||
# This program is free software: you can redistribute it and/or modify
|
# This program is free software: you can redistribute it and/or modify
|
||||||
# it under the terms of the GNU General Public License as published by
|
# it under the terms of the GNU General Public License as published by
|
||||||
@@ -13,14 +13,14 @@
|
|||||||
# GNU General Public License for more details.
|
# GNU General Public License for more details.
|
||||||
#
|
#
|
||||||
# You should have received a copy of the GNU General Public License
|
# You should have received a copy of the GNU General Public License
|
||||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
|
||||||
# b4_stack_file
|
# b4_stack_file
|
||||||
# -------------
|
# -------------
|
||||||
# Name of the file containing the stack class, if we want this file.
|
# Name of the file containing the stack class, if we want this file.
|
||||||
b4_defines_if([b4_required_version_if([302], [],
|
b4_header_if([b4_required_version_if([30200], [],
|
||||||
[m4_define([b4_stack_file], [stack.hh])])])
|
[m4_define([b4_stack_file], [stack.hh])])])
|
||||||
|
|
||||||
|
|
||||||
# b4_stack_define
|
# b4_stack_define
|
||||||
|
|||||||
+131
-69
@@ -1,6 +1,6 @@
|
|||||||
# C++ skeleton for Bison
|
# C++ skeleton for Bison
|
||||||
|
|
||||||
# Copyright (C) 2002-2015, 2018-2020 Free Software Foundation, Inc.
|
# Copyright (C) 2002-2015, 2018-2021 Free Software Foundation, Inc.
|
||||||
|
|
||||||
# This program is free software: you can redistribute it and/or modify
|
# This program is free software: you can redistribute it and/or modify
|
||||||
# it under the terms of the GNU General Public License as published by
|
# it under the terms of the GNU General Public License as published by
|
||||||
@@ -13,13 +13,20 @@
|
|||||||
# GNU General Public License for more details.
|
# GNU General Public License for more details.
|
||||||
#
|
#
|
||||||
# You should have received a copy of the GNU General Public License
|
# You should have received a copy of the GNU General Public License
|
||||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
|
||||||
## --------- ##
|
## --------- ##
|
||||||
## variant. ##
|
## variant. ##
|
||||||
## --------- ##
|
## --------- ##
|
||||||
|
|
||||||
|
# b4_assert
|
||||||
|
# ---------
|
||||||
|
# The name of YY_ASSERT.
|
||||||
|
m4_define([b4_assert],
|
||||||
|
[b4_api_PREFIX[]_ASSERT])
|
||||||
|
|
||||||
|
|
||||||
# b4_symbol_variant(YYTYPE, YYVAL, ACTION, [ARGS])
|
# b4_symbol_variant(YYTYPE, YYVAL, ACTION, [ARGS])
|
||||||
# ------------------------------------------------
|
# ------------------------------------------------
|
||||||
# Run some ACTION ("build", or "destroy") on YYVAL of symbol type
|
# Run some ACTION ("build", or "destroy") on YYVAL of symbol type
|
||||||
@@ -71,12 +78,12 @@ m4_map([ b4_symbol_tag_comment], [$@])dnl
|
|||||||
# -------------------
|
# -------------------
|
||||||
# The needed includes for variants support.
|
# The needed includes for variants support.
|
||||||
m4_define([b4_variant_includes],
|
m4_define([b4_variant_includes],
|
||||||
[b4_parse_assert_if([[#include <typeinfo>]])[
|
[b4_parse_assert_if([[#include <typeinfo>
|
||||||
#ifndef YY_ASSERT
|
#ifndef ]b4_assert[
|
||||||
# include <cassert>
|
# include <cassert>
|
||||||
# define YY_ASSERT assert
|
# define ]b4_assert[ assert
|
||||||
#endif
|
#endif
|
||||||
]])
|
]])])
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -87,45 +94,45 @@ m4_define([b4_variant_includes],
|
|||||||
|
|
||||||
# b4_value_type_declare
|
# b4_value_type_declare
|
||||||
# ---------------------
|
# ---------------------
|
||||||
# Define semantic_type.
|
# Define value_type.
|
||||||
m4_define([b4_value_type_declare],
|
m4_define([b4_value_type_declare],
|
||||||
[[ /// A buffer to store and retrieve objects.
|
[[ /// A buffer to store and retrieve objects.
|
||||||
///
|
///
|
||||||
/// Sort of a variant, but does not keep track of the nature
|
/// Sort of a variant, but does not keep track of the nature
|
||||||
/// of the stored data, since that knowledge is available
|
/// of the stored data, since that knowledge is available
|
||||||
/// via the current parser state.
|
/// via the current parser state.
|
||||||
class semantic_type
|
class value_type
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
/// Type of *this.
|
/// Type of *this.
|
||||||
typedef semantic_type self_type;
|
typedef value_type self_type;
|
||||||
|
|
||||||
/// Empty construction.
|
/// Empty construction.
|
||||||
semantic_type () YY_NOEXCEPT
|
value_type () YY_NOEXCEPT
|
||||||
: yybuffer_ ()]b4_parse_assert_if([
|
: yyraw_ ()]b4_parse_assert_if([
|
||||||
, yytypeid_ (YY_NULLPTR)])[
|
, yytypeid_ (YY_NULLPTR)])[
|
||||||
{}
|
{}
|
||||||
|
|
||||||
/// Construct and fill.
|
/// Construct and fill.
|
||||||
template <typename T>
|
template <typename T>
|
||||||
semantic_type (YY_RVREF (T) t)]b4_parse_assert_if([
|
value_type (YY_RVREF (T) t)]b4_parse_assert_if([
|
||||||
: yytypeid_ (&typeid (T))])[
|
: yytypeid_ (&typeid (T))])[
|
||||||
{
|
{]b4_parse_assert_if([[
|
||||||
YY_ASSERT (sizeof (T) <= size);
|
]b4_assert[ (sizeof (T) <= size);]])[
|
||||||
new (yyas_<T> ()) T (YY_MOVE (t));
|
new (yyas_<T> ()) T (YY_MOVE (t));
|
||||||
}
|
}
|
||||||
|
|
||||||
#if 201103L <= YY_CPLUSPLUS
|
#if 201103L <= YY_CPLUSPLUS
|
||||||
/// Non copyable.
|
/// Non copyable.
|
||||||
semantic_type (const self_type&) = delete;
|
value_type (const self_type&) = delete;
|
||||||
/// Non copyable.
|
/// Non copyable.
|
||||||
self_type& operator= (const self_type&) = delete;
|
self_type& operator= (const self_type&) = delete;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/// Destruction, allowed only if empty.
|
/// Destruction, allowed only if empty.
|
||||||
~semantic_type () YY_NOEXCEPT
|
~value_type () YY_NOEXCEPT
|
||||||
{]b4_parse_assert_if([
|
{]b4_parse_assert_if([
|
||||||
YY_ASSERT (!yytypeid_);
|
]b4_assert[ (!yytypeid_);
|
||||||
])[}
|
])[}
|
||||||
|
|
||||||
# if 201103L <= YY_CPLUSPLUS
|
# if 201103L <= YY_CPLUSPLUS
|
||||||
@@ -133,10 +140,10 @@ m4_define([b4_value_type_declare],
|
|||||||
template <typename T, typename... U>
|
template <typename T, typename... U>
|
||||||
T&
|
T&
|
||||||
emplace (U&&... u)
|
emplace (U&&... u)
|
||||||
{]b4_parse_assert_if([
|
{]b4_parse_assert_if([[
|
||||||
YY_ASSERT (!yytypeid_);
|
]b4_assert[ (!yytypeid_);
|
||||||
YY_ASSERT (sizeof (T) <= size);
|
]b4_assert[ (sizeof (T) <= size);
|
||||||
yytypeid_ = & typeid (T);])[
|
yytypeid_ = & typeid (T);]])[
|
||||||
return *new (yyas_<T> ()) T (std::forward <U>(u)...);
|
return *new (yyas_<T> ()) T (std::forward <U>(u)...);
|
||||||
}
|
}
|
||||||
# else
|
# else
|
||||||
@@ -144,10 +151,10 @@ m4_define([b4_value_type_declare],
|
|||||||
template <typename T>
|
template <typename T>
|
||||||
T&
|
T&
|
||||||
emplace ()
|
emplace ()
|
||||||
{]b4_parse_assert_if([
|
{]b4_parse_assert_if([[
|
||||||
YY_ASSERT (!yytypeid_);
|
]b4_assert[ (!yytypeid_);
|
||||||
YY_ASSERT (sizeof (T) <= size);
|
]b4_assert[ (sizeof (T) <= size);
|
||||||
yytypeid_ = & typeid (T);])[
|
yytypeid_ = & typeid (T);]])[
|
||||||
return *new (yyas_<T> ()) T ();
|
return *new (yyas_<T> ()) T ();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -155,10 +162,10 @@ m4_define([b4_value_type_declare],
|
|||||||
template <typename T>
|
template <typename T>
|
||||||
T&
|
T&
|
||||||
emplace (const T& t)
|
emplace (const T& t)
|
||||||
{]b4_parse_assert_if([
|
{]b4_parse_assert_if([[
|
||||||
YY_ASSERT (!yytypeid_);
|
]b4_assert[ (!yytypeid_);
|
||||||
YY_ASSERT (sizeof (T) <= size);
|
]b4_assert[ (sizeof (T) <= size);
|
||||||
yytypeid_ = & typeid (T);])[
|
yytypeid_ = & typeid (T);]])[
|
||||||
return *new (yyas_<T> ()) T (t);
|
return *new (yyas_<T> ()) T (t);
|
||||||
}
|
}
|
||||||
# endif
|
# endif
|
||||||
@@ -185,10 +192,10 @@ m4_define([b4_value_type_declare],
|
|||||||
template <typename T>
|
template <typename T>
|
||||||
T&
|
T&
|
||||||
as () YY_NOEXCEPT
|
as () YY_NOEXCEPT
|
||||||
{]b4_parse_assert_if([
|
{]b4_parse_assert_if([[
|
||||||
YY_ASSERT (yytypeid_);
|
]b4_assert[ (yytypeid_);
|
||||||
YY_ASSERT (*yytypeid_ == typeid (T));
|
]b4_assert[ (*yytypeid_ == typeid (T));
|
||||||
YY_ASSERT (sizeof (T) <= size);])[
|
]b4_assert[ (sizeof (T) <= size);]])[
|
||||||
return *yyas_<T> ();
|
return *yyas_<T> ();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -196,10 +203,10 @@ m4_define([b4_value_type_declare],
|
|||||||
template <typename T>
|
template <typename T>
|
||||||
const T&
|
const T&
|
||||||
as () const YY_NOEXCEPT
|
as () const YY_NOEXCEPT
|
||||||
{]b4_parse_assert_if([
|
{]b4_parse_assert_if([[
|
||||||
YY_ASSERT (yytypeid_);
|
]b4_assert[ (yytypeid_);
|
||||||
YY_ASSERT (*yytypeid_ == typeid (T));
|
]b4_assert[ (*yytypeid_ == typeid (T));
|
||||||
YY_ASSERT (sizeof (T) <= size);])[
|
]b4_assert[ (sizeof (T) <= size);]])[
|
||||||
return *yyas_<T> ();
|
return *yyas_<T> ();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -214,9 +221,9 @@ m4_define([b4_value_type_declare],
|
|||||||
template <typename T>
|
template <typename T>
|
||||||
void
|
void
|
||||||
swap (self_type& that) YY_NOEXCEPT
|
swap (self_type& that) YY_NOEXCEPT
|
||||||
{]b4_parse_assert_if([
|
{]b4_parse_assert_if([[
|
||||||
YY_ASSERT (yytypeid_);
|
]b4_assert[ (yytypeid_);
|
||||||
YY_ASSERT (*yytypeid_ == *that.yytypeid_);])[
|
]b4_assert[ (*yytypeid_ == *that.yytypeid_);]])[
|
||||||
std::swap (as<T> (), that.as<T> ());
|
std::swap (as<T> (), that.as<T> ());
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -267,7 +274,7 @@ m4_define([b4_value_type_declare],
|
|||||||
private:
|
private:
|
||||||
#if YY_CPLUSPLUS < 201103L
|
#if YY_CPLUSPLUS < 201103L
|
||||||
/// Non copyable.
|
/// Non copyable.
|
||||||
semantic_type (const self_type&);
|
value_type (const self_type&);
|
||||||
/// Non copyable.
|
/// Non copyable.
|
||||||
self_type& operator= (const self_type&);
|
self_type& operator= (const self_type&);
|
||||||
#endif
|
#endif
|
||||||
@@ -277,7 +284,7 @@ m4_define([b4_value_type_declare],
|
|||||||
T*
|
T*
|
||||||
yyas_ () YY_NOEXCEPT
|
yyas_ () YY_NOEXCEPT
|
||||||
{
|
{
|
||||||
void *yyp = yybuffer_.yyraw;
|
void *yyp = yyraw_;
|
||||||
return static_cast<T*> (yyp);
|
return static_cast<T*> (yyp);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -286,7 +293,7 @@ m4_define([b4_value_type_declare],
|
|||||||
const T*
|
const T*
|
||||||
yyas_ () const YY_NOEXCEPT
|
yyas_ () const YY_NOEXCEPT
|
||||||
{
|
{
|
||||||
const void *yyp = yybuffer_.yyraw;
|
const void *yyp = yyraw_;
|
||||||
return static_cast<const T*> (yyp);
|
return static_cast<const T*> (yyp);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -301,10 +308,10 @@ m4_define([b4_value_type_declare],
|
|||||||
union
|
union
|
||||||
{
|
{
|
||||||
/// Strongest alignment constraints.
|
/// Strongest alignment constraints.
|
||||||
long double yyalign_me;
|
long double yyalign_me_;
|
||||||
/// A buffer large enough to store any of the semantic values.
|
/// A buffer large enough to store any of the semantic values.
|
||||||
char yyraw[size];
|
char yyraw_[size];
|
||||||
} yybuffer_;]b4_parse_assert_if([
|
};]b4_parse_assert_if([
|
||||||
|
|
||||||
/// Whether the content is built: if defined, the name of the stored type.
|
/// Whether the content is built: if defined, the name of the stored type.
|
||||||
const std::type_info *yytypeid_;])[
|
const std::type_info *yytypeid_;])[
|
||||||
@@ -388,18 +395,74 @@ m4_define([_b4_token_maker_define],
|
|||||||
])])
|
])])
|
||||||
|
|
||||||
|
|
||||||
m4_define([_b4_type_clause],
|
# b4_token_kind(SYMBOL-NUM)
|
||||||
[b4_symbol_if([$1], [is_token],
|
# -------------------------
|
||||||
[b4_symbol_if([$1], [has_id],
|
# Some tokens don't have an ID.
|
||||||
[tok == token::b4_symbol([$1], [id])],
|
m4_define([b4_token_kind],
|
||||||
[tok == b4_symbol([$1], [user_number])])])])
|
[b4_symbol_if([$1], [has_id],
|
||||||
|
[token::b4_symbol([$1], [id])],
|
||||||
|
[b4_symbol([$1], [code])])])
|
||||||
|
|
||||||
|
|
||||||
# _b4_token_constructor_define(SYMBOL-NUM...)
|
# _b4_tok_in(SYMBOL-NUM, ...)
|
||||||
# -------------------------------------------
|
# ---------------------------
|
||||||
# Define a unique make_symbol for all the SYMBOL-NUM (they
|
# See b4_tok_in below. The SYMBOL-NUMs... are tokens only.
|
||||||
|
#
|
||||||
|
# We iterate over the tokens to group them by "range" of token numbers (not
|
||||||
|
# symbols numbers!).
|
||||||
|
#
|
||||||
|
# b4_fst is the start of that range.
|
||||||
|
# b4_prev is the previous value.
|
||||||
|
# b4_val is the current value.
|
||||||
|
# If b4_val is the successor of b4_prev in token numbers, update the latter,
|
||||||
|
# otherwise emit the code for range b4_fst .. b4_prev.
|
||||||
|
# $1 is also used as a terminator in the foreach, but it will not be printed.
|
||||||
|
#
|
||||||
|
m4_define([_b4_tok_in],
|
||||||
|
[m4_pushdef([b4_prev], [$1])dnl
|
||||||
|
m4_pushdef([b4_fst], [$1])dnl
|
||||||
|
m4_pushdef([b4_sep], [])dnl
|
||||||
|
m4_foreach([b4_val], m4_dquote(m4_shift($@, $1)),
|
||||||
|
[m4_if(b4_symbol(b4_val, [code]), m4_eval(b4_symbol(b4_prev, [code]) + 1), [],
|
||||||
|
[b4_sep[]m4_if(b4_fst, b4_prev,
|
||||||
|
[tok == b4_token_kind(b4_fst)],
|
||||||
|
[(b4_token_kind(b4_fst) <= tok && tok <= b4_token_kind(b4_prev))])[]dnl
|
||||||
|
m4_define([b4_fst], b4_val)dnl
|
||||||
|
m4_define([b4_sep], [
|
||||||
|
|| ])])dnl
|
||||||
|
m4_define([b4_prev], b4_val)])dnl
|
||||||
|
m4_popdef([b4_sep])dnl
|
||||||
|
m4_popdef([b4_fst])dnl
|
||||||
|
m4_popdef([b4_prev])dnl
|
||||||
|
])
|
||||||
|
|
||||||
|
|
||||||
|
# _b4_filter_tokens(SYMBOL-NUM, ...)
|
||||||
|
# ----------------------------------
|
||||||
|
# Expand as the list of tokens amongst SYMBOL-NUM.
|
||||||
|
m4_define([_b4_filter_tokens],
|
||||||
|
[m4_pushdef([b4_sep])dnl
|
||||||
|
m4_foreach([b4_val], [$@],
|
||||||
|
[b4_symbol_if(b4_val, [is_token], [b4_sep[]b4_val[]m4_define([b4_sep], [,])])])dnl
|
||||||
|
m4_popdef([b4_sep])dnl
|
||||||
|
])
|
||||||
|
|
||||||
|
|
||||||
|
# b4_tok_in(SYMBOL-NUM, ...)
|
||||||
|
# ---------------------------
|
||||||
|
# A C++ conditional that checks that `tok` is a member of this list of symbol
|
||||||
|
# numbers.
|
||||||
|
m4_define([b4_tok_in],
|
||||||
|
[_$0(_b4_filter_tokens($@))])
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# _b4_symbol_constructor_define(SYMBOL-NUM...)
|
||||||
|
# --------------------------------------------
|
||||||
|
# Define a symbol_type constructor common to all the SYMBOL-NUM (they
|
||||||
# have the same type). Use at class-level.
|
# have the same type). Use at class-level.
|
||||||
m4_define([_b4_token_constructor_define],
|
m4_define([_b4_symbol_constructor_define],
|
||||||
[m4_ifval(_b4_includes_tokens($@),
|
[m4_ifval(_b4_includes_tokens($@),
|
||||||
[[#if 201103L <= YY_CPLUSPLUS
|
[[#if 201103L <= YY_CPLUSPLUS
|
||||||
symbol_type (]b4_join(
|
symbol_type (]b4_join(
|
||||||
@@ -407,25 +470,24 @@ m4_define([_b4_token_constructor_define],
|
|||||||
b4_symbol_if([$1], [has_type],
|
b4_symbol_if([$1], [has_type],
|
||||||
[b4_symbol([$1], [type]) v]),
|
[b4_symbol([$1], [type]) v]),
|
||||||
b4_locations_if([location_type l]))[)
|
b4_locations_if([location_type l]))[)
|
||||||
: super_type(]b4_join([token_type (tok)],
|
: super_type (]b4_join([token_type (tok)],
|
||||||
b4_symbol_if([$1], [has_type], [std::move (v)]),
|
b4_symbol_if([$1], [has_type], [std::move (v)]),
|
||||||
b4_locations_if([std::move (l)]))[)
|
b4_locations_if([std::move (l)]))[)
|
||||||
{
|
|
||||||
YY_ASSERT (]m4_join([ || ], m4_map_sep([_b4_type_clause], [, ], [$@]))[);
|
|
||||||
}
|
|
||||||
#else
|
#else
|
||||||
symbol_type (]b4_join(
|
symbol_type (]b4_join(
|
||||||
[int tok],
|
[int tok],
|
||||||
b4_symbol_if([$1], [has_type],
|
b4_symbol_if([$1], [has_type],
|
||||||
[const b4_symbol([$1], [type])& v]),
|
[const b4_symbol([$1], [type])& v]),
|
||||||
b4_locations_if([const location_type& l]))[)
|
b4_locations_if([const location_type& l]))[)
|
||||||
: super_type(]b4_join([token_type (tok)],
|
: super_type (]b4_join([token_type (tok)],
|
||||||
b4_symbol_if([$1], [has_type], [v]),
|
b4_symbol_if([$1], [has_type], [v]),
|
||||||
b4_locations_if([l]))[)
|
b4_locations_if([l]))[)
|
||||||
{
|
|
||||||
YY_ASSERT (]m4_join([ || ], m4_map_sep([_b4_type_clause], [, ], [$@]))[);
|
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
|
{]b4_parse_assert_if([[
|
||||||
|
#if !defined _MSC_VER || defined __clang__
|
||||||
|
]b4_assert[ (]b4_tok_in($@)[);
|
||||||
|
#endif
|
||||||
|
]])[}
|
||||||
]])])
|
]])])
|
||||||
|
|
||||||
|
|
||||||
@@ -457,7 +519,7 @@ m4_define([b4_basic_symbol_constructor_define],
|
|||||||
|
|
||||||
# b4_token_constructor_define
|
# b4_token_constructor_define
|
||||||
# ---------------------------
|
# ---------------------------
|
||||||
# Define the overloaded versions of make_symbol for all the value types.
|
# Define the overloaded versions of make_FOO for all the token kinds.
|
||||||
m4_define([b4_token_constructor_define],
|
m4_define([b4_token_constructor_define],
|
||||||
[ // Implementation of make_symbol for each symbol type.
|
[ // Implementation of make_symbol for each token kind.
|
||||||
b4_symbol_foreach([_b4_token_maker_define])])
|
b4_symbol_foreach([_b4_token_maker_define])])
|
||||||
|
|||||||
+274
-164
@@ -1,11 +1,11 @@
|
|||||||
# -*- C -*-
|
# -*- C -*-
|
||||||
# Yacc compatible skeleton for Bison
|
# Yacc compatible skeleton for Bison
|
||||||
|
|
||||||
# Copyright (C) 1984, 1989-1990, 2000-2015, 2018-2020 Free Software
|
# Copyright (C) 1984, 1989-1990, 2000-2015, 2018-2021 Free Software
|
||||||
# Foundation, Inc.
|
# Foundation, Inc.
|
||||||
|
|
||||||
m4_pushdef([b4_copyright_years],
|
m4_pushdef([b4_copyright_years],
|
||||||
[1984, 1989-1990, 2000-2015, 2018-2020])
|
[1984, 1989-1990, 2000-2015, 2018-2021])
|
||||||
|
|
||||||
# This program is free software: you can redistribute it and/or modify
|
# This program is free software: you can redistribute it and/or modify
|
||||||
# it under the terms of the GNU General Public License as published by
|
# it under the terms of the GNU General Public License as published by
|
||||||
@@ -18,10 +18,11 @@ m4_pushdef([b4_copyright_years],
|
|||||||
# GNU General Public License for more details.
|
# GNU General Public License for more details.
|
||||||
#
|
#
|
||||||
# You should have received a copy of the GNU General Public License
|
# You should have received a copy of the GNU General Public License
|
||||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
m4_include(b4_skeletonsdir/[c.m4])
|
m4_include(b4_skeletonsdir/[c.m4])
|
||||||
|
|
||||||
|
|
||||||
## ---------- ##
|
## ---------- ##
|
||||||
## api.pure. ##
|
## api.pure. ##
|
||||||
## ---------- ##
|
## ---------- ##
|
||||||
@@ -48,6 +49,10 @@ m4_define([b4_pure_if],
|
|||||||
## api.push-pull. ##
|
## api.push-pull. ##
|
||||||
## --------------- ##
|
## --------------- ##
|
||||||
|
|
||||||
|
# b4_pull_if, b4_push_if
|
||||||
|
# ----------------------
|
||||||
|
# Whether the pull/push APIs are needed. Both can be enabled.
|
||||||
|
|
||||||
b4_percent_define_default([[api.push-pull]], [[pull]])
|
b4_percent_define_default([[api.push-pull]], [[pull]])
|
||||||
b4_percent_define_check_values([[[[api.push-pull]],
|
b4_percent_define_check_values([[[[api.push-pull]],
|
||||||
[[pull]], [[push]], [[both]]]])
|
[[pull]], [[push]], [[both]]]])
|
||||||
@@ -97,6 +102,16 @@ m4_define([b4_yyerror_arg_loc_if],
|
|||||||
[1], [m4_ifset([b4_parse_param], [$1])],
|
[1], [m4_ifset([b4_parse_param], [$1])],
|
||||||
[2], [$1])])])
|
[2], [$1])])])
|
||||||
|
|
||||||
|
# b4_yyerror_formals
|
||||||
|
# ------------------
|
||||||
|
m4_define([b4_yyerror_formals],
|
||||||
|
[b4_pure_if([b4_locations_if([, [[const ]b4_api_PREFIX[LTYPE *yyllocp], [&yylloc]]])[]dnl
|
||||||
|
m4_ifdef([b4_parse_param], [, b4_parse_param])[]dnl
|
||||||
|
,])dnl
|
||||||
|
[[const char *msg], [msg]]])
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# b4_yyerror_args
|
# b4_yyerror_args
|
||||||
# ---------------
|
# ---------------
|
||||||
# Arguments passed to yyerror: user args plus yylloc.
|
# Arguments passed to yyerror: user args plus yylloc.
|
||||||
@@ -111,6 +126,16 @@ m4_ifset([b4_parse_param], [b4_args(b4_parse_param), ])])
|
|||||||
## ----------------- ##
|
## ----------------- ##
|
||||||
|
|
||||||
|
|
||||||
|
# b4_accept([SYMBOL-NUM])
|
||||||
|
# -----------------------
|
||||||
|
# Used in actions of the rules of accept, the initial symbol, to call
|
||||||
|
# YYACCEPT. If SYMBOL-NUM is specified, run "yyvalue->SLOT = $2;"
|
||||||
|
# before, using the slot of SYMBOL-NUM.
|
||||||
|
m4_define([b4_accept],
|
||||||
|
[m4_ifval([$1],
|
||||||
|
[b4_symbol_value(yyimpl->yyvalue, [$1]) = b4_rhs_value(2, 1, [$1]); ]) YYACCEPT])
|
||||||
|
|
||||||
|
|
||||||
# b4_lhs_value(SYMBOL-NUM, [TYPE])
|
# b4_lhs_value(SYMBOL-NUM, [TYPE])
|
||||||
# --------------------------------
|
# --------------------------------
|
||||||
# See README.
|
# See README.
|
||||||
@@ -150,14 +175,61 @@ m4_define([b4_rhs_location],
|
|||||||
## Declarations. ##
|
## Declarations. ##
|
||||||
## -------------- ##
|
## -------------- ##
|
||||||
|
|
||||||
|
# _b4_declare_sub_yyparse(START-SYMBOL-NUM, SWITCHING-TOKEN-SYMBOL-NUM)
|
||||||
|
# ---------------------------------------------------------------------
|
||||||
|
# Define the return type of the parsing function for SYMBOL-NUM, and
|
||||||
|
# declare its parsing function.
|
||||||
|
m4_define([_b4_declare_sub_yyparse],
|
||||||
|
[[
|
||||||
|
// Return type when parsing one ]_b4_symbol($1, tag)[.
|
||||||
|
typedef struct
|
||||||
|
{]b4_symbol_if([$1], [has_type], [[
|
||||||
|
]_b4_symbol($1, type)[ yyvalue;]])[
|
||||||
|
int yystatus;
|
||||||
|
int yynerrs;
|
||||||
|
} ]b4_prefix[parse_]_b4_symbol($1, id)[_t;
|
||||||
|
|
||||||
|
// Parse one ]_b4_symbol($1, tag)[.
|
||||||
|
]b4_prefix[parse_]_b4_symbol($1, id)[_t ]b4_prefix[parse_]_b4_symbol($1, id)[ (]m4_ifset([b4_parse_param], [b4_formals(b4_parse_param)], [void])[);
|
||||||
|
]])
|
||||||
|
|
||||||
|
|
||||||
|
# _b4_first_switching_token
|
||||||
|
# -------------------------
|
||||||
|
m4_define([b4_first], [$1])
|
||||||
|
m4_define([b4_second], [$2])
|
||||||
|
m4_define([_b4_first_switching_token],
|
||||||
|
[b4_second(b4_first(b4_start_symbols))])
|
||||||
|
|
||||||
|
|
||||||
|
# _b4_define_sub_yyparse(START-SYMBOL-NUM, SWITCHING-TOKEN-SYMBOL-NUM)
|
||||||
|
# --------------------------------------------------------------------
|
||||||
|
# Define the parsing function for START-SYMBOL-NUM.
|
||||||
|
m4_define([_b4_define_sub_yyparse],
|
||||||
|
[[
|
||||||
|
]b4_prefix[parse_]_b4_symbol($1, id)[_t
|
||||||
|
]b4_prefix[parse_]_b4_symbol($1, id)[ (]m4_ifset([b4_parse_param], [b4_formals(b4_parse_param)], [void])[)
|
||||||
|
{
|
||||||
|
]b4_prefix[parse_]_b4_symbol($1, id)[_t yyres;
|
||||||
|
yy_parse_impl_t yyimpl;
|
||||||
|
yyres.yystatus = yy_parse_impl (]b4_symbol($2, id)[, &yyimpl]m4_ifset([b4_parse_param],
|
||||||
|
[[, ]b4_args(b4_parse_param)])[);]b4_symbol_if([$1], [has_type], [[
|
||||||
|
yyres.yyvalue = yyimpl.yyvalue.]b4_symbol($1, slot)[;]])[
|
||||||
|
yyres.yynerrs = yyimpl.yynerrs;
|
||||||
|
return yyres;
|
||||||
|
}
|
||||||
|
]])
|
||||||
|
|
||||||
|
|
||||||
# b4_declare_scanner_communication_variables
|
# b4_declare_scanner_communication_variables
|
||||||
# ------------------------------------------
|
# ------------------------------------------
|
||||||
# Declare the variables that are global, or local to YYPARSE if
|
# Declare the variables that are global, or local to YYPARSE if
|
||||||
# pure-parser.
|
# pure-parser.
|
||||||
m4_define([b4_declare_scanner_communication_variables], [[
|
m4_define([b4_declare_scanner_communication_variables], [[
|
||||||
/* The lookahead symbol. */
|
]m4_ifdef([b4_start_symbols], [],
|
||||||
|
[[/* Lookahead token kind. */
|
||||||
int yychar;
|
int yychar;
|
||||||
|
]])[
|
||||||
]b4_pure_if([[
|
]b4_pure_if([[
|
||||||
/* The semantic value of the lookahead symbol. */
|
/* The semantic value of the lookahead symbol. */
|
||||||
/* Default value used for initialization, for pacifying older GCCs
|
/* Default value used for initialization, for pacifying older GCCs
|
||||||
@@ -176,68 +248,47 @@ YYLTYPE yylloc]b4_yyloc_default[;]])[
|
|||||||
int yynerrs;]])])
|
int yynerrs;]])])
|
||||||
|
|
||||||
|
|
||||||
# b4_declare_parser_state_variables
|
# b4_declare_parser_state_variables([INIT])
|
||||||
# ---------------------------------
|
# -----------------------------------------
|
||||||
# Declare all the variables that are needed to maintain the parser state
|
# Declare all the variables that are needed to maintain the parser state
|
||||||
# between calls to yypush_parse.
|
# between calls to yypush_parse.
|
||||||
|
# If INIT is non-null, initialize these variables.
|
||||||
m4_define([b4_declare_parser_state_variables],
|
m4_define([b4_declare_parser_state_variables],
|
||||||
[b4_pure_if([[
|
[b4_pure_if([[
|
||||||
/* Number of syntax errors so far. */
|
/* Number of syntax errors so far. */
|
||||||
int yynerrs;
|
int yynerrs]m4_ifval([$1], [ = 0])[;
|
||||||
]])[
|
]])[
|
||||||
yy_state_fast_t yystate;
|
yy_state_fast_t yystate]m4_ifval([$1], [ = 0])[;
|
||||||
/* Number of tokens to shift before error messages enabled. */
|
/* Number of tokens to shift before error messages enabled. */
|
||||||
int yyerrstatus;
|
int yyerrstatus]m4_ifval([$1], [ = 0])[;
|
||||||
|
|
||||||
/* The stacks and their tools:
|
/* Refer to the stacks through separate pointers, to allow yyoverflow
|
||||||
'yyss': related to states.
|
|
||||||
'yyvs': related to semantic values.]b4_locations_if([[
|
|
||||||
'yyls': related to locations.]])[
|
|
||||||
|
|
||||||
Refer to the stacks through separate pointers, to allow yyoverflow
|
|
||||||
to reallocate them elsewhere. */
|
to reallocate them elsewhere. */
|
||||||
|
|
||||||
/* Their size. */
|
/* Their size. */
|
||||||
YYPTRDIFF_T yystacksize;
|
YYPTRDIFF_T yystacksize]m4_ifval([$1], [ = YYINITDEPTH])[;
|
||||||
|
|
||||||
/* The state stack. */
|
/* The state stack: array, bottom, top. */
|
||||||
yy_state_t yyssa[YYINITDEPTH];
|
yy_state_t yyssa[YYINITDEPTH];
|
||||||
yy_state_t *yyss;
|
yy_state_t *yyss]m4_ifval([$1], [ = yyssa])[;
|
||||||
yy_state_t *yyssp;
|
yy_state_t *yyssp]m4_ifval([$1], [ = yyss])[;
|
||||||
|
|
||||||
/* The semantic value stack. */
|
/* The semantic value stack: array, bottom, top. */
|
||||||
YYSTYPE yyvsa[YYINITDEPTH];
|
YYSTYPE yyvsa[YYINITDEPTH];
|
||||||
YYSTYPE *yyvs;
|
YYSTYPE *yyvs]m4_ifval([$1], [ = yyvsa])[;
|
||||||
YYSTYPE *yyvsp;]b4_locations_if([[
|
YYSTYPE *yyvsp]m4_ifval([$1], [ = yyvs])[;]b4_locations_if([[
|
||||||
|
|
||||||
/* The location stack. */
|
/* The location stack: array, bottom, top. */
|
||||||
YYLTYPE yylsa[YYINITDEPTH];
|
YYLTYPE yylsa[YYINITDEPTH];
|
||||||
YYLTYPE *yyls;
|
YYLTYPE *yyls]m4_ifval([$1], [ = yylsa])[;
|
||||||
YYLTYPE *yylsp;]])[]b4_lac_if([[
|
YYLTYPE *yylsp]m4_ifval([$1], [ = yyls])[;]])[]b4_lac_if([[
|
||||||
|
|
||||||
yy_state_t yyesa@{]b4_percent_define_get([[parse.lac.es-capacity-initial]])[@};
|
yy_state_t yyesa@{]b4_percent_define_get([[parse.lac.es-capacity-initial]])[@};
|
||||||
yy_state_t *yyes;
|
yy_state_t *yyes]m4_ifval([$1], [ = yyesa])[;
|
||||||
YYPTRDIFF_T yyes_capacity;]])])
|
YYPTRDIFF_T yyes_capacity][]m4_ifval([$1],
|
||||||
|
[m4_do([ = b4_percent_define_get([[parse.lac.es-capacity-initial]]) < YYMAXDEPTH],
|
||||||
|
[ ? b4_percent_define_get([[parse.lac.es-capacity-initial]])],
|
||||||
# b4_initialize_parser_state_variables
|
[ : YYMAXDEPTH])])[;]])])
|
||||||
# ------------------------------------
|
|
||||||
# Initialize these variables.
|
|
||||||
m4_define([b4_initialize_parser_state_variables],
|
|
||||||
[[ yynerrs = 0;
|
|
||||||
yystate = 0;
|
|
||||||
yyerrstatus = 0;
|
|
||||||
|
|
||||||
yystacksize = YYINITDEPTH;
|
|
||||||
yyssp = yyss = yyssa;
|
|
||||||
yyvsp = yyvs = yyvsa;]b4_locations_if([[
|
|
||||||
yylsp = yyls = yylsa;]])[]b4_lac_if([[
|
|
||||||
|
|
||||||
yyes = yyesa;
|
|
||||||
yyes_capacity = ]b4_percent_define_get([[parse.lac.es-capacity-initial]])[;
|
|
||||||
if (YYMAXDEPTH < yyes_capacity)
|
|
||||||
yyes_capacity = YYMAXDEPTH;]])[
|
|
||||||
]])
|
|
||||||
|
|
||||||
|
|
||||||
m4_define([b4_macro_define],
|
m4_define([b4_macro_define],
|
||||||
@@ -293,11 +344,14 @@ int ]b4_prefix[push_parse (]b4_prefix[pstate *ps]b4_pure_if([[,
|
|||||||
void ]b4_prefix[pstate_delete (]b4_prefix[pstate *ps);
|
void ]b4_prefix[pstate_delete (]b4_prefix[pstate *ps);
|
||||||
]])
|
]])
|
||||||
|
|
||||||
|
|
||||||
# _b4_declare_yyparse
|
# _b4_declare_yyparse
|
||||||
# -------------------
|
# -------------------
|
||||||
# When not the push parser.
|
# When not the push parser.
|
||||||
m4_define([_b4_declare_yyparse],
|
m4_define([_b4_declare_yyparse],
|
||||||
[[int ]b4_prefix[parse (]m4_ifset([b4_parse_param], [b4_formals(b4_parse_param)], [void])[);]])
|
[[int ]b4_prefix[parse (]m4_ifset([b4_parse_param], [b4_formals(b4_parse_param)], [void])[);
|
||||||
|
]m4_ifdef([b4_start_symbols],
|
||||||
|
[m4_map([_b4_declare_sub_yyparse], m4_defn([b4_start_symbols]))])])
|
||||||
|
|
||||||
|
|
||||||
# b4_declare_yyparse
|
# b4_declare_yyparse
|
||||||
@@ -308,19 +362,35 @@ m4_define([b4_declare_yyparse],
|
|||||||
])
|
])
|
||||||
|
|
||||||
|
|
||||||
|
# b4_declare_yyerror_and_yylex
|
||||||
|
# ----------------------------
|
||||||
|
# Comply with POSIX Yacc.
|
||||||
|
# <https://austingroupbugs.net/view.php?id=1388#c5220>
|
||||||
|
m4_define([b4_declare_yyerror_and_yylex],
|
||||||
|
[b4_yacc_if([[#if !defined ]b4_prefix[error && !defined ]b4_api_PREFIX[ERROR_IS_DECLARED
|
||||||
|
]b4_function_declare([b4_prefix[error]], void, b4_yyerror_formals)[
|
||||||
|
#endif
|
||||||
|
#if !defined ]b4_prefix[lex && !defined ]b4_api_PREFIX[LEX_IS_DECLARED
|
||||||
|
]b4_function_declare([b4_prefix[lex]], int, b4_yylex_formals)[
|
||||||
|
#endif
|
||||||
|
]])dnl
|
||||||
|
])
|
||||||
|
|
||||||
|
|
||||||
# b4_shared_declarations
|
# b4_shared_declarations
|
||||||
# ----------------------
|
# ----------------------
|
||||||
# Declaration that might either go into the header (if --defines)
|
# Declarations that might either go into the header (if --header)
|
||||||
# or open coded in the parser body.
|
# or into the implementation file.
|
||||||
m4_define([b4_shared_declarations],
|
m4_define([b4_shared_declarations],
|
||||||
[b4_cpp_guard_open([b4_spec_header_file])[
|
[b4_cpp_guard_open([b4_spec_mapped_header_file])[
|
||||||
]b4_declare_yydebug[
|
]b4_declare_yydebug[
|
||||||
]b4_percent_code_get([[requires]])[
|
]b4_percent_code_get([[requires]])[
|
||||||
]b4_token_enums_defines[
|
]b4_token_enums_defines[
|
||||||
]b4_declare_yylstype[
|
]b4_declare_yylstype[
|
||||||
|
]b4_declare_yyerror_and_yylex[
|
||||||
]b4_declare_yyparse[
|
]b4_declare_yyparse[
|
||||||
]b4_percent_code_get([[provides]])[
|
]b4_percent_code_get([[provides]])[
|
||||||
]b4_cpp_guard_close([b4_spec_header_file])[]dnl
|
]b4_cpp_guard_close([b4_spec_mapped_header_file])[]dnl
|
||||||
])
|
])
|
||||||
|
|
||||||
|
|
||||||
@@ -335,7 +405,7 @@ m4_define([b4_header_include_if],
|
|||||||
[$2])],
|
[$2])],
|
||||||
[$2])])
|
[$2])])
|
||||||
|
|
||||||
m4_if(b4_spec_header_file, [[y.tab.h]],
|
m4_if(b4_spec_header_file, [y.tab.h], [],
|
||||||
[b4_percent_define_default([[api.header.include]],
|
[b4_percent_define_default([[api.header.include]],
|
||||||
[["@basename(]b4_spec_header_file[@)"]])])
|
[["@basename(]b4_spec_header_file[@)"]])])
|
||||||
|
|
||||||
@@ -347,13 +417,13 @@ m4_if(b4_spec_header_file, [[y.tab.h]],
|
|||||||
## -------------- ##
|
## -------------- ##
|
||||||
|
|
||||||
|
|
||||||
b4_defines_if([[
|
b4_header_if([[
|
||||||
]b4_output_begin([b4_spec_header_file])[
|
]b4_output_begin([b4_spec_header_file])[
|
||||||
]b4_copyright([Bison interface for Yacc-like parsers in C])[
|
]b4_copyright([Bison interface for Yacc-like parsers in C])[
|
||||||
]b4_disclaimer[
|
]b4_disclaimer[
|
||||||
]b4_shared_declarations[
|
]b4_shared_declarations[
|
||||||
]b4_output_end[
|
]b4_output_end[
|
||||||
]])# b4_defines_if
|
]])# b4_header_if
|
||||||
|
|
||||||
b4_output_begin([b4_parser_file_name])[
|
b4_output_begin([b4_parser_file_name])[
|
||||||
]b4_copyright([Bison implementation for Yacc-like parsers in C])[
|
]b4_copyright([Bison implementation for Yacc-like parsers in C])[
|
||||||
@@ -592,7 +662,8 @@ union yyalloc
|
|||||||
/* YYNSTATES -- Number of states. */
|
/* YYNSTATES -- Number of states. */
|
||||||
#define YYNSTATES ]b4_states_number[
|
#define YYNSTATES ]b4_states_number[
|
||||||
|
|
||||||
#define YYMAXUTOK ]b4_user_token_number_max[
|
/* YYMAXUTOK -- Last valid token kind. */
|
||||||
|
#define YYMAXUTOK ]b4_code_max[
|
||||||
|
|
||||||
|
|
||||||
/* YYTRANSLATE(TOKEN-NUM) -- Symbol number corresponding to TOKEN-NUM
|
/* YYTRANSLATE(TOKEN-NUM) -- Symbol number corresponding to TOKEN-NUM
|
||||||
@@ -657,15 +728,6 @@ yysymbol_name (yysymbol_kind_t yysymbol)
|
|||||||
}]])[
|
}]])[
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef YYPRINT
|
|
||||||
/* YYTOKNUM[NUM] -- (External) token number corresponding to the
|
|
||||||
(internal) symbol number NUM (which must be that of a token). */
|
|
||||||
static const ]b4_int_type_for([b4_toknum])[ yytoknum[] =
|
|
||||||
{
|
|
||||||
]b4_toknum[
|
|
||||||
};
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#define YYPACT_NINF (]b4_pact_ninf[)
|
#define YYPACT_NINF (]b4_pact_ninf[)
|
||||||
|
|
||||||
#define yypact_value_is_default(Yyn) \
|
#define yypact_value_is_default(Yyn) \
|
||||||
@@ -681,18 +743,19 @@ static const ]b4_int_type_for([b4_toknum])[ yytoknum[] =
|
|||||||
enum { YYENOMEM = -2 };
|
enum { YYENOMEM = -2 };
|
||||||
|
|
||||||
#define yyerrok (yyerrstatus = 0)
|
#define yyerrok (yyerrstatus = 0)
|
||||||
#define yyclearin (yychar = ]b4_symbol(-2, id)[)
|
#define yyclearin (yychar = ]b4_symbol(empty, id)[)
|
||||||
|
|
||||||
#define YYACCEPT goto yyacceptlab
|
#define YYACCEPT goto yyacceptlab
|
||||||
#define YYABORT goto yyabortlab
|
#define YYABORT goto yyabortlab
|
||||||
#define YYERROR goto yyerrorlab
|
#define YYERROR goto yyerrorlab
|
||||||
|
#define YYNOMEM goto yyexhaustedlab
|
||||||
|
|
||||||
|
|
||||||
#define YYRECOVERING() (!!yyerrstatus)
|
#define YYRECOVERING() (!!yyerrstatus)
|
||||||
|
|
||||||
#define YYBACKUP(Token, Value) \
|
#define YYBACKUP(Token, Value) \
|
||||||
do \
|
do \
|
||||||
if (yychar == ]b4_symbol(-2, id)[) \
|
if (yychar == ]b4_symbol(empty, id)[) \
|
||||||
{ \
|
{ \
|
||||||
yychar = (Token); \
|
yychar = (Token); \
|
||||||
yylval = (Value); \
|
yylval = (Value); \
|
||||||
@@ -709,8 +772,8 @@ enum { YYENOMEM = -2 };
|
|||||||
while (0)
|
while (0)
|
||||||
|
|
||||||
/* Backward compatibility with an undocumented macro.
|
/* Backward compatibility with an undocumented macro.
|
||||||
Use ]b4_symbol(1, id)[ or ]b4_symbol(2, id)[. */
|
Use ]b4_symbol(error, id)[ or ]b4_symbol(undef, id)[. */
|
||||||
#define YYERRCODE ]b4_symbol(2, id)[
|
#define YYERRCODE ]b4_symbol(undef, id)[
|
||||||
]b4_locations_if([[
|
]b4_locations_if([[
|
||||||
]b4_yylloc_default_define[
|
]b4_yylloc_default_define[
|
||||||
#define YYRHSLOC(Rhs, K) ((Rhs)[K])
|
#define YYRHSLOC(Rhs, K) ((Rhs)[K])
|
||||||
@@ -730,7 +793,7 @@ do { \
|
|||||||
YYFPRINTF Args; \
|
YYFPRINTF Args; \
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
]b4_yy_location_print_define[
|
]b4_yylocation_print_define[
|
||||||
|
|
||||||
# define YY_SYMBOL_PRINT(Title, Kind, Value, Location) \
|
# define YY_SYMBOL_PRINT(Title, Kind, Value, Location) \
|
||||||
do { \
|
do { \
|
||||||
@@ -829,7 +892,8 @@ int yydebug;
|
|||||||
/* Parser data structure. */
|
/* Parser data structure. */
|
||||||
struct yypstate
|
struct yypstate
|
||||||
{]b4_declare_parser_state_variables[
|
{]b4_declare_parser_state_variables[
|
||||||
/* Whether this instance has not started parsing yet. */
|
/* Whether this instance has not started parsing yet.
|
||||||
|
* If 2, it corresponds to a finished parsing. */
|
||||||
int yynew;
|
int yynew;
|
||||||
};]b4_pure_if([], [[
|
};]b4_pure_if([], [[
|
||||||
|
|
||||||
@@ -940,7 +1004,7 @@ do { \
|
|||||||
switch (yy_lac (yyesa, &yyes, &yyes_capacity, yyssp, yytoken)) \
|
switch (yy_lac (yyesa, &yyes, &yyes_capacity, yyssp, yytoken)) \
|
||||||
{ \
|
{ \
|
||||||
case YYENOMEM: \
|
case YYENOMEM: \
|
||||||
goto yyexhaustedlab; \
|
YYNOMEM; \
|
||||||
case 1: \
|
case 1: \
|
||||||
goto yyerrlab; \
|
goto yyerrlab; \
|
||||||
} \
|
} \
|
||||||
@@ -1118,7 +1182,7 @@ yypcontext_expected_tokens (const yypcontext_t *yyctx,
|
|||||||
for (yyx = 0; yyx < YYNTOKENS; ++yyx)
|
for (yyx = 0; yyx < YYNTOKENS; ++yyx)
|
||||||
{
|
{
|
||||||
yysymbol_kind_t yysym = YY_CAST (yysymbol_kind_t, yyx);
|
yysymbol_kind_t yysym = YY_CAST (yysymbol_kind_t, yyx);
|
||||||
if (yysym != ]b4_symbol(1, kind)[ && yysym != ]b4_symbol_prefix[YYUNDEF)
|
if (yysym != ]b4_symbol(error, kind)[ && yysym != ]b4_symbol_prefix[YYUNDEF)
|
||||||
switch (yy_lac (]b4_push_if([[yyps->yyesa, &yyps->yyes, &yyps->yyes_capacity, yyps->yyssp, yysym]],
|
switch (yy_lac (]b4_push_if([[yyps->yyesa, &yyps->yyes, &yyps->yyes_capacity, yyps->yyssp, yysym]],
|
||||||
[[yyctx->yyesa, yyctx->yyes, yyctx->yyes_capacity, yyctx->yyssp, yysym]])[))
|
[[yyctx->yyesa, yyctx->yyes, yyctx->yyes_capacity, yyctx->yyssp, yysym]])[))
|
||||||
{
|
{
|
||||||
@@ -1147,7 +1211,7 @@ yypcontext_expected_tokens (const yypcontext_t *yyctx,
|
|||||||
int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
|
int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
|
||||||
int yyx;
|
int yyx;
|
||||||
for (yyx = yyxbegin; yyx < yyxend; ++yyx)
|
for (yyx = yyxbegin; yyx < yyxend; ++yyx)
|
||||||
if (yycheck[yyx + yyn] == yyx && yyx != ]b4_symbol(1, kind)[
|
if (yycheck[yyx + yyn] == yyx && yyx != ]b4_symbol(error, kind)[
|
||||||
&& !yytable_value_is_error (yytable[yyx + yyn]))
|
&& !yytable_value_is_error (yytable[yyx + yyn]))
|
||||||
{
|
{
|
||||||
if (!yyarg)
|
if (!yyarg)
|
||||||
@@ -1159,7 +1223,7 @@ yypcontext_expected_tokens (const yypcontext_t *yyctx,
|
|||||||
}
|
}
|
||||||
}]])[
|
}]])[
|
||||||
if (yyarg && yycount == 0 && 0 < yyargn)
|
if (yyarg && yycount == 0 && 0 < yyargn)
|
||||||
yyarg[0] = ]b4_symbol(-2, kind)[;
|
yyarg[0] = ]b4_symbol(empty, kind)[;
|
||||||
return yycount;
|
return yycount;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1322,7 +1386,7 @@ yy_syntax_error_arguments (const yypcontext_t *yyctx,
|
|||||||
one exception: it will still contain any token that will not be
|
one exception: it will still contain any token that will not be
|
||||||
accepted due to an error action in a later state.]])[
|
accepted due to an error action in a later state.]])[
|
||||||
*/
|
*/
|
||||||
if (yyctx->yytoken != ]b4_symbol(-2, kind)[)
|
if (yyctx->yytoken != ]b4_symbol(empty, kind)[)
|
||||||
{
|
{
|
||||||
int yyn;]b4_lac_if([[
|
int yyn;]b4_lac_if([[
|
||||||
YYDPRINTF ((stderr, "Constructing syntax error message\n"));]])[
|
YYDPRINTF ((stderr, "Constructing syntax error message\n"));]])[
|
||||||
@@ -1444,36 +1508,33 @@ yysyntax_error (YYPTRDIFF_T *yymsg_alloc, char **yymsg,
|
|||||||
int
|
int
|
||||||
yyparse (]m4_ifset([b4_parse_param], [b4_formals(b4_parse_param)], [void])[)
|
yyparse (]m4_ifset([b4_parse_param], [b4_formals(b4_parse_param)], [void])[)
|
||||||
{
|
{
|
||||||
return yypull_parse (YY_NULLPTR]b4_user_args[);
|
yypstate *yyps = yypstate_new ();
|
||||||
|
if (!yyps)
|
||||||
|
{]b4_pure_if([b4_locations_if([[
|
||||||
|
static YYLTYPE yyloc_default][]b4_yyloc_default[;
|
||||||
|
YYLTYPE yylloc = yyloc_default;]])[
|
||||||
|
yyerror (]b4_yyerror_args[YY_("memory exhausted"));]], [[
|
||||||
|
if (!yypstate_allocated)
|
||||||
|
yyerror (]b4_yyerror_args[YY_("memory exhausted"));]])[
|
||||||
|
return 2;
|
||||||
|
}
|
||||||
|
int yystatus = yypull_parse (yyps]b4_user_args[);
|
||||||
|
yypstate_delete (yyps);
|
||||||
|
return yystatus;
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
yypull_parse (yypstate *yyps]b4_user_formals[)
|
yypull_parse (yypstate *yyps]b4_user_formals[)
|
||||||
{]b4_pure_if([b4_locations_if([[
|
{
|
||||||
|
YY_ASSERT (yyps);]b4_pure_if([b4_locations_if([[
|
||||||
static YYLTYPE yyloc_default][]b4_yyloc_default[;
|
static YYLTYPE yyloc_default][]b4_yyloc_default[;
|
||||||
YYLTYPE yylloc = yyloc_default;]])])[
|
YYLTYPE yylloc = yyloc_default;]])])[
|
||||||
yypstate *yyps_local;
|
|
||||||
if (yyps)
|
|
||||||
yyps_local = yyps;
|
|
||||||
else
|
|
||||||
{
|
|
||||||
yyps_local = yypstate_new ();
|
|
||||||
if (!yyps_local)
|
|
||||||
{]b4_pure_if([[
|
|
||||||
yyerror (]b4_yyerror_args[YY_("memory exhausted"));]], [[
|
|
||||||
if (!yypstate_allocated)
|
|
||||||
yyerror (]b4_yyerror_args[YY_("memory exhausted"));]])[
|
|
||||||
return 2;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
int yystatus;
|
int yystatus;
|
||||||
do {
|
do {
|
||||||
]b4_pure_if([[ YYSTYPE yylval;
|
]b4_pure_if([[ YYSTYPE yylval;
|
||||||
int ]])[yychar = ]b4_lex[;
|
int ]])[yychar = ]b4_yylex[;
|
||||||
yystatus = yypush_parse (yyps_local]b4_pure_if([[, yychar, &yylval]b4_locations_if([[, &yylloc]])])m4_ifset([b4_parse_param], [, b4_args(b4_parse_param)])[);
|
yystatus = yypush_parse (yyps]b4_pure_if([[, yychar, &yylval]b4_locations_if([[, &yylloc]])])m4_ifset([b4_parse_param], [, b4_args(b4_parse_param)])[);
|
||||||
} while (yystatus == YYPUSH_MORE);
|
} while (yystatus == YYPUSH_MORE);
|
||||||
if (!yyps)
|
|
||||||
yypstate_delete (yyps_local);
|
|
||||||
return yystatus;
|
return yystatus;
|
||||||
}]])[
|
}]])[
|
||||||
|
|
||||||
@@ -1483,10 +1544,18 @@ yypull_parse (yypstate *yyps]b4_user_formals[)
|
|||||||
static void
|
static void
|
||||||
yypstate_clear (yypstate *yyps)
|
yypstate_clear (yypstate *yyps)
|
||||||
{
|
{
|
||||||
]b4_initialize_parser_state_variables[
|
yynerrs = 0;
|
||||||
|
yystate = 0;
|
||||||
|
yyerrstatus = 0;
|
||||||
|
|
||||||
|
yyssp = yyss;
|
||||||
|
yyvsp = yyvs;]b4_locations_if([[
|
||||||
|
yylsp = yyls;]])[
|
||||||
|
|
||||||
/* Initialize the state stack, in case yypcontext_expected_tokens is
|
/* Initialize the state stack, in case yypcontext_expected_tokens is
|
||||||
called before the first call to yyparse. */
|
called before the first call to yyparse. */
|
||||||
*yyssp = 0;
|
*yyssp = 0;
|
||||||
|
yyps->yynew = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Initialize the parser data structure. */
|
/* Initialize the parser data structure. */
|
||||||
@@ -1496,11 +1565,18 @@ yypstate_new (void)
|
|||||||
yypstate *yyps;]b4_pure_if([], [[
|
yypstate *yyps;]b4_pure_if([], [[
|
||||||
if (yypstate_allocated)
|
if (yypstate_allocated)
|
||||||
return YY_NULLPTR;]])[
|
return YY_NULLPTR;]])[
|
||||||
yyps = YY_CAST (yypstate *, malloc (sizeof *yyps));
|
yyps = YY_CAST (yypstate *, YYMALLOC (sizeof *yyps));
|
||||||
if (!yyps)
|
if (!yyps)
|
||||||
return YY_NULLPTR;
|
return YY_NULLPTR;]b4_pure_if([], [[
|
||||||
yyps->yynew = 1;]b4_pure_if([], [[
|
|
||||||
yypstate_allocated = 1;]])[
|
yypstate_allocated = 1;]])[
|
||||||
|
yystacksize = YYINITDEPTH;
|
||||||
|
yyss = yyssa;
|
||||||
|
yyvs = yyvsa;]b4_locations_if([[
|
||||||
|
yyls = yylsa;]])[]b4_lac_if([[
|
||||||
|
yyes = yyesa;
|
||||||
|
yyes_capacity = ]b4_percent_define_get([[parse.lac.es-capacity-initial]])[;
|
||||||
|
if (YYMAXDEPTH < yyes_capacity)
|
||||||
|
yyes_capacity = YYMAXDEPTH;]])[
|
||||||
yypstate_clear (yyps);
|
yypstate_clear (yyps);
|
||||||
return yyps;
|
return yyps;
|
||||||
}
|
}
|
||||||
@@ -1513,12 +1589,12 @@ yypstate_delete (yypstate *yyps)
|
|||||||
#ifndef yyoverflow
|
#ifndef yyoverflow
|
||||||
/* If the stack was reallocated but the parse did not complete, then the
|
/* If the stack was reallocated but the parse did not complete, then the
|
||||||
stack still needs to be freed. */
|
stack still needs to be freed. */
|
||||||
if (!yyps->yynew && yyss != yyssa)
|
if (yyss != yyssa)
|
||||||
YYSTACK_FREE (yyss);
|
YYSTACK_FREE (yyss);
|
||||||
#endif]b4_lac_if([[
|
#endif]b4_lac_if([[
|
||||||
if (!yyps->yynew && yyes != yyesa)
|
if (yyes != yyesa)
|
||||||
YYSTACK_FREE (yyes);]])[
|
YYSTACK_FREE (yyes);]])[
|
||||||
free (yyps);]b4_pure_if([], [[
|
YYFREE (yyps);]b4_pure_if([], [[
|
||||||
yypstate_allocated = 0;]])[
|
yypstate_allocated = 0;]])[
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1537,23 +1613,46 @@ yypush_parse (yypstate *yyps]b4_pure_if([[,
|
|||||||
| yyparse. |
|
| yyparse. |
|
||||||
`----------*/
|
`----------*/
|
||||||
|
|
||||||
|
]m4_ifdef([b4_start_symbols],
|
||||||
|
[[// Extract data from the parser.
|
||||||
|
typedef struct
|
||||||
|
{
|
||||||
|
YYSTYPE yyvalue;
|
||||||
|
int yynerrs;
|
||||||
|
} yy_parse_impl_t;
|
||||||
|
|
||||||
|
// Run a full parse, using YYCHAR as switching token.
|
||||||
|
static int
|
||||||
|
yy_parse_impl (int yychar, yy_parse_impl_t *yyimpl]m4_ifset([b4_parse_param], [, b4_formals(b4_parse_param)])[);
|
||||||
|
|
||||||
|
]m4_map([_b4_define_sub_yyparse], m4_defn([b4_start_symbols]))[
|
||||||
|
|
||||||
int
|
int
|
||||||
yyparse (]m4_ifset([b4_parse_param], [b4_formals(b4_parse_param)], [void])[)]])[
|
yyparse (]m4_ifset([b4_parse_param], [b4_formals(b4_parse_param)], [void])[)
|
||||||
|
{
|
||||||
|
return yy_parse_impl (]b4_symbol(_b4_first_switching_token, id)[, YY_NULLPTR]m4_ifset([b4_parse_param],
|
||||||
|
[[, ]b4_args(b4_parse_param)])[);
|
||||||
|
}
|
||||||
|
|
||||||
|
static int
|
||||||
|
yy_parse_impl (int yychar, yy_parse_impl_t *yyimpl]m4_ifset([b4_parse_param], [, b4_formals(b4_parse_param)])[)]],
|
||||||
|
[[int
|
||||||
|
yyparse (]m4_ifset([b4_parse_param], [b4_formals(b4_parse_param)], [void])[)]])])[
|
||||||
{]b4_pure_if([b4_declare_scanner_communication_variables
|
{]b4_pure_if([b4_declare_scanner_communication_variables
|
||||||
])b4_push_if([b4_pure_if([], [[
|
])b4_push_if([b4_pure_if([], [[
|
||||||
int yypushed_char = yychar;
|
int yypushed_char = yychar;
|
||||||
YYSTYPE yypushed_val = yylval;]b4_locations_if([[
|
YYSTYPE yypushed_val = yylval;]b4_locations_if([[
|
||||||
YYLTYPE yypushed_loc = yylloc;]])
|
YYLTYPE yypushed_loc = yylloc;]])
|
||||||
])],
|
])],
|
||||||
[b4_declare_parser_state_variables
|
[b4_declare_parser_state_variables([init])
|
||||||
])b4_lac_if([[
|
])b4_lac_if([[
|
||||||
/* Whether LAC context is established. A Boolean. */
|
/* Whether LAC context is established. A Boolean. */
|
||||||
int yy_lac_established = 0;]])[
|
int yy_lac_established = 0;]])[
|
||||||
int yyn;
|
int yyn;
|
||||||
/* The return value of yyparse. */
|
/* The return value of yyparse. */
|
||||||
int yyresult;
|
int yyresult;
|
||||||
/* Lookahead token as an internal (translated) token number. */
|
/* Lookahead symbol kind. */
|
||||||
yysymbol_kind_t yytoken = ]b4_symbol(-2, kind)[;
|
yysymbol_kind_t yytoken = ]b4_symbol(empty, kind)[;
|
||||||
/* The variables used to return semantic value and location from the
|
/* The variables used to return semantic value and location from the
|
||||||
action routines. */
|
action routines. */
|
||||||
YYSTYPE yyval;]b4_locations_if([[
|
YYSTYPE yyval;]b4_locations_if([[
|
||||||
@@ -1572,18 +1671,27 @@ yyparse (]m4_ifset([b4_parse_param], [b4_formals(b4_parse_param)], [void])[)]])[
|
|||||||
|
|
||||||
/* The number of symbols on the RHS of the reduced rule.
|
/* The number of symbols on the RHS of the reduced rule.
|
||||||
Keep to zero when no symbol should be popped. */
|
Keep to zero when no symbol should be popped. */
|
||||||
int yylen = 0;
|
int yylen = 0;]b4_push_if([[
|
||||||
]b4_push_if([[
|
|
||||||
if (!yyps->yynew)
|
switch (yyps->yynew)
|
||||||
{
|
{
|
||||||
|
case 0:
|
||||||
yyn = yypact[yystate];
|
yyn = yypact[yystate];
|
||||||
goto yyread_pushed_token;
|
goto yyread_pushed_token;
|
||||||
}]], [
|
|
||||||
b4_initialize_parser_state_variables])[
|
case 2:
|
||||||
|
yypstate_clear (yyps);
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}]])[
|
||||||
|
|
||||||
YYDPRINTF ((stderr, "Starting parse\n"));
|
YYDPRINTF ((stderr, "Starting parse\n"));
|
||||||
|
|
||||||
yychar = ]b4_symbol(-2, id)[; /* Cause a token to be read. */
|
]m4_ifdef([b4_start_symbols], [],
|
||||||
|
[[ yychar = ]b4_symbol(empty, id)[; /* Cause a token to be read. */
|
||||||
|
]])[
|
||||||
]m4_ifdef([b4_initial_action], [
|
]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
|
[b4_push_if([b4_pure_if([*])yypushed_loc], [yylloc])])dnl
|
||||||
@@ -1618,7 +1726,7 @@ yysetstate:
|
|||||||
|
|
||||||
if (yyss + yystacksize - 1 <= yyssp)
|
if (yyss + yystacksize - 1 <= yyssp)
|
||||||
#if !defined yyoverflow && !defined YYSTACK_RELOCATE
|
#if !defined yyoverflow && !defined YYSTACK_RELOCATE
|
||||||
goto yyexhaustedlab;
|
YYNOMEM;
|
||||||
#else
|
#else
|
||||||
{
|
{
|
||||||
/* Get the current used size of the three stacks, in elements. */
|
/* Get the current used size of the three stacks, in elements. */
|
||||||
@@ -1649,7 +1757,7 @@ yysetstate:
|
|||||||
# else /* defined YYSTACK_RELOCATE */
|
# else /* defined YYSTACK_RELOCATE */
|
||||||
/* Extend the stack our own way. */
|
/* Extend the stack our own way. */
|
||||||
if (YYMAXDEPTH <= yystacksize)
|
if (YYMAXDEPTH <= yystacksize)
|
||||||
goto yyexhaustedlab;
|
YYNOMEM;
|
||||||
yystacksize *= 2;
|
yystacksize *= 2;
|
||||||
if (YYMAXDEPTH < yystacksize)
|
if (YYMAXDEPTH < yystacksize)
|
||||||
yystacksize = YYMAXDEPTH;
|
yystacksize = YYMAXDEPTH;
|
||||||
@@ -1660,7 +1768,7 @@ yysetstate:
|
|||||||
YY_CAST (union yyalloc *,
|
YY_CAST (union yyalloc *,
|
||||||
YYSTACK_ALLOC (YY_CAST (YYSIZE_T, YYSTACK_BYTES (yystacksize))));
|
YYSTACK_ALLOC (YY_CAST (YYSIZE_T, YYSTACK_BYTES (yystacksize))));
|
||||||
if (! yyptr)
|
if (! yyptr)
|
||||||
goto yyexhaustedlab;
|
YYNOMEM;
|
||||||
YYSTACK_RELOCATE (yyss_alloc, yyss);
|
YYSTACK_RELOCATE (yyss_alloc, yyss);
|
||||||
YYSTACK_RELOCATE (yyvs_alloc, yyvs);]b4_locations_if([
|
YYSTACK_RELOCATE (yyvs_alloc, yyvs);]b4_locations_if([
|
||||||
YYSTACK_RELOCATE (yyls_alloc, yyls);])[
|
YYSTACK_RELOCATE (yyls_alloc, yyls);])[
|
||||||
@@ -1684,8 +1792,9 @@ yysetstate:
|
|||||||
}
|
}
|
||||||
#endif /* !defined yyoverflow && !defined YYSTACK_RELOCATE */
|
#endif /* !defined yyoverflow && !defined YYSTACK_RELOCATE */
|
||||||
|
|
||||||
|
]m4_ifdef([b4_start_symbols], [], [[
|
||||||
if (yystate == YYFINAL)
|
if (yystate == YYFINAL)
|
||||||
YYACCEPT;
|
YYACCEPT;]])[
|
||||||
|
|
||||||
goto yybackup;
|
goto yybackup;
|
||||||
|
|
||||||
@@ -1705,7 +1814,7 @@ yybackup:
|
|||||||
/* Not known => get a lookahead token if don't already have one. */
|
/* Not known => get a lookahead token if don't already have one. */
|
||||||
|
|
||||||
/* YYCHAR is either empty, or end-of-input, or a valid lookahead. */
|
/* YYCHAR is either empty, or end-of-input, or a valid lookahead. */
|
||||||
if (yychar == ]b4_symbol(-2, id)[)
|
if (yychar == ]b4_symbol(empty, id)[)
|
||||||
{]b4_push_if([[
|
{]b4_push_if([[
|
||||||
if (!yyps->yynew)
|
if (!yyps->yynew)
|
||||||
{]b4_use_push_for_pull_if([], [[
|
{]b4_use_push_for_pull_if([], [[
|
||||||
@@ -1727,23 +1836,23 @@ yyread_pushed_token:]])[
|
|||||||
yylval = *yypushed_val;]b4_locations_if([[
|
yylval = *yypushed_val;]b4_locations_if([[
|
||||||
if (yypushed_loc)
|
if (yypushed_loc)
|
||||||
yylloc = *yypushed_loc;]])])], [[
|
yylloc = *yypushed_loc;]])])], [[
|
||||||
yychar = ]b4_lex[;]])[
|
yychar = ]b4_yylex[;]])[
|
||||||
}
|
}
|
||||||
|
|
||||||
if (yychar <= ]b4_symbol(0, [id])[)
|
if (yychar <= ]b4_symbol(eof, [id])[)
|
||||||
{
|
{
|
||||||
yychar = ]b4_symbol(0, [id])[;
|
yychar = ]b4_symbol(eof, [id])[;
|
||||||
yytoken = ]b4_symbol(0, [kind])[;
|
yytoken = ]b4_symbol(eof, [kind])[;
|
||||||
YYDPRINTF ((stderr, "Now at end of input.\n"));
|
YYDPRINTF ((stderr, "Now at end of input.\n"));
|
||||||
}
|
}
|
||||||
else if (yychar == ]b4_symbol(1, [id])[)
|
else if (yychar == ]b4_symbol(error, [id])[)
|
||||||
{
|
{
|
||||||
/* The scanner already issued an error message, process directly
|
/* The scanner already issued an error message, process directly
|
||||||
to error recovery. But do not keep the error token as
|
to error recovery. But do not keep the error token as
|
||||||
lookahead, it is too special and may lead us to an endless
|
lookahead, it is too special and may lead us to an endless
|
||||||
loop in error recovery. */
|
loop in error recovery. */
|
||||||
yychar = ]b4_symbol(2, [id])[;
|
yychar = ]b4_symbol(undef, [id])[;
|
||||||
yytoken = ]b4_symbol(1, [kind])[;]b4_locations_if([[
|
yytoken = ]b4_symbol(error, [kind])[;]b4_locations_if([[
|
||||||
yyerror_range[1] = yylloc;]])[
|
yyerror_range[1] = yylloc;]])[
|
||||||
goto yyerrlab1;
|
goto yyerrlab1;
|
||||||
}
|
}
|
||||||
@@ -1766,9 +1875,9 @@ yyread_pushed_token:]])[
|
|||||||
if (yyn <= 0)
|
if (yyn <= 0)
|
||||||
{
|
{
|
||||||
if (yytable_value_is_error (yyn))
|
if (yytable_value_is_error (yyn))
|
||||||
goto yyerrlab;]b4_lac_if([[
|
goto yyerrlab;
|
||||||
|
yyn = -yyn;]b4_lac_if([[
|
||||||
YY_LAC_ESTABLISH;]])[
|
YY_LAC_ESTABLISH;]])[
|
||||||
yyn = -yyn;
|
|
||||||
goto yyreduce;
|
goto yyreduce;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1786,7 +1895,7 @@ yyread_pushed_token:]])[
|
|||||||
*++yylsp = yylloc;])[
|
*++yylsp = yylloc;])[
|
||||||
|
|
||||||
/* Discard the shifted token. */
|
/* Discard the shifted token. */
|
||||||
yychar = ]b4_symbol(-2, id)[;]b4_lac_if([[
|
yychar = ]b4_symbol(empty, id)[;]b4_lac_if([[
|
||||||
YY_LAC_DISCARD ("shift");]])[
|
YY_LAC_DISCARD ("shift");]])[
|
||||||
goto yynewstate;
|
goto yynewstate;
|
||||||
|
|
||||||
@@ -1877,7 +1986,7 @@ yyreduce:
|
|||||||
yyerrlab:
|
yyerrlab:
|
||||||
/* Make sure we have latest lookahead translation. See comments at
|
/* Make sure we have latest lookahead translation. See comments at
|
||||||
user semantic actions for why this is necessary. */
|
user semantic actions for why this is necessary. */
|
||||||
yytoken = yychar == ]b4_symbol(-2, id)[ ? ]b4_symbol(-2, kind)[ : YYTRANSLATE (yychar);
|
yytoken = yychar == ]b4_symbol(empty, id)[ ? ]b4_symbol(empty, kind)[ : YYTRANSLATE (yychar);
|
||||||
/* If not already recovering from an error, report this error. */
|
/* If not already recovering from an error, report this error. */
|
||||||
if (!yyerrstatus)
|
if (!yyerrstatus)
|
||||||
{
|
{
|
||||||
@@ -1887,11 +1996,11 @@ yyerrlab:
|
|||||||
[[ {
|
[[ {
|
||||||
yypcontext_t yyctx
|
yypcontext_t yyctx
|
||||||
= {]b4_push_if([[yyps]], [[yyssp]b4_lac_if([[, yyesa, &yyes, &yyes_capacity]])])[, yytoken]b4_locations_if([[, &yylloc]])[};]b4_lac_if([[
|
= {]b4_push_if([[yyps]], [[yyssp]b4_lac_if([[, yyesa, &yyes, &yyes_capacity]])])[, yytoken]b4_locations_if([[, &yylloc]])[};]b4_lac_if([[
|
||||||
if (yychar != ]b4_symbol(-2, id)[)
|
if (yychar != ]b4_symbol(empty, id)[)
|
||||||
YY_LAC_ESTABLISH;]])[
|
YY_LAC_ESTABLISH;]])[
|
||||||
if (yyreport_syntax_error (&yyctx]m4_ifset([b4_parse_param],
|
if (yyreport_syntax_error (&yyctx]m4_ifset([b4_parse_param],
|
||||||
[[, ]b4_args(b4_parse_param)])[) == 2)
|
[[, ]b4_args(b4_parse_param)])[) == 2)
|
||||||
goto yyexhaustedlab;
|
YYNOMEM;
|
||||||
}]],
|
}]],
|
||||||
[simple],
|
[simple],
|
||||||
[[ yyerror (]b4_yyerror_args[YY_("syntax error"));]],
|
[[ yyerror (]b4_yyerror_args[YY_("syntax error"));]],
|
||||||
@@ -1900,7 +2009,7 @@ yyerrlab:
|
|||||||
= {]b4_push_if([[yyps]], [[yyssp]b4_lac_if([[, yyesa, &yyes, &yyes_capacity]])])[, yytoken]b4_locations_if([[, &yylloc]])[};
|
= {]b4_push_if([[yyps]], [[yyssp]b4_lac_if([[, yyesa, &yyes, &yyes_capacity]])])[, yytoken]b4_locations_if([[, &yylloc]])[};
|
||||||
char const *yymsgp = YY_("syntax error");
|
char const *yymsgp = YY_("syntax error");
|
||||||
int yysyntax_error_status;]b4_lac_if([[
|
int yysyntax_error_status;]b4_lac_if([[
|
||||||
if (yychar != ]b4_symbol(-2, id)[)
|
if (yychar != ]b4_symbol(empty, id)[)
|
||||||
YY_LAC_ESTABLISH;]])[
|
YY_LAC_ESTABLISH;]])[
|
||||||
yysyntax_error_status = yysyntax_error (&yymsg_alloc, &yymsg, &yyctx);
|
yysyntax_error_status = yysyntax_error (&yymsg_alloc, &yymsg, &yyctx);
|
||||||
if (yysyntax_error_status == 0)
|
if (yysyntax_error_status == 0)
|
||||||
@@ -1926,7 +2035,7 @@ yyerrlab:
|
|||||||
}
|
}
|
||||||
yyerror (]b4_yyerror_args[yymsgp);
|
yyerror (]b4_yyerror_args[yymsgp);
|
||||||
if (yysyntax_error_status == YYENOMEM)
|
if (yysyntax_error_status == YYENOMEM)
|
||||||
goto yyexhaustedlab;
|
YYNOMEM;
|
||||||
}]])[
|
}]])[
|
||||||
}
|
}
|
||||||
]b4_locations_if([[
|
]b4_locations_if([[
|
||||||
@@ -1936,17 +2045,17 @@ yyerrlab:
|
|||||||
/* If just tried and failed to reuse lookahead token after an
|
/* If just tried and failed to reuse lookahead token after an
|
||||||
error, discard it. */
|
error, discard it. */
|
||||||
|
|
||||||
if (yychar <= ]b4_symbol(0, [id])[)
|
if (yychar <= ]b4_symbol(eof, [id])[)
|
||||||
{
|
{
|
||||||
/* Return failure if at end of input. */
|
/* Return failure if at end of input. */
|
||||||
if (yychar == ]b4_symbol(0, [id])[)
|
if (yychar == ]b4_symbol(eof, [id])[)
|
||||||
YYABORT;
|
YYABORT;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
yydestruct ("Error: discarding",
|
yydestruct ("Error: discarding",
|
||||||
yytoken, &yylval]b4_locations_if([, &yylloc])[]b4_user_args[);
|
yytoken, &yylval]b4_locations_if([, &yylloc])[]b4_user_args[);
|
||||||
yychar = ]b4_symbol(-2, id)[;
|
yychar = ]b4_symbol(empty, id)[;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1963,6 +2072,7 @@ yyerrorlab:
|
|||||||
label yyerrorlab therefore never appears in user code. */
|
label yyerrorlab therefore never appears in user code. */
|
||||||
if (0)
|
if (0)
|
||||||
YYERROR;
|
YYERROR;
|
||||||
|
++yynerrs;
|
||||||
|
|
||||||
/* Do not reclaim the symbols of the rule whose action triggered
|
/* Do not reclaim the symbols of the rule whose action triggered
|
||||||
this YYERROR. */
|
this YYERROR. */
|
||||||
@@ -1985,8 +2095,8 @@ yyerrlab1:
|
|||||||
yyn = yypact[yystate];
|
yyn = yypact[yystate];
|
||||||
if (!yypact_value_is_default (yyn))
|
if (!yypact_value_is_default (yyn))
|
||||||
{
|
{
|
||||||
yyn += ]b4_symbol(1, kind)[;
|
yyn += ]b4_symbol(error, kind)[;
|
||||||
if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == ]b4_symbol(1, kind)[)
|
if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == ]b4_symbol(error, kind)[)
|
||||||
{
|
{
|
||||||
yyn = yytable[yyn];
|
yyn = yytable[yyn];
|
||||||
if (0 < yyn)
|
if (0 < yyn)
|
||||||
@@ -2030,7 +2140,7 @@ yyerrlab1:
|
|||||||
`-------------------------------------*/
|
`-------------------------------------*/
|
||||||
yyacceptlab:
|
yyacceptlab:
|
||||||
yyresult = 0;
|
yyresult = 0;
|
||||||
goto yyreturn;
|
goto yyreturnlab;
|
||||||
|
|
||||||
|
|
||||||
/*-----------------------------------.
|
/*-----------------------------------.
|
||||||
@@ -2038,25 +2148,23 @@ yyacceptlab:
|
|||||||
`-----------------------------------*/
|
`-----------------------------------*/
|
||||||
yyabortlab:
|
yyabortlab:
|
||||||
yyresult = 1;
|
yyresult = 1;
|
||||||
goto yyreturn;
|
goto yyreturnlab;
|
||||||
|
|
||||||
|
|
||||||
#if ]b4_lac_if([[1]], [b4_parse_error_case([simple], [[!defined yyoverflow]], [[1]])])[
|
/*-----------------------------------------------------------.
|
||||||
/*-------------------------------------------------.
|
| yyexhaustedlab -- YYNOMEM (memory exhaustion) comes here. |
|
||||||
| yyexhaustedlab -- memory exhaustion comes here. |
|
`-----------------------------------------------------------*/
|
||||||
`-------------------------------------------------*/
|
|
||||||
yyexhaustedlab:
|
yyexhaustedlab:
|
||||||
yyerror (]b4_yyerror_args[YY_("memory exhausted"));
|
yyerror (]b4_yyerror_args[YY_("memory exhausted"));
|
||||||
yyresult = 2;
|
yyresult = 2;
|
||||||
/* Fall through. */
|
goto yyreturnlab;
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
/*-----------------------------------------------------.
|
/*----------------------------------------------------------.
|
||||||
| yyreturn -- parsing is finished, return the result. |
|
| yyreturnlab -- parsing is finished, clean up and return. |
|
||||||
`-----------------------------------------------------*/
|
`----------------------------------------------------------*/
|
||||||
yyreturn:
|
yyreturnlab:
|
||||||
if (yychar != ]b4_symbol(-2, id)[)
|
if (yychar != ]b4_symbol(empty, id)[)
|
||||||
{
|
{
|
||||||
/* Make sure we have latest lookahead translation. See comments at
|
/* Make sure we have latest lookahead translation. See comments at
|
||||||
user semantic actions for why this is necessary. */
|
user semantic actions for why this is necessary. */
|
||||||
@@ -2073,24 +2181,26 @@ yyreturn:
|
|||||||
yydestruct ("Cleanup: popping",
|
yydestruct ("Cleanup: popping",
|
||||||
YY_ACCESSING_SYMBOL (+*yyssp), yyvsp]b4_locations_if([, yylsp])[]b4_user_args[);
|
YY_ACCESSING_SYMBOL (+*yyssp), yyvsp]b4_locations_if([, yylsp])[]b4_user_args[);
|
||||||
YYPOPSTACK (1);
|
YYPOPSTACK (1);
|
||||||
}
|
}]b4_push_if([[
|
||||||
|
yyps->yynew = 2;
|
||||||
|
goto yypushreturn;
|
||||||
|
|
||||||
|
|
||||||
|
/*-------------------------.
|
||||||
|
| yypushreturn -- return. |
|
||||||
|
`-------------------------*/
|
||||||
|
yypushreturn:]], [[
|
||||||
#ifndef yyoverflow
|
#ifndef yyoverflow
|
||||||
if (yyss != yyssa)
|
if (yyss != yyssa)
|
||||||
YYSTACK_FREE (yyss);
|
YYSTACK_FREE (yyss);
|
||||||
#endif]b4_lac_if([[
|
#endif]b4_lac_if([[
|
||||||
if (yyes != yyesa)
|
if (yyes != yyesa)
|
||||||
YYSTACK_FREE (yyes);]])b4_push_if([[
|
YYSTACK_FREE (yyes);]])])[
|
||||||
yypstate_clear (yyps);
|
|
||||||
yyps->yynew = 1;
|
|
||||||
|
|
||||||
|
|
||||||
/*-----------------------------------------.
|
|
||||||
| yypushreturn -- ask for the next token. |
|
|
||||||
`-----------------------------------------*/
|
|
||||||
yypushreturn:]])[
|
|
||||||
]b4_parse_error_bmatch([detailed\|verbose],
|
]b4_parse_error_bmatch([detailed\|verbose],
|
||||||
[[ if (yymsg != yymsgbuf)
|
[[ if (yymsg != yymsgbuf)
|
||||||
YYSTACK_FREE (yymsg);]])[
|
YYSTACK_FREE (yymsg);]])[]m4_ifdef([b4_start_symbols], [[
|
||||||
|
if (yyimpl)
|
||||||
|
yyimpl->yynerrs = yynerrs;]])[
|
||||||
return yyresult;
|
return yyresult;
|
||||||
}
|
}
|
||||||
]b4_push_if([b4_parse_state_variable_macros([b4_macro_undef])])[
|
]b4_push_if([b4_parse_state_variable_macros([b4_macro_undef])])[
|
||||||
|
|||||||
+3
-3
@@ -3,7 +3,7 @@
|
|||||||
<!--
|
<!--
|
||||||
bison.xsl - common templates for Bison XSLT.
|
bison.xsl - common templates for Bison XSLT.
|
||||||
|
|
||||||
Copyright (C) 2007-2015, 2018-2020 Free Software Foundation, Inc.
|
Copyright (C) 2007-2015, 2018-2021 Free Software Foundation, Inc.
|
||||||
|
|
||||||
This file is part of Bison, the GNU Compiler Compiler.
|
This file is part of Bison, the GNU Compiler Compiler.
|
||||||
|
|
||||||
@@ -18,12 +18,12 @@
|
|||||||
GNU General Public License for more details.
|
GNU General Public License for more details.
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
You should have received a copy of the GNU General Public License
|
||||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
-->
|
-->
|
||||||
|
|
||||||
<xsl:stylesheet version="1.0"
|
<xsl:stylesheet version="1.0"
|
||||||
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
|
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
|
||||||
xmlns:bison="http://www.gnu.org/software/bison/">
|
xmlns:bison="https://www.gnu.org/software/bison/">
|
||||||
|
|
||||||
<xsl:key
|
<xsl:key
|
||||||
name="bison:symbolByName"
|
name="bison:symbolByName"
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
<!--
|
<!--
|
||||||
xml2dot.xsl - transform Bison XML Report into DOT.
|
xml2dot.xsl - transform Bison XML Report into DOT.
|
||||||
|
|
||||||
Copyright (C) 2007-2015, 2018-2020 Free Software Foundation, Inc.
|
Copyright (C) 2007-2015, 2018-2021 Free Software Foundation, Inc.
|
||||||
|
|
||||||
This file is part of Bison, the GNU Compiler Compiler.
|
This file is part of Bison, the GNU Compiler Compiler.
|
||||||
|
|
||||||
@@ -18,14 +18,14 @@
|
|||||||
GNU General Public License for more details.
|
GNU General Public License for more details.
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
You should have received a copy of the GNU General Public License
|
||||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
Written by Wojciech Polak <polak@gnu.org>.
|
Written by Wojciech Polak <polak@gnu.org>.
|
||||||
-->
|
-->
|
||||||
|
|
||||||
<xsl:stylesheet version="1.0"
|
<xsl:stylesheet version="1.0"
|
||||||
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
|
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
|
||||||
xmlns:bison="http://www.gnu.org/software/bison/">
|
xmlns:bison="https://www.gnu.org/software/bison/">
|
||||||
|
|
||||||
<xsl:import href="bison.xsl"/>
|
<xsl:import href="bison.xsl"/>
|
||||||
<xsl:output method="text" encoding="UTF-8" indent="no"/>
|
<xsl:output method="text" encoding="UTF-8" indent="no"/>
|
||||||
@@ -159,7 +159,7 @@
|
|||||||
<xsl:param name="prev-rule-number"
|
<xsl:param name="prev-rule-number"
|
||||||
select="preceding-sibling::item[1]/@rule-number"/>
|
select="preceding-sibling::item[1]/@rule-number"/>
|
||||||
<xsl:apply-templates select="key('bison:ruleByNumber', @rule-number)">
|
<xsl:apply-templates select="key('bison:ruleByNumber', @rule-number)">
|
||||||
<xsl:with-param name="point" select="@point"/>
|
<xsl:with-param name="dot" select="@dot"/>
|
||||||
<xsl:with-param name="num" select="@rule-number"/>
|
<xsl:with-param name="num" select="@rule-number"/>
|
||||||
<xsl:with-param name="prev-lhs"
|
<xsl:with-param name="prev-lhs"
|
||||||
select="key('bison:ruleByNumber', $prev-rule-number)/lhs[text()]"
|
select="key('bison:ruleByNumber', $prev-rule-number)/lhs[text()]"
|
||||||
@@ -169,7 +169,7 @@
|
|||||||
</xsl:template>
|
</xsl:template>
|
||||||
|
|
||||||
<xsl:template match="rule">
|
<xsl:template match="rule">
|
||||||
<xsl:param name="point"/>
|
<xsl:param name="dot"/>
|
||||||
<xsl:param name="num"/>
|
<xsl:param name="num"/>
|
||||||
<xsl:param name="prev-lhs"/>
|
<xsl:param name="prev-lhs"/>
|
||||||
<xsl:text> </xsl:text>
|
<xsl:text> </xsl:text>
|
||||||
@@ -198,14 +198,14 @@
|
|||||||
<xsl:text>:</xsl:text>
|
<xsl:text>:</xsl:text>
|
||||||
</xsl:otherwise>
|
</xsl:otherwise>
|
||||||
</xsl:choose>
|
</xsl:choose>
|
||||||
<xsl:if test="$point = 0">
|
<xsl:if test="$dot = 0">
|
||||||
<xsl:text> .</xsl:text>
|
<xsl:text> .</xsl:text>
|
||||||
</xsl:if>
|
</xsl:if>
|
||||||
|
|
||||||
<!-- RHS -->
|
<!-- RHS -->
|
||||||
<xsl:for-each select="rhs/symbol|rhs/empty">
|
<xsl:for-each select="rhs/symbol|rhs/empty">
|
||||||
<xsl:apply-templates select="."/>
|
<xsl:apply-templates select="."/>
|
||||||
<xsl:if test="$point = position()">
|
<xsl:if test="$dot = position()">
|
||||||
<xsl:text> .</xsl:text>
|
<xsl:text> .</xsl:text>
|
||||||
</xsl:if>
|
</xsl:if>
|
||||||
</xsl:for-each>
|
</xsl:for-each>
|
||||||
|
|||||||
+21
-13
@@ -3,7 +3,7 @@
|
|||||||
<!--
|
<!--
|
||||||
xml2text.xsl - transform Bison XML Report into plain text.
|
xml2text.xsl - transform Bison XML Report into plain text.
|
||||||
|
|
||||||
Copyright (C) 2007-2015, 2018-2020 Free Software Foundation, Inc.
|
Copyright (C) 2007-2015, 2018-2021 Free Software Foundation, Inc.
|
||||||
|
|
||||||
This file is part of Bison, the GNU Compiler Compiler.
|
This file is part of Bison, the GNU Compiler Compiler.
|
||||||
|
|
||||||
@@ -18,14 +18,14 @@
|
|||||||
GNU General Public License for more details.
|
GNU General Public License for more details.
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
You should have received a copy of the GNU General Public License
|
||||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
Written by Wojciech Polak <polak@gnu.org>.
|
Written by Wojciech Polak <polak@gnu.org>.
|
||||||
-->
|
-->
|
||||||
|
|
||||||
<xsl:stylesheet version="1.0"
|
<xsl:stylesheet version="1.0"
|
||||||
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
|
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
|
||||||
xmlns:bison="http://www.gnu.org/software/bison/">
|
xmlns:bison="https://www.gnu.org/software/bison/">
|
||||||
|
|
||||||
<xsl:import href="bison.xsl"/>
|
<xsl:import href="bison.xsl"/>
|
||||||
<xsl:output method="text" encoding="UTF-8" indent="no"/>
|
<xsl:output method="text" encoding="UTF-8" indent="no"/>
|
||||||
@@ -52,7 +52,7 @@
|
|||||||
<xsl:if test="nonterminal[@usefulness='useless-in-grammar']">
|
<xsl:if test="nonterminal[@usefulness='useless-in-grammar']">
|
||||||
<xsl:text>Nonterminals useless in grammar </xsl:text>
|
<xsl:text>Nonterminals useless in grammar </xsl:text>
|
||||||
<xsl:for-each select="nonterminal[@usefulness='useless-in-grammar']">
|
<xsl:for-each select="nonterminal[@usefulness='useless-in-grammar']">
|
||||||
<xsl:text> </xsl:text>
|
<xsl:text> </xsl:text>
|
||||||
<xsl:value-of select="@name"/>
|
<xsl:value-of select="@name"/>
|
||||||
<xsl:text> </xsl:text>
|
<xsl:text> </xsl:text>
|
||||||
</xsl:for-each>
|
</xsl:for-each>
|
||||||
@@ -65,7 +65,7 @@
|
|||||||
<xsl:text>Terminals unused in grammar </xsl:text>
|
<xsl:text>Terminals unused in grammar </xsl:text>
|
||||||
<xsl:for-each select="terminal[@usefulness='unused-in-grammar']">
|
<xsl:for-each select="terminal[@usefulness='unused-in-grammar']">
|
||||||
<xsl:sort select="@symbol-number" data-type="number"/>
|
<xsl:sort select="@symbol-number" data-type="number"/>
|
||||||
<xsl:text> </xsl:text>
|
<xsl:text> </xsl:text>
|
||||||
<xsl:value-of select="@name"/>
|
<xsl:value-of select="@name"/>
|
||||||
<xsl:text> </xsl:text>
|
<xsl:text> </xsl:text>
|
||||||
</xsl:for-each>
|
</xsl:for-each>
|
||||||
@@ -136,6 +136,7 @@
|
|||||||
</xsl:template>
|
</xsl:template>
|
||||||
|
|
||||||
<xsl:template match="terminal">
|
<xsl:template match="terminal">
|
||||||
|
<xsl:text> </xsl:text>
|
||||||
<xsl:value-of select="@name"/>
|
<xsl:value-of select="@name"/>
|
||||||
<xsl:call-template name="line-wrap">
|
<xsl:call-template name="line-wrap">
|
||||||
<xsl:with-param name="first-line-length">
|
<xsl:with-param name="first-line-length">
|
||||||
@@ -148,6 +149,9 @@
|
|||||||
</xsl:with-param>
|
</xsl:with-param>
|
||||||
<xsl:with-param name="line-length" select="66" />
|
<xsl:with-param name="line-length" select="66" />
|
||||||
<xsl:with-param name="text">
|
<xsl:with-param name="text">
|
||||||
|
<xsl:if test="string-length(@type) != 0">
|
||||||
|
<xsl:value-of select="concat(' <', @type, '>')"/>
|
||||||
|
</xsl:if>
|
||||||
<xsl:value-of select="concat(' (', @token-number, ')')"/>
|
<xsl:value-of select="concat(' (', @token-number, ')')"/>
|
||||||
<xsl:for-each select="key('bison:ruleByRhs', @name)">
|
<xsl:for-each select="key('bison:ruleByRhs', @name)">
|
||||||
<xsl:value-of select="concat(' ', @number)"/>
|
<xsl:value-of select="concat(' ', @number)"/>
|
||||||
@@ -157,14 +161,18 @@
|
|||||||
</xsl:template>
|
</xsl:template>
|
||||||
|
|
||||||
<xsl:template match="nonterminal">
|
<xsl:template match="nonterminal">
|
||||||
|
<xsl:text> </xsl:text>
|
||||||
<xsl:value-of select="@name"/>
|
<xsl:value-of select="@name"/>
|
||||||
|
<xsl:if test="string-length(@type) != 0">
|
||||||
|
<xsl:value-of select="concat(' <', @type, '>')"/>
|
||||||
|
</xsl:if>
|
||||||
<xsl:value-of select="concat(' (', @symbol-number, ')')"/>
|
<xsl:value-of select="concat(' (', @symbol-number, ')')"/>
|
||||||
<xsl:text> </xsl:text>
|
<xsl:text> </xsl:text>
|
||||||
<xsl:variable name="output">
|
<xsl:variable name="output">
|
||||||
<xsl:call-template name="line-wrap">
|
<xsl:call-template name="line-wrap">
|
||||||
<xsl:with-param name="line-length" select="66" />
|
<xsl:with-param name="line-length" select="66" />
|
||||||
<xsl:with-param name="text">
|
<xsl:with-param name="text">
|
||||||
<xsl:text> </xsl:text>
|
<xsl:text> </xsl:text>
|
||||||
<xsl:if test="key('bison:ruleByLhs', @name)">
|
<xsl:if test="key('bison:ruleByLhs', @name)">
|
||||||
<xsl:text>on@left:</xsl:text>
|
<xsl:text>on@left:</xsl:text>
|
||||||
<xsl:for-each select="key('bison:ruleByLhs', @name)">
|
<xsl:for-each select="key('bison:ruleByLhs', @name)">
|
||||||
@@ -173,7 +181,7 @@
|
|||||||
</xsl:if>
|
</xsl:if>
|
||||||
<xsl:if test="key('bison:ruleByRhs', @name)">
|
<xsl:if test="key('bison:ruleByRhs', @name)">
|
||||||
<xsl:if test="key('bison:ruleByLhs', @name)">
|
<xsl:if test="key('bison:ruleByLhs', @name)">
|
||||||
<xsl:text>, </xsl:text>
|
<xsl:text> </xsl:text>
|
||||||
</xsl:if>
|
</xsl:if>
|
||||||
<xsl:text>on@right:</xsl:text>
|
<xsl:text>on@right:</xsl:text>
|
||||||
<xsl:for-each select="key('bison:ruleByRhs', @name)">
|
<xsl:for-each select="key('bison:ruleByRhs', @name)">
|
||||||
@@ -300,7 +308,7 @@
|
|||||||
name="prev-lhs"
|
name="prev-lhs"
|
||||||
select="key('bison:ruleByNumber', $prev-rule-number)/lhs[text()]"
|
select="key('bison:ruleByNumber', $prev-rule-number)/lhs[text()]"
|
||||||
/>
|
/>
|
||||||
<xsl:with-param name="point" select="@point"/>
|
<xsl:with-param name="dot" select="@dot"/>
|
||||||
<xsl:with-param name="lookaheads">
|
<xsl:with-param name="lookaheads">
|
||||||
<xsl:apply-templates select="lookaheads"/>
|
<xsl:apply-templates select="lookaheads"/>
|
||||||
</xsl:with-param>
|
</xsl:with-param>
|
||||||
@@ -311,7 +319,7 @@
|
|||||||
<xsl:param name="itemset"/>
|
<xsl:param name="itemset"/>
|
||||||
<xsl:param name="pad"/>
|
<xsl:param name="pad"/>
|
||||||
<xsl:param name="prev-lhs"/>
|
<xsl:param name="prev-lhs"/>
|
||||||
<xsl:param name="point"/>
|
<xsl:param name="dot"/>
|
||||||
<xsl:param name="lookaheads"/>
|
<xsl:param name="lookaheads"/>
|
||||||
|
|
||||||
<xsl:if test="$itemset != 'true' and not($prev-lhs = lhs[text()])">
|
<xsl:if test="$itemset != 'true' and not($prev-lhs = lhs[text()])">
|
||||||
@@ -347,12 +355,12 @@
|
|||||||
|
|
||||||
<!-- RHS -->
|
<!-- RHS -->
|
||||||
<xsl:for-each select="rhs/*">
|
<xsl:for-each select="rhs/*">
|
||||||
<xsl:if test="position() = $point + 1">
|
<xsl:if test="position() = $dot + 1">
|
||||||
<xsl:text> .</xsl:text>
|
<xsl:text> •</xsl:text>
|
||||||
</xsl:if>
|
</xsl:if>
|
||||||
<xsl:apply-templates select="."/>
|
<xsl:apply-templates select="."/>
|
||||||
<xsl:if test="position() = last() and position() = $point">
|
<xsl:if test="position() = last() and position() = $dot">
|
||||||
<xsl:text> .</xsl:text>
|
<xsl:text> •</xsl:text>
|
||||||
</xsl:if>
|
</xsl:if>
|
||||||
</xsl:for-each>
|
</xsl:for-each>
|
||||||
<xsl:if test="$lookaheads">
|
<xsl:if test="$lookaheads">
|
||||||
|
|||||||
+83
-59
@@ -3,7 +3,7 @@
|
|||||||
<!--
|
<!--
|
||||||
xml2html.xsl - transform Bison XML Report into XHTML.
|
xml2html.xsl - transform Bison XML Report into XHTML.
|
||||||
|
|
||||||
Copyright (C) 2007-2015, 2018-2020 Free Software Foundation, Inc.
|
Copyright (C) 2007-2015, 2018-2021 Free Software Foundation, Inc.
|
||||||
|
|
||||||
This file is part of Bison, the GNU Compiler Compiler.
|
This file is part of Bison, the GNU Compiler Compiler.
|
||||||
|
|
||||||
@@ -18,7 +18,7 @@
|
|||||||
GNU General Public License for more details.
|
GNU General Public License for more details.
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
You should have received a copy of the GNU General Public License
|
||||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
Written by Wojciech Polak <polak@gnu.org>.
|
Written by Wojciech Polak <polak@gnu.org>.
|
||||||
-->
|
-->
|
||||||
@@ -26,7 +26,7 @@
|
|||||||
<xsl:stylesheet version="1.0"
|
<xsl:stylesheet version="1.0"
|
||||||
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
|
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
|
||||||
xmlns="http://www.w3.org/1999/xhtml"
|
xmlns="http://www.w3.org/1999/xhtml"
|
||||||
xmlns:bison="http://www.gnu.org/software/bison/">
|
xmlns:bison="https://www.gnu.org/software/bison/">
|
||||||
|
|
||||||
<xsl:import href="bison.xsl"/>
|
<xsl:import href="bison.xsl"/>
|
||||||
|
|
||||||
@@ -75,7 +75,7 @@
|
|||||||
ol.lower-alpha {
|
ol.lower-alpha {
|
||||||
list-style-type: lower-alpha;
|
list-style-type: lower-alpha;
|
||||||
}
|
}
|
||||||
.point {
|
.dot {
|
||||||
color: #cc0000;
|
color: #cc0000;
|
||||||
}
|
}
|
||||||
#footer {
|
#footer {
|
||||||
@@ -88,7 +88,7 @@
|
|||||||
<xsl:apply-templates select="bison-xml-report"/>
|
<xsl:apply-templates select="bison-xml-report"/>
|
||||||
<xsl:text> </xsl:text>
|
<xsl:text> </xsl:text>
|
||||||
<div id="footer"><hr />This document was generated using
|
<div id="footer"><hr />This document was generated using
|
||||||
<a href="http://www.gnu.org/software/bison/" title="GNU Bison">
|
<a href="https://www.gnu.org/software/bison/" title="GNU Bison">
|
||||||
GNU Bison <xsl:value-of select="/bison-xml-report/@version"/></a>
|
GNU Bison <xsl:value-of select="/bison-xml-report/@version"/></a>
|
||||||
XML Automaton Report.<br />
|
XML Automaton Report.<br />
|
||||||
<!-- default copying notice -->
|
<!-- default copying notice -->
|
||||||
@@ -227,6 +227,7 @@
|
|||||||
<xsl:text> </xsl:text>
|
<xsl:text> </xsl:text>
|
||||||
<p class="pre">
|
<p class="pre">
|
||||||
<xsl:call-template name="style-rule-set">
|
<xsl:call-template name="style-rule-set">
|
||||||
|
<xsl:with-param name="anchor" select="'true'" />
|
||||||
<xsl:with-param
|
<xsl:with-param
|
||||||
name="rule-set" select="rules/rule[@usefulness!='useless-in-grammar']"
|
name="rule-set" select="rules/rule[@usefulness!='useless-in-grammar']"
|
||||||
/>
|
/>
|
||||||
@@ -238,9 +239,11 @@
|
|||||||
</xsl:template>
|
</xsl:template>
|
||||||
|
|
||||||
<xsl:template name="style-rule-set">
|
<xsl:template name="style-rule-set">
|
||||||
|
<xsl:param name="anchor"/>
|
||||||
<xsl:param name="rule-set"/>
|
<xsl:param name="rule-set"/>
|
||||||
<xsl:for-each select="$rule-set">
|
<xsl:for-each select="$rule-set">
|
||||||
<xsl:apply-templates select=".">
|
<xsl:apply-templates select=".">
|
||||||
|
<xsl:with-param name="anchor" select="$anchor"/>
|
||||||
<xsl:with-param name="pad" select="'3'"/>
|
<xsl:with-param name="pad" select="'3'"/>
|
||||||
<xsl:with-param name="prev-lhs">
|
<xsl:with-param name="prev-lhs">
|
||||||
<xsl:if test="position()>1">
|
<xsl:if test="position()>1">
|
||||||
@@ -306,9 +309,10 @@
|
|||||||
<xsl:text> Terminals, with rules where they appear</xsl:text>
|
<xsl:text> Terminals, with rules where they appear</xsl:text>
|
||||||
</h3>
|
</h3>
|
||||||
<xsl:text> </xsl:text>
|
<xsl:text> </xsl:text>
|
||||||
<p class="pre">
|
<ul>
|
||||||
|
<xsl:text> </xsl:text>
|
||||||
<xsl:apply-templates select="terminal"/>
|
<xsl:apply-templates select="terminal"/>
|
||||||
</p>
|
</ul>
|
||||||
<xsl:text> </xsl:text>
|
<xsl:text> </xsl:text>
|
||||||
</xsl:template>
|
</xsl:template>
|
||||||
|
|
||||||
@@ -318,41 +322,64 @@
|
|||||||
<xsl:text> Nonterminals, with rules where they appear</xsl:text>
|
<xsl:text> Nonterminals, with rules where they appear</xsl:text>
|
||||||
</h3>
|
</h3>
|
||||||
<xsl:text> </xsl:text>
|
<xsl:text> </xsl:text>
|
||||||
<p class="pre">
|
<ul>
|
||||||
|
<xsl:text> </xsl:text>
|
||||||
<xsl:apply-templates
|
<xsl:apply-templates
|
||||||
select="nonterminal[@usefulness!='useless-in-grammar']"
|
select="nonterminal[@usefulness!='useless-in-grammar']"
|
||||||
/>
|
/>
|
||||||
</p>
|
</ul>
|
||||||
</xsl:template>
|
</xsl:template>
|
||||||
|
|
||||||
<xsl:template match="terminal">
|
<xsl:template match="terminal">
|
||||||
<b><xsl:value-of select="@name"/></b>
|
<xsl:text> </xsl:text>
|
||||||
<xsl:value-of select="concat(' (', @token-number, ')')"/>
|
<li>
|
||||||
<xsl:for-each select="key('bison:ruleByRhs', @name)">
|
<b><xsl:value-of select="@name"/></b>
|
||||||
<xsl:apply-templates select="." mode="number-link"/>
|
<xsl:if test="string-length(@type) != 0">
|
||||||
</xsl:for-each>
|
<xsl:value-of select="concat(' <', @type, '>')"/>
|
||||||
|
</xsl:if>
|
||||||
|
<xsl:value-of select="concat(' (', @token-number, ')')"/>
|
||||||
|
<xsl:for-each select="key('bison:ruleByRhs', @name)">
|
||||||
|
<xsl:apply-templates select="." mode="number-link"/>
|
||||||
|
</xsl:for-each>
|
||||||
|
</li>
|
||||||
<xsl:text> </xsl:text>
|
<xsl:text> </xsl:text>
|
||||||
</xsl:template>
|
</xsl:template>
|
||||||
|
|
||||||
<xsl:template match="nonterminal">
|
<xsl:template match="nonterminal">
|
||||||
<b><xsl:value-of select="@name"/></b>
|
<xsl:text> </xsl:text>
|
||||||
<xsl:value-of select="concat(' (', @symbol-number, ')')"/>
|
<li>
|
||||||
<xsl:text> </xsl:text>
|
<b><xsl:value-of select="@name"/></b>
|
||||||
<xsl:if test="key('bison:ruleByLhs', @name)">
|
<xsl:if test="string-length(@type) != 0">
|
||||||
<xsl:text>on left:</xsl:text>
|
<xsl:value-of select="concat(' <', @type, '>')"/>
|
||||||
<xsl:for-each select="key('bison:ruleByLhs', @name)">
|
|
||||||
<xsl:apply-templates select="." mode="number-link"/>
|
|
||||||
</xsl:for-each>
|
|
||||||
</xsl:if>
|
|
||||||
<xsl:if test="key('bison:ruleByRhs', @name)">
|
|
||||||
<xsl:if test="key('bison:ruleByLhs', @name)">
|
|
||||||
<xsl:text> </xsl:text>
|
|
||||||
</xsl:if>
|
</xsl:if>
|
||||||
<xsl:text>on right:</xsl:text>
|
<xsl:value-of select="concat(' (', @symbol-number, ')')"/>
|
||||||
<xsl:for-each select="key('bison:ruleByRhs', @name)">
|
<xsl:text> </xsl:text>
|
||||||
<xsl:apply-templates select="." mode="number-link"/>
|
<ul>
|
||||||
</xsl:for-each>
|
<xsl:text> </xsl:text>
|
||||||
</xsl:if>
|
<xsl:if test="key('bison:ruleByLhs', @name)">
|
||||||
|
<xsl:text> </xsl:text>
|
||||||
|
<li>
|
||||||
|
<xsl:text>on left:</xsl:text>
|
||||||
|
<xsl:for-each select="key('bison:ruleByLhs', @name)">
|
||||||
|
<xsl:apply-templates select="." mode="number-link"/>
|
||||||
|
</xsl:for-each>
|
||||||
|
</li>
|
||||||
|
<xsl:text> </xsl:text>
|
||||||
|
</xsl:if>
|
||||||
|
<xsl:if test="key('bison:ruleByRhs', @name)">
|
||||||
|
<xsl:text> </xsl:text>
|
||||||
|
<li>
|
||||||
|
<xsl:text>on right:</xsl:text>
|
||||||
|
<xsl:for-each select="key('bison:ruleByRhs', @name)">
|
||||||
|
<xsl:apply-templates select="." mode="number-link"/>
|
||||||
|
</xsl:for-each>
|
||||||
|
</li>
|
||||||
|
<xsl:text> </xsl:text>
|
||||||
|
</xsl:if>
|
||||||
|
<xsl:text> </xsl:text>
|
||||||
|
</ul>
|
||||||
|
<xsl:text> </xsl:text>
|
||||||
|
</li>
|
||||||
<xsl:text> </xsl:text>
|
<xsl:text> </xsl:text>
|
||||||
</xsl:template>
|
</xsl:template>
|
||||||
|
|
||||||
@@ -385,7 +412,7 @@
|
|||||||
<xsl:value-of select="concat('state_', @number)"/>
|
<xsl:value-of select="concat('state_', @number)"/>
|
||||||
</xsl:attribute>
|
</xsl:attribute>
|
||||||
</a>
|
</a>
|
||||||
<xsl:text>state </xsl:text>
|
<xsl:text>State </xsl:text>
|
||||||
<xsl:value-of select="@number"/>
|
<xsl:value-of select="@number"/>
|
||||||
</h3>
|
</h3>
|
||||||
<xsl:text> </xsl:text>
|
<xsl:text> </xsl:text>
|
||||||
@@ -457,35 +484,44 @@
|
|||||||
<xsl:with-param name="prev-lhs"
|
<xsl:with-param name="prev-lhs"
|
||||||
select="key('bison:ruleByNumber', $prev-rule-number)/lhs[text()]"
|
select="key('bison:ruleByNumber', $prev-rule-number)/lhs[text()]"
|
||||||
/>
|
/>
|
||||||
<xsl:with-param name="point" select="@point"/>
|
<xsl:with-param name="dot" select="@dot"/>
|
||||||
<xsl:with-param name="lookaheads">
|
<xsl:with-param name="lookaheads">
|
||||||
<xsl:apply-templates select="lookaheads"/>
|
<xsl:apply-templates select="lookaheads"/>
|
||||||
</xsl:with-param>
|
</xsl:with-param>
|
||||||
</xsl:apply-templates>
|
</xsl:apply-templates>
|
||||||
</xsl:template>
|
</xsl:template>
|
||||||
|
|
||||||
|
<!--
|
||||||
|
anchor = 'true': define as an <a> anchor.
|
||||||
|
itemset = 'true': show the items.
|
||||||
|
-->
|
||||||
<xsl:template match="rule">
|
<xsl:template match="rule">
|
||||||
|
<xsl:param name="anchor"/>
|
||||||
<xsl:param name="itemset"/>
|
<xsl:param name="itemset"/>
|
||||||
<xsl:param name="pad"/>
|
<xsl:param name="pad"/>
|
||||||
<xsl:param name="prev-lhs"/>
|
<xsl:param name="prev-lhs"/>
|
||||||
<xsl:param name="point"/>
|
<xsl:param name="dot"/>
|
||||||
<xsl:param name="lookaheads"/>
|
<xsl:param name="lookaheads"/>
|
||||||
|
|
||||||
<xsl:if test="$itemset != 'true' and not($prev-lhs = lhs[text()])">
|
<xsl:if test="$itemset != 'true' and not($prev-lhs = lhs[text()])">
|
||||||
<xsl:text> </xsl:text>
|
<xsl:text> </xsl:text>
|
||||||
</xsl:if>
|
</xsl:if>
|
||||||
|
|
||||||
<xsl:if test="$itemset != 'true'">
|
|
||||||
<a>
|
|
||||||
<xsl:attribute name="name">
|
|
||||||
<xsl:value-of select="concat('rule_', @number)"/>
|
|
||||||
</xsl:attribute>
|
|
||||||
</a>
|
|
||||||
</xsl:if>
|
|
||||||
<xsl:text> </xsl:text>
|
<xsl:text> </xsl:text>
|
||||||
|
|
||||||
<xsl:choose>
|
<xsl:choose>
|
||||||
<xsl:when test="$itemset = 'true'">
|
<xsl:when test="$anchor = 'true'">
|
||||||
|
<a>
|
||||||
|
<xsl:attribute name="name">
|
||||||
|
<xsl:value-of select="concat('rule_', @number)"/>
|
||||||
|
</xsl:attribute>
|
||||||
|
<xsl:call-template name="lpad">
|
||||||
|
<xsl:with-param name="str" select="string(@number)"/>
|
||||||
|
<xsl:with-param name="pad" select="number($pad)"/>
|
||||||
|
</xsl:call-template>
|
||||||
|
</a>
|
||||||
|
</xsl:when>
|
||||||
|
<xsl:otherwise>
|
||||||
<a>
|
<a>
|
||||||
<xsl:attribute name="href">
|
<xsl:attribute name="href">
|
||||||
<xsl:value-of select="concat('#rule_', @number)"/>
|
<xsl:value-of select="concat('#rule_', @number)"/>
|
||||||
@@ -495,25 +531,13 @@
|
|||||||
<xsl:with-param name="pad" select="number($pad)"/>
|
<xsl:with-param name="pad" select="number($pad)"/>
|
||||||
</xsl:call-template>
|
</xsl:call-template>
|
||||||
</a>
|
</a>
|
||||||
</xsl:when>
|
|
||||||
<xsl:otherwise>
|
|
||||||
<xsl:call-template name="lpad">
|
|
||||||
<xsl:with-param name="str" select="string(@number)"/>
|
|
||||||
<xsl:with-param name="pad" select="number($pad)"/>
|
|
||||||
</xsl:call-template>
|
|
||||||
</xsl:otherwise>
|
</xsl:otherwise>
|
||||||
</xsl:choose>
|
</xsl:choose>
|
||||||
<xsl:text> </xsl:text>
|
<xsl:text> </xsl:text>
|
||||||
|
|
||||||
<!-- LHS -->
|
<!-- LHS -->
|
||||||
<xsl:choose>
|
<xsl:choose>
|
||||||
<xsl:when test="$itemset != 'true' and $prev-lhs = lhs[text()]">
|
<xsl:when test="$prev-lhs = lhs[text()]">
|
||||||
<xsl:call-template name="lpad">
|
|
||||||
<xsl:with-param name="str" select="'|'"/>
|
|
||||||
<xsl:with-param name="pad" select="number(string-length(lhs[text()])) + 2"/>
|
|
||||||
</xsl:call-template>
|
|
||||||
</xsl:when>
|
|
||||||
<xsl:when test="$itemset = 'true' and $prev-lhs = lhs[text()]">
|
|
||||||
<xsl:call-template name="lpad">
|
<xsl:call-template name="lpad">
|
||||||
<xsl:with-param name="str" select="'|'"/>
|
<xsl:with-param name="str" select="'|'"/>
|
||||||
<xsl:with-param name="pad" select="number(string-length(lhs[text()])) + 2"/>
|
<xsl:with-param name="pad" select="number(string-length(lhs[text()])) + 2"/>
|
||||||
@@ -529,14 +553,14 @@
|
|||||||
|
|
||||||
<!-- RHS -->
|
<!-- RHS -->
|
||||||
<xsl:for-each select="rhs/*">
|
<xsl:for-each select="rhs/*">
|
||||||
<xsl:if test="position() = $point + 1">
|
<xsl:if test="position() = $dot + 1">
|
||||||
<xsl:text> </xsl:text>
|
<xsl:text> </xsl:text>
|
||||||
<span class="point">.</span>
|
<span class="dot">•</span>
|
||||||
</xsl:if>
|
</xsl:if>
|
||||||
<xsl:apply-templates select="."/>
|
<xsl:apply-templates select="."/>
|
||||||
<xsl:if test="position() = last() and position() = $point">
|
<xsl:if test="position() = last() and position() = $dot">
|
||||||
<xsl:text> </xsl:text>
|
<xsl:text> </xsl:text>
|
||||||
<span class="point">.</span>
|
<span class="dot">•</span>
|
||||||
</xsl:if>
|
</xsl:if>
|
||||||
</xsl:for-each>
|
</xsl:for-each>
|
||||||
<xsl:if test="$lookaheads">
|
<xsl:if test="$lookaheads">
|
||||||
|
|||||||
+3
-3
@@ -22,15 +22,15 @@
|
|||||||
/bison.ps
|
/bison.ps
|
||||||
/cross-options.texi
|
/cross-options.texi
|
||||||
/fdl.texi
|
/fdl.texi
|
||||||
|
/figs/*.eps
|
||||||
|
/figs/*.svg
|
||||||
/gendocs_template
|
/gendocs_template
|
||||||
/gendocs_template_min
|
/gendocs_template_min
|
||||||
/gpl-3.0.texi
|
/gpl-3.0.texi
|
||||||
/refcard.dvi
|
/refcard.dvi
|
||||||
/refcard.log
|
/refcard.log
|
||||||
/refcard.ps
|
/refcard.ps
|
||||||
|
/relocatable.texi
|
||||||
/stamp-vti
|
/stamp-vti
|
||||||
/version.texi
|
/version.texi
|
||||||
/yacc.1
|
/yacc.1
|
||||||
/relocatable.texi
|
|
||||||
/figs/*.eps
|
|
||||||
/figs/*.svg
|
|
||||||
|
|||||||
+134
-62
@@ -1,4 +1,4 @@
|
|||||||
# Doxyfile 1.8.17
|
# Doxyfile 1.9.1
|
||||||
|
|
||||||
# This file describes the settings to be used by the documentation system
|
# This file describes the settings to be used by the documentation system
|
||||||
# doxygen (www.doxygen.org) for a project.
|
# doxygen (www.doxygen.org) for a project.
|
||||||
@@ -32,13 +32,13 @@ DOXYFILE_ENCODING = UTF-8
|
|||||||
# title of most generated pages and in a few other places.
|
# title of most generated pages and in a few other places.
|
||||||
# The default value is: My Project.
|
# The default value is: My Project.
|
||||||
|
|
||||||
PROJECT_NAME = "@PACKAGE_NAME@"
|
PROJECT_NAME = @PACKAGE_NAME@
|
||||||
|
|
||||||
# The PROJECT_NUMBER tag can be used to enter a project or revision number. This
|
# The PROJECT_NUMBER tag can be used to enter a project or revision number. This
|
||||||
# could be handy for archiving the generated documentation or if some version
|
# could be handy for archiving the generated documentation or if some version
|
||||||
# control system is used.
|
# control system is used.
|
||||||
|
|
||||||
PROJECT_NUMBER = "@PACKAGE_VERSION@"
|
PROJECT_NUMBER = @PACKAGE_VERSION@
|
||||||
|
|
||||||
# Using the PROJECT_BRIEF tag one can provide an optional one line description
|
# Using the PROJECT_BRIEF tag one can provide an optional one line description
|
||||||
# for a project that appears at the top of each page and should give viewer a
|
# for a project that appears at the top of each page and should give viewer a
|
||||||
@@ -217,6 +217,14 @@ QT_AUTOBRIEF = NO
|
|||||||
|
|
||||||
MULTILINE_CPP_IS_BRIEF = NO
|
MULTILINE_CPP_IS_BRIEF = NO
|
||||||
|
|
||||||
|
# By default Python docstrings are displayed as preformatted text and doxygen's
|
||||||
|
# special commands cannot be used. By setting PYTHON_DOCSTRING to NO the
|
||||||
|
# doxygen's special commands can be used and the contents of the docstring
|
||||||
|
# documentation blocks is shown as doxygen documentation.
|
||||||
|
# The default value is: YES.
|
||||||
|
|
||||||
|
PYTHON_DOCSTRING = YES
|
||||||
|
|
||||||
# If the INHERIT_DOCS tag is set to YES then an undocumented member inherits the
|
# If the INHERIT_DOCS tag is set to YES then an undocumented member inherits the
|
||||||
# documentation from any documented member that it re-implements.
|
# documentation from any documented member that it re-implements.
|
||||||
# The default value is: YES.
|
# The default value is: YES.
|
||||||
@@ -253,12 +261,6 @@ TAB_SIZE = 8
|
|||||||
|
|
||||||
ALIASES =
|
ALIASES =
|
||||||
|
|
||||||
# This tag can be used to specify a number of word-keyword mappings (TCL only).
|
|
||||||
# A mapping has the form "name=value". For example adding "class=itcl::class"
|
|
||||||
# will allow you to use the command class in the itcl::class meaning.
|
|
||||||
|
|
||||||
TCL_SUBST =
|
|
||||||
|
|
||||||
# Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C sources
|
# Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C sources
|
||||||
# only. Doxygen will then generate output that is more tailored for C. For
|
# only. Doxygen will then generate output that is more tailored for C. For
|
||||||
# instance, some of the names that are used will be different. The list of all
|
# instance, some of the names that are used will be different. The list of all
|
||||||
@@ -300,18 +302,21 @@ OPTIMIZE_OUTPUT_SLICE = NO
|
|||||||
# extension. Doxygen has a built-in mapping, but you can override or extend it
|
# extension. Doxygen has a built-in mapping, but you can override or extend it
|
||||||
# using this tag. The format is ext=language, where ext is a file extension, and
|
# using this tag. The format is ext=language, where ext is a file extension, and
|
||||||
# language is one of the parsers supported by doxygen: IDL, Java, JavaScript,
|
# language is one of the parsers supported by doxygen: IDL, Java, JavaScript,
|
||||||
# Csharp (C#), C, C++, D, PHP, md (Markdown), Objective-C, Python, Slice,
|
# Csharp (C#), C, C++, D, PHP, md (Markdown), Objective-C, Python, Slice, VHDL,
|
||||||
# Fortran (fixed format Fortran: FortranFixed, free formatted Fortran:
|
# Fortran (fixed format Fortran: FortranFixed, free formatted Fortran:
|
||||||
# FortranFree, unknown formatted Fortran: Fortran. In the later case the parser
|
# FortranFree, unknown formatted Fortran: Fortran. In the later case the parser
|
||||||
# tries to guess whether the code is fixed or free formatted code, this is the
|
# tries to guess whether the code is fixed or free formatted code, this is the
|
||||||
# default for Fortran type files), VHDL, tcl. For instance to make doxygen treat
|
# default for Fortran type files). For instance to make doxygen treat .inc files
|
||||||
# .inc files as Fortran files (default is PHP), and .f files as C (default is
|
# as Fortran files (default is PHP), and .f files as C (default is Fortran),
|
||||||
# Fortran), use: inc=Fortran f=C.
|
# use: inc=Fortran f=C.
|
||||||
#
|
#
|
||||||
# Note: For files without extension you can use no_extension as a placeholder.
|
# Note: For files without extension you can use no_extension as a placeholder.
|
||||||
#
|
#
|
||||||
# Note that for custom extensions you also need to set FILE_PATTERNS otherwise
|
# Note that for custom extensions you also need to set FILE_PATTERNS otherwise
|
||||||
# the files are not read by doxygen.
|
# the files are not read by doxygen. When specifying no_extension you should add
|
||||||
|
# * to the FILE_PATTERNS.
|
||||||
|
#
|
||||||
|
# Note see also the list of default file extension mappings.
|
||||||
|
|
||||||
EXTENSION_MAPPING =
|
EXTENSION_MAPPING =
|
||||||
|
|
||||||
@@ -445,6 +450,19 @@ TYPEDEF_HIDES_STRUCT = NO
|
|||||||
|
|
||||||
LOOKUP_CACHE_SIZE = 0
|
LOOKUP_CACHE_SIZE = 0
|
||||||
|
|
||||||
|
# The NUM_PROC_THREADS specifies the number threads doxygen is allowed to use
|
||||||
|
# during processing. When set to 0 doxygen will based this on the number of
|
||||||
|
# cores available in the system. You can set it explicitly to a value larger
|
||||||
|
# than 0 to get more control over the balance between CPU load and processing
|
||||||
|
# speed. At this moment only the input processing can be done using multiple
|
||||||
|
# threads. Since this is still an experimental feature the default is set to 1,
|
||||||
|
# which efficively disables parallel processing. Please report any issues you
|
||||||
|
# encounter. Generating dot graphs in parallel is controlled by the
|
||||||
|
# DOT_NUM_THREADS setting.
|
||||||
|
# Minimum value: 0, maximum value: 32, default value: 1.
|
||||||
|
|
||||||
|
NUM_PROC_THREADS = 1
|
||||||
|
|
||||||
#---------------------------------------------------------------------------
|
#---------------------------------------------------------------------------
|
||||||
# Build related configuration options
|
# Build related configuration options
|
||||||
#---------------------------------------------------------------------------
|
#---------------------------------------------------------------------------
|
||||||
@@ -508,6 +526,13 @@ EXTRACT_LOCAL_METHODS = NO
|
|||||||
|
|
||||||
EXTRACT_ANON_NSPACES = NO
|
EXTRACT_ANON_NSPACES = NO
|
||||||
|
|
||||||
|
# If this flag is set to YES, the name of an unnamed parameter in a declaration
|
||||||
|
# will be determined by the corresponding definition. By default unnamed
|
||||||
|
# parameters remain unnamed in the output.
|
||||||
|
# The default value is: YES.
|
||||||
|
|
||||||
|
RESOLVE_UNNAMED_PARAMS = YES
|
||||||
|
|
||||||
# If the HIDE_UNDOC_MEMBERS tag is set to YES, doxygen will hide all
|
# If the HIDE_UNDOC_MEMBERS tag is set to YES, doxygen will hide all
|
||||||
# undocumented members inside documented classes or files. If set to NO these
|
# undocumented members inside documented classes or files. If set to NO these
|
||||||
# members will be included in the various overviews, but no documentation
|
# members will be included in the various overviews, but no documentation
|
||||||
@@ -545,11 +570,18 @@ HIDE_IN_BODY_DOCS = NO
|
|||||||
|
|
||||||
INTERNAL_DOCS = NO
|
INTERNAL_DOCS = NO
|
||||||
|
|
||||||
# If the CASE_SENSE_NAMES tag is set to NO then doxygen will only generate file
|
# With the correct setting of option CASE_SENSE_NAMES doxygen will better be
|
||||||
# names in lower-case letters. If set to YES, upper-case letters are also
|
# able to match the capabilities of the underlying filesystem. In case the
|
||||||
# allowed. This is useful if you have classes or files whose names only differ
|
# filesystem is case sensitive (i.e. it supports files in the same directory
|
||||||
# in case and if your file system supports case sensitive file names. Windows
|
# whose names only differ in casing), the option must be set to YES to properly
|
||||||
# (including Cygwin) ands Mac users are advised to set this option to NO.
|
# deal with such files in case they appear in the input. For filesystems that
|
||||||
|
# are not case sensitive the option should be be set to NO to properly deal with
|
||||||
|
# output files written for symbols that only differ in casing, such as for two
|
||||||
|
# classes, one named CLASS and the other named Class, and to also support
|
||||||
|
# references to files without having to specify the exact matching casing. On
|
||||||
|
# Windows (including Cygwin) and MacOS, users should typically set this option
|
||||||
|
# to NO, whereas on Linux or other Unix flavors it should typically be set to
|
||||||
|
# YES.
|
||||||
# The default value is: system dependent.
|
# The default value is: system dependent.
|
||||||
|
|
||||||
CASE_SENSE_NAMES = YES
|
CASE_SENSE_NAMES = YES
|
||||||
@@ -788,7 +820,10 @@ WARN_IF_DOC_ERROR = YES
|
|||||||
WARN_NO_PARAMDOC = NO
|
WARN_NO_PARAMDOC = NO
|
||||||
|
|
||||||
# If the WARN_AS_ERROR tag is set to YES then doxygen will immediately stop when
|
# If the WARN_AS_ERROR tag is set to YES then doxygen will immediately stop when
|
||||||
# a warning is encountered.
|
# a warning is encountered. If the WARN_AS_ERROR tag is set to FAIL_ON_WARNINGS
|
||||||
|
# then doxygen will continue running as if WARN_AS_ERROR tag is set to NO, but
|
||||||
|
# at the end of the doxygen process doxygen will return with a non-zero status.
|
||||||
|
# Possible values are: NO, YES and FAIL_ON_WARNINGS.
|
||||||
# The default value is: NO.
|
# The default value is: NO.
|
||||||
|
|
||||||
WARN_AS_ERROR = NO
|
WARN_AS_ERROR = NO
|
||||||
@@ -825,8 +860,8 @@ INPUT = @top_srcdir@/src \
|
|||||||
# This tag can be used to specify the character encoding of the source files
|
# This tag can be used to specify the character encoding of the source files
|
||||||
# that doxygen parses. Internally doxygen uses the UTF-8 encoding. Doxygen uses
|
# that doxygen parses. Internally doxygen uses the UTF-8 encoding. Doxygen uses
|
||||||
# libiconv (or the iconv built into libc) for the transcoding. See the libiconv
|
# libiconv (or the iconv built into libc) for the transcoding. See the libiconv
|
||||||
# documentation (see: https://www.gnu.org/software/libiconv/) for the list of
|
# documentation (see:
|
||||||
# possible encodings.
|
# https://www.gnu.org/software/libiconv/) for the list of possible encodings.
|
||||||
# The default value is: UTF-8.
|
# The default value is: UTF-8.
|
||||||
|
|
||||||
INPUT_ENCODING = UTF-8
|
INPUT_ENCODING = UTF-8
|
||||||
@@ -839,13 +874,15 @@ INPUT_ENCODING = UTF-8
|
|||||||
# need to set EXTENSION_MAPPING for the extension otherwise the files are not
|
# need to set EXTENSION_MAPPING for the extension otherwise the files are not
|
||||||
# read by doxygen.
|
# read by doxygen.
|
||||||
#
|
#
|
||||||
|
# Note the list of default checked file patterns might differ from the list of
|
||||||
|
# default file extension mappings.
|
||||||
|
#
|
||||||
# If left blank the following patterns are tested:*.c, *.cc, *.cxx, *.cpp,
|
# If left blank the following patterns are tested:*.c, *.cc, *.cxx, *.cpp,
|
||||||
# *.c++, *.java, *.ii, *.ixx, *.ipp, *.i++, *.inl, *.idl, *.ddl, *.odl, *.h,
|
# *.c++, *.java, *.ii, *.ixx, *.ipp, *.i++, *.inl, *.idl, *.ddl, *.odl, *.h,
|
||||||
# *.hh, *.hxx, *.hpp, *.h++, *.cs, *.d, *.php, *.php4, *.php5, *.phtml, *.inc,
|
# *.hh, *.hxx, *.hpp, *.h++, *.cs, *.d, *.php, *.php4, *.php5, *.phtml, *.inc,
|
||||||
# *.m, *.markdown, *.md, *.mm, *.dox (to be provided as doxygen C comment),
|
# *.m, *.markdown, *.md, *.mm, *.dox (to be provided as doxygen C comment),
|
||||||
# *.doc (to be provided as doxygen C comment), *.txt (to be provided as doxygen
|
# *.py, *.pyw, *.f90, *.f95, *.f03, *.f08, *.f18, *.f, *.for, *.vhd, *.vhdl,
|
||||||
# C comment), *.py, *.pyw, *.f90, *.f95, *.f03, *.f08, *.f, *.for, *.tcl, *.vhd,
|
# *.ucf, *.qsf and *.ice.
|
||||||
# *.vhdl, *.ucf, *.qsf and *.ice.
|
|
||||||
|
|
||||||
FILE_PATTERNS = *.c \
|
FILE_PATTERNS = *.c \
|
||||||
*.h \
|
*.h \
|
||||||
@@ -1075,13 +1112,6 @@ VERBATIM_HEADERS = YES
|
|||||||
|
|
||||||
ALPHABETICAL_INDEX = YES
|
ALPHABETICAL_INDEX = YES
|
||||||
|
|
||||||
# The COLS_IN_ALPHA_INDEX tag can be used to specify the number of columns in
|
|
||||||
# which the alphabetical index list will be split.
|
|
||||||
# Minimum value: 1, maximum value: 20, default value: 5.
|
|
||||||
# This tag requires that the tag ALPHABETICAL_INDEX is set to YES.
|
|
||||||
|
|
||||||
COLS_IN_ALPHA_INDEX = 5
|
|
||||||
|
|
||||||
# In case all classes in a project start with a common prefix, all classes will
|
# In case all classes in a project start with a common prefix, all classes will
|
||||||
# be put under the same header in the alphabetical index. The IGNORE_PREFIX tag
|
# be put under the same header in the alphabetical index. The IGNORE_PREFIX tag
|
||||||
# can be used to specify a prefix (or a list of prefixes) that should be ignored
|
# can be used to specify a prefix (or a list of prefixes) that should be ignored
|
||||||
@@ -1252,10 +1282,11 @@ HTML_INDEX_NUM_ENTRIES = 100
|
|||||||
|
|
||||||
# If the GENERATE_DOCSET tag is set to YES, additional index files will be
|
# If the GENERATE_DOCSET tag is set to YES, additional index files will be
|
||||||
# generated that can be used as input for Apple's Xcode 3 integrated development
|
# generated that can be used as input for Apple's Xcode 3 integrated development
|
||||||
# environment (see: https://developer.apple.com/xcode/), introduced with OSX
|
# environment (see:
|
||||||
# 10.5 (Leopard). To create a documentation set, doxygen will generate a
|
# https://developer.apple.com/xcode/), introduced with OSX 10.5 (Leopard). To
|
||||||
# Makefile in the HTML output directory. Running make will produce the docset in
|
# create a documentation set, doxygen will generate a Makefile in the HTML
|
||||||
# that directory and running make install will install the docset in
|
# output directory. Running make will produce the docset in that directory and
|
||||||
|
# running make install will install the docset in
|
||||||
# ~/Library/Developer/Shared/Documentation/DocSets so that Xcode will find it at
|
# ~/Library/Developer/Shared/Documentation/DocSets so that Xcode will find it at
|
||||||
# startup. See https://developer.apple.com/library/archive/featuredarticles/Doxy
|
# startup. See https://developer.apple.com/library/archive/featuredarticles/Doxy
|
||||||
# genXcode/_index.html for more information.
|
# genXcode/_index.html for more information.
|
||||||
@@ -1297,8 +1328,8 @@ DOCSET_PUBLISHER_NAME = Publisher
|
|||||||
# If the GENERATE_HTMLHELP tag is set to YES then doxygen generates three
|
# If the GENERATE_HTMLHELP tag is set to YES then doxygen generates three
|
||||||
# additional HTML index files: index.hhp, index.hhc, and index.hhk. The
|
# additional HTML index files: index.hhp, index.hhc, and index.hhk. The
|
||||||
# index.hhp is a project file that can be read by Microsoft's HTML Help Workshop
|
# index.hhp is a project file that can be read by Microsoft's HTML Help Workshop
|
||||||
# (see: https://www.microsoft.com/en-us/download/details.aspx?id=21138) on
|
# (see:
|
||||||
# Windows.
|
# https://www.microsoft.com/en-us/download/details.aspx?id=21138) on Windows.
|
||||||
#
|
#
|
||||||
# The HTML Help Workshop contains a compiler that can convert all HTML output
|
# The HTML Help Workshop contains a compiler that can convert all HTML output
|
||||||
# generated by doxygen into a single compiled HTML file (.chm). Compiled HTML
|
# generated by doxygen into a single compiled HTML file (.chm). Compiled HTML
|
||||||
@@ -1328,7 +1359,7 @@ CHM_FILE =
|
|||||||
HHC_LOCATION =
|
HHC_LOCATION =
|
||||||
|
|
||||||
# The GENERATE_CHI flag controls if a separate .chi index file is generated
|
# The GENERATE_CHI flag controls if a separate .chi index file is generated
|
||||||
# (YES) or that it should be included in the master .chm file (NO).
|
# (YES) or that it should be included in the main .chm file (NO).
|
||||||
# The default value is: NO.
|
# The default value is: NO.
|
||||||
# This tag requires that the tag GENERATE_HTMLHELP is set to YES.
|
# This tag requires that the tag GENERATE_HTMLHELP is set to YES.
|
||||||
|
|
||||||
@@ -1373,7 +1404,8 @@ QCH_FILE =
|
|||||||
|
|
||||||
# The QHP_NAMESPACE tag specifies the namespace to use when generating Qt Help
|
# The QHP_NAMESPACE tag specifies the namespace to use when generating Qt Help
|
||||||
# Project output. For more information please see Qt Help Project / Namespace
|
# Project output. For more information please see Qt Help Project / Namespace
|
||||||
# (see: https://doc.qt.io/archives/qt-4.8/qthelpproject.html#namespace).
|
# (see:
|
||||||
|
# https://doc.qt.io/archives/qt-4.8/qthelpproject.html#namespace).
|
||||||
# The default value is: org.doxygen.Project.
|
# The default value is: org.doxygen.Project.
|
||||||
# This tag requires that the tag GENERATE_QHP is set to YES.
|
# This tag requires that the tag GENERATE_QHP is set to YES.
|
||||||
|
|
||||||
@@ -1381,8 +1413,8 @@ QHP_NAMESPACE = org.doxygen.Project
|
|||||||
|
|
||||||
# The QHP_VIRTUAL_FOLDER tag specifies the namespace to use when generating Qt
|
# The QHP_VIRTUAL_FOLDER tag specifies the namespace to use when generating Qt
|
||||||
# Help Project output. For more information please see Qt Help Project / Virtual
|
# Help Project output. For more information please see Qt Help Project / Virtual
|
||||||
# Folders (see: https://doc.qt.io/archives/qt-4.8/qthelpproject.html#virtual-
|
# Folders (see:
|
||||||
# folders).
|
# https://doc.qt.io/archives/qt-4.8/qthelpproject.html#virtual-folders).
|
||||||
# The default value is: doc.
|
# The default value is: doc.
|
||||||
# This tag requires that the tag GENERATE_QHP is set to YES.
|
# This tag requires that the tag GENERATE_QHP is set to YES.
|
||||||
|
|
||||||
@@ -1390,16 +1422,16 @@ QHP_VIRTUAL_FOLDER = doc
|
|||||||
|
|
||||||
# If the QHP_CUST_FILTER_NAME tag is set, it specifies the name of a custom
|
# If the QHP_CUST_FILTER_NAME tag is set, it specifies the name of a custom
|
||||||
# filter to add. For more information please see Qt Help Project / Custom
|
# filter to add. For more information please see Qt Help Project / Custom
|
||||||
# Filters (see: https://doc.qt.io/archives/qt-4.8/qthelpproject.html#custom-
|
# Filters (see:
|
||||||
# filters).
|
# https://doc.qt.io/archives/qt-4.8/qthelpproject.html#custom-filters).
|
||||||
# This tag requires that the tag GENERATE_QHP is set to YES.
|
# This tag requires that the tag GENERATE_QHP is set to YES.
|
||||||
|
|
||||||
QHP_CUST_FILTER_NAME =
|
QHP_CUST_FILTER_NAME =
|
||||||
|
|
||||||
# The QHP_CUST_FILTER_ATTRS tag specifies the list of the attributes of the
|
# The QHP_CUST_FILTER_ATTRS tag specifies the list of the attributes of the
|
||||||
# custom filter to add. For more information please see Qt Help Project / Custom
|
# custom filter to add. For more information please see Qt Help Project / Custom
|
||||||
# Filters (see: https://doc.qt.io/archives/qt-4.8/qthelpproject.html#custom-
|
# Filters (see:
|
||||||
# filters).
|
# https://doc.qt.io/archives/qt-4.8/qthelpproject.html#custom-filters).
|
||||||
# This tag requires that the tag GENERATE_QHP is set to YES.
|
# This tag requires that the tag GENERATE_QHP is set to YES.
|
||||||
|
|
||||||
QHP_CUST_FILTER_ATTRS =
|
QHP_CUST_FILTER_ATTRS =
|
||||||
@@ -1411,9 +1443,9 @@ QHP_CUST_FILTER_ATTRS =
|
|||||||
|
|
||||||
QHP_SECT_FILTER_ATTRS =
|
QHP_SECT_FILTER_ATTRS =
|
||||||
|
|
||||||
# The QHG_LOCATION tag can be used to specify the location of Qt's
|
# The QHG_LOCATION tag can be used to specify the location (absolute path
|
||||||
# qhelpgenerator. If non-empty doxygen will try to run qhelpgenerator on the
|
# including file name) of Qt's qhelpgenerator. If non-empty doxygen will try to
|
||||||
# generated .qhp file.
|
# run qhelpgenerator on the generated .qhp file.
|
||||||
# This tag requires that the tag GENERATE_QHP is set to YES.
|
# This tag requires that the tag GENERATE_QHP is set to YES.
|
||||||
|
|
||||||
QHG_LOCATION =
|
QHG_LOCATION =
|
||||||
@@ -1490,6 +1522,17 @@ TREEVIEW_WIDTH = 250
|
|||||||
|
|
||||||
EXT_LINKS_IN_WINDOW = NO
|
EXT_LINKS_IN_WINDOW = NO
|
||||||
|
|
||||||
|
# If the HTML_FORMULA_FORMAT option is set to svg, doxygen will use the pdf2svg
|
||||||
|
# tool (see https://github.com/dawbarton/pdf2svg) or inkscape (see
|
||||||
|
# https://inkscape.org) to generate formulas as SVG images instead of PNGs for
|
||||||
|
# the HTML output. These images will generally look nicer at scaled resolutions.
|
||||||
|
# Possible values are: png (the default) and svg (looks nicer but requires the
|
||||||
|
# pdf2svg or inkscape tool).
|
||||||
|
# The default value is: png.
|
||||||
|
# This tag requires that the tag GENERATE_HTML is set to YES.
|
||||||
|
|
||||||
|
HTML_FORMULA_FORMAT = png
|
||||||
|
|
||||||
# Use this tag to change the font size of LaTeX formulas included as images in
|
# Use this tag to change the font size of LaTeX formulas included as images in
|
||||||
# the HTML documentation. When you change the font size after a successful
|
# the HTML documentation. When you change the font size after a successful
|
||||||
# doxygen run you need to manually remove any form_*.png images from the HTML
|
# doxygen run you need to manually remove any form_*.png images from the HTML
|
||||||
@@ -1529,7 +1572,7 @@ USE_MATHJAX = NO
|
|||||||
|
|
||||||
# When MathJax is enabled you can set the default output format to be used for
|
# When MathJax is enabled you can set the default output format to be used for
|
||||||
# the MathJax output. See the MathJax site (see:
|
# the MathJax output. See the MathJax site (see:
|
||||||
# http://docs.mathjax.org/en/latest/output.html) for more details.
|
# http://docs.mathjax.org/en/v2.7-latest/output.html) for more details.
|
||||||
# Possible values are: HTML-CSS (which is slower, but has the best
|
# Possible values are: HTML-CSS (which is slower, but has the best
|
||||||
# compatibility), NativeMML (i.e. MathML) and SVG.
|
# compatibility), NativeMML (i.e. MathML) and SVG.
|
||||||
# The default value is: HTML-CSS.
|
# The default value is: HTML-CSS.
|
||||||
@@ -1545,7 +1588,7 @@ MATHJAX_FORMAT = HTML-CSS
|
|||||||
# Content Delivery Network so you can quickly see the result without installing
|
# Content Delivery Network so you can quickly see the result without installing
|
||||||
# MathJax. However, it is strongly recommended to install a local copy of
|
# MathJax. However, it is strongly recommended to install a local copy of
|
||||||
# MathJax from https://www.mathjax.org before deployment.
|
# MathJax from https://www.mathjax.org before deployment.
|
||||||
# The default value is: https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/.
|
# The default value is: https://cdn.jsdelivr.net/npm/mathjax@2.
|
||||||
# This tag requires that the tag USE_MATHJAX is set to YES.
|
# This tag requires that the tag USE_MATHJAX is set to YES.
|
||||||
|
|
||||||
MATHJAX_RELPATH = http://cdn.mathjax.org/mathjax/latest
|
MATHJAX_RELPATH = http://cdn.mathjax.org/mathjax/latest
|
||||||
@@ -1559,7 +1602,8 @@ MATHJAX_EXTENSIONS =
|
|||||||
|
|
||||||
# The MATHJAX_CODEFILE tag can be used to specify a file with javascript pieces
|
# The MATHJAX_CODEFILE tag can be used to specify a file with javascript pieces
|
||||||
# of code that will be used on startup of the MathJax code. See the MathJax site
|
# of code that will be used on startup of the MathJax code. See the MathJax site
|
||||||
# (see: http://docs.mathjax.org/en/latest/output.html) for more details. For an
|
# (see:
|
||||||
|
# http://docs.mathjax.org/en/v2.7-latest/output.html) for more details. For an
|
||||||
# example see the documentation.
|
# example see the documentation.
|
||||||
# This tag requires that the tag USE_MATHJAX is set to YES.
|
# This tag requires that the tag USE_MATHJAX is set to YES.
|
||||||
|
|
||||||
@@ -1606,7 +1650,8 @@ SERVER_BASED_SEARCH = NO
|
|||||||
#
|
#
|
||||||
# Doxygen ships with an example indexer (doxyindexer) and search engine
|
# Doxygen ships with an example indexer (doxyindexer) and search engine
|
||||||
# (doxysearch.cgi) which are based on the open source search engine library
|
# (doxysearch.cgi) which are based on the open source search engine library
|
||||||
# Xapian (see: https://xapian.org/).
|
# Xapian (see:
|
||||||
|
# https://xapian.org/).
|
||||||
#
|
#
|
||||||
# See the section "External Indexing and Searching" for details.
|
# See the section "External Indexing and Searching" for details.
|
||||||
# The default value is: NO.
|
# The default value is: NO.
|
||||||
@@ -1619,8 +1664,9 @@ EXTERNAL_SEARCH = NO
|
|||||||
#
|
#
|
||||||
# Doxygen ships with an example indexer (doxyindexer) and search engine
|
# Doxygen ships with an example indexer (doxyindexer) and search engine
|
||||||
# (doxysearch.cgi) which are based on the open source search engine library
|
# (doxysearch.cgi) which are based on the open source search engine library
|
||||||
# Xapian (see: https://xapian.org/). See the section "External Indexing and
|
# Xapian (see:
|
||||||
# Searching" for details.
|
# https://xapian.org/). See the section "External Indexing and Searching" for
|
||||||
|
# details.
|
||||||
# This tag requires that the tag SEARCHENGINE is set to YES.
|
# This tag requires that the tag SEARCHENGINE is set to YES.
|
||||||
|
|
||||||
SEARCHENGINE_URL =
|
SEARCHENGINE_URL =
|
||||||
@@ -1715,7 +1761,7 @@ COMPACT_LATEX = NO
|
|||||||
# The default value is: a4.
|
# The default value is: a4.
|
||||||
# This tag requires that the tag GENERATE_LATEX is set to YES.
|
# This tag requires that the tag GENERATE_LATEX is set to YES.
|
||||||
|
|
||||||
PAPER_TYPE = a4wide
|
PAPER_TYPE = a4
|
||||||
|
|
||||||
# The EXTRA_PACKAGES tag can be used to specify one or more LaTeX package names
|
# The EXTRA_PACKAGES tag can be used to specify one or more LaTeX package names
|
||||||
# that should be included in the LaTeX output. The package can be specified just
|
# that should be included in the LaTeX output. The package can be specified just
|
||||||
@@ -1784,9 +1830,11 @@ LATEX_EXTRA_FILES =
|
|||||||
|
|
||||||
PDF_HYPERLINKS = YES
|
PDF_HYPERLINKS = YES
|
||||||
|
|
||||||
# If the USE_PDFLATEX tag is set to YES, doxygen will use pdflatex to generate
|
# If the USE_PDFLATEX tag is set to YES, doxygen will use the engine as
|
||||||
# the PDF file directly from the LaTeX files. Set this option to YES, to get a
|
# specified with LATEX_CMD_NAME to generate the PDF file directly from the LaTeX
|
||||||
# higher quality PDF documentation.
|
# files. Set this option to YES, to get a higher quality PDF documentation.
|
||||||
|
#
|
||||||
|
# See also section LATEX_CMD_NAME for selecting the engine.
|
||||||
# The default value is: YES.
|
# The default value is: YES.
|
||||||
# This tag requires that the tag GENERATE_LATEX is set to YES.
|
# This tag requires that the tag GENERATE_LATEX is set to YES.
|
||||||
|
|
||||||
@@ -2299,10 +2347,32 @@ UML_LOOK = NO
|
|||||||
# but if the number exceeds 15, the total amount of fields shown is limited to
|
# but if the number exceeds 15, the total amount of fields shown is limited to
|
||||||
# 10.
|
# 10.
|
||||||
# Minimum value: 0, maximum value: 100, default value: 10.
|
# Minimum value: 0, maximum value: 100, default value: 10.
|
||||||
# This tag requires that the tag HAVE_DOT is set to YES.
|
# This tag requires that the tag UML_LOOK is set to YES.
|
||||||
|
|
||||||
UML_LIMIT_NUM_FIELDS = 10
|
UML_LIMIT_NUM_FIELDS = 10
|
||||||
|
|
||||||
|
# If the DOT_UML_DETAILS tag is set to NO, doxygen will show attributes and
|
||||||
|
# methods without types and arguments in the UML graphs. If the DOT_UML_DETAILS
|
||||||
|
# tag is set to YES, doxygen will add type and arguments for attributes and
|
||||||
|
# methods in the UML graphs. If the DOT_UML_DETAILS tag is set to NONE, doxygen
|
||||||
|
# will not generate fields with class member information in the UML graphs. The
|
||||||
|
# class diagrams will look similar to the default class diagrams but using UML
|
||||||
|
# notation for the relationships.
|
||||||
|
# Possible values are: NO, YES and NONE.
|
||||||
|
# The default value is: NO.
|
||||||
|
# This tag requires that the tag UML_LOOK is set to YES.
|
||||||
|
|
||||||
|
DOT_UML_DETAILS = NO
|
||||||
|
|
||||||
|
# The DOT_WRAP_THRESHOLD tag can be used to set the maximum number of characters
|
||||||
|
# to display on a single line. If the actual line length exceeds this threshold
|
||||||
|
# significantly it will wrapped across multiple lines. Some heuristics are apply
|
||||||
|
# to avoid ugly line breaks.
|
||||||
|
# Minimum value: 0, maximum value: 1000, default value: 17.
|
||||||
|
# This tag requires that the tag HAVE_DOT is set to YES.
|
||||||
|
|
||||||
|
DOT_WRAP_THRESHOLD = 17
|
||||||
|
|
||||||
# If the TEMPLATE_RELATIONS tag is set to YES then the inheritance and
|
# If the TEMPLATE_RELATIONS tag is set to YES then the inheritance and
|
||||||
# collaboration graphs will show the relations between templates and their
|
# collaboration graphs will show the relations between templates and their
|
||||||
# instances.
|
# instances.
|
||||||
@@ -2492,9 +2562,11 @@ DOT_MULTI_TARGETS = NO
|
|||||||
|
|
||||||
GENERATE_LEGEND = YES
|
GENERATE_LEGEND = YES
|
||||||
|
|
||||||
# If the DOT_CLEANUP tag is set to YES, doxygen will remove the intermediate dot
|
# If the DOT_CLEANUP tag is set to YES, doxygen will remove the intermediate
|
||||||
# files that are used to generate the various graphs.
|
# files that are used to generate the various graphs.
|
||||||
|
#
|
||||||
|
# Note: This setting is not only used for dot files but also for msc and
|
||||||
|
# plantuml temporary files.
|
||||||
# The default value is: YES.
|
# The default value is: YES.
|
||||||
# This tag requires that the tag HAVE_DOT is set to YES.
|
|
||||||
|
|
||||||
DOT_CLEANUP = YES
|
DOT_CLEANUP = YES
|
||||||
|
|||||||
+2019
-622
File diff suppressed because it is too large
Load Diff
+23
@@ -0,0 +1,23 @@
|
|||||||
|
%union
|
||||||
|
{
|
||||||
|
int ival;
|
||||||
|
const char *sval;
|
||||||
|
}
|
||||||
|
|
||||||
|
%token <ival> NUM
|
||||||
|
%nterm <ival> exp
|
||||||
|
%token <sval> STR
|
||||||
|
%nterm <sval> useless
|
||||||
|
|
||||||
|
%left '+' '-'
|
||||||
|
%left '*'
|
||||||
|
|
||||||
|
%%
|
||||||
|
exp:
|
||||||
|
exp '+' exp
|
||||||
|
| exp '-' exp
|
||||||
|
| exp '*' exp
|
||||||
|
| exp '/' exp
|
||||||
|
| NUM
|
||||||
|
;
|
||||||
|
useless: STR;
|
||||||
+13
@@ -0,0 +1,13 @@
|
|||||||
|
%%
|
||||||
|
stmt:
|
||||||
|
expr
|
||||||
|
| if_stmt
|
||||||
|
;
|
||||||
|
|
||||||
|
if_stmt:
|
||||||
|
"if" expr "then" stmt
|
||||||
|
| "if" expr "then" stmt "else" stmt
|
||||||
|
;
|
||||||
|
|
||||||
|
expr:
|
||||||
|
"identifier"
|
||||||
@@ -3,7 +3,7 @@ digraph "reduce.y"
|
|||||||
node [fontname=courier shape=box]
|
node [fontname=courier shape=box]
|
||||||
edge [fontname=courier]
|
edge [fontname=courier]
|
||||||
|
|
||||||
1 [label="State 1\n 3 a: \"0\" . [\".\"]\l 4 b: \"0\" . [\";\"]\l"]
|
1 [label="State 1\n 3 a: \"0\" • [\".\"]\l 4 b: \"0\" • [\";\"]\l"]
|
||||||
1 -> "1R3" [label="" style=solid]
|
1 -> "1R3" [label="" style=solid]
|
||||||
"1R3" [style=filled shape=diamond fillcolor=yellowgreen label="R3"]
|
"1R3" [style=filled shape=diamond fillcolor=yellowgreen label="R3"]
|
||||||
1 -> "1R4" [label="[\";\"]" style=solid]
|
1 -> "1R4" [label="[\";\"]" style=solid]
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
.------------------.
|
.------------------.
|
||||||
| State 1 |
|
| State 1 |
|
||||||
| 3 a: "0" . [";"] |
|
| 3 a: "0" • [";"] |
|
||||||
| 4 b: "0" . ["."] |
|
| 4 b: "0" • ["."] |
|
||||||
`------------------'
|
`------------------'
|
||||||
/ \
|
/ \
|
||||||
/ \ ["."]
|
/ \ ["."]
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ digraph "shift.y"
|
|||||||
node [fontname=courier shape=box]
|
node [fontname=courier shape=box]
|
||||||
edge [fontname=courier]
|
edge [fontname=courier]
|
||||||
|
|
||||||
3 [label="State 3\n 1 exp: a . \".\"\l"]
|
3 [label="State 3\n 1 exp: a • \".\"\l"]
|
||||||
3 -> 6 [style=solid label="\".\""]
|
3 -> 6 [style=solid label="\".\""]
|
||||||
6 [label="State 6\n 1 exp: a \".\" .\l"]
|
6 [label="State 6\n 1 exp: a \".\" •\l"]
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
.----------------.
|
.----------------.
|
||||||
| State 3 |
|
| State 3 |
|
||||||
| 1 exp: a . ";" |
|
| 1 exp: a • ";" |
|
||||||
`----------------'
|
`----------------'
|
||||||
|
|
|
|
||||||
| ";"
|
| ";"
|
||||||
@@ -8,5 +8,5 @@
|
|||||||
v
|
v
|
||||||
.----------------.
|
.----------------.
|
||||||
| State 6 |
|
| State 6 |
|
||||||
| 1 exp: a ";" . |
|
| 1 exp: a ";" • |
|
||||||
`----------------'
|
`----------------'
|
||||||
|
|||||||
+10
-10
@@ -1,35 +1,35 @@
|
|||||||
// Generated by GNU Bison 2.6.90.
|
// Generated by GNU Bison 2.6.90.
|
||||||
// Report bugs to <[email protected]>.
|
// Report bugs to <[email protected]>.
|
||||||
// Home page: <http://www.gnu.org/software/bison/>.
|
// Home page: <https://www.gnu.org/software/bison/>.
|
||||||
|
|
||||||
digraph "/tmp/fo.y"
|
digraph "example.y"
|
||||||
{
|
{
|
||||||
node [fontname = courier, shape = box, colorscheme = paired6]
|
node [fontname = courier, shape = box, colorscheme = paired6]
|
||||||
edge [fontname = courier]
|
edge [fontname = courier]
|
||||||
|
|
||||||
0 [label="State 0\n\l 0 $accept: . exp $end\l 1 exp: . a \";\"\l 2 | . b \".\"\l 3 a: . \"0\"\l 4 b: . \"0\"\l"]
|
0 [label="State 0\n\l 0 $accept: • exp $end\l 1 exp: • a \";\"\l 2 | • b \".\"\l 3 a: • \"0\"\l 4 b: • \"0\"\l"]
|
||||||
0 -> 1 [style=solid label="\"0\""]
|
0 -> 1 [style=solid label="\"0\""]
|
||||||
0 -> 2 [style=dashed label="exp"]
|
0 -> 2 [style=dashed label="exp"]
|
||||||
0 -> 3 [style=dashed label="a"]
|
0 -> 3 [style=dashed label="a"]
|
||||||
0 -> 4 [style=dashed label="b"]
|
0 -> 4 [style=dashed label="b"]
|
||||||
1 [label="State 1\n\l 3 a: \"0\" . [\";\"]\l 4 b: \"0\" . [\".\"]\l"]
|
1 [label="State 1\n\l 3 a: \"0\" • [\";\"]\l 4 b: \"0\" • [\".\"]\l"]
|
||||||
1 -> "1R3" [style=solid]
|
1 -> "1R3" [style=solid]
|
||||||
"1R3" [label="R3", fillcolor=3, shape=diamond, style=filled]
|
"1R3" [label="R3", fillcolor=3, shape=diamond, style=filled]
|
||||||
1 -> "1R4" [label="[\".\"]", style=solid]
|
1 -> "1R4" [label="[\".\"]", style=solid]
|
||||||
"1R4" [label="R4", fillcolor=3, shape=diamond, style=filled]
|
"1R4" [label="R4", fillcolor=3, shape=diamond, style=filled]
|
||||||
2 [label="State 2\n\l 0 $accept: exp . $end\l"]
|
2 [label="State 2\n\l 0 $accept: exp • $end\l"]
|
||||||
2 -> 5 [style=solid label="$end"]
|
2 -> 5 [style=solid label="$end"]
|
||||||
3 [label="State 3\n\l 1 exp: a . \";\"\l"]
|
3 [label="State 3\n\l 1 exp: a • \";\"\l"]
|
||||||
3 -> 6 [style=solid label="\";\""]
|
3 -> 6 [style=solid label="\";\""]
|
||||||
4 [label="State 4\n\l 2 exp: b . \".\"\l"]
|
4 [label="State 4\n\l 2 exp: b • \".\"\l"]
|
||||||
4 -> 7 [style=solid label="\".\""]
|
4 -> 7 [style=solid label="\".\""]
|
||||||
5 [label="State 5\n\l 0 $accept: exp $end .\l"]
|
5 [label="State 5\n\l 0 $accept: exp $end •\l"]
|
||||||
5 -> "5R0" [style=solid]
|
5 -> "5R0" [style=solid]
|
||||||
"5R0" [label="Acc", fillcolor=1, shape=diamond, style=filled]
|
"5R0" [label="Acc", fillcolor=1, shape=diamond, style=filled]
|
||||||
6 [label="State 6\n\l 1 exp: a \";\" .\l"]
|
6 [label="State 6\n\l 1 exp: a \";\" •\l"]
|
||||||
6 -> "6R1" [style=solid]
|
6 -> "6R1" [style=solid]
|
||||||
"6R1" [label="R1", fillcolor=3, shape=diamond, style=filled]
|
"6R1" [label="R1", fillcolor=3, shape=diamond, style=filled]
|
||||||
7 [label="State 7\n\l 2 exp: b \".\" .\l"]
|
7 [label="State 7\n\l 2 exp: b \".\" •\l"]
|
||||||
7 -> "7R2" [style=solid]
|
7 -> "7R2" [style=solid]
|
||||||
"7R2" [label="R2", fillcolor=3, shape=diamond, style=filled]
|
"7R2" [label="R2", fillcolor=3, shape=diamond, style=filled]
|
||||||
}
|
}
|
||||||
|
|||||||
+4
-4
@@ -1,4 +1,4 @@
|
|||||||
## Copyright (C) 2001-2003, 2005-2015, 2018-2020 Free Software
|
## Copyright (C) 2001-2003, 2005-2015, 2018-2021 Free Software
|
||||||
## Foundation, Inc.
|
## Foundation, Inc.
|
||||||
|
|
||||||
## This program is free software: you can redistribute it and/or modify
|
## This program is free software: you can redistribute it and/or modify
|
||||||
@@ -12,7 +12,7 @@
|
|||||||
## GNU General Public License for more details.
|
## GNU General Public License for more details.
|
||||||
##
|
##
|
||||||
## You should have received a copy of the GNU General Public License
|
## You should have received a copy of the GNU General Public License
|
||||||
## along with this program. If not, see <http://www.gnu.org/licenses/>.
|
## along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
AM_MAKEINFOFLAGS = \
|
AM_MAKEINFOFLAGS = \
|
||||||
--no-split \
|
--no-split \
|
||||||
@@ -56,8 +56,8 @@ MAINTAINERCLEANFILES = $(CROSS_OPTIONS_TEXI)
|
|||||||
|
|
||||||
|
|
||||||
# Fix Info's @code in @deftype
|
# Fix Info's @code in @deftype
|
||||||
# https://lists.gnu.org/archive/html/help-texinfo/2019-11/msg00004.html
|
# https://lists.gnu.org/r/help-texinfo/2019-11/msg00004.html
|
||||||
all: $(srcdir)/$(%C%_bison).info.bak
|
all-local: $(srcdir)/$(%C%_bison).info.bak
|
||||||
$(srcdir)/$(%C%_bison).info.bak: $(srcdir)/$(%C%_bison).info
|
$(srcdir)/$(%C%_bison).info.bak: $(srcdir)/$(%C%_bison).info
|
||||||
$(AM_V_GEN) $(PERL) -pi.bak -0777 \
|
$(AM_V_GEN) $(PERL) -pi.bak -0777 \
|
||||||
-e 's{(^ --.*\n(?: {10}.*\n)*)}' \
|
-e 's{(^ --.*\n(?: {10}.*\n)*)}' \
|
||||||
|
|||||||
+2
-2
@@ -19,7 +19,7 @@
|
|||||||
\def\finalout{\overfullrule=0pt}
|
\def\finalout{\overfullrule=0pt}
|
||||||
%\finalout
|
%\finalout
|
||||||
|
|
||||||
% Copyright (c) 1998, 2001, 2009--2015, 2018--2020 Free Software
|
% Copyright (c) 1998, 2001, 2009--2015, 2018--2021 Free Software
|
||||||
% Foundation, Inc.
|
% Foundation, Inc.
|
||||||
%
|
%
|
||||||
% This file is part of Bison.
|
% This file is part of Bison.
|
||||||
@@ -35,7 +35,7 @@
|
|||||||
% GNU General Public License for more details.
|
% GNU General Public License for more details.
|
||||||
%
|
%
|
||||||
% You should have received a copy of the GNU General Public License
|
% You should have received a copy of the GNU General Public License
|
||||||
% along with this program. If not, see <http://www.gnu.org/licenses/>.
|
% along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
%
|
%
|
||||||
% This file is intended to be processed by plain TeX (TeX82).
|
% This file is intended to be processed by plain TeX (TeX82).
|
||||||
%
|
%
|
||||||
|
|||||||
@@ -0,0 +1,10 @@
|
|||||||
|
%%
|
||||||
|
sequence:
|
||||||
|
%empty
|
||||||
|
| maybeword
|
||||||
|
| sequence "word"
|
||||||
|
;
|
||||||
|
maybeword:
|
||||||
|
%empty
|
||||||
|
| "word"
|
||||||
|
;
|
||||||
-38
@@ -1,38 +0,0 @@
|
|||||||
* bench.pl
|
|
||||||
A primitive Perl script to run benches. Currently its only bench is
|
|
||||||
the usual calculator: it has a lightweight processing part (but not
|
|
||||||
null), so it is really emphasizing the cost of the whole parsing
|
|
||||||
(including scanning and I/O).
|
|
||||||
|
|
||||||
Set the envvars BISON and CC to the programs and flags you want to
|
|
||||||
use. They default to bison and gcc. To run a non-installed bison
|
|
||||||
from a tarball built in _build, I suggest the following.
|
|
||||||
|
|
||||||
BISON=_build/tests/bison CC='gcc -O2' ./bench.pl
|
|
||||||
|
|
||||||
(The _build/tests/bison wrapper makes sure that _build/src/bison will
|
|
||||||
use the tarballs' skeletons, not those already installed as a
|
|
||||||
straightforward use of _build/src/bison would.)
|
|
||||||
|
|
||||||
--
|
|
||||||
|
|
||||||
Copyright (C) 2006, 2009-2015, 2018-2020 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/>.
|
|
||||||
|
|
||||||
Local Variables:
|
|
||||||
mode: outline
|
|
||||||
End:
|
|
||||||
@@ -0,0 +1,36 @@
|
|||||||
|
# bench.pl
|
||||||
|
A primitive Perl script to run benches. Currently its only bench is the
|
||||||
|
usual calculator: it has a lightweight processing part (but not null), so it
|
||||||
|
is really emphasizing the cost of the whole parsing (including scanning and
|
||||||
|
I/O).
|
||||||
|
|
||||||
|
Set the envvars `BISON` and `CC` to the programs and flags you want to use.
|
||||||
|
They default to `bison` and `gcc`. To run a non-installed bison from a
|
||||||
|
tarball built in _build, I suggest the following.
|
||||||
|
|
||||||
|
BISON=_build/tests/bison CC='gcc -O2' ./bench.pl
|
||||||
|
|
||||||
|
(The `_build/tests/bison` wrapper makes sure that `_build/src/bison` will
|
||||||
|
use the tarballs' skeletons, not those already installed as a
|
||||||
|
straightforward use of `_build/src/bison` would.)
|
||||||
|
|
||||||
|
<!--
|
||||||
|
|
||||||
|
Local Variables:
|
||||||
|
mode: markdown
|
||||||
|
fill-column: 76
|
||||||
|
ispell-dictionary: "american"
|
||||||
|
End:
|
||||||
|
|
||||||
|
Copyright (C) 2006, 2009-2015, 2018-2021 Free Software Foundation, Inc.
|
||||||
|
|
||||||
|
This file is part of Bison, the GNU Compiler Compiler.
|
||||||
|
|
||||||
|
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.
|
||||||
|
|
||||||
|
-->
|
||||||
+125
-54
@@ -1,6 +1,6 @@
|
|||||||
#! /usr/bin/perl -w
|
#! /usr/bin/perl -w
|
||||||
|
|
||||||
# Copyright (C) 2006, 2008-2015, 2018-2020 Free Software Foundation,
|
# Copyright (C) 2006, 2008-2015, 2018-2021 Free Software Foundation,
|
||||||
# Inc.
|
# Inc.
|
||||||
#
|
#
|
||||||
# This file is part of Bison, the GNU Compiler Compiler.
|
# This file is part of Bison, the GNU Compiler Compiler.
|
||||||
@@ -16,7 +16,7 @@
|
|||||||
# GNU General Public License for more details.
|
# GNU General Public License for more details.
|
||||||
#
|
#
|
||||||
# You should have received a copy of the GNU General Public License
|
# You should have received a copy of the GNU General Public License
|
||||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
=head1 NAME
|
=head1 NAME
|
||||||
|
|
||||||
@@ -185,13 +185,13 @@ my $verbose = 1;
|
|||||||
|
|
||||||
=over 4
|
=over 4
|
||||||
|
|
||||||
=item C<verbose($level, $message)>
|
=item C<verbose ($level, $message)>
|
||||||
|
|
||||||
Report the C<$message> is C<$level> E<lt>= C<$verbose>.
|
Report the C<$message> is C<$level> E<lt>= C<$verbose>.
|
||||||
|
|
||||||
=cut
|
=cut
|
||||||
|
|
||||||
sub verbose($$)
|
sub verbose ($$)
|
||||||
{
|
{
|
||||||
my ($level, $message) = @_;
|
my ($level, $message) = @_;
|
||||||
print STDERR $message
|
print STDERR $message
|
||||||
@@ -201,13 +201,13 @@ sub verbose($$)
|
|||||||
|
|
||||||
######################################################################
|
######################################################################
|
||||||
|
|
||||||
=item C<directives($bench, @directive)>
|
=item C<directives ($bench, @directive)>
|
||||||
|
|
||||||
Format the list of directives for Bison for bench named C<$bench>.
|
Format the list of directives for Bison for bench named C<$bench>.
|
||||||
|
|
||||||
=cut
|
=cut
|
||||||
|
|
||||||
sub directives($@)
|
sub directives ($@)
|
||||||
{
|
{
|
||||||
my ($bench, @directive) = @_;
|
my ($bench, @directive) = @_;
|
||||||
my $res = "/* Directives for bench '$bench'. */\n";
|
my $res = "/* Directives for bench '$bench'. */\n";
|
||||||
@@ -218,6 +218,27 @@ sub directives($@)
|
|||||||
|
|
||||||
######################################################################
|
######################################################################
|
||||||
|
|
||||||
|
=item C<is_pure (@directive)>
|
||||||
|
|
||||||
|
Whether api.pure is set.
|
||||||
|
|
||||||
|
=cut
|
||||||
|
|
||||||
|
sub is_pure (@)
|
||||||
|
{
|
||||||
|
my (@directive) = @_;
|
||||||
|
for my $dir (@directive)
|
||||||
|
{
|
||||||
|
if ($dir =~ /\A%define api.pure/)
|
||||||
|
{
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
######################################################################
|
||||||
|
|
||||||
=item C<generate_grammar_triangular ($base, $max, @directive)>
|
=item C<generate_grammar_triangular ($base, $max, @directive)>
|
||||||
|
|
||||||
Create a large triangular grammar which looks like :
|
Create a large triangular grammar which looks like :
|
||||||
@@ -389,18 +410,14 @@ sub generate_grammar_calc ($$@)
|
|||||||
%define api.value.type union
|
%define api.value.type union
|
||||||
$directives
|
$directives
|
||||||
|
|
||||||
%{
|
%code provides {
|
||||||
static int power (int base, int exponent);
|
static int power (int base, int exponent);
|
||||||
/* yyerror receives the location if:
|
/* yyerror receives the location if:
|
||||||
- %location & %pure & %glr
|
- %location & %pure & %glr
|
||||||
- %location & %pure & %yacc & %parse-param. */
|
- %location & %pure & %yacc & %parse-param. */
|
||||||
static void yyerror (const char *s);
|
static void yyerror (const char *s);
|
||||||
#if YYPURE
|
static int yylex (@{[is_pure (@directive) ? "YYSTYPE *yylvalp" : "void"]});
|
||||||
static int yylex (YYSTYPE* yylvalp);
|
}
|
||||||
#else
|
|
||||||
static int yylex (void);
|
|
||||||
#endif
|
|
||||||
%}
|
|
||||||
|
|
||||||
/* Bison Declarations */
|
/* Bison Declarations */
|
||||||
%token
|
%token
|
||||||
@@ -467,12 +484,7 @@ yyerror (const char *s)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
#if YYPURE
|
yylex (@{[is_pure (@directive) ? "YYSTYPE *yylvalp" : "void"]})
|
||||||
# define yylval (*yylvalp)
|
|
||||||
yylex (YYSTYPE* yylvalp)
|
|
||||||
#else
|
|
||||||
yylex (void)
|
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
int c;
|
int c;
|
||||||
|
|
||||||
@@ -498,14 +510,15 @@ yylex (void)
|
|||||||
case '5': case '6': case '7': case '8': case '9':
|
case '5': case '6': case '7': case '8': case '9':
|
||||||
{
|
{
|
||||||
int nchars = 0;
|
int nchars = 0;
|
||||||
sscanf (input - 1, "%d%n", &yylval.NUM, &nchars);
|
int n = sscanf (input - 1, "%d%n", &@{[is_pure (@directive) ? "yylvalp->" : "yylval."]}NUM, &nchars);
|
||||||
|
assert (n == 1);
|
||||||
input += nchars - 1;
|
input += nchars - 1;
|
||||||
return NUM;
|
return NUM;
|
||||||
}
|
}
|
||||||
|
|
||||||
default:
|
default:
|
||||||
yyerror ("error: invalid character");
|
yyerror ("error: invalid character");
|
||||||
return yylex ();
|
return yylex (@{[is_pure (@directive) ? "yylvalp" : ""]});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
EOF
|
EOF
|
||||||
@@ -568,7 +581,7 @@ sub generate_grammar_list ($$@)
|
|||||||
or die;
|
or die;
|
||||||
print $out <<EOF;
|
print $out <<EOF;
|
||||||
%language "C++"
|
%language "C++"
|
||||||
%defines
|
%header
|
||||||
%locations
|
%locations
|
||||||
$directives
|
$directives
|
||||||
|
|
||||||
@@ -591,10 +604,10 @@ $directives
|
|||||||
// Prototype of the yylex function providing subsequent tokens.
|
// Prototype of the yylex function providing subsequent tokens.
|
||||||
static
|
static
|
||||||
#if USE_TOKEN_CTOR
|
#if USE_TOKEN_CTOR
|
||||||
yy::parser::symbol_type yylex();
|
yy::parser::symbol_type yylex ();
|
||||||
#else
|
#else
|
||||||
yy::parser::token_type yylex(yy::parser::semantic_type* yylvalp,
|
yy::parser::token_type yylex (yy::parser::semantic_type *yylvalp,
|
||||||
yy::parser::location_type* yyllocp);
|
yy::parser::location_type *yyllocp);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Conversion to string.
|
// Conversion to string.
|
||||||
@@ -617,8 +630,8 @@ EOF
|
|||||||
print $out <<'EOF';
|
print $out <<'EOF';
|
||||||
%token <std::string> TEXT
|
%token <std::string> TEXT
|
||||||
%token <int> NUMBER
|
%token <int> NUMBER
|
||||||
%printer { std::cerr << "Number: " << $$; } <int>
|
%printer { yyo << "Number: " << $$; } <int>
|
||||||
%printer { std::cerr << "Text: " << $$; } <std::string>
|
%printer { yyo << "Text: " << $$; } <std::string>
|
||||||
%type <std::string> text result
|
%type <std::string> text result
|
||||||
|
|
||||||
%%
|
%%
|
||||||
@@ -640,8 +653,8 @@ EOF
|
|||||||
%union {int ival; std::string* sval;}
|
%union {int ival; std::string* sval;}
|
||||||
%token <sval> TEXT
|
%token <sval> TEXT
|
||||||
%token <ival> NUMBER
|
%token <ival> NUMBER
|
||||||
%printer { std::cerr << "Number: " << $$; } <ival>
|
%printer { yyo << "Number: " << $$; } <ival>
|
||||||
%printer { std::cerr << "Text: " << *$$; } <sval>
|
%printer { yyo << "Text: " << *$$; } <sval>
|
||||||
%type <sval> text result
|
%type <sval> text result
|
||||||
|
|
||||||
%%
|
%%
|
||||||
@@ -663,10 +676,10 @@ EOF
|
|||||||
|
|
||||||
static
|
static
|
||||||
#if USE_TOKEN_CTOR
|
#if USE_TOKEN_CTOR
|
||||||
yy::parser::symbol_type yylex()
|
yy::parser::symbol_type yylex ()
|
||||||
#else
|
#else
|
||||||
yy::parser::token_type yylex(yy::parser::semantic_type* yylvalp,
|
yy::parser::token_type yylex (yy::parser::semantic_type *yylvalp,
|
||||||
yy::parser::location_type* yyllocp)
|
yy::parser::location_type *yyllocp)
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
typedef yy::parser::location_type location_type;
|
typedef yy::parser::location_type location_type;
|
||||||
@@ -775,7 +788,31 @@ sub run ($)
|
|||||||
|
|
||||||
##################################################################
|
##################################################################
|
||||||
|
|
||||||
=item C<compile ($base)>
|
=item C<language ($base)>
|
||||||
|
|
||||||
|
The language to use depending on the %language specification in
|
||||||
|
C<$base.y>: C<c> or C<c++>.
|
||||||
|
|
||||||
|
=cut
|
||||||
|
|
||||||
|
sub language ($)
|
||||||
|
{
|
||||||
|
my ($base) = @_;
|
||||||
|
if ($gbench)
|
||||||
|
{
|
||||||
|
"c++";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
my $language = `sed -ne '/%language "\\(.*\\)"/{s//\\1/;p;q;}' $base.y`;
|
||||||
|
chomp $language;
|
||||||
|
$language eq 'C++' ? "c++" : "c";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
##################################################################
|
||||||
|
|
||||||
|
=item C<compiler ($base)>
|
||||||
|
|
||||||
The compiler to use depending on the %language specification in
|
The compiler to use depending on the %language specification in
|
||||||
C<$base.y>.
|
C<$base.y>.
|
||||||
@@ -785,16 +822,12 @@ C<$base.y>.
|
|||||||
sub compiler ($)
|
sub compiler ($)
|
||||||
{
|
{
|
||||||
my ($base) = @_;
|
my ($base) = @_;
|
||||||
if ($gbench)
|
my %compiler =
|
||||||
{
|
(
|
||||||
$cxx;
|
'c++' => $cxx,
|
||||||
}
|
'c' => $cc,
|
||||||
else
|
);
|
||||||
{
|
$compiler{language ($base)};
|
||||||
my $language = `sed -ne '/%language "\\(.*\\)"/{s//\\1/;p;q;}' $base.y`;
|
|
||||||
chomp $language;
|
|
||||||
$language eq 'C++' ? $cxx : $cc;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
##################################################################
|
##################################################################
|
||||||
@@ -805,21 +838,38 @@ Compile C<$base.y> to an executable.
|
|||||||
|
|
||||||
=cut
|
=cut
|
||||||
|
|
||||||
sub compile ($)
|
sub compile ($$)
|
||||||
{
|
{
|
||||||
my ($base) = @_;
|
my ($makefile, $base) = @_;
|
||||||
my $compiler = compiler ($base);
|
my $compiler = compiler ($base);
|
||||||
|
|
||||||
my $my_bison = `sed -ne '/[/][/] %bison "\\(.*\\)"/{s//\\1/;p;q;}' $base.y`;
|
my $my_bison = `sed -ne '/[/][/] %bison "\\(.*\\)"/{s//\\1/;p;q;}' $base.y`;
|
||||||
chop $my_bison;
|
chop $my_bison;
|
||||||
run ((length $my_bison ? $my_bison : $bison) . " $base.y -o $base.c");
|
my %ext =
|
||||||
|
(
|
||||||
|
'c++' => 'cc',
|
||||||
|
'c' => 'c',
|
||||||
|
);
|
||||||
|
my $ext = $ext{language ($base)};
|
||||||
if ($gbench)
|
if ($gbench)
|
||||||
{
|
{
|
||||||
run "$compiler -c -o $base.o $cflags $base.c";
|
print $makefile <<EOF;
|
||||||
|
$base.$ext: $base.y
|
||||||
|
\t@{[length $my_bison ? $my_bison : $bison]} $base.y -o $base.$ext
|
||||||
|
|
||||||
|
$base.o: $base.$ext
|
||||||
|
\t$compiler -c -o $base.o $cflags $base.$ext
|
||||||
|
EOF
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
run "$compiler -o $base $cflags $base.c";
|
print $makefile <<EOF;
|
||||||
|
$base.$ext: $base.y
|
||||||
|
\t@{[length $my_bison ? $my_bison : $bison]} $base.y -o $base.$ext
|
||||||
|
|
||||||
|
$base: $base.$ext
|
||||||
|
\t$compiler -o $base $cflags $base.$ext
|
||||||
|
EOF
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -849,11 +899,13 @@ sub bench_with_timethese ($@)
|
|||||||
# For each bench, capture the size.
|
# For each bench, capture the size.
|
||||||
my %size;
|
my %size;
|
||||||
|
|
||||||
|
my $makefile = new IO::File ">Makefile";
|
||||||
while (my ($name, $directives) = each %bench)
|
while (my ($name, $directives) = each %bench)
|
||||||
{
|
{
|
||||||
generate_grammar ($grammar, $name, $directives);
|
generate_grammar ($grammar, $name, $directives);
|
||||||
# Compile the executable.
|
# Compile the executable.
|
||||||
compile ($name);
|
compile ($makefile, $name);
|
||||||
|
run "make $name";
|
||||||
$bench{$name} = "system ('./$name');";
|
$bench{$name} = "system ('./$name');";
|
||||||
chop($size{$name} = `wc -c <$name`);
|
chop($size{$name} = `wc -c <$name`);
|
||||||
}
|
}
|
||||||
@@ -906,6 +958,20 @@ sub bench_with_gbenchmark ($@)
|
|||||||
my $readme = new IO::File ">README.md";
|
my $readme = new IO::File ">README.md";
|
||||||
print $readme <<EOF;
|
print $readme <<EOF;
|
||||||
compiler: $compiler $cflags
|
compiler: $compiler $cflags
|
||||||
|
EOF
|
||||||
|
|
||||||
|
my $makefile = new IO::File ">Makefile";
|
||||||
|
print $makefile <<EOF;
|
||||||
|
.PHONY: bench
|
||||||
|
bench: main
|
||||||
|
\t./main \$(BENCHFLAGS) | tee -a README.md
|
||||||
|
|
||||||
|
# Link the bench cases in a different order to run the bench case in a
|
||||||
|
# different order.
|
||||||
|
.PHONY: rand
|
||||||
|
rand:
|
||||||
|
\t-rm main
|
||||||
|
\tmake bench OBJECTS="\$\$(shuf -e \$(OBJECTS) | xargs)"
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
my @obj = ();
|
my @obj = ();
|
||||||
@@ -916,19 +982,24 @@ EOF
|
|||||||
print $m;
|
print $m;
|
||||||
print $readme $m;
|
print $readme $m;
|
||||||
generate_grammar ($grammar, $base, $directive[$i]);
|
generate_grammar ($grammar, $base, $directive[$i]);
|
||||||
compile ($base);
|
compile ($makefile, $base);
|
||||||
push @obj, "$base.o";
|
push @obj, "$base.o";
|
||||||
}
|
}
|
||||||
|
|
||||||
my $out = new IO::File ">main.c";
|
my $out = new IO::File ">main.cc";
|
||||||
print $out <<EOF;
|
print $out <<EOF;
|
||||||
#include <benchmark/benchmark.h>
|
#include <benchmark/benchmark.h>
|
||||||
|
|
||||||
BENCHMARK_MAIN();
|
BENCHMARK_MAIN();
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
run "$compiler -o main $cflags main.c @obj -lbenchmark";
|
print $makefile <<EOF;
|
||||||
run "./main | tee -a README.md";
|
OBJECTS = @{obj}
|
||||||
|
main: \$(OBJECTS)
|
||||||
|
\t$compiler -o main $cflags main.cc \$(OBJECTS) -lbenchmark
|
||||||
|
EOF
|
||||||
|
|
||||||
|
run "make";
|
||||||
}
|
}
|
||||||
|
|
||||||
######################################################################
|
######################################################################
|
||||||
@@ -1001,7 +1072,7 @@ sub help ($)
|
|||||||
{
|
{
|
||||||
my ($verbose) = @_;
|
my ($verbose) = @_;
|
||||||
use Pod::Usage;
|
use Pod::Usage;
|
||||||
# See <URL:http://perldoc.perl.org/pod2man.html#NOTES>.
|
# See <URL:https://perldoc.perl.org/pod2man.html#NOTES>.
|
||||||
pod2usage( { -message => "Bench Bison parsers",
|
pod2usage( { -message => "Bench Bison parsers",
|
||||||
-exitval => 0,
|
-exitval => 0,
|
||||||
-verbose => $verbose,
|
-verbose => $verbose,
|
||||||
|
|||||||
+4
-3
@@ -1,4 +1,4 @@
|
|||||||
## Copyright (C) 2006, 2008-2015, 2018-2020 Free Software Foundation,
|
## Copyright (C) 2006, 2008-2015, 2018-2021 Free Software Foundation,
|
||||||
## Inc.
|
## Inc.
|
||||||
|
|
||||||
## This program is free software: you can redistribute it and/or modify
|
## This program is free software: you can redistribute it and/or modify
|
||||||
@@ -12,6 +12,7 @@
|
|||||||
## GNU General Public License for more details.
|
## GNU General Public License for more details.
|
||||||
##
|
##
|
||||||
## You should have received a copy of the GNU General Public License
|
## You should have received a copy of the GNU General Public License
|
||||||
## along with this program. If not, see <http://www.gnu.org/licenses/>.
|
## along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
nodist_noinst_SCRIPTS = etc/bench.pl
|
dist_noinst_DATA = %D%/README.md
|
||||||
|
nodist_noinst_SCRIPTS = %D%/bench.pl
|
||||||
|
|||||||
+1
-1
@@ -17,7 +17,7 @@ fill-column: 76
|
|||||||
ispell-dictionary: "american"
|
ispell-dictionary: "american"
|
||||||
End:
|
End:
|
||||||
|
|
||||||
Copyright (C) 2018-2020 Free Software Foundation, Inc.
|
Copyright (C) 2018-2021 Free Software Foundation, Inc.
|
||||||
|
|
||||||
Permission is granted to copy, distribute and/or modify this document
|
Permission is granted to copy, distribute and/or modify this document
|
||||||
under the terms of the GNU Free Documentation License, Version 1.3 or
|
under the terms of the GNU Free Documentation License, Version 1.3 or
|
||||||
|
|||||||
@@ -11,8 +11,8 @@ variant-11: CXXFLAGS = -std=c++11
|
|||||||
|
|
||||||
all: $(PROGS)
|
all: $(PROGS)
|
||||||
|
|
||||||
%.cc %.hh: %.yy
|
%.cc %.hh %.html %.gv: %.yy
|
||||||
$(BISON) $(BISONFLAGS) -o $*.cc $<
|
$(BISON) $(BISONFLAGS) --html --graph -o $*.cc $<
|
||||||
|
|
||||||
%: %.cc
|
%: %.cc
|
||||||
$(CXX) $(CXXFLAGS) -o$@ $<
|
$(CXX) $(CXXFLAGS) -o$@ $<
|
||||||
|
|||||||
@@ -46,7 +46,7 @@ fill-column: 76
|
|||||||
ispell-dictionary: "american"
|
ispell-dictionary: "american"
|
||||||
End:
|
End:
|
||||||
|
|
||||||
Copyright (C) 2018-2020 Free Software Foundation, Inc.
|
Copyright (C) 2018-2021 Free Software Foundation, Inc.
|
||||||
|
|
||||||
Permission is granted to copy, distribute and/or modify this document
|
Permission is granted to copy, distribute and/or modify this document
|
||||||
under the terms of the GNU Free Documentation License, Version 1.3 or
|
under the terms of the GNU Free Documentation License, Version 1.3 or
|
||||||
|
|||||||
@@ -5,12 +5,11 @@ BASE = calc++
|
|||||||
BISON = bison
|
BISON = bison
|
||||||
CXX = g++
|
CXX = g++
|
||||||
FLEX = flex
|
FLEX = flex
|
||||||
XSLTPROC = xsltproc
|
|
||||||
|
|
||||||
all: $(BASE)
|
all: $(BASE)
|
||||||
|
|
||||||
%.cc %.hh %.xml %.gv: %.yy
|
%.cc %.hh %.html %.gv: %.yy
|
||||||
$(BISON) $(BISONFLAGS) --xml --graph=$*.gv -o $*.cc $<
|
$(BISON) $(BISONFLAGS) --html --graph -o $*.cc $<
|
||||||
|
|
||||||
%.cc: %.ll
|
%.cc: %.ll
|
||||||
$(FLEX) $(FLEXFLAGS) -o$@ $<
|
$(FLEX) $(FLEXFLAGS) -o$@ $<
|
||||||
@@ -29,10 +28,6 @@ run: $(BASE)
|
|||||||
@echo "Type arithmetic expressions. Quit with ctrl-d."
|
@echo "Type arithmetic expressions. Quit with ctrl-d."
|
||||||
./$< -
|
./$< -
|
||||||
|
|
||||||
html: parser.html
|
|
||||||
%.html: %.xml
|
|
||||||
$(XSLTPROC) $(XSLTPROCFLAGS) -o $@ $$($(BISON) --print-datadir)/xslt/xml2xhtml.xsl $<
|
|
||||||
|
|
||||||
CLEANFILES = \
|
CLEANFILES = \
|
||||||
$(BASE) *.o \
|
$(BASE) *.o \
|
||||||
parser.hh parser.cc parser.output parser.xml parser.html parser.gv location.hh \
|
parser.hh parser.cc parser.output parser.xml parser.html parser.gv location.hh \
|
||||||
|
|||||||
@@ -36,7 +36,7 @@ fill-column: 76
|
|||||||
ispell-dictionary: "american"
|
ispell-dictionary: "american"
|
||||||
End:
|
End:
|
||||||
|
|
||||||
Copyright (C) 2018-2020 Free Software Foundation, Inc.
|
Copyright (C) 2018-2021 Free Software Foundation, Inc.
|
||||||
|
|
||||||
Permission is granted to copy, distribute and/or modify this document
|
Permission is granted to copy, distribute and/or modify this document
|
||||||
under the terms of the GNU Free Documentation License, Version 1.3 or
|
under the terms of the GNU Free Documentation License, Version 1.3 or
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
#! /bin/sh
|
#! /bin/sh
|
||||||
|
|
||||||
# Copyright (C) 2005-2015, 2018-2020 Free Software Foundation, Inc.
|
# Copyright (C) 2005-2015, 2018-2021 Free Software Foundation, Inc.
|
||||||
#
|
#
|
||||||
# This program is free software: you can redistribute it and/or modify
|
# This program is free software: you can redistribute it and/or modify
|
||||||
# it under the terms of the GNU General Public License as published by
|
# it under the terms of the GNU General Public License as published by
|
||||||
@@ -13,7 +13,7 @@
|
|||||||
# GNU General Public License for more details.
|
# GNU General Public License for more details.
|
||||||
#
|
#
|
||||||
# You should have received a copy of the GNU General Public License
|
# You should have received a copy of the GNU General Public License
|
||||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
cat >input <<EOF
|
cat >input <<EOF
|
||||||
toto := 1
|
toto := 1
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
## Copyright (C) 2005-2006, 2008-2015, 2018-2020 Free Software
|
## Copyright (C) 2005-2006, 2008-2015, 2018-2021 Free Software
|
||||||
## Foundation, Inc.
|
## Foundation, Inc.
|
||||||
##
|
##
|
||||||
## This program is free software: you can redistribute it and/or modify
|
## This program is free software: you can redistribute it and/or modify
|
||||||
@@ -12,13 +12,12 @@
|
|||||||
## GNU General Public License for more details.
|
## GNU General Public License for more details.
|
||||||
##
|
##
|
||||||
## You should have received a copy of the GNU General Public License
|
## You should have received a copy of the GNU General Public License
|
||||||
## along with this program. If not, see <http://www.gnu.org/licenses/>.
|
## along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
## ------------------- ##
|
## ------------------- ##
|
||||||
## Parser generation. ##
|
## Parser generation. ##
|
||||||
## ------------------- ##
|
## ------------------- ##
|
||||||
|
|
||||||
%D%/parser.stamp: $(dependencies)
|
|
||||||
SUFFIXES += .yy .stamp
|
SUFFIXES += .yy .stamp
|
||||||
.yy.stamp:
|
.yy.stamp:
|
||||||
$(AM_V_YACC)rm -f $@
|
$(AM_V_YACC)rm -f $@
|
||||||
@@ -26,12 +25,13 @@ SUFFIXES += .yy .stamp
|
|||||||
$(AM_V_at)$(YACCCOMPILE) -o $*.cc $<
|
$(AM_V_at)$(YACCCOMPILE) -o $*.cc $<
|
||||||
$(AM_V_at)mv -f $@.tmp $@
|
$(AM_V_at)mv -f $@.tmp $@
|
||||||
|
|
||||||
|
%D%/parser.stamp: $(dependencies)
|
||||||
$(calcxx_sources_generated): %D%/parser.stamp
|
$(calcxx_sources_generated): %D%/parser.stamp
|
||||||
@test -f $@ || rm -f %D%/parser.stamp
|
@test -f $@ || rm -f %D%/parser.stamp
|
||||||
@test -f $@ || $(MAKE) $(AM_MAKEFLAGS) %D%/parser.stamp
|
@test -f $@ || $(MAKE) $(AM_MAKEFLAGS) %D%/parser.stamp
|
||||||
CLEANFILES += \
|
CLEANFILES += \
|
||||||
$(calcxx_sources_generated) \
|
$(calcxx_sources_generated) \
|
||||||
%D%/parser.dot \
|
%D%/parser.gv \
|
||||||
%D%/parser.output \
|
%D%/parser.output \
|
||||||
%D%/parser.stamp \
|
%D%/parser.stamp \
|
||||||
%D%/scanner.cc
|
%D%/scanner.cc
|
||||||
|
|||||||
@@ -0,0 +1,23 @@
|
|||||||
|
# This Makefile is designed to be simple and readable. It does not
|
||||||
|
# aim at portability. It requires GNU Make.
|
||||||
|
|
||||||
|
BASE = c++-types
|
||||||
|
BISON = bison
|
||||||
|
|
||||||
|
all: $(BASE)
|
||||||
|
|
||||||
|
%.c %.h %.html %.gv: %.y
|
||||||
|
$(BISON) $(BISONFLAGS) --header --html --graph -o $*.c $<
|
||||||
|
|
||||||
|
$(BASE): $(BASE).o
|
||||||
|
$(CC) $(CFLAGS) -o $@ $^
|
||||||
|
|
||||||
|
run: $(BASE)
|
||||||
|
@echo "Type C++ declarations or expressions. Quit with ctrl-d."
|
||||||
|
./$<
|
||||||
|
|
||||||
|
CLEANFILES = \
|
||||||
|
$(BASE) *.o $(BASE).[ch] $(BASE).output $(BASE).xml $(BASE).html $(BASE).gv
|
||||||
|
|
||||||
|
clean:
|
||||||
|
rm -f $(CLEANFILES)
|
||||||
@@ -0,0 +1,24 @@
|
|||||||
|
# glr
|
||||||
|
|
||||||
|
This example demonstrates the use of GLR parsers to handle (local)
|
||||||
|
ambiguities in the C++ language. See the node "Merging GLR Parses" in
|
||||||
|
Bison's documentation.
|
||||||
|
|
||||||
|
<!---
|
||||||
|
Local Variables:
|
||||||
|
fill-column: 76
|
||||||
|
ispell-dictionary: "american"
|
||||||
|
End:
|
||||||
|
|
||||||
|
Copyright (C) 2020-2021 Free Software Foundation, Inc.
|
||||||
|
|
||||||
|
This file is part of Bison, the GNU Compiler Compiler.
|
||||||
|
|
||||||
|
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,173 @@
|
|||||||
|
/*
|
||||||
|
Copyright (C) 2020-2021 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/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <cstddef> // nullptr_t
|
||||||
|
#include <iostream>
|
||||||
|
#include <memory>
|
||||||
|
|
||||||
|
// Type erasure 101 <https://stackoverflow.com/a/26199467/1353549>.
|
||||||
|
class NodeInterface;
|
||||||
|
|
||||||
|
class Node
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
Node (const Node& node) = default;
|
||||||
|
Node (Node&& node) = default;
|
||||||
|
Node () = default;
|
||||||
|
~Node () = default;
|
||||||
|
|
||||||
|
template <typename T,
|
||||||
|
// SFINAE block using this ctor as a copy/move ctor:
|
||||||
|
std::enable_if_t<!std::is_same<Node, std::decay_t<T>>::value, int>* = nullptr>
|
||||||
|
Node (T&& t);
|
||||||
|
|
||||||
|
Node& operator= (const Node& node) = default;
|
||||||
|
Node& operator= (Node&& node) = default;
|
||||||
|
|
||||||
|
explicit operator bool () const
|
||||||
|
{
|
||||||
|
return impl_ != nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
std::ostream& print (std::ostream& o) const;
|
||||||
|
|
||||||
|
std::shared_ptr<NodeInterface> impl_;
|
||||||
|
};
|
||||||
|
|
||||||
|
static std::ostream&
|
||||||
|
operator<< (std::ostream& o, const Node &node)
|
||||||
|
{
|
||||||
|
return node.print (o);
|
||||||
|
}
|
||||||
|
|
||||||
|
class NodeInterface
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
virtual ~NodeInterface () = default;
|
||||||
|
virtual std::ostream& print (std::ostream& o) const = 0;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
std::ostream& Node::print (std::ostream& o) const
|
||||||
|
{
|
||||||
|
if (impl_)
|
||||||
|
impl_->print (o);
|
||||||
|
return o;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template <typename T,
|
||||||
|
std::enable_if_t<!std::is_same<std::nullptr_t, std::decay_t<T>>::value, int>* = nullptr>
|
||||||
|
struct NodeImpl : public NodeInterface
|
||||||
|
{
|
||||||
|
template <typename U>
|
||||||
|
explicit NodeImpl (U&& u)
|
||||||
|
: t{std::forward<U> (u)}
|
||||||
|
{}
|
||||||
|
virtual ~NodeImpl () = default;
|
||||||
|
virtual std::ostream& print (std::ostream& o) const
|
||||||
|
{
|
||||||
|
return o << t;
|
||||||
|
}
|
||||||
|
|
||||||
|
T t;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
template <typename T,
|
||||||
|
std::enable_if_t<!std::is_same<Node, std::decay_t<T>>::value, int>*>
|
||||||
|
Node::Node (T&& t)
|
||||||
|
: impl_ (new NodeImpl<std::decay_t<T>>{std::forward<T> (t)})
|
||||||
|
{}
|
||||||
|
|
||||||
|
class Nterm
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
Nterm (std::string form,
|
||||||
|
Node child0 = Node (), Node child1 = Node (), Node child2 = Node ())
|
||||||
|
: form_ (std::move (form))
|
||||||
|
{
|
||||||
|
children_[0] = child0;
|
||||||
|
children_[1] = child1;
|
||||||
|
children_[2] = child2;
|
||||||
|
}
|
||||||
|
|
||||||
|
friend std::ostream& operator<< (std::ostream& o, const Nterm& t)
|
||||||
|
{
|
||||||
|
o << t.form_;
|
||||||
|
if (t.children_[0])
|
||||||
|
{
|
||||||
|
o << '(' << t.children_[0];
|
||||||
|
if (t.children_[1])
|
||||||
|
o << ", " << t.children_[1];
|
||||||
|
if (t.children_[2])
|
||||||
|
o << ", " << t.children_[2];
|
||||||
|
o << ')';
|
||||||
|
}
|
||||||
|
return o;
|
||||||
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
std::string form_;
|
||||||
|
Node children_[3];
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
class Term
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
Term (std::string text)
|
||||||
|
: text_ (std::move (text))
|
||||||
|
{}
|
||||||
|
|
||||||
|
friend std::ostream& operator<< (std::ostream& o, const Term& t)
|
||||||
|
{
|
||||||
|
return o << t.text_;
|
||||||
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
std::string text_;
|
||||||
|
};
|
||||||
|
|
||||||
|
#ifdef TEST
|
||||||
|
int main ()
|
||||||
|
{
|
||||||
|
Node n0;
|
||||||
|
std::cout << n0 << '\n';
|
||||||
|
|
||||||
|
Node n;
|
||||||
|
n = n0;
|
||||||
|
std::cout << n0 << '\n';
|
||||||
|
|
||||||
|
Term t1 = Term ("T");
|
||||||
|
std::cout << t1 << '\n';
|
||||||
|
|
||||||
|
n = t1;
|
||||||
|
std::cout << n << '\n';
|
||||||
|
std::cout << Nterm ("+", t1, t1) << '\n';
|
||||||
|
|
||||||
|
auto n1
|
||||||
|
= Nterm ("<OR>",
|
||||||
|
Nterm ("<declare>", Term ("T"), Term ("x")),
|
||||||
|
Nterm ("<cast>", Term ("x"), Term ("T")));
|
||||||
|
std::cout << n1 << '\n';
|
||||||
|
|
||||||
|
n = n1;
|
||||||
|
std::cout << n1 << '\n';
|
||||||
|
}
|
||||||
|
#endif
|
||||||
@@ -0,0 +1,50 @@
|
|||||||
|
#! /bin/sh
|
||||||
|
|
||||||
|
# Copyright (C) 2020-2021 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/>.
|
||||||
|
|
||||||
|
cat >input <<EOF
|
||||||
|
z + q;
|
||||||
|
|
||||||
|
T x;
|
||||||
|
|
||||||
|
T x = y;
|
||||||
|
|
||||||
|
x = y;
|
||||||
|
EOF
|
||||||
|
run 0 "\
|
||||||
|
1.0-5: +(z, q)
|
||||||
|
3.0-3: <declare>(T, x)
|
||||||
|
5.0-7: <init-declare>(T, x, y)
|
||||||
|
7.0-5: =(x, y)"
|
||||||
|
|
||||||
|
cat >input <<EOF
|
||||||
|
T (x) + y;
|
||||||
|
|
||||||
|
T (x);
|
||||||
|
|
||||||
|
T (y) = z + q;
|
||||||
|
|
||||||
|
T (y y) = z + q;
|
||||||
|
|
||||||
|
z + q;
|
||||||
|
EOF
|
||||||
|
run 0 "\
|
||||||
|
1.0-9: +(<cast>(x, T), y)
|
||||||
|
3.0-5: <OR>(<declare>(T, x), <cast>(x, T))
|
||||||
|
5.0-13: <OR>(<init-declare>(T, y, +(z, q)), =(<cast>(y, T), +(z, q)))
|
||||||
|
7.0-15: <error>
|
||||||
|
9.0-5: +(z, q)
|
||||||
|
err: 7.5: syntax error, unexpected identifier, expecting = or + or )"
|
||||||
@@ -0,0 +1,220 @@
|
|||||||
|
/* -*- C++ -*-
|
||||||
|
Copyright (C) 2020-2021 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/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* Simplified C++ Type and Expression Grammar.
|
||||||
|
Written by Paul Hilfinger for Bison's test suite. */
|
||||||
|
|
||||||
|
%require "3.8"
|
||||||
|
%glr-parser
|
||||||
|
%skeleton "glr2.cc"
|
||||||
|
%define parse.assert
|
||||||
|
%define api.token.constructor
|
||||||
|
%header
|
||||||
|
%locations
|
||||||
|
%debug
|
||||||
|
|
||||||
|
// Nice error messages with details.
|
||||||
|
%define parse.error detailed
|
||||||
|
|
||||||
|
%code requires
|
||||||
|
{
|
||||||
|
#include "ast.hh"
|
||||||
|
}
|
||||||
|
|
||||||
|
%define api.value.type variant
|
||||||
|
|
||||||
|
%code
|
||||||
|
{
|
||||||
|
#include <cassert>
|
||||||
|
#include <cctype>
|
||||||
|
#include <fstream>
|
||||||
|
#include <cstring>
|
||||||
|
|
||||||
|
static Node
|
||||||
|
stmt_merge (const Node& x0, const Node& x1);
|
||||||
|
|
||||||
|
static yy::parser::symbol_type
|
||||||
|
yylex ();
|
||||||
|
}
|
||||||
|
|
||||||
|
%expect-rr 1
|
||||||
|
|
||||||
|
%type <Node> TYPENAME ID stmt expr decl declarator
|
||||||
|
%printer { yyo << $$; } <Node>
|
||||||
|
|
||||||
|
%token
|
||||||
|
TYPENAME "typename"
|
||||||
|
ID "identifier"
|
||||||
|
SEMICOLON ";"
|
||||||
|
EQUAL "="
|
||||||
|
PLUS "+"
|
||||||
|
LPAREN "("
|
||||||
|
RPAREN ")"
|
||||||
|
|
||||||
|
%right "="
|
||||||
|
%left "+"
|
||||||
|
|
||||||
|
%%
|
||||||
|
|
||||||
|
prog : %empty
|
||||||
|
| prog stmt { std::cout << @2 << ": " << $2 << '\n'; }
|
||||||
|
;
|
||||||
|
|
||||||
|
stmt : expr ";" %merge <stmt_merge> { $$ = $1; }
|
||||||
|
| decl %merge <stmt_merge>
|
||||||
|
| error ";" { $$ = Nterm ("<error>"); }
|
||||||
|
;
|
||||||
|
|
||||||
|
expr : ID
|
||||||
|
| TYPENAME "(" expr ")" { $$ = Nterm ("<cast>", $3, $1); }
|
||||||
|
| expr "+" expr { $$ = Nterm ("+", $1, $3); }
|
||||||
|
| expr "=" expr { $$ = Nterm ("=", $1, $3); }
|
||||||
|
;
|
||||||
|
|
||||||
|
decl : TYPENAME declarator ";"
|
||||||
|
{ $$ = Nterm ("<declare>", $1, $2); }
|
||||||
|
| TYPENAME declarator "=" expr ";"
|
||||||
|
{ $$ = Nterm ("<init-declare>", $1, $2, $4); }
|
||||||
|
;
|
||||||
|
|
||||||
|
declarator
|
||||||
|
: ID
|
||||||
|
| "(" declarator ")" { $$ = $2; }
|
||||||
|
;
|
||||||
|
|
||||||
|
%%
|
||||||
|
std::istream* input = nullptr;
|
||||||
|
yy::parser::location_type loc;
|
||||||
|
|
||||||
|
// An error reporting function.
|
||||||
|
void
|
||||||
|
yy::parser::error (const location_type& l, const std::string& m)
|
||||||
|
{
|
||||||
|
std::cerr << l << ": " << m << '\n';
|
||||||
|
}
|
||||||
|
|
||||||
|
static yy::parser::symbol_type
|
||||||
|
yylex ()
|
||||||
|
{
|
||||||
|
while (true)
|
||||||
|
{
|
||||||
|
loc.step ();
|
||||||
|
loc += 1;
|
||||||
|
assert (!input->eof ());
|
||||||
|
switch (int c = input->get ())
|
||||||
|
{
|
||||||
|
case EOF:
|
||||||
|
return yy::parser::make_YYEOF (loc);
|
||||||
|
case '\t':
|
||||||
|
loc.end.column = (loc.end.column + 7) & ~7;
|
||||||
|
loc.step ();
|
||||||
|
break;
|
||||||
|
case ' ': case '\f':
|
||||||
|
loc.step ();
|
||||||
|
break;
|
||||||
|
case '\n':
|
||||||
|
loc.lines (1);
|
||||||
|
loc.end.column = 0;
|
||||||
|
loc.step ();
|
||||||
|
break;
|
||||||
|
case '+':
|
||||||
|
return yy::parser::make_PLUS (loc);
|
||||||
|
case '=':
|
||||||
|
return yy::parser::make_EQUAL (loc);
|
||||||
|
case '(':
|
||||||
|
return yy::parser::make_LPAREN (loc);
|
||||||
|
case ')':
|
||||||
|
return yy::parser::make_RPAREN (loc);
|
||||||
|
case ';':
|
||||||
|
return yy::parser::make_SEMICOLON (loc);
|
||||||
|
default:
|
||||||
|
if (isalpha (c))
|
||||||
|
{
|
||||||
|
std::string form;
|
||||||
|
do
|
||||||
|
{
|
||||||
|
form += static_cast<char> (c);
|
||||||
|
loc += 1;
|
||||||
|
c = input->get ();
|
||||||
|
}
|
||||||
|
while (isalnum (c) || c == '_');
|
||||||
|
input->unget ();
|
||||||
|
loc -= 1;
|
||||||
|
if (isupper (static_cast <unsigned char> (form[0])))
|
||||||
|
return yy::parser::make_TYPENAME (Term (form), loc);
|
||||||
|
else
|
||||||
|
return yy::parser::make_ID (Term (form), loc);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
auto msg = "invalid character: " + std::string(1, static_cast<char> (c));
|
||||||
|
throw yy::parser::syntax_error (loc, msg);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static Node
|
||||||
|
stmt_merge (const Node& x0, const Node& x1)
|
||||||
|
{
|
||||||
|
return Nterm ("<OR>", x0, x1);
|
||||||
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
process (yy::parser& parse, const std::string& file)
|
||||||
|
{
|
||||||
|
bool is_stdin = file == "-" || file.empty ();
|
||||||
|
if (is_stdin)
|
||||||
|
input = &std::cin;
|
||||||
|
else
|
||||||
|
input = new std::ifstream (file.c_str ());
|
||||||
|
loc.initialize (nullptr, 1, 0);
|
||||||
|
int status = parse ();
|
||||||
|
if (!is_stdin)
|
||||||
|
delete input;
|
||||||
|
return status;
|
||||||
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
main (int argc, char **argv)
|
||||||
|
{
|
||||||
|
yy::parser parse;
|
||||||
|
|
||||||
|
if (getenv ("YYDEBUG"))
|
||||||
|
parse.set_debug_level (1);
|
||||||
|
|
||||||
|
bool ran = false;
|
||||||
|
for (int i = 1; i < argc; ++i)
|
||||||
|
// Enable parse traces on option -p.
|
||||||
|
if (strcmp (argv[i], "-p") == 0)
|
||||||
|
parse.set_debug_level (1);
|
||||||
|
else
|
||||||
|
{
|
||||||
|
int status = process (parse, argv[i]);
|
||||||
|
ran = true;
|
||||||
|
if (!status)
|
||||||
|
return status;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!ran)
|
||||||
|
{
|
||||||
|
int status = process (parse, "");
|
||||||
|
if (!status)
|
||||||
|
return status;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
@@ -0,0 +1,52 @@
|
|||||||
|
## Copyright (C) 2020-2021 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/>.
|
||||||
|
|
||||||
|
glrxxdir = $(docdir)/%D%
|
||||||
|
|
||||||
|
## ----------- ##
|
||||||
|
## c++-types. ##
|
||||||
|
## ----------- ##
|
||||||
|
|
||||||
|
%D%/c++-types.stamp: $(dependencies)
|
||||||
|
$(nodist_%C%_c___types_SOURCES): %D%/c++-types.stamp
|
||||||
|
@test -f $@ || rm -f %D%/c++-types.stamp
|
||||||
|
@test -f $@ || $(MAKE) $(AM_MAKEFLAGS) %D%/c++-types.stamp
|
||||||
|
CLEANFILES += \
|
||||||
|
$(nodist_%C%_c___types_SOURCES) \
|
||||||
|
%D%/c++-types.stamp \
|
||||||
|
%D%/c++-types.output \
|
||||||
|
%D%/location.hh
|
||||||
|
CLEANDIRS += %D%/*.dSYM
|
||||||
|
|
||||||
|
## -------------------- ##
|
||||||
|
## Building & testing. ##
|
||||||
|
## -------------------- ##
|
||||||
|
|
||||||
|
# Avoid using BUILT_SOURCES which is too global.
|
||||||
|
$(%C%_c___types_OBJECTS): $(cxx_types_sources_generated)
|
||||||
|
|
||||||
|
if ENABLE_CXX14
|
||||||
|
check_PROGRAMS += %D%/c++-types
|
||||||
|
dist_%C%_c___types_SOURCES = \
|
||||||
|
%D%/ast.hh
|
||||||
|
nodist_%C%_c___types_SOURCES = \
|
||||||
|
%D%/c++-types.cc \
|
||||||
|
%D%/c++-types.hh
|
||||||
|
# Don't use gnulib's system headers.
|
||||||
|
%C%_c___types_CPPFLAGS = -I$(top_srcdir)/%D% -I$(top_builddir)/%D%
|
||||||
|
%C%_c___types_CXXFLAGS = $(CXX14_CXXFLAGS) $(WARN_CXXFLAGS_TEST)
|
||||||
|
TESTS += %D%/c++-types.test
|
||||||
|
endif ENABLE_CXX14
|
||||||
|
EXTRA_DIST += %D%/c++-types.yy %D%/c++-types.test
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
## Copyright (C) 2018-2020 Free Software Foundation, Inc.
|
## Copyright (C) 2018-2021 Free Software Foundation, Inc.
|
||||||
##
|
##
|
||||||
## This program is free software: you can redistribute it and/or modify
|
## This program is free software: you can redistribute it and/or modify
|
||||||
## it under the terms of the GNU General Public License as published by
|
## it under the terms of the GNU General Public License as published by
|
||||||
@@ -11,10 +11,11 @@
|
|||||||
## GNU General Public License for more details.
|
## GNU General Public License for more details.
|
||||||
##
|
##
|
||||||
## You should have received a copy of the GNU General Public License
|
## You should have received a copy of the GNU General Public License
|
||||||
## along with this program. If not, see <http://www.gnu.org/licenses/>.
|
## along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
cxxdir = $(docdir)/%D%
|
cxxdir = $(docdir)/%D%
|
||||||
include %D%/calc++/local.mk
|
include %D%/calc++/local.mk
|
||||||
|
include %D%/glr/local.mk
|
||||||
|
|
||||||
## -------- ##
|
## -------- ##
|
||||||
## Simple. ##
|
## Simple. ##
|
||||||
@@ -29,7 +30,7 @@ simple_extracted = %D%/simple.yy
|
|||||||
simple_sources = $(simple_extracted)
|
simple_sources = $(simple_extracted)
|
||||||
extracted += $(simple_extracted)
|
extracted += $(simple_extracted)
|
||||||
|
|
||||||
if ENABLE_CXX14
|
if ENABLE_CXX11
|
||||||
check_PROGRAMS += %D%/simple
|
check_PROGRAMS += %D%/simple
|
||||||
nodist_%C%_simple_SOURCES = $(simple_sources)
|
nodist_%C%_simple_SOURCES = $(simple_sources)
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
#! /bin/sh
|
#! /bin/sh
|
||||||
|
|
||||||
# Copyright (C) 2018-2020 Free Software Foundation, Inc.
|
# Copyright (C) 2018-2021 Free Software Foundation, Inc.
|
||||||
#
|
#
|
||||||
# This program is free software: you can redistribute it and/or modify
|
# This program is free software: you can redistribute it and/or modify
|
||||||
# it under the terms of the GNU General Public License as published by
|
# it under the terms of the GNU General Public License as published by
|
||||||
@@ -13,7 +13,7 @@
|
|||||||
# GNU General Public License for more details.
|
# GNU General Public License for more details.
|
||||||
#
|
#
|
||||||
# You should have received a copy of the GNU General Public License
|
# You should have received a copy of the GNU General Public License
|
||||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
: >input
|
: >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, And that's all!}" 4
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
Copyright (C) 2008-2015, 2018-2020 Free Software Foundation, Inc.
|
Copyright (C) 2008-2015, 2018-2021 Free Software Foundation, Inc.
|
||||||
|
|
||||||
This program is free software: you can redistribute it and/or modify
|
This program is free software: you can redistribute it and/or modify
|
||||||
it under the terms of the GNU General Public License as published by
|
it under the terms of the GNU General Public License as published by
|
||||||
@@ -12,7 +12,7 @@
|
|||||||
GNU General Public License for more details.
|
GNU General Public License for more details.
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
You should have received a copy of the GNU General Public License
|
||||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
%require "3.2"
|
%require "3.2"
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
#! /bin/sh
|
#! /bin/sh
|
||||||
|
|
||||||
# Copyright (C) 2018-2020 Free Software Foundation, Inc.
|
# Copyright (C) 2018-2021 Free Software Foundation, Inc.
|
||||||
#
|
#
|
||||||
# This program is free software: you can redistribute it and/or modify
|
# This program is free software: you can redistribute it and/or modify
|
||||||
# it under the terms of the GNU General Public License as published by
|
# it under the terms of the GNU General Public License as published by
|
||||||
@@ -13,7 +13,7 @@
|
|||||||
# GNU General Public License for more details.
|
# GNU General Public License for more details.
|
||||||
#
|
#
|
||||||
# You should have received a copy of the GNU General Public License
|
# You should have received a copy of the GNU General Public License
|
||||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
: >input
|
: >input
|
||||||
run 0 "{I have three numbers for you., 1, 2, 3, And that's all!}"
|
run 0 "{I have three numbers for you., 1, 2, 3, And that's all!}"
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
Copyright (C) 2008-2015, 2018-2020 Free Software Foundation, Inc.
|
Copyright (C) 2008-2015, 2018-2021 Free Software Foundation, Inc.
|
||||||
|
|
||||||
This program is free software: you can redistribute it and/or modify
|
This program is free software: you can redistribute it and/or modify
|
||||||
it under the terms of the GNU General Public License as published by
|
it under the terms of the GNU General Public License as published by
|
||||||
@@ -12,7 +12,7 @@
|
|||||||
GNU General Public License for more details.
|
GNU General Public License for more details.
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
You should have received a copy of the GNU General Public License
|
||||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
%require "3.2"
|
%require "3.2"
|
||||||
|
|||||||
+12
-3
@@ -53,15 +53,24 @@ push-parser model.
|
|||||||
This example demonstrates best practices when using Bison.
|
This example demonstrates best practices when using Bison.
|
||||||
- Its hand-written scanner tracks locations.
|
- Its hand-written scanner tracks locations.
|
||||||
- Its interface is pure.
|
- Its interface is pure.
|
||||||
- It uses the `error` token to get error recovery.
|
- It uses %params to pass user information to the parser and scanner.
|
||||||
|
- Its scanner uses the `error` token to signal lexical errors and enter
|
||||||
|
error recovery.
|
||||||
- Its interface is "incremental", well suited for interaction: it uses the
|
- Its interface is "incremental", well suited for interaction: it uses the
|
||||||
push-parser API to feed the parser with the incoming tokens.
|
push-parser API to feed the parser with the incoming tokens.
|
||||||
- It features an interactive command line with completion based on the
|
- It features an interactive command line with completion based on the
|
||||||
parser state, based on `yyexpected_tokens`.
|
parser state, based on `yyexpected_tokens`.
|
||||||
- It uses Bison's standard catalogue for internationalization of generated
|
- It uses Bison's standard catalog for internationalization of generated
|
||||||
messages.
|
messages.
|
||||||
- It uses a custom syntax error with location, lookahead correction and
|
- It uses a custom syntax error with location, lookahead correction and
|
||||||
token internationalization.
|
token internationalization.
|
||||||
|
- Error messages quote the source with squiggles that underline the error:
|
||||||
|
```
|
||||||
|
> 123 456
|
||||||
|
1.5-7: syntax error: expected end of file or + or - or * or / or ^ before number
|
||||||
|
1 | 123 456
|
||||||
|
| ^~~
|
||||||
|
```
|
||||||
- It supports debug traces with semantic values.
|
- It supports debug traces with semantic values.
|
||||||
- It uses named references instead of the traditional $1, $2, etc.
|
- It uses named references instead of the traditional $1, $2, etc.
|
||||||
|
|
||||||
@@ -72,7 +81,7 @@ fill-column: 76
|
|||||||
ispell-dictionary: "american"
|
ispell-dictionary: "american"
|
||||||
End:
|
End:
|
||||||
|
|
||||||
Copyright (C) 2018-2020 Free Software Foundation, Inc.
|
Copyright (C) 2018-2021 Free Software Foundation, Inc.
|
||||||
|
|
||||||
This file is part of GNU bison, the GNU Compiler Compiler.
|
This file is part of GNU bison, the GNU Compiler Compiler.
|
||||||
|
|
||||||
|
|||||||
@@ -3,14 +3,13 @@
|
|||||||
|
|
||||||
BASE = bistromathic
|
BASE = bistromathic
|
||||||
BISON = bison
|
BISON = bison
|
||||||
XSLTPROC = xsltproc
|
|
||||||
|
|
||||||
# We need to find the headers and libs for readline (and possibly intl).
|
# We need to find the headers and libs for readline (and possibly intl).
|
||||||
# You probably need to customize this for your own environment.
|
# You probably need to customize this for your own environment.
|
||||||
CPPFLAGS = -I/opt/local/include
|
CPPFLAGS = -I/opt/local/include
|
||||||
LDFLAGS = -L/opt/local/lib
|
LDFLAGS = -L/opt/local/lib
|
||||||
|
|
||||||
# Find the translation catalogue for Bison's generated messagess.
|
# Find the translation catalog for Bison's generated messagess.
|
||||||
BISON_LOCALEDIR = $(shell $(BISON) $(BISON_FLAGS) --print-localedir)
|
BISON_LOCALEDIR = $(shell $(BISON) $(BISON_FLAGS) --print-localedir)
|
||||||
CPPFLAGS += -DENABLE_NLS -DBISON_LOCALEDIR='"$(BISON_LOCALEDIR)"'
|
CPPFLAGS += -DENABLE_NLS -DBISON_LOCALEDIR='"$(BISON_LOCALEDIR)"'
|
||||||
|
|
||||||
@@ -18,8 +17,8 @@ LIBS = -lreadline -lm # In some environments, -lintl is needed.
|
|||||||
|
|
||||||
all: $(BASE)
|
all: $(BASE)
|
||||||
|
|
||||||
%.c %.h %.xml %.gv: %.y
|
%.c %.h %.html %.xml %.gv: %.y
|
||||||
$(BISON) $(BISONFLAGS) --defines --xml --graph=$*.gv -o $*.c $<
|
$(BISON) $(BISONFLAGS) --header --html --graph -o $*.c $<
|
||||||
|
|
||||||
$(BASE): parse.o
|
$(BASE): parse.o
|
||||||
$(CC) $(CPPFLAGS) $(CFLAGS) -o $@ $^ $(LDFLAGS) $(LIBS)
|
$(CC) $(CPPFLAGS) $(CFLAGS) -o $@ $^ $(LDFLAGS) $(LIBS)
|
||||||
@@ -28,10 +27,6 @@ run: $(BASE)
|
|||||||
@echo "Type bistromathic expressions. Quit with ctrl-d."
|
@echo "Type bistromathic expressions. Quit with ctrl-d."
|
||||||
./$<
|
./$<
|
||||||
|
|
||||||
html: $(BASE).html
|
|
||||||
%.html: %.xml
|
|
||||||
$(XSLTPROC) $(XSLTPROCFLAGS) -o $@ $$($(BISON) --print-datadir)/xslt/xml2xhtml.xsl $<
|
|
||||||
|
|
||||||
CLEANFILES = \
|
CLEANFILES = \
|
||||||
$(BASE) *.o \
|
$(BASE) *.o \
|
||||||
parse.[ch] parse.output parse.xml parse.html parse.gv
|
parse.[ch] parse.output parse.xml parse.html parse.gv
|
||||||
|
|||||||
@@ -2,15 +2,24 @@
|
|||||||
This example demonstrates best practices when using Bison.
|
This example demonstrates best practices when using Bison.
|
||||||
- Its hand-written scanner tracks locations.
|
- Its hand-written scanner tracks locations.
|
||||||
- Its interface is pure.
|
- Its interface is pure.
|
||||||
- It uses the `error` token to get error recovery.
|
- It uses %params to pass user information to the parser and scanner.
|
||||||
|
- Its scanner uses the `error` token to signal lexical errors and enter
|
||||||
|
error recovery.
|
||||||
- Its interface is "incremental", well suited for interaction: it uses the
|
- Its interface is "incremental", well suited for interaction: it uses the
|
||||||
push-parser API to feed the parser with the incoming tokens.
|
push-parser API to feed the parser with the incoming tokens.
|
||||||
- It features an interactive command line with completion based on the
|
- It features an interactive command line with completion based on the
|
||||||
parser state, based on `yyexpected_tokens`.
|
parser state, based on `yyexpected_tokens`.
|
||||||
- It uses Bison's standard catalogue for internationalization of generated
|
- It uses Bison's standard catalog for internationalization of generated
|
||||||
messages.
|
messages.
|
||||||
- It uses a custom syntax error with location, lookahead correction and
|
- It uses a custom syntax error with location, lookahead correction and
|
||||||
token internationalization.
|
token internationalization.
|
||||||
|
- Error messages quote the source with squiggles that underline the error:
|
||||||
|
```
|
||||||
|
> 123 456
|
||||||
|
1.5-7: syntax error: expected end of file or + or - or * or / or ^ before number
|
||||||
|
1 | 123 456
|
||||||
|
| ^~~
|
||||||
|
```
|
||||||
- It supports debug traces with semantic values.
|
- It supports debug traces with semantic values.
|
||||||
- It uses named references instead of the traditional $1, $2, etc.
|
- It uses named references instead of the traditional $1, $2, etc.
|
||||||
|
|
||||||
@@ -23,7 +32,7 @@ fill-column: 76
|
|||||||
ispell-dictionary: "american"
|
ispell-dictionary: "american"
|
||||||
End:
|
End:
|
||||||
|
|
||||||
Copyright (C) 2020 Free Software Foundation, Inc.
|
Copyright (C) 2020-2021 Free Software Foundation, Inc.
|
||||||
|
|
||||||
This file is part of Bison, the GNU Compiler Compiler.
|
This file is part of Bison, the GNU Compiler Compiler.
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
#! /bin/sh
|
#! /bin/sh
|
||||||
|
|
||||||
# Copyright (C) 2020 Free Software Foundation, Inc.
|
# Copyright (C) 2020-2021 Free Software Foundation, Inc.
|
||||||
#
|
#
|
||||||
# This program is free software: you can redistribute it and/or modify
|
# This program is free software: you can redistribute it and/or modify
|
||||||
# it under the terms of the GNU General Public License as published by
|
# it under the terms of the GNU General Public License as published by
|
||||||
@@ -13,7 +13,7 @@
|
|||||||
# GNU General Public License for more details.
|
# GNU General Public License for more details.
|
||||||
#
|
#
|
||||||
# You should have received a copy of the GNU General Public License
|
# You should have received a copy of the GNU General Public License
|
||||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
# Users may customize the behavior of readline, which might break our
|
# Users may customize the behavior of readline, which might break our
|
||||||
# expected results.
|
# expected results.
|
||||||
@@ -101,14 +101,28 @@ cat >input <<EOF
|
|||||||
EOF
|
EOF
|
||||||
run 0 '> *
|
run 0 '> *
|
||||||
> ''
|
> ''
|
||||||
err: 1.1: syntax error: expected end of file or - or ( or exit or number or function etc., before *'
|
err: 1.1: syntax error: expected end of file or - or ( or exit or number or function etc., before *
|
||||||
|
err: 1 | *
|
||||||
|
err: | ^'
|
||||||
|
|
||||||
|
# Underline long errors.
|
||||||
|
cat >input <<EOF
|
||||||
|
123 123456
|
||||||
|
EOF
|
||||||
|
run 0 '> 123 123456
|
||||||
|
> ''
|
||||||
|
err: 1.5-10: syntax error: expected end of file or + or - or * or / or ^ before number
|
||||||
|
err: 1 | 123 123456
|
||||||
|
err: | ^~~~~~'
|
||||||
|
|
||||||
cat >input <<EOF
|
cat >input <<EOF
|
||||||
1 + 2 * * 3
|
1 + 2 * * 3
|
||||||
EOF
|
EOF
|
||||||
run 0 '> 1 + 2 * * 3
|
run 0 '> 1 + 2 * * 3
|
||||||
> ''
|
> ''
|
||||||
err: 1.9: syntax error: expected - or ( or number or function or variable before *'
|
err: 1.9: syntax error: expected - or ( or number or function or variable before *
|
||||||
|
err: 1 | 1 + 2 * * 3
|
||||||
|
err: | ^'
|
||||||
|
|
||||||
cat >input <<EOF
|
cat >input <<EOF
|
||||||
1 / 0
|
1 / 0
|
||||||
@@ -132,8 +146,14 @@ run 0 '> ((1 ++ 2) ** 3)
|
|||||||
1332
|
1332
|
||||||
> ''
|
> ''
|
||||||
err: 1.6: syntax error: expected - or ( or number or function or variable before +
|
err: 1.6: syntax error: expected - or ( or number or function or variable before +
|
||||||
|
err: 1 | ((1 ++ 2) ** 3)
|
||||||
|
err: | ^
|
||||||
err: 2.5: syntax error: expected - or ( or number or function or variable before +
|
err: 2.5: syntax error: expected - or ( or number or function or variable before +
|
||||||
err: 2.16: syntax error: expected - or ( or number or function or variable before *'
|
err: 2 | (1 ++ 2) + (3 ** 4)
|
||||||
|
err: | ^
|
||||||
|
err: 2.16: syntax error: expected - or ( or number or function or variable before *
|
||||||
|
err: 2 | (1 ++ 2) + (3 ** 4)
|
||||||
|
err: | ^'
|
||||||
|
|
||||||
# The rule "( error )" should work even if there are no tokens between "(" and ")".
|
# The rule "( error )" should work even if there are no tokens between "(" and ")".
|
||||||
cat >input <<EOF
|
cat >input <<EOF
|
||||||
@@ -142,7 +162,9 @@ EOF
|
|||||||
run 0 '> ()
|
run 0 '> ()
|
||||||
666
|
666
|
||||||
> ''
|
> ''
|
||||||
err: 1.2: syntax error: expected - or ( or number or function or variable before )'
|
err: 1.2: syntax error: expected - or ( or number or function or variable before )
|
||||||
|
err: 1 | ()
|
||||||
|
err: | ^'
|
||||||
|
|
||||||
|
|
||||||
cat >input <<EOF
|
cat >input <<EOF
|
||||||
@@ -189,6 +211,8 @@ err: LAC: checking lookahead function: S5
|
|||||||
err: LAC: checking lookahead variable: S6
|
err: LAC: checking lookahead variable: S6
|
||||||
err: LAC: checking lookahead NEG: Err
|
err: LAC: checking lookahead NEG: Err
|
||||||
err: 1.2: syntax error: expected - or ( or number or function or variable before +
|
err: 1.2: syntax error: expected - or ( or number or function or variable before +
|
||||||
|
err: 1 | (+_)
|
||||||
|
err: | ^
|
||||||
err: LAC: initial context discarded due to error recovery
|
err: LAC: initial context discarded due to error recovery
|
||||||
err: Shifting token error (1.2: )
|
err: Shifting token error (1.2: )
|
||||||
err: Entering state 10
|
err: Entering state 10
|
||||||
@@ -227,29 +251,29 @@ err: Next token is token ) (1.4: )
|
|||||||
err: Shifting token ) (1.4: )
|
err: Shifting token ) (1.4: )
|
||||||
err: Entering state 20
|
err: Entering state 20
|
||||||
err: Stack now 0 2 10 20
|
err: Stack now 0 2 10 20
|
||||||
err: Reducing stack by rule 15 (line 151):
|
err: Reducing stack by rule XX (line XXX):
|
||||||
err: $1 = token ( (1.1: )
|
err: $1 = token ( (1.1: )
|
||||||
err: $2 = token error (1.2-3: )
|
err: $2 = token error (1.2-3: )
|
||||||
err: $3 = token ) (1.4: )
|
err: $3 = token ) (1.4: )
|
||||||
err: -> $$ = nterm exp (1.1-4: 666)
|
err: -> $$ = nterm exp (1.1-4: 666)
|
||||||
err: Entering state 7
|
err: Entering state 8
|
||||||
err: Stack now 0 7
|
err: Stack now 0 8
|
||||||
err: Return for a new token:
|
err: Return for a new token:
|
||||||
err: Reading a token
|
err: Reading a token
|
||||||
err: Now at end of input.
|
err: Now at end of input.
|
||||||
err: LAC: initial context established for end of file
|
err: LAC: initial context established for end of file
|
||||||
err: LAC: checking lookahead end of file: R2 G8 S19
|
err: LAC: checking lookahead end of file: R2 G7 S14
|
||||||
err: Reducing stack by rule 2 (line 126):
|
err: Reducing stack by rule XX (line XXX):
|
||||||
err: $1 = nterm exp (1.1-4: 666)
|
err: $1 = nterm exp (1.1-4: 666)
|
||||||
err: -> $$ = nterm input (1.1-4: )
|
err: -> $$ = nterm input (1.1-4: )
|
||||||
err: Entering state 8
|
err: Entering state 7
|
||||||
err: Stack now 0 8
|
err: Stack now 0 7
|
||||||
err: Now at end of input.
|
err: Now at end of input.
|
||||||
err: Shifting token end of file (1.5: )
|
err: Shifting token end of file (1.5: )
|
||||||
err: LAC: initial context discarded due to shift
|
err: LAC: initial context discarded due to shift
|
||||||
err: Entering state 19
|
err: Entering state 14
|
||||||
err: Stack now 0 8 19
|
err: Stack now 0 7 14
|
||||||
err: Stack now 0 8 19
|
err: Stack now 0 7 14
|
||||||
err: Cleanup: popping token end of file (1.5: )
|
err: Cleanup: popping token end of file (1.5: )
|
||||||
err: Cleanup: popping nterm input (1.1-4: )' -p
|
err: Cleanup: popping nterm input (1.1-4: )' -p
|
||||||
|
|
||||||
@@ -282,11 +306,20 @@ esac
|
|||||||
sed -e 's/\\t/ /g' >input <<EOF
|
sed -e 's/\\t/ /g' >input <<EOF
|
||||||
(1+\t\t
|
(1+\t\t
|
||||||
EOF
|
EOF
|
||||||
run 0 '> (1+
|
# Nuke the possible trailing white spaces in the effective output.
|
||||||
|
# This is to cope with some readlines that pad all the suggestions
|
||||||
|
# with white spaces (for alignment), including the last one on a line.
|
||||||
|
#
|
||||||
|
# See for instance <https://trac.macports.org/ticket/59927#comment:48>
|
||||||
|
# and its test-suite.log:
|
||||||
|
# <https://trac.macports.org/attachment/ticket/59927/bison-3.7.6-test-10.13.test-suite.log>
|
||||||
|
run -t 0 '> (1+
|
||||||
( - atan cos exp ln number sin sqrt
|
( - atan cos exp ln number sin sqrt
|
||||||
> (1+
|
> (1+
|
||||||
> ''
|
>
|
||||||
err: 1.4: syntax error: expected - or ( or number or function or variable before end of file'
|
err: 1.4: syntax error: expected - or ( or number or function or variable before end of file
|
||||||
|
err: 1 | (1+
|
||||||
|
err: | ^'
|
||||||
|
|
||||||
# Check the completion of a word.
|
# Check the completion of a word.
|
||||||
sed -e 's/\\t/ /g' >input <<EOF
|
sed -e 's/\\t/ /g' >input <<EOF
|
||||||
@@ -294,7 +327,9 @@ sed -e 's/\\t/ /g' >input <<EOF
|
|||||||
EOF
|
EOF
|
||||||
run 0 '> (atan ( ''
|
run 0 '> (atan ( ''
|
||||||
> ''
|
> ''
|
||||||
err: 1.9: syntax error: expected - or ( or number or function or variable before end of file'
|
err: 1.9: syntax error: expected - or ( or number or function or variable before end of file
|
||||||
|
err: 1 | (atan ( ''
|
||||||
|
err: | ^'
|
||||||
|
|
||||||
# Check the completion at the very beginning.
|
# Check the completion at the very beginning.
|
||||||
sed -e 's/\\t/ /g' >input <<EOF
|
sed -e 's/\\t/ /g' >input <<EOF
|
||||||
@@ -306,3 +341,28 @@ end of file exit exp ''
|
|||||||
0
|
0
|
||||||
> ''
|
> ''
|
||||||
err: '
|
err: '
|
||||||
|
|
||||||
|
# Check that completion prints valid locations even when there is an error.
|
||||||
|
sed -e 's/\\t/ /g' >input <<EOF
|
||||||
|
1++\t
|
||||||
|
EOF
|
||||||
|
run -n 0 '> 1++ ''
|
||||||
|
> ''
|
||||||
|
err: 1.3: syntax error: expected - or ( or number or function or variable before +
|
||||||
|
err: 1 | 1++ ''
|
||||||
|
err: | ^
|
||||||
|
'
|
||||||
|
|
||||||
|
# And even when the error was recovered from.
|
||||||
|
sed -e 's/\\t/ /g' >input <<EOF
|
||||||
|
(1++2) + 3 +\t\t
|
||||||
|
EOF
|
||||||
|
run -n 0 '> (1++2) + 3 + ''
|
||||||
|
> ''
|
||||||
|
err: 1.4: syntax error: expected - or ( or number or function or variable before +
|
||||||
|
err: 1 | (1++2) + 3 + ''
|
||||||
|
err: | ^
|
||||||
|
err: 1.15: syntax error: expected - or ( or number or function or variable before end of file
|
||||||
|
err: 1 | (1++2) + 3 + ''
|
||||||
|
err: | ^
|
||||||
|
'
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
## Copyright (C) 2020 Free Software Foundation, Inc.
|
## Copyright (C) 2020-2021 Free Software Foundation, Inc.
|
||||||
##
|
##
|
||||||
## This program is free software: you can redistribute it and/or modify
|
## This program is free software: you can redistribute it and/or modify
|
||||||
## it under the terms of the GNU General Public License as published by
|
## it under the terms of the GNU General Public License as published by
|
||||||
@@ -11,7 +11,7 @@
|
|||||||
## GNU General Public License for more details.
|
## GNU General Public License for more details.
|
||||||
##
|
##
|
||||||
## You should have received a copy of the GNU General Public License
|
## You should have received a copy of the GNU General Public License
|
||||||
## along with this program. If not, see <http://www.gnu.org/licenses/>.
|
## along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
bistromathicdir = $(docdir)/%D%
|
bistromathicdir = $(docdir)/%D%
|
||||||
|
|
||||||
|
|||||||
+122
-29
@@ -1,5 +1,25 @@
|
|||||||
%require "3.6"
|
/* Parser and scanner for bistromathic. -*- C -*-
|
||||||
|
|
||||||
|
Copyright (C) 2019-2021 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 <https://www.gnu.org/licenses/>. */
|
||||||
|
|
||||||
|
%require "3.7"
|
||||||
|
|
||||||
|
// Emitted on top of the implementation file.
|
||||||
%code top {
|
%code top {
|
||||||
#include <ctype.h> // isdigit
|
#include <ctype.h> // isdigit
|
||||||
#include <locale.h> // LC_ALL
|
#include <locale.h> // LC_ALL
|
||||||
@@ -17,13 +37,14 @@
|
|||||||
# define YYENABLE_NLS 1
|
# define YYENABLE_NLS 1
|
||||||
# include <libintl.h>
|
# include <libintl.h>
|
||||||
// Unless specified otherwise, we expect bistromathic's own
|
// Unless specified otherwise, we expect bistromathic's own
|
||||||
// catalogue to be installed in the same tree as Bison's catalogue.
|
// catalog to be installed in the same tree as Bison's catalog.
|
||||||
# ifndef LOCALEDIR
|
# ifndef LOCALEDIR
|
||||||
# define LOCALEDIR BISON_LOCALEDIR
|
# define LOCALEDIR BISON_LOCALEDIR
|
||||||
# endif
|
# endif
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Emitted in the header file, before the definition of YYSTYPE.
|
||||||
%code requires {
|
%code requires {
|
||||||
// Function type.
|
// Function type.
|
||||||
typedef double (func_t) (double);
|
typedef double (func_t) (double);
|
||||||
@@ -44,20 +65,39 @@
|
|||||||
|
|
||||||
symrec *putsym (char const *name, int sym_type);
|
symrec *putsym (char const *name, int sym_type);
|
||||||
symrec *getsym (char const *name);
|
symrec *getsym (char const *name);
|
||||||
|
|
||||||
|
// Exchanging information with the parser.
|
||||||
|
typedef struct
|
||||||
|
{
|
||||||
|
// Whether to not emit error messages.
|
||||||
|
int silent;
|
||||||
|
// The current input line.
|
||||||
|
const char *line;
|
||||||
|
} user_context;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Emitted in the header file, after the definition of YYSTYPE.
|
||||||
%code provides {
|
%code provides {
|
||||||
# ifndef __attribute__
|
# ifndef __attribute__
|
||||||
# ifndef __GNUC__
|
# ifndef __GNUC__
|
||||||
# define __attribute__(Spec) /* empty */
|
# define __attribute__(Spec) /* empty */
|
||||||
# endif
|
# endif
|
||||||
# endif
|
# endif
|
||||||
int yylex (const char **line, YYSTYPE *yylval, YYLTYPE *yylloc);
|
|
||||||
void yyerror (YYLTYPE *loc, char const *format, ...)
|
yytoken_kind_t
|
||||||
__attribute__ ((__format__ (__printf__, 2, 3)));
|
yylex (const char **line, YYSTYPE *yylval, YYLTYPE *yylloc,
|
||||||
|
const user_context *uctx);
|
||||||
|
void yyerror (const YYLTYPE *loc, const user_context *uctx,
|
||||||
|
char const *format, ...)
|
||||||
|
__attribute__ ((__format__ (__printf__, 3, 4)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Emitted in the implementation file.
|
||||||
%code {
|
%code {
|
||||||
|
// Print *LOC on OUT.
|
||||||
|
static void location_print (FILE *out, YYLTYPE const * const loc);
|
||||||
|
#define YYLOCATION_PRINT location_print
|
||||||
|
|
||||||
#if defined ENABLE_NLS && ENABLE_NLS
|
#if defined ENABLE_NLS && ENABLE_NLS
|
||||||
# define _(Msgid) gettext (Msgid)
|
# define _(Msgid) gettext (Msgid)
|
||||||
#else
|
#else
|
||||||
@@ -68,6 +108,9 @@
|
|||||||
int done = 0;
|
int done = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Include the header in the implementation rather than duplicating it.
|
||||||
|
%define api.header.include {"parse.h"}
|
||||||
|
|
||||||
// Don't share global variables between the scanner and the parser.
|
// Don't share global variables between the scanner and the parser.
|
||||||
%define api.pure full
|
%define api.pure full
|
||||||
|
|
||||||
@@ -78,18 +121,21 @@
|
|||||||
// with TOK_ (e.g., TOK_EOF).
|
// with TOK_ (e.g., TOK_EOF).
|
||||||
%define api.token.prefix {TOK_}
|
%define api.token.prefix {TOK_}
|
||||||
|
|
||||||
// Customized syntax error messages (see yyreport_syntax_error).
|
// Customized syntax error messages (see yyreport_syntax_error)...
|
||||||
%define parse.error custom
|
%define parse.error custom
|
||||||
|
|
||||||
// with locations.
|
// ... with locations...
|
||||||
%locations
|
%locations
|
||||||
|
|
||||||
// and accurate list of expected tokens.
|
// ... and accurate list of expected tokens.
|
||||||
%define parse.lac full
|
%define parse.lac full
|
||||||
|
|
||||||
// Generate the parser description file (calc.output).
|
// Generate the parser description file (calc.output).
|
||||||
%verbose
|
%verbose
|
||||||
|
|
||||||
|
// User information exchanged with the parser and scanner.
|
||||||
|
%param {const user_context *uctx}
|
||||||
|
|
||||||
// Generate YYSTYPE from the types assigned to symbols.
|
// Generate YYSTYPE from the types assigned to symbols.
|
||||||
%define api.value.type union
|
%define api.value.type union
|
||||||
%token
|
%token
|
||||||
@@ -145,7 +191,7 @@ exp:
|
|||||||
{
|
{
|
||||||
if ($r == 0)
|
if ($r == 0)
|
||||||
{
|
{
|
||||||
yyerror (&@$, "error: division by zero");
|
yyerror (&@$, uctx, _("error: division by zero"));
|
||||||
YYERROR;
|
YYERROR;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -227,12 +273,33 @@ symbol_count (void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*------------.
|
||||||
|
| Locations. |
|
||||||
|
`------------*/
|
||||||
|
|
||||||
|
// Print *LOC on OUT. Do it in a compact way, that avoids redundancy.
|
||||||
|
|
||||||
|
static void
|
||||||
|
location_print (FILE *out, YYLTYPE const * const loc)
|
||||||
|
{
|
||||||
|
fprintf (out, "%d.%d", loc->first_line, loc->first_column);
|
||||||
|
|
||||||
|
int end_col = 0 != loc->last_column ? loc->last_column - 1 : 0;
|
||||||
|
if (loc->first_line < loc->last_line)
|
||||||
|
fprintf (out, "-%d.%d", loc->last_line, end_col);
|
||||||
|
else if (loc->first_column < end_col)
|
||||||
|
fprintf (out, "-%d", end_col);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/*----------.
|
/*----------.
|
||||||
| Scanner. |
|
| Scanner. |
|
||||||
`----------*/
|
`----------*/
|
||||||
|
|
||||||
int
|
yytoken_kind_t
|
||||||
yylex (const char **line, YYSTYPE *yylval, YYLTYPE *yylloc)
|
yylex (const char **line, YYSTYPE *yylval, YYLTYPE *yylloc,
|
||||||
|
const user_context *uctx)
|
||||||
{
|
{
|
||||||
int c;
|
int c;
|
||||||
|
|
||||||
@@ -267,7 +334,8 @@ yylex (const char **line, YYSTYPE *yylval, YYLTYPE *yylloc)
|
|||||||
case '5': case '6': case '7': case '8': case '9':
|
case '5': case '6': case '7': case '8': case '9':
|
||||||
{
|
{
|
||||||
int nchars = 0;
|
int nchars = 0;
|
||||||
sscanf (*line - 1, "%lf%n", &yylval->TOK_NUM, &nchars);
|
if (sscanf (*line - 1, "%lf%n", &yylval->TOK_NUM, &nchars) != 1)
|
||||||
|
abort ();
|
||||||
*line += nchars - 1;
|
*line += nchars - 1;
|
||||||
yylloc->last_column += nchars - 1;
|
yylloc->last_column += nchars - 1;
|
||||||
return TOK_NUM;
|
return TOK_NUM;
|
||||||
@@ -283,7 +351,8 @@ yylex (const char **line, YYSTYPE *yylval, YYLTYPE *yylloc)
|
|||||||
{
|
{
|
||||||
int nchars = 0;
|
int nchars = 0;
|
||||||
char buf[100];
|
char buf[100];
|
||||||
sscanf (*line - 1, "%99[a-z]%n", buf, &nchars);
|
if (sscanf (*line - 1, "%99[a-z]%n", buf, &nchars) != 1)
|
||||||
|
abort ();
|
||||||
*line += nchars - 1;
|
*line += nchars - 1;
|
||||||
yylloc->last_column += nchars - 1;
|
yylloc->last_column += nchars - 1;
|
||||||
if (strcmp (buf, "exit") == 0)
|
if (strcmp (buf, "exit") == 0)
|
||||||
@@ -300,7 +369,7 @@ yylex (const char **line, YYSTYPE *yylval, YYLTYPE *yylloc)
|
|||||||
|
|
||||||
// Stray characters.
|
// Stray characters.
|
||||||
default:
|
default:
|
||||||
yyerror (yylloc, "syntax error: invalid character: %c", c);
|
yyerror (yylloc, uctx, _("syntax error: invalid character: %c"), c);
|
||||||
return TOK_YYerror;
|
return TOK_YYerror;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -338,8 +407,11 @@ error_format_string (int argc)
|
|||||||
|
|
||||||
|
|
||||||
int
|
int
|
||||||
yyreport_syntax_error (const yypcontext_t *ctx)
|
yyreport_syntax_error (const yypcontext_t *ctx, const user_context *uctx)
|
||||||
{
|
{
|
||||||
|
if (uctx->silent)
|
||||||
|
return 0;
|
||||||
|
|
||||||
enum { ARGS_MAX = 6 };
|
enum { ARGS_MAX = 6 };
|
||||||
yysymbol_kind_t arg[ARGS_MAX];
|
yysymbol_kind_t arg[ARGS_MAX];
|
||||||
int argsize = yypcontext_expected_tokens (ctx, arg, ARGS_MAX);
|
int argsize = yypcontext_expected_tokens (ctx, arg, ARGS_MAX);
|
||||||
@@ -350,11 +422,12 @@ yyreport_syntax_error (const yypcontext_t *ctx)
|
|||||||
argsize = ARGS_MAX;
|
argsize = ARGS_MAX;
|
||||||
const char *format = error_format_string (1 + argsize + too_many_expected_tokens);
|
const char *format = error_format_string (1 + argsize + too_many_expected_tokens);
|
||||||
|
|
||||||
|
const YYLTYPE *loc = yypcontext_location (ctx);
|
||||||
while (*format)
|
while (*format)
|
||||||
// %@: location.
|
// %@: location.
|
||||||
if (format[0] == '%' && format[1] == '@')
|
if (format[0] == '%' && format[1] == '@')
|
||||||
{
|
{
|
||||||
YY_LOCATION_PRINT (stderr, *yypcontext_location (ctx));
|
YYLOCATION_PRINT (stderr, loc);
|
||||||
format += 2;
|
format += 2;
|
||||||
}
|
}
|
||||||
// %u: unexpected token.
|
// %u: unexpected token.
|
||||||
@@ -379,14 +452,26 @@ yyreport_syntax_error (const yypcontext_t *ctx)
|
|||||||
++format;
|
++format;
|
||||||
}
|
}
|
||||||
fputc ('\n', stderr);
|
fputc ('\n', stderr);
|
||||||
|
|
||||||
|
// Quote the source line.
|
||||||
|
{
|
||||||
|
fprintf (stderr, "%5d | %s\n", loc->first_line, uctx->line);
|
||||||
|
fprintf (stderr, "%5s | %*s", "", loc->first_column, "^");
|
||||||
|
for (int i = loc->last_column - loc->first_column - 1; 0 < i; --i)
|
||||||
|
putc ('~', stderr);
|
||||||
|
putc ('\n', stderr);
|
||||||
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Called by yyparse on error.
|
// Called by yyparse on error.
|
||||||
void yyerror (YYLTYPE *loc, char const *format, ...)
|
void yyerror (const YYLTYPE *loc, const user_context *uctx, char const *format, ...)
|
||||||
{
|
{
|
||||||
YY_LOCATION_PRINT (stderr, *loc);
|
if (uctx->silent)
|
||||||
|
return;
|
||||||
|
|
||||||
|
YYLOCATION_PRINT (stderr, loc);
|
||||||
fputs (": ", stderr);
|
fputs (": ", stderr);
|
||||||
va_list args;
|
va_list args;
|
||||||
va_start (args, format);
|
va_start (args, format);
|
||||||
@@ -421,11 +506,13 @@ xstrndup (const char *string, size_t n)
|
|||||||
static int
|
static int
|
||||||
process_line (YYLTYPE *lloc, const char *line)
|
process_line (YYLTYPE *lloc, const char *line)
|
||||||
{
|
{
|
||||||
|
user_context uctx = {0, line};
|
||||||
yypstate *ps = yypstate_new ();
|
yypstate *ps = yypstate_new ();
|
||||||
int status = 0;
|
int status = 0;
|
||||||
do {
|
do {
|
||||||
YYSTYPE lval;
|
YYSTYPE lval;
|
||||||
status = yypush_parse (ps, yylex (&line, &lval, lloc), &lval, lloc);
|
yytoken_kind_t token = yylex (&line, &lval, lloc, &uctx);
|
||||||
|
status = yypush_parse (ps, token, &lval, lloc, &uctx);
|
||||||
} while (status == YYPUSH_MORE);
|
} while (status == YYPUSH_MORE);
|
||||||
yypstate_delete (ps);
|
yypstate_delete (ps);
|
||||||
lloc->last_line++;
|
lloc->last_line++;
|
||||||
@@ -440,24 +527,30 @@ expected_tokens (const char *input,
|
|||||||
int *tokens, int ntokens)
|
int *tokens, int ntokens)
|
||||||
{
|
{
|
||||||
YYDPRINTF ((stderr, "expected_tokens (\"%s\")", input));
|
YYDPRINTF ((stderr, "expected_tokens (\"%s\")", input));
|
||||||
|
user_context uctx = {1, input};
|
||||||
|
|
||||||
// Parse the current state of the line.
|
// Parse the current state of the line.
|
||||||
yypstate *ps = yypstate_new ();
|
yypstate *ps = yypstate_new ();
|
||||||
int status = 0;
|
int status = 0;
|
||||||
|
YYLTYPE lloc = { 1, 1, 1, 1 };
|
||||||
do {
|
do {
|
||||||
YYLTYPE lloc;
|
|
||||||
YYSTYPE lval;
|
YYSTYPE lval;
|
||||||
int token = yylex (&input, &lval, &lloc);
|
yytoken_kind_t token = yylex (&input, &lval, &lloc, &uctx);
|
||||||
// Don't let the parse know when we reach the end of input.
|
// Don't let the parse know when we reach the end of input.
|
||||||
if (!token)
|
if (token == TOK_YYEOF)
|
||||||
break;
|
break;
|
||||||
status = yypush_parse (ps, token, &lval, &lloc);
|
status = yypush_parse (ps, token, &lval, &lloc, &uctx);
|
||||||
} while (status == YYPUSH_MORE);
|
} while (status == YYPUSH_MORE);
|
||||||
|
|
||||||
// Then query for the accepted tokens at this point.
|
int res = 0;
|
||||||
int res = yypstate_expected_tokens (ps, tokens, ntokens);
|
// If there were parse errors, don't propose completions.
|
||||||
if (res < 0)
|
if (!ps->yynerrs)
|
||||||
abort ();
|
{
|
||||||
|
// Then query for the accepted tokens at this point.
|
||||||
|
res = yypstate_expected_tokens (ps, tokens, ntokens);
|
||||||
|
if (res < 0)
|
||||||
|
abort ();
|
||||||
|
}
|
||||||
yypstate_delete (ps);
|
yypstate_delete (ps);
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
@@ -569,10 +662,10 @@ main (int argc, char const* argv[])
|
|||||||
#if defined ENABLE_NLS && ENABLE_NLS
|
#if defined ENABLE_NLS && ENABLE_NLS
|
||||||
// Set up internationalization.
|
// Set up internationalization.
|
||||||
setlocale (LC_ALL, "");
|
setlocale (LC_ALL, "");
|
||||||
// Use Bison's standard translation catalogue for error messages
|
// Use Bison's standard translation catalog for error messages
|
||||||
// (the generated messages).
|
// (the generated messages).
|
||||||
bindtextdomain ("bison-runtime", BISON_LOCALEDIR);
|
bindtextdomain ("bison-runtime", BISON_LOCALEDIR);
|
||||||
// The translation catalogue of bistromathic is actually included in
|
// The translation catalog of bistromathic is actually included in
|
||||||
// Bison's. In your own project, use the name of your project.
|
// Bison's. In your own project, use the name of your project.
|
||||||
bindtextdomain ("bison", LOCALEDIR);
|
bindtextdomain ("bison", LOCALEDIR);
|
||||||
textdomain ("bison");
|
textdomain ("bison");
|
||||||
|
|||||||
@@ -3,12 +3,11 @@
|
|||||||
|
|
||||||
BASE = calc
|
BASE = calc
|
||||||
BISON = bison
|
BISON = bison
|
||||||
XSLTPROC = xsltproc
|
|
||||||
|
|
||||||
all: $(BASE)
|
all: $(BASE)
|
||||||
|
|
||||||
%.c %.h %.xml %.gv: %.y
|
%.c %.h %.html %.xml %.gv: %.y
|
||||||
$(BISON) $(BISONFLAGS) --defines --xml --graph=$*.gv -o $*.c $<
|
$(BISON) $(BISONFLAGS) --header --html --graph -o $*.c $<
|
||||||
|
|
||||||
$(BASE): $(BASE).o
|
$(BASE): $(BASE).o
|
||||||
$(CC) $(CFLAGS) -o $@ $^
|
$(CC) $(CFLAGS) -o $@ $^
|
||||||
@@ -17,10 +16,6 @@ run: $(BASE)
|
|||||||
@echo "Type arithmetic expressions. Quit with ctrl-d."
|
@echo "Type arithmetic expressions. Quit with ctrl-d."
|
||||||
./$<
|
./$<
|
||||||
|
|
||||||
html: $(BASE).html
|
|
||||||
%.html: %.xml
|
|
||||||
$(XSLTPROC) $(XSLTPROCFLAGS) -o $@ $$($(BISON) --print-datadir)/xslt/xml2xhtml.xsl $<
|
|
||||||
|
|
||||||
CLEANFILES = \
|
CLEANFILES = \
|
||||||
$(BASE) *.o $(BASE).[ch] $(BASE).output $(BASE).xml $(BASE).html $(BASE).gv
|
$(BASE) *.o $(BASE).[ch] $(BASE).output $(BASE).xml $(BASE).html $(BASE).gv
|
||||||
|
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ fill-column: 76
|
|||||||
ispell-dictionary: "american"
|
ispell-dictionary: "american"
|
||||||
End:
|
End:
|
||||||
|
|
||||||
Copyright (C) 2019-2020 Free Software Foundation, Inc.
|
Copyright (C) 2019-2021 Free Software Foundation, Inc.
|
||||||
|
|
||||||
This file is part of Bison, the GNU Compiler Compiler.
|
This file is part of Bison, the GNU Compiler Compiler.
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
#! /bin/sh
|
#! /bin/sh
|
||||||
|
|
||||||
# Copyright (C) 2019-2020 Free Software Foundation, Inc.
|
# Copyright (C) 2019-2021 Free Software Foundation, Inc.
|
||||||
#
|
#
|
||||||
# This program is free software: you can redistribute it and/or modify
|
# This program is free software: you can redistribute it and/or modify
|
||||||
# it under the terms of the GNU General Public License as published by
|
# it under the terms of the GNU General Public License as published by
|
||||||
@@ -13,7 +13,7 @@
|
|||||||
# GNU General Public License for more details.
|
# GNU General Public License for more details.
|
||||||
#
|
#
|
||||||
# You should have received a copy of the GNU General Public License
|
# You should have received a copy of the GNU General Public License
|
||||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
cat >input <<EOF
|
cat >input <<EOF
|
||||||
1+2*3
|
1+2*3
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user