mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-08-11 11:45:13 +00:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
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 | ||
|
|
22c3839168 | ||
|
|
4619b32dc0 | ||
|
|
ad921890c1 | ||
|
|
14ce500508 | ||
|
|
acba58ac59 | ||
|
|
9c21da3363 | ||
|
|
febf6115a0 | ||
|
|
11b5bac7bf | ||
|
|
b61bf2f0e8 | ||
|
|
19f45df02b | ||
|
|
2ab4058de0 | ||
|
|
f2277c3fec | ||
|
|
fb49a10e2c | ||
|
|
f049a57eec |
+1
-1
@@ -1 +1 @@
|
|||||||
3.6.1
|
3.7.4
|
||||||
|
|||||||
+20
-13
@@ -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
|
||||||
@@ -49,6 +50,7 @@ jobs:
|
|||||||
- make -j2 dist-xz
|
- make -j2 dist-xz
|
||||||
# Can help understanding why we get "dirty" tarballs.
|
# Can help understanding why we get "dirty" tarballs.
|
||||||
- git status
|
- git status
|
||||||
|
- git diff
|
||||||
- dist=$(echo bison*.xz)
|
- dist=$(echo bison*.xz)
|
||||||
|
|
||||||
# Unfortunately we cannot deterministically know the name of the tarball without the full
|
# Unfortunately we cannot deterministically know the name of the tarball without the full
|
||||||
@@ -118,6 +120,8 @@ jobs:
|
|||||||
- CXX='clang++-10 -fsanitize=address -stdlib=libc++'
|
- CXX='clang++-10 -fsanitize=address -stdlib=libc++'
|
||||||
- PART=2
|
- PART=2
|
||||||
|
|
||||||
|
# See https://github.com/simd-everywhere/simde/blob/master/.travis.yml
|
||||||
|
# and https://software.intel.com/content/www/us/en/develop/documentation/get-started-with-intel-oneapi-render-linux/top/configure-your-system.html.
|
||||||
- name: "ICC"
|
- name: "ICC"
|
||||||
stage: check
|
stage: check
|
||||||
os: linux
|
os: linux
|
||||||
@@ -126,7 +130,7 @@ jobs:
|
|||||||
- CC=icc
|
- CC=icc
|
||||||
- CXX=icpc
|
- CXX=icpc
|
||||||
install:
|
install:
|
||||||
- source /opt/intel/inteloneapi/compiler/latest/env/vars.sh
|
- source /opt/intel/oneapi/compiler/latest/env/vars.sh
|
||||||
addons:
|
addons:
|
||||||
apt:
|
apt:
|
||||||
sources:
|
sources:
|
||||||
@@ -135,7 +139,7 @@ jobs:
|
|||||||
packages:
|
packages:
|
||||||
- intel-oneapi-icc
|
- intel-oneapi-icc
|
||||||
|
|
||||||
- name: "ARM64: GCC 10 -O3 part 1"
|
- name: "ARM64: GCC 10 -O2 part 1"
|
||||||
stage: check
|
stage: check
|
||||||
os: linux
|
os: linux
|
||||||
arch: arm64
|
arch: arm64
|
||||||
@@ -144,24 +148,27 @@ jobs:
|
|||||||
env:
|
env:
|
||||||
- CC=gcc-10
|
- CC=gcc-10
|
||||||
- CXX=g++-10
|
- CXX=g++-10
|
||||||
- CONFIGUREFLAGS='CPPFLAGS=-DNDEBUG CFLAGS=-O3 CXXFLAGS=-O3'
|
- CONFIGUREFLAGS='CPPFLAGS=-DNDEBUG CFLAGS=-O2 CXXFLAGS=-O2'
|
||||||
- PART=1
|
- PART=1
|
||||||
|
|
||||||
# GCC10 on PPC seems to be buggy.
|
- name: "PPC64le: GCC 10 -O2 part 1"
|
||||||
# E.g., https://travis-ci.org/github/akimd/bison/jobs/687812428.
|
|
||||||
- name: "PPC64le: GCC 9 part 1"
|
|
||||||
stage: check
|
stage: check
|
||||||
os: linux
|
os: linux
|
||||||
arch: ppc64le
|
arch: ppc64le
|
||||||
dist: bionic
|
dist: bionic
|
||||||
addons: *gcc10
|
addons:
|
||||||
|
apt:
|
||||||
|
sources:
|
||||||
|
# See https://github.com/travis-ci/apt-source-safelist/issues/410.
|
||||||
|
- sourceline: 'ppa:ubuntu-toolchain-r/test'
|
||||||
|
packages: g++-10
|
||||||
env:
|
env:
|
||||||
- CC=gcc-9
|
- CC=gcc-10
|
||||||
- CXX=g++-9
|
- CXX=g++-10
|
||||||
- CONFIGUREFLAGS='CFLAGS=-O3 CXXFLAGS=-O3'
|
- CONFIGUREFLAGS='CFLAGS=-O2 CXXFLAGS=-O2'
|
||||||
- PART=1
|
- PART=1
|
||||||
|
|
||||||
- name: "s390x: GCC 10 part 1"
|
- name: "s390x: GCC 10 -O2 part 1"
|
||||||
stage: check
|
stage: check
|
||||||
os: linux
|
os: linux
|
||||||
arch: s390x
|
arch: s390x
|
||||||
@@ -170,7 +177,7 @@ jobs:
|
|||||||
env:
|
env:
|
||||||
- CC=gcc-10
|
- CC=gcc-10
|
||||||
- CXX=g++-10
|
- CXX=g++-10
|
||||||
- CONFIGUREFLAGS='CFLAGS=-O3 CXXFLAGS=-O3'
|
- CONFIGUREFLAGS='CFLAGS=-O2 CXXFLAGS=-O2'
|
||||||
- PART=1
|
- PART=1
|
||||||
|
|
||||||
## ----- ##
|
## ----- ##
|
||||||
|
|||||||
@@ -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.
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -26733,7 +26733,7 @@
|
|||||||
|
|
||||||
-----
|
-----
|
||||||
|
|
||||||
Copyright (C) 1987-1988, 1991-2015, 2018-2020 Free Software
|
Copyright (C) 1987-1988, 1991-2015, 2018-2021 Free Software
|
||||||
Foundation, Inc.
|
Foundation, Inc.
|
||||||
|
|
||||||
Copying and distribution of this file, with or without
|
Copying and distribution of this file, with or without
|
||||||
|
|||||||
+10
-1
@@ -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
|
||||||
@@ -131,3 +131,12 @@ gen-ChangeLog:
|
|||||||
# Useful to debug.
|
# Useful to debug.
|
||||||
.c.i:
|
.c.i:
|
||||||
$(CC) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -o $@ -E $<
|
$(CC) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -o $@ -E $<
|
||||||
|
|
||||||
|
.PHONY: codespell
|
||||||
|
CODESPELL = codespell
|
||||||
|
codespell:
|
||||||
|
$(AM_V_GEN) cd $(srcdir) \
|
||||||
|
&& $(CODESPELL) \
|
||||||
|
--regex "[\\w\\-'’\`]+\+*" \
|
||||||
|
--ignore-words-list "ba,circularly,cloneable,copyable,define'd,dout,froms,iff,ifset,od,ois" \
|
||||||
|
$$(git ls-files data doc lib src tests)
|
||||||
|
|||||||
@@ -1,5 +1,364 @@
|
|||||||
GNU Bison NEWS
|
GNU Bison NEWS
|
||||||
|
|
||||||
|
* Noteworthy changes in release 3.7.5 (2021-01-24) [stable]
|
||||||
|
|
||||||
|
** Bug fixes
|
||||||
|
|
||||||
|
*** Counterexample Generation
|
||||||
|
|
||||||
|
In some cases counterexample generation could crash. This is fixed.
|
||||||
|
|
||||||
|
*** Fix Table Generation
|
||||||
|
|
||||||
|
In some very rare conditions, when there are many useless tokens, it was
|
||||||
|
possible to generate incorrect parsers.
|
||||||
|
|
||||||
|
*** GLR parsers now support %merge together with api.value.type=union.
|
||||||
|
|
||||||
|
*** C++ parsers use noexcept in more places.
|
||||||
|
|
||||||
|
*** Generated parsers avoid some warnings about signedness issues.
|
||||||
|
|
||||||
|
*** C-language parsers now avoid warnings from pedantic clang.
|
||||||
|
|
||||||
|
*** C-language parsers now work around quirks of HP-UX 11.23 (2003).
|
||||||
|
|
||||||
|
|
||||||
|
* Noteworthy changes in release 3.7.4 (2020-11-14) [stable]
|
||||||
|
|
||||||
|
** Bug fixes
|
||||||
|
|
||||||
|
*** Bug fixes in yacc.c
|
||||||
|
|
||||||
|
In Yacc mode, all the tokens are defined twice: once as an enum, and then
|
||||||
|
as a macro. YYEMPTY was missing its macro.
|
||||||
|
|
||||||
|
*** Bug fixes in lalr1.cc
|
||||||
|
|
||||||
|
The lalr1.cc skeleton used to emit internal assertions (using YY_ASSERT)
|
||||||
|
even when the `parse.assert` %define variable is not enabled. It no
|
||||||
|
longer does.
|
||||||
|
|
||||||
|
The private internal macro YY_ASSERT now obeys the `api.prefix` %define
|
||||||
|
variable.
|
||||||
|
|
||||||
|
When there is a very large number of tokens, some assertions could be long
|
||||||
|
enough to hit arbitrary limits in Visual C++. They have been rewritten to
|
||||||
|
work around this limitation.
|
||||||
|
|
||||||
|
** Changes
|
||||||
|
|
||||||
|
The YYBISON macro in generated "regular C parsers" (from the "yacc.c"
|
||||||
|
skeleton) used to be defined to 1. It is now defined to the version of
|
||||||
|
Bison as an integer (e.g., 30704 for version 3.7.4).
|
||||||
|
|
||||||
|
* Noteworthy changes in release 3.7.3 (2020-10-13) [stable]
|
||||||
|
|
||||||
|
** Bug fixes
|
||||||
|
|
||||||
|
Fix concurrent build issues.
|
||||||
|
|
||||||
|
The bison executable is no longer linked uselessly against libreadline.
|
||||||
|
|
||||||
|
Fix incorrect use of yytname in glr.cc.
|
||||||
|
|
||||||
|
* Noteworthy changes in release 3.7.2 (2020-09-05) [stable]
|
||||||
|
|
||||||
|
This release of Bison fixes all known bugs reported for Bison in MITRE's
|
||||||
|
Common Vulnerabilities and Exposures (CVE) system. These vulnerabilities
|
||||||
|
are only about bison-the-program itself, not the generated code.
|
||||||
|
|
||||||
|
Although these bugs are typically irrelevant to how Bison is used, they
|
||||||
|
are worth fixing if only to give users peace of mind.
|
||||||
|
|
||||||
|
There is no known vulnerability in the generated parsers.
|
||||||
|
|
||||||
|
** Bug fixes
|
||||||
|
|
||||||
|
Fix concurrent build issues (introduced in Bison 3.5).
|
||||||
|
|
||||||
|
Push parsers always use YYMALLOC/YYFREE (no direct calls to malloc/free).
|
||||||
|
|
||||||
|
Fix portability issues of the test suite, and of bison itself.
|
||||||
|
|
||||||
|
Some unlikely crashes found by fuzzing have been fixed. This is only
|
||||||
|
about bison itself, not the generated parsers.
|
||||||
|
|
||||||
|
|
||||||
|
* Noteworthy changes in release 3.7.1 (2020-08-02) [stable]
|
||||||
|
|
||||||
|
** Bug fixes
|
||||||
|
|
||||||
|
Crash when a token alias contains a NUL byte.
|
||||||
|
|
||||||
|
Portability issues with libtextstyle.
|
||||||
|
|
||||||
|
Portability issues of Bison itself with MSVC.
|
||||||
|
|
||||||
|
** Changes
|
||||||
|
|
||||||
|
Improvements and fixes in the documentation.
|
||||||
|
|
||||||
|
More precise location about symbol type redefinitions.
|
||||||
|
|
||||||
|
|
||||||
|
* Noteworthy changes in release 3.7 (2020-07-23) [stable]
|
||||||
|
|
||||||
|
** Deprecated features
|
||||||
|
|
||||||
|
The YYPRINT macro, which works only with yacc.c and only for tokens, was
|
||||||
|
obsoleted long ago by %printer, introduced in Bison 1.50 (November 2002).
|
||||||
|
It is deprecated and its support will be removed eventually.
|
||||||
|
|
||||||
|
In conformance with the recommendations of the Graphviz team, in the next
|
||||||
|
version Bison the option `--graph` will generate a *.gv file by default,
|
||||||
|
instead of *.dot. A transition started in Bison 3.4.
|
||||||
|
|
||||||
|
** New features
|
||||||
|
|
||||||
|
*** Counterexample Generation
|
||||||
|
|
||||||
|
Contributed by Vincent Imbimbo.
|
||||||
|
|
||||||
|
When given `-Wcounterexamples`/`-Wcex`, bison will now output
|
||||||
|
counterexamples for conflicts.
|
||||||
|
|
||||||
|
**** Unifying Counterexamples
|
||||||
|
|
||||||
|
Unifying counterexamples are strings which can be parsed in two ways due
|
||||||
|
to the conflict. For example on a grammar that contains the usual
|
||||||
|
"dangling else" ambiguity:
|
||||||
|
|
||||||
|
$ bison else.y
|
||||||
|
else.y: warning: 1 shift/reduce conflict [-Wconflicts-sr]
|
||||||
|
else.y: note: rerun with option '-Wcounterexamples' to generate conflict counterexamples
|
||||||
|
|
||||||
|
$ bison else.y -Wcex
|
||||||
|
else.y: warning: 1 shift/reduce conflict [-Wconflicts-sr]
|
||||||
|
else.y: warning: shift/reduce conflict on token "else" [-Wcounterexamples]
|
||||||
|
Example: "if" exp "then" "if" exp "then" exp • "else" exp
|
||||||
|
Shift derivation
|
||||||
|
exp
|
||||||
|
↳ "if" exp "then" exp
|
||||||
|
↳ "if" exp "then" exp • "else" exp
|
||||||
|
Example: "if" exp "then" "if" exp "then" exp • "else" exp
|
||||||
|
Reduce derivation
|
||||||
|
exp
|
||||||
|
↳ "if" exp "then" exp "else" exp
|
||||||
|
↳ "if" exp "then" exp •
|
||||||
|
|
||||||
|
When text styling is enabled, colors are used in the examples and the
|
||||||
|
derivations to highlight the structure of both analyses. In this case,
|
||||||
|
|
||||||
|
"if" exp "then" [ "if" exp "then" exp • ] "else" exp
|
||||||
|
|
||||||
|
vs.
|
||||||
|
|
||||||
|
"if" exp "then" [ "if" exp "then" exp • "else" exp ]
|
||||||
|
|
||||||
|
|
||||||
|
The counterexamples are "focused", in two different ways. First, they do
|
||||||
|
not clutter the output with all the derivations from the start symbol,
|
||||||
|
rather they start on the "conflicted nonterminal". They go straight to the
|
||||||
|
point. Second, they don't "expand" nonterminal symbols uselessly.
|
||||||
|
|
||||||
|
**** Nonunifying Counterexamples
|
||||||
|
|
||||||
|
In the case of the dangling else, Bison found an example that can be
|
||||||
|
parsed in two ways (therefore proving that the grammar is ambiguous).
|
||||||
|
When it cannot find such an example, it instead generates two examples
|
||||||
|
that are the same up until the dot:
|
||||||
|
|
||||||
|
$ bison foo.y
|
||||||
|
foo.y: warning: 1 shift/reduce conflict [-Wconflicts-sr]
|
||||||
|
foo.y: note: rerun with option '-Wcounterexamples' to generate conflict counterexamples
|
||||||
|
foo.y:4.4-7: warning: rule useless in parser due to conflicts [-Wother]
|
||||||
|
4 | a: expr
|
||||||
|
| ^~~~
|
||||||
|
|
||||||
|
$ bison -Wcex foo.y
|
||||||
|
foo.y: warning: 1 shift/reduce conflict [-Wconflicts-sr]
|
||||||
|
foo.y: warning: shift/reduce conflict on token ID [-Wcounterexamples]
|
||||||
|
First example: expr • ID ',' ID $end
|
||||||
|
Shift derivation
|
||||||
|
$accept
|
||||||
|
↳ s $end
|
||||||
|
↳ a ID
|
||||||
|
↳ expr
|
||||||
|
↳ expr • ID ','
|
||||||
|
Second example: expr • ID $end
|
||||||
|
Reduce derivation
|
||||||
|
$accept
|
||||||
|
↳ s $end
|
||||||
|
↳ a ID
|
||||||
|
↳ expr •
|
||||||
|
foo.y:4.4-7: warning: rule useless in parser due to conflicts [-Wother]
|
||||||
|
4 | a: expr
|
||||||
|
| ^~~~
|
||||||
|
|
||||||
|
In these cases, the parser usually doesn't have enough lookahead to
|
||||||
|
differentiate the two given examples.
|
||||||
|
|
||||||
|
**** Reports
|
||||||
|
|
||||||
|
Counterexamples are also included in the report when given
|
||||||
|
`--report=counterexamples`/`-rcex` (or `--report=all`), with more
|
||||||
|
technical details:
|
||||||
|
|
||||||
|
State 7
|
||||||
|
|
||||||
|
1 exp: "if" exp "then" exp • [$end, "then", "else"]
|
||||||
|
2 | "if" exp "then" exp • "else" exp
|
||||||
|
|
||||||
|
"else" shift, and go to state 8
|
||||||
|
|
||||||
|
"else" [reduce using rule 1 (exp)]
|
||||||
|
$default reduce using rule 1 (exp)
|
||||||
|
|
||||||
|
shift/reduce conflict on token "else":
|
||||||
|
1 exp: "if" exp "then" exp •
|
||||||
|
2 exp: "if" exp "then" exp • "else" exp
|
||||||
|
Example: "if" exp "then" "if" exp "then" exp • "else" exp
|
||||||
|
Shift derivation
|
||||||
|
exp
|
||||||
|
↳ "if" exp "then" exp
|
||||||
|
↳ "if" exp "then" exp • "else" exp
|
||||||
|
Example: "if" exp "then" "if" exp "then" exp • "else" exp
|
||||||
|
Reduce derivation
|
||||||
|
exp
|
||||||
|
↳ "if" exp "then" exp "else" exp
|
||||||
|
↳ "if" exp "then" exp •
|
||||||
|
|
||||||
|
*** File prefix mapping
|
||||||
|
|
||||||
|
Contributed by Joshua Watt.
|
||||||
|
|
||||||
|
Bison learned a new argument, `--file-prefix-map OLD=NEW`. Any file path
|
||||||
|
in the output (specifically `#line` directives and `#ifdef` header guards)
|
||||||
|
that begins with the prefix OLD will have it replaced with the prefix NEW,
|
||||||
|
similar to the `-ffile-prefix-map` in GCC. This option can be used to
|
||||||
|
make bison output reproducible.
|
||||||
|
|
||||||
|
** Changes
|
||||||
|
|
||||||
|
*** Diagnostics
|
||||||
|
|
||||||
|
When text styling is enabled and the terminal supports it, the warnings
|
||||||
|
now include hyperlinks to the documentation.
|
||||||
|
|
||||||
|
*** Relocatable installation
|
||||||
|
|
||||||
|
When installed to be relocatable (via `configure --enable-relocatable`),
|
||||||
|
bison will now also look for a relocated m4.
|
||||||
|
|
||||||
|
*** C++ file names
|
||||||
|
|
||||||
|
The `filename_type` %define variable was renamed `api.filename.type`.
|
||||||
|
Instead of
|
||||||
|
|
||||||
|
%define filename_type "symbol"
|
||||||
|
|
||||||
|
write
|
||||||
|
|
||||||
|
%define api.filename.type {symbol}
|
||||||
|
|
||||||
|
(Or let `bison --update` do it for you).
|
||||||
|
|
||||||
|
It now defaults to `const std::string` instead of `std::string`.
|
||||||
|
|
||||||
|
*** Deprecated %define variable names
|
||||||
|
|
||||||
|
The following variables have been renamed for consistency. Backward
|
||||||
|
compatibility is ensured, but upgrading is recommended.
|
||||||
|
|
||||||
|
filename_type -> api.filename.type
|
||||||
|
package -> api.package
|
||||||
|
|
||||||
|
*** Push parsers no longer clear their state when parsing is finished
|
||||||
|
|
||||||
|
Previously push-parsers cleared their state when parsing was finished (on
|
||||||
|
success and on failure). This made it impossible to check if there were
|
||||||
|
parse errors, since `yynerrs` was also reset. This can be especially
|
||||||
|
troublesome when used in autocompletion, since a parser with error
|
||||||
|
recovery would suggest (irrelevant) expected tokens even if there were
|
||||||
|
failure.
|
||||||
|
|
||||||
|
Now the parser state can be examined when parsing is finished. The parser
|
||||||
|
state is reset when starting a new parse.
|
||||||
|
|
||||||
|
** Documentation
|
||||||
|
|
||||||
|
*** Examples
|
||||||
|
|
||||||
|
The bistromathic demonstrates %param and how to quote sources in the error
|
||||||
|
messages:
|
||||||
|
|
||||||
|
> 123 456
|
||||||
|
1.5-7: syntax error: expected end of file or + or - or * or / or ^ before number
|
||||||
|
1 | 123 456
|
||||||
|
| ^~~
|
||||||
|
|
||||||
|
** Bug fixes
|
||||||
|
|
||||||
|
*** Include the generated header (yacc.c)
|
||||||
|
|
||||||
|
Historically, when --defines was used, bison generated a header and pasted
|
||||||
|
an exact copy of it into the generated parser implementation file. Since
|
||||||
|
Bison 3.4 it is possible to specify that the header should be `#include`d,
|
||||||
|
and how. For instance
|
||||||
|
|
||||||
|
%define api.header.include {"parse.h"}
|
||||||
|
|
||||||
|
or
|
||||||
|
|
||||||
|
%define api.header.include {<parser/parse.h>}
|
||||||
|
|
||||||
|
Now api.header.include defaults to `"header-basename"`, as was intended in
|
||||||
|
Bison 3.4, where `header-basename` is the basename of the generated
|
||||||
|
header. This is disabled when the generated header is `y.tab.h`, to
|
||||||
|
comply with Automake's ylwrap.
|
||||||
|
|
||||||
|
*** String aliases are faithfully propagated
|
||||||
|
|
||||||
|
Bison used to interpret user strings (i.e., decoding backslash escapes)
|
||||||
|
when reading them, and to escape them (i.e., issue non-printable
|
||||||
|
characters as backslash escapes, taking the locale into account) when
|
||||||
|
outputting them. As a consequence non-ASCII strings (say in UTF-8) ended
|
||||||
|
up "ciphered" as sequences of backslash escapes. This happened not only
|
||||||
|
in the generated sources (where the compiler will reinterpret them), but
|
||||||
|
also in all the generated reports (text, xml, html, dot, etc.). Reports
|
||||||
|
were therefore not readable when string aliases were not pure ASCII.
|
||||||
|
Worse yet: the output depended on the user's locale.
|
||||||
|
|
||||||
|
Now Bison faithfully treats the string aliases exactly the way the user
|
||||||
|
spelled them. This fixes all the aforementioned problems. However, now,
|
||||||
|
string aliases semantically equivalent but syntactically different (e.g.,
|
||||||
|
"A", "\x41", "\101") are considered to be different.
|
||||||
|
|
||||||
|
*** Crash when generating IELR
|
||||||
|
|
||||||
|
An old, well hidden, bug in the generation of IELR parsers was fixed.
|
||||||
|
|
||||||
|
|
||||||
|
* Noteworthy changes in release 3.6.4 (2020-06-15) [stable]
|
||||||
|
|
||||||
|
** Bug fixes
|
||||||
|
|
||||||
|
In glr.cc some internal macros leaked in the user's code, and could damage
|
||||||
|
access to the token kinds.
|
||||||
|
|
||||||
|
|
||||||
|
* Noteworthy changes in release 3.6.3 (2020-06-03) [stable]
|
||||||
|
|
||||||
|
** Bug fixes
|
||||||
|
|
||||||
|
Incorrect comments in the generated parsers.
|
||||||
|
|
||||||
|
Warnings in push parsers (yacc.c).
|
||||||
|
|
||||||
|
Incorrect display of gotos in LAC traces (lalr1.cc).
|
||||||
|
|
||||||
|
|
||||||
* Noteworthy changes in release 3.6.2 (2020-05-17) [stable]
|
* Noteworthy changes in release 3.6.2 (2020-05-17) [stable]
|
||||||
|
|
||||||
** Bug fixes
|
** Bug fixes
|
||||||
@@ -12,6 +371,7 @@ GNU Bison NEWS
|
|||||||
|
|
||||||
bison used to emit "nested" comments, which is invalid C.
|
bison used to emit "nested" comments, which is invalid C.
|
||||||
|
|
||||||
|
|
||||||
* Noteworthy changes in release 3.6.1 (2020-05-10) [stable]
|
* Noteworthy changes in release 3.6.1 (2020-05-10) [stable]
|
||||||
|
|
||||||
** Bug fixes
|
** Bug fixes
|
||||||
@@ -26,6 +386,7 @@ GNU Bison NEWS
|
|||||||
|
|
||||||
In C++, yy::parser::symbol_type now has a public name() member function.
|
In C++, yy::parser::symbol_type now has a public name() member function.
|
||||||
|
|
||||||
|
|
||||||
* Noteworthy changes in release 3.6 (2020-05-08) [stable]
|
* Noteworthy changes in release 3.6 (2020-05-08) [stable]
|
||||||
|
|
||||||
** Backward incompatible changes
|
** Backward incompatible changes
|
||||||
@@ -248,6 +609,7 @@ GNU Bison NEWS
|
|||||||
autocompletion on the existing variables, rather than of the word
|
autocompletion on the existing variables, rather than of the word
|
||||||
"variable".
|
"variable".
|
||||||
|
|
||||||
|
|
||||||
* Noteworthy changes in release 3.5.4 (2020-04-05) [stable]
|
* Noteworthy changes in release 3.5.4 (2020-04-05) [stable]
|
||||||
|
|
||||||
** WARNING: Future backward-incompatibilities!
|
** WARNING: Future backward-incompatibilities!
|
||||||
@@ -268,6 +630,7 @@ GNU Bison NEWS
|
|||||||
|
|
||||||
Fix api.token.raw support in Java.
|
Fix api.token.raw support in Java.
|
||||||
|
|
||||||
|
|
||||||
* Noteworthy changes in release 3.5.3 (2020-03-08) [stable]
|
* Noteworthy changes in release 3.5.3 (2020-03-08) [stable]
|
||||||
|
|
||||||
** Bug fixes
|
** Bug fixes
|
||||||
@@ -276,7 +639,9 @@ GNU Bison NEWS
|
|||||||
\005) with incorrect styling. Fixes for similar issues with unexpectedly
|
\005) with incorrect styling. Fixes for similar issues with unexpectedly
|
||||||
short lines (e.g., the file was changed between parsing and diagnosing).
|
short lines (e.g., the file was changed between parsing and diagnosing).
|
||||||
|
|
||||||
Several unlikely crashes found by fuzzing have been fixed.
|
Some unlikely crashes found by fuzzing have been fixed. This is only
|
||||||
|
about bison itself, not the generated parsers.
|
||||||
|
|
||||||
|
|
||||||
* Noteworthy changes in release 3.5.2 (2020-02-13) [stable]
|
* Noteworthy changes in release 3.5.2 (2020-02-13) [stable]
|
||||||
|
|
||||||
@@ -287,6 +652,7 @@ GNU Bison NEWS
|
|||||||
The lalr1.cc skeleton properly rejects unsupported values for parse.lac
|
The lalr1.cc skeleton properly rejects unsupported values for parse.lac
|
||||||
(as yacc.c does).
|
(as yacc.c does).
|
||||||
|
|
||||||
|
|
||||||
* Noteworthy changes in release 3.5.1 (2020-01-19) [stable]
|
* Noteworthy changes in release 3.5.1 (2020-01-19) [stable]
|
||||||
|
|
||||||
** Bug fixes
|
** Bug fixes
|
||||||
@@ -295,6 +661,7 @@ GNU Bison NEWS
|
|||||||
|
|
||||||
Fix compiler warnings.
|
Fix compiler warnings.
|
||||||
|
|
||||||
|
|
||||||
* Noteworthy changes in release 3.5 (2019-12-11) [stable]
|
* Noteworthy changes in release 3.5 (2019-12-11) [stable]
|
||||||
|
|
||||||
** Backward incompatible changes
|
** Backward incompatible changes
|
||||||
@@ -502,6 +869,7 @@ GNU Bison NEWS
|
|||||||
|
|
||||||
In Java, %define api.prefix was ignored. It now behaves as expected.
|
In Java, %define api.prefix was ignored. It now behaves as expected.
|
||||||
|
|
||||||
|
|
||||||
* Noteworthy changes in release 3.4.2 (2019-09-12) [stable]
|
* Noteworthy changes in release 3.4.2 (2019-09-12) [stable]
|
||||||
|
|
||||||
** Bug fixes
|
** Bug fixes
|
||||||
@@ -519,12 +887,14 @@ GNU Bison NEWS
|
|||||||
When lone carriage-return characters appeared in the input file,
|
When lone carriage-return characters appeared in the input file,
|
||||||
diagnostics could hang forever.
|
diagnostics could hang forever.
|
||||||
|
|
||||||
|
|
||||||
* Noteworthy changes in release 3.4.1 (2019-05-22) [stable]
|
* Noteworthy changes in release 3.4.1 (2019-05-22) [stable]
|
||||||
|
|
||||||
** Bug fixes
|
** Bug fixes
|
||||||
|
|
||||||
Portability fixes.
|
Portability fixes.
|
||||||
|
|
||||||
|
|
||||||
* Noteworthy changes in release 3.4 (2019-05-19) [stable]
|
* Noteworthy changes in release 3.4 (2019-05-19) [stable]
|
||||||
|
|
||||||
** Deprecated features
|
** Deprecated features
|
||||||
@@ -665,6 +1035,7 @@ GNU Bison NEWS
|
|||||||
system, in December 1987. See the NEWS of Bison 3.3 for the previous
|
system, in December 1987. See the NEWS of Bison 3.3 for the previous
|
||||||
oldest bug.
|
oldest bug.
|
||||||
|
|
||||||
|
|
||||||
* Noteworthy changes in release 3.3.2 (2019-02-03) [stable]
|
* Noteworthy changes in release 3.3.2 (2019-02-03) [stable]
|
||||||
|
|
||||||
** Bug fixes
|
** Bug fixes
|
||||||
@@ -672,6 +1043,7 @@ GNU Bison NEWS
|
|||||||
Bison 3.3 failed to generate parsers for grammars with unused nonterminal
|
Bison 3.3 failed to generate parsers for grammars with unused nonterminal
|
||||||
symbols.
|
symbols.
|
||||||
|
|
||||||
|
|
||||||
* Noteworthy changes in release 3.3.1 (2019-01-27) [stable]
|
* Noteworthy changes in release 3.3.1 (2019-01-27) [stable]
|
||||||
|
|
||||||
** Changes
|
** Changes
|
||||||
@@ -679,6 +1051,7 @@ GNU Bison NEWS
|
|||||||
The option -y/--yacc used to imply -Werror=yacc, which turns uses of Bison
|
The option -y/--yacc used to imply -Werror=yacc, which turns uses of Bison
|
||||||
extensions into errors. It now makes them simple warnings (-Wyacc).
|
extensions into errors. It now makes them simple warnings (-Wyacc).
|
||||||
|
|
||||||
|
|
||||||
* Noteworthy changes in release 3.3 (2019-01-26) [stable]
|
* Noteworthy changes in release 3.3 (2019-01-26) [stable]
|
||||||
|
|
||||||
A new mailing list was created, Bison Announce. It is low traffic, and is
|
A new mailing list was created, Bison Announce. It is low traffic, and is
|
||||||
@@ -821,11 +1194,11 @@ GNU Bison NEWS
|
|||||||
|
|
||||||
...
|
...
|
||||||
|
|
||||||
Looking at the output from -v, one can see that the shift-reduce conflict
|
Looking at the output from -v, one can see that the shift/reduce conflict
|
||||||
here is due to the fact that the parser does not know whether to reduce
|
here is due to the fact that the parser does not know whether to reduce
|
||||||
arguments to argument_list until it sees the token _after_ the following
|
arguments to argument_list until it sees the token _after_ the following
|
||||||
','. By marking the rule with %expect 1 (because there is a conflict in
|
','. By marking the rule with %expect 1 (because there is a conflict in
|
||||||
one state), we document the source of the 1 overall shift-reduce conflict.
|
one state), we document the source of the 1 overall shift/reduce conflict.
|
||||||
|
|
||||||
In GLR parsers, we can use %expect-rr in a rule for reduce/reduce
|
In GLR parsers, we can use %expect-rr in a rule for reduce/reduce
|
||||||
conflicts. In this case, we mark each of the conflicting rules. For
|
conflicts. In this case, we mark each of the conflicting rules. For
|
||||||
@@ -940,7 +1313,7 @@ GNU Bison NEWS
|
|||||||
|
|
||||||
** Bug fixes
|
** Bug fixes
|
||||||
|
|
||||||
*** Incorrect number of reduce-reduce conflicts
|
*** Incorrect number of reduce/reduce conflicts
|
||||||
|
|
||||||
On a grammar such as
|
On a grammar such as
|
||||||
|
|
||||||
@@ -994,6 +1367,7 @@ GNU Bison NEWS
|
|||||||
literal such as ‘"number"’. The post-fix quantifiers are ‘?’ (zero or
|
literal such as ‘"number"’. The post-fix quantifiers are ‘?’ (zero or
|
||||||
one), ‘*’ (zero or more) and ‘+’ (one or more).
|
one), ‘*’ (zero or more) and ‘+’ (one or more).
|
||||||
|
|
||||||
|
|
||||||
* Noteworthy changes in release 3.2.4 (2018-12-24) [stable]
|
* Noteworthy changes in release 3.2.4 (2018-12-24) [stable]
|
||||||
|
|
||||||
** Bug fixes
|
** Bug fixes
|
||||||
@@ -1002,6 +1376,7 @@ GNU Bison NEWS
|
|||||||
|
|
||||||
Always provide a copy constructor for symbol_type, even in modern C++.
|
Always provide a copy constructor for symbol_type, even in modern C++.
|
||||||
|
|
||||||
|
|
||||||
* Noteworthy changes in release 3.2.3 (2018-12-18) [stable]
|
* Noteworthy changes in release 3.2.3 (2018-12-18) [stable]
|
||||||
|
|
||||||
** Bug fixes
|
** Bug fixes
|
||||||
@@ -1009,12 +1384,14 @@ GNU Bison NEWS
|
|||||||
Properly support token constructors in C++ with types that include commas
|
Properly support token constructors in C++ with types that include commas
|
||||||
(e.g., std::pair<int, int>). A regression introduced in Bison 3.2.
|
(e.g., std::pair<int, int>). A regression introduced in Bison 3.2.
|
||||||
|
|
||||||
|
|
||||||
* Noteworthy changes in release 3.2.2 (2018-11-21) [stable]
|
* Noteworthy changes in release 3.2.2 (2018-11-21) [stable]
|
||||||
|
|
||||||
** Bug fixes
|
** Bug fixes
|
||||||
|
|
||||||
C++ portability issues.
|
C++ portability issues.
|
||||||
|
|
||||||
|
|
||||||
* Noteworthy changes in release 3.2.1 (2018-11-09) [stable]
|
* Noteworthy changes in release 3.2.1 (2018-11-09) [stable]
|
||||||
|
|
||||||
** Bug fixes
|
** Bug fixes
|
||||||
@@ -1022,6 +1399,7 @@ GNU Bison NEWS
|
|||||||
Several portability issues have been fixed in the build system, in the
|
Several portability issues have been fixed in the build system, in the
|
||||||
test suite, and in the generated parsers in C++.
|
test suite, and in the generated parsers in C++.
|
||||||
|
|
||||||
|
|
||||||
* Noteworthy changes in release 3.2 (2018-10-29) [stable]
|
* Noteworthy changes in release 3.2 (2018-10-29) [stable]
|
||||||
|
|
||||||
** Backward incompatible changes
|
** Backward incompatible changes
|
||||||
@@ -1188,6 +1566,7 @@ GNU Bison NEWS
|
|||||||
|
|
||||||
Portability/warning issues with Flex.
|
Portability/warning issues with Flex.
|
||||||
|
|
||||||
|
|
||||||
* Noteworthy changes in release 3.1 (2018-08-27) [stable]
|
* Noteworthy changes in release 3.1 (2018-08-27) [stable]
|
||||||
|
|
||||||
** Backward incompatible changes
|
** Backward incompatible changes
|
||||||
@@ -1328,6 +1707,7 @@ GNU Bison NEWS
|
|||||||
Useless code was removed from C++ parsers, and some of the generated
|
Useless code was removed from C++ parsers, and some of the generated
|
||||||
constructors are more 'natural'.
|
constructors are more 'natural'.
|
||||||
|
|
||||||
|
|
||||||
* Noteworthy changes in release 3.0.5 (2018-05-27) [stable]
|
* Noteworthy changes in release 3.0.5 (2018-05-27) [stable]
|
||||||
|
|
||||||
** Bug fixes
|
** Bug fixes
|
||||||
@@ -1358,6 +1738,7 @@ GNU Bison NEWS
|
|||||||
|
|
||||||
On some platforms, some Java and/or C++ tests were failing.
|
On some platforms, some Java and/or C++ tests were failing.
|
||||||
|
|
||||||
|
|
||||||
* Noteworthy changes in release 3.0.4 (2015-01-23) [stable]
|
* Noteworthy changes in release 3.0.4 (2015-01-23) [stable]
|
||||||
|
|
||||||
** Bug fixes
|
** Bug fixes
|
||||||
@@ -1370,6 +1751,7 @@ GNU Bison NEWS
|
|||||||
|
|
||||||
Several portability issues in tests were fixed.
|
Several portability issues in tests were fixed.
|
||||||
|
|
||||||
|
|
||||||
* Noteworthy changes in release 3.0.3 (2015-01-15) [stable]
|
* Noteworthy changes in release 3.0.3 (2015-01-15) [stable]
|
||||||
|
|
||||||
** Bug fixes
|
** Bug fixes
|
||||||
@@ -1426,6 +1808,7 @@ GNU Bison NEWS
|
|||||||
- calc++
|
- calc++
|
||||||
a calculator in C++ using variant support and token constructors.
|
a calculator in C++ using variant support and token constructors.
|
||||||
|
|
||||||
|
|
||||||
* Noteworthy changes in release 3.0.2 (2013-12-05) [stable]
|
* Noteworthy changes in release 3.0.2 (2013-12-05) [stable]
|
||||||
|
|
||||||
** Bug fixes
|
** Bug fixes
|
||||||
@@ -1450,6 +1833,7 @@ GNU Bison NEWS
|
|||||||
When C++ variant support is enabled, an error triggered via YYERROR, but
|
When C++ variant support is enabled, an error triggered via YYERROR, but
|
||||||
not caught via error recovery, resulted in a double deletion.
|
not caught via error recovery, resulted in a double deletion.
|
||||||
|
|
||||||
|
|
||||||
* Noteworthy changes in release 3.0.1 (2013-11-12) [stable]
|
* Noteworthy changes in release 3.0.1 (2013-11-12) [stable]
|
||||||
|
|
||||||
** Bug fixes
|
** Bug fixes
|
||||||
@@ -1481,6 +1865,7 @@ GNU Bison NEWS
|
|||||||
|
|
||||||
Bugs and portability issues.
|
Bugs and portability issues.
|
||||||
|
|
||||||
|
|
||||||
* Noteworthy changes in release 3.0 (2013-07-25) [stable]
|
* Noteworthy changes in release 3.0 (2013-07-25) [stable]
|
||||||
|
|
||||||
** WARNING: Future backward-incompatibilities!
|
** WARNING: Future backward-incompatibilities!
|
||||||
@@ -1851,7 +2236,7 @@ GNU Bison NEWS
|
|||||||
%error-verbose directive is deprecated in favor of "%define parse.error
|
%error-verbose directive is deprecated in favor of "%define parse.error
|
||||||
verbose".
|
verbose".
|
||||||
|
|
||||||
** Renamed %define variables
|
** Deprecated %define variable names
|
||||||
|
|
||||||
The following variables have been renamed for consistency. Backward
|
The following variables have been renamed for consistency. Backward
|
||||||
compatibility is ensured, but upgrading is recommended.
|
compatibility is ensured, but upgrading is recommended.
|
||||||
@@ -2077,6 +2462,7 @@ GNU Bison NEWS
|
|||||||
There are operator- and operator-= for 'location'. Negative line/column
|
There are operator- and operator-= for 'location'. Negative line/column
|
||||||
increments can no longer underflow the resulting value.
|
increments can no longer underflow the resulting value.
|
||||||
|
|
||||||
|
|
||||||
* Noteworthy changes in release 2.7.1 (2013-04-15) [stable]
|
* Noteworthy changes in release 2.7.1 (2013-04-15) [stable]
|
||||||
|
|
||||||
** Bug fixes
|
** Bug fixes
|
||||||
@@ -2087,6 +2473,7 @@ GNU Bison NEWS
|
|||||||
|
|
||||||
*** Fix some compiler warnings (lalr1.cc)
|
*** Fix some compiler warnings (lalr1.cc)
|
||||||
|
|
||||||
|
|
||||||
* Noteworthy changes in release 2.7 (2012-12-12) [stable]
|
* Noteworthy changes in release 2.7 (2012-12-12) [stable]
|
||||||
|
|
||||||
** Bug fixes
|
** Bug fixes
|
||||||
@@ -2211,6 +2598,7 @@ GNU Bison NEWS
|
|||||||
|
|
||||||
The translation of midrule actions is now described.
|
The translation of midrule actions is now described.
|
||||||
|
|
||||||
|
|
||||||
* Noteworthy changes in release 2.6.5 (2012-11-07) [stable]
|
* Noteworthy changes in release 2.6.5 (2012-11-07) [stable]
|
||||||
|
|
||||||
We consider compiler warnings about Bison generated parsers to be bugs.
|
We consider compiler warnings about Bison generated parsers to be bugs.
|
||||||
@@ -2230,10 +2618,12 @@ GNU Bison NEWS
|
|||||||
When possible, yylloc is correctly initialized before calling yylex. It
|
When possible, yylloc is correctly initialized before calling yylex. It
|
||||||
is no longer necessary to initialize it in the %initial-action.
|
is no longer necessary to initialize it in the %initial-action.
|
||||||
|
|
||||||
|
|
||||||
* Noteworthy changes in release 2.6.4 (2012-10-23) [stable]
|
* Noteworthy changes in release 2.6.4 (2012-10-23) [stable]
|
||||||
|
|
||||||
Bison 2.6.3's --version was incorrect. This release fixes this issue.
|
Bison 2.6.3's --version was incorrect. This release fixes this issue.
|
||||||
|
|
||||||
|
|
||||||
* Noteworthy changes in release 2.6.3 (2012-10-22) [stable]
|
* Noteworthy changes in release 2.6.3 (2012-10-22) [stable]
|
||||||
|
|
||||||
** Bug fixes
|
** Bug fixes
|
||||||
@@ -2278,6 +2668,7 @@ GNU Bison NEWS
|
|||||||
"function declared 'noreturn' should not return") have also been
|
"function declared 'noreturn' should not return") have also been
|
||||||
addressed.
|
addressed.
|
||||||
|
|
||||||
|
|
||||||
* Noteworthy changes in release 2.6.2 (2012-08-03) [stable]
|
* Noteworthy changes in release 2.6.2 (2012-08-03) [stable]
|
||||||
|
|
||||||
** Bug fixes
|
** Bug fixes
|
||||||
@@ -2294,6 +2685,7 @@ GNU Bison NEWS
|
|||||||
|
|
||||||
The generated files no longer end (nor start) with empty lines.
|
The generated files no longer end (nor start) with empty lines.
|
||||||
|
|
||||||
|
|
||||||
* Noteworthy changes in release 2.6.1 (2012-07-30) [stable]
|
* Noteworthy changes in release 2.6.1 (2012-07-30) [stable]
|
||||||
|
|
||||||
Bison no longer executes user-specified M4 code when processing a grammar.
|
Bison no longer executes user-specified M4 code when processing a grammar.
|
||||||
@@ -2332,6 +2724,7 @@ GNU Bison NEWS
|
|||||||
will display two values for each typed and untyped symbol (provided
|
will display two values for each typed and untyped symbol (provided
|
||||||
that YYSTYPE has both "ival" and "fval" fields).
|
that YYSTYPE has both "ival" and "fval" fields).
|
||||||
|
|
||||||
|
|
||||||
* Noteworthy changes in release 2.6 (2012-07-19) [stable]
|
* Noteworthy changes in release 2.6 (2012-07-19) [stable]
|
||||||
|
|
||||||
** Future changes
|
** Future changes
|
||||||
@@ -2465,6 +2858,7 @@ GNU Bison NEWS
|
|||||||
|
|
||||||
#endif /* !BAR_FOO_H */ #endif /* !BAR_FOO_H */
|
#endif /* !BAR_FOO_H */ #endif /* !BAR_FOO_H */
|
||||||
|
|
||||||
|
|
||||||
* Noteworthy changes in release 2.5.1 (2012-06-05) [stable]
|
* Noteworthy changes in release 2.5.1 (2012-06-05) [stable]
|
||||||
|
|
||||||
** Future changes:
|
** Future changes:
|
||||||
@@ -2562,6 +2956,7 @@ GNU Bison NEWS
|
|||||||
Running "make install-pdf" (or -dvi, -html, -info, and -ps) no longer
|
Running "make install-pdf" (or -dvi, -html, -info, and -ps) no longer
|
||||||
halts in the middle of its course.
|
halts in the middle of its course.
|
||||||
|
|
||||||
|
|
||||||
* Noteworthy changes in release 2.5 (2011-05-14)
|
* Noteworthy changes in release 2.5 (2011-05-14)
|
||||||
|
|
||||||
** Grammar symbol names can now contain non-initial dashes:
|
** Grammar symbol names can now contain non-initial dashes:
|
||||||
@@ -2917,6 +3312,7 @@ GNU Bison NEWS
|
|||||||
|
|
||||||
This bug has been fixed.
|
This bug has been fixed.
|
||||||
|
|
||||||
|
|
||||||
* Noteworthy changes in release 2.4.3 (2010-08-05)
|
* Noteworthy changes in release 2.4.3 (2010-08-05)
|
||||||
|
|
||||||
** Bison now obeys -Werror and --warnings=error for warnings about
|
** Bison now obeys -Werror and --warnings=error for warnings about
|
||||||
@@ -2937,6 +3333,7 @@ GNU Bison NEWS
|
|||||||
|
|
||||||
** Minor documentation fixes.
|
** Minor documentation fixes.
|
||||||
|
|
||||||
|
|
||||||
* Noteworthy changes in release 2.4.2 (2010-03-20)
|
* Noteworthy changes in release 2.4.2 (2010-03-20)
|
||||||
|
|
||||||
** Some portability problems that resulted in failures and livelocks
|
** Some portability problems that resulted in failures and livelocks
|
||||||
@@ -3031,6 +3428,7 @@ GNU Bison NEWS
|
|||||||
message translations were not installed although supported by the
|
message translations were not installed although supported by the
|
||||||
host system.
|
host system.
|
||||||
|
|
||||||
|
|
||||||
* Noteworthy changes in release 2.4.1 (2008-12-11)
|
* Noteworthy changes in release 2.4.1 (2008-12-11)
|
||||||
|
|
||||||
** In the GLR defines file, unexpanded M4 macros in the yylval and yylloc
|
** In the GLR defines file, unexpanded M4 macros in the yylval and yylloc
|
||||||
@@ -3056,6 +3454,7 @@ GNU Bison NEWS
|
|||||||
|
|
||||||
** A few minor improvements to the Bison manual.
|
** A few minor improvements to the Bison manual.
|
||||||
|
|
||||||
|
|
||||||
* Noteworthy changes in release 2.4 (2008-11-02)
|
* Noteworthy changes in release 2.4 (2008-11-02)
|
||||||
|
|
||||||
** %language is an experimental feature.
|
** %language is an experimental feature.
|
||||||
@@ -3071,6 +3470,7 @@ GNU Bison NEWS
|
|||||||
** Several bugs in the C++ skeleton and the experimental Java skeleton have been
|
** Several bugs in the C++ skeleton and the experimental Java skeleton have been
|
||||||
fixed.
|
fixed.
|
||||||
|
|
||||||
|
|
||||||
* Noteworthy changes in release 2.3b (2008-05-27)
|
* Noteworthy changes in release 2.3b (2008-05-27)
|
||||||
|
|
||||||
** The quotes around NAME that used to be required in the following directive
|
** The quotes around NAME that used to be required in the following directive
|
||||||
@@ -3257,6 +3657,7 @@ GNU Bison NEWS
|
|||||||
** The nonfunctional --no-parser, -n, and %no-parser options have been
|
** The nonfunctional --no-parser, -n, and %no-parser options have been
|
||||||
completely removed from Bison.
|
completely removed from Bison.
|
||||||
|
|
||||||
|
|
||||||
* Noteworthy changes in release 2.3a (2006-09-13)
|
* Noteworthy changes in release 2.3a (2006-09-13)
|
||||||
|
|
||||||
** Instead of %union, you can define and use your own union type
|
** Instead of %union, you can define and use your own union type
|
||||||
@@ -3371,6 +3772,7 @@ GNU Bison NEWS
|
|||||||
The old spelling still works, but is not documented and may be removed
|
The old spelling still works, but is not documented and may be removed
|
||||||
in a future release.
|
in a future release.
|
||||||
|
|
||||||
|
|
||||||
* Noteworthy changes in release 2.3 (2006-06-05)
|
* Noteworthy changes in release 2.3 (2006-06-05)
|
||||||
|
|
||||||
** GLR grammars should now use "YYRECOVERING ()" instead of "YYRECOVERING",
|
** GLR grammars should now use "YYRECOVERING ()" instead of "YYRECOVERING",
|
||||||
@@ -3379,6 +3781,7 @@ GNU Bison NEWS
|
|||||||
** It is now documented that any definition of YYSTYPE or YYLTYPE should
|
** It is now documented that any definition of YYSTYPE or YYLTYPE should
|
||||||
be to a type name that does not contain parentheses or brackets.
|
be to a type name that does not contain parentheses or brackets.
|
||||||
|
|
||||||
|
|
||||||
* Noteworthy changes in release 2.2 (2006-05-19)
|
* Noteworthy changes in release 2.2 (2006-05-19)
|
||||||
|
|
||||||
** The distribution terms for all Bison-generated parsers now permit
|
** The distribution terms for all Bison-generated parsers now permit
|
||||||
@@ -3461,6 +3864,7 @@ GNU Bison NEWS
|
|||||||
|
|
||||||
** DJGPP support added.
|
** DJGPP support added.
|
||||||
|
|
||||||
|
|
||||||
* Noteworthy changes in release 2.1 (2005-09-16)
|
* Noteworthy changes in release 2.1 (2005-09-16)
|
||||||
|
|
||||||
** The C++ lalr1.cc skeleton supports %lex-param.
|
** The C++ lalr1.cc skeleton supports %lex-param.
|
||||||
@@ -3487,6 +3891,7 @@ GNU Bison NEWS
|
|||||||
print 'syntax error, unexpected number' instead of 'syntax error,
|
print 'syntax error, unexpected number' instead of 'syntax error,
|
||||||
unexpected "number"'.
|
unexpected "number"'.
|
||||||
|
|
||||||
|
|
||||||
* Noteworthy changes in release 2.0 (2004-12-25)
|
* Noteworthy changes in release 2.0 (2004-12-25)
|
||||||
|
|
||||||
** Possibly-incompatible changes
|
** Possibly-incompatible changes
|
||||||
@@ -3550,6 +3955,7 @@ GNU Bison NEWS
|
|||||||
|
|
||||||
- Semicolons are now allowed before "|" in grammar rules, as POSIX requires.
|
- Semicolons are now allowed before "|" in grammar rules, as POSIX requires.
|
||||||
|
|
||||||
|
|
||||||
* Noteworthy changes in release 1.875 (2003-01-01)
|
* Noteworthy changes in release 1.875 (2003-01-01)
|
||||||
|
|
||||||
** The documentation license has been upgraded to version 1.2
|
** The documentation license has been upgraded to version 1.2
|
||||||
@@ -3670,6 +4076,7 @@ GNU Bison NEWS
|
|||||||
ago, but nobody noticed until we recently asked someone to try
|
ago, but nobody noticed until we recently asked someone to try
|
||||||
building Bison with a K&R C compiler.
|
building Bison with a K&R C compiler.
|
||||||
|
|
||||||
|
|
||||||
* Noteworthy changes in release 1.75 (2002-10-14)
|
* Noteworthy changes in release 1.75 (2002-10-14)
|
||||||
|
|
||||||
** Bison should now work on 64-bit hosts.
|
** Bison should now work on 64-bit hosts.
|
||||||
@@ -3701,6 +4108,7 @@ GNU Bison NEWS
|
|||||||
was incorrectly rejected: $1 is defined in the second midrule
|
was incorrectly rejected: $1 is defined in the second midrule
|
||||||
action, and is equal to the $$ of the first midrule action.
|
action, and is equal to the $$ of the first midrule action.
|
||||||
|
|
||||||
|
|
||||||
* Noteworthy changes in release 1.50 (2002-10-04)
|
* Noteworthy changes in release 1.50 (2002-10-04)
|
||||||
|
|
||||||
** GLR parsing
|
** GLR parsing
|
||||||
@@ -3845,6 +4253,7 @@ GNU Bison NEWS
|
|||||||
|
|
||||||
** GNU M4 is now required when using Bison.
|
** GNU M4 is now required when using Bison.
|
||||||
|
|
||||||
|
|
||||||
* Noteworthy changes in release 1.35 (2002-03-25)
|
* Noteworthy changes in release 1.35 (2002-03-25)
|
||||||
|
|
||||||
** C Skeleton
|
** C Skeleton
|
||||||
@@ -3860,6 +4269,7 @@ GNU Bison NEWS
|
|||||||
This kludge also addresses some C++ problems when the stack was
|
This kludge also addresses some C++ problems when the stack was
|
||||||
extended.
|
extended.
|
||||||
|
|
||||||
|
|
||||||
* Noteworthy changes in release 1.34 (2002-03-12)
|
* Noteworthy changes in release 1.34 (2002-03-12)
|
||||||
|
|
||||||
** File name clashes are detected
|
** File name clashes are detected
|
||||||
@@ -3880,6 +4290,7 @@ GNU Bison NEWS
|
|||||||
|
|
||||||
** Fix test suite portability problems.
|
** Fix test suite portability problems.
|
||||||
|
|
||||||
|
|
||||||
* Noteworthy changes in release 1.33 (2002-02-07)
|
* Noteworthy changes in release 1.33 (2002-02-07)
|
||||||
|
|
||||||
** Fix C++ issues
|
** Fix C++ issues
|
||||||
@@ -3889,6 +4300,7 @@ GNU Bison NEWS
|
|||||||
** Catch invalid @n
|
** Catch invalid @n
|
||||||
As is done with $n.
|
As is done with $n.
|
||||||
|
|
||||||
|
|
||||||
* Noteworthy changes in release 1.32 (2002-01-23)
|
* Noteworthy changes in release 1.32 (2002-01-23)
|
||||||
|
|
||||||
** Fix Yacc output file names
|
** Fix Yacc output file names
|
||||||
@@ -3897,6 +4309,7 @@ GNU Bison NEWS
|
|||||||
|
|
||||||
** Italian, Dutch translations
|
** Italian, Dutch translations
|
||||||
|
|
||||||
|
|
||||||
* Noteworthy changes in release 1.31 (2002-01-14)
|
* Noteworthy changes in release 1.31 (2002-01-14)
|
||||||
|
|
||||||
** Many Bug Fixes
|
** Many Bug Fixes
|
||||||
@@ -3984,6 +4397,7 @@ GNU Bison NEWS
|
|||||||
** --output
|
** --output
|
||||||
New, aliasing "--output-file".
|
New, aliasing "--output-file".
|
||||||
|
|
||||||
|
|
||||||
* Noteworthy changes in release 1.30 (2001-10-26)
|
* Noteworthy changes in release 1.30 (2001-10-26)
|
||||||
|
|
||||||
** "--defines" and "--graph" have now an optional argument which is the
|
** "--defines" and "--graph" have now an optional argument which is the
|
||||||
@@ -3995,6 +4409,7 @@ GNU Bison NEWS
|
|||||||
|
|
||||||
** Portability fixes.
|
** Portability fixes.
|
||||||
|
|
||||||
|
|
||||||
* Noteworthy changes in release 1.29 (2001-09-07)
|
* Noteworthy changes in release 1.29 (2001-09-07)
|
||||||
|
|
||||||
** The output file does not define const, as this caused problems when used
|
** The output file does not define const, as this caused problems when used
|
||||||
@@ -4030,6 +4445,7 @@ GNU Bison NEWS
|
|||||||
** @$
|
** @$
|
||||||
Automatic location tracking.
|
Automatic location tracking.
|
||||||
|
|
||||||
|
|
||||||
* Noteworthy changes in release 1.28 (1999-07-06)
|
* Noteworthy changes in release 1.28 (1999-07-06)
|
||||||
|
|
||||||
** Should compile better now with K&R compilers.
|
** Should compile better now with K&R compilers.
|
||||||
@@ -4040,11 +4456,13 @@ GNU Bison NEWS
|
|||||||
|
|
||||||
** There is now a FAQ.
|
** There is now a FAQ.
|
||||||
|
|
||||||
|
|
||||||
* Noteworthy changes in release 1.27
|
* Noteworthy changes in release 1.27
|
||||||
|
|
||||||
** The make rule which prevented bison.simple from being created on
|
** The make rule which prevented bison.simple from being created on
|
||||||
some systems has been fixed.
|
some systems has been fixed.
|
||||||
|
|
||||||
|
|
||||||
* Noteworthy changes in release 1.26
|
* Noteworthy changes in release 1.26
|
||||||
|
|
||||||
** Bison now uses Automake.
|
** Bison now uses Automake.
|
||||||
@@ -4062,6 +4480,7 @@ GNU Bison NEWS
|
|||||||
** Generated parsers should now work even on operating systems which do
|
** Generated parsers should now work even on operating systems which do
|
||||||
not provide alloca().
|
not provide alloca().
|
||||||
|
|
||||||
|
|
||||||
* Noteworthy changes in release 1.25 (1995-10-16)
|
* Noteworthy changes in release 1.25 (1995-10-16)
|
||||||
|
|
||||||
** Errors in the input grammar are not fatal; Bison keeps reading
|
** Errors in the input grammar are not fatal; Bison keeps reading
|
||||||
@@ -4087,6 +4506,7 @@ the parser engine; a project can now use its own parser engine.
|
|||||||
The actions go into a separate file called NAME.act, in the form of
|
The actions go into a separate file called NAME.act, in the form of
|
||||||
a switch statement body.
|
a switch statement body.
|
||||||
|
|
||||||
|
|
||||||
* Noteworthy changes in release 1.23
|
* Noteworthy changes in release 1.23
|
||||||
|
|
||||||
The user can define YYPARSE_PARAM as the name of an argument to be
|
The user can define YYPARSE_PARAM as the name of an argument to be
|
||||||
@@ -4096,72 +4516,69 @@ by casting it to the proper pointer type.
|
|||||||
|
|
||||||
Line numbers in output file corrected.
|
Line numbers in output file corrected.
|
||||||
|
|
||||||
|
|
||||||
* Noteworthy changes in release 1.22
|
* Noteworthy changes in release 1.22
|
||||||
|
|
||||||
--help option added.
|
--help option added.
|
||||||
|
|
||||||
|
|
||||||
* Noteworthy changes in release 1.20
|
* Noteworthy changes in release 1.20
|
||||||
|
|
||||||
Output file does not redefine const for C++.
|
Output file does not redefine const for C++.
|
||||||
|
|
||||||
-----
|
-----
|
||||||
|
|
||||||
Copyright (C) 1995-2015, 2018-2020 Free Software Foundation, Inc.
|
LocalWords: yacc YYBACKUP glr GCC lalr ArrayIndexOutOfBoundsException nullptr
|
||||||
|
LocalWords: cplusplus liby rpl fprintf mfcalc Wyacc stmt cond expr mk sym lr
|
||||||
This file is part of Bison, the GNU Parser Generator.
|
LocalWords: IELR ielr Lookahead YYERROR nonassoc LALR's api lookaheads yychar
|
||||||
|
LocalWords: destructor lookahead YYRHSLOC YYLLOC Rhs ifndef YYFAIL cpp sr rr
|
||||||
This program is free software: you can redistribute it and/or modify
|
LocalWords: preprocessor initializer Wno Wnone Werror FreeBSD prec livelocks
|
||||||
it under the terms of the GNU General Public License as published by
|
LocalWords: Solaris AIX UX RHEL Tru LHS gcc's Wundef YYENABLE NLS YYLTYPE VCG
|
||||||
the Free Software Foundation, either version 3 of the License, or
|
LocalWords: yyerror cpp's Wunused yylval yylloc prepend yyparse yylex yypush
|
||||||
(at your option) any later version.
|
LocalWords: Graphviz xml nonterminals midrule destructor's YYSTYPE typedef ly
|
||||||
|
LocalWords: CHR chr printf stdout namespace preprocessing enum pre include's
|
||||||
This program is distributed in the hope that it will be useful,
|
LocalWords: YYRECOVERING nonfree destructors YYABORT YYACCEPT params enums de
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
LocalWords: struct yystype DJGPP lex param Haible NUM alloca YYSTACK NUL goto
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
LocalWords: YYMAXDEPTH Unescaped UCNs YYLTYPE's yyltype typedefs inline Yaccs
|
||||||
GNU General Public License for more details.
|
LocalWords: Heriyanto Reenable dprec Hilfinger Eggert MYEOF Folle Menezes EOF
|
||||||
|
LocalWords: Lackovic define's itemset Groff Gettext malloc NEWS'ed YYDEBUG YY
|
||||||
You should have received a copy of the GNU General Public License
|
LocalWords: namespaces strerror const autoconfiguration Dconst Autoconf's FDL
|
||||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
LocalWords: Automake TMPDIR LESSEQ ylwrap endif yydebug YYTOKEN YYLSP ival hh
|
||||||
|
LocalWords: extern YYTOKENTYPE TOKENTYPE yytokentype tokentype STYPE lval pdf
|
||||||
LocalWords: yacc YYBACKUP glr GCC lalr ArrayIndexOutOfBoundsException nullptr
|
LocalWords: lang yyoutput dvi html ps POSIX lvalp llocp Wother nterm arg init
|
||||||
LocalWords: cplusplus liby rpl fprintf mfcalc Wyacc stmt cond expr mk sym lr
|
LocalWords: TOK calc yyo fval Wconflicts parsers yystackp yyval yynerrs
|
||||||
LocalWords: IELR ielr Lookahead YYERROR nonassoc LALR's api lookaheads yychar
|
LocalWords: Théophile Ranquet Santet fno fnone stype associativity Tolmer
|
||||||
LocalWords: destructor lookahead YYRHSLOC YYLLOC Rhs ifndef YYFAIL cpp sr rr
|
LocalWords: Wprecedence Rassoul Wempty Paolo Bonzini parser's Michiel loc
|
||||||
LocalWords: preprocessor initializer Wno Wnone Werror FreeBSD prec livelocks
|
LocalWords: redeclaration sval fcaret reentrant XSLT xsl Wmaybe yyvsp Tedi
|
||||||
LocalWords: Solaris AIX UX RHEL Tru LHS gcc's Wundef YYENABLE NLS YYLTYPE VCG
|
LocalWords: pragmas noreturn untyped Rozenman unexpanded Wojciech Polak
|
||||||
LocalWords: yyerror cpp's Wunused yylval yylloc prepend yyparse yylex yypush
|
LocalWords: Alexandre MERCHANTABILITY yytype emplace ptr automove lvalues
|
||||||
LocalWords: Graphviz xml nonterminals midrule destructor's YYSTYPE typedef ly
|
LocalWords: nonterminal yy args Pragma dereference yyformat rhs docdir bw
|
||||||
LocalWords: CHR chr printf stdout namespace preprocessing enum pre include's
|
LocalWords: Redeclarations rpcalc Autoconf YFLAGS Makefiles PROG DECL num
|
||||||
LocalWords: YYRECOVERING nonfree destructors YYABORT YYACCEPT params enums de
|
LocalWords: Heimbigner AST src ast Makefile srcdir MinGW xxlex XXSTYPE
|
||||||
LocalWords: struct yystype DJGPP lex param Haible NUM alloca YYSTACK NUL goto
|
LocalWords: XXLTYPE strictfp IDEs ffixit fdiagnostics parseable fixits
|
||||||
LocalWords: YYMAXDEPTH Unescaped UCNs YYLTYPE's yyltype typedefs inline Yaccs
|
LocalWords: Wdeprecated yytext Variadic variadic yyrhs yyphrs RCS README
|
||||||
LocalWords: Heriyanto Reenable dprec Hilfinger Eggert MYEOF Folle Menezes EOF
|
LocalWords: noexcept constexpr ispell american deprecations backend Teoh
|
||||||
LocalWords: Lackovic define's itemset Groff Gettext malloc NEWS'ed YYDEBUG YY
|
LocalWords: YYPRINT Mangold Bonzini's Wdangling exVal baz checkable gcc
|
||||||
LocalWords: namespaces strerror const autoconfiguration Dconst Autoconf's FDL
|
LocalWords: fsanitize Vogelsgesang lis redeclared stdint automata yytname
|
||||||
LocalWords: Automake TMPDIR LESSEQ ylwrap endif yydebug YYTOKEN YYLSP ival hh
|
LocalWords: yysymbol yytnamerr yyreport ctx ARGMAX yysyntax stderr LPAREN
|
||||||
LocalWords: extern YYTOKENTYPE TOKENTYPE yytokentype tokentype STYPE lval pdf
|
LocalWords: symrec yypcontext TOKENMAX yyexpected YYEMPTY yypstate YYEOF
|
||||||
LocalWords: lang yyoutput dvi html ps POSIX lvalp llocp Wother nterm arg init
|
LocalWords: autocompletion bistromathic submessages Cayuela lexcalc hoc
|
||||||
LocalWords: TOK calc yyo fval Wconflicts parsers yystackp yyval yynerrs
|
LocalWords: yytoken YYUNDEF YYerror basename Automake's UTF ifdef ffile
|
||||||
LocalWords: Théophile Ranquet Santet fno fnone stype associativity Tolmer
|
LocalWords: gotos readline Imbimbo Wcounterexamples Wcex Nonunifying rcex
|
||||||
LocalWords: Wprecedence Rassoul Wempty Paolo Bonzini parser's Michiel loc
|
|
||||||
LocalWords: redeclaration sval fcaret reentrant XSLT xsl Wmaybe yyvsp Tedi
|
|
||||||
LocalWords: pragmas noreturn untyped Rozenman unexpanded Wojciech Polak
|
|
||||||
LocalWords: Alexandre MERCHANTABILITY yytype emplace ptr automove lvalues
|
|
||||||
LocalWords: nonterminal yy args Pragma dereference yyformat rhs docdir bw
|
|
||||||
LocalWords: Redeclarations rpcalc Autoconf YFLAGS Makefiles PROG DECL num
|
|
||||||
LocalWords: Heimbigner AST src ast Makefile srcdir MinGW xxlex XXSTYPE
|
|
||||||
LocalWords: XXLTYPE strictfp IDEs ffixit fdiagnostics parseable fixits
|
|
||||||
LocalWords: Wdeprecated yytext Variadic variadic yyrhs yyphrs RCS README
|
|
||||||
LocalWords: noexcept constexpr ispell american deprecations backend Teoh
|
|
||||||
LocalWords: YYPRINT Mangold Bonzini's Wdangling exVal baz checkable gcc
|
|
||||||
LocalWords: fsanitize Vogelsgesang lis redeclared stdint automata yytname
|
|
||||||
LocalWords: yysymbol yytnamerr yyreport ctx ARGMAX yysyntax stderr LPAREN
|
|
||||||
LocalWords: symrec yypcontext TOKENMAX yyexpected YYEMPTY yypstate YYEOF
|
|
||||||
LocalWords: autocompletion bistromathic submessages Cayuela lexcalc hoc
|
|
||||||
LocalWords: yytoken YYUNDEF YYerror
|
|
||||||
|
|
||||||
Local Variables:
|
Local Variables:
|
||||||
ispell-dictionary: "american"
|
ispell-dictionary: "american"
|
||||||
mode: outline
|
mode: outline
|
||||||
fill-column: 76
|
fill-column: 76
|
||||||
End:
|
End:
|
||||||
|
|
||||||
|
Copyright (C) 1995-2015, 2018-2021 Free Software Foundation, Inc.
|
||||||
|
|
||||||
|
This file is part of Bison, the GNU Parser Generator.
|
||||||
|
|
||||||
|
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.
|
||||||
|
|||||||
@@ -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.
|
||||||
|
|||||||
@@ -17,17 +17,18 @@ GNU Bison's home page is https://gnu.org/software/bison/.
|
|||||||
|
|
||||||
# Installation
|
# Installation
|
||||||
## Build from git
|
## Build from git
|
||||||
Here are basic installation instructions for a repository checkout:
|
The [README-hacking.md file](README-hacking.md) is about building, modifying
|
||||||
|
and checking Bison. See its "Working from the Repository" section to build
|
||||||
|
Bison from the git repo. Roughly, run:
|
||||||
|
|
||||||
$ git submodule update --init
|
$ git submodule update --init
|
||||||
$ ./bootstrap
|
$ ./bootstrap
|
||||||
|
|
||||||
then proceed with the usual `configure && make` steps.
|
then proceed with the usual `configure && make` steps.
|
||||||
|
|
||||||
The file README-hacking.md is about building, modifying and checking Bison.
|
|
||||||
|
|
||||||
## Build from tarball
|
## Build from tarball
|
||||||
See the file INSTALL for generic compilation and installation instructions.
|
See the [INSTALL file](INSTALL) for generic compilation and installation
|
||||||
|
instructions.
|
||||||
|
|
||||||
Bison requires GNU m4 1.4.6 or later. See
|
Bison requires GNU m4 1.4.6 or later. See
|
||||||
https://ftp.gnu.org/gnu/m4/m4-1.4.6.tar.gz.
|
https://ftp.gnu.org/gnu/m4/m4-1.4.6.tar.gz.
|
||||||
@@ -41,9 +42,11 @@ installing it. In that case, do not use `src/bison`: it would use the
|
|||||||
As an experimental feature, diagnostics are now colored, controlled by the
|
As an experimental feature, diagnostics are now colored, controlled by the
|
||||||
`--color` and `--style` options.
|
`--color` and `--style` options.
|
||||||
|
|
||||||
To use them, install the libtextstyle library before configuring Bison. It
|
To use them, install the libtextstyle library, 0.20.5 or newer, before
|
||||||
is available from https://alpha.gnu.org/gnu/gettext/, for instance
|
configuring Bison. It is available from https://alpha.gnu.org/gnu/gettext/,
|
||||||
https://alpha.gnu.org/pub/gnu/gettext/libtextstyle-0.20.5.tar.gz.
|
for instance https://alpha.gnu.org/gnu/gettext/libtextstyle-0.20.5.tar.gz,
|
||||||
|
or as part of Gettext 0.21 or newer, for instance
|
||||||
|
https://ftp.gnu.org/gnu/gettext/gettext-0.21.tar.gz.
|
||||||
|
|
||||||
The option --color supports the following arguments:
|
The option --color supports the following arguments:
|
||||||
- always, yes: Enable colors.
|
- always, yes: Enable colors.
|
||||||
@@ -60,6 +63,13 @@ To customize the styles, create a CSS file, say `bison-bw.css`, similar to
|
|||||||
then invoke bison with `--style=bison-bw.css`, or set the `BISON_STYLE`
|
then invoke bison with `--style=bison-bw.css`, or set the `BISON_STYLE`
|
||||||
environment variable to `bison-bw.css`.
|
environment variable to `bison-bw.css`.
|
||||||
|
|
||||||
|
In some diagnostics, bison uses libtextstyle to emit special escapes to
|
||||||
|
generate clickable hyperlinks. The environment variable
|
||||||
|
`NO_TERM_HYPERLINKS` can be used to suppress them. This may be useful for
|
||||||
|
terminal emulators which produce garbage output when they receive the escape
|
||||||
|
sequence for a hyperlink. Currently (as of 2020), this affects some versions
|
||||||
|
of emacs, guake, konsole, lxterminal, rxvt, yakuake.
|
||||||
|
|
||||||
## Relocatability
|
## Relocatability
|
||||||
If you pass `--enable-relocatable` to `configure`, Bison is relocatable.
|
If you pass `--enable-relocatable` to `configure`, Bison is relocatable.
|
||||||
|
|
||||||
@@ -100,7 +110,17 @@ that the range specifies every single year in that closed interval.
|
|||||||
|
|
||||||
<!--
|
<!--
|
||||||
|
|
||||||
Copyright (C) 1992, 1998-1999, 2003-2005, 2008-2015, 2018-2020 Free
|
LocalWords: parsers ngettext Texinfo pdf html YYYY ZZZZ ispell american md
|
||||||
|
LocalWords: MERCHANTABILITY GLR LALR IELR submodule init README src bw
|
||||||
|
LocalWords: Relocatability symlinks symlink
|
||||||
|
|
||||||
|
Local Variables:
|
||||||
|
mode: markdown
|
||||||
|
fill-column: 76
|
||||||
|
ispell-dictionary: "american"
|
||||||
|
End:
|
||||||
|
|
||||||
|
Copyright (C) 1992, 1998-1999, 2003-2005, 2008-2015, 2018-2021 Free
|
||||||
Software Foundation, Inc.
|
Software Foundation, Inc.
|
||||||
|
|
||||||
This file is part of GNU bison, the GNU Compiler Compiler.
|
This file is part of GNU bison, the GNU Compiler Compiler.
|
||||||
@@ -112,14 +132,4 @@ Invariant Sections, with no Front-Cover Texts, and with no Back-Cover
|
|||||||
Texts. A copy of the license is included in the "GNU Free
|
Texts. A copy of the license is included in the "GNU Free
|
||||||
Documentation License" file as part of this distribution.
|
Documentation License" file as part of this distribution.
|
||||||
|
|
||||||
Local Variables:
|
|
||||||
mode: markdown
|
|
||||||
fill-column: 76
|
|
||||||
ispell-dictionary: "american"
|
|
||||||
End:
|
|
||||||
|
|
||||||
LocalWords: parsers ngettext Texinfo pdf html YYYY ZZZZ ispell american md
|
|
||||||
LocalWords: MERCHANTABILITY GLR LALR IELR submodule init README src bw
|
|
||||||
LocalWords: Relocatability symlinks symlink
|
|
||||||
|
|
||||||
-->
|
-->
|
||||||
|
|||||||
+1
-1
@@ -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.
|
||||||
|
|||||||
+234
-155
@@ -5,151 +5,6 @@ Everything related to the development of Bison is on Savannah:
|
|||||||
http://savannah.gnu.org/projects/bison/.
|
http://savannah.gnu.org/projects/bison/.
|
||||||
|
|
||||||
|
|
||||||
Administrivia
|
|
||||||
=============
|
|
||||||
|
|
||||||
## If you incorporate a change from somebody on the net:
|
|
||||||
First, if it is a large change, you must make sure they have signed the
|
|
||||||
appropriate paperwork. Second, be sure to add their name and email address
|
|
||||||
to THANKS.
|
|
||||||
|
|
||||||
## If a change fixes a test, mention the test in the commit message.
|
|
||||||
|
|
||||||
## Bug reports
|
|
||||||
If somebody reports a new bug, mention his name in the commit message and in
|
|
||||||
the test case you write. Put him into THANKS.
|
|
||||||
|
|
||||||
The correct response to most actual bugs is to write a new test case which
|
|
||||||
demonstrates the bug. Then fix the bug, re-run the test suite, and check
|
|
||||||
everything in.
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Hacking
|
|
||||||
=======
|
|
||||||
|
|
||||||
## Visible Changes
|
|
||||||
Which include serious bug fixes, must be mentioned in NEWS.
|
|
||||||
|
|
||||||
## Translations
|
|
||||||
Only user visible strings are to be translated: error messages, bits of the
|
|
||||||
.output file etc. This excludes impossible error messages (comparable to
|
|
||||||
assert/abort), and all the --trace output which is meant for the maintainers
|
|
||||||
only.
|
|
||||||
|
|
||||||
## Syntax highlighting
|
|
||||||
It's quite nice to be in C++ mode when editing lalr1.cc for instance.
|
|
||||||
However tools such as Emacs will be fooled by the fact that braces and
|
|
||||||
parens do not nest, as in `[[}]]`. As a consequence you might be misguided
|
|
||||||
by its visual pairing to parens. The m4-mode is safer. Unfortunately the
|
|
||||||
m4-mode is also fooled by `#` which is sees as a comment, stops pairing with
|
|
||||||
parens/brackets that are inside...
|
|
||||||
|
|
||||||
## Coding Style
|
|
||||||
Do not add horizontal tab characters to any file in Bison's repository
|
|
||||||
except where required. For example, do not use tabs to format C code.
|
|
||||||
However, make files, ChangeLog, and some regular expressions require tabs.
|
|
||||||
Also, test cases might need to contain tabs to check that Bison properly
|
|
||||||
processes tabs in its input.
|
|
||||||
|
|
||||||
Prefer "res" as the name of the local variable that will be "return"ed by
|
|
||||||
the function.
|
|
||||||
|
|
||||||
### Bison
|
|
||||||
Follow the GNU Coding Standards.
|
|
||||||
|
|
||||||
Don't reinvent the wheel: we use gnulib, which features many components.
|
|
||||||
Actually, Bison has legacy code that we should replace with gnulib modules
|
|
||||||
(e.g., many ad hoc implementations of lists).
|
|
||||||
|
|
||||||
### Skeletons
|
|
||||||
We try to use the "typical" coding style for each language.
|
|
||||||
|
|
||||||
#### CPP
|
|
||||||
We indent the CPP directives this way:
|
|
||||||
|
|
||||||
```
|
|
||||||
#if FOO
|
|
||||||
# if BAR
|
|
||||||
# define BAZ
|
|
||||||
# endif
|
|
||||||
#endif
|
|
||||||
```
|
|
||||||
|
|
||||||
Don't indent with leading spaces in the skeletons (it's ok in the grammar
|
|
||||||
files though, e.g., in `%code {...}` blocks).
|
|
||||||
|
|
||||||
On occasions, use `cppi -c` to see where we stand. We don't aim at full
|
|
||||||
correctness: depending `-d`, some bits can be in the *.c file, or the *.h
|
|
||||||
file within the double-inclusion cpp-guards. In that case, favor the case
|
|
||||||
of the *.h file, but don't waste time on this.
|
|
||||||
|
|
||||||
Don't hesitate to leave a comment on the `#endif` (e.g., `#endif /* FOO
|
|
||||||
*/`), especially for long blocks.
|
|
||||||
|
|
||||||
There is no conistency on `! defined` vs. `!defined`. The day gnulib
|
|
||||||
decides, we'll follow them.
|
|
||||||
|
|
||||||
#### C/C++
|
|
||||||
Follow the GNU Coding Standards.
|
|
||||||
|
|
||||||
The `glr.c` skeleton was implemented with `camlCase`. We are migrating it
|
|
||||||
to `snake_case`. Because we are standardizing the code, it is currently
|
|
||||||
inconsistent.
|
|
||||||
|
|
||||||
Use `YYFOO` and `yyfoo` for entities that are exposed to the user. They are
|
|
||||||
part of our contract with the users wrt backward compatibility.
|
|
||||||
|
|
||||||
Use `YY_FOO` and `yy_foo` for private matters. Users should not use them,
|
|
||||||
we are free to change them without fear of backward compatibility issues.
|
|
||||||
|
|
||||||
Use `*_t` for types, especially for `yy*_t` in which case we shouldn't worry
|
|
||||||
about the C standard introducing such a name.
|
|
||||||
|
|
||||||
#### C++
|
|
||||||
Follow the C++ Core Guidelines
|
|
||||||
(http://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines). The Google
|
|
||||||
ones may be interesting too
|
|
||||||
(https://google.github.io/styleguide/cppguide.html).
|
|
||||||
|
|
||||||
Our enumerators, such as the kinds (symbol and token kinds), should be lower
|
|
||||||
case, but it was too late to follow that track for token kinds, and symbol
|
|
||||||
kind enumerators are made to be consistent with them.
|
|
||||||
|
|
||||||
Use `*_type` for type aliases. Use `foo_get()` and `foo_set(v)` for
|
|
||||||
accessors, or simply `foo()` and `foo(v)`.
|
|
||||||
|
|
||||||
Use the `yy` prefix for private stuff, but there's no need for it in the
|
|
||||||
public API. The `yy` prefix is already taken care of via the namespace.
|
|
||||||
|
|
||||||
#### Java
|
|
||||||
We follow https://www.oracle.com/technetwork/java/codeconventions-150003.pdf
|
|
||||||
and https://google.github.io/styleguide/javaguide.html. Unfortunately at
|
|
||||||
some point some GNU Coding Style was installed in Java, but it's an error.
|
|
||||||
So we should for instance stop putting spaces in function calls. Because we
|
|
||||||
are standardizing the code, it is currently inconsistent.
|
|
||||||
|
|
||||||
Use a 2-space indentation (Google) rather than 4 (Oracle).
|
|
||||||
|
|
||||||
Don't use the "yy" prefix for public members: "getExpectedTokens", not
|
|
||||||
"yyexpectedTokens" or "yygetExpectedTokens".
|
|
||||||
|
|
||||||
## Commit Messages
|
|
||||||
Imitate the style we use. Use `git log` to get sources of inspiration.
|
|
||||||
|
|
||||||
If the changes have a small impact on Bison's generated parser, embed these
|
|
||||||
changes in the commit itself. If the impact is large, first push all the
|
|
||||||
changes except those about src/parse-gram.[ch], and then another commit
|
|
||||||
named "regen" which is only about them.
|
|
||||||
|
|
||||||
## Debugging
|
|
||||||
Bison supports tracing of its various steps, via the `--trace` option.
|
|
||||||
Since it is not meant for the end user, it is not displayed by `bison
|
|
||||||
--help`, nor is it documented in the manual. Instead, run `bison
|
|
||||||
--trace=help`.
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Working from the Repository
|
Working from the Repository
|
||||||
===========================
|
===========================
|
||||||
|
|
||||||
@@ -168,6 +23,7 @@ tools we depend upon, including:
|
|||||||
- Automake <http://www.gnu.org/software/automake/>
|
- Automake <http://www.gnu.org/software/automake/>
|
||||||
- Flex <http://www.gnu.org/software/flex/>
|
- Flex <http://www.gnu.org/software/flex/>
|
||||||
- Gettext <http://www.gnu.org/software/gettext/>
|
- Gettext <http://www.gnu.org/software/gettext/>
|
||||||
|
- Gperf <http://www.gnu.org/software/gperf/>
|
||||||
- Graphviz <http://www.graphviz.org>
|
- Graphviz <http://www.graphviz.org>
|
||||||
- Gzip <http://www.gnu.org/software/gzip/>
|
- Gzip <http://www.gnu.org/software/gzip/>
|
||||||
- Help2man <http://www.gnu.org/software/help2man/>
|
- Help2man <http://www.gnu.org/software/help2man/>
|
||||||
@@ -184,7 +40,7 @@ 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
|
||||||
@@ -322,6 +178,201 @@ version, compile bison, then force it to recreate the files:
|
|||||||
$ make -C _build
|
$ make -C _build
|
||||||
|
|
||||||
|
|
||||||
|
Administrivia
|
||||||
|
=============
|
||||||
|
|
||||||
|
## If you incorporate a change from somebody on the net:
|
||||||
|
First, if it is a large change, you must make sure they have signed the
|
||||||
|
appropriate paperwork. Second, be sure to add their name and email address
|
||||||
|
to THANKS.
|
||||||
|
|
||||||
|
## If a change fixes a test, mention the test in the commit message.
|
||||||
|
|
||||||
|
## Bug reports
|
||||||
|
If somebody reports a new bug, mention his name in the commit message and in
|
||||||
|
the test case you write. Put him into THANKS.
|
||||||
|
|
||||||
|
The correct response to most actual bugs is to write a new test case which
|
||||||
|
demonstrates the bug. Then fix the bug, re-run the test suite, and check
|
||||||
|
everything in.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Hacking
|
||||||
|
=======
|
||||||
|
|
||||||
|
## Visible Changes
|
||||||
|
Which include serious bug fixes, must be mentioned in NEWS.
|
||||||
|
|
||||||
|
## Translations
|
||||||
|
Only user visible strings are to be translated: error messages, bits of the
|
||||||
|
.output file etc. This excludes impossible error messages (comparable to
|
||||||
|
assert/abort), and all the --trace output which is meant for the maintainers
|
||||||
|
only.
|
||||||
|
|
||||||
|
## Vocabulary
|
||||||
|
- "lookahead", not "look-ahead".
|
||||||
|
- "midrule", not "mid-rule".
|
||||||
|
- "nonterminal", not "variable" or "non-terminal" or "non terminal".
|
||||||
|
Abbreviated as "nterm".
|
||||||
|
- "shift/reduce" and "reduce/reduce", not "shift-reduce" or "shift reduce",
|
||||||
|
etc.
|
||||||
|
|
||||||
|
## Syntax Highlighting
|
||||||
|
It's quite nice to be in C++ mode when editing lalr1.cc for instance.
|
||||||
|
However tools such as Emacs will be fooled by the fact that braces and
|
||||||
|
parens do not nest, as in `[[}]]`. As a consequence you might be misguided
|
||||||
|
by its visual pairing to parens. The m4-mode is safer. Unfortunately the
|
||||||
|
m4-mode is also fooled by `#` which is sees as a comment, stops pairing with
|
||||||
|
parens/brackets that are inside...
|
||||||
|
|
||||||
|
## Implementation Notes
|
||||||
|
There are several places with interesting details about the implementation:
|
||||||
|
- [Understanding C parsers generated by GNU
|
||||||
|
Bison](https://www.cs.uic.edu/~spopuri/cparser.html) by Satya Kiran Popuri,
|
||||||
|
is a wonderful piece of work that explains the implementation of Bison,
|
||||||
|
- [src/gram.h](src/gram.h) documents the way the grammar is represented
|
||||||
|
- [src/tables.h](src/tables.h) documents the generated tables
|
||||||
|
- [data/README.md](data/README.md) contains details about the m4 implementation
|
||||||
|
|
||||||
|
## Coding Style
|
||||||
|
Do not add horizontal tab characters to any file in Bison's repository
|
||||||
|
except where required. For example, do not use tabs to format C code.
|
||||||
|
However, make files, ChangeLog, and some regular expressions require tabs.
|
||||||
|
Also, test cases might need to contain tabs to check that Bison properly
|
||||||
|
processes tabs in its input.
|
||||||
|
|
||||||
|
Prefer `res` as the name of the local variable that will be "return"ed by
|
||||||
|
the function.
|
||||||
|
|
||||||
|
In writing arithmetic comparisons, use "<" and "<=" rather than ">" and ">="
|
||||||
|
(http://www.gelato.unsw.edu.au/archives/git/0505/4507.html).
|
||||||
|
|
||||||
|
### 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](http://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
|
Test Suite
|
||||||
==========
|
==========
|
||||||
|
|
||||||
@@ -331,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
|
||||||
@@ -393,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
|
||||||
|
|
||||||
@@ -409,6 +460,31 @@ Use the `javaexec.sh` script. For instance to run the parser of test case
|
|||||||
|
|
||||||
$ sh ./_build/javaexec.sh -cp ./_build/tests/testsuite.dir/504 Calc
|
$ sh ./_build/javaexec.sh -cp ./_build/tests/testsuite.dir/504 Calc
|
||||||
|
|
||||||
|
## Using Sanitizers
|
||||||
|
Address sanitizer (ASAN) and undefined-behavior sanitizer (UBSAN) are very
|
||||||
|
useful. Here's one way to set 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.
|
||||||
|
|
||||||
@@ -488,11 +564,12 @@ re-run the tests, run:
|
|||||||
Release Procedure
|
Release Procedure
|
||||||
=================
|
=================
|
||||||
|
|
||||||
See README-release.
|
See the [README-release file](README-release), created when the package is
|
||||||
|
bootstrapped.
|
||||||
|
|
||||||
<!--
|
<!--
|
||||||
|
|
||||||
Copyright (C) 2002-2005, 2007-2015, 2018-2020 Free Software Foundation,
|
Copyright (C) 2002-2005, 2007-2015, 2018-2021 Free Software Foundation,
|
||||||
Inc.
|
Inc.
|
||||||
|
|
||||||
This file is part of GNU Bison.
|
This file is part of GNU Bison.
|
||||||
@@ -524,8 +601,10 @@ LocalWords: symlinks vti html lt POSIX Cc'ed Graphviz Texinfo autoconf jN
|
|||||||
LocalWords: automake autopoint graphviz texinfo PROG Wother parsers YYFOO
|
LocalWords: automake autopoint graphviz texinfo PROG Wother parsers YYFOO
|
||||||
LocalWords: TESTSUITEFLAGS deprec struct gnulib's getopt config ggdb yyfoo
|
LocalWords: TESTSUITEFLAGS deprec struct gnulib's getopt config ggdb yyfoo
|
||||||
LocalWords: bitset fsanitize symlink CFLAGS MERCHANTABILITY ispell wrt YY
|
LocalWords: bitset fsanitize symlink CFLAGS MERCHANTABILITY ispell wrt YY
|
||||||
LocalWords: american Administrivia camlCase yy accessors namespace src
|
LocalWords: american Administrivia camlCase yy accessors namespace src hoc
|
||||||
LocalWords: getExpectedTokens yyexpectedTokens yygetExpectedTokens
|
LocalWords: getExpectedTokens yyexpectedTokens yygetExpectedTokens parens
|
||||||
LocalWords: regen dogfooding Autotest testsuite
|
LocalWords: regen dogfooding Autotest testsuite getargs CPP BAZ endif cppi
|
||||||
|
LocalWords: cpp javaexec cp Calc ASAN UBSAN CPPFLAGS isystem CXX cex Gperf
|
||||||
|
LocalWords: CXXFLAGS LDFLAGS dsymutil gperf
|
||||||
|
|
||||||
-->
|
-->
|
||||||
|
|||||||
@@ -45,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]
|
||||||
@@ -59,6 +60,7 @@ Di-an Jan [email protected]
|
|||||||
Dick Streefland [email protected]
|
Dick Streefland [email protected]
|
||||||
Didier Godefroy [email protected]
|
Didier Godefroy [email protected]
|
||||||
Don Macpherson [email protected]
|
Don Macpherson [email protected]
|
||||||
|
Dwight Guth [email protected]
|
||||||
Efi Fogel [email protected]
|
Efi Fogel [email protected]
|
||||||
Enrico Scholz [email protected]
|
Enrico Scholz [email protected]
|
||||||
Eric Blake [email protected]
|
Eric Blake [email protected]
|
||||||
@@ -83,6 +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]
|
||||||
@@ -103,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]
|
||||||
@@ -162,6 +168,7 @@ 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]
|
||||||
@@ -180,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]
|
||||||
@@ -213,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]
|
||||||
@@ -228,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.
|
||||||
|
|
||||||
|
|||||||
@@ -1,15 +1,49 @@
|
|||||||
* Bison 3.7
|
* 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
|
** Bistromathic
|
||||||
- Hitting tab on a line with a syntax error is ugly
|
|
||||||
|
|
||||||
- Be robust to existing ~/.inputrc
|
|
||||||
|
|
||||||
- How about not evaluating incomplete lines when the text is not finished
|
- How about not evaluating incomplete lines when the text is not finished
|
||||||
(as shells do).
|
(as shells do).
|
||||||
|
|
||||||
** Doc
|
|
||||||
*** api.header.include
|
|
||||||
|
|
||||||
** Questions
|
** Questions
|
||||||
*** Java
|
*** Java
|
||||||
- Should i18n be part of the Lexer? Currently it's a static method of
|
- Should i18n be part of the Lexer? Currently it's a static method of
|
||||||
@@ -22,13 +56,6 @@
|
|||||||
|
|
||||||
- promote YYEOF rather than EOF.
|
- promote YYEOF rather than EOF.
|
||||||
|
|
||||||
*** D
|
|
||||||
- is there a way to attach yysymbol_name to the enum itself? As we did
|
|
||||||
in Java.
|
|
||||||
|
|
||||||
- It would be better to have TokenKind as return value. Can we use
|
|
||||||
reflection to support both output types?
|
|
||||||
|
|
||||||
** YYerror
|
** YYerror
|
||||||
https://git.savannah.gnu.org/gitweb/?p=gettext.git;a=blob;f=gettext-runtime/intl/plural.y;h=a712255af4f2f739c93336d4ff6556d932a426a5;hb=HEAD
|
https://git.savannah.gnu.org/gitweb/?p=gettext.git;a=blob;f=gettext-runtime/intl/plural.y;h=a712255af4f2f739c93336d4ff6556d932a426a5;hb=HEAD
|
||||||
|
|
||||||
@@ -39,26 +66,9 @@ enough.
|
|||||||
*** calc.at
|
*** calc.at
|
||||||
Stop hard-coding "Calc". Adjust local.at (look for FIXME).
|
Stop hard-coding "Calc". Adjust local.at (look for FIXME).
|
||||||
|
|
||||||
** Counter example generation
|
|
||||||
See https://github.com/akimd/bison/pull/15.
|
|
||||||
|
|
||||||
** Clean up
|
|
||||||
Rename user_token_number for tokens as "code". It's not a "user number",
|
|
||||||
it's the token code, and the user can control it, but this code always
|
|
||||||
exists.
|
|
||||||
|
|
||||||
See also USER_NUMBER_UNDEFINED and NUMBER_UNDEFINED.
|
|
||||||
|
|
||||||
Rename endtoken as eoftoken.
|
|
||||||
|
|
||||||
Also do it in data/skeletons.
|
|
||||||
|
|
||||||
Don't rename in Bison 3.6 (it would be logical to do so) because that
|
|
||||||
would probably create many conflicts in Vincent's work (see previous point).
|
|
||||||
|
|
||||||
** A dev warning for b4_
|
** A dev warning for b4_
|
||||||
Maybe we should check for m4_ and b4_ leaking out of the m4 processing, as
|
Maybe we should check for m4_ and b4_ leaking out of the m4 processing, as
|
||||||
Autoconf does. It would have caught overquotation issues.
|
Autoconf does. It would have caught over-quotation issues.
|
||||||
|
|
||||||
** doc
|
** doc
|
||||||
I feel it's ugly to use the GNU style to declare functions in the doc. It
|
I feel it's ugly to use the GNU style to declare functions in the doc. It
|
||||||
@@ -66,7 +76,7 @@ generates tons of white space in the page, and may contribute to bad page
|
|||||||
breaks.
|
breaks.
|
||||||
|
|
||||||
** consistency
|
** consistency
|
||||||
token vs terminal, variable vs non terminal.
|
token vs terminal.
|
||||||
|
|
||||||
** api.token.raw
|
** api.token.raw
|
||||||
The YYUNDEFTOK could be assigned a semantic value so that yyerror could be
|
The YYUNDEFTOK could be assigned a semantic value so that yyerror could be
|
||||||
@@ -79,7 +89,7 @@ push parsers on top of pull parser. Which is currently not relevant, since
|
|||||||
push parsers are measurably slower.
|
push parsers are measurably slower.
|
||||||
|
|
||||||
** %define parse.error formatted
|
** %define parse.error formatted
|
||||||
How about pushing bistromathics' yyreport_syntax_error as another standard
|
How about pushing Bistromathic's yyreport_syntax_error as another standard
|
||||||
way to generate the error message, and leave to the user the task of
|
way to generate the error message, and leave to the user the task of
|
||||||
providing the message formats? Currently in bistro, it reads:
|
providing the message formats? Currently in bistro, it reads:
|
||||||
|
|
||||||
@@ -148,6 +158,9 @@ Les catégories d'avertissements incluent :
|
|||||||
Line -1 and -3 should mention CATEGORIE, not CATEGORY.
|
Line -1 and -3 should mention CATEGORIE, not CATEGORY.
|
||||||
|
|
||||||
* Bison 3.8
|
* Bison 3.8
|
||||||
|
** Rewrite glr.cc
|
||||||
|
Get rid of scaffolding in glr.c.
|
||||||
|
|
||||||
** Unit rules / Injection rules (Akim Demaille)
|
** Unit rules / Injection rules (Akim Demaille)
|
||||||
Maybe we could expand unit rules (or "injections", see
|
Maybe we could expand unit rules (or "injections", see
|
||||||
https://homepages.cwi.nl/~daybuild/daily-books/syntax/2-sdf/sdf.html), i.e.,
|
https://homepages.cwi.nl/~daybuild/daily-books/syntax/2-sdf/sdf.html), i.e.,
|
||||||
@@ -190,18 +203,282 @@ 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
|
* Better error messages
|
||||||
The users are not provided with enough tools to forge their error messages.
|
The users are not provided with enough tools to forge their error messages.
|
||||||
See for instance "Is there an option to change the message produced by
|
See for instance "Is there an option to change the message produced by
|
||||||
@@ -219,7 +496,7 @@ and older C++ compilers. Currently the code defaults to defining it to
|
|||||||
define it to the same type as the C ptrdiff_t type.
|
define it to the same type as the C ptrdiff_t type.
|
||||||
|
|
||||||
* Completion
|
* Completion
|
||||||
Several features are not available in all the backends.
|
Several features are not available in all the back-ends.
|
||||||
|
|
||||||
- lac: D, Java (easy)
|
- lac: D, Java (easy)
|
||||||
- push parsers: glr.c, glr.cc, lalr1.cc (not very difficult)
|
- push parsers: glr.c, glr.cc, lalr1.cc (not very difficult)
|
||||||
@@ -289,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?
|
||||||
@@ -414,16 +691,6 @@ undocumented ''features''. Maybe an empty action ought to be
|
|||||||
presented too. Shall we try to make a single grammar with all these
|
presented too. Shall we try to make a single grammar with all these
|
||||||
features, or should we have several very small grammars?
|
features, or should we have several very small grammars?
|
||||||
|
|
||||||
** --report=conflict-path
|
|
||||||
Provide better assistance for understanding the conflicts by providing
|
|
||||||
a sample text exhibiting the (LALR) ambiguity. See the paper from
|
|
||||||
DeRemer and Penello: they already provide the algorithm.
|
|
||||||
|
|
||||||
** Statically check for potential ambiguities in GLR grammars
|
|
||||||
See <http://www.lsv.fr/~schmitz/pub/expamb.pdf> for an approach.
|
|
||||||
An Experimental Ambiguity Detection Tool ∗ Sylvain Schmitz
|
|
||||||
LORIA, INRIA Nancy - Grand Est, Nancy, France
|
|
||||||
|
|
||||||
* Extensions
|
* Extensions
|
||||||
** More languages?
|
** More languages?
|
||||||
Well, only if there is really some demand for it.
|
Well, only if there is really some demand for it.
|
||||||
@@ -514,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:
|
||||||
|
|
||||||
@@ -584,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/>.
|
|
||||||
|
|||||||
+8
-4
@@ -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
|
||||||
@@ -17,7 +17,7 @@
|
|||||||
|
|
||||||
# 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,14 +38,17 @@ gnulib_modules='
|
|||||||
obstack-printf
|
obstack-printf
|
||||||
perror progname
|
perror progname
|
||||||
quote quotearg
|
quote quotearg
|
||||||
|
rbtreehash-list
|
||||||
readline
|
readline
|
||||||
readme-release
|
readme-release
|
||||||
realloc-posix
|
realloc-posix
|
||||||
relocatable-prog relocatable-script
|
relocatable-prog relocatable-script
|
||||||
rename
|
rename
|
||||||
spawn-pipe stdbool stpcpy strdup-posix strerror strverscmp
|
spawn-pipe stdbool stpcpy stpncpy strdup-posix strerror strverscmp
|
||||||
|
sys_ioctl
|
||||||
|
termios
|
||||||
timevar
|
timevar
|
||||||
unistd unistd-safer unlink unlocked-io
|
unicodeio unistd unistd-safer unlink unlocked-io
|
||||||
update-copyright unsetenv verify
|
update-copyright unsetenv verify
|
||||||
warnings
|
warnings
|
||||||
winsz-ioctl
|
winsz-ioctl
|
||||||
|
|||||||
@@ -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
|
||||||
|
|||||||
@@ -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
|
||||||
|
|||||||
@@ -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
|
||||||
|
|||||||
+1
-1
@@ -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
|
||||||
|
|||||||
@@ -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
|
||||||
|
|||||||
@@ -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
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
# Update expectations in an Autotest test suite.
|
# Update expectations in an Autotest test suite.
|
||||||
|
|
||||||
# Copyright (C) 2019-2020 Free Software Foundation, Inc.
|
# Copyright (C) 2019-2021 Free Software Foundation, Inc.
|
||||||
#
|
#
|
||||||
# This program is free software: you can redistribute it and/or modify
|
# This program is free software: you can redistribute it and/or modify
|
||||||
# it under the terms of the GNU General Public License as published by
|
# it under the terms of the GNU General Public License as published by
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
## Customize maint.mk -*- makefile -*-
|
## Customize maint.mk -*- makefile -*-
|
||||||
## Copyright (C) 2008-2015, 2018-2020 Free Software Foundation, Inc.
|
## Copyright (C) 2008-2015, 2018-2021 Free Software Foundation, Inc.
|
||||||
|
|
||||||
## This program is free software: you can redistribute it and/or modify
|
## This program is free software: you can redistribute it and/or modify
|
||||||
## it under the terms of the GNU General Public License as published by
|
## it under the terms of the GNU General Public License as published by
|
||||||
@@ -126,7 +126,7 @@ _sed_rm_comments_q = $(subst ','\'',$(_sed_remove_comments))
|
|||||||
|
|
||||||
_space_before_paren_exempt =? \\n\\$$
|
_space_before_paren_exempt =? \\n\\$$
|
||||||
_space_before_paren_exempt = \
|
_space_before_paren_exempt = \
|
||||||
(^ *\#|(LA)?LR\([01]\)|percent_(code|define)|b4_syncline|m4_(define|init)|symbol)
|
(^ *\#|(LA)?LR\([01]\)|percent_(code|define)|b4_syncline|m4_(define|init))
|
||||||
# Ensure that there is a space before each open parenthesis in C code.
|
# Ensure that there is a space before each open parenthesis in C code.
|
||||||
sc_space_before_open_paren:
|
sc_space_before_open_paren:
|
||||||
@if $(VC_LIST_EXCEPT) | grep -l '\.[ch]$$' > /dev/null; then \
|
@if $(VC_LIST_EXCEPT) | grep -l '\.[ch]$$' > /dev/null; then \
|
||||||
@@ -156,6 +156,8 @@ exclude = \
|
|||||||
$(call exclude, \
|
$(call exclude, \
|
||||||
bindtextdomain=^lib/main.c$$ \
|
bindtextdomain=^lib/main.c$$ \
|
||||||
cast_of_argument_to_free=^src/muscle-tab.c$$ \
|
cast_of_argument_to_free=^src/muscle-tab.c$$ \
|
||||||
|
copyright_check=gnulib/lib/version-etc.c$$ \
|
||||||
|
error_message_uppercase=etc/bench.pl.in$$ \
|
||||||
po_check=^tests|(^po/POTFILES.in|.md)$$ \
|
po_check=^tests|(^po/POTFILES.in|.md)$$ \
|
||||||
preprocessor_indentation=^data/|^lib/|^src/parse-gram.[ch]$$ \
|
preprocessor_indentation=^data/|^lib/|^src/parse-gram.[ch]$$ \
|
||||||
program_name=^lib/main.c$$ \
|
program_name=^lib/main.c$$ \
|
||||||
|
|||||||
+9
-4
@@ -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
|
||||||
@@ -29,7 +29,7 @@ AC_INIT([GNU Bison],
|
|||||||
[[email protected]],
|
[[email protected]],
|
||||||
[],
|
[],
|
||||||
[https://www.gnu.org/software/bison/])
|
[https://www.gnu.org/software/bison/])
|
||||||
AC_SUBST([PACKAGE_COPYRIGHT_YEAR], [2020])
|
AC_SUBST([PACKAGE_COPYRIGHT_YEAR], [2021])
|
||||||
AC_DEFINE_UNQUOTED([PACKAGE_COPYRIGHT_YEAR], [$PACKAGE_COPYRIGHT_YEAR],
|
AC_DEFINE_UNQUOTED([PACKAGE_COPYRIGHT_YEAR], [$PACKAGE_COPYRIGHT_YEAR],
|
||||||
[The copyright year for this package])
|
[The copyright year for this package])
|
||||||
|
|
||||||
@@ -60,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],
|
||||||
@@ -132,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.
|
||||||
|
|||||||
+32
-18
@@ -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
|
||||||
@@ -84,29 +84,35 @@ 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
|
- `id`: string (e.g., `exp`, `NUM`, or `TOK_NUM` with api.token.prefix)
|
||||||
If has_id, the id (prefixed by api.token.prefix if defined), otherwise
|
If `has_id`, the name of the token kind (prefixed by api.token.prefix if
|
||||||
defined as empty. Guaranteed to be usable as a C identifier. This is
|
defined), otherwise empty. Guaranteed to be usable as a C identifier.
|
||||||
used to define the token kind (i.e., the enum used by the return value of
|
This is used to define the token kind (i.e., the enum used by the return
|
||||||
yylex).
|
value of yylex). Should be named `token_kind`.
|
||||||
|
|
||||||
- `tag`: string
|
- `tag`: string
|
||||||
A human representation of the symbol. Can be 'foo', 'foo.id', '"foo"' etc.
|
A human readable representation of the symbol. Can be `'foo'`,
|
||||||
|
`'foo.id'`, `'"foo"'` etc.
|
||||||
|
|
||||||
- `user_number`: integer
|
- `code`: integer
|
||||||
The code associated to the `id`.
|
The token code associated to the token kind `id`.
|
||||||
The external number as used by yylex. Can be ASCII code when a character,
|
The external number as used by yylex. Can be ASCII code when a character,
|
||||||
some number chosen by bison, or some user number in the case of
|
some number chosen by bison, or some user number in the case of `%token
|
||||||
%token FOO <NUM>. Corresponds to yychar in yacc.c.
|
FOO <NUM>`. Corresponds to `yychar` in `yacc.c`.
|
||||||
|
|
||||||
- `is_token`: 0 or 1
|
- `is_token`: 0 or 1
|
||||||
Whether this is a terminal symbol.
|
Whether this is a terminal symbol.
|
||||||
|
|
||||||
|
- `kind_base`: string (e.g., `YYSYMBOL_exp`, `YYSYMBOL_NUM`)
|
||||||
|
The base of the symbol kind, i.e., the enumerator of this symbol (token or
|
||||||
|
nonterminal) which is mapped to its `number`.
|
||||||
|
|
||||||
- `kind`: string
|
- `kind`: string
|
||||||
The symbol kind, i.e., the enumerator of this symbol (token or nonterminal)
|
Same as `kind_base`, but possibly with a prefix in some languages. E.g.,
|
||||||
which is mapping to its `number`.
|
EOF's `kind_base` and `kind` are `YYSYMBOL_YYEOF` in C, but are
|
||||||
|
`S_YYEMPTY` and `symbol_kind::S_YYEMPTY` in C++.
|
||||||
|
|
||||||
- `number`: integer
|
- `number`: integer
|
||||||
The code associated to the `kind`.
|
The code associated to the `kind`.
|
||||||
@@ -136,11 +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
|
||||||
@@ -173,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
|
||||||
@@ -181,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.
|
||||||
|
|
||||||
@@ -197,3 +209,5 @@ 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 <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
-->
|
||||||
|
|||||||
+28
-1
@@ -1,5 +1,5 @@
|
|||||||
/* Default styling rules for Bison when doing terminal output.
|
/* Default styling rules for Bison when doing terminal output.
|
||||||
Copyright (C) 2019-2020 Free Software Foundation, Inc.
|
Copyright (C) 2019-2021 Free Software Foundation, Inc.
|
||||||
|
|
||||||
This program is free software: you can redistribute it and/or modify
|
This program is free software: you can redistribute it and/or modify
|
||||||
it under the terms of the GNU General Public License as published by
|
it under the terms of the GNU General Public License as published by
|
||||||
@@ -30,5 +30,32 @@
|
|||||||
/* "Sections" in traces (--trace). */
|
/* "Sections" in traces (--trace). */
|
||||||
.trace0 { color: green; }
|
.trace0 { color: green; }
|
||||||
|
|
||||||
|
/* Syntax error messages. */
|
||||||
.expected { color: green; }
|
.expected { color: green; }
|
||||||
.unexpected { color: red; }
|
.unexpected { color: red; }
|
||||||
|
|
||||||
|
|
||||||
|
/* Counterexamples. */
|
||||||
|
|
||||||
|
/* Cex: point in rule. */
|
||||||
|
.cex-dot { color: red; }
|
||||||
|
|
||||||
|
/* Cex: coloring various rules. */
|
||||||
|
.cex-0 { color: yellow; }
|
||||||
|
.cex-1 { color: green; }
|
||||||
|
.cex-2 { color: blue; }
|
||||||
|
.cex-3 { color: purple; }
|
||||||
|
.cex-4 { color: violet; }
|
||||||
|
.cex-5 { color: orange; }
|
||||||
|
.cex-6 { color: brown; }
|
||||||
|
.cex-7 { color: mauve; }
|
||||||
|
.cex-8 { color: #013220; } /* Dark green. */
|
||||||
|
.cex-9 { color: #e75480; } /* Dark pink. */
|
||||||
|
.cex-10 { color: cyan; }
|
||||||
|
.cex-11 { color: orange; }
|
||||||
|
|
||||||
|
/* Cex: derivation rewriting steps. */
|
||||||
|
.cex-step { font-style: italic; }
|
||||||
|
|
||||||
|
/* Cex: leaves of a derivation. */
|
||||||
|
.cex-leaf { font-weight: 600; }
|
||||||
|
|||||||
+2
-1
@@ -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
|
||||||
@@ -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
|
||||||
|
|
||||||
|
|||||||
+61
-16
@@ -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
|
||||||
@@ -19,6 +19,29 @@
|
|||||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# m4_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($@))))])
|
||||||
|
|
||||||
|
|
||||||
## ---------------- ##
|
## ---------------- ##
|
||||||
## Identification. ##
|
## Identification. ##
|
||||||
## ---------------- ##
|
## ---------------- ##
|
||||||
@@ -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])
|
||||||
@@ -162,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], ...)
|
||||||
@@ -415,14 +438,14 @@ m4_define([b4_symbol_token_kind],
|
|||||||
_b4_symbol([$1], [id])])
|
_b4_symbol([$1], [id])])
|
||||||
|
|
||||||
|
|
||||||
# b4_symbol_kind(NUM)
|
# b4_symbol_kind_base(NUM)
|
||||||
# -------------------
|
# ------------------------
|
||||||
# Build the name of the kind of this symbol. It must always exist,
|
# Build the name of the kind of this symbol. It must always exist,
|
||||||
# otherwise some symbols might not be represented in the enum, which
|
# otherwise some symbols might not be represented in the enum, which
|
||||||
# might be compiled into too small a type to contain all the symbol
|
# might be compiled into too small a type to contain all the symbol
|
||||||
# numbers.
|
# numbers.
|
||||||
m4_define([b4_symbol_prefix], [b4_percent_define_get([api.symbol.prefix])])
|
m4_define([b4_symbol_prefix], [b4_percent_define_get([api.symbol.prefix])])
|
||||||
m4_define([b4_symbol_kind],
|
m4_define([b4_symbol_kind_base],
|
||||||
[b4_percent_define_get([api.symbol.prefix])dnl
|
[b4_percent_define_get([api.symbol.prefix])dnl
|
||||||
m4_case([$1],
|
m4_case([$1],
|
||||||
[-2], [[YYEMPTY]],
|
[-2], [[YYEMPTY]],
|
||||||
@@ -435,6 +458,26 @@ m4_case([$1],
|
|||||||
[m4_bpatsubst([$1-][]_b4_symbol([$1], [tag]), [[^a-zA-Z_0-9]+], [_])])])])])
|
[m4_bpatsubst([$1-][]_b4_symbol([$1], [tag]), [[^a-zA-Z_0-9]+], [_])])])])])
|
||||||
|
|
||||||
|
|
||||||
|
# b4_symbol_kind(NUM)
|
||||||
|
# -------------------
|
||||||
|
# Same as b4_symbol_kind, but possibly with a prefix in some
|
||||||
|
# languages. E.g., EOF's kind_base and kind are YYSYMBOL_YYEOF in C,
|
||||||
|
# but are S_YYEMPTY and symbol_kind::S_YYEMPTY in C++.
|
||||||
|
m4_copy([b4_symbol_kind_base], [b4_symbol_kind])
|
||||||
|
|
||||||
|
|
||||||
|
# b4_symbol_slot(NUM)
|
||||||
|
# -------------------
|
||||||
|
# The name of union member that contains the value of these symbols.
|
||||||
|
# Currently, we are messy, this should actually be type_tag, but type_tag
|
||||||
|
# has several meanings.
|
||||||
|
m4_define([b4_symbol_slot],
|
||||||
|
[m4_case(b4_percent_define_get([[api.value.type]]),
|
||||||
|
[union], [b4_symbol([$1], [type_tag])],
|
||||||
|
[variant], [b4_symbol([$1], [type_tag])],
|
||||||
|
[b4_symbol([$1], [type])])])
|
||||||
|
|
||||||
|
|
||||||
# b4_symbol(NUM, FIELD)
|
# b4_symbol(NUM, FIELD)
|
||||||
# ---------------------
|
# ---------------------
|
||||||
# Fetch FIELD of symbol #NUM (or "orig NUM"). Fail if undefined.
|
# Fetch FIELD of symbol #NUM (or "orig NUM"). Fail if undefined.
|
||||||
@@ -442,8 +485,10 @@ m4_case([$1],
|
|||||||
# 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], [b4_symbol_token_kind([$1])],
|
[id], [b4_symbol_token_kind([$1])],
|
||||||
[kind], [b4_symbol_kind([$1])],
|
[kind_base], [b4_symbol_kind_base([$1])],
|
||||||
|
[kind], [b4_symbol_kind([$1])],
|
||||||
|
[slot], [b4_symbol_slot([$1])],
|
||||||
[_b4_symbol($@)])])
|
[_b4_symbol($@)])])
|
||||||
|
|
||||||
|
|
||||||
@@ -506,7 +551,7 @@ m4_defn([b4_actions_])[]dnl
|
|||||||
break;
|
break;
|
||||||
}dnl
|
}dnl
|
||||||
],
|
],
|
||||||
[YYUSE (m4_default([$2], [yykind]));])dnl
|
[YY_USE (m4_default([$2], [yykind]));])dnl
|
||||||
m4_popdef([b4_actions_])dnl
|
m4_popdef([b4_actions_])dnl
|
||||||
])
|
])
|
||||||
|
|
||||||
@@ -516,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])])
|
||||||
])
|
])
|
||||||
|
|
||||||
|
|
||||||
@@ -564,8 +609,8 @@ m4_define([b4_any_token_visible_if],
|
|||||||
m4_define([b4_token_format],
|
m4_define([b4_token_format],
|
||||||
[b4_token_visible_if([$2],
|
[b4_token_visible_if([$2],
|
||||||
[m4_format([[$1]],
|
[m4_format([[$1]],
|
||||||
m4_expand(b4_symbol([$2], [id])),
|
b4_symbol([$2], [id]),
|
||||||
m4_expand(b4_symbol([$2], b4_api_token_raw_if([[number]], [[user_number]]))))])])
|
b4_symbol([$2], b4_api_token_raw_if([[number]], [[code]])))])])
|
||||||
|
|
||||||
|
|
||||||
# b4_last_enum_token
|
# b4_last_enum_token
|
||||||
@@ -602,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]))])
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -727,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]],
|
||||||
|
|||||||
@@ -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
|
||||||
|
|||||||
+15
-13
@@ -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
|
||||||
@@ -105,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]))
|
||||||
|
|
||||||
@@ -193,7 +193,7 @@ m4_define([b4_declare_symbol_enum],
|
|||||||
[[enum symbol_kind_type
|
[[enum symbol_kind_type
|
||||||
{
|
{
|
||||||
YYNTOKENS = ]b4_tokens_number[, ///< Number of tokens.
|
YYNTOKENS = ]b4_tokens_number[, ///< Number of tokens.
|
||||||
]b4_symbol_kind([-2])[ = -2,
|
]b4_symbol(-2, kind_base)[ = -2,
|
||||||
]b4_symbol_foreach([ b4_symbol_enum])dnl
|
]b4_symbol_foreach([ b4_symbol_enum])dnl
|
||||||
[ };]])
|
[ };]])
|
||||||
|
|
||||||
@@ -321,8 +321,9 @@ m4_define([b4_symbol_type_define],
|
|||||||
/// Copy constructor.
|
/// Copy constructor.
|
||||||
basic_symbol (const basic_symbol& that);]b4_variant_if([[
|
basic_symbol (const basic_symbol& that);]b4_variant_if([[
|
||||||
|
|
||||||
/// Constructor for valueless symbols, and symbols from each type.
|
/// Constructors for typed symbols.
|
||||||
]b4_type_foreach([b4_basic_symbol_constructor_define])], [[
|
]b4_type_foreach([b4_basic_symbol_constructor_define], [
|
||||||
|
])], [[
|
||||||
/// Constructor for valueless symbols.
|
/// Constructor for valueless symbols.
|
||||||
basic_symbol (typename Base::kind_type t]b4_locations_if([,
|
basic_symbol (typename Base::kind_type t]b4_locations_if([,
|
||||||
YY_MOVE_REF (location_type) l])[);
|
YY_MOVE_REF (location_type) l])[);
|
||||||
@@ -339,7 +340,7 @@ m4_define([b4_symbol_type_define],
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Destroy contents, and record that is empty.
|
/// Destroy contents, and record that is empty.
|
||||||
void clear ()
|
void clear () YY_NOEXCEPT
|
||||||
{]b4_variant_if([[
|
{]b4_variant_if([[
|
||||||
// User destructor.
|
// User destructor.
|
||||||
symbol_kind_type yykind = this->kind ();
|
symbol_kind_type yykind = this->kind ();
|
||||||
@@ -423,7 +424,7 @@ m4_define([b4_symbol_type_define],
|
|||||||
by_kind (kind_type t);
|
by_kind (kind_type t);
|
||||||
|
|
||||||
/// Record that this symbol is empty.
|
/// Record that this symbol is empty.
|
||||||
void clear ();
|
void clear () YY_NOEXCEPT;
|
||||||
|
|
||||||
/// Steal the symbol kind from \a that.
|
/// Steal the symbol kind from \a that.
|
||||||
void move (by_kind& that);
|
void move (by_kind& that);
|
||||||
@@ -507,7 +508,7 @@ m4_define([b4_public_types_define],
|
|||||||
bool
|
bool
|
||||||
]b4_parser_class[::basic_symbol<Base>::empty () const YY_NOEXCEPT
|
]b4_parser_class[::basic_symbol<Base>::empty () const YY_NOEXCEPT
|
||||||
{
|
{
|
||||||
return this->kind () == symbol_kind::]b4_symbol_prefix[YYEMPTY;
|
return this->kind () == ]b4_symbol(-2, kind)[;
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename Base>
|
template <typename Base>
|
||||||
@@ -523,7 +524,7 @@ m4_define([b4_public_types_define],
|
|||||||
|
|
||||||
// by_kind.
|
// by_kind.
|
||||||
]b4_inline([$1])b4_parser_class[::by_kind::by_kind ()
|
]b4_inline([$1])b4_parser_class[::by_kind::by_kind ()
|
||||||
: kind_ (symbol_kind::]b4_symbol_prefix[YYEMPTY)
|
: kind_ (]b4_symbol(-2, kind)[)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
#if 201103L <= YY_CPLUSPLUS
|
#if 201103L <= YY_CPLUSPLUS
|
||||||
@@ -543,9 +544,9 @@ m4_define([b4_public_types_define],
|
|||||||
{}
|
{}
|
||||||
|
|
||||||
]b4_inline([$1])[void
|
]b4_inline([$1])[void
|
||||||
]b4_parser_class[::by_kind::clear ()
|
]b4_parser_class[::by_kind::clear () YY_NOEXCEPT
|
||||||
{
|
{
|
||||||
kind_ = symbol_kind::]b4_symbol_prefix[YYEMPTY;
|
kind_ = ]b4_symbol(-2, kind)[;
|
||||||
}
|
}
|
||||||
|
|
||||||
]b4_inline([$1])[void
|
]b4_inline([$1])[void
|
||||||
@@ -594,11 +595,12 @@ m4_define([b4_yytranslate_define],
|
|||||||
{
|
{
|
||||||
]b4_translate[
|
]b4_translate[
|
||||||
};
|
};
|
||||||
const int user_token_number_max_ = ]b4_user_token_number_max[;
|
// Last valid token kind.
|
||||||
|
const int code_max = ]b4_code_max[;
|
||||||
|
|
||||||
if (t <= 0)
|
if (t <= 0)
|
||||||
return symbol_kind::]b4_symbol_prefix[YYEOF;
|
return symbol_kind::]b4_symbol_prefix[YYEOF;
|
||||||
else if (t <= user_token_number_max_)
|
else if (t <= code_max)
|
||||||
return YY_CAST (symbol_kind_type, translate_table[t]);
|
return YY_CAST (symbol_kind_type, translate_table[t]);
|
||||||
else
|
else
|
||||||
return symbol_kind::]b4_symbol_prefix[YYUNDEF;]])[
|
return symbol_kind::]b4_symbol_prefix[YYUNDEF;]])[
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
# Common code for C-like languages (C, C++, Java, etc.)
|
# Common code for C-like languages (C, C++, Java, etc.)
|
||||||
|
|
||||||
# Copyright (C) 2012-2015, 2018-2020 Free Software Foundation, Inc.
|
# Copyright (C) 2012-2015, 2018-2021 Free Software Foundation, Inc.
|
||||||
|
|
||||||
# This program is free software: you can redistribute it and/or modify
|
# This program is free software: you can redistribute it and/or modify
|
||||||
# it under the terms of the GNU General Public License as published by
|
# it under the terms of the GNU General Public License as published by
|
||||||
@@ -17,6 +17,7 @@
|
|||||||
# You should have received a copy of the GNU General Public License
|
# You should have received a copy of the GNU General Public License
|
||||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
|
||||||
# _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.
|
||||||
@@ -27,9 +28,10 @@
|
|||||||
#
|
#
|
||||||
# Prefix all the output lines with PREFIX.
|
# Prefix all the output lines with PREFIX.
|
||||||
m4_define([_b4_comment],
|
m4_define([_b4_comment],
|
||||||
[$2[]m4_bpatsubsts(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
|
||||||
|
|||||||
+47
-24
@@ -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
|
||||||
@@ -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], [[
|
||||||
@@ -160,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
|
||||||
])
|
])
|
||||||
|
|
||||||
@@ -242,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 \
|
||||||
@@ -355,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)
|
||||||
@@ -376,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__
|
||||||
@@ -501,10 +523,11 @@ m4_define([b4_token_define],
|
|||||||
# ----------------
|
# ----------------
|
||||||
# Output the definition of the tokens.
|
# Output the definition of the tokens.
|
||||||
m4_define([b4_token_defines],
|
m4_define([b4_token_defines],
|
||||||
[b4_any_token_visible_if([/* Token kinds. */
|
[[/* Token kinds. */
|
||||||
m4_join([
|
#define ]b4_symbol([-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)
|
||||||
@@ -515,7 +538,7 @@ m4_define([b4_token_enum],
|
|||||||
[m4_format([ %-30s %s],
|
[m4_format([ %-30s %s],
|
||||||
m4_format([[%s = %s%s%s]],
|
m4_format([[%s = %s%s%s]],
|
||||||
b4_symbol([$1], [id]),
|
b4_symbol([$1], [id]),
|
||||||
b4_symbol([$1], b4_api_token_raw_if([[number]], [[user_number]])),
|
b4_symbol([$1], b4_api_token_raw_if([[number]], [[code]])),
|
||||||
m4_if([$1], b4_last_enum_token, [], [[,]])),
|
m4_if([$1], b4_last_enum_token, [], [[,]])),
|
||||||
[b4_symbol_tag_comment([$1])])])])
|
[b4_symbol_tag_comment([$1])])])])
|
||||||
|
|
||||||
@@ -564,7 +587,7 @@ m4_define([b4_symbol_translate],
|
|||||||
m4_define([b4_symbol_enum],
|
m4_define([b4_symbol_enum],
|
||||||
[m4_format([ %-40s %s],
|
[m4_format([ %-40s %s],
|
||||||
m4_format([[%s = %s%s%s]],
|
m4_format([[%s = %s%s%s]],
|
||||||
b4_symbol([$1], [kind]),
|
b4_symbol([$1], [kind_base]),
|
||||||
[$1],
|
[$1],
|
||||||
m4_if([$1], b4_last_symbol, [], [[,]])),
|
m4_if([$1], b4_last_symbol, [], [[,]])),
|
||||||
[b4_symbol_tag_comment([$1])])])
|
[b4_symbol_tag_comment([$1])])])
|
||||||
@@ -579,7 +602,7 @@ m4_define([b4_declare_symbol_enum],
|
|||||||
[[/* Symbol kind. */
|
[[/* Symbol kind. */
|
||||||
enum yysymbol_kind_t
|
enum yysymbol_kind_t
|
||||||
{
|
{
|
||||||
]b4_symbol_kind([-2])[ = -2,
|
]b4_symbol([-2], kind_base)[ = -2,
|
||||||
]b4_symbol_foreach([b4_symbol_enum])dnl
|
]b4_symbol_foreach([b4_symbol_enum])dnl
|
||||||
[};
|
[};
|
||||||
typedef enum yysymbol_kind_t yysymbol_kind_t;
|
typedef enum yysymbol_kind_t yysymbol_kind_t;
|
||||||
@@ -658,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;])
|
||||||
|
|||||||
@@ -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
|
||||||
|
|||||||
+17
-10
@@ -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
|
||||||
@@ -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[;
|
||||||
])
|
]])
|
||||||
|
|
||||||
|
|
||||||
## ------------ ##
|
## ------------ ##
|
||||||
@@ -152,6 +152,8 @@ private static immutable b4_int_type_for([$2])[[]] yy$1_ =
|
|||||||
## Token kinds. ##
|
## Token kinds. ##
|
||||||
## ------------- ##
|
## ------------- ##
|
||||||
|
|
||||||
|
m4_define([b4_symbol(-2, id)], [[YYEMPTY]])
|
||||||
|
|
||||||
# b4_token_enum(TOKEN-NAME, TOKEN-NUMBER)
|
# b4_token_enum(TOKEN-NAME, TOKEN-NUMBER)
|
||||||
# ---------------------------------------
|
# ---------------------------------------
|
||||||
# Output the definition of this token as an enum.
|
# Output the definition of this token as an enum.
|
||||||
@@ -178,6 +180,11 @@ b4_symbol_foreach([b4_token_enum])dnl
|
|||||||
|
|
||||||
b4_percent_define_default([[api.symbol.prefix]], [[S_]])
|
b4_percent_define_default([[api.symbol.prefix]], [[S_]])
|
||||||
|
|
||||||
|
# b4_symbol_kind(NUM)
|
||||||
|
# -------------------
|
||||||
|
m4_define([b4_symbol_kind],
|
||||||
|
[SymbolKind.b4_symbol_kind_base($@)])
|
||||||
|
|
||||||
|
|
||||||
# b4_symbol_enum(SYMBOL-NUM)
|
# b4_symbol_enum(SYMBOL-NUM)
|
||||||
# --------------------------
|
# --------------------------
|
||||||
@@ -185,7 +192,7 @@ b4_percent_define_default([[api.symbol.prefix]], [[S_]])
|
|||||||
m4_define([b4_symbol_enum],
|
m4_define([b4_symbol_enum],
|
||||||
[m4_format([ %-30s %s],
|
[m4_format([ %-30s %s],
|
||||||
m4_format([[%s = %s,]],
|
m4_format([[%s = %s,]],
|
||||||
b4_symbol([$1], [kind]),
|
b4_symbol([$1], [kind_base]),
|
||||||
[$1]),
|
[$1]),
|
||||||
[b4_symbol_tag_comment([$1])])])
|
[b4_symbol_tag_comment([$1])])])
|
||||||
|
|
||||||
@@ -199,16 +206,16 @@ m4_define([b4_declare_symbol_enum],
|
|||||||
[[ /* Symbol kinds. */
|
[[ /* Symbol kinds. */
|
||||||
public enum SymbolKind
|
public enum SymbolKind
|
||||||
{
|
{
|
||||||
]b4_symbol_kind([-2])[ = -2, /* No symbol. */
|
]b4_symbol(-2, kind_base)[ = -2, /* No symbol. */
|
||||||
]b4_symbol_foreach([b4_symbol_enum])dnl
|
]b4_symbol_foreach([b4_symbol_enum])dnl
|
||||||
[ };
|
[ };
|
||||||
]])])
|
]])])
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# b4-case(ID, CODE)
|
# b4-case(ID, CODE, [COMMENTS])
|
||||||
# -----------------
|
# -----------------------------
|
||||||
m4_define([b4_case], [ case $1:
|
m4_define([b4_case], [ case $1:m4_ifval([$3], [ b4_comment([$3])])
|
||||||
$2
|
$2
|
||||||
break;])
|
break;])
|
||||||
|
|
||||||
|
|||||||
+32
-20
@@ -1,8 +1,8 @@
|
|||||||
-*- C -*-
|
# -*- C -*-
|
||||||
|
|
||||||
# GLR skeleton for Bison
|
# GLR skeleton for Bison
|
||||||
|
|
||||||
# Copyright (C) 2002-2015, 2018-2020 Free Software Foundation, Inc.
|
# Copyright (C) 2002-2015, 2018-2021 Free Software Foundation, Inc.
|
||||||
|
|
||||||
# This program is free software: you can redistribute it and/or modify
|
# This program is free software: you can redistribute it and/or modify
|
||||||
# it under the terms of the GNU General Public License as published by
|
# it under the terms of the GNU General Public License as published by
|
||||||
@@ -145,6 +145,15 @@ m4_define([b4_rhs_location],
|
|||||||
[(b4_rhs_data([$1], [$2]).yyloc)])
|
[(b4_rhs_data([$1], [$2]).yyloc)])
|
||||||
|
|
||||||
|
|
||||||
|
# b4_call_merger(MERGER-NUM, MERGER-NAME, SYMBOL-SUM)
|
||||||
|
# ---------------------------------------------------
|
||||||
|
m4_define([b4_call_merger],
|
||||||
|
[b4_case([$1],
|
||||||
|
[ b4_symbol_if([$3], [has_type],
|
||||||
|
[yy0->b4_symbol($3, slot) = $2 (*yy0, *yy1);],
|
||||||
|
[*yy0 = $2 (*yy0, *yy1);])])])
|
||||||
|
|
||||||
|
|
||||||
## -------------- ##
|
## -------------- ##
|
||||||
## Declarations. ##
|
## Declarations. ##
|
||||||
## -------------- ##
|
## -------------- ##
|
||||||
@@ -188,10 +197,10 @@ b4_glr_cc_if([],
|
|||||||
[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])[
|
||||||
]b4_cpp_guard_open([b4_spec_header_file])[
|
]b4_cpp_guard_open([b4_spec_mapped_header_file])[
|
||||||
]b4_shared_declarations[
|
]b4_shared_declarations[
|
||||||
]b4_cpp_guard_close([b4_spec_header_file])[
|
]b4_cpp_guard_close([b4_spec_mapped_header_file])[
|
||||||
]b4_output_end[
|
]b4_output_end[
|
||||||
]])])
|
]])])
|
||||||
|
|
||||||
@@ -202,7 +211,7 @@ b4_copyright([Skeleton interface for Bison GLR parsers in C],
|
|||||||
|
|
||||||
b4_output_begin([b4_parser_file_name])
|
b4_output_begin([b4_parser_file_name])
|
||||||
b4_copyright([Skeleton implementation for Bison GLR parsers in C],
|
b4_copyright([Skeleton implementation for Bison GLR parsers in C],
|
||||||
[2002-2015, 2018-2020])[
|
[2002-2015, 2018-2021])[
|
||||||
/* C GLR parser skeleton written by Paul Hilfinger. */
|
/* C GLR parser skeleton written by Paul Hilfinger. */
|
||||||
|
|
||||||
]b4_disclaimer[
|
]b4_disclaimer[
|
||||||
@@ -215,7 +224,7 @@ b4_copyright([Skeleton implementation for Bison GLR parsers in C],
|
|||||||
#define YYLTYPE ]b4_api_PREFIX[LTYPE]])])[
|
#define YYLTYPE ]b4_api_PREFIX[LTYPE]])])[
|
||||||
]m4_if(b4_prefix, [yy], [],
|
]m4_if(b4_prefix, [yy], [],
|
||||||
[[/* Substitute the variable and function names. */
|
[[/* Substitute the variable and function names. */
|
||||||
#define yyparse ]b4_prefix[parse
|
#define ]b4_glr_cc_if([yy_parse_impl], [yyparse])[ ]b4_prefix[]b4_glr_cc_if([_parse_impl], [parse])[
|
||||||
#define yylex ]b4_prefix[lex
|
#define yylex ]b4_prefix[lex
|
||||||
#define yyerror ]b4_prefix[error
|
#define yyerror ]b4_prefix[error
|
||||||
#define yydebug ]b4_prefix[debug]]b4_pure_if([], [[
|
#define yydebug ]b4_prefix[debug]]b4_pure_if([], [[
|
||||||
@@ -230,7 +239,9 @@ b4_copyright([Skeleton implementation for Bison GLR parsers in C],
|
|||||||
|
|
||||||
]b4_defines_if([[#include "@basename(]b4_spec_header_file[@)"]],
|
]b4_defines_if([[#include "@basename(]b4_spec_header_file[@)"]],
|
||||||
[b4_shared_declarations])[
|
[b4_shared_declarations])[
|
||||||
]b4_declare_symbol_enum[
|
|
||||||
|
]b4_glr_cc_if([b4_glr_cc_setup],
|
||||||
|
[b4_declare_symbol_enum])[
|
||||||
|
|
||||||
/* Default (constant) value used for initialization for null
|
/* Default (constant) value used for initialization for null
|
||||||
right-hand sides. Unlike the standard yacc.c template, here we set
|
right-hand sides. Unlike the standard yacc.c template, here we set
|
||||||
@@ -331,8 +342,8 @@ static YYLTYPE yyloc_default][]b4_yyloc_default;])[
|
|||||||
accessed by $0, $-1, etc., in any rule. */
|
accessed by $0, $-1, etc., in any rule. */
|
||||||
#define YYMAXLEFT ]b4_max_left_semantic_context[
|
#define YYMAXLEFT ]b4_max_left_semantic_context[
|
||||||
|
|
||||||
/* YYMAXUTOK -- Last valid token number (for yychar). */
|
/* YYMAXUTOK -- Last valid token kind. */
|
||||||
#define YYMAXUTOK ]b4_user_token_number_max[
|
#define YYMAXUTOK ]b4_code_max[
|
||||||
|
|
||||||
/* YYTRANSLATE(TOKEN-NUM) -- Symbol number corresponding to TOKEN-NUM
|
/* YYTRANSLATE(TOKEN-NUM) -- Symbol number corresponding to TOKEN-NUM
|
||||||
as returned by yylex, with out-of-bounds checking. */
|
as returned by yylex, with out-of-bounds checking. */
|
||||||
@@ -873,7 +884,7 @@ yyuserAction (yyRuleNum yyn, int yyrhslen, yyGLRStackItem* yyvsp,
|
|||||||
yybool yynormal YY_ATTRIBUTE_UNUSED = yystackp->yysplitPoint == YY_NULLPTR;
|
yybool yynormal YY_ATTRIBUTE_UNUSED = yystackp->yysplitPoint == YY_NULLPTR;
|
||||||
int yylow;
|
int yylow;
|
||||||
]b4_parse_param_use([yyvalp], [yylocp])dnl
|
]b4_parse_param_use([yyvalp], [yylocp])dnl
|
||||||
[ YYUSE (yyrhslen);
|
[ YY_USE (yyrhslen);
|
||||||
# undef yyerrok
|
# undef yyerrok
|
||||||
# define yyerrok (yystackp->yyerrState = 0)
|
# define yyerrok (yystackp->yyerrState = 0)
|
||||||
# undef YYACCEPT
|
# undef YYACCEPT
|
||||||
@@ -937,8 +948,8 @@ yyuserAction (yyRuleNum yyn, int yyrhslen, yyGLRStackItem* yyvsp,
|
|||||||
static void
|
static void
|
||||||
yyuserMerge (int yyn, YYSTYPE* yy0, YYSTYPE* yy1)
|
yyuserMerge (int yyn, YYSTYPE* yy0, YYSTYPE* yy1)
|
||||||
{
|
{
|
||||||
YYUSE (yy0);
|
YY_USE (yy0);
|
||||||
YYUSE (yy1);
|
YY_USE (yy1);
|
||||||
|
|
||||||
switch (yyn)
|
switch (yyn)
|
||||||
{
|
{
|
||||||
@@ -1793,8 +1804,8 @@ static YYRESULTTAG
|
|||||||
yyreportAmbiguity (yySemanticOption* yyx0,
|
yyreportAmbiguity (yySemanticOption* yyx0,
|
||||||
yySemanticOption* yyx1]b4_pure_formals[)
|
yySemanticOption* yyx1]b4_pure_formals[)
|
||||||
{
|
{
|
||||||
YYUSE (yyx0);
|
YY_USE (yyx0);
|
||||||
YYUSE (yyx1);
|
YY_USE (yyx1);
|
||||||
|
|
||||||
#if ]b4_api_PREFIX[DEBUG
|
#if ]b4_api_PREFIX[DEBUG
|
||||||
YY_FPRINTF ((stderr, "Ambiguity detected.\n"));
|
YY_FPRINTF ((stderr, "Ambiguity detected.\n"));
|
||||||
@@ -2138,7 +2149,7 @@ yypcontext_token (const yyGLRStack *yystackp) YY_ATTRIBUTE_UNUSED;
|
|||||||
static yysymbol_kind_t
|
static yysymbol_kind_t
|
||||||
yypcontext_token (const yyGLRStack *yystackp)
|
yypcontext_token (const yyGLRStack *yystackp)
|
||||||
{
|
{
|
||||||
YYUSE (yystackp);
|
YY_USE (yystackp);
|
||||||
yysymbol_kind_t yytoken = yychar == ]b4_symbol(-2, id)[ ? ]b4_symbol(-2, kind)[ : YYTRANSLATE (yychar);
|
yysymbol_kind_t yytoken = yychar == ]b4_symbol(-2, id)[ ? ]b4_symbol(-2, kind)[ : YYTRANSLATE (yychar);
|
||||||
return yytoken;
|
return yytoken;
|
||||||
}
|
}
|
||||||
@@ -2150,7 +2161,7 @@ yypcontext_location (const yyGLRStack *yystackp) YY_ATTRIBUTE_UNUSED;
|
|||||||
static YYLTYPE *
|
static YYLTYPE *
|
||||||
yypcontext_location (const yyGLRStack *yystackp)
|
yypcontext_location (const yyGLRStack *yystackp)
|
||||||
{
|
{
|
||||||
YYUSE (yystackp);
|
YY_USE (yystackp);
|
||||||
return &yylloc;
|
return &yylloc;
|
||||||
}]])],
|
}]])],
|
||||||
[detailed\|verbose],
|
[detailed\|verbose],
|
||||||
@@ -2418,7 +2429,7 @@ yyrecoverSyntaxError (yyGLRStack* yystackp]b4_user_formals[)
|
|||||||
`----------*/
|
`----------*/
|
||||||
|
|
||||||
int
|
int
|
||||||
yyparse (]m4_ifset([b4_parse_param], [b4_formals(b4_parse_param)], [void])[)
|
]b4_glr_cc_if([yy_parse_impl], [yyparse])[ (]m4_ifset([b4_parse_param], [b4_formals(b4_parse_param)], [void])[)
|
||||||
{
|
{
|
||||||
int yyresult;
|
int yyresult;
|
||||||
yyGLRStack yystack;
|
yyGLRStack yystack;
|
||||||
@@ -2731,7 +2742,8 @@ m4_if(b4_prefix, [yy], [],
|
|||||||
#define yynerrs ]b4_prefix[nerrs]b4_locations_if([[
|
#define yynerrs ]b4_prefix[nerrs]b4_locations_if([[
|
||||||
#define yylloc ]b4_prefix[lloc]])])[
|
#define yylloc ]b4_prefix[lloc]])])[
|
||||||
|
|
||||||
]m4_ifdef([b4_pre_epilogue], [b4_pre_epilogue])[]dnl This is a hack for glr.cc. To remove when we have a better glr.cc.
|
]b4_glr_cc_if([b4_glr_cc_pre_epilogue
|
||||||
b4_percent_code_get([[epilogue]])[]dnl
|
b4_glr_cc_cleanup])[
|
||||||
|
]b4_percent_code_get([[epilogue]])[]dnl
|
||||||
b4_epilogue[]dnl
|
b4_epilogue[]dnl
|
||||||
b4_output_end
|
b4_output_end
|
||||||
|
|||||||
+64
-51
@@ -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
|
||||||
@@ -66,12 +66,6 @@ m4_defn([b4_parse_param]))],
|
|||||||
[[b4_namespace_ref::b4_parser_class[& yyparser], [[yyparser]]]])
|
[[b4_namespace_ref::b4_parser_class[& yyparser], [[yyparser]]]])
|
||||||
])
|
])
|
||||||
|
|
||||||
# b4_declare_symbol_enum
|
|
||||||
# ----------------------
|
|
||||||
m4_append([b4_declare_symbol_enum],
|
|
||||||
[[typedef symbol_kind_type yysymbol_kind_t;
|
|
||||||
]])
|
|
||||||
|
|
||||||
|
|
||||||
# b4_yy_symbol_print_define
|
# b4_yy_symbol_print_define
|
||||||
# -------------------------
|
# -------------------------
|
||||||
@@ -105,15 +99,9 @@ yyerror (]b4_locations_if([[const ]b4_namespace_ref::b4_parser_class[::location_
|
|||||||
]])[]m4_ifset([b4_parse_param], [b4_formals(b4_parse_param),
|
]])[]m4_ifset([b4_parse_param], [b4_formals(b4_parse_param),
|
||||||
])[const char* msg);]])[
|
])[const char* msg);]])[
|
||||||
|
|
||||||
]b4_percent_define_flag_if([[global_tokens_and_yystype]], [],
|
# Inserted before the epilogue to define implementations (yyerror, parser member
|
||||||
[m4_define([b4_pre_epilogue],
|
|
||||||
[[/* The user is using the C++ token kind, not the C one. */
|
|
||||||
#undef ]b4_symbol(0, [id])
|
|
||||||
])])[
|
|
||||||
|
|
||||||
# Hijack the epilogue to define implementations (yyerror, parser member
|
|
||||||
# functions etc.).
|
# functions etc.).
|
||||||
]m4_append([b4_epilogue],
|
]m4_define([b4_glr_cc_pre_epilogue],
|
||||||
[b4_syncline([@oline@], [@ofile@])dnl
|
[b4_syncline([@oline@], [@ofile@])dnl
|
||||||
[
|
[
|
||||||
/*------------------.
|
/*------------------.
|
||||||
@@ -156,7 +144,7 @@ m4_pushdef([b4_parse_param], m4_defn([b4_parse_param_orig]))dnl
|
|||||||
int
|
int
|
||||||
]b4_parser_class[::parse ()
|
]b4_parser_class[::parse ()
|
||||||
{
|
{
|
||||||
return ::yyparse (*this]b4_user_args[);
|
return ::yy_parse_impl (*this]b4_user_args[);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if ]b4_api_PREFIX[DEBUG
|
#if ]b4_api_PREFIX[DEBUG
|
||||||
@@ -169,11 +157,11 @@ m4_pushdef([b4_parse_param], m4_defn([b4_parse_param_orig]))dnl
|
|||||||
const semantic_type* yyvaluep]b4_locations_if([[,
|
const semantic_type* yyvaluep]b4_locations_if([[,
|
||||||
const location_type* yylocationp]])[) const
|
const location_type* yylocationp]])[) const
|
||||||
{]b4_locations_if([[
|
{]b4_locations_if([[
|
||||||
YYUSE (yylocationp);]])[
|
YY_USE (yylocationp);]])[
|
||||||
YYUSE (yyvaluep);
|
YY_USE (yyvaluep);
|
||||||
std::ostream& yyo = debug_stream ();
|
std::ostream& yyo = debug_stream ();
|
||||||
std::ostream& yyoutput = yyo;
|
std::ostream& yyoutput = yyo;
|
||||||
YYUSE (yyoutput);
|
YY_USE (yyoutput);
|
||||||
]b4_symbol_actions([printer])[
|
]b4_symbol_actions([printer])[
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -184,7 +172,7 @@ m4_pushdef([b4_parse_param], m4_defn([b4_parse_param_orig]))dnl
|
|||||||
const location_type* yylocationp]])[) const
|
const location_type* yylocationp]])[) const
|
||||||
{
|
{
|
||||||
*yycdebug_ << (yykind < YYNTOKENS ? "token" : "nterm")
|
*yycdebug_ << (yykind < YYNTOKENS ? "token" : "nterm")
|
||||||
<< ' ' << yytname[yykind] << " ("]b4_locations_if([[
|
<< ' ' << yysymbol_name (yykind) << " ("]b4_locations_if([[
|
||||||
<< *yylocationp << ": "]])[;
|
<< *yylocationp << ": "]])[;
|
||||||
yy_symbol_value_print_ (yykind, yyvaluep]b4_locations_if([[, yylocationp]])[);
|
yy_symbol_value_print_ (yykind, yyvaluep]b4_locations_if([[, yylocationp]])[);
|
||||||
*yycdebug_ << ')';
|
*yycdebug_ << ')';
|
||||||
@@ -222,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)
|
||||||
@@ -333,48 +372,22 @@ b4_percent_code_get([[requires]])[
|
|||||||
]b4_parse_param_vars[
|
]b4_parse_param_vars[
|
||||||
};
|
};
|
||||||
|
|
||||||
]dnl Redirections for glr.c.
|
|
||||||
b4_percent_define_flag_if([[global_tokens_and_yystype]],
|
|
||||||
[b4_token_defines
|
|
||||||
])[
|
|
||||||
]b4_namespace_close[
|
]b4_namespace_close[
|
||||||
|
|
||||||
]dnl Map the name used in c.m4 to the one used in c++.m4.
|
|
||||||
[#undef ]b4_symbol(-2, [id])[
|
|
||||||
#define ]b4_symbol(-2, [id])[ ]b4_namespace_ref[::]b4_parser_class[::token::]b4_symbol(-2, [id])[
|
|
||||||
#undef ]b4_symbol(0, [id])[
|
|
||||||
#define ]b4_symbol(0, [id])[ ]b4_namespace_ref[::]b4_parser_class[::token::]b4_symbol(0, [id])[
|
|
||||||
#undef ]b4_symbol(1, [id])[
|
|
||||||
#define ]b4_symbol(1, [id])[ ]b4_namespace_ref[::]b4_parser_class[::token::]b4_symbol(1, [id])[
|
|
||||||
|
|
||||||
#ifndef ]b4_api_PREFIX[STYPE
|
|
||||||
# define ]b4_api_PREFIX[STYPE ]b4_namespace_ref[::]b4_parser_class[::semantic_type
|
|
||||||
#endif
|
|
||||||
#ifndef ]b4_api_PREFIX[LTYPE
|
|
||||||
# define ]b4_api_PREFIX[LTYPE ]b4_namespace_ref[::]b4_parser_class[::location_type
|
|
||||||
#endif
|
|
||||||
|
|
||||||
]m4_define([b4_declare_symbol_enum],
|
|
||||||
[[typedef ]b4_namespace_ref[::]b4_parser_class[::symbol_kind_type yysymbol_kind_t;
|
|
||||||
#define ]b4_symbol_prefix[YYEMPTY ]b4_namespace_ref[::]b4_parser_class[::symbol_kind::]b4_symbol_prefix[YYEMPTY
|
|
||||||
#define ]b4_symbol_prefix[YYerror ]b4_namespace_ref[::]b4_parser_class[::symbol_kind::]b4_symbol_prefix[YYerror
|
|
||||||
#define ]b4_symbol_prefix[YYEOF ]b4_namespace_ref[::]b4_parser_class[::symbol_kind::]b4_symbol_prefix[YYEOF
|
|
||||||
#define ]b4_symbol_prefix[YYUNDEF ]b4_namespace_ref[::]b4_parser_class[::symbol_kind::]b4_symbol_prefix[YYUNDEF
|
|
||||||
]])[
|
|
||||||
]b4_percent_code_get([[provides]])[
|
]b4_percent_code_get([[provides]])[
|
||||||
]m4_popdef([b4_parse_param])dnl
|
]m4_popdef([b4_parse_param])dnl
|
||||||
])
|
])[
|
||||||
|
|
||||||
b4_defines_if(
|
]b4_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
|
||||||
|
|||||||
+17
-10
@@ -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
|
||||||
@@ -71,12 +71,12 @@ m4_define([b4_lexer_if],
|
|||||||
# b4_identification
|
# b4_identification
|
||||||
# -----------------
|
# -----------------
|
||||||
m4_define([b4_identification],
|
m4_define([b4_identification],
|
||||||
[ /** Version number for the Bison executable that generated this parser. */
|
[[ /** Version number for the Bison executable that generated this parser. */
|
||||||
public static final String bisonVersion = "b4_version";
|
public static final String bisonVersion = "]b4_version_string[";
|
||||||
|
|
||||||
/** Name of the skeleton that generated this parser. */
|
/** Name of the skeleton that generated this parser. */
|
||||||
public static final String bisonSkeleton = b4_skeleton;
|
public static final String bisonSkeleton = ]b4_skeleton[;
|
||||||
])
|
]])
|
||||||
|
|
||||||
|
|
||||||
## ------------ ##
|
## ------------ ##
|
||||||
@@ -143,7 +143,7 @@ m4_define([b4_token_enum],
|
|||||||
]],
|
]],
|
||||||
b4_symbol([$1], [tag]),
|
b4_symbol([$1], [tag]),
|
||||||
b4_symbol([$1], [id]),
|
b4_symbol([$1], [id]),
|
||||||
b4_symbol([$1], b4_api_token_raw_if([[number]], [[user_number]])))])])
|
b4_symbol([$1], b4_api_token_raw_if([[number]], [[code]])))])])
|
||||||
|
|
||||||
|
|
||||||
# b4_token_enums
|
# b4_token_enums
|
||||||
@@ -159,13 +159,20 @@ b4_symbol_foreach([b4_token_enum])])])
|
|||||||
## Symbol kinds. ##
|
## Symbol kinds. ##
|
||||||
## -------------- ##
|
## -------------- ##
|
||||||
|
|
||||||
|
|
||||||
|
# b4_symbol_kind(NUM)
|
||||||
|
# -------------------
|
||||||
|
m4_define([b4_symbol_kind],
|
||||||
|
[SymbolKind.b4_symbol_kind_base($@)])
|
||||||
|
|
||||||
|
|
||||||
# b4_symbol_enum(SYMBOL-NUM)
|
# b4_symbol_enum(SYMBOL-NUM)
|
||||||
# --------------------------
|
# --------------------------
|
||||||
# Output the definition of this symbol as an enum.
|
# Output the definition of this symbol as an enum.
|
||||||
m4_define([b4_symbol_enum],
|
m4_define([b4_symbol_enum],
|
||||||
[m4_format([ %-30s %s],
|
[m4_format([ %-30s %s],
|
||||||
m4_format([[%s(%s)%s]],
|
m4_format([[%s(%s)%s]],
|
||||||
b4_symbol([$1], [kind]),
|
b4_symbol([$1], [kind_base]),
|
||||||
[$1],
|
[$1],
|
||||||
m4_if([$1], b4_last_symbol, [[;]], [[,]])),
|
m4_if([$1], b4_last_symbol, [[;]], [[,]])),
|
||||||
[b4_symbol_tag_comment([$1])])])
|
[b4_symbol_tag_comment([$1])])])
|
||||||
@@ -255,11 +262,11 @@ m4_define([b4_declare_symbol_enum],
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
# b4_case(ID, CODE)
|
# b4_case(ID, CODE, [COMMENTS])
|
||||||
# -----------------
|
# -----------------------------
|
||||||
# We need to fool Java's stupid unreachable code detection.
|
# We need to fool Java's stupid unreachable code detection.
|
||||||
m4_define([b4_case],
|
m4_define([b4_case],
|
||||||
[ case $1:
|
[ case $1:m4_ifval([$3], [ b4_comment([$3])])
|
||||||
if (yyn == $1)
|
if (yyn == $1)
|
||||||
$2;
|
$2;
|
||||||
break;
|
break;
|
||||||
|
|||||||
+29
-30
@@ -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
|
||||||
@@ -59,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
|
||||||
@@ -153,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]])])
|
||||||
@@ -264,9 +271,9 @@ m4_define([b4_shared_declarations],
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
context (const ]b4_parser_class[& yyparser, const symbol_type& yyla);
|
context (const ]b4_parser_class[& yyparser, const symbol_type& yyla);
|
||||||
const symbol_type& lookahead () const { return yyla_; }
|
const symbol_type& lookahead () const YY_NOEXCEPT { return yyla_; }
|
||||||
symbol_kind_type token () const { return yyla_.kind (); }]b4_locations_if([[
|
symbol_kind_type token () const YY_NOEXCEPT { return yyla_.kind (); }]b4_locations_if([[
|
||||||
const location_type& location () const { return yyla_.location; }
|
const location_type& location () const YY_NOEXCEPT { return yyla_.location; }
|
||||||
]])[
|
]])[
|
||||||
/// Put in YYARG at most YYARGN of the expected tokens, and return the
|
/// Put in YYARG at most YYARGN of the expected tokens, and return the
|
||||||
/// number of tokens stored in YYARG. If YYARG is null, return the
|
/// number of tokens stored in YYARG. If YYARG is null, return the
|
||||||
@@ -486,14 +493,6 @@ m4_define([b4_shared_declarations],
|
|||||||
]b4_public_types_define([$1])])[
|
]b4_public_types_define([$1])])[
|
||||||
]b4_namespace_close[
|
]b4_namespace_close[
|
||||||
|
|
||||||
]b4_percent_define_flag_if([[global_tokens_and_yystype]],
|
|
||||||
[b4_token_defines
|
|
||||||
|
|
||||||
#ifndef ]b4_api_PREFIX[STYPE
|
|
||||||
// Redirection for backward compatibility.
|
|
||||||
# define ]b4_api_PREFIX[STYPE b4_namespace_ref::b4_parser_class::semantic_type
|
|
||||||
#endif
|
|
||||||
])[
|
|
||||||
]b4_percent_code_get([[provides]])[
|
]b4_percent_code_get([[provides]])[
|
||||||
]])
|
]])
|
||||||
|
|
||||||
@@ -506,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[
|
||||||
]])
|
]])
|
||||||
|
|
||||||
@@ -598,7 +597,7 @@ m4_if(b4_prefix, [yy], [],
|
|||||||
#else // !]b4_api_PREFIX[DEBUG
|
#else // !]b4_api_PREFIX[DEBUG
|
||||||
|
|
||||||
# define YYCDEBUG if (false) std::cerr
|
# define YYCDEBUG if (false) std::cerr
|
||||||
# define YY_SYMBOL_PRINT(Title, Symbol) YYUSE (Symbol)
|
# define YY_SYMBOL_PRINT(Title, Symbol) YY_USE (Symbol)
|
||||||
# define YY_REDUCE_PRINT(Rule) static_cast<void> (0)
|
# define YY_REDUCE_PRINT(Rule) static_cast<void> (0)
|
||||||
# define YY_STACK_PRINT() static_cast<void> (0)
|
# define YY_STACK_PRINT() static_cast<void> (0)
|
||||||
|
|
||||||
@@ -666,7 +665,7 @@ m4_if(b4_prefix, [yy], [],
|
|||||||
]b4_parser_class[::by_state::kind () const YY_NOEXCEPT
|
]b4_parser_class[::by_state::kind () const YY_NOEXCEPT
|
||||||
{
|
{
|
||||||
if (state == empty_state)
|
if (state == empty_state)
|
||||||
return symbol_kind::]b4_symbol(-2, kind)[;
|
return ]b4_symbol(-2, kind)[;
|
||||||
else
|
else
|
||||||
return YY_CAST (symbol_kind_type, yystos_[+state]);
|
return YY_CAST (symbol_kind_type, yystos_[+state]);
|
||||||
}
|
}
|
||||||
@@ -691,7 +690,7 @@ m4_if(b4_prefix, [yy], [],
|
|||||||
b4_symbol_variant([that.kind ()],
|
b4_symbol_variant([that.kind ()],
|
||||||
[value], [move], [YY_MOVE (that.value)])])[
|
[value], [move], [YY_MOVE (that.value)])])[
|
||||||
// that is emptied.
|
// that is emptied.
|
||||||
that.kind_ = symbol_kind::]b4_symbol(-2, kind)[;
|
that.kind_ = ]b4_symbol(-2, kind)[;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if YY_CPLUSPLUS < 201103L
|
#if YY_CPLUSPLUS < 201103L
|
||||||
@@ -737,7 +736,7 @@ m4_if(b4_prefix, [yy], [],
|
|||||||
]b4_parser_class[::yy_print_ (std::ostream& yyo, const basic_symbol<Base>& yysym) const
|
]b4_parser_class[::yy_print_ (std::ostream& yyo, const basic_symbol<Base>& yysym) const
|
||||||
{
|
{
|
||||||
std::ostream& yyoutput = yyo;
|
std::ostream& yyoutput = yyo;
|
||||||
YYUSE (yyoutput);
|
YY_USE (yyoutput);
|
||||||
if (yysym.empty ())
|
if (yysym.empty ())
|
||||||
yyo << "empty symbol";
|
yyo << "empty symbol";
|
||||||
else
|
else
|
||||||
@@ -920,13 +919,13 @@ b4_dollar_popdef])[]dnl
|
|||||||
}
|
}
|
||||||
YY_SYMBOL_PRINT ("Next token is", yyla);
|
YY_SYMBOL_PRINT ("Next token is", yyla);
|
||||||
|
|
||||||
if (yyla.kind () == ]symbol_kind::b4_symbol(1, kind)[)
|
if (yyla.kind () == ]b4_symbol(1, kind)[)
|
||||||
{
|
{
|
||||||
// The scanner already issued an error message, process directly
|
// The scanner already issued an error message, process directly
|
||||||
// to error recovery. But do not keep the error token as
|
// to error recovery. But do not keep the error token as
|
||||||
// lookahead, it is too special and may lead us to an endless
|
// lookahead, it is too special and may lead us to an endless
|
||||||
// loop in error recovery. */
|
// loop in error recovery. */
|
||||||
yyla.kind_ = ]symbol_kind::b4_symbol(2, kind)[;
|
yyla.kind_ = ]b4_symbol(2, kind)[;
|
||||||
goto yyerrlab1;
|
goto yyerrlab1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1063,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.kind () == symbol_kind::]b4_symbol_prefix[YYEOF)
|
if (yyla.kind () == ]b4_symbol(0, kind)[)
|
||||||
YYABORT;
|
YYABORT;
|
||||||
else if (!yyla.empty ())
|
else if (!yyla.empty ())
|
||||||
{
|
{
|
||||||
@@ -1104,9 +1103,9 @@ b4_dollar_popdef])[]dnl
|
|||||||
yyn = yypact_[+yystack_[0].state];
|
yyn = yypact_[+yystack_[0].state];
|
||||||
if (!yy_pact_value_is_default_ (yyn))
|
if (!yy_pact_value_is_default_ (yyn))
|
||||||
{
|
{
|
||||||
yyn += symbol_kind::]b4_symbol(1, kind)[;
|
yyn += ]b4_symbol(1, kind)[;
|
||||||
if (0 <= yyn && yyn <= yylast_
|
if (0 <= yyn && yyn <= yylast_
|
||||||
&& yycheck_[yyn] == symbol_kind::]b4_symbol(1, kind)[)
|
&& yycheck_[yyn] == ]b4_symbol(1, kind)[)
|
||||||
{
|
{
|
||||||
yyn = yytable_[yyn];
|
yyn = yytable_[yyn];
|
||||||
if (0 < yyn)
|
if (0 < yyn)
|
||||||
@@ -1298,8 +1297,8 @@ b4_dollar_popdef])[]dnl
|
|||||||
for (int yyx = 0; yyx < YYNTOKENS; ++yyx)
|
for (int yyx = 0; yyx < YYNTOKENS; ++yyx)
|
||||||
{
|
{
|
||||||
symbol_kind_type yysym = YY_CAST (symbol_kind_type, yyx);
|
symbol_kind_type yysym = YY_CAST (symbol_kind_type, yyx);
|
||||||
if (yysym != symbol_kind::]b4_symbol(1, kind)[
|
if (yysym != ]b4_symbol(1, kind)[
|
||||||
&& yysym != symbol_kind::]b4_symbol_prefix[YYUNDEF
|
&& yysym != ]b4_symbol(2, kind)[
|
||||||
&& yyparser_.yy_lac_check_ (yysym))
|
&& yyparser_.yy_lac_check_ (yysym))
|
||||||
{
|
{
|
||||||
if (!yyarg)
|
if (!yyarg)
|
||||||
@@ -1321,7 +1320,7 @@ b4_dollar_popdef])[]dnl
|
|||||||
int yychecklim = yylast_ - yyn + 1;
|
int yychecklim = yylast_ - yyn + 1;
|
||||||
int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
|
int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
|
||||||
for (int yyx = yyxbegin; yyx < yyxend; ++yyx)
|
for (int yyx = yyxbegin; yyx < yyxend; ++yyx)
|
||||||
if (yycheck_[yyx + yyn] == yyx && yyx != symbol_kind::]b4_symbol(1, kind)[
|
if (yycheck_[yyx + yyn] == yyx && yyx != ]b4_symbol(1, kind)[
|
||||||
&& !yy_table_value_is_error_ (yytable_[yyx + yyn]))
|
&& !yy_table_value_is_error_ (yytable_[yyx + yyn]))
|
||||||
{
|
{
|
||||||
if (!yyarg)
|
if (!yyarg)
|
||||||
@@ -1334,7 +1333,7 @@ b4_dollar_popdef])[]dnl
|
|||||||
}
|
}
|
||||||
]])[
|
]])[
|
||||||
if (yyarg && yycount == 0 && 0 < yyargn)
|
if (yyarg && yycount == 0 && 0 < yyargn)
|
||||||
yyarg[0] = symbol_kind::]b4_symbol(-2, kind)[;
|
yyarg[0] = ]b4_symbol(-2, kind)[;
|
||||||
return yycount;
|
return yycount;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1411,7 +1410,7 @@ 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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+20
-18
@@ -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
|
||||||
@@ -20,7 +20,7 @@ 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_disclaimer[
|
||||||
]b4_percent_define_ifdef([package], [module b4_percent_define_get([package]);
|
]b4_percent_define_ifdef([package], [module b4_percent_define_get([package]);
|
||||||
])[
|
])[
|
||||||
@@ -428,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 = TokenKind.YYEMPTY;
|
int yychar = TokenKind.YYEMPTY;
|
||||||
SymbolKind yytoken = SymbolKind.]b4_symbol(-2, kind)[;
|
// Lookahead symbol kind.
|
||||||
|
SymbolKind yytoken = ]b4_symbol(-2, kind)[;
|
||||||
|
|
||||||
/* State. */
|
/* State. */
|
||||||
int yyn = 0;
|
int yyn = 0;
|
||||||
@@ -509,14 +510,14 @@ m4_popdef([b4_at_dollar])])dnl
|
|||||||
yytoken = yytranslate_ (yychar);]b4_parse_trace_if([[
|
yytoken = yytranslate_ (yychar);]b4_parse_trace_if([[
|
||||||
yy_symbol_print ("Next token is", yytoken, yylval]b4_locations_if([, yylloc])[);]])[
|
yy_symbol_print ("Next token is", yytoken, yylval]b4_locations_if([, yylloc])[);]])[
|
||||||
|
|
||||||
if (yytoken == SymbolKind.]b4_symbol(1, kind)[)
|
if (yytoken == ]b4_symbol(1, kind)[)
|
||||||
{
|
{
|
||||||
// The scanner already issued an error message, process directly
|
// The scanner already issued an error message, process directly
|
||||||
// to error recovery. But do not keep the error token as
|
// to error recovery. But do not keep the error token as
|
||||||
// lookahead, it is too special and may lead us to an endless
|
// lookahead, it is too special and may lead us to an endless
|
||||||
// loop in error recovery. */
|
// loop in error recovery. */
|
||||||
yychar = TokenKind.YYUNDEF;
|
yychar = TokenKind.]b4_symbol(2, id)[;
|
||||||
yytoken = SymbolKind.]b4_symbol_prefix[YYUNDEF;]b4_locations_if([[
|
yytoken = ]b4_symbol(2, kind)[;]b4_locations_if([[
|
||||||
yyerrloc = yylloc;]])[
|
yyerrloc = yylloc;]])[
|
||||||
label = YYERRLAB1;
|
label = YYERRLAB1;
|
||||||
}
|
}
|
||||||
@@ -587,8 +588,8 @@ m4_popdef([b4_at_dollar])])dnl
|
|||||||
if (yyerrstatus_ == 0)
|
if (yyerrstatus_ == 0)
|
||||||
{
|
{
|
||||||
++yynerrs_;
|
++yynerrs_;
|
||||||
if (yychar == TokenKind.YYEMPTY)
|
if (yychar == TokenKind.]b4_symbol(-2, id)[)
|
||||||
yytoken = SymbolKind.]b4_symbol(-2, kind)[;
|
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([
|
||||||
@@ -638,8 +639,8 @@ m4_popdef([b4_at_dollar])])dnl
|
|||||||
yyn = yypact_[yystate];
|
yyn = yypact_[yystate];
|
||||||
if (!yy_pact_value_is_default_ (yyn))
|
if (!yy_pact_value_is_default_ (yyn))
|
||||||
{
|
{
|
||||||
yyn += SymbolKind.]b4_symbol(1, kind)[;
|
yyn += ]b4_symbol(1, kind)[;
|
||||||
if (0 <= yyn && yyn <= yylast_ && yycheck_[yyn] == SymbolKind.]b4_symbol(1, kind)[)
|
if (0 <= yyn && yyn <= yylast_ && yycheck_[yyn] == ]b4_symbol(1, kind)[)
|
||||||
{
|
{
|
||||||
yyn = yytable_[yyn];
|
yyn = yytable_[yyn];
|
||||||
if (0 < yyn)
|
if (0 < yyn)
|
||||||
@@ -726,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 != SymbolKind.]b4_symbol(-2, kind)[)
|
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.
|
||||||
@@ -745,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 != SymbolKind.]b4_symbol(1, kind)[
|
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 != SymbolKind.]b4_symbol(1, kind)[
|
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 ";
|
||||||
@@ -841,17 +842,18 @@ m4_popdef([b4_at_dollar])])dnl
|
|||||||
]b4_translate[
|
]b4_translate[
|
||||||
@};
|
@};
|
||||||
|
|
||||||
immutable int user_token_number_max_ = ]b4_user_token_number_max[;
|
// Last valid token kind.
|
||||||
|
immutable int code_max = ]b4_code_max[;
|
||||||
|
|
||||||
if (t <= 0)
|
if (t <= 0)
|
||||||
return SymbolKind.]b4_symbol_prefix[YYEOF;
|
return ]b4_symbol(0, kind)[;
|
||||||
else if (t <= user_token_number_max_)
|
else if (t <= code_max)
|
||||||
{
|
{
|
||||||
import std.conv : to;
|
import std.conv : to;
|
||||||
return to!SymbolKind (translate_table[t]);
|
return to!SymbolKind (translate_table[t]);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
return SymbolKind.]b4_symbol_prefix[YYUNDEF;]])[
|
return ]b4_symbol(2, kind)[;]])[
|
||||||
}
|
}
|
||||||
|
|
||||||
private static immutable int yylast_ = ]b4_last[;
|
private static immutable int yylast_ = ]b4_last[;
|
||||||
|
|||||||
+31
-29
@@ -1,6 +1,6 @@
|
|||||||
# Java skeleton for Bison -*- autoconf -*-
|
# Java skeleton for Bison -*- autoconf -*-
|
||||||
|
|
||||||
# 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
|
||||||
@@ -53,8 +53,9 @@ b4_use_push_for_pull_if([
|
|||||||
# allows them to be defined either in parse() when doing pull parsing,
|
# allows them to be defined either in parse() when doing pull parsing,
|
||||||
# or as class instance variable when doing push parsing.
|
# or as class instance variable when doing push parsing.
|
||||||
m4_define([b4_define_state],[[
|
m4_define([b4_define_state],[[
|
||||||
/* Lookahead and lookahead in internal form. */
|
/* Lookahead token kind. */
|
||||||
int yychar = YYEMPTY_;
|
int yychar = YYEMPTY_;
|
||||||
|
/* Lookahead symbol kind. */
|
||||||
SymbolKind yytoken = null;
|
SymbolKind yytoken = null;
|
||||||
|
|
||||||
/* State. */
|
/* State. */
|
||||||
@@ -77,9 +78,9 @@ m4_define([b4_define_state],[[
|
|||||||
|
|
||||||
]b4_output_begin([b4_parser_file_name])[
|
]b4_output_begin([b4_parser_file_name])[
|
||||||
]b4_copyright([Skeleton implementation for Bison LALR(1) parsers in Java],
|
]b4_copyright([Skeleton implementation for Bison LALR(1) parsers in Java],
|
||||||
[2007-2015, 2018-2020])[
|
[2007-2015, 2018-2021])[
|
||||||
]b4_disclaimer[
|
]b4_disclaimer[
|
||||||
]b4_percent_define_ifdef([package], [package b4_percent_define_get([package]);[
|
]b4_percent_define_ifdef([api.package], [package b4_percent_define_get([api.package]);[
|
||||||
]])[
|
]])[
|
||||||
]b4_user_pre_prologue[
|
]b4_user_pre_prologue[
|
||||||
]b4_user_post_prologue[
|
]b4_user_post_prologue[
|
||||||
@@ -602,9 +603,9 @@ b4_dollar_popdef[]dnl
|
|||||||
push_token_consumed = false;]], [b4_parse_trace_if([[
|
push_token_consumed = false;]], [b4_parse_trace_if([[
|
||||||
yycdebug ("Reading a token");]])[
|
yycdebug ("Reading a token");]])[
|
||||||
yychar = yylexer.yylex ();
|
yychar = yylexer.yylex ();
|
||||||
yylval = yylexer.getLVal ();]b4_locations_if([
|
yylval = yylexer.getLVal();]b4_locations_if([[
|
||||||
yylloc = new b4_location_type (yylexer.getStartPos (),
|
yylloc = new ]b4_location_type[(yylexer.getStartPos(),
|
||||||
yylexer.getEndPos ());])[
|
yylexer.getEndPos());]])[
|
||||||
]])[
|
]])[
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -613,14 +614,14 @@ b4_dollar_popdef[]dnl
|
|||||||
yySymbolPrint("Next token is", yytoken,
|
yySymbolPrint("Next token is", yytoken,
|
||||||
yylval]b4_locations_if([, yylloc])[);]])[
|
yylval]b4_locations_if([, yylloc])[);]])[
|
||||||
|
|
||||||
if (yytoken == SymbolKind.]b4_symbol_prefix[YYerror)
|
if (yytoken == ]b4_symbol(1, kind)[)
|
||||||
{
|
{
|
||||||
// The scanner already issued an error message, process directly
|
// The scanner already issued an error message, process directly
|
||||||
// to error recovery. But do not keep the error token as
|
// to error recovery. But do not keep the error token as
|
||||||
// lookahead, it is too special and may lead us to an endless
|
// lookahead, it is too special and may lead us to an endless
|
||||||
// loop in error recovery. */
|
// loop in error recovery. */
|
||||||
yychar = Lexer.]b4_percent_define_get([api.token.prefix])[YYUNDEF;
|
yychar = Lexer.]b4_symbol(2, id)[;
|
||||||
yytoken = SymbolKind.]b4_symbol_prefix[YYUNDEF;]b4_locations_if([[
|
yytoken = ]b4_symbol(2, kind)[;]b4_locations_if([[
|
||||||
yyerrloc = yylloc;]])[
|
yyerrloc = yylloc;]])[
|
||||||
label = YYERRLAB1;
|
label = YYERRLAB1;
|
||||||
}
|
}
|
||||||
@@ -628,8 +629,8 @@ b4_dollar_popdef[]dnl
|
|||||||
{
|
{
|
||||||
/* If the proper action on seeing token YYTOKEN is to reduce or to
|
/* If the proper action on seeing token YYTOKEN is to reduce or to
|
||||||
detect an error, take that action. */
|
detect an error, take that action. */
|
||||||
yyn += yytoken.getCode ();
|
yyn += yytoken.getCode();
|
||||||
if (yyn < 0 || YYLAST_ < yyn || yycheck_[yyn] != yytoken.getCode ())
|
if (yyn < 0 || YYLAST_ < yyn || yycheck_[yyn] != yytoken.getCode())
|
||||||
label = YYDEFAULT;
|
label = YYDEFAULT;
|
||||||
|
|
||||||
/* <= 0 means reduce or error. */
|
/* <= 0 means reduce or error. */
|
||||||
@@ -744,9 +745,9 @@ b4_dollar_popdef[]dnl
|
|||||||
yyn = yypact_[yystate];
|
yyn = yypact_[yystate];
|
||||||
if (!yyPactValueIsDefault (yyn))
|
if (!yyPactValueIsDefault (yyn))
|
||||||
{
|
{
|
||||||
yyn += SymbolKind.]b4_symbol(1, kind)[.getCode ();
|
yyn += ]b4_symbol(1, kind)[.getCode();
|
||||||
if (0 <= yyn && yyn <= YYLAST_
|
if (0 <= yyn && yyn <= YYLAST_
|
||||||
&& yycheck_[yyn] == SymbolKind.]b4_symbol(1, kind)[.getCode ())
|
&& yycheck_[yyn] == ]b4_symbol(1, kind)[.getCode())
|
||||||
{
|
{
|
||||||
yyn = yytable_[yyn];
|
yyn = yytable_[yyn];
|
||||||
if (0 < yyn)
|
if (0 < yyn)
|
||||||
@@ -779,7 +780,7 @@ b4_dollar_popdef[]dnl
|
|||||||
yystack.pop (2);]])[
|
yystack.pop (2);]])[
|
||||||
|
|
||||||
/* Shift the error token. */]b4_parse_trace_if([[
|
/* Shift the error token. */]b4_parse_trace_if([[
|
||||||
yySymbolPrint("Shifting", SymbolKind.get (yystos_[yyn]),
|
yySymbolPrint("Shifting", SymbolKind.get(yystos_[yyn]),
|
||||||
yylval]b4_locations_if([, yyloc])[);]])[
|
yylval]b4_locations_if([, yyloc])[);]])[
|
||||||
|
|
||||||
yystate = yyn;
|
yystate = yyn;
|
||||||
@@ -933,15 +934,15 @@ b4_dollar_popdef[]dnl
|
|||||||
int yychecklim = YYLAST_ - yyn + 1;
|
int yychecklim = YYLAST_ - yyn + 1;
|
||||||
int yyxend = yychecklim < NTOKENS ? yychecklim : NTOKENS;
|
int yyxend = yychecklim < NTOKENS ? yychecklim : NTOKENS;
|
||||||
for (int yyx = yyxbegin; yyx < yyxend; ++yyx)
|
for (int yyx = yyxbegin; yyx < yyxend; ++yyx)
|
||||||
if (yycheck_[yyx + yyn] == yyx && yyx != SymbolKind.]b4_symbol(1, kind)[.getCode ()
|
if (yycheck_[yyx + yyn] == yyx && yyx != ]b4_symbol(1, kind)[.getCode()
|
||||||
&& !yyTableValueIsError (yytable_[yyx + yyn]))
|
&& !yyTableValueIsError(yytable_[yyx + yyn]))
|
||||||
{
|
{
|
||||||
if (yyarg == null)
|
if (yyarg == null)
|
||||||
yycount += 1;
|
yycount += 1;
|
||||||
else if (yycount == yyargn)
|
else if (yycount == yyargn)
|
||||||
return 0; // FIXME: this is incorrect.
|
return 0; // FIXME: this is incorrect.
|
||||||
else
|
else
|
||||||
yyarg[yycount++] = SymbolKind.get (yyx);
|
yyarg[yycount++] = SymbolKind.get(yyx);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (yyarg != null && yycount == yyoffset && yyoffset < yyargn)
|
if (yyarg != null && yycount == yyoffset && yyoffset < yyargn)
|
||||||
@@ -981,12 +982,12 @@ b4_dollar_popdef[]dnl
|
|||||||
to an error action in a later state.
|
to an error action in a later state.
|
||||||
*/
|
*/
|
||||||
int yycount = 0;
|
int yycount = 0;
|
||||||
if (yyctx.getToken () != null)
|
if (yyctx.getToken() != null)
|
||||||
{
|
{
|
||||||
if (yyarg != null)
|
if (yyarg != null)
|
||||||
yyarg[yycount] = yyctx.getToken ();
|
yyarg[yycount] = yyctx.getToken();
|
||||||
yycount += 1;
|
yycount += 1;
|
||||||
yycount += yyctx.getExpectedTokens (yyarg, 1, yyargn);
|
yycount += yyctx.getExpectedTokens(yyarg, 1, yyargn);
|
||||||
}
|
}
|
||||||
return yycount;
|
return yycount;
|
||||||
}
|
}
|
||||||
@@ -1071,27 +1072,28 @@ b4_dollar_popdef[]dnl
|
|||||||
/* The symbols being reduced. */
|
/* The symbols being reduced. */
|
||||||
for (int yyi = 0; yyi < yynrhs; yyi++)
|
for (int yyi = 0; yyi < yynrhs; yyi++)
|
||||||
yySymbolPrint(" $" + (yyi + 1) + " =",
|
yySymbolPrint(" $" + (yyi + 1) + " =",
|
||||||
SymbolKind.get (yystos_[yystack.stateAt (yynrhs - (yyi + 1))]),
|
SymbolKind.get(yystos_[yystack.stateAt (yynrhs - (yyi + 1))]),
|
||||||
]b4_rhs_data(yynrhs, yyi + 1)b4_locations_if([,
|
]b4_rhs_data(yynrhs, yyi + 1)b4_locations_if([,
|
||||||
b4_rhs_location(yynrhs, yyi + 1)])[);
|
b4_rhs_location(yynrhs, yyi + 1)])[);
|
||||||
}]])[
|
}]])[
|
||||||
|
|
||||||
/* YYTRANSLATE_(TOKEN-NUM) -- Symbol number corresponding to TOKEN-NUM
|
/* YYTRANSLATE_(TOKEN-NUM) -- Symbol number corresponding to TOKEN-NUM
|
||||||
as returned by yylex, with out-of-bounds checking. */
|
as returned by yylex, with out-of-bounds checking. */
|
||||||
private static final SymbolKind yytranslate_ (int t)
|
private static final SymbolKind yytranslate_(int t)
|
||||||
]b4_api_token_raw_if(dnl
|
]b4_api_token_raw_if(dnl
|
||||||
[[ {
|
[[ {
|
||||||
return SymbolKind.get (t);
|
return SymbolKind.get(t);
|
||||||
}
|
}
|
||||||
]],
|
]],
|
||||||
[[ {
|
[[ {
|
||||||
int user_token_number_max_ = ]b4_user_token_number_max[;
|
// Last valid token kind.
|
||||||
|
int code_max = ]b4_code_max[;
|
||||||
if (t <= 0)
|
if (t <= 0)
|
||||||
return SymbolKind.]b4_symbol_prefix[YYEOF;
|
return ]b4_symbol(0, kind)[;
|
||||||
else if (t <= user_token_number_max_)
|
else if (t <= code_max)
|
||||||
return SymbolKind.get (yytranslate_table_[t]);
|
return SymbolKind.get(yytranslate_table_[t]);
|
||||||
else
|
else
|
||||||
return SymbolKind.]b4_symbol_prefix[YYUNDEF;
|
return ]b4_symbol(2, kind)[;
|
||||||
}
|
}
|
||||||
]b4_integral_parser_table_define([translate_table], [b4_translate])[
|
]b4_integral_parser_table_define([translate_table], [b4_translate])[
|
||||||
]])[
|
]])[
|
||||||
|
|||||||
@@ -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
|
||||||
@@ -16,13 +16,13 @@
|
|||||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
m4_pushdef([b4_copyright_years],
|
m4_pushdef([b4_copyright_years],
|
||||||
[2002-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[)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -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
|
||||||
@@ -19,7 +19,7 @@
|
|||||||
# 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])])])
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,2 @@
|
|||||||
|
dnl GNU M4 treats -dV in a position-independent manner.
|
||||||
|
m4_debugmode(V)m4_traceon()dnl
|
||||||
+102
-42
@@ -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
|
||||||
@@ -20,6 +20,13 @@
|
|||||||
## 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,8 +117,8 @@ 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));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -125,7 +132,7 @@ m4_define([b4_value_type_declare],
|
|||||||
/// 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
|
||||||
@@ -133,10 +140,10 @@ m4_define([b4_value_type_declare],
|
|||||||
template <typename T, typename... U>
|
template <typename T, typename... U>
|
||||||
T&
|
T&
|
||||||
emplace (U&&... u)
|
emplace (U&&... u)
|
||||||
{]b4_parse_assert_if([
|
{]b4_parse_assert_if([[
|
||||||
YY_ASSERT (!yytypeid_);
|
]b4_assert[ (!yytypeid_);
|
||||||
YY_ASSERT (sizeof (T) <= size);
|
]b4_assert[ (sizeof (T) <= size);
|
||||||
yytypeid_ = & typeid (T);])[
|
yytypeid_ = & typeid (T);]])[
|
||||||
return *new (yyas_<T> ()) T (std::forward <U>(u)...);
|
return *new (yyas_<T> ()) T (std::forward <U>(u)...);
|
||||||
}
|
}
|
||||||
# else
|
# else
|
||||||
@@ -144,10 +151,10 @@ m4_define([b4_value_type_declare],
|
|||||||
template <typename T>
|
template <typename T>
|
||||||
T&
|
T&
|
||||||
emplace ()
|
emplace ()
|
||||||
{]b4_parse_assert_if([
|
{]b4_parse_assert_if([[
|
||||||
YY_ASSERT (!yytypeid_);
|
]b4_assert[ (!yytypeid_);
|
||||||
YY_ASSERT (sizeof (T) <= size);
|
]b4_assert[ (sizeof (T) <= size);
|
||||||
yytypeid_ = & typeid (T);])[
|
yytypeid_ = & typeid (T);]])[
|
||||||
return *new (yyas_<T> ()) T ();
|
return *new (yyas_<T> ()) T ();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -155,10 +162,10 @@ m4_define([b4_value_type_declare],
|
|||||||
template <typename T>
|
template <typename T>
|
||||||
T&
|
T&
|
||||||
emplace (const T& t)
|
emplace (const T& t)
|
||||||
{]b4_parse_assert_if([
|
{]b4_parse_assert_if([[
|
||||||
YY_ASSERT (!yytypeid_);
|
]b4_assert[ (!yytypeid_);
|
||||||
YY_ASSERT (sizeof (T) <= size);
|
]b4_assert[ (sizeof (T) <= size);
|
||||||
yytypeid_ = & typeid (T);])[
|
yytypeid_ = & typeid (T);]])[
|
||||||
return *new (yyas_<T> ()) T (t);
|
return *new (yyas_<T> ()) T (t);
|
||||||
}
|
}
|
||||||
# endif
|
# endif
|
||||||
@@ -185,10 +192,10 @@ m4_define([b4_value_type_declare],
|
|||||||
template <typename T>
|
template <typename T>
|
||||||
T&
|
T&
|
||||||
as () YY_NOEXCEPT
|
as () YY_NOEXCEPT
|
||||||
{]b4_parse_assert_if([
|
{]b4_parse_assert_if([[
|
||||||
YY_ASSERT (yytypeid_);
|
]b4_assert[ (yytypeid_);
|
||||||
YY_ASSERT (*yytypeid_ == typeid (T));
|
]b4_assert[ (*yytypeid_ == typeid (T));
|
||||||
YY_ASSERT (sizeof (T) <= size);])[
|
]b4_assert[ (sizeof (T) <= size);]])[
|
||||||
return *yyas_<T> ();
|
return *yyas_<T> ();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -196,10 +203,10 @@ m4_define([b4_value_type_declare],
|
|||||||
template <typename T>
|
template <typename T>
|
||||||
const T&
|
const T&
|
||||||
as () const YY_NOEXCEPT
|
as () const YY_NOEXCEPT
|
||||||
{]b4_parse_assert_if([
|
{]b4_parse_assert_if([[
|
||||||
YY_ASSERT (yytypeid_);
|
]b4_assert[ (yytypeid_);
|
||||||
YY_ASSERT (*yytypeid_ == typeid (T));
|
]b4_assert[ (*yytypeid_ == typeid (T));
|
||||||
YY_ASSERT (sizeof (T) <= size);])[
|
]b4_assert[ (sizeof (T) <= size);]])[
|
||||||
return *yyas_<T> ();
|
return *yyas_<T> ();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -214,9 +221,9 @@ m4_define([b4_value_type_declare],
|
|||||||
template <typename T>
|
template <typename T>
|
||||||
void
|
void
|
||||||
swap (self_type& that) YY_NOEXCEPT
|
swap (self_type& that) YY_NOEXCEPT
|
||||||
{]b4_parse_assert_if([
|
{]b4_parse_assert_if([[
|
||||||
YY_ASSERT (yytypeid_);
|
]b4_assert[ (yytypeid_);
|
||||||
YY_ASSERT (*yytypeid_ == *that.yytypeid_);])[
|
]b4_assert[ (*yytypeid_ == *that.yytypeid_);]])[
|
||||||
std::swap (as<T> (), that.as<T> ());
|
std::swap (as<T> (), that.as<T> ());
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -388,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...)
|
||||||
@@ -410,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],
|
||||||
@@ -422,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($@)[);
|
||||||
|
]])[}
|
||||||
]])])
|
]])])
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
+101
-99
@@ -1,11 +1,11 @@
|
|||||||
# -*- C -*-
|
# -*- C -*-
|
||||||
# Yacc compatible skeleton for Bison
|
# Yacc compatible skeleton for Bison
|
||||||
|
|
||||||
# Copyright (C) 1984, 1989-1990, 2000-2015, 2018-2020 Free Software
|
# Copyright (C) 1984, 1989-1990, 2000-2015, 2018-2021 Free Software
|
||||||
# Foundation, Inc.
|
# Foundation, Inc.
|
||||||
|
|
||||||
m4_pushdef([b4_copyright_years],
|
m4_pushdef([b4_copyright_years],
|
||||||
[1984, 1989-1990, 2000-2015, 2018-2020])
|
[1984, 1989-1990, 2000-2015, 2018-2021])
|
||||||
|
|
||||||
# This program is free software: you can redistribute it and/or modify
|
# This program is free software: you can redistribute it and/or modify
|
||||||
# it under the terms of the GNU General Public License as published by
|
# it under the terms of the GNU General Public License as published by
|
||||||
@@ -48,6 +48,10 @@ m4_define([b4_pure_if],
|
|||||||
## api.push-pull. ##
|
## api.push-pull. ##
|
||||||
## --------------- ##
|
## --------------- ##
|
||||||
|
|
||||||
|
# b4_pull_if, b4_push_if
|
||||||
|
# ----------------------
|
||||||
|
# Whether the pull/push APIs are needed. Both can be enabled.
|
||||||
|
|
||||||
b4_percent_define_default([[api.push-pull]], [[pull]])
|
b4_percent_define_default([[api.push-pull]], [[pull]])
|
||||||
b4_percent_define_check_values([[[[api.push-pull]],
|
b4_percent_define_check_values([[[[api.push-pull]],
|
||||||
[[pull]], [[push]], [[both]]]])
|
[[pull]], [[push]], [[both]]]])
|
||||||
@@ -155,7 +159,7 @@ m4_define([b4_rhs_location],
|
|||||||
# Declare the variables that are global, or local to YYPARSE if
|
# Declare the variables that are global, or local to YYPARSE if
|
||||||
# pure-parser.
|
# pure-parser.
|
||||||
m4_define([b4_declare_scanner_communication_variables], [[
|
m4_define([b4_declare_scanner_communication_variables], [[
|
||||||
/* The lookahead symbol. */
|
/* Lookahead token kind. */
|
||||||
int yychar;
|
int yychar;
|
||||||
|
|
||||||
]b4_pure_if([[
|
]b4_pure_if([[
|
||||||
@@ -176,68 +180,47 @@ YYLTYPE yylloc]b4_yyloc_default[;]])[
|
|||||||
int yynerrs;]])])
|
int yynerrs;]])])
|
||||||
|
|
||||||
|
|
||||||
# b4_declare_parser_state_variables
|
# b4_declare_parser_state_variables([INIT])
|
||||||
# ---------------------------------
|
# -----------------------------------------
|
||||||
# Declare all the variables that are needed to maintain the parser state
|
# Declare all the variables that are needed to maintain the parser state
|
||||||
# between calls to yypush_parse.
|
# between calls to yypush_parse.
|
||||||
|
# If INIT is non-null, initialize these variables.
|
||||||
m4_define([b4_declare_parser_state_variables],
|
m4_define([b4_declare_parser_state_variables],
|
||||||
[b4_pure_if([[
|
[b4_pure_if([[
|
||||||
/* Number of syntax errors so far. */
|
/* Number of syntax errors so far. */
|
||||||
int yynerrs;
|
int yynerrs]m4_ifval([$1], [ = 0])[;
|
||||||
]])[
|
]])[
|
||||||
yy_state_fast_t yystate;
|
yy_state_fast_t yystate]m4_ifval([$1], [ = 0])[;
|
||||||
/* Number of tokens to shift before error messages enabled. */
|
/* Number of tokens to shift before error messages enabled. */
|
||||||
int yyerrstatus;
|
int yyerrstatus]m4_ifval([$1], [ = 0])[;
|
||||||
|
|
||||||
/* The stacks and their tools:
|
/* Refer to the stacks through separate pointers, to allow yyoverflow
|
||||||
'yyss': related to states.
|
|
||||||
'yyvs': related to semantic values.]b4_locations_if([[
|
|
||||||
'yyls': related to locations.]])[
|
|
||||||
|
|
||||||
Refer to the stacks through separate pointers, to allow yyoverflow
|
|
||||||
to reallocate them elsewhere. */
|
to reallocate them elsewhere. */
|
||||||
|
|
||||||
/* Their size. */
|
/* Their size. */
|
||||||
YYPTRDIFF_T yystacksize;
|
YYPTRDIFF_T yystacksize]m4_ifval([$1], [ = YYINITDEPTH])[;
|
||||||
|
|
||||||
/* The state stack. */
|
/* The state stack: array, bottom, top. */
|
||||||
yy_state_t yyssa[YYINITDEPTH];
|
yy_state_t yyssa[YYINITDEPTH];
|
||||||
yy_state_t *yyss;
|
yy_state_t *yyss]m4_ifval([$1], [ = yyssa])[;
|
||||||
yy_state_t *yyssp;
|
yy_state_t *yyssp]m4_ifval([$1], [ = yyss])[;
|
||||||
|
|
||||||
/* The semantic value stack. */
|
/* The semantic value stack: array, bottom, top. */
|
||||||
YYSTYPE yyvsa[YYINITDEPTH];
|
YYSTYPE yyvsa[YYINITDEPTH];
|
||||||
YYSTYPE *yyvs;
|
YYSTYPE *yyvs]m4_ifval([$1], [ = yyvsa])[;
|
||||||
YYSTYPE *yyvsp;]b4_locations_if([[
|
YYSTYPE *yyvsp]m4_ifval([$1], [ = yyvs])[;]b4_locations_if([[
|
||||||
|
|
||||||
/* The location stack. */
|
/* The location stack: array, bottom, top. */
|
||||||
YYLTYPE yylsa[YYINITDEPTH];
|
YYLTYPE yylsa[YYINITDEPTH];
|
||||||
YYLTYPE *yyls;
|
YYLTYPE *yyls]m4_ifval([$1], [ = yylsa])[;
|
||||||
YYLTYPE *yylsp;]])[]b4_lac_if([[
|
YYLTYPE *yylsp]m4_ifval([$1], [ = yyls])[;]])[]b4_lac_if([[
|
||||||
|
|
||||||
yy_state_t yyesa@{]b4_percent_define_get([[parse.lac.es-capacity-initial]])[@};
|
yy_state_t yyesa@{]b4_percent_define_get([[parse.lac.es-capacity-initial]])[@};
|
||||||
yy_state_t *yyes;
|
yy_state_t *yyes]m4_ifval([$1], [ = yyesa])[;
|
||||||
YYPTRDIFF_T yyes_capacity;]])])
|
YYPTRDIFF_T yyes_capacity][]m4_ifval([$1],
|
||||||
|
[m4_do([ = b4_percent_define_get([[parse.lac.es-capacity-initial]]) < YYMAXDEPTH],
|
||||||
|
[ ? b4_percent_define_get([[parse.lac.es-capacity-initial]])],
|
||||||
# b4_initialize_parser_state_variables
|
[ : YYMAXDEPTH])])[;]])])
|
||||||
# ------------------------------------
|
|
||||||
# Initialize these variables.
|
|
||||||
m4_define([b4_initialize_parser_state_variables],
|
|
||||||
[[ yynerrs = 0;
|
|
||||||
yystate = 0;
|
|
||||||
yyerrstatus = 0;
|
|
||||||
|
|
||||||
yystacksize = YYINITDEPTH;
|
|
||||||
yyssp = yyss = yyssa;
|
|
||||||
yyvsp = yyvs = yyvsa;]b4_locations_if([[
|
|
||||||
yylsp = yyls = yylsa;]])[]b4_lac_if([[
|
|
||||||
|
|
||||||
yyes = yyesa;
|
|
||||||
yyes_capacity = ]b4_percent_define_get([[parse.lac.es-capacity-initial]])[;
|
|
||||||
if (YYMAXDEPTH < yyes_capacity)
|
|
||||||
yyes_capacity = YYMAXDEPTH;]])[
|
|
||||||
]])
|
|
||||||
|
|
||||||
|
|
||||||
m4_define([b4_macro_define],
|
m4_define([b4_macro_define],
|
||||||
@@ -313,14 +296,14 @@ m4_define([b4_declare_yyparse],
|
|||||||
# Declaration that might either go into the header (if --defines)
|
# Declaration that might either go into the header (if --defines)
|
||||||
# or open coded in the parser body.
|
# or open coded in the parser body.
|
||||||
m4_define([b4_shared_declarations],
|
m4_define([b4_shared_declarations],
|
||||||
[b4_cpp_guard_open([b4_spec_header_file])[
|
[b4_cpp_guard_open([b4_spec_mapped_header_file])[
|
||||||
]b4_declare_yydebug[
|
]b4_declare_yydebug[
|
||||||
]b4_percent_code_get([[requires]])[
|
]b4_percent_code_get([[requires]])[
|
||||||
]b4_token_enums_defines[
|
]b4_token_enums_defines[
|
||||||
]b4_declare_yylstype[
|
]b4_declare_yylstype[
|
||||||
]b4_declare_yyparse[
|
]b4_declare_yyparse[
|
||||||
]b4_percent_code_get([[provides]])[
|
]b4_percent_code_get([[provides]])[
|
||||||
]b4_cpp_guard_close([b4_spec_header_file])[]dnl
|
]b4_cpp_guard_close([b4_spec_mapped_header_file])[]dnl
|
||||||
])
|
])
|
||||||
|
|
||||||
|
|
||||||
@@ -335,7 +318,7 @@ m4_define([b4_header_include_if],
|
|||||||
[$2])],
|
[$2])],
|
||||||
[$2])])
|
[$2])])
|
||||||
|
|
||||||
m4_if(b4_spec_header_file, [[y.tab.h]],
|
m4_if(b4_spec_header_file, [y.tab.h], [],
|
||||||
[b4_percent_define_default([[api.header.include]],
|
[b4_percent_define_default([[api.header.include]],
|
||||||
[["@basename(]b4_spec_header_file[@)"]])])
|
[["@basename(]b4_spec_header_file[@)"]])])
|
||||||
|
|
||||||
@@ -592,7 +575,8 @@ union yyalloc
|
|||||||
/* YYNSTATES -- Number of states. */
|
/* YYNSTATES -- Number of states. */
|
||||||
#define YYNSTATES ]b4_states_number[
|
#define YYNSTATES ]b4_states_number[
|
||||||
|
|
||||||
#define YYMAXUTOK ]b4_user_token_number_max[
|
/* YYMAXUTOK -- Last valid token kind. */
|
||||||
|
#define YYMAXUTOK ]b4_code_max[
|
||||||
|
|
||||||
|
|
||||||
/* YYTRANSLATE(TOKEN-NUM) -- Symbol number corresponding to TOKEN-NUM
|
/* YYTRANSLATE(TOKEN-NUM) -- Symbol number corresponding to TOKEN-NUM
|
||||||
@@ -829,7 +813,8 @@ int yydebug;
|
|||||||
/* Parser data structure. */
|
/* Parser data structure. */
|
||||||
struct yypstate
|
struct yypstate
|
||||||
{]b4_declare_parser_state_variables[
|
{]b4_declare_parser_state_variables[
|
||||||
/* Whether this instance has not started parsing yet. */
|
/* Whether this instance has not started parsing yet.
|
||||||
|
* If 2, it corresponds to a finished parsing. */
|
||||||
int yynew;
|
int yynew;
|
||||||
};]b4_pure_if([], [[
|
};]b4_pure_if([], [[
|
||||||
|
|
||||||
@@ -1444,49 +1429,54 @@ yysyntax_error (YYPTRDIFF_T *yymsg_alloc, char **yymsg,
|
|||||||
int
|
int
|
||||||
yyparse (]m4_ifset([b4_parse_param], [b4_formals(b4_parse_param)], [void])[)
|
yyparse (]m4_ifset([b4_parse_param], [b4_formals(b4_parse_param)], [void])[)
|
||||||
{
|
{
|
||||||
return yypull_parse (YY_NULLPTR]b4_user_args[);
|
yypstate *yyps = yypstate_new ();
|
||||||
|
if (!yyps)
|
||||||
|
{]b4_pure_if([b4_locations_if([[
|
||||||
|
static YYLTYPE yyloc_default][]b4_yyloc_default[;
|
||||||
|
YYLTYPE yylloc = yyloc_default;]])[
|
||||||
|
yyerror (]b4_yyerror_args[YY_("memory exhausted"));]], [[
|
||||||
|
if (!yypstate_allocated)
|
||||||
|
yyerror (]b4_yyerror_args[YY_("memory exhausted"));]])[
|
||||||
|
return 2;
|
||||||
|
}
|
||||||
|
int yystatus = yypull_parse (yyps]b4_user_args[);
|
||||||
|
yypstate_delete (yyps);
|
||||||
|
return yystatus;
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
yypull_parse (yypstate *yyps]b4_user_formals[)
|
yypull_parse (yypstate *yyps]b4_user_formals[)
|
||||||
{]b4_pure_if([b4_locations_if([[
|
{
|
||||||
|
YY_ASSERT (yyps);]b4_pure_if([b4_locations_if([[
|
||||||
static YYLTYPE yyloc_default][]b4_yyloc_default[;
|
static YYLTYPE yyloc_default][]b4_yyloc_default[;
|
||||||
YYLTYPE yylloc = yyloc_default;]])])[
|
YYLTYPE yylloc = yyloc_default;]])])[
|
||||||
yypstate *yyps_local;
|
|
||||||
if (yyps)
|
|
||||||
yyps_local = yyps;
|
|
||||||
else
|
|
||||||
{
|
|
||||||
yyps_local = yypstate_new ();
|
|
||||||
if (!yyps_local)
|
|
||||||
{]b4_pure_if([[
|
|
||||||
yyerror (]b4_yyerror_args[YY_("memory exhausted"));]], [[
|
|
||||||
if (!yypstate_allocated)
|
|
||||||
yyerror (]b4_yyerror_args[YY_("memory exhausted"));]])[
|
|
||||||
return 2;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
int yystatus;
|
int yystatus;
|
||||||
do {
|
do {
|
||||||
]b4_pure_if([[ YYSTYPE yylval;
|
]b4_pure_if([[ YYSTYPE yylval;
|
||||||
int ]])[yychar = ]b4_lex[;
|
int ]])[yychar = ]b4_lex[;
|
||||||
yystatus = yypush_parse (yyps_local]b4_pure_if([[, yychar, &yylval]b4_locations_if([[, &yylloc]])])m4_ifset([b4_parse_param], [, b4_args(b4_parse_param)])[);
|
yystatus = yypush_parse (yyps]b4_pure_if([[, yychar, &yylval]b4_locations_if([[, &yylloc]])])m4_ifset([b4_parse_param], [, b4_args(b4_parse_param)])[);
|
||||||
} while (yystatus == YYPUSH_MORE);
|
} while (yystatus == YYPUSH_MORE);
|
||||||
if (!yyps)
|
|
||||||
yypstate_delete (yyps_local);
|
|
||||||
return yystatus;
|
return yystatus;
|
||||||
}]])[
|
}]])[
|
||||||
|
|
||||||
]b4_parse_state_variable_macros([b4_pstate_macro_define])[
|
]b4_parse_state_variable_macros([b4_pstate_macro_define])[
|
||||||
|
|
||||||
/* Initialize the parser data structure. */
|
/* Initialize the parser data structure. */
|
||||||
void
|
static void
|
||||||
yypstate_clear (yypstate *yyps)
|
yypstate_clear (yypstate *yyps)
|
||||||
{
|
{
|
||||||
]b4_initialize_parser_state_variables[
|
yynerrs = 0;
|
||||||
|
yystate = 0;
|
||||||
|
yyerrstatus = 0;
|
||||||
|
|
||||||
|
yyssp = yyss;
|
||||||
|
yyvsp = yyvs;]b4_locations_if([[
|
||||||
|
yylsp = yyls;]])[
|
||||||
|
|
||||||
/* Initialize the state stack, in case yypcontext_expected_tokens is
|
/* Initialize the state stack, in case yypcontext_expected_tokens is
|
||||||
called before the first call to yyparse. */
|
called before the first call to yyparse. */
|
||||||
*yyssp = 0;
|
*yyssp = 0;
|
||||||
|
yyps->yynew = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Initialize the parser data structure. */
|
/* Initialize the parser data structure. */
|
||||||
@@ -1496,11 +1486,18 @@ yypstate_new (void)
|
|||||||
yypstate *yyps;]b4_pure_if([], [[
|
yypstate *yyps;]b4_pure_if([], [[
|
||||||
if (yypstate_allocated)
|
if (yypstate_allocated)
|
||||||
return YY_NULLPTR;]])[
|
return YY_NULLPTR;]])[
|
||||||
yyps = YY_CAST (yypstate *, malloc (sizeof *yyps));
|
yyps = YY_CAST (yypstate *, YYMALLOC (sizeof *yyps));
|
||||||
if (!yyps)
|
if (!yyps)
|
||||||
return YY_NULLPTR;
|
return YY_NULLPTR;]b4_pure_if([], [[
|
||||||
yyps->yynew = 1;]b4_pure_if([], [[
|
|
||||||
yypstate_allocated = 1;]])[
|
yypstate_allocated = 1;]])[
|
||||||
|
yystacksize = YYINITDEPTH;
|
||||||
|
yyss = yyssa;
|
||||||
|
yyvs = yyvsa;]b4_locations_if([[
|
||||||
|
yyls = yylsa;]])[]b4_lac_if([[
|
||||||
|
yyes = yyesa;
|
||||||
|
yyes_capacity = ]b4_percent_define_get([[parse.lac.es-capacity-initial]])[;
|
||||||
|
if (YYMAXDEPTH < yyes_capacity)
|
||||||
|
yyes_capacity = YYMAXDEPTH;]])[
|
||||||
yypstate_clear (yyps);
|
yypstate_clear (yyps);
|
||||||
return yyps;
|
return yyps;
|
||||||
}
|
}
|
||||||
@@ -1513,12 +1510,12 @@ yypstate_delete (yypstate *yyps)
|
|||||||
#ifndef yyoverflow
|
#ifndef yyoverflow
|
||||||
/* If the stack was reallocated but the parse did not complete, then the
|
/* If the stack was reallocated but the parse did not complete, then the
|
||||||
stack still needs to be freed. */
|
stack still needs to be freed. */
|
||||||
if (!yyps->yynew && yyss != yyssa)
|
if (yyss != yyssa)
|
||||||
YYSTACK_FREE (yyss);
|
YYSTACK_FREE (yyss);
|
||||||
#endif]b4_lac_if([[
|
#endif]b4_lac_if([[
|
||||||
if (!yyps->yynew && yyes != yyesa)
|
if (yyes != yyesa)
|
||||||
YYSTACK_FREE (yyes);]])[
|
YYSTACK_FREE (yyes);]])[
|
||||||
free (yyps);]b4_pure_if([], [[
|
YYFREE (yyps);]b4_pure_if([], [[
|
||||||
yypstate_allocated = 0;]])[
|
yypstate_allocated = 0;]])[
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1545,14 +1542,14 @@ yyparse (]m4_ifset([b4_parse_param], [b4_formals(b4_parse_param)], [void])[)]])[
|
|||||||
YYSTYPE yypushed_val = yylval;]b4_locations_if([[
|
YYSTYPE yypushed_val = yylval;]b4_locations_if([[
|
||||||
YYLTYPE yypushed_loc = yylloc;]])
|
YYLTYPE yypushed_loc = yylloc;]])
|
||||||
])],
|
])],
|
||||||
[b4_declare_parser_state_variables
|
[b4_declare_parser_state_variables([init])
|
||||||
])b4_lac_if([[
|
])b4_lac_if([[
|
||||||
/* Whether LAC context is established. A Boolean. */
|
/* Whether LAC context is established. A Boolean. */
|
||||||
int yy_lac_established = 0;]])[
|
int yy_lac_established = 0;]])[
|
||||||
int yyn;
|
int yyn;
|
||||||
/* The return value of yyparse. */
|
/* The return value of yyparse. */
|
||||||
int yyresult;
|
int yyresult;
|
||||||
/* Lookahead token as an internal (translated) token number. */
|
/* Lookahead symbol kind. */
|
||||||
yysymbol_kind_t yytoken = ]b4_symbol(-2, kind)[;
|
yysymbol_kind_t yytoken = ]b4_symbol(-2, kind)[;
|
||||||
/* The variables used to return semantic value and location from the
|
/* The variables used to return semantic value and location from the
|
||||||
action routines. */
|
action routines. */
|
||||||
@@ -1572,14 +1569,19 @@ yyparse (]m4_ifset([b4_parse_param], [b4_formals(b4_parse_param)], [void])[)]])[
|
|||||||
|
|
||||||
/* The number of symbols on the RHS of the reduced rule.
|
/* The number of symbols on the RHS of the reduced rule.
|
||||||
Keep to zero when no symbol should be popped. */
|
Keep to zero when no symbol should be popped. */
|
||||||
int yylen = 0;
|
int yylen = 0;]b4_push_if([[
|
||||||
]b4_push_if([[
|
|
||||||
if (!yyps->yynew)
|
switch (yyps->yynew)
|
||||||
{
|
{
|
||||||
|
case 2:
|
||||||
|
yypstate_clear (yyps);
|
||||||
|
goto case_0;
|
||||||
|
|
||||||
|
case_0:
|
||||||
|
case 0:
|
||||||
yyn = yypact[yystate];
|
yyn = yypact[yystate];
|
||||||
goto yyread_pushed_token;
|
goto yyread_pushed_token;
|
||||||
}]], [
|
}]])[
|
||||||
b4_initialize_parser_state_variables])[
|
|
||||||
|
|
||||||
YYDPRINTF ((stderr, "Starting parse\n"));
|
YYDPRINTF ((stderr, "Starting parse\n"));
|
||||||
|
|
||||||
@@ -2048,13 +2050,13 @@ yyabortlab:
|
|||||||
yyexhaustedlab:
|
yyexhaustedlab:
|
||||||
yyerror (]b4_yyerror_args[YY_("memory exhausted"));
|
yyerror (]b4_yyerror_args[YY_("memory exhausted"));
|
||||||
yyresult = 2;
|
yyresult = 2;
|
||||||
/* Fall through. */
|
goto yyreturn;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
/*-----------------------------------------------------.
|
/*-------------------------------------------------------.
|
||||||
| yyreturn -- parsing is finished, return the result. |
|
| yyreturn -- parsing is finished, clean up and return. |
|
||||||
`-----------------------------------------------------*/
|
`-------------------------------------------------------*/
|
||||||
yyreturn:
|
yyreturn:
|
||||||
if (yychar != ]b4_symbol(-2, id)[)
|
if (yychar != ]b4_symbol(-2, id)[)
|
||||||
{
|
{
|
||||||
@@ -2073,21 +2075,21 @@ yyreturn:
|
|||||||
yydestruct ("Cleanup: popping",
|
yydestruct ("Cleanup: popping",
|
||||||
YY_ACCESSING_SYMBOL (+*yyssp), yyvsp]b4_locations_if([, yylsp])[]b4_user_args[);
|
YY_ACCESSING_SYMBOL (+*yyssp), yyvsp]b4_locations_if([, yylsp])[]b4_user_args[);
|
||||||
YYPOPSTACK (1);
|
YYPOPSTACK (1);
|
||||||
}
|
}]b4_push_if([[
|
||||||
|
yyps->yynew = 2;
|
||||||
|
goto yypushreturn;
|
||||||
|
|
||||||
|
|
||||||
|
/*-------------------------.
|
||||||
|
| yypushreturn -- return. |
|
||||||
|
`-------------------------*/
|
||||||
|
yypushreturn:]], [[
|
||||||
#ifndef yyoverflow
|
#ifndef yyoverflow
|
||||||
if (yyss != yyssa)
|
if (yyss != yyssa)
|
||||||
YYSTACK_FREE (yyss);
|
YYSTACK_FREE (yyss);
|
||||||
#endif]b4_lac_if([[
|
#endif]b4_lac_if([[
|
||||||
if (yyes != yyesa)
|
if (yyes != yyesa)
|
||||||
YYSTACK_FREE (yyes);]])b4_push_if([[
|
YYSTACK_FREE (yyes);]])])[
|
||||||
yypstate_clear (yyps);
|
|
||||||
yyps->yynew = 1;
|
|
||||||
|
|
||||||
|
|
||||||
/*-----------------------------------------.
|
|
||||||
| yypushreturn -- ask for the next token. |
|
|
||||||
`-----------------------------------------*/
|
|
||||||
yypushreturn:]])[
|
|
||||||
]b4_parse_error_bmatch([detailed\|verbose],
|
]b4_parse_error_bmatch([detailed\|verbose],
|
||||||
[[ if (yymsg != yymsgbuf)
|
[[ if (yymsg != yymsgbuf)
|
||||||
YYSTACK_FREE (yymsg);]])[
|
YYSTACK_FREE (yymsg);]])[
|
||||||
|
|||||||
+1
-1
@@ -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.
|
||||||
|
|
||||||
|
|||||||
@@ -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.
|
||||||
|
|
||||||
@@ -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>
|
||||||
|
|||||||
+19
-11
@@ -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.
|
||||||
|
|
||||||
@@ -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">
|
||||||
|
|||||||
+80
-56
@@ -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.
|
||||||
|
|
||||||
@@ -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 {
|
||||||
@@ -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">
|
||||||
|
|||||||
+19
-14
@@ -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
|
||||||
@@ -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
|
||||||
@@ -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
|
||||||
|
|||||||
+1121
-321
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 ";" • |
|
||||||
`----------------'
|
`----------------'
|
||||||
|
|||||||
+9
-9
@@ -2,34 +2,34 @@
|
|||||||
// Report bugs to <[email protected]>.
|
// Report bugs to <[email protected]>.
|
||||||
// Home page: <http://www.gnu.org/software/bison/>.
|
// Home page: <http://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"
|
||||||
+2
-2
@@ -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
|
||||||
@@ -57,7 +57,7 @@ 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/archive/html/help-texinfo/2019-11/msg00004.html
|
||||||
all: $(srcdir)/$(%C%_bison).info.bak
|
all-local: $(srcdir)/$(%C%_bison).info.bak
|
||||||
$(srcdir)/$(%C%_bison).info.bak: $(srcdir)/$(%C%_bison).info
|
$(srcdir)/$(%C%_bison).info.bak: $(srcdir)/$(%C%_bison).info
|
||||||
$(AM_V_GEN) $(PERL) -pi.bak -0777 \
|
$(AM_V_GEN) $(PERL) -pi.bak -0777 \
|
||||||
-e 's{(^ --.*\n(?: {10}.*\n)*)}' \
|
-e 's{(^ --.*\n(?: {10}.*\n)*)}' \
|
||||||
|
|||||||
+1
-1
@@ -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.
|
||||||
|
|||||||
@@ -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.
|
||||||
|
|
||||||
|
-->
|
||||||
+122
-51
@@ -1,6 +1,6 @@
|
|||||||
#! /usr/bin/perl -w
|
#! /usr/bin/perl -w
|
||||||
|
|
||||||
# Copyright (C) 2006, 2008-2015, 2018-2020 Free Software Foundation,
|
# Copyright (C) 2006, 2008-2015, 2018-2021 Free Software Foundation,
|
||||||
# Inc.
|
# Inc.
|
||||||
#
|
#
|
||||||
# This file is part of Bison, the GNU Compiler Compiler.
|
# This file is part of Bison, the GNU Compiler Compiler.
|
||||||
@@ -185,13 +185,13 @@ my $verbose = 1;
|
|||||||
|
|
||||||
=over 4
|
=over 4
|
||||||
|
|
||||||
=item C<verbose($level, $message)>
|
=item C<verbose ($level, $message)>
|
||||||
|
|
||||||
Report the C<$message> is C<$level> E<lt>= C<$verbose>.
|
Report the C<$message> is C<$level> E<lt>= C<$verbose>.
|
||||||
|
|
||||||
=cut
|
=cut
|
||||||
|
|
||||||
sub verbose($$)
|
sub verbose ($$)
|
||||||
{
|
{
|
||||||
my ($level, $message) = @_;
|
my ($level, $message) = @_;
|
||||||
print STDERR $message
|
print STDERR $message
|
||||||
@@ -201,13 +201,13 @@ sub verbose($$)
|
|||||||
|
|
||||||
######################################################################
|
######################################################################
|
||||||
|
|
||||||
=item C<directives($bench, @directive)>
|
=item C<directives ($bench, @directive)>
|
||||||
|
|
||||||
Format the list of directives for Bison for bench named C<$bench>.
|
Format the list of directives for Bison for bench named C<$bench>.
|
||||||
|
|
||||||
=cut
|
=cut
|
||||||
|
|
||||||
sub directives($@)
|
sub directives ($@)
|
||||||
{
|
{
|
||||||
my ($bench, @directive) = @_;
|
my ($bench, @directive) = @_;
|
||||||
my $res = "/* Directives for bench '$bench'. */\n";
|
my $res = "/* Directives for bench '$bench'. */\n";
|
||||||
@@ -218,6 +218,27 @@ sub directives($@)
|
|||||||
|
|
||||||
######################################################################
|
######################################################################
|
||||||
|
|
||||||
|
=item C<is_pure (@directive)>
|
||||||
|
|
||||||
|
Whether api.pure is set.
|
||||||
|
|
||||||
|
=cut
|
||||||
|
|
||||||
|
sub is_pure (@)
|
||||||
|
{
|
||||||
|
my (@directive) = @_;
|
||||||
|
for my $dir (@directive)
|
||||||
|
{
|
||||||
|
if ($dir =~ /\A%define api.pure/)
|
||||||
|
{
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
######################################################################
|
||||||
|
|
||||||
=item C<generate_grammar_triangular ($base, $max, @directive)>
|
=item C<generate_grammar_triangular ($base, $max, @directive)>
|
||||||
|
|
||||||
Create a large triangular grammar which looks like :
|
Create a large triangular grammar which looks like :
|
||||||
@@ -389,18 +410,14 @@ sub generate_grammar_calc ($$@)
|
|||||||
%define api.value.type union
|
%define api.value.type union
|
||||||
$directives
|
$directives
|
||||||
|
|
||||||
%{
|
%code provides {
|
||||||
static int power (int base, int exponent);
|
static int power (int base, int exponent);
|
||||||
/* yyerror receives the location if:
|
/* yyerror receives the location if:
|
||||||
- %location & %pure & %glr
|
- %location & %pure & %glr
|
||||||
- %location & %pure & %yacc & %parse-param. */
|
- %location & %pure & %yacc & %parse-param. */
|
||||||
static void yyerror (const char *s);
|
static void yyerror (const char *s);
|
||||||
#if YYPURE
|
static int yylex (@{[is_pure (@directive) ? "YYSTYPE *yylvalp" : "void"]});
|
||||||
static int yylex (YYSTYPE* yylvalp);
|
}
|
||||||
#else
|
|
||||||
static int yylex (void);
|
|
||||||
#endif
|
|
||||||
%}
|
|
||||||
|
|
||||||
/* Bison Declarations */
|
/* Bison Declarations */
|
||||||
%token
|
%token
|
||||||
@@ -467,12 +484,7 @@ yyerror (const char *s)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
#if YYPURE
|
yylex (@{[is_pure (@directive) ? "YYSTYPE *yylvalp" : "void"]})
|
||||||
# define yylval (*yylvalp)
|
|
||||||
yylex (YYSTYPE* yylvalp)
|
|
||||||
#else
|
|
||||||
yylex (void)
|
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
int c;
|
int c;
|
||||||
|
|
||||||
@@ -498,14 +510,15 @@ yylex (void)
|
|||||||
case '5': case '6': case '7': case '8': case '9':
|
case '5': case '6': case '7': case '8': case '9':
|
||||||
{
|
{
|
||||||
int nchars = 0;
|
int nchars = 0;
|
||||||
sscanf (input - 1, "%d%n", &yylval.NUM, &nchars);
|
int n = sscanf (input - 1, "%d%n", &@{[is_pure (@directive) ? "yylvalp->" : "yylval."]}NUM, &nchars);
|
||||||
|
assert (n == 1);
|
||||||
input += nchars - 1;
|
input += nchars - 1;
|
||||||
return NUM;
|
return NUM;
|
||||||
}
|
}
|
||||||
|
|
||||||
default:
|
default:
|
||||||
yyerror ("error: invalid character");
|
yyerror ("error: invalid character");
|
||||||
return yylex ();
|
return yylex (@{[is_pure (@directive) ? "yylvalp" : ""]});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
EOF
|
EOF
|
||||||
@@ -591,10 +604,10 @@ $directives
|
|||||||
// Prototype of the yylex function providing subsequent tokens.
|
// Prototype of the yylex function providing subsequent tokens.
|
||||||
static
|
static
|
||||||
#if USE_TOKEN_CTOR
|
#if USE_TOKEN_CTOR
|
||||||
yy::parser::symbol_type yylex();
|
yy::parser::symbol_type yylex ();
|
||||||
#else
|
#else
|
||||||
yy::parser::token_type yylex(yy::parser::semantic_type* yylvalp,
|
yy::parser::token_type yylex (yy::parser::semantic_type *yylvalp,
|
||||||
yy::parser::location_type* yyllocp);
|
yy::parser::location_type *yyllocp);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Conversion to string.
|
// Conversion to string.
|
||||||
@@ -617,8 +630,8 @@ EOF
|
|||||||
print $out <<'EOF';
|
print $out <<'EOF';
|
||||||
%token <std::string> TEXT
|
%token <std::string> TEXT
|
||||||
%token <int> NUMBER
|
%token <int> NUMBER
|
||||||
%printer { std::cerr << "Number: " << $$; } <int>
|
%printer { yyo << "Number: " << $$; } <int>
|
||||||
%printer { std::cerr << "Text: " << $$; } <std::string>
|
%printer { yyo << "Text: " << $$; } <std::string>
|
||||||
%type <std::string> text result
|
%type <std::string> text result
|
||||||
|
|
||||||
%%
|
%%
|
||||||
@@ -640,8 +653,8 @@ EOF
|
|||||||
%union {int ival; std::string* sval;}
|
%union {int ival; std::string* sval;}
|
||||||
%token <sval> TEXT
|
%token <sval> TEXT
|
||||||
%token <ival> NUMBER
|
%token <ival> NUMBER
|
||||||
%printer { std::cerr << "Number: " << $$; } <ival>
|
%printer { yyo << "Number: " << $$; } <ival>
|
||||||
%printer { std::cerr << "Text: " << *$$; } <sval>
|
%printer { yyo << "Text: " << *$$; } <sval>
|
||||||
%type <sval> text result
|
%type <sval> text result
|
||||||
|
|
||||||
%%
|
%%
|
||||||
@@ -663,10 +676,10 @@ EOF
|
|||||||
|
|
||||||
static
|
static
|
||||||
#if USE_TOKEN_CTOR
|
#if USE_TOKEN_CTOR
|
||||||
yy::parser::symbol_type yylex()
|
yy::parser::symbol_type yylex ()
|
||||||
#else
|
#else
|
||||||
yy::parser::token_type yylex(yy::parser::semantic_type* yylvalp,
|
yy::parser::token_type yylex (yy::parser::semantic_type *yylvalp,
|
||||||
yy::parser::location_type* yyllocp)
|
yy::parser::location_type *yyllocp)
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
typedef yy::parser::location_type location_type;
|
typedef yy::parser::location_type location_type;
|
||||||
@@ -775,7 +788,31 @@ sub run ($)
|
|||||||
|
|
||||||
##################################################################
|
##################################################################
|
||||||
|
|
||||||
=item C<compile ($base)>
|
=item C<language ($base)>
|
||||||
|
|
||||||
|
The language to use depending on the %language specification in
|
||||||
|
C<$base.y>: C<c> or C<c++>.
|
||||||
|
|
||||||
|
=cut
|
||||||
|
|
||||||
|
sub language ($)
|
||||||
|
{
|
||||||
|
my ($base) = @_;
|
||||||
|
if ($gbench)
|
||||||
|
{
|
||||||
|
"c++";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
my $language = `sed -ne '/%language "\\(.*\\)"/{s//\\1/;p;q;}' $base.y`;
|
||||||
|
chomp $language;
|
||||||
|
$language eq 'C++' ? "c++" : "c";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
##################################################################
|
||||||
|
|
||||||
|
=item C<compiler ($base)>
|
||||||
|
|
||||||
The compiler to use depending on the %language specification in
|
The compiler to use depending on the %language specification in
|
||||||
C<$base.y>.
|
C<$base.y>.
|
||||||
@@ -785,16 +822,12 @@ C<$base.y>.
|
|||||||
sub compiler ($)
|
sub compiler ($)
|
||||||
{
|
{
|
||||||
my ($base) = @_;
|
my ($base) = @_;
|
||||||
if ($gbench)
|
my %compiler =
|
||||||
{
|
(
|
||||||
$cxx;
|
'c++' => $cxx,
|
||||||
}
|
'c' => $cc,
|
||||||
else
|
);
|
||||||
{
|
$compiler{language ($base)};
|
||||||
my $language = `sed -ne '/%language "\\(.*\\)"/{s//\\1/;p;q;}' $base.y`;
|
|
||||||
chomp $language;
|
|
||||||
$language eq 'C++' ? $cxx : $cc;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
##################################################################
|
##################################################################
|
||||||
@@ -805,21 +838,38 @@ Compile C<$base.y> to an executable.
|
|||||||
|
|
||||||
=cut
|
=cut
|
||||||
|
|
||||||
sub compile ($)
|
sub compile ($$)
|
||||||
{
|
{
|
||||||
my ($base) = @_;
|
my ($makefile, $base) = @_;
|
||||||
my $compiler = compiler ($base);
|
my $compiler = compiler ($base);
|
||||||
|
|
||||||
my $my_bison = `sed -ne '/[/][/] %bison "\\(.*\\)"/{s//\\1/;p;q;}' $base.y`;
|
my $my_bison = `sed -ne '/[/][/] %bison "\\(.*\\)"/{s//\\1/;p;q;}' $base.y`;
|
||||||
chop $my_bison;
|
chop $my_bison;
|
||||||
run ((length $my_bison ? $my_bison : $bison) . " $base.y -o $base.c");
|
my %ext =
|
||||||
|
(
|
||||||
|
'c++' => 'cc',
|
||||||
|
'c' => 'c',
|
||||||
|
);
|
||||||
|
my $ext = $ext{language ($base)};
|
||||||
if ($gbench)
|
if ($gbench)
|
||||||
{
|
{
|
||||||
run "$compiler -c -o $base.o $cflags $base.c";
|
print $makefile <<EOF;
|
||||||
|
$base.$ext: $base.y
|
||||||
|
\t@{[length $my_bison ? $my_bison : $bison]} $base.y -o $base.$ext
|
||||||
|
|
||||||
|
$base.o: $base.$ext
|
||||||
|
\t$compiler -c -o $base.o $cflags $base.$ext
|
||||||
|
EOF
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
run "$compiler -o $base $cflags $base.c";
|
print $makefile <<EOF;
|
||||||
|
$base.$ext: $base.y
|
||||||
|
\t@{[length $my_bison ? $my_bison : $bison]} $base.y -o $base.$ext
|
||||||
|
|
||||||
|
$base: $base.$ext
|
||||||
|
\t$compiler -o $base $cflags $base.$ext
|
||||||
|
EOF
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -849,11 +899,13 @@ sub bench_with_timethese ($@)
|
|||||||
# For each bench, capture the size.
|
# For each bench, capture the size.
|
||||||
my %size;
|
my %size;
|
||||||
|
|
||||||
|
my $makefile = new IO::File ">Makefile";
|
||||||
while (my ($name, $directives) = each %bench)
|
while (my ($name, $directives) = each %bench)
|
||||||
{
|
{
|
||||||
generate_grammar ($grammar, $name, $directives);
|
generate_grammar ($grammar, $name, $directives);
|
||||||
# Compile the executable.
|
# Compile the executable.
|
||||||
compile ($name);
|
compile ($makefile, $name);
|
||||||
|
run "make $name";
|
||||||
$bench{$name} = "system ('./$name');";
|
$bench{$name} = "system ('./$name');";
|
||||||
chop($size{$name} = `wc -c <$name`);
|
chop($size{$name} = `wc -c <$name`);
|
||||||
}
|
}
|
||||||
@@ -906,6 +958,20 @@ sub bench_with_gbenchmark ($@)
|
|||||||
my $readme = new IO::File ">README.md";
|
my $readme = new IO::File ">README.md";
|
||||||
print $readme <<EOF;
|
print $readme <<EOF;
|
||||||
compiler: $compiler $cflags
|
compiler: $compiler $cflags
|
||||||
|
EOF
|
||||||
|
|
||||||
|
my $makefile = new IO::File ">Makefile";
|
||||||
|
print $makefile <<EOF;
|
||||||
|
.PHONY: bench
|
||||||
|
bench: main
|
||||||
|
\t./main \$(BENCHFLAGS) | tee -a README.md
|
||||||
|
|
||||||
|
# Link the bench cases in a different order to run the bench case in a
|
||||||
|
# different order.
|
||||||
|
.PHONY: rand
|
||||||
|
rand:
|
||||||
|
\t-rm main
|
||||||
|
\tmake bench OBJECTS="\$\$(shuf -e \$(OBJECTS) | xargs)"
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
my @obj = ();
|
my @obj = ();
|
||||||
@@ -916,19 +982,24 @@ EOF
|
|||||||
print $m;
|
print $m;
|
||||||
print $readme $m;
|
print $readme $m;
|
||||||
generate_grammar ($grammar, $base, $directive[$i]);
|
generate_grammar ($grammar, $base, $directive[$i]);
|
||||||
compile ($base);
|
compile ($makefile, $base);
|
||||||
push @obj, "$base.o";
|
push @obj, "$base.o";
|
||||||
}
|
}
|
||||||
|
|
||||||
my $out = new IO::File ">main.c";
|
my $out = new IO::File ">main.cc";
|
||||||
print $out <<EOF;
|
print $out <<EOF;
|
||||||
#include <benchmark/benchmark.h>
|
#include <benchmark/benchmark.h>
|
||||||
|
|
||||||
BENCHMARK_MAIN();
|
BENCHMARK_MAIN();
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
run "$compiler -o main $cflags main.c @obj -lbenchmark";
|
print $makefile <<EOF;
|
||||||
run "./main | tee -a README.md";
|
OBJECTS = @{obj}
|
||||||
|
main: \$(OBJECTS)
|
||||||
|
\t$compiler -o main $cflags main.cc \$(OBJECTS) -lbenchmark
|
||||||
|
EOF
|
||||||
|
|
||||||
|
run "make";
|
||||||
}
|
}
|
||||||
|
|
||||||
######################################################################
|
######################################################################
|
||||||
|
|||||||
+3
-2
@@ -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
|
||||||
@@ -14,4 +14,5 @@
|
|||||||
## You should have received a copy of the GNU General Public License
|
## You should have received a copy of the GNU General Public License
|
||||||
## along with this program. If not, see <http://www.gnu.org/licenses/>.
|
## along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
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
|
||||||
|
|||||||
@@ -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
|
||||||
|
|||||||
@@ -36,7 +36,7 @@ fill-column: 76
|
|||||||
ispell-dictionary: "american"
|
ispell-dictionary: "american"
|
||||||
End:
|
End:
|
||||||
|
|
||||||
Copyright (C) 2018-2020 Free Software Foundation, Inc.
|
Copyright (C) 2018-2021 Free Software Foundation, Inc.
|
||||||
|
|
||||||
Permission is granted to copy, distribute and/or modify this document
|
Permission is granted to copy, distribute and/or modify this document
|
||||||
under the terms of the GNU Free Documentation License, Version 1.3 or
|
under the terms of the GNU Free Documentation License, Version 1.3 or
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
#! /bin/sh
|
#! /bin/sh
|
||||||
|
|
||||||
# Copyright (C) 2005-2015, 2018-2020 Free Software Foundation, Inc.
|
# Copyright (C) 2005-2015, 2018-2021 Free Software Foundation, Inc.
|
||||||
#
|
#
|
||||||
# This program is free software: you can redistribute it and/or modify
|
# This program is free software: you can redistribute it and/or modify
|
||||||
# it under the terms of the GNU General Public License as published by
|
# it under the terms of the GNU General Public License as published by
|
||||||
|
|||||||
@@ -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
|
||||||
|
|||||||
@@ -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
|
||||||
|
|||||||
@@ -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
|
||||||
|
|||||||
@@ -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
|
||||||
|
|||||||
@@ -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
|
||||||
|
|||||||
@@ -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
|
||||||
|
|||||||
+11
-2
@@ -53,7 +53,9 @@ push-parser model.
|
|||||||
This example demonstrates best practices when using Bison.
|
This example demonstrates best practices when using Bison.
|
||||||
- Its hand-written scanner tracks locations.
|
- Its hand-written scanner tracks locations.
|
||||||
- Its interface is pure.
|
- Its interface is pure.
|
||||||
- It uses the `error` token to get error recovery.
|
- It uses %params to pass user information to the parser and scanner.
|
||||||
|
- Its scanner uses the `error` token to signal lexical errors and enter
|
||||||
|
error recovery.
|
||||||
- Its interface is "incremental", well suited for interaction: it uses the
|
- Its interface is "incremental", well suited for interaction: it uses the
|
||||||
push-parser API to feed the parser with the incoming tokens.
|
push-parser API to feed the parser with the incoming tokens.
|
||||||
- It features an interactive command line with completion based on the
|
- It features an interactive command line with completion based on the
|
||||||
@@ -62,6 +64,13 @@ This example demonstrates best practices when using Bison.
|
|||||||
messages.
|
messages.
|
||||||
- It uses a custom syntax error with location, lookahead correction and
|
- It uses a custom syntax error with location, lookahead correction and
|
||||||
token internationalization.
|
token internationalization.
|
||||||
|
- Error messages quote the source with squiggles that underline the error:
|
||||||
|
```
|
||||||
|
> 123 456
|
||||||
|
1.5-7: syntax error: expected end of file or + or - or * or / or ^ before number
|
||||||
|
1 | 123 456
|
||||||
|
| ^~~
|
||||||
|
```
|
||||||
- It supports debug traces with semantic values.
|
- It supports debug traces with semantic values.
|
||||||
- It uses named references instead of the traditional $1, $2, etc.
|
- It uses named references instead of the traditional $1, $2, etc.
|
||||||
|
|
||||||
@@ -72,7 +81,7 @@ fill-column: 76
|
|||||||
ispell-dictionary: "american"
|
ispell-dictionary: "american"
|
||||||
End:
|
End:
|
||||||
|
|
||||||
Copyright (C) 2018-2020 Free Software Foundation, Inc.
|
Copyright (C) 2018-2021 Free Software Foundation, Inc.
|
||||||
|
|
||||||
This file is part of GNU bison, the GNU Compiler Compiler.
|
This file is part of GNU bison, the GNU Compiler Compiler.
|
||||||
|
|
||||||
|
|||||||
@@ -2,7 +2,9 @@
|
|||||||
This example demonstrates best practices when using Bison.
|
This example demonstrates best practices when using Bison.
|
||||||
- Its hand-written scanner tracks locations.
|
- Its hand-written scanner tracks locations.
|
||||||
- Its interface is pure.
|
- Its interface is pure.
|
||||||
- It uses the `error` token to get error recovery.
|
- It uses %params to pass user information to the parser and scanner.
|
||||||
|
- Its scanner uses the `error` token to signal lexical errors and enter
|
||||||
|
error recovery.
|
||||||
- Its interface is "incremental", well suited for interaction: it uses the
|
- Its interface is "incremental", well suited for interaction: it uses the
|
||||||
push-parser API to feed the parser with the incoming tokens.
|
push-parser API to feed the parser with the incoming tokens.
|
||||||
- It features an interactive command line with completion based on the
|
- It features an interactive command line with completion based on the
|
||||||
@@ -11,6 +13,13 @@ This example demonstrates best practices when using Bison.
|
|||||||
messages.
|
messages.
|
||||||
- It uses a custom syntax error with location, lookahead correction and
|
- It uses a custom syntax error with location, lookahead correction and
|
||||||
token internationalization.
|
token internationalization.
|
||||||
|
- Error messages quote the source with squiggles that underline the error:
|
||||||
|
```
|
||||||
|
> 123 456
|
||||||
|
1.5-7: syntax error: expected end of file or + or - or * or / or ^ before number
|
||||||
|
1 | 123 456
|
||||||
|
| ^~~
|
||||||
|
```
|
||||||
- It supports debug traces with semantic values.
|
- It supports debug traces with semantic values.
|
||||||
- It uses named references instead of the traditional $1, $2, etc.
|
- It uses named references instead of the traditional $1, $2, etc.
|
||||||
|
|
||||||
@@ -23,7 +32,7 @@ fill-column: 76
|
|||||||
ispell-dictionary: "american"
|
ispell-dictionary: "american"
|
||||||
End:
|
End:
|
||||||
|
|
||||||
Copyright (C) 2020 Free Software Foundation, Inc.
|
Copyright (C) 2020-2021 Free Software Foundation, Inc.
|
||||||
|
|
||||||
This file is part of Bison, the GNU Compiler Compiler.
|
This file is part of Bison, the GNU Compiler Compiler.
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
#! /bin/sh
|
#! /bin/sh
|
||||||
|
|
||||||
# Copyright (C) 2020 Free Software Foundation, Inc.
|
# Copyright (C) 2020-2021 Free Software Foundation, Inc.
|
||||||
#
|
#
|
||||||
# This program is free software: you can redistribute it and/or modify
|
# This program is free software: you can redistribute it and/or modify
|
||||||
# it under the terms of the GNU General Public License as published by
|
# it under the terms of the GNU General Public License as published by
|
||||||
@@ -45,7 +45,7 @@ echo >perfect '> 0
|
|||||||
echo >ok '0'
|
echo >ok '0'
|
||||||
echo '0' | prog >effective
|
echo '0' | prog >effective
|
||||||
|
|
||||||
echo "checking for readline output"
|
echo "checking for readline output..."
|
||||||
if diff perfect effective; then
|
if diff perfect effective; then
|
||||||
# Alles ist gut.
|
# Alles ist gut.
|
||||||
strip_prompt=false
|
strip_prompt=false
|
||||||
@@ -101,14 +101,28 @@ cat >input <<EOF
|
|||||||
EOF
|
EOF
|
||||||
run 0 '> *
|
run 0 '> *
|
||||||
> ''
|
> ''
|
||||||
err: 1.1: syntax error: expected end of file or - or ( or exit or number or function etc., before *'
|
err: 1.1: syntax error: expected end of file or - or ( or exit or number or function etc., before *
|
||||||
|
err: 1 | *
|
||||||
|
err: | ^'
|
||||||
|
|
||||||
|
# Underline long errors.
|
||||||
|
cat >input <<EOF
|
||||||
|
123 123456
|
||||||
|
EOF
|
||||||
|
run 0 '> 123 123456
|
||||||
|
> ''
|
||||||
|
err: 1.5-10: syntax error: expected end of file or + or - or * or / or ^ before number
|
||||||
|
err: 1 | 123 123456
|
||||||
|
err: | ^~~~~~'
|
||||||
|
|
||||||
cat >input <<EOF
|
cat >input <<EOF
|
||||||
1 + 2 * * 3
|
1 + 2 * * 3
|
||||||
EOF
|
EOF
|
||||||
run 0 '> 1 + 2 * * 3
|
run 0 '> 1 + 2 * * 3
|
||||||
> ''
|
> ''
|
||||||
err: 1.9: syntax error: expected - or ( or number or function or variable before *'
|
err: 1.9: syntax error: expected - or ( or number or function or variable before *
|
||||||
|
err: 1 | 1 + 2 * * 3
|
||||||
|
err: | ^'
|
||||||
|
|
||||||
cat >input <<EOF
|
cat >input <<EOF
|
||||||
1 / 0
|
1 / 0
|
||||||
@@ -132,8 +146,14 @@ run 0 '> ((1 ++ 2) ** 3)
|
|||||||
1332
|
1332
|
||||||
> ''
|
> ''
|
||||||
err: 1.6: syntax error: expected - or ( or number or function or variable before +
|
err: 1.6: syntax error: expected - or ( or number or function or variable before +
|
||||||
|
err: 1 | ((1 ++ 2) ** 3)
|
||||||
|
err: | ^
|
||||||
err: 2.5: syntax error: expected - or ( or number or function or variable before +
|
err: 2.5: syntax error: expected - or ( or number or function or variable before +
|
||||||
err: 2.16: syntax error: expected - or ( or number or function or variable before *'
|
err: 2 | (1 ++ 2) + (3 ** 4)
|
||||||
|
err: | ^
|
||||||
|
err: 2.16: syntax error: expected - or ( or number or function or variable before *
|
||||||
|
err: 2 | (1 ++ 2) + (3 ** 4)
|
||||||
|
err: | ^'
|
||||||
|
|
||||||
# The rule "( error )" should work even if there are no tokens between "(" and ")".
|
# The rule "( error )" should work even if there are no tokens between "(" and ")".
|
||||||
cat >input <<EOF
|
cat >input <<EOF
|
||||||
@@ -142,7 +162,9 @@ EOF
|
|||||||
run 0 '> ()
|
run 0 '> ()
|
||||||
666
|
666
|
||||||
> ''
|
> ''
|
||||||
err: 1.2: syntax error: expected - or ( or number or function or variable before )'
|
err: 1.2: syntax error: expected - or ( or number or function or variable before )
|
||||||
|
err: 1 | ()
|
||||||
|
err: | ^'
|
||||||
|
|
||||||
|
|
||||||
cat >input <<EOF
|
cat >input <<EOF
|
||||||
@@ -189,6 +211,8 @@ err: LAC: checking lookahead function: S5
|
|||||||
err: LAC: checking lookahead variable: S6
|
err: LAC: checking lookahead variable: S6
|
||||||
err: LAC: checking lookahead NEG: Err
|
err: LAC: checking lookahead NEG: Err
|
||||||
err: 1.2: syntax error: expected - or ( or number or function or variable before +
|
err: 1.2: syntax error: expected - or ( or number or function or variable before +
|
||||||
|
err: 1 | (+_)
|
||||||
|
err: | ^
|
||||||
err: LAC: initial context discarded due to error recovery
|
err: LAC: initial context discarded due to error recovery
|
||||||
err: Shifting token error (1.2: )
|
err: Shifting token error (1.2: )
|
||||||
err: Entering state 10
|
err: Entering state 10
|
||||||
@@ -227,29 +251,29 @@ err: Next token is token ) (1.4: )
|
|||||||
err: Shifting token ) (1.4: )
|
err: Shifting token ) (1.4: )
|
||||||
err: Entering state 20
|
err: Entering state 20
|
||||||
err: Stack now 0 2 10 20
|
err: Stack now 0 2 10 20
|
||||||
err: Reducing stack by rule 15 (line 151):
|
err: Reducing stack by rule XX (line XXX):
|
||||||
err: $1 = token ( (1.1: )
|
err: $1 = token ( (1.1: )
|
||||||
err: $2 = token error (1.2-3: )
|
err: $2 = token error (1.2-3: )
|
||||||
err: $3 = token ) (1.4: )
|
err: $3 = token ) (1.4: )
|
||||||
err: -> $$ = nterm exp (1.1-4: 666)
|
err: -> $$ = nterm exp (1.1-4: 666)
|
||||||
err: Entering state 7
|
err: Entering state 8
|
||||||
err: Stack now 0 7
|
err: Stack now 0 8
|
||||||
err: Return for a new token:
|
err: Return for a new token:
|
||||||
err: Reading a token
|
err: Reading a token
|
||||||
err: Now at end of input.
|
err: Now at end of input.
|
||||||
err: LAC: initial context established for end of file
|
err: LAC: initial context established for end of file
|
||||||
err: LAC: checking lookahead end of file: R2 G8 S19
|
err: LAC: checking lookahead end of file: R2 G7 S14
|
||||||
err: Reducing stack by rule 2 (line 126):
|
err: Reducing stack by rule XX (line XXX):
|
||||||
err: $1 = nterm exp (1.1-4: 666)
|
err: $1 = nterm exp (1.1-4: 666)
|
||||||
err: -> $$ = nterm input (1.1-4: )
|
err: -> $$ = nterm input (1.1-4: )
|
||||||
err: Entering state 8
|
err: Entering state 7
|
||||||
err: Stack now 0 8
|
err: Stack now 0 7
|
||||||
err: Now at end of input.
|
err: Now at end of input.
|
||||||
err: Shifting token end of file (1.5: )
|
err: Shifting token end of file (1.5: )
|
||||||
err: LAC: initial context discarded due to shift
|
err: LAC: initial context discarded due to shift
|
||||||
err: Entering state 19
|
err: Entering state 14
|
||||||
err: Stack now 0 8 19
|
err: Stack now 0 7 14
|
||||||
err: Stack now 0 8 19
|
err: Stack now 0 7 14
|
||||||
err: Cleanup: popping token end of file (1.5: )
|
err: Cleanup: popping token end of file (1.5: )
|
||||||
err: Cleanup: popping nterm input (1.1-4: )' -p
|
err: Cleanup: popping nterm input (1.1-4: )' -p
|
||||||
|
|
||||||
@@ -269,8 +293,8 @@ fi
|
|||||||
# On Windows10/MSYS2 the ^G coming from <tab> completion is not
|
# On Windows10/MSYS2 the ^G coming from <tab> completion is not
|
||||||
# emitted the same way
|
# emitted the same way
|
||||||
# (https://lists.gnu.org/r/bug-bison/2020-05/msg00076.html).
|
# (https://lists.gnu.org/r/bug-bison/2020-05/msg00076.html).
|
||||||
echo "checking for kernel name"
|
echo "checking for kernel name... $(uname -s)"
|
||||||
case `uname -s` in
|
case $(uname -s) in
|
||||||
(MSYS*)
|
(MSYS*)
|
||||||
echo "SKIP: this is Windows/MSYS"
|
echo "SKIP: this is Windows/MSYS"
|
||||||
exit $status
|
exit $status
|
||||||
@@ -286,7 +310,9 @@ run 0 '> (1+
|
|||||||
( - atan cos exp ln number sin sqrt
|
( - atan cos exp ln number sin sqrt
|
||||||
> (1+
|
> (1+
|
||||||
> ''
|
> ''
|
||||||
err: 1.4: syntax error: expected - or ( or number or function or variable before end of file'
|
err: 1.4: syntax error: expected - or ( or number or function or variable before end of file
|
||||||
|
err: 1 | (1+
|
||||||
|
err: | ^'
|
||||||
|
|
||||||
# Check the completion of a word.
|
# Check the completion of a word.
|
||||||
sed -e 's/\\t/ /g' >input <<EOF
|
sed -e 's/\\t/ /g' >input <<EOF
|
||||||
@@ -294,7 +320,9 @@ sed -e 's/\\t/ /g' >input <<EOF
|
|||||||
EOF
|
EOF
|
||||||
run 0 '> (atan ( ''
|
run 0 '> (atan ( ''
|
||||||
> ''
|
> ''
|
||||||
err: 1.9: syntax error: expected - or ( or number or function or variable before end of file'
|
err: 1.9: syntax error: expected - or ( or number or function or variable before end of file
|
||||||
|
err: 1 | (atan ( ''
|
||||||
|
err: | ^'
|
||||||
|
|
||||||
# Check the completion at the very beginning.
|
# Check the completion at the very beginning.
|
||||||
sed -e 's/\\t/ /g' >input <<EOF
|
sed -e 's/\\t/ /g' >input <<EOF
|
||||||
@@ -306,3 +334,28 @@ end of file exit exp ''
|
|||||||
0
|
0
|
||||||
> ''
|
> ''
|
||||||
err: '
|
err: '
|
||||||
|
|
||||||
|
# Check that completion prints valid locations even when there is an error.
|
||||||
|
sed -e 's/\\t/ /g' >input <<EOF
|
||||||
|
1++\t
|
||||||
|
EOF
|
||||||
|
run -n 0 '> 1++ ''
|
||||||
|
> ''
|
||||||
|
err: 1.3: syntax error: expected - or ( or number or function or variable before +
|
||||||
|
err: 1 | 1++ ''
|
||||||
|
err: | ^
|
||||||
|
'
|
||||||
|
|
||||||
|
# And even when the error was recovered from.
|
||||||
|
sed -e 's/\\t/ /g' >input <<EOF
|
||||||
|
(1++2) + 3 +\t\t
|
||||||
|
EOF
|
||||||
|
run -n 0 '> (1++2) + 3 + ''
|
||||||
|
> ''
|
||||||
|
err: 1.4: syntax error: expected - or ( or number or function or variable before +
|
||||||
|
err: 1 | (1++2) + 3 + ''
|
||||||
|
err: | ^
|
||||||
|
err: 1.15: syntax error: expected - or ( or number or function or variable before end of file
|
||||||
|
err: 1 | (1++2) + 3 + ''
|
||||||
|
err: | ^
|
||||||
|
'
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
## Copyright (C) 2020 Free Software Foundation, Inc.
|
## Copyright (C) 2020-2021 Free Software Foundation, Inc.
|
||||||
##
|
##
|
||||||
## This program is free software: you can redistribute it and/or modify
|
## This program is free software: you can redistribute it and/or modify
|
||||||
## it under the terms of the GNU General Public License as published by
|
## it under the terms of the GNU General Public License as published by
|
||||||
@@ -31,6 +31,7 @@ if ENABLE_BISTROMATHIC
|
|||||||
-DBISON_LOCALEDIR='"$(localdir)"' \
|
-DBISON_LOCALEDIR='"$(localdir)"' \
|
||||||
-DLOCALEDIR='"$(localdir)"' \
|
-DLOCALEDIR='"$(localdir)"' \
|
||||||
-I$(top_srcdir)/%D% -I$(top_builddir)/%D%
|
-I$(top_srcdir)/%D% -I$(top_builddir)/%D%
|
||||||
|
%C%_bistromathic_CFLAGS = $(TEST_CFLAGS)
|
||||||
%C%_bistromathic_LDADD = -lm $(LIBREADLINE) $(LIBINTL)
|
%C%_bistromathic_LDADD = -lm $(LIBREADLINE) $(LIBINTL)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
|||||||
+112
-34
@@ -1,7 +1,26 @@
|
|||||||
%require "3.6"
|
/* Parser and scanner for bistromathic. -*- C -*-
|
||||||
|
|
||||||
|
Copyright (C) 2019-2021 Free Software Foundation, Inc.
|
||||||
|
|
||||||
|
This file is part of Bison, the GNU Compiler Compiler.
|
||||||
|
|
||||||
|
This program is free software: you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation, either version 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
||||||
|
|
||||||
|
%require "3.7"
|
||||||
|
|
||||||
|
// Emitted on top of the implementation file.
|
||||||
%code top {
|
%code top {
|
||||||
#include <assert.h>
|
|
||||||
#include <ctype.h> // isdigit
|
#include <ctype.h> // isdigit
|
||||||
#include <locale.h> // LC_ALL
|
#include <locale.h> // LC_ALL
|
||||||
#include <math.h> // cos, sin, etc.
|
#include <math.h> // cos, sin, etc.
|
||||||
@@ -25,6 +44,7 @@
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Emitted in the header file, before the definition of YYSTYPE.
|
||||||
%code requires {
|
%code requires {
|
||||||
// Function type.
|
// Function type.
|
||||||
typedef double (func_t) (double);
|
typedef double (func_t) (double);
|
||||||
@@ -45,19 +65,34 @@
|
|||||||
|
|
||||||
symrec *putsym (char const *name, int sym_type);
|
symrec *putsym (char const *name, int sym_type);
|
||||||
symrec *getsym (char const *name);
|
symrec *getsym (char const *name);
|
||||||
|
|
||||||
|
// Exchanging information with the parser.
|
||||||
|
typedef struct
|
||||||
|
{
|
||||||
|
// Whether to not emit error messages.
|
||||||
|
int silent;
|
||||||
|
// The current input line.
|
||||||
|
const char *line;
|
||||||
|
} user_context;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Emitted in the header file, after the definition of YYSTYPE.
|
||||||
%code provides {
|
%code provides {
|
||||||
# ifndef __attribute__
|
# ifndef __attribute__
|
||||||
# ifndef __GNUC__
|
# ifndef __GNUC__
|
||||||
# define __attribute__(Spec) /* empty */
|
# define __attribute__(Spec) /* empty */
|
||||||
# endif
|
# endif
|
||||||
# endif
|
# endif
|
||||||
int yylex (const char **line, YYSTYPE *yylval, YYLTYPE *yylloc);
|
|
||||||
void yyerror (YYLTYPE *loc, char const *format, ...)
|
yytoken_kind_t
|
||||||
__attribute__ ((__format__ (__printf__, 2, 3)));
|
yylex (const char **line, YYSTYPE *yylval, YYLTYPE *yylloc,
|
||||||
|
const user_context *uctx);
|
||||||
|
void yyerror (YYLTYPE *loc, const user_context *uctx,
|
||||||
|
char const *format, ...)
|
||||||
|
__attribute__ ((__format__ (__printf__, 3, 4)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Emitted in the implementation file.
|
||||||
%code {
|
%code {
|
||||||
#if defined ENABLE_NLS && ENABLE_NLS
|
#if defined ENABLE_NLS && ENABLE_NLS
|
||||||
# define _(Msgid) gettext (Msgid)
|
# define _(Msgid) gettext (Msgid)
|
||||||
@@ -69,6 +104,9 @@
|
|||||||
int done = 0;
|
int done = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Include the header in the implementation rather than duplicating it.
|
||||||
|
%define api.header.include {"parse.h"}
|
||||||
|
|
||||||
// Don't share global variables between the scanner and the parser.
|
// Don't share global variables between the scanner and the parser.
|
||||||
%define api.pure full
|
%define api.pure full
|
||||||
|
|
||||||
@@ -91,6 +129,9 @@
|
|||||||
// Generate the parser description file (calc.output).
|
// Generate the parser description file (calc.output).
|
||||||
%verbose
|
%verbose
|
||||||
|
|
||||||
|
// User information exchanged with the parser and scanner.
|
||||||
|
%param {const user_context *uctx}
|
||||||
|
|
||||||
// Generate YYSTYPE from the types assigned to symbols.
|
// Generate YYSTYPE from the types assigned to symbols.
|
||||||
%define api.value.type union
|
%define api.value.type union
|
||||||
%token
|
%token
|
||||||
@@ -146,7 +187,7 @@ exp:
|
|||||||
{
|
{
|
||||||
if ($r == 0)
|
if ($r == 0)
|
||||||
{
|
{
|
||||||
yyerror (&@$, "error: division by zero");
|
yyerror (&@$, uctx, "error: division by zero");
|
||||||
YYERROR;
|
YYERROR;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -218,7 +259,7 @@ getsym (char const *name)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// How many symbols are registered.
|
// How many symbols are registered.
|
||||||
int
|
static int
|
||||||
symbol_count (void)
|
symbol_count (void)
|
||||||
{
|
{
|
||||||
int res = 0;
|
int res = 0;
|
||||||
@@ -232,8 +273,9 @@ symbol_count (void)
|
|||||||
| Scanner. |
|
| Scanner. |
|
||||||
`----------*/
|
`----------*/
|
||||||
|
|
||||||
int
|
yytoken_kind_t
|
||||||
yylex (const char **line, YYSTYPE *yylval, YYLTYPE *yylloc)
|
yylex (const char **line, YYSTYPE *yylval, YYLTYPE *yylloc,
|
||||||
|
const user_context *uctx)
|
||||||
{
|
{
|
||||||
int c;
|
int c;
|
||||||
|
|
||||||
@@ -268,7 +310,8 @@ yylex (const char **line, YYSTYPE *yylval, YYLTYPE *yylloc)
|
|||||||
case '5': case '6': case '7': case '8': case '9':
|
case '5': case '6': case '7': case '8': case '9':
|
||||||
{
|
{
|
||||||
int nchars = 0;
|
int nchars = 0;
|
||||||
sscanf (*line - 1, "%lf%n", &yylval->TOK_NUM, &nchars);
|
if (sscanf (*line - 1, "%lf%n", &yylval->TOK_NUM, &nchars) != 1)
|
||||||
|
abort ();
|
||||||
*line += nchars - 1;
|
*line += nchars - 1;
|
||||||
yylloc->last_column += nchars - 1;
|
yylloc->last_column += nchars - 1;
|
||||||
return TOK_NUM;
|
return TOK_NUM;
|
||||||
@@ -284,7 +327,8 @@ yylex (const char **line, YYSTYPE *yylval, YYLTYPE *yylloc)
|
|||||||
{
|
{
|
||||||
int nchars = 0;
|
int nchars = 0;
|
||||||
char buf[100];
|
char buf[100];
|
||||||
sscanf (*line - 1, "%99[a-z]%n", buf, &nchars);
|
if (sscanf (*line - 1, "%99[a-z]%n", buf, &nchars) != 1)
|
||||||
|
abort ();
|
||||||
*line += nchars - 1;
|
*line += nchars - 1;
|
||||||
yylloc->last_column += nchars - 1;
|
yylloc->last_column += nchars - 1;
|
||||||
if (strcmp (buf, "exit") == 0)
|
if (strcmp (buf, "exit") == 0)
|
||||||
@@ -301,7 +345,7 @@ yylex (const char **line, YYSTYPE *yylval, YYLTYPE *yylloc)
|
|||||||
|
|
||||||
// Stray characters.
|
// Stray characters.
|
||||||
default:
|
default:
|
||||||
yyerror (yylloc, "syntax error: invalid character: %c", c);
|
yyerror (yylloc, uctx, "syntax error: invalid character: %c", c);
|
||||||
return TOK_YYerror;
|
return TOK_YYerror;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -312,7 +356,7 @@ yylex (const char **line, YYSTYPE *yylval, YYLTYPE *yylloc)
|
|||||||
`---------*/
|
`---------*/
|
||||||
|
|
||||||
|
|
||||||
const char *
|
static const char *
|
||||||
error_format_string (int argc)
|
error_format_string (int argc)
|
||||||
{
|
{
|
||||||
switch (argc)
|
switch (argc)
|
||||||
@@ -339,8 +383,11 @@ error_format_string (int argc)
|
|||||||
|
|
||||||
|
|
||||||
int
|
int
|
||||||
yyreport_syntax_error (const yypcontext_t *ctx)
|
yyreport_syntax_error (const yypcontext_t *ctx, const user_context *uctx)
|
||||||
{
|
{
|
||||||
|
if (uctx->silent)
|
||||||
|
return 0;
|
||||||
|
|
||||||
enum { ARGS_MAX = 6 };
|
enum { ARGS_MAX = 6 };
|
||||||
yysymbol_kind_t arg[ARGS_MAX];
|
yysymbol_kind_t arg[ARGS_MAX];
|
||||||
int argsize = yypcontext_expected_tokens (ctx, arg, ARGS_MAX);
|
int argsize = yypcontext_expected_tokens (ctx, arg, ARGS_MAX);
|
||||||
@@ -351,11 +398,12 @@ yyreport_syntax_error (const yypcontext_t *ctx)
|
|||||||
argsize = ARGS_MAX;
|
argsize = ARGS_MAX;
|
||||||
const char *format = error_format_string (1 + argsize + too_many_expected_tokens);
|
const char *format = error_format_string (1 + argsize + too_many_expected_tokens);
|
||||||
|
|
||||||
|
const YYLTYPE *loc = yypcontext_location (ctx);
|
||||||
while (*format)
|
while (*format)
|
||||||
// %@: location.
|
// %@: location.
|
||||||
if (format[0] == '%' && format[1] == '@')
|
if (format[0] == '%' && format[1] == '@')
|
||||||
{
|
{
|
||||||
YY_LOCATION_PRINT (stderr, *yypcontext_location (ctx));
|
YY_LOCATION_PRINT (stderr, *loc);
|
||||||
format += 2;
|
format += 2;
|
||||||
}
|
}
|
||||||
// %u: unexpected token.
|
// %u: unexpected token.
|
||||||
@@ -380,13 +428,25 @@ yyreport_syntax_error (const yypcontext_t *ctx)
|
|||||||
++format;
|
++format;
|
||||||
}
|
}
|
||||||
fputc ('\n', stderr);
|
fputc ('\n', stderr);
|
||||||
|
|
||||||
|
// Quote the source line.
|
||||||
|
{
|
||||||
|
fprintf (stderr, "%5d | %s\n", loc->first_line, uctx->line);
|
||||||
|
fprintf (stderr, "%5s | %*s", "", loc->first_column, "^");
|
||||||
|
for (int i = loc->last_column - loc->first_column - 1; 0 < i; --i)
|
||||||
|
putc ('~', stderr);
|
||||||
|
putc ('\n', stderr);
|
||||||
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Called by yyparse on error.
|
// Called by yyparse on error.
|
||||||
void yyerror (YYLTYPE *loc, char const *format, ...)
|
void yyerror (YYLTYPE *loc, const user_context *uctx, char const *format, ...)
|
||||||
{
|
{
|
||||||
|
if (uctx->silent)
|
||||||
|
return;
|
||||||
|
|
||||||
YY_LOCATION_PRINT (stderr, *loc);
|
YY_LOCATION_PRINT (stderr, *loc);
|
||||||
fputs (": ", stderr);
|
fputs (": ", stderr);
|
||||||
va_list args;
|
va_list args;
|
||||||
@@ -407,7 +467,8 @@ xstrndup (const char *string, size_t n)
|
|||||||
const char *end = memchr (string, '\0', n);
|
const char *end = memchr (string, '\0', n);
|
||||||
size_t len = end ? (size_t) (end - string) : n;
|
size_t len = end ? (size_t) (end - string) : n;
|
||||||
char *new = malloc (len + 1);
|
char *new = malloc (len + 1);
|
||||||
assert (new);
|
if (!new)
|
||||||
|
abort ();
|
||||||
new[len] = '\0';
|
new[len] = '\0';
|
||||||
return memcpy (new, string, len);
|
return memcpy (new, string, len);
|
||||||
}
|
}
|
||||||
@@ -418,13 +479,16 @@ xstrndup (const char *string, size_t n)
|
|||||||
`-----------*/
|
`-----------*/
|
||||||
|
|
||||||
// Parse (and execute) this line.
|
// Parse (and execute) this line.
|
||||||
int process_line (YYLTYPE *lloc, const char *line)
|
static int
|
||||||
|
process_line (YYLTYPE *lloc, const char *line)
|
||||||
{
|
{
|
||||||
|
user_context uctx = {0, line};
|
||||||
yypstate *ps = yypstate_new ();
|
yypstate *ps = yypstate_new ();
|
||||||
int status = 0;
|
int status = 0;
|
||||||
do {
|
do {
|
||||||
YYSTYPE lval;
|
YYSTYPE lval;
|
||||||
status = yypush_parse (ps, yylex (&line, &lval, lloc), &lval, lloc);
|
yytoken_kind_t token = yylex (&line, &lval, lloc, &uctx);
|
||||||
|
status = yypush_parse (ps, token, &lval, lloc, &uctx);
|
||||||
} while (status == YYPUSH_MORE);
|
} while (status == YYPUSH_MORE);
|
||||||
yypstate_delete (ps);
|
yypstate_delete (ps);
|
||||||
lloc->last_line++;
|
lloc->last_line++;
|
||||||
@@ -433,27 +497,36 @@ int process_line (YYLTYPE *lloc, const char *line)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Get the list of possible tokens after INPUT was read.
|
// Get the list of possible tokens after INPUT was read.
|
||||||
int
|
// Returns a nonnegative.
|
||||||
|
static int
|
||||||
expected_tokens (const char *input,
|
expected_tokens (const char *input,
|
||||||
int *tokens, int ntokens)
|
int *tokens, int ntokens)
|
||||||
{
|
{
|
||||||
YYDPRINTF ((stderr, "expected_tokens (\"%s\")", input));
|
YYDPRINTF ((stderr, "expected_tokens (\"%s\")", input));
|
||||||
|
user_context uctx = {1, input};
|
||||||
|
|
||||||
// Parse the current state of the line.
|
// Parse the current state of the line.
|
||||||
yypstate *ps = yypstate_new ();
|
yypstate *ps = yypstate_new ();
|
||||||
int status = 0;
|
int status = 0;
|
||||||
|
YYLTYPE lloc = { 1, 1, 1, 1 };
|
||||||
do {
|
do {
|
||||||
YYLTYPE lloc;
|
|
||||||
YYSTYPE lval;
|
YYSTYPE lval;
|
||||||
int token = yylex (&input, &lval, &lloc);
|
yytoken_kind_t token = yylex (&input, &lval, &lloc, &uctx);
|
||||||
// Don't let the parse know when we reach the end of input.
|
// Don't let the parse know when we reach the end of input.
|
||||||
if (!token)
|
if (token == TOK_YYEOF)
|
||||||
break;
|
break;
|
||||||
status = yypush_parse (ps, token, &lval, &lloc);
|
status = yypush_parse (ps, token, &lval, &lloc, &uctx);
|
||||||
} while (status == YYPUSH_MORE);
|
} while (status == YYPUSH_MORE);
|
||||||
|
|
||||||
// Then query for the accepted tokens at this point.
|
int res = 0;
|
||||||
int res = yypstate_expected_tokens (ps, tokens, ntokens);
|
// If there were parse errors, don't propose completions.
|
||||||
|
if (!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);
|
yypstate_delete (ps);
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
@@ -463,7 +536,7 @@ expected_tokens (const char *input,
|
|||||||
// TEXT is the word to complete. We can use the entire contents of
|
// 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
|
// rl_line_buffer in case we want to do some simple parsing. Return
|
||||||
// the array of matches, or NULL if there aren't any.
|
// the array of matches, or NULL if there aren't any.
|
||||||
char **
|
static char **
|
||||||
completion (const char *text, int start, int end)
|
completion (const char *text, int start, int end)
|
||||||
{
|
{
|
||||||
YYDPRINTF ((stderr, "completion (\"%.*s[%.*s]%s\")\n",
|
YYDPRINTF ((stderr, "completion (\"%.*s[%.*s]%s\")\n",
|
||||||
@@ -473,14 +546,17 @@ completion (const char *text, int start, int end)
|
|||||||
|
|
||||||
// Get list of token numbers.
|
// Get list of token numbers.
|
||||||
int tokens[YYNTOKENS];
|
int tokens[YYNTOKENS];
|
||||||
char *line = xstrndup (rl_line_buffer, start);
|
char *line = xstrndup (rl_line_buffer, (size_t) start);
|
||||||
int ntokens = expected_tokens (line, tokens, YYNTOKENS);
|
int ntokens = expected_tokens (line, tokens, YYNTOKENS);
|
||||||
free (line);
|
free (line);
|
||||||
|
|
||||||
// Build MATCHES, the list of possible completions.
|
// Build MATCHES, the list of possible completions.
|
||||||
const int len = strlen (text);
|
const size_t len = strlen (text);
|
||||||
// Need initial prefix and final NULL.
|
// Need initial prefix and final NULL.
|
||||||
char **matches = calloc (ntokens + symbol_count () + 2, sizeof *matches);
|
char **matches
|
||||||
|
= calloc ((size_t) ntokens + (size_t) symbol_count () + 2, sizeof *matches);
|
||||||
|
if (!matches)
|
||||||
|
abort ();
|
||||||
int match = 1;
|
int match = 1;
|
||||||
for (int i = 0; i < ntokens; ++i)
|
for (int i = 0; i < ntokens; ++i)
|
||||||
switch (tokens[i])
|
switch (tokens[i])
|
||||||
@@ -510,9 +586,9 @@ completion (const char *text, int start, int end)
|
|||||||
matches[0] = strdup (text);
|
matches[0] = strdup (text);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
int lcplen = strlen (matches[1]);
|
size_t lcplen = strlen (matches[1]);
|
||||||
for (int i = 2; i < match && lcplen; ++i)
|
for (int i = 2; i < match && lcplen; ++i)
|
||||||
for (int j = 0; j < lcplen; ++j)
|
for (size_t j = 0; j < lcplen; ++j)
|
||||||
if (matches[1][j] != matches[i][j])
|
if (matches[1][j] != matches[i][j])
|
||||||
lcplen = j;
|
lcplen = j;
|
||||||
matches[0] = xstrndup (matches[1], lcplen);
|
matches[0] = xstrndup (matches[1], lcplen);
|
||||||
@@ -536,7 +612,8 @@ completion (const char *text, int start, int end)
|
|||||||
return matches;
|
return matches;
|
||||||
}
|
}
|
||||||
|
|
||||||
void init_readline (void)
|
static void
|
||||||
|
init_readline (void)
|
||||||
{
|
{
|
||||||
// Allow conditional parsing of the ~/.inputrc file.
|
// Allow conditional parsing of the ~/.inputrc file.
|
||||||
rl_readline_name = "bistromathic";
|
rl_readline_name = "bistromathic";
|
||||||
@@ -555,7 +632,8 @@ void init_readline (void)
|
|||||||
| Main. |
|
| Main. |
|
||||||
`-------*/
|
`-------*/
|
||||||
|
|
||||||
int main (int argc, char const* argv[])
|
int
|
||||||
|
main (int argc, char const* argv[])
|
||||||
{
|
{
|
||||||
#if defined ENABLE_NLS && ENABLE_NLS
|
#if defined ENABLE_NLS && ENABLE_NLS
|
||||||
// Set up internationalization.
|
// Set up internationalization.
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ fill-column: 76
|
|||||||
ispell-dictionary: "american"
|
ispell-dictionary: "american"
|
||||||
End:
|
End:
|
||||||
|
|
||||||
Copyright (C) 2019-2020 Free Software Foundation, Inc.
|
Copyright (C) 2019-2021 Free Software Foundation, Inc.
|
||||||
|
|
||||||
This file is part of Bison, the GNU Compiler Compiler.
|
This file is part of Bison, the GNU Compiler Compiler.
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
#! /bin/sh
|
#! /bin/sh
|
||||||
|
|
||||||
# Copyright (C) 2019-2020 Free Software Foundation, Inc.
|
# Copyright (C) 2019-2021 Free Software Foundation, Inc.
|
||||||
#
|
#
|
||||||
# This program is free software: you can redistribute it and/or modify
|
# This program is free software: you can redistribute it and/or modify
|
||||||
# it under the terms of the GNU General Public License as published by
|
# it under the terms of the GNU General Public License as published by
|
||||||
|
|||||||
@@ -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);
|
||||||
@@ -73,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
|
||||||
@@ -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
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ fill-column: 76
|
|||||||
ispell-dictionary: "american"
|
ispell-dictionary: "american"
|
||||||
End:
|
End:
|
||||||
|
|
||||||
Copyright (C) 2018-2020 Free Software Foundation, Inc.
|
Copyright (C) 2018-2021 Free Software Foundation, Inc.
|
||||||
|
|
||||||
This file is part of Bison, the GNU Compiler Compiler.
|
This file is part of Bison, the GNU Compiler Compiler.
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
#! /bin/sh
|
#! /bin/sh
|
||||||
|
|
||||||
# Copyright (C) 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
|
||||||
|
|||||||
@@ -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
|
||||||
@@ -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 <http://www.gnu.org/licenses/>. */
|
||||||
|
|
||||||
// Prologue (directives).
|
// Prologue (directives).
|
||||||
%expect 0
|
%expect 0
|
||||||
|
|
||||||
@@ -19,6 +38,9 @@
|
|||||||
#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.
|
// Don't share global variables between the scanner and the parser.
|
||||||
%define api.pure full
|
%define api.pure full
|
||||||
|
|
||||||
|
|||||||
@@ -1,10 +1,29 @@
|
|||||||
/* 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 <http://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 */
|
||||||
|
|
||||||
@@ -12,7 +31,7 @@
|
|||||||
|
|
||||||
// Each time a rule is matched, advance the end cursor/position.
|
// Each time a rule is matched, advance the end cursor/position.
|
||||||
#define YY_USER_ACTION \
|
#define YY_USER_ACTION \
|
||||||
yylloc->last_column += yyleng;
|
yylloc->last_column += (int) yyleng;
|
||||||
|
|
||||||
// Move the first position onto the last.
|
// Move the first position onto the last.
|
||||||
#define LOCATION_STEP() \
|
#define LOCATION_STEP() \
|
||||||
|
|||||||
+1
-1
@@ -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
|
||||||
|
|||||||
@@ -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
|
||||||
@@ -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
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ fill-column: 76
|
|||||||
ispell-dictionary: "american"
|
ispell-dictionary: "american"
|
||||||
End:
|
End:
|
||||||
|
|
||||||
Copyright (C) 2020 Free Software Foundation, Inc.
|
Copyright (C) 2020-2021 Free Software Foundation, Inc.
|
||||||
|
|
||||||
Permission is granted to copy, distribute and/or modify this document
|
Permission is granted to copy, distribute and/or modify this document
|
||||||
under the terms of the GNU Free Documentation License, Version 1.3 or
|
under the terms of the GNU Free Documentation License, Version 1.3 or
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
#! /bin/sh
|
#! /bin/sh
|
||||||
|
|
||||||
# Copyright (C) 2020 Free Software Foundation, Inc.
|
# Copyright (C) 2020-2021 Free Software Foundation, Inc.
|
||||||
#
|
#
|
||||||
# This program is free software: you can redistribute it and/or modify
|
# This program is free software: you can redistribute it and/or modify
|
||||||
# it under the terms of the GNU General Public License as published by
|
# it under the terms of the GNU General Public License as published by
|
||||||
|
|||||||
@@ -1,7 +1,26 @@
|
|||||||
|
/* Parser and scanner for pushcalc. -*- C -*-
|
||||||
|
|
||||||
|
Copyright (C) 2020-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 <http://www.gnu.org/licenses/>. */
|
||||||
|
|
||||||
%code top {
|
%code top {
|
||||||
#include <ctype.h> /* isdigit. */
|
#include <ctype.h> /* isdigit. */
|
||||||
#include <stdbool.h>
|
#include <stdio.h> /* printf. */
|
||||||
#include <stdio.h> /* For printf, etc. */
|
#include <stdlib.h> /* abort. */
|
||||||
#include <string.h> /* strcmp. */
|
#include <string.h> /* strcmp. */
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -81,7 +100,8 @@ yylex (YYSTYPE *yylval)
|
|||||||
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) 2020 Free Software Foundation, Inc.
|
## Copyright (C) 2020-2021 Free Software Foundation, Inc.
|
||||||
##
|
##
|
||||||
## This program is free software: you can redistribute it and/or modify
|
## This program is free software: you can redistribute it and/or modify
|
||||||
## it under the terms of the GNU General Public License as published by
|
## it under the terms of the GNU General Public License as published by
|
||||||
@@ -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_pushcalc_DATA = %D%/calc.y %D%/Makefile %D%/README.md
|
dist_pushcalc_DATA = %D%/calc.y %D%/Makefile %D%/README.md
|
||||||
CLEANFILES += %D%/calc.[ch] %D%/calc.output
|
CLEANFILES += %D%/calc.[ch] %D%/calc.output
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ fill-column: 76
|
|||||||
ispell-dictionary: "american"
|
ispell-dictionary: "american"
|
||||||
End:
|
End:
|
||||||
|
|
||||||
Copyright (C) 2018-2020 Free Software Foundation, Inc.
|
Copyright (C) 2018-2021 Free Software Foundation, Inc.
|
||||||
|
|
||||||
Permission is granted to copy, distribute and/or modify this document
|
Permission is granted to copy, distribute and/or modify this document
|
||||||
under the terms of the GNU Free Documentation License, Version 1.3 or
|
under the terms of the GNU Free Documentation License, Version 1.3 or
|
||||||
|
|||||||
@@ -1,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
|
||||||
@@ -26,6 +26,8 @@ if FLEX_WORKS
|
|||||||
BUILT_SOURCES += $(nodist_%C%_reccalc_SOURCES)
|
BUILT_SOURCES += $(nodist_%C%_reccalc_SOURCES)
|
||||||
# Don't use gnulib's system headers.
|
# Don't use gnulib's system headers.
|
||||||
%C%_reccalc_CPPFLAGS = -I$(top_srcdir)/%D% -I$(top_builddir)/%D%
|
%C%_reccalc_CPPFLAGS = -I$(top_srcdir)/%D% -I$(top_builddir)/%D%
|
||||||
|
# Fighting warnings triggered by Flex is just too painful.
|
||||||
|
# %C%_reccalc_CFLAGS = $(TEST_CFLAGS)
|
||||||
endif FLEX_WORKS
|
endif FLEX_WORKS
|
||||||
|
|
||||||
%D%/parse.c: $(dependencies)
|
%D%/parse.c: $(dependencies)
|
||||||
|
|||||||
@@ -1,3 +1,22 @@
|
|||||||
|
/* Parser for reccalc. -*- 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 <http://www.gnu.org/licenses/>. */
|
||||||
|
|
||||||
// Prologue (directives).
|
// Prologue (directives).
|
||||||
%expect 0
|
%expect 0
|
||||||
|
|
||||||
@@ -46,14 +65,29 @@
|
|||||||
result parse (void);
|
result parse (void);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 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_}
|
||||||
|
|
||||||
|
// Generate YYSTYPE from the types assigned to symbols.
|
||||||
%define api.value.type union
|
%define api.value.type union
|
||||||
%define parse.error verbose
|
|
||||||
|
// Error messages with "unexpected XXX, expected XXX...".
|
||||||
|
%define parse.error detailed
|
||||||
|
|
||||||
|
// Enable run-time traces (yydebug).
|
||||||
%define parse.trace
|
%define parse.trace
|
||||||
|
|
||||||
|
// Generate the parser description file (parse.output).
|
||||||
%verbose
|
%verbose
|
||||||
|
|
||||||
// Scanner and error count are exchanged between main, yyparse and yylex.
|
// Scanner and error count are exchanged between main, yyparse and yylex.
|
||||||
%param {yyscan_t scanner}{result *res}
|
%param {yyscan_t scanner}{result *res}
|
||||||
|
|
||||||
%token
|
%token
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user