mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-08-11 03:35:15 +00:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b458b34f94 | ||
|
|
09a22da8c8 | ||
|
|
cf899f7a7c | ||
|
|
a774839ca8 | ||
|
|
ef3adfa0fb | ||
|
|
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 | ||
|
|
0364dbacbf | ||
|
|
7a11a9308c | ||
|
|
d8cc6b073e | ||
|
|
0264b4bca0 | ||
|
|
8b424b865e | ||
|
|
f4431ea115 | ||
|
|
fe8c36ddca | ||
|
|
21c147b6e5 | ||
|
|
d3c575a6c6 | ||
|
|
d8b49e2b73 | ||
|
|
14c65a35f0 | ||
|
|
c47bb87f9f | ||
|
|
98c35e0025 | ||
|
|
bd6b046ce7 | ||
|
|
7c6e7bd300 | ||
|
|
3cba59dd7f | ||
|
|
a15879c623 | ||
|
|
5d501ee728 | ||
|
|
bc5e4541da | ||
|
|
567d1eaa19 | ||
|
|
c08e0863be | ||
|
|
541943ee04 | ||
|
|
dcdd119f69 | ||
|
|
a0bc06b703 | ||
|
|
5e33dfe59d | ||
|
|
2a4e9a358f | ||
|
|
f7b642cff7 | ||
|
|
3da17724ad | ||
|
|
68e3e442f9 | ||
|
|
e432619d11 | ||
|
|
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 | ||
|
|
0535d2a608 | ||
|
|
94f7606db6 | ||
|
|
de5be4a693 | ||
|
|
03a6b439f6 | ||
|
|
742910838e | ||
|
|
52ce2a008b | ||
|
|
bb311cfbed | ||
|
|
518dc6ca26 | ||
|
|
6a1a681fd2 | ||
|
|
dd878d1851 | ||
|
|
6ed813c122 | ||
|
|
1ec93ca2a2 | ||
|
|
12f4091de4 | ||
|
|
8ece778cb8 | ||
|
|
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 | ||
|
|
f80890c4bb | ||
|
|
1ebc2ac55c | ||
|
|
94952779b6 | ||
|
|
ed7d5c2b5b | ||
|
|
1ce02e13c3 | ||
|
|
8ef0b12eb7 | ||
|
|
e6d83116ae | ||
|
|
4d9fa28ba8 | ||
|
|
a100a3c4c1 | ||
|
|
b18ceb50f1 | ||
|
|
ff4d67ede8 | ||
|
|
465babb635 | ||
|
|
22c3839168 | ||
|
|
4619b32dc0 | ||
|
|
ad921890c1 | ||
|
|
6a28e6d412 | ||
|
|
f4495da337 | ||
|
|
dbaed0bbf2 | ||
|
|
78c7fb6460 | ||
|
|
14ce500508 | ||
|
|
acba58ac59 | ||
|
|
da29809969 | ||
|
|
87e4895189 | ||
|
|
01e3f45f83 | ||
|
|
9c21da3363 | ||
|
|
febf6115a0 | ||
|
|
11b5bac7bf | ||
|
|
b61bf2f0e8 | ||
|
|
091943f265 | ||
|
|
bf98d94f4f | ||
|
|
6bb37dbe27 | ||
|
|
c3585f41ef | ||
|
|
6525abdc83 | ||
|
|
2b63c54f5a | ||
|
|
2da399d15f | ||
|
|
19f45df02b | ||
|
|
2ab4058de0 | ||
|
|
f2277c3fec | ||
|
|
fb49a10e2c | ||
|
|
f049a57eec | ||
|
|
0c77d69721 | ||
|
|
307fcdee00 | ||
|
|
d26d10ad6c | ||
|
|
1b4108da3e | ||
|
|
53bfc7df94 | ||
|
|
a5fb4a88ef | ||
|
|
54df196d49 | ||
|
|
52bb6f0525 | ||
|
|
76dab18af3 | ||
|
|
c982974f33 | ||
|
|
dc2a3578b7 | ||
|
|
9661b2fcbc | ||
|
|
d9a9b054ae | ||
|
|
cb9f4cb543 | ||
|
|
b86dcaf40b | ||
|
|
0fafbbdefb | ||
|
|
4b85b969d0 | ||
|
|
7727693711 | ||
|
|
ce27796b74 | ||
|
|
6135fdc152 | ||
|
|
f1497356e8 | ||
|
|
1429569362 | ||
|
|
506c368ab2 | ||
|
|
4f9dc3bdc1 | ||
|
|
0d81be2dc7 | ||
|
|
32f44f4bfb | ||
|
|
38a8287813 | ||
|
|
df752784c2 | ||
|
|
292409e91e | ||
|
|
eea56d70d9 | ||
|
|
6e2de439e6 | ||
|
|
e33cd4b824 | ||
|
|
0669780ff8 | ||
|
|
160df220b1 | ||
|
|
da5c072a62 | ||
|
|
73ac8ff409 | ||
|
|
0e0fb0efc9 | ||
|
|
bb1d776be0 | ||
|
|
d7e1abe656 | ||
|
|
13a1537dba | ||
|
|
ac2ba46053 | ||
|
|
2a7a2c1d3a | ||
|
|
c9b5b68c73 | ||
|
|
26aef31552 | ||
|
|
392f3caef6 | ||
|
|
ccaa8e29f9 | ||
|
|
76c3bccf40 | ||
|
|
6275137378 | ||
|
|
d0571c846f | ||
|
|
8c1002e4b7 | ||
|
|
dbd8fd71ba | ||
|
|
95bac741c3 | ||
|
|
f8ab4d81c0 | ||
|
|
d55c9b001a | ||
|
|
611495999f | ||
|
|
01d5f232a9 | ||
|
|
0407acbc59 | ||
|
|
0c0e778bd1 | ||
|
|
30357ae942 | ||
|
|
fb1d76d9a9 | ||
|
|
a61bc3f9f8 | ||
|
|
f0942df01a | ||
|
|
52ababbc89 | ||
|
|
8e11933e41 | ||
|
|
99efa35369 | ||
|
|
547545a795 | ||
|
|
1b5cf80e32 | ||
|
|
4c641c5189 | ||
|
|
3b05de2d05 | ||
|
|
902a235ad3 | ||
|
|
11027558c8 | ||
|
|
cd4e799da4 | ||
|
|
7346163840 | ||
|
|
89c4e1becf | ||
|
|
3262747c5b | ||
|
|
5f3cd49acc | ||
|
|
e6d928c4e8 | ||
|
|
b254b36db8 | ||
|
|
58e79539fc | ||
|
|
60366b152b | ||
|
|
c90110efd3 | ||
|
|
3b50adf7f4 | ||
|
|
3aaa971096 | ||
|
|
7eabe1c70b | ||
|
|
7fec669e42 | ||
|
|
cbbbe12e02 | ||
|
|
286d0755f8 | ||
|
|
1c3d79b871 | ||
|
|
9c72d3c5a8 | ||
|
|
bc083be055 | ||
|
|
22eeb1ab8a | ||
|
|
c4dbc1776c | ||
|
|
b74fc07d21 | ||
|
|
3ab12c1036 | ||
|
|
30ce43b2b5 | ||
|
|
150dc95395 | ||
|
|
bb7c4a5508 | ||
|
|
5c9f50b545 | ||
|
|
b42702d738 | ||
|
|
401e7c5c36 | ||
|
|
93fec67c46 | ||
|
|
4378e2dc3c | ||
|
|
81334eb5a0 | ||
|
|
df373f1ea1 | ||
|
|
9b7e7077dd | ||
|
|
5ab0086157 | ||
|
|
2831bd376f | ||
|
|
1d0e3ee896 | ||
|
|
0a64b76430 | ||
|
|
0b948b7696 | ||
|
|
8b5fb7c4c3 | ||
|
|
d6ae95fb50 | ||
|
|
e86b14069d | ||
|
|
5d983253f7 | ||
|
|
caadfc552b | ||
|
|
c4c25e091c | ||
|
|
fc18b4313a | ||
|
|
758172a8b9 | ||
|
|
e9454c3456 | ||
|
|
8f01cf0269 | ||
|
|
dab08da605 | ||
|
|
8cedb4b40e | ||
|
|
258c2c967f | ||
|
|
9a33570493 | ||
|
|
42ab6c1e44 | ||
|
|
dc1035bada | ||
|
|
71e3f6d4da | ||
|
|
3877b7210e | ||
|
|
64aec0a8d8 | ||
|
|
5e2e9af56d | ||
|
|
7a226860ef | ||
|
|
c973361138 | ||
|
|
5839f4d289 | ||
|
|
ffa46e6516 | ||
|
|
ff50f6f223 | ||
|
|
05be0fef95 | ||
|
|
72c9fa4510 | ||
|
|
a555b41990 | ||
|
|
ecf5cb7e0e | ||
|
|
e50de09886 | ||
|
|
95421df67b | ||
|
|
a4ed94bc13 | ||
|
|
07726f1178 | ||
|
|
e78596955d | ||
|
|
ecd5cae2d4 | ||
|
|
8dcc25a1e4 | ||
|
|
1a5f74d2f6 | ||
|
|
00a654c8ad | ||
|
|
6c5f690da4 | ||
|
|
007e1b5f0a | ||
|
|
bbb9750b3e | ||
|
|
52d0e77c2c | ||
|
|
088d5668a9 | ||
|
|
87579e03e0 | ||
|
|
11225a5d2f | ||
|
|
3dcfb4fd88 | ||
|
|
c0ccb8e5b4 | ||
|
|
79f967ac0d | ||
|
|
0f6ab8e692 | ||
|
|
e657f04b62 | ||
|
|
10e61eec6d | ||
|
|
149e280aab | ||
|
|
e9fddab715 | ||
|
|
cc68bbf799 | ||
|
|
f0bb82ae9e | ||
|
|
04d62346f3 | ||
|
|
9b70d69f39 | ||
|
|
2b7bde9d13 | ||
|
|
ff2fc62138 | ||
|
|
2c05fc750a | ||
|
|
57bc3c9013 | ||
|
|
7aee4586ca | ||
|
|
6c44f2dce3 | ||
|
|
5604903f7a | ||
|
|
225a67321b | ||
|
|
4e3c06b0f8 | ||
|
|
4e26809ab9 | ||
|
|
678853da7e | ||
|
|
76e11b5a3e | ||
|
|
f9c73eec5f | ||
|
|
f6dcecb287 | ||
|
|
ad31c3cdf4 | ||
|
|
7fa23136ca | ||
|
|
961ea2ac85 | ||
|
|
cc6e5cf854 | ||
|
|
1376a7c6e2 | ||
|
|
1c273826d4 | ||
|
|
4a55a5ea9a | ||
|
|
72f04ca80f | ||
|
|
fd98afaf10 | ||
|
|
cca8c73431 | ||
|
|
cb40f5c624 | ||
|
|
6c23b012b9 | ||
|
|
ef88dfba81 | ||
|
|
6e89bc0fd2 | ||
|
|
e3e21cc0d8 | ||
|
|
a0ee2a7543 | ||
|
|
7e28dbea11 | ||
|
|
65df8d6747 | ||
|
|
beea39b2ec | ||
|
|
086506bf23 | ||
|
|
39792f57fb | ||
|
|
65bbaf9598 | ||
|
|
9039c571f4 | ||
|
|
d3db22d788 | ||
|
|
9434571f95 | ||
|
|
0cdbcee0ce | ||
|
|
fd37eb057e | ||
|
|
ecc3a13c34 | ||
|
|
04904e4d28 | ||
|
|
75a605454d | ||
|
|
d7f39ac507 | ||
|
|
f3c18c8e80 | ||
|
|
00c80bc96c | ||
|
|
f62f1db298 | ||
|
|
3ba001baac | ||
|
|
4140320a0a | ||
|
|
af19fd7e0f | ||
|
|
2c74872991 | ||
|
|
50517d578c | ||
|
|
59d820d1ef | ||
|
|
90f0500ef8 | ||
|
|
17a9542c4f | ||
|
|
b7045aa706 | ||
|
|
ee56b6e0f2 | ||
|
|
1edc98f793 | ||
|
|
4192de1f41 | ||
|
|
00b0d02955 | ||
|
|
1045c8d0ef | ||
|
|
ef8965b5f5 | ||
|
|
84b1972c96 | ||
|
|
1079595b2a | ||
|
|
e364bcdbc5 | ||
|
|
5a8db8a739 | ||
|
|
5acc29041e | ||
|
|
5b0b0a1e08 | ||
|
|
1c694e08cc | ||
|
|
4cfb067d93 | ||
|
|
cf60d0a617 | ||
|
|
c0e8489605 | ||
|
|
788b1a6858 | ||
|
|
56414791e9 | ||
|
|
675dcf1962 | ||
|
|
466fb66578 | ||
|
|
cbb967dbad | ||
|
|
44ac18d136 | ||
|
|
0c3dd3a669 | ||
|
|
951da960e6 | ||
|
|
15ea35019f | ||
|
|
f49684a577 | ||
|
|
044ad1288c | ||
|
|
e3812bb8c3 | ||
|
|
cfcd823e16 | ||
|
|
2f02d9beae | ||
|
|
b638603477 | ||
|
|
e21ff47f5d | ||
|
|
b82b387da9 | ||
|
|
641e326303 | ||
|
|
192e9fdf77 | ||
|
|
a4a3f08c11 | ||
|
|
666df338a7 | ||
|
|
b437b16603 | ||
|
|
b493c173c9 | ||
|
|
aab3feb5a1 | ||
|
|
b7942f2661 | ||
|
|
cefb538ab0 | ||
|
|
ecd922024e | ||
|
|
2353ce7216 | ||
|
|
9cc76ee62c | ||
|
|
2f83ef57f3 | ||
|
|
744171ddbf | ||
|
|
4fd3282dd7 | ||
|
|
67793793e8 | ||
|
|
f334775dbf | ||
|
|
feb1011c8b | ||
|
|
99bedadf23 | ||
|
|
79c3f2b8fd | ||
|
|
4cca30d2e6 | ||
|
|
5789f9d91e | ||
|
|
b269a45fa4 | ||
|
|
1478fccd23 | ||
|
|
535281f0ff | ||
|
|
c4a7e7a1ab | ||
|
|
388e12ac0f | ||
|
|
b870d5fee4 | ||
|
|
30d01b21e7 | ||
|
|
c2cca46795 | ||
|
|
879530cb95 | ||
|
|
72acecb30c | ||
|
|
d4fcd5c3d0 | ||
|
|
368fcf0af5 | ||
|
|
6fe063da8f | ||
|
|
296660304c | ||
|
|
323731ff74 | ||
|
|
6f7f949708 | ||
|
|
15e57d9108 | ||
|
|
30ba94081c | ||
|
|
0e7bc7a6d8 | ||
|
|
eff4d16175 | ||
|
|
b0e11f4523 | ||
|
|
d9b2270bed | ||
|
|
7a28659495 | ||
|
|
e09a72eeb0 | ||
|
|
a09d0ae4d1 | ||
|
|
1e25cb44d1 | ||
|
|
3ed42d2487 | ||
|
|
26c5f48c1c | ||
|
|
e7a202d762 | ||
|
|
11e2b755f0 | ||
|
|
f3d33c3613 | ||
|
|
163a35d6dd | ||
|
|
cdb42f7730 | ||
|
|
126252333d | ||
|
|
8637f2c7d6 | ||
|
|
6946149701 | ||
|
|
1368b9dbc9 | ||
|
|
0e96eaf612 | ||
|
|
77bdcc6f0c | ||
|
|
57647bb656 | ||
|
|
63cd2918ff | ||
|
|
d810aa3d8f | ||
|
|
ed1eedbbcb | ||
|
|
bc74b4b15a | ||
|
|
8dd8137c38 | ||
|
|
1388e5b276 | ||
|
|
6f5465c917 | ||
|
|
bb02acc2ed | ||
|
|
80a4389377 | ||
|
|
ef097719ea | ||
|
|
0c90c59795 | ||
|
|
18a7cfc7cf | ||
|
|
088356cb2f | ||
|
|
52db24b2bc | ||
|
|
650b253843 | ||
|
|
7781254e01 | ||
|
|
fa226d773c | ||
|
|
1cc83505c5 | ||
|
|
2d97fe86fd | ||
|
|
3239866f4a | ||
|
|
ebab1ffca8 | ||
|
|
f705e9abdb | ||
|
|
d6f576102e | ||
|
|
0f587e9931 | ||
|
|
48be689a73 | ||
|
|
d727e0ff23 | ||
|
|
37aeda6fb3 | ||
|
|
bba2f0a3a0 | ||
|
|
fe14fb1c40 | ||
|
|
88d1ab421a | ||
|
|
edf495b38e | ||
|
|
ba69beafac | ||
|
|
c16fcaf2fb | ||
|
|
7e99f67592 | ||
|
|
d5f929d407 | ||
|
|
c5b215b5e6 | ||
|
|
0774b2c6e3 | ||
|
|
493359b758 | ||
|
|
23ba9e5dfa | ||
|
|
792fc34016 | ||
|
|
c4a08d1899 | ||
|
|
50fb1e6e0c | ||
|
|
6bd0527a50 | ||
|
|
1aa9d40b24 | ||
|
|
a1da9b9fe8 | ||
|
|
c80cdf2db2 | ||
|
|
3197d0fac9 | ||
|
|
78e43ce8ff | ||
|
|
fe23e19323 | ||
|
|
f374310119 | ||
|
|
7bfff37f01 | ||
|
|
26fba6fc94 | ||
|
|
c592202345 | ||
|
|
0917f4dc76 | ||
|
|
0f792833c2 | ||
|
|
b62e063df5 | ||
|
|
e6b0612f91 | ||
|
|
2eb3328afc | ||
|
|
81849520cd | ||
|
|
fc2191f137 | ||
|
|
6fb362c87a | ||
|
|
46ab1d0cbe | ||
|
|
f54a5b303b | ||
|
|
2cc361387c | ||
|
|
e6d1289f4a | ||
|
|
16c77b4ba2 | ||
|
|
172f103c1e | ||
|
|
6ada985ff3 | ||
|
|
2e12257803 | ||
|
|
1db962716a | ||
|
|
9096955fba | ||
|
|
e9d404415a | ||
|
|
d9df62bfcd | ||
|
|
adac9a17f0 | ||
|
|
3b4b157369 | ||
|
|
5c332d70d7 | ||
|
|
91247f50d7 | ||
|
|
f443673450 | ||
|
|
8e6233353f | ||
|
|
e5a5da16ed | ||
|
|
ebe427bbf3 | ||
|
|
c6e2dcabae | ||
|
|
e1197fcc3d | ||
|
|
1854429e40 | ||
|
|
cece227f95 | ||
|
|
e83077c617 | ||
|
|
fd33cc9c8b | ||
|
|
8637438cee | ||
|
|
ee97f37cb4 | ||
|
|
68ef3a0466 | ||
|
|
cda1934606 | ||
|
|
5b883180e6 | ||
|
|
135d0336d5 | ||
|
|
cc6c647f00 | ||
|
|
a1aef9825a | ||
|
|
ece99a890c | ||
|
|
169c2530e4 | ||
|
|
c894a6e2ce | ||
|
|
187c2ac344 | ||
|
|
f06c0d2c05 | ||
|
|
975be86ccc | ||
|
|
1c0adb410d | ||
|
|
32b529f038 | ||
|
|
46cce832fd | ||
|
|
98a1045bea | ||
|
|
8426663631 | ||
|
|
a0675d707f | ||
|
|
e419eda5e2 | ||
|
|
2116af766a | ||
|
|
8036635251 | ||
|
|
c442b5de9d | ||
|
|
da4587fcd7 | ||
|
|
86a3ec0f8d | ||
|
|
7122d747cf | ||
|
|
69fe4b9eb6 | ||
|
|
385fb345bf | ||
|
|
f983d00e77 |
+1
-1
@@ -1 +1 @@
|
|||||||
3.5.1
|
3.7.5
|
||||||
|
|||||||
+144
-77
@@ -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
|
||||||
@@ -46,9 +47,10 @@ jobs:
|
|||||||
- ./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
|
- 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
|
||||||
@@ -67,10 +69,122 @@ jobs:
|
|||||||
## First. ##
|
## First. ##
|
||||||
## ------- ##
|
## ------- ##
|
||||||
|
|
||||||
# Start with three completely different environments, to get
|
# Start with three completely different environments, to get errors asap.
|
||||||
# errors asap.
|
|
||||||
|
|
||||||
- name: "GCC 9 -O3"
|
- name: "GCC 10 -O3"
|
||||||
|
stage: check
|
||||||
|
os: linux
|
||||||
|
dist: bionic
|
||||||
|
addons: &gcc10
|
||||||
|
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
|
||||||
|
- CXX=g++-10
|
||||||
|
- CONFIGUREFLAGS='CPPFLAGS=-DNDEBUG CFLAGS=-O3 CXXFLAGS=-O3'
|
||||||
|
|
||||||
|
# ASAN is time consuming, and we timeout the 50min granted by
|
||||||
|
# Travis if we run all the tests in one go. Run in two parts.
|
||||||
|
- name: "Clang 10 libc++ and ASAN part 1"
|
||||||
|
stage: check
|
||||||
|
os: linux
|
||||||
|
dist: bionic
|
||||||
|
addons: &clang10
|
||||||
|
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:
|
||||||
|
# Do not use ASAN with ubuntu's libc++: https://bugs.llvm.org/show_bug.cgi?id=17379
|
||||||
|
- CC='clang-10 -fsanitize=address'
|
||||||
|
- CXX='clang++-10 -fsanitize=address -stdlib=libc++'
|
||||||
|
- PART=1
|
||||||
|
|
||||||
|
- name: "Clang 10 libc++ and ASAN part 2"
|
||||||
|
stage: check
|
||||||
|
os: linux
|
||||||
|
dist: bionic
|
||||||
|
addons: *clang10
|
||||||
|
env:
|
||||||
|
# Do not use ASAN with ubuntu's libc++: https://bugs.llvm.org/show_bug.cgi?id=17379
|
||||||
|
- CC='clang-10 -fsanitize=address'
|
||||||
|
- CXX='clang++-10 -fsanitize=address -stdlib=libc++'
|
||||||
|
- 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"
|
||||||
|
stage: check
|
||||||
|
os: linux
|
||||||
|
compiler: icc
|
||||||
|
env:
|
||||||
|
- CC=icc
|
||||||
|
- CXX=icpc
|
||||||
|
install:
|
||||||
|
- source /opt/intel/oneapi/compiler/latest/env/vars.sh
|
||||||
|
addons:
|
||||||
|
apt:
|
||||||
|
sources:
|
||||||
|
- sourceline: 'deb https://apt.repos.intel.com/oneapi all main'
|
||||||
|
key_url: 'https://apt.repos.intel.com/intel-gpg-keys/GPG-PUB-KEY-INTEL-SW-PRODUCTS-2023.PUB'
|
||||||
|
packages:
|
||||||
|
- intel-oneapi-icc
|
||||||
|
|
||||||
|
- name: "ARM64: GCC 10 -O2 part 1"
|
||||||
|
stage: check
|
||||||
|
os: linux
|
||||||
|
arch: arm64
|
||||||
|
dist: bionic
|
||||||
|
addons: *gcc10
|
||||||
|
env:
|
||||||
|
- CC=gcc-10
|
||||||
|
- CXX=g++-10
|
||||||
|
- CONFIGUREFLAGS='CPPFLAGS=-DNDEBUG CFLAGS=-O2 CXXFLAGS=-O2'
|
||||||
|
- PART=1
|
||||||
|
|
||||||
|
- name: "PPC64le: GCC 10 -O2 part 1"
|
||||||
|
stage: check
|
||||||
|
os: linux
|
||||||
|
arch: ppc64le
|
||||||
|
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
|
||||||
|
- CXX=g++-10
|
||||||
|
- CONFIGUREFLAGS='CFLAGS=-O2 CXXFLAGS=-O2'
|
||||||
|
- PART=1
|
||||||
|
|
||||||
|
- name: "s390x: GCC 10 -O2 part 1"
|
||||||
|
stage: check
|
||||||
|
os: linux
|
||||||
|
arch: s390x
|
||||||
|
dist: bionic
|
||||||
|
addons: *gcc10
|
||||||
|
env:
|
||||||
|
- CC=gcc-10
|
||||||
|
- CXX=g++-10
|
||||||
|
- CONFIGUREFLAGS='CFLAGS=-O2 CXXFLAGS=-O2'
|
||||||
|
- PART=1
|
||||||
|
|
||||||
|
## ----- ##
|
||||||
|
## GCC. ##
|
||||||
|
## ----- ##
|
||||||
|
|
||||||
|
- name: "GCC 9 with sanitizers part 1"
|
||||||
stage: check
|
stage: check
|
||||||
os: linux
|
os: linux
|
||||||
dist: bionic
|
dist: bionic
|
||||||
@@ -81,74 +195,8 @@ jobs:
|
|||||||
- sourceline: 'ppa:ubuntu-toolchain-r/test'
|
- sourceline: 'ppa:ubuntu-toolchain-r/test'
|
||||||
packages: g++-9
|
packages: g++-9
|
||||||
env:
|
env:
|
||||||
- CC=gcc-9
|
- CC='gcc-9 -fsanitize=undefined,address -fno-omit-frame-pointer'
|
||||||
- CXX=g++-9
|
- CXX='g++-9 -fsanitize=undefined,address -fno-omit-frame-pointer'
|
||||||
- CONFIGUREFLAGS='CPPFLAGS=-DNDEBUG CFLAGS=-O3 CXXFLAGS=-O3'
|
|
||||||
|
|
||||||
# ASAN is time consuming, and we timeout the 50min granted by
|
|
||||||
# Travis if we run all the tests in one go. Run in two parts.
|
|
||||||
- name: "Clang 9 libc++ and ASAN part 1"
|
|
||||||
stage: check
|
|
||||||
os: linux
|
|
||||||
dist: bionic
|
|
||||||
addons: &clang9
|
|
||||||
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-9 main'
|
|
||||||
key_url: 'https://apt.llvm.org/llvm-snapshot.gpg.key'
|
|
||||||
packages:
|
|
||||||
- clang-9
|
|
||||||
- libc++-9-dev
|
|
||||||
- libc++abi-9-dev
|
|
||||||
env:
|
|
||||||
# Do not use ASAN with ubuntu's libc++: https://bugs.llvm.org/show_bug.cgi?id=17379
|
|
||||||
- CC='clang-9 -fsanitize=address'
|
|
||||||
- CXX='clang++-9 -fsanitize=address -stdlib=libc++'
|
|
||||||
- PART=1
|
|
||||||
|
|
||||||
- name: "Clang 9 libc++ and ASAN part 2"
|
|
||||||
stage: check
|
|
||||||
os: linux
|
|
||||||
dist: bionic
|
|
||||||
addons: *clang9
|
|
||||||
env:
|
|
||||||
# Do not use ASAN with ubuntu's libc++: https://bugs.llvm.org/show_bug.cgi?id=17379
|
|
||||||
- CC='clang-9 -fsanitize=address'
|
|
||||||
- CXX='clang++-9 -fsanitize=address -stdlib=libc++'
|
|
||||||
- PART=2
|
|
||||||
|
|
||||||
- name: "ICC"
|
|
||||||
stage: check
|
|
||||||
os: linux
|
|
||||||
compiler: icc
|
|
||||||
env:
|
|
||||||
- CC=icc
|
|
||||||
- CXX=icpc
|
|
||||||
install:
|
|
||||||
- source /opt/intel/inteloneapi/compiler/latest/env/vars.sh
|
|
||||||
addons:
|
|
||||||
apt:
|
|
||||||
sources:
|
|
||||||
- sourceline: 'deb https://apt.repos.intel.com/oneapi all main'
|
|
||||||
key_url: 'https://apt.repos.intel.com/intel-gpg-keys/GPG-PUB-KEY-INTEL-SW-PRODUCTS-2023.PUB'
|
|
||||||
packages:
|
|
||||||
- intel-oneapi-icc
|
|
||||||
|
|
||||||
## ----- ##
|
|
||||||
## GCC. ##
|
|
||||||
## ----- ##
|
|
||||||
|
|
||||||
- name: "GCC 8 with sanitizers part 1"
|
|
||||||
os: linux
|
|
||||||
dist: bionic
|
|
||||||
addons:
|
|
||||||
apt:
|
|
||||||
packages: g++-8
|
|
||||||
env:
|
|
||||||
- CC='gcc-8 -fsanitize=undefined,address -fno-omit-frame-pointer'
|
|
||||||
- CXX='g++-8 -fsanitize=undefined,address -fno-omit-frame-pointer'
|
|
||||||
- CONFIGUREFLAGS='CFLAGS=-O1 CXXFLAGS=-O1'
|
- CONFIGUREFLAGS='CFLAGS=-O1 CXXFLAGS=-O1'
|
||||||
- PART=1
|
- PART=1
|
||||||
|
|
||||||
@@ -250,7 +298,27 @@ jobs:
|
|||||||
## Clang. ##
|
## Clang. ##
|
||||||
## ------- ##
|
## ------- ##
|
||||||
|
|
||||||
- name: "Clang 8 -O3"
|
- name: "Clang 9 -O3"
|
||||||
|
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-9 main'
|
||||||
|
key_url: 'https://apt.llvm.org/llvm-snapshot.gpg.key'
|
||||||
|
packages:
|
||||||
|
- clang-9
|
||||||
|
- libc++-9-dev
|
||||||
|
- libc++abi-9-dev
|
||||||
|
env:
|
||||||
|
- CC='clang-9'
|
||||||
|
- CXX='clang++-9 -stdlib=libc++'
|
||||||
|
- CONFIGUREFLAGS='CPPFLAGS=-DNDEBUG CFLAGS=-O3 CXXFLAGS=-O3'
|
||||||
|
|
||||||
|
- name: "Clang 8"
|
||||||
stage: check
|
stage: check
|
||||||
os: linux
|
os: linux
|
||||||
dist: bionic
|
dist: bionic
|
||||||
@@ -263,7 +331,6 @@ jobs:
|
|||||||
env:
|
env:
|
||||||
- CC=clang-8
|
- CC=clang-8
|
||||||
- CXX='clang++-8 -stdlib=libc++'
|
- CXX='clang++-8 -stdlib=libc++'
|
||||||
- CONFIGUREFLAGS='CPPFLAGS=-DNDEBUG CFLAGS=-O3 CXXFLAGS=-O3'
|
|
||||||
|
|
||||||
- name: "Clang 7"
|
- name: "Clang 7"
|
||||||
stage: check
|
stage: check
|
||||||
@@ -437,11 +504,11 @@ script:
|
|||||||
- sudo apt-get install -qq doxygen flex m4
|
- sudo apt-get install -qq doxygen flex m4
|
||||||
# Install and activate dmd.
|
# Install and activate dmd.
|
||||||
- mkdir -p ~/dlang && wget https://dlang.org/install.sh -O ~/dlang/install.sh
|
- mkdir -p ~/dlang && wget https://dlang.org/install.sh -O ~/dlang/install.sh
|
||||||
- source $(source ~/dlang/install.sh dmd -a)
|
- source $(source ~/dlang/install.sh dmd -a) || true
|
||||||
|
|
||||||
- $CC --version
|
- $CC --version
|
||||||
- $CXX --version
|
- $CXX --version
|
||||||
- dmd --version
|
- dmd --version || true
|
||||||
- doxygen --version
|
- doxygen --version
|
||||||
- flex --version
|
- flex --version
|
||||||
- ld --version
|
- ld --version
|
||||||
|
|||||||
@@ -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
+16
-3
@@ -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
|
||||||
@@ -42,7 +42,7 @@ dependencies = $(BISON_IN) $(src_bison_SOURCES) $(dist_skeletons_DATA)
|
|||||||
BISON = $(top_builddir)/tests/bison
|
BISON = $(top_builddir)/tests/bison
|
||||||
BISON_IN = $(top_srcdir)/tests/bison.in
|
BISON_IN = $(top_srcdir)/tests/bison.in
|
||||||
YACC = $(BISON) -o y.tab.c
|
YACC = $(BISON) -o y.tab.c
|
||||||
AM_YFLAGS_WITH_LINES = --defines -Werror -Wall --report=all
|
AM_YFLAGS_WITH_LINES = --defines -Werror -Wall,dangling-alias --report=all
|
||||||
AM_YFLAGS = $(AM_YFLAGS_WITH_LINES) --no-lines
|
AM_YFLAGS = $(AM_YFLAGS_WITH_LINES) --no-lines
|
||||||
|
|
||||||
# Initialization before completion by local.mk's.
|
# Initialization before completion by local.mk's.
|
||||||
@@ -127,3 +127,16 @@ gen-ChangeLog:
|
|||||||
--since=$(gen_start_date) > $$cl.tmp && \
|
--since=$(gen_start_date) > $$cl.tmp && \
|
||||||
mv -f $$cl.tmp $$cl; \
|
mv -f $$cl.tmp $$cl; \
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# Useful to debug.
|
||||||
|
.c.i:
|
||||||
|
$(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/>.
|
||||||
|
|||||||
@@ -1,29 +1,52 @@
|
|||||||
This package contains the GNU Bison parser generator.
|
GNU Bison is a general-purpose parser generator that converts an annotated
|
||||||
|
context-free grammar into a deterministic LR or generalized LR (GLR) parser
|
||||||
|
employing LALR(1) parser tables. Bison can also generate IELR(1) or
|
||||||
|
canonical LR(1) parser tables. Once you are proficient with Bison, you can
|
||||||
|
use it to develop a wide range of language parsers, from those used in
|
||||||
|
simple desk calculators to complex programming languages.
|
||||||
|
|
||||||
|
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
|
||||||
|
use Bison with little trouble. You need to be fluent in C, C++ or Java
|
||||||
|
programming in order to use Bison.
|
||||||
|
|
||||||
|
Bison and the parsers it generates are portable, they do not require any
|
||||||
|
specific compilers.
|
||||||
|
|
||||||
|
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.
|
||||||
|
|
||||||
|
## Running a non installed bison
|
||||||
|
Once you ran `make`, you might want to toy with this fresh bison before
|
||||||
|
installing it. In that case, do not use `src/bison`: it would use the
|
||||||
|
*installed* files (skeletons, etc.), not the local ones. Use `tests/bison`.
|
||||||
|
|
||||||
## Colored diagnostics
|
## Colored diagnostics
|
||||||
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/gnu/gettext/libtextstyle-0.8.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.
|
||||||
@@ -40,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.
|
||||||
|
|
||||||
@@ -57,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
|
||||||
@@ -80,23 +110,9 @@ 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
|
||||||
Software Foundation, Inc.
|
LocalWords: MERCHANTABILITY GLR LALR IELR submodule init README src bw
|
||||||
|
LocalWords: Relocatability symlinks symlink
|
||||||
This file is part of GNU bison, the GNU Compiler Compiler.
|
|
||||||
|
|
||||||
This program is free software: you can redistribute it and/or modify
|
|
||||||
it under the terms of the GNU General Public License as published by
|
|
||||||
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:
|
Local Variables:
|
||||||
mode: markdown
|
mode: markdown
|
||||||
@@ -104,7 +120,16 @@ fill-column: 76
|
|||||||
ispell-dictionary: "american"
|
ispell-dictionary: "american"
|
||||||
End:
|
End:
|
||||||
|
|
||||||
LocalWords: parsers ngettext Texinfo pdf html YYYY ZZZZ ispell american
|
Copyright (C) 1992, 1998-1999, 2003-2005, 2008-2015, 2018-2021 Free
|
||||||
LocalWords: MERCHANTABILITY
|
Software Foundation, Inc.
|
||||||
|
|
||||||
|
This file is part of GNU 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.
|
||||||
|
|
||||||
-->
|
-->
|
||||||
|
|||||||
+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/>.
|
||||||
|
|||||||
+295
-229
@@ -2,47 +2,11 @@ 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
|
Working from the Repository
|
||||||
|
===========================
|
||||||
## 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.
|
|
||||||
|
|
||||||
## Horizontal tabs
|
|
||||||
Do not add horizontal tab characters to any file in Bison's repository
|
|
||||||
except where required. For example, do not use tabs to format C code.
|
|
||||||
However, make files, ChangeLog, and some regular expressions require tabs.
|
|
||||||
Also, test cases might need to contain tabs to check that Bison properly
|
|
||||||
processes tabs in its input.
|
|
||||||
|
|
||||||
|
|
||||||
# Working from the repository
|
|
||||||
|
|
||||||
These notes intend to help people working on the checked-out sources. These
|
These notes intend to help people working on the checked-out sources. These
|
||||||
requirements do not apply when building from a distribution tarball.
|
requirements do not apply when building from a distribution tarball.
|
||||||
@@ -55,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
|
||||||
@@ -92,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
|
||||||
@@ -174,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
|
||||||
@@ -185,7 +150,231 @@ These files don't change very often in Autoconf, so it should be relatively
|
|||||||
straight-forward to examine the differences in order to decide whether to
|
straight-forward to examine the differences in order to decide whether to
|
||||||
update.
|
update.
|
||||||
|
|
||||||
# Test Suite
|
## Troubleshooting
|
||||||
|
|
||||||
|
Bison is self-hosted: its parser is generated by Bison. We don't force
|
||||||
|
ourselves to use the previous release of Bison, we use the current git
|
||||||
|
master for several reasons:
|
||||||
|
- dogfooding: let Bison be its first user
|
||||||
|
- monitoring: seeing the diff on the generated parsers with git is very
|
||||||
|
helpful, as it allows to see easily the impact of the changes on a real
|
||||||
|
case parser.
|
||||||
|
|
||||||
|
If you are unlucky the generated files, src/parse-gram.[ch], may be older
|
||||||
|
than their source, src/parse-gram.y. And your current version of Bison
|
||||||
|
might not be able to grok it. In that case, first refresh the generated
|
||||||
|
files:
|
||||||
|
|
||||||
|
$ touch src/parse-gram.[ch]
|
||||||
|
|
||||||
|
Then proceed.
|
||||||
|
|
||||||
|
In case you wrecked your current copy of the parser, get back the previous
|
||||||
|
version, compile bison, then force it to recreate the files:
|
||||||
|
|
||||||
|
$ git checkout HEAD^ src/parse-gram.[ch]
|
||||||
|
$ make -C _build
|
||||||
|
$ touch src/parse-gram.y
|
||||||
|
$ 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.
|
||||||
|
|
||||||
|
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`.
|
||||||
|
|
||||||
|
## 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
|
||||||
|
==========
|
||||||
|
|
||||||
## make check
|
## make check
|
||||||
Consume without moderation. It is composed of two kinds of tests: the
|
Consume without moderation. It is composed of two kinds of tests: the
|
||||||
@@ -193,9 +382,9 @@ 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`).
|
||||||
|
|
||||||
### 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
|
||||||
@@ -255,7 +444,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
|
||||||
|
|
||||||
@@ -265,6 +454,37 @@ again, since some early failures may stop latter tests from being run. Yet
|
|||||||
at some point, you'll have to fix remaining issues by hand...
|
at some point, you'll have to fix remaining issues by hand...
|
||||||
|
|
||||||
|
|
||||||
|
## Running Java parsers
|
||||||
|
Use the `javaexec.sh` script. For instance to run the parser of test case
|
||||||
|
504:
|
||||||
|
|
||||||
|
$ 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 ASAN 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' \
|
||||||
|
CFLAGS='-ggdb' \
|
||||||
|
CXX='g++-mp-10.0 -fsanitize=address' \
|
||||||
|
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-local TESTSUITEFLAGS='-j5 -k cex' ASAN_OPTIONS=detect_leaks=1
|
||||||
|
|
||||||
## 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.
|
||||||
|
|
||||||
@@ -292,7 +512,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.
|
||||||
|
|
||||||
@@ -339,175 +559,17 @@ re-run the tests, run:
|
|||||||
./configure -C CC='gcc-mp-8 -fsanitize=undefined' CFLAGS='-ggdb'
|
./configure -C CC='gcc-mp-8 -fsanitize=undefined' CFLAGS='-ggdb'
|
||||||
make check
|
make check
|
||||||
|
|
||||||
# Release Procedure
|
|
||||||
This section needs to be updated to take into account features from gnulib.
|
|
||||||
In particular, be sure to read README-release.
|
|
||||||
|
|
||||||
## Update the submodules. See above.
|
|
||||||
|
|
||||||
## Update maintainer tools, such as Autoconf. See above.
|
Release Procedure
|
||||||
|
=================
|
||||||
|
|
||||||
## Try to get the *.pot files to the Translation Project at least one
|
See the [README-release file](README-release), created when the package is
|
||||||
week before a stable release, to give them time to translate them. Before
|
bootstrapped.
|
||||||
generating the *.pot files, make sure that po/POTFILES.in and
|
|
||||||
runtime-po/POTFILES.in list all files with translatable strings. This
|
|
||||||
helps: `grep -l '\<_(' *`.
|
|
||||||
|
|
||||||
## Tests
|
|
||||||
See above.
|
|
||||||
|
|
||||||
## Update the foreign files
|
|
||||||
Running `./bootstrap` in the top level should update them all for you. This
|
|
||||||
covers PO files too. Sometimes a PO file contains problems that causes it
|
|
||||||
to be rejected by recent Gettext releases; please report these to the
|
|
||||||
Translation Project.
|
|
||||||
|
|
||||||
## Update README
|
|
||||||
Make sure the information in README is current. Most notably, make sure it
|
|
||||||
recommends a version of GNU M4 that is compatible with the latest Bison
|
|
||||||
sources.
|
|
||||||
|
|
||||||
## Check copyright years.
|
|
||||||
We update years in copyright statements throughout Bison once at the start
|
|
||||||
of every year by running `make update-copyright`. However, before a
|
|
||||||
release, it's good to verify that it's actually been run. Besides the
|
|
||||||
copyright statement for each Bison file, check the copyright statements that
|
|
||||||
the skeletons insert into generated parsers, and check all occurrences of
|
|
||||||
`PACKAGE_COPYRIGHT_YEAR` in configure.ac.
|
|
||||||
|
|
||||||
## Update NEWS, commit and tag.
|
|
||||||
See do-release-commit-and-tag in README-release. For a while, we used beta
|
|
||||||
names such as `2.6_rc1`. Now that we use gnulib in the release procedure,
|
|
||||||
we must use `2.5.90`, which has the additional benefit of being properly
|
|
||||||
sorted in `git tag -l`.
|
|
||||||
|
|
||||||
## make alpha, beta, or stable
|
|
||||||
See README-release.
|
|
||||||
|
|
||||||
## Upload
|
|
||||||
There are two ways to upload the tarballs to the GNU servers: using gnupload
|
|
||||||
(from gnulib), or by hand. Obviously prefer the former. But in either
|
|
||||||
case, be sure to read the following paragraph.
|
|
||||||
|
|
||||||
### Setup
|
|
||||||
You need `gnupg`.
|
|
||||||
|
|
||||||
Make sure your public key has been uploaded at least to keys.gnupg.net. You
|
|
||||||
can upload it with:
|
|
||||||
|
|
||||||
gpg --keyserver keys.gnupg.net --send-keys F125BDF3
|
|
||||||
|
|
||||||
where F125BDF3 should be replaced with your key ID.
|
|
||||||
|
|
||||||
### Using gnupload
|
|
||||||
You need `ncftp`.
|
|
||||||
|
|
||||||
At the end `make stable` (or alpha/beta) will display the procedure to run.
|
|
||||||
Just copy and paste it in your shell.
|
|
||||||
|
|
||||||
### By hand
|
|
||||||
|
|
||||||
The generic GNU upload procedure is at
|
|
||||||
http://www.gnu.org/prep/maintain/maintain.html#Automated-FTP-Uploads.
|
|
||||||
|
|
||||||
Follow the instructions there to register your information so you're permitted
|
|
||||||
to upload.
|
|
||||||
|
|
||||||
Here's a brief reminder of how to roll the tarballs and upload them:
|
|
||||||
|
|
||||||
### make distcheck
|
|
||||||
### gpg -b bison-2.3b.tar.gz
|
|
||||||
### In a file named `bison-2.3b.tar.gz.directive`, type:
|
|
||||||
|
|
||||||
version: 1.1
|
|
||||||
directory: bison
|
|
||||||
filename: bison-2.3b.tar.gz
|
|
||||||
|
|
||||||
### gpg --clearsign bison-2.3b.tar.gz.directive
|
|
||||||
### ftp ftp-upload.gnu.org # Log in as anonymous.
|
|
||||||
### cd /incoming/alpha # cd /incoming/ftp for full release.
|
|
||||||
### put bison-2.3b.tar.gz # This can take a while.
|
|
||||||
### put bison-2.3b.tar.gz.sig
|
|
||||||
### put bison-2.3b.tar.gz.directive.asc
|
|
||||||
### Repeat all these steps for bison-2.3b.tar.xz.
|
|
||||||
|
|
||||||
## Update Bison manual on www.gnu.org.
|
|
||||||
|
|
||||||
The instructions below are obsolete, and left in case one would like to run
|
|
||||||
the commands by hand. Today, one just needs to run
|
|
||||||
|
|
||||||
$ make web-manual-update
|
|
||||||
|
|
||||||
See README-release.
|
|
||||||
|
|
||||||
### You need a non-anonymous checkout of the web pages directory.
|
|
||||||
|
|
||||||
$ cvs -d YOUR_USERID@cvs.savannah.gnu.org:/web/bison checkout bison
|
|
||||||
|
|
||||||
### Get familiar with the instructions for web page maintainers.
|
|
||||||
http://www.gnu.org/server/standards/readme_index.html
|
|
||||||
http://www.gnu.org/server/standards/README.software.html
|
|
||||||
especially the note about symlinks.
|
|
||||||
|
|
||||||
### Build the web pages.
|
|
||||||
Assuming BISON_CHECKOUT refers to a checkout of the Bison dir, and
|
|
||||||
BISON_WWW_CHECKOUT refers to the web directory created above, do:
|
|
||||||
|
|
||||||
$ cd $BISON_CHECKOUT/doc
|
|
||||||
$ make stamp-vti
|
|
||||||
$ ../build-aux/gendocs.sh -o "$BISON_WWW_CHECKOUT/manual" \
|
|
||||||
bison "Bison - GNU parser generator"
|
|
||||||
$ cd $BISON_WWW_CHECKOUT
|
|
||||||
|
|
||||||
Verify that the result looks sane.
|
|
||||||
|
|
||||||
### Commit the modified and the new files.
|
|
||||||
|
|
||||||
### Remove old files.
|
|
||||||
Find the files which have not been overwritten (because they belonged to
|
|
||||||
sections that have been removed or renamed):
|
|
||||||
|
|
||||||
$ cd manual/html_node
|
|
||||||
$ ls -lt
|
|
||||||
|
|
||||||
Remove these files and commit their removal to CVS. For each of these
|
|
||||||
files, add a line to the file .symlinks. This will ensure that hyperlinks
|
|
||||||
to the removed files will redirect to the entire manual; this is better than
|
|
||||||
a 404 error.
|
|
||||||
|
|
||||||
## Announce
|
|
||||||
The "make release" command just created a template,
|
|
||||||
`$HOME/announce-bison-X.Y`. Otherwise, to generate it, run:
|
|
||||||
|
|
||||||
make RELEASE_TYPE=alpha gpg_key_ID=F125BDF3 announcement
|
|
||||||
|
|
||||||
where alpha can be replaced by `beta` or `table` and F125BDF3 should be
|
|
||||||
replaced with your key ID.
|
|
||||||
|
|
||||||
Complete/fix the announcement file. The generated list of recipients
|
|
||||||
(info-gnu@gnu.org, bison-announce@gnu.org, bug-bison@gnu.org,
|
|
||||||
help-bison@gnu.org, bison-patches@gnu.org, and
|
|
||||||
coordinator@translationproject.org) is appropriate for a stable release or a
|
|
||||||
"serious beta". For any other release, drop at least info-gnu@gnu.org. For
|
|
||||||
an example of how to fill out the rest of the template, search the mailing
|
|
||||||
list archives for the most recent release announcement.
|
|
||||||
|
|
||||||
For a stable release, send the same announcement on the comp.compilers
|
|
||||||
newsgroup by sending email to compilers@iecc.com. Do not make any Cc as the
|
|
||||||
moderator will throw away anything cross-posted or Cc'ed. It really needs
|
|
||||||
to be a separate message.
|
|
||||||
|
|
||||||
## Prepare NEWS
|
|
||||||
So that developers don't accidentally add new items to the old NEWS entry,
|
|
||||||
create a new empty entry in line 3 (without the two leading spaces):
|
|
||||||
|
|
||||||
* Noteworthy changes in release ?.? (????-??-??) [?]
|
|
||||||
|
|
||||||
Push these changes.
|
|
||||||
|
|
||||||
<!--
|
<!--
|
||||||
|
|
||||||
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.
|
||||||
@@ -523,7 +585,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
|
||||||
@@ -536,9 +598,13 @@ LocalWords: submodule init cd distcheck ChangeLog valgrind sigreturn sudo
|
|||||||
LocalWords: UC gcc DGNULIB POSIXCHECK xml XSLT glr lalr README po runtime rc
|
LocalWords: UC gcc DGNULIB POSIXCHECK xml XSLT glr lalr README po runtime rc
|
||||||
LocalWords: gnupload gnupg gpg keyserver BDF ncftp filename clearsign cvs dir
|
LocalWords: gnupload gnupg gpg keyserver BDF ncftp filename clearsign cvs dir
|
||||||
LocalWords: symlinks vti html lt POSIX Cc'ed Graphviz Texinfo autoconf jN
|
LocalWords: symlinks vti html lt POSIX Cc'ed Graphviz Texinfo autoconf jN
|
||||||
LocalWords: automake autopoint graphviz texinfo PROG Wother parsers
|
LocalWords: automake autopoint graphviz texinfo PROG Wother parsers YYFOO
|
||||||
LocalWords: TESTSUITEFLAGS deprec struct gnulib's getopt config ggdb
|
LocalWords: TESTSUITEFLAGS deprec struct gnulib's getopt config ggdb yyfoo
|
||||||
LocalWords: bitset fsanitize symlink CFLAGS MERCHANTABILITY ispell
|
LocalWords: bitset fsanitize symlink CFLAGS MERCHANTABILITY ispell wrt YY
|
||||||
LocalWords: american
|
LocalWords: american Administrivia camlCase yy accessors namespace src hoc
|
||||||
|
LocalWords: getExpectedTokens yyexpectedTokens yygetExpectedTokens parens
|
||||||
|
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
|
||||||
|
|
||||||
-->
|
-->
|
||||||
|
|||||||
@@ -4,8 +4,10 @@ it is today without the invaluable help of these people:
|
|||||||
Aaro Koskinen [email protected]
|
Aaro Koskinen [email protected]
|
||||||
Аскар Сафин [email protected]
|
Аскар Сафин [email protected]
|
||||||
Adam Sampson [email protected]
|
Adam Sampson [email protected]
|
||||||
|
Adrian Vogelsgesang [email protected]
|
||||||
|
Ahcheong Lee [email protected]
|
||||||
Airy Andre [email protected]
|
Airy Andre [email protected]
|
||||||
Akim Demaille akim@lrde.epita.fr
|
Akim Demaille akim@gnu.org
|
||||||
Albert Chin-A-Young [email protected]
|
Albert Chin-A-Young [email protected]
|
||||||
Alexander Belopolsky [email protected]
|
Alexander Belopolsky [email protected]
|
||||||
Alexandre Duret-Lutz [email protected]
|
Alexandre Duret-Lutz [email protected]
|
||||||
@@ -18,6 +20,7 @@ Anthony Heading [email protected]
|
|||||||
Antonio Silva Correia [email protected]
|
Antonio Silva Correia [email protected]
|
||||||
Arnold Robbins [email protected]
|
Arnold Robbins [email protected]
|
||||||
Art Haas [email protected]
|
Art Haas [email protected]
|
||||||
|
Arthur Schwarz [email protected]
|
||||||
Askar Safin [email protected]
|
Askar Safin [email protected]
|
||||||
Balázs Scheidler [email protected]
|
Balázs Scheidler [email protected]
|
||||||
Baron Schwartz [email protected]
|
Baron Schwartz [email protected]
|
||||||
@@ -42,6 +45,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]
|
||||||
@@ -55,11 +59,14 @@ Derek M. Jones [email protected]
|
|||||||
Di-an Jan [email protected]
|
Di-an Jan [email protected]
|
||||||
Dick Streefland [email protected]
|
Dick Streefland [email protected]
|
||||||
Didier Godefroy [email protected]
|
Didier Godefroy [email protected]
|
||||||
|
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]
|
||||||
Eric S. Raymond [email protected]
|
Eric S. Raymond [email protected]
|
||||||
Étienne Renault [email protected]
|
Étienne Renault [email protected]
|
||||||
|
Evan Lavelle [email protected]
|
||||||
Evan Nemerson [email protected]
|
Evan Nemerson [email protected]
|
||||||
Evgeny Stambulchik [email protected]
|
Evgeny Stambulchik [email protected]
|
||||||
Fabrice Bauzac [email protected]
|
Fabrice Bauzac [email protected]
|
||||||
@@ -78,6 +85,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]
|
||||||
@@ -98,14 +106,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]
|
||||||
@@ -151,11 +162,13 @@ Petr Machata [email protected]
|
|||||||
Pho [email protected]
|
Pho [email protected]
|
||||||
Piotr Gackiewicz [email protected]
|
Piotr Gackiewicz [email protected]
|
||||||
Piotr Marcińczyk [email protected]
|
Piotr Marcińczyk [email protected]
|
||||||
|
Pramod Kumbhar [email protected]
|
||||||
Quentin Hocquet [email protected]
|
Quentin Hocquet [email protected]
|
||||||
Quoc Peyrot [email protected]
|
Quoc Peyrot [email protected]
|
||||||
R Blake [email protected]
|
R Blake [email protected]
|
||||||
Raja R Harinath [email protected]
|
Raja R Harinath [email protected]
|
||||||
Ralf Wildenhues [email protected]
|
Ralf Wildenhues [email protected]
|
||||||
|
Ryan [email protected]
|
||||||
Rich Wilson [email protected]
|
Rich Wilson [email protected]
|
||||||
Richard Stallman [email protected]
|
Richard Stallman [email protected]
|
||||||
Rici Lake [email protected]
|
Rici Lake [email protected]
|
||||||
@@ -174,6 +187,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]
|
||||||
@@ -207,6 +221,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]
|
||||||
@@ -222,7 +237,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.
|
||||||
|
|
||||||
@@ -237,4 +252,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,121 +1,166 @@
|
|||||||
* Bison 3.6
|
* Soon
|
||||||
|
** gnulib
|
||||||
|
Bruno notes:
|
||||||
|
|
||||||
|
> I haven't looked deeply, but it strikes me that gnulib/lib/bitset/array.c
|
||||||
|
> does not make use of the 'ffsl' function, nor or the 'integer_length_l'
|
||||||
|
> function. Maybe because in Bison, all bitsets are so dense that it does
|
||||||
|
> not give a performance advantage?
|
||||||
|
|
||||||
|
** 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
|
||||||
|
- How about not evaluating incomplete lines when the text is not finished
|
||||||
|
(as shells do).
|
||||||
|
|
||||||
|
** Questions
|
||||||
|
*** Java
|
||||||
|
- Should i18n be part of the Lexer? Currently it's a static method of
|
||||||
|
Lexer.
|
||||||
|
|
||||||
|
- is there a migration path that would allow to use TokenKinds in
|
||||||
|
yylex?
|
||||||
|
|
||||||
|
- define the tokens as an enum too.
|
||||||
|
|
||||||
|
- promote YYEOF rather than EOF.
|
||||||
|
|
||||||
|
** YYerror
|
||||||
|
https://git.savannah.gnu.org/gitweb/?p=gettext.git;a=blob;f=gettext-runtime/intl/plural.y;h=a712255af4f2f739c93336d4ff6556d932a426a5;hb=HEAD
|
||||||
|
|
||||||
|
should be updated to not use YYERRCODE. Returning an undef token is good
|
||||||
|
enough.
|
||||||
|
|
||||||
|
** Java
|
||||||
|
*** calc.at
|
||||||
|
Stop hard-coding "Calc". Adjust local.at (look for FIXME).
|
||||||
|
|
||||||
|
** 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 over-quotation issues.
|
||||||
|
|
||||||
** doc
|
** doc
|
||||||
I feel its 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.
|
||||||
|
|
||||||
Also, we seem to teach YYPRINT very early on, although it should be
|
|
||||||
considered deprecated: %printer is superior.
|
|
||||||
|
|
||||||
** improve syntax errors (UTF-8, internationalization)
|
|
||||||
Bison depends on the current locale. For instance:
|
|
||||||
|
|
||||||
%define parse.error verbose
|
|
||||||
%code top {
|
|
||||||
#include <stdio.h>
|
|
||||||
#include <stdlib.h>
|
|
||||||
void yyerror(const char* msg) { fprintf(stderr, "%s\n", msg); }
|
|
||||||
int yylex() { return 0; }
|
|
||||||
}
|
|
||||||
%%
|
|
||||||
exp: "↦" | "🎅🐃" | '\n'
|
|
||||||
%%
|
|
||||||
int main() { return yyparse(); }
|
|
||||||
|
|
||||||
gives different results with/without LC_ALL=C.
|
|
||||||
|
|
||||||
$ LC_ALL=C /opt/local/bin/bison /tmp/mangle.y -o ascii.c
|
|
||||||
$ /opt/local/bin/bison /tmp/mangle.y -o utf8.c
|
|
||||||
$ diff -u ascii.c utf8.c -I#line
|
|
||||||
--- ascii.c 2019-01-12 08:15:35.878010093 +0100
|
|
||||||
+++ utf8.c 2019-01-12 08:15:38.856495929 +0100
|
|
||||||
@@ -415,9 +415,8 @@
|
|
||||||
First, the terminals, then, starting at YYNTOKENS, nonterminals. */
|
|
||||||
static const char *const yytname[] =
|
|
||||||
{
|
|
||||||
- "$end", "error", "$undefined", "\"\\342\\206\\246\"",
|
|
||||||
- "\"\\360\\237\\216\\205\\360\\237\\220\\203\"", "'\\n'", "$accept",
|
|
||||||
- "exp", YY_NULLPTR
|
|
||||||
+ "$end", "error", "$undefined", "\"↦\"", "\"🎅🐃\"", "'\\n'",
|
|
||||||
+ "$accept", "exp", YY_NULLPTR
|
|
||||||
};
|
|
||||||
#endif
|
|
||||||
|
|
||||||
$ gcc ascii.c -o ascii && ./ascii
|
|
||||||
syntax error, unexpected $end, expecting "\342\206\246" or "\360\237\216\205\360\237\220\203" or '\n'
|
|
||||||
$ gcc utf8.c -o utf8 && ./utf8
|
|
||||||
syntax error, unexpected $end, expecting ↦ or 🎅🐃 or '\n'
|
|
||||||
|
|
||||||
|
|
||||||
While at it, we should stop using "$end" by default, in favor of "end of
|
|
||||||
file", or "end of input", whatever. See how lalr1.java does that.
|
|
||||||
|
|
||||||
** consistency
|
** consistency
|
||||||
token vs terminal, variable vs non terminal.
|
token vs terminal.
|
||||||
|
|
||||||
** Stop indentation in diagnostics
|
|
||||||
Before Bison 2.7, we printed "flatly" the dependencies in long diagnostics:
|
|
||||||
|
|
||||||
input.y:2.7-12: %type redeclaration for exp
|
|
||||||
input.y:1.7-12: previous declaration
|
|
||||||
|
|
||||||
In Bison 2.7, we indented them
|
|
||||||
|
|
||||||
input.y:2.7-12: error: %type redeclaration for exp
|
|
||||||
input.y:1.7-12: previous declaration
|
|
||||||
|
|
||||||
Later we quoted the source in the diagnostics, and today we have:
|
|
||||||
|
|
||||||
/tmp/foo.y:1.12-14: warning: symbol FOO redeclared [-Wother]
|
|
||||||
1 | %token FOO FOO
|
|
||||||
| ^~~
|
|
||||||
/tmp/foo.y:1.8-10: previous declaration
|
|
||||||
1 | %token FOO FOO
|
|
||||||
| ^~~
|
|
||||||
|
|
||||||
The indentation is no longer helping. We should probably get rid of it, or
|
|
||||||
maybe keep it only when -fno-caret. GCC displays this as a "note":
|
|
||||||
|
|
||||||
$ g++-mp-9 -Wall /tmp/foo.c -c
|
|
||||||
/tmp/foo.c:1:10: error: redefinition of 'int foo'
|
|
||||||
1 | int foo, foo;
|
|
||||||
| ^~~
|
|
||||||
/tmp/foo.c:1:5: note: 'int foo' previously declared here
|
|
||||||
1 | int foo, foo;
|
|
||||||
| ^~~
|
|
||||||
|
|
||||||
Likewise for Clang, contrary to what I believed (because "note:" is written
|
|
||||||
in black, so it doesn't show in my terminal :-)
|
|
||||||
|
|
||||||
$ clang++-mp-8.0 -Wall /tmp/foo.c -c
|
|
||||||
clang: warning: treating 'c' input as 'c++' when in C++ mode, this behavior is deprecated [-Wdeprecated]
|
|
||||||
/tmp/foo.c:1:10: error: redefinition of 'foo'
|
|
||||||
int foo, foo;
|
|
||||||
^
|
|
||||||
/tmp/foo.c:1:5: note: previous definition is here
|
|
||||||
int foo, foo;
|
|
||||||
^
|
|
||||||
1 error generated.
|
|
||||||
|
|
||||||
See also the item "Complaint submessage indentation" below.
|
|
||||||
|
|
||||||
** api.token.raw
|
** api.token.raw
|
||||||
Maybe we should exhibit the YYUNDEFTOK token. It could also be assigned a
|
The YYUNDEFTOK could be assigned a semantic value so that yyerror could be
|
||||||
semantic value so that yyerror could be used to report invalid lexemes.
|
used to report invalid lexemes.
|
||||||
See also the item "$undefined" below.
|
|
||||||
|
|
||||||
** C++
|
** push parsers
|
||||||
Move to int everywhere instead of unsigned? stack_size, etc. The parser
|
Consider deprecating impure push parsers. They add a lot of complexity, for
|
||||||
itself uses int (for yylen for instance), yet stack is based on size_t.
|
a bad feature. On the other hand, that would make it much harder to sit
|
||||||
|
push parsers on top of pull parser. Which is currently not relevant, since
|
||||||
|
push parsers are measurably slower.
|
||||||
|
|
||||||
Maybe locations should also move to ints.
|
** %define parse.error formatted
|
||||||
|
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
|
||||||
|
providing the message formats? Currently in bistro, it reads:
|
||||||
|
|
||||||
Paul Eggert already covered most of this. But before publishing these
|
const char *
|
||||||
changes, we need to ask our C++ users if they agree with that change, or if
|
error_format_string (int argc)
|
||||||
we need some migration path. Could be a %define variable, or simply
|
{
|
||||||
%require "3.5".
|
switch (argc)
|
||||||
|
{
|
||||||
|
default: /* Avoid compiler warnings. */
|
||||||
|
case 0: return _("%@: syntax error");
|
||||||
|
case 1: return _("%@: syntax error: unexpected %u");
|
||||||
|
// TRANSLATORS: '%@' is a location in a file, '%u' is an
|
||||||
|
// "unexpected token", and '%0e', '%1e'... are expected tokens
|
||||||
|
// at this point.
|
||||||
|
//
|
||||||
|
// For instance on the expression "1 + * 2", you'd get
|
||||||
|
//
|
||||||
|
// 1.5: syntax error: expected - or ( or number or function or variable before *
|
||||||
|
case 2: return _("%@: syntax error: expected %0e before %u");
|
||||||
|
case 3: return _("%@: syntax error: expected %0e or %1e before %u");
|
||||||
|
case 4: return _("%@: syntax error: expected %0e or %1e or %2e before %u");
|
||||||
|
case 5: return _("%@: syntax error: expected %0e or %1e or %2e or %3e before %u");
|
||||||
|
case 6: return _("%@: syntax error: expected %0e or %1e or %2e or %3e or %4e before %u");
|
||||||
|
case 7: return _("%@: syntax error: expected %0e or %1e or %2e or %3e or %4e or %5e before %u");
|
||||||
|
case 8: return _("%@: syntax error: expected %0e or %1e or %2e or %3e or %4e or %5e or %6e before %u");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
The message would have to be generated in a string, and pushed to yyerror.
|
||||||
|
Which will be a pain in the neck in yacc.c.
|
||||||
|
|
||||||
|
If we want to do that, we should think very carefully about the syntax of
|
||||||
|
the format string.
|
||||||
|
|
||||||
|
** yyclearin does not invoke the lookahead token's %destructor
|
||||||
|
https://lists.gnu.org/r/bug-bison/2018-02/msg00000.html
|
||||||
|
Rici:
|
||||||
|
|
||||||
|
> Modifying yyclearin so that it calls yydestruct seems like the simplest
|
||||||
|
> solution to this issue, but it is conceivable that such a change would
|
||||||
|
> break programs which already perform some kind of workaround in order to
|
||||||
|
> destruct the lookahead symbol. So it might be necessary to use some kind of
|
||||||
|
> compatibility %define, or to create a new replacement macro with a
|
||||||
|
> different name such as yydiscardin.
|
||||||
|
>
|
||||||
|
> At a minimum, the fact that yyclearin does not invoke the %destructor
|
||||||
|
> should be highlighted in the documentation, since it is not at all obvious.
|
||||||
|
|
||||||
|
** Issues in i18n
|
||||||
|
|
||||||
|
Les catégories d'avertissements incluent :
|
||||||
|
conflicts-sr conflits S/R (activé par défaut)
|
||||||
|
conflicts-rr conflits R/R (activé par défaut)
|
||||||
|
dangling-alias l'alias chaîne n'est pas attaché à un symbole
|
||||||
|
deprecated construction obsolète
|
||||||
|
empty-rule règle vide sans %empty
|
||||||
|
midrule-values valeurs de règle intermédiaire non définies ou inutilisées
|
||||||
|
precedence priorité et associativité inutiles
|
||||||
|
yacc incompatibilités avec POSIX Yacc
|
||||||
|
other tous les autres avertissements (activé par défaut)
|
||||||
|
all tous les avertissements sauf « dangling-alias » et « yacc »
|
||||||
|
no-CATEGORY désactiver les avertissements dans CATEGORIE
|
||||||
|
none désactiver tous les avertissements
|
||||||
|
error[=CATEGORY] traiter les avertissements comme des erreurs
|
||||||
|
|
||||||
|
Line -1 and -3 should mention CATEGORIE, not CATEGORY.
|
||||||
|
|
||||||
|
* Bison 3.8
|
||||||
|
** Rewrite glr.cc
|
||||||
|
Get rid of scaffolding in glr.c.
|
||||||
|
|
||||||
* Bison 3.7
|
|
||||||
** 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.,
|
||||||
@@ -158,18 +203,292 @@ 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.
|
||||||
|
|
||||||
|
* 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.
|
||||||
|
|
||||||
|
** Rename the D example
|
||||||
|
Move the current content of examples/d into examples/d/simple.
|
||||||
|
|
||||||
|
** Create a second example
|
||||||
|
Duplicate examples/d/simple into examples/d/calc.
|
||||||
|
|
||||||
|
** Add location tracking to d/calc
|
||||||
|
Look at the examples in the other languages to see how to do that.
|
||||||
|
|
||||||
|
** yysymbol_name
|
||||||
|
The SymbolKind is an enum. For a given SymbolKind we want to get its string
|
||||||
|
representation. Currently it's a separate table in the parser that does
|
||||||
|
that:
|
||||||
|
|
||||||
|
/* Symbol kinds. */
|
||||||
|
public enum SymbolKind
|
||||||
|
{
|
||||||
|
S_YYEMPTY = -2, /* No symbol. */
|
||||||
|
S_YYEOF = 0, /* "end of file" */
|
||||||
|
S_YYerror = 1, /* error */
|
||||||
|
S_YYUNDEF = 2, /* "invalid token" */
|
||||||
|
S_EQ = 3, /* "=" */
|
||||||
|
...
|
||||||
|
S_input = 14, /* input */
|
||||||
|
S_line = 15, /* line */
|
||||||
|
S_exp = 16, /* exp */
|
||||||
|
};
|
||||||
|
|
||||||
|
...
|
||||||
|
|
||||||
|
/* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
|
||||||
|
First, the terminals, then, starting at \a yyntokens_, nonterminals. */
|
||||||
|
private static immutable string[] yytname_ =
|
||||||
|
[
|
||||||
|
"\"end of file\"", "error", "\"invalid token\"", "\"=\"", "\"+\"",
|
||||||
|
"\"-\"", "\"*\"", "\"/\"", "\"(\"", "\")\"", "\"end of line\"",
|
||||||
|
"\"number\"", "UNARY", "$accept", "input", "line", "exp", null
|
||||||
|
];
|
||||||
|
|
||||||
|
...
|
||||||
|
|
||||||
|
So to get a symbol kind, one runs `yytname_[yykind]`.
|
||||||
|
|
||||||
|
Is there a way to attach this conversion to string to SymbolKind? In Java
|
||||||
|
for instance, we have:
|
||||||
|
|
||||||
|
public enum SymbolKind
|
||||||
|
{
|
||||||
|
S_YYEOF(0), /* "end of file" */
|
||||||
|
S_YYerror(1), /* error */
|
||||||
|
S_YYUNDEF(2), /* "invalid token" */
|
||||||
|
...
|
||||||
|
S_input(16), /* input */
|
||||||
|
S_line(17), /* line */
|
||||||
|
S_exp(18); /* exp */
|
||||||
|
|
||||||
|
private final int yycode_;
|
||||||
|
|
||||||
|
SymbolKind (int n) {
|
||||||
|
this.yycode_ = n;
|
||||||
|
}
|
||||||
|
...
|
||||||
|
/* YYNAMES_[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
|
||||||
|
First, the terminals, then, starting at \a YYNTOKENS_, nonterminals. */
|
||||||
|
private static final String[] yynames_ = yynames_init();
|
||||||
|
private static final String[] yynames_init()
|
||||||
|
{
|
||||||
|
return new String[]
|
||||||
|
{
|
||||||
|
i18n("end of file"), i18n("error"), i18n("invalid token"), "!", "+", "-", "*",
|
||||||
|
"/", "^", "(", ")", "=", i18n("end of line"), i18n("number"), "NEG",
|
||||||
|
"$accept", "input", "line", "exp", null
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
/* The user-facing name of this symbol. */
|
||||||
|
public final String getName() {
|
||||||
|
return yynames_[yycode_];
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
which allows to write more naturally `yykind.getName()` rather than
|
||||||
|
`yytname_[yykind]`. Is there something comparable in (idiomatic) D?
|
||||||
|
|
||||||
|
** Change the return value of yylex
|
||||||
|
Historically people were allowed to return any int from the scanner (which
|
||||||
|
is convenient and allows `return '+'` from the scanner). Akim tends to see
|
||||||
|
this as an error, we should restrict the return values to TokenKind (not to
|
||||||
|
be confused with SymbolKind).
|
||||||
|
|
||||||
|
In the case of D, without the history, we have the choice to support or not
|
||||||
|
`int`. If we want to _keep_ `int`, is there a way, say via introspection,
|
||||||
|
to support both signatures of yylex? If we don't keep `int`, just move to
|
||||||
|
TokenKind.
|
||||||
|
|
||||||
|
** Documentation
|
||||||
|
Write documentation about D support in doc/bison.texi. Imitate the Java
|
||||||
|
documentation. You should be more succinct IMHO.
|
||||||
|
|
||||||
|
** Complete Symbols
|
||||||
|
The current interface from the scanner to the parser is somewhat clumsy: the
|
||||||
|
token kind is returned by yylex, but the value and location are stored in
|
||||||
|
the scanner. This reflects the fact that the implementation of the parser
|
||||||
|
uses three variables to deal with each parsed symbol: its kind, its value,
|
||||||
|
its location.
|
||||||
|
|
||||||
|
So today the scanner of examples/d/calc.d (no locations) looks like:
|
||||||
|
|
||||||
|
if (input.front.isNumber)
|
||||||
|
{
|
||||||
|
import std.conv : parse;
|
||||||
|
semanticVal_.ival = input.parse!int;
|
||||||
|
return TokenKind.NUM;
|
||||||
|
}
|
||||||
|
|
||||||
|
and the generated parser:
|
||||||
|
|
||||||
|
/* Read a lookahead token. */
|
||||||
|
if (yychar == TokenKind.YYEMPTY)
|
||||||
|
{
|
||||||
|
yychar = yylex ();
|
||||||
|
yylval = yylexer.semanticVal;
|
||||||
|
}
|
||||||
|
|
||||||
|
The parser class should feature a `Symbol` type which binds together kind,
|
||||||
|
value and location, and the scanner should be able to return an instance of
|
||||||
|
that type. Something like
|
||||||
|
|
||||||
|
if (input.front.isNumber)
|
||||||
|
{
|
||||||
|
import std.conv : parse;
|
||||||
|
return parser.Symbol (TokenKind.NUM, input.parse!int);
|
||||||
|
}
|
||||||
|
|
||||||
|
** Token Constructors
|
||||||
|
In the previous example it is possible to mix incorrectly kinds and values,
|
||||||
|
and for instance:
|
||||||
|
|
||||||
|
return parser.Symbol (TokenKind.NUM, "Hello, World!\n");
|
||||||
|
|
||||||
|
attaches a string value to NUM kind (wrong, of course). When
|
||||||
|
api.token.constructor is set, in C++, Bison generated "token constructors":
|
||||||
|
parser.make_NUM. parser.make_PLUS, parser.make_STRING, etc. The previous
|
||||||
|
example becomes
|
||||||
|
|
||||||
|
return parser.make_NUM ("Hello, World!\n");
|
||||||
|
|
||||||
|
which would easily be caught by the type checker.
|
||||||
|
|
||||||
|
** Lookahead Correction
|
||||||
|
Add support for LAC to the D skeleton. It should not be too hard: look how
|
||||||
|
this is done in lalr1.cc, and mock it.
|
||||||
|
|
||||||
|
** Push Parser
|
||||||
|
Add support for push parser. Do not start a nice skeleton, just enhance the
|
||||||
|
current one to support push parsers. This is going to be a tougher nut to
|
||||||
|
crack.
|
||||||
|
|
||||||
|
First, you need to understand well how the push parser is expected to work.
|
||||||
|
To this end:
|
||||||
|
- read the doc
|
||||||
|
- look at examples/c/pushcalc
|
||||||
|
- create an example of a Java push parser.
|
||||||
|
- have a look at the generated parser in Java, which has the advantage of
|
||||||
|
being already based on a parser object, instead of just a function.
|
||||||
|
|
||||||
|
The C case is harder to read, but it may help too. Keep in mind that
|
||||||
|
because there's no object to maintain state, the C push parser uses some
|
||||||
|
struct (yypstate) to preserve this state. We don't need this in D, the
|
||||||
|
parser object will suffice.
|
||||||
|
|
||||||
|
I think working directly on the skeleton to add push-parser support is not
|
||||||
|
the simplest path. I suggest that you (1) transform a generated parser into
|
||||||
|
a push parser by hand, and then (2) transform lalr1.d to generate such a
|
||||||
|
parser.
|
||||||
|
|
||||||
|
Use `git commit` frequently to make sure you keep track of your progress.
|
||||||
|
|
||||||
|
*** (1.a) Prepare pull parser by hand
|
||||||
|
Copy again one of the D examples into say examples/d/pushcalc. Also
|
||||||
|
check-in the generated parser to facilitate experimentation.
|
||||||
|
|
||||||
|
- find local variables of yyparse should become members of the parser object
|
||||||
|
(so that we preserve state from one call to the next).
|
||||||
|
|
||||||
|
- do it in your generated D parser. We don't need an equivalent for
|
||||||
|
yypstate, because we already have it: that the parser object itself.
|
||||||
|
|
||||||
|
- have your *pull*-parser (i.e., the good old yy::parser::parse()) work
|
||||||
|
properly this way. Write and run tests. That's one of the reasons I
|
||||||
|
suggest using examples/d/calc as a starting point: it already has tests,
|
||||||
|
you can/should add more.
|
||||||
|
|
||||||
|
At this point you have a pull-parser which you prepared to turn into a
|
||||||
|
push-parser.
|
||||||
|
|
||||||
|
*** (1.b) Turn pull parser into push parser by hand
|
||||||
|
|
||||||
|
- look again at how push parsers are implemented in Java/C to see what needs
|
||||||
|
to change in yyparse so that the control is inverted: parse() will
|
||||||
|
be *given* the tokens, instead of having to call yylex itself. When I say
|
||||||
|
"look at C", I think your best option are (i) yacc.c (look for b4_push_if)
|
||||||
|
and (ii) examples/c/pushcalc.
|
||||||
|
|
||||||
|
- rename parse() as push_parse(Symbol yyla) (or push_parse(TokenKind, Value,
|
||||||
|
Location)) that takes the symbol as argument. That's the push parser we
|
||||||
|
are looking for.
|
||||||
|
|
||||||
|
- define a new parse() function which has the same signature as the usual
|
||||||
|
pull-parser, that repeatedly calls the push_parse function. Something
|
||||||
|
like this:
|
||||||
|
|
||||||
|
int parse ()
|
||||||
|
{
|
||||||
|
int status = 0;
|
||||||
|
do {
|
||||||
|
status = this->push_parse (yylex());
|
||||||
|
} while (status == YYPUSH_MORE);
|
||||||
|
return status;
|
||||||
|
}
|
||||||
|
|
||||||
|
- show me that parser, so that we can validate the approach.
|
||||||
|
|
||||||
|
*** (2) Port that into the skeleton
|
||||||
|
- once we agree on the API of the push parser, implement it into lalr1.d.
|
||||||
|
You will probaby need help on this regard, but imitation, again, should
|
||||||
|
help.
|
||||||
|
|
||||||
|
- have example/d/pushcalc work properly and pass tests
|
||||||
|
|
||||||
|
- add tests in the "real" test suite. Do that in tests/calc.at. I can
|
||||||
|
help.
|
||||||
|
|
||||||
|
- document
|
||||||
|
|
||||||
|
** 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
|
||||||
|
The users are not provided with enough tools to forge their error messages.
|
||||||
|
See for instance "Is there an option to change the message produced by
|
||||||
|
YYERROR_VERBOSE?" by Simon Sobisch, on bison-help.
|
||||||
|
|
||||||
|
See also
|
||||||
|
https://www.cs.tufts.edu/~nr/cs257/archive/clinton-jefferey/lr-error-messages.pdf
|
||||||
|
https://research.swtch.com/yyerror
|
||||||
|
http://gallium.inria.fr/~fpottier/publis/fpottier-reachability-cc2016.pdf
|
||||||
|
|
||||||
* Modernization
|
* Modernization
|
||||||
Fix data/skeletons/yacc.c so that it defines YYPTRDIFF_T properly for modern
|
Fix data/skeletons/yacc.c so that it defines YYPTRDIFF_T properly for modern
|
||||||
and older C++ compilers. Currently the code defaults to defining it to
|
and older C++ compilers. Currently the code defaults to defining it to
|
||||||
@@ -177,12 +496,12 @@ 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.
|
||||||
|
|
||||||
- push parsers: glr.cc, lalr1.cc
|
- lac: D, Java (easy)
|
||||||
- ielr: C++ and Java
|
- push parsers: glr.c, glr.cc, lalr1.cc (not very difficult)
|
||||||
- glr: Java
|
- token constructors: Java, C, D (a bit difficult)
|
||||||
- token constructors: Java and C
|
- glr: D, Java (super difficult)
|
||||||
|
|
||||||
* Bugs
|
* Bugs
|
||||||
** Autotest has quotation issues
|
** Autotest has quotation issues
|
||||||
@@ -198,8 +517,8 @@ $ ./tests/testsuite -l | grep errors | sed q
|
|||||||
Besides yytoknum is wrong when api.token.raw is defined.
|
Besides yytoknum is wrong when api.token.raw is defined.
|
||||||
|
|
||||||
** Better design for diagnostics
|
** Better design for diagnostics
|
||||||
The current implementation of diagnostics is adhoc, it grew organically. It
|
The current implementation of diagnostics is ad hoc, it grew organically.
|
||||||
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
|
||||||
latter calls on the former. For instance:
|
latter calls on the former. For instance:
|
||||||
|
|
||||||
complain (&sym->location,
|
complain (&sym->location,
|
||||||
@@ -247,7 +566,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?
|
||||||
@@ -314,52 +633,7 @@ 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.
|
||||||
|
|
||||||
** YYERRCODE
|
** yychar == YYEMPTY
|
||||||
Defined to 256, but not used, not documented. Probably the token
|
|
||||||
number for the error token, which POSIX wants to be 256, but which
|
|
||||||
Bison might renumber if the user used number 256. Keep fix and doc?
|
|
||||||
Throw away?
|
|
||||||
|
|
||||||
Also, why don't we output the token name of the error token in the
|
|
||||||
output? It is explicitly skipped:
|
|
||||||
|
|
||||||
/* Skip error token and tokens without identifier. */
|
|
||||||
if (sym != errtoken && id)
|
|
||||||
|
|
||||||
Of course there are issues with name spaces, but if we disable we have
|
|
||||||
something which seems to be more simpler and more consistent instead
|
|
||||||
of the special case YYERRCODE.
|
|
||||||
|
|
||||||
enum yytokentype {
|
|
||||||
error = 256,
|
|
||||||
// ...
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
We could (should?) also treat the case of the undef_token, which is
|
|
||||||
numbered 257 for yylex, and 2 internal. Both appear for instance in
|
|
||||||
toknum:
|
|
||||||
|
|
||||||
const unsigned short
|
|
||||||
parser::yytoken_number_[] =
|
|
||||||
{
|
|
||||||
0, 256, 257, 258, 259, 260, 261, 262, 263, 264,
|
|
||||||
|
|
||||||
while here
|
|
||||||
|
|
||||||
enum yytokentype {
|
|
||||||
TOK_EOF = 0,
|
|
||||||
TOK_EQ = 258,
|
|
||||||
|
|
||||||
so both 256 and 257 are "mysterious".
|
|
||||||
|
|
||||||
const char*
|
|
||||||
const parser::yytname_[] =
|
|
||||||
{
|
|
||||||
"\"end of command\"", "error", "$undefined", "\"=\"", "\"break\"",
|
|
||||||
|
|
||||||
|
|
||||||
** yychar == yyempty_
|
|
||||||
The code in yyerrlab reads:
|
The code in yyerrlab reads:
|
||||||
|
|
||||||
if (yychar <= YYEOF)
|
if (yychar <= YYEOF)
|
||||||
@@ -391,14 +665,6 @@ We need trustworthy benchmarks for Bison, for all our backends. Akim has a
|
|||||||
few things scattered around; we need to put them in the repo, and make them
|
few things scattered around; we need to put them in the repo, and make them
|
||||||
more useful.
|
more useful.
|
||||||
|
|
||||||
** yysyntax_error
|
|
||||||
The code bw glr.c and yacc.c is really alike, we can certainly factor
|
|
||||||
some parts.
|
|
||||||
|
|
||||||
This should be worked on when we also address the expected improvements for
|
|
||||||
error generation (e.g., i18n).
|
|
||||||
|
|
||||||
|
|
||||||
* Report
|
* Report
|
||||||
|
|
||||||
** Figures
|
** Figures
|
||||||
@@ -425,17 +691,16 @@ 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?
|
||||||
|
Well, only if there is really some demand for it.
|
||||||
|
|
||||||
|
*** PHP
|
||||||
|
https://github.com/scfc/bison-php/blob/master/data/lalr1.php
|
||||||
|
|
||||||
|
*** Python
|
||||||
|
https://lists.gnu.org/r/bison-patches/2013-09/msg00000.html and following
|
||||||
|
|
||||||
** Multiple start symbols
|
** Multiple start symbols
|
||||||
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
|
||||||
@@ -458,21 +723,12 @@ 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.
|
||||||
|
|
||||||
** Better error messages
|
|
||||||
The users are not provided with enough tools to forge their error messages.
|
|
||||||
See for instance "Is there an option to change the message produced by
|
|
||||||
YYERROR_VERBOSE?" by Simon Sobisch, on bison-help.
|
|
||||||
|
|
||||||
See also
|
|
||||||
https://www.cs.tufts.edu/~nr/cs257/archive/clinton-jefferey/lr-error-messages.pdf
|
|
||||||
and https://research.swtch.com/yyerror.
|
|
||||||
|
|
||||||
** %include
|
** %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
|
||||||
@@ -485,7 +741,7 @@ There is demand for push parsers in Java and C++. And GLR I guess.
|
|||||||
|
|
||||||
** 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
|
||||||
@@ -525,13 +781,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:
|
||||||
|
|
||||||
@@ -563,15 +812,6 @@ move to partial orders (sounds like series/parallel orders to me).
|
|||||||
|
|
||||||
This is a prerequisite for modules.
|
This is a prerequisite for modules.
|
||||||
|
|
||||||
* $undefined
|
|
||||||
From Hans:
|
|
||||||
- If the Bison generated parser experiences an undefined number in the
|
|
||||||
character range, that character is written out in diagnostic messages, an
|
|
||||||
addition to the $undefined value.
|
|
||||||
|
|
||||||
Suggest: Change the name $undefined to undefined; looks better in outputs.
|
|
||||||
|
|
||||||
|
|
||||||
* Pre and post actions.
|
* Pre and post actions.
|
||||||
From: Florian Krohm <[email protected]>
|
From: Florian Krohm <[email protected]>
|
||||||
Subject: YYACT_EPILOGUE
|
Subject: YYACT_EPILOGUE
|
||||||
@@ -604,28 +844,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 semanticVal ival yychar yylval yylexer Tolmer hoc
|
||||||
|
# LocalWords: Sobisch YYPTRDIFF ptrdiff Autotest YYPRINT 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,6 +1,6 @@
|
|||||||
#! /bin/sh
|
#! /bin/sh
|
||||||
# Print a version string.
|
# Print a version string.
|
||||||
scriptversion=2019-01-04.17; # UTC
|
scriptversion=2020-04-13.15; # UTC
|
||||||
|
|
||||||
# Bootstrap this package from checked-out sources.
|
# Bootstrap this package from checked-out sources.
|
||||||
|
|
||||||
@@ -970,7 +970,7 @@ bootstrap_post_import_hook \
|
|||||||
# Uninitialized submodules are listed with an initial dash.
|
# Uninitialized submodules are listed with an initial dash.
|
||||||
if $use_git && git submodule | grep '^-' >/dev/null; then
|
if $use_git && git submodule | grep '^-' >/dev/null; then
|
||||||
die "some git submodules are not initialized. " \
|
die "some git submodules are not initialized. " \
|
||||||
"Run 'git submodule init' and bootstrap again."
|
"Run 'git submodule update --init' and bootstrap again."
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Remove any dangling symlink matching "*.m4" or "*.[ch]" in some
|
# Remove any dangling symlink matching "*.m4" or "*.[ch]" in some
|
||||||
|
|||||||
+10
-5
@@ -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,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/>.
|
||||||
|
|
||||||
# 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
|
||||||
@@ -30,6 +30,7 @@ gnulib_modules='
|
|||||||
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,13 +38,17 @@ gnulib_modules='
|
|||||||
obstack-printf
|
obstack-printf
|
||||||
perror progname
|
perror progname
|
||||||
quote quotearg
|
quote quotearg
|
||||||
|
rbtreehash-list
|
||||||
|
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
|
||||||
|
|||||||
@@ -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
|
||||||
@@ -17,7 +17,7 @@
|
|||||||
# You should have received a copy of the GNU General Public License
|
# You should have received a copy of the GNU General Public License
|
||||||
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
#
|
#
|
||||||
# Written by Akimn Demaille.
|
# Written by Akim Demaille.
|
||||||
|
|
||||||
use warnings;
|
use warnings;
|
||||||
use 5.005;
|
use 5.005;
|
||||||
|
|||||||
+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
|
||||||
@@ -73,6 +73,11 @@ def diff_to_re(match):
|
|||||||
is_diff = True
|
is_diff = True
|
||||||
to.append(l)
|
to.append(l)
|
||||||
if is_diff:
|
if is_diff:
|
||||||
|
# Do not run s//SOMETHING/g (with an emty pattern), that won't
|
||||||
|
# work well...
|
||||||
|
if frm == []:
|
||||||
|
trace("no from for", match.group(1))
|
||||||
|
return
|
||||||
frm = "\n".join(frm)
|
frm = "\n".join(frm)
|
||||||
to = "\n".join(to)
|
to = "\n".join(to)
|
||||||
subst[frm] = to
|
subst[frm] = to
|
||||||
@@ -102,7 +107,7 @@ def update(at_file, logfile):
|
|||||||
def process(logfile):
|
def process(logfile):
|
||||||
log = contents(logfile)
|
log = contents(logfile)
|
||||||
# Look for the file to update.
|
# Look for the file to update.
|
||||||
m = re.search(r'^\d+\. ([-\w]+\.at):\d+: ', log, re.MULTILINE)
|
m = re.search(r'^\d+\. ([\-\+\w]+\.at):\d+: ', log, re.MULTILINE)
|
||||||
if not m:
|
if not m:
|
||||||
trace("no diff found:", logfile)
|
trace("no diff found:", logfile)
|
||||||
return
|
return
|
||||||
@@ -112,4 +117,6 @@ def process(logfile):
|
|||||||
|
|
||||||
for logfile in args.logs:
|
for logfile in args.logs:
|
||||||
trace("FILE:", logfile)
|
trace("FILE:", logfile)
|
||||||
|
if os.path.isdir(logfile):
|
||||||
|
logfile = os.path.join(logfile, 'testsuite.log')
|
||||||
process(logfile)
|
process(logfile)
|
||||||
|
|||||||
@@ -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.
|
||||||
@@ -51,7 +51,7 @@ gnulib_dir = $(srcdir)/gnulib
|
|||||||
bootstrap-tools = autoconf,automake,flex,gettext,gnulib
|
bootstrap-tools = autoconf,automake,flex,gettext,gnulib
|
||||||
|
|
||||||
announcement_Cc_ = \
|
announcement_Cc_ = \
|
||||||
[email protected], [email protected], bison-patches@gnu.org, \
|
[email protected], bison-announce@gnu.org, \
|
||||||
[email protected]
|
[email protected]
|
||||||
|
|
||||||
update-copyright: update-b4-copyright update-package-copyright-year
|
update-copyright: update-b4-copyright update-package-copyright-year
|
||||||
@@ -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,7 +156,9 @@ 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$$ \
|
||||||
po_check=(^po/POTFILES.in|.md)$$ \
|
copyright_check=gnulib/lib/version-etc.c$$ \
|
||||||
|
error_message_uppercase=etc/bench.pl.in$$ \
|
||||||
|
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$$ \
|
||||||
prohibit_always-defined_macros=^data/skeletons/yacc.c$$ \
|
prohibit_always-defined_macros=^data/skeletons/yacc.c$$ \
|
||||||
@@ -165,7 +167,7 @@ $(call exclude,
|
|||||||
prohibit_doubled_word=^tests/named-refs.at$$ \
|
prohibit_doubled_word=^tests/named-refs.at$$ \
|
||||||
prohibit_magic_number_exit=^doc/bison.texi$$ \
|
prohibit_magic_number_exit=^doc/bison.texi$$ \
|
||||||
prohibit_magic_number_exit+=?|^tests/(conflicts|regression).at$$ \
|
prohibit_magic_number_exit+=?|^tests/(conflicts|regression).at$$ \
|
||||||
prohibit_strcmp=^doc/bison\.texi|examples|tests/local\.at$$ \
|
prohibit_strcmp=^doc/bison\.texi|examples|tests \
|
||||||
prohibit_tab_based_indentation=install-icc.sh|\.(am|mk)$$|^\.git|tests/input.at|Makefile$$ \
|
prohibit_tab_based_indentation=install-icc.sh|\.(am|mk)$$|^\.git|tests/input.at|Makefile$$ \
|
||||||
require_config_h=^(lib/yyerror|data/skeletons/(glr|yacc))\.c$$ \
|
require_config_h=^(lib/yyerror|data/skeletons/(glr|yacc))\.c$$ \
|
||||||
require_config_h_first=^(lib/yyerror|data/skeletons/(glr|yacc))\.c$$ \
|
require_config_h_first=^(lib/yyerror|data/skeletons/(glr|yacc))\.c$$ \
|
||||||
|
|||||||
+21
-11
@@ -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,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/>.
|
||||||
|
|
||||||
# In order for some versions of Sun Studio to compile our C++ test cases
|
# In order for some versions of Sun Studio to compile our C++ test cases
|
||||||
# correctly, we need Autoconf 2.64 or better to handle the restrict
|
# correctly, we need Autoconf 2.64 or better to handle the restrict
|
||||||
@@ -29,17 +29,15 @@ 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])
|
||||||
|
|
||||||
AC_CONFIG_AUX_DIR([build-aux])
|
AC_CONFIG_AUX_DIR([build-aux])
|
||||||
AC_CONFIG_MACRO_DIR([m4])
|
AC_CONFIG_MACRO_DIR([m4])
|
||||||
|
|
||||||
# We use Automake 1.14's %D% and %C%.
|
|
||||||
#
|
|
||||||
# When we move to Automake 1.16, simplify examples/c/reccalc/local.mk.
|
# When we move to Automake 1.16, simplify examples/c/reccalc/local.mk.
|
||||||
# Our CI runs on Xenial, which has only Automake 1.15.
|
# Our CI build the packages on Bionic, which has only Automake 1.15.
|
||||||
#
|
#
|
||||||
# We want gnits strictness only when rolling a stable release. For
|
# We want gnits strictness only when rolling a stable release. For
|
||||||
# release candidates, we use version strings like 2.4.3_rc1, but gnits
|
# release candidates, we use version strings like 2.4.3_rc1, but gnits
|
||||||
@@ -47,7 +45,7 @@ AC_CONFIG_MACRO_DIR([m4])
|
|||||||
# releases, we want to be able run make dist without being required to
|
# releases, we want to be able run make dist without being required to
|
||||||
# add a bogus NEWS entry. In that case, the version string
|
# add a bogus NEWS entry. In that case, the version string
|
||||||
# automatically contains a dash, which we also let disable gnits.
|
# automatically contains a dash, which we also let disable gnits.
|
||||||
AM_INIT_AUTOMAKE([1.14 dist-xz nostdinc
|
AM_INIT_AUTOMAKE([1.15 dist-lzip dist-xz nostdinc
|
||||||
color-tests parallel-tests
|
color-tests parallel-tests
|
||||||
silent-rules]
|
silent-rules]
|
||||||
m4_bmatch(m4_defn([AC_PACKAGE_VERSION]), [[-_]],
|
m4_bmatch(m4_defn([AC_PACKAGE_VERSION]), [[-_]],
|
||||||
@@ -62,6 +60,9 @@ 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],
|
||||||
@@ -134,10 +135,12 @@ if test "$enable_gcc_warnings" = yes; then
|
|||||||
-fparse-all-comments -Wdocumentation
|
-fparse-all-comments -Wdocumentation
|
||||||
-Wformat -Wimplicit-fallthrough -Wnull-dereference
|
-Wformat -Wimplicit-fallthrough -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 -Wstrict-prototypes'
|
warn_c='-Wbad-function-cast
|
||||||
|
-Wmissing-prototypes
|
||||||
|
-Wstrict-prototypes'
|
||||||
warn_cxx='-Wextra-semi -Wnoexcept -Wold-style-cast -Wundefined-func-template
|
warn_cxx='-Wextra-semi -Wnoexcept -Wold-style-cast -Wundefined-func-template
|
||||||
-Wweak-vtables'
|
-Wweak-vtables'
|
||||||
# Warnings for the test suite only.
|
# Warnings for the test suite only.
|
||||||
@@ -261,9 +264,9 @@ if ! "$LEX_IS_FLEX" || test "X$LEX" = X:; then
|
|||||||
AC_MSG_WARN([bypassing lex because flex is required])
|
AC_MSG_WARN([bypassing lex because flex is required])
|
||||||
LEX=:
|
LEX=:
|
||||||
fi
|
fi
|
||||||
AM_CONDITIONAL([FLEX_WORKS], [$LEX_IS_FLEX])
|
AM_CONDITIONAL([FLEX_WORKS], [$LEX_IS_FLEX && $FLEX_SUPPORTS_HEADER_OPT])
|
||||||
AM_CONDITIONAL([FLEX_CXX_WORKS],
|
AM_CONDITIONAL([FLEX_CXX_WORKS],
|
||||||
[$LEX_IS_FLEX && test $bison_cv_cxx_works = yes])
|
[$LEX_IS_FLEX && $FLEX_SUPPORTS_HEADER_OPT && test $bison_cv_cxx_works = yes])
|
||||||
AC_PROG_YACC
|
AC_PROG_YACC
|
||||||
AC_PROG_RANLIB
|
AC_PROG_RANLIB
|
||||||
AC_PROG_GNU_M4
|
AC_PROG_GNU_M4
|
||||||
@@ -332,6 +335,13 @@ AC_MSG_RESULT([$suppfile])
|
|||||||
# Whether we cannot run the compiled bison.
|
# Whether we cannot run the compiled bison.
|
||||||
AM_CONDITIONAL([CROSS_COMPILING], [test "$cross_compiling" = yes])
|
AM_CONDITIONAL([CROSS_COMPILING], [test "$cross_compiling" = yes])
|
||||||
|
|
||||||
|
# Build bistromathic if we have the lib and both readline/readline.h
|
||||||
|
# and readline/history.h.
|
||||||
|
AM_CONDITIONAL([ENABLE_BISTROMATHIC],
|
||||||
|
[test "$gl_cv_lib_readline" != no &&
|
||||||
|
test "$ac_cv_header_readline_readline_h" = yes &&
|
||||||
|
test "$ac_cv_header_readline_history_h" = yes])
|
||||||
|
|
||||||
AM_MISSING_PROG([AUTOM4TE], [autom4te])
|
AM_MISSING_PROG([AUTOM4TE], [autom4te])
|
||||||
# Needed by tests/atlocal.in.
|
# Needed by tests/atlocal.in.
|
||||||
AC_SUBST([GCC])
|
AC_SUBST([GCC])
|
||||||
|
|||||||
+38
-17
@@ -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
|
||||||
@@ -83,26 +83,39 @@ field), where field can `has_id`, `id`, etc.: see
|
|||||||
|
|
||||||
The macro `b4_symbol(NUM, FIELD)` gives access to the following FIELDS:
|
The macro `b4_symbol(NUM, FIELD)` gives access to the following FIELDS:
|
||||||
|
|
||||||
- `has_id`: 0 or 1.
|
- `has_id`: 0 or 1
|
||||||
|
Whether the symbol has an `id`.
|
||||||
|
|
||||||
Whether the symbol has an id.
|
- `id`: string (e.g., `exp`, `NUM`, or `TOK_NUM` with api.token.prefix)
|
||||||
|
If `has_id`, the name of the token kind (prefixed by api.token.prefix if
|
||||||
|
defined), otherwise empty. Guaranteed to be usable as a C identifier.
|
||||||
|
This is used to define the token kind (i.e., the enum used by the return
|
||||||
|
value of yylex). Should be named `token_kind`.
|
||||||
|
|
||||||
- `id`: string
|
- `tag`: string
|
||||||
If has_id, the id (prefixed by api.token.prefix if defined), otherwise
|
A human readable representation of the symbol. Can be `'foo'`,
|
||||||
defined as empty. Guaranteed to be usable as a C identifier.
|
`'foo.id'`, `'"foo"'` etc.
|
||||||
|
|
||||||
- `tag`: string.
|
- `code`: integer
|
||||||
A representation of the symbol. Can be 'foo', 'foo.id', '"foo"' etc.
|
The token code associated to the token kind `id`.
|
||||||
|
|
||||||
- `user_number`: integer
|
|
||||||
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
|
||||||
|
Same as `kind_base`, 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++.
|
||||||
|
|
||||||
- `number`: integer
|
- `number`: integer
|
||||||
|
The code associated to the `kind`.
|
||||||
The internal number (computed from the external number by yytranslate).
|
The internal number (computed from the external number by yytranslate).
|
||||||
Corresponds to yytoken in yacc.c. This is the same number that serves as
|
Corresponds to yytoken in yacc.c. This is the same number that serves as
|
||||||
key in b4_symbol(NUM, FIELD).
|
key in b4_symbol(NUM, FIELD).
|
||||||
@@ -129,11 +142,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
|
||||||
@@ -166,7 +185,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
|
||||||
@@ -174,7 +193,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.
|
||||||
|
|
||||||
@@ -189,4 +208,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/>.
|
||||||
|
|
||||||
|
-->
|
||||||
|
|||||||
+31
-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
|
||||||
@@ -29,3 +29,33 @@
|
|||||||
|
|
||||||
/* "Sections" in traces (--trace). */
|
/* "Sections" in traces (--trace). */
|
||||||
.trace0 { color: green; }
|
.trace0 { color: green; }
|
||||||
|
|
||||||
|
/* Syntax error messages. */
|
||||||
|
.expected { color: green; }
|
||||||
|
.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
-2
@@ -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 \
|
||||||
@@ -34,6 +34,7 @@ dist_skeletons_DATA = \
|
|||||||
data/skeletons/lalr1.java \
|
data/skeletons/lalr1.java \
|
||||||
data/skeletons/location.cc \
|
data/skeletons/location.cc \
|
||||||
data/skeletons/stack.hh \
|
data/skeletons/stack.hh \
|
||||||
|
data/skeletons/traceon.m4 \
|
||||||
data/skeletons/variant.hh \
|
data/skeletons/variant.hh \
|
||||||
data/skeletons/yacc.c
|
data/skeletons/yacc.c
|
||||||
|
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ public interface Lexer
|
|||||||
* to the next token and prepares to return the semantic value
|
* to the next token and prepares to return the semantic value
|
||||||
* and beginning/ending positions of the token.
|
* and beginning/ending positions of the token.
|
||||||
* @return the token identifier corresponding to the next token. */
|
* @return the token identifier corresponding to the next token. */
|
||||||
YYTokenType yylex ();
|
TokenKind yylex ();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Entry point for error reporting. Emits an error
|
* Entry point for error reporting. Emits an error
|
||||||
@@ -39,7 +39,7 @@ public interface Lexer
|
|||||||
void yyerror (YYLocation loc, string s);
|
void yyerror (YYLocation loc, string s);
|
||||||
}
|
}
|
||||||
|
|
||||||
- semantic types are handled by D usions (same as for C/C++ parsers)
|
- semantic types are handled by D unions (same as for C/C++ parsers)
|
||||||
|
|
||||||
- the following (non-standard) %defines are supported:
|
- the following (non-standard) %defines are supported:
|
||||||
|
|
||||||
|
|||||||
+145
-46
@@ -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,30 @@
|
|||||||
# 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_gsub(STRING, RE1, SUBST1, RE2, SUBST2, ...)
|
||||||
|
# ----------------------------------------------
|
||||||
|
# m4 equivalent of
|
||||||
|
#
|
||||||
|
# $_ = STRING;
|
||||||
|
# s/RE1/SUBST1/g;
|
||||||
|
# s/RE2/SUBST2/g;
|
||||||
|
# ...
|
||||||
|
#
|
||||||
|
# Really similar to m4_bpatsubsts, but behaves properly with quotes.
|
||||||
|
# See m4.at's "Generating Comments". Super inelegant, but so far, I
|
||||||
|
# did not find any better solution.
|
||||||
|
m4_define([b4_gsub],
|
||||||
|
[m4_bpatsubst(m4_bpatsubst(m4_bpatsubst([[[[$1]]]],
|
||||||
|
[$2], [$3]),
|
||||||
|
[$4], [$5]),
|
||||||
|
[$6], [$7])])
|
||||||
|
|
||||||
|
# m4_shift2 and m4_shift3 are provided by m4sugar.
|
||||||
|
m4_define([m4_shift4], [m4_shift(m4_shift(m4_shift(m4_shift($@))))])
|
||||||
|
|
||||||
|
|
||||||
## ---------------- ##
|
## ---------------- ##
|
||||||
@@ -26,7 +49,7 @@
|
|||||||
# 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])
|
||||||
@@ -51,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
|
||||||
@@ -72,8 +95,9 @@ version 2.2 of Bison.])
|
|||||||
# -------------
|
# -------------
|
||||||
# Issue a warning about private implementation details.
|
# Issue a warning about private implementation details.
|
||||||
m4_define([b4_disclaimer],
|
m4_define([b4_disclaimer],
|
||||||
[b4_comment([Undocumented macros, especially those whose name start with YY_,
|
[b4_comment([DO NOT RELY ON FEATURES THAT ARE NOT DOCUMENTED in the manual,
|
||||||
are private implementation details. Do not rely on them.])
|
especially those whose name start with YY_ or yy_. They are
|
||||||
|
private implementation details that can be changed or removed.])
|
||||||
])
|
])
|
||||||
|
|
||||||
|
|
||||||
@@ -161,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], ...)
|
||||||
@@ -369,6 +393,7 @@ m4_define([b4_$3_if],
|
|||||||
# 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([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([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.
|
||||||
@@ -384,37 +409,86 @@ m4_define([b4_glr_cc_if],
|
|||||||
## Symbols. ##
|
## Symbols. ##
|
||||||
## --------- ##
|
## --------- ##
|
||||||
|
|
||||||
# For a description of the Symbol handling, see README.
|
# For a description of the Symbol handling, see README.md.
|
||||||
#
|
#
|
||||||
# The following macros provide access to symbol related values.
|
# The following macros provide access to symbol related values.
|
||||||
|
|
||||||
# __b4_symbol(NUM, FIELD)
|
# __b4_symbol(NUM, FIELD)
|
||||||
# -----------------------
|
# -----------------------
|
||||||
# Recover a FIELD about symbol #NUM. Thanks to m4_indir, fails if
|
# Fetch FIELD of symbol #NUM. Fail if undefined.
|
||||||
# undefined.
|
|
||||||
m4_define([__b4_symbol],
|
m4_define([__b4_symbol],
|
||||||
[m4_indir([b4_symbol($1, $2)])])
|
[m4_indir([b4_symbol($1, $2)])])
|
||||||
|
|
||||||
|
|
||||||
# _b4_symbol(NUM, FIELD)
|
# _b4_symbol(NUM, FIELD)
|
||||||
# ----------------------
|
# ----------------------
|
||||||
# Recover a FIELD about symbol #NUM (or "orig NUM"). Fails if
|
# Fetch FIELD of symbol #NUM (or "orig NUM", see README.md).
|
||||||
# undefined.
|
# Fail if undefined.
|
||||||
m4_define([_b4_symbol],
|
m4_define([_b4_symbol],
|
||||||
[m4_ifdef([b4_symbol($1, number)],
|
[m4_ifdef([b4_symbol($1, number)],
|
||||||
[__b4_symbol(m4_indir([b4_symbol($1, number)]), $2)],
|
[__b4_symbol(m4_indir([b4_symbol($1, number)]), $2)],
|
||||||
[__b4_symbol([$1], [$2])])])
|
[__b4_symbol([$1], [$2])])])
|
||||||
|
|
||||||
|
|
||||||
|
# b4_symbol_token_kind(NUM)
|
||||||
|
# -------------------------
|
||||||
|
# The token kind of this symbol.
|
||||||
|
m4_define([b4_symbol_token_kind],
|
||||||
|
[b4_percent_define_get([api.token.prefix])dnl
|
||||||
|
_b4_symbol([$1], [id])])
|
||||||
|
|
||||||
|
|
||||||
|
# b4_symbol_kind_base(NUM)
|
||||||
|
# ------------------------
|
||||||
|
# Build the name of the kind of this symbol. It must always exist,
|
||||||
|
# otherwise some symbols might not be represented in the enum, which
|
||||||
|
# might be compiled into too small a type to contain all the symbol
|
||||||
|
# numbers.
|
||||||
|
m4_define([b4_symbol_prefix], [b4_percent_define_get([api.symbol.prefix])])
|
||||||
|
m4_define([b4_symbol_kind_base],
|
||||||
|
[b4_percent_define_get([api.symbol.prefix])dnl
|
||||||
|
m4_case([$1],
|
||||||
|
[-2], [[YYEMPTY]],
|
||||||
|
[0], [[YYEOF]],
|
||||||
|
[1], [[YYerror]],
|
||||||
|
[2], [[YYUNDEF]],
|
||||||
|
[m4_case(b4_symbol([$1], [tag]),
|
||||||
|
[$accept], [[YYACCEPT]],
|
||||||
|
[b4_symbol_if([$1], [has_id], _b4_symbol([$1], [id]),
|
||||||
|
[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)
|
||||||
# ---------------------
|
# ---------------------
|
||||||
# Recover a FIELD about symbol #NUM (or "orig NUM"). Fails if
|
# Fetch FIELD of symbol #NUM (or "orig NUM"). Fail if undefined.
|
||||||
# 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_case([$2],
|
||||||
[id], [m4_do([b4_percent_define_get([api.token.prefix])],
|
[id], [b4_symbol_token_kind([$1])],
|
||||||
[_b4_symbol([$1], [id])])],
|
[kind_base], [b4_symbol_kind_base([$1])],
|
||||||
|
[kind], [b4_symbol_kind([$1])],
|
||||||
|
[slot], [b4_symbol_slot([$1])],
|
||||||
[_b4_symbol($@)])])
|
[_b4_symbol($@)])])
|
||||||
|
|
||||||
|
|
||||||
@@ -437,9 +511,9 @@ m4_define([b4_symbol_tag_comment],
|
|||||||
])
|
])
|
||||||
|
|
||||||
|
|
||||||
# b4_symbol_action(SYMBOL-NUM, KIND)
|
# b4_symbol_action(SYMBOL-NUM, ACTION)
|
||||||
# ----------------------------------
|
# ------------------------------------
|
||||||
# Run the action KIND (destructor or printer) for SYMBOL-NUM.
|
# Run the action ACTION ("destructor" or "printer") for SYMBOL-NUM.
|
||||||
m4_define([b4_symbol_action],
|
m4_define([b4_symbol_action],
|
||||||
[b4_symbol_if([$1], [has_$2],
|
[b4_symbol_if([$1], [has_$2],
|
||||||
[b4_dollar_pushdef([(*yyvaluep)],
|
[b4_dollar_pushdef([(*yyvaluep)],
|
||||||
@@ -463,21 +537,21 @@ m4_define([b4_symbol_destructor], [b4_symbol_action([$1], [destructor])])
|
|||||||
m4_define([b4_symbol_printer], [b4_symbol_action([$1], [printer])])
|
m4_define([b4_symbol_printer], [b4_symbol_action([$1], [printer])])
|
||||||
|
|
||||||
|
|
||||||
# b4_symbol_actions(KIND, [TYPE = yytype])
|
# b4_symbol_actions(ACTION, [KIND = yykind])
|
||||||
# ----------------------------------------
|
# ------------------------------------------
|
||||||
# Emit the symbol actions for KIND ("printer" or "destructor").
|
# Emit the symbol actions for ACTION ("destructor" or "printer").
|
||||||
# Dispatch on TYPE.
|
# Dispatch on KIND.
|
||||||
m4_define([b4_symbol_actions],
|
m4_define([b4_symbol_actions],
|
||||||
[m4_pushdef([b4_actions_], m4_expand([b4_symbol_foreach([b4_symbol_$1])]))dnl
|
[m4_pushdef([b4_actions_], m4_expand([b4_symbol_foreach([b4_symbol_$1])]))dnl
|
||||||
m4_ifval(m4_defn([b4_actions_]),
|
m4_ifval(m4_defn([b4_actions_]),
|
||||||
[switch (m4_default([$2], [yytype]))
|
[switch (m4_default([$2], [yykind]))
|
||||||
{
|
{
|
||||||
m4_defn([b4_actions_])[]dnl
|
m4_defn([b4_actions_])[]dnl
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}dnl
|
}dnl
|
||||||
],
|
],
|
||||||
[YYUSE (m4_default([$2], [yytype]));])dnl
|
[YY_USE (m4_default([$2], [yykind]));])dnl
|
||||||
m4_popdef([b4_actions_])dnl
|
m4_popdef([b4_actions_])dnl
|
||||||
])
|
])
|
||||||
|
|
||||||
@@ -487,7 +561,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])])
|
||||||
])
|
])
|
||||||
|
|
||||||
|
|
||||||
@@ -507,13 +581,14 @@ m4_define([b4_symbol_map],
|
|||||||
|
|
||||||
# b4_token_visible_if(NUM, IF-TRUE, IF-FALSE)
|
# b4_token_visible_if(NUM, IF-TRUE, IF-FALSE)
|
||||||
# -------------------------------------------
|
# -------------------------------------------
|
||||||
# Whether NUM denotes a token that has an exported definition (i.e.,
|
# Whether NUM denotes a token kind that has an exported definition
|
||||||
# shows in enum yytokentype).
|
# (i.e., shows in enum yytokentype).
|
||||||
m4_define([b4_token_visible_if],
|
m4_define([b4_token_visible_if],
|
||||||
[b4_symbol_if([$1], [is_token],
|
[b4_symbol_if([$1], [is_token],
|
||||||
[b4_symbol_if([$1], [has_id], [$2], [$3])],
|
[b4_symbol_if([$1], [has_id], [$2], [$3])],
|
||||||
[$3])])
|
[$3])])
|
||||||
|
|
||||||
|
|
||||||
# b4_token_has_definition(NUM)
|
# b4_token_has_definition(NUM)
|
||||||
# ----------------------------
|
# ----------------------------
|
||||||
# 1 if NUM is visible, nothing otherwise.
|
# 1 if NUM is visible, nothing otherwise.
|
||||||
@@ -530,13 +605,27 @@ m4_define([b4_any_token_visible_if],
|
|||||||
|
|
||||||
# b4_token_format(FORMAT, NUM)
|
# b4_token_format(FORMAT, NUM)
|
||||||
# ----------------------------
|
# ----------------------------
|
||||||
|
# If token NUM has a visible ID, format FORMAT with ID, USER_NUMBER.
|
||||||
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_quote(b4_symbol([$2], [id])),
|
b4_symbol([$2], [id]),
|
||||||
m4_quote(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
|
||||||
|
# ------------------
|
||||||
|
# The code of the last token visible token.
|
||||||
|
m4_define([_b4_last_enum_token],
|
||||||
|
[b4_token_visible_if([$1],
|
||||||
|
[m4_define([b4_last_enum_token], [$1])])])
|
||||||
|
b4_symbol_foreach([_b4_last_enum_token])
|
||||||
|
|
||||||
|
# b4_last_symbol
|
||||||
|
# --------------
|
||||||
|
# The code of the last symbol.
|
||||||
|
m4_define([b4_last_symbol], m4_eval(b4_tokens_number + b4_nterms_number - 1))
|
||||||
|
|
||||||
## ------- ##
|
## ------- ##
|
||||||
## Types. ##
|
## Types. ##
|
||||||
## ------- ##
|
## ------- ##
|
||||||
@@ -558,11 +647,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]))])
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -603,7 +692,7 @@ m4_define([b4_sync_end], [ b4_comment([$2:$1])]
|
|||||||
# This generates dependencies on the Bison skeletons hence lots of
|
# This generates dependencies on the Bison skeletons hence lots of
|
||||||
# useless 'git diff'. This location is useless for the regular
|
# useless 'git diff'. This location is useless for the regular
|
||||||
# user (who does not care about the skeletons) and is actually not
|
# user (who does not care about the skeletons) and is actually not
|
||||||
# useful for Bison developpers too (I, Akim, never used this to locate
|
# useful for Bison developers too (I, Akim, never used this to locate
|
||||||
# the code in skeletons that generated output). So disable it
|
# the code in skeletons that generated output). So disable it
|
||||||
# completely. If someone thinks this was actually useful, a %define
|
# completely. If someone thinks this was actually useful, a %define
|
||||||
# variable should be provided to control the level of verbosity of
|
# variable should be provided to control the level of verbosity of
|
||||||
@@ -683,7 +772,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]],
|
||||||
@@ -1016,21 +1105,23 @@ m4_define([b4_bison_locations_if],
|
|||||||
[b4_locations_if([b4_percent_define_ifdef([[api.location.type]], [], [$1])])])
|
[b4_locations_if([b4_percent_define_ifdef([[api.location.type]], [], [$1])])])
|
||||||
|
|
||||||
|
|
||||||
# b4_error_verbose_if([IF-ERRORS-ARE-VERBOSE], [IF-NOT])
|
|
||||||
|
# %define parse.error "(custom|detailed|simple|verbose)"
|
||||||
# ------------------------------------------------------
|
# ------------------------------------------------------
|
||||||
# Map %define parse.error "(simple|verbose)" to b4_error_verbose_if and
|
|
||||||
# b4_error_verbose_flag.
|
|
||||||
b4_percent_define_default([[parse.error]], [[simple]])
|
b4_percent_define_default([[parse.error]], [[simple]])
|
||||||
b4_percent_define_check_values([[[[parse.error]],
|
b4_percent_define_check_values([[[[parse.error]],
|
||||||
[[simple]], [[verbose]]]])
|
[[custom]], [[detailed]], [[simple]], [[verbose]]]])
|
||||||
m4_define([b4_error_verbose_flag],
|
|
||||||
[m4_case(b4_percent_define_get([[parse.error]]),
|
# b4_parse_error_case(CASE1, THEN1, CASE2, THEN2, ..., ELSE)
|
||||||
[simple], [[0]],
|
# ----------------------------------------------------------
|
||||||
[verbose], [[1]])])
|
m4_define([b4_parse_error_case],
|
||||||
b4_define_flag_if([error_verbose])
|
[m4_case(b4_percent_define_get([[parse.error]]), $@)])
|
||||||
|
|
||||||
|
# b4_parse_error_bmatch(PATTERN1, THEN1, PATTERN2, THEN2, ..., ELSE)
|
||||||
|
# ------------------------------------------------------------------
|
||||||
|
m4_define([b4_parse_error_bmatch],
|
||||||
|
[m4_bmatch(b4_percent_define_get([[parse.error]]), $@)])
|
||||||
|
|
||||||
# yytoken_table is needed to support verbose errors.
|
|
||||||
b4_error_verbose_if([m4_define([b4_token_table_flag], [1])])
|
|
||||||
|
|
||||||
|
|
||||||
# b4_variant_if([IF-VARIANT-ARE-USED], [IF-NOT])
|
# b4_variant_if([IF-VARIANT-ARE-USED], [IF-NOT])
|
||||||
@@ -1116,3 +1207,11 @@ b4_percent_define_ifdef([api.value.type],
|
|||||||
|
|
||||||
# api.value.union.name.
|
# api.value.union.name.
|
||||||
b4_percent_define_check_kind([api.value.union.name], [keyword])
|
b4_percent_define_check_kind([api.value.union.name], [keyword])
|
||||||
|
|
||||||
|
# parse.error (custom|detailed) >< token-table.
|
||||||
|
b4_token_table_if(
|
||||||
|
[b4_parse_error_bmatch([custom\|detailed],
|
||||||
|
[b4_complain_at(b4_percent_define_get_loc([parse.error]),
|
||||||
|
[['%s' and '%s' cannot be used together]],
|
||||||
|
[%token-table],
|
||||||
|
[%define parse.error (custom|detailed)])])])
|
||||||
|
|||||||
@@ -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]])])
|
||||||
|
|||||||
+158
-85
@@ -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,13 +15,15 @@
|
|||||||
# 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]],
|
||||||
[b4_complain_at(b4_percent_define_get_loc([[api.value.union.name]]),
|
[b4_complain_at(b4_percent_define_get_loc([[api.value.union.name]]),
|
||||||
[named %union is invalid in C++])])
|
[named %union is invalid in C++])])
|
||||||
|
|
||||||
|
b4_percent_define_default([[api.symbol.prefix]], [[S_]])
|
||||||
|
|
||||||
m4_include(b4_skeletonsdir/[c.m4])
|
m4_include(b4_skeletonsdir/[c.m4])
|
||||||
|
|
||||||
b4_percent_define_check_kind([api.namespace], [code], [deprecated])
|
b4_percent_define_check_kind([api.namespace], [code], [deprecated])
|
||||||
@@ -103,7 +105,7 @@ 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]))
|
||||||
|
|
||||||
@@ -160,20 +162,42 @@ m4_bpatsubst(m4_dquote(m4_bpatsubst(m4_dquote(b4_namespace_ref[ ]),
|
|||||||
[::\([^][:]\|:[^:]\)*], [} ])[} // ]b4_namespace_ref])])
|
[::\([^][:]\|:[^:]\)*], [} ])[} // ]b4_namespace_ref])])
|
||||||
|
|
||||||
|
|
||||||
|
## ------------- ##
|
||||||
|
## Token kinds. ##
|
||||||
|
## ------------- ##
|
||||||
|
|
||||||
|
|
||||||
# b4_token_enums
|
# b4_token_enums
|
||||||
# --------------
|
# --------------
|
||||||
# Output the definition of the tokens as enums.
|
# Output the definition of the token kinds.
|
||||||
m4_define([b4_token_enums],
|
m4_define([b4_token_enums],
|
||||||
[[enum yytokentype
|
[[enum token_kind_type
|
||||||
{
|
{
|
||||||
]m4_join([,
|
]b4_symbol([-2], [id])[ = -2,
|
||||||
],
|
]b4_symbol_foreach([b4_token_enum])dnl
|
||||||
b4_symbol_map([b4_token_enum]))[
|
[ };]dnl
|
||||||
};]dnl
|
|
||||||
])
|
])
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## -------------- ##
|
||||||
|
## Symbol kinds. ##
|
||||||
|
## -------------- ##
|
||||||
|
|
||||||
|
# b4_declare_symbol_enum
|
||||||
|
# ----------------------
|
||||||
|
# The definition of the symbol internal numbers as an enum.
|
||||||
|
# Defining YYEMPTY here is important: it forces the compiler
|
||||||
|
# to use a signed type, which matters for yytoken.
|
||||||
|
m4_define([b4_declare_symbol_enum],
|
||||||
|
[[enum symbol_kind_type
|
||||||
|
{
|
||||||
|
YYNTOKENS = ]b4_tokens_number[, ///< Number of tokens.
|
||||||
|
]b4_symbol(-2, kind_base)[ = -2,
|
||||||
|
]b4_symbol_foreach([ b4_symbol_enum])dnl
|
||||||
|
[ };]])
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
## ----------------- ##
|
## ----------------- ##
|
||||||
## Semantic Values. ##
|
## Semantic Values. ##
|
||||||
@@ -231,23 +255,31 @@ m4_define([b4_public_types_declare],
|
|||||||
location_type location;])[
|
location_type location;])[
|
||||||
};
|
};
|
||||||
|
|
||||||
/// Tokens.
|
/// Token kinds.
|
||||||
struct token
|
struct token
|
||||||
{
|
{
|
||||||
]b4_token_enums[
|
]b4_token_enums[
|
||||||
|
/// Backward compatibility alias (Bison 3.6).
|
||||||
|
typedef token_kind_type yytokentype;
|
||||||
};
|
};
|
||||||
|
|
||||||
/// (External) token type, as returned by yylex.
|
/// Token kind, as returned by yylex.
|
||||||
typedef token::yytokentype token_type;
|
typedef token::yytokentype token_kind_type;
|
||||||
|
|
||||||
/// Symbol type: an internal symbol number.
|
/// Backward compatibility alias (Bison 3.6).
|
||||||
typedef int symbol_number_type;
|
typedef token_kind_type token_type;
|
||||||
|
|
||||||
/// The symbol type number to denote an empty symbol.
|
/// Symbol kinds.
|
||||||
enum { empty_symbol = -2 };
|
struct symbol_kind
|
||||||
|
{
|
||||||
|
]b4_declare_symbol_enum[
|
||||||
|
};
|
||||||
|
|
||||||
/// Internal symbol number for tokens (subsumed by symbol_number_type).
|
/// (Internal) symbol kind.
|
||||||
typedef ]b4_int_type_for([b4_translate])[ token_number_type;
|
typedef symbol_kind::symbol_kind_type symbol_kind_type;
|
||||||
|
|
||||||
|
/// The number of tokens.
|
||||||
|
static const symbol_kind_type YYNTOKENS = symbol_kind::YYNTOKENS;
|
||||||
]])
|
]])
|
||||||
|
|
||||||
|
|
||||||
@@ -258,8 +290,8 @@ m4_define([b4_public_types_declare],
|
|||||||
m4_define([b4_symbol_type_define],
|
m4_define([b4_symbol_type_define],
|
||||||
[[ /// A complete symbol.
|
[[ /// A complete symbol.
|
||||||
///
|
///
|
||||||
/// Expects its Base type to provide access to the symbol type
|
/// Expects its Base type to provide access to the symbol kind
|
||||||
/// via type_get ().
|
/// via kind ().
|
||||||
///
|
///
|
||||||
/// Provide access to semantic value]b4_locations_if([ and location])[.
|
/// Provide access to semantic value]b4_locations_if([ and location])[.
|
||||||
template <typename Base>
|
template <typename Base>
|
||||||
@@ -276,14 +308,22 @@ m4_define([b4_symbol_type_define],
|
|||||||
|
|
||||||
#if 201103L <= YY_CPLUSPLUS
|
#if 201103L <= YY_CPLUSPLUS
|
||||||
/// Move constructor.
|
/// Move constructor.
|
||||||
basic_symbol (basic_symbol&& that);
|
basic_symbol (basic_symbol&& that)
|
||||||
|
: Base (std::move (that))
|
||||||
|
, value (]b4_variant_if([], [std::move (that.value)]))b4_locations_if([
|
||||||
|
, location (std::move (that.location))])[
|
||||||
|
{]b4_variant_if([
|
||||||
|
b4_symbol_variant([this->kind ()], [value], [move],
|
||||||
|
[std::move (that.value)])
|
||||||
|
])[}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/// 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])[);
|
||||||
@@ -300,24 +340,50 @@ 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_number_type yytype = this->type_get ();
|
symbol_kind_type yykind = this->kind ();
|
||||||
basic_symbol<Base>& yysym = *this;
|
basic_symbol<Base>& yysym = *this;
|
||||||
(void) yysym;
|
(void) yysym;
|
||||||
switch (yytype)
|
switch (yykind)
|
||||||
{
|
{
|
||||||
]b4_symbol_foreach([b4_symbol_destructor])dnl
|
]b4_symbol_foreach([b4_symbol_destructor])dnl
|
||||||
[ default:
|
[ default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Type destructor.
|
// Value type destructor.
|
||||||
]b4_symbol_variant([[yytype]], [[value]], [[template destroy]])])[
|
]b4_symbol_variant([[yykind]], [[value]], [[template destroy]])])[
|
||||||
Base::clear ();
|
Base::clear ();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
]b4_parse_error_bmatch(
|
||||||
|
[custom\|detailed],
|
||||||
|
[[ /// The user-facing name of this symbol.
|
||||||
|
const char *name () const YY_NOEXCEPT
|
||||||
|
{
|
||||||
|
return ]b4_parser_class[::symbol_name (this->kind ());
|
||||||
|
}]],
|
||||||
|
[simple],
|
||||||
|
[[#if ]b4_api_PREFIX[DEBUG || ]b4_token_table_flag[
|
||||||
|
/// The user-facing name of this symbol.
|
||||||
|
const char *name () const YY_NOEXCEPT
|
||||||
|
{
|
||||||
|
return ]b4_parser_class[::symbol_name (this->kind ());
|
||||||
|
}
|
||||||
|
#endif // #if ]b4_api_PREFIX[DEBUG || ]b4_token_table_flag[
|
||||||
|
]],
|
||||||
|
[verbose],
|
||||||
|
[[ /// The user-facing name of this symbol.
|
||||||
|
std::string name () const YY_NOEXCEPT
|
||||||
|
{
|
||||||
|
return ]b4_parser_class[::symbol_name (this->kind ());
|
||||||
|
}]])[
|
||||||
|
|
||||||
|
/// Backward compatibility (Bison 3.6).
|
||||||
|
symbol_kind_type type_get () const YY_NOEXCEPT;
|
||||||
|
|
||||||
/// Whether empty.
|
/// Whether empty.
|
||||||
bool empty () const YY_NOEXCEPT;
|
bool empty () const YY_NOEXCEPT;
|
||||||
|
|
||||||
@@ -338,46 +404,51 @@ m4_define([b4_symbol_type_define],
|
|||||||
};
|
};
|
||||||
|
|
||||||
/// Type access provider for token (enum) based symbols.
|
/// Type access provider for token (enum) based symbols.
|
||||||
struct by_type
|
struct by_kind
|
||||||
{
|
{
|
||||||
/// Default constructor.
|
/// Default constructor.
|
||||||
by_type ();
|
by_kind ();
|
||||||
|
|
||||||
#if 201103L <= YY_CPLUSPLUS
|
#if 201103L <= YY_CPLUSPLUS
|
||||||
/// Move constructor.
|
/// Move constructor.
|
||||||
by_type (by_type&& that);
|
by_kind (by_kind&& that);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/// Copy constructor.
|
/// Copy constructor.
|
||||||
by_type (const by_type& that);
|
by_kind (const by_kind& that);
|
||||||
|
|
||||||
/// The symbol type as needed by the constructor.
|
/// The symbol kind as needed by the constructor.
|
||||||
typedef token_type kind_type;
|
typedef token_kind_type kind_type;
|
||||||
|
|
||||||
/// Constructor from (external) token numbers.
|
/// Constructor from (external) token numbers.
|
||||||
by_type (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 type from \a that.
|
/// Steal the symbol kind from \a that.
|
||||||
void move (by_type& that);
|
void move (by_kind& that);
|
||||||
|
|
||||||
/// The (internal) type number (corresponding to \a type).
|
/// The (internal) type number (corresponding to \a type).
|
||||||
/// \a empty when empty.
|
/// \a empty when empty.
|
||||||
symbol_number_type type_get () const YY_NOEXCEPT;
|
symbol_kind_type kind () const YY_NOEXCEPT;
|
||||||
|
|
||||||
/// The symbol type.
|
/// Backward compatibility (Bison 3.6).
|
||||||
/// \a empty_symbol when empty.
|
symbol_kind_type type_get () const YY_NOEXCEPT;
|
||||||
/// An int, not token_number_type, to be able to store empty_symbol.
|
|
||||||
int type;
|
/// The symbol kind.
|
||||||
|
/// \a ]b4_symbol_prefix[YYEMPTY when empty.
|
||||||
|
symbol_kind_type kind_;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/// Backward compatibility for a private implementation detail (Bison 3.6).
|
||||||
|
typedef by_kind by_type;
|
||||||
|
|
||||||
/// "External" symbols: returned by the scanner.
|
/// "External" symbols: returned by the scanner.
|
||||||
struct symbol_type : basic_symbol<by_type>
|
struct symbol_type : basic_symbol<by_kind>
|
||||||
{]b4_variant_if([[
|
{]b4_variant_if([[
|
||||||
/// Superclass.
|
/// Superclass.
|
||||||
typedef basic_symbol<by_type> super_type;
|
typedef basic_symbol<by_kind> super_type;
|
||||||
|
|
||||||
/// Empty symbol.
|
/// Empty symbol.
|
||||||
symbol_type () {}
|
symbol_type () {}
|
||||||
@@ -393,25 +464,13 @@ m4_define([b4_symbol_type_define],
|
|||||||
# Provide the implementation needed by the public types.
|
# Provide the implementation needed by the public types.
|
||||||
m4_define([b4_public_types_define],
|
m4_define([b4_public_types_define],
|
||||||
[[ // basic_symbol.
|
[[ // basic_symbol.
|
||||||
#if 201103L <= YY_CPLUSPLUS
|
|
||||||
template <typename Base>
|
|
||||||
]b4_parser_class[::basic_symbol<Base>::basic_symbol (basic_symbol&& that)
|
|
||||||
: Base (std::move (that))
|
|
||||||
, value (]b4_variant_if([], [std::move (that.value)]))b4_locations_if([
|
|
||||||
, location (std::move (that.location))])[
|
|
||||||
{]b4_variant_if([
|
|
||||||
b4_symbol_variant([this->type_get ()], [value], [move],
|
|
||||||
[std::move (that.value)])
|
|
||||||
])[}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
template <typename Base>
|
template <typename Base>
|
||||||
]b4_parser_class[::basic_symbol<Base>::basic_symbol (const basic_symbol& that)
|
]b4_parser_class[::basic_symbol<Base>::basic_symbol (const basic_symbol& that)
|
||||||
: Base (that)
|
: Base (that)
|
||||||
, value (]b4_variant_if([], [that.value]))b4_locations_if([
|
, value (]b4_variant_if([], [that.value]))b4_locations_if([
|
||||||
, location (that.location)])[
|
, location (that.location)])[
|
||||||
{]b4_variant_if([
|
{]b4_variant_if([
|
||||||
b4_symbol_variant([this->type_get ()], [value], [copy],
|
b4_symbol_variant([this->kind ()], [value], [copy],
|
||||||
[YY_MOVE (that.value)])
|
[YY_MOVE (that.value)])
|
||||||
])[}
|
])[}
|
||||||
|
|
||||||
@@ -436,13 +495,20 @@ m4_define([b4_public_types_define],
|
|||||||
, location (YY_MOVE (l))])[
|
, location (YY_MOVE (l))])[
|
||||||
{]b4_variant_if([[
|
{]b4_variant_if([[
|
||||||
(void) v;
|
(void) v;
|
||||||
]b4_symbol_variant([this->type_get ()], [value], [YY_MOVE_OR_COPY], [YY_MOVE (v)])])[}]])[
|
]b4_symbol_variant([this->kind ()], [value], [YY_MOVE_OR_COPY], [YY_MOVE (v)])])[}]])[
|
||||||
|
|
||||||
|
template <typename Base>
|
||||||
|
]b4_parser_class[::symbol_kind_type
|
||||||
|
]b4_parser_class[::basic_symbol<Base>::type_get () const YY_NOEXCEPT
|
||||||
|
{
|
||||||
|
return this->kind ();
|
||||||
|
}
|
||||||
|
|
||||||
template <typename Base>
|
template <typename Base>
|
||||||
bool
|
bool
|
||||||
]b4_parser_class[::basic_symbol<Base>::empty () const YY_NOEXCEPT
|
]b4_parser_class[::basic_symbol<Base>::empty () const YY_NOEXCEPT
|
||||||
{
|
{
|
||||||
return Base::type_get () == empty_symbol;
|
return this->kind () == ]b4_symbol(-2, kind)[;
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename Base>
|
template <typename Base>
|
||||||
@@ -450,50 +516,56 @@ m4_define([b4_public_types_define],
|
|||||||
]b4_parser_class[::basic_symbol<Base>::move (basic_symbol& s)
|
]b4_parser_class[::basic_symbol<Base>::move (basic_symbol& s)
|
||||||
{
|
{
|
||||||
super_type::move (s);
|
super_type::move (s);
|
||||||
]b4_variant_if([b4_symbol_variant([this->type_get ()], [value], [move],
|
]b4_variant_if([b4_symbol_variant([this->kind ()], [value], [move],
|
||||||
[YY_MOVE (s.value)])],
|
[YY_MOVE (s.value)])],
|
||||||
[value = YY_MOVE (s.value);])[]b4_locations_if([
|
[value = YY_MOVE (s.value);])[]b4_locations_if([
|
||||||
location = YY_MOVE (s.location);])[
|
location = YY_MOVE (s.location);])[
|
||||||
}
|
}
|
||||||
|
|
||||||
// by_type.
|
// by_kind.
|
||||||
]b4_inline([$1])b4_parser_class[::by_type::by_type ()
|
]b4_inline([$1])b4_parser_class[::by_kind::by_kind ()
|
||||||
: type (empty_symbol)
|
: kind_ (]b4_symbol(-2, kind)[)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
#if 201103L <= YY_CPLUSPLUS
|
#if 201103L <= YY_CPLUSPLUS
|
||||||
]b4_inline([$1])b4_parser_class[::by_type::by_type (by_type&& that)
|
]b4_inline([$1])b4_parser_class[::by_kind::by_kind (by_kind&& that)
|
||||||
: type (that.type)
|
: kind_ (that.kind_)
|
||||||
{
|
{
|
||||||
that.clear ();
|
that.clear ();
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
]b4_inline([$1])b4_parser_class[::by_type::by_type (const by_type& that)
|
]b4_inline([$1])b4_parser_class[::by_kind::by_kind (const by_kind& that)
|
||||||
: type (that.type)
|
: kind_ (that.kind_)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
]b4_inline([$1])b4_parser_class[::by_type::by_type (token_type t)
|
]b4_inline([$1])b4_parser_class[::by_kind::by_kind (token_kind_type t)
|
||||||
: type (yytranslate_ (t))
|
: kind_ (yytranslate_ (t))
|
||||||
{}
|
{}
|
||||||
|
|
||||||
]b4_inline([$1])[void
|
]b4_inline([$1])[void
|
||||||
]b4_parser_class[::by_type::clear ()
|
]b4_parser_class[::by_kind::clear () YY_NOEXCEPT
|
||||||
{
|
{
|
||||||
type = empty_symbol;
|
kind_ = ]b4_symbol(-2, kind)[;
|
||||||
}
|
}
|
||||||
|
|
||||||
]b4_inline([$1])[void
|
]b4_inline([$1])[void
|
||||||
]b4_parser_class[::by_type::move (by_type& that)
|
]b4_parser_class[::by_kind::move (by_kind& that)
|
||||||
{
|
{
|
||||||
type = that.type;
|
kind_ = that.kind_;
|
||||||
that.clear ();
|
that.clear ();
|
||||||
}
|
}
|
||||||
|
|
||||||
]b4_inline([$1])[int
|
]b4_inline([$1])[]b4_parser_class[::symbol_kind_type
|
||||||
]b4_parser_class[::by_type::type_get () const YY_NOEXCEPT
|
]b4_parser_class[::by_kind::kind () const YY_NOEXCEPT
|
||||||
{
|
{
|
||||||
return type;
|
return kind_;
|
||||||
|
}
|
||||||
|
|
||||||
|
]b4_inline([$1])[]b4_parser_class[::symbol_kind_type
|
||||||
|
]b4_parser_class[::by_kind::type_get () const YY_NOEXCEPT
|
||||||
|
{
|
||||||
|
return this->kind ();
|
||||||
}
|
}
|
||||||
]])
|
]])
|
||||||
|
|
||||||
@@ -510,27 +582,28 @@ m4_define([b4_token_constructor_define], [])
|
|||||||
# Define yytranslate_. Sometimes used in the header file ($1=hh),
|
# Define yytranslate_. Sometimes used in the header file ($1=hh),
|
||||||
# sometimes in the cc file.
|
# sometimes in the cc file.
|
||||||
m4_define([b4_yytranslate_define],
|
m4_define([b4_yytranslate_define],
|
||||||
[ b4_inline([$1])b4_parser_class[::token_number_type
|
[ b4_inline([$1])b4_parser_class[::symbol_kind_type
|
||||||
]b4_parser_class[::yytranslate_ (int t)
|
]b4_parser_class[::yytranslate_ (int t)
|
||||||
{
|
{
|
||||||
]b4_api_token_raw_if(
|
]b4_api_token_raw_if(
|
||||||
[[ return static_cast<token_number_type> (t);]],
|
[[ return static_cast<symbol_kind_type> (t);]],
|
||||||
[[ // YYTRANSLATE[TOKEN-NUM] -- Symbol number corresponding to
|
[[ // YYTRANSLATE[TOKEN-NUM] -- Symbol number corresponding to
|
||||||
// TOKEN-NUM as returned by yylex.
|
// TOKEN-NUM as returned by yylex.
|
||||||
static
|
static
|
||||||
const token_number_type
|
const ]b4_int_type_for([b4_translate])[
|
||||||
translate_table[] =
|
translate_table[] =
|
||||||
{
|
{
|
||||||
]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 yyeof_;
|
return symbol_kind::]b4_symbol_prefix[YYEOF;
|
||||||
else if (t <= user_token_number_max_)
|
else if (t <= code_max)
|
||||||
return translate_table[t];
|
return YY_CAST (symbol_kind_type, translate_table[t]);
|
||||||
else
|
else
|
||||||
return yy_undef_token_;]])[
|
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,17 +15,23 @@
|
|||||||
# 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)
|
||||||
# --------------------------------------
|
# --------------------------------------
|
||||||
# Put TEXT in comment. Avoid trailing spaces: don't indent empty lines.
|
# Put TEXT in comment. Avoid trailing spaces: don't indent empty lines.
|
||||||
# Avoid adding indentation to the first line, as the indentation comes
|
# Avoid adding indentation to the first line, as the indentation comes
|
||||||
# from OPEN. That's why we don't patsubst([$1], [^\(.\)], [ \1]).
|
# from OPEN. That's why we don't patsubst([$1], [^\(.\)], [ \1]).
|
||||||
|
# Turn "*/" in TEXT into "* /" so that we don't unexpectedly close
|
||||||
|
# the comments before its end.
|
||||||
#
|
#
|
||||||
# Prefix all the output lines with PREFIX.
|
# Prefix all the output lines with PREFIX.
|
||||||
m4_define([_b4_comment],
|
m4_define([_b4_comment],
|
||||||
[$2[]m4_bpatsubst(m4_expand([[$1]]), [
|
[$2[]b4_gsub(m4_expand([$1]),
|
||||||
|
[[*]/], [*\\/],
|
||||||
|
[/[*]], [/\\*],
|
||||||
|
[
|
||||||
\(.\)], [
|
\(.\)], [
|
||||||
$3\1])$4])
|
$3\1])$4])
|
||||||
|
|
||||||
|
|||||||
@@ -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]])])
|
||||||
|
|||||||
+206
-102
@@ -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], [[
|
||||||
@@ -101,6 +101,7 @@ m4_define_default([b4_prefix], [b4_api_prefix])
|
|||||||
b4_percent_define_default([[api.value.union.name]],
|
b4_percent_define_default([[api.value.union.name]],
|
||||||
[b4_api_PREFIX[][STYPE]])
|
[b4_api_PREFIX[][STYPE]])
|
||||||
|
|
||||||
|
b4_percent_define_default([[api.symbol.prefix]], [[YYSYMBOL_]])
|
||||||
|
|
||||||
## ------------------------ ##
|
## ------------------------ ##
|
||||||
## Pure/impure interfaces. ##
|
## Pure/impure interfaces. ##
|
||||||
@@ -129,6 +130,13 @@ m4_define([b4_user_args],
|
|||||||
[m4_ifset([b4_parse_param], [, b4_args(b4_parse_param)])])
|
[m4_ifset([b4_parse_param], [, b4_args(b4_parse_param)])])
|
||||||
|
|
||||||
|
|
||||||
|
# b4_user_formals
|
||||||
|
# ---------------
|
||||||
|
# The possible parse-params formal arguments preceded by a comma.
|
||||||
|
m4_define([b4_user_formals],
|
||||||
|
[m4_ifset([b4_parse_param], [, b4_formals(b4_parse_param)])])
|
||||||
|
|
||||||
|
|
||||||
# b4_parse_param
|
# b4_parse_param
|
||||||
# --------------
|
# --------------
|
||||||
# If defined, b4_parse_param arrives double quoted, but below we prefer
|
# If defined, b4_parse_param arrives double quoted, but below we prefer
|
||||||
@@ -152,11 +160,11 @@ m4_popdef([$1])dnl
|
|||||||
|
|
||||||
# b4_parse_param_use([VAL], [LOC])
|
# b4_parse_param_use([VAL], [LOC])
|
||||||
# --------------------------------
|
# --------------------------------
|
||||||
# 'YYUSE' VAL, LOC if locations are enabled, and all the parse-params.
|
# '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], [ YY_USE ([$1]);])dnl
|
||||||
b4_locations_if([m4_ifvaln([$2], [ YYUSE ([$2]);])])dnl
|
b4_locations_if([m4_ifvaln([$2], [ YY_USE ([$2]);])])dnl
|
||||||
b4_parse_param_for([Decl], [Formal], [ YYUSE (Formal);
|
b4_parse_param_for([Decl], [Formal], [ YY_USE (Formal);
|
||||||
])dnl
|
])dnl
|
||||||
])
|
])
|
||||||
|
|
||||||
@@ -197,7 +205,11 @@ m4_define([b4_c99_int_type],
|
|||||||
# Define private types suitable for holding small integers in C99 or later.
|
# Define private types suitable for holding small integers in C99 or later.
|
||||||
m4_define([b4_c99_int_type_define],
|
m4_define([b4_c99_int_type_define],
|
||||||
[m4_copy_force([b4_c99_int_type], [b4_int_type])dnl
|
[m4_copy_force([b4_c99_int_type], [b4_int_type])dnl
|
||||||
[/* On compilers that do not define __PTRDIFF_MAX__ etc., make sure
|
[#ifdef short
|
||||||
|
# undef short
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* On compilers that do not define __PTRDIFF_MAX__ etc., make sure
|
||||||
<limits.h> and (if available) <stdint.h> are included
|
<limits.h> and (if available) <stdint.h> are included
|
||||||
so that the code can choose integer types of a good width. */
|
so that the code can choose integer types of a good width. */
|
||||||
|
|
||||||
@@ -230,6 +242,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 \
|
||||||
@@ -253,6 +277,50 @@ typedef int yytype_uint16;
|
|||||||
#endif]])
|
#endif]])
|
||||||
|
|
||||||
|
|
||||||
|
# b4_sizes_types_define
|
||||||
|
# ---------------------
|
||||||
|
# Define YYPTRDIFF_T/YYPTRDIFF_MAXIMUM, YYSIZE_T/YYSIZE_MAXIMUM,
|
||||||
|
# and YYSIZEOF.
|
||||||
|
m4_define([b4_sizes_types_define],
|
||||||
|
[[#ifndef YYPTRDIFF_T
|
||||||
|
# if defined __PTRDIFF_TYPE__ && defined __PTRDIFF_MAX__
|
||||||
|
# define YYPTRDIFF_T __PTRDIFF_TYPE__
|
||||||
|
# define YYPTRDIFF_MAXIMUM __PTRDIFF_MAX__
|
||||||
|
# elif defined PTRDIFF_MAX
|
||||||
|
# ifndef ptrdiff_t
|
||||||
|
# include <stddef.h> /* INFRINGES ON USER NAME SPACE */
|
||||||
|
# endif
|
||||||
|
# define YYPTRDIFF_T ptrdiff_t
|
||||||
|
# define YYPTRDIFF_MAXIMUM PTRDIFF_MAX
|
||||||
|
# else
|
||||||
|
# define YYPTRDIFF_T long
|
||||||
|
# define YYPTRDIFF_MAXIMUM LONG_MAX
|
||||||
|
# endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef YYSIZE_T
|
||||||
|
# ifdef __SIZE_TYPE__
|
||||||
|
# define YYSIZE_T __SIZE_TYPE__
|
||||||
|
# elif defined size_t
|
||||||
|
# define YYSIZE_T size_t
|
||||||
|
# elif defined __STDC_VERSION__ && 199901 <= __STDC_VERSION__
|
||||||
|
# include <stddef.h> /* INFRINGES ON USER NAME SPACE */
|
||||||
|
# define YYSIZE_T size_t
|
||||||
|
# else
|
||||||
|
# define YYSIZE_T unsigned
|
||||||
|
# endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define YYSIZE_MAXIMUM \
|
||||||
|
YY_CAST (YYPTRDIFF_T, \
|
||||||
|
(YYPTRDIFF_MAXIMUM < YY_CAST (YYSIZE_T, -1) \
|
||||||
|
? YYPTRDIFF_MAXIMUM \
|
||||||
|
: YY_CAST (YYSIZE_T, -1)))
|
||||||
|
|
||||||
|
#define YYSIZEOF(X) YY_CAST (YYPTRDIFF_T, sizeof (X))
|
||||||
|
]])
|
||||||
|
|
||||||
|
|
||||||
# b4_int_type_for(NAME)
|
# b4_int_type_for(NAME)
|
||||||
# ---------------------
|
# ---------------------
|
||||||
# Return a narrow int type able to handle numbers ranging from
|
# Return a narrow int type able to handle numbers ranging from
|
||||||
@@ -299,17 +367,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)
|
||||||
@@ -320,9 +398,9 @@ 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__
|
#if defined __GNUC__ && ! defined __ICC && 407 <= __GNUC__ * 100 + __GNUC_MINOR__
|
||||||
@@ -418,9 +496,22 @@ static const b4_int_type_for([$2]) yy$1[[]] =
|
|||||||
])
|
])
|
||||||
|
|
||||||
|
|
||||||
## ------------------------- ##
|
## ------------- ##
|
||||||
## Assigning token numbers. ##
|
## Token kinds. ##
|
||||||
## ------------------------- ##
|
## ------------- ##
|
||||||
|
|
||||||
|
# Because C enums are not scoped, because tokens are exposed in the
|
||||||
|
# header, and because these tokens are common to all the parsers, we
|
||||||
|
# need to make sure their names don't collide: use the api.prefix.
|
||||||
|
# YYEOF is special, since the user may give it a different name.
|
||||||
|
m4_define([b4_symbol(-2, id)], [b4_api_PREFIX[][EMPTY]])
|
||||||
|
m4_define([b4_symbol(-2, tag)], [[No symbol.]])
|
||||||
|
|
||||||
|
m4_if(b4_symbol(0, id), [YYEOF],
|
||||||
|
[m4_define([b4_symbol(0, id)], [b4_api_PREFIX[][EOF]])])
|
||||||
|
m4_define([b4_symbol(1, id)], [b4_api_PREFIX[][error]])
|
||||||
|
m4_define([b4_symbol(2, id)], [b4_api_PREFIX[][UNDEF]])
|
||||||
|
|
||||||
|
|
||||||
# b4_token_define(TOKEN-NUM)
|
# b4_token_define(TOKEN-NUM)
|
||||||
# --------------------------
|
# --------------------------
|
||||||
@@ -432,44 +523,92 @@ 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([/* Tokens. */
|
[[/* Token kinds. */
|
||||||
m4_join([
|
#define ]b4_symbol([-2], [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)
|
||||||
# ------------------------
|
# ------------------------
|
||||||
# Output the definition of this token as an enum.
|
# Output the definition of this token as an enum.
|
||||||
m4_define([b4_token_enum],
|
m4_define([b4_token_enum],
|
||||||
[b4_token_format([%s = %s], [$1])])
|
[b4_token_visible_if([$1],
|
||||||
|
[m4_format([ %-30s %s],
|
||||||
|
m4_format([[%s = %s%s%s]],
|
||||||
|
b4_symbol([$1], [id]),
|
||||||
|
b4_symbol([$1], b4_api_token_raw_if([[number]], [[code]])),
|
||||||
|
m4_if([$1], b4_last_enum_token, [], [[,]])),
|
||||||
|
[b4_symbol_tag_comment([$1])])])])
|
||||||
|
|
||||||
|
|
||||||
# b4_token_enums
|
# b4_token_enums
|
||||||
# --------------
|
# --------------
|
||||||
# Output the definition of the tokens (if there are) as enums.
|
# The definition of the token kinds.
|
||||||
m4_define([b4_token_enums],
|
m4_define([b4_token_enums],
|
||||||
[b4_any_token_visible_if([[/* Token type. */
|
[b4_any_token_visible_if([[/* Token kinds. */
|
||||||
#ifndef ]b4_api_PREFIX[TOKENTYPE
|
#ifndef ]b4_api_PREFIX[TOKENTYPE
|
||||||
# define ]b4_api_PREFIX[TOKENTYPE
|
# define ]b4_api_PREFIX[TOKENTYPE
|
||||||
enum ]b4_api_prefix[tokentype
|
enum ]b4_api_prefix[tokentype
|
||||||
{
|
{
|
||||||
]m4_join([,
|
]b4_symbol([-2], [id])[ = -2,
|
||||||
],
|
]b4_symbol_foreach([b4_token_enum])dnl
|
||||||
b4_symbol_map([b4_token_enum]))[
|
[ };
|
||||||
};
|
typedef enum ]b4_api_prefix[tokentype ]b4_api_prefix[token_kind_t;
|
||||||
#endif
|
#endif
|
||||||
]])])
|
]])])
|
||||||
|
|
||||||
|
|
||||||
# b4_token_enums_defines
|
# b4_token_enums_defines
|
||||||
# ----------------------
|
# ----------------------
|
||||||
# Output the definition of the tokens (if there are any) as enums and,
|
# The definition of the tokens (if there are any) as enums and,
|
||||||
# if POSIX Yacc is enabled, as #defines.
|
# if POSIX Yacc is enabled, as #defines.
|
||||||
m4_define([b4_token_enums_defines],
|
m4_define([b4_token_enums_defines],
|
||||||
[b4_token_enums[]b4_yacc_if([b4_token_defines])])
|
[b4_token_enums[]b4_yacc_if([b4_token_defines])])
|
||||||
|
|
||||||
|
|
||||||
|
# b4_symbol_translate(STRING)
|
||||||
|
# ---------------------------
|
||||||
|
# Used by "bison" in the array of symbol names to mark those that
|
||||||
|
# require translation.
|
||||||
|
m4_define([b4_symbol_translate],
|
||||||
|
[[N_($1)]])
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## -------------- ##
|
||||||
|
## Symbol kinds. ##
|
||||||
|
## -------------- ##
|
||||||
|
|
||||||
|
# b4_symbol_enum(SYMBOL-NUM)
|
||||||
|
# --------------------------
|
||||||
|
# Output the definition of this symbol as an enum.
|
||||||
|
m4_define([b4_symbol_enum],
|
||||||
|
[m4_format([ %-40s %s],
|
||||||
|
m4_format([[%s = %s%s%s]],
|
||||||
|
b4_symbol([$1], [kind_base]),
|
||||||
|
[$1],
|
||||||
|
m4_if([$1], b4_last_symbol, [], [[,]])),
|
||||||
|
[b4_symbol_tag_comment([$1])])])
|
||||||
|
|
||||||
|
|
||||||
|
# b4_declare_symbol_enum
|
||||||
|
# ----------------------
|
||||||
|
# The definition of the symbol internal numbers as an enum.
|
||||||
|
# Defining YYEMPTY here is important: it forces the compiler
|
||||||
|
# to use a signed type, which matters for yytoken.
|
||||||
|
m4_define([b4_declare_symbol_enum],
|
||||||
|
[[/* Symbol kind. */
|
||||||
|
enum yysymbol_kind_t
|
||||||
|
{
|
||||||
|
]b4_symbol([-2], kind_base)[ = -2,
|
||||||
|
]b4_symbol_foreach([b4_symbol_enum])dnl
|
||||||
|
[};
|
||||||
|
typedef enum yysymbol_kind_t yysymbol_kind_t;
|
||||||
|
]])])
|
||||||
|
|
||||||
|
|
||||||
## ----------------- ##
|
## ----------------- ##
|
||||||
## Semantic Values. ##
|
## Semantic Values. ##
|
||||||
## ----------------- ##
|
## ----------------- ##
|
||||||
@@ -493,15 +632,6 @@ m4_define([b4_symbol_value],
|
|||||||
## ---------------------- ##
|
## ---------------------- ##
|
||||||
|
|
||||||
|
|
||||||
# b4_function_define(NAME, RETURN-VALUE, [DECL1, NAME1], ...)
|
|
||||||
# -----------------------------------------------------------
|
|
||||||
# Declare the function NAME in C.
|
|
||||||
m4_define([b4_function_define],
|
|
||||||
[$2
|
|
||||||
$1 (b4_formals(m4_shift2($@)))[]dnl
|
|
||||||
])
|
|
||||||
|
|
||||||
|
|
||||||
# b4_formals([DECL1, NAME1], ...)
|
# b4_formals([DECL1, NAME1], ...)
|
||||||
# -------------------------------
|
# -------------------------------
|
||||||
# The formal arguments of a C function definition.
|
# The formal arguments of a C function definition.
|
||||||
@@ -515,21 +645,6 @@ m4_define([b4_formal],
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
## ----------------------- ##
|
|
||||||
## Declaring C functions. ##
|
|
||||||
## ----------------------- ##
|
|
||||||
|
|
||||||
|
|
||||||
# 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. ##
|
||||||
## --------------------- ##
|
## --------------------- ##
|
||||||
@@ -566,10 +681,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;])
|
||||||
@@ -593,18 +708,15 @@ m4_define_default([b4_yydestruct_define],
|
|||||||
| Release the memory associated to this symbol. |
|
| Release the memory associated to this symbol. |
|
||||||
`-----------------------------------------------*/
|
`-----------------------------------------------*/
|
||||||
|
|
||||||
]b4_function_define([yydestruct],
|
static void
|
||||||
[static void],
|
yydestruct (const char *yymsg,
|
||||||
[[const char *yymsg], [yymsg]],
|
yysymbol_kind_t yykind, YYSTYPE *yyvaluep]b4_locations_if(dnl
|
||||||
[[int yytype], [yytype]],
|
[[, YYLTYPE *yylocationp]])[]b4_user_formals[)
|
||||||
[[YYSTYPE *yyvaluep], [yyvaluep]][]dnl
|
|
||||||
b4_locations_if( [, [[YYLTYPE *yylocationp], [yylocationp]]])[]dnl
|
|
||||||
m4_ifset([b4_parse_param], [, b4_parse_param]))[
|
|
||||||
{
|
{
|
||||||
]b4_parse_param_use([yyvaluep], [yylocationp])dnl
|
]b4_parse_param_use([yyvaluep], [yylocationp])dnl
|
||||||
[ if (!yymsg)
|
[ if (!yymsg)
|
||||||
yymsg = "Deleting";
|
yymsg = "Deleting";
|
||||||
YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);
|
YY_SYMBOL_PRINT (yymsg, yykind, yyvaluep, yylocationp);
|
||||||
|
|
||||||
YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
|
YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
|
||||||
]b4_symbol_actions([destructor])[
|
]b4_symbol_actions([destructor])[
|
||||||
@@ -622,13 +734,10 @@ m4_define_default([b4_yy_symbol_print_define],
|
|||||||
| Print this symbol's value on YYO. |
|
| Print this symbol's value on YYO. |
|
||||||
`-----------------------------------*/
|
`-----------------------------------*/
|
||||||
|
|
||||||
]b4_function_define([yy_symbol_value_print],
|
static void
|
||||||
[static void],
|
yy_symbol_value_print (FILE *yyo,
|
||||||
[[FILE *yyo], [yyo]],
|
yysymbol_kind_t yykind, YYSTYPE const * const yyvaluep]b4_locations_if(dnl
|
||||||
[[int yytype], [yytype]],
|
[[, YYLTYPE const * const yylocationp]])[]b4_user_formals[)
|
||||||
[[YYSTYPE const * const yyvaluep], [yyvaluep]][]dnl
|
|
||||||
b4_locations_if([, [[YYLTYPE const * const yylocationp], [yylocationp]]])[]dnl
|
|
||||||
m4_ifset([b4_parse_param], [, b4_parse_param]))[
|
|
||||||
{
|
{
|
||||||
FILE *yyoutput = yyo;
|
FILE *yyoutput = yyo;
|
||||||
]b4_parse_param_use([yyoutput], [yylocationp])dnl
|
]b4_parse_param_use([yyoutput], [yylocationp])dnl
|
||||||
@@ -637,8 +746,8 @@ m4_ifset([b4_parse_param], [, b4_parse_param]))[
|
|||||||
dnl glr.c does not feature yytoknum.
|
dnl glr.c does not feature yytoknum.
|
||||||
m4_if(b4_skeleton, ["yacc.c"],
|
m4_if(b4_skeleton, ["yacc.c"],
|
||||||
[[# ifdef YYPRINT
|
[[# ifdef YYPRINT
|
||||||
if (yytype < YYNTOKENS)
|
if (yykind < YYNTOKENS)
|
||||||
YYPRINT (yyo, yytoknum[yytype], *yyvaluep);
|
YYPRINT (yyo, yytoknum[yykind], *yyvaluep);
|
||||||
# endif
|
# endif
|
||||||
]])dnl
|
]])dnl
|
||||||
b4_percent_code_get([[pre-printer]])dnl
|
b4_percent_code_get([[pre-printer]])dnl
|
||||||
@@ -653,21 +762,18 @@ b4_percent_code_get([[post-printer]])dnl
|
|||||||
| Print this symbol on YYO. |
|
| Print this symbol on YYO. |
|
||||||
`---------------------------*/
|
`---------------------------*/
|
||||||
|
|
||||||
]b4_function_define([yy_symbol_print],
|
static void
|
||||||
[static void],
|
yy_symbol_print (FILE *yyo,
|
||||||
[[FILE *yyo], [yyo]],
|
yysymbol_kind_t yykind, YYSTYPE const * const yyvaluep]b4_locations_if(dnl
|
||||||
[[int yytype], [yytype]],
|
[[, YYLTYPE const * const yylocationp]])[]b4_user_formals[)
|
||||||
[[YYSTYPE const * const yyvaluep], [yyvaluep]][]dnl
|
|
||||||
b4_locations_if([, [[YYLTYPE const * const yylocationp], [yylocationp]]])[]dnl
|
|
||||||
m4_ifset([b4_parse_param], [, b4_parse_param]))[
|
|
||||||
{
|
{
|
||||||
YYFPRINTF (yyo, "%s %s (",
|
YYFPRINTF (yyo, "%s %s (",
|
||||||
yytype < YYNTOKENS ? "token" : "nterm", yytname[yytype]);
|
yykind < YYNTOKENS ? "token" : "nterm", yysymbol_name (yykind));
|
||||||
|
|
||||||
]b4_locations_if([ YY_LOCATION_PRINT (yyo, *yylocationp);
|
]b4_locations_if([ YY_LOCATION_PRINT (yyo, *yylocationp);
|
||||||
YYFPRINTF (yyo, ": ");
|
YYFPRINTF (yyo, ": ");
|
||||||
])dnl
|
])dnl
|
||||||
[ yy_symbol_value_print (yyo, yytype, yyvaluep]dnl
|
[ yy_symbol_value_print (yyo, yykind, yyvaluep]dnl
|
||||||
b4_locations_if([, yylocationp])[]b4_user_args[);
|
b4_locations_if([, yylocationp])[]b4_user_args[);
|
||||||
YYFPRINTF (yyo, ")");
|
YYFPRINTF (yyo, ")");
|
||||||
}]dnl
|
}]dnl
|
||||||
@@ -693,11 +799,11 @@ m4_define([b4_symbol_type_register],
|
|||||||
[m4_define([b4_symbol($1, type_tag)],
|
[m4_define([b4_symbol($1, type_tag)],
|
||||||
[b4_symbol_if([$1], [has_id],
|
[b4_symbol_if([$1], [has_id],
|
||||||
[b4_symbol([$1], [id])],
|
[b4_symbol([$1], [id])],
|
||||||
[yytype_[]b4_symbol([$1], [number])])])dnl
|
[yykind_[]b4_symbol([$1], [number])])])dnl
|
||||||
m4_append([b4_union_members],
|
m4_append([b4_union_members],
|
||||||
m4_expand([
|
m4_expand([m4_format([ %-40s %s],
|
||||||
b4_symbol_tag_comment([$1])dnl
|
m4_expand([b4_symbol([$1], [type]) b4_symbol([$1], [type_tag]);]),
|
||||||
b4_symbol([$1], [type]) b4_symbol([$1], [type_tag]);]))
|
[b4_symbol_tag_comment([$1])])]))
|
||||||
])
|
])
|
||||||
|
|
||||||
|
|
||||||
@@ -930,16 +1036,14 @@ m4_define([b4_yy_location_print_define],
|
|||||||
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 YY_LOCATION_PRINT
|
||||||
# if defined ]b4_api_PREFIX[LTYPE_IS_TRIVIAL && ]b4_api_PREFIX[LTYPE_IS_TRIVIAL
|
# if defined ]b4_api_PREFIX[LTYPE_IS_TRIVIAL && ]b4_api_PREFIX[LTYPE_IS_TRIVIAL
|
||||||
|
|
||||||
/* Print *YYLOCP on YYO. Private, do not rely on its existence. */
|
/* Print *YYLOCP on YYO. Private, do not rely on its existence. */
|
||||||
|
|
||||||
YY_ATTRIBUTE_UNUSED
|
YY_ATTRIBUTE_UNUSED
|
||||||
]b4_function_define([yy_location_print_],
|
static int
|
||||||
[static int],
|
yy_location_print_ (FILE *yyo, YYLTYPE const * const yylocp)
|
||||||
[[FILE *yyo], [yyo]],
|
|
||||||
[[YYLTYPE const * const yylocp], [yylocp]])[
|
|
||||||
{
|
{
|
||||||
int res = 0;
|
int res = 0;
|
||||||
int end_col = 0 != yylocp->last_column ? yylocp->last_column - 1 : 0;
|
int end_col = 0 != yylocp->last_column ? yylocp->last_column - 1 : 0;
|
||||||
@@ -963,17 +1067,17 @@ YY_ATTRIBUTE_UNUSED
|
|||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
# define YY_LOCATION_PRINT(File, Loc) \
|
# define YY_LOCATION_PRINT(File, Loc) \
|
||||||
yy_location_print_ (File, &(Loc))
|
yy_location_print_ (File, &(Loc))
|
||||||
|
|
||||||
# else
|
# else
|
||||||
# define YY_LOCATION_PRINT(File, Loc) ((void) 0)
|
# define YY_LOCATION_PRINT(File, Loc) ((void) 0)
|
||||||
# endif
|
# endif
|
||||||
#endif]],
|
# endif /* !defined YY_LOCATION_PRINT */]],
|
||||||
[[/* This macro is provided for backward compatibility. */
|
[[/* This macro is provided for backward compatibility. */
|
||||||
#ifndef YY_LOCATION_PRINT
|
# ifndef YY_LOCATION_PRINT
|
||||||
# define YY_LOCATION_PRINT(File, Loc) ((void) 0)
|
# define YY_LOCATION_PRINT(File, Loc) ((void) 0)
|
||||||
#endif]])
|
# 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])])
|
||||||
|
|||||||
+61
-20
@@ -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,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)
|
||||||
@@ -103,12 +103,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[;
|
||||||
])
|
]])
|
||||||
|
|
||||||
|
|
||||||
## ------------ ##
|
## ------------ ##
|
||||||
@@ -148,9 +148,11 @@ private static immutable b4_int_type_for([$2])[[]] yy$1_ =
|
|||||||
])
|
])
|
||||||
|
|
||||||
|
|
||||||
## ------------------------- ##
|
## ------------- ##
|
||||||
## Assigning token numbers. ##
|
## Token kinds. ##
|
||||||
## ------------------------- ##
|
## ------------- ##
|
||||||
|
|
||||||
|
m4_define([b4_symbol(-2, id)], [[YYEMPTY]])
|
||||||
|
|
||||||
# b4_token_enum(TOKEN-NAME, TOKEN-NUMBER)
|
# b4_token_enum(TOKEN-NAME, TOKEN-NUMBER)
|
||||||
# ---------------------------------------
|
# ---------------------------------------
|
||||||
@@ -159,22 +161,61 @@ m4_define([b4_token_enum],
|
|||||||
[b4_token_format([ %s = %s,
|
[b4_token_format([ %s = %s,
|
||||||
], [$1])])
|
], [$1])])
|
||||||
|
|
||||||
# b4_token_enums(LIST-OF-PAIRS-TOKEN-NAME-TOKEN-NUMBER)
|
# b4_token_enums
|
||||||
# -----------------------------------------------------
|
# --------------
|
||||||
# Output the definition of the tokens as enums.
|
# Output the definition of the tokens as enums.
|
||||||
m4_define([b4_token_enums],
|
m4_define([b4_token_enums],
|
||||||
[/* Tokens. */
|
[/* Token kinds. */
|
||||||
public enum YYTokenType {
|
public enum TokenKind {
|
||||||
|
]b4_symbol_kind([-2])[ = -2,
|
||||||
/** Token returned by the scanner to signal the end of its input. */
|
b4_symbol_foreach([b4_token_enum])dnl
|
||||||
EOF = 0,
|
|
||||||
b4_symbol_foreach([b4_token_enum])
|
|
||||||
}
|
}
|
||||||
])
|
])
|
||||||
|
|
||||||
# b4-case(ID, CODE)
|
|
||||||
# -----------------
|
|
||||||
m4_define([b4_case], [ case $1:
|
## -------------- ##
|
||||||
|
## 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)
|
||||||
|
# --------------------------
|
||||||
|
# Output the definition of this symbol as an enum.
|
||||||
|
m4_define([b4_symbol_enum],
|
||||||
|
[m4_format([ %-30s %s],
|
||||||
|
m4_format([[%s = %s,]],
|
||||||
|
b4_symbol([$1], [kind_base]),
|
||||||
|
[$1]),
|
||||||
|
[b4_symbol_tag_comment([$1])])])
|
||||||
|
|
||||||
|
|
||||||
|
# b4_declare_symbol_enum
|
||||||
|
# ----------------------
|
||||||
|
# The definition of the symbol internal numbers as an enum.
|
||||||
|
# Defining YYEMPTY here is important: it forces the compiler
|
||||||
|
# to use a signed type, which matters for yytoken.
|
||||||
|
m4_define([b4_declare_symbol_enum],
|
||||||
|
[[ /* Symbol kinds. */
|
||||||
|
public enum SymbolKind
|
||||||
|
{
|
||||||
|
]b4_symbol(-2, kind_base)[ = -2, /* No symbol. */
|
||||||
|
]b4_symbol_foreach([b4_symbol_enum])dnl
|
||||||
|
[ };
|
||||||
|
]])])
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# b4-case(ID, CODE, [COMMENTS])
|
||||||
|
# -----------------------------
|
||||||
|
m4_define([b4_case], [ case $1:m4_ifval([$3], [ b4_comment([$3])])
|
||||||
$2
|
$2
|
||||||
break;])
|
break;])
|
||||||
|
|
||||||
|
|||||||
+480
-374
File diff suppressed because it is too large
Load Diff
+93
-80
@@ -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.
|
||||||
@@ -72,24 +72,17 @@ m4_defn([b4_parse_param]))],
|
|||||||
# Bypass the default implementation to generate the "yy_symbol_print"
|
# Bypass the default implementation to generate the "yy_symbol_print"
|
||||||
# and "yy_symbol_value_print" functions.
|
# and "yy_symbol_value_print" functions.
|
||||||
m4_define([b4_yy_symbol_print_define],
|
m4_define([b4_yy_symbol_print_define],
|
||||||
[[
|
[[/*--------------------.
|
||||||
/*--------------------.
|
|
||||||
| Print this symbol. |
|
| Print this symbol. |
|
||||||
`--------------------*/
|
`--------------------*/
|
||||||
|
|
||||||
]b4_function_define([yy_symbol_print],
|
static void
|
||||||
[static void],
|
yy_symbol_print (FILE *, ]b4_namespace_ref::b4_parser_class[::symbol_kind_type yytoken,
|
||||||
[[FILE *], []],
|
const ]b4_namespace_ref::b4_parser_class[::semantic_type *yyvaluep]b4_locations_if([[,
|
||||||
[[int yytype], [yytype]],
|
const ]b4_namespace_ref::b4_parser_class[::location_type *yylocationp]])[]b4_user_formals[)
|
||||||
[[const ]b4_namespace_ref::b4_parser_class[::semantic_type *yyvaluep],
|
|
||||||
[yyvaluep]][]dnl
|
|
||||||
b4_locations_if([,
|
|
||||||
[[const ]b4_namespace_ref::b4_parser_class[::location_type *yylocationp],
|
|
||||||
[yylocationp]]]),
|
|
||||||
b4_parse_param)[
|
|
||||||
{
|
{
|
||||||
]b4_parse_param_use[]dnl
|
]b4_parse_param_use[]dnl
|
||||||
[ yyparser.yy_symbol_print_ (yytype, yyvaluep]b4_locations_if([, yylocationp])[);
|
[ yyparser.yy_symbol_print_ (yytoken, yyvaluep]b4_locations_if([, yylocationp])[);
|
||||||
}
|
}
|
||||||
]])[
|
]])[
|
||||||
|
|
||||||
@@ -101,45 +94,24 @@ m4_defn([b4_initial_action])]))])[
|
|||||||
# Hijack the post prologue to declare yyerror.
|
# Hijack the post prologue to declare yyerror.
|
||||||
]m4_append([b4_post_prologue],
|
]m4_append([b4_post_prologue],
|
||||||
[b4_syncline([@oline@], [@ofile@])dnl
|
[b4_syncline([@oline@], [@ofile@])dnl
|
||||||
b4_function_declare([yyerror],
|
[static void
|
||||||
[static void],b4_locations_if([
|
yyerror (]b4_locations_if([[const ]b4_namespace_ref::b4_parser_class[::location_type *yylocationp,
|
||||||
[[const ]b4_namespace_ref::b4_parser_class[::location_type *yylocationp],
|
]])[]m4_ifset([b4_parse_param], [b4_formals(b4_parse_param),
|
||||||
[yylocationp]],])
|
])[const char* msg);]])[
|
||||||
b4_parse_param,
|
|
||||||
[[const char* msg], [msg]])])[
|
|
||||||
|
|
||||||
|
# Inserted before the epilogue to define implementations (yyerror, parser member
|
||||||
#undef yynerrs
|
|
||||||
#undef yychar
|
|
||||||
#undef yylval]b4_locations_if([
|
|
||||||
#undef yylloc])
|
|
||||||
|
|
||||||
m4_if(b4_prefix, [yy], [],
|
|
||||||
[[/* Substitute the variable and function names. */
|
|
||||||
#define yyparse ]b4_prefix[parse
|
|
||||||
#define yylex ]b4_prefix[lex
|
|
||||||
#define yyerror ]b4_prefix[error
|
|
||||||
#define yydebug ]b4_prefix[debug]]b4_pure_if([], [[
|
|
||||||
#define yylval ]b4_prefix[lval
|
|
||||||
#define yychar ]b4_prefix[char
|
|
||||||
#define yynerrs ]b4_prefix[nerrs]b4_locations_if([[
|
|
||||||
#define yylloc ]b4_prefix[lloc]])]))
|
|
||||||
|
|
||||||
# Hijack the epilogue to define implementations (yyerror, parser member
|
|
||||||
# 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
|
||||||
[
|
[
|
||||||
/*------------------.
|
/*------------------.
|
||||||
| Report an error. |
|
| Report an error. |
|
||||||
`------------------*/
|
`------------------*/
|
||||||
|
|
||||||
]b4_function_define([yyerror],
|
static void
|
||||||
[static void],b4_locations_if([
|
yyerror (]b4_locations_if([[const ]b4_namespace_ref::b4_parser_class[::location_type *yylocationp,
|
||||||
[[const ]b4_namespace_ref::b4_parser_class[::location_type *yylocationp],
|
]])[]m4_ifset([b4_parse_param], [b4_formals(b4_parse_param),
|
||||||
[yylocationp]],])
|
])[const char* msg)
|
||||||
b4_parse_param,
|
|
||||||
[[const char* msg], [msg]])[
|
|
||||||
{
|
{
|
||||||
]b4_parse_param_use[]dnl
|
]b4_parse_param_use[]dnl
|
||||||
[ yyparser.error (]b4_locations_if([[*yylocationp, ]])[msg);
|
[ yyparser.error (]b4_locations_if([[*yylocationp, ]])[msg);
|
||||||
@@ -172,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
|
||||||
@@ -181,28 +153,28 @@ m4_pushdef([b4_parse_param], m4_defn([b4_parse_param_orig]))dnl
|
|||||||
`--------------------*/
|
`--------------------*/
|
||||||
|
|
||||||
void
|
void
|
||||||
]b4_parser_class[::yy_symbol_value_print_ (int yytype,
|
]b4_parser_class[::yy_symbol_value_print_ (symbol_kind_type yykind,
|
||||||
const semantic_type* yyvaluep]b4_locations_if([[,
|
const semantic_type* yyvaluep]b4_locations_if([[,
|
||||||
const location_type* yylocationp]])[)
|
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_ (int yytype,
|
]b4_parser_class[::yy_symbol_print_ (symbol_kind_type yykind,
|
||||||
const semantic_type* yyvaluep]b4_locations_if([[,
|
const semantic_type* yyvaluep]b4_locations_if([[,
|
||||||
const location_type* yylocationp]])[)
|
const location_type* yylocationp]])[) const
|
||||||
{
|
{
|
||||||
*yycdebug_ << (yytype < YYNTOKENS ? "token" : "nterm")
|
*yycdebug_ << (yykind < YYNTOKENS ? "token" : "nterm")
|
||||||
<< ' ' << yytname[yytype] << " ("]b4_locations_if([[
|
<< ' ' << yysymbol_name (yykind) << " ("]b4_locations_if([[
|
||||||
<< *yylocationp << ": "]])[;
|
<< *yylocationp << ": "]])[;
|
||||||
yy_symbol_value_print_ (yytype, yyvaluep]b4_locations_if([[, yylocationp]])[);
|
yy_symbol_value_print_ (yykind, yyvaluep]b4_locations_if([[, yylocationp]])[);
|
||||||
*yycdebug_ << ')';
|
*yycdebug_ << ')';
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -238,6 +210,57 @@ b4_namespace_close[]dnl
|
|||||||
])
|
])
|
||||||
|
|
||||||
|
|
||||||
|
m4_define([b4_define_symbol_kind],
|
||||||
|
[m4_format([#define %-15s %s],
|
||||||
|
b4_symbol($][1, kind_base),
|
||||||
|
b4_namespace_ref[::]b4_parser_class[::symbol_kind::]b4_symbol($1, kind_base))
|
||||||
|
])
|
||||||
|
|
||||||
|
# b4_glr_cc_setup
|
||||||
|
# ---------------
|
||||||
|
# Setup redirections for glr.c: Map the names used in c.m4 to the ones used
|
||||||
|
# in c++.m4.
|
||||||
|
m4_define([b4_glr_cc_setup],
|
||||||
|
[[#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
|
||||||
|
|
||||||
|
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(-2, [id])[
|
||||||
|
#undef ]b4_symbol(0, [id])[
|
||||||
|
#undef ]b4_symbol(1, [id])[
|
||||||
|
|
||||||
|
]b4_undef_symbol_kind(-2)dnl
|
||||||
|
b4_symbol_foreach([b4_undef_symbol_kind])dnl
|
||||||
|
])
|
||||||
|
|
||||||
|
|
||||||
# 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 --defines, $1 = hh)
|
||||||
@@ -328,53 +351,43 @@ b4_percent_code_get([[requires]])[
|
|||||||
# if ]b4_api_PREFIX[DEBUG
|
# if ]b4_api_PREFIX[DEBUG
|
||||||
public:
|
public:
|
||||||
/// \brief Report a symbol value on the debug stream.
|
/// \brief Report a symbol value on the debug stream.
|
||||||
/// \param yytype The token type.
|
/// \param 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_value_print_ (int yytype,
|
virtual void yy_symbol_value_print_ (symbol_kind_type yykind,
|
||||||
const semantic_type* yyvaluep]b4_locations_if([[,
|
const semantic_type* yyvaluep]b4_locations_if([[,
|
||||||
const location_type* yylocationp]])[);
|
const location_type* yylocationp]])[) const;
|
||||||
/// \brief Report a symbol on the debug stream.
|
/// \brief Report a symbol on the debug stream.
|
||||||
/// \param yytype The token type.
|
/// \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_ (int yytype,
|
virtual void yy_symbol_print_ (symbol_kind_type yykind,
|
||||||
const semantic_type* yyvaluep]b4_locations_if([[,
|
const semantic_type* yyvaluep]b4_locations_if([[,
|
||||||
const location_type* yylocationp]])[);
|
const location_type* yylocationp]])[) const;
|
||||||
private:
|
private:
|
||||||
// Debugging.
|
/// Debug stream.
|
||||||
std::ostream* yycdebug_;
|
std::ostream* yycdebug_;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
]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])
|
|
||||||
[
|
|
||||||
#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
|
|
||||||
|
|
||||||
]b4_namespace_close[
|
]b4_namespace_close[
|
||||||
|
|
||||||
]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_defines_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
|
||||||
|
|||||||
@@ -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])])
|
||||||
|
|||||||
+153
-17
@@ -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[;
|
||||||
])
|
]])
|
||||||
|
|
||||||
|
|
||||||
## ------------ ##
|
## ------------ ##
|
||||||
@@ -106,10 +106,13 @@ m4_define([b4_null], [null])
|
|||||||
|
|
||||||
# b4_typed_parser_table_define(TYPE, NAME, DATA, COMMENT)
|
# b4_typed_parser_table_define(TYPE, NAME, DATA, COMMENT)
|
||||||
# -------------------------------------------------------
|
# -------------------------------------------------------
|
||||||
|
# We use intermediate functions (e.g., yypact_init) to work around the
|
||||||
|
# 64KB limit for JVM methods. See
|
||||||
|
# https://lists.gnu.org/r/help-bison/2008-11/msg00004.html.
|
||||||
m4_define([b4_typed_parser_table_define],
|
m4_define([b4_typed_parser_table_define],
|
||||||
[m4_ifval([$4], [b4_comment([$4])
|
[m4_ifval([$4], [b4_comment([$4])
|
||||||
])dnl
|
])dnl
|
||||||
[private static final ]$1[ yy$2_[] = yy$2_init();
|
[private static final ]$1[[] yy$2_ = yy$2_init();
|
||||||
private static final ]$1[[] yy$2_init()
|
private static final ]$1[[] yy$2_init()
|
||||||
{
|
{
|
||||||
return new ]$1[[]
|
return new ]$1[[]
|
||||||
@@ -125,35 +128,151 @@ m4_define([b4_integral_parser_table_define],
|
|||||||
[b4_typed_parser_table_define([b4_int_type_for([$2])], [$1], [$2], [$3])])
|
[b4_typed_parser_table_define([b4_int_type_for([$2])], [$1], [$2], [$3])])
|
||||||
|
|
||||||
|
|
||||||
## ------------------------- ##
|
## ------------- ##
|
||||||
## Assigning token numbers. ##
|
## Token kinds. ##
|
||||||
## ------------------------- ##
|
## ------------- ##
|
||||||
|
|
||||||
|
|
||||||
# b4_token_enum(TOKEN-NUM)
|
# b4_token_enum(TOKEN-NUM)
|
||||||
# ------------------------
|
# ------------------------
|
||||||
# Output the definition of this token as an enum.
|
# Output the definition of this token as an enum.
|
||||||
m4_define([b4_token_enum],
|
m4_define([b4_token_enum],
|
||||||
[b4_token_format([ /** Token number, to be returned by the scanner. */
|
[b4_token_visible_if([$1],
|
||||||
static final int %s = %s;
|
[m4_format([[ /** Token %s, to be returned by the scanner. */
|
||||||
], [$1])])
|
static final int %s = %s%s;
|
||||||
|
]],
|
||||||
|
b4_symbol([$1], [tag]),
|
||||||
|
b4_symbol([$1], [id]),
|
||||||
|
b4_symbol([$1], b4_api_token_raw_if([[number]], [[code]])))])])
|
||||||
|
|
||||||
|
|
||||||
# b4_token_enums
|
# b4_token_enums
|
||||||
# --------------
|
# --------------
|
||||||
# Output the definition of the tokens (if there are) as enums.
|
# Output the definition of the tokens (if there are) as enums.
|
||||||
m4_define([b4_token_enums],
|
m4_define([b4_token_enums],
|
||||||
[b4_any_token_visible_if([/* Tokens. */
|
[b4_any_token_visible_if([ /* Token kinds. */
|
||||||
b4_symbol_foreach([b4_token_enum])])])
|
b4_symbol_foreach([b4_token_enum])])])
|
||||||
|
|
||||||
# b4-case(ID, CODE)
|
|
||||||
# -----------------
|
|
||||||
|
## -------------- ##
|
||||||
|
## Symbol kinds. ##
|
||||||
|
## -------------- ##
|
||||||
|
|
||||||
|
|
||||||
|
# b4_symbol_kind(NUM)
|
||||||
|
# -------------------
|
||||||
|
m4_define([b4_symbol_kind],
|
||||||
|
[SymbolKind.b4_symbol_kind_base($@)])
|
||||||
|
|
||||||
|
|
||||||
|
# b4_symbol_enum(SYMBOL-NUM)
|
||||||
|
# --------------------------
|
||||||
|
# Output the definition of this symbol as an enum.
|
||||||
|
m4_define([b4_symbol_enum],
|
||||||
|
[m4_format([ %-30s %s],
|
||||||
|
m4_format([[%s(%s)%s]],
|
||||||
|
b4_symbol([$1], [kind_base]),
|
||||||
|
[$1],
|
||||||
|
m4_if([$1], b4_last_symbol, [[;]], [[,]])),
|
||||||
|
[b4_symbol_tag_comment([$1])])])
|
||||||
|
|
||||||
|
|
||||||
|
# b4_declare_symbol_enum
|
||||||
|
# ----------------------
|
||||||
|
# The definition of the symbol internal numbers as an enum.
|
||||||
|
m4_define([b4_declare_symbol_enum],
|
||||||
|
[[ public enum SymbolKind
|
||||||
|
{
|
||||||
|
]b4_symbol_foreach([b4_symbol_enum])[
|
||||||
|
|
||||||
|
private final int yycode_;
|
||||||
|
|
||||||
|
SymbolKind (int n) {
|
||||||
|
this.yycode_ = n;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static final SymbolKind[] values_ = {
|
||||||
|
]m4_map_args_sep([b4_symbol_kind(], [)], [,
|
||||||
|
], b4_symbol_numbers)[
|
||||||
|
};
|
||||||
|
|
||||||
|
static final SymbolKind get(int code) {
|
||||||
|
return values_[code];
|
||||||
|
}
|
||||||
|
|
||||||
|
public final int getCode() {
|
||||||
|
return this.yycode_;
|
||||||
|
}
|
||||||
|
|
||||||
|
]b4_parse_error_bmatch(
|
||||||
|
[simple\|verbose],
|
||||||
|
[[ /* Return YYSTR after stripping away unnecessary quotes and
|
||||||
|
backslashes, so that it's suitable for yyerror. The heuristic is
|
||||||
|
that double-quoting is unnecessary unless the string contains an
|
||||||
|
apostrophe, a comma, or backslash (other than backslash-backslash).
|
||||||
|
YYSTR is taken from yytname. */
|
||||||
|
private static String yytnamerr_(String yystr)
|
||||||
|
{
|
||||||
|
if (yystr.charAt (0) == '"')
|
||||||
|
{
|
||||||
|
StringBuffer yyr = new StringBuffer();
|
||||||
|
strip_quotes: for (int i = 1; i < yystr.length(); i++)
|
||||||
|
switch (yystr.charAt(i))
|
||||||
|
{
|
||||||
|
case '\'':
|
||||||
|
case ',':
|
||||||
|
break strip_quotes;
|
||||||
|
|
||||||
|
case '\\':
|
||||||
|
if (yystr.charAt(++i) != '\\')
|
||||||
|
break strip_quotes;
|
||||||
|
/* Fall through. */
|
||||||
|
default:
|
||||||
|
yyr.append(yystr.charAt(i));
|
||||||
|
break;
|
||||||
|
|
||||||
|
case '"':
|
||||||
|
return yyr.toString();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return yystr;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
|
||||||
|
First, the terminals, then, starting at \a YYNTOKENS_, nonterminals. */
|
||||||
|
]b4_typed_parser_table_define([String], [tname], [b4_tname])[
|
||||||
|
|
||||||
|
/* The user-facing name of this symbol. */
|
||||||
|
public final String getName() {
|
||||||
|
return yytnamerr_(yytname_[yycode_]);
|
||||||
|
}
|
||||||
|
]],
|
||||||
|
[custom\|detailed],
|
||||||
|
[[ /* YYNAMES_[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
|
||||||
|
First, the terminals, then, starting at \a YYNTOKENS_, nonterminals. */
|
||||||
|
]b4_typed_parser_table_define([String], [names], [b4_symbol_names])[
|
||||||
|
|
||||||
|
/* The user-facing name of this symbol. */
|
||||||
|
public final String getName() {
|
||||||
|
return yynames_[yycode_];
|
||||||
|
}]])[
|
||||||
|
};
|
||||||
|
]])])
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# 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;
|
||||||
])
|
])
|
||||||
|
|
||||||
|
|
||||||
# b4_predicate_case(LABEL, CONDITIONS)
|
# b4_predicate_case(LABEL, CONDITIONS)
|
||||||
# ------------------------------------
|
# ------------------------------------
|
||||||
m4_define([b4_predicate_case],
|
m4_define([b4_predicate_case],
|
||||||
@@ -185,6 +304,7 @@ b4_percent_define_check_kind([[throws]], [code], [deprecated])
|
|||||||
|
|
||||||
m4_define([b4_yystype], [b4_percent_define_get([[api.value.type]])])
|
m4_define([b4_yystype], [b4_percent_define_get([[api.value.type]])])
|
||||||
b4_percent_define_default([[api.value.type]], [[Object]])
|
b4_percent_define_default([[api.value.type]], [[Object]])
|
||||||
|
b4_percent_define_default([[api.symbol.prefix]], [[S_]])
|
||||||
|
|
||||||
# b4_api_prefix, b4_api_PREFIX
|
# b4_api_prefix, b4_api_PREFIX
|
||||||
# ----------------------------
|
# ----------------------------
|
||||||
@@ -224,6 +344,22 @@ m4_define([b4_position_type], [b4_percent_define_get([[api.position.type]])])
|
|||||||
## ----------------- ##
|
## ----------------- ##
|
||||||
|
|
||||||
|
|
||||||
|
# b4_symbol_translate(STRING)
|
||||||
|
# ---------------------------
|
||||||
|
# Used by "bison" in the array of symbol names to mark those that
|
||||||
|
# require translation.
|
||||||
|
m4_define([b4_symbol_translate],
|
||||||
|
[[i18n($1)]])
|
||||||
|
|
||||||
|
|
||||||
|
# b4_trans(STRING)
|
||||||
|
# ----------------
|
||||||
|
# Translate a string if i18n is enabled. Avoid collision with b4_translate.
|
||||||
|
m4_define([b4_trans],
|
||||||
|
[b4_has_translations_if([i18n($1)], [$1])])
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# b4_symbol_value(VAL, [SYMBOL-NUM], [TYPE-TAG])
|
# b4_symbol_value(VAL, [SYMBOL-NUM], [TYPE-TAG])
|
||||||
# ----------------------------------------------
|
# ----------------------------------------------
|
||||||
# See README.
|
# See README.
|
||||||
|
|||||||
+383
-226
@@ -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,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/>.
|
||||||
|
|
||||||
m4_include(b4_skeletonsdir/[c++.m4])
|
m4_include(b4_skeletonsdir/[c++.m4])
|
||||||
|
|
||||||
@@ -30,6 +30,15 @@ m4_define([b4_lac_flag],
|
|||||||
[none], [[0]], [[1]])])
|
[none], [[0]], [[1]])])
|
||||||
|
|
||||||
|
|
||||||
|
# b4_tname_if(TNAME-NEEDED, TNAME-NOT-NEEDED)
|
||||||
|
# -------------------------------------------
|
||||||
|
m4_define([b4_tname_if],
|
||||||
|
[m4_case(b4_percent_define_get([[parse.error]]),
|
||||||
|
[verbose], [$1],
|
||||||
|
[b4_token_table_if([$1],
|
||||||
|
[$2])])])
|
||||||
|
|
||||||
|
|
||||||
# b4_integral_parser_table_declare(TABLE-NAME, CONTENT, COMMENT)
|
# b4_integral_parser_table_declare(TABLE-NAME, CONTENT, COMMENT)
|
||||||
# --------------------------------------------------------------
|
# --------------------------------------------------------------
|
||||||
# Declare "parser::yy<TABLE-NAME>_" whose contents is CONTENT.
|
# Declare "parser::yy<TABLE-NAME>_" whose contents is CONTENT.
|
||||||
@@ -50,6 +59,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
|
||||||
@@ -144,7 +160,7 @@ 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]])])
|
||||||
@@ -195,6 +211,13 @@ m4_define([b4_shared_declarations],
|
|||||||
]b4_parser_class[ (]b4_parse_param_decl[);
|
]b4_parser_class[ (]b4_parse_param_decl[);
|
||||||
virtual ~]b4_parser_class[ ();
|
virtual ~]b4_parser_class[ ();
|
||||||
|
|
||||||
|
#if 201103L <= YY_CPLUSPLUS
|
||||||
|
/// Non copyable.
|
||||||
|
]b4_parser_class[ (const ]b4_parser_class[&) = delete;
|
||||||
|
/// Non copyable.
|
||||||
|
]b4_parser_class[& operator= (const ]b4_parser_class[&) = delete;
|
||||||
|
#endif
|
||||||
|
|
||||||
/// Parse. An alias for parse ().
|
/// Parse. An alias for parse ().
|
||||||
/// \returns 0 iff parsing succeeded.
|
/// \returns 0 iff parsing succeeded.
|
||||||
int operator() ();
|
int operator() ();
|
||||||
@@ -225,19 +248,57 @@ m4_define([b4_shared_declarations],
|
|||||||
/// Report a syntax error.
|
/// Report a syntax error.
|
||||||
void error (const syntax_error& err);
|
void error (const syntax_error& err);
|
||||||
|
|
||||||
|
]b4_parse_error_bmatch(
|
||||||
|
[custom\|detailed],
|
||||||
|
[[ /// The user-facing name of the symbol whose (internal) number is
|
||||||
|
/// YYSYMBOL. No bounds checking.
|
||||||
|
static const char *symbol_name (symbol_kind_type yysymbol);]],
|
||||||
|
[simple],
|
||||||
|
[[#if ]b4_api_PREFIX[DEBUG || ]b4_token_table_flag[
|
||||||
|
/// The user-facing name of the symbol whose (internal) number is
|
||||||
|
/// YYSYMBOL. No bounds checking.
|
||||||
|
static const char *symbol_name (symbol_kind_type yysymbol);
|
||||||
|
#endif // #if ]b4_api_PREFIX[DEBUG || ]b4_token_table_flag[
|
||||||
|
]],
|
||||||
|
[verbose],
|
||||||
|
[[ /// The user-facing name of the symbol whose (internal) number is
|
||||||
|
/// YYSYMBOL. No bounds checking.
|
||||||
|
static std::string symbol_name (symbol_kind_type yysymbol);]])[
|
||||||
|
|
||||||
]b4_token_constructor_define[
|
]b4_token_constructor_define[
|
||||||
|
]b4_parse_error_bmatch([custom\|detailed\|verbose], [[
|
||||||
|
class context
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
context (const ]b4_parser_class[& yyparser, const symbol_type& yyla);
|
||||||
|
const symbol_type& lookahead () const YY_NOEXCEPT { return yyla_; }
|
||||||
|
symbol_kind_type token () const YY_NOEXCEPT { return yyla_.kind (); }]b4_locations_if([[
|
||||||
|
const location_type& location () const YY_NOEXCEPT { return yyla_.location; }
|
||||||
|
]])[
|
||||||
|
/// 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 expected tokens (guaranteed to be less than YYNTOKENS).
|
||||||
|
int expected_tokens (symbol_kind_type yyarg[], int yyargn) const;
|
||||||
|
|
||||||
|
private:
|
||||||
|
const ]b4_parser_class[& yyparser_;
|
||||||
|
const symbol_type& yyla_;
|
||||||
|
};
|
||||||
|
]])[
|
||||||
private:
|
private:
|
||||||
/// This class is not copyable.
|
#if YY_CPLUSPLUS < 201103L
|
||||||
|
/// Non copyable.
|
||||||
]b4_parser_class[ (const ]b4_parser_class[&);
|
]b4_parser_class[ (const ]b4_parser_class[&);
|
||||||
]b4_parser_class[& operator= (const ]b4_parser_class[&);]b4_lac_if([[
|
/// Non copyable.
|
||||||
|
]b4_parser_class[& operator= (const ]b4_parser_class[&);
|
||||||
|
#endif
|
||||||
|
]b4_lac_if([[
|
||||||
/// Check the lookahead yytoken.
|
/// Check the lookahead yytoken.
|
||||||
/// \returns true iff the token will be eventually shifted.
|
/// \returns true iff the token will be eventually shifted.
|
||||||
bool yy_lac_check_ (int yytoken) const;
|
bool yy_lac_check_ (symbol_kind_type yytoken) const;
|
||||||
/// Establish the initial context if no initial context currently exists.
|
/// Establish the initial context if no initial context currently exists.
|
||||||
/// \returns true iff the token will be eventually shifted.
|
/// \returns true iff the token will be eventually shifted.
|
||||||
bool yy_lac_establish_ (int yytoken);
|
bool yy_lac_establish_ (symbol_kind_type yytoken);
|
||||||
/// Discard any previous initial lookahead context because of event.
|
/// Discard any previous initial lookahead context because of event.
|
||||||
/// \param event the event which caused the lookahead to be discarded.
|
/// \param event the event which caused the lookahead to be discarded.
|
||||||
/// Only used for debbuging output.
|
/// Only used for debbuging output.
|
||||||
@@ -245,13 +306,19 @@ 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(
|
||||||
|
[custom], [[
|
||||||
|
/// Report a syntax error
|
||||||
|
/// \param yyctx the context in which the error occurred.
|
||||||
|
void report_syntax_error (const context& yyctx) const;]],
|
||||||
|
[detailed\|verbose], [[
|
||||||
|
/// The arguments of the error message.
|
||||||
|
int yy_syntax_error_arguments_ (const context& yyctx,
|
||||||
|
symbol_kind_type yyarg[], int yyargn) const;
|
||||||
|
|
||||||
/// Generate an error message.
|
/// Generate an error message.
|
||||||
/// \param yystate the state where the error occurred.
|
/// \param yyctx the context in which the error occurred.
|
||||||
/// \param yyla the lookahead token.
|
virtual std::string yysyntax_error_ (const context& yyctx) const;]])[
|
||||||
virtual std::string yysyntax_error_ (state_type yystate,
|
|
||||||
const symbol_type& yyla) const;
|
|
||||||
|
|
||||||
/// Compute post-reduction state.
|
/// Compute post-reduction state.
|
||||||
/// \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
|
||||||
@@ -268,34 +335,43 @@ m4_define([b4_shared_declarations],
|
|||||||
static const ]b4_int_type(b4_pact_ninf, b4_pact_ninf)[ yypact_ninf_;
|
static const ]b4_int_type(b4_pact_ninf, b4_pact_ninf)[ yypact_ninf_;
|
||||||
static const ]b4_int_type(b4_table_ninf, b4_table_ninf)[ yytable_ninf_;
|
static const ]b4_int_type(b4_table_ninf, b4_table_ninf)[ yytable_ninf_;
|
||||||
|
|
||||||
/// Convert a scanner token number \a t to a symbol number.
|
/// Convert a scanner token kind \a t to a symbol kind.
|
||||||
/// In theory \a t should be a token_type, but character literals
|
/// In theory \a t should be a token_kind_type, but character literals
|
||||||
/// are valid, yet not members of the token_type enum.
|
/// are valid, yet not members of the token_type enum.
|
||||||
static token_number_type yytranslate_ (int t);
|
static symbol_kind_type yytranslate_ (int t);
|
||||||
|
|
||||||
// Tables.
|
]b4_parse_error_bmatch(
|
||||||
]b4_parser_tables_declare[]b4_error_verbose_if([
|
[simple],
|
||||||
|
[[#if ]b4_api_PREFIX[DEBUG || ]b4_token_table_flag[
|
||||||
/// Convert the symbol name \a n to a form suitable for a diagnostic.
|
|
||||||
static std::string yytnamerr_ (const char *n);])[
|
|
||||||
|
|
||||||
]b4_token_table_if([], [[#if ]b4_api_PREFIX[DEBUG]])[
|
|
||||||
/// For a symbol, its name in clear.
|
/// For a symbol, its name in clear.
|
||||||
static const char* const yytname_[];
|
static const char* const yytname_[];
|
||||||
]b4_token_table_if([[#if ]b4_api_PREFIX[DEBUG]])[
|
#endif // #if ]b4_api_PREFIX[DEBUG || ]b4_token_table_flag[
|
||||||
|
]],
|
||||||
|
[verbose],
|
||||||
|
[[ /// Convert the symbol name \a n to a form suitable for a diagnostic.
|
||||||
|
static std::string yytnamerr_ (const char *yystr);
|
||||||
|
|
||||||
|
/// For a symbol, its name in clear.
|
||||||
|
static const char* const yytname_[];
|
||||||
|
]])[
|
||||||
|
|
||||||
|
// Tables.
|
||||||
|
]b4_parser_tables_declare[
|
||||||
|
|
||||||
|
#if ]b4_api_PREFIX[DEBUG
|
||||||
]b4_integral_parser_table_declare([rline], [b4_rline],
|
]b4_integral_parser_table_declare([rline], [b4_rline],
|
||||||
[[YYRLINE[YYN] -- Source line where rule number YYN was defined.]])[
|
[[YYRLINE[YYN] -- Source line where rule number YYN was defined.]])[
|
||||||
/// Report on the debug stream that the rule \a r is going to be reduced.
|
/// Report on the debug stream that the rule \a r is going to be reduced.
|
||||||
virtual void yy_reduce_print_ (int r);
|
virtual void yy_reduce_print_ (int r) const;
|
||||||
/// Print the state stack on the debug stream.
|
/// Print the state stack on the debug stream.
|
||||||
virtual void yystack_print_ ();
|
virtual void yy_stack_print_ () const;
|
||||||
|
|
||||||
/// Debugging level.
|
/// Debugging level.
|
||||||
int yydebug_;
|
int yydebug_;
|
||||||
/// Debug stream.
|
/// Debug stream.
|
||||||
std::ostream* yycdebug_;
|
std::ostream* yycdebug_;
|
||||||
|
|
||||||
/// \brief Display a symbol type, value and location.
|
/// \brief Display a symbol kind, value and location.
|
||||||
/// \param yyo The output stream.
|
/// \param yyo The output stream.
|
||||||
/// \param yysym The symbol.
|
/// \param yysym The symbol.
|
||||||
template <typename Base>
|
template <typename Base>
|
||||||
@@ -316,7 +392,7 @@ m4_define([b4_shared_declarations],
|
|||||||
/// Default constructor.
|
/// Default constructor.
|
||||||
by_state () YY_NOEXCEPT;
|
by_state () YY_NOEXCEPT;
|
||||||
|
|
||||||
/// The symbol type as needed by the constructor.
|
/// The symbol kind as needed by the constructor.
|
||||||
typedef state_type kind_type;
|
typedef state_type kind_type;
|
||||||
|
|
||||||
/// Constructor.
|
/// Constructor.
|
||||||
@@ -328,12 +404,12 @@ m4_define([b4_shared_declarations],
|
|||||||
/// Record that this symbol is empty.
|
/// Record that this symbol is empty.
|
||||||
void clear () YY_NOEXCEPT;
|
void clear () YY_NOEXCEPT;
|
||||||
|
|
||||||
/// Steal the symbol type from \a that.
|
/// Steal the symbol kind from \a that.
|
||||||
void move (by_state& that);
|
void move (by_state& that);
|
||||||
|
|
||||||
/// The (internal) type number (corresponding to \a state).
|
/// The symbol kind (corresponding to \a state).
|
||||||
/// \a empty_symbol when empty.
|
/// \a ]b4_symbol(-2, kind)[ when empty.
|
||||||
symbol_number_type type_get () 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.
|
||||||
/// We use the initial state, as it does not have a value.
|
/// We use the initial state, as it does not have a value.
|
||||||
@@ -401,35 +477,22 @@ m4_define([b4_shared_declarations],
|
|||||||
/// Pop \a n symbols from the stack.
|
/// Pop \a n symbols from the stack.
|
||||||
void yypop_ (int n = 1);
|
void yypop_ (int n = 1);
|
||||||
|
|
||||||
/// Some specific tokens.
|
|
||||||
static const token_number_type yy_error_token_ = 1;
|
|
||||||
static const token_number_type yy_undef_token_ = ]b4_undef_token_number[;
|
|
||||||
|
|
||||||
/// Constants.
|
/// Constants.
|
||||||
enum
|
enum
|
||||||
{
|
{
|
||||||
yyeof_ = 0,
|
|
||||||
yylast_ = ]b4_last[, ///< Last index in yytable_.
|
yylast_ = ]b4_last[, ///< Last index in yytable_.
|
||||||
yynnts_ = ]b4_nterms_number[, ///< Number of nonterminal symbols.
|
yynnts_ = ]b4_nterms_number[, ///< Number of nonterminal symbols.
|
||||||
yyfinal_ = ]b4_final_state_number[, ///< Termination state number.
|
yyfinal_ = ]b4_final_state_number[ ///< Termination state number.
|
||||||
yyntokens_ = ]b4_tokens_number[ ///< Number of tokens.
|
|
||||||
};
|
};
|
||||||
|
|
||||||
]b4_parse_param_vars[
|
]b4_parse_param_vars[
|
||||||
|
]b4_percent_code_get([[yy_bison_internal_hook]])[
|
||||||
};
|
};
|
||||||
|
|
||||||
]b4_token_ctor_if([b4_yytranslate_define([$1])[
|
]b4_token_ctor_if([b4_yytranslate_define([$1])[
|
||||||
]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]])[
|
||||||
]])
|
]])
|
||||||
|
|
||||||
@@ -442,16 +505,16 @@ b4_defines_if(
|
|||||||
b4_copyright([Skeleton interface for Bison LALR(1) parsers in C++])
|
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[
|
||||||
]])
|
]])
|
||||||
|
|
||||||
@@ -484,6 +547,11 @@ m4_if(b4_prefix, [yy], [],
|
|||||||
# define YY_(msgid) msgid
|
# define YY_(msgid) msgid
|
||||||
# endif
|
# endif
|
||||||
#endif
|
#endif
|
||||||
|
]b4_has_translations_if([
|
||||||
|
#ifndef N_
|
||||||
|
# define N_(Msgid) Msgid
|
||||||
|
#endif
|
||||||
|
])[
|
||||||
|
|
||||||
// Whether we are compiled with exception support.
|
// Whether we are compiled with exception support.
|
||||||
#ifndef YY_EXCEPTIONS
|
#ifndef YY_EXCEPTIONS
|
||||||
@@ -523,13 +591,13 @@ m4_if(b4_prefix, [yy], [],
|
|||||||
# define YY_STACK_PRINT() \
|
# define YY_STACK_PRINT() \
|
||||||
do { \
|
do { \
|
||||||
if (yydebug_) \
|
if (yydebug_) \
|
||||||
yystack_print_ (); \
|
yy_stack_print_ (); \
|
||||||
} while (false)
|
} while (false)
|
||||||
|
|
||||||
#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)
|
||||||
|
|
||||||
@@ -543,49 +611,7 @@ m4_if(b4_prefix, [yy], [],
|
|||||||
#define YYERROR goto yyerrorlab
|
#define YYERROR goto yyerrorlab
|
||||||
#define YYRECOVERING() (!!yyerrstatus_)
|
#define YYRECOVERING() (!!yyerrstatus_)
|
||||||
|
|
||||||
]b4_namespace_open[]b4_error_verbose_if([[
|
]b4_namespace_open[
|
||||||
|
|
||||||
/* 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. */
|
|
||||||
std::string
|
|
||||||
]b4_parser_class[::yytnamerr_ (const char *yystr)
|
|
||||||
{
|
|
||||||
if (*yystr == '"')
|
|
||||||
{
|
|
||||||
std::string yyr;
|
|
||||||
char const *yyp = yystr;
|
|
||||||
|
|
||||||
for (;;)
|
|
||||||
switch (*++yyp)
|
|
||||||
{
|
|
||||||
case '\'':
|
|
||||||
case ',':
|
|
||||||
goto do_not_strip_quotes;
|
|
||||||
|
|
||||||
case '\\':
|
|
||||||
if (*++yyp != '\\')
|
|
||||||
goto do_not_strip_quotes;
|
|
||||||
else
|
|
||||||
goto append;
|
|
||||||
|
|
||||||
append:
|
|
||||||
default:
|
|
||||||
yyr += *yyp;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case '"':
|
|
||||||
return yyr;
|
|
||||||
}
|
|
||||||
do_not_strip_quotes: ;
|
|
||||||
}
|
|
||||||
|
|
||||||
return yystr;
|
|
||||||
}
|
|
||||||
]])[
|
|
||||||
|
|
||||||
/// Build a parser object.
|
/// Build a parser object.
|
||||||
]b4_parser_class::b4_parser_class[ (]b4_parse_param_decl[)
|
]b4_parser_class::b4_parser_class[ (]b4_parse_param_decl[)
|
||||||
#if ]b4_api_PREFIX[DEBUG
|
#if ]b4_api_PREFIX[DEBUG
|
||||||
@@ -604,7 +630,7 @@ m4_if(b4_prefix, [yy], [],
|
|||||||
{}
|
{}
|
||||||
|
|
||||||
/*---------------.
|
/*---------------.
|
||||||
| Symbol types. |
|
| symbol kinds. |
|
||||||
`---------------*/
|
`---------------*/
|
||||||
|
|
||||||
]b4_token_ctor_if([], [b4_public_types_define([cc])])[
|
]b4_token_ctor_if([], [b4_public_types_define([cc])])[
|
||||||
@@ -635,13 +661,13 @@ m4_if(b4_prefix, [yy], [],
|
|||||||
: state (s)
|
: state (s)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
]b4_parser_class[::symbol_number_type
|
]b4_parser_class[::symbol_kind_type
|
||||||
]b4_parser_class[::by_state::type_get () const YY_NOEXCEPT
|
]b4_parser_class[::by_state::kind () const YY_NOEXCEPT
|
||||||
{
|
{
|
||||||
if (state == empty_state)
|
if (state == empty_state)
|
||||||
return empty_symbol;
|
return ]b4_symbol(-2, kind)[;
|
||||||
else
|
else
|
||||||
return yystos_[+state];
|
return YY_CAST (symbol_kind_type, yystos_[+state]);
|
||||||
}
|
}
|
||||||
|
|
||||||
]b4_parser_class[::stack_symbol_type::stack_symbol_type ()
|
]b4_parser_class[::stack_symbol_type::stack_symbol_type ()
|
||||||
@@ -650,7 +676,7 @@ m4_if(b4_prefix, [yy], [],
|
|||||||
]b4_parser_class[::stack_symbol_type::stack_symbol_type (YY_RVREF (stack_symbol_type) that)
|
]b4_parser_class[::stack_symbol_type::stack_symbol_type (YY_RVREF (stack_symbol_type) that)
|
||||||
: super_type (YY_MOVE (that.state)]b4_variant_if([], [, YY_MOVE (that.value)])b4_locations_if([, YY_MOVE (that.location)])[)
|
: super_type (YY_MOVE (that.state)]b4_variant_if([], [, YY_MOVE (that.value)])b4_locations_if([, YY_MOVE (that.location)])[)
|
||||||
{]b4_variant_if([
|
{]b4_variant_if([
|
||||||
b4_symbol_variant([that.type_get ()],
|
b4_symbol_variant([that.kind ()],
|
||||||
[value], [YY_MOVE_OR_COPY], [YY_MOVE (that.value)])])[
|
[value], [YY_MOVE_OR_COPY], [YY_MOVE (that.value)])])[
|
||||||
#if 201103L <= YY_CPLUSPLUS
|
#if 201103L <= YY_CPLUSPLUS
|
||||||
// that is emptied.
|
// that is emptied.
|
||||||
@@ -661,10 +687,10 @@ m4_if(b4_prefix, [yy], [],
|
|||||||
]b4_parser_class[::stack_symbol_type::stack_symbol_type (state_type s, YY_MOVE_REF (symbol_type) that)
|
]b4_parser_class[::stack_symbol_type::stack_symbol_type (state_type s, YY_MOVE_REF (symbol_type) that)
|
||||||
: super_type (s]b4_variant_if([], [, YY_MOVE (that.value)])[]b4_locations_if([, YY_MOVE (that.location)])[)
|
: super_type (s]b4_variant_if([], [, YY_MOVE (that.value)])[]b4_locations_if([, YY_MOVE (that.location)])[)
|
||||||
{]b4_variant_if([
|
{]b4_variant_if([
|
||||||
b4_symbol_variant([that.type_get ()],
|
b4_symbol_variant([that.kind ()],
|
||||||
[value], [move], [YY_MOVE (that.value)])])[
|
[value], [move], [YY_MOVE (that.value)])])[
|
||||||
// that is emptied.
|
// that is emptied.
|
||||||
that.type = empty_symbol;
|
that.kind_ = ]b4_symbol(-2, kind)[;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if YY_CPLUSPLUS < 201103L
|
#if YY_CPLUSPLUS < 201103L
|
||||||
@@ -672,7 +698,7 @@ m4_if(b4_prefix, [yy], [],
|
|||||||
]b4_parser_class[::stack_symbol_type::operator= (const stack_symbol_type& that)
|
]b4_parser_class[::stack_symbol_type::operator= (const stack_symbol_type& that)
|
||||||
{
|
{
|
||||||
state = that.state;
|
state = that.state;
|
||||||
]b4_variant_if([b4_symbol_variant([that.type_get ()],
|
]b4_variant_if([b4_symbol_variant([that.kind ()],
|
||||||
[value], [copy], [that.value])],
|
[value], [copy], [that.value])],
|
||||||
[[value = that.value;]])[]b4_locations_if([
|
[[value = that.value;]])[]b4_locations_if([
|
||||||
location = that.location;])[
|
location = that.location;])[
|
||||||
@@ -683,7 +709,7 @@ m4_if(b4_prefix, [yy], [],
|
|||||||
]b4_parser_class[::stack_symbol_type::operator= (stack_symbol_type& that)
|
]b4_parser_class[::stack_symbol_type::operator= (stack_symbol_type& that)
|
||||||
{
|
{
|
||||||
state = that.state;
|
state = that.state;
|
||||||
]b4_variant_if([b4_symbol_variant([that.type_get ()],
|
]b4_variant_if([b4_symbol_variant([that.kind ()],
|
||||||
[value], [move], [that.value])],
|
[value], [move], [that.value])],
|
||||||
[[value = that.value;]])[]b4_locations_if([
|
[[value = that.value;]])[]b4_locations_if([
|
||||||
location = that.location;])[
|
location = that.location;])[
|
||||||
@@ -701,29 +727,27 @@ m4_if(b4_prefix, [yy], [],
|
|||||||
YY_SYMBOL_PRINT (yymsg, yysym);]b4_variant_if([], [
|
YY_SYMBOL_PRINT (yymsg, yysym);]b4_variant_if([], [
|
||||||
|
|
||||||
// User destructor.
|
// User destructor.
|
||||||
b4_symbol_actions([destructor], [yysym.type_get ()])])[
|
b4_symbol_actions([destructor], [yysym.kind ()])])[
|
||||||
}
|
}
|
||||||
|
|
||||||
#if ]b4_api_PREFIX[DEBUG
|
#if ]b4_api_PREFIX[DEBUG
|
||||||
template <typename Base>
|
template <typename Base>
|
||||||
void
|
void
|
||||||
]b4_parser_class[::yy_print_ (std::ostream& yyo,
|
]b4_parser_class[::yy_print_ (std::ostream& yyo, const basic_symbol<Base>& yysym) const
|
||||||
const basic_symbol<Base>& yysym) const
|
|
||||||
{
|
{
|
||||||
std::ostream& yyoutput = yyo;
|
std::ostream& yyoutput = yyo;
|
||||||
YYUSE (yyoutput);
|
YY_USE (yyoutput);
|
||||||
symbol_number_type yytype = yysym.type_get ();
|
|
||||||
#if defined __GNUC__ && ! defined __clang__ && ! defined __ICC && __GNUC__ * 100 + __GNUC_MINOR__ <= 408
|
|
||||||
// Avoid a (spurious) G++ 4.8 warning about "array subscript is
|
|
||||||
// below array bounds".
|
|
||||||
if (yysym.empty ())
|
if (yysym.empty ())
|
||||||
std::abort ();
|
yyo << "empty symbol";
|
||||||
#endif
|
else
|
||||||
yyo << (yytype < yyntokens_ ? "token" : "nterm")
|
{
|
||||||
<< ' ' << yytname_[yytype] << " ("]b4_locations_if([
|
symbol_kind_type yykind = yysym.kind ();
|
||||||
<< yysym.location << ": "])[;
|
yyo << (yykind < YYNTOKENS ? "token" : "nterm")
|
||||||
]b4_symbol_actions([printer])[
|
<< ' ' << yysym.name () << " ("]b4_locations_if([
|
||||||
yyo << ')';
|
<< yysym.location << ": "])[;
|
||||||
|
]b4_symbol_actions([printer])[
|
||||||
|
yyo << ')';
|
||||||
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -782,11 +806,11 @@ m4_if(b4_prefix, [yy], [],
|
|||||||
]b4_parser_class[::state_type
|
]b4_parser_class[::state_type
|
||||||
]b4_parser_class[::yy_lr_goto_state_ (state_type yystate, int yysym)
|
]b4_parser_class[::yy_lr_goto_state_ (state_type 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];
|
||||||
else
|
else
|
||||||
return yydefgoto_[yysym - yyntokens_];
|
return yydefgoto_[yysym - YYNTOKENS];
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
@@ -854,6 +878,7 @@ b4_dollar_popdef])[]dnl
|
|||||||
`-----------------------------------------------*/
|
`-----------------------------------------------*/
|
||||||
yynewstate:
|
yynewstate:
|
||||||
YYCDEBUG << "Entering state " << int (yystack_[0].state) << '\n';
|
YYCDEBUG << "Entering state " << int (yystack_[0].state) << '\n';
|
||||||
|
YY_STACK_PRINT ();
|
||||||
|
|
||||||
// Accept?
|
// Accept?
|
||||||
if (yystack_[0].state == yyfinal_)
|
if (yystack_[0].state == yyfinal_)
|
||||||
@@ -874,14 +899,14 @@ b4_dollar_popdef])[]dnl
|
|||||||
// Read a lookahead token.
|
// Read a lookahead token.
|
||||||
if (yyla.empty ())
|
if (yyla.empty ())
|
||||||
{
|
{
|
||||||
YYCDEBUG << "Reading a token: ";
|
YYCDEBUG << "Reading a token\n";
|
||||||
#if YY_EXCEPTIONS
|
#if YY_EXCEPTIONS
|
||||||
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_lex[);
|
||||||
yyla.move (yylookahead);]], [[
|
yyla.move (yylookahead);]], [[
|
||||||
yyla.type = yytranslate_ (]b4_lex[);]])[
|
yyla.kind_ = yytranslate_ (]b4_lex[);]])[
|
||||||
}
|
}
|
||||||
#if YY_EXCEPTIONS
|
#if YY_EXCEPTIONS
|
||||||
catch (const syntax_error& yyexc)
|
catch (const syntax_error& yyexc)
|
||||||
@@ -894,12 +919,22 @@ b4_dollar_popdef])[]dnl
|
|||||||
}
|
}
|
||||||
YY_SYMBOL_PRINT ("Next token is", yyla);
|
YY_SYMBOL_PRINT ("Next token is", yyla);
|
||||||
|
|
||||||
|
if (yyla.kind () == ]b4_symbol(1, kind)[)
|
||||||
|
{
|
||||||
|
// The scanner already issued an error message, process directly
|
||||||
|
// to error recovery. But do not keep the error token as
|
||||||
|
// lookahead, it is too special and may lead us to an endless
|
||||||
|
// loop in error recovery. */
|
||||||
|
yyla.kind_ = ]b4_symbol(2, kind)[;
|
||||||
|
goto yyerrlab1;
|
||||||
|
}
|
||||||
|
|
||||||
/* If the proper action on seeing token YYLA.TYPE is to reduce or
|
/* If the proper action on seeing token YYLA.TYPE is to reduce or
|
||||||
to detect an error, take that action. */
|
to detect an error, take that action. */
|
||||||
yyn += yyla.type_get ();
|
yyn += yyla.kind ();
|
||||||
if (yyn < 0 || yylast_ < yyn || yycheck_[yyn] != yyla.type_get ())
|
if (yyn < 0 || yylast_ < yyn || yycheck_[yyn] != yyla.kind ())
|
||||||
{]b4_lac_if([[
|
{]b4_lac_if([[
|
||||||
if (!yy_lac_establish_ (yyla.type_get ()))
|
if (!yy_lac_establish_ (yyla.kind ()))
|
||||||
goto yyerrlab;]])[
|
goto yyerrlab;]])[
|
||||||
goto yydefault;
|
goto yydefault;
|
||||||
}
|
}
|
||||||
@@ -910,7 +945,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.type_get ()))
|
if (!yy_lac_establish_ (yyla.kind ()))
|
||||||
goto yyerrlab;
|
goto yyerrlab;
|
||||||
]])[
|
]])[
|
||||||
yyn = -yyn;
|
yyn = -yyn;
|
||||||
@@ -992,7 +1027,6 @@ b4_dollar_popdef])[]dnl
|
|||||||
YY_SYMBOL_PRINT ("-> $$ =", yylhs);
|
YY_SYMBOL_PRINT ("-> $$ =", yylhs);
|
||||||
yypop_ (yylen);
|
yypop_ (yylen);
|
||||||
yylen = 0;
|
yylen = 0;
|
||||||
YY_STACK_PRINT ();
|
|
||||||
|
|
||||||
// Shift the result of the reduction.
|
// Shift the result of the reduction.
|
||||||
yypush_ (YY_NULLPTR, YY_MOVE (yylhs));
|
yypush_ (YY_NULLPTR, YY_MOVE (yylhs));
|
||||||
@@ -1007,9 +1041,17 @@ b4_dollar_popdef])[]dnl
|
|||||||
// If not already recovering from an error, report this error.
|
// If not already recovering from an error, report this error.
|
||||||
if (!yyerrstatus_)
|
if (!yyerrstatus_)
|
||||||
{
|
{
|
||||||
++yynerrs_;
|
++yynerrs_;]b4_parse_error_case(
|
||||||
error (]b4_join(b4_locations_if([yyla.location]),
|
[simple], [[
|
||||||
[[yysyntax_error_ (yystack_[0].state, yyla)]])[);
|
std::string msg = YY_("syntax error");
|
||||||
|
error (]b4_join(b4_locations_if([yyla.location]), [[YY_MOVE (msg)]])[);]],
|
||||||
|
[custom], [[
|
||||||
|
context yyctx (*this, yyla);
|
||||||
|
report_syntax_error (yyctx);]],
|
||||||
|
[[
|
||||||
|
context yyctx (*this, yyla);
|
||||||
|
std::string msg = yysyntax_error_ (yyctx);
|
||||||
|
error (]b4_join(b4_locations_if([yyla.location]), [[YY_MOVE (msg)]])[);]])[
|
||||||
}
|
}
|
||||||
|
|
||||||
]b4_locations_if([[
|
]b4_locations_if([[
|
||||||
@@ -1020,7 +1062,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.type_get () == yyeof_)
|
if (yyla.kind () == ]b4_symbol(0, kind)[)
|
||||||
YYABORT;
|
YYABORT;
|
||||||
else if (!yyla.empty ())
|
else if (!yyla.empty ())
|
||||||
{
|
{
|
||||||
@@ -1046,6 +1088,7 @@ b4_dollar_popdef])[]dnl
|
|||||||
this YYERROR. */
|
this YYERROR. */
|
||||||
yypop_ (yylen);
|
yypop_ (yylen);
|
||||||
yylen = 0;
|
yylen = 0;
|
||||||
|
YY_STACK_PRINT ();
|
||||||
goto yyerrlab1;
|
goto yyerrlab1;
|
||||||
|
|
||||||
|
|
||||||
@@ -1054,31 +1097,33 @@ b4_dollar_popdef])[]dnl
|
|||||||
`-------------------------------------------------------------*/
|
`-------------------------------------------------------------*/
|
||||||
yyerrlab1:
|
yyerrlab1:
|
||||||
yyerrstatus_ = 3; // Each real token shifted decrements this.
|
yyerrstatus_ = 3; // Each real token shifted decrements this.
|
||||||
|
// Pop stack until we find a state that shifts the error token.
|
||||||
|
for (;;)
|
||||||
|
{
|
||||||
|
yyn = yypact_[+yystack_[0].state];
|
||||||
|
if (!yy_pact_value_is_default_ (yyn))
|
||||||
|
{
|
||||||
|
yyn += ]b4_symbol(1, kind)[;
|
||||||
|
if (0 <= yyn && yyn <= yylast_
|
||||||
|
&& yycheck_[yyn] == ]b4_symbol(1, kind)[)
|
||||||
|
{
|
||||||
|
yyn = yytable_[yyn];
|
||||||
|
if (0 < yyn)
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Pop the current state because it cannot handle the error token.
|
||||||
|
if (yystack_.size () == 1)
|
||||||
|
YYABORT;
|
||||||
|
]b4_locations_if([[
|
||||||
|
yyerror_range[1].location = yystack_[0].location;]])[
|
||||||
|
yy_destroy_ ("Error: popping", yystack_[0]);
|
||||||
|
yypop_ ();
|
||||||
|
YY_STACK_PRINT ();
|
||||||
|
}
|
||||||
{
|
{
|
||||||
stack_symbol_type error_token;
|
stack_symbol_type error_token;
|
||||||
for (;;)
|
|
||||||
{
|
|
||||||
yyn = yypact_[+yystack_[0].state];
|
|
||||||
if (!yy_pact_value_is_default_ (yyn))
|
|
||||||
{
|
|
||||||
yyn += yy_error_token_;
|
|
||||||
if (0 <= yyn && yyn <= yylast_ && yycheck_[yyn] == yy_error_token_)
|
|
||||||
{
|
|
||||||
yyn = yytable_[yyn];
|
|
||||||
if (0 < yyn)
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Pop the current state because it cannot handle the error token.
|
|
||||||
if (yystack_.size () == 1)
|
|
||||||
YYABORT;
|
|
||||||
]b4_locations_if([[
|
|
||||||
yyerror_range[1].location = yystack_[0].location;]])[
|
|
||||||
yy_destroy_ ("Error: popping", yystack_[0]);
|
|
||||||
yypop_ ();
|
|
||||||
YY_STACK_PRINT ();
|
|
||||||
}
|
|
||||||
]b4_locations_if([[
|
]b4_locations_if([[
|
||||||
yyerror_range[2].location = yyla.location;
|
yyerror_range[2].location = yyla.location;
|
||||||
YYLLOC_DEFAULT (error_token.location, yyerror_range, 2);]])[
|
YYLLOC_DEFAULT (error_token.location, yyerror_range, 2);]])[
|
||||||
@@ -1117,6 +1162,7 @@ b4_dollar_popdef])[]dnl
|
|||||||
/* Do not reclaim the symbols of the rule whose action triggered
|
/* Do not reclaim the symbols of the rule whose action triggered
|
||||||
this YYABORT or YYACCEPT. */
|
this YYABORT or YYACCEPT. */
|
||||||
yypop_ (yylen);
|
yypop_ (yylen);
|
||||||
|
YY_STACK_PRINT ();
|
||||||
while (1 < yystack_.size ())
|
while (1 < yystack_.size ())
|
||||||
{
|
{
|
||||||
yy_destroy_ ("Cleanup: popping", yystack_[0]);
|
yy_destroy_ ("Cleanup: popping", yystack_[0]);
|
||||||
@@ -1149,17 +1195,158 @@ b4_dollar_popdef])[]dnl
|
|||||||
{
|
{
|
||||||
error (]b4_join(b4_locations_if([yyexc.location]),
|
error (]b4_join(b4_locations_if([yyexc.location]),
|
||||||
[[yyexc.what ()]])[);
|
[[yyexc.what ()]])[);
|
||||||
}]b4_lac_if([[
|
}
|
||||||
|
|
||||||
|
]b4_parse_error_bmatch([custom\|detailed],
|
||||||
|
[[ const char *
|
||||||
|
]b4_parser_class[::symbol_name (symbol_kind_type yysymbol)
|
||||||
|
{
|
||||||
|
static const char *const yy_sname[] =
|
||||||
|
{
|
||||||
|
]b4_symbol_names[
|
||||||
|
};]b4_has_translations_if([[
|
||||||
|
/* YYTRANSLATABLE[SYMBOL-NUM] -- Whether YY_SNAME[SYMBOL-NUM] is
|
||||||
|
internationalizable. */
|
||||||
|
static ]b4_int_type_for([b4_translatable])[ yytranslatable[] =
|
||||||
|
{
|
||||||
|
]b4_translatable[
|
||||||
|
};
|
||||||
|
return (yysymbol < YYNTOKENS && yytranslatable[yysymbol]
|
||||||
|
? _(yy_sname[yysymbol])
|
||||||
|
: yy_sname[yysymbol]);]], [[
|
||||||
|
return yy_sname[yysymbol];]])[
|
||||||
|
}
|
||||||
|
]],
|
||||||
|
[simple],
|
||||||
|
[[#if ]b4_api_PREFIX[DEBUG || ]b4_token_table_flag[
|
||||||
|
const char *
|
||||||
|
]b4_parser_class[::symbol_name (symbol_kind_type yysymbol)
|
||||||
|
{
|
||||||
|
return yytname_[yysymbol];
|
||||||
|
}
|
||||||
|
#endif // #if ]b4_api_PREFIX[DEBUG || ]b4_token_table_flag[
|
||||||
|
]],
|
||||||
|
[verbose],
|
||||||
|
[[ /* 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. */
|
||||||
|
std::string
|
||||||
|
]b4_parser_class[::yytnamerr_ (const char *yystr)
|
||||||
|
{
|
||||||
|
if (*yystr == '"')
|
||||||
|
{
|
||||||
|
std::string yyr;
|
||||||
|
char const *yyp = yystr;
|
||||||
|
|
||||||
|
for (;;)
|
||||||
|
switch (*++yyp)
|
||||||
|
{
|
||||||
|
case '\'':
|
||||||
|
case ',':
|
||||||
|
goto do_not_strip_quotes;
|
||||||
|
|
||||||
|
case '\\':
|
||||||
|
if (*++yyp != '\\')
|
||||||
|
goto do_not_strip_quotes;
|
||||||
|
else
|
||||||
|
goto append;
|
||||||
|
|
||||||
|
append:
|
||||||
|
default:
|
||||||
|
yyr += *yyp;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case '"':
|
||||||
|
return yyr;
|
||||||
|
}
|
||||||
|
do_not_strip_quotes: ;
|
||||||
|
}
|
||||||
|
|
||||||
|
return yystr;
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string
|
||||||
|
]b4_parser_class[::symbol_name (symbol_kind_type yysymbol)
|
||||||
|
{
|
||||||
|
return yytnamerr_ (yytname_[yysymbol]);
|
||||||
|
}
|
||||||
|
]])[
|
||||||
|
|
||||||
|
]b4_parse_error_bmatch([custom\|detailed\|verbose], [[
|
||||||
|
// ]b4_parser_class[::context.
|
||||||
|
]b4_parser_class[::context::context (const ]b4_parser_class[& yyparser, const symbol_type& yyla)
|
||||||
|
: yyparser_ (yyparser)
|
||||||
|
, yyla_ (yyla)
|
||||||
|
{}
|
||||||
|
|
||||||
|
int
|
||||||
|
]b4_parser_class[::context::expected_tokens (symbol_kind_type yyarg[], int yyargn) const
|
||||||
|
{
|
||||||
|
// Actual number of expected tokens
|
||||||
|
int yycount = 0;
|
||||||
|
]b4_lac_if([[
|
||||||
|
#if ]b4_api_PREFIX[DEBUG
|
||||||
|
// Execute LAC once. We don't care if it is successful, we
|
||||||
|
// only do it for the sake of debugging output.
|
||||||
|
if (!yyparser_.yy_lac_established_)
|
||||||
|
yyparser_.yy_lac_check_ (yyla_.kind ());
|
||||||
|
#endif
|
||||||
|
|
||||||
|
for (int yyx = 0; yyx < YYNTOKENS; ++yyx)
|
||||||
|
{
|
||||||
|
symbol_kind_type yysym = YY_CAST (symbol_kind_type, yyx);
|
||||||
|
if (yysym != ]b4_symbol(1, kind)[
|
||||||
|
&& yysym != ]b4_symbol(2, kind)[
|
||||||
|
&& yyparser_.yy_lac_check_ (yysym))
|
||||||
|
{
|
||||||
|
if (!yyarg)
|
||||||
|
++yycount;
|
||||||
|
else if (yycount == yyargn)
|
||||||
|
return 0;
|
||||||
|
else
|
||||||
|
yyarg[yycount++] = yysym;
|
||||||
|
}
|
||||||
|
}]], [[
|
||||||
|
int yyn = yypact_[+yyparser_.yystack_[0].state];
|
||||||
|
if (!yy_pact_value_is_default_ (yyn))
|
||||||
|
{
|
||||||
|
/* Start YYX at -YYN if negative to avoid negative indexes in
|
||||||
|
YYCHECK. In other words, skip the first -YYN actions for
|
||||||
|
this state because they are default actions. */
|
||||||
|
int yyxbegin = yyn < 0 ? -yyn : 0;
|
||||||
|
// Stay within bounds of both yycheck and yytname.
|
||||||
|
int yychecklim = yylast_ - yyn + 1;
|
||||||
|
int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
|
||||||
|
for (int yyx = yyxbegin; yyx < yyxend; ++yyx)
|
||||||
|
if (yycheck_[yyx + yyn] == yyx && yyx != ]b4_symbol(1, kind)[
|
||||||
|
&& !yy_table_value_is_error_ (yytable_[yyx + yyn]))
|
||||||
|
{
|
||||||
|
if (!yyarg)
|
||||||
|
++yycount;
|
||||||
|
else if (yycount == yyargn)
|
||||||
|
return 0;
|
||||||
|
else
|
||||||
|
yyarg[yycount++] = YY_CAST (symbol_kind_type, yyx);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]])[
|
||||||
|
if (yyarg && yycount == 0 && 0 < yyargn)
|
||||||
|
yyarg[0] = ]b4_symbol(-2, kind)[;
|
||||||
|
return yycount;
|
||||||
|
}
|
||||||
|
|
||||||
|
]])b4_lac_if([[
|
||||||
bool
|
bool
|
||||||
]b4_parser_class[::yy_lac_check_ (int yytoken) const
|
]b4_parser_class[::yy_lac_check_ (symbol_kind_type yytoken) const
|
||||||
{
|
{
|
||||||
// Logically, the yylac_stack's lifetime is confined to this function.
|
// Logically, the yylac_stack's lifetime is confined to this function.
|
||||||
// Clear it, to get rid of potential left-overs from previous call.
|
// Clear it, to get rid of potential left-overs from previous call.
|
||||||
yylac_stack_.clear ();
|
yylac_stack_.clear ();
|
||||||
// Reduce until we encounter a shift and thereby accept the token.
|
// Reduce until we encounter a shift and thereby accept the token.
|
||||||
#if ]b4_api_PREFIX[DEBUG
|
#if ]b4_api_PREFIX[DEBUG
|
||||||
YYCDEBUG << "LAC: checking lookahead " << yytname_[yytoken] << ':';
|
YYCDEBUG << "LAC: checking lookahead " << symbol_name (yytoken) << ':';
|
||||||
#endif
|
#endif
|
||||||
std::ptrdiff_t lac_top = 0;
|
std::ptrdiff_t lac_top = 0;
|
||||||
while (true)
|
while (true)
|
||||||
@@ -1223,14 +1410,14 @@ b4_dollar_popdef])[]dnl
|
|||||||
: yylac_stack_.back ());
|
: yylac_stack_.back ());
|
||||||
// Push the resulting state of the reduction.
|
// Push the resulting state of the reduction.
|
||||||
state_type state = yy_lr_goto_state_ (top_state, yyr1_[yyrule]);
|
state_type state = yy_lr_goto_state_ (top_state, yyr1_[yyrule]);
|
||||||
YYCDEBUG << " G" << state;
|
YYCDEBUG << " G" << int (state);
|
||||||
yylac_stack_.push_back (state);
|
yylac_stack_.push_back (state);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Establish the initial context if no initial context currently exists.
|
// Establish the initial context if no initial context currently exists.
|
||||||
bool
|
bool
|
||||||
]b4_parser_class[::yy_lac_establish_ (int yytoken)
|
]b4_parser_class[::yy_lac_establish_ (symbol_kind_type yytoken)
|
||||||
{
|
{
|
||||||
/* Establish the initial context for the current lookahead if no initial
|
/* Establish the initial context for the current lookahead if no initial
|
||||||
context is currently established.
|
context is currently established.
|
||||||
@@ -1259,7 +1446,7 @@ b4_dollar_popdef])[]dnl
|
|||||||
{
|
{
|
||||||
#if ]b4_api_PREFIX[DEBUG
|
#if ]b4_api_PREFIX[DEBUG
|
||||||
YYCDEBUG << "LAC: initial context established for "
|
YYCDEBUG << "LAC: initial context established for "
|
||||||
<< yytname_[yytoken] << '\n';
|
<< symbol_name (yytoken) << '\n';
|
||||||
#endif
|
#endif
|
||||||
yy_lac_established_ = true;
|
yy_lac_established_ = true;
|
||||||
return yy_lac_check_ (yytoken);
|
return yy_lac_check_ (yytoken);
|
||||||
@@ -1288,22 +1475,12 @@ b4_dollar_popdef])[]dnl
|
|||||||
<< evt << '\n';
|
<< evt << '\n';
|
||||||
yy_lac_established_ = false;
|
yy_lac_established_ = false;
|
||||||
}
|
}
|
||||||
}]])[
|
}]])b4_parse_error_bmatch([detailed\|verbose], [[
|
||||||
|
|
||||||
// Generate an error message.
|
|
||||||
std::string
|
|
||||||
]b4_parser_class[::yysyntax_error_ (]dnl
|
|
||||||
b4_error_verbose_if([state_type yystate, const symbol_type& yyla],
|
|
||||||
[state_type, const symbol_type&])[) const
|
|
||||||
{]b4_error_verbose_if([[
|
|
||||||
// Number of reported tokens (one for the "unexpected", one per
|
|
||||||
// "expected").
|
|
||||||
std::ptrdiff_t yycount = 0;
|
|
||||||
// Its maximum.
|
|
||||||
enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
|
|
||||||
// Arguments of yyformat.
|
|
||||||
char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
|
|
||||||
|
|
||||||
|
int
|
||||||
|
]b4_parser_class[::yy_syntax_error_arguments_ (const context& yyctx,
|
||||||
|
symbol_kind_type yyarg[], int yyargn) const
|
||||||
|
{
|
||||||
/* 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, then
|
- If this state is a consistent state with a default action, then
|
||||||
the only way this function was invoked is if the default action
|
the only way this function was invoked is if the default action
|
||||||
@@ -1334,46 +1511,26 @@ b4_error_verbose_if([state_type yystate, const symbol_type& yyla],
|
|||||||
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 (!yyla.empty ())
|
|
||||||
|
if (!yyctx.lookahead ().empty ())
|
||||||
{
|
{
|
||||||
symbol_number_type yytoken = yyla.type_get ();
|
if (yyarg)
|
||||||
yyarg[yycount++] = yytname_[yytoken];]b4_lac_if([[
|
yyarg[0] = yyctx.token ();
|
||||||
|
int yyn = yyctx.expected_tokens (yyarg ? yyarg + 1 : yyarg, yyargn - 1);
|
||||||
#if ]b4_api_PREFIX[DEBUG
|
return yyn + 1;
|
||||||
// Execute LAC once. We don't care if it is succesful, we
|
|
||||||
// only do it for the sake of debugging output.
|
|
||||||
if (!yy_lac_established_)
|
|
||||||
yy_lac_check_ (yytoken);
|
|
||||||
#endif]])[
|
|
||||||
|
|
||||||
int yyn = yypact_[+yystate];
|
|
||||||
if (!yy_pact_value_is_default_ (yyn))
|
|
||||||
{]b4_lac_if([[
|
|
||||||
for (int yyx = 0; yyx < yyntokens_; ++yyx)
|
|
||||||
if (yyx != yy_error_token_ && yyx != yy_undef_token_
|
|
||||||
&& yy_lac_check_ (yyx))
|
|
||||||
{]], [[
|
|
||||||
/* Start YYX at -YYN if negative to avoid negative indexes in
|
|
||||||
YYCHECK. In other words, skip the first -YYN actions for
|
|
||||||
this state because they are default actions. */
|
|
||||||
int yyxbegin = yyn < 0 ? -yyn : 0;
|
|
||||||
// Stay within bounds of both yycheck and yytname.
|
|
||||||
int yychecklim = yylast_ - yyn + 1;
|
|
||||||
int yyxend = yychecklim < yyntokens_ ? yychecklim : yyntokens_;
|
|
||||||
for (int yyx = yyxbegin; yyx < yyxend; ++yyx)
|
|
||||||
if (yycheck_[yyx + yyn] == yyx && yyx != yy_error_token_
|
|
||||||
&& !yy_table_value_is_error_ (yytable_[yyx + yyn]))
|
|
||||||
{]])[
|
|
||||||
if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
|
|
||||||
{
|
|
||||||
yycount = 1;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
yyarg[yycount++] = yytname_[yyx];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Generate an error message.
|
||||||
|
std::string
|
||||||
|
]b4_parser_class[::yysyntax_error_ (const context& yyctx) const
|
||||||
|
{
|
||||||
|
// Its maximum.
|
||||||
|
enum { YYARGS_MAX = 5 };
|
||||||
|
// Arguments of yyformat.
|
||||||
|
symbol_kind_type yyarg[YYARGS_MAX];
|
||||||
|
int yycount = yy_syntax_error_arguments_ (yyctx, yyarg, YYARGS_MAX);
|
||||||
|
|
||||||
char const* yyformat = YY_NULLPTR;
|
char const* yyformat = YY_NULLPTR;
|
||||||
switch (yycount)
|
switch (yycount)
|
||||||
@@ -1398,14 +1555,13 @@ b4_error_verbose_if([state_type yystate, const symbol_type& yyla],
|
|||||||
for (char const* yyp = yyformat; *yyp; ++yyp)
|
for (char const* yyp = yyformat; *yyp; ++yyp)
|
||||||
if (yyp[0] == '%' && yyp[1] == 's' && yyi < yycount)
|
if (yyp[0] == '%' && yyp[1] == 's' && yyi < yycount)
|
||||||
{
|
{
|
||||||
yyres += yytnamerr_ (yyarg[yyi++]);
|
yyres += symbol_name (yyarg[yyi++]);
|
||||||
++yyp;
|
++yyp;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
yyres += *yyp;
|
yyres += *yyp;
|
||||||
return yyres;]], [[
|
return yyres;
|
||||||
return YY_("syntax error");]])[
|
}]])[
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
const ]b4_int_type(b4_pact_ninf, b4_pact_ninf) b4_parser_class::yypact_ninf_ = b4_pact_ninf[;
|
const ]b4_int_type(b4_pact_ninf, b4_pact_ninf) b4_parser_class::yypact_ninf_ = b4_pact_ninf[;
|
||||||
@@ -1414,21 +1570,23 @@ b4_error_verbose_if([state_type yystate, const symbol_type& yyla],
|
|||||||
|
|
||||||
]b4_parser_tables_define[
|
]b4_parser_tables_define[
|
||||||
|
|
||||||
]b4_token_table_if([], [[#if ]b4_api_PREFIX[DEBUG]])[
|
]b4_parse_error_bmatch([simple\|verbose],
|
||||||
|
[[#if ]b4_api_PREFIX[DEBUG]b4_tname_if([[ || 1]])[
|
||||||
// YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
|
// YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
|
||||||
// First, the terminals, then, starting at \a yyntokens_, nonterminals.
|
// First, the terminals, then, starting at \a YYNTOKENS, nonterminals.
|
||||||
const char*
|
const char*
|
||||||
const ]b4_parser_class[::yytname_[] =
|
const ]b4_parser_class[::yytname_[] =
|
||||||
{
|
{
|
||||||
]b4_tname[
|
]b4_tname[
|
||||||
};
|
};
|
||||||
|
#endif
|
||||||
|
]])[
|
||||||
|
|
||||||
]b4_token_table_if([[#if ]b4_api_PREFIX[DEBUG]])[
|
#if ]b4_api_PREFIX[DEBUG][
|
||||||
]b4_integral_parser_table_define([rline], [b4_rline])[
|
]b4_integral_parser_table_define([rline], [b4_rline])[
|
||||||
|
|
||||||
// Print the state stack on the debug stream.
|
|
||||||
void
|
void
|
||||||
]b4_parser_class[::yystack_print_ ()
|
]b4_parser_class[::yy_stack_print_ () const
|
||||||
{
|
{
|
||||||
*yycdebug_ << "Stack now";
|
*yycdebug_ << "Stack now";
|
||||||
for (stack_type::const_iterator
|
for (stack_type::const_iterator
|
||||||
@@ -1439,9 +1597,8 @@ b4_error_verbose_if([state_type yystate, const symbol_type& yyla],
|
|||||||
*yycdebug_ << '\n';
|
*yycdebug_ << '\n';
|
||||||
}
|
}
|
||||||
|
|
||||||
// Report on the debug stream that the rule \a yyrule is going to be reduced.
|
|
||||||
void
|
void
|
||||||
]b4_parser_class[::yy_reduce_print_ (int yyrule)
|
]b4_parser_class[::yy_reduce_print_ (int yyrule) const
|
||||||
{
|
{
|
||||||
int yylno = yyrline_[yyrule];
|
int yylno = yyrline_[yyrule];
|
||||||
int yynrhs = yyr2_[yyrule];
|
int yynrhs = yyr2_[yyrule];
|
||||||
|
|||||||
+117
-89
@@ -1,6 +1,6 @@
|
|||||||
# D skeleton for Bison -*- autoconf -*-
|
# D skeleton for Bison -*- autoconf -*-
|
||||||
|
|
||||||
# Copyright (C) 2007-2012, 2019-2020 Free Software Foundation, Inc.
|
# Copyright (C) 2007-2012, 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,15 +13,15 @@
|
|||||||
# 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/[d.m4])
|
m4_include(b4_skeletonsdir/[d.m4])
|
||||||
|
|
||||||
|
|
||||||
b4_output_begin([b4_parser_file_name])
|
b4_output_begin([b4_parser_file_name])
|
||||||
b4_copyright([Skeleton implementation for Bison LALR(1) parsers in D],
|
b4_copyright([Skeleton implementation for Bison LALR(1) parsers in D],
|
||||||
[2007-2012, 2019-2020])[
|
[2007-2012, 2019-2021])[
|
||||||
|
]b4_disclaimer[
|
||||||
]b4_percent_define_ifdef([package], [module b4_percent_define_get([package]);
|
]b4_percent_define_ifdef([package], [module b4_percent_define_get([package]);
|
||||||
])[
|
])[
|
||||||
version(D_Version2) {
|
version(D_Version2) {
|
||||||
@@ -182,11 +182,13 @@ b4_user_union_members
|
|||||||
};],
|
};],
|
||||||
[m4_if(b4_tag_seen_flag, 0,
|
[m4_if(b4_tag_seen_flag, 0,
|
||||||
[[private alias int YYSemanticType;]])])[
|
[[private alias int YYSemanticType;]])])[
|
||||||
]b4_token_enums(b4_tokens)[
|
]b4_token_enums[
|
||||||
]b4_parser_class_declaration[
|
]b4_parser_class_declaration[
|
||||||
{
|
{
|
||||||
]b4_identification[
|
]b4_identification[
|
||||||
|
|
||||||
|
]b4_declare_symbol_enum[
|
||||||
|
|
||||||
]b4_locations_if([[
|
]b4_locations_if([[
|
||||||
private final ]b4_location_type[ yylloc_from_stack (ref YYStack rhs, int n)
|
private final ]b4_location_type[ yylloc_from_stack (ref YYStack rhs, int n)
|
||||||
{
|
{
|
||||||
@@ -261,6 +263,11 @@ b4_user_union_members
|
|||||||
public final void setDebugLevel(int level) { yydebug = level; }
|
public final void setDebugLevel(int level) { yydebug = level; }
|
||||||
|
|
||||||
protected final void yycdebug (string s) {
|
protected final void yycdebug (string s) {
|
||||||
|
if (0 < yydebug)
|
||||||
|
yyDebugStream.write (s);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected final void yycdebugln (string s) {
|
||||||
if (0 < yydebug)
|
if (0 < yydebug)
|
||||||
yyDebugStream.writeln (s);
|
yyDebugStream.writeln (s);
|
||||||
}
|
}
|
||||||
@@ -335,7 +342,8 @@ b4_user_union_members
|
|||||||
}
|
}
|
||||||
|
|
||||||
]b4_parse_trace_if([[
|
]b4_parse_trace_if([[
|
||||||
yy_symbol_print ("-> $$ =", yyr1_[yyn], yyval]b4_locations_if([, yyloc])[);]])[
|
import std.conv : to;
|
||||||
|
yy_symbol_print ("-> $$ =", to!SymbolKind (yyr1_[yyn]), yyval]b4_locations_if([, yyloc])[);]])[
|
||||||
|
|
||||||
yystack.pop (yylen);
|
yystack.pop (yylen);
|
||||||
yylen = 0;
|
yylen = 0;
|
||||||
@@ -393,21 +401,21 @@ b4_user_union_members
|
|||||||
| Print this symbol on YYOUTPUT. |
|
| Print this symbol on YYOUTPUT. |
|
||||||
`--------------------------------*/
|
`--------------------------------*/
|
||||||
|
|
||||||
private final void yy_symbol_print (string s, int yytype,
|
private final void yy_symbol_print (string s, SymbolKind yykind,
|
||||||
ref ]b4_yystype[ yyvaluep]dnl
|
ref ]b4_yystype[ yyvaluep]dnl
|
||||||
b4_locations_if([, ref ]b4_location_type[ yylocationp])[)
|
b4_locations_if([, ref ]b4_location_type[ yylocationp])[)
|
||||||
{
|
{
|
||||||
if (0 < yydebug)
|
if (0 < yydebug)
|
||||||
{
|
{
|
||||||
string message = s ~ (yytype < yyntokens_ ? " token " : " nterm ")
|
string message = s ~ (yykind < yyntokens_ ? " token " : " nterm ")
|
||||||
~ yytname_[yytype] ~ " ("]b4_locations_if([
|
~ yytname_[yykind] ~ " ("]b4_locations_if([
|
||||||
~ yylocationp.toString() ~ ": "])[;
|
~ yylocationp.toString() ~ ": "])[;
|
||||||
static if (__traits(compiles, message ~= yyvaluep.toString ()))
|
static if (__traits(compiles, message ~= yyvaluep.toString ()))
|
||||||
message ~= yyvaluep.toString ();
|
message ~= yyvaluep.toString ();
|
||||||
else
|
else
|
||||||
message ~= format ("%s", &yyvaluep);
|
message ~= format ("%s", &yyvaluep);
|
||||||
message ~= ")";
|
message ~= ")";
|
||||||
yycdebug (message);
|
yycdebugln (message);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
]])[
|
]])[
|
||||||
@@ -420,9 +428,10 @@ b4_locations_if([, ref ]b4_location_type[ yylocationp])[)
|
|||||||
*/
|
*/
|
||||||
public bool parse ()
|
public bool parse ()
|
||||||
{
|
{
|
||||||
/// Lookahead and lookahead in internal form.
|
// Lookahead token kind.
|
||||||
int yychar = yyempty_;
|
int yychar = TokenKind.YYEMPTY;
|
||||||
int yytoken = 0;
|
// Lookahead symbol kind.
|
||||||
|
SymbolKind yytoken = ]b4_symbol(-2, kind)[;
|
||||||
|
|
||||||
/* State. */
|
/* State. */
|
||||||
int yyn = 0;
|
int yyn = 0;
|
||||||
@@ -445,9 +454,9 @@ b4_locations_if([, ref ]b4_location_type[ yylocationp])[)
|
|||||||
/// Semantic value of the lookahead.
|
/// Semantic value of the lookahead.
|
||||||
]b4_yystype[ yylval;
|
]b4_yystype[ yylval;
|
||||||
|
|
||||||
int yyresult;]b4_parse_trace_if([[
|
bool yyresult;]b4_parse_trace_if([[
|
||||||
|
|
||||||
yycdebug ("Starting parse\n");]])[
|
yycdebugln ("Starting parse");]])[
|
||||||
yyerrstatus_ = 0;
|
yyerrstatus_ = 0;
|
||||||
|
|
||||||
]m4_ifdef([b4_initial_action], [
|
]m4_ifdef([b4_initial_action], [
|
||||||
@@ -468,7 +477,7 @@ m4_popdef([b4_at_dollar])])dnl
|
|||||||
/* New state. Unlike in the C/C++ skeletons, the state is already
|
/* New state. Unlike in the C/C++ skeletons, the state is already
|
||||||
pushed when we come here. */
|
pushed when we come here. */
|
||||||
case YYNEWSTATE:]b4_parse_trace_if([[
|
case YYNEWSTATE:]b4_parse_trace_if([[
|
||||||
yycdebug (format("Entering state %d\n", yystate));
|
yycdebugln (format("Entering state %d", yystate));
|
||||||
if (0 < yydebug)
|
if (0 < yydebug)
|
||||||
yystack.print (yyDebugStream);]])[
|
yystack.print (yyDebugStream);]])[
|
||||||
|
|
||||||
@@ -485,9 +494,9 @@ m4_popdef([b4_at_dollar])])dnl
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Read a lookahead token. */
|
/* Read a lookahead token. */
|
||||||
if (yychar == yyempty_)
|
if (yychar == TokenKind.YYEMPTY)
|
||||||
{]b4_parse_trace_if([[
|
{]b4_parse_trace_if([[
|
||||||
yycdebug ("Reading a token: ");]])[
|
yycdebugln ("Reading a token");]])[
|
||||||
yychar = yylex ();]b4_locations_if([[
|
yychar = yylex ();]b4_locations_if([[
|
||||||
static if (yy_location_is_class) {
|
static if (yy_location_is_class) {
|
||||||
yylloc = new ]b4_location_type[(yylexer.startPos, yylexer.endPos);
|
yylloc = new ]b4_location_type[(yylexer.startPos, yylexer.endPos);
|
||||||
@@ -499,43 +508,55 @@ m4_popdef([b4_at_dollar])])dnl
|
|||||||
|
|
||||||
/* Convert token to internal form. */
|
/* Convert token to internal form. */
|
||||||
yytoken = yytranslate_ (yychar);]b4_parse_trace_if([[
|
yytoken = yytranslate_ (yychar);]b4_parse_trace_if([[
|
||||||
yy_symbol_print ("Next token is",
|
yy_symbol_print ("Next token is", yytoken, yylval]b4_locations_if([, yylloc])[);]])[
|
||||||
yytoken, yylval]b4_locations_if([, yylloc])[);]])[
|
|
||||||
|
|
||||||
/* If the proper action on seeing token YYTOKEN is to reduce or to
|
if (yytoken == ]b4_symbol(1, kind)[)
|
||||||
detect an error, take that action. */
|
|
||||||
yyn += yytoken;
|
|
||||||
if (yyn < 0 || yylast_ < yyn || yycheck_[yyn] != yytoken)
|
|
||||||
label = YYDEFAULT;
|
|
||||||
|
|
||||||
/* <= 0 means reduce or error. */
|
|
||||||
else if ((yyn = yytable_[yyn]) <= 0)
|
|
||||||
{
|
{
|
||||||
if (yy_table_value_is_error_ (yyn))
|
// The scanner already issued an error message, process directly
|
||||||
label = YYERRLAB;
|
// to error recovery. But do not keep the error token as
|
||||||
else
|
// lookahead, it is too special and may lead us to an endless
|
||||||
{
|
// loop in error recovery. */
|
||||||
yyn = -yyn;
|
yychar = TokenKind.]b4_symbol(2, id)[;
|
||||||
label = YYREDUCE;
|
yytoken = ]b4_symbol(2, kind)[;]b4_locations_if([[
|
||||||
}
|
yyerrloc = yylloc;]])[
|
||||||
|
label = YYERRLAB1;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* Shift the lookahead token. */]b4_parse_trace_if([[
|
/* If the proper action on seeing token YYTOKEN is to reduce or to
|
||||||
yy_symbol_print ("Shifting", yytoken,
|
detect an error, take that action. */
|
||||||
yylval]b4_locations_if([, yylloc])[);]])[
|
yyn += yytoken;
|
||||||
|
if (yyn < 0 || yylast_ < yyn || yycheck_[yyn] != yytoken)
|
||||||
|
label = YYDEFAULT;
|
||||||
|
|
||||||
/* Discard the token being shifted. */
|
/* <= 0 means reduce or error. */
|
||||||
yychar = yyempty_;
|
else if ((yyn = yytable_[yyn]) <= 0)
|
||||||
|
{
|
||||||
|
if (yy_table_value_is_error_ (yyn))
|
||||||
|
label = YYERRLAB;
|
||||||
|
else
|
||||||
|
{
|
||||||
|
yyn = -yyn;
|
||||||
|
label = YYREDUCE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
/* Shift the lookahead token. */]b4_parse_trace_if([[
|
||||||
|
yy_symbol_print ("Shifting", yytoken, yylval]b4_locations_if([, yylloc])[);]])[
|
||||||
|
|
||||||
/* Count tokens shifted since error; after three, turn off error
|
/* Discard the token being shifted. */
|
||||||
* status. */
|
yychar = TokenKind.YYEMPTY;
|
||||||
if (yyerrstatus_ > 0)
|
|
||||||
--yyerrstatus_;
|
|
||||||
|
|
||||||
yystate = yyn;
|
/* Count tokens shifted since error; after three, turn off error
|
||||||
yystack.push (yystate, yylval]b4_locations_if([, yylloc])[);
|
* status. */
|
||||||
label = YYNEWSTATE;
|
if (yyerrstatus_ > 0)
|
||||||
|
--yyerrstatus_;
|
||||||
|
|
||||||
|
yystate = yyn;
|
||||||
|
yystack.push (yystate, yylval]b4_locations_if([, yylloc])[);
|
||||||
|
label = YYNEWSTATE;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@@ -559,33 +580,33 @@ m4_popdef([b4_at_dollar])])dnl
|
|||||||
yystate = yystack.stateAt (0);
|
yystate = yystack.stateAt (0);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
/*------------------------------------.
|
/*--------------------------------------.
|
||||||
| yyerrlab -- here on detecting error |
|
| yyerrlab -- here on detecting error. |
|
||||||
`------------------------------------*/
|
`--------------------------------------*/
|
||||||
case YYERRLAB:
|
case YYERRLAB:
|
||||||
/* If not already recovering from an error, report this error. */
|
/* If not already recovering from an error, report this error. */
|
||||||
if (yyerrstatus_ == 0)
|
if (yyerrstatus_ == 0)
|
||||||
{
|
{
|
||||||
++yynerrs_;
|
++yynerrs_;
|
||||||
if (yychar == yyempty_)
|
if (yychar == TokenKind.]b4_symbol(-2, id)[)
|
||||||
yytoken = yyempty_;
|
yytoken = ]b4_symbol(-2, kind)[;
|
||||||
yyerror (]b4_locations_if([yylloc, ])[yysyntax_error (yystate, yytoken));
|
yyerror (]b4_locations_if([yylloc, ])[yysyntax_error (yystate, yytoken));
|
||||||
}
|
}
|
||||||
|
]b4_locations_if([
|
||||||
]b4_locations_if([ yyerrloc = yylloc;])[
|
yyerrloc = yylloc;])[
|
||||||
if (yyerrstatus_ == 3)
|
if (yyerrstatus_ == 3)
|
||||||
{
|
{
|
||||||
/* 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 <= YYTokenType.EOF)
|
if (yychar <= TokenKind.]b4_symbol(0, [id])[)
|
||||||
{
|
{
|
||||||
/* Return failure if at end of input. */
|
/* Return failure if at end of input. */
|
||||||
if (yychar == YYTokenType.EOF)
|
if (yychar == TokenKind.]b4_symbol(0, [id])[)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
yychar = yyempty_;
|
yychar = TokenKind.YYEMPTY;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Else will try to reuse lookahead token after shifting the error
|
/* Else will try to reuse lookahead token after shifting the error
|
||||||
@@ -612,13 +633,14 @@ m4_popdef([b4_at_dollar])])dnl
|
|||||||
case YYERRLAB1:
|
case YYERRLAB1:
|
||||||
yyerrstatus_ = 3; /* Each real token shifted decrements this. */
|
yyerrstatus_ = 3; /* Each real token shifted decrements this. */
|
||||||
|
|
||||||
|
// Pop stack until we find a state that shifts the error token.
|
||||||
for (;;)
|
for (;;)
|
||||||
{
|
{
|
||||||
yyn = yypact_[yystate];
|
yyn = yypact_[yystate];
|
||||||
if (!yy_pact_value_is_default_ (yyn))
|
if (!yy_pact_value_is_default_ (yyn))
|
||||||
{
|
{
|
||||||
yyn += yy_error_token_;
|
yyn += ]b4_symbol(1, kind)[;
|
||||||
if (0 <= yyn && yyn <= yylast_ && yycheck_[yyn] == yy_error_token_)
|
if (0 <= yyn && yyn <= yylast_ && yycheck_[yyn] == ]b4_symbol(1, kind)[)
|
||||||
{
|
{
|
||||||
yyn = yytable_[yyn];
|
yyn = yytable_[yyn];
|
||||||
if (0 < yyn)
|
if (0 < yyn)
|
||||||
@@ -645,9 +667,8 @@ m4_popdef([b4_at_dollar])])dnl
|
|||||||
yystack.pop (2);])[
|
yystack.pop (2);])[
|
||||||
|
|
||||||
/* Shift the error token. */]b4_parse_trace_if([[
|
/* Shift the error token. */]b4_parse_trace_if([[
|
||||||
yy_symbol_print ("Shifting", yystos_[yyn],
|
import std.conv : to;
|
||||||
yylval]b4_locations_if([, yyloc])[);]])[
|
yy_symbol_print ("Shifting", to!SymbolKind (yystos_[yyn]), yylval]b4_locations_if([, yyloc])[);]])[
|
||||||
|
|
||||||
yystate = yyn;
|
yystate = yyn;
|
||||||
yystack.push (yyn, yylval]b4_locations_if([, yyloc])[);
|
yystack.push (yyn, yylval]b4_locations_if([, yyloc])[);
|
||||||
label = YYNEWSTATE;
|
label = YYNEWSTATE;
|
||||||
@@ -655,17 +676,26 @@ m4_popdef([b4_at_dollar])])dnl
|
|||||||
|
|
||||||
/* Accept. */
|
/* Accept. */
|
||||||
case YYACCEPT:
|
case YYACCEPT:
|
||||||
return true;
|
yyresult = true;
|
||||||
|
label = YYRETURN;
|
||||||
|
break;
|
||||||
|
|
||||||
/* Abort. */
|
/* Abort. */
|
||||||
case YYABORT:
|
case YYABORT:
|
||||||
return false;
|
yyresult = false;
|
||||||
|
label = YYRETURN;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case YYRETURN:]b4_parse_trace_if([[
|
||||||
|
if (0 < yydebug)
|
||||||
|
yystack.print (yyDebugStream);]])[
|
||||||
|
return yyresult;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Generate an error message.
|
// Generate an error message.
|
||||||
private final string yysyntax_error (int yystate, int tok)
|
private final string yysyntax_error (int yystate, SymbolKind tok)
|
||||||
{]b4_error_verbose_if([[
|
{]b4_parse_error_case([verbose], [[
|
||||||
/* There are many possibilities here to consider:
|
/* There are many possibilities here to consider:
|
||||||
- Assume YYFAIL is not used. It's too flawed to consider.
|
- Assume YYFAIL is not used. It's too flawed to consider.
|
||||||
See
|
See
|
||||||
@@ -697,7 +727,7 @@ m4_popdef([b4_at_dollar])])dnl
|
|||||||
will still contain any token that will not be accepted due
|
will still contain any token that will not be accepted due
|
||||||
to an error action in a later state.
|
to an error action in a later state.
|
||||||
*/
|
*/
|
||||||
if (tok != yyempty_)
|
if (tok != ]b4_symbol(-2, kind)[)
|
||||||
{
|
{
|
||||||
// FIXME: This method of building the message is not compatible
|
// FIXME: This method of building the message is not compatible
|
||||||
// with internationalization.
|
// with internationalization.
|
||||||
@@ -716,14 +746,14 @@ m4_popdef([b4_at_dollar])])dnl
|
|||||||
int yyxend = yychecklim < yyntokens_ ? yychecklim : yyntokens_;
|
int yyxend = yychecklim < yyntokens_ ? yychecklim : yyntokens_;
|
||||||
int count = 0;
|
int count = 0;
|
||||||
for (int x = yyxbegin; x < yyxend; ++x)
|
for (int x = yyxbegin; x < yyxend; ++x)
|
||||||
if (yycheck_[x + yyn] == x && x != yy_error_token_
|
if (yycheck_[x + yyn] == x && x != ]b4_symbol(1, kind)[
|
||||||
&& !yy_table_value_is_error_ (yytable_[x + yyn]))
|
&& !yy_table_value_is_error_ (yytable_[x + yyn]))
|
||||||
++count;
|
++count;
|
||||||
if (count < 5)
|
if (count < 5)
|
||||||
{
|
{
|
||||||
count = 0;
|
count = 0;
|
||||||
for (int x = yyxbegin; x < yyxend; ++x)
|
for (int x = yyxbegin; x < yyxend; ++x)
|
||||||
if (yycheck_[x + yyn] == x && x != yy_error_token_
|
if (yycheck_[x + yyn] == x && x != ]b4_symbol(1, kind)[
|
||||||
&& !yy_table_value_is_error_ (yytable_[x + yyn]))
|
&& !yy_table_value_is_error_ (yytable_[x + yyn]))
|
||||||
{
|
{
|
||||||
res ~= count++ == 0 ? ", expecting " : " or ";
|
res ~= count++ == 0 ? ", expecting " : " or ";
|
||||||
@@ -788,47 +818,46 @@ m4_popdef([b4_at_dollar])])dnl
|
|||||||
int yylno = yyrline_[yyrule];
|
int yylno = yyrline_[yyrule];
|
||||||
int yynrhs = yyr2_[yyrule];
|
int yynrhs = yyr2_[yyrule];
|
||||||
/* Print the symbols being reduced, and their result. */
|
/* Print the symbols being reduced, and their result. */
|
||||||
yycdebug (format("Reducing stack by rule %d (line %d), ",
|
yycdebugln (format("Reducing stack by rule %d (line %d):",
|
||||||
yyrule - 1, yylno));
|
yyrule - 1, yylno));
|
||||||
|
|
||||||
/* The symbols being reduced. */
|
/* The symbols being reduced. */
|
||||||
|
import std.conv : to;
|
||||||
for (int yyi = 0; yyi < yynrhs; yyi++)
|
for (int yyi = 0; yyi < yynrhs; yyi++)
|
||||||
yy_symbol_print (format(" $%d =", yyi + 1),
|
yy_symbol_print (format(" $%d =", yyi + 1),
|
||||||
yystos_[yystack.stateAt(yynrhs - (yyi + 1))],
|
to!SymbolKind (yystos_[yystack.stateAt(yynrhs - (yyi + 1))]),
|
||||||
]b4_rhs_value(yynrhs, yyi + 1)b4_locations_if([,
|
]b4_rhs_value(yynrhs, yyi + 1)b4_locations_if([,
|
||||||
b4_rhs_location(yynrhs, yyi + 1)])[);
|
b4_rhs_location(yynrhs, yyi + 1)])[);
|
||||||
}
|
}
|
||||||
]])[
|
]])[
|
||||||
|
|
||||||
private static token_number_type yytranslate_ (int t)
|
private static SymbolKind yytranslate_ (int t)
|
||||||
{
|
{
|
||||||
]b4_api_token_raw_if(
|
]b4_api_token_raw_if(
|
||||||
[[ import std.conv : to;
|
[[ import std.conv : to;
|
||||||
return to!byte (t);]],
|
return to!SymbolKind (t);]],
|
||||||
[[ /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
|
[[ /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
|
||||||
immutable token_number_type[] translate_table =
|
immutable ]b4_int_type_for([b4_translate])[[] translate_table =
|
||||||
@{
|
@{
|
||||||
]b4_translate[
|
]b4_translate[
|
||||||
@};
|
@};
|
||||||
|
|
||||||
immutable int user_token_number_max_ = ]b4_user_token_number_max[;
|
// Last valid token kind.
|
||||||
immutable token_number_type undef_token_ = ]b4_undef_token_number[;
|
immutable int code_max = ]b4_code_max[;
|
||||||
|
|
||||||
if (t <= 0)
|
if (t <= 0)
|
||||||
return YYTokenType.EOF;
|
return ]b4_symbol(0, kind)[;
|
||||||
else if (t <= user_token_number_max_)
|
else if (t <= code_max)
|
||||||
return translate_table[t];
|
{
|
||||||
|
import std.conv : to;
|
||||||
|
return to!SymbolKind (translate_table[t]);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
return undef_token_;]])[
|
return ]b4_symbol(2, kind)[;]])[
|
||||||
}
|
}
|
||||||
|
|
||||||
alias ]b4_int_type_for([b4_translate])[ token_number_type;
|
|
||||||
|
|
||||||
private static immutable token_number_type yy_error_token_ = 1;
|
|
||||||
|
|
||||||
private static immutable int yylast_ = ]b4_last[;
|
private static immutable int yylast_ = ]b4_last[;
|
||||||
private static immutable int yynnts_ = ]b4_nterms_number[;
|
private static immutable int yynnts_ = ]b4_nterms_number[;
|
||||||
private static immutable int yyempty_ = -2;
|
|
||||||
private static immutable int yyfinal_ = ]b4_final_state_number[;
|
private static immutable int yyfinal_ = ]b4_final_state_number[;
|
||||||
private static immutable int yyntokens_ = ]b4_tokens_number[;
|
private static immutable int yyntokens_ = ]b4_tokens_number[;
|
||||||
|
|
||||||
@@ -887,9 +916,8 @@ m4_popdef([b4_at_dollar])])dnl
|
|||||||
stream.writeln ();
|
stream.writeln ();
|
||||||
}]])[
|
}]])[
|
||||||
}
|
}
|
||||||
|
|
||||||
/* User implementation code. */
|
|
||||||
]b4_percent_code_get[
|
]b4_percent_code_get[
|
||||||
}
|
}
|
||||||
]b4_epilogue[]dnl
|
]b4_percent_code_get([[epilogue]])[]dnl
|
||||||
|
b4_epilogue[]dnl
|
||||||
b4_output_end
|
b4_output_end
|
||||||
|
|||||||
+353
-289
File diff suppressed because it is too large
Load Diff
+14
-10
@@ -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,16 +13,16 @@
|
|||||||
# 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
|
# b4_position_file
|
||||||
# ----------------
|
# ----------------
|
||||||
# Name of the file containing the position class, if we want this file.
|
# Name of the file containing the position class, if we want this file.
|
||||||
b4_defines_if([b4_required_version_if([302], [],
|
b4_defines_if([b4_required_version_if([30200], [],
|
||||||
[m4_define([b4_position_file], [position.hh])])])])
|
[m4_define([b4_position_file], [position.hh])])])])
|
||||||
|
|
||||||
|
|
||||||
@@ -48,7 +48,7 @@ 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)))
|
||||||
])
|
])
|
||||||
@@ -63,11 +63,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 +79,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 +108,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 +186,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 +204,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 +213,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[)
|
||||||
{
|
{
|
||||||
|
|||||||
+18
-13
@@ -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,13 @@
|
|||||||
# 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_defines_if([b4_required_version_if([30200], [],
|
||||||
[m4_define([b4_stack_file], [stack.hh])])])
|
[m4_define([b4_stack_file], [stack.hh])])])
|
||||||
|
|
||||||
|
|
||||||
@@ -32,8 +32,8 @@ m4_define([b4_stack_define],
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
// Hide our reversed order.
|
// Hide our reversed order.
|
||||||
typedef typename S::reverse_iterator iterator;
|
typedef typename S::iterator iterator;
|
||||||
typedef typename S::const_reverse_iterator const_iterator;
|
typedef typename S::const_iterator const_iterator;
|
||||||
typedef typename S::size_type size_type;
|
typedef typename S::size_type size_type;
|
||||||
typedef typename std::ptrdiff_t index_type;
|
typedef typename std::ptrdiff_t index_type;
|
||||||
|
|
||||||
@@ -41,6 +41,13 @@ m4_define([b4_stack_define],
|
|||||||
: seq_ (n)
|
: seq_ (n)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
#if 201103L <= YY_CPLUSPLUS
|
||||||
|
/// Non copyable.
|
||||||
|
stack (const stack&) = delete;
|
||||||
|
/// Non copyable.
|
||||||
|
stack& operator= (const stack&) = delete;
|
||||||
|
#endif
|
||||||
|
|
||||||
/// Random access.
|
/// Random access.
|
||||||
///
|
///
|
||||||
/// Index 0 returns the topmost element.
|
/// Index 0 returns the topmost element.
|
||||||
@@ -91,24 +98,18 @@ m4_define([b4_stack_define],
|
|||||||
return index_type (seq_.size ());
|
return index_type (seq_.size ());
|
||||||
}
|
}
|
||||||
|
|
||||||
std::ptrdiff_t
|
|
||||||
ssize () const YY_NOEXCEPT
|
|
||||||
{
|
|
||||||
return std::ptrdiff_t (size ());
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Iterator on top of the stack (going downwards).
|
/// Iterator on top of the stack (going downwards).
|
||||||
const_iterator
|
const_iterator
|
||||||
begin () const YY_NOEXCEPT
|
begin () const YY_NOEXCEPT
|
||||||
{
|
{
|
||||||
return seq_.rbegin ();
|
return seq_.begin ();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Bottom of the stack.
|
/// Bottom of the stack.
|
||||||
const_iterator
|
const_iterator
|
||||||
end () const YY_NOEXCEPT
|
end () const YY_NOEXCEPT
|
||||||
{
|
{
|
||||||
return seq_.rend ();
|
return seq_.end ();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Present a slice of the top of a stack.
|
/// Present a slice of the top of a stack.
|
||||||
@@ -132,8 +133,12 @@ m4_define([b4_stack_define],
|
|||||||
};
|
};
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
#if YY_CPLUSPLUS < 201103L
|
||||||
|
/// Non copyable.
|
||||||
stack (const stack&);
|
stack (const stack&);
|
||||||
|
/// Non copyable.
|
||||||
stack& operator= (const stack&);
|
stack& operator= (const stack&);
|
||||||
|
#endif
|
||||||
/// The wrapped container.
|
/// The wrapped container.
|
||||||
S seq_;
|
S seq_;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -0,0 +1,2 @@
|
|||||||
|
dnl GNU M4 treats -dV in a position-independent manner.
|
||||||
|
m4_debugmode(V)m4_traceon()dnl
|
||||||
+115
-45
@@ -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
|
||||||
]])
|
]])])
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -110,15 +117,22 @@ m4_define([b4_value_type_declare],
|
|||||||
template <typename T>
|
template <typename T>
|
||||||
semantic_type (YY_RVREF (T) t)]b4_parse_assert_if([
|
semantic_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
|
||||||
|
/// Non copyable.
|
||||||
|
semantic_type (const self_type&) = delete;
|
||||||
|
/// Non copyable.
|
||||||
|
self_type& operator= (const self_type&) = delete;
|
||||||
|
#endif
|
||||||
|
|
||||||
/// Destruction, allowed only if empty.
|
/// Destruction, allowed only if empty.
|
||||||
~semantic_type () YY_NOEXCEPT
|
~semantic_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
|
||||||
@@ -126,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
|
||||||
@@ -137,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 ();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -148,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
|
||||||
@@ -178,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> ();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -189,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> ();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -207,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> ());
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -258,9 +272,12 @@ m4_define([b4_value_type_declare],
|
|||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
/// Prohibit blind copies.
|
#if YY_CPLUSPLUS < 201103L
|
||||||
self_type& operator= (const self_type&);
|
/// Non copyable.
|
||||||
semantic_type (const self_type&);
|
semantic_type (const self_type&);
|
||||||
|
/// Non copyable.
|
||||||
|
self_type& operator= (const self_type&);
|
||||||
|
#endif
|
||||||
|
|
||||||
/// Accessor to raw memory as \a T.
|
/// Accessor to raw memory as \a T.
|
||||||
template <typename T>
|
template <typename T>
|
||||||
@@ -378,11 +395,67 @@ 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_tok_in(SYMBOL-NUM, ...)
|
||||||
|
# ---------------------------
|
||||||
|
# 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_token_constructor_define(SYMBOL-NUM...)
|
# _b4_token_constructor_define(SYMBOL-NUM...)
|
||||||
@@ -400,9 +473,6 @@ m4_define([_b4_token_constructor_define],
|
|||||||
: 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],
|
||||||
@@ -412,10 +482,10 @@ m4_define([_b4_token_constructor_define],
|
|||||||
: 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([[
|
||||||
|
]b4_assert[ (]b4_tok_in($@)[);
|
||||||
|
]])[}
|
||||||
]])])
|
]])])
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
+582
-445
File diff suppressed because it is too large
Load Diff
+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">
|
||||||
|
|||||||
+26
-21
@@ -1,4 +1,4 @@
|
|||||||
# Doxyfile 1.8.17
|
# Doxyfile 1.8.18
|
||||||
|
|
||||||
# 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.
|
||||||
@@ -253,12 +253,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,13 +294,13 @@ 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.
|
||||||
#
|
#
|
||||||
@@ -844,7 +838,7 @@ INPUT_ENCODING = UTF-8
|
|||||||
# *.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
|
# *.doc (to be provided as doxygen C comment), *.txt (to be provided as doxygen
|
||||||
# C comment), *.py, *.pyw, *.f90, *.f95, *.f03, *.f08, *.f, *.for, *.tcl, *.vhd,
|
# C comment), *.py, *.pyw, *.f90, *.f95, *.f03, *.f08, *.f18, *.f, *.for, *.vhd,
|
||||||
# *.vhdl, *.ucf, *.qsf and *.ice.
|
# *.vhdl, *.ucf, *.qsf and *.ice.
|
||||||
|
|
||||||
FILE_PATTERNS = *.c \
|
FILE_PATTERNS = *.c \
|
||||||
@@ -1490,6 +1484,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 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
|
||||||
@@ -1528,8 +1533,8 @@ FORMULA_MACROFILE =
|
|||||||
USE_MATHJAX = NO
|
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
|
||||||
# http://docs.mathjax.org/en/latest/output.html) for more details.
|
# <https://docs.mathjax.org/en/latest/> 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 +1550,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 +1564,7 @@ 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
|
# <https://docs.mathjax.org/en/latest/> 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.
|
||||||
|
|
||||||
@@ -1715,7 +1720,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
|
||||||
@@ -2217,9 +2222,9 @@ HIDE_UNDOC_RELATIONS = YES
|
|||||||
|
|
||||||
# If you set the HAVE_DOT tag to YES then doxygen will assume the dot tool is
|
# If you set the HAVE_DOT tag to YES then doxygen will assume the dot tool is
|
||||||
# available from the path. This tool is part of Graphviz (see:
|
# available from the path. This tool is part of Graphviz (see:
|
||||||
# http://www.graphviz.org/), a graph visualization toolkit from AT&T and Lucent
|
# https://www.graphviz.org/), a graph visualization toolkit from AT&T
|
||||||
# Bell Labs. The other options in this section have no effect if this option is
|
# and Lucent Bell Labs. The other options in this section have no
|
||||||
# set to NO
|
# effect if this option is set to NO
|
||||||
# The default value is: NO.
|
# The default value is: NO.
|
||||||
|
|
||||||
HAVE_DOT = YES
|
HAVE_DOT = YES
|
||||||
@@ -2372,7 +2377,7 @@ DIRECTORY_GRAPH = YES
|
|||||||
# The DOT_IMAGE_FORMAT tag can be used to set the image format of the images
|
# The DOT_IMAGE_FORMAT tag can be used to set the image format of the images
|
||||||
# generated by dot. For an explanation of the image formats see the section
|
# generated by dot. For an explanation of the image formats see the section
|
||||||
# output formats in the documentation of the dot tool (Graphviz (see:
|
# output formats in the documentation of the dot tool (Graphviz (see:
|
||||||
# http://www.graphviz.org/)).
|
# https://www.graphviz.org/)).
|
||||||
# Note: If you choose svg you need to set HTML_FILE_EXTENSION to xhtml in order
|
# Note: If you choose svg you need to set HTML_FILE_EXTENSION to xhtml in order
|
||||||
# to make the SVG files visible in IE 9+ (other browsers do not have this
|
# to make the SVG files visible in IE 9+ (other browsers do not have this
|
||||||
# requirement).
|
# requirement).
|
||||||
|
|||||||
+2625
-1145
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;
|
||||||
@@ -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]
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,13 @@
|
|||||||
|
%%
|
||||||
|
stmt:
|
||||||
|
expr
|
||||||
|
| if_stmt
|
||||||
|
;
|
||||||
|
|
||||||
|
if_stmt:
|
||||||
|
"if" expr "then" stmt
|
||||||
|
| "if" expr "then" stmt "else" stmt
|
||||||
|
;
|
||||||
|
|
||||||
|
expr:
|
||||||
|
"identifier"
|
||||||
+73
-58
@@ -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 \
|
||||||
@@ -20,71 +20,71 @@ AM_MAKEINFOFLAGS = \
|
|||||||
--set-customization-variable=AVOID_MENU_REDUNDANCY=true \
|
--set-customization-variable=AVOID_MENU_REDUNDANCY=true \
|
||||||
--set-customization-variable=ICONS=true
|
--set-customization-variable=ICONS=true
|
||||||
|
|
||||||
info_TEXINFOS = doc/bison.texi
|
info_TEXINFOS = %D%/bison.texi
|
||||||
doc_bison_TEXINFOS = \
|
%C%_bison_TEXINFOS = \
|
||||||
$(CROSS_OPTIONS_TEXI) \
|
$(CROSS_OPTIONS_TEXI) \
|
||||||
doc/fdl.texi \
|
%D%/fdl.texi \
|
||||||
doc/gpl-3.0.texi \
|
%D%/gpl-3.0.texi \
|
||||||
doc/relocatable.texi
|
%D%/relocatable.texi
|
||||||
|
|
||||||
# Cannot express dependencies directly on file names because of Automake.
|
# Cannot express dependencies directly on file names because of Automake.
|
||||||
# Obfuscate with a variable.
|
# Obfuscate with a variable.
|
||||||
doc_bison = doc/bison
|
%C%_bison = %D%/bison
|
||||||
$(doc_bison).dvi: $(FIGS_GV:.gv=.eps)
|
$(%C%_bison).dvi: $(FIGS_GV:.gv=.eps)
|
||||||
$(doc_bison).info: $(FIGS_GV:.gv=.txt)
|
$(%C%_bison).info: $(FIGS_GV:.gv=.txt)
|
||||||
$(doc_bison).pdf: $(FIGS_GV:.gv=.pdf)
|
$(%C%_bison).pdf: $(FIGS_GV:.gv=.pdf)
|
||||||
$(doc_bison).html: $(FIGS_GV:.gv=.svg)
|
$(%C%_bison).html: $(FIGS_GV:.gv=.svg)
|
||||||
|
|
||||||
TEXI2DVI = texi2dvi --build-dir=doc/bison.t2d -I doc
|
TEXI2DVI = texi2dvi --build-dir=%D%/bison.t2d -I %D%
|
||||||
CLEANDIRS += doc/bison.t2d
|
CLEANDIRS += %D%/bison.t2d
|
||||||
|
|
||||||
MOSTLYCLEANFILES += $(top_srcdir)/doc/*.tmp
|
MOSTLYCLEANFILES += $(top_srcdir)/%D%/*.tmp
|
||||||
|
|
||||||
CROSS_OPTIONS_PL = $(top_srcdir)/build-aux/cross-options.pl
|
CROSS_OPTIONS_PL = $(top_srcdir)/build-aux/cross-options.pl
|
||||||
CROSS_OPTIONS_TEXI = $(top_srcdir)/doc/cross-options.texi
|
CROSS_OPTIONS_TEXI = $(top_srcdir)/%D%/cross-options.texi
|
||||||
$(CROSS_OPTIONS_TEXI): doc/bison.help $(CROSS_OPTIONS_PL)
|
$(CROSS_OPTIONS_TEXI): %D%/bison.help $(CROSS_OPTIONS_PL)
|
||||||
# Create $@~ which is the previous contents. Don't use 'mv' here so
|
# Create $@~ which is the previous contents. Don't use 'mv' here so
|
||||||
# that even if we are interrupted, the file is still available for
|
# that even if we are interrupted, the file is still available for
|
||||||
# diff in the next run. Note that $@ might not exist yet.
|
# diff in the next run. Note that $@ might not exist yet.
|
||||||
$(AM_V_GEN){ test ! -f $@ || cat $@; } >$@~
|
$(AM_V_GEN){ test ! -f $@ || cat $@; } >$@~
|
||||||
$(AM_V_at)test ! -f $@.tmp || rm -f $@.tmp
|
$(AM_V_at)test ! -f $@.tmp || rm -f $@.tmp
|
||||||
$(AM_V_at)$(PERL) $(CROSS_OPTIONS_PL) $(top_srcdir)/src/scan-gram.l \
|
$(AM_V_at)$(PERL) $(CROSS_OPTIONS_PL) $(top_srcdir)/src/scan-gram.l \
|
||||||
<$(top_srcdir)/doc/bison.help >$@.tmp
|
<$(top_srcdir)/%D%/bison.help >$@.tmp
|
||||||
$(AM_V_at)diff -u $@~ $@.tmp || true
|
$(AM_V_at)diff -u $@~ $@.tmp || true
|
||||||
$(AM_V_at)mv $@.tmp $@
|
$(AM_V_at)mv $@.tmp $@
|
||||||
MAINTAINERCLEANFILES = $(CROSS_OPTIONS_TEXI)
|
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)/$(doc_bison).info.bak
|
all-local: $(srcdir)/$(%C%_bison).info.bak
|
||||||
$(srcdir)/$(doc_bison).info.bak: $(srcdir)/$(doc_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)*)}' \
|
||||||
-e '{' \
|
-e '{' \
|
||||||
-e ' $$def = $$1;' \
|
-e ' $$def = $$1;' \
|
||||||
-e ' $$def =~ s/‘|’//g;' \
|
-e ' $$def =~ s/‘|’//g;' \
|
||||||
-e ' $$def;' \
|
-e ' $$def;' \
|
||||||
-e '}gem;' $(srcdir)/$(doc_bison).info
|
-e '}gem;' $(srcdir)/$(%C%_bison).info
|
||||||
@ touch $@
|
@ touch $@
|
||||||
EXTRA_DIST += $(srcdir)/$(doc_bison).info.bak
|
EXTRA_DIST += $(srcdir)/$(%C%_bison).info.bak
|
||||||
MAINTAINERCLEANFILES += $(srcdir)/$(doc_bison).info.bak
|
MAINTAINERCLEANFILES += $(srcdir)/$(%C%_bison).info.bak
|
||||||
|
|
||||||
|
|
||||||
## ---------- ##
|
## ---------- ##
|
||||||
## Ref card. ##
|
## Ref card. ##
|
||||||
## ---------- ##
|
## ---------- ##
|
||||||
|
|
||||||
EXTRA_DIST += doc/refcard.tex
|
EXTRA_DIST += %D%/refcard.tex
|
||||||
CLEANFILES += doc/refcard.pdf
|
CLEANFILES += %D%/refcard.pdf
|
||||||
|
|
||||||
doc/refcard.pdf: doc/refcard.tex
|
%D%/refcard.pdf: %D%/refcard.tex
|
||||||
$(AM_V_GEN) cd doc && pdftex $(abs_top_srcdir)/doc/refcard.tex
|
$(AM_V_GEN) cd %D% && pdftex $(abs_top_srcdir)/%D%/refcard.tex
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
## ---------------- ##
|
## ---------------- ##
|
||||||
## doc/bison.help. ##
|
## %D%/bison.help. ##
|
||||||
## ---------------- ##
|
## ---------------- ##
|
||||||
|
|
||||||
# Some of our targets (cross-options.texi, bison.1) use "bison --help".
|
# Some of our targets (cross-options.texi, bison.1) use "bison --help".
|
||||||
@@ -106,18 +106,19 @@ doc/refcard.pdf: doc/refcard.tex
|
|||||||
# compilations of cross-options.texi and bison.1. At the cost of
|
# compilations of cross-options.texi and bison.1. At the cost of
|
||||||
# repeated builds of bison.help.
|
# repeated builds of bison.help.
|
||||||
|
|
||||||
EXTRA_DIST += $(top_srcdir)/doc/bison.help
|
EXTRA_DIST += $(top_srcdir)/%D%/bison.help
|
||||||
if ! CROSS_COMPILING
|
if ! CROSS_COMPILING
|
||||||
MAINTAINERCLEANFILES += $(top_srcdir)/doc/bison.help
|
MAINTAINERCLEANFILES += $(top_srcdir)/%D%/bison.help
|
||||||
$(top_srcdir)/doc/bison.help: src/bison$(EXEEXT)
|
$(top_srcdir)/%D%/bison.help: src/bison$(EXEEXT)
|
||||||
$(AM_V_GEN)LC_ALL=C tests/bison --version >doc/bison.help.tmp
|
$(AM_V_GEN)$(MKDIR_P) %D%
|
||||||
|
$(AM_V_at) LC_ALL=C tests/bison --version >%D%/bison.help.tmp
|
||||||
$(AM_V_at) LC_ALL=C tests/bison --help | \
|
$(AM_V_at) LC_ALL=C tests/bison --help | \
|
||||||
## Avoid depending on the path to Bison.
|
## Avoid depending on the path to Bison.
|
||||||
sed -e 's,^Usage: .*/bison \[OPTION\],Usage: bison [OPTION],g' \
|
sed -e 's,^Usage: .*/bison \[OPTION\],Usage: bison [OPTION],g' \
|
||||||
## Avoid variations in the output depending on whether we are
|
## Avoid variations in the output depending on whether we are
|
||||||
## on a glibc system.
|
## on a glibc system.
|
||||||
-e '/translation bugs/d' >>doc/bison.help.tmp
|
-e '/translation bugs/d' >>%D%/bison.help.tmp
|
||||||
$(AM_V_at)$(top_srcdir)/build-aux/move-if-change doc/bison.help.tmp $@
|
$(AM_V_at)$(top_srcdir)/build-aux/move-if-change %D%/bison.help.tmp $@
|
||||||
endif ! CROSS_COMPILING
|
endif ! CROSS_COMPILING
|
||||||
|
|
||||||
|
|
||||||
@@ -125,34 +126,48 @@ endif ! CROSS_COMPILING
|
|||||||
## Man Pages. ##
|
## Man Pages. ##
|
||||||
## ----------- ##
|
## ----------- ##
|
||||||
|
|
||||||
dist_man_MANS = $(top_srcdir)/doc/bison.1
|
dist_man_MANS = $(top_srcdir)/%D%/bison.1
|
||||||
|
|
||||||
EXTRA_DIST += $(dist_man_MANS:.1=.x)
|
EXTRA_DIST += $(dist_man_MANS:.1=.x)
|
||||||
MAINTAINERCLEANFILES += $(dist_man_MANS)
|
MAINTAINERCLEANFILES += $(dist_man_MANS)
|
||||||
|
|
||||||
# Differences to ignore when comparing the man page (the date).
|
# Differences to ignore when comparing man pages (the date).
|
||||||
remove_time_stamp = \
|
remove_time_stamp = \
|
||||||
sed 's/^\(\.TH[^"]*"[^"]*"[^"]*\)"[^"]*"/\1/'
|
sed 's/^\(\.TH[^"]*"[^"]*"[^"]*\)"[^"]*"/\1/'
|
||||||
|
|
||||||
# Depend on configure to get version number changes.
|
# Depend on configure to get version number changes.
|
||||||
if ! CROSS_COMPILING
|
if ! CROSS_COMPILING
|
||||||
MAN_DEPS = doc/bison.help doc/bison.x $(top_srcdir)/configure
|
MAN_DEPS = %D%/bison.help %D%/bison.x $(top_srcdir)/configure
|
||||||
endif
|
endif
|
||||||
|
|
||||||
$(top_srcdir)/doc/bison.1: $(MAN_DEPS)
|
# If we don't have help2man, just touch the target. Maintainers must
|
||||||
$(AM_V_GEN)$(HELP2MAN) \
|
# have the real thing, so if there's a .git directory, fail hard.
|
||||||
--include=$(top_srcdir)/doc/bison.x \
|
#
|
||||||
--output=$@.tmp tests/bison
|
# We shouldn't need this, but on some OS the timestamps in the tarball
|
||||||
$(AM_V_at)if $(remove_time_stamp) $@ >$@a.tmp 2>/dev/null && \
|
# leave us no choice. See
|
||||||
$(remove_time_stamp) $@.tmp | cmp $@a.tmp - >/dev/null 2>&1; then \
|
# https://lists.gnu.org/r/bug-bison/2020-05/msg00055.html.
|
||||||
touch $@; \
|
$(top_srcdir)/%D%/bison.1: $(MAN_DEPS)
|
||||||
else \
|
$(AM_V_GEN)if $(HELP2MAN) --version >/dev/null 2>&1; then \
|
||||||
mv $@.tmp $@; \
|
$(HELP2MAN) \
|
||||||
|
--include=$(top_srcdir)/%D%/bison.x \
|
||||||
|
--output=$@.tmp tests/bison && \
|
||||||
|
{ $(remove_time_stamp) $@ >$@a.tmp || true; } && \
|
||||||
|
$(remove_time_stamp) $@.tmp >$@b.tmp && \
|
||||||
|
if diff $@a.tmp $@b.tmp >/dev/null 2>&1; then \
|
||||||
|
touch $@; \
|
||||||
|
else \
|
||||||
|
mv $@.tmp $@; \
|
||||||
|
fi && \
|
||||||
|
rm -f $@*.tmp; \
|
||||||
|
elif test -d $(srcdir)/.git; then \
|
||||||
|
echo >&2 "ERROR: $@: help2man is needed"; \
|
||||||
|
exit 1; \
|
||||||
|
else \
|
||||||
|
touch $@; \
|
||||||
fi
|
fi
|
||||||
$(AM_V_at)rm -f $@*.tmp
|
|
||||||
|
|
||||||
if ENABLE_YACC
|
if ENABLE_YACC
|
||||||
nodist_man_MANS = doc/yacc.1
|
nodist_man_MANS = %D%/yacc.1
|
||||||
endif
|
endif
|
||||||
|
|
||||||
## ----------------------------- ##
|
## ----------------------------- ##
|
||||||
@@ -161,8 +176,8 @@ endif
|
|||||||
|
|
||||||
CLEANFILES += $(FIGS_GV:.gv=.eps) $(FIGS_GV:.gv=.pdf) $(FIGS_GV:.gv=.svg)
|
CLEANFILES += $(FIGS_GV:.gv=.eps) $(FIGS_GV:.gv=.pdf) $(FIGS_GV:.gv=.svg)
|
||||||
FIGS_GV = \
|
FIGS_GV = \
|
||||||
doc/figs/example.gv \
|
%D%/figs/example.gv \
|
||||||
doc/figs/example-reduce.gv doc/figs/example-shift.gv
|
%D%/figs/example-reduce.gv %D%/figs/example-shift.gv
|
||||||
EXTRA_DIST += \
|
EXTRA_DIST += \
|
||||||
$(FIGS_GV) $(FIGS_GV:.gv=.txt) \
|
$(FIGS_GV) $(FIGS_GV:.gv=.txt) \
|
||||||
$(FIGS_GV:.gv=.eps) $(FIGS_GV:.gv=.pdf) $(FIGS_GV:.gv=.svg)
|
$(FIGS_GV:.gv=.eps) $(FIGS_GV:.gv=.pdf) $(FIGS_GV:.gv=.svg)
|
||||||
@@ -193,8 +208,8 @@ DOXYGEN = doxygen
|
|||||||
|
|
||||||
doc: html
|
doc: html
|
||||||
|
|
||||||
html-local: doc/Doxyfile
|
html-local: %D%/Doxyfile
|
||||||
$(AM_V_GEN) $(DOXYGEN) doc/Doxyfile
|
$(AM_V_GEN) $(DOXYGEN) %D%/Doxyfile
|
||||||
|
|
||||||
edit = sed -e 's,@PACKAGE_NAME\@,$(PACKAGE_NAME),g' \
|
edit = sed -e 's,@PACKAGE_NAME\@,$(PACKAGE_NAME),g' \
|
||||||
-e 's,@PACKAGE_VERSION\@,$(PACKAGE_VERSION),g' \
|
-e 's,@PACKAGE_VERSION\@,$(PACKAGE_VERSION),g' \
|
||||||
@@ -202,11 +217,11 @@ edit = sed -e 's,@PACKAGE_NAME\@,$(PACKAGE_NAME),g' \
|
|||||||
-e 's,@top_builddir\@,$(top_builddir),g' \
|
-e 's,@top_builddir\@,$(top_builddir),g' \
|
||||||
-e 's,@top_srcdir\@,$(top_srcdir),g'
|
-e 's,@top_srcdir\@,$(top_srcdir),g'
|
||||||
|
|
||||||
EXTRA_DIST += doc/Doxyfile.in
|
EXTRA_DIST += %D%/Doxyfile.in
|
||||||
CLEANFILES += doc/Doxyfile
|
CLEANFILES += %D%/Doxyfile
|
||||||
# Sed is used to generate Doxyfile from Doxyfile.in instead of
|
# Sed is used to generate Doxyfile from Doxyfile.in instead of
|
||||||
# configure, because the former is way faster than the latter.
|
# configure, because the former is way faster than the latter.
|
||||||
doc/Doxyfile: $(top_srcdir)/doc/Doxyfile.in
|
%D%/Doxyfile: $(top_srcdir)/%D%/Doxyfile.in
|
||||||
$(AM_V_GEN) $(edit) $(top_srcdir)/doc/Doxyfile.in >doc/Doxyfile
|
$(AM_V_GEN) $(edit) $(top_srcdir)/%D%/Doxyfile.in >%D%/Doxyfile
|
||||||
|
|
||||||
CLEANDIRS += doc/html
|
CLEANDIRS += %D%/html
|
||||||
|
|||||||
+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.
|
||||||
|
|
||||||
|
-->
|
||||||
+371
-215
File diff suppressed because one or more lines are too long
+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
|
||||||
|
|||||||
@@ -8,13 +8,13 @@ afterwards.
|
|||||||
## simple.yy - Simple example in C++14
|
## simple.yy - Simple example in C++14
|
||||||
A very simple example in C++, based on variants and symbol constructors.
|
A very simple example in C++, based on variants and symbol constructors.
|
||||||
Variants allow to use any C++ type as semantic value type, and symbol
|
Variants allow to use any C++ type as semantic value type, and symbol
|
||||||
constructors ensure consistency between declared token type and effective
|
constructors ensure consistency between declared token kind and effective
|
||||||
semantic value.
|
semantic value.
|
||||||
|
|
||||||
Run as `./simple`.
|
Run as `./simple`.
|
||||||
|
|
||||||
Extracted from the documentation: "A Simple C++ Example".
|
Extracted from the documentation: [A Simple C++
|
||||||
https://www.gnu.org/software/bison/manual/html_node/A-Simple-C_002b_002b-Example.html
|
Example](https://www.gnu.org/software/bison/manual/html_node/A-Simple-C_002b_002b-Example.html).
|
||||||
|
|
||||||
## variant.yy - Self-contained example in C++98
|
## variant.yy - Self-contained example in C++98
|
||||||
A variation of simple.yy, in C++98.
|
A variation of simple.yy, in C++98.
|
||||||
@@ -36,8 +36,8 @@ starting point for a clean parser in C++. The previous examples are better
|
|||||||
introductory examples, and the C examples are also useful introductory
|
introductory examples, and the C examples are also useful introductory
|
||||||
examples.
|
examples.
|
||||||
|
|
||||||
Extracted from the documentation: "A Complete C++ Example".
|
Extracted from the documentation: [A Complete C++
|
||||||
https://www.gnu.org/software/bison/manual/html_node/A-Complete-C_002b_002b-Example.html
|
Example](https://www.gnu.org/software/bison/manual/html_node/A-Complete-C_002b_002b-Example.html).
|
||||||
|
|
||||||
<!---
|
<!---
|
||||||
|
|
||||||
@@ -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
|
||||||
@@ -55,5 +55,5 @@ 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.
|
||||||
|
|
||||||
# LocalWords: mfcalc calc parsers yy ispell american
|
LocalWords: mfcalc calc parsers yy ispell american
|
||||||
--->
|
--->
|
||||||
|
|||||||
@@ -5,9 +5,9 @@ saw the traditional implementation in C, please first read
|
|||||||
examples/c/lexcalc, which can be seen as a C precursor of this example.
|
examples/c/lexcalc, which can be seen as a C precursor of this example.
|
||||||
|
|
||||||
Read the corresponding chapter in the documentation: "A Complete C++
|
Read the corresponding chapter in the documentation: "A Complete C++
|
||||||
Example". It is also available on line (maybe with a different version of
|
Example". It is also available [on
|
||||||
Bison):
|
line](https://www.gnu.org/software/bison/manual/html_node/A-Complete-C_002b_002b-Example.html)
|
||||||
https://www.gnu.org/software/bison/manual/html_node/A-Complete-C_002b_002b-Example.html
|
(maybe with a different version of Bison).
|
||||||
|
|
||||||
To use it, copy this directory into some work directory, and run `make` to
|
To use it, copy this directory into some work directory, and run `make` to
|
||||||
compile the executable, and try it. It is a simple calculator which accepts
|
compile the executable, and try it. It is a simple calculator which accepts
|
||||||
@@ -36,22 +36,14 @@ 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 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.
|
||||||
|
|
||||||
This program is free software: you can redistribute it and/or modify
|
LocalWords: calc parsers yy MERCHANTABILITY Ctrl ispell american
|
||||||
it under the terms of the GNU General Public License as published by
|
|
||||||
the Free Software Foundation, either version 3 of the License, or
|
|
||||||
(at your option) any later version.
|
|
||||||
|
|
||||||
This program is distributed in the hope that it will be useful,
|
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
GNU General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
|
||||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
# LocalWords: calc parsers yy MERCHANTABILITY Ctrl ispell american
|
|
||||||
--->
|
--->
|
||||||
|
|||||||
@@ -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
|
||||||
@@ -44,11 +44,18 @@ EOF
|
|||||||
run 0 9
|
run 0 9
|
||||||
|
|
||||||
|
|
||||||
|
cat >input <<EOF
|
||||||
|
1 +
|
||||||
|
EOF
|
||||||
|
run 1 'err: -:2.1: syntax error, unexpected end of file, expecting ( or identifier or number'
|
||||||
|
|
||||||
|
|
||||||
|
# LAC finds many more tokens.
|
||||||
cat >input <<EOF
|
cat >input <<EOF
|
||||||
a := 1
|
a := 1
|
||||||
d := a + b * c
|
d := a + b * c
|
||||||
EOF
|
EOF
|
||||||
run 1 'err: -:3.1: syntax error, unexpected end of file, expecting ( or identifier or number'
|
run 1 'err: -:3.1: syntax error, unexpected end of file'
|
||||||
|
|
||||||
|
|
||||||
cat >input <<EOF
|
cat >input <<EOF
|
||||||
|
|||||||
@@ -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,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/>.
|
||||||
|
|
||||||
## ------------------- ##
|
## ------------------- ##
|
||||||
## Parser generation. ##
|
## Parser generation. ##
|
||||||
|
|||||||
@@ -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,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/>.
|
||||||
|
|
||||||
cxxdir = $(docdir)/%D%
|
cxxdir = $(docdir)/%D%
|
||||||
include %D%/calc++/local.mk
|
include %D%/calc++/local.mk
|
||||||
|
|||||||
@@ -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"
|
||||||
@@ -139,7 +139,7 @@ namespace yy
|
|||||||
int
|
int
|
||||||
main (int argc, const char *argv[])
|
main (int argc, const char *argv[])
|
||||||
{
|
{
|
||||||
if (2 <= argc && isdigit (*argv[1]))
|
if (2 <= argc && isdigit (static_cast<unsigned char> (*argv[1])))
|
||||||
{
|
{
|
||||||
auto maxl = strtol (argv[1], nullptr, 10);
|
auto maxl = strtol (argv[1], nullptr, 10);
|
||||||
max = INT_MIN <= maxl && maxl <= INT_MAX ? int(maxl) : 4;
|
max = INT_MIN <= maxl && maxl <= INT_MAX ? int(maxl) : 4;
|
||||||
|
|||||||
@@ -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"
|
||||||
|
|||||||
+53
-13
@@ -10,8 +10,8 @@ The first example is that of a simple double-precision Reverse Polish
|
|||||||
Notation calculator (a calculator using postfix operators). This example
|
Notation calculator (a calculator using postfix operators). This example
|
||||||
provides a good starting point, since operator precedence is not an issue.
|
provides a good starting point, since operator precedence is not an issue.
|
||||||
|
|
||||||
Extracted from the documentation: "Reverse Polish Notation Calculator"
|
Extracted from the documentation: [Reverse Polish Notation
|
||||||
https://www.gnu.org/software/bison/manual/html_node/RPN-Calc.html
|
Calculator](https://www.gnu.org/software/bison/manual/html_node/RPN-Calc.html).
|
||||||
|
|
||||||
## calc - Simple Calculator
|
## calc - Simple Calculator
|
||||||
This example is slightly more complex than rpcalc: it features infix
|
This example is slightly more complex than rpcalc: it features infix
|
||||||
@@ -24,19 +24,55 @@ A more complete C example: a multi-function calculator. More complex than
|
|||||||
the previous example. Using precedence directives to support infix
|
the previous example. Using precedence directives to support infix
|
||||||
operators.
|
operators.
|
||||||
|
|
||||||
Extracted from the documentation: "Multi-Function Calculator: mfcalc".
|
Extracted from the documentation: [Multi-Function Calculator:
|
||||||
https://www.gnu.org/software/bison/manual/html_node/Multi_002dfunction-Calc.html
|
mfcalc](https://www.gnu.org/software/bison/manual/html_node/Multi_002dfunction-Calc.html).
|
||||||
|
|
||||||
## lexcalc - calculator with Flex and Bison
|
## lexcalc - calculator with Flex and Bison
|
||||||
The calculator, redux. This time using a scanner generated by Flex.
|
The calculator with precedence directives and location tracking. It uses
|
||||||
|
Flex to generate the scanner.
|
||||||
|
|
||||||
## reccalc - recursive calculator with Flex and Bison
|
## reccalc - recursive calculator with Flex and Bison
|
||||||
The example builds on top of the previous one to provide a reentrant parser.
|
This example builds on top of the previous one to provide a reentrant
|
||||||
Such parsers can be called concurrently in different threads, or even
|
parser. Such parsers can be called concurrently in different threads, or
|
||||||
recursively. To demonstrate this feature, expressions in parentheses are
|
even recursively. To demonstrate this feature, expressions in parentheses
|
||||||
tokenized as strings, and then recursively parsed from the parser. So
|
are tokenized as strings, and then recursively parsed from the parser. So
|
||||||
`(((1)+(2))*((3)+(4)))` uses eight parsers, with a depth of four.
|
`(((1)+(2))*((3)+(4)))` uses eight parsers, with a depth of four.
|
||||||
|
|
||||||
|
## pushcalc - calculator implemented with a push parser
|
||||||
|
All the previous examples are so called "pull parsers": the user invokes the
|
||||||
|
parser once, which repeatedly calls the scanner until the input is drained.
|
||||||
|
|
||||||
|
This example demonstrates the "push parsers": the user calls the scanner to
|
||||||
|
fetch the next token, passes it to the parser, and repeats the operation
|
||||||
|
until the input is drained.
|
||||||
|
|
||||||
|
This example is a straightforward conversion of the 'calc' example to the
|
||||||
|
push-parser model.
|
||||||
|
|
||||||
|
## bistromathic - all the bells and whistles
|
||||||
|
This example demonstrates best practices when using Bison.
|
||||||
|
- Its hand-written scanner tracks locations.
|
||||||
|
- Its interface is pure.
|
||||||
|
- 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
|
||||||
|
push-parser API to feed the parser with the incoming tokens.
|
||||||
|
- It features an interactive command line with completion based on the
|
||||||
|
parser state, based on `yyexpected_tokens`.
|
||||||
|
- It uses Bison's standard catalogue for internationalization of generated
|
||||||
|
messages.
|
||||||
|
- It uses a custom syntax error with location, lookahead correction and
|
||||||
|
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 uses named references instead of the traditional $1, $2, etc.
|
||||||
|
|
||||||
<!---
|
<!---
|
||||||
|
|
||||||
@@ -45,7 +81,9 @@ 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.
|
||||||
|
|
||||||
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
|
||||||
@@ -54,6 +92,8 @@ 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.
|
||||||
|
|
||||||
# LocalWords: mfcalc calc parsers yy rpcalc lexcalc redux reccalc ispell
|
LocalWords: mfcalc calc parsers yy rpcalc lexcalc redux reccalc ispell
|
||||||
# LocalWords: reentrant tokenized american postfix
|
LocalWords: reentrant tokenized american postfix pushcalc bistromathic
|
||||||
--->
|
LocalWords: lookahead
|
||||||
|
|
||||||
|
-->
|
||||||
|
|||||||
@@ -0,0 +1,40 @@
|
|||||||
|
# This Makefile is designed to be simple and readable. It does not
|
||||||
|
# aim at portability. It requires GNU Make.
|
||||||
|
|
||||||
|
BASE = bistromathic
|
||||||
|
BISON = bison
|
||||||
|
XSLTPROC = xsltproc
|
||||||
|
|
||||||
|
# We need to find the headers and libs for readline (and possibly intl).
|
||||||
|
# You probably need to customize this for your own environment.
|
||||||
|
CPPFLAGS = -I/opt/local/include
|
||||||
|
LDFLAGS = -L/opt/local/lib
|
||||||
|
|
||||||
|
# Find the translation catalogue for Bison's generated messagess.
|
||||||
|
BISON_LOCALEDIR = $(shell $(BISON) $(BISON_FLAGS) --print-localedir)
|
||||||
|
CPPFLAGS += -DENABLE_NLS -DBISON_LOCALEDIR='"$(BISON_LOCALEDIR)"'
|
||||||
|
|
||||||
|
LIBS = -lreadline -lm # In some environments, -lintl is needed.
|
||||||
|
|
||||||
|
all: $(BASE)
|
||||||
|
|
||||||
|
%.c %.h %.xml %.gv: %.y
|
||||||
|
$(BISON) $(BISONFLAGS) --defines --xml --graph=$*.gv -o $*.c $<
|
||||||
|
|
||||||
|
$(BASE): parse.o
|
||||||
|
$(CC) $(CPPFLAGS) $(CFLAGS) -o $@ $^ $(LDFLAGS) $(LIBS)
|
||||||
|
|
||||||
|
run: $(BASE)
|
||||||
|
@echo "Type bistromathic expressions. Quit with ctrl-d."
|
||||||
|
./$<
|
||||||
|
|
||||||
|
html: $(BASE).html
|
||||||
|
%.html: %.xml
|
||||||
|
$(XSLTPROC) $(XSLTPROCFLAGS) -o $@ $$($(BISON) --print-datadir)/xslt/xml2xhtml.xsl $<
|
||||||
|
|
||||||
|
CLEANFILES = \
|
||||||
|
$(BASE) *.o \
|
||||||
|
parse.[ch] parse.output parse.xml parse.html parse.gv
|
||||||
|
|
||||||
|
clean:
|
||||||
|
rm -f $(CLEANFILES)
|
||||||
@@ -0,0 +1,49 @@
|
|||||||
|
# bistromathic - all the bells and whistles
|
||||||
|
This example demonstrates best practices when using Bison.
|
||||||
|
- Its hand-written scanner tracks locations.
|
||||||
|
- Its interface is pure.
|
||||||
|
- 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
|
||||||
|
push-parser API to feed the parser with the incoming tokens.
|
||||||
|
- It features an interactive command line with completion based on the
|
||||||
|
parser state, based on `yyexpected_tokens`.
|
||||||
|
- It uses Bison's standard catalogue for internationalization of generated
|
||||||
|
messages.
|
||||||
|
- It uses a custom syntax error with location, lookahead correction and
|
||||||
|
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 uses named references instead of the traditional $1, $2, etc.
|
||||||
|
|
||||||
|
To customize the interaction with bistromathic, see the GNU Readline user
|
||||||
|
manual (see `info rluserman`).
|
||||||
|
|
||||||
|
<!---
|
||||||
|
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.
|
||||||
|
|
||||||
|
LocalWords: bistromathic yyexpected lookahead ispell american
|
||||||
|
LocalWords: MERCHANTABILITY
|
||||||
|
|
||||||
|
--->
|
||||||
Executable
+361
@@ -0,0 +1,361 @@
|
|||||||
|
#! /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/>.
|
||||||
|
|
||||||
|
# Users may customize the behavior of readline, which might break our
|
||||||
|
# expected results.
|
||||||
|
INPUTRC=/dev/null
|
||||||
|
export INPUTRC
|
||||||
|
|
||||||
|
# Beware of portability issues of readline when not feeding it from a
|
||||||
|
# terminal.
|
||||||
|
#
|
||||||
|
# With recent versions of GNU Readline, input "1+2*3\n" gives
|
||||||
|
# "> 1+2*3\n7\n> \n"
|
||||||
|
#
|
||||||
|
# macOS' version does not display the prompt and does not repeat stdin
|
||||||
|
# on stdout, so input "1+2*3\n" gives "7\n" as output. Let's try to
|
||||||
|
# cope with this.
|
||||||
|
#
|
||||||
|
# On OpenBSD 6.5 the prompt is displayed, but the input is not
|
||||||
|
# repeated (!). So input "1+2*3\n" gives "> 7\n> \n" as output.
|
||||||
|
#
|
||||||
|
# On AIX, you get some escaping sequence before the prompt:
|
||||||
|
# "<ESC>[?1034h> 1+2*3". It appears to pass the terminfo capability
|
||||||
|
# "smm", to put the terminal in "meta mode": as if the user had hit
|
||||||
|
# META.
|
||||||
|
|
||||||
|
echo >perfect '> 0
|
||||||
|
0
|
||||||
|
> '
|
||||||
|
|
||||||
|
echo >ok '0'
|
||||||
|
echo '0' | prog >effective
|
||||||
|
|
||||||
|
echo "checking for readline output..."
|
||||||
|
if diff perfect effective; then
|
||||||
|
# Alles ist gut.
|
||||||
|
strip_prompt=false
|
||||||
|
elif diff ok effective; then
|
||||||
|
strip_prompt=true
|
||||||
|
else
|
||||||
|
skip "this is not the GNU Readline we expect"
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
cat >input <<EOF
|
||||||
|
1+2*3
|
||||||
|
EOF
|
||||||
|
run 0 '> 1+2*3
|
||||||
|
7
|
||||||
|
> '
|
||||||
|
|
||||||
|
cat >input <<EOF
|
||||||
|
(1+2) * 3
|
||||||
|
EOF
|
||||||
|
run 0 '> (1+2) * 3
|
||||||
|
9
|
||||||
|
> '
|
||||||
|
run -noerr 0 '> (1+2) * 3
|
||||||
|
9
|
||||||
|
> ' -p
|
||||||
|
|
||||||
|
cat >input <<EOF
|
||||||
|
a = 256
|
||||||
|
sqrt (a)
|
||||||
|
EOF
|
||||||
|
run 0 '> a = 256
|
||||||
|
256
|
||||||
|
> sqrt (a)
|
||||||
|
16
|
||||||
|
> '
|
||||||
|
|
||||||
|
cat >input <<EOF
|
||||||
|
a = .16
|
||||||
|
b = 10 ^ 2
|
||||||
|
sqrt (a * b)
|
||||||
|
EOF
|
||||||
|
run 0 '> a = .16
|
||||||
|
0.16
|
||||||
|
> b = 10 ^ 2
|
||||||
|
100
|
||||||
|
> sqrt (a * b)
|
||||||
|
4
|
||||||
|
> '
|
||||||
|
|
||||||
|
cat >input <<EOF
|
||||||
|
*
|
||||||
|
EOF
|
||||||
|
run 0 '> *
|
||||||
|
> ''
|
||||||
|
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
|
||||||
|
1 + 2 * * 3
|
||||||
|
EOF
|
||||||
|
run 0 '> 1 + 2 * * 3
|
||||||
|
> ''
|
||||||
|
err: 1.9: syntax error: expected - or ( or number or function or variable before *
|
||||||
|
err: 1 | 1 + 2 * * 3
|
||||||
|
err: | ^'
|
||||||
|
|
||||||
|
cat >input <<EOF
|
||||||
|
1 / 0
|
||||||
|
EOF
|
||||||
|
run 0 '> 1 / 0
|
||||||
|
> ''
|
||||||
|
err: 1.1-5: error: division by zero'
|
||||||
|
|
||||||
|
|
||||||
|
## ---------------- ##
|
||||||
|
## Error recovery. ##
|
||||||
|
## ---------------- ##
|
||||||
|
|
||||||
|
cat >input <<EOF
|
||||||
|
((1 ++ 2) ** 3)
|
||||||
|
(1 ++ 2) + (3 ** 4)
|
||||||
|
EOF
|
||||||
|
run 0 '> ((1 ++ 2) ** 3)
|
||||||
|
666
|
||||||
|
> (1 ++ 2) + (3 ** 4)
|
||||||
|
1332
|
||||||
|
> ''
|
||||||
|
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 | (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 ")".
|
||||||
|
cat >input <<EOF
|
||||||
|
()
|
||||||
|
EOF
|
||||||
|
run 0 '> ()
|
||||||
|
666
|
||||||
|
> ''
|
||||||
|
err: 1.2: syntax error: expected - or ( or number or function or variable before )
|
||||||
|
err: 1 | ()
|
||||||
|
err: | ^'
|
||||||
|
|
||||||
|
|
||||||
|
cat >input <<EOF
|
||||||
|
100% + 10
|
||||||
|
EOF
|
||||||
|
run 0 '> 100% + 10
|
||||||
|
> ''
|
||||||
|
err: 1.4: syntax error: invalid character: %'
|
||||||
|
|
||||||
|
# Traces. This allows to check the location of the error. If we
|
||||||
|
# forget to map YYerror to YYUNDEF, error recovery enters an endless
|
||||||
|
# loop with this input.
|
||||||
|
cat >input <<EOF
|
||||||
|
(+_)
|
||||||
|
EOF
|
||||||
|
run 0 '> (+_)
|
||||||
|
666
|
||||||
|
> ''
|
||||||
|
err: Starting parse
|
||||||
|
err: Entering state 0
|
||||||
|
err: Stack now 0
|
||||||
|
err: Reading a token
|
||||||
|
err: Next token is token ( (1.1: )
|
||||||
|
err: Shifting token ( (1.1: )
|
||||||
|
err: Entering state 2
|
||||||
|
err: Stack now 0 2
|
||||||
|
err: Return for a new token:
|
||||||
|
err: Reading a token
|
||||||
|
err: Next token is token + (1.2: )
|
||||||
|
err: LAC: initial context established for +
|
||||||
|
err: LAC: checking lookahead +: Err
|
||||||
|
err: LAC: checking lookahead end of file: Err
|
||||||
|
err: LAC: checking lookahead +: Err
|
||||||
|
err: LAC: checking lookahead -: S1
|
||||||
|
err: LAC: checking lookahead *: Err
|
||||||
|
err: LAC: checking lookahead /: Err
|
||||||
|
err: LAC: checking lookahead ^: Err
|
||||||
|
err: LAC: checking lookahead (: S2
|
||||||
|
err: LAC: checking lookahead ): Err
|
||||||
|
err: LAC: checking lookahead =: Err
|
||||||
|
err: LAC: checking lookahead exit: Err
|
||||||
|
err: LAC: checking lookahead number: S4
|
||||||
|
err: LAC: checking lookahead function: S5
|
||||||
|
err: LAC: checking lookahead variable: S6
|
||||||
|
err: LAC: checking lookahead NEG: Err
|
||||||
|
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: Shifting token error (1.2: )
|
||||||
|
err: Entering state 10
|
||||||
|
err: Stack now 0 2 10
|
||||||
|
err: Next token is token + (1.2: )
|
||||||
|
err: LAC: initial context established for +
|
||||||
|
err: LAC: checking lookahead +: Err
|
||||||
|
err: Error: discarding token + (1.2: )
|
||||||
|
err: Error: popping token error (1.2: )
|
||||||
|
err: Stack now 0 2
|
||||||
|
err: LAC: initial context discarded due to error recovery
|
||||||
|
err: Shifting token error (1.2: )
|
||||||
|
err: Entering state 10
|
||||||
|
err: Stack now 0 2 10
|
||||||
|
err: Return for a new token:
|
||||||
|
err: 1.3: syntax error: invalid character: _
|
||||||
|
err: Reading a token
|
||||||
|
err: Error: popping token error (1.2: )
|
||||||
|
err: Stack now 0 2
|
||||||
|
err: Shifting token error (1.2-3: )
|
||||||
|
err: Entering state 10
|
||||||
|
err: Stack now 0 2 10
|
||||||
|
err: Next token is token invalid token (1.3: )
|
||||||
|
err: LAC: initial context established for invalid token
|
||||||
|
err: LAC: checking lookahead invalid token: Always Err
|
||||||
|
err: Error: discarding token invalid token (1.3: )
|
||||||
|
err: Error: popping token error (1.2-3: )
|
||||||
|
err: Stack now 0 2
|
||||||
|
err: LAC: initial context discarded due to error recovery
|
||||||
|
err: Shifting token error (1.2-3: )
|
||||||
|
err: Entering state 10
|
||||||
|
err: Stack now 0 2 10
|
||||||
|
err: Return for a new token:
|
||||||
|
err: Reading a token
|
||||||
|
err: Next token is token ) (1.4: )
|
||||||
|
err: Shifting token ) (1.4: )
|
||||||
|
err: Entering state 20
|
||||||
|
err: Stack now 0 2 10 20
|
||||||
|
err: Reducing stack by rule XX (line XXX):
|
||||||
|
err: $1 = token ( (1.1: )
|
||||||
|
err: $2 = token error (1.2-3: )
|
||||||
|
err: $3 = token ) (1.4: )
|
||||||
|
err: -> $$ = nterm exp (1.1-4: 666)
|
||||||
|
err: Entering state 8
|
||||||
|
err: Stack now 0 8
|
||||||
|
err: Return for a new token:
|
||||||
|
err: Reading a token
|
||||||
|
err: Now at end of input.
|
||||||
|
err: LAC: initial context established for end of file
|
||||||
|
err: LAC: checking lookahead end of file: R2 G7 S14
|
||||||
|
err: Reducing stack by rule XX (line XXX):
|
||||||
|
err: $1 = nterm exp (1.1-4: 666)
|
||||||
|
err: -> $$ = nterm input (1.1-4: )
|
||||||
|
err: Entering state 7
|
||||||
|
err: Stack now 0 7
|
||||||
|
err: Now at end of input.
|
||||||
|
err: Shifting token end of file (1.5: )
|
||||||
|
err: LAC: initial context discarded due to shift
|
||||||
|
err: Entering state 14
|
||||||
|
err: Stack now 0 7 14
|
||||||
|
err: Stack now 0 7 14
|
||||||
|
err: Cleanup: popping token end of file (1.5: )
|
||||||
|
err: Cleanup: popping nterm input (1.1-4: )' -p
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## ------------ ##
|
||||||
|
## Completion. ##
|
||||||
|
## ------------ ##
|
||||||
|
|
||||||
|
# From now on, the differences between versions of GNU Readline are
|
||||||
|
# too painful to try to cope with.
|
||||||
|
if $strip_prompt; then
|
||||||
|
echo "SKIP: this is not the GNU Readline we expect"
|
||||||
|
exit $status
|
||||||
|
fi
|
||||||
|
|
||||||
|
# On Windows10/MSYS2 the ^G coming from <tab> completion is not
|
||||||
|
# emitted the same way
|
||||||
|
# (https://lists.gnu.org/r/bug-bison/2020-05/msg00076.html).
|
||||||
|
echo "checking for kernel name... $(uname -s)"
|
||||||
|
case $(uname -s) in
|
||||||
|
(MSYS*)
|
||||||
|
echo "SKIP: this is Windows/MSYS"
|
||||||
|
exit $status
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
|
||||||
|
# Check completion after an operator.
|
||||||
|
sed -e 's/\\t/ /g' >input <<EOF
|
||||||
|
(1+\t\t
|
||||||
|
EOF
|
||||||
|
run 0 '> (1+
|
||||||
|
( - atan cos exp ln number sin sqrt
|
||||||
|
> (1+
|
||||||
|
> ''
|
||||||
|
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.
|
||||||
|
sed -e 's/\\t/ /g' >input <<EOF
|
||||||
|
(at\t\t
|
||||||
|
EOF
|
||||||
|
run 0 '> (atan ( ''
|
||||||
|
> ''
|
||||||
|
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.
|
||||||
|
sed -e 's/\\t/ /g' >input <<EOF
|
||||||
|
e\t\t
|
||||||
|
EOF
|
||||||
|
run -n 0 '> e
|
||||||
|
end of file exit exp ''
|
||||||
|
> e
|
||||||
|
0
|
||||||
|
> ''
|
||||||
|
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: | ^
|
||||||
|
'
|
||||||
@@ -0,0 +1,41 @@
|
|||||||
|
## 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/>.
|
||||||
|
|
||||||
|
bistromathicdir = $(docdir)/%D%
|
||||||
|
|
||||||
|
## --------------- ##
|
||||||
|
## Bistromathics. ##
|
||||||
|
## --------------- ##
|
||||||
|
|
||||||
|
%D%/parse.c: $(dependencies)
|
||||||
|
|
||||||
|
if ENABLE_BISTROMATHIC
|
||||||
|
check_PROGRAMS += %D%/bistromathic
|
||||||
|
TESTS += %D%/bistromathic.test
|
||||||
|
nodist_%C%_bistromathic_SOURCES = %D%/parse.y
|
||||||
|
|
||||||
|
# Don't use gnulib's system headers.
|
||||||
|
%C%_bistromathic_CPPFLAGS = \
|
||||||
|
-DBISON_LOCALEDIR='"$(localdir)"' \
|
||||||
|
-DLOCALEDIR='"$(localdir)"' \
|
||||||
|
-I$(top_srcdir)/%D% -I$(top_builddir)/%D%
|
||||||
|
%C%_bistromathic_CFLAGS = $(TEST_CFLAGS)
|
||||||
|
%C%_bistromathic_LDADD = -lm $(LIBREADLINE) $(LIBINTL)
|
||||||
|
endif
|
||||||
|
|
||||||
|
EXTRA_DIST += %D%/bistromathic.test
|
||||||
|
dist_bistromathic_DATA = %D%/parse.y %D%/Makefile %D%/README.md
|
||||||
|
CLEANFILES += %D%/parse.[ch] %D%/parse.output
|
||||||
|
CLEANDIRS += %D%/*.dSYM
|
||||||
@@ -0,0 +1,670 @@
|
|||||||
|
/* 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 {
|
||||||
|
#include <ctype.h> // isdigit
|
||||||
|
#include <locale.h> // LC_ALL
|
||||||
|
#include <math.h> // cos, sin, etc.
|
||||||
|
#include <stdarg.h> // va_start
|
||||||
|
#include <stdio.h> // printf
|
||||||
|
#include <stdlib.h> // calloc
|
||||||
|
#include <string.h> // strcmp
|
||||||
|
|
||||||
|
#include <readline/readline.h>
|
||||||
|
#include <readline/history.h>
|
||||||
|
|
||||||
|
#if defined ENABLE_NLS && ENABLE_NLS
|
||||||
|
// Unable the translation of Bison's generated messages.
|
||||||
|
# define YYENABLE_NLS 1
|
||||||
|
# include <libintl.h>
|
||||||
|
// Unless specified otherwise, we expect bistromathic's own
|
||||||
|
// catalogue to be installed in the same tree as Bison's catalogue.
|
||||||
|
# ifndef LOCALEDIR
|
||||||
|
# define LOCALEDIR BISON_LOCALEDIR
|
||||||
|
# endif
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
// Emitted in the header file, before the definition of YYSTYPE.
|
||||||
|
%code requires {
|
||||||
|
// Function type.
|
||||||
|
typedef double (func_t) (double);
|
||||||
|
|
||||||
|
// Data type for links in the chain of symbols.
|
||||||
|
typedef struct symrec symrec;
|
||||||
|
struct symrec
|
||||||
|
{
|
||||||
|
char *name; // name of symbol
|
||||||
|
int type; // type of symbol: either VAR or FUN
|
||||||
|
union
|
||||||
|
{
|
||||||
|
double var; // value of a VAR
|
||||||
|
func_t *fun; // value of a FUN
|
||||||
|
} value;
|
||||||
|
symrec *next; // link field
|
||||||
|
};
|
||||||
|
|
||||||
|
symrec *putsym (char const *name, int sym_type);
|
||||||
|
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 {
|
||||||
|
# ifndef __attribute__
|
||||||
|
# ifndef __GNUC__
|
||||||
|
# define __attribute__(Spec) /* empty */
|
||||||
|
# endif
|
||||||
|
# endif
|
||||||
|
|
||||||
|
yytoken_kind_t
|
||||||
|
yylex (const char **line, YYSTYPE *yylval, YYLTYPE *yylloc,
|
||||||
|
const user_context *uctx);
|
||||||
|
void yyerror (YYLTYPE *loc, const user_context *uctx,
|
||||||
|
char const *format, ...)
|
||||||
|
__attribute__ ((__format__ (__printf__, 3, 4)));
|
||||||
|
}
|
||||||
|
|
||||||
|
// Emitted in the implementation file.
|
||||||
|
%code {
|
||||||
|
#if defined ENABLE_NLS && ENABLE_NLS
|
||||||
|
# define _(Msgid) gettext (Msgid)
|
||||||
|
#else
|
||||||
|
# define _(Msgid) (Msgid)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// Whether to quit.
|
||||||
|
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.
|
||||||
|
%define api.pure full
|
||||||
|
|
||||||
|
// Generate a push parser.
|
||||||
|
%define api.push-pull push
|
||||||
|
|
||||||
|
// To avoid name clashes (e.g., with C's EOF) prefix token definitions
|
||||||
|
// with TOK_ (e.g., TOK_EOF).
|
||||||
|
%define api.token.prefix {TOK_}
|
||||||
|
|
||||||
|
// Customized syntax error messages (see yyreport_syntax_error).
|
||||||
|
%define parse.error custom
|
||||||
|
|
||||||
|
// with locations.
|
||||||
|
%locations
|
||||||
|
|
||||||
|
// and accurate list of expected tokens.
|
||||||
|
%define parse.lac full
|
||||||
|
|
||||||
|
// Generate the parser description file (calc.output).
|
||||||
|
%verbose
|
||||||
|
|
||||||
|
// User information exchanged with the parser and scanner.
|
||||||
|
%param {const user_context *uctx}
|
||||||
|
|
||||||
|
// Generate YYSTYPE from the types assigned to symbols.
|
||||||
|
%define api.value.type union
|
||||||
|
%token
|
||||||
|
PLUS "+"
|
||||||
|
MINUS "-"
|
||||||
|
STAR "*"
|
||||||
|
SLASH "/"
|
||||||
|
CARET "^"
|
||||||
|
LPAREN "("
|
||||||
|
RPAREN ")"
|
||||||
|
EQUAL "="
|
||||||
|
EXIT "exit"
|
||||||
|
<double>
|
||||||
|
NUM _("number")
|
||||||
|
<symrec*>
|
||||||
|
FUN _("function")
|
||||||
|
VAR _("variable")
|
||||||
|
|
||||||
|
%nterm <double> exp
|
||||||
|
|
||||||
|
// Enable run-time traces (yydebug).
|
||||||
|
%define parse.trace
|
||||||
|
|
||||||
|
// Formatting semantic values in debug traces.
|
||||||
|
%printer { fprintf (yyo, "%s", $$->name); } VAR;
|
||||||
|
%printer { fprintf (yyo, "%s()", $$->name); } FUN;
|
||||||
|
%printer { fprintf (yyo, "%g", $$); } <double>;
|
||||||
|
|
||||||
|
|
||||||
|
// Precedence (from lowest to highest) and associativity.
|
||||||
|
%precedence "="
|
||||||
|
%left "+" "-"
|
||||||
|
%left "*" "/"
|
||||||
|
%precedence NEG // negation--unary minus
|
||||||
|
%right "^" // exponentiation
|
||||||
|
|
||||||
|
%% // The grammar follows.
|
||||||
|
input:
|
||||||
|
%empty
|
||||||
|
| exp { printf ("%.10g\n", $exp); }
|
||||||
|
| "exit" { done = 1; }
|
||||||
|
;
|
||||||
|
|
||||||
|
exp:
|
||||||
|
NUM
|
||||||
|
| VAR { $$ = $VAR->value.var; }
|
||||||
|
| VAR "=" exp { $$ = $3; $VAR->value.var = $3; }
|
||||||
|
| FUN "(" exp ")" { $$ = $FUN->value.fun ($3); }
|
||||||
|
| exp[l] "+" exp[r] { $$ = $l + $r; }
|
||||||
|
| exp[l] "-" exp[r] { $$ = $l - $r; }
|
||||||
|
| exp[l] "*" exp[r] { $$ = $l * $r; }
|
||||||
|
| exp[l] "/" exp[r]
|
||||||
|
{
|
||||||
|
if ($r == 0)
|
||||||
|
{
|
||||||
|
yyerror (&@$, uctx, "error: division by zero");
|
||||||
|
YYERROR;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
$$ = $l / $r;
|
||||||
|
}
|
||||||
|
| "-" exp %prec NEG { $$ = -$2; }
|
||||||
|
| exp[l] "^" exp[r] { $$ = pow ($l, $r); }
|
||||||
|
| "(" exp ")" { $$ = $2; }
|
||||||
|
| "(" error ")" { $$ = 666; }
|
||||||
|
;
|
||||||
|
|
||||||
|
// End of grammar.
|
||||||
|
%%
|
||||||
|
|
||||||
|
/*------------.
|
||||||
|
| Functions. |
|
||||||
|
`------------*/
|
||||||
|
|
||||||
|
struct init
|
||||||
|
{
|
||||||
|
char const *name;
|
||||||
|
func_t *fun;
|
||||||
|
};
|
||||||
|
|
||||||
|
static struct init const funs[] =
|
||||||
|
{
|
||||||
|
{ "atan", atan },
|
||||||
|
{ "cos", cos },
|
||||||
|
{ "exp", exp },
|
||||||
|
{ "ln", log },
|
||||||
|
{ "sin", sin },
|
||||||
|
{ "sqrt", sqrt },
|
||||||
|
{ 0, 0 },
|
||||||
|
};
|
||||||
|
|
||||||
|
// The symbol table: a chain of 'struct symrec'.
|
||||||
|
static symrec *sym_table;
|
||||||
|
|
||||||
|
// Put functions in table.
|
||||||
|
static void
|
||||||
|
init_table (void)
|
||||||
|
{
|
||||||
|
for (int i = 0; funs[i].name; i++)
|
||||||
|
{
|
||||||
|
symrec *ptr = putsym (funs[i].name, TOK_FUN);
|
||||||
|
ptr->value.fun = funs[i].fun;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
symrec *
|
||||||
|
putsym (char const *name, int sym_type)
|
||||||
|
{
|
||||||
|
symrec *res = (symrec *) malloc (sizeof (symrec));
|
||||||
|
res->name = strdup (name);
|
||||||
|
res->type = sym_type;
|
||||||
|
res->value.var = 0; // Set value to 0 even if fun.
|
||||||
|
res->next = sym_table;
|
||||||
|
sym_table = res;
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
|
symrec *
|
||||||
|
getsym (char const *name)
|
||||||
|
{
|
||||||
|
for (symrec *p = sym_table; p; p = p->next)
|
||||||
|
if (strcmp (p->name, name) == 0)
|
||||||
|
return p;
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
// How many symbols are registered.
|
||||||
|
static int
|
||||||
|
symbol_count (void)
|
||||||
|
{
|
||||||
|
int res = 0;
|
||||||
|
for (symrec *p = sym_table; p; p = p->next)
|
||||||
|
++res;
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*----------.
|
||||||
|
| Scanner. |
|
||||||
|
`----------*/
|
||||||
|
|
||||||
|
yytoken_kind_t
|
||||||
|
yylex (const char **line, YYSTYPE *yylval, YYLTYPE *yylloc,
|
||||||
|
const user_context *uctx)
|
||||||
|
{
|
||||||
|
int c;
|
||||||
|
|
||||||
|
// Ignore white space, get first nonwhite character.
|
||||||
|
do {
|
||||||
|
// Move the first position onto the last.
|
||||||
|
yylloc->first_line = yylloc->last_line;
|
||||||
|
yylloc->first_column = yylloc->last_column;
|
||||||
|
|
||||||
|
yylloc->last_column += 1;
|
||||||
|
c = *((*line)++);
|
||||||
|
} while (c == ' ' || c == '\t');
|
||||||
|
|
||||||
|
switch (c)
|
||||||
|
{
|
||||||
|
case '+': return TOK_PLUS;
|
||||||
|
case '-': return TOK_MINUS;
|
||||||
|
case '*': return TOK_STAR;
|
||||||
|
case '/': return TOK_SLASH;
|
||||||
|
case '^': return TOK_CARET;
|
||||||
|
case '=': return TOK_EQUAL;
|
||||||
|
case '(': return TOK_LPAREN;
|
||||||
|
case ')': return TOK_RPAREN;
|
||||||
|
|
||||||
|
case '!': return TOK_YYUNDEF;
|
||||||
|
|
||||||
|
case '\0': return TOK_YYEOF;
|
||||||
|
|
||||||
|
// Numbers.
|
||||||
|
case '.':
|
||||||
|
case '0': case '1': case '2': case '3': case '4':
|
||||||
|
case '5': case '6': case '7': case '8': case '9':
|
||||||
|
{
|
||||||
|
int nchars = 0;
|
||||||
|
if (sscanf (*line - 1, "%lf%n", &yylval->TOK_NUM, &nchars) != 1)
|
||||||
|
abort ();
|
||||||
|
*line += nchars - 1;
|
||||||
|
yylloc->last_column += nchars - 1;
|
||||||
|
return TOK_NUM;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Identifiers.
|
||||||
|
case 'a': case 'b': case 'c': case 'd': case 'e':
|
||||||
|
case 'f': case 'g': case 'h': case 'i': case 'j':
|
||||||
|
case 'k': case 'l': case 'm': case 'n': case 'o':
|
||||||
|
case 'p': case 'q': case 'r': case 's': case 't':
|
||||||
|
case 'u': case 'v': case 'w': case 'x': case 'y':
|
||||||
|
case 'z':
|
||||||
|
{
|
||||||
|
int nchars = 0;
|
||||||
|
char buf[100];
|
||||||
|
if (sscanf (*line - 1, "%99[a-z]%n", buf, &nchars) != 1)
|
||||||
|
abort ();
|
||||||
|
*line += nchars - 1;
|
||||||
|
yylloc->last_column += nchars - 1;
|
||||||
|
if (strcmp (buf, "exit") == 0)
|
||||||
|
return TOK_EXIT;
|
||||||
|
else
|
||||||
|
{
|
||||||
|
symrec *s = getsym (buf);
|
||||||
|
if (!s)
|
||||||
|
s = putsym (buf, TOK_VAR);
|
||||||
|
yylval->TOK_VAR = s;
|
||||||
|
return s->type;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Stray characters.
|
||||||
|
default:
|
||||||
|
yyerror (yylloc, uctx, "syntax error: invalid character: %c", c);
|
||||||
|
return TOK_YYerror;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*---------.
|
||||||
|
| Parser. |
|
||||||
|
`---------*/
|
||||||
|
|
||||||
|
|
||||||
|
static const char *
|
||||||
|
error_format_string (int argc)
|
||||||
|
{
|
||||||
|
switch (argc)
|
||||||
|
{
|
||||||
|
default: // Avoid compiler warnings.
|
||||||
|
case 0: return _("%@: syntax error");
|
||||||
|
case 1: return _("%@: syntax error: unexpected %u");
|
||||||
|
// TRANSLATORS: '%@' is a location in a file, '%u' is an
|
||||||
|
// "unexpected token", and '%0e', '%1e'... are expected tokens
|
||||||
|
// at this point.
|
||||||
|
//
|
||||||
|
// For instance on the expression "1 + * 2", you'd get
|
||||||
|
//
|
||||||
|
// 1.5: syntax error: expected - or ( or number or function or variable before *
|
||||||
|
case 2: return _("%@: syntax error: expected %0e before %u");
|
||||||
|
case 3: return _("%@: syntax error: expected %0e or %1e before %u");
|
||||||
|
case 4: return _("%@: syntax error: expected %0e or %1e or %2e before %u");
|
||||||
|
case 5: return _("%@: syntax error: expected %0e or %1e or %2e or %3e before %u");
|
||||||
|
case 6: return _("%@: syntax error: expected %0e or %1e or %2e or %3e or %4e before %u");
|
||||||
|
case 7: return _("%@: syntax error: expected %0e or %1e or %2e or %3e or %4e or %5e before %u");
|
||||||
|
case 8: return _("%@: syntax error: expected %0e or %1e or %2e or %3e or %4e or %5e etc., before %u");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int
|
||||||
|
yyreport_syntax_error (const yypcontext_t *ctx, const user_context *uctx)
|
||||||
|
{
|
||||||
|
if (uctx->silent)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
enum { ARGS_MAX = 6 };
|
||||||
|
yysymbol_kind_t arg[ARGS_MAX];
|
||||||
|
int argsize = yypcontext_expected_tokens (ctx, arg, ARGS_MAX);
|
||||||
|
if (argsize < 0)
|
||||||
|
return argsize;
|
||||||
|
const int too_many_expected_tokens = argsize == 0 && arg[0] != YYSYMBOL_YYEMPTY;
|
||||||
|
if (too_many_expected_tokens)
|
||||||
|
argsize = ARGS_MAX;
|
||||||
|
const char *format = error_format_string (1 + argsize + too_many_expected_tokens);
|
||||||
|
|
||||||
|
const YYLTYPE *loc = yypcontext_location (ctx);
|
||||||
|
while (*format)
|
||||||
|
// %@: location.
|
||||||
|
if (format[0] == '%' && format[1] == '@')
|
||||||
|
{
|
||||||
|
YY_LOCATION_PRINT (stderr, *loc);
|
||||||
|
format += 2;
|
||||||
|
}
|
||||||
|
// %u: unexpected token.
|
||||||
|
else if (format[0] == '%' && format[1] == 'u')
|
||||||
|
{
|
||||||
|
fputs (yysymbol_name (yypcontext_token (ctx)), stderr);
|
||||||
|
format += 2;
|
||||||
|
}
|
||||||
|
// %0e, %1e...: expected token.
|
||||||
|
else if (format[0] == '%'
|
||||||
|
&& isdigit ((unsigned char) format[1])
|
||||||
|
&& format[2] == 'e'
|
||||||
|
&& (format[1] - '0') < argsize)
|
||||||
|
{
|
||||||
|
int i = format[1] - '0';
|
||||||
|
fputs (yysymbol_name (arg[i]), stderr);
|
||||||
|
format += 3;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
fputc (*format, stderr);
|
||||||
|
++format;
|
||||||
|
}
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Called by yyparse on error.
|
||||||
|
void yyerror (YYLTYPE *loc, const user_context *uctx, char const *format, ...)
|
||||||
|
{
|
||||||
|
if (uctx->silent)
|
||||||
|
return;
|
||||||
|
|
||||||
|
YY_LOCATION_PRINT (stderr, *loc);
|
||||||
|
fputs (": ", stderr);
|
||||||
|
va_list args;
|
||||||
|
va_start (args, format);
|
||||||
|
vfprintf (stderr, format, args);
|
||||||
|
va_end (args);
|
||||||
|
putc ('\n', stderr);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Return a newly allocated copy of at most N bytes of STRING. In
|
||||||
|
// other words, return a copy of the initial segment of length N of
|
||||||
|
// STRING.
|
||||||
|
static char *
|
||||||
|
xstrndup (const char *string, size_t n)
|
||||||
|
{
|
||||||
|
// len = strnlen (string, n), portably.
|
||||||
|
const char *end = memchr (string, '\0', n);
|
||||||
|
size_t len = end ? (size_t) (end - string) : n;
|
||||||
|
char *new = malloc (len + 1);
|
||||||
|
if (!new)
|
||||||
|
abort ();
|
||||||
|
new[len] = '\0';
|
||||||
|
return memcpy (new, string, len);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*-----------.
|
||||||
|
| Readline. |
|
||||||
|
`-----------*/
|
||||||
|
|
||||||
|
// Parse (and execute) this line.
|
||||||
|
static int
|
||||||
|
process_line (YYLTYPE *lloc, const char *line)
|
||||||
|
{
|
||||||
|
user_context uctx = {0, line};
|
||||||
|
yypstate *ps = yypstate_new ();
|
||||||
|
int status = 0;
|
||||||
|
do {
|
||||||
|
YYSTYPE lval;
|
||||||
|
yytoken_kind_t token = yylex (&line, &lval, lloc, &uctx);
|
||||||
|
status = yypush_parse (ps, token, &lval, lloc, &uctx);
|
||||||
|
} while (status == YYPUSH_MORE);
|
||||||
|
yypstate_delete (ps);
|
||||||
|
lloc->last_line++;
|
||||||
|
lloc->last_column = 1;
|
||||||
|
return status;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Get the list of possible tokens after INPUT was read.
|
||||||
|
// Returns a nonnegative.
|
||||||
|
static int
|
||||||
|
expected_tokens (const char *input,
|
||||||
|
int *tokens, int ntokens)
|
||||||
|
{
|
||||||
|
YYDPRINTF ((stderr, "expected_tokens (\"%s\")", input));
|
||||||
|
user_context uctx = {1, input};
|
||||||
|
|
||||||
|
// Parse the current state of the line.
|
||||||
|
yypstate *ps = yypstate_new ();
|
||||||
|
int status = 0;
|
||||||
|
YYLTYPE lloc = { 1, 1, 1, 1 };
|
||||||
|
do {
|
||||||
|
YYSTYPE lval;
|
||||||
|
yytoken_kind_t token = yylex (&input, &lval, &lloc, &uctx);
|
||||||
|
// Don't let the parse know when we reach the end of input.
|
||||||
|
if (token == TOK_YYEOF)
|
||||||
|
break;
|
||||||
|
status = yypush_parse (ps, token, &lval, &lloc, &uctx);
|
||||||
|
} while (status == YYPUSH_MORE);
|
||||||
|
|
||||||
|
int res = 0;
|
||||||
|
// If there were parse errors, don't propose completions.
|
||||||
|
if (!ps->yynerrs)
|
||||||
|
{
|
||||||
|
// Then query for the accepted tokens at this point.
|
||||||
|
res = yypstate_expected_tokens (ps, tokens, ntokens);
|
||||||
|
if (res < 0)
|
||||||
|
abort ();
|
||||||
|
}
|
||||||
|
yypstate_delete (ps);
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Attempt to complete on the contents of TEXT. START and END bound
|
||||||
|
// the region of rl_line_buffer that contains the word to complete.
|
||||||
|
// TEXT is the word to complete. We can use the entire contents of
|
||||||
|
// rl_line_buffer in case we want to do some simple parsing. Return
|
||||||
|
// the array of matches, or NULL if there aren't any.
|
||||||
|
static char **
|
||||||
|
completion (const char *text, int start, int end)
|
||||||
|
{
|
||||||
|
YYDPRINTF ((stderr, "completion (\"%.*s[%.*s]%s\")\n",
|
||||||
|
start, rl_line_buffer,
|
||||||
|
end - start, rl_line_buffer + start,
|
||||||
|
rl_line_buffer + end));
|
||||||
|
|
||||||
|
// Get list of token numbers.
|
||||||
|
int tokens[YYNTOKENS];
|
||||||
|
char *line = xstrndup (rl_line_buffer, (size_t) start);
|
||||||
|
int ntokens = expected_tokens (line, tokens, YYNTOKENS);
|
||||||
|
free (line);
|
||||||
|
|
||||||
|
// Build MATCHES, the list of possible completions.
|
||||||
|
const size_t len = strlen (text);
|
||||||
|
// Need initial prefix and final NULL.
|
||||||
|
char **matches
|
||||||
|
= calloc ((size_t) ntokens + (size_t) symbol_count () + 2, sizeof *matches);
|
||||||
|
if (!matches)
|
||||||
|
abort ();
|
||||||
|
int match = 1;
|
||||||
|
for (int i = 0; i < ntokens; ++i)
|
||||||
|
switch (tokens[i])
|
||||||
|
{
|
||||||
|
case YYSYMBOL_FUN:
|
||||||
|
for (symrec *s = sym_table; s; s = s->next)
|
||||||
|
if (s->type == TOK_FUN && strncmp (text, s->name, len) == 0)
|
||||||
|
matches[match++] = strdup (s->name);
|
||||||
|
break;
|
||||||
|
case YYSYMBOL_VAR:
|
||||||
|
for (symrec *s = sym_table; s; s = s->next)
|
||||||
|
if (s->type == TOK_VAR && strncmp (text, s->name, len) == 0)
|
||||||
|
matches[match++] = strdup (s->name);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
{
|
||||||
|
const char* token = yysymbol_name (tokens[i]);
|
||||||
|
if (strncmp (text, token, len) == 0)
|
||||||
|
matches[match++] = strdup (token);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Find the longest common prefix, and install it in matches[0], as
|
||||||
|
// required by readline.
|
||||||
|
if (match == 1)
|
||||||
|
matches[0] = strdup (text);
|
||||||
|
else
|
||||||
|
{
|
||||||
|
size_t lcplen = strlen (matches[1]);
|
||||||
|
for (int i = 2; i < match && lcplen; ++i)
|
||||||
|
for (size_t j = 0; j < lcplen; ++j)
|
||||||
|
if (matches[1][j] != matches[i][j])
|
||||||
|
lcplen = j;
|
||||||
|
matches[0] = xstrndup (matches[1], lcplen);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (yydebug)
|
||||||
|
{
|
||||||
|
fprintf (stderr, "completion (\"%.*s[%.*s]%s\") = ",
|
||||||
|
start, rl_line_buffer,
|
||||||
|
end - start, rl_line_buffer + start,
|
||||||
|
rl_line_buffer + end);
|
||||||
|
for (int i = 1; matches[i]; ++i)
|
||||||
|
fprintf (stderr, "%s%s",
|
||||||
|
i == 1 ? "{" : ", ",
|
||||||
|
matches[i]);
|
||||||
|
fprintf (stderr, "}\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
// Don't fall back to proposing file names.
|
||||||
|
rl_attempted_completion_over = 1;
|
||||||
|
return matches;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
init_readline (void)
|
||||||
|
{
|
||||||
|
// Allow conditional parsing of the ~/.inputrc file.
|
||||||
|
rl_readline_name = "bistromathic";
|
||||||
|
|
||||||
|
// Tell the completer that we want a crack first.
|
||||||
|
rl_attempted_completion_function = completion;
|
||||||
|
|
||||||
|
// The basic list of characters that signal a break between words
|
||||||
|
// for the completer routine.
|
||||||
|
rl_basic_word_break_characters = " \t\n\"\\'`@$><=;|&{(+-*/^)";
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*-------.
|
||||||
|
| Main. |
|
||||||
|
`-------*/
|
||||||
|
|
||||||
|
int
|
||||||
|
main (int argc, char const* argv[])
|
||||||
|
{
|
||||||
|
#if defined ENABLE_NLS && ENABLE_NLS
|
||||||
|
// Set up internationalization.
|
||||||
|
setlocale (LC_ALL, "");
|
||||||
|
// Use Bison's standard translation catalogue for error messages
|
||||||
|
// (the generated messages).
|
||||||
|
bindtextdomain ("bison-runtime", BISON_LOCALEDIR);
|
||||||
|
// The translation catalogue of bistromathic is actually included in
|
||||||
|
// Bison's. In your own project, use the name of your project.
|
||||||
|
bindtextdomain ("bison", LOCALEDIR);
|
||||||
|
textdomain ("bison");
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// Enable parse traces on option -p.
|
||||||
|
if (1 < argc && strcmp (argv[1], "-p") == 0)
|
||||||
|
yydebug = 1;
|
||||||
|
init_table ();
|
||||||
|
init_readline ();
|
||||||
|
YYLTYPE lloc = {1, 1, 1, 1};
|
||||||
|
while (!done)
|
||||||
|
{
|
||||||
|
char *line = readline ("> ");
|
||||||
|
if (!line)
|
||||||
|
{
|
||||||
|
// Finish the line started by the prompt.
|
||||||
|
putchar ('\n');
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if (*line)
|
||||||
|
add_history (line);
|
||||||
|
process_line (&lloc, line);
|
||||||
|
free (line);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -9,20 +9,15 @@ 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.
|
||||||
|
|
||||||
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
|
||||||
|
Documentation License" file as part of this distribution.
|
||||||
|
|
||||||
This program is distributed in the hope that it will be useful,
|
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
GNU General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
|
||||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
--->
|
--->
|
||||||
|
|||||||
@@ -1,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
|
||||||
@@ -34,4 +34,10 @@ cat >input <<EOF
|
|||||||
(1+2) * 3
|
(1+2) * 3
|
||||||
EOF
|
EOF
|
||||||
run 0 9
|
run 0 9
|
||||||
|
# Check the traces.
|
||||||
run -noerr 0 9 -p
|
run -noerr 0 9 -p
|
||||||
|
|
||||||
|
cat >input <<EOF
|
||||||
|
1++2
|
||||||
|
EOF
|
||||||
|
run 0 "err: syntax error, unexpected '+', expecting number or '('"
|
||||||
|
|||||||
+14
-5
@@ -1,6 +1,8 @@
|
|||||||
%code top {
|
%code top {
|
||||||
|
#include <assert.h>
|
||||||
#include <ctype.h> /* isdigit. */
|
#include <ctype.h> /* isdigit. */
|
||||||
#include <stdio.h> /* For printf, etc. */
|
#include <stdio.h> /* printf. */
|
||||||
|
#include <stdlib.h> /* abort. */
|
||||||
#include <string.h> /* strcmp. */
|
#include <string.h> /* strcmp. */
|
||||||
|
|
||||||
int yylex (void);
|
int yylex (void);
|
||||||
@@ -8,16 +10,22 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
%define api.header.include {"calc.h"}
|
%define api.header.include {"calc.h"}
|
||||||
%define api.value.type union /* Generate YYSTYPE from these types: */
|
|
||||||
|
/* Generate YYSTYPE from the types used in %token and %type. */
|
||||||
|
%define api.value.type union
|
||||||
%token <double> NUM "number"
|
%token <double> NUM "number"
|
||||||
%type <double> expr term fact
|
%type <double> expr term fact
|
||||||
|
|
||||||
/* Generate the parser description file. */
|
/* Generate the parser description file (calc.output). */
|
||||||
%verbose
|
%verbose
|
||||||
|
|
||||||
|
/* Nice error messages with details. */
|
||||||
|
%define parse.error detailed
|
||||||
|
|
||||||
/* Enable run-time traces (yydebug). */
|
/* Enable run-time traces (yydebug). */
|
||||||
%define parse.trace
|
%define parse.trace
|
||||||
|
|
||||||
/* Formatting semantic values. */
|
/* Formatting semantic values in debug traces. */
|
||||||
%printer { fprintf (yyo, "%g", $$); } <double>;
|
%printer { fprintf (yyo, "%g", $$); } <double>;
|
||||||
|
|
||||||
%% /* The grammar follows. */
|
%% /* The grammar follows. */
|
||||||
@@ -67,7 +75,8 @@ yylex (void)
|
|||||||
if (c == '.' || isdigit (c))
|
if (c == '.' || isdigit (c))
|
||||||
{
|
{
|
||||||
ungetc (c, stdin);
|
ungetc (c, stdin);
|
||||||
scanf ("%lf", &yylval.NUM);
|
if (scanf ("%lf", &yylval.NUM) != 1)
|
||||||
|
abort ();
|
||||||
return NUM;
|
return NUM;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
## 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
|
||||||
@@ -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/>.
|
||||||
|
|
||||||
calcdir = $(docdir)/%D%
|
calcdir = $(docdir)/%D%
|
||||||
|
|
||||||
@@ -27,6 +27,7 @@ nodist_%C%_calc_SOURCES = %D%/calc.y
|
|||||||
|
|
||||||
# Don't use gnulib's system headers.
|
# Don't use gnulib's system headers.
|
||||||
%C%_calc_CPPFLAGS = -I$(top_srcdir)/%D% -I$(top_builddir)/%D%
|
%C%_calc_CPPFLAGS = -I$(top_srcdir)/%D% -I$(top_builddir)/%D%
|
||||||
|
%C%_calc_CFLAGS = $(TEST_CFLAGS)
|
||||||
|
|
||||||
dist_calc_DATA = %D%/calc.y %D%/Makefile %D%/README.md
|
dist_calc_DATA = %D%/calc.y %D%/Makefile %D%/README.md
|
||||||
CLEANFILES += %D%/calc.[ch] %D%/calc.output %D%/scan.c
|
CLEANFILES += %D%/calc.[ch] %D%/calc.output %D%/scan.c
|
||||||
|
|||||||
@@ -3,26 +3,22 @@
|
|||||||
This directory contains lexcalc, the traditional example of using Flex and
|
This directory contains lexcalc, the traditional example of using Flex and
|
||||||
Bison to build a simple calculator.
|
Bison to build a simple calculator.
|
||||||
|
|
||||||
|
It features detailed syntax errors with locations.
|
||||||
|
|
||||||
<!---
|
<!---
|
||||||
Local Variables:
|
Local Variables:
|
||||||
fill-column: 76
|
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 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,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/>.
|
||||||
|
|
||||||
cat >input <<EOF
|
cat >input <<EOF
|
||||||
1+2*3
|
1+2*3
|
||||||
@@ -29,4 +29,9 @@ run -noerr 0 9 -p
|
|||||||
cat >input <<EOF
|
cat >input <<EOF
|
||||||
(1+2) *
|
(1+2) *
|
||||||
EOF
|
EOF
|
||||||
run 1 'err: syntax error, unexpected end-of-line, expecting ( or number'
|
run 1 'err: 1.8-2.0: syntax error, unexpected end of line, expecting ( or number'
|
||||||
|
|
||||||
|
cat >input <<EOF
|
||||||
|
1 / (2 - 2)
|
||||||
|
EOF
|
||||||
|
run 1 'err: 1.1-11: error: division by zero'
|
||||||
|
|||||||
@@ -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,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/>.
|
||||||
|
|
||||||
lexcalcdir = $(docdir)/%D%
|
lexcalcdir = $(docdir)/%D%
|
||||||
|
|
||||||
@@ -25,10 +25,19 @@ if FLEX_WORKS
|
|||||||
nodist_%C%_lexcalc_SOURCES = %D%/parse.y %D%/parse.h %D%/scan.l
|
nodist_%C%_lexcalc_SOURCES = %D%/parse.y %D%/parse.h %D%/scan.l
|
||||||
# Don't use gnulib's system headers.
|
# Don't use gnulib's system headers.
|
||||||
%C%_lexcalc_CPPFLAGS = -I$(top_srcdir)/%D% -I$(top_builddir)/%D%
|
%C%_lexcalc_CPPFLAGS = -I$(top_srcdir)/%D% -I$(top_builddir)/%D%
|
||||||
|
# Fighting warnings triggered by Flex is just too painful.
|
||||||
|
# %C%_lexcalc_CFLAGS = $(TEST_CFLAGS)
|
||||||
endif FLEX_WORKS
|
endif FLEX_WORKS
|
||||||
|
|
||||||
%D%/parse.c: $(dependencies)
|
%D%/parse.c: $(dependencies)
|
||||||
|
|
||||||
|
# Tell Make scan.o depends on parse.h, except that Make sees only
|
||||||
|
# parse.c, not parse.h. We can't use BUILT_SOURCES to this end, since
|
||||||
|
# we use the built bison.
|
||||||
|
%D%/lexcalc$(DASH)scan.o: %D%/parse.c
|
||||||
|
# Likewise, but for Automake before 1.16.
|
||||||
|
%D%/examples_c_lexcalc_lexcalc$(DASH)scan.o: %D%/parse.c
|
||||||
|
|
||||||
EXTRA_DIST += %D%/lexcalc.test
|
EXTRA_DIST += %D%/lexcalc.test
|
||||||
dist_lexcalc_DATA = %D%/parse.y %D%/scan.l %D%/Makefile %D%/README.md
|
dist_lexcalc_DATA = %D%/parse.y %D%/scan.l %D%/Makefile %D%/README.md
|
||||||
CLEANFILES += %D%/parse.[ch] %D%/scan.c %D%/parse.output
|
CLEANFILES += %D%/parse.[ch] %D%/scan.c %D%/parse.output
|
||||||
|
|||||||
@@ -1,3 +1,22 @@
|
|||||||
|
/* Parser for lexcalc. -*- C -*-
|
||||||
|
|
||||||
|
Copyright (C) 2018-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/>. */
|
||||||
|
|
||||||
// Prologue (directives).
|
// Prologue (directives).
|
||||||
%expect 0
|
%expect 0
|
||||||
|
|
||||||
@@ -6,10 +25,10 @@
|
|||||||
{
|
{
|
||||||
// Tell Flex the expected prototype of yylex.
|
// Tell Flex the expected prototype of yylex.
|
||||||
#define YY_DECL \
|
#define YY_DECL \
|
||||||
enum yytokentype yylex (YYSTYPE* yylval, int *nerrs)
|
yytoken_kind_t yylex (YYSTYPE* yylval, YYLTYPE *yylloc, int *nerrs)
|
||||||
YY_DECL;
|
YY_DECL;
|
||||||
|
|
||||||
void yyerror (int *nerrs, const char *msg);
|
void yyerror (YYLTYPE *loc, int *nerrs, const char *msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Emitted on top of the implementation file.
|
// Emitted on top of the implementation file.
|
||||||
@@ -19,12 +38,30 @@
|
|||||||
#include <stdlib.h> // getenv.
|
#include <stdlib.h> // getenv.
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 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.
|
||||||
%define api.pure full
|
%define api.pure full
|
||||||
|
|
||||||
|
// To avoid name clashes (e.g., with C's EOF) prefix token definitions
|
||||||
|
// with TOK_ (e.g., TOK_EOF).
|
||||||
%define api.token.prefix {TOK_}
|
%define api.token.prefix {TOK_}
|
||||||
|
|
||||||
|
// %token and %type use genuine types (e.g., "%token <int>"). Let
|
||||||
|
// %bison define YYSTYPE as a union of all these types.
|
||||||
%define api.value.type union
|
%define api.value.type union
|
||||||
%define parse.error verbose
|
|
||||||
|
// Generate detailed error messages.
|
||||||
|
%define parse.error detailed
|
||||||
|
|
||||||
|
// with locations.
|
||||||
|
%locations
|
||||||
|
|
||||||
|
// Enable debug traces (see yydebug in main).
|
||||||
%define parse.trace
|
%define parse.trace
|
||||||
// Error count, exchanged between main, yyparse and yylex.
|
|
||||||
|
// Error count, exchanged between main, yyparse and yylex.
|
||||||
%param {int *nerrs}
|
%param {int *nerrs}
|
||||||
|
|
||||||
%token
|
%token
|
||||||
@@ -34,8 +71,7 @@
|
|||||||
SLASH "/"
|
SLASH "/"
|
||||||
LPAREN "("
|
LPAREN "("
|
||||||
RPAREN ")"
|
RPAREN ")"
|
||||||
EOL "end-of-line"
|
EOL "end of line"
|
||||||
EOF 0 "end-of-file"
|
|
||||||
;
|
;
|
||||||
|
|
||||||
%token <int> NUM "number"
|
%token <int> NUM "number"
|
||||||
@@ -66,7 +102,7 @@ exp:
|
|||||||
{
|
{
|
||||||
if ($3 == 0)
|
if ($3 == 0)
|
||||||
{
|
{
|
||||||
yyerror (nerrs, "invalid division by zero");
|
yyerror (&@$, nerrs, "error: division by zero");
|
||||||
YYERROR;
|
YYERROR;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -77,9 +113,11 @@ exp:
|
|||||||
;
|
;
|
||||||
%%
|
%%
|
||||||
// Epilogue (C code).
|
// Epilogue (C code).
|
||||||
void yyerror (int *nerrs, const char *msg)
|
|
||||||
|
void yyerror (YYLTYPE *loc, int *nerrs, const char *msg)
|
||||||
{
|
{
|
||||||
fprintf (stderr, "%s\n", msg);
|
YY_LOCATION_PRINT (stderr, *loc);
|
||||||
|
fprintf (stderr, ": %s\n", msg);
|
||||||
++*nerrs;
|
++*nerrs;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,17 +1,51 @@
|
|||||||
/* Prologue (directives). -*- C++ -*- */
|
/* Scanner for lexcalc. -*- C -*-
|
||||||
|
|
||||||
|
Copyright (C) 2018-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/>. */
|
||||||
|
|
||||||
|
/* Prologue (directives). */
|
||||||
|
|
||||||
/* Disable Flex features we don't need, to avoid warnings. */
|
/* Disable Flex features we don't need, to avoid warnings. */
|
||||||
%option nodefault noinput nounput noyywrap
|
%option nodefault noinput nounput noyywrap
|
||||||
|
|
||||||
%{
|
%{
|
||||||
#include <errno.h> /* errno, ERANGE */
|
#include <errno.h> /* errno, ERANGE */
|
||||||
#include <limits.h> /* INT_MIN */
|
#include <limits.h> /* INT_MIN */
|
||||||
#include <stdlib.h> /* strtol */
|
#include <stdlib.h> /* strtol */
|
||||||
|
|
||||||
#include "parse.h"
|
#include "parse.h"
|
||||||
|
|
||||||
|
// Each time a rule is matched, advance the end cursor/position.
|
||||||
|
#define YY_USER_ACTION \
|
||||||
|
yylloc->last_column += (int) yyleng;
|
||||||
|
|
||||||
|
// Move the first position onto the last.
|
||||||
|
#define LOCATION_STEP() \
|
||||||
|
do { \
|
||||||
|
yylloc->first_line = yylloc->last_line; \
|
||||||
|
yylloc->first_column = yylloc->last_column; \
|
||||||
|
} while (0)
|
||||||
%}
|
%}
|
||||||
|
|
||||||
%%
|
%%
|
||||||
|
%{
|
||||||
|
// Each time yylex is called, move the head position to the end one.
|
||||||
|
LOCATION_STEP ();
|
||||||
|
%}
|
||||||
/* Rules. */
|
/* Rules. */
|
||||||
|
|
||||||
"+" return TOK_PLUS;
|
"+" return TOK_PLUS;
|
||||||
@@ -27,18 +61,18 @@
|
|||||||
errno = 0;
|
errno = 0;
|
||||||
long n = strtol (yytext, NULL, 10);
|
long n = strtol (yytext, NULL, 10);
|
||||||
if (! (INT_MIN <= n && n <= INT_MAX && errno != ERANGE))
|
if (! (INT_MIN <= n && n <= INT_MAX && errno != ERANGE))
|
||||||
yyerror (nerrs, "integer is out of range");
|
yyerror (yylloc, nerrs, "integer is out of range");
|
||||||
yylval->TOK_NUM = (int) n;
|
yylval->TOK_NUM = (int) n;
|
||||||
return TOK_NUM;
|
return TOK_NUM;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
"\n" yylloc->last_line++; yylloc->last_column = 1; return TOK_EOL;
|
||||||
|
|
||||||
/* Ignore white spaces. */
|
/* Ignore white spaces. */
|
||||||
[ \t]+ continue;
|
[ \t]+ LOCATION_STEP (); continue;
|
||||||
|
|
||||||
"\n" return TOK_EOL;
|
. yyerror (yylloc, nerrs, "syntax error, invalid character"); continue;
|
||||||
|
|
||||||
. yyerror (nerrs, "syntax error, invalid character");
|
<<EOF>> return TOK_YYEOF;
|
||||||
|
|
||||||
<<EOF>> return TOK_EOF;
|
|
||||||
%%
|
%%
|
||||||
/* Epilogue (C code). */
|
/* Epilogue (C code). */
|
||||||
|
|||||||
+4
-2
@@ -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,13 +11,15 @@
|
|||||||
## 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/>.
|
||||||
|
|
||||||
cdir = $(docdir)/%D%
|
cdir = $(docdir)/%D%
|
||||||
dist_c_DATA = %D%/README.md
|
dist_c_DATA = %D%/README.md
|
||||||
|
|
||||||
|
include %D%/bistromathic/local.mk
|
||||||
include %D%/calc/local.mk
|
include %D%/calc/local.mk
|
||||||
include %D%/lexcalc/local.mk
|
include %D%/lexcalc/local.mk
|
||||||
include %D%/mfcalc/local.mk
|
include %D%/mfcalc/local.mk
|
||||||
|
include %D%/pushcalc/local.mk
|
||||||
include %D%/reccalc/local.mk
|
include %D%/reccalc/local.mk
|
||||||
include %D%/rpcalc/local.mk
|
include %D%/rpcalc/local.mk
|
||||||
|
|||||||
@@ -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,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/>.
|
||||||
|
|
||||||
## -------------------- ##
|
## -------------------- ##
|
||||||
## Building & testing. ##
|
## Building & testing. ##
|
||||||
@@ -31,6 +31,7 @@ nodist_%C%_mfcalc_SOURCES = $(mfcalc_sources)
|
|||||||
%D%/mfcalc.c: $(dependencies)
|
%D%/mfcalc.c: $(dependencies)
|
||||||
# Don't use gnulib's system headers.
|
# Don't use gnulib's system headers.
|
||||||
%C%_mfcalc_CPPFLAGS = -I$(top_srcdir)/%D% -I$(top_builddir)/%D%
|
%C%_mfcalc_CPPFLAGS = -I$(top_srcdir)/%D% -I$(top_builddir)/%D%
|
||||||
|
%C%_mfcalc_CFLAGS = $(TEST_CFLAGS)
|
||||||
%C%_mfcalc_LDADD = -lm
|
%C%_mfcalc_LDADD = -lm
|
||||||
|
|
||||||
dist_TESTS += %D%/mfcalc.test
|
dist_TESTS += %D%/mfcalc.test
|
||||||
|
|||||||
@@ -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
|
||||||
1+2*3
|
1+2*3
|
||||||
@@ -25,3 +25,15 @@ cat >input <<EOF
|
|||||||
EOF
|
EOF
|
||||||
run 0 9
|
run 0 9
|
||||||
run -noerr 0 9 -p
|
run -noerr 0 9 -p
|
||||||
|
|
||||||
|
cat >input <<EOF
|
||||||
|
a = 256
|
||||||
|
sqrt (a)
|
||||||
|
EOF
|
||||||
|
run 0 '256
|
||||||
|
16'
|
||||||
|
|
||||||
|
cat >input <<EOF
|
||||||
|
16 == 12
|
||||||
|
EOF
|
||||||
|
run 0 'err: syntax error'
|
||||||
|
|||||||
@@ -0,0 +1,28 @@
|
|||||||
|
# This Makefile is designed to be simple and readable. It does not
|
||||||
|
# aim at portability. It requires GNU Make.
|
||||||
|
|
||||||
|
BASE = calc
|
||||||
|
BISON = bison
|
||||||
|
XSLTPROC = xsltproc
|
||||||
|
|
||||||
|
all: $(BASE)
|
||||||
|
|
||||||
|
%.c %.h %.xml %.gv: %.y
|
||||||
|
$(BISON) $(BISONFLAGS) --defines --xml --graph=$*.gv -o $*.c $<
|
||||||
|
|
||||||
|
$(BASE): $(BASE).o
|
||||||
|
$(CC) $(CFLAGS) -o $@ $^
|
||||||
|
|
||||||
|
run: $(BASE)
|
||||||
|
@echo "Type arithmetic expressions. Quit with ctrl-d."
|
||||||
|
./$<
|
||||||
|
|
||||||
|
html: $(BASE).html
|
||||||
|
%.html: %.xml
|
||||||
|
$(XSLTPROC) $(XSLTPROCFLAGS) -o $@ $$($(BISON) --print-datadir)/xslt/xml2xhtml.xsl $<
|
||||||
|
|
||||||
|
CLEANFILES = \
|
||||||
|
$(BASE) *.o $(BASE).[ch] $(BASE).output $(BASE).xml $(BASE).html $(BASE).gv
|
||||||
|
|
||||||
|
clean:
|
||||||
|
rm -f $(CLEANFILES)
|
||||||
@@ -0,0 +1,32 @@
|
|||||||
|
# pushcalc - push parser with Bison
|
||||||
|
|
||||||
|
This directory contains pushcalc, the traditional calculator, implemented as
|
||||||
|
a push parser.
|
||||||
|
|
||||||
|
Traditionally Bison is used to create so called "pull parsers": the user
|
||||||
|
invokes the parser once, which repeatedly calls (pulls) the scanner until
|
||||||
|
the input is drained.
|
||||||
|
|
||||||
|
This example demonstrates the "push parsers": the user calls scanner to
|
||||||
|
fetch the next token, passes (pushes) it to the parser, and repeats the
|
||||||
|
operation until the input is drained.
|
||||||
|
|
||||||
|
This example is a straightforward conversion of the 'calc' example to the
|
||||||
|
push-parser model.
|
||||||
|
|
||||||
|
<!---
|
||||||
|
Local Variables:
|
||||||
|
fill-column: 76
|
||||||
|
ispell-dictionary: "american"
|
||||||
|
End:
|
||||||
|
|
||||||
|
Copyright (C) 2020-2021 Free Software Foundation, Inc.
|
||||||
|
|
||||||
|
Permission is granted to copy, distribute and/or modify this document
|
||||||
|
under the terms of the GNU Free Documentation License, Version 1.3 or
|
||||||
|
any later version published by the Free Software Foundation; with no
|
||||||
|
Invariant Sections, with no Front-Cover Texts, and with no Back-Cover
|
||||||
|
Texts. A copy of the license is included in the "GNU Free
|
||||||
|
Documentation License" file as part of this distribution.
|
||||||
|
|
||||||
|
--->
|
||||||
@@ -0,0 +1,42 @@
|
|||||||
|
#! /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
|
||||||
|
1+2*3
|
||||||
|
EOF
|
||||||
|
run 0 7
|
||||||
|
|
||||||
|
cat >input <<EOF
|
||||||
|
1 - 2 - 3
|
||||||
|
EOF
|
||||||
|
run 0 -4
|
||||||
|
|
||||||
|
cat >input <<EOF
|
||||||
|
8 / 2 / 2
|
||||||
|
EOF
|
||||||
|
run 0 2
|
||||||
|
|
||||||
|
cat >input <<EOF
|
||||||
|
(1+2) * 3
|
||||||
|
EOF
|
||||||
|
run 0 9
|
||||||
|
run -noerr 0 9 -p
|
||||||
|
|
||||||
|
cat >input <<EOF
|
||||||
|
1++2
|
||||||
|
EOF
|
||||||
|
run 0 "err: syntax error, unexpected '+', expecting number or '('"
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user