diff --git a/src/bin/bison/ABOUT-NLS b/src/bin/bison/ABOUT-NLS index 2f50c6693e..47d5e39f0e 100644 --- a/src/bin/bison/ABOUT-NLS +++ b/src/bin/bison/ABOUT-NLS @@ -1,8 +1,8 @@ Notes on the Free Translation Project ************************************* -Free software is going international! The Free Translation Project is -a way to get maintainers of free software, translators, and users all + Free software is going international! The Free Translation Project +is a way to get maintainers of free software, translators, and users all together, so that will gradually become able to speak many languages. A few packages already provide translations for their messages. @@ -25,7 +25,7 @@ related to internationalization, you should tell about the version of Quick configuration advice ========================== -If you want to exploit the full power of internationalization, you + If you want to exploit the full power of internationalization, you should configure it using ./configure --with-included-gettext @@ -48,10 +48,10 @@ included `libintl'. INSTALL Matters =============== -Some packages are "localizable" when properly installed; the programs -they contain can be made to speak your own native language. Most such -packages use GNU `gettext'. Other packages have their own ways to -internationalization, predating GNU `gettext'. + Some packages are "localizable" when properly installed; the +programs they contain can be made to speak your own native language. +Most such packages use GNU `gettext'. Other packages have their own +ways to internationalization, predating GNU `gettext'. By default, this package will be installed to allow translation of messages. It will automatically detect whether the system already @@ -98,7 +98,7 @@ codes, stating which languages are allowed. Using This Package ================== -As a user, if your language has been installed for this package, you + As a user, if your language has been installed for this package, you only have to set the `LANG' environment variable to the appropriate `LL_CC' combination. Here `LL' is an ISO 639 two-letter language code, and `CC' is an ISO 3166 two-letter country code. For example, let's @@ -131,13 +131,6 @@ system libraries. For example, some Swedish users who would rather read translations in German than English for when Swedish is not available, set `LANGUAGE' to `sv:de' while leaving `LANG' to `sv_SE'. - Special advice for Norwegian users: The language code for Norwegian -bokma*l changed from `no' to `nb' recently (in 2003). During the -transition period, while some message catalogs for this language are -installed under `nb' and some older ones under `no', it's recommended -for Norwegian users to set `LANGUAGE' to `nb:no' so that both newer and -older translations are used. - In the `LANGUAGE' environment variable, but not in the `LANG' environment variable, `LL_CC' combinations can be abbreviated as `LL' to denote the language's main dialect. For example, `de' is equivalent @@ -147,7 +140,7 @@ to `de_DE' (German as spoken in Germany), and `pt' to `pt_PT' Translating Teams ================= -For the Free Translation Project to be a success, we need interested + For the Free Translation Project to be a success, we need interested people who like their own language and write it well, and who are also able to synergize with other translators speaking the same language. Each translation team has its own mailing list. The up-to-date list of @@ -177,559 +170,423 @@ programming skill, here. Available Packages ================== -Languages are not equally supported in all packages. The following -matrix shows the current state of internationalization, as of January -2004. The matrix shows, in regard of each package, for which languages -PO files have been submitted to translation coordination, with a + Languages are not equally supported in all packages. The following +matrix shows the current state of internationalization, as of May 2003. +The matrix shows, in regard of each package, for which languages PO +files have been submitted to translation coordination, with a translation percentage of at least 50%. - Ready PO files af am ar az be bg bs ca cs da de el en en_GB eo es - +----------------------------------------------------+ - a2ps | [] [] [] [] | - aegis | () | - ant-phone | () | - anubis | | - ap-utils | | - aspell | [] | - bash | [] [] [] [] | - batchelor | | - bfd | [] [] | - binutils | [] [] | - bison | [] [] [] | - bluez-pin | [] [] [] | - clisp | | - clisp | [] [] [] | - console-tools | [] [] | - coreutils | [] [] [] [] | - cpio | [] [] [] | - darkstat | [] () [] | - diffutils | [] [] [] [] [] [] [] | - e2fsprogs | [] [] [] | - enscript | [] [] [] [] | - error | [] [] [] [] [] | - fetchmail | [] () [] [] [] [] | - fileutils | [] [] [] | - findutils | [] [] [] [] [] [] [] | - flex | [] [] [] [] | - fslint | | - gas | [] | - gawk | [] [] [] [] | - gbiff | [] | - gcal | [] | - gcc | [] [] | - gettext | [] [] [] [] [] | - gettext-examples | [] [] [] [] | - gettext-runtime | [] [] [] [] [] | - gettext-tools | [] [] [] | - gimp-print | [] [] [] [] [] | - gliv | | - glunarclock | [] [] | - gnubiff | [] | - gnucash | [] () [] [] | - gnucash-glossary | [] () [] | - gnupg | [] () [] [] [] [] | - gpe-aerial | [] | - gpe-beam | [] [] | - gpe-calendar | [] [] | - gpe-clock | [] [] | - gpe-conf | [] [] | - gpe-contacts | [] [] | - gpe-edit | [] | - gpe-go | [] | - gpe-login | [] [] | - gpe-ownerinfo | [] [] | - gpe-sketchbook | [] [] | - gpe-su | [] [] | - gpe-taskmanager | [] [] | - gpe-timesheet | [] | - gpe-today | [] [] | - gpe-todo | [] [] | - gphoto2 | [] [] [] [] | - gprof | [] [] [] | - gpsdrive | () () () | - gramadoir | [] | - grep | [] [] [] [] [] [] | - gretl | [] | - gtick | [] () | - hello | [] [] [] [] [] [] | - id-utils | [] [] | - indent | [] [] [] [] | - iso_3166 | [] [] [] [] [] [] [] [] [] [] | - iso_3166_1 | [] [] [] [] [] [] | - iso_3166_2 | | - iso_3166_3 | [] | - iso_4217 | [] [] [] [] | - iso_639 | | - jpilot | [] [] [] | - jtag | | - jwhois | [] | - kbd | [] [] [] [] [] | - latrine | () | - ld | [] [] | - libc | [] [] [] [] [] [] | - libgpewidget | [] [] | - libiconv | [] [] [] [] [] | - lifelines | [] () | - lilypond | [] | - lingoteach | | - lingoteach_lessons | () () | - lynx | [] [] [] [] | - m4 | [] [] [] [] | - mailutils | [] [] | - make | [] [] [] | - man-db | [] () [] [] () | - minicom | [] [] [] | - mysecretdiary | [] [] [] | - nano | [] () [] [] [] | - nano_1_0 | [] () [] [] [] | - opcodes | [] | - parted | [] [] [] [] [] | - ptx | [] [] [] [] [] | - python | | - radius | [] | - recode | [] [] [] [] [] [] [] | - rpm | [] [] | - screem | | - scrollkeeper | [] [] [] [] [] [] | - sed | [] [] [] [] [] [] | - sh-utils | [] [] [] | - shared-mime-info | | - sharutils | [] [] [] [] [] [] | - silky | () | - skencil | [] () [] | - sketch | [] () [] | - soundtracker | [] [] [] | - sp | [] | - tar | [] [] [] [] | - texinfo | [] [] [] | - textutils | [] [] [] [] | - tin | () () | - tp-robot | | - tuxpaint | [] [] [] [] [] [] [] | - unicode-han-tra... | | - unicode-transla... | | - util-linux | [] [] [] [] [] | - vorbis-tools | [] [] [] [] | - wastesedge | () | - wdiff | [] [] [] [] | - wget | [] [] [] [] [] [] | - xchat | [] [] [] [] | - xfree86_xkb_xml | [] [] | - xpad | [] | - +----------------------------------------------------+ - af am ar az be bg bs ca cs da de el en en_GB eo es - 4 0 0 1 9 4 1 40 41 60 78 17 1 5 13 68 + Ready PO files am az be bg ca cs da de el en en_GB eo es + +-------------------------------------------+ + a2ps | [] [] [] [] | + aegis | () | + anubis | | + ap-utils | | + bash | [] [] [] | + batchelor | | + bfd | [] [] | + binutils | [] [] | + bison | [] [] [] | + bluez-pin | [] [] | + clisp | | + clisp | [] [] [] | + coreutils | [] [] [] [] | + cpio | [] [] [] | + darkstat | () [] | + diffutils | [] [] [] [] [] [] [] | + e2fsprogs | [] [] | + enscript | [] [] [] [] | + error | [] [] [] [] [] | + fetchmail | [] () [] [] [] [] | + fileutils | [] [] [] | + findutils | [] [] [] [] [] [] | + flex | [] [] [] [] | + gas | [] | + gawk | [] [] [] [] | + gcal | [] | + gcc | [] [] | + gettext | [] [] [] [] [] | + gettext-runtime | [] [] [] [] [] | + gettext-tools | [] [] | + gimp-print | [] [] [] [] [] | + gliv | | + glunarclock | [] [] [] | + gnucash | () [] | + gnucash-glossary | [] () [] | + gnupg | [] () [] [] [] [] | + gpe-calendar | [] | + gpe-conf | [] | + gpe-contacts | [] | + gpe-edit | | + gpe-login | [] | + gpe-ownerinfo | [] | + gpe-sketchbook | [] | + gpe-timesheet | | + gpe-today | [] | + gpe-todo | [] | + gphoto2 | [] [] [] [] | + gprof | [] [] | + gpsdrive | () () () | + grep | [] [] [] [] [] | + gretl | [] | + hello | [] [] [] [] [] [] | + id-utils | [] [] | + indent | [] [] [] [] | + jpilot | [] [] [] [] | + jwhois | [] | + kbd | [] [] [] [] [] | + ld | [] [] | + libc | [] [] [] [] [] [] | + libgpewidget | [] | + libiconv | [] [] [] [] [] | + lifelines | [] () | + lilypond | [] | + lingoteach | | + lingoteach_lessons | () () | + lynx | [] [] [] [] | + m4 | [] [] [] [] | + mailutils | [] [] | + make | [] [] [] | + man-db | [] () [] [] () | + mysecretdiary | [] [] [] | + nano | [] () [] [] [] | + nano_1_0 | [] () [] [] [] | + opcodes | [] [] | + parted | [] [] [] [] [] | + ptx | [] [] [] [] [] | + python | | + radius | | + recode | [] [] [] [] [] [] | + screem | | + sed | [] [] [] [] [] | + sh-utils | [] [] [] | + sharutils | [] [] [] [] [] [] | + sketch | [] () [] | + soundtracker | [] [] [] | + sp | [] | + tar | [] [] [] [] | + texinfo | [] [] [] [] | + textutils | [] [] [] [] | + tin | () () | + util-linux | [] [] [] [] [] | + vorbis-tools | [] [] [] | + wastesedge | () | + wdiff | [] [] [] [] | + wget | [] [] [] [] [] [] [] | + xchat | [] [] [] | + xpad | | + +-------------------------------------------+ + am az be bg ca cs da de el en en_GB eo es + 0 1 4 2 31 17 54 60 14 1 4 12 56 - et eu fa fi fr ga gl he hr hu id is it ja ko lg - +-------------------------------------------------+ - a2ps | [] [] [] () () | - aegis | | - ant-phone | [] | - anubis | [] | - ap-utils | [] | - aspell | [] [] | - bash | [] [] | - batchelor | [] [] | - bfd | [] | - binutils | [] [] | - bison | [] [] [] [] | - bluez-pin | [] [] [] [] [] | - clisp | | - clisp | [] | - console-tools | | - coreutils | [] [] [] [] [] [] | - cpio | [] [] [] [] | - darkstat | () [] [] [] | - diffutils | [] [] [] [] [] [] [] | - e2fsprogs | | - enscript | [] [] | - error | [] [] [] [] | - fetchmail | [] | - fileutils | [] [] [] [] [] [] | - findutils | [] [] [] [] [] [] [] [] [] [] [] | - flex | [] [] [] | - fslint | [] | - gas | [] | - gawk | [] [] [] | - gbiff | [] | - gcal | [] | - gcc | [] | - gettext | [] [] [] | - gettext-examples | [] [] | - gettext-runtime | [] [] [] [] [] | - gettext-tools | [] [] [] | - gimp-print | [] [] | - gliv | () | - glunarclock | [] [] [] [] | - gnubiff | [] | - gnucash | () [] | - gnucash-glossary | [] | - gnupg | [] [] [] [] [] [] [] | - gpe-aerial | [] | - gpe-beam | [] | - gpe-calendar | [] [] [] | - gpe-clock | [] | - gpe-conf | [] | - gpe-contacts | [] [] | - gpe-edit | [] [] | - gpe-go | [] | - gpe-login | [] [] | - gpe-ownerinfo | [] [] [] | - gpe-sketchbook | [] | - gpe-su | [] | - gpe-taskmanager | [] | - gpe-timesheet | [] [] [] | - gpe-today | [] [] | - gpe-todo | [] [] | - gphoto2 | [] [] [] | - gprof | [] [] | - gpsdrive | () () () | - gramadoir | [] [] | - grep | [] [] [] [] [] [] [] [] [] [] [] | - gretl | [] [] | - gtick | [] [] [] | - hello | [] [] [] [] [] [] [] [] [] [] [] [] [] | - id-utils | [] [] [] [] | - indent | [] [] [] [] [] [] [] [] [] | - iso_3166 | [] [] [] [] [] [] [] | - iso_3166_1 | [] [] [] [] [] | - iso_3166_2 | | - iso_3166_3 | | - iso_4217 | [] [] [] [] [] [] | - iso_639 | | - jpilot | [] () | - jtag | [] | - jwhois | [] [] [] [] | - kbd | [] | - latrine | [] | - ld | [] | - libc | [] [] [] [] [] [] | - libgpewidget | [] [] [] [] | - libiconv | [] [] [] [] [] [] [] [] [] | - lifelines | () | - lilypond | [] | - lingoteach | [] [] | - lingoteach_lessons | | - lynx | [] [] [] [] | - m4 | [] [] [] [] | - mailutils | | - make | [] [] [] [] [] [] | - man-db | () () | - minicom | [] [] [] [] | - mysecretdiary | [] [] | - nano | [] [] [] [] | - nano_1_0 | [] [] [] [] | - opcodes | [] | - parted | [] [] [] | - ptx | [] [] [] [] [] [] [] | - python | | - radius | [] | - recode | [] [] [] [] [] [] | - rpm | [] [] | - screem | | - scrollkeeper | [] | - sed | [] [] [] [] [] [] [] [] [] | - sh-utils | [] [] [] [] [] [] [] | - shared-mime-info | [] [] [] | - sharutils | [] [] [] [] [] | - silky | () [] () () | - skencil | [] | - sketch | [] | - soundtracker | [] [] | - sp | [] () | - tar | [] [] [] [] [] [] [] [] [] | - texinfo | [] [] [] [] | - textutils | [] [] [] [] [] [] | - tin | [] () | - tp-robot | [] | - tuxpaint | [] [] [] [] [] [] [] [] [] | - unicode-han-tra... | | - unicode-transla... | [] [] | - util-linux | [] [] [] [] () [] | - vorbis-tools | [] | - wastesedge | () | - wdiff | [] [] [] [] [] [] | - wget | [] [] [] [] [] [] [] | - xchat | [] [] [] | - xfree86_xkb_xml | [] [] | - xpad | [] [] | - +-------------------------------------------------+ - et eu fa fi fr ga gl he hr hu id is it ja ko lg - 22 2 1 26 106 28 24 8 10 41 33 1 26 33 12 0 + et fa fi fr ga gl he hr hu id it ja ko + +----------------------------------------+ + a2ps | [] [] [] () () | + aegis | | + anubis | [] | + ap-utils | [] | + bash | [] [] | + batchelor | [] | + bfd | [] [] | + binutils | [] [] | + bison | [] [] [] [] | + bluez-pin | [] [] [] [] | + clisp | | + clisp | [] | + coreutils | [] [] [] [] | + cpio | [] [] [] [] | + darkstat | () [] [] [] | + diffutils | [] [] [] [] [] [] [] | + e2fsprogs | | + enscript | [] [] | + error | [] [] [] [] | + fetchmail | [] | + fileutils | [] [] [] [] [] | + findutils | [] [] [] [] [] [] [] [] [] [] [] | + flex | [] [] | + gas | [] | + gawk | [] [] | + gcal | [] | + gcc | [] | + gettext | [] [] [] | + gettext-runtime | [] [] [] [] | + gettext-tools | [] | + gimp-print | [] [] | + gliv | () | + glunarclock | [] [] [] [] | + gnucash | [] | + gnucash-glossary | [] | + gnupg | [] [] [] [] [] [] [] | + gpe-calendar | [] | + gpe-conf | | + gpe-contacts | [] | + gpe-edit | [] [] | + gpe-login | [] | + gpe-ownerinfo | [] [] [] | + gpe-sketchbook | [] | + gpe-timesheet | [] [] [] | + gpe-today | [] [] | + gpe-todo | [] [] | + gphoto2 | [] [] [] | + gprof | [] [] | + gpsdrive | () [] () () | + grep | [] [] [] [] [] [] [] [] [] [] [] | + gretl | [] | + hello | [] [] [] [] [] [] [] [] [] [] [] [] [] | + id-utils | [] [] [] | + indent | [] [] [] [] [] [] [] [] | + jpilot | [] () | + jwhois | [] [] [] [] | + kbd | [] | + ld | [] | + libc | [] [] [] [] [] [] | + libgpewidget | [] [] [] | + libiconv | [] [] [] [] [] [] [] [] | + lifelines | () | + lilypond | [] | + lingoteach | [] [] | + lingoteach_lessons | | + lynx | [] [] [] [] | + m4 | [] [] [] [] | + mailutils | | + make | [] [] [] [] [] [] | + man-db | [] () () | + mysecretdiary | [] [] | + nano | [] [] [] [] | + nano_1_0 | [] [] [] [] | + opcodes | [] [] | + parted | [] [] [] | + ptx | [] [] [] [] [] [] [] | + python | | + radius | | + recode | [] [] [] [] [] [] | + screem | | + sed | [] [] [] [] [] [] [] [] | + sh-utils | [] [] [] [] [] [] | + sharutils | [] [] [] [] [] | + sketch | [] | + soundtracker | [] [] [] | + sp | [] () | + tar | [] [] [] [] [] [] [] [] [] | + texinfo | [] [] [] [] | + textutils | [] [] [] [] [] | + tin | [] () | + util-linux | [] [] [] [] () [] | + vorbis-tools | [] | + wastesedge | () | + wdiff | [] [] [] [] [] | + wget | [] [] [] [] [] [] [] [] | + xchat | [] [] [] | + xpad | | + +----------------------------------------+ + et fa fi fr ga gl he hr hu id it ja ko + 20 1 15 73 14 24 8 10 30 31 19 31 9 - lt lv mk mn ms mt nb nl nn no nso pl pt pt_BR ro ru - +-----------------------------------------------------+ - a2ps | [] [] () () [] [] [] | - aegis | () () () | - ant-phone | [] [] | - anubis | [] [] [] [] [] [] | - ap-utils | [] () [] | - aspell | [] | - bash | [] [] [] | - batchelor | [] | - bfd | [] | - binutils | [] | - bison | [] [] [] [] [] | - bluez-pin | [] [] [] | - clisp | | - clisp | [] | - console-tools | [] | - coreutils | [] [] | - cpio | [] [] [] [] [] | - darkstat | [] [] [] [] | - diffutils | [] [] [] [] [] [] | - e2fsprogs | [] | - enscript | [] [] [] [] | - error | [] [] [] | - fetchmail | [] [] () [] | - fileutils | [] [] [] | - findutils | [] [] [] [] [] | - flex | [] [] [] [] | - fslint | [] [] | - gas | | - gawk | [] [] [] | - gbiff | [] [] | - gcal | | - gcc | | - gettext | [] [] [] | - gettext-examples | [] [] [] | - gettext-runtime | [] [] [] [] | - gettext-tools | [] [] | - gimp-print | [] | - gliv | [] [] [] | - glunarclock | [] [] [] [] | - gnubiff | [] | - gnucash | [] [] () [] | - gnucash-glossary | [] [] | - gnupg | [] | - gpe-aerial | [] [] [] [] | - gpe-beam | [] [] [] [] | - gpe-calendar | [] [] [] [] | - gpe-clock | [] [] [] [] | - gpe-conf | [] [] [] [] | - gpe-contacts | [] [] [] [] | - gpe-edit | [] [] [] [] | - gpe-go | [] [] [] | - gpe-login | [] [] [] [] | - gpe-ownerinfo | [] [] [] [] | - gpe-sketchbook | [] [] [] [] | - gpe-su | [] [] [] [] | - gpe-taskmanager | [] [] [] [] | - gpe-timesheet | [] [] [] [] | - gpe-today | [] [] [] [] | - gpe-todo | [] [] [] [] | - gphoto2 | [] | - gprof | [] [] | - gpsdrive | () () [] | - gramadoir | () [] | - grep | [] [] [] [] [] | - gretl | | - gtick | [] [] [] | - hello | [] [] [] [] [] [] [] [] [] [] | - id-utils | [] [] [] [] | - indent | [] [] [] [] | - iso_3166 | [] [] [] | - iso_3166_1 | [] [] | - iso_3166_2 | | - iso_3166_3 | [] | - iso_4217 | [] [] [] [] [] [] [] [] | - iso_639 | [] | - jpilot | () () | - jtag | | - jwhois | [] [] [] [] () | - kbd | [] [] [] | - latrine | [] | - ld | | - libc | [] [] [] [] | - libgpewidget | [] [] [] | - libiconv | [] [] [] [] [] | - lifelines | | - lilypond | | - lingoteach | | - lingoteach_lessons | | - lynx | [] [] [] | - m4 | [] [] [] [] [] | - mailutils | [] [] [] | - make | [] [] [] [] | - man-db | [] | - minicom | [] [] [] [] | - mysecretdiary | [] [] [] | - nano | [] [] [] [] [] | - nano_1_0 | [] [] [] [] [] [] | - opcodes | [] [] | - parted | [] [] [] [] | - ptx | [] [] [] [] [] [] [] [] | - python | | - radius | [] [] | - recode | [] [] [] [] | - rpm | [] [] [] | - screem | | - scrollkeeper | [] [] [] [] [] | - sed | [] [] [] | - sh-utils | [] [] | - shared-mime-info | [] [] | - sharutils | [] [] | - silky | () | - skencil | [] [] | - sketch | [] [] | - soundtracker | | - sp | | - tar | [] [] [] [] [] [] | - texinfo | [] [] [] [] | - textutils | [] [] | - tin | | - tp-robot | [] | - tuxpaint | [] [] [] [] [] [] [] [] | - unicode-han-tra... | | - unicode-transla... | | - util-linux | [] [] [] | - vorbis-tools | [] [] [] | - wastesedge | | - wdiff | [] [] [] [] [] | - wget | [] [] [] | - xchat | [] [] [] | - xfree86_xkb_xml | [] [] | - xpad | [] [] | - +-----------------------------------------------------+ - lt lv mk mn ms mt nb nl nn no nso pl pt pt_BR ro ru - 1 2 0 3 12 0 10 69 6 7 1 40 26 36 76 63 + lg lt lv ms nb nl nn no pl pt pt_BR ro + +----------------------------------------+ + a2ps | [] [] () () () [] [] | + aegis | () | + anubis | [] [] | + ap-utils | () | + bash | [] | + batchelor | | + bfd | | + binutils | | + bison | [] [] [] [] | + bluez-pin | [] | + clisp | | + clisp | [] | + coreutils | [] | + cpio | [] [] [] | + darkstat | [] [] [] [] | + diffutils | [] [] [] | + e2fsprogs | | + enscript | [] [] | + error | [] [] | + fetchmail | () () | + fileutils | [] | + findutils | [] [] [] [] | + flex | [] | + gas | | + gawk | [] | + gcal | | + gcc | | + gettext | [] | + gettext-runtime | [] | + gettext-tools | | + gimp-print | [] | + gliv | [] | + glunarclock | [] | + gnucash | | + gnucash-glossary | [] [] | + gnupg | | + gpe-calendar | [] [] | + gpe-conf | [] [] | + gpe-contacts | [] | + gpe-edit | [] [] | + gpe-login | [] [] | + gpe-ownerinfo | [] [] | + gpe-sketchbook | [] [] | + gpe-timesheet | [] [] | + gpe-today | [] [] | + gpe-todo | [] [] | + gphoto2 | | + gprof | [] | + gpsdrive | () () () | + grep | [] [] [] [] | + gretl | | + hello | [] [] [] [] [] [] [] [] [] | + id-utils | [] [] [] | + indent | [] [] [] | + jpilot | () () | + jwhois | [] [] [] | + kbd | | + ld | | + libc | [] [] [] [] | + libgpewidget | [] [] | + libiconv | [] [] | + lifelines | | + lilypond | [] | + lingoteach | | + lingoteach_lessons | | + lynx | [] [] | + m4 | [] [] [] [] | + mailutils | | + make | [] [] | + man-db | [] | + mysecretdiary | [] | + nano | [] [] [] [] | + nano_1_0 | [] [] [] [] | + opcodes | [] [] [] | + parted | [] [] [] | + ptx | [] [] [] [] [] [] [] | + python | | + radius | | + recode | [] [] [] | + screem | | + sed | [] [] | + sh-utils | [] | + sharutils | [] | + sketch | [] | + soundtracker | | + sp | | + tar | [] [] [] [] [] [] | + texinfo | [] | + textutils | [] | + tin | | + util-linux | [] [] | + vorbis-tools | [] [] | + wastesedge | | + wdiff | [] [] [] [] | + wget | [] [] [] | + xchat | [] [] | + xpad | [] | + +----------------------------------------+ + lg lt lv ms nb nl nn no pl pt pt_BR ro + 0 0 2 11 7 26 3 4 18 15 34 34 - sk sl sr sv ta th tr uk ven vi wa xh zh_CN zh_TW zu - +-----------------------------------------------------+ - a2ps | [] [] [] [] | 16 - aegis | | 0 - ant-phone | | 3 - anubis | [] [] | 9 - ap-utils | () | 3 - aspell | | 4 - bash | | 9 - batchelor | | 3 - bfd | [] [] | 6 - binutils | [] [] [] | 8 - bison | [] [] | 14 - bluez-pin | [] [] [] | 14 - clisp | | 0 - clisp | | 5 - console-tools | | 3 - coreutils | [] [] [] [] | 16 - cpio | [] [] | 14 - darkstat | [] [] [] () () | 12 - diffutils | [] [] [] | 23 - e2fsprogs | [] [] | 6 - enscript | [] [] | 12 - error | [] [] [] | 15 - fetchmail | [] [] | 11 - fileutils | [] [] [] [] [] | 17 - findutils | [] [] [] [] [] [] | 29 - flex | [] [] | 13 - fslint | | 3 - gas | [] | 3 - gawk | [] [] | 12 - gbiff | | 4 - gcal | [] [] | 4 - gcc | [] | 4 - gettext | [] [] [] [] [] | 16 - gettext-examples | [] [] [] [] [] | 14 - gettext-runtime | [] [] [] [] [] [] [] [] | 22 - gettext-tools | [] [] [] [] [] [] | 14 - gimp-print | [] [] | 10 - gliv | | 3 - glunarclock | [] [] [] | 13 - gnubiff | | 3 - gnucash | [] [] | 9 - gnucash-glossary | [] [] [] | 8 - gnupg | [] [] [] [] | 17 - gpe-aerial | [] | 7 - gpe-beam | [] | 8 - gpe-calendar | [] [] [] [] | 13 - gpe-clock | [] [] [] | 10 - gpe-conf | [] [] | 9 - gpe-contacts | [] [] [] | 11 - gpe-edit | [] [] [] [] [] | 12 - gpe-go | | 5 - gpe-login | [] [] [] [] [] | 13 - gpe-ownerinfo | [] [] [] [] | 13 - gpe-sketchbook | [] [] | 9 - gpe-su | [] [] [] | 10 - gpe-taskmanager | [] [] [] | 10 - gpe-timesheet | [] [] [] [] | 12 - gpe-today | [] [] [] [] [] | 13 - gpe-todo | [] [] [] [] | 12 - gphoto2 | [] [] [] | 11 - gprof | [] [] | 9 - gpsdrive | [] [] | 3 - gramadoir | [] | 5 - grep | [] [] [] [] | 26 - gretl | | 3 - gtick | | 7 - hello | [] [] [] [] [] | 34 - id-utils | [] [] | 12 - indent | [] [] [] [] | 21 - iso_3166 | [] [] [] [] [] [] [] | 27 - iso_3166_1 | [] [] [] | 16 - iso_3166_2 | | 0 - iso_3166_3 | | 2 - iso_4217 | [] [] [] [] [] [] | 24 - iso_639 | | 1 - jpilot | [] [] [] [] [] | 9 - jtag | [] | 2 - jwhois | () [] [] | 11 - kbd | [] [] | 11 - latrine | | 2 - ld | [] [] | 5 - libc | [] [] [] [] | 20 - libgpewidget | [] [] [] [] | 13 - libiconv | [] [] [] [] [] [] [] [] | 27 - lifelines | [] | 2 - lilypond | [] | 3 - lingoteach | | 2 - lingoteach_lessons | () | 0 - lynx | [] [] [] | 14 - m4 | [] [] | 15 - mailutils | | 5 - make | [] [] [] | 16 - man-db | [] | 5 - minicom | | 11 - mysecretdiary | [] [] | 10 - nano | [] [] [] [] | 17 - nano_1_0 | [] [] [] | 17 - opcodes | [] [] | 6 - parted | [] [] [] | 15 - ptx | [] [] | 22 - python | | 0 - radius | | 4 - recode | [] [] [] | 20 - rpm | [] [] | 9 - screem | [] [] | 2 - scrollkeeper | [] [] [] | 15 - sed | [] [] [] [] [] [] | 24 - sh-utils | [] [] | 14 - shared-mime-info | [] [] | 7 - sharutils | [] [] [] [] | 17 - silky | () | 3 - skencil | [] | 6 - sketch | [] | 6 - soundtracker | [] [] | 7 - sp | [] | 3 - tar | [] [] [] [] [] | 24 - texinfo | [] [] [] | 14 - textutils | [] [] [] [] | 16 - tin | | 1 - tp-robot | | 2 - tuxpaint | [] [] [] [] [] | 29 - unicode-han-tra... | | 0 - unicode-transla... | | 2 - util-linux | [] [] | 15 - vorbis-tools | | 8 - wastesedge | | 0 - wdiff | [] [] [] | 18 - wget | [] [] [] [] [] [] [] [] | 24 - xchat | [] [] [] [] [] | 15 - xfree86_xkb_xml | [] [] [] [] [] | 11 - xpad | | 5 - +-----------------------------------------------------+ - 63 teams sk sl sr sv ta th tr uk ven vi wa xh zh_CN zh_TW zu - 131 domains 47 19 28 83 0 0 59 13 1 1 11 0 22 22 0 1373 + ru sk sl sr sv ta tr uk vi wa zh_CN zh_TW + +-------------------------------------------+ + a2ps | [] [] [] [] [] | 16 + aegis | () | 0 + anubis | [] [] | 5 + ap-utils | () | 1 + bash | [] | 7 + batchelor | | 1 + bfd | [] [] [] | 7 + binutils | [] [] [] | 7 + bison | [] [] | 13 + bluez-pin | | 7 + clisp | | 0 + clisp | | 5 + coreutils | [] [] [] [] [] | 14 + cpio | [] [] [] | 13 + darkstat | [] () () | 9 + diffutils | [] [] [] [] | 21 + e2fsprogs | [] | 3 + enscript | [] [] [] | 11 + error | [] [] [] | 14 + fetchmail | [] | 7 + fileutils | [] [] [] [] [] [] | 15 + findutils | [] [] [] [] [] [] | 27 + flex | [] [] [] | 10 + gas | [] | 3 + gawk | [] [] | 9 + gcal | [] [] | 4 + gcc | [] | 4 + gettext | [] [] [] [] [] [] | 15 + gettext-runtime | [] [] [] [] [] [] | 16 + gettext-tools | [] [] | 5 + gimp-print | [] [] | 10 + gliv | | 1 + glunarclock | [] [] [] | 11 + gnucash | [] [] | 4 + gnucash-glossary | [] [] [] | 8 + gnupg | [] [] [] [] | 16 + gpe-calendar | [] | 5 + gpe-conf | | 3 + gpe-contacts | [] | 4 + gpe-edit | [] | 5 + gpe-login | [] | 5 + gpe-ownerinfo | [] | 7 + gpe-sketchbook | [] | 5 + gpe-timesheet | [] | 6 + gpe-today | [] | 6 + gpe-todo | [] | 6 + gphoto2 | [] [] | 9 + gprof | [] [] | 7 + gpsdrive | [] [] | 3 + grep | [] [] [] [] | 24 + gretl | | 2 + hello | [] [] [] [] [] | 33 + id-utils | [] [] [] | 11 + indent | [] [] [] [] | 19 + jpilot | [] [] [] [] [] | 10 + jwhois | () () [] [] | 10 + kbd | [] [] | 8 + ld | [] [] | 5 + libc | [] [] [] [] | 20 + libgpewidget | | 6 + libiconv | [] [] [] [] [] [] | 21 + lifelines | [] | 2 + lilypond | [] | 4 + lingoteach | | 2 + lingoteach_lessons | () | 0 + lynx | [] [] [] [] | 14 + m4 | [] [] [] | 15 + mailutils | | 2 + make | [] [] [] [] | 15 + man-db | [] | 6 + mysecretdiary | [] [] | 8 + nano | [] [] [] | 15 + nano_1_0 | [] [] [] | 15 + opcodes | [] [] | 9 + parted | [] [] | 13 + ptx | [] [] [] | 22 + python | | 0 + radius | | 0 + recode | [] [] [] [] | 19 + screem | [] | 1 + sed | [] [] [] [] [] | 20 + sh-utils | [] [] [] | 13 + sharutils | [] [] [] [] | 16 + sketch | [] | 5 + soundtracker | [] | 7 + sp | [] | 3 + tar | [] [] [] [] [] | 24 + texinfo | [] [] [] [] | 13 + textutils | [] [] [] [] [] | 15 + tin | | 1 + util-linux | [] [] | 14 + vorbis-tools | [] | 7 + wastesedge | | 0 + wdiff | [] [] [] [] | 17 + wget | [] [] [] [] [] [] [] | 25 + xchat | [] [] [] | 11 + xpad | | 1 + +-------------------------------------------+ + 50 teams ru sk sl sr sv ta tr uk vi wa zh_CN zh_TW + 97 domains 32 19 16 0 56 0 48 10 1 1 12 23 913 Some counters in the preceding matrix are higher than the number of visible blocks let us expect. This is because a few extra PO files are @@ -742,7 +599,7 @@ distributed as such by its maintainer. There might be an observable lag between the mere existence a PO file and its wide availability in a distribution. - If January 2004 seems to be old, you may fetch a more recent copy of + If May 2003 seems to be old, you may fetch a more recent copy of this `ABOUT-NLS' file on most GNU archive sites. The most up-to-date matrix with full percentage details can be found at `http://www.iro.umontreal.ca/contrib/po/HTML/matrix.html'. @@ -750,7 +607,7 @@ matrix with full percentage details can be found at Using `gettext' in new packages =============================== -If you are writing a freely available program and want to + If you are writing a freely available program and want to internationalize it you are welcome to use GNU `gettext' in your package. Of course you have to respect the GNU Library General Public License which covers the use of the GNU `gettext' library. This means diff --git a/src/bin/bison/COPYING b/src/bin/bison/COPYING index d60c31a97a..3912109b5c 100644 --- a/src/bin/bison/COPYING +++ b/src/bin/bison/COPYING @@ -2,7 +2,7 @@ Version 2, June 1991 Copyright (C) 1989, 1991 Free Software Foundation, Inc. - 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. @@ -305,7 +305,7 @@ the "copyright" line and a pointer to where the full notice is found. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA Also add information on how to contact you by electronic and paper mail. @@ -313,7 +313,7 @@ Also add information on how to contact you by electronic and paper mail. If the program is interactive, make it output a short notice like this when it starts in an interactive mode: - Gnomovision version 69, Copyright (C) year name of author + Gnomovision version 69, Copyright (C) year name of author Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. diff --git a/src/bin/bison/ChangeLog b/src/bin/bison/ChangeLog index ba9bc5989e..64f4b1ad7c 100644 --- a/src/bin/bison/ChangeLog +++ b/src/bin/bison/ChangeLog @@ -1,3 +1,2124 @@ +2005-09-16 Paul Eggert + + * NEWS: Version 2.1. + + * NEWS: Remove notice of yytname change, since it was never in an + official release. + * data/glr.c (yydestroyGLRState): Rename local var to avoid shadowing + diagnostic. + * src/output.c (prepare): Likewise. + * data/lalr1.cc (YYERROR_VERBOSE_IF): New macro. + (yysyntax_error_): Use it to avoid GCC warning when YYERROR_VERBOSE + is not defined. This is an awful hack, but it's enough for now. + All callers changed. + * tests/glr-regression-at (make_value): Args are const pointers now, + to avoid GCC warning. + (Duplicated user destructor for lookahead): New test. Currently + skipped. It fails on my host but I'm not sure it'll always fail. + +2005-09-16 Akim Demaille + + * src/symtab.h (struct symbol): Declare the printer and destructor + as const, to avoid accidental calls to free. + (symbol_destructor_set, symbol_printer_set): Adjust. + * src/symtab.c: Adjust. + +2005-09-16 Akim Demaille + + * data/c.m4 (b4_token_enums): New. + (b4_token_defines): Rename as... + (b4_token_enums_defines): this. + (b4_token_defines): New, output only the #defines. + * data/yacc.c, data/glr.c: Adjust. + * data/lalr1.cc: Use b4_token_enums instead of b4_token_enums_defines. + * data/c.m4 (b4_yydestruct_generate, b4_yysymprint_generate): Define + as default values. + +2005-09-16 Akim Demaille + + * data/lalr1.cc (yylex_): Remove, inline its code. + (yyreport_syntax_error_): Remove, replaced by... + (yysyntax_error_): this which returns a string and leaves to the + caller the call to the users' error function. + (yylooka_, yyilooka_, yylval, yylloc, yyerror_range_, yyval, yyloc): + Move from members of the parser object... + (yylooka, yyilooka, yylval, yylloc, yyerror_range, yyval, yyloc): + to local variables of the parse function. + +2005-09-16 Akim Demaille + + * doc/bison.texinfo (Calc++ Parser): Don't promote defining YYEOF + since it's in Bison's name space. + +2005-09-15 Paul Eggert + + * data/glr.c (yyresolveValue): Add default case to pacify + gcc -Wswitch-default. Problem reported by twlevo@xs4all.nl. + + * NEWS: Document when yyparse started to return 2. + * doc/bison.texinfo (Parser Function): Document when yyparse + returns 2. + + * data/lalr1.cc: Revert part of previous change, as it's incompatible. + (b4_filename_type): Renamed back from b4_file_name_type. All uses + changed. + (class position): file_name -> filename (reverting). All uses changed. + +2005-09-14 Paul Eggert + + * examples/calc++/Makefile.am ($(calc_sources_generated)): Don't + do anything if $@ exists. This reverts part of the 2005-07-07 + patch. + +2005-09-11 Paul Eggert + + * Makefile.am (EXTRA_DIST): Do not distribute REFERENCES; it + contains obsolete information and isn't worth distributing as a + separate file anyway. + * data/glr.c [defined YYSETJMP]: Don't include . + (YYJMP_BUF, YYSETJMP, YYLONGJMP) [!defined YYSETJMP]: New macros. + All uses of jmp_buf, setjmp, longjmp changed to use these instead. + (yyparse): Abort if user code uses longjmp to throw an unexpected + value. + +2005-09-09 Paul Eggert + + * data/c.m4 (b4_identification): Define YYBISON_VERSION. + Suggested by twlevo@xs4all.nl. + + * data/glr.c (YYCHK1): Do not assume YYE is in range. + This avoids a diagnostic from gcc -Wswitch-enum. + Problem reported by twlevo@xs4all.nl. + + * doc/bison.texinfo: Don't use "filename", as per GNU coding + standards. Use "file name" or "file" or "name", depending on + the context. + (Invocation): The output of "bison hack/foo.y" goes to foo.tab.c, + not to hack/foo.tab.c. + (Calc++ Top Level): 2nd arg of main is not const. + * data/glr.c: b4_filename -> b4_file_name. + * data/lalr1.cc: Likewise. Also, b4_filename_type -> b4_file_name_type. + All uses changed. + (class position): filename -> file_name. All uses changed. + * data/yacc.c: b4_filename -> b4_file_name. + * lib/bitset.h: filename -> file_name in local vars. + * lib/bitset_stats.c: Likewise. + * src/files.c: Likewise. + * src/scan-skel.l ("@output ".*\n): Likewise. + * src/files.c (file_name_split): Renamed from filename_split. + * src/muscle_tab.c (muscle_init): Output b4_file_name, not b4_filename. + +2005-09-08 Paul Eggert + + * lib/.cvsignore: Add pipe-safer.c, stdio--.h, unistd--.h, + to accommodate latest gnulib. + + * tests/glr-regression.at (Duplicate representation of merged trees): + Add casts to pacify g++. Problem reported by twlevo@xs4all.nl. + + * bootstrap: Add comment as to why the AM_LANGINFO_CODESET hack is + needed. + +2005-08-26 Paul Eggert + + * data/glr.c (yydestroyGLRState): Renamed from yydestroyStackItem. + All uses changed. Invoke user destructor after an error during a + split parse (trivial change from Joel E. Denny). + + * tests/glr-regression.at + (User destructor after an error during a split parse): New test case. + Problem reported by Joel E. Denny in: + http://lists.gnu.org/archive/html/bison-patches/2005-08/msg00029.html + +2005-08-25 Paul Eggert + + * README-cvs: Give URLs for recommended tools. + Mention Gzip version problem, and bootstrapping issues. + Remove troubleshooting section, as it's somewhat obsolete. + + * bootstrap (no_cache): New var, to accommodate different wget + variants. Use it instead of '-C off'. Problem reported by + twlevo@xs4all.nl. + + * data/glr.c (yydestroyStackItem): New function. + (yyrecoverSyntaxError, yyreturn): Use it to improve quality of + debugging information. Problem reported by Joel E. Denny. + +2005-08-25 Akim Demaille + + * tests/local.at (AT_COMPILE_CXX): Pass $LINKS too. + +2005-08-24 Paul Eggert + + * data/glr.c (yyrecoverSyntaxError, yyreturn): + Don't invoke destructor on unresolved entries. + * tests/glr-regression.at + (User destructor for unresolved GLR semantic value): New test case. + Problem reported by Joel E. Denny in: + http://lists.gnu.org/archive/html/bison-patches/2005-08/msg00016.html + +2005-08-21 Paul Eggert + + * lib/.cvsignore: Remove realloc.c, strncasecmp.c, xstrdup.c. + Add strnlen.c. + * m4/.cvsignore: Remove codeset.m4, gettext.m4, lib-ld.m4, + lib-prefix.m4, po.m4. + + * data/glr.c (yyreturn): Use "Cleanup:" rather than "Error:" + in yydestruct diagnostic, since it might not be an error. + Problem reported by Joel Denny near end of + . + * data/lalr1.cc (yyerturn): Likewise. + * data/yacc.c (yyreturn): Likewise. + * tests/calc.at (_AT_CHECK_CALC_ERROR): Adjust to the above change. + + * src/files.c: Remove obsolete FIXME comment. + + * data/glr.c (YY_SYMBOL_PRINT): Append a newline, for consistency + with the other templates, and to fix bogus run-on messages such + as the one reported at the end of + . + All callers changed to avoid the newline. + (yyprocessOneStack): Output two lines rather than one, to accommodate + the above change. This changes the debug output format slightly. + + * data/glr.c (yyresolveValue): Fix redundant parse tree problem + reported by Joel E. Denny in + + (trivial change). + * tests/glr-regression.at (Duplicate representation of merged trees): + New test, from Joel E. Denny in: + . + * THANKS: Add Joel E. Denny. + + * configure.ac (AC_INIT): Bump to 2.0c. + +2005-07-24 Paul Eggert + + * NEWS: Version 2.0b. + + * Makefile.am (SUBDIRS): Put examples before tests, so that + "make check" doesn't finish with "All 1 tests passed". + + * tests/regression.at (Token definitions): Don't rely on + AT_PARSER_CHECK for data that contains backslashes. It currently + uses 'echo', and 'echo' isn't portable if its argument contains + backslashes. Problem found on OpenBSD 3.4. Also, do not assume + that the byte '\0xff' is not printable in the C locale; it is, + under OpenBSD 3.4 (!). Luckily, '\0x80' through '\0x9e' are + not printable, so use '\0x81' to test. + + * data/glr.c (YYOPTIONAL_LOC): Define even if it's not a recent + version of GCC, since the macro is used with non-GCC compilers. + + Fix core dump reported by Pablo De Napoli in + . + * tests/regression.at (Invalid inputs with {}): New test. + * src/parse-gram.y (token_name): Translate type before using + it as an index. + + * data/glr.c (ATTRIBUTE_UNUSED): Remove, since it infringes on + the user's name space. All uses changed to __attribute__ + ((__unused__)). + (yyFail, yyMemoryExhausted, yyreportAmbiguity): + Add __attribute__ ((__noreturn__)). + + * etc/clcommit: Remove. We weren't using it, and it failed + "make maintainer-distcheck". + * Makefile.maint: Merge from coreutils. + (CVS_LIST, CVS_LIST_EXCEPT): New macros. + (syntax-check-rules): Change list of rules as described below. + (sc_cast_of_alloca_return_value, sc_dd_max_sym_length): + (sc_file_system, sc_obsolete_symbols, sc_prohibit_atoi_atof): + (sc_prohibit_jm_in_m4, sc_root_tests, sc_tight_scope): + (sc_trailing_space): New rules. + (sc_xalloc_h_in_src): Remove. + (sc_cast_of_argument_to_free, sc_cast_of_x_alloc_return_value): + (sc_space_tab, sc_error_exit_success, sc_changelog): + (sc_system_h_headers, sc_sun_os_names, sc_unmarked_diagnostics): + (makefile-check, po-check, author_mark_check): + (makefile_path_separator_check, copyright-check): + Use grep -n, to make it easier to find violations. + Use CVS_LIST and CVS_LIST_EXCEPT. + (header_regexp, h_re): Remove. + (dd_c): New macro. + (sc_dd_max_sym_length, .re-list, news-date-check): New rules. + (my-distcheck): Use more-modern GCC flags. + (signatures, %.asc): Remove. + (rel-files, announcement): Remove signatures. + Restore old updating code, even though we don't use it, so + that we're the same as coreutils. + (alpha, beta, major): Depend on news-date-check. + Make the upload commands. + + * data/c.m4, data/lalr1.cc, data/yacc.c: Normalize white space. + * lib/abitset.h, lib/bbitset.h, lib/bitset.h: Likewise. + * lib/bitset_stats.c, lib/ebitset.h, lib/lbitset.c: Likewise. + * lib/libitset.h, lib/timevar.c, lib/vbitset.h: Likewise. + * src/Makefile.am, src/gram.c, src/muscle_tab.h: Likewise. + * src/parse-gram.y, src/system.h, src/tables.c, src/vcg.c: Likewise. + * src/vcg_defaults.h, tests/cxx-type.at, tests/existing.at: Likewise. + * tests/sets.at: Likewise. + + * data/m4sugar/m4sugar.m4: Sync from Autoconf, except that + we comment out the Autoconf version number. + * doc/bison.texinfo (Calc++ Scanner): Don't use atoi, as + it's error-prone and "make maintainer-distcheck" rejects it. + + * lib/subpipe.c: Include without checking for HAVE_FCNTL_H. + Indent calls to "error" to pacify "make maintainer-distcheck", + when the calls are not intended to be translated. + * m4/subpipe.m4 (BISON_PREREQ_SUBPIPE): Don't check for fcntl.h. + + * src/Makefile.am (DEFS): Use +=, to pacify + "make maintainer-distcheck". + (bison_SOURCES): Add scan-skel.h. + (sc_tight_scope): New rule, from coreutils. + + * src/files.c (src_extension, header_extension): + Now static, not extern. + * src/getargs.c (short_options): Likewise. + * src/muscle_tab.c (muscle_table): Likewise. + * src/parse-gram.y (current_class, current_type, current_prec): + Likewise. + * src/reader.c (grammar_end, previous_rule_end): Likewise. + * src/getargs.h: Redo comments to pacify "make maintainer-distcheck". + * src/main.c (main): Cast bindtextdomain and textdomain calls to + void, to avoid warning when NLS is disabled. + * src/output.c: Include scan-skel.h. + (scan_skel): Remove decl, since scan-skel.h does this. + (output_skeleton): + Indent calls to "error" to pacify "make maintainer-distcheck". + * src/print_graph.c: Don't include , as system.h does this. + * src/reader.h (gram_end, gram_lineno): New decls to pacify + "make maintainer-distcheck". + * src/scan-skel.l (skel_lex, skel_get_lineno, skel_get_in): + (skel_get_out, skel_get_leng, skel_get_text, skel_set_lineno): + (skel_set_in, skel_set_out, skel_get_debug, skel_set_debug): + (skel_lex_destroy, scan_skel): Move these decls to... + * src/scan-skel.h: New file. + * src/uniqstr.c (uniqstr_assert): + Indent calls to "error" to pacify "make maintainer-distcheck". + + * tests/Makefile.am ($(srcdir)/package.m4): Use $(VAR), + not @VAR@. + + * tests/torture.at: Revamp to avoid misuse of atoi that + "make maintainer-distcheck" complained about. + + * examples/extexi (message): Don't print a message more than once, + and omit line-number decoration that makes Emacs compile think + that informative messages are worth worrying about. + +2005-07-22 Paul Eggert + + * configure.ac: Update version number. + + * Makefile.am (SUBDIRS): Add examples; somehow this got removed + accidentally. + * examples/calc++/calc++-parser.yy: Remove from CVS, as it's + autogenerated by the maintainer. + * examples/calc++/.cvsignore: Add *.yy. + + * lib/bitset.c (bitset_alloc): Don't cast xcalloc result. + * lib/bitset_stats.c (bitset_stats_init): Likewise. + * lib/bitsetv.c (bitsetv_alloc): Likewise. + + * po/POTFILES.in: Add lib/xalloc-die.c; remove lib/xmalloc.c. + + * src/relation.c (relation_transpose): Rewrite to avoid bogus complaint + from maintainer-distcheck about casting the argument of 'free'. + + * NEWS: Mention recent yytname changes. + * THANKS: Add Anthony Heading, twlevo@xs4all.nl. + + * bootstrap: For translations that have not yet been upgraded to + the new runtime-po domain, prime the pump by extracting the + relevant strings from the obsolete translations. This code can be + removed once the bison-runtime domain has been translated by each + team. + + * src/scan-gram.l (.): Don't double-quote token names, + now that token names are already quoted. + + Fix problem reported by Anthony Heading. + * data/glr.c (YYTOKEN_TABLE): New macro. + (yytname): Define if YYTOKEN_TABLE. + * data/yacc.c (YYTOKEN_TABLE, yytname): Likewise. + * data/lalr1.cc (YYTOKEN_TABLE, yytname_): Likewise. + (YYERROR_VERBOSE): Define the same way the other skeletons do. + * src/output.c (prepare_symbols): Output token_table_flag. + +2005-07-21 Paul Eggert + + * data/glr.c (yyinitGLRStack, yyreturn): Don't call malloc + again if the first call fails. + + * data/glr.c (yytnamerr): New function. + (yyreportSyntaxError): Use it to dequote most string literals. + * data/lalr1.c (yytname_): Renamed from yyname_, for compatibility + with other skeletons. All uses changed. + (yytnameerr_): New function. + (yyreport_syntax_error): Use it to dequote most string literals. + * data/yacc.c (yytnamerr): New function. + (yyerrlab): Use it to decode most string literals. + * doc/bison.texinfo (Decl Summary, Calling Convention): + Clarify quoting convention of yytname. + * src/output.c (prepare_symbols): Quote all names. This undoes + the 2005-04-17 change, which is now accomplished (mostly) via + changes in the parsers as described above. + * tests/regression.at (Token definitions, Web2c Actions): + Undo most 2005-04-17 change here, too. + +2005-07-20 Paul Eggert + + Fix more problems reported by twlevo@xs4all.nl. + * tests/cxx-type.at: Don't pipe output of ./types through sed to + remove trailing spaces. This loses the exit status of ./types, + and isn't needed since ./types shouldn't be emitting trailing + spaces. + * data/glr.c (yyreturn): Don't pop stack if yyinitStateSet failed, + as the stack isn't valid in that case. + + * src/scan-gram.l (gram_get_lineno, gram_get_in, gram_get_out): + (gram_get_leng, gram_get_text, gram_set_lineno, gram_set_in): + (gram_set_out, gram_get_debug, gram_set_debug, gram_lex_destroy): + Add declarations to pacify "gcc -Wmissing-prototypes" when flex 2.5.31 + is used. + * src/scan-skel.l (skel_get_lineno, skel_get_in, skel_get_out): + (skel_get_leng, skel_get_text, skel_set_lineno, skel_set_in): + (skel_set_out, skel_get_debug, skel_set_debug, skel_lex_destroy): + Likewise. + + * tests/cxx-type.at (_AT_TEST_GLR_CXXTYPES): Work even with + overly-picky compilers that reject 'char *foo = "bar";'. + + * src/symtab.c (SYMBOL_ATTR_PRINT, symbol_print): Direct output + to FILE * parameter, not to stderr. This fixes a typo introduced + in the 2005-07-12 change. + + * lib/subpipe.c (create_subpipe): Rewrite slightly to avoid + warnings from GCC 4. + + * data/glr.c (yyexpandGLRStack, yyaddDeferredAction, yyexpandGLRStack): + (yyglrShiftDefer, yysplitStack): + Remove unused parameters b4_pure_formals. All uses changed. + (yyglrShift): Remove unused parameters b4_user_formals. + All uses changed. + (yyglrReduce): Removed unused parameter yylocp. All uses changed. + +2005-07-18 Paul Eggert + + Destructor cleanups and regularization among the three skeletons. + * NEWS: Document the behavior changes. + * data/glr.c (yyrecoverSyntaxError): Don't bother to pop the + stack before failing, as the cleanup code will do it for us now. + * data/lalr1.cc (yyerrlab): Likewise. + * data/glr.c (yyparse): Pop everything off the stack before + freeing it, so that destructors get called properly. + * data/lalr1.cc (yyreturn): Likewise. + * data/yacc.c (yyreturn): Pop and destroy the start symbol, too. + This is more consistent. + * doc/bison.texinfo (Destructor Decl): Mention more reasons + why destructors might be called. 1.875 -> 2.1. + (Destructor Decl, Decl Summary, Table of Symbols): + Some English-language cleanups for %destructor. + * tests/actions.at (_AT_CHECK_PRINTER_AND_DESTRUCTOR): + Add output line for destructor of start symbol. + * tests/calc.at (AT_CHECK_CALC): Add one to line counts, + because of that same extra output line. + + * NEWS: Document minor wording changes in diagnostics of + Bison-generated parsers. + * data/glr.c (yyMemoryExhausted): Renamed from yyStackOverflow. + Remove unused formals. All uses changed. + (yyreportAmbiguity): "ambiguity detected" -> "syntax is ambiguous". + (yyparse): Rename yyoverflowlab to yyexhaustedlab. + * data/yacc.c (yyparse): "parser stack overflow" -> "memory exhausted". + Rename yyoverflowab to yyexhaustedlab. + When memory exhaustion occurs during syntax-error reporting, + report it separately rather than in a single diagnostic; this + eases translation. + * doc/bison.texinfo (Memory Management): Renamed from Stack Overflow. + (Memory Exhausted): Renamed from Parser Stack Overflow. + Revamp wording slightly to prefer "memory exhaustion". + * tests/actions.at: "parser stack overflow" -> "memory exhausted". + + * data/c.m4 (b4_yysymprint_generate): Use YYFPRINTF, not fprintf. + + Add i18n support to the GLR skeleton. Partially fix the C++ + skeleton; a C++ expert needs to finish this. Remove debugging + msgids; there's little point to having them translated, since they + can be understood only by someone who can read the + (English-language) source code. + + Generate runtime-po/bison-runtime.pot automatically, so that we + don't have to worry about garbage getting in that file. We'll + make sure after the next official release that old msgids don't + get lost. See + . + + * runtime-po/Makefile.in.in, runtime-po/bison-runtime.pot: Remove. + Now auto-generated. + * PACKAGING: Don't claim that Gawk, GCC, Perl use this method yet. + Fix typos in explanations of the runtime file. + * bootstrap: Change gettext keyword from YYI18N to YY_. + Use standard Makefile.in.in in runtime-po, since we'll arrange + for backward-compatible bison-runtime.po files in a different way. + * data/glr.c (YY_): New macro, from yacc.c. + (yyuserAction, yyreportAmbiguity, yyreportSyntaxError, yyparse): + Translate messages intended for users. + (yyreportSyntaxError): Change "virtual memory" to "memory" to match + the wording in the other skeletons. We don't know that the memory + is virtual. + * data/lalr1.cc (YY_): Renamed from _. All uses changed. + Use same method that yacc.c uses. + Don't translate debugging messages. + (yy::yyreport_syntax_error): Put in a FIXME for the i18n stuff; + it doesn't work (yet), and requires C++ expertise to fix. + * data/yacc.c (YY_): Renamed from YY18N. All uses changed. + Move defn to a more logical place, to be consistent with other + skeletons. + Don't translate debugging messages. + Don't assume line numbers fit in unsigned int; use unsigned long fmts. + * doc/bison.texinfo: Mention . Change glibc cross reference + to gettext cross reference. Add indexing terms. Mention YYENABLE_NLS. + * runtime-po/POTFILES.in: Add data/glr.c, data/lalr1.cc. + + Fix yyerror / yylex test glitches noted by twlevo@xs4all.nl. + * tests/cxx-type.at (_AT_TEST_GLR_CXXTYPES): Have yyerror return + void, not int. + * tests/glr-regression.at (Badly Collapsed GLR States): + Likewise. + (Improper handling of embedded actions and dollar(-N) in GLR parsers): + yylex should return 0 at EOF rather than aborting. + + Improve tests for stack overflow in GLR parser. + Problem reported by twlevo@xs4all.nl. + * data/glr.c (struct yyGLRStack): Remove yyerrflag member. + All uses removed. + (yyStackOverflow): Just longjmp, but with value 2 so that caller + can handle the problem. + (YYCHK1): Use goto (a la yacc.c) rather than setting a flag. + (yyparse): New local variable yyresult to record the result. + Use result of setjmp to set it, rather than storing itinto + struct. + (yyDone): Remove label. + (yyacceptlab, yyabortlab, yyoverflowlab, yyreturn): New labels, + to mimic yacc.c. Do not discard lookahead if it's EOF (possible + if YYABORT is used). + * tests/actions.at (_AT_CHECK_PRINTER_AND_DESTRUCTOR): Exit with + yyparse status; put status > 1 into diagnostic. + Check that status==2 works. + * tests/calc.at, tests/cxx-type.at, tests/glr-regression.at: + Use exit status 3 for failure to open (which shouldn't happen). + +2005-07-17 Paul Eggert + + * tests/conflicts.at (%nonassoc and eof): Don't exit with status + 1 on syntax error; just let yyparse do its thing. + * tests/glr-regression.at (Badly Collapsed GLR States): Likewise. + * tests/torture.at (AT_DATA_STACK_TORTURE): Likewise. + (Exploding the Stack Size with Alloca): + (Exploding the Stack Size with Malloc): + Expect exit status 2, not 1, since the parser is supposed to blow + its stack. Problem reported by twlevo@xs4all.nl. + + * data/glr.c (yyparse): Don't assume that the initial calls + to YYMALLOC succeed; in that case, yyparse incorrectly returned 0. + Print a stack-overflow message and fail instead. + Initialize the line-number information before creating the stack, + so that the stack-overflow message can report line zero safely. + +2005-07-14 Paul Eggert + + Fix problems reported by twlevo@xs4all.nl. + * data/glr.c (YYSTACKEXPANDABLE): Don't define if already defined. + (yyuserMerge): Provide a default case if b4_mergers is empty. + * tests/cxx-type.at (_AT_TEST_GLR_CXXTYPES): Define YYSTACKEXPANDABLE. + * tests/glr-regression.at + (Improper handling of embedded actions and dollar(-N) in GLR parsers): + Add casts to pacify C++ compilers. + * tests/glr-regression.at (Improper merging of GLR delayed action + sets): Declare yylex before using it. + * tests/Makefile.am (maintainer-check-g++): Fix a stray + $(GXX) that escaped the renaming of GXX to CXX. Remove bogus + test for valgrind; valgrind is independent of g++. + (maintainer-check-posix): Add _POSIX2_VERSION=200112, to check + for compatibility with POSIX 1003.1-2001 (if running coreutils). + * tests/cxx-type.at (_AT_TEST_GLR_CXXTYPES): Port to stricter C++. + Use a destructor, so that we can expand the stack. Change + YYSTYPE to char * so that we can free it. Cast result of malloc. + +2005-07-13 Paul Hilfinger + + * data/glr.c (yyuserAction): Fix uninitialized variable that caused + a valgrind failure. Problem reported by twlevo@xs4all.nl. + +2005-07-13 Paul Eggert + + * PACKAGING: New file, suggested by Bruno Haible and taken from + similar wording in gettext's PACKAGING file. + * NEWS: Mention PACKAGING. + * Makefile.am (EXTRA_DIST): Add PACKAGING. + +2005-07-12 Paul Eggert + + * NEWS: Document recent i18n improvements. + * bootstrap: Get runtime translations into runtime-po. + Create runtime-po files automatically, if possible. + * configure.ac: Invoke BISON_I18N, so that we eat our own dog food. + * data/yacc.c: Rewrite inclusion of so that ENABLE_NLS + does not infringe on the user's name space. + (YYENABLE_NLS): Renamed from ENABLE_BISON_NLS. + * doc/bison.texinfo (Internationalization): Revamp the English + and Texinfo syntax a bit, to try to make it clearer. + (Bison Options, Option Cross Key): Mention --print-localedir. + * m4/bison-i18n.m4 (BISON_I18N): Rename ENABLE_BISON_NLS to + YYENABLE_NLS. Quote a bit more. + * runtime-po/.cvsignore: New file. + * runtime-po/Makefile.in.in (mostlyclean): Remove *.old.pot. + * runtime-po/Rules-quot: Remove; now created by bootstrap. + * runtime-po/quot.sed: Likewise. + * runtime-po/boldquot.sed: Likewise. + * runtime-po/en@quot.header: Likewise. + * runtime-po/en@boldquot.header: Likewise. + * runtime-po/insert-header.sin: Likewise. + * runtime-po/remove-potcdate.sin: Likewise. + * runtime-po/Makevars: Likewise. + * runtime-po/LINGUAS: Likewise. + * runtime-po/de.po: Likewise; we will rely on the translation project + to maintain this, so "bootstrap" should get it. + * src/getarg.c (PRINT_LOCALEDIR_OPTION): Let the C compiler determine + its value. + * src/main.c (main): Bind the bison-runtime domain, too. + +2005-07-12 Bruno Haible + + * data/yacc.c: Include when NLS is enabled. + (YYI18N): Renamed from _. Use dgettext when NLS is enabled. + * po/POTFILES.in: Remove autogenerated file src/parse-gram.c. + * runtime-po: New directory. + * runtime-po/Makefile.in.in: New file, copied from po/, with modified + $(DOMAIN).pot-update rule, so that old messages are never dropped. + * runtime-po/Rules-quot: New file, copied from po/. + * runtime-po/quot.sed: Likewise. + * runtime-po/boldquot.sed: Likewise. + * runtime-po/en@quot.header: Likewise. + * runtime-po/en@boldquot.header: Likewise. + * runtime-po/insert-header.sin: Likewise. + * runtime-po/remove-potcdate.sin: Likewise. + * runtime-po/Makevars: New file. + * runtime-po/POTFILES.in: New file. + * runtime-po/LINGUAS: New file. + * runtime-po/bison-runtime.pot: New file. + * runtime-po/de.po: New file. + * m4/bison.m4: New file. + * Makefile.am (SUBDIRS): Add runtime-po. + (aclocaldir, aclocal_DATA): New variables. + * configure.ac: Add AC_CONFIG_FILES of runtime-po/Makefile.in. + Define aclocaldir. + * src/getargs.c (usage): Document --print-localedir option. + (PRINT_LOCALEDIR_OPTION): New enum item. + (long_options): Add --print-localedir option. + (getargs): Handle --print-localedir option. + * doc/bison.texinfo (Bison Parser): Remove paragraph about _(). + (Internationalization): New section. + +2005-07-12 Akim Demaille + + * src/symtab.h, src/symtab.c (symbol_print): Swap the arguments, + for consistency with the rest of the code. + * src/symlist.h, src/symlist.c (symbol_list_print): Ditto. + Add separators. + +2005-07-12 Akim Demaille + + * src/parse-gram.y: Use %printer instead of YYPRINT. + +2005-07-12 Akim Demaille + + * src/symtab.h, src/symtab.c (symbol_print): New. + * src/symlist.h, src/symlist.c (symbol_list_print): New. + * src/symlist.c (symbol_list_n_type_name_get): Report the culprit. + +2005-07-12 Akim Demaille + + * data/glr.c (b4_syncline): Fix (swap) the definitions of + b4_at_dollar and b4_dollar_dollar. + +2005-07-11 Paul Eggert + + * doc/bison.texinfo (Mystery Conflicts): Add reference to DeRemer + and Pennello's paper. + +2005-07-09 Paul Eggert + + * data/yacc.c (yyparse): Undo previous patch. Instead, + set yylsp[0] and yyvsp[0] only if the initial action + sets yylloc and yylval, respectively. + + * data/yacc.c (yyparse): In the initial action, set + yylsp[0] and yyvsp[0] rather than yylloc and yylval. + This avoids the use of undefined variables if the initial + action does not set yylloc and/or yylval. + +2005-07-07 Paul Eggert + + * examples/calc++/calc++-driver.cc, examples/calc++/calc++-driver.hh: + * examples/calc++/calc++-scanner.ll, examples/calc++/calc++.cc: + Remove from CVS. These files are automatically generated. + * examples/extexi: Clarify that this file is now part of Bison, + not GNU M4, and that it works with any POSIX-compatible Awk. + * examples/calc++/Makefile.am (run_extexi): Remove; not used. + ($(calc_extracted)): Renamed from $(calc_sources_extracted), + so that we also get calc++-parser.yy. Geneate it. + Use $(AWK), not gawk, since any conforming Awk will do. + Put comment before action, since older 'make' can't handle comment + in action. + $(BUILT_SOURCES): List all built sources, not just some of them. + $(MAINTAINERCLEANFILES): Remove *.stamp, and all built sources. + $($(srcdir)/calc++-parser.stamp): Work even if POSIXLY_CORRECT. + $($(calc_sources_generated)): Remove unnecessary test for existence + of target. (This had a shell syntax error anyway; a stray "x".) + (calc_extracted): List $(srcdir)/calc++-parser.yy, not + calc++-parser.yy. + * examples/.cvsignore, examples/calc++/.cvsignore: New files. + + * bootstrap (gnulib_modules): Add gettext, now that it's no longer + implied by the other modules. + +2005-07-06 Akim Demaille + + Bind examples/calc++ to the package. + * examples/calc++/Makefile: Remove, replaced by... + * examples/calc++/Makefile.am: ... this new file. + * examples/calc++/test: Remove input. + * examples/calc++/compile: Remove. + * examples/Makefile.am: New. + * configure.ac, Makefile.am: Adjust. + * doc/Makefile.am (clean-local): New, for more recent texi2dvis. + +2005-07-05 Paul Eggert + + * data/glr.c (yyFail): Drastically simplify; since the format argument + never had any % directives, we can simply pass it to yyerror. + (yyparse): Use "t a; a=b;" rather than "t a = b;" when a will + be modified later, as that is the usual style in glr.c. + Problems reported by Paul Hilfinger. + + Rewrite GLR parser to catch more buffer overrun, storage exhaustion, + and size overflow errors. + * data/glr.c: Include etc. after user prolog, not before, + in case the user prolog sets feature-test macros like _GNU_SOURCE. + (YYSIZEMAX): New macro. + (yystpcpy): New function, taken from yacc.c. + (struct yyGLRStack.yyspaceLeft): Now size_t, not int. + (yyinitGLRStack, yyfreeGLRstack): Remove unnecessary forward decls, + so that we don't have to maintain their signatures. + (yyFail): Check for buffer overflow, by using vsnprintf rather + than vsprintf. Allocate a bigger buffer if possible. + Report an error if buffer allocation fails. + (yyStackOverflow): New function. + (yyinitStateSet, yyinitGLRStack): Return a boolean indicating whether + the initialization was successful. It might fail if storage was + exhausted. + (yyexpandGLRStack): Add more checks for storage allocation failure. + Use yyStackOverflow to report failures. + (yymarkStackDeleted, yyglrShift, yyglrShiftDefer, yydoAction): + (yysplitStack, yyprocessOneStack, yyparse, yypstack): + Don't assume stack number fits in int. + (yysplitStack): Check for storage allocation failure. + (yysplitStack, yyprocessOneStack): Add pure_formals, so that we + can print diagnostics on storage allocation failure. All callers + changed. + (yyresolveValue): Use yybool for boolean. + (yyreportSyntaxError): Check for size-calculation overflow. + This code is taken from yacc.c. + (yyparse): Check for storage allocation errors when allocating + the initial stack. + +2005-07-05 Akim Demaille + + Extract calc++ from the documentation. + * doc/bison.texinfo (Calc++): Add the extraction marks. + * examples/extexi: New, from the aborted GNU Programming 2E. + Separate the different paragraph of a file with empty lines. + * examples/Makefile: Use it to extract the whole calc++ example. + +2005-06-24 Akim Demaille + + * doc/bison.texinfo (C++ Parser Interface): Use defcv to define + class typedefs. + +2005-06-22 Akim Demaille + + * doc/bison.texinfo (C++ Language Interface): First stab. + (C++ Parsers): Remove. + +2005-06-22 Akim Demaille + + * data/lalr1.cc (yylex_): Honor %lex-param. + +2005-06-22 Akim Demaille + + Start a set of simple examples. + * examples/calc++/Makefile, examples/calc++/calc++-driver.cc, + * examples/calc++/calc++-driver.hh, + * examples/calc++/calc++-parser.yy, + * examples/calc++/calc++-scanner.ll, examples/calc++/calc++.cc, + * examples/calc++/compile, examples/calc++/test: New. + +2005-06-09 Paul Eggert + + * data/yacc.c (malloc, free) [defined __cplusplus]: Wrap inside + extern "C" {}. This fixes a problem reported by Paul Hilfinger, + which stems from the 2005-05-27 patch. + +2005-06-06 Paul Hilfinger + + * data/glr.c: Modify treatment of unused parameters to permit use + of g++ (which doesn't allow __attribute__ ((unused)) for parameters). + +2005-05-30 Paul Eggert + + Fix infringement on user name space reported by Janos Zoltan Szabo. + * data/yacc.c (yyparse): strlen -> yystrlen. + +2005-05-30 Akim Demaille + + * data/lalr1.cc (_): New. + Translate the various messages. + +2005-05-27 Paul Eggert + + Fix infringement on user name space reported by Bruno Haible. + * data/yacc.c (YYSIZE_T): Define first, so that later decls can use it. + Prefer GCC's __SIZE_TYPE__ if available, so that we don't infringe on + the user's name space. + (alloca): Include to get it, if it's not built in. + (YYMALLOC, YYFREE): Define only if needed. + (malloc, free): Declare, but only if needed, as this infringes on + the user name space. + +2005-05-25 Paul Eggert + + Fix BeOS, FreeBSD, MacOS porting problems reported by Bruno Haible. + * lib/bitset.c (bitset_print): Don't assume size_t can be printed + with %d format. + * lib/ebitset.c (min, max): Undef before defining. + * lib/vbitset.c (min, max): Likewise. + * lib/subpipe.c (create_subpipe): Save local variables in case + vfork clobbers them. + +2005-05-24 Bruno Haible + + * tests/synclines.at (AT_SYNCLINES_COMPILE): Add support for the + error message syntax used by gcc-4.0. + +2005-05-23 Paul Eggert + + * README: Mention m4 1.4.3. Remove obsolete advice about + Sun Forte Developer 6 update 2, VMS, and MS-DOS. + + * bootstrap: Remove workaround for problem I encountered with + gettext 0.14.1; it seems to be fixed now. + +2005-05-22 Paul Eggert + + * NEWS: Version 2.0a. + + * src/files.c: Include "stdio-safer.h"; this fixes a typo in + the previous change. + + Various maintainer cleanups. + * .cvsignore: Add a.exe, a.out, b.out,, conf[0-9]*, confdefs*, + conftest*, for benefit of CVS commands run at the same time as + "configure". Add build-aux, since "bootstrap" now creates it and + its subfiles. + * Makefile.cfg (move_if_change): Remove. + * Makefile.maint: Remove the update stuff; we now use "bootstrap". + (ftp-gnu, www-gnu, move_if_change, local_updates, update): + (po_repo, do-po-update, po-update, wget_files, get-targets): + (config.guess-url_prefix, config.sub-url_prefix): + (ansi2knr.c-url_prefix, texinfo.tex-url_prefix): + (standards.texi-url_prefix, make-stds.texi-url_prefix, taget, url): + ($(get-targets), cvs-files, automake_repo, wget-update, cvs-update): + Remove. + * configure.ac (AC_CONFIG_AUX_DIR): Change from config to build-aux; + this is now the recommended name. + * config/.cvsignore: Remove config.guess, config.rpath, config.sub, + depcomp, install-sh, mdate-sh, missing, mkinstalldirs, texinfo.tex, + ylwrap. These files now go into build-aux. + * config/move-if-change: Remove. + * config/prev-version.txt: Bump from 1.75 to 2.0. + + * bootstrap: Add stdio-safer, unistd-safer modules. + Remove m4/glibc2.m4 (introduced by latest gnulib, but + we don't need it). + * lib/.cvsignore: Add dup-safer.c, fd-safer.c, + fopen-safer.c, stdio-safer.h, unistd-safer.h. + * lib/subpipe.c: Include "unistd-safer.h". + (create_subpipe): Make sure all the newly-created + file descriptors are > 2, so that diagnostics don't + get sent down them (which might cause Bison to hang, in theory). + * m4/.cvsignore: Add stdio-safer.m4, unistd-safer.m4. + * src/files.c (xfopen): Use fopen_safer, not fopen. + + * data/lalr1.cc (yy::]b4_parser_class_name[::parse): Port + yesterday's yacc.c fix. + +2005-05-21 Paul Eggert + + * data/glr.c, data/lalr1.cc: Update copyright date. + + Fix a destructor bug reported by Wolfgang Spraul in + . + * data/yacc.c (yyabortlab): Don't call destructor, and + don't set yychar to EMPTY. + (yyoverflowlab): Don't call destructor. + (yyreturn): Call destructor, if yychar is neither YYEOF nor YYEMPTY. + * tests/calc.at (AT_CHECK_CALC): Expect one fewer output lines, + since we no longer output the message "discarding lookahead token + end of input ()". + +2005-05-20 Paul Hilfinger + + * data/glr.c (YY_SYMBOL_PRINT): Don't print newline at end to + fix a small glitch in debugging output. + (yyprocessOneStack, yyrecoverSyntaxError, yyparse): Print newline + after YY_SYMBOL_PRINT where needed. + + (struct yyGLRState): Add some comments. + (struct yySemanticOption): Add some comments. + (union yyGLRStackItem): Add comment. + + (yymergeOptionSets): Correct this to properly perform the union, + avoiding infinite reported by Michael Rosien. + Update comment. + + * tests/glr-regression.at: Add test for GLR merging error reported + by M. Rosien. + +2005-05-13 Paul Eggert + + * COPYING, ChangeLog, GNUmakefile, HACKING, Makefile.am, + Makefile.cfg, Makefile.maint, NEWS, README, README-alpha, + README-cvs, TODO, bootstrap, configure.ac, data/Makefile.am, + data/README, data/c.m4, data/glr.c, data/lalr1.cc, data/yacc.c, + data/m4sugar/m4sugar.m4, doc/Makefile.am, doc/bison.texinfo, + doc/fdl.texi, doc/gpl.texi, doc/refcard.tex, lib/Makefile.am, + lib/abitset.c, lib/abitset.h, lib/bbitset.h, lib/bitset.c, + lib/bitset.h, lib/bitset_stats.c, lib/bitset_stats.h, + lib/bitsetv-print.c, lib/bitsetv-print.h, lib/bitsetv.c, + lib/bitsetv.h, lib/ebitset.c, lib/ebitset.h, lib/get-errno.c, + lib/get-errno.h, lib/lbitset.c, lib/lbitset.h, lib/libiberty.h, + lib/main.c, lib/subpipe.c, lib/subpipe.h, lib/timevar.c, + lib/timevar.def, lib/timevar.h, lib/vbitset.c, lib/vbitset.h, + lib/yyerror.c, m4/cxx.m4, m4/m4.m4, m4/subpipe.m4, m4/timevar.m4, + m4/warning.m4, src/LR0.c, src/LR0.h, src/Makefile.am, src/assoc.c, + src/assoc.h, src/closure.c, src/closure.h, src/complain.c, + src/complain.h, src/conflicts.c, src/conflicts.h, src/derives.c, + src/derives.h, src/files.c, src/files.h, src/getargs.c, + src/getargs.h, src/gram.c, src/gram.h, src/lalr.c, src/lalr.h, + src/location.c, src/location.h, src/main.c, src/muscle_tab.c, + src/muscle_tab.h, src/nullable.c, src/nullable.h, src/output.c, + src/output.h, src/parse-gram.c, src/parse-gram.h, + src/parse-gram.y, src/print.c, src/print.h, src/print_graph.c, + src/print_graph.h, src/reader.c, src/reader.h, src/reduce.c, + src/reduce.h, src/relation.c, src/relation.h, src/scan-gram.l, + src/scan-skel.l, src/state.c, src/state.h, src/symlist.c, + src/symlist.h, src/symtab.c, src/symtab.h, src/system.h, + src/tables.c, src/tables.h, src/uniqstr.c, src/uniqstr.h, + src/vcg.c, src/vcg.h, src/vcg_defaults.h, tests/Makefile.am, + tests/actions.at, tests/c++.at, tests/calc.at, tests/conflicts.at, + tests/cxx-type.at, tests/existing.at, tests/glr-regression.at, + tests/headers.at, tests/input.at, tests/local.at, tests/output.at, + tests/reduce.at, tests/regression.at, tests/sets.at, + tests/synclines.at, tests/testsuite.at, tests/torture.at: + Update FSF postal mail address. + +2005-05-11 Paul Eggert + + * tests/local.at (AT_COMPILE_CXX): Treat LDFLAGS like AT_COMPILE does. + Problem reported by Ralf Menzel. + +2005-05-01 Paul Eggert + + * tests/actions.at: Test that stack overflow invokes destructors. + From Marcus Holland-Moritz. + * data/yacc.c (yyerrlab): Move the code that destroys the stack + from here.... + (yyreturn): to here. That way, destructors are called properly + even if the stack overflows, or the user calls YYACCEPT or + YYABORT. Stack-overflow problem reported by Marcus Holland-Moritz. + (yyoverflowlab): Destroy the lookahead. + +2005-04-24 Paul Eggert + + * data/yacc.c (YYSTACK_ALLOC_MAXIMUM): Add more-descriptive comment. + +2005-04-17 Paul Eggert + + * NEWS: Bison-generated C parsers no longer quote literal strings + associated with tokens. + * src/output.c (prepare_symbols): Don't escape strings, + since users don't want to see C escapes. + * tests/calc.at (AT_CHECK_CALC): Adjust to lack of quotes + in diagnostics. + * tests/input.at (Torturing the Scanner): Likewise. + * tests/regression.at (Token definitions, Web2c Actions): Likewise. + +2005-04-16 Paul Eggert + + * tests/torture.at (AT_INCREASE_DATA_SIZE): Skip the test if + the data size is known to be too small and we can't increase it. + This works around an HP-UX 11.00 glitch reported by Andrew Benham. + +2005-04-15 Paul Eggert + + * src/parse-gram.y: Include quotearg.h. + (string_as_id): Quote $1 before using it as a key, since the + lexer no longer quotes it for us. + (string_content): Don't strip quotes, since lexer no longer + quotes it for us. + * src/scan-gram.l: Include quotearg.h. + ("\""): Omit quote. + ("'"): Quote symbol before using it as + a key, since the rest of the lexer doesn't quote it. + * src/symtab.c (symbol_get): Don't quote symbol; caller does it now. + * tests/regression.at (Token definitions): Check for backslashes + in token strings. + + * data/yacc.c (YYSTACK_ALLOC_MAXIMUM): New macro. + (YYSIZE_T): Define to unsigned long int when using an older compiler. + (yyparse): Revamp code to generate long syntax error message, to + make it easier to translate, and to avoid problems with arithmetic + overflow. Change "virtual memory" to "memory" in diagnostic, since + we don't know whether the memory is virtual. + +2005-04-13 Paul Eggert + + * NEWS: Bison-generated C parsers now use the _ macro to + translate strings. + * data/yacc.c (_) [!defined _]: New macro. + All English strings wrapped inside this macro. + * doc/bison.texinfo (Bison Parser): Document _. + * po/POTFILES.in: Include src/parse-gram.c, since it now + includes translateable strings that parse-gram.y doesn't. + +2005-04-12 Paul Eggert + + * src/symtab.c (symbol_make_alias): Call symbol_type_set, + reverting the 2004-10-11 change to this function. + (symbol_check_alias_consistency): Don't call symbol_type_set + if the type name is already correct. + * tests/input.at (Typed symbol aliases): New test, from Tim Van Holder. + +2005-03-25 Paul Eggert + + * tests/regression.at (Token definitions): Don't use a token named + c, as that generates a "#define c ..." that runs afoul of buggy + stdlib.h that uses the identifier c as a member of struct + drand48_data. Problem reported by Horst Wente. + +2005-03-21 Paul Eggert + + * bootstrap: Change translation URL from + http://www2.iro.umontreal.ca/~gnutra/po/maint/bison/ to + http://www.iro.umontreal.ca/translation/maint/bison/ to avoid + redirection glitches. Problem reported by twlevo@xs4all.nl. + +2005-03-20 Paul Eggert + + * tests/local.at (AT_COMPILE, AT_COMPILE_CXX): Don't put options + after operands; POSIX says this isn't portable for the c99 command. + +2005-03-18 Paul Eggert + + * tests/glr-regression.at (glr-regr2a.y): Try to dump core + immediately if a data overrun has occurred; this may help us track + down what may be a spurious failure on MacOS. + +2005-03-17 Paul Eggert + + Respond to problems reported by twlevo@xs4all.nl. + + * bootstrap: Use "trap - 0" rather than the unportable "trap 0". + + * src/vcg.h: Comment fix. + * src/vcg_defaults.h: Parenthesize macro bodies to make them safe. + (G_CMAX): Change to -1 instead of INT_MAX. + + * data/yacc.c (yyparse): Omit spaces before #line. + +2005-03-15 Paul Eggert + + * src/tables.c (state_number_to_vector_number): Put it inside an + "#if 0", since it's not currently used. Problem reported by + Roland McGrath. + +2005-03-06 Paul Eggert + + * src/output.c (escaped_output): Renamed from + escaped_file_name_output, since we now use it for symbol tags as + well. All uses changed. + (symbol_destructors_output, symbol_printers_output): + Escape symbol tags too. + Problem reported by Matyas Forstner in + . + + * src/muscle_tab.c (muscle_code_grow): Don't quote numbers; it's + not needed. + * src/output.c (user_actions_output, token_definitions_output, + symbol_destructors_output, symbol_printers_output): Likewise. + * src/reader.c (prologue_augment): Likewise. + * src/scan-gram.l (handle_action_dollar, handle_action_at): Likewise. + + * src/vcg.c (output_edge): Don't quote linestyle arg. + Problem reported by twlevo@xs4all.nl. + +2005-02-28 Paul Eggert + + * doc/bison.texinfo (Semantic Tokens): Fix scoping problem in + example, reported by Derek M Jones. Also, make the example even + more outrageous, to better illustrate how bad the problem is. + +2005-02-24 Paul Eggert + + * doc/bison.texinfo (Mfcalc Symtab): Correct the prototype for + putsym. Typo reported by Sebastian Piping. + +2005-02-23 Paul Eggert + + * doc/bison.texinfo (Language and Grammar): some -> same + (Epilogue): int he -> in the + Typos reported by Sebastian Piping via Justin Pence. + +2005-02-07 Paul Eggert + + * tests/glr-regression.at (Improper handling of embedded actions + and dollar(-N) in GLR parsers): Renamed from "Improper handling of + embedded actions and $-N in GLR parsers", work around an Autoconf bug + with dollar signs in test names. + * tests/input.at (Invalid dollar-n): Renamed from "Invalid \$n", + for a similar reason. + +2005-01-28 Paul Eggert + + * src/vcg.c (output_graph): G_VIEW -> normal_view in case someone + wants to redefine G_VIEW. + +2005-01-27 Paul Eggert + + * src/vcg.c (get_view_str): Remove case for normal_view. + Problem reported by twlevo@xs4all.nl. + +2005-01-24 Paul Eggert + + * configure.ac (O0CFLAGS, O0CXXFLAGS): Fix quoting bug. + Problem reported by twlevo@xs4all.nl. + + * doc/bison.texinfo: Change @dircategory from "GNU programming + tools" to "Software development". Requested by Richard Stallman + via Karl Berry. + +2005-01-23 Paul Eggert + + * tests/c++.at (AT_CHECK_DOXYGEN): Don't use options after operands. + Problem reported by twlevo@xs4all.nl. + +2005-01-21 Paul Eggert + + * data/yacc.c (YYCOPY, yystpcpy, yyparse): Remove "register" + keyword; it's not needed with modern compilers, and it doesn't + affect correctness with older compilers. Suggested by + twlevo@xs4all.nl. + +2005-01-17 Paul Eggert + + * data/glr.c (yyuserAction): Add "default: break;" case to pacify + gcc -Wswitch-default. + * data/lalr1.cc (yy::]b4_parser_class_name[::parse): Likewise. + * data/yacc.c (yyparse): Likewise. + +2005-01-12 Paul Eggert + + * src/system.h (OUTPUT_EXT, TAB_EXT): Define only if not defined + already. Let config.h define any nonstandard values. + +2005-01-10 Paul Eggert + + * tests/calc.at (_AT_DATA_CALC_Y): Use alarm (100), not alarm (10), + for the benefit of slower hosts. Problem reported by + Nelson H. F. Beebe. + +2005-01-07 Paul Eggert + + * data/yacc.c (yyparse): Pacify non-GCC compilers about yyerrorlab + being defined and not used. + * data/lalr1.cc (yyparse): Likewise. + Use "if (false)" rather than "if (0)". + +2005-01-05 Paul Eggert + + * TODO: Mention that we should allow NUL bytes in tokens. + +2005-01-02 Paul Eggert + + * src/scan-skel.l (<>): Don't close standard output. + Problem reported by Hans Aberg. + +2005-01-01 Paul Eggert + + * src/getargs.c (version): Happy new year; update overall + program copyright date from 2004 to 2005. + + * src/scan-skel.l ("@output ".*\n): Don't close standard output. + Problem reported by Hans Aberg. + * tests/output.at (AT_CHECK_OUTPUT): New arg SHELLIO. + (Output file names.): Add a test for the case when standard output + is closed. + +2004-12-26 Paul Eggert + + * doc/bison.texinfo (@copying): Update FDL version number to 1.2, + to fix an oversight in the Bison 2.0 manual. + +2004-12-25 Paul Eggert + + * NEWS: Version 2.0. Reformat the existing news items since + 1.875, so that related items are grouped together. + * configure.ac (AC_INIT): Bump version to 2.0. + * src/parse-gram.c, src/parse-gram.h: Regenerate with 2.0. + + * tests/torture.at (Exploding the Stack Size with Alloca): Set + YYSTACK_USE_ALLOCA to 1 if __GNUC__ or alloca are defined; + otherwise, we're not testing alloca. Unfortunately there's no + simple way to consult HAVE_ALLOCA here. + + * data/lalr1.cc (yydestruct_): Pacify unused variable warning + for yymsg, too. + + * src/LR0.c (new_itemsets): Use memset rather than zeroing by + hand. This avoids a warning about comparing int to size_t when + GCC warnings are enabled. + +2004-12-22 Paul Eggert + + * NEWS: Bison-generated parsers no longer default to using the + alloca function (when available) to extend the parser stack, due + to widespread problems in unchecked stack-overflow detection. + * data/glr.c (YYMAXDEPTH): Remove undef when zero. It's the user's + responsibility to set it to a positive value. This lets the user + specify a value that is not a preprocessor constant. + * data/yacc.c (YYMAXDEPTH): Likewise. + (YYSTACK_ALLOC): Define only if YYSTACK_USE_ALLOCA is nonzero. + * doc/bison.texinfo (Stack Overflow): YYMAXDEPTH no longer needs + to be a compile-time constant. However, explain the constraints on it. + Also, explain the constraints on YYINITDEPTH. + (Table of Symbols): Explain that alloca is no longer the default. + Explain the user's responsibility if they define YYSTACK_USE_ALLOCA + to 1. + + * doc/bison.texinfo (Location Default Action): Mention that n must + be zero when k is zero. Suggested by Frank Heckenbach. + +2004-12-22 Akim Demaille + + * data/lalr1.cc (parser::token_number_type, parser::rhs_number_type) + (parser::state_type, parser::semantic_type, parser::location_type): + Private, not public. + (parser::parse): Return ints, not bool. + Returning a bool introduces a problem: 0 corresponds to false, and + it seems weird to return false on success. Returning true changes + the conventions for yyparse. + Alternatively we could return void and send an exception. + There is no clear consensus (yet?). + (state_stack, semantic_stack, location_stack): Rename as... + (state_stack_type, semantic_stack_type, location_stack_type): these. + Private, not public. + * tests/c++.at: New. + * tests/testsuite.at, tests/Makefile.am: Adjust. + +2004-12-21 Akim Demaille + + * data/lalr1.cc (parser::parse): Return a bool instead of an int. + +2004-12-21 Akim Demaille + + Don't impose std::string for filenames. + + * data/lalr1.cc (b4_filename_type): New. + (position::filename): Use it. + (parser.hh): Move the inclusion of stack.hh and location.hh below + the user code, so that needed headers for the filename type can be + included first. + Forward declare them before the user code. + * tests/Makefile.am (check-local, installcheck-local): Pass + TESTSUITEFLAGS to the TESTSUITE. + +2004-12-20 Akim Demaille + + Use more STL like names: my_class instead of MyClass. + + * data/lalr1.cc (LocationStack, LocationType, RhsNumberType) + (SemanticStack, SemanticType, StateStack, StateType) + (TokenNumberType, Stack, Slice, Traits, Parser::location) + (Parser::value): Rename as... + (location_stack, location_type, rhs_number_type, semantic_stack) + (semantic_type, state_stack, state_type, token_number_type, stack) + (slice, traits, parser::yylloc, parser::yylval): these. + + * tests/calc.at, tests/regression.at, tests/actions.at: Adjust. + +2004-12-19 Paul Eggert + + * data/glr.c (YYLLOC_DEFAULT): Use GNU spacing conventions. + * data/yacc.c (YYLLOC_DEFAULT): Likewise. + +2004-12-17 Paul Eggert + + Remove uses of 'short int' and 'unsigned short int'. This raises + some arbitrary limits. It uses more memory but nowadays that's + not much of an issue. + + This change does not affect the generated parsers; that's a different + task, as some users will want to conserve memory there. + + Ideally we should use size_t to represent all object counts, and + something like ptrdiff_t to represent signed differences of object + counts; but that will require more code-cleanup than I have the + time to do right now. + + * src/LR0.c (allocate_itemsets, new_itemsets, save_reductions): + Use size_t, not int or short int, to count objects. + * src/closure.c (nritemset, closure): Likewise. + * src/closure.h (nritemset, closure): Likewise. + * src/nullable.c (nullable_compute): Likewise. + * src/print.c (print_core): Likewise. + * src/print_graph.c (print_core): Likewise. + * src/state.c (state_compare, state_hash): Likewise. + * src/state.h (struct state): Likewise. + * src/tables.c (default_goto, goto_actions): Likewise. + + * src/gram.h (rule_number, rule): Use int, not short int. + * src/output.c (prepare_rules): Likewise. + * src/state.h (state_number, STATE_NUMBER_MAXIMUM, transitions, + errs, reductions): Likewise. + * src/symtab.h (symbol_number, SYMBOL_NUMBER_MAXIMUM, struct symbol): + Likewise. + * src/tables.c (vector_number, tally, action_number, + ACTION_NUMBER_MINIMUM): Likewise. + * src/output.c (muscle_insert_short_int_table): Remove. + +2004-12-17 Akim Demaille + + * data/lalr1.cc: Extensive Doxygenation. + (error_): Rename as... + (error): this, since it is visible to the user. + Adjust callers. + (Parser::message): Now an automatic variable from... + (Parser::yyreport_syntax_error_): here. + * tests/actions.at, tests/calc.at, tests/regression.at: Adjust to + Parser::error. + * tests/input.at: Escape $. + +2004-12-16 Paul Eggert + + * data/glr.c (b4_lhs_value, b4_rhs_value, b4_rhs-location): + Parenthesize rhs to avoid obscure problems with mistakes like + "foo$$bar = foo$1bar;". Problem reported by twlevo at xs4all. + * data/lalr1.cc (b4_lhs_value, b4_rhs_value, b4_lhs_location, + b4_rhs_location): Likewise. + * data/yacc.c (b4_lhs_value, b4_rhs_value, b4_lhs_location, + b4_rhs_location): Likewise. + +2004-12-16 Akim Demaille + + * data/lalr1.cc (yyreport_syntax_error_): Catch up with glr.c and + yacc.c: be sure to stay within yycheck_. + * tests/actions.at: Re-enable C++ tests. + +2004-12-16 Akim Demaille + + * src/print_graph.c (print_graph): Remove layoutalgorithm uses for + real. + +2004-12-16 Akim Demaille + + Use #define to handle the %name-prefix. + + * data/glr.c, data/yacc.c: Comment changes. + * data/lalr1.cc (yylex): Use #define to select the name of yylex, + so that one can refer to yylex in the parser file, and have it + renamed, as is the case with other skeletons. + +2004-12-16 Akim Demaille + + Move lalr1.cc internals into yy*. + + * data/lalr1.cc (semantic_stack_, location_stack_, state_stack_) + (semantic_stack_, location_stack_, pact_, pact_ninf_, defact_) + (pgoto_, defgoto_, table_, table_ninf_, check_, stos_, r1_, r2_) + (name_, rhs_, prhs_, rline_, token_number_, eof_, last_, nnts_) + (empty_, final_, terror_, errcode_, ntokens_) + (user_token_number_max_, undef_token_, n_, len_, state_, nerrs_) + (looka_, ilooka_, error_range_, nerrs_): + Rename as... + (yysemantic_stack_, yylocation_stack_, yystate_stack_) + (yysemantic_stack_, yylocation_stack_, yypact_, yypact_ninf_) + (yydefact_, yypgoto_, yydefgoto_, yytable_, yytable_ninf_) + (yycheck_, yystos_, yyr1_, yyr2_, yyname_, yyrhs_, yyprhs_) + (yyrline_, yytoken_number_, yyeof_, yylast_, yynnts_, yyempty_) + (yyfinal_, yyterror_, yyerrcode_, yyntokens_) + (yyuser_token_number_max_, yyundef_token_, yyn_, yylen_, yystate_) + (yynerrs_, yylooka_, yyilooka_, yyerror_range_, yynerrs_): + these. + +2004-12-15 Paul Eggert + + Fix some problems reported by twlevo at xs4all. + * src/symtab.c (symbol_new): Report an error if the input grammar + contains too many symbols. This is better than calling abort() later. + * src/vcg.h (enum layoutalgorithm): Remove. All uses removed. + (struct node, struct graph): + Rename member expand to stretch. All uses changed. + (struct graph): Remove member layoutalgorithm. All uses removed. + * src/vcg.c (get_layoutalgorithm_str): Remove. All uses removed. + * src/vcg_defaults.h (G_STRETCH): Renamed from G_EXPAND. + All uses changed. + (N_STRETCH): Rename from N_EXPAND. All uses changed. + +2004-12-15 Akim Demaille + + * data/lalr1.cc: Normalize /** \brief ... */ to ///. + Add more Doxygen comments. + (symprint_, stack_print_, reduce_print_, destruct_, pop) + (report_syntax_error_, translate_): Rename as... + (yysymprint_, yystack_print_, yyreduce_print_, yydestruct_) + (yypop_, yyreport_syntax_error_, yytranslate_): this. + +2004-12-15 Akim Demaille + + * data/lalr1.cc (lex_): Rename as... + (yylex_): this. + Move the trace here. + Take the %name-prefix into account. + Reported by Alexandre Duret-Lutz. + +2004-12-15 Akim Demaille + + Simplify the C++ parser constructor. + + * data/lalr1.cc (debug_): Rename as... + (yydebug_): so that the parser's internals are always in the yy* + pseudo namespace. + Adjust uses. + (b4_parse_param_decl): Remove the leading comma as it is now only + called as unique argument list. + (Parser::Parser): Remove the constructor accepting a location and + an initial debugging level. + Remove from the other ctor the argument for the debugging level. + (debug_level_type, debug_level, set_debug_level): New. + + * tests/actions.at, tests/calc.at, tests/regression.at: Adjust + constructor calls. + +2004-12-15 Akim Demaille + + Remove b4_root related material: failure experiment + (which goal was to allow to derive from a class). + + * data/lalr1.cc (b4_root, b4_param, b4_constructor): Remove + definitions and uses. + +2004-12-14 Paul Eggert + + * data/glr.c (struct yyGLRStack): yyerror_range now has 3 items, + not 2, since it's not portable to subtract 1 from the start of an + array. The new item 0 is never set or used. All uses changed. + + (yyrecoverSyntaxError): Use YYLLOC_DEFAULT instead of assuming + the default definition of YYLLOC_DEFAULT. Problem reported + by Frank Heckenbach. + +2004-12-12 Paul Eggert + + * data/glr.c (YYRHSLOC): Don't have two definitions, one for + the normal case and one for the error case. Just use the + first one uniformly. Problem reported by Frank Heckenbach. + (YYLLOC_DEFAULT): Use the conventions of yacc.c, so we can + use exactly the same macro in both places. + (yyerror_range): Now of type yyGLRStackItem, not YYLTYPE, + so that the normal-case YYRHSLOC works for the error case too. + All uses changed. + * data/yacc.c (YYRHSLOC): New macro, taken from glr.c. + (YYLLOC_DEFAULT): Use the same macro as glr.c. + * doc/bison.texinfo (Location Default Action): Don't claim that + we have an array of locations. Use the same macro for both glr + and lalr parsers. Mention YYRHSLOC. Mention what happens when + the index is 0. + +2004-12-10 Paul Eggert + + * HACKING: Update email addresses to send announcements to. + + * configure.ac (AC_INIT): Bump version to 1.875f. + +2004-12-10 Paul Eggert + + * NEWS: Version 1.875e. + * src/parse-gram.c, src/parse-gram.h: Regenerate with 1.875e. + + * src/scan-skel.l: Include "complain.h", for "fatal". + + * src/relation.h (relation_print, relation_digraph): + Relation sizes are of type relation_node, not size_t (this is + merely a doc fix, since the two types are equivalent). + (relation_transpose): Relation sizes are of type relation_node, + not int. + * src/relation.c: Likewise. + (top, infinity): Now of type relation_node, not int. + (traverse, relation_transpose): Use relation_node, not int. + + * data/glr.c (yyuserAction, yyrecoverSyntaxError): Mark args + with ATTRIBUTE_UNUSED if they're not used, to avoid GCC warning. + (yyparse): Remove unused local introduced in 2004-10-25 patch. + + * tests/actions.at (_AT_CHECK_PRINTER_AND_DESTRUCTOR): New arg + specifying whether the test should be skipped. Use it tp + specify that the [%defines %skeleton "lalr1.cc"] tests currently + fail on some hosts, and should be skipped. + +2004-12-08 Paul Eggert + + * src/system.h (CALLOC, MALLOC, REALLOC): Remove. All callers + changed to use xcalloc, xnmalloc, xnrealloc, respectively, + unless otherwise specified below. + + * src/LR0.c (allocate_itemsets): Use xnmalloc, not xcalloc, + to allocate kernel_base, kernel_items, kernel_size, since + they needn't be initialized to 0. + (allocate_storgae): Likewise, for shiftset, redset, shift_symbol. + * src/closure.c (new_closure): Likewise, for itemset. + * src/derives.c (derives_compute): Likewise, for delts, derives, q. + * src/lalr.c (set_goto_map): Likewise, for temp_map. + (initialize_F): Likewise, for reads, edge, reads[i], includes[i]. + (build_relations): Likewise for edge, states1, includes. + * src/nullable.c (nullable_compute): Likewise, for squeue, relts. + * src/reader.c (packgram): Likewise, for ritem, rules. + * src/reduce.c (nonterminals_reduce): Likewise for nontermmap. + * src/relation.c (relation_digraph): Likewise for VERTICES. + (relation_transpose): Likewise for new_R, end_R. + * src/symtab.c (symbols_token_translations_init): Likewise for + token_translations. + * src/tables.c (save_row): Likewise for froms, tos, conflict_tos. + (token_actions): Likewise for yydefact, actrow, conflrow, + conflict_list. + (save_column): Likewise for froms[symno], tos[symno]. + (goto_actions): Likewise for state_count. + (pack_table): Likewise for base, pos, check. + (tables_generate): Likewise for width. + + * src/LR0.c (set_states): Don't reuse kernel_size and kernel_base + for initial core. Just have a separate core, so we needn't worry + about whether kernel_size and kernel_base are initialized. + + * src/LR0.c (shift_symbol, redset, shiftset, kernel_base, + kernel_size, kernel_items): Remove unnecessary initialization. + * src/conflicts.c (conflicts): Likewise. + * src/derives.c (derives): Likewise. + * src/muscle_tablc (muscle_insert): Likewise. + * src/relation.c (relation_digraph): Likewise. + * src/tables.c (froms, tos, conflict_tos, tally, width, actrow, order, + conflrow, conflict_table, conflict_list, table, check): + Likewise. + + * src/closure.c (new_closure): Arg is of type unsigned int, not int. + This is because all callers pass unsigned int. + * src/closure.h (new_closure): Likewise. + + * src/lalr.c (initialize_F): Initialize reads[i] in all cases. + (build_relations): Initialize includes[i] in all cases. + * src/reader.c (packgram): Always initialize rules[ruleno].prec + and rules[ruleno].precsym. Initialize members in order. + * src/relation.c (relation_transpose): Always initialize new_R[i] + and end_R[i]. + * src/table.c (conflict_row): Initialize 0 at end of conflict_list. + + * src/output.c (prepare_actions): Pass 0 instead of conflict_list[0]; + conflict_list[0] was always 0, but now it isn't initialized. + + * src/table.c (table_grow): When conflict_table grew, the grown + area wasn't cleared. Fix this. + + * lib/.cvsignore: Add strdup.c, strdup.h. + * m4/.cvsignore: Add strdup.m4. + +2004-12-07 Paul Eggert + + * src/lalr.h (GOTO_NUMBER_MAXIMUM): New macro. + * src/lalr.c (set_goto_map): Don't allow ngotos to equal + GOTO_NUMBER_MAXIMUM, since we occasionally compute + ngotos + 1 without checking for overflow. + (build_relations): Use END_NODE, not -1, to denote end of edges. + * src/lalr.c (set_goto_map, map_goto, initialize_F, add_loopback_edge, + build_relations): Use goto_number, not int, for goto numbers. + * src/tables.c (save_column, default_goto): Likewise. + +2004-11-23 Akim Demaille + + * data/lalr1.cc (YYSTYPE): Define it as is done for C, instead + of #defining from yystype. + Don't typedef yystype, C++ does not need it. + This lets it possible to forward declare it as union. + +2004-11-23 Paul Eggert + + * bootstrap (gnulib_modules): Add extensions. + Problem reported by Jim Meyering. + +2004-11-22 Paul Eggert + + * src/LR0.c, src/closure.c, src/derives.c, src/gram.c, + src/lalr.c, src/nullable.c, src/relation.c, src/scan-skel.l, + src/system.h, src/tables.c: XFREE -> free, to accommodate + recent change to gnulib xalloc.h. + Problem reported by Jim Meyering. + +2004-11-17 Akim Demaille + + * data/lalr1.cc (symprint_): Use cdebug_ to avoid warnings. + +2004-10-28 Akim Demaille , + Alexandre Duret-Lutz + + * data/lalr1.cc (Parser::yycdebug_): New, a pointer, to allow + changes. + (YYCDEBUG): Adjust. + Use it instead of cdebug_. + (Parser::debug_stream, Parser::set_debug_stream): New. + (Parser::symprint_): Define cdebug_ for temporary backward + compatibility. + * tests/actions.at (_AT_CHECK_PRINTER_AND_DESTRUCTOR): Use + debug_stream (). + +2004-11-17 Akim Demaille + + * data/lalr1.cc (Parser:print_): Remove, use %printer instead. + * tests/regression.at (_AT_DATA_DANCER_Y): Adjust. + * tests/calc.at (_AT_DATA_CALC_Y): Ditto. + * tests/actions.at (_AT_CHECK_PRINTER_AND_DESTRUCTOR): Likewise. + +2004-10-27 Paul Eggert + + * data/glr.c (yyloc_default): Remove; not used. + Problem reported by Frank Heckenbach. + +2004-10-25 Akim Demaille + + * data/glr.c (YYRHSLOC): Move its definition next to its uses. + Introduce another definition to address simple location arrays. + (yyGLRStack): New member: yyerror_range. + (yyrecoverSyntaxError, yyparse): Update it. + (yyrecoverSyntaxError): Use it when shifting the error token to + have an accurate range, equivalent to the one computed by both + yacc.c and lalr1.cc. + * tests/cxx-type.at (_AT_TEST_GLR_CXXTYPES): Change its yylex so + that column numbers start at column 0, as per GNU Coding + Standards, the others tests, and the doc. + (_AT_RESOLVED_GLR_OUTPUT_WITH_LOC, _AT_AMBIG_GLR_OUTPUT_WITH_LOC): + Adjust to the above change (first column is 0). + And adjust the location of the "", now covering the whole + line. + +2004-10-22 Akim Demaille + and Paul Eggert + + Remove some arbitrary limits on goto numbers and relations. + * src/lalr.c (goto_map, ngotos, from_state, to_state): Omit + initial values, since they're never used. + (set_goto_map): ngotos is now unsigned, so test for overflow + by seeing whether it wraps around to zero. + * src/lalr.h (goto_number): Now size_t, not short int. + (GOTO_NUMBER_MAXIMUM): Remove. + * src/relation.c (relation_print, traverse, relation_transpose): + Check for END_NODE rather than looking at sign. + * src/relation.h (END_NODE): New macro. + (relation_node): Now size_t, not short int. + +2004-10-22 Paul Eggert + + * doc/bison.texinfo (Language and Grammar): In example, "int" is a + keyword, not an identifier. Problem reported by Baron Schwartz in + . + +2004-10-11 Akim Demaille + + * src/symtab.c (symbol_check_alias_consistency): Also check + type names, destructors, and printers. + Reported by Alexandre Duret-Lutz. + Recode the handling of associativity and precedence in terms + of symbol_precedence_set. + Accept no redeclaration at all, not even equal to the previous + value. + (redeclaration): New. + Use it to factor redeclaration complaints. + (symbol_make_alias): Don't set the type of the alias, let + symbol_check_alias_consistency do it as for other features. + * src/symtab.h (symbol): Add new member prec_location, and + type_location. + * src/symtab.c (symbol_precedence_set, symbol_type_set): Set them. + * tests/input.at (Incompatible Aliases): New. + +2004-10-09 Paul Eggert + + .cvsignore fixes to accommodate gnulib changes, + and the practice of naming build directories "_build". + * .cvsignore: Add "_*". Sort. + * lib/.cvsignore: Add getopt_.h, xalloc-die.c. + * m4/.cvsignore: Add "*_gl.m4". + +2004-10-06 Akim Demaille + + * src/parse-gram.y (add_param): Fix the truncation of trailing + spaces. + +2004-10-05 Akim Demaille + + In Bison 1.875's yacc.c, YYLLOC_DEFAULT was called regardless + whether the reducion was empty or not. This leaves room to + improve the use of YYLLOC_DEFAULT in such a case. + lalr1.cc is still experimental, so changing this is acceptable. + And finally, there are probably not many users who changed the + handling of locations in GLR, so changing is admissible too. + + * data/glr.c, data/lalr1.cc, data/yacc.c (YYLLOC_DEFAULT): On an + empty reduction, set @$ to an empty location ending the previously + stacked symbol. + Adjust uses to make sure the code is triggered on empty + reductions. + * tests/actions.at (_AT_CHECK_PRINTER_AND_DESTRUCTOR): Adjust the + expected output: empty reductions have empty locations. + +2004-09-29 Akim Demaille + + * data/lalr1.cc: Move towards a more standard C++ coding style + for templates: Class < T > -> Class. + +2004-09-29 Akim Demaille + + * data/lalr1.cc: Reinstall the former ctor, for sake of + compatibility, but warn it will be removed. + Move towards a more standard C++ coding style (i.e., type *var -> + type* var). + +2004-09-27 Paul Eggert + + * src/parse-gram.y (add_param): Rewrite to avoid strchr, + since it's less likely to work if NULs are involved in the future. + +2004-09-27 Akim Demaille + + * data/yacc.c (YY_LOCATION_PRINT): Fix its default declaration. + +2004-09-27 Akim Demaille + + * data/lalr1.cc (b4_parse_param_decl_1): New. + (b4_parse_param_decl): Use it to have different names between attribute + and argument names. + (b4_cc_constructor_call): Likewise. + +2004-09-24 Akim Demaille + + * src/parse-gram.y (add_param): Strip the leading and trailing + blanks from a formal argument declaration. + (YY_LOCATION_PRINT): New. + +2004-09-24 Akim Demaille + + * data/c.m4 (b4_yysymprint_generate): Move the YYINPUT invocation + after the location. + +2004-09-24 Akim Demaille + + * doc/bison.texinfo (Table of Symbols): Sort. + +2004-09-21 Akim Demaille + + * data/yacc.c, data/glr.c (b4_at_dollar, b4_dollar_dollar): Remove + the useless parentheses. + Suggested by Paul Eggert. + +2004-09-20 Akim Demaille + + Let the initial-action act on the look-ahead, and use it for the + "initial push" (corresponding to an hypothetical beginning-of-file). + And let lalr1.cc honor %initial-action. + + * doc/bison.texinfo (Initial Action Decl): Clarify, and add an + example. + * data/lalr1.cc (Parser::initlocation_): Remove, bad experiment. + (Parser::Parser): Remove the ctor that used to initialize it. + (Parser::parse): Like in the other skeletons, issue the "starting + parse" message before any action. + Honor %initial-action. + Initialize the stacks with the lookahead. + * data/yacc.c: Let $$ and @$ in %initial-action designate the + look-ahead. + Push them in the stacks. + * tests/actions.at, tests/calc.at: Adjust the C++ ctor invocations. + +2004-09-20 Akim Demaille + + * doc/bison.texinfo (Initial Action Decl): New. + +2004-09-20 Akim Demaille + + * data/yacc.c (YY_LOCATION_PRINT): Use YYLTYPE_IS_TRIVIAL as a + clearer criterion to define it. + (parse): Initialize the initial location when YYLTYPE_IS_TRIVIAL. + When reducing on an empty RHS, use the latest stacked location as + location. + yylloc is not always available. + * data/glr.c: Likewise. + Also, honor initial-actions. + +2004-09-20 Akim Demaille + + * data/yacc.c (YY_LOCATION_PRINT): New. + Define when we know YYLTYPE's structure, i.e., when the default + YYLLOC_DEFAULT is used. + * data/c.m4 (b4_yysymprint_generate): Use it. + * data/lalr1.cc (YYLLOC_DEFAULT): Stop relying on the initial + value of the result. + (error_start_): Replace with... + (error_range_): this location array. + This allows to replace code relying on the implementation of + locations by portable code. + * data/yacc.c (yylerrsp): Replace with... + (yyerror_range): this. + Every time a token is popped, update yyerror_range[0], to have an + accurate location for the error token. + * data/glr.c (YY_LOCATION_PRINT): New. + (yyprocessOneStack): Fix an invocation of YY_SYMBOL_PRINT: + deference a pointer. + * tests/actions.at (_AT_CHECK_PRINTER_AND_DESTRUCTOR): No longer + report the location in %printers. + + * src/scan-skel.l: Instead of abort, report error messages to ease + understanding skeleton scanning failures. + +2004-09-16 Akim Demaille + + * data/lalr1.cc (Stack::Iterator, Stack::ConstIterator): Rename as... + (iterator, const_iterator): these, to be more in the C++ spirit. + Also, return reverse iterators so that when displaying the stack + we display its bottom first. + (Parser::stack_print_, Parser::reduce_print_): Match the messages + from yacc.c. + We should probably use vector here though. + +2004-09-16 Akim Demaille + + Have more complete shift traces. + + * data/yacc.c, data/lalr1.c, data/glr.c: Use YY_SYMBOL_PRINT + to report Shifts instead of ad hoc YYDPRINTF invocations, + including for the error token. + * data/lalr1.cc (symprint_): Output the location. + * tests/actions.at (_AT_CHECK_PRINTER_AND_DESTRUCTOR): In C++, don't + output the location within the %printer. + Activate GLR tests, at least to make sure they compile properly. + They still don't pass though. + * tests/calc.at: Adjust expect verbose output, since now "Entering + state..." is on a different line than the "Shifting" message. + +2004-09-08 Akim Demaille + + * tests/actions.at (_AT_CHECK_PRINTER_AND_DESTRUCTOR): Move the + Bison directive from the Bison file to the invocation of this + macro, so that these directives are passed to + AT_BISON_OPTION_PUSHDEFS to get correct help macros. + Use these helping macros (e.g., AT_LOC, AT_VAL and so forth). + Move the AT_SETUP/AT_CLEANUP outside, to report as test title + the extra Bison directives instead of the whole series. + Change the grammar so that there are recoverable errors, and + unrecoverable errors. Now we can have the parser give up before + consuming the whole input. As a result we now can observe that + the lookahead is freed when needed. + Change the parser source to parse argv[1] instead of a hard coded + string. + Simplify yylex, and give a value and location to EOF. + Simplify some invocations of AT_CHECK_PRINTER_AND_DESTRUCTOR that + passed directives already coded in the file. + Add some tests to check the location of "error". + For some tests, the C++ parser is correct, and not yacc.c. + For other tests, they provide different, but unsatisfying, values, + so keep the C++ value so that at least one parser is "correct" + according to the test suite. + (Actions after errors): Remove, this is subsumed by the + AT_CHECK_PRINTER_AND_DESTRUCTOR series. + +2004-09-06 Akim Demaille + + * data/lalr1.cc: Adjust the indentation of the labels. + (Parser::pop): New. + Use it. + +2004-09-06 Akim Demaille + + * data/yacc.cc, data/glr.cc (yydestruct): Accept an additional + argument, an informative message. + Call YY_SYMBOL_PRINT. + Adjust all callers: integrate the associated YY_SYMBOL_PRINT. + * data/lalr1.cc (destruct_): Likewise. + In addition, no longer depend on b4_yysymprint_generate and + b4_yydestruct_generate to generate these functions, do it "by + hand". + +2004-09-03 Akim Demaille + + * data/glr.c, data/lalr1.cc, data/yacc.c: When YYABORT was + invoked, yydestruct the lookahead. + * tests/calc.at (Calculator $1): Update the expected lengths of + traces: there is an added line for the discarded lookahead. + * doc/bison.texinfo (Destructor Decl): Some rewording. + Define "discarded" symbols. + +2004-09-02 Akim Demaille + + * data/lalr1.cc (translate_, destruct_): No reason to be static. + +2004-09-02 Akim Demaille + + * data/glr.c, yacc.c (YYDSYMPRINT): Remove, not used. + (YYDSYMPRINTF): Rename as... + (YY_SYMBOL_PRINT): this. + * data/lalr1.cc (YY_SYMBOL_PRINT): New, modeled after the previous + two. + Use it instead of direct symprint_ calls. + (yybackup): Tweak the "Now at end of input" case to match yacc.c's + one. + +2004-09-02 Akim Demaille + + * data/lalr1.cc (b4_yysymprint_generate): New. + (symprint_): New member function, defined when YYDEBUG. + Use it consistently instead of token/nterm debugging output by + hand. + * tests/actions.at (_AT_CHECK_PRINTER_AND_DESTRUCTOR): Adjust + %printer calls to use cdebug_ when using lalr1.cc. + +2004-08-30 Florian Krohm + + * data/glr.c: Guard the declarations of yypstack and yypdumpstack + with #ifdef YYDEBUG. + +2004-08-26 Akim Demaille + + * doc/bison.texinfo (Implementing Loops): Rename as... + (Implementing Gotos/Loops): this. + +2004-08-13 Paul Eggert + + Adjust to latest gnulib. + * bootstrap (gnulib_modules): Add xalloc-die. + Set LC_ALL=C so that file names sort consistently. + Prefer the gnulib copies of gettext.m4, glibc21.m4, + inttypes_h.m4, lib-ld.m4, lib-prefix.m4, po.m4, stdint_h.m4, + uintmax_t.m4, ulonglong.m4. + (intl_files_to_remove): Add gettext.m4, lib-ld.m4, lib-prefix.m4, + po.m4 since we are now using _gl.m4 instead. + +2004-08-10 Florian Krohm + + * src/scan-action.l: Remove. Scanning of semantic actions is + handled in scan-gram.l. + +2004-08-07 Florian Krohm + + * src/scan-gram.l (handle_syncline): Use uniqstr_new not xstrdup. + + * src/location.h (struct): The file member is a uniqstr. + (equal_boundaries): Use UNIQSTR_EQ for comparison. + +2004-07-22 Paul Eggert + + Fix bug with non-%union parsers that have printers or destructors, + which led to a Bison core dump. Reported by Peter Fales in + . + + * data/c.m4 (b4_symbol_actions): Don't assume %union was used. + * data/lalr1.cc (yystype) [defined YYSTYPE]: Define to YYSTYPE, + not to our own type. + * src/output.c (symbol_destructors_output, symbol_printers_output): + Don't assume %union. + * tests/actions.at (_AT_CHECK_PRINTER_AND_DESTRUCTOR, + AT_CHECK_PRINTER_AND_DESTRUCTOR): New argument + UNION-FLAG. All callers changed. + (_AT_CHECK_PRINTER_AND_DESTRUCTOR): Don't assume %union. + Use type char, not unsigned int, when declaring an array of char; + this lets us remove a cast. + (Printers and Destructors): Add non-%union test cases. + +2004-06-21 Paul Eggert + + * doc/bison.texinfo: Minor editorial changes, mostly to the new + GLR writeups. E.g., avoid frenchspacing and the future tense, + change "lookahead" to "look-ahead", and change "wrt" to "with + respect to". + +2004-06-21 Paul Hilfinger + + * doc/bison.texinfo (Merging GLR Parses, Compiler Requirements): + New sections, split off from the GLR Parsers section. Put the new + Simple GLR Parser near the start of the GLR section, for clarity. + Rewrite connective text. + +2004-06-21 Frank Heckenbach + + * doc/bison.texinfo (Simple GLR Parsers): New section. + +2004-06-21 Paul Eggert + + * NEWS, TODO, doc/bison.texinfo: + Use "look-ahead" instead of "lookahead", to be consistent. + * REFERENCES: Fix incorrect reference to DeRemer and Pennello, + while we're fixing "look-ahead". + * src/conflicts.c (shift_set): Renamed from shiftset. + (look_ahead_set): Renamed from lookaheadset. + * src/print.c: Likewise. + * src/getargs.c (report_args): Add "look-ahead" as the new canonical + name for "lookahead". + (report_types, usage): Likewise. + * src/getargs.h (report_look_ahead_tokens): Renamed from + report_lookaheads. + * src/lalr.c (compute_look_ahead_tokens): Renamed from + compute_lookaheads. + (state_look_ahead_tokens_count): Renamed from state_lookaheads_count. + (look_ahead_tokens_print): Renamed from lookaheads_print. + * src/state.c (state_rule_look_ahead_tokens_print): Renamed from + state_rule_lookaheads_print. + * src/state.h: Likewise. + (reductions.look_ahead_tokens): Renamed from lookaheads. + * tests/torture.at (AT_DATA_LOOK_AHEAD_TOKENS_GRAMMAR): Renamed from + AT_DATA_LOOKAHEADS_GRAMMAR. + +2004-06-03 Paul Eggert + + * README: Update location of patched M4 distribution. + +2004-05-30 Albert Chin-A-Young + + Don't assume the C++ compiler takes the same arguments as the C compiler + (trivial change). + * configure.ac (O0CXXFLAGS): New var. + * tests/atlocal.in (CXXFLAGS): Use it. + +2004-05-29 Paul Eggert + + Fix some "make check" problems with C++ reported by + Albert Chin-A-Young for Tru64 C++ in this thread: + http://lists.gnu.org/archive/html/bug-bison/2004-05/msg00049.html + + * m4/cxx.m4 (BISON_TEST_FOR_WORKING_CXX_COMPILER): Check for std::cerr. + * tests/actions.at (_AT_CHECK_PRINTER_AND_DESTRUCTOR): + Output to a .cc file for C++, not to a .c file. + * tests/calc.at (AT_CHECK_CALC): Likewise. + * tests/regression.at (AT_CHECK_DANCER): Likewise. + * tests/local.at (AT_COMPILE_CXX): Default to OUTPUT.cc, not OUTPUT.c. + +2004-05-28 Albert Chin-A-Young + + * tests/calc.at, tests/actions.at: Workaround for SGI + C++ compiler. (trivial change) + +2004-05-27 Paul Eggert + + Spent a few hours checking out which prerequisite versions the + current sources actually require. I went all the way back to + Gettext 0.10.40, Automake 1.4, and Autoconf 2.57 and investigated + a seemingly endless set of combinations of versions more recent + than that. The bottom line is that the current sources require + fairly recent versions of the build tools, and it'll be some work + to change this. + * configure.ac (AC_PREREQ): Increase from 2.58 to 2.59. + (AM_INIT_AUTOMAKE): Increase from 1.7 to 1.8. + (AM_GNU_GETTEXT_VERSION): Increase from 0.11.5 to 0.12. + Add comments explaining why those particular versions are + currently needed. + + * src/parse-gram.y (lloc_default): Rewrite to avoid compiler bug + in SGI MIPSpro 7.4.1m. Problem reported by Albert Chin-A-Young in + . + + * configure.ac (AC_PREREQ): Bump to 2.58, since 2.57 doesn't work + (it fails with a Autoconf-without-aclocal-m4 diagnostic). + +2004-05-26 Paul Eggert + + * configure.ac (AM_GNU_GETTEXT_VERSION): Lower it from 0.14.1 to + 0.11.5. Suggested by Bruno Haible. + * bootstrap: Remove gettext version checking. + + * doc/bison.texinfo (Decl Summary): Also mention that %union + can depend on prerequisite types. Problem reported by Tim + Van Holder. + +2004-05-25 Paul Eggert + + * README: Mention GNU m4 1.4 bugs and Akim's patched version. + * README-alpha: Don't tell people not to package this. + + * bootstrap: Don't assume $(...) works; use `...` instead. + Problem reported by Paul Hilfinger. Also, diagnose non-GNU + gettext better. + + * doc/bison.texinfo (Decl Summary, Bison Options): Clarify what's + put into the -d output file, and mention what to do if YYSTYPE is + defined as a macro. + +2004-05-24 Paul Eggert + + Undo change made earlier today: it caused autopoint to not bring + in ABOUT-NLS. Ouch. Instead, substitute our own diagnostic for + autopoint's. + + * bootstrap: Check that gettext version matches what's in + configure.ac. Warn users to ignore robots.txt ERROR 404. + * bootstrap: Undo today's earlier change (logged below). + * configure.ac (AM_GNU_GETTEXT_VERSION): Likewise. + + The gettext version checking is causing more trouble than it's + curing; remove it. Problem reported by Paul Hilfinger. + + * bootstrap: Issue a warning that one can expect a message + 'AM_GNU_GETTEXT is used, but not AM_GNU_GETTEXT_VERSION'. + * configure.ac (AM_GNU_GETTEXT_VERSION): Remove. + +2004-05-23 Paul Eggert + + Ensure that the C++ compiler used for testing actually works on a + simple test program; if not, skip the C++-related tests. Problem + reported by Vin Shelton in: + http://lists.gnu.org/archive/html/bug-bison/2004-05/msg00026.html + + * m4/cxx.m4: New file. + * configure.ac (BISON_TEST_FOR_WORKING_CXX_COMPILER): Add. + * tests/atlocal.in (BISON_CXX_WORKS): Add. + * tests/local.at (AT_COMPILE_CXX): Use it. + +2004-05-21 Paul Eggert + + * data/glr.c (yylloc): Output this macro even if locations are not + being generated, as the GLR parser needs it even in that case. + Problem reported by Troy A. Johnson + . + + * configure.ac (AC_INIT): Update to 1.875e. + 2004-05-21 Paul Eggert * NEWS: Version 1.875d. @@ -269,7 +2390,7 @@ 2004-03-08 Paul Eggert Add support for hex token numbers. Suggested by Odd Arild Olsen in - . + . * NEWS: Document hexadecimal tokens, no NUL bytes, %destructor in lalr1.cc. @@ -286,7 +2407,7 @@ * tests/local.at (AT_COMPILE, AT_COMPILE_CXX): Ignore stdout from compilers. This fixes a problem with Intel's C++ compiler being chatty, reported by Guido Trentalancia in - . + . 2004-02-09 Alexandre Duret-Lutz @@ -482,7 +2603,7 @@ Have lalr1.cc catch with Paul Eggert's patch to fix the infinite error recovery loops. This patch is based on - . + . Also, augment the similarity between lalr1.cc and yacc.c. Note: the locations of error recovery rules are not correct yet. @@ -531,14 +2652,14 @@ * data/glr.c (yyglrReduce): Don't use C89 string concatenation, for portability to K&R C (after ansi2knr, presumably). See - + by Frank Heckenbach, though I have omitted the structure-initialization part of his glr-knr.diff patch since I recall that the Portable C Compiler didn't require that change. Let the user specify how to allocate and free memory. Derived from a suggestion by Frank Heckenbach in - . + . * data/glr.c (YYFREE, YYMALLOC, YYREALLOC): New macros. All uses of free, malloc, realloc changed to use these macros, and unnecessary casts removed. @@ -548,7 +2669,7 @@ * data/lalr1.cc (operator<<(std::ostream&, const Position&)): use s.empty() rather than s == "" to test for empty string; see - + (trivial change) 2003-06-25 Akim Demaille @@ -571,7 +2692,7 @@ yyreportTree): Do not assume that size_t is the same width as int, when printing sizes. Print sizes using an unsigned format. Problem reported by Frank Heckenbach in - . + . Port to Forte Developer 7 C compiler. * data/glr.c (struct YYLTYPE): If locations are not being used, @@ -616,7 +2737,7 @@ (ATTRIBUTE_UNUSED): Define unconditionally. Upgrade to 2003-06-08 libbitset, submitted by Michael Hayes in: - + * lib/Makefile.am (bitsets_sources): Add vbitset.c, vbitset.h. * lib/vbitset.c, lib/vbitset.h: New files. * lib/abitset.c, lib/bbitset.h, lib/bitset.c, lib/bitset.h, @@ -736,7 +2857,7 @@ * tests/local.at (AT_COMPILE_CXX): Use it instead of CFLAGS. Fix a GLR parser bug I reported in February; see - . + . The problem was that GLR parsers did not conform to the C standard, because actions like { $1 = $2 + $3; } expanded to expressions that invoked YYFILL in separate subexpressions, and YYFILL assigned @@ -757,7 +2878,7 @@ parser can loop. Provide a test case and a fix for yacc.c. I don't have a fix for lalr1.cc or for glr.c, unfortunately. The original bug report is in: - + * data/yacc.c (YYERROR): Now just 'goto yyerrorlab', since the macro's size was becoming unwieldy. @@ -890,14 +3011,14 @@ * lib/bitset.h (__INT_TO_PTR): Define to a value that presumes C89. This avoids a diagnostic on compilers that define __STDC__ to 0, fixing a problem with Tru64 cc reported by Martin Mokrejs in - . + . 2003-05-03 Paul Eggert * lib/bitset.h (BITSET_FOR_EACH, BITSET_FOR_EACH_REVERSE): Do not overrun array bounds. This should fix a bug reported today by Olatunji Oluwabukunmi in - . + . 2003-04-29 Akim Demaille @@ -929,7 +3050,7 @@ 2003-04-27 Paul Eggert Avoid gcc -Wundef warnings reported by Gerald Pfeifer in - . + . * data/yacc.c (YYSTACK_ALLOC): Don't evaluate YYSTACK_USE_ALLOCA if it is not defined. (YYMAXDEPTH): Don't evaluate YYMAXDEPTH if it is not defined. @@ -941,13 +3062,13 @@ type suitable for the corresponding table, since the latter might be unsigned but the ninf value might be negative. This fixes a bug reported by Alexandre Duret-Lutz in - . + . * configure.ac (AC_FUNC_ERROR_AT_LINE): Remove, since gl_ERROR invokes it. We shouldn't invoke it twice because it will attempt to put error.o in the archive twice. This fixes a glitch reported by Martin Mokrejs in - . + . 2003-04-21 Paul Eggert @@ -974,7 +3095,7 @@ * src/conflicts.c (set_conflicts): Resolve all conflicts, not just the first one. This change is from Paul Hilfinger, and it fixes regression reported by Werner Lemberg in - . + . (resolve_sr_conflict): Don't invoke state_errs_set unless one or more tokens have been explicitly made errors. @@ -1023,7 +3144,7 @@ (<>, <>): Set *loc to the scanner cursor, instead of leaving it undefined. This fixes a bug reported by Tim Van Holder in - . + . * tests/input.at (Torturing the Scanner): Test the scanner on an empty input file, which was Tim Van Holder's test case. @@ -1031,7 +3152,7 @@ can be included, include sys/time.h and sys/times.h first, if available. This works around the SunOS 4.1.4 porting bug reported by Bruce Becker in - . + . * m4/subpipe.m4 (BISON_PREREQ_SUBPIPE): Don't AC_CHECK_HEADERS([sys/wait.h]), as this interferes with @@ -1145,7 +3266,7 @@ * lib/mbswidth.c: Include before "mbswidth.h", to work around a UnixWare 7.1.1 porting bug reported by John Hughes in - . + . 2003-02-26 Paul Eggert @@ -1160,7 +3281,7 @@ * data/glr.c (yy_reduce_print): yylineno -> yylno, to avoid collision with flex use of yylineno. Problem reported by Bruce Lilly in - . + . * data/lalr1.cc (yy::]b4_parser_class_name[::parse): Likewise. * data/yacc.c (yy_reduce_print): Likewise. @@ -1230,13 +3351,13 @@ * tests/atlocal.in (LDFLAGS, LIBS): New vars. * tests/testsuite.at (AT_COMPILE): Use them. This fixes the testsuite problem reported by Robert Lentz in - . + . 2003-02-12 Paul Eggert * data/yacc.c (yyerrlab) [YYERROR_VERBOSE]: Avoid subscript error in yycheck. Bug reported by Andrew Suffield in - . + . * data/glr.c (yyreportSyntaxError) [YYERROR_VERBOSE]: Likewise. Check for malloc failure, for consistency with yacc.c. (yytname_size): Remove, for consistency with yacc.c. @@ -1366,7 +3487,7 @@ Changes in response to error report by S. Eken: GLR mode does not handle negative $ indices or $ indices in embedded rules correctly. - See . + See . * data/glr.c (b4_rhs_value): Change to use YYFILL macro. (b4_rhs_location): Ditto. @@ -1397,8 +3518,8 @@ * data/lalr1.cc: Do not use @output_header_name@ unless b4_defines_flag is set. This fixes two bugs reported by Tim Van Holder in - - and . + + and . 2003-01-21 Paul Eggert @@ -1416,7 +3537,7 @@ * src/output.c (symbol_printers_output): Fix typo that led to core dump. Problem reported by Antonio Rus in - . + . 2003-01-13 Akim Demaille , Quoc Peyrot , @@ -1434,7 +3555,7 @@ * NEWS: %expect-violations are now just warnings, reverting to Bison 1.30 and 1.75 behavior. This fixes the GCC 3.2 bootstrapping problem reported by Matthias Klose; see - . + . * src/conflicts.c (conflicts_print): Likewise. * tests/conflicts.at (%expect not enough, %expect too much, %expect with reduce conflicts): Likewise. @@ -1562,7 +3683,7 @@ Fix a bug where error locations were not being recorded correctly. This problem was originally reported by Paul Hilfinger in - . + . * data/yacc.c (yyparse): New local var yylerrsp, to record the top of the location stack's error locations. @@ -1610,7 +3731,7 @@ Remove obsolete references to bison.simple and bison.hairy. Problem mentioned by Aubin Mahe in - . + . * data/glr.c: Comment fix. * doc/bison.1: Remove references. Also, mention "yacc". @@ -1745,7 +3866,7 @@ * config/install-sh: Sync with autotools. Fix a bad interaction with flex 2.5.23 reported by Bruce Lilly in - . + . * data/yacc.c (YYLTYPE, struct yyltype): Do not define unless locations are requested. (union yyalloc): Do not depend on YYLTYPE_IS_TRIVIAL unless @@ -2026,7 +4147,7 @@ sequences like "@" that are treated specially by src/scan-skel.l. Instead, just use the file's basename. This fixes the bug reported by Martin Mokrejs in - . + . 2002-12-06 Paul Eggert @@ -2124,7 +4245,7 @@ * configure.ac (AC_REPLACE_FUNCS): Add strtoul. * lib/strtoul.c: New file, from gnulib. This fixes a porting bug reported by Peter Klein in - . + . 2002-11-30 Paul Eggert @@ -2176,7 +4297,7 @@ * data/c.m4 (b4_yysymprint_generate): yyout -> yyoutput, to avoid collision with lex macro described by Bruce Lilly in - . + . * tests/actions.at (_AT_CHECK_PRINTER_AND_DESTRUCTOR): Likewise. * doc/bison.texinfo (Prologue, Tracing): yyprint -> print_token_value. * src/parse-gram.y (print_token_value): Renamed from yyprint. @@ -2274,7 +4395,7 @@ * data/glr.c (yygetLRActions): Replace `yyindex' with `yytable[yyindex]' to fix typo introduced in my 2002-11-09 patch. This fixes the regression with Sun ONE Studio 7 cc that I reported in - . + . 2002-11-18 Akim Demaille @@ -2392,7 +4513,7 @@ duplicating xfopen's body. Fix bugs reported by Nelson H. F. Beebe in - . + . * tests/headers.at (AT_TEST_CPP_GUARD_H): Don't assume that "$CC -E foo.h" is allowed, as this doesn't work with the Portland @@ -2435,7 +4556,7 @@ 2002-11-13 Paul Eggert Fix some bugs reported by Albert Chin-A-Young in - . + . * tests/input.at (Torturing the Scanner): Don't invoke "cc a.c b.c -o c"; the HP C compiler chatters during compilation. @@ -2464,7 +4585,7 @@ (yyglrReduce): Return yyok, not 0. This should avoid the enumerated-type warnings reported by Nelson H. F. Beebe in - . + . * lib/bbitset.h (BITSET_INLINE): Remove. * lib/bitset.h [! BITSET_INLINE]: Remove. @@ -2474,12 +4595,12 @@ * data/glr.c (inline): Remove #define. It's the user's responsibility to #define it away, just like 'const'. This fixes one of the bugs reported by Nelson H. F. Beebe in - . + . * Makefile.maint (po-check): Scan .l and .y files instead of the .c and the .h files that they generate. This fixes the bug reported by Tim Van Holder in: - + Look for N_ as well as for _. Try to avoid matching #define for N_ and _. * po/POTFILES.in: Remove src/parse-gram.c, src/scan-gram.c, @@ -2640,7 +4761,7 @@ Revamp to fix many (but not all) of the C- and M4-related quoting problems. Among other things, this fixes the Bison bug reported by Jan Hubicka when processing the Bash grammar; see: - + Use new @ escapes consistently. Represent brackets with @{ and @} rather than @<:@ and @:>@, since this works a bit better with dumb @@ -2708,7 +4829,7 @@ 2002-11-09 Paul Eggert Fix the test failure due to GCC warnings described in - . + . * data/glr.c (yyis_pact_ninf, yyis_table_ninf): New macros, which evaluate to 0 if it's impossible for NINF to be in the respective table. @@ -3060,8 +5181,8 @@ * data/glr.c (struct yyltype): Define members even when not doing locations. This is more consistent with yacc.c, and it works around the following bug reports: - http://mail.gnu.org/archive/html/bug-bison/2002-10/msg00106.html - http://mail.gnu.org/archive/html/bug-bison/2002-10/msg00111.html + http://lists.gnu.org/archive/html/bug-bison/2002-10/msg00106.html + http://lists.gnu.org/archive/html/bug-bison/2002-10/msg00111.html * doc/bison.texinfo: Minor spelling and typographical fixes. Use @acronym consistently. Standardize on "Yacc" instead of "YACC", @@ -3493,7 +5614,7 @@ 2002-10-13 Paul Eggert Fix problem reported by Henrik Grubbstroem in - : + : "nonterm: { $$ = 123; } { $$ = $1; };" was wrongly rejected, because the Bison parser reads the second action before reducing the first one. @@ -3510,7 +5631,7 @@ Include when checking for clock_t and struct tms. Use same include order as source. This is for the SunOS 4.1.4 porting bug reported by Peter Klein in - . + . * lib/timevar.c: Update copyright date and clarify comments. (get_time) [IN_GCC]: Keep the GCC version for reference. @@ -3523,13 +5644,13 @@ * src/reader.c (grammar_current_rule_check): Don't worry about the default action if $$ is untyped. Prevents bogus warnings reported by Jim Gifford in - . + . * data/c.m4 (b4_token_enum): Do not define YYTOKENTYPE. * data/glr.c, data/lalr1.cc, data/yacc.c: Output token definitions before the first part of user declarations. Fixes compatibility problem reported by Jim Gifford for kbd in - . + . 2002-10-11 Paul Eggert @@ -3654,7 +5775,7 @@ * lib/bitset.h (bitset_reset): Do not assume that bitset_word is the same width as int. This reapplies a hunk of the 2002-08-12 patch - , + , which was inadvertently undone by the 2002-09-30 patch. * lib/lbitset.c (debug_lbitset): Do not assume that bitset_word is the same width as int. @@ -6303,7 +8424,7 @@ * tests/atlocal.at (GCC): New. * tests/synclines.at (AT_TEST_SYNCLINE): New macro. - (Prologue synch line, ,%union synch line, Postprologue synch line) + (Prologue synch line, %union synch line, Postprologue synch line) (Action synch line, Epilogue synch line): New tests. * src/reader.c (parse_union_decl): Define the muscle stype_line. * data/bison.simple, data/bison.c++: Use it. @@ -12116,24 +14237,13 @@ * REFERENCES: entered into RCS ------ -Copyright (C) 1987, 1988, 1991, 1992, 1993, 1994, 1995, 1996, 1997, -1998, 1999, 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc. + ----- -This file is part of Bison, the GNU Compiler Compiler. + Copyright (C) 1987, 1988, 1991, 1992, 1993, 1994, 1995, 1996, + 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005 Free Software + Foundation, Inc. -Bison 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 2, or (at your option) -any later version. - -Bison 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 Bison; see the file COPYING. If not, write to -the Free Software Foundation, Inc., 59 Temple Place - Suite 330, -Boston, MA 02111-1307, USA. + Copying and distribution of this file, with or without + modification, are permitted provided the copyright notice and this + notice are preserved. diff --git a/src/bin/bison/GNUmakefile b/src/bin/bison/GNUmakefile index 7e67536c4b..675af82285 100644 --- a/src/bin/bison/GNUmakefile +++ b/src/bin/bison/GNUmakefile @@ -18,7 +18,7 @@ # # You should have received a copy of the GNU General Public License along # with this program; if not, write to the Free Software Foundation, Inc., -# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. # Systems where /bin/sh is not the default shell need this. The $(shell) # command below won't work with e.g. stock DOS/Windows shells. diff --git a/src/bin/bison/INSTALL b/src/bin/bison/INSTALL index 54caf7c190..23e5f25d0e 100644 --- a/src/bin/bison/INSTALL +++ b/src/bin/bison/INSTALL @@ -1,13 +1,16 @@ -Copyright (C) 1994, 1995, 1996, 1999, 2000, 2001, 2002 Free Software -Foundation, Inc. +Installation Instructions +************************* - This file is free documentation; the Free Software Foundation gives +Copyright (C) 1994, 1995, 1996, 1999, 2000, 2001, 2002, 2004, 2005 Free +Software Foundation, Inc. + +This file is free documentation; the Free Software Foundation gives unlimited permission to copy, distribute and modify it. Basic Installation ================== - These are generic installation instructions. +These are generic installation instructions. The `configure' shell script attempts to guess correct values for various system-dependent variables used during compilation. It uses @@ -67,9 +70,9 @@ The simplest way to compile this package is: Compilers and Options ===================== - Some systems require unusual options for compilation or linking that -the `configure' script does not know about. Run `./configure --help' -for details on some of the pertinent environment variables. +Some systems require unusual options for compilation or linking that the +`configure' script does not know about. Run `./configure --help' for +details on some of the pertinent environment variables. You can give `configure' initial values for configuration parameters by setting variables in the command line or in the environment. Here @@ -82,7 +85,7 @@ is an example: Compiling For Multiple Architectures ==================================== - You can compile the package for more than one kind of computer at the +You can compile the package for more than one kind of computer at the same time, by placing the object files for each architecture in their own directory. To do this, you must use a version of `make' that supports the `VPATH' variable, such as GNU `make'. `cd' to the @@ -99,19 +102,19 @@ for another architecture. Installation Names ================== - By default, `make install' will install the package's files in -`/usr/local/bin', `/usr/local/man', etc. You can specify an -installation prefix other than `/usr/local' by giving `configure' the -option `--prefix=PATH'. +By default, `make install' installs the package's commands under +`/usr/local/bin', include files under `/usr/local/include', etc. You +can specify an installation prefix other than `/usr/local' by giving +`configure' the option `--prefix=PREFIX'. You can specify separate installation prefixes for architecture-specific files and architecture-independent files. If you -give `configure' the option `--exec-prefix=PATH', the package will use -PATH as the prefix for installing programs and libraries. -Documentation and other data files will still use the regular prefix. +pass the option `--exec-prefix=PREFIX' to `configure', the package uses +PREFIX as the prefix for installing programs and libraries. +Documentation and other data files still use the regular prefix. In addition, if you use an unusual directory layout you can give -options like `--bindir=PATH' to specify different values for particular +options like `--bindir=DIR' to specify different values for particular kinds of files. Run `configure --help' for a list of the directories you can set and what kinds of files go in them. @@ -122,7 +125,7 @@ option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'. Optional Features ================= - Some packages pay attention to `--enable-FEATURE' options to +Some packages pay attention to `--enable-FEATURE' options to `configure', where FEATURE indicates an optional part of the package. They may also pay attention to `--with-PACKAGE' options, where PACKAGE is something like `gnu-as' or `x' (for the X Window System). The @@ -137,11 +140,11 @@ you can use the `configure' options `--x-includes=DIR' and Specifying the System Type ========================== - There may be some features `configure' cannot figure out -automatically, but needs to determine by the type of machine the package -will run on. Usually, assuming the package is built to be run on the -_same_ architectures, `configure' can figure that out, but if it prints -a message saying it cannot guess the machine type, give it the +There may be some features `configure' cannot figure out automatically, +but needs to determine by the type of machine the package will run on. +Usually, assuming the package is built to be run on the _same_ +architectures, `configure' can figure that out, but if it prints a +message saying it cannot guess the machine type, give it the `--build=TYPE' option. TYPE can either be a short name for the system type, such as `sun4', or a canonical name which has the form: @@ -156,7 +159,7 @@ where SYSTEM can have one of these forms: need to know the machine type. If you are _building_ compiler tools for cross-compiling, you should -use the `--target=TYPE' option to select the type of system they will +use the option `--target=TYPE' to select the type of system they will produce code for. If you want to _use_ a cross compiler, that generates code for a @@ -167,9 +170,9 @@ eventually be run) with `--host=TYPE'. Sharing Defaults ================ - If you want to set default values for `configure' scripts to share, -you can create a site shell script called `config.site' that gives -default values for variables like `CC', `cache_file', and `prefix'. +If you want to set default values for `configure' scripts to share, you +can create a site shell script called `config.site' that gives default +values for variables like `CC', `cache_file', and `prefix'. `configure' looks for `PREFIX/share/config.site' if it exists, then `PREFIX/etc/config.site' if it exists. Or, you can set the `CONFIG_SITE' environment variable to the location of the site script. @@ -178,7 +181,7 @@ A warning: not all `configure' scripts look for a site script. Defining Variables ================== - Variables not defined in a site shell script can be set in the +Variables not defined in a site shell script can be set in the environment passed to `configure'. However, some packages may run configure again during the build, and the customized values of these variables may be lost. In order to avoid this problem, you should set @@ -186,14 +189,18 @@ them in the `configure' command line, using `VAR=value'. For example: ./configure CC=/usr/local2/bin/gcc -will cause the specified gcc to be used as the C compiler (unless it is -overridden in the site shell script). +causes the specified `gcc' to be used as the C compiler (unless it is +overridden in the site shell script). Here is a another example: + + /bin/bash ./configure CONFIG_SHELL=/bin/bash + +Here the `CONFIG_SHELL=/bin/bash' operand causes subsequent +configuration-related scripts to be executed by `/bin/bash'. `configure' Invocation ====================== - `configure' recognizes the following options to control how it -operates. +`configure' recognizes the following options to control how it operates. `--help' `-h' diff --git a/src/bin/bison/Makefile.am b/src/bin/bison/Makefile.am index 93e167a38d..33c3f05626 100644 --- a/src/bin/bison/Makefile.am +++ b/src/bin/bison/Makefile.am @@ -1,5 +1,5 @@ ## Process this file with automake to produce Makefile.in -*-Makefile-*- -## Copyright (C) 2001, 2002, 2003, 2004 Free Software Foundation, Inc. +## Copyright (C) 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc. ## This program is free software; you can redistribute it and/or modify ## it under the terms of the GNU General Public License as published by @@ -13,14 +13,19 @@ ## You should have received a copy of the GNU General Public License ## along with this program; if not, write to the Free Software -## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA -## 02111-1307 USA +## Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +## 02110-1301 USA ACLOCAL_AMFLAGS = -I m4 -SUBDIRS = config po lib data src doc tests +SUBDIRS = config po runtime-po lib data src doc examples tests -EXTRA_DIST = REFERENCES OChangeLog Makefile.maint GNUmakefile Makefile.cfg +# Files installed for use by Automake. +aclocaldir = @aclocaldir@ +aclocal_DATA = m4/bison-i18n.m4 + +EXTRA_DIST = GNUmakefile Makefile.cfg Makefile.maint \ + OChangeLog PACKAGING .PHONY: maintainer-check maintainer-check: diff --git a/src/bin/bison/Makefile.cfg b/src/bin/bison/Makefile.cfg index 8de8cf954f..0d72c3eb79 100644 --- a/src/bin/bison/Makefile.cfg +++ b/src/bin/bison/Makefile.cfg @@ -13,11 +13,10 @@ # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA -# 02111-1307, USA. +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +# 02110-1301, USA. prev_version_file = $(srcdir)/config/prev-version.txt -move_if_change = $(srcdir)/config/move-if-change announce_gen = $(srcdir)/config/announce-gen release_archive_dir = releases diff --git a/src/bin/bison/Makefile.in b/src/bin/bison/Makefile.in index 556fa2147e..cd42aeab96 100644 --- a/src/bin/bison/Makefile.in +++ b/src/bin/bison/Makefile.in @@ -1,8 +1,8 @@ -# Makefile.in generated by automake 1.8.5 from Makefile.am. +# Makefile.in generated by automake 1.9.6 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, -# 2003, 2004 Free Software Foundation, Inc. +# 2003, 2004, 2005 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. @@ -13,6 +13,7 @@ # PARTICULAR PURPOSE. @SET_MAKE@ + srcdir = @srcdir@ top_srcdir = @top_srcdir@ VPATH = @srcdir@ @@ -33,38 +34,47 @@ POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : +build_triplet = @build@ host_triplet = @host@ -subdir = . DIST_COMMON = README $(am__configure_deps) $(srcdir)/Makefile.am \ $(srcdir)/Makefile.in $(srcdir)/config.hin \ $(top_srcdir)/configure ABOUT-NLS AUTHORS COPYING ChangeLog \ - INSTALL NEWS README-alpha THANKS TODO + INSTALL NEWS THANKS TODO build-aux/config.guess \ + build-aux/config.rpath build-aux/config.sub build-aux/depcomp \ + build-aux/install-sh build-aux/mdate-sh build-aux/missing \ + build-aux/mkinstalldirs build-aux/texinfo.tex build-aux/ylwrap +subdir = . ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/alloca.m4 \ + $(top_srcdir)/m4/bison-i18n.m4 $(top_srcdir)/m4/cxx.m4 \ $(top_srcdir)/m4/dirname.m4 $(top_srcdir)/m4/dmalloc.m4 \ $(top_srcdir)/m4/dos.m4 $(top_srcdir)/m4/error.m4 \ $(top_srcdir)/m4/exitfail.m4 $(top_srcdir)/m4/extensions.m4 \ - $(top_srcdir)/m4/getopt.m4 $(top_srcdir)/m4/gettext.m4 \ + $(top_srcdir)/m4/getopt.m4 $(top_srcdir)/m4/gettext_gl.m4 \ $(top_srcdir)/m4/gnulib.m4 $(top_srcdir)/m4/hard-locale.m4 \ $(top_srcdir)/m4/hash.m4 $(top_srcdir)/m4/iconv.m4 \ - $(top_srcdir)/m4/lib-ld.m4 $(top_srcdir)/m4/lib-link.m4 \ - $(top_srcdir)/m4/lib-prefix.m4 $(top_srcdir)/m4/m4.m4 \ + $(top_srcdir)/m4/inttypes_h_gl.m4 \ + $(top_srcdir)/m4/lib-ld_gl.m4 $(top_srcdir)/m4/lib-link.m4 \ + $(top_srcdir)/m4/lib-prefix_gl.m4 $(top_srcdir)/m4/m4.m4 \ $(top_srcdir)/m4/mbrtowc.m4 $(top_srcdir)/m4/mbstate_t.m4 \ $(top_srcdir)/m4/mbswidth.m4 $(top_srcdir)/m4/nls.m4 \ $(top_srcdir)/m4/obstack.m4 $(top_srcdir)/m4/onceonly.m4 \ - $(top_srcdir)/m4/po.m4 $(top_srcdir)/m4/progtest.m4 \ + $(top_srcdir)/m4/po_gl.m4 $(top_srcdir)/m4/progtest.m4 \ $(top_srcdir)/m4/quote.m4 $(top_srcdir)/m4/quotearg.m4 \ - $(top_srcdir)/m4/stdbool.m4 $(top_srcdir)/m4/stpcpy.m4 \ - $(top_srcdir)/m4/strndup.m4 $(top_srcdir)/m4/strnlen.m4 \ - $(top_srcdir)/m4/subpipe.m4 $(top_srcdir)/m4/timevar.m4 \ - $(top_srcdir)/m4/unlocked-io.m4 $(top_srcdir)/m4/warning.m4 \ + $(top_srcdir)/m4/stdbool.m4 $(top_srcdir)/m4/stdint_h_gl.m4 \ + $(top_srcdir)/m4/stdio-safer.m4 $(top_srcdir)/m4/stpcpy.m4 \ + $(top_srcdir)/m4/strdup.m4 $(top_srcdir)/m4/strndup.m4 \ + $(top_srcdir)/m4/strnlen.m4 $(top_srcdir)/m4/subpipe.m4 \ + $(top_srcdir)/m4/timevar.m4 $(top_srcdir)/m4/uintmax_t_gl.m4 \ + $(top_srcdir)/m4/ulonglong_gl.m4 \ + $(top_srcdir)/m4/unistd-safer.m4 $(top_srcdir)/m4/warning.m4 \ $(top_srcdir)/m4/xalloc.m4 $(top_srcdir)/m4/xstrndup.m4 \ $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \ configure.lineno configure.status.lineno -mkinstalldirs = $(SHELL) $(top_srcdir)/config/mkinstalldirs +mkinstalldirs = $(SHELL) $(top_srcdir)/build-aux/mkinstalldirs CONFIG_HEADER = config.h CONFIG_CLEAN_FILES = SOURCES = @@ -75,6 +85,15 @@ RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \ install-recursive installcheck-recursive installdirs-recursive \ pdf-recursive ps-recursive uninstall-info-recursive \ uninstall-recursive +am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; +am__vpath_adj = case $$p in \ + $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ + *) f=$$p;; \ + esac; +am__strip_dir = `echo $$p | sed -e 's|^.*/||'`; +am__installdirs = "$(DESTDIR)$(aclocaldir)" +aclocalDATA_INSTALL = $(INSTALL_DATA) +DATA = $(aclocal_DATA) ETAGS = etags CTAGS = ctags DIST_SUBDIRS = $(SUBDIRS) @@ -100,6 +119,8 @@ AUTOHEADER = @AUTOHEADER@ AUTOM4TE = @AUTOM4TE@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ +BISON_CXX_WORKS = @BISON_CXX_WORKS@ +BISON_LOCALEDIR = @BISON_LOCALEDIR@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ @@ -117,6 +138,7 @@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ GCC = @GCC@ +GETOPT_H = @GETOPT_H@ GMSGFMT = @GMSGFMT@ HAVE__BOOL = @HAVE__BOOL@ INSTALL_DATA = @INSTALL_DATA@ @@ -124,6 +146,7 @@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ INTLLIBS = @INTLLIBS@ +INTL_MACOSX_LIBS = @INTL_MACOSX_LIBS@ LDFLAGS = @LDFLAGS@ LEX = @LEX@ LEXLIB = @LEXLIB@ @@ -141,6 +164,7 @@ MKINSTALLDIRS = @MKINSTALLDIRS@ MSGFMT = @MSGFMT@ MSGMERGE = @MSGMERGE@ O0CFLAGS = @O0CFLAGS@ +O0CXXFLAGS = @O0CXXFLAGS@ OBJEXT = @OBJEXT@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ @@ -169,6 +193,9 @@ ac_ct_CC = @ac_ct_CC@ ac_ct_CXX = @ac_ct_CXX@ ac_ct_RANLIB = @ac_ct_RANLIB@ ac_ct_STRIP = @ac_ct_STRIP@ + +# Files installed for use by Automake. +aclocaldir = @aclocaldir@ am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@ @@ -176,6 +203,8 @@ am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ @@ -205,8 +234,11 @@ sharedstatedir = @sharedstatedir@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ ACLOCAL_AMFLAGS = -I m4 -SUBDIRS = config po lib data src doc tests -EXTRA_DIST = REFERENCES OChangeLog Makefile.maint GNUmakefile Makefile.cfg +SUBDIRS = config po runtime-po lib data src doc examples tests +aclocal_DATA = m4/bison-i18n.m4 +EXTRA_DIST = GNUmakefile Makefile.cfg Makefile.maint \ + OChangeLog PACKAGING + all: config.h $(MAKE) $(AM_MAKEFLAGS) all-recursive @@ -262,6 +294,23 @@ $(srcdir)/config.hin: $(am__configure_deps) distclean-hdr: -rm -f config.h stamp-h1 uninstall-info-am: +install-aclocalDATA: $(aclocal_DATA) + @$(NORMAL_INSTALL) + test -z "$(aclocaldir)" || $(mkdir_p) "$(DESTDIR)$(aclocaldir)" + @list='$(aclocal_DATA)'; for p in $$list; do \ + if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ + f=$(am__strip_dir) \ + echo " $(aclocalDATA_INSTALL) '$$d$$p' '$(DESTDIR)$(aclocaldir)/$$f'"; \ + $(aclocalDATA_INSTALL) "$$d$$p" "$(DESTDIR)$(aclocaldir)/$$f"; \ + done + +uninstall-aclocalDATA: + @$(NORMAL_UNINSTALL) + @list='$(aclocal_DATA)'; for p in $$list; do \ + f=$(am__strip_dir) \ + echo " rm -f '$(DESTDIR)$(aclocaldir)/$$f'"; \ + rm -f "$(DESTDIR)$(aclocaldir)/$$f"; \ + done # This directory's subdirectories are mostly independent; you can cd # into them and run `make' without going through this Makefile. @@ -270,7 +319,13 @@ uninstall-info-am: # (which will cause the Makefiles to be regenerated when you run `make'); # (2) otherwise, pass the desired values on the `make' command line. $(RECURSIVE_TARGETS): - @set fnord $$MAKEFLAGS; amf=$$2; \ + @failcom='exit 1'; \ + for f in x $$MAKEFLAGS; do \ + case $$f in \ + *=* | --[!k]*);; \ + *k*) failcom='fail=yes';; \ + esac; \ + done; \ dot_seen=no; \ target=`echo $@ | sed s/-recursive//`; \ list='$(SUBDIRS)'; for subdir in $$list; do \ @@ -282,7 +337,7 @@ $(RECURSIVE_TARGETS): local_target="$$target"; \ fi; \ (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ - || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \ + || eval $$failcom; \ done; \ if test "$$dot_seen" = "no"; then \ $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ @@ -290,7 +345,13 @@ $(RECURSIVE_TARGETS): mostlyclean-recursive clean-recursive distclean-recursive \ maintainer-clean-recursive: - @set fnord $$MAKEFLAGS; amf=$$2; \ + @failcom='exit 1'; \ + for f in x $$MAKEFLAGS; do \ + case $$f in \ + *=* | --[!k]*);; \ + *k*) failcom='fail=yes';; \ + esac; \ + done; \ dot_seen=no; \ case "$@" in \ distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ @@ -311,7 +372,7 @@ maintainer-clean-recursive: local_target="$$target"; \ fi; \ (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ - || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \ + || eval $$failcom; \ done && test -z "$$fail" tags-recursive: list='$(SUBDIRS)'; for subdir in $$list; do \ @@ -392,7 +453,7 @@ distdir: $(DISTFILES) esac $(am__remove_distdir) mkdir $(distdir) - $(mkdir_p) $(distdir)/m4 $(distdir)/po $(distdir)/tests + $(mkdir_p) $(distdir)/build-aux $(distdir)/m4 $(distdir)/po $(distdir)/runtime-po $(distdir)/tests @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ list='$(DISTFILES)'; for file in $$list; do \ @@ -419,15 +480,17 @@ distdir: $(DISTFILES) || exit 1; \ fi; \ done - list='$(SUBDIRS)'; for subdir in $$list; do \ + list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ if test "$$subdir" = .; then :; else \ test -d "$(distdir)/$$subdir" \ - || mkdir "$(distdir)/$$subdir" \ + || $(mkdir_p) "$(distdir)/$$subdir" \ || exit 1; \ + distdir=`$(am__cd) $(distdir) && pwd`; \ + top_distdir=`$(am__cd) $(top_distdir) && pwd`; \ (cd $$subdir && \ $(MAKE) $(AM_MAKEFLAGS) \ - top_distdir="../$(top_distdir)" \ - distdir="../$(distdir)/$$subdir" \ + top_distdir="$$top_distdir" \ + distdir="$$distdir/$$subdir" \ distdir) \ || exit 1; \ fi; \ @@ -438,14 +501,14 @@ distdir: $(DISTFILES) ! -type d ! -perm -444 -exec $(SHELL) $(install_sh) -c -m a+r {} {} \; \ || chmod -R a+r $(distdir) dist-gzip: distdir - $(AMTAR) chof - $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz + tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz $(am__remove_distdir) dist-bzip2: distdir - $(AMTAR) chof - $(distdir) | bzip2 -9 -c >$(distdir).tar.bz2 + tardir=$(distdir) && $(am__tar) | bzip2 -9 -c >$(distdir).tar.bz2 $(am__remove_distdir) dist-tarZ: distdir - $(AMTAR) chof - $(distdir) | compress -c >$(distdir).tar.Z + tardir=$(distdir) && $(am__tar) | compress -c >$(distdir).tar.Z $(am__remove_distdir) dist-shar: distdir @@ -458,8 +521,8 @@ dist-zip: distdir $(am__remove_distdir) dist dist-all: distdir - $(AMTAR) chof - $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz - $(AMTAR) chof - $(distdir) | bzip2 -9 -c >$(distdir).tar.bz2 + tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz + tardir=$(distdir) && $(am__tar) | bzip2 -9 -c >$(distdir).tar.bz2 $(am__remove_distdir) # This target untars the dist file and tries a VPATH configuration. Then @@ -468,11 +531,11 @@ dist dist-all: distdir distcheck: dist case '$(DIST_ARCHIVES)' in \ *.tar.gz*) \ - GZIP=$(GZIP_ENV) gunzip -c $(distdir).tar.gz | $(AMTAR) xf - ;;\ + GZIP=$(GZIP_ENV) gunzip -c $(distdir).tar.gz | $(am__untar) ;;\ *.tar.bz2*) \ - bunzip2 -c $(distdir).tar.bz2 | $(AMTAR) xf - ;;\ + bunzip2 -c $(distdir).tar.bz2 | $(am__untar) ;;\ *.tar.Z*) \ - uncompress -c $(distdir).tar.Z | $(AMTAR) xf - ;;\ + uncompress -c $(distdir).tar.Z | $(am__untar) ;;\ *.shar.gz*) \ GZIP=$(GZIP_ENV) gunzip -c $(distdir).shar.gz | unshar ;;\ *.zip*) \ @@ -531,9 +594,12 @@ distcleancheck: distclean exit 1; } >&2 check-am: all-am check: check-recursive -all-am: Makefile config.h +all-am: Makefile $(DATA) config.h installdirs: installdirs-recursive installdirs-am: + for dir in "$(DESTDIR)$(aclocaldir)"; do \ + test -z "$$dir" || $(mkdir_p) "$$dir"; \ + done install: install-recursive install-exec: install-exec-recursive install-data: install-data-recursive @@ -553,7 +619,7 @@ mostlyclean-generic: clean-generic: distclean-generic: - -rm -f $(CONFIG_CLEAN_FILES) + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @@ -577,7 +643,7 @@ info: info-recursive info-am: -install-data-am: +install-data-am: install-aclocalDATA install-exec-am: @@ -605,7 +671,7 @@ ps: ps-recursive ps-am: -uninstall-am: uninstall-info-am +uninstall-am: uninstall-aclocalDATA uninstall-info-am uninstall-info: uninstall-info-recursive @@ -615,14 +681,14 @@ uninstall-info: uninstall-info-recursive dist-tarZ dist-zip distcheck distclean distclean-generic \ distclean-hdr distclean-recursive distclean-tags \ distcleancheck distdir distuninstallcheck dvi dvi-am html \ - html-am info info-am install install-am install-data \ - install-data-am install-exec install-exec-am install-info \ - install-info-am install-man install-strip installcheck \ - installcheck-am installdirs installdirs-am maintainer-clean \ - maintainer-clean-generic maintainer-clean-recursive \ - mostlyclean mostlyclean-generic mostlyclean-recursive pdf \ - pdf-am ps ps-am tags tags-recursive uninstall uninstall-am \ - uninstall-info-am + html-am info info-am install install-aclocalDATA install-am \ + install-data install-data-am install-exec install-exec-am \ + install-info install-info-am install-man install-strip \ + installcheck installcheck-am installdirs installdirs-am \ + maintainer-clean maintainer-clean-generic \ + maintainer-clean-recursive mostlyclean mostlyclean-generic \ + mostlyclean-recursive pdf pdf-am ps ps-am tags tags-recursive \ + uninstall uninstall-aclocalDATA uninstall-am uninstall-info-am .PHONY: maintainer-check diff --git a/src/bin/bison/Makefile.maint b/src/bin/bison/Makefile.maint index a5712d8094..8656fbbad6 100644 --- a/src/bin/bison/Makefile.maint +++ b/src/bin/bison/Makefile.maint @@ -2,7 +2,7 @@ # This Makefile fragment is shared between the coreutils, # CPPI, Bison, and Autoconf. -## Copyright (C) 2001, 2002, 2003, 2004 Free Software Foundation, Inc. +## Copyright (C) 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc. ## ## This program is free software; you can redistribute it and/or modify ## it under the terms of the GNU General Public License as published by @@ -16,14 +16,15 @@ ## ## You should have received a copy of the GNU General Public License ## along with this program; if not, write to the Free Software -## Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA -## 02111-1307, USA. +## Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +## 02110-1301, USA. # This is reported not to work with make-3.79.1 # ME := $(word $(words $(MAKEFILE_LIST)),$(MAKEFILE_LIST)) ME := Makefile.maint # Do not save the original name or timestamp in the .tar.gz file. +# Use --rsyncable if available. GZIP_ENV = \ "--no-name --best$$( \ case $$(gzip --help) in \ @@ -33,6 +34,20 @@ GZIP_ENV = \ CVS = cvs +CVS_LIST = sh -c ' \ + (cvsu --find --types=AFGM $$*) 2>/dev/null || \ + awk -F/ '\''{ \ + if (!$$1 && $$3 !~ /^-/) { \ + f=FILENAME; \ + sub(/CVS\/Entries/, "", f); \ + print f $$2; \ + }}'\'' \ + $$(find $${*-*} -name Entries -print) /dev/null \ + ' dummy + +CVS_LIST_EXCEPT = \ + $(CVS_LIST) | if test -f .x-$@; then grep -vEf .x-$@; else grep -v ChangeLog; fi + ifeq ($(origin prev_version_file), undefined) prev_version_file = .prev-version endif @@ -69,126 +84,184 @@ local-checks-available = \ local-check = $(filter-out $(local-checks-to-skip), $(local-checks-available)) -# Make sure C source files in src/ don't include xalloc.h directly, -# since they all already include it via sys2.h. -# It's not a big deal -- just aesthetics. .PHONY: $(syntax-check-rules) syntax-check-rules = \ sc_cast_of_argument_to_free \ sc_cast_of_x_alloc_return_value \ + sc_cast_of_alloca_return_value \ sc_changelog \ + sc_dd_max_sym_length \ sc_error_exit_success \ + sc_file_system \ + sc_obsolete_symbols \ + sc_prohibit_atoi_atof \ + sc_prohibit_jm_in_m4 \ + sc_root_tests \ sc_space_tab \ sc_sun_os_names \ sc_system_h_headers \ - sc_unmarked_diagnostics \ - sc_xalloc_h_in_src + sc_tight_scope \ + sc_trailing_space \ + sc_unmarked_diagnostics syntax-check: $(syntax-check-rules) -# @grep -E '# *include <(limits|std(def|arg|bool))\.h>' \ +# @grep -nE '# *include <(limits|std(def|arg|bool))\.h>' \ # $$(find -type f -name '*.[chly]') && \ # { echo '$(ME): found conditional include' 1>&2; \ # exit 1; } || : -# grep -E '^# *include <(string|stdlib)\.h>' \ +# grep -nE '^# *include <(string|stdlib)\.h>' \ # $(srcdir)/{lib,src}/*.[chy] && \ # { echo '$(ME): FIXME' 1>&2; \ # exit 1; } || : # FIXME: don't allow `#include .strings\.h' anywhere -# Look for diagnostics that aren't marked for translation. -# This won't find any for which error's format string is on a separate line. -sc_unmarked_diagnostics: - @grep --exclude=$(srcdir)/src/shred.c -E \ - '\&2; \ - exit 1; } || : - sc_cast_of_argument_to_free: - @grep -E '\&2; \ exit 1; } || : sc_cast_of_x_alloc_return_value: - @grep -E --exclude=$(srcdir)/lib/regex.c \ - '\*\) *x(m|c|re)alloc\>' $(srcdir)/{lib,src}/*.[chy] && \ + @grep -nE --exclude=$(srcdir)/lib/regex.c \ + '\*\) *x(m|c|re)alloc\>' \ + $(srcdir)/{lib,src}/*.[chy] && \ { echo '$(ME): don'\''t cast x*alloc return value' 1>&2; \ exit 1; } || : +sc_cast_of_alloca_return_value: + @grep -nE '\*\) *alloca\>' \ + $(srcdir)/src/*.[chy] && \ + { echo '$(ME): don'\''t cast alloca return value' 1>&2; \ + exit 1; } || : + sc_space_tab: - @( cvsu --list ) > /dev/null 2>&1 || : && \ - grep '[ ] ' \ - $$(cvsu --list | grep -vEf .x-$@ ) && \ + @grep -n '[ ] ' \ + $$($(CVS_LIST_EXCEPT)) && \ { echo '$(ME): found SPACE-TAB sequence; remove the SPACE' \ 1>&2; exit 1; } || : +# Don't use the old ato* functions in `real' code. +# They provide no error checking mechanism. +# Instead, use strto* functions. +sc_prohibit_atoi_atof: + @grep -nE '\<(ato[filq]|ato''ll)\>' \ + $$($(CVS_LIST_EXCEPT)) && \ + { echo '$(ME): do not use ato''f, ato''i, ato''l, ato''ll, or ato''q' \ + 1>&2; exit 1; } || : + # Using EXIT_SUCCESS as the first argument to error is misleading, # since when that parameter is 0, error does not exit. Use `0' instead. sc_error_exit_success: - @grep -F 'error (EXIT_SUCCESS,' \ + @grep -nF 'error (EXIT_SUCCESS,' \ $$(find -type f -name '*.[chly]') && \ { echo '$(ME): found error (EXIT_SUCCESS' 1>&2; \ exit 1; } || : -# FIXME: merge this with sc_system_h_headers below. -# xalloc.h is included via system.h, so should not be included -# directly by any file in src/. -sc_xalloc_h_in_src: - @if test -f $(srcdir)/src/sys2.h; then \ - if grep 'xalloc\.h' $(srcdir)/src/*.c; then \ - exit 1; \ - fi; \ - fi +sc_file_system: + @grep -ni 'file''system' \ + $$($(CVS_LIST_EXCEPT)) && \ + { echo '$(ME): found use of "file''system";' \ + 'rewrite to use "file system"' 1>&2; \ + exit 1; } || : + +sc_obsolete_symbols: + @grep -nE '\<(HAVE_''FCNTL_H)\>' \ + $$($(CVS_LIST_EXCEPT)) && \ + { echo '$(ME): do not use HAVE_''FCNTL_H' \ + 1>&2; exit 1; } || : # FIXME: warn about definitions of EXIT_FAILURE, EXIT_SUCCESS, STREQ # Each nonempty line must start with a year number, or a TAB. sc_changelog: - @grep '^[^12 ]' $$(find . -name ChangeLog -maxdepth 2) && \ + @grep -n '^[^12 ]' $$(find . -maxdepth 2 -name ChangeLog) && \ { echo '$(ME): found unexpected prefix in a ChangeLog' 1>&2; \ exit 1; } || : -header_regexp = \ - alloca\ - |closeout\ - |ctype\ - |dirent\ - |errno\ - |fcntl\ - |inttypes\ - |limits\ - |locale\ - |pathmax\ - |std(lib|bool)\ - |string\ - |sys/(stat|dir|time)\ - |time\ - |unistd\ - |utime\ - |version-etc\ - |xalloc -h_re := $(shell echo '$(header_regexp)'|tr -d ' ') +# Ensure that dd's definition of LONGEST_SYMBOL stays in sync +# with the strings from the two affected variables. +dd_c = $(srcdir)/src/dd.c +sc_dd_max_sym_length: +ifneq ($(wildcard $(dd_c)),) + @len=$$( (sed -n '/conversions\[\] =$$/,/^};/p' $(dd_c);\ + sed -n '/flags\[\] =$$/,/^};/p' $(dd_c) ) \ + |sed -n '/"/s/^[^"]*"\([^"]*\)".*/\1/p' \ + | wc --max-line-length); \ + max=$$(sed -n '/^#define LONGEST_SYMBOL /s///p' $(dd_c) \ + |tr -d '"' | wc --max-line-length); \ + if test "$$len" = "$$max"; then :; else \ + echo 'dd.c: LONGEST_SYMBOL is not longest' 1>&2; \ + exit 1; \ + fi +endif + +# Many m4 macros names once began with `jm_'. +# On 2004-04-13, they were all changed to start with gl_ instead. +# Make sure that none are inadvertently reintroduced. +sc_prohibit_jm_in_m4: + @grep -nE 'jm_[A-Z]' \ + $$($(CVS_LIST) $(srcdir)/m4 |grep '\.m4$$') && \ + { echo '$(ME): do not use jm_ in m4 macro names' \ + 1>&2; exit 1; } || : + +sc_root_tests: + @t1=sc-root.expected; t2=sc-root.actual; \ + grep -nl '^PRIV_CHECK_ARG=require-root' \ + $$($(CVS_LIST) tests) |sed s,tests,., |sort > $$t1; \ + sed -n 's, cd \([^ ]*\) .*MAKE..check TESTS=\(.*\),./\1/\2,p' \ + $(srcdir)/tests/Makefile.am |sort > $$t2; \ + diff -u $$t1 $$t2 || diff=1; \ + rm -f $$t1 $$t2; \ + test "$$diff" \ + && { echo 'tests/Makefile.am: missing check-root action'>&2; \ + exit 1; } || : + +# Create a list of regular expressions matching the names +# of files included from system.h. Exclude a couple. +.re-list: + @sed -n '/^# *include /s///p' $(srcdir)/src/system.h \ + | grep -Ev 'sys/(param|file)\.h' \ + | sed 's/ .*//;;s/^["<]/^# *include [<"]/;s/\.h[">]$$/\\.h[">]/' \ + > $@-t + @mv $@-t $@ # Files in src/ should not include directly any of # the headers already included via system.h. -# Get list of candidates with this: -# grep -h include src/sys*.h|sed 's/.*include //'|sort - -sc_system_h_headers: - @( cvsu --list ) > /dev/null 2>&1 || : && \ - grep -E '^# *include ["<]($(h_re))\.h[">]' \ - $$(cvsu --list src | grep -Ev 'sys(2|tem)\.h$$') \ - && { echo '$(ME): the above are already included via system.h'\ - 1>&2; exit 1; } || : +sc_system_h_headers: .re-list + if test -f $(srcdir)/src/system.h; then \ + trap 'rc=$$?; rm -f .re-list; exit $$rc' 0 1 2 3 15; \ + grep -nE -f .re-list \ + $$($(CVS_LIST) src | \ + grep -Ev '((copy|system)\.h|parse-gram\.c)$$') \ + && { echo '$(ME): the above are already included via system.h'\ + 1>&2; exit 1; } || :; \ + fi sc_sun_os_names: - @( cvsu --list ) > /dev/null 2>&1 || : && \ - grep -Ei \ + @grep -nEi \ 'solaris[^[:alnum:]]*2\.(7|8|9|[1-9][0-9])|sunos[^[:alnum:]][6-9]' \ - $$(cvsu --list | grep -vEf .x-$@ ) && \ + $$($(CVS_LIST_EXCEPT)) && \ { echo '$(ME): found misuse of Sun OS version numbers' 1>&2; \ exit 1; } || : +sc_tight_scope: + $(MAKE) -C src $@ + +sc_trailing_space: + @grep -n '[ ]$$' \ + $$($(CVS_LIST_EXCEPT)) && \ + { echo '$(ME): found trailing space(s)' \ + 1>&2; exit 1; } || : + +# Look for diagnostics that aren't marked for translation. +# This won't find any for which error's format string is on a separate line. +sc_unmarked_diagnostics: + @grep -nE \ + '\&2; \ + exit 1; } || : + # Ensure that date's --help output stays in sync with the info # documentation for GNU strftime. The only exception is %N, # which date accepts but GNU strftime does not. @@ -208,8 +281,17 @@ strftime-check: # not @...@ in Makefile.am, now that we can rely on automake # to emit a definition for each substituted variable. makefile-check: - grep -E '@[A-Z_0-9]+@' `find . -name Makefile.am` \ - && { echo 'Makefile.maint: use $(...), not @...@' 1>&2; exit 1; } || : + grep -nE '@[A-Z_0-9]+@' `find . -name Makefile.am` \ + && { echo 'Makefile.maint: use $$(...), not @...@' 1>&2; exit 1; } || : + +news-date-check: NEWS + today=`date +%Y-%m-%d`; \ + if head NEWS | grep '^\*.*'$$today >/dev/null; then \ + :; \ + else \ + echo "today's date is not in NEWS" 1>&2; \ + exit 1; \ + fi changelog-check: if head ChangeLog | grep 'Version $(VERSION)' >/dev/null; then \ @@ -225,28 +307,30 @@ m4-check: exit 1; } || : # Verify that all source files using _() are listed in po/POTFILES.in. +# FIXME: don't hard-code src/false.c below; use a more general mechanism. po-check: - if test -f po/POTFILES.in; then \ - grep -E -v '^(#|$$)' po/POTFILES.in | sort > $@-1; \ - files=; \ + if test -f po/POTFILES.in; then \ + grep -E -v '^(#|$$)' po/POTFILES.in \ + | grep -v '^src/false\.c$$' | sort > $@-1; \ + files=; \ for file in lib/*.[chly] src/*.[chly]; do \ - case $$file in \ - *.[ch]) \ - base=`expr " $$file" : ' \(.*\)\..'`; \ - { test -f $$base.l || test -f $$base.y; } && continue;; \ - esac; \ - files="$$files $$file"; \ - done; \ - grep -E -l '\bN?_\([^)"]*("|$$)' $$files | sort > $@-2; \ - diff -u $@-1 $@-2 || exit 1; \ - rm -f $@-1 $@-2; \ + case $$file in \ + *.[ch]) \ + base=`expr " $$file" : ' \(.*\)\..'`; \ + { test -f $$base.l || test -f $$base.y; } && continue;; \ + esac; \ + files="$$files $$file"; \ + done; \ + grep -E -l '\bN?_\([^)"]*("|$$)' $$files | sort > $@-2; \ + diff -u $@-1 $@-2 || exit 1; \ + rm -f $@-1 $@-2; \ fi # In a definition of #define AUTHORS "... and ..." where the RHS contains # the English word `and', the string must be marked with `N_ (...)' so that # gettext recognizes it as a string requiring translation. author_mark_check: - @grep '^# *define AUTHORS "[^"]* and ' src/*.c |grep -v ' N_ (' && \ + @grep -n '^# *define AUTHORS "[^"]* and ' src/*.c |grep -v ' N_ (' && \ { echo 'Makefile.maint: enclose the above strings in N_ (...)' 1>&2; \ exit 1; } || : @@ -258,7 +342,7 @@ author_mark_check: # that we'd have to worry about limits on command line length. msg = 'Makefile.maint: Do not use `:'\'' above; use @PATH_SEPARATOR@ instead' makefile_path_separator_check: - @grep 'PATH=.*:' `find $(srcdir) -name Makefile.am` \ + @grep -n 'PATH=.*:' `find $(srcdir) -name Makefile.am` \ && { echo $(msg) 1>&2; exit 1; } || : # Check that `make alpha' will not fail at the end of the process. @@ -279,7 +363,7 @@ v_etc_file = lib/version-etc.c # Make sure that the copyright date in $(v_etc_file) is up to date. copyright-check: @if test -f $(v_etc_file); then \ - grep '"Copyright (C) $(shell date +%Y) Free' $(v_etc_file) \ + grep 'enum { COPYRIGHT_YEAR = 2005 };' $(v_etc_file) \ >/dev/null \ || { echo 'out of date copyright in $(v_etc_file); update it' 1>&2; \ exit 1; }; \ @@ -330,21 +414,23 @@ null_AM_MAKEFLAGS = \ # Detect format-string/arg-list mismatches that would normally be obscured # by the use of _(). The --disable-nls effectively defines away that macro, # and building with CFLAGS='-Wformat -Werror' causes any format warning to be -# treated as a failure. +# treated as a failure. Also, check for shadowing problems with -Wshadow. +# These CFLAGS are pretty strict. If you build this target, you probably +# have to have a recent version of gcc and glibc headers. TMPDIR ?= /tmp t=$(TMPDIR)/$(PACKAGE)/test my-distcheck: $(local-check) -rm -rf $(t) mkdir -p $(t) GZIP=$(GZIP_ENV) $(AMTAR) -C $(t) -zxf $(distdir).tar.gz - cd $(t)/$(distdir) \ - && ./configure --disable-nls \ - && $(MAKE) CFLAGS='-Wformat -Werror' \ - AM_MAKEFLAGS='$(null_AM_MAKEFLAGS)' \ - && $(MAKE) dvi \ - && $(MAKE) check \ + cd $(t)/$(distdir) \ + && ./configure --disable-nls \ + && $(MAKE) CFLAGS='-Werror -Wall -Wformat -Wshadow' \ + AM_MAKEFLAGS='$(null_AM_MAKEFLAGS)' \ + && $(MAKE) dvi \ + && $(MAKE) check \ && $(MAKE) distclean - (cd $(t) && mv $(distdir) $(distdir).old \ + (cd $(t) && mv $(distdir) $(distdir).old \ && $(AMTAR) -zxf - ) < $(distdir).tar.gz diff -ur $(t)/$(distdir).old $(t)/$(distdir) -rm -rf $(t) @@ -377,15 +463,9 @@ rel-check: prev-tgz = $(PACKAGE)-$(PREV_VERSION).tar.gz xd-delta = $(PACKAGE)-$(PREV_VERSION)-$(VERSION).xdelta -signatures ?= $(distdir).tar.bz2.asc $(distdir).tar.gz.asc -%.asc: % - rm -f $@ - gpg --armor --detach-sign -o $@ $< - -rel-files = $(xd-delta) $(distdir).tar.bz2 $(distdir).tar.gz $(signatures) -announce_gen ?= ./announce-gen -announcement: NEWS ChangeLog $(rel-files) $(signatures) - @$(announce_gen) \ +rel-files = $(xd-delta) $(DIST_ARCHIVES) +announcement: NEWS ChangeLog $(rel-files) + @./announce-gen \ --release-type=$(RELEASE_TYPE) \ --package=$(PACKAGE) \ --prev=$(PREV_VERSION) \ @@ -443,14 +523,16 @@ po-update: # The following pseudo table associates a local directory and a URL # with each of the files that belongs to some other package and is # regularly updated from the specified URL. -wget_files ?= $(srcdir)/config/config.guess \ - $(srcdir)/config/config.sub \ - $(srcdir)/src/ansi2knr.c \ - $(srcdir)/config/texinfo.tex +wget_files ?= \ + $(srcdir)/build-aux/config.guess \ + $(srcdir)/build-aux/config.sub \ + $(srcdir)/build-aux/texinfo.tex \ + $(srcdir)/src/ansi2knr.c + get-targets = $(patsubst %, get-%, $(wget_files)) -config.guess-url_prefix = $(ftp-gnu)/config/ -config.sub-url_prefix = $(ftp-gnu)/config/ +config.guess-url_prefix = $(ftp-gnu)/build-aux/ +config.sub-url_prefix = $(ftp-gnu)/build-aux/ ansi2knr.c-url_prefix = ftp://ftp.cs.wisc.edu/ghost/ @@ -468,11 +550,11 @@ $(get-targets): && $(move_if_change) $(target).t $(target) cvs_files ?= \ - $(srcdir)/src/ansi2knr.c \ - $(srcdir)/config/depcomp \ - $(srcdir)/config/install-sh \ - $(srcdir)/config/missing \ - $(srcdir)/config/mkinstalldirs + $(srcdir)/build-aux/depcomp \ + $(srcdir)/build-aux/install-sh \ + $(srcdir)/build-aux/missing \ + $(srcdir)/build-aux/mkinstalldirs \ + $(srcdir)/src/ansi2knr.c automake_repo=:pserver:anoncvs:anoncvs@sources.redhat.com:/cvs/automake .PHONY: wget-update wget-update: $(get-targets) @@ -492,25 +574,26 @@ cvs-update: done; \ test "$$fail" && exit 1 -define emit-upload-commands - echo ===================================== - echo ===================================== - echo upload $(PACKAGE) $(PREV_VERSION) $(VERSION) - echo '# send the /tmp/announcement e-mail' - echo ===================================== - echo ===================================== -endef +emit_upload_commands: + @echo ===================================== + @echo ===================================== + @echo "$(srcdir)/gnupload $(GNUPLOADFLAGS) \\" + @echo " --to $(gnu_rel_host):coreutils \\" + @echo " $(rel-files)" + @echo '# send the /tmp/announcement e-mail' + @echo ===================================== + @echo ===================================== $(xd-delta): $(release_archive_dir)/$(prev-tgz) $(distdir).tar.gz xdelta delta -9 $^ $@ || : .PHONY: alpha beta major -alpha beta major: $(local-check) +alpha beta major: news-date-check $(local-check) $(MAKE) cvs-dist $(MAKE) $(xd-delta) $(MAKE) -s announcement RELEASE_TYPE=$@ > /tmp/announce-$(my_distdir) ln $(rel-files) $(release_archive_dir) chmod a-w $(rel-files) + $(MAKE) -s emit_upload_commands RELEASE_TYPE=$@ echo $(VERSION) > $(prev_version_file) $(CVS) ci -m. $(prev_version_file) - @$(emit-upload-commands) diff --git a/src/bin/bison/NEWS b/src/bin/bison/NEWS index bc66e854a1..5ce9863945 100644 --- a/src/bin/bison/NEWS +++ b/src/bin/bison/NEWS @@ -1,47 +1,93 @@ Bison News ---------- -Changes in version 1.875d, 2004-05-21: +Changes in version 2.1, 2005-09-16: -* Unescaped newlines are no longer allowed in character constants or - string literals. They were never portable, and GCC 3.4.0 has - dropped support for them. Better diagnostics are now generated if - forget a closing quote. +* Bison-generated parsers now support the translation of diagnostics like + "syntax error" into languages other than English. The default + language is still English. For details, please see the new + Internationalization section of the Bison manual. Software + distributors should also see the new PACKAGING file. Thanks to + Bruno Haible for this new feature. -* NUL bytes are no longer allowed in Bison string literals, unfortunately. +* Wording in the Bison-generated parsers has been changed slightly to + simplify translation. In particular, the message "memory exhausted" + has replaced "parser stack overflow", as the old message was not + always accurate for modern Bison-generated parsers. -* %token numbers can now be hexadecimal integers, e.g., `%token FOO 0x12d'. - This is a GNU extension. +* Destructors are now called when the parser aborts, for all symbols left + behind on the stack. Also, the start symbol is now destroyed after a + successful parse. In both cases, the behavior was formerly inconsistent. -* A new directive "%expect-rr N" specifies the expected number of - reduce/reduce conflicts in GLR parsers. +* When generating verbose diagnostics, Bison-generated parsers no longer + quote the literal strings associated with tokens. For example, for + a syntax error associated with '%token NUM "number"' they might + print 'syntax error, unexpected number' instead of 'syntax error, + unexpected "number"'. -* Experimental %destructor support has been added to lalr1.cc. +Changes in version 2.0, 2004-12-25: -Changes in version 1.875c, 2003-08-25: +* Possibly-incompatible changes - (Just bug fixes.) + - Bison-generated parsers no longer default to using the alloca function + (when available) to extend the parser stack, due to widespread + problems in unchecked stack-overflow detection. You can "#define + YYSTACK_USE_ALLOCA 1" to require the use of alloca, but please read + the manual to determine safe values for YYMAXDEPTH in that case. -Changes in version 1.875b, 2003-06-17: + - Error token location. + During error recovery, the location of the syntax error is updated + to cover the whole sequence covered by the error token: it includes + the shifted symbols thrown away during the first part of the error + recovery, and the lookahead rejected during the second part. -* GLR grammars now support locations. + - Semicolon changes: + . Stray semicolons are no longer allowed at the start of a grammar. + . Semicolons are now required after in-grammar declarations. + + - Unescaped newlines are no longer allowed in character constants or + string literals. They were never portable, and GCC 3.4.0 has + dropped support for them. Better diagnostics are now generated if + forget a closing quote. + + - NUL bytes are no longer allowed in Bison string literals, unfortunately. + +* New features + + - GLR grammars now support locations. + + - New directive: %initial-action. + This directive allows the user to run arbitrary code (including + initializing @$) from yyparse before parsing starts. + + - A new directive "%expect-rr N" specifies the expected number of + reduce/reduce conflicts in GLR parsers. + + - %token numbers can now be hexadecimal integers, e.g., `%token FOO 0x12d'. + This is a GNU extension. + + - The option `--report=lookahead' was changed to `--report=look-ahead'. + The old spelling still works, but is not documented and will be + removed. + + - Experimental %destructor support has been added to lalr1.cc. + + - New configure option --disable-yacc, to disable installation of the + yacc command and -ly library introduced in 1.875 for POSIX conformance. + +* Bug fixes + + - For now, %expect-count violations are now just warnings, not errors. + This is for compatibility with Bison 1.75 and earlier (when there are + reduce/reduce conflicts) and with Bison 1.30 and earlier (when there + are too many or too few shift/reduce conflicts). However, in future + versions of Bison we plan to improve the %expect machinery so that + these violations will become errors again. + + - Within Bison itself, numbers (e.g., goto numbers) are no longer + arbitrarily limited to 16-bit counts. -* Semicolon changes: - Semicolons are now allowed before "|" in grammar rules, as POSIX requires. - - Stray semicolons are no longer allowed at the start of a grammar. - - Semicolons are now required after in-grammar declarations. - -Changes in version 1.875a, 2003-02-01: - -* For now, %expect-count violations are now just warnings, not errors. - This is for compatibility with Bison 1.75 and earlier (when there are - reduce/reduce conflicts) and with Bison 1.30 and earlier (when there - are too many or too few shift/reduce conflicts). However, in future - versions of Bison we plan to improve the %expect machinery so that - these violations will become errors again. - -* New configure option --disable-yacc, to disable installation of the - yacc command and -ly library introduced in 1.875 for POSIX conformance. Changes in version 1.875, 2003-01-01: @@ -213,7 +259,8 @@ Changes in version 1.50, 2002-10-04: allowed some non-error action other than a default reduction on the error token. The new behavior has long been the documented behavior, and has long been required by POSIX. For more details, please see - . + Paul Eggert, "Reductions during Bison error handling" (2002-05-20) + . * Traces Popped tokens and nonterminals are now reported. @@ -288,8 +335,8 @@ Changes in version 1.50, 2002-10-04: produces additional information: - itemset complete the core item sets with their closure - - lookahead - explicitly associate lookaheads to items + - lookahead [changed to `look-ahead' in 1.875e and later] + explicitly associate look-ahead tokens to items - solved describe shift/reduce conflicts solving. Bison used to systematically output this information on top of @@ -376,6 +423,8 @@ Changes in version 1.31, 2002-01-14: alloca is used only when compiled with GCC, to avoid portability problems as on AIX. +* yyparse now returns 2 if memory is exhausted; formerly it dumped core. + * When the generated parser lacks debugging code, YYDEBUG is now 0 (as POSIX requires) instead of being undefined. @@ -570,7 +619,7 @@ End: ----- -Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004 +Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc. This file is part of Bison, the GNU Compiler Compiler. @@ -587,5 +636,5 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License along with autoconf; see the file COPYING. If not, write to -the Free Software Foundation, Inc., 59 Temple Place - Suite 330, -Boston, MA 02111-1307, USA. +the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +Boston, MA 02110-1301, USA. diff --git a/src/bin/bison/README b/src/bin/bison/README index d8b45ccf04..a053f4b81e 100644 --- a/src/bin/bison/README +++ b/src/bin/bison/README @@ -3,33 +3,25 @@ This directory contains the Bison parser generator. See the file INSTALL for generic compilation and installation instructions. See the file doc/FAQ for frequently asked questions. -Bison requires GNU m4 1.4 (or later, if a later version of GNU m4 -becomes available). The following m4 patches are recommended: +Bison requires GNU m4 1.4.3 or later. See: -http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=92629 -http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=211477 +ftp://ftp.gnu.org/gnu/m4/m4-1.4.3.tar.gz -Older versions of Sun Forte Developer 6 update 2 have a compiler bug -that cause "make check" to fail with a "Encounter BINCL entry" -diagnostic. To fix the bug, update to the latest set of Solaris and -Forte patches recommended by Sun. +Bison can work with pre-1.4.3 distributions of GNU m4 if they are +sufficiently patched, but if you encounter a bug with an older +distribution and report a bug we will probably suggest that you +upgrade to 1.4.3 as the first step in trying to fix it. -VMS and MS-DOS builds are probably broken right now. If you are able -to build Bison on either platform and you need to make changes to do -so, please submit those changes as a bug report. On VMS, you will -probably have to create Makefile from Makefile.in by hand. Remember -to do `SET COMMAND BISON' to install the data in `BISON.CLD'. +Please send bug reports to . Please include the +version number from `bison --version', and a complete, self-contained +test case in each bug report. -Send bug reports to . Please include the version -number from `bison --version', and a complete, self-contained test -case in each bug report. - -If you have questions about using Bison which the documentation does -not answer, send mail to . +If you have questions about using Bison and the documentation does +not answer them, please send mail to . ----- -Copyright (C) 1992, 1998, 1999, 2003, 2004 Free Software Foundation, Inc. +Copyright (C) 1992, 1998, 1999, 2003, 2004, 2005 Free Software Foundation, Inc. This file is part of Bison, the GNU Compiler Compiler. @@ -45,5 +37,5 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License along with autoconf; see the file COPYING. If not, write to -the Free Software Foundation, Inc., 59 Temple Place - Suite 330, -Boston, MA 02111-1307, USA. +the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +Boston, MA 02110-1301, USA. diff --git a/src/bin/bison/THANKS b/src/bin/bison/THANKS index cb6025c823..983bf687b3 100644 --- a/src/bin/bison/THANKS +++ b/src/bin/bison/THANKS @@ -5,10 +5,13 @@ Airy Andre Airy.Andre@edf.fr Akim Demaille akim@freefriends.org Albert Chin-A-Young china@thewrittenword.com Alexander Belopolsky alexb@rentec.com +Alexandre Duret-Lutz adl@src.lip6.fr Andreas Schwab schwab@suse.de Andrew Suffield asuffield@users.sourceforge.net +Anthony Heading ajrh@ajrh.net Arnold Robbins arnold@skeeve.com Art Haas ahaas@neosoft.com +Baron Schwartz baron@sequent.org Benoit Perrot benoit.perrot@epita.fr Bert Deknuydt Bert.Deknuydt@esat.kuleuven.ac.be Bruce Lilly blilly@erols.com @@ -23,12 +26,15 @@ Enrico Scholz enrico.scholz@informatik.tu-chemnitz.de Evgeny Stambulchik fnevgeny@plasma-gate.weizmann.ac.il Fabrice Bauzac noon@cote-dazur.com Florian Krohm florian@edamail.fishkill.ibm.com +Frank Heckenbach frank@g-n-u.de +Guido Trentalancia trentalg@aston.ac.uk H. Merijn Brand h.m.brand@hccnet.nl Hans Aberg haberg@matematik.su.se Jan Nieuwenhuizen janneke@gnu.org Jesse Thilo jthilo@gnu.org Jim Kent jkent@arch.sel.sony.com Jim Meyering jim@meyering.net +Joel E. Denny jdenny@hubcap.clemson.edu Juan Manuel Guerrero ST001906@HRZ1.HRZ.TU-Darmstadt.De Kees Zeelenberg kzlg@users.sourceforge.net Keith Browne kbrowne@legato.com @@ -46,9 +52,10 @@ Nicolas Burrus nicolas.burrus@epita.fr Nicolas Tisserand nicolas.tisserand@epita.fr Noah Friedman friedman@gnu.org Pascal Bart pascal.bart@epita.fr -Paul Eggert eggert@twinsun.com +Paul Eggert eggert@cs.ucla.edu Paul Hilfinger Hilfinger@CS.Berkeley.EDU Per Allansson per@appgate.com +Peter Fales psfales@lucent.com Peter Hamorsky hamo@upjs.sk Piotr Gackiewicz gacek@intertel.com.pl Quoc Peyrot chojin@lrde.epita.fr @@ -61,10 +68,13 @@ Tim Josling tej@melbpc.org.au Tim Van Holder tim.van.holder@pandora.be Tom Lane tgl@sss.pgh.pa.us Tom Tromey tromey@cygnus.com +Troy A. Johnson troyj@ecn.purdue.edu +Vin Shelton acs@alumni.princeton.edu Wayne Green wayne@infosavvy.com Wolfram Wagner ww@mpi-sb.mpg.de Wwp subscript@free.fr Zack Weinberg zack@codesourcery.com + twlevo@xs4all.nl Many people are not named here because we lost track of them. We thank them! Please, help us keeping this list up to date. diff --git a/src/bin/bison/TODO b/src/bin/bison/TODO index a300524021..a44f64ece4 100644 --- a/src/bin/bison/TODO +++ b/src/bin/bison/TODO @@ -12,24 +12,22 @@ They should not: it is not documented. But if they need to, let's find something clean (not like YYLSP_NEEDED...). -* URGENT: Documenting C++ output -Write a first documentation for C++ output. - - * Documentation Before releasing, make sure the documentation ("Understanding your parser") refers to the current `output' format. +* lalr1.cc +** vector +Move to using vector, drop stack.hh. -* GLR & C++ -Currently, the GLR parser cannot compile with a C++ compiler. - +** I18n +Catch up with yacc.c. * Report ** GLR How would Paul like to display the conflicted actions? In particular, -what when two reductions are possible on a given lookahead, but one is +what when two reductions are possible on a given look-ahead token, but one is part of $default. Should we make the two reductions explicit, or just keep $default? See the following point. @@ -52,14 +50,7 @@ DeRemer and Penello: they already provide the algorithm. * Extensions -** %destructor -I think we should document it as experimental, and allow its use in -the next releases. But we also need to port it to GLR. What about -lalr1.cc? Well, read what Hans reported, maybe we don't want -%detructor. On the other hand, there is no reason not to provide it: -users can avoid its use. - -** $foo +** Labeling the symbols Have a look at the Lemon parser generator: instead of $1, $2 etc. they can name the values. This is much more pleasant. For instance: @@ -69,6 +60,21 @@ I love this. I have been bitten too often by the removal of the symbol, and forgetting to shift all the $n to $n-1. If you are unlucky, it compiles... +But instead of using $a etc., we can use regular variables. And +instead of using (), I propose to use `:' (again). Paul suggests +supporting `->' in addition to `:' to separate LHS and RHS. In other +words: + + r:exp -> a:exp '+' b:exp { r = a + b; }; + +That requires an significant improvement of the grammar parser. Using +GLR would be nice. It also requires that Bison know the type of the +symbols (which will be useful for %include anyway). So we have some +time before... + +Note that there remains the problem of locations: `@r'? + + ** $-1 We should find a means to provide an access to values deep in the stack. For instance, instead of @@ -192,7 +198,9 @@ Paul notes: PDP-10 ports :-) but they should probably be documented somewhere. - + More importantly, Bison does not currently allow NUL bytes in + tokens, either via escapes (e.g., "x\0y") or via a NUL byte in + the source code. This should get fixed. * --graph Show reductions. [] @@ -337,7 +345,7 @@ the parser with a means to create the (visual) parse tree. ----- -Copyright (C) 2001, 2002, 2003 Free Software Foundation, Inc. +Copyright (C) 2001, 2002, 2003, 2004 Free Software Foundation, Inc. This file is part of GNU Bison. @@ -353,5 +361,5 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License along with Bison; see the file COPYING. If not, write to -the Free Software Foundation, Inc., 59 Temple Place - Suite 330, -Boston, MA 02111-1307, USA. +the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +Boston, MA 02110-1301, USA. diff --git a/src/bin/bison/aclocal.m4 b/src/bin/bison/aclocal.m4 index 38141b7b83..15dc1cc1e9 100644 --- a/src/bin/bison/aclocal.m4 +++ b/src/bin/bison/aclocal.m4 @@ -1,7 +1,7 @@ -# generated automatically by aclocal 1.8.5 -*- Autoconf -*- +# generated automatically by aclocal 1.9.6 -*- Autoconf -*- -# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004 -# Free Software Foundation, Inc. +# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, +# 2005 Free Software Foundation, Inc. # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. @@ -11,55 +11,32 @@ # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. -# -*- Autoconf -*- -# Copyright (C) 2002, 2003 Free Software Foundation, Inc. -# Generated from amversion.in; do not edit by hand. - -# 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 2, 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, write to the Free Software -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA +# Copyright (C) 2002, 2003, 2005 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. # AM_AUTOMAKE_VERSION(VERSION) # ---------------------------- # Automake X.Y traces this macro to ensure aclocal.m4 has been # generated from the m4 files accompanying Automake X.Y. -AC_DEFUN([AM_AUTOMAKE_VERSION], [am__api_version="1.8"]) +AC_DEFUN([AM_AUTOMAKE_VERSION], [am__api_version="1.9"]) # AM_SET_CURRENT_AUTOMAKE_VERSION # ------------------------------- # Call AM_AUTOMAKE_VERSION so it can be traced. # This function is AC_REQUIREd by AC_INIT_AUTOMAKE. AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION], - [AM_AUTOMAKE_VERSION([1.8.5])]) + [AM_AUTOMAKE_VERSION([1.9.6])]) -# AM_AUX_DIR_EXPAND +# AM_AUX_DIR_EXPAND -*- Autoconf -*- -# Copyright (C) 2001, 2003 Free Software Foundation, Inc. - -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2, 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, write to the Free Software -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA -# 02111-1307, USA. +# Copyright (C) 2001, 2003, 2005 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. # For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets # $ac_aux_dir to `$srcdir/foo'. In other projects, it is set to @@ -107,25 +84,14 @@ am_aux_dir=`cd $ac_aux_dir && pwd` ]) -# Copyright (C) 1996, 1997, 1999, 2000, 2001, 2002, 2003 +# Copyright (C) 1996, 1997, 1999, 2000, 2001, 2002, 2003, 2005 # Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. -# 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 2, 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, write to the Free Software -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA -# 02111-1307, USA. - -# serial 3 +# serial 4 # This was merged into AC_PROG_CC in Autoconf. @@ -140,26 +106,16 @@ am_cv_prog_cc_stdc=$ac_cv_prog_cc_stdc ]) AU_DEFUN([fp_PROG_CC_STDC]) -# AM_CONDITIONAL -*- Autoconf -*- +# AM_CONDITIONAL -*- Autoconf -*- -# Copyright (C) 1997, 2000, 2001, 2003 Free Software Foundation, Inc. +# Copyright (C) 1997, 2000, 2001, 2003, 2004, 2005 +# Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. -# 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 2, 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, write to the Free Software -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA -# 02111-1307, USA. - -# serial 6 +# serial 7 # AM_CONDITIONAL(NAME, SHELL-CONDITION) # ------------------------------------- @@ -179,30 +135,19 @@ else fi AC_CONFIG_COMMANDS_PRE( [if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then - AC_MSG_ERROR([conditional "$1" was never defined. -Usually this means the macro was only invoked conditionally.]) + AC_MSG_ERROR([[conditional "$1" was never defined. +Usually this means the macro was only invoked conditionally.]]) fi])]) -# serial 7 -*- Autoconf -*- -# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004 +# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005 # Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. -# 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 2, 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, write to the Free Software -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA -# 02111-1307, USA. - +# serial 8 # There are a few dirty hacks below to avoid letting `AC_PROG_CC' be # written in clear, in which case automake, when reading aclocal.m4, @@ -211,7 +156,6 @@ fi])]) # CC etc. in the Makefile, will ask for an AC_PROG_CC use... - # _AM_DEPENDENCIES(NAME) # ---------------------- # See how the compiler implements dependency checking. @@ -351,26 +295,16 @@ AM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno]) AC_SUBST([AMDEPBACKSLASH]) ]) -# Generate code to set up dependency tracking. -*- Autoconf -*- +# Generate code to set up dependency tracking. -*- Autoconf -*- -# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc. +# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005 +# Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. -# 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 2, 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, write to the Free Software -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA -# 02111-1307, USA. - -#serial 2 +#serial 3 # _AM_OUTPUT_DEPENDENCY_COMMANDS # ------------------------------ @@ -389,27 +323,21 @@ AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS], else continue fi - grep '^DEP_FILES *= *[[^ @%:@]]' < "$mf" > /dev/null || continue - # Extract the definition of DEP_FILES from the Makefile without - # running `make'. + # Extract the definition of DEPDIR, am__include, and am__quote + # from the Makefile without running `make'. DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"` test -z "$DEPDIR" && continue + am__include=`sed -n 's/^am__include = //p' < "$mf"` + test -z "am__include" && continue + am__quote=`sed -n 's/^am__quote = //p' < "$mf"` # When using ansi2knr, U may be empty or an underscore; expand it U=`sed -n 's/^U = //p' < "$mf"` - test -d "$dirpart/$DEPDIR" || mkdir "$dirpart/$DEPDIR" - # We invoke sed twice because it is the simplest approach to - # changing $(DEPDIR) to its actual value in the expansion. - for file in `sed -n ' - /^DEP_FILES = .*\\\\$/ { - s/^DEP_FILES = // - :loop - s/\\\\$// - p - n - /\\\\$/ b loop - p - } - /^DEP_FILES = / s/^DEP_FILES = //p' < "$mf" | \ + # Find all dependency output files, they are included files with + # $(DEPDIR) in their names. We invoke sed twice because it is the + # simplest approach to changing $(DEPDIR) to its actual value in the + # expansion. + for file in `sed -n " + s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \ sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do # Make sure the directory exists. test -f "$dirpart/$file" && continue @@ -435,30 +363,19 @@ AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS], [AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"]) ]) -# Do all the work for Automake. -*- Autoconf -*- +# Do all the work for Automake. -*- Autoconf -*- -# This macro actually does too much some checks are only needed if -# your package does certain things. But this isn't really a big deal. - -# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003 +# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005 # Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. -# 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 2, or (at your option) -# any later version. +# serial 12 -# 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, write to the Free Software -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA -# 02111-1307, USA. - -# serial 11 +# This macro actually does too much. Some checks are only needed if +# your package does certain things. But this isn't really a big deal. # AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE]) # AM_INIT_AUTOMAKE([OPTIONS]) @@ -516,7 +433,6 @@ AM_MISSING_PROG(AUTOCONF, autoconf) AM_MISSING_PROG(AUTOMAKE, automake-${am__api_version}) AM_MISSING_PROG(AUTOHEADER, autoheader) AM_MISSING_PROG(MAKEINFO, makeinfo) -AM_MISSING_PROG(AMTAR, tar) AM_PROG_INSTALL_SH AM_PROG_INSTALL_STRIP AC_REQUIRE([AM_PROG_MKDIR_P])dnl @@ -525,7 +441,9 @@ AC_REQUIRE([AM_PROG_MKDIR_P])dnl AC_REQUIRE([AC_PROG_AWK])dnl AC_REQUIRE([AC_PROG_MAKE_SET])dnl AC_REQUIRE([AM_SET_LEADING_DOT])dnl - +_AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])], + [_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])], + [_AM_PROG_TAR([v7])])]) _AM_IF_OPTION([no-dependencies],, [AC_PROVIDE_IFELSE([AC_PROG_CC], [_AM_DEPENDENCIES(CC)], @@ -559,51 +477,27 @@ for _am_header in $config_headers :; do done echo "timestamp for $1" >`AS_DIRNAME([$1])`/stamp-h[]$_am_stamp_count]) +# Copyright (C) 2001, 2003, 2005 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + # AM_PROG_INSTALL_SH # ------------------ # Define $install_sh. - -# Copyright (C) 2001, 2003 Free Software Foundation, Inc. - -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2, 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, write to the Free Software -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA -# 02111-1307, USA. - AC_DEFUN([AM_PROG_INSTALL_SH], [AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl install_sh=${install_sh-"$am_aux_dir/install-sh"} AC_SUBST(install_sh)]) -# -*- Autoconf -*- -# Copyright (C) 2003 Free Software Foundation, Inc. +# Copyright (C) 2003, 2005 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. -# 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 2, 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, write to the Free Software -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA -# 02111-1307, USA. - -# serial 1 +# serial 2 # Check whether the underlying file-system supports filenames # with a leading dot. For instance MS-DOS doesn't. @@ -618,26 +512,15 @@ fi rmdir .tst 2>/dev/null AC_SUBST([am__leading_dot])]) -# Check to see how 'make' treats includes. -*- Autoconf -*- +# Check to see how 'make' treats includes. -*- Autoconf -*- -# Copyright (C) 2001, 2002, 2003 Free Software Foundation, Inc. +# Copyright (C) 2001, 2002, 2003, 2005 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. -# 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 2, 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, write to the Free Software -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA -# 02111-1307, USA. - -# serial 2 +# serial 3 # AM_MAKE_INCLUDE() # ----------------- @@ -681,27 +564,16 @@ AC_MSG_RESULT([$_am_result]) rm -f confinc confmf ]) -# -*- Autoconf -*- +# Fake the existence of programs that GNU maintainers use. -*- Autoconf -*- +# Copyright (C) 1997, 1999, 2000, 2001, 2003, 2005 +# Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. -# Copyright (C) 1997, 1999, 2000, 2001, 2003 Free Software Foundation, Inc. - -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2, 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, write to the Free Software -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA -# 02111-1307, USA. - -# serial 3 +# serial 4 # AM_MISSING_PROG(NAME, PROGRAM) # ------------------------------ @@ -727,27 +599,16 @@ else fi ]) +# Copyright (C) 2003, 2004, 2005 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + # AM_PROG_MKDIR_P # --------------- # Check whether `mkdir -p' is supported, fallback to mkinstalldirs otherwise. - -# Copyright (C) 2003, 2004 Free Software Foundation, Inc. - -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2, 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, write to the Free Software -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA -# 02111-1307, USA. - +# # Automake 1.8 used `mkdir -m 0755 -p --' to ensure that directories # created by `make install' are always world readable, even if the # installer happens to have an overly restrictive umask (e.g. 077). @@ -768,13 +629,21 @@ fi # this.) AC_DEFUN([AM_PROG_MKDIR_P], [if mkdir -p --version . >/dev/null 2>&1 && test ! -d ./--version; then - # Keeping the `.' argument allows $(mkdir_p) to be used without - # argument. Indeed, we sometimes output rules like + # We used to keeping the `.' as first argument, in order to + # allow $(mkdir_p) to be used without argument. As in # $(mkdir_p) $(somedir) - # where $(somedir) is conditionally defined. - # (`test -n '$(somedir)' && $(mkdir_p) $(somedir)' is a more - # expensive solution, as it forces Make to start a sub-shell.) - mkdir_p='mkdir -p -- .' + # where $(somedir) is conditionally defined. However this is wrong + # for two reasons: + # 1. if the package is installed by a user who cannot write `.' + # make install will fail, + # 2. the above comment should most certainly read + # $(mkdir_p) $(DESTDIR)$(somedir) + # so it does not work when $(somedir) is undefined and + # $(DESTDIR) is not. + # To support the latter case, we have to write + # test -z "$(somedir)" || $(mkdir_p) $(DESTDIR)$(somedir), + # so the `.' trick is pointless. + mkdir_p='mkdir -p --' else # On NextStep and OpenStep, the `mkdir' command does not # recognize any option. It will interpret all options as @@ -793,26 +662,15 @@ else fi AC_SUBST([mkdir_p])]) -# Helper functions for option handling. -*- Autoconf -*- +# Helper functions for option handling. -*- Autoconf -*- -# Copyright (C) 2001, 2002, 2003 Free Software Foundation, Inc. +# Copyright (C) 2001, 2002, 2003, 2005 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. -# 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 2, 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, write to the Free Software -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA -# 02111-1307, USA. - -# serial 2 +# serial 3 # _AM_MANGLE_OPTION(NAME) # ----------------------- @@ -837,28 +695,16 @@ AC_DEFUN([_AM_SET_OPTIONS], AC_DEFUN([_AM_IF_OPTION], [m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])]) +# Check to make sure that the build environment is sane. -*- Autoconf -*- + +# Copyright (C) 1996, 1997, 2000, 2001, 2003, 2005 +# Free Software Foundation, Inc. # -# Check to make sure that the build environment is sane. -# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. -# Copyright (C) 1996, 1997, 2000, 2001, 2003 Free Software Foundation, Inc. - -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2, 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, write to the Free Software -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA -# 02111-1307, USA. - -# serial 3 +# serial 4 # AM_SANITY_CHECK # --------------- @@ -901,25 +747,14 @@ Check your system clock]) fi AC_MSG_RESULT(yes)]) +# Copyright (C) 2001, 2003, 2005 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + # AM_PROG_INSTALL_STRIP - -# Copyright (C) 2001, 2003 Free Software Foundation, Inc. - -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2, 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, write to the Free Software -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA -# 02111-1307, USA. - +# --------------------- # One issue with vendor `install' (even GNU) is that you can't # specify the program used to strip binaries. This is especially # annoying in cross-compiling environments, where the build's strip @@ -940,7 +775,105 @@ fi INSTALL_STRIP_PROGRAM="\${SHELL} \$(install_sh) -c -s" AC_SUBST([INSTALL_STRIP_PROGRAM])]) +# Check how to create a tarball. -*- Autoconf -*- + +# Copyright (C) 2004, 2005 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# serial 2 + +# _AM_PROG_TAR(FORMAT) +# -------------------- +# Check how to create a tarball in format FORMAT. +# FORMAT should be one of `v7', `ustar', or `pax'. +# +# Substitute a variable $(am__tar) that is a command +# writing to stdout a FORMAT-tarball containing the directory +# $tardir. +# tardir=directory && $(am__tar) > result.tar +# +# Substitute a variable $(am__untar) that extract such +# a tarball read from stdin. +# $(am__untar) < result.tar +AC_DEFUN([_AM_PROG_TAR], +[# Always define AMTAR for backward compatibility. +AM_MISSING_PROG([AMTAR], [tar]) +m4_if([$1], [v7], + [am__tar='${AMTAR} chof - "$$tardir"'; am__untar='${AMTAR} xf -'], + [m4_case([$1], [ustar],, [pax],, + [m4_fatal([Unknown tar format])]) +AC_MSG_CHECKING([how to create a $1 tar archive]) +# Loop over all known methods to create a tar archive until one works. +_am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none' +_am_tools=${am_cv_prog_tar_$1-$_am_tools} +# Do not fold the above two line into one, because Tru64 sh and +# Solaris sh will not grok spaces in the rhs of `-'. +for _am_tool in $_am_tools +do + case $_am_tool in + gnutar) + for _am_tar in tar gnutar gtar; + do + AM_RUN_LOG([$_am_tar --version]) && break + done + am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"' + am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"' + am__untar="$_am_tar -xf -" + ;; + plaintar) + # Must skip GNU tar: if it does not support --format= it doesn't create + # ustar tarball either. + (tar --version) >/dev/null 2>&1 && continue + am__tar='tar chf - "$$tardir"' + am__tar_='tar chf - "$tardir"' + am__untar='tar xf -' + ;; + pax) + am__tar='pax -L -x $1 -w "$$tardir"' + am__tar_='pax -L -x $1 -w "$tardir"' + am__untar='pax -r' + ;; + cpio) + am__tar='find "$$tardir" -print | cpio -o -H $1 -L' + am__tar_='find "$tardir" -print | cpio -o -H $1 -L' + am__untar='cpio -i -H $1 -d' + ;; + none) + am__tar=false + am__tar_=false + am__untar=false + ;; + esac + + # If the value was cached, stop now. We just wanted to have am__tar + # and am__untar set. + test -n "${am_cv_prog_tar_$1}" && break + + # tar/untar a dummy directory, and stop if the command works + rm -rf conftest.dir + mkdir conftest.dir + echo GrepMe > conftest.dir/file + AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar]) + rm -rf conftest.dir + if test -s conftest.tar; then + AM_RUN_LOG([$am__untar /dev/null 2>&1 && break + fi +done +rm -rf conftest.dir + +AC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool]) +AC_MSG_RESULT([$am_cv_prog_tar_$1])]) +AC_SUBST([am__tar]) +AC_SUBST([am__untar]) +]) # _AM_PROG_TAR + m4_include([m4/alloca.m4]) +m4_include([m4/bison-i18n.m4]) +m4_include([m4/cxx.m4]) m4_include([m4/dirname.m4]) m4_include([m4/dmalloc.m4]) m4_include([m4/dos.m4]) @@ -948,14 +881,15 @@ m4_include([m4/error.m4]) m4_include([m4/exitfail.m4]) m4_include([m4/extensions.m4]) m4_include([m4/getopt.m4]) -m4_include([m4/gettext.m4]) +m4_include([m4/gettext_gl.m4]) m4_include([m4/gnulib.m4]) m4_include([m4/hard-locale.m4]) m4_include([m4/hash.m4]) m4_include([m4/iconv.m4]) -m4_include([m4/lib-ld.m4]) +m4_include([m4/inttypes_h_gl.m4]) +m4_include([m4/lib-ld_gl.m4]) m4_include([m4/lib-link.m4]) -m4_include([m4/lib-prefix.m4]) +m4_include([m4/lib-prefix_gl.m4]) m4_include([m4/m4.m4]) m4_include([m4/mbrtowc.m4]) m4_include([m4/mbstate_t.m4]) @@ -963,17 +897,22 @@ m4_include([m4/mbswidth.m4]) m4_include([m4/nls.m4]) m4_include([m4/obstack.m4]) m4_include([m4/onceonly.m4]) -m4_include([m4/po.m4]) +m4_include([m4/po_gl.m4]) m4_include([m4/progtest.m4]) m4_include([m4/quote.m4]) m4_include([m4/quotearg.m4]) m4_include([m4/stdbool.m4]) +m4_include([m4/stdint_h_gl.m4]) +m4_include([m4/stdio-safer.m4]) m4_include([m4/stpcpy.m4]) +m4_include([m4/strdup.m4]) m4_include([m4/strndup.m4]) m4_include([m4/strnlen.m4]) m4_include([m4/subpipe.m4]) m4_include([m4/timevar.m4]) -m4_include([m4/unlocked-io.m4]) +m4_include([m4/uintmax_t_gl.m4]) +m4_include([m4/ulonglong_gl.m4]) +m4_include([m4/unistd-safer.m4]) m4_include([m4/warning.m4]) m4_include([m4/xalloc.m4]) m4_include([m4/xstrndup.m4]) diff --git a/src/bin/bison/config.hin b/src/bin/bison/config.hin index 348274bfa7..68e91d3729 100644 --- a/src/bin/bison/config.hin +++ b/src/bin/bison/config.hin @@ -15,17 +15,17 @@ /* Define on systems for which file names may have a so-called `drive letter' prefix, define this to compute the length of that prefix, including the colon. */ -#undef FILESYSTEM_ACCEPTS_DRIVE_LETTER_PREFIX +#undef FILE_SYSTEM_ACCEPTS_DRIVE_LETTER_PREFIX /* Define if the backslash character may also serve as a file name component separator. */ -#undef FILESYSTEM_BACKSLASH_IS_FILE_NAME_SEPARATOR +#undef FILE_SYSTEM_BACKSLASH_IS_FILE_NAME_SEPARATOR -#if FILESYSTEM_ACCEPTS_DRIVE_LETTER_PREFIX -# define FILESYSTEM_PREFIX_LEN(Filename) \ +#if FILE_SYSTEM_ACCEPTS_DRIVE_LETTER_PREFIX +# define FILE_SYSTEM_PREFIX_LEN(Filename) \ ((Filename)[0] && (Filename)[1] == ':' ? 2 : 0) #else -# define FILESYSTEM_PREFIX_LEN(Filename) 0 +# define FILE_SYSTEM_PREFIX_LEN(Filename) 0 #endif /* Define to 1 if you have `alloca' after including , a header that @@ -36,6 +36,14 @@ includes only if HAVE_ALLOCA_H is defined. */ #undef HAVE_ALLOCA_H +/* Define to 1 if you have the MacOS X function CFLocaleCopyCurrent in the + CoreFoundation framework. */ +#undef HAVE_CFLOCALECOPYCURRENT + +/* Define to 1 if you have the MacOS X function CFPreferencesCopyAppValue in + the CoreFoundation framework. */ +#undef HAVE_CFPREFERENCESCOPYAPPVALUE + /* Define to 1 if the system has the type `clock_t'. */ #undef HAVE_CLOCK_T @@ -43,54 +51,10 @@ */ #undef HAVE_DCGETTEXT -/* Define to 1 if you have the declaration of `clearerr_unlocked', and to 0 if - you don't. */ -#undef HAVE_DECL_CLEARERR_UNLOCKED - /* Define to 1 if you have the declaration of `clock', and to 0 if you don't. */ #undef HAVE_DECL_CLOCK -/* Define to 1 if you have the declaration of `feof_unlocked', and to 0 if you - don't. */ -#undef HAVE_DECL_FEOF_UNLOCKED - -/* Define to 1 if you have the declaration of `ferror_unlocked', and to 0 if - you don't. */ -#undef HAVE_DECL_FERROR_UNLOCKED - -/* Define to 1 if you have the declaration of `fflush_unlocked', and to 0 if - you don't. */ -#undef HAVE_DECL_FFLUSH_UNLOCKED - -/* Define to 1 if you have the declaration of `fgets_unlocked', and to 0 if - you don't. */ -#undef HAVE_DECL_FGETS_UNLOCKED - -/* Define to 1 if you have the declaration of `fputc_unlocked', and to 0 if - you don't. */ -#undef HAVE_DECL_FPUTC_UNLOCKED - -/* Define to 1 if you have the declaration of `fputs_unlocked', and to 0 if - you don't. */ -#undef HAVE_DECL_FPUTS_UNLOCKED - -/* Define to 1 if you have the declaration of `fread_unlocked', and to 0 if - you don't. */ -#undef HAVE_DECL_FREAD_UNLOCKED - -/* Define to 1 if you have the declaration of `fwrite_unlocked', and to 0 if - you don't. */ -#undef HAVE_DECL_FWRITE_UNLOCKED - -/* Define to 1 if you have the declaration of `getchar_unlocked', and to 0 if - you don't. */ -#undef HAVE_DECL_GETCHAR_UNLOCKED - -/* Define to 1 if you have the declaration of `getc_unlocked', and to 0 if you - don't. */ -#undef HAVE_DECL_GETC_UNLOCKED - /* Define to 1 if you have the declaration of `getrusage', and to 0 if you don't. */ #undef HAVE_DECL_GETRUSAGE @@ -99,13 +63,9 @@ otherwise. */ #undef HAVE_DECL_MBSWIDTH_IN_WCHAR_H -/* Define to 1 if you have the declaration of `putchar_unlocked', and to 0 if - you don't. */ -#undef HAVE_DECL_PUTCHAR_UNLOCKED - -/* Define to 1 if you have the declaration of `putc_unlocked', and to 0 if you - don't. */ -#undef HAVE_DECL_PUTC_UNLOCKED +/* Define to 1 if you have the declaration of `strdup', and to 0 if you don't. + */ +#undef HAVE_DECL_STRDUP /* Define to 1 if you have the declaration of `strerror_r', and to 0 if you don't. */ @@ -130,12 +90,15 @@ /* Define to 1 if you have the `dup2' function. */ #undef HAVE_DUP2 -/* Define to 1 if you have the header file. */ -#undef HAVE_FCNTL_H - /* Define to 1 if you have the `fork' function. */ #undef HAVE_FORK +/* Define to 1 if you have the header file. */ +#undef HAVE_GETOPT_H + +/* Define to 1 if you have the `getopt_long_only' function. */ +#undef HAVE_GETOPT_LONG_ONLY + /* Define if the GNU gettext() function is already present or preinstalled. */ #undef HAVE_GETTEXT @@ -145,6 +108,10 @@ /* Define to 1 if you have the header file. */ #undef HAVE_INTTYPES_H +/* Define if exists, doesn't clash with , and + declares uintmax_t. */ +#undef HAVE_INTTYPES_H_WITH_UINTMAX + /* Define to 1 if you have the `isascii' function. */ #undef HAVE_ISASCII @@ -176,10 +143,6 @@ /* Define to 1 if libc includes obstacks. */ #undef HAVE_OBSTACK -/* Define to 1 if your system has a GNU libc compatible `realloc' function, - and to 0 otherwise. */ -#undef HAVE_REALLOC - /* Define to 1 if you have the `setlocale' function. */ #undef HAVE_SETLOCALE @@ -189,12 +152,19 @@ /* Define to 1 if you have the header file. */ #undef HAVE_STDINT_H +/* Define if exists, doesn't clash with , and declares + uintmax_t. */ +#undef HAVE_STDINT_H_WITH_UINTMAX + /* Define to 1 if you have the header file. */ #undef HAVE_STDLIB_H /* Define to 1 if you have the `stpcpy' function. */ #undef HAVE_STPCPY +/* Define to 1 if you have the `strdup' function. */ +#undef HAVE_STRDUP + /* Define to 1 if you have the `strerror_r' function. */ #undef HAVE_STRERROR_R @@ -231,12 +201,18 @@ /* Define to 1 if you have the `times' function. */ #undef HAVE_TIMES +/* Define if you have the 'uintmax_t' type in or . */ +#undef HAVE_UINTMAX_T + /* Define to 1 if the system has the type `uintptr_t'. */ #undef HAVE_UINTPTR_T /* Define to 1 if you have the header file. */ #undef HAVE_UNISTD_H +/* Define if you have the 'unsigned long long' type. */ +#undef HAVE_UNSIGNED_LONG_LONG + /* Define to 1 if you have the `vfork' function. */ #undef HAVE_VFORK @@ -264,7 +240,7 @@ /* Define to 1 if the system has the type `_Bool'. */ #undef HAVE__BOOL -#if FILESYSTEM_BACKSLASH_IS_FILE_NAME_SEPARATOR +#if FILE_SYSTEM_BACKSLASH_IS_FILE_NAME_SEPARATOR # define ISSLASH(C) ((C) == '/' || (C) == '\\') #else # define ISSLASH(C) ((C) == '/') @@ -311,6 +287,9 @@ /* Define if using the dmalloc debugging malloc package */ #undef WITH_DMALLOC +/* Define to 1 to internationalize bison runtime messages. */ +#undef YYENABLE_NLS + /* Define to 1 if `lex' declares `yytext' as a `char *' by default, not a `char[]'. */ #undef YYTEXT_POINTER @@ -341,6 +320,13 @@ #ifndef __EXTENSIONS__ # undef __EXTENSIONS__ #endif +#ifndef _POSIX_PTHREAD_SEMANTICS +# undef _POSIX_PTHREAD_SEMANTICS +#endif + +/* Define to rpl_ if the getopt replacement functions and variables should be + used. */ +#undef __GETOPT_PREFIX /* Define to `__inline__' or `__inline' if that's what the C compiler calls it, or to nothing if 'inline' is not supported under any name. */ @@ -360,11 +346,12 @@ /* Define to `int' if does not define. */ #undef pid_t -/* Define to rpl_realloc if the replacement function should be used. */ -#undef realloc - /* Define to rpl_strnlen if the replacement function should be used. */ #undef strnlen +/* Define to unsigned long or unsigned long long if and + don't define. */ +#undef uintmax_t + /* Define as `fork' if `vfork' does not work. */ #undef vfork diff --git a/src/bin/bison/config/Makefile.am b/src/bin/bison/config/Makefile.am deleted file mode 100644 index b3a810d847..0000000000 --- a/src/bin/bison/config/Makefile.am +++ /dev/null @@ -1,2 +0,0 @@ -## Process this file with automake to produce Makefile.in -*-Makefile-*- -EXTRA_DIST = move-if-change prev-version.txt config.rpath diff --git a/src/bin/bison/config/Makefile.in b/src/bin/bison/config/Makefile.in deleted file mode 100644 index 40260be8ba..0000000000 --- a/src/bin/bison/config/Makefile.in +++ /dev/null @@ -1,338 +0,0 @@ -# Makefile.in generated by automake 1.8.5 from Makefile.am. -# @configure_input@ - -# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, -# 2003, 2004 Free Software Foundation, Inc. -# This Makefile.in is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY, to the extent permitted by law; without -# even the implied warranty of MERCHANTABILITY or FITNESS FOR A -# PARTICULAR PURPOSE. - -@SET_MAKE@ -srcdir = @srcdir@ -top_srcdir = @top_srcdir@ -VPATH = @srcdir@ -pkgdatadir = $(datadir)/@PACKAGE@ -pkglibdir = $(libdir)/@PACKAGE@ -pkgincludedir = $(includedir)/@PACKAGE@ -top_builddir = .. -am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd -INSTALL = @INSTALL@ -install_sh_DATA = $(install_sh) -c -m 644 -install_sh_PROGRAM = $(install_sh) -c -install_sh_SCRIPT = $(install_sh) -c -INSTALL_HEADER = $(INSTALL_DATA) -transform = $(program_transform_name) -NORMAL_INSTALL = : -PRE_INSTALL = : -POST_INSTALL = : -NORMAL_UNINSTALL = : -PRE_UNINSTALL = : -POST_UNINSTALL = : -host_triplet = @host@ -subdir = config -DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in config.guess \ - config.rpath config.sub depcomp install-sh mdate-sh missing \ - mkinstalldirs texinfo.tex ylwrap -ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -am__aclocal_m4_deps = $(top_srcdir)/m4/alloca.m4 \ - $(top_srcdir)/m4/dirname.m4 $(top_srcdir)/m4/dmalloc.m4 \ - $(top_srcdir)/m4/dos.m4 $(top_srcdir)/m4/error.m4 \ - $(top_srcdir)/m4/exitfail.m4 $(top_srcdir)/m4/extensions.m4 \ - $(top_srcdir)/m4/getopt.m4 $(top_srcdir)/m4/gettext.m4 \ - $(top_srcdir)/m4/gnulib.m4 $(top_srcdir)/m4/hard-locale.m4 \ - $(top_srcdir)/m4/hash.m4 $(top_srcdir)/m4/iconv.m4 \ - $(top_srcdir)/m4/lib-ld.m4 $(top_srcdir)/m4/lib-link.m4 \ - $(top_srcdir)/m4/lib-prefix.m4 $(top_srcdir)/m4/m4.m4 \ - $(top_srcdir)/m4/mbrtowc.m4 $(top_srcdir)/m4/mbstate_t.m4 \ - $(top_srcdir)/m4/mbswidth.m4 $(top_srcdir)/m4/nls.m4 \ - $(top_srcdir)/m4/obstack.m4 $(top_srcdir)/m4/onceonly.m4 \ - $(top_srcdir)/m4/po.m4 $(top_srcdir)/m4/progtest.m4 \ - $(top_srcdir)/m4/quote.m4 $(top_srcdir)/m4/quotearg.m4 \ - $(top_srcdir)/m4/stdbool.m4 $(top_srcdir)/m4/stpcpy.m4 \ - $(top_srcdir)/m4/strndup.m4 $(top_srcdir)/m4/strnlen.m4 \ - $(top_srcdir)/m4/subpipe.m4 $(top_srcdir)/m4/timevar.m4 \ - $(top_srcdir)/m4/unlocked-io.m4 $(top_srcdir)/m4/warning.m4 \ - $(top_srcdir)/m4/xalloc.m4 $(top_srcdir)/m4/xstrndup.m4 \ - $(top_srcdir)/configure.ac -am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ - $(ACLOCAL_M4) -mkinstalldirs = $(SHELL) $(top_srcdir)/config/mkinstalldirs -CONFIG_HEADER = $(top_builddir)/config.h -CONFIG_CLEAN_FILES = -SOURCES = -DIST_SOURCES = -DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) -ACLOCAL = @ACLOCAL@ -ALLOCA = @ALLOCA@ -ALLOCA_H = @ALLOCA_H@ -AMDEP_FALSE = @AMDEP_FALSE@ -AMDEP_TRUE = @AMDEP_TRUE@ -AMTAR = @AMTAR@ -AUTOCONF = @AUTOCONF@ -AUTOHEADER = @AUTOHEADER@ -AUTOM4TE = @AUTOM4TE@ -AUTOMAKE = @AUTOMAKE@ -AWK = @AWK@ -CC = @CC@ -CCDEPMODE = @CCDEPMODE@ -CFLAGS = @CFLAGS@ -CPP = @CPP@ -CPPFLAGS = @CPPFLAGS@ -CXX = @CXX@ -CXXDEPMODE = @CXXDEPMODE@ -CXXFLAGS = @CXXFLAGS@ -CYGPATH_W = @CYGPATH_W@ -DEFS = @DEFS@ -DEPDIR = @DEPDIR@ -ECHO_C = @ECHO_C@ -ECHO_N = @ECHO_N@ -ECHO_T = @ECHO_T@ -EGREP = @EGREP@ -EXEEXT = @EXEEXT@ -GCC = @GCC@ -GMSGFMT = @GMSGFMT@ -HAVE__BOOL = @HAVE__BOOL@ -INSTALL_DATA = @INSTALL_DATA@ -INSTALL_PROGRAM = @INSTALL_PROGRAM@ -INSTALL_SCRIPT = @INSTALL_SCRIPT@ -INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ -INTLLIBS = @INTLLIBS@ -LDFLAGS = @LDFLAGS@ -LEX = @LEX@ -LEXLIB = @LEXLIB@ -LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@ -LIBICONV = @LIBICONV@ -LIBINTL = @LIBINTL@ -LIBOBJS = @LIBOBJS@ -LIBS = @LIBS@ -LTLIBICONV = @LTLIBICONV@ -LTLIBINTL = @LTLIBINTL@ -LTLIBOBJS = @LTLIBOBJS@ -M4 = @M4@ -MAKEINFO = @MAKEINFO@ -MKINSTALLDIRS = @MKINSTALLDIRS@ -MSGFMT = @MSGFMT@ -MSGMERGE = @MSGMERGE@ -O0CFLAGS = @O0CFLAGS@ -OBJEXT = @OBJEXT@ -PACKAGE = @PACKAGE@ -PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ -PACKAGE_NAME = @PACKAGE_NAME@ -PACKAGE_STRING = @PACKAGE_STRING@ -PACKAGE_TARNAME = @PACKAGE_TARNAME@ -PACKAGE_VERSION = @PACKAGE_VERSION@ -PATH_SEPARATOR = @PATH_SEPARATOR@ -POSUB = @POSUB@ -RANLIB = @RANLIB@ -SET_MAKE = @SET_MAKE@ -SHELL = @SHELL@ -STDBOOL_H = @STDBOOL_H@ -STRIP = @STRIP@ -USE_NLS = @USE_NLS@ -VALGRIND = @VALGRIND@ -VERSION = @VERSION@ -WARNING_CFLAGS = @WARNING_CFLAGS@ -WARNING_CXXFLAGS = @WARNING_CXXFLAGS@ -WERROR_CFLAGS = @WERROR_CFLAGS@ -XGETTEXT = @XGETTEXT@ -YACC = @YACC@ -YACC_LIBRARY = @YACC_LIBRARY@ -YACC_SCRIPT = @YACC_SCRIPT@ -ac_ct_CC = @ac_ct_CC@ -ac_ct_CXX = @ac_ct_CXX@ -ac_ct_RANLIB = @ac_ct_RANLIB@ -ac_ct_STRIP = @ac_ct_STRIP@ -am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ -am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ -am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@ -am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@ -am__include = @am__include@ -am__leading_dot = @am__leading_dot@ -am__quote = @am__quote@ -bindir = @bindir@ -build = @build@ -build_alias = @build_alias@ -build_cpu = @build_cpu@ -build_os = @build_os@ -build_vendor = @build_vendor@ -datadir = @datadir@ -exec_prefix = @exec_prefix@ -host = @host@ -host_alias = @host_alias@ -host_cpu = @host_cpu@ -host_os = @host_os@ -host_vendor = @host_vendor@ -includedir = @includedir@ -infodir = @infodir@ -install_sh = @install_sh@ -libdir = @libdir@ -libexecdir = @libexecdir@ -localstatedir = @localstatedir@ -mandir = @mandir@ -mkdir_p = @mkdir_p@ -oldincludedir = @oldincludedir@ -prefix = @prefix@ -program_transform_name = @program_transform_name@ -sbindir = @sbindir@ -sharedstatedir = @sharedstatedir@ -sysconfdir = @sysconfdir@ -target_alias = @target_alias@ -EXTRA_DIST = move-if-change prev-version.txt config.rpath -all: all-am - -.SUFFIXES: -$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) - @for dep in $?; do \ - case '$(am__configure_deps)' in \ - *$$dep*) \ - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ - && exit 0; \ - exit 1;; \ - esac; \ - done; \ - echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu config/Makefile'; \ - cd $(top_srcdir) && \ - $(AUTOMAKE) --gnu config/Makefile -.PRECIOUS: Makefile -Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status - @case '$?' in \ - *config.status*) \ - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ - *) \ - echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ - cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ - esac; - -$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh - -$(top_srcdir)/configure: $(am__configure_deps) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh -$(ACLOCAL_M4): $(am__aclocal_m4_deps) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh -uninstall-info-am: -tags: TAGS -TAGS: - -ctags: CTAGS -CTAGS: - - -distdir: $(DISTFILES) - @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ - topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ - list='$(DISTFILES)'; for file in $$list; do \ - case $$file in \ - $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ - $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ - esac; \ - if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ - dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ - if test "$$dir" != "$$file" && test "$$dir" != "."; then \ - dir="/$$dir"; \ - $(mkdir_p) "$(distdir)$$dir"; \ - else \ - dir=''; \ - fi; \ - if test -d $$d/$$file; then \ - if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ - cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ - fi; \ - cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ - else \ - test -f $(distdir)/$$file \ - || cp -p $$d/$$file $(distdir)/$$file \ - || exit 1; \ - fi; \ - done -check-am: all-am -check: check-am -all-am: Makefile -installdirs: -install: install-am -install-exec: install-exec-am -install-data: install-data-am -uninstall: uninstall-am - -install-am: all-am - @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am - -installcheck: installcheck-am -install-strip: - $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ - install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ - `test -z '$(STRIP)' || \ - echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install -mostlyclean-generic: - -clean-generic: - -distclean-generic: - -rm -f $(CONFIG_CLEAN_FILES) - -maintainer-clean-generic: - @echo "This command is intended for maintainers to use" - @echo "it deletes files that may require special tools to rebuild." -clean: clean-am - -clean-am: clean-generic mostlyclean-am - -distclean: distclean-am - -rm -f Makefile -distclean-am: clean-am distclean-generic - -dvi: dvi-am - -dvi-am: - -html: html-am - -info: info-am - -info-am: - -install-data-am: - -install-exec-am: - -install-info: install-info-am - -install-man: - -installcheck-am: - -maintainer-clean: maintainer-clean-am - -rm -f Makefile -maintainer-clean-am: distclean-am maintainer-clean-generic - -mostlyclean: mostlyclean-am - -mostlyclean-am: mostlyclean-generic - -pdf: pdf-am - -pdf-am: - -ps: ps-am - -ps-am: - -uninstall-am: uninstall-info-am - -.PHONY: all all-am check check-am clean clean-generic distclean \ - distclean-generic distdir dvi dvi-am html html-am info info-am \ - install install-am install-data install-data-am install-exec \ - install-exec-am install-info install-info-am install-man \ - install-strip installcheck installcheck-am installdirs \ - maintainer-clean maintainer-clean-generic mostlyclean \ - mostlyclean-generic pdf pdf-am ps ps-am uninstall uninstall-am \ - uninstall-info-am - -# Tell versions [3.59,3.63) of GNU make to not export all variables. -# Otherwise a system limit (for SysV at least) may be exceeded. -.NOEXPORT: diff --git a/src/bin/bison/config/config.guess b/src/bin/bison/config/config.guess deleted file mode 100644 index 51fab47709..0000000000 --- a/src/bin/bison/config/config.guess +++ /dev/null @@ -1,1459 +0,0 @@ -#! /bin/sh -# Attempt to guess a canonical system name. -# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, -# 2000, 2001, 2002, 2003 Free Software Foundation, Inc. - -timestamp='2004-03-12' - -# This file 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 2 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, write to the Free Software -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -# -# As a special exception to the GNU General Public License, if you -# distribute this file as part of a program that contains a -# configuration script generated by Autoconf, you may include it under -# the same distribution terms that you use for the rest of that program. - -# Originally written by Per Bothner . -# Please send patches to . Submit a context -# diff and a properly formatted ChangeLog entry. -# -# This script attempts to guess a canonical system name similar to -# config.sub. If it succeeds, it prints the system name on stdout, and -# exits with 0. Otherwise, it exits with 1. -# -# The plan is that this can be called by configure scripts if you -# don't specify an explicit build system type. - -me=`echo "$0" | sed -e 's,.*/,,'` - -usage="\ -Usage: $0 [OPTION] - -Output the configuration name of the system \`$me' is run on. - -Operation modes: - -h, --help print this help, then exit - -t, --time-stamp print date of last modification, then exit - -v, --version print version number, then exit - -Report bugs and patches to ." - -version="\ -GNU config.guess ($timestamp) - -Originally written by Per Bothner. -Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001 -Free Software Foundation, Inc. - -This is free software; see the source for copying conditions. There is NO -warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." - -help=" -Try \`$me --help' for more information." - -# Parse command line -while test $# -gt 0 ; do - case $1 in - --time-stamp | --time* | -t ) - echo "$timestamp" ; exit 0 ;; - --version | -v ) - echo "$version" ; exit 0 ;; - --help | --h* | -h ) - echo "$usage"; exit 0 ;; - -- ) # Stop option processing - shift; break ;; - - ) # Use stdin as input. - break ;; - -* ) - echo "$me: invalid option $1$help" >&2 - exit 1 ;; - * ) - break ;; - esac -done - -if test $# != 0; then - echo "$me: too many arguments$help" >&2 - exit 1 -fi - -trap 'exit 1' 1 2 15 - -# CC_FOR_BUILD -- compiler used by this script. Note that the use of a -# compiler to aid in system detection is discouraged as it requires -# temporary files to be created and, as you can see below, it is a -# headache to deal with in a portable fashion. - -# Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still -# use `HOST_CC' if defined, but it is deprecated. - -# Portable tmp directory creation inspired by the Autoconf team. - -set_cc_for_build=' -trap "exitcode=\$?; (rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null) && exit \$exitcode" 0 ; -trap "rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null; exit 1" 1 2 13 15 ; -: ${TMPDIR=/tmp} ; - { tmp=`(umask 077 && mktemp -d -q "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } || - { test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir $tmp) ; } || - { tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir $tmp) && echo "Warning: creating insecure temp directory" >&2 ; } || - { echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; } ; -dummy=$tmp/dummy ; -tmpfiles="$dummy.c $dummy.o $dummy.rel $dummy" ; -case $CC_FOR_BUILD,$HOST_CC,$CC in - ,,) echo "int x;" > $dummy.c ; - for c in cc gcc c89 c99 ; do - if ($c -c -o $dummy.o $dummy.c) >/dev/null 2>&1 ; then - CC_FOR_BUILD="$c"; break ; - fi ; - done ; - if test x"$CC_FOR_BUILD" = x ; then - CC_FOR_BUILD=no_compiler_found ; - fi - ;; - ,,*) CC_FOR_BUILD=$CC ;; - ,*,*) CC_FOR_BUILD=$HOST_CC ;; -esac ;' - -# This is needed to find uname on a Pyramid OSx when run in the BSD universe. -# (ghazi@noc.rutgers.edu 1994-08-24) -if (test -f /.attbin/uname) >/dev/null 2>&1 ; then - PATH=$PATH:/.attbin ; export PATH -fi - -UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown -UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown -UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown -UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown - -# Note: order is significant - the case branches are not exclusive. - -case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in - *:NetBSD:*:*) - # NetBSD (nbsd) targets should (where applicable) match one or - # more of the tupples: *-*-netbsdelf*, *-*-netbsdaout*, - # *-*-netbsdecoff* and *-*-netbsd*. For targets that recently - # switched to ELF, *-*-netbsd* would select the old - # object file format. This provides both forward - # compatibility and a consistent mechanism for selecting the - # object file format. - # - # Note: NetBSD doesn't particularly care about the vendor - # portion of the name. We always set it to "unknown". - sysctl="sysctl -n hw.machine_arch" - UNAME_MACHINE_ARCH=`(/sbin/$sysctl 2>/dev/null || \ - /usr/sbin/$sysctl 2>/dev/null || echo unknown)` - case "${UNAME_MACHINE_ARCH}" in - armeb) machine=armeb-unknown ;; - arm*) machine=arm-unknown ;; - sh3el) machine=shl-unknown ;; - sh3eb) machine=sh-unknown ;; - *) machine=${UNAME_MACHINE_ARCH}-unknown ;; - esac - # The Operating System including object format, if it has switched - # to ELF recently, or will in the future. - case "${UNAME_MACHINE_ARCH}" in - arm*|i386|m68k|ns32k|sh3*|sparc|vax) - eval $set_cc_for_build - if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \ - | grep __ELF__ >/dev/null - then - # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout). - # Return netbsd for either. FIX? - os=netbsd - else - os=netbsdelf - fi - ;; - *) - os=netbsd - ;; - esac - # The OS release - # Debian GNU/NetBSD machines have a different userland, and - # thus, need a distinct triplet. However, they do not need - # kernel version information, so it can be replaced with a - # suitable tag, in the style of linux-gnu. - case "${UNAME_VERSION}" in - Debian*) - release='-gnu' - ;; - *) - release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'` - ;; - esac - # Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM: - # contains redundant information, the shorter form: - # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used. - echo "${machine}-${os}${release}" - exit 0 ;; - amd64:OpenBSD:*:*) - echo x86_64-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; - amiga:OpenBSD:*:*) - echo m68k-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; - arc:OpenBSD:*:*) - echo mipsel-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; - cats:OpenBSD:*:*) - echo arm-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; - hp300:OpenBSD:*:*) - echo m68k-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; - mac68k:OpenBSD:*:*) - echo m68k-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; - macppc:OpenBSD:*:*) - echo powerpc-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; - mvme68k:OpenBSD:*:*) - echo m68k-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; - mvme88k:OpenBSD:*:*) - echo m88k-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; - mvmeppc:OpenBSD:*:*) - echo powerpc-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; - pegasos:OpenBSD:*:*) - echo powerpc-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; - pmax:OpenBSD:*:*) - echo mipsel-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; - sgi:OpenBSD:*:*) - echo mipseb-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; - sun3:OpenBSD:*:*) - echo m68k-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; - wgrisc:OpenBSD:*:*) - echo mipsel-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; - *:OpenBSD:*:*) - echo ${UNAME_MACHINE}-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; - *:ekkoBSD:*:*) - echo ${UNAME_MACHINE}-unknown-ekkobsd${UNAME_RELEASE} - exit 0 ;; - macppc:MirBSD:*:*) - echo powerppc-unknown-mirbsd${UNAME_RELEASE} - exit 0 ;; - *:MirBSD:*:*) - echo ${UNAME_MACHINE}-unknown-mirbsd${UNAME_RELEASE} - exit 0 ;; - alpha:OSF1:*:*) - case $UNAME_RELEASE in - *4.0) - UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'` - ;; - *5.*) - UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'` - ;; - esac - # According to Compaq, /usr/sbin/psrinfo has been available on - # OSF/1 and Tru64 systems produced since 1995. I hope that - # covers most systems running today. This code pipes the CPU - # types through head -n 1, so we only detect the type of CPU 0. - ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^ The alpha \(.*\) processor.*$/\1/p' | head -n 1` - case "$ALPHA_CPU_TYPE" in - "EV4 (21064)") - UNAME_MACHINE="alpha" ;; - "EV4.5 (21064)") - UNAME_MACHINE="alpha" ;; - "LCA4 (21066/21068)") - UNAME_MACHINE="alpha" ;; - "EV5 (21164)") - UNAME_MACHINE="alphaev5" ;; - "EV5.6 (21164A)") - UNAME_MACHINE="alphaev56" ;; - "EV5.6 (21164PC)") - UNAME_MACHINE="alphapca56" ;; - "EV5.7 (21164PC)") - UNAME_MACHINE="alphapca57" ;; - "EV6 (21264)") - UNAME_MACHINE="alphaev6" ;; - "EV6.7 (21264A)") - UNAME_MACHINE="alphaev67" ;; - "EV6.8CB (21264C)") - UNAME_MACHINE="alphaev68" ;; - "EV6.8AL (21264B)") - UNAME_MACHINE="alphaev68" ;; - "EV6.8CX (21264D)") - UNAME_MACHINE="alphaev68" ;; - "EV6.9A (21264/EV69A)") - UNAME_MACHINE="alphaev69" ;; - "EV7 (21364)") - UNAME_MACHINE="alphaev7" ;; - "EV7.9 (21364A)") - UNAME_MACHINE="alphaev79" ;; - esac - # A Pn.n version is a patched version. - # A Vn.n version is a released version. - # A Tn.n version is a released field test version. - # A Xn.n version is an unreleased experimental baselevel. - # 1.2 uses "1.2" for uname -r. - echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[PVTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` - exit 0 ;; - Alpha*:OpenVMS:*:*) - echo alpha-hp-vms - exit 0 ;; - Alpha\ *:Windows_NT*:*) - # How do we know it's Interix rather than the generic POSIX subsystem? - # Should we change UNAME_MACHINE based on the output of uname instead - # of the specific Alpha model? - echo alpha-pc-interix - exit 0 ;; - 21064:Windows_NT:50:3) - echo alpha-dec-winnt3.5 - exit 0 ;; - Amiga*:UNIX_System_V:4.0:*) - echo m68k-unknown-sysv4 - exit 0;; - *:[Aa]miga[Oo][Ss]:*:*) - echo ${UNAME_MACHINE}-unknown-amigaos - exit 0 ;; - *:[Mm]orph[Oo][Ss]:*:*) - echo ${UNAME_MACHINE}-unknown-morphos - exit 0 ;; - *:OS/390:*:*) - echo i370-ibm-openedition - exit 0 ;; - *:OS400:*:*) - echo powerpc-ibm-os400 - exit 0 ;; - arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*) - echo arm-acorn-riscix${UNAME_RELEASE} - exit 0;; - SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*) - echo hppa1.1-hitachi-hiuxmpp - exit 0;; - Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*) - # akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE. - if test "`(/bin/universe) 2>/dev/null`" = att ; then - echo pyramid-pyramid-sysv3 - else - echo pyramid-pyramid-bsd - fi - exit 0 ;; - NILE*:*:*:dcosx) - echo pyramid-pyramid-svr4 - exit 0 ;; - DRS?6000:unix:4.0:6*) - echo sparc-icl-nx6 - exit 0 ;; - DRS?6000:UNIX_SV:4.2*:7*) - case `/usr/bin/uname -p` in - sparc) echo sparc-icl-nx7 && exit 0 ;; - esac ;; - sun4H:SunOS:5.*:*) - echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` - exit 0 ;; - sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*) - echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` - exit 0 ;; - i86pc:SunOS:5.*:*) - echo i386-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` - exit 0 ;; - sun4*:SunOS:6*:*) - # According to config.sub, this is the proper way to canonicalize - # SunOS6. Hard to guess exactly what SunOS6 will be like, but - # it's likely to be more like Solaris than SunOS4. - echo sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` - exit 0 ;; - sun4*:SunOS:*:*) - case "`/usr/bin/arch -k`" in - Series*|S4*) - UNAME_RELEASE=`uname -v` - ;; - esac - # Japanese Language versions have a version number like `4.1.3-JL'. - echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'` - exit 0 ;; - sun3*:SunOS:*:*) - echo m68k-sun-sunos${UNAME_RELEASE} - exit 0 ;; - sun*:*:4.2BSD:*) - UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null` - test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3 - case "`/bin/arch`" in - sun3) - echo m68k-sun-sunos${UNAME_RELEASE} - ;; - sun4) - echo sparc-sun-sunos${UNAME_RELEASE} - ;; - esac - exit 0 ;; - aushp:SunOS:*:*) - echo sparc-auspex-sunos${UNAME_RELEASE} - exit 0 ;; - # The situation for MiNT is a little confusing. The machine name - # can be virtually everything (everything which is not - # "atarist" or "atariste" at least should have a processor - # > m68000). The system name ranges from "MiNT" over "FreeMiNT" - # to the lowercase version "mint" (or "freemint"). Finally - # the system name "TOS" denotes a system which is actually not - # MiNT. But MiNT is downward compatible to TOS, so this should - # be no problem. - atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*) - echo m68k-atari-mint${UNAME_RELEASE} - exit 0 ;; - atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*) - echo m68k-atari-mint${UNAME_RELEASE} - exit 0 ;; - *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*) - echo m68k-atari-mint${UNAME_RELEASE} - exit 0 ;; - milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*) - echo m68k-milan-mint${UNAME_RELEASE} - exit 0 ;; - hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*) - echo m68k-hades-mint${UNAME_RELEASE} - exit 0 ;; - *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*) - echo m68k-unknown-mint${UNAME_RELEASE} - exit 0 ;; - m68k:machten:*:*) - echo m68k-apple-machten${UNAME_RELEASE} - exit 0 ;; - powerpc:machten:*:*) - echo powerpc-apple-machten${UNAME_RELEASE} - exit 0 ;; - RISC*:Mach:*:*) - echo mips-dec-mach_bsd4.3 - exit 0 ;; - RISC*:ULTRIX:*:*) - echo mips-dec-ultrix${UNAME_RELEASE} - exit 0 ;; - VAX*:ULTRIX*:*:*) - echo vax-dec-ultrix${UNAME_RELEASE} - exit 0 ;; - 2020:CLIX:*:* | 2430:CLIX:*:*) - echo clipper-intergraph-clix${UNAME_RELEASE} - exit 0 ;; - mips:*:*:UMIPS | mips:*:*:RISCos) - eval $set_cc_for_build - sed 's/^ //' << EOF >$dummy.c -#ifdef __cplusplus -#include /* for printf() prototype */ - int main (int argc, char *argv[]) { -#else - int main (argc, argv) int argc; char *argv[]; { -#endif - #if defined (host_mips) && defined (MIPSEB) - #if defined (SYSTYPE_SYSV) - printf ("mips-mips-riscos%ssysv\n", argv[1]); exit (0); - #endif - #if defined (SYSTYPE_SVR4) - printf ("mips-mips-riscos%ssvr4\n", argv[1]); exit (0); - #endif - #if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD) - printf ("mips-mips-riscos%sbsd\n", argv[1]); exit (0); - #endif - #endif - exit (-1); - } -EOF - $CC_FOR_BUILD -o $dummy $dummy.c \ - && $dummy `echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` \ - && exit 0 - echo mips-mips-riscos${UNAME_RELEASE} - exit 0 ;; - Motorola:PowerMAX_OS:*:*) - echo powerpc-motorola-powermax - exit 0 ;; - Motorola:*:4.3:PL8-*) - echo powerpc-harris-powermax - exit 0 ;; - Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*) - echo powerpc-harris-powermax - exit 0 ;; - Night_Hawk:Power_UNIX:*:*) - echo powerpc-harris-powerunix - exit 0 ;; - m88k:CX/UX:7*:*) - echo m88k-harris-cxux7 - exit 0 ;; - m88k:*:4*:R4*) - echo m88k-motorola-sysv4 - exit 0 ;; - m88k:*:3*:R3*) - echo m88k-motorola-sysv3 - exit 0 ;; - AViiON:dgux:*:*) - # DG/UX returns AViiON for all architectures - UNAME_PROCESSOR=`/usr/bin/uname -p` - if [ $UNAME_PROCESSOR = mc88100 ] || [ $UNAME_PROCESSOR = mc88110 ] - then - if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx ] || \ - [ ${TARGET_BINARY_INTERFACE}x = x ] - then - echo m88k-dg-dgux${UNAME_RELEASE} - else - echo m88k-dg-dguxbcs${UNAME_RELEASE} - fi - else - echo i586-dg-dgux${UNAME_RELEASE} - fi - exit 0 ;; - M88*:DolphinOS:*:*) # DolphinOS (SVR3) - echo m88k-dolphin-sysv3 - exit 0 ;; - M88*:*:R3*:*) - # Delta 88k system running SVR3 - echo m88k-motorola-sysv3 - exit 0 ;; - XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3) - echo m88k-tektronix-sysv3 - exit 0 ;; - Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD) - echo m68k-tektronix-bsd - exit 0 ;; - *:IRIX*:*:*) - echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'` - exit 0 ;; - ????????:AIX?:[12].1:2) # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX. - echo romp-ibm-aix # uname -m gives an 8 hex-code CPU id - exit 0 ;; # Note that: echo "'`uname -s`'" gives 'AIX ' - i*86:AIX:*:*) - echo i386-ibm-aix - exit 0 ;; - ia64:AIX:*:*) - if [ -x /usr/bin/oslevel ] ; then - IBM_REV=`/usr/bin/oslevel` - else - IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} - fi - echo ${UNAME_MACHINE}-ibm-aix${IBM_REV} - exit 0 ;; - *:AIX:2:3) - if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then - eval $set_cc_for_build - sed 's/^ //' << EOF >$dummy.c - #include - - main() - { - if (!__power_pc()) - exit(1); - puts("powerpc-ibm-aix3.2.5"); - exit(0); - } -EOF - $CC_FOR_BUILD -o $dummy $dummy.c && $dummy && exit 0 - echo rs6000-ibm-aix3.2.5 - elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then - echo rs6000-ibm-aix3.2.4 - else - echo rs6000-ibm-aix3.2 - fi - exit 0 ;; - *:AIX:*:[45]) - IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'` - if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then - IBM_ARCH=rs6000 - else - IBM_ARCH=powerpc - fi - if [ -x /usr/bin/oslevel ] ; then - IBM_REV=`/usr/bin/oslevel` - else - IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} - fi - echo ${IBM_ARCH}-ibm-aix${IBM_REV} - exit 0 ;; - *:AIX:*:*) - echo rs6000-ibm-aix - exit 0 ;; - ibmrt:4.4BSD:*|romp-ibm:BSD:*) - echo romp-ibm-bsd4.4 - exit 0 ;; - ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC BSD and - echo romp-ibm-bsd${UNAME_RELEASE} # 4.3 with uname added to - exit 0 ;; # report: romp-ibm BSD 4.3 - *:BOSX:*:*) - echo rs6000-bull-bosx - exit 0 ;; - DPX/2?00:B.O.S.:*:*) - echo m68k-bull-sysv3 - exit 0 ;; - 9000/[34]??:4.3bsd:1.*:*) - echo m68k-hp-bsd - exit 0 ;; - hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*) - echo m68k-hp-bsd4.4 - exit 0 ;; - 9000/[34678]??:HP-UX:*:*) - HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` - case "${UNAME_MACHINE}" in - 9000/31? ) HP_ARCH=m68000 ;; - 9000/[34]?? ) HP_ARCH=m68k ;; - 9000/[678][0-9][0-9]) - if [ -x /usr/bin/getconf ]; then - sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null` - sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null` - case "${sc_cpu_version}" in - 523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0 - 528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1 - 532) # CPU_PA_RISC2_0 - case "${sc_kernel_bits}" in - 32) HP_ARCH="hppa2.0n" ;; - 64) HP_ARCH="hppa2.0w" ;; - '') HP_ARCH="hppa2.0" ;; # HP-UX 10.20 - esac ;; - esac - fi - if [ "${HP_ARCH}" = "" ]; then - eval $set_cc_for_build - sed 's/^ //' << EOF >$dummy.c - - #define _HPUX_SOURCE - #include - #include - - int main () - { - #if defined(_SC_KERNEL_BITS) - long bits = sysconf(_SC_KERNEL_BITS); - #endif - long cpu = sysconf (_SC_CPU_VERSION); - - switch (cpu) - { - case CPU_PA_RISC1_0: puts ("hppa1.0"); break; - case CPU_PA_RISC1_1: puts ("hppa1.1"); break; - case CPU_PA_RISC2_0: - #if defined(_SC_KERNEL_BITS) - switch (bits) - { - case 64: puts ("hppa2.0w"); break; - case 32: puts ("hppa2.0n"); break; - default: puts ("hppa2.0"); break; - } break; - #else /* !defined(_SC_KERNEL_BITS) */ - puts ("hppa2.0"); break; - #endif - default: puts ("hppa1.0"); break; - } - exit (0); - } -EOF - (CCOPTS= $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy` - test -z "$HP_ARCH" && HP_ARCH=hppa - fi ;; - esac - if [ ${HP_ARCH} = "hppa2.0w" ] - then - # avoid double evaluation of $set_cc_for_build - test -n "$CC_FOR_BUILD" || eval $set_cc_for_build - if echo __LP64__ | (CCOPTS= $CC_FOR_BUILD -E -) | grep __LP64__ >/dev/null - then - HP_ARCH="hppa2.0w" - else - HP_ARCH="hppa64" - fi - fi - echo ${HP_ARCH}-hp-hpux${HPUX_REV} - exit 0 ;; - ia64:HP-UX:*:*) - HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` - echo ia64-hp-hpux${HPUX_REV} - exit 0 ;; - 3050*:HI-UX:*:*) - eval $set_cc_for_build - sed 's/^ //' << EOF >$dummy.c - #include - int - main () - { - long cpu = sysconf (_SC_CPU_VERSION); - /* The order matters, because CPU_IS_HP_MC68K erroneously returns - true for CPU_PA_RISC1_0. CPU_IS_PA_RISC returns correct - results, however. */ - if (CPU_IS_PA_RISC (cpu)) - { - switch (cpu) - { - case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break; - case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break; - case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break; - default: puts ("hppa-hitachi-hiuxwe2"); break; - } - } - else if (CPU_IS_HP_MC68K (cpu)) - puts ("m68k-hitachi-hiuxwe2"); - else puts ("unknown-hitachi-hiuxwe2"); - exit (0); - } -EOF - $CC_FOR_BUILD -o $dummy $dummy.c && $dummy && exit 0 - echo unknown-hitachi-hiuxwe2 - exit 0 ;; - 9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* ) - echo hppa1.1-hp-bsd - exit 0 ;; - 9000/8??:4.3bsd:*:*) - echo hppa1.0-hp-bsd - exit 0 ;; - *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*) - echo hppa1.0-hp-mpeix - exit 0 ;; - hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* ) - echo hppa1.1-hp-osf - exit 0 ;; - hp8??:OSF1:*:*) - echo hppa1.0-hp-osf - exit 0 ;; - i*86:OSF1:*:*) - if [ -x /usr/sbin/sysversion ] ; then - echo ${UNAME_MACHINE}-unknown-osf1mk - else - echo ${UNAME_MACHINE}-unknown-osf1 - fi - exit 0 ;; - parisc*:Lites*:*:*) - echo hppa1.1-hp-lites - exit 0 ;; - C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*) - echo c1-convex-bsd - exit 0 ;; - C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*) - if getsysinfo -f scalar_acc - then echo c32-convex-bsd - else echo c2-convex-bsd - fi - exit 0 ;; - C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*) - echo c34-convex-bsd - exit 0 ;; - C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*) - echo c38-convex-bsd - exit 0 ;; - C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*) - echo c4-convex-bsd - exit 0 ;; - CRAY*Y-MP:*:*:*) - echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' - exit 0 ;; - CRAY*[A-Z]90:*:*:*) - echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \ - | sed -e 's/CRAY.*\([A-Z]90\)/\1/' \ - -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \ - -e 's/\.[^.]*$/.X/' - exit 0 ;; - CRAY*TS:*:*:*) - echo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' - exit 0 ;; - CRAY*T3E:*:*:*) - echo alphaev5-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' - exit 0 ;; - CRAY*SV1:*:*:*) - echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' - exit 0 ;; - *:UNICOS/mp:*:*) - echo nv1-cray-unicosmp${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' - exit 0 ;; - F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*) - FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` - FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` - FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'` - echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" - exit 0 ;; - 5000:UNIX_System_V:4.*:*) - FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` - FUJITSU_REL=`echo ${UNAME_RELEASE} | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/ /_/'` - echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" - exit 0 ;; - i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*) - echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE} - exit 0 ;; - sparc*:BSD/OS:*:*) - echo sparc-unknown-bsdi${UNAME_RELEASE} - exit 0 ;; - *:BSD/OS:*:*) - echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE} - exit 0 ;; - *:FreeBSD:*:*) - # Determine whether the default compiler uses glibc. - eval $set_cc_for_build - sed 's/^ //' << EOF >$dummy.c - #include - #if __GLIBC__ >= 2 - LIBC=gnu - #else - LIBC= - #endif -EOF - eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^LIBC=` - # GNU/KFreeBSD systems have a "k" prefix to indicate we are using - # FreeBSD's kernel, but not the complete OS. - case ${LIBC} in gnu) kernel_only='k' ;; esac - echo ${UNAME_MACHINE}-unknown-${kernel_only}freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`${LIBC:+-$LIBC} - exit 0 ;; - i*:CYGWIN*:*) - echo ${UNAME_MACHINE}-pc-cygwin - exit 0 ;; - i*:MINGW*:*) - echo ${UNAME_MACHINE}-pc-mingw32 - exit 0 ;; - i*:PW*:*) - echo ${UNAME_MACHINE}-pc-pw32 - exit 0 ;; - x86:Interix*:[34]*) - echo i586-pc-interix${UNAME_RELEASE}|sed -e 's/\..*//' - exit 0 ;; - [345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*) - echo i${UNAME_MACHINE}-pc-mks - exit 0 ;; - i*:Windows_NT*:* | Pentium*:Windows_NT*:*) - # How do we know it's Interix rather than the generic POSIX subsystem? - # It also conflicts with pre-2.0 versions of AT&T UWIN. Should we - # UNAME_MACHINE based on the output of uname instead of i386? - echo i586-pc-interix - exit 0 ;; - i*:UWIN*:*) - echo ${UNAME_MACHINE}-pc-uwin - exit 0 ;; - p*:CYGWIN*:*) - echo powerpcle-unknown-cygwin - exit 0 ;; - prep*:SunOS:5.*:*) - echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` - exit 0 ;; - *:GNU:*:*) - # the GNU system - echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'` - exit 0 ;; - *:GNU/*:*:*) - # other systems with GNU libc and userland - echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-gnu - exit 0 ;; - i*86:Minix:*:*) - echo ${UNAME_MACHINE}-pc-minix - exit 0 ;; - arm*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu - exit 0 ;; - cris:Linux:*:*) - echo cris-axis-linux-gnu - exit 0 ;; - ia64:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu - exit 0 ;; - m32r*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu - exit 0 ;; - m68*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu - exit 0 ;; - mips:Linux:*:*) - eval $set_cc_for_build - sed 's/^ //' << EOF >$dummy.c - #undef CPU - #undef mips - #undef mipsel - #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL) - CPU=mipsel - #else - #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB) - CPU=mips - #else - CPU= - #endif - #endif -EOF - eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^CPU=` - test x"${CPU}" != x && echo "${CPU}-unknown-linux-gnu" && exit 0 - ;; - mips64:Linux:*:*) - eval $set_cc_for_build - sed 's/^ //' << EOF >$dummy.c - #undef CPU - #undef mips64 - #undef mips64el - #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL) - CPU=mips64el - #else - #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB) - CPU=mips64 - #else - CPU= - #endif - #endif -EOF - eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^CPU=` - test x"${CPU}" != x && echo "${CPU}-unknown-linux-gnu" && exit 0 - ;; - ppc:Linux:*:*) - echo powerpc-unknown-linux-gnu - exit 0 ;; - ppc64:Linux:*:*) - echo powerpc64-unknown-linux-gnu - exit 0 ;; - alpha:Linux:*:*) - case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in - EV5) UNAME_MACHINE=alphaev5 ;; - EV56) UNAME_MACHINE=alphaev56 ;; - PCA56) UNAME_MACHINE=alphapca56 ;; - PCA57) UNAME_MACHINE=alphapca56 ;; - EV6) UNAME_MACHINE=alphaev6 ;; - EV67) UNAME_MACHINE=alphaev67 ;; - EV68*) UNAME_MACHINE=alphaev68 ;; - esac - objdump --private-headers /bin/sh | grep ld.so.1 >/dev/null - if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi - echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC} - exit 0 ;; - parisc:Linux:*:* | hppa:Linux:*:*) - # Look for CPU level - case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in - PA7*) echo hppa1.1-unknown-linux-gnu ;; - PA8*) echo hppa2.0-unknown-linux-gnu ;; - *) echo hppa-unknown-linux-gnu ;; - esac - exit 0 ;; - parisc64:Linux:*:* | hppa64:Linux:*:*) - echo hppa64-unknown-linux-gnu - exit 0 ;; - s390:Linux:*:* | s390x:Linux:*:*) - echo ${UNAME_MACHINE}-ibm-linux - exit 0 ;; - sh64*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu - exit 0 ;; - sh*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu - exit 0 ;; - sparc:Linux:*:* | sparc64:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu - exit 0 ;; - x86_64:Linux:*:*) - echo x86_64-unknown-linux-gnu - exit 0 ;; - i*86:Linux:*:*) - # The BFD linker knows what the default object file format is, so - # first see if it will tell us. cd to the root directory to prevent - # problems with other programs or directories called `ld' in the path. - # Set LC_ALL=C to ensure ld outputs messages in English. - ld_supported_targets=`cd /; LC_ALL=C ld --help 2>&1 \ - | sed -ne '/supported targets:/!d - s/[ ][ ]*/ /g - s/.*supported targets: *// - s/ .*// - p'` - case "$ld_supported_targets" in - elf32-i386) - TENTATIVE="${UNAME_MACHINE}-pc-linux-gnu" - ;; - a.out-i386-linux) - echo "${UNAME_MACHINE}-pc-linux-gnuaout" - exit 0 ;; - coff-i386) - echo "${UNAME_MACHINE}-pc-linux-gnucoff" - exit 0 ;; - "") - # Either a pre-BFD a.out linker (linux-gnuoldld) or - # one that does not give us useful --help. - echo "${UNAME_MACHINE}-pc-linux-gnuoldld" - exit 0 ;; - esac - # Determine whether the default compiler is a.out or elf - eval $set_cc_for_build - sed 's/^ //' << EOF >$dummy.c - #include - #ifdef __ELF__ - # ifdef __GLIBC__ - # if __GLIBC__ >= 2 - LIBC=gnu - # else - LIBC=gnulibc1 - # endif - # else - LIBC=gnulibc1 - # endif - #else - #ifdef __INTEL_COMPILER - LIBC=gnu - #else - LIBC=gnuaout - #endif - #endif - #ifdef __dietlibc__ - LIBC=dietlibc - #endif -EOF - eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^LIBC=` - test x"${LIBC}" != x && echo "${UNAME_MACHINE}-pc-linux-${LIBC}" && exit 0 - test x"${TENTATIVE}" != x && echo "${TENTATIVE}" && exit 0 - ;; - i*86:DYNIX/ptx:4*:*) - # ptx 4.0 does uname -s correctly, with DYNIX/ptx in there. - # earlier versions are messed up and put the nodename in both - # sysname and nodename. - echo i386-sequent-sysv4 - exit 0 ;; - i*86:UNIX_SV:4.2MP:2.*) - # Unixware is an offshoot of SVR4, but it has its own version - # number series starting with 2... - # I am not positive that other SVR4 systems won't match this, - # I just have to hope. -- rms. - # Use sysv4.2uw... so that sysv4* matches it. - echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION} - exit 0 ;; - i*86:OS/2:*:*) - # If we were able to find `uname', then EMX Unix compatibility - # is probably installed. - echo ${UNAME_MACHINE}-pc-os2-emx - exit 0 ;; - i*86:XTS-300:*:STOP) - echo ${UNAME_MACHINE}-unknown-stop - exit 0 ;; - i*86:atheos:*:*) - echo ${UNAME_MACHINE}-unknown-atheos - exit 0 ;; - i*86:syllable:*:*) - echo ${UNAME_MACHINE}-pc-syllable - exit 0 ;; - i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.0*:*) - echo i386-unknown-lynxos${UNAME_RELEASE} - exit 0 ;; - i*86:*DOS:*:*) - echo ${UNAME_MACHINE}-pc-msdosdjgpp - exit 0 ;; - i*86:*:4.*:* | i*86:SYSTEM_V:4.*:*) - UNAME_REL=`echo ${UNAME_RELEASE} | sed 's/\/MP$//'` - if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then - echo ${UNAME_MACHINE}-univel-sysv${UNAME_REL} - else - echo ${UNAME_MACHINE}-pc-sysv${UNAME_REL} - fi - exit 0 ;; - i*86:*:5:[78]*) - case `/bin/uname -X | grep "^Machine"` in - *486*) UNAME_MACHINE=i486 ;; - *Pentium) UNAME_MACHINE=i586 ;; - *Pent*|*Celeron) UNAME_MACHINE=i686 ;; - esac - echo ${UNAME_MACHINE}-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION} - exit 0 ;; - i*86:*:3.2:*) - if test -f /usr/options/cb.name; then - UNAME_REL=`sed -n 's/.*Version //p' /dev/null >/dev/null ; then - UNAME_REL=`(/bin/uname -X|grep Release|sed -e 's/.*= //')` - (/bin/uname -X|grep i80486 >/dev/null) && UNAME_MACHINE=i486 - (/bin/uname -X|grep '^Machine.*Pentium' >/dev/null) \ - && UNAME_MACHINE=i586 - (/bin/uname -X|grep '^Machine.*Pent *II' >/dev/null) \ - && UNAME_MACHINE=i686 - (/bin/uname -X|grep '^Machine.*Pentium Pro' >/dev/null) \ - && UNAME_MACHINE=i686 - echo ${UNAME_MACHINE}-pc-sco$UNAME_REL - else - echo ${UNAME_MACHINE}-pc-sysv32 - fi - exit 0 ;; - pc:*:*:*) - # Left here for compatibility: - # uname -m prints for DJGPP always 'pc', but it prints nothing about - # the processor, so we play safe by assuming i386. - echo i386-pc-msdosdjgpp - exit 0 ;; - Intel:Mach:3*:*) - echo i386-pc-mach3 - exit 0 ;; - paragon:*:*:*) - echo i860-intel-osf1 - exit 0 ;; - i860:*:4.*:*) # i860-SVR4 - if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then - echo i860-stardent-sysv${UNAME_RELEASE} # Stardent Vistra i860-SVR4 - else # Add other i860-SVR4 vendors below as they are discovered. - echo i860-unknown-sysv${UNAME_RELEASE} # Unknown i860-SVR4 - fi - exit 0 ;; - mini*:CTIX:SYS*5:*) - # "miniframe" - echo m68010-convergent-sysv - exit 0 ;; - mc68k:UNIX:SYSTEM5:3.51m) - echo m68k-convergent-sysv - exit 0 ;; - M680?0:D-NIX:5.3:*) - echo m68k-diab-dnix - exit 0 ;; - M68*:*:R3V[567]*:*) - test -r /sysV68 && echo 'm68k-motorola-sysv' && exit 0 ;; - 3[345]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0 | SDS2:*:4.0:3.0 | SHG2:*:4.0:3.0) - OS_REL='' - test -r /etc/.relid \ - && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` - /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ - && echo i486-ncr-sysv4.3${OS_REL} && exit 0 - /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ - && echo i586-ncr-sysv4.3${OS_REL} && exit 0 ;; - 3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*) - /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ - && echo i486-ncr-sysv4 && exit 0 ;; - m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*) - echo m68k-unknown-lynxos${UNAME_RELEASE} - exit 0 ;; - mc68030:UNIX_System_V:4.*:*) - echo m68k-atari-sysv4 - exit 0 ;; - TSUNAMI:LynxOS:2.*:*) - echo sparc-unknown-lynxos${UNAME_RELEASE} - exit 0 ;; - rs6000:LynxOS:2.*:*) - echo rs6000-unknown-lynxos${UNAME_RELEASE} - exit 0 ;; - PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.0*:*) - echo powerpc-unknown-lynxos${UNAME_RELEASE} - exit 0 ;; - SM[BE]S:UNIX_SV:*:*) - echo mips-dde-sysv${UNAME_RELEASE} - exit 0 ;; - RM*:ReliantUNIX-*:*:*) - echo mips-sni-sysv4 - exit 0 ;; - RM*:SINIX-*:*:*) - echo mips-sni-sysv4 - exit 0 ;; - *:SINIX-*:*:*) - if uname -p 2>/dev/null >/dev/null ; then - UNAME_MACHINE=`(uname -p) 2>/dev/null` - echo ${UNAME_MACHINE}-sni-sysv4 - else - echo ns32k-sni-sysv - fi - exit 0 ;; - PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort - # says - echo i586-unisys-sysv4 - exit 0 ;; - *:UNIX_System_V:4*:FTX*) - # From Gerald Hewes . - # How about differentiating between stratus architectures? -djm - echo hppa1.1-stratus-sysv4 - exit 0 ;; - *:*:*:FTX*) - # From seanf@swdc.stratus.com. - echo i860-stratus-sysv4 - exit 0 ;; - *:VOS:*:*) - # From Paul.Green@stratus.com. - echo hppa1.1-stratus-vos - exit 0 ;; - mc68*:A/UX:*:*) - echo m68k-apple-aux${UNAME_RELEASE} - exit 0 ;; - news*:NEWS-OS:6*:*) - echo mips-sony-newsos6 - exit 0 ;; - R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*) - if [ -d /usr/nec ]; then - echo mips-nec-sysv${UNAME_RELEASE} - else - echo mips-unknown-sysv${UNAME_RELEASE} - fi - exit 0 ;; - BeBox:BeOS:*:*) # BeOS running on hardware made by Be, PPC only. - echo powerpc-be-beos - exit 0 ;; - BeMac:BeOS:*:*) # BeOS running on Mac or Mac clone, PPC only. - echo powerpc-apple-beos - exit 0 ;; - BePC:BeOS:*:*) # BeOS running on Intel PC compatible. - echo i586-pc-beos - exit 0 ;; - SX-4:SUPER-UX:*:*) - echo sx4-nec-superux${UNAME_RELEASE} - exit 0 ;; - SX-5:SUPER-UX:*:*) - echo sx5-nec-superux${UNAME_RELEASE} - exit 0 ;; - SX-6:SUPER-UX:*:*) - echo sx6-nec-superux${UNAME_RELEASE} - exit 0 ;; - Power*:Rhapsody:*:*) - echo powerpc-apple-rhapsody${UNAME_RELEASE} - exit 0 ;; - *:Rhapsody:*:*) - echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE} - exit 0 ;; - *:Darwin:*:*) - case `uname -p` in - *86) UNAME_PROCESSOR=i686 ;; - powerpc) UNAME_PROCESSOR=powerpc ;; - esac - echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE} - exit 0 ;; - *:procnto*:*:* | *:QNX:[0123456789]*:*) - UNAME_PROCESSOR=`uname -p` - if test "$UNAME_PROCESSOR" = "x86"; then - UNAME_PROCESSOR=i386 - UNAME_MACHINE=pc - fi - echo ${UNAME_PROCESSOR}-${UNAME_MACHINE}-nto-qnx${UNAME_RELEASE} - exit 0 ;; - *:QNX:*:4*) - echo i386-pc-qnx - exit 0 ;; - NSR-?:NONSTOP_KERNEL:*:*) - echo nsr-tandem-nsk${UNAME_RELEASE} - exit 0 ;; - *:NonStop-UX:*:*) - echo mips-compaq-nonstopux - exit 0 ;; - BS2000:POSIX*:*:*) - echo bs2000-siemens-sysv - exit 0 ;; - DS/*:UNIX_System_V:*:*) - echo ${UNAME_MACHINE}-${UNAME_SYSTEM}-${UNAME_RELEASE} - exit 0 ;; - *:Plan9:*:*) - # "uname -m" is not consistent, so use $cputype instead. 386 - # is converted to i386 for consistency with other x86 - # operating systems. - if test "$cputype" = "386"; then - UNAME_MACHINE=i386 - else - UNAME_MACHINE="$cputype" - fi - echo ${UNAME_MACHINE}-unknown-plan9 - exit 0 ;; - *:TOPS-10:*:*) - echo pdp10-unknown-tops10 - exit 0 ;; - *:TENEX:*:*) - echo pdp10-unknown-tenex - exit 0 ;; - KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*) - echo pdp10-dec-tops20 - exit 0 ;; - XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*) - echo pdp10-xkl-tops20 - exit 0 ;; - *:TOPS-20:*:*) - echo pdp10-unknown-tops20 - exit 0 ;; - *:ITS:*:*) - echo pdp10-unknown-its - exit 0 ;; - SEI:*:*:SEIUX) - echo mips-sei-seiux${UNAME_RELEASE} - exit 0 ;; - *:DragonFly:*:*) - echo ${UNAME_MACHINE}-unknown-dragonfly`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` - exit 0 ;; -esac - -#echo '(No uname command or uname output not recognized.)' 1>&2 -#echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2 - -eval $set_cc_for_build -cat >$dummy.c < -# include -#endif -main () -{ -#if defined (sony) -#if defined (MIPSEB) - /* BFD wants "bsd" instead of "newsos". Perhaps BFD should be changed, - I don't know.... */ - printf ("mips-sony-bsd\n"); exit (0); -#else -#include - printf ("m68k-sony-newsos%s\n", -#ifdef NEWSOS4 - "4" -#else - "" -#endif - ); exit (0); -#endif -#endif - -#if defined (__arm) && defined (__acorn) && defined (__unix) - printf ("arm-acorn-riscix"); exit (0); -#endif - -#if defined (hp300) && !defined (hpux) - printf ("m68k-hp-bsd\n"); exit (0); -#endif - -#if defined (NeXT) -#if !defined (__ARCHITECTURE__) -#define __ARCHITECTURE__ "m68k" -#endif - int version; - version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`; - if (version < 4) - printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version); - else - printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version); - exit (0); -#endif - -#if defined (MULTIMAX) || defined (n16) -#if defined (UMAXV) - printf ("ns32k-encore-sysv\n"); exit (0); -#else -#if defined (CMU) - printf ("ns32k-encore-mach\n"); exit (0); -#else - printf ("ns32k-encore-bsd\n"); exit (0); -#endif -#endif -#endif - -#if defined (__386BSD__) - printf ("i386-pc-bsd\n"); exit (0); -#endif - -#if defined (sequent) -#if defined (i386) - printf ("i386-sequent-dynix\n"); exit (0); -#endif -#if defined (ns32000) - printf ("ns32k-sequent-dynix\n"); exit (0); -#endif -#endif - -#if defined (_SEQUENT_) - struct utsname un; - - uname(&un); - - if (strncmp(un.version, "V2", 2) == 0) { - printf ("i386-sequent-ptx2\n"); exit (0); - } - if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */ - printf ("i386-sequent-ptx1\n"); exit (0); - } - printf ("i386-sequent-ptx\n"); exit (0); - -#endif - -#if defined (vax) -# if !defined (ultrix) -# include -# if defined (BSD) -# if BSD == 43 - printf ("vax-dec-bsd4.3\n"); exit (0); -# else -# if BSD == 199006 - printf ("vax-dec-bsd4.3reno\n"); exit (0); -# else - printf ("vax-dec-bsd\n"); exit (0); -# endif -# endif -# else - printf ("vax-dec-bsd\n"); exit (0); -# endif -# else - printf ("vax-dec-ultrix\n"); exit (0); -# endif -#endif - -#if defined (alliant) && defined (i860) - printf ("i860-alliant-bsd\n"); exit (0); -#endif - - exit (1); -} -EOF - -$CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null && $dummy && exit 0 - -# Apollos put the system type in the environment. - -test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit 0; } - -# Convex versions that predate uname can use getsysinfo(1) - -if [ -x /usr/convex/getsysinfo ] -then - case `getsysinfo -f cpu_type` in - c1*) - echo c1-convex-bsd - exit 0 ;; - c2*) - if getsysinfo -f scalar_acc - then echo c32-convex-bsd - else echo c2-convex-bsd - fi - exit 0 ;; - c34*) - echo c34-convex-bsd - exit 0 ;; - c38*) - echo c38-convex-bsd - exit 0 ;; - c4*) - echo c4-convex-bsd - exit 0 ;; - esac -fi - -cat >&2 < in order to provide the needed -information to handle your system. - -config.guess timestamp = $timestamp - -uname -m = `(uname -m) 2>/dev/null || echo unknown` -uname -r = `(uname -r) 2>/dev/null || echo unknown` -uname -s = `(uname -s) 2>/dev/null || echo unknown` -uname -v = `(uname -v) 2>/dev/null || echo unknown` - -/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null` -/bin/uname -X = `(/bin/uname -X) 2>/dev/null` - -hostinfo = `(hostinfo) 2>/dev/null` -/bin/universe = `(/bin/universe) 2>/dev/null` -/usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null` -/bin/arch = `(/bin/arch) 2>/dev/null` -/usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null` -/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null` - -UNAME_MACHINE = ${UNAME_MACHINE} -UNAME_RELEASE = ${UNAME_RELEASE} -UNAME_SYSTEM = ${UNAME_SYSTEM} -UNAME_VERSION = ${UNAME_VERSION} -EOF - -exit 1 - -# Local variables: -# eval: (add-hook 'write-file-hooks 'time-stamp) -# time-stamp-start: "timestamp='" -# time-stamp-format: "%:y-%02m-%02d" -# time-stamp-end: "'" -# End: diff --git a/src/bin/bison/config/config.rpath b/src/bin/bison/config/config.rpath deleted file mode 100644 index 4db13e50f6..0000000000 --- a/src/bin/bison/config/config.rpath +++ /dev/null @@ -1,548 +0,0 @@ -#! /bin/sh -# Output a system dependent set of variables, describing how to set the -# run time search path of shared libraries in an executable. -# -# Copyright 1996-2003 Free Software Foundation, Inc. -# Taken from GNU libtool, 2001 -# Originally by Gordon Matzigkeit , 1996 -# -# 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 2 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, write to the Free Software -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -# -# As a special exception to the GNU General Public License, if you -# distribute this file as part of a program that contains a -# configuration script generated by Autoconf, you may include it under -# the same distribution terms that you use for the rest of that program. -# -# The first argument passed to this file is the canonical host specification, -# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM -# or -# CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM -# The environment variables CC, GCC, LDFLAGS, LD, with_gnu_ld -# should be set by the caller. -# -# The set of defined variables is at the end of this script. - -# Known limitations: -# - On IRIX 6.5 with CC="cc", the run time search patch must not be longer -# than 256 bytes, otherwise the compiler driver will dump core. The only -# known workaround is to choose shorter directory names for the build -# directory and/or the installation directory. - -# All known linkers require a `.a' archive for static linking (except M$VC, -# which needs '.lib'). -libext=a -shrext=.so - -host="$1" -host_cpu=`echo "$host" | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` -host_vendor=`echo "$host" | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'` -host_os=`echo "$host" | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` - -# Code taken from libtool.m4's AC_LIBTOOL_PROG_COMPILER_PIC. - -wl= -if test "$GCC" = yes; then - wl='-Wl,' -else - case "$host_os" in - aix*) - wl='-Wl,' - ;; - mingw* | pw32* | os2*) - ;; - hpux9* | hpux10* | hpux11*) - wl='-Wl,' - ;; - irix5* | irix6* | nonstopux*) - wl='-Wl,' - ;; - newsos6) - ;; - linux*) - case $CC in - icc|ecc) - wl='-Wl,' - ;; - ccc) - wl='-Wl,' - ;; - esac - ;; - osf3* | osf4* | osf5*) - wl='-Wl,' - ;; - sco3.2v5*) - ;; - solaris*) - wl='-Wl,' - ;; - sunos4*) - wl='-Qoption ld ' - ;; - sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) - wl='-Wl,' - ;; - sysv4*MP*) - ;; - uts4*) - ;; - esac -fi - -# Code taken from libtool.m4's AC_LIBTOOL_PROG_LD_SHLIBS. - -hardcode_libdir_flag_spec= -hardcode_libdir_separator= -hardcode_direct=no -hardcode_minus_L=no - -case "$host_os" in - cygwin* | mingw* | pw32*) - # FIXME: the MSVC++ port hasn't been tested in a loooong time - # When not using gcc, we currently assume that we are using - # Microsoft Visual C++. - if test "$GCC" != yes; then - with_gnu_ld=no - fi - ;; - openbsd*) - with_gnu_ld=no - ;; -esac - -ld_shlibs=yes -if test "$with_gnu_ld" = yes; then - case "$host_os" in - aix3* | aix4* | aix5*) - # On AIX/PPC, the GNU linker is very broken - if test "$host_cpu" != ia64; then - ld_shlibs=no - fi - ;; - amigaos*) - hardcode_libdir_flag_spec='-L$libdir' - hardcode_minus_L=yes - # Samuel A. Falvo II reports - # that the semantics of dynamic libraries on AmigaOS, at least up - # to version 4, is to share data among multiple programs linked - # with the same dynamic library. Since this doesn't match the - # behavior of shared libraries on other platforms, we can use - # them. - ld_shlibs=no - ;; - beos*) - if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then - : - else - ld_shlibs=no - fi - ;; - cygwin* | mingw* | pw32*) - # hardcode_libdir_flag_spec is actually meaningless, as there is - # no search path for DLLs. - hardcode_libdir_flag_spec='-L$libdir' - if $LD --help 2>&1 | grep 'auto-import' > /dev/null; then - : - else - ld_shlibs=no - fi - ;; - netbsd*) - ;; - solaris* | sysv5*) - if $LD -v 2>&1 | grep 'BFD 2\.8' > /dev/null; then - ld_shlibs=no - elif $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then - : - else - ld_shlibs=no - fi - ;; - sunos4*) - hardcode_direct=yes - ;; - *) - if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then - : - else - ld_shlibs=no - fi - ;; - esac - if test "$ld_shlibs" = yes; then - # Unlike libtool, we use -rpath here, not --rpath, since the documented - # option of GNU ld is called -rpath, not --rpath. - hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' - fi -else - case "$host_os" in - aix3*) - # Note: this linker hardcodes the directories in LIBPATH if there - # are no directories specified by -L. - hardcode_minus_L=yes - if test "$GCC" = yes; then - # Neither direct hardcoding nor static linking is supported with a - # broken collect2. - hardcode_direct=unsupported - fi - ;; - aix4* | aix5*) - if test "$host_cpu" = ia64; then - # On IA64, the linker does run time linking by default, so we don't - # have to do anything special. - aix_use_runtimelinking=no - else - aix_use_runtimelinking=no - # Test if we are trying to use run time linking or normal - # AIX style linking. If -brtl is somewhere in LDFLAGS, we - # need to do runtime linking. - case $host_os in aix4.[23]|aix4.[23].*|aix5*) - for ld_flag in $LDFLAGS; do - if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then - aix_use_runtimelinking=yes - break - fi - done - esac - fi - hardcode_direct=yes - hardcode_libdir_separator=':' - if test "$GCC" = yes; then - case $host_os in aix4.[012]|aix4.[012].*) - collect2name=`${CC} -print-prog-name=collect2` - if test -f "$collect2name" && \ - strings "$collect2name" | grep resolve_lib_name >/dev/null - then - # We have reworked collect2 - hardcode_direct=yes - else - # We have old collect2 - hardcode_direct=unsupported - hardcode_minus_L=yes - hardcode_libdir_flag_spec='-L$libdir' - hardcode_libdir_separator= - fi - esac - fi - # Begin _LT_AC_SYS_LIBPATH_AIX. - echo 'int main () { return 0; }' > conftest.c - ${CC} ${LDFLAGS} conftest.c -o conftest - aix_libpath=`dump -H conftest 2>/dev/null | sed -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } -}'` - if test -z "$aix_libpath"; then - aix_libpath=`dump -HX64 conftest 2>/dev/null | sed -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } -}'` - fi - if test -z "$aix_libpath"; then - aix_libpath="/usr/lib:/lib" - fi - rm -f conftest.c conftest - # End _LT_AC_SYS_LIBPATH_AIX. - if test "$aix_use_runtimelinking" = yes; then - hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath" - else - if test "$host_cpu" = ia64; then - hardcode_libdir_flag_spec='${wl}-R $libdir:/usr/lib:/lib' - else - hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath" - fi - fi - ;; - amigaos*) - hardcode_libdir_flag_spec='-L$libdir' - hardcode_minus_L=yes - # see comment about different semantics on the GNU ld section - ld_shlibs=no - ;; - bsdi4*) - ;; - cygwin* | mingw* | pw32*) - # When not using gcc, we currently assume that we are using - # Microsoft Visual C++. - # hardcode_libdir_flag_spec is actually meaningless, as there is - # no search path for DLLs. - hardcode_libdir_flag_spec=' ' - libext=lib - ;; - darwin* | rhapsody*) - if $CC -v 2>&1 | grep 'Apple' >/dev/null ; then - hardcode_direct=no - fi - ;; - dgux*) - hardcode_libdir_flag_spec='-L$libdir' - ;; - freebsd1*) - ld_shlibs=no - ;; - freebsd2.2*) - hardcode_libdir_flag_spec='-R$libdir' - hardcode_direct=yes - ;; - freebsd2*) - hardcode_direct=yes - hardcode_minus_L=yes - ;; - freebsd*) - hardcode_libdir_flag_spec='-R$libdir' - hardcode_direct=yes - ;; - hpux9*) - hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir' - hardcode_libdir_separator=: - hardcode_direct=yes - # hardcode_minus_L: Not really in the search PATH, - # but as the default location of the library. - hardcode_minus_L=yes - ;; - hpux10* | hpux11*) - if test "$with_gnu_ld" = no; then - case "$host_cpu" in - hppa*64*) - hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir' - hardcode_libdir_separator=: - hardcode_direct=no - ;; - ia64*) - hardcode_libdir_flag_spec='-L$libdir' - hardcode_direct=no - # hardcode_minus_L: Not really in the search PATH, - # but as the default location of the library. - hardcode_minus_L=yes - ;; - *) - hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir' - hardcode_libdir_separator=: - hardcode_direct=yes - # hardcode_minus_L: Not really in the search PATH, - # but as the default location of the library. - hardcode_minus_L=yes - ;; - esac - fi - ;; - irix5* | irix6* | nonstopux*) - hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' - hardcode_libdir_separator=: - ;; - netbsd*) - hardcode_libdir_flag_spec='-R$libdir' - hardcode_direct=yes - ;; - newsos6) - hardcode_direct=yes - hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' - hardcode_libdir_separator=: - ;; - openbsd*) - hardcode_direct=yes - if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then - hardcode_libdir_flag_spec='${wl}-rpath,$libdir' - else - case "$host_os" in - openbsd[01].* | openbsd2.[0-7] | openbsd2.[0-7].*) - hardcode_libdir_flag_spec='-R$libdir' - ;; - *) - hardcode_libdir_flag_spec='${wl}-rpath,$libdir' - ;; - esac - fi - ;; - os2*) - hardcode_libdir_flag_spec='-L$libdir' - hardcode_minus_L=yes - ;; - osf3*) - hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' - hardcode_libdir_separator=: - ;; - osf4* | osf5*) - if test "$GCC" = yes; then - hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' - else - # Both cc and cxx compiler support -rpath directly - hardcode_libdir_flag_spec='-rpath $libdir' - fi - hardcode_libdir_separator=: - ;; - sco3.2v5*) - ;; - solaris*) - hardcode_libdir_flag_spec='-R$libdir' - ;; - sunos4*) - hardcode_libdir_flag_spec='-L$libdir' - hardcode_direct=yes - hardcode_minus_L=yes - ;; - sysv4) - case $host_vendor in - sni) - hardcode_direct=yes # is this really true??? - ;; - siemens) - hardcode_direct=no - ;; - motorola) - hardcode_direct=no #Motorola manual says yes, but my tests say they lie - ;; - esac - ;; - sysv4.3*) - ;; - sysv4*MP*) - if test -d /usr/nec; then - ld_shlibs=yes - fi - ;; - sysv4.2uw2*) - hardcode_direct=yes - hardcode_minus_L=no - ;; - sysv5OpenUNIX8* | sysv5UnixWare7* | sysv5uw[78]* | unixware7*) - ;; - sysv5*) - hardcode_libdir_flag_spec= - ;; - uts4*) - hardcode_libdir_flag_spec='-L$libdir' - ;; - *) - ld_shlibs=no - ;; - esac -fi - -# Check dynamic linker characteristics -# Code taken from libtool.m4's AC_LIBTOOL_SYS_DYNAMIC_LINKER. -libname_spec='lib$name' -case "$host_os" in - aix3*) - ;; - aix4* | aix5*) - ;; - amigaos*) - ;; - beos*) - ;; - bsdi4*) - ;; - cygwin* | mingw* | pw32*) - shrext=.dll - ;; - darwin* | rhapsody*) - shrext=.dylib - ;; - dgux*) - ;; - freebsd1*) - ;; - freebsd*) - ;; - gnu*) - ;; - hpux9* | hpux10* | hpux11*) - case "$host_cpu" in - ia64*) - shrext=.so - ;; - hppa*64*) - shrext=.sl - ;; - *) - shrext=.sl - ;; - esac - ;; - irix5* | irix6* | nonstopux*) - case "$host_os" in - irix5* | nonstopux*) - libsuff= shlibsuff= - ;; - *) - case $LD in - *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ") libsuff= shlibsuff= ;; - *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ") libsuff=32 shlibsuff=N32 ;; - *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ") libsuff=64 shlibsuff=64 ;; - *) libsuff= shlibsuff= ;; - esac - ;; - esac - ;; - linux*oldld* | linux*aout* | linux*coff*) - ;; - linux*) - ;; - netbsd*) - ;; - newsos6) - ;; - nto-qnx) - ;; - openbsd*) - ;; - os2*) - libname_spec='$name' - shrext=.dll - ;; - osf3* | osf4* | osf5*) - ;; - sco3.2v5*) - ;; - solaris*) - ;; - sunos4*) - ;; - sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) - ;; - sysv4*MP*) - ;; - uts4*) - ;; -esac - -sed_quote_subst='s/\(["`$\\]\)/\\\1/g' -escaped_wl=`echo "X$wl" | sed -e 's/^X//' -e "$sed_quote_subst"` -shlibext=`echo "$shrext" | sed -e 's,^\.,,'` -escaped_hardcode_libdir_flag_spec=`echo "X$hardcode_libdir_flag_spec" | sed -e 's/^X//' -e "$sed_quote_subst"` - -sed -e 's/^\([a-zA-Z0-9_]*\)=/acl_cv_\1=/' <. Submit a context -# diff and a properly formatted ChangeLog entry. -# -# Configuration subroutine to validate and canonicalize a configuration type. -# Supply the specified configuration type as an argument. -# If it is invalid, we print an error message on stderr and exit with code 1. -# Otherwise, we print the canonical config type on stdout and succeed. - -# This file is supposed to be the same for all GNU packages -# and recognize all the CPU types, system types and aliases -# that are meaningful with *any* GNU software. -# Each package is responsible for reporting which valid configurations -# it does not support. The user should be able to distinguish -# a failure to support a valid configuration from a meaningless -# configuration. - -# The goal of this file is to map all the various variations of a given -# machine specification into a single specification in the form: -# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM -# or in some cases, the newer four-part form: -# CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM -# It is wrong to echo any other type of specification. - -me=`echo "$0" | sed -e 's,.*/,,'` - -usage="\ -Usage: $0 [OPTION] CPU-MFR-OPSYS - $0 [OPTION] ALIAS - -Canonicalize a configuration name. - -Operation modes: - -h, --help print this help, then exit - -t, --time-stamp print date of last modification, then exit - -v, --version print version number, then exit - -Report bugs and patches to ." - -version="\ -GNU config.sub ($timestamp) - -Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001 -Free Software Foundation, Inc. - -This is free software; see the source for copying conditions. There is NO -warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." - -help=" -Try \`$me --help' for more information." - -# Parse command line -while test $# -gt 0 ; do - case $1 in - --time-stamp | --time* | -t ) - echo "$timestamp" ; exit 0 ;; - --version | -v ) - echo "$version" ; exit 0 ;; - --help | --h* | -h ) - echo "$usage"; exit 0 ;; - -- ) # Stop option processing - shift; break ;; - - ) # Use stdin as input. - break ;; - -* ) - echo "$me: invalid option $1$help" - exit 1 ;; - - *local*) - # First pass through any local machine types. - echo $1 - exit 0;; - - * ) - break ;; - esac -done - -case $# in - 0) echo "$me: missing argument$help" >&2 - exit 1;; - 1) ;; - *) echo "$me: too many arguments$help" >&2 - exit 1;; -esac - -# Separate what the user gave into CPU-COMPANY and OS or KERNEL-OS (if any). -# Here we must recognize all the valid KERNEL-OS combinations. -maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'` -case $maybe_os in - nto-qnx* | linux-gnu* | linux-dietlibc | linux-uclibc* | uclinux-uclibc* | uclinux-gnu* | \ - kfreebsd*-gnu* | knetbsd*-gnu* | netbsd*-gnu* | storm-chaos* | os2-emx* | rtmk-nova*) - os=-$maybe_os - basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'` - ;; - *) - basic_machine=`echo $1 | sed 's/-[^-]*$//'` - if [ $basic_machine != $1 ] - then os=`echo $1 | sed 's/.*-/-/'` - else os=; fi - ;; -esac - -### Let's recognize common machines as not being operating systems so -### that things like config.sub decstation-3100 work. We also -### recognize some manufacturers as not being operating systems, so we -### can provide default operating systems below. -case $os in - -sun*os*) - # Prevent following clause from handling this invalid input. - ;; - -dec* | -mips* | -sequent* | -encore* | -pc532* | -sgi* | -sony* | \ - -att* | -7300* | -3300* | -delta* | -motorola* | -sun[234]* | \ - -unicom* | -ibm* | -next | -hp | -isi* | -apollo | -altos* | \ - -convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\ - -c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \ - -harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \ - -apple | -axis) - os= - basic_machine=$1 - ;; - -sim | -cisco | -oki | -wec | -winbond) - os= - basic_machine=$1 - ;; - -scout) - ;; - -wrs) - os=-vxworks - basic_machine=$1 - ;; - -chorusos*) - os=-chorusos - basic_machine=$1 - ;; - -chorusrdb) - os=-chorusrdb - basic_machine=$1 - ;; - -hiux*) - os=-hiuxwe2 - ;; - -sco5) - os=-sco3.2v5 - basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` - ;; - -sco4) - os=-sco3.2v4 - basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` - ;; - -sco3.2.[4-9]*) - os=`echo $os | sed -e 's/sco3.2./sco3.2v/'` - basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` - ;; - -sco3.2v[4-9]*) - # Don't forget version if it is 3.2v4 or newer. - basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` - ;; - -sco*) - os=-sco3.2v2 - basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` - ;; - -udk*) - basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` - ;; - -isc) - os=-isc2.2 - basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` - ;; - -clix*) - basic_machine=clipper-intergraph - ;; - -isc*) - basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` - ;; - -lynx*) - os=-lynxos - ;; - -ptx*) - basic_machine=`echo $1 | sed -e 's/86-.*/86-sequent/'` - ;; - -windowsnt*) - os=`echo $os | sed -e 's/windowsnt/winnt/'` - ;; - -psos*) - os=-psos - ;; - -mint | -mint[0-9]*) - basic_machine=m68k-atari - os=-mint - ;; -esac - -# Decode aliases for certain CPU-COMPANY combinations. -case $basic_machine in - # Recognize the basic CPU types without company name. - # Some are omitted here because they have special meanings below. - 1750a | 580 \ - | a29k \ - | alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \ - | alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \ - | am33_2.0 \ - | arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr \ - | c4x | clipper \ - | d10v | d30v | dlx | dsp16xx \ - | fr30 | frv \ - | h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \ - | i370 | i860 | i960 | ia64 \ - | ip2k | iq2000 \ - | m32r | m32rle | m68000 | m68k | m88k | mcore \ - | mips | mipsbe | mipseb | mipsel | mipsle \ - | mips16 \ - | mips64 | mips64el \ - | mips64vr | mips64vrel \ - | mips64orion | mips64orionel \ - | mips64vr4100 | mips64vr4100el \ - | mips64vr4300 | mips64vr4300el \ - | mips64vr5000 | mips64vr5000el \ - | mipsisa32 | mipsisa32el \ - | mipsisa32r2 | mipsisa32r2el \ - | mipsisa64 | mipsisa64el \ - | mipsisa64r2 | mipsisa64r2el \ - | mipsisa64sb1 | mipsisa64sb1el \ - | mipsisa64sr71k | mipsisa64sr71kel \ - | mipstx39 | mipstx39el \ - | mn10200 | mn10300 \ - | msp430 \ - | ns16k | ns32k \ - | openrisc | or32 \ - | pdp10 | pdp11 | pj | pjl \ - | powerpc | powerpc64 | powerpc64le | powerpcle | ppcbe \ - | pyramid \ - | sh | sh[1234] | sh[23]e | sh[34]eb | shbe | shle | sh[1234]le | sh3ele \ - | sh64 | sh64le \ - | sparc | sparc64 | sparc86x | sparclet | sparclite | sparcv8 | sparcv9 | sparcv9b \ - | strongarm \ - | tahoe | thumb | tic4x | tic80 | tron \ - | v850 | v850e \ - | we32k \ - | x86 | xscale | xstormy16 | xtensa \ - | z8k) - basic_machine=$basic_machine-unknown - ;; - m6811 | m68hc11 | m6812 | m68hc12) - # Motorola 68HC11/12. - basic_machine=$basic_machine-unknown - os=-none - ;; - m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | v70 | w65 | z8k) - ;; - - # We use `pc' rather than `unknown' - # because (1) that's what they normally are, and - # (2) the word "unknown" tends to confuse beginning users. - i*86 | x86_64) - basic_machine=$basic_machine-pc - ;; - # Object if more than one company name word. - *-*-*) - echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 - exit 1 - ;; - # Recognize the basic CPU types with company name. - 580-* \ - | a29k-* \ - | alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \ - | alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \ - | alphapca5[67]-* | alpha64pca5[67]-* | arc-* \ - | arm-* | armbe-* | armle-* | armeb-* | armv*-* \ - | avr-* \ - | bs2000-* \ - | c[123]* | c30-* | [cjt]90-* | c4x-* | c54x-* | c55x-* | c6x-* \ - | clipper-* | cydra-* \ - | d10v-* | d30v-* | dlx-* \ - | elxsi-* \ - | f30[01]-* | f700-* | fr30-* | frv-* | fx80-* \ - | h8300-* | h8500-* \ - | hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \ - | i*86-* | i860-* | i960-* | ia64-* \ - | ip2k-* | iq2000-* \ - | m32r-* | m32rle-* \ - | m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \ - | m88110-* | m88k-* | mcore-* \ - | mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \ - | mips16-* \ - | mips64-* | mips64el-* \ - | mips64vr-* | mips64vrel-* \ - | mips64orion-* | mips64orionel-* \ - | mips64vr4100-* | mips64vr4100el-* \ - | mips64vr4300-* | mips64vr4300el-* \ - | mips64vr5000-* | mips64vr5000el-* \ - | mipsisa32-* | mipsisa32el-* \ - | mipsisa32r2-* | mipsisa32r2el-* \ - | mipsisa64-* | mipsisa64el-* \ - | mipsisa64r2-* | mipsisa64r2el-* \ - | mipsisa64sb1-* | mipsisa64sb1el-* \ - | mipsisa64sr71k-* | mipsisa64sr71kel-* \ - | mipstx39-* | mipstx39el-* \ - | msp430-* \ - | none-* | np1-* | nv1-* | ns16k-* | ns32k-* \ - | orion-* \ - | pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \ - | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* | ppcbe-* \ - | pyramid-* \ - | romp-* | rs6000-* \ - | sh-* | sh[1234]-* | sh[23]e-* | sh[34]eb-* | shbe-* \ - | shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \ - | sparc-* | sparc64-* | sparc86x-* | sparclet-* | sparclite-* \ - | sparcv8-* | sparcv9-* | sparcv9b-* | strongarm-* | sv1-* | sx?-* \ - | tahoe-* | thumb-* \ - | tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \ - | tron-* \ - | v850-* | v850e-* | vax-* \ - | we32k-* \ - | x86-* | x86_64-* | xps100-* | xscale-* | xstormy16-* \ - | xtensa-* \ - | ymp-* \ - | z8k-*) - ;; - # Recognize the various machine names and aliases which stand - # for a CPU type and a company and sometimes even an OS. - 386bsd) - basic_machine=i386-unknown - os=-bsd - ;; - 3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc) - basic_machine=m68000-att - ;; - 3b*) - basic_machine=we32k-att - ;; - a29khif) - basic_machine=a29k-amd - os=-udi - ;; - abacus) - basic_machine=abacus-unknown - ;; - adobe68k) - basic_machine=m68010-adobe - os=-scout - ;; - alliant | fx80) - basic_machine=fx80-alliant - ;; - altos | altos3068) - basic_machine=m68k-altos - ;; - am29k) - basic_machine=a29k-none - os=-bsd - ;; - amd64) - basic_machine=x86_64-pc - ;; - amd64-*) - basic_machine=x86_64-`echo $basic_machine | sed 's/^[^-]*-//'` - ;; - amdahl) - basic_machine=580-amdahl - os=-sysv - ;; - amiga | amiga-*) - basic_machine=m68k-unknown - ;; - amigaos | amigados) - basic_machine=m68k-unknown - os=-amigaos - ;; - amigaunix | amix) - basic_machine=m68k-unknown - os=-sysv4 - ;; - apollo68) - basic_machine=m68k-apollo - os=-sysv - ;; - apollo68bsd) - basic_machine=m68k-apollo - os=-bsd - ;; - aux) - basic_machine=m68k-apple - os=-aux - ;; - balance) - basic_machine=ns32k-sequent - os=-dynix - ;; - c90) - basic_machine=c90-cray - os=-unicos - ;; - convex-c1) - basic_machine=c1-convex - os=-bsd - ;; - convex-c2) - basic_machine=c2-convex - os=-bsd - ;; - convex-c32) - basic_machine=c32-convex - os=-bsd - ;; - convex-c34) - basic_machine=c34-convex - os=-bsd - ;; - convex-c38) - basic_machine=c38-convex - os=-bsd - ;; - cray | j90) - basic_machine=j90-cray - os=-unicos - ;; - cr16c) - basic_machine=cr16c-unknown - os=-elf - ;; - crds | unos) - basic_machine=m68k-crds - ;; - cris | cris-* | etrax*) - basic_machine=cris-axis - ;; - crx) - basic_machine=crx-unknown - os=-elf - ;; - da30 | da30-*) - basic_machine=m68k-da30 - ;; - decstation | decstation-3100 | pmax | pmax-* | pmin | dec3100 | decstatn) - basic_machine=mips-dec - ;; - decsystem10* | dec10*) - basic_machine=pdp10-dec - os=-tops10 - ;; - decsystem20* | dec20*) - basic_machine=pdp10-dec - os=-tops20 - ;; - delta | 3300 | motorola-3300 | motorola-delta \ - | 3300-motorola | delta-motorola) - basic_machine=m68k-motorola - ;; - delta88) - basic_machine=m88k-motorola - os=-sysv3 - ;; - dpx20 | dpx20-*) - basic_machine=rs6000-bull - os=-bosx - ;; - dpx2* | dpx2*-bull) - basic_machine=m68k-bull - os=-sysv3 - ;; - ebmon29k) - basic_machine=a29k-amd - os=-ebmon - ;; - elxsi) - basic_machine=elxsi-elxsi - os=-bsd - ;; - encore | umax | mmax) - basic_machine=ns32k-encore - ;; - es1800 | OSE68k | ose68k | ose | OSE) - basic_machine=m68k-ericsson - os=-ose - ;; - fx2800) - basic_machine=i860-alliant - ;; - genix) - basic_machine=ns32k-ns - ;; - gmicro) - basic_machine=tron-gmicro - os=-sysv - ;; - go32) - basic_machine=i386-pc - os=-go32 - ;; - h3050r* | hiux*) - basic_machine=hppa1.1-hitachi - os=-hiuxwe2 - ;; - h8300hms) - basic_machine=h8300-hitachi - os=-hms - ;; - h8300xray) - basic_machine=h8300-hitachi - os=-xray - ;; - h8500hms) - basic_machine=h8500-hitachi - os=-hms - ;; - harris) - basic_machine=m88k-harris - os=-sysv3 - ;; - hp300-*) - basic_machine=m68k-hp - ;; - hp300bsd) - basic_machine=m68k-hp - os=-bsd - ;; - hp300hpux) - basic_machine=m68k-hp - os=-hpux - ;; - hp3k9[0-9][0-9] | hp9[0-9][0-9]) - basic_machine=hppa1.0-hp - ;; - hp9k2[0-9][0-9] | hp9k31[0-9]) - basic_machine=m68000-hp - ;; - hp9k3[2-9][0-9]) - basic_machine=m68k-hp - ;; - hp9k6[0-9][0-9] | hp6[0-9][0-9]) - basic_machine=hppa1.0-hp - ;; - hp9k7[0-79][0-9] | hp7[0-79][0-9]) - basic_machine=hppa1.1-hp - ;; - hp9k78[0-9] | hp78[0-9]) - # FIXME: really hppa2.0-hp - basic_machine=hppa1.1-hp - ;; - hp9k8[67]1 | hp8[67]1 | hp9k80[24] | hp80[24] | hp9k8[78]9 | hp8[78]9 | hp9k893 | hp893) - # FIXME: really hppa2.0-hp - basic_machine=hppa1.1-hp - ;; - hp9k8[0-9][13679] | hp8[0-9][13679]) - basic_machine=hppa1.1-hp - ;; - hp9k8[0-9][0-9] | hp8[0-9][0-9]) - basic_machine=hppa1.0-hp - ;; - hppa-next) - os=-nextstep3 - ;; - hppaosf) - basic_machine=hppa1.1-hp - os=-osf - ;; - hppro) - basic_machine=hppa1.1-hp - os=-proelf - ;; - i370-ibm* | ibm*) - basic_machine=i370-ibm - ;; -# I'm not sure what "Sysv32" means. Should this be sysv3.2? - i*86v32) - basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` - os=-sysv32 - ;; - i*86v4*) - basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` - os=-sysv4 - ;; - i*86v) - basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` - os=-sysv - ;; - i*86sol2) - basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` - os=-solaris2 - ;; - i386mach) - basic_machine=i386-mach - os=-mach - ;; - i386-vsta | vsta) - basic_machine=i386-unknown - os=-vsta - ;; - iris | iris4d) - basic_machine=mips-sgi - case $os in - -irix*) - ;; - *) - os=-irix4 - ;; - esac - ;; - isi68 | isi) - basic_machine=m68k-isi - os=-sysv - ;; - m88k-omron*) - basic_machine=m88k-omron - ;; - magnum | m3230) - basic_machine=mips-mips - os=-sysv - ;; - merlin) - basic_machine=ns32k-utek - os=-sysv - ;; - mingw32) - basic_machine=i386-pc - os=-mingw32 - ;; - miniframe) - basic_machine=m68000-convergent - ;; - *mint | -mint[0-9]* | *MiNT | *MiNT[0-9]*) - basic_machine=m68k-atari - os=-mint - ;; - mips3*-*) - basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'` - ;; - mips3*) - basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown - ;; - mmix*) - basic_machine=mmix-knuth - os=-mmixware - ;; - monitor) - basic_machine=m68k-rom68k - os=-coff - ;; - morphos) - basic_machine=powerpc-unknown - os=-morphos - ;; - msdos) - basic_machine=i386-pc - os=-msdos - ;; - mvs) - basic_machine=i370-ibm - os=-mvs - ;; - ncr3000) - basic_machine=i486-ncr - os=-sysv4 - ;; - netbsd386) - basic_machine=i386-unknown - os=-netbsd - ;; - netwinder) - basic_machine=armv4l-rebel - os=-linux - ;; - news | news700 | news800 | news900) - basic_machine=m68k-sony - os=-newsos - ;; - news1000) - basic_machine=m68030-sony - os=-newsos - ;; - news-3600 | risc-news) - basic_machine=mips-sony - os=-newsos - ;; - necv70) - basic_machine=v70-nec - os=-sysv - ;; - next | m*-next ) - basic_machine=m68k-next - case $os in - -nextstep* ) - ;; - -ns2*) - os=-nextstep2 - ;; - *) - os=-nextstep3 - ;; - esac - ;; - nh3000) - basic_machine=m68k-harris - os=-cxux - ;; - nh[45]000) - basic_machine=m88k-harris - os=-cxux - ;; - nindy960) - basic_machine=i960-intel - os=-nindy - ;; - mon960) - basic_machine=i960-intel - os=-mon960 - ;; - nonstopux) - basic_machine=mips-compaq - os=-nonstopux - ;; - np1) - basic_machine=np1-gould - ;; - nv1) - basic_machine=nv1-cray - os=-unicosmp - ;; - nsr-tandem) - basic_machine=nsr-tandem - ;; - op50n-* | op60c-*) - basic_machine=hppa1.1-oki - os=-proelf - ;; - or32 | or32-*) - basic_machine=or32-unknown - os=-coff - ;; - os400) - basic_machine=powerpc-ibm - os=-os400 - ;; - OSE68000 | ose68000) - basic_machine=m68000-ericsson - os=-ose - ;; - os68k) - basic_machine=m68k-none - os=-os68k - ;; - pa-hitachi) - basic_machine=hppa1.1-hitachi - os=-hiuxwe2 - ;; - paragon) - basic_machine=i860-intel - os=-osf - ;; - pbd) - basic_machine=sparc-tti - ;; - pbb) - basic_machine=m68k-tti - ;; - pc532 | pc532-*) - basic_machine=ns32k-pc532 - ;; - pentium | p5 | k5 | k6 | nexgen | viac3) - basic_machine=i586-pc - ;; - pentiumpro | p6 | 6x86 | athlon | athlon_*) - basic_machine=i686-pc - ;; - pentiumii | pentium2 | pentiumiii | pentium3) - basic_machine=i686-pc - ;; - pentium4) - basic_machine=i786-pc - ;; - pentium-* | p5-* | k5-* | k6-* | nexgen-* | viac3-*) - basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'` - ;; - pentiumpro-* | p6-* | 6x86-* | athlon-*) - basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` - ;; - pentiumii-* | pentium2-* | pentiumiii-* | pentium3-*) - basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` - ;; - pentium4-*) - basic_machine=i786-`echo $basic_machine | sed 's/^[^-]*-//'` - ;; - pn) - basic_machine=pn-gould - ;; - power) basic_machine=power-ibm - ;; - ppc) basic_machine=powerpc-unknown - ;; - ppc-*) basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'` - ;; - ppcle | powerpclittle | ppc-le | powerpc-little) - basic_machine=powerpcle-unknown - ;; - ppcle-* | powerpclittle-*) - basic_machine=powerpcle-`echo $basic_machine | sed 's/^[^-]*-//'` - ;; - ppc64) basic_machine=powerpc64-unknown - ;; - ppc64-*) basic_machine=powerpc64-`echo $basic_machine | sed 's/^[^-]*-//'` - ;; - ppc64le | powerpc64little | ppc64-le | powerpc64-little) - basic_machine=powerpc64le-unknown - ;; - ppc64le-* | powerpc64little-*) - basic_machine=powerpc64le-`echo $basic_machine | sed 's/^[^-]*-//'` - ;; - ps2) - basic_machine=i386-ibm - ;; - pw32) - basic_machine=i586-unknown - os=-pw32 - ;; - rom68k) - basic_machine=m68k-rom68k - os=-coff - ;; - rm[46]00) - basic_machine=mips-siemens - ;; - rtpc | rtpc-*) - basic_machine=romp-ibm - ;; - s390 | s390-*) - basic_machine=s390-ibm - ;; - s390x | s390x-*) - basic_machine=s390x-ibm - ;; - sa29200) - basic_machine=a29k-amd - os=-udi - ;; - sb1) - basic_machine=mipsisa64sb1-unknown - ;; - sb1el) - basic_machine=mipsisa64sb1el-unknown - ;; - sei) - basic_machine=mips-sei - os=-seiux - ;; - sequent) - basic_machine=i386-sequent - ;; - sh) - basic_machine=sh-hitachi - os=-hms - ;; - sh64) - basic_machine=sh64-unknown - ;; - sparclite-wrs | simso-wrs) - basic_machine=sparclite-wrs - os=-vxworks - ;; - sps7) - basic_machine=m68k-bull - os=-sysv2 - ;; - spur) - basic_machine=spur-unknown - ;; - st2000) - basic_machine=m68k-tandem - ;; - stratus) - basic_machine=i860-stratus - os=-sysv4 - ;; - sun2) - basic_machine=m68000-sun - ;; - sun2os3) - basic_machine=m68000-sun - os=-sunos3 - ;; - sun2os4) - basic_machine=m68000-sun - os=-sunos4 - ;; - sun3os3) - basic_machine=m68k-sun - os=-sunos3 - ;; - sun3os4) - basic_machine=m68k-sun - os=-sunos4 - ;; - sun4os3) - basic_machine=sparc-sun - os=-sunos3 - ;; - sun4os4) - basic_machine=sparc-sun - os=-sunos4 - ;; - sun4sol2) - basic_machine=sparc-sun - os=-solaris2 - ;; - sun3 | sun3-*) - basic_machine=m68k-sun - ;; - sun4) - basic_machine=sparc-sun - ;; - sun386 | sun386i | roadrunner) - basic_machine=i386-sun - ;; - sv1) - basic_machine=sv1-cray - os=-unicos - ;; - symmetry) - basic_machine=i386-sequent - os=-dynix - ;; - t3e) - basic_machine=alphaev5-cray - os=-unicos - ;; - t90) - basic_machine=t90-cray - os=-unicos - ;; - tic54x | c54x*) - basic_machine=tic54x-unknown - os=-coff - ;; - tic55x | c55x*) - basic_machine=tic55x-unknown - os=-coff - ;; - tic6x | c6x*) - basic_machine=tic6x-unknown - os=-coff - ;; - tx39) - basic_machine=mipstx39-unknown - ;; - tx39el) - basic_machine=mipstx39el-unknown - ;; - toad1) - basic_machine=pdp10-xkl - os=-tops20 - ;; - tower | tower-32) - basic_machine=m68k-ncr - ;; - tpf) - basic_machine=s390x-ibm - os=-tpf - ;; - udi29k) - basic_machine=a29k-amd - os=-udi - ;; - ultra3) - basic_machine=a29k-nyu - os=-sym1 - ;; - v810 | necv810) - basic_machine=v810-nec - os=-none - ;; - vaxv) - basic_machine=vax-dec - os=-sysv - ;; - vms) - basic_machine=vax-dec - os=-vms - ;; - vpp*|vx|vx-*) - basic_machine=f301-fujitsu - ;; - vxworks960) - basic_machine=i960-wrs - os=-vxworks - ;; - vxworks68) - basic_machine=m68k-wrs - os=-vxworks - ;; - vxworks29k) - basic_machine=a29k-wrs - os=-vxworks - ;; - w65*) - basic_machine=w65-wdc - os=-none - ;; - w89k-*) - basic_machine=hppa1.1-winbond - os=-proelf - ;; - xps | xps100) - basic_machine=xps100-honeywell - ;; - ymp) - basic_machine=ymp-cray - os=-unicos - ;; - z8k-*-coff) - basic_machine=z8k-unknown - os=-sim - ;; - none) - basic_machine=none-none - os=-none - ;; - -# Here we handle the default manufacturer of certain CPU types. It is in -# some cases the only manufacturer, in others, it is the most popular. - w89k) - basic_machine=hppa1.1-winbond - ;; - op50n) - basic_machine=hppa1.1-oki - ;; - op60c) - basic_machine=hppa1.1-oki - ;; - romp) - basic_machine=romp-ibm - ;; - rs6000) - basic_machine=rs6000-ibm - ;; - vax) - basic_machine=vax-dec - ;; - pdp10) - # there are many clones, so DEC is not a safe bet - basic_machine=pdp10-unknown - ;; - pdp11) - basic_machine=pdp11-dec - ;; - we32k) - basic_machine=we32k-att - ;; - sh3 | sh4 | sh[34]eb | sh[1234]le | sh[23]ele) - basic_machine=sh-unknown - ;; - sh64) - basic_machine=sh64-unknown - ;; - sparc | sparcv8 | sparcv9 | sparcv9b) - basic_machine=sparc-sun - ;; - cydra) - basic_machine=cydra-cydrome - ;; - orion) - basic_machine=orion-highlevel - ;; - orion105) - basic_machine=clipper-highlevel - ;; - mac | mpw | mac-mpw) - basic_machine=m68k-apple - ;; - pmac | pmac-mpw) - basic_machine=powerpc-apple - ;; - *-unknown) - # Make sure to match an already-canonicalized machine name. - ;; - *) - echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 - exit 1 - ;; -esac - -# Here we canonicalize certain aliases for manufacturers. -case $basic_machine in - *-digital*) - basic_machine=`echo $basic_machine | sed 's/digital.*/dec/'` - ;; - *-commodore*) - basic_machine=`echo $basic_machine | sed 's/commodore.*/cbm/'` - ;; - *) - ;; -esac - -# Decode manufacturer-specific aliases for certain operating systems. - -if [ x"$os" != x"" ] -then -case $os in - # First match some system type aliases - # that might get confused with valid system types. - # -solaris* is a basic system type, with this one exception. - -solaris1 | -solaris1.*) - os=`echo $os | sed -e 's|solaris1|sunos4|'` - ;; - -solaris) - os=-solaris2 - ;; - -svr4*) - os=-sysv4 - ;; - -unixware*) - os=-sysv4.2uw - ;; - -gnu/linux*) - os=`echo $os | sed -e 's|gnu/linux|linux-gnu|'` - ;; - # First accept the basic system types. - # The portable systems comes first. - # Each alternative MUST END IN A *, to match a version number. - # -sysv* is not here because it comes later, after sysvr4. - -gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \ - | -*vms* | -sco* | -esix* | -isc* | -aix* | -sunos | -sunos[34]*\ - | -hpux* | -unos* | -osf* | -luna* | -dgux* | -solaris* | -sym* \ - | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \ - | -aos* \ - | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \ - | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \ - | -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* | -openbsd* \ - | -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \ - | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \ - | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \ - | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \ - | -chorusos* | -chorusrdb* \ - | -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \ - | -mingw32* | -linux-gnu* | -linux-uclibc* | -uxpv* | -beos* | -mpeix* | -udk* \ - | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \ - | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \ - | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \ - | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \ - | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \ - | -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly*) - # Remember, each alternative MUST END IN *, to match a version number. - ;; - -qnx*) - case $basic_machine in - x86-* | i*86-*) - ;; - *) - os=-nto$os - ;; - esac - ;; - -nto-qnx*) - ;; - -nto*) - os=`echo $os | sed -e 's|nto|nto-qnx|'` - ;; - -sim | -es1800* | -hms* | -xray | -os68k* | -none* | -v88r* \ - | -windows* | -osx | -abug | -netware* | -os9* | -beos* \ - | -macos* | -mpw* | -magic* | -mmixware* | -mon960* | -lnews*) - ;; - -mac*) - os=`echo $os | sed -e 's|mac|macos|'` - ;; - -linux-dietlibc) - os=-linux-dietlibc - ;; - -linux*) - os=`echo $os | sed -e 's|linux|linux-gnu|'` - ;; - -sunos5*) - os=`echo $os | sed -e 's|sunos5|solaris2|'` - ;; - -sunos6*) - os=`echo $os | sed -e 's|sunos6|solaris3|'` - ;; - -opened*) - os=-openedition - ;; - -os400*) - os=-os400 - ;; - -wince*) - os=-wince - ;; - -osfrose*) - os=-osfrose - ;; - -osf*) - os=-osf - ;; - -utek*) - os=-bsd - ;; - -dynix*) - os=-bsd - ;; - -acis*) - os=-aos - ;; - -atheos*) - os=-atheos - ;; - -syllable*) - os=-syllable - ;; - -386bsd) - os=-bsd - ;; - -ctix* | -uts*) - os=-sysv - ;; - -nova*) - os=-rtmk-nova - ;; - -ns2 ) - os=-nextstep2 - ;; - -nsk*) - os=-nsk - ;; - # Preserve the version number of sinix5. - -sinix5.*) - os=`echo $os | sed -e 's|sinix|sysv|'` - ;; - -sinix*) - os=-sysv4 - ;; - -tpf*) - os=-tpf - ;; - -triton*) - os=-sysv3 - ;; - -oss*) - os=-sysv3 - ;; - -svr4) - os=-sysv4 - ;; - -svr3) - os=-sysv3 - ;; - -sysvr4) - os=-sysv4 - ;; - # This must come after -sysvr4. - -sysv*) - ;; - -ose*) - os=-ose - ;; - -es1800*) - os=-ose - ;; - -xenix) - os=-xenix - ;; - -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) - os=-mint - ;; - -aros*) - os=-aros - ;; - -kaos*) - os=-kaos - ;; - -none) - ;; - *) - # Get rid of the `-' at the beginning of $os. - os=`echo $os | sed 's/[^-]*-//'` - echo Invalid configuration \`$1\': system \`$os\' not recognized 1>&2 - exit 1 - ;; -esac -else - -# Here we handle the default operating systems that come with various machines. -# The value should be what the vendor currently ships out the door with their -# machine or put another way, the most popular os provided with the machine. - -# Note that if you're going to try to match "-MANUFACTURER" here (say, -# "-sun"), then you have to tell the case statement up towards the top -# that MANUFACTURER isn't an operating system. Otherwise, code above -# will signal an error saying that MANUFACTURER isn't an operating -# system, and we'll never get to this point. - -case $basic_machine in - *-acorn) - os=-riscix1.2 - ;; - arm*-rebel) - os=-linux - ;; - arm*-semi) - os=-aout - ;; - c4x-* | tic4x-*) - os=-coff - ;; - # This must come before the *-dec entry. - pdp10-*) - os=-tops20 - ;; - pdp11-*) - os=-none - ;; - *-dec | vax-*) - os=-ultrix4.2 - ;; - m68*-apollo) - os=-domain - ;; - i386-sun) - os=-sunos4.0.2 - ;; - m68000-sun) - os=-sunos3 - # This also exists in the configure program, but was not the - # default. - # os=-sunos4 - ;; - m68*-cisco) - os=-aout - ;; - mips*-cisco) - os=-elf - ;; - mips*-*) - os=-elf - ;; - or32-*) - os=-coff - ;; - *-tti) # must be before sparc entry or we get the wrong os. - os=-sysv3 - ;; - sparc-* | *-sun) - os=-sunos4.1.1 - ;; - *-be) - os=-beos - ;; - *-ibm) - os=-aix - ;; - *-wec) - os=-proelf - ;; - *-winbond) - os=-proelf - ;; - *-oki) - os=-proelf - ;; - *-hp) - os=-hpux - ;; - *-hitachi) - os=-hiux - ;; - i860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent) - os=-sysv - ;; - *-cbm) - os=-amigaos - ;; - *-dg) - os=-dgux - ;; - *-dolphin) - os=-sysv3 - ;; - m68k-ccur) - os=-rtu - ;; - m88k-omron*) - os=-luna - ;; - *-next ) - os=-nextstep - ;; - *-sequent) - os=-ptx - ;; - *-crds) - os=-unos - ;; - *-ns) - os=-genix - ;; - i370-*) - os=-mvs - ;; - *-next) - os=-nextstep3 - ;; - *-gould) - os=-sysv - ;; - *-highlevel) - os=-bsd - ;; - *-encore) - os=-bsd - ;; - *-sgi) - os=-irix - ;; - *-siemens) - os=-sysv4 - ;; - *-masscomp) - os=-rtu - ;; - f30[01]-fujitsu | f700-fujitsu) - os=-uxpv - ;; - *-rom68k) - os=-coff - ;; - *-*bug) - os=-coff - ;; - *-apple) - os=-macos - ;; - *-atari*) - os=-mint - ;; - *) - os=-none - ;; -esac -fi - -# Here we handle the case where we know the os, and the CPU type, but not the -# manufacturer. We pick the logical manufacturer. -vendor=unknown -case $basic_machine in - *-unknown) - case $os in - -riscix*) - vendor=acorn - ;; - -sunos*) - vendor=sun - ;; - -aix*) - vendor=ibm - ;; - -beos*) - vendor=be - ;; - -hpux*) - vendor=hp - ;; - -mpeix*) - vendor=hp - ;; - -hiux*) - vendor=hitachi - ;; - -unos*) - vendor=crds - ;; - -dgux*) - vendor=dg - ;; - -luna*) - vendor=omron - ;; - -genix*) - vendor=ns - ;; - -mvs* | -opened*) - vendor=ibm - ;; - -os400*) - vendor=ibm - ;; - -ptx*) - vendor=sequent - ;; - -tpf*) - vendor=ibm - ;; - -vxsim* | -vxworks* | -windiss*) - vendor=wrs - ;; - -aux*) - vendor=apple - ;; - -hms*) - vendor=hitachi - ;; - -mpw* | -macos*) - vendor=apple - ;; - -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) - vendor=atari - ;; - -vos*) - vendor=stratus - ;; - esac - basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"` - ;; -esac - -echo $basic_machine$os -exit 0 - -# Local variables: -# eval: (add-hook 'write-file-hooks 'time-stamp) -# time-stamp-start: "timestamp='" -# time-stamp-format: "%:y-%02m-%02d" -# time-stamp-end: "'" -# End: diff --git a/src/bin/bison/config/depcomp b/src/bin/bison/config/depcomp deleted file mode 100644 index 25bdb18892..0000000000 --- a/src/bin/bison/config/depcomp +++ /dev/null @@ -1,526 +0,0 @@ -#! /bin/sh -# depcomp - compile a program generating dependencies as side-effects - -scriptversion=2004-04-25.13 - -# Copyright (C) 1999, 2000, 2003, 2004 Free Software Foundation, Inc. - -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2, 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, write to the Free Software -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA -# 02111-1307, USA. - -# As a special exception to the GNU General Public License, if you -# distribute this file as part of a program that contains a -# configuration script generated by Autoconf, you may include it under -# the same distribution terms that you use for the rest of that program. - -# Originally written by Alexandre Oliva . - -case $1 in - '') - echo "$0: No command. Try \`$0 --help' for more information." 1>&2 - exit 1; - ;; - -h | --h*) - cat <<\EOF -Usage: depcomp [--help] [--version] PROGRAM [ARGS] - -Run PROGRAMS ARGS to compile a file, generating dependencies -as side-effects. - -Environment variables: - depmode Dependency tracking mode. - source Source file read by `PROGRAMS ARGS'. - object Object file output by `PROGRAMS ARGS'. - depfile Dependency file to output. - tmpdepfile Temporary file to use when outputing dependencies. - libtool Whether libtool is used (yes/no). - -Report bugs to . -EOF - exit 0 - ;; - -v | --v*) - echo "depcomp $scriptversion" - exit 0 - ;; -esac - -if test -z "$depmode" || test -z "$source" || test -z "$object"; then - echo "depcomp: Variables source, object and depmode must be set" 1>&2 - exit 1 -fi -# `libtool' can also be set to `yes' or `no'. - -if test -z "$depfile"; then - base=`echo "$object" | sed -e 's,^.*/,,' -e 's,\.\([^.]*\)$,.P\1,'` - dir=`echo "$object" | sed 's,/.*$,/,'` - if test "$dir" = "$object"; then - dir= - fi - # FIXME: should be _deps on DOS. - depfile="$dir.deps/$base" -fi - -tmpdepfile=${tmpdepfile-`echo "$depfile" | sed 's/\.\([^.]*\)$/.T\1/'`} - -rm -f "$tmpdepfile" - -# Some modes work just like other modes, but use different flags. We -# parameterize here, but still list the modes in the big case below, -# to make depend.m4 easier to write. Note that we *cannot* use a case -# here, because this file can only contain one case statement. -if test "$depmode" = hp; then - # HP compiler uses -M and no extra arg. - gccflag=-M - depmode=gcc -fi - -if test "$depmode" = dashXmstdout; then - # This is just like dashmstdout with a different argument. - dashmflag=-xM - depmode=dashmstdout -fi - -case "$depmode" in -gcc3) -## gcc 3 implements dependency tracking that does exactly what -## we want. Yay! Note: for some reason libtool 1.4 doesn't like -## it if -MD -MP comes after the -MF stuff. Hmm. - "$@" -MT "$object" -MD -MP -MF "$tmpdepfile" - stat=$? - if test $stat -eq 0; then : - else - rm -f "$tmpdepfile" - exit $stat - fi - mv "$tmpdepfile" "$depfile" - ;; - -gcc) -## There are various ways to get dependency output from gcc. Here's -## why we pick this rather obscure method: -## - Don't want to use -MD because we'd like the dependencies to end -## up in a subdir. Having to rename by hand is ugly. -## (We might end up doing this anyway to support other compilers.) -## - The DEPENDENCIES_OUTPUT environment variable makes gcc act like -## -MM, not -M (despite what the docs say). -## - Using -M directly means running the compiler twice (even worse -## than renaming). - if test -z "$gccflag"; then - gccflag=-MD, - fi - "$@" -Wp,"$gccflag$tmpdepfile" - stat=$? - if test $stat -eq 0; then : - else - rm -f "$tmpdepfile" - exit $stat - fi - rm -f "$depfile" - echo "$object : \\" > "$depfile" - alpha=ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz -## The second -e expression handles DOS-style file names with drive letters. - sed -e 's/^[^:]*: / /' \ - -e 's/^['$alpha']:\/[^:]*: / /' < "$tmpdepfile" >> "$depfile" -## This next piece of magic avoids the `deleted header file' problem. -## The problem is that when a header file which appears in a .P file -## is deleted, the dependency causes make to die (because there is -## typically no way to rebuild the header). We avoid this by adding -## dummy dependencies for each header file. Too bad gcc doesn't do -## this for us directly. - tr ' ' ' -' < "$tmpdepfile" | -## Some versions of gcc put a space before the `:'. On the theory -## that the space means something, we add a space to the output as -## well. -## Some versions of the HPUX 10.20 sed can't process this invocation -## correctly. Breaking it into two sed invocations is a workaround. - sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile" - rm -f "$tmpdepfile" - ;; - -hp) - # This case exists only to let depend.m4 do its work. It works by - # looking at the text of this script. This case will never be run, - # since it is checked for above. - exit 1 - ;; - -sgi) - if test "$libtool" = yes; then - "$@" "-Wp,-MDupdate,$tmpdepfile" - else - "$@" -MDupdate "$tmpdepfile" - fi - stat=$? - if test $stat -eq 0; then : - else - rm -f "$tmpdepfile" - exit $stat - fi - rm -f "$depfile" - - if test -f "$tmpdepfile"; then # yes, the sourcefile depend on other files - echo "$object : \\" > "$depfile" - - # Clip off the initial element (the dependent). Don't try to be - # clever and replace this with sed code, as IRIX sed won't handle - # lines with more than a fixed number of characters (4096 in - # IRIX 6.2 sed, 8192 in IRIX 6.5). We also remove comment lines; - # the IRIX cc adds comments like `#:fec' to the end of the - # dependency line. - tr ' ' ' -' < "$tmpdepfile" \ - | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' | \ - tr ' -' ' ' >> $depfile - echo >> $depfile - - # The second pass generates a dummy entry for each header file. - tr ' ' ' -' < "$tmpdepfile" \ - | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \ - >> $depfile - else - # The sourcefile does not contain any dependencies, so just - # store a dummy comment line, to avoid errors with the Makefile - # "include basename.Plo" scheme. - echo "#dummy" > "$depfile" - fi - rm -f "$tmpdepfile" - ;; - -aix) - # The C for AIX Compiler uses -M and outputs the dependencies - # in a .u file. In older versions, this file always lives in the - # current directory. Also, the AIX compiler puts `$object:' at the - # start of each line; $object doesn't have directory information. - # Version 6 uses the directory in both cases. - stripped=`echo "$object" | sed 's/\(.*\)\..*$/\1/'` - tmpdepfile="$stripped.u" - if test "$libtool" = yes; then - "$@" -Wc,-M - else - "$@" -M - fi - stat=$? - - if test -f "$tmpdepfile"; then : - else - stripped=`echo "$stripped" | sed 's,^.*/,,'` - tmpdepfile="$stripped.u" - fi - - if test $stat -eq 0; then : - else - rm -f "$tmpdepfile" - exit $stat - fi - - if test -f "$tmpdepfile"; then - outname="$stripped.o" - # Each line is of the form `foo.o: dependent.h'. - # Do two passes, one to just change these to - # `$object: dependent.h' and one to simply `dependent.h:'. - sed -e "s,^$outname:,$object :," < "$tmpdepfile" > "$depfile" - sed -e "s,^$outname: \(.*\)$,\1:," < "$tmpdepfile" >> "$depfile" - else - # The sourcefile does not contain any dependencies, so just - # store a dummy comment line, to avoid errors with the Makefile - # "include basename.Plo" scheme. - echo "#dummy" > "$depfile" - fi - rm -f "$tmpdepfile" - ;; - -icc) - # Intel's C compiler understands `-MD -MF file'. However on - # icc -MD -MF foo.d -c -o sub/foo.o sub/foo.c - # ICC 7.0 will fill foo.d with something like - # foo.o: sub/foo.c - # foo.o: sub/foo.h - # which is wrong. We want: - # sub/foo.o: sub/foo.c - # sub/foo.o: sub/foo.h - # sub/foo.c: - # sub/foo.h: - # ICC 7.1 will output - # foo.o: sub/foo.c sub/foo.h - # and will wrap long lines using \ : - # foo.o: sub/foo.c ... \ - # sub/foo.h ... \ - # ... - - "$@" -MD -MF "$tmpdepfile" - stat=$? - if test $stat -eq 0; then : - else - rm -f "$tmpdepfile" - exit $stat - fi - rm -f "$depfile" - # Each line is of the form `foo.o: dependent.h', - # or `foo.o: dep1.h dep2.h \', or ` dep3.h dep4.h \'. - # Do two passes, one to just change these to - # `$object: dependent.h' and one to simply `dependent.h:'. - sed "s,^[^:]*:,$object :," < "$tmpdepfile" > "$depfile" - # Some versions of the HPUX 10.20 sed can't process this invocation - # correctly. Breaking it into two sed invocations is a workaround. - sed 's,^[^:]*: \(.*\)$,\1,;s/^\\$//;/^$/d;/:$/d' < "$tmpdepfile" | - sed -e 's/$/ :/' >> "$depfile" - rm -f "$tmpdepfile" - ;; - -tru64) - # The Tru64 compiler uses -MD to generate dependencies as a side - # effect. `cc -MD -o foo.o ...' puts the dependencies into `foo.o.d'. - # At least on Alpha/Redhat 6.1, Compaq CCC V6.2-504 seems to put - # dependencies in `foo.d' instead, so we check for that too. - # Subdirectories are respected. - dir=`echo "$object" | sed -e 's|/[^/]*$|/|'` - test "x$dir" = "x$object" && dir= - base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'` - - if test "$libtool" = yes; then - # Dependencies are output in .lo.d with libtool 1.4. - # They are output in .o.d with libtool 1.5. - tmpdepfile1="$dir.libs/$base.lo.d" - tmpdepfile2="$dir.libs/$base.o.d" - tmpdepfile3="$dir.libs/$base.d" - "$@" -Wc,-MD - else - tmpdepfile1="$dir$base.o.d" - tmpdepfile2="$dir$base.d" - tmpdepfile3="$dir$base.d" - "$@" -MD - fi - - stat=$? - if test $stat -eq 0; then : - else - rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" - exit $stat - fi - - if test -f "$tmpdepfile1"; then - tmpdepfile="$tmpdepfile1" - elif test -f "$tmpdepfile2"; then - tmpdepfile="$tmpdepfile2" - else - tmpdepfile="$tmpdepfile3" - fi - if test -f "$tmpdepfile"; then - sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile" - # That's a tab and a space in the []. - sed -e 's,^.*\.[a-z]*:[ ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile" - else - echo "#dummy" > "$depfile" - fi - rm -f "$tmpdepfile" - ;; - -#nosideeffect) - # This comment above is used by automake to tell side-effect - # dependency tracking mechanisms from slower ones. - -dashmstdout) - # Important note: in order to support this mode, a compiler *must* - # always write the preprocessed file to stdout, regardless of -o. - "$@" || exit $? - - # Remove the call to Libtool. - if test "$libtool" = yes; then - while test $1 != '--mode=compile'; do - shift - done - shift - fi - - # Remove `-o $object'. - IFS=" " - for arg - do - case $arg in - -o) - shift - ;; - $object) - shift - ;; - *) - set fnord "$@" "$arg" - shift # fnord - shift # $arg - ;; - esac - done - - test -z "$dashmflag" && dashmflag=-M - # Require at least two characters before searching for `:' - # in the target name. This is to cope with DOS-style filenames: - # a dependency such as `c:/foo/bar' could be seen as target `c' otherwise. - "$@" $dashmflag | - sed 's:^[ ]*[^: ][^:][^:]*\:[ ]*:'"$object"'\: :' > "$tmpdepfile" - rm -f "$depfile" - cat < "$tmpdepfile" > "$depfile" - tr ' ' ' -' < "$tmpdepfile" | \ -## Some versions of the HPUX 10.20 sed can't process this invocation -## correctly. Breaking it into two sed invocations is a workaround. - sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile" - rm -f "$tmpdepfile" - ;; - -dashXmstdout) - # This case only exists to satisfy depend.m4. It is never actually - # run, as this mode is specially recognized in the preamble. - exit 1 - ;; - -makedepend) - "$@" || exit $? - # Remove any Libtool call - if test "$libtool" = yes; then - while test $1 != '--mode=compile'; do - shift - done - shift - fi - # X makedepend - shift - cleared=no - for arg in "$@"; do - case $cleared in - no) - set ""; shift - cleared=yes ;; - esac - case "$arg" in - -D*|-I*) - set fnord "$@" "$arg"; shift ;; - # Strip any option that makedepend may not understand. Remove - # the object too, otherwise makedepend will parse it as a source file. - -*|$object) - ;; - *) - set fnord "$@" "$arg"; shift ;; - esac - done - obj_suffix="`echo $object | sed 's/^.*\././'`" - touch "$tmpdepfile" - ${MAKEDEPEND-makedepend} -o"$obj_suffix" -f"$tmpdepfile" "$@" - rm -f "$depfile" - cat < "$tmpdepfile" > "$depfile" - sed '1,2d' "$tmpdepfile" | tr ' ' ' -' | \ -## Some versions of the HPUX 10.20 sed can't process this invocation -## correctly. Breaking it into two sed invocations is a workaround. - sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile" - rm -f "$tmpdepfile" "$tmpdepfile".bak - ;; - -cpp) - # Important note: in order to support this mode, a compiler *must* - # always write the preprocessed file to stdout. - "$@" || exit $? - - # Remove the call to Libtool. - if test "$libtool" = yes; then - while test $1 != '--mode=compile'; do - shift - done - shift - fi - - # Remove `-o $object'. - IFS=" " - for arg - do - case $arg in - -o) - shift - ;; - $object) - shift - ;; - *) - set fnord "$@" "$arg" - shift # fnord - shift # $arg - ;; - esac - done - - "$@" -E | - sed -n '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' | - sed '$ s: \\$::' > "$tmpdepfile" - rm -f "$depfile" - echo "$object : \\" > "$depfile" - cat < "$tmpdepfile" >> "$depfile" - sed < "$tmpdepfile" '/^$/d;s/^ //;s/ \\$//;s/$/ :/' >> "$depfile" - rm -f "$tmpdepfile" - ;; - -msvisualcpp) - # Important note: in order to support this mode, a compiler *must* - # always write the preprocessed file to stdout, regardless of -o, - # because we must use -o when running libtool. - "$@" || exit $? - IFS=" " - for arg - do - case "$arg" in - "-Gm"|"/Gm"|"-Gi"|"/Gi"|"-ZI"|"/ZI") - set fnord "$@" - shift - shift - ;; - *) - set fnord "$@" "$arg" - shift - shift - ;; - esac - done - "$@" -E | - sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::echo "`cygpath -u \\"\1\\"`":p' | sort | uniq > "$tmpdepfile" - rm -f "$depfile" - echo "$object : \\" > "$depfile" - . "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s:: \1 \\:p' >> "$depfile" - echo " " >> "$depfile" - . "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s::\1\::p' >> "$depfile" - rm -f "$tmpdepfile" - ;; - -none) - exec "$@" - ;; - -*) - echo "Unknown depmode $depmode" 1>&2 - exit 1 - ;; -esac - -exit 0 - -# Local Variables: -# mode: shell-script -# sh-indentation: 2 -# eval: (add-hook 'write-file-hooks 'time-stamp) -# time-stamp-start: "scriptversion=" -# time-stamp-format: "%:y-%02m-%02d.%02H" -# time-stamp-end: "$" -# End: diff --git a/src/bin/bison/config/install-sh b/src/bin/bison/config/install-sh deleted file mode 100644 index e4160c991d..0000000000 --- a/src/bin/bison/config/install-sh +++ /dev/null @@ -1,325 +0,0 @@ -#!/bin/sh -# install - install a program, script, or datafile - -scriptversion=2004-04-01.17 - -# This originates from X11R5 (mit/util/scripts/install.sh), which was -# later released in X11R6 (xc/config/util/install.sh) with the -# following copyright and license. -# -# Copyright (C) 1994 X Consortium -# -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to -# deal in the Software without restriction, including without limitation the -# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or -# sell copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -# AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNEC- -# TION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -# -# Except as contained in this notice, the name of the X Consortium shall not -# be used in advertising or otherwise to promote the sale, use or other deal- -# ings in this Software without prior written authorization from the X Consor- -# tium. -# -# -# FSF changes to this file are in the public domain. -# -# Calling this script install-sh is preferred over install.sh, to prevent -# `make' implicit rules from creating a file called install from it -# when there is no Makefile. -# -# This script is compatible with the BSD install script, but was written -# from scratch. It can only install one file at a time, a restriction -# shared with many OS's install programs. - -# set DOITPROG to echo to test this script - -# Don't use :- since 4.3BSD and earlier shells don't like it. -doit="${DOITPROG-}" - -# put in absolute paths if you don't have them in your path; or use env. vars. - -mvprog="${MVPROG-mv}" -cpprog="${CPPROG-cp}" -chmodprog="${CHMODPROG-chmod}" -chownprog="${CHOWNPROG-chown}" -chgrpprog="${CHGRPPROG-chgrp}" -stripprog="${STRIPPROG-strip}" -rmprog="${RMPROG-rm}" -mkdirprog="${MKDIRPROG-mkdir}" - -transformbasename= -transform_arg= -instcmd="$mvprog" -chmodcmd="$chmodprog 0755" -chowncmd= -chgrpcmd= -stripcmd= -rmcmd="$rmprog -f" -mvcmd="$mvprog" -src= -dst= -dir_arg= - -usage="Usage: $0 [OPTION]... SRCFILE DSTFILE - or: $0 [OPTION]... SRCFILES... DIRECTORY - or: $0 -d DIRECTORIES... - -In the first form, install SRCFILE to DSTFILE, removing SRCFILE by default. -In the second, create the directory path DIR. - -Options: --b=TRANSFORMBASENAME --c copy source (using $cpprog) instead of moving (using $mvprog). --d create directories instead of installing files. --g GROUP $chgrp installed files to GROUP. --m MODE $chmod installed files to MODE. --o USER $chown installed files to USER. --s strip installed files (using $stripprog). --t=TRANSFORM ---help display this help and exit. ---version display version info and exit. - -Environment variables override the default commands: - CHGRPPROG CHMODPROG CHOWNPROG CPPROG MKDIRPROG MVPROG RMPROG STRIPPROG -" - -while test -n "$1"; do - case $1 in - -b=*) transformbasename=`echo $1 | sed 's/-b=//'` - shift - continue;; - - -c) instcmd=$cpprog - shift - continue;; - - -d) dir_arg=true - shift - continue;; - - -g) chgrpcmd="$chgrpprog $2" - shift - shift - continue;; - - --help) echo "$usage"; exit 0;; - - -m) chmodcmd="$chmodprog $2" - shift - shift - continue;; - - -o) chowncmd="$chownprog $2" - shift - shift - continue;; - - -s) stripcmd=$stripprog - shift - continue;; - - -t=*) transformarg=`echo $1 | sed 's/-t=//'` - shift - continue;; - - --version) echo "$0 $scriptversion"; exit 0;; - - *) # When -d is used, all remaining arguments are directories to create. - test -n "$dir_arg" && break - # Otherwise, the last argument is the destination. Remove it from $@. - for arg - do - if test -n "$dstarg"; then - # $@ is not empty: it contains at least $arg. - set fnord "$@" "$dstarg" - shift # fnord - fi - shift # arg - dstarg=$arg - done - break;; - esac -done - -if test -z "$1"; then - if test -z "$dir_arg"; then - echo "$0: no input file specified." >&2 - exit 1 - fi - # It's OK to call `install-sh -d' without argument. - # This can happen when creating conditional directories. - exit 0 -fi - -for src -do - # Protect names starting with `-'. - case $src in - -*) src=./$src ;; - esac - - if test -n "$dir_arg"; then - dst=$src - src= - - if test -d "$dst"; then - instcmd=: - chmodcmd= - else - instcmd=$mkdirprog - fi - else - # Waiting for this to be detected by the "$instcmd $src $dsttmp" command - # might cause directories to be created, which would be especially bad - # if $src (and thus $dsttmp) contains '*'. - if test ! -f "$src" && test ! -d "$src"; then - echo "$0: $src does not exist." >&2 - exit 1 - fi - - if test -z "$dstarg"; then - echo "$0: no destination specified." >&2 - exit 1 - fi - - dst=$dstarg - # Protect names starting with `-'. - case $dst in - -*) dst=./$dst ;; - esac - - # If destination is a directory, append the input filename; won't work - # if double slashes aren't ignored. - if test -d "$dst"; then - dst=$dst/`basename "$src"` - fi - fi - - # This sed command emulates the dirname command. - dstdir=`echo "$dst" | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'` - - # Make sure that the destination directory exists. - - # Skip lots of stat calls in the usual case. - if test ! -d "$dstdir"; then - defaultIFS=' - ' - IFS="${IFS-$defaultIFS}" - - oIFS=$IFS - # Some sh's can't handle IFS=/ for some reason. - IFS='%' - set - `echo "$dstdir" | sed -e 's@/@%@g' -e 's@^%@/@'` - IFS=$oIFS - - pathcomp= - - while test $# -ne 0 ; do - pathcomp=$pathcomp$1 - shift - if test ! -d "$pathcomp"; then - $mkdirprog "$pathcomp" || lasterr=$? - # mkdir can fail with a `File exist' error in case several - # install-sh are creating the directory concurrently. This - # is OK. - test ! -d "$pathcomp" && { (exit ${lasterr-1}); exit; } - fi - pathcomp=$pathcomp/ - done - fi - - if test -n "$dir_arg"; then - $doit $instcmd "$dst" \ - && { test -z "$chowncmd" || $doit $chowncmd "$dst"; } \ - && { test -z "$chgrpcmd" || $doit $chgrpcmd "$dst"; } \ - && { test -z "$stripcmd" || $doit $stripcmd "$dst"; } \ - && { test -z "$chmodcmd" || $doit $chmodcmd "$dst"; } - - else - # If we're going to rename the final executable, determine the name now. - if test -z "$transformarg"; then - dstfile=`basename "$dst"` - else - dstfile=`basename "$dst" $transformbasename \ - | sed $transformarg`$transformbasename - fi - - # don't allow the sed command to completely eliminate the filename. - test -z "$dstfile" && dstfile=`basename "$dst"` - - # Make a couple of temp file names in the proper directory. - dsttmp=$dstdir/_inst.$$_ - rmtmp=$dstdir/_rm.$$_ - - # Trap to clean up those temp files at exit. - trap 'status=$?; rm -f "$dsttmp" "$rmtmp" && exit $status' 0 - trap '(exit $?); exit' 1 2 13 15 - - # Move or copy the file name to the temp name - $doit $instcmd "$src" "$dsttmp" && - - # and set any options; do chmod last to preserve setuid bits. - # - # If any of these fail, we abort the whole thing. If we want to - # ignore errors from any of these, just make sure not to ignore - # errors from the above "$doit $instcmd $src $dsttmp" command. - # - { test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } \ - && { test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } \ - && { test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } \ - && { test -z "$chmodcmd" || $doit $chmodcmd "$dsttmp"; } && - - # Now rename the file to the real destination. - { $doit $mvcmd -f "$dsttmp" "$dstdir/$dstfile" 2>/dev/null \ - || { - # The rename failed, perhaps because mv can't rename something else - # to itself, or perhaps because mv is so ancient that it does not - # support -f. - - # Now remove or move aside any old file at destination location. - # We try this two ways since rm can't unlink itself on some - # systems and the destination file might be busy for other - # reasons. In this case, the final cleanup might fail but the new - # file should still install successfully. - { - if test -f "$dstdir/$dstfile"; then - $doit $rmcmd -f "$dstdir/$dstfile" 2>/dev/null \ - || $doit $mvcmd -f "$dstdir/$dstfile" "$rmtmp" 2>/dev/null \ - || { - echo "$0: cannot unlink or rename $dstdir/$dstfile" >&2 - (exit 1); exit - } - else - : - fi - } && - - # Now rename the file to the real destination. - $doit $mvcmd "$dsttmp" "$dstdir/$dstfile" - } - } - fi || { (exit 1); exit; } -done - -# The final little trick to "correctly" pass the exit status to the exit trap. -{ - (exit 0); exit -} - -# Local variables: -# eval: (add-hook 'write-file-hooks 'time-stamp) -# time-stamp-start: "scriptversion=" -# time-stamp-format: "%:y-%02m-%02d.%02H" -# time-stamp-end: "$" -# End: diff --git a/src/bin/bison/config/mdate-sh b/src/bin/bison/config/mdate-sh deleted file mode 100644 index 05e828b081..0000000000 --- a/src/bin/bison/config/mdate-sh +++ /dev/null @@ -1,170 +0,0 @@ -#!/bin/sh -# Get modification time of a file or directory and pretty-print it. - -scriptversion=2003-11-09.00 - -# Copyright (C) 1995, 1996, 1997, 2003 Free Software Foundation, Inc. -# written by Ulrich Drepper , June 1995 -# -# 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 2, 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, write to the Free Software Foundation, -# Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - -# As a special exception to the GNU General Public License, if you -# distribute this file as part of a program that contains a -# configuration script generated by Autoconf, you may include it under -# the same distribution terms that you use for the rest of that program. - -# This file is maintained in Automake, please report -# bugs to or send patches to -# . - -case $1 in - '') - echo "$0: No file. Try \`$0 --help' for more information." 1>&2 - exit 1; - ;; - -h | --h*) - cat <<\EOF -Usage: mdate-sh [--help] [--version] FILE - -Pretty-print the modification time of FILE. - -Report bugs to . -EOF - exit 0 - ;; - -v | --v*) - echo "mdate-sh $scriptversion" - exit 0 - ;; -esac - -# Prevent date giving response in another language. -LANG=C -export LANG -LC_ALL=C -export LC_ALL -LC_TIME=C -export LC_TIME - -save_arg1="$1" - -# Find out how to get the extended ls output of a file or directory. -if ls -L /dev/null 1>/dev/null 2>&1; then - ls_command='ls -L -l -d' -else - ls_command='ls -l -d' -fi - -# A `ls -l' line looks as follows on OS/2. -# drwxrwx--- 0 Aug 11 2001 foo -# This differs from Unix, which adds ownership information. -# drwxrwx--- 2 root root 4096 Aug 11 2001 foo -# -# To find the date, we split the line on spaces and iterate on words -# until we find a month. This cannot work with files whose owner is a -# user named `Jan', or `Feb', etc. However, it's unlikely that `/' -# will be owned by a user whose name is a month. So we first look at -# the extended ls output of the root directory to decide how many -# words should be skipped to get the date. - -# On HPUX /bin/sh, "set" interprets "-rw-r--r--" as options, so the "x" below. -set - x`$ls_command /` - -# Find which argument is the month. -month= -command= -until test $month -do - shift - # Add another shift to the command. - command="$command shift;" - case $1 in - Jan) month=January; nummonth=1;; - Feb) month=February; nummonth=2;; - Mar) month=March; nummonth=3;; - Apr) month=April; nummonth=4;; - May) month=May; nummonth=5;; - Jun) month=June; nummonth=6;; - Jul) month=July; nummonth=7;; - Aug) month=August; nummonth=8;; - Sep) month=September; nummonth=9;; - Oct) month=October; nummonth=10;; - Nov) month=November; nummonth=11;; - Dec) month=December; nummonth=12;; - esac -done - -# Get the extended ls output of the file or directory. -set - x`eval "$ls_command \"\$save_arg1\""` - -# Remove all preceding arguments -eval $command - -# Get the month. Next argument is day, followed by the year or time. -case $1 in - Jan) month=January; nummonth=1;; - Feb) month=February; nummonth=2;; - Mar) month=March; nummonth=3;; - Apr) month=April; nummonth=4;; - May) month=May; nummonth=5;; - Jun) month=June; nummonth=6;; - Jul) month=July; nummonth=7;; - Aug) month=August; nummonth=8;; - Sep) month=September; nummonth=9;; - Oct) month=October; nummonth=10;; - Nov) month=November; nummonth=11;; - Dec) month=December; nummonth=12;; -esac - -day=$2 - -# Here we have to deal with the problem that the ls output gives either -# the time of day or the year. -case $3 in - *:*) set `date`; eval year=\$$# - case $2 in - Jan) nummonthtod=1;; - Feb) nummonthtod=2;; - Mar) nummonthtod=3;; - Apr) nummonthtod=4;; - May) nummonthtod=5;; - Jun) nummonthtod=6;; - Jul) nummonthtod=7;; - Aug) nummonthtod=8;; - Sep) nummonthtod=9;; - Oct) nummonthtod=10;; - Nov) nummonthtod=11;; - Dec) nummonthtod=12;; - esac - # For the first six month of the year the time notation can also - # be used for files modified in the last year. - if (expr $nummonth \> $nummonthtod) > /dev/null; - then - year=`expr $year - 1` - fi;; - *) year=$3;; -esac - -# The result. -echo $day $month $year - -# Local Variables: -# mode: shell-script -# sh-indentation: 2 -# eval: (add-hook 'write-file-hooks 'time-stamp) -# time-stamp-start: "scriptversion=" -# time-stamp-format: "%:y-%02m-%02d.%02H" -# time-stamp-end: "$" -# End: diff --git a/src/bin/bison/config/missing b/src/bin/bison/config/missing deleted file mode 100644 index e7ef83a1c2..0000000000 --- a/src/bin/bison/config/missing +++ /dev/null @@ -1,360 +0,0 @@ -#! /bin/sh -# Common stub for a few missing GNU programs while installing. - -scriptversion=2003-09-02.23 - -# Copyright (C) 1996, 1997, 1999, 2000, 2002, 2003 -# Free Software Foundation, Inc. -# Originally by Fran,cois Pinard , 1996. - -# 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 2, 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, write to the Free Software -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA -# 02111-1307, USA. - -# As a special exception to the GNU General Public License, if you -# distribute this file as part of a program that contains a -# configuration script generated by Autoconf, you may include it under -# the same distribution terms that you use for the rest of that program. - -if test $# -eq 0; then - echo 1>&2 "Try \`$0 --help' for more information" - exit 1 -fi - -run=: - -# In the cases where this matters, `missing' is being run in the -# srcdir already. -if test -f configure.ac; then - configure_ac=configure.ac -else - configure_ac=configure.in -fi - -msg="missing on your system" - -case "$1" in ---run) - # Try to run requested program, and just exit if it succeeds. - run= - shift - "$@" && exit 0 - # Exit code 63 means version mismatch. This often happens - # when the user try to use an ancient version of a tool on - # a file that requires a minimum version. In this case we - # we should proceed has if the program had been absent, or - # if --run hadn't been passed. - if test $? = 63; then - run=: - msg="probably too old" - fi - ;; -esac - -# If it does not exist, or fails to run (possibly an outdated version), -# try to emulate it. -case "$1" in - - -h|--h|--he|--hel|--help) - echo "\ -$0 [OPTION]... PROGRAM [ARGUMENT]... - -Handle \`PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an -error status if there is no known handling for PROGRAM. - -Options: - -h, --help display this help and exit - -v, --version output version information and exit - --run try to run the given command, and emulate it if it fails - -Supported PROGRAM values: - aclocal touch file \`aclocal.m4' - autoconf touch file \`configure' - autoheader touch file \`config.h.in' - automake touch all \`Makefile.in' files - bison create \`y.tab.[ch]', if possible, from existing .[ch] - flex create \`lex.yy.c', if possible, from existing .c - help2man touch the output file - lex create \`lex.yy.c', if possible, from existing .c - makeinfo touch the output file - tar try tar, gnutar, gtar, then tar without non-portable flags - yacc create \`y.tab.[ch]', if possible, from existing .[ch] - -Send bug reports to ." - ;; - - -v|--v|--ve|--ver|--vers|--versi|--versio|--version) - echo "missing $scriptversion (GNU Automake)" - ;; - - -*) - echo 1>&2 "$0: Unknown \`$1' option" - echo 1>&2 "Try \`$0 --help' for more information" - exit 1 - ;; - - aclocal*) - if test -z "$run" && ($1 --version) > /dev/null 2>&1; then - # We have it, but it failed. - exit 1 - fi - - echo 1>&2 "\ -WARNING: \`$1' is $msg. You should only need it if - you modified \`acinclude.m4' or \`${configure_ac}'. You might want - to install the \`Automake' and \`Perl' packages. Grab them from - any GNU archive site." - touch aclocal.m4 - ;; - - autoconf) - if test -z "$run" && ($1 --version) > /dev/null 2>&1; then - # We have it, but it failed. - exit 1 - fi - - echo 1>&2 "\ -WARNING: \`$1' is $msg. You should only need it if - you modified \`${configure_ac}'. You might want to install the - \`Autoconf' and \`GNU m4' packages. Grab them from any GNU - archive site." - touch configure - ;; - - autoheader) - if test -z "$run" && ($1 --version) > /dev/null 2>&1; then - # We have it, but it failed. - exit 1 - fi - - echo 1>&2 "\ -WARNING: \`$1' is $msg. You should only need it if - you modified \`acconfig.h' or \`${configure_ac}'. You might want - to install the \`Autoconf' and \`GNU m4' packages. Grab them - from any GNU archive site." - files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER(\([^)]*\)).*/\1/p' ${configure_ac}` - test -z "$files" && files="config.h" - touch_files= - for f in $files; do - case "$f" in - *:*) touch_files="$touch_files "`echo "$f" | - sed -e 's/^[^:]*://' -e 's/:.*//'`;; - *) touch_files="$touch_files $f.in";; - esac - done - touch $touch_files - ;; - - automake*) - if test -z "$run" && ($1 --version) > /dev/null 2>&1; then - # We have it, but it failed. - exit 1 - fi - - echo 1>&2 "\ -WARNING: \`$1' is $msg. You should only need it if - you modified \`Makefile.am', \`acinclude.m4' or \`${configure_ac}'. - You might want to install the \`Automake' and \`Perl' packages. - Grab them from any GNU archive site." - find . -type f -name Makefile.am -print | - sed 's/\.am$/.in/' | - while read f; do touch "$f"; done - ;; - - autom4te) - if test -z "$run" && ($1 --version) > /dev/null 2>&1; then - # We have it, but it failed. - exit 1 - fi - - echo 1>&2 "\ -WARNING: \`$1' is needed, but is $msg. - You might have modified some files without having the - proper tools for further handling them. - You can get \`$1' as part of \`Autoconf' from any GNU - archive site." - - file=`echo "$*" | sed -n 's/.*--output[ =]*\([^ ]*\).*/\1/p'` - test -z "$file" && file=`echo "$*" | sed -n 's/.*-o[ ]*\([^ ]*\).*/\1/p'` - if test -f "$file"; then - touch $file - else - test -z "$file" || exec >$file - echo "#! /bin/sh" - echo "# Created by GNU Automake missing as a replacement of" - echo "# $ $@" - echo "exit 0" - chmod +x $file - exit 1 - fi - ;; - - bison|yacc) - echo 1>&2 "\ -WARNING: \`$1' $msg. You should only need it if - you modified a \`.y' file. You may need the \`Bison' package - in order for those modifications to take effect. You can get - \`Bison' from any GNU archive site." - rm -f y.tab.c y.tab.h - if [ $# -ne 1 ]; then - eval LASTARG="\${$#}" - case "$LASTARG" in - *.y) - SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'` - if [ -f "$SRCFILE" ]; then - cp "$SRCFILE" y.tab.c - fi - SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'` - if [ -f "$SRCFILE" ]; then - cp "$SRCFILE" y.tab.h - fi - ;; - esac - fi - if [ ! -f y.tab.h ]; then - echo >y.tab.h - fi - if [ ! -f y.tab.c ]; then - echo 'main() { return 0; }' >y.tab.c - fi - ;; - - lex|flex) - echo 1>&2 "\ -WARNING: \`$1' is $msg. You should only need it if - you modified a \`.l' file. You may need the \`Flex' package - in order for those modifications to take effect. You can get - \`Flex' from any GNU archive site." - rm -f lex.yy.c - if [ $# -ne 1 ]; then - eval LASTARG="\${$#}" - case "$LASTARG" in - *.l) - SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'` - if [ -f "$SRCFILE" ]; then - cp "$SRCFILE" lex.yy.c - fi - ;; - esac - fi - if [ ! -f lex.yy.c ]; then - echo 'main() { return 0; }' >lex.yy.c - fi - ;; - - help2man) - if test -z "$run" && ($1 --version) > /dev/null 2>&1; then - # We have it, but it failed. - exit 1 - fi - - echo 1>&2 "\ -WARNING: \`$1' is $msg. You should only need it if - you modified a dependency of a manual page. You may need the - \`Help2man' package in order for those modifications to take - effect. You can get \`Help2man' from any GNU archive site." - - file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'` - if test -z "$file"; then - file=`echo "$*" | sed -n 's/.*--output=\([^ ]*\).*/\1/p'` - fi - if [ -f "$file" ]; then - touch $file - else - test -z "$file" || exec >$file - echo ".ab help2man is required to generate this page" - exit 1 - fi - ;; - - makeinfo) - if test -z "$run" && (makeinfo --version) > /dev/null 2>&1; then - # We have makeinfo, but it failed. - exit 1 - fi - - echo 1>&2 "\ -WARNING: \`$1' is $msg. You should only need it if - you modified a \`.texi' or \`.texinfo' file, or any other file - indirectly affecting the aspect of the manual. The spurious - call might also be the consequence of using a buggy \`make' (AIX, - DU, IRIX). You might want to install the \`Texinfo' package or - the \`GNU make' package. Grab either from any GNU archive site." - file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'` - if test -z "$file"; then - file=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'` - file=`sed -n '/^@setfilename/ { s/.* \([^ ]*\) *$/\1/; p; q; }' $file` - fi - touch $file - ;; - - tar) - shift - if test -n "$run"; then - echo 1>&2 "ERROR: \`tar' requires --run" - exit 1 - fi - - # We have already tried tar in the generic part. - # Look for gnutar/gtar before invocation to avoid ugly error - # messages. - if (gnutar --version > /dev/null 2>&1); then - gnutar "$@" && exit 0 - fi - if (gtar --version > /dev/null 2>&1); then - gtar "$@" && exit 0 - fi - firstarg="$1" - if shift; then - case "$firstarg" in - *o*) - firstarg=`echo "$firstarg" | sed s/o//` - tar "$firstarg" "$@" && exit 0 - ;; - esac - case "$firstarg" in - *h*) - firstarg=`echo "$firstarg" | sed s/h//` - tar "$firstarg" "$@" && exit 0 - ;; - esac - fi - - echo 1>&2 "\ -WARNING: I can't seem to be able to run \`tar' with the given arguments. - You may want to install GNU tar or Free paxutils, or check the - command line arguments." - exit 1 - ;; - - *) - echo 1>&2 "\ -WARNING: \`$1' is needed, and is $msg. - You might have modified some files without having the - proper tools for further handling them. Check the \`README' file, - it often tells you about the needed prerequisites for installing - this package. You may also peek at any GNU archive site, in case - some other package would contain this missing \`$1' program." - exit 1 - ;; -esac - -exit 0 - -# Local variables: -# eval: (add-hook 'write-file-hooks 'time-stamp) -# time-stamp-start: "scriptversion=" -# time-stamp-format: "%:y-%02m-%02d.%02H" -# time-stamp-end: "$" -# End: diff --git a/src/bin/bison/config/mkinstalldirs b/src/bin/bison/config/mkinstalldirs deleted file mode 100644 index 6fbe5e1176..0000000000 --- a/src/bin/bison/config/mkinstalldirs +++ /dev/null @@ -1,150 +0,0 @@ -#! /bin/sh -# mkinstalldirs --- make directory hierarchy - -scriptversion=2004-02-15.20 - -# Original author: Noah Friedman -# Created: 1993-05-16 -# Public domain. -# -# This file is maintained in Automake, please report -# bugs to or send patches to -# . - -errstatus=0 -dirmode="" - -usage="\ -Usage: mkinstalldirs [-h] [--help] [--version] [-m MODE] DIR ... - -Create each directory DIR (with mode MODE, if specified), including all -leading file name components. - -Report bugs to ." - -# process command line arguments -while test $# -gt 0 ; do - case $1 in - -h | --help | --h*) # -h for help - echo "$usage" - exit 0 - ;; - -m) # -m PERM arg - shift - test $# -eq 0 && { echo "$usage" 1>&2; exit 1; } - dirmode=$1 - shift - ;; - --version) - echo "$0 $scriptversion" - exit 0 - ;; - --) # stop option processing - shift - break - ;; - -*) # unknown option - echo "$usage" 1>&2 - exit 1 - ;; - *) # first non-opt arg - break - ;; - esac -done - -for file -do - if test -d "$file"; then - shift - else - break - fi -done - -case $# in - 0) exit 0 ;; -esac - -# Solaris 8's mkdir -p isn't thread-safe. If you mkdir -p a/b and -# mkdir -p a/c at the same time, both will detect that a is missing, -# one will create a, then the other will try to create a and die with -# a "File exists" error. This is a problem when calling mkinstalldirs -# from a parallel make. We use --version in the probe to restrict -# ourselves to GNU mkdir, which is thread-safe. -case $dirmode in - '') - if mkdir -p --version . >/dev/null 2>&1 && test ! -d ./--version; then - echo "mkdir -p -- $*" - exec mkdir -p -- "$@" - else - # On NextStep and OpenStep, the `mkdir' command does not - # recognize any option. It will interpret all options as - # directories to create, and then abort because `.' already - # exists. - test -d ./-p && rmdir ./-p - test -d ./--version && rmdir ./--version - fi - ;; - *) - if mkdir -m "$dirmode" -p --version . >/dev/null 2>&1 && - test ! -d ./--version; then - echo "mkdir -m $dirmode -p -- $*" - exec mkdir -m "$dirmode" -p -- "$@" - else - # Clean up after NextStep and OpenStep mkdir. - for d in ./-m ./-p ./--version "./$dirmode"; - do - test -d $d && rmdir $d - done - fi - ;; -esac - -for file -do - set fnord `echo ":$file" | sed -ne 's/^:\//#/;s/^://;s/\// /g;s/^#/\//;p'` - shift - - pathcomp= - for d - do - pathcomp="$pathcomp$d" - case $pathcomp in - -*) pathcomp=./$pathcomp ;; - esac - - if test ! -d "$pathcomp"; then - echo "mkdir $pathcomp" - - mkdir "$pathcomp" || lasterr=$? - - if test ! -d "$pathcomp"; then - errstatus=$lasterr - else - if test ! -z "$dirmode"; then - echo "chmod $dirmode $pathcomp" - lasterr="" - chmod "$dirmode" "$pathcomp" || lasterr=$? - - if test ! -z "$lasterr"; then - errstatus=$lasterr - fi - fi - fi - fi - - pathcomp="$pathcomp/" - done -done - -exit $errstatus - -# Local Variables: -# mode: shell-script -# sh-indentation: 2 -# eval: (add-hook 'write-file-hooks 'time-stamp) -# time-stamp-start: "scriptversion=" -# time-stamp-format: "%:y-%02m-%02d.%02H" -# time-stamp-end: "$" -# End: diff --git a/src/bin/bison/config/move-if-change b/src/bin/bison/config/move-if-change deleted file mode 100644 index 66d8b8adc7..0000000000 --- a/src/bin/bison/config/move-if-change +++ /dev/null @@ -1,17 +0,0 @@ -#!/bin/sh -# Like mv $1 $2, but if the files are the same, just delete $1. -# Status is 0 if $2 is changed, 1 otherwise. -if -test -r $2 -then -if -cmp -s $1 $2 -then -echo $2 is unchanged -rm -f $1 -else -mv -f $1 $2 -fi -else -mv -f $1 $2 -fi diff --git a/src/bin/bison/config/prev-version.txt b/src/bin/bison/config/prev-version.txt deleted file mode 100644 index 07cde98405..0000000000 --- a/src/bin/bison/config/prev-version.txt +++ /dev/null @@ -1 +0,0 @@ -1.75 diff --git a/src/bin/bison/config/texinfo.tex b/src/bin/bison/config/texinfo.tex deleted file mode 100644 index 6c8536c4d4..0000000000 --- a/src/bin/bison/config/texinfo.tex +++ /dev/null @@ -1,7006 +0,0 @@ -% texinfo.tex -- TeX macros to handle Texinfo files. -% -% Load plain if necessary, i.e., if running under initex. -\expandafter\ifx\csname fmtname\endcsname\relax\input plain\fi -% -\def\texinfoversion{2004-05-16.08} -% -% Copyright (C) 1985, 1986, 1988, 1990, 1991, 1992, 1993, 1994, 1995, -% 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004 Free Software -% Foundation, Inc. -% -% This texinfo.tex file 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 2, or (at -% your option) any later version. -% -% This texinfo.tex file 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 texinfo.tex file; see the file COPYING. If not, write -% to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, -% Boston, MA 02111-1307, USA. -% -% As a special exception, when this file is read by TeX when processing -% a Texinfo source document, you may use the result without -% restriction. (This has been our intent since Texinfo was invented.) -% -% Please try the latest version of texinfo.tex before submitting bug -% reports; you can get the latest version from: -% http://www.gnu.org/software/texinfo/ (the Texinfo home page), or -% ftp://tug.org/tex/texinfo.tex -% (and all CTAN mirrors, see http://www.ctan.org). -% The texinfo.tex in any given distribution could well be out -% of date, so if that's what you're using, please check. -% -% Send bug reports to bug-texinfo@gnu.org. Please include including a -% complete document in each bug report with which we can reproduce the -% problem. Patches are, of course, greatly appreciated. -% -% To process a Texinfo manual with TeX, it's most reliable to use the -% texi2dvi shell script that comes with the distribution. For a simple -% manual foo.texi, however, you can get away with this: -% tex foo.texi -% texindex foo.?? -% tex foo.texi -% tex foo.texi -% dvips foo.dvi -o # or whatever; this makes foo.ps. -% The extra TeX runs get the cross-reference information correct. -% Sometimes one run after texindex suffices, and sometimes you need more -% than two; texi2dvi does it as many times as necessary. -% -% It is possible to adapt texinfo.tex for other languages, to some -% extent. You can get the existing language-specific files from the -% full Texinfo distribution. -% -% The GNU Texinfo home page is http://www.gnu.org/software/texinfo. - - -\message{Loading texinfo [version \texinfoversion]:} - -% If in a .fmt file, print the version number -% and turn on active characters that we couldn't do earlier because -% they might have appeared in the input file name. -\everyjob{\message{[Texinfo version \texinfoversion]}% - \catcode`+=\active \catcode`\_=\active} - -\message{Basics,} -\chardef\other=12 - -% We never want plain's \outer definition of \+ in Texinfo. -% For @tex, we can use \tabalign. -\let\+ = \relax - -% Save some plain tex macros whose names we will redefine. -\let\ptexb=\b -\let\ptexbullet=\bullet -\let\ptexc=\c -\let\ptexcomma=\, -\let\ptexdot=\. -\let\ptexdots=\dots -\let\ptexend=\end -\let\ptexequiv=\equiv -\let\ptexexclam=\! -\let\ptexfootnote=\footnote -\let\ptexgtr=> -\let\ptexhat=^ -\let\ptexi=\i -\let\ptexindent=\indent -\let\ptexnoindent=\noindent -\let\ptexinsert=\insert -\let\ptexlbrace=\{ -\let\ptexless=< -\let\ptexplus=+ -\let\ptexrbrace=\} -\let\ptexslash=\/ -\let\ptexstar=\* -\let\ptext=\t - -% If this character appears in an error message or help string, it -% starts a new line in the output. -\newlinechar = `^^J - -% Use TeX 3.0's \inputlineno to get the line number, for better error -% messages, but if we're using an old version of TeX, don't do anything. -% -\ifx\inputlineno\thisisundefined - \let\linenumber = \empty % Pre-3.0. -\else - \def\linenumber{l.\the\inputlineno:\space} -\fi - -% Set up fixed words for English if not already set. -\ifx\putwordAppendix\undefined \gdef\putwordAppendix{Appendix}\fi -\ifx\putwordChapter\undefined \gdef\putwordChapter{Chapter}\fi -\ifx\putwordfile\undefined \gdef\putwordfile{file}\fi -\ifx\putwordin\undefined \gdef\putwordin{in}\fi -\ifx\putwordIndexIsEmpty\undefined \gdef\putwordIndexIsEmpty{(Index is empty)}\fi -\ifx\putwordIndexNonexistent\undefined \gdef\putwordIndexNonexistent{(Index is nonexistent)}\fi -\ifx\putwordInfo\undefined \gdef\putwordInfo{Info}\fi -\ifx\putwordInstanceVariableof\undefined \gdef\putwordInstanceVariableof{Instance Variable of}\fi -\ifx\putwordMethodon\undefined \gdef\putwordMethodon{Method on}\fi -\ifx\putwordNoTitle\undefined \gdef\putwordNoTitle{No Title}\fi -\ifx\putwordof\undefined \gdef\putwordof{of}\fi -\ifx\putwordon\undefined \gdef\putwordon{on}\fi -\ifx\putwordpage\undefined \gdef\putwordpage{page}\fi -\ifx\putwordsection\undefined \gdef\putwordsection{section}\fi -\ifx\putwordSection\undefined \gdef\putwordSection{Section}\fi -\ifx\putwordsee\undefined \gdef\putwordsee{see}\fi -\ifx\putwordSee\undefined \gdef\putwordSee{See}\fi -\ifx\putwordShortTOC\undefined \gdef\putwordShortTOC{Short Contents}\fi -\ifx\putwordTOC\undefined \gdef\putwordTOC{Table of Contents}\fi -% -\ifx\putwordMJan\undefined \gdef\putwordMJan{January}\fi -\ifx\putwordMFeb\undefined \gdef\putwordMFeb{February}\fi -\ifx\putwordMMar\undefined \gdef\putwordMMar{March}\fi -\ifx\putwordMApr\undefined \gdef\putwordMApr{April}\fi -\ifx\putwordMMay\undefined \gdef\putwordMMay{May}\fi -\ifx\putwordMJun\undefined \gdef\putwordMJun{June}\fi -\ifx\putwordMJul\undefined \gdef\putwordMJul{July}\fi -\ifx\putwordMAug\undefined \gdef\putwordMAug{August}\fi -\ifx\putwordMSep\undefined \gdef\putwordMSep{September}\fi -\ifx\putwordMOct\undefined \gdef\putwordMOct{October}\fi -\ifx\putwordMNov\undefined \gdef\putwordMNov{November}\fi -\ifx\putwordMDec\undefined \gdef\putwordMDec{December}\fi -% -\ifx\putwordDefmac\undefined \gdef\putwordDefmac{Macro}\fi -\ifx\putwordDefspec\undefined \gdef\putwordDefspec{Special Form}\fi -\ifx\putwordDefvar\undefined \gdef\putwordDefvar{Variable}\fi -\ifx\putwordDefopt\undefined \gdef\putwordDefopt{User Option}\fi -\ifx\putwordDeffunc\undefined \gdef\putwordDeffunc{Function}\fi - -% In some macros, we cannot use the `\? notation---the left quote is -% in some cases the escape char. -\chardef\colonChar = `\: -\chardef\commaChar = `\, -\chardef\dotChar = `\. -\chardef\exclamChar= `\! -\chardef\questChar = `\? -\chardef\semiChar = `\; -\chardef\underChar = `\_ - -\chardef\spaceChar = `\ % -\chardef\spacecat = 10 -\def\spaceisspace{\catcode\spaceChar=\spacecat} - -% Ignore a token. -% -\def\gobble#1{} - -% The following is used inside several \edef's. -\def\makecsname#1{\expandafter\noexpand\csname#1\endcsname} - -% Hyphenation fixes. -\hyphenation{ - Flor-i-da Ghost-script Ghost-view Mac-OS Post-Script - ap-pen-dix bit-map bit-maps - data-base data-bases eshell fall-ing half-way long-est man-u-script - man-u-scripts mini-buf-fer mini-buf-fers over-view par-a-digm - par-a-digms rath-er rec-tan-gu-lar ro-bot-ics se-vere-ly set-up spa-ces - spell-ing spell-ings - stand-alone strong-est time-stamp time-stamps which-ever white-space - wide-spread wrap-around -} - -% Margin to add to right of even pages, to left of odd pages. -\newdimen\bindingoffset -\newdimen\normaloffset -\newdimen\pagewidth \newdimen\pageheight - -% For a final copy, take out the rectangles -% that mark overfull boxes (in case you have decided -% that the text looks ok even though it passes the margin). -% -\def\finalout{\overfullrule=0pt} - -% @| inserts a changebar to the left of the current line. It should -% surround any changed text. This approach does *not* work if the -% change spans more than two lines of output. To handle that, we would -% have adopt a much more difficult approach (putting marks into the main -% vertical list for the beginning and end of each change). -% -\def\|{% - % \vadjust can only be used in horizontal mode. - \leavevmode - % - % Append this vertical mode material after the current line in the output. - \vadjust{% - % We want to insert a rule with the height and depth of the current - % leading; that is exactly what \strutbox is supposed to record. - \vskip-\baselineskip - % - % \vadjust-items are inserted at the left edge of the type. So - % the \llap here moves out into the left-hand margin. - \llap{% - % - % For a thicker or thinner bar, change the `1pt'. - \vrule height\baselineskip width1pt - % - % This is the space between the bar and the text. - \hskip 12pt - }% - }% -} - -% Sometimes it is convenient to have everything in the transcript file -% and nothing on the terminal. We don't just call \tracingall here, -% since that produces some useless output on the terminal. We also make -% some effort to order the tracing commands to reduce output in the log -% file; cf. trace.sty in LaTeX. -% -\def\gloggingall{\begingroup \globaldefs = 1 \loggingall \endgroup}% -\def\loggingall{% - \tracingstats2 - \tracingpages1 - \tracinglostchars2 % 2 gives us more in etex - \tracingparagraphs1 - \tracingoutput1 - \tracingmacros2 - \tracingrestores1 - \showboxbreadth\maxdimen \showboxdepth\maxdimen - \ifx\eTeXversion\undefined\else % etex gives us more logging - \tracingscantokens1 - \tracingifs1 - \tracinggroups1 - \tracingnesting2 - \tracingassigns1 - \fi - \tracingcommands3 % 3 gives us more in etex - \errorcontextlines16 -}% - -% add check for \lastpenalty to plain's definitions. If the last thing -% we did was a \nobreak, we don't want to insert more space. -% -\def\smallbreak{\ifnum\lastpenalty<10000\par\ifdim\lastskip<\smallskipamount - \removelastskip\penalty-50\smallskip\fi\fi} -\def\medbreak{\ifnum\lastpenalty<10000\par\ifdim\lastskip<\medskipamount - \removelastskip\penalty-100\medskip\fi\fi} -\def\bigbreak{\ifnum\lastpenalty<10000\par\ifdim\lastskip<\bigskipamount - \removelastskip\penalty-200\bigskip\fi\fi} - -% For @cropmarks command. -% Do @cropmarks to get crop marks. -% -\newif\ifcropmarks -\let\cropmarks = \cropmarkstrue -% -% Dimensions to add cropmarks at corners. -% Added by P. A. MacKay, 12 Nov. 1986 -% -\newdimen\outerhsize \newdimen\outervsize % set by the paper size routines -\newdimen\cornerlong \cornerlong=1pc -\newdimen\cornerthick \cornerthick=.3pt -\newdimen\topandbottommargin \topandbottommargin=.75in - -% Main output routine. -\chardef\PAGE = 255 -\output = {\onepageout{\pagecontents\PAGE}} - -\newbox\headlinebox -\newbox\footlinebox - -% \onepageout takes a vbox as an argument. Note that \pagecontents -% does insertions, but you have to call it yourself. -\def\onepageout#1{% - \ifcropmarks \hoffset=0pt \else \hoffset=\normaloffset \fi - % - \ifodd\pageno \advance\hoffset by \bindingoffset - \else \advance\hoffset by -\bindingoffset\fi - % - % Do this outside of the \shipout so @code etc. will be expanded in - % the headline as they should be, not taken literally (outputting ''code). - \setbox\headlinebox = \vbox{\let\hsize=\pagewidth \makeheadline}% - \setbox\footlinebox = \vbox{\let\hsize=\pagewidth \makefootline}% - % - {% - % Have to do this stuff outside the \shipout because we want it to - % take effect in \write's, yet the group defined by the \vbox ends - % before the \shipout runs. - % - \escapechar = `\\ % use backslash in output files. - \indexdummies % don't expand commands in the output. - \normalturnoffactive % \ in index entries must not stay \, e.g., if - % the page break happens to be in the middle of an example. - \shipout\vbox{% - % Do this early so pdf references go to the beginning of the page. - \ifpdfmakepagedest \pdfdest name{\the\pageno} xyz\fi - % - \ifcropmarks \vbox to \outervsize\bgroup - \hsize = \outerhsize - \vskip-\topandbottommargin - \vtop to0pt{% - \line{\ewtop\hfil\ewtop}% - \nointerlineskip - \line{% - \vbox{\moveleft\cornerthick\nstop}% - \hfill - \vbox{\moveright\cornerthick\nstop}% - }% - \vss}% - \vskip\topandbottommargin - \line\bgroup - \hfil % center the page within the outer (page) hsize. - \ifodd\pageno\hskip\bindingoffset\fi - \vbox\bgroup - \fi - % - \unvbox\headlinebox - \pagebody{#1}% - \ifdim\ht\footlinebox > 0pt - % Only leave this space if the footline is nonempty. - % (We lessened \vsize for it in \oddfootingxxx.) - % The \baselineskip=24pt in plain's \makefootline has no effect. - \vskip 2\baselineskip - \unvbox\footlinebox - \fi - % - \ifcropmarks - \egroup % end of \vbox\bgroup - \hfil\egroup % end of (centering) \line\bgroup - \vskip\topandbottommargin plus1fill minus1fill - \boxmaxdepth = \cornerthick - \vbox to0pt{\vss - \line{% - \vbox{\moveleft\cornerthick\nsbot}% - \hfill - \vbox{\moveright\cornerthick\nsbot}% - }% - \nointerlineskip - \line{\ewbot\hfil\ewbot}% - }% - \egroup % \vbox from first cropmarks clause - \fi - }% end of \shipout\vbox - }% end of group with \normalturnoffactive - \advancepageno - \ifnum\outputpenalty>-20000 \else\dosupereject\fi -} - -\newinsert\margin \dimen\margin=\maxdimen - -\def\pagebody#1{\vbox to\pageheight{\boxmaxdepth=\maxdepth #1}} -{\catcode`\@ =11 -\gdef\pagecontents#1{\ifvoid\topins\else\unvbox\topins\fi -% marginal hacks, juha@viisa.uucp (Juha Takala) -\ifvoid\margin\else % marginal info is present - \rlap{\kern\hsize\vbox to\z@{\kern1pt\box\margin \vss}}\fi -\dimen@=\dp#1 \unvbox#1 -\ifvoid\footins\else\vskip\skip\footins\footnoterule \unvbox\footins\fi -\ifr@ggedbottom \kern-\dimen@ \vfil \fi} -} - -% Here are the rules for the cropmarks. Note that they are -% offset so that the space between them is truly \outerhsize or \outervsize -% (P. A. MacKay, 12 November, 1986) -% -\def\ewtop{\vrule height\cornerthick depth0pt width\cornerlong} -\def\nstop{\vbox - {\hrule height\cornerthick depth\cornerlong width\cornerthick}} -\def\ewbot{\vrule height0pt depth\cornerthick width\cornerlong} -\def\nsbot{\vbox - {\hrule height\cornerlong depth\cornerthick width\cornerthick}} - -% Parse an argument, then pass it to #1. The argument is the rest of -% the input line (except we remove a trailing comment). #1 should be a -% macro which expects an ordinary undelimited TeX argument. -% -\def\parsearg{\parseargusing{}} -\def\parseargusing#1#2{% - \def\next{#2}% - \begingroup - \obeylines - \spaceisspace - #1% - \parseargline\empty% Insert the \empty token, see \finishparsearg below. -} - -{\obeylines % - \gdef\parseargline#1^^M{% - \endgroup % End of the group started in \parsearg. - \argremovecomment #1\comment\ArgTerm% - }% -} - -% First remove any @comment, then any @c comment. -\def\argremovecomment#1\comment#2\ArgTerm{\argremovec #1\c\ArgTerm} -\def\argremovec#1\c#2\ArgTerm{\argcheckspaces#1\^^M\ArgTerm} - -% Each occurence of `\^^M' or `\^^M' is replaced by a single space. -% -% \argremovec might leave us with trailing space, e.g., -% @end itemize @c foo -% This space token undergoes the same procedure and is eventually removed -% by \finishparsearg. -% -\def\argcheckspaces#1\^^M{\argcheckspacesX#1\^^M \^^M} -\def\argcheckspacesX#1 \^^M{\argcheckspacesY#1\^^M} -\def\argcheckspacesY#1\^^M#2\^^M#3\ArgTerm{% - \def\temp{#3}% - \ifx\temp\empty - % We cannot use \next here, as it holds the macro to run; - % thus we reuse \temp. - \let\temp\finishparsearg - \else - \let\temp\argcheckspaces - \fi - % Put the space token in: - \temp#1 #3\ArgTerm -} - -% If a _delimited_ argument is enclosed in braces, they get stripped; so -% to get _exactly_ the rest of the line, we had to prevent such situation. -% We prepended an \empty token at the very beginning and we expand it now, -% just before passing the control to \next. -% (Similarily, we have to think about #3 of \argcheckspacesY above: it is -% either the null string, or it ends with \^^M---thus there is no danger -% that a pair of braces would be stripped. -% -% But first, we have to remove the trailing space token. -% -\def\finishparsearg#1 \ArgTerm{\expandafter\next\expandafter{#1}} - -% \parseargdef\foo{...} -% is roughly equivalent to -% \def\foo{\parsearg\Xfoo} -% \def\Xfoo#1{...} -% -% Actually, I use \csname\string\foo\endcsname, ie. \\foo, as it is my -% favourite TeX trick. --kasal, 16nov03 - -\def\parseargdef#1{% - \expandafter \doparseargdef \csname\string#1\endcsname #1% -} -\def\doparseargdef#1#2{% - \def#2{\parsearg#1}% - \def#1##1% -} - -% Several utility definitions with active space: -{ - \obeyspaces - \gdef\obeyedspace{ } - - % Make each space character in the input produce a normal interword - % space in the output. Don't allow a line break at this space, as this - % is used only in environments like @example, where each line of input - % should produce a line of output anyway. - % - \gdef\sepspaces{\obeyspaces\let =\tie} - - % If an index command is used in an @example environment, any spaces - % therein should become regular spaces in the raw index file, not the - % expansion of \tie (\leavevmode \penalty \@M \ ). - \gdef\unsepspaces{\let =\space} -} - - -\def\flushcr{\ifx\par\lisppar \def\next##1{}\else \let\next=\relax \fi \next} - -% Define the framework for environments in texinfo.tex. It's used like this: -% -% \envdef\foo{...} -% \def\Efoo{...} -% -% It's the responsibility of \envdef to insert \begingroup before the -% actual body; @end closes the group after calling \Efoo. \envdef also -% defines \thisenv, so the current environment is known; @end checks -% whether the environment name matches. The \checkenv macro can also be -% used to check whether the current environment is the one expected. -% -% Non-false conditionals (@iftex, @ifset) don't fit into this, so they -% are not treated as enviroments; they don't open a group. (The -% implementation of @end takes care not to call \endgroup in this -% special case.) - - -% At runtime, environments start with this: -\def\startenvironment#1{\begingroup\def\thisenv{#1}} -% initialize -\let\thisenv\empty - -% ... but they get defined via ``\envdef\foo{...}'': -\long\def\envdef#1#2{\def#1{\startenvironment#1#2}} -\def\envparseargdef#1#2{\parseargdef#1{\startenvironment#1#2}} - -% Check whether we're in the right environment: -\def\checkenv#1{% - \def\temp{#1}% - \ifx\thisenv\temp - \else - \badenverr - \fi -} - -% Evironment mismatch, #1 expected: -\def\badenverr{% - \errhelp = \EMsimple - \errmessage{This command can appear only \inenvironment\temp, - not \inenvironment\thisenv}% -} -\def\inenvironment#1{% - \ifx#1\empty - out of any environment% - \else - in environment \expandafter\string#1% - \fi -} - -% @end foo executes the definition of \Efoo. -% But first, it executes a specialized version of \checkenv -% -\parseargdef\end{% - \if 1\csname iscond.#1\endcsname - \else - % The general wording of \badenverr may not be ideal, but... --kasal, 06nov03 - \expandafter\checkenv\csname#1\endcsname - \csname E#1\endcsname - \endgroup - \fi -} - -\newhelp\EMsimple{Press RETURN to continue.} - - -%% Simple single-character @ commands - -% @@ prints an @ -% Kludge this until the fonts are right (grr). -\def\@{{\tt\char64}} - -% This is turned off because it was never documented -% and you can use @w{...} around a quote to suppress ligatures. -%% Define @` and @' to be the same as ` and ' -%% but suppressing ligatures. -%\def\`{{`}} -%\def\'{{'}} - -% Used to generate quoted braces. -\def\mylbrace {{\tt\char123}} -\def\myrbrace {{\tt\char125}} -\let\{=\mylbrace -\let\}=\myrbrace -\begingroup - % Definitions to produce \{ and \} commands for indices, - % and @{ and @} for the aux file. - \catcode`\{ = \other \catcode`\} = \other - \catcode`\[ = 1 \catcode`\] = 2 - \catcode`\! = 0 \catcode`\\ = \other - !gdef!lbracecmd[\{]% - !gdef!rbracecmd[\}]% - !gdef!lbraceatcmd[@{]% - !gdef!rbraceatcmd[@}]% -!endgroup - -% @comma{} to avoid , parsing problems. -\let\comma = , - -% Accents: @, @dotaccent @ringaccent @ubaraccent @udotaccent -% Others are defined by plain TeX: @` @' @" @^ @~ @= @u @v @H. -\let\, = \c -\let\dotaccent = \. -\def\ringaccent#1{{\accent23 #1}} -\let\tieaccent = \t -\let\ubaraccent = \b -\let\udotaccent = \d - -% Other special characters: @questiondown @exclamdown @ordf @ordm -% Plain TeX defines: @AA @AE @O @OE @L (plus lowercase versions) @ss. -\def\questiondown{?`} -\def\exclamdown{!`} -\def\ordf{\leavevmode\raise1ex\hbox{\selectfonts\lllsize \underbar{a}}} -\def\ordm{\leavevmode\raise1ex\hbox{\selectfonts\lllsize \underbar{o}}} - -% Dotless i and dotless j, used for accents. -\def\imacro{i} -\def\jmacro{j} -\def\dotless#1{% - \def\temp{#1}% - \ifx\temp\imacro \ptexi - \else\ifx\temp\jmacro \j - \else \errmessage{@dotless can be used only with i or j}% - \fi\fi -} - -% The \TeX{} logo, as in plain, but resetting the spacing so that a -% period following counts as ending a sentence. (Idea found in latex.) -% -\edef\TeX{\TeX \spacefactor=3000 } - -% @LaTeX{} logo. Not quite the same results as the definition in -% latex.ltx, since we use a different font for the raised A; it's most -% convenient for us to use an explicitly smaller font, rather than using -% the \scriptstyle font (since we don't reset \scriptstyle and -% \scriptscriptstyle). -% -\def\LaTeX{% - L\kern-.36em - {\setbox0=\hbox{T}% - \vbox to \ht0{\hbox{\selectfonts\lllsize A}\vss}}% - \kern-.15em - \TeX -} - -% Be sure we're in horizontal mode when doing a tie, since we make space -% equivalent to this in @example-like environments. Otherwise, a space -% at the beginning of a line will start with \penalty -- and -% since \penalty is valid in vertical mode, we'd end up putting the -% penalty on the vertical list instead of in the new paragraph. -{\catcode`@ = 11 - % Avoid using \@M directly, because that causes trouble - % if the definition is written into an index file. - \global\let\tiepenalty = \@M - \gdef\tie{\leavevmode\penalty\tiepenalty\ } -} - -% @: forces normal size whitespace following. -\def\:{\spacefactor=1000 } - -% @* forces a line break. -\def\*{\hfil\break\hbox{}\ignorespaces} - -% @/ allows a line break. -\let\/=\allowbreak - -% @. is an end-of-sentence period. -\def\.{.\spacefactor=3000 } - -% @! is an end-of-sentence bang. -\def\!{!\spacefactor=3000 } - -% @? is an end-of-sentence query. -\def\?{?\spacefactor=3000 } - -% @w prevents a word break. Without the \leavevmode, @w at the -% beginning of a paragraph, when TeX is still in vertical mode, would -% produce a whole line of output instead of starting the paragraph. -\def\w#1{\leavevmode\hbox{#1}} - -% @group ... @end group forces ... to be all on one page, by enclosing -% it in a TeX vbox. We use \vtop instead of \vbox to construct the box -% to keep its height that of a normal line. According to the rules for -% \topskip (p.114 of the TeXbook), the glue inserted is -% max (\topskip - \ht (first item), 0). If that height is large, -% therefore, no glue is inserted, and the space between the headline and -% the text is small, which looks bad. -% -% Another complication is that the group might be very large. This can -% cause the glue on the previous page to be unduly stretched, because it -% does not have much material. In this case, it's better to add an -% explicit \vfill so that the extra space is at the bottom. The -% threshold for doing this is if the group is more than \vfilllimit -% percent of a page (\vfilllimit can be changed inside of @tex). -% -\newbox\groupbox -\def\vfilllimit{0.7} -% -\envdef\group{% - \ifnum\catcode`\^^M=\active \else - \errhelp = \groupinvalidhelp - \errmessage{@group invalid in context where filling is enabled}% - \fi - \startsavinginserts - % - \setbox\groupbox = \vtop\bgroup - % Do @comment since we are called inside an environment such as - % @example, where each end-of-line in the input causes an - % end-of-line in the output. We don't want the end-of-line after - % the `@group' to put extra space in the output. Since @group - % should appear on a line by itself (according to the Texinfo - % manual), we don't worry about eating any user text. - \comment -} -% -% The \vtop produces a box with normal height and large depth; thus, TeX puts -% \baselineskip glue before it, and (when the next line of text is done) -% \lineskip glue after it. Thus, space below is not quite equal to space -% above. But it's pretty close. -\def\Egroup{% - % To get correct interline space between the last line of the group - % and the first line afterwards, we have to propagate \prevdepth. - \endgraf % Not \par, as it may have been set to \lisppar. - \global\dimen1 = \prevdepth - \egroup % End the \vtop. - % \dimen0 is the vertical size of the group's box. - \dimen0 = \ht\groupbox \advance\dimen0 by \dp\groupbox - % \dimen2 is how much space is left on the page (more or less). - \dimen2 = \pageheight \advance\dimen2 by -\pagetotal - % if the group doesn't fit on the current page, and it's a big big - % group, force a page break. - \ifdim \dimen0 > \dimen2 - \ifdim \pagetotal < \vfilllimit\pageheight - \page - \fi - \fi - \box\groupbox - \prevdepth = \dimen1 - \checkinserts -} -% -% TeX puts in an \escapechar (i.e., `@') at the beginning of the help -% message, so this ends up printing `@group can only ...'. -% -\newhelp\groupinvalidhelp{% -group can only be used in environments such as @example,^^J% -where each line of input produces a line of output.} - -% @need space-in-mils -% forces a page break if there is not space-in-mils remaining. - -\newdimen\mil \mil=0.001in - -% Old definition--didn't work. -%\parseargdef\need{\par % -%% This method tries to make TeX break the page naturally -%% if the depth of the box does not fit. -%{\baselineskip=0pt% -%\vtop to #1\mil{\vfil}\kern -#1\mil\nobreak -%\prevdepth=-1000pt -%}} - -\parseargdef\need{% - % Ensure vertical mode, so we don't make a big box in the middle of a - % paragraph. - \par - % - % If the @need value is less than one line space, it's useless. - \dimen0 = #1\mil - \dimen2 = \ht\strutbox - \advance\dimen2 by \dp\strutbox - \ifdim\dimen0 > \dimen2 - % - % Do a \strut just to make the height of this box be normal, so the - % normal leading is inserted relative to the preceding line. - % And a page break here is fine. - \vtop to #1\mil{\strut\vfil}% - % - % TeX does not even consider page breaks if a penalty added to the - % main vertical list is 10000 or more. But in order to see if the - % empty box we just added fits on the page, we must make it consider - % page breaks. On the other hand, we don't want to actually break the - % page after the empty box. So we use a penalty of 9999. - % - % There is an extremely small chance that TeX will actually break the - % page at this \penalty, if there are no other feasible breakpoints in - % sight. (If the user is using lots of big @group commands, which - % almost-but-not-quite fill up a page, TeX will have a hard time doing - % good page breaking, for example.) However, I could not construct an - % example where a page broke at this \penalty; if it happens in a real - % document, then we can reconsider our strategy. - \penalty9999 - % - % Back up by the size of the box, whether we did a page break or not. - \kern -#1\mil - % - % Do not allow a page break right after this kern. - \nobreak - \fi -} - -% @br forces paragraph break (and is undocumented). - -\let\br = \par - -% @page forces the start of a new page. -% -\def\page{\par\vfill\supereject} - -% @exdent text.... -% outputs text on separate line in roman font, starting at standard page margin - -% This records the amount of indent in the innermost environment. -% That's how much \exdent should take out. -\newskip\exdentamount - -% This defn is used inside fill environments such as @defun. -\parseargdef\exdent{\hfil\break\hbox{\kern -\exdentamount{\rm#1}}\hfil\break} - -% This defn is used inside nofill environments such as @example. -\parseargdef\nofillexdent{{\advance \leftskip by -\exdentamount - \leftline{\hskip\leftskip{\rm#1}}}} - -% @inmargin{WHICH}{TEXT} puts TEXT in the WHICH margin next to the current -% paragraph. For more general purposes, use the \margin insertion -% class. WHICH is `l' or `r'. -% -\newskip\inmarginspacing \inmarginspacing=1cm -\def\strutdepth{\dp\strutbox} -% -\def\doinmargin#1#2{\strut\vadjust{% - \nobreak - \kern-\strutdepth - \vtop to \strutdepth{% - \baselineskip=\strutdepth - \vss - % if you have multiple lines of stuff to put here, you'll need to - % make the vbox yourself of the appropriate size. - \ifx#1l% - \llap{\ignorespaces #2\hskip\inmarginspacing}% - \else - \rlap{\hskip\hsize \hskip\inmarginspacing \ignorespaces #2}% - \fi - \null - }% -}} -\def\inleftmargin{\doinmargin l} -\def\inrightmargin{\doinmargin r} -% -% @inmargin{TEXT [, RIGHT-TEXT]} -% (if RIGHT-TEXT is given, use TEXT for left page, RIGHT-TEXT for right; -% else use TEXT for both). -% -\def\inmargin#1{\parseinmargin #1,,\finish} -\def\parseinmargin#1,#2,#3\finish{% not perfect, but better than nothing. - \setbox0 = \hbox{\ignorespaces #2}% - \ifdim\wd0 > 0pt - \def\lefttext{#1}% have both texts - \def\righttext{#2}% - \else - \def\lefttext{#1}% have only one text - \def\righttext{#1}% - \fi - % - \ifodd\pageno - \def\temp{\inrightmargin\righttext}% odd page -> outside is right margin - \else - \def\temp{\inleftmargin\lefttext}% - \fi - \temp -} - -% @include file insert text of that file as input. -% -\def\include{\parseargusing\filenamecatcodes\includezzz} -\def\includezzz#1{% - \pushthisfilestack - \def\thisfile{#1}% - {% - \makevalueexpandable - \def\temp{\input #1 }% - \expandafter - }\temp - \popthisfilestack -} -\def\filenamecatcodes{% - \catcode`\\=\other - \catcode`~=\other - \catcode`^=\other - \catcode`_=\other - \catcode`|=\other - \catcode`<=\other - \catcode`>=\other - \catcode`+=\other - \catcode`-=\other -} - -\def\pushthisfilestack{% - \expandafter\pushthisfilestackX\popthisfilestack\StackTerm -} -\def\pushthisfilestackX{% - \expandafter\pushthisfilestackY\thisfile\StackTerm -} -\def\pushthisfilestackY #1\StackTerm #2\StackTerm {% - \gdef\popthisfilestack{\gdef\thisfile{#1}\gdef\popthisfilestack{#2}}% -} - -\def\popthisfilestack{\errthisfilestackempty} -\def\errthisfilestackempty{\errmessage{Internal error: - the stack of filenames is empty.}} - -\def\thisfile{} - -% @center line -% outputs that line, centered. -% -\parseargdef\center{% - \ifhmode - \let\next\centerH - \else - \let\next\centerV - \fi - \next{\hfil \ignorespaces#1\unskip \hfil}% -} -\def\centerH#1{% - {% - \hfil\break - \advance\hsize by -\leftskip - \advance\hsize by -\rightskip - \line{#1}% - \break - }% -} -\def\centerV#1{\line{\kern\leftskip #1\kern\rightskip}} - -% @sp n outputs n lines of vertical space - -\parseargdef\sp{\vskip #1\baselineskip} - -% @comment ...line which is ignored... -% @c is the same as @comment -% @ignore ... @end ignore is another way to write a comment - -\def\comment{\begingroup \catcode`\^^M=\other% -\catcode`\@=\other \catcode`\{=\other \catcode`\}=\other% -\commentxxx} -{\catcode`\^^M=\other \gdef\commentxxx#1^^M{\endgroup}} - -\let\c=\comment - -% @paragraphindent NCHARS -% We'll use ems for NCHARS, close enough. -% NCHARS can also be the word `asis' or `none'. -% We cannot feasibly implement @paragraphindent asis, though. -% -\def\asisword{asis} % no translation, these are keywords -\def\noneword{none} -% -\parseargdef\paragraphindent{% - \def\temp{#1}% - \ifx\temp\asisword - \else - \ifx\temp\noneword - \defaultparindent = 0pt - \else - \defaultparindent = #1em - \fi - \fi - \parindent = \defaultparindent -} - -% @exampleindent NCHARS -% We'll use ems for NCHARS like @paragraphindent. -% It seems @exampleindent asis isn't necessary, but -% I preserve it to make it similar to @paragraphindent. -\parseargdef\exampleindent{% - \def\temp{#1}% - \ifx\temp\asisword - \else - \ifx\temp\noneword - \lispnarrowing = 0pt - \else - \lispnarrowing = #1em - \fi - \fi -} - -% @firstparagraphindent WORD -% If WORD is `none', then suppress indentation of the first paragraph -% after a section heading. If WORD is `insert', then do indent at such -% paragraphs. -% -% The paragraph indentation is suppressed or not by calling -% \suppressfirstparagraphindent, which the sectioning commands do. -% We switch the definition of this back and forth according to WORD. -% By default, we suppress indentation. -% -\def\suppressfirstparagraphindent{\dosuppressfirstparagraphindent} -\def\insertword{insert} -% -\parseargdef\firstparagraphindent{% - \def\temp{#1}% - \ifx\temp\noneword - \let\suppressfirstparagraphindent = \dosuppressfirstparagraphindent - \else\ifx\temp\insertword - \let\suppressfirstparagraphindent = \relax - \else - \errhelp = \EMsimple - \errmessage{Unknown @firstparagraphindent option `\temp'}% - \fi\fi -} - -% Here is how we actually suppress indentation. Redefine \everypar to -% \kern backwards by \parindent, and then reset itself to empty. -% -% We also make \indent itself not actually do anything until the next -% paragraph. -% -\gdef\dosuppressfirstparagraphindent{% - \gdef\indent{% - \restorefirstparagraphindent - \indent - }% - \gdef\noindent{% - \restorefirstparagraphindent - \noindent - }% - \global\everypar = {% - \kern -\parindent - \restorefirstparagraphindent - }% -} - -\gdef\restorefirstparagraphindent{% - \global \let \indent = \ptexindent - \global \let \noindent = \ptexnoindent - \global \everypar = {}% -} - - -% @asis just yields its argument. Used with @table, for example. -% -\def\asis#1{#1} - -% @math outputs its argument in math mode. -% -% One complication: _ usually means subscripts, but it could also mean -% an actual _ character, as in @math{@var{some_variable} + 1}. So make -% _ active, and distinguish by seeing if the current family is \slfam, -% which is what @var uses. -{ - \catcode\underChar = \active - \gdef\mathunderscore{% - \catcode\underChar=\active - \def_{\ifnum\fam=\slfam \_\else\sb\fi}% - } -} -% Another complication: we want \\ (and @\) to output a \ character. -% FYI, plain.tex uses \\ as a temporary control sequence (why?), but -% this is not advertised and we don't care. Texinfo does not -% otherwise define @\. -% -% The \mathchar is class=0=ordinary, family=7=ttfam, position=5C=\. -\def\mathbackslash{\ifnum\fam=\ttfam \mathchar"075C \else\backslash \fi} -% -\def\math{% - \tex - \mathunderscore - \let\\ = \mathbackslash - \mathactive - $\finishmath -} -\def\finishmath#1{#1$\endgroup} % Close the group opened by \tex. - -% Some active characters (such as <) are spaced differently in math. -% We have to reset their definitions in case the @math was an argument -% to a command which sets the catcodes (such as @item or @section). -% -{ - \catcode`^ = \active - \catcode`< = \active - \catcode`> = \active - \catcode`+ = \active - \gdef\mathactive{% - \let^ = \ptexhat - \let< = \ptexless - \let> = \ptexgtr - \let+ = \ptexplus - } -} - -% @bullet and @minus need the same treatment as @math, just above. -\def\bullet{$\ptexbullet$} -\def\minus{$-$} - -% @dots{} outputs an ellipsis using the current font. -% We do .5em per period so that it has the same spacing in a typewriter -% font as three actual period characters. -% -\def\dots{% - \leavevmode - \hbox to 1.5em{% - \hskip 0pt plus 0.25fil - .\hfil.\hfil.% - \hskip 0pt plus 0.5fil - }% -} - -% @enddots{} is an end-of-sentence ellipsis. -% -\def\enddots{% - \dots - \spacefactor=3000 -} - -% @comma{} is so commas can be inserted into text without messing up -% Texinfo's parsing. -% -\let\comma = , - -% @refill is a no-op. -\let\refill=\relax - -% If working on a large document in chapters, it is convenient to -% be able to disable indexing, cross-referencing, and contents, for test runs. -% This is done with @novalidate (before @setfilename). -% -\newif\iflinks \linkstrue % by default we want the aux files. -\let\novalidate = \linksfalse - -% @setfilename is done at the beginning of every texinfo file. -% So open here the files we need to have open while reading the input. -% This makes it possible to make a .fmt file for texinfo. -\def\setfilename{% - \fixbackslash % Turn off hack to swallow `\input texinfo'. - \iflinks - \tryauxfile - % Open the new aux file. TeX will close it automatically at exit. - \immediate\openout\auxfile=\jobname.aux - \fi % \openindices needs to do some work in any case. - \openindices - \let\setfilename=\comment % Ignore extra @setfilename cmds. - % - % If texinfo.cnf is present on the system, read it. - % Useful for site-wide @afourpaper, etc. - \openin 1 texinfo.cnf - \ifeof 1 \else \input texinfo.cnf \fi - \closein 1 - % - \comment % Ignore the actual filename. -} - -% Called from \setfilename. -% -\def\openindices{% - \newindex{cp}% - \newcodeindex{fn}% - \newcodeindex{vr}% - \newcodeindex{tp}% - \newcodeindex{ky}% - \newcodeindex{pg}% -} - -% @bye. -\outer\def\bye{\pagealignmacro\tracingstats=1\ptexend} - - -\message{pdf,} -% adobe `portable' document format -\newcount\tempnum -\newcount\lnkcount -\newtoks\filename -\newcount\filenamelength -\newcount\pgn -\newtoks\toksA -\newtoks\toksB -\newtoks\toksC -\newtoks\toksD -\newbox\boxA -\newcount\countA -\newif\ifpdf -\newif\ifpdfmakepagedest - -% when pdftex is run in dvi mode, \pdfoutput is defined (so \pdfoutput=1 -% can be set). So we test for \relax and 0 as well as \undefined, -% borrowed from ifpdf.sty. -\ifx\pdfoutput\undefined -\else - \ifx\pdfoutput\relax - \else - \ifcase\pdfoutput - \else - \pdftrue - \fi - \fi -\fi -% -\ifpdf - \input pdfcolor - \pdfcatalog{/PageMode /UseOutlines}% - \def\dopdfimage#1#2#3{% - \def\imagewidth{#2}% - \def\imageheight{#3}% - % without \immediate, pdftex seg faults when the same image is - % included twice. (Version 3.14159-pre-1.0-unofficial-20010704.) - \ifnum\pdftexversion < 14 - \immediate\pdfimage - \else - \immediate\pdfximage - \fi - \ifx\empty\imagewidth\else width \imagewidth \fi - \ifx\empty\imageheight\else height \imageheight \fi - \ifnum\pdftexversion<13 - #1.pdf% - \else - {#1.pdf}% - \fi - \ifnum\pdftexversion < 14 \else - \pdfrefximage \pdflastximage - \fi} - \def\pdfmkdest#1{{% - % We have to set dummies so commands such as @code in a section title - % aren't expanded. - \atdummies - \normalturnoffactive - \pdfdest name{#1} xyz% - }} - \def\pdfmkpgn#1{#1} - \let\linkcolor = \Blue % was Cyan, but that seems light? - \def\endlink{\Black\pdfendlink} - % Adding outlines to PDF; macros for calculating structure of outlines - % come from Petr Olsak - \def\expnumber#1{\expandafter\ifx\csname#1\endcsname\relax 0% - \else \csname#1\endcsname \fi} - \def\advancenumber#1{\tempnum=\expnumber{#1}\relax - \advance\tempnum by 1 - \expandafter\xdef\csname#1\endcsname{\the\tempnum}} - % - % #1 is the section text. #2 is the pdf expression for the number - % of subentries (or empty, for subsubsections). #3 is the node - % text, which might be empty if this toc entry had no - % corresponding node. #4 is the page number. - % - \def\dopdfoutline#1#2#3#4{% - % Generate a link to the node text if that exists; else, use the - % page number. We could generate a destination for the section - % text in the case where a section has no node, but it doesn't - % seem worthwhile, since most documents are normally structured. - \def\pdfoutlinedest{#3}% - \ifx\pdfoutlinedest\empty \def\pdfoutlinedest{#4}\fi - % - \pdfoutline goto name{\pdfmkpgn{\pdfoutlinedest}}#2{#1}% - } - % - \def\pdfmakeoutlines{% - \begingroup - % Thanh's hack / proper braces in bookmarks - \edef\mylbrace{\iftrue \string{\else}\fi}\let\{=\mylbrace - \edef\myrbrace{\iffalse{\else\string}\fi}\let\}=\myrbrace - % - % Read toc silently, to get counts of subentries for \pdfoutline. - \def\numchapentry##1##2##3##4{% - \def\thischapnum{##2}% - \let\thissecnum\empty - \let\thissubsecnum\empty - }% - \def\numsecentry##1##2##3##4{% - \advancenumber{chap\thischapnum}% - \def\thissecnum{##2}% - \let\thissubsecnum\empty - }% - \def\numsubsecentry##1##2##3##4{% - \advancenumber{sec\thissecnum}% - \def\thissubsecnum{##2}% - }% - \def\numsubsubsecentry##1##2##3##4{% - \advancenumber{subsec\thissubsecnum}% - }% - \let\thischapnum\empty - \let\thissecnum\empty - \let\thissubsecnum\empty - % - % use \def rather than \let here because we redefine \chapentry et - % al. a second time, below. - \def\appentry{\numchapentry}% - \def\appsecentry{\numsecentry}% - \def\appsubsecentry{\numsubsecentry}% - \def\appsubsubsecentry{\numsubsubsecentry}% - \def\unnchapentry{\numchapentry}% - \def\unnsecentry{\numsecentry}% - \def\unnsubsecentry{\numsubsecentry}% - \def\unnsubsubsecentry{\numsubsubsecentry}% - \input \jobname.toc - % - % Read toc second time, this time actually producing the outlines. - % The `-' means take the \expnumber as the absolute number of - % subentries, which we calculated on our first read of the .toc above. - % - % We use the node names as the destinations. - \def\numchapentry##1##2##3##4{% - \dopdfoutline{##1}{count-\expnumber{chap##2}}{##3}{##4}}% - \def\numsecentry##1##2##3##4{% - \dopdfoutline{##1}{count-\expnumber{sec##2}}{##3}{##4}}% - \def\numsubsecentry##1##2##3##4{% - \dopdfoutline{##1}{count-\expnumber{subsec##2}}{##3}{##4}}% - \def\numsubsubsecentry##1##2##3##4{% count is always zero - \dopdfoutline{##1}{}{##3}{##4}}% - % - % PDF outlines are displayed using system fonts, instead of - % document fonts. Therefore we cannot use special characters, - % since the encoding is unknown. For example, the eogonek from - % Latin 2 (0xea) gets translated to a | character. Info from - % Staszek Wawrykiewicz, 19 Jan 2004 04:09:24 +0100. - % - % xx to do this right, we have to translate 8-bit characters to - % their "best" equivalent, based on the @documentencoding. Right - % now, I guess we'll just let the pdf reader have its way. - \indexnofonts - \turnoffactive - \input \jobname.toc - \endgroup - } - % - \def\makelinks #1,{% - \def\params{#1}\def\E{END}% - \ifx\params\E - \let\nextmakelinks=\relax - \else - \let\nextmakelinks=\makelinks - \ifnum\lnkcount>0,\fi - \picknum{#1}% - \startlink attr{/Border [0 0 0]} - goto name{\pdfmkpgn{\the\pgn}}% - \linkcolor #1% - \advance\lnkcount by 1% - \endlink - \fi - \nextmakelinks - } - \def\picknum#1{\expandafter\pn#1} - \def\pn#1{% - \def\p{#1}% - \ifx\p\lbrace - \let\nextpn=\ppn - \else - \let\nextpn=\ppnn - \def\first{#1} - \fi - \nextpn - } - \def\ppn#1{\pgn=#1\gobble} - \def\ppnn{\pgn=\first} - \def\pdfmklnk#1{\lnkcount=0\makelinks #1,END,} - \def\skipspaces#1{\def\PP{#1}\def\D{|}% - \ifx\PP\D\let\nextsp\relax - \else\let\nextsp\skipspaces - \ifx\p\space\else\addtokens{\filename}{\PP}% - \advance\filenamelength by 1 - \fi - \fi - \nextsp} - \def\getfilename#1{\filenamelength=0\expandafter\skipspaces#1|\relax} - \ifnum\pdftexversion < 14 - \let \startlink \pdfannotlink - \else - \let \startlink \pdfstartlink - \fi - \def\pdfurl#1{% - \begingroup - \normalturnoffactive\def\@{@}% - \makevalueexpandable - \leavevmode\Red - \startlink attr{/Border [0 0 0]}% - user{/Subtype /Link /A << /S /URI /URI (#1) >>}% - \endgroup} - \def\pdfgettoks#1.{\setbox\boxA=\hbox{\toksA={#1.}\toksB={}\maketoks}} - \def\addtokens#1#2{\edef\addtoks{\noexpand#1={\the#1#2}}\addtoks} - \def\adn#1{\addtokens{\toksC}{#1}\global\countA=1\let\next=\maketoks} - \def\poptoks#1#2|ENDTOKS|{\let\first=#1\toksD={#1}\toksA={#2}} - \def\maketoks{% - \expandafter\poptoks\the\toksA|ENDTOKS|\relax - \ifx\first0\adn0 - \else\ifx\first1\adn1 \else\ifx\first2\adn2 \else\ifx\first3\adn3 - \else\ifx\first4\adn4 \else\ifx\first5\adn5 \else\ifx\first6\adn6 - \else\ifx\first7\adn7 \else\ifx\first8\adn8 \else\ifx\first9\adn9 - \else - \ifnum0=\countA\else\makelink\fi - \ifx\first.\let\next=\done\else - \let\next=\maketoks - \addtokens{\toksB}{\the\toksD} - \ifx\first,\addtokens{\toksB}{\space}\fi - \fi - \fi\fi\fi\fi\fi\fi\fi\fi\fi\fi - \next} - \def\makelink{\addtokens{\toksB}% - {\noexpand\pdflink{\the\toksC}}\toksC={}\global\countA=0} - \def\pdflink#1{% - \startlink attr{/Border [0 0 0]} goto name{\pdfmkpgn{#1}} - \linkcolor #1\endlink} - \def\done{\edef\st{\global\noexpand\toksA={\the\toksB}}\st} -\else - \let\pdfmkdest = \gobble - \let\pdfurl = \gobble - \let\endlink = \relax - \let\linkcolor = \relax - \let\pdfmakeoutlines = \relax -\fi % \ifx\pdfoutput - - -\message{fonts,} - -% Change the current font style to #1, remembering it in \curfontstyle. -% For now, we do not accumulate font styles: @b{@i{foo}} prints foo in -% italics, not bold italics. -% -\def\setfontstyle#1{% - \def\curfontstyle{#1}% not as a control sequence, because we are \edef'd. - \csname ten#1\endcsname % change the current font -} - -% Select #1 fonts with the current style. -% -\def\selectfonts#1{\csname #1fonts\endcsname \csname\curfontstyle\endcsname} - -\def\rm{\fam=0 \setfontstyle{rm}} -\def\it{\fam=\itfam \setfontstyle{it}} -\def\sl{\fam=\slfam \setfontstyle{sl}} -\def\bf{\fam=\bffam \setfontstyle{bf}} -\def\tt{\fam=\ttfam \setfontstyle{tt}} - -% Texinfo sort of supports the sans serif font style, which plain TeX does not. -% So we set up a \sf. -\newfam\sffam -\def\sf{\fam=\sffam \setfontstyle{sf}} -\let\li = \sf % Sometimes we call it \li, not \sf. - -% We don't need math for this font style. -\def\ttsl{\setfontstyle{ttsl}} - -% Default leading. -\newdimen\textleading \textleading = 13.2pt - -% Set the baselineskip to #1, and the lineskip and strut size -% correspondingly. There is no deep meaning behind these magic numbers -% used as factors; they just match (closely enough) what Knuth defined. -% -\def\lineskipfactor{.08333} -\def\strutheightpercent{.70833} -\def\strutdepthpercent {.29167} -% -\def\setleading#1{% - \normalbaselineskip = #1\relax - \normallineskip = \lineskipfactor\normalbaselineskip - \normalbaselines - \setbox\strutbox =\hbox{% - \vrule width0pt height\strutheightpercent\baselineskip - depth \strutdepthpercent \baselineskip - }% -} - -% Set the font macro #1 to the font named #2, adding on the -% specified font prefix (normally `cm'). -% #3 is the font's design size, #4 is a scale factor -\def\setfont#1#2#3#4{\font#1=\fontprefix#2#3 scaled #4} - -% Use cm as the default font prefix. -% To specify the font prefix, you must define \fontprefix -% before you read in texinfo.tex. -\ifx\fontprefix\undefined -\def\fontprefix{cm} -\fi -% Support font families that don't use the same naming scheme as CM. -\def\rmshape{r} -\def\rmbshape{bx} %where the normal face is bold -\def\bfshape{b} -\def\bxshape{bx} -\def\ttshape{tt} -\def\ttbshape{tt} -\def\ttslshape{sltt} -\def\itshape{ti} -\def\itbshape{bxti} -\def\slshape{sl} -\def\slbshape{bxsl} -\def\sfshape{ss} -\def\sfbshape{ss} -\def\scshape{csc} -\def\scbshape{csc} - -% Text fonts (11.2pt, magstep1). -\newcount\mainmagstep -\ifx\bigger\relax - % not really supported. - \mainmagstep=\magstep1 - \setfont\textrm\rmshape{12}{1000} - \setfont\texttt\ttshape{12}{1000} -\else - \mainmagstep=\magstephalf - \setfont\textrm\rmshape{10}{\mainmagstep} - \setfont\texttt\ttshape{10}{\mainmagstep} -\fi -\setfont\textbf\bfshape{10}{\mainmagstep} -\setfont\textit\itshape{10}{\mainmagstep} -\setfont\textsl\slshape{10}{\mainmagstep} -\setfont\textsf\sfshape{10}{\mainmagstep} -\setfont\textsc\scshape{10}{\mainmagstep} -\setfont\textttsl\ttslshape{10}{\mainmagstep} -\font\texti=cmmi10 scaled \mainmagstep -\font\textsy=cmsy10 scaled \mainmagstep - -% A few fonts for @defun names and args. -\setfont\defbf\bfshape{10}{\magstep1} -\setfont\deftt\ttshape{10}{\magstep1} -\setfont\defttsl\ttslshape{10}{\magstep1} -\def\df{\let\tentt=\deftt \let\tenbf = \defbf \let\tenttsl=\defttsl \bf} - -% Fonts for indices, footnotes, small examples (9pt). -\setfont\smallrm\rmshape{9}{1000} -\setfont\smalltt\ttshape{9}{1000} -\setfont\smallbf\bfshape{10}{900} -\setfont\smallit\itshape{9}{1000} -\setfont\smallsl\slshape{9}{1000} -\setfont\smallsf\sfshape{9}{1000} -\setfont\smallsc\scshape{10}{900} -\setfont\smallttsl\ttslshape{10}{900} -\font\smalli=cmmi9 -\font\smallsy=cmsy9 - -% Fonts for small examples (8pt). -\setfont\smallerrm\rmshape{8}{1000} -\setfont\smallertt\ttshape{8}{1000} -\setfont\smallerbf\bfshape{10}{800} -\setfont\smallerit\itshape{8}{1000} -\setfont\smallersl\slshape{8}{1000} -\setfont\smallersf\sfshape{8}{1000} -\setfont\smallersc\scshape{10}{800} -\setfont\smallerttsl\ttslshape{10}{800} -\font\smalleri=cmmi8 -\font\smallersy=cmsy8 - -% Fonts for title page (20.4pt): -\setfont\titlerm\rmbshape{12}{\magstep3} -\setfont\titleit\itbshape{10}{\magstep4} -\setfont\titlesl\slbshape{10}{\magstep4} -\setfont\titlett\ttbshape{12}{\magstep3} -\setfont\titlettsl\ttslshape{10}{\magstep4} -\setfont\titlesf\sfbshape{17}{\magstep1} -\let\titlebf=\titlerm -\setfont\titlesc\scbshape{10}{\magstep4} -\font\titlei=cmmi12 scaled \magstep3 -\font\titlesy=cmsy10 scaled \magstep4 -\def\authorrm{\secrm} -\def\authortt{\sectt} - -% Chapter (and unnumbered) fonts (17.28pt). -\setfont\chaprm\rmbshape{12}{\magstep2} -\setfont\chapit\itbshape{10}{\magstep3} -\setfont\chapsl\slbshape{10}{\magstep3} -\setfont\chaptt\ttbshape{12}{\magstep2} -\setfont\chapttsl\ttslshape{10}{\magstep3} -\setfont\chapsf\sfbshape{17}{1000} -\let\chapbf=\chaprm -\setfont\chapsc\scbshape{10}{\magstep3} -\font\chapi=cmmi12 scaled \magstep2 -\font\chapsy=cmsy10 scaled \magstep3 - -% Section fonts (14.4pt). -\setfont\secrm\rmbshape{12}{\magstep1} -\setfont\secit\itbshape{10}{\magstep2} -\setfont\secsl\slbshape{10}{\magstep2} -\setfont\sectt\ttbshape{12}{\magstep1} -\setfont\secttsl\ttslshape{10}{\magstep2} -\setfont\secsf\sfbshape{12}{\magstep1} -\let\secbf\secrm -\setfont\secsc\scbshape{10}{\magstep2} -\font\seci=cmmi12 scaled \magstep1 -\font\secsy=cmsy10 scaled \magstep2 - -% Subsection fonts (13.15pt). -\setfont\ssecrm\rmbshape{12}{\magstephalf} -\setfont\ssecit\itbshape{10}{1315} -\setfont\ssecsl\slbshape{10}{1315} -\setfont\ssectt\ttbshape{12}{\magstephalf} -\setfont\ssecttsl\ttslshape{10}{1315} -\setfont\ssecsf\sfbshape{12}{\magstephalf} -\let\ssecbf\ssecrm -\setfont\ssecsc\scbshape{10}{1315} -\font\sseci=cmmi12 scaled \magstephalf -\font\ssecsy=cmsy10 scaled 1315 - -% Reduced fonts for @acro in text (10pt). -\setfont\reducedrm\rmshape{10}{1000} -\setfont\reducedtt\ttshape{10}{1000} -\setfont\reducedbf\bfshape{10}{1000} -\setfont\reducedit\itshape{10}{1000} -\setfont\reducedsl\slshape{10}{1000} -\setfont\reducedsf\sfshape{10}{1000} -\setfont\reducedsc\scshape{10}{1000} -\setfont\reducedttsl\ttslshape{10}{1000} -\font\reducedi=cmmi10 -\font\reducedsy=cmsy10 - -% In order for the font changes to affect most math symbols and letters, -% we have to define the \textfont of the standard families. Since -% texinfo doesn't allow for producing subscripts and superscripts except -% in the main text, we don't bother to reset \scriptfont and -% \scriptscriptfont (which would also require loading a lot more fonts). -% -\def\resetmathfonts{% - \textfont0=\tenrm \textfont1=\teni \textfont2=\tensy - \textfont\itfam=\tenit \textfont\slfam=\tensl \textfont\bffam=\tenbf - \textfont\ttfam=\tentt \textfont\sffam=\tensf -} - -% The font-changing commands redefine the meanings of \tenSTYLE, instead -% of just \STYLE. We do this because \STYLE needs to also set the -% current \fam for math mode. Our \STYLE (e.g., \rm) commands hardwire -% \tenSTYLE to set the current font. -% -% Each font-changing command also sets the names \lsize (one size lower) -% and \lllsize (three sizes lower). These relative commands are used in -% the LaTeX logo and acronyms. -% -% This all needs generalizing, badly. -% -\def\textfonts{% - \let\tenrm=\textrm \let\tenit=\textit \let\tensl=\textsl - \let\tenbf=\textbf \let\tentt=\texttt \let\smallcaps=\textsc - \let\tensf=\textsf \let\teni=\texti \let\tensy=\textsy - \let\tenttsl=\textttsl - \def\lsize{reduced}\def\lllsize{smaller}% - \resetmathfonts \setleading{\textleading}} -\def\titlefonts{% - \let\tenrm=\titlerm \let\tenit=\titleit \let\tensl=\titlesl - \let\tenbf=\titlebf \let\tentt=\titlett \let\smallcaps=\titlesc - \let\tensf=\titlesf \let\teni=\titlei \let\tensy=\titlesy - \let\tenttsl=\titlettsl - \def\lsize{chap}\def\lllsize{subsec}% - \resetmathfonts \setleading{25pt}} -\def\titlefont#1{{\titlefonts\rm #1}} -\def\chapfonts{% - \let\tenrm=\chaprm \let\tenit=\chapit \let\tensl=\chapsl - \let\tenbf=\chapbf \let\tentt=\chaptt \let\smallcaps=\chapsc - \let\tensf=\chapsf \let\teni=\chapi \let\tensy=\chapsy \let\tenttsl=\chapttsl - \def\lsize{sec}\def\lllsize{text}% - \resetmathfonts \setleading{19pt}} -\def\secfonts{% - \let\tenrm=\secrm \let\tenit=\secit \let\tensl=\secsl - \let\tenbf=\secbf \let\tentt=\sectt \let\smallcaps=\secsc - \let\tensf=\secsf \let\teni=\seci \let\tensy=\secsy - \let\tenttsl=\secttsl - \def\lsize{subsec}\def\lllsize{reduced}% - \resetmathfonts \setleading{16pt}} -\def\subsecfonts{% - \let\tenrm=\ssecrm \let\tenit=\ssecit \let\tensl=\ssecsl - \let\tenbf=\ssecbf \let\tentt=\ssectt \let\smallcaps=\ssecsc - \let\tensf=\ssecsf \let\teni=\sseci \let\tensy=\ssecsy - \let\tenttsl=\ssecttsl - \def\lsize{text}\def\lllsize{small}% - \resetmathfonts \setleading{15pt}} -\let\subsubsecfonts = \subsecfonts -\def\reducedfonts{% - \let\tenrm=\reducedrm \let\tenit=\reducedit \let\tensl=\reducedsl - \let\tenbf=\reducedbf \let\tentt=\reducedtt \let\reducedcaps=\reducedsc - \let\tensf=\reducedsf \let\teni=\reducedi \let\tensy=\reducedsy - \let\tenttsl=\reducedttsl - \def\lsize{small}\def\lllsize{smaller}% - \resetmathfonts \setleading{10.5pt}} -\def\smallfonts{% - \let\tenrm=\smallrm \let\tenit=\smallit \let\tensl=\smallsl - \let\tenbf=\smallbf \let\tentt=\smalltt \let\smallcaps=\smallsc - \let\tensf=\smallsf \let\teni=\smalli \let\tensy=\smallsy - \let\tenttsl=\smallttsl - \def\lsize{smaller}\def\lllsize{smaller}% - \resetmathfonts \setleading{10.5pt}} -\def\smallerfonts{% - \let\tenrm=\smallerrm \let\tenit=\smallerit \let\tensl=\smallersl - \let\tenbf=\smallerbf \let\tentt=\smallertt \let\smallcaps=\smallersc - \let\tensf=\smallersf \let\teni=\smalleri \let\tensy=\smallersy - \let\tenttsl=\smallerttsl - \def\lsize{smaller}\def\lllsize{smaller}% - \resetmathfonts \setleading{9.5pt}} - -% Set the fonts to use with the @small... environments. -\let\smallexamplefonts = \smallfonts - -% About \smallexamplefonts. If we use \smallfonts (9pt), @smallexample -% can fit this many characters: -% 8.5x11=86 smallbook=72 a4=90 a5=69 -% If we use \scriptfonts (8pt), then we can fit this many characters: -% 8.5x11=90+ smallbook=80 a4=90+ a5=77 -% For me, subjectively, the few extra characters that fit aren't worth -% the additional smallness of 8pt. So I'm making the default 9pt. -% -% By the way, for comparison, here's what fits with @example (10pt): -% 8.5x11=71 smallbook=60 a4=75 a5=58 -% -% I wish the USA used A4 paper. -% --karl, 24jan03. - - -% Set up the default fonts, so we can use them for creating boxes. -% -\textfonts \rm - -% Define these so they can be easily changed for other fonts. -\def\angleleft{$\langle$} -\def\angleright{$\rangle$} - -% Count depth in font-changes, for error checks -\newcount\fontdepth \fontdepth=0 - -% Fonts for short table of contents. -\setfont\shortcontrm\rmshape{12}{1000} -\setfont\shortcontbf\bfshape{10}{\magstep1} % no cmb12 -\setfont\shortcontsl\slshape{12}{1000} -\setfont\shortconttt\ttshape{12}{1000} - -%% Add scribe-like font environments, plus @l for inline lisp (usually sans -%% serif) and @ii for TeX italic - -% \smartitalic{ARG} outputs arg in italics, followed by an italic correction -% unless the following character is such as not to need one. -\def\smartitalicx{\ifx\next,\else\ifx\next-\else\ifx\next.\else - \ptexslash\fi\fi\fi} -\def\smartslanted#1{{\ifusingtt\ttsl\sl #1}\futurelet\next\smartitalicx} -\def\smartitalic#1{{\ifusingtt\ttsl\it #1}\futurelet\next\smartitalicx} - -% like \smartslanted except unconditionally uses \ttsl. -% @var is set to this for defun arguments. -\def\ttslanted#1{{\ttsl #1}\futurelet\next\smartitalicx} - -% like \smartslanted except unconditionally use \sl. We never want -% ttsl for book titles, do we? -\def\cite#1{{\sl #1}\futurelet\next\smartitalicx} - -\let\i=\smartitalic -\let\var=\smartslanted -\let\dfn=\smartslanted -\let\emph=\smartitalic - -\def\b#1{{\bf #1}} -\let\strong=\b - -% We can't just use \exhyphenpenalty, because that only has effect at -% the end of a paragraph. Restore normal hyphenation at the end of the -% group within which \nohyphenation is presumably called. -% -\def\nohyphenation{\hyphenchar\font = -1 \aftergroup\restorehyphenation} -\def\restorehyphenation{\hyphenchar\font = `- } - -% Set sfcode to normal for the chars that usually have another value. -% Can't use plain's \frenchspacing because it uses the `\x notation, and -% sometimes \x has an active definition that messes things up. -% -\catcode`@=11 - \def\frenchspacing{% - \sfcode\dotChar =\@m \sfcode\questChar=\@m \sfcode\exclamChar=\@m - \sfcode\colonChar=\@m \sfcode\semiChar =\@m \sfcode\commaChar =\@m - } -\catcode`@=\other - -\def\t#1{% - {\tt \rawbackslash \frenchspacing #1}% - \null -} -\def\samp#1{`\tclose{#1}'\null} -\setfont\keyrm\rmshape{8}{1000} -\font\keysy=cmsy9 -\def\key#1{{\keyrm\textfont2=\keysy \leavevmode\hbox{% - \raise0.4pt\hbox{\angleleft}\kern-.08em\vtop{% - \vbox{\hrule\kern-0.4pt - \hbox{\raise0.4pt\hbox{\vphantom{\angleleft}}#1}}% - \kern-0.4pt\hrule}% - \kern-.06em\raise0.4pt\hbox{\angleright}}}} -% The old definition, with no lozenge: -%\def\key #1{{\ttsl \nohyphenation \uppercase{#1}}\null} -\def\ctrl #1{{\tt \rawbackslash \hat}#1} - -% @file, @option are the same as @samp. -\let\file=\samp -\let\option=\samp - -% @code is a modification of @t, -% which makes spaces the same size as normal in the surrounding text. -\def\tclose#1{% - {% - % Change normal interword space to be same as for the current font. - \spaceskip = \fontdimen2\font - % - % Switch to typewriter. - \tt - % - % But `\ ' produces the large typewriter interword space. - \def\ {{\spaceskip = 0pt{} }}% - % - % Turn off hyphenation. - \nohyphenation - % - \rawbackslash - \frenchspacing - #1% - }% - \null -} - -% We *must* turn on hyphenation at `-' and `_' in @code. -% Otherwise, it is too hard to avoid overfull hboxes -% in the Emacs manual, the Library manual, etc. - -% Unfortunately, TeX uses one parameter (\hyphenchar) to control -% both hyphenation at - and hyphenation within words. -% We must therefore turn them both off (\tclose does that) -% and arrange explicitly to hyphenate at a dash. -% -- rms. -{ - \catcode`\-=\active - \catcode`\_=\active - % - \global\def\code{\begingroup - \catcode`\-=\active \let-\codedash - \catcode`\_=\active \let_\codeunder - \codex - } -} - -\def\realdash{-} -\def\codedash{-\discretionary{}{}{}} -\def\codeunder{% - % this is all so @math{@code{var_name}+1} can work. In math mode, _ - % is "active" (mathcode"8000) and \normalunderscore (or \char95, etc.) - % will therefore expand the active definition of _, which is us - % (inside @code that is), therefore an endless loop. - \ifusingtt{\ifmmode - \mathchar"075F % class 0=ordinary, family 7=ttfam, pos 0x5F=_. - \else\normalunderscore \fi - \discretionary{}{}{}}% - {\_}% -} -\def\codex #1{\tclose{#1}\endgroup} - -% @kbd is like @code, except that if the argument is just one @key command, -% then @kbd has no effect. - -% @kbdinputstyle -- arg is `distinct' (@kbd uses slanted tty font always), -% `example' (@kbd uses ttsl only inside of @example and friends), -% or `code' (@kbd uses normal tty font always). -\parseargdef\kbdinputstyle{% - \def\arg{#1}% - \ifx\arg\worddistinct - \gdef\kbdexamplefont{\ttsl}\gdef\kbdfont{\ttsl}% - \else\ifx\arg\wordexample - \gdef\kbdexamplefont{\ttsl}\gdef\kbdfont{\tt}% - \else\ifx\arg\wordcode - \gdef\kbdexamplefont{\tt}\gdef\kbdfont{\tt}% - \else - \errhelp = \EMsimple - \errmessage{Unknown @kbdinputstyle option `\arg'}% - \fi\fi\fi -} -\def\worddistinct{distinct} -\def\wordexample{example} -\def\wordcode{code} - -% Default is `distinct.' -\kbdinputstyle distinct - -\def\xkey{\key} -\def\kbdfoo#1#2#3\par{\def\one{#1}\def\three{#3}\def\threex{??}% -\ifx\one\xkey\ifx\threex\three \key{#2}% -\else{\tclose{\kbdfont\look}}\fi -\else{\tclose{\kbdfont\look}}\fi} - -% For @indicateurl, @env, @command quotes seem unnecessary, so use \code. -\let\indicateurl=\code -\let\env=\code -\let\command=\code - -% @uref (abbreviation for `urlref') takes an optional (comma-separated) -% second argument specifying the text to display and an optional third -% arg as text to display instead of (rather than in addition to) the url -% itself. First (mandatory) arg is the url. Perhaps eventually put in -% a hypertex \special here. -% -\def\uref#1{\douref #1,,,\finish} -\def\douref#1,#2,#3,#4\finish{\begingroup - \unsepspaces - \pdfurl{#1}% - \setbox0 = \hbox{\ignorespaces #3}% - \ifdim\wd0 > 0pt - \unhbox0 % third arg given, show only that - \else - \setbox0 = \hbox{\ignorespaces #2}% - \ifdim\wd0 > 0pt - \ifpdf - \unhbox0 % PDF: 2nd arg given, show only it - \else - \unhbox0\ (\code{#1})% DVI: 2nd arg given, show both it and url - \fi - \else - \code{#1}% only url given, so show it - \fi - \fi - \endlink -\endgroup} - -% @url synonym for @uref, since that's how everyone uses it. -% -\let\url=\uref - -% rms does not like angle brackets --karl, 17may97. -% So now @email is just like @uref, unless we are pdf. -% -%\def\email#1{\angleleft{\tt #1}\angleright} -\ifpdf - \def\email#1{\doemail#1,,\finish} - \def\doemail#1,#2,#3\finish{\begingroup - \unsepspaces - \pdfurl{mailto:#1}% - \setbox0 = \hbox{\ignorespaces #2}% - \ifdim\wd0>0pt\unhbox0\else\code{#1}\fi - \endlink - \endgroup} -\else - \let\email=\uref -\fi - -% Check if we are currently using a typewriter font. Since all the -% Computer Modern typewriter fonts have zero interword stretch (and -% shrink), and it is reasonable to expect all typewriter fonts to have -% this property, we can check that font parameter. -% -\def\ifmonospace{\ifdim\fontdimen3\font=0pt } - -% Typeset a dimension, e.g., `in' or `pt'. The only reason for the -% argument is to make the input look right: @dmn{pt} instead of @dmn{}pt. -% -\def\dmn#1{\thinspace #1} - -\def\kbd#1{\def\look{#1}\expandafter\kbdfoo\look??\par} - -% @l was never documented to mean ``switch to the Lisp font'', -% and it is not used as such in any manual I can find. We need it for -% Polish suppressed-l. --karl, 22sep96. -%\def\l#1{{\li #1}\null} - -% Explicit font changes: @r, @sc, undocumented @ii. -\def\r#1{{\rm #1}} % roman font -\def\sc#1{{\smallcaps#1}} % smallcaps font -\def\ii#1{{\it #1}} % italic font - -\def\acronym#1{\doacronym #1,,\finish} -\def\doacronym#1,#2,#3\finish{% - {\selectfonts\lsize #1}% - \def\temp{#2}% - \ifx\temp\empty \else - \space ({\unsepspaces \ignorespaces \temp \unskip})% - \fi -} - -% @pounds{} is a sterling sign, which is in the CM italic font. -% -\def\pounds{{\it\$}} - -% @registeredsymbol - R in a circle. The font for the R should really -% be smaller yet, but lllsize is the best we can do for now. -% Adapted from the plain.tex definition of \copyright. -% -\def\registeredsymbol{% - $^{{\ooalign{\hfil\raise.07ex\hbox{\selectfonts\lllsize R}% - \hfil\crcr\Orb}}% - }$% -} - -% Laurent Siebenmann reports \Orb undefined with: -% Textures 1.7.7 (preloaded format=plain 93.10.14) (68K) 16 APR 2004 02:38 -% so we'll define it if necessary. -% -\ifx\Orb\undefined -\def\Orb{\mathhexbox20D} -\fi - - -\message{page headings,} - -\newskip\titlepagetopglue \titlepagetopglue = 1.5in -\newskip\titlepagebottomglue \titlepagebottomglue = 2pc - -% First the title page. Must do @settitle before @titlepage. -\newif\ifseenauthor -\newif\iffinishedtitlepage - -% Do an implicit @contents or @shortcontents after @end titlepage if the -% user says @setcontentsaftertitlepage or @setshortcontentsaftertitlepage. -% -\newif\ifsetcontentsaftertitlepage - \let\setcontentsaftertitlepage = \setcontentsaftertitlepagetrue -\newif\ifsetshortcontentsaftertitlepage - \let\setshortcontentsaftertitlepage = \setshortcontentsaftertitlepagetrue - -\parseargdef\shorttitlepage{\begingroup\hbox{}\vskip 1.5in \chaprm \centerline{#1}% - \endgroup\page\hbox{}\page} - -\envdef\titlepage{% - % Open one extra group, as we want to close it in the middle of \Etitlepage. - \begingroup - \parindent=0pt \textfonts - % Leave some space at the very top of the page. - \vglue\titlepagetopglue - % No rule at page bottom unless we print one at the top with @title. - \finishedtitlepagetrue - % - % Most title ``pages'' are actually two pages long, with space - % at the top of the second. We don't want the ragged left on the second. - \let\oldpage = \page - \def\page{% - \iffinishedtitlepage\else - \finishtitlepage - \fi - \let\page = \oldpage - \page - \null - }% -} - -\def\Etitlepage{% - \iffinishedtitlepage\else - \finishtitlepage - \fi - % It is important to do the page break before ending the group, - % because the headline and footline are only empty inside the group. - % If we use the new definition of \page, we always get a blank page - % after the title page, which we certainly don't want. - \oldpage - \endgroup - % - % Need this before the \...aftertitlepage checks so that if they are - % in effect the toc pages will come out with page numbers. - \HEADINGSon - % - % If they want short, they certainly want long too. - \ifsetshortcontentsaftertitlepage - \shortcontents - \contents - \global\let\shortcontents = \relax - \global\let\contents = \relax - \fi - % - \ifsetcontentsaftertitlepage - \contents - \global\let\contents = \relax - \global\let\shortcontents = \relax - \fi -} - -\def\finishtitlepage{% - \vskip4pt \hrule height 2pt width \hsize - \vskip\titlepagebottomglue - \finishedtitlepagetrue -} - -%%% Macros to be used within @titlepage: - -\let\subtitlerm=\tenrm -\def\subtitlefont{\subtitlerm \normalbaselineskip = 13pt \normalbaselines} - -\def\authorfont{\authorrm \normalbaselineskip = 16pt \normalbaselines - \let\tt=\authortt} - -\parseargdef\title{% - \checkenv\titlepage - \leftline{\titlefonts\rm #1} - % print a rule at the page bottom also. - \finishedtitlepagefalse - \vskip4pt \hrule height 4pt width \hsize \vskip4pt -} - -\parseargdef\subtitle{% - \checkenv\titlepage - {\subtitlefont \rightline{#1}}% -} - -% @author should come last, but may come many times. -% It can also be used inside @quotation. -% -\parseargdef\author{% - \def\temp{\quotation}% - \ifx\thisenv\temp - \def\quotationauthor{#1}% printed in \Equotation. - \else - \checkenv\titlepage - \ifseenauthor\else \vskip 0pt plus 1filll \seenauthortrue \fi - {\authorfont \leftline{#1}}% - \fi -} - - -%%% Set up page headings and footings. - -\let\thispage=\folio - -\newtoks\evenheadline % headline on even pages -\newtoks\oddheadline % headline on odd pages -\newtoks\evenfootline % footline on even pages -\newtoks\oddfootline % footline on odd pages - -% Now make TeX use those variables -\headline={{\textfonts\rm \ifodd\pageno \the\oddheadline - \else \the\evenheadline \fi}} -\footline={{\textfonts\rm \ifodd\pageno \the\oddfootline - \else \the\evenfootline \fi}\HEADINGShook} -\let\HEADINGShook=\relax - -% Commands to set those variables. -% For example, this is what @headings on does -% @evenheading @thistitle|@thispage|@thischapter -% @oddheading @thischapter|@thispage|@thistitle -% @evenfooting @thisfile|| -% @oddfooting ||@thisfile - - -\def\evenheading{\parsearg\evenheadingxxx} -\def\evenheadingxxx #1{\evenheadingyyy #1\|\|\|\|\finish} -\def\evenheadingyyy #1\|#2\|#3\|#4\finish{% -\global\evenheadline={\rlap{\centerline{#2}}\line{#1\hfil#3}}} - -\def\oddheading{\parsearg\oddheadingxxx} -\def\oddheadingxxx #1{\oddheadingyyy #1\|\|\|\|\finish} -\def\oddheadingyyy #1\|#2\|#3\|#4\finish{% -\global\oddheadline={\rlap{\centerline{#2}}\line{#1\hfil#3}}} - -\parseargdef\everyheading{\oddheadingxxx{#1}\evenheadingxxx{#1}}% - -\def\evenfooting{\parsearg\evenfootingxxx} -\def\evenfootingxxx #1{\evenfootingyyy #1\|\|\|\|\finish} -\def\evenfootingyyy #1\|#2\|#3\|#4\finish{% -\global\evenfootline={\rlap{\centerline{#2}}\line{#1\hfil#3}}} - -\def\oddfooting{\parsearg\oddfootingxxx} -\def\oddfootingxxx #1{\oddfootingyyy #1\|\|\|\|\finish} -\def\oddfootingyyy #1\|#2\|#3\|#4\finish{% - \global\oddfootline = {\rlap{\centerline{#2}}\line{#1\hfil#3}}% - % - % Leave some space for the footline. Hopefully ok to assume - % @evenfooting will not be used by itself. - \global\advance\pageheight by -\baselineskip - \global\advance\vsize by -\baselineskip -} - -\parseargdef\everyfooting{\oddfootingxxx{#1}\evenfootingxxx{#1}} - - -% @headings double turns headings on for double-sided printing. -% @headings single turns headings on for single-sided printing. -% @headings off turns them off. -% @headings on same as @headings double, retained for compatibility. -% @headings after turns on double-sided headings after this page. -% @headings doubleafter turns on double-sided headings after this page. -% @headings singleafter turns on single-sided headings after this page. -% By default, they are off at the start of a document, -% and turned `on' after @end titlepage. - -\def\headings #1 {\csname HEADINGS#1\endcsname} - -\def\HEADINGSoff{% -\global\evenheadline={\hfil} \global\evenfootline={\hfil} -\global\oddheadline={\hfil} \global\oddfootline={\hfil}} -\HEADINGSoff -% When we turn headings on, set the page number to 1. -% For double-sided printing, put current file name in lower left corner, -% chapter name on inside top of right hand pages, document -% title on inside top of left hand pages, and page numbers on outside top -% edge of all pages. -\def\HEADINGSdouble{% -\global\pageno=1 -\global\evenfootline={\hfil} -\global\oddfootline={\hfil} -\global\evenheadline={\line{\folio\hfil\thistitle}} -\global\oddheadline={\line{\thischapter\hfil\folio}} -\global\let\contentsalignmacro = \chapoddpage -} -\let\contentsalignmacro = \chappager - -% For single-sided printing, chapter title goes across top left of page, -% page number on top right. -\def\HEADINGSsingle{% -\global\pageno=1 -\global\evenfootline={\hfil} -\global\oddfootline={\hfil} -\global\evenheadline={\line{\thischapter\hfil\folio}} -\global\oddheadline={\line{\thischapter\hfil\folio}} -\global\let\contentsalignmacro = \chappager -} -\def\HEADINGSon{\HEADINGSdouble} - -\def\HEADINGSafter{\let\HEADINGShook=\HEADINGSdoublex} -\let\HEADINGSdoubleafter=\HEADINGSafter -\def\HEADINGSdoublex{% -\global\evenfootline={\hfil} -\global\oddfootline={\hfil} -\global\evenheadline={\line{\folio\hfil\thistitle}} -\global\oddheadline={\line{\thischapter\hfil\folio}} -\global\let\contentsalignmacro = \chapoddpage -} - -\def\HEADINGSsingleafter{\let\HEADINGShook=\HEADINGSsinglex} -\def\HEADINGSsinglex{% -\global\evenfootline={\hfil} -\global\oddfootline={\hfil} -\global\evenheadline={\line{\thischapter\hfil\folio}} -\global\oddheadline={\line{\thischapter\hfil\folio}} -\global\let\contentsalignmacro = \chappager -} - -% Subroutines used in generating headings -% This produces Day Month Year style of output. -% Only define if not already defined, in case a txi-??.tex file has set -% up a different format (e.g., txi-cs.tex does this). -\ifx\today\undefined -\def\today{% - \number\day\space - \ifcase\month - \or\putwordMJan\or\putwordMFeb\or\putwordMMar\or\putwordMApr - \or\putwordMMay\or\putwordMJun\or\putwordMJul\or\putwordMAug - \or\putwordMSep\or\putwordMOct\or\putwordMNov\or\putwordMDec - \fi - \space\number\year} -\fi - -% @settitle line... specifies the title of the document, for headings. -% It generates no output of its own. -\def\thistitle{\putwordNoTitle} -\def\settitle{\parsearg{\gdef\thistitle}} - - -\message{tables,} -% Tables -- @table, @ftable, @vtable, @item(x). - -% default indentation of table text -\newdimen\tableindent \tableindent=.8in -% default indentation of @itemize and @enumerate text -\newdimen\itemindent \itemindent=.3in -% margin between end of table item and start of table text. -\newdimen\itemmargin \itemmargin=.1in - -% used internally for \itemindent minus \itemmargin -\newdimen\itemmax - -% Note @table, @ftable, and @vtable define @item, @itemx, etc., with -% these defs. -% They also define \itemindex -% to index the item name in whatever manner is desired (perhaps none). - -\newif\ifitemxneedsnegativevskip - -\def\itemxpar{\par\ifitemxneedsnegativevskip\nobreak\vskip-\parskip\nobreak\fi} - -\def\internalBitem{\smallbreak \parsearg\itemzzz} -\def\internalBitemx{\itemxpar \parsearg\itemzzz} - -\def\itemzzz #1{\begingroup % - \advance\hsize by -\rightskip - \advance\hsize by -\tableindent - \setbox0=\hbox{\itemindicate{#1}}% - \itemindex{#1}% - \nobreak % This prevents a break before @itemx. - % - % If the item text does not fit in the space we have, put it on a line - % by itself, and do not allow a page break either before or after that - % line. We do not start a paragraph here because then if the next - % command is, e.g., @kindex, the whatsit would get put into the - % horizontal list on a line by itself, resulting in extra blank space. - \ifdim \wd0>\itemmax - % - % Make this a paragraph so we get the \parskip glue and wrapping, - % but leave it ragged-right. - \begingroup - \advance\leftskip by-\tableindent - \advance\hsize by\tableindent - \advance\rightskip by0pt plus1fil - \leavevmode\unhbox0\par - \endgroup - % - % We're going to be starting a paragraph, but we don't want the - % \parskip glue -- logically it's part of the @item we just started. - \nobreak \vskip-\parskip - % - % Stop a page break at the \parskip glue coming up. (Unfortunately - % we can't prevent a possible page break at the following - % \baselineskip glue.) However, if what follows is an environment - % such as @example, there will be no \parskip glue; then - % the negative vskip we just would cause the example and the item to - % crash together. So we use this bizarre value of 10001 as a signal - % to \aboveenvbreak to insert \parskip glue after all. - % (Possibly there are other commands that could be followed by - % @example which need the same treatment, but not section titles; or - % maybe section titles are the only special case and they should be - % penalty 10001...) - \penalty 10001 - \endgroup - \itemxneedsnegativevskipfalse - \else - % The item text fits into the space. Start a paragraph, so that the - % following text (if any) will end up on the same line. - \noindent - % Do this with kerns and \unhbox so that if there is a footnote in - % the item text, it can migrate to the main vertical list and - % eventually be printed. - \nobreak\kern-\tableindent - \dimen0 = \itemmax \advance\dimen0 by \itemmargin \advance\dimen0 by -\wd0 - \unhbox0 - \nobreak\kern\dimen0 - \endgroup - \itemxneedsnegativevskiptrue - \fi -} - -\def\item{\errmessage{@item while not in a list environment}} -\def\itemx{\errmessage{@itemx while not in a list environment}} - -% @table, @ftable, @vtable. -\envdef\table{% - \let\itemindex\gobble - \tablex -} -\envdef\ftable{% - \def\itemindex ##1{\doind {fn}{\code{##1}}}% - \tablex -} -\envdef\vtable{% - \def\itemindex ##1{\doind {vr}{\code{##1}}}% - \tablex -} -\def\tablex#1{% - \def\itemindicate{#1}% - \parsearg\tabley -} -\def\tabley#1{% - {% - \makevalueexpandable - \edef\temp{\noexpand\tablez #1\space\space\space}% - \expandafter - }\temp \endtablez -} -\def\tablez #1 #2 #3 #4\endtablez{% - \aboveenvbreak - \ifnum 0#1>0 \advance \leftskip by #1\mil \fi - \ifnum 0#2>0 \tableindent=#2\mil \fi - \ifnum 0#3>0 \advance \rightskip by #3\mil \fi - \itemmax=\tableindent - \advance \itemmax by -\itemmargin - \advance \leftskip by \tableindent - \exdentamount=\tableindent - \parindent = 0pt - \parskip = \smallskipamount - \ifdim \parskip=0pt \parskip=2pt \fi - \let\item = \internalBitem - \let\itemx = \internalBitemx -} -\def\Etable{\endgraf\afterenvbreak} -\let\Eftable\Etable -\let\Evtable\Etable -\let\Eitemize\Etable -\let\Eenumerate\Etable - -% This is the counter used by @enumerate, which is really @itemize - -\newcount \itemno - -\envdef\itemize{\parsearg\doitemize} - -\def\doitemize#1{% - \aboveenvbreak - \itemmax=\itemindent - \advance\itemmax by -\itemmargin - \advance\leftskip by \itemindent - \exdentamount=\itemindent - \parindent=0pt - \parskip=\smallskipamount - \ifdim\parskip=0pt \parskip=2pt \fi - \def\itemcontents{#1}% - % @itemize with no arg is equivalent to @itemize @bullet. - \ifx\itemcontents\empty\def\itemcontents{\bullet}\fi - \let\item=\itemizeitem -} - -% Definition of @item while inside @itemize and @enumerate. -% -\def\itemizeitem{% - \advance\itemno by 1 % for enumerations - {\let\par=\endgraf \smallbreak}% reasonable place to break - {% - % If the document has an @itemize directly after a section title, a - % \nobreak will be last on the list, and \sectionheading will have - % done a \vskip-\parskip. In that case, we don't want to zero - % parskip, or the item text will crash with the heading. On the - % other hand, when there is normal text preceding the item (as there - % usually is), we do want to zero parskip, or there would be too much - % space. In that case, we won't have a \nobreak before. At least - % that's the theory. - \ifnum\lastpenalty<10000 \parskip=0in \fi - \noindent - \hbox to 0pt{\hss \itemcontents \kern\itemmargin}% - \vadjust{\penalty 1200}}% not good to break after first line of item. - \flushcr -} - -% \splitoff TOKENS\endmark defines \first to be the first token in -% TOKENS, and \rest to be the remainder. -% -\def\splitoff#1#2\endmark{\def\first{#1}\def\rest{#2}}% - -% Allow an optional argument of an uppercase letter, lowercase letter, -% or number, to specify the first label in the enumerated list. No -% argument is the same as `1'. -% -\envparseargdef\enumerate{\enumeratey #1 \endenumeratey} -\def\enumeratey #1 #2\endenumeratey{% - % If we were given no argument, pretend we were given `1'. - \def\thearg{#1}% - \ifx\thearg\empty \def\thearg{1}\fi - % - % Detect if the argument is a single token. If so, it might be a - % letter. Otherwise, the only valid thing it can be is a number. - % (We will always have one token, because of the test we just made. - % This is a good thing, since \splitoff doesn't work given nothing at - % all -- the first parameter is undelimited.) - \expandafter\splitoff\thearg\endmark - \ifx\rest\empty - % Only one token in the argument. It could still be anything. - % A ``lowercase letter'' is one whose \lccode is nonzero. - % An ``uppercase letter'' is one whose \lccode is both nonzero, and - % not equal to itself. - % Otherwise, we assume it's a number. - % - % We need the \relax at the end of the \ifnum lines to stop TeX from - % continuing to look for a . - % - \ifnum\lccode\expandafter`\thearg=0\relax - \numericenumerate % a number (we hope) - \else - % It's a letter. - \ifnum\lccode\expandafter`\thearg=\expandafter`\thearg\relax - \lowercaseenumerate % lowercase letter - \else - \uppercaseenumerate % uppercase letter - \fi - \fi - \else - % Multiple tokens in the argument. We hope it's a number. - \numericenumerate - \fi -} - -% An @enumerate whose labels are integers. The starting integer is -% given in \thearg. -% -\def\numericenumerate{% - \itemno = \thearg - \startenumeration{\the\itemno}% -} - -% The starting (lowercase) letter is in \thearg. -\def\lowercaseenumerate{% - \itemno = \expandafter`\thearg - \startenumeration{% - % Be sure we're not beyond the end of the alphabet. - \ifnum\itemno=0 - \errmessage{No more lowercase letters in @enumerate; get a bigger - alphabet}% - \fi - \char\lccode\itemno - }% -} - -% The starting (uppercase) letter is in \thearg. -\def\uppercaseenumerate{% - \itemno = \expandafter`\thearg - \startenumeration{% - % Be sure we're not beyond the end of the alphabet. - \ifnum\itemno=0 - \errmessage{No more uppercase letters in @enumerate; get a bigger - alphabet} - \fi - \char\uccode\itemno - }% -} - -% Call \doitemize, adding a period to the first argument and supplying the -% common last two arguments. Also subtract one from the initial value in -% \itemno, since @item increments \itemno. -% -\def\startenumeration#1{% - \advance\itemno by -1 - \doitemize{#1.}\flushcr -} - -% @alphaenumerate and @capsenumerate are abbreviations for giving an arg -% to @enumerate. -% -\def\alphaenumerate{\enumerate{a}} -\def\capsenumerate{\enumerate{A}} -\def\Ealphaenumerate{\Eenumerate} -\def\Ecapsenumerate{\Eenumerate} - - -% @multitable macros -% Amy Hendrickson, 8/18/94, 3/6/96 -% -% @multitable ... @end multitable will make as many columns as desired. -% Contents of each column will wrap at width given in preamble. Width -% can be specified either with sample text given in a template line, -% or in percent of \hsize, the current width of text on page. - -% Table can continue over pages but will only break between lines. - -% To make preamble: -% -% Either define widths of columns in terms of percent of \hsize: -% @multitable @columnfractions .25 .3 .45 -% @item ... -% -% Numbers following @columnfractions are the percent of the total -% current hsize to be used for each column. You may use as many -% columns as desired. - - -% Or use a template: -% @multitable {Column 1 template} {Column 2 template} {Column 3 template} -% @item ... -% using the widest term desired in each column. - -% Each new table line starts with @item, each subsequent new column -% starts with @tab. Empty columns may be produced by supplying @tab's -% with nothing between them for as many times as empty columns are needed, -% ie, @tab@tab@tab will produce two empty columns. - -% @item, @tab do not need to be on their own lines, but it will not hurt -% if they are. - -% Sample multitable: - -% @multitable {Column 1 template} {Column 2 template} {Column 3 template} -% @item first col stuff @tab second col stuff @tab third col -% @item -% first col stuff -% @tab -% second col stuff -% @tab -% third col -% @item first col stuff @tab second col stuff -% @tab Many paragraphs of text may be used in any column. -% -% They will wrap at the width determined by the template. -% @item@tab@tab This will be in third column. -% @end multitable - -% Default dimensions may be reset by user. -% @multitableparskip is vertical space between paragraphs in table. -% @multitableparindent is paragraph indent in table. -% @multitablecolmargin is horizontal space to be left between columns. -% @multitablelinespace is space to leave between table items, baseline -% to baseline. -% 0pt means it depends on current normal line spacing. -% -\newskip\multitableparskip -\newskip\multitableparindent -\newdimen\multitablecolspace -\newskip\multitablelinespace -\multitableparskip=0pt -\multitableparindent=6pt -\multitablecolspace=12pt -\multitablelinespace=0pt - -% Macros used to set up halign preamble: -% -\let\endsetuptable\relax -\def\xendsetuptable{\endsetuptable} -\let\columnfractions\relax -\def\xcolumnfractions{\columnfractions} -\newif\ifsetpercent - -% #1 is the @columnfraction, usually a decimal number like .5, but might -% be just 1. We just use it, whatever it is. -% -\def\pickupwholefraction#1 {% - \global\advance\colcount by 1 - \expandafter\xdef\csname col\the\colcount\endcsname{#1\hsize}% - \setuptable -} - -\newcount\colcount -\def\setuptable#1{% - \def\firstarg{#1}% - \ifx\firstarg\xendsetuptable - \let\go = \relax - \else - \ifx\firstarg\xcolumnfractions - \global\setpercenttrue - \else - \ifsetpercent - \let\go\pickupwholefraction - \else - \global\advance\colcount by 1 - \setbox0=\hbox{#1\unskip\space}% Add a normal word space as a - % separator; typically that is always in the input, anyway. - \expandafter\xdef\csname col\the\colcount\endcsname{\the\wd0}% - \fi - \fi - \ifx\go\pickupwholefraction - % Put the argument back for the \pickupwholefraction call, so - % we'll always have a period there to be parsed. - \def\go{\pickupwholefraction#1}% - \else - \let\go = \setuptable - \fi% - \fi - \go -} - -% multitable-only commands. -% -% @headitem starts a heading row, which we typeset in bold. -% Assignments have to be global since we are inside the implicit group -% of an alignment entry. Note that \everycr resets \everytab. -\def\headitem{\checkenv\multitable \crcr \global\everytab={\bf}\the\everytab}% -% -% A \tab used to include \hskip1sp. But then the space in a template -% line is not enough. That is bad. So let's go back to just `&' until -% we encounter the problem it was intended to solve again. -% --karl, nathan@acm.org, 20apr99. -\def\tab{\checkenv\multitable &\the\everytab}% - -% @multitable ... @end multitable definitions: -% -\newtoks\everytab % insert after every tab. -% -\envdef\multitable{% - \vskip\parskip - \startsavinginserts - % - % @item within a multitable starts a normal row. - \let\item\crcr - % - \tolerance=9500 - \hbadness=9500 - \setmultitablespacing - \parskip=\multitableparskip - \parindent=\multitableparindent - \overfullrule=0pt - \global\colcount=0 - % - \everycr = {% - \noalign{% - \global\everytab={}% - \global\colcount=0 % Reset the column counter. - % Check for saved footnotes, etc. - \checkinserts - % Keeps underfull box messages off when table breaks over pages. - %\filbreak - % Maybe so, but it also creates really weird page breaks when the - % table breaks over pages. Wouldn't \vfil be better? Wait until the - % problem manifests itself, so it can be fixed for real --karl. - }% - }% - % - \parsearg\domultitable -} -\def\domultitable#1{% - % To parse everything between @multitable and @item: - \setuptable#1 \endsetuptable - % - % This preamble sets up a generic column definition, which will - % be used as many times as user calls for columns. - % \vtop will set a single line and will also let text wrap and - % continue for many paragraphs if desired. - \halign\bgroup &% - \global\advance\colcount by 1 - \multistrut - \vtop{% - % Use the current \colcount to find the correct column width: - \hsize=\expandafter\csname col\the\colcount\endcsname - % - % In order to keep entries from bumping into each other - % we will add a \leftskip of \multitablecolspace to all columns after - % the first one. - % - % If a template has been used, we will add \multitablecolspace - % to the width of each template entry. - % - % If the user has set preamble in terms of percent of \hsize we will - % use that dimension as the width of the column, and the \leftskip - % will keep entries from bumping into each other. Table will start at - % left margin and final column will justify at right margin. - % - % Make sure we don't inherit \rightskip from the outer environment. - \rightskip=0pt - \ifnum\colcount=1 - % The first column will be indented with the surrounding text. - \advance\hsize by\leftskip - \else - \ifsetpercent \else - % If user has not set preamble in terms of percent of \hsize - % we will advance \hsize by \multitablecolspace. - \advance\hsize by \multitablecolspace - \fi - % In either case we will make \leftskip=\multitablecolspace: - \leftskip=\multitablecolspace - \fi - % Ignoring space at the beginning and end avoids an occasional spurious - % blank line, when TeX decides to break the line at the space before the - % box from the multistrut, so the strut ends up on a line by itself. - % For example: - % @multitable @columnfractions .11 .89 - % @item @code{#} - % @tab Legal holiday which is valid in major parts of the whole country. - % Is automatically provided with highlighting sequences respectively - % marking characters. - \noindent\ignorespaces##\unskip\multistrut - }\cr -} -\def\Emultitable{% - \crcr - \egroup % end the \halign - \global\setpercentfalse -} - -\def\setmultitablespacing{% test to see if user has set \multitablelinespace. -% If so, do nothing. If not, give it an appropriate dimension based on -% current baselineskip. -\ifdim\multitablelinespace=0pt -\setbox0=\vbox{X}\global\multitablelinespace=\the\baselineskip -\global\advance\multitablelinespace by-\ht0 -%% strut to put in table in case some entry doesn't have descenders, -%% to keep lines equally spaced -\let\multistrut = \strut -\else -%% FIXME: what is \box0 supposed to be? -\gdef\multistrut{\vrule height\multitablelinespace depth\dp0 -width0pt\relax} \fi -%% Test to see if parskip is larger than space between lines of -%% table. If not, do nothing. -%% If so, set to same dimension as multitablelinespace. -\ifdim\multitableparskip>\multitablelinespace -\global\multitableparskip=\multitablelinespace -\global\advance\multitableparskip-7pt %% to keep parskip somewhat smaller - %% than skip between lines in the table. -\fi% -\ifdim\multitableparskip=0pt -\global\multitableparskip=\multitablelinespace -\global\advance\multitableparskip-7pt %% to keep parskip somewhat smaller - %% than skip between lines in the table. -\fi} - - -\message{conditionals,} - -% @iftex, @ifnotdocbook, @ifnothtml, @ifnotinfo, @ifnotplaintext, -% @ifnotxml always succeed. They currently do nothing; we don't -% attempt to check whether the conditionals are properly nested. But we -% have to remember that they are conditionals, so that @end doesn't -% attempt to close an environment group. -% -\def\makecond#1{% - \expandafter\let\csname #1\endcsname = \relax - \expandafter\let\csname iscond.#1\endcsname = 1 -} -\makecond{iftex} -\makecond{ifnotdocbook} -\makecond{ifnothtml} -\makecond{ifnotinfo} -\makecond{ifnotplaintext} -\makecond{ifnotxml} - -% Ignore @ignore, @ifhtml, @ifinfo, and the like. -% -\def\direntry{\doignore{direntry}} -\def\documentdescription{\doignore{documentdescription}} -\def\docbook{\doignore{docbook}} -\def\html{\doignore{html}} -\def\ifdocbook{\doignore{ifdocbook}} -\def\ifhtml{\doignore{ifhtml}} -\def\ifinfo{\doignore{ifinfo}} -\def\ifnottex{\doignore{ifnottex}} -\def\ifplaintext{\doignore{ifplaintext}} -\def\ifxml{\doignore{ifxml}} -\def\ignore{\doignore{ignore}} -\def\menu{\doignore{menu}} -\def\xml{\doignore{xml}} - -% Ignore text until a line `@end #1', keeping track of nested conditionals. -% -% A count to remember the depth of nesting. -\newcount\doignorecount - -\def\doignore#1{\begingroup - % Scan in ``verbatim'' mode: - \catcode`\@ = \other - \catcode`\{ = \other - \catcode`\} = \other - % - % Make sure that spaces turn into tokens that match what \doignoretext wants. - \spaceisspace - % - % Count number of #1's that we've seen. - \doignorecount = 0 - % - % Swallow text until we reach the matching `@end #1'. - \dodoignore {#1}% -} - -{ \catcode`_=11 % We want to use \_STOP_ which cannot appear in texinfo source. - \obeylines % - % - \gdef\dodoignore#1{% - % #1 contains the string `ifinfo'. - % - % Define a command to find the next `@end #1', which must be on a line - % by itself. - \long\def\doignoretext##1^^M@end #1{\doignoretextyyy##1^^M@#1\_STOP_}% - % And this command to find another #1 command, at the beginning of a - % line. (Otherwise, we would consider a line `@c @ifset', for - % example, to count as an @ifset for nesting.) - \long\def\doignoretextyyy##1^^M@#1##2\_STOP_{\doignoreyyy{##2}\_STOP_}% - % - % And now expand that command. - \obeylines % - \doignoretext ^^M% - }% -} - -\def\doignoreyyy#1{% - \def\temp{#1}% - \ifx\temp\empty % Nothing found. - \let\next\doignoretextzzz - \else % Found a nested condition, ... - \advance\doignorecount by 1 - \let\next\doignoretextyyy % ..., look for another. - % If we're here, #1 ends with ^^M\ifinfo (for example). - \fi - \next #1% the token \_STOP_ is present just after this macro. -} - -% We have to swallow the remaining "\_STOP_". -% -\def\doignoretextzzz#1{% - \ifnum\doignorecount = 0 % We have just found the outermost @end. - \let\next\enddoignore - \else % Still inside a nested condition. - \advance\doignorecount by -1 - \let\next\doignoretext % Look for the next @end. - \fi - \next -} - -% Finish off ignored text. -\def\enddoignore{\endgroup\ignorespaces} - - -% @set VAR sets the variable VAR to an empty value. -% @set VAR REST-OF-LINE sets VAR to the value REST-OF-LINE. -% -% Since we want to separate VAR from REST-OF-LINE (which might be -% empty), we can't just use \parsearg; we have to insert a space of our -% own to delimit the rest of the line, and then take it out again if we -% didn't need it. -% We rely on the fact that \parsearg sets \catcode`\ =10. -% -\parseargdef\set{\setyyy#1 \endsetyyy} -\def\setyyy#1 #2\endsetyyy{% - {% - \makevalueexpandable - \def\temp{#2}% - \edef\next{\gdef\makecsname{SET#1}}% - \ifx\temp\empty - \next{}% - \else - \setzzz#2\endsetzzz - \fi - }% -} -% Remove the trailing space \setxxx inserted. -\def\setzzz#1 \endsetzzz{\next{#1}} - -% @clear VAR clears (i.e., unsets) the variable VAR. -% -\parseargdef\clear{% - {% - \makevalueexpandable - \global\expandafter\let\csname SET#1\endcsname=\relax - }% -} - -% @value{foo} gets the text saved in variable foo. -\def\value{\begingroup\makevalueexpandable\valuexxx} -\def\valuexxx#1{\expandablevalue{#1}\endgroup} -{ - \catcode`\- = \active \catcode`\_ = \active - % - \gdef\makevalueexpandable{% - \let\value = \expandablevalue - % We don't want these characters active, ... - \catcode`\-=\other \catcode`\_=\other - % ..., but we might end up with active ones in the argument if - % we're called from @code, as @code{@value{foo-bar_}}, though. - % So \let them to their normal equivalents. - \let-\realdash \let_\normalunderscore - } -} - -% We have this subroutine so that we can handle at least some @value's -% properly in indexes (we call \makevalueexpandable in \indexdummies). -% The command has to be fully expandable (if the variable is set), since -% the result winds up in the index file. This means that if the -% variable's value contains other Texinfo commands, it's almost certain -% it will fail (although perhaps we could fix that with sufficient work -% to do a one-level expansion on the result, instead of complete). -% -\def\expandablevalue#1{% - \expandafter\ifx\csname SET#1\endcsname\relax - {[No value for ``#1'']}% - \message{Variable `#1', used in @value, is not set.}% - \else - \csname SET#1\endcsname - \fi -} - -% @ifset VAR ... @end ifset reads the `...' iff VAR has been defined -% with @set. -% -% To get special treatment of `@end ifset,' call \makeond and the redefine. -% -\makecond{ifset} -\def\ifset{\parsearg{\doifset{\let\next=\ifsetfail}}} -\def\doifset#1#2{% - {% - \makevalueexpandable - \let\next=\empty - \expandafter\ifx\csname SET#2\endcsname\relax - #1% If not set, redefine \next. - \fi - \expandafter - }\next -} -\def\ifsetfail{\doignore{ifset}} - -% @ifclear VAR ... @end ifclear reads the `...' iff VAR has never been -% defined with @set, or has been undefined with @clear. -% -% The `\else' inside the `\doifset' parameter is a trick to reuse the -% above code: if the variable is not set, do nothing, if it is set, -% then redefine \next to \ifclearfail. -% -\makecond{ifclear} -\def\ifclear{\parsearg{\doifset{\else \let\next=\ifclearfail}}} -\def\ifclearfail{\doignore{ifclear}} - -% @dircategory CATEGORY -- specify a category of the dir file -% which this file should belong to. Ignore this in TeX. -\let\dircategory=\comment - -% @defininfoenclose. -\let\definfoenclose=\comment - - -\message{indexing,} -% Index generation facilities - -% Define \newwrite to be identical to plain tex's \newwrite -% except not \outer, so it can be used within \newindex. -{\catcode`\@=11 -\gdef\newwrite{\alloc@7\write\chardef\sixt@@n}} - -% \newindex {foo} defines an index named foo. -% It automatically defines \fooindex such that -% \fooindex ...rest of line... puts an entry in the index foo. -% It also defines \fooindfile to be the number of the output channel for -% the file that accumulates this index. The file's extension is foo. -% The name of an index should be no more than 2 characters long -% for the sake of vms. -% -\def\newindex#1{% - \iflinks - \expandafter\newwrite \csname#1indfile\endcsname - \openout \csname#1indfile\endcsname \jobname.#1 % Open the file - \fi - \expandafter\xdef\csname#1index\endcsname{% % Define @#1index - \noexpand\doindex{#1}} -} - -% @defindex foo == \newindex{foo} -% -\def\defindex{\parsearg\newindex} - -% Define @defcodeindex, like @defindex except put all entries in @code. -% -\def\defcodeindex{\parsearg\newcodeindex} -% -\def\newcodeindex#1{% - \iflinks - \expandafter\newwrite \csname#1indfile\endcsname - \openout \csname#1indfile\endcsname \jobname.#1 - \fi - \expandafter\xdef\csname#1index\endcsname{% - \noexpand\docodeindex{#1}}% -} - - -% @synindex foo bar makes index foo feed into index bar. -% Do this instead of @defindex foo if you don't want it as a separate index. -% -% @syncodeindex foo bar similar, but put all entries made for index foo -% inside @code. -% -\def\synindex#1 #2 {\dosynindex\doindex{#1}{#2}} -\def\syncodeindex#1 #2 {\dosynindex\docodeindex{#1}{#2}} - -% #1 is \doindex or \docodeindex, #2 the index getting redefined (foo), -% #3 the target index (bar). -\def\dosynindex#1#2#3{% - % Only do \closeout if we haven't already done it, else we'll end up - % closing the target index. - \expandafter \ifx\csname donesynindex#2\endcsname \undefined - % The \closeout helps reduce unnecessary open files; the limit on the - % Acorn RISC OS is a mere 16 files. - \expandafter\closeout\csname#2indfile\endcsname - \expandafter\let\csname\donesynindex#2\endcsname = 1 - \fi - % redefine \fooindfile: - \expandafter\let\expandafter\temp\expandafter=\csname#3indfile\endcsname - \expandafter\let\csname#2indfile\endcsname=\temp - % redefine \fooindex: - \expandafter\xdef\csname#2index\endcsname{\noexpand#1{#3}}% -} - -% Define \doindex, the driver for all \fooindex macros. -% Argument #1 is generated by the calling \fooindex macro, -% and it is "foo", the name of the index. - -% \doindex just uses \parsearg; it calls \doind for the actual work. -% This is because \doind is more useful to call from other macros. - -% There is also \dosubind {index}{topic}{subtopic} -% which makes an entry in a two-level index such as the operation index. - -\def\doindex#1{\edef\indexname{#1}\parsearg\singleindexer} -\def\singleindexer #1{\doind{\indexname}{#1}} - -% like the previous two, but they put @code around the argument. -\def\docodeindex#1{\edef\indexname{#1}\parsearg\singlecodeindexer} -\def\singlecodeindexer #1{\doind{\indexname}{\code{#1}}} - -% Take care of Texinfo commands that can appear in an index entry. -% Since there are some commands we want to expand, and others we don't, -% we have to laboriously prevent expansion for those that we don't. -% -\def\indexdummies{% - \def\@{@}% change to @@ when we switch to @ as escape char in index files. - \def\ {\realbackslash\space }% - % Need these in case \tex is in effect and \{ is a \delimiter again. - % But can't use \lbracecmd and \rbracecmd because texindex assumes - % braces and backslashes are used only as delimiters. - \let\{ = \mylbrace - \let\} = \myrbrace - % - % \definedummyword defines \#1 as \realbackslash #1\space, thus - % effectively preventing its expansion. This is used only for control - % words, not control letters, because the \space would be incorrect - % for control characters, but is needed to separate the control word - % from whatever follows. - % - % For control letters, we have \definedummyletter, which omits the - % space. - % - % These can be used both for control words that take an argument and - % those that do not. If it is followed by {arg} in the input, then - % that will dutifully get written to the index (or wherever). - % - \def\definedummyword##1{% - \expandafter\def\csname ##1\endcsname{\realbackslash ##1\space}% - }% - \def\definedummyletter##1{% - \expandafter\def\csname ##1\endcsname{\realbackslash ##1}% - }% - \let\definedummyaccent\definedummyletter - % - % Do the redefinitions. - \commondummies -} - -% For the aux file, @ is the escape character. So we want to redefine -% everything using @ instead of \realbackslash. When everything uses -% @, this will be simpler. -% -\def\atdummies{% - \def\@{@@}% - \def\ {@ }% - \let\{ = \lbraceatcmd - \let\} = \rbraceatcmd - % - % (See comments in \indexdummies.) - \def\definedummyword##1{% - \expandafter\def\csname ##1\endcsname{@##1\space}% - }% - \def\definedummyletter##1{% - \expandafter\def\csname ##1\endcsname{@##1}% - }% - \let\definedummyaccent\definedummyletter - % - % Do the redefinitions. - \commondummies -} - -% Called from \indexdummies and \atdummies. \definedummyword and -% \definedummyletter must be defined first. -% -\def\commondummies{% - % - \normalturnoffactive - % - \commondummiesnofonts - % - \definedummyletter{_}% - % - % Non-English letters. - \definedummyword{AA}% - \definedummyword{AE}% - \definedummyword{L}% - \definedummyword{OE}% - \definedummyword{O}% - \definedummyword{aa}% - \definedummyword{ae}% - \definedummyword{l}% - \definedummyword{oe}% - \definedummyword{o}% - \definedummyword{ss}% - \definedummyword{exclamdown}% - \definedummyword{questiondown}% - \definedummyword{ordf}% - \definedummyword{ordm}% - % - % Although these internal commands shouldn't show up, sometimes they do. - \definedummyword{bf}% - \definedummyword{gtr}% - \definedummyword{hat}% - \definedummyword{less}% - \definedummyword{sf}% - \definedummyword{sl}% - \definedummyword{tclose}% - \definedummyword{tt}% - % - \definedummyword{LaTeX}% - \definedummyword{TeX}% - % - % Assorted special characters. - \definedummyword{bullet}% - \definedummyword{copyright}% - \definedummyword{registeredsymbol}% - \definedummyword{dots}% - \definedummyword{enddots}% - \definedummyword{equiv}% - \definedummyword{error}% - \definedummyword{expansion}% - \definedummyword{minus}% - \definedummyword{pounds}% - \definedummyword{point}% - \definedummyword{print}% - \definedummyword{result}% - % - % Handle some cases of @value -- where it does not contain any - % (non-fully-expandable) commands. - \makevalueexpandable - % - % Normal spaces, not active ones. - \unsepspaces - % - % No macro expansion. - \turnoffmacros -} - -% \commondummiesnofonts: common to \commondummies and \indexnofonts. -% -% Better have this without active chars. -{ - \catcode`\~=\other - \gdef\commondummiesnofonts{% - % Control letters and accents. - \definedummyletter{!}% - \definedummyaccent{"}% - \definedummyaccent{'}% - \definedummyletter{*}% - \definedummyaccent{,}% - \definedummyletter{.}% - \definedummyletter{/}% - \definedummyletter{:}% - \definedummyaccent{=}% - \definedummyletter{?}% - \definedummyaccent{^}% - \definedummyaccent{`}% - \definedummyaccent{~}% - \definedummyword{u}% - \definedummyword{v}% - \definedummyword{H}% - \definedummyword{dotaccent}% - \definedummyword{ringaccent}% - \definedummyword{tieaccent}% - \definedummyword{ubaraccent}% - \definedummyword{udotaccent}% - \definedummyword{dotless}% - % - % Texinfo font commands. - \definedummyword{b}% - \definedummyword{i}% - \definedummyword{r}% - \definedummyword{sc}% - \definedummyword{t}% - % - % Commands that take arguments. - \definedummyword{acronym}% - \definedummyword{cite}% - \definedummyword{code}% - \definedummyword{command}% - \definedummyword{dfn}% - \definedummyword{emph}% - \definedummyword{env}% - \definedummyword{file}% - \definedummyword{kbd}% - \definedummyword{key}% - \definedummyword{math}% - \definedummyword{option}% - \definedummyword{samp}% - \definedummyword{strong}% - \definedummyword{tie}% - \definedummyword{uref}% - \definedummyword{url}% - \definedummyword{var}% - \definedummyword{verb}% - \definedummyword{w}% - } -} - -% \indexnofonts is used when outputting the strings to sort the index -% by, and when constructing control sequence names. It eliminates all -% control sequences and just writes whatever the best ASCII sort string -% would be for a given command (usually its argument). -% -\def\indexnofonts{% - % Accent commands should become @asis. - \def\definedummyaccent##1{% - \expandafter\let\csname ##1\endcsname\asis - }% - % We can just ignore other control letters. - \def\definedummyletter##1{% - \expandafter\def\csname ##1\endcsname{}% - }% - % Hopefully, all control words can become @asis. - \let\definedummyword\definedummyaccent - % - \commondummiesnofonts - % - % Don't no-op \tt, since it isn't a user-level command - % and is used in the definitions of the active chars like <, >, |, etc. - % Likewise with the other plain tex font commands. - %\let\tt=\asis - % - \def\ { }% - \def\@{@}% - % how to handle braces? - \def\_{\normalunderscore}% - % - % Non-English letters. - \def\AA{AA}% - \def\AE{AE}% - \def\L{L}% - \def\OE{OE}% - \def\O{O}% - \def\aa{aa}% - \def\ae{ae}% - \def\l{l}% - \def\oe{oe}% - \def\o{o}% - \def\ss{ss}% - \def\exclamdown{!}% - \def\questiondown{?}% - \def\ordf{a}% - \def\ordm{o}% - % - \def\LaTeX{LaTeX}% - \def\TeX{TeX}% - % - % Assorted special characters. - % (The following {} will end up in the sort string, but that's ok.) - \def\bullet{bullet}% - \def\copyright{copyright}% - \def\registeredsymbol{R}% - \def\dots{...}% - \def\enddots{...}% - \def\equiv{==}% - \def\error{error}% - \def\expansion{==>}% - \def\minus{-}% - \def\pounds{pounds}% - \def\point{.}% - \def\print{-|}% - \def\result{=>}% - % - % Don't write macro names. - \emptyusermacros -} - -\let\indexbackslash=0 %overridden during \printindex. -\let\SETmarginindex=\relax % put index entries in margin (undocumented)? - -% Most index entries go through here, but \dosubind is the general case. -% #1 is the index name, #2 is the entry text. -\def\doind#1#2{\dosubind{#1}{#2}{}} - -% Workhorse for all \fooindexes. -% #1 is name of index, #2 is stuff to put there, #3 is subentry -- -% empty if called from \doind, as we usually are (the main exception -% is with most defuns, which call us directly). -% -\def\dosubind#1#2#3{% - \iflinks - {% - % Store the main index entry text (including the third arg). - \toks0 = {#2}% - % If third arg is present, precede it with a space. - \def\thirdarg{#3}% - \ifx\thirdarg\empty \else - \toks0 = \expandafter{\the\toks0 \space #3}% - \fi - % - \edef\writeto{\csname#1indfile\endcsname}% - % - \ifvmode - \dosubindsanitize - \else - \dosubindwrite - \fi - }% - \fi -} - -% Write the entry in \toks0 to the index file: -% -\def\dosubindwrite{% - % Put the index entry in the margin if desired. - \ifx\SETmarginindex\relax\else - \insert\margin{\hbox{\vrule height8pt depth3pt width0pt \the\toks0}}% - \fi - % - % Remember, we are within a group. - \indexdummies % Must do this here, since \bf, etc expand at this stage - \escapechar=`\\ - \def\backslashcurfont{\indexbackslash}% \indexbackslash isn't defined now - % so it will be output as is; and it will print as backslash. - % - % Process the index entry with all font commands turned off, to - % get the string to sort by. - {\indexnofonts - \edef\temp{\the\toks0}% need full expansion - \xdef\indexsorttmp{\temp}% - }% - % - % Set up the complete index entry, with both the sort key and - % the original text, including any font commands. We write - % three arguments to \entry to the .?? file (four in the - % subentry case), texindex reduces to two when writing the .??s - % sorted result. - \edef\temp{% - \write\writeto{% - \string\entry{\indexsorttmp}{\noexpand\folio}{\the\toks0}}% - }% - \temp -} - -% Take care of unwanted page breaks: -% -% If a skip is the last thing on the list now, preserve it -% by backing up by \lastskip, doing the \write, then inserting -% the skip again. Otherwise, the whatsit generated by the -% \write will make \lastskip zero. The result is that sequences -% like this: -% @end defun -% @tindex whatever -% @defun ... -% will have extra space inserted, because the \medbreak in the -% start of the @defun won't see the skip inserted by the @end of -% the previous defun. -% -% But don't do any of this if we're not in vertical mode. We -% don't want to do a \vskip and prematurely end a paragraph. -% -% Avoid page breaks due to these extra skips, too. -% -% But wait, there is a catch there: -% We'll have to check whether \lastskip is zero skip. \ifdim is not -% sufficient for this purpose, as it ignores stretch and shrink parts -% of the skip. The only way seems to be to check the textual -% representation of the skip. -% -% The following is almost like \def\zeroskipmacro{0.0pt} except that -% the ``p'' and ``t'' characters have catcode \other, not 11 (letter). -% -\edef\zeroskipmacro{\expandafter\the\csname z@skip\endcsname} -% -% ..., ready, GO: -% -\def\dosubindsanitize{% - % \lastskip and \lastpenalty cannot both be nonzero simultaneously. - \skip0 = \lastskip - \edef\lastskipmacro{\the\lastskip}% - \count255 = \lastpenalty - % - % If \lastskip is nonzero, that means the last item was a - % skip. And since a skip is discardable, that means this - % -\skip0 glue we're inserting is preceded by a - % non-discardable item, therefore it is not a potential - % breakpoint, therefore no \nobreak needed. - \ifx\lastskipmacro\zeroskipmacro - \else - \vskip-\skip0 - \fi - % - \dosubindwrite - % - \ifx\lastskipmacro\zeroskipmacro - % if \lastskip was zero, perhaps the last item was a - % penalty, and perhaps it was >=10000, e.g., a \nobreak. - % In that case, we want to re-insert the penalty; since we - % just inserted a non-discardable item, any following glue - % (such as a \parskip) would be a breakpoint. For example: - % @deffn deffn-whatever - % @vindex index-whatever - % Description. - % would allow a break between the index-whatever whatsit - % and the "Description." paragraph. - \ifnum\count255>9999 \nobreak \fi - \else - % On the other hand, if we had a nonzero \lastskip, - % this make-up glue would be preceded by a non-discardable item - % (the whatsit from the \write), so we must insert a \nobreak. - \nobreak\vskip\skip0 - \fi -} - -% The index entry written in the file actually looks like -% \entry {sortstring}{page}{topic} -% or -% \entry {sortstring}{page}{topic}{subtopic} -% The texindex program reads in these files and writes files -% containing these kinds of lines: -% \initial {c} -% before the first topic whose initial is c -% \entry {topic}{pagelist} -% for a topic that is used without subtopics -% \primary {topic} -% for the beginning of a topic that is used with subtopics -% \secondary {subtopic}{pagelist} -% for each subtopic. - -% Define the user-accessible indexing commands -% @findex, @vindex, @kindex, @cindex. - -\def\findex {\fnindex} -\def\kindex {\kyindex} -\def\cindex {\cpindex} -\def\vindex {\vrindex} -\def\tindex {\tpindex} -\def\pindex {\pgindex} - -\def\cindexsub {\begingroup\obeylines\cindexsub} -{\obeylines % -\gdef\cindexsub "#1" #2^^M{\endgroup % -\dosubind{cp}{#2}{#1}}} - -% Define the macros used in formatting output of the sorted index material. - -% @printindex causes a particular index (the ??s file) to get printed. -% It does not print any chapter heading (usually an @unnumbered). -% -\parseargdef\printindex{\begingroup - \dobreak \chapheadingskip{10000}% - % - \smallfonts \rm - \tolerance = 9500 - \everypar = {}% don't want the \kern\-parindent from indentation suppression. - % - % See if the index file exists and is nonempty. - % Change catcode of @ here so that if the index file contains - % \initial {@} - % as its first line, TeX doesn't complain about mismatched braces - % (because it thinks @} is a control sequence). - \catcode`\@ = 11 - \openin 1 \jobname.#1s - \ifeof 1 - % \enddoublecolumns gets confused if there is no text in the index, - % and it loses the chapter title and the aux file entries for the - % index. The easiest way to prevent this problem is to make sure - % there is some text. - \putwordIndexNonexistent - \else - % - % If the index file exists but is empty, then \openin leaves \ifeof - % false. We have to make TeX try to read something from the file, so - % it can discover if there is anything in it. - \read 1 to \temp - \ifeof 1 - \putwordIndexIsEmpty - \else - % Index files are almost Texinfo source, but we use \ as the escape - % character. It would be better to use @, but that's too big a change - % to make right now. - \def\indexbackslash{\backslashcurfont}% - \catcode`\\ = 0 - \escapechar = `\\ - \begindoublecolumns - \input \jobname.#1s - \enddoublecolumns - \fi - \fi - \closein 1 -\endgroup} - -% These macros are used by the sorted index file itself. -% Change them to control the appearance of the index. - -\def\initial#1{{% - % Some minor font changes for the special characters. - \let\tentt=\sectt \let\tt=\sectt \let\sf=\sectt - % - % Remove any glue we may have, we'll be inserting our own. - \removelastskip - % - % We like breaks before the index initials, so insert a bonus. - \penalty -300 - % - % Typeset the initial. Making this add up to a whole number of - % baselineskips increases the chance of the dots lining up from column - % to column. It still won't often be perfect, because of the stretch - % we need before each entry, but it's better. - % - % No shrink because it confuses \balancecolumns. - \vskip 1.67\baselineskip plus .5\baselineskip - \leftline{\secbf #1}% - \vskip .33\baselineskip plus .1\baselineskip - % - % Do our best not to break after the initial. - \nobreak -}} - -% \entry typesets a paragraph consisting of the text (#1), dot leaders, and -% then page number (#2) flushed to the right margin. It is used for index -% and table of contents entries. The paragraph is indented by \leftskip. -% -% A straightforward implementation would start like this: -% \def\entry#1#2{... -% But this frozes the catcodes in the argument, and can cause problems to -% @code, which sets - active. This problem was fixed by a kludge--- -% ``-'' was active throughout whole index, but this isn't really right. -% -% The right solution is to prevent \entry from swallowing the whole text. -% --kasal, 21nov03 -\def\entry{% - \begingroup - % - % Start a new paragraph if necessary, so our assignments below can't - % affect previous text. - \par - % - % Do not fill out the last line with white space. - \parfillskip = 0in - % - % No extra space above this paragraph. - \parskip = 0in - % - % Do not prefer a separate line ending with a hyphen to fewer lines. - \finalhyphendemerits = 0 - % - % \hangindent is only relevant when the entry text and page number - % don't both fit on one line. In that case, bob suggests starting the - % dots pretty far over on the line. Unfortunately, a large - % indentation looks wrong when the entry text itself is broken across - % lines. So we use a small indentation and put up with long leaders. - % - % \hangafter is reset to 1 (which is the value we want) at the start - % of each paragraph, so we need not do anything with that. - \hangindent = 2em - % - % When the entry text needs to be broken, just fill out the first line - % with blank space. - \rightskip = 0pt plus1fil - % - % A bit of stretch before each entry for the benefit of balancing - % columns. - \vskip 0pt plus1pt - % - % Swallow the left brace of the text (first parameter): - \afterassignment\doentry - \let\temp = -} -\def\doentry{% - \bgroup % Instead of the swallowed brace. - \noindent - \aftergroup\finishentry - % And now comes the text of the entry. -} -\def\finishentry#1{% - % #1 is the page number. - % - % The following is kludged to not output a line of dots in the index if - % there are no page numbers. The next person who breaks this will be - % cursed by a Unix daemon. - \def\tempa{{\rm }}% - \def\tempb{#1}% - \edef\tempc{\tempa}% - \edef\tempd{\tempb}% - \ifx\tempc\tempd - \ % - \else - % - % If we must, put the page number on a line of its own, and fill out - % this line with blank space. (The \hfil is overwhelmed with the - % fill leaders glue in \indexdotfill if the page number does fit.) - \hfil\penalty50 - \null\nobreak\indexdotfill % Have leaders before the page number. - % - % The `\ ' here is removed by the implicit \unskip that TeX does as - % part of (the primitive) \par. Without it, a spurious underfull - % \hbox ensues. - \ifpdf - \pdfgettoks#1.% - \ \the\toksA - \else - \ #1% - \fi - \fi - \par - \endgroup -} - -% Like \dotfill except takes at least 1 em. -\def\indexdotfill{\cleaders - \hbox{$\mathsurround=0pt \mkern1.5mu ${\it .}$ \mkern1.5mu$}\hskip 1em plus 1fill} - -\def\primary #1{\line{#1\hfil}} - -\newskip\secondaryindent \secondaryindent=0.5cm -\def\secondary#1#2{{% - \parfillskip=0in - \parskip=0in - \hangindent=1in - \hangafter=1 - \noindent\hskip\secondaryindent\hbox{#1}\indexdotfill - \ifpdf - \pdfgettoks#2.\ \the\toksA % The page number ends the paragraph. - \else - #2 - \fi - \par -}} - -% Define two-column mode, which we use to typeset indexes. -% Adapted from the TeXbook, page 416, which is to say, -% the manmac.tex format used to print the TeXbook itself. -\catcode`\@=11 - -\newbox\partialpage -\newdimen\doublecolumnhsize - -\def\begindoublecolumns{\begingroup % ended by \enddoublecolumns - % Grab any single-column material above us. - \output = {% - % - % Here is a possibility not foreseen in manmac: if we accumulate a - % whole lot of material, we might end up calling this \output - % routine twice in a row (see the doublecol-lose test, which is - % essentially a couple of indexes with @setchapternewpage off). In - % that case we just ship out what is in \partialpage with the normal - % output routine. Generally, \partialpage will be empty when this - % runs and this will be a no-op. See the indexspread.tex test case. - \ifvoid\partialpage \else - \onepageout{\pagecontents\partialpage}% - \fi - % - \global\setbox\partialpage = \vbox{% - % Unvbox the main output page. - \unvbox\PAGE - \kern-\topskip \kern\baselineskip - }% - }% - \eject % run that output routine to set \partialpage - % - % Use the double-column output routine for subsequent pages. - \output = {\doublecolumnout}% - % - % Change the page size parameters. We could do this once outside this - % routine, in each of @smallbook, @afourpaper, and the default 8.5x11 - % format, but then we repeat the same computation. Repeating a couple - % of assignments once per index is clearly meaningless for the - % execution time, so we may as well do it in one place. - % - % First we halve the line length, less a little for the gutter between - % the columns. We compute the gutter based on the line length, so it - % changes automatically with the paper format. The magic constant - % below is chosen so that the gutter has the same value (well, +-<1pt) - % as it did when we hard-coded it. - % - % We put the result in a separate register, \doublecolumhsize, so we - % can restore it in \pagesofar, after \hsize itself has (potentially) - % been clobbered. - % - \doublecolumnhsize = \hsize - \advance\doublecolumnhsize by -.04154\hsize - \divide\doublecolumnhsize by 2 - \hsize = \doublecolumnhsize - % - % Double the \vsize as well. (We don't need a separate register here, - % since nobody clobbers \vsize.) - \vsize = 2\vsize -} - -% The double-column output routine for all double-column pages except -% the last. -% -\def\doublecolumnout{% - \splittopskip=\topskip \splitmaxdepth=\maxdepth - % Get the available space for the double columns -- the normal - % (undoubled) page height minus any material left over from the - % previous page. - \dimen@ = \vsize - \divide\dimen@ by 2 - \advance\dimen@ by -\ht\partialpage - % - % box0 will be the left-hand column, box2 the right. - \setbox0=\vsplit255 to\dimen@ \setbox2=\vsplit255 to\dimen@ - \onepageout\pagesofar - \unvbox255 - \penalty\outputpenalty -} -% -% Re-output the contents of the output page -- any previous material, -% followed by the two boxes we just split, in box0 and box2. -\def\pagesofar{% - \unvbox\partialpage - % - \hsize = \doublecolumnhsize - \wd0=\hsize \wd2=\hsize - \hbox to\pagewidth{\box0\hfil\box2}% -} -% -% All done with double columns. -\def\enddoublecolumns{% - \output = {% - % Split the last of the double-column material. Leave it on the - % current page, no automatic page break. - \balancecolumns - % - % If we end up splitting too much material for the current page, - % though, there will be another page break right after this \output - % invocation ends. Having called \balancecolumns once, we do not - % want to call it again. Therefore, reset \output to its normal - % definition right away. (We hope \balancecolumns will never be - % called on to balance too much material, but if it is, this makes - % the output somewhat more palatable.) - \global\output = {\onepageout{\pagecontents\PAGE}}% - }% - \eject - \endgroup % started in \begindoublecolumns - % - % \pagegoal was set to the doubled \vsize above, since we restarted - % the current page. We're now back to normal single-column - % typesetting, so reset \pagegoal to the normal \vsize (after the - % \endgroup where \vsize got restored). - \pagegoal = \vsize -} -% -% Called at the end of the double column material. -\def\balancecolumns{% - \setbox0 = \vbox{\unvbox255}% like \box255 but more efficient, see p.120. - \dimen@ = \ht0 - \advance\dimen@ by \topskip - \advance\dimen@ by-\baselineskip - \divide\dimen@ by 2 % target to split to - %debug\message{final 2-column material height=\the\ht0, target=\the\dimen@.}% - \splittopskip = \topskip - % Loop until we get a decent breakpoint. - {% - \vbadness = 10000 - \loop - \global\setbox3 = \copy0 - \global\setbox1 = \vsplit3 to \dimen@ - \ifdim\ht3>\dimen@ - \global\advance\dimen@ by 1pt - \repeat - }% - %debug\message{split to \the\dimen@, column heights: \the\ht1, \the\ht3.}% - \setbox0=\vbox to\dimen@{\unvbox1}% - \setbox2=\vbox to\dimen@{\unvbox3}% - % - \pagesofar -} -\catcode`\@ = \other - - -\message{sectioning,} -% Chapters, sections, etc. - -% \unnumberedno is an oxymoron, of course. But we count the unnumbered -% sections so that we can refer to them unambiguously in the pdf -% outlines by their "section number". We avoid collisions with chapter -% numbers by starting them at 10000. (If a document ever has 10000 -% chapters, we're in trouble anyway, I'm sure.) -\newcount\unnumberedno \unnumberedno = 10000 -\newcount\chapno -\newcount\secno \secno=0 -\newcount\subsecno \subsecno=0 -\newcount\subsubsecno \subsubsecno=0 - -% This counter is funny since it counts through charcodes of letters A, B, ... -\newcount\appendixno \appendixno = `\@ -% -% \def\appendixletter{\char\the\appendixno} -% We do the following ugly conditional instead of the above simple -% construct for the sake of pdftex, which needs the actual -% letter in the expansion, not just typeset. -% -\def\appendixletter{% - \ifnum\appendixno=`A A% - \else\ifnum\appendixno=`B B% - \else\ifnum\appendixno=`C C% - \else\ifnum\appendixno=`D D% - \else\ifnum\appendixno=`E E% - \else\ifnum\appendixno=`F F% - \else\ifnum\appendixno=`G G% - \else\ifnum\appendixno=`H H% - \else\ifnum\appendixno=`I I% - \else\ifnum\appendixno=`J J% - \else\ifnum\appendixno=`K K% - \else\ifnum\appendixno=`L L% - \else\ifnum\appendixno=`M M% - \else\ifnum\appendixno=`N N% - \else\ifnum\appendixno=`O O% - \else\ifnum\appendixno=`P P% - \else\ifnum\appendixno=`Q Q% - \else\ifnum\appendixno=`R R% - \else\ifnum\appendixno=`S S% - \else\ifnum\appendixno=`T T% - \else\ifnum\appendixno=`U U% - \else\ifnum\appendixno=`V V% - \else\ifnum\appendixno=`W W% - \else\ifnum\appendixno=`X X% - \else\ifnum\appendixno=`Y Y% - \else\ifnum\appendixno=`Z Z% - % The \the is necessary, despite appearances, because \appendixletter is - % expanded while writing the .toc file. \char\appendixno is not - % expandable, thus it is written literally, thus all appendixes come out - % with the same letter (or @) in the toc without it. - \else\char\the\appendixno - \fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi - \fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi} - -% Each @chapter defines this as the name of the chapter. -% page headings and footings can use it. @section does likewise. -% However, they are not reliable, because we don't use marks. -\def\thischapter{} -\def\thissection{} - -\newcount\absseclevel % used to calculate proper heading level -\newcount\secbase\secbase=0 % @raisesections/@lowersections modify this count - -% @raisesections: treat @section as chapter, @subsection as section, etc. -\def\raisesections{\global\advance\secbase by -1} -\let\up=\raisesections % original BFox name - -% @lowersections: treat @chapter as section, @section as subsection, etc. -\def\lowersections{\global\advance\secbase by 1} -\let\down=\lowersections % original BFox name - -% we only have subsub. -\chardef\maxseclevel = 3 -% -% A numbered section within an unnumbered changes to unnumbered too. -% To achive this, remember the "biggest" unnum. sec. we are currently in: -\chardef\unmlevel = \maxseclevel -% -% Trace whether the current chapter is an appendix or not: -% \chapheadtype is "N" or "A", unnumbered chapters are ignored. -\def\chapheadtype{N} - -% Choose a heading macro -% #1 is heading type -% #2 is heading level -% #3 is text for heading -\def\genhead#1#2#3{% - % Compute the abs. sec. level: - \absseclevel=#2 - \advance\absseclevel by \secbase - % Make sure \absseclevel doesn't fall outside the range: - \ifnum \absseclevel < 0 - \absseclevel = 0 - \else - \ifnum \absseclevel > 3 - \absseclevel = 3 - \fi - \fi - % The heading type: - \def\headtype{#1}% - \if \headtype U% - \ifnum \absseclevel < \unmlevel - \chardef\unmlevel = \absseclevel - \fi - \else - % Check for appendix sections: - \ifnum \absseclevel = 0 - \edef\chapheadtype{\headtype}% - \else - \if \headtype A\if \chapheadtype N% - \errmessage{@appendix... within a non-appendix chapter}% - \fi\fi - \fi - % Check for numbered within unnumbered: - \ifnum \absseclevel > \unmlevel - \def\headtype{U}% - \else - \chardef\unmlevel = 3 - \fi - \fi - % Now print the heading: - \if \headtype U% - \ifcase\absseclevel - \unnumberedzzz{#3}% - \or \unnumberedseczzz{#3}% - \or \unnumberedsubseczzz{#3}% - \or \unnumberedsubsubseczzz{#3}% - \fi - \else - \if \headtype A% - \ifcase\absseclevel - \appendixzzz{#3}% - \or \appendixsectionzzz{#3}% - \or \appendixsubseczzz{#3}% - \or \appendixsubsubseczzz{#3}% - \fi - \else - \ifcase\absseclevel - \chapterzzz{#3}% - \or \seczzz{#3}% - \or \numberedsubseczzz{#3}% - \or \numberedsubsubseczzz{#3}% - \fi - \fi - \fi - \suppressfirstparagraphindent -} - -% an interface: -\def\numhead{\genhead N} -\def\apphead{\genhead A} -\def\unnmhead{\genhead U} - -% @chapter, @appendix, @unnumbered. Increment top-level counter, reset -% all lower-level sectioning counters to zero. -% -% Also set \chaplevelprefix, which we prepend to @float sequence numbers -% (e.g., figures), q.v. By default (before any chapter), that is empty. -\let\chaplevelprefix = \empty -% -\outer\parseargdef\chapter{\numhead0{#1}} % normally numhead0 calls chapterzzz -\def\chapterzzz#1{% - % section resetting is \global in case the chapter is in a group, such - % as an @include file. - \global\secno=0 \global\subsecno=0 \global\subsubsecno=0 - \global\advance\chapno by 1 - % - % Used for \float. - \gdef\chaplevelprefix{\the\chapno.}% - \resetallfloatnos - % - \message{\putwordChapter\space \the\chapno}% - % - % Write the actual heading. - \chapmacro{#1}{Ynumbered}{\the\chapno}% - % - % So @section and the like are numbered underneath this chapter. - \global\let\section = \numberedsec - \global\let\subsection = \numberedsubsec - \global\let\subsubsection = \numberedsubsubsec -} - -\outer\parseargdef\appendix{\apphead0{#1}} % normally apphead0 calls appendixzzz -\def\appendixzzz#1{% - \global\secno=0 \global\subsecno=0 \global\subsubsecno=0 - \global\advance\appendixno by 1 - \gdef\chaplevelprefix{\appendixletter.}% - \resetallfloatnos - % - \def\appendixnum{\putwordAppendix\space \appendixletter}% - \message{\appendixnum}% - % - \chapmacro{#1}{Yappendix}{\appendixletter}% - % - \global\let\section = \appendixsec - \global\let\subsection = \appendixsubsec - \global\let\subsubsection = \appendixsubsubsec -} - -\outer\parseargdef\unnumbered{\unnmhead0{#1}} % normally unnmhead0 calls unnumberedzzz -\def\unnumberedzzz#1{% - \global\secno=0 \global\subsecno=0 \global\subsubsecno=0 - \global\advance\unnumberedno by 1 - % - % Since an unnumbered has no number, no prefix for figures. - \global\let\chaplevelprefix = \empty - \resetallfloatnos - % - % This used to be simply \message{#1}, but TeX fully expands the - % argument to \message. Therefore, if #1 contained @-commands, TeX - % expanded them. For example, in `@unnumbered The @cite{Book}', TeX - % expanded @cite (which turns out to cause errors because \cite is meant - % to be executed, not expanded). - % - % Anyway, we don't want the fully-expanded definition of @cite to appear - % as a result of the \message, we just want `@cite' itself. We use - % \the to achieve this: TeX expands \the only once, - % simply yielding the contents of . (We also do this for - % the toc entries.) - \toks0 = {#1}% - \message{(\the\toks0)}% - % - \chapmacro{#1}{Ynothing}{\the\unnumberedno}% - % - \global\let\section = \unnumberedsec - \global\let\subsection = \unnumberedsubsec - \global\let\subsubsection = \unnumberedsubsubsec -} - -% @centerchap is like @unnumbered, but the heading is centered. -\outer\parseargdef\centerchap{% - % Well, we could do the following in a group, but that would break - % an assumption that \chapmacro is called at the outermost level. - % Thus we are safer this way: --kasal, 24feb04 - \let\centerparametersmaybe = \centerparameters - \unnmhead0{#1}% - \let\centerparametersmaybe = \relax -} - -% @top is like @unnumbered. -\let\top\unnumbered - -% Sections. -\outer\parseargdef\numberedsec{\numhead1{#1}} % normally calls seczzz -\def\seczzz#1{% - \global\subsecno=0 \global\subsubsecno=0 \global\advance\secno by 1 - \sectionheading{#1}{sec}{Ynumbered}{\the\chapno.\the\secno}% -} - -\outer\parseargdef\appendixsection{\apphead1{#1}} % normally calls appendixsectionzzz -\def\appendixsectionzzz#1{% - \global\subsecno=0 \global\subsubsecno=0 \global\advance\secno by 1 - \sectionheading{#1}{sec}{Yappendix}{\appendixletter.\the\secno}% -} -\let\appendixsec\appendixsection - -\outer\parseargdef\unnumberedsec{\unnmhead1{#1}} % normally calls unnumberedseczzz -\def\unnumberedseczzz#1{% - \global\subsecno=0 \global\subsubsecno=0 \global\advance\secno by 1 - \sectionheading{#1}{sec}{Ynothing}{\the\unnumberedno.\the\secno}% -} - -% Subsections. -\outer\parseargdef\numberedsubsec{\numhead2{#1}} % normally calls numberedsubseczzz -\def\numberedsubseczzz#1{% - \global\subsubsecno=0 \global\advance\subsecno by 1 - \sectionheading{#1}{subsec}{Ynumbered}{\the\chapno.\the\secno.\the\subsecno}% -} - -\outer\parseargdef\appendixsubsec{\apphead2{#1}} % normally calls appendixsubseczzz -\def\appendixsubseczzz#1{% - \global\subsubsecno=0 \global\advance\subsecno by 1 - \sectionheading{#1}{subsec}{Yappendix}% - {\appendixletter.\the\secno.\the\subsecno}% -} - -\outer\parseargdef\unnumberedsubsec{\unnmhead2{#1}} %normally calls unnumberedsubseczzz -\def\unnumberedsubseczzz#1{% - \global\subsubsecno=0 \global\advance\subsecno by 1 - \sectionheading{#1}{subsec}{Ynothing}% - {\the\unnumberedno.\the\secno.\the\subsecno}% -} - -% Subsubsections. -\outer\parseargdef\numberedsubsubsec{\numhead3{#1}} % normally numberedsubsubseczzz -\def\numberedsubsubseczzz#1{% - \global\advance\subsubsecno by 1 - \sectionheading{#1}{subsubsec}{Ynumbered}% - {\the\chapno.\the\secno.\the\subsecno.\the\subsubsecno}% -} - -\outer\parseargdef\appendixsubsubsec{\apphead3{#1}} % normally appendixsubsubseczzz -\def\appendixsubsubseczzz#1{% - \global\advance\subsubsecno by 1 - \sectionheading{#1}{subsubsec}{Yappendix}% - {\appendixletter.\the\secno.\the\subsecno.\the\subsubsecno}% -} - -\outer\parseargdef\unnumberedsubsubsec{\unnmhead3{#1}} %normally unnumberedsubsubseczzz -\def\unnumberedsubsubseczzz#1{% - \global\advance\subsubsecno by 1 - \sectionheading{#1}{subsubsec}{Ynothing}% - {\the\unnumberedno.\the\secno.\the\subsecno.\the\subsubsecno}% -} - -% These macros control what the section commands do, according -% to what kind of chapter we are in (ordinary, appendix, or unnumbered). -% Define them by default for a numbered chapter. -\let\section = \numberedsec -\let\subsection = \numberedsubsec -\let\subsubsection = \numberedsubsubsec - -% Define @majorheading, @heading and @subheading - -% NOTE on use of \vbox for chapter headings, section headings, and such: -% 1) We use \vbox rather than the earlier \line to permit -% overlong headings to fold. -% 2) \hyphenpenalty is set to 10000 because hyphenation in a -% heading is obnoxious; this forbids it. -% 3) Likewise, headings look best if no \parindent is used, and -% if justification is not attempted. Hence \raggedright. - - -\def\majorheading{% - {\advance\chapheadingskip by 10pt \chapbreak }% - \parsearg\chapheadingzzz -} - -\def\chapheading{\chapbreak \parsearg\chapheadingzzz} -\def\chapheadingzzz#1{% - {\chapfonts \vbox{\hyphenpenalty=10000\tolerance=5000 - \parindent=0pt\raggedright - \rm #1\hfill}}% - \bigskip \par\penalty 200\relax - \suppressfirstparagraphindent -} - -% @heading, @subheading, @subsubheading. -\parseargdef\heading{\sectionheading{#1}{sec}{Yomitfromtoc}{} - \suppressfirstparagraphindent} -\parseargdef\subheading{\sectionheading{#1}{subsec}{Yomitfromtoc}{} - \suppressfirstparagraphindent} -\parseargdef\subsubheading{\sectionheading{#1}{subsubsec}{Yomitfromtoc}{} - \suppressfirstparagraphindent} - -% These macros generate a chapter, section, etc. heading only -% (including whitespace, linebreaking, etc. around it), -% given all the information in convenient, parsed form. - -%%% Args are the skip and penalty (usually negative) -\def\dobreak#1#2{\par\ifdim\lastskip<#1\removelastskip\penalty#2\vskip#1\fi} - -%%% Define plain chapter starts, and page on/off switching for it -% Parameter controlling skip before chapter headings (if needed) - -\newskip\chapheadingskip - -\def\chapbreak{\dobreak \chapheadingskip {-4000}} -\def\chappager{\par\vfill\supereject} -\def\chapoddpage{\chappager \ifodd\pageno \else \hbox to 0pt{} \chappager\fi} - -\def\setchapternewpage #1 {\csname CHAPPAG#1\endcsname} - -\def\CHAPPAGoff{% -\global\let\contentsalignmacro = \chappager -\global\let\pchapsepmacro=\chapbreak -\global\let\pagealignmacro=\chappager} - -\def\CHAPPAGon{% -\global\let\contentsalignmacro = \chappager -\global\let\pchapsepmacro=\chappager -\global\let\pagealignmacro=\chappager -\global\def\HEADINGSon{\HEADINGSsingle}} - -\def\CHAPPAGodd{% -\global\let\contentsalignmacro = \chapoddpage -\global\let\pchapsepmacro=\chapoddpage -\global\let\pagealignmacro=\chapoddpage -\global\def\HEADINGSon{\HEADINGSdouble}} - -\CHAPPAGon - -% Chapter opening. -% -% #1 is the text, #2 is the section type (Ynumbered, Ynothing, -% Yappendix, Yomitfromtoc), #3 the chapter number. -% -% To test against our argument. -\def\Ynothingkeyword{Ynothing} -\def\Yomitfromtockeyword{Yomitfromtoc} -\def\Yappendixkeyword{Yappendix} -% -\def\chapmacro#1#2#3{% - \pchapsepmacro - {% - \chapfonts \rm - % - % Have to define \thissection before calling \donoderef, because the - % xref code eventually uses it. On the other hand, it has to be called - % after \pchapsepmacro, or the headline will change too soon. - \gdef\thissection{#1}% - \gdef\thischaptername{#1}% - % - % Only insert the separating space if we have a chapter/appendix - % number, and don't print the unnumbered ``number''. - \def\temptype{#2}% - \ifx\temptype\Ynothingkeyword - \setbox0 = \hbox{}% - \def\toctype{unnchap}% - \def\thischapter{#1}% - \else\ifx\temptype\Yomitfromtockeyword - \setbox0 = \hbox{}% contents like unnumbered, but no toc entry - \def\toctype{omit}% - \xdef\thischapter{}% - \else\ifx\temptype\Yappendixkeyword - \setbox0 = \hbox{\putwordAppendix{} #3\enspace}% - \def\toctype{app}% - % We don't substitute the actual chapter name into \thischapter - % because we don't want its macros evaluated now. And we don't - % use \thissection because that changes with each section. - % - \xdef\thischapter{\putwordAppendix{} \appendixletter: - \noexpand\thischaptername}% - \else - \setbox0 = \hbox{#3\enspace}% - \def\toctype{numchap}% - \xdef\thischapter{\putwordChapter{} \the\chapno: - \noexpand\thischaptername}% - \fi\fi\fi - % - % Write the toc entry for this chapter. Must come before the - % \donoderef, because we include the current node name in the toc - % entry, and \donoderef resets it to empty. - \writetocentry{\toctype}{#1}{#3}% - % - % For pdftex, we have to write out the node definition (aka, make - % the pdfdest) after any page break, but before the actual text has - % been typeset. If the destination for the pdf outline is after the - % text, then jumping from the outline may wind up with the text not - % being visible, for instance under high magnification. - \donoderef{#2}% - % - % Typeset the actual heading. - \vbox{\hyphenpenalty=10000 \tolerance=5000 \parindent=0pt \raggedright - \hangindent=\wd0 \centerparametersmaybe - \unhbox0 #1\par}% - }% - \nobreak\bigskip % no page break after a chapter title - \nobreak -} - -% @centerchap -- centered and unnumbered. -\let\centerparametersmaybe = \relax -\def\centerparameters{% - \advance\rightskip by 3\rightskip - \leftskip = \rightskip - \parfillskip = 0pt -} - - -% I don't think this chapter style is supported any more, so I'm not -% updating it with the new noderef stuff. We'll see. --karl, 11aug03. -% -\def\setchapterstyle #1 {\csname CHAPF#1\endcsname} -% -\def\unnchfopen #1{% -\chapoddpage {\chapfonts \vbox{\hyphenpenalty=10000\tolerance=5000 - \parindent=0pt\raggedright - \rm #1\hfill}}\bigskip \par\nobreak -} -\def\chfopen #1#2{\chapoddpage {\chapfonts -\vbox to 3in{\vfil \hbox to\hsize{\hfil #2} \hbox to\hsize{\hfil #1} \vfil}}% -\par\penalty 5000 % -} -\def\centerchfopen #1{% -\chapoddpage {\chapfonts \vbox{\hyphenpenalty=10000\tolerance=5000 - \parindent=0pt - \hfill {\rm #1}\hfill}}\bigskip \par\nobreak -} -\def\CHAPFopen{% - \global\let\chapmacro=\chfopen - \global\let\centerchapmacro=\centerchfopen} - - -% Section titles. These macros combine the section number parts and -% call the generic \sectionheading to do the printing. -% -\newskip\secheadingskip -\def\secheadingbreak{\dobreak \secheadingskip{-1000}} - -% Subsection titles. -\newskip\subsecheadingskip -\def\subsecheadingbreak{\dobreak \subsecheadingskip{-500}} - -% Subsubsection titles. -\def\subsubsecheadingskip{\subsecheadingskip} -\def\subsubsecheadingbreak{\subsecheadingbreak} - - -% Print any size, any type, section title. -% -% #1 is the text, #2 is the section level (sec/subsec/subsubsec), #3 is -% the section type for xrefs (Ynumbered, Ynothing, Yappendix), #4 is the -% section number. -% -\def\sectionheading#1#2#3#4{% - {% - % Switch to the right set of fonts. - \csname #2fonts\endcsname \rm - % - % Insert space above the heading. - \csname #2headingbreak\endcsname - % - % Only insert the space after the number if we have a section number. - \def\sectionlevel{#2}% - \def\temptype{#3}% - % - \ifx\temptype\Ynothingkeyword - \setbox0 = \hbox{}% - \def\toctype{unn}% - \gdef\thissection{#1}% - \else\ifx\temptype\Yomitfromtockeyword - % for @headings -- no section number, don't include in toc, - % and don't redefine \thissection. - \setbox0 = \hbox{}% - \def\toctype{omit}% - \let\sectionlevel=\empty - \else\ifx\temptype\Yappendixkeyword - \setbox0 = \hbox{#4\enspace}% - \def\toctype{app}% - \gdef\thissection{#1}% - \else - \setbox0 = \hbox{#4\enspace}% - \def\toctype{num}% - \gdef\thissection{#1}% - \fi\fi\fi - % - % Write the toc entry (before \donoderef). See comments in \chfplain. - \writetocentry{\toctype\sectionlevel}{#1}{#4}% - % - % Write the node reference (= pdf destination for pdftex). - % Again, see comments in \chfplain. - \donoderef{#3}% - % - % Output the actual section heading. - \vbox{\hyphenpenalty=10000 \tolerance=5000 \parindent=0pt \raggedright - \hangindent=\wd0 % zero if no section number - \unhbox0 #1}% - }% - % Add extra space after the heading -- half of whatever came above it. - % Don't allow stretch, though. - \kern .5 \csname #2headingskip\endcsname - % - % Do not let the kern be a potential breakpoint, as it would be if it - % was followed by glue. - \nobreak - % - % We'll almost certainly start a paragraph next, so don't let that - % glue accumulate. (Not a breakpoint because it's preceded by a - % discardable item.) - \vskip-\parskip - % - % This \nobreak is purely so the last item on the list is a \penalty - % of 10000. This is so other code, for instance \parsebodycommon, can - % check for and avoid allowing breakpoints. Otherwise, it would - % insert a valid breakpoint between: - % @section sec-whatever - % @deffn def-whatever - \nobreak -} - - -\message{toc,} -% Table of contents. -\newwrite\tocfile - -% Write an entry to the toc file, opening it if necessary. -% Called from @chapter, etc. -% -% Example usage: \writetocentry{sec}{Section Name}{\the\chapno.\the\secno} -% We append the current node name (if any) and page number as additional -% arguments for the \{chap,sec,...}entry macros which will eventually -% read this. The node name is used in the pdf outlines as the -% destination to jump to. -% -% We open the .toc file for writing here instead of at @setfilename (or -% any other fixed time) so that @contents can be anywhere in the document. -% But if #1 is `omit', then we don't do anything. This is used for the -% table of contents chapter openings themselves. -% -\newif\iftocfileopened -\def\omitkeyword{omit}% -% -\def\writetocentry#1#2#3{% - \edef\writetoctype{#1}% - \ifx\writetoctype\omitkeyword \else - \iftocfileopened\else - \immediate\openout\tocfile = \jobname.toc - \global\tocfileopenedtrue - \fi - % - \iflinks - \toks0 = {#2}% - \toks2 = \expandafter{\lastnode}% - \edef\temp{\write\tocfile{\realbackslash #1entry{\the\toks0}{#3}% - {\the\toks2}{\noexpand\folio}}}% - \temp - \fi - \fi - % - % Tell \shipout to create a pdf destination on each page, if we're - % writing pdf. These are used in the table of contents. We can't - % just write one on every page because the title pages are numbered - % 1 and 2 (the page numbers aren't printed), and so are the first - % two pages of the document. Thus, we'd have two destinations named - % `1', and two named `2'. - \ifpdf \global\pdfmakepagedesttrue \fi -} - -\newskip\contentsrightmargin \contentsrightmargin=1in -\newcount\savepageno -\newcount\lastnegativepageno \lastnegativepageno = -1 - -% Prepare to read what we've written to \tocfile. -% -\def\startcontents#1{% - % If @setchapternewpage on, and @headings double, the contents should - % start on an odd page, unlike chapters. Thus, we maintain - % \contentsalignmacro in parallel with \pagealignmacro. - % From: Torbjorn Granlund - \contentsalignmacro - \immediate\closeout\tocfile - % - % Don't need to put `Contents' or `Short Contents' in the headline. - % It is abundantly clear what they are. - \def\thischapter{}% - \chapmacro{#1}{Yomitfromtoc}{}% - % - \savepageno = \pageno - \begingroup % Set up to handle contents files properly. - \catcode`\\=0 \catcode`\{=1 \catcode`\}=2 \catcode`\@=11 - % We can't do this, because then an actual ^ in a section - % title fails, e.g., @chapter ^ -- exponentiation. --karl, 9jul97. - %\catcode`\^=7 % to see ^^e4 as \"a etc. juha@piuha.ydi.vtt.fi - \raggedbottom % Worry more about breakpoints than the bottom. - \advance\hsize by -\contentsrightmargin % Don't use the full line length. - % - % Roman numerals for page numbers. - \ifnum \pageno>0 \global\pageno = \lastnegativepageno \fi -} - - -% Normal (long) toc. -\def\contents{% - \startcontents{\putwordTOC}% - \openin 1 \jobname.toc - \ifeof 1 \else - \input \jobname.toc - \fi - \vfill \eject - \contentsalignmacro % in case @setchapternewpage odd is in effect - \ifeof 1 \else - \pdfmakeoutlines - \fi - \closein 1 - \endgroup - \lastnegativepageno = \pageno - \global\pageno = \savepageno -} - -% And just the chapters. -\def\summarycontents{% - \startcontents{\putwordShortTOC}% - % - \let\numchapentry = \shortchapentry - \let\appentry = \shortchapentry - \let\unnchapentry = \shortunnchapentry - % We want a true roman here for the page numbers. - \secfonts - \let\rm=\shortcontrm \let\bf=\shortcontbf - \let\sl=\shortcontsl \let\tt=\shortconttt - \rm - \hyphenpenalty = 10000 - \advance\baselineskip by 1pt % Open it up a little. - \def\numsecentry##1##2##3##4{} - \let\appsecentry = \numsecentry - \let\unnsecentry = \numsecentry - \let\numsubsecentry = \numsecentry - \let\appsubsecentry = \numsecentry - \let\unnsubsecentry = \numsecentry - \let\numsubsubsecentry = \numsecentry - \let\appsubsubsecentry = \numsecentry - \let\unnsubsubsecentry = \numsecentry - \openin 1 \jobname.toc - \ifeof 1 \else - \input \jobname.toc - \fi - \closein 1 - \vfill \eject - \contentsalignmacro % in case @setchapternewpage odd is in effect - \endgroup - \lastnegativepageno = \pageno - \global\pageno = \savepageno -} -\let\shortcontents = \summarycontents - -% Typeset the label for a chapter or appendix for the short contents. -% The arg is, e.g., `A' for an appendix, or `3' for a chapter. -% -\def\shortchaplabel#1{% - % This space should be enough, since a single number is .5em, and the - % widest letter (M) is 1em, at least in the Computer Modern fonts. - % But use \hss just in case. - % (This space doesn't include the extra space that gets added after - % the label; that gets put in by \shortchapentry above.) - % - % We'd like to right-justify chapter numbers, but that looks strange - % with appendix letters. And right-justifying numbers and - % left-justifying letters looks strange when there is less than 10 - % chapters. Have to read the whole toc once to know how many chapters - % there are before deciding ... - \hbox to 1em{#1\hss}% -} - -% These macros generate individual entries in the table of contents. -% The first argument is the chapter or section name. -% The last argument is the page number. -% The arguments in between are the chapter number, section number, ... - -% Chapters, in the main contents. -\def\numchapentry#1#2#3#4{\dochapentry{#2\labelspace#1}{#4}} -% -% Chapters, in the short toc. -% See comments in \dochapentry re vbox and related settings. -\def\shortchapentry#1#2#3#4{% - \tocentry{\shortchaplabel{#2}\labelspace #1}{\doshortpageno\bgroup#4\egroup}% -} - -% Appendices, in the main contents. -% Need the word Appendix, and a fixed-size box. -% -\def\appendixbox#1{% - % We use M since it's probably the widest letter. - \setbox0 = \hbox{\putwordAppendix{} M}% - \hbox to \wd0{\putwordAppendix{} #1\hss}} -% -\def\appentry#1#2#3#4{\dochapentry{\appendixbox{#2}\labelspace#1}{#4}} - -% Unnumbered chapters. -\def\unnchapentry#1#2#3#4{\dochapentry{#1}{#4}} -\def\shortunnchapentry#1#2#3#4{\tocentry{#1}{\doshortpageno\bgroup#4\egroup}} - -% Sections. -\def\numsecentry#1#2#3#4{\dosecentry{#2\labelspace#1}{#4}} -\let\appsecentry=\numsecentry -\def\unnsecentry#1#2#3#4{\dosecentry{#1}{#4}} - -% Subsections. -\def\numsubsecentry#1#2#3#4{\dosubsecentry{#2\labelspace#1}{#4}} -\let\appsubsecentry=\numsubsecentry -\def\unnsubsecentry#1#2#3#4{\dosubsecentry{#1}{#4}} - -% And subsubsections. -\def\numsubsubsecentry#1#2#3#4{\dosubsubsecentry{#2\labelspace#1}{#4}} -\let\appsubsubsecentry=\numsubsubsecentry -\def\unnsubsubsecentry#1#2#3#4{\dosubsubsecentry{#1}{#4}} - -% This parameter controls the indentation of the various levels. -% Same as \defaultparindent. -\newdimen\tocindent \tocindent = 15pt - -% Now for the actual typesetting. In all these, #1 is the text and #2 is the -% page number. -% -% If the toc has to be broken over pages, we want it to be at chapters -% if at all possible; hence the \penalty. -\def\dochapentry#1#2{% - \penalty-300 \vskip1\baselineskip plus.33\baselineskip minus.25\baselineskip - \begingroup - \chapentryfonts - \tocentry{#1}{\dopageno\bgroup#2\egroup}% - \endgroup - \nobreak\vskip .25\baselineskip plus.1\baselineskip -} - -\def\dosecentry#1#2{\begingroup - \secentryfonts \leftskip=\tocindent - \tocentry{#1}{\dopageno\bgroup#2\egroup}% -\endgroup} - -\def\dosubsecentry#1#2{\begingroup - \subsecentryfonts \leftskip=2\tocindent - \tocentry{#1}{\dopageno\bgroup#2\egroup}% -\endgroup} - -\def\dosubsubsecentry#1#2{\begingroup - \subsubsecentryfonts \leftskip=3\tocindent - \tocentry{#1}{\dopageno\bgroup#2\egroup}% -\endgroup} - -% We use the same \entry macro as for the index entries. -\let\tocentry = \entry - -% Space between chapter (or whatever) number and the title. -\def\labelspace{\hskip1em \relax} - -\def\dopageno#1{{\rm #1}} -\def\doshortpageno#1{{\rm #1}} - -\def\chapentryfonts{\secfonts \rm} -\def\secentryfonts{\textfonts} -\def\subsecentryfonts{\textfonts} -\def\subsubsecentryfonts{\textfonts} - - -\message{environments,} -% @foo ... @end foo. - -% @point{}, @result{}, @expansion{}, @print{}, @equiv{}. -% -% Since these characters are used in examples, it should be an even number of -% \tt widths. Each \tt character is 1en, so two makes it 1em. -% -\def\point{$\star$} -\def\result{\leavevmode\raise.15ex\hbox to 1em{\hfil$\Rightarrow$\hfil}} -\def\expansion{\leavevmode\raise.1ex\hbox to 1em{\hfil$\mapsto$\hfil}} -\def\print{\leavevmode\lower.1ex\hbox to 1em{\hfil$\dashv$\hfil}} -\def\equiv{\leavevmode\lower.1ex\hbox to 1em{\hfil$\ptexequiv$\hfil}} - -% The @error{} command. -% Adapted from the TeXbook's \boxit. -% -\newbox\errorbox -% -{\tentt \global\dimen0 = 3em}% Width of the box. -\dimen2 = .55pt % Thickness of rules -% The text. (`r' is open on the right, `e' somewhat less so on the left.) -\setbox0 = \hbox{\kern-.75pt \tensf error\kern-1.5pt} -% -\setbox\errorbox=\hbox to \dimen0{\hfil - \hsize = \dimen0 \advance\hsize by -5.8pt % Space to left+right. - \advance\hsize by -2\dimen2 % Rules. - \vbox{% - \hrule height\dimen2 - \hbox{\vrule width\dimen2 \kern3pt % Space to left of text. - \vtop{\kern2.4pt \box0 \kern2.4pt}% Space above/below. - \kern3pt\vrule width\dimen2}% Space to right. - \hrule height\dimen2} - \hfil} -% -\def\error{\leavevmode\lower.7ex\copy\errorbox} - -% @tex ... @end tex escapes into raw Tex temporarily. -% One exception: @ is still an escape character, so that @end tex works. -% But \@ or @@ will get a plain tex @ character. - -\envdef\tex{% - \catcode `\\=0 \catcode `\{=1 \catcode `\}=2 - \catcode `\$=3 \catcode `\&=4 \catcode `\#=6 - \catcode `\^=7 \catcode `\_=8 \catcode `\~=\active \let~=\tie - \catcode `\%=14 - \catcode `\+=\other - \catcode `\"=\other - \catcode `\|=\other - \catcode `\<=\other - \catcode `\>=\other - \escapechar=`\\ - % - \let\b=\ptexb - \let\bullet=\ptexbullet - \let\c=\ptexc - \let\,=\ptexcomma - \let\.=\ptexdot - \let\dots=\ptexdots - \let\equiv=\ptexequiv - \let\!=\ptexexclam - \let\i=\ptexi - \let\indent=\ptexindent - \let\noindent=\ptexnoindent - \let\{=\ptexlbrace - \let\+=\tabalign - \let\}=\ptexrbrace - \let\/=\ptexslash - \let\*=\ptexstar - \let\t=\ptext - % - \def\endldots{\mathinner{\ldots\ldots\ldots\ldots}}% - \def\enddots{\relax\ifmmode\endldots\else$\mathsurround=0pt \endldots\,$\fi}% - \def\@{@}% -} -% There is no need to define \Etex. - -% Define @lisp ... @end lisp. -% @lisp environment forms a group so it can rebind things, -% including the definition of @end lisp (which normally is erroneous). - -% Amount to narrow the margins by for @lisp. -\newskip\lispnarrowing \lispnarrowing=0.4in - -% This is the definition that ^^M gets inside @lisp, @example, and other -% such environments. \null is better than a space, since it doesn't -% have any width. -\def\lisppar{\null\endgraf} - -% This space is always present above and below environments. -\newskip\envskipamount \envskipamount = 0pt - -% Make spacing and below environment symmetrical. We use \parskip here -% to help in doing that, since in @example-like environments \parskip -% is reset to zero; thus the \afterenvbreak inserts no space -- but the -% start of the next paragraph will insert \parskip. -% -\def\aboveenvbreak{{% - % =10000 instead of <10000 because of a special case in \itemzzz, q.v. - \ifnum \lastpenalty=10000 \else - \advance\envskipamount by \parskip - \endgraf - \ifdim\lastskip<\envskipamount - \removelastskip - % it's not a good place to break if the last penalty was \nobreak - % or better ... - \ifnum\lastpenalty<10000 \penalty-50 \fi - \vskip\envskipamount - \fi - \fi -}} - -\let\afterenvbreak = \aboveenvbreak - -% \nonarrowing is a flag. If "set", @lisp etc don't narrow margins. -\let\nonarrowing=\relax - -% @cartouche ... @end cartouche: draw rectangle w/rounded corners around -% environment contents. -\font\circle=lcircle10 -\newdimen\circthick -\newdimen\cartouter\newdimen\cartinner -\newskip\normbskip\newskip\normpskip\newskip\normlskip -\circthick=\fontdimen8\circle -% -\def\ctl{{\circle\char'013\hskip -6pt}}% 6pt from pl file: 1/2charwidth -\def\ctr{{\hskip 6pt\circle\char'010}} -\def\cbl{{\circle\char'012\hskip -6pt}} -\def\cbr{{\hskip 6pt\circle\char'011}} -\def\carttop{\hbox to \cartouter{\hskip\lskip - \ctl\leaders\hrule height\circthick\hfil\ctr - \hskip\rskip}} -\def\cartbot{\hbox to \cartouter{\hskip\lskip - \cbl\leaders\hrule height\circthick\hfil\cbr - \hskip\rskip}} -% -\newskip\lskip\newskip\rskip - -\envdef\cartouche{% - \ifhmode\par\fi % can't be in the midst of a paragraph. - \startsavinginserts - \lskip=\leftskip \rskip=\rightskip - \leftskip=0pt\rightskip=0pt % we want these *outside*. - \cartinner=\hsize \advance\cartinner by-\lskip - \advance\cartinner by-\rskip - \cartouter=\hsize - \advance\cartouter by 18.4pt % allow for 3pt kerns on either - % side, and for 6pt waste from - % each corner char, and rule thickness - \normbskip=\baselineskip \normpskip=\parskip \normlskip=\lineskip - % Flag to tell @lisp, etc., not to narrow margin. - \let\nonarrowing=\comment - \vbox\bgroup - \baselineskip=0pt\parskip=0pt\lineskip=0pt - \carttop - \hbox\bgroup - \hskip\lskip - \vrule\kern3pt - \vbox\bgroup - \kern3pt - \hsize=\cartinner - \baselineskip=\normbskip - \lineskip=\normlskip - \parskip=\normpskip - \vskip -\parskip - \comment % For explanation, see the end of \def\group. -} -\def\Ecartouche{% - \ifhmode\par\fi - \kern3pt - \egroup - \kern3pt\vrule - \hskip\rskip - \egroup - \cartbot - \egroup - \checkinserts -} - - -% This macro is called at the beginning of all the @example variants, -% inside a group. -\def\nonfillstart{% - \aboveenvbreak - \hfuzz = 12pt % Don't be fussy - \sepspaces % Make spaces be word-separators rather than space tokens. - \let\par = \lisppar % don't ignore blank lines - \obeylines % each line of input is a line of output - \parskip = 0pt - \parindent = 0pt - \emergencystretch = 0pt % don't try to avoid overfull boxes - % @cartouche defines \nonarrowing to inhibit narrowing - % at next level down. - \ifx\nonarrowing\relax - \advance \leftskip by \lispnarrowing - \exdentamount=\lispnarrowing - \fi - \let\exdent=\nofillexdent -} - -% If you want all examples etc. small: @set dispenvsize small. -% If you want even small examples the full size: @set dispenvsize nosmall. -% This affects the following displayed environments: -% @example, @display, @format, @lisp -% -\def\smallword{small} -\def\nosmallword{nosmall} -\let\SETdispenvsize\relax -\def\setnormaldispenv{% - \ifx\SETdispenvsize\smallword - \smallexamplefonts \rm - \fi -} -\def\setsmalldispenv{% - \ifx\SETdispenvsize\nosmallword - \else - \smallexamplefonts \rm - \fi -} - -% We often define two environments, @foo and @smallfoo. -% Let's do it by one command: -\def\makedispenv #1#2{ - \expandafter\envdef\csname#1\endcsname {\setnormaldispenv #2} - \expandafter\envdef\csname small#1\endcsname {\setsmalldispenv #2} - \expandafter\let\csname E#1\endcsname \afterenvbreak - \expandafter\let\csname Esmall#1\endcsname \afterenvbreak -} - -% Define two synonyms: -\def\maketwodispenvs #1#2#3{ - \makedispenv{#1}{#3} - \makedispenv{#2}{#3} -} - -% @lisp: indented, narrowed, typewriter font; @example: same as @lisp. -% -% @smallexample and @smalllisp: use smaller fonts. -% Originally contributed by Pavel@xerox. -% -\maketwodispenvs {lisp}{example}{% - \nonfillstart - \tt - \let\kbdfont = \kbdexamplefont % Allow @kbd to do something special. - \gobble % eat return -} - -% @display/@smalldisplay: same as @lisp except keep current font. -% -\makedispenv {display}{% - \nonfillstart - \gobble -} - -% @format/@smallformat: same as @display except don't narrow margins. -% -\makedispenv{format}{% - \let\nonarrowing = t% - \nonfillstart - \gobble -} - -% @flushleft: same as @format, but doesn't obey \SETdispenvsize. -\envdef\flushleft{% - \let\nonarrowing = t% - \nonfillstart - \gobble -} -\let\Eflushleft = \afterenvbreak - -% @flushright. -% -\envdef\flushright{% - \let\nonarrowing = t% - \nonfillstart - \advance\leftskip by 0pt plus 1fill - \gobble -} -\let\Eflushright = \afterenvbreak - - -% @quotation does normal linebreaking (hence we can't use \nonfillstart) -% and narrows the margins. We keep \parskip nonzero in general, since -% we're doing normal filling. So, when using \aboveenvbreak and -% \afterenvbreak, temporarily make \parskip 0. -% -\envdef\quotation{% - {\parskip=0pt \aboveenvbreak}% because \aboveenvbreak inserts \parskip - \parindent=0pt - % - % @cartouche defines \nonarrowing to inhibit narrowing at next level down. - \ifx\nonarrowing\relax - \advance\leftskip by \lispnarrowing - \advance\rightskip by \lispnarrowing - \exdentamount = \lispnarrowing - \let\nonarrowing = \relax - \fi - \parsearg\quotationlabel -} - -% We have retained a nonzero parskip for the environment, since we're -% doing normal filling. -% -\def\Equotation{% - \par - \ifx\quotationauthor\undefined\else - % indent a bit. - \leftline{\kern 2\leftskip \sl ---\quotationauthor}% - \fi - {\parskip=0pt \afterenvbreak}% -} - -% If we're given an argument, typeset it in bold with a colon after. -\def\quotationlabel#1{% - \def\temp{#1}% - \ifx\temp\empty \else - {\bf #1: }% - \fi -} - - -% LaTeX-like @verbatim...@end verbatim and @verb{...} -% If we want to allow any as delimiter, -% we need the curly braces so that makeinfo sees the @verb command, eg: -% `@verbx...x' would look like the '@verbx' command. --janneke@gnu.org -% -% [Knuth]: Donald Ervin Knuth, 1996. The TeXbook. -% -% [Knuth] p.344; only we need to do the other characters Texinfo sets -% active too. Otherwise, they get lost as the first character on a -% verbatim line. -\def\dospecials{% - \do\ \do\\\do\{\do\}\do\$\do\&% - \do\#\do\^\do\^^K\do\_\do\^^A\do\%\do\~% - \do\<\do\>\do\|\do\@\do+\do\"% -} -% -% [Knuth] p. 380 -\def\uncatcodespecials{% - \def\do##1{\catcode`##1=\other}\dospecials} -% -% [Knuth] pp. 380,381,391 -% Disable Spanish ligatures ?` and !` of \tt font -\begingroup - \catcode`\`=\active\gdef`{\relax\lq} -\endgroup -% -% Setup for the @verb command. -% -% Eight spaces for a tab -\begingroup - \catcode`\^^I=\active - \gdef\tabeightspaces{\catcode`\^^I=\active\def^^I{\ \ \ \ \ \ \ \ }} -\endgroup -% -\def\setupverb{% - \tt % easiest (and conventionally used) font for verbatim - \def\par{\leavevmode\endgraf}% - \catcode`\`=\active - \tabeightspaces - % Respect line breaks, - % print special symbols as themselves, and - % make each space count - % must do in this order: - \obeylines \uncatcodespecials \sepspaces -} - -% Setup for the @verbatim environment -% -% Real tab expansion -\newdimen\tabw \setbox0=\hbox{\tt\space} \tabw=8\wd0 % tab amount -% -\def\starttabbox{\setbox0=\hbox\bgroup} -\begingroup - \catcode`\^^I=\active - \gdef\tabexpand{% - \catcode`\^^I=\active - \def^^I{\leavevmode\egroup - \dimen0=\wd0 % the width so far, or since the previous tab - \divide\dimen0 by\tabw - \multiply\dimen0 by\tabw % compute previous multiple of \tabw - \advance\dimen0 by\tabw % advance to next multiple of \tabw - \wd0=\dimen0 \box0 \starttabbox - }% - } -\endgroup -\def\setupverbatim{% - \nonfillstart - \advance\leftskip by -\defbodyindent - % Easiest (and conventionally used) font for verbatim - \tt - \def\par{\leavevmode\egroup\box0\endgraf}% - \catcode`\`=\active - \tabexpand - % Respect line breaks, - % print special symbols as themselves, and - % make each space count - % must do in this order: - \obeylines \uncatcodespecials \sepspaces - \everypar{\starttabbox}% -} - -% Do the @verb magic: verbatim text is quoted by unique -% delimiter characters. Before first delimiter expect a -% right brace, after last delimiter expect closing brace: -% -% \def\doverb'{'#1'}'{#1} -% -% [Knuth] p. 382; only eat outer {} -\begingroup - \catcode`[=1\catcode`]=2\catcode`\{=\other\catcode`\}=\other - \gdef\doverb{#1[\def\next##1#1}[##1\endgroup]\next] -\endgroup -% -\def\verb{\begingroup\setupverb\doverb} -% -% -% Do the @verbatim magic: define the macro \doverbatim so that -% the (first) argument ends when '@end verbatim' is reached, ie: -% -% \def\doverbatim#1@end verbatim{#1} -% -% For Texinfo it's a lot easier than for LaTeX, -% because texinfo's \verbatim doesn't stop at '\end{verbatim}': -% we need not redefine '\', '{' and '}'. -% -% Inspired by LaTeX's verbatim command set [latex.ltx] -% -\begingroup - \catcode`\ =\active - \obeylines % - % ignore everything up to the first ^^M, that's the newline at the end - % of the @verbatim input line itself. Otherwise we get an extra blank - % line in the output. - \xdef\doverbatim#1^^M#2@end verbatim{#2\noexpand\end\gobble verbatim}% - % We really want {...\end verbatim} in the body of the macro, but - % without the active space; thus we have to use \xdef and \gobble. -\endgroup -% -\envdef\verbatim{% - \setupverbatim\doverbatim -} -\let\Everbatim = \afterenvbreak - - -% @verbatiminclude FILE - insert text of file in verbatim environment. -% -\def\verbatiminclude{\parseargusing\filenamecatcodes\doverbatiminclude} -% -\def\doverbatiminclude#1{% - {% - \makevalueexpandable - \setupverbatim - \input #1 - \afterenvbreak - }% -} - -% @copying ... @end copying. -% Save the text away for @insertcopying later. Many commands won't be -% allowed in this context, but that's ok. -% -% We save the uninterpreted tokens, rather than creating a box. -% Saving the text in a box would be much easier, but then all the -% typesetting commands (@smallbook, font changes, etc.) have to be done -% beforehand -- and a) we want @copying to be done first in the source -% file; b) letting users define the frontmatter in as flexible order as -% possible is very desirable. -% -\def\copying{\begingroup - % Define a command to swallow text until we reach `@end copying'. - % \ is the escape char in this texinfo.tex file, so it is the - % delimiter for the command; @ will be the escape char when we read - % it, but that doesn't matter. - \long\def\docopying##1\end copying{\gdef\copyingtext{##1}\enddocopying}% - % - % We must preserve ^^M's in the input file; see \insertcopying below. - \catcode`\^^M = \active - \docopying -} - -% What we do to finish off the copying text. -% -\def\enddocopying{\endgroup\ignorespaces} - -% @insertcopying. Here we must play games with ^^M's. On the one hand, -% we need them to delimit commands such as `@end quotation', so they -% must be active. On the other hand, we certainly don't want every -% end-of-line to be a \par, as would happen with the normal active -% definition of ^^M. On the third hand, two ^^M's in a row should still -% generate a \par. -% -% Our approach is to make ^^M insert a space and a penalty1 normally; -% then it can also check if \lastpenalty=1. If it does, then manually -% do \par. -% -% This messes up the normal definitions of @c[omment], so we redefine -% it. Similarly for @ignore. (These commands are used in the gcc -% manual for man page generation.) -% -% Seems pretty fragile, most line-oriented commands will presumably -% fail, but for the limited use of getting the copying text (which -% should be quite simple) inserted, we can hope it's ok. -% -{\catcode`\^^M=\active % -\gdef\insertcopying{\begingroup % - \parindent = 0pt % looks wrong on title page - \def^^M{% - \ifnum \lastpenalty=1 % - \par % - \else % - \space \penalty 1 % - \fi % - }% - % - % Fix @c[omment] for catcode 13 ^^M's. - \def\c##1^^M{\ignorespaces}% - \let\comment = \c % - % - % Don't bother jumping through all the hoops that \doignore does, it - % would be very hard since the catcodes are already set. - \long\def\ignore##1\end ignore{\ignorespaces}% - % - \copyingtext % -\endgroup}% -} - -\message{defuns,} -% @defun etc. - -\newskip\defbodyindent \defbodyindent=.4in -\newskip\defargsindent \defargsindent=50pt -\newskip\deflastargmargin \deflastargmargin=18pt - -% Start the processing of @deffn: -\def\startdefun{% - \ifnum\lastpenalty<10000 - \medbreak - \else - % If there are two @def commands in a row, we'll have a \nobreak, - % which is there to keep the function description together with its - % header. But if there's nothing but headers, we need to allow a - % break somewhere. Check for penalty 10002 (inserted by - % \defargscommonending) instead of 10000, since the sectioning - % commands insert a \penalty10000, and we don't want to allow a break - % between a section heading and a defun. - \ifnum\lastpenalty=10002 \penalty2000 \fi - % - % Similarly, after a section heading, do not allow a break. - % But do insert the glue. - \medskip % preceded by discardable penalty, so not a breakpoint - \fi - % - \parindent=0in - \advance\leftskip by \defbodyindent - \exdentamount=\defbodyindent -} - -\def\dodefunx#1{% - % First, check whether we are in the right environment: - \checkenv#1% - % - % As above, allow line break if we have multiple x headers in a row. - % It's not a great place, though. - \ifnum\lastpenalty=10002 \penalty3000 \fi - % - % And now, it's time to reuse the body of the original defun: - \expandafter\gobbledefun#1% -} -\def\gobbledefun#1\startdefun{} - -% \printdefunline \deffnheader{text} -% -\def\printdefunline#1#2{% - \begingroup - % call \deffnheader: - #1#2 \endheader - % common ending: - \interlinepenalty = 10000 - \advance\rightskip by 0pt plus 1fil - \endgraf - \nobreak\vskip -\parskip - \penalty 10002 % signal to \startdefun and \dodefunx - % Some of the @defun-type tags do not enable magic parentheses, - % rendering the following check redundant. But we don't optimize. - \checkparencounts - \endgroup -} - -\def\Edefun{\endgraf\medbreak} - -% \makedefun{deffn} creates \deffn, \deffnx and \Edeffn; -% the only thing remainnig is to define \deffnheader. -% -\def\makedefun#1{% - \expandafter\let\csname E#1\endcsname = \Edefun - \edef\temp{\noexpand\domakedefun - \makecsname{#1}\makecsname{#1x}\makecsname{#1header}}% - \temp -} - -% \domakedefun \deffn \deffnx \deffnheader -% -% Define \deffn and \deffnx, without parameters. -% \deffnheader has to be defined explicitly. -% -\def\domakedefun#1#2#3{% - \envdef#1{% - \startdefun - \parseargusing\activeparens{\printdefunline#3}% - }% - \def#2{\dodefunx#1}% - \def#3% -} - -%%% Untyped functions: - -% @deffn category name args -\makedefun{deffn}{\deffngeneral{}} - -% @deffn category class name args -\makedefun{defop}#1 {\defopon{#1\ \putwordon}} - -% \defopon {category on}class name args -\def\defopon#1#2 {\deffngeneral{\putwordon\ \code{#2}}{#1\ \code{#2}} } - -% \deffngeneral {subind}category name args -% -\def\deffngeneral#1#2 #3 #4\endheader{% - % Remember that \dosubind{fn}{foo}{} is equivalent to \doind{fn}{foo}. - \dosubind{fn}{\code{#3}}{#1}% - \defname{#2}{}{#3}\magicamp\defunargs{#4\unskip}% -} - -%%% Typed functions: - -% @deftypefn category type name args -\makedefun{deftypefn}{\deftypefngeneral{}} - -% @deftypeop category class type name args -\makedefun{deftypeop}#1 {\deftypeopon{#1\ \putwordon}} - -% \deftypeopon {category on}class type name args -\def\deftypeopon#1#2 {\deftypefngeneral{\putwordon\ \code{#2}}{#1\ \code{#2}} } - -% \deftypefngeneral {subind}category type name args -% -\def\deftypefngeneral#1#2 #3 #4 #5\endheader{% - \dosubind{fn}{\code{#4}}{#1}% - \defname{#2}{#3}{#4}\defunargs{#5\unskip}% -} - -%%% Typed variables: - -% @deftypevr category type var args -\makedefun{deftypevr}{\deftypecvgeneral{}} - -% @deftypecv category class type var args -\makedefun{deftypecv}#1 {\deftypecvof{#1\ \putwordof}} - -% \deftypecvof {category of}class type var args -\def\deftypecvof#1#2 {\deftypecvgeneral{\putwordof\ \code{#2}}{#1\ \code{#2}} } - -% \deftypecvgeneral {subind}category type var args -% -\def\deftypecvgeneral#1#2 #3 #4 #5\endheader{% - \dosubind{vr}{\code{#4}}{#1}% - \defname{#2}{#3}{#4}\defunargs{#5\unskip}% -} - -%%% Untyped variables: - -% @defvr category var args -\makedefun{defvr}#1 {\deftypevrheader{#1} {} } - -% @defcv category class var args -\makedefun{defcv}#1 {\defcvof{#1\ \putwordof}} - -% \defcvof {category of}class var args -\def\defcvof#1#2 {\deftypecvof{#1}#2 {} } - -%%% Type: -% @deftp category name args -\makedefun{deftp}#1 #2 #3\endheader{% - \doind{tp}{\code{#2}}% - \defname{#1}{}{#2}\defunargs{#3\unskip}% -} - -% Remaining @defun-like shortcuts: -\makedefun{defun}{\deffnheader{\putwordDeffunc} } -\makedefun{defmac}{\deffnheader{\putwordDefmac} } -\makedefun{defspec}{\deffnheader{\putwordDefspec} } -\makedefun{deftypefun}{\deftypefnheader{\putwordDeffunc} } -\makedefun{defvar}{\defvrheader{\putwordDefvar} } -\makedefun{defopt}{\defvrheader{\putwordDefopt} } -\makedefun{deftypevar}{\deftypevrheader{\putwordDefvar} } -\makedefun{defmethod}{\defopon\putwordMethodon} -\makedefun{deftypemethod}{\deftypeopon\putwordMethodon} -\makedefun{defivar}{\defcvof\putwordInstanceVariableof} -\makedefun{deftypeivar}{\deftypecvof\putwordInstanceVariableof} - -% \defname, which formats the name of the @def (not the args). -% #1 is the category, such as "Function". -% #2 is the return type, if any. -% #3 is the function name. -% -% We are followed by (but not passed) the arguments, if any. -% -\def\defname#1#2#3{% - % Get the values of \leftskip and \rightskip as they were outside the @def... - \advance\leftskip by -\defbodyindent - % - % How we'll format the type name. Putting it in brackets helps - % distinguish it from the body text that may end up on the next line - % just below it. - \def\temp{#1}% - \setbox0=\hbox{\kern\deflastargmargin \ifx\temp\empty\else [\rm\temp]\fi} - % - % Figure out line sizes for the paragraph shape. - % The first line needs space for \box0; but if \rightskip is nonzero, - % we need only space for the part of \box0 which exceeds it: - \dimen0=\hsize \advance\dimen0 by -\wd0 \advance\dimen0 by \rightskip - % The continuations: - \dimen2=\hsize \advance\dimen2 by -\defargsindent - % (plain.tex says that \dimen1 should be used only as global.) - \parshape 2 0in \dimen0 \defargsindent \dimen2 - % - % Put the type name to the right margin. - \noindent - \hbox to 0pt{% - \hfil\box0 \kern-\hsize - % \hsize has to be shortened this way: - \kern\leftskip - % Intentionally do not respect \rightskip, since we need the space. - }% - % - % Allow all lines to be underfull without complaint: - \tolerance=10000 \hbadness=10000 - \exdentamount=\defbodyindent - {% - % defun fonts. We use typewriter by default (used to be bold) because: - % . we're printing identifiers, they should be in tt in principle. - % . in languages with many accents, such as Czech or French, it's - % common to leave accents off identifiers. The result looks ok in - % tt, but exceedingly strange in rm. - % . we don't want -- and --- to be treated as ligatures. - % . this still does not fix the ?` and !` ligatures, but so far no - % one has made identifiers using them :). - \df \tt - \def\temp{#2}% return value type - \ifx\temp\empty\else \tclose{\temp} \fi - #3% output function name - }% - {\rm\enskip}% hskip 0.5 em of \tenrm - % - \boldbrax - % arguments will be output next, if any. -} - -% Print arguments in slanted roman (not ttsl), inconsistently with using -% tt for the name. This is because literal text is sometimes needed in -% the argument list (groff manual), and ttsl and tt are not very -% distinguishable. Prevent hyphenation at `-' chars. -% -\def\defunargs#1{% - % use sl by default (not ttsl), - % tt for the names. - \df \sl \hyphenchar\font=0 - % - % On the other hand, if an argument has two dashes (for instance), we - % want a way to get ttsl. Let's try @var for that. - \let\var=\ttslanted - #1% - \sl\hyphenchar\font=45 -} - -% We want ()&[] to print specially on the defun line. -% -\def\activeparens{% - \catcode`\(=\active \catcode`\)=\active - \catcode`\[=\active \catcode`\]=\active - \catcode`\&=\active -} - -% Make control sequences which act like normal parenthesis chars. -\let\lparen = ( \let\rparen = ) - -% Be sure that we always have a definition for `(', etc. For example, -% if the fn name has parens in it, \boldbrax will not be in effect yet, -% so TeX would otherwise complain about undefined control sequence. -{ - \activeparens - \global\let(=\lparen \global\let)=\rparen - \global\let[=\lbrack \global\let]=\rbrack - \global\let& = \& - - \gdef\boldbrax{\let(=\opnr\let)=\clnr\let[=\lbrb\let]=\rbrb} - \gdef\magicamp{\let&=\amprm} -} - -\newcount\parencount - -% If we encounter &foo, then turn on ()-hacking afterwards -\newif\ifampseen -\def\amprm#1 {\ampseentrue{\bf\ }} - -\def\parenfont{% - \ifampseen - % At the first level, print parens in roman, - % otherwise use the default font. - \ifnum \parencount=1 \rm \fi - \else - % The \sf parens (in \boldbrax) actually are a little bolder than - % the contained text. This is especially needed for [ and ] . - \sf - \fi -} -\def\infirstlevel#1{% - \ifampseen - \ifnum\parencount=1 - #1% - \fi - \fi -} -\def\bfafterword#1 {#1 \bf} - -\def\opnr{% - \global\advance\parencount by 1 - {\parenfont(}% - \infirstlevel \bfafterword -} -\def\clnr{% - {\parenfont)}% - \infirstlevel \sl - \global\advance\parencount by -1 -} - -\newcount\brackcount -\def\lbrb{% - \global\advance\brackcount by 1 - {\bf[}% -} -\def\rbrb{% - {\bf]}% - \global\advance\brackcount by -1 -} - -\def\checkparencounts{% - \ifnum\parencount=0 \else \badparencount \fi - \ifnum\brackcount=0 \else \badbrackcount \fi -} -\def\badparencount{% - \errmessage{Unbalanced parentheses in @def}% - \global\parencount=0 -} -\def\badbrackcount{% - \errmessage{Unbalanced square braces in @def}% - \global\brackcount=0 -} - - -\message{macros,} -% @macro. - -% To do this right we need a feature of e-TeX, \scantokens, -% which we arrange to emulate with a temporary file in ordinary TeX. -\ifx\eTeXversion\undefined - \newwrite\macscribble - \def\scantokens#1{% - \toks0={#1\endinput}% - \immediate\openout\macscribble=\jobname.tmp - \immediate\write\macscribble{\the\toks0}% - \immediate\closeout\macscribble - \input \jobname.tmp - } -\fi - -\def\scanmacro#1{% - \begingroup - \newlinechar`\^^M - \let\xeatspaces\eatspaces - % Undo catcode changes of \startcontents and \doprintindex - \catcode`\@=0 \catcode`\\=\other \escapechar=`\@ - % ... and \example - \spaceisspace - % - % Append \endinput to make sure that TeX does not see the ending newline. - % - % I've verified that it is necessary both for e-TeX and for ordinary TeX - % --kasal, 29nov03 - \scantokens{#1\endinput}% - \endgroup -} - -\newcount\paramno % Count of parameters -\newtoks\macname % Macro name -\newif\ifrecursive % Is it recursive? -\def\macrolist{} % List of all defined macros in the form - % \do\macro1\do\macro2... - -% Utility routines. -% This does \let #1 = #2, except with \csnames. -\def\cslet#1#2{% -\expandafter\expandafter -\expandafter\let -\expandafter\expandafter -\csname#1\endcsname -\csname#2\endcsname} - -% Trim leading and trailing spaces off a string. -% Concepts from aro-bend problem 15 (see CTAN). -{\catcode`\@=11 -\gdef\eatspaces #1{\expandafter\trim@\expandafter{#1 }} -\gdef\trim@ #1{\trim@@ @#1 @ #1 @ @@} -\gdef\trim@@ #1@ #2@ #3@@{\trim@@@\empty #2 @} -\def\unbrace#1{#1} -\unbrace{\gdef\trim@@@ #1 } #2@{#1} -} - -% Trim a single trailing ^^M off a string. -{\catcode`\^^M=\other \catcode`\Q=3% -\gdef\eatcr #1{\eatcra #1Q^^MQ}% -\gdef\eatcra#1^^MQ{\eatcrb#1Q}% -\gdef\eatcrb#1Q#2Q{#1}% -} - -% Macro bodies are absorbed as an argument in a context where -% all characters are catcode 10, 11 or 12, except \ which is active -% (as in normal texinfo). It is necessary to change the definition of \. - -% It's necessary to have hard CRs when the macro is executed. This is -% done by making ^^M (\endlinechar) catcode 12 when reading the macro -% body, and then making it the \newlinechar in \scanmacro. - -\def\macrobodyctxt{% - \catcode`\~=\other - \catcode`\^=\other - \catcode`\_=\other - \catcode`\|=\other - \catcode`\<=\other - \catcode`\>=\other - \catcode`\+=\other - \catcode`\{=\other - \catcode`\}=\other - \catcode`\@=\other - \catcode`\^^M=\other - \usembodybackslash} - -\def\macroargctxt{% - \catcode`\~=\other - \catcode`\^=\other - \catcode`\_=\other - \catcode`\|=\other - \catcode`\<=\other - \catcode`\>=\other - \catcode`\+=\other - \catcode`\@=\other - \catcode`\\=\other} - -% \mbodybackslash is the definition of \ in @macro bodies. -% It maps \foo\ => \csname macarg.foo\endcsname => #N -% where N is the macro parameter number. -% We define \csname macarg.\endcsname to be \realbackslash, so -% \\ in macro replacement text gets you a backslash. - -{\catcode`@=0 @catcode`@\=@active - @gdef@usembodybackslash{@let\=@mbodybackslash} - @gdef@mbodybackslash#1\{@csname macarg.#1@endcsname} -} -\expandafter\def\csname macarg.\endcsname{\realbackslash} - -\def\macro{\recursivefalse\parsearg\macroxxx} -\def\rmacro{\recursivetrue\parsearg\macroxxx} - -\def\macroxxx#1{% - \getargs{#1}% now \macname is the macname and \argl the arglist - \ifx\argl\empty % no arguments - \paramno=0% - \else - \expandafter\parsemargdef \argl;% - \fi - \if1\csname ismacro.\the\macname\endcsname - \message{Warning: redefining \the\macname}% - \else - \expandafter\ifx\csname \the\macname\endcsname \relax - \else \errmessage{Macro name \the\macname\space already defined}\fi - \global\cslet{macsave.\the\macname}{\the\macname}% - \global\expandafter\let\csname ismacro.\the\macname\endcsname=1% - % Add the macroname to \macrolist - \toks0 = \expandafter{\macrolist\do}% - \xdef\macrolist{\the\toks0 - \expandafter\noexpand\csname\the\macname\endcsname}% - \fi - \begingroup \macrobodyctxt - \ifrecursive \expandafter\parsermacbody - \else \expandafter\parsemacbody - \fi} - -\parseargdef\unmacro{% - \if1\csname ismacro.#1\endcsname - \global\cslet{#1}{macsave.#1}% - \global\expandafter\let \csname ismacro.#1\endcsname=0% - % Remove the macro name from \macrolist: - \begingroup - \expandafter\let\csname#1\endcsname \relax - \let\do\unmacrodo - \xdef\macrolist{\macrolist}% - \endgroup - \else - \errmessage{Macro #1 not defined}% - \fi -} - -% Called by \do from \dounmacro on each macro. The idea is to omit any -% macro definitions that have been changed to \relax. -% -\def\unmacrodo#1{% - \ifx#1\relax - % remove this - \else - \noexpand\do \noexpand #1% - \fi -} - -% This makes use of the obscure feature that if the last token of a -% is #, then the preceding argument is delimited by -% an opening brace, and that opening brace is not consumed. -\def\getargs#1{\getargsxxx#1{}} -\def\getargsxxx#1#{\getmacname #1 \relax\getmacargs} -\def\getmacname #1 #2\relax{\macname={#1}} -\def\getmacargs#1{\def\argl{#1}} - -% Parse the optional {params} list. Set up \paramno and \paramlist -% so \defmacro knows what to do. Define \macarg.blah for each blah -% in the params list, to be ##N where N is the position in that list. -% That gets used by \mbodybackslash (above). - -% We need to get `macro parameter char #' into several definitions. -% The technique used is stolen from LaTeX: let \hash be something -% unexpandable, insert that wherever you need a #, and then redefine -% it to # just before using the token list produced. -% -% The same technique is used to protect \eatspaces till just before -% the macro is used. - -\def\parsemargdef#1;{\paramno=0\def\paramlist{}% - \let\hash\relax\let\xeatspaces\relax\parsemargdefxxx#1,;,} -\def\parsemargdefxxx#1,{% - \if#1;\let\next=\relax - \else \let\next=\parsemargdefxxx - \advance\paramno by 1% - \expandafter\edef\csname macarg.\eatspaces{#1}\endcsname - {\xeatspaces{\hash\the\paramno}}% - \edef\paramlist{\paramlist\hash\the\paramno,}% - \fi\next} - -% These two commands read recursive and nonrecursive macro bodies. -% (They're different since rec and nonrec macros end differently.) - -\long\def\parsemacbody#1@end macro% -{\xdef\temp{\eatcr{#1}}\endgroup\defmacro}% -\long\def\parsermacbody#1@end rmacro% -{\xdef\temp{\eatcr{#1}}\endgroup\defmacro}% - -% This defines the macro itself. There are six cases: recursive and -% nonrecursive macros of zero, one, and many arguments. -% Much magic with \expandafter here. -% \xdef is used so that macro definitions will survive the file -% they're defined in; @include reads the file inside a group. -\def\defmacro{% - \let\hash=##% convert placeholders to macro parameter chars - \ifrecursive - \ifcase\paramno - % 0 - \expandafter\xdef\csname\the\macname\endcsname{% - \noexpand\scanmacro{\temp}}% - \or % 1 - \expandafter\xdef\csname\the\macname\endcsname{% - \bgroup\noexpand\macroargctxt - \noexpand\braceorline - \expandafter\noexpand\csname\the\macname xxx\endcsname}% - \expandafter\xdef\csname\the\macname xxx\endcsname##1{% - \egroup\noexpand\scanmacro{\temp}}% - \else % many - \expandafter\xdef\csname\the\macname\endcsname{% - \bgroup\noexpand\macroargctxt - \noexpand\csname\the\macname xx\endcsname}% - \expandafter\xdef\csname\the\macname xx\endcsname##1{% - \expandafter\noexpand\csname\the\macname xxx\endcsname ##1,}% - \expandafter\expandafter - \expandafter\xdef - \expandafter\expandafter - \csname\the\macname xxx\endcsname - \paramlist{\egroup\noexpand\scanmacro{\temp}}% - \fi - \else - \ifcase\paramno - % 0 - \expandafter\xdef\csname\the\macname\endcsname{% - \noexpand\norecurse{\the\macname}% - \noexpand\scanmacro{\temp}\egroup}% - \or % 1 - \expandafter\xdef\csname\the\macname\endcsname{% - \bgroup\noexpand\macroargctxt - \noexpand\braceorline - \expandafter\noexpand\csname\the\macname xxx\endcsname}% - \expandafter\xdef\csname\the\macname xxx\endcsname##1{% - \egroup - \noexpand\norecurse{\the\macname}% - \noexpand\scanmacro{\temp}\egroup}% - \else % many - \expandafter\xdef\csname\the\macname\endcsname{% - \bgroup\noexpand\macroargctxt - \expandafter\noexpand\csname\the\macname xx\endcsname}% - \expandafter\xdef\csname\the\macname xx\endcsname##1{% - \expandafter\noexpand\csname\the\macname xxx\endcsname ##1,}% - \expandafter\expandafter - \expandafter\xdef - \expandafter\expandafter - \csname\the\macname xxx\endcsname - \paramlist{% - \egroup - \noexpand\norecurse{\the\macname}% - \noexpand\scanmacro{\temp}\egroup}% - \fi - \fi} - -\def\norecurse#1{\bgroup\cslet{#1}{macsave.#1}} - -% \braceorline decides whether the next nonwhitespace character is a -% {. If so it reads up to the closing }, if not, it reads the whole -% line. Whatever was read is then fed to the next control sequence -% as an argument (by \parsebrace or \parsearg) -\def\braceorline#1{\let\next=#1\futurelet\nchar\braceorlinexxx} -\def\braceorlinexxx{% - \ifx\nchar\bgroup\else - \expandafter\parsearg - \fi \next} - -% We want to disable all macros during \shipout so that they are not -% expanded by \write. -\def\turnoffmacros{\begingroup \def\do##1{\let\noexpand##1=\relax}% - \edef\next{\macrolist}\expandafter\endgroup\next} - -% For \indexnofonts, we need to get rid of all macros, leaving only the -% arguments (if present). Of course this is not nearly correct, but it -% is the best we can do for now. makeinfo does not expand macros in the -% argument to @deffn, which ends up writing an index entry, and texindex -% isn't prepared for an index sort entry that starts with \. -% -% Since macro invocations are followed by braces, we can just redefine them -% to take a single TeX argument. The case of a macro invocation that -% goes to end-of-line is not handled. -% -\def\emptyusermacros{\begingroup - \def\do##1{\let\noexpand##1=\noexpand\asis}% - \edef\next{\macrolist}\expandafter\endgroup\next} - - -% @alias. -% We need some trickery to remove the optional spaces around the equal -% sign. Just make them active and then expand them all to nothing. -\def\alias{\parseargusing\obeyspaces\aliasxxx} -\def\aliasxxx #1{\aliasyyy#1\relax} -\def\aliasyyy #1=#2\relax{% - {% - \expandafter\let\obeyedspace=\empty - \xdef\next{\global\let\makecsname{#1}=\makecsname{#2}}% - }% - \next -} - - -\message{cross references,} - -\newwrite\auxfile - -\newif\ifhavexrefs % True if xref values are known. -\newif\ifwarnedxrefs % True if we warned once that they aren't known. - -% @inforef is relatively simple. -\def\inforef #1{\inforefzzz #1,,,,**} -\def\inforefzzz #1,#2,#3,#4**{\putwordSee{} \putwordInfo{} \putwordfile{} \file{\ignorespaces #3{}}, - node \samp{\ignorespaces#1{}}} - -% @node's only job in TeX is to define \lastnode, which is used in -% cross-references. The @node line might or might not have commas, and -% might or might not have spaces before the first comma, like: -% @node foo , bar , ... -% We don't want such trailing spaces in the node name. -% -\parseargdef\node{\checkenv{}\donode #1 ,\finishnodeparse} -% -% also remove a trailing comma, in case of something like this: -% @node Help-Cross, , , Cross-refs -\def\donode#1 ,#2\finishnodeparse{\dodonode #1,\finishnodeparse} -\def\dodonode#1,#2\finishnodeparse{\gdef\lastnode{#1}} - -\let\nwnode=\node -\let\lastnode=\empty - -% Write a cross-reference definition for the current node. #1 is the -% type (Ynumbered, Yappendix, Ynothing). -% -\def\donoderef#1{% - \ifx\lastnode\empty\else - \setref{\lastnode}{#1}% - \global\let\lastnode=\empty - \fi -} - -% @anchor{NAME} -- define xref target at arbitrary point. -% -\newcount\savesfregister -% -\def\savesf{\relax \ifhmode \savesfregister=\spacefactor \fi} -\def\restoresf{\relax \ifhmode \spacefactor=\savesfregister \fi} -\def\anchor#1{\savesf \setref{#1}{Ynothing}\restoresf \ignorespaces} - -% \setref{NAME}{SNT} defines a cross-reference point NAME (a node or an -% anchor), which consists of three parts: -% 1) NAME-title - the current sectioning name taken from \thissection, -% or the anchor name. -% 2) NAME-snt - section number and type, passed as the SNT arg, or -% empty for anchors. -% 3) NAME-pg - the page number. -% -% This is called from \donoderef, \anchor, and \dofloat. In the case of -% floats, there is an additional part, which is not written here: -% 4) NAME-lof - the text as it should appear in a @listoffloats. -% -\def\setref#1#2{% - \pdfmkdest{#1}% - \iflinks - {% - \atdummies % preserve commands, but don't expand them - \turnoffactive - \otherbackslash - \edef\writexrdef##1##2{% - \write\auxfile{@xrdef{#1-% #1 of \setref, expanded by the \edef - ##1}{##2}}% these are parameters of \writexrdef - }% - \toks0 = \expandafter{\thissection}% - \immediate \writexrdef{title}{\the\toks0 }% - \immediate \writexrdef{snt}{\csname #2\endcsname}% \Ynumbered etc. - \writexrdef{pg}{\folio}% will be written later, during \shipout - }% - \fi -} - -% @xref, @pxref, and @ref generate cross-references. For \xrefX, #1 is -% the node name, #2 the name of the Info cross-reference, #3 the printed -% node name, #4 the name of the Info file, #5 the name of the printed -% manual. All but the node name can be omitted. -% -\def\pxref#1{\putwordsee{} \xrefX[#1,,,,,,,]} -\def\xref#1{\putwordSee{} \xrefX[#1,,,,,,,]} -\def\ref#1{\xrefX[#1,,,,,,,]} -\def\xrefX[#1,#2,#3,#4,#5,#6]{\begingroup - \unsepspaces - \def\printedmanual{\ignorespaces #5}% - \def\printedrefname{\ignorespaces #3}% - \setbox1=\hbox{\printedmanual\unskip}% - \setbox0=\hbox{\printedrefname\unskip}% - \ifdim \wd0 = 0pt - % No printed node name was explicitly given. - \expandafter\ifx\csname SETxref-automatic-section-title\endcsname\relax - % Use the node name inside the square brackets. - \def\printedrefname{\ignorespaces #1}% - \else - % Use the actual chapter/section title appear inside - % the square brackets. Use the real section title if we have it. - \ifdim \wd1 > 0pt - % It is in another manual, so we don't have it. - \def\printedrefname{\ignorespaces #1}% - \else - \ifhavexrefs - % We know the real title if we have the xref values. - \def\printedrefname{\refx{#1-title}{}}% - \else - % Otherwise just copy the Info node name. - \def\printedrefname{\ignorespaces #1}% - \fi% - \fi - \fi - \fi - % - % Make link in pdf output. - \ifpdf - \leavevmode - \getfilename{#4}% - {\turnoffactive \otherbackslash - \ifnum\filenamelength>0 - \startlink attr{/Border [0 0 0]}% - goto file{\the\filename.pdf} name{#1}% - \else - \startlink attr{/Border [0 0 0]}% - goto name{\pdfmkpgn{#1}}% - \fi - }% - \linkcolor - \fi - % - % Float references are printed completely differently: "Figure 1.2" - % instead of "[somenode], p.3". We distinguish them by the - % LABEL-title being set to a magic string. - {% - % Have to otherify everything special to allow the \csname to - % include an _ in the xref name, etc. - \indexnofonts - \turnoffactive - \otherbackslash - \expandafter\global\expandafter\let\expandafter\Xthisreftitle - \csname XR#1-title\endcsname - }% - \iffloat\Xthisreftitle - % If the user specified the print name (third arg) to the ref, - % print it instead of our usual "Figure 1.2". - \ifdim\wd0 = 0pt - \refx{#1-snt}% - \else - \printedrefname - \fi - % - % if the user also gave the printed manual name (fifth arg), append - % "in MANUALNAME". - \ifdim \wd1 > 0pt - \space \putwordin{} \cite{\printedmanual}% - \fi - \else - % node/anchor (non-float) references. - % - % If we use \unhbox0 and \unhbox1 to print the node names, TeX does not - % insert empty discretionaries after hyphens, which means that it will - % not find a line break at a hyphen in a node names. Since some manuals - % are best written with fairly long node names, containing hyphens, this - % is a loss. Therefore, we give the text of the node name again, so it - % is as if TeX is seeing it for the first time. - \ifdim \wd1 > 0pt - \putwordsection{} ``\printedrefname'' \putwordin{} \cite{\printedmanual}% - \else - % _ (for example) has to be the character _ for the purposes of the - % control sequence corresponding to the node, but it has to expand - % into the usual \leavevmode...\vrule stuff for purposes of - % printing. So we \turnoffactive for the \refx-snt, back on for the - % printing, back off for the \refx-pg. - {\turnoffactive \otherbackslash - % Only output a following space if the -snt ref is nonempty; for - % @unnumbered and @anchor, it won't be. - \setbox2 = \hbox{\ignorespaces \refx{#1-snt}{}}% - \ifdim \wd2 > 0pt \refx{#1-snt}\space\fi - }% - % output the `[mynode]' via a macro so it can be overridden. - \xrefprintnodename\printedrefname - % - % But we always want a comma and a space: - ,\space - % - % output the `page 3'. - \turnoffactive \otherbackslash \putwordpage\tie\refx{#1-pg}{}% - \fi - \fi - \endlink -\endgroup} - -% This macro is called from \xrefX for the `[nodename]' part of xref -% output. It's a separate macro only so it can be changed more easily, -% since square brackets don't work well in some documents. Particularly -% one that Bob is working on :). -% -\def\xrefprintnodename#1{[#1]} - -% Things referred to by \setref. -% -\def\Ynothing{} -\def\Yomitfromtoc{} -\def\Ynumbered{% - \ifnum\secno=0 - \putwordChapter@tie \the\chapno - \else \ifnum\subsecno=0 - \putwordSection@tie \the\chapno.\the\secno - \else \ifnum\subsubsecno=0 - \putwordSection@tie \the\chapno.\the\secno.\the\subsecno - \else - \putwordSection@tie \the\chapno.\the\secno.\the\subsecno.\the\subsubsecno - \fi\fi\fi -} -\def\Yappendix{% - \ifnum\secno=0 - \putwordAppendix@tie @char\the\appendixno{}% - \else \ifnum\subsecno=0 - \putwordSection@tie @char\the\appendixno.\the\secno - \else \ifnum\subsubsecno=0 - \putwordSection@tie @char\the\appendixno.\the\secno.\the\subsecno - \else - \putwordSection@tie - @char\the\appendixno.\the\secno.\the\subsecno.\the\subsubsecno - \fi\fi\fi -} - -% Define \refx{NAME}{SUFFIX} to reference a cross-reference string named NAME. -% If its value is nonempty, SUFFIX is output afterward. -% -\def\refx#1#2{% - {% - \indexnofonts - \otherbackslash - \expandafter\global\expandafter\let\expandafter\thisrefX - \csname XR#1\endcsname - }% - \ifx\thisrefX\relax - % If not defined, say something at least. - \angleleft un\-de\-fined\angleright - \iflinks - \ifhavexrefs - \message{\linenumber Undefined cross reference `#1'.}% - \else - \ifwarnedxrefs\else - \global\warnedxrefstrue - \message{Cross reference values unknown; you must run TeX again.}% - \fi - \fi - \fi - \else - % It's defined, so just use it. - \thisrefX - \fi - #2% Output the suffix in any case. -} - -% This is the macro invoked by entries in the aux file. Usually it's -% just a \def (we prepend XR to the control sequence name to avoid -% collisions). But if this is a float type, we have more work to do. -% -\def\xrdef#1#2{% - \expandafter\gdef\csname XR#1\endcsname{#2}% remember this xref value. - % - % Was that xref control sequence that we just defined for a float? - \expandafter\iffloat\csname XR#1\endcsname - % it was a float, and we have the (safe) float type in \iffloattype. - \expandafter\let\expandafter\floatlist - \csname floatlist\iffloattype\endcsname - % - % Is this the first time we've seen this float type? - \expandafter\ifx\floatlist\relax - \toks0 = {\do}% yes, so just \do - \else - % had it before, so preserve previous elements in list. - \toks0 = \expandafter{\floatlist\do}% - \fi - % - % Remember this xref in the control sequence \floatlistFLOATTYPE, - % for later use in \listoffloats. - \expandafter\xdef\csname floatlist\iffloattype\endcsname{\the\toks0{#1}}% - \fi -} - -% Read the last existing aux file, if any. No error if none exists. -% -\def\tryauxfile{% - \openin 1 \jobname.aux - \ifeof 1 \else - \readauxfile - \global\havexrefstrue - \fi - \closein 1 -} - -\def\readauxfile{\begingroup - \catcode`\^^@=\other - \catcode`\^^A=\other - \catcode`\^^B=\other - \catcode`\^^C=\other - \catcode`\^^D=\other - \catcode`\^^E=\other - \catcode`\^^F=\other - \catcode`\^^G=\other - \catcode`\^^H=\other - \catcode`\^^K=\other - \catcode`\^^L=\other - \catcode`\^^N=\other - \catcode`\^^P=\other - \catcode`\^^Q=\other - \catcode`\^^R=\other - \catcode`\^^S=\other - \catcode`\^^T=\other - \catcode`\^^U=\other - \catcode`\^^V=\other - \catcode`\^^W=\other - \catcode`\^^X=\other - \catcode`\^^Z=\other - \catcode`\^^[=\other - \catcode`\^^\=\other - \catcode`\^^]=\other - \catcode`\^^^=\other - \catcode`\^^_=\other - % It was suggested to set the catcode of ^ to 7, which would allow ^^e4 etc. - % in xref tags, i.e., node names. But since ^^e4 notation isn't - % supported in the main text, it doesn't seem desirable. Furthermore, - % that is not enough: for node names that actually contain a ^ - % character, we would end up writing a line like this: 'xrdef {'hat - % b-title}{'hat b} and \xrdef does a \csname...\endcsname on the first - % argument, and \hat is not an expandable control sequence. It could - % all be worked out, but why? Either we support ^^ or we don't. - % - % The other change necessary for this was to define \auxhat: - % \def\auxhat{\def^{'hat }}% extra space so ok if followed by letter - % and then to call \auxhat in \setq. - % - \catcode`\^=\other - % - % Special characters. Should be turned off anyway, but... - \catcode`\~=\other - \catcode`\[=\other - \catcode`\]=\other - \catcode`\"=\other - \catcode`\_=\other - \catcode`\|=\other - \catcode`\<=\other - \catcode`\>=\other - \catcode`\$=\other - \catcode`\#=\other - \catcode`\&=\other - \catcode`\%=\other - \catcode`+=\other % avoid \+ for paranoia even though we've turned it off - % - % This is to support \ in node names and titles, since the \ - % characters end up in a \csname. It's easier than - % leaving it active and making its active definition an actual \ - % character. What I don't understand is why it works in the *value* - % of the xrdef. Seems like it should be a catcode12 \, and that - % should not typeset properly. But it works, so I'm moving on for - % now. --karl, 15jan04. - \catcode`\\=\other - % - % Make the characters 128-255 be printing characters. - {% - \count 1=128 - \def\loop{% - \catcode\count 1=\other - \advance\count 1 by 1 - \ifnum \count 1<256 \loop \fi - }% - }% - % - % @ is our escape character in .aux files, and we need braces. - \catcode`\{=1 - \catcode`\}=2 - \catcode`\@=0 - % - \input \jobname.aux -\endgroup} - - -\message{insertions,} -% including footnotes. - -\newcount \footnoteno - -% The trailing space in the following definition for supereject is -% vital for proper filling; pages come out unaligned when you do a -% pagealignmacro call if that space before the closing brace is -% removed. (Generally, numeric constants should always be followed by a -% space to prevent strange expansion errors.) -\def\supereject{\par\penalty -20000\footnoteno =0 } - -% @footnotestyle is meaningful for info output only. -\let\footnotestyle=\comment - -{\catcode `\@=11 -% -% Auto-number footnotes. Otherwise like plain. -\gdef\footnote{% - \let\indent=\ptexindent - \let\noindent=\ptexnoindent - \global\advance\footnoteno by \@ne - \edef\thisfootno{$^{\the\footnoteno}$}% - % - % In case the footnote comes at the end of a sentence, preserve the - % extra spacing after we do the footnote number. - \let\@sf\empty - \ifhmode\edef\@sf{\spacefactor\the\spacefactor}\ptexslash\fi - % - % Remove inadvertent blank space before typesetting the footnote number. - \unskip - \thisfootno\@sf - \dofootnote -}% - -% Don't bother with the trickery in plain.tex to not require the -% footnote text as a parameter. Our footnotes don't need to be so general. -% -% Oh yes, they do; otherwise, @ifset (and anything else that uses -% \parseargline) fails inside footnotes because the tokens are fixed when -% the footnote is read. --karl, 16nov96. -% -\gdef\dofootnote{% - \insert\footins\bgroup - % We want to typeset this text as a normal paragraph, even if the - % footnote reference occurs in (for example) a display environment. - % So reset some parameters. - \hsize=\pagewidth - \interlinepenalty\interfootnotelinepenalty - \splittopskip\ht\strutbox % top baseline for broken footnotes - \splitmaxdepth\dp\strutbox - \floatingpenalty\@MM - \leftskip\z@skip - \rightskip\z@skip - \spaceskip\z@skip - \xspaceskip\z@skip - \parindent\defaultparindent - % - \smallfonts \rm - % - % Because we use hanging indentation in footnotes, a @noindent appears - % to exdent this text, so make it be a no-op. makeinfo does not use - % hanging indentation so @noindent can still be needed within footnote - % text after an @example or the like (not that this is good style). - \let\noindent = \relax - % - % Hang the footnote text off the number. Use \everypar in case the - % footnote extends for more than one paragraph. - \everypar = {\hang}% - \textindent{\thisfootno}% - % - % Don't crash into the line above the footnote text. Since this - % expands into a box, it must come within the paragraph, lest it - % provide a place where TeX can split the footnote. - \footstrut - \futurelet\next\fo@t -} -}%end \catcode `\@=11 - -% In case a @footnote appears in a vbox, save the footnote text and create -% the real \insert just after the vbox finished. Otherwise, the insertion -% would be lost. -% Similarily, if a @footnote appears inside an alignment, save the footnote -% text to a box and make the \insert when a row of the table is finished. -% And the same can be done for other insert classes. --kasal, 16nov03. - -% Replace the \insert primitive by a cheating macro. -% Deeper inside, just make sure that the saved insertions are not spilled -% out prematurely. -% -\def\startsavinginserts{% - \ifx \insert\ptexinsert - \let\insert\saveinsert - \else - \let\checkinserts\relax - \fi -} - -% This \insert replacement works for both \insert\footins{foo} and -% \insert\footins\bgroup foo\egroup, but it doesn't work for \insert27{foo}. -% -\def\saveinsert#1{% - \edef\next{\noexpand\savetobox \makeSAVEname#1}% - \afterassignment\next - % swallow the left brace - \let\temp = -} -\def\makeSAVEname#1{\makecsname{SAVE\expandafter\gobble\string#1}} -\def\savetobox#1{\global\setbox#1 = \vbox\bgroup \unvbox#1} - -\def\checksaveins#1{\ifvoid#1\else \placesaveins#1\fi} - -\def\placesaveins#1{% - \ptexinsert \csname\expandafter\gobblesave\string#1\endcsname - {\box#1}% -} - -% eat @SAVE -- beware, all of them have catcode \other: -{ - \def\dospecials{\do S\do A\do V\do E} \uncatcodespecials % ;-) - \gdef\gobblesave @SAVE{} -} - -% initialization: -\def\newsaveins #1{% - \edef\next{\noexpand\newsaveinsX \makeSAVEname#1}% - \next -} -\def\newsaveinsX #1{% - \csname newbox\endcsname #1% - \expandafter\def\expandafter\checkinserts\expandafter{\checkinserts - \checksaveins #1}% -} - -% initialize: -\let\checkinserts\empty -\newsaveins\footins -\newsaveins\margin - - -% @image. We use the macros from epsf.tex to support this. -% If epsf.tex is not installed and @image is used, we complain. -% -% Check for and read epsf.tex up front. If we read it only at @image -% time, we might be inside a group, and then its definitions would get -% undone and the next image would fail. -\openin 1 = epsf.tex -\ifeof 1 \else - % Do not bother showing banner with epsf.tex v2.7k (available in - % doc/epsf.tex and on ctan). - \def\epsfannounce{\toks0 = }% - \input epsf.tex -\fi -\closein 1 -% -% We will only complain once about lack of epsf.tex. -\newif\ifwarnednoepsf -\newhelp\noepsfhelp{epsf.tex must be installed for images to - work. It is also included in the Texinfo distribution, or you can get - it from ftp://tug.org/tex/epsf.tex.} -% -\def\image#1{% - \ifx\epsfbox\undefined - \ifwarnednoepsf \else - \errhelp = \noepsfhelp - \errmessage{epsf.tex not found, images will be ignored}% - \global\warnednoepsftrue - \fi - \else - \imagexxx #1,,,,,\finish - \fi -} -% -% Arguments to @image: -% #1 is (mandatory) image filename; we tack on .eps extension. -% #2 is (optional) width, #3 is (optional) height. -% #4 is (ignored optional) html alt text. -% #5 is (ignored optional) extension. -% #6 is just the usual extra ignored arg for parsing this stuff. -\newif\ifimagevmode -\def\imagexxx#1,#2,#3,#4,#5,#6\finish{\begingroup - \catcode`\^^M = 5 % in case we're inside an example - \normalturnoffactive % allow _ et al. in names - % If the image is by itself, center it. - \ifvmode - \imagevmodetrue - \nobreak\bigskip - % Usually we'll have text after the image which will insert - % \parskip glue, so insert it here too to equalize the space - % above and below. - \nobreak\vskip\parskip - \nobreak - \line\bgroup\hss - \fi - % - % Output the image. - \ifpdf - \dopdfimage{#1}{#2}{#3}% - \else - % \epsfbox itself resets \epsf?size at each figure. - \setbox0 = \hbox{\ignorespaces #2}\ifdim\wd0 > 0pt \epsfxsize=#2\relax \fi - \setbox0 = \hbox{\ignorespaces #3}\ifdim\wd0 > 0pt \epsfysize=#3\relax \fi - \epsfbox{#1.eps}% - \fi - % - \ifimagevmode \hss \egroup \bigbreak \fi % space after the image -\endgroup} - - -% @float FLOATTYPE,LOC ... @end float for displayed figures, tables, etc. -% We don't actually implement floating yet, we just plop the float "here". -% But it seemed the best name for the future. -% -\envparseargdef\float{\dofloat #1,,,\finish} - -% #1 is the optional FLOATTYPE, the text label for this float, typically -% "Figure", "Table", "Example", etc. Can't contain commas. If omitted, -% this float will not be numbered and cannot be referred to. -% -% #2 is the optional xref label. Also must be present for the float to -% be referable. -% -% #3 is the optional positioning argument; for now, it is ignored. It -% will somehow specify the positions allowed to float to (here, top, bottom). -% -% We keep a separate counter for each FLOATTYPE, which we reset at each -% chapter-level command. -\let\resetallfloatnos=\empty -% -\def\dofloat#1,#2,#3,#4\finish{% - \let\thiscaption=\empty - \let\thisshortcaption=\empty - % - % don't lose footnotes inside @float. - \startsavinginserts - % - % We can't be used inside a paragraph. - \par - % - \vtop\bgroup - \def\floattype{#1}% - \def\floatlabel{#2}% - \def\floatloc{#3}% we do nothing with this yet. - % - \ifx\floattype\empty - \let\safefloattype=\empty - \else - {% - % the floattype might have accents or other special characters, - % but we need to use it in a control sequence name. - \indexnofonts - \turnoffactive - \xdef\safefloattype{\floattype}% - }% - \fi - % - % If label is given but no type, we handle that as the empty type. - \ifx\floatlabel\empty \else - % We want each FLOATTYPE to be numbered separately (Figure 1, - % Table 1, Figure 2, ...). (And if no label, no number.) - % - \expandafter\getfloatno\csname\safefloattype floatno\endcsname - \global\advance\floatno by 1 - % - {% - % This magic value for \thissection is output by \setref as the - % XREFLABEL-title value. \xrefX uses it to distinguish float - % labels (which have a completely different output format) from - % node and anchor labels. And \xrdef uses it to construct the - % lists of floats. - % - \edef\thissection{\floatmagic=\safefloattype}% - \setref{\floatlabel}{Yfloat}% - }% - \fi - % - % start with \parskip glue, I guess. - \vskip\parskip - % - % Don't suppress indentation if a float happens to start a section. - \restorefirstparagraphindent -} - -% we have these possibilities: -% @float Foo,lbl & @caption{Cap}: Foo 1.1: Cap -% @float Foo,lbl & no caption: Foo 1.1 -% @float Foo & @caption{Cap}: Foo: Cap -% @float Foo & no caption: Foo -% @float ,lbl & Caption{Cap}: 1.1: Cap -% @float ,lbl & no caption: 1.1 -% @float & @caption{Cap}: Cap -% @float & no caption: -% -\def\Efloat{% - \let\floatident = \empty - % - % In all cases, if we have a float type, it comes first. - \ifx\floattype\empty \else \def\floatident{\floattype}\fi - % - % If we have an xref label, the number comes next. - \ifx\floatlabel\empty \else - \ifx\floattype\empty \else % if also had float type, need tie first. - \appendtomacro\floatident{\tie}% - \fi - % the number. - \appendtomacro\floatident{\chaplevelprefix\the\floatno}% - \fi - % - % Start the printed caption with what we've constructed in - % \floatident, but keep it separate; we need \floatident again. - \let\captionline = \floatident - % - \ifx\thiscaption\empty \else - \ifx\floatident\empty \else - \appendtomacro\captionline{: }% had ident, so need a colon between - \fi - % - % caption text. - \appendtomacro\captionline\thiscaption - \fi - % - % If we have anything to print, print it, with space before. - % Eventually this needs to become an \insert. - \ifx\captionline\empty \else - \vskip.5\parskip - \captionline - \fi - % - % If have an xref label, write the list of floats info. Do this - % after the caption, to avoid chance of it being a breakpoint. - \ifx\floatlabel\empty \else - % Write the text that goes in the lof to the aux file as - % \floatlabel-lof. Besides \floatident, we include the short - % caption if specified, else the full caption if specified, else nothing. - {% - \atdummies \turnoffactive \otherbackslash - \immediate\write\auxfile{@xrdef{\floatlabel-lof}{% - \floatident - \ifx\thisshortcaption\empty - \ifx\thiscaption\empty \else : \thiscaption \fi - \else - : \thisshortcaption - \fi - }}% - }% - \fi - % - % Space below caption, if we printed anything. - \ifx\printedsomething\empty \else \vskip\parskip \fi - \egroup % end of \vtop - \checkinserts -} - -% Append the tokens #2 to the definition of macro #1, not expanding either. -% -\newtoks\appendtomacroAtoks -\newtoks\appendtomacroBtoks -\def\appendtomacro#1#2{% - \appendtomacroAtoks = \expandafter{#1}% - \appendtomacroBtoks = {#2}% - \edef#1{\the\appendtomacroAtoks \the\appendtomacroBtoks}% -} - -% @caption, @shortcaption are easy. -% -\long\def\caption#1{\checkenv\float \def\thiscaption{#1}} -\def\shortcaption#1{\checkenv\float \def\thisshortcaption{#1}} - -% The parameter is the control sequence identifying the counter we are -% going to use. Create it if it doesn't exist and assign it to \floatno. -\def\getfloatno#1{% - \ifx#1\relax - % Haven't seen this figure type before. - \csname newcount\endcsname #1% - % - % Remember to reset this floatno at the next chap. - \expandafter\gdef\expandafter\resetallfloatnos - \expandafter{\resetallfloatnos #1=0 }% - \fi - \let\floatno#1% -} - -% \setref calls this to get the XREFLABEL-snt value. We want an @xref -% to the FLOATLABEL to expand to "Figure 3.1". We call \setref when we -% first read the @float command. -% -\def\Yfloat{\floattype@tie \chaplevelprefix\the\floatno}% - -% Magic string used for the XREFLABEL-title value, so \xrefX can -% distinguish floats from other xref types. -\def\floatmagic{!!float!!} - -% #1 is the control sequence we are passed; we expand into a conditional -% which is true if #1 represents a float ref. That is, the magic -% \thissection value which we \setref above. -% -\def\iffloat#1{\expandafter\doiffloat#1==\finish} -% -% #1 is (maybe) the \floatmagic string. If so, #2 will be the -% (safe) float type for this float. We set \iffloattype to #2. -% -\def\doiffloat#1=#2=#3\finish{% - \def\temp{#1}% - \def\iffloattype{#2}% - \ifx\temp\floatmagic -} - -% @listoffloats FLOATTYPE - print a list of floats like a table of contents. -% -\parseargdef\listoffloats{% - \def\floattype{#1}% floattype - {% - % the floattype might have accents or other special characters, - % but we need to use it in a control sequence name. - \indexnofonts - \turnoffactive - \xdef\safefloattype{\floattype}% - }% - % - % \xrdef saves the floats as a \do-list in \floatlistSAFEFLOATTYPE. - \expandafter\ifx\csname floatlist\safefloattype\endcsname \relax - \ifhavexrefs - % if the user said @listoffloats foo but never @float foo. - \message{\linenumber No `\safefloattype' floats to list.}% - \fi - \else - \begingroup - \leftskip=\tocindent % indent these entries like a toc - \let\do=\listoffloatsdo - \csname floatlist\safefloattype\endcsname - \endgroup - \fi -} - -% This is called on each entry in a list of floats. We're passed the -% xref label, in the form LABEL-title, which is how we save it in the -% aux file. We strip off the -title and look up \XRLABEL-lof, which -% has the text we're supposed to typeset here. -% -% Figures without xref labels will not be included in the list (since -% they won't appear in the aux file). -% -\def\listoffloatsdo#1{\listoffloatsdoentry#1\finish} -\def\listoffloatsdoentry#1-title\finish{{% - % Can't fully expand XR#1-lof because it can contain anything. Just - % pass the control sequence. On the other hand, XR#1-pg is just the - % page number, and we want to fully expand that so we can get a link - % in pdf output. - \toksA = \expandafter{\csname XR#1-lof\endcsname}% - % - % use the same \entry macro we use to generate the TOC and index. - \edef\writeentry{\noexpand\entry{\the\toksA}{\csname XR#1-pg\endcsname}}% - \writeentry -}} - -\message{localization,} -% and i18n. - -% @documentlanguage is usually given very early, just after -% @setfilename. If done too late, it may not override everything -% properly. Single argument is the language abbreviation. -% It would be nice if we could set up a hyphenation file here. -% -\parseargdef\documentlanguage{% - \tex % read txi-??.tex file in plain TeX. - % Read the file if it exists. - \openin 1 txi-#1.tex - \ifeof 1 - \errhelp = \nolanghelp - \errmessage{Cannot read language file txi-#1.tex}% - \else - \input txi-#1.tex - \fi - \closein 1 - \endgroup -} -\newhelp\nolanghelp{The given language definition file cannot be found or -is empty. Maybe you need to install it? In the current directory -should work if nowhere else does.} - - -% @documentencoding should change something in TeX eventually, most -% likely, but for now just recognize it. -\let\documentencoding = \comment - - -% Page size parameters. -% -\newdimen\defaultparindent \defaultparindent = 15pt - -\chapheadingskip = 15pt plus 4pt minus 2pt -\secheadingskip = 12pt plus 3pt minus 2pt -\subsecheadingskip = 9pt plus 2pt minus 2pt - -% Prevent underfull vbox error messages. -\vbadness = 10000 - -% Don't be so finicky about underfull hboxes, either. -\hbadness = 2000 - -% Following George Bush, just get rid of widows and orphans. -\widowpenalty=10000 -\clubpenalty=10000 - -% Use TeX 3.0's \emergencystretch to help line breaking, but if we're -% using an old version of TeX, don't do anything. We want the amount of -% stretch added to depend on the line length, hence the dependence on -% \hsize. We call this whenever the paper size is set. -% -\def\setemergencystretch{% - \ifx\emergencystretch\thisisundefined - % Allow us to assign to \emergencystretch anyway. - \def\emergencystretch{\dimen0}% - \else - \emergencystretch = .15\hsize - \fi -} - -% Parameters in order: 1) textheight; 2) textwidth; 3) voffset; -% 4) hoffset; 5) binding offset; 6) topskip; 7) physical page height; 8) -% physical page width. -% -% We also call \setleading{\textleading}, so the caller should define -% \textleading. The caller should also set \parskip. -% -\def\internalpagesizes#1#2#3#4#5#6#7#8{% - \voffset = #3\relax - \topskip = #6\relax - \splittopskip = \topskip - % - \vsize = #1\relax - \advance\vsize by \topskip - \outervsize = \vsize - \advance\outervsize by 2\topandbottommargin - \pageheight = \vsize - % - \hsize = #2\relax - \outerhsize = \hsize - \advance\outerhsize by 0.5in - \pagewidth = \hsize - % - \normaloffset = #4\relax - \bindingoffset = #5\relax - % - \ifpdf - \pdfpageheight #7\relax - \pdfpagewidth #8\relax - \fi - % - \setleading{\textleading} - % - \parindent = \defaultparindent - \setemergencystretch -} - -% @letterpaper (the default). -\def\letterpaper{{\globaldefs = 1 - \parskip = 3pt plus 2pt minus 1pt - \textleading = 13.2pt - % - % If page is nothing but text, make it come out even. - \internalpagesizes{46\baselineskip}{6in}% - {\voffset}{.25in}% - {\bindingoffset}{36pt}% - {11in}{8.5in}% -}} - -% Use @smallbook to reset parameters for 7x9.5 (or so) format. -\def\smallbook{{\globaldefs = 1 - \parskip = 2pt plus 1pt - \textleading = 12pt - % - \internalpagesizes{7.5in}{5in}% - {\voffset}{.25in}% - {\bindingoffset}{16pt}% - {9.25in}{7in}% - % - \lispnarrowing = 0.3in - \tolerance = 700 - \hfuzz = 1pt - \contentsrightmargin = 0pt - \defbodyindent = .5cm -}} - -% Use @afourpaper to print on European A4 paper. -\def\afourpaper{{\globaldefs = 1 - \parskip = 3pt plus 2pt minus 1pt - \textleading = 13.2pt - % - % Double-side printing via postscript on Laserjet 4050 - % prints double-sided nicely when \bindingoffset=10mm and \hoffset=-6mm. - % To change the settings for a different printer or situation, adjust - % \normaloffset until the front-side and back-side texts align. Then - % do the same for \bindingoffset. You can set these for testing in - % your texinfo source file like this: - % @tex - % \global\normaloffset = -6mm - % \global\bindingoffset = 10mm - % @end tex - \internalpagesizes{51\baselineskip}{160mm} - {\voffset}{\hoffset}% - {\bindingoffset}{44pt}% - {297mm}{210mm}% - % - \tolerance = 700 - \hfuzz = 1pt - \contentsrightmargin = 0pt - \defbodyindent = 5mm -}} - -% Use @afivepaper to print on European A5 paper. -% From romildo@urano.iceb.ufop.br, 2 July 2000. -% He also recommends making @example and @lisp be small. -\def\afivepaper{{\globaldefs = 1 - \parskip = 2pt plus 1pt minus 0.1pt - \textleading = 12.5pt - % - \internalpagesizes{160mm}{120mm}% - {\voffset}{\hoffset}% - {\bindingoffset}{8pt}% - {210mm}{148mm}% - % - \lispnarrowing = 0.2in - \tolerance = 800 - \hfuzz = 1.2pt - \contentsrightmargin = 0pt - \defbodyindent = 2mm - \tableindent = 12mm -}} - -% A specific text layout, 24x15cm overall, intended for A4 paper. -\def\afourlatex{{\globaldefs = 1 - \afourpaper - \internalpagesizes{237mm}{150mm}% - {\voffset}{4.6mm}% - {\bindingoffset}{7mm}% - {297mm}{210mm}% - % - % Must explicitly reset to 0 because we call \afourpaper. - \globaldefs = 0 -}} - -% Use @afourwide to print on A4 paper in landscape format. -\def\afourwide{{\globaldefs = 1 - \afourpaper - \internalpagesizes{241mm}{165mm}% - {\voffset}{-2.95mm}% - {\bindingoffset}{7mm}% - {297mm}{210mm}% - \globaldefs = 0 -}} - -% @pagesizes TEXTHEIGHT[,TEXTWIDTH] -% Perhaps we should allow setting the margins, \topskip, \parskip, -% and/or leading, also. Or perhaps we should compute them somehow. -% -\parseargdef\pagesizes{\pagesizesyyy #1,,\finish} -\def\pagesizesyyy#1,#2,#3\finish{{% - \setbox0 = \hbox{\ignorespaces #2}\ifdim\wd0 > 0pt \hsize=#2\relax \fi - \globaldefs = 1 - % - \parskip = 3pt plus 2pt minus 1pt - \setleading{\textleading}% - % - \dimen0 = #1 - \advance\dimen0 by \voffset - % - \dimen2 = \hsize - \advance\dimen2 by \normaloffset - % - \internalpagesizes{#1}{\hsize}% - {\voffset}{\normaloffset}% - {\bindingoffset}{44pt}% - {\dimen0}{\dimen2}% -}} - -% Set default to letter. -% -\letterpaper - - -\message{and turning on texinfo input format.} - -% Define macros to output various characters with catcode for normal text. -\catcode`\"=\other -\catcode`\~=\other -\catcode`\^=\other -\catcode`\_=\other -\catcode`\|=\other -\catcode`\<=\other -\catcode`\>=\other -\catcode`\+=\other -\catcode`\$=\other -\def\normaldoublequote{"} -\def\normaltilde{~} -\def\normalcaret{^} -\def\normalunderscore{_} -\def\normalverticalbar{|} -\def\normalless{<} -\def\normalgreater{>} -\def\normalplus{+} -\def\normaldollar{$}%$ font-lock fix - -% This macro is used to make a character print one way in \tt -% (where it can probably be output as-is), and another way in other fonts, -% where something hairier probably needs to be done. -% -% #1 is what to print if we are indeed using \tt; #2 is what to print -% otherwise. Since all the Computer Modern typewriter fonts have zero -% interword stretch (and shrink), and it is reasonable to expect all -% typewriter fonts to have this, we can check that font parameter. -% -\def\ifusingtt#1#2{\ifdim \fontdimen3\font=0pt #1\else #2\fi} - -% Same as above, but check for italic font. Actually this also catches -% non-italic slanted fonts since it is impossible to distinguish them from -% italic fonts. But since this is only used by $ and it uses \sl anyway -% this is not a problem. -\def\ifusingit#1#2{\ifdim \fontdimen1\font>0pt #1\else #2\fi} - -% Turn off all special characters except @ -% (and those which the user can use as if they were ordinary). -% Most of these we simply print from the \tt font, but for some, we can -% use math or other variants that look better in normal text. - -\catcode`\"=\active -\def\activedoublequote{{\tt\char34}} -\let"=\activedoublequote -\catcode`\~=\active -\def~{{\tt\char126}} -\chardef\hat=`\^ -\catcode`\^=\active -\def^{{\tt \hat}} - -\catcode`\_=\active -\def_{\ifusingtt\normalunderscore\_} -% Subroutine for the previous macro. -\def\_{\leavevmode \kern.07em \vbox{\hrule width.3em height.1ex}\kern .07em } - -\catcode`\|=\active -\def|{{\tt\char124}} -\chardef \less=`\< -\catcode`\<=\active -\def<{{\tt \less}} -\chardef \gtr=`\> -\catcode`\>=\active -\def>{{\tt \gtr}} -\catcode`\+=\active -\def+{{\tt \char 43}} -\catcode`\$=\active -\def${\ifusingit{{\sl\$}}\normaldollar}%$ font-lock fix - -% If a .fmt file is being used, characters that might appear in a file -% name cannot be active until we have parsed the command line. -% So turn them off again, and have \everyjob (or @setfilename) turn them on. -% \otherifyactive is called near the end of this file. -\def\otherifyactive{\catcode`+=\other \catcode`\_=\other} - -\catcode`\@=0 - -% \backslashcurfont outputs one backslash character in current font, -% as in \char`\\. -\global\chardef\backslashcurfont=`\\ -\global\let\rawbackslashxx=\backslashcurfont % let existing .??s files work - -% \rawbackslash defines an active \ to do \backslashcurfont. -% \otherbackslash defines an active \ to be a literal `\' character with -% catcode other. -{\catcode`\\=\active - @gdef@rawbackslash{@let\=@backslashcurfont} - @gdef@otherbackslash{@let\=@realbackslash} -} - -% \realbackslash is an actual character `\' with catcode other. -{\catcode`\\=\other @gdef@realbackslash{\}} - -% \normalbackslash outputs one backslash in fixed width font. -\def\normalbackslash{{\tt\backslashcurfont}} - -\catcode`\\=\active - -% Used sometimes to turn off (effectively) the active characters -% even after parsing them. -@def@turnoffactive{% - @let"=@normaldoublequote - @let\=@realbackslash - @let~=@normaltilde - @let^=@normalcaret - @let_=@normalunderscore - @let|=@normalverticalbar - @let<=@normalless - @let>=@normalgreater - @let+=@normalplus - @let$=@normaldollar %$ font-lock fix - @unsepspaces -} - -% Same as @turnoffactive except outputs \ as {\tt\char`\\} instead of -% the literal character `\'. (Thus, \ is not expandable when this is in -% effect.) -% -@def@normalturnoffactive{@turnoffactive @let\=@normalbackslash} - -% Make _ and + \other characters, temporarily. -% This is canceled by @fixbackslash. -@otherifyactive - -% If a .fmt file is being used, we don't want the `\input texinfo' to show up. -% That is what \eatinput is for; after that, the `\' should revert to printing -% a backslash. -% -@gdef@eatinput input texinfo{@fixbackslash} -@global@let\ = @eatinput - -% On the other hand, perhaps the file did not have a `\input texinfo'. Then -% the first `\{ in the file would cause an error. This macro tries to fix -% that, assuming it is called before the first `\' could plausibly occur. -% Also back turn on active characters that might appear in the input -% file name, in case not using a pre-dumped format. -% -@gdef@fixbackslash{% - @ifx\@eatinput @let\ = @normalbackslash @fi - @catcode`+=@active - @catcode`@_=@active -} - -% Say @foo, not \foo, in error messages. -@escapechar = `@@ - -% These look ok in all fonts, so just make them not special. -@catcode`@& = @other -@catcode`@# = @other -@catcode`@% = @other - - -@c Local variables: -@c eval: (add-hook 'write-file-hooks 'time-stamp) -@c page-delimiter: "^\\\\message" -@c time-stamp-start: "def\\\\texinfoversion{" -@c time-stamp-format: "%:y-%02m-%02d.%02H" -@c time-stamp-end: "}" -@c End: - -@c vim:sw=2: - -@ignore - arch-tag: e1b36e32-c96e-4135-a41a-0b2efa2ea115 -@end ignore diff --git a/src/bin/bison/config/ylwrap b/src/bin/bison/config/ylwrap deleted file mode 100644 index f86e217301..0000000000 --- a/src/bin/bison/config/ylwrap +++ /dev/null @@ -1,222 +0,0 @@ -#! /bin/sh -# ylwrap - wrapper for lex/yacc invocations. - -scriptversion=2003-11-18.20 - -# Copyright (C) 1996, 1997, 1998, 1999, 2001, 2002, 2003 -# Free Software Foundation, Inc. -# -# Written by Tom Tromey . -# -# 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 2, 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, write to the Free Software -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - -# As a special exception to the GNU General Public License, if you -# distribute this file as part of a program that contains a -# configuration script generated by Autoconf, you may include it under -# the same distribution terms that you use for the rest of that program. - -# This file is maintained in Automake, please report -# bugs to or send patches to -# . - -case "$1" in - '') - echo "$0: No files given. Try \`$0 --help' for more information." 1>&2 - exit 1 - ;; - --basedir) - basedir=$2 - shift 2 - ;; - -h|--h*) - cat <<\EOF -Usage: ylwrap [--help|--version] INPUT [OUTPUT DESIRED]... -- PROGRAM [ARGS]... - -Wrapper for lex/yacc invocations, renaming files as desired. - - INPUT is the input file - OUTPUT is one file PROG generates - DESIRED is the file we actually want instead of OUTPUT - PROGRAM is program to run - ARGS are passed to PROG - -Any number of OUTPUT,DESIRED pairs may be used. - -Report bugs to . -EOF - exit 0 - ;; - -v|--v*) - echo "ylwrap $scriptversion" - exit 0 - ;; -esac - - -# The input. -input="$1" -shift -case "$input" in - [\\/]* | ?:[\\/]*) - # Absolute path; do nothing. - ;; - *) - # Relative path. Make it absolute. - input="`pwd`/$input" - ;; -esac - -pairlist= -while test "$#" -ne 0; do - if test "$1" = "--"; then - shift - break - fi - pairlist="$pairlist $1" - shift -done - -# The program to run. -prog="$1" -shift -# Make any relative path in $prog absolute. -case "$prog" in - [\\/]* | ?:[\\/]*) ;; - *[\\/]*) prog="`pwd`/$prog" ;; -esac - -# FIXME: add hostname here for parallel makes that run commands on -# other machines. But that might take us over the 14-char limit. -dirname=ylwrap$$ -trap "cd `pwd`; rm -rf $dirname > /dev/null 2>&1" 1 2 3 15 -mkdir $dirname || exit 1 - -cd $dirname - -case $# in - 0) $prog "$input" ;; - *) $prog "$@" "$input" ;; -esac -status=$? - -if test $status -eq 0; then - set X $pairlist - shift - first=yes - # Since DOS filename conventions don't allow two dots, - # the DOS version of Bison writes out y_tab.c instead of y.tab.c - # and y_tab.h instead of y.tab.h. Test to see if this is the case. - y_tab_nodot="no" - if test -f y_tab.c || test -f y_tab.h; then - y_tab_nodot="yes" - fi - - # The directory holding the input. - input_dir=`echo "$input" | sed -e 's,\([\\/]\)[^\\/]*$,\1,'` - # Quote $INPUT_DIR so we can use it in a regexp. - # FIXME: really we should care about more than `.' and `\'. - input_rx=`echo "$input_dir" | sed 's,\\\\,\\\\\\\\,g;s,\\.,\\\\.,g'` - - while test "$#" -ne 0; do - from="$1" - # Handle y_tab.c and y_tab.h output by DOS - if test $y_tab_nodot = "yes"; then - if test $from = "y.tab.c"; then - from="y_tab.c" - else - if test $from = "y.tab.h"; then - from="y_tab.h" - fi - fi - fi - if test -f "$from"; then - # If $2 is an absolute path name, then just use that, - # otherwise prepend `../'. - case "$2" in - [\\/]* | ?:[\\/]*) target="$2";; - *) target="../$2";; - esac - - # We do not want to overwrite a header file if it hasn't - # changed. This avoid useless recompilations. However the - # parser itself (the first file) should always be updated, - # because it is the destination of the .y.c rule in the - # Makefile. Divert the output of all other files to a temporary - # file so we can compare them to existing versions. - if test $first = no; then - realtarget="$target" - target="tmp-`echo $target | sed s/.*[\\/]//g`" - fi - # Edit out `#line' or `#' directives. - # - # We don't want the resulting debug information to point at - # an absolute srcdir; it is better for it to just mention the - # .y file with no path. - # - # We want to use the real output file name, not yy.lex.c for - # instance. - # - # We want the include guards to be adjusted too. - FROM=`echo "$from" | sed \ - -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'\ - -e 's/[^ABCDEFGHIJKLMNOPQRSTUVWXYZ]/_/g'` - TARGET=`echo "$2" | sed \ - -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'\ - -e 's/[^ABCDEFGHIJKLMNOPQRSTUVWXYZ]/_/g'` - - sed -e "/^#/!b" -e "s,$input_rx,," -e "s,$from,$2," \ - -e "s,$FROM,$TARGET," "$from" >"$target" || status=$? - - # Check whether header files must be updated. - if test $first = no; then - if test -f "$realtarget" && cmp -s "$realtarget" "$target"; then - echo "$2" is unchanged - rm -f "$target" - else - echo updating "$2" - mv -f "$target" "$realtarget" - fi - fi - else - # A missing file is only an error for the first file. This - # is a blatant hack to let us support using "yacc -d". If -d - # is not specified, we don't want an error when the header - # file is "missing". - if test $first = yes; then - status=1 - fi - fi - shift - shift - first=no - done -else - status=$? -fi - -# Remove the directory. -cd .. -rm -rf $dirname - -exit $status - -# Local Variables: -# mode: shell-script -# sh-indentation: 2 -# eval: (add-hook 'write-file-hooks 'time-stamp) -# time-stamp-start: "scriptversion=" -# time-stamp-format: "%:y-%02m-%02d.%02H" -# time-stamp-end: "$" -# End: diff --git a/src/bin/bison/configure b/src/bin/bison/configure index dfa5d7ead7..fc5dba981a 100644 --- a/src/bin/bison/configure +++ b/src/bin/bison/configure @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.59 for GNU Bison 1.875d. +# Generated by GNU Autoconf 2.59 for GNU Bison 2.1. # # Report bugs to . # @@ -269,8 +269,8 @@ SHELL=${CONFIG_SHELL-/bin/sh} # Identity of this package. PACKAGE_NAME='GNU Bison' PACKAGE_TARNAME='bison' -PACKAGE_VERSION='1.875d' -PACKAGE_STRING='GNU Bison 1.875d' +PACKAGE_VERSION='2.1' +PACKAGE_STRING='GNU Bison 2.1' PACKAGE_BUGREPORT='bug-bison@gnu.org' # Factoring default headers for most tests. @@ -312,7 +312,7 @@ ac_includes_default="\ gl_header_list= gl_func_list= -ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA CYGPATH_W PACKAGE VERSION ACLOCAL AUTOCONF AUTOMAKE AUTOHEADER MAKEINFO AMTAR install_sh STRIP ac_ct_STRIP INSTALL_STRIP_PROGRAM mkdir_p AWK SET_MAKE am__leading_dot CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT DEPDIR am__include am__quote AMDEP_TRUE AMDEP_FALSE AMDEPBACKSLASH CCDEPMODE am__fastdepCC_TRUE am__fastdepCC_FALSE CPP EGREP WARNING_CFLAGS WERROR_CFLAGS WARNING_CXXFLAGS YACC_SCRIPT YACC_LIBRARY LEX LEXLIB LEX_OUTPUT_ROOT YACC RANLIB ac_ct_RANLIB M4 STDBOOL_H HAVE__BOOL ALLOCA ALLOCA_H LIBOBJS MKINSTALLDIRS USE_NLS MSGFMT GMSGFMT XGETTEXT MSGMERGE build build_cpu build_vendor build_os host host_cpu host_vendor host_os LIBICONV LTLIBICONV INTLLIBS LIBINTL LTLIBINTL POSUB VALGRIND CXX CXXFLAGS ac_ct_CXX CXXDEPMODE am__fastdepCXX_TRUE am__fastdepCXX_FALSE AUTOM4TE GCC O0CFLAGS LTLIBOBJS' +ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA CYGPATH_W PACKAGE VERSION ACLOCAL AUTOCONF AUTOMAKE AUTOHEADER MAKEINFO install_sh STRIP ac_ct_STRIP INSTALL_STRIP_PROGRAM mkdir_p AWK SET_MAKE am__leading_dot AMTAR am__tar am__untar CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT DEPDIR am__include am__quote AMDEP_TRUE AMDEP_FALSE AMDEPBACKSLASH CCDEPMODE am__fastdepCC_TRUE am__fastdepCC_FALSE CPP EGREP WARNING_CFLAGS WERROR_CFLAGS WARNING_CXXFLAGS YACC_SCRIPT YACC_LIBRARY LEX LEXLIB LEX_OUTPUT_ROOT YACC RANLIB ac_ct_RANLIB M4 STDBOOL_H HAVE__BOOL ALLOCA ALLOCA_H LIBOBJS GETOPT_H MKINSTALLDIRS USE_NLS MSGFMT GMSGFMT XGETTEXT MSGMERGE build build_cpu build_vendor build_os host host_cpu host_vendor host_os INTL_MACOSX_LIBS LIBICONV LTLIBICONV INTLLIBS LIBINTL LTLIBINTL POSUB BISON_LOCALEDIR aclocaldir VALGRIND CXX CXXFLAGS ac_ct_CXX CXXDEPMODE am__fastdepCXX_TRUE am__fastdepCXX_FALSE BISON_CXX_WORKS AUTOM4TE GCC O0CFLAGS O0CXXFLAGS LTLIBOBJS' ac_subst_files='' # Initialize some variables set by options. @@ -789,7 +789,7 @@ if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures GNU Bison 1.875d to adapt to many kinds of systems. +\`configure' configures GNU Bison 2.1 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -855,7 +855,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of GNU Bison 1.875d:";; + short | recursive ) echo "Configuration of GNU Bison 2.1:";; esac cat <<\_ACEOF @@ -983,14 +983,14 @@ esac else echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2 fi - cd $ac_popdir + cd "$ac_popdir" done fi test -n "$ac_init_help" && exit 0 if $ac_init_version; then cat <<\_ACEOF -GNU Bison configure 1.875d +GNU Bison configure 2.1 generated by GNU Autoconf 2.59 Copyright (C) 2003 Free Software Foundation, Inc. @@ -1004,7 +1004,7 @@ cat >&5 <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by GNU Bison $as_me 1.875d, which was +It was created by GNU Bison $as_me 2.1, which was generated by GNU Autoconf 2.59. Invocation command line was $ $0 $@ @@ -1322,6 +1322,7 @@ gl_header_list="$gl_header_list wctype.h" gl_func_list="$gl_func_list isascii" gl_func_list="$gl_func_list iswprint" gl_func_list="$gl_func_list mbsinit" +gl_header_list="$gl_header_list unistd.h" @@ -1348,7 +1349,7 @@ gl_func_list="$gl_func_list mbsinit" ac_aux_dir= -for ac_dir in config $srcdir/config; do +for ac_dir in build-aux $srcdir/build-aux; do if test -f $ac_dir/install-sh; then ac_aux_dir=$ac_dir ac_install_sh="$ac_aux_dir/install-sh -c" @@ -1364,8 +1365,8 @@ for ac_dir in config $srcdir/config; do fi done if test -z "$ac_aux_dir"; then - { { echo "$as_me:$LINENO: error: cannot find install-sh or install.sh in config $srcdir/config" >&5 -echo "$as_me: error: cannot find install-sh or install.sh in config $srcdir/config" >&2;} + { { echo "$as_me:$LINENO: error: cannot find install-sh or install.sh in build-aux $srcdir/build-aux" >&5 +echo "$as_me: error: cannot find install-sh or install.sh in build-aux $srcdir/build-aux" >&2;} { (exit 1); exit 1; }; } fi ac_config_guess="$SHELL $ac_aux_dir/config.guess" @@ -1384,7 +1385,8 @@ echo "$as_me: error: cannot find macro directory \`m4'" >&2;} fi -am__api_version="1.8" +# We don't have a file m4/Makefile.am, so we need Automake 1.8 or later. +am__api_version="1.9" # Find a good install program. We prefer a C program (faster), # so one script is as good as another. But avoid the broken or # incompatible versions: @@ -1536,13 +1538,21 @@ echo "$as_me: WARNING: \`missing' script is too old or missing" >&2;} fi if mkdir -p --version . >/dev/null 2>&1 && test ! -d ./--version; then - # Keeping the `.' argument allows $(mkdir_p) to be used without - # argument. Indeed, we sometimes output rules like + # We used to keeping the `.' as first argument, in order to + # allow $(mkdir_p) to be used without argument. As in # $(mkdir_p) $(somedir) - # where $(somedir) is conditionally defined. - # (`test -n '$(somedir)' && $(mkdir_p) $(somedir)' is a more - # expensive solution, as it forces Make to start a sub-shell.) - mkdir_p='mkdir -p -- .' + # where $(somedir) is conditionally defined. However this is wrong + # for two reasons: + # 1. if the package is installed by a user who cannot write `.' + # make install will fail, + # 2. the above comment should most certainly read + # $(mkdir_p) $(DESTDIR)$(somedir) + # so it does not work when $(somedir) is undefined and + # $(DESTDIR) is not. + # To support the latter case, we have to write + # test -z "$(somedir)" || $(mkdir_p) $(DESTDIR)$(somedir), + # so the `.' trick is pointless. + mkdir_p='mkdir -p --' else # On NextStep and OpenStep, the `mkdir' command does not # recognize any option. It will interpret all options as @@ -1658,7 +1668,7 @@ fi # Define the identity of the package. PACKAGE='bison' - VERSION='1.875d' + VERSION='2.1' cat >>confdefs.h <<_ACEOF @@ -1686,9 +1696,6 @@ AUTOHEADER=${AUTOHEADER-"${am_missing_run}autoheader"} MAKEINFO=${MAKEINFO-"${am_missing_run}makeinfo"} - -AMTAR=${AMTAR-"${am_missing_run}tar"} - install_sh=${install_sh-"$am_aux_dir/install-sh"} # Installed binaries are usually stripped using `strip' when the user @@ -1781,6 +1788,13 @@ INSTALL_STRIP_PROGRAM="\${SHELL} \$(install_sh) -c -s" # We need awk for the "check" target. The system "awk" is bad on # some platforms. +# Always define AMTAR for backward compatibility. + +AMTAR=${AMTAR-"${am_missing_run}tar"} + +am__tar='${AMTAR} chof - "$$tardir"'; am__untar='${AMTAR} xf -' + + @@ -2426,8 +2440,7 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -2485,8 +2498,7 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -2602,8 +2614,7 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -2657,8 +2668,7 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -2703,8 +2713,7 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -2748,8 +2757,7 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -3210,8 +3218,7 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -3381,8 +3388,7 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -3445,8 +3451,7 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -3591,6 +3596,10 @@ fi #define __EXTENSIONS__ 1 _ACEOF + cat >>confdefs.h <<\_ACEOF +#define _POSIX_PTHREAD_SEMANTICS 1 +_ACEOF + # Checks for the compiler. @@ -3961,8 +3970,7 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -4020,8 +4028,7 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -4137,8 +4144,7 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -4192,8 +4198,7 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -4238,8 +4243,7 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -4283,8 +4287,7 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -4799,8 +4802,7 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -4858,8 +4860,7 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -4975,8 +4976,7 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -5030,8 +5030,7 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -5076,8 +5075,7 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -5121,8 +5119,7 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -5315,8 +5312,7 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -5372,8 +5368,7 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -5426,8 +5421,7 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -5480,8 +5474,7 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -5534,8 +5527,7 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -5588,8 +5580,7 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -5642,8 +5633,7 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -5699,8 +5689,7 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -5753,8 +5742,7 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -5807,8 +5795,7 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -5861,8 +5848,7 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -5915,8 +5901,7 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -5969,8 +5954,7 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -6101,8 +6085,7 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -6168,8 +6151,7 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -6258,8 +6240,7 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -6524,8 +6505,7 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -6675,7 +6655,7 @@ cat >>conftest.$ac_ext <<_ACEOF "error: false is not 0" #endif #ifndef true - "error: false is not defined" + "error: true is not defined" #endif #if true != 1 "error: true is not 1" @@ -6695,11 +6675,17 @@ cat >>conftest.$ac_ext <<_ACEOF char g[true]; char h[sizeof (_Bool)]; char i[sizeof s.t]; + enum { j = false, k = true, l = false * true, m = true * 256 }; + _Bool n[m]; + char o[sizeof n == m * sizeof n[0] ? 1 : -1]; int main () { - return !a + !b + !c + !d + !e + !f + !g + !h + !i; + + return (!a + !b + !c + !d + !e + !f + !g + !h + !i + !j + !k + !l + + !m + !n + !o); + ; return 0; } @@ -6713,8 +6699,7 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -6769,8 +6754,7 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -6859,8 +6843,7 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -6935,8 +6918,7 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -7043,8 +7025,7 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -7146,8 +7127,7 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -7180,156 +7160,6 @@ _ACEOF fi - -for ac_header in fcntl.h -do -as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` -if eval "test \"\${$as_ac_Header+set}\" = set"; then - echo "$as_me:$LINENO: checking for $ac_header" >&5 -echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 -if eval "test \"\${$as_ac_Header+set}\" = set"; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -fi -echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 -echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 -else - # Is the header compilable? -echo "$as_me:$LINENO: checking $ac_header usability" >&5 -echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6 -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -$ac_includes_default -#include <$ac_header> -_ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_header_compiler=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_header_compiler=no -fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext -echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 -echo "${ECHO_T}$ac_header_compiler" >&6 - -# Is the header present? -echo "$as_me:$LINENO: checking $ac_header presence" >&5 -echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6 -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include <$ac_header> -_ACEOF -if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 - (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } >/dev/null; then - if test -s conftest.err; then - ac_cpp_err=$ac_c_preproc_warn_flag - ac_cpp_err=$ac_cpp_err$ac_c_werror_flag - else - ac_cpp_err= - fi -else - ac_cpp_err=yes -fi -if test -z "$ac_cpp_err"; then - ac_header_preproc=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_header_preproc=no -fi -rm -f conftest.err conftest.$ac_ext -echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 -echo "${ECHO_T}$ac_header_preproc" >&6 - -# So? What about this header? -case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in - yes:no: ) - { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 -echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} - { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5 -echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;} - ac_header_preproc=yes - ;; - no:yes:* ) - { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 -echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} - { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 -echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} - { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5 -echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;} - { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5 -echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;} - { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 -echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} - { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 -echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} - ( - cat <<\_ASBOX -## -------------------------------- ## -## Report this to bug-bison@gnu.org ## -## -------------------------------- ## -_ASBOX - ) | - sed "s/^/$as_me: WARNING: /" >&2 - ;; -esac -echo "$as_me:$LINENO: checking for $ac_header" >&5 -echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 -if eval "test \"\${$as_ac_Header+set}\" = set"; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - eval "$as_ac_Header=\$ac_header_preproc" -fi -echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 -echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 - -fi -if test `eval echo '${'$as_ac_Header'}'` = yes; then - cat >>confdefs.h <<_ACEOF -#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 -_ACEOF - -fi - -done - echo "$as_me:$LINENO: checking for sys/wait.h that is POSIX.1 compatible" >&5 echo $ECHO_N "checking for sys/wait.h that is POSIX.1 compatible... $ECHO_C" >&6 if test "${ac_cv_header_sys_wait_h+set}" = set; then @@ -7369,8 +7199,7 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -7471,8 +7300,7 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -7539,8 +7367,7 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -7725,8 +7552,7 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -8025,8 +7851,7 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -8176,8 +8001,7 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -8278,8 +8102,7 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -8355,8 +8178,7 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -8436,8 +8258,7 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -8517,8 +8338,7 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -8598,8 +8418,7 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -8682,8 +8501,7 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -8757,8 +8575,7 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -8824,8 +8641,7 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -8906,8 +8722,7 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -9048,8 +8863,7 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -9185,8 +8999,7 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -9224,7 +9037,7 @@ echo "${ECHO_T}$ac_cv_win_or_dos" >&6 cat >>confdefs.h <<_ACEOF -#define FILESYSTEM_ACCEPTS_DRIVE_LETTER_PREFIX $ac_fs_accepts_drive_letter_prefix +#define FILE_SYSTEM_ACCEPTS_DRIVE_LETTER_PREFIX $ac_fs_accepts_drive_letter_prefix _ACEOF @@ -9233,7 +9046,7 @@ _ACEOF cat >>confdefs.h <<_ACEOF -#define FILESYSTEM_BACKSLASH_IS_FILE_NAME_SEPARATOR $ac_fs_backslash_is_file_name_separator +#define FILE_SYSTEM_BACKSLASH_IS_FILE_NAME_SEPARATOR $ac_fs_backslash_is_file_name_separator _ACEOF @@ -9269,8 +9082,7 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -9378,8 +9190,7 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -9447,8 +9258,7 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -9529,6 +9339,451 @@ _ACEOF fi + if test -z "$GETOPT_H"; then + +for ac_header in getopt.h +do +as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 +else + # Is the header compilable? +echo "$as_me:$LINENO: checking $ac_header usability" >&5 +echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +#include <$ac_header> +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_header_compiler=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_header_compiler=no +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 +echo "${ECHO_T}$ac_header_compiler" >&6 + +# Is the header present? +echo "$as_me:$LINENO: checking $ac_header presence" >&5 +echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include <$ac_header> +_ACEOF +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + ac_cpp_err=$ac_cpp_err$ac_c_werror_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + ac_header_preproc=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_header_preproc=no +fi +rm -f conftest.err conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 +echo "${ECHO_T}$ac_header_preproc" >&6 + +# So? What about this header? +case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in + yes:no: ) + { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 +echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5 +echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;} + ac_header_preproc=yes + ;; + no:yes:* ) + { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 +echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 +echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5 +echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5 +echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 +echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} + ( + cat <<\_ASBOX +## -------------------------------- ## +## Report this to bug-bison@gnu.org ## +## -------------------------------- ## +_ASBOX + ) | + sed "s/^/$as_me: WARNING: /" >&2 + ;; +esac +echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + eval "$as_ac_Header=\$ac_header_preproc" +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 + +fi +if test `eval echo '${'$as_ac_Header'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + +else + GETOPT_H=getopt.h +fi + +done + + fi + + if test -z "$GETOPT_H"; then + +for ac_func in getopt_long_only +do +as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` +echo "$as_me:$LINENO: checking for $ac_func" >&5 +echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6 +if eval "test \"\${$as_ac_var+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +/* Define $ac_func to an innocuous variant, in case declares $ac_func. + For example, HP-UX 11i declares gettimeofday. */ +#define $ac_func innocuous_$ac_func + +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char $ac_func (); below. + Prefer to if __STDC__ is defined, since + exists even on freestanding compilers. */ + +#ifdef __STDC__ +# include +#else +# include +#endif + +#undef $ac_func + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +{ +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char $ac_func (); +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined (__stub_$ac_func) || defined (__stub___$ac_func) +choke me +#else +char (*f) () = $ac_func; +#endif +#ifdef __cplusplus +} +#endif + +int +main () +{ +return f != $ac_func; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + eval "$as_ac_var=yes" +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +eval "$as_ac_var=no" +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6 +if test `eval echo '${'$as_ac_var'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 +_ACEOF + +else + GETOPT_H=getopt.h +fi +done + + fi + + if test -z "$GETOPT_H"; then + echo "$as_me:$LINENO: checking whether optreset is declared" >&5 +echo $ECHO_N "checking whether optreset is declared... $ECHO_C" >&6 +if test "${ac_cv_have_decl_optreset+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include + +int +main () +{ +#ifndef optreset + char *p = (char *) optreset; +#endif + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_have_decl_optreset=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_have_decl_optreset=no +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_have_decl_optreset" >&5 +echo "${ECHO_T}$ac_cv_have_decl_optreset" >&6 +if test $ac_cv_have_decl_optreset = yes; then + GETOPT_H=getopt.h +fi + + fi + + if test -z "$GETOPT_H"; then + echo "$as_me:$LINENO: checking for working GNU getopt function" >&5 +echo $ECHO_N "checking for working GNU getopt function... $ECHO_C" >&6 +if test "${gl_cv_func_gnu_getopt+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test "$cross_compiling" = yes; then + echo "$as_me:$LINENO: checking whether getopt_clip is declared" >&5 +echo $ECHO_N "checking whether getopt_clip is declared... $ECHO_C" >&6 +if test "${ac_cv_have_decl_getopt_clip+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include + +int +main () +{ +#ifndef getopt_clip + char *p = (char *) getopt_clip; +#endif + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_have_decl_getopt_clip=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_have_decl_getopt_clip=no +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_have_decl_getopt_clip" >&5 +echo "${ECHO_T}$ac_cv_have_decl_getopt_clip" >&6 +if test $ac_cv_have_decl_getopt_clip = yes; then + gl_cv_func_gnu_getopt=no +else + gl_cv_func_gnu_getopt=yes +fi + +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +int +main () +{ + + char *myargv[3]; + myargv[0] = "conftest"; + myargv[1] = "-+"; + myargv[2] = 0; + return getopt (2, myargv, "+a") != '?'; + + ; + return 0; +} +_ACEOF +rm -f conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { ac_try='./conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + gl_cv_func_gnu_getopt=yes +else + echo "$as_me: program exited with status $ac_status" >&5 +echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +( exit $ac_status ) +gl_cv_func_gnu_getopt=no +fi +rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +fi +fi +echo "$as_me:$LINENO: result: $gl_cv_func_gnu_getopt" >&5 +echo "${ECHO_T}$gl_cv_func_gnu_getopt" >&6 + if test "$gl_cv_func_gnu_getopt" = "no"; then + GETOPT_H=getopt.h + fi + fi + + MKINSTALLDIRS= if test -n "$ac_aux_dir"; then case "$ac_aux_dir" in @@ -9605,7 +9860,7 @@ else test -z "$ac_dir" && ac_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $ac_executable_p "$ac_dir/$ac_word$ac_exec_ext"; then - if $ac_dir/$ac_word --statistics /dev/null >/dev/null 2>&1 && + if $ac_dir/$ac_word --statistics /dev/null >&5 2>&1 && (if $ac_dir/$ac_word --statistics /dev/null 2>&1 >/dev/null | grep usage >/dev/null; then exit 1; else exit 0; fi); then ac_cv_path_MSGFMT="$ac_dir/$ac_word$ac_exec_ext" break 2 @@ -9715,7 +9970,7 @@ else test -z "$ac_dir" && ac_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $ac_executable_p "$ac_dir/$ac_word$ac_exec_ext"; then - if $ac_dir/$ac_word --omit-header --copyright-holder= --msgid-bugs-address= /dev/null >/dev/null 2>&1 && + if $ac_dir/$ac_word --omit-header --copyright-holder= --msgid-bugs-address= /dev/null >&5 2>&1 && (if $ac_dir/$ac_word --omit-header --copyright-holder= --msgid-bugs-address= /dev/null 2>&1 >/dev/null | grep usage >/dev/null; then exit 1; else exit 0; fi); then ac_cv_path_XGETTEXT="$ac_dir/$ac_word$ac_exec_ext" break 2 @@ -9786,7 +10041,7 @@ else test -z "$ac_dir" && ac_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $ac_executable_p "$ac_dir/$ac_word$ac_exec_ext"; then - if $ac_dir/$ac_word --update -q /dev/null /dev/null >/dev/null 2>&1; then + if $ac_dir/$ac_word --update -q /dev/null /dev/null >&5 2>&1; then ac_cv_path_MSGMERGE="$ac_dir/$ac_word$ac_exec_ext" break 2 fi @@ -10465,9 +10720,223 @@ fi; - echo "$as_me:$LINENO: checking whether clearerr_unlocked is declared" >&5 -echo $ECHO_N "checking whether clearerr_unlocked is declared... $ECHO_C" >&6 -if test "${ac_cv_have_decl_clearerr_unlocked+set}" = set; then + echo "$as_me:$LINENO: checking for inttypes.h" >&5 +echo $ECHO_N "checking for inttypes.h... $ECHO_C" >&6 +if test "${gl_cv_header_inttypes_h+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +#include +int +main () +{ +uintmax_t i = (uintmax_t) -1; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + gl_cv_header_inttypes_h=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +gl_cv_header_inttypes_h=no +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $gl_cv_header_inttypes_h" >&5 +echo "${ECHO_T}$gl_cv_header_inttypes_h" >&6 + if test $gl_cv_header_inttypes_h = yes; then + +cat >>confdefs.h <<_ACEOF +#define HAVE_INTTYPES_H_WITH_UINTMAX 1 +_ACEOF + + fi + + + echo "$as_me:$LINENO: checking for stdint.h" >&5 +echo $ECHO_N "checking for stdint.h... $ECHO_C" >&6 +if test "${gl_cv_header_stdint_h+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +#include +int +main () +{ +uintmax_t i = (uintmax_t) -1; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + gl_cv_header_stdint_h=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +gl_cv_header_stdint_h=no +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $gl_cv_header_stdint_h" >&5 +echo "${ECHO_T}$gl_cv_header_stdint_h" >&6 + if test $gl_cv_header_stdint_h = yes; then + +cat >>confdefs.h <<_ACEOF +#define HAVE_STDINT_H_WITH_UINTMAX 1 +_ACEOF + + fi + + + echo "$as_me:$LINENO: checking for unsigned long long" >&5 +echo $ECHO_N "checking for unsigned long long... $ECHO_C" >&6 +if test "${ac_cv_type_unsigned_long_long+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +unsigned long long ull = 1ULL; int i = 63; +int +main () +{ +unsigned long long ullmax = (unsigned long long) -1; + return ull << i | ull >> i | ullmax / ull | ullmax % ull; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_type_unsigned_long_long=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_type_unsigned_long_long=no +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_type_unsigned_long_long" >&5 +echo "${ECHO_T}$ac_cv_type_unsigned_long_long" >&6 + if test $ac_cv_type_unsigned_long_long = yes; then + +cat >>confdefs.h <<\_ACEOF +#define HAVE_UNSIGNED_LONG_LONG 1 +_ACEOF + + fi + + + + + if test $gl_cv_header_inttypes_h = no && test $gl_cv_header_stdint_h = no; then + + test $ac_cv_type_unsigned_long_long = yes \ + && ac_type='unsigned long long' \ + || ac_type='unsigned long' + +cat >>confdefs.h <<_ACEOF +#define uintmax_t $ac_type +_ACEOF + + else + +cat >>confdefs.h <<\_ACEOF +#define HAVE_UINTMAX_T 1 +_ACEOF + + fi + + + + + + + + + echo "$as_me:$LINENO: checking whether strdup is declared" >&5 +echo $ECHO_N "checking whether strdup is declared... $ECHO_C" >&6 +if test "${ac_cv_have_decl_strdup+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF @@ -10480,8 +10949,8 @@ $ac_includes_default int main () { -#ifndef clearerr_unlocked - char *p = (char *) clearerr_unlocked; +#ifndef strdup + char *p = (char *) strdup; #endif ; @@ -10497,8 +10966,7 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -10510,27 +10978,27 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - ac_cv_have_decl_clearerr_unlocked=yes + ac_cv_have_decl_strdup=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 -ac_cv_have_decl_clearerr_unlocked=no +ac_cv_have_decl_strdup=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi -echo "$as_me:$LINENO: result: $ac_cv_have_decl_clearerr_unlocked" >&5 -echo "${ECHO_T}$ac_cv_have_decl_clearerr_unlocked" >&6 -if test $ac_cv_have_decl_clearerr_unlocked = yes; then +echo "$as_me:$LINENO: result: $ac_cv_have_decl_strdup" >&5 +echo "${ECHO_T}$ac_cv_have_decl_strdup" >&6 +if test $ac_cv_have_decl_strdup = yes; then cat >>confdefs.h <<_ACEOF -#define HAVE_DECL_CLEARERR_UNLOCKED 1 +#define HAVE_DECL_STRDUP 1 _ACEOF else cat >>confdefs.h <<_ACEOF -#define HAVE_DECL_CLEARERR_UNLOCKED 0 +#define HAVE_DECL_STRDUP 0 _ACEOF @@ -10539,9 +11007,9 @@ fi - echo "$as_me:$LINENO: checking whether feof_unlocked is declared" >&5 -echo $ECHO_N "checking whether feof_unlocked is declared... $ECHO_C" >&6 -if test "${ac_cv_have_decl_feof_unlocked+set}" = set; then + echo "$as_me:$LINENO: checking whether strnlen is declared" >&5 +echo $ECHO_N "checking whether strnlen is declared... $ECHO_C" >&6 +if test "${ac_cv_have_decl_strnlen+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF @@ -10554,8 +11022,8 @@ $ac_includes_default int main () { -#ifndef feof_unlocked - char *p = (char *) feof_unlocked; +#ifndef strnlen + char *p = (char *) strnlen; #endif ; @@ -10571,8 +11039,7 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -10584,27 +11051,27 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - ac_cv_have_decl_feof_unlocked=yes + ac_cv_have_decl_strnlen=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 -ac_cv_have_decl_feof_unlocked=no +ac_cv_have_decl_strnlen=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi -echo "$as_me:$LINENO: result: $ac_cv_have_decl_feof_unlocked" >&5 -echo "${ECHO_T}$ac_cv_have_decl_feof_unlocked" >&6 -if test $ac_cv_have_decl_feof_unlocked = yes; then +echo "$as_me:$LINENO: result: $ac_cv_have_decl_strnlen" >&5 +echo "${ECHO_T}$ac_cv_have_decl_strnlen" >&6 +if test $ac_cv_have_decl_strnlen = yes; then cat >>confdefs.h <<_ACEOF -#define HAVE_DECL_FEOF_UNLOCKED 1 +#define HAVE_DECL_STRNLEN 1 _ACEOF else cat >>confdefs.h <<_ACEOF -#define HAVE_DECL_FEOF_UNLOCKED 0 +#define HAVE_DECL_STRNLEN 0 _ACEOF @@ -10613,819 +11080,6 @@ fi - echo "$as_me:$LINENO: checking whether ferror_unlocked is declared" >&5 -echo $ECHO_N "checking whether ferror_unlocked is declared... $ECHO_C" >&6 -if test "${ac_cv_have_decl_ferror_unlocked+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -$ac_includes_default -int -main () -{ -#ifndef ferror_unlocked - char *p = (char *) ferror_unlocked; -#endif - - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_have_decl_ferror_unlocked=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_cv_have_decl_ferror_unlocked=no -fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext -fi -echo "$as_me:$LINENO: result: $ac_cv_have_decl_ferror_unlocked" >&5 -echo "${ECHO_T}$ac_cv_have_decl_ferror_unlocked" >&6 -if test $ac_cv_have_decl_ferror_unlocked = yes; then - -cat >>confdefs.h <<_ACEOF -#define HAVE_DECL_FERROR_UNLOCKED 1 -_ACEOF - - -else - cat >>confdefs.h <<_ACEOF -#define HAVE_DECL_FERROR_UNLOCKED 0 -_ACEOF - - -fi - - - - - echo "$as_me:$LINENO: checking whether fflush_unlocked is declared" >&5 -echo $ECHO_N "checking whether fflush_unlocked is declared... $ECHO_C" >&6 -if test "${ac_cv_have_decl_fflush_unlocked+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -$ac_includes_default -int -main () -{ -#ifndef fflush_unlocked - char *p = (char *) fflush_unlocked; -#endif - - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_have_decl_fflush_unlocked=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_cv_have_decl_fflush_unlocked=no -fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext -fi -echo "$as_me:$LINENO: result: $ac_cv_have_decl_fflush_unlocked" >&5 -echo "${ECHO_T}$ac_cv_have_decl_fflush_unlocked" >&6 -if test $ac_cv_have_decl_fflush_unlocked = yes; then - -cat >>confdefs.h <<_ACEOF -#define HAVE_DECL_FFLUSH_UNLOCKED 1 -_ACEOF - - -else - cat >>confdefs.h <<_ACEOF -#define HAVE_DECL_FFLUSH_UNLOCKED 0 -_ACEOF - - -fi - - - - - echo "$as_me:$LINENO: checking whether fgets_unlocked is declared" >&5 -echo $ECHO_N "checking whether fgets_unlocked is declared... $ECHO_C" >&6 -if test "${ac_cv_have_decl_fgets_unlocked+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -$ac_includes_default -int -main () -{ -#ifndef fgets_unlocked - char *p = (char *) fgets_unlocked; -#endif - - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_have_decl_fgets_unlocked=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_cv_have_decl_fgets_unlocked=no -fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext -fi -echo "$as_me:$LINENO: result: $ac_cv_have_decl_fgets_unlocked" >&5 -echo "${ECHO_T}$ac_cv_have_decl_fgets_unlocked" >&6 -if test $ac_cv_have_decl_fgets_unlocked = yes; then - -cat >>confdefs.h <<_ACEOF -#define HAVE_DECL_FGETS_UNLOCKED 1 -_ACEOF - - -else - cat >>confdefs.h <<_ACEOF -#define HAVE_DECL_FGETS_UNLOCKED 0 -_ACEOF - - -fi - - - - - echo "$as_me:$LINENO: checking whether fputc_unlocked is declared" >&5 -echo $ECHO_N "checking whether fputc_unlocked is declared... $ECHO_C" >&6 -if test "${ac_cv_have_decl_fputc_unlocked+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -$ac_includes_default -int -main () -{ -#ifndef fputc_unlocked - char *p = (char *) fputc_unlocked; -#endif - - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_have_decl_fputc_unlocked=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_cv_have_decl_fputc_unlocked=no -fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext -fi -echo "$as_me:$LINENO: result: $ac_cv_have_decl_fputc_unlocked" >&5 -echo "${ECHO_T}$ac_cv_have_decl_fputc_unlocked" >&6 -if test $ac_cv_have_decl_fputc_unlocked = yes; then - -cat >>confdefs.h <<_ACEOF -#define HAVE_DECL_FPUTC_UNLOCKED 1 -_ACEOF - - -else - cat >>confdefs.h <<_ACEOF -#define HAVE_DECL_FPUTC_UNLOCKED 0 -_ACEOF - - -fi - - - - - echo "$as_me:$LINENO: checking whether fputs_unlocked is declared" >&5 -echo $ECHO_N "checking whether fputs_unlocked is declared... $ECHO_C" >&6 -if test "${ac_cv_have_decl_fputs_unlocked+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -$ac_includes_default -int -main () -{ -#ifndef fputs_unlocked - char *p = (char *) fputs_unlocked; -#endif - - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_have_decl_fputs_unlocked=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_cv_have_decl_fputs_unlocked=no -fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext -fi -echo "$as_me:$LINENO: result: $ac_cv_have_decl_fputs_unlocked" >&5 -echo "${ECHO_T}$ac_cv_have_decl_fputs_unlocked" >&6 -if test $ac_cv_have_decl_fputs_unlocked = yes; then - -cat >>confdefs.h <<_ACEOF -#define HAVE_DECL_FPUTS_UNLOCKED 1 -_ACEOF - - -else - cat >>confdefs.h <<_ACEOF -#define HAVE_DECL_FPUTS_UNLOCKED 0 -_ACEOF - - -fi - - - - - echo "$as_me:$LINENO: checking whether fread_unlocked is declared" >&5 -echo $ECHO_N "checking whether fread_unlocked is declared... $ECHO_C" >&6 -if test "${ac_cv_have_decl_fread_unlocked+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -$ac_includes_default -int -main () -{ -#ifndef fread_unlocked - char *p = (char *) fread_unlocked; -#endif - - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_have_decl_fread_unlocked=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_cv_have_decl_fread_unlocked=no -fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext -fi -echo "$as_me:$LINENO: result: $ac_cv_have_decl_fread_unlocked" >&5 -echo "${ECHO_T}$ac_cv_have_decl_fread_unlocked" >&6 -if test $ac_cv_have_decl_fread_unlocked = yes; then - -cat >>confdefs.h <<_ACEOF -#define HAVE_DECL_FREAD_UNLOCKED 1 -_ACEOF - - -else - cat >>confdefs.h <<_ACEOF -#define HAVE_DECL_FREAD_UNLOCKED 0 -_ACEOF - - -fi - - - - - echo "$as_me:$LINENO: checking whether fwrite_unlocked is declared" >&5 -echo $ECHO_N "checking whether fwrite_unlocked is declared... $ECHO_C" >&6 -if test "${ac_cv_have_decl_fwrite_unlocked+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -$ac_includes_default -int -main () -{ -#ifndef fwrite_unlocked - char *p = (char *) fwrite_unlocked; -#endif - - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_have_decl_fwrite_unlocked=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_cv_have_decl_fwrite_unlocked=no -fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext -fi -echo "$as_me:$LINENO: result: $ac_cv_have_decl_fwrite_unlocked" >&5 -echo "${ECHO_T}$ac_cv_have_decl_fwrite_unlocked" >&6 -if test $ac_cv_have_decl_fwrite_unlocked = yes; then - -cat >>confdefs.h <<_ACEOF -#define HAVE_DECL_FWRITE_UNLOCKED 1 -_ACEOF - - -else - cat >>confdefs.h <<_ACEOF -#define HAVE_DECL_FWRITE_UNLOCKED 0 -_ACEOF - - -fi - - - - - echo "$as_me:$LINENO: checking whether getc_unlocked is declared" >&5 -echo $ECHO_N "checking whether getc_unlocked is declared... $ECHO_C" >&6 -if test "${ac_cv_have_decl_getc_unlocked+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -$ac_includes_default -int -main () -{ -#ifndef getc_unlocked - char *p = (char *) getc_unlocked; -#endif - - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_have_decl_getc_unlocked=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_cv_have_decl_getc_unlocked=no -fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext -fi -echo "$as_me:$LINENO: result: $ac_cv_have_decl_getc_unlocked" >&5 -echo "${ECHO_T}$ac_cv_have_decl_getc_unlocked" >&6 -if test $ac_cv_have_decl_getc_unlocked = yes; then - -cat >>confdefs.h <<_ACEOF -#define HAVE_DECL_GETC_UNLOCKED 1 -_ACEOF - - -else - cat >>confdefs.h <<_ACEOF -#define HAVE_DECL_GETC_UNLOCKED 0 -_ACEOF - - -fi - - - - - echo "$as_me:$LINENO: checking whether getchar_unlocked is declared" >&5 -echo $ECHO_N "checking whether getchar_unlocked is declared... $ECHO_C" >&6 -if test "${ac_cv_have_decl_getchar_unlocked+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -$ac_includes_default -int -main () -{ -#ifndef getchar_unlocked - char *p = (char *) getchar_unlocked; -#endif - - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_have_decl_getchar_unlocked=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_cv_have_decl_getchar_unlocked=no -fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext -fi -echo "$as_me:$LINENO: result: $ac_cv_have_decl_getchar_unlocked" >&5 -echo "${ECHO_T}$ac_cv_have_decl_getchar_unlocked" >&6 -if test $ac_cv_have_decl_getchar_unlocked = yes; then - -cat >>confdefs.h <<_ACEOF -#define HAVE_DECL_GETCHAR_UNLOCKED 1 -_ACEOF - - -else - cat >>confdefs.h <<_ACEOF -#define HAVE_DECL_GETCHAR_UNLOCKED 0 -_ACEOF - - -fi - - - - - echo "$as_me:$LINENO: checking whether putc_unlocked is declared" >&5 -echo $ECHO_N "checking whether putc_unlocked is declared... $ECHO_C" >&6 -if test "${ac_cv_have_decl_putc_unlocked+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -$ac_includes_default -int -main () -{ -#ifndef putc_unlocked - char *p = (char *) putc_unlocked; -#endif - - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_have_decl_putc_unlocked=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_cv_have_decl_putc_unlocked=no -fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext -fi -echo "$as_me:$LINENO: result: $ac_cv_have_decl_putc_unlocked" >&5 -echo "${ECHO_T}$ac_cv_have_decl_putc_unlocked" >&6 -if test $ac_cv_have_decl_putc_unlocked = yes; then - -cat >>confdefs.h <<_ACEOF -#define HAVE_DECL_PUTC_UNLOCKED 1 -_ACEOF - - -else - cat >>confdefs.h <<_ACEOF -#define HAVE_DECL_PUTC_UNLOCKED 0 -_ACEOF - - -fi - - - - - echo "$as_me:$LINENO: checking whether putchar_unlocked is declared" >&5 -echo $ECHO_N "checking whether putchar_unlocked is declared... $ECHO_C" >&6 -if test "${ac_cv_have_decl_putchar_unlocked+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -$ac_includes_default -int -main () -{ -#ifndef putchar_unlocked - char *p = (char *) putchar_unlocked; -#endif - - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_have_decl_putchar_unlocked=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_cv_have_decl_putchar_unlocked=no -fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext -fi -echo "$as_me:$LINENO: result: $ac_cv_have_decl_putchar_unlocked" >&5 -echo "${ECHO_T}$ac_cv_have_decl_putchar_unlocked" >&6 -if test $ac_cv_have_decl_putchar_unlocked = yes; then - -cat >>confdefs.h <<_ACEOF -#define HAVE_DECL_PUTCHAR_UNLOCKED 1 -_ACEOF - - -else - cat >>confdefs.h <<_ACEOF -#define HAVE_DECL_PUTCHAR_UNLOCKED 0 -_ACEOF - - -fi - - - @@ -11478,6 +11132,16 @@ _ACEOF + case $LIBOBJS in + "dirname.$ac_objext" | \ + *" dirname.$ac_objext" | \ + "dirname.$ac_objext "* | \ + *" dirname.$ac_objext "* ) ;; + *) LIBOBJS="$LIBOBJS dirname.$ac_objext" ;; +esac + + + @@ -11511,8 +11175,7 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -11555,9 +11218,14 @@ fi - : - + case $LIBOBJS in + "exitfail.$ac_objext" | \ + *" exitfail.$ac_objext" | \ + "exitfail.$ac_objext "* | \ + *" exitfail.$ac_objext "* ) ;; + *) LIBOBJS="$LIBOBJS exitfail.$ac_objext" ;; +esac : @@ -11566,6 +11234,36 @@ fi + if test -n "$GETOPT_H"; then + + case $LIBOBJS in + "getopt.$ac_objext" | \ + *" getopt.$ac_objext" | \ + "getopt.$ac_objext "* | \ + *" getopt.$ac_objext "* ) ;; + *) LIBOBJS="$LIBOBJS getopt.$ac_objext" ;; +esac + + case $LIBOBJS in + "getopt1.$ac_objext" | \ + *" getopt1.$ac_objext" | \ + "getopt1.$ac_objext "* | \ + *" getopt1.$ac_objext "* ) ;; + *) LIBOBJS="$LIBOBJS getopt1.$ac_objext" ;; +esac + + + GETOPT_H=getopt.h + +cat >>confdefs.h <<\_ACEOF +#define __GETOPT_PREFIX rpl_ +_ACEOF + + + + : + +fi @@ -11579,6 +11277,152 @@ fi + + + + + + + echo "$as_me:$LINENO: checking for CFPreferencesCopyAppValue" >&5 +echo $ECHO_N "checking for CFPreferencesCopyAppValue... $ECHO_C" >&6 +if test "${gt_cv_func_CFPreferencesCopyAppValue+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + gt_save_CPPFLAGS="$CPPFLAGS" + CPPFLAGS="$CPPFLAGS -I/System/Library/Frameworks/CoreFoundation.framework/Headers" + gt_save_LIBS="$LIBS" + LIBS="$LIBS -framework CoreFoundation" + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +int +main () +{ +CFPreferencesCopyAppValue(NULL, NULL) + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + gt_cv_func_CFPreferencesCopyAppValue=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +gt_cv_func_CFPreferencesCopyAppValue=no +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + CPPFLAGS="$gt_save_CPPFLAGS" + LIBS="$gt_save_LIBS" +fi +echo "$as_me:$LINENO: result: $gt_cv_func_CFPreferencesCopyAppValue" >&5 +echo "${ECHO_T}$gt_cv_func_CFPreferencesCopyAppValue" >&6 + if test $gt_cv_func_CFPreferencesCopyAppValue = yes; then + +cat >>confdefs.h <<\_ACEOF +#define HAVE_CFPREFERENCESCOPYAPPVALUE 1 +_ACEOF + + fi + echo "$as_me:$LINENO: checking for CFLocaleCopyCurrent" >&5 +echo $ECHO_N "checking for CFLocaleCopyCurrent... $ECHO_C" >&6 +if test "${gt_cv_func_CFLocaleCopyCurrent+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + gt_save_CPPFLAGS="$CPPFLAGS" + CPPFLAGS="$CPPFLAGS -I/System/Library/Frameworks/CoreFoundation.framework/Headers" + gt_save_LIBS="$LIBS" + LIBS="$LIBS -framework CoreFoundation" + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +int +main () +{ +CFLocaleCopyCurrent(); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + gt_cv_func_CFLocaleCopyCurrent=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +gt_cv_func_CFLocaleCopyCurrent=no +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + CPPFLAGS="$gt_save_CPPFLAGS" + LIBS="$gt_save_LIBS" +fi +echo "$as_me:$LINENO: result: $gt_cv_func_CFLocaleCopyCurrent" >&5 +echo "${ECHO_T}$gt_cv_func_CFLocaleCopyCurrent" >&6 + if test $gt_cv_func_CFLocaleCopyCurrent = yes; then + +cat >>confdefs.h <<\_ACEOF +#define HAVE_CFLOCALECOPYCURRENT 1 +_ACEOF + + fi + INTL_MACOSX_LIBS= + if test $gt_cv_func_CFPreferencesCopyAppValue = yes || test $gt_cv_func_CFLocaleCopyCurrent = yes; then + INTL_MACOSX_LIBS="-Wl,-framework -Wl,CoreFoundation" + fi + + + + echo "$as_me:$LINENO: checking whether NLS is requested" >&5 echo $ECHO_N "checking whether NLS is requested... $ECHO_C" >&6 # Check whether --enable-nls or --disable-nls was given. @@ -11624,7 +11468,7 @@ int main () { bindtextdomain ("", ""); -return (int) gettext ("") + _nl_msg_cat_cntr + *_nl_domain_bindings +return * gettext ("") + _nl_msg_cat_cntr + *_nl_domain_bindings ; return 0; } @@ -11638,8 +11482,7 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -11730,8 +11573,7 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -11781,8 +11623,7 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -12229,12 +12070,12 @@ extern #ifdef __cplusplus "C" #endif -const char *_nl_expand_alias (); +const char *_nl_expand_alias (const char *); int main () { bindtextdomain ("", ""); -return (int) gettext ("") + _nl_msg_cat_cntr + *_nl_expand_alias (0) +return * gettext ("") + _nl_msg_cat_cntr + *_nl_expand_alias ("") ; return 0; } @@ -12248,8 +12089,7 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -12284,12 +12124,12 @@ extern #ifdef __cplusplus "C" #endif -const char *_nl_expand_alias (); +const char *_nl_expand_alias (const char *); int main () { bindtextdomain ("", ""); -return (int) gettext ("") + _nl_msg_cat_cntr + *_nl_expand_alias (0) +return * gettext ("") + _nl_msg_cat_cntr + *_nl_expand_alias ("") ; return 0; } @@ -12303,8 +12143,7 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -12348,6 +12187,14 @@ echo "${ECHO_T}$gt_cv_func_gnugettext1_libintl" >&6 + if test -n "$INTL_MACOSX_LIBS"; then + if test "$gt_use_preinstalled_gnugettext" = "yes" \ + || test "$nls_cv_use_gnu_gettext" = "yes"; then + LIBINTL="$LIBINTL $INTL_MACOSX_LIBS" + LTLIBINTL="$LTLIBINTL $INTL_MACOSX_LIBS" + fi + fi + if test "$gt_use_preinstalled_gnugettext" = "yes" \ || test "$nls_cv_use_gnu_gettext" = "yes"; then @@ -12440,19 +12287,26 @@ _ACEOF - : - - - - - - - : + + case $LIBOBJS in + "hard-locale.$ac_objext" | \ + *" hard-locale.$ac_objext" | \ + "hard-locale.$ac_objext "* | \ + *" hard-locale.$ac_objext "* ) ;; + *) LIBOBJS="$LIBOBJS hard-locale.$ac_objext" ;; +esac + case $LIBOBJS in + "hash.$ac_objext" | \ + *" hash.$ac_objext" | \ + "hash.$ac_objext "* | \ + *" hash.$ac_objext "* ) ;; + *) LIBOBJS="$LIBOBJS hash.$ac_objext" ;; +esac @@ -12493,8 +12347,7 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -12785,8 +12638,7 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -12819,7 +12671,7 @@ fi done - echo "$as_me:$LINENO: checking whether mbrtowc and mbstate_t are properly declared" >&5 + echo "$as_me:$LINENO: checking whether mbrtowc and mbstate_t are properly declared" >&5 echo $ECHO_N "checking whether mbrtowc and mbstate_t are properly declared... $ECHO_C" >&6 if test "${gl_cv_func_mbrtowc+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 @@ -12834,7 +12686,11 @@ cat >>conftest.$ac_ext <<_ACEOF int main () { -mbstate_t state; return ! (sizeof state && mbrtowc); +wchar_t wc; + char const s[] = ""; + size_t n = 1; + mbstate_t state; + return ! (sizeof state && (mbrtowc) (&wc, s, n, &state)); ; return 0; } @@ -12848,8 +12704,7 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -12923,8 +12778,7 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -12993,8 +12847,7 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -13058,8 +12911,7 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -13127,8 +12979,7 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -13170,12 +13021,37 @@ esac fi if test $ac_cv_func_obstack = no; then - : + + + + + : + fi + case $LIBOBJS in + "quote.$ac_objext" | \ + *" quote.$ac_objext" | \ + "quote.$ac_objext "* | \ + *" quote.$ac_objext "* ) ;; + *) LIBOBJS="$LIBOBJS quote.$ac_objext" ;; +esac + + + + + + + case $LIBOBJS in + "quotearg.$ac_objext" | \ + *" quotearg.$ac_objext" | \ + "quotearg.$ac_objext "* | \ + *" quotearg.$ac_objext "* ) ;; + *) LIBOBJS="$LIBOBJS quotearg.$ac_objext" ;; +esac @@ -13228,8 +13104,7 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -13266,7 +13141,7 @@ _ACEOF fi - echo "$as_me:$LINENO: checking whether mbrtowc and mbstate_t are properly declared" >&5 + echo "$as_me:$LINENO: checking whether mbrtowc and mbstate_t are properly declared" >&5 echo $ECHO_N "checking whether mbrtowc and mbstate_t are properly declared... $ECHO_C" >&6 if test "${gl_cv_func_mbrtowc+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 @@ -13281,7 +13156,11 @@ cat >>conftest.$ac_ext <<_ACEOF int main () { -mbstate_t state; return ! (sizeof state && mbrtowc); +wchar_t wc; + char const s[] = ""; + size_t n = 1; + mbstate_t state; + return ! (sizeof state && (mbrtowc) (&wc, s, n, &state)); ; return 0; } @@ -13295,8 +13174,7 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -13331,238 +13209,6 @@ _ACEOF -for ac_header in stdlib.h -do -as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` -if eval "test \"\${$as_ac_Header+set}\" = set"; then - echo "$as_me:$LINENO: checking for $ac_header" >&5 -echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 -if eval "test \"\${$as_ac_Header+set}\" = set"; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -fi -echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 -echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 -else - # Is the header compilable? -echo "$as_me:$LINENO: checking $ac_header usability" >&5 -echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6 -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -$ac_includes_default -#include <$ac_header> -_ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_header_compiler=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_header_compiler=no -fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext -echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 -echo "${ECHO_T}$ac_header_compiler" >&6 - -# Is the header present? -echo "$as_me:$LINENO: checking $ac_header presence" >&5 -echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6 -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include <$ac_header> -_ACEOF -if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 - (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } >/dev/null; then - if test -s conftest.err; then - ac_cpp_err=$ac_c_preproc_warn_flag - ac_cpp_err=$ac_cpp_err$ac_c_werror_flag - else - ac_cpp_err= - fi -else - ac_cpp_err=yes -fi -if test -z "$ac_cpp_err"; then - ac_header_preproc=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_header_preproc=no -fi -rm -f conftest.err conftest.$ac_ext -echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 -echo "${ECHO_T}$ac_header_preproc" >&6 - -# So? What about this header? -case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in - yes:no: ) - { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 -echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} - { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5 -echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;} - ac_header_preproc=yes - ;; - no:yes:* ) - { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 -echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} - { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 -echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} - { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5 -echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;} - { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5 -echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;} - { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 -echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} - { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 -echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} - ( - cat <<\_ASBOX -## -------------------------------- ## -## Report this to bug-bison@gnu.org ## -## -------------------------------- ## -_ASBOX - ) | - sed "s/^/$as_me: WARNING: /" >&2 - ;; -esac -echo "$as_me:$LINENO: checking for $ac_header" >&5 -echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 -if eval "test \"\${$as_ac_Header+set}\" = set"; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - eval "$as_ac_Header=\$ac_header_preproc" -fi -echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 -echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 - -fi -if test `eval echo '${'$as_ac_Header'}'` = yes; then - cat >>confdefs.h <<_ACEOF -#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 -_ACEOF - -fi - -done - -echo "$as_me:$LINENO: checking for GNU libc compatible realloc" >&5 -echo $ECHO_N "checking for GNU libc compatible realloc... $ECHO_C" >&6 -if test "${ac_cv_func_realloc_0_nonnull+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test "$cross_compiling" = yes; then - ac_cv_func_realloc_0_nonnull=no -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#if STDC_HEADERS || HAVE_STDLIB_H -# include -#else -char *realloc (); -#endif - -int -main () -{ -exit (realloc (0, 0) ? 0 : 1); - ; - return 0; -} -_ACEOF -rm -f conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { ac_try='./conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_func_realloc_0_nonnull=yes -else - echo "$as_me: program exited with status $ac_status" >&5 -echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -( exit $ac_status ) -ac_cv_func_realloc_0_nonnull=no -fi -rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext -fi -fi -echo "$as_me:$LINENO: result: $ac_cv_func_realloc_0_nonnull" >&5 -echo "${ECHO_T}$ac_cv_func_realloc_0_nonnull" >&6 -if test $ac_cv_func_realloc_0_nonnull = yes; then - -cat >>confdefs.h <<\_ACEOF -#define HAVE_REALLOC 1 -_ACEOF - -else - cat >>confdefs.h <<\_ACEOF -#define HAVE_REALLOC 0 -_ACEOF - - case $LIBOBJS in - "realloc.$ac_objext" | \ - *" realloc.$ac_objext" | \ - "realloc.$ac_objext "* | \ - *" realloc.$ac_objext "* ) ;; - *) LIBOBJS="$LIBOBJS realloc.$ac_objext" ;; -esac - - -cat >>confdefs.h <<\_ACEOF -#define realloc rpl_realloc -_ACEOF - -fi - - - - - # Define two additional variables used in the Makefile substitution. @@ -13584,6 +13230,26 @@ fi + case $LIBOBJS in + "fopen-safer.$ac_objext" | \ + *" fopen-safer.$ac_objext" | \ + "fopen-safer.$ac_objext "* | \ + *" fopen-safer.$ac_objext "* ) ;; + *) LIBOBJS="$LIBOBJS fopen-safer.$ac_objext" ;; +esac + + + + : + + + + + + + + + for ac_func in stpcpy @@ -13654,8 +13320,7 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -13708,6 +13373,132 @@ done +for ac_func in strdup +do +as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` +echo "$as_me:$LINENO: checking for $ac_func" >&5 +echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6 +if eval "test \"\${$as_ac_var+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +/* Define $ac_func to an innocuous variant, in case declares $ac_func. + For example, HP-UX 11i declares gettimeofday. */ +#define $ac_func innocuous_$ac_func + +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char $ac_func (); below. + Prefer to if __STDC__ is defined, since + exists even on freestanding compilers. */ + +#ifdef __STDC__ +# include +#else +# include +#endif + +#undef $ac_func + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +{ +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char $ac_func (); +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined (__stub_$ac_func) || defined (__stub___$ac_func) +choke me +#else +char (*f) () = $ac_func; +#endif +#ifdef __cplusplus +} +#endif + +int +main () +{ +return f != $ac_func; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + eval "$as_ac_var=yes" +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +eval "$as_ac_var=no" +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6 +if test `eval echo '${'$as_ac_var'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 +_ACEOF + +else + case $LIBOBJS in + "$ac_func.$ac_objext" | \ + *" $ac_func.$ac_objext" | \ + "$ac_func.$ac_objext "* | \ + *" $ac_func.$ac_objext "* ) ;; + *) LIBOBJS="$LIBOBJS $ac_func.$ac_objext" ;; +esac + +fi +done + + + + : + + + + + + : + + + + + + + + for ac_func in strndup do as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` @@ -13776,8 +13567,7 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -13820,86 +13610,15 @@ done if test $ac_cv_func_strndup = no; then - - echo "$as_me:$LINENO: checking whether strnlen is declared" >&5 -echo $ECHO_N "checking whether strnlen is declared... $ECHO_C" >&6 -if test "${ac_cv_have_decl_strnlen+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -$ac_includes_default -int -main () -{ -#ifndef strnlen - char *p = (char *) strnlen; -#endif - - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_have_decl_strnlen=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_cv_have_decl_strnlen=no -fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext -fi -echo "$as_me:$LINENO: result: $ac_cv_have_decl_strnlen" >&5 -echo "${ECHO_T}$ac_cv_have_decl_strnlen" >&6 -if test $ac_cv_have_decl_strnlen = yes; then - -cat >>confdefs.h <<_ACEOF -#define HAVE_DECL_STRNLEN 1 -_ACEOF - - -else - cat >>confdefs.h <<_ACEOF -#define HAVE_DECL_STRNLEN 0 -_ACEOF - - -fi - - - + : fi + + echo "$as_me:$LINENO: checking for working strnlen" >&5 echo $ECHO_N "checking for working strnlen... $ECHO_C" >&6 if test "${ac_cv_func_strnlen_working+set}" = set; then @@ -13982,12 +13701,45 @@ cat >>confdefs.h <<\_ACEOF #define strnlen rpl_strnlen _ACEOF - : + + + : + + + + + + fi + case $LIBOBJS in + "dup-safer.$ac_objext" | \ + *" dup-safer.$ac_objext" | \ + "dup-safer.$ac_objext "* | \ + *" dup-safer.$ac_objext "* ) ;; + *) LIBOBJS="$LIBOBJS dup-safer.$ac_objext" ;; +esac + + case $LIBOBJS in + "fd-safer.$ac_objext" | \ + *" fd-safer.$ac_objext" | \ + "fd-safer.$ac_objext "* | \ + *" fd-safer.$ac_objext "* ) ;; + *) LIBOBJS="$LIBOBJS fd-safer.$ac_objext" ;; +esac + + case $LIBOBJS in + "pipe-safer.$ac_objext" | \ + *" pipe-safer.$ac_objext" | \ + "pipe-safer.$ac_objext "* | \ + *" pipe-safer.$ac_objext "* ) ;; + *) LIBOBJS="$LIBOBJS pipe-safer.$ac_objext" ;; +esac + + : @@ -13999,56 +13751,36 @@ _ACEOF - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - : - : + + + + + + case $LIBOBJS in + "xmalloc.$ac_objext" | \ + *" xmalloc.$ac_objext" | \ + "xmalloc.$ac_objext "* | \ + *" xmalloc.$ac_objext "* ) ;; + *) LIBOBJS="$LIBOBJS xmalloc.$ac_objext" ;; +esac + : + : + + + + : @@ -14056,6 +13788,60 @@ _ACEOF +# We use po/Makevars, so we need at least gettext 0.12. + + + if test -z "$USE_NLS"; then + echo "The BISON-I18N macro is used without being preceded by AM-GNU-GETTEXT." 1>&2 + exit 1 + fi + BISON_LOCALEDIR= + if test "$USE_NLS" = yes; then + if test -n "$YACC"; then + case "$YACC" in + *bison*) + if ($YACC --print-localedir) >/dev/null 2>&1; then + BISON_LOCALEDIR=`$YACC --print-localedir` + fi + ;; + esac + else + if test -n "$BISON"; then + if test "$BISON" != ":"; then + if ($BISON --print-localedir) >/dev/null 2>&1; then + BISON_LOCALEDIR=`$BISON --print-localedir` + fi + fi + fi + fi + + if test -n "$BISON_LOCALEDIR"; then + USER_LINGUAS="${LINGUAS-%UNSET%}" + if test -n "$USER_LINGUAS"; then + BISON_USE_NLS=yes + else + BISON_USE_NLS=no + fi + else + BISON_USE_NLS=no + fi + else + BISON_USE_NLS=no + fi + if test $BISON_USE_NLS = yes; then + +cat >>confdefs.h <<\_ACEOF +#define YYENABLE_NLS 1 +_ACEOF + + fi + + +# Internationalized parsers. + ac_config_files="$ac_config_files runtime-po/Makefile.in" + +# Autoconf macros for packages using internationalized parsers. +aclocaldir='${datadir}/aclocal' # Initialize the test suite. @@ -14251,8 +14037,7 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -z "$ac_cxx_werror_flag" - || test ! -s conftest.err' + { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -14310,8 +14095,7 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -z "$ac_cxx_werror_flag" - || test ! -s conftest.err' + { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -14382,8 +14166,7 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -z "$ac_cxx_werror_flag" - || test ! -s conftest.err' + { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -14427,8 +14210,7 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -z "$ac_cxx_werror_flag" - || test ! -s conftest.err' + { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -14571,14 +14353,90 @@ fi + + echo "$as_me:$LINENO: checking whether $CXX builds executables that work" >&5 +echo $ECHO_N "checking whether $CXX builds executables that work... $ECHO_C" >&6 +if test "${bison_cv_cxx_works+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_ext=cc +ac_cpp='$CXXCPP $CPPFLAGS' +ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_cxx_compiler_gnu + + if test "$cross_compiling" = yes; then + bison_cv_cxx_works=cross +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include + using namespace std; +int +main () +{ +std::cerr << ""; + cout << ""; + ; + return 0; +} +_ACEOF +rm -f conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { ac_try='./conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + bison_cv_cxx_works=yes +else + echo "$as_me: program exited with status $ac_status" >&5 +echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +( exit $ac_status ) +bison_cv_cxx_works=no +fi +rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +fi + ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + +fi +echo "$as_me:$LINENO: result: $bison_cv_cxx_works" >&5 +echo "${ECHO_T}$bison_cv_cxx_works" >&6 + + case $bison_cv_cxx_works in + yes) + BISON_CXX_WORKS=':';; + no | cross) + BISON_CXX_WORKS='exit 77';; + esac + + + + AUTOM4TE=${AUTOM4TE-"${am_missing_run}autom4te"} # Needed by tests/atlocal.in. -O0CFLAGS=`echo $CFLAGS | sed 's/-O0-9 *//'` +O0CFLAGS=`echo $CFLAGS | sed 's/-O[0-9] *//'` + +O0CXXFLAGS=`echo $CXXFLAGS | sed 's/-O[0-9] *//'` - ac_config_files="$ac_config_files Makefile config/Makefile po/Makefile.in data/Makefile lib/Makefile src/Makefile doc/Makefile" + ac_config_files="$ac_config_files Makefile config/Makefile po/Makefile.in data/Makefile examples/Makefile examples/calc++/Makefile lib/Makefile src/Makefile doc/Makefile" cat >confcache <<\_ACEOF # This file is a shell script that caches the results of configure @@ -14977,7 +14835,7 @@ _ASBOX } >&5 cat >&5 <<_CSEOF -This file was extended by GNU Bison $as_me 1.875d, which was +This file was extended by GNU Bison $as_me 2.1, which was generated by GNU Autoconf 2.59. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -15040,7 +14898,7 @@ _ACEOF cat >>$CONFIG_STATUS <<_ACEOF ac_cs_version="\\ -GNU Bison config.status 1.875d +GNU Bison config.status 2.1 configured by $0, generated by GNU Autoconf 2.59, with options \\"`echo "$ac_configure_args" | sed 's/[\\""\`\$]/\\\\&/g'`\\" @@ -15157,6 +15015,7 @@ for ac_config_target in $ac_config_targets do case "$ac_config_target" in # Handling of arguments. + "runtime-po/Makefile.in" ) CONFIG_FILES="$CONFIG_FILES runtime-po/Makefile.in" ;; "tests/Makefile" ) CONFIG_FILES="$CONFIG_FILES tests/Makefile" ;; "tests/atlocal" ) CONFIG_FILES="$CONFIG_FILES tests/atlocal" ;; "tests/bison" ) CONFIG_FILES="$CONFIG_FILES tests/bison" ;; @@ -15164,6 +15023,8 @@ do "config/Makefile" ) CONFIG_FILES="$CONFIG_FILES config/Makefile" ;; "po/Makefile.in" ) CONFIG_FILES="$CONFIG_FILES po/Makefile.in" ;; "data/Makefile" ) CONFIG_FILES="$CONFIG_FILES data/Makefile" ;; + "examples/Makefile" ) CONFIG_FILES="$CONFIG_FILES examples/Makefile" ;; + "examples/calc++/Makefile" ) CONFIG_FILES="$CONFIG_FILES examples/calc++/Makefile" ;; "lib/Makefile" ) CONFIG_FILES="$CONFIG_FILES lib/Makefile" ;; "src/Makefile" ) CONFIG_FILES="$CONFIG_FILES src/Makefile" ;; "doc/Makefile" ) CONFIG_FILES="$CONFIG_FILES doc/Makefile" ;; @@ -15267,7 +15128,6 @@ s,@AUTOCONF@,$AUTOCONF,;t t s,@AUTOMAKE@,$AUTOMAKE,;t t s,@AUTOHEADER@,$AUTOHEADER,;t t s,@MAKEINFO@,$MAKEINFO,;t t -s,@AMTAR@,$AMTAR,;t t s,@install_sh@,$install_sh,;t t s,@STRIP@,$STRIP,;t t s,@ac_ct_STRIP@,$ac_ct_STRIP,;t t @@ -15276,6 +15136,9 @@ s,@mkdir_p@,$mkdir_p,;t t s,@AWK@,$AWK,;t t s,@SET_MAKE@,$SET_MAKE,;t t s,@am__leading_dot@,$am__leading_dot,;t t +s,@AMTAR@,$AMTAR,;t t +s,@am__tar@,$am__tar,;t t +s,@am__untar@,$am__untar,;t t s,@CC@,$CC,;t t s,@CFLAGS@,$CFLAGS,;t t s,@LDFLAGS@,$LDFLAGS,;t t @@ -15311,6 +15174,7 @@ s,@HAVE__BOOL@,$HAVE__BOOL,;t t s,@ALLOCA@,$ALLOCA,;t t s,@ALLOCA_H@,$ALLOCA_H,;t t s,@LIBOBJS@,$LIBOBJS,;t t +s,@GETOPT_H@,$GETOPT_H,;t t s,@MKINSTALLDIRS@,$MKINSTALLDIRS,;t t s,@USE_NLS@,$USE_NLS,;t t s,@MSGFMT@,$MSGFMT,;t t @@ -15325,12 +15189,15 @@ s,@host@,$host,;t t s,@host_cpu@,$host_cpu,;t t s,@host_vendor@,$host_vendor,;t t s,@host_os@,$host_os,;t t +s,@INTL_MACOSX_LIBS@,$INTL_MACOSX_LIBS,;t t s,@LIBICONV@,$LIBICONV,;t t s,@LTLIBICONV@,$LTLIBICONV,;t t s,@INTLLIBS@,$INTLLIBS,;t t s,@LIBINTL@,$LIBINTL,;t t s,@LTLIBINTL@,$LTLIBINTL,;t t s,@POSUB@,$POSUB,;t t +s,@BISON_LOCALEDIR@,$BISON_LOCALEDIR,;t t +s,@aclocaldir@,$aclocaldir,;t t s,@VALGRIND@,$VALGRIND,;t t s,@CXX@,$CXX,;t t s,@CXXFLAGS@,$CXXFLAGS,;t t @@ -15338,9 +15205,11 @@ s,@ac_ct_CXX@,$ac_ct_CXX,;t t s,@CXXDEPMODE@,$CXXDEPMODE,;t t s,@am__fastdepCXX_TRUE@,$am__fastdepCXX_TRUE,;t t s,@am__fastdepCXX_FALSE@,$am__fastdepCXX_FALSE,;t t +s,@BISON_CXX_WORKS@,$BISON_CXX_WORKS,;t t s,@AUTOM4TE@,$AUTOM4TE,;t t s,@GCC@,$GCC,;t t s,@O0CFLAGS@,$O0CFLAGS,;t t +s,@O0CXXFLAGS@,$O0CXXFLAGS,;t t s,@LTLIBOBJS@,$LTLIBOBJS,;t t CEOF @@ -15508,11 +15377,6 @@ esac *) ac_INSTALL=$ac_top_builddir$INSTALL ;; esac - if test x"$ac_file" != x-; then - { echo "$as_me:$LINENO: creating $ac_file" >&5 -echo "$as_me: creating $ac_file" >&6;} - rm -f "$ac_file" - fi # Let's still pretend it is `configure' which instantiates (i.e., don't # use $as_me), people would be surprised to read: # /* config.h. Generated by config.status. */ @@ -15551,6 +15415,12 @@ echo "$as_me: error: cannot find input file: $f" >&2;} fi;; esac done` || { (exit 1); exit 1; } + + if test x"$ac_file" != x-; then + { echo "$as_me:$LINENO: creating $ac_file" >&5 +echo "$as_me: creating $ac_file" >&6;} + rm -f "$ac_file" + fi _ACEOF cat >>$CONFIG_STATUS <<_ACEOF sed "$ac_vpsub @@ -15968,27 +15838,21 @@ echo X"$mf" | else continue fi - grep '^DEP_FILES *= *[^ #]' < "$mf" > /dev/null || continue - # Extract the definition of DEP_FILES from the Makefile without - # running `make'. + # Extract the definition of DEPDIR, am__include, and am__quote + # from the Makefile without running `make'. DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"` test -z "$DEPDIR" && continue + am__include=`sed -n 's/^am__include = //p' < "$mf"` + test -z "am__include" && continue + am__quote=`sed -n 's/^am__quote = //p' < "$mf"` # When using ansi2knr, U may be empty or an underscore; expand it U=`sed -n 's/^U = //p' < "$mf"` - test -d "$dirpart/$DEPDIR" || mkdir "$dirpart/$DEPDIR" - # We invoke sed twice because it is the simplest approach to - # changing $(DEPDIR) to its actual value in the expansion. - for file in `sed -n ' - /^DEP_FILES = .*\\\\$/ { - s/^DEP_FILES = // - :loop - s/\\\\$// - p - n - /\\\\$/ b loop - p - } - /^DEP_FILES = / s/^DEP_FILES = //p' < "$mf" | \ + # Find all dependency output files, they are included files with + # $(DEPDIR) in their names. We invoke sed twice because it is the + # simplest approach to changing $(DEPDIR) to its actual value in the + # expansion. + for file in `sed -n " + s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \ sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do # Make sure the directory exists. test -f "$dirpart/$file" && continue @@ -16054,6 +15918,9 @@ done /*) top_srcdir="$ac_given_srcdir" ;; *) top_srcdir="$ac_dots$ac_given_srcdir" ;; esac + # Treat a directory as a PO directory if and only if it has a + # POTFILES.in file. This allows packages to have multiple PO + # directories under different names or in different locations. if test -f "$ac_given_srcdir/$ac_dir/POTFILES.in"; then rm -f "$ac_dir/POTFILES" test -n "$as_me" && echo "$as_me: creating $ac_dir/POTFILES" || echo "creating $ac_dir/POTFILES" @@ -16067,7 +15934,7 @@ done if test -n "$OBSOLETE_ALL_LINGUAS"; then test -n "$as_me" && echo "$as_me: setting ALL_LINGUAS in configure.in is obsolete" || echo "setting ALL_LINGUAS in configure.in is obsolete" fi - ALL_LINGUAS_=`sed -e "/^#/d" "$ac_given_srcdir/$ac_dir/LINGUAS"` + ALL_LINGUAS_=`sed -e "/^#/d" -e "s/#.*//" "$ac_given_srcdir/$ac_dir/LINGUAS"` # Hide the ALL_LINGUAS assigment from automake. eval 'ALL_LINGUAS''=$ALL_LINGUAS_' POMAKEFILEDEPS="$POMAKEFILEDEPS LINGUAS" diff --git a/src/bin/bison/configure.ac b/src/bin/bison/configure.ac index 03ec0ec77d..cf6b688047 100644 --- a/src/bin/bison/configure.ac +++ b/src/bin/bison/configure.ac @@ -1,6 +1,6 @@ # Configure template for GNU Bison. -*-Autoconf-*- # -# Copyright (C) 2001, 2002, 2003, 2004 Free Software Foundation, Inc. +# Copyright (C) 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc. # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -14,17 +14,21 @@ # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA -# 02111-1307 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +# 02110-1301 USA -# We need a recent Autoconf to run a recent Autotest. -AC_PREREQ(2.57) +# This file uses AC_CONFIG_MACRO_DIR, so we need Autoconf 2.58 or better. +# But Autoconf 2.58 has a bug in the way that it generates tests: it +# puts the wrong absolute path names in the tests. So we need at +# least Autoconf 2.59. +AC_PREREQ(2.59) -AC_INIT([GNU Bison], [1.875d], [bug-bison@gnu.org]) -AC_CONFIG_AUX_DIR([config]) +AC_INIT([GNU Bison], [2.1], [bug-bison@gnu.org]) +AC_CONFIG_AUX_DIR([build-aux]) AC_CONFIG_MACRO_DIR([m4]) -AM_INIT_AUTOMAKE([1.7 check-news readme-alpha dist-bzip2]) +# We don't have a file m4/Makefile.am, so we need Automake 1.8 or later. +AM_INIT_AUTOMAKE([1.8 check-news readme-alpha dist-bzip2]) AC_CONFIG_HEADERS([config.h:config.hin]) gl_USE_SYSTEM_EXTENSIONS @@ -103,7 +107,15 @@ BISON_PREREQ_TIMEVAR # gnulib and gettext. GNULIB_AUTOCONF_SNIPPET -AM_GNU_GETTEXT_VERSION([0.14.1]) +# We use po/Makevars, so we need at least gettext 0.12. +AM_GNU_GETTEXT_VERSION([0.12]) +BISON_I18N + +# Internationalized parsers. +AC_CONFIG_FILES([runtime-po/Makefile.in]) +# Autoconf macros for packages using internationalized parsers. +aclocaldir='${datadir}/aclocal' +AC_SUBST([aclocaldir]) # Initialize the test suite. AC_CONFIG_TESTDIR(tests) @@ -111,15 +123,20 @@ AC_CONFIG_FILES([tests/Makefile tests/atlocal]) AC_CONFIG_FILES([tests/bison], [chmod +x tests/bison]) AC_CHECK_PROGS([VALGRIND], [valgrind]) AC_PROG_CXX +BISON_TEST_FOR_WORKING_CXX_COMPILER AM_MISSING_PROG([AUTOM4TE], [autom4te]) # Needed by tests/atlocal.in. AC_SUBST([GCC]) -O0CFLAGS=`echo $CFLAGS | sed 's/-O[0-9] *//'` +O0CFLAGS=`echo $CFLAGS | sed 's/-O[[0-9]] *//'` AC_SUBST([O0CFLAGS]) +O0CXXFLAGS=`echo $CXXFLAGS | sed 's/-O[[0-9]] *//'` +AC_SUBST([O0CXXFLAGS]) AC_CONFIG_FILES([Makefile config/Makefile po/Makefile.in data/Makefile + examples/Makefile + examples/calc++/Makefile lib/Makefile src/Makefile doc/Makefile]) AC_OUTPUT diff --git a/src/bin/bison/data/Makefile.am b/src/bin/bison/data/Makefile.am index 945e45905b..26e0a00178 100644 --- a/src/bin/bison/data/Makefile.am +++ b/src/bin/bison/data/Makefile.am @@ -1,4 +1,4 @@ -## Copyright (C) 2002 Free Software Foundation, Inc. +## Copyright (C) 2002, 2005 Free Software Foundation, Inc. ## This program is free software; you can redistribute it and/or modify ## it under the terms of the GNU General Public License as published by @@ -12,10 +12,12 @@ ## You should have received a copy of the GNU General Public License ## along with this program; if not, write to the Free Software -## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA -## 02111-1307 USA +## Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +## 02110-1301 USA -dist_pkgdata_DATA = README c.m4 yacc.c lalr1.cc glr.c +dist_pkgdata_DATA = README \ + c.m4 yacc.c glr.c \ + c++.m4 lalr1.cc m4sugardir = $(pkgdatadir)/m4sugar dist_m4sugar_DATA = m4sugar/m4sugar.m4 diff --git a/src/bin/bison/data/Makefile.in b/src/bin/bison/data/Makefile.in index 8d2b54619b..89a8c32c5f 100644 --- a/src/bin/bison/data/Makefile.in +++ b/src/bin/bison/data/Makefile.in @@ -1,8 +1,8 @@ -# Makefile.in generated by automake 1.8.5 from Makefile.am. +# Makefile.in generated by automake 1.9.6 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, -# 2003, 2004 Free Software Foundation, Inc. +# 2003, 2004, 2005 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. @@ -34,38 +34,50 @@ POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : +build_triplet = @build@ host_triplet = @host@ subdir = data DIST_COMMON = README $(dist_m4sugar_DATA) $(dist_pkgdata_DATA) \ $(srcdir)/Makefile.am $(srcdir)/Makefile.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/alloca.m4 \ + $(top_srcdir)/m4/bison-i18n.m4 $(top_srcdir)/m4/cxx.m4 \ $(top_srcdir)/m4/dirname.m4 $(top_srcdir)/m4/dmalloc.m4 \ $(top_srcdir)/m4/dos.m4 $(top_srcdir)/m4/error.m4 \ $(top_srcdir)/m4/exitfail.m4 $(top_srcdir)/m4/extensions.m4 \ - $(top_srcdir)/m4/getopt.m4 $(top_srcdir)/m4/gettext.m4 \ + $(top_srcdir)/m4/getopt.m4 $(top_srcdir)/m4/gettext_gl.m4 \ $(top_srcdir)/m4/gnulib.m4 $(top_srcdir)/m4/hard-locale.m4 \ $(top_srcdir)/m4/hash.m4 $(top_srcdir)/m4/iconv.m4 \ - $(top_srcdir)/m4/lib-ld.m4 $(top_srcdir)/m4/lib-link.m4 \ - $(top_srcdir)/m4/lib-prefix.m4 $(top_srcdir)/m4/m4.m4 \ + $(top_srcdir)/m4/inttypes_h_gl.m4 \ + $(top_srcdir)/m4/lib-ld_gl.m4 $(top_srcdir)/m4/lib-link.m4 \ + $(top_srcdir)/m4/lib-prefix_gl.m4 $(top_srcdir)/m4/m4.m4 \ $(top_srcdir)/m4/mbrtowc.m4 $(top_srcdir)/m4/mbstate_t.m4 \ $(top_srcdir)/m4/mbswidth.m4 $(top_srcdir)/m4/nls.m4 \ $(top_srcdir)/m4/obstack.m4 $(top_srcdir)/m4/onceonly.m4 \ - $(top_srcdir)/m4/po.m4 $(top_srcdir)/m4/progtest.m4 \ + $(top_srcdir)/m4/po_gl.m4 $(top_srcdir)/m4/progtest.m4 \ $(top_srcdir)/m4/quote.m4 $(top_srcdir)/m4/quotearg.m4 \ - $(top_srcdir)/m4/stdbool.m4 $(top_srcdir)/m4/stpcpy.m4 \ - $(top_srcdir)/m4/strndup.m4 $(top_srcdir)/m4/strnlen.m4 \ - $(top_srcdir)/m4/subpipe.m4 $(top_srcdir)/m4/timevar.m4 \ - $(top_srcdir)/m4/unlocked-io.m4 $(top_srcdir)/m4/warning.m4 \ + $(top_srcdir)/m4/stdbool.m4 $(top_srcdir)/m4/stdint_h_gl.m4 \ + $(top_srcdir)/m4/stdio-safer.m4 $(top_srcdir)/m4/stpcpy.m4 \ + $(top_srcdir)/m4/strdup.m4 $(top_srcdir)/m4/strndup.m4 \ + $(top_srcdir)/m4/strnlen.m4 $(top_srcdir)/m4/subpipe.m4 \ + $(top_srcdir)/m4/timevar.m4 $(top_srcdir)/m4/uintmax_t_gl.m4 \ + $(top_srcdir)/m4/ulonglong_gl.m4 \ + $(top_srcdir)/m4/unistd-safer.m4 $(top_srcdir)/m4/warning.m4 \ $(top_srcdir)/m4/xalloc.m4 $(top_srcdir)/m4/xstrndup.m4 \ $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) -mkinstalldirs = $(SHELL) $(top_srcdir)/config/mkinstalldirs +mkinstalldirs = $(SHELL) $(top_srcdir)/build-aux/mkinstalldirs CONFIG_HEADER = $(top_builddir)/config.h CONFIG_CLEAN_FILES = SOURCES = DIST_SOURCES = +am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; +am__vpath_adj = case $$p in \ + $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ + *) f=$$p;; \ + esac; +am__strip_dir = `echo $$p | sed -e 's|^.*/||'`; am__installdirs = "$(DESTDIR)$(m4sugardir)" "$(DESTDIR)$(pkgdatadir)" dist_m4sugarDATA_INSTALL = $(INSTALL_DATA) dist_pkgdataDATA_INSTALL = $(INSTALL_DATA) @@ -82,6 +94,8 @@ AUTOHEADER = @AUTOHEADER@ AUTOM4TE = @AUTOM4TE@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ +BISON_CXX_WORKS = @BISON_CXX_WORKS@ +BISON_LOCALEDIR = @BISON_LOCALEDIR@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ @@ -99,6 +113,7 @@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ GCC = @GCC@ +GETOPT_H = @GETOPT_H@ GMSGFMT = @GMSGFMT@ HAVE__BOOL = @HAVE__BOOL@ INSTALL_DATA = @INSTALL_DATA@ @@ -106,6 +121,7 @@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ INTLLIBS = @INTLLIBS@ +INTL_MACOSX_LIBS = @INTL_MACOSX_LIBS@ LDFLAGS = @LDFLAGS@ LEX = @LEX@ LEXLIB = @LEXLIB@ @@ -123,6 +139,7 @@ MKINSTALLDIRS = @MKINSTALLDIRS@ MSGFMT = @MSGFMT@ MSGMERGE = @MSGMERGE@ O0CFLAGS = @O0CFLAGS@ +O0CXXFLAGS = @O0CXXFLAGS@ OBJEXT = @OBJEXT@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ @@ -151,6 +168,7 @@ ac_ct_CC = @ac_ct_CC@ ac_ct_CXX = @ac_ct_CXX@ ac_ct_RANLIB = @ac_ct_RANLIB@ ac_ct_STRIP = @ac_ct_STRIP@ +aclocaldir = @aclocaldir@ am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@ @@ -158,6 +176,8 @@ am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ @@ -186,7 +206,10 @@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ -dist_pkgdata_DATA = README c.m4 yacc.c lalr1.cc glr.c +dist_pkgdata_DATA = README \ + c.m4 yacc.c glr.c \ + c++.m4 lalr1.cc + m4sugardir = $(pkgdatadir)/m4sugar dist_m4sugar_DATA = m4sugar/m4sugar.m4 all: all-am @@ -227,7 +250,7 @@ install-dist_m4sugarDATA: $(dist_m4sugar_DATA) test -z "$(m4sugardir)" || $(mkdir_p) "$(DESTDIR)$(m4sugardir)" @list='$(dist_m4sugar_DATA)'; for p in $$list; do \ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ - f="`echo $$p | sed -e 's|^.*/||'`"; \ + f=$(am__strip_dir) \ echo " $(dist_m4sugarDATA_INSTALL) '$$d$$p' '$(DESTDIR)$(m4sugardir)/$$f'"; \ $(dist_m4sugarDATA_INSTALL) "$$d$$p" "$(DESTDIR)$(m4sugardir)/$$f"; \ done @@ -235,7 +258,7 @@ install-dist_m4sugarDATA: $(dist_m4sugar_DATA) uninstall-dist_m4sugarDATA: @$(NORMAL_UNINSTALL) @list='$(dist_m4sugar_DATA)'; for p in $$list; do \ - f="`echo $$p | sed -e 's|^.*/||'`"; \ + f=$(am__strip_dir) \ echo " rm -f '$(DESTDIR)$(m4sugardir)/$$f'"; \ rm -f "$(DESTDIR)$(m4sugardir)/$$f"; \ done @@ -244,7 +267,7 @@ install-dist_pkgdataDATA: $(dist_pkgdata_DATA) test -z "$(pkgdatadir)" || $(mkdir_p) "$(DESTDIR)$(pkgdatadir)" @list='$(dist_pkgdata_DATA)'; for p in $$list; do \ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ - f="`echo $$p | sed -e 's|^.*/||'`"; \ + f=$(am__strip_dir) \ echo " $(dist_pkgdataDATA_INSTALL) '$$d$$p' '$(DESTDIR)$(pkgdatadir)/$$f'"; \ $(dist_pkgdataDATA_INSTALL) "$$d$$p" "$(DESTDIR)$(pkgdatadir)/$$f"; \ done @@ -252,7 +275,7 @@ install-dist_pkgdataDATA: $(dist_pkgdata_DATA) uninstall-dist_pkgdataDATA: @$(NORMAL_UNINSTALL) @list='$(dist_pkgdata_DATA)'; for p in $$list; do \ - f="`echo $$p | sed -e 's|^.*/||'`"; \ + f=$(am__strip_dir) \ echo " rm -f '$(DESTDIR)$(pkgdatadir)/$$f'"; \ rm -f "$(DESTDIR)$(pkgdatadir)/$$f"; \ done @@ -317,7 +340,7 @@ mostlyclean-generic: clean-generic: distclean-generic: - -rm -f $(CONFIG_CLEAN_FILES) + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" diff --git a/src/bin/bison/data/README b/src/bin/bison/data/README index af5e905a35..226779178c 100644 --- a/src/bin/bison/data/README +++ b/src/bin/bison/data/README @@ -41,5 +41,5 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License along with Bison; see the file COPYING. If not, write to -the Free Software Foundation, Inc., 59 Temple Place - Suite 330, -Boston, MA 02111-1307, USA. +the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +Boston, MA 02110-1301, USA. diff --git a/src/bin/bison/data/c++.m4 b/src/bin/bison/data/c++.m4 new file mode 100644 index 0000000000..0f127b9354 --- /dev/null +++ b/src/bin/bison/data/c++.m4 @@ -0,0 +1,121 @@ +m4_divert(-1) + +# C++ skeleton for Bison + +# Copyright (C) 2002, 2003, 2004, 2005 Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 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, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +# 02110-1301 USA + +## ---------------- ## +## Default values. ## +## ---------------- ## + +# Default parser class name. +m4_define_default([b4_parser_class_name], [parser]) +m4_define_default([b4_location_type], [location]) +m4_define_default([b4_filename_type], [std::string]) + + + +# b4_token_enums(LIST-OF-PAIRS-TOKEN-NAME-TOKEN-NUMBER) +# ----------------------------------------------------- +# Output the definition of the tokens (if there are) as enums. +m4_define([b4_token_enums], +[m4_if([$@], [[]], [], +[/* Tokens. */ + enum yytokentype { +m4_map_sep([ b4_token_enum], [, +], + [$@]) + }; +])]) + + +## ----------------- ## +## Semantic Values. ## +## ----------------- ## + + +# b4_lhs_value([TYPE]) +# -------------------- +# Expansion of $$. +m4_define([b4_lhs_value], +[(yyval[]m4_ifval([$1], [.$1]))]) + + +# b4_rhs_value(RULE-LENGTH, NUM, [TYPE]) +# -------------------------------------- +# Expansion of $NUM, where the current rule has RULE-LENGTH +# symbols on RHS. +m4_define([b4_rhs_value], +[(yysemantic_stack_@{m4_eval([$1 - $2])@}m4_ifval([$3], [.$3]))]) + +# b4_lhs_location() +# ----------------- +# Expansion of @$. +m4_define([b4_lhs_location], +[(yyloc)]) + + +# b4_rhs_location(RULE-LENGTH, NUM) +# --------------------------------- +# Expansion of @NUM, where the current rule has RULE-LENGTH symbols +# on RHS. +m4_define([b4_rhs_location], +[(yylocation_stack_@{m4_eval([$1 - $2])@})]) + + +# b4_parse_param_decl +# ------------------- +# Extra formal arguments of the constructor. +# Change the parameter names from "foo" into "foo_yyarg", so that +# there is no collision bw the user chosen attribute name, and the +# argument name in the constructor. +m4_define([b4_parse_param_decl], +[m4_ifset([b4_parse_param], + [m4_map_sep([b4_parse_param_decl_1], [, ], [b4_parse_param])])]) + +m4_define([b4_parse_param_decl_1], +[$1_yyarg]) + + + +# b4_parse_param_cons +# ------------------- +# Extra initialisations of the constructor. +m4_define([b4_parse_param_cons], + [m4_ifset([b4_parse_param], + [, + b4_cc_constructor_calls(b4_parse_param)])]) +m4_define([b4_cc_constructor_calls], + [m4_map_sep([b4_cc_constructor_call], [, + ], [$@])]) +m4_define([b4_cc_constructor_call], + [$2 ($2_yyarg)]) + +# b4_parse_param_vars +# ------------------- +# Extra instance variables. +m4_define([b4_parse_param_vars], + [m4_ifset([b4_parse_param], + [ + /* User arguments. */ +b4_cc_var_decls(b4_parse_param)])]) +m4_define([b4_cc_var_decls], + [m4_map_sep([b4_cc_var_decl], [ +], [$@])]) +m4_define([b4_cc_var_decl], + [ $1;]) diff --git a/src/bin/bison/data/c.m4 b/src/bin/bison/data/c.m4 index a72f059a51..d8dc6bc4bc 100644 --- a/src/bin/bison/data/c.m4 +++ b/src/bin/bison/data/c.m4 @@ -1,7 +1,7 @@ m4_divert(-1) -*- Autoconf -*- # C M4 Macros for Bison. -# Copyright (C) 2002, 2004 Free Software Foundation, Inc. +# Copyright (C) 2002, 2004, 2005 Free Software Foundation, Inc. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -15,8 +15,8 @@ m4_divert(-1) -*- Autoconf -*- # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA -# 02111-1307 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +# 02110-1301 USA ## ---------------- ## @@ -43,8 +43,8 @@ m4_define([b4_copyright], You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */]) + Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. */]) # b4_identification @@ -53,6 +53,9 @@ m4_define([b4_identification], [/* Identify Bison output. */ [#]define YYBISON 1 +/* Bison version. */ +[#]define YYBISON_VERSION "b4_version" + /* Skeleton name. */ [#]define YYSKELETON_NAME b4_skeleton @@ -119,7 +122,7 @@ m4_define([b4_int_type], m4_eval([0 <= $1]), [1], [unsigned int], - [int])]) + [int])]) # b4_int_type_for(NAME) @@ -166,6 +169,16 @@ m4_define([b4_token_define], ]) +# b4_token_defines(LIST-OF-PAIRS-TOKEN-NAME-TOKEN-NUMBER) +# ------------------------------------------------------- +# Output the definition of the tokens (if there are) as #defines. +m4_define([b4_token_defines], +[m4_if([$@], [[]], [], +[/* Tokens. */ +m4_map([b4_token_define], [$@])]) +]) + + # b4_token_enum(TOKEN-NAME, TOKEN-NUMBER) # --------------------------------------- # Output the definition of this token as an enum. @@ -173,10 +186,10 @@ m4_define([b4_token_enum], [$1 = $2]) -# b4_token_defines(LIST-OF-PAIRS-TOKEN-NAME-TOKEN-NUMBER) -# ------------------------------------------------------- -# Output the definition of the tokens (if there are) as enums and #define. -m4_define([b4_token_defines], +# b4_token_enums(LIST-OF-PAIRS-TOKEN-NAME-TOKEN-NUMBER) +# ----------------------------------------------------- +# Output the definition of the tokens (if there are) as enums. +m4_define([b4_token_enums], [m4_if([$@], [[]], [], [/* Tokens. */ #ifndef YYTOKENTYPE @@ -189,8 +202,14 @@ m4_map_sep([ b4_token_enum], [, [$@]) }; #endif -m4_map([b4_token_define], [$@]) -]) +])]) + + +# b4_token_enums_defines(LIST-OF-PAIRS-TOKEN-NAME-TOKEN-NUMBER) +# ------------------------------------------------------------- +# Output the definition of the tokens (if there are) as enums and #defines. +m4_define([b4_token_enums_defines], +[b4_token_enums($@)b4_token_defines($@) ]) @@ -327,7 +346,8 @@ m4_define([b4_syncline], # SYMBOL-ACTION, SYMBOL-TYPENAME) # ------------------------------------------------- m4_define([b4_symbol_actions], -[m4_pushdef([b4_dollar_dollar], [yyvaluep->$6])dnl +[m4_pushdef([b4_dollar_dollar], + [m4_ifval([$6], [(yyvaluep->$6)], [(*yyvaluep)])])dnl m4_pushdef([b4_at_dollar], [(*yylocationp)])dnl case $4: /* $3 */ b4_syncline([$2], [$1]) @@ -344,13 +364,14 @@ m4_popdef([b4_dollar_dollar])dnl # Generate the "yydestruct" function, which declaration is issued using # FUNCTION-DECLARATOR, which may be "b4_c_ansi_function_def" for ISO C # or "b4_c_function_def" for K&R. -m4_define([b4_yydestruct_generate], +m4_define_default([b4_yydestruct_generate], [[/*-----------------------------------------------. | Release the memory associated to this symbol. | `-----------------------------------------------*/ ]$1([yydestruct], [static void], + [[const char *yymsg], [yymsg]], [[int yytype], [yytype]], [[YYSTYPE *yyvaluep], [yyvaluep]]b4_location_if([, [[YYLTYPE *yylocationp], [yylocationp]]]))[ @@ -359,6 +380,10 @@ m4_define([b4_yydestruct_generate], (void) yyvaluep; ]b4_location_if([ (void) yylocationp; ])[ + if (!yymsg) + yymsg = "Deleting"; + YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp); + switch (yytype) { ]m4_map([b4_symbol_actions], m4_defn([b4_symbol_destructors]))[ @@ -374,7 +399,7 @@ m4_define([b4_yydestruct_generate], # Generate the "yysymprint" function, which declaration is issued using # FUNCTION-DECLARATOR, which may be "b4_c_ansi_function_def" for ISO C # or "b4_c_function_def" for K&R. -m4_define([b4_yysymprint_generate], +m4_define_default([b4_yysymprint_generate], [[/*--------------------------------. | Print this symbol on YYOUTPUT. | `--------------------------------*/ @@ -390,23 +415,26 @@ m4_define([b4_yysymprint_generate], (void) yyvaluep; b4_location_if([ (void) yylocationp; ])dnl - +[ if (yytype < YYNTOKENS) - { - YYFPRINTF (yyoutput, "token %s (", yytname[[yytype]]); -# ifdef YYPRINT - YYPRINT (yyoutput, yytoknum[[yytype]], *yyvaluep); -# endif - } + YYFPRINTF (yyoutput, "token %s (", yytname[yytype]); else - YYFPRINTF (yyoutput, "nterm %s (", yytname[[yytype]]); + YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]); +]b4_location_if([ YY_LOCATION_PRINT (yyoutput, *yylocationp); + YYFPRINTF (yyoutput, ": "); +])dnl +[ +# ifdef YYPRINT + if (yytype < YYNTOKENS) + YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep); +# endif switch (yytype) { -m4_map([b4_symbol_actions], m4_defn([b4_symbol_printers]))dnl - default: +]m4_map([b4_symbol_actions], m4_defn([b4_symbol_printers]))dnl +[ default: break; } YYFPRINTF (yyoutput, ")"); } -]) +]]) diff --git a/src/bin/bison/data/glr.c b/src/bin/bison/data/glr.c index a77a985703..6d3ec6cc22 100644 --- a/src/bin/bison/data/glr.c +++ b/src/bin/bison/data/glr.c @@ -1,7 +1,7 @@ m4_divert(-1) -*- C -*- # GLR skeleton for Bison -# Copyright (C) 2002, 2003, 2004 Free Software Foundation, Inc. +# Copyright (C) 2002, 2003, 2004, 2005 Free Software Foundation, Inc. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -15,8 +15,8 @@ m4_divert(-1) -*- C -*- # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA -# 02111-1307 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +# 02110-1301 USA ## ---------------- ## @@ -60,7 +60,7 @@ m4_ifset([b4_parse_param], [b4_c_args(b4_parse_param), ])]) # b4_lyyerror_args # ---------------- -# Same as above, but on the lookahead, hence yyllocp instead of yylocp. +# Same as above, but on the look-ahead, hence yyllocp instead of yylocp. m4_define([b4_lyyerror_args], [b4_pure_if([b4_location_if([yyllocp, ])])dnl m4_ifset([b4_parse_param], [b4_c_args(b4_parse_param), ])]) @@ -82,14 +82,14 @@ m4_define([b4_pure_formals], # b4_lpure_args # ------------- -# Same as above, but on the lookahead, hence yyllocp instead of yylocp. +# Same as above, but on the look-ahead, hence yyllocp instead of yylocp. m4_define([b4_lpure_args], [b4_pure_if([b4_location_if([, yyllocp])])[]b4_user_args]) # b4_lpure_formals # ---------------- -# Same as above, but on the lookahead, hence yyllocp instead of yylocp. +# Same as above, but on the look-ahead, hence yyllocp instead of yylocp. m4_define([b4_lpure_formals], [b4_pure_if([b4_location_if([YYLTYPE *yyllocp])])[]b4_user_formals]) @@ -103,7 +103,7 @@ m4_define([b4_lpure_formals], # -------------------- # Expansion of $$. m4_define([b4_lhs_value], -[(*yyvalp)[]m4_ifval([$1], [.$1])]) +[((*yyvalp)[]m4_ifval([$1], [.$1]))]) # b4_rhs_value(RULE-LENGTH, NUM, [TYPE]) @@ -111,7 +111,7 @@ m4_define([b4_lhs_value], # Expansion of $NUM, where the current rule has RULE-LENGTH # symbols on RHS. m4_define([b4_rhs_value], -[((yyGLRStackItem const *)yyvsp)@{YYFILL (m4_eval([$2 - $1]))@}.yystate.yysemantics.yysval[]m4_ifval([$3], [.$3])]) +[(((yyGLRStackItem const *)yyvsp)@{YYFILL (m4_eval([$2 - $1]))@}.yystate.yysemantics.yysval[]m4_ifval([$3], [.$3]))]) @@ -131,26 +131,20 @@ m4_define([b4_lhs_location], # Expansion of @NUM, where the current rule has RULE-LENGTH symbols # on RHS. m4_define([b4_rhs_location], -[((yyGLRStackItem const *)yyvsp)@{YYFILL (m4_eval([$2 - $1]))@}.yystate.yyloc]) +[(((yyGLRStackItem const *)yyvsp)@{YYFILL (m4_eval([$2 - $1]))@}.yystate.yyloc)]) # We do want M4 expansion after # for CPP macros. m4_changecom() m4_divert(0)dnl @output @output_parser_name@ -b4_copyright([Skeleton parser for GLR parsing with Bison], [2002, 2003, 2004]) +b4_copyright([Skeleton parser for GLR parsing with Bison], + [2002, 2003, 2004, 2005]) [ /* This is the parser code for GLR (Generalized LR) parser. */ -#include -#include -#include -#include -#include - ]b4_identification m4_if(b4_prefix[], [yy], [], -[/* If NAME_PREFIX is specified substitute the variables and functions - names. */ +[/* Substitute the variable and function names. */ #define yyparse b4_prefix[]parse #define yylex b4_prefix[]lex #define yyerror b4_prefix[]error @@ -158,9 +152,9 @@ m4_if(b4_prefix[], [yy], [], #define yychar b4_prefix[]char #define yydebug b4_prefix[]debug #define yynerrs b4_prefix[]nerrs -b4_location_if([#define yylloc b4_prefix[]lloc])]) +#define yylloc b4_prefix[]lloc]) -b4_token_defines(b4_tokens) +b4_token_enums_defines(b4_tokens) /* Copy the first part of user declarations. */ b4_pre_prologue[ @@ -178,9 +172,14 @@ b4_pre_prologue[ # define YYERROR_VERBOSE ]b4_error_verbose[ #endif +/* Enabling the token table. */ +#ifndef YYTOKEN_TABLE +# define YYTOKEN_TABLE ]b4_token_table[ +#endif + #if ! defined (YYSTYPE) && ! defined (YYSTYPE_IS_DECLARED) ]m4_ifdef([b4_stype], -[b4_syncline([b4_stype_line], [b4_filename]) +[b4_syncline([b4_stype_line], [b4_file_name]) typedef union m4_bregexp(b4_stype, [^{], [YYSTYPE ])b4_stype YYSTYPE; /* Line __line__ of glr.c. */ b4_syncline([@oline@], [@ofile@])], @@ -205,13 +204,12 @@ typedef struct YYLTYPE # define YYLTYPE_IS_TRIVIAL 1 #endif -/* Default (constant) values 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 the default values of $$ and $@@ to zeroed-out - values. Since the default value of these quantities is undefined, - this behavior is technically correct. */ + here we set the default value of $$ to a zeroed-out value. + Since the default value is undefined, this behavior is + technically correct. */ static YYSTYPE yyval_default; -static YYLTYPE yyloc_default; /* Copy the second part of user declarations. */ ]b4_post_prologue[ @@ -219,6 +217,23 @@ static YYLTYPE yyloc_default; ]/* Line __line__ of glr.c. */ b4_syncline([@oline@], [@ofile@]) [ +#include +#include +#include +#include + +#ifndef YY_ +# if YYENABLE_NLS +# if ENABLE_NLS +# include /* INFRINGES ON USER NAME SPACE */ +# define YY_(msgid) dgettext ("bison-runtime", msgid) +# endif +# endif +# ifndef YY_ +# define YY_(msgid) msgid +# endif +#endif + #ifndef YYFREE # define YYFREE free #endif @@ -229,6 +244,8 @@ b4_syncline([@oline@], [@ofile@]) # define YYREALLOC realloc #endif +#define YYSIZEMAX ((size_t) -1) + #ifdef __cplusplus typedef bool yybool; #else @@ -237,26 +254,36 @@ b4_syncline([@oline@], [@ofile@]) #define yytrue 1 #define yyfalse 0 +#ifndef YYSETJMP +# include +# define YYJMP_BUF jmp_buf +# define YYSETJMP(env) setjmp (env) +# define YYLONGJMP(env, val) longjmp (env, val) +#endif + /*-----------------. | GCC extensions. | `-----------------*/ #ifndef __attribute__ /* This feature is available in gcc versions 2.5 and later. */ -# if !defined (__GNUC__) || __GNUC__ < 2 || \ -(__GNUC__ == 2 && __GNUC_MINOR__ < 5) || __STRICT_ANSI__ +# if (!defined (__GNUC__) || __GNUC__ < 2 \ + || (__GNUC__ == 2 && __GNUC_MINOR__ < 5) || __STRICT_ANSI__) # define __attribute__(Spec) /* empty */ # endif #endif +]b4_location_if([#define YYOPTIONAL_LOC(Name) Name],[ +#ifdef __cplusplus +# define YYOPTIONAL_LOC(Name) /* empty */ +#else +# define YYOPTIONAL_LOC(Name) Name __attribute__ ((__unused__)) +#endif])[ + #ifndef YYASSERT # define YYASSERT(condition) ((void) ((condition) || (abort (), 0))) #endif -#ifndef ATTRIBUTE_UNUSED -# define ATTRIBUTE_UNUSED __attribute__ ((__unused__)) -#endif - /* YYFINAL -- State number of the termination state. */ #define YYFINAL ]b4_final_state_number[ /* YYLAST -- Last index in YYTABLE. */ @@ -311,8 +338,8 @@ static const ]b4_int_type_for([b4_rline])[ yyrline[] = }; #endif -#if (YYDEBUG) || YYERROR_VERBOSE -/* YYTNME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM. +#if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE +/* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM. First, the terminals, then, starting at YYNTOKENS, nonterminals. */ static const char *const yytname[] = { @@ -420,25 +447,50 @@ static const ]b4_int_type_for([b4_stos])[ yystos[] = /* Error token number */ #define YYTERROR 1 -/* YYLLOC_DEFAULT -- Compute the default location (before the actions - are run). */ +/* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N]. + If N is 0, then set CURRENT to the empty location which ends + the previous symbol: RHS[0] (always defined). */ ]b4_location_if([[ -#define YYRHSLOC(yyRhs,YYK) ((yyRhs)[YYK].yystate.yyloc) - +#define YYRHSLOC(Rhs, K) ((Rhs)[K].yystate.yyloc) #ifndef YYLLOC_DEFAULT -# define YYLLOC_DEFAULT(yyCurrent, yyRhs, YYN) \ - ((yyCurrent).first_line = YYRHSLOC(yyRhs, 1).first_line, \ - (yyCurrent).first_column = YYRHSLOC(yyRhs, 1).first_column, \ - (yyCurrent).last_line = YYRHSLOC(yyRhs, YYN).last_line, \ - (yyCurrent).last_column = YYRHSLOC(yyRhs, YYN).last_column) +# define YYLLOC_DEFAULT(Current, Rhs, N) \ + do \ + if (N) \ + { \ + (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \ + (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \ + (Current).last_line = YYRHSLOC (Rhs, N).last_line; \ + (Current).last_column = YYRHSLOC (Rhs, N).last_column; \ + } \ + else \ + { \ + (Current).first_line = (Current).last_line = \ + YYRHSLOC (Rhs, 0).last_line; \ + (Current).first_column = (Current).last_column = \ + YYRHSLOC (Rhs, 0).last_column; \ + } \ + while (0) + +/* YY_LOCATION_PRINT -- Print the location on the stream. + This macro was not mandated originally: define only if we know + we won't break user code: when these are the locations we know. */ + +# define YY_LOCATION_PRINT(File, Loc) \ + fprintf (File, "%d.%d-%d.%d", \ + (Loc).first_line, (Loc).first_column, \ + (Loc).last_line, (Loc).last_column) #endif ]],[ #ifndef YYLLOC_DEFAULT -# define YYLLOC_DEFAULT(yyCurrent, yyRhs, YYN) ((void) 0) +# define YYLLOC_DEFAULT(Current, Rhs, N) ((void) 0) #endif ])[ +#ifndef YY_LOCATION_PRINT +# define YY_LOCATION_PRINT(File, Loc) ((void) 0) +#endif + /* YYLEX -- calling `yylex' with the right arguments. */ #define YYLEX ]b4_c_function_call([yylex], [int], b4_lex_param)[ @@ -479,19 +531,13 @@ do { \ ]b4_yysymprint_generate([b4_c_ansi_function_def])[ -# define YYDSYMPRINT(Args) \ -do { \ - if (yydebug) \ - yysymprint Args; \ -} while (0) - -# define YYDSYMPRINTF(Title, Token, Value, Location) \ +# define YY_SYMBOL_PRINT(Title, Type, Value, Location) \ do { \ if (yydebug) \ { \ YYFPRINTF (stderr, "%s ", Title); \ yysymprint (stderr, \ - Token, Value]b4_location_if([, Location])[); \ + Type, Value]b4_location_if([, Location])[); \ YYFPRINTF (stderr, "\n"); \ } \ } while (0) @@ -502,10 +548,8 @@ int yydebug; #else /* !YYDEBUG */ - /* Avoid empty `if' bodies. */ # define YYDPRINTF(Args) -# define YYDSYMPRINT(Args) -# define YYDSYMPRINTF(Title, Token, Value, Location) +# define YY_SYMBOL_PRINT(Title, Type, Value, Location) #endif /* !YYDEBUG */ @@ -521,30 +565,99 @@ int yydebug; SIZE_MAX < YYMAXDEPTH * sizeof (GLRStackItem) evaluated with infinite-precision integer arithmetic. */ -#if YYMAXDEPTH == 0 -# undef YYMAXDEPTH -#endif - #ifndef YYMAXDEPTH # define YYMAXDEPTH ]b4_stack_depth_max[ #endif /* Minimum number of free items on the stack allowed after an allocation. This is to allow allocation and initialization - to be completed by functions that call expandGLRStack before the + to be completed by functions that call yyexpandGLRStack before the stack is expanded, thus insuring that all necessary pointers get properly redirected to new data. */ #define YYHEADROOM 2 -#if (! defined (YYSTACKEXPANDABLE) \ - && (! defined (__cplusplus) \ - || (]b4_location_if([[defined (YYLTYPE_IS_TRIVIAL) && YYLTYPE_IS_TRIVIAL \ - && ]])[defined (YYSTYPE_IS_TRIVIAL) && YYSTYPE_IS_TRIVIAL))) -#define YYSTACKEXPANDABLE 1 -#else -#define YYSTACKEXPANDABLE 0 +#ifndef YYSTACKEXPANDABLE +# if (! defined (__cplusplus) \ + || (]b4_location_if([[defined (YYLTYPE_IS_TRIVIAL) && YYLTYPE_IS_TRIVIAL \ + && ]])[defined (YYSTYPE_IS_TRIVIAL) && YYSTYPE_IS_TRIVIAL)) +# define YYSTACKEXPANDABLE 1 +# else +# define YYSTACKEXPANDABLE 0 +# endif #endif +#if YYERROR_VERBOSE + +# ifndef yystpcpy +# if defined (__GLIBC__) && defined (_STRING_H) && defined (_GNU_SOURCE) +# define yystpcpy stpcpy +# else +/* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in + YYDEST. */ +static char * +yystpcpy (char *yydest, const char *yysrc) +{ + char *yyd = yydest; + const char *yys = yysrc; + + while ((*yyd++ = *yys++) != '\0') + continue; + + return yyd - 1; +} +# endif +# endif + +# ifndef yytnamerr +/* Copy to YYRES the contents of YYSTR after stripping away unnecessary + quotes and backslashes, so that it's suitable for yyerror. The + heuristic is that double-quoting is unnecessary unless the string + contains an apostrophe, a comma, or backslash (other than + backslash-backslash). YYSTR is taken from yytname. If YYRES is + null, do not copy; instead, return the length of what the result + would have been. */ +static size_t +yytnamerr (char *yyres, const char *yystr) +{ + if (*yystr == '"') + { + size_t yyn = 0; + char const *yyp = yystr; + + for (;;) + switch (*++yyp) + { + case '\'': + case ',': + goto do_not_strip_quotes; + + case '\\': + if (*++yyp != '\\') + goto do_not_strip_quotes; + /* Fall through. */ + default: + if (yyres) + yyres[yyn] = *yyp; + yyn++; + break; + + case '"': + if (yyres) + yyres[yyn] = '\0'; + return yyn; + } + do_not_strip_quotes: ; + } + + if (! yyres) + return strlen (yystr); + + return yystpcpy (yyres, yystr) - yyres; +} +# endif + +#endif /* !YYERROR_VERBOSE */ + /** State numbers, as in LALR(1) machine */ typedef int yyStateNum; @@ -564,15 +677,26 @@ typedef struct yyGLRStack yyGLRStack; typedef struct yyGLRStateSet yyGLRStateSet; struct yyGLRState { + /** Type tag: always true. */ yybool yyisState; + /** Type tag for yysemantics. If true, yysval applies, otherwise + * yyfirstVal applies. */ yybool yyresolved; + /** Number of corresponding LALR(1) machine state. */ yyStateNum yylrState; + /** Preceding state in this stack */ yyGLRState* yypred; + /** Source position of the first token produced by my symbol */ size_t yyposn; union { + /** First in a chain of alternative reductions producing the + * non-terminal corresponding to this state, threaded through + * yynext. */ yySemanticOption* yyfirstVal; + /** Semantic value for this state. */ YYSTYPE yysval; } yysemantics; + /** Source location for this state. */ YYLTYPE yyloc; }; @@ -582,57 +706,65 @@ struct yyGLRStateSet { }; struct yySemanticOption { + /** Type tag: always false. */ yybool yyisState; + /** Rule number for this reduction */ yyRuleNum yyrule; + /** The last RHS state in the list of states to be reduced. */ yyGLRState* yystate; + /** Next sibling in chain of options. To facilitate merging, + * options are chained in decreasing order by address. */ yySemanticOption* yynext; }; +/** Type of the items in the GLR stack. The yyisState field + * indicates which item of the union is valid. */ union yyGLRStackItem { yyGLRState yystate; yySemanticOption yyoption; }; struct yyGLRStack { - int yyerrflag; int yyerrState; +]b4_location_if([[ /* To compute the location of the error token. */ + yyGLRStackItem yyerror_range[3];]])[ ]b4_pure_if( [ int yyerrcnt; int yyrawchar; ])[ yySymbol* yytokenp; - jmp_buf yyexception_buffer; + YYJMP_BUF yyexception_buffer; yyGLRStackItem* yyitems; yyGLRStackItem* yynextFree; - int yyspaceLeft; + size_t yyspaceLeft; yyGLRState* yysplitPoint; yyGLRState* yylastDeleted; yyGLRStateSet yytops; }; -static void yyinitGLRStack (yyGLRStack* yystack, size_t yysize); -static void yyexpandGLRStack (yyGLRStack* yystack]b4_pure_formals[); -static void yyfreeGLRStack (yyGLRStack* yystack); +static void yyexpandGLRStack (yyGLRStack* yystack); +static void yyFail (yyGLRStack* yystack]b4_pure_formals[, const char* yymsg) + __attribute__ ((__noreturn__)); static void -yyFail (yyGLRStack* yystack]b4_pure_formals[, const char* yyformat, ...) +yyFail (yyGLRStack* yystack]b4_pure_formals[, const char* yymsg) { - yystack->yyerrflag = 1; - if (yyformat != NULL) - { - char yymsg[256]; - va_list yyap; - va_start (yyap, yyformat); - vsprintf (yymsg, yyformat, yyap); - yyerror (]b4_yyerror_args[yymsg); - } - longjmp (yystack->yyexception_buffer, 1); + if (yymsg != NULL) + yyerror (]b4_yyerror_args[yymsg); + YYLONGJMP (yystack->yyexception_buffer, 1); +} + +static void yyMemoryExhausted (yyGLRStack* yystack) + __attribute__ ((__noreturn__)); +static void +yyMemoryExhausted (yyGLRStack* yystack) +{ + YYLONGJMP (yystack->yyexception_buffer, 2); } #if YYDEBUG || YYERROR_VERBOSE -/** A printable representation of TOKEN. Valid until next call to - * tokenName. */ +/** A printable representation of TOKEN. */ static inline const char* yytokenName (yySymbol yytoken) { @@ -647,7 +779,7 @@ yytokenName (yySymbol yytoken) * at YYVSP[YYLOW0].yystate.yypred. Leaves YYVSP[YYLOW1].yystate.yypred * containing the pointer to the next state in the chain. Assumes * YYLOW1 < YYLOW0. */ -static void yyfillin (yyGLRStackItem *, int, int) ATTRIBUTE_UNUSED; +static void yyfillin (yyGLRStackItem *, int, int) __attribute__ ((__unused__)); static void yyfillin (yyGLRStackItem *yyvsp, int yylow0, int yylow1) { @@ -668,7 +800,7 @@ yyfillin (yyGLRStackItem *yyvsp, int yylow0, int yylow1) YYVSP[YYLOW1 .. *YYLOW-1] as in yyfillin and set *YYLOW = YYLOW1. For convenience, always return YYLOW1. */ static inline int yyfill (yyGLRStackItem *, int *, int, yybool) - ATTRIBUTE_UNUSED; + __attribute__ ((__unused__)); static inline int yyfill (yyGLRStackItem *yyvsp, int *yylow, int yylow1, yybool yynormal) { @@ -687,10 +819,13 @@ yyfill (yyGLRStackItem *yyvsp, int *yylow, int yylow1, yybool yynormal) * yyerr for YYERROR, yyabort for YYABORT. */ static YYRESULTTAG yyuserAction (yyRuleNum yyn, int yyrhslen, yyGLRStackItem* yyvsp, - YYSTYPE* yyvalp, YYLTYPE* yylocp, yyGLRStack* yystack + YYSTYPE* yyvalp, + YYLTYPE* YYOPTIONAL_LOC (yylocp), + yyGLRStack* yystack ]b4_user_formals[) { - yybool yynormal ATTRIBUTE_UNUSED = (yystack->yysplitPoint == NULL); + yybool yynormal __attribute__ ((__unused__)) = + (yystack->yysplitPoint == NULL); int yylow; # undef yyerrok @@ -709,25 +844,21 @@ yyuserAction (yyRuleNum yyn, int yyrhslen, yyGLRStackItem* yyvsp, # define YYFILL(N) yyfill (yyvsp, &yylow, N, yynormal) # undef YYBACKUP # define YYBACKUP(Token, Value) \ - return yyerror (]b4_yyerror_args["syntax error: cannot back up"), \ + return yyerror (]b4_yyerror_args[YY_("syntax error: cannot back up")), \ yyerrok, yyerr yylow = 1; if (yyrhslen == 0) - { - *yyvalp = yyval_default; - *yylocp = yyloc_default; - } + *yyvalp = yyval_default; else - { - *yyvalp = yyvsp[YYFILL (1-yyrhslen)].yystate.yysemantics.yysval; - YYLLOC_DEFAULT (*yylocp, yyvsp - yyrhslen, yyrhslen); - } - -] + *yyvalp = yyvsp[YYFILL (1-yyrhslen)].yystate.yysemantics.yysval; + YYLLOC_DEFAULT (*yylocp, yyvsp - yyrhslen, yyrhslen); +]b4_location_if([[ yystack->yyerror_range[1].yystate.yyloc = *yylocp; +]]) switch (yyn) { b4_actions + default: break; } return yyok; @@ -753,6 +884,7 @@ yyuserMerge (int yyn, YYSTYPE* yy0, YYSTYPE* yy1) switch (yyn) { b4_mergers + default: break; } } [ @@ -760,13 +892,44 @@ yyuserMerge (int yyn, YYSTYPE* yy0, YYSTYPE* yy1) ]b4_yydestruct_generate([b4_c_ansi_function_def])[ -/** Number of symbols composing the right hand side of rule #RULE. */ +/** Number of symbols composing the right hand side of rule #RULE. */ static inline int yyrhsLength (yyRuleNum yyrule) { return yyr2[yyrule]; } +static void +yydestroyGLRState (char const *yymsg, yyGLRState *yys) +{ + if (yys->yyresolved) + yydestruct (yymsg, yystos[yys->yylrState], + &yys->yysemantics.yysval]b4_location_if([, &yys->yyloc])[); + else + { +#if YYDEBUG + if (yydebug) + { + YYFPRINTF (stderr, "%s unresolved ", yymsg); + yysymprint (stderr, yystos[yys->yylrState], + &yys->yysemantics.yysval]b4_location_if([, &yys->yyloc])[); + YYFPRINTF (stderr, "\n"); + } +#endif + + if (yys->yysemantics.yyfirstVal) + { + yySemanticOption *yyoption = yys->yysemantics.yyfirstVal; + yyGLRState *yyrh; + int yyn; + for (yyrh = yyoption->yystate, yyn = yyrhsLength (yyoption->yyrule); + yyn > 0; + yyrh = yyrh->yypred, yyn -= 1) + yydestroyGLRState (yymsg, yyrh); + } + } +} + /** Left-hand-side symbol for rule #RULE. */ static inline yySymbol yylhsNonterm (yyRuleNum yyrule) @@ -856,7 +1019,7 @@ yyisErrorAction (int yyaction) static void yyaddDeferredAction (yyGLRStack* yystack, yyGLRState* yystate, - yyGLRState* rhs, yyRuleNum yyrule]b4_pure_formals[) + yyGLRState* rhs, yyRuleNum yyrule) { yySemanticOption* yynewItem; yynewItem = &yystack->yynextFree->yyoption; @@ -868,19 +1031,22 @@ yyaddDeferredAction (yyGLRStack* yystack, yyGLRState* yystate, yynewItem->yynext = yystate->yysemantics.yyfirstVal; yystate->yysemantics.yyfirstVal = yynewItem; if (yystack->yyspaceLeft < YYHEADROOM) - yyexpandGLRStack (yystack]b4_pure_args[); + yyexpandGLRStack (yystack); } /* GLRStacks */ /** Initialize SET to a singleton set containing an empty stack. */ -static void +static yybool yyinitStateSet (yyGLRStateSet* yyset) { yyset->yysize = 1; yyset->yycapacity = 16; yyset->yystates = (yyGLRState**) YYMALLOC (16 * sizeof yyset->yystates[0]); + if (! yyset->yystates) + return yyfalse; yyset->yystates[0] = NULL; + return yytrue; } static void yyfreeStateSet (yyGLRStateSet* yyset) @@ -890,18 +1056,20 @@ static void yyfreeStateSet (yyGLRStateSet* yyset) /** Initialize STACK to a single empty stack, with total maximum * capacity for all stacks of SIZE. */ -static void +static yybool yyinitGLRStack (yyGLRStack* yystack, size_t yysize) { - yystack->yyerrflag = 0; yystack->yyerrState = 0; yynerrs = 0; yystack->yyspaceLeft = yysize; - yystack->yynextFree = yystack->yyitems = + yystack->yyitems = (yyGLRStackItem*) YYMALLOC (yysize * sizeof yystack->yynextFree[0]); + if (!yystack->yyitems) + return yyfalse; + yystack->yynextFree = yystack->yyitems; yystack->yysplitPoint = NULL; yystack->yylastDeleted = NULL; - yyinitStateSet (&yystack->yytops); + return yyinitStateSet (&yystack->yytops); } #define YYRELOC(YYFROMITEMS,YYTOITEMS,YYX,YYTYPE) \ @@ -913,21 +1081,23 @@ yyinitGLRStack (yyGLRStack* yystack, size_t yysize) allocation, so that we can avoid having external pointers exist across an allocation. */ static void -yyexpandGLRStack (yyGLRStack* yystack]b4_pure_formals[) +yyexpandGLRStack (yyGLRStack* yystack) { #if YYSTACKEXPANDABLE - yyGLRStack yynewStack; + yyGLRStackItem* yynewItems; yyGLRStackItem* yyp0, *yyp1; size_t yysize, yynewSize; size_t yyn; yysize = yystack->yynextFree - yystack->yyitems; if (YYMAXDEPTH <= yysize) - yyFail (yystack][]b4_pure_args[, "parser stack overflow"); + yyMemoryExhausted (yystack); yynewSize = 2*yysize; if (YYMAXDEPTH < yynewSize) yynewSize = YYMAXDEPTH; - yyinitGLRStack (&yynewStack, yynewSize); - for (yyp0 = yystack->yyitems, yyp1 = yynewStack.yyitems, yyn = yysize; + yynewItems = (yyGLRStackItem*) YYMALLOC (yynewSize * sizeof yynewItems[0]); + if (! yynewItems) + yyMemoryExhausted (yystack); + for (yyp0 = yystack->yyitems, yyp1 = yynewItems, yyn = yysize; 0 < yyn; yyn -= 1, yyp0 += 1, yyp1 += 1) { @@ -954,22 +1124,21 @@ yyexpandGLRStack (yyGLRStack* yystack]b4_pure_formals[) } } if (yystack->yysplitPoint != NULL) - yystack->yysplitPoint = YYRELOC (yystack->yyitems, yynewStack.yyitems, + yystack->yysplitPoint = YYRELOC (yystack->yyitems, yynewItems, yystack->yysplitPoint, yystate); for (yyn = 0; yyn < yystack->yytops.yysize; yyn += 1) if (yystack->yytops.yystates[yyn] != NULL) yystack->yytops.yystates[yyn] = - YYRELOC (yystack->yyitems, yynewStack.yyitems, + YYRELOC (yystack->yyitems, yynewItems, yystack->yytops.yystates[yyn], yystate); YYFREE (yystack->yyitems); - yystack->yyitems = yynewStack.yyitems; - yystack->yynextFree = yynewStack.yynextFree + yysize; - yystack->yyspaceLeft = yynewStack.yyspaceLeft - yysize; + yystack->yyitems = yynewItems; + yystack->yynextFree = yynewItems + yysize; + yystack->yyspaceLeft = yynewSize - yysize; #else - - yyFail (yystack][]b4_pure_args[, "parser stack overflow"); + yyMemoryExhausted (yystack); #endif } @@ -992,7 +1161,7 @@ yyupdateSplit (yyGLRStack* yystack, yyGLRState* yys) /** Invalidate stack #K in STACK. */ static inline void -yymarkStackDeleted (yyGLRStack* yystack, int yyk) +yymarkStackDeleted (yyGLRStack* yystack, size_t yyk) { if (yystack->yytops.yystates[yyk] != NULL) yystack->yylastDeleted = yystack->yytops.yystates[yyk]; @@ -1045,8 +1214,9 @@ yyremoveDeletes (yyGLRStack* yystack) /** Shift to a new state on stack #K of STACK, corresponding to LR state * LRSTATE, at input position POSN, with (resolved) semantic value SVAL. */ static inline void -yyglrShift (yyGLRStack* yystack, int yyk, yyStateNum yylrState, size_t yyposn, - YYSTYPE yysval, YYLTYPE* yylocp]b4_user_formals[) +yyglrShift (yyGLRStack* yystack, size_t yyk, yyStateNum yylrState, + size_t yyposn, + YYSTYPE yysval, YYLTYPE* yylocp) { yyGLRStackItem* yynewItem; @@ -1062,15 +1232,15 @@ yyglrShift (yyGLRStack* yystack, int yyk, yyStateNum yylrState, size_t yyposn, yynewItem->yystate.yysemantics.yysval = yysval; yynewItem->yystate.yyloc = *yylocp; if (yystack->yyspaceLeft < YYHEADROOM) - yyexpandGLRStack (yystack]b4_pure_args[); + yyexpandGLRStack (yystack); } /** Shift stack #K of YYSTACK, to a new state corresponding to LR * state YYLRSTATE, at input position YYPOSN, with the (unresolved) * semantic value of YYRHS under the action for YYRULE. */ static inline void -yyglrShiftDefer (yyGLRStack* yystack, int yyk, yyStateNum yylrState, - size_t yyposn, yyGLRState* rhs, yyRuleNum yyrule]b4_pure_formals[) +yyglrShiftDefer (yyGLRStack* yystack, size_t yyk, yyStateNum yylrState, + size_t yyposn, yyGLRState* rhs, yyRuleNum yyrule) { yyGLRStackItem* yynewItem; @@ -1084,7 +1254,7 @@ yyglrShiftDefer (yyGLRStack* yystack, int yyk, yyStateNum yylrState, yystack->yytops.yystates[yyk] = &yynewItem->yystate; yystack->yynextFree += 1; yystack->yyspaceLeft -= 1; - yyaddDeferredAction (yystack, &yynewItem->yystate, rhs, yyrule]b4_pure_args[); + yyaddDeferredAction (yystack, &yynewItem->yystate, rhs, yyrule); } /** Pop the symbols consumed by reduction #RULE from the top of stack @@ -1094,7 +1264,7 @@ yyglrShiftDefer (yyGLRStack* yystack, int yyk, yyStateNum yylrState, * and *LOCP to the computed location (if any). Return value is as * for userAction. */ static inline YYRESULTTAG -yydoAction (yyGLRStack* yystack, int yyk, yyRuleNum yyrule, +yydoAction (yyGLRStack* yystack, size_t yyk, yyRuleNum yyrule, YYSTYPE* yyvalp, YYLTYPE* yylocp]b4_user_formals[) { int yynrhs = yyrhsLength (yyrule); @@ -1169,7 +1339,7 @@ yy_reduce_print (size_t yyk, yyRuleNum yyrule) */ static inline YYRESULTTAG yyglrReduce (yyGLRStack* yystack, size_t yyk, yyRuleNum yyrule, - yybool yyforceEval]b4_pure_formals[) + yybool yyforceEval]b4_user_formals[) { size_t yyposn = yystack->yytops.yystates[yyk]->yyposn; @@ -1183,7 +1353,7 @@ yyglrReduce (yyGLRStack* yystack, size_t yyk, yyRuleNum yyrule, yyglrShift (yystack, yyk, yyLRgotoState (yystack->yytops.yystates[yyk]->yylrState, yylhsNonterm (yyrule)), - yyposn, yysval, &yyloc]b4_user_args[); + yyposn, yysval, &yyloc); } else { @@ -1212,7 +1382,7 @@ yyglrReduce (yyGLRStack* yystack, size_t yyk, yyRuleNum yyrule, { if (yyp->yylrState == yynewLRState && yyp->yypred == yys) { - yyaddDeferredAction (yystack, yyp, yys0, yyrule]b4_pure_args[); + yyaddDeferredAction (yystack, yyp, yys0, yyrule); yymarkStackDeleted (yystack, yyk); YYDPRINTF ((stderr, "Merging stack %lu into stack %lu.\n", (unsigned long int) yyk, @@ -1223,13 +1393,13 @@ yyglrReduce (yyGLRStack* yystack, size_t yyk, yyRuleNum yyrule, } } yystack->yytops.yystates[yyk] = yys; - yyglrShiftDefer (yystack, yyk, yynewLRState, yyposn, yys0, yyrule]b4_pure_args[); + yyglrShiftDefer (yystack, yyk, yynewLRState, yyposn, yys0, yyrule); } return yyok; } -static int -yysplitStack (yyGLRStack* yystack, int yyk) +static size_t +yysplitStack (yyGLRStack* yystack, size_t yyk) { if (yystack->yysplitPoint == NULL) { @@ -1238,11 +1408,15 @@ yysplitStack (yyGLRStack* yystack, int yyk) } if (yystack->yytops.yysize >= yystack->yytops.yycapacity) { - yystack->yytops.yycapacity *= 2; - yystack->yytops.yystates = - (yyGLRState**) YYREALLOC (yystack->yytops.yystates, - (yystack->yytops.yycapacity - * sizeof yystack->yytops.yystates[0])); + yyGLRState** yynewStates; + if (! ((yystack->yytops.yycapacity + <= (YYSIZEMAX / (2 * sizeof yynewStates[0]))) + && (yynewStates = + (yyGLRState**) YYREALLOC (yystack->yytops.yystates, + ((yystack->yytops.yycapacity *= 2) + * sizeof yynewStates[0]))))) + yyMemoryExhausted (yystack); + yystack->yytops.yystates = yynewStates; } yystack->yytops.yystates[yystack->yytops.yysize] = yystack->yytops.yystates[yyk]; @@ -1272,9 +1446,8 @@ yyidenticalOptions (yySemanticOption* yyy0, yySemanticOption* yyy1) return yyfalse; } -/** Assuming identicalOptions (Y0,Y1), (destructively) merge the - * alternative semantic values for the RHS-symbols of Y1 into the - * corresponding semantic value sets of the symbols of Y0. */ +/** Assuming identicalOptions (Y0,Y1), destructively merge the + * alternative semantic values for the RHS-symbols of Y1 and Y0. */ static void yymergeOptionSets (yySemanticOption* yyy0, yySemanticOption* yyy1) { @@ -1284,16 +1457,46 @@ yymergeOptionSets (yySemanticOption* yyy0, yySemanticOption* yyy1) yyn = yyrhsLength (yyy0->yyrule); yyn > 0; yys0 = yys0->yypred, yys1 = yys1->yypred, yyn -= 1) - if (yys0 == yys1) - break; - else if (! yys0->yyresolved && ! yys1->yyresolved) - { - yySemanticOption* yyz; - for (yyz = yys0->yysemantics.yyfirstVal; yyz->yynext != NULL; - yyz = yyz->yynext) - continue; - yyz->yynext = yys1->yysemantics.yyfirstVal; - } + { + if (yys0 == yys1) + break; + else if (yys0->yyresolved) + { + yys1->yyresolved = yytrue; + yys1->yysemantics.yysval = yys0->yysemantics.yysval; + } + else if (yys1->yyresolved) + { + yys0->yyresolved = yytrue; + yys0->yysemantics.yysval = yys1->yysemantics.yysval; + } + else + { + yySemanticOption** yyz0p; + yySemanticOption* yyz1; + yyz0p = &yys0->yysemantics.yyfirstVal; + yyz1 = yys1->yysemantics.yyfirstVal; + while (yytrue) + { + if (yyz1 == *yyz0p || yyz1 == NULL) + break; + else if (*yyz0p == NULL) + { + *yyz0p = yyz1; + break; + } + else if (*yyz0p < yyz1) + { + yySemanticOption* yyz = *yyz0p; + *yyz0p = yyz1; + yyz1 = yyz1->yynext; + (*yyz0p)->yynext = yyz; + } + yyz0p = &(*yyz0p)->yynext; + } + yys1->yysemantics.yyfirstVal = yys0->yysemantics.yyfirstVal; + } + } } /** Y0 and Y1 represent two possible actions to take in a given @@ -1411,6 +1614,9 @@ yyreportTree (yySemanticOption* yyx, int yyindent) } #endif +static void yyreportAmbiguity (yySemanticOption* yyx0, yySemanticOption* yyx1, + yyGLRStack* yystack]b4_pure_formals[) + __attribute__ ((__noreturn__)); static void yyreportAmbiguity (yySemanticOption* yyx0, yySemanticOption* yyx1, yyGLRStack* yystack]b4_pure_formals[) @@ -1427,7 +1633,7 @@ yyreportAmbiguity (yySemanticOption* yyx0, yySemanticOption* yyx1, yyreportTree (yyx1, 2); YYFPRINTF (stderr, "\n"); #endif - yyFail (yystack][]b4_pure_args[, "ambiguity detected"); + yyFail (yystack][]b4_pure_args[, YY_("syntax is ambiguous")); } @@ -1438,35 +1644,49 @@ yyresolveValue (yySemanticOption* yyoptionList, yyGLRStack* yystack, YYSTYPE* yyvalp, YYLTYPE* yylocp]b4_user_formals[) { yySemanticOption* yybest; - yySemanticOption* yyp; - int yymerge; + yySemanticOption** yypp; + yybool yymerge; yybest = yyoptionList; - yymerge = 0; - for (yyp = yyoptionList->yynext; yyp != NULL; yyp = yyp->yynext) + yymerge = yyfalse; + for (yypp = &yyoptionList->yynext; *yypp != NULL; ) { + yySemanticOption* yyp = *yypp; + if (yyidenticalOptions (yybest, yyp)) - yymergeOptionSets (yybest, yyp); + { + yymergeOptionSets (yybest, yyp); + *yypp = yyp->yynext; + } else - switch (yypreference (yybest, yyp)) - { - case 0: - yyreportAmbiguity (yybest, yyp, yystack]b4_pure_args[); - break; - case 1: - yymerge = 1; - break; - case 2: - break; - case 3: - yybest = yyp; - yymerge = 0; - break; - } + { + switch (yypreference (yybest, yyp)) + { + case 0: + yyreportAmbiguity (yybest, yyp, yystack]b4_pure_args[); + break; + case 1: + yymerge = yytrue; + break; + case 2: + break; + case 3: + yybest = yyp; + yymerge = yyfalse; + break; + default: + /* This cannot happen so it is not worth a YYASSERT (yyfalse), + but some compilers complain if the default case is + omitted. */ + break; + } + yypp = &yyp->yynext; + } } if (yymerge) { + yySemanticOption* yyp; int yyprec = yydprec[yybest->yyrule]; YYCHK (yyresolveAction (yybest, yystack, yyvalp, yylocp]b4_user_args[)); for (yyp = yybest->yynext; yyp != NULL; yyp = yyp->yynext) @@ -1534,9 +1754,9 @@ yycompressStack (yyGLRStack* yystack) } static YYRESULTTAG -yyprocessOneStack (yyGLRStack* yystack, int yyk, +yyprocessOneStack (yyGLRStack* yystack, size_t yyk, size_t yyposn, YYSTYPE* yylvalp, YYLTYPE* yyllocp - ]b4_user_formals[) + ]b4_pure_formals[) { int yyaction; const short int* yyconflicts; @@ -1546,7 +1766,8 @@ yyprocessOneStack (yyGLRStack* yystack, int yyk, while (yystack->yytops.yystates[yyk] != NULL) { yyStateNum yystate = yystack->yytops.yystates[yyk]->yylrState; - YYDPRINTF ((stderr, "Stack %d Entering state %d\n", yyk, yystate)); + YYDPRINTF ((stderr, "Stack %lu Entering state %d\n", + (unsigned long int) yyk, yystate)); YYASSERT (yystate != YYFINAL); @@ -1555,11 +1776,12 @@ yyprocessOneStack (yyGLRStack* yystack, int yyk, yyrule = yydefaultAction (yystate); if (yyrule == 0) { - YYDPRINTF ((stderr, "Stack %d dies.\n", yyk)); + YYDPRINTF ((stderr, "Stack %lu dies.\n", + (unsigned long int) yyk)); yymarkStackDeleted (yystack, yyk); return yyok; } - YYCHK (yyglrReduce (yystack, yyk, yyrule, yyfalse]b4_lpure_args[)); + YYCHK (yyglrReduce (yystack, yyk, yyrule, yyfalse]b4_user_args[)); } else { @@ -1568,40 +1790,43 @@ yyprocessOneStack (yyGLRStack* yystack, int yyk, YYDPRINTF ((stderr, "Reading a token: ")); yychar = YYLEX; *yytokenp = YYTRANSLATE (yychar); - YYDSYMPRINTF ("Next token is", *yytokenp, yylvalp, yyllocp); + YY_SYMBOL_PRINT ("Next token is", *yytokenp, yylvalp, yyllocp); } yygetLRActions (yystate, *yytokenp, &yyaction, &yyconflicts); while (*yyconflicts != 0) { - int yynewStack = yysplitStack (yystack, yyk); - YYDPRINTF ((stderr, "Splitting off stack %d from %d.\n", - yynewStack, yyk)); + size_t yynewStack = yysplitStack (yystack, yyk); + YYDPRINTF ((stderr, "Splitting off stack %lu from %lu.\n", + (unsigned long int) yynewStack, + (unsigned long int) yyk)); YYCHK (yyglrReduce (yystack, yynewStack, - *yyconflicts, yyfalse]b4_lpure_args[)); + *yyconflicts, yyfalse]b4_user_args[)); YYCHK (yyprocessOneStack (yystack, yynewStack, yyposn, - yylvalp, yyllocp]b4_user_args[)); + yylvalp, yyllocp]b4_pure_args[)); yyconflicts += 1; } if (yyisShiftAction (yyaction)) { - YYDPRINTF ((stderr, "Shifting token %s on stack %d, ", - yytokenName (*yytokenp), yyk)); + YYDPRINTF ((stderr, "On stack %lu, ", (unsigned long int) yyk)); + YY_SYMBOL_PRINT ("shifting", *yytokenp, yylvalp, yyllocp); yyglrShift (yystack, yyk, yyaction, yyposn+1, - *yylvalp, yyllocp]b4_user_args[); - YYDPRINTF ((stderr, "which is now in state #%d\n", + *yylvalp, yyllocp); + YYDPRINTF ((stderr, "Stack %lu now in state #%d\n", + (unsigned long int) yyk, yystack->yytops.yystates[yyk]->yylrState)); break; } else if (yyisErrorAction (yyaction)) { - YYDPRINTF ((stderr, "Stack %d dies.\n", yyk)); + YYDPRINTF ((stderr, "Stack %lu dies.\n", + (unsigned long int) yyk)); yymarkStackDeleted (yystack, yyk); break; } else - YYCHK (yyglrReduce (yystack, yyk, -yyaction, yyfalse]b4_lpure_args[)); + YYCHK (yyglrReduce (yystack, yyk, -yyaction, yyfalse]b4_user_args[)); } } return yyok; @@ -1623,10 +1848,24 @@ yyreportSyntaxError (yyGLRStack* yystack, yyn = yypact[yystack->yytops.yystates[0]->yylrState]; if (YYPACT_NINF < yyn && yyn < YYLAST) { - size_t yysize = 0; - const char* yyprefix; - char* yymsg; + size_t yysize0 = yytnamerr (NULL, yytokenName (*yytokenp)); + size_t yysize = yysize0; + size_t yysize1; + yybool yysize_overflow = yyfalse; + char* yymsg = NULL; + enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 }; + char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM]; int yyx; + char *yyfmt; + char const *yyf; + static char const yyunexpected[] = "syntax error, unexpected %s"; + static char const yyexpecting[] = ", expecting %s"; + static char const yyor[] = " or %s"; + char yyformat[sizeof yyunexpected + + sizeof yyexpecting - 1 + + ((YYERROR_VERBOSE_ARGS_MAXIMUM - 2) + * (sizeof yyor - 1))]; + char const *yyprefix = yyexpecting; /* Start YYX at -YYN if negative to avoid negative indexes in YYCHECK. */ @@ -1635,61 +1874,78 @@ yyreportSyntaxError (yyGLRStack* yystack, /* Stay within bounds of both yycheck and yytname. */ int yychecklim = YYLAST - yyn; int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS; - int yycount = 0; + int yycount = 1; + + yyarg[0] = yytokenName (*yytokenp); + yyfmt = yystpcpy (yyformat, yyunexpected); - yyprefix = ", expecting "; for (yyx = yyxbegin; yyx < yyxend; ++yyx) if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR) { - yysize += strlen (yyprefix) + strlen (yytokenName (yyx)); - yycount += 1; - if (yycount == 5) + if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM) { - yysize = 0; + yycount = 1; + yysize = yysize0; + yyformat[sizeof yyunexpected - 1] = '\0'; break; } - yyprefix = " or "; + yyarg[yycount++] = yytokenName (yyx); + yysize1 = yysize + yytnamerr (NULL, yytokenName (yyx)); + yysize_overflow |= yysize1 < yysize; + yysize = yysize1; + yyfmt = yystpcpy (yyfmt, yyprefix); + yyprefix = yyor; } - yysize += (sizeof ("syntax error, unexpected ") - + strlen (yytokenName (*yytokenp))); - yymsg = (char*) YYMALLOC (yysize); - if (yymsg != 0) + + yyf = YY_(yyformat); + yysize1 = yysize + strlen (yyf); + yysize_overflow |= yysize1 < yysize; + yysize = yysize1; + + if (!yysize_overflow) + yymsg = (char *) YYMALLOC (yysize); + + if (yymsg) { - char* yyp = yymsg; - sprintf (yyp, "syntax error%s%s", - (*yytokenp == YYEMPTY ? "" : ", unexpected "), - yytokenName (*yytokenp)); - yyp += strlen (yyp); - if (yycount < 5) + char *yyp = yymsg; + int yyi = 0; + while ((*yyp = *yyf)) { - yyprefix = ", expecting "; - for (yyx = yyxbegin; yyx < yyxend; ++yyx) - if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR) - { - sprintf (yyp, "%s%s", yyprefix, yytokenName (yyx)); - yyp += strlen (yyp); - yyprefix = " or "; - } + if (*yyp == '%' && yyf[1] == 's' && yyi < yycount) + { + yyp += yytnamerr (yyp, yyarg[yyi++]); + yyf += 2; + } + else + { + yyp++; + yyf++; + } } yyerror (]b4_lyyerror_args[yymsg); YYFREE (yymsg); } else - yyerror (]b4_lyyerror_args["syntax error; also virtual memory exhausted"); + { + yyerror (]b4_lyyerror_args[YY_("syntax error")); + yyMemoryExhausted (yystack); + } } else #endif /* YYERROR_VERBOSE */ - yyerror (]b4_lyyerror_args["syntax error"); + yyerror (]b4_lyyerror_args[YY_("syntax error")); yynerrs += 1; } } /* Recover from a syntax error on YYSTACK, assuming that YYTOKENP, YYLVALP, and YYLLOCP point to the syntactic category, semantic - value, and location of the lookahead. */ + value, and location of the look-ahead. */ static void yyrecoverSyntaxError (yyGLRStack* yystack, - YYSTYPE* yylvalp, YYLTYPE* yyllocp]b4_user_formals[) + YYSTYPE* yylvalp, + YYLTYPE* YYOPTIONAL_LOC (yyllocp) + ]b4_user_formals[) { yySymbol* const yytokenp = yystack->yytokenp; size_t yyk; @@ -1701,31 +1957,23 @@ yyrecoverSyntaxError (yyGLRStack* yystack, while (yytrue) { if (*yytokenp == YYEOF) - { - /* Now pop stack until empty and fail. */ - while (yystack->yytops.yystates[0] != NULL) - { - yyGLRState *yys = yystack->yytops.yystates[0]; - YYDSYMPRINTF ("Error: popping", - yystos[yys->yylrState], - &yys->yysemantics.yysval, &yys->yyloc); - yydestruct (yystos[yys->yylrState], - &yys->yysemantics.yysval]b4_location_if([, &yys->yyloc])[); - yystack->yytops.yystates[0] = yys->yypred; - yystack->yynextFree -= 1; - yystack->yyspaceLeft += 1; - } - yyFail (yystack][]b4_lpure_args[, NULL); - } + yyFail (yystack][]b4_lpure_args[, NULL); if (*yytokenp != YYEMPTY) - { - YYDSYMPRINTF ("Error: discarding", *yytokenp, yylvalp, yyllocp); - yydestruct (*yytokenp, yylvalp]b4_location_if([, yyllocp])[); + {]b4_location_if([[ + /* We throw away the lookahead, but the error range + of the shifted error token must take it into account. */ + yyGLRState *yys = yystack->yytops.yystates[0]; + yyGLRStackItem yyerror_range[3]; + yyerror_range[1].yystate.yyloc = yys->yyloc; + yyerror_range[2].yystate.yyloc = *yyllocp; + YYLLOC_DEFAULT (yys->yyloc, yyerror_range, 2);]])[ + yydestruct ("Error: discarding", + *yytokenp, yylvalp]b4_location_if([, yyllocp])[); } YYDPRINTF ((stderr, "Reading a token: ")); yychar = YYLEX; *yytokenp = YYTRANSLATE (yychar); - YYDSYMPRINTF ("Next token is", *yytokenp, yylvalp, yyllocp); + YY_SYMBOL_PRINT ("Next token is", *yytokenp, yylvalp, yyllocp); yyj = yypact[yystack->yytops.yystates[0]->yylrState]; if (yyis_pact_ninf (yyj)) return; @@ -1762,17 +2010,20 @@ yyrecoverSyntaxError (yyGLRStack* yystack, if (0 <= yyj && yyj <= YYLAST && yycheck[yyj] == YYTERROR && yyisShiftAction (yytable[yyj])) { - YYDPRINTF ((stderr, "Shifting error token, ")); + /* Shift the error token having adjusted its location. */ + YYLTYPE yyerrloc;]b4_location_if([[ + yystack->yyerror_range[2].yystate.yyloc = *yyllocp; + YYLLOC_DEFAULT (yyerrloc, yystack->yyerror_range, 2);]])[ + YY_SYMBOL_PRINT ("Shifting", yystos[yytable[yyj]], + yylvalp, &yyerrloc); yyglrShift (yystack, 0, yytable[yyj], - yys->yyposn, *yylvalp, yyllocp]b4_user_args[); + yys->yyposn, *yylvalp, &yyerrloc); + yys = yystack->yytops.yystates[0]; break; } } - YYDSYMPRINTF ("Error: popping", - yystos[yys->yylrState], - &yys->yysemantics.yysval, &yys->yyloc); - yydestruct (yystos[yys->yylrState], - &yys->yysemantics.yysval]b4_location_if([, &yys->yyloc])[); +]b4_location_if([[ yystack->yyerror_range[1].yystate.yyloc = yys->yyloc;]])[ + yydestroyGLRState ("Error: popping", yys); yystack->yytops.yystates[0] = yys->yypred; yystack->yynextFree -= 1; yystack->yyspaceLeft += 1; @@ -1784,16 +2035,16 @@ yyrecoverSyntaxError (yyGLRStack* yystack, #define YYCHK1(YYE) \ do { \ switch (YYE) { \ - default: \ + case yyok: \ break; \ case yyabort: \ - yystack.yyerrflag = 1; \ - goto yyDone; \ + goto yyabortlab; \ case yyaccept: \ - yystack.yyerrflag = 0; \ - goto yyDone; \ + goto yyacceptlab; \ case yyerr: \ goto yyuser_error; \ + default: \ + goto yybuglab; \ } \ } while (0) @@ -1804,6 +2055,7 @@ yyrecoverSyntaxError (yyGLRStack* yystack, ]b4_c_ansi_function_def([yyparse], [int], b4_parse_param)[ { + int yyresult; yySymbol yytoken; yyGLRStack yystack; size_t yyposn; @@ -1818,16 +2070,37 @@ yyrecoverSyntaxError (yyGLRStack* yystack, YYSTYPE* const yylvalp = &yylval; YYLTYPE* const yyllocp = &yylloc; - yyinitGLRStack (&yystack, YYINITDEPTH); - yystack.yytokenp = &yytoken; - YYDPRINTF ((stderr, "Starting parse\n")); - if (setjmp (yystack.yyexception_buffer) != 0) - goto yyDone; - - yyglrShift (&yystack, 0, 0, 0, yyval_default, &yyloc_default]b4_user_args[); yytoken = YYEMPTY; + yylval = yyval_default; +]b4_location_if([ +#if YYLTYPE_IS_TRIVIAL + yylloc.first_line = yylloc.last_line = 1; + yylloc.first_column = yylloc.last_column = 0; +#endif +]) +m4_ifdef([b4_initial_action], [ +m4_pushdef([b4_at_dollar], [yylloc])dnl +m4_pushdef([b4_dollar_dollar], [yylval])dnl + /* User initialization code. */ + b4_initial_action +m4_popdef([b4_dollar_dollar])dnl +m4_popdef([b4_at_dollar])dnl +/* Line __line__ of glr.c. */ +b4_syncline([@oline@], [@ofile@])])dnl +[ + if (! yyinitGLRStack (&yystack, YYINITDEPTH)) + goto yyexhaustedlab; + switch (YYSETJMP (yystack.yyexception_buffer)) + { + case 0: break; + case 1: goto yyabortlab; + case 2: goto yyexhaustedlab; + default: goto yybuglab; + } + yystack.yytokenp = &yytoken; + yyglrShift (&yystack, 0, 0, 0, yylval, &yylloc); yyposn = 0; while (yytrue) @@ -1845,16 +2118,17 @@ yyrecoverSyntaxError (yyGLRStack* yystack, yyStateNum yystate = yystack.yytops.yystates[0]->yylrState; YYDPRINTF ((stderr, "Entering state %d\n", yystate)); if (yystate == YYFINAL) - goto yyDone; + goto yyacceptlab; if (yyisDefaultedState (yystate)) { yyrule = yydefaultAction (yystate); if (yyrule == 0) { +]b4_location_if([[ yystack.yyerror_range[1].yystate.yyloc = *yyllocp;]])[ yyreportSyntaxError (&yystack, yylvalp, yyllocp]b4_user_args[); goto yyuser_error; } - YYCHK1 (yyglrReduce (&yystack, 0, yyrule, yytrue]b4_lpure_args[)); + YYCHK1 (yyglrReduce (&yystack, 0, yyrule, yytrue]b4_user_args[)); } else { @@ -1863,40 +2137,39 @@ yyrecoverSyntaxError (yyGLRStack* yystack, YYDPRINTF ((stderr, "Reading a token: ")); yychar = YYLEX; yytoken = YYTRANSLATE (yychar); - YYDSYMPRINTF ("Next token is", yytoken, yylvalp, yyllocp); + YY_SYMBOL_PRINT ("Next token is", yytoken, yylvalp, yyllocp); } yygetLRActions (yystate, yytoken, &yyaction, &yyconflicts); if (*yyconflicts != 0) break; if (yyisShiftAction (yyaction)) { - YYDPRINTF ((stderr, "Shifting token %s, ", - yytokenName (yytoken))); + YY_SYMBOL_PRINT ("Shifting", yytoken, yylvalp, yyllocp); if (yytoken != YYEOF) yytoken = YYEMPTY; yyposn += 1; - yyglrShift (&yystack, 0, yyaction, yyposn, - yylval, yyllocp]b4_user_args[); + yyglrShift (&yystack, 0, yyaction, yyposn, yylval, yyllocp); if (0 < yystack.yyerrState) yystack.yyerrState -= 1; } else if (yyisErrorAction (yyaction)) { +]b4_location_if([[ yystack.yyerror_range[1].yystate.yyloc = *yyllocp;]])[ yyreportSyntaxError (&yystack, yylvalp, yyllocp]b4_user_args[); goto yyuser_error; } else - YYCHK1 (yyglrReduce (&yystack, 0, -yyaction, yytrue]b4_lpure_args[)); + YYCHK1 (yyglrReduce (&yystack, 0, -yyaction, yytrue]b4_user_args[)); } } while (yytrue) { - int yys; - int yyn = yystack.yytops.yysize; + size_t yys; + size_t yyn = yystack.yytops.yysize; for (yys = 0; yys < yyn; yys += 1) YYCHK1 (yyprocessOneStack (&yystack, yys, yyposn, - yylvalp, yyllocp]b4_user_args[)); + yylvalp, yyllocp]b4_lpure_args[)); yytoken = YYEMPTY; yyposn += 1; yyremoveDeletes (&yystack); @@ -1904,9 +2177,10 @@ yyrecoverSyntaxError (yyGLRStack* yystack, { yyundeleteLastStack (&yystack); if (yystack.yytops.yysize == 0) - yyFail (&yystack][]b4_lpure_args[, "syntax error"); + yyFail (&yystack][]b4_lpure_args[, YY_("syntax error")); YYCHK1 (yyresolveStack (&yystack]b4_user_args[)); YYDPRINTF ((stderr, "Returning to deterministic operation.\n")); +]b4_location_if([[ yystack.yyerror_range[1].yystate.yyloc = *yyllocp;]])[ yyreportSyntaxError (&yystack, yylvalp, yyllocp]b4_user_args[); goto yyuser_error; } @@ -1923,16 +2197,56 @@ yyrecoverSyntaxError (yyGLRStack* yystack, yyrecoverSyntaxError (&yystack, yylvalp, yyllocp]b4_user_args[); yyposn = yystack.yytops.yystates[0]->yyposn; } - yyDone: - ; - yyfreeGLRStack (&yystack); - return yystack.yyerrflag; + yyacceptlab: + yyresult = 0; + goto yyreturn; + + yybuglab: + YYASSERT (yyfalse); + /* Fall through. */ + + yyabortlab: + yyresult = 1; + goto yyreturn; + + yyexhaustedlab: + yyerror (]b4_lyyerror_args[YY_("memory exhausted")); + yyresult = 2; + /* Fall through. */ + + yyreturn: + if (yytoken != YYEOF && yytoken != YYEMPTY) + yydestruct ("Cleanup: discarding lookahead", + yytoken, yylvalp]b4_location_if([, yyllocp])[); + + /* If the stack is well-formed, pop the stack until it is empty, + destroying its entries as we go. But free the stack regardless + of whether it is well-formed. */ + if (yystack.yyitems) + { + yyGLRState** yystates = yystack.yytops.yystates; + if (yystates) + while (yystates[0]) + { + yyGLRState *yys = yystates[0]; +]b4_location_if([[ yystack.yyerror_range[1].yystate.yyloc = yys->yyloc;]] +)[ yydestroyGLRState ("Cleanup: popping", yys); + yystates[0] = yys->yypred; + yystack.yynextFree -= 1; + yystack.yyspaceLeft += 1; + } + yyfreeGLRStack (&yystack); + } + + return yyresult; } /* DEBUGGING ONLY */ -static void yypstack (yyGLRStack* yystack, int yyk) ATTRIBUTE_UNUSED; -static void yypdumpstack (yyGLRStack* yystack) ATTRIBUTE_UNUSED; +#ifdef YYDEBUG +static void yypstack (yyGLRStack* yystack, size_t yyk) + __attribute__ ((__unused__)); +static void yypdumpstack (yyGLRStack* yystack) __attribute__ ((__unused__)); static void yy_yypstack (yyGLRState* yys) @@ -1956,7 +2270,7 @@ yypstates (yyGLRState* yyst) } static void -yypstack (yyGLRStack* yystack, int yyk) +yypstack (yyGLRStack* yystack, size_t yyk) { yypstates (yystack->yytops.yystates[yyk]); } @@ -1998,18 +2312,20 @@ yypdumpstack (yyGLRStack* yystack) (long int) YYINDEX (yystack->yytops.yystates[yyi])); fprintf (stderr, "\n"); } +#endif ] b4_epilogue m4_if(b4_defines_flag, 0, [], [@output @output_header_name@ -b4_copyright([Skeleton parser for GLR parsing with Bison], [2002, 2003, 2004]) +b4_copyright([Skeleton parser for GLR parsing with Bison], + [2002, 2003, 2004, 2005]) -b4_token_defines(b4_tokens) +b4_token_enums_defines(b4_tokens) #if ! defined (YYSTYPE) && ! defined (YYSTYPE_IS_DECLARED) m4_ifdef([b4_stype], -[b4_syncline([b4_stype_line], [b4_filename]) +[b4_syncline([b4_stype_line], [b4_file_name]) typedef union m4_bregexp(b4_stype, [^{], [YYSTYPE ])b4_stype YYSTYPE; /* Line __line__ of glr.c. */ b4_syncline([@oline@], [@ofile@])], @@ -2037,7 +2353,7 @@ b4_location_if([ # define YYLTYPE_IS_TRIVIAL 1 #endif -b4_location_if([m4_if(b4_pure, [0], +b4_location_if([b4_pure_if([], [extern YYLTYPE b4_prefix[]lloc;]) ]) ]) diff --git a/src/bin/bison/data/lalr1.cc b/src/bin/bison/data/lalr1.cc index 9ac1677d80..2ab900bed6 100644 --- a/src/bin/bison/data/lalr1.cc +++ b/src/bin/bison/data/lalr1.cc @@ -1,6 +1,8 @@ m4_divert(-1) + # C++ skeleton for Bison -# Copyright (C) 2002, 2003, 2004 Free Software Foundation, Inc. + +# Copyright (C) 2002, 2003, 2004, 2005 Free Software Foundation, Inc. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -14,113 +16,10 @@ m4_divert(-1) # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA -# 02111-1307 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +# 02110-1301 USA -## ---------------- ## -## Default values. ## -## ---------------- ## - -# Default Parser class name. -m4_define_default([b4_parser_class_name], [Parser]) - - - -## ----------------- ## -## Semantic Values. ## -## ----------------- ## - - -# b4_lhs_value([TYPE]) -# -------------------- -# Expansion of $$. -m4_define([b4_lhs_value], -[yyval[]m4_ifval([$1], [.$1])]) - - -# b4_rhs_value(RULE-LENGTH, NUM, [TYPE]) -# -------------------------------------- -# Expansion of $NUM, where the current rule has RULE-LENGTH -# symbols on RHS. -m4_define([b4_rhs_value], -[semantic_stack_@{m4_eval([$1 - $2])@}m4_ifval([$3], [.$3])]) - -m4_define_default([b4_location_type], [Location]) - -# b4_lhs_location() -# ----------------- -# Expansion of @$. -m4_define([b4_lhs_location], -[yyloc]) - - -# b4_rhs_location(RULE-LENGTH, NUM) -# --------------------------------- -# Expansion of @NUM, where the current rule has RULE-LENGTH symbols -# on RHS. -m4_define([b4_rhs_location], -[location_stack_@{m4_eval([$1 - $2])@}]) - - -m4_define([b4_inherit], - [m4_ifdef([b4_root], - [: public b4_root -], - [])]) - -m4_define([b4_param], - [m4_ifdef([b4_root], - [, - const Param& param], - [])]) - -m4_define([b4_constructor], - [m4_ifdef([b4_root], - [b4_root (param), - ], - [])]) - - -# b4_parse_param_decl -# ------------------- -# Constructor's extra arguments. -m4_define([b4_parse_param_decl], - [m4_ifset([b4_parse_param], [, b4_c_ansi_formals(b4_parse_param)])]) - -# b4_parse_param_cons -# ------------------- -# constructor's extra initialisations. -m4_define([b4_parse_param_cons], - [m4_ifset([b4_parse_param], - [, - b4_cc_constructor_calls(b4_parse_param)])]) -m4_define([b4_cc_constructor_calls], - [m4_map_sep([b4_cc_constructor_call], [, - ], [$@])]) -m4_define([b4_cc_constructor_call], - [$2($2)]) - -# b4_parse_param_vars -# ------------------- -# Extra instance variables. -m4_define([b4_parse_param_vars], - [m4_ifset([b4_parse_param], - [ - /* User arguments. */ -b4_cc_var_decls(b4_parse_param)])]) -m4_define([b4_cc_var_decls], - [m4_map_sep([b4_cc_var_decl], [ -], [$@])]) -m4_define([b4_cc_var_decl], - [ $1;]) - -# b4_cxx_destruct_def(IGNORED-ARGUMENTS) -# -------------------------------------- -# Declare the destruct_ method. -m4_define([b4_cxx_destruct_def], -[void -yy::b4_parser_class_name::destruct_ (int yytype, SemanticType *yyvaluep, LocationType *yylocationp)[]dnl -]) +m4_include(b4_pkgdatadir/[c++.m4]) # We do want M4 expansion after # for CPP macros. m4_changecom() @@ -128,22 +27,25 @@ m4_divert(0)dnl m4_if(b4_defines_flag, 0, [], [@output @output_header_name@ b4_copyright([C++ Skeleton parser for LALR(1) parsing with Bison], - [2002, 2003, 2004])[ + [2002, 2003, 2004, 2005])[ /* FIXME: This is wrong, we want computed header guards. I don't know why the macros are missing now. :( */ #ifndef PARSER_HEADER_H # define PARSER_HEADER_H -#include "stack.hh" -#include "location.hh" - #include #include /* Using locations. */ #define YYLSP_NEEDED ]b4_locations_flag[ -]b4_token_defines(b4_tokens)[ +namespace yy +{ + class position; + class location; +} + +]b4_token_enums(b4_tokens)[ /* Copy the first part of user declarations. */ ]b4_pre_prologue[ @@ -151,24 +53,43 @@ b4_copyright([C++ Skeleton parser for LALR(1) parsing with Bison], ]/* Line __line__ of lalr1.cc. */ b4_syncline([@oline@], [@ofile@])[ +#include "stack.hh" +#include "location.hh" + /* Enabling traces. */ #ifndef YYDEBUG # define YYDEBUG ]b4_debug[ #endif -/* Enabling verbose error message. */ -#ifndef YYERROR_VERBOSE +/* Enabling verbose error messages. */ +#ifdef YYERROR_VERBOSE +# undef YYERROR_VERBOSE +# define YYERROR_VERBOSE 1 +#else # define YYERROR_VERBOSE ]b4_error_verbose[ #endif -#ifndef YYSTYPE +#if YYERROR_VERBOSE +# define YYERROR_VERBOSE_IF(x) x +#else +# define YYERROR_VERBOSE_IF(x) /* empty */ +#endif + +/* Enabling the token table. */ +#ifndef YYTOKEN_TABLE +# define YYTOKEN_TABLE ]b4_token_table[ +#endif + +#if ! defined (YYSTYPE) && ! defined (YYSTYPE_IS_DECLARED) ]m4_ifdef([b4_stype], -[b4_syncline([b4_stype_line], [b4_filename]) -typedef union b4_stype yystype; +[b4_syncline([b4_stype_line], [b4_file_name]) +union YYSTYPE b4_stype; /* Line __line__ of lalr1.cc. */ b4_syncline([@oline@], [@ofile@])], -[typedef int yystype;])[ -# define YYSTYPE yystype +[typedef int YYSTYPE;])[ +# define yystype YYSTYPE /* obsolescent; will be withdrawn */ +# define YYSTYPE_IS_DECLARED 1 +# define YYSTYPE_IS_TRIVIAL 1 #endif /* Copy the second part of user declarations. */ @@ -176,58 +97,60 @@ b4_syncline([@oline@], [@ofile@])], ]/* Line __line__ of lalr1.cc. */ b4_syncline([@oline@], [@ofile@])[ +/* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N]. + If N is 0, then set CURRENT to the empty location which ends + the previous symbol: RHS[0] (always defined). */ + #ifndef YYLLOC_DEFAULT -# define YYLLOC_DEFAULT(Current, Rhs, N) \ - ((Current).end = Rhs[N].end) +# define YYLLOC_DEFAULT(Current, Rhs, N) \ +do { \ + if (N) \ + { \ + (Current).begin = (Rhs)[1].begin; \ + (Current).end = (Rhs)[N].end; \ + } \ + else \ + { \ + (Current).begin = (Current).end = (Rhs)[0].end; \ + } \ +} while (0) #endif namespace yy { class ]b4_parser_class_name[; - template < typename P > - struct Traits + template + struct traits { }; - template < > - struct Traits< ]b4_parser_class_name[ > + template <> + struct traits<]b4_parser_class_name[> { - typedef ]b4_int_type_for([b4_translate])[ TokenNumberType; - typedef ]b4_int_type_for([b4_rhs])[ RhsNumberType; - typedef int StateType; - typedef yystype SemanticType; - typedef ]b4_location_type[ LocationType; + typedef ]b4_int_type_for([b4_translate])[ token_number_type; + typedef ]b4_int_type_for([b4_rhs])[ rhs_number_type; + typedef int state_type; + typedef YYSTYPE semantic_type; + typedef ]b4_location_type[ location_type; }; } namespace yy { - class ]b4_parser_class_name b4_inherit[ + /// A Bison parser. + class ]b4_parser_class_name[ { + /// Symbol semantic values. + typedef traits<]b4_parser_class_name[>::semantic_type semantic_type; + /// Symbol locations. + typedef traits<]b4_parser_class_name[>::location_type location_type; + public: - - typedef Traits< ]b4_parser_class_name[ >::TokenNumberType TokenNumberType; - typedef Traits< ]b4_parser_class_name[ >::RhsNumberType RhsNumberType; - typedef Traits< ]b4_parser_class_name[ >::StateType StateType; - typedef Traits< ]b4_parser_class_name[ >::SemanticType SemanticType; - typedef Traits< ]b4_parser_class_name[ >::LocationType LocationType; - - typedef Stack< StateType > StateStack; - typedef Stack< SemanticType > SemanticStack; - typedef Stack< LocationType > LocationStack; - -#if YYLSP_NEEDED - ]b4_parser_class_name[ (bool debug, - LocationType initlocation][]b4_param[]b4_parse_param_decl[) : - ]b4_constructor[][debug_ (debug), - cdebug_ (std::cerr), - initlocation_ (initlocation)]b4_parse_param_cons[ -#else - ]b4_parser_class_name[ (bool debug][]b4_param[]b4_parse_param_decl[) : - ]b4_constructor[][debug_ (debug), - cdebug_ (std::cerr)]b4_parse_param_cons[ -#endif + /// Build a parser object. + ]b4_parser_class_name[ (]b4_parse_param_decl[) : + yydebug_ (false), + yycdebug_ (&std::cerr)]b4_parse_param_cons[ { } @@ -235,97 +158,161 @@ namespace yy { } + /// Parse. + /// \returns 0 iff parsing succeeded. virtual int parse (); + /// The current debugging stream. + std::ostream& debug_stream () const; + /// Set the current debugging stream. + void set_debug_stream (std::ostream &); + + /// Type for debugging levels. + typedef int debug_level_type; + /// The current debugging level. + debug_level_type debug_level () const; + /// Set the current debugging level. + void set_debug_level (debug_level_type l); + private: + /// Report a syntax error. + /// \param loc where the syntax error is found. + /// \param msg a description of the syntax error. + virtual void error (const location_type& loc, const std::string& msg); - virtual void lex_ (); - virtual void error_ (); - virtual void print_ (); - virtual void report_syntax_error_ (); + /// Generate an error message. + /// \param tok the look-ahead token. + virtual std::string yysyntax_error_ (YYERROR_VERBOSE_IF (int tok)); - /* Stacks. */ - StateStack state_stack_; - SemanticStack semantic_stack_; - LocationStack location_stack_; - - /* Tables. */ - static const ]b4_int_type_for([b4_pact])[ pact_[]; - static const ]b4_int_type(b4_pact_ninf, b4_pact_ninf)[ pact_ninf_; - static const ]b4_int_type_for([b4_defact])[ defact_[]; - static const ]b4_int_type_for([b4_pgoto])[ pgoto_[]; - static const ]b4_int_type_for([b4_defgoto])[ defgoto_[]; - static const ]b4_int_type_for([b4_table])[ table_[]; - static const ]b4_int_type(b4_table_ninf, b4_table_ninf)[ table_ninf_; - static const ]b4_int_type_for([b4_check])[ check_[]; - static const ]b4_int_type_for([b4_stos])[ stos_[]; - static const ]b4_int_type_for([b4_r1])[ r1_[]; - static const ]b4_int_type_for([b4_r2])[ r2_[]; - -#if YYDEBUG || YYERROR_VERBOSE - static const char* const name_[]; -#endif - - /* More tables, for debugging. */ #if YYDEBUG - static const RhsNumberType rhs_[]; - static const ]b4_int_type_for([b4_prhs])[ prhs_[]; - static const ]b4_int_type_for([b4_rline])[ rline_[]; - static const ]b4_int_type_for([b4_toknum])[ token_number_[]; - virtual void reduce_print_ (int yyrule); - virtual void stack_print_ (); + /// \brief Report a symbol on the debug stream. + /// \param yytype The token type. + /// \param yyvaluep Its semantic value. + /// \param yylocationp Its location. + virtual void yysymprint_ (int yytype, + const semantic_type* yyvaluep, + const location_type* yylocationp); +#endif /* ! YYDEBUG */ + + + /// State numbers. + typedef traits<]b4_parser_class_name[>::state_type state_type; + /// State stack type. + typedef stack state_stack_type; + /// Semantic value stack type. + typedef stack semantic_stack_type; + /// location stack type. + typedef stack location_stack_type; + + /// The state stack. + state_stack_type yystate_stack_; + /// The semantic value stack. + semantic_stack_type yysemantic_stack_; + /// The location stack. + location_stack_type yylocation_stack_; + + /// Internal symbol numbers. + typedef traits<]b4_parser_class_name[>::token_number_type token_number_type; + /* Tables. */ + /// For a state, the index in \a yytable_ of its portion. + static const ]b4_int_type_for([b4_pact])[ yypact_[]; + static const ]b4_int_type(b4_pact_ninf, b4_pact_ninf)[ yypact_ninf_; + + /// For a state, default rule to reduce. + /// Unless\a yytable_ specifies something else to do. + /// Zero means the default is an error. + static const ]b4_int_type_for([b4_defact])[ yydefact_[]; + + static const ]b4_int_type_for([b4_pgoto])[ yypgoto_[]; + static const ]b4_int_type_for([b4_defgoto])[ yydefgoto_[]; + + /// What to do in a state. + /// \a yytable_[yypact_[s]]: what to do in state \a s. + /// - if positive, shift that token. + /// - if negative, reduce the rule which number is the opposite. + /// - if zero, do what YYDEFACT says. + static const ]b4_int_type_for([b4_table])[ yytable_[]; + static const ]b4_int_type(b4_table_ninf, b4_table_ninf)[ yytable_ninf_; + + static const ]b4_int_type_for([b4_check])[ yycheck_[]; + + /// For a state, its accessing symbol. + static const ]b4_int_type_for([b4_stos])[ yystos_[]; + + /// For a rule, its LHS. + static const ]b4_int_type_for([b4_r1])[ yyr1_[]; + /// For a rule, its RHS length. + static const ]b4_int_type_for([b4_r2])[ yyr2_[]; + +#if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE + /// For a symbol, its name in clear. + static const char* const yytname_[]; #endif - /* Even more tables. */ - static inline TokenNumberType translate_ (int token); - static inline void destruct_ (int yytype, SemanticType *yyvaluep, - LocationType *yylocationp); +#if YYERROR_VERBOSE + /// Convert the symbol name \a n to a form suitable for a diagnostic. + virtual std::string yytnamerr_ (const char *n); +#endif + +#if YYDEBUG + /// A type to store symbol numbers and -1. + typedef traits<]b4_parser_class_name[>::rhs_number_type rhs_number_type; + /// A `-1'-separated list of the rules' RHS. + static const rhs_number_type yyrhs_[]; + /// For each rule, the index of the first RHS symbol in \a yyrhs_. + static const ]b4_int_type_for([b4_prhs])[ yyprhs_[]; + /// For each rule, its source line number. + static const ]b4_int_type_for([b4_rline])[ yyrline_[]; + /// For each scanner token number, its symbol number. + static const ]b4_int_type_for([b4_toknum])[ yytoken_number_[]; + /// Report on the debug stream that the rule \a r is going to be reduced. + virtual void yyreduce_print_ (int r); + /// Print the state stack on the debug stream. + virtual void yystack_print_ (); +#endif + + /// Convert a scanner token number to a symbol number. + inline token_number_type yytranslate_ (int token); + + /// \brief Reclaim the memory associated to a symbol. + /// \param yymsg Why this token is reclaimed. + /// \param yytype The symbol type. + /// \param yyvaluep Its semantic value. + /// \param yylocationp Its location. + inline void yydestruct_ (const char* yymsg, + int yytype, + semantic_type* yyvaluep, + location_type* yylocationp); + + /// Pop \a n symbols the three stacks. + inline void yypop_ (unsigned int n = 1); /* Constants. */ - static const int eof_; + static const int yyeof_; /* LAST_ -- Last index in TABLE_. */ - static const int last_; - static const int nnts_; - static const int empty_; - static const int final_; - static const int terror_; - static const int errcode_; - static const int ntokens_; - static const unsigned int user_token_number_max_; - static const TokenNumberType undef_token_; + static const int yylast_; + static const int yynnts_; + static const int yyempty_; + static const int yyfinal_; + static const int yyterror_; + static const int yyerrcode_; + static const int yyntokens_; + static const unsigned int yyuser_token_number_max_; + static const token_number_type yyundef_token_; /* State. */ - int n_; - int len_; - int state_; + int yyn_; + int yylen_; + int yystate_; /* Error handling. */ - int nerrs_; - int errstatus_; + int yynerrs_; + int yyerrstatus_; /* Debugging. */ - int debug_; - std::ostream &cdebug_; + int yydebug_; + std::ostream* yycdebug_; - /* Lookahead and lookahead in internal form. */ - int looka_; - int ilooka_; - - /* Message. */ - std::string message; - - /* Semantic value and location of lookahead token. */ - SemanticType value; - LocationType location; - /* Beginning of the last erroneous token popped off. */ - Position error_start_; - - /* @@$ and $$. */ - SemanticType yyval; - LocationType yyloc; - - /* Initial location. */ - LocationType initlocation_; ]b4_parse_param_vars[ }; } @@ -334,253 +321,409 @@ namespace yy ])dnl @output @output_parser_name@ b4_copyright([C++ Skeleton parser for LALR(1) parsing with Bison], - [2002, 2003, 2004]) + [2002, 2003, 2004, 2005]) +m4_if(b4_prefix[], [yy], [], +[ +// Take the name prefix into account. +#define yylex b4_prefix[]lex]) +m4_if(b4_defines_flag, 0, [], +[ +#include @output_header_name@])[ -m4_if(b4_defines_flag, 0, [], [#include @output_header_name@])[ +#ifndef YY_ +# if YYENABLE_NLS +# if ENABLE_NLS +# include /* FIXME: INFRINGES ON USER NAME SPACE */ +# define YY_(msgid) dgettext ("bison-runtime", msgid) +# endif +# endif +# ifndef YY_ +# define YY_(msgid) msgid +# endif +#endif + +/* A pseudo ostream that takes yydebug_ into account. */ +# define YYCDEBUG \ + for (bool yydebugcond_ = yydebug_; yydebugcond_; yydebugcond_ = false) \ + (*yycdebug_) /* Enable debugging if requested. */ #if YYDEBUG -# define YYCDEBUG if (debug_) cdebug_ + +# define YY_SYMBOL_PRINT(Title, Type, Value, Location) \ +do { \ + if (yydebug_) \ + { \ + *yycdebug_ << (Title) << ' '; \ + yysymprint_ ((Type), (Value), (Location)); \ + *yycdebug_ << std::endl; \ + } \ +} while (0) + # define YY_REDUCE_PRINT(Rule) \ do { \ - if (debug_) \ - reduce_print_ (Rule); \ + if (yydebug_) \ + yyreduce_print_ (Rule); \ } while (0) + # define YY_STACK_PRINT() \ do { \ - if (debug_) \ - stack_print_ (); \ + if (yydebug_) \ + yystack_print_ (); \ } while (0) + #else /* !YYDEBUG */ -# define YYCDEBUG if (0) cdebug_ + +# define YY_SYMBOL_PRINT(Title, Type, Value, Location) # define YY_REDUCE_PRINT(Rule) # define YY_STACK_PRINT() + #endif /* !YYDEBUG */ #define YYACCEPT goto yyacceptlab #define YYABORT goto yyabortlab #define YYERROR goto yyerrorlab -]b4_yydestruct_generate([b4_cxx_destruct_def])[ +#if YYERROR_VERBOSE + +/* Return YYSTR after stripping away unnecessary quotes and + backslashes, so that it's suitable for yyerror. The heuristic is + that double-quoting is unnecessary unless the string contains an + apostrophe, a comma, or backslash (other than backslash-backslash). + YYSTR is taken from yytname. */ +std::string +yy::]b4_parser_class_name[::yytnamerr_ (const char *yystr) +{ + if (*yystr == '"') + { + std::string yyr = ""; + char const *yyp = yystr; + + for (;;) + switch (*++yyp) + { + case '\'': + case ',': + goto do_not_strip_quotes; + + case '\\': + if (*++yyp != '\\') + goto do_not_strip_quotes; + /* Fall through. */ + default: + yyr += *yyp; + break; + + case '"': + return yyr; + } + do_not_strip_quotes: ; + } + + return yystr; +} + +#endif + +#if YYDEBUG +/*--------------------------------. +| Print this symbol on YYOUTPUT. | +`--------------------------------*/ + +void +yy::]b4_parser_class_name[::yysymprint_ (int yytype, + const semantic_type* yyvaluep, const location_type* yylocationp) +{ + /* Pacify ``unused variable'' warnings. */ + (void) yyvaluep; + (void) yylocationp; + /* Backward compatibility, but should be removed eventually. */ + std::ostream& cdebug_ = *yycdebug_; + (void) cdebug_; + + *yycdebug_ << (yytype < yyntokens_ ? "token" : "nterm") + << ' ' << yytname_[yytype] << " (" + << *yylocationp << ": "; + switch (yytype) + { +]m4_map([b4_symbol_actions], m4_defn([b4_symbol_printers]))dnl +[ default: + break; + } + *yycdebug_ << ')'; +} +#endif /* ! YYDEBUG */ + +void +yy::]b4_parser_class_name[::yydestruct_ (const char* yymsg, + int yytype, semantic_type* yyvaluep, location_type* yylocationp) +{ + /* Pacify ``unused variable'' warnings. */ + (void) yymsg; + (void) yyvaluep; + (void) yylocationp; + + YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp); + + switch (yytype) + { +]m4_map([b4_symbol_actions], m4_defn([b4_symbol_destructors]))[ + default: + break; + } +} + +void +yy::]b4_parser_class_name[::yypop_ (unsigned int n) +{ + yystate_stack_.pop (n); + yysemantic_stack_.pop (n); + yylocation_stack_.pop (n); +} + +std::ostream& +yy::]b4_parser_class_name[::debug_stream () const +{ + return *yycdebug_; +} + +void +yy::]b4_parser_class_name[::set_debug_stream (std::ostream& o) +{ + yycdebug_ = &o; +} + + +yy::]b4_parser_class_name[::debug_level_type +yy::]b4_parser_class_name[::debug_level () const +{ + return yydebug_; +} + +void +yy::]b4_parser_class_name[::set_debug_level (debug_level_type l) +{ + yydebug_ = l; +} + int yy::]b4_parser_class_name[::parse () { - nerrs_ = 0; - errstatus_ = 0; + /* Look-ahead and look-ahead in internal form. */ + int yylooka; + int yyilooka; - /* Initialize the stacks. The initial state will be pushed in + /// Semantic value of the look-ahead. + semantic_type yylval; + /// Location of the look-ahead. + location_type yylloc; + /// The locations where the error started and ended. + location yyerror_range[2]; + + /// $$. + semantic_type yyval; + /// @@$. + location_type yyloc; + + int yyresult_; + + YYCDEBUG << "Starting parse" << std::endl; + + yynerrs_ = 0; + yyerrstatus_ = 0; + + /* Start. */ + yystate_ = 0; + yylooka = yyempty_; + +]m4_ifdef([b4_initial_action], [ +m4_pushdef([b4_at_dollar], [yylloc])dnl +m4_pushdef([b4_dollar_dollar], [yylval])dnl + /* User initialization code. */ + b4_initial_action +m4_popdef([b4_dollar_dollar])dnl +m4_popdef([b4_at_dollar])dnl +/* Line __line__ of yacc.c. */ +b4_syncline([@oline@], [@ofile@])])dnl + +[ /* Initialize the stacks. The initial state will be pushed in yynewstate, since the latter expects the semantical and the location values to have been already stored, initialize these stacks with a primary value. */ - state_stack_ = StateStack (0); - semantic_stack_ = SemanticStack (1); - location_stack_ = LocationStack (1); - - /* Start. */ - state_ = 0; - looka_ = empty_; -#if YYLSP_NEEDED - location = initlocation_; -#endif - YYCDEBUG << "Starting parse" << std::endl; + yystate_stack_ = state_stack_type (0); + yysemantic_stack_ = semantic_stack_type (0); + yylocation_stack_ = location_stack_type (0); + yysemantic_stack_.push (yylval); + yylocation_stack_.push (yylloc); /* New state. */ - yynewstate: - state_stack_.push (state_); - YYCDEBUG << "Entering state " << state_ << std::endl; +yynewstate: + yystate_stack_.push (yystate_); + YYCDEBUG << "Entering state " << yystate_ << std::endl; goto yybackup; /* Backup. */ - yybackup: +yybackup: - /* Try to take a decision without lookahead. */ - n_ = pact_[state_]; - if (n_ == pact_ninf_) + /* Try to take a decision without look-ahead. */ + yyn_ = yypact_[yystate_]; + if (yyn_ == yypact_ninf_) goto yydefault; - /* Read a lookahead token. */ - if (looka_ == empty_) + /* Read a look-ahead token. */ + if (yylooka == yyempty_) { YYCDEBUG << "Reading a token: "; - lex_ (); + yylooka = ]b4_c_function_call([yylex], [int], +[[YYSTYPE*], [&yylval]][]dnl +b4_location_if([, [[location*], [&yylloc]]])dnl +m4_ifdef([b4_lex_param], [, ]b4_lex_param))[; } + /* Convert token to internal form. */ - if (looka_ <= 0) + if (yylooka <= yyeof_) { - looka_ = eof_; - ilooka_ = 0; + yylooka = yyilooka = yyeof_; YYCDEBUG << "Now at end of input." << std::endl; } else { - ilooka_ = translate_ (looka_); -#if YYDEBUG - if (debug_) - { - YYCDEBUG << "Next token is " << looka_ - << " (" << name_[ilooka_]; - print_ (); - YYCDEBUG << ')' << std::endl; - } -#endif + yyilooka = yytranslate_ (yylooka); + YY_SYMBOL_PRINT ("Next token is", yyilooka, &yylval, &yylloc); } - /* If the proper action on seeing token YYTOKEN is to reduce or to + /* If the proper action on seeing token ILOOKA_ is to reduce or to detect an error, take that action. */ - n_ += ilooka_; - if (n_ < 0 || last_ < n_ || check_[n_] != ilooka_) + yyn_ += yyilooka; + if (yyn_ < 0 || yylast_ < yyn_ || yycheck_[yyn_] != yyilooka) goto yydefault; /* Reduce or error. */ - n_ = table_[n_]; - if (n_ < 0) + yyn_ = yytable_[yyn_]; + if (yyn_ < 0) { - if (n_ == table_ninf_) + if (yyn_ == yytable_ninf_) goto yyerrlab; else { - n_ = -n_; + yyn_ = -yyn_; goto yyreduce; } } - else if (n_ == 0) + else if (yyn_ == 0) goto yyerrlab; /* Accept? */ - if (n_ == final_) + if (yyn_ == yyfinal_) goto yyacceptlab; - /* Shift the lookahead token. */ -#if YYDEBUG - YYCDEBUG << "Shifting token " << looka_ - << " (" << name_[ilooka_] << "), "; -#endif + /* Shift the look-ahead token. */ + YY_SYMBOL_PRINT ("Shifting", yyilooka, &yylval, &yylloc); /* Discard the token being shifted unless it is eof. */ - if (looka_ != eof_) - looka_ = empty_; + if (yylooka != yyeof_) + yylooka = yyempty_; - semantic_stack_.push (value); - location_stack_.push (location); + yysemantic_stack_.push (yylval); + yylocation_stack_.push (yylloc); /* Count tokens shifted since error; after three, turn off error status. */ - if (errstatus_) - --errstatus_; + if (yyerrstatus_) + --yyerrstatus_; - state_ = n_; + yystate_ = yyn_; goto yynewstate; /*-----------------------------------------------------------. | yydefault -- do the default action for the current state. | `-----------------------------------------------------------*/ - yydefault: - n_ = defact_[state_]; - if (n_ == 0) +yydefault: + yyn_ = yydefact_[yystate_]; + if (yyn_ == 0) goto yyerrlab; goto yyreduce; /*-----------------------------. | yyreduce -- Do a reduction. | `-----------------------------*/ - yyreduce: - len_ = r2_[n_]; +yyreduce: + yylen_ = yyr2_[yyn_]; /* If LEN_ is nonzero, implement the default value of the action: `$$ = $1'. Otherwise, use the top of the stack. Otherwise, the following line sets YYVAL to garbage. This behavior is undocumented and Bison users should not rely upon it. */ - if (len_) - { - yyval = semantic_stack_[len_ - 1]; - yyloc = location_stack_[len_ - 1]; - } + if (yylen_) + yyval = yysemantic_stack_[yylen_ - 1]; else - { - yyval = semantic_stack_[0]; - yyloc = location_stack_[0]; - } + yyval = yysemantic_stack_[0]; - if (len_) - { - Slice< LocationType, LocationStack > slice (location_stack_, len_); - YYLLOC_DEFAULT (yyloc, slice, len_); - } - YY_REDUCE_PRINT (n_); - switch (n_) + { + slice slice (yylocation_stack_, yylen_); + YYLLOC_DEFAULT (yyloc, slice, yylen_); + } + YY_REDUCE_PRINT (yyn_); + switch (yyn_) { ]b4_actions[ + default: break; } ]/* Line __line__ of lalr1.cc. */ b4_syncline([@oline@], [@ofile@])[ - state_stack_.pop (len_); - semantic_stack_.pop (len_); - location_stack_.pop (len_); + yypop_ (yylen_); YY_STACK_PRINT (); - semantic_stack_.push (yyval); - location_stack_.push (yyloc); + yysemantic_stack_.push (yyval); + yylocation_stack_.push (yyloc); /* Shift the result of the reduction. */ - n_ = r1_[n_]; - state_ = pgoto_[n_ - ntokens_] + state_stack_[0]; - if (0 <= state_ && state_ <= last_ && check_[state_] == state_stack_[0]) - state_ = table_[state_]; + yyn_ = yyr1_[yyn_]; + yystate_ = yypgoto_[yyn_ - yyntokens_] + yystate_stack_[0]; + if (0 <= yystate_ && yystate_ <= yylast_ + && yycheck_[yystate_] == yystate_stack_[0]) + yystate_ = yytable_[yystate_]; else - state_ = defgoto_[n_ - ntokens_]; + yystate_ = yydefgoto_[yyn_ - yyntokens_]; goto yynewstate; /*------------------------------------. | yyerrlab -- here on detecting error | `------------------------------------*/ - yyerrlab: +yyerrlab: /* If not already recovering from an error, report this error. */ - report_syntax_error_ (); - - error_start_ = location.begin; - if (errstatus_ == 3) + if (!yyerrstatus_) { - /* If just tried and failed to reuse lookahead token after an + ++yynerrs_; + error (yylloc, yysyntax_error_ (YYERROR_VERBOSE_IF (yyilooka))); + } + + yyerror_range[0] = yylloc; + if (yyerrstatus_ == 3) + { + /* If just tried and failed to reuse look-ahead token after an error, discard it. */ - /* Return failure if at end of input. */ - if (looka_ <= eof_) + if (yylooka <= yyeof_) { - /* If at end of input, pop the error token, - then the rest of the stack, then return failure. */ - if (looka_ == eof_) - for (;;) - { - error_start_ = location_stack_[0].begin; - state_stack_.pop (); - semantic_stack_.pop (); - location_stack_.pop (); - if (state_stack_.height () == 1) - YYABORT; -// YYDSYMPRINTF ("Error: popping", yystos[*yyssp], yyvsp, yylsp); - destruct_ (stos_[state_stack_[0]], - &semantic_stack_[0], - &location_stack_[0]); - } + /* Return failure if at end of input. */ + if (yylooka == yyeof_) + YYABORT; } else { -#if YYDEBUG - YYCDEBUG << "Discarding token " << looka_ - << " (" << name_[ilooka_] << ")." << std::endl; -#endif - destruct_ (ilooka_, &value, &location); - looka_ = empty_; + yydestruct_ ("Error: discarding", yyilooka, &yylval, &yylloc); + yylooka = yyempty_; } } - /* Else will try to reuse lookahead token after shifting the error + /* Else will try to reuse look-ahead token after shifting the error token. */ goto yyerrlab1; @@ -590,155 +733,147 @@ b4_syncline([@oline@], [@ofile@])[ `---------------------------------------------------*/ yyerrorlab: -#ifdef __GNUC__ - /* Pacify GCC when the user code never invokes YYERROR and the label - yyerrorlab therefore never appears in user code. */ - if (0) - goto yyerrorlab; -#endif + /* Pacify compilers like GCC when the user code never invokes + YYERROR and the label yyerrorlab therefore never appears in user + code. */ + if (false) + goto yyerrorlab; - state_stack_.pop (len_); - semantic_stack_.pop (len_); - error_start_ = location_stack_[len_ - 1].begin; - location_stack_.pop (len_); - state_ = state_stack_[0]; + yyerror_range[0] = yylocation_stack_[yylen_ - 1]; + yypop_ (yylen_); + yystate_ = yystate_stack_[0]; goto yyerrlab1; /*-------------------------------------------------------------. | yyerrlab1 -- common code for both syntax error and YYERROR. | `-------------------------------------------------------------*/ yyerrlab1: - errstatus_ = 3; /* Each real token shifted decrements this. */ + yyerrstatus_ = 3; /* Each real token shifted decrements this. */ for (;;) { - n_ = pact_[state_]; - if (n_ != pact_ninf_) + yyn_ = yypact_[yystate_]; + if (yyn_ != yypact_ninf_) { - n_ += terror_; - if (0 <= n_ && n_ <= last_ && check_[n_] == terror_) + yyn_ += yyterror_; + if (0 <= yyn_ && yyn_ <= yylast_ && yycheck_[yyn_] == yyterror_) { - n_ = table_[n_]; - if (0 < n_) + yyn_ = yytable_[yyn_]; + if (0 < yyn_) break; } } /* Pop the current state because it cannot handle the error token. */ - if (state_stack_.height () == 1) + if (yystate_stack_.height () == 1) YYABORT; -#if YYDEBUG - if (debug_) - { - if (stos_[state_] < ntokens_) - { - YYCDEBUG << "Error: popping token " - << token_number_[stos_[state_]] - << " (" << name_[stos_[state_]]; -# ifdef YYPRINT - YYPRINT (stderr, token_number_[stos_[state_]], - semantic_stack_.top ()); -# endif - YYCDEBUG << ')' << std::endl; - } - else - { - YYCDEBUG << "Error: popping nonterminal (" - << name_[stos_[state_]] << ')' << std::endl; - } - } -#endif - destruct_ (stos_[state_], &semantic_stack_[0], &location_stack_[0]); - error_start_ = location_stack_[0].begin; - - state_stack_.pop (); - semantic_stack_.pop (); - location_stack_.pop (); - state_ = state_stack_[0]; + yyerror_range[0] = yylocation_stack_[0]; + yydestruct_ ("Error: popping", + yystos_[yystate_], + &yysemantic_stack_[0], &yylocation_stack_[0]); + yypop_ (); + yystate_ = yystate_stack_[0]; YY_STACK_PRINT (); } - if (n_ == final_) + if (yyn_ == yyfinal_) goto yyacceptlab; - YYCDEBUG << "Shifting error token, "; + yyerror_range[1] = yylloc; + // Using YYLLOC is tempting, but would change the location of + // the look-ahead. YYLOC is available though. + YYLLOC_DEFAULT (yyloc, yyerror_range - 1, 2); + yysemantic_stack_.push (yylval); + yylocation_stack_.push (yyloc); - { - Location errloc; - errloc.begin = error_start_; - errloc.end = location.end; - semantic_stack_.push (value); - location_stack_.push (errloc); - } + /* Shift the error token. */ + YY_SYMBOL_PRINT ("Shifting", yystos_[yyn_], + &yysemantic_stack_[0], &yylocation_stack_[0]); - state_ = n_; + yystate_ = yyn_; goto yynewstate; /* Accept. */ - yyacceptlab: - return 0; +yyacceptlab: + yyresult_ = 0; + goto yyreturn; /* Abort. */ - yyabortlab: - return 1; -} +yyabortlab: + yyresult_ = 1; + goto yyreturn; -void -yy::]b4_parser_class_name[::lex_ () -{ -#if YYLSP_NEEDED - looka_ = yylex (&value, &location); -#else - looka_ = yylex (&value); -#endif -} +yyreturn: + if (yylooka != yyeof_ && yylooka != yyempty_) + yydestruct_ ("Cleanup: discarding lookahead", yyilooka, &yylval, &yylloc); -/** Generate an error message, and invoke yyerror. */ -void -yy::]b4_parser_class_name[::report_syntax_error_ () -{ - /* If not already recovering from an error, report this error. */ - if (!errstatus_) + while (yystate_stack_.height () != 1) { - ++nerrs_; - -#if YYERROR_VERBOSE - n_ = pact_[state_]; - if (pact_ninf_ < n_ && n_ < last_) - { - message = "syntax error, unexpected "; - message += name_[ilooka_]; - { - int count = 0; - for (int x = (n_ < 0 ? -n_ : 0); x < ntokens_ + nnts_; ++x) - if (check_[x + n_] == x && x != terror_) - ++count; - if (count < 5) - { - count = 0; - for (int x = (n_ < 0 ? -n_ : 0); x < ntokens_ + nnts_; ++x) - if (check_[x + n_] == x && x != terror_) - { - message += (!count++) ? ", expecting " : " or "; - message += name_[x]; - } - } - } - } - else -#endif - message = "syntax error"; - error_ (); + yydestruct_ ("Cleanup: popping", + yystos_[yystate_stack_[0]], + &yysemantic_stack_[0], + &yylocation_stack_[0]); + yypop_ (); } + + return yyresult_; +} + +// Generate an error message. +std::string +yy::]b4_parser_class_name[::yysyntax_error_ (YYERROR_VERBOSE_IF (int tok)) +{ + std::string res; +#if YYERROR_VERBOSE + yyn_ = yypact_[yystate_]; + if (yypact_ninf_ < yyn_ && yyn_ < yylast_) + { + /* Start YYX at -YYN if negative to avoid negative indexes in + YYCHECK. */ + int yyxbegin = yyn_ < 0 ? -yyn_ : 0; + + /* Stay within bounds of both yycheck and yytname. */ + int yychecklim = yylast_ - yyn_; + int yyxend = yychecklim < yyntokens_ ? yychecklim : yyntokens_; + int count = 0; + for (int x = yyxbegin; x < yyxend; ++x) + if (yycheck_[x + yyn_] == x && x != yyterror_) + ++count; + + // FIXME: This method of building the message is not compatible + // with internationalization. It should work like yacc.c does it. + // That is, first build a string that looks like this: + // "syntax error, unexpected %s or %s or %s" + // Then, invoke YY_ on this string. + // Finally, use the string as a format to output + // yytname_[tok], etc. + // Until this gets fixed, this message appears in English only. + res = "syntax error, unexpected "; + res += yytnamerr_ (yytname_[tok]); + if (count < 5) + { + count = 0; + for (int x = yyxbegin; x < yyxend; ++x) + if (yycheck_[x + yyn_] == x && x != yyterror_) + { + res += (!count++) ? ", expecting " : " or "; + res += yytnamerr_ (yytname_[x]); + } + } + } + else +#endif + res = YY_("syntax error"); + return res; } /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing STATE-NUM. */ -const ]b4_int_type(b4_pact_ninf, b4_pact_ninf) yy::b4_parser_class_name::pact_ninf_ = b4_pact_ninf[; +const ]b4_int_type(b4_pact_ninf, b4_pact_ninf) yy::b4_parser_class_name::yypact_ninf_ = b4_pact_ninf[; const ]b4_int_type_for([b4_pact])[ -yy::]b4_parser_class_name[::pact_[] = +yy::]b4_parser_class_name[::yypact_[] = { ]b4_pact[ }; @@ -747,21 +882,21 @@ yy::]b4_parser_class_name[::pact_[] = doesn't specify something else to do. Zero means the default is an error. */ const ]b4_int_type_for([b4_defact])[ -yy::]b4_parser_class_name[::defact_[] = +yy::]b4_parser_class_name[::yydefact_[] = { ]b4_defact[ }; /* YYPGOTO[NTERM-NUM]. */ const ]b4_int_type_for([b4_pgoto])[ -yy::]b4_parser_class_name[::pgoto_[] = +yy::]b4_parser_class_name[::yypgoto_[] = { ]b4_pgoto[ }; /* YYDEFGOTO[NTERM-NUM]. */ const ]b4_int_type_for([b4_defgoto])[ -yy::]b4_parser_class_name[::defgoto_[] = +yy::]b4_parser_class_name[::yydefgoto_[] = { ]b4_defgoto[ }; @@ -769,16 +904,16 @@ yy::]b4_parser_class_name[::defgoto_[] = /* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If positive, shift that token. If negative, reduce the rule which number is the opposite. If zero, do what YYDEFACT says. */ -const ]b4_int_type(b4_table_ninf, b4_table_ninf) yy::b4_parser_class_name::table_ninf_ = b4_table_ninf[; +const ]b4_int_type(b4_table_ninf, b4_table_ninf) yy::b4_parser_class_name::yytable_ninf_ = b4_table_ninf[; const ]b4_int_type_for([b4_table])[ -yy::]b4_parser_class_name[::table_[] = +yy::]b4_parser_class_name[::yytable_[] = { ]b4_table[ }; /* YYCHECK. */ const ]b4_int_type_for([b4_check])[ -yy::]b4_parser_class_name[::check_[] = +yy::]b4_parser_class_name[::yycheck_[] = { ]b4_check[ }; @@ -786,16 +921,16 @@ yy::]b4_parser_class_name[::check_[] = /* STOS_[STATE-NUM] -- The (internal number of the) accessing symbol of state STATE-NUM. */ const ]b4_int_type_for([b4_stos])[ -yy::]b4_parser_class_name[::stos_[] = +yy::]b4_parser_class_name[::yystos_[] = { ]b4_stos[ }; #if YYDEBUG -/* TOKEN_NUMBER_[YYLEX-NUM] -- Internal token number corresponding +/* TOKEN_NUMBER_[YYLEX-NUM] -- Internal symbol number corresponding to YYLEX-NUM. */ const ]b4_int_type_for([b4_toknum])[ -yy::]b4_parser_class_name[::token_number_[] = +yy::]b4_parser_class_name[::yytoken_number_[] = { ]b4_toknum[ }; @@ -803,23 +938,23 @@ yy::]b4_parser_class_name[::token_number_[] = /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */ const ]b4_int_type_for([b4_r1])[ -yy::]b4_parser_class_name[::r1_[] = +yy::]b4_parser_class_name[::yyr1_[] = { ]b4_r1[ }; /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */ const ]b4_int_type_for([b4_r2])[ -yy::]b4_parser_class_name[::r2_[] = +yy::]b4_parser_class_name[::yyr2_[] = { ]b4_r2[ }; -#if YYDEBUG || YYERROR_VERBOSE +#if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM. - First, the terminals, then, starting at YYNTOKENS, nonterminals. */ + First, the terminals, then, starting at \a yyntokens_, nonterminals. */ const char* -const yy::]b4_parser_class_name[::name_[] = +const yy::]b4_parser_class_name[::yytname_[] = { ]b4_tname[ }; @@ -827,8 +962,8 @@ const yy::]b4_parser_class_name[::name_[] = #if YYDEBUG /* YYRHS -- A `-1'-separated list of the rules' RHS. */ -const yy::]b4_parser_class_name[::RhsNumberType -yy::]b4_parser_class_name[::rhs_[] = +const yy::]b4_parser_class_name[::rhs_number_type +yy::]b4_parser_class_name[::yyrhs_[] = { ]b4_rhs[ }; @@ -836,77 +971,76 @@ yy::]b4_parser_class_name[::rhs_[] = /* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in YYRHS. */ const ]b4_int_type_for([b4_prhs])[ -yy::]b4_parser_class_name[::prhs_[] = +yy::]b4_parser_class_name[::yyprhs_[] = { ]b4_prhs[ }; -/* YYRLINE[YYN] -- source line where rule number YYN was defined. */ +/* YYRLINE[YYN] -- Source line where rule number YYN was defined. */ const ]b4_int_type_for([b4_rline])[ -yy::]b4_parser_class_name[::rline_[] = +yy::]b4_parser_class_name[::yyrline_[] = { ]b4_rline[ }; -/** Print the state stack from its BOTTOM up to its TOP (included). */ - +// Print the state stack on the debug stream. void -yy::]b4_parser_class_name[::stack_print_ () +yy::]b4_parser_class_name[::yystack_print_ () { - cdebug_ << "state stack now"; - for (StateStack::ConstIterator i = state_stack_.begin (); - i != state_stack_.end (); ++i) - cdebug_ << ' ' << *i; - cdebug_ << std::endl; + *yycdebug_ << "Stack now"; + for (state_stack_type::const_iterator i = yystate_stack_.begin (); + i != yystate_stack_.end (); ++i) + *yycdebug_ << ' ' << *i; + *yycdebug_ << std::endl; } -/** Report that the YYRULE is going to be reduced. */ - +// Report on the debug stream that the rule \a yyrule is going to be reduced. void -yy::]b4_parser_class_name[::reduce_print_ (int yyrule) +yy::]b4_parser_class_name[::yyreduce_print_ (int yyrule) { - unsigned int yylno = rline_[yyrule]; + unsigned int yylno = yyrline_[yyrule]; /* Print the symbols being reduced, and their result. */ - cdebug_ << "Reducing via rule " << n_ - 1 << " (line " << yylno << "), "; - for (]b4_int_type_for([b4_prhs])[ i = prhs_[n_]; - 0 <= rhs_[i]; ++i) - cdebug_ << name_[rhs_[i]] << ' '; - cdebug_ << "-> " << name_[r1_[n_]] << std::endl; + *yycdebug_ << "Reducing stack by rule " << yyn_ - 1 + << " (line " << yylno << "), "; + for (]b4_int_type_for([b4_prhs])[ i = yyprhs_[yyn_]; + 0 <= yyrhs_[i]; ++i) + *yycdebug_ << yytname_[yyrhs_[i]] << ' '; + *yycdebug_ << "-> " << yytname_[yyr1_[yyn_]] << std::endl; } #endif // YYDEBUG /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */ -yy::]b4_parser_class_name[::TokenNumberType -yy::]b4_parser_class_name[::translate_ (int token) +yy::]b4_parser_class_name[::token_number_type +yy::]b4_parser_class_name[::yytranslate_ (int token) { static - const TokenNumberType + const token_number_type translate_table[] = { ]b4_translate[ }; - if ((unsigned int) token <= user_token_number_max_) + if ((unsigned int) token <= yyuser_token_number_max_) return translate_table[token]; else - return undef_token_; + return yyundef_token_; } -const int yy::]b4_parser_class_name[::eof_ = 0; -const int yy::]b4_parser_class_name[::last_ = ]b4_last[; -const int yy::]b4_parser_class_name[::nnts_ = ]b4_nterms_number[; -const int yy::]b4_parser_class_name[::empty_ = -2; -const int yy::]b4_parser_class_name[::final_ = ]b4_final_state_number[; -const int yy::]b4_parser_class_name[::terror_ = 1; -const int yy::]b4_parser_class_name[::errcode_ = 256; -const int yy::]b4_parser_class_name[::ntokens_ = ]b4_tokens_number[; +const int yy::]b4_parser_class_name[::yyeof_ = 0; +const int yy::]b4_parser_class_name[::yylast_ = ]b4_last[; +const int yy::]b4_parser_class_name[::yynnts_ = ]b4_nterms_number[; +const int yy::]b4_parser_class_name[::yyempty_ = -2; +const int yy::]b4_parser_class_name[::yyfinal_ = ]b4_final_state_number[; +const int yy::]b4_parser_class_name[::yyterror_ = 1; +const int yy::]b4_parser_class_name[::yyerrcode_ = 256; +const int yy::]b4_parser_class_name[::yyntokens_ = ]b4_tokens_number[; -const unsigned int yy::]b4_parser_class_name[::user_token_number_max_ = ]b4_user_token_number_max[; -const yy::]b4_parser_class_name[::TokenNumberType yy::]b4_parser_class_name[::undef_token_ = ]b4_undef_token_number[; +const unsigned int yy::]b4_parser_class_name[::yyuser_token_number_max_ = ]b4_user_token_number_max[; +const yy::]b4_parser_class_name[::token_number_type yy::]b4_parser_class_name[::yyundef_token_ = ]b4_undef_token_number[; ]b4_epilogue dnl @output stack.hh -b4_copyright([Stack handling for Bison C++ parsers], [2002, 2003, 2004])[ +b4_copyright([stack handling for Bison C++ parsers], [2002, 2003, 2004, 2005])[ #ifndef BISON_STACK_HH # define BISON_STACK_HH @@ -915,19 +1049,20 @@ b4_copyright([Stack handling for Bison C++ parsers], [2002, 2003, 2004])[ namespace yy { - template < class T, class S = std::deque< T > > - class Stack + template > + class stack { public: - typedef typename S::iterator Iterator; - typedef typename S::const_iterator ConstIterator; + // Hide our reversed order. + typedef typename S::reverse_iterator iterator; + typedef typename S::const_reverse_iterator const_iterator; - Stack () : seq_ () + stack () : seq_ () { } - Stack (unsigned int n) : seq_ (n) + stack (unsigned int n) : seq_ (n) { } @@ -967,20 +1102,21 @@ namespace yy return seq_.size (); } - inline ConstIterator begin () const { return seq_.begin (); } - inline ConstIterator end () const { return seq_.end (); } + inline const_iterator begin () const { return seq_.rbegin (); } + inline const_iterator end () const { return seq_.rend (); } private: S seq_; }; - template < class T, class S = Stack< T > > - class Slice + /// Present a slice of the top of a stack. + template > + class slice { public: - Slice (const S& stack, + slice (const S& stack, unsigned int range) : stack_ (stack), range_ (range) { @@ -1003,11 +1139,11 @@ namespace yy #endif // not BISON_STACK_HH] dnl @output position.hh -b4_copyright([Position class for Bison C++ parsers], [2002, 2003, 2004])[ +b4_copyright([Position class for Bison C++ parsers], [2002, 2003, 2004, 2005])[ /** ** \file position.hh - ** Define the Location class. + ** Define the position class. */ #ifndef BISON_POSITION_HH @@ -1018,21 +1154,21 @@ b4_copyright([Position class for Bison C++ parsers], [2002, 2003, 2004])[ namespace yy { - /** \brief Abstract a Position. */ - class Position + /// Abstract a position. + class position { public: - /** \brief Initial column number. */ + /// Initial column number. static const unsigned int initial_column = 0; - /** \brief Initial line number. */ + /// Initial line number. static const unsigned int initial_line = 1; /** \name Ctor & dtor. ** \{ */ public: - /** \brief Construct a Position. */ - Position () : - filename (), + /// Construct a position. + position () : + filename (0), line (initial_line), column (initial_column) { @@ -1043,14 +1179,14 @@ namespace yy /** \name Line and Column related manipulators ** \{ */ public: - /** \brief (line related) Advance to the COUNT next lines. */ + /// (line related) Advance to the COUNT next lines. inline void lines (int count = 1) { column = initial_column; line += count; } - /** \brief (column related) Advance to the COUNT next columns. */ + /// (column related) Advance to the COUNT next columns. inline void columns (int count = 1) { int leftmost = initial_column; @@ -1063,64 +1199,64 @@ namespace yy /** \} */ public: - /** \brief File name to which this position refers. */ - std::string filename; - /** \brief Current line number. */ + /// File name to which this position refers. + ]b4_filename_type[* filename; + /// Current line number. unsigned int line; - /** \brief Current column number. */ + /// Current column number. unsigned int column; }; - /** \brief Add and assign a Position. */ - inline const Position& - operator+= (Position& res, const int width) + /// Add and assign a position. + inline const position& + operator+= (position& res, const int width) { res.columns (width); return res; } - /** \brief Add two Position objects. */ - inline const Position - operator+ (const Position& begin, const int width) + /// Add two position objects. + inline const position + operator+ (const position& begin, const int width) { - Position res = begin; + position res = begin; return res += width; } - /** \brief Add and assign a Position. */ - inline const Position& - operator-= (Position& res, const int width) + /// Add and assign a position. + inline const position& + operator-= (position& res, const int width) { return res += -width; } - /** \brief Add two Position objects. */ - inline const Position - operator- (const Position& begin, const int width) + /// Add two position objects. + inline const position + operator- (const position& begin, const int width) { return begin + -width; } /** \brief Intercept output stream redirection. ** \param ostr the destination output stream - ** \param pos a reference to the Position to redirect + ** \param pos a reference to the position to redirect */ inline std::ostream& - operator<< (std::ostream& ostr, const Position& pos) + operator<< (std::ostream& ostr, const position& pos) { - if (!pos.filename.empty ()) - ostr << pos.filename << ':'; + if (pos.filename) + ostr << *pos.filename << ':'; return ostr << pos.line << '.' << pos.column; } } #endif // not BISON_POSITION_HH] @output location.hh -b4_copyright([Location class for Bison C++ parsers], [2002, 2003, 2004])[ +b4_copyright([Location class for Bison C++ parsers], [2002, 2003, 2004, 2005])[ /** ** \file location.hh - ** Define the Location class. + ** Define the location class. */ #ifndef BISON_LOCATION_HH @@ -1133,14 +1269,14 @@ b4_copyright([Location class for Bison C++ parsers], [2002, 2003, 2004])[ namespace yy { - /** \brief Abstract a Location. */ - class Location + /// Abstract a location. + class location { /** \name Ctor & dtor. ** \{ */ public: - /** \brief Construct a Location. */ - Location (void) : + /// Construct a location. + location () : begin (), end () { @@ -1151,19 +1287,19 @@ namespace yy /** \name Line and Column related manipulators ** \{ */ public: - /** \brief Reset initial location to final location. */ - inline void step (void) + /// Reset initial location to final location. + inline void step () { begin = end; } - /** \brief Extend the current location to the COUNT next columns. */ + /// Extend the current location to the COUNT next columns. inline void columns (unsigned int count = 1) { end += count; } - /** \brief Extend the current location to the COUNT next lines. */ + /// Extend the current location to the COUNT next lines. inline void lines (unsigned int count = 1) { end.lines (count); @@ -1172,30 +1308,30 @@ namespace yy public: - /** \brief Beginning of the located region. */ - Position begin; - /** \brief End of the located region. */ - Position end; + /// Beginning of the located region. + position begin; + /// End of the located region. + position end; }; - /** \brief Join two Location objects to create a Location. */ - inline const Location operator+ (const Location& begin, const Location& end) + /// Join two location objects to create a location. + inline const location operator+ (const location& begin, const location& end) { - Location res = begin; + location res = begin; res.end = end.end; return res; } - /** \brief Add two Location objects */ - inline const Location operator+ (const Location& begin, unsigned int width) + /// Add two location objects. + inline const location operator+ (const location& begin, unsigned int width) { - Location res = begin; + location res = begin; res.columns (width); return res; } - /** \brief Add and assign a Location */ - inline Location &operator+= (Location& res, unsigned int width) + /// Add and assign a location. + inline location& operator+= (location& res, unsigned int width) { res.columns (width); return res; @@ -1203,15 +1339,17 @@ namespace yy /** \brief Intercept output stream redirection. ** \param ostr the destination output stream - ** \param loc a reference to the Location to redirect + ** \param loc a reference to the location to redirect ** ** Avoid duplicate information. */ - inline std::ostream& operator<< (std::ostream& ostr, const Location& loc) + inline std::ostream& operator<< (std::ostream& ostr, const location& loc) { - Position last = loc.end - 1; + position last = loc.end - 1; ostr << loc.begin; - if (loc.begin.filename != last.filename) + if (last.filename + && (!loc.begin.filename + || *loc.begin.filename != *last.filename)) ostr << '-' << last; else if (loc.begin.line != last.line) ostr << '-' << last.line << '.' << last.column; diff --git a/src/bin/bison/data/m4sugar/m4sugar.m4 b/src/bin/bison/data/m4sugar/m4sugar.m4 index 83c2ac6d55..bd6c8d68c1 100644 --- a/src/bin/bison/data/m4sugar/m4sugar.m4 +++ b/src/bin/bison/data/m4sugar/m4sugar.m4 @@ -2,7 +2,9 @@ divert(-1)# -*- Autoconf -*- # This file is part of Autoconf. # Base M4 layer. # Requires GNU M4. -# Copyright (C) 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc. +# +# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005 Free Software +# Foundation, Inc. # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -16,8 +18,8 @@ divert(-1)# -*- Autoconf -*- # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA -# 02111-1307, USA. +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +# 02110-1301, USA. # # As a special exception, the Free Software Foundation gives unlimited # permission to copy, distribute and modify the configure scripts that @@ -58,7 +60,7 @@ changequote([, ]) # long macros we define. ifdef([__gnu__], , [errprint(M4sugar requires GNU M4. Install it before installing M4sugar or -set the M4 environment variable to its path name.) +set the M4 environment variable to its absolute file name.) m4exit(2)]) @@ -83,12 +85,12 @@ m4_undefine([undefine]) # Define DST as the definition of SRC. # What's the difference between: # 1. m4_copy([from], [to]) -# 2. m4_define([from], [to($@)]) -# Well, obviously 1 is more expansive in space. Maybe 2 is more expansive +# 2. m4_define([to], [from($@)]) +# Well, obviously 1 is more expensive in space. Maybe 2 is more expensive # in time, but because of the space cost of 1, it's not that obvious. # Nevertheless, one huge difference is the handling of `$0'. If `from' # uses `$0', then with 1, `to''s `$0' is `to', while it is `from' in 2. -# The user will certainly prefer see `from'. +# The user will certainly prefer to see `to'. m4_define([m4_copy], [m4_define([$2], m4_defn([$1]))]) @@ -131,7 +133,7 @@ m4_rename_m4([eval]) m4_rename_m4([format]) m4_rename_m4([ifdef]) m4_rename([ifelse], [m4_if]) -m4_rename_m4([include]) +m4_undefine([include]) m4_rename_m4([incr]) m4_rename_m4([index]) m4_rename_m4([indir]) @@ -144,7 +146,7 @@ m4_undefine([popdef]) m4_rename_m4([pushdef]) m4_rename([regexp], [m4_bregexp]) m4_rename_m4([shift]) -m4_rename_m4([sinclude]) +m4_undefine([sinclude]) m4_rename_m4([substr]) m4_rename_m4([symbols]) m4_rename_m4([syscmd]) @@ -199,76 +201,29 @@ m4_define([m4_assert], [m4_fatal([assert failed: $1], [$2])])]) + ## ------------- ## ## 3. Warnings. ## ## ------------- ## -# m4_warning_ifelse(CATEGORY, IF-TRUE, IF-FALSE) -# ---------------------------------------------- -# If the CATEGORY of warnings is enabled, expand IF_TRUE otherwise -# IF-FALSE. -# -# The variable `m4_warnings' contains a comma separated list of -# warnings which order is the converse from the one specified by -# the user, i.e., if she specified `-W error,none,obsolete', -# `m4_warnings' is `obsolete,none,error'. We read it from left to -# right, and: -# - if none or noCATEGORY is met, run IF-FALSE -# - if all or CATEGORY is met, run IF-TRUE -# - if there is nothing left, run IF-FALSE. -m4_define([m4_warning_ifelse], -[_m4_warning_ifelse([$1], [$2], [$3], m4_warnings)]) - - -# _m4_warning_ifelse(CATEGORY, IF-TRUE, IF-FALSE, WARNING1, ...) -# -------------------------------------------------------------- -# Implementation of the loop described above. -m4_define([_m4_warning_ifelse], -[m4_case([$4], - [$1], [$2], - [all], [$2], - [], [$3], - [none], [$3], - [no-$1], [$3], - [$0([$1], [$2], [$3], m4_shiftn(4, $@))])]) - - -# _m4_warning_error_ifelse(IF-TRUE, IF-FALSE) -# ------------------------------------------- -# The same as m4_warning_ifelse, but scan for `error' only. -m4_define([_m4_warning_error_ifelse], -[__m4_warning_error_ifelse([$1], [$2], m4_warnings)]) - - -# __m4_warning_error_ifelse(IF-TRUE, IF-FALSE) -# -------------------------------------------- -# The same as _m4_warning_ifelse, but scan for `error' only. -m4_define([__m4_warning_error_ifelse], -[m4_case([$3], - [error], [$1], - [], [$2], - [no-error], [$2], - [$0([$1], [$2], m4_shiftn(3, $@))])]) - - - -# _m4_warn(MESSAGE) -# ----------------- -# Report MESSAGE as a warning, unless the user requested -W error, -# in which case report a fatal error. -m4_define([_m4_warn], -[_m4_warning_error_ifelse([m4_fatal([$1])], - [m4_warning([$1])])]) +# _m4_warn(CATEGORY, MESSAGE, STACK-TRACE) +# ---------------------------------------- +# Report a MESSAGE to the user if the CATEGORY of warnings is enabled. +# This is for traces only. +# The STACK-TRACE is a \n-separated list of "LOCATION: MESSAGE". +m4_define([_m4_warn], []) # m4_warn(CATEGORY, MESSAGE) # -------------------------- -# Report a MESSAGE to the autoconf user if the CATEGORY of warnings -# is requested (in fact, not disabled). +# Report a MESSAGE to the user if the CATEGORY of warnings is enabled. m4_define([m4_warn], -[m4_warning_ifelse([$1], [_m4_warn([$2])])]) - +[_m4_warn([$1], [$2], +m4_ifdef([m4_expansion_stack], + [m4_defn([m4_expansion_stack]) +m4_location[: the top level]]))dnl +]) @@ -294,7 +249,7 @@ m4_define([m4_warn], # been included. m4_define([m4_include_unique], [m4_ifdef([m4_include($1)], - [m4_warn([syntax], [file `$1' included several times])])dnl + [m4_warn([syntax], [file `$1' included several times])])dnl m4_define([m4_include($1)])]) @@ -347,7 +302,7 @@ m4_define([m4_ifval], m4_define([m4_n], [m4_if([$1], [], [], - [$1 + [$1 ])]) @@ -358,7 +313,7 @@ m4_define([m4_n], m4_define([m4_ifvaln], [m4_if([$1], [], [m4_n([$3])], - [m4_n([$2])])]) + [m4_n([$2])])]) # m4_ifset(MACRO, [IF-TRUE], [IF-FALSE]) @@ -367,8 +322,8 @@ m4_define([m4_ifvaln], # expand IF-FALSE, otherwise IF-TRUE. m4_define([m4_ifset], [m4_ifdef([$1], - [m4_if(m4_defn([$1]), [], [$3], [$2])], - [$3])]) + [m4_ifval(m4_defn([$1]), [$2], [$3])], + [$3])]) # m4_ifndef(NAME, [IF-NOT-DEFINED], [IF-DEFINED]) @@ -419,23 +374,32 @@ m4_define([m4_case], # All the values are optional, and the macro is robust to active symbols # properly quoted. m4_define([m4_bmatch], -[m4_if([$#], 0, [], - [$#], 1, [], +[m4_if([$#], 0, [m4_fatal([$0: too few arguments: $#])], + [$#], 1, [m4_fatal([$0: too few arguments: $#: $1])], [$#], 2, [$2], [m4_if(m4_bregexp([$1], [$2]), -1, [$0([$1], m4_shiftn(3, $@))], [$3])])]) +# m4_car(LIST) +# m4_cdr(LIST) +# ------------ +# Manipulate m4 lists. +m4_define([m4_car], [[$1]]) +m4_define([m4_cdr], +[m4_if([$#], 0, [m4_fatal([$0: cannot be called without arguments])], + [$#], 1, [], + [m4_dquote(m4_shift($@))])]) + + # m4_map(MACRO, LIST) # ------------------- # Invoke MACRO($1), MACRO($2) etc. where $1, $2... are the elements # of LIST (which can be lists themselves, for multiple arguments MACROs). m4_define([m4_fst], [$1]) m4_define([m4_map], -[m4_if([$2], [], [], - [$2], [[]], [], - [$1(m4_fst($2))[]dnl -m4_map([$1], m4_cdr($2))])]) +[m4_ifval([$2], + [$1(m4_fst($2))[]m4_map([$1], m4_cdr($2))])]) # m4_map_sep(MACRO, SEPARATOR, LIST) @@ -444,20 +408,16 @@ m4_map([$1], m4_cdr($2))])]) # are the elements of LIST (which can be lists themselves, for multiple # arguments MACROs). m4_define([m4_map_sep], -[m4_if([$3], [[]], [], - [$1(m4_fst($3))[]dnl -m4_if(m4_cdr($3), - [[]], [], - [$2])[]dnl -m4_map_sep([$1], [$2], m4_cdr($3))])]) +[m4_ifval([$3], + [$1(m4_fst($3))[]m4_map([$2[]$1], m4_cdr($3))])]) ## ---------------------------------------- ## ## 6. Enhanced version of some primitives. ## ## ---------------------------------------- ## -# m4_patsubsts(STRING, RE1, SUBST1, RE2, SUBST2, ...) -# --------------------------------------------------- +# m4_bpatsubsts(STRING, RE1, SUBST1, RE2, SUBST2, ...) +# ---------------------------------------------------- # m4 equivalent of # # $_ = STRING; @@ -468,7 +428,7 @@ m4_map_sep([$1], [$2], m4_cdr($3))])]) # All the values are optional, and the macro is robust to active symbols # properly quoted. # -# I would have liked to name this macro `m4_patsubst', unfortunately, +# I would have liked to name this macro `m4_bpatsubst', unfortunately, # due to quotation problems, I need to double quote $1 below, therefore # the anchors are broken :( I can't let users be trapped by that. m4_define([m4_bpatsubsts], @@ -476,7 +436,7 @@ m4_define([m4_bpatsubsts], [$#], 1, [m4_fatal([$0: too few arguments: $#: $1])], [$#], 2, [m4_builtin([patsubst], $@)], [$0(m4_builtin([patsubst], [[$1]], [$2], [$3]), - m4_shiftn(3, $@))])]) + m4_shiftn(3, $@))])]) @@ -511,7 +471,7 @@ m4_define([m4_default], # undefined. m4_define([m4_defn], [m4_ifndef([$1], - [m4_fatal([$0: undefined macro: $1])])dnl + [m4_fatal([$0: undefined macro: $1])])dnl m4_builtin([defn], $@)]) @@ -519,7 +479,7 @@ m4_builtin([defn], $@)]) # --------------------- m4_define([_m4_dumpdefs_up], [m4_ifdef([$1], - [m4_pushdef([_m4_dumpdefs], m4_defn([$1]))dnl + [m4_pushdef([_m4_dumpdefs], m4_defn([$1]))dnl m4_dumpdef([$1])dnl m4_popdef([$1])dnl _m4_dumpdefs_up([$1])])]) @@ -529,7 +489,7 @@ _m4_dumpdefs_up([$1])])]) # ----------------------- m4_define([_m4_dumpdefs_down], [m4_ifdef([_m4_dumpdefs], - [m4_pushdef([$1], m4_defn([_m4_dumpdefs]))dnl + [m4_pushdef([$1], m4_defn([_m4_dumpdefs]))dnl m4_popdef([_m4_dumpdefs])dnl _m4_dumpdefs_down([$1])])]) @@ -549,7 +509,7 @@ _m4_dumpdefs_down([$1])]) # undefined. m4_define([m4_popdef], [m4_ifndef([$1], - [m4_fatal([$0: undefined macro: $1])])dnl + [m4_fatal([$0: undefined macro: $1])])dnl m4_builtin([popdef], $@)]) @@ -594,7 +554,7 @@ m4_define([_m4_shiftn], # undefined. m4_define([m4_undefine], [m4_ifndef([$1], - [m4_fatal([$0: undefined macro: $1])])dnl + [m4_fatal([$0: undefined macro: $1])])dnl m4_builtin([undefine], $@)]) @@ -609,8 +569,8 @@ m4_builtin([undefine], $@)]) # Both limits are included, and bounds are checked for consistency. m4_define([m4_for], [m4_case(m4_sign(m4_eval($3 - $2)), - 1, [m4_assert(m4_sign(m4_default($4, 1)) == 1)], - -1, [m4_assert(m4_sign(m4_default($4, -1)) == -1)])dnl + 1, [m4_assert(m4_sign(m4_default($4, 1)) == 1)], + -1, [m4_assert(m4_sign(m4_default($4, -1)) == -1)])dnl m4_pushdef([$1], [$2])dnl m4_if(m4_eval([$3 > $2]), 1, [_m4_for([$1], [$3], m4_default([$4], 1), [$5])], @@ -639,8 +599,8 @@ m4_if($1, [$2], [], # | [m4_pushdef([$1])_foreach([$1], [$2], [$3])m4_popdef([$1])]) # | m4_define([_arg1], [$1]) # | m4_define([_foreach], -# | [m4_if([$2], [()], , -# | [m4_define([$1], _arg1$2)$3[]_foreach([$1], +# | [m4_if([$2], [()], , +# | [m4_define([$1], _arg1$2)$3[]_foreach([$1], # | (shift$2), # | [$3])])]) # @@ -670,7 +630,7 @@ m4_if($1, [$2], [], # | m4_define([_arg1], [[$1]]) # | m4_define([_foreach], # | [m4_if($2, [()], , -# | [m4_define([$1], [_arg1$2])$3[]_foreach([$1], +# | [m4_define([$1], [_arg1$2])$3[]_foreach([$1], # | [(shift$2)], # | [$3])])]) # @@ -695,7 +655,7 @@ m4_if($1, [$2], [], # | m4_define([_arg1], [$1]) # | m4_define([_foreach], # | [m4_if($2, [], , -# | [m4_define([$1], [_arg1($2)])$3[]_foreach([$1], +# | [m4_define([$1], [_arg1($2)])$3[]_foreach([$1], # | [shift($2)], # | [$3])])]) # @@ -726,14 +686,25 @@ m4_if($1, [$2], [], m4_define([m4_foreach], [m4_pushdef([$1])_m4_foreach($@)m4_popdef([$1])]) -# Low level macros used to define m4_foreach. -m4_define([m4_car], [[$1]]) -m4_define([m4_cdr], [m4_dquote(m4_shift($@))]) m4_define([_m4_foreach], -[m4_if([$2], [[]], [], - [m4_define([$1], m4_car($2))$3[]_m4_foreach([$1], - m4_cdr($2), - [$3])])]) +[m4_ifval([$2], + [m4_define([$1], m4_car($2))$3[]dnl +_m4_foreach([$1], m4_cdr($2), [$3])])]) + + +# m4_foreach_w(VARIABLE, LIST, EXPRESSION) +# ---------------------------------------- +# +# Like m4_foreach, but the list is whitespace separated. +# +# This macro is robust to active symbols: +# m4_foreach_w([Var], [ active +# b act\ +# ive ], [-Var-])end +# => -active--b--active-end +# +m4_define([m4_foreach_w], +[m4_foreach([$1], m4_split(m4_normalize([$2])), [$3])]) @@ -745,23 +716,29 @@ m4_define([_m4_foreach], # _m4_divert(DIVERSION-NAME or NUMBER) # ------------------------------------ # If DIVERSION-NAME is the name of a diversion, return its number, -# otherwise if is a NUMBER return it. +# otherwise if it is a NUMBER return it. m4_define([_m4_divert], [m4_ifdef([_m4_divert($1)], - [m4_indir([_m4_divert($1)])], - [$1])]) + [m4_indir([_m4_divert($1)])], + [$1])]) # KILL is only used to suppress output. m4_define([_m4_divert(KILL)], -1) +# _m4_divert_n_stack +# ------------------ +# Print m4_divert_stack with newline prepended, if it's nonempty. +m4_define([_m4_divert_n_stack], +[m4_ifdef([m4_divert_stack], [ +m4_defn([m4_divert_stack])])]) + + # m4_divert(DIVERSION-NAME) # ------------------------- # Change the diversion stream to DIVERSION-NAME. m4_define([m4_divert], -[m4_define([m4_divert_stack], - m4_location[: $0: $1]m4_ifdef([m4_divert_stack], [ -m4_defn([m4_divert_stack])]))dnl +[m4_define([m4_divert_stack], m4_location[: $0: $1]_m4_divert_n_stack)dnl m4_builtin([divert], _m4_divert([$1]))dnl ]) @@ -770,11 +747,9 @@ m4_builtin([divert], _m4_divert([$1]))dnl # ------------------------------ # Change the diversion stream to DIVERSION-NAME, while stacking old values. m4_define([m4_divert_push], -[m4_pushdef([m4_divert_stack], - m4_location[: $0: $1]m4_ifdef([m4_divert_stack], [ -m4_defn([m4_divert_stack])]))dnl +[m4_pushdef([m4_divert_stack], m4_location[: $0: $1]_m4_divert_n_stack)dnl m4_pushdef([_m4_divert_diversion], [$1])dnl -m4_builtin([divert], _m4_divert(_m4_divert_diversion))dnl +m4_builtin([divert], _m4_divert([$1]))dnl ]) @@ -782,18 +757,19 @@ m4_builtin([divert], _m4_divert(_m4_divert_diversion))dnl # ------------------------------- # Change the diversion stream to its previous value, unstacking it. # If specified, verify we left DIVERSION-NAME. +# When we pop the last value from the stack, we divert to -1. m4_define([m4_divert_pop], -[m4_ifval([$1], - [m4_if(_m4_divert([$1]), m4_divnum, [], - [m4_fatal([$0($1): diversion mismatch: ] -m4_defn([m4_divert_stack]))])])dnl -m4_popdef([_m4_divert_diversion])dnl -dnl m4_ifndef([_m4_divert_diversion], -dnl [m4_fatal([too many m4_divert_pop])])dnl -m4_builtin([divert], - m4_ifdef([_m4_divert_diversion], - [_m4_divert(_m4_divert_diversion)], -1))dnl +[m4_ifndef([_m4_divert_diversion], + [m4_fatal([too many m4_divert_pop])])dnl +m4_if([$1], [], [], + [$1], m4_defn([_m4_divert_diversion]), [], + [m4_fatal([$0($1): diversion mismatch: ]_m4_divert_n_stack)])dnl m4_popdef([m4_divert_stack])dnl +m4_popdef([_m4_divert_diversion])dnl +m4_builtin([divert], + m4_ifdef([_m4_divert_diversion], + [_m4_divert(m4_defn([_m4_divert_diversion]))], + -1))dnl ]) @@ -866,18 +842,18 @@ m4_define([m4_undivert], # must keep the expansions of the various level of m4_require separated. # Right before executing the epilogue of TEST1, we have: # -# GROW - 2: Test...3 -# GROW - 1: Test...2 -# GROW: Test...1 -# BODY: +# GROW - 2: Test...3 +# GROW - 1: Test...2 +# GROW: Test...1 +# BODY: # # Finally the epilogue of TEST1 undiverts GROW - 2, GROW - 1, and # GROW into the regular flow, BODY. # -# GROW - 2: -# GROW - 1: -# GROW: -# BODY: Test...3; Test...2; Test...1 +# GROW - 2: +# GROW - 1: +# GROW: +# BODY: Test...3; Test...2; Test...1 # # (The semicolons are here for clarification, but of course are not # emitted.) This is what Autoconf 2.0 (I think) to 2.13 (I'm sure) @@ -901,27 +877,27 @@ m4_define([m4_undivert], # # The dependencies between the macros are: # -# 3 --- 2b -# / \ is m4_require'd by -# / \ left -------------------- right -# 2a ------------ 1 +# 3 --- 2b +# / \ is m4_require'd by +# / \ left -------------------- right +# 2a ------------ 1 # # If you strictly apply the rules given in the previous section you get: # -# GROW - 2: TEST3 -# GROW - 1: TEST2a; TEST2b -# GROW: TEST1 -# BODY: +# GROW - 2: TEST3 +# GROW - 1: TEST2a; TEST2b +# GROW: TEST1 +# BODY: # # (TEST2a, although required by TEST3 is not expanded in GROW - 3 # because is has already been expanded before in GROW - 1, so it has # been AC_PROVIDE'd, so it is not expanded again) so when you undivert # the stack of diversions, you get: # -# GROW - 2: -# GROW - 1: -# GROW: -# BODY: TEST3; TEST2a; TEST2b; TEST1 +# GROW - 2: +# GROW - 1: +# GROW: +# BODY: TEST3; TEST2a; TEST2b; TEST1 # # i.e., TEST2a is expanded after TEST3 although the latter required the # former. @@ -939,48 +915,48 @@ m4_define([m4_undivert], # In the example above, when TEST2a is expanded, but it's epilogue is # not run yet, you have: # -# GROW - 2: -# GROW - 1: TEST2a -# GROW: Elaboration of TEST1 -# BODY: +# GROW - 2: +# GROW - 1: TEST2a +# GROW: Elaboration of TEST1 +# BODY: # # The epilogue of TEST2a emits it immediately: # -# GROW - 2: -# GROW - 1: -# GROW: Elaboration of TEST1 -# BODY: TEST2a +# GROW - 2: +# GROW - 1: +# GROW: Elaboration of TEST1 +# BODY: TEST2a # # TEST2b then requires TEST3, so right before the epilogue of TEST3, you # have: # -# GROW - 2: TEST3 -# GROW - 1: Elaboration of TEST2b -# GROW: Elaboration of TEST1 -# BODY: TEST2a +# GROW - 2: TEST3 +# GROW - 1: Elaboration of TEST2b +# GROW: Elaboration of TEST1 +# BODY: TEST2a # # The epilogue of TEST3 emits it: # -# GROW - 2: -# GROW - 1: Elaboration of TEST2b -# GROW: Elaboration of TEST1 -# BODY: TEST2a; TEST3 +# GROW - 2: +# GROW - 1: Elaboration of TEST2b +# GROW: Elaboration of TEST1 +# BODY: TEST2a; TEST3 # # TEST2b is now completely expanded, and emitted: # -# GROW - 2: -# GROW - 1: -# GROW: Elaboration of TEST1 -# BODY: TEST2a; TEST3; TEST2b +# GROW - 2: +# GROW - 1: +# GROW: Elaboration of TEST1 +# BODY: TEST2a; TEST3; TEST2b # # and finally, TEST1 is finished and emitted: # -# GROW - 2: -# GROW - 1: -# GROW: -# BODY: TEST2a; TEST3; TEST2b: TEST1 +# GROW - 2: +# GROW - 1: +# GROW: +# BODY: TEST2a; TEST3; TEST2b: TEST1 # -# The idea, is simple, but the implementation is a bit evolved. If you +# The idea is simple, but the implementation is a bit evolved. If you # are like me, you will want to see the actual functioning of this # implementation to be convinced. The next section gives the full # details. @@ -991,18 +967,18 @@ m4_define([m4_undivert], # # We consider the macros above, and this configure.ac: # -# AC_INIT -# TEST1 +# AC_INIT +# TEST1 # # You should keep the definitions of _m4_defun_pro, _m4_defun_epi, and # m4_require at hand to follow the steps. # -# This implements tries not to assume that of the current diversion is +# This implements tries not to assume that the current diversion is # BODY, so as soon as a macro (m4_defun'd) is expanded, we first # record the current diversion under the name _m4_divert_dump (denoted # DUMP below for short). This introduces an important difference with # the previous versions of Autoconf: you cannot use m4_require if you -# were not inside an m4_defun'd macro, and especially, you cannot +# are not inside an m4_defun'd macro, and especially, you cannot # m4_require directly from the top level. # # We have not tried to simulate the old behavior (better yet, we @@ -1017,104 +993,64 @@ m4_define([m4_undivert], # diversion stack: BODY |- # # * TEST1 is expanded -# The prologue of TEST1 sets AC_DIVERSION_DUMP, which is the diversion +# The prologue of TEST1 sets _m4_divert_dump, which is the diversion # where the current elaboration will be dumped, to the current # diversion. It also m4_divert_push to GROW, where the full # expansion of TEST1 and its dependencies will be elaborated. -# DUMP: BODY -# BODY: empty -# diversions: GROW, BODY |- -# -# * TEST1 requires TEST2a: prologue -# m4_require m4_divert_pushes another temporary diversion GROW - 1 (in -# fact, the diversion whose number is one less than the current -# diversion), and expands TEST2a in there. -# DUMP: BODY -# BODY: empty -# diversions: GROW-1, GROW, BODY |- -# -# * TEST2a is expanded. -# Its prologue pushes the current diversion again. -# DUMP: BODY -# BODY: empty -# diversions: GROW - 1, GROW - 1, GROW, BODY |- -# It is expanded in GROW - 1, and GROW - 1 is popped by the epilogue -# of TEST2a. # DUMP: BODY -# BODY: nothing +# BODY: empty +# diversions: GROW, BODY |- +# +# * TEST1 requires TEST2a +# _m4_require_call m4_divert_pushes another temporary diversion, +# GROW - 1, and expands TEST2a in there. +# DUMP: BODY +# BODY: empty # GROW - 1: TEST2a # diversions: GROW - 1, GROW, BODY |- +# Than the content of the temporary diversion is moved to DUMP and the +# temporary diversion is popped. +# DUMP: BODY +# BODY: TEST2a +# diversions: GROW, BODY |- # -# * TEST1 requires TEST2a: epilogue -# The content of the current diversion is appended to DUMP (and removed -# from the current diversion). A diversion is popped. -# DUMP: BODY -# BODY: TEST2a -# diversions: GROW, BODY |- +# * TEST1 requires TEST2b +# Again, _m4_require_call pushes GROW - 1 and heads to expand TEST2b. +# DUMP: BODY +# BODY: TEST2a +# diversions: GROW - 1, GROW, BODY |- # -# * TEST1 requires TEST2b: prologue -# m4_require pushes GROW - 1 and expands TEST2b. -# DUMP: BODY -# BODY: TEST2a -# diversions: GROW - 1, GROW, BODY |- +# * TEST2b requires TEST3 +# _m4_require_call pushes GROW - 2 and expands TEST3 here. +# (TEST3 requires TEST2a, but TEST2a has already been m4_provide'd, so +# nothing happens.) +# DUMP: BODY +# BODY: TEST2a +# GROW - 2: TEST3 +# diversions: GROW - 2, GROW - 1, GROW, BODY |- +# Than the diversion is appended to DUMP, and popped. +# DUMP: BODY +# BODY: TEST2a; TEST3 +# diversions: GROW - 1, GROW, BODY |- # -# * TEST2b is expanded. -# Its prologue pushes the current diversion again. -# DUMP: BODY -# BODY: TEST2a -# diversions: GROW - 1, GROW - 1, GROW, BODY |- -# The body is expanded here. -# -# * TEST2b requires TEST3: prologue -# m4_require pushes GROW - 2 and expands TEST3. -# DUMP: BODY -# BODY: TEST2a -# diversions: GROW - 2, GROW - 1, GROW - 1, GROW, BODY |- -# -# * TEST3 is expanded. -# Its prologue pushes the current diversion again. -# DUMP: BODY -# BODY: TEST2a -# diversions: GROW-2, GROW-2, GROW-1, GROW-1, GROW, BODY |- -# TEST3 requires TEST2a, but TEST2a has already been AC_PROVIDE'd, so -# nothing happens. It's body is expanded here, and its epilogue pops a -# diversion. -# DUMP: BODY -# BODY: TEST2a -# GROW - 2: TEST3 -# diversions: GROW - 2, GROW - 1, GROW - 1, GROW, BODY |- -# -# * TEST2b requires TEST3: epilogue -# The current diversion is appended to DUMP, and a diversion is popped. -# DUMP: BODY -# BODY: TEST2a; TEST3 -# diversions: GROW - 1, GROW - 1, GROW, BODY |- -# The content of TEST2b is expanded here. -# DUMP: BODY -# BODY: TEST2a; TEST3 -# GROW - 1: TEST2b, -# diversions: GROW - 1, GROW - 1, GROW, BODY |- -# The epilogue of TEST2b pops a diversion. -# DUMP: BODY -# BODY: TEST2a; TEST3 -# GROW - 1: TEST2b, -# diversions: GROW - 1, GROW, BODY |- -# -# * TEST1 requires TEST2b: epilogue -# The current diversion is appended to DUMP, and a diversion is popped. -# DUMP: BODY -# BODY: TEST2a; TEST3; TEST2b -# diversions: GROW, BODY |- +# * TEST1 requires TEST2b (contd.) +# The content of TEST2b is expanded... +# DUMP: BODY +# BODY: TEST2a; TEST3 +# GROW - 1: TEST2b, +# diversions: GROW - 1, GROW, BODY |- +# ... and moved to DUMP. +# DUMP: BODY +# BODY: TEST2a; TEST3; TEST2b +# diversions: GROW, BODY |- # # * TEST1 is expanded: epilogue -# TEST1's own content is in GROW, and it's epilogue pops a diversion. -# DUMP: BODY -# BODY: TEST2a; TEST3; TEST2b -# GROW: TEST1 -# diversions: BODY |- -# Here, the epilogue of TEST1 notices the elaboration is done because -# DUMP and the current diversion are the same, it then undiverts -# GROW by hand, and undefines DUMP. +# TEST1's own content is in GROW... +# DUMP: BODY +# BODY: TEST2a; TEST3; TEST2b +# GROW: TEST1 +# diversions: BODY |- +# ... and it's epilogue moves it to DUMP and then undefines DUMP. # DUMP: undefined # BODY: TEST2a; TEST3; TEST2b; TEST1 # diversions: BODY |- @@ -1136,37 +1072,21 @@ m4_define([m4_undivert], # we prepend its name in m4_expansion_stack, and when we exit the # macro, we remove it (thanks to pushdef/popdef). # -# In addition, we want to use the expansion stack to detect circular -# m4_require dependencies. This means we need to browse the stack to -# check whether a macro being expanded is m4_require'd. For ease of -# implementation, and certainly for the benefit of performances, we -# don't browse the m4_expansion_stack, rather each time we expand a -# macro FOO we define _m4_expanding(FOO). Then m4_require(BAR) simply -# needs to check whether _m4_expanding(BAR) is defined to diagnose a -# circular dependency. -# -# To improve the diagnostic, in addition to keeping track of the stack -# of macro calls, m4_expansion_stack also records the m4_require -# stack. Note that therefore an m4_defun'd macro being required will -# appear twice in the stack: the first time because it is required, -# the second because it is expanded. We can avoid this, but it has -# two small drawbacks: (i) the implementation is slightly more -# complex, and (ii) it hides the difference between define'd macros -# (which don't appear in m4_expansion_stack) and m4_defun'd macros -# (which do). The more debugging information, the better. +# In addition, we want to detect circular m4_require dependencies. +# Each time we expand a macro FOO we define _m4_expanding(FOO); and +# m4_require(BAR) simply checks whether _m4_expanding(BAR) is defined. # m4_expansion_stack_push(TEXT) # ----------------------------- m4_define([m4_expansion_stack_push], [m4_pushdef([m4_expansion_stack], - [$1]m4_ifdef([m4_expansion_stack], [ + [$1]m4_ifdef([m4_expansion_stack], [ m4_defn([m4_expansion_stack])]))]) # m4_expansion_stack_pop # ---------------------- -# Dump the expansion stack. m4_define([m4_expansion_stack_pop], [m4_popdef([m4_expansion_stack])]) @@ -1176,7 +1096,7 @@ m4_define([m4_expansion_stack_pop], # Dump the expansion stack. m4_define([m4_expansion_stack_dump], [m4_ifdef([m4_expansion_stack], - [m4_errprintn(m4_defn([m4_expansion_stack]))])dnl + [m4_errprintn(m4_defn([m4_expansion_stack]))])dnl m4_errprintn(m4_location[: the top level])]) @@ -1203,29 +1123,33 @@ m4_define([_m4_divert(GROW)], 10000) # ------------------------- # The prologue for Autoconf macros. m4_define([_m4_defun_pro], -[m4_expansion_stack_push(m4_defn([m4_location($1)])[: $1 is expanded from...])dnl +[m4_ifndef([m4_expansion_stack], [_m4_defun_pro_outer[]])dnl +m4_expansion_stack_push(m4_defn([m4_location($1)])[: $1 is expanded from...])dnl m4_pushdef([_m4_expanding($1)])dnl -m4_ifdef([_m4_divert_dump], - [m4_divert_push(m4_defn([_m4_divert_diversion]))], - [m4_copy([_m4_divert_diversion], [_m4_divert_dump])dnl -m4_divert_push([GROW])])dnl ]) +m4_define([_m4_defun_pro_outer], +[m4_copy([_m4_divert_diversion], [_m4_divert_dump])dnl +m4_divert_push([GROW])dnl +]) # _m4_defun_epi(MACRO-NAME) # ------------------------- # The Epilogue for Autoconf macros. MACRO-NAME only helps tracing # the PRO/EPI pairs. m4_define([_m4_defun_epi], -[m4_divert_pop()dnl -m4_if(_m4_divert_dump, _m4_divert_diversion, - [m4_undivert([GROW])dnl -m4_undefine([_m4_divert_dump])])dnl +[m4_popdef([_m4_expanding($1)])dnl m4_expansion_stack_pop()dnl -m4_popdef([_m4_expanding($1)])dnl +m4_ifndef([m4_expansion_stack], [_m4_defun_epi_outer[]])dnl m4_provide([$1])dnl ]) +m4_define([_m4_defun_epi_outer], +[m4_undefine([_m4_divert_dump])dnl +m4_divert_pop([GROW])dnl +m4_undivert([GROW])dnl +]) + # m4_defun(NAME, EXPANSION) # ------------------------- @@ -1240,7 +1164,7 @@ m4_provide([$1])dnl m4_define([m4_defun], [m4_define([m4_location($1)], m4_location)dnl m4_define([$1], - [_m4_defun_pro([$1])$2[]_m4_defun_epi([$1])])]) + [_m4_defun_pro([$1])$2[]_m4_defun_epi([$1])])]) # m4_defun_once(NAME, EXPANSION) @@ -1250,9 +1174,9 @@ m4_define([$1], m4_define([m4_defun_once], [m4_define([m4_location($1)], m4_location)dnl m4_define([$1], - [m4_provide_if([$1], - [m4_warn([syntax], [$1 invoked multiple times])], - [_m4_defun_pro([$1])$2[]_m4_defun_epi([$1])])])]) + [m4_provide_if([$1], + [m4_warn([syntax], [$1 invoked multiple times])], + [_m4_defun_pro([$1])$2[]_m4_defun_epi([$1])])])]) # m4_pattern_forbid(ERE, [WHY]) @@ -1278,7 +1202,7 @@ m4_define([m4_pattern_allow], []) # --------------------------------------------- m4_define([m4_before], [m4_provide_if([$2], - [m4_warn([syntax], [$2 was called before $1])])]) + [m4_warn([syntax], [$2 was called before $1])])]) # m4_require(NAME-TO-CHECK, [BODY-TO-EXPAND = NAME-TO-CHECK]) @@ -1314,34 +1238,48 @@ m4_define([m4_before], # `extension' prevents `AC_LANG_COMPILER' from having actual arguments that # it passes to `AC_LANG_COMPILER(C)'. m4_define([m4_require], -[m4_expansion_stack_push(m4_location[: $1 is required by...])dnl -m4_ifdef([_m4_expanding($1)], - [m4_fatal([$0: circular dependency of $1])])dnl +[m4_ifdef([_m4_expanding($1)], + [m4_fatal([$0: circular dependency of $1])])dnl m4_ifndef([_m4_divert_dump], - [m4_fatal([$0: cannot be used outside of an m4_defun'd macro])])dnl + [m4_fatal([$0($1): cannot be used outside of an m4_defun'd macro])])dnl m4_provide_if([$1], - [], - [m4_divert_push(m4_eval(m4_divnum - 1))dnl -m4_default([$2], [$1]) -m4_divert(m4_defn([_m4_divert_dump]))dnl -m4_undivert(m4_defn([_m4_divert_diversion]))dnl -m4_divert_pop(m4_defn([_m4_divert_dump]))])dnl -m4_provide_if([$1], - [], - [m4_warn([syntax], - [$1 is m4_require'd but is not m4_defun'd])])dnl -m4_expansion_stack_pop()dnl + [], + [_m4_require_call([$1], [$2])])dnl ]) +# _m4_require_call(BODY-TO-EXPAND) +# -------------------------------- +# If m4_require decides to expand the body, it calls this macro. +m4_define([_m4_require_call], +[m4_define([_m4_divert_grow], m4_decr(_m4_divert_grow))dnl +m4_divert_push(_m4_divert_grow)dnl +m4_default([$2], [$1]) +m4_provide_if([$1], + [], + [m4_warn([syntax], + [$1 is m4_require'd but not m4_defun'd])])dnl +m4_divert(m4_defn([_m4_divert_dump]))dnl +m4_undivert(_m4_divert_grow)dnl +m4_divert_pop(_m4_divert_grow)dnl +m4_define([_m4_divert_grow], m4_incr(_m4_divert_grow))dnl +]) + + +# _m4_divert_grow +# --------------- +# The counter for _m4_require_call. +m4_define([_m4_divert_grow], _m4_divert([GROW])) + + # m4_expand_once(TEXT, [WITNESS = TEXT]) # -------------------------------------- # If TEXT has never been expanded, expand it *here*. Use WITNESS as # as a memory that TEXT has already been expanded. m4_define([m4_expand_once], [m4_provide_if(m4_ifval([$2], [[$2]], [[$1]]), - [], - [m4_provide(m4_ifval([$2], [[$2]], [[$1]]))[]$1])]) + [], + [m4_provide(m4_ifval([$2], [[$2]], [[$1]]))[]$1])]) # m4_provide(MACRO-NAME) @@ -1358,7 +1296,7 @@ m4_define([m4_provide], # information is coded. m4_define([m4_provide_if], [m4_ifdef([m4_provide($1)], - [$2], [$3])]) + [$2], [$3])]) ## -------------------- ## @@ -1397,17 +1335,18 @@ m4_defn([m4_cr_digits])dnl # m4_re_escape(STRING) # -------------------- -# Escape BRE active characters in STRING. +# Escape RE active characters in STRING. m4_define([m4_re_escape], [m4_bpatsubst([$1], - [[][+*.]], [\\\&])]) + [[][*+.?\^$]], [\\\&])]) # m4_re_string # ------------ # Regexp for `[a-zA-Z_0-9]*' +# m4_dquote provides literal [] for the character class. m4_define([m4_re_string], -m4_defn([m4_cr_symbols2])dnl +m4_dquote(m4_defn([m4_cr_symbols2]))dnl [*]dnl ) @@ -1416,7 +1355,7 @@ m4_defn([m4_cr_symbols2])dnl # ---------- # Regexp for `[a-zA-Z_][a-zA-Z_0-9]*' m4_define([m4_re_word], -m4_defn([m4_cr_symbols1])dnl +m4_dquote(m4_defn([m4_cr_symbols1]))dnl m4_defn([m4_re_string])dnl ) @@ -1440,11 +1379,11 @@ m4_define([m4_toupper], # # REGEXP specifies where to split. Default is [\t ]+. # -# Pay attention to the m4_changequotes. Inner m4_changequotes exist for -# obvious reasons (we want to insert square brackets). Outer -# m4_changequotes are needed because otherwise the m4 parser, when it -# sees the closing bracket we add to the result, believes it is the -# end of the body of the macro we define. +# If STRING is empty, the result is an empty list. +# +# Pay attention to the m4_changequotes. When m4 reads the definition of +# m4_split, it still has quotes set to [ and ]. Luckily, these are matched +# in the macro body, so the definition is stored correctly. # # Also, notice that $1 is quoted twice, since we want the result to # be quoted. Then you should understand that the argument of @@ -1455,16 +1394,17 @@ m4_define([m4_toupper], # m4_split([active active ])end # => [active], [active], []end -m4_changequote(<<, >>) -m4_define(<>, -<>) -m4_changequote([, ]) +m4_changequote([, ])]) @@ -1491,13 +1431,10 @@ m4_define([m4_flatten], # # This macro is robust to active symbols. # m4_define(active, ACTIVE) -# m4_strip([ active active ])end +# m4_strip([ active active ])end # => active activeend # -# This macro is fun! Because we want to preserve active symbols, STRING -# must be quoted for each evaluation, which explains there are 4 levels -# of brackets around $1 (don't forget that the result must be quoted -# too, hence one more quoting than applications). +# Because we want to preserve active symbols, STRING must be double-quoted. # # Then notice the 2 last patterns: they are in charge of removing the # leading/trailing spaces. Why not just `[^ ]'? Because they are @@ -1506,9 +1443,9 @@ m4_define([m4_flatten], # character, since there are two leading `['; equally for the last pattern. m4_define([m4_strip], [m4_bpatsubsts([[$1]], - [[ ]+], [ ], - [^\(..\) ], [\1], - [ \(..\)$], [\1])]) + [[ ]+], [ ], + [^\(..\) ], [\1], + [ \(..\)$], [\1])]) # m4_normalize(STRING) @@ -1533,9 +1470,9 @@ m4_define([m4_normalize], # Produce ARG1SEPARG2...SEPARGn. m4_defun([m4_join], [m4_case([$#], - [1], [], - [2], [[$2]], - [[$2][$1]$0([$1], m4_shiftn(2, $@))])]) + [1], [], + [2], [[$2]], + [[$2][$1]$0([$1], m4_shiftn(2, $@))])]) @@ -1573,7 +1510,7 @@ m4_defun([m4_join], # => active m4_define([m4_append], [m4_define([$1], - m4_ifdef([$1], [m4_defn([$1])$3])[$2])]) + m4_ifdef([$1], [m4_defn([$1])$3])[$2])]) # m4_append_uniq(MACRO-NAME, STRING, [SEPARATOR]) @@ -1581,18 +1518,18 @@ m4_define([m4_append], # As `m4_append', but append only if not yet present. m4_define([m4_append_uniq], [m4_ifdef([$1], - [m4_bmatch([$3]m4_defn([$1])[$3], m4_re_escape([$3$2$3]), [], - [m4_append($@)])], - [m4_append($@)])]) + [m4_bmatch([$3]m4_defn([$1])[$3], m4_re_escape([$3$2$3]), [], + [m4_append($@)])], + [m4_append($@)])]) # m4_text_wrap(STRING, [PREFIX], [FIRST-PREFIX], [WIDTH]) # ------------------------------------------------------- # Expands into STRING wrapped to hold in WIDTH columns (default = 79). -# If prefix is set, each line is prefixed with it. If FIRST-PREFIX is -# specified, then the first line is prefixed with it. As a special -# case, if the length of the first prefix is greater than that of -# PREFIX, then FIRST-PREFIX will be left alone on the first line. +# If PREFIX is given, each line is prefixed with it. If FIRST-PREFIX is +# specified, then the first line is prefixed with it. As a special case, +# if the length of FIRST-PREFIX is greater than that of PREFIX, then +# FIRST-PREFIX will be left alone on the first line. # # Typical outputs are: # @@ -1612,19 +1549,22 @@ m4_define([m4_append_uniq], # # m4_text_wrap([Super long documentation.], [ ], [ --too-wide ], 30) # => --too-wide -# => Super long -# => documentation. +# => Super long +# => documentation. # # FIXME: there is no checking of a longer PREFIX than WIDTH, but do # we really want to bother with people trying each single corner # of a software? # +# more important: +# FIXME: handle quadrigraphs correctly, both in TEXT and in FIRST_PREFIX. +# # This macro does not leave a trailing space behind the last word, # what complicates it a bit. The algorithm is stupid simple: all the # words are preceded by m4_Separator which is defined to empty for the # first word, and then ` ' (single space) for all the others. m4_define([m4_text_wrap], -[m4_pushdef([m4_Prefix], m4_default([$2], []))dnl +[m4_pushdef([m4_Prefix], [$2])dnl m4_pushdef([m4_Prefix1], m4_default([$3], [m4_Prefix]))dnl m4_pushdef([m4_Width], m4_default([$4], 79))dnl m4_pushdef([m4_Cursor], m4_len(m4_Prefix1))dnl @@ -1633,13 +1573,13 @@ m4_Prefix1[]dnl m4_if(m4_eval(m4_Cursor > m4_len(m4_Prefix)), 1, [m4_define([m4_Cursor], m4_len(m4_Prefix)) m4_Prefix])[]dnl -m4_foreach([m4_Word], m4_quote(m4_split(m4_normalize([$1]))), +m4_foreach_w([m4_Word], [$1], [m4_define([m4_Cursor], m4_eval(m4_Cursor + m4_len(m4_defn([m4_Word])) + 1))dnl dnl New line if too long, else insert a space unless it is the first dnl of the words. m4_if(m4_eval(m4_Cursor > m4_Width), 1, [m4_define([m4_Cursor], - m4_eval(m4_len(m4_Prefix) + m4_len(m4_defn([m4_Word])) + 1))] + m4_eval(m4_len(m4_Prefix) + m4_len(m4_defn([m4_Word])) + 1))] m4_Prefix, [m4_Separator])[]dnl m4_defn([m4_Word])[]dnl @@ -1661,6 +1601,21 @@ m4_define([m4_text_box], ]) +# m4_qlen(STRING) +# --------------- +# Expands to the length of STRING after autom4te converts all quadrigraphs. +m4_define([m4_qlen], +[m4_len(m4_bpatsubsts([[$1]], [@\(<:\|:>\|S|\|%:\)@], [P], [@&t@]))]) + + +# m4_qdelta(STRING) +# ----------------- +# Expands to the net change in the length of STRING from autom4te converting the +# quadrigraphs in STRING. This number is always negative or zero. +m4_define([m4_qdelta], +[m4_eval(m4_qlen([$1]) - m4_len([$1]))]) + + ## ----------------------- ## ## 10. Number processing. ## @@ -1672,9 +1627,9 @@ m4_define([m4_text_box], # The sign of the integer A. m4_define([m4_sign], [m4_bmatch([$1], - [^-], -1, - [^0+], 0, - 1)]) + [^-], -1, + [^0+], 0, + 1)]) # m4_cmp(A, B) # ------------ @@ -1703,9 +1658,9 @@ m4_define([m4_list_cmp], [$1], [()], [$0((0), [$2])], [$2], [()], [$0([$1], (0))], [m4_case(m4_cmp(m4_car$1, m4_car$2), - -1, -1, - 1, 1, - 0, [$0((m4_shift$1), (m4_shift$2))])])]) + -1, -1, + 1, 1, + 0, [$0((m4_shift$1), (m4_shift$2))])])]) @@ -1725,14 +1680,14 @@ m4_define([m4_list_cmp], # reasonable version numbers and is valid up to `z', no double letters. m4_define([m4_version_unletter], [m4_translit(m4_bpatsubsts([$1], - [\([0-9]+\)\([abcdefghi]\)], - [m4_eval(\1 + 1).-1.\2], - [\([0-9]+\)\([jklmnopqrs]\)], - [m4_eval(\1 + 1).-1.1\2], - [\([0-9]+\)\([tuvwxyz]\)], - [m4_eval(\1 + 1).-1.2\2]), - [abcdefghijklmnopqrstuvwxyz], - [12345678901234567890123456])]) + [\([0-9]+\)\([abcdefghi]\)], + [m4_eval(\1 + 1).-1.\2], + [\([0-9]+\)\([jklmnopqrs]\)], + [m4_eval(\1 + 1).-1.1\2], + [\([0-9]+\)\([tuvwxyz]\)], + [m4_eval(\1 + 1).-1.2\2]), + [abcdefghijklmnopqrstuvwxyz], + [12345678901234567890123456])]) # m4_version_compare(VERSION-1, VERSION-2) @@ -1743,7 +1698,16 @@ m4_define([m4_version_unletter], # 1 if > m4_define([m4_version_compare], [m4_list_cmp((m4_split(m4_version_unletter([$1]), [\.])), - (m4_split(m4_version_unletter([$2]), [\.])))]) + (m4_split(m4_version_unletter([$2]), [\.])))]) + + +# m4_PACKAGE_NAME +# m4_PACKAGE_TARNAME +# m4_PACKAGE_VERSION +# m4_PACKAGE_STRING +# m4_PACKAGE_BUGREPORT +# -------------------- +#m4_include([m4sugar/version.m4]) # This is needed for Autoconf, but not Bison. # m4_version_prereq(VERSION, [IF-OK], [IF-NOT = FAIL]) @@ -1752,7 +1716,8 @@ m4_define([m4_version_compare], m4_define([m4_version_prereq], [m4_if(m4_version_compare(m4_defn([m4_PACKAGE_VERSION]), [$1]), -1, [m4_default([$3], - [m4_fatal([Autoconf version $1 or higher is required])])], + [m4_fatal([Autoconf version $1 or higher is required], + 63)])], [$2])[]dnl ]) @@ -1795,8 +1760,7 @@ m4_pattern_forbid([^dnl$]) # Check the divert push/pop perfect balance. m4_wrap([m4_ifdef([_m4_divert_diversion], - [m4_fatal([$0: unbalanced m4_divert_push:] -m4_defn([m4_divert_stack]))])[]]) + [m4_fatal([$0: unbalanced m4_divert_push:]_m4_divert_n_stack)])[]]) m4_divert_push([KILL]) m4_wrap([m4_divert_pop([KILL])[]]) diff --git a/src/bin/bison/data/yacc.c b/src/bin/bison/data/yacc.c index 0957600efc..7e7c44ac40 100644 --- a/src/bin/bison/data/yacc.c +++ b/src/bin/bison/data/yacc.c @@ -1,7 +1,8 @@ m4_divert(-1) -*- C -*- # Yacc compatible skeleton for Bison -# Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004 + +# Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005 # Free Software Foundation, Inc. # This program is free software; you can redistribute it and/or modify @@ -16,8 +17,8 @@ m4_divert(-1) -*- C -*- # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA -# 02111-1307 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +# 02110-1301 USA @@ -81,7 +82,7 @@ m4_define([b4_int_type], m4_eval([0 <= $1]), [1], [unsigned int], - [int])]) + [int])]) ## ----------------- ## @@ -93,7 +94,7 @@ m4_define([b4_int_type], # -------------------- # Expansion of $$. m4_define([b4_lhs_value], -[yyval[]m4_ifval([$1], [.$1])]) +[(yyval[]m4_ifval([$1], [.$1]))]) # b4_rhs_value(RULE-LENGTH, NUM, [TYPE]) @@ -101,7 +102,7 @@ m4_define([b4_lhs_value], # Expansion of $NUM, where the current rule has RULE-LENGTH # symbols on RHS. m4_define([b4_rhs_value], -[yyvsp@{m4_eval([$2 - $1])@}m4_ifval([$3], [.$3])]) +[(yyvsp@{m4_eval([$2 - $1])@}m4_ifval([$3], [.$3]))]) @@ -113,7 +114,7 @@ m4_define([b4_rhs_value], # ----------------- # Expansion of @$. m4_define([b4_lhs_location], -[yyloc]) +[(yyloc)]) # b4_rhs_location(RULE-LENGTH, NUM) @@ -121,7 +122,7 @@ m4_define([b4_lhs_location], # Expansion of @NUM, where the current rule has RULE-LENGTH symbols # on RHS. m4_define([b4_rhs_location], -[yylsp@{m4_eval([$2 - $1])@}]) +[(yylsp@{m4_eval([$2 - $1])@})]) @@ -134,7 +135,7 @@ m4_changecom() m4_divert(0)dnl @output @output_parser_name@ b4_copyright([Skeleton parser for Yacc-like parsing with Bison], - [1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004])[ + [1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005])[ /* As a special exception, when this file is copied by Bison into a Bison output file, you may use that output file without restriction. @@ -153,8 +154,7 @@ b4_copyright([Skeleton parser for Yacc-like parsing with Bison], ]b4_identification m4_if(b4_prefix[], [yy], [], -[/* If NAME_PREFIX is specified substitute the variables and functions - names. */ +[/* Substitute the variable and function names. */ #define yyparse b4_prefix[]parse #define yylex b4_prefix[]lex #define yyerror b4_prefix[]error @@ -164,7 +164,7 @@ m4_if(b4_prefix[], [yy], [], #define yynerrs b4_prefix[]nerrs b4_location_if([#define yylloc b4_prefix[]lloc])])[ -]b4_token_defines(b4_tokens)[ +]b4_token_enums_defines(b4_tokens)[ /* Copy the first part of user declarations. */ ]b4_pre_prologue[ @@ -182,9 +182,14 @@ b4_location_if([#define yylloc b4_prefix[]lloc])])[ # define YYERROR_VERBOSE ]b4_error_verbose[ #endif +/* Enabling the token table. */ +#ifndef YYTOKEN_TABLE +# define YYTOKEN_TABLE ]b4_token_table[ +#endif + #if ! defined (YYSTYPE) && ! defined (YYSTYPE_IS_DECLARED) ]m4_ifdef([b4_stype], -[b4_syncline([b4_stype_line], [b4_filename]) +[b4_syncline([b4_stype_line], [b4_file_name]) typedef union m4_bregexp(b4_stype, [^{], [YYSTYPE ])b4_stype YYSTYPE; /* Line __line__ of yacc.c. */ b4_syncline([@oline@], [@ofile@])], @@ -214,27 +219,46 @@ typedef struct YYLTYPE /* Line __line__ of yacc.c. */ b4_syncline([@oline@], [@ofile@])[ -#if ! defined (yyoverflow) || YYERROR_VERBOSE +#if ! defined (YYSIZE_T) && defined (__SIZE_TYPE__) +# define YYSIZE_T __SIZE_TYPE__ +#endif +#if ! defined (YYSIZE_T) && defined (size_t) +# define YYSIZE_T size_t +#endif +#if ! defined (YYSIZE_T) && (defined (__STDC__) || defined (__cplusplus)) +# include /* INFRINGES ON USER NAME SPACE */ +# define YYSIZE_T size_t +#endif +#if ! defined (YYSIZE_T) +# define YYSIZE_T unsigned int +#endif -# ifndef YYFREE -# define YYFREE free +#ifndef YY_ +# if YYENABLE_NLS +# if ENABLE_NLS +# include /* INFRINGES ON USER NAME SPACE */ +# define YY_(msgid) dgettext ("bison-runtime", msgid) +# endif # endif -# ifndef YYMALLOC -# define YYMALLOC malloc +# ifndef YY_ +# define YY_(msgid) msgid # endif +#endif + +#if ! defined (yyoverflow) || YYERROR_VERBOSE /* The parser invokes alloca or malloc; define the necessary symbols. */ # ifdef YYSTACK_USE_ALLOCA # if YYSTACK_USE_ALLOCA -# define YYSTACK_ALLOC alloca -# endif -# else -# if defined (alloca) || defined (_ALLOCA_H) -# define YYSTACK_ALLOC alloca -# else # ifdef __GNUC__ # define YYSTACK_ALLOC __builtin_alloca +# else +# define YYSTACK_ALLOC alloca +# if defined (__STDC__) || defined (__cplusplus) +# include /* INFRINGES ON USER NAME SPACE */ +# define YYINCLUDED_STDLIB_H +# endif # endif # endif # endif @@ -242,13 +266,39 @@ b4_syncline([@oline@], [@ofile@])[ # ifdef YYSTACK_ALLOC /* Pacify GCC's `empty if-body' warning. */ # define YYSTACK_FREE(Ptr) do { /* empty */; } while (0) -# else -# if defined (__STDC__) || defined (__cplusplus) -# include /* INFRINGES ON USER NAME SPACE */ -# define YYSIZE_T size_t +# ifndef YYSTACK_ALLOC_MAXIMUM + /* The OS might guarantee only one guard page at the bottom of the stack, + and a page size can be as small as 4096 bytes. So we cannot safely + invoke alloca (N) if N exceeds 4096. Use a slightly smaller number + to allow for a few compiler-allocated temporary stack slots. */ +# define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2005 */ # endif +# else # define YYSTACK_ALLOC YYMALLOC # define YYSTACK_FREE YYFREE +# ifndef YYSTACK_ALLOC_MAXIMUM +# define YYSTACK_ALLOC_MAXIMUM ((YYSIZE_T) -1) +# endif +# ifdef __cplusplus +extern "C" { +# endif +# ifndef YYMALLOC +# define YYMALLOC malloc +# if (! defined (malloc) && ! defined (YYINCLUDED_STDLIB_H) \ + && (defined (__STDC__) || defined (__cplusplus))) +void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */ +# endif +# endif +# ifndef YYFREE +# define YYFREE free +# if (! defined (free) && ! defined (YYINCLUDED_STDLIB_H) \ + && (defined (__STDC__) || defined (__cplusplus))) +void free (void *); /* INFRINGES ON USER NAME SPACE */ +# endif +# endif +# ifdef __cplusplus +} +# endif # endif #endif /* ! defined (yyoverflow) || YYERROR_VERBOSE */ @@ -290,7 +340,7 @@ union yyalloc # define YYCOPY(To, From, Count) \ do \ { \ - register YYSIZE_T yyi; \ + YYSIZE_T yyi; \ for (yyi = 0; yyi < (Count); yyi++) \ (To)[yyi] = (From)[yyi]; \ } \ @@ -340,7 +390,7 @@ union yyalloc #define YYUNDEFTOK ]b4_undef_token_number[ #define YYMAXUTOK ]b4_user_token_number_max[ -#define YYTRANSLATE(YYX) \ +#define YYTRANSLATE(YYX) \ ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK) /* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */ @@ -370,8 +420,8 @@ static const ]b4_int_type_for([b4_rline])[ yyrline[] = }; #endif -#if YYDEBUG || YYERROR_VERBOSE -/* YYTNME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM. +#if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE +/* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM. First, the terminals, then, starting at YYNTOKENS, nonterminals. */ static const char *const yytname[] = { @@ -450,22 +500,6 @@ static const ]b4_int_type_for([b4_stos])[ yystos[] = ]b4_stos[ }; -#if ! defined (YYSIZE_T) && defined (__SIZE_TYPE__) -# define YYSIZE_T __SIZE_TYPE__ -#endif -#if ! defined (YYSIZE_T) && defined (size_t) -# define YYSIZE_T size_t -#endif -#if ! defined (YYSIZE_T) -# if defined (__STDC__) || defined (__cplusplus) -# include /* INFRINGES ON USER NAME SPACE */ -# define YYSIZE_T size_t -# endif -#endif -#if ! defined (YYSIZE_T) -# define YYSIZE_T unsigned int -#endif - #define yyerrok (yyerrstatus = 0) #define yyclearin (yychar = YYEMPTY) #define YYEMPTY (-2) @@ -495,26 +529,59 @@ do \ goto yybackup; \ } \ else \ - { \ - yyerror (]b4_yyerror_args["syntax error: cannot back up");\ + { \ + yyerror (]b4_yyerror_args[YY_("syntax error: cannot back up")); \ YYERROR; \ } \ while (0) + #define YYTERROR 1 #define YYERRCODE 256 -/* YYLLOC_DEFAULT -- Compute the default location (before the actions - are run). */ +/* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N]. + If N is 0, then set CURRENT to the empty location which ends + the previous symbol: RHS[0] (always defined). */ + +#define YYRHSLOC(Rhs, K) ((Rhs)[K]) #ifndef YYLLOC_DEFAULT -# define YYLLOC_DEFAULT(Current, Rhs, N) \ - ((Current).first_line = (Rhs)[1].first_line, \ - (Current).first_column = (Rhs)[1].first_column, \ - (Current).last_line = (Rhs)[N].last_line, \ - (Current).last_column = (Rhs)[N].last_column) +# define YYLLOC_DEFAULT(Current, Rhs, N) \ + do \ + if (N) \ + { \ + (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \ + (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \ + (Current).last_line = YYRHSLOC (Rhs, N).last_line; \ + (Current).last_column = YYRHSLOC (Rhs, N).last_column; \ + } \ + else \ + { \ + (Current).first_line = (Current).last_line = \ + YYRHSLOC (Rhs, 0).last_line; \ + (Current).first_column = (Current).last_column = \ + YYRHSLOC (Rhs, 0).last_column; \ + } \ + while (0) #endif + +/* YY_LOCATION_PRINT -- Print the location on the stream. + This macro was not mandated originally: define only if we know + we won't break user code: when these are the locations we know. */ + +#ifndef YY_LOCATION_PRINT +# if YYLTYPE_IS_TRIVIAL +# define YY_LOCATION_PRINT(File, Loc) \ + fprintf (File, "%d.%d-%d.%d", \ + (Loc).first_line, (Loc).first_column, \ + (Loc).last_line, (Loc).last_column) +# else +# define YY_LOCATION_PRINT(File, Loc) ((void) 0) +# endif +#endif + + /* YYLEX -- calling `yylex' with the right arguments. */ #ifdef YYLEX_PARAM @@ -537,19 +604,13 @@ do { \ YYFPRINTF Args; \ } while (0) -# define YYDSYMPRINT(Args) \ -do { \ - if (yydebug) \ - yysymprint Args; \ -} while (0) - -# define YYDSYMPRINTF(Title, Token, Value, Location) \ +# define YY_SYMBOL_PRINT(Title, Type, Value, Location) \ do { \ if (yydebug) \ { \ YYFPRINTF (stderr, "%s ", Title); \ - yysymprint (stderr, \ - Token, Value]b4_location_if([, Location])[); \ + yysymprint (stderr, \ + Type, Value]b4_location_if([, Location])[); \ YYFPRINTF (stderr, "\n"); \ } \ } while (0) @@ -584,13 +645,13 @@ do { \ [[int yyrule], [yyrule]])[ { int yyi; - unsigned int yylno = yyrline[yyrule]; - YYFPRINTF (stderr, "Reducing stack by rule %d (line %u), ", + unsigned long int yylno = yyrline[yyrule]; + YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu), ", yyrule - 1, yylno); /* Print the symbols being reduced, and their result. */ for (yyi = yyprhs[yyrule]; 0 <= yyrhs[yyi]; yyi++) - YYFPRINTF (stderr, "%s ", yytname [yyrhs[yyi]]); - YYFPRINTF (stderr, "-> %s\n", yytname [yyr1[yyrule]]); + YYFPRINTF (stderr, "%s ", yytname[yyrhs[yyi]]); + YYFPRINTF (stderr, "-> %s\n", yytname[yyr1[yyrule]]); } # define YY_REDUCE_PRINT(Rule) \ @@ -604,8 +665,7 @@ do { \ int yydebug; #else /* !YYDEBUG */ # define YYDPRINTF(Args) -# define YYDSYMPRINT(Args) -# define YYDSYMPRINTF(Title, Token, Value, Location) +# define YY_SYMBOL_PRINT(Title, Type, Value, Location) # define YY_STACK_PRINT(Bottom, Top) # define YY_REDUCE_PRINT(Rule) #endif /* !YYDEBUG */ @@ -620,13 +680,9 @@ int yydebug; if the built-in stack extension method is used). Do not make this value too large; the results are undefined if - SIZE_MAX < YYSTACK_BYTES (YYMAXDEPTH) + YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH) evaluated with infinite-precision integer arithmetic. */ -#if defined (YYMAXDEPTH) && YYMAXDEPTH == 0 -# undef YYMAXDEPTH -#endif - #ifndef YYMAXDEPTH # define YYMAXDEPTH ]b4_stack_depth_max[ #endif @@ -648,7 +704,7 @@ yystrlen (yystr) const char *yystr; # endif { - register const char *yys = yystr; + const char *yys = yystr; while (*yys++ != '\0') continue; @@ -673,8 +729,8 @@ yystpcpy (yydest, yysrc) const char *yysrc; # endif { - register char *yyd = yydest; - register const char *yys = yysrc; + char *yyd = yydest; + const char *yys = yysrc; while ((*yyd++ = *yys++) != '\0') continue; @@ -684,7 +740,55 @@ yystpcpy (yydest, yysrc) # endif # endif -#endif /* !YYERROR_VERBOSE */ +# ifndef yytnamerr +/* Copy to YYRES the contents of YYSTR after stripping away unnecessary + quotes and backslashes, so that it's suitable for yyerror. The + heuristic is that double-quoting is unnecessary unless the string + contains an apostrophe, a comma, or backslash (other than + backslash-backslash). YYSTR is taken from yytname. If YYRES is + null, do not copy; instead, return the length of what the result + would have been. */ +static YYSIZE_T +yytnamerr (char *yyres, const char *yystr) +{ + if (*yystr == '"') + { + size_t yyn = 0; + char const *yyp = yystr; + + for (;;) + switch (*++yyp) + { + case '\'': + case ',': + goto do_not_strip_quotes; + + case '\\': + if (*++yyp != '\\') + goto do_not_strip_quotes; + /* Fall through. */ + default: + if (yyres) + yyres[yyn] = *yyp; + yyn++; + break; + + case '"': + if (yyres) + yyres[yyn] = '\0'; + return yyn; + } + do_not_strip_quotes: ; + } + + if (! yyres) + return yystrlen (yystr); + + return yystpcpy (yyres, yystr) - yyres; +} +# endif + +#endif /* YYERROR_VERBOSE */ @@ -713,15 +817,15 @@ m4_divert_push([KILL])# ======================== M4 code. # Declare the variables that are global, or local to YYPARSE if # pure-parser. m4_define([b4_declare_parser_variables], -[/* The lookahead symbol. */ +[/* The look-ahead symbol. */ int yychar; -/* The semantic value of the lookahead symbol. */ +/* The semantic value of the look-ahead symbol. */ YYSTYPE yylval; /* Number of syntax errors so far. */ int yynerrs;b4_location_if([ -/* Location data for the lookahead symbol. */ +/* Location data for the look-ahead symbol. */ YYLTYPE yylloc;]) ]) m4_divert_pop([KILL])dnl# ====================== End of M4 code. @@ -746,12 +850,12 @@ b4_c_function_def([yyparse], [int], b4_parse_param) #endif {[ ]b4_pure_if([b4_declare_parser_variables])[ - register int yystate; - register int yyn; + int yystate; + int yyn; int yyresult; /* Number of tokens to shift before error messages enabled. */ int yyerrstatus; - /* Lookahead token as an internal (translated) token number. */ + /* Look-ahead token as an internal (translated) token number. */ int yytoken = 0; /* Three stacks and their tools: @@ -765,19 +869,20 @@ b4_c_function_def([yyparse], [int], b4_parse_param) /* The state stack. */ short int yyssa[YYINITDEPTH]; short int *yyss = yyssa; - register short int *yyssp; + short int *yyssp; /* The semantic value stack. */ YYSTYPE yyvsa[YYINITDEPTH]; YYSTYPE *yyvs = yyvsa; - register YYSTYPE *yyvsp; + YYSTYPE *yyvsp; ]b4_location_if( [[ /* The location stack. */ YYLTYPE yylsa[YYINITDEPTH]; YYLTYPE *yyls = yylsa; YYLTYPE *yylsp; - YYLTYPE *yylerrsp;]])[ + /* The locations where the error started and ended. */ + YYLTYPE yyerror_range[2];]])[ #define YYPOPSTACK (yyvsp--, yyssp--]b4_location_if([, yylsp--])[) @@ -806,17 +911,27 @@ b4_c_function_def([yyparse], [int], b4_parse_param) yyssp = yyss; yyvsp = yyvs; -]b4_location_if([ yylsp = yyls;])[ -]m4_ifdef([b4_initial_action], [ -m4_pushdef([b4_at_dollar], [(*yylsp)])dnl -m4_pushdef([b4_dollar_dollar], [(*yyvsp)])dnl +]b4_location_if([[ yylsp = yyls; +#if YYLTYPE_IS_TRIVIAL + /* Initialize the default location before parsing starts. */ + yylloc.first_line = yylloc.last_line = 1; + yylloc.first_column = yylloc.last_column = 0; +#endif +]]) +m4_ifdef([b4_initial_action], [ +m4_pushdef([b4_at_dollar], [m4_define([b4_at_dollar_used])yylloc])dnl +m4_pushdef([b4_dollar_dollar], [m4_define([b4_dollar_dollar_used])yylval])dnl /* User initialization code. */ - b4_initial_action +b4_initial_action m4_popdef([b4_dollar_dollar])dnl m4_popdef([b4_at_dollar])dnl /* Line __line__ of yacc.c. */ -b4_syncline([@oline@], [@ofile@])])dnl - +b4_syncline([@oline@], [@ofile@]) +])dnl +m4_ifdef([b4_dollar_dollar_used],[[ yyvsp[0] = yylval; +]])dnl +m4_ifdef([b4_at_dollar_used], [[ yylsp[0] = yylloc; +]])dnl [ goto yysetstate; /*------------------------------------------------------------. @@ -849,7 +964,7 @@ b4_syncline([@oline@], [@ofile@])])dnl data in use in that stack, in bytes. This used to be a conditional around just the two extra args, but that might be undefined if yyoverflow is a macro. */ - yyoverflow ("parser stack overflow", + yyoverflow (YY_("memory exhausted"), &yyss1, yysize * sizeof (*yyssp), &yyvs1, yysize * sizeof (*yyvsp), ]b4_location_if([ &yyls1, yysize * sizeof (*yylsp),])[ @@ -860,11 +975,11 @@ b4_syncline([@oline@], [@ofile@])])dnl } #else /* no yyoverflow */ # ifndef YYSTACK_RELOCATE - goto yyoverflowlab; + goto yyexhaustedlab; # else /* Extend the stack our own way. */ if (YYMAXDEPTH <= yystacksize) - goto yyoverflowlab; + goto yyexhaustedlab; yystacksize *= 2; if (YYMAXDEPTH < yystacksize) yystacksize = YYMAXDEPTH; @@ -874,7 +989,7 @@ b4_syncline([@oline@], [@ofile@])])dnl union yyalloc *yyptr = (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize)); if (! yyptr) - goto yyoverflowlab; + goto yyexhaustedlab; YYSTACK_RELOCATE (yyss); YYSTACK_RELOCATE (yyvs); ]b4_location_if([ YYSTACK_RELOCATE (yyls);])[ @@ -906,18 +1021,18 @@ b4_syncline([@oline@], [@ofile@])])dnl yybackup: /* Do appropriate processing given the current state. */ -/* Read a lookahead token if we need one and don't already have one. */ +/* Read a look-ahead token if we need one and don't already have one. */ /* yyresume: */ - /* First try to decide what to do without reference to lookahead token. */ + /* First try to decide what to do without reference to look-ahead token. */ yyn = yypact[yystate]; if (yyn == YYPACT_NINF) goto yydefault; - /* Not known => get a lookahead token if don't already have one. */ + /* Not known => get a look-ahead token if don't already have one. */ - /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol. */ + /* YYCHAR is either YYEMPTY or YYEOF or a valid look-ahead symbol. */ if (yychar == YYEMPTY) { YYDPRINTF ((stderr, "Reading a token: ")); @@ -932,7 +1047,7 @@ yybackup: else { yytoken = YYTRANSLATE (yychar); - YYDSYMPRINTF ("Next token is", yytoken, &yylval, &yylloc); + YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc); } /* If the proper action on seeing token YYTOKEN is to reduce or to @@ -952,8 +1067,8 @@ yybackup: if (yyn == YYFINAL) YYACCEPT; - /* Shift the lookahead token. */ - YYDPRINTF ((stderr, "Shifting token %s, ", yytname[yytoken])); + /* Shift the look-ahead token. */ + YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc); /* Discard the token being shifted unless it is eof. */ if (yychar != YYEOF) @@ -999,12 +1114,13 @@ yyreduce: yyval = yyvsp[1-yylen]; ]b4_location_if( -[ /* Default location. */ - YYLLOC_DEFAULT (yyloc, yylsp - yylen, yylen);])[ +[[ /* Default location. */ + YYLLOC_DEFAULT (yyloc, yylsp - yylen, yylen);]])[ YY_REDUCE_PRINT (yyn); switch (yyn) ]{ b4_actions + default: break; } /* Line __line__ of yacc.c. */ @@ -1047,12 +1163,36 @@ yyerrlab: if (YYPACT_NINF < yyn && yyn < YYLAST) { - YYSIZE_T yysize = 0; int yytype = YYTRANSLATE (yychar); - const char* yyprefix; - char *yymsg; + YYSIZE_T yysize0 = yytnamerr (0, yytname[yytype]); + YYSIZE_T yysize = yysize0; + YYSIZE_T yysize1; + int yysize_overflow = 0; + char *yymsg = 0; +# define YYERROR_VERBOSE_ARGS_MAXIMUM 5 + char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM]; int yyx; +#if 0 + /* This is so xgettext sees the translatable formats that are + constructed on the fly. */ + YY_("syntax error, unexpected %s"); + YY_("syntax error, unexpected %s, expecting %s"); + YY_("syntax error, unexpected %s, expecting %s or %s"); + YY_("syntax error, unexpected %s, expecting %s or %s or %s"); + YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s"); +#endif + char *yyfmt; + char const *yyf; + static char const yyunexpected[] = "syntax error, unexpected %s"; + static char const yyexpecting[] = ", expecting %s"; + static char const yyor[] = " or %s"; + char yyformat[sizeof yyunexpected + + sizeof yyexpecting - 1 + + ((YYERROR_VERBOSE_ARGS_MAXIMUM - 2) + * (sizeof yyor - 1))]; + char const *yyprefix = yyexpecting; + /* Start YYX at -YYN if negative to avoid negative indexes in YYCHECK. */ int yyxbegin = yyn < 0 ? -yyn : 0; @@ -1060,81 +1200,91 @@ yyerrlab: /* Stay within bounds of both yycheck and yytname. */ int yychecklim = YYLAST - yyn; int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS; - int yycount = 0; + int yycount = 1; + + yyarg[0] = yytname[yytype]; + yyfmt = yystpcpy (yyformat, yyunexpected); - yyprefix = ", expecting "; for (yyx = yyxbegin; yyx < yyxend; ++yyx) if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR) { - yysize += yystrlen (yyprefix) + yystrlen (yytname [yyx]); - yycount += 1; - if (yycount == 5) + if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM) { - yysize = 0; + yycount = 1; + yysize = yysize0; + yyformat[sizeof yyunexpected - 1] = '\0'; break; } + yyarg[yycount++] = yytname[yyx]; + yysize1 = yysize + yytnamerr (0, yytname[yyx]); + yysize_overflow |= yysize1 < yysize; + yysize = yysize1; + yyfmt = yystpcpy (yyfmt, yyprefix); + yyprefix = yyor; } - yysize += (sizeof ("syntax error, unexpected ") - + yystrlen (yytname[yytype])); - yymsg = (char *) YYSTACK_ALLOC (yysize); - if (yymsg != 0) - { - char *yyp = yystpcpy (yymsg, "syntax error, unexpected "); - yyp = yystpcpy (yyp, yytname[yytype]); - if (yycount < 5) + yyf = YY_(yyformat); + yysize1 = yysize + yystrlen (yyf); + yysize_overflow |= yysize1 < yysize; + yysize = yysize1; + + if (!yysize_overflow && yysize <= YYSTACK_ALLOC_MAXIMUM) + yymsg = (char *) YYSTACK_ALLOC (yysize); + if (yymsg) + { + /* Avoid sprintf, as that infringes on the user's name space. + Don't have undefined behavior even if the translation + produced a string with the wrong number of "%s"s. */ + char *yyp = yymsg; + int yyi = 0; + while ((*yyp = *yyf)) { - yyprefix = ", expecting "; - for (yyx = yyxbegin; yyx < yyxend; ++yyx) - if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR) - { - yyp = yystpcpy (yyp, yyprefix); - yyp = yystpcpy (yyp, yytname[yyx]); - yyprefix = " or "; - } + if (*yyp == '%' && yyf[1] == 's' && yyi < yycount) + { + yyp += yytnamerr (yyp, yyarg[yyi++]); + yyf += 2; + } + else + { + yyp++; + yyf++; + } } yyerror (]b4_yyerror_args[yymsg); YYSTACK_FREE (yymsg); } else - yyerror (]b4_yyerror_args["syntax error; also virtual memory exhausted"); + { + yyerror (]b4_yyerror_args[YY_("syntax error")); + goto yyexhaustedlab; + } } else #endif /* YYERROR_VERBOSE */ - yyerror (]b4_yyerror_args["syntax error"); + yyerror (]b4_yyerror_args[YY_("syntax error")); } -]b4_location_if([ yylerrsp = yylsp;])[ +]b4_location_if([[ yyerror_range[0] = yylloc;]])[ if (yyerrstatus == 3) { - /* If just tried and failed to reuse lookahead token after an + /* If just tried and failed to reuse look-ahead token after an error, discard it. */ if (yychar <= YYEOF) { - /* If at end of input, pop the error token, - then the rest of the stack, then return failure. */ + /* Return failure if at end of input. */ if (yychar == YYEOF) - for (;;) - { - YYPOPSTACK; - if (yyssp == yyss) - YYABORT; - YYDSYMPRINTF ("Error: popping", yystos[*yyssp], yyvsp, yylsp); - yydestruct (yystos[*yyssp], yyvsp]b4_location_if([, yylsp])[); - } + YYABORT; } else { - YYDSYMPRINTF ("Error: discarding", yytoken, &yylval, &yylloc); - yydestruct (yytoken, &yylval]b4_location_if([, &yylloc])[); + yydestruct ("Error: discarding", yytoken, &yylval]b4_location_if([, &yylloc])[); yychar = YYEMPTY; -]b4_location_if([ *++yylerrsp = yylloc;])[ } } - /* Else will try to reuse lookahead token after shifting the error + /* Else will try to reuse look-ahead token after shifting the error token. */ goto yyerrlab1; @@ -1144,20 +1294,18 @@ yyerrlab: `---------------------------------------------------*/ yyerrorlab: -#ifdef __GNUC__ - /* Pacify GCC when the user code never invokes YYERROR and the label - yyerrorlab therefore never appears in user code. */ + /* Pacify compilers like GCC when the user code never invokes + YYERROR and the label yyerrorlab therefore never appears in user + code. */ if (0) goto yyerrorlab; -#endif - yyvsp -= yylen; +]b4_location_if([[ yyerror_range[0] = yylsp[1-yylen]; + yylsp -= yylen; + ]])[yyvsp -= yylen; yyssp -= yylen; yystate = *yyssp; - ]b4_location_if([yylerrsp = yylsp; - *++yylerrsp = yyloc; - yylsp -= yylen; - ])[goto yyerrlab1; + goto yyerrlab1; /*-------------------------------------------------------------. @@ -1184,8 +1332,8 @@ yyerrlab1: if (yyssp == yyss) YYABORT; - YYDSYMPRINTF ("Error: popping", yystos[*yyssp], yyvsp, yylsp); - yydestruct (yystos[yystate], yyvsp]b4_location_if([, yylsp])[); +]b4_location_if([[ yyerror_range[0] = *yylsp;]])[ + yydestruct ("Error: popping", yystos[yystate], yyvsp]b4_location_if([, yylsp])[); YYPOPSTACK; yystate = *yyssp; YY_STACK_PRINT (yyss, yyssp); @@ -1194,11 +1342,16 @@ yyerrlab1: if (yyn == YYFINAL) YYACCEPT; - YYDPRINTF ((stderr, "Shifting error token, ")); - *++yyvsp = yylval; -]b4_location_if([ YYLLOC_DEFAULT (yyloc, yylsp, yylerrsp - yylsp); - *++yylsp = yyloc;])[ +]b4_location_if([[ + yyerror_range[1] = yylloc; + /* Using YYLLOC is tempting, but would change the location of + the look-ahead. YYLOC is available though. */ + YYLLOC_DEFAULT (yyloc, yyerror_range - 1, 2); + *++yylsp = yyloc;]])[ + + /* Shift the error token. */ + YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp); yystate = yyn; goto yynewstate; @@ -1219,16 +1372,25 @@ yyabortlab: goto yyreturn; #ifndef yyoverflow -/*----------------------------------------------. -| yyoverflowlab -- parser overflow comes here. | -`----------------------------------------------*/ -yyoverflowlab: - yyerror (]b4_yyerror_args["parser stack overflow"); +/*-------------------------------------------------. +| yyexhaustedlab -- memory exhaustion comes here. | +`-------------------------------------------------*/ +yyexhaustedlab: + yyerror (]b4_yyerror_args[YY_("memory exhausted")); yyresult = 2; /* Fall through. */ #endif yyreturn: + if (yychar != YYEOF && yychar != YYEMPTY) + yydestruct ("Cleanup: discarding lookahead", + yytoken, &yylval]b4_location_if([, &yylloc])[); + while (yyssp != yyss) + { + yydestruct ("Cleanup: popping", + yystos[*yyssp], yyvsp]b4_location_if([, yylsp])[); + YYPOPSTACK; + } #ifndef yyoverflow if (yyss != yyssa) YYSTACK_FREE (yyss); @@ -1241,18 +1403,18 @@ b4_epilogue m4_if(b4_defines_flag, 0, [], [@output @output_header_name@ b4_copyright([Skeleton parser for Yacc-like parsing with Bison], - [1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004]) + [1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005]) /* As a special exception, when this file is copied by Bison into a Bison output file, you may use that output file without restriction. This special exception was added by the Free Software Foundation in version 1.24 of Bison. */ -b4_token_defines(b4_tokens) +b4_token_enums_defines(b4_tokens) #if ! defined (YYSTYPE) && ! defined (YYSTYPE_IS_DECLARED) m4_ifdef([b4_stype], -[b4_syncline([b4_stype_line], [b4_filename]) +[b4_syncline([b4_stype_line], [b4_file_name]) typedef union m4_bregexp(b4_stype, [^{], [YYSTYPE ])b4_stype YYSTYPE; /* Line __line__ of yacc.c. */ b4_syncline([@oline@], [@ofile@])], diff --git a/src/bin/bison/doc/Makefile.am b/src/bin/bison/doc/Makefile.am index a909a0d22e..b7b2d4ea03 100644 --- a/src/bin/bison/doc/Makefile.am +++ b/src/bin/bison/doc/Makefile.am @@ -1,5 +1,5 @@ ## Process this file with automake to produce Makefile.in -*-Makefile-*- -## Copyright (C) 2001, 2002, 2003 Free Software Foundation, Inc. +## Copyright (C) 2001, 2002, 2003, 2005 Free Software Foundation, Inc. ## This program is free software; you can redistribute it and/or modify ## it under the terms of the GNU General Public License as published by @@ -13,8 +13,8 @@ ## You should have received a copy of the GNU General Public License ## along with this program; if not, write to the Free Software -## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA -## 02111-1307 USA +## Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +## 02110-1301 USA AM_MAKEINFOFLAGS = --no-split info_TEXINFOS = bison.texinfo @@ -25,6 +25,9 @@ EXTRA_DIST = FAQ bison.1 refcard.tex CLEANFILES = refcard.dvi refcard.log refcard.ps bison.fns +clean-local: + rm -rf *.t2d + refcard.dvi: refcard.tex tex refcard.tex diff --git a/src/bin/bison/doc/Makefile.in b/src/bin/bison/doc/Makefile.in index 9bf7bdd340..ab28cb94cf 100644 --- a/src/bin/bison/doc/Makefile.in +++ b/src/bin/bison/doc/Makefile.in @@ -1,8 +1,8 @@ -# Makefile.in generated by automake 1.8.5 from Makefile.am. +# Makefile.in generated by automake 1.9.6 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, -# 2003, 2004 Free Software Foundation, Inc. +# 2003, 2004, 2005 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. @@ -33,6 +33,7 @@ POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : +build_triplet = @build@ host_triplet = @host@ subdir = doc DIST_COMMON = $(bison_TEXINFOS) $(srcdir)/Makefile.am \ @@ -40,35 +41,40 @@ DIST_COMMON = $(bison_TEXINFOS) $(srcdir)/Makefile.am \ $(srcdir)/version.texi ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/alloca.m4 \ + $(top_srcdir)/m4/bison-i18n.m4 $(top_srcdir)/m4/cxx.m4 \ $(top_srcdir)/m4/dirname.m4 $(top_srcdir)/m4/dmalloc.m4 \ $(top_srcdir)/m4/dos.m4 $(top_srcdir)/m4/error.m4 \ $(top_srcdir)/m4/exitfail.m4 $(top_srcdir)/m4/extensions.m4 \ - $(top_srcdir)/m4/getopt.m4 $(top_srcdir)/m4/gettext.m4 \ + $(top_srcdir)/m4/getopt.m4 $(top_srcdir)/m4/gettext_gl.m4 \ $(top_srcdir)/m4/gnulib.m4 $(top_srcdir)/m4/hard-locale.m4 \ $(top_srcdir)/m4/hash.m4 $(top_srcdir)/m4/iconv.m4 \ - $(top_srcdir)/m4/lib-ld.m4 $(top_srcdir)/m4/lib-link.m4 \ - $(top_srcdir)/m4/lib-prefix.m4 $(top_srcdir)/m4/m4.m4 \ + $(top_srcdir)/m4/inttypes_h_gl.m4 \ + $(top_srcdir)/m4/lib-ld_gl.m4 $(top_srcdir)/m4/lib-link.m4 \ + $(top_srcdir)/m4/lib-prefix_gl.m4 $(top_srcdir)/m4/m4.m4 \ $(top_srcdir)/m4/mbrtowc.m4 $(top_srcdir)/m4/mbstate_t.m4 \ $(top_srcdir)/m4/mbswidth.m4 $(top_srcdir)/m4/nls.m4 \ $(top_srcdir)/m4/obstack.m4 $(top_srcdir)/m4/onceonly.m4 \ - $(top_srcdir)/m4/po.m4 $(top_srcdir)/m4/progtest.m4 \ + $(top_srcdir)/m4/po_gl.m4 $(top_srcdir)/m4/progtest.m4 \ $(top_srcdir)/m4/quote.m4 $(top_srcdir)/m4/quotearg.m4 \ - $(top_srcdir)/m4/stdbool.m4 $(top_srcdir)/m4/stpcpy.m4 \ - $(top_srcdir)/m4/strndup.m4 $(top_srcdir)/m4/strnlen.m4 \ - $(top_srcdir)/m4/subpipe.m4 $(top_srcdir)/m4/timevar.m4 \ - $(top_srcdir)/m4/unlocked-io.m4 $(top_srcdir)/m4/warning.m4 \ + $(top_srcdir)/m4/stdbool.m4 $(top_srcdir)/m4/stdint_h_gl.m4 \ + $(top_srcdir)/m4/stdio-safer.m4 $(top_srcdir)/m4/stpcpy.m4 \ + $(top_srcdir)/m4/strdup.m4 $(top_srcdir)/m4/strndup.m4 \ + $(top_srcdir)/m4/strnlen.m4 $(top_srcdir)/m4/subpipe.m4 \ + $(top_srcdir)/m4/timevar.m4 $(top_srcdir)/m4/uintmax_t_gl.m4 \ + $(top_srcdir)/m4/ulonglong_gl.m4 \ + $(top_srcdir)/m4/unistd-safer.m4 $(top_srcdir)/m4/warning.m4 \ $(top_srcdir)/m4/xalloc.m4 $(top_srcdir)/m4/xstrndup.m4 \ $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) -mkinstalldirs = $(SHELL) $(top_srcdir)/config/mkinstalldirs +mkinstalldirs = $(SHELL) $(top_srcdir)/build-aux/mkinstalldirs CONFIG_HEADER = $(top_builddir)/config.h CONFIG_CLEAN_FILES = SOURCES = DIST_SOURCES = INFO_DEPS = $(srcdir)/bison.info -TEXINFO_TEX = $(top_srcdir)/config/texinfo.tex -am__TEXINFO_TEX_DIR = $(top_srcdir)/config +TEXINFO_TEX = $(top_srcdir)/build-aux/texinfo.tex +am__TEXINFO_TEX_DIR = $(top_srcdir)/build-aux DVIS = bison.dvi PDFS = bison.pdf PSS = bison.ps @@ -95,6 +101,8 @@ AUTOHEADER = @AUTOHEADER@ AUTOM4TE = @AUTOM4TE@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ +BISON_CXX_WORKS = @BISON_CXX_WORKS@ +BISON_LOCALEDIR = @BISON_LOCALEDIR@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ @@ -112,6 +120,7 @@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ GCC = @GCC@ +GETOPT_H = @GETOPT_H@ GMSGFMT = @GMSGFMT@ HAVE__BOOL = @HAVE__BOOL@ INSTALL_DATA = @INSTALL_DATA@ @@ -119,6 +128,7 @@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ INTLLIBS = @INTLLIBS@ +INTL_MACOSX_LIBS = @INTL_MACOSX_LIBS@ LDFLAGS = @LDFLAGS@ LEX = @LEX@ LEXLIB = @LEXLIB@ @@ -136,6 +146,7 @@ MKINSTALLDIRS = @MKINSTALLDIRS@ MSGFMT = @MSGFMT@ MSGMERGE = @MSGMERGE@ O0CFLAGS = @O0CFLAGS@ +O0CXXFLAGS = @O0CXXFLAGS@ OBJEXT = @OBJEXT@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ @@ -164,6 +175,7 @@ ac_ct_CC = @ac_ct_CC@ ac_ct_CXX = @ac_ct_CXX@ ac_ct_RANLIB = @ac_ct_RANLIB@ ac_ct_STRIP = @ac_ct_STRIP@ +aclocaldir = @aclocaldir@ am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@ @@ -171,6 +183,8 @@ am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ @@ -240,16 +254,14 @@ $(ACLOCAL_M4): $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh .texinfo.info: - restore=: && \ - backupdir="$(am__leading_dot)am$$$$" && \ + restore=: && backupdir="$(am__leading_dot)am$$$$" && \ am__cwd=`pwd` && cd $(srcdir) && \ rm -rf $$backupdir && mkdir $$backupdir && \ - for f in $@ $@-[0-9] $@-[0-9][0-9] $(@:.info=).i[0-9] $(@:.info=).i[0-9][0-9]; do \ - if test -f $$f; then \ - mv $$f $$backupdir; \ - restore=mv; \ - fi; \ - done; \ + if ($(MAKEINFO) --version) >/dev/null 2>&1; then \ + for f in $@ $@-[0-9] $@-[0-9][0-9] $(@:.info=).i[0-9] $(@:.info=).i[0-9][0-9]; do \ + if test -f $$f; then mv $$f $$backupdir; restore=mv; else :; fi; \ + done; \ + else :; fi && \ cd "$$am__cwd"; \ if $(MAKEINFO) $(AM_MAKEINFOFLAGS) $(MAKEINFOFLAGS) -I $(srcdir) \ -o $@ $<; \ @@ -261,8 +273,7 @@ $(ACLOCAL_M4): $(am__aclocal_m4_deps) cd $(srcdir) && \ $$restore $$backupdir/* `echo "./$@" | sed 's|[^/]*$$||'`; \ fi; \ - rm -rf $$backupdir; \ - exit $$rc + rm -rf $$backupdir; exit $$rc .texinfo.dvi: TEXINPUTS="$(am__TEXINFO_TEX_DIR)$(PATH_SEPARATOR)$$TEXINPUTS" \ @@ -275,10 +286,18 @@ $(ACLOCAL_M4): $(am__aclocal_m4_deps) $(TEXI2PDF) $< .texinfo.html: - $(MAKEINFOHTML) $(AM_MAKEINFOHTMLFLAGS) $(MAKEINFOFLAGS) -I $(srcdir) \ - -o $@ $< - if test ! -d $@ && test -d $(@:.html=); then \ - mv $(@:.html=) $@; else :; fi + rm -rf $(@:.html=.htp) + if $(MAKEINFOHTML) $(AM_MAKEINFOHTMLFLAGS) $(MAKEINFOFLAGS) -I $(srcdir) \ + -o $(@:.html=.htp) $<; \ + then \ + rm -rf $@; \ + if test ! -d $(@:.html=.htp) && test -d $(@:.html=); then \ + mv $(@:.html=) $@; else mv $(@:.html=.htp) $@; fi; \ + else \ + if test ! -d $(@:.html=.htp) && test -d $(@:.html=); then \ + rm -rf $(@:.html=); else rm -Rf $(@:.html=.htp) $@; fi; \ + exit 1; \ + fi $(srcdir)/bison.info: bison.texinfo $(srcdir)/version.texi $(bison_TEXINFOS) bison.dvi: bison.texinfo $(srcdir)/version.texi $(bison_TEXINFOS) bison.pdf: bison.texinfo $(srcdir)/version.texi $(bison_TEXINFOS) @@ -286,7 +305,7 @@ bison.html: bison.texinfo $(srcdir)/version.texi $(bison_TEXINFOS) $(srcdir)/version.texi: $(srcdir)/stamp-vti $(srcdir)/stamp-vti: bison.texinfo $(top_srcdir)/configure @(dir=.; test -f ./bison.texinfo || dir=$(srcdir); \ - set `$(SHELL) $(top_srcdir)/config/mdate-sh $$dir/bison.texinfo`; \ + set `$(SHELL) $(top_srcdir)/build-aux/mdate-sh $$dir/bison.texinfo`; \ echo "@set UPDATED $$1 $$2 $$3"; \ echo "@set UPDATED-MONTH $$2 $$3"; \ echo "@set EDITION $(VERSION)"; \ @@ -303,10 +322,11 @@ mostlyclean-vti: maintainer-clean-vti: -rm -f $(srcdir)/stamp-vti $(srcdir)/version.texi .dvi.ps: + TEXINPUTS="$(am__TEXINFO_TEX_DIR)$(PATH_SEPARATOR)$$TEXINPUTS" \ $(DVIPS) -o $@ $< uninstall-info-am: - $(PRE_UNINSTALL) + @$(PRE_UNINSTALL) @if (install-info --version && \ install-info --version 2>&1 | sed 1q | grep -i -v debian) >/dev/null 2>&1; then \ list='$(INFO_DEPS)'; \ @@ -322,7 +342,7 @@ uninstall-info-am: relfile=`echo "$$file" | sed 's|^.*/||'`; \ relfile_i=`echo "$$relfile" | sed 's|\.info$$||;s|$$|.i|'`; \ (if cd "$(DESTDIR)$(infodir)"; then \ - echo " rm -f $$relfile $$relfile-[0-9] $$relfile-[0-9][0-9] $$relfile_i[0-9] $$relfile_i[0-9][0-9])"; \ + echo " cd '$(DESTDIR)$(infodir)' && rm -f $$relfile $$relfile-[0-9] $$relfile-[0-9][0-9] $$relfile_i[0-9] $$relfile_i[0-9][0-9]"; \ rm -f $$relfile $$relfile-[0-9] $$relfile-[0-9][0-9] $$relfile_i[0-9] $$relfile_i[0-9][0-9]; \ else :; fi); \ done @@ -462,14 +482,14 @@ clean-generic: -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) distclean-generic: - -rm -f $(CONFIG_CLEAN_FILES) + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-am -clean-am: clean-generic mostlyclean-am +clean-am: clean-generic clean-local mostlyclean-am distclean: distclean-am -rm -f Makefile @@ -548,12 +568,12 @@ uninstall-am: uninstall-info-am uninstall-man uninstall-man: uninstall-man1 -.PHONY: all all-am check check-am clean clean-generic dist-info \ - distclean distclean-generic distdir dvi dvi-am html html-am \ - info info-am install install-am install-data install-data-am \ - install-exec install-exec-am install-info install-info-am \ - install-man install-man1 install-strip installcheck \ - installcheck-am installdirs maintainer-clean \ +.PHONY: all all-am check check-am clean clean-generic clean-local \ + dist-info distclean distclean-generic distdir dvi dvi-am html \ + html-am info info-am install install-am install-data \ + install-data-am install-exec install-exec-am install-info \ + install-info-am install-man install-man1 install-strip \ + installcheck installcheck-am installdirs maintainer-clean \ maintainer-clean-aminfo maintainer-clean-generic \ maintainer-clean-vti mostlyclean mostlyclean-aminfo \ mostlyclean-generic mostlyclean-vti pdf pdf-am ps ps-am \ @@ -561,6 +581,9 @@ uninstall-man: uninstall-man1 uninstall-man1 +clean-local: + rm -rf *.t2d + refcard.dvi: refcard.tex tex refcard.tex diff --git a/src/bin/bison/doc/bison.info b/src/bin/bison/doc/bison.info index 38cfbdd1e9..86206de832 100644 --- a/src/bin/bison/doc/bison.info +++ b/src/bin/bison/doc/bison.info @@ -1,14 +1,14 @@ This is bison.info, produced by makeinfo version 4.7 from bison.texinfo. - This manual is for GNU Bison (version 1.875d, 30 March 2004), the + This manual is for GNU Bison (version 2.1, 16 September 2005), the GNU parser generator. Copyright (C) 1988, 1989, 1990, 1991, 1992, 1993, 1995, 1998, 1999, -2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc. +2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc. Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, - Version 1.1 or any later version published by the Free Software + Version 1.2 or any later version published by the Free Software Foundation; with no Invariant Sections, with the Front-Cover texts being "A GNU Manual," and with the Back-Cover Texts as in (a) below. A copy of the license is included in the section entitled @@ -18,7 +18,7 @@ GNU parser generator. modify this GNU Manual, like GNU software. Copies published by the Free Software Foundation raise funds for GNU development." -INFO-DIR-SECTION GNU programming tools +INFO-DIR-SECTION Software development START-INFO-DIR-ENTRY * bison: (bison). GNU parser generator (Yacc replacement). END-INFO-DIR-ENTRY @@ -29,15 +29,15 @@ File: bison.info, Node: Top, Next: Introduction, Up: (dir) Bison ***** -This manual is for GNU Bison (version 1.875d, 30 March 2004), the GNU +This manual is for GNU Bison (version 2.1, 16 September 2005), the GNU parser generator. Copyright (C) 1988, 1989, 1990, 1991, 1992, 1993, 1995, 1998, 1999, -2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc. +2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc. Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, - Version 1.1 or any later version published by the Free Software + Version 1.2 or any later version published by the Free Software Foundation; with no Invariant Sections, with the Front-Cover texts being "A GNU Manual," and with the Back-Cover Texts as in (a) below. A copy of the license is included in the section entitled @@ -67,9 +67,10 @@ Reference sections: messy for Bison to handle straightforwardly. * Debugging:: Understanding or debugging Bison parsers. * Invocation:: How to run Bison (to produce the parser source file). +* C++ Language Interface:: Creating C++ parser objects. +* FAQ:: Frequently Asked Questions * Table of Symbols:: All the keywords of the Bison language are explained. * Glossary:: Basic concepts are explained. -* FAQ:: Frequently Asked Questions * Copying This Manual:: License for copying this manual. * Index:: Cross-references to the text. @@ -84,13 +85,19 @@ The Concepts of Bison a semantic value (the value of an integer, the name of an identifier, etc.). * Semantic Actions:: Each rule can have an action containing C code. -* GLR Parsers:: Writing parsers for general context-free languages +* GLR Parsers:: Writing parsers for general context-free languages. * Locations Overview:: Tracking Locations. * Bison Parser:: What are Bison's input and output, how is the output used? * Stages:: Stages in writing and running Bison grammars. * Grammar Layout:: Overall structure of a Bison grammar file. +Writing GLR Parsers + +* Simple GLR Parsers:: Using GLR parsers on unambiguous grammars +* Merging GLR Parses:: Using GLR parsers to resolve ambiguities +* Compiler Requirements:: GLR parsers require a modern C compiler + Examples * RPN Calc:: Reverse polish notation calculator; @@ -171,6 +178,7 @@ Bison Declarations * Precedence Decl:: Declaring terminals with precedence and associativity. * Union Decl:: Declaring the set of all semantic value types. * Type Decl:: Declaring the choice of type for a nonterminal symbol. +* Initial Action Decl:: Code run before parsing starts. * Destructor Decl:: Declaring how symbols are freed. * Expect Decl:: Suppressing warnings about parsing conflicts. * Start Decl:: Specifying the start symbol. @@ -184,6 +192,8 @@ Parser C-Language Interface which reads tokens. * Error Reporting:: You must supply a function `yyerror'. * Action Features:: Special features for use in actions. +* Internationalization:: How to let the parser speak in the user's + native language. The Lexical Analyzer Function `yylex' @@ -206,7 +216,7 @@ The Bison Parser Algorithm * Reduce/Reduce:: When two rules are applicable in the same situation. * Mystery Conflicts:: Reduce/reduce conflicts that look unjustified. * Generalized LR Parsing:: Parsing arbitrary context-free grammars. -* Stack Overflow:: What happens when stack gets full. How to avoid it. +* Memory Management:: What happens when memory is exhausted. How to avoid it. Operator Precedence @@ -234,13 +244,33 @@ Invoking Bison * Option Cross Key:: Alphabetical list of long options. * Yacc Library:: Yacc-compatible `yylex' and `main'. +C++ Language Interface + +* C++ Parsers:: The interface to generate C++ parser classes +* A Complete C++ Example:: Demonstrating their use + +C++ Parsers + +* C++ Bison Interface:: Asking for C++ parser generation +* C++ Semantic Values:: %union vs. C++ +* C++ Location Values:: The position and location classes +* C++ Parser Interface:: Instantiating and running the parser +* C++ Scanner Interface:: Exchanges between yylex and parse + +A Complete C++ Example + +* Calc++ --- C++ Calculator:: The specifications +* Calc++ Parsing Driver:: An active parsing context +* Calc++ Parser:: A parser class +* Calc++ Scanner:: A pure C++ Flex scanner +* Calc++ Top Level:: Conducting the band + Frequently Asked Questions -* Parser Stack Overflow:: Breaking the Stack Limits +* Memory Exhausted:: Breaking the Stack Limits * How Can I Reset the Parser:: `yyparse' Keeps some State * Strings are Destroyed:: `yylval' Loses Track of Strings -* C++ Parsers:: Compiling Parsers with C++ Compilers -* Implementing Loops:: Control Flow in the Calculator +* Implementing Gotos/Loops:: Control Flow in the Calculator Copying This Manual @@ -274,7 +304,7 @@ Bison in detail. it Yacc-compatible. Wilfred Hansen of Carnegie Mellon University added multi-character string literals and other features. - This edition corresponds to version 1.875d of Bison. + This edition corresponds to version 2.1 of Bison.  File: bison.info, Node: Conditions, Next: Copying, Prev: Introduction, Up: Top @@ -323,7 +353,7 @@ GNU GENERAL PUBLIC LICENSE Version 2, June 1991 Copyright (C) 1989, 1991 Free Software Foundation, Inc. - 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. @@ -637,7 +667,7 @@ the "copyright" line and a pointer to where the full notice is found. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. Also add information on how to contact you by electronic and paper mail. @@ -692,7 +722,7 @@ carefully. a semantic value (the value of an integer, the name of an identifier, etc.). * Semantic Actions:: Each rule can have an action containing C code. -* GLR Parsers:: Writing parsers for general context-free languages +* GLR Parsers:: Writing parsers for general context-free languages. * Locations Overview:: Tracking Locations. * Bison Parser:: What are Bison's input and output, how is the output used? @@ -737,7 +767,7 @@ that the next grammar rule to apply at any point in the input is uniquely determined by the preceding input and a fixed, finite portion (called a "look-ahead") of the remaining input. A context-free grammar can be "ambiguous", meaning that there are multiple ways to apply the -grammar rules to get the some inputs. Even unambiguous grammars can be +grammar rules to get the same inputs. Even unambiguous grammars can be "non-deterministic", meaning that no fixed look-ahead always suffices to determine the next grammar rule to apply. With the proper declarations, Bison is also able to parse these more general @@ -767,7 +797,7 @@ lexicography, not grammar.) Here is a simple C function subdivided into tokens: int /* keyword `int' */ - square (int x) /* identifier, open-paren, identifier, + square (int x) /* identifier, open-paren, keyword `int', identifier, close-paren */ { /* open-brace */ return x * x; /* keyword `return', identifier, asterisk, @@ -934,33 +964,32 @@ File: bison.info, Node: GLR Parsers, Next: Locations Overview, Prev: Semantic 1.5 Writing GLR Parsers ======================= -In some grammars, there will be cases where Bison's standard LALR(1) -parsing algorithm cannot decide whether to apply a certain grammar rule -at a given point. That is, it may not be able to decide (on the basis -of the input read so far) which of two possible reductions -(applications of a grammar rule) applies, or whether to apply a -reduction or read more of the input and apply a reduction later in the -input. These are known respectively as "reduce/reduce" conflicts -(*note Reduce/Reduce::), and "shift/reduce" conflicts (*note -Shift/Reduce::). +In some grammars, Bison's standard LALR(1) parsing algorithm cannot +decide whether to apply a certain grammar rule at a given point. That +is, it may not be able to decide (on the basis of the input read so +far) which of two possible reductions (applications of a grammar rule) +applies, or whether to apply a reduction or read more of the input and +apply a reduction later in the input. These are known respectively as +"reduce/reduce" conflicts (*note Reduce/Reduce::), and "shift/reduce" +conflicts (*note Shift/Reduce::). To use a grammar that is not easily modified to be LALR(1), a more general parsing algorithm is sometimes necessary. If you include `%glr-parser' among the Bison declarations in your file (*note Grammar -Outline::), the result will be a Generalized LR (GLR) parser. These -parsers handle Bison grammars that contain no unresolved conflicts -(i.e., after applying precedence declarations) identically to LALR(1) -parsers. However, when faced with unresolved shift/reduce and -reduce/reduce conflicts, GLR parsers use the simple expedient of doing -both, effectively cloning the parser to follow both possibilities. -Each of the resulting parsers can again split, so that at any given -time, there can be any number of possible parses being explored. The -parsers proceed in lockstep; that is, all of them consume (shift) a -given input symbol before any of them proceed to the next. Each of the -cloned parsers eventually meets one of two possible fates: either it -runs into a parsing error, in which case it simply vanishes, or it -merges with another parser, because the two of them have reduced the -input to an identical set of symbols. +Outline::), the result is a Generalized LR (GLR) parser. These parsers +handle Bison grammars that contain no unresolved conflicts (i.e., after +applying precedence declarations) identically to LALR(1) parsers. +However, when faced with unresolved shift/reduce and reduce/reduce +conflicts, GLR parsers use the simple expedient of doing both, +effectively cloning the parser to follow both possibilities. Each of +the resulting parsers can again split, so that at any given time, there +can be any number of possible parses being explored. The parsers +proceed in lockstep; that is, all of them consume (shift) a given input +symbol before any of them proceed to the next. Each of the cloned +parsers eventually meets one of two possible fates: either it runs into +a parsing error, in which case it simply vanishes, or it merges with +another parser, because the two of them have reduced the input to an +identical set of symbols. During the time that there are multiple parsers, semantic actions are recorded, but not performed. When a parser disappears, its recorded @@ -973,7 +1002,174 @@ involved, or by performing both actions, and then calling a designated user-defined function on the resulting values to produce an arbitrary merged result. - Let's consider an example, vastly simplified from a C++ grammar. +* Menu: + +* Simple GLR Parsers:: Using GLR parsers on unambiguous grammars +* Merging GLR Parses:: Using GLR parsers to resolve ambiguities +* Compiler Requirements:: GLR parsers require a modern C compiler + + +File: bison.info, Node: Simple GLR Parsers, Next: Merging GLR Parses, Up: GLR Parsers + +1.5.1 Using GLR on Unambiguous Grammars +--------------------------------------- + +In the simplest cases, you can use the GLR algorithm to parse grammars +that are unambiguous, but fail to be LALR(1). Such grammars typically +require more than one symbol of look-ahead, or (in rare cases) fall +into the category of grammars in which the LALR(1) algorithm throws +away too much information (they are in LR(1), but not LALR(1), *Note +Mystery Conflicts::). + + Consider a problem that arises in the declaration of enumerated and +subrange types in the programming language Pascal. Here are some +examples: + + type subrange = lo .. hi; + type enum = (a, b, c); + +The original language standard allows only numeric literals and +constant identifiers for the subrange bounds (`lo' and `hi'), but +Extended Pascal (ISO/IEC 10206) and many other Pascal implementations +allow arbitrary expressions there. This gives rise to the following +situation, containing a superfluous pair of parentheses: + + type subrange = (a) .. b; + +Compare this to the following declaration of an enumerated type with +only one value: + + type enum = (a); + +(These declarations are contrived, but they are syntactically valid, +and more-complicated cases can come up in practical programs.) + + These two declarations look identical until the `..' token. With +normal LALR(1) one-token look-ahead it is not possible to decide +between the two forms when the identifier `a' is parsed. It is, +however, desirable for a parser to decide this, since in the latter case +`a' must become a new identifier to represent the enumeration value, +while in the former case `a' must be evaluated with its current +meaning, which may be a constant or even a function call. + + You could parse `(a)' as an "unspecified identifier in parentheses", +to be resolved later, but this typically requires substantial +contortions in both semantic actions and large parts of the grammar, +where the parentheses are nested in the recursive rules for expressions. + + You might think of using the lexer to distinguish between the two +forms by returning different tokens for currently defined and undefined +identifiers. But if these declarations occur in a local scope, and `a' +is defined in an outer scope, then both forms are possible--either +locally redefining `a', or using the value of `a' from the outer scope. +So this approach cannot work. + + A simple solution to this problem is to declare the parser to use +the GLR algorithm. When the GLR parser reaches the critical state, it +merely splits into two branches and pursues both syntax rules +simultaneously. Sooner or later, one of them runs into a parsing +error. If there is a `..' token before the next `;', the rule for +enumerated types fails since it cannot accept `..' anywhere; otherwise, +the subrange type rule fails since it requires a `..' token. So one of +the branches fails silently, and the other one continues normally, +performing all the intermediate actions that were postponed during the +split. + + If the input is syntactically incorrect, both branches fail and the +parser reports a syntax error as usual. + + The effect of all this is that the parser seems to "guess" the +correct branch to take, or in other words, it seems to use more +look-ahead than the underlying LALR(1) algorithm actually allows for. +In this example, LALR(2) would suffice, but also some cases that are +not LALR(k) for any k can be handled this way. + + In general, a GLR parser can take quadratic or cubic worst-case time, +and the current Bison parser even takes exponential time and space for +some grammars. In practice, this rarely happens, and for many grammars +it is possible to prove that it cannot happen. The present example +contains only one conflict between two rules, and the type-declaration +context containing the conflict cannot be nested. So the number of +branches that can exist at any time is limited by the constant 2, and +the parsing time is still linear. + + Here is a Bison grammar corresponding to the example above. It +parses a vastly simplified form of Pascal type declarations. + + %token TYPE DOTDOT ID + + %left '+' '-' + %left '*' '/' + + %% + + type_decl : TYPE ID '=' type ';' + ; + + type : '(' id_list ')' + | expr DOTDOT expr + ; + + id_list : ID + | id_list ',' ID + ; + + expr : '(' expr ')' + | expr '+' expr + | expr '-' expr + | expr '*' expr + | expr '/' expr + | ID + ; + + When used as a normal LALR(1) grammar, Bison correctly complains +about one reduce/reduce conflict. In the conflicting situation the +parser chooses one of the alternatives, arbitrarily the one declared +first. Therefore the following correct input is not recognized: + + type t = (a) .. b; + + The parser can be turned into a GLR parser, while also telling Bison +to be silent about the one known reduce/reduce conflict, by adding +these two declarations to the Bison input file (before the first `%%'): + + %glr-parser + %expect-rr 1 + +No change in the grammar itself is required. Now the parser recognizes +all valid declarations, according to the limited syntax above, +transparently. In fact, the user does not even notice when the parser +splits. + + So here we have a case where we can use the benefits of GLR, almost +without disadvantages. Even in simple cases like this, however, there +are at least two potential problems to beware. First, always analyze +the conflicts reported by Bison to make sure that GLR splitting is only +done where it is intended. A GLR parser splitting inadvertently may +cause problems less obvious than an LALR parser statically choosing the +wrong alternative in a conflict. Second, consider interactions with +the lexer (*note Semantic Tokens::) with great care. Since a split +parser consumes tokens without performing any actions during the split, +the lexer cannot obtain information via parser actions. Some cases of +lexer interactions can be eliminated by using GLR to shift the +complications from the lexer to the parser. You must check the +remaining cases for correctness. + + In our example, it would be safe for the lexer to return tokens +based on their current meanings in some symbol table, because no new +symbols are defined in the middle of a type declaration. Though it is +possible for a parser to define the enumeration constants as they are +parsed, before the type declaration is completed, it actually makes no +difference since they cannot be used within the same enumerated type +declaration. + + +File: bison.info, Node: Merging GLR Parses, Next: Compiler Requirements, Prev: Simple GLR Parsers, Up: GLR Parsers + +1.5.2 Using GLR to Resolve Ambiguities +-------------------------------------- + +Let's consider an example, vastly simplified from a C++ grammar. %{ #include @@ -1025,29 +1221,44 @@ parses as either an `expr' or a `stmt' (assuming that `T' is recognized as a `TYPENAME' and `x' as an `ID'). Bison detects this as a reduce/reduce conflict between the rules `expr : ID' and `declarator : ID', which it cannot resolve at the time it encounters `x' in the -example above. The two `%dprec' declarations, however, give precedence -to interpreting the example as a `decl', which implies that `x' is a -declarator. The parser therefore prints +example above. Since this is a GLR parser, it therefore splits the +problem into two parses, one for each choice of resolving the +reduce/reduce conflict. Unlike the example from the previous section +(*note Simple GLR Parsers::), however, neither of these parses "dies," +because the grammar as it stands is ambiguous. One of the parsers +eventually reduces `stmt : expr ';'' and the other reduces `stmt : +decl', after which both parsers are in an identical state: they've seen +`prog stmt' and have the same unprocessed input remaining. We say that +these parses have "merged." + + At this point, the GLR parser requires a specification in the +grammar of how to choose between the competing parses. In the example +above, the two `%dprec' declarations specify that Bison is to give +precedence to the parse that interprets the example as a `decl', which +implies that `x' is a declarator. The parser therefore prints "x" y z + T - Consider a different input string for this parser: + The `%dprec' declarations only come into play when more than one +parse survives. Consider a different input string for this parser: T (x) + y; -Here, there is no ambiguity (this cannot be parsed as a declaration). +This is another example of using GLR to parse an unambiguous construct, +as shown in the previous section (*note Simple GLR Parsers::). Here, +there is no ambiguity (this cannot be parsed as a declaration). However, at the time the Bison parser encounters `x', it does not have enough information to resolve the reduce/reduce conflict (again, between `x' as an `expr' or a `declarator'). In this case, no -precedence declaration is used. Instead, the parser splits into two, -one assuming that `x' is an `expr', and the other assuming `x' is a +precedence declaration is used. Again, the parser splits into two, one +assuming that `x' is an `expr', and the other assuming `x' is a `declarator'. The second of these parsers then vanishes when it sees `+', and the parser prints x T y + Suppose that instead of resolving the ambiguity, you wanted to see -all the possibilities. For this purpose, we must "merge" the semantic +all the possibilities. For this purpose, you must merge the semantic actions of the two possible parsers, rather than choosing one over the other. To do so, you could change the declaration of `stmt' as follows: @@ -1072,17 +1283,27 @@ beginning of the file: static YYSTYPE stmtMerge (YYSTYPE x0, YYSTYPE x1); %} -With these declarations, the resulting parser will parse the first -example as both an `expr' and a `decl', and print +With these declarations, the resulting parser parses the first example +as both an `expr' and a `decl', and prints "x" y z + T x T y z + = + Bison requires that all of the productions that participate in any +particular merge have identical `%merge' clauses. Otherwise, the +ambiguity would be unresolvable, and the parser will report an error +during any parse that results in the offending merge. - The GLR parsers require a compiler for ISO C89 or later. In -addition, they use the `inline' keyword, which is not C89, but is C99 -and is a common extension in pre-C99 compilers. It is up to the user -of these parsers to handle portability issues. For instance, if using -Autoconf and the Autoconf macro `AC_C_INLINE', a mere + +File: bison.info, Node: Compiler Requirements, Prev: Merging GLR Parses, Up: GLR Parsers + +1.5.3 Considerations when Compiling GLR Parsers +----------------------------------------------- + +The GLR parsers require a compiler for ISO C89 or later. In addition, +they use the `inline' keyword, which is not C89, but is C99 and is a +common extension in pre-C99 compilers. It is up to the user of these +parsers to handle portability issues. For instance, if using Autoconf +and the Autoconf macro `AC_C_INLINE', a mere %{ #include @@ -1176,8 +1397,10 @@ file except for the ones defined in this manual. those cases your code should respect the identifiers reserved by those headers. On some non-GNU hosts, `', `', and `' are included as needed to declare memory allocators and -related types. Other system headers may be included if you define -`YYDEBUG' to a nonzero value (*note Tracing Your Parser: Tracing.). +related types. `' is included if message translation is in +use (*note Internationalization::). Other system headers may be +included if you define `YYDEBUG' to a nonzero value (*note Tracing Your +Parser: Tracing.).  File: bison.info, Node: Stages, Next: Grammar Layout, Prev: Bison Parser, Up: Concepts @@ -1513,13 +1736,14 @@ what happens in the first rule (the one that uses `NUM'). does not require it. You can add or change white space as much as you wish. For example, this: - exp : NUM | exp exp '+' {$$ = $1 + $2; } | ... + exp : NUM | exp exp '+' {$$ = $1 + $2; } | ... ; means the same thing as this: exp: NUM | exp exp '+' { $$ = $1 + $2; } | ... + ; The latter, however, is much more readable. @@ -1655,14 +1879,13 @@ and use `make' to arrange to recompile them. With all the source in a single file, you use the following command to convert it into a parser file: - bison FILE_NAME.y + bison FILE.y In this example the file was called `rpcalc.y' (for "Reverse Polish -CALCulator"). Bison produces a file named `FILE_NAME.tab.c', removing -the `.y' from the original file name. The file output by Bison -contains the source code for `yyparse'. The additional functions in -the input file (`yylex', `yyerror' and `main') are copied verbatim to -the output. +CALCulator"). Bison produces a file named `FILE.tab.c', removing the +`.y' from the original file name. The file output by Bison contains +the source code for `yyparse'. The additional functions in the input +file (`yylex', `yyerror' and `main') are copied verbatim to the output.  File: bison.info, Node: Rpcalc Compile, Prev: Rpcalc Gen, Up: RPN Calc @@ -2175,7 +2398,7 @@ provides for either functions or variables to be placed in the table. /* The symbol table: a chain of `struct symrec'. */ extern symrec *sym_table; - symrec *putsym (char const *, func_t); + symrec *putsym (char const *, int); symrec *getsym (char const *); The new version of `main' includes a call to `init_table', a @@ -2493,7 +2716,7 @@ which need not come before the definition of `yyparse'. For example, the definitions of `yylex' and `yyerror' often go here. Because C requires functions to be declared before being used, you often need to declare functions like `yylex' and `yyerror' in the Prologue, even if -you define them int he Epilogue. *Note Parser C-Language Interface: +you define them in the Epilogue. *Note Parser C-Language Interface: Interface. If the last section is empty, you may omit the `%%' that separates it @@ -3173,37 +3396,46 @@ dedicated code from semantic actions. The `YYLLOC_DEFAULT' macro takes three parameters. The first one is the location of the grouping (the result of the computation). When a -rule is matched, the second parameter is an array holding locations of -all right hand side elements of the rule being matched, and the third -parameter is the size of the rule's right hand side. When processing a -syntax error, the second parameter is an array holding locations of the -symbols that were discarded during error processing, and the third -parameter is the number of discarded symbols. +rule is matched, the second parameter identifies locations of all right +hand side elements of the rule being matched, and the third parameter +is the size of the rule's right hand side. When processing a syntax +error, the second parameter identifies locations of the symbols that +were discarded during error processing, and the third parameter is the +number of discarded symbols. - By default, `YYLLOC_DEFAULT' is defined this way for simple LALR(1) -parsers: + By default, `YYLLOC_DEFAULT' is defined this way: - # define YYLLOC_DEFAULT(Current, Rhs, N) \ - ((Current).first_line = (Rhs)[1].first_line, \ - (Current).first_column = (Rhs)[1].first_column, \ - (Current).last_line = (Rhs)[N].last_line, \ - (Current).last_column = (Rhs)[N].last_column) + # define YYLLOC_DEFAULT(Current, Rhs, N) \ + do \ + if (N) \ + { \ + (Current).first_line = YYRHSLOC(Rhs, 1).first_line; \ + (Current).first_column = YYRHSLOC(Rhs, 1).first_column; \ + (Current).last_line = YYRHSLOC(Rhs, N).last_line; \ + (Current).last_column = YYRHSLOC(Rhs, N).last_column; \ + } \ + else \ + { \ + (Current).first_line = (Current).last_line = \ + YYRHSLOC(Rhs, 0).last_line; \ + (Current).first_column = (Current).last_column = \ + YYRHSLOC(Rhs, 0).last_column; \ + } \ + while (0) -and like this for GLR parsers: - - # define YYLLOC_DEFAULT(yyCurrent, yyRhs, YYN) \ - ((yyCurrent).first_line = YYRHSLOC(yyRhs, 1).first_line, \ - (yyCurrent).first_column = YYRHSLOC(yyRhs, 1).first_column, \ - (yyCurrent).last_line = YYRHSLOC(yyRhs, YYN).last_line, \ - (yyCurrent).last_column = YYRHSLOC(yyRhs, YYN).last_column) + where `YYRHSLOC (rhs, k)' is the location of the Kth symbol in RHS +when K is positive, and the location of the symbol just before the +reduction when K and N are both zero. When defining `YYLLOC_DEFAULT', you should consider that: * All arguments are free of side-effects. However, only the first one (the result) should be modified by `YYLLOC_DEFAULT'. - * For consistency with semantic actions, valid indexes for the - location array range from 1 to N. + * For consistency with semantic actions, valid indexes within the + right hand side range from 1 to N. When N is zero, only 0 is a + valid index, and it refers to the symbol just before the reduction. + During error processing N is always positive. * Your macro should parenthesize its arguments, if need be, since the actual arguments may not be surrounded by parentheses. Also, your @@ -3236,6 +3468,7 @@ Language and Grammar.). * Precedence Decl:: Declaring terminals with precedence and associativity. * Union Decl:: Declaring the set of all semantic value types. * Type Decl:: Declaring the choice of type for a nonterminal symbol. +* Initial Action Decl:: Code run before parsing starts. * Destructor Decl:: Declaring how symbols are freed. * Expect Decl:: Suppressing warnings about parsing conflicts. * Start Decl:: Specifying the start symbol. @@ -3380,7 +3613,7 @@ example: write a semicolon after the closing brace.  -File: bison.info, Node: Type Decl, Next: Destructor Decl, Prev: Union Decl, Up: Declarations +File: bison.info, Node: Type Decl, Next: Initial Action Decl, Prev: Union Decl, Up: Declarations 3.7.4 Nonterminal Symbols ------------------------- @@ -3402,34 +3635,58 @@ this, use the same `' construction in a declaration for the terminal symbol. All kinds of token declarations allow `'.  -File: bison.info, Node: Destructor Decl, Next: Expect Decl, Prev: Type Decl, Up: Declarations +File: bison.info, Node: Initial Action Decl, Next: Destructor Decl, Prev: Type Decl, Up: Declarations -3.7.5 Freeing Discarded Symbols +3.7.5 Performing Actions before Parsing +--------------------------------------- + +Sometimes your parser needs to perform some initializations before +parsing. The `%initial-action' directive allows for such arbitrary +code. + + -- Directive: %initial-action { CODE } + Declare that the CODE must be invoked before parsing each time + `yyparse' is called. The CODE may use `$$' and `@$' -- initial + value and location of the look-ahead -- and the `%parse-param'. + + For instance, if your locations use a file name, you may use + + %parse-param { char const *file_name }; + %initial-action + { + @$.begin.filename = @$.end.filename = file_name; + }; + + +File: bison.info, Node: Destructor Decl, Next: Expect Decl, Prev: Initial Action Decl, Up: Declarations + +3.7.6 Freeing Discarded Symbols ------------------------------- -Some symbols can be discarded by the parser, typically during error -recovery (*note Error Recovery::). Basically, during error recovery, -embarrassing symbols already pushed on the stack, and embarrassing -tokens coming from the rest of the file are thrown away until the parser -falls on its feet. If these symbols convey heap based information, this -memory is lost. While this behavior is tolerable for batch parsers, -such as in compilers, it is unacceptable for parsers that can -possibility "never end" such as shells, or implementations of -communication protocols. +Some symbols can be discarded by the parser. During error recovery +(*note Error Recovery::), symbols already pushed on the stack and +tokens coming from the rest of the file are discarded until the parser +falls on its feet. If the parser runs out of memory, all the symbols +on the stack must be discarded. Even if the parser succeeds, it must +discard the start symbol. - The `%destructor' directive allows for the definition of code that -is called when a symbol is thrown away. + When discarded symbols convey heap based information, this memory is +lost. While this behavior can be tolerable for batch parsers, such as +in traditional compilers, it is unacceptable for programs like shells +or protocol implementations that may parse and execute indefinitely. + + The `%destructor' directive defines code that is called when a +symbol is discarded. -- Directive: %destructor { CODE } SYMBOLS - Declare that the CODE must be invoked for each of the SYMBOLS that - will be discarded by the parser. The CODE should use `$$' to - designate the semantic value associated to the SYMBOLS. The - additional parser parameters are also available (*note The Parser - Function `yyparse': Parser Function.). + Invoke CODE whenever the parser discards one of the SYMBOLS. + Within CODE, `$$' designates the semantic value associated with + the discarded symbol. The additional parser parameters are also + available (*note The Parser Function `yyparse': Parser Function.). - *Warning:* as of Bison 1.875, this feature is still considered as - experimental, as there was not enough user feedback. In - particular, the syntax might still change. + *Warning:* as of Bison 2.1, this feature is still experimental, as + there has not been enough user feedback. In particular, the + syntax might still change. For instance: @@ -3441,7 +3698,7 @@ is called when a symbol is thrown away. %type string %destructor { free ($$); } STRING string -guarantees that when a `STRING' or a `string' will be discarded, its +guarantees that when a `STRING' or a `string' is discarded, its associated memory will be freed. Note that in the future, Bison might also consider that right hand @@ -3456,10 +3713,23 @@ Of course, this will not apply to the default action; compare: typeless: string; // $$ = $1 does not apply; $1 is destroyed. typefull: string; // $$ = $1 applies, $1 is not destroyed. + + "Discarded symbols" are the following: + + * stacked symbols popped during the first phase of error recovery, + + * incoming terminals during the second phase of error recovery, + + * the current look-ahead and the entire stack when the parser aborts + (either via an explicit call to `YYABORT', or as a consequence of + a failed error recovery or of memory exhaustion), and + + * the start symbol, when the parser succeeds. +  File: bison.info, Node: Expect Decl, Next: Start Decl, Prev: Destructor Decl, Up: Declarations -3.7.6 Suppressing Conflict Warnings +3.7.7 Suppressing Conflict Warnings ----------------------------------- Bison normally warns if there are any conflicts in the grammar (*note @@ -3508,7 +3778,7 @@ in more or fewer conflicts.  File: bison.info, Node: Start Decl, Next: Pure Decl, Prev: Expect Decl, Up: Declarations -3.7.7 The Start-Symbol +3.7.8 The Start-Symbol ---------------------- Bison assumes by default that the start symbol for the grammar is the @@ -3521,7 +3791,7 @@ as follows:  File: bison.info, Node: Pure Decl, Next: Decl Summary, Prev: Start Decl, Up: Declarations -3.7.8 A Pure (Reentrant) Parser +3.7.9 A Pure (Reentrant) Parser ------------------------------- A "reentrant" program is one which does not alter in the course of @@ -3558,8 +3828,8 @@ valid grammar.  File: bison.info, Node: Decl Summary, Prev: Pure Decl, Up: Declarations -3.7.9 Bison Declaration Summary -------------------------------- +3.7.10 Bison Declaration Summary +-------------------------------- Here is a summary of the declarations used to define a grammar: @@ -3606,21 +3876,36 @@ directives: *Note Tracing Your Parser: Tracing. -- Directive: %defines - Write an extra output file containing macro definitions for the - token type names defined in the grammar and the semantic value type - `YYSTYPE', as well as a few `extern' variable declarations. - + Write a header file containing macro definitions for the token type + names defined in the grammar as well as a few other declarations. If the parser output file is named `NAME.c' then this file is named `NAME.h'. - This output file is essential if you wish to put the definition of - `yylex' in a separate source file, because `yylex' needs to be - able to refer to token type codes and the variable `yylval'. - *Note Semantic Values of Tokens: Token Values. + Unless `YYSTYPE' is already defined as a macro, the output header + declares `YYSTYPE'. Therefore, if you are using a `%union' (*note + More Than One Value Type: Multiple Types.) with components that + require other definitions, or if you have defined a `YYSTYPE' + macro (*note Data Types of Semantic Values: Value Type.), you need + to arrange for these definitions to be propagated to all modules, + e.g., by putting them in a prerequisite header that is included + both by your parser and by any other module that needs `YYSTYPE'. + + Unless your parser is pure, the output header declares `yylval' as + an external variable. *Note A Pure (Reentrant) Parser: Pure Decl. + + If you have also used locations, the output header declares + `YYLTYPE' and `yylloc' using a protocol similar to that of + `YYSTYPE' and `yylval'. *Note Tracking Locations: Locations. + + This output file is normally essential if you wish to put the + definition of `yylex' in a separate source file, because `yylex' + typically needs to be able to refer to the above-mentioned + declarations and to the token type codes. *Note Semantic Values + of Tokens: Token Values. -- Directive: %destructor - Specifying how the parser should reclaim the memory associated to - discarded symbols. *Note Freeing Discarded Symbols: Destructor + Specify how the parser should reclaim the memory associated to + discarded symbols. *Note Freeing Discarded Symbols: Destructor Decl. -- Directive: %file-prefix="PREFIX" @@ -3649,7 +3934,7 @@ directives: static variable declarations. This option also tells Bison to write the C code for the grammar - actions into a file named `FILENAME.act', in the form of a + actions into a file named `FILE.act', in the form of a brace-surrounded body fit for a `switch' statement. -- Directive: %no-lines @@ -3660,8 +3945,8 @@ directives: directive causes them to associate errors with the parser file, treating it an independent source file in its own right. - -- Directive: %output="FILENAME" - Specify the FILENAME for the parser file. + -- Directive: %output="FILE" + Specify FILE for the parser file. -- Directive: %pure-parser Request a pure (reentrant) parser program (*note A Pure @@ -3675,15 +3960,14 @@ directives: `"error"', and `"$undefined"'; after these come the symbols defined in the grammar file. - For single-character literal tokens and literal string tokens, the - name in the table includes the single-quote or double-quote - characters: for example, `"'+'"' is a single-character literal and - `"\"<=\""' is a literal string token. All the characters of the - literal string token appear verbatim in the string found in the - table; even double-quote characters are not escaped. For example, - if the token consists of three characters `*"*', its string in - `yytname' contains `"*"*"'. (In C, that would be written as - `"\"*\"*\""'). + The name in the table includes all the characters needed to + represent the token in Bison. For single-character literals and + literal strings, this includes the surrounding quoting characters + and any escape sequences. For example, the Bison single-character + literal `'+'' corresponds to a three-character name, represented + in C as `"'+'"'; and the Bison two-character literal string `"\\/"' + corresponds to a five-character name, represented in C as + `"\"\\\\/\""'. When you specify `%token-table', Bison also generates macro definitions for macros `YYNTOKENS', `YYNNTS', and `YYNRULES', and @@ -3767,6 +4051,8 @@ grammar file, you are likely to run into trouble. which reads tokens. * Error Reporting:: You must supply a function `yyerror'. * Action Features:: Special features for use in actions. +* Internationalization:: How to let the parser speak in the user's + native language.  File: bison.info, Node: Parser Function, Next: Lexical, Up: Interface @@ -3784,7 +4070,11 @@ reading further. The value returned by `yyparse' is 0 if parsing was successful (return is due to end-of-input). - The value is 1 if parsing failed (return is due to a syntax error). + The value is 1 if parsing failed because of invalid input, i.e., + input that contains a syntax error or that causes `YYABORT' to be + invoked. + + The value is 2 if parsing failed due to memory exhaustion. In an action, you can cause immediate return from `yyparse' by using these macros: @@ -3906,11 +4196,13 @@ utility can be used without change as the definition of `yylex'. The index of the token in the table is the token type's code. The name of a multicharacter token is recorded in `yytname' with a double-quote, the token's characters, and another double-quote. - The token's characters are not escaped in any way; they appear - verbatim in the contents of the string in the table. + The token's characters are escaped as necessary to be suitable as + input to Bison. - Here's code for looking up a token in `yytname', assuming that the - characters of the token are stored in `token_buffer'. + Here's code for looking up a multicharacter token in `yytname', + assuming that the characters of the token are stored in + `token_buffer', and assuming that the token does not contain any + characters like `"' that require escaping. for (i = 0; i < YYNTOKENS; i++) { @@ -4059,12 +4351,16 @@ declarations section (*note The Bison Declarations Section: Bison Declarations.), then Bison provides a more verbose and specific error message string instead of just plain `"syntax error"'. - The parser can detect one other kind of error: stack overflow. This -happens when the input contains constructions that are very deeply -nested. It isn't likely you will encounter this, since the Bison -parser extends its stack automatically up to a very large limit. But -if overflow happens, `yyparse' calls `yyerror' in the usual fashion, -except that the argument string is `"parser stack overflow"'. + The parser can detect one other kind of error: memory exhaustion. +This can happen when the input contains constructions that are very +deeply nested. It isn't likely you will encounter this, since the Bison +parser normally extends its stack automatically up to a very large +limit. But if memory is exhausted, `yyparse' calls `yyerror' in the +usual fashion, except that the argument string is `"memory exhausted"'. + + In some cases diagnostics like `"syntax error"' are translated +automatically from English to some other language before they are +passed to `yyerror'. *Note Internationalization::. The following definition suffices in simple programs: @@ -4131,7 +4427,7 @@ request a pure parser (*note A Pure (Reentrant) Parser: Pure Decl.) then it is a local variable which only the actions can access.  -File: bison.info, Node: Action Features, Prev: Error Reporting, Up: Interface +File: bison.info, Node: Action Features, Next: Internationalization, Prev: Error Reporting, Up: Interface 4.4 Special Features for Use in Actions ======================================= @@ -4220,6 +4516,64 @@ useful in actions. textual location of the Nth component of the current rule. *Note Tracking Locations: Locations. + +File: bison.info, Node: Internationalization, Prev: Action Features, Up: Interface + +4.5 Parser Internationalization +=============================== + +A Bison-generated parser can print diagnostics, including error and +tracing messages. By default, they appear in English. However, Bison +also supports outputting diagnostics in the user's native language. To +make this work, the user should set the usual environment variables. +*Note The User's View: (gettext)Users. For example, the shell command +`export LC_ALL=fr_CA.UTF-8' might set the user's locale to French +Canadian using the UTF-8 encoding. The exact set of available locales +depends on the user's installation. + + The maintainer of a package that uses a Bison-generated parser +enables the internationalization of the parser's output through the +following steps. Here we assume a package that uses GNU Autoconf and +GNU Automake. + + 1. Into the directory containing the GNU Autoconf macros used by the + package--often called `m4'--copy the `bison-i18n.m4' file + installed by Bison under `share/aclocal/bison-i18n.m4' in Bison's + installation directory. For example: + + cp /usr/local/share/aclocal/bison-i18n.m4 m4/bison-i18n.m4 + + 2. In the top-level `configure.ac', after the `AM_GNU_GETTEXT' + invocation, add an invocation of `BISON_I18N'. This macro is + defined in the file `bison-i18n.m4' that you copied earlier. It + causes `configure' to find the value of the `BISON_LOCALEDIR' + variable, and it defines the source-language symbol `YYENABLE_NLS' + to enable translations in the Bison-generated parser. + + 3. In the `main' function of your program, designate the directory + containing Bison's runtime message catalog, through a call to + `bindtextdomain' with domain name `bison-runtime'. For example: + + bindtextdomain ("bison-runtime", BISON_LOCALEDIR); + + Typically this appears after any other call `bindtextdomain + (PACKAGE, LOCALEDIR)' that your package already has. Here we rely + on `BISON_LOCALEDIR' to be defined as a string through the + `Makefile'. + + 4. In the `Makefile.am' that controls the compilation of the `main' + function, make `BISON_LOCALEDIR' available as a C preprocessor + macro, either in `DEFS' or in `AM_CPPFLAGS'. For example: + + DEFS = @DEFS@ -DBISON_LOCALEDIR='"$(BISON_LOCALEDIR)"' + + or: + + AM_CPPFLAGS = -DBISON_LOCALEDIR='"$(BISON_LOCALEDIR)"' + + 5. Finally, invoke the command `autoreconf' to generate the build + infrastructure. +  File: bison.info, Node: Algorithm, Next: Error Recovery, Prev: Interface, Up: Top @@ -4276,7 +4630,7 @@ Grammar.). * Reduce/Reduce:: When two rules are applicable in the same situation. * Mystery Conflicts:: Reduce/reduce conflicts that look unjustified. * Generalized LR Parsing:: Parsing arbitrary context-free grammars. -* Stack Overflow:: What happens when stack gets full. How to avoid it. +* Memory Management:: What happens when memory is exhausted. How to avoid it.  File: bison.info, Node: Look-Ahead, Next: Shift/Reduce, Up: Algorithm @@ -4807,20 +5161,26 @@ activates the altered rule for `return_spec' rather than the one for | ID ':' type ; + For a more detailed exposition of LALR(1) parsers and parser +generators, please see: Frank DeRemer and Thomas Pennello, Efficient +Computation of LALR(1) Look-Ahead Sets, `ACM Transactions on +Programming Languages and Systems', Vol. 4, No. 4 (October 1982), pp. +615-649 `http://doi.acm.org/10.1145/69622.357187'. +  -File: bison.info, Node: Generalized LR Parsing, Next: Stack Overflow, Prev: Mystery Conflicts, Up: Algorithm +File: bison.info, Node: Generalized LR Parsing, Next: Memory Management, Prev: Mystery Conflicts, Up: Algorithm 5.8 Generalized LR (GLR) Parsing ================================ Bison produces _deterministic_ parsers that choose uniquely when to reduce and which reduction to apply based on a summary of the preceding -input and on one extra token of lookahead. As a result, normal Bison +input and on one extra token of look-ahead. As a result, normal Bison handles a proper subset of the family of context-free languages. Ambiguous grammars, since they have strings with more than one possible sequence of reductions cannot have deterministic parsers in this sense. The same is true of languages that require more than one symbol of -lookahead, since the parser lacks the information necessary to make a +look-ahead, since the parser lacks the information necessary to make a decision at the point it must be made in a shift-reduce parser. Finally, as previously mentioned (*note Mystery Conflicts::), there are languages where Bison's particular choice of how to summarize the input @@ -4887,43 +5247,50 @@ Department of Computer Science, TR-00-12, (2000-12-24).  -File: bison.info, Node: Stack Overflow, Prev: Generalized LR Parsing, Up: Algorithm +File: bison.info, Node: Memory Management, Prev: Generalized LR Parsing, Up: Algorithm -5.9 Stack Overflow, and How to Avoid It -======================================= +5.9 Memory Management, and How to Avoid Memory Exhaustion +========================================================= -The Bison parser stack can overflow if too many tokens are shifted and -not reduced. When this happens, the parser function `yyparse' returns -a nonzero value, pausing only to call `yyerror' to report the overflow. +The Bison parser stack can run out of memory if too many tokens are +shifted and not reduced. When this happens, the parser function +`yyparse' calls `yyerror' and then returns 2. Because Bison parsers have growing stacks, hitting the upper limit usually results from using a right recursion instead of a left recursion, *Note Recursive Rules: Recursion. By defining the macro `YYMAXDEPTH', you can control how deep the -parser stack can become before a stack overflow occurs. Define the -macro with a value that is an integer. This value is the maximum number -of tokens that can be shifted (and not reduced) before overflow. It -must be a constant expression whose value is known at compile time. +parser stack can become before memory is exhausted. Define the macro +with a value that is an integer. This value is the maximum number of +tokens that can be shifted (and not reduced) before overflow. The stack space allowed is not necessarily allocated. If you -specify a large value for `YYMAXDEPTH', the parser actually allocates a +specify a large value for `YYMAXDEPTH', the parser normally allocates a small stack at first, and then makes it bigger by stages as needed. This increasing allocation happens automatically and silently. Therefore, you do not need to make `YYMAXDEPTH' painfully small merely to save space for ordinary inputs that do not need much stack. + However, do not allow `YYMAXDEPTH' to be a value so large that +arithmetic overflow could occur when calculating the size of the stack +space. Also, do not allow `YYMAXDEPTH' to be less than `YYINITDEPTH'. + The default value of `YYMAXDEPTH', if you do not define it, is 10000. You can control how much stack is allocated initially by defining the -macro `YYINITDEPTH'. This value too must be a compile-time constant -integer. The default is 200. +macro `YYINITDEPTH' to a positive integer. For the C LALR(1) parser, +this value must be a compile-time constant unless you are assuming C99 +or some other target language or compiler that allows variable-length +arrays. The default is 200. + + Do not allow `YYINITDEPTH' to be greater than `YYMAXDEPTH'. Because of semantical differences between C and C++, the LALR(1) -parsers in C produced by Bison by compiled as C++ cannot grow. In this -precise case (compiling a C parser as C++) you are suggested to grow -`YYINITDEPTH'. In the near future, a C++ output output will be -provided which addresses this issue. +parsers in C produced by Bison cannot grow when compiled by C++ +compilers. In this precise case (compiling a C parser as C++) you are +suggested to grow `YYINITDEPTH'. The Bison maintainers hope to fix +this deficiency in a future release.  File: bison.info, Node: Error Recovery, Next: Context Dependency, Prev: Algorithm, Up: Top @@ -5095,9 +5462,13 @@ parsed. But in C this is not always so: C allows a declaration to redeclare a typedef name provided an explicit type has been specified earlier: - typedef int foo, bar, lose; - static foo (bar); /* redeclare `bar' as static variable */ - static int foo (lose); /* redeclare `foo' as function */ + typedef int foo, bar; + int baz (void) + { + static bar (bar); /* redeclare `bar' as static variable */ + extern foo foo (foo); /* redeclare `foo' as function */ + return foo (bar); + } Unfortunately, the name being declared is separated from the declaration construct itself by a complicated syntactic structure--the @@ -5379,12 +5750,12 @@ beginning of the parsing, in the initial rule, right before the start symbol (here, `exp'). When the parser returns to this state right after having reduced a rule that produced an `exp', the control flow jumps to state 2. If there is no such transition on a nonterminal -symbol, and the lookahead is a `NUM', then this token is shifted on the -parse stack, and the control flow jumps to state 1. Any other -lookahead triggers a syntax error." +symbol, and the look-ahead is a `NUM', then this token is shifted on +the parse stack, and the control flow jumps to state 1. Any other +look-ahead triggers a syntax error." Even though the only active rule in state 0 seems to be rule 0, the -report lists `NUM' as a lookahead symbol because `NUM' can be at the +report lists `NUM' as a look-ahead token because `NUM' can be at the beginning of any rule deriving an `exp'. By default Bison reports the so-called "core" or "kernel" of the item set, but if you want to see more detail you can invoke `bison' with `--report=itemset' to list all @@ -5411,7 +5782,7 @@ In the state 1... $default reduce using rule 5 (exp) -the rule 5, `exp: NUM;', is completed. Whatever the lookahead +the rule 5, `exp: NUM;', is completed. Whatever the look-ahead token (`$default'), the parser will reduce it. If it was coming from state 0, then, after this reduction it will return to state 0, and will jump to state 2 (`exp: go to state 2'). @@ -5431,11 +5802,11 @@ to state 2 (`exp: go to state 2'). '/' shift, and go to state 7 In state 2, the automaton can only shift a symbol. For instance, -because of the item `exp -> exp . '+' exp', if the lookahead if `+', it -will be shifted on the parse stack, and the automaton control will jump -to state 4, corresponding to the item `exp -> exp '+' . exp'. Since -there is no default action, any other token than those listed above -will trigger a syntax error. +because of the item `exp -> exp . '+' exp', if the look-ahead if `+', +it will be shifted on the parse stack, and the automaton control will +jump to state 4, corresponding to the item `exp -> exp '+' . exp'. +Since there is no default action, any other token than those listed +above will trigger a syntax error. The state 3 is named the "final state", or the "accepting state": @@ -5500,7 +5871,7 @@ shift/reduce': '/' [reduce using rule 1 (exp)] $default reduce using rule 1 (exp) - Indeed, there are two actions associated to the lookahead `/': + Indeed, there are two actions associated to the look-ahead `/': either shifting (and going to state 7), or reducing rule 1. The conflict means that either the grammar is ambiguous, or the parser lacks information to make the right decision. Indeed the grammar is @@ -5518,14 +5889,14 @@ square brackets. either shifting the next token and going to the corresponding state, or reducing a single rule. In the other cases, i.e., when shifting _and_ reducing is possible or when _several_ reductions are possible, the -lookahead is required to select the action. State 8 is one such state: -if the lookahead is `*' or `/' then the action is shifting, otherwise -the action is reducing rule 1. In other words, the first two items, -corresponding to rule 1, are not eligible when the lookahead is `*', -since we specified that `*' has higher precedence that `+'. More -generally, some items are eligible only with some set of possible -lookaheads. When run with `--report=lookahead', Bison specifies these -lookaheads: +look-ahead is required to select the action. State 8 is one such +state: if the look-ahead is `*' or `/' then the action is shifting, +otherwise the action is reducing rule 1. In other words, the first two +items, corresponding to rule 1, are not eligible when the look-ahead +token is `*', since we specified that `*' has higher precedence than +`+'. More generally, some items are eligible only with some set of +possible look-ahead tokens. When run with `--report=look-ahead', Bison +specifies these look-ahead tokens: state 8 @@ -5589,9 +5960,9 @@ lookaheads: '/' [reduce using rule 4 (exp)] $default reduce using rule 4 (exp) -Observe that state 11 contains conflicts due to the lack of precedence -of `/' wrt `+', `-', and `*', but also because the associativity of `/' -is not specified. +Observe that state 11 contains conflicts not only due to the lack of +precedence of `/' with respect to `+', `-', and `*', but also because +the associativity of `/' is not specified.  File: bison.info, Node: Tracing, Prev: Understanding, Up: Debugging @@ -5691,7 +6062,7 @@ calculator (*note Declarations for `mfcalc': Mfcalc Decl.): }  -File: bison.info, Node: Invocation, Next: Table of Symbols, Prev: Debugging, Up: Top +File: bison.info, Node: Invocation, Next: C++ Language Interface, Prev: Debugging, Up: Top 9 Invoking Bison **************** @@ -5701,14 +6072,15 @@ The usual way to invoke Bison is as follows: bison INFILE Here INFILE is the grammar file name, which usually ends in `.y'. -The parser file's name is made by replacing the `.y' with `.tab.c'. -Thus, the `bison foo.y' filename yields `foo.tab.c', and the `bison -hack/foo.y' filename yields `hack/foo.tab.c'. It's also possible, in -case you are writing C++ code instead of C in your grammar file, to -name it `foo.ypp' or `foo.y++'. Then, the output files will take an -extension like the given one as input (respectively `foo.tab.cpp' and -`foo.tab.c++'). This feature takes effect with all options that -manipulate filenames like `-o' or `-d'. +The parser file's name is made by replacing the `.y' with `.tab.c' and +removing any leading directory. Thus, the `bison foo.y' file name +yields `foo.tab.c', and the `bison hack/foo.y' file name yields +`foo.tab.c'. It's also possible, in case you are writing C++ code +instead of C in your grammar file, to name it `foo.ypp' or `foo.y++'. +Then, the output files will take an extension like the given one as +input (respectively `foo.tab.cpp' and `foo.tab.c++'). This feature +takes effect with all options that manipulate file names like `-o' or +`-d'. For example : @@ -5754,6 +6126,9 @@ Operations modes: `--version' Print the version number of Bison and exit. +`--print-localedir' + Print the name of the directory containing locale-dependent data. + `-y' `--yacc' Equivalent to `-o y.tab.c'; the parser output file is called @@ -5810,8 +6185,8 @@ Adjust the output: `--defines' Pretend that `%defines' was specified, i.e., write an extra output file containing macro definitions for the token type names defined - in the grammar and the semantic value type `YYSTYPE', as well as a - few `extern' variable declarations. *Note Decl Summary::. + in the grammar, as well as a few other declarations. *Note Decl + Summary::. `--defines=DEFINES-FILE' Same as above, but save in the file DEFINES-FILE. @@ -5830,9 +6205,9 @@ Adjust the output: Description of the grammar, conflicts (resolved and unresolved), and LALR automaton. - `lookahead' + `look-ahead' Implies `state' and augments the description of the automaton - with each rule's lookahead set. + with each rule's look-ahead set. `itemset' Implies `state' and augments the description of the automaton @@ -5847,11 +6222,11 @@ Adjust the output: file containing verbose descriptions of the grammar and parser. *Note Decl Summary::. -`-o FILENAME' -`--output=FILENAME' - Specify the FILENAME for the parser file. +`-o FILE' +`--output=FILE' + Specify the FILE for the parser file. - The other output files' names are constructed from FILENAME as + The other output files' names are constructed from FILE as described under the `-v' and `-d' options. `-g' @@ -5862,7 +6237,7 @@ Adjust the output: `--graph=GRAPH-FILE' The behavior of -GRAPH is the same than `-g'. The only difference is that it has an optional argument which is the name of the - output graph filename. + output graph file.  File: bison.info, Node: Option Cross Key, Next: Yacc Library, Prev: Bison Options, Up: Invocation @@ -5882,6 +6257,7 @@ the corresponding short option. --no-lines -l --no-parser -n --output=OUTFILE -o OUTFILE + --print-localedir --token-table -k --verbose -v --version -V @@ -5912,9 +6288,589 @@ have the following type signature: int yyparse (void);  -File: bison.info, Node: FAQ, Next: Copying This Manual, Prev: Glossary, Up: Top +File: bison.info, Node: C++ Language Interface, Next: FAQ, Prev: Invocation, Up: Top -10 Frequently Asked Questions +10 C++ Language Interface +************************* + +* Menu: + +* C++ Parsers:: The interface to generate C++ parser classes +* A Complete C++ Example:: Demonstrating their use + + +File: bison.info, Node: C++ Parsers, Next: A Complete C++ Example, Up: C++ Language Interface + +10.1 C++ Parsers +================ + +* Menu: + +* C++ Bison Interface:: Asking for C++ parser generation +* C++ Semantic Values:: %union vs. C++ +* C++ Location Values:: The position and location classes +* C++ Parser Interface:: Instantiating and running the parser +* C++ Scanner Interface:: Exchanges between yylex and parse + + +File: bison.info, Node: C++ Bison Interface, Next: C++ Semantic Values, Up: C++ Parsers + +10.1.1 C++ Bison Interface +-------------------------- + +The C++ parser LALR(1) skeleton is named `lalr1.cc'. To select it, you +may either pass the option `--skeleton=lalr1.cc' to Bison, or include +the directive `%skeleton "lalr1.cc"' in the grammar preamble. When +run, `bison' will create several files: +`position.hh' +`location.hh' + The definition of the classes `position' and `location', used for + location tracking. *Note C++ Location Values::. + +`stack.hh' + An auxiliary class `stack' used by the parser. + +`FILE.hh' +`FILE.cc' + The declaration and implementation of the C++ parser class. FILE + is the name of the output file. It follows the same rules as with + regular C parsers. + + Note that `FILE.hh' is _mandatory_, the C++ cannot work without + the parser class declaration. Therefore, you must either pass + `-d'/`--defines' to `bison', or use the `%defines' directive. + + All these files are documented using Doxygen; run `doxygen' for a +complete and accurate documentation. + + +File: bison.info, Node: C++ Semantic Values, Next: C++ Location Values, Prev: C++ Bison Interface, Up: C++ Parsers + +10.1.2 C++ Semantic Values +-------------------------- + +The `%union' directive works as for C, see *Note The Collection of +Value Types: Union Decl. In particular it produces a genuine +`union'(1), which have a few specific features in C++. + - The name `YYSTYPE' also denotes `union YYSTYPE'. You may forward + declare it just with `union YYSTYPE;'. + + - Non POD (Plain Old Data) types cannot be used. C++ forbids any + instance of classes with constructors in unions: only _pointers_ + to such objects are allowed. + + Because objects have to be stored via pointers, memory is not +reclaimed automatically: using the `%destructor' directive is the only +means to avoid leaks. *Note Freeing Discarded Symbols: Destructor Decl. + + ---------- Footnotes ---------- + + (1) In the future techniques to allow complex types within +pseudo-unions (variants) might be implemented to alleviate these issues. + + +File: bison.info, Node: C++ Location Values, Next: C++ Parser Interface, Prev: C++ Semantic Values, Up: C++ Parsers + +10.1.3 C++ Location Values +-------------------------- + +When the directive `%locations' is used, the C++ parser supports +location tracking, see *Note Locations Overview: Locations. Two +auxiliary classes define a `position', a single point in a file, and a +`location', a range composed of a pair of `position's (possibly +spanning several files). + + -- Method on position: std::string* file + The name of the file. It will always be handled as a pointer, the + parser will never duplicate nor deallocate it. As an experimental + feature you may change it to `TYPE*' using `%define + "filename_type" "TYPE"'. + + -- Method on position: unsigned int line + The line, starting at 1. + + -- Method on position: unsigned int lines (int HEIGHT = 1) + Advance by HEIGHT lines, resetting the column number. + + -- Method on position: unsigned int column + The column, starting at 0. + + -- Method on position: unsigned int columns (int WIDTH = 1) + Advance by WIDTH columns, without changing the line number. + + -- Method on position: position& operator+= (position& POS, int WIDTH) + -- Method on position: position operator+ (const position& POS, int + WIDTH) + -- Method on position: position& operator-= (const position& POS, int + WIDTH) + -- Method on position: position operator- (position& POS, int WIDTH) + Various forms of syntactic sugar for `columns'. + + -- Method on position: position operator<< (std::ostream O, const + position& P) + Report P on O like this: `FILE:LINE.COLUMN', or `LINE.COLUMN' if + FILE is null. + + -- Method on location: position begin + -- Method on location: position end + The first, inclusive, position of the range, and the first beyond. + + -- Method on location: unsigned int columns (int WIDTH = 1) + -- Method on location: unsigned int lines (int HEIGHT = 1) + Advance the `end' position. + + -- Method on location: location operator+ (const location& BEGIN, + const location& END) + -- Method on location: location operator+ (const location& BEGIN, int + WIDTH) + -- Method on location: location operator+= (const location& LOC, int + WIDTH) + Various forms of syntactic sugar. + + -- Method on location: void step () + Move `begin' onto `end'. + + +File: bison.info, Node: C++ Parser Interface, Next: C++ Scanner Interface, Prev: C++ Location Values, Up: C++ Parsers + +10.1.4 C++ Parser Interface +--------------------------- + +The output files `OUTPUT.hh' and `OUTPUT.cc' declare and define the +parser class in the namespace `yy'. The class name defaults to +`parser', but may be changed using `%define "parser_class_name" +"NAME"'. The interface of this class is detailled below. It can be +extended using the `%parse-param' feature: its semantics is slightly +changed since it describes an additional member of the parser class, +and an additional argument for its constructor. + + -- Type of parser: semantic_value_type + -- Type of parser: location_value_type + The types for semantics value and locations. + + -- Method on parser: parser (TYPE1 ARG1, ...) + Build a new parser object. There are no arguments by default, + unless `%parse-param {TYPE1 ARG1}' was used. + + -- Method on parser: int parse () + Run the syntactic analysis, and return 0 on success, 1 otherwise. + + -- Method on parser: std::ostream& debug_stream () + -- Method on parser: void set_debug_stream (std::ostream& O) + Get or set the stream used for tracing the parsing. It defaults to + `std::cerr'. + + -- Method on parser: debug_level_type debug_level () + -- Method on parser: void set_debug_level (debug_level L) + Get or set the tracing level. Currently its value is either 0, no + trace, or non-zero, full tracing. + + -- Method on parser: void error (const location_type& L, const + std::string& M) + The definition for this member function must be supplied by the + user: the parser uses it to report a parser error occurring at L, + described by M. + + +File: bison.info, Node: C++ Scanner Interface, Prev: C++ Parser Interface, Up: C++ Parsers + +10.1.5 C++ Scanner Interface +---------------------------- + +The parser invokes the scanner by calling `yylex'. Contrary to C +parsers, C++ parsers are always pure: there is no point in using the +`%pure-parser' directive. Therefore the interface is as follows. + + -- Method on parser: int yylex (semantic_value_type& YYLVAL, + location_type& YYLLOC, TYPE1 ARG1, ...) + Return the next token. Its type is the return value, its semantic + value and location being YYLVAL and YYLLOC. Invocations of + `%lex-param {TYPE1 ARG1}' yield additional arguments. + + +File: bison.info, Node: A Complete C++ Example, Prev: C++ Parsers, Up: C++ Language Interface + +10.2 A Complete C++ Example +=========================== + +This section demonstrates the use of a C++ parser with a simple but +complete example. This example should be available on your system, +ready to compile, in the directory "../bison/examples/calc++". It +focuses on the use of Bison, therefore the design of the various C++ +classes is very naive: no accessors, no encapsulation of members etc. +We will use a Lex scanner, and more precisely, a Flex scanner, to +demonstrate the various interaction. A hand written scanner is +actually easier to interface with. + +* Menu: + +* Calc++ --- C++ Calculator:: The specifications +* Calc++ Parsing Driver:: An active parsing context +* Calc++ Parser:: A parser class +* Calc++ Scanner:: A pure C++ Flex scanner +* Calc++ Top Level:: Conducting the band + + +File: bison.info, Node: Calc++ --- C++ Calculator, Next: Calc++ Parsing Driver, Up: A Complete C++ Example + +10.2.1 Calc++ -- C++ Calculator +------------------------------- + +Of course the grammar is dedicated to arithmetics, a single expression, +possibily preceded by variable assignments. An environment containing +possibly predefined variables such as `one' and `two', is exchanged +with the parser. An example of valid input follows. + + three := 3 + seven := one + two * three + seven * seven + + +File: bison.info, Node: Calc++ Parsing Driver, Next: Calc++ Parser, Prev: Calc++ --- C++ Calculator, Up: A Complete C++ Example + +10.2.2 Calc++ Parsing Driver +---------------------------- + +To support a pure interface with the parser (and the scanner) the +technique of the "parsing context" is convenient: a structure +containing all the data to exchange. Since, in addition to simply +launch the parsing, there are several auxiliary tasks to execute (open +the file for parsing, instantiate the parser etc.), we recommend +transforming the simple parsing context structure into a fully blown +"parsing driver" class. + + The declaration of this driver class, `calc++-driver.hh', is as +follows. The first part includes the CPP guard and imports the +required standard library components. + + #ifndef CALCXX_DRIVER_HH + # define CALCXX_DRIVER_HH + # include + # include + +Then come forward declarations. Because the parser uses the parsing +driver and reciprocally, simple inclusions of header files will not do. +Because the driver's declaration is the one that will be imported by +the rest of the project, it is saner to forward declare the parser's +information here. + + // Forward declarations. + union YYSTYPE; + namespace yy + { + class location; + class calcxx_parser; + } + class calcxx_driver; + +Then comes the declaration of the scanning function. Flex expects the +signature of `yylex' to be defined in the macro `YY_DECL', and the C++ +parser expects it to be declared. We can factor both as follows. + + // Announce to Flex the prototype we want for lexing function, ... + # define YY_DECL \ + int yylex (YYSTYPE* yylval, yy::location* yylloc, calcxx_driver& driver) + // ... and declare it for the parser's sake. + YY_DECL; + +The `calcxx_driver' class is then declared with its most obvious +members. + + // Conducting the whole scanning and parsing of Calc++. + class calcxx_driver + { + public: + calcxx_driver (); + virtual ~calcxx_driver (); + + std::map variables; + + int result; + +To encapsulate the coordination with the Flex scanner, it is useful to +have two members function to open and close the scanning phase. +members. + + // Handling the scanner. + void scan_begin (); + void scan_end (); + bool trace_scanning; + +Similarly for the parser itself. + + // Handling the parser. + void parse (const std::string& f); + std::string file; + bool trace_parsing; + +To demonstrate pure handling of parse errors, instead of simply dumping +them on the standard error output, we will pass them to the compiler +driver using the following two member functions. Finally, we close the +class declaration and CPP guard. + + // Error handling. + void error (const yy::location& l, const std::string& m); + void error (const std::string& m); + }; + #endif // ! CALCXX_DRIVER_HH + + The implementation of the driver is straightforward. The `parse' +member function deserves some attention. The `error' functions are +simple stubs, they should actually register the located error messages +and set error state. + + #include "calc++-driver.hh" + #include "calc++-parser.hh" + + calcxx_driver::calcxx_driver () + : trace_scanning (false), trace_parsing (false) + { + variables["one"] = 1; + variables["two"] = 2; + } + + calcxx_driver::~calcxx_driver () + { + } + + void + calcxx_driver::parse (const std::string &f) + { + file = f; + scan_begin (); + yy::calcxx_parser parser (*this); + parser.set_debug_level (trace_parsing); + parser.parse (); + scan_end (); + } + + void + calcxx_driver::error (const yy::location& l, const std::string& m) + { + std::cerr << l << ": " << m << std::endl; + } + + void + calcxx_driver::error (const std::string& m) + { + std::cerr << m << std::endl; + } + + +File: bison.info, Node: Calc++ Parser, Next: Calc++ Scanner, Prev: Calc++ Parsing Driver, Up: A Complete C++ Example + +10.2.3 Calc++ Parser +-------------------- + +The parser definition file `calc++-parser.yy' starts by asking for the +C++ skeleton, the creation of the parser header file, and specifies the +name of the parser class. It then includes the required headers. + + %skeleton "lalr1.cc" /* -*- C++ -*- */ + %define "parser_class_name" "calcxx_parser" + %defines + %{ + # include + # include "calc++-driver.hh" + %} + +The driver is passed by reference to the parser and to the scanner. +This provides a simple but effective pure interface, not relying on +global variables. + + // The parsing context. + %parse-param { calcxx_driver& driver } + %lex-param { calcxx_driver& driver } + +Then we request the location tracking feature, and initialize the first +location's file name. Afterwards new locations are computed relatively +to the previous locations: the file name will be automatically +propagated. + + %locations + %initial-action + { + // Initialize the initial location. + @$.begin.filename = @$.end.filename = &driver.file; + }; + +Use the two following directives to enable parser tracing and verbose +error messages. + + %debug + %error-verbose + +Semantic values cannot use "real" objects, but only pointers to them. + + // Symbols. + %union + { + int ival; + std::string *sval; + }; + +The token numbered as 0 corresponds to end of file; the following line +allows for nicer error messages referring to "end of file" instead of +"$end". Similarly user friendly named are provided for each symbol. +Note that the tokens names are prefixed by `TOKEN_' to avoid name +clashes. + + %token TOKEN_EOF 0 "end of file" + %token TOKEN_ASSIGN ":=" + %token TOKEN_IDENTIFIER "identifier" + %token TOKEN_NUMBER "number" + %type exp "expression" + +To enable memory deallocation during error recovery, use `%destructor'. + + %printer { debug_stream () << *$$; } "identifier" + %destructor { delete $$; } "identifier" + + %printer { debug_stream () << $$; } "number" "expression" + +The grammar itself is straightforward. + + %% + %start unit; + unit: assignments exp { driver.result = $2; }; + + assignments: assignments assignment {} + | /* Nothing. */ {}; + + assignment: TOKEN_IDENTIFIER ":=" exp { driver.variables[*$1] = $3; }; + + %left '+' '-'; + %left '*' '/'; + exp: exp '+' exp { $$ = $1 + $3; } + | exp '-' exp { $$ = $1 - $3; } + | exp '*' exp { $$ = $1 * $3; } + | exp '/' exp { $$ = $1 / $3; } + | TOKEN_IDENTIFIER { $$ = driver.variables[*$1]; } + | TOKEN_NUMBER { $$ = $1; }; + %% + +Finally the `error' member function registers the errors to the driver. + + void + yy::calcxx_parser::error (const yy::calcxx_parser::location_type& l, + const std::string& m) + { + driver.error (l, m); + } + + +File: bison.info, Node: Calc++ Scanner, Next: Calc++ Top Level, Prev: Calc++ Parser, Up: A Complete C++ Example + +10.2.4 Calc++ Scanner +--------------------- + +The Flex scanner first includes the driver declaration, then the +parser's to get the set of defined tokens. + + %{ /* -*- C++ -*- */ + # include + # include + # include + # include + # include "calc++-driver.hh" + # include "calc++-parser.hh" + %} + +Because there is no `#include'-like feature we don't need `yywrap', we +don't need `unput' either, and we parse an actual file, this is not an +interactive session with the user. Finally we enable the scanner +tracing features. + + %option noyywrap nounput batch debug + +Abbreviations allow for more readable rules. + + id [a-zA-Z][a-zA-Z_0-9]* + int [0-9]+ + blank [ \t] + +The following paragraph suffices to track locations acurately. Each +time `yylex' is invoked, the begin position is moved onto the end +position. Then when a pattern is matched, the end position is advanced +of its width. In case it matched ends of lines, the end cursor is +adjusted, and each time blanks are matched, the begin cursor is moved +onto the end cursor to effectively ignore the blanks preceding tokens. +Comments would be treated equally. + + %{ + # define YY_USER_ACTION yylloc->columns (yyleng); + %} + %% + %{ + yylloc->step (); + %} + {blank}+ yylloc->step (); + [\n]+ yylloc->lines (yyleng); yylloc->step (); + +The rules are simple, just note the use of the driver to report errors. + + [-+*/] return yytext[0]; + ":=" return TOKEN_ASSIGN; + {int} { + errno = 0; + long n = strtol (yytext, NULL, 10); + if (! (INT_MIN <= n && n <= INT_MAX && errno != ERANGE)) + driver.error (*yylloc, "integer is out of range"); + yylval->ival = n; + return TOKEN_NUMBER; + } + {id} yylval->sval = new std::string (yytext); return TOKEN_IDENTIFIER; + . driver.error (*yylloc, "invalid character"); + %% + +Finally, because the scanner related driver's member function depend on +the scanner's data, it is simpler to implement them in this file. + + void + calcxx_driver::scan_begin () + { + yy_flex_debug = trace_scanning; + if (!(yyin = fopen (file.c_str (), "r"))) + error (std::string ("cannot open ") + file); + } + + void + calcxx_driver::scan_end () + { + fclose (yyin); + } + + +File: bison.info, Node: Calc++ Top Level, Prev: Calc++ Scanner, Up: A Complete C++ Example + +10.2.5 Calc++ Top Level +----------------------- + +The top level file, `calc++.cc', poses no problem. + + #include + #include "calc++-driver.hh" + + int + main (int argc, char *argv[]) + { + calcxx_driver driver; + for (++argv; argv[0]; ++argv) + if (*argv == std::string ("-p")) + driver.trace_parsing = true; + else if (*argv == std::string ("-s")) + driver.trace_scanning = true; + else + { + driver.parse (*argv); + std::cout << driver.result << std::endl; + } + } + + +File: bison.info, Node: FAQ, Next: Table of Symbols, Prev: C++ Language Interface, Up: Top + +11 Frequently Asked Questions ***************************** Several questions about Bison come up occasionally. Here some of them @@ -5922,28 +6878,27 @@ are addressed. * Menu: -* Parser Stack Overflow:: Breaking the Stack Limits +* Memory Exhausted:: Breaking the Stack Limits * How Can I Reset the Parser:: `yyparse' Keeps some State * Strings are Destroyed:: `yylval' Loses Track of Strings -* C++ Parsers:: Compiling Parsers with C++ Compilers -* Implementing Loops:: Control Flow in the Calculator +* Implementing Gotos/Loops:: Control Flow in the Calculator  -File: bison.info, Node: Parser Stack Overflow, Next: How Can I Reset the Parser, Up: FAQ +File: bison.info, Node: Memory Exhausted, Next: How Can I Reset the Parser, Up: FAQ -10.1 Parser Stack Overflow -========================== +11.1 Memory Exhausted +===================== - My parser returns with error with a `parser stack overflow' + My parser returns with error with a `memory exhausted' message. What can I do? This question is already addressed elsewhere, *Note Recursive Rules: Recursion.  -File: bison.info, Node: How Can I Reset the Parser, Next: Strings are Destroyed, Prev: Parser Stack Overflow, Up: FAQ +File: bison.info, Node: How Can I Reset the Parser, Next: Strings are Destroyed, Prev: Memory Exhausted, Up: FAQ -10.2 How Can I Reset the Parser +11.2 How Can I Reset the Parser =============================== The following phenomenon has several symptoms, resulting in the @@ -5978,7 +6933,7 @@ yyparse (char const *file) yyin = fopen (file, "r"); if (!yyin) exit (2); - /* One token only. */ + /* One token only. */ yylex (); if (fclose (yyin) != 0) exit (3); @@ -6022,9 +6977,9 @@ scanner's state, i.e., go back to the initial start condition, through a call to `BEGIN (0)'.  -File: bison.info, Node: Strings are Destroyed, Next: C++ Parsers, Prev: How Can I Reset the Parser, Up: FAQ +File: bison.info, Node: Strings are Destroyed, Next: Implementing Gotos/Loops, Prev: How Can I Reset the Parser, Up: FAQ -10.3 Strings are Destroyed +11.3 Strings are Destroyed ========================== My parser seems to destroy old strings, or maybe it loses track of @@ -6047,7 +7002,7 @@ char *yylval = NULL; int main () { - /* Similar to using $1, $2 in a Bison action. */ + /* Similar to using $1, $2 in a Bison action. */ char *fst = (yylex (), yylval); char *snd = (yylex (), yylval); printf ("\"%s\", \"%s\"\n", fst, snd); @@ -6075,35 +7030,13 @@ generates a different behavior: "two", "two"  -File: bison.info, Node: C++ Parsers, Next: Implementing Loops, Prev: Strings are Destroyed, Up: FAQ +File: bison.info, Node: Implementing Gotos/Loops, Prev: Strings are Destroyed, Up: FAQ -10.4 C++ Parsers -================ - - How can I generate parsers in C++? - - We are working on a C++ output for Bison, but unfortunately, for lack -of time, the skeleton is not finished. It is functional, but in -numerous respects, it will require additional work which _might_ break -backward compatibility. Since the skeleton for C++ is not documented, -we do not consider ourselves bound to this interface, nevertheless, as -much as possible we will try to keep compatibility. - - Another possibility is to use the regular C parsers, and to compile -them with a C++ compiler. This works properly, provided that you bear -some simple C++ rules in mind, such as not including "real classes" -(i.e., structure with constructors) in unions. Therefore, in the -`%union', use pointers to classes, or better yet, a single pointer type -to the root of your lexical/syntactic hierarchy. - - -File: bison.info, Node: Implementing Loops, Prev: C++ Parsers, Up: FAQ - -10.5 Implementing Loops -======================= +11.4 Implementing Gotos/Loops +============================= My simple calculator supports variables, assignments, and functions, - but how can I implement loops? + but how can I implement gotos, or loops? Although very pedagogical, the examples included in the document blur the distinction to make between the parser--whose job is to recover the @@ -6124,7 +7057,7 @@ will result in an interpreter or a compiler. invited to consult the dedicated literature.  -File: bison.info, Node: Table of Symbols, Next: Glossary, Prev: Invocation, Up: Top +File: bison.info, Node: Table of Symbols, Next: Glossary, Prev: FAQ, Up: Top Appendix A Bison Symbols ************************ @@ -6145,20 +7078,56 @@ Appendix A Bison Symbols In an action, the semantic value of the N-th symbol of the right-hand side of the rule. *Note Actions::. + -- Delimiter: %% + Delimiter used to separate the grammar rule section from the Bison + declarations section or the epilogue. *Note The Overall Layout of + a Bison Grammar: Grammar Layout. + + -- Delimiter: %{CODE%} + All code listed between `%{' and `%}' is copied directly to the + output file uninterpreted. Such code forms the prologue of the + input file. *Note Outline of a Bison Grammar: Grammar Outline. + + -- Construct: /*...*/ + Comment delimiters, as in C. + + -- Delimiter: : + Separates a rule's result from its components. *Note Syntax of + Grammar Rules: Rules. + + -- Delimiter: ; + Terminates a rule. *Note Syntax of Grammar Rules: Rules. + + -- Delimiter: | + Separates alternate rules for the same result nonterminal. *Note + Syntax of Grammar Rules: Rules. + -- Symbol: $accept The predefined nonterminal whose only rule is `$accept: START $end', where START is the start symbol. *Note The Start-Symbol: Start Decl. It cannot be used in the grammar. + -- Directive: %debug + Equip the parser for debugging. *Note Decl Summary::. + + -- Directive: %defines + Bison declaration to create a header file meant for the scanner. + *Note Decl Summary::. + + -- Directive: %destructor + Specify how the parser should reclaim the memory associated to + discarded symbols. *Note Freeing Discarded Symbols: Destructor + Decl. + + -- Directive: %dprec + Bison declaration to assign a precedence to a rule that is used at + parse time to resolve reduce/reduce conflicts. *Note Writing GLR + Parsers: GLR Parsers. + -- Symbol: $end The predefined token marking the end of the token stream. It cannot be used in the grammar. - -- Symbol: $undefined - The predefined token onto which all undefined values returned by - `yylex' are mapped. It cannot be used in the grammar, rather, use - `error'. - -- Symbol: error A token name reserved for error recovery. This token may be used in grammar rules so as to allow the Bison parser to recognize an @@ -6169,148 +7138,6 @@ Appendix A Bison Symbols the look-ahead token is reset to the token that originally caused the violation. *Note Error Recovery::. - -- Macro: YYABORT - Macro to pretend that an unrecoverable syntax error has occurred, - by making `yyparse' return 1 immediately. The error reporting - function `yyerror' is not called. *Note The Parser Function - `yyparse': Parser Function. - - -- Macro: YYACCEPT - Macro to pretend that a complete utterance of the language has been - read, by making `yyparse' return 0 immediately. *Note The Parser - Function `yyparse': Parser Function. - - -- Macro: YYBACKUP - Macro to discard a value from the parser stack and fake a - look-ahead token. *Note Special Features for Use in Actions: - Action Features. - - -- Macro: YYDEBUG - Macro to define to equip the parser with tracing code. *Note - Tracing Your Parser: Tracing. - - -- Macro: YYERROR - Macro to pretend that a syntax error has just been detected: call - `yyerror' and then perform normal error recovery if possible - (*note Error Recovery::), or (if recovery is impossible) make - `yyparse' return 1. *Note Error Recovery::. - - -- Macro: YYERROR_VERBOSE - An obsolete macro that you define with `#define' in the prologue - to request verbose, specific error message strings when `yyerror' - is called. It doesn't matter what definition you use for - `YYERROR_VERBOSE', just whether you define it. Using - `%error-verbose' is preferred. - - -- Macro: YYINITDEPTH - Macro for specifying the initial size of the parser stack. *Note - Stack Overflow::. - - -- Macro: YYLEX_PARAM - An obsolete macro for specifying an extra argument (or list of - extra arguments) for `yyparse' to pass to `yylex'. he use of this - macro is deprecated, and is supported only for Yacc like parsers. - *Note Calling Conventions for Pure Parsers: Pure Calling. - - -- Type: YYLTYPE - Data type of `yylloc'; by default, a structure with four members. - *Note Data Types of Locations: Location Type. - - -- Macro: YYMAXDEPTH - Macro for specifying the maximum size of the parser stack. *Note - Stack Overflow::. - - -- Macro: YYPARSE_PARAM - An obsolete macro for specifying the name of a parameter that - `yyparse' should accept. The use of this macro is deprecated, and - is supported only for Yacc like parsers. *Note Calling - Conventions for Pure Parsers: Pure Calling. - - -- Macro: YYRECOVERING - Macro whose value indicates whether the parser is recovering from a - syntax error. *Note Special Features for Use in Actions: Action - Features. - - -- Macro: YYSTACK_USE_ALLOCA - Macro used to control the use of `alloca'. If defined to `0', the - parser will not use `alloca' but `malloc' when trying to grow its - internal stacks. Do _not_ define `YYSTACK_USE_ALLOCA' to anything - else. - - -- Type: YYSTYPE - Data type of semantic values; `int' by default. *Note Data Types - of Semantic Values: Value Type. - - -- Variable: yychar - External integer variable that contains the integer value of the - current look-ahead token. (In a pure parser, it is a local - variable within `yyparse'.) Error-recovery rule actions may - examine this variable. *Note Special Features for Use in Actions: - Action Features. - - -- Variable: yyclearin - Macro used in error-recovery rule actions. It clears the previous - look-ahead token. *Note Error Recovery::. - - -- Variable: yydebug - External integer variable set to zero by default. If `yydebug' is - given a nonzero value, the parser will output information on input - symbols and parser action. *Note Tracing Your Parser: Tracing. - - -- Macro: yyerrok - Macro to cause parser to recover immediately to its normal mode - after a syntax error. *Note Error Recovery::. - - -- Function: yyerror - User-supplied function to be called by `yyparse' on error. *Note - The Error Reporting Function `yyerror': Error Reporting. - - -- Function: yylex - User-supplied lexical analyzer function, called with no arguments - to get the next token. *Note The Lexical Analyzer Function - `yylex': Lexical. - - -- Variable: yylval - External variable in which `yylex' should place the semantic value - associated with a token. (In a pure parser, it is a local - variable within `yyparse', and its address is passed to `yylex'.) - *Note Semantic Values of Tokens: Token Values. - - -- Variable: yylloc - External variable in which `yylex' should place the line and column - numbers associated with a token. (In a pure parser, it is a local - variable within `yyparse', and its address is passed to `yylex'.) - You can ignore this variable if you don't use the `@' feature in - the grammar actions. *Note Textual Locations of Tokens: Token - Locations. - - -- Variable: yynerrs - Global variable which Bison increments each time there is a syntax - error. (In a pure parser, it is a local variable within - `yyparse'.) *Note The Error Reporting Function `yyerror': Error - Reporting. - - -- Function: yyparse - The parser function produced by Bison; call this function to start - parsing. *Note The Parser Function `yyparse': Parser Function. - - -- Directive: %debug - Equip the parser for debugging. *Note Decl Summary::. - - -- Directive: %defines - Bison declaration to create a header file meant for the scanner. - *Note Decl Summary::. - - -- Directive: %destructor - Specifying how the parser should reclaim the memory associated to - discarded symbols. *Note Freeing Discarded Symbols: Destructor - Decl. - - -- Directive: %dprec - Bison declaration to assign a precedence to a rule that is used at - parse time to resolve reduce/reduce conflicts. *Note Writing GLR - Parsers: GLR Parsers. - -- Directive: %error-verbose Bison declaration to request verbose, specific error message strings when `yyerror' is called. @@ -6323,6 +7150,10 @@ Appendix A Bison Symbols Bison declaration to produce a GLR parser. *Note Writing GLR Parsers: GLR Parsers. + -- Directive: %initial-action + Run user code before parsing. *Note Performing Actions before + Parsing: Initial Action Decl. + -- Directive: %left Bison declaration to assign left associativity to token(s). *Note Operator Precedence: Precedence Decl. @@ -6351,7 +7182,7 @@ Appendix A Bison Symbols Bison declaration to assign non-associativity to token(s). *Note Operator Precedence: Precedence Decl. - -- Directive: %output="FILENAME" + -- Directive: %output="FILE" Bison declaration to set the name of the parser file. *Note Decl Summary::. @@ -6388,39 +7219,155 @@ Appendix A Bison Symbols Bison declaration to declare nonterminals. *Note Nonterminal Symbols: Type Decl. + -- Symbol: $undefined + The predefined token onto which all undefined values returned by + `yylex' are mapped. It cannot be used in the grammar, rather, use + `error'. + -- Directive: %union Bison declaration to specify several possible data types for semantic values. *Note The Collection of Value Types: Union Decl. + -- Macro: YYABORT + Macro to pretend that an unrecoverable syntax error has occurred, + by making `yyparse' return 1 immediately. The error reporting + function `yyerror' is not called. *Note The Parser Function + `yyparse': Parser Function. - These are the punctuation and delimiters used in Bison input: + -- Macro: YYACCEPT + Macro to pretend that a complete utterance of the language has been + read, by making `yyparse' return 0 immediately. *Note The Parser + Function `yyparse': Parser Function. - -- Delimiter: %% - Delimiter used to separate the grammar rule section from the Bison - declarations section or the epilogue. *Note The Overall Layout of - a Bison Grammar: Grammar Layout. + -- Macro: YYBACKUP + Macro to discard a value from the parser stack and fake a + look-ahead token. *Note Special Features for Use in Actions: + Action Features. - -- Delimiter: %{CODE%} - All code listed between `%{' and `%}' is copied directly to the - output file uninterpreted. Such code forms the prologue of the - input file. *Note Outline of a Bison Grammar: Grammar Outline. + -- Variable: yychar + External integer variable that contains the integer value of the + current look-ahead token. (In a pure parser, it is a local + variable within `yyparse'.) Error-recovery rule actions may + examine this variable. *Note Special Features for Use in Actions: + Action Features. - -- Construct: /*...*/ - Comment delimiters, as in C. + -- Variable: yyclearin + Macro used in error-recovery rule actions. It clears the previous + look-ahead token. *Note Error Recovery::. - -- Delimiter: : - Separates a rule's result from its components. *Note Syntax of - Grammar Rules: Rules. + -- Macro: YYDEBUG + Macro to define to equip the parser with tracing code. *Note + Tracing Your Parser: Tracing. - -- Delimiter: ; - Terminates a rule. *Note Syntax of Grammar Rules: Rules. + -- Variable: yydebug + External integer variable set to zero by default. If `yydebug' is + given a nonzero value, the parser will output information on input + symbols and parser action. *Note Tracing Your Parser: Tracing. - -- Delimiter: | - Separates alternate rules for the same result nonterminal. *Note - Syntax of Grammar Rules: Rules. + -- Macro: yyerrok + Macro to cause parser to recover immediately to its normal mode + after a syntax error. *Note Error Recovery::. + + -- Macro: YYERROR + Macro to pretend that a syntax error has just been detected: call + `yyerror' and then perform normal error recovery if possible + (*note Error Recovery::), or (if recovery is impossible) make + `yyparse' return 1. *Note Error Recovery::. + + -- Function: yyerror + User-supplied function to be called by `yyparse' on error. *Note + The Error Reporting Function `yyerror': Error Reporting. + + -- Macro: YYERROR_VERBOSE + An obsolete macro that you define with `#define' in the prologue + to request verbose, specific error message strings when `yyerror' + is called. It doesn't matter what definition you use for + `YYERROR_VERBOSE', just whether you define it. Using + `%error-verbose' is preferred. + + -- Macro: YYINITDEPTH + Macro for specifying the initial size of the parser stack. *Note + Memory Management::. + + -- Function: yylex + User-supplied lexical analyzer function, called with no arguments + to get the next token. *Note The Lexical Analyzer Function + `yylex': Lexical. + + -- Macro: YYLEX_PARAM + An obsolete macro for specifying an extra argument (or list of + extra arguments) for `yyparse' to pass to `yylex'. he use of this + macro is deprecated, and is supported only for Yacc like parsers. + *Note Calling Conventions for Pure Parsers: Pure Calling. + + -- Variable: yylloc + External variable in which `yylex' should place the line and column + numbers associated with a token. (In a pure parser, it is a local + variable within `yyparse', and its address is passed to `yylex'.) + You can ignore this variable if you don't use the `@' feature in + the grammar actions. *Note Textual Locations of Tokens: Token + Locations. + + -- Type: YYLTYPE + Data type of `yylloc'; by default, a structure with four members. + *Note Data Types of Locations: Location Type. + + -- Variable: yylval + External variable in which `yylex' should place the semantic value + associated with a token. (In a pure parser, it is a local + variable within `yyparse', and its address is passed to `yylex'.) + *Note Semantic Values of Tokens: Token Values. + + -- Macro: YYMAXDEPTH + Macro for specifying the maximum size of the parser stack. *Note + Memory Management::. + + -- Variable: yynerrs + Global variable which Bison increments each time there is a syntax + error. (In a pure parser, it is a local variable within + `yyparse'.) *Note The Error Reporting Function `yyerror': Error + Reporting. + + -- Function: yyparse + The parser function produced by Bison; call this function to start + parsing. *Note The Parser Function `yyparse': Parser Function. + + -- Macro: YYPARSE_PARAM + An obsolete macro for specifying the name of a parameter that + `yyparse' should accept. The use of this macro is deprecated, and + is supported only for Yacc like parsers. *Note Calling + Conventions for Pure Parsers: Pure Calling. + + -- Macro: YYRECOVERING + Macro whose value indicates whether the parser is recovering from a + syntax error. *Note Special Features for Use in Actions: Action + Features. + + -- Macro: YYSTACK_USE_ALLOCA + Macro used to control the use of `alloca' when the C LALR(1) + parser needs to extend its stacks. If defined to 0, the parser + will use `malloc' to extend its stacks. If defined to 1, the + parser will use `alloca'. Values other than 0 and 1 are reserved + for future Bison extensions. If not defined, `YYSTACK_USE_ALLOCA' + defaults to 0. + + If you define `YYSTACK_USE_ALLOCA' to 1, it is your responsibility + to make sure that `alloca' is visible, e.g., by using GCC or by + including `'. Furthermore, in the all-too-common case + where your code may run on a host with a limited stack and with + unreliable stack-overflow checking, you should set `YYMAXDEPTH' to + a value that cannot possibly result in unchecked stack overflow on + any of your target hosts when `alloca' is called. You can inspect + the code that Bison generates in order to determine the proper + numeric values. This will require some expertise in low-level + implementation details. + + -- Type: YYSTYPE + Data type of semantic values; `int' by default. *Note Data Types + of Semantic Values: Value Type.  -File: bison.info, Node: Glossary, Next: FAQ, Prev: Table of Symbols, Up: Top +File: bison.info, Node: Glossary, Next: Copying This Manual, Prev: Table of Symbols, Up: Top Appendix B Glossary ******************* @@ -6596,7 +7543,7 @@ Terminal symbol Grammar.  -File: bison.info, Node: Copying This Manual, Next: Index, Prev: FAQ, Up: Top +File: bison.info, Node: Copying This Manual, Next: Index, Prev: Glossary, Up: Top Appendix C Copying This Manual ****************************** @@ -6614,7 +7561,7 @@ C.1 GNU Free Documentation License Version 1.2, November 2002 Copyright (C) 2000,2001,2002 Free Software Foundation, Inc. - 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA + 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. @@ -7017,8 +7964,8 @@ notices just after the title page: Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.2 or any later version published by the Free Software Foundation; - with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts. - A copy of the license is included in the section entitled ``GNU + with no Invariant Sections, no Front-Cover Texts, and no Back-Cover + Texts. A copy of the license is included in the section entitled ``GNU Free Documentation License''. If you have Invariant Sections, Front-Cover Texts and Back-Cover @@ -7052,77 +7999,83 @@ Index * $$ <2>: Action Features. (line 10) * $$: Actions. (line 6) * $<: Action Features. (line 18) -* $accept: Table of Symbols. (line 23) -* $end: Table of Symbols. (line 28) +* $accept: Table of Symbols. (line 47) +* $end: Table of Symbols. (line 69) * $N: Actions. (line 6) -* $undefined: Table of Symbols. (line 32) -* %: Table of Symbols. (line 278) -* %%: Table of Symbols. (line 273) -* %debug <1>: Table of Symbols. (line 172) +* $undefined: Table of Symbols. (line 164) +* %: Table of Symbols. (line 28) +* %%: Table of Symbols. (line 23) +* %debug <1>: Table of Symbols. (line 52) * %debug <2>: Tracing. (line 23) * %debug: Decl Summary. (line 46) -* %defines <1>: Table of Symbols. (line 175) +* %defines <1>: Table of Symbols. (line 55) * %defines: Decl Summary. (line 51) -* %destructor <1>: Table of Symbols. (line 179) -* %destructor <2>: Decl Summary. (line 64) +* %destructor <1>: Table of Symbols. (line 59) +* %destructor <2>: Decl Summary. (line 79) * %destructor: Destructor Decl. (line 6) -* %dprec: Table of Symbols. (line 184) -* %error-verbose <1>: Table of Symbols. (line 189) +* %dprec <1>: Table of Symbols. (line 64) +* %dprec: Merging GLR Parses. (line 6) +* %error-verbose <1>: Table of Symbols. (line 83) * %error-verbose: Error Reporting. (line 17) * %expect <1>: Decl Summary. (line 38) * %expect: Expect Decl. (line 6) -* %expect-rr: Expect Decl. (line 6) -* %file-prefix=" <1>: Table of Symbols. (line 193) -* %file-prefix=": Decl Summary. (line 69) -* %glr-parser <1>: Table of Symbols. (line 197) +* %expect-rr <1>: Expect Decl. (line 6) +* %expect-rr: Simple GLR Parsers. (line 6) +* %file-prefix=" <1>: Table of Symbols. (line 87) +* %file-prefix=": Decl Summary. (line 84) +* %glr-parser <1>: Table of Symbols. (line 91) +* %glr-parser <2>: Simple GLR Parsers. (line 6) * %glr-parser: GLR Parsers. (line 6) -* %left <1>: Table of Symbols. (line 201) +* %initial-action <1>: Table of Symbols. (line 95) +* %initial-action: Initial Action Decl. (line 6) +* %left <1>: Table of Symbols. (line 99) * %left <2>: Using Precedence. (line 6) * %left: Decl Summary. (line 21) -* %lex-param <1>: Table of Symbols. (line 205) +* %lex-param <1>: Table of Symbols. (line 103) * %lex-param: Pure Calling. (line 31) -* %locations: Decl Summary. (line 73) -* %merge: Table of Symbols. (line 210) -* %name-prefix=" <1>: Table of Symbols. (line 217) -* %name-prefix=": Decl Summary. (line 80) -* %no-lines <1>: Table of Symbols. (line 221) -* %no-lines: Decl Summary. (line 98) -* %no-parser: Decl Summary. (line 89) -* %nonassoc <1>: Table of Symbols. (line 225) +* %locations: Decl Summary. (line 88) +* %merge <1>: Table of Symbols. (line 108) +* %merge: Merging GLR Parses. (line 6) +* %name-prefix=" <1>: Table of Symbols. (line 115) +* %name-prefix=": Decl Summary. (line 95) +* %no-lines <1>: Table of Symbols. (line 119) +* %no-lines: Decl Summary. (line 113) +* %no-parser: Decl Summary. (line 104) +* %nonassoc <1>: Table of Symbols. (line 123) * %nonassoc <2>: Using Precedence. (line 6) * %nonassoc: Decl Summary. (line 25) -* %output=" <1>: Table of Symbols. (line 229) -* %output=": Decl Summary. (line 106) -* %parse-param <1>: Table of Symbols. (line 233) -* %parse-param: Parser Function. (line 32) -* %prec <1>: Table of Symbols. (line 238) +* %output=" <1>: Table of Symbols. (line 127) +* %output=": Decl Summary. (line 121) +* %parse-param <1>: Table of Symbols. (line 131) +* %parse-param: Parser Function. (line 36) +* %prec <1>: Table of Symbols. (line 136) * %prec: Contextual Precedence. (line 6) -* %pure-parser <1>: Table of Symbols. (line 242) -* %pure-parser <2>: Decl Summary. (line 109) +* %pure-parser <1>: Table of Symbols. (line 140) +* %pure-parser <2>: Decl Summary. (line 124) * %pure-parser: Pure Decl. (line 6) -* %right <1>: Table of Symbols. (line 246) +* %right <1>: Table of Symbols. (line 144) * %right <2>: Using Precedence. (line 6) * %right: Decl Summary. (line 17) -* %start <1>: Table of Symbols. (line 250) +* %start <1>: Table of Symbols. (line 148) * %start <2>: Decl Summary. (line 34) * %start: Start Decl. (line 6) -* %token <1>: Table of Symbols. (line 254) +* %token <1>: Table of Symbols. (line 152) * %token <2>: Decl Summary. (line 13) * %token: Token Decl. (line 6) -* %token-table <1>: Table of Symbols. (line 258) -* %token-table: Decl Summary. (line 113) -* %type <1>: Table of Symbols. (line 262) +* %token-table <1>: Table of Symbols. (line 156) +* %token-table: Decl Summary. (line 128) +* %type <1>: Table of Symbols. (line 160) * %type <2>: Decl Summary. (line 30) * %type: Type Decl. (line 6) -* %union <1>: Table of Symbols. (line 266) +* %union <1>: Table of Symbols. (line 169) * %union <2>: Decl Summary. (line 9) * %union: Union Decl. (line 6) -* %verbose: Decl Summary. (line 147) -* %yacc: Decl Summary. (line 153) -* /*: Table of Symbols. (line 283) -* :: Table of Symbols. (line 286) -* ;: Table of Symbols. (line 290) +* %verbose: Decl Summary. (line 161) +* %yacc: Decl Summary. (line 167) +* /*: Table of Symbols. (line 33) +* :: Table of Symbols. (line 36) +* ;: Table of Symbols. (line 40) * @$ <1>: Table of Symbols. (line 7) * @$ <2>: Action Features. (line 80) * @$: Actions and Locations. @@ -7131,7 +8084,8 @@ Index * @N <2>: Action Features. (line 86) * @N: Actions and Locations. (line 6) -* abstract syntax tree: Implementing Loops. (line 17) +* abstract syntax tree: Implementing Gotos/Loops. + (line 17) * action: Actions. (line 6) * action data types: Action Types. (line 6) * action features summary: Action Features. (line 6) @@ -7146,9 +8100,11 @@ Index * ambiguous grammars: Language and Grammar. (line 33) * associativity: Why Precedence. (line 33) -* AST: Implementing Loops. (line 17) +* AST: Implementing Gotos/Loops. + (line 17) * Backus-Naur form: Language and Grammar. (line 16) +* begin on location: C++ Location Values. (line 44) * Bison declaration summary: Decl Summary. (line 6) * Bison declarations: Declarations. (line 6) * Bison declarations (introduction): Bison Declarations. (line 6) @@ -7158,6 +8114,14 @@ Index * Bison parser algorithm: Algorithm. (line 6) * Bison symbols, table of: Table of Symbols. (line 6) * Bison utility: Bison Parser. (line 6) +* bison-i18n.m4: Internationalization. + (line 20) +* bison-po: Internationalization. + (line 6) +* BISON_I18N: Internationalization. + (line 27) +* BISON_LOCALEDIR: Internationalization. + (line 27) * BNF: Language and Grammar. (line 16) * C code, section for additional: Epilogue. (line 6) @@ -7169,8 +8133,13 @@ Index * calculator, multi-function: Multi-function Calc. (line 6) * calculator, simple: RPN Calc. (line 6) * character token: Symbols. (line 31) +* column on position: C++ Location Values. (line 25) +* columns on location: C++ Location Values. (line 48) +* columns on position: C++ Location Values. (line 28) * compiling the parser: Rpcalc Compile. (line 6) * conflicts <1>: Shift/Reduce. (line 6) +* conflicts <2>: Merging GLR Parses. (line 6) +* conflicts <3>: Simple GLR Parsers. (line 6) * conflicts: GLR Parsers. (line 6) * conflicts, reduce/reduce: Reduce/Reduce. (line 6) * conflicts, suppressing warnings of: Expect Decl. (line 6) @@ -7184,6 +8153,10 @@ Index * data type of locations: Location Type. (line 6) * data types in actions: Action Types. (line 6) * data types of semantic values: Value Type. (line 6) +* debug_level on parser: C++ Parser Interface. + (line 31) +* debug_stream on parser: C++ Parser Interface. + (line 26) * debugging: Tracing. (line 6) * declaration summary: Decl Summary. (line 6) * declarations: Prologue. (line 6) @@ -7199,13 +8172,17 @@ Index * default action: Actions. (line 56) * default data type: Value Type. (line 6) * default location type: Location Type. (line 6) -* default stack limit: Stack Overflow. (line 27) +* default stack limit: Memory Management. (line 30) * default start symbol: Start Decl. (line 6) * defining language semantics: Semantics. (line 6) +* discarded symbols: Destructor Decl. (line 57) * else, dangling: Shift/Reduce. (line 6) +* end on location: C++ Location Values. (line 45) * epilogue: Epilogue. (line 6) -* error <1>: Table of Symbols. (line 37) +* error <1>: Table of Symbols. (line 73) * error: Error Recovery. (line 20) +* error on parser: C++ Parser Interface. + (line 37) * error recovery: Error Recovery. (line 6) * error recovery, simple: Simple Error Recovery. (line 6) @@ -7216,6 +8193,7 @@ Index * FDL, GNU Free Documentation License: GNU Free Documentation License. (line 6) * file format: Grammar Layout. (line 6) +* file on position: C++ Location Values. (line 13) * finite-state machine: Parser States. (line 6) * formal grammar: Grammar in Bison. (line 6) * format of grammar file: Grammar Layout. (line 6) @@ -7226,13 +8204,22 @@ Index * generalized LR (GLR) parsing <2>: GLR Parsers. (line 6) * generalized LR (GLR) parsing: Language and Grammar. (line 33) +* generalized LR (GLR) parsing, ambiguous grammars: Merging GLR Parses. + (line 6) +* generalized LR (GLR) parsing, unambiguous grammars: Simple GLR Parsers. + (line 6) +* gettext: Internationalization. + (line 6) * glossary: Glossary. (line 6) -* GLR parsers and inline: GLR Parsers. (line 150) +* GLR parsers and inline: Compiler Requirements. + (line 6) * GLR parsing <1>: Generalized LR Parsing. (line 6) * GLR parsing <2>: GLR Parsers. (line 6) * GLR parsing: Language and Grammar. (line 33) +* GLR parsing, ambiguous grammars: Merging GLR Parses. (line 6) +* GLR parsing, unambiguous grammars: Simple GLR Parsers. (line 6) * grammar file: Grammar Layout. (line 6) * grammar rule syntax: Rules. (line 6) * grammar rules section: Grammar Rules. (line 6) @@ -7241,9 +8228,14 @@ Index (line 6) * grouping, syntactic: Language and Grammar. (line 47) -* incline: GLR Parsers. (line 150) +* i18n: Internationalization. + (line 6) * infix notation calculator: Infix Calc. (line 6) +* inline: Compiler Requirements. + (line 6) * interface: Interface. (line 6) +* internationalization: Internationalization. + (line 6) * introduction: Introduction. (line 6) * invoking Bison: Invocation. (line 6) * item: Understanding. (line 107) @@ -7260,6 +8252,9 @@ Index * lexical analyzer, purpose: Bison Parser. (line 6) * lexical analyzer, writing: Rpcalc Lexer. (line 6) * lexical tie-in: Lexical Tie-ins. (line 6) +* line on position: C++ Location Values. (line 19) +* lines on location: C++ Location Values. (line 49) +* lines on position: C++ Location Values. (line 22) * literal string token: Symbols. (line 53) * literal token: Symbols. (line 31) * location <1>: Locations. (line 6) @@ -7270,6 +8265,8 @@ Index (line 6) * location, textual <1>: Locations. (line 6) * location, textual: Locations Overview. (line 6) +* location_value_type: C++ Parser Interface. + (line 16) * look-ahead token: Look-Ahead. (line 6) * LR(1): Mystery Conflicts. (line 36) * LR(1) grammars: Language and Grammar. @@ -7277,11 +8274,15 @@ Index * ltcalc: Location Tracking Calc. (line 6) * main function in simple example: Rpcalc Main. (line 6) +* memory exhaustion: Memory Management. (line 6) +* memory management: Memory Management. (line 6) * mfcalc: Multi-function Calc. (line 6) * mid-rule actions: Mid-Rule Actions. (line 6) * multi-function calculator: Multi-function Calc. (line 6) * multicharacter literal: Symbols. (line 53) * mutual recursion: Recursion. (line 32) +* NLS: Internationalization. + (line 6) * non-deterministic parsing <1>: Generalized LR Parsing. (line 6) * non-deterministic parsing: Language and Grammar. @@ -7290,12 +8291,23 @@ Index * nonterminal, useless: Understanding. (line 62) * operator precedence: Precedence. (line 6) * operator precedence, declaring: Precedence Decl. (line 6) +* operator+ on location: C++ Location Values. (line 53) +* operator+ on position: C++ Location Values. (line 33) +* operator+= on location: C++ Location Values. (line 57) +* operator+= on position: C++ Location Values. (line 31) +* operator- on position: C++ Location Values. (line 36) +* operator-= on position: C++ Location Values. (line 35) +* operator<< on position: C++ Location Values. (line 40) * options for invoking Bison: Invocation. (line 6) -* overflow of parser stack: Stack Overflow. (line 6) +* overflow of parser stack: Memory Management. (line 6) * parse error: Error Reporting. (line 6) +* parse on parser: C++ Parser Interface. + (line 23) * parser: Bison Parser. (line 6) +* parser on parser: C++ Parser Interface. + (line 19) * parser stack: Algorithm. (line 6) -* parser stack overflow: Stack Overflow. (line 6) +* parser stack overflow: Memory Management. (line 6) * parser state: Parser States. (line 6) * pointed rule: Understanding. (line 107) * polish notation calculator: RPN Calc. (line 6) @@ -7312,6 +8324,9 @@ Index * recovery from errors: Error Recovery. (line 6) * recursive rule: Recursion. (line 6) * reduce/reduce conflict: Reduce/Reduce. (line 6) +* reduce/reduce conflicts <1>: Merging GLR Parses. (line 6) +* reduce/reduce conflicts <2>: Simple GLR Parsers. (line 6) +* reduce/reduce conflicts: GLR Parsers. (line 6) * reduction: Algorithm. (line 6) * reentrant parser: Pure Decl. (line 6) * reverse polish notation: RPN Calc. (line 6) @@ -7325,18 +8340,26 @@ Index * semantic actions: Semantic Actions. (line 6) * semantic value: Semantic Values. (line 6) * semantic value type: Value Type. (line 6) +* semantic_value_type: C++ Parser Interface. + (line 15) +* set_debug_level on parser: C++ Parser Interface. + (line 32) +* set_debug_stream on parser: C++ Parser Interface. + (line 27) * shift/reduce conflicts <1>: Shift/Reduce. (line 6) +* shift/reduce conflicts <2>: Simple GLR Parsers. (line 6) * shift/reduce conflicts: GLR Parsers. (line 6) * shifting: Algorithm. (line 6) * simple examples: Examples. (line 6) * single-character literal: Symbols. (line 31) -* stack overflow: Stack Overflow. (line 6) +* stack overflow: Memory Management. (line 6) * stack, parser: Algorithm. (line 6) * stages in using Bison: Stages. (line 6) * start symbol: Language and Grammar. (line 96) * start symbol, declaring: Start Decl. (line 6) * state (of parser): Parser States. (line 6) +* step on location: C++ Location Values. (line 60) * string token: Symbols. (line 53) * summary, action features: Action Features. (line 6) * summary, Bison declaration: Decl Summary. (line 6) @@ -7371,178 +8394,200 @@ Index * value, semantic: Semantic Values. (line 6) * warnings, preventing: Expect Decl. (line 6) * writing a lexical analyzer: Rpcalc Lexer. (line 6) -* YYABORT <1>: Table of Symbols. (line 47) -* YYABORT: Parser Function. (line 25) +* YYABORT <1>: Table of Symbols. (line 173) +* YYABORT: Parser Function. (line 29) * YYABORT;: Action Features. (line 28) -* YYACCEPT <1>: Table of Symbols. (line 53) -* YYACCEPT: Parser Function. (line 22) +* YYACCEPT <1>: Table of Symbols. (line 179) +* YYACCEPT: Parser Function. (line 26) * YYACCEPT;: Action Features. (line 32) -* YYBACKUP <1>: Table of Symbols. (line 58) +* YYBACKUP <1>: Table of Symbols. (line 184) * YYBACKUP: Action Features. (line 36) -* yychar <1>: Table of Symbols. (line 119) +* yychar <1>: Table of Symbols. (line 189) * yychar <2>: Look-Ahead. (line 47) * yychar: Action Features. (line 65) -* yyclearin <1>: Table of Symbols. (line 126) +* yyclearin <1>: Table of Symbols. (line 196) * yyclearin: Error Recovery. (line 97) * yyclearin;: Action Features. (line 71) -* yydebug: Table of Symbols. (line 130) -* YYDEBUG <1>: Table of Symbols. (line 63) +* yydebug: Table of Symbols. (line 204) +* YYDEBUG <1>: Table of Symbols. (line 200) * YYDEBUG: Tracing. (line 12) * yydebug: Tracing. (line 6) * YYEMPTY: Action Features. (line 49) -* yyerrok <1>: Table of Symbols. (line 135) +* YYENABLE_NLS: Internationalization. + (line 27) +* yyerrok <1>: Table of Symbols. (line 209) * yyerrok: Error Recovery. (line 92) * yyerrok;: Action Features. (line 75) -* yyerror: Table of Symbols. (line 139) -* YYERROR <1>: Table of Symbols. (line 67) +* yyerror: Table of Symbols. (line 219) +* YYERROR <1>: Table of Symbols. (line 213) * YYERROR: Action Features. (line 52) * yyerror: Error Reporting. (line 6) * YYERROR;: Action Features. (line 52) -* YYERROR_VERBOSE: Table of Symbols. (line 73) -* YYINITDEPTH <1>: Table of Symbols. (line 80) -* YYINITDEPTH: Stack Overflow. (line 29) -* yylex <1>: Table of Symbols. (line 143) +* YYERROR_VERBOSE: Table of Symbols. (line 223) +* YYINITDEPTH <1>: Table of Symbols. (line 230) +* YYINITDEPTH: Memory Management. (line 32) +* yylex <1>: Table of Symbols. (line 234) * yylex: Lexical. (line 6) -* YYLEX_PARAM: Table of Symbols. (line 84) -* yylloc <1>: Table of Symbols. (line 154) +* yylex on parser: C++ Scanner Interface. + (line 12) +* YYLEX_PARAM: Table of Symbols. (line 239) +* yylloc <1>: Table of Symbols. (line 245) * yylloc: Token Locations. (line 6) * YYLLOC_DEFAULT: Location Default Action. (line 6) -* YYLTYPE <1>: Table of Symbols. (line 90) +* YYLTYPE <1>: Table of Symbols. (line 253) * YYLTYPE: Token Locations. (line 19) -* yylval <1>: Table of Symbols. (line 148) +* yylval <1>: Table of Symbols. (line 257) * yylval: Token Values. (line 6) -* YYMAXDEPTH <1>: Table of Symbols. (line 94) -* YYMAXDEPTH: Stack Overflow. (line 14) -* yynerrs <1>: Table of Symbols. (line 162) -* yynerrs: Error Reporting. (line 88) -* yyparse <1>: Table of Symbols. (line 168) +* YYMAXDEPTH <1>: Table of Symbols. (line 263) +* YYMAXDEPTH: Memory Management. (line 14) +* yynerrs <1>: Table of Symbols. (line 267) +* yynerrs: Error Reporting. (line 92) +* yyparse <1>: Table of Symbols. (line 273) * yyparse: Parser Function. (line 6) -* YYPARSE_PARAM: Table of Symbols. (line 98) +* YYPARSE_PARAM: Table of Symbols. (line 277) * YYPRINT: Tracing. (line 71) -* YYRECOVERING <1>: Table of Symbols. (line 104) +* YYRECOVERING <1>: Table of Symbols. (line 283) * YYRECOVERING <2>: Error Recovery. (line 108) * YYRECOVERING: Action Features. (line 60) -* YYSTACK_USE_ALLOCA: Table of Symbols. (line 109) -* YYSTYPE: Table of Symbols. (line 115) -* | <1>: Table of Symbols. (line 293) +* YYSTACK_USE_ALLOCA: Table of Symbols. (line 288) +* YYSTYPE: Table of Symbols. (line 307) +* | <1>: Table of Symbols. (line 43) * |: Rules. (line 34)  Tag Table: -Node: Top1104 -Node: Introduction10643 -Node: Conditions11916 -Node: Copying13805 -Node: Concepts32975 -Node: Language and Grammar34128 -Node: Grammar in Bison40019 -Node: Semantic Values41948 -Node: Semantic Actions44054 -Node: GLR Parsers45241 -Node: Locations Overview51439 -Node: Bison Parser52892 -Node: Stages55612 -Node: Grammar Layout56900 -Node: Examples58232 -Node: RPN Calc59431 -Node: Rpcalc Decls60410 -Node: Rpcalc Rules62331 -Node: Rpcalc Input64138 -Node: Rpcalc Line65613 -Node: Rpcalc Expr66741 -Node: Rpcalc Lexer68699 -Node: Rpcalc Main71286 -Node: Rpcalc Error71693 -Node: Rpcalc Gen72721 -Node: Rpcalc Compile73861 -Node: Infix Calc74735 -Node: Simple Error Recovery77498 -Node: Location Tracking Calc79393 -Node: Ltcalc Decls80080 -Node: Ltcalc Rules81033 -Node: Ltcalc Lexer83042 -Node: Multi-function Calc85365 -Node: Mfcalc Decl86937 -Node: Mfcalc Rules88976 -Node: Mfcalc Symtab90357 -Node: Exercises96533 -Node: Grammar File97047 -Node: Grammar Outline97896 -Node: Prologue98656 -Node: Bison Declarations99937 -Node: Grammar Rules100352 -Node: Epilogue100823 -Node: Symbols101839 -Node: Rules108544 -Node: Recursion110185 -Node: Semantics111903 -Node: Value Type113002 -Node: Multiple Types113669 -Node: Actions114699 -Node: Action Types118203 -Node: Mid-Rule Actions119515 -Node: Locations125089 -Node: Location Type125740 -Node: Actions and Locations126332 -Node: Location Default Action128592 -Node: Declarations131104 -Node: Token Decl132477 -Node: Precedence Decl134564 -Node: Union Decl136124 -Node: Type Decl137266 -Node: Destructor Decl138188 -Node: Expect Decl140312 -Node: Start Decl142340 -Node: Pure Decl142728 -Node: Decl Summary144414 -Node: Multiple Parsers150689 -Node: Interface152198 -Node: Parser Function153062 -Node: Lexical154899 -Node: Calling Convention156310 -Node: Token Values159187 -Node: Token Locations160352 -Node: Pure Calling161246 -Node: Error Reporting163101 -Node: Action Features167024 -Node: Algorithm170514 -Node: Look-Ahead172877 -Node: Shift/Reduce175009 -Node: Precedence177906 -Node: Why Precedence178562 -Node: Using Precedence180436 -Node: Precedence Examples181413 -Node: How Precedence182123 -Node: Contextual Precedence183282 -Node: Parser States185078 -Node: Reduce/Reduce186326 -Node: Mystery Conflicts189867 -Node: Generalized LR Parsing193260 -Node: Stack Overflow197878 -Node: Error Recovery199751 -Node: Context Dependency205049 -Node: Semantic Tokens205898 -Node: Lexical Tie-ins208915 -Node: Tie-in Recovery210492 -Node: Debugging212669 -Node: Understanding213335 -Node: Tracing224426 -Node: Invocation228510 -Node: Bison Options229877 -Node: Option Cross Key234139 -Node: Yacc Library235012 -Node: FAQ235837 -Node: Parser Stack Overflow236390 -Node: How Can I Reset the Parser236720 -Node: Strings are Destroyed239000 -Node: C++ Parsers240571 -Node: Implementing Loops241556 -Node: Table of Symbols242770 -Node: Glossary253936 -Node: Copying This Manual260821 -Node: GNU Free Documentation License261047 -Node: Index283454 +Node: Top1110 +Node: Introduction11831 +Node: Conditions13101 +Node: Copying14990 +Node: Concepts34168 +Node: Language and Grammar35322 +Node: Grammar in Bison41216 +Node: Semantic Values43145 +Node: Semantic Actions45251 +Node: GLR Parsers46438 +Node: Simple GLR Parsers49121 +Node: Merging GLR Parses55776 +Node: Compiler Requirements60346 +Node: Locations Overview61080 +Node: Bison Parser62533 +Node: Stages65345 +Node: Grammar Layout66633 +Node: Examples67965 +Node: RPN Calc69164 +Node: Rpcalc Decls70143 +Node: Rpcalc Rules72064 +Node: Rpcalc Input73871 +Node: Rpcalc Line75346 +Node: Rpcalc Expr76474 +Node: Rpcalc Lexer78441 +Node: Rpcalc Main81028 +Node: Rpcalc Error81435 +Node: Rpcalc Gen82463 +Node: Rpcalc Compile83593 +Node: Infix Calc84467 +Node: Simple Error Recovery87230 +Node: Location Tracking Calc89125 +Node: Ltcalc Decls89812 +Node: Ltcalc Rules90765 +Node: Ltcalc Lexer92774 +Node: Multi-function Calc95097 +Node: Mfcalc Decl96669 +Node: Mfcalc Rules98708 +Node: Mfcalc Symtab100089 +Node: Exercises106262 +Node: Grammar File106776 +Node: Grammar Outline107625 +Node: Prologue108385 +Node: Bison Declarations109666 +Node: Grammar Rules110081 +Node: Epilogue110552 +Node: Symbols111568 +Node: Rules118273 +Node: Recursion119914 +Node: Semantics121632 +Node: Value Type122731 +Node: Multiple Types123398 +Node: Actions124428 +Node: Action Types127932 +Node: Mid-Rule Actions129244 +Node: Locations134818 +Node: Location Type135469 +Node: Actions and Locations136061 +Node: Location Default Action138321 +Node: Declarations141763 +Node: Token Decl143193 +Node: Precedence Decl145280 +Node: Union Decl146840 +Node: Type Decl147982 +Node: Initial Action Decl148908 +Node: Destructor Decl149690 +Node: Expect Decl152263 +Node: Start Decl154291 +Node: Pure Decl154679 +Node: Decl Summary156365 +Node: Multiple Parsers163438 +Node: Interface164947 +Node: Parser Function165920 +Node: Lexical167904 +Node: Calling Convention169315 +Node: Token Values172275 +Node: Token Locations173440 +Node: Pure Calling174334 +Node: Error Reporting176189 +Node: Action Features180309 +Node: Internationalization183828 +Node: Algorithm186369 +Node: Look-Ahead188736 +Node: Shift/Reduce190868 +Node: Precedence193765 +Node: Why Precedence194421 +Node: Using Precedence196295 +Node: Precedence Examples197272 +Node: How Precedence197982 +Node: Contextual Precedence199141 +Node: Parser States200937 +Node: Reduce/Reduce202185 +Node: Mystery Conflicts205726 +Node: Generalized LR Parsing209435 +Node: Memory Management214058 +Node: Error Recovery216271 +Node: Context Dependency221569 +Node: Semantic Tokens222418 +Node: Lexical Tie-ins225488 +Node: Tie-in Recovery227065 +Node: Debugging229242 +Node: Understanding229908 +Node: Tracing241054 +Node: Invocation245138 +Node: Bison Options246544 +Node: Option Cross Key250830 +Node: Yacc Library251726 +Node: C++ Language Interface252551 +Node: C++ Parsers252839 +Node: C++ Bison Interface253297 +Node: C++ Semantic Values254414 +Ref: C++ Semantic Values-Footnote-1255311 +Node: C++ Location Values255447 +Node: C++ Parser Interface257822 +Node: C++ Scanner Interface259544 +Node: A Complete C++ Example260211 +Node: Calc++ --- C++ Calculator261150 +Node: Calc++ Parsing Driver261661 +Node: Calc++ Parser265635 +Node: Calc++ Scanner268780 +Node: Calc++ Top Level271324 +Node: FAQ271991 +Node: Memory Exhausted272487 +Node: How Can I Reset the Parser272797 +Node: Strings are Destroyed275073 +Node: Implementing Gotos/Loops276658 +Node: Table of Symbols277910 +Node: Glossary289938 +Node: Copying This Manual296839 +Node: GNU Free Documentation License297070 +Node: Index319479  End Tag Table diff --git a/src/bin/bison/doc/bison.texinfo b/src/bin/bison/doc/bison.texinfo index f01c638a88..c384d2d416 100644 --- a/src/bin/bison/doc/bison.texinfo +++ b/src/bin/bison/doc/bison.texinfo @@ -44,12 +44,12 @@ This manual is for @acronym{GNU} Bison (version @value{VERSION}, @value{UPDATED}), the @acronym{GNU} parser generator. Copyright @copyright{} 1988, 1989, 1990, 1991, 1992, 1993, 1995, 1998, -1999, 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc. +1999, 2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc. @quotation Permission is granted to copy, distribute and/or modify this document under the terms of the @acronym{GNU} Free Documentation License, -Version 1.1 or any later version published by the Free Software +Version 1.2 or any later version published by the Free Software Foundation; with no Invariant Sections, with the Front-Cover texts being ``A @acronym{GNU} Manual,'' and with the Back-Cover Texts as in (a) below. A copy of the license is included in the section entitled @@ -62,7 +62,7 @@ Copies published by the Free Software Foundation raise funds for @end quotation @end copying -@dircategory GNU programming tools +@dircategory Software development @direntry * bison: (bison). @acronym{GNU} parser generator (Yacc replacement). @end direntry @@ -82,8 +82,8 @@ Copies published by the Free Software Foundation raise funds for @insertcopying @sp 2 Published by the Free Software Foundation @* -59 Temple Place, Suite 330 @* -Boston, MA 02111-1307 USA @* +51 Franklin Street, Fifth Floor @* +Boston, MA 02110-1301 USA @* Printed copies are available from the Free Software Foundation.@* @acronym{ISBN} 1-882114-44-2 @sp 2 @@ -117,9 +117,10 @@ Reference sections: messy for Bison to handle straightforwardly. * Debugging:: Understanding or debugging Bison parsers. * Invocation:: How to run Bison (to produce the parser source file). +* C++ Language Interface:: Creating C++ parser objects. +* FAQ:: Frequently Asked Questions * Table of Symbols:: All the keywords of the Bison language are explained. * Glossary:: Basic concepts are explained. -* FAQ:: Frequently Asked Questions * Copying This Manual:: License for copying this manual. * Index:: Cross-references to the text. @@ -135,13 +136,19 @@ The Concepts of Bison a semantic value (the value of an integer, the name of an identifier, etc.). * Semantic Actions:: Each rule can have an action containing C code. -* GLR Parsers:: Writing parsers for general context-free languages +* GLR Parsers:: Writing parsers for general context-free languages. * Locations Overview:: Tracking Locations. * Bison Parser:: What are Bison's input and output, how is the output used? * Stages:: Stages in writing and running Bison grammars. * Grammar Layout:: Overall structure of a Bison grammar file. +Writing @acronym{GLR} Parsers + +* Simple GLR Parsers:: Using @acronym{GLR} parsers on unambiguous grammars +* Merging GLR Parses:: Using @acronym{GLR} parsers to resolve ambiguities +* Compiler Requirements:: @acronym{GLR} parsers require a modern C compiler + Examples * RPN Calc:: Reverse polish notation calculator; @@ -222,6 +229,7 @@ Bison Declarations * Precedence Decl:: Declaring terminals with precedence and associativity. * Union Decl:: Declaring the set of all semantic value types. * Type Decl:: Declaring the choice of type for a nonterminal symbol. +* Initial Action Decl:: Code run before parsing starts. * Destructor Decl:: Declaring how symbols are freed. * Expect Decl:: Suppressing warnings about parsing conflicts. * Start Decl:: Specifying the start symbol. @@ -235,6 +243,8 @@ Parser C-Language Interface which reads tokens. * Error Reporting:: You must supply a function @code{yyerror}. * Action Features:: Special features for use in actions. +* Internationalization:: How to let the parser speak in the user's + native language. The Lexical Analyzer Function @code{yylex} @@ -257,7 +267,7 @@ The Bison Parser Algorithm * Reduce/Reduce:: When two rules are applicable in the same situation. * Mystery Conflicts:: Reduce/reduce conflicts that look unjustified. * Generalized LR Parsing:: Parsing arbitrary context-free grammars. -* Stack Overflow:: What happens when stack gets full. How to avoid it. +* Memory Management:: What happens when memory is exhausted. How to avoid it. Operator Precedence @@ -285,13 +295,33 @@ Invoking Bison * Option Cross Key:: Alphabetical list of long options. * Yacc Library:: Yacc-compatible @code{yylex} and @code{main}. +C++ Language Interface + +* C++ Parsers:: The interface to generate C++ parser classes +* A Complete C++ Example:: Demonstrating their use + +C++ Parsers + +* C++ Bison Interface:: Asking for C++ parser generation +* C++ Semantic Values:: %union vs. C++ +* C++ Location Values:: The position and location classes +* C++ Parser Interface:: Instantiating and running the parser +* C++ Scanner Interface:: Exchanges between yylex and parse + +A Complete C++ Example + +* Calc++ --- C++ Calculator:: The specifications +* Calc++ Parsing Driver:: An active parsing context +* Calc++ Parser:: A parser class +* Calc++ Scanner:: A pure C++ Flex scanner +* Calc++ Top Level:: Conducting the band + Frequently Asked Questions -* Parser Stack Overflow:: Breaking the Stack Limits +* Memory Exhausted:: Breaking the Stack Limits * How Can I Reset the Parser:: @code{yyparse} Keeps some State * Strings are Destroyed:: @code{yylval} Loses Track of Strings -* C++ Parsers:: Compiling Parsers with C++ Compilers -* Implementing Loops:: Control Flow in the Calculator +* Implementing Gotos/Loops:: Control Flow in the Calculator Copying This Manual @@ -381,7 +411,7 @@ use Bison or Yacc, we suggest you start by reading this chapter carefully. a semantic value (the value of an integer, the name of an identifier, etc.). * Semantic Actions:: Each rule can have an action containing C code. -* GLR Parsers:: Writing parsers for general context-free languages +* GLR Parsers:: Writing parsers for general context-free languages. * Locations Overview:: Tracking Locations. * Bison Parser:: What are Bison's input and output, how is the output used? @@ -437,7 +467,7 @@ roughly that the next grammar rule to apply at any point in the input is uniquely determined by the preceding input and a fixed, finite portion (called a @dfn{look-ahead}) of the remaining input. A context-free grammar can be @dfn{ambiguous}, meaning that there are multiple ways to -apply the grammar rules to get the some inputs. Even unambiguous +apply the grammar rules to get the same inputs. Even unambiguous grammars can be @dfn{non-deterministic}, meaning that no fixed look-ahead always suffices to determine the next grammar rule to apply. With the proper declarations, Bison is also able to parse these more @@ -473,7 +503,7 @@ Here is a simple C function subdivided into tokens: @ifinfo @example int /* @r{keyword `int'} */ -square (int x) /* @r{identifier, open-paren, identifier,} +square (int x) /* @r{identifier, open-paren, keyword `int',} @r{identifier, close-paren} */ @{ /* @r{open-brace} */ return x * x; /* @r{keyword `return', identifier, asterisk, @@ -484,7 +514,7 @@ square (int x) /* @r{identifier, open-paren, identifier,} @ifnotinfo @example int /* @r{keyword `int'} */ -square (int x) /* @r{identifier, open-paren, identifier, identifier, close-paren} */ +square (int x) /* @r{identifier, open-paren, keyword `int', identifier, close-paren} */ @{ /* @r{open-brace} */ return x * x; /* @r{keyword `return', identifier, asterisk, identifier, semicolon} */ @} /* @r{close-brace} */ @@ -659,8 +689,9 @@ from the values of the two subexpressions. @findex %glr-parser @cindex conflicts @cindex shift/reduce conflicts +@cindex reduce/reduce conflicts -In some grammars, there will be cases where Bison's standard +In some grammars, Bison's standard @acronym{LALR}(1) parsing algorithm cannot decide whether to apply a certain grammar rule at a given point. That is, it may not be able to decide (on the basis of the input read so far) which of two possible @@ -673,7 +704,7 @@ input. These are known respectively as @dfn{reduce/reduce} conflicts To use a grammar that is not easily modified to be @acronym{LALR}(1), a more general parsing algorithm is sometimes necessary. If you include @code{%glr-parser} among the Bison declarations in your file -(@pxref{Grammar Outline}), the result will be a Generalized @acronym{LR} +(@pxref{Grammar Outline}), the result is a Generalized @acronym{LR} (@acronym{GLR}) parser. These parsers handle Bison grammars that contain no unresolved conflicts (i.e., after applying precedence declarations) identically to @acronym{LALR}(1) parsers. However, when @@ -700,6 +731,217 @@ involved, or by performing both actions, and then calling a designated user-defined function on the resulting values to produce an arbitrary merged result. +@menu +* Simple GLR Parsers:: Using @acronym{GLR} parsers on unambiguous grammars +* Merging GLR Parses:: Using @acronym{GLR} parsers to resolve ambiguities +* Compiler Requirements:: @acronym{GLR} parsers require a modern C compiler +@end menu + +@node Simple GLR Parsers +@subsection Using @acronym{GLR} on Unambiguous Grammars +@cindex @acronym{GLR} parsing, unambiguous grammars +@cindex generalized @acronym{LR} (@acronym{GLR}) parsing, unambiguous grammars +@findex %glr-parser +@findex %expect-rr +@cindex conflicts +@cindex reduce/reduce conflicts +@cindex shift/reduce conflicts + +In the simplest cases, you can use the @acronym{GLR} algorithm +to parse grammars that are unambiguous, but fail to be @acronym{LALR}(1). +Such grammars typically require more than one symbol of look-ahead, +or (in rare cases) fall into the category of grammars in which the +@acronym{LALR}(1) algorithm throws away too much information (they are in +@acronym{LR}(1), but not @acronym{LALR}(1), @ref{Mystery Conflicts}). + +Consider a problem that +arises in the declaration of enumerated and subrange types in the +programming language Pascal. Here are some examples: + +@example +type subrange = lo .. hi; +type enum = (a, b, c); +@end example + +@noindent +The original language standard allows only numeric +literals and constant identifiers for the subrange bounds (@samp{lo} +and @samp{hi}), but Extended Pascal (@acronym{ISO}/@acronym{IEC} +10206) and many other +Pascal implementations allow arbitrary expressions there. This gives +rise to the following situation, containing a superfluous pair of +parentheses: + +@example +type subrange = (a) .. b; +@end example + +@noindent +Compare this to the following declaration of an enumerated +type with only one value: + +@example +type enum = (a); +@end example + +@noindent +(These declarations are contrived, but they are syntactically +valid, and more-complicated cases can come up in practical programs.) + +These two declarations look identical until the @samp{..} token. +With normal @acronym{LALR}(1) one-token look-ahead it is not +possible to decide between the two forms when the identifier +@samp{a} is parsed. It is, however, desirable +for a parser to decide this, since in the latter case +@samp{a} must become a new identifier to represent the enumeration +value, while in the former case @samp{a} must be evaluated with its +current meaning, which may be a constant or even a function call. + +You could parse @samp{(a)} as an ``unspecified identifier in parentheses'', +to be resolved later, but this typically requires substantial +contortions in both semantic actions and large parts of the +grammar, where the parentheses are nested in the recursive rules for +expressions. + +You might think of using the lexer to distinguish between the two +forms by returning different tokens for currently defined and +undefined identifiers. But if these declarations occur in a local +scope, and @samp{a} is defined in an outer scope, then both forms +are possible---either locally redefining @samp{a}, or using the +value of @samp{a} from the outer scope. So this approach cannot +work. + +A simple solution to this problem is to declare the parser to +use the @acronym{GLR} algorithm. +When the @acronym{GLR} parser reaches the critical state, it +merely splits into two branches and pursues both syntax rules +simultaneously. Sooner or later, one of them runs into a parsing +error. If there is a @samp{..} token before the next +@samp{;}, the rule for enumerated types fails since it cannot +accept @samp{..} anywhere; otherwise, the subrange type rule +fails since it requires a @samp{..} token. So one of the branches +fails silently, and the other one continues normally, performing +all the intermediate actions that were postponed during the split. + +If the input is syntactically incorrect, both branches fail and the parser +reports a syntax error as usual. + +The effect of all this is that the parser seems to ``guess'' the +correct branch to take, or in other words, it seems to use more +look-ahead than the underlying @acronym{LALR}(1) algorithm actually allows +for. In this example, @acronym{LALR}(2) would suffice, but also some cases +that are not @acronym{LALR}(@math{k}) for any @math{k} can be handled this way. + +In general, a @acronym{GLR} parser can take quadratic or cubic worst-case time, +and the current Bison parser even takes exponential time and space +for some grammars. In practice, this rarely happens, and for many +grammars it is possible to prove that it cannot happen. +The present example contains only one conflict between two +rules, and the type-declaration context containing the conflict +cannot be nested. So the number of +branches that can exist at any time is limited by the constant 2, +and the parsing time is still linear. + +Here is a Bison grammar corresponding to the example above. It +parses a vastly simplified form of Pascal type declarations. + +@example +%token TYPE DOTDOT ID + +@group +%left '+' '-' +%left '*' '/' +@end group + +%% + +@group +type_decl : TYPE ID '=' type ';' + ; +@end group + +@group +type : '(' id_list ')' + | expr DOTDOT expr + ; +@end group + +@group +id_list : ID + | id_list ',' ID + ; +@end group + +@group +expr : '(' expr ')' + | expr '+' expr + | expr '-' expr + | expr '*' expr + | expr '/' expr + | ID + ; +@end group +@end example + +When used as a normal @acronym{LALR}(1) grammar, Bison correctly complains +about one reduce/reduce conflict. In the conflicting situation the +parser chooses one of the alternatives, arbitrarily the one +declared first. Therefore the following correct input is not +recognized: + +@example +type t = (a) .. b; +@end example + +The parser can be turned into a @acronym{GLR} parser, while also telling Bison +to be silent about the one known reduce/reduce conflict, by +adding these two declarations to the Bison input file (before the first +@samp{%%}): + +@example +%glr-parser +%expect-rr 1 +@end example + +@noindent +No change in the grammar itself is required. Now the +parser recognizes all valid declarations, according to the +limited syntax above, transparently. In fact, the user does not even +notice when the parser splits. + +So here we have a case where we can use the benefits of @acronym{GLR}, almost +without disadvantages. Even in simple cases like this, however, there +are at least two potential problems to beware. +First, always analyze the conflicts reported by +Bison to make sure that @acronym{GLR} splitting is only done where it is +intended. A @acronym{GLR} parser splitting inadvertently may cause +problems less obvious than an @acronym{LALR} parser statically choosing the +wrong alternative in a conflict. +Second, consider interactions with the lexer (@pxref{Semantic Tokens}) +with great care. Since a split parser consumes tokens +without performing any actions during the split, the lexer cannot +obtain information via parser actions. Some cases of +lexer interactions can be eliminated by using @acronym{GLR} to +shift the complications from the lexer to the parser. You must check +the remaining cases for correctness. + +In our example, it would be safe for the lexer to return tokens +based on their current meanings in some symbol table, because no new +symbols are defined in the middle of a type declaration. Though it +is possible for a parser to define the enumeration +constants as they are parsed, before the type declaration is +completed, it actually makes no difference since they cannot be used +within the same enumerated type declaration. + +@node Merging GLR Parses +@subsection Using @acronym{GLR} to Resolve Ambiguities +@cindex @acronym{GLR} parsing, ambiguous grammars +@cindex generalized @acronym{LR} (@acronym{GLR}) parsing, ambiguous grammars +@findex %dprec +@findex %merge +@cindex conflicts +@cindex reduce/reduce conflicts + Let's consider an example, vastly simplified from a C++ grammar. @example @@ -759,8 +1001,21 @@ parses as either an @code{expr} or a @code{stmt} @samp{x} as an @code{ID}). Bison detects this as a reduce/reduce conflict between the rules @code{expr : ID} and @code{declarator : ID}, which it cannot resolve at the -time it encounters @code{x} in the example above. The two @code{%dprec} -declarations, however, give precedence to interpreting the example as a +time it encounters @code{x} in the example above. Since this is a +@acronym{GLR} parser, it therefore splits the problem into two parses, one for +each choice of resolving the reduce/reduce conflict. +Unlike the example from the previous section (@pxref{Simple GLR Parsers}), +however, neither of these parses ``dies,'' because the grammar as it stands is +ambiguous. One of the parsers eventually reduces @code{stmt : expr ';'} and +the other reduces @code{stmt : decl}, after which both parsers are in an +identical state: they've seen @samp{prog stmt} and have the same unprocessed +input remaining. We say that these parses have @dfn{merged.} + +At this point, the @acronym{GLR} parser requires a specification in the +grammar of how to choose between the competing parses. +In the example above, the two @code{%dprec} +declarations specify that Bison is to give precedence +to the parse that interprets the example as a @code{decl}, which implies that @code{x} is a declarator. The parser therefore prints @@ -768,18 +1023,21 @@ The parser therefore prints "x" y z + T @end example -Consider a different input string for this parser: +The @code{%dprec} declarations only come into play when more than one +parse survives. Consider a different input string for this parser: @example T (x) + y; @end example @noindent +This is another example of using @acronym{GLR} to parse an unambiguous +construct, as shown in the previous section (@pxref{Simple GLR Parsers}). Here, there is no ambiguity (this cannot be parsed as a declaration). However, at the time the Bison parser encounters @code{x}, it does not have enough information to resolve the reduce/reduce conflict (again, between @code{x} as an @code{expr} or a @code{declarator}). In this -case, no precedence declaration is used. Instead, the parser splits +case, no precedence declaration is used. Again, the parser splits into two, one assuming that @code{x} is an @code{expr}, and the other assuming @code{x} is a @code{declarator}. The second of these parsers then vanishes when it sees @code{+}, and the parser prints @@ -789,7 +1047,7 @@ x T y + @end example Suppose that instead of resolving the ambiguity, you wanted to see all -the possibilities. For this purpose, we must @dfn{merge} the semantic +the possibilities. For this purpose, you must merge the semantic actions of the two possible parsers, rather than choosing one over the other. To do so, you could change the declaration of @code{stmt} as follows: @@ -801,7 +1059,6 @@ stmt : expr ';' %merge @end example @noindent - and define the @code{stmtMerge} function as: @example @@ -825,17 +1082,24 @@ in the C declarations at the beginning of the file: @end example @noindent -With these declarations, the resulting parser will parse the first example -as both an @code{expr} and a @code{decl}, and print +With these declarations, the resulting parser parses the first example +as both an @code{expr} and a @code{decl}, and prints @example "x" y z + T x T y z + = @end example -@sp 1 +Bison requires that all of the +productions that participate in any particular merge have identical +@samp{%merge} clauses. Otherwise, the ambiguity would be unresolvable, +and the parser will report an error during any parse that results in +the offending merge. -@cindex @code{incline} +@node Compiler Requirements +@subsection Considerations when Compiling @acronym{GLR} Parsers +@cindex @code{inline} @cindex @acronym{GLR} parsers and @code{inline} + The @acronym{GLR} parsers require a compiler for @acronym{ISO} C89 or later. In addition, they use the @code{inline} keyword, which is not C89, but is C99 and is a common extension in pre-C99 compilers. It is @@ -939,7 +1203,9 @@ In some cases the Bison parser file includes system headers, and in those cases your code should respect the identifiers reserved by those headers. On some non-@acronym{GNU} hosts, @code{}, @code{}, and @code{} are included as needed to -declare memory allocators and related types. Other system headers may +declare memory allocators and related types. @code{} is +included if message translation is in use +(@pxref{Internationalization}). Other system headers may be included if you define @code{YYDEBUG} to a nonzero value (@pxref{Tracing, ,Tracing Your Parser}). @@ -1290,7 +1556,7 @@ not require it. You can add or change white space as much as you wish. For example, this: @example -exp : NUM | exp exp '+' @{$$ = $1 + $2; @} | @dots{} +exp : NUM | exp exp '+' @{$$ = $1 + $2; @} | @dots{} ; @end example @noindent @@ -1300,6 +1566,7 @@ means the same thing as this: exp: NUM | exp exp '+' @{ $$ = $1 + $2; @} | @dots{} +; @end example @noindent @@ -1449,12 +1716,12 @@ With all the source in a single file, you use the following command to convert it into a parser file: @example -bison @var{file_name}.y +bison @var{file}.y @end example @noindent In this example the file was called @file{rpcalc.y} (for ``Reverse Polish -@sc{calc}ulator''). Bison produces a file named @file{@var{file_name}.tab.c}, +@sc{calc}ulator''). Bison produces a file named @file{@var{file}.tab.c}, removing the @samp{.y} from the original file name. The file output by Bison contains the source code for @code{yyparse}. The additional functions in the input file (@code{yylex}, @code{yyerror} and @code{main}) @@ -2030,7 +2297,7 @@ typedef struct symrec symrec; /* The symbol table: a chain of `struct symrec'. */ extern symrec *sym_table; -symrec *putsym (char const *, func_t); +symrec *putsym (char const *, int); symrec *getsym (char const *); @end group @end smallexample @@ -2385,7 +2652,7 @@ not come before the definition of @code{yyparse}. For example, the definitions of @code{yylex} and @code{yyerror} often go here. Because C requires functions to be declared before being used, you often need to declare functions like @code{yylex} and @code{yyerror} in the Prologue, -even if you define them int he Epilogue. +even if you define them in the Epilogue. @xref{Interface, ,Parser C-Language Interface}. If the last section is empty, you may omit the @samp{%%} that separates it @@ -3204,38 +3471,40 @@ dedicated code from semantic actions. The @code{YYLLOC_DEFAULT} macro takes three parameters. The first one is the location of the grouping (the result of the computation). When a -rule is matched, the second parameter is an array holding locations of +rule is matched, the second parameter identifies locations of all right hand side elements of the rule being matched, and the third parameter is the size of the rule's right hand side. When processing -a syntax error, the second parameter is an array holding locations of +a syntax error, the second parameter identifies locations of the symbols that were discarded during error processing, and the third parameter is the number of discarded symbols. -By default, @code{YYLLOC_DEFAULT} is defined this way for simple -@acronym{LALR}(1) parsers: +By default, @code{YYLLOC_DEFAULT} is defined this way: -@example +@smallexample @group -# define YYLLOC_DEFAULT(Current, Rhs, N) \ - ((Current).first_line = (Rhs)[1].first_line, \ - (Current).first_column = (Rhs)[1].first_column, \ - (Current).last_line = (Rhs)[N].last_line, \ - (Current).last_column = (Rhs)[N].last_column) +# define YYLLOC_DEFAULT(Current, Rhs, N) \ + do \ + if (N) \ + @{ \ + (Current).first_line = YYRHSLOC(Rhs, 1).first_line; \ + (Current).first_column = YYRHSLOC(Rhs, 1).first_column; \ + (Current).last_line = YYRHSLOC(Rhs, N).last_line; \ + (Current).last_column = YYRHSLOC(Rhs, N).last_column; \ + @} \ + else \ + @{ \ + (Current).first_line = (Current).last_line = \ + YYRHSLOC(Rhs, 0).last_line; \ + (Current).first_column = (Current).last_column = \ + YYRHSLOC(Rhs, 0).last_column; \ + @} \ + while (0) @end group -@end example +@end smallexample -@noindent -and like this for @acronym{GLR} parsers: - -@example -@group -# define YYLLOC_DEFAULT(yyCurrent, yyRhs, YYN) \ - ((yyCurrent).first_line = YYRHSLOC(yyRhs, 1).first_line, \ - (yyCurrent).first_column = YYRHSLOC(yyRhs, 1).first_column, \ - (yyCurrent).last_line = YYRHSLOC(yyRhs, YYN).last_line, \ - (yyCurrent).last_column = YYRHSLOC(yyRhs, YYN).last_column) -@end group -@end example +where @code{YYRHSLOC (rhs, k)} is the location of the @var{k}th symbol +in @var{rhs} when @var{k} is positive, and the location of the symbol +just before the reduction when @var{k} and @var{n} are both zero. When defining @code{YYLLOC_DEFAULT}, you should consider that: @@ -3245,8 +3514,10 @@ All arguments are free of side-effects. However, only the first one (the result) should be modified by @code{YYLLOC_DEFAULT}. @item -For consistency with semantic actions, valid indexes for the location -array range from 1 to @var{n}. +For consistency with semantic actions, valid indexes within the +right hand side range from 1 to @var{n}. When @var{n} is zero, only 0 is a +valid index, and it refers to the symbol just before the reduction. +During error processing @var{n} is always positive. @item Your macro should parenthesize its arguments, if need be, since the @@ -3279,6 +3550,7 @@ Grammars}). * Precedence Decl:: Declaring terminals with precedence and associativity. * Union Decl:: Declaring the set of all semantic value types. * Type Decl:: Declaring the choice of type for a nonterminal symbol. +* Initial Action Decl:: Code run before parsing starts. * Destructor Decl:: Declaring how symbols are freed. * Expect Decl:: Suppressing warnings about parsing conflicts. * Start Decl:: Specifying the start symbol. @@ -3488,34 +3760,63 @@ use the same @code{<@var{type}>} construction in a declaration for the terminal symbol. All kinds of token declarations allow @code{<@var{type}>}. +@node Initial Action Decl +@subsection Performing Actions before Parsing +@findex %initial-action + +Sometimes your parser needs to perform some initializations before +parsing. The @code{%initial-action} directive allows for such arbitrary +code. + +@deffn {Directive} %initial-action @{ @var{code} @} +@findex %initial-action +Declare that the @var{code} must be invoked before parsing each time +@code{yyparse} is called. The @var{code} may use @code{$$} and +@code{@@$} --- initial value and location of the look-ahead --- and the +@code{%parse-param}. +@end deffn + +For instance, if your locations use a file name, you may use + +@example +%parse-param @{ char const *file_name @}; +%initial-action +@{ + @@$.begin.filename = @@$.end.filename = file_name; +@}; +@end example + + @node Destructor Decl @subsection Freeing Discarded Symbols @cindex freeing discarded symbols @findex %destructor -Some symbols can be discarded by the parser, typically during error -recovery (@pxref{Error Recovery}). Basically, during error recovery, -embarrassing symbols already pushed on the stack, and embarrassing -tokens coming from the rest of the file are thrown away until the parser -falls on its feet. If these symbols convey heap based information, this -memory is lost. While this behavior is tolerable for batch parsers, -such as in compilers, it is unacceptable for parsers that can -possibility ``never end'' such as shells, or implementations of -communication protocols. +Some symbols can be discarded by the parser. During error +recovery (@pxref{Error Recovery}), symbols already pushed +on the stack and tokens coming from the rest of the file +are discarded until the parser falls on its feet. If the parser +runs out of memory, all the symbols on the stack must be discarded. +Even if the parser succeeds, it must discard the start symbol. -The @code{%destructor} directive allows for the definition of code that -is called when a symbol is thrown away. +When discarded symbols convey heap based information, this memory is +lost. While this behavior can be tolerable for batch parsers, such as +in traditional compilers, it is unacceptable for programs like shells +or protocol implementations that may parse and execute indefinitely. + +The @code{%destructor} directive defines code that +is called when a symbol is discarded. @deffn {Directive} %destructor @{ @var{code} @} @var{symbols} @findex %destructor -Declare that the @var{code} must be invoked for each of the -@var{symbols} that will be discarded by the parser. The @var{code} -should use @code{$$} to designate the semantic value associated to the -@var{symbols}. The additional parser parameters are also available +Invoke @var{code} whenever the parser discards one of the +@var{symbols}. Within @var{code}, @code{$$} designates the semantic +value associated with the discarded symbol. The additional +parser parameters are also available (@pxref{Parser Function, , The Parser Function @code{yyparse}}). -@strong{Warning:} as of Bison 1.875, this feature is still considered as -experimental, as there was not enough user feedback. In particular, +@strong{Warning:} as of Bison 2.1, this feature is still +experimental, as there has not been enough user feedback. In particular, the syntax might still change. @end deffn @@ -3532,7 +3833,7 @@ For instance: @end smallexample @noindent -guarantees that when a @code{STRING} or a @code{string} will be discarded, +guarantees that when a @code{STRING} or a @code{string} is discarded, its associated memory will be freed. Note that in the future, Bison might also consider that right hand side @@ -3553,6 +3854,25 @@ typeless: string; // $$ = $1 does not apply; $1 is destroyed. typefull: string; // $$ = $1 applies, $1 is not destroyed. @end smallexample +@sp 1 + +@cindex discarded symbols +@dfn{Discarded symbols} are the following: + +@itemize +@item +stacked symbols popped during the first phase of error recovery, +@item +incoming terminals during the second phase of error recovery, +@item +the current look-ahead and the entire stack when the parser aborts +(either via an explicit call to @code{YYABORT}, or as a consequence of +a failed error recovery or of memory exhaustion), and +@item +the start symbol, when the parser succeeds. +@end itemize + + @node Expect Decl @subsection Suppressing Conflict Warnings @cindex suppressing conflict warnings @@ -3581,12 +3901,12 @@ reduce/reduce conflicts. The usual warning is given if there are either more or fewer conflicts, or if there are any reduce/reduce conflicts. -For normal LALR(1) parsers, reduce/reduce conflicts are more serious, +For normal @acronym{LALR}(1) parsers, reduce/reduce conflicts are more serious, and should be eliminated entirely. Bison will always report -reduce/reduce conflicts for these parsers. With GLR parsers, however, +reduce/reduce conflicts for these parsers. With @acronym{GLR} parsers, however, both shift/reduce and reduce/reduce are routine (otherwise, there -would be no need to use GLR parsing). Therefore, it is also possible -to specify an expected number of reduce/reduce conflicts in GLR +would be no need to use @acronym{GLR} parsing). Therefore, it is also possible +to specify an expected number of reduce/reduce conflicts in @acronym{GLR} parsers, using the declaration: @example @@ -3739,22 +4059,40 @@ already defined, so that the debugging facilities are compiled. @xref{Tracing, ,Tracing Your Parser}. @deffn {Directive} %defines -Write an extra output file containing macro definitions for the token -type names defined in the grammar and the semantic value type -@code{YYSTYPE}, as well as a few @code{extern} variable declarations. - +Write a header file containing macro definitions for the token type +names defined in the grammar as well as a few other declarations. If the parser output file is named @file{@var{name}.c} then this file is named @file{@var{name}.h}. -This output file is essential if you wish to put the definition of -@code{yylex} in a separate source file, because @code{yylex} needs to -be able to refer to token type codes and the variable -@code{yylval}. @xref{Token Values, ,Semantic Values of Tokens}. +Unless @code{YYSTYPE} is already defined as a macro, the output header +declares @code{YYSTYPE}. Therefore, if you are using a @code{%union} +(@pxref{Multiple Types, ,More Than One Value Type}) with components +that require other definitions, or if you have defined a +@code{YYSTYPE} macro (@pxref{Value Type, ,Data Types of Semantic +Values}), you need to arrange for these definitions to be propagated to +all modules, e.g., by putting them in a +prerequisite header that is included both by your parser and by any +other module that needs @code{YYSTYPE}. + +Unless your parser is pure, the output header declares @code{yylval} +as an external variable. @xref{Pure Decl, ,A Pure (Reentrant) +Parser}. + +If you have also used locations, the output header declares +@code{YYLTYPE} and @code{yylloc} using a protocol similar to that of +@code{YYSTYPE} and @code{yylval}. @xref{Locations, ,Tracking +Locations}. + +This output file is normally essential if you wish to put the +definition of @code{yylex} in a separate source file, because +@code{yylex} typically needs to be able to refer to the +above-mentioned declarations and to the token type codes. +@xref{Token Values, ,Semantic Values of Tokens}. @end deffn @deffn {Directive} %destructor -Specifying how the parser should reclaim the memory associated to -discarded symbols. @xref{Destructor Decl, , Freeing Discarded Symbols}. +Specify how the parser should reclaim the memory associated to +discarded symbols. @xref{Destructor Decl, , Freeing Discarded Symbols}. @end deffn @deffn {Directive} %file-prefix="@var{prefix}" @@ -3795,7 +4133,7 @@ parser file contains just @code{#define} directives and static variable declarations. This option also tells Bison to write the C code for the grammar actions -into a file named @file{@var{filename}.act}, in the form of a +into a file named @file{@var{file}.act}, in the form of a brace-surrounded body fit for a @code{switch} statement. @end deffn @@ -3808,8 +4146,8 @@ associate errors with the parser file, treating it an independent source file in its own right. @end deffn -@deffn {Directive} %output="@var{filename}" -Specify the @var{filename} for the parser file. +@deffn {Directive} %output="@var{file}" +Specify @var{file} for the parser file. @end deffn @deffn {Directive} %pure-parser @@ -3826,15 +4164,14 @@ three elements of @code{yytname} correspond to the predefined tokens @code{"error"}, and @code{"$undefined"}; after these come the symbols defined in the grammar file. -For single-character literal tokens and literal string tokens, the name -in the table includes the single-quote or double-quote characters: for -example, @code{"'+'"} is a single-character literal and @code{"\"<=\""} -is a literal string token. All the characters of the literal string -token appear verbatim in the string found in the table; even -double-quote characters are not escaped. For example, if the token -consists of three characters @samp{*"*}, its string in @code{yytname} -contains @samp{"*"*"}. (In C, that would be written as -@code{"\"*\"*\""}). +The name in the table includes all the characters needed to represent +the token in Bison. For single-character literals and literal +strings, this includes the surrounding quoting characters and any +escape sequences. For example, the Bison single-character literal +@code{'+'} corresponds to a three-character name, represented in C as +@code{"'+'"}; and the Bison two-character literal string @code{"\\/"} +corresponds to a five-character name, represented in C as +@code{"\"\\\\/\""}. When you specify @code{%token-table}, Bison also generates macro definitions for macros @code{YYNTOKENS}, @code{YYNNTS}, and @@ -3915,6 +4252,8 @@ in the grammar file, you are likely to run into trouble. which reads tokens. * Error Reporting:: You must supply a function @code{yyerror}. * Action Features:: Special features for use in actions. +* Internationalization:: How to let the parser speak in the user's + native language. @end menu @node Parser Function @@ -3932,7 +4271,11 @@ without reading further. The value returned by @code{yyparse} is 0 if parsing was successful (return is due to end-of-input). -The value is 1 if parsing failed (return is due to a syntax error). +The value is 1 if parsing failed because of invalid input, i.e., input +that contains a syntax error or that causes @code{YYABORT} to be +invoked. + +The value is 2 if parsing failed due to memory exhaustion. @end deftypefun In an action, you can cause immediate return from @code{yyparse} by using @@ -4073,11 +4416,13 @@ the grammar file has no effect on @code{yylex}. table. The index of the token in the table is the token type's code. The name of a multicharacter token is recorded in @code{yytname} with a double-quote, the token's characters, and another double-quote. The -token's characters are not escaped in any way; they appear verbatim in -the contents of the string in the table. +token's characters are escaped as necessary to be suitable as input +to Bison. -Here's code for looking up a token in @code{yytname}, assuming that the -characters of the token are stored in @code{token_buffer}. +Here's code for looking up a multicharacter token in @code{yytname}, +assuming that the characters of the token are stored in +@code{token_buffer}, and assuming that the token does not contain any +characters like @samp{"} that require escaping. @smallexample for (i = 0; i < YYNTOKENS; i++) @@ -4258,13 +4603,16 @@ declarations section (@pxref{Bison Declarations, ,The Bison Declarations Section}), then Bison provides a more verbose and specific error message string instead of just plain @w{@code{"syntax error"}}. -The parser can detect one other kind of error: stack overflow. This -happens when the input contains constructions that are very deeply +The parser can detect one other kind of error: memory exhaustion. This +can happen when the input contains constructions that are very deeply nested. It isn't likely you will encounter this, since the Bison -parser extends its stack automatically up to a very large limit. But -if overflow happens, @code{yyparse} calls @code{yyerror} in the usual -fashion, except that the argument string is @w{@code{"parser stack -overflow"}}. +parser normally extends its stack automatically up to a very large limit. But +if memory is exhausted, @code{yyparse} calls @code{yyerror} in the usual +fashion, except that the argument string is @w{@code{"memory exhausted"}}. + +In some cases diagnostics like @w{@code{"syntax error"}} are +translated automatically from English to some other language before +they are passed to @code{yyerror}. @xref{Internationalization}. The following definition suffices in simple programs: @@ -4286,7 +4634,8 @@ error recovery if you have written suitable error recovery grammar rules immediately return 1. Obviously, in location tracking pure parsers, @code{yyerror} should have -an access to the current location. This is indeed the case for the GLR +an access to the current location. +This is indeed the case for the @acronym{GLR} parsers, but not for the Yacc parser, for historical reasons. I.e., if @samp{%locations %pure-parser} is passed then the prototypes for @code{yyerror} are: @@ -4303,7 +4652,7 @@ void yyerror (int *nastiness, char const *msg); /* Yacc parsers. */ void yyerror (int *nastiness, char const *msg); /* GLR parsers. */ @end example -Finally, GLR and Yacc parsers share the same @code{yyerror} calling +Finally, @acronym{GLR} and Yacc parsers share the same @code{yyerror} calling convention for absolutely pure parsers, i.e., when the calling convention of @code{yylex} @emph{and} the calling convention of @code{%pure-parser} are pure. I.e.: @@ -4476,6 +4825,90 @@ of the @var{n}th component of the current rule. @xref{Locations, , Tracking Locations}. @end deffn +@node Internationalization +@section Parser Internationalization +@cindex internationalization +@cindex i18n +@cindex NLS +@cindex gettext +@cindex bison-po + +A Bison-generated parser can print diagnostics, including error and +tracing messages. By default, they appear in English. However, Bison +also supports outputting diagnostics in the user's native language. +To make this work, the user should set the usual environment +variables. @xref{Users, , The User's View, gettext, GNU +@code{gettext} utilities}. For +example, the shell command @samp{export LC_ALL=fr_CA.UTF-8} might set +the user's locale to French Canadian using the @acronym{UTF}-8 +encoding. The exact set of available locales depends on the user's +installation. + +The maintainer of a package that uses a Bison-generated parser enables +the internationalization of the parser's output through the following +steps. Here we assume a package that uses @acronym{GNU} Autoconf and +@acronym{GNU} Automake. + +@enumerate +@item +@cindex bison-i18n.m4 +Into the directory containing the @acronym{GNU} Autoconf macros used +by the package---often called @file{m4}---copy the +@file{bison-i18n.m4} file installed by Bison under +@samp{share/aclocal/bison-i18n.m4} in Bison's installation directory. +For example: + +@example +cp /usr/local/share/aclocal/bison-i18n.m4 m4/bison-i18n.m4 +@end example + +@item +@findex BISON_I18N +@vindex BISON_LOCALEDIR +@vindex YYENABLE_NLS +In the top-level @file{configure.ac}, after the @code{AM_GNU_GETTEXT} +invocation, add an invocation of @code{BISON_I18N}. This macro is +defined in the file @file{bison-i18n.m4} that you copied earlier. It +causes @samp{configure} to find the value of the +@code{BISON_LOCALEDIR} variable, and it defines the source-language +symbol @code{YYENABLE_NLS} to enable translations in the +Bison-generated parser. + +@item +In the @code{main} function of your program, designate the directory +containing Bison's runtime message catalog, through a call to +@samp{bindtextdomain} with domain name @samp{bison-runtime}. +For example: + +@example +bindtextdomain ("bison-runtime", BISON_LOCALEDIR); +@end example + +Typically this appears after any other call @code{bindtextdomain +(PACKAGE, LOCALEDIR)} that your package already has. Here we rely on +@samp{BISON_LOCALEDIR} to be defined as a string through the +@file{Makefile}. + +@item +In the @file{Makefile.am} that controls the compilation of the @code{main} +function, make @samp{BISON_LOCALEDIR} available as a C preprocessor macro, +either in @samp{DEFS} or in @samp{AM_CPPFLAGS}. For example: + +@example +DEFS = @@DEFS@@ -DBISON_LOCALEDIR='"$(BISON_LOCALEDIR)"' +@end example + +or: + +@example +AM_CPPFLAGS = -DBISON_LOCALEDIR='"$(BISON_LOCALEDIR)"' +@end example + +@item +Finally, invoke the command @command{autoreconf} to generate the build +infrastructure. +@end enumerate + @node Algorithm @chapter The Bison Parser Algorithm @@ -4542,7 +4975,7 @@ This kind of parser is known in the literature as a bottom-up parser. * Reduce/Reduce:: When two rules are applicable in the same situation. * Mystery Conflicts:: Reduce/reduce conflicts that look unjustified. * Generalized LR Parsing:: Parsing arbitrary context-free grammars. -* Stack Overflow:: What happens when stack gets full. How to avoid it. +* Memory Management:: What happens when memory is exhausted. How to avoid it. @end menu @node Look-Ahead @@ -5160,6 +5593,13 @@ return_spec: ; @end example +For a more detailed exposition of @acronym{LALR}(1) parsers and parser +generators, please see: +Frank DeRemer and Thomas Pennello, Efficient Computation of +@acronym{LALR}(1) Look-Ahead Sets, @cite{@acronym{ACM} Transactions on +Programming Languages and Systems}, Vol.@: 4, No.@: 4 (October 1982), +pp.@: 615--649 @uref{http://doi.acm.org/10.1145/69622.357187}. + @node Generalized LR Parsing @section Generalized @acronym{LR} (@acronym{GLR}) Parsing @cindex @acronym{GLR} parsing @@ -5169,13 +5609,13 @@ return_spec: Bison produces @emph{deterministic} parsers that choose uniquely when to reduce and which reduction to apply -based on a summary of the preceding input and on one extra token of lookahead. +based on a summary of the preceding input and on one extra token of look-ahead. As a result, normal Bison handles a proper subset of the family of context-free languages. Ambiguous grammars, since they have strings with more than one possible sequence of reductions cannot have deterministic parsers in this sense. The same is true of languages that require more than one symbol of -lookahead, since the parser lacks the information necessary to make a +look-ahead, since the parser lacks the information necessary to make a decision at the point it must be made in a shift-reduce parser. Finally, as previously mentioned (@pxref{Mystery Conflicts}), there are languages where Bison's particular choice of how to @@ -5239,23 +5679,24 @@ structure should generally be adequate. On @acronym{LALR}(1) portions of a grammar, in particular, it is only slightly slower than with the default Bison parser. -For a more detailed exposition of GLR parsers, please see: Elizabeth +For a more detailed exposition of @acronym{GLR} parsers, please see: Elizabeth Scott, Adrian Johnstone and Shamsa Sadaf Hussain, Tomita-Style Generalised @acronym{LR} Parsers, Royal Holloway, University of London, Department of Computer Science, TR-00-12, @uref{http://www.cs.rhul.ac.uk/research/languages/publications/tomita_style_1.ps}, (2000-12-24). -@node Stack Overflow -@section Stack Overflow, and How to Avoid It +@node Memory Management +@section Memory Management, and How to Avoid Memory Exhaustion +@cindex memory exhaustion +@cindex memory management @cindex stack overflow @cindex parser stack overflow @cindex overflow of parser stack -The Bison parser stack can overflow if too many tokens are shifted and +The Bison parser stack can run out of memory if too many tokens are shifted and not reduced. When this happens, the parser function @code{yyparse} -returns a nonzero value, pausing only to call @code{yyerror} to report -the overflow. +calls @code{yyerror} and then returns 2. Because Bison parsers have growing stacks, hitting the upper limit usually results from using a right recursion instead of a left @@ -5263,34 +5704,41 @@ recursion, @xref{Recursion, ,Recursive Rules}. @vindex YYMAXDEPTH By defining the macro @code{YYMAXDEPTH}, you can control how deep the -parser stack can become before a stack overflow occurs. Define the +parser stack can become before memory is exhausted. Define the macro with a value that is an integer. This value is the maximum number of tokens that can be shifted (and not reduced) before overflow. -It must be a constant expression whose value is known at compile time. The stack space allowed is not necessarily allocated. If you specify a -large value for @code{YYMAXDEPTH}, the parser actually allocates a small +large value for @code{YYMAXDEPTH}, the parser normally allocates a small stack at first, and then makes it bigger by stages as needed. This increasing allocation happens automatically and silently. Therefore, you do not need to make @code{YYMAXDEPTH} painfully small merely to save space for ordinary inputs that do not need much stack. +However, do not allow @code{YYMAXDEPTH} to be a value so large that +arithmetic overflow could occur when calculating the size of the stack +space. Also, do not allow @code{YYMAXDEPTH} to be less than +@code{YYINITDEPTH}. + @cindex default stack limit The default value of @code{YYMAXDEPTH}, if you do not define it, is 10000. @vindex YYINITDEPTH You can control how much stack is allocated initially by defining the -macro @code{YYINITDEPTH}. This value too must be a compile-time -constant integer. The default is 200. +macro @code{YYINITDEPTH} to a positive integer. For the C +@acronym{LALR}(1) parser, this value must be a compile-time constant +unless you are assuming C99 or some other target language or compiler +that allows variable-length arrays. The default is 200. + +Do not allow @code{YYINITDEPTH} to be greater than @code{YYMAXDEPTH}. @c FIXME: C++ output. Because of semantical differences between C and C++, the -@acronym{LALR}(1) parsers -in C produced by Bison by compiled as C++ cannot grow. In this precise -case (compiling a C parser as C++) you are suggested to grow -@code{YYINITDEPTH}. In the near future, a C++ output output will be -provided which addresses this issue. +@acronym{LALR}(1) parsers in C produced by Bison cannot grow when compiled +by C++ compilers. In this precise case (compiling a C parser as C++) you are +suggested to grow @code{YYINITDEPTH}. The Bison maintainers hope to fix +this deficiency in a future release. @node Error Recovery @chapter Error Recovery @@ -5466,9 +5914,13 @@ redeclare a typedef name provided an explicit type has been specified earlier: @example -typedef int foo, bar, lose; -static foo (bar); /* @r{redeclare @code{bar} as static variable} */ -static int foo (lose); /* @r{redeclare @code{foo} as function} */ +typedef int foo, bar; +int baz (void) +@{ + static bar (bar); /* @r{redeclare @code{bar} as static variable} */ + extern foo foo (foo); /* @r{redeclare @code{foo} as function} */ + return foo (bar); +@} @end example Unfortunately, the name being declared is separated from the declaration @@ -5787,16 +6239,16 @@ beginning of the parsing, in the initial rule, right before the start symbol (here, @code{exp}). When the parser returns to this state right after having reduced a rule that produced an @code{exp}, the control flow jumps to state 2. If there is no such transition on a nonterminal -symbol, and the lookahead is a @code{NUM}, then this token is shifted on +symbol, and the look-ahead is a @code{NUM}, then this token is shifted on the parse stack, and the control flow jumps to state 1. Any other -lookahead triggers a syntax error.'' +look-ahead triggers a syntax error.'' @cindex core, item set @cindex item set core @cindex kernel, item set @cindex item set core Even though the only active rule in state 0 seems to be rule 0, the -report lists @code{NUM} as a lookahead symbol because @code{NUM} can be +report lists @code{NUM} as a look-ahead token because @code{NUM} can be at the beginning of any rule deriving an @code{exp}. By default Bison reports the so-called @dfn{core} or @dfn{kernel} of the item set, but if you want to see more detail you can invoke @command{bison} with @@ -5830,7 +6282,7 @@ state 1 @end example @noindent -the rule 5, @samp{exp: NUM;}, is completed. Whatever the lookahead +the rule 5, @samp{exp: NUM;}, is completed. Whatever the look-ahead token (@samp{$default}), the parser will reduce it. If it was coming from state 0, then, after this reduction it will return to state 0, and will jump to state 2 (@samp{exp: go to state 2}). @@ -5853,7 +6305,7 @@ state 2 @noindent In state 2, the automaton can only shift a symbol. For instance, -because of the item @samp{exp -> exp . '+' exp}, if the lookahead if +because of the item @samp{exp -> exp . '+' exp}, if the look-ahead if @samp{+}, it will be shifted on the parse stack, and the automaton control will jump to state 4, corresponding to the item @samp{exp -> exp '+' . exp}. Since there is no default action, any other token than @@ -5930,7 +6382,7 @@ state 8 $default reduce using rule 1 (exp) @end example -Indeed, there are two actions associated to the lookahead @samp{/}: +Indeed, there are two actions associated to the look-ahead @samp{/}: either shifting (and going to state 7), or reducing rule 1. The conflict means that either the grammar is ambiguous, or the parser lacks information to make the right decision. Indeed the grammar is @@ -5948,14 +6400,14 @@ Note that all the previous states had a single possible action: either shifting the next token and going to the corresponding state, or reducing a single rule. In the other cases, i.e., when shifting @emph{and} reducing is possible or when @emph{several} reductions are -possible, the lookahead is required to select the action. State 8 is -one such state: if the lookahead is @samp{*} or @samp{/} then the action +possible, the look-ahead is required to select the action. State 8 is +one such state: if the look-ahead is @samp{*} or @samp{/} then the action is shifting, otherwise the action is reducing rule 1. In other words, the first two items, corresponding to rule 1, are not eligible when the -lookahead is @samp{*}, since we specified that @samp{*} has higher -precedence that @samp{+}. More generally, some items are eligible only -with some set of possible lookaheads. When run with -@option{--report=lookahead}, Bison specifies these lookaheads: +look-ahead token is @samp{*}, since we specified that @samp{*} has higher +precedence than @samp{+}. More generally, some items are eligible only +with some set of possible look-ahead tokens. When run with +@option{--report=look-ahead}, Bison specifies these look-ahead tokens: @example state 8 @@ -6024,8 +6476,9 @@ state 11 @end example @noindent -Observe that state 11 contains conflicts due to the lack of precedence -of @samp{/} wrt @samp{+}, @samp{-}, and @samp{*}, but also because the +Observe that state 11 contains conflicts not only due to the lack of +precedence of @samp{/} with respect to @samp{+}, @samp{-}, and +@samp{*}, but also because the associativity of @samp{/} is not specified. @@ -6156,14 +6609,15 @@ bison @var{infile} Here @var{infile} is the grammar file name, which usually ends in @samp{.y}. The parser file's name is made by replacing the @samp{.y} -with @samp{.tab.c}. Thus, the @samp{bison foo.y} filename yields -@file{foo.tab.c}, and the @samp{bison hack/foo.y} filename yields -@file{hack/foo.tab.c}. It's also possible, in case you are writing +with @samp{.tab.c} and removing any leading directory. Thus, the +@samp{bison foo.y} file name yields +@file{foo.tab.c}, and the @samp{bison hack/foo.y} file name yields +@file{foo.tab.c}. It's also possible, in case you are writing C++ code instead of C in your grammar file, to name it @file{foo.ypp} or @file{foo.y++}. Then, the output files will take an extension like the given one as input (respectively @file{foo.tab.cpp} and @file{foo.tab.c++}). -This feature takes effect with all options that manipulate filenames like +This feature takes effect with all options that manipulate file names like @samp{-o} or @samp{-d}. For example : @@ -6217,6 +6671,9 @@ Print a summary of the command-line options to Bison and exit. @itemx --version Print the version number of Bison and exit. +@item --print-localedir +Print the name of the directory containing locale-dependent data. + @need 1750 @item -y @itemx --yacc @@ -6281,8 +6738,7 @@ Adjust the output: @itemx --defines Pretend that @code{%defines} was specified, i.e., write an extra output file containing macro definitions for the token type names defined in -the grammar and the semantic value type @code{YYSTYPE}, as well as a few -@code{extern} variable declarations. @xref{Decl Summary}. +the grammar, as well as a few other declarations. @xref{Decl Summary}. @item --defines=@var{defines-file} Same as above, but save in the file @var{defines-file}. @@ -6302,9 +6758,9 @@ separated list of @var{things} among: Description of the grammar, conflicts (resolved and unresolved), and @acronym{LALR} automaton. -@item lookahead +@item look-ahead Implies @code{state} and augments the description of the automaton with -each rule's lookahead set. +each rule's look-ahead set. @item itemset Implies @code{state} and augments the description of the automaton with @@ -6319,11 +6775,11 @@ Pretend that @code{%verbose} was specified, i.e, write an extra output file containing verbose descriptions of the grammar and parser. @xref{Decl Summary}. -@item -o @var{filename} -@itemx --output=@var{filename} -Specify the @var{filename} for the parser file. +@item -o @var{file} +@itemx --output=@var{file} +Specify the @var{file} for the parser file. -The other output files' names are constructed from @var{filename} as +The other output files' names are constructed from @var{file} as described under the @samp{-v} and @samp{-d} options. @item -g @@ -6335,7 +6791,7 @@ be @file{foo.vcg}. @item --graph=@var{graph-file} The behavior of @var{--graph} is the same than @samp{-g}. The only difference is that it has an optional argument which is the name of -the output graph filename. +the output graph file. @end table @node Option Cross Key @@ -6357,6 +6813,7 @@ the corresponding short option. \line{ --no-lines \leaderfill -l} \line{ --no-parser \leaderfill -n} \line{ --output \leaderfill -o} +\line{ --print-localedir} \line{ --token-table \leaderfill -k} \line{ --verbose \leaderfill -v} \line{ --version \leaderfill -V} @@ -6375,6 +6832,7 @@ the corresponding short option. --no-lines -l --no-parser -n --output=@var{outfile} -o @var{outfile} +--print-localedir --token-table -k --verbose -v --version -V @@ -6408,7 +6866,692 @@ If you use the Yacc library's @code{main} function, your int yyparse (void); @end example -@c ================================================= Invoking Bison +@c ================================================= C++ Bison + +@node C++ Language Interface +@chapter C++ Language Interface + +@menu +* C++ Parsers:: The interface to generate C++ parser classes +* A Complete C++ Example:: Demonstrating their use +@end menu + +@node C++ Parsers +@section C++ Parsers + +@menu +* C++ Bison Interface:: Asking for C++ parser generation +* C++ Semantic Values:: %union vs. C++ +* C++ Location Values:: The position and location classes +* C++ Parser Interface:: Instantiating and running the parser +* C++ Scanner Interface:: Exchanges between yylex and parse +@end menu + +@node C++ Bison Interface +@subsection C++ Bison Interface +@c - %skeleton "lalr1.cc" +@c - Always pure +@c - initial action + +The C++ parser @acronym{LALR}(1) skeleton is named @file{lalr1.cc}. To select +it, you may either pass the option @option{--skeleton=lalr1.cc} to +Bison, or include the directive @samp{%skeleton "lalr1.cc"} in the +grammar preamble. When run, @command{bison} will create several +files: +@table @file +@item position.hh +@itemx location.hh +The definition of the classes @code{position} and @code{location}, +used for location tracking. @xref{C++ Location Values}. + +@item stack.hh +An auxiliary class @code{stack} used by the parser. + +@item @var{file}.hh +@itemx @var{file}.cc +The declaration and implementation of the C++ parser class. +@var{file} is the name of the output file. It follows the same +rules as with regular C parsers. + +Note that @file{@var{file}.hh} is @emph{mandatory}, the C++ cannot +work without the parser class declaration. Therefore, you must either +pass @option{-d}/@option{--defines} to @command{bison}, or use the +@samp{%defines} directive. +@end table + +All these files are documented using Doxygen; run @command{doxygen} +for a complete and accurate documentation. + +@node C++ Semantic Values +@subsection C++ Semantic Values +@c - No objects in unions +@c - YSTYPE +@c - Printer and destructor + +The @code{%union} directive works as for C, see @ref{Union Decl, ,The +Collection of Value Types}. In particular it produces a genuine +@code{union}@footnote{In the future techniques to allow complex types +within pseudo-unions (variants) might be implemented to alleviate +these issues.}, which have a few specific features in C++. +@itemize @minus +@item +The name @code{YYSTYPE} also denotes @samp{union YYSTYPE}. You may +forward declare it just with @samp{union YYSTYPE;}. +@item +Non POD (Plain Old Data) types cannot be used. C++ forbids any +instance of classes with constructors in unions: only @emph{pointers} +to such objects are allowed. +@end itemize + +Because objects have to be stored via pointers, memory is not +reclaimed automatically: using the @code{%destructor} directive is the +only means to avoid leaks. @xref{Destructor Decl, , Freeing Discarded +Symbols}. + + +@node C++ Location Values +@subsection C++ Location Values +@c - %locations +@c - class Position +@c - class Location +@c - %define "filename_type" "const symbol::Symbol" + +When the directive @code{%locations} is used, the C++ parser supports +location tracking, see @ref{Locations, , Locations Overview}. Two +auxiliary classes define a @code{position}, a single point in a file, +and a @code{location}, a range composed of a pair of +@code{position}s (possibly spanning several files). + +@deftypemethod {position} {std::string*} file +The name of the file. It will always be handled as a pointer, the +parser will never duplicate nor deallocate it. As an experimental +feature you may change it to @samp{@var{type}*} using @samp{%define +"filename_type" "@var{type}"}. +@end deftypemethod + +@deftypemethod {position} {unsigned int} line +The line, starting at 1. +@end deftypemethod + +@deftypemethod {position} {unsigned int} lines (int @var{height} = 1) +Advance by @var{height} lines, resetting the column number. +@end deftypemethod + +@deftypemethod {position} {unsigned int} column +The column, starting at 0. +@end deftypemethod + +@deftypemethod {position} {unsigned int} columns (int @var{width} = 1) +Advance by @var{width} columns, without changing the line number. +@end deftypemethod + +@deftypemethod {position} {position&} operator+= (position& @var{pos}, int @var{width}) +@deftypemethodx {position} {position} operator+ (const position& @var{pos}, int @var{width}) +@deftypemethodx {position} {position&} operator-= (const position& @var{pos}, int @var{width}) +@deftypemethodx {position} {position} operator- (position& @var{pos}, int @var{width}) +Various forms of syntactic sugar for @code{columns}. +@end deftypemethod + +@deftypemethod {position} {position} operator<< (std::ostream @var{o}, const position& @var{p}) +Report @var{p} on @var{o} like this: +@samp{@var{file}:@var{line}.@var{column}}, or +@samp{@var{line}.@var{column}} if @var{file} is null. +@end deftypemethod + +@deftypemethod {location} {position} begin +@deftypemethodx {location} {position} end +The first, inclusive, position of the range, and the first beyond. +@end deftypemethod + +@deftypemethod {location} {unsigned int} columns (int @var{width} = 1) +@deftypemethodx {location} {unsigned int} lines (int @var{height} = 1) +Advance the @code{end} position. +@end deftypemethod + +@deftypemethod {location} {location} operator+ (const location& @var{begin}, const location& @var{end}) +@deftypemethodx {location} {location} operator+ (const location& @var{begin}, int @var{width}) +@deftypemethodx {location} {location} operator+= (const location& @var{loc}, int @var{width}) +Various forms of syntactic sugar. +@end deftypemethod + +@deftypemethod {location} {void} step () +Move @code{begin} onto @code{end}. +@end deftypemethod + + +@node C++ Parser Interface +@subsection C++ Parser Interface +@c - define parser_class_name +@c - Ctor +@c - parse, error, set_debug_level, debug_level, set_debug_stream, +@c debug_stream. +@c - Reporting errors + +The output files @file{@var{output}.hh} and @file{@var{output}.cc} +declare and define the parser class in the namespace @code{yy}. The +class name defaults to @code{parser}, but may be changed using +@samp{%define "parser_class_name" "@var{name}"}. The interface of +this class is detailled below. It can be extended using the +@code{%parse-param} feature: its semantics is slightly changed since +it describes an additional member of the parser class, and an +additional argument for its constructor. + +@defcv {Type} {parser} {semantic_value_type} +@defcvx {Type} {parser} {location_value_type} +The types for semantics value and locations. +@end defcv + +@deftypemethod {parser} {} parser (@var{type1} @var{arg1}, ...) +Build a new parser object. There are no arguments by default, unless +@samp{%parse-param @{@var{type1} @var{arg1}@}} was used. +@end deftypemethod + +@deftypemethod {parser} {int} parse () +Run the syntactic analysis, and return 0 on success, 1 otherwise. +@end deftypemethod + +@deftypemethod {parser} {std::ostream&} debug_stream () +@deftypemethodx {parser} {void} set_debug_stream (std::ostream& @var{o}) +Get or set the stream used for tracing the parsing. It defaults to +@code{std::cerr}. +@end deftypemethod + +@deftypemethod {parser} {debug_level_type} debug_level () +@deftypemethodx {parser} {void} set_debug_level (debug_level @var{l}) +Get or set the tracing level. Currently its value is either 0, no trace, +or non-zero, full tracing. +@end deftypemethod + +@deftypemethod {parser} {void} error (const location_type& @var{l}, const std::string& @var{m}) +The definition for this member function must be supplied by the user: +the parser uses it to report a parser error occurring at @var{l}, +described by @var{m}. +@end deftypemethod + + +@node C++ Scanner Interface +@subsection C++ Scanner Interface +@c - prefix for yylex. +@c - Pure interface to yylex +@c - %lex-param + +The parser invokes the scanner by calling @code{yylex}. Contrary to C +parsers, C++ parsers are always pure: there is no point in using the +@code{%pure-parser} directive. Therefore the interface is as follows. + +@deftypemethod {parser} {int} yylex (semantic_value_type& @var{yylval}, location_type& @var{yylloc}, @var{type1} @var{arg1}, ...) +Return the next token. Its type is the return value, its semantic +value and location being @var{yylval} and @var{yylloc}. Invocations of +@samp{%lex-param @{@var{type1} @var{arg1}@}} yield additional arguments. +@end deftypemethod + + +@node A Complete C++ Example +@section A Complete C++ Example + +This section demonstrates the use of a C++ parser with a simple but +complete example. This example should be available on your system, +ready to compile, in the directory @dfn{../bison/examples/calc++}. It +focuses on the use of Bison, therefore the design of the various C++ +classes is very naive: no accessors, no encapsulation of members etc. +We will use a Lex scanner, and more precisely, a Flex scanner, to +demonstrate the various interaction. A hand written scanner is +actually easier to interface with. + +@menu +* Calc++ --- C++ Calculator:: The specifications +* Calc++ Parsing Driver:: An active parsing context +* Calc++ Parser:: A parser class +* Calc++ Scanner:: A pure C++ Flex scanner +* Calc++ Top Level:: Conducting the band +@end menu + +@node Calc++ --- C++ Calculator +@subsection Calc++ --- C++ Calculator + +Of course the grammar is dedicated to arithmetics, a single +expression, possibily preceded by variable assignments. An +environment containing possibly predefined variables such as +@code{one} and @code{two}, is exchanged with the parser. An example +of valid input follows. + +@example +three := 3 +seven := one + two * three +seven * seven +@end example + +@node Calc++ Parsing Driver +@subsection Calc++ Parsing Driver +@c - An env +@c - A place to store error messages +@c - A place for the result + +To support a pure interface with the parser (and the scanner) the +technique of the ``parsing context'' is convenient: a structure +containing all the data to exchange. Since, in addition to simply +launch the parsing, there are several auxiliary tasks to execute (open +the file for parsing, instantiate the parser etc.), we recommend +transforming the simple parsing context structure into a fully blown +@dfn{parsing driver} class. + +The declaration of this driver class, @file{calc++-driver.hh}, is as +follows. The first part includes the CPP guard and imports the +required standard library components. + +@comment file: calc++-driver.hh +@example +#ifndef CALCXX_DRIVER_HH +# define CALCXX_DRIVER_HH +# include +# include +@end example + +@noindent +Then come forward declarations. Because the parser uses the parsing +driver and reciprocally, simple inclusions of header files will not +do. Because the driver's declaration is the one that will be imported +by the rest of the project, it is saner to forward declare the +parser's information here. + +@comment file: calc++-driver.hh +@example +// Forward declarations. +union YYSTYPE; +namespace yy +@{ + class location; + class calcxx_parser; +@} +class calcxx_driver; +@end example + +@noindent +Then comes the declaration of the scanning function. Flex expects +the signature of @code{yylex} to be defined in the macro +@code{YY_DECL}, and the C++ parser expects it to be declared. We can +factor both as follows. + +@comment file: calc++-driver.hh +@example +// Announce to Flex the prototype we want for lexing function, ... +# define YY_DECL \ + int yylex (YYSTYPE* yylval, yy::location* yylloc, calcxx_driver& driver) +// ... and declare it for the parser's sake. +YY_DECL; +@end example + +@noindent +The @code{calcxx_driver} class is then declared with its most obvious +members. + +@comment file: calc++-driver.hh +@example +// Conducting the whole scanning and parsing of Calc++. +class calcxx_driver +@{ +public: + calcxx_driver (); + virtual ~calcxx_driver (); + + std::map variables; + + int result; +@end example + +@noindent +To encapsulate the coordination with the Flex scanner, it is useful to +have two members function to open and close the scanning phase. +members. + +@comment file: calc++-driver.hh +@example + // Handling the scanner. + void scan_begin (); + void scan_end (); + bool trace_scanning; +@end example + +@noindent +Similarly for the parser itself. + +@comment file: calc++-driver.hh +@example + // Handling the parser. + void parse (const std::string& f); + std::string file; + bool trace_parsing; +@end example + +@noindent +To demonstrate pure handling of parse errors, instead of simply +dumping them on the standard error output, we will pass them to the +compiler driver using the following two member functions. Finally, we +close the class declaration and CPP guard. + +@comment file: calc++-driver.hh +@example + // Error handling. + void error (const yy::location& l, const std::string& m); + void error (const std::string& m); +@}; +#endif // ! CALCXX_DRIVER_HH +@end example + +The implementation of the driver is straightforward. The @code{parse} +member function deserves some attention. The @code{error} functions +are simple stubs, they should actually register the located error +messages and set error state. + +@comment file: calc++-driver.cc +@example +#include "calc++-driver.hh" +#include "calc++-parser.hh" + +calcxx_driver::calcxx_driver () + : trace_scanning (false), trace_parsing (false) +@{ + variables["one"] = 1; + variables["two"] = 2; +@} + +calcxx_driver::~calcxx_driver () +@{ +@} + +void +calcxx_driver::parse (const std::string &f) +@{ + file = f; + scan_begin (); + yy::calcxx_parser parser (*this); + parser.set_debug_level (trace_parsing); + parser.parse (); + scan_end (); +@} + +void +calcxx_driver::error (const yy::location& l, const std::string& m) +@{ + std::cerr << l << ": " << m << std::endl; +@} + +void +calcxx_driver::error (const std::string& m) +@{ + std::cerr << m << std::endl; +@} +@end example + +@node Calc++ Parser +@subsection Calc++ Parser + +The parser definition file @file{calc++-parser.yy} starts by asking +for the C++ skeleton, the creation of the parser header file, and +specifies the name of the parser class. It then includes the required +headers. + +@comment file: calc++-parser.yy +@example +%skeleton "lalr1.cc" /* -*- C++ -*- */ +%define "parser_class_name" "calcxx_parser" +%defines +%@{ +# include +# include "calc++-driver.hh" +%@} +@end example + +@noindent +The driver is passed by reference to the parser and to the scanner. +This provides a simple but effective pure interface, not relying on +global variables. + +@comment file: calc++-parser.yy +@example +// The parsing context. +%parse-param @{ calcxx_driver& driver @} +%lex-param @{ calcxx_driver& driver @} +@end example + +@noindent +Then we request the location tracking feature, and initialize the +first location's file name. Afterwards new locations are computed +relatively to the previous locations: the file name will be +automatically propagated. + +@comment file: calc++-parser.yy +@example +%locations +%initial-action +@{ + // Initialize the initial location. + @@$.begin.filename = @@$.end.filename = &driver.file; +@}; +@end example + +@noindent +Use the two following directives to enable parser tracing and verbose +error messages. + +@comment file: calc++-parser.yy +@example +%debug +%error-verbose +@end example + +@noindent +Semantic values cannot use ``real'' objects, but only pointers to +them. + +@comment file: calc++-parser.yy +@example +// Symbols. +%union +@{ + int ival; + std::string *sval; +@}; +@end example + +@noindent +The token numbered as 0 corresponds to end of file; the following line +allows for nicer error messages referring to ``end of file'' instead +of ``$end''. Similarly user friendly named are provided for each +symbol. Note that the tokens names are prefixed by @code{TOKEN_} to +avoid name clashes. + +@comment file: calc++-parser.yy +@example +%token TOKEN_EOF 0 "end of file" +%token TOKEN_ASSIGN ":=" +%token TOKEN_IDENTIFIER "identifier" +%token TOKEN_NUMBER "number" +%type exp "expression" +@end example + +@noindent +To enable memory deallocation during error recovery, use +@code{%destructor}. + +@comment file: calc++-parser.yy +@example +%printer @{ debug_stream () << *$$; @} "identifier" +%destructor @{ delete $$; @} "identifier" + +%printer @{ debug_stream () << $$; @} "number" "expression" +@end example + +@noindent +The grammar itself is straightforward. + +@comment file: calc++-parser.yy +@example +%% +%start unit; +unit: assignments exp @{ driver.result = $2; @}; + +assignments: assignments assignment @{@} + | /* Nothing. */ @{@}; + +assignment: TOKEN_IDENTIFIER ":=" exp @{ driver.variables[*$1] = $3; @}; + +%left '+' '-'; +%left '*' '/'; +exp: exp '+' exp @{ $$ = $1 + $3; @} + | exp '-' exp @{ $$ = $1 - $3; @} + | exp '*' exp @{ $$ = $1 * $3; @} + | exp '/' exp @{ $$ = $1 / $3; @} + | TOKEN_IDENTIFIER @{ $$ = driver.variables[*$1]; @} + | TOKEN_NUMBER @{ $$ = $1; @}; +%% +@end example + +@noindent +Finally the @code{error} member function registers the errors to the +driver. + +@comment file: calc++-parser.yy +@example +void +yy::calcxx_parser::error (const yy::calcxx_parser::location_type& l, + const std::string& m) +@{ + driver.error (l, m); +@} +@end example + +@node Calc++ Scanner +@subsection Calc++ Scanner + +The Flex scanner first includes the driver declaration, then the +parser's to get the set of defined tokens. + +@comment file: calc++-scanner.ll +@example +%@{ /* -*- C++ -*- */ +# include +# include +# include +# include +# include "calc++-driver.hh" +# include "calc++-parser.hh" +%@} +@end example + +@noindent +Because there is no @code{#include}-like feature we don't need +@code{yywrap}, we don't need @code{unput} either, and we parse an +actual file, this is not an interactive session with the user. +Finally we enable the scanner tracing features. + +@comment file: calc++-scanner.ll +@example +%option noyywrap nounput batch debug +@end example + +@noindent +Abbreviations allow for more readable rules. + +@comment file: calc++-scanner.ll +@example +id [a-zA-Z][a-zA-Z_0-9]* +int [0-9]+ +blank [ \t] +@end example + +@noindent +The following paragraph suffices to track locations acurately. Each +time @code{yylex} is invoked, the begin position is moved onto the end +position. Then when a pattern is matched, the end position is +advanced of its width. In case it matched ends of lines, the end +cursor is adjusted, and each time blanks are matched, the begin cursor +is moved onto the end cursor to effectively ignore the blanks +preceding tokens. Comments would be treated equally. + +@comment file: calc++-scanner.ll +@example +%@{ +# define YY_USER_ACTION yylloc->columns (yyleng); +%@} +%% +%@{ + yylloc->step (); +%@} +@{blank@}+ yylloc->step (); +[\n]+ yylloc->lines (yyleng); yylloc->step (); +@end example + +@noindent +The rules are simple, just note the use of the driver to report +errors. + +@comment file: calc++-scanner.ll +@example +[-+*/] return yytext[0]; +":=" return TOKEN_ASSIGN; +@{int@} @{ + errno = 0; + long n = strtol (yytext, NULL, 10); + if (! (INT_MIN <= n && n <= INT_MAX && errno != ERANGE)) + driver.error (*yylloc, "integer is out of range"); + yylval->ival = n; + return TOKEN_NUMBER; +@} +@{id@} yylval->sval = new std::string (yytext); return TOKEN_IDENTIFIER; +. driver.error (*yylloc, "invalid character"); +%% +@end example + +@noindent +Finally, because the scanner related driver's member function depend +on the scanner's data, it is simpler to implement them in this file. + +@comment file: calc++-scanner.ll +@example +void +calcxx_driver::scan_begin () +@{ + yy_flex_debug = trace_scanning; + if (!(yyin = fopen (file.c_str (), "r"))) + error (std::string ("cannot open ") + file); +@} + +void +calcxx_driver::scan_end () +@{ + fclose (yyin); +@} +@end example + +@node Calc++ Top Level +@subsection Calc++ Top Level + +The top level file, @file{calc++.cc}, poses no problem. + +@comment file: calc++.cc +@example +#include +#include "calc++-driver.hh" + +int +main (int argc, char *argv[]) +@{ + calcxx_driver driver; + for (++argv; argv[0]; ++argv) + if (*argv == std::string ("-p")) + driver.trace_parsing = true; + else if (*argv == std::string ("-s")) + driver.trace_scanning = true; + else + @{ + driver.parse (*argv); + std::cout << driver.result << std::endl; + @} +@} +@end example + +@c ================================================= FAQ @node FAQ @chapter Frequently Asked Questions @@ -6419,18 +7562,17 @@ Several questions about Bison come up occasionally. Here some of them are addressed. @menu -* Parser Stack Overflow:: Breaking the Stack Limits +* Memory Exhausted:: Breaking the Stack Limits * How Can I Reset the Parser:: @code{yyparse} Keeps some State * Strings are Destroyed:: @code{yylval} Loses Track of Strings -* C++ Parsers:: Compiling Parsers with C++ Compilers -* Implementing Loops:: Control Flow in the Calculator +* Implementing Gotos/Loops:: Control Flow in the Calculator @end menu -@node Parser Stack Overflow -@section Parser Stack Overflow +@node Memory Exhausted +@section Memory Exhausted @display -My parser returns with error with a @samp{parser stack overflow} +My parser returns with error with a @samp{memory exhausted} message. What can I do? @end display @@ -6478,7 +7620,7 @@ yyparse (char const *file) yyin = fopen (file, "r"); if (!yyin) exit (2); - /* One token only. */ + /* One token only. */ yylex (); if (fclose (yyin) != 0) exit (3); @@ -6553,7 +7695,7 @@ char *yylval = NULL; int main () { - /* Similar to using $1, $2 in a Bison action. */ + /* Similar to using $1, $2 in a Bison action. */ char *fst = (yylex (), yylval); char *snd = (yylex (), yylval); printf ("\"%s\", \"%s\"\n", fst, snd); @@ -6587,34 +7729,12 @@ $ @kbd{printf 'one\ntwo\n' | ./split-lines} @end example -@node C++ Parsers -@section C++ Parsers - -@display -How can I generate parsers in C++? -@end display - -We are working on a C++ output for Bison, but unfortunately, for lack -of time, the skeleton is not finished. It is functional, but in -numerous respects, it will require additional work which @emph{might} -break backward compatibility. Since the skeleton for C++ is not -documented, we do not consider ourselves bound to this interface, -nevertheless, as much as possible we will try to keep compatibility. - -Another possibility is to use the regular C parsers, and to compile -them with a C++ compiler. This works properly, provided that you bear -some simple C++ rules in mind, such as not including ``real classes'' -(i.e., structure with constructors) in unions. Therefore, in the -@code{%union}, use pointers to classes, or better yet, a single -pointer type to the root of your lexical/syntactic hierarchy. - - -@node Implementing Loops -@section Implementing Loops +@node Implementing Gotos/Loops +@section Implementing Gotos/Loops @display My simple calculator supports variables, assignments, and functions, -but how can I implement loops? +but how can I implement gotos, or loops? @end display Although very pedagogical, the examples included in the document blur @@ -6667,180 +7787,44 @@ In an action, the semantic value of the @var{n}-th symbol of the right-hand side of the rule. @xref{Actions}. @end deffn +@deffn {Delimiter} %% +Delimiter used to separate the grammar rule section from the +Bison declarations section or the epilogue. +@xref{Grammar Layout, ,The Overall Layout of a Bison Grammar}. +@end deffn + +@c Don't insert spaces, or check the DVI output. +@deffn {Delimiter} %@{@var{code}%@} +All code listed between @samp{%@{} and @samp{%@}} is copied directly to +the output file uninterpreted. Such code forms the prologue of the input +file. @xref{Grammar Outline, ,Outline of a Bison +Grammar}. +@end deffn + +@deffn {Construct} /*@dots{}*/ +Comment delimiters, as in C. +@end deffn + +@deffn {Delimiter} : +Separates a rule's result from its components. @xref{Rules, ,Syntax of +Grammar Rules}. +@end deffn + +@deffn {Delimiter} ; +Terminates a rule. @xref{Rules, ,Syntax of Grammar Rules}. +@end deffn + +@deffn {Delimiter} | +Separates alternate rules for the same result nonterminal. +@xref{Rules, ,Syntax of Grammar Rules}. +@end deffn + @deffn {Symbol} $accept The predefined nonterminal whose only rule is @samp{$accept: @var{start} $end}, where @var{start} is the start symbol. @xref{Start Decl, , The Start-Symbol}. It cannot be used in the grammar. @end deffn -@deffn {Symbol} $end -The predefined token marking the end of the token stream. It cannot be -used in the grammar. -@end deffn - -@deffn {Symbol} $undefined -The predefined token onto which all undefined values returned by -@code{yylex} are mapped. It cannot be used in the grammar, rather, use -@code{error}. -@end deffn - -@deffn {Symbol} error -A token name reserved for error recovery. This token may be used in -grammar rules so as to allow the Bison parser to recognize an error in -the grammar without halting the process. In effect, a sentence -containing an error may be recognized as valid. On a syntax error, the -token @code{error} becomes the current look-ahead token. Actions -corresponding to @code{error} are then executed, and the look-ahead -token is reset to the token that originally caused the violation. -@xref{Error Recovery}. -@end deffn - -@deffn {Macro} YYABORT -Macro to pretend that an unrecoverable syntax error has occurred, by -making @code{yyparse} return 1 immediately. The error reporting -function @code{yyerror} is not called. @xref{Parser Function, ,The -Parser Function @code{yyparse}}. -@end deffn - -@deffn {Macro} YYACCEPT -Macro to pretend that a complete utterance of the language has been -read, by making @code{yyparse} return 0 immediately. -@xref{Parser Function, ,The Parser Function @code{yyparse}}. -@end deffn - -@deffn {Macro} YYBACKUP -Macro to discard a value from the parser stack and fake a look-ahead -token. @xref{Action Features, ,Special Features for Use in Actions}. -@end deffn - -@deffn {Macro} YYDEBUG -Macro to define to equip the parser with tracing code. @xref{Tracing, -,Tracing Your Parser}. -@end deffn - -@deffn {Macro} YYERROR -Macro to pretend that a syntax error has just been detected: call -@code{yyerror} and then perform normal error recovery if possible -(@pxref{Error Recovery}), or (if recovery is impossible) make -@code{yyparse} return 1. @xref{Error Recovery}. -@end deffn - -@deffn {Macro} YYERROR_VERBOSE -An obsolete macro that you define with @code{#define} in the prologue -to request verbose, specific error message strings -when @code{yyerror} is called. It doesn't matter what definition you -use for @code{YYERROR_VERBOSE}, just whether you define it. Using -@code{%error-verbose} is preferred. -@end deffn - -@deffn {Macro} YYINITDEPTH -Macro for specifying the initial size of the parser stack. -@xref{Stack Overflow}. -@end deffn - -@deffn {Macro} YYLEX_PARAM -An obsolete macro for specifying an extra argument (or list of extra -arguments) for @code{yyparse} to pass to @code{yylex}. he use of this -macro is deprecated, and is supported only for Yacc like parsers. -@xref{Pure Calling,, Calling Conventions for Pure Parsers}. -@end deffn - -@deffn {Type} YYLTYPE -Data type of @code{yylloc}; by default, a structure with four -members. @xref{Location Type, , Data Types of Locations}. -@end deffn - -@deffn {Macro} YYMAXDEPTH -Macro for specifying the maximum size of the parser stack. @xref{Stack -Overflow}. -@end deffn - -@deffn {Macro} YYPARSE_PARAM -An obsolete macro for specifying the name of a parameter that -@code{yyparse} should accept. The use of this macro is deprecated, and -is supported only for Yacc like parsers. @xref{Pure Calling,, Calling -Conventions for Pure Parsers}. -@end deffn - -@deffn {Macro} YYRECOVERING -Macro whose value indicates whether the parser is recovering from a -syntax error. @xref{Action Features, ,Special Features for Use in Actions}. -@end deffn - -@deffn {Macro} YYSTACK_USE_ALLOCA -Macro used to control the use of @code{alloca}. If defined to @samp{0}, -the parser will not use @code{alloca} but @code{malloc} when trying to -grow its internal stacks. Do @emph{not} define @code{YYSTACK_USE_ALLOCA} -to anything else. -@end deffn - -@deffn {Type} YYSTYPE -Data type of semantic values; @code{int} by default. -@xref{Value Type, ,Data Types of Semantic Values}. -@end deffn - -@deffn {Variable} yychar -External integer variable that contains the integer value of the current -look-ahead token. (In a pure parser, it is a local variable within -@code{yyparse}.) Error-recovery rule actions may examine this variable. -@xref{Action Features, ,Special Features for Use in Actions}. -@end deffn - -@deffn {Variable} yyclearin -Macro used in error-recovery rule actions. It clears the previous -look-ahead token. @xref{Error Recovery}. -@end deffn - -@deffn {Variable} yydebug -External integer variable set to zero by default. If @code{yydebug} -is given a nonzero value, the parser will output information on input -symbols and parser action. @xref{Tracing, ,Tracing Your Parser}. -@end deffn - -@deffn {Macro} yyerrok -Macro to cause parser to recover immediately to its normal mode -after a syntax error. @xref{Error Recovery}. -@end deffn - -@deffn {Function} yyerror -User-supplied function to be called by @code{yyparse} on error. -@xref{Error Reporting, ,The Error -Reporting Function @code{yyerror}}. -@end deffn - -@deffn {Function} yylex -User-supplied lexical analyzer function, called with no arguments to get -the next token. @xref{Lexical, ,The Lexical Analyzer Function -@code{yylex}}. -@end deffn - -@deffn {Variable} yylval -External variable in which @code{yylex} should place the semantic -value associated with a token. (In a pure parser, it is a local -variable within @code{yyparse}, and its address is passed to -@code{yylex}.) @xref{Token Values, ,Semantic Values of Tokens}. -@end deffn - -@deffn {Variable} yylloc -External variable in which @code{yylex} should place the line and column -numbers associated with a token. (In a pure parser, it is a local -variable within @code{yyparse}, and its address is passed to -@code{yylex}.) You can ignore this variable if you don't use the -@samp{@@} feature in the grammar actions. @xref{Token Locations, -,Textual Locations of Tokens}. -@end deffn - -@deffn {Variable} yynerrs -Global variable which Bison increments each time there is a syntax error. -(In a pure parser, it is a local variable within @code{yyparse}.) -@xref{Error Reporting, ,The Error Reporting Function @code{yyerror}}. -@end deffn - -@deffn {Function} yyparse -The parser function produced by Bison; call this function to start -parsing. @xref{Parser Function, ,The Parser Function @code{yyparse}}. -@end deffn - @deffn {Directive} %debug Equip the parser for debugging. @xref{Decl Summary}. @end deffn @@ -6859,8 +7843,8 @@ Bison declaration to create a header file meant for the scanner. @end deffn @deffn {Directive} %destructor -Specifying how the parser should reclaim the memory associated to -discarded symbols. @xref{Destructor Decl, , Freeing Discarded Symbols}. +Specify how the parser should reclaim the memory associated to +discarded symbols. @xref{Destructor Decl, , Freeing Discarded Symbols}. @end deffn @deffn {Directive} %dprec @@ -6869,6 +7853,22 @@ time to resolve reduce/reduce conflicts. @xref{GLR Parsers, ,Writing @acronym{GLR} Parsers}. @end deffn +@deffn {Symbol} $end +The predefined token marking the end of the token stream. It cannot be +used in the grammar. +@end deffn + +@deffn {Symbol} error +A token name reserved for error recovery. This token may be used in +grammar rules so as to allow the Bison parser to recognize an error in +the grammar without halting the process. In effect, a sentence +containing an error may be recognized as valid. On a syntax error, the +token @code{error} becomes the current look-ahead token. Actions +corresponding to @code{error} are then executed, and the look-ahead +token is reset to the token that originally caused the violation. +@xref{Error Recovery}. +@end deffn + @deffn {Directive} %error-verbose Bison declaration to request verbose, specific error message strings when @code{yyerror} is called. @@ -6884,6 +7884,10 @@ Bison declaration to produce a @acronym{GLR} parser. @xref{GLR Parsers, ,Writing @acronym{GLR} Parsers}. @end deffn +@deffn {Directive} %initial-action +Run user code before parsing. @xref{Initial Action Decl, , Performing Actions before Parsing}. +@end deffn + @deffn {Directive} %left Bison declaration to assign left associativity to token(s). @xref{Precedence Decl, ,Operator Precedence}. @@ -6924,7 +7928,7 @@ Bison declaration to assign non-associativity to token(s). @xref{Precedence Decl, ,Operator Precedence}. @end deffn -@deffn {Directive} %output="@var{filename}" +@deffn {Directive} %output="@var{file}" Bison declaration to set the name of the parser file. @xref{Decl Summary}. @end deffn @@ -6970,45 +7974,174 @@ Bison declaration to declare nonterminals. @xref{Type Decl, ,Nonterminal Symbols}. @end deffn +@deffn {Symbol} $undefined +The predefined token onto which all undefined values returned by +@code{yylex} are mapped. It cannot be used in the grammar, rather, use +@code{error}. +@end deffn + @deffn {Directive} %union Bison declaration to specify several possible data types for semantic values. @xref{Union Decl, ,The Collection of Value Types}. @end deffn -@sp 1 - -These are the punctuation and delimiters used in Bison input: - -@deffn {Delimiter} %% -Delimiter used to separate the grammar rule section from the -Bison declarations section or the epilogue. -@xref{Grammar Layout, ,The Overall Layout of a Bison Grammar}. +@deffn {Macro} YYABORT +Macro to pretend that an unrecoverable syntax error has occurred, by +making @code{yyparse} return 1 immediately. The error reporting +function @code{yyerror} is not called. @xref{Parser Function, ,The +Parser Function @code{yyparse}}. @end deffn -@c Don't insert spaces, or check the DVI output. -@deffn {Delimiter} %@{@var{code}%@} -All code listed between @samp{%@{} and @samp{%@}} is copied directly to -the output file uninterpreted. Such code forms the prologue of the input -file. @xref{Grammar Outline, ,Outline of a Bison -Grammar}. +@deffn {Macro} YYACCEPT +Macro to pretend that a complete utterance of the language has been +read, by making @code{yyparse} return 0 immediately. +@xref{Parser Function, ,The Parser Function @code{yyparse}}. @end deffn -@deffn {Construct} /*@dots{}*/ -Comment delimiters, as in C. +@deffn {Macro} YYBACKUP +Macro to discard a value from the parser stack and fake a look-ahead +token. @xref{Action Features, ,Special Features for Use in Actions}. @end deffn -@deffn {Delimiter} : -Separates a rule's result from its components. @xref{Rules, ,Syntax of -Grammar Rules}. +@deffn {Variable} yychar +External integer variable that contains the integer value of the current +look-ahead token. (In a pure parser, it is a local variable within +@code{yyparse}.) Error-recovery rule actions may examine this variable. +@xref{Action Features, ,Special Features for Use in Actions}. @end deffn -@deffn {Delimiter} ; -Terminates a rule. @xref{Rules, ,Syntax of Grammar Rules}. +@deffn {Variable} yyclearin +Macro used in error-recovery rule actions. It clears the previous +look-ahead token. @xref{Error Recovery}. @end deffn -@deffn {Delimiter} | -Separates alternate rules for the same result nonterminal. -@xref{Rules, ,Syntax of Grammar Rules}. +@deffn {Macro} YYDEBUG +Macro to define to equip the parser with tracing code. @xref{Tracing, +,Tracing Your Parser}. +@end deffn + +@deffn {Variable} yydebug +External integer variable set to zero by default. If @code{yydebug} +is given a nonzero value, the parser will output information on input +symbols and parser action. @xref{Tracing, ,Tracing Your Parser}. +@end deffn + +@deffn {Macro} yyerrok +Macro to cause parser to recover immediately to its normal mode +after a syntax error. @xref{Error Recovery}. +@end deffn + +@deffn {Macro} YYERROR +Macro to pretend that a syntax error has just been detected: call +@code{yyerror} and then perform normal error recovery if possible +(@pxref{Error Recovery}), or (if recovery is impossible) make +@code{yyparse} return 1. @xref{Error Recovery}. +@end deffn + +@deffn {Function} yyerror +User-supplied function to be called by @code{yyparse} on error. +@xref{Error Reporting, ,The Error +Reporting Function @code{yyerror}}. +@end deffn + +@deffn {Macro} YYERROR_VERBOSE +An obsolete macro that you define with @code{#define} in the prologue +to request verbose, specific error message strings +when @code{yyerror} is called. It doesn't matter what definition you +use for @code{YYERROR_VERBOSE}, just whether you define it. Using +@code{%error-verbose} is preferred. +@end deffn + +@deffn {Macro} YYINITDEPTH +Macro for specifying the initial size of the parser stack. +@xref{Memory Management}. +@end deffn + +@deffn {Function} yylex +User-supplied lexical analyzer function, called with no arguments to get +the next token. @xref{Lexical, ,The Lexical Analyzer Function +@code{yylex}}. +@end deffn + +@deffn {Macro} YYLEX_PARAM +An obsolete macro for specifying an extra argument (or list of extra +arguments) for @code{yyparse} to pass to @code{yylex}. he use of this +macro is deprecated, and is supported only for Yacc like parsers. +@xref{Pure Calling,, Calling Conventions for Pure Parsers}. +@end deffn + +@deffn {Variable} yylloc +External variable in which @code{yylex} should place the line and column +numbers associated with a token. (In a pure parser, it is a local +variable within @code{yyparse}, and its address is passed to +@code{yylex}.) You can ignore this variable if you don't use the +@samp{@@} feature in the grammar actions. @xref{Token Locations, +,Textual Locations of Tokens}. +@end deffn + +@deffn {Type} YYLTYPE +Data type of @code{yylloc}; by default, a structure with four +members. @xref{Location Type, , Data Types of Locations}. +@end deffn + +@deffn {Variable} yylval +External variable in which @code{yylex} should place the semantic +value associated with a token. (In a pure parser, it is a local +variable within @code{yyparse}, and its address is passed to +@code{yylex}.) @xref{Token Values, ,Semantic Values of Tokens}. +@end deffn + +@deffn {Macro} YYMAXDEPTH +Macro for specifying the maximum size of the parser stack. @xref{Memory +Management}. +@end deffn + +@deffn {Variable} yynerrs +Global variable which Bison increments each time there is a syntax error. +(In a pure parser, it is a local variable within @code{yyparse}.) +@xref{Error Reporting, ,The Error Reporting Function @code{yyerror}}. +@end deffn + +@deffn {Function} yyparse +The parser function produced by Bison; call this function to start +parsing. @xref{Parser Function, ,The Parser Function @code{yyparse}}. +@end deffn + +@deffn {Macro} YYPARSE_PARAM +An obsolete macro for specifying the name of a parameter that +@code{yyparse} should accept. The use of this macro is deprecated, and +is supported only for Yacc like parsers. @xref{Pure Calling,, Calling +Conventions for Pure Parsers}. +@end deffn + +@deffn {Macro} YYRECOVERING +Macro whose value indicates whether the parser is recovering from a +syntax error. @xref{Action Features, ,Special Features for Use in Actions}. +@end deffn + +@deffn {Macro} YYSTACK_USE_ALLOCA +Macro used to control the use of @code{alloca} when the C +@acronym{LALR}(1) parser needs to extend its stacks. If defined to 0, +the parser will use @code{malloc} to extend its stacks. If defined to +1, the parser will use @code{alloca}. Values other than 0 and 1 are +reserved for future Bison extensions. If not defined, +@code{YYSTACK_USE_ALLOCA} defaults to 0. + +If you define @code{YYSTACK_USE_ALLOCA} to 1, it is your +responsibility to make sure that @code{alloca} is visible, e.g., by +using @acronym{GCC} or by including @code{}. Furthermore, +in the all-too-common case where your code may run on a host with a +limited stack and with unreliable stack-overflow checking, you should +set @code{YYMAXDEPTH} to a value that cannot possibly result in +unchecked stack overflow on any of your target hosts when +@code{alloca} is called. You can inspect the code that Bison +generates in order to determine the proper numeric values. This will +require some expertise in low-level implementation details. +@end deffn + +@deffn {Type} YYSTYPE +Data type of semantic values; @code{int} by default. +@xref{Value Type, ,Data Types of Semantic Values}. @end deffn @node Glossary diff --git a/src/bin/bison/doc/fdl.texi b/src/bin/bison/doc/fdl.texi index e02da1459e..fe78df8d53 100644 --- a/src/bin/bison/doc/fdl.texi +++ b/src/bin/bison/doc/fdl.texi @@ -7,7 +7,7 @@ @display Copyright @copyright{} 2000,2001,2002 Free Software Foundation, Inc. -59 Temple Place, Suite 330, Boston, MA 02111-1307, USA +51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. @@ -420,8 +420,8 @@ license notices just after the title page: Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.2 or any later version published by the Free Software Foundation; - with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts. - A copy of the license is included in the section entitled ``GNU + with no Invariant Sections, no Front-Cover Texts, and no Back-Cover + Texts. A copy of the license is included in the section entitled ``GNU Free Documentation License''. @end group @end smallexample diff --git a/src/bin/bison/doc/gpl.texi b/src/bin/bison/doc/gpl.texi index 852fa5cfcb..9903fc8872 100644 --- a/src/bin/bison/doc/gpl.texi +++ b/src/bin/bison/doc/gpl.texi @@ -6,7 +6,7 @@ @display Copyright @copyright{} 1989, 1991 Free Software Foundation, Inc. -59 Temple Place - Suite 330, Boston, MA 02111-1307, USA +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. @@ -352,7 +352,7 @@ 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, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. @end smallexample Also add information on how to contact you by electronic and paper mail. diff --git a/src/bin/bison/doc/refcard.tex b/src/bin/bison/doc/refcard.tex index ead2a56382..3f2ec9b309 100644 --- a/src/bin/bison/doc/refcard.tex +++ b/src/bin/bison/doc/refcard.tex @@ -35,8 +35,8 @@ % % You should have received a copy of the GNU General Public License % along with either Flex or Bison; see the file COPYING. If not, write -% to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, -% Boston, MA 02111-1307, USA. +% to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +% Boston, MA 02110-1301, USA. % % This file is intended to be processed by plain TeX (TeX82). % @@ -96,9 +96,9 @@ For information, write to the: \vskip .2\baselineskip \centerline{Free Software Foundation, Inc.} \vskip .2\baselineskip -\centerline{59 Temple Place - Suite 330} +\centerline{51 Franklin Street, Fifth Floor} \vskip .2\baselineskip -\centerline{Boston, MA 02111-1307 USA} +\centerline{Boston, MA 02110-1301 USA} \endgroup} %%%% smallcopyrightnotice for two column printing on one page. @@ -121,9 +121,9 @@ For information, write to the: \vskip .2\baselineskip \centerline{Free Software Foundation, Inc.} \vskip .2\baselineskip -\centerline{59 Temple Place - Suite 330} +\centerline{51 Franklin Street, Fifth Floor} \vskip .2\baselineskip -\centerline{Boston, MA 02111-1307 USA} +\centerline{Boston, MA 02110-1301 USA} \endgroup} % make \bye not \outer so that the \def\bye in the \else clause below diff --git a/src/bin/bison/doc/stamp-vti b/src/bin/bison/doc/stamp-vti index 2e1d5ea4f8..29c953db1c 100644 --- a/src/bin/bison/doc/stamp-vti +++ b/src/bin/bison/doc/stamp-vti @@ -1,4 +1,4 @@ -@set UPDATED 30 March 2004 -@set UPDATED-MONTH March 2004 -@set EDITION 1.875d -@set VERSION 1.875d +@set UPDATED 16 September 2005 +@set UPDATED-MONTH September 2005 +@set EDITION 2.1 +@set VERSION 2.1 diff --git a/src/bin/bison/doc/version.texi b/src/bin/bison/doc/version.texi index 2e1d5ea4f8..29c953db1c 100644 --- a/src/bin/bison/doc/version.texi +++ b/src/bin/bison/doc/version.texi @@ -1,4 +1,4 @@ -@set UPDATED 30 March 2004 -@set UPDATED-MONTH March 2004 -@set EDITION 1.875d -@set VERSION 1.875d +@set UPDATED 16 September 2005 +@set UPDATED-MONTH September 2005 +@set EDITION 2.1 +@set VERSION 2.1 diff --git a/src/bin/bison/lib/Jamfile b/src/bin/bison/lib/Jamfile index e3f5196daf..f01ac40fe2 100644 --- a/src/bin/bison/lib/Jamfile +++ b/src/bin/bison/lib/Jamfile @@ -14,9 +14,12 @@ StaticLibrary bison : bitsetv-print.c bitsetv.c dirname.c + dup-safer.c ebitset.c error.c exitfail.c + fd-safer.c + fopen-safer.c get-errno.c getopt.c getopt1.c @@ -37,6 +40,7 @@ StaticLibrary bison : timevar.c vbitset.c xmalloc.c + xalloc-die.c xstrdup.c xstrndup.c ; diff --git a/src/bin/bison/lib/Makefile.am b/src/bin/bison/lib/Makefile.am index 9a92666efd..f4d783e264 100644 --- a/src/bin/bison/lib/Makefile.am +++ b/src/bin/bison/lib/Makefile.am @@ -12,8 +12,8 @@ ## You should have received a copy of the GNU General Public License ## along with this program; if not, write to the Free Software -## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA -## 02111-1307 USA +## Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +## 02110-1301 USA AM_CFLAGS = $(WARNING_CFLAGS) diff --git a/src/bin/bison/lib/Makefile.in b/src/bin/bison/lib/Makefile.in index 2d82903a06..e5525e35ab 100644 --- a/src/bin/bison/lib/Makefile.in +++ b/src/bin/bison/lib/Makefile.in @@ -1,8 +1,8 @@ -# Makefile.in generated by automake 1.8.5 from Makefile.am. +# Makefile.in generated by automake 1.9.6 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, -# 2003, 2004 Free Software Foundation, Inc. +# 2003, 2004, 2005 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. @@ -14,7 +14,7 @@ @SET_MAKE@ -SOURCES = $(libbison_a_SOURCES) $(liby_a_SOURCES) +# This file is generated automatically by "bootstrap". srcdir = @srcdir@ top_srcdir = @top_srcdir@ @@ -36,37 +36,54 @@ POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : +build_triplet = @build@ host_triplet = @host@ DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \ - $(srcdir)/gnulib.mk alloca.c error.c error.h malloc.c \ - obstack.c obstack.h realloc.c stpcpy.c strndup.c strnlen.c + $(srcdir)/gnulib.mk alloca.c dirname.c dirname.h dup-safer.c \ + error.c error.h exitfail.c exitfail.h fd-safer.c fopen-safer.c \ + getopt.c getopt1.c hard-locale.c hard-locale.h hash.c hash.h \ + malloc.c obstack.c obstack.h pipe-safer.c quote.c quote.h \ + quotearg.c quotearg.h stdio--.h stdio-safer.h stpcpy.c \ + strdup.c strdup.h strndup.c strndup.h strnlen.c strnlen.h \ + unistd--.h unistd-safer.h xalloc.h xmalloc.c subdir = lib ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/alloca.m4 \ + $(top_srcdir)/m4/bison-i18n.m4 $(top_srcdir)/m4/cxx.m4 \ $(top_srcdir)/m4/dirname.m4 $(top_srcdir)/m4/dmalloc.m4 \ $(top_srcdir)/m4/dos.m4 $(top_srcdir)/m4/error.m4 \ $(top_srcdir)/m4/exitfail.m4 $(top_srcdir)/m4/extensions.m4 \ - $(top_srcdir)/m4/getopt.m4 $(top_srcdir)/m4/gettext.m4 \ + $(top_srcdir)/m4/getopt.m4 $(top_srcdir)/m4/gettext_gl.m4 \ $(top_srcdir)/m4/gnulib.m4 $(top_srcdir)/m4/hard-locale.m4 \ $(top_srcdir)/m4/hash.m4 $(top_srcdir)/m4/iconv.m4 \ - $(top_srcdir)/m4/lib-ld.m4 $(top_srcdir)/m4/lib-link.m4 \ - $(top_srcdir)/m4/lib-prefix.m4 $(top_srcdir)/m4/m4.m4 \ + $(top_srcdir)/m4/inttypes_h_gl.m4 \ + $(top_srcdir)/m4/lib-ld_gl.m4 $(top_srcdir)/m4/lib-link.m4 \ + $(top_srcdir)/m4/lib-prefix_gl.m4 $(top_srcdir)/m4/m4.m4 \ $(top_srcdir)/m4/mbrtowc.m4 $(top_srcdir)/m4/mbstate_t.m4 \ $(top_srcdir)/m4/mbswidth.m4 $(top_srcdir)/m4/nls.m4 \ $(top_srcdir)/m4/obstack.m4 $(top_srcdir)/m4/onceonly.m4 \ - $(top_srcdir)/m4/po.m4 $(top_srcdir)/m4/progtest.m4 \ + $(top_srcdir)/m4/po_gl.m4 $(top_srcdir)/m4/progtest.m4 \ $(top_srcdir)/m4/quote.m4 $(top_srcdir)/m4/quotearg.m4 \ - $(top_srcdir)/m4/stdbool.m4 $(top_srcdir)/m4/stpcpy.m4 \ - $(top_srcdir)/m4/strndup.m4 $(top_srcdir)/m4/strnlen.m4 \ - $(top_srcdir)/m4/subpipe.m4 $(top_srcdir)/m4/timevar.m4 \ - $(top_srcdir)/m4/unlocked-io.m4 $(top_srcdir)/m4/warning.m4 \ + $(top_srcdir)/m4/stdbool.m4 $(top_srcdir)/m4/stdint_h_gl.m4 \ + $(top_srcdir)/m4/stdio-safer.m4 $(top_srcdir)/m4/stpcpy.m4 \ + $(top_srcdir)/m4/strdup.m4 $(top_srcdir)/m4/strndup.m4 \ + $(top_srcdir)/m4/strnlen.m4 $(top_srcdir)/m4/subpipe.m4 \ + $(top_srcdir)/m4/timevar.m4 $(top_srcdir)/m4/uintmax_t_gl.m4 \ + $(top_srcdir)/m4/ulonglong_gl.m4 \ + $(top_srcdir)/m4/unistd-safer.m4 $(top_srcdir)/m4/warning.m4 \ $(top_srcdir)/m4/xalloc.m4 $(top_srcdir)/m4/xstrndup.m4 \ $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) -mkinstalldirs = $(SHELL) $(top_srcdir)/config/mkinstalldirs +mkinstalldirs = $(SHELL) $(top_srcdir)/build-aux/mkinstalldirs CONFIG_HEADER = $(top_builddir)/config.h CONFIG_CLEAN_FILES = +am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; +am__vpath_adj = case $$p in \ + $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ + *) f=$$p;; \ + esac; +am__strip_dir = `echo $$p | sed -e 's|^.*/||'`; am__installdirs = "$(DESTDIR)$(libdir)" libLIBRARIES_INSTALL = $(INSTALL_DATA) LIBRARIES = $(lib_LIBRARIES) $(noinst_LIBRARIES) @@ -82,11 +99,8 @@ am__objects_2 = bitsetv-print.$(OBJEXT) am__objects_3 = timevar.$(OBJEXT) am__objects_4 = get-errno.$(OBJEXT) subpipe.$(OBJEXT) $(am__objects_1) \ $(am__objects_2) $(am__objects_3) argmatch.$(OBJEXT) \ - dirname.$(OBJEXT) basename.$(OBJEXT) stripslash.$(OBJEXT) \ - exitfail.$(OBJEXT) getopt.$(OBJEXT) getopt1.$(OBJEXT) \ - hard-locale.$(OBJEXT) hash.$(OBJEXT) mbswidth.$(OBJEXT) \ - quote.$(OBJEXT) quotearg.$(OBJEXT) xmalloc.$(OBJEXT) \ - xstrdup.$(OBJEXT) xstrndup.$(OBJEXT) + basename.$(OBJEXT) stripslash.$(OBJEXT) mbswidth.$(OBJEXT) \ + xalloc-die.$(OBJEXT) xstrndup.$(OBJEXT) am_libbison_a_OBJECTS = $(am__objects_4) libbison_a_OBJECTS = $(am_libbison_a_OBJECTS) liby_a_AR = $(AR) $(ARFLAGS) @@ -94,27 +108,8 @@ liby_a_LIBADD = am_liby_a_OBJECTS = main.$(OBJEXT) yyerror.$(OBJEXT) liby_a_OBJECTS = $(am_liby_a_OBJECTS) DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir) -depcomp = $(SHELL) $(top_srcdir)/config/depcomp +depcomp = $(SHELL) $(top_srcdir)/build-aux/depcomp am__depfiles_maybe = depfiles -@AMDEP_TRUE@DEP_FILES = $(DEPDIR)/alloca.Po $(DEPDIR)/error.Po \ -@AMDEP_TRUE@ $(DEPDIR)/malloc.Po $(DEPDIR)/obstack.Po \ -@AMDEP_TRUE@ $(DEPDIR)/realloc.Po $(DEPDIR)/stpcpy.Po \ -@AMDEP_TRUE@ $(DEPDIR)/strndup.Po $(DEPDIR)/strnlen.Po \ -@AMDEP_TRUE@ ./$(DEPDIR)/abitset.Po ./$(DEPDIR)/argmatch.Po \ -@AMDEP_TRUE@ ./$(DEPDIR)/basename.Po ./$(DEPDIR)/bitset.Po \ -@AMDEP_TRUE@ ./$(DEPDIR)/bitset_stats.Po \ -@AMDEP_TRUE@ ./$(DEPDIR)/bitsetv-print.Po \ -@AMDEP_TRUE@ ./$(DEPDIR)/bitsetv.Po ./$(DEPDIR)/dirname.Po \ -@AMDEP_TRUE@ ./$(DEPDIR)/ebitset.Po ./$(DEPDIR)/exitfail.Po \ -@AMDEP_TRUE@ ./$(DEPDIR)/get-errno.Po ./$(DEPDIR)/getopt.Po \ -@AMDEP_TRUE@ ./$(DEPDIR)/getopt1.Po ./$(DEPDIR)/hard-locale.Po \ -@AMDEP_TRUE@ ./$(DEPDIR)/hash.Po ./$(DEPDIR)/lbitset.Po \ -@AMDEP_TRUE@ ./$(DEPDIR)/main.Po ./$(DEPDIR)/mbswidth.Po \ -@AMDEP_TRUE@ ./$(DEPDIR)/quote.Po ./$(DEPDIR)/quotearg.Po \ -@AMDEP_TRUE@ ./$(DEPDIR)/stripslash.Po ./$(DEPDIR)/subpipe.Po \ -@AMDEP_TRUE@ ./$(DEPDIR)/timevar.Po ./$(DEPDIR)/vbitset.Po \ -@AMDEP_TRUE@ ./$(DEPDIR)/xmalloc.Po ./$(DEPDIR)/xstrdup.Po \ -@AMDEP_TRUE@ ./$(DEPDIR)/xstrndup.Po ./$(DEPDIR)/yyerror.Po COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) CCLD = $(CC) @@ -135,6 +130,8 @@ AUTOHEADER = @AUTOHEADER@ AUTOM4TE = @AUTOM4TE@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ +BISON_CXX_WORKS = @BISON_CXX_WORKS@ +BISON_LOCALEDIR = @BISON_LOCALEDIR@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ @@ -152,6 +149,7 @@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ GCC = @GCC@ +GETOPT_H = @GETOPT_H@ GMSGFMT = @GMSGFMT@ HAVE__BOOL = @HAVE__BOOL@ INSTALL_DATA = @INSTALL_DATA@ @@ -159,6 +157,7 @@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ INTLLIBS = @INTLLIBS@ +INTL_MACOSX_LIBS = @INTL_MACOSX_LIBS@ LDFLAGS = @LDFLAGS@ LEX = @LEX@ LEXLIB = @LEXLIB@ @@ -176,6 +175,7 @@ MKINSTALLDIRS = @MKINSTALLDIRS@ MSGFMT = @MSGFMT@ MSGMERGE = @MSGMERGE@ O0CFLAGS = @O0CFLAGS@ +O0CXXFLAGS = @O0CXXFLAGS@ OBJEXT = @OBJEXT@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ @@ -204,6 +204,7 @@ ac_ct_CC = @ac_ct_CC@ ac_ct_CXX = @ac_ct_CXX@ ac_ct_RANLIB = @ac_ct_RANLIB@ ac_ct_STRIP = @ac_ct_STRIP@ +aclocaldir = @aclocaldir@ am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@ @@ -211,6 +212,8 @@ am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ @@ -240,21 +243,20 @@ sharedstatedir = @sharedstatedir@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ AM_CFLAGS = $(WARNING_CFLAGS) - -# This file is generated automatically by "bootstrap". -BUILT_SOURCES = $(ALLOCA_H) $(STDBOOL_H) -EXTRA_DIST = alloca_.h stdbool_.h -MOSTLYCLEANFILES = alloca.h alloca.h-t stdbool.h stdbool.h-t +BUILT_SOURCES = $(ALLOCA_H) $(GETOPT_H) $(STDBOOL_H) +EXTRA_DIST = alloca_.h getopt_.h getopt_int.h stdbool_.h +MOSTLYCLEANFILES = alloca.h alloca.h-t getopt.h getopt.h-t stdbool.h \ + stdbool.h-t lib_LIBRARIES = $(YACC_LIBRARY) EXTRA_LIBRARIES = liby.a noinst_LIBRARIES = libbison.a liby_a_SOURCES = main.c yyerror.c libbison_a_SOURCES = $(lib_SOURCES) -lib_SOURCES = \ - get-errno.h get-errno.c \ - subpipe.h subpipe.c \ - $(bitsets_sources) $(additional_bitsets_sources) $(timevars_sources)\ -argmatch.h argmatch.c dirname.h dirname.c basename.c stripslash.c exit.h exitfail.h exitfail.c getopt.h getopt.c getopt1.c getopt_int.h gettext.h hard-locale.h hard-locale.c hash.h hash.c mbswidth.h mbswidth.c quote.h quote.c quotearg.h quotearg.c stpcpy.h strndup.h unlocked-io.h xalloc.h xmalloc.c xstrdup.c xstrndup.h xstrndup.c +lib_SOURCES = get-errno.h get-errno.c subpipe.h subpipe.c \ + $(bitsets_sources) $(additional_bitsets_sources) \ + $(timevars_sources) argmatch.h argmatch.c basename.c \ + stripslash.c exit.h gettext.h mbswidth.h mbswidth.c stpcpy.h \ + xalloc-die.c xstrndup.h xstrndup.c # Implementation of bitsets bitsets_sources = \ @@ -313,7 +315,7 @@ install-libLIBRARIES: $(lib_LIBRARIES) test -z "$(libdir)" || $(mkdir_p) "$(DESTDIR)$(libdir)" @list='$(lib_LIBRARIES)'; for p in $$list; do \ if test -f $$p; then \ - f="`echo $$p | sed -e 's|^.*/||'`"; \ + f=$(am__strip_dir) \ echo " $(libLIBRARIES_INSTALL) '$$p' '$(DESTDIR)$(libdir)/$$f'"; \ $(libLIBRARIES_INSTALL) "$$p" "$(DESTDIR)$(libdir)/$$f"; \ else :; fi; \ @@ -321,7 +323,7 @@ install-libLIBRARIES: $(lib_LIBRARIES) @$(POST_INSTALL) @list='$(lib_LIBRARIES)'; for p in $$list; do \ if test -f $$p; then \ - p="`echo $$p | sed -e 's|^.*/||'`"; \ + p=$(am__strip_dir) \ echo " $(RANLIB) '$(DESTDIR)$(libdir)/$$p'"; \ $(RANLIB) "$(DESTDIR)$(libdir)/$$p"; \ else :; fi; \ @@ -330,7 +332,7 @@ install-libLIBRARIES: $(lib_LIBRARIES) uninstall-libLIBRARIES: @$(NORMAL_UNINSTALL) @list='$(lib_LIBRARIES)'; for p in $$list; do \ - p="`echo $$p | sed -e 's|^.*/||'`"; \ + p=$(am__strip_dir) \ echo " rm -f '$(DESTDIR)$(libdir)/$$p'"; \ rm -f "$(DESTDIR)$(libdir)/$$p"; \ done @@ -356,13 +358,26 @@ distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/alloca.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/dirname.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/dup-safer.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/error.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/exitfail.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/fd-safer.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/fopen-safer.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/getopt.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/getopt1.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/hard-locale.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/hash.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/malloc.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/obstack.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/realloc.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/pipe-safer.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/quote.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/quotearg.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/stpcpy.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/strdup.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/strndup.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/strnlen.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/xmalloc.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/abitset.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/argmatch.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/basename.Po@am__quote@ @@ -370,25 +385,16 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/bitset_stats.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/bitsetv-print.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/bitsetv.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dirname.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ebitset.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/exitfail.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/get-errno.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/getopt.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/getopt1.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/hard-locale.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/hash.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lbitset.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/main.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mbswidth.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/quote.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/quotearg.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/stripslash.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/subpipe.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/timevar.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/vbitset.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xmalloc.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xstrdup.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xalloc-die.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xstrndup.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/yyerror.Po@am__quote@ @@ -396,16 +402,14 @@ distclean-compile: @am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ @am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(COMPILE) -c $< .c.obj: @am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \ @am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` uninstall-info-am: @@ -513,7 +517,7 @@ mostlyclean-generic: clean-generic: distclean-generic: - -rm -f $(CONFIG_CLEAN_FILES) + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @@ -582,16 +586,20 @@ uninstall-am: uninstall-info-am uninstall-libLIBRARIES uninstall-libLIBRARIES -# We need the following in order to create an when the system +# We need the following in order to create when the system # doesn't have one that works with the given compiler. -all-local $(lib_OBJECTS): $(ALLOCA_H) alloca.h: alloca_.h cp $(srcdir)/alloca_.h $@-t mv $@-t $@ -# We need the following in order to create an when the system +# We need the following in order to create when the system +# doesn't have one that works with the given compiler. +getopt.h: getopt_.h + cp $(srcdir)/getopt_.h $@-t + mv $@-t $@ + +# We need the following in order to create when the system # doesn't have one that works. -all-local $(lib_OBJECTS): $(STDBOOL_H) stdbool.h: stdbool_.h sed -e 's/@''HAVE__BOOL''@/$(HAVE__BOOL)/g' < $(srcdir)/stdbool_.h > $@-t mv $@-t $@ diff --git a/src/bin/bison/lib/abitset.c b/src/bin/bison/lib/abitset.c index 0fe1b47bbb..ec5bf6a0f1 100644 --- a/src/bin/bison/lib/abitset.c +++ b/src/bin/bison/lib/abitset.c @@ -14,7 +14,7 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #ifdef HAVE_CONFIG_H diff --git a/src/bin/bison/lib/abitset.h b/src/bin/bison/lib/abitset.h index 728891106d..a22c9191ce 100644 --- a/src/bin/bison/lib/abitset.h +++ b/src/bin/bison/lib/abitset.h @@ -14,10 +14,10 @@ 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, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ +Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #ifndef _ABITSET_H -#define _ABITSET_H +#define _ABITSET_H #include "bitset.h" diff --git a/src/bin/bison/lib/alloca_.h b/src/bin/bison/lib/alloca_.h index 8a91698c54..3e3fdf43f8 100644 --- a/src/bin/bison/lib/alloca_.h +++ b/src/bin/bison/lib/alloca_.h @@ -15,15 +15,13 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -/* When this file is included, it may be preceded only by preprocessor - declarations. Thanks to AIX. Therefore we include it right after - "config.h", not later. */ - -#ifndef _ALLOCA_H -# define _ALLOCA_H +/* Avoid using the symbol _ALLOCA_H here, as Bison assumes _ALLOCA_H + means there is a real alloca function. */ +#ifndef _GNULIB_ALLOCA_H +# define _GNULIB_ALLOCA_H /* alloca (N) returns a pointer to N bytes of memory allocated on the stack, which will last until the function returns. @@ -39,7 +37,7 @@ #ifdef __GNUC__ # define alloca __builtin_alloca #elif defined _AIX -# define alloca __alloca +# define alloca __alloca #elif defined _MSC_VER # include # define alloca _alloca @@ -51,4 +49,4 @@ extern "C" void *alloca (size_t); #endif -#endif /* _ALLOCA_H */ +#endif /* _GNULIB_ALLOCA_H */ diff --git a/src/bin/bison/lib/argmatch.c b/src/bin/bison/lib/argmatch.c index 210689ba3f..db883ac41c 100644 --- a/src/bin/bison/lib/argmatch.c +++ b/src/bin/bison/lib/argmatch.c @@ -1,6 +1,6 @@ /* argmatch.c -- find a match for a string in an array - Copyright (C) 1990, 1998, 1999, 2001, 2002, 2003, 2004 Free + Copyright (C) 1990, 1998, 1999, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify @@ -15,7 +15,7 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, - Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ /* Written by David MacKenzie Modified by Akim Demaille */ @@ -27,6 +27,7 @@ /* Specification. */ #include "argmatch.h" +#include #include #include #include @@ -38,7 +39,10 @@ #include "exit.h" #include "quotearg.h" #include "quote.h" -#include "unlocked-io.h" + +#if USE_UNLOCKED_IO +# include "unlocked-io.h" +#endif /* When reporting an invalid argument, show nonprinting characters by using the quoting style ARGMATCH_QUOTING_STYLE. Do not use @@ -69,7 +73,7 @@ argmatch_exit_fn argmatch_die = __argmatch_die; /* If ARG is an unambiguous match for an element of the - null-terminated array ARGLIST, return the index in ARGLIST + NULL-terminated array ARGLIST, return the index in ARGLIST of the matched element, else -1 if it does not match any element or -2 if it is ambiguous (is a prefix of more than one element). @@ -79,14 +83,14 @@ argmatch_exit_fn argmatch_die = __argmatch_die; "no", "nope" -> 1 "y" is a valid argument, for `0', and "n" for `1'. */ -int +ptrdiff_t argmatch (const char *arg, const char *const *arglist, const char *vallist, size_t valsize) { - int i; /* Temporary index in ARGLIST. */ + size_t i; /* Temporary index in ARGLIST. */ size_t arglen; /* Length of ARG. */ - int matchind = -1; /* Index of first nonexact match. */ - int ambiguous = 0; /* If nonzero, multiple nonexact match(es). */ + ptrdiff_t matchind = -1; /* Index of first nonexact match. */ + bool ambiguous = false; /* If true, multiple nonexact match(es). */ arglen = strlen (arg); @@ -110,7 +114,7 @@ argmatch (const char *arg, const char *const *arglist, { /* There is a real ambiguity, or we could not disambiguate. */ - ambiguous = 1; + ambiguous = true; } } } @@ -127,7 +131,7 @@ argmatch (const char *arg, const char *const *arglist, PROBLEM is the return value from argmatch. */ void -argmatch_invalid (const char *context, const char *value, int problem) +argmatch_invalid (const char *context, const char *value, ptrdiff_t problem) { char const *format = (problem == -1 ? _("invalid argument %s for %s") @@ -145,7 +149,7 @@ void argmatch_valid (const char *const *arglist, const char *vallist, size_t valsize) { - int i; + size_t i; const char *last_val = NULL; /* We try to put synonyms on the same line. The assumption is that @@ -171,13 +175,13 @@ argmatch_valid (const char *const *arglist, "--version-control", or "$VERSION_CONTROL" etc.). Upon failure, calls the (supposed never to return) function EXIT_FN. */ -int +ptrdiff_t __xargmatch_internal (const char *context, const char *arg, const char *const *arglist, const char *vallist, size_t valsize, argmatch_exit_fn exit_fn) { - int res = argmatch (arg, arglist, vallist, valsize); + ptrdiff_t res = argmatch (arg, arglist, vallist, valsize); if (res >= 0) /* Success. */ return res; @@ -197,7 +201,7 @@ argmatch_to_argument (const char *value, const char *const *arglist, const char *vallist, size_t valsize) { - int i; + size_t i; for (i = 0; arglist[i]; i++) if (!memcmp (value, vallist + valsize * i, valsize)) @@ -215,17 +219,17 @@ char *program_name; enum backup_type { /* Never make backups. */ - none, + no_backups, /* Make simple backups of every file. */ - simple, + simple_backups, /* Make numbered backups of files that already have numbered backups, and simple backups of the others. */ - numbered_existing, + numbered_existing_backups, /* Make numbered backups of every file. */ - numbered + numbered_backups }; /* Two tables describing arguments (keys) and their corresponding @@ -241,17 +245,17 @@ static const char *const backup_args[] = static const enum backup_type backup_vals[] = { - none, none, none, - simple, simple, - numbered_existing, numbered_existing, - numbered, numbered + no_backups, no_backups, no_backups, + simple_backups, simple_backups, + numbered_existing_backups, numbered_existing_backups, + numbered_backups, numbered_backups }; int main (int argc, const char *const *argv) { const char *cp; - enum backup_type backup_type = none; + enum backup_type backup_type = no_backups; program_name = (char *) argv[0]; diff --git a/src/bin/bison/lib/argmatch.h b/src/bin/bison/lib/argmatch.h index e8bb23c667..ea0f46800e 100644 --- a/src/bin/bison/lib/argmatch.h +++ b/src/bin/bison/lib/argmatch.h @@ -15,7 +15,7 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, - Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ /* Written by David MacKenzie Modified by Akim Demaille */ @@ -49,8 +49,8 @@ false ambiguities (i.e., different matches of ARG but corresponding to the same values in VALLIST). */ -int argmatch (char const *arg, char const *const *arglist, - char const *vallist, size_t valsize); +ptrdiff_t argmatch (char const *arg, char const *const *arglist, + char const *vallist, size_t valsize); # define ARGMATCH(Arg, Arglist, Vallist) \ argmatch (Arg, Arglist, (char const *) (Vallist), sizeof *(Vallist)) @@ -63,7 +63,8 @@ extern argmatch_exit_fn argmatch_die; /* Report on stderr why argmatch failed. Report correct values. */ -void argmatch_invalid (char const *context, char const *value, int problem); +void argmatch_invalid (char const *context, char const *value, + ptrdiff_t problem); /* Left for compatibility with the old name invalid_arg */ @@ -85,10 +86,10 @@ void argmatch_valid (char const *const *arglist, /* Same as argmatch, but upon failure, reports a explanation on the failure, and exits using the function EXIT_FN. */ -int __xargmatch_internal (char const *context, - char const *arg, char const *const *arglist, - char const *vallist, size_t valsize, - argmatch_exit_fn exit_fn); +ptrdiff_t __xargmatch_internal (char const *context, + char const *arg, char const *const *arglist, + char const *vallist, size_t valsize, + argmatch_exit_fn exit_fn); /* Programmer friendly interface to __xargmatch_internal. */ diff --git a/src/bin/bison/lib/basename.c b/src/bin/bison/lib/basename.c index 5ff2989330..00adc0015e 100644 --- a/src/bin/bison/lib/basename.c +++ b/src/bin/bison/lib/basename.c @@ -1,7 +1,7 @@ -/* basename.c -- return the last element in a path +/* basename.c -- return the last element in a file name - Copyright (C) 1990, 1998, 1999, 2000, 2001, 2003 Free Software - Foundation, Inc. + Copyright (C) 1990, 1998, 1999, 2000, 2001, 2003, 2004, 2005 Free + Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -15,7 +15,7 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, - Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #if HAVE_CONFIG_H # include @@ -35,7 +35,7 @@ char * base_name (char const *name) { - char const *base = name + FILESYSTEM_PREFIX_LEN (name); + char const *base = name + FILE_SYSTEM_PREFIX_LEN (name); char const *p; for (p = base; *p; p++) diff --git a/src/bin/bison/lib/bbitset.h b/src/bin/bison/lib/bbitset.h index 4a9367452f..f06a4e2733 100644 --- a/src/bin/bison/lib/bbitset.h +++ b/src/bin/bison/lib/bbitset.h @@ -14,7 +14,7 @@ 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, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ +Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #ifndef _BBITSET_H #define _BBITSET_H @@ -34,7 +34,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ BITSET_TABLE: Expandable table of pointers to arrays of bits (variable size, less storage for large sparse sets). Faster than BITSET_LIST for random access. - BITSET_VARRAY: Variable array of bits (variable size, fast for + BITSET_VARRAY: Variable array of bits (variable size, fast for dense bitsets). BITSET_STATS: Wrapper bitset for internal use only. Used for gathering statistics and/or better run-time checking. diff --git a/src/bin/bison/lib/bitset.c b/src/bin/bison/lib/bitset.c index 93fe75d33b..ddbef84366 100644 --- a/src/bin/bison/lib/bitset.c +++ b/src/bin/bison/lib/bitset.c @@ -1,5 +1,5 @@ /* General bitsets. - Copyright (C) 2002, 2003, 2004 Free Software Foundation, Inc. + Copyright (C) 2002, 2003, 2004, 2005 Free Software Foundation, Inc. Contributed by Michael Hayes (m.hayes@elec.canterbury.ac.nz). This program is free software; you can redistribute it and/or modify @@ -14,7 +14,7 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #ifdef HAVE_CONFIG_H #include "config.h" @@ -111,7 +111,7 @@ bitset_type_choose (bitset_bindex n_bits ATTRIBUTE_UNUSED, unsigned int attr) /* Choose the type of bitset. Note that sometimes we will be asked for a zero length fixed size bitset. */ - + /* If no attributes selected, choose a good compromise. */ if (!attr) return BITSET_VARRAY; @@ -138,7 +138,7 @@ bitset_alloc (bitset_bindex n_bits, enum bitset_type type) bytes = bitset_bytes (type, n_bits); - bset = (bitset) xcalloc (1, bytes); + bset = xcalloc (1, bytes); /* The cache is disabled until some elements are allocated. If we have variable length arrays, then we may need to allocate a dummy @@ -307,7 +307,7 @@ bitset_print (FILE *file, bitset bset, bool verbose) pos = 0; } - fprintf (file, "%d ", i); + fprintf (file, "%lu ", (unsigned long int) i); pos += 1 + (i >= 10) + (i >= 100); }; diff --git a/src/bin/bison/lib/bitset.h b/src/bin/bison/lib/bitset.h index 3f13ffd4e4..0b6aa6b336 100644 --- a/src/bin/bison/lib/bitset.h +++ b/src/bin/bison/lib/bitset.h @@ -14,7 +14,7 @@ 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, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ +Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #ifndef _BITSET_H #define _BITSET_H @@ -309,8 +309,8 @@ extern void bitset_dump (FILE *, bitset); */ #define BITSET_FOR_EACH(ITER, BSET, INDEX, MIN) \ for (ITER.next = (MIN), ITER.num = BITSET_LIST_SIZE; \ - (ITER.num == BITSET_LIST_SIZE) \ - && (ITER.num = bitset_list (BSET, ITER.list, \ + (ITER.num == BITSET_LIST_SIZE) \ + && (ITER.num = bitset_list (BSET, ITER.list, \ BITSET_LIST_SIZE, &ITER.next));) \ for (ITER.i = 0; \ ITER.i < ITER.num && ((INDEX) = ITER.list[ITER.i], 1); \ @@ -331,7 +331,7 @@ extern void bitset_dump (FILE *, bitset); */ #define BITSET_FOR_EACH_REVERSE(ITER, BSET, INDEX, MIN) \ for (ITER.next = (MIN), ITER.num = BITSET_LIST_SIZE; \ - (ITER.num == BITSET_LIST_SIZE) \ + (ITER.num == BITSET_LIST_SIZE) \ && (ITER.num = bitset_list_reverse (BSET, ITER.list, \ BITSET_LIST_SIZE, &ITER.next));) \ for (ITER.i = 0; \ @@ -371,10 +371,10 @@ extern void bitset_stats_enable (void); extern void bitset_stats_disable (void); /* Read bitset stats file of accummulated stats. */ -void bitset_stats_read (const char *filename); +void bitset_stats_read (const char *file_name); /* Write bitset stats file of accummulated stats. */ -void bitset_stats_write (const char *filename); +void bitset_stats_write (const char *file_name); /* Dump bitset stats. */ extern void bitset_stats_dump (FILE *); @@ -386,4 +386,3 @@ extern void debug_bitset (bitset); extern void debug_bitset_stats (void); #endif /* _BITSET_H */ - diff --git a/src/bin/bison/lib/bitset_stats.c b/src/bin/bison/lib/bitset_stats.c index 70acd977de..0b59865d7f 100644 --- a/src/bin/bison/lib/bitset_stats.c +++ b/src/bin/bison/lib/bitset_stats.c @@ -1,5 +1,5 @@ /* Bitset statistics. - Copyright (C) 2002, 2003, 2004 Free Software Foundation, Inc. + Copyright (C) 2002, 2003, 2004, 2005 Free Software Foundation, Inc. Contributed by Michael Hayes (m.hayes@elec.canterbury.ac.nz). This program is free software; you can redistribute it and/or modify @@ -14,7 +14,7 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ /* This file is a wrapper bitset implementation for the other bitset @@ -50,29 +50,29 @@ /* Accessor macros. */ -#define BITSET_STATS_ALLOCS_INC(TYPE) \ +#define BITSET_STATS_ALLOCS_INC(TYPE) \ bitset_stats_info->types[(TYPE)].allocs++ -#define BITSET_STATS_FREES_INC(BSET) \ +#define BITSET_STATS_FREES_INC(BSET) \ bitset_stats_info->types[BITSET_TYPE_ (BSET)].frees++ -#define BITSET_STATS_SETS_INC(BSET) \ +#define BITSET_STATS_SETS_INC(BSET) \ bitset_stats_info->types[BITSET_TYPE_ (BSET)].sets++ -#define BITSET_STATS_CACHE_SETS_INC(BSET) \ +#define BITSET_STATS_CACHE_SETS_INC(BSET) \ bitset_stats_info->types[BITSET_TYPE_ (BSET)].cache_sets++ -#define BITSET_STATS_RESETS_INC(BSET) \ +#define BITSET_STATS_RESETS_INC(BSET) \ bitset_stats_info->types[BITSET_TYPE_ (BSET)].resets++ -#define BITSET_STATS_CACHE_RESETS_INC(BSET) \ +#define BITSET_STATS_CACHE_RESETS_INC(BSET) \ bitset_stats_info->types[BITSET_TYPE_ (BSET)].cache_resets++ -#define BITSET_STATS_TESTS_INC(BSET) \ +#define BITSET_STATS_TESTS_INC(BSET) \ bitset_stats_info->types[BITSET_TYPE_ (BSET)].tests++ -#define BITSET_STATS_CACHE_TESTS_INC(BSET) \ +#define BITSET_STATS_CACHE_TESTS_INC(BSET) \ bitset_stats_info->types[BITSET_TYPE_ (BSET)].cache_tests++ -#define BITSET_STATS_LISTS_INC(BSET) \ +#define BITSET_STATS_LISTS_INC(BSET) \ bitset_stats_info->types[BITSET_TYPE_ (BSET)].lists++ -#define BITSET_STATS_LIST_COUNTS_INC(BSET, I) \ +#define BITSET_STATS_LIST_COUNTS_INC(BSET, I) \ bitset_stats_info->types[BITSET_TYPE_ (BSET)].list_counts[(I)]++ -#define BITSET_STATS_LIST_SIZES_INC(BSET, I) \ +#define BITSET_STATS_LIST_SIZES_INC(BSET, I) \ bitset_stats_info->types[BITSET_TYPE_ (BSET)].list_sizes[(I)]++ -#define BITSET_STATS_LIST_DENSITY_INC(BSET, I) \ +#define BITSET_STATS_LIST_DENSITY_INC(BSET, I) \ bitset_stats_info->types[BITSET_TYPE_ (BSET)].list_density[(I)]++ @@ -241,17 +241,17 @@ bitset_stats_disable (void) /* Read bitset statistics file. */ void -bitset_stats_read (const char *filename) +bitset_stats_read (const char *file_name) { FILE *file; if (!bitset_stats_info) return; - if (!filename) - filename = BITSET_STATS_FILE; + if (!file_name) + file_name = BITSET_STATS_FILE; - file = fopen (filename, "r"); + file = fopen (file_name, "r"); if (file) { if (fread (&bitset_stats_info_data, sizeof (bitset_stats_info_data), @@ -271,17 +271,17 @@ bitset_stats_read (const char *filename) /* Write bitset statistics file. */ void -bitset_stats_write (const char *filename) +bitset_stats_write (const char *file_name) { FILE *file; if (!bitset_stats_info) return; - if (!filename) - filename = BITSET_STATS_FILE; + if (!file_name) + file_name = BITSET_STATS_FILE; - file = fopen (filename, "w"); + file = fopen (file_name, "w"); if (file) { if (fwrite (&bitset_stats_info_data, sizeof (bitset_stats_info_data), @@ -698,25 +698,25 @@ bitset_stats_init (bitset bset, bitset_bindex n_bits, enum bitset_type type) { case BITSET_ARRAY: bytes = abitset_bytes (n_bits); - sbset = (bitset) xcalloc (1, bytes); + sbset = xcalloc (1, bytes); abitset_init (sbset, n_bits); break; case BITSET_LIST: bytes = lbitset_bytes (n_bits); - sbset = (bitset) xcalloc (1, bytes); + sbset = xcalloc (1, bytes); lbitset_init (sbset, n_bits); break; case BITSET_TABLE: bytes = ebitset_bytes (n_bits); - sbset = (bitset) xcalloc (1, bytes); + sbset = xcalloc (1, bytes); ebitset_init (sbset, n_bits); break; case BITSET_VARRAY: bytes = vbitset_bytes (n_bits); - sbset = (bitset) xcalloc (1, bytes); + sbset = xcalloc (1, bytes); vbitset_init (sbset, n_bits); break; diff --git a/src/bin/bison/lib/bitset_stats.h b/src/bin/bison/lib/bitset_stats.h index 2614c22fb5..6378c5cac1 100644 --- a/src/bin/bison/lib/bitset_stats.h +++ b/src/bin/bison/lib/bitset_stats.h @@ -14,7 +14,7 @@ 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, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ +Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #ifndef _BITSET_STATS_H #define _BITSET_STATS_H diff --git a/src/bin/bison/lib/bitsetv-print.c b/src/bin/bison/lib/bitsetv-print.c index 5a624f596b..4763c75fe4 100644 --- a/src/bin/bison/lib/bitsetv-print.c +++ b/src/bin/bison/lib/bitsetv-print.c @@ -15,8 +15,8 @@ for more details. You should have received a copy of the GNU General Public License along with Bison; see the file COPYING. If not, write to the Free -Software Foundation, 59 Temple Place - Suite 330, Boston, MA -02111-1307, USA. */ +Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301, USA. */ #ifdef HAVE_CONFIG_H #include "config.h" diff --git a/src/bin/bison/lib/bitsetv-print.h b/src/bin/bison/lib/bitsetv-print.h index ccf99acf1d..e54be683b9 100644 --- a/src/bin/bison/lib/bitsetv-print.h +++ b/src/bin/bison/lib/bitsetv-print.h @@ -14,7 +14,7 @@ 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, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ +Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #ifndef _BITSETV_PRINT_H #define _BITSETV_PRINT_H diff --git a/src/bin/bison/lib/bitsetv.c b/src/bin/bison/lib/bitsetv.c index 42e0a3d791..db2aa1af2c 100644 --- a/src/bin/bison/lib/bitsetv.c +++ b/src/bin/bison/lib/bitsetv.c @@ -1,5 +1,5 @@ /* Bitset vectors. - Copyright (C) 2001, 2002, 2004 Free Software Foundation, Inc. + Copyright (C) 2001, 2002, 2004, 2005 Free Software Foundation, Inc. This file is part of GCC. @@ -15,8 +15,8 @@ for more details. You should have received a copy of the GNU General Public License along with GCC; see the file COPYING. If not, write to the Free -Software Foundation, 59 Temple Place - Suite 330, Boston, MA -02111-1307, USA. */ +Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301, USA. */ #ifdef HAVE_CONFIG_H #include "config.h" @@ -47,7 +47,7 @@ bitsetv_alloc (bitset_bindex n_vecs, bitset_bindex n_bits, /* Allocate vector table at head of bitset array. */ vector_bytes = (n_vecs + 1) * sizeof (bitset) + bytes - 1; vector_bytes -= vector_bytes % bytes; - bsetv = (bitset *) xcalloc (1, vector_bytes + bytes * n_vecs); + bsetv = xcalloc (1, vector_bytes + bytes * n_vecs); for (i = 0; i < n_vecs; i++) { diff --git a/src/bin/bison/lib/bitsetv.h b/src/bin/bison/lib/bitsetv.h index 9065334e17..652f9e39de 100644 --- a/src/bin/bison/lib/bitsetv.h +++ b/src/bin/bison/lib/bitsetv.h @@ -14,7 +14,7 @@ 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, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ +Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #ifndef _BITSETV_H #define _BITSETV_H diff --git a/src/bin/bison/lib/dirname.c b/src/bin/bison/lib/dirname.c index 815192a66f..f1930c8d2f 100644 --- a/src/bin/bison/lib/dirname.c +++ b/src/bin/bison/lib/dirname.c @@ -1,5 +1,7 @@ -/* dirname.c -- return all but the last element in a path - Copyright (C) 1990, 1998, 2000, 2001, 2003 Free Software Foundation, Inc. +/* dirname.c -- return all but the last element in a file name + + Copyright (C) 1990, 1998, 2000, 2001, 2003, 2004, 2005 Free Software + Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -13,7 +15,7 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, - Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #if HAVE_CONFIG_H # include @@ -24,40 +26,40 @@ #include #include "xalloc.h" -/* Return the length of `dirname (PATH)', or zero if PATH is +/* Return the length of `dirname (FILE)', or zero if FILE is in the working directory. Works properly even if there are trailing slashes (by effectively ignoring them). */ size_t -dir_len (char const *path) +dir_len (char const *file) { - size_t prefix_length = FILESYSTEM_PREFIX_LEN (path); + size_t prefix_length = FILE_SYSTEM_PREFIX_LEN (file); size_t length; /* Strip the basename and any redundant slashes before it. */ - for (length = base_name (path) - path; prefix_length < length; length--) - if (! ISSLASH (path[length - 1])) + for (length = base_name (file) - file; prefix_length < length; length--) + if (! ISSLASH (file[length - 1])) return length; /* But don't strip the only slash from "/". */ - return prefix_length + ISSLASH (path[prefix_length]); + return prefix_length + ISSLASH (file[prefix_length]); } -/* Return the leading directories part of PATH, +/* Return the leading directories part of FILE, allocated with xmalloc. Works properly even if there are trailing slashes (by effectively ignoring them). */ char * -dir_name (char const *path) +dir_name (char const *file) { - size_t length = dir_len (path); - int append_dot = (length == FILESYSTEM_PREFIX_LEN (path)); - char *newpath = xmalloc (length + append_dot + 1); - memcpy (newpath, path, length); + size_t length = dir_len (file); + bool append_dot = (length == FILE_SYSTEM_PREFIX_LEN (file)); + char *dir = xmalloc (length + append_dot + 1); + memcpy (dir, file, length); if (append_dot) - newpath[length++] = '.'; - newpath[length] = 0; - return newpath; + dir[length++] = '.'; + dir[length] = 0; + return dir; } #ifdef TEST_DIRNAME @@ -106,13 +108,13 @@ main (int argc, char *argv[]) buff[MAX_BUFF_LEN] = 0; while (fgets (buff, MAX_BUFF_LEN, stdin) && buff[0]) { - char path[MAX_BUFF_LEN]; + char file[MAX_BUFF_LEN]; char expected_result[MAX_BUFF_LEN]; char const *result; - sscanf (buff, "%s %s", path, expected_result); - result = dir_name (path); + sscanf (buff, "%s %s", file, expected_result); + result = dir_name (file); if (strcmp (result, expected_result)) - printf ("%s: got %s, expected %s\n", path, result, expected_result); + printf ("%s: got %s, expected %s\n", file, result, expected_result); } return 0; } diff --git a/src/bin/bison/lib/dirname.h b/src/bin/bison/lib/dirname.h index 62da37dc9a..1688ae8104 100644 --- a/src/bin/bison/lib/dirname.h +++ b/src/bin/bison/lib/dirname.h @@ -1,6 +1,6 @@ /* Take file names apart into directory and base names. - Copyright (C) 1998, 2001, 2003 Free Software Foundation, Inc. + Copyright (C) 1998, 2001, 2003, 2004, 2005 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -14,11 +14,12 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, - Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #ifndef DIRNAME_H_ # define DIRNAME_H_ 1 +# include # include # ifndef DIRECTORY_SEPARATOR @@ -29,15 +30,18 @@ # define ISSLASH(C) ((C) == DIRECTORY_SEPARATOR) # endif -# ifndef FILESYSTEM_PREFIX_LEN -# define FILESYSTEM_PREFIX_LEN(Filename) 0 +# ifndef FILE_SYSTEM_PREFIX_LEN +# define FILE_SYSTEM_PREFIX_LEN(File_name) 0 # endif -char *base_name (char const *path); -char *dir_name (char const *path); -size_t base_len (char const *path); -size_t dir_len (char const *path); +# define IS_ABSOLUTE_FILE_NAME(F) ISSLASH ((F)[FILE_SYSTEM_PREFIX_LEN (F)]) +# define IS_RELATIVE_FILE_NAME(F) (! IS_ABSOLUTE_FILE_NAME (F)) -int strip_trailing_slashes (char *path); +char *base_name (char const *file); +char *dir_name (char const *file); +size_t base_len (char const *file); +size_t dir_len (char const *file); + +bool strip_trailing_slashes (char *file); #endif /* not DIRNAME_H_ */ diff --git a/src/bin/bison/lib/dup-safer.c b/src/bin/bison/lib/dup-safer.c new file mode 100644 index 0000000000..1c46b6e722 --- /dev/null +++ b/src/bin/bison/lib/dup-safer.c @@ -0,0 +1,46 @@ +/* Invoke dup, but avoid some glitches. + Copyright (C) 2001, 2004, 2005 Free Software Foundation, Inc. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2, 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, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ + +/* Written by Paul Eggert. */ + +#if HAVE_CONFIG_H +# include +#endif + +#include "unistd-safer.h" + +#include + +#include +#ifndef STDERR_FILENO +# define STDERR_FILENO 2 +#endif + +/* Like dup, but do not return STDIN_FILENO, STDOUT_FILENO, or + STDERR_FILENO. */ + +int +dup_safer (int fd) +{ +#ifdef F_DUPFD + return fcntl (fd, F_DUPFD, STDERR_FILENO + 1); +#else + /* fd_safer calls us back, but eventually the recursion unwinds and + does the right thing. */ + return fd_safer (dup (fd)); +#endif +} diff --git a/src/bin/bison/lib/ebitset.c b/src/bin/bison/lib/ebitset.c index 6006c0e244..9ac85a2c1b 100644 --- a/src/bin/bison/lib/ebitset.c +++ b/src/bin/bison/lib/ebitset.c @@ -1,5 +1,5 @@ /* Functions to support expandable bitsets. - Copyright (C) 2002, 2003, 2004 Free Software Foundation, Inc. + Copyright (C) 2002, 2003, 2004, 2005 Free Software Foundation, Inc. Contributed by Michael Hayes (m.hayes@elec.canterbury.ac.nz). This program is free software; you can redistribute it and/or modify @@ -14,7 +14,7 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #ifdef HAVE_CONFIG_H @@ -115,11 +115,11 @@ static ebitset_elt *ebitset_free_list; /* Free list of bitset elements. */ ((BSET)->b.cindex = (EINDEX) * EBITSET_ELT_WORDS, \ (BSET)->b.cdata = EBITSET_WORDS (EBITSET_ELTS (BSET) [EINDEX])) - +#undef min +#undef max #define min(a, b) ((a) > (b) ? (b) : (a)) #define max(a, b) ((a) > (b) ? (a) : (b)) - static bitset_bindex ebitset_resize (bitset src, bitset_bindex n_bits) { @@ -136,7 +136,7 @@ ebitset_resize (bitset src, bitset_bindex n_bits) { bitset_windex size; - /* The bitset needs to grow. If we already have enough memory + /* The bitset needs to grow. If we already have enough memory allocated, then just zero what we need. */ if (newsize > EBITSET_ASIZE (src)) { @@ -149,13 +149,13 @@ ebitset_resize (bitset src, bitset_bindex n_bits) size = newsize; else size = newsize + newsize / 4; - + EBITSET_ELTS (src) = realloc (EBITSET_ELTS (src), size * sizeof (ebitset_elt *)); EBITSET_ASIZE (src) = size; } - memset (EBITSET_ELTS (src) + oldsize, 0, + memset (EBITSET_ELTS (src) + oldsize, 0, (newsize - oldsize) * sizeof (ebitset_elt *)); } else @@ -838,10 +838,10 @@ ebitset_unused_clear (bitset dst) { unsigned int last_bit; bitset_bindex n_bits; - + n_bits = BITSET_NBITS_ (dst); last_bit = n_bits % EBITSET_ELT_BITS; - + if (last_bit) { bitset_windex eindex; @@ -849,20 +849,20 @@ ebitset_unused_clear (bitset dst) ebitset_elt *elt; elts = EBITSET_ELTS (dst); - + eindex = n_bits / EBITSET_ELT_BITS; - + elt = elts[eindex]; if (elt) { bitset_windex windex; bitset_windex woffset; bitset_word *srcp = EBITSET_WORDS (elt); - + windex = n_bits / BITSET_WORD_BITS; woffset = eindex * EBITSET_ELT_WORDS; - - srcp[windex - woffset] &= ((bitset_word) 1 << last_bit) - 1; + + srcp[windex - woffset] &= ((bitset_word) 1 << last_bit) - 1; windex++; for (; (windex - woffset) < EBITSET_ELT_WORDS; windex++) srcp[windex - woffset] = 0; diff --git a/src/bin/bison/lib/ebitset.h b/src/bin/bison/lib/ebitset.h index 70c0fcada3..dc602734a0 100644 --- a/src/bin/bison/lib/ebitset.h +++ b/src/bin/bison/lib/ebitset.h @@ -14,10 +14,10 @@ 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, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ +Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #ifndef _EBITSET_H -#define _EBITSET_H +#define _EBITSET_H #include "bitset.h" diff --git a/src/bin/bison/lib/error.c b/src/bin/bison/lib/error.c index 1149235a10..45698be8da 100644 --- a/src/bin/bison/lib/error.c +++ b/src/bin/bison/lib/error.c @@ -1,5 +1,5 @@ /* Error handler for noninteractive utilities - Copyright (C) 1990-1998, 2000-2002, 2003 Free Software Foundation, Inc. + Copyright (C) 1990-1998, 2000-2003, 2004 Free Software Foundation, Inc. This file is part of the GNU C Library. This program is free software; you can redistribute it and/or modify @@ -14,7 +14,7 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, - Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ /* Written by David MacKenzie . */ @@ -29,9 +29,7 @@ #include #include -#ifdef _LIBC -# include -#else +#if !_LIBC && ENABLE_NLS # include "gettext.h" #endif @@ -40,7 +38,7 @@ # define mbsrtowcs __mbsrtowcs #endif -#if !_LIBC +#if USE_UNLOCKED_IO # include "unlocked-io.h" #endif @@ -106,7 +104,7 @@ extern char *program_name; static void print_errno_message (int errnum) { - char const *s; + char const *s = NULL; #if defined HAVE_STRERROR_R || _LIBC char errbuf[1024]; @@ -115,15 +113,11 @@ print_errno_message (int errnum) # else if (__strerror_r (errnum, errbuf, sizeof errbuf) == 0) s = errbuf; - else - s = 0; # endif -#else - s = strerror (errnum); #endif #if !_LIBC - if (! s) + if (! s && ! (s = strerror (errnum))) s = _("Unknown system error"); #endif diff --git a/src/bin/bison/lib/error.h b/src/bin/bison/lib/error.h index 8ed63595f2..e5220a2f13 100644 --- a/src/bin/bison/lib/error.h +++ b/src/bin/bison/lib/error.h @@ -14,7 +14,7 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, - Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #ifndef _ERROR_H #define _ERROR_H 1 diff --git a/src/bin/bison/lib/exit.h b/src/bin/bison/lib/exit.h index 4e8d465165..9dbfb7ce85 100644 --- a/src/bin/bison/lib/exit.h +++ b/src/bin/bison/lib/exit.h @@ -13,7 +13,7 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, - Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #ifndef _EXIT_H #define _EXIT_H diff --git a/src/bin/bison/lib/exitfail.c b/src/bin/bison/lib/exitfail.c index 2ae5f69555..1c5997b8ac 100644 --- a/src/bin/bison/lib/exitfail.c +++ b/src/bin/bison/lib/exitfail.c @@ -15,7 +15,7 @@ You should have received a copy of the GNU General Public License along with this program; see the file COPYING. If not, write to the Free Software Foundation, - 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #if HAVE_CONFIG_H # include diff --git a/src/bin/bison/lib/exitfail.h b/src/bin/bison/lib/exitfail.h index cf5ab71958..e46cf9c166 100644 --- a/src/bin/bison/lib/exitfail.h +++ b/src/bin/bison/lib/exitfail.h @@ -15,6 +15,6 @@ You should have received a copy of the GNU General Public License along with this program; see the file COPYING. If not, write to the Free Software Foundation, - 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ extern int volatile exit_failure; diff --git a/src/bin/bison/lib/fd-safer.c b/src/bin/bison/lib/fd-safer.c new file mode 100644 index 0000000000..6b50451338 --- /dev/null +++ b/src/bin/bison/lib/fd-safer.c @@ -0,0 +1,59 @@ +/* Return a safer copy of a file descriptor. + + Copyright (C) 2005 Free Software Foundation, Inc. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2, 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, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ + +/* Written by Paul Eggert. */ + +#if HAVE_CONFIG_H +# include +#endif + +#include "unistd-safer.h" + +#include + +#include +#ifndef STDIN_FILENO +# define STDIN_FILENO 0 +#endif +#ifndef STDERR_FILENO +# define STDERR_FILENO 2 +#endif + +/* Return FD, unless FD would be a copy of standard input, output, or + error; in that case, return a duplicate of FD, closing FD. On + failure to duplicate, close FD, set errno, and return -1. Preserve + errno if FD is negative, so that the caller can always inspect + errno when the returned value is negative. + + This function is usefully wrapped around functions that return file + descriptors, e.g., fd_safer (open ("file", O_RDONLY)). */ + +int +fd_safer (int fd) +{ + if (STDIN_FILENO <= fd && fd <= STDERR_FILENO) + { + int f = dup_safer (fd); + int e = errno; + close (fd); + errno = e; + fd = f; + } + + return fd; +} diff --git a/src/bin/bison/lib/fopen-safer.c b/src/bin/bison/lib/fopen-safer.c new file mode 100644 index 0000000000..ccaf1219f0 --- /dev/null +++ b/src/bin/bison/lib/fopen-safer.c @@ -0,0 +1,69 @@ +/* Invoke fopen, but avoid some glitches. + Copyright (C) 2001, 2004, 2005 Free Software Foundation, Inc. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2, 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, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ + +/* Written by Paul Eggert. */ + +#if HAVE_CONFIG_H +# include +#endif + +#include "stdio-safer.h" + +#include +#include +#include "unistd-safer.h" + +#ifndef STDERR_FILENO +# define STDERR_FILENO 2 +#endif + +/* Like fopen, but do not return stdin, stdout, or stderr. */ + +FILE * +fopen_safer (char const *file, char const *mode) +{ + FILE *fp = fopen (file, mode); + + if (fp) + { + int fd = fileno (fp); + + if (0 <= fd && fd <= STDERR_FILENO) + { + int f = dup_safer (fd); + + if (f < 0) + { + int e = errno; + fclose (fp); + errno = e; + return NULL; + } + + if (fclose (fp) != 0 + || ! (fp = fdopen (f, mode))) + { + int e = errno; + close (f); + errno = e; + return NULL; + } + } + } + + return fp; +} diff --git a/src/bin/bison/lib/get-errno.c b/src/bin/bison/lib/get-errno.c index 57cea01966..78b3674aee 100644 --- a/src/bin/bison/lib/get-errno.c +++ b/src/bin/bison/lib/get-errno.c @@ -14,7 +14,7 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, - Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ /* Written by Paul Eggert. */ diff --git a/src/bin/bison/lib/get-errno.h b/src/bin/bison/lib/get-errno.h index 23f1992bf1..d39a8dd664 100644 --- a/src/bin/bison/lib/get-errno.h +++ b/src/bin/bison/lib/get-errno.h @@ -14,7 +14,7 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, - Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ extern int get_errno (void); extern void set_errno (int); diff --git a/src/bin/bison/lib/getopt.c b/src/bin/bison/lib/getopt.c index 8f017f87b1..bcb81c83fe 100644 --- a/src/bin/bison/lib/getopt.c +++ b/src/bin/bison/lib/getopt.c @@ -3,7 +3,7 @@ "Keep this file name-space clean" means, talk to drepper@gnu.org before changing it! Copyright (C) 1987,88,89,90,91,92,93,94,95,96,98,99,2000,2001,2002,2003,2004 - Free Software Foundation, Inc. + Free Software Foundation, Inc. This file is part of the GNU C Library. This program is free software; you can redistribute it and/or modify @@ -18,7 +18,7 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, - Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ /* This tells Alpha OSF/1 not to define a getopt prototype in . Ditto for AIX 3.2 and . */ @@ -32,25 +32,6 @@ #include -/* Comment out all this code if we are using the GNU C Library, and are not - actually compiling the library itself. This code is part of the GNU C - Library, but also included in many other GNU distributions. Compiling - and linking in this code is a waste when using the GNU C library - (especially if it is a shared library). Rather than having every GNU - program understand `configure --with-gnu-libc' and omit the object files, - it is simpler to just do this in the source for each such file. */ - -#define GETOPT_INTERFACE_VERSION 2 -#if !defined _LIBC && defined __GLIBC__ && __GLIBC__ >= 2 -# include -# if _GNU_GETOPT_INTERFACE_VERSION == GETOPT_INTERFACE_VERSION -# define ELIDE_CODE -# endif -#endif - -#ifndef ELIDE_CODE - - /* This needs to come after some library #include to get __GNU_LIBRARY__ defined. */ #ifdef __GNU_LIBRARY__ @@ -81,16 +62,16 @@ # define attribute_hidden #endif -/* This version of `getopt' appears to the caller like standard Unix `getopt' - but it behaves differently for the user, since it allows the user - to intersperse the options with the other arguments. +/* Unlike standard Unix `getopt', functions like `getopt_long' + let the user intersperse the options with the other arguments. - As `getopt' works, it permutes the elements of ARGV so that, + As `getopt_long' works, it permutes the elements of ARGV so that, when it is done, all the options precede everything else. Thus all application programs are extended to handle flexible argument order. - Setting the environment variable POSIXLY_CORRECT disables permutation. - Then the behavior is completely standard. + Using `getopt' or setting the environment variable POSIXLY_CORRECT + disables permutation. + Then the application's behavior is completely standard. GNU application programs can use a third alternative mode in which they can distinguish the relative order of options and other arguments. */ @@ -269,8 +250,8 @@ exchange (char **argv, struct _getopt_data *d) /* Initialize the internal data when the first call is made. */ static const char * -_getopt_initialize (int argc, char *const *argv, const char *optstring, - struct _getopt_data *d) +_getopt_initialize (int argc, char **argv, const char *optstring, + int posixly_correct, struct _getopt_data *d) { /* Start processing options with ARGV-element 1 (since ARGV-element 0 is the program name); the sequence of previously skipped @@ -280,7 +261,7 @@ _getopt_initialize (int argc, char *const *argv, const char *optstring, d->__nextchar = NULL; - d->__posixly_correct = !!getenv ("POSIXLY_CORRECT"); + d->__posixly_correct = posixly_correct || !!getenv ("POSIXLY_CORRECT"); /* Determine how to handle the ordering of options and nonoptions. */ @@ -374,10 +355,6 @@ _getopt_initialize (int argc, char *const *argv, const char *optstring, `flag' field is nonzero, the value of the option's `val' field if the `flag' field is zero. - The elements of ARGV aren't really const, because we permute them. - But we pretend they're const in the prototype to be compatible - with other systems. - LONGOPTS is a vector of `struct option' terminated by an element containing a name which is zero. @@ -386,12 +363,15 @@ _getopt_initialize (int argc, char *const *argv, const char *optstring, recent call. If LONG_ONLY is nonzero, '-' as well as '--' can introduce - long-named options. */ + long-named options. + + If POSIXLY_CORRECT is nonzero, behave as if the POSIXLY_CORRECT + environment variable were set. */ int -_getopt_internal_r (int argc, char *const *argv, const char *optstring, +_getopt_internal_r (int argc, char **argv, const char *optstring, const struct option *longopts, int *longind, - int long_only, struct _getopt_data *d) + int long_only, int posixly_correct, struct _getopt_data *d) { int print_errors = d->opterr; if (optstring[0] == ':') @@ -406,7 +386,8 @@ _getopt_internal_r (int argc, char *const *argv, const char *optstring, { if (d->optind == 0) d->optind = 1; /* Don't scan ARGV[0], the program name. */ - optstring = _getopt_initialize (argc, argv, optstring, d); + optstring = _getopt_initialize (argc, argv, optstring, + posixly_correct, d); d->__initialized = 1; } @@ -1154,16 +1135,17 @@ _getopt_internal_r (int argc, char *const *argv, const char *optstring, } int -_getopt_internal (int argc, char *const *argv, const char *optstring, - const struct option *longopts, int *longind, int long_only) +_getopt_internal (int argc, char **argv, const char *optstring, + const struct option *longopts, int *longind, + int long_only, int posixly_correct) { int result; getopt_data.optind = optind; getopt_data.opterr = opterr; - result = _getopt_internal_r (argc, argv, optstring, longopts, - longind, long_only, &getopt_data); + result = _getopt_internal_r (argc, argv, optstring, longopts, longind, + long_only, posixly_correct, &getopt_data); optind = getopt_data.optind; optarg = getopt_data.optarg; @@ -1172,16 +1154,21 @@ _getopt_internal (int argc, char *const *argv, const char *optstring, return result; } +/* glibc gets a LSB-compliant getopt. + Standalone applications get a POSIX-compliant getopt. */ +#if _LIBC +enum { POSIXLY_CORRECT = 0 }; +#else +enum { POSIXLY_CORRECT = 1 }; +#endif + int getopt (int argc, char *const *argv, const char *optstring) { - return _getopt_internal (argc, argv, optstring, - (const struct option *) 0, - (int *) 0, - 0); + return _getopt_internal (argc, (char **) argv, optstring, NULL, NULL, 0, + POSIXLY_CORRECT); } -#endif /* Not ELIDE_CODE. */ #ifdef TEST diff --git a/src/bin/bison/lib/getopt.h b/src/bin/bison/lib/getopt.h index c61768c691..a4e78cb06b 100644 --- a/src/bin/bison/lib/getopt.h +++ b/src/bin/bison/lib/getopt.h @@ -15,7 +15,7 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, - Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #ifndef _GETOPT_H @@ -23,6 +23,64 @@ # define _GETOPT_H 1 #endif +/* Standalone applications should #define __GETOPT_PREFIX to an + identifier that prefixes the external functions and variables + defined in this header. When this happens, include the + headers that might declare getopt so that they will not cause + confusion if included after this file. Then systematically rename + identifiers so that they do not collide with the system functions + and variables. Renaming avoids problems with some compilers and + linkers. */ +#if defined __GETOPT_PREFIX && !defined __need_getopt +# include +# include +# if HAVE_UNISTD_H +# include +# endif +# undef __need_getopt +# undef getopt +# undef getopt_long +# undef getopt_long_only +# undef optarg +# undef opterr +# undef optind +# undef optopt +# define __GETOPT_CONCAT(x, y) x ## y +# define __GETOPT_XCONCAT(x, y) __GETOPT_CONCAT (x, y) +# define __GETOPT_ID(y) __GETOPT_XCONCAT (__GETOPT_PREFIX, y) +# define getopt __GETOPT_ID (getopt) +# define getopt_long __GETOPT_ID (getopt_long) +# define getopt_long_only __GETOPT_ID (getopt_long_only) +# define optarg __GETOPT_ID (optarg) +# define opterr __GETOPT_ID (opterr) +# define optind __GETOPT_ID (optind) +# define optopt __GETOPT_ID (optopt) +#endif + +/* Standalone applications get correct prototypes for getopt_long and + getopt_long_only; they declare "char **argv". libc uses prototypes + with "char *const *argv" that are incorrect because getopt_long and + getopt_long_only can permute argv; this is required for backward + compatibility (e.g., for LSB 2.0.1). + + This used to be `#if defined __GETOPT_PREFIX && !defined __need_getopt', + but it caused redefinition warnings if both unistd.h and getopt.h were + included, since unistd.h includes getopt.h having previously defined + __need_getopt. + + The only place where __getopt_argv_const is used is in definitions + of getopt_long and getopt_long_only below, but these are visible + only if __need_getopt is not defined, so it is quite safe to rewrite + the conditional as follows: +*/ +#if !defined __need_getopt +# if defined __GETOPT_PREFIX +# define __getopt_argv_const /* empty */ +# else +# define __getopt_argv_const const +# endif +#endif + /* If __GNU_LIBRARY__ is not already defined, either we are being used standalone, or this is the first header included in the source file. If we are being used with glibc, we need to include , but @@ -89,7 +147,7 @@ extern int optopt; The field `has_arg' is: no_argument (or 0) if the option does not take an argument, required_argument (or 1) if the option requires an argument, - optional_argument (or 2) if the option takes an optional argument. + optional_argument (or 2) if the option takes an optional argument. If the field `flag' is not NULL, it points to a variable that is set to the value given in the field `val' when the option is found, but @@ -144,22 +202,15 @@ struct option arguments to the option '\0'. This behavior is specific to the GNU `getopt'. */ -#ifdef __GNU_LIBRARY__ -/* Many other libraries have conflicting prototypes for getopt, with - differences in the consts, in stdlib.h. To avoid compilation - errors, only prototype getopt for the GNU C library. */ extern int getopt (int ___argc, char *const *___argv, const char *__shortopts) __THROW; -#else /* not __GNU_LIBRARY__ */ -extern int getopt (); -#endif /* __GNU_LIBRARY__ */ #ifndef __need_getopt -extern int getopt_long (int ___argc, char *const *___argv, +extern int getopt_long (int ___argc, char *__getopt_argv_const *___argv, const char *__shortopts, const struct option *__longopts, int *__longind) __THROW; -extern int getopt_long_only (int ___argc, char *const *___argv, +extern int getopt_long_only (int ___argc, char *__getopt_argv_const *___argv, const char *__shortopts, const struct option *__longopts, int *__longind) __THROW; diff --git a/src/bin/bison/lib/getopt1.c b/src/bin/bison/lib/getopt1.c index 7671eba373..5acd2245af 100644 --- a/src/bin/bison/lib/getopt1.c +++ b/src/bin/bison/lib/getopt1.c @@ -15,7 +15,7 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, - Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #ifdef HAVE_CONFIG_H #include @@ -30,25 +30,6 @@ #include -/* Comment out all this code if we are using the GNU C Library, and are not - actually compiling the library itself. This code is part of the GNU C - Library, but also included in many other GNU distributions. Compiling - and linking in this code is a waste when using the GNU C library - (especially if it is a shared library). Rather than having every GNU - program understand `configure --with-gnu-libc' and omit the object files, - it is simpler to just do this in the source for each such file. */ - -#define GETOPT_INTERFACE_VERSION 2 -#if !defined _LIBC && defined __GLIBC__ && __GLIBC__ >= 2 -#include -#if _GNU_GETOPT_INTERFACE_VERSION == GETOPT_INTERFACE_VERSION -#define ELIDE_CODE -#endif -#endif - -#ifndef ELIDE_CODE - - /* This needs to come after some library #include to get __GNU_LIBRARY__ defined. */ #ifdef __GNU_LIBRARY__ @@ -60,19 +41,20 @@ #endif int -getopt_long (int argc, char *const *argv, const char *options, +getopt_long (int argc, char *__getopt_argv_const *argv, const char *options, const struct option *long_options, int *opt_index) { - return _getopt_internal (argc, argv, options, long_options, opt_index, 0); + return _getopt_internal (argc, (char **) argv, options, long_options, + opt_index, 0, 0); } int -_getopt_long_r (int argc, char *const *argv, const char *options, +_getopt_long_r (int argc, char **argv, const char *options, const struct option *long_options, int *opt_index, struct _getopt_data *d) { return _getopt_internal_r (argc, argv, options, long_options, opt_index, - 0, d); + 0, 0, d); } /* Like getopt_long, but '-' as well as '--' can indicate a long option. @@ -81,22 +63,23 @@ _getopt_long_r (int argc, char *const *argv, const char *options, instead. */ int -getopt_long_only (int argc, char *const *argv, const char *options, +getopt_long_only (int argc, char *__getopt_argv_const *argv, + const char *options, const struct option *long_options, int *opt_index) { - return _getopt_internal (argc, argv, options, long_options, opt_index, 1); + return _getopt_internal (argc, (char **) argv, options, long_options, + opt_index, 1, 0); } int -_getopt_long_only_r (int argc, char *const *argv, const char *options, +_getopt_long_only_r (int argc, char **argv, const char *options, const struct option *long_options, int *opt_index, struct _getopt_data *d) { return _getopt_internal_r (argc, argv, options, long_options, opt_index, - 1, d); + 1, 0, d); } -#endif /* Not ELIDE_CODE. */ #ifdef TEST diff --git a/src/bin/bison/lib/getopt_int.h b/src/bin/bison/lib/getopt_int.h index 0c5eddeca9..401579fd28 100644 --- a/src/bin/bison/lib/getopt_int.h +++ b/src/bin/bison/lib/getopt_int.h @@ -15,15 +15,15 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, - Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #ifndef _GETOPT_INT_H #define _GETOPT_INT_H 1 -extern int _getopt_internal (int ___argc, char *const *___argv, +extern int _getopt_internal (int ___argc, char **___argv, const char *__shortopts, const struct option *__longopts, int *__longind, - int __long_only); + int __long_only, int __posixly_correct); /* Reentrant versions which can handle parsing multiple argument @@ -64,7 +64,7 @@ struct _getopt_data This is what Unix does. This mode of operation is selected by either setting the environment variable POSIXLY_CORRECT, or using `+' as the first character - of the list of option characters. + of the list of option characters, or by calling getopt. PERMUTE is the default. We permute the contents of ARGV as we scan, so that eventually all the non-options are at the end. @@ -87,7 +87,8 @@ struct _getopt_data REQUIRE_ORDER, PERMUTE, RETURN_IN_ORDER } __ordering; - /* If the POSIXLY_CORRECT environment variable is set. */ + /* If the POSIXLY_CORRECT environment variable is set + or getopt was called. */ int __posixly_correct; @@ -110,17 +111,18 @@ struct _getopt_data default values and to clear the initialization flag. */ #define _GETOPT_DATA_INITIALIZER { 1, 1 } -extern int _getopt_internal_r (int ___argc, char *const *___argv, +extern int _getopt_internal_r (int ___argc, char **___argv, const char *__shortopts, const struct option *__longopts, int *__longind, - int __long_only, struct _getopt_data *__data); + int __long_only, int __posixly_correct, + struct _getopt_data *__data); -extern int _getopt_long_r (int ___argc, char *const *___argv, +extern int _getopt_long_r (int ___argc, char **___argv, const char *__shortopts, const struct option *__longopts, int *__longind, struct _getopt_data *__data); -extern int _getopt_long_only_r (int ___argc, char *const *___argv, +extern int _getopt_long_only_r (int ___argc, char **___argv, const char *__shortopts, const struct option *__longopts, int *__longind, diff --git a/src/bin/bison/lib/gettext.h b/src/bin/bison/lib/gettext.h index 835732e01f..285cb314ce 100644 --- a/src/bin/bison/lib/gettext.h +++ b/src/bin/bison/lib/gettext.h @@ -1,5 +1,5 @@ /* Convenience header for conditional use of GNU . - Copyright (C) 1995-1998, 2000-2002 Free Software Foundation, Inc. + Copyright (C) 1995-1998, 2000-2002, 2004 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -13,7 +13,7 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, - Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #ifndef _LIBGETTEXT_H #define _LIBGETTEXT_H 1 @@ -36,6 +36,16 @@ # include #endif +/* Many header files from the libstdc++ coming with g++ 3.3 or newer include + , which chokes if dcgettext is defined as a macro. So include + it now, to make later inclusions of a NOP. */ +#if defined(__cplusplus) && defined(__GNUG__) && (__GNUC__ >= 3) +# include +# if (__GLIBC__ >= 2) || _GLIBCXX_HAVE_LIBINTL_H +# include +# endif +#endif + /* Disabled NLS. The casts to 'const char *' serve the purpose of producing warnings for invalid uses of the value returned from these functions. diff --git a/src/bin/bison/lib/gnulib.mk b/src/bin/bison/lib/gnulib.mk index 912d27eb82..7359b728df 100644 --- a/src/bin/bison/lib/gnulib.mk +++ b/src/bin/bison/lib/gnulib.mk @@ -1,10 +1,10 @@ # This file is generated automatically by "bootstrap". + BUILT_SOURCES += $(ALLOCA_H) EXTRA_DIST += alloca_.h -# We need the following in order to create an when the system +# We need the following in order to create when the system # doesn't have one that works with the given compiler. -all-local $(lib_OBJECTS): $(ALLOCA_H) alloca.h: alloca_.h cp $(srcdir)/alloca_.h $@-t mv $@-t $@ @@ -12,50 +12,54 @@ MOSTLYCLEANFILES += alloca.h alloca.h-t lib_SOURCES += argmatch.h argmatch.c -lib_SOURCES += dirname.h dirname.c basename.c stripslash.c +lib_SOURCES += basename.c stripslash.c lib_SOURCES += exit.h -lib_SOURCES += exitfail.h exitfail.c -lib_SOURCES += getopt.h getopt.c getopt1.c getopt_int.h +BUILT_SOURCES += $(GETOPT_H) +EXTRA_DIST += getopt_.h getopt_int.h + +# We need the following in order to create when the system +# doesn't have one that works with the given compiler. +getopt.h: getopt_.h + cp $(srcdir)/getopt_.h $@-t + mv $@-t $@ +MOSTLYCLEANFILES += getopt.h getopt.h-t + lib_SOURCES += gettext.h -lib_SOURCES += hard-locale.h hard-locale.c -lib_SOURCES += hash.h hash.c + lib_SOURCES += mbswidth.h mbswidth.c -lib_SOURCES += quote.h quote.c - -lib_SOURCES += quotearg.h quotearg.c BUILT_SOURCES += $(STDBOOL_H) EXTRA_DIST += stdbool_.h -# We need the following in order to create an when the system +# We need the following in order to create when the system # doesn't have one that works. -all-local $(lib_OBJECTS): $(STDBOOL_H) stdbool.h: stdbool_.h sed -e 's/@''HAVE__BOOL''@/$(HAVE__BOOL)/g' < $(srcdir)/stdbool_.h > $@-t mv $@-t $@ MOSTLYCLEANFILES += stdbool.h stdbool.h-t + lib_SOURCES += stpcpy.h -lib_SOURCES += strndup.h -lib_SOURCES += unlocked-io.h -lib_SOURCES += xalloc.h xmalloc.c xstrdup.c + + +lib_SOURCES += xalloc-die.c lib_SOURCES += xstrndup.h xstrndup.c diff --git a/src/bin/bison/lib/hard-locale.c b/src/bin/bison/lib/hard-locale.c index 8c0ee8c777..b0566ec218 100644 --- a/src/bin/bison/lib/hard-locale.c +++ b/src/bin/bison/lib/hard-locale.c @@ -1,6 +1,7 @@ /* hard-locale.c -- Determine whether a locale is hard. - Copyright (C) 1997, 1998, 1999, 2002, 2003 Free Software Foundation, Inc. + Copyright (C) 1997, 1998, 1999, 2002, 2003, 2004 Free Software + Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -14,7 +15,7 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, - Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #if HAVE_CONFIG_H # include @@ -22,53 +23,53 @@ #include "hard-locale.h" -#if HAVE_LOCALE_H -# include -#endif - +#include #include #include -/* Return nonzero if the current CATEGORY locale is hard, i.e. if you +#include "strdup.h" + +#ifdef __GLIBC__ +# define GLIBC_VERSION __GLIBC__ +#else +# define GLIBC_VERSION 0 +#endif + +/* Return true if the current CATEGORY locale is hard, i.e. if you can't get away with assuming traditional C or POSIX behavior. */ -int +bool hard_locale (int category) { -#if ! HAVE_SETLOCALE - return 0; -#else - - int hard = 1; - char const *p = setlocale (category, 0); + bool hard = true; + char const *p = setlocale (category, NULL); if (p) { -# if defined __GLIBC__ && 2 <= __GLIBC__ - if (strcmp (p, "C") == 0 || strcmp (p, "POSIX") == 0) - hard = 0; -# else - char *locale = malloc (strlen (p) + 1); - if (locale) + if (2 <= GLIBC_VERSION) { - strcpy (locale, p); - - /* Temporarily set the locale to the "C" and "POSIX" locales - to find their names, so that we can determine whether one - or the other is the caller's locale. */ - if (((p = setlocale (category, "C")) - && strcmp (p, locale) == 0) - || ((p = setlocale (category, "POSIX")) - && strcmp (p, locale) == 0)) - hard = 0; - - /* Restore the caller's locale. */ - setlocale (category, locale); - free (locale); + if (strcmp (p, "C") == 0 || strcmp (p, "POSIX") == 0) + hard = false; + } + else + { + char *locale = strdup (p); + if (locale) + { + /* Temporarily set the locale to the "C" and "POSIX" locales + to find their names, so that we can determine whether one + or the other is the caller's locale. */ + if (((p = setlocale (category, "C")) + && strcmp (p, locale) == 0) + || ((p = setlocale (category, "POSIX")) + && strcmp (p, locale) == 0)) + hard = false; + + /* Restore the caller's locale. */ + setlocale (category, locale); + free (locale); + } } -# endif } return hard; - -#endif } diff --git a/src/bin/bison/lib/hard-locale.h b/src/bin/bison/lib/hard-locale.h index ddc15d019d..c5cedc0259 100644 --- a/src/bin/bison/lib/hard-locale.h +++ b/src/bin/bison/lib/hard-locale.h @@ -1,6 +1,6 @@ /* Determine whether a locale is hard. - Copyright (C) 1999, 2003 Free Software Foundation, Inc. + Copyright (C) 1999, 2003, 2004 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -14,11 +14,13 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, - Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #ifndef HARD_LOCALE_H_ # define HARD_LOCALE_H_ 1 -int hard_locale (int); +# include + +bool hard_locale (int); #endif /* HARD_LOCALE_H_ */ diff --git a/src/bin/bison/lib/hash.c b/src/bin/bison/lib/hash.c index 945bb80f78..2b5d5c255d 100644 --- a/src/bin/bison/lib/hash.c +++ b/src/bin/bison/lib/hash.c @@ -1,7 +1,7 @@ /* hash - hashing table processing. - Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003 Free Software - Foundation, Inc. + Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004 Free + Software Foundation, Inc. Written by Jim Meyering, 1992. @@ -17,7 +17,7 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, - Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ /* A generic hash table package. */ @@ -400,9 +400,10 @@ hash_string (const char *string, size_t n_buckets) ((Byte) + ROTATE_LEFT (Value, 7)) size_t value = 0; + unsigned char ch; - for (; *string; string++) - value = HASH_ONE_CHAR (value, (unsigned char) *string); + for (; (ch = *string); string++) + value = HASH_ONE_CHAR (value, ch); return value % n_buckets; # undef ROTATE_LEFT @@ -420,9 +421,10 @@ size_t hash_string (const char *string, size_t n_buckets) { size_t value = 0; + unsigned char ch; - while (*string) - value = (value * 31 + (unsigned char) *string++) % n_buckets; + for (; (ch = *string); string++) + value = (value * 31 + ch) % n_buckets; return value; } diff --git a/src/bin/bison/lib/hash.h b/src/bin/bison/lib/hash.h index 6920824e8a..ab63a863fd 100644 --- a/src/bin/bison/lib/hash.h +++ b/src/bin/bison/lib/hash.h @@ -14,7 +14,7 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, - Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ /* A generic hash table package. */ diff --git a/src/bin/bison/lib/lbitset.c b/src/bin/bison/lib/lbitset.c index a405b8cf61..9d3d957342 100644 --- a/src/bin/bison/lib/lbitset.c +++ b/src/bin/bison/lib/lbitset.c @@ -14,7 +14,7 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #ifdef HAVE_CONFIG_H @@ -41,7 +41,7 @@ /* Number of words to use for each element. The larger the value the greater the size of the cache and the shorter the time to find a given bit but the more memory wasted for sparse bitsets and the longer the time - to search for set bits. + to search for set bits. The routines that dominate timing profiles are lbitset_elt_find and lbitset_elt_link, especially when accessing the bits randomly. */ @@ -888,18 +888,18 @@ lbitset_unused_clear (bitset dst) n_bits = BITSET_SIZE_ (dst); last_bit = n_bits % LBITSET_ELT_BITS; - + if (last_bit) { lbitset_elt *elt; bitset_windex windex; bitset_word *srcp; - + elt = LBITSET_TAIL (dst); srcp = elt->words; windex = n_bits / BITSET_WORD_BITS; - - srcp[windex - elt->index] &= ((bitset_word) 1 << last_bit) - 1; + + srcp[windex - elt->index] &= ((bitset_word) 1 << last_bit) - 1; windex++; for (; (windex - elt->index) < LBITSET_ELT_WORDS; windex++) diff --git a/src/bin/bison/lib/lbitset.h b/src/bin/bison/lib/lbitset.h index 72a0d46d87..aaad8345ef 100644 --- a/src/bin/bison/lib/lbitset.h +++ b/src/bin/bison/lib/lbitset.h @@ -14,10 +14,10 @@ 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, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ +Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #ifndef _LBITSET_H -#define _LBITSET_H +#define _LBITSET_H #include "bitset.h" diff --git a/src/bin/bison/lib/libiberty.h b/src/bin/bison/lib/libiberty.h index 1867232b61..e8629e40a4 100644 --- a/src/bin/bison/lib/libiberty.h +++ b/src/bin/bison/lib/libiberty.h @@ -13,7 +13,7 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, - Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ /* Bison depends on libiberty's implementation of bitsets, which diff --git a/src/bin/bison/lib/main.c b/src/bin/bison/lib/main.c index 10664c7d66..98dedf979c 100644 --- a/src/bin/bison/lib/main.c +++ b/src/bin/bison/lib/main.c @@ -16,8 +16,8 @@ You should have received a copy of the GNU General Public License along with Bison; see the file COPYING. If not, write to - the Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. */ #include diff --git a/src/bin/bison/lib/malloc.c b/src/bin/bison/lib/malloc.c index a43d169271..a75da9b795 100644 --- a/src/bin/bison/lib/malloc.c +++ b/src/bin/bison/lib/malloc.c @@ -1,4 +1,4 @@ -/* Work around bug on some systems where malloc (0) fails. +/* malloc() function that is glibc compatible. Copyright (C) 1997, 1998 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify @@ -13,7 +13,7 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, - Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ /* written by Jim Meyering */ diff --git a/src/bin/bison/lib/mbswidth.c b/src/bin/bison/lib/mbswidth.c index 6b9d4b38bb..c9e78d6502 100644 --- a/src/bin/bison/lib/mbswidth.c +++ b/src/bin/bison/lib/mbswidth.c @@ -1,5 +1,5 @@ /* Determine the number of screen columns needed for a string. - Copyright (C) 2000-2004 Free Software Foundation, Inc. + Copyright (C) 2000-2005 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -13,7 +13,7 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, - Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ /* Written by Bruno Haible . */ @@ -91,7 +91,8 @@ int wcwidth (); character string pointed to by STRING. If a non-printable character occurs, and MBSW_REJECT_UNPRINTABLE is specified, -1 is returned. With flags = MBSW_REJECT_INVALID | MBSW_REJECT_UNPRINTABLE, this is - the multibyte analogon of the wcswidth function. */ + the multibyte analogue of the wcswidth function. + If STRING is not of length < INT_MAX / 2, integer overflow can occur. */ int mbswidth (const char *string, int flags) { @@ -101,7 +102,8 @@ mbswidth (const char *string, int flags) /* Returns the number of columns needed to represent the multibyte character string pointed to by STRING of length NBYTES. If a non-printable character occurs, and MBSW_REJECT_UNPRINTABLE is - specified, -1 is returned. */ + specified, -1 is returned. + If NBYTES is not < INT_MAX / 2, integer overflow can occur. */ int mbsnwidth (const char *string, size_t nbytes, int flags) { diff --git a/src/bin/bison/lib/mbswidth.h b/src/bin/bison/lib/mbswidth.h index 6fec3f4904..1935e0a2dc 100644 --- a/src/bin/bison/lib/mbswidth.h +++ b/src/bin/bison/lib/mbswidth.h @@ -13,7 +13,7 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, - Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #include @@ -30,6 +30,11 @@ #endif +#ifdef __cplusplus +extern "C" { +#endif + + /* Optional flags to influence mbswidth/mbsnwidth behavior. */ /* If this bit is set, return -1 upon finding an invalid or incomplete @@ -49,3 +54,8 @@ extern int mbswidth (const char *string, int flags); /* Returns the number of screen columns needed for the NBYTES bytes starting at BUF. */ extern int mbsnwidth (const char *buf, size_t nbytes, int flags); + + +#ifdef __cplusplus +} +#endif diff --git a/src/bin/bison/lib/obstack.c b/src/bin/bison/lib/obstack.c index 52946d26de..f3ca2c2e06 100644 --- a/src/bin/bison/lib/obstack.c +++ b/src/bin/bison/lib/obstack.c @@ -1,7 +1,7 @@ /* obstack.c - subroutines used implicitly by object stack macros Copyright (C) 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1996, 1997, - 1998, 1999, 2000, 2001, 2002, 2003, 2004 Free Software Foundation, + 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify @@ -16,7 +16,7 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, - Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #ifdef HAVE_CONFIG_H # include @@ -24,6 +24,7 @@ #ifdef _LIBC # include +# include #else # include "obstack.h" #endif @@ -59,19 +60,31 @@ #ifndef ELIDE_CODE +# if HAVE_INTTYPES_H +# include +# endif +# if HAVE_STDINT_H || defined _LIBC +# include +# endif + /* Determine default alignment. */ union fooround { - long int i; + uintmax_t i; long double d; void *p; }; +struct fooalign +{ + char c; + union fooround u; +}; /* If malloc were really smart, it would round addresses to DEFAULT_ALIGNMENT. But in fact it might be less smart and round addresses to as much as DEFAULT_ROUNDING. So we prepare for it to do that. */ enum { - DEFAULT_ALIGNMENT = offsetof (struct { char c; union fooround u; }, u), + DEFAULT_ALIGNMENT = offsetof (struct fooalign, u), DEFAULT_ROUNDING = sizeof (union fooround) }; @@ -103,10 +116,13 @@ int obstack_exit_failure = EXIT_FAILURE; # endif # ifdef _LIBC +# if SHLIB_COMPAT (libc, GLIBC_2_0, GLIBC_2_3_4) /* A looong time ago (before 1994, anyway; we're not sure) this global variable was used by non-GNU-C macros to avoid multiple evaluation. The GNU C library still exports it because somebody might use it. */ -struct obstack *_obstack; +struct obstack *_obstack_compat; +compat_symbol (libc, _obstack_compat, _obstack, GLIBC_2_0); +# endif # endif /* Define a macro that either calls functions with the traditional malloc/free @@ -173,7 +189,8 @@ _obstack_begin (struct obstack *h, chunk = h->chunk = CALL_CHUNKFUN (h, h -> chunk_size); if (!chunk) (*obstack_alloc_failed_handler) (); - h->next_free = h->object_base = chunk->contents; + h->next_free = h->object_base = __PTR_ALIGN ((char *) chunk, chunk->contents, + alignment - 1); h->chunk_limit = chunk->limit = (char *) chunk + h->chunk_size; chunk->prev = 0; @@ -220,7 +237,8 @@ _obstack_begin_1 (struct obstack *h, int size, int alignment, chunk = h->chunk = CALL_CHUNKFUN (h, h -> chunk_size); if (!chunk) (*obstack_alloc_failed_handler) (); - h->next_free = h->object_base = chunk->contents; + h->next_free = h->object_base = __PTR_ALIGN ((char *) chunk, chunk->contents, + alignment - 1); h->chunk_limit = chunk->limit = (char *) chunk + h->chunk_size; chunk->prev = 0; @@ -287,7 +305,10 @@ _obstack_newchunk (struct obstack *h, int length) /* If the object just copied was the only data in OLD_CHUNK, free that chunk and remove it from the chain. But not if that chunk might contain an empty object. */ - if (h->object_base == old_chunk->contents && ! h->maybe_empty_object) + if (! h->maybe_empty_object + && (h->object_base + == __PTR_ALIGN ((char *) old_chunk, old_chunk->contents, + h->alignment_mask))) { new_chunk->prev = old_chunk->prev; CALL_FREEFUN (h, old_chunk); diff --git a/src/bin/bison/lib/obstack.h b/src/bin/bison/lib/obstack.h index c4140ad292..940bc8051e 100644 --- a/src/bin/bison/lib/obstack.h +++ b/src/bin/bison/lib/obstack.h @@ -19,7 +19,7 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, - Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ /* Summary: @@ -206,7 +206,7 @@ extern int obstack_exit_failure; Note that this might not be the final address of the object because a new chunk might be needed to hold the final size. */ -#define obstack_base(h) ((h)->object_base) +#define obstack_base(h) ((void *) (h)->object_base) /* Size for allocating ordinary chunks. */ @@ -287,7 +287,10 @@ __extension__ \ # define obstack_empty_p(OBSTACK) \ __extension__ \ ({ struct obstack const *__o = (OBSTACK); \ - (__o->chunk->prev == 0 && __o->next_free - __o->chunk->contents == 0); }) + (__o->chunk->prev == 0 \ + && __o->next_free == __PTR_ALIGN ((char *) __o->chunk, \ + __o->chunk->contents, \ + __o->alignment_mask)); }) # define obstack_grow(OBSTACK,where,length) \ __extension__ \ @@ -411,7 +414,10 @@ __extension__ \ (unsigned) ((h)->chunk_limit - (h)->next_free) # define obstack_empty_p(h) \ - ((h)->chunk->prev == 0 && (h)->next_free - (h)->chunk->contents == 0) + ((h)->chunk->prev == 0 \ + && (h)->next_free == __PTR_ALIGN ((char *) (h)->chunk, \ + (h)->chunk->contents, \ + (h)->alignment_mask)) /* Note that the call to _obstack_newchunk is enclosed in (..., 0) so that we can avoid having void expressions diff --git a/src/bin/bison/lib/pipe-safer.c b/src/bin/bison/lib/pipe-safer.c new file mode 100644 index 0000000000..5791657654 --- /dev/null +++ b/src/bin/bison/lib/pipe-safer.c @@ -0,0 +1,50 @@ +/* Invoke pipe, but avoid some glitches. + Copyright (C) 2005 Free Software Foundation, Inc. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2, 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, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ + +/* Written by Jim Meyering. */ + +#if HAVE_CONFIG_H +# include +#endif + +#include "unistd-safer.h" + +#include + +/* Like pipe, but ensure that neither of the file descriptors is + STDIN_FILENO, STDOUT_FILENO, or STDERR_FILENO. */ + +int +pipe_safer (int fd[2]) +{ + int fail = pipe (fd); + if (fail) + return fail; + + { + int i; + for (i = 0; i < 2; i++) + { + int f = fd_safer (fd[i]); + if (f < 0) + return -1; + fd[i] = f; + } + } + + return 0; +} diff --git a/src/bin/bison/lib/quote.c b/src/bin/bison/lib/quote.c index 5f11d836b3..4c75029a33 100644 --- a/src/bin/bison/lib/quote.c +++ b/src/bin/bison/lib/quote.c @@ -13,7 +13,7 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, - Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ /* Written by Paul Eggert */ diff --git a/src/bin/bison/lib/quote.h b/src/bin/bison/lib/quote.h index 682f9d1fd2..5400eadb65 100644 --- a/src/bin/bison/lib/quote.h +++ b/src/bin/bison/lib/quote.h @@ -15,7 +15,7 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, - Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ char const *quote_n (int n, char const *name); diff --git a/src/bin/bison/lib/quotearg.c b/src/bin/bison/lib/quotearg.c index fe747fb0b9..eef237f0e6 100644 --- a/src/bin/bison/lib/quotearg.c +++ b/src/bin/bison/lib/quotearg.c @@ -1,6 +1,6 @@ /* quotearg.c - quote arguments for output - Copyright (C) 1998, 1999, 2000, 2001, 2002, 2004 Free Software + Copyright (C) 1998, 1999, 2000, 2001, 2002, 2004, 2005 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify @@ -15,7 +15,7 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, - Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ /* Written by Paul Eggert */ @@ -30,6 +30,7 @@ #include #include #include +#include #include #include @@ -83,7 +84,7 @@ struct quoting_options /* Quote the characters indicated by this bit vector even if the quoting style would not normally require them to be quoted. */ - int quote_these_too[(UCHAR_MAX / INT_BITS) + 1]; + unsigned int quote_these_too[(UCHAR_MAX / INT_BITS) + 1]; }; /* Names of quoting styles. */ @@ -151,7 +152,8 @@ int set_char_quoting (struct quoting_options *o, char c, int i) { unsigned char uc = c; - int *p = (o ? o : &default_quoting_options)->quote_these_too + uc / INT_BITS; + unsigned int *p = + (o ? o : &default_quoting_options)->quote_these_too + uc / INT_BITS; int shift = uc % INT_BITS; int r = (*p >> shift) & 1; *p ^= ((i & 1) ^ r) << shift; @@ -192,8 +194,8 @@ quotearg_buffer_restyled (char *buffer, size_t buffersize, size_t len = 0; char const *quote_string = 0; size_t quote_string_len = 0; - int backslash_escapes = 0; - int unibyte_locale = MB_CUR_MAX == 1; + bool backslash_escapes = false; + bool unibyte_locale = MB_CUR_MAX == 1; #define STORE(c) \ do \ @@ -208,19 +210,20 @@ quotearg_buffer_restyled (char *buffer, size_t buffersize, { case c_quoting_style: STORE ('"'); - backslash_escapes = 1; + backslash_escapes = true; quote_string = "\""; quote_string_len = 1; break; case escape_quoting_style: - backslash_escapes = 1; + backslash_escapes = true; break; case locale_quoting_style: case clocale_quoting_style: { - /* Get translations for open and closing quotation marks. + /* TRANSLATORS: + Get translations for open and closing quotation marks. The message catalog should translate "`" to a left quotation mark suitable for the locale, and similarly for @@ -233,13 +236,17 @@ quotearg_buffer_restyled (char *buffer, size_t buffersize, should translate "'" to U+201D (RIGHT DOUBLE QUOTATION MARK). A British English Unicode locale should instead translate these to U+2018 (LEFT SINGLE QUOTATION MARK) and - U+2019 (RIGHT SINGLE QUOTATION MARK), respectively. */ + U+2019 (RIGHT SINGLE QUOTATION MARK), respectively. + + If you don't know what to put here, please see + + and use glyphs suitable for your language. */ char const *left = gettext_quote (N_("`"), quoting_style); char const *right = gettext_quote (N_("'"), quoting_style); for (quote_string = left; *quote_string; quote_string++) STORE (*quote_string); - backslash_escapes = 1; + backslash_escapes = true; quote_string = right; quote_string_len = strlen (quote_string); } @@ -396,12 +403,12 @@ quotearg_buffer_restyled (char *buffer, size_t buffersize, /* Length of multibyte sequence found so far. */ size_t m; - int printable; + bool printable; if (unibyte_locale) { m = 1; - printable = isprint (c); + printable = isprint (c) != 0; } else { @@ -409,7 +416,7 @@ quotearg_buffer_restyled (char *buffer, size_t buffersize, memset (&mbstate, 0, sizeof mbstate); m = 0; - printable = 1; + printable = true; if (argsize == SIZE_MAX) argsize = strlen (arg); @@ -422,12 +429,12 @@ quotearg_buffer_restyled (char *buffer, size_t buffersize, break; else if (bytes == (size_t) -1) { - printable = 0; + printable = false; break; } else if (bytes == (size_t) -2) { - printable = 0; + printable = false; while (i + m < argsize && arg[i + m]) m++; break; @@ -449,9 +456,9 @@ quotearg_buffer_restyled (char *buffer, size_t buffersize, goto use_shell_always_quoting_style; } } - + if (! iswprint (w)) - printable = 0; + printable = false; m += bytes; } } diff --git a/src/bin/bison/lib/quotearg.h b/src/bin/bison/lib/quotearg.h index 2bbf38d92a..24f26f7d41 100644 --- a/src/bin/bison/lib/quotearg.h +++ b/src/bin/bison/lib/quotearg.h @@ -15,7 +15,7 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, - Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ /* Written by Paul Eggert */ @@ -29,7 +29,7 @@ enum quoting_style { /* Output names as-is (ls --quoting-style=literal). */ literal_quoting_style, - + /* Quote names for the shell if they contain shell metacharacters or would cause ambiguous output (ls --quoting-style=shell). */ shell_quoting_style, diff --git a/src/bin/bison/lib/stdbool_.h b/src/bin/bison/lib/stdbool_.h index e33715a615..3177ae03cf 100644 --- a/src/bin/bison/lib/stdbool_.h +++ b/src/bin/bison/lib/stdbool_.h @@ -13,7 +13,7 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, - Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #ifndef _STDBOOL_H #define _STDBOOL_H diff --git a/src/bin/bison/lib/stdio--.h b/src/bin/bison/lib/stdio--.h new file mode 100644 index 0000000000..b2765fd524 --- /dev/null +++ b/src/bin/bison/lib/stdio--.h @@ -0,0 +1,25 @@ +/* Like stdio.h, but redefine some names to avoid glitches. + + Copyright (C) 2005 Free Software Foundation, Inc. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2, 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, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ + +/* Written by Paul Eggert. */ + +#include +#include "stdio-safer.h" + +#undef fopen +#define fopen fopen_safer diff --git a/src/bin/bison/lib/stdio-safer.h b/src/bin/bison/lib/stdio-safer.h new file mode 100644 index 0000000000..0b9a9ab80c --- /dev/null +++ b/src/bin/bison/lib/stdio-safer.h @@ -0,0 +1,23 @@ +/* Invoke stdio functions, but avoid some glitches. + + Copyright (C) 2001, 2003 Free Software Foundation, Inc. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2, 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, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ + +/* Written by Paul Eggert. */ + +#include + +FILE *fopen_safer (char const *, char const *); diff --git a/src/bin/bison/lib/stpcpy.c b/src/bin/bison/lib/stpcpy.c index a01636cd1c..acda21a26f 100644 --- a/src/bin/bison/lib/stpcpy.c +++ b/src/bin/bison/lib/stpcpy.c @@ -16,7 +16,7 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #ifdef HAVE_CONFIG_H diff --git a/src/bin/bison/lib/stpcpy.h b/src/bin/bison/lib/stpcpy.h index b579c5c9de..53c4ce00ab 100644 --- a/src/bin/bison/lib/stpcpy.h +++ b/src/bin/bison/lib/stpcpy.h @@ -13,7 +13,7 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, - Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #ifndef _STPCPY_H #define _STPCPY_H @@ -25,9 +25,17 @@ #else +#ifdef __cplusplus +extern "C" { +#endif + /* Copy SRC to DST, returning the address of the terminating '\0' in DST. */ extern char *stpcpy (char *dst, const char *src); +#ifdef __cplusplus +} +#endif + #endif #endif /* _STPCPY_H */ diff --git a/src/bin/bison/lib/strdup.c b/src/bin/bison/lib/strdup.c new file mode 100644 index 0000000000..d6d0116204 --- /dev/null +++ b/src/bin/bison/lib/strdup.c @@ -0,0 +1,56 @@ +/* Copyright (C) 1991, 1996, 1997, 1998, 2002, 2003, 2004 Free Software + Foundation, Inc. + + This file is part of the GNU C Library. + + 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 2, 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, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ + +#ifdef HAVE_CONFIG_H +# include +#endif + +#ifndef _LIBC +/* Get specification. */ +# include "strdup.h" +#endif + +#include +#include + +#undef __strdup +#undef strdup + +#ifndef weak_alias +# define __strdup strdup +#endif + +/* Duplicate S, returning an identical malloc'd string. */ +char * +__strdup (const char *s) +{ + size_t len = strlen (s) + 1; + void *new = malloc (len); + + if (new == NULL) + return NULL; + + return (char *) memcpy (new, s, len); +} +#ifdef libc_hidden_def +libc_hidden_def (__strdup) +#endif +#ifdef weak_alias +weak_alias (__strdup, strdup) +#endif diff --git a/src/bin/bison/lib/strdup.h b/src/bin/bison/lib/strdup.h new file mode 100644 index 0000000000..a0d5fb929c --- /dev/null +++ b/src/bin/bison/lib/strdup.h @@ -0,0 +1,29 @@ +/* strdup.h -- duplicate a string + Copyright (C) 2004 Free Software Foundation, Inc. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2, 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, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ + +#ifndef STRDUP_H_ +#define STRDUP_H_ + +/* Get strdup declaration, if available. */ +#include + +#if defined HAVE_DECL_STRDUP && !HAVE_DECL_STRDUP && !defined strdup +/* Duplicate S, returning an identical malloc'd string. */ +extern char *strdup (const char *s); +#endif + +#endif /* STRDUP_H_ */ diff --git a/src/bin/bison/lib/stripslash.c b/src/bin/bison/lib/stripslash.c index c6b319e69f..870a66f387 100644 --- a/src/bin/bison/lib/stripslash.c +++ b/src/bin/bison/lib/stripslash.c @@ -1,5 +1,6 @@ /* stripslash.c -- remove redundant trailing slashes from a file name - Copyright (C) 1990, 2001, 2003 Free Software Foundation, Inc. + + Copyright (C) 1990, 2001, 2003, 2004, 2005 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -13,7 +14,7 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, - Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #if HAVE_CONFIG_H # include @@ -21,19 +22,19 @@ #include "dirname.h" -/* Remove trailing slashes from PATH. - Return nonzero if a trailing slash was removed. - This is useful when using filename completion from a shell that +/* Remove trailing slashes from FILE. + Return true if a trailing slash was removed. + This is useful when using file name completion from a shell that adds a "/" after directory names (such as tcsh and bash), because the Unix rename and rmdir system calls return an "Invalid argument" error - when given a path that ends in "/" (except for the root directory). */ + when given a file that ends in "/" (except for the root directory). */ -int -strip_trailing_slashes (char *path) +bool +strip_trailing_slashes (char *file) { - char *base = base_name (path); + char *base = base_name (file); char *base_lim = base + base_len (base); - int had_slash = *base_lim; + bool had_slash = (*base_lim != '\0'); *base_lim = '\0'; return had_slash; } diff --git a/src/bin/bison/lib/strndup.c b/src/bin/bison/lib/strndup.c index f85627e879..b2d7c0e0bb 100644 --- a/src/bin/bison/lib/strndup.c +++ b/src/bin/bison/lib/strndup.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1996, 1997, 1998, 2000, 2003 Free Software Foundation, Inc. +/* Copyright (C) 1996, 1997, 1998, 2000, 2003, 2005 Free Software Foundation, Inc. NOTE: The canonical source of this file is maintained with the GNU C Library. Bugs can be reported to bug-glibc@prep.ai.mit.edu. @@ -15,7 +15,7 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, - Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #ifdef HAVE_CONFIG_H # include "config.h" @@ -24,12 +24,8 @@ #include #include -#ifndef HAVE_DECL_STRNLEN -"this configure-time declaration test was not run" -#endif -#if !HAVE_DECL_STRNLEN -size_t strnlen (); -#endif +/* Get strnlen. */ +#include "strnlen.h" #undef __strndup #undef strndup diff --git a/src/bin/bison/lib/strndup.h b/src/bin/bison/lib/strndup.h index 318e799839..8eae493adc 100644 --- a/src/bin/bison/lib/strndup.h +++ b/src/bin/bison/lib/strndup.h @@ -13,7 +13,7 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, - Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #if HAVE_STRNDUP diff --git a/src/bin/bison/lib/strnlen.c b/src/bin/bison/lib/strnlen.c index c9f3898451..642c66fac8 100644 --- a/src/bin/bison/lib/strnlen.c +++ b/src/bin/bison/lib/strnlen.c @@ -14,7 +14,7 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, - Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #if HAVE_CONFIG_H # include diff --git a/src/bin/bison/lib/strnlen.h b/src/bin/bison/lib/strnlen.h new file mode 100644 index 0000000000..ba74dba7b2 --- /dev/null +++ b/src/bin/bison/lib/strnlen.h @@ -0,0 +1,32 @@ +/* Find the length of STRING, but scan at most MAXLEN characters. + Copyright (C) 2005 Free Software Foundation, Inc. + Written by Simon Josefsson. + + 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 2, 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, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ + +#ifndef STRNLEN_H +#define STRNLEN_H + +/* Get strnlen declaration, if available. */ +#include + +#if defined HAVE_DECL_STRNLEN && !HAVE_DECL_STRNLEN +/* Find the length (number of bytes) of STRING, but scan at most + MAXLEN bytes. If no '\0' terminator is found in that many bytes, + return MAXLEN. */ +extern size_t strnlen(const char *string, size_t maxlen); +#endif + +#endif /* STRNLEN_H */ diff --git a/src/bin/bison/lib/subpipe.c b/src/bin/bison/lib/subpipe.c index 8722bac035..7f8e44f2a1 100644 --- a/src/bin/bison/lib/subpipe.c +++ b/src/bin/bison/lib/subpipe.c @@ -1,6 +1,6 @@ /* Subprocesses with pipes. - Copyright (C) 2002, 2004 Free Software Foundation, Inc. + Copyright (C) 2002, 2004, 2005 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -14,7 +14,7 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, - Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ /* Written by Paul Eggert and Florian Krohm . */ @@ -44,9 +44,7 @@ # define STDOUT_FILENO 1 #endif #if ! HAVE_DUP2 && ! defined dup2 -# if HAVE_FCNTL_H -# include -# endif +# include # define dup2(f, t) (close (t), fcntl (f, F_DUPFD, t)) #endif @@ -68,6 +66,7 @@ #endif #include "error.h" +#include "unistd-safer.h" #include "gettext.h" #define _(Msgid) gettext (Msgid) @@ -99,56 +98,44 @@ pid_t create_subpipe (char const * const *argv, int fd[2]) { int pipe_fd[2]; - int from_in_fd; - int from_out_fd; - int to_in_fd; - int to_out_fd; + int child_fd[2]; pid_t pid; - if (pipe (pipe_fd) != 0) - error (EXIT_FAILURE, errno, "pipe"); - to_in_fd = pipe_fd[0]; - to_out_fd = pipe_fd[1]; - - if (pipe (pipe_fd) != 0) - error (EXIT_FAILURE, errno, "pipe"); - from_in_fd = pipe_fd[0]; - from_out_fd = pipe_fd[1]; + if (pipe (child_fd) != 0 + || (child_fd[0] = fd_safer (child_fd[0])) < 0 + || (fd[0] = fd_safer (child_fd[1])) < 0 + || pipe (pipe_fd) != 0 + || (fd[1] = fd_safer (pipe_fd[0])) < 0 + || (child_fd[1] = fd_safer (pipe_fd[1])) < 0) + error (EXIT_FAILURE, errno, + "pipe"); pid = vfork (); if (pid < 0) - error (EXIT_FAILURE, errno, "fork"); + error (EXIT_FAILURE, errno, + "fork"); if (! pid) { /* Child. */ - close (to_out_fd); - close (from_in_fd); - - if (to_in_fd != STDIN_FILENO) - { - dup2 (to_in_fd, STDIN_FILENO); - close (to_in_fd); - } - if (from_out_fd != STDOUT_FILENO) - { - dup2 (from_out_fd, STDOUT_FILENO); - close (from_out_fd); - } + close (fd[0]); + close (fd[1]); + dup2 (child_fd[0], STDIN_FILENO); + close (child_fd[0]); + dup2 (child_fd[1], STDOUT_FILENO); + close (child_fd[1]); /* The cast to (char **) rather than (char * const *) is needed for portability to older hosts with a nonstandard prototype for execvp. */ execvp (argv[0], (char **) argv); - + _exit (errno == ENOENT ? 127 : 126); } /* Parent. */ - close (to_in_fd); - close (from_out_fd); - fd[0] = to_out_fd; - fd[1] = from_in_fd; + close (child_fd[0]); + close (child_fd[1]); return pid; } @@ -161,7 +148,8 @@ reap_subpipe (pid_t pid, char const *program) #if HAVE_WAITPID || defined waitpid int wstatus; if (waitpid (pid, &wstatus, 0) < 0) - error (EXIT_FAILURE, errno, "waitpid"); + error (EXIT_FAILURE, errno, + "waitpid"); else { int status = WIFEXITED (wstatus) ? WEXITSTATUS (wstatus) : -1; diff --git a/src/bin/bison/lib/subpipe.h b/src/bin/bison/lib/subpipe.h index 8e1eb8b46c..7b76bdae41 100644 --- a/src/bin/bison/lib/subpipe.h +++ b/src/bin/bison/lib/subpipe.h @@ -15,8 +15,8 @@ You should have received a copy of the GNU General Public License along with Bison; see the file COPYING. If not, write to the Free - Software Foundation, 59 Temple Place - Suite 330, Boston, MA - 02111-1307, USA. */ + Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA + 02110-1301, USA. */ /* Written by Paul Eggert and Florian Krohm . */ diff --git a/src/bin/bison/lib/timevar.c b/src/bin/bison/lib/timevar.c index 625decbb5c..d647687fea 100644 --- a/src/bin/bison/lib/timevar.c +++ b/src/bin/bison/lib/timevar.c @@ -16,8 +16,8 @@ for more details. You should have received a copy of the GNU General Public License along with Bison; see the file COPYING. If not, write to the Free -Software Foundation, 59 Temple Place - Suite 330, Boston, MA -02111-1307, USA. */ +Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301, USA. */ #if IN_GCC @@ -31,7 +31,7 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA /* This source file is taken from the GCC source code, with slight modifications that are under control of the IN_GCC preprocessor variable. The !IN_GCC part of this file is specific to Bison. */ - + # include "../src/system.h" # if HAVE_SYS_TIME_H # include diff --git a/src/bin/bison/lib/timevar.def b/src/bin/bison/lib/timevar.def index e02d013bd8..04ac392be4 100644 --- a/src/bin/bison/lib/timevar.def +++ b/src/bin/bison/lib/timevar.def @@ -17,8 +17,8 @@ You should have received a copy of the GNU General Public License along with Bison; see the file COPYING. If not, write to - the Free Software Foundation, 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ + the Free Software Foundation, 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. */ /* This file contains timing variable definitions, used by timevar.h and timevar.c. diff --git a/src/bin/bison/lib/timevar.h b/src/bin/bison/lib/timevar.h index 27dab57096..bb9b0c89c6 100644 --- a/src/bin/bison/lib/timevar.h +++ b/src/bin/bison/lib/timevar.h @@ -16,8 +16,8 @@ You should have received a copy of the GNU General Public License along with Bison; see the file COPYING. If not, write to the Free - Software Foundation, 59 Temple Place - Suite 330, Boston, MA - 02111-1307, USA. */ + Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA + 02110-1301, USA. */ #ifndef GCC_TIMEVAR_H #define GCC_TIMEVAR_H diff --git a/src/bin/bison/lib/unistd--.h b/src/bin/bison/lib/unistd--.h new file mode 100644 index 0000000000..1fe6ce8b27 --- /dev/null +++ b/src/bin/bison/lib/unistd--.h @@ -0,0 +1,28 @@ +/* Like unistd.h, but redefine some names to avoid glitches. + + Copyright (C) 2005 Free Software Foundation, Inc. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2, 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, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ + +/* Written by Paul Eggert. */ + +#include +#include "unistd-safer.h" + +#undef dup +#define dup dup_safer + +#undef pipe +#define pipe pipe_safer diff --git a/src/bin/bison/lib/unistd-safer.h b/src/bin/bison/lib/unistd-safer.h new file mode 100644 index 0000000000..f95999d391 --- /dev/null +++ b/src/bin/bison/lib/unistd-safer.h @@ -0,0 +1,23 @@ +/* Invoke unistd-like functions, but avoid some glitches. + + Copyright (C) 2001, 2003, 2005 Free Software Foundation, Inc. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2, 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, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ + +/* Written by Paul Eggert. */ + +int dup_safer (int); +int fd_safer (int); +int pipe_safer (int[2]); diff --git a/src/bin/bison/lib/vbitset.c b/src/bin/bison/lib/vbitset.c index c055fbfe13..a7d9bdec07 100644 --- a/src/bin/bison/lib/vbitset.c +++ b/src/bin/bison/lib/vbitset.c @@ -1,5 +1,5 @@ /* Variable array bitsets. - Copyright (C) 2002, 2003, 2004 Free Software Foundation, Inc. + Copyright (C) 2002, 2003, 2004, 2005 Free Software Foundation, Inc. Contributed by Michael Hayes (m.hayes@elec.canterbury.ac.nz). This program is free software; you can redistribute it and/or modify @@ -14,7 +14,7 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #ifdef HAVE_CONFIG_H @@ -27,7 +27,7 @@ /* This file implements variable size bitsets stored as a variable length array of words. Any unused bits in the last word must be - zero. + zero. Note that binary or ternary operations assume that each bitset operand has the same size. @@ -38,7 +38,7 @@ static void vbitset_unused_clear (bitset); static void vbitset_set (bitset, bitset_bindex); static void vbitset_reset (bitset, bitset_bindex); static bool vbitset_test (bitset, bitset_bindex); -static bitset_bindex vbitset_list (bitset, bitset_bindex *, +static bitset_bindex vbitset_list (bitset, bitset_bindex *, bitset_bindex, bitset_bindex *); static bitset_bindex vbitset_list_reverse (bitset, bitset_bindex *, bitset_bindex, bitset_bindex *); @@ -48,7 +48,8 @@ static bitset_bindex vbitset_list_reverse (bitset, bitset_bindex *, #define VBITSET_SIZE(X) ((X)->b.csize) #define VBITSET_ASIZE(X) ((X)->v.size) - +#undef min +#undef max #define min(a, b) ((a) > (b) ? (b) : (a)) #define max(a, b) ((a) > (b) ? (a) : (b)) @@ -68,7 +69,7 @@ vbitset_resize (bitset src, bitset_bindex n_bits) { bitset_windex size; - /* The bitset needs to grow. If we already have enough memory + /* The bitset needs to grow. If we already have enough memory allocated, then just zero what we need. */ if (newsize > VBITSET_ASIZE (src)) { @@ -81,13 +82,13 @@ vbitset_resize (bitset src, bitset_bindex n_bits) size = newsize; else size = newsize + newsize / 4; - + VBITSET_WORDS (src) = realloc (VBITSET_WORDS (src), size * sizeof (bitset_word)); VBITSET_ASIZE (src) = size; } - memset (VBITSET_WORDS (src) + oldsize, 0, + memset (VBITSET_WORDS (src) + oldsize, 0, (newsize - oldsize) * sizeof (bitset_word)); VBITSET_SIZE (src) = newsize; } @@ -426,7 +427,7 @@ vbitset_not (bitset dst, bitset src) sizeof (bitset_word) * (dsize - ssize)); } - + static bool vbitset_equal_p (bitset dst, bitset src) { @@ -465,7 +466,7 @@ vbitset_subset_p (bitset dst, bitset src) bitset_word *dstp = VBITSET_WORDS (dst); bitset_windex ssize = VBITSET_SIZE (src); bitset_windex dsize = VBITSET_SIZE (dst); - + for (i = 0; i < min (ssize, dsize); i++, dstp++, srcp++) if (*dstp != (*srcp | *dstp)) return 0; @@ -520,7 +521,7 @@ vbitset_and (bitset dst, bitset src1, bitset src2) for (i = 0; i < min (ssize1, ssize2); i++) *dstp++ = *src1p++ & *src2p++; - + memset (dstp, 0, sizeof (bitset_word) * (dsize - min (ssize1, ssize2))); } @@ -549,14 +550,14 @@ vbitset_and_cmp (bitset dst, bitset src1, bitset src2) for (i = 0; i < min (ssize1, ssize2); i++, dstp++) { bitset_word tmp = *src1p++ & *src2p++; - + if (*dstp != tmp) { changed = 1; *dstp = tmp; } } - + if (ssize2 > ssize1) { src1p = src2p; @@ -600,7 +601,7 @@ vbitset_andn (bitset dst, bitset src1, bitset src2) for (i = 0; i < min (ssize1, ssize2); i++) *dstp++ = *src1p++ & ~(*src2p++); - + if (ssize2 > ssize1) { for (; i < ssize2; i++) @@ -642,14 +643,14 @@ vbitset_andn_cmp (bitset dst, bitset src1, bitset src2) for (i = 0; i < min (ssize1, ssize2); i++, dstp++) { bitset_word tmp = *src1p++ & ~(*src2p++); - + if (*dstp != tmp) { changed = 1; *dstp = tmp; } } - + if (ssize2 > ssize1) { for (; i < ssize2; i++, dstp++) @@ -668,7 +669,7 @@ vbitset_andn_cmp (bitset dst, bitset src1, bitset src2) for (; i < ssize1; i++, dstp++) { bitset_word tmp = *src1p++; - + if (*dstp != tmp) { changed = 1; @@ -705,7 +706,7 @@ vbitset_or (bitset dst, bitset src1, bitset src2) for (i = 0; i < min (ssize1, ssize2); i++) *dstp++ = *src1p++ | *src2p++; - + if (ssize2 > ssize1) { src1p = src2p; @@ -743,14 +744,14 @@ vbitset_or_cmp (bitset dst, bitset src1, bitset src2) for (i = 0; i < min (ssize1, ssize2); i++, dstp++) { bitset_word tmp = *src1p++ | *src2p++; - + if (*dstp != tmp) { changed = 1; *dstp = tmp; } } - + if (ssize2 > ssize1) { src1p = src2p; @@ -760,7 +761,7 @@ vbitset_or_cmp (bitset dst, bitset src1, bitset src2) for (; i < ssize1; i++, dstp++) { bitset_word tmp = *src1p++; - + if (*dstp != tmp) { changed = 1; @@ -796,7 +797,7 @@ vbitset_xor (bitset dst, bitset src1, bitset src2) for (i = 0; i < min (ssize1, ssize2); i++) *dstp++ = *src1p++ ^ *src2p++; - + if (ssize2 > ssize1) { src1p = src2p; @@ -834,14 +835,14 @@ vbitset_xor_cmp (bitset dst, bitset src1, bitset src2) for (i = 0; i < min (ssize1, ssize2); i++, dstp++) { bitset_word tmp = *src1p++ ^ *src2p++; - + if (*dstp != tmp) { changed = 1; *dstp = tmp; } } - + if (ssize2 > ssize1) { src1p = src2p; @@ -851,7 +852,7 @@ vbitset_xor_cmp (bitset dst, bitset src1, bitset src2) for (; i < ssize1; i++, dstp++) { bitset_word tmp = *src1p++; - + if (*dstp != tmp) { changed = 1; @@ -877,7 +878,7 @@ vbitset_and_or (bitset dst, bitset src1, bitset src2, bitset src3) bitset_word *src3p; bitset_word *dstp; bitset_windex size; - + if (BITSET_NBITS_ (src1) != BITSET_NBITS_ (src2) || BITSET_NBITS_ (src1) != BITSET_NBITS_ (src3)) { @@ -908,7 +909,7 @@ vbitset_and_or_cmp (bitset dst, bitset src1, bitset src2, bitset src3) bitset_word *src3p; bitset_word *dstp; bitset_windex size; - + if (BITSET_NBITS_ (src1) != BITSET_NBITS_ (src2) || BITSET_NBITS_ (src1) != BITSET_NBITS_ (src3)) return bitset_and_or_cmp_ (dst, src1, src2, src3); @@ -920,11 +921,11 @@ vbitset_and_or_cmp (bitset dst, bitset src1, bitset src2, bitset src3) src3p = VBITSET_WORDS (src3); dstp = VBITSET_WORDS (dst); size = VBITSET_SIZE (dst); - + for (i = 0; i < size; i++, dstp++) { bitset_word tmp = (*src1p++ & *src2p++) | *src3p++; - + if (*dstp != tmp) { changed = 1; @@ -944,7 +945,7 @@ vbitset_andn_or (bitset dst, bitset src1, bitset src2, bitset src3) bitset_word *src3p; bitset_word *dstp; bitset_windex size; - + if (BITSET_NBITS_ (src1) != BITSET_NBITS_ (src2) || BITSET_NBITS_ (src1) != BITSET_NBITS_ (src3)) { @@ -975,7 +976,7 @@ vbitset_andn_or_cmp (bitset dst, bitset src1, bitset src2, bitset src3) bitset_word *src3p; bitset_word *dstp; bitset_windex size; - + if (BITSET_NBITS_ (src1) != BITSET_NBITS_ (src2) || BITSET_NBITS_ (src1) != BITSET_NBITS_ (src3)) return bitset_andn_or_cmp_ (dst, src1, src2, src3); @@ -987,11 +988,11 @@ vbitset_andn_or_cmp (bitset dst, bitset src1, bitset src2, bitset src3) src3p = VBITSET_WORDS (src3); dstp = VBITSET_WORDS (dst); size = VBITSET_SIZE (dst); - + for (i = 0; i < size; i++, dstp++) { bitset_word tmp = (*src1p++ & ~(*src2p++)) | *src3p++; - + if (*dstp != tmp) { changed = 1; @@ -1011,7 +1012,7 @@ vbitset_or_and (bitset dst, bitset src1, bitset src2, bitset src3) bitset_word *src3p; bitset_word *dstp; bitset_windex size; - + if (BITSET_NBITS_ (src1) != BITSET_NBITS_ (src2) || BITSET_NBITS_ (src1) != BITSET_NBITS_ (src3)) { @@ -1026,7 +1027,7 @@ vbitset_or_and (bitset dst, bitset src1, bitset src2, bitset src3) src3p = VBITSET_WORDS (src3); dstp = VBITSET_WORDS (dst); size = VBITSET_SIZE (dst); - + for (i = 0; i < size; i++) *dstp++ = (*src1p++ | *src2p++) & *src3p++; } @@ -1042,7 +1043,7 @@ vbitset_or_and_cmp (bitset dst, bitset src1, bitset src2, bitset src3) bitset_word *src3p; bitset_word *dstp; bitset_windex size; - + if (BITSET_NBITS_ (src1) != BITSET_NBITS_ (src2) || BITSET_NBITS_ (src1) != BITSET_NBITS_ (src3)) return bitset_or_and_cmp_ (dst, src1, src2, src3); @@ -1054,11 +1055,11 @@ vbitset_or_and_cmp (bitset dst, bitset src1, bitset src2, bitset src3) src3p = VBITSET_WORDS (src3); dstp = VBITSET_WORDS (dst); size = VBITSET_SIZE (dst); - + for (i = 0; i < size; i++, dstp++) { bitset_word tmp = (*src1p++ | *src2p++) & *src3p++; - + if (*dstp != tmp) { changed = 1; diff --git a/src/bin/bison/lib/vbitset.h b/src/bin/bison/lib/vbitset.h index 2660458749..bab011c478 100644 --- a/src/bin/bison/lib/vbitset.h +++ b/src/bin/bison/lib/vbitset.h @@ -14,10 +14,10 @@ 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, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ +Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #ifndef _VBITSET_H -#define _VBITSET_H +#define _VBITSET_H #include "bitset.h" diff --git a/src/bin/bison/lib/xalloc-die.c b/src/bin/bison/lib/xalloc-die.c new file mode 100644 index 0000000000..637933e308 --- /dev/null +++ b/src/bin/bison/lib/xalloc-die.c @@ -0,0 +1,45 @@ +/* Report a memory allocation failure and exit. + + Copyright (C) 1997, 1998, 1999, 2000, 2002, 2003, 2004 Free + Software Foundation, Inc. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2, 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, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ + +#if HAVE_CONFIG_H +# include +#endif + +#include "xalloc.h" + +#include + +#include "error.h" +#include "exitfail.h" + +#include "gettext.h" +#define _(msgid) gettext (msgid) +#define N_(msgid) msgid + +void +xalloc_die (void) +{ + error (exit_failure, 0, "%s", _("memory exhausted")); + + /* The `noreturn' cannot be given to error, since it may return if + its first argument is 0. To help compilers understand the + xalloc_die does not return, call abort. Also, the abort is a + safety feature if exit_failure is 0 (which shouldn't happen). */ + abort (); +} diff --git a/src/bin/bison/lib/xalloc.h b/src/bin/bison/lib/xalloc.h index 4b6585811b..f80977e309 100644 --- a/src/bin/bison/lib/xalloc.h +++ b/src/bin/bison/lib/xalloc.h @@ -1,7 +1,7 @@ /* xalloc.h -- malloc with out-of-memory checking Copyright (C) 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, - 1999, 2000, 2003 Free Software Foundation, Inc. + 1999, 2000, 2003, 2004 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -15,13 +15,19 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, - Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #ifndef XALLOC_H_ # define XALLOC_H_ # include + +# ifdef __cplusplus +extern "C" { +# endif + + # ifndef __attribute__ # if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 8) || __STRICT_ANSI__ # define __attribute__(x) @@ -32,18 +38,9 @@ # define ATTRIBUTE_NORETURN __attribute__ ((__noreturn__)) # endif -/* If this pointer is non-zero, run the specified function upon each - allocation failure. It is initialized to zero. */ -extern void (*xalloc_fail_func) (void); - -/* If XALLOC_FAIL_FUNC is undefined or a function that returns, this - message is output. It is translated via gettext. - Its value is "memory exhausted". */ -extern char const xalloc_msg_memory_exhausted[]; - -/* This function is always triggered when memory is exhausted. It is - in charge of honoring the two previous items. It exits with status - exit_failure (defined in exitfail.h). This is the +/* This function is always triggered when memory is exhausted. + It must be defined by the application, either explicitly + or by using gnulib's xalloc-die module. This is the function to call when one wants the program to die because of a memory allocation failure. */ extern void xalloc_die (void) ATTRIBUTE_NORETURN; @@ -56,8 +53,8 @@ void *xrealloc (void *p, size_t s); void *xnrealloc (void *p, size_t n, size_t s); void *x2realloc (void *p, size_t *pn); void *x2nrealloc (void *p, size_t *pn, size_t s); -void *xclone (void const *p, size_t s); -char *xstrdup (const char *str); +void *xmemdup (void const *p, size_t s); +char *xstrdup (char const *str); /* Return 1 if an array of N objects, each of size S, cannot exist due to size arithmetic overflow. S must be positive and N must be @@ -74,14 +71,9 @@ char *xstrdup (const char *str); # define xalloc_oversized(n, s) \ ((size_t) (sizeof (ptrdiff_t) <= sizeof (size_t) ? -1 : -2) / (s) < (n)) -/* These macros are deprecated; they will go away soon, and are retained - temporarily only to ease conversion to the functions described above. */ -# define CCLONE(p, n) xclone (p, (n) * sizeof *(p)) -# define CLONE(p) xclone (p, sizeof *(p)) -# define NEW(type, var) type *var = xmalloc (sizeof (type)) -# define XCALLOC(type, n) xcalloc (n, sizeof (type)) -# define XMALLOC(type, n) xnmalloc (n, sizeof (type)) -# define XREALLOC(p, type, n) xnrealloc (p, n, sizeof (type)) -# define XFREE(p) free (p) +# ifdef __cplusplus +} +# endif + #endif /* !XALLOC_H_ */ diff --git a/src/bin/bison/lib/xmalloc.c b/src/bin/bison/lib/xmalloc.c index 181006b43d..6977703b80 100644 --- a/src/bin/bison/lib/xmalloc.c +++ b/src/bin/bison/lib/xmalloc.c @@ -1,7 +1,7 @@ /* xmalloc.c -- malloc with out of memory checking - Copyright (C) 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 2003, - 1999, 2000, 2002, 2003 Free Software Foundation, Inc. + Copyright (C) 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, + 1999, 2000, 2002, 2003, 2004, 2005 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -15,7 +15,7 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, - Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #if HAVE_CONFIG_H # include @@ -26,44 +26,19 @@ #include #include -#include "gettext.h" -#define _(msgid) gettext (msgid) -#define N_(msgid) msgid - -#include "error.h" -#include "exitfail.h" - #ifndef SIZE_MAX # define SIZE_MAX ((size_t) -1) #endif -#ifndef HAVE_MALLOC -"you must run the autoconf test for a GNU libc compatible malloc" +/* 1 if calloc is known to be compatible with GNU calloc. This + matters if we are not also using the calloc module, which defines + HAVE_CALLOC and supports the GNU API even on non-GNU platforms. */ +#if defined HAVE_CALLOC || defined __GLIBC__ +enum { HAVE_GNU_CALLOC = 1 }; +#else +enum { HAVE_GNU_CALLOC = 0 }; #endif -#ifndef HAVE_REALLOC -"you must run the autoconf test for a GNU libc compatible realloc" -#endif - -/* If non NULL, call this function when memory is exhausted. */ -void (*xalloc_fail_func) (void) = 0; - -/* If XALLOC_FAIL_FUNC is NULL, or does return, display this message - before exiting when memory is exhausted. Goes through gettext. */ -char const xalloc_msg_memory_exhausted[] = N_("memory exhausted"); - -void -xalloc_die (void) -{ - if (xalloc_fail_func) - (*xalloc_fail_func) (); - error (exit_failure, 0, "%s", _(xalloc_msg_memory_exhausted)); - /* The `noreturn' cannot be given to error, since it may return if - its first argument is 0. To help compilers understand the - xalloc_die does terminate, call abort. */ - abort (); -} - /* Allocate an array of N objects, each with S bytes of memory, dynamically, with error checking. S must be nonzero. */ @@ -71,7 +46,7 @@ static inline void * xnmalloc_inline (size_t n, size_t s) { void *p; - if (xalloc_oversized (n, s) || ! (p = malloc (n * s))) + if (xalloc_oversized (n, s) || (! (p = malloc (n * s)) && n != 0)) xalloc_die (); return p; } @@ -96,7 +71,7 @@ xmalloc (size_t n) static inline void * xnrealloc_inline (void *p, size_t n, size_t s) { - if (xalloc_oversized (n, s) || ! (p = realloc (p, n * s))) + if (xalloc_oversized (n, s) || (! (p = realloc (p, n * s)) && n != 0)) xalloc_die (); return p; } @@ -238,18 +213,29 @@ xcalloc (size_t n, size_t s) { void *p; /* Test for overflow, since some calloc implementations don't have - proper overflow checks. */ - if (xalloc_oversized (n, s) || ! (p = calloc (n, s))) + proper overflow checks. But omit overflow and size-zero tests if + HAVE_GNU_CALLOC, since GNU calloc catches overflow and never + returns NULL if successful. */ + if ((! HAVE_GNU_CALLOC && xalloc_oversized (n, s)) + || (! (p = calloc (n, s)) && (HAVE_GNU_CALLOC || n != 0))) xalloc_die (); return p; } /* Clone an object P of size S, with error checking. There's no need - for xnclone (P, N, S), since xclone (P, N * S) works without any + for xnmemdup (P, N, S), since xmemdup (P, N * S) works without any need for an arithmetic overflow check. */ void * -xclone (void const *p, size_t s) +xmemdup (void const *p, size_t s) { return memcpy (xmalloc (s), p, s); } + +/* Clone STRING. */ + +char * +xstrdup (char const *string) +{ + return xmemdup (string, strlen (string) + 1); +} diff --git a/src/bin/bison/lib/xstrndup.c b/src/bin/bison/lib/xstrndup.c index 5addbf6637..edf83cf87f 100644 --- a/src/bin/bison/lib/xstrndup.c +++ b/src/bin/bison/lib/xstrndup.c @@ -14,7 +14,7 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, - Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #if HAVE_CONFIG_H # include diff --git a/src/bin/bison/lib/xstrndup.h b/src/bin/bison/lib/xstrndup.h index b09a2fc0bd..88354cfd43 100644 --- a/src/bin/bison/lib/xstrndup.h +++ b/src/bin/bison/lib/xstrndup.h @@ -14,7 +14,7 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, - Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #include diff --git a/src/bin/bison/lib/yyerror.c b/src/bin/bison/lib/yyerror.c index 7d8cace896..b4ce4ba954 100644 --- a/src/bin/bison/lib/yyerror.c +++ b/src/bin/bison/lib/yyerror.c @@ -16,8 +16,8 @@ You should have received a copy of the GNU General Public License along with Bison; see the file COPYING. If not, write to - the Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. */ #include diff --git a/src/bin/bison/m4/alloca.m4 b/src/bin/bison/m4/alloca.m4 deleted file mode 100644 index 6fcb205e94..0000000000 --- a/src/bin/bison/m4/alloca.m4 +++ /dev/null @@ -1,44 +0,0 @@ -# alloca.m4 serial 4 -dnl Copyright (C) 2002, 2003, 2004 Free Software Foundation, Inc. -dnl This file is free software, distributed under the terms of the GNU -dnl General Public License. As a special exception to the GNU General -dnl Public License, this file may be distributed as part of a program -dnl that contains a configuration script generated by Autoconf, under -dnl the same distribution terms as the rest of that program. - -AC_DEFUN([gl_FUNC_ALLOCA], -[ - dnl Work around a bug of AC_EGREP_CPP in autoconf-2.57. - AC_REQUIRE([AC_PROG_CPP]) - AC_REQUIRE([AC_PROG_EGREP]) - - AC_REQUIRE([AC_FUNC_ALLOCA]) - if test $ac_cv_func_alloca_works = no; then - gl_PREREQ_ALLOCA - fi - - # Define an additional variable used in the Makefile substitution. - if test $ac_cv_working_alloca_h = yes; then - AC_EGREP_CPP([Need own alloca], [ -#if defined __GNUC__ || defined _AIX || defined _MSC_VER - Need own alloca -#endif - ], - [AC_DEFINE(HAVE_ALLOCA, 1, - [Define to 1 if you have `alloca' after including , - a header that may be supplied by this distribution.]) - ALLOCA_H=alloca.h], - [ALLOCA_H=]) - else - ALLOCA_H=alloca.h - fi - AC_SUBST([ALLOCA_H]) - - AC_DEFINE(HAVE_ALLOCA_H, 1, - [Define HAVE_ALLOCA_H for backward compatibility with older code - that includes only if HAVE_ALLOCA_H is defined.]) -]) - -# Prerequisites of lib/alloca.c. -# STACK_DIRECTION is already handled by AC_FUNC_ALLOCA. -AC_DEFUN([gl_PREREQ_ALLOCA], [:]) diff --git a/src/bin/bison/m4/dirname.m4 b/src/bin/bison/m4/dirname.m4 deleted file mode 100644 index d0dacf1e06..0000000000 --- a/src/bin/bison/m4/dirname.m4 +++ /dev/null @@ -1,15 +0,0 @@ -# dirname.m4 serial 3 -dnl Copyright (C) 2002, 2003 Free Software Foundation, Inc. -dnl This file is free software, distributed under the terms of the GNU -dnl General Public License. As a special exception to the GNU General -dnl Public License, this file may be distributed as part of a program -dnl that contains a configuration script generated by Autoconf, under -dnl the same distribution terms as the rest of that program. - -AC_DEFUN([gl_DIRNAME], -[ - dnl Prerequisites of lib/dirname.h. - AC_REQUIRE([gl_AC_DOS]) - - dnl No prerequisites of lib/basename.c, lib/dirname.c, lib/stripslash.c. -]) diff --git a/src/bin/bison/m4/dmalloc.m4 b/src/bin/bison/m4/dmalloc.m4 deleted file mode 100644 index f724670891..0000000000 --- a/src/bin/bison/m4/dmalloc.m4 +++ /dev/null @@ -1,22 +0,0 @@ -## ----------------------------------- ## -## Check if --with-dmalloc was given. ## -## From Franc,ois Pinard ## -## ----------------------------------- ## - -# serial 1 - -AC_DEFUN([AM_WITH_DMALLOC], -[AC_MSG_CHECKING([if malloc debugging is wanted]) -AC_ARG_WITH(dmalloc, -[ --with-dmalloc use dmalloc, as in - http://www.dmalloc.com/dmalloc.tar.gz], -[if test "$withval" = yes; then - AC_MSG_RESULT(yes) - AC_DEFINE(WITH_DMALLOC,1, - [Define if using the dmalloc debugging malloc package]) - LIBS="$LIBS -ldmalloc" - LDFLAGS="$LDFLAGS -g" -else - AC_MSG_RESULT(no) -fi], [AC_MSG_RESULT(no)]) -]) diff --git a/src/bin/bison/m4/dos.m4 b/src/bin/bison/m4/dos.m4 deleted file mode 100644 index fc68724f6b..0000000000 --- a/src/bin/bison/m4/dos.m4 +++ /dev/null @@ -1,70 +0,0 @@ -#serial 7 - -# Define some macros required for proper operation of code in lib/*.c -# on MSDOS/Windows systems. - -# Copyright (C) 2000, 2001, 2004 Free Software Foundation, Inc. - -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2, 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, write to the Free Software -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA -# 02111-1307, USA. - -# From Jim Meyering. - -AC_DEFUN([gl_AC_DOS], - [ - AC_CACHE_CHECK([whether system is Windows or MSDOS], [ac_cv_win_or_dos], - [ - AC_TRY_COMPILE([], - [#if !defined _WIN32 && !defined __WIN32__ && !defined __MSDOS__ && !defined __CYGWIN__ -neither MSDOS nor Windows -#endif], - [ac_cv_win_or_dos=yes], - [ac_cv_win_or_dos=no]) - ]) - - if test x"$ac_cv_win_or_dos" = xyes; then - ac_fs_accepts_drive_letter_prefix=1 - ac_fs_backslash_is_file_name_separator=1 - else - ac_fs_accepts_drive_letter_prefix=0 - ac_fs_backslash_is_file_name_separator=0 - fi - - AH_VERBATIM(FILESYSTEM_PREFIX_LEN, - [#if FILESYSTEM_ACCEPTS_DRIVE_LETTER_PREFIX -# define FILESYSTEM_PREFIX_LEN(Filename) \ - ((Filename)[0] && (Filename)[1] == ':' ? 2 : 0) -#else -# define FILESYSTEM_PREFIX_LEN(Filename) 0 -#endif]) - - AC_DEFINE_UNQUOTED([FILESYSTEM_ACCEPTS_DRIVE_LETTER_PREFIX], - $ac_fs_accepts_drive_letter_prefix, - [Define on systems for which file names may have a so-called - `drive letter' prefix, define this to compute the length of that - prefix, including the colon.]) - - AH_VERBATIM(ISSLASH, - [#if FILESYSTEM_BACKSLASH_IS_FILE_NAME_SEPARATOR -# define ISSLASH(C) ((C) == '/' || (C) == '\\') -#else -# define ISSLASH(C) ((C) == '/') -#endif]) - - AC_DEFINE_UNQUOTED([FILESYSTEM_BACKSLASH_IS_FILE_NAME_SEPARATOR], - $ac_fs_backslash_is_file_name_separator, - [Define if the backslash character may also serve as a file name - component separator.]) - ]) diff --git a/src/bin/bison/m4/error.m4 b/src/bin/bison/m4/error.m4 deleted file mode 100644 index da8fb513c6..0000000000 --- a/src/bin/bison/m4/error.m4 +++ /dev/null @@ -1,15 +0,0 @@ -#serial 10 - -AC_DEFUN([gl_ERROR], -[ - AC_FUNC_ERROR_AT_LINE - dnl Note: AC_FUNC_ERROR_AT_LINE does AC_LIBSOURCES([error.h, error.c]). - gl_PREREQ_ERROR -]) - -# Prerequisites of lib/error.c. -AC_DEFUN([gl_PREREQ_ERROR], -[ - AC_REQUIRE([AC_FUNC_STRERROR_R]) - : -]) diff --git a/src/bin/bison/m4/exitfail.m4 b/src/bin/bison/m4/exitfail.m4 deleted file mode 100644 index fa5b14931f..0000000000 --- a/src/bin/bison/m4/exitfail.m4 +++ /dev/null @@ -1,13 +0,0 @@ -# exitfail.m4 serial 3 -dnl Copyright (C) 2002, 2003 Free Software Foundation, Inc. -dnl This file is free software, distributed under the terms of the GNU -dnl General Public License. As a special exception to the GNU General -dnl Public License, this file may be distributed as part of a program -dnl that contains a configuration script generated by Autoconf, under -dnl the same distribution terms as the rest of that program. - -AC_DEFUN([gl_EXITFAIL], -[ - dnl No prerequisites of lib/exitfail.c. - : -]) diff --git a/src/bin/bison/m4/extensions.m4 b/src/bin/bison/m4/extensions.m4 deleted file mode 100644 index 58bc0beb6d..0000000000 --- a/src/bin/bison/m4/extensions.m4 +++ /dev/null @@ -1,29 +0,0 @@ -# Enable extensions on systems that normally disable them. - -# Copyright (C) 2003 Free Software Foundation, Inc. - -# This file is free software, distributed under the terms of the GNU -# General Public License. As a special exception to the GNU General -# Public License, this file may be distributed as part of a program -# that contains a configuration script generated by Autoconf, under -# the same distribution terms as the rest of that program. - -# gl_USE_SYSTEM_EXTENSIONS -# ------------------------ -# Enable extensions on systems that normally disable them, -# typically due to standards-conformance issues. -AC_DEFUN([gl_USE_SYSTEM_EXTENSIONS], [ - AC_BEFORE([$0], [AC_COMPILE_IFELSE]) - AC_BEFORE([$0], [AC_RUN_IFELSE]) - - AC_REQUIRE([AC_GNU_SOURCE]) - AC_REQUIRE([AC_AIX]) - AC_REQUIRE([AC_MINIX]) - - AH_VERBATIM([__EXTENSIONS__], -[/* Enable extensions on Solaris. */ -#ifndef __EXTENSIONS__ -# undef __EXTENSIONS__ -#endif]) - AC_DEFINE([__EXTENSIONS__]) -]) diff --git a/src/bin/bison/m4/getopt.m4 b/src/bin/bison/m4/getopt.m4 deleted file mode 100644 index df602b985f..0000000000 --- a/src/bin/bison/m4/getopt.m4 +++ /dev/null @@ -1,13 +0,0 @@ -# getopt.m4 serial 2 -dnl Copyright (C) 2002, 2003 Free Software Foundation, Inc. -dnl This file is free software, distributed under the terms of the GNU -dnl General Public License. As a special exception to the GNU General -dnl Public License, this file may be distributed as part of a program -dnl that contains a configuration script generated by Autoconf, under -dnl the same distribution terms as the rest of that program. - -AC_DEFUN([gl_GETOPT], -[ - dnl Prerequisites of lib/getopt.c. - : -]) diff --git a/src/bin/bison/m4/gettext.m4 b/src/bin/bison/m4/gettext.m4 deleted file mode 100644 index b0426ddd74..0000000000 --- a/src/bin/bison/m4/gettext.m4 +++ /dev/null @@ -1,371 +0,0 @@ -# gettext.m4 serial 28 (gettext-0.13) -dnl Copyright (C) 1995-2003 Free Software Foundation, Inc. -dnl This file is free software, distributed under the terms of the GNU -dnl General Public License. As a special exception to the GNU General -dnl Public License, this file may be distributed as part of a program -dnl that contains a configuration script generated by Autoconf, under -dnl the same distribution terms as the rest of that program. -dnl -dnl This file can can be used in projects which are not available under -dnl the GNU General Public License or the GNU Library General Public -dnl License but which still want to provide support for the GNU gettext -dnl functionality. -dnl Please note that the actual code of the GNU gettext library is covered -dnl by the GNU Library General Public License, and the rest of the GNU -dnl gettext package package is covered by the GNU General Public License. -dnl They are *not* in the public domain. - -dnl Authors: -dnl Ulrich Drepper , 1995-2000. -dnl Bruno Haible , 2000-2003. - -dnl Macro to add for using GNU gettext. - -dnl Usage: AM_GNU_GETTEXT([INTLSYMBOL], [NEEDSYMBOL], [INTLDIR]). -dnl INTLSYMBOL can be one of 'external', 'no-libtool', 'use-libtool'. The -dnl default (if it is not specified or empty) is 'no-libtool'. -dnl INTLSYMBOL should be 'external' for packages with no intl directory, -dnl and 'no-libtool' or 'use-libtool' for packages with an intl directory. -dnl If INTLSYMBOL is 'use-libtool', then a libtool library -dnl $(top_builddir)/intl/libintl.la will be created (shared and/or static, -dnl depending on --{enable,disable}-{shared,static} and on the presence of -dnl AM-DISABLE-SHARED). If INTLSYMBOL is 'no-libtool', a static library -dnl $(top_builddir)/intl/libintl.a will be created. -dnl If NEEDSYMBOL is specified and is 'need-ngettext', then GNU gettext -dnl implementations (in libc or libintl) without the ngettext() function -dnl will be ignored. If NEEDSYMBOL is specified and is -dnl 'need-formatstring-macros', then GNU gettext implementations that don't -dnl support the ISO C 99 formatstring macros will be ignored. -dnl INTLDIR is used to find the intl libraries. If empty, -dnl the value `$(top_builddir)/intl/' is used. -dnl -dnl The result of the configuration is one of three cases: -dnl 1) GNU gettext, as included in the intl subdirectory, will be compiled -dnl and used. -dnl Catalog format: GNU --> install in $(datadir) -dnl Catalog extension: .mo after installation, .gmo in source tree -dnl 2) GNU gettext has been found in the system's C library. -dnl Catalog format: GNU --> install in $(datadir) -dnl Catalog extension: .mo after installation, .gmo in source tree -dnl 3) No internationalization, always use English msgid. -dnl Catalog format: none -dnl Catalog extension: none -dnl If INTLSYMBOL is 'external', only cases 2 and 3 can occur. -dnl The use of .gmo is historical (it was needed to avoid overwriting the -dnl GNU format catalogs when building on a platform with an X/Open gettext), -dnl but we keep it in order not to force irrelevant filename changes on the -dnl maintainers. -dnl -AC_DEFUN([AM_GNU_GETTEXT], -[ - dnl Argument checking. - ifelse([$1], [], , [ifelse([$1], [external], , [ifelse([$1], [no-libtool], , [ifelse([$1], [use-libtool], , - [errprint([ERROR: invalid first argument to AM_GNU_GETTEXT -])])])])]) - ifelse([$2], [], , [ifelse([$2], [need-ngettext], , [ifelse([$2], [need-formatstring-macros], , - [errprint([ERROR: invalid second argument to AM_GNU_GETTEXT -])])])]) - define(gt_included_intl, ifelse([$1], [external], [no], [yes])) - define(gt_libtool_suffix_prefix, ifelse([$1], [use-libtool], [l], [])) - - AC_REQUIRE([AM_PO_SUBDIRS])dnl - ifelse(gt_included_intl, yes, [ - AC_REQUIRE([AM_INTL_SUBDIR])dnl - ]) - - dnl Prerequisites of AC_LIB_LINKFLAGS_BODY. - AC_REQUIRE([AC_LIB_PREPARE_PREFIX]) - AC_REQUIRE([AC_LIB_RPATH]) - - dnl Sometimes libintl requires libiconv, so first search for libiconv. - dnl Ideally we would do this search only after the - dnl if test "$USE_NLS" = "yes"; then - dnl if test "$gt_cv_func_gnugettext_libc" != "yes"; then - dnl tests. But if configure.in invokes AM_ICONV after AM_GNU_GETTEXT - dnl the configure script would need to contain the same shell code - dnl again, outside any 'if'. There are two solutions: - dnl - Invoke AM_ICONV_LINKFLAGS_BODY here, outside any 'if'. - dnl - Control the expansions in more detail using AC_PROVIDE_IFELSE. - dnl Since AC_PROVIDE_IFELSE is only in autoconf >= 2.52 and not - dnl documented, we avoid it. - ifelse(gt_included_intl, yes, , [ - AC_REQUIRE([AM_ICONV_LINKFLAGS_BODY]) - ]) - - dnl Set USE_NLS. - AM_NLS - - ifelse(gt_included_intl, yes, [ - BUILD_INCLUDED_LIBINTL=no - USE_INCLUDED_LIBINTL=no - ]) - LIBINTL= - LTLIBINTL= - POSUB= - - dnl If we use NLS figure out what method - if test "$USE_NLS" = "yes"; then - gt_use_preinstalled_gnugettext=no - ifelse(gt_included_intl, yes, [ - AC_MSG_CHECKING([whether included gettext is requested]) - AC_ARG_WITH(included-gettext, - [ --with-included-gettext use the GNU gettext library included here], - nls_cv_force_use_gnu_gettext=$withval, - nls_cv_force_use_gnu_gettext=no) - AC_MSG_RESULT($nls_cv_force_use_gnu_gettext) - - nls_cv_use_gnu_gettext="$nls_cv_force_use_gnu_gettext" - if test "$nls_cv_force_use_gnu_gettext" != "yes"; then - ]) - dnl User does not insist on using GNU NLS library. Figure out what - dnl to use. If GNU gettext is available we use this. Else we have - dnl to fall back to GNU NLS library. - - dnl Add a version number to the cache macros. - define([gt_api_version], ifelse([$2], [need-formatstring-macros], 3, ifelse([$2], [need-ngettext], 2, 1))) - define([gt_cv_func_gnugettext_libc], [gt_cv_func_gnugettext]gt_api_version[_libc]) - define([gt_cv_func_gnugettext_libintl], [gt_cv_func_gnugettext]gt_api_version[_libintl]) - - AC_CACHE_CHECK([for GNU gettext in libc], gt_cv_func_gnugettext_libc, - [AC_TRY_LINK([#include -]ifelse([$2], [need-formatstring-macros], -[#ifndef __GNU_GETTEXT_SUPPORTED_REVISION -#define __GNU_GETTEXT_SUPPORTED_REVISION(major) ((major) == 0 ? 0 : -1) -#endif -changequote(,)dnl -typedef int array [2 * (__GNU_GETTEXT_SUPPORTED_REVISION(0) >= 1) - 1]; -changequote([,])dnl -], [])[extern int _nl_msg_cat_cntr; -extern int *_nl_domain_bindings;], - [bindtextdomain ("", ""); -return (int) gettext ("")]ifelse([$2], [need-ngettext], [ + (int) ngettext ("", "", 0)], [])[ + _nl_msg_cat_cntr + *_nl_domain_bindings], - gt_cv_func_gnugettext_libc=yes, - gt_cv_func_gnugettext_libc=no)]) - - if test "$gt_cv_func_gnugettext_libc" != "yes"; then - dnl Sometimes libintl requires libiconv, so first search for libiconv. - ifelse(gt_included_intl, yes, , [ - AM_ICONV_LINK - ]) - dnl Search for libintl and define LIBINTL, LTLIBINTL and INCINTL - dnl accordingly. Don't use AC_LIB_LINKFLAGS_BODY([intl],[iconv]) - dnl because that would add "-liconv" to LIBINTL and LTLIBINTL - dnl even if libiconv doesn't exist. - AC_LIB_LINKFLAGS_BODY([intl]) - AC_CACHE_CHECK([for GNU gettext in libintl], - gt_cv_func_gnugettext_libintl, - [gt_save_CPPFLAGS="$CPPFLAGS" - CPPFLAGS="$CPPFLAGS $INCINTL" - gt_save_LIBS="$LIBS" - LIBS="$LIBS $LIBINTL" - dnl Now see whether libintl exists and does not depend on libiconv. - AC_TRY_LINK([#include -]ifelse([$2], [need-formatstring-macros], -[#ifndef __GNU_GETTEXT_SUPPORTED_REVISION -#define __GNU_GETTEXT_SUPPORTED_REVISION(major) ((major) == 0 ? 0 : -1) -#endif -changequote(,)dnl -typedef int array [2 * (__GNU_GETTEXT_SUPPORTED_REVISION(0) >= 1) - 1]; -changequote([,])dnl -], [])[extern int _nl_msg_cat_cntr; -extern -#ifdef __cplusplus -"C" -#endif -const char *_nl_expand_alias ();], - [bindtextdomain ("", ""); -return (int) gettext ("")]ifelse([$2], [need-ngettext], [ + (int) ngettext ("", "", 0)], [])[ + _nl_msg_cat_cntr + *_nl_expand_alias (0)], - gt_cv_func_gnugettext_libintl=yes, - gt_cv_func_gnugettext_libintl=no) - dnl Now see whether libintl exists and depends on libiconv. - if test "$gt_cv_func_gnugettext_libintl" != yes && test -n "$LIBICONV"; then - LIBS="$LIBS $LIBICONV" - AC_TRY_LINK([#include -]ifelse([$2], [need-formatstring-macros], -[#ifndef __GNU_GETTEXT_SUPPORTED_REVISION -#define __GNU_GETTEXT_SUPPORTED_REVISION(major) ((major) == 0 ? 0 : -1) -#endif -changequote(,)dnl -typedef int array [2 * (__GNU_GETTEXT_SUPPORTED_REVISION(0) >= 1) - 1]; -changequote([,])dnl -], [])[extern int _nl_msg_cat_cntr; -extern -#ifdef __cplusplus -"C" -#endif -const char *_nl_expand_alias ();], - [bindtextdomain ("", ""); -return (int) gettext ("")]ifelse([$2], [need-ngettext], [ + (int) ngettext ("", "", 0)], [])[ + _nl_msg_cat_cntr + *_nl_expand_alias (0)], - [LIBINTL="$LIBINTL $LIBICONV" - LTLIBINTL="$LTLIBINTL $LTLIBICONV" - gt_cv_func_gnugettext_libintl=yes - ]) - fi - CPPFLAGS="$gt_save_CPPFLAGS" - LIBS="$gt_save_LIBS"]) - fi - - dnl If an already present or preinstalled GNU gettext() is found, - dnl use it. But if this macro is used in GNU gettext, and GNU - dnl gettext is already preinstalled in libintl, we update this - dnl libintl. (Cf. the install rule in intl/Makefile.in.) - if test "$gt_cv_func_gnugettext_libc" = "yes" \ - || { test "$gt_cv_func_gnugettext_libintl" = "yes" \ - && test "$PACKAGE" != gettext-runtime \ - && test "$PACKAGE" != gettext-tools; }; then - gt_use_preinstalled_gnugettext=yes - else - dnl Reset the values set by searching for libintl. - LIBINTL= - LTLIBINTL= - INCINTL= - fi - - ifelse(gt_included_intl, yes, [ - if test "$gt_use_preinstalled_gnugettext" != "yes"; then - dnl GNU gettext is not found in the C library. - dnl Fall back on included GNU gettext library. - nls_cv_use_gnu_gettext=yes - fi - fi - - if test "$nls_cv_use_gnu_gettext" = "yes"; then - dnl Mark actions used to generate GNU NLS library. - BUILD_INCLUDED_LIBINTL=yes - USE_INCLUDED_LIBINTL=yes - LIBINTL="ifelse([$3],[],\${top_builddir}/intl,[$3])/libintl.[]gt_libtool_suffix_prefix[]a $LIBICONV" - LTLIBINTL="ifelse([$3],[],\${top_builddir}/intl,[$3])/libintl.[]gt_libtool_suffix_prefix[]a $LTLIBICONV" - LIBS=`echo " $LIBS " | sed -e 's/ -lintl / /' -e 's/^ //' -e 's/ $//'` - fi - - if test "$gt_use_preinstalled_gnugettext" = "yes" \ - || test "$nls_cv_use_gnu_gettext" = "yes"; then - dnl Mark actions to use GNU gettext tools. - CATOBJEXT=.gmo - fi - ]) - - if test "$gt_use_preinstalled_gnugettext" = "yes" \ - || test "$nls_cv_use_gnu_gettext" = "yes"; then - AC_DEFINE(ENABLE_NLS, 1, - [Define to 1 if translation of program messages to the user's native language - is requested.]) - else - USE_NLS=no - fi - fi - - AC_MSG_CHECKING([whether to use NLS]) - AC_MSG_RESULT([$USE_NLS]) - if test "$USE_NLS" = "yes"; then - AC_MSG_CHECKING([where the gettext function comes from]) - if test "$gt_use_preinstalled_gnugettext" = "yes"; then - if test "$gt_cv_func_gnugettext_libintl" = "yes"; then - gt_source="external libintl" - else - gt_source="libc" - fi - else - gt_source="included intl directory" - fi - AC_MSG_RESULT([$gt_source]) - fi - - if test "$USE_NLS" = "yes"; then - - if test "$gt_use_preinstalled_gnugettext" = "yes"; then - if test "$gt_cv_func_gnugettext_libintl" = "yes"; then - AC_MSG_CHECKING([how to link with libintl]) - AC_MSG_RESULT([$LIBINTL]) - AC_LIB_APPENDTOVAR([CPPFLAGS], [$INCINTL]) - fi - - dnl For backward compatibility. Some packages may be using this. - AC_DEFINE(HAVE_GETTEXT, 1, - [Define if the GNU gettext() function is already present or preinstalled.]) - AC_DEFINE(HAVE_DCGETTEXT, 1, - [Define if the GNU dcgettext() function is already present or preinstalled.]) - fi - - dnl We need to process the po/ directory. - POSUB=po - fi - - ifelse(gt_included_intl, yes, [ - dnl If this is used in GNU gettext we have to set BUILD_INCLUDED_LIBINTL - dnl to 'yes' because some of the testsuite requires it. - if test "$PACKAGE" = gettext-runtime || test "$PACKAGE" = gettext-tools; then - BUILD_INCLUDED_LIBINTL=yes - fi - - dnl Make all variables we use known to autoconf. - AC_SUBST(BUILD_INCLUDED_LIBINTL) - AC_SUBST(USE_INCLUDED_LIBINTL) - AC_SUBST(CATOBJEXT) - - dnl For backward compatibility. Some configure.ins may be using this. - nls_cv_header_intl= - nls_cv_header_libgt= - - dnl For backward compatibility. Some Makefiles may be using this. - DATADIRNAME=share - AC_SUBST(DATADIRNAME) - - dnl For backward compatibility. Some Makefiles may be using this. - INSTOBJEXT=.mo - AC_SUBST(INSTOBJEXT) - - dnl For backward compatibility. Some Makefiles may be using this. - GENCAT=gencat - AC_SUBST(GENCAT) - - dnl For backward compatibility. Some Makefiles may be using this. - if test "$USE_INCLUDED_LIBINTL" = yes; then - INTLOBJS="\$(GETTOBJS)" - fi - AC_SUBST(INTLOBJS) - - dnl Enable libtool support if the surrounding package wishes it. - INTL_LIBTOOL_SUFFIX_PREFIX=gt_libtool_suffix_prefix - AC_SUBST(INTL_LIBTOOL_SUFFIX_PREFIX) - ]) - - dnl For backward compatibility. Some Makefiles may be using this. - INTLLIBS="$LIBINTL" - AC_SUBST(INTLLIBS) - - dnl Make all documented variables known to autoconf. - AC_SUBST(LIBINTL) - AC_SUBST(LTLIBINTL) - AC_SUBST(POSUB) -]) - - -dnl Checks for all prerequisites of the intl subdirectory, -dnl except for INTL_LIBTOOL_SUFFIX_PREFIX (and possibly LIBTOOL), INTLOBJS, -dnl USE_INCLUDED_LIBINTL, BUILD_INCLUDED_LIBINTL. - AC_DEFUN([AM_INTL_SUBDIR], []) - - -dnl gt_CHECK_DECL(FUNC, INCLUDES) -dnl Check whether a function is declared. -AC_DEFUN([gt_CHECK_DECL], -[ - AC_CACHE_CHECK([whether $1 is declared], ac_cv_have_decl_$1, - [AC_TRY_COMPILE([$2], [ -#ifndef $1 - char *p = (char *) $1; -#endif -], ac_cv_have_decl_$1=yes, ac_cv_have_decl_$1=no)]) - if test $ac_cv_have_decl_$1 = yes; then - gt_value=1 - else - gt_value=0 - fi - AC_DEFINE_UNQUOTED([HAVE_DECL_]translit($1, [a-z], [A-Z]), [$gt_value], - [Define to 1 if you have the declaration of `$1', and to 0 if you don't.]) -]) - - -dnl Usage: AM_GNU_GETTEXT_VERSION([gettext-version]) -AC_DEFUN([AM_GNU_GETTEXT_VERSION], []) diff --git a/src/bin/bison/m4/gnulib.m4 b/src/bin/bison/m4/gnulib.m4 deleted file mode 100644 index a6a8405539..0000000000 --- a/src/bin/bison/m4/gnulib.m4 +++ /dev/null @@ -1,49 +0,0 @@ -# This file is generated automatically by "bootstrap". -AC_DEFUN([GNULIB_AUTOCONF_SNIPPET],[ -gl_FUNC_ALLOCA - - -gl_DIRNAME - -gl_ERROR - - -gl_EXITFAIL - -dnl gl_USE_SYSTEM_EXTENSIONS must be added quite early to configure.ac. - -gl_GETOPT - -AM_GNU_GETTEXT([external]) - -gl_HARD_LOCALE - -gl_HASH - -AC_FUNC_MALLOC - -gl_MBSWIDTH - -gl_OBSTACK - -gl_QUOTE - -gl_QUOTEARG - -AC_FUNC_REALLOC - -AM_STDBOOL_H - -gl_FUNC_STPCPY - -gl_FUNC_STRNDUP - -gl_FUNC_STRNLEN - -gl_FUNC_GLIBC_UNLOCKED_IO - -gl_XALLOC - -gl_XSTRNDUP - -]) diff --git a/src/bin/bison/m4/hard-locale.m4 b/src/bin/bison/m4/hard-locale.m4 deleted file mode 100644 index 3e2a08ccb5..0000000000 --- a/src/bin/bison/m4/hard-locale.m4 +++ /dev/null @@ -1,14 +0,0 @@ -# hard-locale.m4 serial 2 -dnl Copyright (C) 2002, 2003 Free Software Foundation, Inc. -dnl This file is free software, distributed under the terms of the GNU -dnl General Public License. As a special exception to the GNU General -dnl Public License, this file may be distributed as part of a program -dnl that contains a configuration script generated by Autoconf, under -dnl the same distribution terms as the rest of that program. - -AC_DEFUN([gl_HARD_LOCALE], -[ - dnl Prerequisites of lib/hard-locale.c. - AC_CHECK_HEADERS_ONCE(locale.h) - AC_CHECK_FUNCS_ONCE(setlocale) -]) diff --git a/src/bin/bison/m4/hash.m4 b/src/bin/bison/m4/hash.m4 deleted file mode 100644 index 9fe3211f91..0000000000 --- a/src/bin/bison/m4/hash.m4 +++ /dev/null @@ -1,13 +0,0 @@ -# hash.m4 serial 3 -dnl Copyright (C) 2002, 2003 Free Software Foundation, Inc. -dnl This file is free software, distributed under the terms of the GNU -dnl General Public License. As a special exception to the GNU General -dnl Public License, this file may be distributed as part of a program -dnl that contains a configuration script generated by Autoconf, under -dnl the same distribution terms as the rest of that program. - -AC_DEFUN([gl_HASH], -[ - dnl Prerequisites of lib/hash.c. - AC_REQUIRE([AM_STDBOOL_H]) -]) diff --git a/src/bin/bison/m4/iconv.m4 b/src/bin/bison/m4/iconv.m4 deleted file mode 100644 index c5f3579827..0000000000 --- a/src/bin/bison/m4/iconv.m4 +++ /dev/null @@ -1,103 +0,0 @@ -# iconv.m4 serial AM4 (gettext-0.11.3) -dnl Copyright (C) 2000-2002 Free Software Foundation, Inc. -dnl This file is free software, distributed under the terms of the GNU -dnl General Public License. As a special exception to the GNU General -dnl Public License, this file may be distributed as part of a program -dnl that contains a configuration script generated by Autoconf, under -dnl the same distribution terms as the rest of that program. - -dnl From Bruno Haible. - -AC_DEFUN([AM_ICONV_LINKFLAGS_BODY], -[ - dnl Prerequisites of AC_LIB_LINKFLAGS_BODY. - AC_REQUIRE([AC_LIB_PREPARE_PREFIX]) - AC_REQUIRE([AC_LIB_RPATH]) - - dnl Search for libiconv and define LIBICONV, LTLIBICONV and INCICONV - dnl accordingly. - AC_LIB_LINKFLAGS_BODY([iconv]) -]) - -AC_DEFUN([AM_ICONV_LINK], -[ - dnl Some systems have iconv in libc, some have it in libiconv (OSF/1 and - dnl those with the standalone portable GNU libiconv installed). - - dnl Search for libiconv and define LIBICONV, LTLIBICONV and INCICONV - dnl accordingly. - AC_REQUIRE([AM_ICONV_LINKFLAGS_BODY]) - - dnl Add $INCICONV to CPPFLAGS before performing the following checks, - dnl because if the user has installed libiconv and not disabled its use - dnl via --without-libiconv-prefix, he wants to use it. The first - dnl AC_TRY_LINK will then fail, the second AC_TRY_LINK will succeed. - am_save_CPPFLAGS="$CPPFLAGS" - AC_LIB_APPENDTOVAR([CPPFLAGS], [$INCICONV]) - - AC_CACHE_CHECK(for iconv, am_cv_func_iconv, [ - am_cv_func_iconv="no, consider installing GNU libiconv" - am_cv_lib_iconv=no - AC_TRY_LINK([#include -#include ], - [iconv_t cd = iconv_open("",""); - iconv(cd,NULL,NULL,NULL,NULL); - iconv_close(cd);], - am_cv_func_iconv=yes) - if test "$am_cv_func_iconv" != yes; then - am_save_LIBS="$LIBS" - LIBS="$LIBS $LIBICONV" - AC_TRY_LINK([#include -#include ], - [iconv_t cd = iconv_open("",""); - iconv(cd,NULL,NULL,NULL,NULL); - iconv_close(cd);], - am_cv_lib_iconv=yes - am_cv_func_iconv=yes) - LIBS="$am_save_LIBS" - fi - ]) - if test "$am_cv_func_iconv" = yes; then - AC_DEFINE(HAVE_ICONV, 1, [Define if you have the iconv() function.]) - fi - if test "$am_cv_lib_iconv" = yes; then - AC_MSG_CHECKING([how to link with libiconv]) - AC_MSG_RESULT([$LIBICONV]) - else - dnl If $LIBICONV didn't lead to a usable library, we don't need $INCICONV - dnl either. - CPPFLAGS="$am_save_CPPFLAGS" - LIBICONV= - LTLIBICONV= - fi - AC_SUBST(LIBICONV) - AC_SUBST(LTLIBICONV) -]) - -AC_DEFUN([AM_ICONV], -[ - AM_ICONV_LINK - if test "$am_cv_func_iconv" = yes; then - AC_MSG_CHECKING([for iconv declaration]) - AC_CACHE_VAL(am_cv_proto_iconv, [ - AC_TRY_COMPILE([ -#include -#include -extern -#ifdef __cplusplus -"C" -#endif -#if defined(__STDC__) || defined(__cplusplus) -size_t iconv (iconv_t cd, char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft); -#else -size_t iconv(); -#endif -], [], am_cv_proto_iconv_arg1="", am_cv_proto_iconv_arg1="const") - am_cv_proto_iconv="extern size_t iconv (iconv_t cd, $am_cv_proto_iconv_arg1 char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft);"]) - am_cv_proto_iconv=`echo "[$]am_cv_proto_iconv" | tr -s ' ' | sed -e 's/( /(/'` - AC_MSG_RESULT([$]{ac_t:- - }[$]am_cv_proto_iconv) - AC_DEFINE_UNQUOTED(ICONV_CONST, $am_cv_proto_iconv_arg1, - [Define as const if the declaration of iconv() needs const.]) - fi -]) diff --git a/src/bin/bison/m4/lib-ld.m4 b/src/bin/bison/m4/lib-ld.m4 deleted file mode 100644 index 38aeaec19f..0000000000 --- a/src/bin/bison/m4/lib-ld.m4 +++ /dev/null @@ -1,112 +0,0 @@ -# lib-ld.m4 serial 3 (gettext-0.13) -dnl Copyright (C) 1996-2003 Free Software Foundation, Inc. -dnl This file is free software, distributed under the terms of the GNU -dnl General Public License. As a special exception to the GNU General -dnl Public License, this file may be distributed as part of a program -dnl that contains a configuration script generated by Autoconf, under -dnl the same distribution terms as the rest of that program. - -dnl Subroutines of libtool.m4, -dnl with replacements s/AC_/AC_LIB/ and s/lt_cv/acl_cv/ to avoid collision -dnl with libtool.m4. - -dnl From libtool-1.4. Sets the variable with_gnu_ld to yes or no. -AC_DEFUN([AC_LIB_PROG_LD_GNU], -[AC_CACHE_CHECK([if the linker ($LD) is GNU ld], acl_cv_prog_gnu_ld, -[# I'd rather use --version here, but apparently some GNU ld's only accept -v. -case `$LD -v 2>&1 conf$$.sh - echo "exit 0" >>conf$$.sh - chmod +x conf$$.sh - if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then - PATH_SEPARATOR=';' - else - PATH_SEPARATOR=: - fi - rm -f conf$$.sh -fi -ac_prog=ld -if test "$GCC" = yes; then - # Check if gcc -print-prog-name=ld gives a path. - AC_MSG_CHECKING([for ld used by GCC]) - case $host in - *-*-mingw*) - # gcc leaves a trailing carriage return which upsets mingw - ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;; - *) - ac_prog=`($CC -print-prog-name=ld) 2>&5` ;; - esac - case $ac_prog in - # Accept absolute paths. - [[\\/]* | [A-Za-z]:[\\/]*)] - [re_direlt='/[^/][^/]*/\.\./'] - # Canonicalize the path of ld - ac_prog=`echo $ac_prog| sed 's%\\\\%/%g'` - while echo $ac_prog | grep "$re_direlt" > /dev/null 2>&1; do - ac_prog=`echo $ac_prog| sed "s%$re_direlt%/%"` - done - test -z "$LD" && LD="$ac_prog" - ;; - "") - # If it fails, then pretend we aren't using GCC. - ac_prog=ld - ;; - *) - # If it is relative, then search for the first ld in PATH. - with_gnu_ld=unknown - ;; - esac -elif test "$with_gnu_ld" = yes; then - AC_MSG_CHECKING([for GNU ld]) -else - AC_MSG_CHECKING([for non-GNU ld]) -fi -AC_CACHE_VAL(acl_cv_path_LD, -[if test -z "$LD"; then - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR-:}" - for ac_dir in $PATH; do - test -z "$ac_dir" && ac_dir=. - if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then - acl_cv_path_LD="$ac_dir/$ac_prog" - # Check to see if the program is GNU ld. I'd rather use --version, - # but apparently some GNU ld's only accept -v. - # Break only if it was the GNU/non-GNU ld that we prefer. - case `"$acl_cv_path_LD" -v 2>&1 < /dev/null` in - *GNU* | *'with BFD'*) - test "$with_gnu_ld" != no && break ;; - *) - test "$with_gnu_ld" != yes && break ;; - esac - fi - done - IFS="$ac_save_ifs" -else - acl_cv_path_LD="$LD" # Let the user override the test with a path. -fi]) -LD="$acl_cv_path_LD" -if test -n "$LD"; then - AC_MSG_RESULT($LD) -else - AC_MSG_RESULT(no) -fi -test -z "$LD" && AC_MSG_ERROR([no acceptable ld found in \$PATH]) -AC_LIB_PROG_LD_GNU -]) diff --git a/src/bin/bison/m4/lib-link.m4 b/src/bin/bison/m4/lib-link.m4 deleted file mode 100644 index eeb200d266..0000000000 --- a/src/bin/bison/m4/lib-link.m4 +++ /dev/null @@ -1,551 +0,0 @@ -# lib-link.m4 serial 4 (gettext-0.12) -dnl Copyright (C) 2001-2003 Free Software Foundation, Inc. -dnl This file is free software, distributed under the terms of the GNU -dnl General Public License. As a special exception to the GNU General -dnl Public License, this file may be distributed as part of a program -dnl that contains a configuration script generated by Autoconf, under -dnl the same distribution terms as the rest of that program. - -dnl From Bruno Haible. - -dnl AC_LIB_LINKFLAGS(name [, dependencies]) searches for libname and -dnl the libraries corresponding to explicit and implicit dependencies. -dnl Sets and AC_SUBSTs the LIB${NAME} and LTLIB${NAME} variables and -dnl augments the CPPFLAGS variable. -AC_DEFUN([AC_LIB_LINKFLAGS], -[ - AC_REQUIRE([AC_LIB_PREPARE_PREFIX]) - AC_REQUIRE([AC_LIB_RPATH]) - define([Name],[translit([$1],[./-], [___])]) - define([NAME],[translit([$1],[abcdefghijklmnopqrstuvwxyz./-], - [ABCDEFGHIJKLMNOPQRSTUVWXYZ___])]) - AC_CACHE_CHECK([how to link with lib[]$1], [ac_cv_lib[]Name[]_libs], [ - AC_LIB_LINKFLAGS_BODY([$1], [$2]) - ac_cv_lib[]Name[]_libs="$LIB[]NAME" - ac_cv_lib[]Name[]_ltlibs="$LTLIB[]NAME" - ac_cv_lib[]Name[]_cppflags="$INC[]NAME" - ]) - LIB[]NAME="$ac_cv_lib[]Name[]_libs" - LTLIB[]NAME="$ac_cv_lib[]Name[]_ltlibs" - INC[]NAME="$ac_cv_lib[]Name[]_cppflags" - AC_LIB_APPENDTOVAR([CPPFLAGS], [$INC]NAME) - AC_SUBST([LIB]NAME) - AC_SUBST([LTLIB]NAME) - dnl Also set HAVE_LIB[]NAME so that AC_LIB_HAVE_LINKFLAGS can reuse the - dnl results of this search when this library appears as a dependency. - HAVE_LIB[]NAME=yes - undefine([Name]) - undefine([NAME]) -]) - -dnl AC_LIB_HAVE_LINKFLAGS(name, dependencies, includes, testcode) -dnl searches for libname and the libraries corresponding to explicit and -dnl implicit dependencies, together with the specified include files and -dnl the ability to compile and link the specified testcode. If found, it -dnl sets and AC_SUBSTs HAVE_LIB${NAME}=yes and the LIB${NAME} and -dnl LTLIB${NAME} variables and augments the CPPFLAGS variable, and -dnl #defines HAVE_LIB${NAME} to 1. Otherwise, it sets and AC_SUBSTs -dnl HAVE_LIB${NAME}=no and LIB${NAME} and LTLIB${NAME} to empty. -AC_DEFUN([AC_LIB_HAVE_LINKFLAGS], -[ - AC_REQUIRE([AC_LIB_PREPARE_PREFIX]) - AC_REQUIRE([AC_LIB_RPATH]) - define([Name],[translit([$1],[./-], [___])]) - define([NAME],[translit([$1],[abcdefghijklmnopqrstuvwxyz./-], - [ABCDEFGHIJKLMNOPQRSTUVWXYZ___])]) - - dnl Search for lib[]Name and define LIB[]NAME, LTLIB[]NAME and INC[]NAME - dnl accordingly. - AC_LIB_LINKFLAGS_BODY([$1], [$2]) - - dnl Add $INC[]NAME to CPPFLAGS before performing the following checks, - dnl because if the user has installed lib[]Name and not disabled its use - dnl via --without-lib[]Name-prefix, he wants to use it. - ac_save_CPPFLAGS="$CPPFLAGS" - AC_LIB_APPENDTOVAR([CPPFLAGS], [$INC]NAME) - - AC_CACHE_CHECK([for lib[]$1], [ac_cv_lib[]Name], [ - ac_save_LIBS="$LIBS" - LIBS="$LIBS $LIB[]NAME" - AC_TRY_LINK([$3], [$4], [ac_cv_lib[]Name=yes], [ac_cv_lib[]Name=no]) - LIBS="$ac_save_LIBS" - ]) - if test "$ac_cv_lib[]Name" = yes; then - HAVE_LIB[]NAME=yes - AC_DEFINE([HAVE_LIB]NAME, 1, [Define if you have the $1 library.]) - AC_MSG_CHECKING([how to link with lib[]$1]) - AC_MSG_RESULT([$LIB[]NAME]) - else - HAVE_LIB[]NAME=no - dnl If $LIB[]NAME didn't lead to a usable library, we don't need - dnl $INC[]NAME either. - CPPFLAGS="$ac_save_CPPFLAGS" - LIB[]NAME= - LTLIB[]NAME= - fi - AC_SUBST([HAVE_LIB]NAME) - AC_SUBST([LIB]NAME) - AC_SUBST([LTLIB]NAME) - undefine([Name]) - undefine([NAME]) -]) - -dnl Determine the platform dependent parameters needed to use rpath: -dnl libext, shlibext, hardcode_libdir_flag_spec, hardcode_libdir_separator, -dnl hardcode_direct, hardcode_minus_L. -AC_DEFUN([AC_LIB_RPATH], -[ - AC_REQUIRE([AC_PROG_CC]) dnl we use $CC, $GCC, $LDFLAGS - AC_REQUIRE([AC_LIB_PROG_LD]) dnl we use $LD, $with_gnu_ld - AC_REQUIRE([AC_CANONICAL_HOST]) dnl we use $host - AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT]) dnl we use $ac_aux_dir - AC_CACHE_CHECK([for shared library run path origin], acl_cv_rpath, [ - CC="$CC" GCC="$GCC" LDFLAGS="$LDFLAGS" LD="$LD" with_gnu_ld="$with_gnu_ld" \ - ${CONFIG_SHELL-/bin/sh} "$ac_aux_dir/config.rpath" "$host" > conftest.sh - . ./conftest.sh - rm -f ./conftest.sh - acl_cv_rpath=done - ]) - wl="$acl_cv_wl" - libext="$acl_cv_libext" - shlibext="$acl_cv_shlibext" - hardcode_libdir_flag_spec="$acl_cv_hardcode_libdir_flag_spec" - hardcode_libdir_separator="$acl_cv_hardcode_libdir_separator" - hardcode_direct="$acl_cv_hardcode_direct" - hardcode_minus_L="$acl_cv_hardcode_minus_L" - dnl Determine whether the user wants rpath handling at all. - AC_ARG_ENABLE(rpath, - [ --disable-rpath do not hardcode runtime library paths], - :, enable_rpath=yes) -]) - -dnl AC_LIB_LINKFLAGS_BODY(name [, dependencies]) searches for libname and -dnl the libraries corresponding to explicit and implicit dependencies. -dnl Sets the LIB${NAME}, LTLIB${NAME} and INC${NAME} variables. -AC_DEFUN([AC_LIB_LINKFLAGS_BODY], -[ - define([NAME],[translit([$1],[abcdefghijklmnopqrstuvwxyz./-], - [ABCDEFGHIJKLMNOPQRSTUVWXYZ___])]) - dnl By default, look in $includedir and $libdir. - use_additional=yes - AC_LIB_WITH_FINAL_PREFIX([ - eval additional_includedir=\"$includedir\" - eval additional_libdir=\"$libdir\" - ]) - AC_LIB_ARG_WITH([lib$1-prefix], -[ --with-lib$1-prefix[=DIR] search for lib$1 in DIR/include and DIR/lib - --without-lib$1-prefix don't search for lib$1 in includedir and libdir], -[ - if test "X$withval" = "Xno"; then - use_additional=no - else - if test "X$withval" = "X"; then - AC_LIB_WITH_FINAL_PREFIX([ - eval additional_includedir=\"$includedir\" - eval additional_libdir=\"$libdir\" - ]) - else - additional_includedir="$withval/include" - additional_libdir="$withval/lib" - fi - fi -]) - dnl Search the library and its dependencies in $additional_libdir and - dnl $LDFLAGS. Using breadth-first-seach. - LIB[]NAME= - LTLIB[]NAME= - INC[]NAME= - rpathdirs= - ltrpathdirs= - names_already_handled= - names_next_round='$1 $2' - while test -n "$names_next_round"; do - names_this_round="$names_next_round" - names_next_round= - for name in $names_this_round; do - already_handled= - for n in $names_already_handled; do - if test "$n" = "$name"; then - already_handled=yes - break - fi - done - if test -z "$already_handled"; then - names_already_handled="$names_already_handled $name" - dnl See if it was already located by an earlier AC_LIB_LINKFLAGS - dnl or AC_LIB_HAVE_LINKFLAGS call. - uppername=`echo "$name" | sed -e 'y|abcdefghijklmnopqrstuvwxyz./-|ABCDEFGHIJKLMNOPQRSTUVWXYZ___|'` - eval value=\"\$HAVE_LIB$uppername\" - if test -n "$value"; then - if test "$value" = yes; then - eval value=\"\$LIB$uppername\" - test -z "$value" || LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$value" - eval value=\"\$LTLIB$uppername\" - test -z "$value" || LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }$value" - else - dnl An earlier call to AC_LIB_HAVE_LINKFLAGS has determined - dnl that this library doesn't exist. So just drop it. - : - fi - else - dnl Search the library lib$name in $additional_libdir and $LDFLAGS - dnl and the already constructed $LIBNAME/$LTLIBNAME. - found_dir= - found_la= - found_so= - found_a= - if test $use_additional = yes; then - if test -n "$shlibext" && test -f "$additional_libdir/lib$name.$shlibext"; then - found_dir="$additional_libdir" - found_so="$additional_libdir/lib$name.$shlibext" - if test -f "$additional_libdir/lib$name.la"; then - found_la="$additional_libdir/lib$name.la" - fi - else - if test -f "$additional_libdir/lib$name.$libext"; then - found_dir="$additional_libdir" - found_a="$additional_libdir/lib$name.$libext" - if test -f "$additional_libdir/lib$name.la"; then - found_la="$additional_libdir/lib$name.la" - fi - fi - fi - fi - if test "X$found_dir" = "X"; then - for x in $LDFLAGS $LTLIB[]NAME; do - AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"]) - case "$x" in - -L*) - dir=`echo "X$x" | sed -e 's/^X-L//'` - if test -n "$shlibext" && test -f "$dir/lib$name.$shlibext"; then - found_dir="$dir" - found_so="$dir/lib$name.$shlibext" - if test -f "$dir/lib$name.la"; then - found_la="$dir/lib$name.la" - fi - else - if test -f "$dir/lib$name.$libext"; then - found_dir="$dir" - found_a="$dir/lib$name.$libext" - if test -f "$dir/lib$name.la"; then - found_la="$dir/lib$name.la" - fi - fi - fi - ;; - esac - if test "X$found_dir" != "X"; then - break - fi - done - fi - if test "X$found_dir" != "X"; then - dnl Found the library. - LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-L$found_dir -l$name" - if test "X$found_so" != "X"; then - dnl Linking with a shared library. We attempt to hardcode its - dnl directory into the executable's runpath, unless it's the - dnl standard /usr/lib. - if test "$enable_rpath" = no || test "X$found_dir" = "X/usr/lib"; then - dnl No hardcoding is needed. - LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so" - else - dnl Use an explicit option to hardcode DIR into the resulting - dnl binary. - dnl Potentially add DIR to ltrpathdirs. - dnl The ltrpathdirs will be appended to $LTLIBNAME at the end. - haveit= - for x in $ltrpathdirs; do - if test "X$x" = "X$found_dir"; then - haveit=yes - break - fi - done - if test -z "$haveit"; then - ltrpathdirs="$ltrpathdirs $found_dir" - fi - dnl The hardcoding into $LIBNAME is system dependent. - if test "$hardcode_direct" = yes; then - dnl Using DIR/libNAME.so during linking hardcodes DIR into the - dnl resulting binary. - LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so" - else - if test -n "$hardcode_libdir_flag_spec" && test "$hardcode_minus_L" = no; then - dnl Use an explicit option to hardcode DIR into the resulting - dnl binary. - LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so" - dnl Potentially add DIR to rpathdirs. - dnl The rpathdirs will be appended to $LIBNAME at the end. - haveit= - for x in $rpathdirs; do - if test "X$x" = "X$found_dir"; then - haveit=yes - break - fi - done - if test -z "$haveit"; then - rpathdirs="$rpathdirs $found_dir" - fi - else - dnl Rely on "-L$found_dir". - dnl But don't add it if it's already contained in the LDFLAGS - dnl or the already constructed $LIBNAME - haveit= - for x in $LDFLAGS $LIB[]NAME; do - AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"]) - if test "X$x" = "X-L$found_dir"; then - haveit=yes - break - fi - done - if test -z "$haveit"; then - LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-L$found_dir" - fi - if test "$hardcode_minus_L" != no; then - dnl FIXME: Not sure whether we should use - dnl "-L$found_dir -l$name" or "-L$found_dir $found_so" - dnl here. - LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so" - else - dnl We cannot use $hardcode_runpath_var and LD_RUN_PATH - dnl here, because this doesn't fit in flags passed to the - dnl compiler. So give up. No hardcoding. This affects only - dnl very old systems. - dnl FIXME: Not sure whether we should use - dnl "-L$found_dir -l$name" or "-L$found_dir $found_so" - dnl here. - LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-l$name" - fi - fi - fi - fi - else - if test "X$found_a" != "X"; then - dnl Linking with a static library. - LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_a" - else - dnl We shouldn't come here, but anyway it's good to have a - dnl fallback. - LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-L$found_dir -l$name" - fi - fi - dnl Assume the include files are nearby. - additional_includedir= - case "$found_dir" in - */lib | */lib/) - basedir=`echo "X$found_dir" | sed -e 's,^X,,' -e 's,/lib/*$,,'` - additional_includedir="$basedir/include" - ;; - esac - if test "X$additional_includedir" != "X"; then - dnl Potentially add $additional_includedir to $INCNAME. - dnl But don't add it - dnl 1. if it's the standard /usr/include, - dnl 2. if it's /usr/local/include and we are using GCC on Linux, - dnl 3. if it's already present in $CPPFLAGS or the already - dnl constructed $INCNAME, - dnl 4. if it doesn't exist as a directory. - if test "X$additional_includedir" != "X/usr/include"; then - haveit= - if test "X$additional_includedir" = "X/usr/local/include"; then - if test -n "$GCC"; then - case $host_os in - linux*) haveit=yes;; - esac - fi - fi - if test -z "$haveit"; then - for x in $CPPFLAGS $INC[]NAME; do - AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"]) - if test "X$x" = "X-I$additional_includedir"; then - haveit=yes - break - fi - done - if test -z "$haveit"; then - if test -d "$additional_includedir"; then - dnl Really add $additional_includedir to $INCNAME. - INC[]NAME="${INC[]NAME}${INC[]NAME:+ }-I$additional_includedir" - fi - fi - fi - fi - fi - dnl Look for dependencies. - if test -n "$found_la"; then - dnl Read the .la file. It defines the variables - dnl dlname, library_names, old_library, dependency_libs, current, - dnl age, revision, installed, dlopen, dlpreopen, libdir. - save_libdir="$libdir" - case "$found_la" in - */* | *\\*) . "$found_la" ;; - *) . "./$found_la" ;; - esac - libdir="$save_libdir" - dnl We use only dependency_libs. - for dep in $dependency_libs; do - case "$dep" in - -L*) - additional_libdir=`echo "X$dep" | sed -e 's/^X-L//'` - dnl Potentially add $additional_libdir to $LIBNAME and $LTLIBNAME. - dnl But don't add it - dnl 1. if it's the standard /usr/lib, - dnl 2. if it's /usr/local/lib and we are using GCC on Linux, - dnl 3. if it's already present in $LDFLAGS or the already - dnl constructed $LIBNAME, - dnl 4. if it doesn't exist as a directory. - if test "X$additional_libdir" != "X/usr/lib"; then - haveit= - if test "X$additional_libdir" = "X/usr/local/lib"; then - if test -n "$GCC"; then - case $host_os in - linux*) haveit=yes;; - esac - fi - fi - if test -z "$haveit"; then - haveit= - for x in $LDFLAGS $LIB[]NAME; do - AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"]) - if test "X$x" = "X-L$additional_libdir"; then - haveit=yes - break - fi - done - if test -z "$haveit"; then - if test -d "$additional_libdir"; then - dnl Really add $additional_libdir to $LIBNAME. - LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-L$additional_libdir" - fi - fi - haveit= - for x in $LDFLAGS $LTLIB[]NAME; do - AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"]) - if test "X$x" = "X-L$additional_libdir"; then - haveit=yes - break - fi - done - if test -z "$haveit"; then - if test -d "$additional_libdir"; then - dnl Really add $additional_libdir to $LTLIBNAME. - LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-L$additional_libdir" - fi - fi - fi - fi - ;; - -R*) - dir=`echo "X$dep" | sed -e 's/^X-R//'` - if test "$enable_rpath" != no; then - dnl Potentially add DIR to rpathdirs. - dnl The rpathdirs will be appended to $LIBNAME at the end. - haveit= - for x in $rpathdirs; do - if test "X$x" = "X$dir"; then - haveit=yes - break - fi - done - if test -z "$haveit"; then - rpathdirs="$rpathdirs $dir" - fi - dnl Potentially add DIR to ltrpathdirs. - dnl The ltrpathdirs will be appended to $LTLIBNAME at the end. - haveit= - for x in $ltrpathdirs; do - if test "X$x" = "X$dir"; then - haveit=yes - break - fi - done - if test -z "$haveit"; then - ltrpathdirs="$ltrpathdirs $dir" - fi - fi - ;; - -l*) - dnl Handle this in the next round. - names_next_round="$names_next_round "`echo "X$dep" | sed -e 's/^X-l//'` - ;; - *.la) - dnl Handle this in the next round. Throw away the .la's - dnl directory; it is already contained in a preceding -L - dnl option. - names_next_round="$names_next_round "`echo "X$dep" | sed -e 's,^X.*/,,' -e 's,^lib,,' -e 's,\.la$,,'` - ;; - *) - dnl Most likely an immediate library name. - LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$dep" - LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }$dep" - ;; - esac - done - fi - else - dnl Didn't find the library; assume it is in the system directories - dnl known to the linker and runtime loader. (All the system - dnl directories known to the linker should also be known to the - dnl runtime loader, otherwise the system is severely misconfigured.) - LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-l$name" - LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-l$name" - fi - fi - fi - done - done - if test "X$rpathdirs" != "X"; then - if test -n "$hardcode_libdir_separator"; then - dnl Weird platform: only the last -rpath option counts, the user must - dnl pass all path elements in one option. We can arrange that for a - dnl single library, but not when more than one $LIBNAMEs are used. - alldirs= - for found_dir in $rpathdirs; do - alldirs="${alldirs}${alldirs:+$hardcode_libdir_separator}$found_dir" - done - dnl Note: hardcode_libdir_flag_spec uses $libdir and $wl. - acl_save_libdir="$libdir" - libdir="$alldirs" - eval flag=\"$hardcode_libdir_flag_spec\" - libdir="$acl_save_libdir" - LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$flag" - else - dnl The -rpath options are cumulative. - for found_dir in $rpathdirs; do - acl_save_libdir="$libdir" - libdir="$found_dir" - eval flag=\"$hardcode_libdir_flag_spec\" - libdir="$acl_save_libdir" - LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$flag" - done - fi - fi - if test "X$ltrpathdirs" != "X"; then - dnl When using libtool, the option that works for both libraries and - dnl executables is -R. The -R options are cumulative. - for found_dir in $ltrpathdirs; do - LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-R$found_dir" - done - fi -]) - -dnl AC_LIB_APPENDTOVAR(VAR, CONTENTS) appends the elements of CONTENTS to VAR, -dnl unless already present in VAR. -dnl Works only for CPPFLAGS, not for LIB* variables because that sometimes -dnl contains two or three consecutive elements that belong together. -AC_DEFUN([AC_LIB_APPENDTOVAR], -[ - for element in [$2]; do - haveit= - for x in $[$1]; do - AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"]) - if test "X$x" = "X$element"; then - haveit=yes - break - fi - done - if test -z "$haveit"; then - [$1]="${[$1]}${[$1]:+ }$element" - fi - done -]) diff --git a/src/bin/bison/m4/lib-prefix.m4 b/src/bin/bison/m4/lib-prefix.m4 deleted file mode 100644 index 8aff5a9d20..0000000000 --- a/src/bin/bison/m4/lib-prefix.m4 +++ /dev/null @@ -1,155 +0,0 @@ -# lib-prefix.m4 serial 3 (gettext-0.13) -dnl Copyright (C) 2001-2003 Free Software Foundation, Inc. -dnl This file is free software, distributed under the terms of the GNU -dnl General Public License. As a special exception to the GNU General -dnl Public License, this file may be distributed as part of a program -dnl that contains a configuration script generated by Autoconf, under -dnl the same distribution terms as the rest of that program. - -dnl From Bruno Haible. - -dnl AC_LIB_ARG_WITH is synonymous to AC_ARG_WITH in autoconf-2.13, and -dnl similar to AC_ARG_WITH in autoconf 2.52...2.57 except that is doesn't -dnl require excessive bracketing. -ifdef([AC_HELP_STRING], -[AC_DEFUN([AC_LIB_ARG_WITH], [AC_ARG_WITH([$1],[[$2]],[$3],[$4])])], -[AC_DEFUN([AC_][LIB_ARG_WITH], [AC_ARG_WITH([$1],[$2],[$3],[$4])])]) - -dnl AC_LIB_PREFIX adds to the CPPFLAGS and LDFLAGS the flags that are needed -dnl to access previously installed libraries. The basic assumption is that -dnl a user will want packages to use other packages he previously installed -dnl with the same --prefix option. -dnl This macro is not needed if only AC_LIB_LINKFLAGS is used to locate -dnl libraries, but is otherwise very convenient. -AC_DEFUN([AC_LIB_PREFIX], -[ - AC_BEFORE([$0], [AC_LIB_LINKFLAGS]) - AC_REQUIRE([AC_PROG_CC]) - AC_REQUIRE([AC_CANONICAL_HOST]) - AC_REQUIRE([AC_LIB_PREPARE_PREFIX]) - dnl By default, look in $includedir and $libdir. - use_additional=yes - AC_LIB_WITH_FINAL_PREFIX([ - eval additional_includedir=\"$includedir\" - eval additional_libdir=\"$libdir\" - ]) - AC_LIB_ARG_WITH([lib-prefix], -[ --with-lib-prefix[=DIR] search for libraries in DIR/include and DIR/lib - --without-lib-prefix don't search for libraries in includedir and libdir], -[ - if test "X$withval" = "Xno"; then - use_additional=no - else - if test "X$withval" = "X"; then - AC_LIB_WITH_FINAL_PREFIX([ - eval additional_includedir=\"$includedir\" - eval additional_libdir=\"$libdir\" - ]) - else - additional_includedir="$withval/include" - additional_libdir="$withval/lib" - fi - fi -]) - if test $use_additional = yes; then - dnl Potentially add $additional_includedir to $CPPFLAGS. - dnl But don't add it - dnl 1. if it's the standard /usr/include, - dnl 2. if it's already present in $CPPFLAGS, - dnl 3. if it's /usr/local/include and we are using GCC on Linux, - dnl 4. if it doesn't exist as a directory. - if test "X$additional_includedir" != "X/usr/include"; then - haveit= - for x in $CPPFLAGS; do - AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"]) - if test "X$x" = "X-I$additional_includedir"; then - haveit=yes - break - fi - done - if test -z "$haveit"; then - if test "X$additional_includedir" = "X/usr/local/include"; then - if test -n "$GCC"; then - case $host_os in - linux*) haveit=yes;; - esac - fi - fi - if test -z "$haveit"; then - if test -d "$additional_includedir"; then - dnl Really add $additional_includedir to $CPPFLAGS. - CPPFLAGS="${CPPFLAGS}${CPPFLAGS:+ }-I$additional_includedir" - fi - fi - fi - fi - dnl Potentially add $additional_libdir to $LDFLAGS. - dnl But don't add it - dnl 1. if it's the standard /usr/lib, - dnl 2. if it's already present in $LDFLAGS, - dnl 3. if it's /usr/local/lib and we are using GCC on Linux, - dnl 4. if it doesn't exist as a directory. - if test "X$additional_libdir" != "X/usr/lib"; then - haveit= - for x in $LDFLAGS; do - AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"]) - if test "X$x" = "X-L$additional_libdir"; then - haveit=yes - break - fi - done - if test -z "$haveit"; then - if test "X$additional_libdir" = "X/usr/local/lib"; then - if test -n "$GCC"; then - case $host_os in - linux*) haveit=yes;; - esac - fi - fi - if test -z "$haveit"; then - if test -d "$additional_libdir"; then - dnl Really add $additional_libdir to $LDFLAGS. - LDFLAGS="${LDFLAGS}${LDFLAGS:+ }-L$additional_libdir" - fi - fi - fi - fi - fi -]) - -dnl AC_LIB_PREPARE_PREFIX creates variables acl_final_prefix, -dnl acl_final_exec_prefix, containing the values to which $prefix and -dnl $exec_prefix will expand at the end of the configure script. -AC_DEFUN([AC_LIB_PREPARE_PREFIX], -[ - dnl Unfortunately, prefix and exec_prefix get only finally determined - dnl at the end of configure. - if test "X$prefix" = "XNONE"; then - acl_final_prefix="$ac_default_prefix" - else - acl_final_prefix="$prefix" - fi - if test "X$exec_prefix" = "XNONE"; then - acl_final_exec_prefix='${prefix}' - else - acl_final_exec_prefix="$exec_prefix" - fi - acl_save_prefix="$prefix" - prefix="$acl_final_prefix" - eval acl_final_exec_prefix=\"$acl_final_exec_prefix\" - prefix="$acl_save_prefix" -]) - -dnl AC_LIB_WITH_FINAL_PREFIX([statement]) evaluates statement, with the -dnl variables prefix and exec_prefix bound to the values they will have -dnl at the end of the configure script. -AC_DEFUN([AC_LIB_WITH_FINAL_PREFIX], -[ - acl_save_prefix="$prefix" - prefix="$acl_final_prefix" - acl_save_exec_prefix="$exec_prefix" - exec_prefix="$acl_final_exec_prefix" - $1 - exec_prefix="$acl_save_exec_prefix" - prefix="$acl_save_prefix" -]) diff --git a/src/bin/bison/m4/m4.m4 b/src/bin/bison/m4/m4.m4 deleted file mode 100644 index 1b4b903f3e..0000000000 --- a/src/bin/bison/m4/m4.m4 +++ /dev/null @@ -1,29 +0,0 @@ -# Copyright 2000 Free Software Foundation, Inc. -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2, 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, write to the Free Software -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA -# 02111-1307, USA. - -# BISON_PROG_GNU_M4 -# ----------------- -# Check for GNU m4, at least 1.3 (supports frozen files). -AC_DEFUN([BISON_PROG_GNU_M4], -[AC_PATH_PROGS(M4, gm4 gnum4 m4, m4) -AC_CACHE_CHECK(whether m4 supports frozen files, ac_cv_prog_gnu_m4, -[ac_cv_prog_gnu_m4=no -if test x"$M4" != x; then - case `$M4 --help < /dev/null 2>&1` in - *reload-state*) ac_cv_prog_gnu_m4=yes ;; - esac -fi])]) diff --git a/src/bin/bison/m4/mbrtowc.m4 b/src/bin/bison/m4/mbrtowc.m4 deleted file mode 100644 index 3d8768ecbe..0000000000 --- a/src/bin/bison/m4/mbrtowc.m4 +++ /dev/null @@ -1,27 +0,0 @@ -# mbrtowc.m4 serial 7 -dnl Copyright (C) 2001-2002, 2004 Free Software Foundation, Inc. -dnl This file is free software, distributed under the terms of the GNU -dnl General Public License. As a special exception to the GNU General -dnl Public License, this file may be distributed as part of a program -dnl that contains a configuration script generated by Autoconf, under -dnl the same distribution terms as the rest of that program. - -dnl From Paul Eggert - -dnl This file can be removed, and gl_FUNC_MBRTOWC replaced with -dnl AC_FUNC_MBRTOWC, when autoconf 2.57 can be assumed everywhere. - -AC_DEFUN([gl_FUNC_MBRTOWC], -[ - AC_CACHE_CHECK([whether mbrtowc and mbstate_t are properly declared], - gl_cv_func_mbrtowc, - [AC_TRY_LINK( - [#include ], - [mbstate_t state; return ! (sizeof state && mbrtowc);], - gl_cv_func_mbrtowc=yes, - gl_cv_func_mbrtowc=no)]) - if test $gl_cv_func_mbrtowc = yes; then - AC_DEFINE(HAVE_MBRTOWC, 1, - [Define to 1 if mbrtowc and mbstate_t are properly declared.]) - fi -]) diff --git a/src/bin/bison/m4/mbstate_t.m4 b/src/bin/bison/m4/mbstate_t.m4 deleted file mode 100644 index a07f51bc15..0000000000 --- a/src/bin/bison/m4/mbstate_t.m4 +++ /dev/null @@ -1,32 +0,0 @@ -# mbstate_t.m4 serial 9 -dnl Copyright (C) 2000, 2001, 2002 Free Software Foundation, Inc. -dnl This file is free software, distributed under the terms of the GNU -dnl General Public License. As a special exception to the GNU General -dnl Public License, this file may be distributed as part of a program -dnl that contains a configuration script generated by Autoconf, under -dnl the same distribution terms as the rest of that program. - -# From Paul Eggert. - -# BeOS 5 has but does not define mbstate_t, -# so you can't declare an object of that type. -# Check for this incompatibility with Standard C. - -# AC_TYPE_MBSTATE_T -# ----------------- -AC_DEFUN([AC_TYPE_MBSTATE_T], - [AC_CACHE_CHECK([for mbstate_t], ac_cv_type_mbstate_t, - [AC_COMPILE_IFELSE( - [AC_LANG_PROGRAM( - [AC_INCLUDES_DEFAULT -# include ], - [mbstate_t x; return sizeof x;])], - [ac_cv_type_mbstate_t=yes], - [ac_cv_type_mbstate_t=no])]) - if test $ac_cv_type_mbstate_t = yes; then - AC_DEFINE([HAVE_MBSTATE_T], 1, - [Define to 1 if declares mbstate_t.]) - else - AC_DEFINE([mbstate_t], int, - [Define to a type if does not define.]) - fi]) diff --git a/src/bin/bison/m4/mbswidth.m4 b/src/bin/bison/m4/mbswidth.m4 deleted file mode 100644 index f61be107a8..0000000000 --- a/src/bin/bison/m4/mbswidth.m4 +++ /dev/null @@ -1,55 +0,0 @@ -#serial 11 - -dnl autoconf tests required for use of mbswidth.c -dnl From Bruno Haible. - -AC_DEFUN([gl_MBSWIDTH], -[ - AC_CHECK_HEADERS_ONCE(wchar.h wctype.h) - AC_CHECK_FUNCS_ONCE(isascii iswprint mbsinit) - AC_CHECK_FUNCS(iswcntrl wcwidth) - gl_FUNC_MBRTOWC - - AC_CACHE_CHECK([whether wcwidth is declared], ac_cv_have_decl_wcwidth, - [AC_TRY_COMPILE([ -/* AIX 3.2.5 declares wcwidth in . */ -#if HAVE_STRING_H -# include -#endif -#if HAVE_WCHAR_H -# include -#endif -], [ -#ifndef wcwidth - char *p = (char *) wcwidth; -#endif -], ac_cv_have_decl_wcwidth=yes, ac_cv_have_decl_wcwidth=no)]) - if test $ac_cv_have_decl_wcwidth = yes; then - ac_val=1 - else - ac_val=0 - fi - AC_DEFINE_UNQUOTED(HAVE_DECL_WCWIDTH, $ac_val, - [Define to 1 if you have the declaration of wcwidth(), and to 0 otherwise.]) - - dnl UnixWare 7.1.1 has a declaration of a function mbswidth() - dnl that clashes with ours. - AC_CACHE_CHECK([whether mbswidth is declared in ], - ac_cv_have_decl_mbswidth, - [AC_TRY_COMPILE([ -#if HAVE_WCHAR_H -# include -#endif -], [ - char *p = (char *) mbswidth; -], ac_cv_have_decl_mbswidth=yes, ac_cv_have_decl_mbswidth=no)]) - if test $ac_cv_have_decl_mbswidth = yes; then - ac_val=1 - else - ac_val=0 - fi - AC_DEFINE_UNQUOTED(HAVE_DECL_MBSWIDTH_IN_WCHAR_H, $ac_val, - [Define to 1 if you have a declaration of mbswidth() in , and to 0 otherwise.]) - - AC_TYPE_MBSTATE_T -]) diff --git a/src/bin/bison/m4/nls.m4 b/src/bin/bison/m4/nls.m4 deleted file mode 100644 index 36bc49317c..0000000000 --- a/src/bin/bison/m4/nls.m4 +++ /dev/null @@ -1,49 +0,0 @@ -# nls.m4 serial 1 (gettext-0.12) -dnl Copyright (C) 1995-2003 Free Software Foundation, Inc. -dnl This file is free software, distributed under the terms of the GNU -dnl General Public License. As a special exception to the GNU General -dnl Public License, this file may be distributed as part of a program -dnl that contains a configuration script generated by Autoconf, under -dnl the same distribution terms as the rest of that program. -dnl -dnl This file can can be used in projects which are not available under -dnl the GNU General Public License or the GNU Library General Public -dnl License but which still want to provide support for the GNU gettext -dnl functionality. -dnl Please note that the actual code of the GNU gettext library is covered -dnl by the GNU Library General Public License, and the rest of the GNU -dnl gettext package package is covered by the GNU General Public License. -dnl They are *not* in the public domain. - -dnl Authors: -dnl Ulrich Drepper , 1995-2000. -dnl Bruno Haible , 2000-2003. - -AC_DEFUN([AM_NLS], -[ - AC_MSG_CHECKING([whether NLS is requested]) - dnl Default is enabled NLS - AC_ARG_ENABLE(nls, - [ --disable-nls do not use Native Language Support], - USE_NLS=$enableval, USE_NLS=yes) - AC_MSG_RESULT($USE_NLS) - AC_SUBST(USE_NLS) -]) - -AC_DEFUN([AM_MKINSTALLDIRS], -[ - dnl If the AC_CONFIG_AUX_DIR macro for autoconf is used we possibly - dnl find the mkinstalldirs script in another subdir but $(top_srcdir). - dnl Try to locate it. - MKINSTALLDIRS= - if test -n "$ac_aux_dir"; then - case "$ac_aux_dir" in - /*) MKINSTALLDIRS="$ac_aux_dir/mkinstalldirs" ;; - *) MKINSTALLDIRS="\$(top_builddir)/$ac_aux_dir/mkinstalldirs" ;; - esac - fi - if test -z "$MKINSTALLDIRS"; then - MKINSTALLDIRS="\$(top_srcdir)/mkinstalldirs" - fi - AC_SUBST(MKINSTALLDIRS) -]) diff --git a/src/bin/bison/m4/obstack.m4 b/src/bin/bison/m4/obstack.m4 deleted file mode 100644 index 9a56027858..0000000000 --- a/src/bin/bison/m4/obstack.m4 +++ /dev/null @@ -1,19 +0,0 @@ -# obstack.m4 serial 2 -dnl Copyright (C) 2002, 2003 Free Software Foundation, Inc. -dnl This file is free software, distributed under the terms of the GNU -dnl General Public License. As a special exception to the GNU General -dnl Public License, this file may be distributed as part of a program -dnl that contains a configuration script generated by Autoconf, under -dnl the same distribution terms as the rest of that program. - -AC_DEFUN([gl_OBSTACK], -[ - AC_FUNC_OBSTACK - dnl Note: AC_FUNC_OBSTACK does AC_LIBSOURCES([obstack.h, obstack.c]). - if test $ac_cv_func_obstack = no; then - gl_PREREQ_OBSTACK - fi -]) - -# Prerequisites of lib/obstack.c. -AC_DEFUN([gl_PREREQ_OBSTACK], [:]) diff --git a/src/bin/bison/m4/onceonly.m4 b/src/bin/bison/m4/onceonly.m4 deleted file mode 100644 index 9fc510e06e..0000000000 --- a/src/bin/bison/m4/onceonly.m4 +++ /dev/null @@ -1,86 +0,0 @@ -# onceonly_2_57.m4 serial 3 -dnl Copyright (C) 2002-2003 Free Software Foundation, Inc. -dnl This file is free software, distributed under the terms of the GNU -dnl General Public License. As a special exception to the GNU General -dnl Public License, this file may be distributed as part of a program -dnl that contains a configuration script generated by Autoconf, under -dnl the same distribution terms as the rest of that program. - -dnl This file defines some "once only" variants of standard autoconf macros. -dnl AC_CHECK_HEADERS_ONCE like AC_CHECK_HEADERS -dnl AC_CHECK_FUNCS_ONCE like AC_CHECK_FUNCS -dnl AC_CHECK_DECLS_ONCE like AC_CHECK_DECLS -dnl AC_REQUIRE([AC_HEADER_STDC]) like AC_HEADER_STDC -dnl The advantage is that the check for each of the headers/functions/decls -dnl will be put only once into the 'configure' file. It keeps the size of -dnl the 'configure' file down, and avoids redundant output when 'configure' -dnl is run. -dnl The drawback is that the checks cannot be conditionalized. If you write -dnl if some_condition; then gl_CHECK_HEADERS(stdlib.h); fi -dnl inside an AC_DEFUNed function, the gl_CHECK_HEADERS macro call expands to -dnl empty, and the check will be inserted before the body of the AC_DEFUNed -dnl function. - -dnl This is like onceonly.m4, except that it uses diversions to named sections -dnl DEFAULTS and INIT_PREPARE in order to check all requested headers at once, -dnl thus reducing the size of 'configure'. Works with autoconf-2.57. The -dnl size reduction is ca. 9%. - -dnl Autoconf version 2.57 or newer is recommended. -AC_PREREQ(2.54) - -# AC_CHECK_HEADERS_ONCE(HEADER1 HEADER2 ...) is a once-only variant of -# AC_CHECK_HEADERS(HEADER1 HEADER2 ...). -AC_DEFUN([AC_CHECK_HEADERS_ONCE], [ - : - AC_FOREACH([gl_HEADER_NAME], [$1], [ - AC_DEFUN([gl_CHECK_HEADER_]m4_quote(translit(gl_HEADER_NAME, - [./-], [___])), [ - m4_divert_text([INIT_PREPARE], - [gl_header_list="$gl_header_list gl_HEADER_NAME"]) - gl_HEADERS_EXPANSION - AH_TEMPLATE(AS_TR_CPP([HAVE_]m4_defn([gl_HEADER_NAME])), - [Define to 1 if you have the <]m4_defn([gl_HEADER_NAME])[> header file.]) - ]) - AC_REQUIRE([gl_CHECK_HEADER_]m4_quote(translit(gl_HEADER_NAME, - [./-], [___]))) - ]) -]) -m4_define([gl_HEADERS_EXPANSION], [ - m4_divert_text([DEFAULTS], [gl_header_list=]) - AC_CHECK_HEADERS([$gl_header_list]) - m4_define([gl_HEADERS_EXPANSION], []) -]) - -# AC_CHECK_FUNCS_ONCE(FUNC1 FUNC2 ...) is a once-only variant of -# AC_CHECK_FUNCS(FUNC1 FUNC2 ...). -AC_DEFUN([AC_CHECK_FUNCS_ONCE], [ - : - AC_FOREACH([gl_FUNC_NAME], [$1], [ - AC_DEFUN([gl_CHECK_FUNC_]m4_defn([gl_FUNC_NAME]), [ - m4_divert_text([INIT_PREPARE], - [gl_func_list="$gl_func_list gl_FUNC_NAME"]) - gl_FUNCS_EXPANSION - AH_TEMPLATE(AS_TR_CPP([HAVE_]m4_defn([gl_FUNC_NAME])), - [Define to 1 if you have the `]m4_defn([gl_FUNC_NAME])[' function.]) - ]) - AC_REQUIRE([gl_CHECK_FUNC_]m4_defn([gl_FUNC_NAME])) - ]) -]) -m4_define([gl_FUNCS_EXPANSION], [ - m4_divert_text([DEFAULTS], [gl_func_list=]) - AC_CHECK_FUNCS([$gl_func_list]) - m4_define([gl_FUNCS_EXPANSION], []) -]) - -# AC_CHECK_DECLS_ONCE(DECL1 DECL2 ...) is a once-only variant of -# AC_CHECK_DECLS(DECL1, DECL2, ...). -AC_DEFUN([AC_CHECK_DECLS_ONCE], [ - : - AC_FOREACH([gl_DECL_NAME], [$1], [ - AC_DEFUN([gl_CHECK_DECL_]m4_defn([gl_DECL_NAME]), [ - AC_CHECK_DECLS(m4_defn([gl_DECL_NAME])) - ]) - AC_REQUIRE([gl_CHECK_DECL_]m4_defn([gl_DECL_NAME])) - ]) -]) diff --git a/src/bin/bison/m4/po.m4 b/src/bin/bison/m4/po.m4 deleted file mode 100644 index e161998818..0000000000 --- a/src/bin/bison/m4/po.m4 +++ /dev/null @@ -1,426 +0,0 @@ -# po.m4 serial 3 (gettext-0.14) -dnl Copyright (C) 1995-2003 Free Software Foundation, Inc. -dnl This file is free software, distributed under the terms of the GNU -dnl General Public License. As a special exception to the GNU General -dnl Public License, this file may be distributed as part of a program -dnl that contains a configuration script generated by Autoconf, under -dnl the same distribution terms as the rest of that program. -dnl -dnl This file can can be used in projects which are not available under -dnl the GNU General Public License or the GNU Library General Public -dnl License but which still want to provide support for the GNU gettext -dnl functionality. -dnl Please note that the actual code of the GNU gettext library is covered -dnl by the GNU Library General Public License, and the rest of the GNU -dnl gettext package package is covered by the GNU General Public License. -dnl They are *not* in the public domain. - -dnl Authors: -dnl Ulrich Drepper , 1995-2000. -dnl Bruno Haible , 2000-2003. - -dnl Checks for all prerequisites of the po subdirectory. -AC_DEFUN([AM_PO_SUBDIRS], -[ - AC_REQUIRE([AC_PROG_MAKE_SET])dnl - AC_REQUIRE([AC_PROG_INSTALL])dnl - AC_REQUIRE([AM_MKINSTALLDIRS])dnl - AC_REQUIRE([AM_NLS])dnl - - dnl Perform the following tests also if --disable-nls has been given, - dnl because they are needed for "make dist" to work. - - dnl Search for GNU msgfmt in the PATH. - dnl The first test excludes Solaris msgfmt and early GNU msgfmt versions. - dnl The second test excludes FreeBSD msgfmt. - AM_PATH_PROG_WITH_TEST(MSGFMT, msgfmt, - [$ac_dir/$ac_word --statistics /dev/null >/dev/null 2>&1 && - (if $ac_dir/$ac_word --statistics /dev/null 2>&1 >/dev/null | grep usage >/dev/null; then exit 1; else exit 0; fi)], - :) - AC_PATH_PROG(GMSGFMT, gmsgfmt, $MSGFMT) - - dnl Search for GNU xgettext 0.12 or newer in the PATH. - dnl The first test excludes Solaris xgettext and early GNU xgettext versions. - dnl The second test excludes FreeBSD xgettext. - AM_PATH_PROG_WITH_TEST(XGETTEXT, xgettext, - [$ac_dir/$ac_word --omit-header --copyright-holder= --msgid-bugs-address= /dev/null >/dev/null 2>&1 && - (if $ac_dir/$ac_word --omit-header --copyright-holder= --msgid-bugs-address= /dev/null 2>&1 >/dev/null | grep usage >/dev/null; then exit 1; else exit 0; fi)], - :) - dnl Remove leftover from FreeBSD xgettext call. - rm -f messages.po - - dnl Search for GNU msgmerge 0.11 or newer in the PATH. - AM_PATH_PROG_WITH_TEST(MSGMERGE, msgmerge, - [$ac_dir/$ac_word --update -q /dev/null /dev/null >/dev/null 2>&1], :) - - dnl This could go away some day; the PATH_PROG_WITH_TEST already does it. - dnl Test whether we really found GNU msgfmt. - if test "$GMSGFMT" != ":"; then - dnl If it is no GNU msgfmt we define it as : so that the - dnl Makefiles still can work. - if $GMSGFMT --statistics /dev/null >/dev/null 2>&1 && - (if $GMSGFMT --statistics /dev/null 2>&1 >/dev/null | grep usage >/dev/null; then exit 1; else exit 0; fi); then - : ; - else - GMSGFMT=`echo "$GMSGFMT" | sed -e 's,^.*/,,'` - AC_MSG_RESULT( - [found $GMSGFMT program is not GNU msgfmt; ignore it]) - GMSGFMT=":" - fi - fi - - dnl This could go away some day; the PATH_PROG_WITH_TEST already does it. - dnl Test whether we really found GNU xgettext. - if test "$XGETTEXT" != ":"; then - dnl If it is no GNU xgettext we define it as : so that the - dnl Makefiles still can work. - if $XGETTEXT --omit-header --copyright-holder= --msgid-bugs-address= /dev/null >/dev/null 2>&1 && - (if $XGETTEXT --omit-header --copyright-holder= --msgid-bugs-address= /dev/null 2>&1 >/dev/null | grep usage >/dev/null; then exit 1; else exit 0; fi); then - : ; - else - AC_MSG_RESULT( - [found xgettext program is not GNU xgettext; ignore it]) - XGETTEXT=":" - fi - dnl Remove leftover from FreeBSD xgettext call. - rm -f messages.po - fi - - AC_OUTPUT_COMMANDS([ - for ac_file in $CONFIG_FILES; do - # Support "outfile[:infile[:infile...]]" - case "$ac_file" in - *:*) ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;; - esac - # PO directories have a Makefile.in generated from Makefile.in.in. - case "$ac_file" in */Makefile.in) - # Adjust a relative srcdir. - ac_dir=`echo "$ac_file"|sed 's%/[^/][^/]*$%%'` - ac_dir_suffix="/`echo "$ac_dir"|sed 's%^\./%%'`" - ac_dots=`echo "$ac_dir_suffix"|sed 's%/[^/]*%../%g'` - # In autoconf-2.13 it is called $ac_given_srcdir. - # In autoconf-2.50 it is called $srcdir. - test -n "$ac_given_srcdir" || ac_given_srcdir="$srcdir" - case "$ac_given_srcdir" in - .) top_srcdir=`echo $ac_dots|sed 's%/$%%'` ;; - /*) top_srcdir="$ac_given_srcdir" ;; - *) top_srcdir="$ac_dots$ac_given_srcdir" ;; - esac - if test -f "$ac_given_srcdir/$ac_dir/POTFILES.in"; then - rm -f "$ac_dir/POTFILES" - test -n "$as_me" && echo "$as_me: creating $ac_dir/POTFILES" || echo "creating $ac_dir/POTFILES" - cat "$ac_given_srcdir/$ac_dir/POTFILES.in" | sed -e "/^#/d" -e "/^[ ]*\$/d" -e "s,.*, $top_srcdir/& \\\\," | sed -e "\$s/\(.*\) \\\\/\1/" > "$ac_dir/POTFILES" - POMAKEFILEDEPS="POTFILES.in" - # ALL_LINGUAS, POFILES, UPDATEPOFILES, DUMMYPOFILES, GMOFILES depend - # on $ac_dir but don't depend on user-specified configuration - # parameters. - if test -f "$ac_given_srcdir/$ac_dir/LINGUAS"; then - # The LINGUAS file contains the set of available languages. - if test -n "$OBSOLETE_ALL_LINGUAS"; then - test -n "$as_me" && echo "$as_me: setting ALL_LINGUAS in configure.in is obsolete" || echo "setting ALL_LINGUAS in configure.in is obsolete" - fi - ALL_LINGUAS_=`sed -e "/^#/d" "$ac_given_srcdir/$ac_dir/LINGUAS"` - # Hide the ALL_LINGUAS assigment from automake. - eval 'ALL_LINGUAS''=$ALL_LINGUAS_' - POMAKEFILEDEPS="$POMAKEFILEDEPS LINGUAS" - else - # The set of available languages was given in configure.in. - eval 'ALL_LINGUAS''=$OBSOLETE_ALL_LINGUAS' - fi - # Compute POFILES - # as $(foreach lang, $(ALL_LINGUAS), $(srcdir)/$(lang).po) - # Compute UPDATEPOFILES - # as $(foreach lang, $(ALL_LINGUAS), $(lang).po-update) - # Compute DUMMYPOFILES - # as $(foreach lang, $(ALL_LINGUAS), $(lang).nop) - # Compute GMOFILES - # as $(foreach lang, $(ALL_LINGUAS), $(srcdir)/$(lang).gmo) - case "$ac_given_srcdir" in - .) srcdirpre= ;; - *) srcdirpre='$(srcdir)/' ;; - esac - POFILES= - UPDATEPOFILES= - DUMMYPOFILES= - GMOFILES= - for lang in $ALL_LINGUAS; do - POFILES="$POFILES $srcdirpre$lang.po" - UPDATEPOFILES="$UPDATEPOFILES $lang.po-update" - DUMMYPOFILES="$DUMMYPOFILES $lang.nop" - GMOFILES="$GMOFILES $srcdirpre$lang.gmo" - done - # CATALOGS depends on both $ac_dir and the user's LINGUAS - # environment variable. - INST_LINGUAS= - if test -n "$ALL_LINGUAS"; then - for presentlang in $ALL_LINGUAS; do - useit=no - if test "%UNSET%" != "$LINGUAS"; then - desiredlanguages="$LINGUAS" - else - desiredlanguages="$ALL_LINGUAS" - fi - for desiredlang in $desiredlanguages; do - # Use the presentlang catalog if desiredlang is - # a. equal to presentlang, or - # b. a variant of presentlang (because in this case, - # presentlang can be used as a fallback for messages - # which are not translated in the desiredlang catalog). - case "$desiredlang" in - "$presentlang"*) useit=yes;; - esac - done - if test $useit = yes; then - INST_LINGUAS="$INST_LINGUAS $presentlang" - fi - done - fi - CATALOGS= - if test -n "$INST_LINGUAS"; then - for lang in $INST_LINGUAS; do - CATALOGS="$CATALOGS $lang.gmo" - done - fi - test -n "$as_me" && echo "$as_me: creating $ac_dir/Makefile" || echo "creating $ac_dir/Makefile" - sed -e "/^POTFILES =/r $ac_dir/POTFILES" -e "/^# Makevars/r $ac_given_srcdir/$ac_dir/Makevars" -e "s|@POFILES@|$POFILES|g" -e "s|@UPDATEPOFILES@|$UPDATEPOFILES|g" -e "s|@DUMMYPOFILES@|$DUMMYPOFILES|g" -e "s|@GMOFILES@|$GMOFILES|g" -e "s|@CATALOGS@|$CATALOGS|g" -e "s|@POMAKEFILEDEPS@|$POMAKEFILEDEPS|g" "$ac_dir/Makefile.in" > "$ac_dir/Makefile" - for f in "$ac_given_srcdir/$ac_dir"/Rules-*; do - if test -f "$f"; then - case "$f" in - *.orig | *.bak | *~) ;; - *) cat "$f" >> "$ac_dir/Makefile" ;; - esac - fi - done - fi - ;; - esac - done], - [# Capture the value of obsolete ALL_LINGUAS because we need it to compute - # POFILES, UPDATEPOFILES, DUMMYPOFILES, GMOFILES, CATALOGS. But hide it - # from automake. - eval 'OBSOLETE_ALL_LINGUAS''="$ALL_LINGUAS"' - # Capture the value of LINGUAS because we need it to compute CATALOGS. - LINGUAS="${LINGUAS-%UNSET%}" - ]) -]) - -dnl Postprocesses a Makefile in a directory containing PO files. -AC_DEFUN([AM_POSTPROCESS_PO_MAKEFILE], -[ - # When this code is run, in config.status, two variables have already been - # set: - # - OBSOLETE_ALL_LINGUAS is the value of LINGUAS set in configure.in, - # - LINGUAS is the value of the environment variable LINGUAS at configure - # time. - -changequote(,)dnl - # Adjust a relative srcdir. - ac_dir=`echo "$ac_file"|sed 's%/[^/][^/]*$%%'` - ac_dir_suffix="/`echo "$ac_dir"|sed 's%^\./%%'`" - ac_dots=`echo "$ac_dir_suffix"|sed 's%/[^/]*%../%g'` - # In autoconf-2.13 it is called $ac_given_srcdir. - # In autoconf-2.50 it is called $srcdir. - test -n "$ac_given_srcdir" || ac_given_srcdir="$srcdir" - case "$ac_given_srcdir" in - .) top_srcdir=`echo $ac_dots|sed 's%/$%%'` ;; - /*) top_srcdir="$ac_given_srcdir" ;; - *) top_srcdir="$ac_dots$ac_given_srcdir" ;; - esac - - # Find a way to echo strings without interpreting backslash. - if test "X`(echo '\t') 2>/dev/null`" = 'X\t'; then - gt_echo='echo' - else - if test "X`(printf '%s\n' '\t') 2>/dev/null`" = 'X\t'; then - gt_echo='printf %s\n' - else - echo_func () { - cat < "$ac_file.tmp" - if grep -l '@TCLCATALOGS@' "$ac_file" > /dev/null; then - # Add dependencies that cannot be formulated as a simple suffix rule. - for lang in $ALL_LINGUAS; do - frobbedlang=`echo $lang | sed -e 's/\..*$//' -e 'y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/'` - cat >> "$ac_file.tmp" < /dev/null; then - # Add dependencies that cannot be formulated as a simple suffix rule. - for lang in $ALL_LINGUAS; do - frobbedlang=`echo $lang | sed -e 's/_/-/g'` - cat >> "$ac_file.tmp" <> "$ac_file.tmp" <, 1996. - -# Search path for a program which passes the given test. - -dnl AM_PATH_PROG_WITH_TEST(VARIABLE, PROG-TO-CHECK-FOR, -dnl TEST-PERFORMED-ON-FOUND_PROGRAM [, VALUE-IF-NOT-FOUND [, PATH]]) -AC_DEFUN([AM_PATH_PROG_WITH_TEST], -[ -# Prepare PATH_SEPARATOR. -# The user is always right. -if test "${PATH_SEPARATOR+set}" != set; then - echo "#! /bin/sh" >conf$$.sh - echo "exit 0" >>conf$$.sh - chmod +x conf$$.sh - if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then - PATH_SEPARATOR=';' - else - PATH_SEPARATOR=: - fi - rm -f conf$$.sh -fi - -# Find out how to test for executable files. Don't use a zero-byte file, -# as systems may use methods other than mode bits to determine executability. -cat >conf$$.file <<_ASEOF -#! /bin/sh -exit 0 -_ASEOF -chmod +x conf$$.file -if test -x conf$$.file >/dev/null 2>&1; then - ac_executable_p="test -x" -else - ac_executable_p="test -f" -fi -rm -f conf$$.file - -# Extract the first word of "$2", so it can be a program name with args. -set dummy $2; ac_word=[$]2 -AC_MSG_CHECKING([for $ac_word]) -AC_CACHE_VAL(ac_cv_path_$1, -[case "[$]$1" in - [[\\/]]* | ?:[[\\/]]*) - ac_cv_path_$1="[$]$1" # Let the user override the test with a path. - ;; - *) - ac_save_IFS="$IFS"; IFS=$PATH_SEPARATOR - for ac_dir in ifelse([$5], , $PATH, [$5]); do - IFS="$ac_save_IFS" - test -z "$ac_dir" && ac_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if $ac_executable_p "$ac_dir/$ac_word$ac_exec_ext"; then - if [$3]; then - ac_cv_path_$1="$ac_dir/$ac_word$ac_exec_ext" - break 2 - fi - fi - done - done - IFS="$ac_save_IFS" -dnl If no 4th arg is given, leave the cache variable unset, -dnl so AC_PATH_PROGS will keep looking. -ifelse([$4], , , [ test -z "[$]ac_cv_path_$1" && ac_cv_path_$1="$4" -])dnl - ;; -esac])dnl -$1="$ac_cv_path_$1" -if test ifelse([$4], , [-n "[$]$1"], ["[$]$1" != "$4"]); then - AC_MSG_RESULT([$]$1) -else - AC_MSG_RESULT(no) -fi -AC_SUBST($1)dnl -]) diff --git a/src/bin/bison/m4/quote.m4 b/src/bin/bison/m4/quote.m4 deleted file mode 100644 index 14ce1b6198..0000000000 --- a/src/bin/bison/m4/quote.m4 +++ /dev/null @@ -1,13 +0,0 @@ -# quote.m4 serial 2 -dnl Copyright (C) 2002, 2003 Free Software Foundation, Inc. -dnl This file is free software, distributed under the terms of the GNU -dnl General Public License. As a special exception to the GNU General -dnl Public License, this file may be distributed as part of a program -dnl that contains a configuration script generated by Autoconf, under -dnl the same distribution terms as the rest of that program. - -AC_DEFUN([gl_QUOTE], -[ - dnl Prerequisites of lib/quote.c. - dnl (none) -]) diff --git a/src/bin/bison/m4/quotearg.m4 b/src/bin/bison/m4/quotearg.m4 deleted file mode 100644 index aa4a3d1473..0000000000 --- a/src/bin/bison/m4/quotearg.m4 +++ /dev/null @@ -1,16 +0,0 @@ -# quotearg.m4 serial 2 -dnl Copyright (C) 2002 Free Software Foundation, Inc. -dnl This file is free software, distributed under the terms of the GNU -dnl General Public License. As a special exception to the GNU General -dnl Public License, this file may be distributed as part of a program -dnl that contains a configuration script generated by Autoconf, under -dnl the same distribution terms as the rest of that program. - -AC_DEFUN([gl_QUOTEARG], -[ - dnl Prerequisites of lib/quotearg.c. - AC_CHECK_HEADERS_ONCE(wchar.h wctype.h) - AC_CHECK_FUNCS_ONCE(iswprint mbsinit) - AC_TYPE_MBSTATE_T - gl_FUNC_MBRTOWC -]) diff --git a/src/bin/bison/m4/stdbool.m4 b/src/bin/bison/m4/stdbool.m4 deleted file mode 100644 index ed000c8163..0000000000 --- a/src/bin/bison/m4/stdbool.m4 +++ /dev/null @@ -1,89 +0,0 @@ -# Check for stdbool.h that conforms to C99. - -# Copyright (C) 2002-2003 Free Software Foundation, Inc. - -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2, 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, write to the Free Software -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA -# 02111-1307, USA. - -# Prepare for substituting if it is not supported. - -AC_DEFUN([AM_STDBOOL_H], -[ - AC_REQUIRE([AC_HEADER_STDBOOL]) - - # Define two additional variables used in the Makefile substitution. - - if test "$ac_cv_header_stdbool_h" = yes; then - STDBOOL_H='' - else - STDBOOL_H='stdbool.h' - fi - AC_SUBST([STDBOOL_H]) - - if test "$ac_cv_type__Bool" = yes; then - HAVE__BOOL=1 - else - HAVE__BOOL=0 - fi - AC_SUBST([HAVE__BOOL]) -]) - -# This macro is only needed in autoconf <= 2.54. Newer versions of autoconf -# have this macro built-in. - -AC_DEFUN([AC_HEADER_STDBOOL], - [AC_CACHE_CHECK([for stdbool.h that conforms to C99], - [ac_cv_header_stdbool_h], - [AC_TRY_COMPILE( - [ - #include - #ifndef bool - "error: bool is not defined" - #endif - #ifndef false - "error: false is not defined" - #endif - #if false - "error: false is not 0" - #endif - #ifndef true - "error: false is not defined" - #endif - #if true != 1 - "error: true is not 1" - #endif - #ifndef __bool_true_false_are_defined - "error: __bool_true_false_are_defined is not defined" - #endif - - struct s { _Bool s: 1; _Bool t; } s; - - char a[true == 1 ? 1 : -1]; - char b[false == 0 ? 1 : -1]; - char c[__bool_true_false_are_defined == 1 ? 1 : -1]; - char d[(bool) -0.5 == true ? 1 : -1]; - bool e = &s; - char f[(_Bool) -0.0 == false ? 1 : -1]; - char g[true]; - char h[sizeof (_Bool)]; - char i[sizeof s.t]; - ], - [ return !a + !b + !c + !d + !e + !f + !g + !h + !i; ], - [ac_cv_header_stdbool_h=yes], - [ac_cv_header_stdbool_h=no])]) - AC_CHECK_TYPES([_Bool]) - if test $ac_cv_header_stdbool_h = yes; then - AC_DEFINE(HAVE_STDBOOL_H, 1, [Define to 1 if stdbool.h conforms to C99.]) - fi]) diff --git a/src/bin/bison/m4/stpcpy.m4 b/src/bin/bison/m4/stpcpy.m4 deleted file mode 100644 index b3282661b2..0000000000 --- a/src/bin/bison/m4/stpcpy.m4 +++ /dev/null @@ -1,24 +0,0 @@ -# stpcpy.m4 serial 1 -dnl Copyright (C) 2002 Free Software Foundation, Inc. -dnl This file is free software, distributed under the terms of the GNU -dnl General Public License. As a special exception to the GNU General -dnl Public License, this file may be distributed as part of a program -dnl that contains a configuration script generated by Autoconf, under -dnl the same distribution terms as the rest of that program. - -AC_DEFUN([gl_FUNC_STPCPY], -[ - dnl Persuade glibc to declare stpcpy(). - AC_REQUIRE([AC_GNU_SOURCE]) - - AC_REPLACE_FUNCS(stpcpy) - if test $ac_cv_func_stpcpy = no; then - gl_PREREQ_STPCPY - fi -]) - -# Prerequisites of lib/stpcpy.c. -AC_DEFUN([gl_PREREQ_STPCPY], [ - : -]) - diff --git a/src/bin/bison/m4/strndup.m4 b/src/bin/bison/m4/strndup.m4 deleted file mode 100644 index 80dfcc1d90..0000000000 --- a/src/bin/bison/m4/strndup.m4 +++ /dev/null @@ -1,24 +0,0 @@ -# strndup.m4 serial 2 -dnl Copyright (C) 2002, 2003 Free Software Foundation, Inc. -dnl This file is free software, distributed under the terms of the GNU -dnl General Public License. As a special exception to the GNU General -dnl Public License, this file may be distributed as part of a program -dnl that contains a configuration script generated by Autoconf, under -dnl the same distribution terms as the rest of that program. - -AC_DEFUN([gl_FUNC_STRNDUP], -[ - dnl Persuade glibc to declare strndup(). - AC_REQUIRE([AC_GNU_SOURCE]) - - AC_REPLACE_FUNCS(strndup) - if test $ac_cv_func_strndup = no; then - gl_PREREQ_STRNDUP - fi -]) - -# Prerequisites of lib/strndup.c. -AC_DEFUN([gl_PREREQ_STRNDUP], [ - AC_CHECK_DECLS(strnlen) -]) - diff --git a/src/bin/bison/m4/strnlen.m4 b/src/bin/bison/m4/strnlen.m4 deleted file mode 100644 index 989ff49f75..0000000000 --- a/src/bin/bison/m4/strnlen.m4 +++ /dev/null @@ -1,27 +0,0 @@ -# strnlen.m4 serial 3 -dnl Copyright (C) 2002-2003 Free Software Foundation, Inc. -dnl This file is free software, distributed under the terms of the GNU -dnl General Public License. As a special exception to the GNU General -dnl Public License, this file may be distributed as part of a program -dnl that contains a configuration script generated by Autoconf, under -dnl the same distribution terms as the rest of that program. - -AC_DEFUN([gl_FUNC_STRNLEN], -[ - dnl Persuade glibc to declare strnlen(). - AC_REQUIRE([AC_GNU_SOURCE]) - - AC_FUNC_STRNLEN - if test $ac_cv_func_strnlen_working = no; then - # This is necessary because automake-1.6.1 doens't understand - # that the above use of AC_FUNC_STRNLEN means we may have to use - # lib/strnlen.c. - #AC_LIBOBJ(strnlen) - AC_DEFINE(strnlen, rpl_strnlen, - [Define to rpl_strnlen if the replacement function should be used.]) - gl_PREREQ_STRNLEN - fi -]) - -# Prerequisites of lib/strnlen.c. -AC_DEFUN([gl_PREREQ_STRNLEN], [:]) diff --git a/src/bin/bison/m4/subpipe.m4 b/src/bin/bison/m4/subpipe.m4 deleted file mode 100644 index 5d6a8c4a07..0000000000 --- a/src/bin/bison/m4/subpipe.m4 +++ /dev/null @@ -1,30 +0,0 @@ -# -*- Autoconf -*- -# Checks required to run `subpipe'. -# -# Copyright (C) 2002, 2003 Free Software Foundation, Inc. -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 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, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA -# 02111-1307 USA - -# Written by Paul Eggert . - -AC_DEFUN([BISON_PREREQ_SUBPIPE], -[ - AC_TYPE_PID_T - AC_CHECK_HEADERS([fcntl.h]) - AC_HEADER_SYS_WAIT - AC_CHECK_FUNCS(dup2 waitpid) - AC_FUNC_FORK -]) diff --git a/src/bin/bison/m4/timevar.m4 b/src/bin/bison/m4/timevar.m4 deleted file mode 100644 index e755173f5e..0000000000 --- a/src/bin/bison/m4/timevar.m4 +++ /dev/null @@ -1,61 +0,0 @@ -# -*- Autoconf -*- -# Checks required to run `timevar', a time tracker. -# -# Copyright (C) 2002, 2003 Free Software Foundation, Inc. -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 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, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA -# 02111-1307 USA - -# serial 2 - -AC_DEFUN([BISON_PREREQ_TIMEVAR], -[AC_CHECK_HEADERS([sys/time.h sys/times.h]) - AC_CHECK_HEADERS([sys/resource.h],,, - [$ac_includes_default -#if HAVE_SYS_TIME_H -# include -#endif -#ifdef HAVE_SYS_TIMES_H -# include -#endif -]) -AC_CHECK_FUNCS([times]) - -AC_CHECK_DECLS([getrusage, times, clock, sysconf], [], [], -[$ac_includes_default -#if HAVE_SYS_TIME_H -# include -#endif -#if HAVE_SYS_TIMES_H -# include -#endif -#if HAVE_SYS_RESOURCE_H -# include -#endif -]) - -AC_CHECK_TYPES([clock_t, struct tms], [], [], -[$ac_includes_default -#if HAVE_SYS_TIME_H -# include -#endif -#if HAVE_SYS_TIMES_H -# include -#endif -#if HAVE_SYS_RESOURCE_H -# include -#endif -]) -]) diff --git a/src/bin/bison/m4/unlocked-io.m4 b/src/bin/bison/m4/unlocked-io.m4 deleted file mode 100644 index cd1c5f4ef7..0000000000 --- a/src/bin/bison/m4/unlocked-io.m4 +++ /dev/null @@ -1,22 +0,0 @@ -#serial 9 - -dnl From Jim Meyering. -dnl -dnl See if the glibc *_unlocked I/O macros or functions are available. -dnl Use only those *_unlocked macros or functions that are declared -dnl (because some of them were declared in Solaris 2.5.1 but were removed -dnl in Solaris 2.6, whereas we want binaries built on Solaris 2.5.1 to run -dnl on Solaris 2.6). - -AC_DEFUN([gl_FUNC_GLIBC_UNLOCKED_IO], -[ - dnl Persuade glibc and Solaris to declare - dnl fgets_unlocked(), fputs_unlocked() etc. - AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS]) - - AC_CHECK_DECLS_ONCE( - [clearerr_unlocked feof_unlocked ferror_unlocked - fflush_unlocked fgets_unlocked fputc_unlocked fputs_unlocked - fread_unlocked fwrite_unlocked getc_unlocked - getchar_unlocked putc_unlocked putchar_unlocked]) -]) diff --git a/src/bin/bison/m4/warning.m4 b/src/bin/bison/m4/warning.m4 deleted file mode 100644 index c57260f738..0000000000 --- a/src/bin/bison/m4/warning.m4 +++ /dev/null @@ -1,32 +0,0 @@ -# Finding valid warning flags for the C Compiler. -*-Autoconf-*- -# -# Copyright (C) 2001, 2002 Free Software Foundation, Inc. -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 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, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA -# 02111-1307 USA - -# serial 1 - -AC_DEFUN([BISON_WARNING], -[AC_MSG_CHECKING(whether compiler accepts $1) -AC_SUBST(WARNING_CFLAGS) -ac_save_CFLAGS="$CFLAGS" -CFLAGS="$CFLAGS $1" -AC_TRY_COMPILE(, -[int x;], -WARNING_CFLAGS="$WARNING_CFLAGS $1" -AC_MSG_RESULT(yes), -AC_MSG_RESULT(no)) -CFLAGS="$ac_save_CFLAGS"]) diff --git a/src/bin/bison/m4/xalloc.m4 b/src/bin/bison/m4/xalloc.m4 deleted file mode 100644 index f3d3790074..0000000000 --- a/src/bin/bison/m4/xalloc.m4 +++ /dev/null @@ -1,32 +0,0 @@ -# xalloc.m4 serial 8 -dnl Copyright (C) 2002-2004 Free Software Foundation, Inc. -dnl This file is free software, distributed under the terms of the GNU -dnl General Public License. As a special exception to the GNU General -dnl Public License, this file may be distributed as part of a program -dnl that contains a configuration script generated by Autoconf, under -dnl the same distribution terms as the rest of that program. - -AC_DEFUN([gl_XALLOC], -[ - gl_PREREQ_XALLOC - gl_PREREQ_XMALLOC - gl_PREREQ_XSTRDUP -]) - -# Prerequisites of lib/xalloc.h. -AC_DEFUN([gl_PREREQ_XALLOC], [ - : -]) - -# Prerequisites of lib/xmalloc.c. -AC_DEFUN([gl_PREREQ_XMALLOC], [ - AC_REQUIRE([AC_C_INLINE]) - AC_REQUIRE([AC_FUNC_MALLOC]) - AC_REQUIRE([AC_FUNC_REALLOC]) - : -]) - -# Prerequisites of lib/xstrdup.c. -AC_DEFUN([gl_PREREQ_XSTRDUP], [ - : -]) diff --git a/src/bin/bison/m4/xstrndup.m4 b/src/bin/bison/m4/xstrndup.m4 deleted file mode 100644 index 87c0ab8cb1..0000000000 --- a/src/bin/bison/m4/xstrndup.m4 +++ /dev/null @@ -1,17 +0,0 @@ -# xstrndup.m4 serial 1 -dnl Copyright (C) 2003 Free Software Foundation, Inc. -dnl This file is free software, distributed under the terms of the GNU -dnl General Public License. As a special exception to the GNU General -dnl Public License, this file may be distributed as part of a program -dnl that contains a configuration script generated by Autoconf, under -dnl the same distribution terms as the rest of that program. - -AC_DEFUN([gl_XSTRNDUP], -[ - gl_PREREQ_XSTRNDUP -]) - -# Prerequisites of lib/xstrndup.c. -AC_DEFUN([gl_PREREQ_XSTRNDUP], [ - : -]) diff --git a/src/bin/bison/po/LINGUAS b/src/bin/bison/po/LINGUAS deleted file mode 100644 index 5e5aec3c49..0000000000 --- a/src/bin/bison/po/LINGUAS +++ /dev/null @@ -1,16 +0,0 @@ -da -de -es -et -fr -hr -id -it -ja -ms -nl -pt_BR -ro -ru -sv -tr diff --git a/src/bin/bison/po/Makefile.in.in b/src/bin/bison/po/Makefile.in.in deleted file mode 100644 index fe173892cf..0000000000 --- a/src/bin/bison/po/Makefile.in.in +++ /dev/null @@ -1,367 +0,0 @@ -top_builddir=@top_builddir@ -# Makefile for PO directory in any package using GNU gettext. -# Copyright (C) 1995-1997, 2000-2004 by Ulrich Drepper -# -# This file can be copied and used freely without restrictions. It can -# be used in projects which are not available under the GNU General Public -# License but which still want to provide support for the GNU gettext -# functionality. -# Please note that the actual code of GNU gettext is covered by the GNU -# General Public License and is *not* in the public domain. -# -# Origin: gettext-0.14 - -PACKAGE = @PACKAGE@ -VERSION = @VERSION@ - -SHELL = /bin/sh -@SET_MAKE@ - -srcdir = @srcdir@ -top_srcdir = @top_srcdir@ -VPATH = @srcdir@ - -prefix = @prefix@ -exec_prefix = @exec_prefix@ -datadir = @datadir@ -localedir = $(datadir)/locale -gettextsrcdir = $(datadir)/gettext/po - -INSTALL = @INSTALL@ -INSTALL_DATA = @INSTALL_DATA@ -MKINSTALLDIRS = @MKINSTALLDIRS@ -mkinstalldirs = $(SHELL) $(MKINSTALLDIRS) - -GMSGFMT = @GMSGFMT@ -MSGFMT = @MSGFMT@ -XGETTEXT = @XGETTEXT@ -MSGMERGE = msgmerge -MSGMERGE_UPDATE = @MSGMERGE@ --update -MSGINIT = msginit -MSGCONV = msgconv -MSGFILTER = msgfilter - -POFILES = @POFILES@ -GMOFILES = @GMOFILES@ -UPDATEPOFILES = @UPDATEPOFILES@ -DUMMYPOFILES = @DUMMYPOFILES@ -DISTFILES.common = Makefile.in.in remove-potcdate.sin \ -$(DISTFILES.common.extra1) $(DISTFILES.common.extra2) $(DISTFILES.common.extra3) -DISTFILES = $(DISTFILES.common) Makevars POTFILES.in $(DOMAIN).pot stamp-po \ -$(POFILES) $(GMOFILES) \ -$(DISTFILES.extra1) $(DISTFILES.extra2) $(DISTFILES.extra3) - -POTFILES = \ - -CATALOGS = @CATALOGS@ - -# Makevars gets inserted here. (Don't remove this line!) - -.SUFFIXES: -.SUFFIXES: .po .gmo .mo .sed .sin .nop .po-create .po-update - -.po.mo: - @echo "$(MSGFMT) -c -o $@ $<"; \ - $(MSGFMT) -c -o t-$@ $< && mv t-$@ $@ - -.po.gmo: - @lang=`echo $* | sed -e 's,.*/,,'`; \ - test "$(srcdir)" = . && cdcmd="" || cdcmd="cd $(srcdir) && "; \ - echo "$${cdcmd}rm -f $${lang}.gmo && $(GMSGFMT) -c --statistics -o $${lang}.gmo $${lang}.po"; \ - cd $(srcdir) && rm -f $${lang}.gmo && $(GMSGFMT) -c --statistics -o t-$${lang}.gmo $${lang}.po && mv t-$${lang}.gmo $${lang}.gmo - -.sin.sed: - sed -e '/^#/d' $< > t-$@ - mv t-$@ $@ - - -all: all-@USE_NLS@ - -all-yes: stamp-po -all-no: - -# stamp-po is a timestamp denoting the last time at which the CATALOGS have -# been loosely updated. Its purpose is that when a developer or translator -# checks out the package via CVS, and the $(DOMAIN).pot file is not in CVS, -# "make" will update the $(DOMAIN).pot and the $(CATALOGS), but subsequent -# invocations of "make" will do nothing. This timestamp would not be necessary -# if updating the $(CATALOGS) would always touch them; however, the rule for -# $(POFILES) has been designed to not touch files that don't need to be -# changed. -stamp-po: $(srcdir)/$(DOMAIN).pot - test -z "$(GMOFILES)" || $(MAKE) $(GMOFILES) - @echo "touch stamp-po" - @echo timestamp > stamp-poT - @mv stamp-poT stamp-po - -# Note: Target 'all' must not depend on target '$(DOMAIN).pot-update', -# otherwise packages like GCC can not be built if only parts of the source -# have been downloaded. - -# This target rebuilds $(DOMAIN).pot; it is an expensive operation. -# Note that $(DOMAIN).pot is not touched if it doesn't need to be changed. -$(DOMAIN).pot-update: $(POTFILES) $(srcdir)/POTFILES.in remove-potcdate.sed - $(XGETTEXT) --default-domain=$(DOMAIN) --directory=$(top_srcdir) \ - --add-comments=TRANSLATORS: $(XGETTEXT_OPTIONS) \ - --files-from=$(srcdir)/POTFILES.in \ - --copyright-holder='$(COPYRIGHT_HOLDER)' \ - --msgid-bugs-address='$(MSGID_BUGS_ADDRESS)' - test ! -f $(DOMAIN).po || { \ - if test -f $(srcdir)/$(DOMAIN).pot; then \ - sed -f remove-potcdate.sed < $(srcdir)/$(DOMAIN).pot > $(DOMAIN).1po && \ - sed -f remove-potcdate.sed < $(DOMAIN).po > $(DOMAIN).2po && \ - if cmp $(DOMAIN).1po $(DOMAIN).2po >/dev/null 2>&1; then \ - rm -f $(DOMAIN).1po $(DOMAIN).2po $(DOMAIN).po; \ - else \ - rm -f $(DOMAIN).1po $(DOMAIN).2po $(srcdir)/$(DOMAIN).pot && \ - mv $(DOMAIN).po $(srcdir)/$(DOMAIN).pot; \ - fi; \ - else \ - mv $(DOMAIN).po $(srcdir)/$(DOMAIN).pot; \ - fi; \ - } - -# This rule has no dependencies: we don't need to update $(DOMAIN).pot at -# every "make" invocation, only create it when it is missing. -# Only "make $(DOMAIN).pot-update" or "make dist" will force an update. -$(srcdir)/$(DOMAIN).pot: - $(MAKE) $(DOMAIN).pot-update - -# This target rebuilds a PO file if $(DOMAIN).pot has changed. -# Note that a PO file is not touched if it doesn't need to be changed. -$(POFILES): $(srcdir)/$(DOMAIN).pot - @lang=`echo $@ | sed -e 's,.*/,,' -e 's/\.po$$//'`; \ - if test -f "$(srcdir)/$${lang}.po"; then \ - test "$(srcdir)" = . && cdcmd="" || cdcmd="cd $(srcdir) && "; \ - echo "$${cdcmd}$(MSGMERGE_UPDATE) $${lang}.po $(DOMAIN).pot"; \ - cd $(srcdir) && $(MSGMERGE_UPDATE) $${lang}.po $(DOMAIN).pot; \ - else \ - $(MAKE) $${lang}.po-create; \ - fi - - -install: install-exec install-data -install-exec: -install-data: install-data-@USE_NLS@ - if test "$(PACKAGE)" = "gettext-tools"; then \ - $(mkinstalldirs) $(DESTDIR)$(gettextsrcdir); \ - for file in $(DISTFILES.common) Makevars.template; do \ - $(INSTALL_DATA) $(srcdir)/$$file \ - $(DESTDIR)$(gettextsrcdir)/$$file; \ - done; \ - for file in Makevars; do \ - rm -f $(DESTDIR)$(gettextsrcdir)/$$file; \ - done; \ - else \ - : ; \ - fi -install-data-no: all -install-data-yes: all - $(mkinstalldirs) $(DESTDIR)$(datadir) - @catalogs='$(CATALOGS)'; \ - for cat in $$catalogs; do \ - cat=`basename $$cat`; \ - lang=`echo $$cat | sed -e 's/\.gmo$$//'`; \ - dir=$(localedir)/$$lang/LC_MESSAGES; \ - $(mkinstalldirs) $(DESTDIR)$$dir; \ - if test -r $$cat; then realcat=$$cat; else realcat=$(srcdir)/$$cat; fi; \ - $(INSTALL_DATA) $$realcat $(DESTDIR)$$dir/$(DOMAIN).mo; \ - echo "installing $$realcat as $(DESTDIR)$$dir/$(DOMAIN).mo"; \ - for lc in '' $(EXTRA_LOCALE_CATEGORIES); do \ - if test -n "$$lc"; then \ - if (cd $(DESTDIR)$(localedir)/$$lang && LC_ALL=C ls -l -d $$lc 2>/dev/null) | grep ' -> ' >/dev/null; then \ - link=`cd $(DESTDIR)$(localedir)/$$lang && LC_ALL=C ls -l -d $$lc | sed -e 's/^.* -> //'`; \ - mv $(DESTDIR)$(localedir)/$$lang/$$lc $(DESTDIR)$(localedir)/$$lang/$$lc.old; \ - mkdir $(DESTDIR)$(localedir)/$$lang/$$lc; \ - (cd $(DESTDIR)$(localedir)/$$lang/$$lc.old && \ - for file in *; do \ - if test -f $$file; then \ - ln -s ../$$link/$$file $(DESTDIR)$(localedir)/$$lang/$$lc/$$file; \ - fi; \ - done); \ - rm -f $(DESTDIR)$(localedir)/$$lang/$$lc.old; \ - else \ - if test -d $(DESTDIR)$(localedir)/$$lang/$$lc; then \ - :; \ - else \ - rm -f $(DESTDIR)$(localedir)/$$lang/$$lc; \ - mkdir $(DESTDIR)$(localedir)/$$lang/$$lc; \ - fi; \ - fi; \ - rm -f $(DESTDIR)$(localedir)/$$lang/$$lc/$(DOMAIN).mo; \ - ln -s ../LC_MESSAGES/$(DOMAIN).mo $(DESTDIR)$(localedir)/$$lang/$$lc/$(DOMAIN).mo 2>/dev/null || \ - ln $(DESTDIR)$(localedir)/$$lang/LC_MESSAGES/$(DOMAIN).mo $(DESTDIR)$(localedir)/$$lang/$$lc/$(DOMAIN).mo 2>/dev/null || \ - cp -p $(DESTDIR)$(localedir)/$$lang/LC_MESSAGES/$(DOMAIN).mo $(DESTDIR)$(localedir)/$$lang/$$lc/$(DOMAIN).mo; \ - echo "installing $$realcat link as $(DESTDIR)$(localedir)/$$lang/$$lc/$(DOMAIN).mo"; \ - fi; \ - done; \ - done - -install-strip: install - -installdirs: installdirs-exec installdirs-data -installdirs-exec: -installdirs-data: installdirs-data-@USE_NLS@ - if test "$(PACKAGE)" = "gettext-tools"; then \ - $(mkinstalldirs) $(DESTDIR)$(gettextsrcdir); \ - else \ - : ; \ - fi -installdirs-data-no: -installdirs-data-yes: - $(mkinstalldirs) $(DESTDIR)$(datadir) - @catalogs='$(CATALOGS)'; \ - for cat in $$catalogs; do \ - cat=`basename $$cat`; \ - lang=`echo $$cat | sed -e 's/\.gmo$$//'`; \ - dir=$(localedir)/$$lang/LC_MESSAGES; \ - $(mkinstalldirs) $(DESTDIR)$$dir; \ - for lc in '' $(EXTRA_LOCALE_CATEGORIES); do \ - if test -n "$$lc"; then \ - if (cd $(DESTDIR)$(localedir)/$$lang && LC_ALL=C ls -l -d $$lc 2>/dev/null) | grep ' -> ' >/dev/null; then \ - link=`cd $(DESTDIR)$(localedir)/$$lang && LC_ALL=C ls -l -d $$lc | sed -e 's/^.* -> //'`; \ - mv $(DESTDIR)$(localedir)/$$lang/$$lc $(DESTDIR)$(localedir)/$$lang/$$lc.old; \ - mkdir $(DESTDIR)$(localedir)/$$lang/$$lc; \ - (cd $(DESTDIR)$(localedir)/$$lang/$$lc.old && \ - for file in *; do \ - if test -f $$file; then \ - ln -s ../$$link/$$file $(DESTDIR)$(localedir)/$$lang/$$lc/$$file; \ - fi; \ - done); \ - rm -f $(DESTDIR)$(localedir)/$$lang/$$lc.old; \ - else \ - if test -d $(DESTDIR)$(localedir)/$$lang/$$lc; then \ - :; \ - else \ - rm -f $(DESTDIR)$(localedir)/$$lang/$$lc; \ - mkdir $(DESTDIR)$(localedir)/$$lang/$$lc; \ - fi; \ - fi; \ - fi; \ - done; \ - done - -# Define this as empty until I found a useful application. -installcheck: - -uninstall: uninstall-exec uninstall-data -uninstall-exec: -uninstall-data: uninstall-data-@USE_NLS@ - if test "$(PACKAGE)" = "gettext-tools"; then \ - for file in $(DISTFILES.common) Makevars.template; do \ - rm -f $(DESTDIR)$(gettextsrcdir)/$$file; \ - done; \ - else \ - : ; \ - fi -uninstall-data-no: -uninstall-data-yes: - catalogs='$(CATALOGS)'; \ - for cat in $$catalogs; do \ - cat=`basename $$cat`; \ - lang=`echo $$cat | sed -e 's/\.gmo$$//'`; \ - for lc in LC_MESSAGES $(EXTRA_LOCALE_CATEGORIES); do \ - rm -f $(DESTDIR)$(localedir)/$$lang/$$lc/$(DOMAIN).mo; \ - done; \ - done - -check: all - -info dvi ps pdf html tags TAGS ctags CTAGS ID: - -mostlyclean: - rm -f remove-potcdate.sed - rm -f stamp-poT - rm -f core core.* $(DOMAIN).po $(DOMAIN).1po $(DOMAIN).2po *.new.po - rm -fr *.o - -clean: mostlyclean - -distclean: clean - rm -f Makefile Makefile.in POTFILES *.mo - -maintainer-clean: distclean - @echo "This command is intended for maintainers to use;" - @echo "it deletes files that may require special tools to rebuild." - rm -f stamp-po $(GMOFILES) - -distdir = $(top_builddir)/$(PACKAGE)-$(VERSION)/$(subdir) -dist distdir: - $(MAKE) update-po - @$(MAKE) dist2 -# This is a separate target because 'update-po' must be executed before. -dist2: $(DISTFILES) - dists="$(DISTFILES)"; \ - if test "$(PACKAGE)" = "gettext-tools"; then \ - dists="$$dists Makevars.template"; \ - fi; \ - if test -f $(srcdir)/ChangeLog; then \ - dists="$$dists ChangeLog"; \ - fi; \ - for i in 0 1 2 3 4 5 6 7 8 9; do \ - if test -f $(srcdir)/ChangeLog.$$i; then \ - dists="$$dists ChangeLog.$$i"; \ - fi; \ - done; \ - if test -f $(srcdir)/LINGUAS; then dists="$$dists LINGUAS"; fi; \ - for file in $$dists; do \ - if test -f $$file; then \ - cp -p $$file $(distdir); \ - else \ - cp -p $(srcdir)/$$file $(distdir); \ - fi; \ - done - -update-po: Makefile - $(MAKE) $(DOMAIN).pot-update - test -z "$(UPDATEPOFILES)" || $(MAKE) $(UPDATEPOFILES) - $(MAKE) update-gmo - -# General rule for creating PO files. - -.nop.po-create: - @lang=`echo $@ | sed -e 's/\.po-create$$//'`; \ - echo "File $$lang.po does not exist. If you are a translator, you can create it through 'msginit'." 1>&2; \ - exit 1 - -# General rule for updating PO files. - -.nop.po-update: - @lang=`echo $@ | sed -e 's/\.po-update$$//'`; \ - if test "$(PACKAGE)" = "gettext-tools"; then PATH=`pwd`/../src:$$PATH; fi; \ - tmpdir=`pwd`; \ - echo "$$lang:"; \ - test "$(srcdir)" = . && cdcmd="" || cdcmd="cd $(srcdir) && "; \ - echo "$${cdcmd}$(MSGMERGE) $$lang.po $(DOMAIN).pot -o $$lang.new.po"; \ - cd $(srcdir); \ - if $(MSGMERGE) $$lang.po $(DOMAIN).pot -o $$tmpdir/$$lang.new.po; then \ - if cmp $$lang.po $$tmpdir/$$lang.new.po >/dev/null 2>&1; then \ - rm -f $$tmpdir/$$lang.new.po; \ - else \ - if mv -f $$tmpdir/$$lang.new.po $$lang.po; then \ - :; \ - else \ - echo "msgmerge for $$lang.po failed: cannot move $$tmpdir/$$lang.new.po to $$lang.po" 1>&2; \ - exit 1; \ - fi; \ - fi; \ - else \ - echo "msgmerge for $$lang.po failed!" 1>&2; \ - rm -f $$tmpdir/$$lang.new.po; \ - fi - -$(DUMMYPOFILES): - -update-gmo: Makefile $(GMOFILES) - @: - -Makefile: Makefile.in.in $(top_builddir)/config.status @POMAKEFILEDEPS@ - cd $(top_builddir) \ - && CONFIG_FILES=$(subdir)/$@.in CONFIG_HEADERS= \ - $(SHELL) ./config.status - -force: - -# Tell versions [3.59,3.63) of GNU make not to export all variables. -# Otherwise a system limit (for SysV at least) may be exceeded. -.NOEXPORT: diff --git a/src/bin/bison/po/Makevars b/src/bin/bison/po/Makevars deleted file mode 100644 index 4fad030846..0000000000 --- a/src/bin/bison/po/Makevars +++ /dev/null @@ -1,41 +0,0 @@ -# Makefile variables for PO directory in any package using GNU gettext. - -# Usually the message domain is the same as the package name. -DOMAIN = $(PACKAGE) - -# These two variables depend on the location of this directory. -subdir = po -top_builddir = .. - -# These options get passed to xgettext. -XGETTEXT_OPTIONS = --keyword=_ --keyword=N_ - -# This is the copyright holder that gets inserted into the header of the -# $(DOMAIN).pot file. Set this to the copyright holder of the surrounding -# package. (Note that the msgstr strings, extracted from the package's -# sources, belong to the copyright holder of the package.) Translators are -# expected to transfer the copyright for their translations to this person -# or entity, or to disclaim their copyright. The empty string stands for -# the public domain; in this case the translators are expected to disclaim -# their copyright. -COPYRIGHT_HOLDER = Free Software Foundation, Inc. - -# This is the email address or URL to which the translators shall report -# bugs in the untranslated strings: -# - Strings which are not entire sentences, see the maintainer guidelines -# in the GNU gettext documentation, section 'Preparing Strings'. -# - Strings which use unclear terms or require additional context to be -# understood. -# - Strings which make invalid assumptions about notation of date, time or -# money. -# - Pluralisation problems. -# - Incorrect English spelling. -# - Incorrect formatting. -# It can be your email address, or a mailing list address where translators -# can write to without being subscribed, or the URL of a web page through -# which the translators can contact you. -MSGID_BUGS_ADDRESS = bug-bison@gnu.org - -# This is the list of locale categories, beyond LC_MESSAGES, for which the -# message catalogs shall be used. It is usually empty. -EXTRA_LOCALE_CATEGORIES = diff --git a/src/bin/bison/po/POTFILES.in b/src/bin/bison/po/POTFILES.in deleted file mode 100644 index ea193b14e4..0000000000 --- a/src/bin/bison/po/POTFILES.in +++ /dev/null @@ -1,23 +0,0 @@ -src/complain.c -src/conflicts.c -src/files.c -src/getargs.c -src/gram.c -src/main.c -src/parse-gram.y -src/print.c -src/reader.c -src/reduce.c -src/scan-gram.l -src/symlist.c -src/symtab.c - -lib/argmatch.c -lib/bitset_stats.c -lib/error.c -lib/getopt.c -lib/obstack.c -lib/quotearg.c -lib/subpipe.c -lib/timevar.c -lib/xmalloc.c diff --git a/src/bin/bison/po/Rules-quot b/src/bin/bison/po/Rules-quot deleted file mode 100644 index 9c2a995e30..0000000000 --- a/src/bin/bison/po/Rules-quot +++ /dev/null @@ -1,47 +0,0 @@ -# Special Makefile rules for English message catalogs with quotation marks. - -DISTFILES.common.extra1 = quot.sed boldquot.sed en@quot.header en@boldquot.header insert-header.sin Rules-quot - -.SUFFIXES: .insert-header .po-update-en - -en@quot.po-create: - $(MAKE) en@quot.po-update -en@boldquot.po-create: - $(MAKE) en@boldquot.po-update - -en@quot.po-update: en@quot.po-update-en -en@boldquot.po-update: en@boldquot.po-update-en - -.insert-header.po-update-en: - @lang=`echo $@ | sed -e 's/\.po-update-en$$//'`; \ - if test "$(PACKAGE)" = "gettext"; then PATH=`pwd`/../src:$$PATH; GETTEXTLIBDIR=`cd $(top_srcdir)/src && pwd`; export GETTEXTLIBDIR; fi; \ - tmpdir=`pwd`; \ - echo "$$lang:"; \ - ll=`echo $$lang | sed -e 's/@.*//'`; \ - LC_ALL=C; export LC_ALL; \ - cd $(srcdir); \ - if $(MSGINIT) -i $(DOMAIN).pot --no-translator -l $$ll -o - 2>/dev/null | sed -f $$tmpdir/$$lang.insert-header | $(MSGCONV) -t UTF-8 | $(MSGFILTER) sed -f `echo $$lang | sed -e 's/.*@//'`.sed 2>/dev/null > $$tmpdir/$$lang.new.po; then \ - if cmp $$lang.po $$tmpdir/$$lang.new.po >/dev/null 2>&1; then \ - rm -f $$tmpdir/$$lang.new.po; \ - else \ - if mv -f $$tmpdir/$$lang.new.po $$lang.po; then \ - :; \ - else \ - echo "creation of $$lang.po failed: cannot move $$tmpdir/$$lang.new.po to $$lang.po" 1>&2; \ - exit 1; \ - fi; \ - fi; \ - else \ - echo "creation of $$lang.po failed!" 1>&2; \ - rm -f $$tmpdir/$$lang.new.po; \ - fi - -en@quot.insert-header: insert-header.sin - sed -e '/^#/d' -e 's/HEADER/en@quot.header/g' $(srcdir)/insert-header.sin > en@quot.insert-header - -en@boldquot.insert-header: insert-header.sin - sed -e '/^#/d' -e 's/HEADER/en@boldquot.header/g' $(srcdir)/insert-header.sin > en@boldquot.insert-header - -mostlyclean: mostlyclean-quot -mostlyclean-quot: - rm -f *.insert-header diff --git a/src/bin/bison/po/bison.pot b/src/bin/bison/po/bison.pot deleted file mode 100644 index 4ce1f0fb46..0000000000 --- a/src/bin/bison/po/bison.pot +++ /dev/null @@ -1,698 +0,0 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) YEAR Free Software Foundation, Inc. -# This file is distributed under the same license as the PACKAGE package. -# FIRST AUTHOR , YEAR. -# -#, fuzzy -msgid "" -msgstr "" -"Project-Id-Version: PACKAGE VERSION\n" -"Report-Msgid-Bugs-To: bug-bison@gnu.org\n" -"POT-Creation-Date: 2004-05-21 10:26-0700\n" -"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" -"Last-Translator: FULL NAME \n" -"Language-Team: LANGUAGE \n" -"MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=CHARSET\n" -"Content-Transfer-Encoding: 8bit\n" -"Plural-Forms: nplurals=INTEGER; plural=EXPRESSION;\n" - -#: src/complain.c:51 src/complain.c:66 -msgid "warning: " -msgstr "" - -#: src/complain.c:122 src/complain.c:138 -msgid "fatal error: " -msgstr "" - -#: src/conflicts.c:76 -#, c-format -msgid " Conflict between rule %d and token %s resolved as shift" -msgstr "" - -#: src/conflicts.c:84 -#, c-format -msgid " Conflict between rule %d and token %s resolved as reduce" -msgstr "" - -#: src/conflicts.c:91 -#, c-format -msgid " Conflict between rule %d and token %s resolved as an error" -msgstr "" - -#: src/conflicts.c:399 -#, c-format -msgid "conflicts: %d shift/reduce, %d reduce/reduce\n" -msgstr "" - -#: src/conflicts.c:402 -#, c-format -msgid "conflicts: %d shift/reduce\n" -msgstr "" - -#: src/conflicts.c:404 -#, c-format -msgid "conflicts: %d reduce/reduce\n" -msgstr "" - -#: src/conflicts.c:422 -#, c-format -msgid "State %d " -msgstr "" - -#: src/conflicts.c:487 -#, c-format -msgid "%%expect-rr applies only to GLR parsers" -msgstr "" - -#: src/conflicts.c:511 -#, c-format -msgid "expected %d shift/reduce conflict" -msgid_plural "expected %d shift/reduce conflicts" -msgstr[0] "" -msgstr[1] "" - -#: src/conflicts.c:515 -#, c-format -msgid "expected %d reduce/reduce conflict" -msgid_plural "expected %d reduce/reduce conflicts" -msgstr[0] "" -msgstr[1] "" - -#: src/files.c:100 -#, c-format -msgid "cannot open file `%s'" -msgstr "" - -#: src/files.c:116 -msgid "I/O error" -msgstr "" - -#: src/files.c:119 -msgid "cannot close file" -msgstr "" - -#: src/files.c:337 -#, c-format -msgid "conflicting outputs to file %s" -msgstr "" - -#: src/getargs.c:186 -#, c-format -msgid "Try `%s --help' for more information.\n" -msgstr "" - -#: src/getargs.c:192 -msgid "GNU bison generates parsers for LALR(1) grammars.\n" -msgstr "" - -#: src/getargs.c:196 -#, c-format -msgid "Usage: %s [OPTION]... FILE\n" -msgstr "" - -#: src/getargs.c:200 -msgid "" -"If a long option shows an argument as mandatory, then it is mandatory\n" -"for the equivalent short option also. Similarly for optional arguments.\n" -msgstr "" - -#: src/getargs.c:206 -msgid "" -"Operation modes:\n" -" -h, --help display this help and exit\n" -" -V, --version output version information and exit\n" -" -y, --yacc emulate POSIX yacc\n" -msgstr "" - -#: src/getargs.c:213 -msgid "" -"Parser:\n" -" -S, --skeleton=FILE specify the skeleton to use\n" -" -t, --debug instrument the parser for debugging\n" -" --locations enable locations computation\n" -" -p, --name-prefix=PREFIX prepend PREFIX to the external symbols\n" -" -l, --no-lines don't generate `#line' directives\n" -" -n, --no-parser generate the tables only\n" -" -k, --token-table include a table of token names\n" -msgstr "" - -#: src/getargs.c:225 -msgid "" -"Output:\n" -" -d, --defines also produce a header file\n" -" -r, --report=THINGS also produce details on the automaton\n" -" -v, --verbose same as `--report=state'\n" -" -b, --file-prefix=PREFIX specify a PREFIX for output files\n" -" -o, --output=FILE leave output to FILE\n" -" -g, --graph also produce a VCG description of the " -"automaton\n" -msgstr "" - -#: src/getargs.c:236 -msgid "" -"THINGS is a list of comma separated words that can include:\n" -" `state' describe the states\n" -" `itemset' complete the core item sets with their closure\n" -" `lookahead' explicitly associate lookaheads to items\n" -" `solved' describe shift/reduce conflicts solving\n" -" `all' include all the above information\n" -" `none' disable the report\n" -msgstr "" - -#: src/getargs.c:247 -msgid "Report bugs to .\n" -msgstr "" - -#: src/getargs.c:264 -#, c-format -msgid "bison (GNU Bison) %s" -msgstr "" - -#: src/getargs.c:266 -msgid "Written by Robert Corbett and Richard Stallman.\n" -msgstr "" - -#: src/getargs.c:270 -#, c-format -msgid "Copyright (C) %d Free Software Foundation, Inc.\n" -msgstr "" - -#: src/getargs.c:272 -msgid "" -"This is free software; see the source for copying conditions. There is NO\n" -"warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n" -msgstr "" - -#: src/getargs.c:438 -#, c-format -msgid "missing operand after `%s'" -msgstr "" - -#: src/getargs.c:440 -#, c-format -msgid "extra operand `%s'" -msgstr "" - -#: src/gram.c:139 -msgid "empty" -msgstr "" - -#: src/gram.c:233 -msgid "Grammar" -msgstr "" - -#: src/gram.c:321 src/reduce.c:394 -msgid "warning" -msgstr "" - -#: src/main.c:124 -msgid "rule never reduced because of conflicts" -msgstr "" - -#: src/parse-gram.y:363 -msgid "POSIX forbids declarations in the grammar" -msgstr "" - -#: src/parse-gram.y:486 -msgid "missing identifier in parameter declaration" -msgstr "" - -#: src/print.c:49 -#, c-format -msgid " type %d is %s\n" -msgstr "" - -#: src/print.c:165 -#, c-format -msgid "shift, and go to state %d\n" -msgstr "" - -#: src/print.c:167 -#, c-format -msgid "go to state %d\n" -msgstr "" - -#: src/print.c:204 -msgid "error (nonassociative)\n" -msgstr "" - -#: src/print.c:292 -#, c-format -msgid "reduce using rule %d (%s)" -msgstr "" - -#: src/print.c:294 -#, c-format -msgid "accept" -msgstr "" - -#: src/print.c:325 src/print.c:391 -msgid "$default" -msgstr "" - -#: src/print.c:420 -#, c-format -msgid "state %d" -msgstr "" - -#: src/print.c:456 -msgid "Terminals, with rules where they appear" -msgstr "" - -#: src/print.c:483 -msgid "Nonterminals, with rules where they appear" -msgstr "" - -#: src/print.c:512 -#, c-format -msgid " on left:" -msgstr "" - -#: src/print.c:527 -#, c-format -msgid " on right:" -msgstr "" - -#: src/print.c:555 -msgid "Rules never reduced" -msgstr "" - -#: src/reader.c:56 -#, c-format -msgid "multiple %s declarations" -msgstr "" - -#: src/reader.c:118 -#, c-format -msgid "result type clash on merge function %s: <%s> != <%s>" -msgstr "" - -#: src/reader.c:216 -#, c-format -msgid "rule given for %s, which is a token" -msgstr "" - -#: src/reader.c:245 -#, c-format -msgid "type clash on default action: <%s> != <%s>" -msgstr "" - -#: src/reader.c:251 -msgid "empty rule for typed nonterminal, and no action" -msgstr "" - -#: src/reader.c:321 src/reader.c:335 src/reader.c:348 -#, c-format -msgid "only one %s allowed per rule" -msgstr "" - -#: src/reader.c:331 src/reader.c:346 -#, c-format -msgid "%s affects only GLR parsers" -msgstr "" - -#: src/reader.c:333 -#, c-format -msgid "%s must be followed by positive number" -msgstr "" - -#: src/reader.c:490 -msgid "no rules in the input grammar" -msgstr "" - -#: src/reduce.c:242 -msgid "useless rule" -msgstr "" - -#: src/reduce.c:303 -#, c-format -msgid "useless nonterminal: %s" -msgstr "" - -#: src/reduce.c:351 -msgid "Useless nonterminals" -msgstr "" - -#: src/reduce.c:364 -msgid "Terminals which are not used" -msgstr "" - -#: src/reduce.c:373 -msgid "Useless rules" -msgstr "" - -#: src/reduce.c:389 -#, c-format -msgid "%d rule never reduced\n" -msgid_plural "%d rules never reduced\n" -msgstr[0] "" -msgstr[1] "" - -#: src/reduce.c:397 -#, c-format -msgid "%d useless nonterminal" -msgid_plural "%d useless nonterminals" -msgstr[0] "" -msgstr[1] "" - -#: src/reduce.c:403 -#, c-format -msgid " and " -msgstr "" - -#: src/reduce.c:406 -#, c-format -msgid "%d useless rule" -msgid_plural "%d useless rules" -msgstr[0] "" -msgstr[1] "" - -#: src/reduce.c:436 -#, c-format -msgid "start symbol %s does not derive any sentence" -msgstr "" - -#: src/scan-gram.l:162 -msgid "stray `,' treated as white space" -msgstr "" - -#: src/scan-gram.l:225 -#, c-format -msgid "invalid directive: %s" -msgstr "" - -#: src/scan-gram.l:283 -#, c-format -msgid "invalid character: %s" -msgstr "" - -#: src/scan-gram.l:402 -msgid "invalid null character" -msgstr "" - -#: src/scan-gram.l:415 src/scan-gram.l:427 src/scan-gram.l:448 -#, c-format -msgid "invalid escape sequence: %s" -msgstr "" - -#: src/scan-gram.l:417 src/scan-gram.l:429 src/scan-gram.l:450 -#, c-format -msgid "invalid null character: %s" -msgstr "" - -#: src/scan-gram.l:455 -#, c-format -msgid "unrecognized escape sequence: %s" -msgstr "" - -#: src/scan-gram.l:537 -#, c-format -msgid "missing `{' in `%s'" -msgstr "" - -#: src/scan-gram.l:782 -#, c-format -msgid "$$ of `%s' has no declared type" -msgstr "" - -#: src/scan-gram.l:803 -#, c-format -msgid "$%d of `%s' has no declared type" -msgstr "" - -#: src/scan-gram.l:812 src/scan-gram.l:881 src/scan-gram.l:932 -#, c-format -msgid "integer out of range: %s" -msgstr "" - -#: src/scan-gram.l:848 src/scan-gram.l:916 -#, c-format -msgid "invalid value: %s" -msgstr "" - -#: src/scan-gram.l:1036 -#, c-format -msgid "missing `%s' at end of file" -msgstr "" - -#: src/scan-gram.l:1047 -#, c-format -msgid "missing `%s' at end of line" -msgstr "" - -#: src/symlist.c:97 src/symlist.c:108 -msgid "invalid $ value" -msgstr "" - -#: src/symtab.c:85 -#, c-format -msgid "type redeclaration for %s" -msgstr "" - -#: src/symtab.c:102 src/symtab.c:120 -#, c-format -msgid "%s redeclaration for %s" -msgstr "" - -#: src/symtab.c:139 -#, c-format -msgid "redefining precedence of %s" -msgstr "" - -#: src/symtab.c:157 -#, c-format -msgid "symbol %s redefined" -msgstr "" - -#: src/symtab.c:180 -#, c-format -msgid "redefining user token number of %s" -msgstr "" - -#: src/symtab.c:207 -#, c-format -msgid "symbol %s is used, but is not defined as a token and has no rules" -msgstr "" - -#: src/symtab.c:232 -#, c-format -msgid "symbol `%s' used more than once as a literal string" -msgstr "" - -#: src/symtab.c:235 -#, c-format -msgid "symbol `%s' given more than one literal string" -msgstr "" - -#: src/symtab.c:271 -#, c-format -msgid "conflicting precedences for %s and %s" -msgstr "" - -#: src/symtab.c:283 -#, c-format -msgid "conflicting associativities for %s (%s) and %s (%s)" -msgstr "" - -#: src/symtab.c:368 -#, c-format -msgid "tokens %s and %s both assigned number %d" -msgstr "" - -#: src/symtab.c:591 -#, c-format -msgid "the start symbol %s is undefined" -msgstr "" - -#: src/symtab.c:595 -#, c-format -msgid "the start symbol %s is a token" -msgstr "" - -#: lib/argmatch.c:133 -#, c-format -msgid "invalid argument %s for %s" -msgstr "" - -#: lib/argmatch.c:134 -#, c-format -msgid "ambiguous argument %s for %s" -msgstr "" - -#: lib/argmatch.c:153 -#, c-format -msgid "Valid arguments are:" -msgstr "" - -#: lib/bitset_stats.c:179 -#, c-format -msgid "%u bitset_allocs, %u freed (%.2f%%).\n" -msgstr "" - -#: lib/bitset_stats.c:182 -#, c-format -msgid "%u bitset_sets, %u cached (%.2f%%)\n" -msgstr "" - -#: lib/bitset_stats.c:185 -#, c-format -msgid "%u bitset_resets, %u cached (%.2f%%)\n" -msgstr "" - -#: lib/bitset_stats.c:188 -#, c-format -msgid "%u bitset_tests, %u cached (%.2f%%)\n" -msgstr "" - -#: lib/bitset_stats.c:192 -#, c-format -msgid "%u bitset_lists\n" -msgstr "" - -#: lib/bitset_stats.c:194 -msgid "count log histogram\n" -msgstr "" - -#: lib/bitset_stats.c:197 -msgid "size log histogram\n" -msgstr "" - -#: lib/bitset_stats.c:200 -msgid "density histogram\n" -msgstr "" - -#: lib/bitset_stats.c:214 -#, c-format -msgid "" -"Bitset statistics:\n" -"\n" -msgstr "" - -#: lib/bitset_stats.c:217 -#, c-format -msgid "Accumulated runs = %u\n" -msgstr "" - -#: lib/bitset_stats.c:261 lib/bitset_stats.c:266 -msgid "Could not read stats file." -msgstr "" - -#: lib/bitset_stats.c:263 -#, c-format -msgid "Bad stats file size.\n" -msgstr "" - -#: lib/bitset_stats.c:289 lib/bitset_stats.c:291 -msgid "Could not write stats file." -msgstr "" - -#: lib/bitset_stats.c:294 -msgid "Could not open stats file for writing." -msgstr "" - -#: lib/error.c:127 -msgid "Unknown system error" -msgstr "" - -#: lib/getopt.c:570 lib/getopt.c:589 -#, c-format -msgid "%s: option `%s' is ambiguous\n" -msgstr "" - -#: lib/getopt.c:622 lib/getopt.c:626 -#, c-format -msgid "%s: option `--%s' doesn't allow an argument\n" -msgstr "" - -#: lib/getopt.c:635 lib/getopt.c:640 -#, c-format -msgid "%s: option `%c%s' doesn't allow an argument\n" -msgstr "" - -#: lib/getopt.c:686 lib/getopt.c:708 lib/getopt.c:1039 lib/getopt.c:1061 -#, c-format -msgid "%s: option `%s' requires an argument\n" -msgstr "" - -#: lib/getopt.c:746 lib/getopt.c:749 -#, c-format -msgid "%s: unrecognized option `--%s'\n" -msgstr "" - -#: lib/getopt.c:757 lib/getopt.c:760 -#, c-format -msgid "%s: unrecognized option `%c%s'\n" -msgstr "" - -#: lib/getopt.c:815 lib/getopt.c:818 -#, c-format -msgid "%s: illegal option -- %c\n" -msgstr "" - -#: lib/getopt.c:824 lib/getopt.c:827 -#, c-format -msgid "%s: invalid option -- %c\n" -msgstr "" - -#: lib/getopt.c:882 lib/getopt.c:901 lib/getopt.c:1114 lib/getopt.c:1135 -#, c-format -msgid "%s: option requires an argument -- %c\n" -msgstr "" - -#: lib/getopt.c:954 lib/getopt.c:973 -#, c-format -msgid "%s: option `-W %s' is ambiguous\n" -msgstr "" - -#: lib/getopt.c:997 lib/getopt.c:1018 -#, c-format -msgid "%s: option `-W %s' doesn't allow an argument\n" -msgstr "" - -#: lib/obstack.c:417 lib/obstack.c:420 lib/xmalloc.c:53 -msgid "memory exhausted" -msgstr "" - -#: lib/quotearg.c:238 -msgid "`" -msgstr "" - -#: lib/quotearg.c:239 -msgid "'" -msgstr "" - -#: lib/subpipe.c:171 -#, c-format -msgid "subsidiary program `%s' could not be invoked" -msgstr "" - -#: lib/subpipe.c:173 -#, c-format -msgid "subsidiary program `%s' not found" -msgstr "" - -#: lib/subpipe.c:175 -#, c-format -msgid "subsidiary program `%s' failed" -msgstr "" - -#: lib/subpipe.c:176 -#, c-format -msgid "subsidiary program `%s' failed (exit status %d)" -msgstr "" - -#: lib/timevar.c:475 -msgid "" -"\n" -"Execution times (seconds)\n" -msgstr "" - -#: lib/timevar.c:525 -msgid " TOTAL :" -msgstr "" - -#: lib/timevar.c:561 -#, c-format -msgid "time in %s: %ld.%06ld (%ld%%)\n" -msgstr "" diff --git a/src/bin/bison/po/boldquot.sed b/src/bin/bison/po/boldquot.sed deleted file mode 100644 index 4b937aa517..0000000000 --- a/src/bin/bison/po/boldquot.sed +++ /dev/null @@ -1,10 +0,0 @@ -s/"\([^"]*\)"/“\1â€/g -s/`\([^`']*\)'/‘\1’/g -s/ '\([^`']*\)' / ‘\1’ /g -s/ '\([^`']*\)'$/ ‘\1’/g -s/^'\([^`']*\)' /‘\1’ /g -s/“â€/""/g -s/“/“/g -s/â€/â€/g -s/‘/‘/g -s/’/’/g diff --git a/src/bin/bison/po/da.gmo b/src/bin/bison/po/da.gmo deleted file mode 100644 index fd42e71a05..0000000000 Binary files a/src/bin/bison/po/da.gmo and /dev/null differ diff --git a/src/bin/bison/po/da.po b/src/bin/bison/po/da.po deleted file mode 100644 index 6e71202485..0000000000 --- a/src/bin/bison/po/da.po +++ /dev/null @@ -1,740 +0,0 @@ -# Danish messages for bison. -# Copyright © 2001, 2002 Free Software Foundation, Inc. -# Keld Simonsen , 2002. -# Byrial Ole Jensen , 2002-2003. -# -msgid "" -msgstr "" -"Project-Id-Version: bison 1.875a\n" -"Report-Msgid-Bugs-To: bug-bison@gnu.org\n" -"POT-Creation-Date: 2004-05-21 10:26-0700\n" -"PO-Revision-Date: 2003-04-12 22:57+0200\n" -"Last-Translator: Byrial Ole Jensen \n" -"Language-Team: Danish \n" -"MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=iso-8859-1\n" -"Content-Transfer-Encoding: 8bit\n" -"Plural-Forms: nplurals=2; plural=(n != 1);\n" - -#: src/complain.c:51 src/complain.c:66 -msgid "warning: " -msgstr "advarsel: " - -#: src/complain.c:122 src/complain.c:138 -msgid "fatal error: " -msgstr "fatal fejl: " - -#: src/conflicts.c:76 -#, c-format -msgid " Conflict between rule %d and token %s resolved as shift" -msgstr " Konflikt mellem regel %d og element %s løstes som skift" - -#: src/conflicts.c:84 -#, c-format -msgid " Conflict between rule %d and token %s resolved as reduce" -msgstr " Konflikt mellem regel %d og element %s løstes som reducér" - -#: src/conflicts.c:91 -#, c-format -msgid " Conflict between rule %d and token %s resolved as an error" -msgstr " Konflikt mellem regel %d og element %s løstes som en fejl" - -#: src/conflicts.c:399 -#, c-format -msgid "conflicts: %d shift/reduce, %d reduce/reduce\n" -msgstr "konflikter: %d skift/reducér, %d reducér/reducér\n" - -#: src/conflicts.c:402 -#, c-format -msgid "conflicts: %d shift/reduce\n" -msgstr "konflikter: %d skift/reducér\n" - -#: src/conflicts.c:404 -#, c-format -msgid "conflicts: %d reduce/reduce\n" -msgstr "konflikter: %d reducér/reducér\n" - -#: src/conflicts.c:422 -#, c-format -msgid "State %d " -msgstr "Tilstand %d " - -#: src/conflicts.c:487 -#, fuzzy, c-format -msgid "%%expect-rr applies only to GLR parsers" -msgstr "%s påvirker kun GLR-fortolkere" - -#: src/conflicts.c:511 -#, c-format -msgid "expected %d shift/reduce conflict" -msgid_plural "expected %d shift/reduce conflicts" -msgstr[0] "forventede %d skift/reducér-konflikt" -msgstr[1] "forventede %d skift/reducér-konflikter" - -#: src/conflicts.c:515 -#, fuzzy, c-format -msgid "expected %d reduce/reduce conflict" -msgid_plural "expected %d reduce/reduce conflicts" -msgstr[0] "forventede 0 reducér/reducér-konflikter" -msgstr[1] "forventede 0 reducér/reducér-konflikter" - -#: src/files.c:100 -#, c-format -msgid "cannot open file `%s'" -msgstr "kan ikke åbne filen \"%s\"" - -#: src/files.c:116 -msgid "I/O error" -msgstr "Fejl ved ind- eller udlæsning" - -#: src/files.c:119 -msgid "cannot close file" -msgstr "kan ikke lukke fil" - -#: src/files.c:337 -#, c-format -msgid "conflicting outputs to file %s" -msgstr "konfliktende uddata til filen %s" - -#: src/getargs.c:186 -#, c-format -msgid "Try `%s --help' for more information.\n" -msgstr "Prøv med \"%s --help\" for mere information.\n" - -#: src/getargs.c:192 -msgid "GNU bison generates parsers for LALR(1) grammars.\n" -msgstr "GNU bison genererer fortolkere til LALR(1)-grammatiker.\n" - -#: src/getargs.c:196 -#, c-format -msgid "Usage: %s [OPTION]... FILE\n" -msgstr "Brug: %s [FLAG]... FIL\n" - -#: src/getargs.c:200 -msgid "" -"If a long option shows an argument as mandatory, then it is mandatory\n" -"for the equivalent short option also. Similarly for optional arguments.\n" -msgstr "" -"Hvis et lang flag viser et argument som obligatorisk, er det også\n" -"obligatorisk for det tilsvarende korte flag. Tilsvarende\n" -"for valgfrie argumenter.\n" - -#: src/getargs.c:206 -msgid "" -"Operation modes:\n" -" -h, --help display this help and exit\n" -" -V, --version output version information and exit\n" -" -y, --yacc emulate POSIX yacc\n" -msgstr "" -"Arbejdstilstande:\n" -" -h, --help vis denne hjælpetekst og afslut\n" -" -V, --version vis versionsinformation og afslut\n" -" -y, --yacc emulér POSIX-yacc\n" - -#: src/getargs.c:213 -msgid "" -"Parser:\n" -" -S, --skeleton=FILE specify the skeleton to use\n" -" -t, --debug instrument the parser for debugging\n" -" --locations enable locations computation\n" -" -p, --name-prefix=PREFIX prepend PREFIX to the external symbols\n" -" -l, --no-lines don't generate `#line' directives\n" -" -n, --no-parser generate the tables only\n" -" -k, --token-table include a table of token names\n" -msgstr "" -"Fortolker:\n" -" -S, --skeleton=FIL angiv skeletfilen som skal bruges\n" -" -t, --debug instrumentér fortolkeren for fejlsøgning\n" -" --locations aktivér tilstandsberegning\n" -" -p, --name-prefix=PRÆFIKS tilføj PRÆFIKS for eksterne symboler\n" -" -l, --no-lines generér ikke \"#line\"-direktiver\n" -" -n, --no-parser generér kun tabellerne\n" -" -k, --token-table inkludér en tabel over elementnavne\n" - -#: src/getargs.c:225 -msgid "" -"Output:\n" -" -d, --defines also produce a header file\n" -" -r, --report=THINGS also produce details on the automaton\n" -" -v, --verbose same as `--report=state'\n" -" -b, --file-prefix=PREFIX specify a PREFIX for output files\n" -" -o, --output=FILE leave output to FILE\n" -" -g, --graph also produce a VCG description of the " -"automaton\n" -msgstr "" -"Uddata:\n" -" -d, --defines lav også en hovedfil\n" -" -r, --report=SAGER lav også detaljer om automaten\n" -" -v, --verbose samme som \"--report=state\"\n" -" -b, --file-prefix=PRÆFIKS angiv et PRÆFIKS for uddatafiler\n" -" -o, --output=FIL læg uddata i FIL\n" -" -g, --graph lav også en VCG-beskrivelse af automaten\n" - -#: src/getargs.c:236 -msgid "" -"THINGS is a list of comma separated words that can include:\n" -" `state' describe the states\n" -" `itemset' complete the core item sets with their closure\n" -" `lookahead' explicitly associate lookaheads to items\n" -" `solved' describe shift/reduce conflicts solving\n" -" `all' include all the above information\n" -" `none' disable the report\n" -msgstr "" -"TING er en liste med kommaseparerede ord som kan indeholde:\n" -" \"state\" beskriv tilstandene\n" -" \"itemset\" komplettér kerneobjektmængderne med deres afslutninger\n" -" \"lookahead\" kobl udtrykkeligt fremadkig til objekter\n" -" \"solved\" beskriv løsninger af skift/reducér-konflikter\n" -" \"all\" inkludér al ovenstående information\n" -" \"none\" deaktivér rapporten\n" - -#: src/getargs.c:247 -msgid "Report bugs to .\n" -msgstr "" -"Rapportér fejl til .\n" -"Rapportér synpunkter om oversættelsen til .\n" - -#: src/getargs.c:264 -#, c-format -msgid "bison (GNU Bison) %s" -msgstr "bison (GNU Bison) %s" - -#: src/getargs.c:266 -msgid "Written by Robert Corbett and Richard Stallman.\n" -msgstr "Skrevet af Robert Corbett og Richard Stallman.\n" - -#: src/getargs.c:270 -#, c-format -msgid "Copyright (C) %d Free Software Foundation, Inc.\n" -msgstr "Copyright © %d Free Software Foundation, Inc.\n" - -#: src/getargs.c:272 -msgid "" -"This is free software; see the source for copying conditions. There is NO\n" -"warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n" -msgstr "" -"Dette er frit programmel, se kildekoden for kopieringsbetingelser. Der\n" -"gives INGEN garanti, endog ikke for SALGBARHED eller EGNETHED FOR NOGET\n" -"BESTEMT FORMÅL.\n" - -#: src/getargs.c:438 -#, c-format -msgid "missing operand after `%s'" -msgstr "manglende operand efter \"%s\"" - -#: src/getargs.c:440 -#, c-format -msgid "extra operand `%s'" -msgstr "overtallig operand \"%s\"" - -#: src/gram.c:139 -msgid "empty" -msgstr "tom" - -#: src/gram.c:233 -msgid "Grammar" -msgstr "Grammatik" - -#: src/gram.c:321 src/reduce.c:394 -msgid "warning" -msgstr "advarsel" - -#: src/main.c:124 -msgid "rule never reduced because of conflicts" -msgstr "regel aldrig reduceret på grund af konflikter" - -#: src/parse-gram.y:363 -msgid "POSIX forbids declarations in the grammar" -msgstr "POSIX forbyder deklarationer i grammatikken" - -#: src/parse-gram.y:486 -msgid "missing identifier in parameter declaration" -msgstr "manglende identifikator i parameterdeklaration" - -#: src/print.c:49 -#, c-format -msgid " type %d is %s\n" -msgstr " type %d er %s\n" - -#: src/print.c:165 -#, c-format -msgid "shift, and go to state %d\n" -msgstr "skift, og gå til tilstand %d\n" - -#: src/print.c:167 -#, c-format -msgid "go to state %d\n" -msgstr "gå til tilstand %d\n" - -#: src/print.c:204 -msgid "error (nonassociative)\n" -msgstr "fejl (ikke-associativ)\n" - -#: src/print.c:292 -#, c-format -msgid "reduce using rule %d (%s)" -msgstr "reducér med regel %d (%s)" - -#: src/print.c:294 -#, c-format -msgid "accept" -msgstr "acceptér" - -#: src/print.c:325 src/print.c:391 -msgid "$default" -msgstr "$default" - -#: src/print.c:420 -#, c-format -msgid "state %d" -msgstr "tilstand %d" - -#: src/print.c:456 -msgid "Terminals, with rules where they appear" -msgstr "Terminaler, med regler hvor de forekommer" - -#: src/print.c:483 -msgid "Nonterminals, with rules where they appear" -msgstr "Ikke-terminaler, med regler hvor de forekommer" - -#: src/print.c:512 -#, c-format -msgid " on left:" -msgstr " til venstre:" - -#: src/print.c:527 -#, c-format -msgid " on right:" -msgstr " til højre:" - -#: src/print.c:555 -msgid "Rules never reduced" -msgstr "Aldrig reducerede regler" - -#: src/reader.c:56 -#, c-format -msgid "multiple %s declarations" -msgstr "flere %s-deklarationer" - -#: src/reader.c:118 -#, c-format -msgid "result type clash on merge function %s: <%s> != <%s>" -msgstr "resultattypekonflikt ved sammenfletningsfunktion %s: <%s> != <%s>" - -#: src/reader.c:216 -#, c-format -msgid "rule given for %s, which is a token" -msgstr "regel givet for %s som er et element" - -#: src/reader.c:245 -#, c-format -msgid "type clash on default action: <%s> != <%s>" -msgstr "typekonflikt for standardhandling: <%s> != <%s>" - -#: src/reader.c:251 -msgid "empty rule for typed nonterminal, and no action" -msgstr "tom regel for typet ikke-terminal, og ingen handling" - -#: src/reader.c:321 src/reader.c:335 src/reader.c:348 -#, c-format -msgid "only one %s allowed per rule" -msgstr "kun en %s tilladt per regel" - -#: src/reader.c:331 src/reader.c:346 -#, c-format -msgid "%s affects only GLR parsers" -msgstr "%s påvirker kun GLR-fortolkere" - -#: src/reader.c:333 -#, c-format -msgid "%s must be followed by positive number" -msgstr "%s skal følges af et positivt tal" - -#: src/reader.c:490 -msgid "no rules in the input grammar" -msgstr "ingen regler i inddatagrammatikken" - -#: src/reduce.c:242 -msgid "useless rule" -msgstr "ubrugelig regel" - -#: src/reduce.c:303 -#, c-format -msgid "useless nonterminal: %s" -msgstr "ubrugelig ikke-terminal: %s" - -#: src/reduce.c:351 -msgid "Useless nonterminals" -msgstr "Ubrugelige ikke-terminaler" - -#: src/reduce.c:364 -msgid "Terminals which are not used" -msgstr "Terminaler som ikke bruges" - -#: src/reduce.c:373 -msgid "Useless rules" -msgstr "Ubrugelige regler" - -#: src/reduce.c:389 -#, c-format -msgid "%d rule never reduced\n" -msgid_plural "%d rules never reduced\n" -msgstr[0] "%d regel reduceres aldrig\n" -msgstr[1] "%d regler reduceres aldrig\n" - -#: src/reduce.c:397 -#, c-format -msgid "%d useless nonterminal" -msgid_plural "%d useless nonterminals" -msgstr[0] "%d ubrugelig ikke-terminal" -msgstr[1] "%d ubrugelige ikke-terminaler" - -#: src/reduce.c:403 -#, c-format -msgid " and " -msgstr " og " - -#: src/reduce.c:406 -#, c-format -msgid "%d useless rule" -msgid_plural "%d useless rules" -msgstr[0] "%d ubrugelig regel" -msgstr[1] "%d ubrugelige regler" - -#: src/reduce.c:436 -#, c-format -msgid "start symbol %s does not derive any sentence" -msgstr "startsymbolet %s genererer ingen sætninger" - -#: src/scan-gram.l:162 -msgid "stray `,' treated as white space" -msgstr "Malplaceret \",\" behandlet som blanktegn" - -#: src/scan-gram.l:225 -#, c-format -msgid "invalid directive: %s" -msgstr "ugyldigt direktiv: %s" - -#: src/scan-gram.l:283 -#, c-format -msgid "invalid character: %s" -msgstr "ugyldigt tegn: %s" - -#: src/scan-gram.l:402 -#, fuzzy -msgid "invalid null character" -msgstr "ugyldigt tegn: %s" - -#: src/scan-gram.l:415 src/scan-gram.l:427 src/scan-gram.l:448 -#, c-format -msgid "invalid escape sequence: %s" -msgstr "ugyldig undvigesekvens: %s" - -#: src/scan-gram.l:417 src/scan-gram.l:429 src/scan-gram.l:450 -#, fuzzy, c-format -msgid "invalid null character: %s" -msgstr "ugyldigt tegn: %s" - -#: src/scan-gram.l:455 -#, c-format -msgid "unrecognized escape sequence: %s" -msgstr "ukendt undvigesekvens: %s" - -#: src/scan-gram.l:537 -#, c-format -msgid "missing `{' in `%s'" -msgstr "manglende \"{\" i \"%s\"" - -#: src/scan-gram.l:782 -#, c-format -msgid "$$ of `%s' has no declared type" -msgstr "$$ for \"%s\" har ingen erklæret type" - -#: src/scan-gram.l:803 -#, c-format -msgid "$%d of `%s' has no declared type" -msgstr "$%d for \"%s\" har ingen erklæret type" - -#: src/scan-gram.l:812 src/scan-gram.l:881 src/scan-gram.l:932 -#, c-format -msgid "integer out of range: %s" -msgstr "heltal uden for gyldigshedsområdet: %s" - -#: src/scan-gram.l:848 src/scan-gram.l:916 -#, c-format -msgid "invalid value: %s" -msgstr "fejlagtig værdi: %s" - -#: src/scan-gram.l:1036 -#, c-format -msgid "missing `%s' at end of file" -msgstr "manglende \"%s\" ved slutningen af filen" - -#: src/scan-gram.l:1047 -#, fuzzy, c-format -msgid "missing `%s' at end of line" -msgstr "manglende \"%s\" ved slutningen af filen" - -#: src/symlist.c:97 src/symlist.c:108 -msgid "invalid $ value" -msgstr "fejlagtig $-værdi" - -#: src/symtab.c:85 -#, c-format -msgid "type redeclaration for %s" -msgstr "gentagen typeerklæring for %s" - -#: src/symtab.c:102 src/symtab.c:120 -#, c-format -msgid "%s redeclaration for %s" -msgstr "gentagen %s-erklæring for %s" - -#: src/symtab.c:139 -#, c-format -msgid "redefining precedence of %s" -msgstr "redefinition af præcedens for %s" - -#: src/symtab.c:157 -#, c-format -msgid "symbol %s redefined" -msgstr "symbol %s redefineret" - -#: src/symtab.c:180 -#, c-format -msgid "redefining user token number of %s" -msgstr "redefinition af elementnummer for %s" - -#: src/symtab.c:207 -#, c-format -msgid "symbol %s is used, but is not defined as a token and has no rules" -msgstr "" -"symbol %s bruges, men er ikke defineret som et element og har ingen regler" - -#: src/symtab.c:232 -#, c-format -msgid "symbol `%s' used more than once as a literal string" -msgstr "symbol \"%s\" bruges mere end en gang som en bogstavelig streng" - -#: src/symtab.c:235 -#, c-format -msgid "symbol `%s' given more than one literal string" -msgstr "symbol \"%s\" har fået mere end én bogstavelig streng" - -#: src/symtab.c:271 -#, c-format -msgid "conflicting precedences for %s and %s" -msgstr "modstridige præcedenser mellem %s og %s" - -#: src/symtab.c:283 -#, c-format -msgid "conflicting associativities for %s (%s) and %s (%s)" -msgstr "modstridige associativiteter for %s (%s) og %s (%s)" - -#: src/symtab.c:368 -#, c-format -msgid "tokens %s and %s both assigned number %d" -msgstr "elementerne %s og %s har begge fået nummer %d" - -#: src/symtab.c:591 -#, c-format -msgid "the start symbol %s is undefined" -msgstr "startsymbolet %s er udefineret" - -#: src/symtab.c:595 -#, c-format -msgid "the start symbol %s is a token" -msgstr "startsymbolet %s er et element" - -#: lib/argmatch.c:133 -#, c-format -msgid "invalid argument %s for %s" -msgstr "ugyldigt argument %s til %s" - -#: lib/argmatch.c:134 -#, c-format -msgid "ambiguous argument %s for %s" -msgstr "flertydigt argument %s til %s" - -#: lib/argmatch.c:153 -#, c-format -msgid "Valid arguments are:" -msgstr "Gyldige argumenter er:" - -#: lib/bitset_stats.c:179 -#, c-format -msgid "%u bitset_allocs, %u freed (%.2f%%).\n" -msgstr "%u bitmængdeallokeringer, %u frigjort (%.2f%%).\n" - -#: lib/bitset_stats.c:182 -#, c-format -msgid "%u bitset_sets, %u cached (%.2f%%)\n" -msgstr "%u bitmængdeindstillinger, %u cachede (%.2f%%)\n" - -#: lib/bitset_stats.c:185 -#, c-format -msgid "%u bitset_resets, %u cached (%.2f%%)\n" -msgstr "%u bitmængdenulstillinger, %u cachede (%.2f%%)\n" - -#: lib/bitset_stats.c:188 -#, c-format -msgid "%u bitset_tests, %u cached (%.2f%%)\n" -msgstr "%u bitmængdetest, %u cachede (%.2f%%)\n" - -#: lib/bitset_stats.c:192 -#, c-format -msgid "%u bitset_lists\n" -msgstr "%u bitmængdelister\n" - -#: lib/bitset_stats.c:194 -msgid "count log histogram\n" -msgstr "kaldsloghistogram\n" - -#: lib/bitset_stats.c:197 -msgid "size log histogram\n" -msgstr "størrelsesloghistogram\n" - -#: lib/bitset_stats.c:200 -msgid "density histogram\n" -msgstr "densitetshistogram\n" - -#: lib/bitset_stats.c:214 -#, c-format -msgid "" -"Bitset statistics:\n" -"\n" -msgstr "" -"Bitmængdestatistik:\n" -"\n" - -#: lib/bitset_stats.c:217 -#, c-format -msgid "Accumulated runs = %u\n" -msgstr "Akkumulerede kørsler = %u\n" - -#: lib/bitset_stats.c:261 lib/bitset_stats.c:266 -msgid "Could not read stats file." -msgstr "Kunne ikke læse statistikfil." - -#: lib/bitset_stats.c:263 -#, c-format -msgid "Bad stats file size.\n" -msgstr "Dårlig statistikfilstørrelse.\n" - -#: lib/bitset_stats.c:289 lib/bitset_stats.c:291 -msgid "Could not write stats file." -msgstr "Kunne ikke skrive statistikfil." - -#: lib/bitset_stats.c:294 -msgid "Could not open stats file for writing." -msgstr "Kunne ikke åbne statistikfil for skrivning." - -#: lib/error.c:127 -msgid "Unknown system error" -msgstr "Ukendt systemfejl" - -#: lib/getopt.c:570 lib/getopt.c:589 -#, c-format -msgid "%s: option `%s' is ambiguous\n" -msgstr "%s: flaget \"%s\" er flertydigt\n" - -#: lib/getopt.c:622 lib/getopt.c:626 -#, c-format -msgid "%s: option `--%s' doesn't allow an argument\n" -msgstr "%s: flaget \"--%s\" tager intet argument\n" - -#: lib/getopt.c:635 lib/getopt.c:640 -#, c-format -msgid "%s: option `%c%s' doesn't allow an argument\n" -msgstr "%s: flaget \"%c%s\" tager intet argument\n" - -#: lib/getopt.c:686 lib/getopt.c:708 lib/getopt.c:1039 lib/getopt.c:1061 -#, c-format -msgid "%s: option `%s' requires an argument\n" -msgstr "%s: flaget \"%s\" behøver et argument\n" - -#: lib/getopt.c:746 lib/getopt.c:749 -#, c-format -msgid "%s: unrecognized option `--%s'\n" -msgstr "%s: ukendt flag \"--%s\"\n" - -#: lib/getopt.c:757 lib/getopt.c:760 -#, c-format -msgid "%s: unrecognized option `%c%s'\n" -msgstr "%s: ukendt flag \"%c%s\"\n" - -#: lib/getopt.c:815 lib/getopt.c:818 -#, c-format -msgid "%s: illegal option -- %c\n" -msgstr "%s: ikke tilladt flag -- %c\n" - -#: lib/getopt.c:824 lib/getopt.c:827 -#, c-format -msgid "%s: invalid option -- %c\n" -msgstr "%s: ugyldigt flag --%c\n" - -#: lib/getopt.c:882 lib/getopt.c:901 lib/getopt.c:1114 lib/getopt.c:1135 -#, c-format -msgid "%s: option requires an argument -- %c\n" -msgstr "%s: flaget behøver et argument -- %c\n" - -#: lib/getopt.c:954 lib/getopt.c:973 -#, c-format -msgid "%s: option `-W %s' is ambiguous\n" -msgstr "%s: flaget \"-W %s\" er flertydigt\n" - -#: lib/getopt.c:997 lib/getopt.c:1018 -#, c-format -msgid "%s: option `-W %s' doesn't allow an argument\n" -msgstr "%s: flaget \"-W %s\" tager intet argument\n" - -#: lib/obstack.c:417 lib/obstack.c:420 lib/xmalloc.c:53 -msgid "memory exhausted" -msgstr "hukommelsen opbrugt" - -# Når vi går over til Unicode mere allmænt måske vi bør oversættta båda disse -# med U+201D (RIGHT DOUBLE QUOTATION MARK) på svenska. Eller? -# -#: lib/quotearg.c:238 -msgid "`" -msgstr "\"" - -#: lib/quotearg.c:239 -msgid "'" -msgstr "\"" - -#: lib/subpipe.c:171 -#, c-format -msgid "subsidiary program `%s' could not be invoked" -msgstr "hjælpeprogrammet \"%s\" kunne ikke startes" - -#: lib/subpipe.c:173 -#, c-format -msgid "subsidiary program `%s' not found" -msgstr "hjælpeprogrammet \"%s\" ikke fundet" - -#: lib/subpipe.c:175 -#, c-format -msgid "subsidiary program `%s' failed" -msgstr "hjælpeprogrammet \"%s\" fejlede" - -#: lib/subpipe.c:176 -#, c-format -msgid "subsidiary program `%s' failed (exit status %d)" -msgstr "hjælpeprogrammet \"%s\" fejlede med afslutningskode %d" - -#: lib/timevar.c:475 -msgid "" -"\n" -"Execution times (seconds)\n" -msgstr "" -"\n" -"Udførelsestider (sekunder)\n" - -#: lib/timevar.c:525 -msgid " TOTAL :" -msgstr " TOTALT :" - -#: lib/timevar.c:561 -#, c-format -msgid "time in %s: %ld.%06ld (%ld%%)\n" -msgstr "tid i %s: %ld.%06ld (%ld%%)\n" diff --git a/src/bin/bison/po/de.gmo b/src/bin/bison/po/de.gmo deleted file mode 100644 index 39d2909179..0000000000 Binary files a/src/bin/bison/po/de.gmo and /dev/null differ diff --git a/src/bin/bison/po/de.po b/src/bin/bison/po/de.po deleted file mode 100644 index 1981900245..0000000000 --- a/src/bin/bison/po/de.po +++ /dev/null @@ -1,1038 +0,0 @@ -# German translation for message of GNU bison. -# Copyright (C) 1996 Free Software Foundation, Inc. -# Ulrich Drepper , 1996. -# Michael Piefel , 2002. -# -msgid "" -msgstr "" -"Project-Id-Version: bison 1.875\n" -"Report-Msgid-Bugs-To: bug-bison@gnu.org\n" -"POT-Creation-Date: 2004-05-21 10:26-0700\n" -"PO-Revision-Date: 2003-01-02 12:38:45+0100\n" -"Last-Translator: Michael Piefel \n" -"Language-Team: German \n" -"MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=UTF-8\n" -"Content-Transfer-Encoding: 8-bit\n" -"Plural-Forms: nplurals=2; plural=n != 1;\n" - -#: src/complain.c:51 src/complain.c:66 -msgid "warning: " -msgstr "Warnung: " - -#: src/complain.c:122 src/complain.c:138 -msgid "fatal error: " -msgstr "fataler Fehler: " - -#: src/conflicts.c:76 -#, c-format -msgid " Conflict between rule %d and token %s resolved as shift" -msgstr "" -" Konflikt zwischen Regel %d and Token %s wurde durch Schieben gelöst" - -#: src/conflicts.c:84 -#, c-format -msgid " Conflict between rule %d and token %s resolved as reduce" -msgstr "" -" Konflikt zwischen Regel %d and Token %s wurde durch Reduzierung gelöst" - -#: src/conflicts.c:91 -#, c-format -msgid " Conflict between rule %d and token %s resolved as an error" -msgstr "" -" Konflikt zwischen Regel %d and Token %s wurde als Fehler betrachtet" - -#: src/conflicts.c:399 -#, c-format -msgid "conflicts: %d shift/reduce, %d reduce/reduce\n" -msgstr "Konflikte: %d Schiebe/Reduziere, %d Reduziere/Reduziere\n" - -#: src/conflicts.c:402 -#, c-format -msgid "conflicts: %d shift/reduce\n" -msgstr "Konflikte: %d Schiebe/Reduziere\n" - -#: src/conflicts.c:404 -#, c-format -msgid "conflicts: %d reduce/reduce\n" -msgstr "Konflikte: %d Reduziere/Reduziere\n" - -#: src/conflicts.c:422 -#, c-format -msgid "State %d " -msgstr "Zustand %d " - -#: src/conflicts.c:487 -#, fuzzy, c-format -msgid "%%expect-rr applies only to GLR parsers" -msgstr "%%dprec betrifft nur GLR-Parser" - -#: src/conflicts.c:511 -#, c-format -msgid "expected %d shift/reduce conflict" -msgid_plural "expected %d shift/reduce conflicts" -msgstr[0] "erwartete %d Schiebe/Reduziere-Konflikt" -msgstr[1] "erwartete %d Schiebe/Reduziere-Konflikte" - -#: src/conflicts.c:515 -#, fuzzy, c-format -msgid "expected %d reduce/reduce conflict" -msgid_plural "expected %d reduce/reduce conflicts" -msgstr[0] "erwartete 0 Reduziere/Reduziere-Konflikte" -msgstr[1] "erwartete 0 Reduziere/Reduziere-Konflikte" - -#: src/files.c:100 -#, c-format -msgid "cannot open file `%s'" -msgstr "kann Datei »%s« nicht öffnen" - -#: src/files.c:116 -msgid "I/O error" -msgstr "E/A-Fehler" - -#: src/files.c:119 -msgid "cannot close file" -msgstr "kann Datei nicht schließen" - -#: src/files.c:337 -#, c-format -msgid "conflicting outputs to file %s" -msgstr "widersprüchliche Ausgaben in Datei %s" - -#: src/getargs.c:186 -#, c-format -msgid "Try `%s --help' for more information.\n" -msgstr "»%s --help« gibt weitere Informationen.\n" - -#: src/getargs.c:192 -msgid "GNU bison generates parsers for LALR(1) grammars.\n" -msgstr "GNU bison generiert Parser für LALR(1)-Grammatiken.\n" - -#: src/getargs.c:196 -#, c-format -msgid "Usage: %s [OPTION]... FILE\n" -msgstr "Aufruf: %s [OPTION]... DATEI\n" - -#: src/getargs.c:200 -msgid "" -"If a long option shows an argument as mandatory, then it is mandatory\n" -"for the equivalent short option also. Similarly for optional arguments.\n" -msgstr "" -"Wenn eine lange Option ein Argument als erforderlich anzeigt, dann ist es " -"auch\n" -"für die äquivalente kurze Option erforderlich. Ähnlich für optionale " -"Argumente.\n" - -#: src/getargs.c:206 -msgid "" -"Operation modes:\n" -" -h, --help display this help and exit\n" -" -V, --version output version information and exit\n" -" -y, --yacc emulate POSIX yacc\n" -msgstr "" -"Arbeitsmodi:\n" -" -h, --help diese Hilfe anzeigen und beenden.\n" -" -v, --version Versionsinformation anzeigen und beenden.\n" -" -y, --yacc POSIX' yacc emulieren\n" - -#: src/getargs.c:213 -msgid "" -"Parser:\n" -" -S, --skeleton=FILE specify the skeleton to use\n" -" -t, --debug instrument the parser for debugging\n" -" --locations enable locations computation\n" -" -p, --name-prefix=PREFIX prepend PREFIX to the external symbols\n" -" -l, --no-lines don't generate `#line' directives\n" -" -n, --no-parser generate the tables only\n" -" -k, --token-table include a table of token names\n" -msgstr "" -"Parser:\n" -" -S, --skeleton=DATEI zu benutzende Skelettdatei angeben\n" -" -t, --debug den Parser auf Debugging-Unterstützung " -"vorbereiten\n" -" --locations Standortberechnung ermöglichen\n" -" -p, --name-prefix=PRÄFIX PRÄFIX vor alle externen Symbole setzen\n" -" -l, --no-lines keine »#line«-Direktiven erzeugen\n" -" -n, --no-parser nur die Tabellen generieren\n" -" -k, --token-table einer Tabellen der Token-Namen mit " -"einschließen\n" - -#: src/getargs.c:225 -msgid "" -"Output:\n" -" -d, --defines also produce a header file\n" -" -r, --report=THINGS also produce details on the automaton\n" -" -v, --verbose same as `--report=state'\n" -" -b, --file-prefix=PREFIX specify a PREFIX for output files\n" -" -o, --output=FILE leave output to FILE\n" -" -g, --graph also produce a VCG description of the " -"automaton\n" -msgstr "" -"Ausgabe:\n" -" -d, --defines auch eine Header-Datei herstellen\n" -" -r, --report=DINGE auch Details des Automaten ausgeben\n" -" -v, --verbose auch eine Erklärung des Automaten herstellen\n" -" -b, --file-prefix=PRÄFIX einen PRÄFIX für Ausgabe-Dateien angeben\n" -" -o, --output=DATEI Ausgabe in DATEI schreiben\n" -" -g, --graph auch eine VCG-Beschreibung des Automaten " -"herstellen\n" - -#: src/getargs.c:236 -msgid "" -"THINGS is a list of comma separated words that can include:\n" -" `state' describe the states\n" -" `itemset' complete the core item sets with their closure\n" -" `lookahead' explicitly associate lookaheads to items\n" -" `solved' describe shift/reduce conflicts solving\n" -" `all' include all the above information\n" -" `none' disable the report\n" -msgstr "" -"DINGE ist eine Liste kommagetrennter Wörter aus:\n" -" »state« die Zustänge beschreiben\n" -" »itemset« die Kernsybolmengen mit ihrem Abschluss vervollständigen\n" -" »lookahead« explizit Vorschau mit Symbolen verbinden\n" -" »solved« Schiebe-/Reduzier-Konfliktlösung beschreiben\n" -" »all« alle oben genannten Informationen\n" -" »none« den Report abschalten\n" - -#: src/getargs.c:247 -msgid "Report bugs to .\n" -msgstr "" -"Berichten Sie Fehler (auf Englisch, mit LC_ALL=C) an .\n" - -#: src/getargs.c:264 -#, c-format -msgid "bison (GNU Bison) %s" -msgstr "bison (GNU Bison) %s" - -#: src/getargs.c:266 -msgid "Written by Robert Corbett and Richard Stallman.\n" -msgstr "Geschrieben von Robert Corbett und Richard Stallman.\n" - -#: src/getargs.c:270 -#, c-format -msgid "Copyright (C) %d Free Software Foundation, Inc.\n" -msgstr "Copyright © %d Free Software Foundation, Inc.\n" - -#: src/getargs.c:272 -msgid "" -"This is free software; see the source for copying conditions. There is NO\n" -"warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n" -msgstr "" -"Dies ist freie Software; die Kopierbedingungen stehen in den Quellen. Es\n" -"gibt keine Garantie; auch nicht für VERKAUFBARKEIT oder FÜR SPEZIELLE " -"ZWECKE.\n" - -#: src/getargs.c:438 -#, c-format -msgid "missing operand after `%s'" -msgstr "fehlender Operand nach »%s«" - -#: src/getargs.c:440 -#, c-format -msgid "extra operand `%s'" -msgstr "zusätzlicher Operand »%s«" - -#: src/gram.c:139 -msgid "empty" -msgstr "leer" - -#: src/gram.c:233 -msgid "Grammar" -msgstr "Grammatik" - -#: src/gram.c:321 src/reduce.c:394 -msgid "warning" -msgstr "Warnung" - -#: src/main.c:124 -msgid "rule never reduced because of conflicts" -msgstr "Regel nie reduziert wegen Konflikten" - -#: src/parse-gram.y:363 -msgid "POSIX forbids declarations in the grammar" -msgstr "POSIX verbietet Deklarationen in der Grammatik" - -#: src/parse-gram.y:486 -msgid "missing identifier in parameter declaration" -msgstr "fehlender Bezeichner in Parameterdeklaration" - -#: src/print.c:49 -#, c-format -msgid " type %d is %s\n" -msgstr " Typ %d ist %s\n" - -#: src/print.c:165 -#, c-format -msgid "shift, and go to state %d\n" -msgstr "schiebe und gehe zu Zustand %d über\n" - -#: src/print.c:167 -#, c-format -msgid "go to state %d\n" -msgstr "gehe zu Zustand %d über\n" - -#: src/print.c:204 -msgid "error (nonassociative)\n" -msgstr "Fehler (nicht assoziativ)\n" - -#: src/print.c:292 -#, c-format -msgid "reduce using rule %d (%s)" -msgstr "reduziere mit Regel %d (%s)" - -#: src/print.c:294 -#, c-format -msgid "accept" -msgstr "annehmen" - -#: src/print.c:325 src/print.c:391 -msgid "$default" -msgstr "$default" - -#: src/print.c:420 -#, c-format -msgid "state %d" -msgstr "Zustand %d" - -#: src/print.c:456 -msgid "Terminals, with rules where they appear" -msgstr "Terminale und die Regeln, in denen sie verwendet werden" - -#: src/print.c:483 -msgid "Nonterminals, with rules where they appear" -msgstr "Nicht-Terminal und die Regeln, in denen sie verwendet werden" - -#: src/print.c:512 -#, c-format -msgid " on left:" -msgstr " auf der linken Seite:" - -#: src/print.c:527 -#, c-format -msgid " on right:" -msgstr " auf der rechten Seite:" - -#: src/print.c:555 -msgid "Rules never reduced" -msgstr "niemals reduzierte Regeln" - -#: src/reader.c:56 -#, c-format -msgid "multiple %s declarations" -msgstr "mehr als eine %s-Deklaration" - -#: src/reader.c:118 -#, c-format -msgid "result type clash on merge function %s: <%s> != <%s>" -msgstr "Rückgabetyp-Konflikt in merge-Funktion %s: <%s> != <%s>" - -#: src/reader.c:216 -#, c-format -msgid "rule given for %s, which is a token" -msgstr "Regel für %s vorhanden, welches aber ein Token ist" - -#: src/reader.c:245 -#, c-format -msgid "type clash on default action: <%s> != <%s>" -msgstr "Typkonflikt bei Default-Aktion: <%s> != <%s>) " - -#: src/reader.c:251 -msgid "empty rule for typed nonterminal, and no action" -msgstr "leere Regel für Nicht-Terminal mit Typ und keine Aktion" - -#: src/reader.c:321 src/reader.c:335 src/reader.c:348 -#, c-format -msgid "only one %s allowed per rule" -msgstr "nur ein %s pro Regel erlaubt" - -#: src/reader.c:331 src/reader.c:346 -#, c-format -msgid "%s affects only GLR parsers" -msgstr "%s betrifft nur GLR-Parser" - -#: src/reader.c:333 -#, c-format -msgid "%s must be followed by positive number" -msgstr "%s muss von positiver Zahl gefolgt sein" - -#: src/reader.c:490 -msgid "no rules in the input grammar" -msgstr "Eingabegrammatik enthält keine Regeln" - -#: src/reduce.c:242 -msgid "useless rule" -msgstr "nutzlose Regel" - -#: src/reduce.c:303 -#, c-format -msgid "useless nonterminal: %s" -msgstr "nutzloses Nicht-Terminal: %s" - -#: src/reduce.c:351 -msgid "Useless nonterminals" -msgstr "Nutzlose Nicht-Terminale" - -#: src/reduce.c:364 -msgid "Terminals which are not used" -msgstr "Nicht genutzte Terminale" - -#: src/reduce.c:373 -msgid "Useless rules" -msgstr "Nutzlose Regeln" - -#: src/reduce.c:389 -#, c-format -msgid "%d rule never reduced\n" -msgid_plural "%d rules never reduced\n" -msgstr[0] "%d Regel wurde niemals reduziert\n" -msgstr[1] "%d Regeln wurden niemals reduziert\n" - -#: src/reduce.c:397 -#, c-format -msgid "%d useless nonterminal" -msgid_plural "%d useless nonterminals" -msgstr[0] "%d nutzloses Nicht-Terminal" -msgstr[1] "%d nutzlose Nicht-Terminale" - -#: src/reduce.c:403 -#, c-format -msgid " and " -msgstr " und " - -#: src/reduce.c:406 -#, c-format -msgid "%d useless rule" -msgid_plural "%d useless rules" -msgstr[0] "%d nutzlose Regel" -msgstr[1] "%d nutzlose Regeln" - -#: src/reduce.c:436 -#, c-format -msgid "start symbol %s does not derive any sentence" -msgstr "es lassen sich keine Sätze vom Startsymbol %s ableiten" - -#: src/scan-gram.l:162 -msgid "stray `,' treated as white space" -msgstr "überzähliges »,« als Freiraum betrachtet" - -#: src/scan-gram.l:225 -#, c-format -msgid "invalid directive: %s" -msgstr "ungültige Direktive: %s" - -#: src/scan-gram.l:283 -#, c-format -msgid "invalid character: %s" -msgstr "ungültiges Zeichen: %s" - -#: src/scan-gram.l:402 -#, fuzzy -msgid "invalid null character" -msgstr "ungültiges Zeichen: %s" - -#: src/scan-gram.l:415 src/scan-gram.l:427 src/scan-gram.l:448 -#, c-format -msgid "invalid escape sequence: %s" -msgstr "unzulässiges Fluchtzeichen: %s" - -#: src/scan-gram.l:417 src/scan-gram.l:429 src/scan-gram.l:450 -#, fuzzy, c-format -msgid "invalid null character: %s" -msgstr "ungültiges Zeichen: %s" - -#: src/scan-gram.l:455 -#, c-format -msgid "unrecognized escape sequence: %s" -msgstr "unbekanntes Fluchtzeichen: %s" - -#: src/scan-gram.l:537 -#, c-format -msgid "missing `{' in `%s'" -msgstr "fehlende »{« in »%s«" - -#: src/scan-gram.l:782 -#, c-format -msgid "$$ of `%s' has no declared type" -msgstr "$$ von »%s« hat keinen deklarierten Typ" - -#: src/scan-gram.l:803 -#, c-format -msgid "$%d of `%s' has no declared type" -msgstr "$%d von »%s« hat keinen deklarierten Typ" - -#: src/scan-gram.l:812 src/scan-gram.l:881 src/scan-gram.l:932 -#, c-format -msgid "integer out of range: %s" -msgstr "Ganzzahl außerhalb des Wertebereichs: %s" - -#: src/scan-gram.l:848 src/scan-gram.l:916 -#, c-format -msgid "invalid value: %s" -msgstr "unzulässiger Wert: %s" - -#: src/scan-gram.l:1036 -#, c-format -msgid "missing `%s' at end of file" -msgstr "fehlendes »%s« am Ende der Datei" - -#: src/scan-gram.l:1047 -#, fuzzy, c-format -msgid "missing `%s' at end of line" -msgstr "fehlendes »%s« am Ende der Datei" - -#: src/symlist.c:97 src/symlist.c:108 -msgid "invalid $ value" -msgstr "unzulässiger $-Wert" - -#: src/symtab.c:85 -#, c-format -msgid "type redeclaration for %s" -msgstr "erneute Deklaration des Typs für %s" - -#: src/symtab.c:102 src/symtab.c:120 -#, c-format -msgid "%s redeclaration for %s" -msgstr "%s erneute Deklaration für %s" - -#: src/symtab.c:139 -#, c-format -msgid "redefining precedence of %s" -msgstr "Vorrang von %s wird erneut definiert" - -#: src/symtab.c:157 -#, c-format -msgid "symbol %s redefined" -msgstr "Symbol %s noch einmal definiert" - -#: src/symtab.c:180 -#, c-format -msgid "redefining user token number of %s" -msgstr "Nutzertokennummer von %s erneut definiert" - -#: src/symtab.c:207 -#, c-format -msgid "symbol %s is used, but is not defined as a token and has no rules" -msgstr "" -"Symbol %s wird benutzt, ist aber nicht als Token definiert und hat keine " -"Regel" - -#: src/symtab.c:232 -#, c-format -msgid "symbol `%s' used more than once as a literal string" -msgstr "Symbol »%s« wird mehr als einmal als literale Zeichenkette benutzt" - -#: src/symtab.c:235 -#, c-format -msgid "symbol `%s' given more than one literal string" -msgstr "Symbol »%s« wird mehr als eine literale Zeichenkette gegeben" - -#: src/symtab.c:271 -#, c-format -msgid "conflicting precedences for %s and %s" -msgstr "Vorrang für %s und %s widersprechen sich" - -#: src/symtab.c:283 -#, c-format -msgid "conflicting associativities for %s (%s) and %s (%s)" -msgstr "Assoziativitäts-Werte für %s (%s) und %s (%s) widersprechen sich" - -#: src/symtab.c:368 -#, c-format -msgid "tokens %s and %s both assigned number %d" -msgstr "Token %s und %s haben die selbe Nummer %d" - -#: src/symtab.c:591 -#, c-format -msgid "the start symbol %s is undefined" -msgstr "das Startsymbol %s ist undefiniert" - -#: src/symtab.c:595 -#, c-format -msgid "the start symbol %s is a token" -msgstr "das Startsymbol %s ist ein Token" - -#: lib/argmatch.c:133 -#, c-format -msgid "invalid argument %s for %s" -msgstr "unzulässiges Argument %s für %s" - -#: lib/argmatch.c:134 -#, c-format -msgid "ambiguous argument %s for %s" -msgstr "mehrdeutiges Argument %s für %s" - -#: lib/argmatch.c:153 -#, c-format -msgid "Valid arguments are:" -msgstr "Gültige Argumente sind:" - -#: lib/bitset_stats.c:179 -#, c-format -msgid "%u bitset_allocs, %u freed (%.2f%%).\n" -msgstr "%u bitset_allocs, %u freigegeben (%.2f%%).\n" - -#: lib/bitset_stats.c:182 -#, c-format -msgid "%u bitset_sets, %u cached (%.2f%%)\n" -msgstr "%u bitset_sets, %u zwischengespeichert (%.2f%%)\n" - -#: lib/bitset_stats.c:185 -#, c-format -msgid "%u bitset_resets, %u cached (%.2f%%)\n" -msgstr "%u bitset_resets, %u zwischengespeichert (%.2f%%)\n" - -#: lib/bitset_stats.c:188 -#, c-format -msgid "%u bitset_tests, %u cached (%.2f%%)\n" -msgstr "%u bitset_tests, %u zwischengespeichert (%.2f%%)\n" - -#: lib/bitset_stats.c:192 -#, c-format -msgid "%u bitset_lists\n" -msgstr "%u bitset_lists\n" - -#: lib/bitset_stats.c:194 -msgid "count log histogram\n" -msgstr "Zähler-Histogramm\n" - -#: lib/bitset_stats.c:197 -msgid "size log histogram\n" -msgstr "Größe-Histogramm\n" - -#: lib/bitset_stats.c:200 -msgid "density histogram\n" -msgstr "Dichte-Histogramm\n" - -#: lib/bitset_stats.c:214 -#, c-format -msgid "" -"Bitset statistics:\n" -"\n" -msgstr "" -"Bitset-Statistiken:\n" -"\n" - -#: lib/bitset_stats.c:217 -#, c-format -msgid "Accumulated runs = %u\n" -msgstr "Gesammelte Durchläufe = %u\n" - -#: lib/bitset_stats.c:261 lib/bitset_stats.c:266 -msgid "Could not read stats file." -msgstr "Konnte Statistik-Datei nicht lesen." - -#: lib/bitset_stats.c:263 -#, c-format -msgid "Bad stats file size.\n" -msgstr "Ungültige Statistik-Datei-Größe.\n" - -#: lib/bitset_stats.c:289 lib/bitset_stats.c:291 -msgid "Could not write stats file." -msgstr "Konnte Statistik-Datei nicht schreiben." - -#: lib/bitset_stats.c:294 -msgid "Could not open stats file for writing." -msgstr "Konnte Statistik-Datei nicht zum Schreiben öffnen." - -#: lib/error.c:127 -msgid "Unknown system error" -msgstr "Unbekannter Systemfehler" - -#: lib/getopt.c:570 lib/getopt.c:589 -#, c-format -msgid "%s: option `%s' is ambiguous\n" -msgstr "%s: Option »%s« ist mehrdeutig\n" - -#: lib/getopt.c:622 lib/getopt.c:626 -#, c-format -msgid "%s: option `--%s' doesn't allow an argument\n" -msgstr "%s: Option »--%s« erlaubt kein Argument\n" - -#: lib/getopt.c:635 lib/getopt.c:640 -#, c-format -msgid "%s: option `%c%s' doesn't allow an argument\n" -msgstr "%s: Option »%c%s« erlaubt kein Argument\n" - -#: lib/getopt.c:686 lib/getopt.c:708 lib/getopt.c:1039 lib/getopt.c:1061 -#, c-format -msgid "%s: option `%s' requires an argument\n" -msgstr "%s: Option »%s« erfordert ein Argument\n" - -#: lib/getopt.c:746 lib/getopt.c:749 -#, c-format -msgid "%s: unrecognized option `--%s'\n" -msgstr "%s: unbekannte Option »--%s«\n" - -#: lib/getopt.c:757 lib/getopt.c:760 -#, c-format -msgid "%s: unrecognized option `%c%s'\n" -msgstr "%s: unbekannte Option »%c%s«\n" - -#: lib/getopt.c:815 lib/getopt.c:818 -#, c-format -msgid "%s: illegal option -- %c\n" -msgstr "%s: ungültige Option -- %c\n" - -#: lib/getopt.c:824 lib/getopt.c:827 -#, c-format -msgid "%s: invalid option -- %c\n" -msgstr "%s: ungültige Option -- %c\n" - -#: lib/getopt.c:882 lib/getopt.c:901 lib/getopt.c:1114 lib/getopt.c:1135 -#, c-format -msgid "%s: option requires an argument -- %c\n" -msgstr "%s: Option erfordert ein Argument -- %c\n" - -#: lib/getopt.c:954 lib/getopt.c:973 -#, c-format -msgid "%s: option `-W %s' is ambiguous\n" -msgstr "%s: Option »-W %s« ist mehrdeutig\n" - -#: lib/getopt.c:997 lib/getopt.c:1018 -#, c-format -msgid "%s: option `-W %s' doesn't allow an argument\n" -msgstr "%s: Option »-W %s« erlaubt kein Argument\n" - -#: lib/obstack.c:417 lib/obstack.c:420 lib/xmalloc.c:53 -msgid "memory exhausted" -msgstr "Speicher ausgeschöpft" - -#: lib/quotearg.c:238 -msgid "`" -msgstr "»" - -#: lib/quotearg.c:239 -msgid "'" -msgstr "«" - -#: lib/subpipe.c:171 -#, c-format -msgid "subsidiary program `%s' could not be invoked" -msgstr "untergeordnetes Programm »%s« konnte nicht aufgerufen werden" - -#: lib/subpipe.c:173 -#, c-format -msgid "subsidiary program `%s' not found" -msgstr "untergeordnetes Programm »%s« nicht gefunden" - -#: lib/subpipe.c:175 -#, c-format -msgid "subsidiary program `%s' failed" -msgstr "untergeordnetes Programm »%s« fehlgeschlagen" - -#: lib/subpipe.c:176 -#, c-format -msgid "subsidiary program `%s' failed (exit status %d)" -msgstr "untergeordnetes Programm »%s« fehlgeschlagen (Rückgabewert %d)" - -#: lib/timevar.c:475 -msgid "" -"\n" -"Execution times (seconds)\n" -msgstr "" -"\n" -"Ausführungszeiten (Sekunden)\n" - -#: lib/timevar.c:525 -msgid " TOTAL :" -msgstr " ZUSAMMEN :" - -#: lib/timevar.c:561 -#, c-format -msgid "time in %s: %ld.%06ld (%ld%%)\n" -msgstr "Zeit in %s: %ld.%06ld (%ld%%)\n" - -#~ msgid "%d shift/reduce conflict" -#~ msgid_plural "%d shift/reduce conflicts" -#~ msgstr[0] "%d Schiebe/Reduziere-Konflikt" -#~ msgstr[1] "%d Schiebe/Reduziere-Konflikte" - -#~ msgid "and" -#~ msgstr "und" - -#~ msgid "conflicts: " -#~ msgstr "Konflikte: " - -#~ msgid "State %d contains " -#~ msgstr "Zustand %d enthält " - -#~ msgid "too many gotos (max %d)" -#~ msgstr "zu viele Gotos (max %d)" - -#~ msgid "too many symbols (tokens plus nonterminals); maximum %d" -#~ msgstr "zu viele Symbole (Token plus Nicht-Terminale); Maximum %d" - -#~ msgid ": unexpected end of file in a comment\n" -#~ msgstr ": Datei endet unerwartet innerhalb eines Kommentars\n" - -#~ msgid ": unexpected end of file in a string\n" -#~ msgstr ": Datei endet unerwartet innerhalb einer Zeichenkette\n" - -#~ msgid ": unexpected end of file in a character\n" -#~ msgstr ": Datei endet unerwartet innerhalb eines Zeichens\n" - -#~ msgid ": unexpected end of file in a braced code\n" -#~ msgstr ": Datei endet unerwartet innerhalb geklammerten Programmtexts\n" - -#~ msgid ": unexpected end of file in a prologue\n" -#~ msgstr ": Datei endet unerwartet innerhalb eines Prologs\n" - -#~ msgid "%s is invalid" -#~ msgstr "%s ist unzulässig" - -#~ msgid "too many states (max %d)" -#~ msgstr "zu viele Zustände (max %d)" - -#~ msgid "%s: no grammar file given\n" -#~ msgstr "%s: keine Grammatik-Datei angegeben\n" - -#~ msgid "%s: extra arguments ignored after `%s'\n" -#~ msgstr "%s: zusätzliche Argumente nach »%s« werden ignoriert\n" - -#~ msgid "two @prec's in a row" -#~ msgstr "zwei @prec-Anweisungen nacheinander" - -#~ msgid "only one %%dprec allowed per rule" -#~ msgstr "nur ein %%dprec pro Regel erlaubt" - -#~ msgid "state_list_append (state = %d, symbol = %d (%s))\n" -#~ msgstr "state_list_append (Zustand = %d, Symbol = %d (%s))\n" - -#~ msgid "Entering new_itemsets, state = %d\n" -#~ msgstr "Betrete new_itemsets, Zustand = %d\n" - -#~ msgid "Entering get_state, symbol = %d (%s)\n" -#~ msgstr "Betrete get_state, Symbol = %d (%s)\n" - -#~ msgid "Exiting get_state => %d\n" -#~ msgstr "Verlasse get_state => %d\n" - -#~ msgid "Entering append_states, state = %d\n" -#~ msgstr "Betrete append_states, Zustand = %d\n" - -#~ msgid "Processing state %d (reached by %s)\n" -#~ msgstr "Verarbeite Zustand %d (erreicht von %s)\n" - -#~ msgid "undefined associativity" -#~ msgstr "undefinierte Assoziativität" - -#~ msgid "Closure: %s\n" -#~ msgstr "Abschluss: %s\n" - -#~ msgid " (rule %d)\n" -#~ msgstr " (Regel %d)\n" - -#~ msgid "input" -#~ msgstr "Eingabe" - -#~ msgid "output" -#~ msgstr "Ausgabe" - -#~ msgid "" -#~ "Variables\n" -#~ "---------\n" -#~ "\n" -#~ msgstr "" -#~ "Variablen\n" -#~ "---------\n" -#~ "\n" - -#~ msgid "Value Sprec Sassoc Tag\n" -#~ msgstr "Wert Spräz Sassoz Tag\n" - -#~ msgid "" -#~ "Rules\n" -#~ "-----\n" -#~ "\n" -#~ msgstr "" -#~ "Regeln\n" -#~ "-----\n" -#~ "\n" - -#~ msgid "" -#~ "Num (Prec, Assoc, Useful, Ritem Range) Lhs -> Rhs (Ritem range) [Num]\n" -#~ msgstr "" -#~ "Num (Präz, Assoz, Nützl., Ritem-Ber.) LS -> RS (Ritem-Ber.) [Num]\n" - -#~ msgid "" -#~ "Rules interpreted\n" -#~ "-----------------\n" -#~ "\n" -#~ msgstr "" -#~ "Regeln interpretiert\n" -#~ "-----------------\n" -#~ "\n" - -#~ msgid "Lookaheads: BEGIN\n" -#~ msgstr "Vorschau: ANFANG\n" - -#~ msgid "State %d: %d lookaheads\n" -#~ msgstr "Zustand %d: %d Vorschauen\n" - -#~ msgid " on %d (%s) -> rule %d\n" -#~ msgstr " auf %d (%s) -> Regel %d\n" - -#~ msgid "Lookaheads: END\n" -#~ msgstr "Vorschau: ENDE\n" - -#~ msgid "relation_transpose: input\n" -#~ msgstr "relation_transpose: Eingabe\n" - -#~ msgid "relation_transpose: output\n" -#~ msgstr "relation_transpose: Ausgabe\n" - -#~ msgid "reduce" -#~ msgstr "durch Reduzierung gelöst" - -#~ msgid "shift" -#~ msgstr "durch Schieben gelöst" - -#~ msgid "%s contains " -#~ msgstr "%s enthält " - -#~ msgid "`%s' is no longer supported" -#~ msgstr "»%s« wird nicht länger unterstützt" - -#~ msgid "unexpected `/' found and ignored" -#~ msgstr "»/« wird hier nicht erwartet und wird deshalb ignoriert" - -#~ msgid "unterminated comment" -#~ msgstr "unbeendeter Kommentar" - -#~ msgid "unescaped newline in constant" -#~ msgstr "nicht maskiertes Zeilenendezeichen in Konstante" - -#~ msgid "octal value outside range 0...255: `\\%o'" -#~ msgstr "oktaler Zahlenwert außerhalb des Bereichs 0...255: »\\%o«" - -#~ msgid "hexadecimal value above 255: `\\x%x'" -#~ msgstr "hexadezimaler Zahlenwert größer als 255: »\\x%x«" - -# Oder soll man den Begriff "Escapezeichen" verwenden? -#~ msgid "unknown escape sequence: `\\' followed by `%s'" -#~ msgstr "unbekanntes Escapezeichen: »\\« gefolgt von »%s«" - -#~ msgid "unterminated type name at end of file" -#~ msgstr "unerwarteter Typname am Ende der Datei" - -#~ msgid "unterminated type name" -#~ msgstr "unerwarteter Typname" - -#~ msgid "use \"...\" for multi-character literal tokens" -#~ msgstr "für Literal mit mehreren Zeichen bitte \"...\" verwenden" - -#~ msgid "`%s' supports no argument: %s" -#~ msgstr "»%s« unterstützt kein Argument: %s" - -#~ msgid "`%s' requires an argument" -#~ msgstr "die Option »%s« erfordert ein Argument" - -#~ msgid " %-4s\terror (nonassociative)\n" -#~ msgstr " %-4s\tFehler (nicht assoziativ)\n" - -#~ msgid "" -#~ " $default\treduce using rule %d (%s)\n" -#~ "\n" -#~ msgstr "" -#~ " $default\treduziere mit Regel %d (%s)\n" -#~ "\n" - -#~ msgid " %-4s\t[reduce using rule %d (%s)]\n" -#~ msgstr " %-4s\t[reduziere mit Regel %d (%s)]\n" - -#~ msgid " %-4s\treduce using rule %d (%s)\n" -#~ msgstr " %-4s\treduziere mit Regel %d (%s)\n" - -#~ msgid " $default\treduce using rule %d (%s)\n" -#~ msgstr " $default\treduziere mit Regel %d (%s)\n" - -#~ msgid " $default\taccept\n" -#~ msgstr " $default\takzeptiere\n" - -#~ msgid " NO ACTIONS\n" -#~ msgstr " KEINE AKTIONEN\n" - -#~ msgid "Number, Line, Rule" -#~ msgstr "Nummer, Zeile, Regel" - -#~ msgid " %3d %3d %s ->" -#~ msgstr " %3d %3d %s ->" - -#~ msgid " Skipping to next \\n" -#~ msgstr " Überspringe Zeichen bis zum nächsten \\n" - -#~ msgid " Skipping to next %c" -#~ msgstr " Überspringe Zeichen bis zum nächten %c" - -#~ msgid "unterminated string" -#~ msgstr "unbeendete Zeichenkette" - -#~ msgid "unterminated `%{' definition" -#~ msgstr "unbeendete »%{«-Definition" - -#~ msgid "Premature EOF after %s" -#~ msgstr "Vorzeitiges EOF nach %s" - -#~ msgid "`%s' is invalid in %s" -#~ msgstr "»%s« ist in %s nicht erlaubt" - -#~ msgid "invalid %s declaration" -#~ msgstr "ungültige %s-Deklaration" - -#~ msgid "%type declaration has no " -#~ msgstr "%type-Deklaration hat keinen " - -#~ msgid "invalid %%type declaration due to item: %s" -#~ msgstr "ungültige %%type-Deklaration wegen: %s" - -#~ msgid "invalid text (%s) - number should be after identifier" -#~ msgstr "unzulässiger Text (%s) - Zahl sollte nach Bezeichner kommen" - -#~ msgid "unexpected item: %s" -#~ msgstr "unerwartetes Symbol: %s" - -#~ msgid "unmatched %s" -#~ msgstr "%s ohne Gegenstück" - -#~ msgid "argument of %%expect is not an integer" -#~ msgstr "Argument von %%expect ist keine ganze Zahl" - -#~ msgid "unrecognized item %s, expected an identifier" -#~ msgstr "unerwartetes Symbol %s, hier wird ein Bezeichner erwartet" - -#~ msgid "expected string constant instead of %s" -#~ msgstr "hier wird eine Zeichenkette erwartet, nicht %s" - -#~ msgid "no input grammar" -#~ msgstr "keine Eingabe-Grammatik" - -#~ msgid "unknown character: %s" -#~ msgstr "unbekanntes Zeichen: %s" - -#~ msgid "ill-formed rule: initial symbol not followed by colon" -#~ msgstr "" -#~ "falsch geformte Regel: führendes Symbol wird nicht von einem Semikolon " -#~ "gefolgt" - -#~ msgid "grammar starts with vertical bar" -#~ msgstr "Grammatik fängt mit einem vertikalen Strich (»|«) an" - -#~ msgid "previous rule lacks an ending `;'" -#~ msgstr "vorangehende Regel hat kein abschließendes »;«" - -#~ msgid "%%guard present but %%semantic_parser not specified" -#~ msgstr "" -#~ "%%guard-Anweisung vorhanden, jedoch wird %%semantic_parser nicht angegeben" - -#~ msgid "two actions at end of one rule" -#~ msgstr "Zwei Aktionen am Ende einer Regel" - -#~ msgid "maximum table size (%d) exceeded" -#~ msgstr "maximale Tabellengröße (%d) überschritten" - -#~ msgid " $ \tgo to state %d\n" -#~ msgstr " $ \tgehe zu Zustand %d über\n" - -#~ msgid "unterminated %guard clause" -#~ msgstr "unbeendeter %guard-Fall" diff --git a/src/bin/bison/po/en@boldquot.header b/src/bin/bison/po/en@boldquot.header deleted file mode 100644 index fedb6a06d1..0000000000 --- a/src/bin/bison/po/en@boldquot.header +++ /dev/null @@ -1,25 +0,0 @@ -# All this catalog "translates" are quotation characters. -# The msgids must be ASCII and therefore cannot contain real quotation -# characters, only substitutes like grave accent (0x60), apostrophe (0x27) -# and double quote (0x22). These substitutes look strange; see -# http://www.cl.cam.ac.uk/~mgk25/ucs/quotes.html -# -# This catalog translates grave accent (0x60) and apostrophe (0x27) to -# left single quotation mark (U+2018) and right single quotation mark (U+2019). -# It also translates pairs of apostrophe (0x27) to -# left single quotation mark (U+2018) and right single quotation mark (U+2019) -# and pairs of quotation mark (0x22) to -# left double quotation mark (U+201C) and right double quotation mark (U+201D). -# -# When output to an UTF-8 terminal, the quotation characters appear perfectly. -# When output to an ISO-8859-1 terminal, the single quotation marks are -# transliterated to apostrophes (by iconv in glibc 2.2 or newer) or to -# grave/acute accent (by libiconv), and the double quotation marks are -# transliterated to 0x22. -# When output to an ASCII terminal, the single quotation marks are -# transliterated to apostrophes, and the double quotation marks are -# transliterated to 0x22. -# -# This catalog furthermore displays the text between the quotation marks in -# bold face, assuming the VT100/XTerm escape sequences. -# diff --git a/src/bin/bison/po/en@quot.header b/src/bin/bison/po/en@quot.header deleted file mode 100644 index a9647fc35c..0000000000 --- a/src/bin/bison/po/en@quot.header +++ /dev/null @@ -1,22 +0,0 @@ -# All this catalog "translates" are quotation characters. -# The msgids must be ASCII and therefore cannot contain real quotation -# characters, only substitutes like grave accent (0x60), apostrophe (0x27) -# and double quote (0x22). These substitutes look strange; see -# http://www.cl.cam.ac.uk/~mgk25/ucs/quotes.html -# -# This catalog translates grave accent (0x60) and apostrophe (0x27) to -# left single quotation mark (U+2018) and right single quotation mark (U+2019). -# It also translates pairs of apostrophe (0x27) to -# left single quotation mark (U+2018) and right single quotation mark (U+2019) -# and pairs of quotation mark (0x22) to -# left double quotation mark (U+201C) and right double quotation mark (U+201D). -# -# When output to an UTF-8 terminal, the quotation characters appear perfectly. -# When output to an ISO-8859-1 terminal, the single quotation marks are -# transliterated to apostrophes (by iconv in glibc 2.2 or newer) or to -# grave/acute accent (by libiconv), and the double quotation marks are -# transliterated to 0x22. -# When output to an ASCII terminal, the single quotation marks are -# transliterated to apostrophes, and the double quotation marks are -# transliterated to 0x22. -# diff --git a/src/bin/bison/po/es.gmo b/src/bin/bison/po/es.gmo deleted file mode 100644 index ec44b4e3b9..0000000000 Binary files a/src/bin/bison/po/es.gmo and /dev/null differ diff --git a/src/bin/bison/po/es.po b/src/bin/bison/po/es.po deleted file mode 100644 index 21e6ecd37a..0000000000 --- a/src/bin/bison/po/es.po +++ /dev/null @@ -1,1048 +0,0 @@ -# Mensajes en español para GNU Bison. -# Copyright (C) 1998 Free Software Foundation, Inc. -# Nicolás García-Pedrajas , 1998. -# -# Corregido por: -# -# cll - Carlos Linares López clinares@acm.org -# clinares@delicias.dia.fi.upm.es -# -# Notas: -# -# 1. Nicolás, en algunas ocasiones notarás que algunos `msgstr' no están -# indentados como los `msgid'. No te preocupes, eso es porque yo utilizo -# el `po-mode' de Emacs, ... Él es el responsable de esas indentaciones -# del `msgstr' :) -# -# 2. Todos los comentarios que contengan "Duda:" debieran revisarse. -# -# -------------------------------------------------------------------- -# En mi opinión has hecho un excelente trabajo y te animo a que sigas -# manteniendo esta traducción y a que lo intentes con otras. -# -# (¡te lo dice el tío que ha traducido el paquete más grande: 1406 -# mensajes en el clisp!) -# -# Carlos Linares -# -------------------------------------------------------------------- -# -msgid "" -msgstr "" -"Project-Id-Version: GNU bison 1.875\n" -"Report-Msgid-Bugs-To: bug-bison@gnu.org\n" -"POT-Creation-Date: 2004-05-21 10:26-0700\n" -"PO-Revision-Date: 2003-01-02 12:47+0100\n" -"Last-Translator: Nicolás García-Pedrajas \n" -"Language-Team: Spanish \n" -"MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=ISO-8859-1\n" -"Content-Transfer-Encoding: 8-bit\n" -"Plural-Forms: nplurals=2; plural=(n != 1);\n" - -#: src/complain.c:51 src/complain.c:66 -msgid "warning: " -msgstr "aviso: " - -# Duda: desconozco cuál será el convenio en la lista de correo a -# propósito de "fatal". Por favor, comprueba que "error grave" es -# preferido por todos los miembros a "error fatal" - cll -# veremos que dice la mayoría, como hay otros 2 revisores -# La verdad es que a mi lo de error fatal me suena fatal -# ngp -# -#: src/complain.c:122 src/complain.c:138 -msgid "fatal error: " -msgstr "error grave: " - -#: src/conflicts.c:76 -#, c-format -msgid " Conflict between rule %d and token %s resolved as shift" -msgstr "" -" El conflicto entre la regla %d y el terminal %s se resuelve como " -"desplazamiento." - -#: src/conflicts.c:84 -#, c-format -msgid " Conflict between rule %d and token %s resolved as reduce" -msgstr "" -" El conflicto entre la regla %d y el terminal %s se resuelve como " -"reducción." - -#: src/conflicts.c:91 -#, c-format -msgid " Conflict between rule %d and token %s resolved as an error" -msgstr "" -" El conflicto entre la regla %d y el terminal %s se resuelve como un " -"error." - -#: src/conflicts.c:399 -#, c-format -msgid "conflicts: %d shift/reduce, %d reduce/reduce\n" -msgstr "conflictos: %d desplazamiento/reducción, %d reducción/reducción\n" - -# Date cuenta de que `%d' puede ser cualquier número decimal. Podría -# ocurrir, por lo tanto, que tu mensaje en ejecución se vea luego como: -# -# 23845789243789 desplazamiento/reducción -# -# (¡estoy exagerando!, por supuesto :) -# -# Te sugiero por lo tanto que añadas el caso (s) tal y como se hace en -# español habitualmente. -# ok -# ngp -# -#: src/conflicts.c:402 -#, c-format -msgid "conflicts: %d shift/reduce\n" -msgstr "conflictos: %d desplazamiento(s)/reducción(ones)\n" - -# Date cuenta de que `%d' puede ser cualquier número decimal. Podría -# ocurrir, por lo tanto, que tu mensaje en ejecución se vea luego como: -# -# 23845789243789 reducción/reducción -# -# (¡estoy exagerando!, por supuesto :) -# -# Te sugiero por lo tanto que añadas el caso (s) tal y como se hace en -# español habitualmente. -# -# ok -# ngp -#: src/conflicts.c:404 -#, c-format -msgid "conflicts: %d reduce/reduce\n" -msgstr "conflictos: %d reducción(ones)/reducción(ones)\n" - -#: src/conflicts.c:422 -#, c-format -msgid "State %d " -msgstr "Estado %d " - -#: src/conflicts.c:487 -#, fuzzy, c-format -msgid "%%expect-rr applies only to GLR parsers" -msgstr "%s afecta sólo a los analizadores GLR" - -#: src/conflicts.c:511 -#, c-format -msgid "expected %d shift/reduce conflict" -msgid_plural "expected %d shift/reduce conflicts" -msgstr[0] "esperado %d conflicto desplazamiento/reducción" -msgstr[1] "esperados %d conflictos desplazamiento/reducción" - -#: src/conflicts.c:515 -#, fuzzy, c-format -msgid "expected %d reduce/reduce conflict" -msgid_plural "expected %d reduce/reduce conflicts" -msgstr[0] "esperados 0 conflictos reducción/reducción" -msgstr[1] "esperados 0 conflictos reducción/reducción" - -#: src/files.c:100 -#, c-format -msgid "cannot open file `%s'" -msgstr "no se puede abrir el fichero `%s'" - -#: src/files.c:116 -msgid "I/O error" -msgstr "Error de E/S" - -#: src/files.c:119 -msgid "cannot close file" -msgstr "no se puede cerrar el fichero" - -#: src/files.c:337 -#, c-format -msgid "conflicting outputs to file %s" -msgstr "salidas en conflicto al fichero %s" - -#: src/getargs.c:186 -#, c-format -msgid "Try `%s --help' for more information.\n" -msgstr "Pruebe `%s --help' para más información.\n" - -#: src/getargs.c:192 -msgid "GNU bison generates parsers for LALR(1) grammars.\n" -msgstr "GNU bison genera analizadores para gramáticas LALR(1).\n" - -#: src/getargs.c:196 -#, c-format -msgid "Usage: %s [OPTION]... FILE\n" -msgstr "Utilización: %s [OPCIÓN]... FICHERO\n" - -#: src/getargs.c:200 -msgid "" -"If a long option shows an argument as mandatory, then it is mandatory\n" -"for the equivalent short option also. Similarly for optional arguments.\n" -msgstr "" -"Si una opción larga muestra un argumento como obligatorio, entonces es " -"obligatorio\n" -"para la opción corta equivalente también. De igual forma para los argumentos " -"opcionales.\n" - -#: src/getargs.c:206 -msgid "" -"Operation modes:\n" -" -h, --help display this help and exit\n" -" -V, --version output version information and exit\n" -" -y, --yacc emulate POSIX yacc\n" -msgstr "" -"Modos de operación:\n" -" -h, --help muestra esta ayuda y termina\n" -" -V, --version informa de la versión y termina\n" -" -y, --yacc emula POSIX yacc\n" - -#: src/getargs.c:213 -msgid "" -"Parser:\n" -" -S, --skeleton=FILE specify the skeleton to use\n" -" -t, --debug instrument the parser for debugging\n" -" --locations enable locations computation\n" -" -p, --name-prefix=PREFIX prepend PREFIX to the external symbols\n" -" -l, --no-lines don't generate `#line' directives\n" -" -n, --no-parser generate the tables only\n" -" -k, --token-table include a table of token names\n" -msgstr "" -"Analizador:\n" -" -S, --skeleton=FICHERO especifica el skeleton a utilizar\n" -" -t, --debug instrumenta al analizador para depuración\n" -" --locations abilita la computación de localizaciones\n" -" -p, --name-prefix=PREFIJO preañade PREFIJO a los símbolos externos\n" -" -l, --no-lines no genera la directiva `#line'\n" -" -n, --no-parser solamente genera las tablas\n" -" --k, --token-table incluye una tabla de nombres de terminales\n" - -#: src/getargs.c:225 -msgid "" -"Output:\n" -" -d, --defines also produce a header file\n" -" -r, --report=THINGS also produce details on the automaton\n" -" -v, --verbose same as `--report=state'\n" -" -b, --file-prefix=PREFIX specify a PREFIX for output files\n" -" -o, --output=FILE leave output to FILE\n" -" -g, --graph also produce a VCG description of the " -"automaton\n" -msgstr "" -"Salida:\n" -" -d, --defines también produce un fichero de cabecera\n" -" -r, --report=THINGS también produce detalles del automaton\n" -" -v, --verbose también produce una explicación del automaton\n" -" -b, --file-prefix=PREFIJO especifia el PREFIJO para los ficheros de " -"salida\n" -" -o, --output=FICHERO almacena la salida en FICHERO\n" -" -g, --graph también produce una descripción en VCG del " -"automaton\n" - -#: src/getargs.c:236 -msgid "" -"THINGS is a list of comma separated words that can include:\n" -" `state' describe the states\n" -" `itemset' complete the core item sets with their closure\n" -" `lookahead' explicitly associate lookaheads to items\n" -" `solved' describe shift/reduce conflicts solving\n" -" `all' include all the above information\n" -" `none' disable the report\n" -msgstr "" -"THINGS es una lista de palabras separadas por comas que puede incluir:\n" -" `state' describe los estados\n" -" `itemset' completa los conjuntos de ítems núcleo con sus cierres\n" -" `lookahead' asocia explícitamente lookaheads a los ítems\n" -" `solved' describe la resolución de los conflictos desplazamiento/" -"reducción\n" -" `all' incluye toda la información anterior\n" -" `none' disable the report\n" - -#: src/getargs.c:247 -msgid "Report bugs to .\n" -msgstr "Informe de los errores a .\n" - -#: src/getargs.c:264 -#, c-format -msgid "bison (GNU Bison) %s" -msgstr "bison (GNU bison) %s" - -#: src/getargs.c:266 -msgid "Written by Robert Corbett and Richard Stallman.\n" -msgstr "Escrito por Robert Corbett y Richard Stallman.\n" - -#: src/getargs.c:270 -#, c-format -msgid "Copyright (C) %d Free Software Foundation, Inc.\n" -msgstr "Copyright (C) %d Free Software Foundation, Inc.\n" - -#: src/getargs.c:272 -msgid "" -"This is free software; see the source for copying conditions. There is NO\n" -"warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n" -msgstr "" -"Esto es software libre; mire el fuente para las condiciones de copia. No " -"hay\n" -"NINGUNA garantía; ni siquiera para COMERCIALIZACIÓN o ADAPTACIÓN PARA UN\n" -"USO PARTICULAR\n" - -#: src/getargs.c:438 -#, c-format -msgid "missing operand after `%s'" -msgstr "falta un operando después de `%s'" - -#: src/getargs.c:440 -#, c-format -msgid "extra operand `%s'" -msgstr "operando extra `%s'" - -#: src/gram.c:139 -msgid "empty" -msgstr "vacío" - -#: src/gram.c:233 -msgid "Grammar" -msgstr "Gramática" - -#: src/gram.c:321 src/reduce.c:394 -msgid "warning" -msgstr "aviso" - -#: src/main.c:124 -msgid "rule never reduced because of conflicts" -msgstr "la regla nunca se redujo debido a los conflictos" - -#: src/parse-gram.y:363 -msgid "POSIX forbids declarations in the grammar" -msgstr "POSIX prohíbe declaraciones en a gramática" - -#: src/parse-gram.y:486 -msgid "missing identifier in parameter declaration" -msgstr "falta el identificador el la declaración del parámetro" - -#: src/print.c:49 -#, c-format -msgid " type %d is %s\n" -msgstr " el tipo %d es %s\n" - -#: src/print.c:165 -#, c-format -msgid "shift, and go to state %d\n" -msgstr "desplazar e ir al estado %d\n" - -#: src/print.c:167 -#, c-format -msgid "go to state %d\n" -msgstr "ir al estado %d\n" - -#: src/print.c:204 -msgid "error (nonassociative)\n" -msgstr "error (no asociativo)\n" - -#: src/print.c:292 -#, c-format -msgid "reduce using rule %d (%s)" -msgstr "reduce usando la regla %d (%s)" - -#: src/print.c:294 -#, c-format -msgid "accept" -msgstr "aceptar" - -#: src/print.c:325 src/print.c:391 -msgid "$default" -msgstr "$default" - -#: src/print.c:420 -#, c-format -msgid "state %d" -msgstr "estado %d" - -#: src/print.c:456 -msgid "Terminals, with rules where they appear" -msgstr "Terminales con las reglas donde aparecen" - -#: src/print.c:483 -msgid "Nonterminals, with rules where they appear" -msgstr "No terminales con las reglas donde aparecen" - -#: src/print.c:512 -#, c-format -msgid " on left:" -msgstr " en la izquierda:" - -#: src/print.c:527 -#, c-format -msgid " on right:" -msgstr " en la derecha:" - -#: src/print.c:555 -msgid "Rules never reduced" -msgstr "Reglas nunca reducidas" - -#: src/reader.c:56 -#, c-format -msgid "multiple %s declarations" -msgstr "múltiples declaraciones de %s" - -#: src/reader.c:118 -#, c-format -msgid "result type clash on merge function %s: <%s> != <%s>" -msgstr "tipo resultado incompatible en la función combinada %s: <%s> != <%s>" - -#: src/reader.c:216 -#, c-format -msgid "rule given for %s, which is a token" -msgstr "se ha dado una regla para %s, que es un terminal" - -#: src/reader.c:245 -#, c-format -msgid "type clash on default action: <%s> != <%s>" -msgstr "incompatibilidad de tipos en la acción por defecto: <%s> != <%s>" - -#: src/reader.c:251 -msgid "empty rule for typed nonterminal, and no action" -msgstr "regla vacía para un no terminal con tipo y no hay ninguna acción" - -#: src/reader.c:321 src/reader.c:335 src/reader.c:348 -#, c-format -msgid "only one %s allowed per rule" -msgstr "sólo se permite un %s por regla" - -#: src/reader.c:331 src/reader.c:346 -#, c-format -msgid "%s affects only GLR parsers" -msgstr "%s afecta sólo a los analizadores GLR" - -#: src/reader.c:333 -#, c-format -msgid "%s must be followed by positive number" -msgstr "%s debe estar seguido por un número positivo" - -#: src/reader.c:490 -msgid "no rules in the input grammar" -msgstr "no hay reglas en la gramática de entrada" - -#: src/reduce.c:242 -msgid "useless rule" -msgstr "regla sin uso" - -#: src/reduce.c:303 -#, c-format -msgid "useless nonterminal: %s" -msgstr "No terminal sin uso: %s" - -#: src/reduce.c:351 -msgid "Useless nonterminals" -msgstr "No terminales sin uso" - -#: src/reduce.c:364 -msgid "Terminals which are not used" -msgstr "Terminales que no se usan" - -#: src/reduce.c:373 -msgid "Useless rules" -msgstr "Reglas sin uso" - -#: src/reduce.c:389 -#, c-format -msgid "%d rule never reduced\n" -msgid_plural "%d rules never reduced\n" -msgstr[0] "%d regla que nunca se ha reducido\n" -msgstr[1] "%d reglas que nunca se han reducido\n" - -#: src/reduce.c:397 -#, c-format -msgid "%d useless nonterminal" -msgid_plural "%d useless nonterminals" -msgstr[0] "%d no terminal sin uso" -msgstr[1] "%d no terminales sin uso" - -#: src/reduce.c:403 -#, c-format -msgid " and " -msgstr " y " - -#: src/reduce.c:406 -#, c-format -msgid "%d useless rule" -msgid_plural "%d useless rules" -msgstr[0] "%d regla sin uso" -msgstr[1] "%d reglas sin uso" - -#: src/reduce.c:436 -#, c-format -msgid "start symbol %s does not derive any sentence" -msgstr "El símbolo de inicio (axioma) %s no deriva ninguna sentencia" - -#: src/scan-gram.l:162 -msgid "stray `,' treated as white space" -msgstr "`,' perdido se trato como un espacio en blanco" - -#: src/scan-gram.l:225 -#, c-format -msgid "invalid directive: %s" -msgstr "directiva no válida: %s" - -#: src/scan-gram.l:283 -#, c-format -msgid "invalid character: %s" -msgstr "carácter no válido: %s" - -#: src/scan-gram.l:402 -#, fuzzy -msgid "invalid null character" -msgstr "carácter no válido: %s" - -#: src/scan-gram.l:415 src/scan-gram.l:427 src/scan-gram.l:448 -#, c-format -msgid "invalid escape sequence: %s" -msgstr "secuencia de escape no válida: %s" - -#: src/scan-gram.l:417 src/scan-gram.l:429 src/scan-gram.l:450 -#, fuzzy, c-format -msgid "invalid null character: %s" -msgstr "carácter no válido: %s" - -#: src/scan-gram.l:455 -#, c-format -msgid "unrecognized escape sequence: %s" -msgstr "secuencia de escape no reconocida: %s" - -#: src/scan-gram.l:537 -#, c-format -msgid "missing `{' in `%s'" -msgstr "falta `{' en `%s'" - -#: src/scan-gram.l:782 -#, c-format -msgid "$$ of `%s' has no declared type" -msgstr "$$ de `%s' no tiene tipo declarado" - -#: src/scan-gram.l:803 -#, c-format -msgid "$%d of `%s' has no declared type" -msgstr "$%d de `%s' no tiene tipo declarado" - -#: src/scan-gram.l:812 src/scan-gram.l:881 src/scan-gram.l:932 -#, c-format -msgid "integer out of range: %s" -msgstr "entero fuera de rango: %s" - -#: src/scan-gram.l:848 src/scan-gram.l:916 -#, c-format -msgid "invalid value: %s" -msgstr "valor no válido: %s" - -#: src/scan-gram.l:1036 -#, c-format -msgid "missing `%s' at end of file" -msgstr "falta cadena `%s' al final del fichero" - -#: src/scan-gram.l:1047 -#, fuzzy, c-format -msgid "missing `%s' at end of line" -msgstr "falta cadena `%s' al final del fichero" - -#: src/symlist.c:97 src/symlist.c:108 -msgid "invalid $ value" -msgstr "valor $ no válido" - -#: src/symtab.c:85 -#, c-format -msgid "type redeclaration for %s" -msgstr "redeclaración del tipo de %s" - -#: src/symtab.c:102 src/symtab.c:120 -#, c-format -msgid "%s redeclaration for %s" -msgstr "%s redeclaración de %s" - -#: src/symtab.c:139 -#, c-format -msgid "redefining precedence of %s" -msgstr "redefinición de la precedencia de %s" - -#: src/symtab.c:157 -#, c-format -msgid "symbol %s redefined" -msgstr "redefinido el símbolo %s" - -#: src/symtab.c:180 -#, c-format -msgid "redefining user token number of %s" -msgstr "redefinición del número del terminal del usuario de %s" - -# `token' se debe traducir como `literal' - cll -# en terminología de compiladores token es más un terminal - ngp -# -#: src/symtab.c:207 -#, c-format -msgid "symbol %s is used, but is not defined as a token and has no rules" -msgstr "" -"se usa el símbolo %s, pero no está definido como terminal y no tiene reglas" - -#: src/symtab.c:232 -#, c-format -msgid "symbol `%s' used more than once as a literal string" -msgstr "símbolo `%s' utilizado más de una vez como cadena literal" - -#: src/symtab.c:235 -#, c-format -msgid "symbol `%s' given more than one literal string" -msgstr "al símbolo `%s' se le ha dado más de una cadena literal" - -#: src/symtab.c:271 -#, c-format -msgid "conflicting precedences for %s and %s" -msgstr "precedencias en conflicto entre %s y %s" - -#: src/symtab.c:283 -#, c-format -msgid "conflicting associativities for %s (%s) and %s (%s)" -msgstr "conflicto de asociaciatividades para %s (%s) y %s (%s)" - -#: src/symtab.c:368 -#, c-format -msgid "tokens %s and %s both assigned number %d" -msgstr "los terminales %s y %s tienen asignados ambos el número %d" - -#: src/symtab.c:591 -#, c-format -msgid "the start symbol %s is undefined" -msgstr "el símbolo de inicio (axioma) %s no está definido" - -#: src/symtab.c:595 -#, c-format -msgid "the start symbol %s is a token" -msgstr "el símbolo de inicio (axioma) %s es un terminal" - -#: lib/argmatch.c:133 -#, c-format -msgid "invalid argument %s for %s" -msgstr "argumento no válido %s para %s" - -#: lib/argmatch.c:134 -#, c-format -msgid "ambiguous argument %s for %s" -msgstr "argumento %s ambigüo para %s" - -#: lib/argmatch.c:153 -#, c-format -msgid "Valid arguments are:" -msgstr "Los argumentos válidos son:" - -#: lib/bitset_stats.c:179 -#, c-format -msgid "%u bitset_allocs, %u freed (%.2f%%).\n" -msgstr "%u bitset_allocs, %u liberados (%.2f%%).\n" - -#: lib/bitset_stats.c:182 -#, c-format -msgid "%u bitset_sets, %u cached (%.2f%%)\n" -msgstr "%u bitset_sets, %u en la caché (%.2f%%)\n" - -#: lib/bitset_stats.c:185 -#, c-format -msgid "%u bitset_resets, %u cached (%.2f%%)\n" -msgstr "%u bitset_resets, %u en la caché (%.2f%%)\n" - -#: lib/bitset_stats.c:188 -#, c-format -msgid "%u bitset_tests, %u cached (%.2f%%)\n" -msgstr "%u bitset_tests, %u en la caché (%.2f%%)\n" - -#: lib/bitset_stats.c:192 -#, c-format -msgid "%u bitset_lists\n" -msgstr "%u bitset_lists\n" - -#: lib/bitset_stats.c:194 -msgid "count log histogram\n" -msgstr "histograma del registro de conteo\n" - -#: lib/bitset_stats.c:197 -msgid "size log histogram\n" -msgstr "histograma del registro de tamaño\n" - -#: lib/bitset_stats.c:200 -msgid "density histogram\n" -msgstr "histograma de densidad\n" - -#: lib/bitset_stats.c:214 -#, c-format -msgid "" -"Bitset statistics:\n" -"\n" -msgstr "Estadísticas de bitset\n" - -#: lib/bitset_stats.c:217 -#, c-format -msgid "Accumulated runs = %u\n" -msgstr "Ejecuciones acumuladas = %u\n" - -#: lib/bitset_stats.c:261 lib/bitset_stats.c:266 -msgid "Could not read stats file." -msgstr "No pude leer fichero de estadísticas" - -#: lib/bitset_stats.c:263 -#, c-format -msgid "Bad stats file size.\n" -msgstr "Fichero de estadística no válido.\n" - -#: lib/bitset_stats.c:289 lib/bitset_stats.c:291 -msgid "Could not write stats file." -msgstr "No pude escribir el fichero de estadísticas." - -#: lib/bitset_stats.c:294 -msgid "Could not open stats file for writing." -msgstr "No pude abrir el fichero de estadísticas para escritura" - -#: lib/error.c:127 -msgid "Unknown system error" -msgstr "Error del sistema desconocido" - -#: lib/getopt.c:570 lib/getopt.c:589 -#, c-format -msgid "%s: option `%s' is ambiguous\n" -msgstr "%s: la opción `%s' es ambigua\n" - -# Pongo esto como en otros .po. sv -#: lib/getopt.c:622 lib/getopt.c:626 -#, c-format -msgid "%s: option `--%s' doesn't allow an argument\n" -msgstr "%s: la opción `--%s' no admite ningún argumento\n" - -#: lib/getopt.c:635 lib/getopt.c:640 -#, c-format -msgid "%s: option `%c%s' doesn't allow an argument\n" -msgstr "%s: la opción `%c%s' no admite ningún argumento\n" - -#: lib/getopt.c:686 lib/getopt.c:708 lib/getopt.c:1039 lib/getopt.c:1061 -#, c-format -msgid "%s: option `%s' requires an argument\n" -msgstr "%s: la opción `%s' requiere un argumento\n" - -#: lib/getopt.c:746 lib/getopt.c:749 -#, c-format -msgid "%s: unrecognized option `--%s'\n" -msgstr "%s: opción `--%s' no reconocida\n" - -#: lib/getopt.c:757 lib/getopt.c:760 -#, c-format -msgid "%s: unrecognized option `%c%s'\n" -msgstr "%s: opción `%c%s' no reconocida\n" - -# ¿Qué encuentras de malo en traducir `illegal' como `ilegal'? Date -# cuenta de que el mensaje "opción no válida" parece ambigua y hará -# pensar al usuario de que tal vez la ha usado incorrectamente, sin -# reparar, por lo tanto, en que la opción misma es ilegal. Esto es, ¡¡no -# existe!! (porque imagino que es en este sentido como se ha programado) -# - cll -# Sobre esto hubo una discusión en la lista hace tiempo, -# quizás ilegal queda un poco fuerte, alguien decía que parecía que -# ibas a ir a la carcel por usar la opción. -# ngp -# -# Sí, era Enrique a quien no le gustaba la palabra. -# No creo que debamos dejar de decir algo por la "corrección política" -# Yo creo que si el 386 tiene instrucciones *ilegales*, también puede -# haber opciones ilegales, digo yo, y no por eso las CPUs van -# a la cárcel (como mucho se cuelgan, je, je, 0ff0 :-). sv -# -#: lib/getopt.c:815 lib/getopt.c:818 -#, c-format -msgid "%s: illegal option -- %c\n" -msgstr "%s: opción -- %c ilegal\n" - -# ¡Muy bien traducido! En el grupo de traducción ha habido auténticas -# batallas con el tema "invalid - inválido/a" :) - cll -# Porque Enrique decía que le recordaba a disminuidos físicos. -# Francamente, no creo que haya que andar con estas "fobias". -# Pongo inválida. sv -#: lib/getopt.c:824 lib/getopt.c:827 -#, c-format -msgid "%s: invalid option -- %c\n" -msgstr "%s: opción -- %c no válida\n" - -#: lib/getopt.c:882 lib/getopt.c:901 lib/getopt.c:1114 lib/getopt.c:1135 -#, c-format -msgid "%s: option requires an argument -- %c\n" -msgstr "%s: la opción -- %c requiere un argumento\n" - -#: lib/getopt.c:954 lib/getopt.c:973 -#, c-format -msgid "%s: option `-W %s' is ambiguous\n" -msgstr "%s: la opción `-W %s' es ambigua\n" - -# Pongo esto como en otros .po. sv -#: lib/getopt.c:997 lib/getopt.c:1018 -#, c-format -msgid "%s: option `-W %s' doesn't allow an argument\n" -msgstr "%s: la opción `-W %s' no admite ningún argumento\n" - -#: lib/obstack.c:417 lib/obstack.c:420 lib/xmalloc.c:53 -msgid "memory exhausted" -msgstr "memoria agotada" - -#: lib/quotearg.c:238 -msgid "`" -msgstr "`" - -#: lib/quotearg.c:239 -msgid "'" -msgstr "'" - -#: lib/subpipe.c:171 -#, c-format -msgid "subsidiary program `%s' could not be invoked" -msgstr "no se pudo invocar el programa subsidiario `%s'" - -#: lib/subpipe.c:173 -#, c-format -msgid "subsidiary program `%s' not found" -msgstr "no se encontró el programa subsidiario `%s'" - -#: lib/subpipe.c:175 -#, c-format -msgid "subsidiary program `%s' failed" -msgstr "falló el programa subsidiario `%s'" - -#: lib/subpipe.c:176 -#, c-format -msgid "subsidiary program `%s' failed (exit status %d)" -msgstr "falló el programa subsidiario `%s' (estado de salida %d)" - -#: lib/timevar.c:475 -msgid "" -"\n" -"Execution times (seconds)\n" -msgstr "" -"\n" -"Tiempos de ejecución (segundo)\n" - -#: lib/timevar.c:525 -msgid " TOTAL :" -msgstr " TOTAL :" - -#: lib/timevar.c:561 -#, c-format -msgid "time in %s: %ld.%06ld (%ld%%)\n" -msgstr "tiempo en %s: %ld.%06ld (%ld%%)\n" - -#~ msgid "too many states (max %d)" -#~ msgstr "demasiados estados (máximo %d)" - -#~ msgid "reduce" -#~ msgstr "reduce" - -#~ msgid "shift" -#~ msgstr "desplaza" - -#~ msgid "%d shift/reduce conflict" -#~ msgid_plural "%d shift/reduce conflicts" -#~ msgstr[0] "%d conflicto desplazamiento/reducción" -#~ msgstr[1] "%d conflictos desplazamiento/reducción" - -#~ msgid "and" -#~ msgstr "y" - -#~ msgid "State %d contains " -#~ msgstr "El estado %d contiene" - -#~ msgid "conflicts: " -#~ msgstr "conflictos: " - -#~ msgid "%s contains " -#~ msgstr "%s contiene " - -#~ msgid "`%s' is no longer supported" -#~ msgstr "`%s' ya no está soportado" - -# Me parece menos "computadora" decir "ningún fichero de gramática" - cll -# -#~ msgid "%s: no grammar file given\n" -#~ msgstr "%s: no se ha especificado ningún fichero de gramática\n" - -# Ignorar es no saber, to ignore es no hacer caso, que no es lo mismo. sv -#~ msgid "%s: extra arguments ignored after `%s'\n" -#~ msgstr "%s: los argumentos extra después de '%s' no se tendrán en cuenta\n" - -#~ msgid "too many gotos (max %d)" -#~ msgstr "demasiados gotos (máximo %d)" - -# to ignore no es ignorar. Pon otra cosa, please. sv -#~ msgid "unexpected `/' found and ignored" -#~ msgstr "se ha encontrado `/' cuando no se esperaba, no se tendrán en cuenta" - -#~ msgid "unterminated comment" -#~ msgstr "comentario sin terminar" - -#~ msgid "unexpected end of file" -#~ msgstr "fin de fichero inesperado" - -# ¿unescaped? -#~ msgid "unescaped newline in constant" -#~ msgstr "salto de línea en constante sin secuencia de escape" - -#~ msgid "octal value outside range 0...255: `\\%o'" -#~ msgstr "valor octal fuera del rango 0...255: `\\%o'" - -#~ msgid "hexadecimal value above 255: `\\x%x'" -#~ msgstr "valor hexadecimal mayor que 255: `\\x%x'" - -#~ msgid "unknown escape sequence: `\\' followed by `%s'" -#~ msgstr "secuencia de escape desconocida: `\\' seguido de `%s'" - -#~ msgid "unterminated type name at end of file" -#~ msgstr "nombre de tipo sin terminar al final del fichero" - -#~ msgid "unterminated type name" -#~ msgstr "nombre de tipo sin terminar" - -# ¿multicarácter o multicaracteres? sv -#~ msgid "use \"...\" for multi-character literal tokens" -#~ msgstr "use \"...\" para terminales literales multicarácter" - -#~ msgid "`%s' supports no argument: %s" -#~ msgstr "`%s' no soporta el argumento: %s" - -#~ msgid "`%s' requires an argument" -#~ msgstr "`%s' requiere un argumento" - -#~ msgid " (rule %d)" -#~ msgstr " (regla %d)" - -#~ msgid " %-4s\terror (nonassociative)\n" -#~ msgstr " %-4s\terror (no asociativo)\n" - -#~ msgid "" -#~ " $default\treduce using rule %d (%s)\n" -#~ "\n" -#~ msgstr "" -#~ " $default\treduce usando la regla %d (%s)\n" -#~ "\n" - -#~ msgid " %-4s\t[reduce using rule %d (%s)]\n" -#~ msgstr " %-4s\t[reduce usando la regla %d (%s)]\n" - -#~ msgid " %-4s\treduce using rule %d (%s)\n" -#~ msgstr " %-4s\treduce usando la regla %d (%s)\n" - -#~ msgid " $default\treduce using rule %d (%s)\n" -#~ msgstr " $default\treduce usando la regla %d (%s)\n" - -#~ msgid " $default\taccept\n" -#~ msgstr " $default\taceptar\n" - -#~ msgid " NO ACTIONS\n" -#~ msgstr " SIN ACCIONES\n" - -#~ msgid "Number, Line, Rule" -#~ msgstr "Número, Línea, Regla" - -#~ msgid " %3d %3d %s ->" -#~ msgstr " %3d %3d %s ->" - -#~ msgid " Skipping to next \\n" -#~ msgstr " Saltando al siguiente \\n" - -#~ msgid " Skipping to next %c" -#~ msgstr " Saltando al siguiente %c" - -#~ msgid "unterminated string" -#~ msgstr "cadena sin terminar" - -#~ msgid "%s is invalid" -#~ msgstr "%s no es válido" - -#~ msgid "unterminated `%{' definition" -#~ msgstr "definición `%{' sin terminar" - -#~ msgid "Premature EOF after %s" -#~ msgstr "EOF prematuro después de %s" - -#~ msgid "`%s' is invalid in %s" -#~ msgstr "`%s' no es válido en %s" - -#~ msgid "invalid %s declaration" -#~ msgstr "declaración de %s no válida" - -#~ msgid "%type declaration has no " -#~ msgstr "la declaración %type no tiene " - -#~ msgid "invalid %%type declaration due to item: %s" -#~ msgstr "declaración de %%type no válida debido al ítem: %s" - -# Una corrección menor: en realidad, `should' es el pasado y condicional -# de "to must" y aquí se emplea en su forma condicional. Por eso, he -# cambiado `debe' por `debería' - cll -# ahí me has pillado en un olvido del inglés - ngp -#~ msgid "invalid text (%s) - number should be after identifier" -#~ msgstr "" -#~ "texto no válido (%s) - el número debería estar después del identificador" - -# En unas ocasiones, has traducido `unexpected' como `no esperado' y, en -# otras, como `inesperado'. Cualquiera es correcta, por supuesto y, en -# este caso, la segunda me parece más apropiada - cll -# ok - ngp -#~ msgid "unexpected item: %s" -#~ msgstr "ítem inesperado: %s" - -# Cambio el orden y el sexo. Ahora está "en español". sv -#~ msgid "unmatched %s" -#~ msgstr "%s desemparejado/a" - -#~ msgid "argument of %%expect is not an integer" -#~ msgstr "el argumento de %%expect no es un entero" - -# No te recomiendo que emplees participios para expresar acciones (¡si -# me oyera mi antigua profesora de lengua, lloraría de emoción! :). En -# vez de eso, emplea las conjugaciones habituales, que para eso están :) -# - cll -# ok - ngp -# -#~ msgid "unrecognized item %s, expected an identifier" -#~ msgstr "no se reconoce el ítem %s, se esperaba un identificador" - -#~ msgid "expected string constant instead of %s" -#~ msgstr "se esperaba una cadena constante en lugar de %s" - -#~ msgid "no input grammar" -#~ msgstr "no hay gramática de entrada" - -#~ msgid "ill-formed rule: initial symbol not followed by colon" -#~ msgstr "regla mal formada: el símbolo inicial no está seguido por :" - -#~ msgid "grammar starts with vertical bar" -#~ msgstr "la gramática comienza con una barra vertical" - -#~ msgid "previous rule lacks an ending `;'" -#~ msgstr "a la regla previa le falta un `;' al final" - -#~ msgid "two @prec's in a row" -#~ msgstr "dos @prec en una línea" - -# Insisto, el empleo de participios a secas me parece como hablar en -# indio. Por favor, permíteme que añada un "está" :) - cll -# ok - ngp -#~ msgid "%%guard present but %%semantic_parser not specified" -#~ msgstr "%%guard presente pero %%semantic_parser está sin especificar" - -#~ msgid "two actions at end of one rule" -#~ msgstr "dos acciones al final de una regla" - -#~ msgid "too many symbols (tokens plus nonterminals); maximum %d" -#~ msgstr "demasiados símbolos (terminales y no terminales); máximo %d" - -# Únicamente cambio la posición del adjetivo `máximo'. En vez de después -# de `tabla', después de `tamaño' - cll -# en inglés era así, pero quizás en español sea mejor como dices -# ngp -# -#~ msgid "maximum table size (%d) exceeded" -#~ msgstr "excedido el tamaño máximo de la tabla (%d)" - -#~ msgid " $ \tgo to state %d\n" -#~ msgstr " $ \tir al estado %d\n" - -# Tal vez pueda parecer pedante, pero `inconclusa' me suena muchísimo -# mejor que `sin terminar' que me parece más "computerizado" - cll -# quizás un poco cacofónico lo de claúsula inconclusa - ngp -# -#~ msgid "unterminated %guard clause" -#~ msgstr "cláusula %guard sin terminar" diff --git a/src/bin/bison/po/et.gmo b/src/bin/bison/po/et.gmo deleted file mode 100644 index ab1f88fa37..0000000000 Binary files a/src/bin/bison/po/et.gmo and /dev/null differ diff --git a/src/bin/bison/po/et.po b/src/bin/bison/po/et.po deleted file mode 100644 index 2321874e30..0000000000 --- a/src/bin/bison/po/et.po +++ /dev/null @@ -1,734 +0,0 @@ -# Estonian translations for bison. -# Copyright (C) 2001 Free Software Foundation, Inc. -# Toomas Soome , 2002. -# -msgid "" -msgstr "" -"Project-Id-Version: bison 1.875\n" -"Report-Msgid-Bugs-To: bug-bison@gnu.org\n" -"POT-Creation-Date: 2004-05-21 10:26-0700\n" -"PO-Revision-Date: 2003-01-02 11:59+0200\n" -"Last-Translator: Toomas Soome \n" -"Language-Team: Estonian \n" -"MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=ISO-8859-15\n" -"Content-Transfer-Encoding: 8-bit\n" -"Plural-Forms: nplurals=2; plural=(n != 1);\n" - -#: src/complain.c:51 src/complain.c:66 -msgid "warning: " -msgstr "hoiatus: " - -#: src/complain.c:122 src/complain.c:138 -msgid "fatal error: " -msgstr "fataalne viga: " - -#: src/conflicts.c:76 -#, c-format -msgid " Conflict between rule %d and token %s resolved as shift" -msgstr " Konflikt reegli %d ja märgi %s vahel lahendatud nihkega" - -#: src/conflicts.c:84 -#, c-format -msgid " Conflict between rule %d and token %s resolved as reduce" -msgstr " Konflikt reegli %d ja märgi %s vahel lahendatud redutseerimisega" - -#: src/conflicts.c:91 -#, c-format -msgid " Conflict between rule %d and token %s resolved as an error" -msgstr " Konflikt reegli %d ja märgi %s vahel lahendatud veana" - -#: src/conflicts.c:399 -#, c-format -msgid "conflicts: %d shift/reduce, %d reduce/reduce\n" -msgstr "" -"konfliktid: %d nihutamine/redutseerimine, %d redutseerimine/redutseerimine\n" - -#: src/conflicts.c:402 -#, c-format -msgid "conflicts: %d shift/reduce\n" -msgstr "konfliktid: %d nihutamine/redutseerimine\n" - -#: src/conflicts.c:404 -#, c-format -msgid "conflicts: %d reduce/reduce\n" -msgstr "konfliktid: %d redutseerimine/redutseerimine\n" - -#: src/conflicts.c:422 -#, c-format -msgid "State %d " -msgstr "Olek %d " - -#: src/conflicts.c:487 -#, fuzzy, c-format -msgid "%%expect-rr applies only to GLR parsers" -msgstr "%s puudutab ainult GLR parsereid" - -#: src/conflicts.c:511 -#, c-format -msgid "expected %d shift/reduce conflict" -msgid_plural "expected %d shift/reduce conflicts" -msgstr[0] "eeldasime %d nihutamine/redutseerimine konflikti" -msgstr[1] "eeldasime %d nihutamine/redutseerimine konflikti" - -#: src/conflicts.c:515 -#, fuzzy, c-format -msgid "expected %d reduce/reduce conflict" -msgid_plural "expected %d reduce/reduce conflicts" -msgstr[0] "eeldasin 0 redutseerimine/redutseerimine konflikti" -msgstr[1] "eeldasin 0 redutseerimine/redutseerimine konflikti" - -#: src/files.c:100 -#, c-format -msgid "cannot open file `%s'" -msgstr "faili `%s' ei saa avada" - -#: src/files.c:116 -msgid "I/O error" -msgstr "S/V viga" - -#: src/files.c:119 -msgid "cannot close file" -msgstr "faili ei õnnestu sulgeda" - -#: src/files.c:337 -#, c-format -msgid "conflicting outputs to file %s" -msgstr "konfliktsed väljundid faili %s" - -#: src/getargs.c:186 -#, c-format -msgid "Try `%s --help' for more information.\n" -msgstr "Lisainfo saamiseks proovige `%s --help'.\n" - -#: src/getargs.c:192 -msgid "GNU bison generates parsers for LALR(1) grammars.\n" -msgstr "GNU bison genereerib parsereid LALR(1) grammatikatele.\n" - -#: src/getargs.c:196 -#, c-format -msgid "Usage: %s [OPTION]... FILE\n" -msgstr "Kasuta: %s [VÕTI]...FAIL\n" - -#: src/getargs.c:200 -msgid "" -"If a long option shows an argument as mandatory, then it is mandatory\n" -"for the equivalent short option also. Similarly for optional arguments.\n" -msgstr "" -"Kui pikk võti näitab, et argument on kohustuslik, siis on see kohustuslik \n" -"ka lühikese võtme korral. Sama ka vabalt valitavate võtmete korral.\n" - -#: src/getargs.c:206 -msgid "" -"Operation modes:\n" -" -h, --help display this help and exit\n" -" -V, --version output version information and exit\n" -" -y, --yacc emulate POSIX yacc\n" -msgstr "" -"Töömoodid:\n" -" -h, --help esita see abiinfo ja lõpeta töö\n" -" -V, --version esita versiooniinfo ja lõpeta töö\n" -" -y, --yacc emuleeri POSIX yacc\n" - -#: src/getargs.c:213 -msgid "" -"Parser:\n" -" -S, --skeleton=FILE specify the skeleton to use\n" -" -t, --debug instrument the parser for debugging\n" -" --locations enable locations computation\n" -" -p, --name-prefix=PREFIX prepend PREFIX to the external symbols\n" -" -l, --no-lines don't generate `#line' directives\n" -" -n, --no-parser generate the tables only\n" -" -k, --token-table include a table of token names\n" -msgstr "" -"Parser:\n" -" -S, --skeleton=FAIL kasutatava skeleti kirjeldus\n" -" -t, --debug varusta parser silumisinfoga\n" -" --locations luba asukohtade arvestamine\n" -" -p, --name-prefix=PREFIKS lisa välissümbolite nimedele PREFIKS\n" -" -l, --no-lines ära genereeri `#line' direktiive\n" -" -n, --no-parser genereeri ainult tabelid\n" -" -k, --token-table lisa ka sümbolite nimede tabel\n" - -#: src/getargs.c:225 -msgid "" -"Output:\n" -" -d, --defines also produce a header file\n" -" -r, --report=THINGS also produce details on the automaton\n" -" -v, --verbose same as `--report=state'\n" -" -b, --file-prefix=PREFIX specify a PREFIX for output files\n" -" -o, --output=FILE leave output to FILE\n" -" -g, --graph also produce a VCG description of the " -"automaton\n" -msgstr "" -"Väljund:\n" -" -d, --defines loo ka päisfail\n" -" -r, --report=ASJAD väljasta automaadi kohta selgitusi\n" -" -v, --verbose sama, kui `--report=state'\n" -" -b, --file-prefix=PREFIKS kasuta väljundfailide nimedes PREFIKSit\n" -" -o, --output-file=FAIL jäta väljund FAILi\n" -" -g, --graph loo automaadi kirjeldus VCG graafina\n" - -#: src/getargs.c:236 -msgid "" -"THINGS is a list of comma separated words that can include:\n" -" `state' describe the states\n" -" `itemset' complete the core item sets with their closure\n" -" `lookahead' explicitly associate lookaheads to items\n" -" `solved' describe shift/reduce conflicts solving\n" -" `all' include all the above information\n" -" `none' disable the report\n" -msgstr "" -"ASJAD on loend komadega eraldatud järgnevaid sõnu:\n" -" `state' olekute kirjeldus\n" -" `itemset' täienda põhilisi elemente nende sulunditega\n" -" `lookahead' seo ettevaatamised elementidega\n" -" `solved' kirjelda nihuta/redutseeri konfliktide lahendamisi\n" -" `all' kogu ülaltoodud info\n" -" `none' blokeeri raport\n" - -#: src/getargs.c:247 -msgid "Report bugs to .\n" -msgstr "Teatage palun vigadest aadressil .\n" - -#: src/getargs.c:264 -#, c-format -msgid "bison (GNU Bison) %s" -msgstr "bison (GNU Bison) %s" - -#: src/getargs.c:266 -msgid "Written by Robert Corbett and Richard Stallman.\n" -msgstr "Kirjutanud Robert Corbett ja Richard Stallman.\n" - -#: src/getargs.c:270 -#, c-format -msgid "Copyright (C) %d Free Software Foundation, Inc.\n" -msgstr "Autoriõigus © %d Free Software Foundation, Inc.\n" - -#: src/getargs.c:272 -msgid "" -"This is free software; see the source for copying conditions. There is NO\n" -"warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n" -msgstr "" -"See on vaba tarkvara; kopeerimistingimused leiate lähtetekstidest. Garantii\n" -"PUUDUB; ka müügiks või mingil eesmärgil kasutamiseks.\n" - -#: src/getargs.c:438 -#, c-format -msgid "missing operand after `%s'" -msgstr "`%s' järel puudub operand" - -#: src/getargs.c:440 -#, c-format -msgid "extra operand `%s'" -msgstr "Liigne operand `%s'" - -#: src/gram.c:139 -msgid "empty" -msgstr "tühi" - -#: src/gram.c:233 -msgid "Grammar" -msgstr "Grammatika" - -#: src/gram.c:321 src/reduce.c:394 -msgid "warning" -msgstr "hoiatus" - -#: src/main.c:124 -msgid "rule never reduced because of conflicts" -msgstr "reeglit ei redutseerita konfliktide tõttu kunagi" - -#: src/parse-gram.y:363 -msgid "POSIX forbids declarations in the grammar" -msgstr "POSIX keelab deklareerimised grammatikas" - -#: src/parse-gram.y:486 -msgid "missing identifier in parameter declaration" -msgstr "parameetri deklaratsioonis puudub identifikaator" - -#: src/print.c:49 -#, c-format -msgid " type %d is %s\n" -msgstr " tüüp %d on %s\n" - -#: src/print.c:165 -#, c-format -msgid "shift, and go to state %d\n" -msgstr "nihuta ja liigu olekule %d\n" - -#: src/print.c:167 -#, c-format -msgid "go to state %d\n" -msgstr "liigu olekule %d\n" - -#: src/print.c:204 -msgid "error (nonassociative)\n" -msgstr "viga (mitteassotsiatiivne)\n" - -#: src/print.c:292 -#, c-format -msgid "reduce using rule %d (%s)" -msgstr "redutseerin kasutades reeglit %d (%s)" - -#: src/print.c:294 -#, c-format -msgid "accept" -msgstr "nõustun" - -#: src/print.c:325 src/print.c:391 -msgid "$default" -msgstr "$default" - -#: src/print.c:420 -#, c-format -msgid "state %d" -msgstr "olek %d" - -#: src/print.c:456 -msgid "Terminals, with rules where they appear" -msgstr "Terminalid, koos reeglitega kus nad ilmuvad" - -#: src/print.c:483 -msgid "Nonterminals, with rules where they appear" -msgstr "Mitteterminalid, koos reeglitega kus nad ilmuvad" - -#: src/print.c:512 -#, c-format -msgid " on left:" -msgstr " vasakul:" - -#: src/print.c:527 -#, c-format -msgid " on right:" -msgstr " paremal:" - -#: src/print.c:555 -msgid "Rules never reduced" -msgstr "Mitteredutseeruvad reeglid" - -#: src/reader.c:56 -#, c-format -msgid "multiple %s declarations" -msgstr "korduvad %s deklaratsioonid" - -#: src/reader.c:118 -#, c-format -msgid "result type clash on merge function %s: <%s> != <%s>" -msgstr "tulemuse tüübikonflikt mestimise funktsioonis %s: <%s> != <%s>" - -#: src/reader.c:216 -#, c-format -msgid "rule given for %s, which is a token" -msgstr "%s jaoks on antud reegel, aga see on märk" - -#: src/reader.c:245 -#, c-format -msgid "type clash on default action: <%s> != <%s>" -msgstr "vaikimisi tegevuse tüübikonflikt: <%s> != <%s>" - -#: src/reader.c:251 -msgid "empty rule for typed nonterminal, and no action" -msgstr "tüübiga mitteterminalil on tühi reegel ja puudub tegevus" - -#: src/reader.c:321 src/reader.c:335 src/reader.c:348 -#, c-format -msgid "only one %s allowed per rule" -msgstr "reeglis on lubatud ainult üks %s" - -#: src/reader.c:331 src/reader.c:346 -#, c-format -msgid "%s affects only GLR parsers" -msgstr "%s puudutab ainult GLR parsereid" - -#: src/reader.c:333 -#, c-format -msgid "%s must be followed by positive number" -msgstr "%s järel peab olema positiivne number" - -#: src/reader.c:490 -msgid "no rules in the input grammar" -msgstr "sisendgrammatikas pole reegleid" - -#: src/reduce.c:242 -msgid "useless rule" -msgstr "kasutamata reegel" - -#: src/reduce.c:303 -#, c-format -msgid "useless nonterminal: %s" -msgstr "kasutamata mitteterminal: %s" - -#: src/reduce.c:351 -msgid "Useless nonterminals" -msgstr "Kasutamata mitteterminalid" - -#: src/reduce.c:364 -msgid "Terminals which are not used" -msgstr "Terminalid, mida ei kasutatud" - -#: src/reduce.c:373 -msgid "Useless rules" -msgstr "Kasutamata reeglid" - -#: src/reduce.c:389 -#, c-format -msgid "%d rule never reduced\n" -msgid_plural "%d rules never reduced\n" -msgstr[0] "%d reegel ei redutseeru\n" -msgstr[1] "%d reeglit ei redutseeru\n" - -#: src/reduce.c:397 -#, c-format -msgid "%d useless nonterminal" -msgid_plural "%d useless nonterminals" -msgstr[0] "%d kasutamata mitteterminal" -msgstr[1] "%d kasutamata mitteterminali" - -#: src/reduce.c:403 -#, c-format -msgid " and " -msgstr " ja " - -#: src/reduce.c:406 -#, c-format -msgid "%d useless rule" -msgid_plural "%d useless rules" -msgstr[0] "%d kasutamata reegel" -msgstr[1] "%d kasutamata reeglit" - -#: src/reduce.c:436 -#, c-format -msgid "start symbol %s does not derive any sentence" -msgstr "stardisümbolist %s ei tuletata ühtegi lauset" - -#: src/scan-gram.l:162 -msgid "stray `,' treated as white space" -msgstr "käsitlen juhuslikku `,' kui tühikut" - -#: src/scan-gram.l:225 -#, c-format -msgid "invalid directive: %s" -msgstr "vigane juhus: %s" - -#: src/scan-gram.l:283 -#, c-format -msgid "invalid character: %s" -msgstr "vigased sümbolid: %s" - -#: src/scan-gram.l:402 -#, fuzzy -msgid "invalid null character" -msgstr "vigased sümbolid: %s" - -#: src/scan-gram.l:415 src/scan-gram.l:427 src/scan-gram.l:448 -#, c-format -msgid "invalid escape sequence: %s" -msgstr "vigane paojada: %s" - -#: src/scan-gram.l:417 src/scan-gram.l:429 src/scan-gram.l:450 -#, fuzzy, c-format -msgid "invalid null character: %s" -msgstr "vigased sümbolid: %s" - -#: src/scan-gram.l:455 -#, c-format -msgid "unrecognized escape sequence: %s" -msgstr "tundmatu paojada: %s" - -#: src/scan-gram.l:537 -#, c-format -msgid "missing `{' in `%s'" -msgstr "`%s' juures puudub `{'" - -#: src/scan-gram.l:782 -#, c-format -msgid "$$ of `%s' has no declared type" -msgstr "`%s' $$ ei oma deklareeritud tüüpi" - -#: src/scan-gram.l:803 -#, c-format -msgid "$%d of `%s' has no declared type" -msgstr "$%d `%s' ei oma deklareeritud tüüpi" - -#: src/scan-gram.l:812 src/scan-gram.l:881 src/scan-gram.l:932 -#, c-format -msgid "integer out of range: %s" -msgstr "number piiridest väljas: %s" - -#: src/scan-gram.l:848 src/scan-gram.l:916 -#, c-format -msgid "invalid value: %s" -msgstr "vigane väärtus: %s" - -#: src/scan-gram.l:1036 -#, c-format -msgid "missing `%s' at end of file" -msgstr "faili lõpus puudub `%s'" - -#: src/scan-gram.l:1047 -#, fuzzy, c-format -msgid "missing `%s' at end of line" -msgstr "faili lõpus puudub `%s'" - -#: src/symlist.c:97 src/symlist.c:108 -msgid "invalid $ value" -msgstr "vigane $ väärtus" - -#: src/symtab.c:85 -#, c-format -msgid "type redeclaration for %s" -msgstr "%s tüübi uuesti deklareerimine" - -#: src/symtab.c:102 src/symtab.c:120 -#, c-format -msgid "%s redeclaration for %s" -msgstr "%s uuesti deklareerimine %s jaoks" - -#: src/symtab.c:139 -#, c-format -msgid "redefining precedence of %s" -msgstr "%s prioriteedi uus definitsioon" - -#: src/symtab.c:157 -#, c-format -msgid "symbol %s redefined" -msgstr "sümbol %s on uuesti defineeritud" - -#: src/symtab.c:180 -#, c-format -msgid "redefining user token number of %s" -msgstr "%s kasutaja märgi numbri uuesti defineerimine" - -#: src/symtab.c:207 -#, c-format -msgid "symbol %s is used, but is not defined as a token and has no rules" -msgstr "" -"kasutatakse sümbolit %s, mis ei ole defineeritud märgina ja millel puuduvad " -"reeglid" - -#: src/symtab.c:232 -#, c-format -msgid "symbol `%s' used more than once as a literal string" -msgstr "sümbolit `%s' on kasutatud enam kui kord literaal sõnena" - -#: src/symtab.c:235 -#, c-format -msgid "symbol `%s' given more than one literal string" -msgstr "sümbolile `%s' on antud enam kui üks literaal sõne" - -#: src/symtab.c:271 -#, c-format -msgid "conflicting precedences for %s and %s" -msgstr "%s ja %s omavad konfliktseid prioriteete" - -#: src/symtab.c:283 -#, c-format -msgid "conflicting associativities for %s (%s) and %s (%s)" -msgstr "%s (%s) ja %s (%s) omavad konfliktseid assotsiatiivseid väärtuseid" - -#: src/symtab.c:368 -#, c-format -msgid "tokens %s and %s both assigned number %d" -msgstr "märkidele %s ja %s on mõlemale omistatud number %d" - -#: src/symtab.c:591 -#, c-format -msgid "the start symbol %s is undefined" -msgstr "stardisümbol %s ei ole defineeritud" - -#: src/symtab.c:595 -#, c-format -msgid "the start symbol %s is a token" -msgstr "stardisümbol %s on märk" - -#: lib/argmatch.c:133 -#, c-format -msgid "invalid argument %s for %s" -msgstr "vigane argument %s %s'le" - -#: lib/argmatch.c:134 -#, c-format -msgid "ambiguous argument %s for %s" -msgstr "segane argument %s %s'le" - -#: lib/argmatch.c:153 -#, c-format -msgid "Valid arguments are:" -msgstr "Lubatud argumendid on:" - -#: lib/bitset_stats.c:179 -#, c-format -msgid "%u bitset_allocs, %u freed (%.2f%%).\n" -msgstr "%u bitset_allocs, %u vabastatud (%.2f%%).\n" - -#: lib/bitset_stats.c:182 -#, c-format -msgid "%u bitset_sets, %u cached (%.2f%%)\n" -msgstr "%u bitset_sets, %u puhverdatud (%.2f%%)\n" - -#: lib/bitset_stats.c:185 -#, c-format -msgid "%u bitset_resets, %u cached (%.2f%%)\n" -msgstr "%u bitset_resets, %u puhverdatud (%.2f%%)\n" - -#: lib/bitset_stats.c:188 -#, c-format -msgid "%u bitset_tests, %u cached (%.2f%%)\n" -msgstr "%u bitset_tests, %u puhverdatud (%.2f%%)\n" - -#: lib/bitset_stats.c:192 -#, c-format -msgid "%u bitset_lists\n" -msgstr "%u bitset_lists\n" - -#: lib/bitset_stats.c:194 -msgid "count log histogram\n" -msgstr "loenduri logi histogramm\n" - -#: lib/bitset_stats.c:197 -msgid "size log histogram\n" -msgstr "suuruste logi histogramm\n" - -#: lib/bitset_stats.c:200 -msgid "density histogram\n" -msgstr "tiheduse histogramm\n" - -#: lib/bitset_stats.c:214 -#, c-format -msgid "" -"Bitset statistics:\n" -"\n" -msgstr "" -"Bitset statistika:\n" -"\n" - -#: lib/bitset_stats.c:217 -#, c-format -msgid "Accumulated runs = %u\n" -msgstr "Salvestatud läbimisi = %u\n" - -#: lib/bitset_stats.c:261 lib/bitset_stats.c:266 -msgid "Could not read stats file." -msgstr "Statistika faili ei saa lugeda." - -#: lib/bitset_stats.c:263 -#, c-format -msgid "Bad stats file size.\n" -msgstr "Vigane statistika faili suurus.\n" - -#: lib/bitset_stats.c:289 lib/bitset_stats.c:291 -msgid "Could not write stats file." -msgstr "Statistika faili ei saa kirjutada." - -#: lib/bitset_stats.c:294 -msgid "Could not open stats file for writing." -msgstr "Statistika faili ei saa kirjutamiseks avada." - -#: lib/error.c:127 -msgid "Unknown system error" -msgstr "Tundmatu süsteemi viga" - -#: lib/getopt.c:570 lib/getopt.c:589 -#, c-format -msgid "%s: option `%s' is ambiguous\n" -msgstr "%s: võti `%s' on segane\n" - -#: lib/getopt.c:622 lib/getopt.c:626 -#, c-format -msgid "%s: option `--%s' doesn't allow an argument\n" -msgstr "%s: võti `--%s' ei luba argumenti\n" - -#: lib/getopt.c:635 lib/getopt.c:640 -#, c-format -msgid "%s: option `%c%s' doesn't allow an argument\n" -msgstr "%s: võti `%c%s' ei luba argumenti\n" - -#: lib/getopt.c:686 lib/getopt.c:708 lib/getopt.c:1039 lib/getopt.c:1061 -#, c-format -msgid "%s: option `%s' requires an argument\n" -msgstr "%s: võti `%s' nõuab argumenti\n" - -#: lib/getopt.c:746 lib/getopt.c:749 -#, c-format -msgid "%s: unrecognized option `--%s'\n" -msgstr "%s: tundmatu võti `--%s'\n" - -#: lib/getopt.c:757 lib/getopt.c:760 -#, c-format -msgid "%s: unrecognized option `%c%s'\n" -msgstr "%s: tundmatu võti `%c%s'\n" - -#: lib/getopt.c:815 lib/getopt.c:818 -#, c-format -msgid "%s: illegal option -- %c\n" -msgstr "%s: lubamatu võti -- %c\n" - -#: lib/getopt.c:824 lib/getopt.c:827 -#, c-format -msgid "%s: invalid option -- %c\n" -msgstr "%s: vigane võti -- %c\n" - -#: lib/getopt.c:882 lib/getopt.c:901 lib/getopt.c:1114 lib/getopt.c:1135 -#, c-format -msgid "%s: option requires an argument -- %c\n" -msgstr "%s: võti nõuab argumenti -- %c\n" - -#: lib/getopt.c:954 lib/getopt.c:973 -#, c-format -msgid "%s: option `-W %s' is ambiguous\n" -msgstr "%s: võti `-W %s' on segane\n" - -#: lib/getopt.c:997 lib/getopt.c:1018 -#, c-format -msgid "%s: option `-W %s' doesn't allow an argument\n" -msgstr "%s: võti `-W %s' ei luba argumenti\n" - -#: lib/obstack.c:417 lib/obstack.c:420 lib/xmalloc.c:53 -msgid "memory exhausted" -msgstr "mälu on otsas" - -#: lib/quotearg.c:238 -msgid "`" -msgstr "`" - -#: lib/quotearg.c:239 -msgid "'" -msgstr "'" - -#: lib/subpipe.c:171 -#, c-format -msgid "subsidiary program `%s' could not be invoked" -msgstr "abiprogrammi `%s' ei saa käivitada" - -#: lib/subpipe.c:173 -#, c-format -msgid "subsidiary program `%s' not found" -msgstr "ei leia abiprogrammi `%s'" - -#: lib/subpipe.c:175 -#, c-format -msgid "subsidiary program `%s' failed" -msgstr "abiprogramm `%s' ebaõnnestus" - -#: lib/subpipe.c:176 -#, c-format -msgid "subsidiary program `%s' failed (exit status %d)" -msgstr "abiprogramm `%s' ebaõnnestus (lõpetamise kood %d)" - -#: lib/timevar.c:475 -msgid "" -"\n" -"Execution times (seconds)\n" -msgstr "" -"\n" -"Täitmise ajad (sekundites)\n" - -#: lib/timevar.c:525 -msgid " TOTAL :" -msgstr " KOKKU :" - -#: lib/timevar.c:561 -#, c-format -msgid "time in %s: %ld.%06ld (%ld%%)\n" -msgstr "aeg %s: %ld.%06ld (%ld%%)\n" diff --git a/src/bin/bison/po/fr.gmo b/src/bin/bison/po/fr.gmo deleted file mode 100644 index 51d44cb55e..0000000000 Binary files a/src/bin/bison/po/fr.gmo and /dev/null differ diff --git a/src/bin/bison/po/fr.po b/src/bin/bison/po/fr.po deleted file mode 100644 index cb77d09f12..0000000000 --- a/src/bin/bison/po/fr.po +++ /dev/null @@ -1,1210 +0,0 @@ -# Messages français pour Bison. -# Copyright © 2004 Free Software Foundation, Inc. -# Michel Robitaille , traducteur depuis/since 1996 -# Dominique Boucher a été le traducteur de 1996 à 2000 -# -msgid "" -msgstr "" -"Project-Id-Version: GNU bison 1.875a\n" -"Report-Msgid-Bugs-To: bug-bison@gnu.org\n" -"POT-Creation-Date: 2004-05-21 10:26-0700\n" -"PO-Revision-Date: 2004-05-10 08:00-0500\n" -"Last-Translator: Michel Robitaille \n" -"Language-Team: French \n" -"MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=ISO-8859-1\n" -"Content-Transfer-Encoding: 8-bit\n" -"Plural-Forms: nplurals=2; plural=(n > 1);\n" - -#: src/complain.c:51 src/complain.c:66 -msgid "warning: " -msgstr "AVERTISSEMENT: " - -#: src/complain.c:122 src/complain.c:138 -msgid "fatal error: " -msgstr "erreur fatale: " - -#: src/conflicts.c:76 -#, c-format -msgid " Conflict between rule %d and token %s resolved as shift" -msgstr "Conflit entre la règle %d et le jeton %s résolu par décalage" - -#: src/conflicts.c:84 -#, c-format -msgid " Conflict between rule %d and token %s resolved as reduce" -msgstr "Conflit entre la règle %d et le jeton %s résolu par réduction" - -#: src/conflicts.c:91 -#, c-format -msgid " Conflict between rule %d and token %s resolved as an error" -msgstr "Conflit entre la règle %d et le jeton %s résolu comme étant une erreur" - -#: src/conflicts.c:399 -#, c-format -msgid "conflicts: %d shift/reduce, %d reduce/reduce\n" -msgstr "conflits: %d décalage/réduction, %d réduction/réduction\n" - -#: src/conflicts.c:402 -#, c-format -msgid "conflicts: %d shift/reduce\n" -msgstr "conflits: %d décalage/réduction\n" - -#: src/conflicts.c:404 -#, c-format -msgid "conflicts: %d reduce/reduce\n" -msgstr "conflits: %d réduction/réduction\n" - -#: src/conflicts.c:422 -#, c-format -msgid "State %d " -msgstr "État %d" - -#: src/conflicts.c:487 -#, fuzzy, c-format -msgid "%%expect-rr applies only to GLR parsers" -msgstr "%%dprec affecte seulement les analyseurs GLR" - -#: src/conflicts.c:511 -#, c-format -msgid "expected %d shift/reduce conflict" -msgid_plural "expected %d shift/reduce conflicts" -msgstr[0] "attendait %d conflit par décalage/réduction" -msgstr[1] "attendait %d conflits par décalage/réduction" - -#: src/conflicts.c:515 -#, fuzzy, c-format -msgid "expected %d reduce/reduce conflict" -msgid_plural "expected %d reduce/reduce conflicts" -msgstr[0] "attendait 0 conflit par réduction/réduction" -msgstr[1] "attendait 0 conflit par réduction/réduction" - -#: src/files.c:100 -#, c-format -msgid "cannot open file `%s'" -msgstr "ne peut ouvrir le fichier « %s »" - -#: src/files.c:116 -msgid "I/O error" -msgstr "une erreur d'E/S" - -#: src/files.c:119 -msgid "cannot close file" -msgstr "ne peut fermer le fichier" - -#: src/files.c:337 -#, c-format -msgid "conflicting outputs to file %s" -msgstr "sorties en conflit vers le fichier %s" - -#: src/getargs.c:186 -#, c-format -msgid "Try `%s --help' for more information.\n" -msgstr "Pour en savoir davantage, faites: « %s --help ».\n" - -#: src/getargs.c:192 -msgid "GNU bison generates parsers for LALR(1) grammars.\n" -msgstr "GNU bison génère des analyseurs pour les grammaires de type LALR(1).\n" - -#: src/getargs.c:196 -#, c-format -msgid "Usage: %s [OPTION]... FILE\n" -msgstr "Usage: %s [OPTION]... FICHIER\n" - -#: src/getargs.c:200 -msgid "" -"If a long option shows an argument as mandatory, then it is mandatory\n" -"for the equivalent short option also. Similarly for optional arguments.\n" -msgstr "" -"Si une option de forme longue montre un arguement comme étant obligatoire,\n" -"il est alors obligatoire également pour une option de forme courte.\n" -"Il en est de même pour les arguments optionnels.\n" - -#: src/getargs.c:206 -msgid "" -"Operation modes:\n" -" -h, --help display this help and exit\n" -" -V, --version output version information and exit\n" -" -y, --yacc emulate POSIX yacc\n" -msgstr "" -"Modes d'utilisation:\n" -" -h, --help afficher l'aide-mémoire\n" -" -V, --version afficher le nom et la version du logiciel\n" -" -y, --yacc émuler yacc en mode POSIX\n" - -#: src/getargs.c:213 -msgid "" -"Parser:\n" -" -S, --skeleton=FILE specify the skeleton to use\n" -" -t, --debug instrument the parser for debugging\n" -" --locations enable locations computation\n" -" -p, --name-prefix=PREFIX prepend PREFIX to the external symbols\n" -" -l, --no-lines don't generate `#line' directives\n" -" -n, --no-parser generate the tables only\n" -" -k, --token-table include a table of token names\n" -msgstr "" -"Analyseur:\n" -" -S, --skeleton=FICHIER utiliser le FICHIER squelette\n" -" -t, --debug activer le mode de mise au point\n" -" de l'analyseur\n" -" --locations permettre le calcul des localisations\n" -" -p, --name-prefix=PREFIXE accoler le PREFIXE aux symboles externes\n" -" -l, --no-lines ne pas générer les directives « #line »\n" -" -n, --no-parser générer les tables seulement\n" -" -r, --raw compter les jetons à partir de 3\n" -" -k, --token-table inclure la table des noms de jetons\n" - -#: src/getargs.c:225 -msgid "" -"Output:\n" -" -d, --defines also produce a header file\n" -" -r, --report=THINGS also produce details on the automaton\n" -" -v, --verbose same as `--report=state'\n" -" -b, --file-prefix=PREFIX specify a PREFIX for output files\n" -" -o, --output=FILE leave output to FILE\n" -" -g, --graph also produce a VCG description of the " -"automaton\n" -msgstr "" -"Sortie:\n" -" -d, --defines produire un fichier d'en-tête\n" -" -r, --report=CHOSES générer les détails concernant l'automate\n" -" -v, --verbose produire une explication de l'automate\n" -" -b, --file-prefix=PREFIXE utiliser le PREFIXE pour le fichier de sortie\n" -" -o, --output=FICHIER produire la sortie dans le FICHIER\n" -" -g, --graph produire aussi la description du graphe VCG de " -"l'automate\n" - -#: src/getargs.c:236 -msgid "" -"THINGS is a list of comma separated words that can include:\n" -" `state' describe the states\n" -" `itemset' complete the core item sets with their closure\n" -" `lookahead' explicitly associate lookaheads to items\n" -" `solved' describe shift/reduce conflicts solving\n" -" `all' include all the above information\n" -" `none' disable the report\n" -msgstr "" -"CHOSES est une liste de mots séparés par des virgules par les suivants:\n" -" `state' description des états\n" -" `itemset' compléter le corps du jeu d'items avec leur fermeture\n" -" `lookahead' explicitement associé les lookahead aux items\n" -" `solved' décrirer la résolution des conflits décalage/réduction\n" -" `all' inclure toutes les informations ci-haut\n" -" `none' désactiver la génération de rapport\n" - -#: src/getargs.c:247 -msgid "Report bugs to .\n" -msgstr "Rapporter toutes anomalies à .\n" - -#: src/getargs.c:264 -#, c-format -msgid "bison (GNU Bison) %s" -msgstr "bison (GNU Bison) %s" - -#: src/getargs.c:266 -msgid "Written by Robert Corbett and Richard Stallman.\n" -msgstr "Écrit par Robert Corbett et Richard Stallman.\n" - -#: src/getargs.c:270 -#, c-format -msgid "Copyright (C) %d Free Software Foundation, Inc.\n" -msgstr "Copyright © %d Free Software Foundation, Inc.\n" - -#: src/getargs.c:272 -msgid "" -"This is free software; see the source for copying conditions. There is NO\n" -"warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n" -msgstr "" -"Ce logiciel est libre; voir les sources pour les conditions de\n" -"reproduction. AUCUNE garantie n'est donnée; tant pour des raisons\n" -"COMMERCIALES que pour RÉPONDRE À UN BESOIN PARTICULIER.\n" - -#: src/getargs.c:438 -#, c-format -msgid "missing operand after `%s'" -msgstr "opérande manquante après « %s »" - -#: src/getargs.c:440 -#, c-format -msgid "extra operand `%s'" -msgstr "opérande superflue « %s »" - -#: src/gram.c:139 -msgid "empty" -msgstr "vide" - -#: src/gram.c:233 -msgid "Grammar" -msgstr "Grammaire" - -#: src/gram.c:321 src/reduce.c:394 -msgid "warning" -msgstr "AVERTISSEMENT" - -#: src/main.c:124 -msgid "rule never reduced because of conflicts" -msgstr "la règle n'a jamais fait de réduction en raison des conflits" - -#: src/parse-gram.y:363 -msgid "POSIX forbids declarations in the grammar" -msgstr "POSIX interdit les déclaration dans la grammaire" - -#: src/parse-gram.y:486 -msgid "missing identifier in parameter declaration" -msgstr "identificateur manquant dans la déclaration de paramètres" - -#: src/print.c:49 -#, c-format -msgid " type %d is %s\n" -msgstr " le type %d est %s\n" - -#: src/print.c:165 -#, c-format -msgid "shift, and go to state %d\n" -msgstr "décalage et aller à l'état %d\n" - -#: src/print.c:167 -#, c-format -msgid "go to state %d\n" -msgstr "aller à l'état %d\n" - -#: src/print.c:204 -msgid "error (nonassociative)\n" -msgstr "erreur (non-associative)\n" - -#: src/print.c:292 -#, c-format -msgid "reduce using rule %d (%s)" -msgstr "réduction par utilisation de la règle %d (%s)" - -#: src/print.c:294 -#, c-format -msgid "accept" -msgstr "accepter" - -#: src/print.c:325 src/print.c:391 -msgid "$default" -msgstr "$défaut" - -#: src/print.c:420 -#, c-format -msgid "state %d" -msgstr "état %d" - -#: src/print.c:456 -msgid "Terminals, with rules where they appear" -msgstr "Terminaux, suivis des règles où ils apparaissent" - -#: src/print.c:483 -msgid "Nonterminals, with rules where they appear" -msgstr "Non-terminaux, suivis des règles où ils apparaissent" - -#: src/print.c:512 -#, c-format -msgid " on left:" -msgstr " à gauche:" - -#: src/print.c:527 -#, c-format -msgid " on right:" -msgstr " à droite:" - -#: src/print.c:555 -msgid "Rules never reduced" -msgstr "Règles jamais réduites" - -#: src/reader.c:56 -#, c-format -msgid "multiple %s declarations" -msgstr "déclarations multiples de %s" - -#: src/reader.c:118 -#, c-format -msgid "result type clash on merge function %s: <%s> != <%s>" -msgstr "" -"conflit dans le type résultant de la fonction de fusion %s: <%s> != <%s>" - -#: src/reader.c:216 -#, c-format -msgid "rule given for %s, which is a token" -msgstr "la règle pour %s, qui est un terminal" - -#: src/reader.c:245 -#, c-format -msgid "type clash on default action: <%s> != <%s>" -msgstr "conflit de type pour l'action par défaut: <%s> != <%s>" - -#: src/reader.c:251 -msgid "empty rule for typed nonterminal, and no action" -msgstr "règle vide pour une catégorie typée et aucune action" - -#: src/reader.c:321 src/reader.c:335 src/reader.c:348 -#, c-format -msgid "only one %s allowed per rule" -msgstr "seul un %s est permis par règle" - -#: src/reader.c:331 src/reader.c:346 -#, c-format -msgid "%s affects only GLR parsers" -msgstr "%s affecte seulement les analyseurs GLR" - -#: src/reader.c:333 -#, c-format -msgid "%s must be followed by positive number" -msgstr "%s doit être suivi d'un nombre positif" - -#: src/reader.c:490 -msgid "no rules in the input grammar" -msgstr "la grammaire n'a pas de règles" - -#: src/reduce.c:242 -msgid "useless rule" -msgstr "règle inutilisable" - -#: src/reduce.c:303 -#, c-format -msgid "useless nonterminal: %s" -msgstr "non-terminal inutilisable: %s" - -#: src/reduce.c:351 -msgid "Useless nonterminals" -msgstr "Non-terminaux inutiles" - -#: src/reduce.c:364 -msgid "Terminals which are not used" -msgstr "Terminaux qui ne sont utilisés" - -#: src/reduce.c:373 -msgid "Useless rules" -msgstr "Règles inutiles" - -#: src/reduce.c:389 -#, c-format -msgid "%d rule never reduced\n" -msgid_plural "%d rules never reduced\n" -msgstr[0] "%d règle n'a jamais été réduite\n" -msgstr[1] "%d règles n'ont jamais été réduites\n" - -#: src/reduce.c:397 -#, c-format -msgid "%d useless nonterminal" -msgid_plural "%d useless nonterminals" -msgstr[0] "%d nonterminal inutilisable" -msgstr[1] "%d nonterminals inutilisables" - -#: src/reduce.c:403 -#, c-format -msgid " and " -msgstr " et " - -#: src/reduce.c:406 -#, c-format -msgid "%d useless rule" -msgid_plural "%d useless rules" -msgstr[0] "%d règle inutilisable" -msgstr[1] "%d règles inutilisables" - -#: src/reduce.c:436 -#, c-format -msgid "start symbol %s does not derive any sentence" -msgstr "" -"symbole de départ %s peut permettre la dérivation de n'importe quelle phrase" - -#: src/scan-gram.l:162 -msgid "stray `,' treated as white space" -msgstr "« , » errante traitée comme un blanc" - -#: src/scan-gram.l:225 -#, c-format -msgid "invalid directive: %s" -msgstr "directive invalide: %s" - -#: src/scan-gram.l:283 -#, c-format -msgid "invalid character: %s" -msgstr "caractère invalide: %s" - -#: src/scan-gram.l:402 -#, fuzzy -msgid "invalid null character" -msgstr "caractère invalide: %s" - -#: src/scan-gram.l:415 src/scan-gram.l:427 src/scan-gram.l:448 -#, c-format -msgid "invalid escape sequence: %s" -msgstr "séquence d'échappement invalide: %s" - -#: src/scan-gram.l:417 src/scan-gram.l:429 src/scan-gram.l:450 -#, fuzzy, c-format -msgid "invalid null character: %s" -msgstr "caractère invalide: %s" - -#: src/scan-gram.l:455 -#, c-format -msgid "unrecognized escape sequence: %s" -msgstr "séquence d'échappement non reconnue: %s" - -#: src/scan-gram.l:537 -#, c-format -msgid "missing `{' in `%s'" -msgstr "« { » manquante dans « %s »" - -#: src/scan-gram.l:782 -#, c-format -msgid "$$ of `%s' has no declared type" -msgstr "$$ de « %s » n'a pas son type déclaré" - -#: src/scan-gram.l:803 -#, c-format -msgid "$%d of `%s' has no declared type" -msgstr "$%d de « %s » n'a pas de type déclaré" - -#: src/scan-gram.l:812 src/scan-gram.l:881 src/scan-gram.l:932 -#, c-format -msgid "integer out of range: %s" -msgstr "entier hors limite: %s" - -#: src/scan-gram.l:848 src/scan-gram.l:916 -#, c-format -msgid "invalid value: %s" -msgstr "valeur invalide: %s" - -#: src/scan-gram.l:1036 -#, c-format -msgid "missing `%s' at end of file" -msgstr "chaîne de caractères « %s » manquante en fin de fichier" - -#: src/scan-gram.l:1047 -#, fuzzy, c-format -msgid "missing `%s' at end of line" -msgstr "chaîne de caractères « %s » manquante en fin de fichier" - -#: src/symlist.c:97 src/symlist.c:108 -msgid "invalid $ value" -msgstr "la valeur de symbole $ n'est pas valide" - -#: src/symtab.c:85 -#, c-format -msgid "type redeclaration for %s" -msgstr "redéclaration du type de %s" - -#: src/symtab.c:102 src/symtab.c:120 -#, c-format -msgid "%s redeclaration for %s" -msgstr "redéclaration de %s pour %s" - -#: src/symtab.c:139 -#, c-format -msgid "redefining precedence of %s" -msgstr "redéfinition du niveau de priorité de %s" - -#: src/symtab.c:157 -#, c-format -msgid "symbol %s redefined" -msgstr "symbole %s redéfini" - -#: src/symtab.c:180 -#, c-format -msgid "redefining user token number of %s" -msgstr "redéfinition du jeton usager numéro de %s" - -#: src/symtab.c:207 -#, c-format -msgid "symbol %s is used, but is not defined as a token and has no rules" -msgstr "" -"le symbole %s est utilisé mais ce n'est pas un terminal et il ne possède pas " -"de règle" - -#: src/symtab.c:232 -#, c-format -msgid "symbol `%s' used more than once as a literal string" -msgstr "symbole « %s » utilisé plus d'une fois dans une chaîne litérale" - -#: src/symtab.c:235 -#, c-format -msgid "symbol `%s' given more than one literal string" -msgstr "symbole « %s » présent dans plus d'une chaîne litérale" - -#: src/symtab.c:271 -#, c-format -msgid "conflicting precedences for %s and %s" -msgstr "les priorités pour %s et %s entrent en conflit" - -#: src/symtab.c:283 -#, c-format -msgid "conflicting associativities for %s (%s) and %s (%s)" -msgstr "conflits d'associativités pour %s (%s) et %s (%s)" - -#: src/symtab.c:368 -#, c-format -msgid "tokens %s and %s both assigned number %d" -msgstr "les jetons %s et %s se sont vus assigner le nombre %d" - -#: src/symtab.c:591 -#, c-format -msgid "the start symbol %s is undefined" -msgstr "le symbole de départ %s n'est pas défini" - -#: src/symtab.c:595 -#, c-format -msgid "the start symbol %s is a token" -msgstr "le symbole de départ %s est un terminal" - -#: lib/argmatch.c:133 -#, c-format -msgid "invalid argument %s for %s" -msgstr "argument invalide %s pour %s" - -#: lib/argmatch.c:134 -#, c-format -msgid "ambiguous argument %s for %s" -msgstr "argument ambiguë %s pour %s" - -#: lib/argmatch.c:153 -#, c-format -msgid "Valid arguments are:" -msgstr "Arguments valides sont:" - -#: lib/bitset_stats.c:179 -#, c-format -msgid "%u bitset_allocs, %u freed (%.2f%%).\n" -msgstr "%u bitset_allocs, %u libérés (%.2f%%).\n" - -#: lib/bitset_stats.c:182 -#, c-format -msgid "%u bitset_sets, %u cached (%.2f%%)\n" -msgstr "%u bitset_sets, %u dans la cache (%.2f%%)\n" - -#: lib/bitset_stats.c:185 -#, c-format -msgid "%u bitset_resets, %u cached (%.2f%%)\n" -msgstr "%u bitset_resets, %u dans la cache (%.2f%%)\n" - -#: lib/bitset_stats.c:188 -#, c-format -msgid "%u bitset_tests, %u cached (%.2f%%)\n" -msgstr "%u bitset_tests, %u dans la cache (%.2f%%)\n" - -#: lib/bitset_stats.c:192 -#, c-format -msgid "%u bitset_lists\n" -msgstr "%u bitset_lists\n" - -#: lib/bitset_stats.c:194 -msgid "count log histogram\n" -msgstr "histogramme des compteurs\n" - -#: lib/bitset_stats.c:197 -msgid "size log histogram\n" -msgstr "taille de l'histogramme des compteurs\n" - -#: lib/bitset_stats.c:200 -msgid "density histogram\n" -msgstr "densité de l'histogramme\n" - -#: lib/bitset_stats.c:214 -#, c-format -msgid "" -"Bitset statistics:\n" -"\n" -msgstr "" -"Statistiques des bitset:\n" -"\n" - -#: lib/bitset_stats.c:217 -#, c-format -msgid "Accumulated runs = %u\n" -msgstr "Exécutions accumulées = %u\n" - -#: lib/bitset_stats.c:261 lib/bitset_stats.c:266 -msgid "Could not read stats file." -msgstr "Ne peut lire le fichier de stats." - -#: lib/bitset_stats.c:263 -#, c-format -msgid "Bad stats file size.\n" -msgstr "Taille erronée du fichier de stats.\n" - -#: lib/bitset_stats.c:289 lib/bitset_stats.c:291 -msgid "Could not write stats file." -msgstr "Ne peut écrire le fichier de stats." - -#: lib/bitset_stats.c:294 -msgid "Could not open stats file for writing." -msgstr "Ne ouvrir en écriture le fichier de stats." - -#: lib/error.c:127 -msgid "Unknown system error" -msgstr "Erreur système inconnue" - -#: lib/getopt.c:570 lib/getopt.c:589 -#, c-format -msgid "%s: option `%s' is ambiguous\n" -msgstr "%s: l'option %s est ambigüe\n" - -#: lib/getopt.c:622 lib/getopt.c:626 -#, c-format -msgid "%s: option `--%s' doesn't allow an argument\n" -msgstr "%s: l'option « --%s » n'admet pas d'argument\n" - -#: lib/getopt.c:635 lib/getopt.c:640 -#, c-format -msgid "%s: option `%c%s' doesn't allow an argument\n" -msgstr "%s: l'option « %c%s » n'admet pas d'argument\n" - -#: lib/getopt.c:686 lib/getopt.c:708 lib/getopt.c:1039 lib/getopt.c:1061 -#, c-format -msgid "%s: option `%s' requires an argument\n" -msgstr "%s: l'option « %s » requiert un argument\n" - -#: lib/getopt.c:746 lib/getopt.c:749 -#, c-format -msgid "%s: unrecognized option `--%s'\n" -msgstr "%s: l'option « --%s » est inconnue\n" - -#: lib/getopt.c:757 lib/getopt.c:760 -#, c-format -msgid "%s: unrecognized option `%c%s'\n" -msgstr "%s: l'option « %c%s » est inconnue\n" - -#: lib/getopt.c:815 lib/getopt.c:818 -#, c-format -msgid "%s: illegal option -- %c\n" -msgstr "%s: option illégale -- %c\n" - -#: lib/getopt.c:824 lib/getopt.c:827 -#, c-format -msgid "%s: invalid option -- %c\n" -msgstr "%s: option non valide -- %c\n" - -#: lib/getopt.c:882 lib/getopt.c:901 lib/getopt.c:1114 lib/getopt.c:1135 -#, c-format -msgid "%s: option requires an argument -- %c\n" -msgstr "%s: l'option requiert un argument -- %c\n" - -#: lib/getopt.c:954 lib/getopt.c:973 -#, c-format -msgid "%s: option `-W %s' is ambiguous\n" -msgstr "%s: l'option « -W %s » est ambiguë\n" - -#: lib/getopt.c:997 lib/getopt.c:1018 -#, c-format -msgid "%s: option `-W %s' doesn't allow an argument\n" -msgstr "%s: l'option « -W %s » n'admet pas d'argument\n" - -#: lib/obstack.c:417 lib/obstack.c:420 lib/xmalloc.c:53 -msgid "memory exhausted" -msgstr "mémoire épuisée" - -#: lib/quotearg.c:238 -msgid "`" -msgstr "`" - -#: lib/quotearg.c:239 -msgid "'" -msgstr "'" - -#: lib/subpipe.c:171 -#, c-format -msgid "subsidiary program `%s' could not be invoked" -msgstr "programme subsidiaire « %s » n'a pu être invoqué" - -#: lib/subpipe.c:173 -#, c-format -msgid "subsidiary program `%s' not found" -msgstr "programme subsidiaire « %s » n'a pas été repéré" - -#: lib/subpipe.c:175 -#, c-format -msgid "subsidiary program `%s' failed" -msgstr "programme subsidiaire « %s » a échoué" - -#: lib/subpipe.c:176 -#, c-format -msgid "subsidiary program `%s' failed (exit status %d)" -msgstr "programme subsidiaire « %s » a échoué (statut d'exécution %d)" - -#: lib/timevar.c:475 -msgid "" -"\n" -"Execution times (seconds)\n" -msgstr "" -"\n" -"Temps d'exécution (secondes)\n" - -#: lib/timevar.c:525 -msgid " TOTAL :" -msgstr " TOTAL :" - -#: lib/timevar.c:561 -#, c-format -msgid "time in %s: %ld.%06ld (%ld%%)\n" -msgstr "temps dans %s: %ld.%06ld (%ld%%)\n" - -#~ msgid "%d shift/reduce conflict" -#~ msgid_plural "%d shift/reduce conflicts" -#~ msgstr[0] "%d conflit par décalage/réduction" -#~ msgstr[1] "%d conflits par décalage/réduction" - -#~ msgid "and" -#~ msgstr "et" - -#~ msgid "conflicts: " -#~ msgstr "conflits: " - -#~ msgid "State %d contains " -#~ msgstr "L'état %d contient " - -#~ msgid "too many gotos (max %d)" -#~ msgstr "nombre trop grand de « goto » (Max %d)" - -#~ msgid "too many symbols (tokens plus nonterminals); maximum %d" -#~ msgstr "trop de symboles (jeton plus non terminaux); maximum %d" - -#~ msgid ": unexpected end of file in a comment\n" -#~ msgstr ": fin de fichier inattendue dans un commentaire\n" - -#~ msgid ": unexpected end of file in a string\n" -#~ msgstr ": fin de fichier inattendue dans une chaîne\n" - -#~ msgid ": unexpected end of file in a character\n" -#~ msgstr ": fin de fichier inattendue dans un caractère\n" - -#~ msgid ": unexpected end of file in a braced code\n" -#~ msgstr ": fin de fichier inattendue dans du code entre accolades\n" - -#~ msgid ": unexpected end of file in a prologue\n" -#~ msgstr ": fin de fichier inattendue dans un prologue\n" - -#~ msgid "%s is invalid" -#~ msgstr "%s n'est pas valide" - -#~ msgid "too many states (max %d)" -#~ msgstr "nombre trop grand d'états (max %d)" - -#~ msgid "%s: no grammar file given\n" -#~ msgstr "%s: grammaire manquante\n" - -#~ msgid "%s: extra arguments ignored after `%s'\n" -#~ msgstr "%s: arguments supplémentaires ignorés après « %s »\n" - -#~ msgid "two @prec's in a row" -#~ msgstr "deux @prec de suite" - -#~ msgid "only one %%dprec allowed per rule" -#~ msgstr "seul un %%dprec est permis par règle" - -#~ msgid "state_list_append (state = %d, symbol = %d (%s))\n" -#~ msgstr "state_list_append (état = %d, symbole = %d (%s))\n" - -#~ msgid "Entering new_itemsets, state = %d\n" -#~ msgstr "Entrant dans new_itemsets, état = %d\n" - -#~ msgid "Entering get_state, symbol = %d (%s)\n" -#~ msgstr "Entrant dans get_state, symbole = %d (%s)\n" - -#~ msgid "Exiting get_state => %d\n" -#~ msgstr "Sortant de get_state => %d\n" - -#~ msgid "Entering append_states, state = %d\n" -#~ msgstr "Entrant dans append_states, état = %d\n" - -#~ msgid "Processing state %d (reached by %s)\n" -#~ msgstr "Traitement de l'état %d (atteint par %s)\n" - -#~ msgid "undefined associativity" -#~ msgstr "associativité indéfinie" - -#~ msgid "Closure: %s\n" -#~ msgstr "Fermeture: %s\n" - -#~ msgid " (rule %d)\n" -#~ msgstr " (règle %d)\n" - -#~ msgid "RTC: Firsts Input" -#~ msgstr "RTC: premières entrées" - -#~ msgid "RTC: Firsts Output" -#~ msgstr "RTC: premières sorties" - -#~ msgid "input" -#~ msgstr "entrée" - -#~ msgid "output" -#~ msgstr "sortie" - -#~ msgid "" -#~ "Variables\n" -#~ "---------\n" -#~ "\n" -#~ msgstr "" -#~ "Variables\n" -#~ "---------\n" -#~ "\n" - -#~ msgid "Value Sprec Sassoc Tag\n" -#~ msgstr "Valeur Sprec Sassoc Étiquette\n" - -#~ msgid "" -#~ "Rules\n" -#~ "-----\n" -#~ "\n" -#~ msgstr "" -#~ "Règles\n" -#~ "------\n" -#~ "\n" - -#~ msgid "" -#~ "Num (Prec, Assoc, Useful, Ritem Range) Lhs -> Rhs (Ritem range) [Num]\n" -#~ msgstr "" -#~ "Num (Prec, Assoc, Utile, Ritem étendue) Lhs -> Rhs (Ritem étendue) " -#~ "[Num]\n" - -#~ msgid "" -#~ "Rules interpreted\n" -#~ "-----------------\n" -#~ "\n" -#~ msgstr "" -#~ "Règles interprétées\n" -#~ "-------------------\n" -#~ "\n" - -#~ msgid "Lookaheads: BEGIN\n" -#~ msgstr "Lookaheads: DÉBUT\n" - -#~ msgid "State %d: %d lookaheads\n" -#~ msgstr "État %d: %d lookaheads\n" - -#~ msgid " on %d (%s) -> rule %d\n" -#~ msgstr " sur %d (%s) -> règle %d\n" - -#~ msgid "Lookaheads: END\n" -#~ msgstr "Lookaheads: FIN\n" - -#~ msgid "relation_transpose: input\n" -#~ msgstr "relation_transpose: entrée\n" - -#~ msgid "relation_transpose: output\n" -#~ msgstr "relation_transpose: sortie\n" - -#~ msgid "growing table and check from: %lu to %lu\n" -#~ msgstr "table en croissance et vérification depuis %lu à %lu\n" - -#~ msgid "base_t too small to hold %d\n" -#~ msgstr "base_t trop petite pour contenir %d\n" - -#~ msgid "reduce" -#~ msgstr "réduction" - -#~ msgid "shift" -#~ msgstr "décalage" - -#~ msgid "%s contains " -#~ msgstr "%s contient " - -#~ msgid "`%s' is no longer supported" -#~ msgstr "« %s » n'est plus supporté" - -#~ msgid "unexpected `/' found and ignored" -#~ msgstr "« / » inattendu et ignoré" - -#~ msgid "unterminated comment" -#~ msgstr "le commentaire ne se termine pas" - -#~ msgid "unescaped newline in constant" -#~ msgstr "retour de chariot sans échappement dans une constante" - -#~ msgid "octal value outside range 0...255: `\\%o'" -#~ msgstr "valeur octale à l'extérieur de l'intervalle 0...255: « \\%o »" - -#~ msgid "hexadecimal value above 255: `\\x%x'" -#~ msgstr "valeur hexadécimale supérieure à 255: « \\x%x »" - -#~ msgid "unknown escape sequence: `\\' followed by `%s'" -#~ msgstr "séquence d'échappement inconnue: « \\ » suivie de « %s »" - -#~ msgid "unterminated type name at end of file" -#~ msgstr "le nom de type ne se termine pas avant la fin de fichier" - -#~ msgid "unterminated type name" -#~ msgstr "le nom de type ne se termine pas" - -#~ msgid "use \"...\" for multi-character literal tokens" -#~ msgstr "" -#~ "utilisez \"...\" pour les terminaux litéraux de plusieurs caractères" - -#~ msgid "`%s' supports no argument: %s" -#~ msgstr "« %s » ne supporte aucun argument: %s" - -#~ msgid "`%s' requires an argument" -#~ msgstr "« %s »: requiert un argument" - -#~ msgid " %-4s\terror (nonassociative)\n" -#~ msgstr " %-4s\terreur (non-associatif)\n" - -#~ msgid "" -#~ " $default\treduce using rule %d (%s)\n" -#~ "\n" -#~ msgstr "" -#~ " $défaut\tréduction par la règle %d (%s)\n" -#~ "\n" - -#~ msgid " %-4s\t[reduce using rule %d (%s)]\n" -#~ msgstr " %-4s\t[réduction par la règle %d (%s)]\n" - -#~ msgid " %-4s\treduce using rule %d (%s)\n" -#~ msgstr " %-4s\tréduction par la règle %d (%s)\n" - -#~ msgid " $default\treduce using rule %d (%s)\n" -#~ msgstr " $défaut\tréduction par la règle %d (%s)\n" - -#~ msgid " $default\taccept\n" -#~ msgstr " $défaut\taccepter\n" - -#~ msgid " NO ACTIONS\n" -#~ msgstr " PAS D'ACTION\n" - -#~ msgid "Number, Line, Rule" -#~ msgstr "Nombre, ligne, règle" - -#~ msgid " %3d %3d %s ->" -#~ msgstr " %3d %3d %s ->" - -#~ msgid " Skipping to next \\n" -#~ msgstr " Saut jusqu'au prochain \\n" - -#~ msgid " Skipping to next %c" -#~ msgstr " Saut jusqu'au prochain %c" - -#~ msgid "unterminated string" -#~ msgstr "chaîne de caractère non terminée" - -#~ msgid "unterminated `%{' definition" -#~ msgstr "" -#~ "La section de définition « %{ » ne termine pas avant la fin du fichier" - -#~ msgid "Premature EOF after %s" -#~ msgstr "Fin de fichier prématutée après %s" - -#~ msgid "`%s' is invalid in %s" -#~ msgstr "« %s » n'est pas valide dans %s" - -#~ msgid "invalid %s declaration" -#~ msgstr "la déclaration %s n'est pas valide" - -#~ msgid "%type declaration has no " -#~ msgstr "la déclaration %type n'a pas de " - -#~ msgid "invalid %%type declaration due to item: %s" -#~ msgstr "la déclaration %%type n'est pas valide en raison de l'item: %s" - -#~ msgid "invalid text (%s) - number should be after identifier" -#~ msgstr "" -#~ "le texte n'est pas valide (%s) - le nombre devrait suivre l'identificateur" - -#~ msgid "unexpected item: %s" -#~ msgstr "item inattendu: %s" - -#~ msgid "unmatched %s" -#~ msgstr "non appariement de %s" - -#~ msgid "argument of %%expect is not an integer" -#~ msgstr "l'argument de %%expect n'est pas un entier" - -#~ msgid "unrecognized item %s, expected an identifier" -#~ msgstr "item %s non reconnu, un identificateur est attendu" - -#~ msgid "expected string constant instead of %s" -#~ msgstr "chaîne de caractères constante attendue plutôt que %s" - -#~ msgid "no input grammar" -#~ msgstr "aucune grammaire en entrée" - -#~ msgid "unknown character: %s" -#~ msgstr "caractère inconnu: %s" - -#~ msgid "ill-formed rule: initial symbol not followed by colon" -#~ msgstr "règle mal formée: le symbole initial n'est pas suivi de « : »" - -#~ msgid "grammar starts with vertical bar" -#~ msgstr "la grammaire débute par une barre verticale" - -#~ msgid "previous rule lacks an ending `;'" -#~ msgstr "règle précédente manque une terminaison « ; »" - -#~ msgid "%%guard present but %%semantic_parser not specified" -#~ msgstr "%%guard est présent mais %%semantic_parser n'est pas spécifié" - -#~ msgid "two actions at end of one rule" -#~ msgstr "deux actions à la fin d'une même règle" - -#~ msgid "maximum table size (%d) exceeded" -#~ msgstr "taille maximale de la table (%d) dépassée" - -#~ msgid " $ \tgo to state %d\n" -#~ msgstr " $ \taller à l'état %d\n" - -#~ msgid "unterminated %guard clause" -#~ msgstr "clause %guard non terminée" - -#~ msgid "%s: internal error: %s\n" -#~ msgstr "%s: erreur interne: %s\n" - -#~ msgid "DERIVES" -#~ msgstr "DÉRIVES" - -#~ msgid "%s derives" -#~ msgstr "%s dérive" - -#~ msgid "Entering set_nullable" -#~ msgstr "Entré dans set_nullable" - -#~ msgid "" -#~ "reduced %s defines %d terminal%s, %d nonterminal%s, and %d production%s.\n" -#~ msgstr "" -#~ "la réduction de %s définit %d terminal%s, %d catégorie%s et %d production%" -#~ "s.\n" - -#~ msgid " 1 shift/reduce conflict" -#~ msgstr " 1 conflit décalage/réduction" - -#~ msgid "%s contains" -#~ msgstr "%s contient" - -#~ msgid "\t\t/* empty */" -#~ msgstr "\t\t/* epsilon */" - -#~ msgid "multiple %%header_extension declarations" -#~ msgstr "multiples déclarations %%header_extension" - -#~ msgid "multiple %%source_extension declarations" -#~ msgstr "multiples déclarations %%source_extension" - -#~ msgid "vcg graph: no such color." -#~ msgstr "graphe vcg: pas de telle couleur" - -#~ msgid "vcg graph: no such text mode" -#~ msgstr "graphe vcg: pas de tel mode texte" - -#~ msgid "vcg graph: no such shape" -#~ msgstr "graphe vcg: pas de telle forme" - -#~ msgid "vcg graph: no such decision" -#~ msgstr "graphe vcg: pas de telle décision" - -#~ msgid "vcg graph: no such an orientation" -#~ msgstr "graphe vcg: pas de telle orientation" - -#~ msgid "vcg graph: no such an alignement" -#~ msgstr "graphe vcg: pas de tel alignement" - -#~ msgid "vcg graph: no such an arrow mode" -#~ msgstr "graphe vcg: pas de tel mode de flèche" - -#~ msgid "vcg graph: no such crossing_type" -#~ msgstr "graphe vcg: pas de tel type de croisement (crossing_type)" - -#~ msgid "vcg graph: no such view" -#~ msgstr "graphe vcg: pas de tel vue" - -#~ msgid "vcg graph: no such linestyle" -#~ msgstr "graphe vcg: pas de tel style de ligne" - -#~ msgid "vcg graph: no such an arrowstyle" -#~ msgstr "graphe vcg: pas de tel style de flèche" - -#~ msgid "" -#~ "\n" -#~ "\n" -#~ "\n" -#~ "DERIVES\n" -#~ "\n" -#~ msgstr "" -#~ "\n" -#~ "\n" -#~ "\n" -#~ "DERIVES\n" -#~ "\n" - -#~ msgid "unterminated comment at end of file" -#~ msgstr "le commentaire ne se termine pas avant la fin du fichier" - -#~ msgid "unmatched close-brace (`}')" -#~ msgstr "accolade fermante `}' non appariée" - -#~ msgid "@%s is invalid" -#~ msgstr "@%s n'est pas valide" - -#~ msgid "unmatched right brace (`}')" -#~ msgstr "accolade fermante `}' non appariée" - -#~ msgid "ill-formed %type declaration" -#~ msgstr "déclaration %type mal formée" - -#~ msgid "" -#~ "\n" -#~ "\n" -#~ "\n" -#~ "FIRSTS\n" -#~ "\n" -#~ msgstr "" -#~ "\n" -#~ "\n" -#~ "\n" -#~ "FIRSTS\n" -#~ "\n" - -#~ msgid "" -#~ "\n" -#~ "\n" -#~ "%s firsts\n" -#~ "\n" -#~ msgstr "" -#~ "\n" -#~ "\n" -#~ "%s firsts\n" -#~ "\n" - -#~ msgid "" -#~ "\n" -#~ "\n" -#~ "%s derives\n" -#~ "\n" -#~ msgstr "" -#~ "\n" -#~ "\n" -#~ "%s derives\n" -#~ "\n" - -#~ msgid "" -#~ "Usage: %s [-dhklntvyV] [-b file-prefix] [-o outfile] [-p name-prefix]\n" -#~ " [--debug] [--defines] [--fixed-output-files] [--no-lines]\n" -#~ " [--verbose] [--version] [--help] [--yacc]\n" -#~ " [--no-parser] [--token-table]\n" -#~ " [--file-prefix=prefix] [--name-prefix=prefix]\n" -#~ " [--output=outfile] grammar-file\n" -#~ msgstr "" -#~ "Usage: %s [-dhklntvyV] [-b préfixe-de-fichier] [-o sortie] [-p préfixe-de-" -#~ "nom]\n" -#~ " [--debug] [--defines] [--fixed-output-files] [--no-lines]\n" -#~ " [--verbose] [--version] [--help] [--yacc]\n" -#~ " [--no-parser] [--token-table]\n" -#~ " [--file-prefix=préfixe] [--name-prefix=préfixe]\n" -#~ " [--output=outfile] grammaire\n" - -#~ msgid "gotos" -#~ msgstr "gotos" - -#~ msgid "\"%s\", line %d: %s\n" -#~ msgstr "\"%s\", ligne %d: %s\n" - -#~ msgid "(\"%s\", line %d) error: %s\n" -#~ msgstr "(\"%s\", ligne %d) erreur: %s\n" - -#~ msgid "limit of %d exceeded, too many %s" -#~ msgstr "limite de %d dépassée, trop de %s" - -#~ msgid "unterminated comment in `%{' definition" -#~ msgstr "le commentaire ne se termine pas dans la section de définition (%{)" - -#~ msgid "invalid @-construct" -#~ msgstr "la construction «@» n'est pas valide" diff --git a/src/bin/bison/po/hr.gmo b/src/bin/bison/po/hr.gmo deleted file mode 100644 index 60a28cbf4d..0000000000 Binary files a/src/bin/bison/po/hr.gmo and /dev/null differ diff --git a/src/bin/bison/po/hr.po b/src/bin/bison/po/hr.po deleted file mode 100644 index 9fcfee346e..0000000000 --- a/src/bin/bison/po/hr.po +++ /dev/null @@ -1,922 +0,0 @@ -# Translation of bision to Croatian -# Copyright (C) 2002 Free Software Foundation, Inc. -# Denis Lackovic , 2002. -# This file is distributed under the same license as the bison package. -# Denis Lackovic , 2002. -# -msgid "" -msgstr "" -"Project-Id-Version: bison 1.34a\n" -"Report-Msgid-Bugs-To: bug-bison@gnu.org\n" -"POT-Creation-Date: 2004-05-21 10:26-0700\n" -"PO-Revision-Date: 2002-04-10 22:20+01\n" -"Last-Translator: Denis Lackovic \n" -"Language-Team: Croatian \n" -"MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=iso-8859-2\n" -"Content-Transfer-Encoding: 8bit\n" -"Plural-Forms: nplurals=2; plural=(n==1 ? 0 : 1);\n" - -#: src/complain.c:51 src/complain.c:66 -msgid "warning: " -msgstr "upozorenje:" - -#: src/complain.c:122 src/complain.c:138 -msgid "fatal error: " -msgstr "fatalna gre¹ka:" - -#: src/conflicts.c:76 -#, fuzzy, c-format -msgid " Conflict between rule %d and token %s resolved as shift" -msgstr "Konflikt u stanju %d izmeðu pravila %d i znaka %s razrije¹en kao %s.\n" - -#: src/conflicts.c:84 -#, fuzzy, c-format -msgid " Conflict between rule %d and token %s resolved as reduce" -msgstr "Konflikt u stanju %d izmeðu pravila %d i znaka %s razrije¹en kao %s.\n" - -#: src/conflicts.c:91 -#, fuzzy, c-format -msgid " Conflict between rule %d and token %s resolved as an error" -msgstr "Konflikt u stanju %d izmeðu pravila %d i znaka %s razrije¹en kao %s.\n" - -#: src/conflicts.c:399 -#, c-format -msgid "conflicts: %d shift/reduce, %d reduce/reduce\n" -msgstr "" - -#: src/conflicts.c:402 -#, fuzzy, c-format -msgid "conflicts: %d shift/reduce\n" -msgstr " %d pomakni/reduciraj" - -#: src/conflicts.c:404 -#, fuzzy, c-format -msgid "conflicts: %d reduce/reduce\n" -msgstr " %d reduviraj/reduciraj" - -#: src/conflicts.c:422 -#, fuzzy, c-format -msgid "State %d " -msgstr "stanje %d" - -#: src/conflicts.c:487 -#, c-format -msgid "%%expect-rr applies only to GLR parsers" -msgstr "" - -#: src/conflicts.c:511 -#, fuzzy, c-format -msgid "expected %d shift/reduce conflict" -msgid_plural "expected %d shift/reduce conflicts" -msgstr[0] "oèekujem %d pomakni/reduciraj konflikt\n" -msgstr[1] "oèekujem %d pomakni/reduciraj konflikata\n" - -#: src/conflicts.c:515 -#, fuzzy, c-format -msgid "expected %d reduce/reduce conflict" -msgid_plural "expected %d reduce/reduce conflicts" -msgstr[0] "%d reduciraj/reduciraj konflikt" -msgstr[1] "%d reduciraj/reduciraj konflikata" - -#: src/files.c:100 -#, c-format -msgid "cannot open file `%s'" -msgstr "ne mogu otvoriti datoteku `%s'" - -#: src/files.c:116 -#, fuzzy -msgid "I/O error" -msgstr "gre¹ka" - -#: src/files.c:119 -msgid "cannot close file" -msgstr "ne mogu zatvoriti datoteku" - -#: src/files.c:337 -#, fuzzy, c-format -msgid "conflicting outputs to file %s" -msgstr "konfliktne asocijativne vrijednosti za %s i %s" - -#: src/getargs.c:186 -#, c-format -msgid "Try `%s --help' for more information.\n" -msgstr "Poku¹aj `%s --help' za vi¹e informacija.\n" - -#: src/getargs.c:192 -msgid "GNU bison generates parsers for LALR(1) grammars.\n" -msgstr "GNU bison generira parsere za LALR(1) gramatike.\n" - -#: src/getargs.c:196 -#, c-format -msgid "Usage: %s [OPTION]... FILE\n" -msgstr "Kori¹tenje: %s [OPCIJA]... DATOTEKA\n" - -#: src/getargs.c:200 -msgid "" -"If a long option shows an argument as mandatory, then it is mandatory\n" -"for the equivalent short option also. Similarly for optional arguments.\n" -msgstr "" -"Ako duga opcija ka¾e da je argument obavezan, tada je on obavezan\n" -"i za ekvivalentnu kratku opciju. Slièno je i za opcionalne argumente.\n" - -#: src/getargs.c:206 -msgid "" -"Operation modes:\n" -" -h, --help display this help and exit\n" -" -V, --version output version information and exit\n" -" -y, --yacc emulate POSIX yacc\n" -msgstr "" -"Naèini rada:\n" -" -h, --help prika¾i ovu pomoæ i izaði\n" -" -V, --version prika¾i verziju i izaði\n" -" -y, --yacc emuliraj POSIX yacc\n" - -#: src/getargs.c:213 -msgid "" -"Parser:\n" -" -S, --skeleton=FILE specify the skeleton to use\n" -" -t, --debug instrument the parser for debugging\n" -" --locations enable locations computation\n" -" -p, --name-prefix=PREFIX prepend PREFIX to the external symbols\n" -" -l, --no-lines don't generate `#line' directives\n" -" -n, --no-parser generate the tables only\n" -" -k, --token-table include a table of token names\n" -msgstr "" -"Parser:\n" -" -S, --skeleton=DATOTEKA specificiraj kostur za uporabu\n" -" -t, --debug pripremi parser za deugiranje\n" -" --locations omoguæi izraèunavanje lokacija\n" -" -p, --name-prefix=PREFIKS stavi PREFIX ispred vanjskih simbola\n" -" -l, --no-lines ne eneriraj `#line' direktive\n" -" -n, --no-parser generiraj samo tablice\n" -" -k, --token-table ukljuèi tablicu imena znakova\n" - -#: src/getargs.c:225 -#, fuzzy -msgid "" -"Output:\n" -" -d, --defines also produce a header file\n" -" -r, --report=THINGS also produce details on the automaton\n" -" -v, --verbose same as `--report=state'\n" -" -b, --file-prefix=PREFIX specify a PREFIX for output files\n" -" -o, --output=FILE leave output to FILE\n" -" -g, --graph also produce a VCG description of the " -"automaton\n" -msgstr "" -"Izlaz:\n" -" -d, --defines takoðer proizvedi header datoteku\n" -" -v, --verbose takoðer proizvedi obja¹njenje automata\n" -" -b, --file-prefix=PREFIKS specificiraj PREFIKS za izlazne datoteke\n" -" -o, --output=DATOTEKA ispi¹i izlaz u DATOTEKU\n" -" -g, --graph takoðer proizvedi VCG opis automata\n" - -#: src/getargs.c:236 -msgid "" -"THINGS is a list of comma separated words that can include:\n" -" `state' describe the states\n" -" `itemset' complete the core item sets with their closure\n" -" `lookahead' explicitly associate lookaheads to items\n" -" `solved' describe shift/reduce conflicts solving\n" -" `all' include all the above information\n" -" `none' disable the report\n" -msgstr "" - -#: src/getargs.c:247 -msgid "Report bugs to .\n" -msgstr "Izvjesti o bugovima na .\n" - -#: src/getargs.c:264 -#, c-format -msgid "bison (GNU Bison) %s" -msgstr "bison (GNU Bison) %s" - -#: src/getargs.c:266 -msgid "Written by Robert Corbett and Richard Stallman.\n" -msgstr "" - -#: src/getargs.c:270 -#, fuzzy, c-format -msgid "Copyright (C) %d Free Software Foundation, Inc.\n" -msgstr "" -"Copyright 1984, 1986, 1989, 1992, 2000, 2001, 2002\n" -"Free Software Foundation, Inc.\n" - -#: src/getargs.c:272 -msgid "" -"This is free software; see the source for copying conditions. There is NO\n" -"warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n" -msgstr "" -"Ovo je slobodni softver; pogledajte kod kako biste doznali uvjete " -"kopiranja. NEMA\n" -"garancije; èak ni tvrdnje o ISPLATIVOSTI ili POGODNOSTI ZA NEKU SVRHU.\n" - -#: src/getargs.c:438 -#, c-format -msgid "missing operand after `%s'" -msgstr "" - -#: src/getargs.c:440 -#, c-format -msgid "extra operand `%s'" -msgstr "" - -#: src/gram.c:139 -msgid "empty" -msgstr "prazno" - -#: src/gram.c:233 -msgid "Grammar" -msgstr "Gramatika" - -#: src/gram.c:321 src/reduce.c:394 -#, fuzzy -msgid "warning" -msgstr "upozorenje:" - -#: src/main.c:124 -msgid "rule never reduced because of conflicts" -msgstr "" - -#: src/parse-gram.y:363 -msgid "POSIX forbids declarations in the grammar" -msgstr "" - -#: src/parse-gram.y:486 -msgid "missing identifier in parameter declaration" -msgstr "" - -#: src/print.c:49 -#, c-format -msgid " type %d is %s\n" -msgstr " tip %d je %s\n" - -#: src/print.c:165 -#, fuzzy, c-format -msgid "shift, and go to state %d\n" -msgstr " %-4s\tpomakni i idi u stanje %d\n" - -#: src/print.c:167 -#, fuzzy, c-format -msgid "go to state %d\n" -msgstr " $ \tidu u stanje %d\n" - -#: src/print.c:204 -#, fuzzy -msgid "error (nonassociative)\n" -msgstr "%-4s\tgre¹ka (nonassociative)" - -#: src/print.c:292 -#, fuzzy, c-format -msgid "reduce using rule %d (%s)" -msgstr "$default\treduciraj koristeæi pravilo %d (%s)" - -#: src/print.c:294 -#, c-format -msgid "accept" -msgstr "" - -#: src/print.c:325 src/print.c:391 -msgid "$default" -msgstr "" - -#: src/print.c:420 -#, c-format -msgid "state %d" -msgstr "stanje %d" - -#: src/print.c:456 -msgid "Terminals, with rules where they appear" -msgstr "Zavr¹ni znakovi, sa pravilima gdje se pojavljuju" - -#: src/print.c:483 -msgid "Nonterminals, with rules where they appear" -msgstr "Nezavr¹ni znakovi, sa pravilima gdje se pojavljuju" - -#: src/print.c:512 -#, c-format -msgid " on left:" -msgstr "s lijeva:" - -#: src/print.c:527 -#, c-format -msgid " on right:" -msgstr "s desna:" - -#: src/print.c:555 -#, fuzzy -msgid "Rules never reduced" -msgstr "%d pravilo nije nikad reducirano\n" - -#: src/reader.c:56 -#, c-format -msgid "multiple %s declarations" -msgstr "vi¹estruke %s deklaracije" - -#: src/reader.c:118 -#, c-format -msgid "result type clash on merge function %s: <%s> != <%s>" -msgstr "" - -#: src/reader.c:216 -#, c-format -msgid "rule given for %s, which is a token" -msgstr "pravilo dato za %s, a to je znak" - -#: src/reader.c:245 -#, fuzzy, c-format -msgid "type clash on default action: <%s> != <%s>" -msgstr "sudar tipova (`%s' `%s') na deaultnoj akciji" - -#: src/reader.c:251 -msgid "empty rule for typed nonterminal, and no action" -msgstr "prazno pravilo za nezavr¹ni znak, i nema akcije" - -#: src/reader.c:321 src/reader.c:335 src/reader.c:348 -#, c-format -msgid "only one %s allowed per rule" -msgstr "" - -#: src/reader.c:331 src/reader.c:346 -#, c-format -msgid "%s affects only GLR parsers" -msgstr "" - -#: src/reader.c:333 -#, c-format -msgid "%s must be followed by positive number" -msgstr "" - -#: src/reader.c:490 -msgid "no rules in the input grammar" -msgstr "nema pravila u ulaznoj gramatici" - -#: src/reduce.c:242 -#, fuzzy -msgid "useless rule" -msgstr "%d beskorisno pravilo" - -#: src/reduce.c:303 -#, fuzzy, c-format -msgid "useless nonterminal: %s" -msgstr "Beskorisni nezavr¹ni znakovi:" - -#: src/reduce.c:351 -#, fuzzy -msgid "Useless nonterminals" -msgstr "Beskorisni nezavr¹ni znakovi:" - -#: src/reduce.c:364 -#, fuzzy -msgid "Terminals which are not used" -msgstr "Zavr¹ni znakovi koji nisu kori¹teni:" - -#: src/reduce.c:373 -#, fuzzy -msgid "Useless rules" -msgstr "Beskorisna pravila:" - -#: src/reduce.c:389 -#, c-format -msgid "%d rule never reduced\n" -msgid_plural "%d rules never reduced\n" -msgstr[0] "%d pravilo nije nikad reducirano\n" -msgstr[1] "%d pravila nisu nikad reducirana\n" - -#: src/reduce.c:397 -#, c-format -msgid "%d useless nonterminal" -msgid_plural "%d useless nonterminals" -msgstr[0] "%d beskorisan nezavr¹ni znak" -msgstr[1] "%d beskorisnih nezavr¹nih znakova" - -#: src/reduce.c:403 -#, c-format -msgid " and " -msgstr " i" - -#: src/reduce.c:406 -#, c-format -msgid "%d useless rule" -msgid_plural "%d useless rules" -msgstr[0] "%d beskorisno pravilo" -msgstr[1] "%d beskorisnih pravila" - -#: src/reduce.c:436 -#, fuzzy, c-format -msgid "start symbol %s does not derive any sentence" -msgstr "Poèetni simbol %s ne daje niti jednu reèenicu" - -#: src/scan-gram.l:162 -msgid "stray `,' treated as white space" -msgstr "" - -#: src/scan-gram.l:225 -#, fuzzy, c-format -msgid "invalid directive: %s" -msgstr "nedozvoljeni ulaz: %s" - -#: src/scan-gram.l:283 -#, fuzzy, c-format -msgid "invalid character: %s" -msgstr "nepoznati znak: %s" - -#: src/scan-gram.l:402 -#, fuzzy -msgid "invalid null character" -msgstr "nedozvoljena %s deklaracija" - -#: src/scan-gram.l:415 src/scan-gram.l:427 src/scan-gram.l:448 -#, fuzzy, c-format -msgid "invalid escape sequence: %s" -msgstr "nedozvoljeni ulaz: %s" - -#: src/scan-gram.l:417 src/scan-gram.l:429 src/scan-gram.l:450 -#, fuzzy, c-format -msgid "invalid null character: %s" -msgstr "nedozvoljeni ulaz: %s" - -#: src/scan-gram.l:455 -#, fuzzy, c-format -msgid "unrecognized escape sequence: %s" -msgstr "neprepoznati: %s" - -#: src/scan-gram.l:537 -#, c-format -msgid "missing `{' in `%s'" -msgstr "" - -#: src/scan-gram.l:782 -#, c-format -msgid "$$ of `%s' has no declared type" -msgstr "$$ od `%s' nema deklarirani tip" - -#: src/scan-gram.l:803 -#, c-format -msgid "$%d of `%s' has no declared type" -msgstr "$%d od `%s' nema deklarirani tip" - -#: src/scan-gram.l:812 src/scan-gram.l:881 src/scan-gram.l:932 -#, c-format -msgid "integer out of range: %s" -msgstr "" - -#: src/scan-gram.l:848 src/scan-gram.l:916 -#, fuzzy, c-format -msgid "invalid value: %s" -msgstr "nedozvoljena $ vrijednost" - -#: src/scan-gram.l:1036 -#, fuzzy, c-format -msgid "missing `%s' at end of file" -msgstr "nezavr¹eni znakovni niz na kraju datoteke" - -#: src/scan-gram.l:1047 -#, fuzzy, c-format -msgid "missing `%s' at end of line" -msgstr "nezavr¹eni znakovni niz na kraju datoteke" - -#: src/symlist.c:97 src/symlist.c:108 -msgid "invalid $ value" -msgstr "nedozvoljena $ vrijednost" - -#: src/symtab.c:85 -#, c-format -msgid "type redeclaration for %s" -msgstr "ponovna deklaracija za %s" - -#: src/symtab.c:102 src/symtab.c:120 -#, fuzzy, c-format -msgid "%s redeclaration for %s" -msgstr "ponovna deklaracija za %s" - -#: src/symtab.c:139 -#, c-format -msgid "redefining precedence of %s" -msgstr "ponovno definiran prethodnik od %s" - -#: src/symtab.c:157 -#, c-format -msgid "symbol %s redefined" -msgstr "simbol %s ponovo definiran" - -#: src/symtab.c:180 -#, fuzzy, c-format -msgid "redefining user token number of %s" -msgstr "ponovno definiran prethodnik od %s" - -#: src/symtab.c:207 -#, c-format -msgid "symbol %s is used, but is not defined as a token and has no rules" -msgstr "simbol %s je kori¹ten, ali nije definiran kao znak i nema pravila" - -#: src/symtab.c:232 -#, c-format -msgid "symbol `%s' used more than once as a literal string" -msgstr "simbol `%s' kori¹ten vi¹e puta kao znakovni niz" - -#: src/symtab.c:235 -#, c-format -msgid "symbol `%s' given more than one literal string" -msgstr "simbolz `%s' dat vi¹e od jednog znakovnog niza" - -#: src/symtab.c:271 -#, c-format -msgid "conflicting precedences for %s and %s" -msgstr "konflikt u prethodnici za %s and %s" - -#: src/symtab.c:283 -#, fuzzy, c-format -msgid "conflicting associativities for %s (%s) and %s (%s)" -msgstr "konfliktne asocijativne vrijednosti za %s i %s" - -#: src/symtab.c:368 -#, c-format -msgid "tokens %s and %s both assigned number %d" -msgstr "objema znakovima %s i %s je pridru¾en broj %d" - -#: src/symtab.c:591 -#, c-format -msgid "the start symbol %s is undefined" -msgstr "poèetni simbol %s nije definiran" - -#: src/symtab.c:595 -#, c-format -msgid "the start symbol %s is a token" -msgstr "poèetni simbol %s je znak" - -#: lib/argmatch.c:133 -#, fuzzy, c-format -msgid "invalid argument %s for %s" -msgstr "nedozvoljeni ulaz: %s" - -#: lib/argmatch.c:134 -#, c-format -msgid "ambiguous argument %s for %s" -msgstr "" - -#: lib/argmatch.c:153 -#, c-format -msgid "Valid arguments are:" -msgstr "" - -#: lib/bitset_stats.c:179 -#, c-format -msgid "%u bitset_allocs, %u freed (%.2f%%).\n" -msgstr "" - -#: lib/bitset_stats.c:182 -#, c-format -msgid "%u bitset_sets, %u cached (%.2f%%)\n" -msgstr "" - -#: lib/bitset_stats.c:185 -#, c-format -msgid "%u bitset_resets, %u cached (%.2f%%)\n" -msgstr "" - -#: lib/bitset_stats.c:188 -#, c-format -msgid "%u bitset_tests, %u cached (%.2f%%)\n" -msgstr "" - -#: lib/bitset_stats.c:192 -#, c-format -msgid "%u bitset_lists\n" -msgstr "" - -#: lib/bitset_stats.c:194 -msgid "count log histogram\n" -msgstr "" - -#: lib/bitset_stats.c:197 -msgid "size log histogram\n" -msgstr "" - -#: lib/bitset_stats.c:200 -msgid "density histogram\n" -msgstr "" - -#: lib/bitset_stats.c:214 -#, c-format -msgid "" -"Bitset statistics:\n" -"\n" -msgstr "" - -#: lib/bitset_stats.c:217 -#, c-format -msgid "Accumulated runs = %u\n" -msgstr "" - -#: lib/bitset_stats.c:261 lib/bitset_stats.c:266 -msgid "Could not read stats file." -msgstr "" - -#: lib/bitset_stats.c:263 -#, c-format -msgid "Bad stats file size.\n" -msgstr "" - -#: lib/bitset_stats.c:289 lib/bitset_stats.c:291 -msgid "Could not write stats file." -msgstr "" - -#: lib/bitset_stats.c:294 -msgid "Could not open stats file for writing." -msgstr "" - -#: lib/error.c:127 -msgid "Unknown system error" -msgstr "Nepoznata sistemska gre¹ka" - -#: lib/getopt.c:570 lib/getopt.c:589 -#, c-format -msgid "%s: option `%s' is ambiguous\n" -msgstr "%s: opcija `%s' je nejednoznaèna\n" - -#: lib/getopt.c:622 lib/getopt.c:626 -#, c-format -msgid "%s: option `--%s' doesn't allow an argument\n" -msgstr "%s: opcija `--%s' ne dopu¹ta argument\n" - -#: lib/getopt.c:635 lib/getopt.c:640 -#, c-format -msgid "%s: option `%c%s' doesn't allow an argument\n" -msgstr "%s: opcija `%c%s' ne dopu¹ta argument\n" - -#: lib/getopt.c:686 lib/getopt.c:708 lib/getopt.c:1039 lib/getopt.c:1061 -#, c-format -msgid "%s: option `%s' requires an argument\n" -msgstr "%s: opcija `%s' zahtijeva argument\n" - -#: lib/getopt.c:746 lib/getopt.c:749 -#, c-format -msgid "%s: unrecognized option `--%s'\n" -msgstr "%s: neprepoznata opcija `--%s'\n" - -#: lib/getopt.c:757 lib/getopt.c:760 -#, c-format -msgid "%s: unrecognized option `%c%s'\n" -msgstr "%s: neprepoznata opcija `%c%s'\n" - -#: lib/getopt.c:815 lib/getopt.c:818 -#, c-format -msgid "%s: illegal option -- %c\n" -msgstr "%s: nedozvoljena opcija -- %c\n" - -#: lib/getopt.c:824 lib/getopt.c:827 -#, c-format -msgid "%s: invalid option -- %c\n" -msgstr "%s: nedozvoljena opcija -- %c\n" - -#: lib/getopt.c:882 lib/getopt.c:901 lib/getopt.c:1114 lib/getopt.c:1135 -#, c-format -msgid "%s: option requires an argument -- %c\n" -msgstr "%s: opcija zahtijeva argument -- %c\n" - -#: lib/getopt.c:954 lib/getopt.c:973 -#, c-format -msgid "%s: option `-W %s' is ambiguous\n" -msgstr "%s: opcija `-W %s' je nejednoznaèna\n" - -#: lib/getopt.c:997 lib/getopt.c:1018 -#, c-format -msgid "%s: option `-W %s' doesn't allow an argument\n" -msgstr "%s: opcija `-W %s' ne dopu¹ta argument\n" - -#: lib/obstack.c:417 lib/obstack.c:420 lib/xmalloc.c:53 -msgid "memory exhausted" -msgstr "iscrpljeni memorijski resursi" - -#: lib/quotearg.c:238 -msgid "`" -msgstr "`" - -#: lib/quotearg.c:239 -msgid "'" -msgstr "'" - -#: lib/subpipe.c:171 -#, c-format -msgid "subsidiary program `%s' could not be invoked" -msgstr "" - -#: lib/subpipe.c:173 -#, c-format -msgid "subsidiary program `%s' not found" -msgstr "" - -#: lib/subpipe.c:175 -#, c-format -msgid "subsidiary program `%s' failed" -msgstr "" - -#: lib/subpipe.c:176 -#, c-format -msgid "subsidiary program `%s' failed (exit status %d)" -msgstr "" - -#: lib/timevar.c:475 -msgid "" -"\n" -"Execution times (seconds)\n" -msgstr "" - -#: lib/timevar.c:525 -msgid " TOTAL :" -msgstr "" - -#: lib/timevar.c:561 -#, c-format -msgid "time in %s: %ld.%06ld (%ld%%)\n" -msgstr "" - -#~ msgid "too many states (max %d)" -#~ msgstr "previ¹e stanja (maks %d)" - -#~ msgid "reduce" -#~ msgstr "reduciraj" - -#~ msgid "shift" -#~ msgstr "pomakni" - -#~ msgid "%d shift/reduce conflict" -#~ msgid_plural "%d shift/reduce conflicts" -#~ msgstr[0] "%d pomakni/reduciraj konflikat" -#~ msgstr[1] "%d pomakni/reduciraj konflikata" - -#~ msgid "and" -#~ msgstr "i" - -#~ msgid "State %d contains " -#~ msgstr "Stanje %d sadr¾i" - -#~ msgid "conflicts: " -#~ msgstr "konflikt:" - -#~ msgid "%s contains " -#~ msgstr "%s sadr¾i" - -#~ msgid " %-4s\t[reduce using rule %d (%s)]\n" -#~ msgstr " %-4s\t[reduciraj koristeæi pravilo %d (%s)]\n" - -#~ msgid "" -#~ " $default\treduce using rule %d (%s)\n" -#~ "\n" -#~ msgstr "" -#~ " $default\treduciraj koristeæi pravilo %d (%s)\n" -#~ "\n" - -#~ msgid " %-4s\treduce using rule %d (%s)\n" -#~ msgstr " %-4s\treduciraj koristeæi pravilo %d (%s)\n" - -#~ msgid " $default\treduce using rule %d (%s)\n" -#~ msgstr " $default\treduciraj koristeæi pravilo %d (%s)\n" - -#~ msgid "`%s' is no longer supported" -#~ msgstr "`%s' vi¹e nije podr¾ano" - -#~ msgid "%s: no grammar file given\n" -#~ msgstr "%s: nije data datoteka sa gramatikom\n" - -#~ msgid "%s: extra arguments ignored after `%s'\n" -#~ msgstr "%s: dodatni argumenti se ignoriraju nakon `%s'\n" - -#~ msgid "too many gotos (max %d)" -#~ msgstr "previ¹e goto-a (maksimalno %d)" - -#~ msgid "unexpected `/' found and ignored" -#~ msgstr "neoèekivan `/' naðen i zanemaren" - -#~ msgid "unterminated comment" -#~ msgstr "nezavr¹eni komentar" - -#~ msgid "unexpected end of file" -#~ msgstr "neoèekivan kraj datoteke" - -#~ msgid "unescaped newline in constant" -#~ msgstr "neoèekivan znak za novu liniju u konstanti" - -#~ msgid "octal value outside range 0...255: `\\%o'" -#~ msgstr "oktalna vrijednost izvan dosega 0...255: `\\%o'" - -#~ msgid "hexadecimal value above 255: `\\x%x'" -#~ msgstr "heksadecimalna vrijednost vi¹a od 255: `\\x%x'" - -#~ msgid "unknown escape sequence: `\\' followed by `%s'" -#~ msgstr "nepoznata escape sekvenca: `\\' koju slijedi `%s'" - -#~ msgid "unterminated type name at end of file" -#~ msgstr "nezavr¹eno ime tipa pri kraju datoteke" - -#~ msgid "unterminated type name" -#~ msgstr "nezavr¹eno ime tipa" - -#~ msgid "use \"...\" for multi-character literal tokens" -#~ msgstr "koristi \"...\" za vi¹ebajtne znakove" - -#~ msgid "`%s' supports no argument: %s" -#~ msgstr "`%s' ne podr¾ava argument: %s" - -#~ msgid "`%s' requires an argument" -#~ msgstr "`%s' zahtijeva argument" - -#~ msgid "maximum table size (%d) exceeded" -#~ msgstr "maksimalna velièina tablice (%d) prekoraèena" - -#~ msgid " (rule %d)" -#~ msgstr " (pravilo %d)" - -#~ msgid " $default\taccept\n" -#~ msgstr " $default\tprihvati\n" - -#~ msgid " NO ACTIONS\n" -#~ msgstr " NEMA AKCIJA\n" - -#~ msgid " %-4s\terror (nonassociative)\n" -#~ msgstr " %-4s\tgre¹ka (nonassociative)\n" - -#~ msgid " %-4s\tgo to state %d\n" -#~ msgstr " %-4s\tidu u stanje %d\n" - -#~ msgid "Number, Line, Rule" -#~ msgstr "Broj, Linija, Pravilo" - -#~ msgid " %3d %3d %s ->" -#~ msgstr " %3d %3d %s ->" - -#~ msgid " Skipping to next \\n" -#~ msgstr " Preskaèem na slijedeæe \\n" - -#~ msgid " Skipping to next %c" -#~ msgstr " Preskaèem na slijedeæi %c" - -#~ msgid "unterminated string" -#~ msgstr "nezavr¹eni znakovni niz" - -#~ msgid "invalid @ value" -#~ msgstr "nedozvoljena @ vrijednost" - -#~ msgid "%s is invalid" -#~ msgstr "%s je nedozvoljeno" - -#~ msgid "unterminated `%{' definition" -#~ msgstr "nezavr¹ena `%{' definicija" - -#~ msgid "Premature EOF after %s" -#~ msgstr "Preuranjeni EOF nakon %s" - -#~ msgid "`%s' is invalid in %s" -#~ msgstr "`%s' je nedozvoljen u %s" - -#~ msgid "%type declaration has no " -#~ msgstr "%type deklaracija nema " - -#~ msgid "invalid %%type declaration due to item: %s" -#~ msgstr "nedozvoljena %%type deklaracija zbog: %s" - -#~ msgid "invalid text (%s) - number should be after identifier" -#~ msgstr "nedozvoljeno tekst (%s) - broj bi trebao biti nakon identifikatora" - -#~ msgid "unexpected item: %s" -#~ msgstr "neoèekivani: %s" - -#~ msgid "unmatched %s" -#~ msgstr "nije pronaðen %s" - -#~ msgid "argument of %%expect is not an integer" -#~ msgstr "argument od %%expect nije cijeli broj" - -#~ msgid "unrecognized item %s, expected an identifier" -#~ msgstr "neprepoznati %s, oèekivan nakon identifikatora" - -#~ msgid "expected string constant instead of %s" -#~ msgstr "oèekivana znakovna konstana umjesto %s" - -#~ msgid "no input grammar" -#~ msgstr "nema ulazne gramatike" - -#~ msgid "unterminated %guard clause" -#~ msgstr "nezavr¹ena %guard klauzula" - -#~ msgid "ill-formed rule: initial symbol not followed by colon" -#~ msgstr "lo¹e pravilo: zarez ne bi trebao slijediti poèetni simbol" - -#~ msgid "grammar starts with vertical bar" -#~ msgstr "gramatika poèinje sa okomitom crtom" - -#~ msgid "previous rule lacks an ending `;'" -#~ msgstr "prethodnom pravilu nedostaje zavr¹etak `;'" - -#~ msgid "two @prec's in a row" -#~ msgstr "dva @prec's u retku" - -#~ msgid "%%guard present but %%semantic_parser not specified" -#~ msgstr "%%guard prisutan ali %%semantic_parser nije specificiran" - -#~ msgid "two actions at end of one rule" -#~ msgstr "dvije akcije pri kraju jednog pravila" - -#~ msgid "too many symbols (tokens plus nonterminals); maximum %d" -#~ msgstr "previ¹e simbola (znakovi plus nezavr¹ni znakovi); maksimalno %d" diff --git a/src/bin/bison/po/id.gmo b/src/bin/bison/po/id.gmo deleted file mode 100644 index bc0b049e52..0000000000 Binary files a/src/bin/bison/po/id.gmo and /dev/null differ diff --git a/src/bin/bison/po/id.po b/src/bin/bison/po/id.po deleted file mode 100644 index 54e86af681..0000000000 --- a/src/bin/bison/po/id.po +++ /dev/null @@ -1,750 +0,0 @@ -# bison 1.875 (Indonesian) -# Copyright (C) 2002 Free Software Foundation, Inc. -# This file is distributed under the same license as the bison 1.50 package. -# Tedi Heriyanto , 2002, 2003 -# -msgid "" -msgstr "" -"Project-Id-Version: bison 1.875\n" -"Report-Msgid-Bugs-To: bug-bison@gnu.org\n" -"POT-Creation-Date: 2004-05-21 10:26-0700\n" -"PO-Revision-Date: 2003-01-07 13:25GMT+0700\n" -"Last-Translator: Tedi Heriyanto \n" -"Language-Team: Indonesian \n" -"MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=UTF-8\n" -"Content-Transfer-Encoding: 8bit\n" -"Plural-Forms: nplurals=1; plural=0;\n" -"X-Generator: KBabel 0.9.6\n" - -#: src/complain.c:51 src/complain.c:66 -msgid "warning: " -msgstr "peringatan: " - -#: src/complain.c:122 src/complain.c:138 -msgid "fatal error: " -msgstr "kesalahan fatal: " - -#: src/conflicts.c:76 -#, c-format -msgid " Conflict between rule %d and token %s resolved as shift" -msgstr " Konflik antara aturan %d dan token %s diselesaikan sebagai shift" - -#: src/conflicts.c:84 -#, c-format -msgid " Conflict between rule %d and token %s resolved as reduce" -msgstr " Konflik antara aturan %d dan token %s diselesaikan sebagai reduce" - -#: src/conflicts.c:91 -#, c-format -msgid " Conflict between rule %d and token %s resolved as an error" -msgstr "" -" Konflik antara aturan %d dan token %s diselesaikan sebagai kesalahan" - -#: src/conflicts.c:399 -#, c-format -msgid "conflicts: %d shift/reduce, %d reduce/reduce\n" -msgstr "konflik: %d geser/kurangi, %d kurangi/kurangi\n" - -#: src/conflicts.c:402 -#, c-format -msgid "conflicts: %d shift/reduce\n" -msgstr "konflik: %d geser/kurangi\n" - -#: src/conflicts.c:404 -#, c-format -msgid "conflicts: %d reduce/reduce\n" -msgstr "konflik: %d kurangi/kurangi\n" - -#: src/conflicts.c:422 -#, c-format -msgid "State %d " -msgstr "State %d " - -#: src/conflicts.c:487 -#, fuzzy, c-format -msgid "%%expect-rr applies only to GLR parsers" -msgstr "%s hanya mempengaruhi parser GLR" - -#: src/conflicts.c:511 -#, c-format -msgid "expected %d shift/reduce conflict" -msgid_plural "expected %d shift/reduce conflicts" -msgstr[0] "mengharapkan %d shift/reduce konflik" -msgstr[1] "mengharapkan %d shift/reduce konflik" - -#: src/conflicts.c:515 -#, fuzzy, c-format -msgid "expected %d reduce/reduce conflict" -msgid_plural "expected %d reduce/reduce conflicts" -msgstr[0] "diharapkan 0 kurangi/kurangi konflik" - -#: src/files.c:100 -#, c-format -msgid "cannot open file `%s'" -msgstr "tidak dapat membuka file `%s'" - -#: src/files.c:116 -msgid "I/O error" -msgstr "Kesalahan I/O" - -#: src/files.c:119 -msgid "cannot close file" -msgstr "tidak dapat menutup file" - -#: src/files.c:337 -#, c-format -msgid "conflicting outputs to file %s" -msgstr "output konflik ke file %s" - -#: src/getargs.c:186 -#, c-format -msgid "Try `%s --help' for more information.\n" -msgstr "Coba `%s --help' untuk informasi lebih lanjut.\n" - -#: src/getargs.c:192 -msgid "GNU bison generates parsers for LALR(1) grammars.\n" -msgstr "GNU bison generates parsers for LALR(1) grammars.\n" - -#: src/getargs.c:196 -#, c-format -msgid "Usage: %s [OPTION]... FILE\n" -msgstr "Penggunaan: %s [OPTION]... FILE\n" - -#: src/getargs.c:200 -msgid "" -"If a long option shows an argument as mandatory, then it is mandatory\n" -"for the equivalent short option also. Similarly for optional arguments.\n" -msgstr "" -"Jika option panjang menyatakan argumen sebagai mandatori, maka ia mandatori " -"juga\n" -"untuk option pendek. Hal yang sama untuk argumen opsional.\n" - -#: src/getargs.c:206 -msgid "" -"Operation modes:\n" -" -h, --help display this help and exit\n" -" -V, --version output version information and exit\n" -" -y, --yacc emulate POSIX yacc\n" -msgstr "" -"Mode Operasi:\n" -" -h, --help tampilkan bantuan ini dan keluar\n" -" -V, --version tampilkan informasi versi dan keluar\n" -" -y, --yacc emulasikan POSIX yacc\n" - -#: src/getargs.c:213 -msgid "" -"Parser:\n" -" -S, --skeleton=FILE specify the skeleton to use\n" -" -t, --debug instrument the parser for debugging\n" -" --locations enable locations computation\n" -" -p, --name-prefix=PREFIX prepend PREFIX to the external symbols\n" -" -l, --no-lines don't generate `#line' directives\n" -" -n, --no-parser generate the tables only\n" -" -k, --token-table include a table of token names\n" -msgstr "" -"Parser:\n" -" -S, --skeleton=FILE specifikasikan rangka yang akan digunakan\n" -" -t, --debug instrumen parser untuk debugging\n" -" --locations aktifkan lokasi perhitungan\n" -" -p, --name-prefix=PREFIX tambahkan PREFIX ke simbol eksternal\n" -" -l, --no-lines jangan hasilkan direktiv `#line'\n" -" -n, --no-parser hasilkan hanya tabel\n" -" -k, --token-table sertakan tabel nama token\n" - -#: src/getargs.c:225 -msgid "" -"Output:\n" -" -d, --defines also produce a header file\n" -" -r, --report=THINGS also produce details on the automaton\n" -" -v, --verbose same as `--report=state'\n" -" -b, --file-prefix=PREFIX specify a PREFIX for output files\n" -" -o, --output=FILE leave output to FILE\n" -" -g, --graph also produce a VCG description of the " -"automaton\n" -msgstr "" -"Output:\n" -" -d, --defines juga hasilkan file header\n" -" -r, --report=THINGS juga hasilkan detil tentang otomaton\n" -" -v, --verbose sama seperti `--report=state'\n" -" -b, --file-prefix=PREFIX spesifikasikan PREFIX untuk file output\n" -" -o, --output=FILE simpan output ke FILE\n" -" -g, --graph juga hasilkan deskripsi VCG automaton\n" - -#: src/getargs.c:236 -msgid "" -"THINGS is a list of comma separated words that can include:\n" -" `state' describe the states\n" -" `itemset' complete the core item sets with their closure\n" -" `lookahead' explicitly associate lookaheads to items\n" -" `solved' describe shift/reduce conflicts solving\n" -" `all' include all the above information\n" -" `none' disable the report\n" -msgstr "" -"THINGS adalah daftar kata yang dipisahkan koma termasuk:\n" -" `state' menggambarkan state\n" -" `itemset' lengkapi himpunan item inti dengan klosurnya\n" -" `lookahead' asosiasikan lookaheads ke items secara eksplisit\n" -" `solved' gambarkan penyelesaian konflik shift/reduce\n" -" `all' sertakan semua informasi di atas\n" -" `none' tiadakan laporan\n" - -#: src/getargs.c:247 -msgid "Report bugs to .\n" -msgstr "Laporkan kesalahan ke .\n" - -#: src/getargs.c:264 -#, c-format -msgid "bison (GNU Bison) %s" -msgstr "bison (GNU Bison) %s" - -#: src/getargs.c:266 -msgid "Written by Robert Corbett and Richard Stallman.\n" -msgstr "Written by Robert Corbett and Richard Stallman.\n" - -#: src/getargs.c:270 -#, c-format -msgid "Copyright (C) %d Free Software Foundation, Inc.\n" -msgstr "Copyright (C) %d Free Software Foundation, Inc.\n" - -#: src/getargs.c:272 -msgid "" -"This is free software; see the source for copying conditions. There is NO\n" -"warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n" -msgstr "" -"This is free software; see the source for copying conditions. There is NO\n" -"warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n" - -#: src/getargs.c:438 -#, c-format -msgid "missing operand after `%s'" -msgstr "operand hilang setelah `%s'" - -#: src/getargs.c:440 -#, c-format -msgid "extra operand `%s'" -msgstr "operand ekstra `%s'" - -#: src/gram.c:139 -msgid "empty" -msgstr "kosong" - -#: src/gram.c:233 -msgid "Grammar" -msgstr "Grammar" - -#: src/gram.c:321 src/reduce.c:394 -msgid "warning" -msgstr "peringatan" - -#: src/main.c:124 -msgid "rule never reduced because of conflicts" -msgstr "aturan tidak pernah dikurangi karena konflik" - -#: src/parse-gram.y:363 -msgid "POSIX forbids declarations in the grammar" -msgstr "POSIX melarang deklarasi dalam grammar" - -#: src/parse-gram.y:486 -msgid "missing identifier in parameter declaration" -msgstr "identifier tidak ada dalam deklarasi parameter" - -#: src/print.c:49 -#, c-format -msgid " type %d is %s\n" -msgstr " tipe %d adalah %s\n" - -#: src/print.c:165 -#, c-format -msgid "shift, and go to state %d\n" -msgstr "geser, dan ke state %d\n" - -#: src/print.c:167 -#, c-format -msgid "go to state %d\n" -msgstr "ke state %d\n" - -#: src/print.c:204 -msgid "error (nonassociative)\n" -msgstr "kesalahan(nonasosiatif)\n" - -#: src/print.c:292 -#, c-format -msgid "reduce using rule %d (%s)" -msgstr "kurangi gunakan aturan %d (%s)" - -#: src/print.c:294 -#, c-format -msgid "accept" -msgstr "terima" - -#: src/print.c:325 src/print.c:391 -msgid "$default" -msgstr "$default" - -#: src/print.c:420 -#, c-format -msgid "state %d" -msgstr "state %d" - -#: src/print.c:456 -msgid "Terminals, with rules where they appear" -msgstr "Terminal, dengan aturan tempat mereka muncul" - -#: src/print.c:483 -msgid "Nonterminals, with rules where they appear" -msgstr "Nonterminal, dengan aturan tempat mereka muncul" - -#: src/print.c:512 -#, c-format -msgid " on left:" -msgstr " di kiri:" - -#: src/print.c:527 -#, c-format -msgid " on right:" -msgstr " di kanan:" - -#: src/print.c:555 -msgid "Rules never reduced" -msgstr "Aturan tidak pernah dikurangi" - -#: src/reader.c:56 -#, c-format -msgid "multiple %s declarations" -msgstr "deklarasi ganda %s" - -#: src/reader.c:118 -#, c-format -msgid "result type clash on merge function %s: <%s> != <%s>" -msgstr "tipe hasil bentrok pada fungsi merge %s: <%s> != <%s>" - -#: src/reader.c:216 -#, c-format -msgid "rule given for %s, which is a token" -msgstr "aturan diberikan untuk %s, yang merupakan sebuah token" - -#: src/reader.c:245 -#, c-format -msgid "type clash on default action: <%s> != <%s>" -msgstr "bentrokan tipe pada aksi baku: <%s> != <%s>" - -#: src/reader.c:251 -msgid "empty rule for typed nonterminal, and no action" -msgstr "aturan kosong untuk nonterminal typed, dan tidak ada aksi" - -#: src/reader.c:321 src/reader.c:335 src/reader.c:348 -#, c-format -msgid "only one %s allowed per rule" -msgstr "hanya satu %s yang dibolehkan per aturan" - -#: src/reader.c:331 src/reader.c:346 -#, c-format -msgid "%s affects only GLR parsers" -msgstr "%s hanya mempengaruhi parser GLR" - -#: src/reader.c:333 -#, c-format -msgid "%s must be followed by positive number" -msgstr "%s harus diikuti angka positif" - -#: src/reader.c:490 -msgid "no rules in the input grammar" -msgstr "tidak ada aturan dalam grammar input" - -#: src/reduce.c:242 -msgid "useless rule" -msgstr "aturan tidak berguna" - -#: src/reduce.c:303 -#, c-format -msgid "useless nonterminal: %s" -msgstr "nonterminal tidak berguna: %s" - -#: src/reduce.c:351 -msgid "Useless nonterminals" -msgstr "Nonterminal tidak berguna" - -#: src/reduce.c:364 -msgid "Terminals which are not used" -msgstr "Terminal yang tidak digunakan" - -#: src/reduce.c:373 -msgid "Useless rules" -msgstr "Useless rules" - -#: src/reduce.c:389 -#, c-format -msgid "%d rule never reduced\n" -msgid_plural "%d rules never reduced\n" -msgstr[0] "Aturan %d tidak pernah dikurangi\n" -msgstr[1] "Aturan %d tidak pernah dikurangi\n" - -#: src/reduce.c:397 -#, c-format -msgid "%d useless nonterminal" -msgid_plural "%d useless nonterminals" -msgstr[0] "nonterminal tidak berguna %d" -msgstr[1] "nonterminal tidak berguna %d" - -#: src/reduce.c:403 -#, c-format -msgid " and " -msgstr " dan " - -#: src/reduce.c:406 -#, c-format -msgid "%d useless rule" -msgid_plural "%d useless rules" -msgstr[0] "aturan tidak berguna %d" -msgstr[1] "aturan tidak berguna %d" - -#: src/reduce.c:436 -#, c-format -msgid "start symbol %s does not derive any sentence" -msgstr "simbol awal %s tidak melahirkan kalimat" - -#: src/scan-gram.l:162 -msgid "stray `,' treated as white space" -msgstr "stray `,' dianggap sebagai white space" - -#: src/scan-gram.l:225 -#, c-format -msgid "invalid directive: %s" -msgstr "direktif tidak valid: %s" - -#: src/scan-gram.l:283 -#, c-format -msgid "invalid character: %s" -msgstr "karakter tidak valid: %s" - -#: src/scan-gram.l:402 -#, fuzzy -msgid "invalid null character" -msgstr "karakter tidak valid: %s" - -#: src/scan-gram.l:415 src/scan-gram.l:427 src/scan-gram.l:448 -#, c-format -msgid "invalid escape sequence: %s" -msgstr "urutan escape tidak valid: %s" - -#: src/scan-gram.l:417 src/scan-gram.l:429 src/scan-gram.l:450 -#, fuzzy, c-format -msgid "invalid null character: %s" -msgstr "karakter tidak valid: %s" - -#: src/scan-gram.l:455 -#, c-format -msgid "unrecognized escape sequence: %s" -msgstr "urutan escape tidak dikenal: %s" - -#: src/scan-gram.l:537 -#, c-format -msgid "missing `{' in `%s'" -msgstr "hilang `{' dalam `%s'" - -#: src/scan-gram.l:782 -#, c-format -msgid "$$ of `%s' has no declared type" -msgstr "$$ dari `%s' tidak memiliki tipe yang terdeklarasi" - -#: src/scan-gram.l:803 -#, c-format -msgid "$%d of `%s' has no declared type" -msgstr "$%d dari `%s' tidak memiliki tipe terdeklarasi" - -#: src/scan-gram.l:812 src/scan-gram.l:881 src/scan-gram.l:932 -#, c-format -msgid "integer out of range: %s" -msgstr "integer ke luar batas: %s" - -#: src/scan-gram.l:848 src/scan-gram.l:916 -#, c-format -msgid "invalid value: %s" -msgstr "nilai tidak valid: %s" - -#: src/scan-gram.l:1036 -#, c-format -msgid "missing `%s' at end of file" -msgstr "`%s' hilang di akhir file" - -#: src/scan-gram.l:1047 -#, fuzzy, c-format -msgid "missing `%s' at end of line" -msgstr "`%s' hilang di akhir file" - -#: src/symlist.c:97 src/symlist.c:108 -msgid "invalid $ value" -msgstr "nilai $ tidak valid" - -#: src/symtab.c:85 -#, c-format -msgid "type redeclaration for %s" -msgstr "redeklarasi tipe untuk %s" - -#: src/symtab.c:102 src/symtab.c:120 -#, c-format -msgid "%s redeclaration for %s" -msgstr "%s redeklarasi untuk %s" - -#: src/symtab.c:139 -#, c-format -msgid "redefining precedence of %s" -msgstr "mendefinisikan kembali presedens %s" - -#: src/symtab.c:157 -#, c-format -msgid "symbol %s redefined" -msgstr "simbol %s didefinisikan ulang" - -#: src/symtab.c:180 -#, c-format -msgid "redefining user token number of %s" -msgstr "mendefinisikan ulang nomor token user %s" - -#: src/symtab.c:207 -#, c-format -msgid "symbol %s is used, but is not defined as a token and has no rules" -msgstr "" -"simbol %s digunakan, namun tidak didefinisikan sebagai token dan tidak " -"memiliki aturan" - -#: src/symtab.c:232 -#, c-format -msgid "symbol `%s' used more than once as a literal string" -msgstr "simbol `%s' digunakan lebih dari satu kali sebagai string literal" - -#: src/symtab.c:235 -#, c-format -msgid "symbol `%s' given more than one literal string" -msgstr "simbol `%s' diberikan lebih dari satu string literal" - -#: src/symtab.c:271 -#, c-format -msgid "conflicting precedences for %s and %s" -msgstr "presenden konflik untuk %s dan %s" - -#: src/symtab.c:283 -#, c-format -msgid "conflicting associativities for %s (%s) and %s (%s)" -msgstr "asosiatif konflik untuk %s (%s) dan %s (%s)" - -#: src/symtab.c:368 -#, c-format -msgid "tokens %s and %s both assigned number %d" -msgstr "token %s dan %s keduanya memiliki angka %d" - -#: src/symtab.c:591 -#, c-format -msgid "the start symbol %s is undefined" -msgstr "simbol awal %s tidak didefinisikan" - -#: src/symtab.c:595 -#, c-format -msgid "the start symbol %s is a token" -msgstr "simbol awal %s adalah sebuah token" - -#: lib/argmatch.c:133 -#, c-format -msgid "invalid argument %s for %s" -msgstr "argument %s tidak valid untuk %s" - -#: lib/argmatch.c:134 -#, c-format -msgid "ambiguous argument %s for %s" -msgstr "argumen %s ambigu untuk %s" - -#: lib/argmatch.c:153 -#, c-format -msgid "Valid arguments are:" -msgstr "Argumen valid adalah:" - -#: lib/bitset_stats.c:179 -#, c-format -msgid "%u bitset_allocs, %u freed (%.2f%%).\n" -msgstr "%u bitset_allocs, %u freed (%.2f%%).\n" - -#: lib/bitset_stats.c:182 -#, c-format -msgid "%u bitset_sets, %u cached (%.2f%%)\n" -msgstr "%u bitset_sets, %u cached (%.2f%%)\n" - -#: lib/bitset_stats.c:185 -#, c-format -msgid "%u bitset_resets, %u cached (%.2f%%)\n" -msgstr "%u bitset_resets, %u cached (%.2f%%)\n" - -#: lib/bitset_stats.c:188 -#, c-format -msgid "%u bitset_tests, %u cached (%.2f%%)\n" -msgstr "%u bitset_tests, %u cached (%.2f%%)\n" - -#: lib/bitset_stats.c:192 -#, c-format -msgid "%u bitset_lists\n" -msgstr "%u bitset_lists\n" - -#: lib/bitset_stats.c:194 -msgid "count log histogram\n" -msgstr "hitung log histogram\n" - -#: lib/bitset_stats.c:197 -msgid "size log histogram\n" -msgstr "ukuran log histogram\n" - -#: lib/bitset_stats.c:200 -msgid "density histogram\n" -msgstr "kepadatan histogram\n" - -#: lib/bitset_stats.c:214 -#, c-format -msgid "" -"Bitset statistics:\n" -"\n" -msgstr "" -"Statistik bitset:\n" -"\n" - -#: lib/bitset_stats.c:217 -#, c-format -msgid "Accumulated runs = %u\n" -msgstr "Run terakumulasi = %u\n" - -#: lib/bitset_stats.c:261 lib/bitset_stats.c:266 -msgid "Could not read stats file." -msgstr "Tidak dapat membaca file stat." - -#: lib/bitset_stats.c:263 -#, c-format -msgid "Bad stats file size.\n" -msgstr "Ukuran file stat buruk.\n" - -#: lib/bitset_stats.c:289 lib/bitset_stats.c:291 -msgid "Could not write stats file." -msgstr "Tidak dapat menulis file stat." - -#: lib/bitset_stats.c:294 -msgid "Could not open stats file for writing." -msgstr "Tidak dapat membuka file stat untuk ditulisi." - -#: lib/error.c:127 -msgid "Unknown system error" -msgstr "Kesalahan sistem tidak dikenal" - -#: lib/getopt.c:570 lib/getopt.c:589 -#, c-format -msgid "%s: option `%s' is ambiguous\n" -msgstr "%s: option `%s' ambigu\n" - -#: lib/getopt.c:622 lib/getopt.c:626 -#, c-format -msgid "%s: option `--%s' doesn't allow an argument\n" -msgstr "%s: option `--%s' tidak membolehkan sebuah argumen\n" - -#: lib/getopt.c:635 lib/getopt.c:640 -#, c-format -msgid "%s: option `%c%s' doesn't allow an argument\n" -msgstr "%s: option `%c%s' tidak membolehkan sebuah argumen\n" - -#: lib/getopt.c:686 lib/getopt.c:708 lib/getopt.c:1039 lib/getopt.c:1061 -#, c-format -msgid "%s: option `%s' requires an argument\n" -msgstr "%s: option `%s' membutuhkan sebuah argumen\n" - -#: lib/getopt.c:746 lib/getopt.c:749 -#, c-format -msgid "%s: unrecognized option `--%s'\n" -msgstr "%s: option tidak dikenal `--%s'\n" - -#: lib/getopt.c:757 lib/getopt.c:760 -#, c-format -msgid "%s: unrecognized option `%c%s'\n" -msgstr "%s: option tidak dikenal `%c%s'\n" - -#: lib/getopt.c:815 lib/getopt.c:818 -#, c-format -msgid "%s: illegal option -- %c\n" -msgstr "%s: option ilegal -- %c\n" - -#: lib/getopt.c:824 lib/getopt.c:827 -#, c-format -msgid "%s: invalid option -- %c\n" -msgstr "%s: option tidak valid -- %c\n" - -#: lib/getopt.c:882 lib/getopt.c:901 lib/getopt.c:1114 lib/getopt.c:1135 -#, c-format -msgid "%s: option requires an argument -- %c\n" -msgstr "%s: option membutuhkan sebuah argumen -- %c\n" - -#: lib/getopt.c:954 lib/getopt.c:973 -#, c-format -msgid "%s: option `-W %s' is ambiguous\n" -msgstr "%s: option `-W %s' ambigu\n" - -#: lib/getopt.c:997 lib/getopt.c:1018 -#, c-format -msgid "%s: option `-W %s' doesn't allow an argument\n" -msgstr "%s: option `-W %s' tidak membolehkan sebuah argumen\n" - -#: lib/obstack.c:417 lib/obstack.c:420 lib/xmalloc.c:53 -msgid "memory exhausted" -msgstr "memori habis" - -#: lib/quotearg.c:238 -msgid "`" -msgstr "`" - -#: lib/quotearg.c:239 -msgid "'" -msgstr "'" - -#: lib/subpipe.c:171 -#, c-format -msgid "subsidiary program `%s' could not be invoked" -msgstr "program subsider `%s' tidak dapat dipanggil" - -#: lib/subpipe.c:173 -#, c-format -msgid "subsidiary program `%s' not found" -msgstr "program subsider `%s' tidak ditemukan" - -#: lib/subpipe.c:175 -#, c-format -msgid "subsidiary program `%s' failed" -msgstr "program subsider `%s' gagal" - -#: lib/subpipe.c:176 -#, c-format -msgid "subsidiary program `%s' failed (exit status %d)" -msgstr "program subsider `%s' gagal (status kegagalan %d)" - -#: lib/timevar.c:475 -msgid "" -"\n" -"Execution times (seconds)\n" -msgstr "" -"\n" -"Waktu eksekusi (detik)\n" - -#: lib/timevar.c:525 -msgid " TOTAL :" -msgstr " TOTAL :" - -#: lib/timevar.c:561 -#, c-format -msgid "time in %s: %ld.%06ld (%ld%%)\n" -msgstr "waktu dalam %s: %ld.%06ld (%ld%%)\n" - -#~ msgid "%d shift/reduce conflict" -#~ msgid_plural "%d shift/reduce conflicts" -#~ msgstr[0] "%d geser/kurangi konflik" -#~ msgstr[1] "%d geser/kurangi konflik" - -#~ msgid "and" -#~ msgstr "dan" - -#~ msgid "conflicts: " -#~ msgstr "konflik: " - -#~ msgid "State %d contains " -#~ msgstr "State %d berisi " diff --git a/src/bin/bison/po/insert-header.sin b/src/bin/bison/po/insert-header.sin deleted file mode 100644 index b26de01f6c..0000000000 --- a/src/bin/bison/po/insert-header.sin +++ /dev/null @@ -1,23 +0,0 @@ -# Sed script that inserts the file called HEADER before the header entry. -# -# At each occurrence of a line starting with "msgid ", we execute the following -# commands. At the first occurrence, insert the file. At the following -# occurrences, do nothing. The distinction between the first and the following -# occurrences is achieved by looking at the hold space. -/^msgid /{ -x -# Test if the hold space is empty. -s/m/m/ -ta -# Yes it was empty. First occurrence. Read the file. -r HEADER -# Output the file's contents by reading the next line. But don't lose the -# current line while doing this. -g -N -bb -:a -# The hold space was nonempty. Following occurrences. Do nothing. -x -:b -} diff --git a/src/bin/bison/po/it.gmo b/src/bin/bison/po/it.gmo deleted file mode 100644 index ead839dc97..0000000000 Binary files a/src/bin/bison/po/it.gmo and /dev/null differ diff --git a/src/bin/bison/po/it.po b/src/bin/bison/po/it.po deleted file mode 100644 index 111431b374..0000000000 --- a/src/bin/bison/po/it.po +++ /dev/null @@ -1,787 +0,0 @@ -# Italian translation for message of GNU bison. -# Copyright (C) 2002 Free Software Foundation, Inc. -# Paolo Bonzini , 2002. -# -msgid "" -msgstr "" -"Project-Id-Version: bison 1.50\n" -"Report-Msgid-Bugs-To: bug-bison@gnu.org\n" -"POT-Creation-Date: 2004-05-21 10:26-0700\n" -"PO-Revision-Date: 2002-10-17 14:37+0100\n" -"Last-Translator: Paolo Bonzini \n" -"Language-Team: Italian \n" -"MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=ISO-8859-1\n" -"Content-Transfer-Encoding: 8-bit\n" -"Plural-Forms: nplurals=2; plural=(n != 1);\n" - -#: src/complain.c:51 src/complain.c:66 -msgid "warning: " -msgstr "attenzione: " - -#: src/complain.c:122 src/complain.c:138 -msgid "fatal error: " -msgstr "errore fatale: " - -#: src/conflicts.c:76 -#, c-format -msgid " Conflict between rule %d and token %s resolved as shift" -msgstr " Conflitto tra la regola %d e il token %s risolto come shift" - -#: src/conflicts.c:84 -#, c-format -msgid " Conflict between rule %d and token %s resolved as reduce" -msgstr " Conflitto tra la regola %d e il token %s risolto come riduzione" - -#: src/conflicts.c:91 -#, c-format -msgid " Conflict between rule %d and token %s resolved as an error" -msgstr " Conflitto tra la regola %d e il token %s risolto come errore" - -#: src/conflicts.c:399 -#, c-format -msgid "conflicts: %d shift/reduce, %d reduce/reduce\n" -msgstr "" - -#: src/conflicts.c:402 -#, fuzzy, c-format -msgid "conflicts: %d shift/reduce\n" -msgstr " %d shift/riduzione" - -#: src/conflicts.c:404 -#, fuzzy, c-format -msgid "conflicts: %d reduce/reduce\n" -msgstr " %d riduzione/riduzione" - -#: src/conflicts.c:422 -#, fuzzy, c-format -msgid "State %d " -msgstr "stato %d" - -#: src/conflicts.c:487 -#, fuzzy, c-format -msgid "%%expect-rr applies only to GLR parsers" -msgstr "%%dprec considerato solo nei parser GLR" - -#: src/conflicts.c:511 -#, c-format -msgid "expected %d shift/reduce conflict" -msgid_plural "expected %d shift/reduce conflicts" -msgstr[0] "atteso %d conflitto shift/riduzione" -msgstr[1] "attesi %d conflitti shift/riduzione" - -#: src/conflicts.c:515 -#, fuzzy, c-format -msgid "expected %d reduce/reduce conflict" -msgid_plural "expected %d reduce/reduce conflicts" -msgstr[0] "%d conflitto riduzione/riduzione" -msgstr[1] "%d conflitti riduzione/riduzione" - -#: src/files.c:100 -#, c-format -msgid "cannot open file `%s'" -msgstr "impossibile aprire il file `%s'" - -#: src/files.c:116 -msgid "I/O error" -msgstr "" - -#: src/files.c:119 -msgid "cannot close file" -msgstr "impossibile chiudere il file `%s'" - -#: src/files.c:337 -#, c-format -msgid "conflicting outputs to file %s" -msgstr "" - -#: src/getargs.c:186 -#, c-format -msgid "Try `%s --help' for more information.\n" -msgstr "Provare `%s --help' per ulteriori informazioni.\n" - -#: src/getargs.c:192 -msgid "GNU bison generates parsers for LALR(1) grammars.\n" -msgstr "GNU bison genera parser per grammatiche LALR(1).\n" - -#: src/getargs.c:196 -#, c-format -msgid "Usage: %s [OPTION]... FILE\n" -msgstr "Utilizzo: %s [OPZIONE]... FILE\n" - -#: src/getargs.c:200 -msgid "" -"If a long option shows an argument as mandatory, then it is mandatory\n" -"for the equivalent short option also. Similarly for optional arguments.\n" -msgstr "" -"Se un argomento è indicato come obbligatorio in un'opzione lunga, allora\n" -"è obbligatorio anche per l'equivalente opzione corta. Analogamente per\n" -"gli argomenti opzionali.\n" - -#: src/getargs.c:206 -msgid "" -"Operation modes:\n" -" -h, --help display this help and exit\n" -" -V, --version output version information and exit\n" -" -y, --yacc emulate POSIX yacc\n" -msgstr "" -"Modalità operative:\n" -" -h, --help mostra questo aiuto ed esce\n" -" -V, --version mostra informazioni sulla versione ed esce\n" -" -y, --yacc emula il comportamento di POSIX yacc\n" - -#: src/getargs.c:213 -msgid "" -"Parser:\n" -" -S, --skeleton=FILE specify the skeleton to use\n" -" -t, --debug instrument the parser for debugging\n" -" --locations enable locations computation\n" -" -p, --name-prefix=PREFIX prepend PREFIX to the external symbols\n" -" -l, --no-lines don't generate `#line' directives\n" -" -n, --no-parser generate the tables only\n" -" -k, --token-table include a table of token names\n" -msgstr "" -" -S, --skeleton=FILE specifica lo scheletro da usare\n" -" -t, --debug aggiunge informazioni di debug al parser\n" -" --locations abilita il calcolo delle locazioni (@N)\n" -" -p, --name-prefix=PREFIX prepone PREFIX ai simboli globali\n" -" -l, --no-lines non genera direttive `#line'\n" -" -n, --no-parser genera le sole tabelle\n" -" -k, --token-table include una tabella di nomi dei token\n" - -#: src/getargs.c:225 -msgid "" -"Output:\n" -" -d, --defines also produce a header file\n" -" -r, --report=THINGS also produce details on the automaton\n" -" -v, --verbose same as `--report=state'\n" -" -b, --file-prefix=PREFIX specify a PREFIX for output files\n" -" -o, --output=FILE leave output to FILE\n" -" -g, --graph also produce a VCG description of the " -"automaton\n" -msgstr "" -"Output:\n" -" -d, --defines produce anche uno header\n" -" -r, --report=THINGS produce anche dettagli sull'automa\n" -" -v, --verbose produce anche una spiegazione dell'automa\n" -" -b, --file-prefix=PREFIX specifica un prefisso per il file di output\n" -" -o, --output=FILE lascia l'output in FILE\n" -" -g, --graph produce anche una descrizione VCG dell'automa\n" - -#: src/getargs.c:236 -msgid "" -"THINGS is a list of comma separated words that can include:\n" -" `state' describe the states\n" -" `itemset' complete the core item sets with their closure\n" -" `lookahead' explicitly associate lookaheads to items\n" -" `solved' describe shift/reduce conflicts solving\n" -" `all' include all the above information\n" -" `none' disable the report\n" -msgstr "" -"THINGS è un elenco di parole separate da virgola scelte tra:\n" -" `state' descrive gli stati\n" -" `itemset' completa gli insiemi dei simboli con la loro chiusura " -"transitiva\n" -" `lookahead' associa i token di prospezione ai simboli\n" -" `solved' descrive la riduzione dei conflitti shift/riduzione\n" -" `all' include tutte queste informazioni\n" -" `none' disabilita la produzione del rapporto\n" - -#: src/getargs.c:247 -msgid "Report bugs to .\n" -msgstr "Segnalare eventuali bug a .\n" - -#: src/getargs.c:264 -#, c-format -msgid "bison (GNU Bison) %s" -msgstr "bison (GNU Bison) %s" - -#: src/getargs.c:266 -msgid "Written by Robert Corbett and Richard Stallman.\n" -msgstr "Scritto da Robert Corbett e Richard Stallman.\n" - -#: src/getargs.c:270 -#, c-format -msgid "Copyright (C) %d Free Software Foundation, Inc.\n" -msgstr "Copyright (C) %d Free Software Foundation, Inc.\n" - -#: src/getargs.c:272 -msgid "" -"This is free software; see the source for copying conditions. There is NO\n" -"warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n" -msgstr "" -"Questo e' software libero; vedere il sorgente per le condizioni cui e'\n" -"sottoposta la copia. NON c'è ALCUNA garanzia, neanche di\n" -"COMMERCIABILITA` o di ADEGUATEZZA AD UN PARTICOLARE SCOPO.\n" - -#: src/getargs.c:438 -#, c-format -msgid "missing operand after `%s'" -msgstr "" - -#: src/getargs.c:440 -#, c-format -msgid "extra operand `%s'" -msgstr "" - -#: src/gram.c:139 -msgid "empty" -msgstr "vuoto" - -#: src/gram.c:233 -msgid "Grammar" -msgstr "Grammatica" - -#: src/gram.c:321 src/reduce.c:394 -msgid "warning" -msgstr "attenzione" - -#: src/main.c:124 -msgid "rule never reduced because of conflicts" -msgstr "regola mai ridotta a causa dei conflitti" - -#: src/parse-gram.y:363 -msgid "POSIX forbids declarations in the grammar" -msgstr "POSIX proibisce l'uso di dichiarazioni interne alla grammatica" - -#: src/parse-gram.y:486 -msgid "missing identifier in parameter declaration" -msgstr "" - -#: src/print.c:49 -#, c-format -msgid " type %d is %s\n" -msgstr " il tipo %d è %s\n" - -#: src/print.c:165 -#, c-format -msgid "shift, and go to state %d\n" -msgstr "shift e prosecuzione allo stato %d\n" - -#: src/print.c:167 -#, c-format -msgid "go to state %d\n" -msgstr "prosecuzione allo stato %d\n" - -#: src/print.c:204 -msgid "error (nonassociative)\n" -msgstr "errore (non associativo)\n" - -#: src/print.c:292 -#, c-format -msgid "reduce using rule %d (%s)" -msgstr "riduzione con la regola %d (%s)" - -#: src/print.c:294 -#, c-format -msgid "accept" -msgstr "accetta" - -#: src/print.c:325 src/print.c:391 -msgid "$default" -msgstr "$default" - -#: src/print.c:420 -#, c-format -msgid "state %d" -msgstr "stato %d" - -#: src/print.c:456 -msgid "Terminals, with rules where they appear" -msgstr "Simboli terminali e regole in cui appaiono" - -#: src/print.c:483 -msgid "Nonterminals, with rules where they appear" -msgstr "Simboli nonterminali e regole in cui appaiono" - -#: src/print.c:512 -#, c-format -msgid " on left:" -msgstr " nel primo membro:" - -#: src/print.c:527 -#, c-format -msgid " on right:" -msgstr " nel secondo membro:" - -#: src/print.c:555 -msgid "Rules never reduced" -msgstr "Regole mai ridotte" - -#: src/reader.c:56 -#, c-format -msgid "multiple %s declarations" -msgstr "dichiarazioni multiple per %s" - -#: src/reader.c:118 -#, fuzzy, c-format -msgid "result type clash on merge function %s: <%s> != <%s>" -msgstr "" -"conflitto nei tipi del risultato della funzione di merge %s: `%s' e `%s'" - -#: src/reader.c:216 -#, c-format -msgid "rule given for %s, which is a token" -msgstr "fornita una regola per il token %s" - -#: src/reader.c:245 -#, fuzzy, c-format -msgid "type clash on default action: <%s> != <%s>" -msgstr "conflitto di tipo (`%s' e `%s') nell'azione di default" - -#: src/reader.c:251 -msgid "empty rule for typed nonterminal, and no action" -msgstr "regola vuota e nessuna azione per un nonterminale con tipo" - -#: src/reader.c:321 src/reader.c:335 src/reader.c:348 -#, fuzzy, c-format -msgid "only one %s allowed per rule" -msgstr "solo un %%merge è permesso in una regola" - -#: src/reader.c:331 src/reader.c:346 -#, fuzzy, c-format -msgid "%s affects only GLR parsers" -msgstr "%%merge considerato solo nei parser GLR" - -#: src/reader.c:333 -#, fuzzy, c-format -msgid "%s must be followed by positive number" -msgstr "%%dprec deve essere seguito da un intero positivo" - -#: src/reader.c:490 -msgid "no rules in the input grammar" -msgstr "nessuna regola nella grammatica di input" - -#: src/reduce.c:242 -msgid "useless rule" -msgstr "regola inutile" - -#: src/reduce.c:303 -#, fuzzy, c-format -msgid "useless nonterminal: %s" -msgstr "simbolo nonterminale inutilizzato" - -#: src/reduce.c:351 -msgid "Useless nonterminals" -msgstr "Simboli nonterminali inutili" - -#: src/reduce.c:364 -msgid "Terminals which are not used" -msgstr "Simboli terminali inutilizzati" - -#: src/reduce.c:373 -msgid "Useless rules" -msgstr "Regole inutili" - -#: src/reduce.c:389 -#, c-format -msgid "%d rule never reduced\n" -msgid_plural "%d rules never reduced\n" -msgstr[0] "%d regola non applicata\n" -msgstr[1] "%d regole non applicate\n" - -#: src/reduce.c:397 -#, c-format -msgid "%d useless nonterminal" -msgid_plural "%d useless nonterminals" -msgstr[0] "%d simbolo nonterminale inutilizzato" -msgstr[1] "%d simboli nonterminali inutilizzati" - -#: src/reduce.c:403 -#, c-format -msgid " and " -msgstr " e " - -#: src/reduce.c:406 -#, c-format -msgid "%d useless rule" -msgid_plural "%d useless rules" -msgstr[0] "%d regola inutile" -msgstr[1] "%d regole inutili" - -#: src/reduce.c:436 -#, c-format -msgid "start symbol %s does not derive any sentence" -msgstr "dal simbolo iniziale %s non deriva alcuna frase" - -#: src/scan-gram.l:162 -msgid "stray `,' treated as white space" -msgstr "" - -#: src/scan-gram.l:225 -#, fuzzy, c-format -msgid "invalid directive: %s" -msgstr ": escape non valido: %s\n" - -#: src/scan-gram.l:283 -#, fuzzy, c-format -msgid "invalid character: %s" -msgstr ": carattere non valido: `%c'\n" - -#: src/scan-gram.l:402 -#, fuzzy -msgid "invalid null character" -msgstr ": carattere non valido: `%c'\n" - -#: src/scan-gram.l:415 src/scan-gram.l:427 src/scan-gram.l:448 -#, fuzzy, c-format -msgid "invalid escape sequence: %s" -msgstr ": escape non valido: %s\n" - -#: src/scan-gram.l:417 src/scan-gram.l:429 src/scan-gram.l:450 -#, fuzzy, c-format -msgid "invalid null character: %s" -msgstr ": carattere non valido: `%c'\n" - -#: src/scan-gram.l:455 -#, fuzzy, c-format -msgid "unrecognized escape sequence: %s" -msgstr ": escape non riconosciuto: %s\n" - -#: src/scan-gram.l:537 -#, c-format -msgid "missing `{' in `%s'" -msgstr "" - -#: src/scan-gram.l:782 -#, c-format -msgid "$$ of `%s' has no declared type" -msgstr "Manca una dichiarazione di tipo per $$ di `%s'" - -#: src/scan-gram.l:803 -#, c-format -msgid "$%d of `%s' has no declared type" -msgstr "Manca una dichiarazione di tipo per $%d di `%s'" - -#: src/scan-gram.l:812 src/scan-gram.l:881 src/scan-gram.l:932 -#, c-format -msgid "integer out of range: %s" -msgstr "" - -#: src/scan-gram.l:848 src/scan-gram.l:916 -#, fuzzy, c-format -msgid "invalid value: %s" -msgstr "valore non valido: %s%d" - -#: src/scan-gram.l:1036 -#, c-format -msgid "missing `%s' at end of file" -msgstr "" - -#: src/scan-gram.l:1047 -#, c-format -msgid "missing `%s' at end of line" -msgstr "" - -#: src/symlist.c:97 src/symlist.c:108 -msgid "invalid $ value" -msgstr "valore $ non valido" - -#: src/symtab.c:85 -#, c-format -msgid "type redeclaration for %s" -msgstr "tipo dichiarato due volte per %s" - -#: src/symtab.c:102 src/symtab.c:120 -#, c-format -msgid "%s redeclaration for %s" -msgstr "dichiarazione due volte di %s per %s" - -#: src/symtab.c:139 -#, c-format -msgid "redefining precedence of %s" -msgstr "precedenza di `%s' definita due volte" - -#: src/symtab.c:157 -#, c-format -msgid "symbol %s redefined" -msgstr "simbolo %s ridefinito" - -#: src/symtab.c:180 -#, c-format -msgid "redefining user token number of %s" -msgstr "numero di token definito dall'utente specificato due volte per %s" - -#: src/symtab.c:207 -#, c-format -msgid "symbol %s is used, but is not defined as a token and has no rules" -msgstr "usato il simbolo %s, ma non è un token e non ha regole" - -#: src/symtab.c:232 -#, c-format -msgid "symbol `%s' used more than once as a literal string" -msgstr "simbolo `%s' usato più di una volta in una stringa letterale" - -#: src/symtab.c:235 -#, c-format -msgid "symbol `%s' given more than one literal string" -msgstr "il simbolo `%s' dà pi` di una stringa letterale" - -#: src/symtab.c:271 -#, c-format -msgid "conflicting precedences for %s and %s" -msgstr "precedenze in conflitto per %s und %s" - -#: src/symtab.c:283 -#, c-format -msgid "conflicting associativities for %s (%s) and %s (%s)" -msgstr "associatività in conflitto per %s (%s) e %s (%s)" - -#: src/symtab.c:368 -#, c-format -msgid "tokens %s and %s both assigned number %d" -msgstr "i token %s e %s hanno lo stesso numero %d" - -#: src/symtab.c:591 -#, c-format -msgid "the start symbol %s is undefined" -msgstr "simbolo iniziale %s non definito" - -#: src/symtab.c:595 -#, c-format -msgid "the start symbol %s is a token" -msgstr "specificato il token %s come simbolo iniziale" - -#: lib/argmatch.c:133 -#, c-format -msgid "invalid argument %s for %s" -msgstr "argomento non valido %s per %s" - -#: lib/argmatch.c:134 -#, c-format -msgid "ambiguous argument %s for %s" -msgstr "argomento ambiguo %s per %s" - -#: lib/argmatch.c:153 -#, c-format -msgid "Valid arguments are:" -msgstr "Gli argomenti validi sono:" - -#: lib/bitset_stats.c:179 -#, c-format -msgid "%u bitset_allocs, %u freed (%.2f%%).\n" -msgstr "%u bitset_alloc, %u liberati (%.2f%%).\n" - -#: lib/bitset_stats.c:182 -#, c-format -msgid "%u bitset_sets, %u cached (%.2f%%)\n" -msgstr "%u bitset_set, %u in cache (%.2f%%)\n" - -#: lib/bitset_stats.c:185 -#, c-format -msgid "%u bitset_resets, %u cached (%.2f%%)\n" -msgstr "%u bitset_reset, %u in cache (%.2f%%)\n" - -#: lib/bitset_stats.c:188 -#, c-format -msgid "%u bitset_tests, %u cached (%.2f%%)\n" -msgstr "%u bitset_test, %u in cache (%.2f%%)\n" - -#: lib/bitset_stats.c:192 -#, c-format -msgid "%u bitset_lists\n" -msgstr "%u bitset_list\n" - -#: lib/bitset_stats.c:194 -msgid "count log histogram\n" -msgstr "istogramma dei conteggi\n" - -#: lib/bitset_stats.c:197 -msgid "size log histogram\n" -msgstr "istogramma delle dimensioni\n" - -#: lib/bitset_stats.c:200 -msgid "density histogram\n" -msgstr "istogranna delle densità\n" - -#: lib/bitset_stats.c:214 -#, c-format -msgid "" -"Bitset statistics:\n" -"\n" -msgstr "" -"Statistiche dei bitset:\n" -"\n" - -#: lib/bitset_stats.c:217 -#, c-format -msgid "Accumulated runs = %u\n" -msgstr "Esecuzioni accumulate = %u\n" - -#: lib/bitset_stats.c:261 lib/bitset_stats.c:266 -msgid "Could not read stats file." -msgstr "Impossibile leggere il file delle statistiche." - -#: lib/bitset_stats.c:263 -#, c-format -msgid "Bad stats file size.\n" -msgstr "Dimensione errata del file delle statistiche.\n" - -#: lib/bitset_stats.c:289 lib/bitset_stats.c:291 -msgid "Could not write stats file." -msgstr "Impossibile scrivere il file delle statistiche." - -#: lib/bitset_stats.c:294 -msgid "Could not open stats file for writing." -msgstr "Impossibile aprire in scrittura il file delle statistiche." - -#: lib/error.c:127 -msgid "Unknown system error" -msgstr "Errore di sistema sconosciuto" - -#: lib/getopt.c:570 lib/getopt.c:589 -#, c-format -msgid "%s: option `%s' is ambiguous\n" -msgstr "%s: l'opzione `%s' è ambigua\n" - -#: lib/getopt.c:622 lib/getopt.c:626 -#, c-format -msgid "%s: option `--%s' doesn't allow an argument\n" -msgstr "%s: l'opzione `--%s' non ammette argomenti\n" - -#: lib/getopt.c:635 lib/getopt.c:640 -#, c-format -msgid "%s: option `%c%s' doesn't allow an argument\n" -msgstr "%s: l'opzione `%c%s' non ammette argomenti\n" - -#: lib/getopt.c:686 lib/getopt.c:708 lib/getopt.c:1039 lib/getopt.c:1061 -#, c-format -msgid "%s: option `%s' requires an argument\n" -msgstr "%s: l'opzione `%s' richiede un argomento\n" - -#: lib/getopt.c:746 lib/getopt.c:749 -#, c-format -msgid "%s: unrecognized option `--%s'\n" -msgstr "%s: opzione sconosciuta `--%s'\n" - -#: lib/getopt.c:757 lib/getopt.c:760 -#, c-format -msgid "%s: unrecognized option `%c%s'\n" -msgstr "%s: opzione sconosciuta `%c%s'\n" - -#: lib/getopt.c:815 lib/getopt.c:818 -#, c-format -msgid "%s: illegal option -- %c\n" -msgstr "%s: opzione non valida -- %c\n" - -#: lib/getopt.c:824 lib/getopt.c:827 -#, c-format -msgid "%s: invalid option -- %c\n" -msgstr "%s: opzione non valida -- %c\n" - -#: lib/getopt.c:882 lib/getopt.c:901 lib/getopt.c:1114 lib/getopt.c:1135 -#, c-format -msgid "%s: option requires an argument -- %c\n" -msgstr "%s: l'opzione richiede un argomento -- %c\n" - -#: lib/getopt.c:954 lib/getopt.c:973 -#, c-format -msgid "%s: option `-W %s' is ambiguous\n" -msgstr "%s: l'opzione `-W %s' è ambigua\n" - -#: lib/getopt.c:997 lib/getopt.c:1018 -#, c-format -msgid "%s: option `-W %s' doesn't allow an argument\n" -msgstr "%s: l'opzione `-W %s' non ammette un argomento\n" - -#: lib/obstack.c:417 lib/obstack.c:420 lib/xmalloc.c:53 -msgid "memory exhausted" -msgstr "memoria esaurita" - -#: lib/quotearg.c:238 -msgid "`" -msgstr "`" - -#: lib/quotearg.c:239 -msgid "'" -msgstr "'" - -#: lib/subpipe.c:171 -#, c-format -msgid "subsidiary program `%s' could not be invoked" -msgstr "" - -#: lib/subpipe.c:173 -#, c-format -msgid "subsidiary program `%s' not found" -msgstr "" - -#: lib/subpipe.c:175 -#, c-format -msgid "subsidiary program `%s' failed" -msgstr "" - -#: lib/subpipe.c:176 -#, c-format -msgid "subsidiary program `%s' failed (exit status %d)" -msgstr "" - -#: lib/timevar.c:475 -msgid "" -"\n" -"Execution times (seconds)\n" -msgstr "" -"\n" -"Tempo di esecuzione (in secondi)\n" - -#: lib/timevar.c:525 -msgid " TOTAL :" -msgstr " TOTALE :" - -#: lib/timevar.c:561 -#, c-format -msgid "time in %s: %ld.%06ld (%ld%%)\n" -msgstr "tempo in %s: %ld.%06ld (%ld%%)\n" - -#~ msgid "%d shift/reduce conflict" -#~ msgid_plural "%d shift/reduce conflicts" -#~ msgstr[0] "%d conflitto shift/riduzione" -#~ msgstr[1] "%d conflitti shift/riduzione" - -#~ msgid "and" -#~ msgstr "e" - -#~ msgid "conflicts: " -#~ msgstr "conflitti: " - -#~ msgid "State %d contains " -#~ msgstr "Lo stato %d contiene" - -#~ msgid "%s: no grammar file given\n" -#~ msgstr "%s: nessun file grammatica specificato\n" - -#~ msgid "%s: extra arguments ignored after `%s'\n" -#~ msgstr "%s: ignorati gli argomenti successivi a `%s'\n" - -#~ msgid "too many gotos (max %d)" -#~ msgstr "troppi goto (max %d)" - -#~ msgid "two @prec's in a row" -#~ msgstr "due @prec di seguito" - -#~ msgid "only one %%dprec allowed per rule" -#~ msgstr "solo un %%dprec è permesso in una regola" - -#~ msgid "too many symbols (tokens plus nonterminals); maximum %d" -#~ msgstr "troppi simboli (token e nonterminali); il massimo è %d" - -#~ msgid ": unexpected end of file in a comment\n" -#~ msgstr ": fine del file inattesa in un commento\n" - -#~ msgid ": unexpected end of file in a string\n" -#~ msgstr ": fine del file inattesa in una stringa\n" - -#~ msgid ": unexpected end of file in a character\n" -#~ msgstr ": fine del file inattesa in un carattere\n" - -#~ msgid ": unexpected end of file in a braced code\n" -#~ msgstr ": fine del file inattesa in codice (tra parentesi graffe)\n" - -#~ msgid ": unexpected end of file in a prologue\n" -#~ msgstr ": fine del file inattesa nel prologo\n" - -#~ msgid "%s is invalid" -#~ msgstr "%s non è valido" - -#~ msgid "too many states (max %d)" -#~ msgstr "troppi stati (massimo %d)" diff --git a/src/bin/bison/po/ja.gmo b/src/bin/bison/po/ja.gmo deleted file mode 100644 index 0cd515c354..0000000000 Binary files a/src/bin/bison/po/ja.gmo and /dev/null differ diff --git a/src/bin/bison/po/ja.po b/src/bin/bison/po/ja.po deleted file mode 100644 index bd9a959730..0000000000 --- a/src/bin/bison/po/ja.po +++ /dev/null @@ -1,1080 +0,0 @@ -# Japanese message for GNU bison 1.30f -# Copyright (C) 2001 Free Software Foundation, Inc. -# Daisuke Yamashita , 2001. -# -msgid "" -msgstr "" -"Project-Id-Version: GNU bison 1.30f\n" -"Report-Msgid-Bugs-To: bug-bison@gnu.org\n" -"POT-Creation-Date: 2004-05-21 10:26-0700\n" -"PO-Revision-Date: 2002-10-29 01:00-05:00\n" -"Last-Translator: Daisuke Yamashita \n" -"Language-Team: Japanese \n" -"MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=EUC-JP\n" -"Content-Transfer-Encoding: 8bit\n" -"Plural-Forms: nplurals=1; plural=0;\n" - -#: src/complain.c:51 src/complain.c:66 -msgid "warning: " -msgstr "·Ù¹ð: " - -#: src/complain.c:122 src/complain.c:138 -msgid "fatal error: " -msgstr "Ã×̿Ū¥¨¥é¡¼: " - -#: src/conflicts.c:76 -#, fuzzy, c-format -msgid " Conflict between rule %d and token %s resolved as shift" -msgstr "¾õÂÖ %d ¤Îµ¬Â§ %d ¤È¥È¡¼¥¯¥ó %s ¤Î¶¥¹ç¤ò%s¤È¤·¤Æ²ò·è¡£\n" - -#: src/conflicts.c:84 -#, fuzzy, c-format -msgid " Conflict between rule %d and token %s resolved as reduce" -msgstr "¾õÂÖ %d ¤Îµ¬Â§ %d ¤È¥È¡¼¥¯¥ó %s ¤Î¶¥¹ç¤ò%s¤È¤·¤Æ²ò·è¡£\n" - -#: src/conflicts.c:91 -#, fuzzy, c-format -msgid " Conflict between rule %d and token %s resolved as an error" -msgstr "¾õÂÖ %d ¤Îµ¬Â§ %d ¤È¥È¡¼¥¯¥ó %s ¤Î¶¥¹ç¤ò%s¤È¤·¤Æ²ò·è¡£\n" - -#: src/conflicts.c:399 -#, c-format -msgid "conflicts: %d shift/reduce, %d reduce/reduce\n" -msgstr "" - -#: src/conflicts.c:402 -#, fuzzy, c-format -msgid "conflicts: %d shift/reduce\n" -msgstr " %d ¥·¥Õ¥È/´Ô¸µ" - -#: src/conflicts.c:404 -#, fuzzy, c-format -msgid "conflicts: %d reduce/reduce\n" -msgstr " %d ´Ô¸µ/´Ô¸µ" - -#: src/conflicts.c:422 -#, fuzzy, c-format -msgid "State %d " -msgstr "¾õÂÖ %d" - -#: src/conflicts.c:487 -#, c-format -msgid "%%expect-rr applies only to GLR parsers" -msgstr "" - -#: src/conflicts.c:511 -#, fuzzy, c-format -msgid "expected %d shift/reduce conflict" -msgid_plural "expected %d shift/reduce conflicts" -msgstr[0] "ËÜÍè %d ¸Ä¤Î¥·¥Õ¥È/´Ô¸µ¾×ÆÍ¤Ç¤¢¤ë¤Ï¤º¤Ç¤¹\n" - -#: src/conflicts.c:515 -#, fuzzy, c-format -msgid "expected %d reduce/reduce conflict" -msgid_plural "expected %d reduce/reduce conflicts" -msgstr[0] "%d ´Ô¸µ/´Ô¸µ¾×ÆÍ" - -#: src/files.c:100 -#, c-format -msgid "cannot open file `%s'" -msgstr "¥Õ¥¡¥¤¥ë `%s' ¤ò³«¤±¤Þ¤»¤ó" - -#: src/files.c:116 -#, fuzzy -msgid "I/O error" -msgstr "¥¨¥é¡¼" - -#: src/files.c:119 -msgid "cannot close file" -msgstr "¥Õ¥¡¥¤¥ë¤òÊĤ¸¤ë¤³¤È¤¬¤Ç¤­¤Þ¤»¤ó" - -#: src/files.c:337 -#, fuzzy, c-format -msgid "conflicting outputs to file %s" -msgstr "Èó·ë¹çÃÍ %s ¤È %s ¤Ç¶¥¹ç¤¬À¸¤¸¤Æ¤¤¤Þ¤¹" - -#: src/getargs.c:186 -#, c-format -msgid "Try `%s --help' for more information.\n" -msgstr "`%s --help' ¤Ç¾ÜºÙ¾ðÊó¤ò»²¾È¤·¤Æ¤¯¤À¤µ¤¤\n" - -#: src/getargs.c:192 -msgid "GNU bison generates parsers for LALR(1) grammars.\n" -msgstr "GNU bison ¤Ï LALR(1) ʸˡ¤Î¹½Ê¸²òÀÏ´ï¤òÀ¸À®¤·¤Þ¤¹¡£\n" - -#: src/getargs.c:196 -#, c-format -msgid "Usage: %s [OPTION]... FILE\n" -msgstr "»È¤¤Êý: %s [¥ª¥×¥·¥ç¥ó]... ¥Õ¥¡¥¤¥ë\n" - -#: src/getargs.c:200 -msgid "" -"If a long option shows an argument as mandatory, then it is mandatory\n" -"for the equivalent short option also. Similarly for optional arguments.\n" -msgstr "" -"¥í¥ó¥°¥ª¥×¥·¥ç¥ó¤Çɬ¿Ü¤Î°ú¿ô¤¬¼¨¤µ¤ì¤Æ¤¤¤ì¤Ð¡¢Æ±¤¸°ÕÌ£¤Î¥·¥ç¡¼¥È¥ª¥×¥·¥ç¥ó\n" -"¤Ç¤âƱÍͤËɬ¿Ü¤Î°ú¿ô¤È¤Ê¤ê¤Þ¤¹¡£É¬¿Ü¤Ç¤Ê¤¤ÁªÂòŪ°ú¿ô¤Ç¤âƱÍͤǤ¹¡£\n" - -#: src/getargs.c:206 -msgid "" -"Operation modes:\n" -" -h, --help display this help and exit\n" -" -V, --version output version information and exit\n" -" -y, --yacc emulate POSIX yacc\n" -msgstr "" -"Áàºî¥â¡¼¥É:\n" -" -h, --help ¤³¤Î»È¤¤Êý¤òɽ¼¨¤·¤Æ½ªÎ»¤¹¤ë\n" -" -V, --version ¥Ð¡¼¥¸¥ç¥ó¾ðÊó¤òɽ¼¨¤·¤Æ½ªÎ»¤¹¤ë\n" -" -y, --yacc POSIX yacc ¤ò¥¨¥ß¥å¥ì¥¤¥È¤¹¤ë\n" - -#: src/getargs.c:213 -msgid "" -"Parser:\n" -" -S, --skeleton=FILE specify the skeleton to use\n" -" -t, --debug instrument the parser for debugging\n" -" --locations enable locations computation\n" -" -p, --name-prefix=PREFIX prepend PREFIX to the external symbols\n" -" -l, --no-lines don't generate `#line' directives\n" -" -n, --no-parser generate the tables only\n" -" -k, --token-table include a table of token names\n" -msgstr "" -"¹½Ê¸²òÀÏ´ï:\n" -" -S, --skeleton=FILE ÍøÍѤ¹¤ë¥¹¥±¥ë¥È¥ó¤ò»ØÄꤹ¤ë\n" -" -t, --debug ¹½Ê¸²òÀϤΥǥХå°ÍѤμêÃÊ\n" -" --locations ·×»»·ë²Ì°ÌÃÖ¤òÍ­¸ú¤Ë¤¹¤ë\n" -" -p, --name-prefix=PREFIX PREFIX ¤ò³°Éô¥·¥ó¥Ü¥ë¤È¤·¤ÆÀèÆ¬¤ËÁÞÆþ¤¹¤ë\n" -" -l, --no-lines `#line' ¥Ç¥£¥ì¥¯¥Æ¥£¥Ö¤òÀ¸À®¤·¤Ê¤¤\n" -" -n, --no-parser ¥Æ¡¼¥Ö¥ë¤Î¤ß¤òÀ¸À®¤¹¤ë\n" -" -k, --token-table ¥È¡¼¥¯¥ó̾¤Î¥Æ¡¼¥Ö¥ë¤ò´Þ¤á¤ë\n" - -#: src/getargs.c:225 -#, fuzzy -msgid "" -"Output:\n" -" -d, --defines also produce a header file\n" -" -r, --report=THINGS also produce details on the automaton\n" -" -v, --verbose same as `--report=state'\n" -" -b, --file-prefix=PREFIX specify a PREFIX for output files\n" -" -o, --output=FILE leave output to FILE\n" -" -g, --graph also produce a VCG description of the " -"automaton\n" -msgstr "" -"½ÐÎÏ:\n" -" -d, --defines ¥Ø¥Ã¥À¥Õ¥¡¥¤¥ë¤âºîÀ®¤¹¤ë\n" -" -v, --verbose ¥ª¡¼¥È¥Þ¥È¥ó¤Î²òÀâ¤âºîÀ®¤¹¤ë\n" -" -b, --file-prefix=PREFIX ½ÐÎÏ¥Õ¥¡¥¤¥ë¤Î PREFIX(ÀÜÆ¬¼­) ¤ò»ØÄꤹ¤ë\n" -" -o, --output=FILE ½ÐÎÏÀè¤ò FILE ¤È¤¹¤ë\n" -" -g, --graph ¥ª¡¼¥È¥Þ¥È¥ó¤Î VCG µ­½Ò»Ò¤âºîÀ®¤¹¤ë\n" - -#: src/getargs.c:236 -msgid "" -"THINGS is a list of comma separated words that can include:\n" -" `state' describe the states\n" -" `itemset' complete the core item sets with their closure\n" -" `lookahead' explicitly associate lookaheads to items\n" -" `solved' describe shift/reduce conflicts solving\n" -" `all' include all the above information\n" -" `none' disable the report\n" -msgstr "" - -#: src/getargs.c:247 -msgid "Report bugs to .\n" -msgstr "¥Ð¥°¥ì¥Ý¡¼¥È¤Ï ¤Þ¤Ç¡£\n" - -#: src/getargs.c:264 -#, c-format -msgid "bison (GNU Bison) %s" -msgstr "bison (GNU Bison) %s" - -#: src/getargs.c:266 -msgid "Written by Robert Corbett and Richard Stallman.\n" -msgstr "" - -#: src/getargs.c:270 -#, fuzzy, c-format -msgid "Copyright (C) %d Free Software Foundation, Inc.\n" -msgstr "" -"Copyright 1984, 1986, 1989, 1992, 2000, 2001 Free Software Foundation, Inc.\n" - -#: src/getargs.c:272 -msgid "" -"This is free software; see the source for copying conditions. There is NO\n" -"warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n" -msgstr "" -"This is free software; see the source for copying conditions. There is NO\n" -"warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n" -"[»²¹ÍÌõ -- ˡŪ¸úÎϤϱÑʸ¤¬Å¬ÍѤµ¤ì¤Þ¤¹]\n" -"¤³¤ì¤Ï¥Õ¥ê¡¼¥½¥Õ¥È¥¦¥§¥¢¤Ç¤¹ -- Ê£À½¤Ë¤Ä¤¤¤Æ¤Î¾ò·ï¤Ï¥½¡¼¥¹¤ò¸«¤Þ¤·¤ç¤¦¡£\n" -"°ìÀÚ¤ÎÊݾڤϤ¢¤ê¤Þ¤»¤ó -- ¾¦¶ÈÀ­¤äÌÜŪŬ¹çÀ­¤Ë¤Ä¤¤¤Æ¤ÎÊݾڤ¹¤é¤¢¤ê¤Þ¤»¤ó¡£\n" - -#: src/getargs.c:438 -#, c-format -msgid "missing operand after `%s'" -msgstr "" - -#: src/getargs.c:440 -#, c-format -msgid "extra operand `%s'" -msgstr "" - -#: src/gram.c:139 -msgid "empty" -msgstr "¶õ" - -#: src/gram.c:233 -msgid "Grammar" -msgstr "ʸˡ" - -#: src/gram.c:321 src/reduce.c:394 -#, fuzzy -msgid "warning" -msgstr "·Ù¹ð: " - -#: src/main.c:124 -#, fuzzy -msgid "rule never reduced because of conflicts" -msgstr " 1 ´Ô¸µ/´Ô¸µ¾×ÆÍ" - -#: src/parse-gram.y:363 -msgid "POSIX forbids declarations in the grammar" -msgstr "" - -#: src/parse-gram.y:486 -msgid "missing identifier in parameter declaration" -msgstr "" - -#: src/print.c:49 -#, c-format -msgid " type %d is %s\n" -msgstr " ¥¿¥¤¥× %d ¤Ï %s ¤Ç¤¹\n" - -#: src/print.c:165 -#, fuzzy, c-format -msgid "shift, and go to state %d\n" -msgstr " %-4s\t¥·¥Õ¥È¡¢¤ª¤è¤Ó¾õÂÖ %d ¤Ø\n" - -#: src/print.c:167 -#, fuzzy, c-format -msgid "go to state %d\n" -msgstr " $ \t¾õÂÖ %d ¤Ø\n" - -#: src/print.c:204 -#, fuzzy -msgid "error (nonassociative)\n" -msgstr "%-4s\t¥¨¥é¡¼ (Èó·ë¹ç)" - -#: src/print.c:292 -#, fuzzy, c-format -msgid "reduce using rule %d (%s)" -msgstr "$default\tµ¬Â§ %d ¤òÍøÍѤ·¤Æ´Ô¸µ (%s)" - -#: src/print.c:294 -#, c-format -msgid "accept" -msgstr "" - -#: src/print.c:325 src/print.c:391 -msgid "$default" -msgstr "" - -#: src/print.c:420 -#, c-format -msgid "state %d" -msgstr "¾õÂÖ %d" - -#: src/print.c:456 -msgid "Terminals, with rules where they appear" -msgstr "½Ð¸½°ÌÃ֤ε¬Â§¤Ë¤è¤ë½ªÃ¼" - -#: src/print.c:483 -msgid "Nonterminals, with rules where they appear" -msgstr "½Ð¸½°ÌÃ֤ε¬Â§¤Ë¤è¤ëÈó½ªÃ¼" - -#: src/print.c:512 -#, c-format -msgid " on left:" -msgstr " º¸ÊÕ:" - -#: src/print.c:527 -#, c-format -msgid " on right:" -msgstr " ±¦ÊÕ:" - -#: src/print.c:555 -#, fuzzy -msgid "Rules never reduced" -msgstr "%d ¸Ä¤Îµ¬Â§¤Ï·è¤·¤Æ´Ô¸µ¤µ¤ì¤Þ¤»¤ó\n" - -#: src/reader.c:56 -#, c-format -msgid "multiple %s declarations" -msgstr "%s ¤¬Ê£¿ô¸ÄÀë¸À¤µ¤ì¤Þ¤·¤¿" - -#: src/reader.c:118 -#, c-format -msgid "result type clash on merge function %s: <%s> != <%s>" -msgstr "" - -#: src/reader.c:216 -#, c-format -msgid "rule given for %s, which is a token" -msgstr "%s ¤Ëµ¬Â§¤¬Í¿¤¨¤é¤ì¡¢¤½¤ì¤Ï¥È¡¼¥¯¥ó¤È¤Ê¤ê¤Þ¤¹" - -#: src/reader.c:245 -#, fuzzy, c-format -msgid "type clash on default action: <%s> != <%s>" -msgstr "½é´ü¾õÂÖ¤ÎÆ°ºî¤Ç¤Ï·¿ (`%s' `%s') ¤¬¾×ÆÍ¤·¤Þ¤¹" - -#: src/reader.c:251 -msgid "empty rule for typed nonterminal, and no action" -msgstr "¶õ¤Î·¿ÉÕ¤­Èó½ªÃ¼¥¢¥¤¥Æ¥àÍѵ¬Â§¤Ç¤¢¤ê¡¢Æ°ºî¤¬µ¯¤ê¤Þ¤»¤ó" - -#: src/reader.c:321 src/reader.c:335 src/reader.c:348 -#, c-format -msgid "only one %s allowed per rule" -msgstr "" - -#: src/reader.c:331 src/reader.c:346 -#, c-format -msgid "%s affects only GLR parsers" -msgstr "" - -#: src/reader.c:333 -#, c-format -msgid "%s must be followed by positive number" -msgstr "" - -#: src/reader.c:490 -msgid "no rules in the input grammar" -msgstr "ÆþÎϤ·¤¿Ê¸Ë¡¤Ëµ¬Â§¤¬ÄêµÁ¤µ¤ì¤Æ¤¤¤Þ¤»¤ó" - -#: src/reduce.c:242 -#, fuzzy -msgid "useless rule" -msgstr "%d ¸Ä¤Î̵°ÕÌ£¤Êµ¬Â§" - -#: src/reduce.c:303 -#, fuzzy, c-format -msgid "useless nonterminal: %s" -msgstr "̵°ÕÌ£¤ÊÈó½ªÃ¼»Ò:" - -#: src/reduce.c:351 -#, fuzzy -msgid "Useless nonterminals" -msgstr "̵°ÕÌ£¤ÊÈó½ªÃ¼»Ò:" - -#: src/reduce.c:364 -#, fuzzy -msgid "Terminals which are not used" -msgstr "ÍøÍѤµ¤ì¤Ê¤¤½ªÃ¼»Ò:" - -#: src/reduce.c:373 -#, fuzzy -msgid "Useless rules" -msgstr "̵°ÕÌ£¤Êµ¬Â§:" - -#: src/reduce.c:389 -#, c-format -msgid "%d rule never reduced\n" -msgid_plural "%d rules never reduced\n" -msgstr[0] "%d ¸Ä¤Îµ¬Â§¤Ï·è¤·¤Æ´Ô¸µ¤µ¤ì¤Þ¤»¤ó\n" - -#: src/reduce.c:397 -#, c-format -msgid "%d useless nonterminal" -msgid_plural "%d useless nonterminals" -msgstr[0] "%d ¸Ä¤Î̵°ÕÌ£¤ÊÈó½ªÃ¼»Ò" - -#: src/reduce.c:403 -#, c-format -msgid " and " -msgstr "¤ª¤è¤Ó" - -#: src/reduce.c:406 -#, c-format -msgid "%d useless rule" -msgid_plural "%d useless rules" -msgstr[0] "%d ¸Ä¤Î̵°ÕÌ£¤Êµ¬Â§" - -#: src/reduce.c:436 -#, fuzzy, c-format -msgid "start symbol %s does not derive any sentence" -msgstr "³«»Ï¥·¥ó¥Ü¥ë %s ¤Ï¤É¤Îʸ¤Ë¤âͳÍ褷¤Þ¤»¤ó" - -#: src/scan-gram.l:162 -msgid "stray `,' treated as white space" -msgstr "" - -#: src/scan-gram.l:225 -#, fuzzy, c-format -msgid "invalid directive: %s" -msgstr "ÉÔŬÀÚ¤ÊÆþÎÏ: %s" - -#: src/scan-gram.l:283 -#, fuzzy, c-format -msgid "invalid character: %s" -msgstr "̤ÃΤÎʸ»ú: %s" - -#: src/scan-gram.l:402 -#, fuzzy -msgid "invalid null character" -msgstr "%s ¤ÎÀë¸À¤¬ÉÔŬÀڤǤ¹" - -#: src/scan-gram.l:415 src/scan-gram.l:427 src/scan-gram.l:448 -#, fuzzy, c-format -msgid "invalid escape sequence: %s" -msgstr "ÉÔŬÀÚ¤ÊÆþÎÏ: %s" - -#: src/scan-gram.l:417 src/scan-gram.l:429 src/scan-gram.l:450 -#, fuzzy, c-format -msgid "invalid null character: %s" -msgstr "ÉÔŬÀÚ¤ÊÆþÎÏ: %s" - -#: src/scan-gram.l:455 -#, fuzzy, c-format -msgid "unrecognized escape sequence: %s" -msgstr "ǧ¼±¤Ç¤­¤Ê¤¤: %s" - -#: src/scan-gram.l:537 -#, c-format -msgid "missing `{' in `%s'" -msgstr "" - -#: src/scan-gram.l:782 -#, c-format -msgid "$$ of `%s' has no declared type" -msgstr "`%s' ¤Î $$ ¤ËÀë¸À¤Î¤Ê¤¤·¿¤¬¤¢¤ê¤Þ¤¹" - -#: src/scan-gram.l:803 -#, c-format -msgid "$%d of `%s' has no declared type" -msgstr "$%d ¸Ä¤Î `%s' ¤¬Àë¸À¤µ¤ì¤¿·¿¤ò»ý¤Ã¤Æ¤¤¤Þ¤»¤ó" - -#: src/scan-gram.l:812 src/scan-gram.l:881 src/scan-gram.l:932 -#, c-format -msgid "integer out of range: %s" -msgstr "" - -#: src/scan-gram.l:848 src/scan-gram.l:916 -#, fuzzy, c-format -msgid "invalid value: %s" -msgstr "ÉÔŬÀÚ¤Ê $ ¤ÎÃÍ" - -#: src/scan-gram.l:1036 -#, fuzzy, c-format -msgid "missing `%s' at end of file" -msgstr "ÊĤ¸¤é¤ì¤Æ¤¤¤Ê¤¤Ê¸»úÎ󤬥ե¡¥¤¥ëËöÈø¤Ë¤¢¤ê¤Þ¤¹" - -#: src/scan-gram.l:1047 -#, fuzzy, c-format -msgid "missing `%s' at end of line" -msgstr "ÊĤ¸¤é¤ì¤Æ¤¤¤Ê¤¤Ê¸»úÎ󤬥ե¡¥¤¥ëËöÈø¤Ë¤¢¤ê¤Þ¤¹" - -#: src/symlist.c:97 src/symlist.c:108 -msgid "invalid $ value" -msgstr "ÉÔŬÀÚ¤Ê $ ¤ÎÃÍ" - -#: src/symtab.c:85 -#, c-format -msgid "type redeclaration for %s" -msgstr "%s ¤Î·¿¤¬ºÆÄêµÁ¤µ¤ì¤Þ¤·¤¿" - -#: src/symtab.c:102 src/symtab.c:120 -#, fuzzy, c-format -msgid "%s redeclaration for %s" -msgstr "%s ¤Î·¿¤¬ºÆÄêµÁ¤µ¤ì¤Þ¤·¤¿" - -#: src/symtab.c:139 -#, c-format -msgid "redefining precedence of %s" -msgstr "%s ¤ËÀè¹Ô¤·¤¿ºÆÄêµÁ¤Ç¤¹" - -#: src/symtab.c:157 -#, c-format -msgid "symbol %s redefined" -msgstr "¥·¥ó¥Ü¥ë %s ¤¬ºÆÄêµÁ¤µ¤ì¤Þ¤·¤¿" - -#: src/symtab.c:180 -#, fuzzy, c-format -msgid "redefining user token number of %s" -msgstr "%s ¤ËÀè¹Ô¤·¤¿ºÆÄêµÁ¤Ç¤¹" - -#: src/symtab.c:207 -#, c-format -msgid "symbol %s is used, but is not defined as a token and has no rules" -msgstr "" -"¥·¥ó¥Ü¥ë %s ¤¬»È¤ï¤ì¤Æ¤¤¤Þ¤¹¤¬¡¢¥È¡¼¥¯¥ó¤È¤·¤ÆÄêµÁ¤µ¤ì¤Æ¤ª¤é¤º¡¢µ¬Â§¤ò»ý¤Á¤Þ" -"¤»¤ó" - -#: src/symtab.c:232 -#, c-format -msgid "symbol `%s' used more than once as a literal string" -msgstr "¥·¥ó¥Ü¥ë `%s' ¤Ï¥ê¥Æ¥é¥ëʸ»úÎó¤È¤·¤ÆÊ£¿ô²ó»È¤ï¤ì¤Þ¤·¤¿" - -#: src/symtab.c:235 -#, c-format -msgid "symbol `%s' given more than one literal string" -msgstr "¥·¥ó¥Ü¥ë `%s' ¤ÏÊ£¿ô¤Î¥ê¥Æ¥é¥ëʸ»úÎó¤¬Í¿¤¨¤é¤ì¤Þ¤·¤¿" - -#: src/symtab.c:271 -#, c-format -msgid "conflicting precedences for %s and %s" -msgstr "Àè¹Ô¤·¤Æ¤¤¤ë %s ¤È %s ¤Ç¶¥¹ç¤¬À¸¤¸¤Æ¤¤¤Þ¤¹" - -#: src/symtab.c:283 -#, fuzzy, c-format -msgid "conflicting associativities for %s (%s) and %s (%s)" -msgstr "Èó·ë¹çÃÍ %s ¤È %s ¤Ç¶¥¹ç¤¬À¸¤¸¤Æ¤¤¤Þ¤¹" - -#: src/symtab.c:368 -#, c-format -msgid "tokens %s and %s both assigned number %d" -msgstr "¥È¡¼¥¯¥ó %s ¤È %s ¤ÎÁÐÊý¤¬ÈÖ¹æ %d ¤Ë³ä¤êÅö¤Æ¤é¤ì¤Þ¤·¤¿" - -#: src/symtab.c:591 -#, c-format -msgid "the start symbol %s is undefined" -msgstr "³«»Ï¥·¥ó¥Ü¥ë %s ¤ÏÄêµÁ¤µ¤ì¤Æ¤¤¤Þ¤»¤ó" - -#: src/symtab.c:595 -#, c-format -msgid "the start symbol %s is a token" -msgstr "³«»Ï¥·¥ó¥Ü¥ë %s ¤Ï¥È¡¼¥¯¥ó¤Ç¤¹" - -#: lib/argmatch.c:133 -#, fuzzy, c-format -msgid "invalid argument %s for %s" -msgstr "ÉÔŬÀÚ¤ÊÆþÎÏ: %s" - -#: lib/argmatch.c:134 -#, c-format -msgid "ambiguous argument %s for %s" -msgstr "" - -#: lib/argmatch.c:153 -#, c-format -msgid "Valid arguments are:" -msgstr "" - -#: lib/bitset_stats.c:179 -#, c-format -msgid "%u bitset_allocs, %u freed (%.2f%%).\n" -msgstr "" - -#: lib/bitset_stats.c:182 -#, c-format -msgid "%u bitset_sets, %u cached (%.2f%%)\n" -msgstr "" - -#: lib/bitset_stats.c:185 -#, c-format -msgid "%u bitset_resets, %u cached (%.2f%%)\n" -msgstr "" - -#: lib/bitset_stats.c:188 -#, c-format -msgid "%u bitset_tests, %u cached (%.2f%%)\n" -msgstr "" - -#: lib/bitset_stats.c:192 -#, c-format -msgid "%u bitset_lists\n" -msgstr "" - -#: lib/bitset_stats.c:194 -msgid "count log histogram\n" -msgstr "" - -#: lib/bitset_stats.c:197 -msgid "size log histogram\n" -msgstr "" - -#: lib/bitset_stats.c:200 -msgid "density histogram\n" -msgstr "" - -#: lib/bitset_stats.c:214 -#, c-format -msgid "" -"Bitset statistics:\n" -"\n" -msgstr "" - -#: lib/bitset_stats.c:217 -#, c-format -msgid "Accumulated runs = %u\n" -msgstr "" - -#: lib/bitset_stats.c:261 lib/bitset_stats.c:266 -msgid "Could not read stats file." -msgstr "" - -#: lib/bitset_stats.c:263 -#, c-format -msgid "Bad stats file size.\n" -msgstr "" - -#: lib/bitset_stats.c:289 lib/bitset_stats.c:291 -msgid "Could not write stats file." -msgstr "" - -#: lib/bitset_stats.c:294 -msgid "Could not open stats file for writing." -msgstr "" - -#: lib/error.c:127 -msgid "Unknown system error" -msgstr "ÉÔÌÀ¤Ê¥·¥¹¥Æ¥à¥¨¥é¡¼" - -#: lib/getopt.c:570 lib/getopt.c:589 -#, c-format -msgid "%s: option `%s' is ambiguous\n" -msgstr "%s: ¥ª¥×¥·¥ç¥ó `%s' ¤ÏÛ£Ëæ¤Ç¤¹\n" - -#: lib/getopt.c:622 lib/getopt.c:626 -#, c-format -msgid "%s: option `--%s' doesn't allow an argument\n" -msgstr "%s: ¥ª¥×¥·¥ç¥ó `--%s' ¤Ï°ú¿ô¤òµö¤·¤Þ¤»¤ó\n" - -#: lib/getopt.c:635 lib/getopt.c:640 -#, c-format -msgid "%s: option `%c%s' doesn't allow an argument\n" -msgstr "%s: ¥ª¥×¥·¥ç¥ó `%c%s' ¤Ï°ú¿ô¤òµö¤·¤Þ¤»¤ó\n" - -#: lib/getopt.c:686 lib/getopt.c:708 lib/getopt.c:1039 lib/getopt.c:1061 -#, c-format -msgid "%s: option `%s' requires an argument\n" -msgstr "%s: ¥ª¥×¥·¥ç¥ó `%s' ¤Ï°ú¿ô¤òÍ׵ᤷ¤Þ¤¹\n" - -#: lib/getopt.c:746 lib/getopt.c:749 -#, c-format -msgid "%s: unrecognized option `--%s'\n" -msgstr "%s: ǧ¼±¤Ç¤­¤Ê¤¤¥ª¥×¥·¥ç¥ó `--%s' ¤Ç¤¹\n" - -#: lib/getopt.c:757 lib/getopt.c:760 -#, c-format -msgid "%s: unrecognized option `%c%s'\n" -msgstr "%s: ǧ¼±¤Ç¤­¤Ê¤¤¥ª¥×¥·¥ç¥ó `%c%s' ¤Ç¤¹\n" - -#: lib/getopt.c:815 lib/getopt.c:818 -#, c-format -msgid "%s: illegal option -- %c\n" -msgstr "%s: Äê³Ê³°¤Î¥ª¥×¥·¥ç¥ó -- %c\n" - -#: lib/getopt.c:824 lib/getopt.c:827 -#, c-format -msgid "%s: invalid option -- %c\n" -msgstr "%s: ÉÔŬÀڤʥª¥×¥·¥ç¥ó -- %c\n" - -#: lib/getopt.c:882 lib/getopt.c:901 lib/getopt.c:1114 lib/getopt.c:1135 -#, c-format -msgid "%s: option requires an argument -- %c\n" -msgstr "%s: ¥ª¥×¥·¥ç¥ó¤Ï°ú¿ô¤òÍ׵ᤷ¤Þ¤¹ -- %c\n" - -#: lib/getopt.c:954 lib/getopt.c:973 -#, c-format -msgid "%s: option `-W %s' is ambiguous\n" -msgstr "%s: ¥ª¥×¥·¥ç¥ó `-W %s' ¤ÏÛ£Ëæ¤Ç¤¹\n" - -#: lib/getopt.c:997 lib/getopt.c:1018 -#, c-format -msgid "%s: option `-W %s' doesn't allow an argument\n" -msgstr "%s: ¥ª¥×¥·¥ç¥ó `-W %s' ¤Ï°ú¿ô¤òµö¤·¤Þ¤»¤ó\n" - -#: lib/obstack.c:417 lib/obstack.c:420 lib/xmalloc.c:53 -msgid "memory exhausted" -msgstr "¥á¥â¥ê¤ò»È¤¤²Ì¤¿¤·¤Þ¤·¤¿" - -#: lib/quotearg.c:238 -msgid "`" -msgstr "`" - -#: lib/quotearg.c:239 -msgid "'" -msgstr "'" - -#: lib/subpipe.c:171 -#, c-format -msgid "subsidiary program `%s' could not be invoked" -msgstr "" - -#: lib/subpipe.c:173 -#, c-format -msgid "subsidiary program `%s' not found" -msgstr "" - -#: lib/subpipe.c:175 -#, c-format -msgid "subsidiary program `%s' failed" -msgstr "" - -#: lib/subpipe.c:176 -#, c-format -msgid "subsidiary program `%s' failed (exit status %d)" -msgstr "" - -#: lib/timevar.c:475 -msgid "" -"\n" -"Execution times (seconds)\n" -msgstr "" - -#: lib/timevar.c:525 -msgid " TOTAL :" -msgstr "" - -#: lib/timevar.c:561 -#, c-format -msgid "time in %s: %ld.%06ld (%ld%%)\n" -msgstr "" - -#~ msgid "too many states (max %d)" -#~ msgstr "¾õÂÖ¤¬Â¿¤¹¤®¤Þ¤¹ (ºÇÂç %d)" - -#~ msgid "reduce" -#~ msgstr "´Ô¸µ" - -#~ msgid "shift" -#~ msgstr "¥·¥Õ¥È" - -#~ msgid "%d shift/reduce conflict" -#~ msgid_plural "%d shift/reduce conflicts" -#~ msgstr[0] "%d ¥·¥Õ¥È/´Ô¸µ¾×ÆÍ" - -#~ msgid "and" -#~ msgstr "¤ª¤è¤Ó" - -#~ msgid "State %d contains " -#~ msgstr "¾õÂÖ %d ¤¬´Þ¤à¤Î¤Ï " - -#~ msgid "conflicts: " -#~ msgstr "¾×ÆÍ: " - -#~ msgid "%s contains " -#~ msgstr "%s ¤ÎÃæ¿È¤Ï" - -#~ msgid " %-4s\t[reduce using rule %d (%s)]\n" -#~ msgstr " %-4s\t[µ¬Â§ %d ¤òÍøÍѤ·¤Æ´Ô¸µ (%s)]\n" - -#~ msgid "" -#~ " $default\treduce using rule %d (%s)\n" -#~ "\n" -#~ msgstr "" -#~ " $default\tµ¬Â§ %d ¤òÍøÍѤ·¤Æ´Ô¸µ (%s)\n" -#~ "\n" - -#~ msgid " %-4s\treduce using rule %d (%s)\n" -#~ msgstr " %-4s\tµ¬Â§ %d ¤òÍøÍѤ·¤Æ´Ô¸µ (%s)\n" - -#~ msgid " $default\treduce using rule %d (%s)\n" -#~ msgstr " $default\tµ¬Â§ %d ¤òÍøÍѤ·¤Æ´Ô¸µ (%s)\n" - -#~ msgid "`%s' is no longer supported" -#~ msgstr "`%s' ¤ÏºÇÁ᥵¥Ý¡¼¥È¤µ¤ì¤Þ¤»¤ó" - -#~ msgid "%s: no grammar file given\n" -#~ msgstr "%s: ʸˡ¥Õ¥¡¥¤¥ë¤¬»ØÄꤵ¤ì¤Æ¤¤¤Þ¤»¤ó\n" - -#~ msgid "%s: extra arguments ignored after `%s'\n" -#~ msgstr "%s: `%s' ¤Î¸å¤í¤Î;ʬ¤Ê°ú¿ô¤Ï̵»ë¤µ¤ì¤Þ¤·¤¿\n" - -#~ msgid "too many gotos (max %d)" -#~ msgstr "goto ¤Î¿ô¤¬Â¿¤¹¤®¤Þ¤¹ (ºÇÂç %d)" - -#~ msgid "unexpected `/' found and ignored" -#~ msgstr "ͽ´ü¤·¤Ê¤¤ `/' ¤¬¸«¤Ä¤«¤ê¡¢Ìµ»ë¤µ¤ì¤Þ¤·¤¿" - -#~ msgid "unterminated comment" -#~ msgstr "ÊĤ¸¤Æ¤¤¤Ê¤¤¥³¥á¥ó¥È¤Ç¤¹" - -#~ msgid "unexpected end of file" -#~ msgstr "ͽ´ü¤·¤Ê¤¤¥Õ¥¡¥¤¥ë¤Î½ªÃ¼¤Ç¤¹" - -#~ msgid "unescaped newline in constant" -#~ msgstr "Äê¿ô¤ÎÃæ¤Ë¥¨¥¹¥±¡¼¥×¤µ¤ì¤Æ¤¤¤Ê¤¤²þ¹Ô¤¬¤¢¤ê¤Þ¤¹" - -#~ msgid "octal value outside range 0...255: `\\%o'" -#~ msgstr "8 ¿Ê¿ô¤ÎÃͤ¬ 0...255 ¤ÎÈϰϳ°¤Ç¤¹: `\\%o'" - -#~ msgid "hexadecimal value above 255: `\\x%x'" -#~ msgstr "16 ¿Ê¿ô¤ÎÃͤ¬ 255 ¤ò±Û¤¨¤Æ¤¤¤Þ¤¹: `\\x%x'" - -#~ msgid "unknown escape sequence: `\\' followed by `%s'" -#~ msgstr "̤ÃΤΥ¨¥¹¥±¡¼¥×¥·¡¼¥±¥ó¥¹: `\\' ¤Î¸å¤Ë `%s'" - -#~ msgid "unterminated type name at end of file" -#~ msgstr "ÊĤ¸¤é¤ì¤Æ¤¤¤Ê¤¤¥¿¥¤¥×̾¤¬¡¢¥Õ¥¡¥¤¥ëËöÈø¤Ë¤¢¤ê¤Þ¤¹" - -#~ msgid "unterminated type name" -#~ msgstr "ÊĤ¸¤é¤ì¤Æ¤¤¤Ê¤¤¥¿¥¤¥×̾¤¬¤¢¤ê¤Þ¤¹" - -#~ msgid "use \"...\" for multi-character literal tokens" -#~ msgstr "Ê£¿ôʸ»ú¤Î¥ê¥Æ¥é¥ë¥È¡¼¥¯¥ó¤Ë¤Ï \"...\" ¤ò»È¤¤¤Þ¤·¤ç¤¦" - -#~ msgid "`%s' supports no argument: %s" -#~ msgstr "`%s' ¤Ï°ú¿ô¤ò¼õ¤±ÉÕ¤±¤Þ¤»¤ó: %s" - -#~ msgid "`%s' requires an argument" -#~ msgstr "`%s' ¥ª¥×¥·¥ç¥ó¤Ï°ú¿ô¤òÍ׵ᤷ¤Þ¤¹" - -#~ msgid "maximum table size (%d) exceeded" -#~ msgstr "ºÇÂç¥Æ¡¼¥Ö¥ë¥µ¥¤¥º (%d) ¤òͤ¨¤Þ¤·¤¿" - -#~ msgid " (rule %d)" -#~ msgstr " (µ¬Â§ %d)" - -#~ msgid " $default\taccept\n" -#~ msgstr " $default\taccept\n" - -#~ msgid " NO ACTIONS\n" -#~ msgstr " ưºî̵¤·\n" - -#~ msgid " %-4s\terror (nonassociative)\n" -#~ msgstr " %-4s\t¥¨¥é¡¼ (Èó·ë¹ç)\n" - -#~ msgid " %-4s\tgo to state %d\n" -#~ msgstr " %-4s\t¾õÂÖ %d ¤Ø\n" - -#~ msgid "Number, Line, Rule" -#~ msgstr "ÈÖ¹æ, ¹Ô, µ¬Â§" - -#~ msgid " %3d %3d %s ->" -#~ msgstr " %3d %3d %s ->" - -#~ msgid " Skipping to next \\n" -#~ msgstr " ¼¡¤Î \\n ¤Ë¥¹¥­¥Ã¥×" - -#~ msgid " Skipping to next %c" -#~ msgstr " ¼¡¤Î %c ¤Ë¥¹¥­¥Ã¥×" - -#~ msgid "unterminated string" -#~ msgstr "ÊĤ¸¤é¤ì¤Æ¤¤¤Ê¤¤Ê¸»úÎó" - -#~ msgid "%s is invalid" -#~ msgstr "%s ¤ÏÉÔŬÀڤǤ¹" - -#~ msgid "unterminated `%{' definition" -#~ msgstr "`%{' ÄêµÁ ¤¬ÊĤ¸¤é¤ì¤Æ¤¤¤Þ¤»¤ó" - -#~ msgid "Premature EOF after %s" -#~ msgstr "%s ¤Î¸å¤í¤ËÁ᤯¤â EOF ¤¬¤¢¤ê¤Þ¤¹" - -#~ msgid "`%s' is invalid in %s" -#~ msgstr "`%s' ¤Ï %s Æâ¤Ç¤ÏÉÔŬÀڤǤ¹" - -#~ msgid "%type declaration has no " -#~ msgstr "%type Àë¸À¤Ë <¥¿¥¤¥×̾> ¤¬¤¢¤ê¤Þ¤»¤ó" - -#~ msgid "invalid %%type declaration due to item: %s" -#~ msgstr "¥¢¥¤¥Æ¥à¤Î°Ù¤Î %%type Àë¸À¤¬ÉÔŬÀڤǤ¹: %s" - -#~ msgid "invalid text (%s) - number should be after identifier" -#~ msgstr "ÉÔŬÀڤʥƥ­¥¹¥È (%s) - ¿ôÃͤϼ±Ê̻Ҥθå¤í¤Ë¤¢¤ë¤Ù¤­¤Ç¤¹" - -#~ msgid "unexpected item: %s" -#~ msgstr "ͽ´ü¤»¤Ì¥¢¥¤¥Æ¥à: %s" - -#~ msgid "unmatched %s" -#~ msgstr "Âбþ¤Î¤Ê¤¤ %s ¤Ç¤¹" - -#~ msgid "argument of %%expect is not an integer" -#~ msgstr "%%expect ¤Î°ú¿ô¤¬À°¿ôÃͤǤϤ¢¤ê¤Þ¤»¤ó" - -#~ msgid "unrecognized item %s, expected an identifier" -#~ msgstr "ǧ¼±¤Ç¤­¤Ê¤¤¥¢¥¤¥Æ¥à %s¡¢¤³¤³¤Ç¤Ï¼±Ê̻Ҥ¬´üÂÔ¤µ¤ì¤Þ¤¹" - -#~ msgid "expected string constant instead of %s" -#~ msgstr "¤³¤³¤Ç¤Ï %s ¤Ç¤Ï¤Ê¤¯Ê¸»úÎóÄê¿ô¤¬´üÂÔ¤µ¤ì¤Þ¤¹" - -#~ msgid "no input grammar" -#~ msgstr "ʸˡ¤ÎÆþÎϤ¬Ìµ¤¤" - -#~ msgid "unterminated %guard clause" -#~ msgstr "%guard À᤬ÊĤ¸¤é¤ì¤Æ¤¤¤Þ¤»¤ó" - -#~ msgid "ill-formed rule: initial symbol not followed by colon" -#~ msgstr "¼Ù°­¤Êµ¬Â§: ½é´ü²½¥·¥ó¥Ü¥ë¤Ë¥³¥í¥ó (:) ¤¬Â³¤¤¤Æ¤¤¤Þ¤»¤ó" - -#~ msgid "grammar starts with vertical bar" -#~ msgstr "ʸˡ¤Ï½ÄËÀ (|) ¤Ç»Ï¤á¤Þ¤¹" - -#~ msgid "two @prec's in a row" -#~ msgstr "@prec ¤Î¤â¤ÎÆó¤Ä¤¬Æ±Îó¤Ë¤Ê¤Ã¤Æ¤¤¤Þ¤¹" - -#~ msgid "%%guard present but %%semantic_parser not specified" -#~ msgstr "%%guard ¤¬¤¢¤ê¤Þ¤¹¤¬ %%semantic_parser ¤¬»ØÄꤵ¤ì¤Æ¤¤¤Þ¤»¤ó" - -#~ msgid "two actions at end of one rule" -#~ msgstr "°ì¤Ä¤Îµ¬Â§¤Î½ª¤ê¤ËÆó¤Ä¤Îưºî¤ò»ØÄꤷ¤Æ¤¤¤Þ¤¹" - -#~ msgid "too many symbols (tokens plus nonterminals); maximum %d" -#~ msgstr "¥·¥ó¥Ü¥ë¤¬Â¿¤¹¤®¤Þ¤¹ (¥È¡¼¥¯¥ó + Èó½ªÃ¼¥¢¥¤¥Æ¥à) -- ºÇÂç %d" - -#~ msgid "" -#~ "\n" -#~ "\n" -#~ "\n" -#~ "FIRSTS\n" -#~ "\n" -#~ msgstr "" -#~ "\n" -#~ "\n" -#~ "\n" -#~ "FIRSTS\n" -#~ "\n" - -#~ msgid "" -#~ "\n" -#~ "\n" -#~ "%s firsts\n" -#~ "\n" -#~ msgstr "" -#~ "\n" -#~ "\n" -#~ "%s firsts\n" -#~ "\n" - -#~ msgid "" -#~ "\n" -#~ "\n" -#~ "\n" -#~ "FDERIVES\n" -#~ msgstr "" -#~ "\n" -#~ "\n" -#~ "\n" -#~ "FDERIVES\n" - -#~ msgid "" -#~ "\n" -#~ "\n" -#~ "%s derives\n" -#~ "\n" -#~ msgstr "" -#~ "\n" -#~ "\n" -#~ "%s ¤Ï°Ê²¼¤«¤éÇÉÀ¸\n" -#~ "\n" - -#~ msgid " 1 shift/reduce conflict" -#~ msgstr " 1 ¥·¥Õ¥È/´Ô¸µ¾×ÆÍ" - -#~ msgid "%s contains" -#~ msgstr "%s ¤Ë¤Ï¡¢" - -#~ msgid "" -#~ "\n" -#~ "\n" -#~ "\n" -#~ "DERIVES\n" -#~ "\n" -#~ msgstr "" -#~ "\n" -#~ "\n" -#~ "\n" -#~ "DERIVES\n" -#~ "\n" - -#~ msgid "%s derives" -#~ msgstr "%s ¤Ï°Ê²¼¤«¤éÇÉÀ¸" - -#~ msgid "" -#~ "Usage: %s [-dhklntvyV] [-b file-prefix] [-o outfile] [-p name-prefix]\n" -#~ " [--debug] [--defines] [--fixed-output-files] [--no-lines]\n" -#~ " [--verbose] [--version] [--help] [--yacc]\n" -#~ " [--no-parser] [--token-table]\n" -#~ " [--file-prefix=prefix] [--name-prefix=prefix]\n" -#~ " [--output=outfile] grammar-file\n" -#~ "\n" -#~ "Report bugs to bug-bison@gnu.org\n" -#~ msgstr "" -#~ "»È¤¤Êý: %s [-dhklntvyV] [-b file-prefix] [-o outfile] [-p name-prefix]\n" -#~ " [--debug] [--defines] [--fixed-output-files] [--no-lines]\n" -#~ " [--verbose] [--version] [--help] [--yacc]\n" -#~ " [--no-parser] [--token-table]\n" -#~ " [--file-prefix=prefix] [--name-prefix=prefix]\n" -#~ " [--output=outfile] ʸˡ¥Õ¥¡¥¤¥ë\n" -#~ "\n" -#~ "¥Ð¥°¤ò¸«¤Ä¤±¤¿¤é bug-bison@gnu.org ¤Þ¤ÇÏ¢Íí¤ò¡£\n" - -#~ msgid "gotos" -#~ msgstr "goto" - -#~ msgid "%s:%d: fatal error: " -#~ msgstr "%s:%d: Ã×̿Ū¥¨¥é¡¼: " - -#~ msgid "%s: " -#~ msgstr "%s: " - -#~ msgid "%s:%d: " -#~ msgstr "%s:%d: " - -#~ msgid "%s: internal error: %s\n" -#~ msgstr "%s: ÆâÉô¥¨¥é¡¼: %s\n" - -#~ msgid "Entering set_nullable" -#~ msgstr "set_nullable ¤ËÆþ¤ê¤Þ¤¹" - -#~ msgid "\t\t/* empty */" -#~ msgstr "\t\t/* ¶õ */" - -#~ msgid "unterminated comment in `%{' definition" -#~ msgstr "`%{' ÄêµÁ ¤ËÊĤ¸¤é¤ì¤Æ¤¤¤Ê¤¤¥³¥á¥ó¥È¤¬¤¢¤ê¤Þ¤¹" - -#~ msgid "multiple %union declarations" -#~ msgstr "Ê£¿ô¤Î %union Àë¸À¤Ç¤¹" - -#~ msgid "unterminated comment at end of file" -#~ msgstr "¥Õ¥¡¥¤¥ëËöÈø¤ËÊĤ¸¤é¤ì¤Æ¤¤¤Ê¤¤¥³¥á¥ó¥È¤¬¤¢¤ê¤Þ¤¹" - -#~ msgid "unmatched close-brace (`}')" -#~ msgstr "Âбþ¤Î¤Ê¤¤ÊĤ¸¥Ö¥ì¡¼¥¹ (`}') ¤Ç¤¹" - -#~ msgid "unmatched right brace (`}')" -#~ msgstr "Âбþ¤Î¤Ê¤¤±¦¥Ö¥ì¡¼¥¹ (`}') ¤Ç¤¹" - -#~ msgid "$%s is invalid" -#~ msgstr "$%s ¤ÏÉÔŬÀڤǤ¹" - -#~ msgid "invalid @-construct" -#~ msgstr "ÉÔŬÀÚ¤Ê @-¥³¥ó¥¹¥È¥é¥¯¥È¤Ç¤¹" - -#~ msgid "ill-formed %type declaration" -#~ msgstr "¼Ù°­¤Ê %type Àë¸À¤Ç¤¹" - -#~ msgid "" -#~ "reduced %s defines %d terminal%s, %d nonterminal%s, and %d production%s.\n" -#~ msgstr "" -#~ "´Ô¸µ¥Õ¥¡¥¤¥ë %s ¤Ç %d ¸Ä¤Î½ªÃ¼»Ò%.0s, %d ¸Ä¤ÎÈó½ªÃ¼»Ò%.0s, %d ¸Ä¤Îµ¬Â§%.0s" -#~ "¤¬ÄêµÁ¤µ¤ì¤Þ¤·¤¿\n" - -#~ msgid "" -#~ "Variables\n" -#~ "---------\n" -#~ "\n" -#~ msgstr "" -#~ "ÊÑ¿ô\n" -#~ "---------\n" -#~ "\n" - -#~ msgid "Value Sprec Sassoc Tag\n" -#~ msgstr "ÃÍ Á°ÃÖ ·ë¹ç ¥¿¥°\n" - -#~ msgid "" -#~ "Rules\n" -#~ "-----\n" -#~ "\n" -#~ msgstr "" -#~ "µ¬Â§\n" -#~ "-----\n" -#~ "\n" - -#~ msgid "" -#~ "Rules interpreted\n" -#~ "-----------------\n" -#~ "\n" -#~ msgstr "" -#~ "²ò¼á¤µ¤ì¤¿µ¬Â§\n" -#~ "-----------------\n" -#~ "\n" diff --git a/src/bin/bison/po/ms.gmo b/src/bin/bison/po/ms.gmo deleted file mode 100644 index 949d0f355a..0000000000 Binary files a/src/bin/bison/po/ms.gmo and /dev/null differ diff --git a/src/bin/bison/po/ms.po b/src/bin/bison/po/ms.po deleted file mode 100644 index c54ed060c6..0000000000 --- a/src/bin/bison/po/ms.po +++ /dev/null @@ -1,738 +0,0 @@ -# Bison Bahasa Melayu (Malay) (ms). -# Copyright (C) 2003 Free Software Foundation, Inc. -# This file is distributed under the same license as the Bison package. -# Sharuzzaman Ahmat Raslan , 2003. -# -msgid "" -msgstr "" -"Project-Id-Version: bison 1.875a\n" -"Report-Msgid-Bugs-To: bug-bison@gnu.org\n" -"POT-Creation-Date: 2004-05-21 10:26-0700\n" -"PO-Revision-Date: 2003-02-26 22:43GMT+8\n" -"Last-Translator: Sharuzzaman Ahmat Raslan \n" -"Language-Team: Malay \n" -"MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=UTF-8\n" -"Content-Transfer-Encoding: 8bit\n" -"Plural-Forms: nplurals=1; plural=0;\n" -"X-Generator: KBabel 0.9.5\n" - -#: src/complain.c:51 src/complain.c:66 -msgid "warning: " -msgstr "amaran: " - -#: src/complain.c:122 src/complain.c:138 -msgid "fatal error: " -msgstr "ralat maut: " - -#: src/conflicts.c:76 -#, c-format -msgid " Conflict between rule %d and token %s resolved as shift" -msgstr " Konflik antara hukum %d dan token %s diselesaikan sebagai pindahan" - -#: src/conflicts.c:84 -#, c-format -msgid " Conflict between rule %d and token %s resolved as reduce" -msgstr "" -" Konflik antara hukum %d dan token %s diselesaikan sebagai pengurangan" - -#: src/conflicts.c:91 -#, c-format -msgid " Conflict between rule %d and token %s resolved as an error" -msgstr " Konflik antara hukum %d dan token %s diselesaikan sebagai ralat" - -#: src/conflicts.c:399 -#, c-format -msgid "conflicts: %d shift/reduce, %d reduce/reduce\n" -msgstr "konflik: %d pemindahan/pengurangan, %d pengurangan/pengurangan\n" - -#: src/conflicts.c:402 -#, c-format -msgid "conflicts: %d shift/reduce\n" -msgstr "konflik: %d pemindahan/pengurangan\n" - -#: src/conflicts.c:404 -#, c-format -msgid "conflicts: %d reduce/reduce\n" -msgstr "konflik: %d pengurangan/pengurangan\n" - -#: src/conflicts.c:422 -#, c-format -msgid "State %d " -msgstr "Keadaan %d " - -#: src/conflicts.c:487 -#, fuzzy, c-format -msgid "%%expect-rr applies only to GLR parsers" -msgstr "%s hanya berkesan kepada parser GLR" - -#: src/conflicts.c:511 -#, c-format -msgid "expected %d shift/reduce conflict" -msgid_plural "expected %d shift/reduce conflicts" -msgstr[0] "jangkaan %d konflik pemindahan/pengurangan" -msgstr[1] "jangkaan %d konflik pemindahan/pengurangan" - -#: src/conflicts.c:515 -#, fuzzy, c-format -msgid "expected %d reduce/reduce conflict" -msgid_plural "expected %d reduce/reduce conflicts" -msgstr[0] "jangkaan 0 konflik pengurangan/pengurangan" - -#: src/files.c:100 -#, c-format -msgid "cannot open file `%s'" -msgstr "tidak dapat membuka fail `%s'" - -#: src/files.c:116 -msgid "I/O error" -msgstr "Ralat I/O" - -#: src/files.c:119 -msgid "cannot close file" -msgstr "tidak dapat menutup fail" - -#: src/files.c:337 -#, c-format -msgid "conflicting outputs to file %s" -msgstr "keluaran berkonflik kepada fail %s" - -#: src/getargs.c:186 -#, c-format -msgid "Try `%s --help' for more information.\n" -msgstr "Cuba `%s --help' untuk lebih maklumat.\n" - -#: src/getargs.c:192 -msgid "GNU bison generates parsers for LALR(1) grammars.\n" -msgstr "GNU bison menjanakan penghurai untuk tatabahasa LALR(1).\n" - -#: src/getargs.c:196 -#, c-format -msgid "Usage: %s [OPTION]... FILE\n" -msgstr "Penggunaan: %s [PILIHAN]... FAIL\n" - -#: src/getargs.c:200 -msgid "" -"If a long option shows an argument as mandatory, then it is mandatory\n" -"for the equivalent short option also. Similarly for optional arguments.\n" -msgstr "" -"Jika satu pilihan panjang menunjukkan satu hujah sebagai mandatori, oleh itu " -"ia\n" -"mandatori untuk pilihan pendek sepadan juga. Serupa juga dengan hujah tidak " -"wajib.\n" - -#: src/getargs.c:206 -msgid "" -"Operation modes:\n" -" -h, --help display this help and exit\n" -" -V, --version output version information and exit\n" -" -y, --yacc emulate POSIX yacc\n" -msgstr "" -"Mod operasi:\n" -" -h, --help papar bantuan ini dan keluar\n" -" -V, --version keluarkan maklumat versi dan keluar\n" -" -y, --yacc tiru POSIX yacc\n" - -#: src/getargs.c:213 -msgid "" -"Parser:\n" -" -S, --skeleton=FILE specify the skeleton to use\n" -" -t, --debug instrument the parser for debugging\n" -" --locations enable locations computation\n" -" -p, --name-prefix=PREFIX prepend PREFIX to the external symbols\n" -" -l, --no-lines don't generate `#line' directives\n" -" -n, --no-parser generate the tables only\n" -" -k, --token-table include a table of token names\n" -msgstr "" -"Parser:\n" -" -S, --skeleton=FAIL nyatakan rangka untuk digunakan\n" -" -t, --debug peralatan parser untuk nyahpepijat\n" -" --locations hidupkan pengiraan lokasi\n" -" -p, --name-prefix=AWALAN tambah AWALAN kepada simbol luaran\n" -" -l, --no-lines jangan jana arahan `#line'\n" -" -n, --no-parser jana jadual sahaja\n" -" -k, --token-table sertakan jadual nama token\n" - -#: src/getargs.c:225 -msgid "" -"Output:\n" -" -d, --defines also produce a header file\n" -" -r, --report=THINGS also produce details on the automaton\n" -" -v, --verbose same as `--report=state'\n" -" -b, --file-prefix=PREFIX specify a PREFIX for output files\n" -" -o, --output=FILE leave output to FILE\n" -" -g, --graph also produce a VCG description of the " -"automaton\n" -msgstr "" -"Keluaran:\n" -" -d, --defines juga hasilkan fail header\n" -" -r, --report=PERKARA juga hasilkan butir terperinci bagi automaton\n" -" -v, --verbose sama seperti `--report=state'\n" -" -b, --file-prefix=AWALAN nyatakan AWALAN untuk fail keluaran\n" -" -o, --output=FAIL biarkan keluaran kepada FAIL\n" -" -g, --graph juga hasilkan huraian VCG bagi automaton\n" - -#: src/getargs.c:236 -msgid "" -"THINGS is a list of comma separated words that can include:\n" -" `state' describe the states\n" -" `itemset' complete the core item sets with their closure\n" -" `lookahead' explicitly associate lookaheads to items\n" -" `solved' describe shift/reduce conflicts solving\n" -" `all' include all the above information\n" -" `none' disable the report\n" -msgstr "" -"PERKARA adalah senarai perkataan dipisah koma yang boleh termasuk:\n" -" `state' nyatakan keadaan\n" -" `itemset' lengkapkan perkara asas dengan penutupnya\n" -" `lookahead' dengan jelas kaitkan lookahead kepada perkara\n" -" `solved' nyatakan penyelesaian konflik pemindahan/pengurangan\n" -" `all' masukkan semua maklumat diatas\n" -" `none' matikan laporan\n" - -#: src/getargs.c:247 -msgid "Report bugs to .\n" -msgstr "Lapor pepijat kepada .\n" - -#: src/getargs.c:264 -#, c-format -msgid "bison (GNU Bison) %s" -msgstr "bison (GNU Bison) %s" - -#: src/getargs.c:266 -msgid "Written by Robert Corbett and Richard Stallman.\n" -msgstr "Ditulis oleh Robert Corbett dan Richard Stallman.\n" - -#: src/getargs.c:270 -#, c-format -msgid "Copyright (C) %d Free Software Foundation, Inc.\n" -msgstr "Hakcipta (C) %d Free Software Foundation, Inc.\n" - -#: src/getargs.c:272 -msgid "" -"This is free software; see the source for copying conditions. There is NO\n" -"warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n" -msgstr "" -"Ini adalah perisian bebas; lihat sumber untuk syarat menyalin. TIADA\n" -"jaminan disediakan; tidak juga untuk KEBOLEHDAGANGAN atau KEUPAYAAN UNTUK " -"SESUATU TUJUAN KHUSUS.\n" - -#: src/getargs.c:438 -#, c-format -msgid "missing operand after `%s'" -msgstr "operan hilang selepas `%s'" - -#: src/getargs.c:440 -#, c-format -msgid "extra operand `%s'" -msgstr "operan tambahan `%s'" - -#: src/gram.c:139 -msgid "empty" -msgstr "kosong" - -#: src/gram.c:233 -msgid "Grammar" -msgstr "Tatabahasa" - -#: src/gram.c:321 src/reduce.c:394 -msgid "warning" -msgstr "amaran" - -#: src/main.c:124 -msgid "rule never reduced because of conflicts" -msgstr "hukum tidak dikurangkan kerana konflik" - -#: src/parse-gram.y:363 -msgid "POSIX forbids declarations in the grammar" -msgstr "POSIX melarang pengisytiharan didalam tatabahasa" - -#: src/parse-gram.y:486 -msgid "missing identifier in parameter declaration" -msgstr "pengecam hilang dalam parameter pengisytiharan" - -#: src/print.c:49 -#, c-format -msgid " type %d is %s\n" -msgstr " jenis %d adalah %s\n" - -#: src/print.c:165 -#, c-format -msgid "shift, and go to state %d\n" -msgstr "pindah, dan pergi ke keadaan %d\n" - -#: src/print.c:167 -#, c-format -msgid "go to state %d\n" -msgstr "pergi ke keadaan %d\n" - -#: src/print.c:204 -msgid "error (nonassociative)\n" -msgstr "ralat (tidak bergabung)\n" - -#: src/print.c:292 -#, c-format -msgid "reduce using rule %d (%s)" -msgstr "kurang menggunakan hukum %d (%s)" - -#: src/print.c:294 -#, c-format -msgid "accept" -msgstr "terima" - -#: src/print.c:325 src/print.c:391 -msgid "$default" -msgstr "$default" - -#: src/print.c:420 -#, c-format -msgid "state %d" -msgstr "keadaan %d" - -#: src/print.c:456 -msgid "Terminals, with rules where they appear" -msgstr "Terminal, dengan hukum dimana mereka kelihatan" - -#: src/print.c:483 -msgid "Nonterminals, with rules where they appear" -msgstr "Tidak terminal, dengan hukum dimana mereka kelihatan" - -#: src/print.c:512 -#, c-format -msgid " on left:" -msgstr " pada kiri:" - -#: src/print.c:527 -#, c-format -msgid " on right:" -msgstr " pada kanan:" - -#: src/print.c:555 -msgid "Rules never reduced" -msgstr "Hukum tidak dikurangkan" - -#: src/reader.c:56 -#, c-format -msgid "multiple %s declarations" -msgstr "pelbagai pengisytiharan %s" - -#: src/reader.c:118 -#, c-format -msgid "result type clash on merge function %s: <%s> != <%s>" -msgstr "jenis hasil bertelingkah pada fungsi gabung %s: <%s> != <%s>" - -#: src/reader.c:216 -#, c-format -msgid "rule given for %s, which is a token" -msgstr "hukum diberi untuk %s, dimana ia adalah token" - -#: src/reader.c:245 -#, c-format -msgid "type clash on default action: <%s> != <%s>" -msgstr "pertelingkahan jenis pada tindakan default: <%s> != <%s>" - -#: src/reader.c:251 -msgid "empty rule for typed nonterminal, and no action" -msgstr "hukum kosong untuk bukan terminal ditaip, dan tiada tindakan" - -#: src/reader.c:321 src/reader.c:335 src/reader.c:348 -#, c-format -msgid "only one %s allowed per rule" -msgstr "hanya satu %s dibenarkan setiap hukum" - -#: src/reader.c:331 src/reader.c:346 -#, c-format -msgid "%s affects only GLR parsers" -msgstr "%s hanya berkesan kepada parser GLR" - -#: src/reader.c:333 -#, c-format -msgid "%s must be followed by positive number" -msgstr "%s mesti diikuti dengan nombor positif" - -#: src/reader.c:490 -msgid "no rules in the input grammar" -msgstr "tiada hukum dalam masukan tatabahasa" - -#: src/reduce.c:242 -msgid "useless rule" -msgstr "hukum tidak berguna" - -#: src/reduce.c:303 -#, c-format -msgid "useless nonterminal: %s" -msgstr "bukan terminal tidak berguna: %s" - -#: src/reduce.c:351 -msgid "Useless nonterminals" -msgstr "Bukan terminal tidak berguna" - -#: src/reduce.c:364 -msgid "Terminals which are not used" -msgstr "Terminal yang tidak digunakan" - -#: src/reduce.c:373 -msgid "Useless rules" -msgstr "Hukum tidak berguna" - -#: src/reduce.c:389 -#, c-format -msgid "%d rule never reduced\n" -msgid_plural "%d rules never reduced\n" -msgstr[0] "%d hukum tidak dikurangkan\n" -msgstr[1] "%d hukum tidak dikurangkan\n" - -#: src/reduce.c:397 -#, c-format -msgid "%d useless nonterminal" -msgid_plural "%d useless nonterminals" -msgstr[0] "%d bukan terminal tidak berguna" -msgstr[1] "%d bukan terminal tidak berguna" - -#: src/reduce.c:403 -#, c-format -msgid " and " -msgstr " dan " - -#: src/reduce.c:406 -#, c-format -msgid "%d useless rule" -msgid_plural "%d useless rules" -msgstr[0] "%d hukum tidak berguna" -msgstr[1] "%d hukum tidak berguna" - -#: src/reduce.c:436 -#, c-format -msgid "start symbol %s does not derive any sentence" -msgstr "simbol permulaan %s tidak menghasilkan sebarang perkataan" - -#: src/scan-gram.l:162 -msgid "stray `,' treated as white space" -msgstr "`,' sesat dianggap sebagai ruang" - -#: src/scan-gram.l:225 -#, c-format -msgid "invalid directive: %s" -msgstr "arahan tidak sah: %s" - -#: src/scan-gram.l:283 -#, c-format -msgid "invalid character: %s" -msgstr "aksara tidak sah: %s" - -#: src/scan-gram.l:402 -#, fuzzy -msgid "invalid null character" -msgstr "aksara tidak sah: %s" - -#: src/scan-gram.l:415 src/scan-gram.l:427 src/scan-gram.l:448 -#, c-format -msgid "invalid escape sequence: %s" -msgstr "turutan escape tidak sah: %s" - -#: src/scan-gram.l:417 src/scan-gram.l:429 src/scan-gram.l:450 -#, fuzzy, c-format -msgid "invalid null character: %s" -msgstr "aksara tidak sah: %s" - -#: src/scan-gram.l:455 -#, c-format -msgid "unrecognized escape sequence: %s" -msgstr "turutan escape tidak dikenali: %s" - -#: src/scan-gram.l:537 -#, c-format -msgid "missing `{' in `%s'" -msgstr "`(' hilang dalam `%s'" - -#: src/scan-gram.l:782 -#, c-format -msgid "$$ of `%s' has no declared type" -msgstr "$$ dari `%s' tiada jenis diisytiharkan" - -#: src/scan-gram.l:803 -#, c-format -msgid "$%d of `%s' has no declared type" -msgstr "$%d dari `%s' tiada jenis diisytiharkan" - -#: src/scan-gram.l:812 src/scan-gram.l:881 src/scan-gram.l:932 -#, c-format -msgid "integer out of range: %s" -msgstr "integer diluar julat: %s" - -#: src/scan-gram.l:848 src/scan-gram.l:916 -#, c-format -msgid "invalid value: %s" -msgstr "nilai tidak sah: %s" - -#: src/scan-gram.l:1036 -#, c-format -msgid "missing `%s' at end of file" -msgstr "`%s' hilang pada penghujung fail" - -#: src/scan-gram.l:1047 -#, fuzzy, c-format -msgid "missing `%s' at end of line" -msgstr "`%s' hilang pada penghujung fail" - -#: src/symlist.c:97 src/symlist.c:108 -msgid "invalid $ value" -msgstr "nilai $ tidak sah" - -#: src/symtab.c:85 -#, c-format -msgid "type redeclaration for %s" -msgstr "pengisytiharan semula jenis untuk %s" - -#: src/symtab.c:102 src/symtab.c:120 -#, c-format -msgid "%s redeclaration for %s" -msgstr "%s pengisytiharan semula untuk %s" - -#: src/symtab.c:139 -#, c-format -msgid "redefining precedence of %s" -msgstr "mentakrif semula keutamaan %s" - -#: src/symtab.c:157 -#, c-format -msgid "symbol %s redefined" -msgstr "simbol %s ditakrif semula" - -#: src/symtab.c:180 -#, c-format -msgid "redefining user token number of %s" -msgstr "mentakrif semula nombor token pengguna %s" - -#: src/symtab.c:207 -#, c-format -msgid "symbol %s is used, but is not defined as a token and has no rules" -msgstr "" -"simbol %s digunakan, tetapi tidak ditakrifkan sebagai token atau mempunyai " -"hukum" - -#: src/symtab.c:232 -#, c-format -msgid "symbol `%s' used more than once as a literal string" -msgstr "simbol `%s' digunakan lebih dari sekali sebagai rentetan perkataan" - -#: src/symtab.c:235 -#, c-format -msgid "symbol `%s' given more than one literal string" -msgstr "simbol `%s' diberikan lebih daripada satu rentetan perkataan" - -#: src/symtab.c:271 -#, c-format -msgid "conflicting precedences for %s and %s" -msgstr "konflik keutamaan untuk %s dan %s" - -#: src/symtab.c:283 -#, c-format -msgid "conflicting associativities for %s (%s) and %s (%s)" -msgstr "konflik kaitan bagi %s (%s) dan %s (%s)" - -#: src/symtab.c:368 -#, c-format -msgid "tokens %s and %s both assigned number %d" -msgstr "token %s dan %s kedua-dunya diberi nombor %d" - -#: src/symtab.c:591 -#, c-format -msgid "the start symbol %s is undefined" -msgstr "simbol permulaan %s tidak ditakrifkan" - -#: src/symtab.c:595 -#, c-format -msgid "the start symbol %s is a token" -msgstr "simbol permulaan %s adalah token" - -#: lib/argmatch.c:133 -#, c-format -msgid "invalid argument %s for %s" -msgstr "hujah tidak sah %s untuk %s" - -#: lib/argmatch.c:134 -#, c-format -msgid "ambiguous argument %s for %s" -msgstr "hujah kabur %s untuk %s" - -#: lib/argmatch.c:153 -#, c-format -msgid "Valid arguments are:" -msgstr "Hujah yang sah adalah:" - -#: lib/bitset_stats.c:179 -#, c-format -msgid "%u bitset_allocs, %u freed (%.2f%%).\n" -msgstr "%u bitset_allocs, %u dibebaskan (%.2f%%).\n" - -#: lib/bitset_stats.c:182 -#, c-format -msgid "%u bitset_sets, %u cached (%.2f%%)\n" -msgstr "%u bitset_sets, %u disimpan (%.2f%%)\n" - -#: lib/bitset_stats.c:185 -#, c-format -msgid "%u bitset_resets, %u cached (%.2f%%)\n" -msgstr "%u bitset_resets, %u disimpan (%.2f%%)\n" - -#: lib/bitset_stats.c:188 -#, c-format -msgid "%u bitset_tests, %u cached (%.2f%%)\n" -msgstr "%u bitset_tests, %u disimpan (%.2f%%)\n" - -#: lib/bitset_stats.c:192 -#, c-format -msgid "%u bitset_lists\n" -msgstr "%u bitset_lists\n" - -#: lib/bitset_stats.c:194 -msgid "count log histogram\n" -msgstr "kira histogram log\n" - -#: lib/bitset_stats.c:197 -msgid "size log histogram\n" -msgstr "saiz histogram log\n" - -#: lib/bitset_stats.c:200 -msgid "density histogram\n" -msgstr "histogram kepadatan\n" - -#: lib/bitset_stats.c:214 -#, c-format -msgid "" -"Bitset statistics:\n" -"\n" -msgstr "" -"Statistik bitset:\n" -"\n" - -#: lib/bitset_stats.c:217 -#, c-format -msgid "Accumulated runs = %u\n" -msgstr "Pelaksanaan terkumpul = %u\n" - -#: lib/bitset_stats.c:261 lib/bitset_stats.c:266 -msgid "Could not read stats file." -msgstr "Tidak dapat membaca fail stats." - -#: lib/bitset_stats.c:263 -#, c-format -msgid "Bad stats file size.\n" -msgstr "Saiz fail stats tidak betul.\n" - -#: lib/bitset_stats.c:289 lib/bitset_stats.c:291 -msgid "Could not write stats file." -msgstr "Tidak dapat menulis fail stats." - -#: lib/bitset_stats.c:294 -msgid "Could not open stats file for writing." -msgstr "Tidak dapat membuka fail stats untuk menulis." - -#: lib/error.c:127 -msgid "Unknown system error" -msgstr "Ralat sistem tidak diketahui" - -#: lib/getopt.c:570 lib/getopt.c:589 -#, c-format -msgid "%s: option `%s' is ambiguous\n" -msgstr "%s: pilihan `%s' adalah kabur\n" - -#: lib/getopt.c:622 lib/getopt.c:626 -#, c-format -msgid "%s: option `--%s' doesn't allow an argument\n" -msgstr "%s: pilihan `--%s' tidak mengizinkan hujah\n" - -#: lib/getopt.c:635 lib/getopt.c:640 -#, c-format -msgid "%s: option `%c%s' doesn't allow an argument\n" -msgstr "%s: pilihan `%c%s' tidak mengizinkan hujah\n" - -#: lib/getopt.c:686 lib/getopt.c:708 lib/getopt.c:1039 lib/getopt.c:1061 -#, c-format -msgid "%s: option `%s' requires an argument\n" -msgstr "%s: pilihan `%s' memerlukan hujah\n" - -#: lib/getopt.c:746 lib/getopt.c:749 -#, c-format -msgid "%s: unrecognized option `--%s'\n" -msgstr "%s: pilihan tidak dikenali `--%s'\n" - -#: lib/getopt.c:757 lib/getopt.c:760 -#, c-format -msgid "%s: unrecognized option `%c%s'\n" -msgstr "%s: pilihan tidak dikenali '%c%s'\n" - -#: lib/getopt.c:815 lib/getopt.c:818 -#, c-format -msgid "%s: illegal option -- %c\n" -msgstr "%s: pilihan salah -- %c\n" - -#: lib/getopt.c:824 lib/getopt.c:827 -#, c-format -msgid "%s: invalid option -- %c\n" -msgstr "%s: pilihan tidak sah -- %c\n" - -#: lib/getopt.c:882 lib/getopt.c:901 lib/getopt.c:1114 lib/getopt.c:1135 -#, c-format -msgid "%s: option requires an argument -- %c\n" -msgstr "%s: pilihan memerlukan hujah -- %c\n" - -#: lib/getopt.c:954 lib/getopt.c:973 -#, c-format -msgid "%s: option `-W %s' is ambiguous\n" -msgstr "%s: pilihan `-W %s' adalah kabur\n" - -#: lib/getopt.c:997 lib/getopt.c:1018 -#, c-format -msgid "%s: option `-W %s' doesn't allow an argument\n" -msgstr "%s: pilihan `-W %s' tidak mengizinkan hujah\n" - -#: lib/obstack.c:417 lib/obstack.c:420 lib/xmalloc.c:53 -msgid "memory exhausted" -msgstr "kehabisan memori" - -#: lib/quotearg.c:238 -msgid "`" -msgstr "`" - -#: lib/quotearg.c:239 -msgid "'" -msgstr "'" - -#: lib/subpipe.c:171 -#, c-format -msgid "subsidiary program `%s' could not be invoked" -msgstr "program subsidiari `%s' tidak dapat dilaksanakan" - -#: lib/subpipe.c:173 -#, c-format -msgid "subsidiary program `%s' not found" -msgstr "program subsidiari `%s' tidak dijumpai" - -#: lib/subpipe.c:175 -#, c-format -msgid "subsidiary program `%s' failed" -msgstr "program subsidiari `%s' gagal" - -#: lib/subpipe.c:176 -#, c-format -msgid "subsidiary program `%s' failed (exit status %d)" -msgstr "program subsidiari `%s' gagal (status keluar %d)" - -#: lib/timevar.c:475 -msgid "" -"\n" -"Execution times (seconds)\n" -msgstr "" -"\n" -"Masa pelaksanaan (saat)\n" - -#: lib/timevar.c:525 -msgid " TOTAL :" -msgstr " JUMLAH :" - -#: lib/timevar.c:561 -#, c-format -msgid "time in %s: %ld.%06ld (%ld%%)\n" -msgstr "masa dalam %s: %ld.%06ld (%ld%%)\n" diff --git a/src/bin/bison/po/nl.gmo b/src/bin/bison/po/nl.gmo deleted file mode 100644 index c3c144ba5f..0000000000 Binary files a/src/bin/bison/po/nl.gmo and /dev/null differ diff --git a/src/bin/bison/po/nl.po b/src/bin/bison/po/nl.po deleted file mode 100644 index 5606008812..0000000000 --- a/src/bin/bison/po/nl.po +++ /dev/null @@ -1,750 +0,0 @@ -# Dutch messages for GNU bison. -# Copyright (C) 1996, 2002, 2003 Free Software Foundation, Inc. -# Tim Van Holder , 2002, 2003. -# Erick Branderhorst , 1996. -# -msgid "" -msgstr "" -"Project-Id-Version: bison 1.875a\n" -"Report-Msgid-Bugs-To: bug-bison@gnu.org\n" -"POT-Creation-Date: 2004-05-21 10:26-0700\n" -"PO-Revision-Date: 2003-02-02 02:19+0100\n" -"Last-Translator: Tim Van Holder \n" -"Language-Team: Dutch \n" -"MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=iso-8859-1\n" -"Content-Transfer-Encoding: 8bit\n" -"Plural-Forms: nplurals=2; plural=(n != 1);\n" - -#: src/complain.c:51 src/complain.c:66 -msgid "warning: " -msgstr "let op: " - -#: src/complain.c:122 src/complain.c:138 -msgid "fatal error: " -msgstr "fatale fout: " - -#: src/conflicts.c:76 -#, c-format -msgid " Conflict between rule %d and token %s resolved as shift" -msgstr " Conflict tussen regel %d en token %s opgelost als shift" - -#: src/conflicts.c:84 -#, c-format -msgid " Conflict between rule %d and token %s resolved as reduce" -msgstr " Conflict tussen regel %d en token %s opgelost als reductie" - -#: src/conflicts.c:91 -#, c-format -msgid " Conflict between rule %d and token %s resolved as an error" -msgstr " Conflict tussen regel %d en token %s opgelost als een fout" - -#: src/conflicts.c:399 -#, c-format -msgid "conflicts: %d shift/reduce, %d reduce/reduce\n" -msgstr "conflicten: %d shift/reductie, %d reductie/reductie\n" - -#: src/conflicts.c:402 -#, c-format -msgid "conflicts: %d shift/reduce\n" -msgstr "conflicten: %d shift/reductie\n" - -#: src/conflicts.c:404 -#, c-format -msgid "conflicts: %d reduce/reduce\n" -msgstr "conflicten: %d reductie/reductie\n" - -#: src/conflicts.c:422 -#, c-format -msgid "State %d " -msgstr "Staat %d" - -#: src/conflicts.c:487 -#, fuzzy, c-format -msgid "%%expect-rr applies only to GLR parsers" -msgstr "%s is enkel van toepassing op GLR parsers" - -#: src/conflicts.c:511 -#, c-format -msgid "expected %d shift/reduce conflict" -msgid_plural "expected %d shift/reduce conflicts" -msgstr[0] "%d shift/reductie conflict werd verwacht" -msgstr[1] "%d shift/reductie conflicten werden verwacht" - -#: src/conflicts.c:515 -#, fuzzy, c-format -msgid "expected %d reduce/reduce conflict" -msgid_plural "expected %d reduce/reduce conflicts" -msgstr[0] "er werden geen reductie/reductie conflicten verwacht" -msgstr[1] "er werden geen reductie/reductie conflicten verwacht" - -#: src/files.c:100 -#, c-format -msgid "cannot open file `%s'" -msgstr "kan bestand `%s' niet openen" - -#: src/files.c:116 -msgid "I/O error" -msgstr "I/O fout" - -#: src/files.c:119 -msgid "cannot close file" -msgstr "kan bestand niet sluiten" - -#: src/files.c:337 -#, c-format -msgid "conflicting outputs to file %s" -msgstr "conflicterende uitvoer naar bestand %s" - -#: src/getargs.c:186 -#, c-format -msgid "Try `%s --help' for more information.\n" -msgstr "Probeer `%s --help' voor meer informatie.\n" - -# Dank U, Akim :-) -#: src/getargs.c:192 -msgid "GNU bison generates parsers for LALR(1) grammars.\n" -msgstr "GNU bison genereert parsers voor LALR(1) grammatica's.\n" - -#: src/getargs.c:196 -#, c-format -msgid "Usage: %s [OPTION]... FILE\n" -msgstr "Gebruik: %s [OPTIE]... BESTAND\n" - -#: src/getargs.c:200 -msgid "" -"If a long option shows an argument as mandatory, then it is mandatory\n" -"for the equivalent short option also. Similarly for optional arguments.\n" -msgstr "" -"Wanneer een lange optie een argument als verplicht aanduidt, dan is dat\n" -"argument eveneens verplicht bij de overeenkomstige korte optie. Voor\n" -"optionele argumenten geldt dezelfde regel.\n" - -# Misschien beter 'een POSIX-compatibele yacc'? -#: src/getargs.c:206 -msgid "" -"Operation modes:\n" -" -h, --help display this help and exit\n" -" -V, --version output version information and exit\n" -" -y, --yacc emulate POSIX yacc\n" -msgstr "" -"Werkwijzes:\n" -" -h, --help toon deze hulptekst en beëindig het programma\n" -" -V, --version toon versie-informatie en beëindig het programma\n" -" -y, --yacc emuleer POSIX yacc\n" - -# Correcte vervoeging van 'voorvoegen'? -# Betere vertaling voor 'directives'? -#: src/getargs.c:213 -msgid "" -"Parser:\n" -" -S, --skeleton=FILE specify the skeleton to use\n" -" -t, --debug instrument the parser for debugging\n" -" --locations enable locations computation\n" -" -p, --name-prefix=PREFIX prepend PREFIX to the external symbols\n" -" -l, --no-lines don't generate `#line' directives\n" -" -n, --no-parser generate the tables only\n" -" -k, --token-table include a table of token names\n" -msgstr "" -"Parser:\n" -" -S, --skeleton=BESTAND geef het te gebruiken skeletbestand op\n" -" -t, --debug maak de parser geschikt voor debugging\n" -" --locations enable locations computation\n" -" -p, --name-prefix=PREFIX geef een PREFIX op voor de externe symbolen\n" -" -l, --no-lines genereer geen `#line' directieven\n" -" -n, --no-parser genereer alleen de tabellen\n" -" -k, --token-table genereer ook een tabel van tokennamen\n" - -#: src/getargs.c:225 -msgid "" -"Output:\n" -" -d, --defines also produce a header file\n" -" -r, --report=THINGS also produce details on the automaton\n" -" -v, --verbose same as `--report=state'\n" -" -b, --file-prefix=PREFIX specify a PREFIX for output files\n" -" -o, --output=FILE leave output to FILE\n" -" -g, --graph also produce a VCG description of the " -"automaton\n" -msgstr "" -"Uitvoer:\n" -" -d, --defines genereer ook een header-bestand\n" -" -r, --report=DINGEN genereer ook details over de automaat\n" -" -v, --verbose hetzelfde als `--report=state'\n" -" -b, --file-prefix=PREFIX geef een PREFIX op voor de uitvoerbestanden\n" -" -o, --output=BESTAND schrijf uitvoer naar BESTAND\n" -" -g, --graph genereer ook een VCG beschrijving van de " -"automaat\n" - -# Verschillende dingen die beter zouden moeten kunnen - zeker de 'itemset' tekst -#: src/getargs.c:236 -msgid "" -"THINGS is a list of comma separated words that can include:\n" -" `state' describe the states\n" -" `itemset' complete the core item sets with their closure\n" -" `lookahead' explicitly associate lookaheads to items\n" -" `solved' describe shift/reduce conflicts solving\n" -" `all' include all the above information\n" -" `none' disable the report\n" -msgstr "" -"DINGEN is een door komma's gescheiden lijst van woorden; geldige woorden " -"zijn:\n" -" `state' beschijft de staten van de automaat\n" -" `itemset' vervolledig de verzamelingen van core items met hun " -"closures\n" -" `lookahead' verbind lookaheads expliciet met items\n" -" `solved' beschijft het oplossen van shift/reductie conflicten\n" -" `all' bevat al de bovenstaande keuzes\n" -" `none' schakel de rapportering uit\n" - -#: src/getargs.c:247 -msgid "Report bugs to .\n" -msgstr "" -"Meld bugs aan .\n" -"Meld fouten in de vertaling aan .\n" - -#: src/getargs.c:264 -#, c-format -msgid "bison (GNU Bison) %s" -msgstr "bison (GNU Bison) %s" - -#: src/getargs.c:266 -msgid "Written by Robert Corbett and Richard Stallman.\n" -msgstr "Geschreven door Robert Corbett en Richard Stallman.\n" - -#: src/getargs.c:270 -#, c-format -msgid "Copyright (C) %d Free Software Foundation, Inc.\n" -msgstr "Copyright (C) %d Free Software Foundation, Inc.\n" - -#: src/getargs.c:272 -msgid "" -"This is free software; see the source for copying conditions. There is NO\n" -"warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n" -msgstr "" -"Dit is vrije software; zie de broncode voor kopieercondities. Er is GEEN\n" -"garantie; zelfs niet voor VERKOOPBAARHEID of GESCHIKTHEID VOOR EEN BEPAALD\n" -"DOEL.\n" - -#: src/getargs.c:438 -#, c-format -msgid "missing operand after `%s'" -msgstr "operand ontbreekt na `%s'" - -#: src/getargs.c:440 -#, c-format -msgid "extra operand `%s'" -msgstr "overtollige operand `%s'" - -#: src/gram.c:139 -msgid "empty" -msgstr "leeg" - -#: src/gram.c:233 -msgid "Grammar" -msgstr "Grammatica" - -#: src/gram.c:321 src/reduce.c:394 -msgid "warning" -msgstr "let op" - -#: src/main.c:124 -msgid "rule never reduced because of conflicts" -msgstr "regel wordt nooit gereduceerd omwille van conflicten" - -#: src/parse-gram.y:363 -msgid "POSIX forbids declarations in the grammar" -msgstr "POSIX verbiedt declaraties binnen de grammatica" - -#: src/parse-gram.y:486 -msgid "missing identifier in parameter declaration" -msgstr "naam ontbreekt in parameterdeclaratie" - -#: src/print.c:49 -#, c-format -msgid " type %d is %s\n" -msgstr " type %d is %s\n" - -#: src/print.c:165 -#, c-format -msgid "shift, and go to state %d\n" -msgstr "shift, en ga naar staat %d\n" - -#: src/print.c:167 -#, c-format -msgid "go to state %d\n" -msgstr "ga naar staat %d\n" - -#: src/print.c:204 -msgid "error (nonassociative)\n" -msgstr "fout (niet associatief)\n" - -#: src/print.c:292 -#, c-format -msgid "reduce using rule %d (%s)" -msgstr "reduceren via regel %d (%s)" - -#: src/print.c:294 -#, c-format -msgid "accept" -msgstr "accepteer" - -#: src/print.c:325 src/print.c:391 -msgid "$default" -msgstr "$standaard" - -#: src/print.c:420 -#, c-format -msgid "state %d" -msgstr "staat %d" - -#: src/print.c:456 -msgid "Terminals, with rules where they appear" -msgstr "Eindsymbolen, met de regels waarin ze voorkomen" - -# Betere vertaling voor non-terminals? 'tussensymbolen'? -#: src/print.c:483 -msgid "Nonterminals, with rules where they appear" -msgstr "Niet-eindsymbolen, met de regels waarin ze voorkomen" - -#: src/print.c:512 -#, c-format -msgid " on left:" -msgstr " links:" - -#: src/print.c:527 -#, c-format -msgid " on right:" -msgstr " rechts:" - -#: src/print.c:555 -msgid "Rules never reduced" -msgstr "Regels die nooit gereduceerd worden" - -#: src/reader.c:56 -#, c-format -msgid "multiple %s declarations" -msgstr "meerdere %s declaraties" - -#: src/reader.c:118 -#, c-format -msgid "result type clash on merge function %s: <%s> != <%s>" -msgstr "botsing tussen resultaattypes bij merge-functie %s: «%s» != «%s»" - -#: src/reader.c:216 -#, c-format -msgid "rule given for %s, which is a token" -msgstr "regel opgegeven voor token (%s)" - -#: src/reader.c:245 -#, c-format -msgid "type clash on default action: <%s> != <%s>" -msgstr "type-conflict bij standaardaktie: «%s» != «%s»" - -#: src/reader.c:251 -msgid "empty rule for typed nonterminal, and no action" -msgstr "lege regel voor niet-eindsymbool met type, en geen actie" - -#: src/reader.c:321 src/reader.c:335 src/reader.c:348 -#, c-format -msgid "only one %s allowed per rule" -msgstr "slechts één %s toegestaan per regel" - -#: src/reader.c:331 src/reader.c:346 -#, c-format -msgid "%s affects only GLR parsers" -msgstr "%s is enkel van toepassing op GLR parsers" - -#: src/reader.c:333 -#, c-format -msgid "%s must be followed by positive number" -msgstr "%s moet gevolgd worden door een positief getal" - -#: src/reader.c:490 -msgid "no rules in the input grammar" -msgstr "invoergrammatica bevat geen regels" - -#: src/reduce.c:242 -msgid "useless rule" -msgstr "nutteloze regel" - -#: src/reduce.c:303 -#, c-format -msgid "useless nonterminal: %s" -msgstr "nutteloos niet-eindsymbool: %s" - -#: src/reduce.c:351 -msgid "Useless nonterminals" -msgstr "Nutteloze niet-eindsymbolen" - -#: src/reduce.c:364 -msgid "Terminals which are not used" -msgstr "Eindsymbolen die niet gebruikt worden" - -#: src/reduce.c:373 -msgid "Useless rules" -msgstr "Nutteloze regels" - -#: src/reduce.c:389 -#, c-format -msgid "%d rule never reduced\n" -msgid_plural "%d rules never reduced\n" -msgstr[0] "%d regel wordt nooit gereduceerd\n" -msgstr[1] "%d regels worden nooit gereduceerd\n" - -#: src/reduce.c:397 -#, c-format -msgid "%d useless nonterminal" -msgid_plural "%d useless nonterminals" -msgstr[0] "%d nutteloos niet-eindsymbool" -msgstr[1] "%d nutteloze niet-eindsymbolen" - -#: src/reduce.c:403 -#, c-format -msgid " and " -msgstr " en " - -#: src/reduce.c:406 -#, c-format -msgid "%d useless rule" -msgid_plural "%d useless rules" -msgstr[0] "%d nutteloze regel" -msgstr[1] "%d nutteloze regels" - -# Ik _denk_ dat dit correct weergeeft wat er bedoeld wordt (m.a.w. er is geen regel voor het startsymbool) -#: src/reduce.c:436 -#, c-format -msgid "start symbol %s does not derive any sentence" -msgstr "uit startsymbool %s kan geen enkele zin afgeleid worden" - -#: src/scan-gram.l:162 -msgid "stray `,' treated as white space" -msgstr "losse `,' behandeld als witruimte" - -#: src/scan-gram.l:225 -#, c-format -msgid "invalid directive: %s" -msgstr "ongeldig commando: %s" - -#: src/scan-gram.l:283 -#, c-format -msgid "invalid character: %s" -msgstr "ongeldig teken: %s" - -#: src/scan-gram.l:402 -#, fuzzy -msgid "invalid null character" -msgstr "ongeldig teken: %s" - -#: src/scan-gram.l:415 src/scan-gram.l:427 src/scan-gram.l:448 -#, c-format -msgid "invalid escape sequence: %s" -msgstr "ongeldige escape: %s" - -#: src/scan-gram.l:417 src/scan-gram.l:429 src/scan-gram.l:450 -#, fuzzy, c-format -msgid "invalid null character: %s" -msgstr "ongeldig teken: %s" - -#: src/scan-gram.l:455 -#, c-format -msgid "unrecognized escape sequence: %s" -msgstr "onbekende escape: %s" - -#: src/scan-gram.l:537 -#, c-format -msgid "missing `{' in `%s'" -msgstr "`{' ontbreekt in `%s'" - -#: src/scan-gram.l:782 -#, c-format -msgid "$$ of `%s' has no declared type" -msgstr "$$ van `%s' heeft geen gedeclareerd type" - -#: src/scan-gram.l:803 -#, c-format -msgid "$%d of `%s' has no declared type" -msgstr "$%d van `%s' heeft geen gedeclareerd type" - -# Hier zou wel het bereik bij vermeld mogen worden... -#: src/scan-gram.l:812 src/scan-gram.l:881 src/scan-gram.l:932 -#, c-format -msgid "integer out of range: %s" -msgstr "integer buiten bereik: %s" - -#: src/scan-gram.l:848 src/scan-gram.l:916 -#, c-format -msgid "invalid value: %s" -msgstr "ongeldige waarde: %s" - -#: src/scan-gram.l:1036 -#, c-format -msgid "missing `%s' at end of file" -msgstr "`%s' ontbreekt aan einde van bestand" - -#: src/scan-gram.l:1047 -#, fuzzy, c-format -msgid "missing `%s' at end of line" -msgstr "`%s' ontbreekt aan einde van bestand" - -#: src/symlist.c:97 src/symlist.c:108 -msgid "invalid $ value" -msgstr "ongeldige $-waarde" - -#: src/symtab.c:85 -#, c-format -msgid "type redeclaration for %s" -msgstr "type herdeclaratie voor %s" - -# Dit ziet er een potentieel slechte originele string uit - wat kan er in die eerste '%s' staan? -#: src/symtab.c:102 src/symtab.c:120 -#, c-format -msgid "%s redeclaration for %s" -msgstr "%s herdeclaratie voor %s" - -#: src/symtab.c:139 -#, c-format -msgid "redefining precedence of %s" -msgstr "herdefinitie van de voorrang van %s" - -#: src/symtab.c:157 -#, c-format -msgid "symbol %s redefined" -msgstr "symbool %s opnieuw gedefinieerd" - -#: src/symtab.c:180 -#, c-format -msgid "redefining user token number of %s" -msgstr "herdefinitie van het door de gebruiker gekozen tokennummer van %s" - -#: src/symtab.c:207 -#, c-format -msgid "symbol %s is used, but is not defined as a token and has no rules" -msgstr "" -"symbool %s wordt gebruikt, maar is niet gedefinieerd als een teken en heeft " -"geen regels" - -#: src/symtab.c:232 -#, c-format -msgid "symbol `%s' used more than once as a literal string" -msgstr "symbool `%s' meer dan eens gebruikt als een letterlijke string" - -#: src/symtab.c:235 -#, c-format -msgid "symbol `%s' given more than one literal string" -msgstr "symbool `%s' krijgt meer dan één letterlijke string toegewezen" - -#: src/symtab.c:271 -#, c-format -msgid "conflicting precedences for %s and %s" -msgstr "voorrangen voor %s en %s geven conflicten" - -#: src/symtab.c:283 -#, c-format -msgid "conflicting associativities for %s (%s) and %s (%s)" -msgstr "associativiteitswaarden voor %s (%s) en %s (%s) geven conflicten" - -#: src/symtab.c:368 -#, c-format -msgid "tokens %s and %s both assigned number %d" -msgstr "tokens %s en %s hebben beide nummer %d toegewezen gekregen" - -#: src/symtab.c:591 -#, c-format -msgid "the start symbol %s is undefined" -msgstr "het startsymbool %s is niet gedefinieerd" - -#: src/symtab.c:595 -#, c-format -msgid "the start symbol %s is a token" -msgstr "het startsymbool %s is een token" - -#: lib/argmatch.c:133 -#, c-format -msgid "invalid argument %s for %s" -msgstr "ongeldige argument %s voor %s" - -#: lib/argmatch.c:134 -#, c-format -msgid "ambiguous argument %s for %s" -msgstr "argument %s voor %s is niet eenduidig" - -#: lib/argmatch.c:153 -#, c-format -msgid "Valid arguments are:" -msgstr "Geldige argumenten zijn:" - -#: lib/bitset_stats.c:179 -#, c-format -msgid "%u bitset_allocs, %u freed (%.2f%%).\n" -msgstr "%u bitset_allocs, %u vrijgegeven (%.2f%%).\n" - -#: lib/bitset_stats.c:182 -#, c-format -msgid "%u bitset_sets, %u cached (%.2f%%)\n" -msgstr "%u bitset_sets, %u gecached (%.2f%%)\n" - -#: lib/bitset_stats.c:185 -#, c-format -msgid "%u bitset_resets, %u cached (%.2f%%)\n" -msgstr "%u bitset_resets, %u gecached (%.2f%%)\n" - -#: lib/bitset_stats.c:188 -#, c-format -msgid "%u bitset_tests, %u cached (%.2f%%)\n" -msgstr "%u bitset_tests, %u gecached (%.2f%%)\n" - -#: lib/bitset_stats.c:192 -#, c-format -msgid "%u bitset_lists\n" -msgstr "%u bitset_lists\n" - -#: lib/bitset_stats.c:194 -msgid "count log histogram\n" -msgstr "count log histogram\n" - -#: lib/bitset_stats.c:197 -msgid "size log histogram\n" -msgstr "size log histogram\n" - -#: lib/bitset_stats.c:200 -msgid "density histogram\n" -msgstr "density histogram\n" - -#: lib/bitset_stats.c:214 -#, c-format -msgid "" -"Bitset statistics:\n" -"\n" -msgstr "" -"Bitset statistieken:\n" -"\n" - -#: lib/bitset_stats.c:217 -#, c-format -msgid "Accumulated runs = %u\n" -msgstr "Accumulated runs = %u\n" - -#: lib/bitset_stats.c:261 lib/bitset_stats.c:266 -msgid "Could not read stats file." -msgstr "Kon het statistiekenbestand niet lezen." - -#: lib/bitset_stats.c:263 -#, c-format -msgid "Bad stats file size.\n" -msgstr "Het statistiekenbestand heeft een verkeerde grootte.\n" - -#: lib/bitset_stats.c:289 lib/bitset_stats.c:291 -msgid "Could not write stats file." -msgstr "Kon niet schrijven naar het statistiekenbestand." - -#: lib/bitset_stats.c:294 -msgid "Could not open stats file for writing." -msgstr "Kon het statistiekenbestand niet openen voor schrijven." - -#: lib/error.c:127 -msgid "Unknown system error" -msgstr "Onbekende systeemfout" - -#: lib/getopt.c:570 lib/getopt.c:589 -#, c-format -msgid "%s: option `%s' is ambiguous\n" -msgstr "%s: optie `%s' is niet eenduidig\n" - -#: lib/getopt.c:622 lib/getopt.c:626 -#, c-format -msgid "%s: option `--%s' doesn't allow an argument\n" -msgstr "%s: optie `--%s' staat geen argument toe\n" - -#: lib/getopt.c:635 lib/getopt.c:640 -#, c-format -msgid "%s: option `%c%s' doesn't allow an argument\n" -msgstr "%s: optie `%c%s' staat geen argument toe\n" - -#: lib/getopt.c:686 lib/getopt.c:708 lib/getopt.c:1039 lib/getopt.c:1061 -#, c-format -msgid "%s: option `%s' requires an argument\n" -msgstr "%s: optie `%s' vereist een argument\n" - -#: lib/getopt.c:746 lib/getopt.c:749 -#, c-format -msgid "%s: unrecognized option `--%s'\n" -msgstr "%s: onbekende optie `--%s'\n" - -#: lib/getopt.c:757 lib/getopt.c:760 -#, c-format -msgid "%s: unrecognized option `%c%s'\n" -msgstr "%s: onbekende optie `%c%s'\n" - -#: lib/getopt.c:815 lib/getopt.c:818 -#, c-format -msgid "%s: illegal option -- %c\n" -msgstr "%s: ongeldige optie -- %c\n" - -#: lib/getopt.c:824 lib/getopt.c:827 -#, c-format -msgid "%s: invalid option -- %c\n" -msgstr "%s: ongeldige optie -- %c\n" - -#: lib/getopt.c:882 lib/getopt.c:901 lib/getopt.c:1114 lib/getopt.c:1135 -#, c-format -msgid "%s: option requires an argument -- %c\n" -msgstr "%s: optie vereist een argument -- %c\n" - -#: lib/getopt.c:954 lib/getopt.c:973 -#, c-format -msgid "%s: option `-W %s' is ambiguous\n" -msgstr "%s: optie `-W %s' is niet eenduidig\n" - -#: lib/getopt.c:997 lib/getopt.c:1018 -#, c-format -msgid "%s: option `-W %s' doesn't allow an argument\n" -msgstr "%s: optie `--%s' staat geen argument toe\n" - -#: lib/obstack.c:417 lib/obstack.c:420 lib/xmalloc.c:53 -msgid "memory exhausted" -msgstr "geen geheugen meer beschikbaar" - -#: lib/quotearg.c:238 -msgid "`" -msgstr "`" - -#: lib/quotearg.c:239 -msgid "'" -msgstr "'" - -#: lib/subpipe.c:171 -#, c-format -msgid "subsidiary program `%s' could not be invoked" -msgstr "hulpprogramma `%s' kon niet opgeroepen worden" - -#: lib/subpipe.c:173 -#, c-format -msgid "subsidiary program `%s' not found" -msgstr "hulpprogramma `%s' niet gevonden" - -#: lib/subpipe.c:175 -#, c-format -msgid "subsidiary program `%s' failed" -msgstr "hulpprogramma `%s' mislukt" - -#: lib/subpipe.c:176 -#, c-format -msgid "subsidiary program `%s' failed (exit status %d)" -msgstr "hulpprogramma `%s' mislukt (eindstatus %d)" - -#: lib/timevar.c:475 -msgid "" -"\n" -"Execution times (seconds)\n" -msgstr "" -"\n" -"Uitvoeringstijden (in seconden)\n" - -#: lib/timevar.c:525 -msgid " TOTAL :" -msgstr " TOTAAL :" - -#: lib/timevar.c:561 -#, c-format -msgid "time in %s: %ld.%06ld (%ld%%)\n" -msgstr "tijd in %s: %ld.%06ld (%ld%%)\n" diff --git a/src/bin/bison/po/pt_BR.gmo b/src/bin/bison/po/pt_BR.gmo deleted file mode 100644 index a37851ec81..0000000000 Binary files a/src/bin/bison/po/pt_BR.gmo and /dev/null differ diff --git a/src/bin/bison/po/pt_BR.po b/src/bin/bison/po/pt_BR.po deleted file mode 100644 index fc7782f415..0000000000 --- a/src/bin/bison/po/pt_BR.po +++ /dev/null @@ -1,736 +0,0 @@ -# bison: translation to Brazilian Portuguese (pt_BR) -# Copyright (C) 2002 Free Software Foundation, Inc. -# Alexandre Folle de Menezes , 2002, 2003. -# -msgid "" -msgstr "" -"Project-Id-Version: bison 1.875\n" -"Report-Msgid-Bugs-To: bug-bison@gnu.org\n" -"POT-Creation-Date: 2004-05-21 10:26-0700\n" -"PO-Revision-Date: 2003-01-06 02:30-0300\n" -"Last-Translator: Alexandre Folle de Menezes \n" -"Language-Team: Brazilian Portuguese \n" -"MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=ISO-8859-1\n" -"Content-Transfer-Encoding: 8-bit\n" -"Plural-Forms: nplurals=2; plural=(n > 1);\n" - -#: src/complain.c:51 src/complain.c:66 -msgid "warning: " -msgstr "aviso: " - -#: src/complain.c:122 src/complain.c:138 -msgid "fatal error: " -msgstr "erro fatal: " - -#: src/conflicts.c:76 -#, c-format -msgid " Conflict between rule %d and token %s resolved as shift" -msgstr " Conflito entre a regra %d e a token %s resolvido como `shift`." - -#: src/conflicts.c:84 -#, c-format -msgid " Conflict between rule %d and token %s resolved as reduce" -msgstr " Conflito entre a regra %d e a token %s resolvido como `reduce`." - -#: src/conflicts.c:91 -#, c-format -msgid " Conflict between rule %d and token %s resolved as an error" -msgstr " Conflito entre a regra %d e a token %s resolvido como um erro." - -#: src/conflicts.c:399 -#, c-format -msgid "conflicts: %d shift/reduce, %d reduce/reduce\n" -msgstr "conflitos: %d de deslocamento/redução, %d de redução/redução\n" - -#: src/conflicts.c:402 -#, c-format -msgid "conflicts: %d shift/reduce\n" -msgstr "conflitos: %d de deslocamento/redução\n" - -#: src/conflicts.c:404 -#, c-format -msgid "conflicts: %d reduce/reduce\n" -msgstr "conflitos: %d de redução/redução\n" - -#: src/conflicts.c:422 -#, c-format -msgid "State %d " -msgstr "Estado %d" - -#: src/conflicts.c:487 -#, fuzzy, c-format -msgid "%%expect-rr applies only to GLR parsers" -msgstr "%s afeta apenas analisadores GLR" - -#: src/conflicts.c:511 -#, c-format -msgid "expected %d shift/reduce conflict" -msgid_plural "expected %d shift/reduce conflicts" -msgstr[0] "esperado: %d conflito de deslocamento/redução" -msgstr[1] "esperados: %d conflitos de deslocamento/redução" - -#: src/conflicts.c:515 -#, fuzzy, c-format -msgid "expected %d reduce/reduce conflict" -msgid_plural "expected %d reduce/reduce conflicts" -msgstr[0] "esperados 0 conflitos de redução/redução" -msgstr[1] "esperados 0 conflitos de redução/redução" - -#: src/files.c:100 -#, c-format -msgid "cannot open file `%s'" -msgstr "impossível abrir o arquivo `%s'" - -#: src/files.c:116 -msgid "I/O error" -msgstr "Erro de E/S" - -#: src/files.c:119 -msgid "cannot close file" -msgstr "impossível fechar o arquivo" - -#: src/files.c:337 -#, c-format -msgid "conflicting outputs to file %s" -msgstr "saídas conflitantes para o arquivo %s" - -#: src/getargs.c:186 -#, c-format -msgid "Try `%s --help' for more information.\n" -msgstr "tente `%s --help' para mais informações.\n" - -#: src/getargs.c:192 -msgid "GNU bison generates parsers for LALR(1) grammars.\n" -msgstr "GNU bison gera analisadores para gramáticas LALR(1).\n" - -#: src/getargs.c:196 -#, c-format -msgid "Usage: %s [OPTION]... FILE\n" -msgstr "Uso: %s [OPCAO]... ARQUIVO\n" - -#: src/getargs.c:200 -msgid "" -"If a long option shows an argument as mandatory, then it is mandatory\n" -"for the equivalent short option also. Similarly for optional arguments.\n" -msgstr "" -"Se uma opção longa mostra um argumento como obrigatório, então ele é\n" -"obrigatório para a opção curta equivalente também. Igualmente para os\n" -"argumentos opcionais.\n" - -#: src/getargs.c:206 -msgid "" -"Operation modes:\n" -" -h, --help display this help and exit\n" -" -V, --version output version information and exit\n" -" -y, --yacc emulate POSIX yacc\n" -msgstr "" -"Modos de operação:\n" -" -h, --help exibe esta ajuda e sai\n" -" -V, --version mostra informações de versão e sai\n" -" -y, --yacc emula o yacc POSIX\n" - -#: src/getargs.c:213 -msgid "" -"Parser:\n" -" -S, --skeleton=FILE specify the skeleton to use\n" -" -t, --debug instrument the parser for debugging\n" -" --locations enable locations computation\n" -" -p, --name-prefix=PREFIX prepend PREFIX to the external symbols\n" -" -l, --no-lines don't generate `#line' directives\n" -" -n, --no-parser generate the tables only\n" -" -k, --token-table include a table of token names\n" -msgstr "" -"Analizador:\n" -" -S, --skeleton=arquivo especifica o skeleto a ser usado\n" -" -t, --debug instrumenta o analisador para depuração\n" -" --locations habilita a computação de localizações\n" -" -p, --name-prefix=PREFIXO adiciona PREFIXO aos símbolos externos\n" -" -l, --no-lines não gera diretivas `#line'\n" -" -n, --no-parser apenas gera as tabelas\n" -" --k, --token-table inclui uma tabela de nomes de tokens\n" - -#: src/getargs.c:225 -msgid "" -"Output:\n" -" -d, --defines also produce a header file\n" -" -r, --report=THINGS also produce details on the automaton\n" -" -v, --verbose same as `--report=state'\n" -" -b, --file-prefix=PREFIX specify a PREFIX for output files\n" -" -o, --output=FILE leave output to FILE\n" -" -g, --graph also produce a VCG description of the " -"automaton\n" -msgstr "" -"Saída:\n" -" -d, --defines também produz um arquivo de cabeçalho\n" -" -r, --report=ITENS também produz detalhes do autômato\n" -" -v, --verbose o mesmo que `--report=state'\n" -" -b, --file-prefix=PREFIXO especifica o PREFIXO para os arquivos de saída\n" -" -o, --output=ARQUIVO armazena a saída em ARQUIVO\n" -" -g, --graph também produz uma descrição em VCG do autômato\n" - -#: src/getargs.c:236 -msgid "" -"THINGS is a list of comma separated words that can include:\n" -" `state' describe the states\n" -" `itemset' complete the core item sets with their closure\n" -" `lookahead' explicitly associate lookaheads to items\n" -" `solved' describe shift/reduce conflicts solving\n" -" `all' include all the above information\n" -" `none' disable the report\n" -msgstr "" -"ITENS é uma lista separada por vírgulas, que pode incluir:\n" -" `state' descreve os estados\n" -" `itemset' completa os conjuntos de ítens básicos com seus " -"fechamentos\n" -" `lookahead' associa explicitamente as previsões com os ítens\n" -" `solved' descreve a solução de conflitos de deslocamento/redução\n" -" `all' inclui todas as informações acima\n" -" `none' desabilita o relatório\n" - -#: src/getargs.c:247 -msgid "Report bugs to .\n" -msgstr "Informe os erros para .\n" - -#: src/getargs.c:264 -#, c-format -msgid "bison (GNU Bison) %s" -msgstr "bison (GNU bison) %s" - -#: src/getargs.c:266 -msgid "Written by Robert Corbett and Richard Stallman.\n" -msgstr "Escrito por Robert Corbett e Richard Stallman.\n" - -#: src/getargs.c:270 -#, c-format -msgid "Copyright (C) %d Free Software Foundation, Inc.\n" -msgstr "Copyright © %d Free Software Foundation, Inc.\n" - -#: src/getargs.c:272 -msgid "" -"This is free software; see the source for copying conditions. There is NO\n" -"warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n" -msgstr "" -"Este é um software livre; veja o código fonte para condições de copyright. " -"Não\n" -"existe NENHUMA garantia; nem mesmo a garantia implícita de COMERCIABILIDADE " -"ou\n" -"ADEQUAÇÃO À QUALQUER FINALIDADE PARTICULAR.\n" - -#: src/getargs.c:438 -#, c-format -msgid "missing operand after `%s'" -msgstr "falta operando depois de `%s'" - -#: src/getargs.c:440 -#, c-format -msgid "extra operand `%s'" -msgstr "operando `%s' sobrando" - -#: src/gram.c:139 -msgid "empty" -msgstr "vazio" - -#: src/gram.c:233 -msgid "Grammar" -msgstr "Gramática" - -#: src/gram.c:321 src/reduce.c:394 -msgid "warning" -msgstr "aviso" - -#: src/main.c:124 -msgid "rule never reduced because of conflicts" -msgstr "regra não reduzida por causa de conflitos" - -#: src/parse-gram.y:363 -msgid "POSIX forbids declarations in the grammar" -msgstr "o POSIX proíbe declarações na gramática" - -#: src/parse-gram.y:486 -msgid "missing identifier in parameter declaration" -msgstr "identificador faltando na declaração do parâmetro" - -#: src/print.c:49 -#, c-format -msgid " type %d is %s\n" -msgstr " tipo %d é %s\n" - -#: src/print.c:165 -#, c-format -msgid "shift, and go to state %d\n" -msgstr "deslocar, e ir ao estado %d\n" - -#: src/print.c:167 -#, c-format -msgid "go to state %d\n" -msgstr "ir ao estado %d\n" - -#: src/print.c:204 -msgid "error (nonassociative)\n" -msgstr "erro (não associativo)\n" - -#: src/print.c:292 -#, c-format -msgid "reduce using rule %d (%s)" -msgstr "reduzir usando a regra %d (%s)" - -#: src/print.c:294 -#, c-format -msgid "accept" -msgstr "aceitar" - -#: src/print.c:325 src/print.c:391 -msgid "$default" -msgstr "$padrão" - -#: src/print.c:420 -#, c-format -msgid "state %d" -msgstr "estado %d" - -#: src/print.c:456 -msgid "Terminals, with rules where they appear" -msgstr "Terminais, com as regras onde eles aparecem" - -#: src/print.c:483 -msgid "Nonterminals, with rules where they appear" -msgstr "Não-terminais com as regras onde eles aparecem" - -#: src/print.c:512 -#, c-format -msgid " on left:" -msgstr " à esquerda:" - -#: src/print.c:527 -#, c-format -msgid " on right:" -msgstr " à direita:" - -#: src/print.c:555 -msgid "Rules never reduced" -msgstr "Regras nunca reduzidas" - -#: src/reader.c:56 -#, c-format -msgid "multiple %s declarations" -msgstr "declarações de %s múltiplas" - -#: src/reader.c:118 -#, c-format -msgid "result type clash on merge function %s: <%s> != <%s>" -msgstr "tipo de resultado conflita na fução de mescla %s: <%s> != <%s>" - -#: src/reader.c:216 -#, c-format -msgid "rule given for %s, which is a token" -msgstr "regra fornecida para %s, que é um token" - -#: src/reader.c:245 -#, c-format -msgid "type clash on default action: <%s> != <%s>" -msgstr "conflito de tipos na ação padrão: <%s> != <%s>" - -#: src/reader.c:251 -msgid "empty rule for typed nonterminal, and no action" -msgstr "regra vazia para um não-terminal com tipo, e não há ações" - -#: src/reader.c:321 src/reader.c:335 src/reader.c:348 -#, c-format -msgid "only one %s allowed per rule" -msgstr "apenas um %s é permitido por regra" - -#: src/reader.c:331 src/reader.c:346 -#, c-format -msgid "%s affects only GLR parsers" -msgstr "%s afeta apenas analisadores GLR" - -#: src/reader.c:333 -#, c-format -msgid "%s must be followed by positive number" -msgstr "%s deve ser seguido por um número positivo" - -#: src/reader.c:490 -msgid "no rules in the input grammar" -msgstr "não há regras na gramática de entrada" - -#: src/reduce.c:242 -msgid "useless rule" -msgstr "regra inútil" - -#: src/reduce.c:303 -#, c-format -msgid "useless nonterminal: %s" -msgstr "não-terminal inútil: %s" - -#: src/reduce.c:351 -msgid "Useless nonterminals" -msgstr "Não-terminais inúteis" - -#: src/reduce.c:364 -msgid "Terminals which are not used" -msgstr "Terminais que não foram usados" - -#: src/reduce.c:373 -msgid "Useless rules" -msgstr "Regras inúteis" - -#: src/reduce.c:389 -#, c-format -msgid "%d rule never reduced\n" -msgid_plural "%d rules never reduced\n" -msgstr[0] "%d regra que nunca foi reduzida\n" -msgstr[1] "%d regras que nunca foram reduzidas\n" - -#: src/reduce.c:397 -#, c-format -msgid "%d useless nonterminal" -msgid_plural "%d useless nonterminals" -msgstr[0] "%d não-terminal inútil" -msgstr[1] "%d não-terminal inútil" - -#: src/reduce.c:403 -#, c-format -msgid " and " -msgstr " e " - -#: src/reduce.c:406 -#, c-format -msgid "%d useless rule" -msgid_plural "%d useless rules" -msgstr[0] "%d regra inútil" -msgstr[1] "%d regras inúteis" - -#: src/reduce.c:436 -#, c-format -msgid "start symbol %s does not derive any sentence" -msgstr "símbolo de início %s não deriva nenhuma sentença" - -#: src/scan-gram.l:162 -msgid "stray `,' treated as white space" -msgstr "`,' perdida tratada como branco" - -#: src/scan-gram.l:225 -#, c-format -msgid "invalid directive: %s" -msgstr "diretiva inválida: %s" - -#: src/scan-gram.l:283 -#, c-format -msgid "invalid character: %s" -msgstr "caractere inválido: %s" - -#: src/scan-gram.l:402 -#, fuzzy -msgid "invalid null character" -msgstr "caractere inválido: %s" - -#: src/scan-gram.l:415 src/scan-gram.l:427 src/scan-gram.l:448 -#, c-format -msgid "invalid escape sequence: %s" -msgstr "seqüência de escape inválida: %s" - -#: src/scan-gram.l:417 src/scan-gram.l:429 src/scan-gram.l:450 -#, fuzzy, c-format -msgid "invalid null character: %s" -msgstr "caractere inválido: %s" - -#: src/scan-gram.l:455 -#, c-format -msgid "unrecognized escape sequence: %s" -msgstr "seqüência de escape não reconhecida: %s" - -#: src/scan-gram.l:537 -#, c-format -msgid "missing `{' in `%s'" -msgstr "falta `{' em `%s'" - -#: src/scan-gram.l:782 -#, c-format -msgid "$$ of `%s' has no declared type" -msgstr "$$ de `%s' não tem tipo declarado" - -#: src/scan-gram.l:803 -#, c-format -msgid "$%d of `%s' has no declared type" -msgstr "$%d de `%s' não tem tipo declarado" - -#: src/scan-gram.l:812 src/scan-gram.l:881 src/scan-gram.l:932 -#, c-format -msgid "integer out of range: %s" -msgstr "inteiro fora de faixa: %s" - -#: src/scan-gram.l:848 src/scan-gram.l:916 -#, c-format -msgid "invalid value: %s" -msgstr "valor inválido: %s" - -#: src/scan-gram.l:1036 -#, c-format -msgid "missing `%s' at end of file" -msgstr "`%s' faltando no final do arquivo" - -#: src/scan-gram.l:1047 -#, fuzzy, c-format -msgid "missing `%s' at end of line" -msgstr "`%s' faltando no final do arquivo" - -#: src/symlist.c:97 src/symlist.c:108 -msgid "invalid $ value" -msgstr "valor $ inválido" - -#: src/symtab.c:85 -#, c-format -msgid "type redeclaration for %s" -msgstr "redeclaração de tipo para %s" - -#: src/symtab.c:102 src/symtab.c:120 -#, c-format -msgid "%s redeclaration for %s" -msgstr "redeclaração de %s para %s" - -#: src/symtab.c:139 -#, c-format -msgid "redefining precedence of %s" -msgstr "redefinindo precedência de %s" - -#: src/symtab.c:157 -#, c-format -msgid "symbol %s redefined" -msgstr "símbolo %s redefinido" - -#: src/symtab.c:180 -#, c-format -msgid "redefining user token number of %s" -msgstr "redefinindo número de token de usuário de %s" - -#: src/symtab.c:207 -#, c-format -msgid "symbol %s is used, but is not defined as a token and has no rules" -msgstr "símbolo %s usado, mas não definido como uma token e não tem regras" - -#: src/symtab.c:232 -#, c-format -msgid "symbol `%s' used more than once as a literal string" -msgstr "símbolo `%s' usado mais the uma vez como uma string literal" - -#: src/symtab.c:235 -#, c-format -msgid "symbol `%s' given more than one literal string" -msgstr "símbolo `%s' associado a mais de uma string literal" - -#: src/symtab.c:271 -#, c-format -msgid "conflicting precedences for %s and %s" -msgstr "precedências conflitantes para %s e %s" - -#: src/symtab.c:283 -#, c-format -msgid "conflicting associativities for %s (%s) and %s (%s)" -msgstr "valores associativos conflitantes para %s (%s) e %s (%s)" - -#: src/symtab.c:368 -#, c-format -msgid "tokens %s and %s both assigned number %d" -msgstr "tokens %s e %s associadas ao mesmo número %d" - -#: src/symtab.c:591 -#, c-format -msgid "the start symbol %s is undefined" -msgstr "o símbolo de início %s não está definido" - -#: src/symtab.c:595 -#, c-format -msgid "the start symbol %s is a token" -msgstr "o símbolo de início %s é um terminal" - -#: lib/argmatch.c:133 -#, c-format -msgid "invalid argument %s for %s" -msgstr "argumento %s inválido para %s" - -#: lib/argmatch.c:134 -#, c-format -msgid "ambiguous argument %s for %s" -msgstr "argumento %s ambíguo para %s" - -#: lib/argmatch.c:153 -#, c-format -msgid "Valid arguments are:" -msgstr "Argumentos válidos são:" - -#: lib/bitset_stats.c:179 -#, c-format -msgid "%u bitset_allocs, %u freed (%.2f%%).\n" -msgstr "%u bitset_allocs, %u liberados (%.2f%%).\n" - -#: lib/bitset_stats.c:182 -#, c-format -msgid "%u bitset_sets, %u cached (%.2f%%)\n" -msgstr "%u bitset_sets, %u em cache (%.2f%%)\n" - -#: lib/bitset_stats.c:185 -#, c-format -msgid "%u bitset_resets, %u cached (%.2f%%)\n" -msgstr "%u bitset_resets, %u em cache (%.2f%%)\n" - -#: lib/bitset_stats.c:188 -#, c-format -msgid "%u bitset_tests, %u cached (%.2f%%)\n" -msgstr "%u bitset_tests, %u em cache (%.2f%%)\n" - -#: lib/bitset_stats.c:192 -#, c-format -msgid "%u bitset_lists\n" -msgstr "%u bitset_lists\n" - -#: lib/bitset_stats.c:194 -msgid "count log histogram\n" -msgstr "histograma de log de contagens\n" - -#: lib/bitset_stats.c:197 -msgid "size log histogram\n" -msgstr "histograma de log de tamanhos\n" - -#: lib/bitset_stats.c:200 -msgid "density histogram\n" -msgstr "histograma de densidades\n" - -#: lib/bitset_stats.c:214 -#, c-format -msgid "" -"Bitset statistics:\n" -"\n" -msgstr "" -"Estatísticas de bitset:\n" -"\n" - -#: lib/bitset_stats.c:217 -#, c-format -msgid "Accumulated runs = %u\n" -msgstr "Execuções acumuladas = %u\n" - -#: lib/bitset_stats.c:261 lib/bitset_stats.c:266 -msgid "Could not read stats file." -msgstr "Impossível ler o arquivo de estatísticas." - -#: lib/bitset_stats.c:263 -#, c-format -msgid "Bad stats file size.\n" -msgstr "Tamanho do arquivo de estatísticas com erro.\n" - -#: lib/bitset_stats.c:289 lib/bitset_stats.c:291 -msgid "Could not write stats file." -msgstr "Impossível de escrever no arquivo de estatísticas." - -#: lib/bitset_stats.c:294 -msgid "Could not open stats file for writing." -msgstr "Impossível abrir arquivo de estatísticas para escrita." - -#: lib/error.c:127 -msgid "Unknown system error" -msgstr "Erro de sistema desconhecido" - -#: lib/getopt.c:570 lib/getopt.c:589 -#, c-format -msgid "%s: option `%s' is ambiguous\n" -msgstr "%s: a opção `%s' é ambígua\n" - -#: lib/getopt.c:622 lib/getopt.c:626 -#, c-format -msgid "%s: option `--%s' doesn't allow an argument\n" -msgstr "%s: a opção `--%s' no admite nenhum argumento\n" - -#: lib/getopt.c:635 lib/getopt.c:640 -#, c-format -msgid "%s: option `%c%s' doesn't allow an argument\n" -msgstr "%s: a opção `%c%s' não admite nenhum argumento\n" - -#: lib/getopt.c:686 lib/getopt.c:708 lib/getopt.c:1039 lib/getopt.c:1061 -#, c-format -msgid "%s: option `%s' requires an argument\n" -msgstr "%s: a opção `%s' exige um argumento\n" - -#: lib/getopt.c:746 lib/getopt.c:749 -#, c-format -msgid "%s: unrecognized option `--%s'\n" -msgstr "%s: opção `--%s' não reconhecida\n" - -#: lib/getopt.c:757 lib/getopt.c:760 -#, c-format -msgid "%s: unrecognized option `%c%s'\n" -msgstr "%s: opção `%c%s' não reconhecida\n" - -#: lib/getopt.c:815 lib/getopt.c:818 -#, c-format -msgid "%s: illegal option -- %c\n" -msgstr "%s: opção -- %c ilegal\n" - -#: lib/getopt.c:824 lib/getopt.c:827 -#, c-format -msgid "%s: invalid option -- %c\n" -msgstr "%s: opção -- %c inválida\n" - -#: lib/getopt.c:882 lib/getopt.c:901 lib/getopt.c:1114 lib/getopt.c:1135 -#, c-format -msgid "%s: option requires an argument -- %c\n" -msgstr "%s: a opção -- %c exige um argumento\n" - -#: lib/getopt.c:954 lib/getopt.c:973 -#, c-format -msgid "%s: option `-W %s' is ambiguous\n" -msgstr "%s: a opção `-W %s' é ambígua\n" - -#: lib/getopt.c:997 lib/getopt.c:1018 -#, c-format -msgid "%s: option `-W %s' doesn't allow an argument\n" -msgstr "%s: a opção `-W %s' não admite nenhum argumento\n" - -#: lib/obstack.c:417 lib/obstack.c:420 lib/xmalloc.c:53 -msgid "memory exhausted" -msgstr "memória esgotada" - -#: lib/quotearg.c:238 -msgid "`" -msgstr "`" - -#: lib/quotearg.c:239 -msgid "'" -msgstr "'" - -#: lib/subpipe.c:171 -#, c-format -msgid "subsidiary program `%s' could not be invoked" -msgstr "programa subsidiário `%s' não pôde ser invocado" - -#: lib/subpipe.c:173 -#, c-format -msgid "subsidiary program `%s' not found" -msgstr "programa subsidiário `%s' não foi encontrado" - -#: lib/subpipe.c:175 -#, c-format -msgid "subsidiary program `%s' failed" -msgstr "programa subsidiário `%s' falhou" - -#: lib/subpipe.c:176 -#, c-format -msgid "subsidiary program `%s' failed (exit status %d)" -msgstr "programa subsidiário `%s' falhou (estado de saída %d)" - -#: lib/timevar.c:475 -msgid "" -"\n" -"Execution times (seconds)\n" -msgstr "" -"\n" -"Tempos de execução (segundos)\n" - -#: lib/timevar.c:525 -msgid " TOTAL :" -msgstr " TOTAL :" - -#: lib/timevar.c:561 -#, c-format -msgid "time in %s: %ld.%06ld (%ld%%)\n" -msgstr "tempo em %s: %ld.%06ld (%ld%%)\n" diff --git a/src/bin/bison/po/quot.sed b/src/bin/bison/po/quot.sed deleted file mode 100644 index 0122c46318..0000000000 --- a/src/bin/bison/po/quot.sed +++ /dev/null @@ -1,6 +0,0 @@ -s/"\([^"]*\)"/“\1â€/g -s/`\([^`']*\)'/‘\1’/g -s/ '\([^`']*\)' / ‘\1’ /g -s/ '\([^`']*\)'$/ ‘\1’/g -s/^'\([^`']*\)' /‘\1’ /g -s/“â€/""/g diff --git a/src/bin/bison/po/remove-potcdate.sin b/src/bin/bison/po/remove-potcdate.sin deleted file mode 100644 index 2436c49e78..0000000000 --- a/src/bin/bison/po/remove-potcdate.sin +++ /dev/null @@ -1,19 +0,0 @@ -# Sed script that remove the POT-Creation-Date line in the header entry -# from a POT file. -# -# The distinction between the first and the following occurrences of the -# pattern is achieved by looking at the hold space. -/^"POT-Creation-Date: .*"$/{ -x -# Test if the hold space is empty. -s/P/P/ -ta -# Yes it was empty. First occurrence. Remove the line. -g -d -bb -:a -# The hold space was nonempty. Following occurrences. Do nothing. -x -:b -} diff --git a/src/bin/bison/po/ro.gmo b/src/bin/bison/po/ro.gmo deleted file mode 100644 index cd0e00b55a..0000000000 Binary files a/src/bin/bison/po/ro.gmo and /dev/null differ diff --git a/src/bin/bison/po/ro.po b/src/bin/bison/po/ro.po deleted file mode 100644 index 440322aa26..0000000000 --- a/src/bin/bison/po/ro.po +++ /dev/null @@ -1,743 +0,0 @@ -# Mesajele în limba românã pentru GNU Bison. -# Copyright (C) 2003 Free Software Foundation, Inc. -# Acest fiºier este distribuit sub aceeaºi licenþã ca ºi pachetul bison. -# Laurentiu Buzdugan , 2003. -# -# -# -msgid "" -msgstr "" -"Project-Id-Version: bison 1.875a\n" -"Report-Msgid-Bugs-To: bug-bison@gnu.org\n" -"POT-Creation-Date: 2004-05-21 10:26-0700\n" -"PO-Revision-Date: 2003-03-01 21:43-0500\n" -"Last-Translator: Laurentiu Buzdugan \n" -"Language-Team: Romanian \n" -"MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=ISO-8859-2\n" -"Content-Transfer-Encoding: 8bit\n" -"Plural-Forms: nplurals=2; plural=(n != 1);\n" - -#: src/complain.c:51 src/complain.c:66 -msgid "warning: " -msgstr "avertisment:" - -#: src/complain.c:122 src/complain.c:138 -msgid "fatal error: " -msgstr "eroare fatalã:" - -#: src/conflicts.c:76 -#, c-format -msgid " Conflict between rule %d and token %s resolved as shift" -msgstr " Conflict între regula %d ºi elementul (token) %s rezolvat ca shift" - -#: src/conflicts.c:84 -#, c-format -msgid " Conflict between rule %d and token %s resolved as reduce" -msgstr "" -" Conflict între regula %d ºi elementul (token) %s rezolvat ca reduce" - -#: src/conflicts.c:91 -#, c-format -msgid " Conflict between rule %d and token %s resolved as an error" -msgstr "" -" Conflict între regula %d ºi elementul (token) %s rezolvat ca eroare" - -#: src/conflicts.c:399 -#, c-format -msgid "conflicts: %d shift/reduce, %d reduce/reduce\n" -msgstr "conflicte: %d shift/reduce, %d reduce/reduce\n" - -#: src/conflicts.c:402 -#, c-format -msgid "conflicts: %d shift/reduce\n" -msgstr "conflicte: %d shift/reduce\n" - -#: src/conflicts.c:404 -#, c-format -msgid "conflicts: %d reduce/reduce\n" -msgstr "conflicte: %d reduce/reduce\n" - -#: src/conflicts.c:422 -#, c-format -msgid "State %d " -msgstr "Stare %d" - -#: src/conflicts.c:487 -#, fuzzy, c-format -msgid "%%expect-rr applies only to GLR parsers" -msgstr "%s afecteazã numai parsere GLR" - -#: src/conflicts.c:511 -#, c-format -msgid "expected %d shift/reduce conflict" -msgid_plural "expected %d shift/reduce conflicts" -msgstr[0] "am aºteptat %d conflict shift/reduce" -msgstr[1] "am aºteptat %d conflicte shift/reduce" - -#: src/conflicts.c:515 -#, fuzzy, c-format -msgid "expected %d reduce/reduce conflict" -msgid_plural "expected %d reduce/reduce conflicts" -msgstr[0] "am aºteptat 0 conflicte reduce/reduce" -msgstr[1] "am aºteptat 0 conflicte reduce/reduce" - -#: src/files.c:100 -#, c-format -msgid "cannot open file `%s'" -msgstr "nu am putut deschide fiºierul `%s'" - -#: src/files.c:116 -msgid "I/O error" -msgstr "Eroare I/O" - -#: src/files.c:119 -msgid "cannot close file" -msgstr "nu pot închide fiºierul" - -#: src/files.c:337 -#, c-format -msgid "conflicting outputs to file %s" -msgstr "ieºiri în conflict în fiºierul %s" - -#: src/getargs.c:186 -#, c-format -msgid "Try `%s --help' for more information.\n" -msgstr "Încercaþi `%s --help' pentru informaþii suplimentare.\n" - -#: src/getargs.c:192 -msgid "GNU bison generates parsers for LALR(1) grammars.\n" -msgstr "GNU bison genereazã parsere pentru gramatici LALR(1).\n" - -#: src/getargs.c:196 -#, c-format -msgid "Usage: %s [OPTION]... FILE\n" -msgstr "Folosire: %s [OPÞIUNE]... FIªIER\n" - -#: src/getargs.c:200 -msgid "" -"If a long option shows an argument as mandatory, then it is mandatory\n" -"for the equivalent short option also. Similarly for optional arguments.\n" -msgstr "" -"Dacã o opþiune lungã aratã un argument ca necesar, atunci el este necesar\n" -"ºi pentru opþiunea scurtã echivalentã. Similar pentru argumentele " -"opþionale.\n" - -#: src/getargs.c:206 -msgid "" -"Operation modes:\n" -" -h, --help display this help and exit\n" -" -V, --version output version information and exit\n" -" -y, --yacc emulate POSIX yacc\n" -msgstr "" -"Moduri de operare:\n" -" -h, --help afiºeazã acest mesaj ºi terminã\n" -" -V, --version afiºeazã informaþii despre versiune ºi terminã\n" -" -y, --yacc emuleazã POSIX yacc\n" - -#: src/getargs.c:213 -msgid "" -"Parser:\n" -" -S, --skeleton=FILE specify the skeleton to use\n" -" -t, --debug instrument the parser for debugging\n" -" --locations enable locations computation\n" -" -p, --name-prefix=PREFIX prepend PREFIX to the external symbols\n" -" -l, --no-lines don't generate `#line' directives\n" -" -n, --no-parser generate the tables only\n" -" -k, --token-table include a table of token names\n" -msgstr "" -"Parser:\n" -" -S, --skeleton=FIªIER specificã scheletul de folosit\n" -" -t, --debug instrumenteazã parserul pentru depanare\n" -" --locations activeazã calculul locaþiilor\n" -" -p, --name-prefix=PREFIX pune prefix PREFIX la simbolurile externe\n" -" -l, --no-lines nu genera directive `#line'\n" -" -n, --no-parser genereazã numai tabelele\n" -" -k, --token-table include un tabel cu nume de elemente\n" - -#: src/getargs.c:225 -msgid "" -"Output:\n" -" -d, --defines also produce a header file\n" -" -r, --report=THINGS also produce details on the automaton\n" -" -v, --verbose same as `--report=state'\n" -" -b, --file-prefix=PREFIX specify a PREFIX for output files\n" -" -o, --output=FILE leave output to FILE\n" -" -g, --graph also produce a VCG description of the " -"automaton\n" -msgstr "" -"Ieºire:\n" -" -d, --defines creazã ºi un fiºier header\n" -" -r, --report=LUCRURI creazã ºi detalii despre automaton\n" -" -v, --verbose la fel ca `--report=state'\n" -" -b, --file-prefix=PREFIX specificã un PREFIX pentru fiºierele ieºire\n" -" -o, --output=FIªIER creazã ieºire în FIªIER\n" -" -g, --graph creazã ºi o descriere VCG a automaton-ului\n" - -#: src/getargs.c:236 -msgid "" -"THINGS is a list of comma separated words that can include:\n" -" `state' describe the states\n" -" `itemset' complete the core item sets with their closure\n" -" `lookahead' explicitly associate lookaheads to items\n" -" `solved' describe shift/reduce conflicts solving\n" -" `all' include all the above information\n" -" `none' disable the report\n" -msgstr "" -"LUCRURI este o listã de cuvinte separate de virgulã ce pot fi:\n" -" `state' descrie stãrile\n" -" `itemset' completeazã seturile de elemente nucleu cu închiderea lor\n" -" `lookahead' asociazã explicit lookaheads la elemente\n" -" `solved' descrie rezolvarea conflictelor shift/reduce\n" -" `all' include toatã informaþia de deasupra\n" -" `none' deactiveazã raportarea\n" - -#: src/getargs.c:247 -msgid "Report bugs to .\n" -msgstr "Raportaþi bug-uri la .\n" - -#: src/getargs.c:264 -#, c-format -msgid "bison (GNU Bison) %s" -msgstr "bison (GNU Bison) %s" - -#: src/getargs.c:266 -msgid "Written by Robert Corbett and Richard Stallman.\n" -msgstr "Scris de Robert Corbett ºi Richard Stallman.\n" - -#: src/getargs.c:270 -#, c-format -msgid "Copyright (C) %d Free Software Foundation, Inc.\n" -msgstr "Copyright (C) %d Free Software Foundation, Inc.\n" - -#: src/getargs.c:272 -msgid "" -"This is free software; see the source for copying conditions. There is NO\n" -"warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n" -msgstr "" -"Acesta este software liber; vedeþi codul sursã pentru condiþii despre " -"copiere.\n" -"Nu existã nici o garanþie; nici chiar pentru COMERCIALIZARE sau de " -"POTRIVIRE\n" -"PENTRU UN SCOP ANUME.\n" - -#: src/getargs.c:438 -#, c-format -msgid "missing operand after `%s'" -msgstr "operator lipsã dupã `%s'" - -#: src/getargs.c:440 -#, c-format -msgid "extra operand `%s'" -msgstr "extra operator `%s'" - -#: src/gram.c:139 -msgid "empty" -msgstr "goleºte" - -#: src/gram.c:233 -msgid "Grammar" -msgstr "Gramaticã" - -#: src/gram.c:321 src/reduce.c:394 -msgid "warning" -msgstr "avertisment" - -#: src/main.c:124 -msgid "rule never reduced because of conflicts" -msgstr "regula nu este redusã niciodatã din cauza conflictelor" - -#: src/parse-gram.y:363 -msgid "POSIX forbids declarations in the grammar" -msgstr "POSIX interzice declaraþii în gramaticã" - -#: src/parse-gram.y:486 -msgid "missing identifier in parameter declaration" -msgstr "identificator lipsã în declaraþia parametrului" - -#: src/print.c:49 -#, c-format -msgid " type %d is %s\n" -msgstr " tipul %d este %s\n" - -#: src/print.c:165 -#, c-format -msgid "shift, and go to state %d\n" -msgstr "shift, ºi mergi în starea %d\n" - -#: src/print.c:167 -#, c-format -msgid "go to state %d\n" -msgstr "mergi în starea %d\n" - -#: src/print.c:204 -msgid "error (nonassociative)\n" -msgstr "eroare (ne-asociativitate)\n" - -#: src/print.c:292 -#, c-format -msgid "reduce using rule %d (%s)" -msgstr "reduce folosind regula %d (%s)" - -#: src/print.c:294 -#, c-format -msgid "accept" -msgstr "accept" - -#: src/print.c:325 src/print.c:391 -msgid "$default" -msgstr "$implicit" - -#: src/print.c:420 -#, c-format -msgid "state %d" -msgstr "stare %d" - -#: src/print.c:456 -msgid "Terminals, with rules where they appear" -msgstr "Terminale, cu reguli acolo unde acestea apar" - -#: src/print.c:483 -msgid "Nonterminals, with rules where they appear" -msgstr "Non-terminale, cu reguli acolo unde acestea apar" - -#: src/print.c:512 -#, c-format -msgid " on left:" -msgstr " pe stânga:" - -#: src/print.c:527 -#, c-format -msgid " on right:" -msgstr " pe dreapta:" - -#: src/print.c:555 -msgid "Rules never reduced" -msgstr "Regulile nu au fost reduse" - -#: src/reader.c:56 -#, c-format -msgid "multiple %s declarations" -msgstr "declaraþii %s multiple" - -#: src/reader.c:118 -#, c-format -msgid "result type clash on merge function %s: <%s> != <%s>" -msgstr "" -"tipul rezultatului în conflict cu funcþia de combinare %s: <%s> != <%s>" - -#: src/reader.c:216 -#, c-format -msgid "rule given for %s, which is a token" -msgstr "regula datã pentru %s, care este un element (token)" - -#: src/reader.c:245 -#, c-format -msgid "type clash on default action: <%s> != <%s>" -msgstr "conflict de tip pentru acþiunea implicitã: <%s> != <%s>" - -#: src/reader.c:251 -msgid "empty rule for typed nonterminal, and no action" -msgstr "regulã vidã pentru nonterminal cu tip, ºi nici o acþiune" - -#: src/reader.c:321 src/reader.c:335 src/reader.c:348 -#, c-format -msgid "only one %s allowed per rule" -msgstr "un singur %s permis pe fiecare regulã" - -#: src/reader.c:331 src/reader.c:346 -#, c-format -msgid "%s affects only GLR parsers" -msgstr "%s afecteazã numai parsere GLR" - -#: src/reader.c:333 -#, c-format -msgid "%s must be followed by positive number" -msgstr "%s trebuie sã fie urmat de numere pozitive" - -#: src/reader.c:490 -msgid "no rules in the input grammar" -msgstr "nici o regulã în gramatica furnizatã" - -#: src/reduce.c:242 -msgid "useless rule" -msgstr "regulã fãrã rost" - -#: src/reduce.c:303 -#, c-format -msgid "useless nonterminal: %s" -msgstr "nonterminal fãrã rost: %s" - -#: src/reduce.c:351 -msgid "Useless nonterminals" -msgstr "Nonterminale fãrã rost" - -#: src/reduce.c:364 -msgid "Terminals which are not used" -msgstr "Terminale care nu sunt folosite" - -#: src/reduce.c:373 -msgid "Useless rules" -msgstr "Reguli fãrã rost" - -#: src/reduce.c:389 -#, c-format -msgid "%d rule never reduced\n" -msgid_plural "%d rules never reduced\n" -msgstr[0] "%d regulã niciodatã redusã\n" -msgstr[1] "%d reguli niciodatã reduse\n" - -#: src/reduce.c:397 -#, c-format -msgid "%d useless nonterminal" -msgid_plural "%d useless nonterminals" -msgstr[0] "%d nonterminal fãrã rost" -msgstr[1] "%d nonterminale fãrã rost" - -#: src/reduce.c:403 -#, c-format -msgid " and " -msgstr " ºi " - -#: src/reduce.c:406 -#, c-format -msgid "%d useless rule" -msgid_plural "%d useless rules" -msgstr[0] "%d regulã fãrã rost" -msgstr[1] "%d reguli fãrã rost" - -#: src/reduce.c:436 -#, c-format -msgid "start symbol %s does not derive any sentence" -msgstr "simbol de start %s nu deriveazã nici o propoziþie" - -#: src/scan-gram.l:162 -msgid "stray `,' treated as white space" -msgstr "Virgulã `,' rãtãcitã tratatã ca spaþiu gol" - -#: src/scan-gram.l:225 -#, c-format -msgid "invalid directive: %s" -msgstr "directivã invalidã: %s" - -#: src/scan-gram.l:283 -#, c-format -msgid "invalid character: %s" -msgstr "caracter invalid: %s" - -#: src/scan-gram.l:402 -#, fuzzy -msgid "invalid null character" -msgstr "caracter invalid: %s" - -#: src/scan-gram.l:415 src/scan-gram.l:427 src/scan-gram.l:448 -#, c-format -msgid "invalid escape sequence: %s" -msgstr "secvenþã escape invalidã: %s" - -#: src/scan-gram.l:417 src/scan-gram.l:429 src/scan-gram.l:450 -#, fuzzy, c-format -msgid "invalid null character: %s" -msgstr "caracter invalid: %s" - -#: src/scan-gram.l:455 -#, c-format -msgid "unrecognized escape sequence: %s" -msgstr "secvenþã escape nerecunoscutã: %s" - -#: src/scan-gram.l:537 -#, c-format -msgid "missing `{' in `%s'" -msgstr "`{' lipsã în `%s'" - -#: src/scan-gram.l:782 -#, c-format -msgid "$$ of `%s' has no declared type" -msgstr "$$ a lui `%s' nu are nici un tip declarat" - -#: src/scan-gram.l:803 -#, c-format -msgid "$%d of `%s' has no declared type" -msgstr "$%d a lui `%s' nu are nici un tip declarat" - -#: src/scan-gram.l:812 src/scan-gram.l:881 src/scan-gram.l:932 -#, c-format -msgid "integer out of range: %s" -msgstr "întreg în afara domeniului: %s" - -#: src/scan-gram.l:848 src/scan-gram.l:916 -#, c-format -msgid "invalid value: %s" -msgstr "valoare invalidã: %s" - -#: src/scan-gram.l:1036 -#, c-format -msgid "missing `%s' at end of file" -msgstr "`%s' lipsã la sfârºitul fiºierului" - -#: src/scan-gram.l:1047 -#, fuzzy, c-format -msgid "missing `%s' at end of line" -msgstr "`%s' lipsã la sfârºitul fiºierului" - -#: src/symlist.c:97 src/symlist.c:108 -msgid "invalid $ value" -msgstr "valoare $ invalidã" - -#: src/symtab.c:85 -#, c-format -msgid "type redeclaration for %s" -msgstr "redeclarare de tip pentru %s" - -#: src/symtab.c:102 src/symtab.c:120 -#, c-format -msgid "%s redeclaration for %s" -msgstr "redeclarare %s pentru %s" - -#: src/symtab.c:139 -#, c-format -msgid "redefining precedence of %s" -msgstr "precedenþã redefinitã pentru %s" - -#: src/symtab.c:157 -#, c-format -msgid "symbol %s redefined" -msgstr "simbol %s redefinit" - -#: src/symtab.c:180 -#, c-format -msgid "redefining user token number of %s" -msgstr "numãrul elementului (token) definit de utilizator redefinit pentru %s" - -#: src/symtab.c:207 -#, c-format -msgid "symbol %s is used, but is not defined as a token and has no rules" -msgstr "" -"simbolul %s e folosit, dar nu este definit ca element (token) ºi nu are nici " -"o regulã" - -#: src/symtab.c:232 -#, c-format -msgid "symbol `%s' used more than once as a literal string" -msgstr "simbolul `%s' este folosit de mai multe ori ca ºir literar" - -#: src/symtab.c:235 -#, c-format -msgid "symbol `%s' given more than one literal string" -msgstr "simbolului `%s' îi este dat mai mult de un singur ºir literar" - -#: src/symtab.c:271 -#, c-format -msgid "conflicting precedences for %s and %s" -msgstr "precedenþe în conflict pentru %s ºi %s" - -#: src/symtab.c:283 -#, c-format -msgid "conflicting associativities for %s (%s) and %s (%s)" -msgstr "asoaciativitãþi în conflict pentru %s (%s) ºi %s (%s)" - -#: src/symtab.c:368 -#, c-format -msgid "tokens %s and %s both assigned number %d" -msgstr "ambelor elementele (tokens) %s ºi %s le sunt alocate acelaºi numãr %d" - -#: src/symtab.c:591 -#, c-format -msgid "the start symbol %s is undefined" -msgstr "simbolul de start %s nu este definit" - -#: src/symtab.c:595 -#, c-format -msgid "the start symbol %s is a token" -msgstr "simbolul de start %s este un element (token)" - -#: lib/argmatch.c:133 -#, c-format -msgid "invalid argument %s for %s" -msgstr "argument invalid %s pentru %s" - -#: lib/argmatch.c:134 -#, c-format -msgid "ambiguous argument %s for %s" -msgstr "argument ambiguu %s pentru %s" - -#: lib/argmatch.c:153 -#, c-format -msgid "Valid arguments are:" -msgstr "Argumente valide sunt:" - -#: lib/bitset_stats.c:179 -#, c-format -msgid "%u bitset_allocs, %u freed (%.2f%%).\n" -msgstr "%u bitset_allocs, %u eliberate (%.2f%%).\n" - -#: lib/bitset_stats.c:182 -#, c-format -msgid "%u bitset_sets, %u cached (%.2f%%)\n" -msgstr "%u bitset_sets, %u stocate (cached) (%.2f%%)\n" - -#: lib/bitset_stats.c:185 -#, c-format -msgid "%u bitset_resets, %u cached (%.2f%%)\n" -msgstr "%u bitset_resets, %u stocate (cached) (%.2f%%)\n" - -#: lib/bitset_stats.c:188 -#, c-format -msgid "%u bitset_tests, %u cached (%.2f%%)\n" -msgstr "%u bitset_tests, %u stocate (cached) (%.2f%%)\n" - -#: lib/bitset_stats.c:192 -#, c-format -msgid "%u bitset_lists\n" -msgstr "%u bitset_lists\n" - -#: lib/bitset_stats.c:194 -msgid "count log histogram\n" -msgstr "numãrã histograma jurnal\n" - -#: lib/bitset_stats.c:197 -msgid "size log histogram\n" -msgstr "dimensiune histogramã jurnal\n" - -#: lib/bitset_stats.c:200 -msgid "density histogram\n" -msgstr "densitate histogramã\n" - -#: lib/bitset_stats.c:214 -#, c-format -msgid "" -"Bitset statistics:\n" -"\n" -msgstr "" -"Statistici bitset:\n" -"\n" - -#: lib/bitset_stats.c:217 -#, c-format -msgid "Accumulated runs = %u\n" -msgstr "Rulãri acumulate = %u\n" - -#: lib/bitset_stats.c:261 lib/bitset_stats.c:266 -msgid "Could not read stats file." -msgstr "Nu am putut citi fiºierul de statistici." - -#: lib/bitset_stats.c:263 -#, c-format -msgid "Bad stats file size.\n" -msgstr "Dimensiune fiºier cu statistici incorectã.\n" - -#: lib/bitset_stats.c:289 lib/bitset_stats.c:291 -msgid "Could not write stats file." -msgstr "Nu am putut scrie fiºier statistici." - -#: lib/bitset_stats.c:294 -msgid "Could not open stats file for writing." -msgstr "Nu am putut deschide fiºierul de statistici pentru scriere." - -#: lib/error.c:127 -msgid "Unknown system error" -msgstr "Eroare de sistem necunoscutã" - -#: lib/getopt.c:570 lib/getopt.c:589 -#, c-format -msgid "%s: option `%s' is ambiguous\n" -msgstr "%s: opþiunea `%s' este ambiguã\n" - -#: lib/getopt.c:622 lib/getopt.c:626 -#, c-format -msgid "%s: option `--%s' doesn't allow an argument\n" -msgstr "%s: opþiunea `--%s' nu permite un argument\n" - -#: lib/getopt.c:635 lib/getopt.c:640 -#, c-format -msgid "%s: option `%c%s' doesn't allow an argument\n" -msgstr "%s: opþiunea `%c%s' nu permite un argument\n" - -#: lib/getopt.c:686 lib/getopt.c:708 lib/getopt.c:1039 lib/getopt.c:1061 -#, c-format -msgid "%s: option `%s' requires an argument\n" -msgstr "%s: opþiunea `%s' necesitã un argument\n" - -#: lib/getopt.c:746 lib/getopt.c:749 -#, c-format -msgid "%s: unrecognized option `--%s'\n" -msgstr "%s: opþiune nerecunoscutã `--%s'\n" - -#: lib/getopt.c:757 lib/getopt.c:760 -#, c-format -msgid "%s: unrecognized option `%c%s'\n" -msgstr "%s: opþiune nerecunoscutã `%c%s'\n" - -#: lib/getopt.c:815 lib/getopt.c:818 -#, c-format -msgid "%s: illegal option -- %c\n" -msgstr "%s: opþiune ilegalã -- %c\n" - -#: lib/getopt.c:824 lib/getopt.c:827 -#, c-format -msgid "%s: invalid option -- %c\n" -msgstr "%s: opþiune ilegalã -- %c\n" - -#: lib/getopt.c:882 lib/getopt.c:901 lib/getopt.c:1114 lib/getopt.c:1135 -#, c-format -msgid "%s: option requires an argument -- %c\n" -msgstr "%s: opþiunea necesitã un argument -- %c\n" - -#: lib/getopt.c:954 lib/getopt.c:973 -#, c-format -msgid "%s: option `-W %s' is ambiguous\n" -msgstr "%s: opþiunea `-W %s' este ambiguã\n" - -#: lib/getopt.c:997 lib/getopt.c:1018 -#, c-format -msgid "%s: option `-W %s' doesn't allow an argument\n" -msgstr "%s: opþiunea `-W %s' nu permite un argument\n" - -#: lib/obstack.c:417 lib/obstack.c:420 lib/xmalloc.c:53 -msgid "memory exhausted" -msgstr "memorie epuizatã" - -#: lib/quotearg.c:238 -msgid "`" -msgstr "`" - -#: lib/quotearg.c:239 -msgid "'" -msgstr "'" - -#: lib/subpipe.c:171 -#, c-format -msgid "subsidiary program `%s' could not be invoked" -msgstr "programul auxiliar `%s' nu poate fi invocat" - -#: lib/subpipe.c:173 -#, c-format -msgid "subsidiary program `%s' not found" -msgstr "programul auxiliar `%s' nu a fost gãsit" - -#: lib/subpipe.c:175 -#, c-format -msgid "subsidiary program `%s' failed" -msgstr "programul auxiliar `%s' a eºuat" - -#: lib/subpipe.c:176 -#, c-format -msgid "subsidiary program `%s' failed (exit status %d)" -msgstr "programul auxiliar `%s' a eºuat (stare de terminare %d)" - -#: lib/timevar.c:475 -msgid "" -"\n" -"Execution times (seconds)\n" -msgstr "" -"\n" -"Timp de execuþie (secunde)\n" - -#: lib/timevar.c:525 -msgid " TOTAL :" -msgstr " TOTAL :" - -#: lib/timevar.c:561 -#, c-format -msgid "time in %s: %ld.%06ld (%ld%%)\n" -msgstr "timp în %s: %ld.%06ld (%ld%%)\n" diff --git a/src/bin/bison/po/ru.gmo b/src/bin/bison/po/ru.gmo deleted file mode 100644 index 9ddea8c112..0000000000 Binary files a/src/bin/bison/po/ru.gmo and /dev/null differ diff --git a/src/bin/bison/po/ru.po b/src/bin/bison/po/ru.po deleted file mode 100644 index ae57307bc6..0000000000 --- a/src/bin/bison/po/ru.po +++ /dev/null @@ -1,989 +0,0 @@ -# ðÅÒÅ×ÏÄ ÓÏÏÂÝÅÎÉÊ bison. -# Copyright (C) 1999 Free Software Foundation, Inc. -# Dmitry S. Sivachenko , 1999,2000,2001,2002. -# -msgid "" -msgstr "" -"Project-Id-Version: bison 1.875\n" -"Report-Msgid-Bugs-To: bug-bison@gnu.org\n" -"POT-Creation-Date: 2004-05-21 10:26-0700\n" -"PO-Revision-Date: 2003-01-01 20:35+0300\n" -"Last-Translator: Dmitry S. Sivachenko \n" -"Language-Team: Russian \n" -"MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=koi8-r\n" -"Content-Transfer-Encoding: 8-bit\n" -"Plural-Forms: nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%" -"10<=4 && (n%100<10 || n%100>=20) ? 1 : 2);\n" - -#: src/complain.c:51 src/complain.c:66 -msgid "warning: " -msgstr "ÐÒÅÄÕÐÒÅÖÄÅÎÉÅ: " - -#: src/complain.c:122 src/complain.c:138 -msgid "fatal error: " -msgstr "ÆÁÔÁÌØÎÁÑ ÏÛÉÂËÁ: " - -#: src/conflicts.c:76 -#, c-format -msgid " Conflict between rule %d and token %s resolved as shift" -msgstr " ëÏÎÆÌÉËÔ ÍÅÖÄÕ ÐÒÁ×ÉÌÏÍ %d É ÌÅËÓÅÍÏÊ %s ÒÁÚÒÅÛÅÎ ÓÄ×ÉÇÏÍ" - -#: src/conflicts.c:84 -#, c-format -msgid " Conflict between rule %d and token %s resolved as reduce" -msgstr " ëÏÎÆÌÉËÔ ÍÅÖÄÕ ÐÒÁ×ÉÌÏÍ %d É ÌÅËÓÅÍÏÊ %s ÒÁÚÒÅÛÅÎ ×Ù×ÏÄÏÍ" - -#: src/conflicts.c:91 -#, c-format -msgid " Conflict between rule %d and token %s resolved as an error" -msgstr " ëÏÎÆÌÉËÔ ÍÅÖÄÕ ÐÒÁ×ÉÌÏÍ %d É ÌÅËÓÅÍÏÊ %s ÒÁÚÒÅÛÅÎ ËÁË ÏÛÉÂËÁ" - -#: src/conflicts.c:399 -#, c-format -msgid "conflicts: %d shift/reduce, %d reduce/reduce\n" -msgstr "ËÏÎÆÌÉËÔÙ: %d ÓÄ×ÉÇÁ/×Ù×ÏÄÁ, %d ×Ù×ÏÄÁ/×Ù×ÏÄÁ\n" - -#: src/conflicts.c:402 -#, c-format -msgid "conflicts: %d shift/reduce\n" -msgstr "ËÏÎÆÌÉËÔÙ: %d ÓÄ×ÉÇÁ/×Ù×ÏÄÁ\n" - -#: src/conflicts.c:404 -#, c-format -msgid "conflicts: %d reduce/reduce\n" -msgstr "ËÏÎÆÌÉËÔÙ: %d ×Ù×ÏÄÁ/×Ù×ÏÄÁ\n" - -#: src/conflicts.c:422 -#, c-format -msgid "State %d " -msgstr "óÏÓÔÏÑÎÉÅ %d " - -#: src/conflicts.c:487 -#, c-format -msgid "%%expect-rr applies only to GLR parsers" -msgstr "" - -#: src/conflicts.c:511 -#, c-format -msgid "expected %d shift/reduce conflict" -msgid_plural "expected %d shift/reduce conflicts" -msgstr[0] "ÏÖÉÄÁÌÓÑ %d ËÏÎÆÌÉËÔ ÓÄ×ÉÇÁ/×Ù×ÏÄÁ" -msgstr[1] "ÏÖÉÄÁÌÏÓØ %d ËÏÎÆÌÉËÔÁ ÓÄ×ÉÇÁ/×Ù×ÏÄÁ" -msgstr[2] "ÏÖÉÄÁÌÏÓØ %d ËÏÎÆÌÉËÔÏ× ÓÄ×ÉÇÁ/×Ù×ÏÄÁ" - -#: src/conflicts.c:515 -#, fuzzy, c-format -msgid "expected %d reduce/reduce conflict" -msgid_plural "expected %d reduce/reduce conflicts" -msgstr[0] "ÏÖÉÄÁÌÏÓØ 0 ËÏÎÆÌÉËÔÏ× ×Ù×ÏÄÁ/×Ù×ÏÄÁ" -msgstr[1] "ÏÖÉÄÁÌÏÓØ 0 ËÏÎÆÌÉËÔÏ× ×Ù×ÏÄÁ/×Ù×ÏÄÁ" -msgstr[2] "ÏÖÉÄÁÌÏÓØ 0 ËÏÎÆÌÉËÔÏ× ×Ù×ÏÄÁ/×Ù×ÏÄÁ" - -#: src/files.c:100 -#, c-format -msgid "cannot open file `%s'" -msgstr "ÎÅ ÕÄÁÅÔÓÑ ÏÔËÒÙÔØ ÆÁÊÌ `%s'" - -#: src/files.c:116 -msgid "I/O error" -msgstr "ÏÛÉÂËÁ ××ÏÄÁ-×Ù×ÏÄÁ" - -#: src/files.c:119 -msgid "cannot close file" -msgstr "ÎÅ ÕÄÁÅÔÓÑ ÚÁËÒÙÔØ ÆÁÊÌ" - -#: src/files.c:337 -#, fuzzy, c-format -msgid "conflicting outputs to file %s" -msgstr "ÐÒÏÔÉ×ÏÒÅÞÉ×ÙÅ ÚÎÁÞÅÎÉÑ ÁÓÓÏÃÉÁÔÉ×ÎÏÓÔÉ ÄÌÑ %s É %s" - -#: src/getargs.c:186 -#, c-format -msgid "Try `%s --help' for more information.\n" -msgstr "éÓÐÏÌØÚÕÊÔÅ `%s --help' ÄÌÑ ÄÏÐÏÌÎÉÔÅÌØÎÏÊ ÉÎÆÏÒÍÁÃÉÉ.\n" - -#: src/getargs.c:192 -msgid "GNU bison generates parsers for LALR(1) grammars.\n" -msgstr "GNU bison ÇÅÎÅÒÉÒÕÅÔ ÁÎÁÌÉÚÁÔÏÒÙ ÄÌÑ ÇÒÁÍÍÁÔÉË LALR(1).\n" - -#: src/getargs.c:196 -#, c-format -msgid "Usage: %s [OPTION]... FILE\n" -msgstr "éÓÐÏÌØÚÏ×ÁÎÉÅ: %s [ëìàþé]... æáêì\n" - -#: src/getargs.c:200 -msgid "" -"If a long option shows an argument as mandatory, then it is mandatory\n" -"for the equivalent short option also. Similarly for optional arguments.\n" -msgstr "" -"åÓÌÉ ÄÌÉÎÎÁÑ ÆÏÒÍÁ ËÌÀÞÁ ÏÐÒÅÄÅÌÑÅÔ ÁÒÇÕÍÅÎÔ ËÁË ÏÂÑÚÁÔÅÌØÎÙÊ, ÔÏ ÏÎ ÔÁËÖÅ\n" -"Ñ×ÌÑÅÔÓÑ ÏÂÑÚÁÔÅÌØÎÙÍ ÄÌÑ ËÏÒÏÔËÏÊ ÆÏÒÍÙ. ôÏ ÖÅ ËÁÓÁÅÔÓÑ ÎÅÏÂÑÚÁÔÅÌØÎÙÈ\n" -"ÁÒÇÕÍÅÎÔÏ×.\n" - -#: src/getargs.c:206 -msgid "" -"Operation modes:\n" -" -h, --help display this help and exit\n" -" -V, --version output version information and exit\n" -" -y, --yacc emulate POSIX yacc\n" -msgstr "" -"òÅÖÉÍÙ ÆÕÎËÃÉÏÎÉÒÏ×ÁÎÉÑ:\n" -" -h, --help ×Ù×ÅÓÔÉ ÜÔÕ ÓÐÒÁ×ËÕ É ×ÙÊÔÉ\n" -" -V, --version ×Ù×ÅÓÔÉ ÉÎÆÏÒÍÁÃÉÀ Ï ×ÅÒÓÉÉ É ×ÙÊÔÉ\n" -" -y, --yacc ÜÍÕÌÉÒÏ×ÁÔØ POSIX yacc\n" - -#: src/getargs.c:213 -msgid "" -"Parser:\n" -" -S, --skeleton=FILE specify the skeleton to use\n" -" -t, --debug instrument the parser for debugging\n" -" --locations enable locations computation\n" -" -p, --name-prefix=PREFIX prepend PREFIX to the external symbols\n" -" -l, --no-lines don't generate `#line' directives\n" -" -n, --no-parser generate the tables only\n" -" -k, --token-table include a table of token names\n" -msgstr "" -"áÎÁÌÉÚÁÔÏÒ:\n" -" -S, --skeleton=æáêì ÕËÁÚÁÔØ ÆÁÊÌ ÛÁÂÌÏÎÁ\n" -" -t, --debug ÎÁÓÔÒÏÉÔØ ÁÎÁÌÉÚÁÔÏÒ ÄÌÑ ÏÔÌÁÄËÉ\n" -" --locations ×ËÌÀÞÉÔØ ×ÙÞÉÓÌÅÎÉÅ ÍÅÓÔÏÐÏÌÏÖÅÎÉÊ\n" -" -p, --name-prefix=ðòåæéëó ÐÏÄÓÔÁ×ÉÔØ ðòåæéëó ÄÌÑ ×ÎÅÛÎÉÈ ÓÉÍ×ÏÌÏ×\n" -" -l, --no-lines ÎÅ ÇÅÎÅÒÉÒÏ×ÁÔØ ÄÉÒÅËÔÉ×Ù `#line'\n" -" -n, --no-parser ÇÅÎÅÒÉÒÏ×ÁÔØ ÔÏÌØËÏ ÔÁÂÌÉÃÙ\n" -" -k, --token-table ×ËÌÀÞÉÔØ ÔÁÂÌÉÃÕ ÉÍÅÎ ÌÅËÓÅÍ\n" - -#: src/getargs.c:225 -msgid "" -"Output:\n" -" -d, --defines also produce a header file\n" -" -r, --report=THINGS also produce details on the automaton\n" -" -v, --verbose same as `--report=state'\n" -" -b, --file-prefix=PREFIX specify a PREFIX for output files\n" -" -o, --output=FILE leave output to FILE\n" -" -g, --graph also produce a VCG description of the " -"automaton\n" -msgstr "" -"÷Ù×ÏÄ:\n" -" -d, --defines ÓÏÚÄÁÔØ ÔÁËÖÅ ÆÁÊÌ ÚÁÇÏÌÏ×ËÏ×\n" -" -r, --report=THINGS ÓÏÚÄÁÔØ ÔÁËÖÅ ÐÏÑÓÎÅÎÉÑ × Á×ÔÏÍÁÔÕ\n" -" -v, --verbose ÔÏ ÖÅ, ÞÔÏ É `--report=state'\n" -" -b, --file-prefix=ðòåæéëó ÕËÁÚÁÔØ ðòåæéëó ÄÌÑ ×ÙÈÏÄÎÙÈ ÆÁÊÌÏ×\n" -" -o, --output=æáêì ÐÏÍÅÓÔÉÔØ ÒÅÚÕÌØÔÁÔ × æáêì\n" -" -g, --graph ÓÏÚÄÁÔØ ÔÁËÖÅ ÐÏÑÓÎÅÎÉÑ Ë Á×ÔÏÍÁÔÕ × ×ÉÄÅ \n" -" VCG-ÇÒÁÆÁ\n" - -#: src/getargs.c:236 -msgid "" -"THINGS is a list of comma separated words that can include:\n" -" `state' describe the states\n" -" `itemset' complete the core item sets with their closure\n" -" `lookahead' explicitly associate lookaheads to items\n" -" `solved' describe shift/reduce conflicts solving\n" -" `all' include all the above information\n" -" `none' disable the report\n" -msgstr "" - -#: src/getargs.c:247 -msgid "Report bugs to .\n" -msgstr "ïÛÉÂËÉ ÓÏÏÂÝÁÊÔÅ ÐÏ ÁÄÒÅÓÕ .\n" - -#: src/getargs.c:264 -#, c-format -msgid "bison (GNU Bison) %s" -msgstr "bison (GNU Bison) %s" - -#: src/getargs.c:266 -msgid "Written by Robert Corbett and Richard Stallman.\n" -msgstr "á×ÔÏÒÙ: òÏÂÅÒÔ ëÏÒÂÅÔ É òÉÞÁÒÄ óÔÏÌÍÅÎ.\n" - -#: src/getargs.c:270 -#, c-format -msgid "Copyright (C) %d Free Software Foundation, Inc.\n" -msgstr "Copyright (C) %d Free Software Foundation, Inc.\n" - -#: src/getargs.c:272 -msgid "" -"This is free software; see the source for copying conditions. There is NO\n" -"warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n" -msgstr "" -"üÔÏ Ó×ÏÂÏÄÎÁÑ ÐÒÏÇÒÁÍÍÁ; ÕÓÌÏ×ÉÑ ÒÁÓÐÒÏÓÔÒÁÎÅÎÉÑ ÓÍÏÔÒÉÔÅ × ÉÓÈÏÄÎÙÈ " -"ÔÅËÓÔÁÈ.\n" -"îéëáëéè ÇÁÒÁÎÔÉÊ ÎÅ ÐÒÅÄÏÓÔÁ×ÌÑÅÔÓÑ, ÄÁÖÅ ÇÁÒÁÎÔÉÉ ðïìåúîïóôé ÉÌÉ " -"ðòéçïäîïóôé\n" -"äìñ ïðòåäåìåîîïê ãåìé.\n" - -#: src/getargs.c:438 -#, c-format -msgid "missing operand after `%s'" -msgstr "ÐÏÓÌÅ `%s' ÐÒÏÐÕÝÅÎ ÏÐÅÒÁÎÄ" - -#: src/getargs.c:440 -#, c-format -msgid "extra operand `%s'" -msgstr "ÌÉÛÎÉÊ ÏÐÅÒÁÎÄ `%s'" - -#: src/gram.c:139 -msgid "empty" -msgstr "ÐÕÓÔÏ" - -#: src/gram.c:233 -msgid "Grammar" -msgstr "çÒÁÍÍÁÔÉËÁ" - -#: src/gram.c:321 src/reduce.c:394 -msgid "warning" -msgstr "ÐÒÅÄÕÐÒÅÖÄÅÎÉÅ" - -#: src/main.c:124 -msgid "rule never reduced because of conflicts" -msgstr "ÐÒÁ×ÉÌÏ ÎÅ Ó×ÅÄÅÎÏ ÉÚ-ÚÁ ËÏÎÆÌÉËÔÏ×" - -#: src/parse-gram.y:363 -msgid "POSIX forbids declarations in the grammar" -msgstr "POSIX ÚÁÐÒÅÝÁÅÔ ÐÏÍÅÝÁÔØ ÏÐÉÓÁÎÉÑ × ÇÒÁÍÍÁÔÉËÅ" - -#: src/parse-gram.y:486 -msgid "missing identifier in parameter declaration" -msgstr "× ÏÐÉÓÁÎÉÉ ÐÁÒÁÍÅÔÒÁ ÏÔÓÕÔÓÔ×ÕÅÔ ÉÄÅÎÔÉÆÉËÁÔÏÒ" - -#: src/print.c:49 -#, c-format -msgid " type %d is %s\n" -msgstr " ÔÉÐ %d Ñ×ÌÑÅÔÓÑ %s\n" - -#: src/print.c:165 -#, c-format -msgid "shift, and go to state %d\n" -msgstr "ÓÄ×ÉÇ, É ÐÅÒÅÈÏÄ × ÓÏÓÔÏÑÎÉÅ %d\n" - -#: src/print.c:167 -#, c-format -msgid "go to state %d\n" -msgstr "ÐÅÒÅÈÏÄ × ÓÏÓÔÏÑÎÉÅ %d\n" - -#: src/print.c:204 -msgid "error (nonassociative)\n" -msgstr "ÏÛÉÂËÁ (ÎÅÁÓÓÏÃÉÁÔÉ×ÎÁÑ)\n" - -#: src/print.c:292 -#, c-format -msgid "reduce using rule %d (%s)" -msgstr "×Ù×ÏÄ Ó ÉÓÐÏÌØÚÏ×ÁÎÉÅÍ ÐÒÁ×ÉÌÁ %d (%s)" - -#: src/print.c:294 -#, c-format -msgid "accept" -msgstr "" - -#: src/print.c:325 src/print.c:391 -msgid "$default" -msgstr "$default" - -#: src/print.c:420 -#, c-format -msgid "state %d" -msgstr "ÓÏÓÔÏÑÎÉÅ %d" - -#: src/print.c:456 -msgid "Terminals, with rules where they appear" -msgstr "ôÅÒÍÉÎÁÌØÎÙÅ ÓÉÍ×ÏÌÙ Ó ÐÒÁ×ÉÌÁÍÉ, × ËÏÔÏÒÙÈ ÏÎÉ ÐÏÑ×ÌÑÀÔÓÑ" - -#: src/print.c:483 -msgid "Nonterminals, with rules where they appear" -msgstr "îÅÔÅÒÍÉÎÁÌØÎÙÅ ÓÉÍ×ÏÌÙ Ó ÐÒÁ×ÉÌÁÍÉ, × ËÏÔÏÒÙÈ ÏÎÉ ÐÏÑ×ÌÑÀÔÓÑ" - -#: src/print.c:512 -#, c-format -msgid " on left:" -msgstr " ÎÁÌÅ×Ï:" - -#: src/print.c:527 -#, c-format -msgid " on right:" -msgstr " ÎÁÐÒÁ×Ï:" - -#: src/print.c:555 -msgid "Rules never reduced" -msgstr "ðÒÁ×ÉÌÁ ÎÅ Ó×ÅÄÅÎÙ" - -#: src/reader.c:56 -#, c-format -msgid "multiple %s declarations" -msgstr "ÍÎÏÖÅÓÔ×ÅÎÎÏÅ ÏÐÉÓÁÎÉÅ %s" - -#: src/reader.c:118 -#, c-format -msgid "result type clash on merge function %s: <%s> != <%s>" -msgstr "" - -#: src/reader.c:216 -#, c-format -msgid "rule given for %s, which is a token" -msgstr "ÐÒÁ×ÉÌÏ ÚÁÄÁÎÏ ÄÌÑ %s, ËÏÔÏÒÙÊ Ñ×ÌÑÅÔÓÑ ÌÅËÓÅÍÏÊ" - -#: src/reader.c:245 -#, c-format -msgid "type clash on default action: <%s> != <%s>" -msgstr "ËÏÎÆÌÉËÔ ÔÉÐÏ× ÎÁ ÄÅÊÓÔ×ÉÉ ÐÏ ÕÍÏÌÞÁÎÉÀ: <%s> != <%s>" - -#: src/reader.c:251 -msgid "empty rule for typed nonterminal, and no action" -msgstr "" -"ÐÕÓÔÏÅ ÐÒÁ×ÉÌÏ ÄÌÑ ÔÉÐÉÚÉÒÏ×ÁÎÎÏÇÏ ÎÅÔÅÒÍÉÎÁÌØÎÏÇÏ ÓÉÍ×ÏÌÁ, É ÎÅÔ ÄÅÊÓÔ×ÉÑ" - -#: src/reader.c:321 src/reader.c:335 src/reader.c:348 -#, c-format -msgid "only one %s allowed per rule" -msgstr "" - -#: src/reader.c:331 src/reader.c:346 -#, c-format -msgid "%s affects only GLR parsers" -msgstr "" - -#: src/reader.c:333 -#, c-format -msgid "%s must be followed by positive number" -msgstr "ÚÁ %s ÄÏÌÖÎÏ ÓÌÅÄÏ×ÁÔØ ÐÏÌÏÖÉÔÅÌØÎÏÅ ÞÉÓÌÏ" - -#: src/reader.c:490 -msgid "no rules in the input grammar" -msgstr "ÏÔÓÕÔÓÔ×ÕÀÔ ÐÒÁ×ÉÌÁ ×Ï ×ÈÏÄÎÏÊ ÇÒÁÍÍÁÔÉËÅ" - -#: src/reduce.c:242 -msgid "useless rule" -msgstr "ÂÅÓÐÏÌÅÚÎÏÅ ÐÒÁ×ÉÌÏ" - -#: src/reduce.c:303 -#, c-format -msgid "useless nonterminal: %s" -msgstr "ÂÅÓÐÏÌÅÚÎÙÅ ÎÅÔÅÒÍÉÎÁÌ: %s" - -#: src/reduce.c:351 -msgid "Useless nonterminals" -msgstr "âÅÓÐÏÌÅÚÎÙÅ ÎÅÔÅÒÍÉÎÁÌÙ" - -#: src/reduce.c:364 -msgid "Terminals which are not used" -msgstr "îÅÉÓÐÏÌØÚÏ×ÁÎÎÙÅ ÔÅÒÍÉÎÁÌÙ" - -#: src/reduce.c:373 -msgid "Useless rules" -msgstr "âÅÓÐÏÌÅÚÎÙÅ ÐÒÁ×ÉÌÁ" - -#: src/reduce.c:389 -#, c-format -msgid "%d rule never reduced\n" -msgid_plural "%d rules never reduced\n" -msgstr[0] "%d ÐÒÁ×ÉÌÏ ÎÅ Ó×ÅÄÅÎÏ\n" -msgstr[1] "%d ÐÒÁ×ÉÌÁ ÎÅ Ó×ÅÄÅÎÏ\n" -msgstr[2] "%d ÐÒÁ×ÉÌ ÎÅ Ó×ÅÄÅÎÏ\n" - -#: src/reduce.c:397 -#, c-format -msgid "%d useless nonterminal" -msgid_plural "%d useless nonterminals" -msgstr[0] "%d ÂÅÓÐÏÌÅÚÎÙÊ ÎÅÔÅÒÍÉÎÁÌ" -msgstr[1] "%d ÂÅÓÐÏÌÅÚÎÙÈ ÎÅÔÅÒÍÉÎÁÌÁ" -msgstr[2] "%d ÂÅÓÐÏÌÅÚÎÙÈ ÎÅÔÅÒÍÉÎÁÌÏ×" - -#: src/reduce.c:403 -#, c-format -msgid " and " -msgstr " É " - -#: src/reduce.c:406 -#, c-format -msgid "%d useless rule" -msgid_plural "%d useless rules" -msgstr[0] "%d ÂÅÓÐÏÌÅÚÎÏÅ ÐÒÁ×ÉÌÏ" -msgstr[1] "%d ÂÅÓÐÏÌÅÚÎÙÈ ÐÒÁ×ÉÌÁ" -msgstr[2] "%d ÂÅÓÐÏÌÅÚÎÙÈ ÐÒÁ×ÉÌ" - -#: src/reduce.c:436 -#, c-format -msgid "start symbol %s does not derive any sentence" -msgstr "ÎÁÞÁÌØÎÙÊ ÓÉÍ×ÏÌ %s ÎÅ ×Ù×ÏÄÉÔ ÎÉ ÏÄÎÏÇÏ ÐÒÅÄÌÏÖÅÎÉÑ" - -#: src/scan-gram.l:162 -msgid "stray `,' treated as white space" -msgstr "ÌÉÛÎÑÑ `,', ÓÞÉÔÁÅÔÓÑ ÐÒÏÂÅÌÏÍ" - -#: src/scan-gram.l:225 -#, c-format -msgid "invalid directive: %s" -msgstr "ÎÅ×ÅÒÎÁÑ ÄÉÒÅËÔÉ×Á: %s" - -#: src/scan-gram.l:283 -#, c-format -msgid "invalid character: %s" -msgstr "ÎÅÄÏÐÕÓÔÉÍÙÊ ÓÉÍ×ÏÌ: %s" - -#: src/scan-gram.l:402 -#, fuzzy -msgid "invalid null character" -msgstr "ÎÅÄÏÐÕÓÔÉÍÙÊ ÓÉÍ×ÏÌ: %s" - -#: src/scan-gram.l:415 src/scan-gram.l:427 src/scan-gram.l:448 -#, c-format -msgid "invalid escape sequence: %s" -msgstr "ÎÅÄÏÐÕÓÔÉÍÁÑ ÜËÒÁÎÉÒÕÀÝÁÑ ÐÏÓÌÅÄÏ×ÁÔÅÌØÎÏÓÔØ: %s" - -#: src/scan-gram.l:417 src/scan-gram.l:429 src/scan-gram.l:450 -#, fuzzy, c-format -msgid "invalid null character: %s" -msgstr "ÎÅÄÏÐÕÓÔÉÍÙÊ ÓÉÍ×ÏÌ: %s" - -#: src/scan-gram.l:455 -#, c-format -msgid "unrecognized escape sequence: %s" -msgstr "ÎÅÒÁÓÐÏÚÎÁÎÎÁÑ ÜËÒÁÎÉÒÕÀÝÁÑ ÐÏÓÌÅÄÏ×ÁÔÅÌØÎÏÓÔØ: %s" - -#: src/scan-gram.l:537 -#, c-format -msgid "missing `{' in `%s'" -msgstr "× `%s' ÏÔÓÕÔÓÔ×ÕÅÔ `{'" - -#: src/scan-gram.l:782 -#, c-format -msgid "$$ of `%s' has no declared type" -msgstr "$$ × `%s' ÎÅ ÉÍÅÅÔ ÏÐÉÓÁÎÎÏÇÏ ÔÉÐÁ" - -#: src/scan-gram.l:803 -#, c-format -msgid "$%d of `%s' has no declared type" -msgstr "$%d ÉÚ `%s' ÎÅ ÉÍÅÅÔ ÏÐÉÓÁÎÎÏÇÏ ÔÉÐÁ" - -#: src/scan-gram.l:812 src/scan-gram.l:881 src/scan-gram.l:932 -#, c-format -msgid "integer out of range: %s" -msgstr "×ÙÈÏÄ ÚÁ ÇÒÁÎÉÃÙ ÄÉÁÐÁÚÏÎÁ ÃÅÌÏÇÏ: %s" - -#: src/scan-gram.l:848 src/scan-gram.l:916 -#, c-format -msgid "invalid value: %s" -msgstr "ÎÅÄÏÐÕÓÔÉÍÏÅ ÚÎÁÞÅÎÉÅ: %s" - -#: src/scan-gram.l:1036 -#, c-format -msgid "missing `%s' at end of file" -msgstr "ÏÔÓÕÔÓÔ×ÕÅÔ `%s' × ËÏÎÃÅ ÆÁÊÌÁ" - -#: src/scan-gram.l:1047 -#, fuzzy, c-format -msgid "missing `%s' at end of line" -msgstr "ÏÔÓÕÔÓÔ×ÕÅÔ `%s' × ËÏÎÃÅ ÆÁÊÌÁ" - -#: src/symlist.c:97 src/symlist.c:108 -msgid "invalid $ value" -msgstr "ÎÅ×ÅÒÎÏÅ $ ÚÎÁÞÅÎÉÅ" - -#: src/symtab.c:85 -#, c-format -msgid "type redeclaration for %s" -msgstr "ÐÏ×ÔÏÒÎÏÅ ÏÐÉÓÁÎÉÅ ÔÉÐÁ ÄÌÑ %s" - -#: src/symtab.c:102 src/symtab.c:120 -#, c-format -msgid "%s redeclaration for %s" -msgstr "ÐÏ×ÔÏÒÎÏÅ ÏÐÉÓÁÎÉÅ %s ÄÌÑ %s" - -#: src/symtab.c:139 -#, c-format -msgid "redefining precedence of %s" -msgstr "ÐÅÒÅÏÐÒÅÄÅÌÅÎÉÅ ÐÒÉÏÒÉÔÅÔÁ ÄÌÑ %s" - -#: src/symtab.c:157 -#, c-format -msgid "symbol %s redefined" -msgstr "ÐÏ×ÔÏÒÎÏÅ ÏÐÒÅÄÅÌÅÎÉÅ ÓÉÍ×ÏÌÁ %s" - -#: src/symtab.c:180 -#, c-format -msgid "redefining user token number of %s" -msgstr "ÐÅÒÅÏÐÒÅÄÅÌÅÎÉÅ ÎÏÍÅÒÁ ÌÅËÓÅÍÙ ÐÏÌØÚÏ×ÁÔÅÌÑ ÄÌÑ %s" - -#: src/symtab.c:207 -#, c-format -msgid "symbol %s is used, but is not defined as a token and has no rules" -msgstr "ÓÉÍ×ÏÌ %s ÉÓÐÏÌØÚÕÅÔÓÑ, ÎÏ ÎÅ ÏÐÒÅÄÅÌÅÎ ËÁË ÌÅËÓÅÍÁ É ÎÅ ÉÍÅÅÔ ÐÒÁ×ÉÌ" - -#: src/symtab.c:232 -#, c-format -msgid "symbol `%s' used more than once as a literal string" -msgstr "" - -#: src/symtab.c:235 -#, c-format -msgid "symbol `%s' given more than one literal string" -msgstr "" - -#: src/symtab.c:271 -#, c-format -msgid "conflicting precedences for %s and %s" -msgstr "ÐÒÏÔÉ×ÏÒÅÞÉ×ÙÅ ÐÒÉÏÒÉÔÅÔÙ ÄÌÑ %s É %s" - -#: src/symtab.c:283 -#, c-format -msgid "conflicting associativities for %s (%s) and %s (%s)" -msgstr "ÐÒÏÔÉ×ÏÒÅÞÉ×ÙÅ ÚÎÁÞÅÎÉÑ ÁÓÓÏÃÉÁÔÉ×ÎÏÓÔÉ ÄÌÑ %s (%s) É %s (%s)" - -#: src/symtab.c:368 -#, c-format -msgid "tokens %s and %s both assigned number %d" -msgstr "ÏÂÅÉÍ ÌÅËÓÅÍÁÍ %s É %s ÐÒÉÓ×ÏÅÎ ÎÏÍÅÒ %d" - -#: src/symtab.c:591 -#, c-format -msgid "the start symbol %s is undefined" -msgstr "ÎÁÞÁÌØÎÙÊ ÓÉÍ×ÏÌ %s ÎÅÏÐÒÅÄÅÌÅÎ" - -#: src/symtab.c:595 -#, c-format -msgid "the start symbol %s is a token" -msgstr "ÎÁÞÁÌØÎÙÊ ÓÉÍ×ÏÌ %s Ñ×ÌÑÅÔÓÑ ÌÅËÓÅÍÏÊ" - -#: lib/argmatch.c:133 -#, c-format -msgid "invalid argument %s for %s" -msgstr "ÎÅÄÏÐÕÓÔÉÍÙÊ ÁÒÇÕÍÅÎÔ %s ÄÌÑ %s" - -#: lib/argmatch.c:134 -#, c-format -msgid "ambiguous argument %s for %s" -msgstr "ÎÅÏÄÎÏÚÎÁÞÎÙÊ ÁÒÇÕÍÅÎÔ %s ÄÌÑ %s" - -#: lib/argmatch.c:153 -#, c-format -msgid "Valid arguments are:" -msgstr "äÏÐÕÓÔÉÍÙÅ ÁÒÇÕÍÅÎÔÙ:" - -#: lib/bitset_stats.c:179 -#, c-format -msgid "%u bitset_allocs, %u freed (%.2f%%).\n" -msgstr "" - -#: lib/bitset_stats.c:182 -#, c-format -msgid "%u bitset_sets, %u cached (%.2f%%)\n" -msgstr "" - -#: lib/bitset_stats.c:185 -#, c-format -msgid "%u bitset_resets, %u cached (%.2f%%)\n" -msgstr "" - -#: lib/bitset_stats.c:188 -#, c-format -msgid "%u bitset_tests, %u cached (%.2f%%)\n" -msgstr "" - -#: lib/bitset_stats.c:192 -#, c-format -msgid "%u bitset_lists\n" -msgstr "" - -#: lib/bitset_stats.c:194 -msgid "count log histogram\n" -msgstr "" - -#: lib/bitset_stats.c:197 -msgid "size log histogram\n" -msgstr "" - -#: lib/bitset_stats.c:200 -msgid "density histogram\n" -msgstr "" - -#: lib/bitset_stats.c:214 -#, c-format -msgid "" -"Bitset statistics:\n" -"\n" -msgstr "" - -#: lib/bitset_stats.c:217 -#, c-format -msgid "Accumulated runs = %u\n" -msgstr "" - -#: lib/bitset_stats.c:261 lib/bitset_stats.c:266 -msgid "Could not read stats file." -msgstr "îÅ ÕÄÁÅÔÓÑ ÐÒÏÞÉÔÁÔØ ÆÁÊÌ ÓÔÁÔÉÓÔÉËÉ." - -#: lib/bitset_stats.c:263 -#, c-format -msgid "Bad stats file size.\n" -msgstr "" - -#: lib/bitset_stats.c:289 lib/bitset_stats.c:291 -msgid "Could not write stats file." -msgstr "îÅ ÕÄÁÅÔÓÑ ÚÁÐÉÓÁÔØ × ÆÁÊÌ ÓÔÁÔÉÓÔÉËÉ." - -#: lib/bitset_stats.c:294 -msgid "Could not open stats file for writing." -msgstr "îÅ ÕÄÁÅÔÓÑ ÏÔËÒÙÔØ ÆÁÊÌ ÓÔÁÔÉÓÔÉËÉ ÄÌÑ ÚÁÐÉÓÉ." - -#: lib/error.c:127 -msgid "Unknown system error" -msgstr "îÅÉÚ×ÅÓÔÎÁÑ ÓÉÓÔÅÍÎÁÑ ÏÛÉÂËÁ" - -#: lib/getopt.c:570 lib/getopt.c:589 -#, c-format -msgid "%s: option `%s' is ambiguous\n" -msgstr "%s: ÎÅÏÄÎÏÚÎÁÞÎÙÊ ËÌÀÞ `%s'\n" - -#: lib/getopt.c:622 lib/getopt.c:626 -#, c-format -msgid "%s: option `--%s' doesn't allow an argument\n" -msgstr "%s: ËÌÀÞ `--%s' ÄÏÌÖÅÎ ÉÓÐÏÌØÚÏ×ÁÔØÓÑ ÂÅÚ ÁÒÇÕÍÅÎÔÁ\n" - -#: lib/getopt.c:635 lib/getopt.c:640 -#, c-format -msgid "%s: option `%c%s' doesn't allow an argument\n" -msgstr "%s: ËÌÀÞ `%c%s' ÄÏÌÖÅÎ ÉÓÐÏÌØÚÏ×ÁÔØÓÑ ÂÅÚ ÁÒÇÕÍÅÎÔÁ\n" - -#: lib/getopt.c:686 lib/getopt.c:708 lib/getopt.c:1039 lib/getopt.c:1061 -#, c-format -msgid "%s: option `%s' requires an argument\n" -msgstr "%s: ËÌÀÞ `%s' ÄÏÌÖÅÎ ÉÓÐÏÌØÚÏ×ÁÔØÓÑ Ó ÁÒÇÕÍÅÎÔÏÍ\n" - -#: lib/getopt.c:746 lib/getopt.c:749 -#, c-format -msgid "%s: unrecognized option `--%s'\n" -msgstr "%s: ÎÅÉÚ×ÅÓÔÎÙÊ ËÌÀÞ `--%s'\n" - -#: lib/getopt.c:757 lib/getopt.c:760 -#, c-format -msgid "%s: unrecognized option `%c%s'\n" -msgstr "%s: ÎÅÉÚ×ÅÓÔÎÙÊ ËÌÀÞ `%c%s'\n" - -#: lib/getopt.c:815 lib/getopt.c:818 -#, c-format -msgid "%s: illegal option -- %c\n" -msgstr "%s: ÎÅÄÏÐÕÓÔÉÍÙÊ ËÌÀÞ -- %c\n" - -#: lib/getopt.c:824 lib/getopt.c:827 -#, c-format -msgid "%s: invalid option -- %c\n" -msgstr "%s: ÎÅ×ÅÒÎÙÊ ËÌÀÞ -- %c\n" - -#: lib/getopt.c:882 lib/getopt.c:901 lib/getopt.c:1114 lib/getopt.c:1135 -#, c-format -msgid "%s: option requires an argument -- %c\n" -msgstr "%s: ËÌÀÞ ÄÏÌÖÅÎ ÉÓÐÏÌØÚÏ×ÁÔØÓÑ Ó ÁÒÇÕÍÅÎÔÏÍ -- %c\n" - -#: lib/getopt.c:954 lib/getopt.c:973 -#, c-format -msgid "%s: option `-W %s' is ambiguous\n" -msgstr "%s: ÎÅÏÄÎÏÚÎÁÞÎÙÊ ËÌÀÞ `-W %s'\n" - -#: lib/getopt.c:997 lib/getopt.c:1018 -#, c-format -msgid "%s: option `-W %s' doesn't allow an argument\n" -msgstr "%s: ËÌÀÞ `-W %s' ÄÏÌÖÅÎ ÉÓÐÏÌØÚÏ×ÁÔØÓÑ ÂÅÚ ÁÒÇÕÍÅÎÔÁ\n" - -#: lib/obstack.c:417 lib/obstack.c:420 lib/xmalloc.c:53 -msgid "memory exhausted" -msgstr "ÐÁÍÑÔØ ÉÓÞÅÒÐÁÎÁ" - -#: lib/quotearg.c:238 -msgid "`" -msgstr "`" - -#: lib/quotearg.c:239 -msgid "'" -msgstr "'" - -#: lib/subpipe.c:171 -#, c-format -msgid "subsidiary program `%s' could not be invoked" -msgstr "ÎÅ ÕÄÁÅÔÓÑ ×ÙÐÏÌÎÉÔØ ×ÓÐÏÍÏÇÁÔÅÌØÎÕÀ ÐÒÏÇÒÁÍÍÕ `%s'" - -#: lib/subpipe.c:173 -#, c-format -msgid "subsidiary program `%s' not found" -msgstr "×ÓÐÏÍÏÇÁÔÅÌØÎÁÑ ÐÒÏÇÒÁÍÍÁ `%s' ÎÅ ÎÁÊÄÅÎÁ" - -#: lib/subpipe.c:175 -#, c-format -msgid "subsidiary program `%s' failed" -msgstr "×ÓÐÏÍÏÇÁÔÅÌØÎÁÑ ÐÒÏÇÒÁÍÍÁ `%s' ÚÁ×ÅÒÛÉÌÁÓØ ÎÅÕÄÁÞÎÏ" - -#: lib/subpipe.c:176 -#, c-format -msgid "subsidiary program `%s' failed (exit status %d)" -msgstr "" -"×ÓÐÏÍÏÇÁÔÅÌØÎÁÑ ÐÒÏÇÒÁÍÍÁ `%s' ÚÁ×ÅÒÛÉÌÁÓØ ÎÅÕÄÁÞÎÏ (ËÏÄ ÚÁ×ÅÒÛÅÎÉÑ %d)" - -#: lib/timevar.c:475 -msgid "" -"\n" -"Execution times (seconds)\n" -msgstr "" - -#: lib/timevar.c:525 -msgid " TOTAL :" -msgstr "" - -#: lib/timevar.c:561 -#, c-format -msgid "time in %s: %ld.%06ld (%ld%%)\n" -msgstr "" - -#~ msgid "too many states (max %d)" -#~ msgstr "ÓÌÉÛËÏÍ ÍÎÏÇÏ ÓÏÓÔÏÑÎÉÊ (ÍÁËÓÉÍÁÌØÎÏ %d)" - -#~ msgid "reduce" -#~ msgstr "×Ù×ÏÄ" - -#~ msgid "shift" -#~ msgstr "ÓÄ×ÉÇ" - -#~ msgid "%d shift/reduce conflict" -#~ msgid_plural "%d shift/reduce conflicts" -#~ msgstr[0] "%d ËÏÎÆÌÉËÔ ÓÄ×ÉÇÁ/×Ù×ÏÄÁ" -#~ msgstr[1] "%d ËÏÎÆÌÉËÔÁ ÓÄ×ÉÇÁ/×Ù×ÏÄÁ" -#~ msgstr[2] "%d ËÏÎÆÌÉËÔÏ× ÓÄ×ÉÇÁ/×Ù×ÏÄÁ" - -#~ msgid "and" -#~ msgstr "É" - -#~ msgid "State %d contains " -#~ msgstr "óÏÓÔÏÑÎÉÅ %d ÓÏÄÅÒÖÉÔ " - -#~ msgid "conflicts: " -#~ msgstr "ËÏÎÆÌÉËÔÙ: " - -#~ msgid "%s contains " -#~ msgstr "%s ÓÏÄÅÒÖÉÔ " - -#~ msgid "`%s' is no longer supported" -#~ msgstr "`%s' ÂÏÌØÛÅ ÎÅ ÐÏÄÄÅÒÖÉ×ÁÅÔÓÑ" - -#~ msgid "%s: no grammar file given\n" -#~ msgstr "%s: ÎÅ ÚÁÄÁÎ ÆÁÊÌ Ó ÇÒÁÍÍÁÔÉËÏÊ\n" - -#~ msgid "%s: extra arguments ignored after `%s'\n" -#~ msgstr "%s: ÌÉÛÎÉÅ ÁÒÇÕÍÅÎÔÙ ÐÏÓÌÅ `%s' ÉÇÎÏÒÉÒÏ×ÁÎÙ\n" - -#~ msgid "too many gotos (max %d)" -#~ msgstr "ÓÌÉÛËÏÍ ÍÎÏÇÏ goto (ÍÁËÓÉÍÁÌØÎÏ %d)" - -#~ msgid "unexpected `/' found and ignored" -#~ msgstr "×ÓÔÒÅÞÅÎ É ÐÒÏÉÇÎÏÒÉÒÏ×ÁÎ ÎÅÏÖÉÄÁÎÎÙÊ ÓÉÍ×ÏÌ `/'" - -#~ msgid "unterminated comment" -#~ msgstr "ÎÅÚÁËÏÎÞÅÎÎÙÊ ËÏÍÍÅÎÔÁÒÉÊ" - -#~ msgid "unexpected end of file" -#~ msgstr "ÎÅÏÖÉÄÁÎÎÙÊ ËÏÎÅà ÆÁÊÌÁ" - -#~ msgid "unescaped newline in constant" -#~ msgstr "ÎÅÜËÒÁÎÉÒÏ×ÁÎÎÙÊ ÐÅÒÅ×ÏÄ ÓÔÒÏËÉ × ËÏÎÓÔÁÎÔÅ" - -#~ msgid "octal value outside range 0...255: `\\%o'" -#~ msgstr "×ÏÓØÍÅÒÉÞÎÁÑ ×ÅÌÉÞÉÎÁ ÚÁ ÐÒÅÄÅÌÁÍÉ ÄÉÁÐÁÚÏÎÁ 0...255: `\\%o'" - -#~ msgid "hexadecimal value above 255: `\\x%x'" -#~ msgstr "ÛÅÓÔÎÁÄÃÁÔÅÒÉÞÎÁÑ ×ÅÌÉÞÉÎÁ ÐÒÅ×ÙÛÁÅÔ 255: `\\x%x'" - -#~ msgid "unknown escape sequence: `\\' followed by `%s'" -#~ msgstr "ÎÅÉÚ×ÅÓÔÎÁÑ escape-ÐÏÓÌÅÄÏ×ÁÔÅÌØÎÏÓÔØ: `%s' ÐÏÓÌÅ `\\'" - -#~ msgid "unterminated type name at end of file" -#~ msgstr "ÎÅÚÁËÏÎÞÅÎÎÏÅ ÉÍÑ ÔÉÐÁ × ËÏÎÃÅ ÆÁÊÌÁ" - -#~ msgid "unterminated type name" -#~ msgstr "ÎÅÚÁËÏÎÞÅÎÎÏÅ ÉÍÑ ÔÉÐÁ" - -#~ msgid "use \"...\" for multi-character literal tokens" -#~ msgstr "ÉÓÐÏÌØÚÕÊÔÅ \"...\" ÄÌÑ ÍÎÏÇÏÓÉÍ×ÏÌØÎÙÈ ÌÉÔÅÒÁÌØÎÙÈ ÌÅËÓÅÍ" - -#~ msgid "`%s' supports no argument: %s" -#~ msgstr "`%s' ÎÅ ÐÏÄÄÅÒÖÉ×ÁÅÔ ÁÒÇÕÍÅÎÔÁ %s" - -#~ msgid "`%s' requires an argument" -#~ msgstr "ËÌÀÞ `%s' ÄÏÌÖÅÎ ÉÓÐÏÌØÚÏ×ÁÔØÓÑ Ó ÁÒÇÕÍÅÎÔÏÍ" - -#~ msgid " (rule %d)" -#~ msgstr " (ÐÒÁ×ÉÌÏ %d)" - -#~ msgid " %-4s\terror (nonassociative)\n" -#~ msgstr " %-4s\tÏÛÉÂËÁ (ÎÅÁÓÓÏÃÉÁÔÉ×ÎÁÑ)\n" - -#~ msgid "" -#~ " $default\treduce using rule %d (%s)\n" -#~ "\n" -#~ msgstr "" -#~ " $default\t×Ù×ÏÄ Ó ÉÓÐÏÌØÚÏ×ÁÎÉÅÍ ÐÒÁ×ÉÌÁ %d (%s)\n" -#~ "\n" - -#~ msgid " %-4s\t[reduce using rule %d (%s)]\n" -#~ msgstr " %-4s\t[×Ù×ÏÄ Ó ÉÓÐÏÌØÚÏ×ÁÎÉÅÍ ÐÒÁ×ÉÌÁ %d (%s)]\n" - -#~ msgid " %-4s\treduce using rule %d (%s)\n" -#~ msgstr " %-4s\t×Ù×ÏÄ Ó ÉÓÐÏÌØÚÏ×ÁÎÉÅÍ ÐÒÁ×ÉÌÁ %d (%s)\n" - -#~ msgid " $default\treduce using rule %d (%s)\n" -#~ msgstr " $default\t×Ù×ÏÄ Ó ÉÓÐÏÌØÚÏ×ÁÎÉÅÍ ÐÒÁ×ÉÌÁ %d (%s)\n" - -#~ msgid " $default\taccept\n" -#~ msgstr " $default\tÐÒÉÎÑÔÉÅ\n" - -#~ msgid " NO ACTIONS\n" -#~ msgstr " îåô äåêóô÷éê\n" - -#~ msgid "Number, Line, Rule" -#~ msgstr "îÏÍÅÒ, óÔÒÏËÁ, ðÒÁ×ÉÌÏ" - -#~ msgid " %3d %3d %s ->" -#~ msgstr " %3d %3d %s ->" - -#~ msgid " Skipping to next \\n" -#~ msgstr " ðÒÏÐÕÓË ÄÏ ÓÌÅÄÕÀÝÅÇÏ \\n" - -#~ msgid " Skipping to next %c" -#~ msgstr " ðÒÏÐÕÓË ÄÏ ÓÌÅÄÕÀÝÅÇÏ %c" - -#~ msgid "unterminated string" -#~ msgstr "ÎÅÚÁËÏÎÞÅÎÎÁÑ ÓÔÒÏËÁ" - -#~ msgid "%s is invalid" -#~ msgstr "ÎÅ×ÅÒÎÙÊ ÚÎÁË %s" - -#~ msgid "unterminated `%{' definition" -#~ msgstr "ÎÅÚÁËÏÎÞÅÎÎÏÅ ÏÐÒÅÄÅÌÅÎÉÅ `%{'" - -#~ msgid "Premature EOF after %s" -#~ msgstr "ðÒÅÖÄÅ×ÒÅÍÅÎÎÙÊ ËÏÎÅà ÆÁÊÌÁ ÐÏÓÌÅ %s" - -#~ msgid "`%s' is invalid in %s" -#~ msgstr "`%s' ÎÅ×ÅÒÎÏ × %s" - -#~ msgid "invalid %s declaration" -#~ msgstr "ÎÅ×ÅÒÎÏÅ ÏÐÉÓÁÎÉÅ %s" - -#~ msgid "%type declaration has no " -#~ msgstr "ÏÐÉÓÁÎÉÅ %type ÎÅ ÉÍÅÅÔ <ÉÍÑ_ÔÉÐÁ>" - -#~ msgid "invalid %%type declaration due to item: %s" -#~ msgstr "ÎÅ×ÅÒÎÏÅ ÏÐÉÓÁÎÉÅ %%type ÉÚ-ÚÁ ÜÌÅÍÅÎÔÁ: %s" - -#~ msgid "invalid text (%s) - number should be after identifier" -#~ msgstr "ÎÅ×ÅÒÎÙÊ ÔÅËÓÔ (%s) - ÞÉÓÌÏ ÄÏÌÖÎÏ ÓÌÅÄÏ×ÁÔØ ÚÁ ÉÄÅÎÔÉÆÉËÁÔÏÒÏÍ" - -#~ msgid "unexpected item: %s" -#~ msgstr "ÎÅÏÖÉÄÁÎÎÙÊ ÜÌÅÍÅÎÔ: %s" - -#~ msgid "unmatched %s" -#~ msgstr "ÎÅÐÁÒÎÁÑ %s" - -#~ msgid "argument of %%expect is not an integer" -#~ msgstr "ÁÒÇÕÍÅÎÔ %%expect ÎÅ Ñ×ÌÑÅÔÓÑ ÃÅÌÙÍ ÞÉÓÌÏÍ" - -#~ msgid "unrecognized item %s, expected an identifier" -#~ msgstr "ÎÅÒÁÓÐÏÚÎÁÎÎÙÊ ÜÌÅÍÅÎÔ %s, ÏÖÉÄÁÌÓÑ ÉÄÅÎÔÉÆÉËÁÔÏÒ" - -#~ msgid "expected string constant instead of %s" -#~ msgstr "×ÍÅÓÔÏ %s ÏÖÉÄÁÌÁÓØ ÓÔÒÏËÏ×ÁÑ ÐÏÓÔÏÑÎÎÁÑ" - -#~ msgid "no input grammar" -#~ msgstr "ÎÅÔ ×ÈÏÄÎÏÊ ÇÒÁÍÍÁÔÉËÉ" - -#~ msgid "ill-formed rule: initial symbol not followed by colon" -#~ msgstr "ÎÅ×ÅÒÎÏÅ ÐÒÁ×ÉÌÏ: Ä×ÏÅÔÏÞÉÅ ÎÅ ÓÌÅÄÕÅÔ ÚÁ ÎÁÞÁÌØÎÙÍ ÓÉÍ×ÏÌÏÍ" - -#~ msgid "grammar starts with vertical bar" -#~ msgstr "ÇÒÁÍÍÁÔÉËÁ ÎÁÞÉÎÁÅÔÓÑ Ó ×ÅÒÔÉËÁÌØÎÏÊ ÞÅÒÔÙ" - -#~ msgid "previous rule lacks an ending `;'" -#~ msgstr "× ÐÒÅÄÙÄÕÝÅÍ ÐÒÁ×ÉÌÅ ÏÔÓÕÔÓÔ×ÕÅÔ ÚÁ×ÅÒÛÁÀÝÁÑ `;'" - -#~ msgid "two @prec's in a row" -#~ msgstr "Ä×Á @prec ÐÏÄÒÑÄ" - -#~ msgid "%%guard present but %%semantic_parser not specified" -#~ msgstr "%%guard ÐÒÉÓÕÔÓÔ×ÕÅÔ, Á %%semantic_parser ÎÅ ÚÁÄÁÎ" - -#~ msgid "two actions at end of one rule" -#~ msgstr "Ä×Á ÄÅÊÓÔ×ÉÑ × ËÏÎÃÅ ÏÄÎÏÇÏ ÐÒÁ×ÉÌÁ" - -#~ msgid "too many symbols (tokens plus nonterminals); maximum %d" -#~ msgstr "ÓÌÉÛËÏÍ ÍÎÏÇÏ ÓÉÍ×ÏÌÏ× (ÌÅËÓÅÍÙ ÐÌÀÓ ÎÅÔÅÒÍÉÎÁÌÙ); ÍÁËÓÉÍÁÌØÎÏ %d" - -#~ msgid "maximum table size (%d) exceeded" -#~ msgstr "ÐÒÅ×ÙÛÅÎ ÍÁËÓÉÍÁÌØÎÙÊ ÒÁÚÍÅÒ ÔÁÂÌÉÃÙ (%d)" - -#~ msgid " $ \tgo to state %d\n" -#~ msgstr " $ \tÐÅÒÅÈÏÄ × ÓÏÓÔÏÑÎÉÅ %d\n" - -#~ msgid "unterminated %guard clause" -#~ msgstr "ÎÅÚÁËÏÎÞÅÎÎÙÊ ÏÐÅÒÁÔÏÒ %guard" - -#~ msgid " 1 shift/reduce conflict" -#~ msgstr " 1 ËÏÎÆÌÉËÔ ÓÄ×ÉÇÁ/×Ù×ÏÄÁ" - -#~ msgid "%s contains" -#~ msgstr "%s ÓÏÄÅÒÖÉÔ" - -#~ msgid "DERIVES" -#~ msgstr "DERIVES" - -#~ msgid "%s derives" -#~ msgstr "%s ×Ù×ÏÄÉÔ" - -#~ msgid "%s: internal error: %s\n" -#~ msgstr "%s: ×ÎÕÔÒÅÎÎÑÑ ÏÛÉÂËÁ: %s\n" - -#~ msgid "Entering set_nullable" -#~ msgstr "÷ÈÏÄ × set_nullable" - -#~ msgid "\t\t/* empty */" -#~ msgstr "\t\t/* ÐÕÓÔÏ */" - -#~ msgid "multiple %%header_extension declarations" -#~ msgstr "ÍÎÏÖÅÓÔ×ÅÎÎÙÅ ÏÐÉÓÁÎÉÑ %%header_extension" - -#~ msgid "multiple %%source_extension declarations" -#~ msgstr "ÍÎÏÖÅÓÔ×ÅÎÎÙÅ ÏÐÉÓÁÎÉÑ %%source_extension" - -#~ msgid "" -#~ "Variables\n" -#~ "---------\n" -#~ "\n" -#~ msgstr "" -#~ "ðÅÒÅÍÅÎÎÙÅ\n" -#~ "----------\n" -#~ "\n" - -#~ msgid "Value Sprec Sassoc Tag\n" -#~ msgstr "úÎÁÞ ðÒÉÏÒ áÓÓÏà ôÅÇ\n" - -#~ msgid "" -#~ "Rules\n" -#~ "-----\n" -#~ "\n" -#~ msgstr "" -#~ "ðÒÁ×ÉÌÁ\n" -#~ "-------\n" -#~ "\n" - -#~ msgid "" -#~ "Rules interpreted\n" -#~ "-----------------\n" -#~ "\n" -#~ msgstr "" -#~ "éÎÔÅÒÐÒÅÔÉÒÏ×ÁÎÎÙÅ ÐÒÁ×ÉÌÁ\n" -#~ "--------------------------\n" -#~ "\n" - -#~ msgid "" -#~ "reduced %s defines %d terminal%s, %d nonterminal%s, and %d production%s.\n" -#~ msgstr "" -#~ "×Ù×ÅÄÅÎÎÙÊ %s ÏÐÒÅÄÅÌÑÅÔ %d ÔÅÒÍÉÎÁÌÏ×%s, %d ÎÅÔÅÒÍÉÎÁÌÏ×%s, É %d ÐÒÁ×ÉÌ " -#~ "×Ù×ÏÄÁ%s.\n" - -#~ msgid "@%s is invalid" -#~ msgstr "ÎÅ×ÅÒÎÙÊ ÚÎÁË @%s" diff --git a/src/bin/bison/po/stamp-po b/src/bin/bison/po/stamp-po deleted file mode 100644 index 9788f70238..0000000000 --- a/src/bin/bison/po/stamp-po +++ /dev/null @@ -1 +0,0 @@ -timestamp diff --git a/src/bin/bison/po/sv.gmo b/src/bin/bison/po/sv.gmo deleted file mode 100644 index 9bcc62a62f..0000000000 Binary files a/src/bin/bison/po/sv.gmo and /dev/null differ diff --git a/src/bin/bison/po/sv.po b/src/bin/bison/po/sv.po deleted file mode 100644 index e0c9d44506..0000000000 --- a/src/bin/bison/po/sv.po +++ /dev/null @@ -1,741 +0,0 @@ -# Swedish messages for bison. -# Copyright © 2001, 2002, 2003 Free Software Foundation, Inc. -# Göran Uddeborg , 2001, 2002, 2003. -# $Revision: 1.1 $ -# -msgid "" -msgstr "" -"Project-Id-Version: bison 1.875\n" -"Report-Msgid-Bugs-To: bug-bison@gnu.org\n" -"POT-Creation-Date: 2004-05-21 10:26-0700\n" -"PO-Revision-Date: 2003-01-01 23:03+0100\n" -"Last-Translator: Göran Uddeborg \n" -"Language-Team: Swedish \n" -"MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=iso-8859-1\n" -"Content-Transfer-Encoding: 8bit\n" -"Plural-Forms: nplurals=2; plural=(n != 1);\n" - -#: src/complain.c:51 src/complain.c:66 -msgid "warning: " -msgstr "varning: " - -#: src/complain.c:122 src/complain.c:138 -msgid "fatal error: " -msgstr "ödesdigert fel: " - -#: src/conflicts.c:76 -#, c-format -msgid " Conflict between rule %d and token %s resolved as shift" -msgstr " Konflikt mellan regel %d och element %s löstes som skift" - -#: src/conflicts.c:84 -#, c-format -msgid " Conflict between rule %d and token %s resolved as reduce" -msgstr " Konflikt mellan regel %d och element %s löstes som reducera" - -#: src/conflicts.c:91 -#, c-format -msgid " Conflict between rule %d and token %s resolved as an error" -msgstr " Konflikt mellan regel %d och element %s löstes som ett fel" - -#: src/conflicts.c:399 -#, c-format -msgid "conflicts: %d shift/reduce, %d reduce/reduce\n" -msgstr "konflikter: %d skifta/reducera, %d reducera/reducera\n" - -#: src/conflicts.c:402 -#, c-format -msgid "conflicts: %d shift/reduce\n" -msgstr "konflikter: %d skifta/reducera\n" - -#: src/conflicts.c:404 -#, c-format -msgid "conflicts: %d reduce/reduce\n" -msgstr "konflikter: %d reducera/reducera\n" - -#: src/conflicts.c:422 -#, c-format -msgid "State %d " -msgstr "Tillstånd %d " - -#: src/conflicts.c:487 -#, fuzzy, c-format -msgid "%%expect-rr applies only to GLR parsers" -msgstr "%s påverkar endast GLR-parsrar" - -#: src/conflicts.c:511 -#, c-format -msgid "expected %d shift/reduce conflict" -msgid_plural "expected %d shift/reduce conflicts" -msgstr[0] "förväntade %d skifta/reducerakonflikt" -msgstr[1] "förväntade %d skifta/reducerakonflikter" - -#: src/conflicts.c:515 -#, fuzzy, c-format -msgid "expected %d reduce/reduce conflict" -msgid_plural "expected %d reduce/reduce conflicts" -msgstr[0] "förväntade 0 reducera/reducerakonflikter" -msgstr[1] "förväntade 0 reducera/reducerakonflikter" - -#: src/files.c:100 -#, c-format -msgid "cannot open file `%s'" -msgstr "kan inte öppna filen \"%s\"" - -#: src/files.c:116 -msgid "I/O error" -msgstr "I/O-fel" - -#: src/files.c:119 -msgid "cannot close file" -msgstr "kan inte stänga fil" - -#: src/files.c:337 -#, c-format -msgid "conflicting outputs to file %s" -msgstr "motstridiga utmatningar till filen %s" - -#: src/getargs.c:186 -#, c-format -msgid "Try `%s --help' for more information.\n" -msgstr "Försök med \"%s --help\" för mer information.\n" - -#: src/getargs.c:192 -msgid "GNU bison generates parsers for LALR(1) grammars.\n" -msgstr "GNU bison genererar parsrar för LALR(1)-grammatiker.\n" - -#: src/getargs.c:196 -#, c-format -msgid "Usage: %s [OPTION]... FILE\n" -msgstr "Användning: %s [FLAGGA]... FIL\n" - -#: src/getargs.c:200 -msgid "" -"If a long option shows an argument as mandatory, then it is mandatory\n" -"for the equivalent short option also. Similarly for optional arguments.\n" -msgstr "" -"Om en lång flagga visar ett argument som obligatoriskt är det\n" -"obligatoriskt för den motsvarande korta flaggan också. Motsvarande\n" -"för valfria argument.\n" - -#: src/getargs.c:206 -msgid "" -"Operation modes:\n" -" -h, --help display this help and exit\n" -" -V, --version output version information and exit\n" -" -y, --yacc emulate POSIX yacc\n" -msgstr "" -"Arbetslägen:\n" -" -h, --help visa denna hjälptext och avsluta\n" -" -V, --version visa versionsinformation och avsluta\n" -" -y, --yacc emulera POSIX-yacc\n" - -#: src/getargs.c:213 -msgid "" -"Parser:\n" -" -S, --skeleton=FILE specify the skeleton to use\n" -" -t, --debug instrument the parser for debugging\n" -" --locations enable locations computation\n" -" -p, --name-prefix=PREFIX prepend PREFIX to the external symbols\n" -" -l, --no-lines don't generate `#line' directives\n" -" -n, --no-parser generate the tables only\n" -" -k, --token-table include a table of token names\n" -msgstr "" -"Tolk:\n" -" -S, --skeleton=FIL ange skelettfilen som skall användas\n" -" -t, --debug instrumentera tolken för felsökning\n" -" --locations aktivera lägesberäkning\n" -" -p, --name-prefix=PREFIX lägg till PREFIX före externa symboler\n" -" -l, --no-lines generera inte \"#line\"-direktiv\n" -" -n, --no-parser generera endast tabellerna\n" -" -k, --token-table inkludera en tabell över elementnamn\n" - -#: src/getargs.c:225 -msgid "" -"Output:\n" -" -d, --defines also produce a header file\n" -" -r, --report=THINGS also produce details on the automaton\n" -" -v, --verbose same as `--report=state'\n" -" -b, --file-prefix=PREFIX specify a PREFIX for output files\n" -" -o, --output=FILE leave output to FILE\n" -" -g, --graph also produce a VCG description of the " -"automaton\n" -msgstr "" -"Utdata:\n" -" -d, --defines skapa också en huvudfil\n" -" -r, --report=SAKER skapa också detaljer om automaten\n" -" -v, --verbose samma som \"--report=state\"\n" -" -b, --file-prefix=PREFIX ange ett PREFIX för utdatafiler\n" -" -o, --output=FIL lägg utdata i FIL\n" -" -g, --graph skapa också en VCG-beskrivning av automaten\n" - -#: src/getargs.c:236 -msgid "" -"THINGS is a list of comma separated words that can include:\n" -" `state' describe the states\n" -" `itemset' complete the core item sets with their closure\n" -" `lookahead' explicitly associate lookaheads to items\n" -" `solved' describe shift/reduce conflicts solving\n" -" `all' include all the above information\n" -" `none' disable the report\n" -msgstr "" -"SAKER är en lista med kommaseparerade ord som kan innehålla:\n" -" \"state\" beskriv tillstånden\n" -" \"itemset\" komplettera kärnobjektmängderna med sina höljen\n" -" \"lookahead\" koppla uttryckligen framåtblickar till objekt\n" -" \"solved\" beskriv lösningar av skifta/reducerakonflikter\n" -" \"all\" inkludera all ovanstående information\n" -" \"none\" avaktivera rapporten\n" - -#: src/getargs.c:247 -msgid "Report bugs to .\n" -msgstr "" -"Rapportera fel till .\n" -"Rapportera synpunkter på översättningen till .\n" - -#: src/getargs.c:264 -#, c-format -msgid "bison (GNU Bison) %s" -msgstr "bison (GNU Bison) %s" - -#: src/getargs.c:266 -msgid "Written by Robert Corbett and Richard Stallman.\n" -msgstr "Skriven av Robert Corbett och Richard Stallman.\n" - -#: src/getargs.c:270 -#, c-format -msgid "Copyright (C) %d Free Software Foundation, Inc.\n" -msgstr "Copyright © %d Free Software Foundation, Inc.\n" - -#: src/getargs.c:272 -msgid "" -"This is free software; see the source for copying conditions. There is NO\n" -"warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n" -msgstr "" -"Detta är fri programvara, se källkoden för kopieringsvillkor. Det\n" -"finns INGEN garanti, inte ens för SÄLJBARHET eller LÄMPLIGHET FÖR ETT\n" -"SPECIELLT ÄNDAMÅL.\n" - -#: src/getargs.c:438 -#, c-format -msgid "missing operand after `%s'" -msgstr "saknad operand efter \"%s\"" - -#: src/getargs.c:440 -#, c-format -msgid "extra operand `%s'" -msgstr "extra operand \"%s\"" - -#: src/gram.c:139 -msgid "empty" -msgstr "tom" - -#: src/gram.c:233 -msgid "Grammar" -msgstr "Grammatik" - -#: src/gram.c:321 src/reduce.c:394 -msgid "warning" -msgstr "varning" - -#: src/main.c:124 -msgid "rule never reduced because of conflicts" -msgstr "regel aldrig reducerad på grund av konflikter" - -#: src/parse-gram.y:363 -msgid "POSIX forbids declarations in the grammar" -msgstr "POSIX förbjuder deklarationer i grammatiken" - -#: src/parse-gram.y:486 -msgid "missing identifier in parameter declaration" -msgstr "identiferare saknas i parameterdeklaration" - -#: src/print.c:49 -#, c-format -msgid " type %d is %s\n" -msgstr " typ %d är %s\n" - -#: src/print.c:165 -#, c-format -msgid "shift, and go to state %d\n" -msgstr "skifta, och gå till tillstånd %d\n" - -#: src/print.c:167 -#, c-format -msgid "go to state %d\n" -msgstr "gå till tillstånd %d\n" - -#: src/print.c:204 -msgid "error (nonassociative)\n" -msgstr "fel (ickeassociativ)\n" - -#: src/print.c:292 -#, c-format -msgid "reduce using rule %d (%s)" -msgstr "reducera med regel %d (%s)" - -#: src/print.c:294 -#, c-format -msgid "accept" -msgstr "acceptera" - -#: src/print.c:325 src/print.c:391 -msgid "$default" -msgstr "$standard" - -#: src/print.c:420 -#, c-format -msgid "state %d" -msgstr "tillstånd %d" - -#: src/print.c:456 -msgid "Terminals, with rules where they appear" -msgstr "Terminaler, med regler där de förekommer" - -#: src/print.c:483 -msgid "Nonterminals, with rules where they appear" -msgstr "Icketerminaler, med regler där de förekommer" - -#: src/print.c:512 -#, c-format -msgid " on left:" -msgstr " till vänster:" - -#: src/print.c:527 -#, c-format -msgid " on right:" -msgstr " till höger:" - -#: src/print.c:555 -msgid "Rules never reduced" -msgstr "Aldrig reducerade regler" - -#: src/reader.c:56 -#, c-format -msgid "multiple %s declarations" -msgstr "flera %s-deklarationer" - -#: src/reader.c:118 -#, c-format -msgid "result type clash on merge function %s: <%s> != <%s>" -msgstr "resultattypskonflikt vid sammanslagningsfunktion %s: <%s> != <%s>" - -#: src/reader.c:216 -#, c-format -msgid "rule given for %s, which is a token" -msgstr "regel given för %s, som är ett element" - -#: src/reader.c:245 -#, c-format -msgid "type clash on default action: <%s> != <%s>" -msgstr "typkonflikt för standardåtgärd: <%s> <%s>" - -#: src/reader.c:251 -msgid "empty rule for typed nonterminal, and no action" -msgstr "tom regel för typad icketerminal, och ingen åtgärd" - -#: src/reader.c:321 src/reader.c:335 src/reader.c:348 -#, c-format -msgid "only one %s allowed per rule" -msgstr "endast en %s tillåts per regel" - -#: src/reader.c:331 src/reader.c:346 -#, c-format -msgid "%s affects only GLR parsers" -msgstr "%s påverkar endast GLR-parsrar" - -#: src/reader.c:333 -#, c-format -msgid "%s must be followed by positive number" -msgstr "%s måste följas av ett positivt tal" - -#: src/reader.c:490 -msgid "no rules in the input grammar" -msgstr "inga regler i ingrammatiken" - -#: src/reduce.c:242 -msgid "useless rule" -msgstr "oanvändbar regel" - -#: src/reduce.c:303 -#, c-format -msgid "useless nonterminal: %s" -msgstr "oanvändbar icketerminal: %s" - -#: src/reduce.c:351 -msgid "Useless nonterminals" -msgstr "Oanvändbara icketerminaler" - -#: src/reduce.c:364 -msgid "Terminals which are not used" -msgstr "Terminaler som inte används" - -#: src/reduce.c:373 -msgid "Useless rules" -msgstr "Oanvändbara regler" - -#: src/reduce.c:389 -#, c-format -msgid "%d rule never reduced\n" -msgid_plural "%d rules never reduced\n" -msgstr[0] "%d regel reduceras aldrig\n" -msgstr[1] "%d regler reduceras aldrig\n" - -#: src/reduce.c:397 -#, c-format -msgid "%d useless nonterminal" -msgid_plural "%d useless nonterminals" -msgstr[0] "%d oanvändbar icketerminal" -msgstr[1] "%d oanvändbara icketerminaler" - -#: src/reduce.c:403 -#, c-format -msgid " and " -msgstr " och " - -#: src/reduce.c:406 -#, c-format -msgid "%d useless rule" -msgid_plural "%d useless rules" -msgstr[0] "%d oanvändbar regel" -msgstr[1] "%d oanvändbara regler" - -#: src/reduce.c:436 -#, c-format -msgid "start symbol %s does not derive any sentence" -msgstr "startsymbolen %s genererar inga meningar" - -#: src/scan-gram.l:162 -msgid "stray `,' treated as white space" -msgstr "vilsekommet \",\" hanterat som blank" - -#: src/scan-gram.l:225 -#, c-format -msgid "invalid directive: %s" -msgstr "ogiltigt direktiv: %s" - -#: src/scan-gram.l:283 -#, c-format -msgid "invalid character: %s" -msgstr "ogiltigt tecken: %s" - -#: src/scan-gram.l:402 -#, fuzzy -msgid "invalid null character" -msgstr "ogiltigt tecken: %s" - -#: src/scan-gram.l:415 src/scan-gram.l:427 src/scan-gram.l:448 -#, c-format -msgid "invalid escape sequence: %s" -msgstr "ogiltig specialsekvens: %s" - -#: src/scan-gram.l:417 src/scan-gram.l:429 src/scan-gram.l:450 -#, fuzzy, c-format -msgid "invalid null character: %s" -msgstr "ogiltigt tecken: %s" - -#: src/scan-gram.l:455 -#, c-format -msgid "unrecognized escape sequence: %s" -msgstr "okänd specialsekvens: %s" - -#: src/scan-gram.l:537 -#, c-format -msgid "missing `{' in `%s'" -msgstr "saknad \"{\" i \"%s\"" - -#: src/scan-gram.l:782 -#, c-format -msgid "$$ of `%s' has no declared type" -msgstr "$$ för \"%s\" har ingen deklarerad typ" - -#: src/scan-gram.l:803 -#, c-format -msgid "$%d of `%s' has no declared type" -msgstr "$%d för \"%s\" har ingen deklarerad typ" - -#: src/scan-gram.l:812 src/scan-gram.l:881 src/scan-gram.l:932 -#, c-format -msgid "integer out of range: %s" -msgstr "heltal utanför intervall: %s" - -#: src/scan-gram.l:848 src/scan-gram.l:916 -#, c-format -msgid "invalid value: %s" -msgstr "felaktigt värde: %s" - -#: src/scan-gram.l:1036 -#, c-format -msgid "missing `%s' at end of file" -msgstr "saknat \"%s\" vid filslut" - -#: src/scan-gram.l:1047 -#, fuzzy, c-format -msgid "missing `%s' at end of line" -msgstr "saknat \"%s\" vid filslut" - -#: src/symlist.c:97 src/symlist.c:108 -msgid "invalid $ value" -msgstr "felaktigt $-värde" - -#: src/symtab.c:85 -#, c-format -msgid "type redeclaration for %s" -msgstr "typen omdeklarerad för %s" - -#: src/symtab.c:102 src/symtab.c:120 -#, c-format -msgid "%s redeclaration for %s" -msgstr "%s-omdeklaration för %s" - -#: src/symtab.c:139 -#, c-format -msgid "redefining precedence of %s" -msgstr "omdefinition av precedens för %s" - -#: src/symtab.c:157 -#, c-format -msgid "symbol %s redefined" -msgstr "symbolen %s omdefinierad" - -#: src/symtab.c:180 -#, c-format -msgid "redefining user token number of %s" -msgstr "omdefinition av elementnummer för %s" - -#: src/symtab.c:207 -#, c-format -msgid "symbol %s is used, but is not defined as a token and has no rules" -msgstr "" -"symbolen %s används, men är inte definierad som ett element och har inga " -"regler" - -#: src/symtab.c:232 -#, c-format -msgid "symbol `%s' used more than once as a literal string" -msgstr "symbolen \"%s\" används mer än en gång som en bokstavlig sträng" - -#: src/symtab.c:235 -#, c-format -msgid "symbol `%s' given more than one literal string" -msgstr "symbolen \"%s\" har fått mer än en bokstavlig sträng" - -#: src/symtab.c:271 -#, c-format -msgid "conflicting precedences for %s and %s" -msgstr "motstridiga precedenser mellan %s och %s" - -#: src/symtab.c:283 -#, c-format -msgid "conflicting associativities for %s (%s) and %s (%s)" -msgstr "motstridiga associativiteter för %s (%s) och %s (%s)" - -#: src/symtab.c:368 -#, c-format -msgid "tokens %s and %s both assigned number %d" -msgstr "elementen %s och %s har båda fått nummer %d" - -#: src/symtab.c:591 -#, c-format -msgid "the start symbol %s is undefined" -msgstr "startsymbolen %s är odefinierad" - -#: src/symtab.c:595 -#, c-format -msgid "the start symbol %s is a token" -msgstr "startsymbolen %s är ett element" - -#: lib/argmatch.c:133 -#, c-format -msgid "invalid argument %s for %s" -msgstr "ogiltigt argument %s till %s" - -#: lib/argmatch.c:134 -#, c-format -msgid "ambiguous argument %s for %s" -msgstr "tvetydigt argument %s till %s" - -#: lib/argmatch.c:153 -#, c-format -msgid "Valid arguments are:" -msgstr "Giltiga argument är:" - -#: lib/bitset_stats.c:179 -#, c-format -msgid "%u bitset_allocs, %u freed (%.2f%%).\n" -msgstr "%u bitmängdallokeringar, %u frianden (%.2f%%).\n" - -#: lib/bitset_stats.c:182 -#, c-format -msgid "%u bitset_sets, %u cached (%.2f%%)\n" -msgstr "%u bitmängdmängder, %u cachade (%.2f%%)\n" - -#: lib/bitset_stats.c:185 -#, c-format -msgid "%u bitset_resets, %u cached (%.2f%%)\n" -msgstr "%u bitmängdåterställanden, %u cachade (%.2f%%)\n" - -#: lib/bitset_stats.c:188 -#, c-format -msgid "%u bitset_tests, %u cached (%.2f%%)\n" -msgstr "%u bitmängdtester, %u cachade (%.2f%%)\n" - -#: lib/bitset_stats.c:192 -#, c-format -msgid "%u bitset_lists\n" -msgstr "%u bitmängdlistor\n" - -#: lib/bitset_stats.c:194 -msgid "count log histogram\n" -msgstr "anropslogghistogram\n" - -#: lib/bitset_stats.c:197 -msgid "size log histogram\n" -msgstr "storlekslogghistogram\n" - -#: lib/bitset_stats.c:200 -msgid "density histogram\n" -msgstr "densitetshistogram\n" - -#: lib/bitset_stats.c:214 -#, c-format -msgid "" -"Bitset statistics:\n" -"\n" -msgstr "" -"Bitmängdsstatistik:\n" -"\n" - -#: lib/bitset_stats.c:217 -#, c-format -msgid "Accumulated runs = %u\n" -msgstr "Ackumulerade körningar = %u\n" - -#: lib/bitset_stats.c:261 lib/bitset_stats.c:266 -msgid "Could not read stats file." -msgstr "Kunde inte läsa statistikfil." - -#: lib/bitset_stats.c:263 -#, c-format -msgid "Bad stats file size.\n" -msgstr "Dålig statistikfilstorlek.\n" - -#: lib/bitset_stats.c:289 lib/bitset_stats.c:291 -msgid "Could not write stats file." -msgstr "Kunde inte skriva statistikfil." - -#: lib/bitset_stats.c:294 -msgid "Could not open stats file for writing." -msgstr "Kunde inte öppna statistikfil för skrivning." - -#: lib/error.c:127 -msgid "Unknown system error" -msgstr "Okänt systemfel" - -#: lib/getopt.c:570 lib/getopt.c:589 -#, c-format -msgid "%s: option `%s' is ambiguous\n" -msgstr "%s: flaggan \"%s\" är tvetydig\n" - -#: lib/getopt.c:622 lib/getopt.c:626 -#, c-format -msgid "%s: option `--%s' doesn't allow an argument\n" -msgstr "%s: flaggan \"--%s\" tar inget argument\n" - -#: lib/getopt.c:635 lib/getopt.c:640 -#, c-format -msgid "%s: option `%c%s' doesn't allow an argument\n" -msgstr "%s: flaggan \"%c%s\" tar inget argument\n" - -#: lib/getopt.c:686 lib/getopt.c:708 lib/getopt.c:1039 lib/getopt.c:1061 -#, c-format -msgid "%s: option `%s' requires an argument\n" -msgstr "%s: flaggan \"%s\" behöver ett argument\n" - -#: lib/getopt.c:746 lib/getopt.c:749 -#, c-format -msgid "%s: unrecognized option `--%s'\n" -msgstr "%s: okänd flagga \"--%s\"\n" - -#: lib/getopt.c:757 lib/getopt.c:760 -#, c-format -msgid "%s: unrecognized option `%c%s'\n" -msgstr "%s: okänd flagga \"%c%s\"\n" - -#: lib/getopt.c:815 lib/getopt.c:818 -#, c-format -msgid "%s: illegal option -- %c\n" -msgstr "%s: otillåten flagga -- %c\n" - -#: lib/getopt.c:824 lib/getopt.c:827 -#, c-format -msgid "%s: invalid option -- %c\n" -msgstr "%s: ogiltig flagga --%c\n" - -#: lib/getopt.c:882 lib/getopt.c:901 lib/getopt.c:1114 lib/getopt.c:1135 -#, c-format -msgid "%s: option requires an argument -- %c\n" -msgstr "%s: flaggan behöver ett argument -- %c\n" - -#: lib/getopt.c:954 lib/getopt.c:973 -#, c-format -msgid "%s: option `-W %s' is ambiguous\n" -msgstr "%s: flaggan \"-W %s\" är tvetydig\n" - -#: lib/getopt.c:997 lib/getopt.c:1018 -#, c-format -msgid "%s: option `-W %s' doesn't allow an argument\n" -msgstr "%s: flaggan \"-W %s\" tar inget argument\n" - -#: lib/obstack.c:417 lib/obstack.c:420 lib/xmalloc.c:53 -msgid "memory exhausted" -msgstr "minnet slut" - -# När vi går över till Unicode mer allmänt kanske vi bör översätta båda dessa -# med U+201D (RIGHT DOUBLE QUOTATION MARK) på svenska. Eller? -# -#: lib/quotearg.c:238 -msgid "`" -msgstr "\"" - -#: lib/quotearg.c:239 -msgid "'" -msgstr "\"" - -#: lib/subpipe.c:171 -#, c-format -msgid "subsidiary program `%s' could not be invoked" -msgstr "underprogram \"%s\" kunde inte köras" - -#: lib/subpipe.c:173 -#, c-format -msgid "subsidiary program `%s' not found" -msgstr "underprogram \"%s\" hittades inte" - -#: lib/subpipe.c:175 -#, c-format -msgid "subsidiary program `%s' failed" -msgstr "underprogram \"%s\" misslyckades" - -#: lib/subpipe.c:176 -#, c-format -msgid "subsidiary program `%s' failed (exit status %d)" -msgstr "underprogram \"%s\" misslyckades (slutstatus %d)" - -#: lib/timevar.c:475 -msgid "" -"\n" -"Execution times (seconds)\n" -msgstr "" -"\n" -"Exekveringstider (sekunder)\n" - -#: lib/timevar.c:525 -msgid " TOTAL :" -msgstr " TOTALT :" - -#: lib/timevar.c:561 -#, c-format -msgid "time in %s: %ld.%06ld (%ld%%)\n" -msgstr "tid i %s: %ld.%06ld (%ld%%)\n" diff --git a/src/bin/bison/po/tr.gmo b/src/bin/bison/po/tr.gmo deleted file mode 100644 index ce722313fb..0000000000 Binary files a/src/bin/bison/po/tr.gmo and /dev/null differ diff --git a/src/bin/bison/po/tr.po b/src/bin/bison/po/tr.po deleted file mode 100644 index 02bf31c3bf..0000000000 --- a/src/bin/bison/po/tr.po +++ /dev/null @@ -1,928 +0,0 @@ -# Turkish translations for GNU Bison messages. -# Copyright (C) 2001 Free Software Foundation, Inc. -# Altuð Bayram , 2001. -# Çaðrý Çöltekin , 2003 -# -msgid "" -msgstr "" -"Project-Id-Version: bison 1.875a\n" -"Report-Msgid-Bugs-To: bug-bison@gnu.org\n" -"POT-Creation-Date: 2004-05-21 10:26-0700\n" -"PO-Revision-Date: 2003-11-08 22:00+0100\n" -"Last-Translator: Çaðrý Çöltekin \n" -"Language-Team: Turkish \n" -"MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=ISO-8859-9\n" -"Content-Transfer-Encoding: 8bit\n" -"Plural-Forms: nplurals=1; plural=0;\n" - -#: src/complain.c:51 src/complain.c:66 -msgid "warning: " -msgstr "uyarý: " - -#: src/complain.c:122 src/complain.c:138 -msgid "fatal error: " -msgstr "ölümcül hata:" - -#: src/conflicts.c:76 -#, c-format -msgid " Conflict between rule %d and token %s resolved as shift" -msgstr " %d durumu %s andacý arasýndaki çeliþki kaydýrýlarak çözümlendi" - -#: src/conflicts.c:84 -#, c-format -msgid " Conflict between rule %d and token %s resolved as reduce" -msgstr " %d durumu %s andacý arasýndaki çeliþki indirgenerek çözümlendi" - -#: src/conflicts.c:91 -#, c-format -msgid " Conflict between rule %d and token %s resolved as an error" -msgstr " %d durumu %s andacý arasýndaki çeliþki hata olarak çözümlendi" - -#: src/conflicts.c:399 -#, c-format -msgid "conflicts: %d shift/reduce, %d reduce/reduce\n" -msgstr "çeliþkiler: %d öteleme/indirgeme, %d indirgeme/indirgeme\n" - -#: src/conflicts.c:402 -#, c-format -msgid "conflicts: %d shift/reduce\n" -msgstr "çeliþkiler: %d öteleme/indirgeme\n" - -#: src/conflicts.c:404 -#, c-format -msgid "conflicts: %d reduce/reduce\n" -msgstr "çeliþkiler: %d indirgeme/indirgeme\n" - -#: src/conflicts.c:422 -#, c-format -msgid "State %d " -msgstr "Durum %d " - -#: src/conflicts.c:487 -#, fuzzy, c-format -msgid "%%expect-rr applies only to GLR parsers" -msgstr "%s sadece GLR ayrýþtýrýcýlarý etkiler" - -#: src/conflicts.c:511 -#, c-format -msgid "expected %d shift/reduce conflict" -msgid_plural "expected %d shift/reduce conflicts" -msgstr[0] "beklenen %d öteleme/indirgeme çeliþkisi" -msgstr[1] "beklenen %d öteleme/indirgeme çeliþkisi" - -#: src/conflicts.c:515 -#, fuzzy, c-format -msgid "expected %d reduce/reduce conflict" -msgid_plural "expected %d reduce/reduce conflicts" -msgstr[0] "0 indirgeme/indirgeme çeliþkisi bekleniyor" - -#: src/files.c:100 -#, c-format -msgid "cannot open file `%s'" -msgstr "`%s' dosyasý açýlamýyor" - -#: src/files.c:116 -msgid "I/O error" -msgstr "G/Ç hatasý" - -#: src/files.c:119 -msgid "cannot close file" -msgstr "dosya kapatýlamýyor" - -#: src/files.c:337 -#, c-format -msgid "conflicting outputs to file %s" -msgstr "%s dosyasýna çeliþen çýktýlar" - -#: src/getargs.c:186 -#, c-format -msgid "Try `%s --help' for more information.\n" -msgstr "Daha fazla bilgi için `%s --help' yazýn.\n" - -#: src/getargs.c:192 -msgid "GNU bison generates parsers for LALR(1) grammars.\n" -msgstr "GNU bison LALR(1) gramerler için ayrýþtýrýcýlar üretir.\n" - -#: src/getargs.c:196 -#, c-format -msgid "Usage: %s [OPTION]... FILE\n" -msgstr "Kullaným: %s [SEÇENEK]... DOSYA\n" - -#: src/getargs.c:200 -msgid "" -"If a long option shows an argument as mandatory, then it is mandatory\n" -"for the equivalent short option also. Similarly for optional arguments.\n" -msgstr "" -"Eðer bir uzun seçenek bir argümaný gerektirirse, bu gereklilik, denk olan " -"kýsa\n" -"seçenek için de geçerlidir. Bu durum, seçimli argümanlar için de " -"geçerlidir.\n" - -#: src/getargs.c:206 -msgid "" -"Operation modes:\n" -" -h, --help display this help and exit\n" -" -V, --version output version information and exit\n" -" -y, --yacc emulate POSIX yacc\n" -msgstr "" -"Çalýþma kipleri:\n" -" -h, --help bu yardýmý göster ve çýk\n" -" -V, --version sürüm bilgisini ver ve çýk\n" -" -y, --yacc POSIX yacc öykünmesi\n" - -#: src/getargs.c:213 -msgid "" -"Parser:\n" -" -S, --skeleton=FILE specify the skeleton to use\n" -" -t, --debug instrument the parser for debugging\n" -" --locations enable locations computation\n" -" -p, --name-prefix=PREFIX prepend PREFIX to the external symbols\n" -" -l, --no-lines don't generate `#line' directives\n" -" -n, --no-parser generate the tables only\n" -" -k, --token-table include a table of token names\n" -msgstr "" -"Ayrýþtýrýcý:\n" -" -S, --skeleton=FILE kullanýlacak iskeleti belirt\n" -" -t, --debug ayrýþtýrýcýya hata ayýklayýcý ekle\n" -" --locations konum hesaplamalarýný etkinleþtir\n" -" -p, --name-prefix=ÖNEK dýþ simgelerin baþýna ÖNEK ekle\n" -" -l, --no-lines `#line' yönergelerini üretme\n" -" -n, --no-parser sadece tablolarý üret\n" -" -k, --token-table andaç isimlerinin bir tablosunu içer\n" - -#: src/getargs.c:225 -msgid "" -"Output:\n" -" -d, --defines also produce a header file\n" -" -r, --report=THINGS also produce details on the automaton\n" -" -v, --verbose same as `--report=state'\n" -" -b, --file-prefix=PREFIX specify a PREFIX for output files\n" -" -o, --output=FILE leave output to FILE\n" -" -g, --graph also produce a VCG description of the " -"automaton\n" -msgstr "" -"Çýktý:\n" -" -d, --defines bir baþlýk dosyasý da üret\n" -" -r, --report=SEÇENEKLER otomatta ayrýntýlý bilgi de göster\n" -" -v, --verbose otomatýn bir açýklamasýný da üret\n" -" -b, --file-prefix=ÖNEK çýktý dosyalarý için bir ÖNEK belir\n" -" -o, --output=DOSYA çýktýyý DOSYAya yaz\n" -" -g, --graph otomatýn bir VCG grafik açýklamasýný da üret\n" - -# DUZELT: cevrilmemis iki mesaj var -#: src/getargs.c:236 -msgid "" -"THINGS is a list of comma separated words that can include:\n" -" `state' describe the states\n" -" `itemset' complete the core item sets with their closure\n" -" `lookahead' explicitly associate lookaheads to items\n" -" `solved' describe shift/reduce conflicts solving\n" -" `all' include all the above information\n" -" `none' disable the report\n" -msgstr "" -"SEÇENEKLER aþaðýdaki anhtar sözcüklerden virgülle ayýrarak oluþturulabilir:\n" -" `state' durumlarý açýkla\n" -" `itemset' complete the core item sets with their closure\n" -" `lookahead' explicitly associate lookaheads to items\n" -" `solved' öteleme/indigerme çeliþkilerinin çözümünü açýkla\n" -" `all' yukarýdaki bilgilerini tümünü gosterir\n" -" `none' raporu üretme\n" - -#: src/getargs.c:247 -msgid "Report bugs to .\n" -msgstr "" -"Hatalarý 'a,\n" -"çeviri hatalarýný 'e bildir.\n" - -#: src/getargs.c:264 -#, c-format -msgid "bison (GNU Bison) %s" -msgstr "bison (GNU Bison) %s" - -#: src/getargs.c:266 -msgid "Written by Robert Corbett and Richard Stallman.\n" -msgstr "Yazanlar: Robert Corbett ve Richard Stallman.\n" - -#: src/getargs.c:270 -#, c-format -msgid "Copyright (C) %d Free Software Foundation, Inc.\n" -msgstr "Telif Hakký (C) %d Free Software Foundation, Inc.\n" - -#: src/getargs.c:272 -msgid "" -"This is free software; see the source for copying conditions. There is NO\n" -"warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n" -msgstr "" -"Bu bir serbest yazýlýmdýr; kopyalama koþullarý için kaynak koduna bakýnýz.\n" -"Hiçbir garantisi yoktur; hatta SATILABÝLÝRLÝÐÝ veya ÞAHSÝ KULLANIMINIZA\n" -"UYGUNLUÐU için bile garanti verilmez.\n" - -#: src/getargs.c:438 -#, c-format -msgid "missing operand after `%s'" -msgstr "`%s'ten sonra eksik iþleç" - -#: src/getargs.c:440 -#, c-format -msgid "extra operand `%s'" -msgstr "fazla iþleç: `%s'" - -#: src/gram.c:139 -msgid "empty" -msgstr "boþ" - -#: src/gram.c:233 -msgid "Grammar" -msgstr "Gramer" - -#: src/gram.c:321 src/reduce.c:394 -msgid "warning" -msgstr "uyarý" - -#: src/main.c:124 -msgid "rule never reduced because of conflicts" -msgstr "çeliskiler yüzünden kural indirgenemedi" - -#: src/parse-gram.y:363 -msgid "POSIX forbids declarations in the grammar" -msgstr "Gramer içindeki bildirimler POSIX'e uygun deðildir" - -#: src/parse-gram.y:486 -msgid "missing identifier in parameter declaration" -msgstr "parametre bildiriminde eksik tanýtýcý" - -#: src/print.c:49 -#, c-format -msgid " type %d is %s\n" -msgstr " tip %d %s'dir\n" - -#: src/print.c:165 -#, c-format -msgid "shift, and go to state %d\n" -msgstr "ötele, ve durum %d'ye git\n" - -#: src/print.c:167 -#, c-format -msgid "go to state %d\n" -msgstr "durum %d'ye git\n" - -#: src/print.c:204 -msgid "error (nonassociative)\n" -msgstr "hata (birleþmeli deðil)\n" - -#: src/print.c:292 -#, c-format -msgid "reduce using rule %d (%s)" -msgstr "kural %d (%s) ile indirgeme" - -#: src/print.c:294 -#, c-format -msgid "accept" -msgstr "onayla" - -#: src/print.c:325 src/print.c:391 -msgid "$default" -msgstr "$öntanýmlý" - -#: src/print.c:420 -#, c-format -msgid "state %d" -msgstr "durum %d" - -#: src/print.c:456 -msgid "Terminals, with rules where they appear" -msgstr "Sabit simgeler, içinde geçtikleri kurallarla birlikte" - -#: src/print.c:483 -msgid "Nonterminals, with rules where they appear" -msgstr "Deðiþken simgeler, içinde geçtikleri kurallarla birlikte" - -#: src/print.c:512 -#, c-format -msgid " on left:" -msgstr " (sol tarafta):" - -#: src/print.c:527 -#, c-format -msgid " on right:" -msgstr " (sað tarafta):" - -#: src/print.c:555 -msgid "Rules never reduced" -msgstr "Hiç indirgenmeyen kurallar" - -#: src/reader.c:56 -#, c-format -msgid "multiple %s declarations" -msgstr "çoklu %s bildirimleri" - -#: src/reader.c:118 -#, c-format -msgid "result type clash on merge function %s: <%s> != <%s>" -msgstr "birleþtirme iþlevi `%s'de tip çatýþmasý: <%s> != <%s>" - -#: src/reader.c:216 -#, c-format -msgid "rule given for %s, which is a token" -msgstr "bir andaç olan %s için kural verilmiþ" - -#: src/reader.c:245 -#, c-format -msgid "type clash on default action: <%s> != <%s>" -msgstr "öntanýmlý eylem üzerinde tip çatýþmasý: `%s' != `%s'" - -#: src/reader.c:251 -msgid "empty rule for typed nonterminal, and no action" -msgstr "" -"Tipli deðiþken simge için boþ kural tanýmlanmýþ, ve eylem belirtilmemiþ" - -#: src/reader.c:321 src/reader.c:335 src/reader.c:348 -#, c-format -msgid "only one %s allowed per rule" -msgstr "her kural icin sadece bir %s kullanýlabilir" - -#: src/reader.c:331 src/reader.c:346 -#, c-format -msgid "%s affects only GLR parsers" -msgstr "%s sadece GLR ayrýþtýrýcýlarý etkiler" - -#: src/reader.c:333 -#, c-format -msgid "%s must be followed by positive number" -msgstr "%s'i pozitif bir sayý izlemeli" - -#: src/reader.c:490 -msgid "no rules in the input grammar" -msgstr "girdi gramer içinde kural yok" - -#: src/reduce.c:242 -msgid "useless rule" -msgstr "gereksiz kural" - -#: src/reduce.c:303 -#, c-format -msgid "useless nonterminal: %s" -msgstr "gereksiz deðiþken simge: %s" - -#: src/reduce.c:351 -msgid "Useless nonterminals" -msgstr "Gereksiz deðiþken simgeler" - -#: src/reduce.c:364 -msgid "Terminals which are not used" -msgstr "Kullanýlmayan sabit simgeler" - -#: src/reduce.c:373 -msgid "Useless rules" -msgstr "Gereksiz kurallar" - -#: src/reduce.c:389 -#, c-format -msgid "%d rule never reduced\n" -msgid_plural "%d rules never reduced\n" -msgstr[0] "%d kural hiç indirgenmedi\n" -msgstr[1] "%d kural hiç indirgenmedi\n" - -#: src/reduce.c:397 -#, c-format -msgid "%d useless nonterminal" -msgid_plural "%d useless nonterminals" -msgstr[0] "%d gereksiz deðiþken simge" -msgstr[1] "%d gereksiz deðiþken simge" - -#: src/reduce.c:403 -#, c-format -msgid " and " -msgstr " ve " - -#: src/reduce.c:406 -#, c-format -msgid "%d useless rule" -msgid_plural "%d useless rules" -msgstr[0] "%d gereksiz kural" -msgstr[1] "%d gereksiz kural" - -#: src/reduce.c:436 -#, c-format -msgid "start symbol %s does not derive any sentence" -msgstr "baþlangýç simgesi %s herhangi bir cümleden türemiyor" - -#: src/scan-gram.l:162 -msgid "stray `,' treated as white space" -msgstr "fazladan `,' boþluk olarak algýlandý" - -#: src/scan-gram.l:225 -#, c-format -msgid "invalid directive: %s" -msgstr "geçersiz yönerge: %s" - -#: src/scan-gram.l:283 -#, c-format -msgid "invalid character: %s" -msgstr "geçersiz karakter: %s" - -#: src/scan-gram.l:402 -#, fuzzy -msgid "invalid null character" -msgstr "geçersiz karakter: %s" - -#: src/scan-gram.l:415 src/scan-gram.l:427 src/scan-gram.l:448 -#, c-format -msgid "invalid escape sequence: %s" -msgstr "geçersiz önceleme dizgesi: %s" - -#: src/scan-gram.l:417 src/scan-gram.l:429 src/scan-gram.l:450 -#, fuzzy, c-format -msgid "invalid null character: %s" -msgstr "geçersiz karakter: %s" - -#: src/scan-gram.l:455 -#, c-format -msgid "unrecognized escape sequence: %s" -msgstr "tanýnmayan önceleme dizgesi: %s" - -#: src/scan-gram.l:537 -#, c-format -msgid "missing `{' in `%s'" -msgstr "`%s' içinde eksik `{'" - -#: src/scan-gram.l:782 -#, c-format -msgid "$$ of `%s' has no declared type" -msgstr "`%s''in $$'ý için bildirilmiþ tip yok" - -#: src/scan-gram.l:803 -#, c-format -msgid "$%d of `%s' has no declared type" -msgstr "`%2$s''in %1$d'i için bildirilmiþ tip yok" - -#: src/scan-gram.l:812 src/scan-gram.l:881 src/scan-gram.l:932 -#, c-format -msgid "integer out of range: %s" -msgstr "tam sayý kapsam dýþý: %s" - -#: src/scan-gram.l:848 src/scan-gram.l:916 -#, c-format -msgid "invalid value: %s" -msgstr "geçersiz deðer: %s" - -#: src/scan-gram.l:1036 -#, c-format -msgid "missing `%s' at end of file" -msgstr "dosyanýn sonunda eksik `%s'" - -#: src/scan-gram.l:1047 -#, fuzzy, c-format -msgid "missing `%s' at end of line" -msgstr "dosyanýn sonunda eksik `%s'" - -#: src/symlist.c:97 src/symlist.c:108 -msgid "invalid $ value" -msgstr "geçersiz $ deðeri" - -#: src/symtab.c:85 -#, c-format -msgid "type redeclaration for %s" -msgstr "%s için tekrar tip bildirimi" - -#: src/symtab.c:102 src/symtab.c:120 -#, c-format -msgid "%s redeclaration for %s" -msgstr "%2$s için tekrar %1$s bildirimi" - -#: src/symtab.c:139 -#, c-format -msgid "redefining precedence of %s" -msgstr "%s'in önceliði tekrar tanýmlanýyor" - -#: src/symtab.c:157 -#, c-format -msgid "symbol %s redefined" -msgstr "%s simgesi tekrar tanýmlanmýþ" - -#: src/symtab.c:180 -#, c-format -msgid "redefining user token number of %s" -msgstr "kullanýcý andacý %s tekrar tanýmlanýyor" - -#: src/symtab.c:207 -#, c-format -msgid "symbol %s is used, but is not defined as a token and has no rules" -msgstr "" -"simge %s kullanýlmýþ, fakat andaç olarak tanýmlanmamýþ ve kurallarý yok" - -#: src/symtab.c:232 -#, c-format -msgid "symbol `%s' used more than once as a literal string" -msgstr "simge `%s', yalýn dizge olarak birden fazla kullanýlmýþ" - -#: src/symtab.c:235 -#, c-format -msgid "symbol `%s' given more than one literal string" -msgstr "simge `%s', birden fazla yalýn dizgeye atanmýþ" - -#: src/symtab.c:271 -#, c-format -msgid "conflicting precedences for %s and %s" -msgstr "%s ve %s için çeliþen öncelikler" - -#: src/symtab.c:283 -#, c-format -msgid "conflicting associativities for %s (%s) and %s (%s)" -msgstr "%s (%s) ve %s (%s) için çeliþen birleþmeli deðerler" - -#: src/symtab.c:368 -#, c-format -msgid "tokens %s and %s both assigned number %d" -msgstr "%s ve %s andaçlarýnýn her ikisi %d sayýsýna atandmýþ" - -#: src/symtab.c:591 -#, c-format -msgid "the start symbol %s is undefined" -msgstr "baþlangýç simgesi %s tanýmlanmamýþ" - -#: src/symtab.c:595 -#, c-format -msgid "the start symbol %s is a token" -msgstr "baþlangýç simgesi %s bir andaç" - -#: lib/argmatch.c:133 -#, c-format -msgid "invalid argument %s for %s" -msgstr "geçersiz argüman: %2$s için %1$s" - -#: lib/argmatch.c:134 -#, c-format -msgid "ambiguous argument %s for %s" -msgstr "%s argümaný, %s için belirsiz" - -#: lib/argmatch.c:153 -#, c-format -msgid "Valid arguments are:" -msgstr "Geçerli argümanlar:" - -#: lib/bitset_stats.c:179 -#, c-format -msgid "%u bitset_allocs, %u freed (%.2f%%).\n" -msgstr "%u bitset_allocs, %u serbest býrakýlan (%.2f%%).\n" - -#: lib/bitset_stats.c:182 -#, c-format -msgid "%u bitset_sets, %u cached (%.2f%%)\n" -msgstr "%u bitset_sets, %u önbellek kullanýmý (%.2f%%)\n" - -#: lib/bitset_stats.c:185 -#, c-format -msgid "%u bitset_resets, %u cached (%.2f%%)\n" -msgstr "%u bitset_resets, %u önbellek kullanýmý (%.2f%%)\n" - -#: lib/bitset_stats.c:188 -#, c-format -msgid "%u bitset_tests, %u cached (%.2f%%)\n" -msgstr "%u bitset_tests, %u önbellek kullanýmý (%.2f%%)\n" - -#: lib/bitset_stats.c:192 -#, c-format -msgid "%u bitset_lists\n" -msgstr "%u bitset_lists\n" - -#: lib/bitset_stats.c:194 -msgid "count log histogram\n" -msgstr "sayý histogramý\n" - -#: lib/bitset_stats.c:197 -msgid "size log histogram\n" -msgstr "büyükük histogramý\n" - -#: lib/bitset_stats.c:200 -msgid "density histogram\n" -msgstr "yogunluk histogramý\n" - -#: lib/bitset_stats.c:214 -#, c-format -msgid "" -"Bitset statistics:\n" -"\n" -msgstr "" -"Bitset istatistikleri:\n" -"\n" - -#: lib/bitset_stats.c:217 -#, c-format -msgid "Accumulated runs = %u\n" -msgstr "Toplam çalýþtýrýlan = %u\n" - -#: lib/bitset_stats.c:261 lib/bitset_stats.c:266 -msgid "Could not read stats file." -msgstr "Ýstatistik dosyasý okunamadý." - -#: lib/bitset_stats.c:263 -#, c-format -msgid "Bad stats file size.\n" -msgstr "Ýstatistik dosyasý büyüklüðü yanlýþ.\n" - -#: lib/bitset_stats.c:289 lib/bitset_stats.c:291 -msgid "Could not write stats file." -msgstr "Ýstatistik dosyasýna yazýlamadý." - -#: lib/bitset_stats.c:294 -msgid "Could not open stats file for writing." -msgstr "Ýstatistik dosyasý yazmak için açýlamadý." - -#: lib/error.c:127 -msgid "Unknown system error" -msgstr "Bilinmeyen sistem hatasý" - -#: lib/getopt.c:570 lib/getopt.c:589 -#, c-format -msgid "%s: option `%s' is ambiguous\n" -msgstr "%s: `%s' seçeneði belirsiz\n" - -#: lib/getopt.c:622 lib/getopt.c:626 -#, c-format -msgid "%s: option `--%s' doesn't allow an argument\n" -msgstr "%s: `--%s' seçeneði argümansýz kullanýlýr\n" - -#: lib/getopt.c:635 lib/getopt.c:640 -#, c-format -msgid "%s: option `%c%s' doesn't allow an argument\n" -msgstr "%s: seçenek `%c%s' argümansýz kullanýlýr\n" - -#: lib/getopt.c:686 lib/getopt.c:708 lib/getopt.c:1039 lib/getopt.c:1061 -#, c-format -msgid "%s: option `%s' requires an argument\n" -msgstr "%s: `%s' seçeneði bir argümanla kullanýlýr\n" - -#: lib/getopt.c:746 lib/getopt.c:749 -#, c-format -msgid "%s: unrecognized option `--%s'\n" -msgstr "%s: `--%s' seçeneði bilinmiyor\n" - -#: lib/getopt.c:757 lib/getopt.c:760 -#, c-format -msgid "%s: unrecognized option `%c%s'\n" -msgstr "%s: `%c%s' seçeneði bilinmiyor\n" - -#: lib/getopt.c:815 lib/getopt.c:818 -#, c-format -msgid "%s: illegal option -- %c\n" -msgstr "%s: kural dýþý seçenek -- %c\n" - -#: lib/getopt.c:824 lib/getopt.c:827 -#, c-format -msgid "%s: invalid option -- %c\n" -msgstr "%s: geçersiz seçenek -- %c\n" - -#: lib/getopt.c:882 lib/getopt.c:901 lib/getopt.c:1114 lib/getopt.c:1135 -#, c-format -msgid "%s: option requires an argument -- %c\n" -msgstr "%s: seçenek bir argümanla kullanýlýr -- %c\n" - -#: lib/getopt.c:954 lib/getopt.c:973 -#, c-format -msgid "%s: option `-W %s' is ambiguous\n" -msgstr "%s: `-W %s' seçeneði belirsiz\n" - -#: lib/getopt.c:997 lib/getopt.c:1018 -#, c-format -msgid "%s: option `-W %s' doesn't allow an argument\n" -msgstr "%s: `-W %s' seçeneði argümansýz kullanýlýr\n" - -#: lib/obstack.c:417 lib/obstack.c:420 lib/xmalloc.c:53 -msgid "memory exhausted" -msgstr "bellek tükendi" - -#: lib/quotearg.c:238 -msgid "`" -msgstr "`" - -#: lib/quotearg.c:239 -msgid "'" -msgstr "'" - -#: lib/subpipe.c:171 -#, c-format -msgid "subsidiary program `%s' could not be invoked" -msgstr "alt program `%s' çalýþtýrýlamadý" - -#: lib/subpipe.c:173 -#, c-format -msgid "subsidiary program `%s' not found" -msgstr "alt program `%s' bulunamadý" - -#: lib/subpipe.c:175 -#, c-format -msgid "subsidiary program `%s' failed" -msgstr "alt program `%s' baþarýsýz" - -#: lib/subpipe.c:176 -#, c-format -msgid "subsidiary program `%s' failed (exit status %d)" -msgstr "alt program `%s' baþarýsýz (hata kodu: %d)" - -#: lib/timevar.c:475 -msgid "" -"\n" -"Execution times (seconds)\n" -msgstr "" -"\n" -"Çalýþma süresi (saniye)\n" - -#: lib/timevar.c:525 -msgid " TOTAL :" -msgstr " TOPLAM : " - -#: lib/timevar.c:561 -#, c-format -msgid "time in %s: %ld.%06ld (%ld%%)\n" -msgstr "%s'te geçen zaman: %ld.%06ld (%ld%%)\n" - -#~ msgid "too many states (max %d)" -#~ msgstr "çok fazla durum (en fazla %d)" - -#~ msgid "reduce" -#~ msgstr "indirgeme" - -#~ msgid "shift" -#~ msgstr "shift" - -#~ msgid "%d shift/reduce conflict" -#~ msgid_plural "%d shift/reduce conflicts" -#~ msgstr[0] "%d öteleme/indirgeme çeliþkisi" -#~ msgstr[1] "%d öteleme/indirgeme çeliþkisi" - -#~ msgid "and" -#~ msgstr "ve" - -#~ msgid "State %d contains " -#~ msgstr "%d durumu içerir" - -#~ msgid "conflicts: " -#~ msgstr "çeliþkiler: " - -#~ msgid "%s contains " -#~ msgstr "%s içerir" - -#~ msgid "`%s' is no longer supported" -#~ msgstr "`%s' artýk desteklenmeyecek" - -#~ msgid "%s: no grammar file given\n" -#~ msgstr "%s: gramer dosyasý verilmemiþ\n" - -#~ msgid "%s: extra arguments ignored after `%s'\n" -#~ msgstr "%s: '%s' den sonraki argümanlar yoksayýldý\n" - -#~ msgid "too many gotos (max %d)" -#~ msgstr "gotos çok fazla (en fazla %d)" - -#~ msgid "unexpected `/' found and ignored" -#~ msgstr "beklenmeyen `/' bulundu ve yoksayýldý" - -#~ msgid "unterminated comment" -#~ msgstr "sonlandýrýlmamýþ açýklama" - -#~ msgid "unexpected end of file" -#~ msgstr "beklenmeyen dosya sonu" - -#~ msgid "unescaped newline in constant" -#~ msgstr "sabit içinde kaçamayan yeni satýr" - -#~ msgid "octal value outside range 0...255: `\\%o'" -#~ msgstr "sekizli deðer 0...255'in dýþýnda: `\\%o'" - -#~ msgid "hexadecimal value above 255: `\\x%x'" -#~ msgstr "onaltýlýk deðer 255'in üstünde: `\\x%x'" - -#~ msgid "unknown escape sequence: `\\' followed by `%s'" -#~ msgstr "bilinmeyen kaçýþ sýrasý: `\\' `%s' tarafýndan takip edildi" - -#~ msgid "unterminated type name at end of file" -#~ msgstr "dosya sonunda sonlandýrýlmamýþ tip adý" - -#~ msgid "unterminated type name" -#~ msgstr "sonlandýrýlmamýþ tip ismi" - -#~ msgid "use \"...\" for multi-character literal tokens" -#~ msgstr "çok-karakterli yazýn andaçlarý için \"...\" kullan" - -#~ msgid "`%s' supports no argument: %s" -#~ msgstr "`%s' argüman %s'i desteklemez" - -#~ msgid "`%s' requires an argument" -#~ msgstr "`%s' bir argüman gerektirir" - -#~ msgid " (rule %d)" -#~ msgstr " (kural %d)" - -#~ msgid " %-4s\terror (nonassociative)\n" -#~ msgstr " %-4s\thata (birleþmeli deðil)\n" - -#~ msgid "" -#~ " $default\treduce using rule %d (%s)\n" -#~ "\n" -#~ msgstr "" -#~ " $default\tindirgeme kural %d (%s)'i kullanýyor\n" -#~ "\n" - -#~ msgid " %-4s\t[reduce using rule %d (%s)]\n" -#~ msgstr " %-4s\t[indirgeme kural %d (%s)'i kullanýyor]\n" - -#~ msgid " %-4s\treduce using rule %d (%s)\n" -#~ msgstr " %-4s\tindirgeme kural %d (%s)'i kullanýyor\n" - -#~ msgid " $default\treduce using rule %d (%s)\n" -#~ msgstr " $default\tindirgeme kural %d (%s)'i kullanýyor\n" - -#~ msgid " $default\taccept\n" -#~ msgstr " $default\tonayla\n" - -#~ msgid " NO ACTIONS\n" -#~ msgstr " EYLEM YOK\n" - -#~ msgid "Number, Line, Rule" -#~ msgstr "Sayý, Satýr, Kural" - -#~ msgid " %3d %3d %s ->" -#~ msgstr " %3d %3d %s ->" - -#~ msgid " Skipping to next \\n" -#~ msgstr " Sonrakine atlanýyor \\n" - -#~ msgid " Skipping to next %c" -#~ msgstr " Sonraki %c'ye atlanýyor" - -#~ msgid "unterminated string" -#~ msgstr "sonlandýrýlmamýþ dizge" - -#~ msgid "%s is invalid" -#~ msgstr "%s geçersizdir" - -#~ msgid "unterminated `%{' definition" -#~ msgstr "`%{' tanýmlamasý sonlandýrýlmamýþ" - -#~ msgid "Premature EOF after %s" -#~ msgstr "%s'den sonra erken EOF" - -#~ msgid "`%s' is invalid in %s" -#~ msgstr "`%s' %s içinde geçersizdir" - -#~ msgid "invalid %s declaration" -#~ msgstr "geçersiz %s bildirimi" - -#~ msgid "%type declaration has no " -#~ msgstr "%type bildirimi 'na sahip deðil" - -#~ msgid "invalid %%type declaration due to item: %s" -#~ msgstr "geçersiz %%type bildirimine neden olan öðe: `%s'" - -#~ msgid "invalid text (%s) - number should be after identifier" -#~ msgstr "geçersiz metin (%s) - sayý tanýtýcýdan sonra olmalýdýr" - -#~ msgid "unexpected item: %s" -#~ msgstr "beklenmeyen öðe: %s" - -#~ msgid "unmatched %s" -#~ msgstr "eþlenemeyen %s" - -#~ msgid "argument of %%expect is not an integer" -#~ msgstr "%%expect'in argümaný bir tamsayý deðildir" - -#~ msgid "unrecognized item %s, expected an identifier" -#~ msgstr "%s öðesi tanýnmadý, beklenen bir tanýtýcýdýr" - -#~ msgid "expected string constant instead of %s" -#~ msgstr "%s'in yerine sabit dizge beklendi" - -#~ msgid "no input grammar" -#~ msgstr "girdi grameri yok" - -#~ msgid "ill-formed rule: initial symbol not followed by colon" -#~ msgstr "kötü-biçemli kural: baþlangýç simgesini takip eden \":\" yok" - -#~ msgid "grammar starts with vertical bar" -#~ msgstr "gramer düþey çubuk ile baþlýyor" - -#~ msgid "previous rule lacks an ending `;'" -#~ msgstr "önceki kuralda bir bitiþ `;' eksik" - -#~ msgid "two @prec's in a row" -#~ msgstr "bir satýrda iki @prec" - -#~ msgid "%%guard present but %%semantic_parser not specified" -#~ msgstr "%%guard sunulmuþ fakat %%semantic_parser belirlenmemiþ" - -#~ msgid "two actions at end of one rule" -#~ msgstr "bir kuralýn sonunda iki eylem" - -#~ msgid "too many symbols (tokens plus nonterminals); maximum %d" -#~ msgstr "çok fazla simge var (andaçlar ve deðiþken simgeler); en fazla %d" - -#~ msgid "maximum table size (%d) exceeded" -#~ msgstr "en büyük tablo uzunluðu (%d) aþýldý" - -#~ msgid " $ \tgo to state %d\n" -#~ msgstr " $ \tdurum %d'ye git\n" - -#~ msgid "unterminated %guard clause" -#~ msgstr "sonlandýrýlmamýþ %guard yantümcesi" diff --git a/src/bin/bison/src/LR0.c b/src/bin/bison/src/LR0.c index 2a75193e81..43030fc5ba 100644 --- a/src/bin/bison/src/LR0.c +++ b/src/bin/bison/src/LR0.c @@ -17,8 +17,8 @@ You should have received a copy of the GNU General Public License along with Bison; see the file COPYING. If not, write to - the Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. */ /* See comments in state.h for the data structures that represent it. @@ -59,7 +59,7 @@ static state_list *last_state = NULL; static state * state_list_append (symbol_number sym, size_t core_size, item_number *core) { - state_list *node = MALLOC (node, 1); + state_list *node = xmalloc (sizeof *node); state *s = state_new (sym, core_size, core); if (trace_flag & trace_automaton) @@ -84,14 +84,14 @@ state_list_append (symbol_number sym, size_t core_size, item_number *core) } static int nshifts; -static symbol_number *shift_symbol = NULL; +static symbol_number *shift_symbol; -static rule **redset = NULL; -static state **shiftset = NULL; +static rule **redset; +static state **shiftset; -static item_number **kernel_base = NULL; -static int *kernel_size = NULL; -static item_number *kernel_items = NULL; +static item_number **kernel_base; +static int *kernel_size; +static item_number *kernel_items; static void @@ -105,9 +105,9 @@ allocate_itemsets (void) Note that useless productions (hence useless nonterminals) are browsed too, hence we need to allocate room for _all_ the symbols. */ - int count = 0; - short int *symbol_count = CALLOC (symbol_count, - nsyms + nuseless_nonterminals); + size_t count = 0; + size_t *symbol_count = xcalloc (nsyms + nuseless_nonterminals, + sizeof *symbol_count); for (r = 0; r < nrules; ++r) for (rhsp = rules[r].rhs; *rhsp >= 0; ++rhsp) @@ -122,9 +122,8 @@ allocate_itemsets (void) appears as an item, which is SYMBOL_COUNT[S]. We allocate that much space for each symbol. */ - CALLOC (kernel_base, nsyms); - if (count) - CALLOC (kernel_items, count); + kernel_base = xnmalloc (nsyms, sizeof *kernel_base); + kernel_items = xnmalloc (count, sizeof *kernel_items); count = 0; for (i = 0; i < nsyms; i++) @@ -134,7 +133,7 @@ allocate_itemsets (void) } free (symbol_count); - CALLOC (kernel_size, nsyms); + kernel_size = xnmalloc (nsyms, sizeof *kernel_size); } @@ -143,10 +142,10 @@ allocate_storage (void) { allocate_itemsets (); - CALLOC (shiftset, nsyms); - CALLOC (redset, nrules); + shiftset = xnmalloc (nsyms, sizeof *shiftset); + redset = xnmalloc (nrules, sizeof *redset); state_hash_new (); - CALLOC (shift_symbol, nsyms); + shift_symbol = xnmalloc (nsyms, sizeof *shift_symbol); } @@ -158,7 +157,7 @@ free_storage (void) free (shiftset); free (kernel_base); free (kernel_size); - XFREE (kernel_items); + free (kernel_items); state_hash_free (); } @@ -179,13 +178,12 @@ free_storage (void) static void new_itemsets (state *s) { - int i; + size_t i; if (trace_flag & trace_automaton) fprintf (stderr, "Entering new_itemsets, state = %d\n", s->number); - for (i = 0; i < nsyms; i++) - kernel_size[i] = 0; + memset (kernel_size, 0, nsyms * sizeof *kernel_size); nshifts = 0; @@ -252,7 +250,7 @@ append_states (state *s) { symbol_number sym = shift_symbol[i]; int j; - for (j = i; 0 < j && sym < shift_symbol [j - 1]; j--) + for (j = i; 0 < j && sym < shift_symbol[j - 1]; j--) shift_symbol[j] = shift_symbol[j - 1]; shift_symbol[j] = sym; } @@ -275,7 +273,7 @@ static void save_reductions (state *s) { int count = 0; - int i; + size_t i; /* Find and count the active items that represent ends of rules. */ for (i = 0; i < nritemset; ++i) @@ -297,7 +295,7 @@ save_reductions (state *s) static void set_states (void) { - CALLOC (states, nstates); + states = xcalloc (nstates, sizeof *states); while (first_state) { @@ -331,15 +329,14 @@ set_states (void) void generate_states (void) { + item_number initial_core = 0; state_list *list = NULL; allocate_storage (); new_closure (nritems); /* Create the initial state. The 0 at the lhs is the index of the item of this initial rule. */ - kernel_base[0][0] = 0; - kernel_size[0] = 1; - state_list_append (0, kernel_size[0], kernel_base[0]); + state_list_append (0, 1, &initial_core); list = first_state; diff --git a/src/bin/bison/src/LR0.h b/src/bin/bison/src/LR0.h index be8cdaa1c1..60045389ce 100644 --- a/src/bin/bison/src/LR0.h +++ b/src/bin/bison/src/LR0.h @@ -15,8 +15,8 @@ You should have received a copy of the GNU General Public License along with Bison; see the file COPYING. If not, write to - the Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. */ #ifndef LR0_H_ # define LR0_H_ diff --git a/src/bin/bison/src/Makefile.am b/src/bin/bison/src/Makefile.am index 8f34832968..4fc07a29a1 100644 --- a/src/bin/bison/src/Makefile.am +++ b/src/bin/bison/src/Makefile.am @@ -1,4 +1,4 @@ -## Copyright (C) 2001, 2002, 2003, 2004 Free Software Foundation, Inc. +## Copyright (C) 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc. ## This program is free software; you can redistribute it and/or modify ## it under the terms of the GNU General Public License as published by @@ -12,12 +12,10 @@ ## You should have received a copy of the GNU General Public License ## along with this program; if not, write to the Free Software -## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA -## 02111-1307 USA +## Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +## 02110-1301 USA -DEFS = @DEFS@ \ - -DPKGDATADIR=\"$(pkgdatadir)\" \ - -DLOCALEDIR=\"$(datadir)/locale\" +DEFS += -DPKGDATADIR=\"$(pkgdatadir)\" -DLOCALEDIR=\"$(datadir)/locale\" AM_CFLAGS = $(WARNING_CFLAGS) $(WERROR_CFLAGS) AM_CPPFLAGS = -I$(top_srcdir)/lib -I../lib @@ -33,7 +31,7 @@ bin_PROGRAMS = bison bin_SCRIPTS = $(YACC_SCRIPT) EXTRA_SCRIPTS = yacc -bison_SOURCES = \ +bison_SOURCES = \ LR0.c LR0.h \ assoc.c assoc.h \ closure.c closure.h \ @@ -56,7 +54,7 @@ bison_SOURCES = \ reduce.c reduce.h \ relation.c relation.h \ scan-gram.l \ - scan-skel.l \ + scan-skel.h scan-skel.l \ state.c state.h \ symlist.c symlist.h \ symtab.c symtab.h \ @@ -77,3 +75,34 @@ yacc: echo: echo $(bison_SOURCES) $(noinst_HEADERS) + +# The following rule is not designed to be portable, +# and relies on tools that not everyone has. + +# Most functions in src/*.c should have static scope. +# Any that don't must be marked with `extern', but `main' +# and `usage' are exceptions. They're always extern, but +# don't need to be marked. +# +# The second nm|grep checks for file-scope variables with `extern' scope. +sc_tight_scope: $(all_programs) + @t=exceptions-$$$$; \ + trap 's=$$?; rm -f $$t; exit $$s' 0 1 2 13 15; \ + ( printf '^main$$\n^usage$$\n'; \ + grep -h -A1 '^extern .*[^;]$$' $(SOURCES) \ + | grep -vE '^(extern |--)' |sed 's/^/^/;s/ .*/$$/' ) > $$t; \ + if nm -e *.$(OBJEXT) \ + | sed -n 's/.* T //p' \ + | grep -Ev -f $$t; then \ + echo 'the above functions should have static scope' 1>&2; \ + exit 1; \ + fi; \ + ( printf '^program_name$$\n'; \ + sed -n 's/^extern .*[* ]\([a-zA-Z_][a-zA-Z_0-9]*\);$$/^\1$$/p' \ + $$(ls $(SOURCES) | grep '\.h$$') /dev/null) > $$t; \ + if nm -e *.$(OBJEXT) \ + | sed -n 's/.* [BD] //p' \ + | grep -Ev -f $$t; then \ + echo 'the above variables should have static scope' 1>&2; \ + exit 1; \ + fi diff --git a/src/bin/bison/src/Makefile.in b/src/bin/bison/src/Makefile.in index 878396fe52..be41e91bdb 100644 --- a/src/bin/bison/src/Makefile.in +++ b/src/bin/bison/src/Makefile.in @@ -1,8 +1,8 @@ -# Makefile.in generated by automake 1.8.5 from Makefile.am. +# Makefile.in generated by automake 1.9.6 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, -# 2003, 2004 Free Software Foundation, Inc. +# 2003, 2004, 2005 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. @@ -15,8 +15,6 @@ @SET_MAKE@ -SOURCES = $(bison_SOURCES) - srcdir = @srcdir@ top_srcdir = @top_srcdir@ VPATH = @srcdir@ @@ -37,6 +35,7 @@ POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : +build_triplet = @build@ host_triplet = @host@ bin_PROGRAMS = bison$(EXEEXT) subdir = src @@ -44,28 +43,33 @@ DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in parse-gram.c \ scan-gram.c scan-skel.c ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/alloca.m4 \ + $(top_srcdir)/m4/bison-i18n.m4 $(top_srcdir)/m4/cxx.m4 \ $(top_srcdir)/m4/dirname.m4 $(top_srcdir)/m4/dmalloc.m4 \ $(top_srcdir)/m4/dos.m4 $(top_srcdir)/m4/error.m4 \ $(top_srcdir)/m4/exitfail.m4 $(top_srcdir)/m4/extensions.m4 \ - $(top_srcdir)/m4/getopt.m4 $(top_srcdir)/m4/gettext.m4 \ + $(top_srcdir)/m4/getopt.m4 $(top_srcdir)/m4/gettext_gl.m4 \ $(top_srcdir)/m4/gnulib.m4 $(top_srcdir)/m4/hard-locale.m4 \ $(top_srcdir)/m4/hash.m4 $(top_srcdir)/m4/iconv.m4 \ - $(top_srcdir)/m4/lib-ld.m4 $(top_srcdir)/m4/lib-link.m4 \ - $(top_srcdir)/m4/lib-prefix.m4 $(top_srcdir)/m4/m4.m4 \ + $(top_srcdir)/m4/inttypes_h_gl.m4 \ + $(top_srcdir)/m4/lib-ld_gl.m4 $(top_srcdir)/m4/lib-link.m4 \ + $(top_srcdir)/m4/lib-prefix_gl.m4 $(top_srcdir)/m4/m4.m4 \ $(top_srcdir)/m4/mbrtowc.m4 $(top_srcdir)/m4/mbstate_t.m4 \ $(top_srcdir)/m4/mbswidth.m4 $(top_srcdir)/m4/nls.m4 \ $(top_srcdir)/m4/obstack.m4 $(top_srcdir)/m4/onceonly.m4 \ - $(top_srcdir)/m4/po.m4 $(top_srcdir)/m4/progtest.m4 \ + $(top_srcdir)/m4/po_gl.m4 $(top_srcdir)/m4/progtest.m4 \ $(top_srcdir)/m4/quote.m4 $(top_srcdir)/m4/quotearg.m4 \ - $(top_srcdir)/m4/stdbool.m4 $(top_srcdir)/m4/stpcpy.m4 \ - $(top_srcdir)/m4/strndup.m4 $(top_srcdir)/m4/strnlen.m4 \ - $(top_srcdir)/m4/subpipe.m4 $(top_srcdir)/m4/timevar.m4 \ - $(top_srcdir)/m4/unlocked-io.m4 $(top_srcdir)/m4/warning.m4 \ + $(top_srcdir)/m4/stdbool.m4 $(top_srcdir)/m4/stdint_h_gl.m4 \ + $(top_srcdir)/m4/stdio-safer.m4 $(top_srcdir)/m4/stpcpy.m4 \ + $(top_srcdir)/m4/strdup.m4 $(top_srcdir)/m4/strndup.m4 \ + $(top_srcdir)/m4/strnlen.m4 $(top_srcdir)/m4/subpipe.m4 \ + $(top_srcdir)/m4/timevar.m4 $(top_srcdir)/m4/uintmax_t_gl.m4 \ + $(top_srcdir)/m4/ulonglong_gl.m4 \ + $(top_srcdir)/m4/unistd-safer.m4 $(top_srcdir)/m4/warning.m4 \ $(top_srcdir)/m4/xalloc.m4 $(top_srcdir)/m4/xstrndup.m4 \ $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) -mkinstalldirs = $(SHELL) $(top_srcdir)/config/mkinstalldirs +mkinstalldirs = $(SHELL) $(top_srcdir)/build-aux/mkinstalldirs CONFIG_HEADER = $(top_builddir)/config.h CONFIG_CLEAN_FILES = am__installdirs = "$(DESTDIR)$(bindir)" "$(DESTDIR)$(bindir)" @@ -88,29 +92,14 @@ bison_DEPENDENCIES = ../lib/libbison.a $(am__DEPENDENCIES_1) binSCRIPT_INSTALL = $(INSTALL_SCRIPT) SCRIPTS = $(bin_SCRIPTS) DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir) -depcomp = $(SHELL) $(top_srcdir)/config/depcomp +depcomp = $(SHELL) $(top_srcdir)/build-aux/depcomp am__depfiles_maybe = depfiles -@AMDEP_TRUE@DEP_FILES = ./$(DEPDIR)/LR0.Po ./$(DEPDIR)/assoc.Po \ -@AMDEP_TRUE@ ./$(DEPDIR)/closure.Po ./$(DEPDIR)/complain.Po \ -@AMDEP_TRUE@ ./$(DEPDIR)/conflicts.Po ./$(DEPDIR)/derives.Po \ -@AMDEP_TRUE@ ./$(DEPDIR)/files.Po ./$(DEPDIR)/getargs.Po \ -@AMDEP_TRUE@ ./$(DEPDIR)/gram.Po ./$(DEPDIR)/lalr.Po \ -@AMDEP_TRUE@ ./$(DEPDIR)/location.Po ./$(DEPDIR)/main.Po \ -@AMDEP_TRUE@ ./$(DEPDIR)/muscle_tab.Po ./$(DEPDIR)/nullable.Po \ -@AMDEP_TRUE@ ./$(DEPDIR)/output.Po ./$(DEPDIR)/parse-gram.Po \ -@AMDEP_TRUE@ ./$(DEPDIR)/print.Po ./$(DEPDIR)/print_graph.Po \ -@AMDEP_TRUE@ ./$(DEPDIR)/reader.Po ./$(DEPDIR)/reduce.Po \ -@AMDEP_TRUE@ ./$(DEPDIR)/relation.Po ./$(DEPDIR)/scan-gram.Po \ -@AMDEP_TRUE@ ./$(DEPDIR)/scan-skel.Po ./$(DEPDIR)/state.Po \ -@AMDEP_TRUE@ ./$(DEPDIR)/symlist.Po ./$(DEPDIR)/symtab.Po \ -@AMDEP_TRUE@ ./$(DEPDIR)/tables.Po ./$(DEPDIR)/uniqstr.Po \ -@AMDEP_TRUE@ ./$(DEPDIR)/vcg.Po COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) CCLD = $(CC) LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ LEXCOMPILE = $(LEX) $(LFLAGS) $(AM_LFLAGS) -YLWRAP = $(top_srcdir)/config/ylwrap +YLWRAP = $(top_srcdir)/build-aux/ylwrap YACCCOMPILE = $(YACC) $(YFLAGS) $(AM_YFLAGS) SOURCES = $(bison_SOURCES) DIST_SOURCES = $(bison_SOURCES) @@ -128,6 +117,8 @@ AUTOHEADER = @AUTOHEADER@ AUTOM4TE = @AUTOM4TE@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ +BISON_CXX_WORKS = @BISON_CXX_WORKS@ +BISON_LOCALEDIR = @BISON_LOCALEDIR@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ @@ -137,10 +128,8 @@ CXX = @CXX@ CXXDEPMODE = @CXXDEPMODE@ CXXFLAGS = @CXXFLAGS@ CYGPATH_W = @CYGPATH_W@ -DEFS = @DEFS@ \ - -DPKGDATADIR=\"$(pkgdatadir)\" \ - -DLOCALEDIR=\"$(datadir)/locale\" - +DEFS = @DEFS@ -DPKGDATADIR=\"$(pkgdatadir)\" \ + -DLOCALEDIR=\"$(datadir)/locale\" DEPDIR = @DEPDIR@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ @@ -148,6 +137,7 @@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ GCC = @GCC@ +GETOPT_H = @GETOPT_H@ GMSGFMT = @GMSGFMT@ HAVE__BOOL = @HAVE__BOOL@ INSTALL_DATA = @INSTALL_DATA@ @@ -155,6 +145,7 @@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ INTLLIBS = @INTLLIBS@ +INTL_MACOSX_LIBS = @INTL_MACOSX_LIBS@ LDFLAGS = @LDFLAGS@ LEX = @LEX@ LEXLIB = @LEXLIB@ @@ -172,6 +163,7 @@ MKINSTALLDIRS = @MKINSTALLDIRS@ MSGFMT = @MSGFMT@ MSGMERGE = @MSGMERGE@ O0CFLAGS = @O0CFLAGS@ +O0CXXFLAGS = @O0CXXFLAGS@ OBJEXT = @OBJEXT@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ @@ -203,6 +195,7 @@ ac_ct_CC = @ac_ct_CC@ ac_ct_CXX = @ac_ct_CXX@ ac_ct_RANLIB = @ac_ct_RANLIB@ ac_ct_STRIP = @ac_ct_STRIP@ +aclocaldir = @aclocaldir@ am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@ @@ -210,6 +203,8 @@ am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ @@ -267,7 +262,7 @@ bison_SOURCES = \ reduce.c reduce.h \ relation.c relation.h \ scan-gram.l \ - scan-skel.l \ + scan-skel.h scan-skel.l \ state.c state.h \ symlist.c symlist.h \ symtab.c symtab.h \ @@ -399,16 +394,14 @@ distclean-compile: @am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ @am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(COMPILE) -c $< .c.obj: @am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \ @am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` .l.c: @@ -420,7 +413,8 @@ distclean-compile: to=`echo "$*_H" | sed \ -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/' \ -e 's/[^ABCDEFGHIJKLMNOPQRSTUVWXYZ]/_/g'`; \ - sed "/^#/ s/Y_TAB_H/$$to/g" y.tab.h >$*.ht; \ + sed -e "/^#/!b" -e "s/Y_TAB_H/$$to/g" -e "s|y\.tab\.h|$*.h|" \ + y.tab.h >$*.ht; \ rm -f y.tab.h; \ if cmp -s $*.ht $*.h; then \ rm -f $*.ht ;\ @@ -539,15 +533,15 @@ mostlyclean-generic: clean-generic: distclean-generic: - -rm -f $(CONFIG_CLEAN_FILES) + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." - -rm -f scan-gram.c - -test -z "$(BUILT_SOURCES)" || rm -f $(BUILT_SOURCES) - -rm -f scan-skel.c -rm -f parse-gram.c + -rm -f scan-gram.c + -rm -f scan-skel.c + -test -z "$(BUILT_SOURCES)" || rm -f $(BUILT_SOURCES) clean: clean-am clean-am: clean-binPROGRAMS clean-generic mostlyclean-am @@ -618,6 +612,37 @@ yacc: echo: echo $(bison_SOURCES) $(noinst_HEADERS) + +# The following rule is not designed to be portable, +# and relies on tools that not everyone has. + +# Most functions in src/*.c should have static scope. +# Any that don't must be marked with `extern', but `main' +# and `usage' are exceptions. They're always extern, but +# don't need to be marked. +# +# The second nm|grep checks for file-scope variables with `extern' scope. +sc_tight_scope: $(all_programs) + @t=exceptions-$$$$; \ + trap 's=$$?; rm -f $$t; exit $$s' 0 1 2 13 15; \ + ( printf '^main$$\n^usage$$\n'; \ + grep -h -A1 '^extern .*[^;]$$' $(SOURCES) \ + | grep -vE '^(extern |--)' |sed 's/^/^/;s/ .*/$$/' ) > $$t; \ + if nm -e *.$(OBJEXT) \ + | sed -n 's/.* T //p' \ + | grep -Ev -f $$t; then \ + echo 'the above functions should have static scope' 1>&2; \ + exit 1; \ + fi; \ + ( printf '^program_name$$\n'; \ + sed -n 's/^extern .*[* ]\([a-zA-Z_][a-zA-Z_0-9]*\);$$/^\1$$/p' \ + $$(ls $(SOURCES) | grep '\.h$$') /dev/null) > $$t; \ + if nm -e *.$(OBJEXT) \ + | sed -n 's/.* [BD] //p' \ + | grep -Ev -f $$t; then \ + echo 'the above variables should have static scope' 1>&2; \ + exit 1; \ + fi # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: diff --git a/src/bin/bison/src/assoc.c b/src/bin/bison/src/assoc.c index a63fc191fc..b816499c85 100644 --- a/src/bin/bison/src/assoc.c +++ b/src/bin/bison/src/assoc.c @@ -15,8 +15,8 @@ You should have received a copy of the GNU General Public License along with Bison; see the file COPYING. If not, write to - the Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. */ #include "system.h" diff --git a/src/bin/bison/src/assoc.h b/src/bin/bison/src/assoc.h index 97a6b28bcc..b31c55e2bc 100644 --- a/src/bin/bison/src/assoc.h +++ b/src/bin/bison/src/assoc.h @@ -15,8 +15,8 @@ You should have received a copy of the GNU General Public License along with Bison; see the file COPYING. If not, write to - the Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. */ #ifndef ASSOC_H_ # define ASSOC_H_ diff --git a/src/bin/bison/src/closure.c b/src/bin/bison/src/closure.c index 228056f7bb..eb53ee0562 100644 --- a/src/bin/bison/src/closure.c +++ b/src/bin/bison/src/closure.c @@ -1,6 +1,7 @@ /* Closures for Bison - Copyright (C) 1984, 1989, 2000, 2001, 2002 Free Software Foundation, Inc. + Copyright (C) 1984, 1989, 2000, 2001, 2002, 2004 Free Software + Foundation, Inc. This file is part of Bison, the GNU Compiler Compiler. @@ -16,8 +17,8 @@ You should have received a copy of the GNU General Public License along with Bison; see the file COPYING. If not, write to the Free - Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - 02111-1307, USA. */ + Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA + 02110-1301, USA. */ #include "system.h" @@ -35,7 +36,7 @@ /* NITEMSET is the size of the array ITEMSET. */ item_number *itemset; -int nritemset; +size_t nritemset; static bitset ruleset; @@ -180,9 +181,9 @@ set_fderives (void) void -new_closure (int n) +new_closure (unsigned int n) { - CALLOC (itemset, n); + itemset = xnmalloc (n, sizeof *itemset); ruleset = bitset_create (nrules, BITSET_FIXED); @@ -192,10 +193,10 @@ new_closure (int n) void -closure (item_number *core, int n) +closure (item_number *core, size_t n) { /* Index over CORE. */ - int c; + size_t c; /* A bit index over RULESET. */ rule_number ruleno; @@ -241,7 +242,7 @@ closure (item_number *core, int n) void free_closure (void) { - XFREE (itemset); + free (itemset); bitset_free (ruleset); bitsetv_free (fderives); } diff --git a/src/bin/bison/src/closure.h b/src/bin/bison/src/closure.h index 8cc4feb251..a2582e8946 100644 --- a/src/bin/bison/src/closure.h +++ b/src/bin/bison/src/closure.h @@ -17,8 +17,8 @@ You should have received a copy of the GNU General Public License along with Bison; see the file COPYING. If not, write to the Free - Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - 02111-1307, USA. */ + Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA + 02110-1301, USA. */ #ifndef CLOSURE_H_ # define CLOSURE_H_ @@ -29,7 +29,7 @@ data so that closure can be called. n is the number of elements to allocate for itemset. */ -void new_closure (int n); +void new_closure (unsigned int n); /* Given the kernel (aka core) of a state (a vector of item numbers @@ -46,7 +46,7 @@ void new_closure (int n); significant). CLOSURE places there the indices of all items which represent units of input that could arrive next. */ -void closure (item_number *items, int n); +void closure (item_number *items, size_t n); /* Frees ITEMSET, RULESET and internal data. */ @@ -54,6 +54,6 @@ void closure (item_number *items, int n); void free_closure (void); extern item_number *itemset; -extern int nritemset; +extern size_t nritemset; #endif /* !CLOSURE_H_ */ diff --git a/src/bin/bison/src/complain.c b/src/bin/bison/src/complain.c index 8a192bd26c..4769df5c27 100644 --- a/src/bin/bison/src/complain.c +++ b/src/bin/bison/src/complain.c @@ -13,7 +13,7 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ /* Based on error.c and error.h, diff --git a/src/bin/bison/src/complain.h b/src/bin/bison/src/complain.h index b9b00c6661..9ae334a4b3 100644 --- a/src/bin/bison/src/complain.h +++ b/src/bin/bison/src/complain.h @@ -13,7 +13,7 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #ifndef COMPLAIN_H_ diff --git a/src/bin/bison/src/conflicts.c b/src/bin/bison/src/conflicts.c index 2edd1e8b3b..ede39690c3 100644 --- a/src/bin/bison/src/conflicts.c +++ b/src/bin/bison/src/conflicts.c @@ -17,8 +17,8 @@ You should have received a copy of the GNU General Public License along with Bison; see the file COPYING. If not, write to the Free - Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - 02111-1307, USA. */ + Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA + 02110-1301, USA. */ #include "system.h" @@ -38,11 +38,11 @@ /* -1 stands for not specified. */ int expected_sr_conflicts = -1; int expected_rr_conflicts = -1; -static char *conflicts = NULL; +static char *conflicts; struct obstack solved_conflicts_obstack; -static bitset shiftset; -static bitset lookaheadset; +static bitset shift_set; +static bitset look_ahead_set; @@ -146,7 +146,7 @@ flush_shift (state *s, int token) transitions *trans = s->transitions; int i; - bitset_reset (lookaheadset, token); + bitset_reset (look_ahead_set, token); for (i = 0; i < trans->num; i++) if (!TRANSITION_IS_DISABLED (trans, i) && TRANSITION_SYMBOL (trans, i) == token) @@ -154,16 +154,16 @@ flush_shift (state *s, int token) } -/*-------------------------------------------------------------------. -| Turn off the reduce recorded for the specified token for the | -| specified lookahead. Used when we resolve a shift-reduce conflict | -| in favor of the shift. | -`-------------------------------------------------------------------*/ +/*--------------------------------------------------------------------. +| Turn off the reduce recorded for the specified token for the | +| specified look-ahead. Used when we resolve a shift-reduce conflict | +| in favor of the shift. | +`--------------------------------------------------------------------*/ static void -flush_reduce (bitset lookaheads, int token) +flush_reduce (bitset look_ahead_tokens, int token) { - bitset_reset (lookaheads, token); + bitset_reset (look_ahead_tokens, token); } @@ -173,7 +173,7 @@ flush_reduce (bitset lookaheads, int token) | rule has a precedence. A conflict is resolved by modifying the | | shift or reduce tables so that there is no longer a conflict. | | | -| LOOKAHEAD is the number of the lookahead bitset to consider. | +| RULENO is the number of the look-ahead bitset to consider. | | | | ERRORS can be used to store discovered explicit errors. | `------------------------------------------------------------------*/ @@ -186,12 +186,12 @@ resolve_sr_conflict (state *s, int ruleno, symbol **errors) /* Find the rule to reduce by to get precedence of reduction. */ rule *redrule = reds->rules[ruleno]; int redprec = redrule->prec->prec; - bitset lookaheads = reds->lookaheads[ruleno]; + bitset look_ahead_tokens = reds->look_ahead_tokens[ruleno]; int nerrs = 0; for (i = 0; i < ntokens; i++) - if (bitset_test (lookaheads, i) - && bitset_test (lookaheadset, i) + if (bitset_test (look_ahead_tokens, i) + && bitset_test (look_ahead_set, i) && symbols[i]->prec) { /* Shift-reduce conflict occurs for token number i @@ -205,7 +205,7 @@ resolve_sr_conflict (state *s, int ruleno, symbol **errors) else if (symbols[i]->prec > redprec) { log_resolution (redrule, i, shift_resolution); - flush_reduce (lookaheads, i); + flush_reduce (look_ahead_tokens, i); } else /* Matching precedence levels. @@ -217,7 +217,7 @@ resolve_sr_conflict (state *s, int ruleno, symbol **errors) { case right_assoc: log_resolution (redrule, i, right_resolution); - flush_reduce (lookaheads, i); + flush_reduce (look_ahead_tokens, i); break; case left_assoc: @@ -228,7 +228,7 @@ resolve_sr_conflict (state *s, int ruleno, symbol **errors) case non_assoc: log_resolution (redrule, i, nonassoc_resolution); flush_shift (s, i); - flush_reduce (lookaheads, i); + flush_reduce (look_ahead_tokens, i); /* Record an explicit error for this token. */ errors[nerrs++] = symbols[i]; break; @@ -257,7 +257,7 @@ resolve_sr_conflict (state *s, int ruleno, symbol **errors) | Solve the S/R conflicts of state S using the | | precedence/associativity, and flag it inconsistent if it still has | | conflicts. ERRORS can be used as storage to compute the list of | -| lookaheads on which S raises a syntax error (%nonassoc). | +| look-ahead tokens on which S raises a syntax error (%nonassoc). | `-------------------------------------------------------------------*/ static void @@ -270,27 +270,27 @@ set_conflicts (state *s, symbol **errors) if (s->consistent) return; - bitset_zero (lookaheadset); + bitset_zero (look_ahead_set); FOR_EACH_SHIFT (trans, i) - bitset_set (lookaheadset, TRANSITION_SYMBOL (trans, i)); + bitset_set (look_ahead_set, TRANSITION_SYMBOL (trans, i)); - /* Loop over all rules which require lookahead in this state. First + /* Loop over all rules which require look-ahead in this state. First check for shift-reduce conflict, and try to resolve using precedence. */ for (i = 0; i < reds->num; ++i) if (reds->rules[i]->prec && reds->rules[i]->prec->prec - && !bitset_disjoint_p (reds->lookaheads[i], lookaheadset)) + && !bitset_disjoint_p (reds->look_ahead_tokens[i], look_ahead_set)) resolve_sr_conflict (s, i, errors); - /* Loop over all rules which require lookahead in this state. Check + /* Loop over all rules which require look-ahead in this state. Check for conflicts not resolved above. */ for (i = 0; i < reds->num; ++i) { - if (!bitset_disjoint_p (reds->lookaheads[i], lookaheadset)) + if (!bitset_disjoint_p (reds->look_ahead_tokens[i], look_ahead_set)) conflicts[s->number] = 1; - bitset_or (lookaheadset, lookaheadset, reds->lookaheads[i]); + bitset_or (look_ahead_set, look_ahead_set, reds->look_ahead_tokens[i]); } } @@ -304,12 +304,12 @@ void conflicts_solve (void) { state_number i; - /* List of lookaheads on which we explicitly raise a syntax error. */ - symbol **errors = MALLOC (errors, ntokens + 1); + /* List of look-ahead tokens on which we explicitly raise a syntax error. */ + symbol **errors = xnmalloc (ntokens + 1, sizeof *errors); - CALLOC (conflicts, nstates); - shiftset = bitset_create (ntokens, BITSET_FIXED); - lookaheadset = bitset_create (ntokens, BITSET_FIXED); + conflicts = xcalloc (nstates, sizeof *conflicts); + shift_set = bitset_create (ntokens, BITSET_FIXED); + look_ahead_set = bitset_create (ntokens, BITSET_FIXED); obstack_init (&solved_conflicts_obstack); for (i = 0; i < nstates; i++) @@ -341,18 +341,18 @@ count_sr_conflicts (state *s) if (!trans) return 0; - bitset_zero (lookaheadset); - bitset_zero (shiftset); + bitset_zero (look_ahead_set); + bitset_zero (shift_set); FOR_EACH_SHIFT (trans, i) - bitset_set (shiftset, TRANSITION_SYMBOL (trans, i)); + bitset_set (shift_set, TRANSITION_SYMBOL (trans, i)); for (i = 0; i < reds->num; ++i) - bitset_or (lookaheadset, lookaheadset, reds->lookaheads[i]); + bitset_or (look_ahead_set, look_ahead_set, reds->look_ahead_tokens[i]); - bitset_and (lookaheadset, lookaheadset, shiftset); + bitset_and (look_ahead_set, look_ahead_set, shift_set); - src_count = bitset_count (lookaheadset); + src_count = bitset_count (look_ahead_set); return src_count; } @@ -377,7 +377,7 @@ count_rr_conflicts (state *s, bool one_per_token) int count = 0; int j; for (j = 0; j < reds->num; ++j) - if (bitset_test (reds->lookaheads[j], i)) + if (bitset_test (reds->look_ahead_tokens[j], i)) count++; if (count >= 2) @@ -432,7 +432,7 @@ conflicts_output (FILE *out) /*--------------------------------------------------------. | Total the number of S/R and R/R conflicts. Unlike the | | code in conflicts_output, however, count EACH pair of | -| reductions for the same state and lookahead as one | +| reductions for the same state and look-ahead as one | | conflict. | `--------------------------------------------------------*/ @@ -488,9 +488,9 @@ conflicts_print (void) expected_rr_conflicts = -1; } - src_ok = + src_ok = src_total == (expected_sr_conflicts == -1 ? 0 : expected_sr_conflicts); - rrc_ok = + rrc_ok = rrc_total == (expected_rr_conflicts == -1 ? 0 : expected_rr_conflicts); /* If there are as many RR conflicts and SR conflicts as @@ -522,8 +522,8 @@ conflicts_print (void) void conflicts_free (void) { - XFREE (conflicts); - bitset_free (shiftset); - bitset_free (lookaheadset); + free (conflicts); + bitset_free (shift_set); + bitset_free (look_ahead_set); obstack_free (&solved_conflicts_obstack, NULL); } diff --git a/src/bin/bison/src/conflicts.h b/src/bin/bison/src/conflicts.h index fdf8389302..4389e5ecca 100644 --- a/src/bin/bison/src/conflicts.h +++ b/src/bin/bison/src/conflicts.h @@ -15,8 +15,8 @@ You should have received a copy of the GNU General Public License along with Bison; see the file COPYING. If not, write to the Free - Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - 02111-1307, USA. */ + Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA + 02110-1301, USA. */ #ifndef CONFLICTS_H_ # define CONFLICTS_H_ diff --git a/src/bin/bison/src/derives.c b/src/bin/bison/src/derives.c index 7e20fe5a29..24fde5d2d6 100644 --- a/src/bin/bison/src/derives.c +++ b/src/bin/bison/src/derives.c @@ -17,8 +17,8 @@ You should have received a copy of the GNU General Public License along with Bison; see the file COPYING. If not, write to - the Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. */ #include "system.h" @@ -37,7 +37,7 @@ typedef struct rule_list rule *value; } rule_list; -rule ***derives = NULL; +rule ***derives; static void print_derives (void) @@ -70,12 +70,12 @@ derives_compute (void) /* DSET[NTERM - NTOKENS] -- A linked list of the numbers of the rules whose LHS is NTERM. */ - rule_list **dset = CALLOC (dset, nvars); + rule_list **dset = xcalloc (nvars, sizeof *dset); /* DELTS[RULE] -- There are NRULES rule number to attach to nterms. Instead of performing NRULES allocations for each, have an array indexed by rule numbers. */ - rule_list *delts = CALLOC (delts, nrules); + rule_list *delts = xnmalloc (nrules, sizeof *delts); for (r = nrules - 1; r >= 0; --r) { @@ -90,8 +90,8 @@ derives_compute (void) /* DSET contains what we need under the form of a linked list. Make it a single array. */ - CALLOC (derives, nvars); - CALLOC (q, nvars + nrules); + derives = xnmalloc (nvars, sizeof *derives); + q = xnmalloc (nvars + nrules, sizeof *q); for (i = ntokens; i < nsyms; i++) { @@ -116,6 +116,6 @@ derives_compute (void) void derives_free (void) { - XFREE (derives[0]); - XFREE (derives); + free (derives[0]); + free (derives); } diff --git a/src/bin/bison/src/derives.h b/src/bin/bison/src/derives.h index df6dde8ae2..9a45dc9cd5 100644 --- a/src/bin/bison/src/derives.h +++ b/src/bin/bison/src/derives.h @@ -17,8 +17,8 @@ You should have received a copy of the GNU General Public License along with Bison; see the file COPYING. If not, write to - the Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. */ #ifndef DERIVES_H_ # define DERIVES_H_ diff --git a/src/bin/bison/src/files.c b/src/bin/bison/src/files.c index 32a3e729c9..f2092b273a 100644 --- a/src/bin/bison/src/files.c +++ b/src/bin/bison/src/files.c @@ -1,6 +1,6 @@ /* Open and close files for Bison. - Copyright (C) 1984, 1986, 1989, 1992, 2000, 2001, 2002, 2003, 2004 + Copyright (C) 1984, 1986, 1989, 1992, 2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc. This file is part of Bison, the GNU Compiler Compiler. @@ -17,8 +17,8 @@ You should have received a copy of the GNU General Public License along with Bison; see the file COPYING. If not, write to the Free - Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - 02111-1307, USA. */ + Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA + 02110-1301, USA. */ #include "system.h" @@ -32,6 +32,7 @@ #include "files.h" #include "getargs.h" #include "gram.h" +#include "stdio-safer.h" /* From basename.c. Almost a lie, as it returns a char *. */ const char *base_name (char const *name); @@ -65,9 +66,9 @@ static char *full_base_name = NULL; char *short_base_name = NULL; /* C source file extension (the parser source). */ -const char *src_extension = NULL; +static char const *src_extension = NULL; /* Header file extension (if option ``-d'' is specified). */ -const char *header_extension = NULL; +static char const *header_extension = NULL; /*-----------------------------------------------------------------. | Return a newly allocated string composed of the concatenation of | @@ -95,7 +96,7 @@ xfopen (const char *name, const char *mode) { FILE *ptr; - ptr = fopen (name, mode); + ptr = fopen_safer (name, mode); if (!ptr) error (EXIT_FAILURE, get_errno (), _("cannot open file `%s'"), name); @@ -164,8 +165,8 @@ compute_exts_from_src (const char *ext) } -/* Decompose FILENAME in four parts: *BASE, *TAB, and *EXT, the fourth - part, (the directory) is ranging from FILENAME to the char before +/* Decompose FILE_NAME in four parts: *BASE, *TAB, and *EXT, the fourth + part, (the directory) is ranging from FILE_NAME to the char before *BASE, so we don't need an additional parameter. *EXT points to the last period in the basename, or NULL if none. @@ -174,7 +175,7 @@ compute_exts_from_src (const char *ext) `.tab' or `_tab' if present right before *EXT, or is NULL. *TAB cannot be equal to *BASE. - None are allocated, they are simply pointers to parts of FILENAME. + None are allocated, they are simply pointers to parts of FILE_NAME. Examples: '/tmp/foo.tab.c' -> *BASE = 'foo.tab.c', *TAB = '.tab.c', *EXT = @@ -193,10 +194,10 @@ compute_exts_from_src (const char *ext) 'foo' -> *BASE = 'foo', *TAB = NULL, *EXT = NULL. */ static void -filename_split (const char *filename, - const char **base, const char **tab, const char **ext) +file_name_split (const char *file_name, + const char **base, const char **tab, const char **ext) { - *base = base_name (filename); + *base = base_name (file_name); /* Look for the extension, i.e., look for the last dot. */ *ext = strrchr (*base, '.'); @@ -216,8 +217,6 @@ filename_split (const char *filename, } -/* FIXME: Should use xstrndup. */ - static void compute_base_names (void) { @@ -233,7 +232,7 @@ compute_base_names (void) files, remove the ".c" or ".tab.c" suffix. */ if (spec_outfile) { - filename_split (spec_outfile, &base, &tab, &ext); + file_name_split (spec_outfile, &base, &tab, &ext); /* The full base name goes up the EXT, excluding it. */ full_base_name = @@ -271,7 +270,7 @@ compute_base_names (void) { /* Otherwise, the short base name is computed from the input grammar: `foo/bar.yy' => `bar'. */ - filename_split (grammar_file, &base, &tab, &ext); + file_name_split (grammar_file, &base, &tab, &ext); short_base_name = xstrndup (base, (strlen (base) - (ext ? strlen (ext) : 0))); @@ -282,7 +281,7 @@ compute_base_names (void) stpcpy (stpcpy (full_base_name, short_base_name), TAB_EXT); /* Compute the extensions from the grammar file name. */ - filename_split (grammar_file, &base, &tab, &ext); + file_name_split (grammar_file, &base, &tab, &ext); if (ext && !yacc_flag) compute_exts_from_gf (ext); } diff --git a/src/bin/bison/src/files.h b/src/bin/bison/src/files.h index bf7e2c7733..3269c40d41 100644 --- a/src/bin/bison/src/files.h +++ b/src/bin/bison/src/files.h @@ -15,8 +15,8 @@ You should have received a copy of the GNU General Public License along with Bison; see the file COPYING. If not, write to - the Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. */ #ifndef FILES_H_ # define FILES_H_ diff --git a/src/bin/bison/src/getargs.c b/src/bin/bison/src/getargs.c index ba7627efbe..0170f8e34f 100644 --- a/src/bin/bison/src/getargs.c +++ b/src/bin/bison/src/getargs.c @@ -1,6 +1,6 @@ /* Parse command line arguments for Bison. - Copyright (C) 1984, 1986, 1989, 1992, 2000, 2001, 2002, 2003, 2004 + Copyright (C) 1984, 1986, 1989, 1992, 2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc. This file is part of Bison, the GNU Compiler Compiler. @@ -17,8 +17,8 @@ You should have received a copy of the GNU General Public License along with Bison; see the file COPYING. If not, write to the Free - Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - 02111-1307, USA. */ + Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA + 02110-1301, USA. */ #include "system.h" @@ -138,7 +138,7 @@ static const char * const report_args[] = "none", "state", "states", "itemset", "itemsets", - "lookahead", "lookaheads", + "look-ahead", "lookahead", "lookaheads", "solved", "all", 0 @@ -149,7 +149,9 @@ static const int report_types[] = report_none, report_states, report_states, report_states | report_itemsets, report_states | report_itemsets, - report_states | report_lookaheads, report_states | report_lookaheads, + report_states | report_look_ahead_tokens, + report_states | report_look_ahead_tokens, + report_states | report_look_ahead_tokens, report_states | report_solved_conflicts, report_all }; @@ -205,9 +207,10 @@ for the equivalent short option also. Similarly for optional arguments.\n"), fputs (_("\ Operation modes:\n\ - -h, --help display this help and exit\n\ - -V, --version output version information and exit\n\ - -y, --yacc emulate POSIX yacc\n"), stdout); + -h, --help display this help and exit\n\ + -V, --version output version information and exit\n\ + --print-localedir output directory containing locale-dependent data\n\ + -y, --yacc emulate POSIX yacc\n"), stdout); putc ('\n', stdout); fputs (_("\ @@ -237,7 +240,7 @@ Output:\n\ THINGS is a list of comma separated words that can include:\n\ `state' describe the states\n\ `itemset' complete the core item sets with their closure\n\ - `lookahead' explicitly associate lookaheads to items\n\ + `look-ahead' explicitly associate look-ahead tokens to items\n\ `solved' describe shift/reduce conflicts solving\n\ `all' include all the above information\n\ `none' disable the report\n\ @@ -267,7 +270,7 @@ version (void) putc ('\n', stdout); fprintf (stdout, - _("Copyright (C) %d Free Software Foundation, Inc.\n"), 2004); + _("Copyright (C) %d Free Software Foundation, Inc.\n"), 2005); fputs (_("\ This is free software; see the source for copying conditions. There is NO\n\ @@ -282,19 +285,21 @@ warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n\ `----------------------*/ /* Shorts options. */ -const char *short_options = "yvegdhr:ltknVo:b:p:S:T::"; +static char const short_options[] = "yvegdhr:ltknVo:b:p:S:T::"; /* Values for long options that do not have single-letter equivalents. */ enum { - LOCATIONS_OPTION = CHAR_MAX + 1 + LOCATIONS_OPTION = CHAR_MAX + 1, + PRINT_LOCALEDIR_OPTION }; static struct option const long_options[] = { /* Operation modes. */ - { "help", no_argument, 0, 'h' }, - { "version", no_argument, 0, 'V' }, + { "help", no_argument, 0, 'h' }, + { "version", no_argument, 0, 'V' }, + { "print-localedir", no_argument, 0, PRINT_LOCALEDIR_OPTION }, /* Parser. */ { "name-prefix", required_argument, 0, 'p' }, @@ -362,6 +367,10 @@ getargs (int argc, char *argv[]) version (); exit (EXIT_SUCCESS); + case PRINT_LOCALEDIR_OPTION: + printf ("%s\n", LOCALEDIR); + exit (EXIT_SUCCESS); + case 'g': /* Here, the -g and --graph=FILE options are differentiated. */ graph_flag = true; diff --git a/src/bin/bison/src/getargs.h b/src/bin/bison/src/getargs.h index 630e8ced28..2e02a76ae9 100644 --- a/src/bin/bison/src/getargs.h +++ b/src/bin/bison/src/getargs.h @@ -1,5 +1,5 @@ /* Parse command line arguments for bison. - Copyright (C) 1984, 1986, 1989, 1992, 2000, 2001, 2002, 2003 + Copyright (C) 1984, 1986, 1989, 1992, 2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc. This file is part of Bison, the GNU Compiler Compiler. @@ -16,15 +16,19 @@ You should have received a copy of the GNU General Public License along with Bison; see the file COPYING. If not, write to the Free - Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - 02111-1307, USA. */ + Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA + 02110-1301, USA. */ #ifndef GETARGS_H_ # define GETARGS_H_ /* flags set by % directives */ -extern const char *skeleton; /* for -S */ -extern const char *include; /* for -I */ + +/* for -S */ +extern char const *skeleton; + +/* for -I */ +extern char const *include; extern bool debug_flag; /* for -t */ extern bool defines_flag; /* for -d */ @@ -76,7 +80,7 @@ enum report report_none = 0, report_states = 1 << 0, report_itemsets = 1 << 1, - report_lookaheads = 1 << 2, + report_look_ahead_tokens= 1 << 2, report_solved_conflicts = 1 << 3, report_all = ~0 }; diff --git a/src/bin/bison/src/gram.c b/src/bin/bison/src/gram.c index 223b736d47..4636f4e14c 100644 --- a/src/bin/bison/src/gram.c +++ b/src/bin/bison/src/gram.c @@ -17,8 +17,8 @@ You should have received a copy of the GNU General Public License along with Bison; see the file COPYING. If not, write to - the Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. */ #include "system.h" @@ -269,7 +269,7 @@ grammar_dump (FILE *out, const char *title) rule *rule_i = &rules[i]; item_number *rp = NULL; unsigned int rhs_itemno = rule_i->rhs - ritem; - unsigned int rhs_count = 0; + unsigned int rhs_count = 0; /* Find the last RHS index in ritems. */ for (rp = rule_i->rhs; *rp >= 0; ++rp) ++rhs_count; @@ -326,9 +326,9 @@ grammar_rules_never_reduced_report (const char *message) void grammar_free (void) { - XFREE (ritem); + free (ritem); free (rules); - XFREE (token_translations); + free (token_translations); /* Free the symbol table data structure. */ symbols_free (); free_merger_functions (); diff --git a/src/bin/bison/src/gram.h b/src/bin/bison/src/gram.h index caae4847b9..a5dfc1e93b 100644 --- a/src/bin/bison/src/gram.h +++ b/src/bin/bison/src/gram.h @@ -17,8 +17,8 @@ You should have received a copy of the GNU General Public License along with Bison; see the file COPYING. If not, write to - the Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. */ #ifndef GRAM_H_ # define GRAM_H_ @@ -139,7 +139,7 @@ item_number_as_symbol_number (item_number i) } /* Rule numbers. */ -typedef short int rule_number; +typedef int rule_number; extern rule_number nrules; static inline item_number @@ -175,8 +175,8 @@ typedef struct /* This symbol provides both the associativity, and the precedence. */ symbol *prec; - short int dprec; - short int merger; + int dprec; + int merger; /* This symbol was attached to the rule via %prec. */ symbol *precsym; diff --git a/src/bin/bison/src/lalr.c b/src/bin/bison/src/lalr.c index 7273805ac0..8627f1cbc3 100644 --- a/src/bin/bison/src/lalr.c +++ b/src/bin/bison/src/lalr.c @@ -1,6 +1,6 @@ /* Compute look-ahead criteria for Bison. - Copyright (C) 1984, 1986, 1989, 2000, 2001, 2002, 2003 + Copyright (C) 1984, 1986, 1989, 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc. This file is part of Bison, the GNU Compiler Compiler. @@ -17,12 +17,12 @@ You should have received a copy of the GNU General Public License along with Bison; see the file COPYING. If not, write to - the Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. */ /* Compute how to make the finite state machine deterministic; find - which rules need lookahead in each state, and which lookahead + which rules need look-ahead in each state, and which look-ahead tokens they accept. */ #include "system.h" @@ -42,10 +42,10 @@ #include "relation.h" #include "symtab.h" -goto_number *goto_map = NULL; -static goto_number ngotos = 0; -state_number *from_state = NULL; -state_number *to_state = NULL; +goto_number *goto_map; +static goto_number ngotos; +state_number *from_state; +state_number *to_state; /* Linked list of goto numbers. */ typedef struct goto_list @@ -80,8 +80,8 @@ set_goto_map (void) state_number s; goto_number *temp_map; - CALLOC (goto_map, nvars + 1); - CALLOC (temp_map, nvars + 1); + goto_map = xcalloc (nvars + 1, sizeof *goto_map); + temp_map = xnmalloc (nvars + 1, sizeof *temp_map); ngotos = 0; for (s = 0; s < nstates; ++s) @@ -90,15 +90,18 @@ set_goto_map (void) int i; for (i = sp->num - 1; i >= 0 && TRANSITION_IS_GOTO (sp, i); --i) { - if (ngotos >= GOTO_NUMBER_MAXIMUM) - abort (); ngotos++; + + /* Abort if (ngotos + 1) would overflow. */ + if (ngotos == GOTO_NUMBER_MAXIMUM) + abort (); + goto_map[TRANSITION_SYMBOL (sp, i) - ntokens]++; } } { - int k = 0; + goto_number k = 0; int i; for (i = ntokens; i < nsyms; i++) { @@ -113,8 +116,8 @@ set_goto_map (void) temp_map[nsyms - ntokens] = ngotos; } - CALLOC (from_state, ngotos); - CALLOC (to_state, ngotos); + from_state = xcalloc (ngotos, sizeof *from_state); + to_state = xcalloc (ngotos, sizeof *to_state); for (s = 0; s < nstates; ++s) { @@ -122,13 +125,13 @@ set_goto_map (void) int i; for (i = sp->num - 1; i >= 0 && TRANSITION_IS_GOTO (sp, i); --i) { - int k = temp_map[TRANSITION_SYMBOL (sp, i) - ntokens]++; + goto_number k = temp_map[TRANSITION_SYMBOL (sp, i) - ntokens]++; from_state[k] = s; to_state[k] = sp->states[i]->number; } } - XFREE (temp_map); + free (temp_map); } @@ -137,12 +140,12 @@ set_goto_map (void) | Map a state/symbol pair into its numeric representation. | `----------------------------------------------------------*/ -static int +static goto_number map_goto (state_number s0, symbol_number sym) { - int high; - int low; - int middle; + goto_number high; + goto_number low; + goto_number middle; state_number s; low = goto_map[sym - ntokens]; @@ -167,11 +170,11 @@ map_goto (state_number s0, symbol_number sym) static void initialize_F (void) { - goto_number **reads = CALLOC (reads, ngotos); - goto_number *edge = CALLOC (edge, ngotos + 1); - int nedges = 0; + goto_number **reads = xnmalloc (ngotos, sizeof *reads); + goto_number *edge = xnmalloc (ngotos + 1, sizeof *edge); + goto_number nedges = 0; - int i; + goto_number i; F = bitsetv_create (ngotos, ntokens, BITSET_FIXED); @@ -191,11 +194,13 @@ initialize_F (void) edge[nedges++] = map_goto (stateno, sym); } - if (nedges) + if (nedges == 0) + reads[i] = NULL; + else { - CALLOC (reads[i], nedges + 1); - memcpy (reads[i], edge, nedges * sizeof (edge[0])); - reads[i][nedges] = -1; + reads[i] = xnmalloc (nedges + 1, sizeof reads[i][0]); + memcpy (reads[i], edge, nedges * sizeof edge[0]); + reads[i][nedges] = END_NODE; nedges = 0; } } @@ -203,21 +208,21 @@ initialize_F (void) relation_digraph (reads, ngotos, &F); for (i = 0; i < ngotos; i++) - XFREE (reads[i]); + free (reads[i]); - XFREE (reads); - XFREE (edge); + free (reads); + free (edge); } static void -add_lookback_edge (state *s, rule *r, int gotono) +add_lookback_edge (state *s, rule *r, goto_number gotono) { int ri = state_reduction_find (s, r); - goto_list *sp = MALLOC (sp, 1); - sp->next = lookback[(s->reductions->lookaheads - LA) + ri]; + goto_list *sp = xmalloc (sizeof *sp); + sp->next = lookback[(s->reductions->look_ahead_tokens - LA) + ri]; sp->value = gotono; - lookback[(s->reductions->lookaheads - LA) + ri] = sp; + lookback[(s->reductions->look_ahead_tokens - LA) + ri] = sp; } @@ -225,11 +230,11 @@ add_lookback_edge (state *s, rule *r, int gotono) static void build_relations (void) { - goto_number *edge = CALLOC (edge, ngotos + 1); - state_number *states1 = CALLOC (states1, ritem_longest_rhs () + 1); - int i; + goto_number *edge = xnmalloc (ngotos + 1, sizeof *edge); + state_number *states1 = xnmalloc (ritem_longest_rhs () + 1, sizeof *states1); + goto_number i; - CALLOC (includes, ngotos); + includes = xnmalloc (ngotos, sizeof *includes); for (i = 0; i < ngotos; i++) { @@ -273,18 +278,20 @@ build_relations (void) } } - if (nedges) + if (nedges == 0) + includes[i] = NULL; + else { int j; - CALLOC (includes[i], nedges + 1); + includes[i] = xnmalloc (nedges + 1, sizeof includes[i][0]); for (j = 0; j < nedges; j++) includes[i][j] = edge[j]; - includes[i][nedges] = -1; + includes[i][nedges] = END_NODE; } } - XFREE (edge); - XFREE (states1); + free (edge); + free (states1); relation_transpose (&includes, ngotos); } @@ -294,19 +301,19 @@ build_relations (void) static void compute_FOLLOWS (void) { - int i; + goto_number i; relation_digraph (includes, ngotos, &F); for (i = 0; i < ngotos; i++) - XFREE (includes[i]); + free (includes[i]); - XFREE (includes); + free (includes); } static void -compute_lookaheads (void) +compute_look_ahead_tokens (void) { size_t i; goto_list *sp; @@ -319,32 +326,32 @@ compute_lookaheads (void) for (i = 0; i < nLA; i++) LIST_FREE (goto_list, lookback[i]); - XFREE (lookback); + free (lookback); bitsetv_free (F); } -/*-----------------------------------------------------------. -| Count the number of lookaheads required for S (NLOOKAHEADS | -| member). | -`-----------------------------------------------------------*/ +/*-----------------------------------------------------. +| Count the number of look-ahead tokens required for S | +| (N_LOOK_AHEAD_TOKENS member). | +`-----------------------------------------------------*/ static int -state_lookaheads_count (state *s) +state_look_ahead_tokens_count (state *s) { int k; - int nlookaheads = 0; + int n_look_ahead_tokens = 0; reductions *rp = s->reductions; transitions *sp = s->transitions; - /* We need a lookahead either to distinguish different + /* We need a look-ahead either to distinguish different reductions (i.e., there are two or more), or to distinguish a reduction from a shift. Otherwise, it is straightforward, and the state is `consistent'. */ if (rp->num > 1 || (rp->num == 1 && sp->num && !TRANSITION_IS_DISABLED (sp, 0) && TRANSITION_IS_SHIFT (sp, 0))) - nlookaheads += rp->num; + n_look_ahead_tokens += rp->num; else s->consistent = 1; @@ -355,13 +362,13 @@ state_lookaheads_count (state *s) break; } - return nlookaheads; + return n_look_ahead_tokens; } -/*----------------------------------------------. -| Compute LA, NLA, and the lookaheads members. | -`----------------------------------------------*/ +/*-----------------------------------------------------. +| Compute LA, NLA, and the look_ahead_tokens members. | +`-----------------------------------------------------*/ static void initialize_LA (void) @@ -369,65 +376,65 @@ initialize_LA (void) state_number i; bitsetv pLA; - /* Compute the total number of reductions requiring a lookahead. */ + /* Compute the total number of reductions requiring a look-ahead. */ nLA = 0; for (i = 0; i < nstates; i++) - nLA += state_lookaheads_count (states[i]); + nLA += state_look_ahead_tokens_count (states[i]); /* Avoid having to special case 0. */ if (!nLA) nLA = 1; pLA = LA = bitsetv_create (nLA, ntokens, BITSET_FIXED); - CALLOC (lookback, nLA); + lookback = xcalloc (nLA, sizeof *lookback); - /* Initialize the members LOOKAHEADS for each state which reductions - require lookaheads. */ + /* Initialize the members LOOK_AHEAD_TOKENS for each state whose reductions + require look-ahead tokens. */ for (i = 0; i < nstates; i++) { - int count = state_lookaheads_count (states[i]); + int count = state_look_ahead_tokens_count (states[i]); if (count) { - states[i]->reductions->lookaheads = pLA; + states[i]->reductions->look_ahead_tokens = pLA; pLA += count; } } } -/*---------------------------------------. -| Output the lookaheads for each state. | -`---------------------------------------*/ +/*----------------------------------------------. +| Output the look-ahead tokens for each state. | +`----------------------------------------------*/ static void -lookaheads_print (FILE *out) +look_ahead_tokens_print (FILE *out) { state_number i; int j, k; - fprintf (out, "Lookaheads: BEGIN\n"); + fprintf (out, "Look-ahead tokens: BEGIN\n"); for (i = 0; i < nstates; ++i) { reductions *reds = states[i]->reductions; bitset_iterator iter; - int nlookaheads = 0; + int n_look_ahead_tokens = 0; - if (reds->lookaheads) + if (reds->look_ahead_tokens) for (k = 0; k < reds->num; ++k) - if (reds->lookaheads[k]) - ++nlookaheads; + if (reds->look_ahead_tokens[k]) + ++n_look_ahead_tokens; - fprintf (out, "State %d: %d lookaheads\n", - i, nlookaheads); + fprintf (out, "State %d: %d look-ahead tokens\n", + i, n_look_ahead_tokens); - if (reds->lookaheads) + if (reds->look_ahead_tokens) for (j = 0; j < reds->num; ++j) - BITSET_FOR_EACH (iter, reds->lookaheads[j], k, 0) + BITSET_FOR_EACH (iter, reds->look_ahead_tokens[j], k, 0) { fprintf (out, " on %d (%s) -> rule %d\n", k, symbols[k]->tag, reds->rules[j]->number); }; } - fprintf (out, "Lookaheads: END\n"); + fprintf (out, "Look-ahead tokens: END\n"); } void @@ -438,10 +445,10 @@ lalr (void) initialize_F (); build_relations (); compute_FOLLOWS (); - compute_lookaheads (); + compute_look_ahead_tokens (); if (trace_flag & trace_sets) - lookaheads_print (stderr); + look_ahead_tokens_print (stderr); } @@ -450,6 +457,6 @@ lalr_free (void) { state_number s; for (s = 0; s < nstates; ++s) - states[s]->reductions->lookaheads = NULL; + states[s]->reductions->look_ahead_tokens = NULL; bitsetv_free (LA); } diff --git a/src/bin/bison/src/lalr.h b/src/bin/bison/src/lalr.h index ce10edd019..a2c1753761 100644 --- a/src/bin/bison/src/lalr.h +++ b/src/bin/bison/src/lalr.h @@ -17,8 +17,8 @@ You should have received a copy of the GNU General Public License along with Bison; see the file COPYING. If not, write to - the Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. */ #ifndef LALR_H_ # define LALR_H_ @@ -33,12 +33,12 @@ # include "state.h" /* Compute how to make the finite state machine deterministic; find - which rules need lookahead in each state, and which lookahead + which rules need look-ahead in each state, and which look-ahead tokens they accept. */ void lalr (void); -/* Release the information related to lookaheads. Can be performed +/* Release the information related to look-ahead tokens. Can be performed once the action tables are computed. */ void lalr_free (void); @@ -56,8 +56,8 @@ void lalr_free (void); together and GOTO_MAP[I - NTOKENS] is the index in FROM_STATE and TO_STATE of the first of them. */ -typedef short int goto_number; -# define GOTO_NUMBER_MAXIMUM SHRT_MAX +typedef size_t goto_number; +# define GOTO_NUMBER_MAXIMUM ((goto_number) -1) extern goto_number *goto_map; extern state_number *from_state; diff --git a/src/bin/bison/src/location.c b/src/bin/bison/src/location.c index 9ba9378577..8c235bbbf9 100644 --- a/src/bin/bison/src/location.c +++ b/src/bin/bison/src/location.c @@ -15,8 +15,8 @@ You should have received a copy of the GNU General Public License along with Bison; see the file COPYING. If not, write to - the Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. */ #include "system.h" diff --git a/src/bin/bison/src/location.h b/src/bin/bison/src/location.h index f4fbb2f805..b03f6d0e69 100644 --- a/src/bin/bison/src/location.h +++ b/src/bin/bison/src/location.h @@ -1,5 +1,5 @@ /* Locations for Bison - Copyright (C) 2002 Free Software Foundation, Inc. + Copyright (C) 2002, 2004 Free Software Foundation, Inc. This file is part of Bison, the GNU Compiler Compiler. @@ -15,17 +15,19 @@ You should have received a copy of the GNU General Public License along with Bison; see the file COPYING. If not, write to - the Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. */ #ifndef LOCATION_H_ # define LOCATION_H_ +# include "uniqstr.h" + /* A boundary between two characters. */ typedef struct { /* The name of the file that contains the boundary. */ - char const *file; + uniqstr file; /* The (origin-1) line that contains the boundary. */ int line; @@ -42,7 +44,7 @@ equal_boundaries (boundary a, boundary b) { return (a.column == b.column && a.line == b.line - && a.file == b.file); + && UNIQSTR_EQ (a.file, b.file)); } /* A location, that is, a region of source code. */ diff --git a/src/bin/bison/src/main.c b/src/bin/bison/src/main.c index 87ecbaba43..08de721692 100644 --- a/src/bin/bison/src/main.c +++ b/src/bin/bison/src/main.c @@ -1,6 +1,6 @@ /* Top level entry point of Bison. - Copyright (C) 1984, 1986, 1989, 1992, 1995, 2000, 2001, 2002 + Copyright (C) 1984, 1986, 1989, 1992, 1995, 2000, 2001, 2002, 2004, 2005 Free Software Foundation, Inc. This file is part of Bison, the GNU Compiler Compiler. @@ -17,8 +17,8 @@ You should have received a copy of the GNU General Public License along with Bison; see the file COPYING. If not, write to - the Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. */ #include "system.h" @@ -57,6 +57,7 @@ main (int argc, char *argv[]) program_name = argv[0]; setlocale (LC_ALL, ""); (void) bindtextdomain (PACKAGE, LOCALEDIR); + (void) bindtextdomain ("bison-runtime", LOCALEDIR); (void) textdomain (PACKAGE); uniqstrs_new (); @@ -107,7 +108,7 @@ main (int argc, char *argv[]) timevar_pop (TV_LALR); /* Find and record any conflicts: places where one token of - lookahead is not enough to disambiguate the parsing. In file + look-ahead is not enough to disambiguate the parsing. In file conflicts. Also resolve s/r conflicts based on precedence declarations. */ timevar_push (TV_CONFLICTS); @@ -147,7 +148,7 @@ main (int argc, char *argv[]) if (complaint_issued) goto finish; - /* Lookaheads are no longer needed. */ + /* Look-ahead tokens are no longer needed. */ timevar_push (TV_FREE); lalr_free (); timevar_pop (TV_FREE); diff --git a/src/bin/bison/src/muscle_tab.c b/src/bin/bison/src/muscle_tab.c index bf5c4dd346..3e0fb289de 100644 --- a/src/bin/bison/src/muscle_tab.c +++ b/src/bin/bison/src/muscle_tab.c @@ -1,6 +1,7 @@ /* Muscle table manager for Bison. - Copyright (C) 2001, 2002, 2003, 2004 Free Software Foundation, Inc. + Copyright (C) 2001, 2002, 2003, 2004, 2005 Free Software + Foundation, Inc. This file is part of Bison, the GNU Compiler Compiler. @@ -16,8 +17,8 @@ You should have received a copy of the GNU General Public License along with Bison; see the file COPYING. If not, write to - the Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. */ #include "system.h" @@ -40,7 +41,7 @@ struct obstack muscle_obstack; /* Initial capacity of muscles hash table. */ #define HT_INITIAL_CAPACITY 257 -struct hash_table *muscle_table = NULL; +static struct hash_table *muscle_table = NULL; static bool hash_compare_muscles (void const *x, void const *y) @@ -73,7 +74,7 @@ muscle_init (void) /* Version and input file. */ MUSCLE_INSERT_STRING ("version", VERSION); - MUSCLE_INSERT_C_STRING ("filename", grammar_file); + MUSCLE_INSERT_C_STRING ("file_name", grammar_file); } @@ -99,7 +100,7 @@ void muscle_insert (const char *key, char *value) { muscle_entry probe; - muscle_entry *entry = NULL; + muscle_entry *entry; probe.key = key; entry = hash_lookup (muscle_table, &probe); @@ -107,7 +108,7 @@ muscle_insert (const char *key, char *value) if (!entry) { /* First insertion in the hash. */ - MALLOC (entry, 1); + entry = xmalloc (sizeof *entry); entry->key = key; hash_insert (muscle_table, entry); } @@ -133,7 +134,7 @@ muscle_grow (const char *key, const char *val, const char *separator) if (!entry) { /* First insertion in the hash. */ - MALLOC (entry, 1); + entry = xmalloc (sizeof *entry); entry->key = key; hash_insert (muscle_table, entry); entry->value = xstrdup (val); @@ -163,7 +164,7 @@ void muscle_code_grow (const char *key, const char *val, location loc) { char *extension = NULL; - obstack_fgrow1 (&muscle_obstack, "]b4_syncline([[%d]], [[", loc.start.line); + obstack_fgrow1 (&muscle_obstack, "]b4_syncline(%d, [[", loc.start.line); MUSCLE_OBSTACK_SGROW (&muscle_obstack, quotearg_style (c_quoting_style, loc.start.file)); obstack_sgrow (&muscle_obstack, "]])[\n"); diff --git a/src/bin/bison/src/muscle_tab.h b/src/bin/bison/src/muscle_tab.h index d4cd4b54bb..9e8ac24f24 100644 --- a/src/bin/bison/src/muscle_tab.h +++ b/src/bin/bison/src/muscle_tab.h @@ -15,8 +15,8 @@ You should have received a copy of the GNU General Public License along with Bison; see the file COPYING. If not, write to - the Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. */ #ifndef MUSCLE_TAB_H_ # define MUSCLE_TAB_H_ @@ -40,14 +40,14 @@ extern struct obstack muscle_obstack; #define MUSCLE_INSERT_INT(Key, Value) \ { \ - obstack_fgrow1 (&muscle_obstack, "%d", Value); \ + obstack_fgrow1 (&muscle_obstack, "%d", Value); \ obstack_1grow (&muscle_obstack, 0); \ muscle_insert (Key, obstack_finish (&muscle_obstack)); \ } #define MUSCLE_INSERT_LONG_INT(Key, Value) \ { \ - obstack_fgrow1 (&muscle_obstack, "%ld", Value); \ + obstack_fgrow1 (&muscle_obstack, "%ld", Value); \ obstack_1grow (&muscle_obstack, 0); \ muscle_insert (Key, obstack_finish (&muscle_obstack)); \ } diff --git a/src/bin/bison/src/nullable.c b/src/bin/bison/src/nullable.c index d65c4f2b43..e73344f828 100644 --- a/src/bin/bison/src/nullable.c +++ b/src/bin/bison/src/nullable.c @@ -17,8 +17,8 @@ You should have received a copy of the GNU General Public License along with Bison; see the file COPYING. If not, write to - the Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. */ /* Set up NULLABLE, a vector saying which nonterminals can expand into @@ -61,16 +61,16 @@ nullable_compute (void) symbol_number *s2; rule_list *p; - symbol_number *squeue = CALLOC (squeue, nvars); - short int *rcount = CALLOC (rcount, nrules); + symbol_number *squeue = xnmalloc (nvars, sizeof *squeue); + size_t *rcount = xcalloc (nrules, sizeof *rcount); /* RITEM contains all the rules, including useless productions. Hence we must allocate room for useless nonterminals too. */ - rule_list **rsets = CALLOC (rsets, nvars); + rule_list **rsets = xcalloc (nvars, sizeof *rsets); /* This is said to be more elements than we actually use. Supposedly NRITEMS - NRULES is enough. But why take the risk? */ - rule_list *relts = CALLOC (relts, nritems + nvars + 1); + rule_list *relts = xnmalloc (nritems + nvars + 1, sizeof *relts); - CALLOC (nullable, nvars); + nullable = xcalloc (nvars, sizeof *nullable); s1 = s2 = squeue; p = relts; @@ -126,10 +126,10 @@ nullable_compute (void) } } - XFREE (squeue); - XFREE (rcount); - XFREE (rsets); - XFREE (relts); + free (squeue); + free (rcount); + free (rsets); + free (relts); if (trace_flag & trace_sets) nullable_print (stderr); @@ -139,5 +139,5 @@ nullable_compute (void) void nullable_free (void) { - XFREE (nullable); + free (nullable); } diff --git a/src/bin/bison/src/nullable.h b/src/bin/bison/src/nullable.h index dbef4905b2..d5106c7e98 100644 --- a/src/bin/bison/src/nullable.h +++ b/src/bin/bison/src/nullable.h @@ -15,8 +15,8 @@ You should have received a copy of the GNU General Public License along with Bison; see the file COPYING. If not, write to - the Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. */ #ifndef NULLABLE_H_ # define NULLABLE_H_ diff --git a/src/bin/bison/src/output.c b/src/bin/bison/src/output.c index 68dd2dffbd..5b12f72806 100644 --- a/src/bin/bison/src/output.c +++ b/src/bin/bison/src/output.c @@ -1,6 +1,6 @@ /* Output the generated parsing program for Bison. - Copyright (C) 1984, 1986, 1989, 1992, 2000, 2001, 2002, 2003, 2004 + Copyright (C) 1984, 1986, 1989, 1992, 2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc. This file is part of Bison, the GNU Compiler Compiler. @@ -17,8 +17,8 @@ You should have received a copy of the GNU General Public License along with Bison; see the file COPYING. If not, write to the Free - Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - 02111-1307, USA. */ + Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA + 02110-1301, USA. */ #include "system.h" @@ -36,12 +36,10 @@ #include "muscle_tab.h" #include "output.h" #include "reader.h" +#include "scan-skel.h" #include "symtab.h" #include "tables.h" -/* From src/scan-skel.l. */ -void scan_skel (FILE *); - static struct obstack format_obstack; @@ -60,7 +58,7 @@ bool error_verbose = false; #define GENERATE_MUSCLE_INSERT_TABLE(Name, Type) \ \ static void \ -Name (const char *name, \ +Name (char const *name, \ Type *table_data, \ Type first, \ int begin, \ @@ -106,7 +104,6 @@ Name (const char *name, \ GENERATE_MUSCLE_INSERT_TABLE(muscle_insert_unsigned_int_table, unsigned int) GENERATE_MUSCLE_INSERT_TABLE(muscle_insert_int_table, int) -GENERATE_MUSCLE_INSERT_TABLE(muscle_insert_short_int_table, short int) GENERATE_MUSCLE_INSERT_TABLE(muscle_insert_base_table, base_number) GENERATE_MUSCLE_INSERT_TABLE(muscle_insert_rule_number_table, rule_number) GENERATE_MUSCLE_INSERT_TABLE(muscle_insert_symbol_number_table, symbol_number) @@ -114,17 +111,17 @@ GENERATE_MUSCLE_INSERT_TABLE(muscle_insert_item_number_table, item_number) GENERATE_MUSCLE_INSERT_TABLE(muscle_insert_state_number_table, state_number) -/*----------------------------------------------------------------------. -| Print to OUT a representation of FILENAME escaped both for C and M4. | -`----------------------------------------------------------------------*/ +/*--------------------------------------------------------------------. +| Print to OUT a representation of STRING escaped both for C and M4. | +`--------------------------------------------------------------------*/ static void -escaped_file_name_output (FILE *out, char const *filename) +escaped_output (FILE *out, char const *string) { char const *p; fprintf (out, "[["); - for (p = quotearg_style (c_quoting_style, filename); *p; p++) + for (p = quotearg_style (c_quoting_style, string); *p; p++) switch (*p) { case '$': fputs ("$][", out); break; @@ -146,6 +143,7 @@ escaped_file_name_output (FILE *out, char const *filename) static void prepare_symbols (void) { + MUSCLE_INSERT_BOOL ("token_table", token_table_flag); MUSCLE_INSERT_INT ("tokens_number", ntokens); MUSCLE_INSERT_INT ("nterms_number", nvars); MUSCLE_INSERT_INT ("undef_token_number", undeftoken->number); @@ -163,7 +161,7 @@ prepare_symbols (void) int j = 2; for (i = 0; i < nsyms; i++) { - const char *cp = quotearg_style (c_quoting_style, symbols[i]->tag); + char const *cp = quotearg_style (c_quoting_style, symbols[i]->tag); /* Width of the next token, including the two quotes, the comma and the space. */ int width = strlen (cp) + 2; @@ -192,7 +190,7 @@ prepare_symbols (void) /* Output YYTOKNUM. */ { int i; - int *values = MALLOC (values, ntokens); + int *values = xnmalloc (ntokens, sizeof *values); for (i = 0; i < ntokens; ++i) values[i] = symbols[i]->user_token_number; muscle_insert_int_table ("toknum", values, @@ -212,13 +210,13 @@ prepare_rules (void) { rule_number r; unsigned int i = 0; - item_number *rhs = MALLOC (rhs, nritems); - unsigned int *prhs = MALLOC (prhs, nrules); - unsigned int *rline = MALLOC (rline, nrules); - symbol_number *r1 = MALLOC (r1, nrules); - unsigned int *r2 = MALLOC (r2, nrules); - short int *dprec = MALLOC (dprec, nrules); - short int *merger = MALLOC (merger, nrules); + item_number *rhs = xnmalloc (nritems, sizeof *rhs); + unsigned int *prhs = xnmalloc (nrules, sizeof *prhs); + unsigned int *rline = xnmalloc (nrules, sizeof *rline); + symbol_number *r1 = xnmalloc (nrules, sizeof *r1); + unsigned int *r2 = xnmalloc (nrules, sizeof *r2); + int *dprec = xnmalloc (nrules, sizeof *dprec); + int *merger = xnmalloc (nrules, sizeof *merger); for (r = 0; r < nrules; ++r) { @@ -249,8 +247,8 @@ prepare_rules (void) muscle_insert_unsigned_int_table ("rline", rline, 0, 0, nrules); muscle_insert_symbol_number_table ("r1", r1, 0, 0, nrules); muscle_insert_unsigned_int_table ("r2", r2, 0, 0, nrules); - muscle_insert_short_int_table ("dprec", dprec, 0, 0, nrules); - muscle_insert_short_int_table ("merger", merger, 0, 0, nrules); + muscle_insert_int_table ("dprec", dprec, 0, 0, nrules); + muscle_insert_int_table ("merger", merger, 0, 0, nrules); MUSCLE_INSERT_INT ("rules_number", nrules); MUSCLE_INSERT_INT ("max_left_semantic_context", max_left_semantic_context); @@ -272,7 +270,7 @@ static void prepare_states (void) { state_number i; - symbol_number *values = MALLOC (values, nstates); + symbol_number *values = xnmalloc (nstates, sizeof *values); for (i = 0; i < nstates; ++i) values[i] = states[i]->accessing_symbol; muscle_insert_symbol_number_table ("stos", values, @@ -301,9 +299,9 @@ user_actions_output (FILE *out) { fprintf (out, " case %d:\n", r + 1); - fprintf (out, "]b4_syncline([[%d]], ", + fprintf (out, "]b4_syncline(%d, ", rules[r].action_location.start.line); - escaped_file_name_output (out, rules[r].action_location.start.file); + escaped_output (out, rules[r].action_location.start.file); fprintf (out, ")[\n"); fprintf (out, " %s\n break;\n\n", rules[r].action); @@ -376,7 +374,7 @@ token_definitions_output (FILE *out) if (strchr (sym->tag, '.') || strchr (sym->tag, '$')) continue; - fprintf (out, "%s[[[%s]], [%d]]", + fprintf (out, "%s[[[%s]], %d]", sep, sym->tag, number); sep = ",\n"; } @@ -402,16 +400,16 @@ symbol_destructors_output (FILE *out) /* Filename, lineno, Symbol-name, Symbol-number, - destructor, typename. */ + destructor, optional typename. */ fprintf (out, "%s[", sep); sep = ",\n"; - escaped_file_name_output (out, sym->destructor_location.start.file); - fprintf (out, ", [[%d]], [[%s]], [[%d]], [[%s]], [[%s]]]", - sym->destructor_location.start.line, - sym->tag, - sym->number, - sym->destructor, - sym->type_name); + escaped_output (out, sym->destructor_location.start.file); + fprintf (out, ", %d, ", sym->destructor_location.start.line); + escaped_output (out, sym->tag); + fprintf (out, ", %d, [[%s]]", sym->number, sym->destructor); + if (sym->type_name) + fprintf (out, ", [[%s]]", sym->type_name); + fputc (']', out); } fputs ("])\n\n", out); } @@ -435,16 +433,16 @@ symbol_printers_output (FILE *out) /* Filename, lineno, Symbol-name, Symbol-number, - printer, typename. */ + printer, optional typename. */ fprintf (out, "%s[", sep); sep = ",\n"; - escaped_file_name_output (out, sym->printer_location.start.file); - fprintf (out, ", [[%d]], [[%s]], [[%d]], [[%s]], [[%s]]]", - sym->printer_location.start.line, - sym->tag, - sym->number, - sym->printer, - sym->type_name); + escaped_output (out, sym->printer_location.start.file); + fprintf (out, ", %d, ", sym->printer_location.start.line); + escaped_output (out, sym->tag); + fprintf (out, ", %d, [[%s]]", sym->number, sym->printer); + if (sym->type_name) + fprintf (out, ", [[%s]]", sym->type_name); + fputc (']', out); } fputs ("])\n\n", out); } @@ -454,7 +452,7 @@ static void prepare_actions (void) { /* Figure out the actions for the specified state, indexed by - lookahead token type. */ + look-ahead token type. */ muscle_insert_rule_number_table ("defact", yydefact, yydefact[0], 1, nstates); @@ -494,7 +492,7 @@ prepare_actions (void) muscle_insert_unsigned_int_table ("conflict_list_heads", conflict_table, conflict_table[0], 1, high + 1); muscle_insert_unsigned_int_table ("conflicting_rules", conflict_list, - conflict_list[0], 1, conflict_list_cnt); + 0, 1, conflict_list_cnt); } @@ -559,7 +557,8 @@ output_skeleton (void) out = fdopen (filter_fd[0], "w"); if (! out) - error (EXIT_FAILURE, get_errno (), "fdopen"); + error (EXIT_FAILURE, get_errno (), + "fdopen"); /* Output the definitions of all the muscles. */ fputs ("m4_init()\n", out); @@ -580,7 +579,8 @@ output_skeleton (void) timevar_push (TV_M4); in = fdopen (filter_fd[1], "r"); if (! in) - error (EXIT_FAILURE, get_errno (), "fdopen"); + error (EXIT_FAILURE, get_errno (), + "fdopen"); scan_skel (in); xfclose (in); reap_subpipe (pid, m4); @@ -616,8 +616,12 @@ prepare (void) skeleton = "yacc.c"; } - /* Parse the skeleton file and output the needed parsers. */ - MUSCLE_INSERT_C_STRING ("skeleton", skeleton); + /* About the skeletons. */ + { + char const *pkgdatadir = getenv ("BISON_PKGDATADIR"); + MUSCLE_INSERT_STRING ("pkgdatadir", pkgdatadir ? pkgdatadir : PKGDATADIR); + MUSCLE_INSERT_C_STRING ("skeleton", skeleton); + } } diff --git a/src/bin/bison/src/output.h b/src/bin/bison/src/output.h index de69e6afb2..0f16e874d9 100644 --- a/src/bin/bison/src/output.h +++ b/src/bin/bison/src/output.h @@ -15,8 +15,8 @@ You should have received a copy of the GNU General Public License along with Bison; see the file COPYING. If not, write to the Free - Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - 02111-1307, USA. */ + Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA + 02110-1301, USA. */ #ifndef OUTPUT_H_ # define OUTPUT_H_ diff --git a/src/bin/bison/src/parse-gram.c b/src/bin/bison/src/parse-gram.c index 5597ab162c..35492f567b 100644 --- a/src/bin/bison/src/parse-gram.c +++ b/src/bin/bison/src/parse-gram.c @@ -1,7 +1,7 @@ -/* A Bison parser, made by GNU Bison 1.875d. */ +/* A Bison parser, made by GNU Bison 2.1. */ /* Skeleton parser for Yacc-like parsing with Bison, - Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc. + Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -15,8 +15,8 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ + Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. */ /* As a special exception, when this file is copied by Bison into a Bison output file, you may use that output file without restriction. @@ -36,6 +36,9 @@ /* Identify Bison output. */ #define YYBISON 1 +/* Bison version. */ +#define YYBISON_VERSION "2.1" + /* Skeleton name. */ #define YYSKELETON_NAME "yacc.c" @@ -45,8 +48,7 @@ /* Using locations. */ #define YYLSP_NEEDED 1 -/* If NAME_PREFIX is specified substitute the variables and functions - names. */ +/* Substitute the variable and function names. */ #define yyparse gram_parse #define yylex gram_lex #define yyerror gram_error @@ -113,6 +115,7 @@ BRACED_CODE = 305 }; #endif +/* Tokens. */ #define GRAM_EOF 0 #define STRING 258 #define INT 259 @@ -170,7 +173,7 @@ #line 1 "parse-gram.y" /* Bison Grammar Parser -*- C -*- - Copyright (C) 2002, 2003, 2004 Free Software Foundation, Inc. + Copyright (C) 2002, 2003, 2004, 2005 Free Software Foundation, Inc. This file is part of Bison, the GNU Compiler Compiler. @@ -186,8 +189,8 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA - 02111-1307 USA + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA + 02110-1301 USA */ #include "system.h" @@ -199,12 +202,16 @@ #include "gram.h" #include "muscle_tab.h" #include "output.h" +#include "quotearg.h" #include "reader.h" #include "symlist.h" #define YYLLOC_DEFAULT(Current, Rhs, N) (Current) = lloc_default (Rhs, N) static YYLTYPE lloc_default (YYLTYPE const *, int); +#define YY_LOCATION_PRINT(File, Loc) \ + location_print (File, Loc) + /* Request detailed syntax error messages, and pass them to GRAM_ERROR. FIXME: depends on the undocumented availability of YYLLOC. */ #undef yyerror @@ -212,18 +219,14 @@ static YYLTYPE lloc_default (YYLTYPE const *, int); gram_error (&yylloc, Msg) static void gram_error (location const *, char const *); -#define YYPRINT(File, Type, Value) \ - print_token_value (File, Type, &Value) -static void print_token_value (FILE *, int, YYSTYPE const *); - static void add_param (char const *, char *, location); -symbol_class current_class = unknown_sym; -uniqstr current_type = 0; +static symbol_class current_class = unknown_sym; +static uniqstr current_type = 0; symbol *current_lhs; location current_lhs_location; assoc current_assoc; -int current_prec = 0; +static int current_prec = 0; /* Enabling traces. */ @@ -239,8 +242,13 @@ int current_prec = 0; # define YYERROR_VERBOSE 1 #endif +/* Enabling the token table. */ +#ifndef YYTOKEN_TABLE +# define YYTOKEN_TABLE 0 +#endif + #if ! defined (YYSTYPE) && ! defined (YYSTYPE_IS_DECLARED) -#line 78 "parse-gram.y" +#line 79 "parse-gram.y" typedef union YYSTYPE { symbol *symbol; symbol_list *list; @@ -249,8 +257,8 @@ typedef union YYSTYPE { assoc assoc; uniqstr uniqstr; } YYSTYPE; -/* Line 191 of yacc.c. */ -#line 254 "parse-gram.c" +/* Line 196 of yacc.c. */ +#line 262 "parse-gram.c" # define yystype YYSTYPE /* obsolescent; will be withdrawn */ # define YYSTYPE_IS_DECLARED 1 # define YYSTYPE_IS_TRIVIAL 1 @@ -273,30 +281,49 @@ typedef struct YYLTYPE /* Copy the second part of user declarations. */ -/* Line 214 of yacc.c. */ -#line 278 "parse-gram.c" +/* Line 219 of yacc.c. */ +#line 286 "parse-gram.c" + +#if ! defined (YYSIZE_T) && defined (__SIZE_TYPE__) +# define YYSIZE_T __SIZE_TYPE__ +#endif +#if ! defined (YYSIZE_T) && defined (size_t) +# define YYSIZE_T size_t +#endif +#if ! defined (YYSIZE_T) && (defined (__STDC__) || defined (__cplusplus)) +# include /* INFRINGES ON USER NAME SPACE */ +# define YYSIZE_T size_t +#endif +#if ! defined (YYSIZE_T) +# define YYSIZE_T unsigned int +#endif + +#ifndef YY_ +# if YYENABLE_NLS +# if ENABLE_NLS +# include /* INFRINGES ON USER NAME SPACE */ +# define YY_(msgid) dgettext ("bison-runtime", msgid) +# endif +# endif +# ifndef YY_ +# define YY_(msgid) msgid +# endif +#endif #if ! defined (yyoverflow) || YYERROR_VERBOSE -# ifndef YYFREE -# define YYFREE free -# endif -# ifndef YYMALLOC -# define YYMALLOC malloc -# endif - /* The parser invokes alloca or malloc; define the necessary symbols. */ # ifdef YYSTACK_USE_ALLOCA # if YYSTACK_USE_ALLOCA -# define YYSTACK_ALLOC alloca -# endif -# else -# if defined (alloca) || defined (_ALLOCA_H) -# define YYSTACK_ALLOC alloca -# else # ifdef __GNUC__ # define YYSTACK_ALLOC __builtin_alloca +# else +# define YYSTACK_ALLOC alloca +# if defined (__STDC__) || defined (__cplusplus) +# include /* INFRINGES ON USER NAME SPACE */ +# define YYINCLUDED_STDLIB_H +# endif # endif # endif # endif @@ -304,13 +331,39 @@ typedef struct YYLTYPE # ifdef YYSTACK_ALLOC /* Pacify GCC's `empty if-body' warning. */ # define YYSTACK_FREE(Ptr) do { /* empty */; } while (0) -# else -# if defined (__STDC__) || defined (__cplusplus) -# include /* INFRINGES ON USER NAME SPACE */ -# define YYSIZE_T size_t +# ifndef YYSTACK_ALLOC_MAXIMUM + /* The OS might guarantee only one guard page at the bottom of the stack, + and a page size can be as small as 4096 bytes. So we cannot safely + invoke alloca (N) if N exceeds 4096. Use a slightly smaller number + to allow for a few compiler-allocated temporary stack slots. */ +# define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2005 */ # endif +# else # define YYSTACK_ALLOC YYMALLOC # define YYSTACK_FREE YYFREE +# ifndef YYSTACK_ALLOC_MAXIMUM +# define YYSTACK_ALLOC_MAXIMUM ((YYSIZE_T) -1) +# endif +# ifdef __cplusplus +extern "C" { +# endif +# ifndef YYMALLOC +# define YYMALLOC malloc +# if (! defined (malloc) && ! defined (YYINCLUDED_STDLIB_H) \ + && (defined (__STDC__) || defined (__cplusplus))) +void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */ +# endif +# endif +# ifndef YYFREE +# define YYFREE free +# if (! defined (free) && ! defined (YYINCLUDED_STDLIB_H) \ + && (defined (__STDC__) || defined (__cplusplus))) +void free (void *); /* INFRINGES ON USER NAME SPACE */ +# endif +# endif +# ifdef __cplusplus +} +# endif # endif #endif /* ! defined (yyoverflow) || YYERROR_VERBOSE */ @@ -347,7 +400,7 @@ union yyalloc # define YYCOPY(To, From, Count) \ do \ { \ - register YYSIZE_T yyi; \ + YYSIZE_T yyi; \ for (yyi = 0; yyi < (Count); yyi++) \ (To)[yyi] = (From)[yyi]; \ } \ @@ -397,7 +450,7 @@ union yyalloc #define YYUNDEFTOK 2 #define YYMAXUTOK 305 -#define YYTRANSLATE(YYX) \ +#define YYTRANSLATE(YYX) \ ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK) /* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */ @@ -480,19 +533,19 @@ static const yysigned_char yyrhs[] = /* YYRLINE[YYN] -- source line where rule number YYN was defined. */ static const unsigned short int yyrline[] = { - 0, 171, 171, 179, 181, 185, 186, 187, 188, 189, - 190, 191, 192, 193, 194, 199, 203, 204, 205, 206, - 207, 208, 209, 210, 211, 212, 213, 214, 215, 219, - 220, 221, 225, 231, 238, 245, 249, 256, 256, 261, - 261, 266, 276, 291, 292, 293, 297, 298, 304, 305, - 310, 314, 319, 325, 331, 342, 343, 352, 353, 359, - 360, 365, 372, 372, 376, 377, 378, 383, 384, 386, - 388, 390, 392, 397, 398, 402, 408, 417, 424, 426 + 0, 188, 188, 196, 198, 202, 203, 204, 205, 206, + 207, 208, 209, 210, 211, 216, 220, 221, 222, 223, + 224, 225, 226, 227, 228, 229, 230, 231, 232, 236, + 237, 238, 242, 248, 255, 262, 266, 273, 273, 278, + 278, 283, 293, 308, 309, 310, 314, 315, 321, 322, + 327, 331, 336, 342, 348, 359, 360, 369, 370, 376, + 377, 382, 389, 389, 393, 394, 395, 400, 401, 403, + 405, 407, 409, 414, 415, 419, 425, 434, 439, 441 }; #endif -#if YYDEBUG || YYERROR_VERBOSE -/* YYTNME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM. +#if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE +/* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM. First, the terminals, then, starting at YYNTOKENS, nonterminals. */ static const char *const yytname[] = { @@ -671,22 +724,6 @@ static const unsigned char yystos[] = 16, 50, 71, 72, 70, 71, 4, 41 }; -#if ! defined (YYSIZE_T) && defined (__SIZE_TYPE__) -# define YYSIZE_T __SIZE_TYPE__ -#endif -#if ! defined (YYSIZE_T) && defined (size_t) -# define YYSIZE_T size_t -#endif -#if ! defined (YYSIZE_T) -# if defined (__STDC__) || defined (__cplusplus) -# include /* INFRINGES ON USER NAME SPACE */ -# define YYSIZE_T size_t -# endif -#endif -#if ! defined (YYSIZE_T) -# define YYSIZE_T unsigned int -#endif - #define yyerrok (yyerrstatus = 0) #define yyclearin (yychar = YYEMPTY) #define YYEMPTY (-2) @@ -716,26 +753,59 @@ do \ goto yybackup; \ } \ else \ - { \ - yyerror ("syntax error: cannot back up");\ + { \ + yyerror (YY_("syntax error: cannot back up")); \ YYERROR; \ } \ while (0) + #define YYTERROR 1 #define YYERRCODE 256 -/* YYLLOC_DEFAULT -- Compute the default location (before the actions - are run). */ +/* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N]. + If N is 0, then set CURRENT to the empty location which ends + the previous symbol: RHS[0] (always defined). */ + +#define YYRHSLOC(Rhs, K) ((Rhs)[K]) #ifndef YYLLOC_DEFAULT -# define YYLLOC_DEFAULT(Current, Rhs, N) \ - ((Current).first_line = (Rhs)[1].first_line, \ - (Current).first_column = (Rhs)[1].first_column, \ - (Current).last_line = (Rhs)[N].last_line, \ - (Current).last_column = (Rhs)[N].last_column) +# define YYLLOC_DEFAULT(Current, Rhs, N) \ + do \ + if (N) \ + { \ + (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \ + (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \ + (Current).last_line = YYRHSLOC (Rhs, N).last_line; \ + (Current).last_column = YYRHSLOC (Rhs, N).last_column; \ + } \ + else \ + { \ + (Current).first_line = (Current).last_line = \ + YYRHSLOC (Rhs, 0).last_line; \ + (Current).first_column = (Current).last_column = \ + YYRHSLOC (Rhs, 0).last_column; \ + } \ + while (0) #endif + +/* YY_LOCATION_PRINT -- Print the location on the stream. + This macro was not mandated originally: define only if we know + we won't break user code: when these are the locations we know. */ + +#ifndef YY_LOCATION_PRINT +# if YYLTYPE_IS_TRIVIAL +# define YY_LOCATION_PRINT(File, Loc) \ + fprintf (File, "%d.%d-%d.%d", \ + (Loc).first_line, (Loc).first_column, \ + (Loc).last_line, (Loc).last_column) +# else +# define YY_LOCATION_PRINT(File, Loc) ((void) 0) +# endif +#endif + + /* YYLEX -- calling `yylex' with the right arguments. */ #ifdef YYLEX_PARAM @@ -758,19 +828,13 @@ do { \ YYFPRINTF Args; \ } while (0) -# define YYDSYMPRINT(Args) \ -do { \ - if (yydebug) \ - yysymprint Args; \ -} while (0) - -# define YYDSYMPRINTF(Title, Token, Value, Location) \ +# define YY_SYMBOL_PRINT(Title, Type, Value, Location) \ do { \ if (yydebug) \ { \ YYFPRINTF (stderr, "%s ", Title); \ - yysymprint (stderr, \ - Token, Value, Location); \ + yysymprint (stderr, \ + Type, Value, Location); \ YYFPRINTF (stderr, "\n"); \ } \ } while (0) @@ -817,13 +881,13 @@ yy_reduce_print (yyrule) #endif { int yyi; - unsigned int yylno = yyrline[yyrule]; - YYFPRINTF (stderr, "Reducing stack by rule %d (line %u), ", + unsigned long int yylno = yyrline[yyrule]; + YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu), ", yyrule - 1, yylno); /* Print the symbols being reduced, and their result. */ for (yyi = yyprhs[yyrule]; 0 <= yyrhs[yyi]; yyi++) - YYFPRINTF (stderr, "%s ", yytname [yyrhs[yyi]]); - YYFPRINTF (stderr, "-> %s\n", yytname [yyr1[yyrule]]); + YYFPRINTF (stderr, "%s ", yytname[yyrhs[yyi]]); + YYFPRINTF (stderr, "-> %s\n", yytname[yyr1[yyrule]]); } # define YY_REDUCE_PRINT(Rule) \ @@ -837,8 +901,7 @@ do { \ int yydebug; #else /* !YYDEBUG */ # define YYDPRINTF(Args) -# define YYDSYMPRINT(Args) -# define YYDSYMPRINTF(Title, Token, Value, Location) +# define YY_SYMBOL_PRINT(Title, Type, Value, Location) # define YY_STACK_PRINT(Bottom, Top) # define YY_REDUCE_PRINT(Rule) #endif /* !YYDEBUG */ @@ -853,13 +916,9 @@ int yydebug; if the built-in stack extension method is used). Do not make this value too large; the results are undefined if - SIZE_MAX < YYSTACK_BYTES (YYMAXDEPTH) + YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH) evaluated with infinite-precision integer arithmetic. */ -#if defined (YYMAXDEPTH) && YYMAXDEPTH == 0 -# undef YYMAXDEPTH -#endif - #ifndef YYMAXDEPTH # define YYMAXDEPTH 10000 #endif @@ -881,7 +940,7 @@ yystrlen (yystr) const char *yystr; # endif { - register const char *yys = yystr; + const char *yys = yystr; while (*yys++ != '\0') continue; @@ -906,8 +965,8 @@ yystpcpy (yydest, yysrc) const char *yysrc; # endif { - register char *yyd = yydest; - register const char *yys = yysrc; + char *yyd = yydest; + const char *yys = yysrc; while ((*yyd++ = *yys++) != '\0') continue; @@ -917,7 +976,55 @@ yystpcpy (yydest, yysrc) # endif # endif -#endif /* !YYERROR_VERBOSE */ +# ifndef yytnamerr +/* Copy to YYRES the contents of YYSTR after stripping away unnecessary + quotes and backslashes, so that it's suitable for yyerror. The + heuristic is that double-quoting is unnecessary unless the string + contains an apostrophe, a comma, or backslash (other than + backslash-backslash). YYSTR is taken from yytname. If YYRES is + null, do not copy; instead, return the length of what the result + would have been. */ +static YYSIZE_T +yytnamerr (char *yyres, const char *yystr) +{ + if (*yystr == '"') + { + size_t yyn = 0; + char const *yyp = yystr; + + for (;;) + switch (*++yyp) + { + case '\'': + case ',': + goto do_not_strip_quotes; + + case '\\': + if (*++yyp != '\\') + goto do_not_strip_quotes; + /* Fall through. */ + default: + if (yyres) + yyres[yyn] = *yyp; + yyn++; + break; + + case '"': + if (yyres) + yyres[yyn] = '\0'; + return yyn; + } + do_not_strip_quotes: ; + } + + if (! yyres) + return yystrlen (yystr); + + return yystpcpy (yyres, yystr) - yyres; +} +# endif + +#endif /* YYERROR_VERBOSE */ @@ -943,17 +1050,109 @@ yysymprint (yyoutput, yytype, yyvaluep, yylocationp) (void) yylocationp; if (yytype < YYNTOKENS) - { - YYFPRINTF (yyoutput, "token %s (", yytname[yytype]); -# ifdef YYPRINT - YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep); -# endif - } + YYFPRINTF (yyoutput, "token %s (", yytname[yytype]); else YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]); + YY_LOCATION_PRINT (yyoutput, *yylocationp); + YYFPRINTF (yyoutput, ": "); + +# ifdef YYPRINT + if (yytype < YYNTOKENS) + YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep); +# endif switch (yytype) { + case 3: /* "\"string\"" */ +#line 165 "parse-gram.y" + { fprintf (stderr, "\"%s\"", (yyvaluep->chars)); }; +#line 1070 "parse-gram.c" + break; + case 4: /* "\"integer\"" */ +#line 178 "parse-gram.y" + { fprintf (stderr, "%d", (yyvaluep->integer)); }; +#line 1075 "parse-gram.c" + break; + case 8: /* "\"%destructor {...}\"" */ +#line 167 "parse-gram.y" + { fprintf (stderr, "{\n%s\n}", (yyvaluep->chars)); }; +#line 1080 "parse-gram.c" + break; + case 9: /* "\"%printer {...}\"" */ +#line 171 "parse-gram.y" + { fprintf (stderr, "{\n%s\n}", (yyvaluep->chars)); }; +#line 1085 "parse-gram.c" + break; + case 10: /* "\"%union {...}\"" */ +#line 172 "parse-gram.y" + { fprintf (stderr, "{\n%s\n}", (yyvaluep->chars)); }; +#line 1090 "parse-gram.c" + break; + case 26: /* "\"%initial-action {...}\"" */ +#line 168 "parse-gram.y" + { fprintf (stderr, "{\n%s\n}", (yyvaluep->chars)); }; +#line 1095 "parse-gram.c" + break; + case 27: /* "\"%lex-param {...}\"" */ +#line 169 "parse-gram.y" + { fprintf (stderr, "{\n%s\n}", (yyvaluep->chars)); }; +#line 1100 "parse-gram.c" + break; + case 34: /* "\"%parse-param {...}\"" */ +#line 170 "parse-gram.y" + { fprintf (stderr, "{\n%s\n}", (yyvaluep->chars)); }; +#line 1105 "parse-gram.c" + break; + case 41: /* "\"type\"" */ +#line 176 "parse-gram.y" + { fprintf (stderr, "<%s>", (yyvaluep->uniqstr)); }; +#line 1110 "parse-gram.c" + break; + case 45: /* "\"identifier\"" */ +#line 180 "parse-gram.y" + { fprintf (stderr, "%s", (yyvaluep->symbol)->tag); }; +#line 1115 "parse-gram.c" + break; + case 46: /* "\"identifier:\"" */ +#line 182 "parse-gram.y" + { fprintf (stderr, "%s:", (yyvaluep->symbol)->tag); }; +#line 1120 "parse-gram.c" + break; + case 48: /* "\"%{...%}\"" */ +#line 174 "parse-gram.y" + { fprintf (stderr, "{\n%s\n}", (yyvaluep->chars)); }; +#line 1125 "parse-gram.c" + break; + case 49: /* "\"epilogue\"" */ +#line 174 "parse-gram.y" + { fprintf (stderr, "{\n%s\n}", (yyvaluep->chars)); }; +#line 1130 "parse-gram.c" + break; + case 50: /* "\"{...}\"" */ +#line 173 "parse-gram.y" + { fprintf (stderr, "{\n%s\n}", (yyvaluep->chars)); }; +#line 1135 "parse-gram.c" + break; + case 71: /* "symbol" */ +#line 180 "parse-gram.y" + { fprintf (stderr, "%s", (yyvaluep->symbol)->tag); }; +#line 1140 "parse-gram.c" + break; + case 72: /* "action" */ +#line 173 "parse-gram.y" + { fprintf (stderr, "{\n%s\n}", (yyvaluep->chars)); }; +#line 1145 "parse-gram.c" + break; + case 73: /* "string_as_id" */ +#line 180 "parse-gram.y" + { fprintf (stderr, "%s", (yyvaluep->symbol)->tag); }; +#line 1150 "parse-gram.c" + break; + case 74: /* "string_content" */ +#line 165 "parse-gram.y" + { fprintf (stderr, "\"%s\"", (yyvaluep->chars)); }; +#line 1155 "parse-gram.c" + break; default: break; } @@ -967,10 +1166,11 @@ yysymprint (yyoutput, yytype, yyvaluep, yylocationp) #if defined (__STDC__) || defined (__cplusplus) static void -yydestruct (int yytype, YYSTYPE *yyvaluep, YYLTYPE *yylocationp) +yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep, YYLTYPE *yylocationp) #else static void -yydestruct (yytype, yyvaluep, yylocationp) +yydestruct (yymsg, yytype, yyvaluep, yylocationp) + const char *yymsg; int yytype; YYSTYPE *yyvaluep; YYLTYPE *yylocationp; @@ -980,6 +1180,10 @@ yydestruct (yytype, yyvaluep, yylocationp) (void) yyvaluep; (void) yylocationp; + if (!yymsg) + yymsg = "Deleting"; + YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp); + switch (yytype) { @@ -1028,27 +1232,27 @@ yyparse (void) #else int yyparse () - + ; #endif #endif { - /* The lookahead symbol. */ + /* The look-ahead symbol. */ int yychar; -/* The semantic value of the lookahead symbol. */ +/* The semantic value of the look-ahead symbol. */ YYSTYPE yylval; /* Number of syntax errors so far. */ int yynerrs; -/* Location data for the lookahead symbol. */ +/* Location data for the look-ahead symbol. */ YYLTYPE yylloc; - register int yystate; - register int yyn; + int yystate; + int yyn; int yyresult; /* Number of tokens to shift before error messages enabled. */ int yyerrstatus; - /* Lookahead token as an internal (translated) token number. */ + /* Look-ahead token as an internal (translated) token number. */ int yytoken = 0; /* Three stacks and their tools: @@ -1062,18 +1266,19 @@ YYLTYPE yylloc; /* The state stack. */ short int yyssa[YYINITDEPTH]; short int *yyss = yyssa; - register short int *yyssp; + short int *yyssp; /* The semantic value stack. */ YYSTYPE yyvsa[YYINITDEPTH]; YYSTYPE *yyvs = yyvsa; - register YYSTYPE *yyvsp; + YYSTYPE *yyvsp; /* The location stack. */ YYLTYPE yylsa[YYINITDEPTH]; YYLTYPE *yyls = yylsa; YYLTYPE *yylsp; - YYLTYPE *yylerrsp; + /* The locations where the error started and ended. */ + YYLTYPE yyerror_range[2]; #define YYPOPSTACK (yyvsp--, yyssp--, yylsp--) @@ -1103,18 +1308,25 @@ YYLTYPE yylloc; yyssp = yyss; yyvsp = yyvs; yylsp = yyls; +#if YYLTYPE_IS_TRIVIAL + /* Initialize the default location before parsing starts. */ + yylloc.first_line = yylloc.last_line = 1; + yylloc.first_column = yylloc.last_column = 0; +#endif + /* User initialization code. */ - #line 68 "parse-gram.y" +#line 69 "parse-gram.y" { /* Bison's grammar can initial empty locations, hence a default location is needed. */ - (*yylsp).start.file = (*yylsp).end.file = current_file; - (*yylsp).start.line = (*yylsp).end.line = 1; - (*yylsp).start.column = (*yylsp).end.column = 0; + yylloc.start.file = yylloc.end.file = current_file; + yylloc.start.line = yylloc.end.line = 1; + yylloc.start.column = yylloc.end.column = 0; } -/* Line 818 of yacc.c. */ -#line 1118 "parse-gram.c" +/* Line 930 of yacc.c. */ +#line 1329 "parse-gram.c" + yylsp[0] = yylloc; goto yysetstate; /*------------------------------------------------------------. @@ -1147,7 +1359,7 @@ YYLTYPE yylloc; data in use in that stack, in bytes. This used to be a conditional around just the two extra args, but that might be undefined if yyoverflow is a macro. */ - yyoverflow ("parser stack overflow", + yyoverflow (YY_("memory exhausted"), &yyss1, yysize * sizeof (*yyssp), &yyvs1, yysize * sizeof (*yyvsp), &yyls1, yysize * sizeof (*yylsp), @@ -1158,11 +1370,11 @@ YYLTYPE yylloc; } #else /* no yyoverflow */ # ifndef YYSTACK_RELOCATE - goto yyoverflowlab; + goto yyexhaustedlab; # else /* Extend the stack our own way. */ if (YYMAXDEPTH <= yystacksize) - goto yyoverflowlab; + goto yyexhaustedlab; yystacksize *= 2; if (YYMAXDEPTH < yystacksize) yystacksize = YYMAXDEPTH; @@ -1172,7 +1384,7 @@ YYLTYPE yylloc; union yyalloc *yyptr = (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize)); if (! yyptr) - goto yyoverflowlab; + goto yyexhaustedlab; YYSTACK_RELOCATE (yyss); YYSTACK_RELOCATE (yyvs); YYSTACK_RELOCATE (yyls); @@ -1204,18 +1416,18 @@ YYLTYPE yylloc; yybackup: /* Do appropriate processing given the current state. */ -/* Read a lookahead token if we need one and don't already have one. */ +/* Read a look-ahead token if we need one and don't already have one. */ /* yyresume: */ - /* First try to decide what to do without reference to lookahead token. */ + /* First try to decide what to do without reference to look-ahead token. */ yyn = yypact[yystate]; if (yyn == YYPACT_NINF) goto yydefault; - /* Not known => get a lookahead token if don't already have one. */ + /* Not known => get a look-ahead token if don't already have one. */ - /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol. */ + /* YYCHAR is either YYEMPTY or YYEOF or a valid look-ahead symbol. */ if (yychar == YYEMPTY) { YYDPRINTF ((stderr, "Reading a token: ")); @@ -1230,7 +1442,7 @@ yybackup: else { yytoken = YYTRANSLATE (yychar); - YYDSYMPRINTF ("Next token is", yytoken, &yylval, &yylloc); + YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc); } /* If the proper action on seeing token YYTOKEN is to reduce or to @@ -1250,8 +1462,8 @@ yybackup: if (yyn == YYFINAL) YYACCEPT; - /* Shift the lookahead token. */ - YYDPRINTF ((stderr, "Shifting token %s, ", yytname[yytoken])); + /* Shift the look-ahead token. */ + YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc); /* Discard the token being shifted unless it is eof. */ if (yychar != YYEOF) @@ -1302,47 +1514,47 @@ yyreduce: switch (yyn) { case 6: -#line 186 "parse-gram.y" - { prologue_augment (yyvsp[0].chars, yylsp[0]); } +#line 203 "parse-gram.y" + { prologue_augment ((yyvsp[0].chars), (yylsp[0])); } break; case 7: -#line 187 "parse-gram.y" +#line 204 "parse-gram.y" { debug_flag = true; } break; case 8: -#line 188 "parse-gram.y" - { muscle_insert (yyvsp[-1].chars, yyvsp[0].chars); } +#line 205 "parse-gram.y" + { muscle_insert ((yyvsp[-1].chars), (yyvsp[0].chars)); } break; case 9: -#line 189 "parse-gram.y" +#line 206 "parse-gram.y" { defines_flag = true; } break; case 10: -#line 190 "parse-gram.y" +#line 207 "parse-gram.y" { error_verbose = true; } break; case 11: -#line 191 "parse-gram.y" - { expected_sr_conflicts = yyvsp[0].integer; } +#line 208 "parse-gram.y" + { expected_sr_conflicts = (yyvsp[0].integer); } break; case 12: -#line 192 "parse-gram.y" - { expected_rr_conflicts = yyvsp[0].integer; } +#line 209 "parse-gram.y" + { expected_rr_conflicts = (yyvsp[0].integer); } break; case 13: -#line 193 "parse-gram.y" - { spec_file_prefix = yyvsp[0].chars; } +#line 210 "parse-gram.y" + { spec_file_prefix = (yyvsp[0].chars); } break; case 14: -#line 195 "parse-gram.y" +#line 212 "parse-gram.y" { nondeterministic_parser = true; glr_parser = true; @@ -1350,129 +1562,129 @@ yyreduce: break; case 15: -#line 200 "parse-gram.y" +#line 217 "parse-gram.y" { - muscle_code_grow ("initial_action", yyvsp[0].chars, yylsp[0]); + muscle_code_grow ("initial_action", (yyvsp[0].chars), (yylsp[0])); } break; case 16: -#line 203 "parse-gram.y" - { add_param ("lex_param", yyvsp[0].chars, yylsp[0]); } +#line 220 "parse-gram.y" + { add_param ("lex_param", (yyvsp[0].chars), (yylsp[0])); } break; case 17: -#line 204 "parse-gram.y" +#line 221 "parse-gram.y" { locations_flag = true; } break; case 18: -#line 205 "parse-gram.y" - { spec_name_prefix = yyvsp[0].chars; } +#line 222 "parse-gram.y" + { spec_name_prefix = (yyvsp[0].chars); } break; case 19: -#line 206 "parse-gram.y" +#line 223 "parse-gram.y" { no_lines_flag = true; } break; case 20: -#line 207 "parse-gram.y" +#line 224 "parse-gram.y" { nondeterministic_parser = true; } break; case 21: -#line 208 "parse-gram.y" - { spec_outfile = yyvsp[0].chars; } +#line 225 "parse-gram.y" + { spec_outfile = (yyvsp[0].chars); } break; case 22: -#line 209 "parse-gram.y" - { add_param ("parse_param", yyvsp[0].chars, yylsp[0]); } +#line 226 "parse-gram.y" + { add_param ("parse_param", (yyvsp[0].chars), (yylsp[0])); } break; case 23: -#line 210 "parse-gram.y" +#line 227 "parse-gram.y" { pure_parser = true; } break; case 24: -#line 211 "parse-gram.y" - { skeleton = yyvsp[0].chars; } +#line 228 "parse-gram.y" + { skeleton = (yyvsp[0].chars); } break; case 25: -#line 212 "parse-gram.y" +#line 229 "parse-gram.y" { token_table_flag = true; } break; case 26: -#line 213 "parse-gram.y" +#line 230 "parse-gram.y" { report_flag = report_states; } break; case 27: -#line 214 "parse-gram.y" +#line 231 "parse-gram.y" { yacc_flag = true; } break; case 31: -#line 222 "parse-gram.y" +#line 239 "parse-gram.y" { - grammar_start_symbol_set (yyvsp[0].symbol, yylsp[0]); + grammar_start_symbol_set ((yyvsp[0].symbol), (yylsp[0])); } break; case 32: -#line 226 "parse-gram.y" +#line 243 "parse-gram.y" { typed = true; - MUSCLE_INSERT_INT ("stype_line", yylsp[0].start.line); - muscle_insert ("stype", yyvsp[0].chars); + MUSCLE_INSERT_INT ("stype_line", (yylsp[0]).start.line); + muscle_insert ("stype", (yyvsp[0].chars)); } break; case 33: -#line 232 "parse-gram.y" +#line 249 "parse-gram.y" { symbol_list *list; - for (list = yyvsp[0].list; list; list = list->next) - symbol_destructor_set (list->sym, yyvsp[-1].chars, yylsp[-1]); - symbol_list_free (yyvsp[0].list); + for (list = (yyvsp[0].list); list; list = list->next) + symbol_destructor_set (list->sym, (yyvsp[-1].chars), (yylsp[-1])); + symbol_list_free ((yyvsp[0].list)); } break; case 34: -#line 239 "parse-gram.y" +#line 256 "parse-gram.y" { symbol_list *list; - for (list = yyvsp[0].list; list; list = list->next) - symbol_printer_set (list->sym, yyvsp[-1].chars, list->location); - symbol_list_free (yyvsp[0].list); + for (list = (yyvsp[0].list); list; list = list->next) + symbol_printer_set (list->sym, (yyvsp[-1].chars), list->location); + symbol_list_free ((yyvsp[0].list)); } break; case 35: -#line 246 "parse-gram.y" +#line 263 "parse-gram.y" { default_prec = true; } break; case 36: -#line 250 "parse-gram.y" +#line 267 "parse-gram.y" { default_prec = false; } break; case 37: -#line 256 "parse-gram.y" +#line 273 "parse-gram.y" { current_class = nterm_sym; } break; case 38: -#line 257 "parse-gram.y" +#line 274 "parse-gram.y" { current_class = unknown_sym; current_type = NULL; @@ -1480,12 +1692,12 @@ yyreduce: break; case 39: -#line 261 "parse-gram.y" +#line 278 "parse-gram.y" { current_class = token_sym; } break; case 40: -#line 262 "parse-gram.y" +#line 279 "parse-gram.y" { current_class = unknown_sym; current_type = NULL; @@ -1493,212 +1705,210 @@ yyreduce: break; case 41: -#line 267 "parse-gram.y" +#line 284 "parse-gram.y" { symbol_list *list; - for (list = yyvsp[0].list; list; list = list->next) - symbol_type_set (list->sym, yyvsp[-1].uniqstr, yylsp[-1]); - symbol_list_free (yyvsp[0].list); + for (list = (yyvsp[0].list); list; list = list->next) + symbol_type_set (list->sym, (yyvsp[-1].uniqstr), (yylsp[-1])); + symbol_list_free ((yyvsp[0].list)); } break; case 42: -#line 277 "parse-gram.y" +#line 294 "parse-gram.y" { symbol_list *list; ++current_prec; - for (list = yyvsp[0].list; list; list = list->next) + for (list = (yyvsp[0].list); list; list = list->next) { - symbol_type_set (list->sym, current_type, yylsp[-1]); - symbol_precedence_set (list->sym, current_prec, yyvsp[-2].assoc, yylsp[-2]); + symbol_type_set (list->sym, current_type, (yylsp[-1])); + symbol_precedence_set (list->sym, current_prec, (yyvsp[-2].assoc), (yylsp[-2])); } - symbol_list_free (yyvsp[0].list); + symbol_list_free ((yyvsp[0].list)); current_type = NULL; } break; case 43: -#line 291 "parse-gram.y" - { yyval.assoc = left_assoc; } +#line 308 "parse-gram.y" + { (yyval.assoc) = left_assoc; } break; case 44: -#line 292 "parse-gram.y" - { yyval.assoc = right_assoc; } +#line 309 "parse-gram.y" + { (yyval.assoc) = right_assoc; } break; case 45: -#line 293 "parse-gram.y" - { yyval.assoc = non_assoc; } +#line 310 "parse-gram.y" + { (yyval.assoc) = non_assoc; } break; case 46: -#line 297 "parse-gram.y" +#line 314 "parse-gram.y" { current_type = NULL; } break; case 47: -#line 298 "parse-gram.y" - { current_type = yyvsp[0].uniqstr; } +#line 315 "parse-gram.y" + { current_type = (yyvsp[0].uniqstr); } break; case 48: -#line 304 "parse-gram.y" - { yyval.list = symbol_list_new (yyvsp[0].symbol, yylsp[0]); } +#line 321 "parse-gram.y" + { (yyval.list) = symbol_list_new ((yyvsp[0].symbol), (yylsp[0])); } break; case 49: -#line 305 "parse-gram.y" - { yyval.list = symbol_list_prepend (yyvsp[-1].list, yyvsp[0].symbol, yylsp[0]); } +#line 322 "parse-gram.y" + { (yyval.list) = symbol_list_prepend ((yyvsp[-1].list), (yyvsp[0].symbol), (yylsp[0])); } break; case 50: -#line 311 "parse-gram.y" +#line 328 "parse-gram.y" { - current_type = yyvsp[0].uniqstr; + current_type = (yyvsp[0].uniqstr); } break; case 51: -#line 315 "parse-gram.y" +#line 332 "parse-gram.y" { - symbol_class_set (yyvsp[0].symbol, current_class, yylsp[0]); - symbol_type_set (yyvsp[0].symbol, current_type, yylsp[0]); + symbol_class_set ((yyvsp[0].symbol), current_class, (yylsp[0])); + symbol_type_set ((yyvsp[0].symbol), current_type, (yylsp[0])); } break; case 52: -#line 320 "parse-gram.y" +#line 337 "parse-gram.y" { - symbol_class_set (yyvsp[-1].symbol, current_class, yylsp[-1]); - symbol_type_set (yyvsp[-1].symbol, current_type, yylsp[-1]); - symbol_user_token_number_set (yyvsp[-1].symbol, yyvsp[0].integer, yylsp[0]); + symbol_class_set ((yyvsp[-1].symbol), current_class, (yylsp[-1])); + symbol_type_set ((yyvsp[-1].symbol), current_type, (yylsp[-1])); + symbol_user_token_number_set ((yyvsp[-1].symbol), (yyvsp[0].integer), (yylsp[0])); } break; case 53: -#line 326 "parse-gram.y" +#line 343 "parse-gram.y" { - symbol_class_set (yyvsp[-1].symbol, current_class, yylsp[-1]); - symbol_type_set (yyvsp[-1].symbol, current_type, yylsp[-1]); - symbol_make_alias (yyvsp[-1].symbol, yyvsp[0].symbol, yyloc); + symbol_class_set ((yyvsp[-1].symbol), current_class, (yylsp[-1])); + symbol_type_set ((yyvsp[-1].symbol), current_type, (yylsp[-1])); + symbol_make_alias ((yyvsp[-1].symbol), (yyvsp[0].symbol), (yyloc)); } break; case 54: -#line 332 "parse-gram.y" +#line 349 "parse-gram.y" { - symbol_class_set (yyvsp[-2].symbol, current_class, yylsp[-2]); - symbol_type_set (yyvsp[-2].symbol, current_type, yylsp[-2]); - symbol_user_token_number_set (yyvsp[-2].symbol, yyvsp[-1].integer, yylsp[-1]); - symbol_make_alias (yyvsp[-2].symbol, yyvsp[0].symbol, yyloc); + symbol_class_set ((yyvsp[-2].symbol), current_class, (yylsp[-2])); + symbol_type_set ((yyvsp[-2].symbol), current_type, (yylsp[-2])); + symbol_user_token_number_set ((yyvsp[-2].symbol), (yyvsp[-1].integer), (yylsp[-1])); + symbol_make_alias ((yyvsp[-2].symbol), (yyvsp[0].symbol), (yyloc)); } break; case 60: -#line 361 "parse-gram.y" +#line 378 "parse-gram.y" { if (yacc_flag) - complain_at (yyloc, _("POSIX forbids declarations in the grammar")); + complain_at ((yyloc), _("POSIX forbids declarations in the grammar")); } break; case 61: -#line 366 "parse-gram.y" +#line 383 "parse-gram.y" { yyerrok; } break; case 62: -#line 372 "parse-gram.y" - { current_lhs = yyvsp[0].symbol; current_lhs_location = yylsp[0]; } +#line 389 "parse-gram.y" + { current_lhs = (yyvsp[0].symbol); current_lhs_location = (yylsp[0]); } break; case 64: -#line 376 "parse-gram.y" - { grammar_rule_end (yylsp[0]); } +#line 393 "parse-gram.y" + { grammar_rule_end ((yylsp[0])); } break; case 65: -#line 377 "parse-gram.y" - { grammar_rule_end (yylsp[0]); } +#line 394 "parse-gram.y" + { grammar_rule_end ((yylsp[0])); } break; case 67: -#line 383 "parse-gram.y" +#line 400 "parse-gram.y" { grammar_rule_begin (current_lhs, current_lhs_location); } break; case 68: -#line 385 "parse-gram.y" - { grammar_current_rule_symbol_append (yyvsp[0].symbol, yylsp[0]); } +#line 402 "parse-gram.y" + { grammar_current_rule_symbol_append ((yyvsp[0].symbol), (yylsp[0])); } break; case 69: -#line 387 "parse-gram.y" - { grammar_current_rule_action_append (yyvsp[0].chars, yylsp[0]); } +#line 404 "parse-gram.y" + { grammar_current_rule_action_append ((yyvsp[0].chars), (yylsp[0])); } break; case 70: -#line 389 "parse-gram.y" - { grammar_current_rule_prec_set (yyvsp[0].symbol, yylsp[0]); } +#line 406 "parse-gram.y" + { grammar_current_rule_prec_set ((yyvsp[0].symbol), (yylsp[0])); } break; case 71: -#line 391 "parse-gram.y" - { grammar_current_rule_dprec_set (yyvsp[0].integer, yylsp[0]); } +#line 408 "parse-gram.y" + { grammar_current_rule_dprec_set ((yyvsp[0].integer), (yylsp[0])); } break; case 72: -#line 393 "parse-gram.y" - { grammar_current_rule_merge_set (yyvsp[0].uniqstr, yylsp[0]); } +#line 410 "parse-gram.y" + { grammar_current_rule_merge_set ((yyvsp[0].uniqstr), (yylsp[0])); } break; case 73: -#line 397 "parse-gram.y" - { yyval.symbol = yyvsp[0].symbol; } +#line 414 "parse-gram.y" + { (yyval.symbol) = (yyvsp[0].symbol); } break; case 74: -#line 398 "parse-gram.y" - { yyval.symbol = yyvsp[0].symbol; } +#line 415 "parse-gram.y" + { (yyval.symbol) = (yyvsp[0].symbol); } break; case 75: -#line 403 "parse-gram.y" - { yyval.chars = yyvsp[0].chars; } +#line 420 "parse-gram.y" + { (yyval.chars) = (yyvsp[0].chars); } break; case 76: -#line 409 "parse-gram.y" +#line 426 "parse-gram.y" { - yyval.symbol = symbol_get (yyvsp[0].chars, yylsp[0]); - symbol_class_set (yyval.symbol, token_sym, yylsp[0]); + (yyval.symbol) = symbol_get (quotearg_style (c_quoting_style, (yyvsp[0].chars)), (yylsp[0])); + symbol_class_set ((yyval.symbol), token_sym, (yylsp[0])); } break; case 77: -#line 418 "parse-gram.y" - { - yyval.chars = yyvsp[0].chars + 1; - yyval.chars[strlen (yyval.chars) - 1] = '\0'; - } +#line 435 "parse-gram.y" + { (yyval.chars) = (yyvsp[0].chars); } break; case 79: -#line 427 "parse-gram.y" +#line 442 "parse-gram.y" { - muscle_code_grow ("epilogue", yyvsp[0].chars, yylsp[0]); + muscle_code_grow ("epilogue", (yyvsp[0].chars), (yylsp[0])); scanner_last_string_free (); } break; + default: break; } -/* Line 1010 of yacc.c. */ -#line 1702 "parse-gram.c" +/* Line 1126 of yacc.c. */ +#line 1912 "parse-gram.c" yyvsp -= yylen; yyssp -= yylen; @@ -1737,12 +1947,36 @@ yyerrlab: if (YYPACT_NINF < yyn && yyn < YYLAST) { - YYSIZE_T yysize = 0; int yytype = YYTRANSLATE (yychar); - const char* yyprefix; - char *yymsg; + YYSIZE_T yysize0 = yytnamerr (0, yytname[yytype]); + YYSIZE_T yysize = yysize0; + YYSIZE_T yysize1; + int yysize_overflow = 0; + char *yymsg = 0; +# define YYERROR_VERBOSE_ARGS_MAXIMUM 5 + char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM]; int yyx; +#if 0 + /* This is so xgettext sees the translatable formats that are + constructed on the fly. */ + YY_("syntax error, unexpected %s"); + YY_("syntax error, unexpected %s, expecting %s"); + YY_("syntax error, unexpected %s, expecting %s or %s"); + YY_("syntax error, unexpected %s, expecting %s or %s or %s"); + YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s"); +#endif + char *yyfmt; + char const *yyf; + static char const yyunexpected[] = "syntax error, unexpected %s"; + static char const yyexpecting[] = ", expecting %s"; + static char const yyor[] = " or %s"; + char yyformat[sizeof yyunexpected + + sizeof yyexpecting - 1 + + ((YYERROR_VERBOSE_ARGS_MAXIMUM - 2) + * (sizeof yyor - 1))]; + char const *yyprefix = yyexpecting; + /* Start YYX at -YYN if negative to avoid negative indexes in YYCHECK. */ int yyxbegin = yyn < 0 ? -yyn : 0; @@ -1750,81 +1984,91 @@ yyerrlab: /* Stay within bounds of both yycheck and yytname. */ int yychecklim = YYLAST - yyn; int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS; - int yycount = 0; + int yycount = 1; + + yyarg[0] = yytname[yytype]; + yyfmt = yystpcpy (yyformat, yyunexpected); - yyprefix = ", expecting "; for (yyx = yyxbegin; yyx < yyxend; ++yyx) if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR) { - yysize += yystrlen (yyprefix) + yystrlen (yytname [yyx]); - yycount += 1; - if (yycount == 5) + if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM) { - yysize = 0; + yycount = 1; + yysize = yysize0; + yyformat[sizeof yyunexpected - 1] = '\0'; break; } + yyarg[yycount++] = yytname[yyx]; + yysize1 = yysize + yytnamerr (0, yytname[yyx]); + yysize_overflow |= yysize1 < yysize; + yysize = yysize1; + yyfmt = yystpcpy (yyfmt, yyprefix); + yyprefix = yyor; } - yysize += (sizeof ("syntax error, unexpected ") - + yystrlen (yytname[yytype])); - yymsg = (char *) YYSTACK_ALLOC (yysize); - if (yymsg != 0) - { - char *yyp = yystpcpy (yymsg, "syntax error, unexpected "); - yyp = yystpcpy (yyp, yytname[yytype]); - if (yycount < 5) + yyf = YY_(yyformat); + yysize1 = yysize + yystrlen (yyf); + yysize_overflow |= yysize1 < yysize; + yysize = yysize1; + + if (!yysize_overflow && yysize <= YYSTACK_ALLOC_MAXIMUM) + yymsg = (char *) YYSTACK_ALLOC (yysize); + if (yymsg) + { + /* Avoid sprintf, as that infringes on the user's name space. + Don't have undefined behavior even if the translation + produced a string with the wrong number of "%s"s. */ + char *yyp = yymsg; + int yyi = 0; + while ((*yyp = *yyf)) { - yyprefix = ", expecting "; - for (yyx = yyxbegin; yyx < yyxend; ++yyx) - if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR) - { - yyp = yystpcpy (yyp, yyprefix); - yyp = yystpcpy (yyp, yytname[yyx]); - yyprefix = " or "; - } + if (*yyp == '%' && yyf[1] == 's' && yyi < yycount) + { + yyp += yytnamerr (yyp, yyarg[yyi++]); + yyf += 2; + } + else + { + yyp++; + yyf++; + } } yyerror (yymsg); YYSTACK_FREE (yymsg); } else - yyerror ("syntax error; also virtual memory exhausted"); + { + yyerror (YY_("syntax error")); + goto yyexhaustedlab; + } } else #endif /* YYERROR_VERBOSE */ - yyerror ("syntax error"); + yyerror (YY_("syntax error")); } - yylerrsp = yylsp; + yyerror_range[0] = yylloc; if (yyerrstatus == 3) { - /* If just tried and failed to reuse lookahead token after an + /* If just tried and failed to reuse look-ahead token after an error, discard it. */ if (yychar <= YYEOF) { - /* If at end of input, pop the error token, - then the rest of the stack, then return failure. */ + /* Return failure if at end of input. */ if (yychar == YYEOF) - for (;;) - { - YYPOPSTACK; - if (yyssp == yyss) - YYABORT; - YYDSYMPRINTF ("Error: popping", yystos[*yyssp], yyvsp, yylsp); - yydestruct (yystos[*yyssp], yyvsp, yylsp); - } + YYABORT; } else { - YYDSYMPRINTF ("Error: discarding", yytoken, &yylval, &yylloc); - yydestruct (yytoken, &yylval, &yylloc); + yydestruct ("Error: discarding", yytoken, &yylval, &yylloc); yychar = YYEMPTY; - *++yylerrsp = yylloc; } } - /* Else will try to reuse lookahead token after shifting the error + /* Else will try to reuse look-ahead token after shifting the error token. */ goto yyerrlab1; @@ -1834,19 +2078,17 @@ yyerrlab: `---------------------------------------------------*/ yyerrorlab: -#ifdef __GNUC__ - /* Pacify GCC when the user code never invokes YYERROR and the label - yyerrorlab therefore never appears in user code. */ + /* Pacify compilers like GCC when the user code never invokes + YYERROR and the label yyerrorlab therefore never appears in user + code. */ if (0) goto yyerrorlab; -#endif + yyerror_range[0] = yylsp[1-yylen]; + yylsp -= yylen; yyvsp -= yylen; yyssp -= yylen; yystate = *yyssp; - yylerrsp = yylsp; - *++yylerrsp = yyloc; - yylsp -= yylen; goto yyerrlab1; @@ -1874,8 +2116,8 @@ yyerrlab1: if (yyssp == yyss) YYABORT; - YYDSYMPRINTF ("Error: popping", yystos[*yyssp], yyvsp, yylsp); - yydestruct (yystos[yystate], yyvsp, yylsp); + yyerror_range[0] = *yylsp; + yydestruct ("Error: popping", yystos[yystate], yyvsp, yylsp); YYPOPSTACK; yystate = *yyssp; YY_STACK_PRINT (yyss, yyssp); @@ -1884,12 +2126,17 @@ yyerrlab1: if (yyn == YYFINAL) YYACCEPT; - YYDPRINTF ((stderr, "Shifting error token, ")); - *++yyvsp = yylval; - YYLLOC_DEFAULT (yyloc, yylsp, yylerrsp - yylsp); + + yyerror_range[1] = yylloc; + /* Using YYLLOC is tempting, but would change the location of + the look-ahead. YYLOC is available though. */ + YYLLOC_DEFAULT (yyloc, yyerror_range - 1, 2); *++yylsp = yyloc; + /* Shift the error token. */ + YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp); + yystate = yyn; goto yynewstate; @@ -1909,16 +2156,25 @@ yyabortlab: goto yyreturn; #ifndef yyoverflow -/*----------------------------------------------. -| yyoverflowlab -- parser overflow comes here. | -`----------------------------------------------*/ -yyoverflowlab: - yyerror ("parser stack overflow"); +/*-------------------------------------------------. +| yyexhaustedlab -- memory exhaustion comes here. | +`-------------------------------------------------*/ +yyexhaustedlab: + yyerror (YY_("memory exhausted")); yyresult = 2; /* Fall through. */ #endif yyreturn: + if (yychar != YYEOF && yychar != YYEMPTY) + yydestruct ("Cleanup: discarding lookahead", + yytoken, &yylval, &yylloc); + while (yyssp != yyss) + { + yydestruct ("Cleanup: popping", + yystos[*yyssp], yyvsp, yylsp); + YYPOPSTACK; + } #ifndef yyoverflow if (yyss != yyssa) YYSTACK_FREE (yyss); @@ -1927,7 +2183,7 @@ yyreturn: } -#line 433 "parse-gram.y" +#line 448 "parse-gram.y" @@ -1941,7 +2197,11 @@ lloc_default (YYLTYPE const *rhs, int n) { int i; YYLTYPE loc; - loc.start = loc.end = rhs[n].end; + + /* SGI MIPSpro 7.4.1m miscompiles "loc.start = loc.end = rhs[n].end;". + The bug is fixed in 7.4.2m, but play it safe for now. */ + loc.start = rhs[n].end; + loc.end = rhs[n].end; /* Ignore empty nonterminals the start of the the right-hand side. Do not bother to ignore them at the end of the right-hand side, @@ -1963,22 +2223,28 @@ lloc_default (YYLTYPE const *rhs, int n) static void add_param (char const *type, char *decl, location loc) { - static char const alphanum[] = - "0123456789" + static char const alphanum[26 + 26 + 1 + 10] = "abcdefghijklmnopqrstuvwxyz" "ABCDEFGHIJKLMNOPQRSTUVWXYZ" - "_"; - char const *alpha = alphanum + 10; + "_" + "0123456789"; char const *name_start = NULL; char *p; - for (p = decl; *p; p++) - if ((p == decl || ! strchr (alphanum, p[-1])) && strchr (alpha, p[0])) + /* Stop on last actual character. */ + for (p = decl; p[1]; p++) + if ((p == decl + || ! memchr (alphanum, p[-1], sizeof alphanum)) + && memchr (alphanum, p[0], sizeof alphanum - 10)) name_start = p; - /* Strip the surrounding '{' and '}'. */ - decl++; - p[-1] = '\0'; + /* Strip the surrounding '{' and '}', and any blanks just inside + the braces. */ + while (*--p == ' ' || *p == '\t') + continue; + p[1] = '\0'; + while (*++decl == ' ' || *decl == '\t') + continue; if (! name_start) complain_at (loc, _("missing identifier in parameter declaration")); @@ -1988,7 +2254,7 @@ add_param (char const *type, char *decl, location loc) size_t name_len; for (name_len = 1; - name_start[name_len] && strchr (alphanum, name_start[name_len]); + memchr (alphanum, name_start[name_len], sizeof alphanum); name_len++) continue; @@ -2002,49 +2268,6 @@ add_param (char const *type, char *decl, location loc) scanner_last_string_free (); } -/*----------------------------------------------------. -| When debugging the parser, display tokens' values. | -`----------------------------------------------------*/ - -static void -print_token_value (FILE *file, int type, YYSTYPE const *value) -{ - fputc (' ', file); - switch (type) - { - case ID: - fprintf (file, " = %s", value->symbol->tag); - break; - - case INT: - fprintf (file, " = %d", value->integer); - break; - - case STRING: - fprintf (file, " = \"%s\"", value->chars); - break; - - case TYPE: - fprintf (file, " = <%s>", value->uniqstr); - break; - - case BRACED_CODE: - case PERCENT_DESTRUCTOR: - case PERCENT_LEX_PARAM: - case PERCENT_PARSE_PARAM: - case PERCENT_PRINTER: - case PERCENT_UNION: - case PROLOGUE: - case EPILOGUE: - fprintf (file, " = {{ %s }}", value->chars); - break; - - default: - fprintf (file, "unknown token type"); - break; - } -} - static void gram_error (location const *loc, char const *msg) { @@ -2054,6 +2277,6 @@ gram_error (location const *loc, char const *msg) char const * token_name (int type) { - return yytname[type]; + return yytname[YYTRANSLATE (type)]; } diff --git a/src/bin/bison/src/parse-gram.h b/src/bin/bison/src/parse-gram.h index b6cb75c621..876e749067 100644 --- a/src/bin/bison/src/parse-gram.h +++ b/src/bin/bison/src/parse-gram.h @@ -1,7 +1,7 @@ -/* A Bison parser, made by GNU Bison 1.875d. */ +/* A Bison parser, made by GNU Bison 2.1. */ /* Skeleton parser for Yacc-like parsing with Bison, - Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc. + Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -15,8 +15,8 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ + Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. */ /* As a special exception, when this file is copied by Bison into a Bison output file, you may use that output file without restriction. @@ -80,6 +80,7 @@ BRACED_CODE = 305 }; #endif +/* Tokens. */ #define GRAM_EOF 0 #define STRING 258 #define INT 259 @@ -134,7 +135,7 @@ #if ! defined (YYSTYPE) && ! defined (YYSTYPE_IS_DECLARED) -#line 78 "parse-gram.y" +#line 79 "parse-gram.y" typedef union YYSTYPE { symbol *symbol; symbol_list *list; @@ -143,8 +144,8 @@ typedef union YYSTYPE { assoc assoc; uniqstr uniqstr; } YYSTYPE; -/* Line 1285 of yacc.c. */ -#line 148 "y.tab.h" +/* Line 1447 of yacc.c. */ +#line 149 "parse-gram.h" # define yystype YYSTYPE /* obsolescent; will be withdrawn */ # define YYSTYPE_IS_DECLARED 1 # define YYSTYPE_IS_TRIVIAL 1 diff --git a/src/bin/bison/src/parse-gram.y b/src/bin/bison/src/parse-gram.y index fa35eb6410..db15562dff 100644 --- a/src/bin/bison/src/parse-gram.y +++ b/src/bin/bison/src/parse-gram.y @@ -1,6 +1,6 @@ %{/* Bison Grammar Parser -*- C -*- - Copyright (C) 2002, 2003, 2004 Free Software Foundation, Inc. + Copyright (C) 2002, 2003, 2004, 2005 Free Software Foundation, Inc. This file is part of Bison, the GNU Compiler Compiler. @@ -16,8 +16,8 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA - 02111-1307 USA + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA + 02110-1301 USA */ #include "system.h" @@ -29,12 +29,16 @@ #include "gram.h" #include "muscle_tab.h" #include "output.h" +#include "quotearg.h" #include "reader.h" #include "symlist.h" #define YYLLOC_DEFAULT(Current, Rhs, N) (Current) = lloc_default (Rhs, N) static YYLTYPE lloc_default (YYLTYPE const *, int); +#define YY_LOCATION_PRINT(File, Loc) \ + location_print (File, Loc) + /* Request detailed syntax error messages, and pass them to GRAM_ERROR. FIXME: depends on the undocumented availability of YYLLOC. */ #undef yyerror @@ -42,21 +46,18 @@ static YYLTYPE lloc_default (YYLTYPE const *, int); gram_error (&yylloc, Msg) static void gram_error (location const *, char const *); -#define YYPRINT(File, Type, Value) \ - print_token_value (File, Type, &Value) -static void print_token_value (FILE *, int, YYSTYPE const *); - static void add_param (char const *, char *, location); -symbol_class current_class = unknown_sym; -uniqstr current_type = 0; +static symbol_class current_class = unknown_sym; +static uniqstr current_type = 0; symbol *current_lhs; location current_lhs_location; assoc current_assoc; -int current_prec = 0; +static int current_prec = 0; %} %debug +%verbose %defines %locations %pure-parser @@ -160,9 +161,25 @@ int current_prec = 0; "%union {...}" BRACED_CODE action PROLOGUE EPILOGUE +%printer { fprintf (stderr, "\"%s\"", $$); } + STRING string_content +%printer { fprintf (stderr, "{\n%s\n}", $$); } + "%destructor {...}" + "%initial-action {...}" + "%lex-param {...}" + "%parse-param {...}" + "%printer {...}" + "%union {...}" + BRACED_CODE action + PROLOGUE EPILOGUE %type TYPE +%printer { fprintf (stderr, "<%s>", $$); } TYPE %type INT -%type ID ID_COLON symbol string_as_id +%printer { fprintf (stderr, "%d", $$); } INT +%type ID symbol string_as_id +%printer { fprintf (stderr, "%s", $$->tag); } ID symbol string_as_id +%type ID_COLON +%printer { fprintf (stderr, "%s:", $$->tag); } ID_COLON %type precedence_declarator %type symbols.1 %% @@ -189,7 +206,7 @@ declaration: | "%defines" { defines_flag = true; } | "%error-verbose" { error_verbose = true; } | "%expect" INT { expected_sr_conflicts = $2; } -| "%expect-rr" INT { expected_rr_conflicts = $2; } +| "%expect-rr" INT { expected_rr_conflicts = $2; } | "%file-prefix" "=" string_content { spec_file_prefix = $3; } | "%glr-parser" { @@ -204,7 +221,7 @@ declaration: | "%locations" { locations_flag = true; } | "%name-prefix" "=" string_content { spec_name_prefix = $3; } | "%no-lines" { no_lines_flag = true; } -| "%nondeterministic-parser" { nondeterministic_parser = true; } +| "%nondeterministic-parser" { nondeterministic_parser = true; } | "%output" "=" string_content { spec_outfile = $3; } | "%parse-param {...}" { add_param ("parse_param", $1, @1); } | "%pure-parser" { pure_parser = true; } @@ -400,25 +417,23 @@ symbol: action: BRACED_CODE - { $$ = $1; } + { $$ = $1; } ; -/* A string used as an ID: we have to keep the quotes. */ +/* A string used as an ID: quote it. */ string_as_id: STRING { - $$ = symbol_get ($1, @1); + $$ = symbol_get (quotearg_style (c_quoting_style, $1), @1); symbol_class_set ($$, token_sym, @1); } ; -/* A string used for its contents. Strip the quotes. */ +/* A string used for its contents. Don't quote it. */ string_content: STRING - { - $$ = $1 + 1; - $$[strlen ($$) - 1] = '\0'; - }; + { $$ = $1; } +; epilogue.opt: @@ -443,7 +458,11 @@ lloc_default (YYLTYPE const *rhs, int n) { int i; YYLTYPE loc; - loc.start = loc.end = rhs[n].end; + + /* SGI MIPSpro 7.4.1m miscompiles "loc.start = loc.end = rhs[n].end;". + The bug is fixed in 7.4.2m, but play it safe for now. */ + loc.start = rhs[n].end; + loc.end = rhs[n].end; /* Ignore empty nonterminals the start of the the right-hand side. Do not bother to ignore them at the end of the right-hand side, @@ -465,22 +484,28 @@ lloc_default (YYLTYPE const *rhs, int n) static void add_param (char const *type, char *decl, location loc) { - static char const alphanum[] = - "0123456789" + static char const alphanum[26 + 26 + 1 + 10] = "abcdefghijklmnopqrstuvwxyz" "ABCDEFGHIJKLMNOPQRSTUVWXYZ" - "_"; - char const *alpha = alphanum + 10; + "_" + "0123456789"; char const *name_start = NULL; char *p; - for (p = decl; *p; p++) - if ((p == decl || ! strchr (alphanum, p[-1])) && strchr (alpha, p[0])) + /* Stop on last actual character. */ + for (p = decl; p[1]; p++) + if ((p == decl + || ! memchr (alphanum, p[-1], sizeof alphanum)) + && memchr (alphanum, p[0], sizeof alphanum - 10)) name_start = p; - /* Strip the surrounding '{' and '}'. */ - decl++; - p[-1] = '\0'; + /* Strip the surrounding '{' and '}', and any blanks just inside + the braces. */ + while (*--p == ' ' || *p == '\t') + continue; + p[1] = '\0'; + while (*++decl == ' ' || *decl == '\t') + continue; if (! name_start) complain_at (loc, _("missing identifier in parameter declaration")); @@ -490,7 +515,7 @@ add_param (char const *type, char *decl, location loc) size_t name_len; for (name_len = 1; - name_start[name_len] && strchr (alphanum, name_start[name_len]); + memchr (alphanum, name_start[name_len], sizeof alphanum); name_len++) continue; @@ -504,49 +529,6 @@ add_param (char const *type, char *decl, location loc) scanner_last_string_free (); } -/*----------------------------------------------------. -| When debugging the parser, display tokens' values. | -`----------------------------------------------------*/ - -static void -print_token_value (FILE *file, int type, YYSTYPE const *value) -{ - fputc (' ', file); - switch (type) - { - case ID: - fprintf (file, " = %s", value->symbol->tag); - break; - - case INT: - fprintf (file, " = %d", value->integer); - break; - - case STRING: - fprintf (file, " = \"%s\"", value->chars); - break; - - case TYPE: - fprintf (file, " = <%s>", value->uniqstr); - break; - - case BRACED_CODE: - case PERCENT_DESTRUCTOR: - case PERCENT_LEX_PARAM: - case PERCENT_PARSE_PARAM: - case PERCENT_PRINTER: - case PERCENT_UNION: - case PROLOGUE: - case EPILOGUE: - fprintf (file, " = {{ %s }}", value->chars); - break; - - default: - fprintf (file, "unknown token type"); - break; - } -} - static void gram_error (location const *loc, char const *msg) { @@ -556,5 +538,5 @@ gram_error (location const *loc, char const *msg) char const * token_name (int type) { - return yytname[type]; + return yytname[YYTRANSLATE (type)]; } diff --git a/src/bin/bison/src/print.c b/src/bin/bison/src/print.c index 4f85524431..533e3ca1d7 100644 --- a/src/bin/bison/src/print.c +++ b/src/bin/bison/src/print.c @@ -1,6 +1,6 @@ /* Print information on generated parser, for bison, - Copyright (C) 1984, 1986, 1989, 2000, 2001, 2002, 2003 + Copyright (C) 1984, 1986, 1989, 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc. This file is part of Bison, the GNU Compiler Compiler. @@ -17,8 +17,8 @@ You should have received a copy of the GNU General Public License along with Bison; see the file COPYING. If not, write to - the Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. */ #include "system.h" @@ -39,8 +39,8 @@ #include "state.h" #include "symtab.h" -static bitset shiftset; -static bitset lookaheadset; +static bitset shift_set; +static bitset look_ahead_set; #if 0 static void @@ -71,9 +71,9 @@ max_length (size_t *width, const char *str) static void print_core (FILE *out, state *s) { - int i; + size_t i; item_number *sitems = s->items; - int snritems = s->nitems; + size_t snritems = s->nitems; symbol *previous_lhs = NULL; /* Output all the items of a state, not only its kernel. */ @@ -111,9 +111,9 @@ print_core (FILE *out, state *s) for (/* Nothing */; *sp >= 0; ++sp) fprintf (out, " %s", symbols[*sp]->tag); - /* Display the lookaheads? */ - if (report_flag & report_lookaheads) - state_rule_lookaheads_print (s, &rules[r], out); + /* Display the look-ahead tokens? */ + if (report_flag & report_look_ahead_tokens) + state_rule_look_ahead_tokens_print (s, &rules[r], out); fputc ('\n', out); } @@ -132,7 +132,7 @@ print_transitions (state *s, FILE *out, bool display_transitions_p) size_t width = 0; int i; - /* Compute the width of the lookaheads column. */ + /* Compute the width of the look-ahead token column. */ for (i = 0; i < trans->num; i++) if (!TRANSITION_IS_DISABLED (trans, i) && TRANSITION_IS_SHIFT (trans, i) == display_transitions_p) @@ -148,7 +148,7 @@ print_transitions (state *s, FILE *out, bool display_transitions_p) fputc ('\n', out); width += 2; - /* Report lookaheads and shifts. */ + /* Report look-ahead tokens and shifts. */ for (i = 0; i < trans->num; i++) if (!TRANSITION_IS_DISABLED (trans, i) && TRANSITION_IS_SHIFT (trans, i) == display_transitions_p) @@ -180,7 +180,7 @@ print_errs (FILE *out, state *s) size_t width = 0; int i; - /* Compute the width of the lookaheads column. */ + /* Compute the width of the look-ahead token column. */ for (i = 0; i < errp->num; ++i) if (errp->symbols[i]) max_length (&width, errp->symbols[i]->tag); @@ -192,7 +192,7 @@ print_errs (FILE *out, state *s) fputc ('\n', out); width += 2; - /* Report lookaheads and errors. */ + /* Report look-ahead tokens and errors. */ for (i = 0; i < errp->num; ++i) if (errp->symbols[i]) { @@ -218,13 +218,13 @@ state_default_rule (state *s) int cmax = 0; int i; - /* No need for a lookahead. */ + /* No need for a look-ahead. */ if (s->consistent) return reds->rules[0]; - /* 1. Each reduction is possibly masked by the lookaheads on which + /* 1. Each reduction is possibly masked by the look-ahead tokens on which we shift (S/R conflicts)... */ - bitset_zero (shiftset); + bitset_zero (shift_set); { transitions *trans = s->transitions; FOR_EACH_SHIFT (trans, i) @@ -233,27 +233,27 @@ state_default_rule (state *s) default rule. */ if (TRANSITION_IS_ERROR (trans, i)) return NULL; - bitset_set (shiftset, TRANSITION_SYMBOL (trans, i)); + bitset_set (shift_set, TRANSITION_SYMBOL (trans, i)); } } - /* 2. Each reduction is possibly masked by the lookaheads on which + /* 2. Each reduction is possibly masked by the look-ahead tokens on which we raise an error (due to %nonassoc). */ { errs *errp = s->errs; for (i = 0; i < errp->num; i++) if (errp->symbols[i]) - bitset_set (shiftset, errp->symbols[i]->number); + bitset_set (shift_set, errp->symbols[i]->number); } for (i = 0; i < reds->num; ++i) { int count = 0; - /* How many non-masked lookaheads are there for this reduction? - */ - bitset_andn (lookaheadset, reds->lookaheads[i], shiftset); - count = bitset_count (lookaheadset); + /* How many non-masked look-ahead tokens are there for this + reduction? */ + bitset_andn (look_ahead_set, reds->look_ahead_tokens[i], shift_set); + count = bitset_count (look_ahead_set); if (count > cmax) { @@ -264,27 +264,27 @@ state_default_rule (state *s) /* 3. And finally, each reduction is possibly masked by previous reductions (in R/R conflicts, we keep the first reductions). */ - bitset_or (shiftset, shiftset, reds->lookaheads[i]); + bitset_or (shift_set, shift_set, reds->look_ahead_tokens[i]); } return default_rule; } -/*--------------------------------------------------------------------. -| Report a reduction of RULE on LOOKAHEADS (which can be `default'). | -| If not ENABLED, the rule is masked by a shift or a reduce (S/R and | -| R/R conflicts). | -`--------------------------------------------------------------------*/ +/*--------------------------------------------------------------------------. +| Report a reduction of RULE on LOOK_AHEAD_TOKEN (which can be `default'). | +| If not ENABLED, the rule is masked by a shift or a reduce (S/R and | +| R/R conflicts). | +`--------------------------------------------------------------------------*/ static void print_reduction (FILE *out, size_t width, - const char *lookahead, + const char *look_ahead_token, rule *r, bool enabled) { int j; - fprintf (out, " %s", lookahead); - for (j = width - strlen (lookahead); j > 0; --j) + fprintf (out, " %s", look_ahead_token); + for (j = width - strlen (look_ahead_token); j > 0; --j) fputc (' ', out); if (!enabled) fputc ('[', out); @@ -316,21 +316,21 @@ print_reductions (FILE *out, state *s) default_rule = state_default_rule (s); - bitset_zero (shiftset); + bitset_zero (shift_set); FOR_EACH_SHIFT (trans, i) - bitset_set (shiftset, TRANSITION_SYMBOL (trans, i)); + bitset_set (shift_set, TRANSITION_SYMBOL (trans, i)); - /* Compute the width of the lookaheads column. */ + /* Compute the width of the look-ahead token column. */ if (default_rule) width = strlen (_("$default")); - if (reds->lookaheads) + if (reds->look_ahead_tokens) for (i = 0; i < ntokens; i++) { - bool count = bitset_test (shiftset, i); + bool count = bitset_test (shift_set, i); for (j = 0; j < reds->num; ++j) - if (bitset_test (reds->lookaheads[j], i)) + if (bitset_test (reds->look_ahead_tokens[j], i)) { if (! count) { @@ -352,15 +352,15 @@ print_reductions (FILE *out, state *s) fputc ('\n', out); width += 2; - /* Report lookaheads (or $default) and reductions. */ - if (reds->lookaheads) + /* Report look-ahead tokens (or $default) and reductions. */ + if (reds->look_ahead_tokens) for (i = 0; i < ntokens; i++) { bool defaulted = false; - bool count = bitset_test (shiftset, i); + bool count = bitset_test (shift_set, i); for (j = 0; j < reds->num; ++j) - if (bitset_test (reds->lookaheads[j], i)) + if (bitset_test (reds->look_ahead_tokens[j], i)) { if (! count) { @@ -562,12 +562,12 @@ print_results (void) if (report_flag & report_itemsets) new_closure (nritems); /* Storage for print_reductions. */ - shiftset = bitset_create (ntokens, BITSET_FIXED); - lookaheadset = bitset_create (ntokens, BITSET_FIXED); + shift_set = bitset_create (ntokens, BITSET_FIXED); + look_ahead_set = bitset_create (ntokens, BITSET_FIXED); for (i = 0; i < nstates; i++) print_state (out, states[i]); - bitset_free (shiftset); - bitset_free (lookaheadset); + bitset_free (shift_set); + bitset_free (look_ahead_set); if (report_flag & report_itemsets) free_closure (); diff --git a/src/bin/bison/src/print.h b/src/bin/bison/src/print.h index bdddafbea9..1daa577d9f 100644 --- a/src/bin/bison/src/print.h +++ b/src/bin/bison/src/print.h @@ -15,8 +15,8 @@ You should have received a copy of the GNU General Public License along with Bison; see the file COPYING. If not, write to - the Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. */ #ifndef PRINT_H_ # define PRINT_H_ diff --git a/src/bin/bison/src/print_graph.c b/src/bin/bison/src/print_graph.c index 80b0d3b1c6..dc0f8306c7 100644 --- a/src/bin/bison/src/print_graph.c +++ b/src/bin/bison/src/print_graph.c @@ -1,6 +1,6 @@ /* Output a VCG description on generated parser, for Bison, - Copyright (C) 2001, 2002, 2003 Free Software Foundation, Inc. + Copyright (C) 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc. This file is part of Bison, the GNU Compiler Compiler. @@ -16,12 +16,11 @@ You should have received a copy of the GNU General Public License along with Bison; see the file COPYING. If not, write to - the Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. */ #include "system.h" -#include #include #include "LR0.h" @@ -49,9 +48,9 @@ static FILE *fgraph = NULL; static void print_core (struct obstack *oout, state *s) { - int i; + size_t i; item_number *sitems = s->items; - int snritems = s->nitems; + size_t snritems = s->nitems; /* Output all the items of a state, not only its kernel. */ if (report_flag & report_itemsets) @@ -88,21 +87,21 @@ print_core (struct obstack *oout, state *s) for (/* Nothing */; *sp >= 0; ++sp) obstack_fgrow1 (oout, " %s", symbols[*sp]->tag); - /* Experimental feature: display the lookaheads. */ - if (report_flag & report_lookaheads) + /* Experimental feature: display the look-ahead tokens. */ + if (report_flag & report_look_ahead_tokens) { /* Find the reduction we are handling. */ reductions *reds = s->reductions; int redno = state_reduction_find (s, &rules[r]); /* Print them if there are. */ - if (reds->lookaheads && redno != -1) + if (reds->look_ahead_tokens && redno != -1) { bitset_iterator biter; int k; char const *sep = ""; obstack_sgrow (oout, "["); - BITSET_FOR_EACH (biter, reds->lookaheads[redno], k, 0) + BITSET_FOR_EACH (biter, reds->look_ahead_tokens[redno], k, 0) { obstack_fgrow2 (oout, "%s%s", sep, symbols[k]->tag); sep = ", "; @@ -202,13 +201,7 @@ print_graph (void) new_graph (&static_graph); -#if 0 - static_graph.smanhattan_edges = yes; - static_graph.manhattan_edges = yes; -#endif - static_graph.display_edge_labels = yes; - static_graph.layoutalgorithm = normal; static_graph.port_sharing = no; static_graph.finetuning = yes; diff --git a/src/bin/bison/src/print_graph.h b/src/bin/bison/src/print_graph.h index 7be8a52dba..befc531362 100644 --- a/src/bin/bison/src/print_graph.h +++ b/src/bin/bison/src/print_graph.h @@ -15,8 +15,8 @@ You should have received a copy of the GNU General Public License along with Bison; see the file COPYING. If not, write to - the Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. */ #ifndef PRINT_GRAPH_H_ # define PRINT_GRAPH_H_ diff --git a/src/bin/bison/src/reader.c b/src/bin/bison/src/reader.c index 1cd035cce2..6b247b7f2d 100644 --- a/src/bin/bison/src/reader.c +++ b/src/bin/bison/src/reader.c @@ -1,7 +1,7 @@ /* Input parser for Bison - Copyright (C) 1984, 1986, 1989, 1992, 1998, 2000, 2001, 2002, 2003 - Free Software Foundation, Inc. + Copyright (C) 1984, 1986, 1989, 1992, 1998, 2000, 2001, 2002, 2003, + 2005 Free Software Foundation, Inc. This file is part of Bison, the GNU Compiler Compiler. @@ -17,8 +17,8 @@ You should have received a copy of the GNU General Public License along with Bison; see the file COPYING. If not, write to - the Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. */ #include "system.h" @@ -74,7 +74,7 @@ prologue_augment (const char *prologue, location loc) struct obstack *oout = !typed ? &pre_prologue_obstack : &post_prologue_obstack; - obstack_fgrow1 (oout, "]b4_syncline([[%d]], [[", loc.start.line); + obstack_fgrow1 (oout, "]b4_syncline(%d, [[", loc.start.line); MUSCLE_OBSTACK_SGROW (oout, quotearg_style (c_quoting_style, loc.start.file)); obstack_sgrow (oout, "]])[\n"); @@ -108,7 +108,7 @@ get_merge_function (uniqstr name, uniqstr type, location loc) break; if (syms->next == NULL) { - MALLOC (syms->next, 1); + syms->next = xmalloc (sizeof syms->next[0]); syms->next->name = uniqstr_new (name); syms->next->type = uniqstr_new (type); syms->next->next = NULL; @@ -159,7 +159,7 @@ free_merger_functions (void) `-------------------------------------------------------------------*/ /* The (currently) last symbol of GRAMMAR. */ -symbol_list *grammar_end = NULL; +static symbol_list *grammar_end = NULL; /* Append SYM to the grammar. */ void @@ -179,7 +179,7 @@ grammar_symbol_append (symbol *sym, location loc) CURRENT_RULE points to the first LHS of the current rule, while PREVIOUS_RULE_END points to the *end* of the previous rule (NULL). */ symbol_list *current_rule = NULL; -symbol_list *previous_rule_end = NULL; +static symbol_list *previous_rule_end = NULL; /*----------------------------------------------. @@ -387,8 +387,8 @@ packgram (void) rule_number ruleno = 0; symbol_list *p = grammar; - CALLOC (ritem, nritems); - CALLOC (rules, nrules); + ritem = xnmalloc (nritems, sizeof *ritem); + rules = xnmalloc (nrules, sizeof *rules); while (p) { @@ -397,12 +397,14 @@ packgram (void) rules[ruleno].number = ruleno; rules[ruleno].lhs = p->sym; rules[ruleno].rhs = ritem + itemno; + rules[ruleno].prec = NULL; + rules[ruleno].dprec = p->dprec; + rules[ruleno].merger = p->merger; + rules[ruleno].precsym = NULL; rules[ruleno].location = p->location; rules[ruleno].useful = true; rules[ruleno].action = p->action; rules[ruleno].action_location = p->action_location; - rules[ruleno].dprec = p->dprec; - rules[ruleno].merger = p->merger; p = p->next; while (p && p->sym) diff --git a/src/bin/bison/src/reader.h b/src/bin/bison/src/reader.h index fc6ee7d6af..c47a16ebfc 100644 --- a/src/bin/bison/src/reader.h +++ b/src/bin/bison/src/reader.h @@ -1,6 +1,6 @@ /* Input parser for Bison - Copyright (C) 2000, 2001, 2002, 2003 Free Software Foundation, Inc. + Copyright (C) 2000, 2001, 2002, 2003, 2005 Free Software Foundation, Inc. This file is part of Bison, the GNU Compiler Compiler. @@ -16,8 +16,8 @@ You should have received a copy of the GNU General Public License along with Bison; see the file COPYING. If not, write to - the Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. */ #ifndef READER_H_ # define READER_H_ @@ -43,6 +43,11 @@ void scanner_initialize (void); void scanner_free (void); void scanner_last_string_free (void); +/* These are declared by the scanner, but not used. We put them here + to pacify "make syntax-check". */ +extern FILE *gram_out; +extern int gram_lineno; + # define YY_DECL int gram_lex (YYSTYPE *val, location *loc) YY_DECL; diff --git a/src/bin/bison/src/reduce.c b/src/bin/bison/src/reduce.c index b9b6a3dde4..a6b9e62908 100644 --- a/src/bin/bison/src/reduce.c +++ b/src/bin/bison/src/reduce.c @@ -17,8 +17,8 @@ You should have received a copy of the GNU General Public License along with Bison; see the file COPYING. If not, write to - the Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. */ /* Reduce the grammar: Find and eliminate unreachable terminals, @@ -247,7 +247,7 @@ reduce_grammar_tables (void) { int useful = 0; int useless = nrules - nuseless_productions; - rule *rules_sorted = MALLOC (rules_sorted, nrules); + rule *rules_sorted = xnmalloc (nrules, sizeof *rules_sorted); rule_number r; for (r = 0; r < nrules; ++r) rules_sorted[rules[r].useful ? useful++ : useless++] = rules[r]; @@ -291,7 +291,7 @@ nonterminals_reduce (void) /* Map the nonterminals to their new index: useful first, useless afterwards. Kept for later report. */ - symbol_number *nontermmap = CALLOC (nontermmap, nvars); + symbol_number *nontermmap = xnmalloc (nvars, sizeof *nontermmap); n = ntokens; for (i = ntokens; i < nsyms; i++) if (bitset_test (V, i)) @@ -307,7 +307,7 @@ nonterminals_reduce (void) /* Shuffle elements of tables indexed by symbol number. */ { - symbol **symbols_sorted = MALLOC (symbols_sorted, nvars); + symbol **symbols_sorted = xnmalloc (nvars, sizeof *symbols_sorted); for (i = ntokens; i < nsyms; i++) symbols[i]->number = nontermmap[i - ntokens]; diff --git a/src/bin/bison/src/reduce.h b/src/bin/bison/src/reduce.h index f66d4f38e7..dfdab657e8 100644 --- a/src/bin/bison/src/reduce.h +++ b/src/bin/bison/src/reduce.h @@ -16,8 +16,8 @@ You should have received a copy of the GNU General Public License along with Bison; see the file COPYING. If not, write to - the Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. */ #ifndef REDUCE_H_ # define REDUCE_H_ diff --git a/src/bin/bison/src/relation.c b/src/bin/bison/src/relation.c index 8f97fa9903..da62af8fb0 100644 --- a/src/bin/bison/src/relation.c +++ b/src/bin/bison/src/relation.c @@ -1,5 +1,5 @@ /* Binary relations. - Copyright (C) 2002, 2004 Free Software Foundation, Inc. + Copyright (C) 2002, 2004, 2005 Free Software Foundation, Inc. This file is part of Bison, the GNU Compiler Compiler. @@ -15,8 +15,8 @@ You should have received a copy of the GNU General Public License along with Bison; see the file COPYING. If not, write to - the Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. */ #include "system.h" @@ -26,17 +26,17 @@ #include "relation.h" void -relation_print (relation r, size_t size, FILE *out) +relation_print (relation r, relation_node size, FILE *out) { - unsigned int i; - unsigned int j; + relation_node i; + relation_node j; for (i = 0; i < size; ++i) { - fprintf (out, "%3d: ", i); + fprintf (out, "%3lu: ", (unsigned long int) i); if (r[i]) - for (j = 0; r[i][j] != -1; ++j) - fprintf (out, "%3d ", r[i][j]); + for (j = 0; r[i][j] != END_NODE; ++j) + fprintf (out, "%3lu ", (unsigned long int) r[i][j]); fputc ('\n', out); } fputc ('\n', out); @@ -53,21 +53,21 @@ relation_print (relation r, size_t size, FILE *out) static relation R; static relation_nodes INDEX; static relation_nodes VERTICES; -static int top; -static int infinity; +static relation_node top; +static relation_node infinity; static bitsetv F; static void -traverse (int i) +traverse (relation_node i) { - int j; - int height; + relation_node j; + relation_node height; VERTICES[++top] = i; INDEX[i] = height = top; if (R[i]) - for (j = 0; R[i][j] >= 0; ++j) + for (j = 0; R[i][j] != END_NODE; ++j) { if (INDEX[R[i][j]] == 0) traverse (R[i][j]); @@ -93,27 +93,24 @@ traverse (int i) void -relation_digraph (relation r, size_t size, bitsetv *function) +relation_digraph (relation r, relation_node size, bitsetv *function) { - unsigned int i; + relation_node i; infinity = size + 2; - CALLOC (INDEX, size + 1); - CALLOC (VERTICES, size + 1); + INDEX = xcalloc (size + 1, sizeof *INDEX); + VERTICES = xnmalloc (size + 1, sizeof *VERTICES); top = 0; R = r; F = *function; - for (i = 0; i < size; i++) - INDEX[i] = 0; - for (i = 0; i < size; i++) if (INDEX[i] == 0 && R[i]) traverse (i); - XFREE (INDEX); - XFREE (VERTICES); + free (INDEX); + free (VERTICES); *function = F; } @@ -124,54 +121,56 @@ relation_digraph (relation r, size_t size, bitsetv *function) `-------------------------------------------*/ void -relation_transpose (relation *R_arg, int n) +relation_transpose (relation *R_arg, relation_node n) { + relation r = *R_arg; /* The result. */ - relation new_R = CALLOC (new_R, n); + relation new_R = xnmalloc (n, sizeof *new_R); /* END_R[I] -- next entry of NEW_R[I]. */ - relation end_R = CALLOC (end_R, n); + relation end_R = xnmalloc (n, sizeof *end_R); /* NEDGES[I] -- total size of NEW_R[I]. */ - int *nedges = CALLOC (nedges, n); - int i, j; + size_t *nedges = xcalloc (n, sizeof *nedges); + relation_node i; + relation_node j; if (trace_flag & trace_sets) { fputs ("relation_transpose: input\n", stderr); - relation_print (*R_arg, n, stderr); + relation_print (r, n, stderr); } /* Count. */ for (i = 0; i < n; i++) - if ((*R_arg)[i]) - for (j = 0; (*R_arg)[i][j] >= 0; ++j) - ++nedges[(*R_arg)[i][j]]; + if (r[i]) + for (j = 0; r[i][j] != END_NODE; ++j) + ++nedges[r[i][j]]; /* Allocate. */ for (i = 0; i < n; i++) - if (nedges[i] > 0) - { - relation_node *sp = CALLOC (sp, nedges[i] + 1); - sp[nedges[i]] = -1; - new_R[i] = sp; - end_R[i] = sp; - } + { + relation_node *sp = NULL; + if (nedges[i] > 0) + { + sp = xnmalloc (nedges[i] + 1, sizeof *sp); + sp[nedges[i]] = END_NODE; + } + new_R[i] = sp; + end_R[i] = sp; + } /* Store. */ for (i = 0; i < n; i++) - if ((*R_arg)[i]) - for (j = 0; (*R_arg)[i][j] >= 0; ++j) - { - *end_R[(*R_arg)[i][j]] = i; - ++end_R[(*R_arg)[i][j]]; - } + if (r[i]) + for (j = 0; r[i][j] != END_NODE; ++j) + *end_R[r[i][j]]++ = i; free (nedges); free (end_R); /* Free the input: it is replaced with the result. */ for (i = 0; i < n; i++) - XFREE ((*R_arg)[i]); - free (*R_arg); + free (r[i]); + free (r); if (trace_flag & trace_sets) { diff --git a/src/bin/bison/src/relation.h b/src/bin/bison/src/relation.h index f79174c248..479e42ecf0 100644 --- a/src/bin/bison/src/relation.h +++ b/src/bin/bison/src/relation.h @@ -15,8 +15,8 @@ You should have received a copy of the GNU General Public License along with Bison; see the file COPYING. If not, write to - the Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. */ #ifndef RELATION_H_ @@ -25,24 +25,26 @@ /* Performing operations on graphs coded as list of adjacency. If GRAPH is a relation, then GRAPH[Node] is a list of adjacent - nodes, ended with -1. */ + nodes, ended with END_NODE. */ -typedef short int relation_node; +#define END_NODE ((relation_node) -1) + +typedef size_t relation_node; typedef relation_node *relation_nodes; typedef relation_nodes *relation; /* Report a relation R that has SIZE vertices. */ -void relation_print (relation r, size_t size, FILE *out); +void relation_print (relation r, relation_node size, FILE *out); /* Compute the transitive closure of the FUNCTION on the relation R with SIZE vertices. If R (NODE-1, NODE-2) then on exit FUNCTION[NODE - 1] was extended (unioned) with FUNCTION[NODE - 2]. */ -void relation_digraph (relation r, size_t size, bitsetv *function); +void relation_digraph (relation r, relation_node size, bitsetv *function); /* Destructively transpose *R_ARG, of size N. */ -void relation_transpose (relation *R_arg, int n); +void relation_transpose (relation *R_arg, relation_node n); #endif /* ! RELATION_H_ */ diff --git a/src/bin/bison/src/scan-gram.c b/src/bin/bison/src/scan-gram.c index 72aa905c70..f15f19f036 100644 --- a/src/bin/bison/src/scan-gram.c +++ b/src/bin/bison/src/scan-gram.c @@ -1,58 +1,107 @@ -#define yy_create_buffer gram__create_buffer -#define yy_delete_buffer gram__delete_buffer -#define yy_scan_buffer gram__scan_buffer -#define yy_scan_string gram__scan_string -#define yy_scan_bytes gram__scan_bytes -#define yy_flex_debug gram__flex_debug -#define yy_init_buffer gram__init_buffer -#define yy_flush_buffer gram__flush_buffer -#define yy_load_buffer_state gram__load_buffer_state -#define yy_switch_to_buffer gram__switch_to_buffer -#define yyin gram_in -#define yyleng gram_leng -#define yylex gram_lex -#define yyout gram_out -#define yyrestart gram_restart -#define yytext gram_text +#line 2 "scan-gram.c" + +#line 4 "scan-gram.c" + +#define YY_INT_ALIGNED short int -#line 19 "scan-gram.c" /* A lexical scanner generated by flex */ -/* Scanner skeleton version: - * $Header: /tmp/bonefish/open-beos/current/src/apps/bin/bison/src/scan-gram.c,v 1.1 2004/06/01 09:52:40 korli Exp $ - */ - #define FLEX_SCANNER #define YY_FLEX_MAJOR_VERSION 2 #define YY_FLEX_MINOR_VERSION 5 +#define YY_FLEX_SUBMINOR_VERSION 31 +#if YY_FLEX_SUBMINOR_VERSION > 0 +#define FLEX_BETA +#endif +/* %if-c++-only */ +/* %endif */ + +/* %if-c-only */ + +/* %endif */ + +/* %if-c-only */ + +/* %endif */ + +/* First, we deal with platform-specific or compiler-specific issues. */ + +/* begin standard C headers. */ +/* %if-c-only */ #include +#include #include +#include +/* %endif */ -/* cfront 1.2 defines "c_plusplus" instead of "__cplusplus" */ -#ifdef c_plusplus -#ifndef __cplusplus -#define __cplusplus +/* %if-tables-serialization */ +/* %endif */ +/* end standard C headers. */ + +/* %if-c-or-c++ */ +/* flex integer type definitions */ + +#ifndef FLEXINT_H +#define FLEXINT_H + +/* C99 systems have . Non-C99 systems may or may not. */ + +#if defined __STDC_VERSION__ && __STDC_VERSION__ >= 199901L +#include +typedef int8_t flex_int8_t; +typedef uint8_t flex_uint8_t; +typedef int16_t flex_int16_t; +typedef uint16_t flex_uint16_t; +typedef int32_t flex_int32_t; +typedef uint32_t flex_uint32_t; +#else +typedef signed char flex_int8_t; +typedef short int flex_int16_t; +typedef int flex_int32_t; +typedef unsigned char flex_uint8_t; +typedef unsigned short int flex_uint16_t; +typedef unsigned int flex_uint32_t; +#endif /* ! C99 */ + +/* Limits of integral types. */ +#ifndef INT8_MIN +#define INT8_MIN (-128) #endif +#ifndef INT16_MIN +#define INT16_MIN (-32767-1) +#endif +#ifndef INT32_MIN +#define INT32_MIN (-2147483647-1) +#endif +#ifndef INT8_MAX +#define INT8_MAX (127) +#endif +#ifndef INT16_MAX +#define INT16_MAX (32767) +#endif +#ifndef INT32_MAX +#define INT32_MAX (2147483647) +#endif +#ifndef UINT8_MAX +#define UINT8_MAX (255U) +#endif +#ifndef UINT16_MAX +#define UINT16_MAX (65535U) +#endif +#ifndef UINT32_MAX +#define UINT32_MAX (4294967295U) #endif +#endif /* ! FLEXINT_H */ + +/* %endif */ + +/* %if-c++-only */ +/* %endif */ #ifdef __cplusplus -#include -#ifndef _WIN32 -#include -#else -#ifndef YY_ALWAYS_INTERACTIVE -#ifndef YY_NEVER_INTERACTIVE -extern int isatty YY_PROTO(( int )); -#endif -#endif -#endif - -/* Use prototypes in function declarations. */ -#define YY_USE_PROTOS - /* The "const" storage-class-modifier is valid. */ #define YY_USE_CONST @@ -60,36 +109,24 @@ extern int isatty YY_PROTO(( int )); #if __STDC__ -#define YY_USE_PROTOS #define YY_USE_CONST #endif /* __STDC__ */ #endif /* ! __cplusplus */ -#ifdef __TURBOC__ - #pragma warn -rch - #pragma warn -use -#include -#include -#define YY_USE_CONST -#define YY_USE_PROTOS -#endif - #ifdef YY_USE_CONST #define yyconst const #else #define yyconst #endif - -#ifdef YY_USE_PROTOS -#define YY_PROTO(proto) proto -#else -#define YY_PROTO(proto) () -#endif +/* %not-for-header */ /* Returned upon end-of-file. */ #define YY_NULL 0 +/* %ok-for-header */ + +/* %not-for-header */ /* Promotes a possibly negative, possibly signed char to an unsigned * integer for use as an array index. If the signed char is negative, @@ -97,79 +134,98 @@ extern int isatty YY_PROTO(( int )); * double cast. */ #define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c) +/* %ok-for-header */ + +/* %if-reentrant */ +/* %endif */ + +/* %if-not-reentrant */ + +/* %endif */ /* Enter a start condition. This macro really ought to take a parameter, * but we do it the disgusting crufty way forced on us by the ()-less * definition of BEGIN. */ -#define BEGIN yy_start = 1 + 2 * +#define BEGIN (yy_start) = 1 + 2 * /* Translate the current start state into a value that can be later handed * to BEGIN to return to the state. The YYSTATE alias is for lex * compatibility. */ -#define YY_START ((yy_start - 1) / 2) +#define YY_START (((yy_start) - 1) / 2) #define YYSTATE YY_START /* Action number for EOF rule of a given start state. */ #define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1) /* Special action meaning "start processing a new file". */ -#define YY_NEW_FILE yyrestart( yyin ) +#define YY_NEW_FILE gram_restart(gram_in ) #define YY_END_OF_BUFFER_CHAR 0 /* Size of default input buffer. */ +#ifndef YY_BUF_SIZE #define YY_BUF_SIZE 16384 +#endif +#ifndef YY_TYPEDEF_YY_BUFFER_STATE +#define YY_TYPEDEF_YY_BUFFER_STATE typedef struct yy_buffer_state *YY_BUFFER_STATE; +#endif -extern int yyleng; -extern FILE *yyin, *yyout; +/* %if-not-reentrant */ +extern int gram_leng; +/* %endif */ + +/* %if-c-only */ +/* %if-not-reentrant */ +extern FILE *gram_in, *gram_out; +/* %endif */ +/* %endif */ #define EOB_ACT_CONTINUE_SCAN 0 #define EOB_ACT_END_OF_FILE 1 #define EOB_ACT_LAST_MATCH 2 -/* The funky do-while in the following #define is used to turn the definition - * int a single C statement (which needs a semi-colon terminator). This - * avoids problems with code like: - * - * if ( condition_holds ) - * yyless( 5 ); - * else - * do_something_else(); - * - * Prior to using the do-while the compiler would get upset at the - * "else" because it interpreted the "if" statement as being all - * done when it reached the ';' after the yyless() call. - */ - -/* Return all but the first 'n' matched characters back to the input stream. */ - + #define YY_LESS_LINENO(n) + +/* Return all but the first "n" matched characters back to the input stream. */ #define yyless(n) \ do \ { \ - /* Undo effects of setting up yytext. */ \ - *yy_cp = yy_hold_char; \ + /* Undo effects of setting up gram_text. */ \ + int yyless_macro_arg = (n); \ + YY_LESS_LINENO(yyless_macro_arg);\ + *yy_cp = (yy_hold_char); \ YY_RESTORE_YY_MORE_OFFSET \ - yy_c_buf_p = yy_cp = yy_bp + n - YY_MORE_ADJ; \ - YY_DO_BEFORE_ACTION; /* set up yytext again */ \ + (yy_c_buf_p) = yy_cp = yy_bp + yyless_macro_arg - YY_MORE_ADJ; \ + YY_DO_BEFORE_ACTION; /* set up gram_text again */ \ } \ while ( 0 ) -#define unput(c) yyunput( c, yytext_ptr ) +#define unput(c) yyunput( c, (yytext_ptr) ) /* The following is because we cannot portably get our hands on size_t * (without autoconf's help, which isn't available because we want * flex-generated scanners to compile on their own). */ + +#ifndef YY_TYPEDEF_YY_SIZE_T +#define YY_TYPEDEF_YY_SIZE_T typedef unsigned int yy_size_t; +#endif - +#ifndef YY_STRUCT_YY_BUFFER_STATE +#define YY_STRUCT_YY_BUFFER_STATE struct yy_buffer_state { +/* %if-c-only */ FILE *yy_input_file; +/* %endif */ + +/* %if-c++-only */ +/* %endif */ char *yy_ch_buf; /* input buffer */ char *yy_buf_pos; /* current position in input buffer */ @@ -203,12 +259,16 @@ struct yy_buffer_state */ int yy_at_bol; + int yy_bs_lineno; /**< The line count. */ + int yy_bs_column; /**< The column count. */ + /* Whether to try to fill the input buffer when we reach the * end of it. */ int yy_fill_buffer; int yy_buffer_status; + #define YY_BUFFER_NEW 0 #define YY_BUFFER_NORMAL 1 /* When an EOF's been seen but there's still some text to process @@ -218,106 +278,167 @@ struct yy_buffer_state * possible backing-up. * * When we actually see the EOF, we change the status to "new" - * (via yyrestart()), so that the user can continue scanning by - * just pointing yyin at a new input file. + * (via gram_restart()), so that the user can continue scanning by + * just pointing gram_in at a new input file. */ #define YY_BUFFER_EOF_PENDING 2 - }; -static YY_BUFFER_STATE yy_current_buffer = 0; + }; +#endif /* !YY_STRUCT_YY_BUFFER_STATE */ + +/* %if-c-only Standard (non-C++) definition */ +/* %not-for-header */ + +/* %if-not-reentrant */ + +/* Stack of input buffers. */ +static size_t yy_buffer_stack_top = 0; /**< index of top of stack. */ +static size_t yy_buffer_stack_max = 0; /**< capacity of stack. */ +static YY_BUFFER_STATE * yy_buffer_stack = 0; /**< Stack as an array. */ +/* %endif */ +/* %ok-for-header */ + +/* %endif */ /* We provide macros for accessing buffer states in case in the * future we want to put the buffer states in a more general * "scanner state". + * + * Returns the top of the stack, or NULL. */ -#define YY_CURRENT_BUFFER yy_current_buffer +#define YY_CURRENT_BUFFER ( (yy_buffer_stack) \ + ? (yy_buffer_stack)[(yy_buffer_stack_top)] \ + : NULL) +/* Same as previous macro, but useful when we know that the buffer stack is not + * NULL or when we need an lvalue. For internal use only. + */ +#define YY_CURRENT_BUFFER_LVALUE (yy_buffer_stack)[(yy_buffer_stack_top)] -/* yy_hold_char holds the character lost when yytext is formed. */ +/* %if-c-only Standard (non-C++) definition */ + +/* %if-not-reentrant */ +/* %not-for-header */ + +/* yy_hold_char holds the character lost when gram_text is formed. */ static char yy_hold_char; - static int yy_n_chars; /* number of characters read into yy_ch_buf */ - - -int yyleng; +int gram_leng; /* Points to current character in buffer. */ static char *yy_c_buf_p = (char *) 0; static int yy_init = 1; /* whether we need to initialize */ static int yy_start = 0; /* start state number */ -/* Flag which is used to allow yywrap()'s to do buffer switches - * instead of setting up a fresh yyin. A bit of a hack ... +/* Flag which is used to allow gram_wrap()'s to do buffer switches + * instead of setting up a fresh gram_in. A bit of a hack ... */ static int yy_did_buffer_switch_on_eof; +/* %ok-for-header */ -void yyrestart YY_PROTO(( FILE *input_file )); +/* %endif */ -void yy_switch_to_buffer YY_PROTO(( YY_BUFFER_STATE new_buffer )); -void yy_load_buffer_state YY_PROTO(( void )); -YY_BUFFER_STATE yy_create_buffer YY_PROTO(( FILE *file, int size )); -void yy_delete_buffer YY_PROTO(( YY_BUFFER_STATE b )); -void yy_init_buffer YY_PROTO(( YY_BUFFER_STATE b, FILE *file )); -void yy_flush_buffer YY_PROTO(( YY_BUFFER_STATE b )); -#define YY_FLUSH_BUFFER yy_flush_buffer( yy_current_buffer ) +void gram_restart (FILE *input_file ); +void gram__switch_to_buffer (YY_BUFFER_STATE new_buffer ); +YY_BUFFER_STATE gram__create_buffer (FILE *file,int size ); +void gram__delete_buffer (YY_BUFFER_STATE b ); +void gram__flush_buffer (YY_BUFFER_STATE b ); +void gram_push_buffer_state (YY_BUFFER_STATE new_buffer ); +void gram_pop_buffer_state (void ); -YY_BUFFER_STATE yy_scan_buffer YY_PROTO(( char *base, yy_size_t size )); -YY_BUFFER_STATE yy_scan_string YY_PROTO(( yyconst char *yy_str )); -YY_BUFFER_STATE yy_scan_bytes YY_PROTO(( yyconst char *bytes, int len )); +static void gram_ensure_buffer_stack (void ); +static void gram__load_buffer_state (void ); +static void gram__init_buffer (YY_BUFFER_STATE b,FILE *file ); -static void *yy_flex_alloc YY_PROTO(( yy_size_t )); -static void *yy_flex_realloc YY_PROTO(( void *, yy_size_t )); -static void yy_flex_free YY_PROTO(( void * )); +#define YY_FLUSH_BUFFER gram__flush_buffer(YY_CURRENT_BUFFER ) -#define yy_new_buffer yy_create_buffer +YY_BUFFER_STATE gram__scan_buffer (char *base,yy_size_t size ); +YY_BUFFER_STATE gram__scan_string (yyconst char *yy_str ); +YY_BUFFER_STATE gram__scan_bytes (yyconst char *bytes,int len ); + +/* %endif */ + +void *gram_alloc (yy_size_t ); +void *gram_realloc (void *,yy_size_t ); +void gram_free (void * ); + +#define yy_new_buffer gram__create_buffer #define yy_set_interactive(is_interactive) \ { \ - if ( ! yy_current_buffer ) \ - yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE ); \ - yy_current_buffer->yy_is_interactive = is_interactive; \ + if ( ! YY_CURRENT_BUFFER ){ \ + gram_ensure_buffer_stack (); \ + YY_CURRENT_BUFFER_LVALUE = \ + gram__create_buffer(gram_in,YY_BUF_SIZE ); \ + } \ + YY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \ } #define yy_set_bol(at_bol) \ { \ - if ( ! yy_current_buffer ) \ - yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE ); \ - yy_current_buffer->yy_at_bol = at_bol; \ + if ( ! YY_CURRENT_BUFFER ){\ + gram_ensure_buffer_stack (); \ + YY_CURRENT_BUFFER_LVALUE = \ + gram__create_buffer(gram_in,YY_BUF_SIZE ); \ + } \ + YY_CURRENT_BUFFER_LVALUE->yy_at_bol = at_bol; \ } -#define YY_AT_BOL() (yy_current_buffer->yy_at_bol) +#define YY_AT_BOL() (YY_CURRENT_BUFFER_LVALUE->yy_at_bol) +/* %% [1.0] gram_text/gram_in/gram_out/yy_state_type/gram_lineno etc. def's & init go here */ +/* Begin user sect3 */ -#define yywrap() 1 +#define gram_wrap(n) 1 #define YY_SKIP_YYWRAP #define FLEX_DEBUG + typedef unsigned char YY_CHAR; -FILE *yyin = (FILE *) 0, *yyout = (FILE *) 0; + +FILE *gram_in = (FILE *) 0, *gram_out = (FILE *) 0; + typedef int yy_state_type; -#define FLEX_DEBUG -extern char *yytext; -#define yytext_ptr yytext +extern int gram_lineno; -static yy_state_type yy_get_previous_state YY_PROTO(( void )); -static yy_state_type yy_try_NUL_trans YY_PROTO(( yy_state_type current_state )); -static int yy_get_next_buffer YY_PROTO(( void )); -static void yy_fatal_error YY_PROTO(( yyconst char msg[] )); +int gram_lineno = 1; + +extern char *gram_text; +#define yytext_ptr gram_text + +/* %if-c-only Standard (non-C++) definition */ + +static yy_state_type yy_get_previous_state (void ); +static yy_state_type yy_try_NUL_trans (yy_state_type current_state ); +static int yy_get_next_buffer (void ); +static void yy_fatal_error (yyconst char msg[] ); + +/* %endif */ /* Done after the current pattern has been matched and before the - * corresponding action - sets up yytext. + * corresponding action - sets up gram_text. */ #define YY_DO_BEFORE_ACTION \ - yytext_ptr = yy_bp; \ - yyleng = (int) (yy_cp - yy_bp); \ - yy_hold_char = *yy_cp; \ + (yytext_ptr) = yy_bp; \ +/* %% [2.0] code to fiddle gram_text and gram_leng for yymore() goes here \ */\ + gram_leng = (size_t) (yy_cp - yy_bp); \ + (yy_hold_char) = *yy_cp; \ *yy_cp = '\0'; \ - yy_c_buf_p = yy_cp; +/* %% [3.0] code to copy yytext_ptr to gram_text[] goes here, if %array \ */\ + (yy_c_buf_p) = yy_cp; +/* %% [4.0] data tables for the DFA and the user's section 1 definitions go here */ #define YY_NUM_RULES 106 #define YY_END_OF_BUFFER 107 -static yyconst short int yy_accept[455] = +/* This struct is not used in this scanner, + but its presence is necessary. */ +struct yy_trans_info + { + flex_int32_t yy_verify; + flex_int32_t yy_nxt; + }; +static yyconst flex_int16_t yy_accept[455] = { 0, 0, 0, 0, 0, 65, 65, 0, 0, 83, 83, 83, 83, 0, 0, 0, 0, 0, 0, 0, 0, @@ -371,7 +492,7 @@ static yyconst short int yy_accept[455] = 45, 45, 28, 0 } ; -static yyconst int yy_ec[256] = +static yyconst flex_int32_t yy_ec[256] = { 0, 1, 1, 1, 1, 1, 1, 1, 1, 2, 3, 2, 2, 1, 1, 1, 1, 1, 1, 1, 1, @@ -403,7 +524,7 @@ static yyconst int yy_ec[256] = 1, 1, 1, 1, 1 } ; -static yyconst int yy_meta[58] = +static yyconst flex_int32_t yy_meta[58] = { 0, 1, 1, 2, 1, 1, 1, 3, 1, 1, 1, 1, 4, 5, 1, 6, 6, 6, 1, 1, 1, @@ -413,7 +534,7 @@ static yyconst int yy_meta[58] = 5, 5, 5, 1, 1, 1, 7 } ; -static yyconst short int yy_base[477] = +static yyconst flex_int16_t yy_base[477] = { 0, 0, 725, 55, 56, 64, 67, 720, 719, 95, 98, 105, 108, 137, 143, 101, 113, 147, 150, 160, 178, @@ -469,7 +590,7 @@ static yyconst short int yy_base[477] = 233, 203, 197, 138, 69, 507 } ; -static yyconst short int yy_def[477] = +static yyconst flex_int16_t yy_def[477] = { 0, 454, 1, 455, 455, 455, 455, 456, 456, 455, 455, 455, 455, 457, 457, 455, 455, 455, 455, 458, 458, @@ -525,7 +646,7 @@ static yyconst short int yy_def[477] = 454, 454, 454, 454, 454, 454 } ; -static yyconst short int yy_nxt[790] = +static yyconst flex_int16_t yy_nxt[790] = { 0, 28, 29, 30, 29, 31, 28, 28, 32, 33, 28, 34, 28, 35, 36, 37, 38, 38, 28, 39, 40, @@ -615,7 +736,7 @@ static yyconst short int yy_nxt[790] = 454, 454, 454, 454, 454, 454, 454, 454, 454 } ; -static yyconst short int yy_chk[790] = +static yyconst flex_int16_t yy_chk[790] = { 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, @@ -708,23 +829,23 @@ static yyconst short int yy_chk[790] = static yy_state_type yy_last_accepting_state; static char *yy_last_accepting_cpos; -extern int yy_flex_debug; -int yy_flex_debug = 1; +extern int gram__flex_debug; +int gram__flex_debug = 1; -static yyconst short int yy_rule_linenum[106] = +static yyconst flex_int16_t yy_rule_linenum[106] = { 0, - 162, 163, 164, 165, 173, 184, 185, 186, 187, 188, - 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, - 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, - 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, - 219, 220, 221, 222, 224, 228, 229, 230, 232, 239, - 243, 249, 252, 255, 258, 267, 275, 282, 299, 305, - 326, 327, 338, 349, 350, 362, 371, 382, 396, 402, - 412, 422, 434, 435, 436, 437, 438, 439, 440, 443, - 445, 454, 466, 471, 472, 478, 479, 490, 496, 502, - 508, 524, 558, 559, 560, 595, 597, 598, 610, 645, + 176, 177, 178, 179, 187, 198, 199, 200, 201, 202, + 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, + 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, + 223, 224, 225, 226, 227, 228, 229, 230, 231, 232, + 233, 234, 235, 236, 238, 242, 243, 244, 246, 253, + 257, 263, 266, 269, 272, 281, 289, 296, 313, 319, + 340, 341, 352, 363, 364, 376, 384, 395, 411, 417, + 427, 437, 449, 450, 451, 452, 453, 454, 455, 458, + 460, 469, 481, 486, 487, 493, 494, 505, 511, 517, + 523, 539, 573, 574, 575, 610, 612, 613, 625, 660, - 646, 647, 648, 656, 657 + 661, 662, 663, 671, 672 } ; /* The intent behind this definition is that it'll catch @@ -734,12 +855,11 @@ static yyconst short int yy_rule_linenum[106] = #define yymore() yymore_used_but_not_detected #define YY_MORE_ADJ 0 #define YY_RESTORE_YY_MORE_OFFSET -char *yytext; +char *gram_text; #line 1 "scan-gram.l" -#define INITIAL 0 /* Bison Grammar Scanner -*- C -*- - Copyright (C) 2002, 2003, 2004 Free Software Foundation, Inc. + Copyright (C) 2002, 2003, 2004, 2005 Free Software Foundation, Inc. This file is part of Bison, the GNU Compiler Compiler. @@ -755,11 +875,9 @@ char *yytext; You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA - 02111-1307 USA + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA + 02110-1301 USA */ -#define YY_NO_UNPUT 1 -#define YY_NEVER_INTERACTIVE 1 #line 27 "scan-gram.l" #include "system.h" @@ -771,6 +889,7 @@ char *yytext; #include "files.h" #include "getargs.h" #include "gram.h" +#include "quotearg.h" #include "reader.h" #include "uniqstr.h" @@ -784,14 +903,27 @@ char *yytext; } \ while (0) +/* Pacify "gcc -Wmissing-prototypes" when flex 2.5.31 is used. */ +int gram_get_lineno (void); +FILE *gram_get_in (void); +FILE *gram_get_out (void); +int gram_get_leng (void); +char *gram_get_text (void); +void gram_set_lineno (int); +void gram_set_in (FILE *); +void gram_set_out (FILE *); +int gram_get_debug (void); +void gram_set_debug (int); +int gram_lex_destroy (void); + /* Location of scanner cursor. */ boundary scanner_cursor; static void adjust_location (location *, char const *, size_t); -#define YY_USER_ACTION adjust_location (loc, yytext, yyleng); +#define YY_USER_ACTION adjust_location (loc, gram_text, gram_leng); static size_t no_cr_read (FILE *, char *, size_t); -#define YY_INPUT(buf, result, size) ((result) = no_cr_read (yyin, buf, size)) +#define YY_INPUT(buf, result, size) ((result) = no_cr_read (gram_in, buf, size)) /* OBSTACK_FOR_STRING -- Used to store all the characters that we need to @@ -810,7 +942,7 @@ static char *last_string; #define STRING_GROW \ - obstack_grow (&obstack_for_string, yytext, yyleng) + obstack_grow (&obstack_for_string, gram_text, gram_leng) #define STRING_FINISH \ do { \ @@ -843,29 +975,55 @@ static int convert_ucn_to_byte (char const *hex_text); static void unexpected_eof (boundary, char const *); static void unexpected_newline (boundary, char const *); -#define SC_COMMENT 1 -#define SC_LINE_COMMENT 2 -#define SC_YACC_COMMENT 3 -#define SC_STRING 4 -#define SC_CHARACTER 5 -#define SC_AFTER_IDENTIFIER 6 -#define SC_ESCAPED_STRING 7 -#define SC_ESCAPED_CHARACTER 8 -#define SC_PRE_CODE 9 -#define SC_BRACED_CODE 10 -#define SC_PROLOGUE 11 -#define SC_EPILOGUE 12 /* POSIX says that a tag must be both an id and a C union member, but historically almost any character is allowed in a tag. We disallow NUL and newline, as this simplifies our implementation. */ /* Zero or more instances of backslash-newline. Following GCC, allow white space between the backslash and the newline. */ -#line 869 "scan-gram.c" +#line 989 "scan-gram.c" + +#define INITIAL 0 +#define SC_COMMENT 1 +#define SC_LINE_COMMENT 2 +#define SC_YACC_COMMENT 3 +#define SC_STRING 4 +#define SC_CHARACTER 5 +#define SC_AFTER_IDENTIFIER 6 +#define SC_ESCAPED_STRING 7 +#define SC_ESCAPED_CHARACTER 8 +#define SC_PRE_CODE 9 +#define SC_BRACED_CODE 10 +#define SC_PROLOGUE 11 +#define SC_EPILOGUE 12 + +#ifndef YY_NO_UNISTD_H +/* Special case for "unistd.h", since it is non-ANSI. We include it way + * down here because we want the user's section 1 to have been scanned first. + * The user has a chance to override it with an option. + */ +/* %if-c-only */ +#include +/* %endif */ +/* %if-c++-only */ +/* %endif */ +#endif + +#ifndef YY_EXTRA_TYPE +#define YY_EXTRA_TYPE void * +#endif + +/* %if-c-only Reentrant structure and macros (non-C++). */ +/* %if-reentrant */ +/* %if-reentrant */ +/* %endif */ +/* %if-bison-bridge */ +/* %endif */ +/* %endif End reentrant structures and macros. */ /* Macros after this point can all be overridden by user definitions in * section 1. @@ -873,66 +1031,43 @@ static void unexpected_newline (boundary, char const *); #ifndef YY_SKIP_YYWRAP #ifdef __cplusplus -extern "C" int yywrap YY_PROTO(( void )); +extern "C" int gram_wrap (void ); #else -extern int yywrap YY_PROTO(( void )); +extern int gram_wrap (void ); #endif #endif -#ifndef YY_NO_UNPUT -static void yyunput YY_PROTO(( int c, char *buf_ptr )); -#endif +/* %not-for-header */ + +/* %ok-for-header */ + +/* %endif */ #ifndef yytext_ptr -static void yy_flex_strncpy YY_PROTO(( char *, yyconst char *, int )); +static void yy_flex_strncpy (char *,yyconst char *,int ); #endif #ifdef YY_NEED_STRLEN -static int yy_flex_strlen YY_PROTO(( yyconst char * )); +static int yy_flex_strlen (yyconst char * ); #endif #ifndef YY_NO_INPUT +/* %if-c-only Standard (non-C++) definition */ +/* %not-for-header */ + #ifdef __cplusplus -static int yyinput YY_PROTO(( void )); +static int yyinput (void ); #else -static int input YY_PROTO(( void )); +static int input (void ); #endif +/* %ok-for-header */ + +/* %endif */ #endif -#if YY_STACK_USED -static int yy_start_stack_ptr = 0; -static int yy_start_stack_depth = 0; -static int *yy_start_stack = 0; -#ifndef YY_NO_PUSH_STATE -static void yy_push_state YY_PROTO(( int new_state )); -#endif -#ifndef YY_NO_POP_STATE -static void yy_pop_state YY_PROTO(( void )); -#endif -#ifndef YY_NO_TOP_STATE -static int yy_top_state YY_PROTO(( void )); -#endif +/* %if-c-only */ -#else -#define YY_NO_PUSH_STATE 1 -#define YY_NO_POP_STATE 1 -#define YY_NO_TOP_STATE 1 -#endif - -#ifdef YY_MALLOC_DECL -YY_MALLOC_DECL -#else -#if __STDC__ -#ifndef __cplusplus -#include -#endif -#else -/* Just try to get by without declaring the routines. This will fail - * miserably on non-ANSI systems for which sizeof(size_t) != sizeof(int) - * or sizeof(void*) != sizeof(int). - */ -#endif -#endif +/* %endif */ /* Amount of stuff to slurp up with each read. */ #ifndef YY_READ_BUF_SIZE @@ -940,12 +1075,15 @@ YY_MALLOC_DECL #endif /* Copy whatever the last rule matched to the standard output. */ - #ifndef ECHO +/* %if-c-only Standard (non-C++) definition */ /* This used to be an fputs(), but since the string might contain NUL's, * we now use fwrite(). */ -#define ECHO (void) fwrite( yytext, yyleng, 1, yyout ) +#define ECHO (void) fwrite( gram_text, gram_leng, 1, gram_out ) +/* %endif */ +/* %if-c++-only C++ definition */ +/* %endif */ #endif /* Gets input and stuffs it into "buf". number of characters read, or YY_NULL, @@ -953,22 +1091,24 @@ YY_MALLOC_DECL */ #ifndef YY_INPUT #define YY_INPUT(buf,result,max_size) \ - if ( yy_current_buffer->yy_is_interactive ) \ +/* %% [5.0] fread()/read() definition of YY_INPUT goes here unless we're doing C++ \ */\ + if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \ { \ - int c = '*', n; \ + int c = '*'; \ + size_t n; \ for ( n = 0; n < max_size && \ - (c = getc( yyin )) != EOF && c != '\n'; ++n ) \ + (c = getc( gram_in )) != EOF && c != '\n'; ++n ) \ buf[n] = (char) c; \ if ( c == '\n' ) \ buf[n++] = (char) c; \ - if ( c == EOF && ferror( yyin ) ) \ + if ( c == EOF && ferror( gram_in ) ) \ YY_FATAL_ERROR( "input in flex scanner failed" ); \ result = n; \ } \ else \ { \ errno=0; \ - while ( (result = fread(buf, 1, max_size, yyin))==0 && ferror(yyin)) \ + while ( (result = fread(buf, 1, max_size, gram_in))==0 && ferror(gram_in)) \ { \ if( errno != EINTR) \ { \ @@ -976,9 +1116,13 @@ YY_MALLOC_DECL break; \ } \ errno=0; \ - clearerr(yyin); \ + clearerr(gram_in); \ } \ - } + }\ +\ +/* %if-c++-only C++ definition \ */\ +/* %endif */ + #endif /* No semi-colon after return; correct usage is to write "yyterminate();" - @@ -996,17 +1140,42 @@ YY_MALLOC_DECL /* Report a fatal error. */ #ifndef YY_FATAL_ERROR +/* %if-c-only */ #define YY_FATAL_ERROR(msg) yy_fatal_error( msg ) +/* %endif */ +/* %if-c++-only */ +/* %endif */ #endif +/* %if-tables-serialization structures and prototypes */ +/* %not-for-header */ + +/* %ok-for-header */ + +/* %not-for-header */ + +/* %tables-yydmap generated elements */ +/* %endif */ +/* end tables serialization structures and prototypes */ + +/* %ok-for-header */ + /* Default declaration of generated scanner - a define so the user can * easily add parameters. */ #ifndef YY_DECL -#define YY_DECL int yylex YY_PROTO(( void )) -#endif +#define YY_DECL_IS_OURS 1 +/* %if-c-only Standard (non-C++) definition */ -/* Code executed at the beginning of each rule, after yytext and yyleng +extern int gram_lex (void); + +#define YY_DECL int gram_lex (void) +/* %endif */ +/* %if-c++-only C++ definition */ +/* %endif */ +#endif /* !YY_DECL */ + +/* Code executed at the beginning of each rule, after gram_text and gram_leng * have been set up. */ #ifndef YY_USER_ACTION @@ -1018,19 +1187,25 @@ YY_MALLOC_DECL #define YY_BREAK break; #endif +/* %% [6.0] YY_RULE_SETUP definition goes here */ #define YY_RULE_SETUP \ - if ( yyleng > 0 ) \ - yy_current_buffer->yy_at_bol = \ - (yytext[yyleng - 1] == '\n'); \ + if ( gram_leng > 0 ) \ + YY_CURRENT_BUFFER_LVALUE->yy_at_bol = \ + (gram_text[gram_leng - 1] == '\n'); \ YY_USER_ACTION +/* %not-for-header */ + +/** The main scanner function which does all the work. + */ YY_DECL - { +{ register yy_state_type yy_current_state; register char *yy_cp, *yy_bp; register int yy_act; - -#line 130 "scan-gram.l" + +/* %% [7.0] user's declarations go here */ +#line 144 "scan-gram.l" /* Nesting level of the current code in braces. */ @@ -1046,7 +1221,7 @@ YY_DECL location id_loc IF_LINT (= empty_location); /* Where containing code started, when applicable. Its initial - value is relevant only when yylex is invoked in the SC_EPILOGUE + value is relevant only when gram_lex is invoked in the SC_EPILOGUE start condition. */ boundary code_start = scanner_cursor; @@ -1060,45 +1235,57 @@ YY_DECL | Scanning white space. | `-----------------------*/ -#line 1064 "scan-gram.c" +#line 1239 "scan-gram.c" - if ( yy_init ) + if ( (yy_init) ) { - yy_init = 0; + (yy_init) = 0; #ifdef YY_USER_INIT YY_USER_INIT; #endif - if ( ! yy_start ) - yy_start = 1; /* first start state */ + if ( ! (yy_start) ) + (yy_start) = 1; /* first start state */ - if ( ! yyin ) - yyin = stdin; + if ( ! gram_in ) +/* %if-c-only */ + gram_in = stdin; +/* %endif */ +/* %if-c++-only */ +/* %endif */ - if ( ! yyout ) - yyout = stdout; + if ( ! gram_out ) +/* %if-c-only */ + gram_out = stdout; +/* %endif */ +/* %if-c++-only */ +/* %endif */ - if ( ! yy_current_buffer ) - yy_current_buffer = - yy_create_buffer( yyin, YY_BUF_SIZE ); + if ( ! YY_CURRENT_BUFFER ) { + gram_ensure_buffer_stack (); + YY_CURRENT_BUFFER_LVALUE = + gram__create_buffer(gram_in,YY_BUF_SIZE ); + } - yy_load_buffer_state(); + gram__load_buffer_state( ); } while ( 1 ) /* loops until end-of-file is reached */ { - yy_cp = yy_c_buf_p; +/* %% [8.0] yymore()-related code goes here */ + yy_cp = (yy_c_buf_p); - /* Support of yytext. */ - *yy_cp = yy_hold_char; + /* Support of gram_text. */ + *yy_cp = (yy_hold_char); /* yy_bp points to the position in yy_ch_buf of the start of * the current run. */ yy_bp = yy_cp; - yy_current_state = yy_start; +/* %% [9.0] code to set up and find next match goes here */ + yy_current_state = (yy_start); yy_current_state += YY_AT_BOL(); yy_match: do @@ -1106,8 +1293,8 @@ yy_match: register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)]; if ( yy_accept[yy_current_state] ) { - yy_last_accepting_state = yy_current_state; - yy_last_accepting_cpos = yy_cp; + (yy_last_accepting_state) = yy_current_state; + (yy_last_accepting_cpos) = yy_cp; } while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) { @@ -1118,32 +1305,31 @@ yy_match: yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; ++yy_cp; } - while ( yy_base[yy_current_state] != 732 ); + while ( yy_current_state != 454 ); + yy_cp = (yy_last_accepting_cpos); + yy_current_state = (yy_last_accepting_state); yy_find_action: +/* %% [10.0] code to find the action number goes here */ yy_act = yy_accept[yy_current_state]; - if ( yy_act == 0 ) - { /* have to back up */ - yy_cp = yy_last_accepting_cpos; - yy_current_state = yy_last_accepting_state; - yy_act = yy_accept[yy_current_state]; - } YY_DO_BEFORE_ACTION; +/* %% [11.0] code for gram_lineno update goes here */ do_action: /* This label is used only to access EOF actions. */ - if ( yy_flex_debug ) +/* %% [12.0] debug code goes here */ + if ( gram__flex_debug ) { if ( yy_act == 0 ) fprintf( stderr, "--scanner backing up\n" ); else if ( yy_act < 106 ) - fprintf( stderr, "--accepting rule at line %d (\"%s\")\n", - yy_rule_linenum[yy_act], yytext ); + fprintf( stderr, "--accepting rule at line %ld (\"%s\")\n", + (long)yy_rule_linenum[yy_act], gram_text ); else if ( yy_act == 106 ) fprintf( stderr, "--accepting default rule (\"%s\")\n", - yytext ); + gram_text ); else if ( yy_act == 107 ) fprintf( stderr, "--(end of buffer or a NUL)\n" ); else @@ -1152,31 +1338,32 @@ do_action: /* This label is used only to access EOF actions. */ switch ( yy_act ) { /* beginning of action switch */ +/* %% [13.0] actions go here */ case 0: /* must back up */ /* undo the effects of YY_DO_BEFORE_ACTION */ - *yy_cp = yy_hold_char; - yy_cp = yy_last_accepting_cpos; - yy_current_state = yy_last_accepting_state; + *yy_cp = (yy_hold_char); + yy_cp = (yy_last_accepting_cpos); + yy_current_state = (yy_last_accepting_state); goto yy_find_action; - - /* Comments and white space. */ case 1: YY_RULE_SETUP -#line 162 "scan-gram.l" +#line 176 "scan-gram.l" warn_at (*loc, _("stray `,' treated as white space")); YY_BREAK case 2: -#line 164 "scan-gram.l" +/* rule 2 can match eol */ +#line 178 "scan-gram.l" case 3: +/* rule 3 can match eol */ YY_RULE_SETUP -#line 164 "scan-gram.l" +#line 178 "scan-gram.l" ; YY_BREAK case 4: YY_RULE_SETUP -#line 165 "scan-gram.l" +#line 179 "scan-gram.l" { token_start = loc->start; context_state = YY_START; @@ -1186,10 +1373,11 @@ YY_RULE_SETUP /* #line directives are not documented, and may be withdrawn or modified in future versions of Bison. */ case 5: +/* rule 5 can match eol */ YY_RULE_SETUP -#line 173 "scan-gram.l" +#line 187 "scan-gram.l" { - handle_syncline (yytext + sizeof "#line " - 1); + handle_syncline (gram_text + sizeof "#line " - 1); } YY_BREAK @@ -1200,226 +1388,226 @@ YY_RULE_SETUP case 6: YY_RULE_SETUP -#line 184 "scan-gram.l" +#line 198 "scan-gram.l" return PERCENT_NONASSOC; YY_BREAK case 7: YY_RULE_SETUP -#line 185 "scan-gram.l" +#line 199 "scan-gram.l" return PERCENT_DEBUG; YY_BREAK case 8: YY_RULE_SETUP -#line 186 "scan-gram.l" +#line 200 "scan-gram.l" return PERCENT_DEFAULT_PREC; YY_BREAK case 9: YY_RULE_SETUP -#line 187 "scan-gram.l" +#line 201 "scan-gram.l" return PERCENT_DEFINE; YY_BREAK case 10: YY_RULE_SETUP -#line 188 "scan-gram.l" +#line 202 "scan-gram.l" return PERCENT_DEFINES; YY_BREAK case 11: YY_RULE_SETUP -#line 189 "scan-gram.l" +#line 203 "scan-gram.l" token_type = PERCENT_DESTRUCTOR; BEGIN SC_PRE_CODE; YY_BREAK case 12: YY_RULE_SETUP -#line 190 "scan-gram.l" +#line 204 "scan-gram.l" return PERCENT_DPREC; YY_BREAK case 13: YY_RULE_SETUP -#line 191 "scan-gram.l" +#line 205 "scan-gram.l" return PERCENT_ERROR_VERBOSE; YY_BREAK case 14: YY_RULE_SETUP -#line 192 "scan-gram.l" +#line 206 "scan-gram.l" return PERCENT_EXPECT; YY_BREAK case 15: YY_RULE_SETUP -#line 193 "scan-gram.l" +#line 207 "scan-gram.l" return PERCENT_EXPECT_RR; YY_BREAK case 16: YY_RULE_SETUP -#line 194 "scan-gram.l" +#line 208 "scan-gram.l" return PERCENT_FILE_PREFIX; YY_BREAK case 17: YY_RULE_SETUP -#line 195 "scan-gram.l" +#line 209 "scan-gram.l" return PERCENT_YACC; YY_BREAK case 18: YY_RULE_SETUP -#line 196 "scan-gram.l" +#line 210 "scan-gram.l" token_type = PERCENT_INITIAL_ACTION; BEGIN SC_PRE_CODE; YY_BREAK case 19: YY_RULE_SETUP -#line 197 "scan-gram.l" +#line 211 "scan-gram.l" return PERCENT_GLR_PARSER; YY_BREAK case 20: YY_RULE_SETUP -#line 198 "scan-gram.l" +#line 212 "scan-gram.l" return PERCENT_LEFT; YY_BREAK case 21: YY_RULE_SETUP -#line 199 "scan-gram.l" +#line 213 "scan-gram.l" token_type = PERCENT_LEX_PARAM; BEGIN SC_PRE_CODE; YY_BREAK case 22: YY_RULE_SETUP -#line 200 "scan-gram.l" +#line 214 "scan-gram.l" return PERCENT_LOCATIONS; YY_BREAK case 23: YY_RULE_SETUP -#line 201 "scan-gram.l" +#line 215 "scan-gram.l" return PERCENT_MERGE; YY_BREAK case 24: YY_RULE_SETUP -#line 202 "scan-gram.l" +#line 216 "scan-gram.l" return PERCENT_NAME_PREFIX; YY_BREAK case 25: YY_RULE_SETUP -#line 203 "scan-gram.l" +#line 217 "scan-gram.l" return PERCENT_NO_DEFAULT_PREC; YY_BREAK case 26: YY_RULE_SETUP -#line 204 "scan-gram.l" +#line 218 "scan-gram.l" return PERCENT_NO_LINES; YY_BREAK case 27: YY_RULE_SETUP -#line 205 "scan-gram.l" +#line 219 "scan-gram.l" return PERCENT_NONASSOC; YY_BREAK case 28: YY_RULE_SETUP -#line 206 "scan-gram.l" +#line 220 "scan-gram.l" return PERCENT_NONDETERMINISTIC_PARSER; YY_BREAK case 29: YY_RULE_SETUP -#line 207 "scan-gram.l" +#line 221 "scan-gram.l" return PERCENT_NTERM; YY_BREAK case 30: YY_RULE_SETUP -#line 208 "scan-gram.l" +#line 222 "scan-gram.l" return PERCENT_OUTPUT; YY_BREAK case 31: YY_RULE_SETUP -#line 209 "scan-gram.l" +#line 223 "scan-gram.l" token_type = PERCENT_PARSE_PARAM; BEGIN SC_PRE_CODE; YY_BREAK case 32: YY_RULE_SETUP -#line 210 "scan-gram.l" +#line 224 "scan-gram.l" rule_length--; return PERCENT_PREC; YY_BREAK case 33: YY_RULE_SETUP -#line 211 "scan-gram.l" +#line 225 "scan-gram.l" token_type = PERCENT_PRINTER; BEGIN SC_PRE_CODE; YY_BREAK case 34: YY_RULE_SETUP -#line 212 "scan-gram.l" +#line 226 "scan-gram.l" return PERCENT_PURE_PARSER; YY_BREAK case 35: YY_RULE_SETUP -#line 213 "scan-gram.l" +#line 227 "scan-gram.l" return PERCENT_RIGHT; YY_BREAK case 36: YY_RULE_SETUP -#line 214 "scan-gram.l" +#line 228 "scan-gram.l" return PERCENT_SKELETON; YY_BREAK case 37: YY_RULE_SETUP -#line 215 "scan-gram.l" +#line 229 "scan-gram.l" return PERCENT_START; YY_BREAK case 38: YY_RULE_SETUP -#line 216 "scan-gram.l" +#line 230 "scan-gram.l" return PERCENT_TOKEN; YY_BREAK case 39: YY_RULE_SETUP -#line 217 "scan-gram.l" +#line 231 "scan-gram.l" return PERCENT_TOKEN; YY_BREAK case 40: YY_RULE_SETUP -#line 218 "scan-gram.l" +#line 232 "scan-gram.l" return PERCENT_TOKEN_TABLE; YY_BREAK case 41: YY_RULE_SETUP -#line 219 "scan-gram.l" +#line 233 "scan-gram.l" return PERCENT_TYPE; YY_BREAK case 42: YY_RULE_SETUP -#line 220 "scan-gram.l" +#line 234 "scan-gram.l" token_type = PERCENT_UNION; BEGIN SC_PRE_CODE; YY_BREAK case 43: YY_RULE_SETUP -#line 221 "scan-gram.l" +#line 235 "scan-gram.l" return PERCENT_VERBOSE; YY_BREAK case 44: YY_RULE_SETUP -#line 222 "scan-gram.l" +#line 236 "scan-gram.l" return PERCENT_YACC; YY_BREAK case 45: YY_RULE_SETUP -#line 224 "scan-gram.l" +#line 238 "scan-gram.l" { - complain_at (*loc, _("invalid directive: %s"), quote (yytext)); + complain_at (*loc, _("invalid directive: %s"), quote (gram_text)); } YY_BREAK case 46: YY_RULE_SETUP -#line 228 "scan-gram.l" +#line 242 "scan-gram.l" return EQUAL; YY_BREAK case 47: YY_RULE_SETUP -#line 229 "scan-gram.l" +#line 243 "scan-gram.l" rule_length = 0; return PIPE; YY_BREAK case 48: YY_RULE_SETUP -#line 230 "scan-gram.l" +#line 244 "scan-gram.l" return SEMICOLON; YY_BREAK case 49: YY_RULE_SETUP -#line 232 "scan-gram.l" +#line 246 "scan-gram.l" { - val->symbol = symbol_get (yytext, *loc); + val->symbol = symbol_get (gram_text, *loc); id_loc = *loc; rule_length++; BEGIN SC_AFTER_IDENTIFIER; @@ -1427,42 +1615,42 @@ YY_RULE_SETUP YY_BREAK case 50: YY_RULE_SETUP -#line 239 "scan-gram.l" +#line 253 "scan-gram.l" { - val->integer = scan_integer (yytext, 10, *loc); + val->integer = scan_integer (gram_text, 10, *loc); return INT; } YY_BREAK case 51: YY_RULE_SETUP -#line 243 "scan-gram.l" +#line 257 "scan-gram.l" { - val->integer = scan_integer (yytext, 16, *loc); + val->integer = scan_integer (gram_text, 16, *loc); return INT; } YY_BREAK /* Characters. We don't check there is only one. */ case 52: YY_RULE_SETUP -#line 249 "scan-gram.l" +#line 263 "scan-gram.l" STRING_GROW; token_start = loc->start; BEGIN SC_ESCAPED_CHARACTER; YY_BREAK /* Strings. */ case 53: YY_RULE_SETUP -#line 252 "scan-gram.l" -STRING_GROW; token_start = loc->start; BEGIN SC_ESCAPED_STRING; +#line 266 "scan-gram.l" +token_start = loc->start; BEGIN SC_ESCAPED_STRING; YY_BREAK /* Prologue. */ case 54: YY_RULE_SETUP -#line 255 "scan-gram.l" +#line 269 "scan-gram.l" code_start = loc->start; BEGIN SC_PROLOGUE; YY_BREAK /* Code in between braces. */ case 55: YY_RULE_SETUP -#line 258 "scan-gram.l" +#line 272 "scan-gram.l" { STRING_GROW; token_type = BRACED_CODE; @@ -1474,9 +1662,9 @@ YY_RULE_SETUP /* A type. */ case 56: YY_RULE_SETUP -#line 267 "scan-gram.l" +#line 281 "scan-gram.l" { - obstack_grow (&obstack_for_string, yytext + 1, yyleng - 2); + obstack_grow (&obstack_for_string, gram_text + 1, gram_leng - 2); STRING_FINISH; val->uniqstr = uniqstr_new (last_string); STRING_FREE; @@ -1485,7 +1673,7 @@ YY_RULE_SETUP YY_BREAK case 57: YY_RULE_SETUP -#line 275 "scan-gram.l" +#line 289 "scan-gram.l" { static int percent_percent_count; if (++percent_percent_count == 2) @@ -1495,13 +1683,13 @@ YY_RULE_SETUP YY_BREAK case 58: YY_RULE_SETUP -#line 282 "scan-gram.l" +#line 296 "scan-gram.l" { - complain_at (*loc, _("invalid character: %s"), quote (yytext)); + complain_at (*loc, _("invalid character: %s"), quote (gram_text)); } YY_BREAK case YY_STATE_EOF(INITIAL): -#line 286 "scan-gram.l" +#line 300 "scan-gram.l" { loc->start = loc->end = scanner_cursor; yyterminate (); @@ -1515,7 +1703,7 @@ case YY_STATE_EOF(INITIAL): case 59: YY_RULE_SETUP -#line 299 "scan-gram.l" +#line 313 "scan-gram.l" { rule_length = 0; *loc = id_loc; @@ -1525,9 +1713,9 @@ YY_RULE_SETUP YY_BREAK case 60: YY_RULE_SETUP -#line 305 "scan-gram.l" +#line 319 "scan-gram.l" { - scanner_cursor.column -= mbsnwidth (yytext, yyleng, 0); + scanner_cursor.column -= mbsnwidth (gram_text, gram_leng, 0); yyless (0); *loc = id_loc; BEGIN INITIAL; @@ -1535,7 +1723,7 @@ YY_RULE_SETUP } YY_BREAK case YY_STATE_EOF(SC_AFTER_IDENTIFIER): -#line 312 "scan-gram.l" +#line 326 "scan-gram.l" { *loc = id_loc; BEGIN INITIAL; @@ -1550,16 +1738,17 @@ case YY_STATE_EOF(SC_AFTER_IDENTIFIER): case 61: YY_RULE_SETUP -#line 326 "scan-gram.l" +#line 340 "scan-gram.l" BEGIN context_state; YY_BREAK case 62: +/* rule 62 can match eol */ YY_RULE_SETUP -#line 327 "scan-gram.l" +#line 341 "scan-gram.l" ; YY_BREAK case YY_STATE_EOF(SC_YACC_COMMENT): -#line 328 "scan-gram.l" +#line 342 "scan-gram.l" unexpected_eof (token_start, "*/"); BEGIN context_state; YY_BREAK @@ -1569,12 +1758,13 @@ unexpected_eof (token_start, "*/"); BEGIN context_state; case 63: +/* rule 63 can match eol */ YY_RULE_SETUP -#line 338 "scan-gram.l" +#line 352 "scan-gram.l" STRING_GROW; BEGIN context_state; YY_BREAK case YY_STATE_EOF(SC_COMMENT): -#line 339 "scan-gram.l" +#line 353 "scan-gram.l" unexpected_eof (token_start, "*/"); BEGIN context_state; YY_BREAK @@ -1584,17 +1774,19 @@ unexpected_eof (token_start, "*/"); BEGIN context_state; case 64: +/* rule 64 can match eol */ YY_RULE_SETUP -#line 349 "scan-gram.l" +#line 363 "scan-gram.l" STRING_GROW; BEGIN context_state; YY_BREAK case 65: +/* rule 65 can match eol */ YY_RULE_SETUP -#line 350 "scan-gram.l" +#line 364 "scan-gram.l" STRING_GROW; YY_BREAK case YY_STATE_EOF(SC_LINE_COMMENT): -#line 351 "scan-gram.l" +#line 365 "scan-gram.l" BEGIN context_state; YY_BREAK @@ -1606,9 +1798,8 @@ BEGIN context_state; case 66: YY_RULE_SETUP -#line 362 "scan-gram.l" +#line 376 "scan-gram.l" { - STRING_GROW; STRING_FINISH; loc->start = token_start; val->chars = last_string; @@ -1618,12 +1809,13 @@ YY_RULE_SETUP } YY_BREAK case 67: +/* rule 67 can match eol */ YY_RULE_SETUP -#line 371 "scan-gram.l" +#line 384 "scan-gram.l" unexpected_newline (token_start, "\""); BEGIN INITIAL; YY_BREAK case YY_STATE_EOF(SC_ESCAPED_STRING): -#line 372 "scan-gram.l" +#line 385 "scan-gram.l" unexpected_eof (token_start, "\""); BEGIN INITIAL; YY_BREAK @@ -1635,13 +1827,15 @@ unexpected_eof (token_start, "\""); BEGIN INITIAL; case 68: YY_RULE_SETUP -#line 382 "scan-gram.l" +#line 395 "scan-gram.l" { unsigned char last_string_1; STRING_GROW; STRING_FINISH; loc->start = token_start; - val->symbol = symbol_get (last_string, *loc); + val->symbol = symbol_get (quotearg_style (escape_quoting_style, + last_string), + *loc); symbol_class_set (val->symbol, token_sym, *loc); last_string_1 = last_string[1]; symbol_user_token_number_set (val->symbol, last_string_1, *loc); @@ -1652,12 +1846,13 @@ YY_RULE_SETUP } YY_BREAK case 69: +/* rule 69 can match eol */ YY_RULE_SETUP -#line 396 "scan-gram.l" +#line 411 "scan-gram.l" unexpected_newline (token_start, "'"); BEGIN INITIAL; YY_BREAK case YY_STATE_EOF(SC_ESCAPED_CHARACTER): -#line 397 "scan-gram.l" +#line 412 "scan-gram.l" unexpected_eof (token_start, "'"); BEGIN INITIAL; YY_BREAK @@ -1665,7 +1860,7 @@ unexpected_eof (token_start, "'"); BEGIN INITIAL; case 70: YY_RULE_SETUP -#line 402 "scan-gram.l" +#line 417 "scan-gram.l" complain_at (*loc, _("invalid null character")); YY_BREAK @@ -1676,91 +1871,92 @@ complain_at (*loc, _("invalid null character")); case 71: YY_RULE_SETUP -#line 412 "scan-gram.l" +#line 427 "scan-gram.l" { - unsigned long int c = strtoul (yytext + 1, 0, 8); + unsigned long int c = strtoul (gram_text + 1, 0, 8); if (UCHAR_MAX < c) - complain_at (*loc, _("invalid escape sequence: %s"), quote (yytext)); - else if (! c) - complain_at (*loc, _("invalid null character: %s"), quote (yytext)); + complain_at (*loc, _("invalid escape sequence: %s"), quote (gram_text)); + else if (! c) + complain_at (*loc, _("invalid null character: %s"), quote (gram_text)); else obstack_1grow (&obstack_for_string, c); } YY_BREAK case 72: YY_RULE_SETUP -#line 422 "scan-gram.l" +#line 437 "scan-gram.l" { unsigned long int c; set_errno (0); - c = strtoul (yytext + 2, 0, 16); + c = strtoul (gram_text + 2, 0, 16); if (UCHAR_MAX < c || get_errno ()) - complain_at (*loc, _("invalid escape sequence: %s"), quote (yytext)); + complain_at (*loc, _("invalid escape sequence: %s"), quote (gram_text)); else if (! c) - complain_at (*loc, _("invalid null character: %s"), quote (yytext)); + complain_at (*loc, _("invalid null character: %s"), quote (gram_text)); else obstack_1grow (&obstack_for_string, c); } YY_BREAK case 73: YY_RULE_SETUP -#line 434 "scan-gram.l" +#line 449 "scan-gram.l" obstack_1grow (&obstack_for_string, '\a'); YY_BREAK case 74: YY_RULE_SETUP -#line 435 "scan-gram.l" +#line 450 "scan-gram.l" obstack_1grow (&obstack_for_string, '\b'); YY_BREAK case 75: YY_RULE_SETUP -#line 436 "scan-gram.l" +#line 451 "scan-gram.l" obstack_1grow (&obstack_for_string, '\f'); YY_BREAK case 76: YY_RULE_SETUP -#line 437 "scan-gram.l" +#line 452 "scan-gram.l" obstack_1grow (&obstack_for_string, '\n'); YY_BREAK case 77: YY_RULE_SETUP -#line 438 "scan-gram.l" +#line 453 "scan-gram.l" obstack_1grow (&obstack_for_string, '\r'); YY_BREAK case 78: YY_RULE_SETUP -#line 439 "scan-gram.l" +#line 454 "scan-gram.l" obstack_1grow (&obstack_for_string, '\t'); YY_BREAK case 79: YY_RULE_SETUP -#line 440 "scan-gram.l" +#line 455 "scan-gram.l" obstack_1grow (&obstack_for_string, '\v'); YY_BREAK /* \\[\"\'?\\] would be shorter, but it confuses xgettext. */ case 80: YY_RULE_SETUP -#line 443 "scan-gram.l" -obstack_1grow (&obstack_for_string, yytext[1]); +#line 458 "scan-gram.l" +obstack_1grow (&obstack_for_string, gram_text[1]); YY_BREAK case 81: YY_RULE_SETUP -#line 445 "scan-gram.l" +#line 460 "scan-gram.l" { - int c = convert_ucn_to_byte (yytext); + int c = convert_ucn_to_byte (gram_text); if (c < 0) - complain_at (*loc, _("invalid escape sequence: %s"), quote (yytext)); + complain_at (*loc, _("invalid escape sequence: %s"), quote (gram_text)); else if (! c) - complain_at (*loc, _("invalid null character: %s"), quote (yytext)); + complain_at (*loc, _("invalid null character: %s"), quote (gram_text)); else obstack_1grow (&obstack_for_string, c); } YY_BREAK case 82: +/* rule 82 can match eol */ YY_RULE_SETUP -#line 454 "scan-gram.l" +#line 469 "scan-gram.l" { - complain_at (*loc, _("unrecognized escape sequence: %s"), quote (yytext)); + complain_at (*loc, _("unrecognized escape sequence: %s"), quote (gram_text)); STRING_GROW; } YY_BREAK @@ -1771,8 +1967,9 @@ YY_RULE_SETUP case 83: +/* rule 83 can match eol */ YY_RULE_SETUP -#line 466 "scan-gram.l" +#line 481 "scan-gram.l" STRING_GROW; YY_BREAK @@ -1780,16 +1977,17 @@ STRING_GROW; case 84: YY_RULE_SETUP -#line 471 "scan-gram.l" +#line 486 "scan-gram.l" STRING_GROW; BEGIN context_state; YY_BREAK case 85: +/* rule 85 can match eol */ YY_RULE_SETUP -#line 472 "scan-gram.l" +#line 487 "scan-gram.l" unexpected_newline (token_start, "'"); BEGIN context_state; YY_BREAK case YY_STATE_EOF(SC_CHARACTER): -#line 473 "scan-gram.l" +#line 488 "scan-gram.l" unexpected_eof (token_start, "'"); BEGIN context_state; YY_BREAK @@ -1797,16 +1995,17 @@ unexpected_eof (token_start, "'"); BEGIN context_state; case 86: YY_RULE_SETUP -#line 478 "scan-gram.l" +#line 493 "scan-gram.l" STRING_GROW; BEGIN context_state; YY_BREAK case 87: +/* rule 87 can match eol */ YY_RULE_SETUP -#line 479 "scan-gram.l" +#line 494 "scan-gram.l" unexpected_newline (token_start, "\""); BEGIN context_state; YY_BREAK case YY_STATE_EOF(SC_STRING): -#line 480 "scan-gram.l" +#line 495 "scan-gram.l" unexpected_eof (token_start, "\""); BEGIN context_state; YY_BREAK @@ -1817,7 +2016,7 @@ unexpected_eof (token_start, "\""); BEGIN context_state; case 88: YY_RULE_SETUP -#line 490 "scan-gram.l" +#line 505 "scan-gram.l" { STRING_GROW; context_state = YY_START; @@ -1827,7 +2026,7 @@ YY_RULE_SETUP YY_BREAK case 89: YY_RULE_SETUP -#line 496 "scan-gram.l" +#line 511 "scan-gram.l" { STRING_GROW; context_state = YY_START; @@ -1836,8 +2035,9 @@ YY_RULE_SETUP } YY_BREAK case 90: +/* rule 90 can match eol */ YY_RULE_SETUP -#line 502 "scan-gram.l" +#line 517 "scan-gram.l" { STRING_GROW; context_state = YY_START; @@ -1846,8 +2046,9 @@ YY_RULE_SETUP } YY_BREAK case 91: +/* rule 91 can match eol */ YY_RULE_SETUP -#line 508 "scan-gram.l" +#line 523 "scan-gram.l" { STRING_GROW; context_state = YY_START; @@ -1864,10 +2065,10 @@ YY_RULE_SETUP case 92: YY_RULE_SETUP -#line 524 "scan-gram.l" +#line 539 "scan-gram.l" { - bool valid = yytext[0] == '{' || token_type == PERCENT_UNION; - scanner_cursor.column -= mbsnwidth (yytext, yyleng, 0); + bool valid = gram_text[0] == '{' || token_type == PERCENT_UNION; + scanner_cursor.column -= mbsnwidth (gram_text, gram_leng, 0); yyless (0); if (valid) @@ -1878,7 +2079,7 @@ YY_RULE_SETUP } else { - complain_at (*loc, _("missing `{' in `%s'"), + complain_at (*loc, _("missing `{' in %s"), token_name (token_type)); obstack_sgrow (&obstack_for_string, "{}"); STRING_FINISH; @@ -1889,7 +2090,7 @@ YY_RULE_SETUP } YY_BREAK case YY_STATE_EOF(SC_PRE_CODE): -#line 547 "scan-gram.l" +#line 562 "scan-gram.l" unexpected_eof (scanner_cursor, "{}"); BEGIN INITIAL; YY_BREAK @@ -1900,18 +2101,20 @@ unexpected_eof (scanner_cursor, "{}"); BEGIN INITIAL; case 93: +/* rule 93 can match eol */ YY_RULE_SETUP -#line 558 "scan-gram.l" +#line 573 "scan-gram.l" STRING_GROW; braces_level++; YY_BREAK case 94: +/* rule 94 can match eol */ YY_RULE_SETUP -#line 559 "scan-gram.l" +#line 574 "scan-gram.l" STRING_GROW; braces_level--; YY_BREAK case 95: YY_RULE_SETUP -#line 560 "scan-gram.l" +#line 575 "scan-gram.l" { bool outer_brace = --braces_level < 0; @@ -1948,22 +2151,23 @@ YY_RULE_SETUP /* Tokenize `<<%' correctly (as `<<' `%') rather than incorrrectly (as `<' `<%'). */ case 96: +/* rule 96 can match eol */ YY_RULE_SETUP -#line 595 "scan-gram.l" +#line 610 "scan-gram.l" STRING_GROW; YY_BREAK case 97: YY_RULE_SETUP -#line 597 "scan-gram.l" -handle_dollar (token_type, yytext, *loc); +#line 612 "scan-gram.l" +handle_dollar (token_type, gram_text, *loc); YY_BREAK case 98: YY_RULE_SETUP -#line 598 "scan-gram.l" -handle_at (token_type, yytext, *loc); +#line 613 "scan-gram.l" +handle_at (token_type, gram_text, *loc); YY_BREAK case YY_STATE_EOF(SC_BRACED_CODE): -#line 600 "scan-gram.l" +#line 615 "scan-gram.l" unexpected_eof (code_start, "}"); BEGIN INITIAL; YY_BREAK @@ -1974,7 +2178,7 @@ unexpected_eof (code_start, "}"); BEGIN INITIAL; case 99: YY_RULE_SETUP -#line 610 "scan-gram.l" +#line 625 "scan-gram.l" { STRING_FINISH; loc->start = code_start; @@ -1984,7 +2188,7 @@ YY_RULE_SETUP } YY_BREAK case YY_STATE_EOF(SC_PROLOGUE): -#line 618 "scan-gram.l" +#line 633 "scan-gram.l" unexpected_eof (code_start, "%}"); BEGIN INITIAL; YY_BREAK @@ -1995,7 +2199,7 @@ unexpected_eof (code_start, "%}"); BEGIN INITIAL; case YY_STATE_EOF(SC_EPILOGUE): -#line 629 "scan-gram.l" +#line 644 "scan-gram.l" { STRING_FINISH; loc->start = code_start; @@ -2012,22 +2216,22 @@ case YY_STATE_EOF(SC_EPILOGUE): case 100: YY_RULE_SETUP -#line 645 "scan-gram.l" +#line 660 "scan-gram.l" obstack_sgrow (&obstack_for_string, "$]["); YY_BREAK case 101: YY_RULE_SETUP -#line 646 "scan-gram.l" +#line 661 "scan-gram.l" obstack_sgrow (&obstack_for_string, "@@"); YY_BREAK case 102: YY_RULE_SETUP -#line 647 "scan-gram.l" +#line 662 "scan-gram.l" obstack_sgrow (&obstack_for_string, "@{"); YY_BREAK case 103: YY_RULE_SETUP -#line 648 "scan-gram.l" +#line 663 "scan-gram.l" obstack_sgrow (&obstack_for_string, "@}"); YY_BREAK @@ -2035,42 +2239,43 @@ obstack_sgrow (&obstack_for_string, "@}"); | By default, grow the string obstack with the input. | `-----------------------------------------------------*/ case 104: -#line 657 "scan-gram.l" +#line 672 "scan-gram.l" case 105: +/* rule 105 can match eol */ YY_RULE_SETUP -#line 657 "scan-gram.l" +#line 672 "scan-gram.l" STRING_GROW; YY_BREAK case 106: YY_RULE_SETUP -#line 659 "scan-gram.l" +#line 674 "scan-gram.l" YY_FATAL_ERROR( "flex scanner jammed" ); YY_BREAK -#line 2050 "scan-gram.c" +#line 2255 "scan-gram.c" case YY_END_OF_BUFFER: { /* Amount of text matched not including the EOB char. */ - int yy_amount_of_matched_text = (int) (yy_cp - yytext_ptr) - 1; + int yy_amount_of_matched_text = (int) (yy_cp - (yytext_ptr)) - 1; /* Undo the effects of YY_DO_BEFORE_ACTION. */ - *yy_cp = yy_hold_char; + *yy_cp = (yy_hold_char); YY_RESTORE_YY_MORE_OFFSET - if ( yy_current_buffer->yy_buffer_status == YY_BUFFER_NEW ) + if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_NEW ) { /* We're scanning a new file or input source. It's * possible that this happened because the user - * just pointed yyin at a new source and called - * yylex(). If so, then we have to assure - * consistency between yy_current_buffer and our + * just pointed gram_in at a new source and called + * gram_lex(). If so, then we have to assure + * consistency between YY_CURRENT_BUFFER and our * globals. Here is the right place to do so, because * this is the first action (other than possibly a * back-up) that will match for the new input source. */ - yy_n_chars = yy_current_buffer->yy_n_chars; - yy_current_buffer->yy_input_file = yyin; - yy_current_buffer->yy_buffer_status = YY_BUFFER_NORMAL; + (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars; + YY_CURRENT_BUFFER_LVALUE->yy_input_file = gram_in; + YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_NORMAL; } /* Note that here we test for yy_c_buf_p "<=" to the position @@ -2080,13 +2285,13 @@ YY_FATAL_ERROR( "flex scanner jammed" ); * end-of-buffer state). Contrast this with the test * in input(). */ - if ( yy_c_buf_p <= &yy_current_buffer->yy_ch_buf[yy_n_chars] ) + if ( (yy_c_buf_p) <= &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] ) { /* This was really a NUL. */ yy_state_type yy_next_state; - yy_c_buf_p = yytext_ptr + yy_amount_of_matched_text; + (yy_c_buf_p) = (yytext_ptr) + yy_amount_of_matched_text; - yy_current_state = yy_get_previous_state(); + yy_current_state = yy_get_previous_state( ); /* Okay, we're now positioned to make the NUL * transition. We couldn't have @@ -2099,41 +2304,43 @@ YY_FATAL_ERROR( "flex scanner jammed" ); yy_next_state = yy_try_NUL_trans( yy_current_state ); - yy_bp = yytext_ptr + YY_MORE_ADJ; + yy_bp = (yytext_ptr) + YY_MORE_ADJ; if ( yy_next_state ) { /* Consume the NUL. */ - yy_cp = ++yy_c_buf_p; + yy_cp = ++(yy_c_buf_p); yy_current_state = yy_next_state; goto yy_match; } else { - yy_cp = yy_c_buf_p; +/* %% [14.0] code to do back-up for compressed tables and set up yy_cp goes here */ + yy_cp = (yy_last_accepting_cpos); + yy_current_state = (yy_last_accepting_state); goto yy_find_action; } } - else switch ( yy_get_next_buffer() ) + else switch ( yy_get_next_buffer( ) ) { case EOB_ACT_END_OF_FILE: { - yy_did_buffer_switch_on_eof = 0; + (yy_did_buffer_switch_on_eof) = 0; - if ( yywrap() ) + if ( gram_wrap( ) ) { /* Note: because we've taken care in * yy_get_next_buffer() to have set up - * yytext, we can now set up + * gram_text, we can now set up * yy_c_buf_p so that if some total * hoser (like flex itself) wants to * call the scanner after we return the * YY_NULL, it'll still work - another * YY_NULL will get returned. */ - yy_c_buf_p = yytext_ptr + YY_MORE_ADJ; + (yy_c_buf_p) = (yytext_ptr) + YY_MORE_ADJ; yy_act = YY_STATE_EOF(YY_START); goto do_action; @@ -2141,30 +2348,30 @@ YY_FATAL_ERROR( "flex scanner jammed" ); else { - if ( ! yy_did_buffer_switch_on_eof ) + if ( ! (yy_did_buffer_switch_on_eof) ) YY_NEW_FILE; } break; } case EOB_ACT_CONTINUE_SCAN: - yy_c_buf_p = - yytext_ptr + yy_amount_of_matched_text; + (yy_c_buf_p) = + (yytext_ptr) + yy_amount_of_matched_text; - yy_current_state = yy_get_previous_state(); + yy_current_state = yy_get_previous_state( ); - yy_cp = yy_c_buf_p; - yy_bp = yytext_ptr + YY_MORE_ADJ; + yy_cp = (yy_c_buf_p); + yy_bp = (yytext_ptr) + YY_MORE_ADJ; goto yy_match; case EOB_ACT_LAST_MATCH: - yy_c_buf_p = - &yy_current_buffer->yy_ch_buf[yy_n_chars]; + (yy_c_buf_p) = + &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)]; - yy_current_state = yy_get_previous_state(); + yy_current_state = yy_get_previous_state( ); - yy_cp = yy_c_buf_p; - yy_bp = yytext_ptr + YY_MORE_ADJ; + yy_cp = (yy_c_buf_p); + yy_bp = (yytext_ptr) + YY_MORE_ADJ; goto yy_find_action; } break; @@ -2175,8 +2382,15 @@ YY_FATAL_ERROR( "flex scanner jammed" ); "fatal flex scanner internal error--no action found" ); } /* end of action switch */ } /* end of scanning one token */ - } /* end of yylex */ +} /* end of gram_lex */ +/* %ok-for-header */ +/* %if-c++-only */ +/* %not-for-header */ + +/* %ok-for-header */ + +/* %endif */ /* yy_get_next_buffer - try to read in a new buffer * @@ -2185,21 +2399,24 @@ YY_FATAL_ERROR( "flex scanner jammed" ); * EOB_ACT_CONTINUE_SCAN - continue scanning from current position * EOB_ACT_END_OF_FILE - end of file */ - -static int yy_get_next_buffer() - { - register char *dest = yy_current_buffer->yy_ch_buf; - register char *source = yytext_ptr; +/* %if-c-only */ +static int yy_get_next_buffer (void) +/* %endif */ +/* %if-c++-only */ +/* %endif */ +{ + register char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf; + register char *source = (yytext_ptr); register int number_to_move, i; int ret_val; - if ( yy_c_buf_p > &yy_current_buffer->yy_ch_buf[yy_n_chars + 1] ) + if ( (yy_c_buf_p) > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] ) YY_FATAL_ERROR( "fatal flex scanner internal error--end of buffer missed" ); - if ( yy_current_buffer->yy_fill_buffer == 0 ) + if ( YY_CURRENT_BUFFER_LVALUE->yy_fill_buffer == 0 ) { /* Don't try to fill the buffer, so this is an EOF. */ - if ( yy_c_buf_p - yytext_ptr - YY_MORE_ADJ == 1 ) + if ( (yy_c_buf_p) - (yytext_ptr) - YY_MORE_ADJ == 1 ) { /* We matched a single character, the EOB, so * treat this as a final EOF. @@ -2219,34 +2436,30 @@ static int yy_get_next_buffer() /* Try to read more data. */ /* First move last chars to start of buffer. */ - number_to_move = (int) (yy_c_buf_p - yytext_ptr) - 1; + number_to_move = (int) ((yy_c_buf_p) - (yytext_ptr)) - 1; for ( i = 0; i < number_to_move; ++i ) *(dest++) = *(source++); - if ( yy_current_buffer->yy_buffer_status == YY_BUFFER_EOF_PENDING ) + if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_EOF_PENDING ) /* don't do the read, it's not guaranteed to return an EOF, * just force an EOF */ - yy_current_buffer->yy_n_chars = yy_n_chars = 0; + YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars) = 0; else { - int num_to_read = - yy_current_buffer->yy_buf_size - number_to_move - 1; + size_t num_to_read = + YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1; while ( num_to_read <= 0 ) { /* Not enough room in the buffer - grow it. */ -#ifdef YY_USES_REJECT - YY_FATAL_ERROR( -"input buffer overflow, can't enlarge buffer because scanner uses REJECT" ); -#else /* just a shorter name for the current buffer */ - YY_BUFFER_STATE b = yy_current_buffer; + YY_BUFFER_STATE b = YY_CURRENT_BUFFER; int yy_c_buf_p_offset = - (int) (yy_c_buf_p - b->yy_ch_buf); + (int) ((yy_c_buf_p) - b->yy_ch_buf); if ( b->yy_is_our_buffer ) { @@ -2259,8 +2472,7 @@ static int yy_get_next_buffer() b->yy_ch_buf = (char *) /* Include room in for 2 EOB chars. */ - yy_flex_realloc( (void *) b->yy_ch_buf, - b->yy_buf_size + 2 ); + gram_realloc((void *) b->yy_ch_buf,b->yy_buf_size + 2 ); } else /* Can't grow it, we don't own it. */ @@ -2270,35 +2482,35 @@ static int yy_get_next_buffer() YY_FATAL_ERROR( "fatal error - scanner input buffer overflow" ); - yy_c_buf_p = &b->yy_ch_buf[yy_c_buf_p_offset]; + (yy_c_buf_p) = &b->yy_ch_buf[yy_c_buf_p_offset]; - num_to_read = yy_current_buffer->yy_buf_size - + num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1; -#endif + } if ( num_to_read > YY_READ_BUF_SIZE ) num_to_read = YY_READ_BUF_SIZE; /* Read in more data. */ - YY_INPUT( (&yy_current_buffer->yy_ch_buf[number_to_move]), - yy_n_chars, num_to_read ); + YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]), + (yy_n_chars), num_to_read ); - yy_current_buffer->yy_n_chars = yy_n_chars; + YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars); } - if ( yy_n_chars == 0 ) + if ( (yy_n_chars) == 0 ) { if ( number_to_move == YY_MORE_ADJ ) { ret_val = EOB_ACT_END_OF_FILE; - yyrestart( yyin ); + gram_restart(gram_in ); } else { ret_val = EOB_ACT_LAST_MATCH; - yy_current_buffer->yy_buffer_status = + YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_EOF_PENDING; } } @@ -2306,33 +2518,40 @@ static int yy_get_next_buffer() else ret_val = EOB_ACT_CONTINUE_SCAN; - yy_n_chars += number_to_move; - yy_current_buffer->yy_ch_buf[yy_n_chars] = YY_END_OF_BUFFER_CHAR; - yy_current_buffer->yy_ch_buf[yy_n_chars + 1] = YY_END_OF_BUFFER_CHAR; + (yy_n_chars) += number_to_move; + YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] = YY_END_OF_BUFFER_CHAR; + YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] = YY_END_OF_BUFFER_CHAR; - yytext_ptr = &yy_current_buffer->yy_ch_buf[0]; + (yytext_ptr) = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[0]; return ret_val; - } - +} /* yy_get_previous_state - get the state just before the EOB char was reached */ -static yy_state_type yy_get_previous_state() - { +/* %if-c-only */ +/* %not-for-header */ + + static yy_state_type yy_get_previous_state (void) +/* %endif */ +/* %if-c++-only */ +/* %endif */ +{ register yy_state_type yy_current_state; register char *yy_cp; - - yy_current_state = yy_start; + +/* %% [15.0] code to get the start state into yy_current_state goes here */ + yy_current_state = (yy_start); yy_current_state += YY_AT_BOL(); - for ( yy_cp = yytext_ptr + YY_MORE_ADJ; yy_cp < yy_c_buf_p; ++yy_cp ) + for ( yy_cp = (yytext_ptr) + YY_MORE_ADJ; yy_cp < (yy_c_buf_p); ++yy_cp ) { +/* %% [16.0] code to find the next state goes here */ register YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 57); if ( yy_accept[yy_current_state] ) { - yy_last_accepting_state = yy_current_state; - yy_last_accepting_cpos = yy_cp; + (yy_last_accepting_state) = yy_current_state; + (yy_last_accepting_cpos) = yy_cp; } while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) { @@ -2344,30 +2563,28 @@ static yy_state_type yy_get_previous_state() } return yy_current_state; - } - +} /* yy_try_NUL_trans - try to make a transition on the NUL character * * synopsis * next_state = yy_try_NUL_trans( current_state ); */ - -#ifdef YY_USE_PROTOS -static yy_state_type yy_try_NUL_trans( yy_state_type yy_current_state ) -#else -static yy_state_type yy_try_NUL_trans( yy_current_state ) -yy_state_type yy_current_state; -#endif - { +/* %if-c-only */ + static yy_state_type yy_try_NUL_trans (yy_state_type yy_current_state ) +/* %endif */ +/* %if-c++-only */ +/* %endif */ +{ register int yy_is_jam; - register char *yy_cp = yy_c_buf_p; + /* %% [17.0] code to find the next state, and perhaps do backing up, goes here */ + register char *yy_cp = (yy_c_buf_p); register YY_CHAR yy_c = 57; if ( yy_accept[yy_current_state] ) { - yy_last_accepting_state = yy_current_state; - yy_last_accepting_cpos = yy_cp; + (yy_last_accepting_state) = yy_current_state; + (yy_last_accepting_cpos) = yy_cp; } while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) { @@ -2379,80 +2596,44 @@ yy_state_type yy_current_state; yy_is_jam = (yy_current_state == 454); return yy_is_jam ? 0 : yy_current_state; - } +} +/* %if-c-only */ -#ifndef YY_NO_UNPUT -#ifdef YY_USE_PROTOS -static void yyunput( int c, register char *yy_bp ) -#else -static void yyunput( c, yy_bp ) -int c; -register char *yy_bp; -#endif - { - register char *yy_cp = yy_c_buf_p; - - /* undo effects of setting up yytext */ - *yy_cp = yy_hold_char; - - if ( yy_cp < yy_current_buffer->yy_ch_buf + 2 ) - { /* need to shift things up to make room */ - /* +2 for EOB chars. */ - register int number_to_move = yy_n_chars + 2; - register char *dest = &yy_current_buffer->yy_ch_buf[ - yy_current_buffer->yy_buf_size + 2]; - register char *source = - &yy_current_buffer->yy_ch_buf[number_to_move]; - - while ( source > yy_current_buffer->yy_ch_buf ) - *--dest = *--source; - - yy_cp += (int) (dest - source); - yy_bp += (int) (dest - source); - yy_current_buffer->yy_n_chars = - yy_n_chars = yy_current_buffer->yy_buf_size; - - if ( yy_cp < yy_current_buffer->yy_ch_buf + 2 ) - YY_FATAL_ERROR( "flex scanner push-back overflow" ); - } - - *--yy_cp = (char) c; - - - yytext_ptr = yy_bp; - yy_hold_char = *yy_cp; - yy_c_buf_p = yy_cp; - } -#endif /* ifndef YY_NO_UNPUT */ - +/* %endif */ +/* %if-c-only */ +#ifndef YY_NO_INPUT #ifdef __cplusplus -static int yyinput() + static int yyinput (void) #else -static int input() + static int input (void) #endif - { + +/* %endif */ +/* %if-c++-only */ +/* %endif */ +{ int c; + + *(yy_c_buf_p) = (yy_hold_char); - *yy_c_buf_p = yy_hold_char; - - if ( *yy_c_buf_p == YY_END_OF_BUFFER_CHAR ) + if ( *(yy_c_buf_p) == YY_END_OF_BUFFER_CHAR ) { /* yy_c_buf_p now points to the character we want to return. * If this occurs *before* the EOB characters, then it's a * valid NUL; if not, then we've hit the end of the buffer. */ - if ( yy_c_buf_p < &yy_current_buffer->yy_ch_buf[yy_n_chars] ) + if ( (yy_c_buf_p) < &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] ) /* This was really a NUL. */ - *yy_c_buf_p = '\0'; + *(yy_c_buf_p) = '\0'; else { /* need more input */ - int offset = yy_c_buf_p - yytext_ptr; - ++yy_c_buf_p; + int offset = (yy_c_buf_p) - (yytext_ptr); + ++(yy_c_buf_p); - switch ( yy_get_next_buffer() ) + switch ( yy_get_next_buffer( ) ) { case EOB_ACT_LAST_MATCH: /* This happens because yy_g_n_b() @@ -2466,16 +2647,16 @@ static int input() */ /* Reset buffer status. */ - yyrestart( yyin ); + gram_restart(gram_in ); - /* fall through */ + /*FALLTHROUGH*/ case EOB_ACT_END_OF_FILE: { - if ( yywrap() ) + if ( gram_wrap( ) ) return EOF; - if ( ! yy_did_buffer_switch_on_eof ) + if ( ! (yy_did_buffer_switch_on_eof) ) YY_NEW_FILE; #ifdef __cplusplus return yyinput(); @@ -2485,177 +2666,210 @@ static int input() } case EOB_ACT_CONTINUE_SCAN: - yy_c_buf_p = yytext_ptr + offset; + (yy_c_buf_p) = (yytext_ptr) + offset; break; } } } - c = *(unsigned char *) yy_c_buf_p; /* cast for 8-bit char's */ - *yy_c_buf_p = '\0'; /* preserve yytext */ - yy_hold_char = *++yy_c_buf_p; + c = *(unsigned char *) (yy_c_buf_p); /* cast for 8-bit char's */ + *(yy_c_buf_p) = '\0'; /* preserve gram_text */ + (yy_hold_char) = *++(yy_c_buf_p); - yy_current_buffer->yy_at_bol = (c == '\n'); +/* %% [19.0] update BOL and gram_lineno */ + YY_CURRENT_BUFFER_LVALUE->yy_at_bol = (c == '\n'); return c; +} +/* %if-c-only */ +#endif /* ifndef YY_NO_INPUT */ +/* %endif */ + +/** Immediately switch to a different input stream. + * @param input_file A readable stream. + * + * @note This function does not reset the start condition to @c INITIAL . + */ +/* %if-c-only */ + void gram_restart (FILE * input_file ) +/* %endif */ +/* %if-c++-only */ +/* %endif */ +{ + + if ( ! YY_CURRENT_BUFFER ){ + gram_ensure_buffer_stack (); + YY_CURRENT_BUFFER_LVALUE = + gram__create_buffer(gram_in,YY_BUF_SIZE ); } + gram__init_buffer(YY_CURRENT_BUFFER,input_file ); + gram__load_buffer_state( ); +} -#ifdef YY_USE_PROTOS -void yyrestart( FILE *input_file ) -#else -void yyrestart( input_file ) -FILE *input_file; -#endif - { - if ( ! yy_current_buffer ) - yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE ); - - yy_init_buffer( yy_current_buffer, input_file ); - yy_load_buffer_state(); - } - - -#ifdef YY_USE_PROTOS -void yy_switch_to_buffer( YY_BUFFER_STATE new_buffer ) -#else -void yy_switch_to_buffer( new_buffer ) -YY_BUFFER_STATE new_buffer; -#endif - { - if ( yy_current_buffer == new_buffer ) +/** Switch to a different input buffer. + * @param new_buffer The new input buffer. + * + */ +/* %if-c-only */ + void gram__switch_to_buffer (YY_BUFFER_STATE new_buffer ) +/* %endif */ +/* %if-c++-only */ +/* %endif */ +{ + + /* TODO. We should be able to replace this entire function body + * with + * gram_pop_buffer_state(); + * gram_push_buffer_state(new_buffer); + */ + gram_ensure_buffer_stack (); + if ( YY_CURRENT_BUFFER == new_buffer ) return; - if ( yy_current_buffer ) + if ( YY_CURRENT_BUFFER ) { /* Flush out information for old buffer. */ - *yy_c_buf_p = yy_hold_char; - yy_current_buffer->yy_buf_pos = yy_c_buf_p; - yy_current_buffer->yy_n_chars = yy_n_chars; + *(yy_c_buf_p) = (yy_hold_char); + YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p); + YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars); } - yy_current_buffer = new_buffer; - yy_load_buffer_state(); + YY_CURRENT_BUFFER_LVALUE = new_buffer; + gram__load_buffer_state( ); /* We don't actually know whether we did this switch during - * EOF (yywrap()) processing, but the only time this flag - * is looked at is after yywrap() is called, so it's safe + * EOF (gram_wrap()) processing, but the only time this flag + * is looked at is after gram_wrap() is called, so it's safe * to go ahead and always set it. */ - yy_did_buffer_switch_on_eof = 1; - } + (yy_did_buffer_switch_on_eof) = 1; +} +/* %if-c-only */ +static void gram__load_buffer_state (void) +/* %endif */ +/* %if-c++-only */ +/* %endif */ +{ + (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars; + (yytext_ptr) = (yy_c_buf_p) = YY_CURRENT_BUFFER_LVALUE->yy_buf_pos; + gram_in = YY_CURRENT_BUFFER_LVALUE->yy_input_file; + (yy_hold_char) = *(yy_c_buf_p); +} -#ifdef YY_USE_PROTOS -void yy_load_buffer_state( void ) -#else -void yy_load_buffer_state() -#endif - { - yy_n_chars = yy_current_buffer->yy_n_chars; - yytext_ptr = yy_c_buf_p = yy_current_buffer->yy_buf_pos; - yyin = yy_current_buffer->yy_input_file; - yy_hold_char = *yy_c_buf_p; - } - - -#ifdef YY_USE_PROTOS -YY_BUFFER_STATE yy_create_buffer( FILE *file, int size ) -#else -YY_BUFFER_STATE yy_create_buffer( file, size ) -FILE *file; -int size; -#endif - { +/** Allocate and initialize an input buffer state. + * @param file A readable stream. + * @param size The character buffer size in bytes. When in doubt, use @c YY_BUF_SIZE. + * + * @return the allocated buffer state. + */ +/* %if-c-only */ + YY_BUFFER_STATE gram__create_buffer (FILE * file, int size ) +/* %endif */ +/* %if-c++-only */ +/* %endif */ +{ YY_BUFFER_STATE b; - - b = (YY_BUFFER_STATE) yy_flex_alloc( sizeof( struct yy_buffer_state ) ); + + b = (YY_BUFFER_STATE) gram_alloc(sizeof( struct yy_buffer_state ) ); if ( ! b ) - YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" ); + YY_FATAL_ERROR( "out of dynamic memory in gram__create_buffer()" ); b->yy_buf_size = size; /* yy_ch_buf has to be 2 characters longer than the size given because * we need to put in 2 end-of-buffer characters. */ - b->yy_ch_buf = (char *) yy_flex_alloc( b->yy_buf_size + 2 ); + b->yy_ch_buf = (char *) gram_alloc(b->yy_buf_size + 2 ); if ( ! b->yy_ch_buf ) - YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" ); + YY_FATAL_ERROR( "out of dynamic memory in gram__create_buffer()" ); b->yy_is_our_buffer = 1; - yy_init_buffer( b, file ); + gram__init_buffer(b,file ); return b; - } +} - -#ifdef YY_USE_PROTOS -void yy_delete_buffer( YY_BUFFER_STATE b ) -#else -void yy_delete_buffer( b ) -YY_BUFFER_STATE b; -#endif - { +/** Destroy the buffer. + * @param b a buffer created with gram__create_buffer() + * + */ +/* %if-c-only */ + void gram__delete_buffer (YY_BUFFER_STATE b ) +/* %endif */ +/* %if-c++-only */ +/* %endif */ +{ + if ( ! b ) return; - if ( b == yy_current_buffer ) - yy_current_buffer = (YY_BUFFER_STATE) 0; + if ( b == YY_CURRENT_BUFFER ) /* Not sure if we should pop here. */ + YY_CURRENT_BUFFER_LVALUE = (YY_BUFFER_STATE) 0; if ( b->yy_is_our_buffer ) - yy_flex_free( (void *) b->yy_ch_buf ); + gram_free((void *) b->yy_ch_buf ); - yy_flex_free( (void *) b ); - } + gram_free((void *) b ); +} +/* %if-c-only */ -#ifndef _WIN32 -#include -#else -#ifndef YY_ALWAYS_INTERACTIVE -#ifndef YY_NEVER_INTERACTIVE -extern int isatty YY_PROTO(( int )); -#endif -#endif -#endif +/* %endif */ -#ifdef YY_USE_PROTOS -void yy_init_buffer( YY_BUFFER_STATE b, FILE *file ) -#else -void yy_init_buffer( b, file ) -YY_BUFFER_STATE b; -FILE *file; -#endif +/* %if-c++-only */ +/* %endif */ +/* Initializes or reinitializes a buffer. + * This function is sometimes called more than once on the same buffer, + * such as during a gram_restart() or at EOF. + */ +/* %if-c-only */ + static void gram__init_buffer (YY_BUFFER_STATE b, FILE * file ) +/* %endif */ +/* %if-c++-only */ +/* %endif */ - { - yy_flush_buffer( b ); +{ + int oerrno = errno; + + gram__flush_buffer(b ); b->yy_input_file = file; b->yy_fill_buffer = 1; -#if YY_ALWAYS_INTERACTIVE - b->yy_is_interactive = 1; -#else -#if YY_NEVER_INTERACTIVE - b->yy_is_interactive = 0; -#else - b->yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0; -#endif -#endif - } + /* If b is the current buffer, then gram__init_buffer was _probably_ + * called from gram_restart() or through yy_get_next_buffer. + * In that case, we don't want to reset the lineno or column. + */ + if (b != YY_CURRENT_BUFFER){ + b->yy_bs_lineno = 1; + b->yy_bs_column = 0; + } +/* %if-c-only */ -#ifdef YY_USE_PROTOS -void yy_flush_buffer( YY_BUFFER_STATE b ) -#else -void yy_flush_buffer( b ) -YY_BUFFER_STATE b; -#endif + b->yy_is_interactive = 0; + +/* %endif */ +/* %if-c++-only */ +/* %endif */ + errno = oerrno; +} - { - if ( ! b ) +/** Discard all buffered characters. On the next scan, YY_INPUT will be called. + * @param b the buffer state to be flushed, usually @c YY_CURRENT_BUFFER. + * + */ +/* %if-c-only */ + void gram__flush_buffer (YY_BUFFER_STATE b ) +/* %endif */ +/* %if-c++-only */ +/* %endif */ +{ + if ( ! b ) return; b->yy_n_chars = 0; @@ -2672,31 +2886,142 @@ YY_BUFFER_STATE b; b->yy_at_bol = 1; b->yy_buffer_status = YY_BUFFER_NEW; - if ( b == yy_current_buffer ) - yy_load_buffer_state(); + if ( b == YY_CURRENT_BUFFER ) + gram__load_buffer_state( ); +} + +/* %if-c-or-c++ */ +/** Pushes the new state onto the stack. The new state becomes + * the current state. This function will allocate the stack + * if necessary. + * @param new_buffer The new state. + * + */ +/* %if-c-only */ +void gram_push_buffer_state (YY_BUFFER_STATE new_buffer ) +/* %endif */ +/* %if-c++-only */ +/* %endif */ +{ + if (new_buffer == NULL) + return; + + gram_ensure_buffer_stack(); + + /* This block is copied from gram__switch_to_buffer. */ + if ( YY_CURRENT_BUFFER ) + { + /* Flush out information for old buffer. */ + *(yy_c_buf_p) = (yy_hold_char); + YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p); + YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars); + } + + /* Only push if top exists. Otherwise, replace top. */ + if (YY_CURRENT_BUFFER) + (yy_buffer_stack_top)++; + YY_CURRENT_BUFFER_LVALUE = new_buffer; + + /* copied from gram__switch_to_buffer. */ + gram__load_buffer_state( ); + (yy_did_buffer_switch_on_eof) = 1; +} +/* %endif */ + +/* %if-c-or-c++ */ +/** Removes and deletes the top of the stack, if present. + * The next element becomes the new top. + * + */ +/* %if-c-only */ +void gram_pop_buffer_state (void) +/* %endif */ +/* %if-c++-only */ +/* %endif */ +{ + if (!YY_CURRENT_BUFFER) + return; + + gram__delete_buffer(YY_CURRENT_BUFFER ); + YY_CURRENT_BUFFER_LVALUE = NULL; + if ((yy_buffer_stack_top) > 0) + --(yy_buffer_stack_top); + + if (YY_CURRENT_BUFFER) { + gram__load_buffer_state( ); + (yy_did_buffer_switch_on_eof) = 1; + } +} +/* %endif */ + +/* %if-c-or-c++ */ +/* Allocates the stack if it does not exist. + * Guarantees space for at least one push. + */ +/* %if-c-only */ +static void gram_ensure_buffer_stack (void) +/* %endif */ +/* %if-c++-only */ +/* %endif */ +{ + int num_to_alloc; + + if (!(yy_buffer_stack)) { + + /* First allocation is just for 2 elements, since we don't know if this + * scanner will even need a stack. We use 2 instead of 1 to avoid an + * immediate realloc on the next call. + */ + num_to_alloc = 1; + (yy_buffer_stack) = (struct yy_buffer_state**)gram_alloc + (num_to_alloc * sizeof(struct yy_buffer_state*) + ); + + memset((yy_buffer_stack), 0, num_to_alloc * sizeof(struct yy_buffer_state*)); + + (yy_buffer_stack_max) = num_to_alloc; + (yy_buffer_stack_top) = 0; + return; } + if ((yy_buffer_stack_top) >= ((yy_buffer_stack_max)) - 1){ -#ifndef YY_NO_SCAN_BUFFER -#ifdef YY_USE_PROTOS -YY_BUFFER_STATE yy_scan_buffer( char *base, yy_size_t size ) -#else -YY_BUFFER_STATE yy_scan_buffer( base, size ) -char *base; -yy_size_t size; -#endif - { + /* Increase the buffer to prepare for a possible push. */ + int grow_size = 8 /* arbitrary grow size */; + + num_to_alloc = (yy_buffer_stack_max) + grow_size; + (yy_buffer_stack) = (struct yy_buffer_state**)gram_realloc + ((yy_buffer_stack), + num_to_alloc * sizeof(struct yy_buffer_state*) + ); + + /* zero only the new slots.*/ + memset((yy_buffer_stack) + (yy_buffer_stack_max), 0, grow_size * sizeof(struct yy_buffer_state*)); + (yy_buffer_stack_max) = num_to_alloc; + } +} +/* %endif */ + +/* %if-c-only */ +/** Setup the input buffer state to scan directly from a user-specified character buffer. + * @param base the character buffer + * @param size the size in bytes of the character buffer + * + * @return the newly allocated buffer state object. + */ +YY_BUFFER_STATE gram__scan_buffer (char * base, yy_size_t size ) +{ YY_BUFFER_STATE b; - + if ( size < 2 || base[size-2] != YY_END_OF_BUFFER_CHAR || base[size-1] != YY_END_OF_BUFFER_CHAR ) /* They forgot to leave room for the EOB's. */ return 0; - b = (YY_BUFFER_STATE) yy_flex_alloc( sizeof( struct yy_buffer_state ) ); + b = (YY_BUFFER_STATE) gram_alloc(sizeof( struct yy_buffer_state ) ); if ( ! b ) - YY_FATAL_ERROR( "out of dynamic memory in yy_scan_buffer()" ); + YY_FATAL_ERROR( "out of dynamic memory in gram__scan_buffer()" ); b->yy_buf_size = size - 2; /* "- 2" to take care of EOB's */ b->yy_buf_pos = b->yy_ch_buf = base; @@ -2708,58 +3033,57 @@ yy_size_t size; b->yy_fill_buffer = 0; b->yy_buffer_status = YY_BUFFER_NEW; - yy_switch_to_buffer( b ); + gram__switch_to_buffer(b ); return b; - } -#endif +} +/* %endif */ +/* %if-c-only */ +/** Setup the input buffer state to scan a string. The next call to gram_lex() will + * scan from a @e copy of @a str. + * @param str a NUL-terminated string to scan + * + * @return the newly allocated buffer state object. + * @note If you want to scan bytes that may contain NUL values, then use + * gram__scan_bytes() instead. + */ +YY_BUFFER_STATE gram__scan_string (yyconst char * yy_str ) +{ + + return gram__scan_bytes(yy_str,strlen(yy_str) ); +} +/* %endif */ -#ifndef YY_NO_SCAN_STRING -#ifdef YY_USE_PROTOS -YY_BUFFER_STATE yy_scan_string( yyconst char *yy_str ) -#else -YY_BUFFER_STATE yy_scan_string( yy_str ) -yyconst char *yy_str; -#endif - { - int len; - for ( len = 0; yy_str[len]; ++len ) - ; - - return yy_scan_bytes( yy_str, len ); - } -#endif - - -#ifndef YY_NO_SCAN_BYTES -#ifdef YY_USE_PROTOS -YY_BUFFER_STATE yy_scan_bytes( yyconst char *bytes, int len ) -#else -YY_BUFFER_STATE yy_scan_bytes( bytes, len ) -yyconst char *bytes; -int len; -#endif - { +/* %if-c-only */ +/** Setup the input buffer state to scan the given bytes. The next call to gram_lex() will + * scan from a @e copy of @a bytes. + * @param bytes the byte buffer to scan + * @param len the number of bytes in the buffer pointed to by @a bytes. + * + * @return the newly allocated buffer state object. + */ +YY_BUFFER_STATE gram__scan_bytes (yyconst char * bytes, int len ) +{ YY_BUFFER_STATE b; char *buf; yy_size_t n; int i; - + /* Get memory for full buffer, including space for trailing EOB's. */ n = len + 2; - buf = (char *) yy_flex_alloc( n ); + buf = (char *) gram_alloc(n ); if ( ! buf ) - YY_FATAL_ERROR( "out of dynamic memory in yy_scan_bytes()" ); + YY_FATAL_ERROR( "out of dynamic memory in gram__scan_bytes()" ); for ( i = 0; i < len; ++i ) buf[i] = bytes[i]; buf[len] = buf[len+1] = YY_END_OF_BUFFER_CHAR; - b = yy_scan_buffer( buf, n ); + b = gram__scan_buffer(buf,n ); if ( ! b ) - YY_FATAL_ERROR( "bad buffer in yy_scan_bytes()" ); + YY_FATAL_ERROR( "bad buffer in gram__scan_bytes()" ); /* It's okay to grow etc. this buffer, and we should throw it * away when we're done. @@ -2767,78 +3091,22 @@ int len; b->yy_is_our_buffer = 1; return b; - } -#endif - - -#ifndef YY_NO_PUSH_STATE -#ifdef YY_USE_PROTOS -static void yy_push_state( int new_state ) -#else -static void yy_push_state( new_state ) -int new_state; -#endif - { - if ( yy_start_stack_ptr >= yy_start_stack_depth ) - { - yy_size_t new_size; - - yy_start_stack_depth += YY_START_STACK_INCR; - new_size = yy_start_stack_depth * sizeof( int ); - - if ( ! yy_start_stack ) - yy_start_stack = (int *) yy_flex_alloc( new_size ); - - else - yy_start_stack = (int *) yy_flex_realloc( - (void *) yy_start_stack, new_size ); - - if ( ! yy_start_stack ) - YY_FATAL_ERROR( - "out of memory expanding start-condition stack" ); - } - - yy_start_stack[yy_start_stack_ptr++] = YY_START; - - BEGIN(new_state); - } -#endif - - -#ifndef YY_NO_POP_STATE -static void yy_pop_state() - { - if ( --yy_start_stack_ptr < 0 ) - YY_FATAL_ERROR( "start-condition stack underflow" ); - - BEGIN(yy_start_stack[yy_start_stack_ptr]); - } -#endif - - -#ifndef YY_NO_TOP_STATE -static int yy_top_state() - { - return yy_start_stack[yy_start_stack_ptr - 1]; - } -#endif +} +/* %endif */ #ifndef YY_EXIT_FAILURE #define YY_EXIT_FAILURE 2 #endif -#ifdef YY_USE_PROTOS -static void yy_fatal_error( yyconst char msg[] ) -#else -static void yy_fatal_error( msg ) -char msg[]; -#endif - { - (void) fprintf( stderr, "%s\n", msg ); +/* %if-c-only */ +static void yy_fatal_error (yyconst char* msg ) +{ + (void) fprintf( stderr, "%s\n", msg ); exit( YY_EXIT_FAILURE ); - } - - +} +/* %endif */ +/* %if-c++-only */ +/* %endif */ /* Redefine yyless() so it works in section 3 code. */ @@ -2846,69 +3114,164 @@ char msg[]; #define yyless(n) \ do \ { \ - /* Undo effects of setting up yytext. */ \ - yytext[yyleng] = yy_hold_char; \ - yy_c_buf_p = yytext + n; \ - yy_hold_char = *yy_c_buf_p; \ - *yy_c_buf_p = '\0'; \ - yyleng = n; \ + /* Undo effects of setting up gram_text. */ \ + int yyless_macro_arg = (n); \ + YY_LESS_LINENO(yyless_macro_arg);\ + gram_text[gram_leng] = (yy_hold_char); \ + (yy_c_buf_p) = gram_text + yyless_macro_arg; \ + (yy_hold_char) = *(yy_c_buf_p); \ + *(yy_c_buf_p) = '\0'; \ + gram_leng = yyless_macro_arg; \ } \ while ( 0 ) +/* Accessor methods (get/set functions) to struct members. */ -/* Internal utility routines. */ +/* %if-c-only */ +/* %if-reentrant */ +/* %endif */ + +/** Get the current line number. + * + */ +int gram_get_lineno (void) +{ + + return gram_lineno; +} + +/** Get the input stream. + * + */ +FILE *gram_get_in (void) +{ + return gram_in; +} + +/** Get the output stream. + * + */ +FILE *gram_get_out (void) +{ + return gram_out; +} + +/** Get the length of the current token. + * + */ +int gram_get_leng (void) +{ + return gram_leng; +} + +/** Get the current token. + * + */ + +char *gram_get_text (void) +{ + return gram_text; +} + +/* %if-reentrant */ +/* %endif */ + +/** Set the current line number. + * @param line_number + * + */ +void gram_set_lineno (int line_number ) +{ + + gram_lineno = line_number; +} + +/** Set the input stream. This does not discard the current + * input buffer. + * @param in_str A readable stream. + * + * @see gram__switch_to_buffer + */ +void gram_set_in (FILE * in_str ) +{ + gram_in = in_str ; +} + +void gram_set_out (FILE * out_str ) +{ + gram_out = out_str ; +} + +int gram_get_debug (void) +{ + return gram__flex_debug; +} + +void gram_set_debug (int bdebug ) +{ + gram__flex_debug = bdebug ; +} + +/* %endif */ + +/* %if-reentrant */ +/* %if-bison-bridge */ +/* %endif */ +/* %endif */ + +/* %if-c-only SNIP! this currently causes conflicts with the c++ scanner */ +/* gram_lex_destroy is for both reentrant and non-reentrant scanners. */ +int gram_lex_destroy (void) +{ + + /* Pop the buffer stack, destroying each element. */ + while(YY_CURRENT_BUFFER){ + gram__delete_buffer(YY_CURRENT_BUFFER ); + YY_CURRENT_BUFFER_LVALUE = NULL; + gram_pop_buffer_state(); + } + + /* Destroy the stack itself. */ + gram_free((yy_buffer_stack) ); + (yy_buffer_stack) = NULL; + +/* %if-reentrant */ +/* %endif */ + return 0; +} +/* %endif */ + +/* + * Internal utility routines. + */ #ifndef yytext_ptr -#ifdef YY_USE_PROTOS -static void yy_flex_strncpy( char *s1, yyconst char *s2, int n ) -#else -static void yy_flex_strncpy( s1, s2, n ) -char *s1; -yyconst char *s2; -int n; -#endif - { +static void yy_flex_strncpy (char* s1, yyconst char * s2, int n ) +{ register int i; - for ( i = 0; i < n; ++i ) + for ( i = 0; i < n; ++i ) s1[i] = s2[i]; - } +} #endif #ifdef YY_NEED_STRLEN -#ifdef YY_USE_PROTOS -static int yy_flex_strlen( yyconst char *s ) -#else -static int yy_flex_strlen( s ) -yyconst char *s; -#endif - { +static int yy_flex_strlen (yyconst char * s ) +{ register int n; - for ( n = 0; s[n]; ++n ) + for ( n = 0; s[n]; ++n ) ; return n; - } +} #endif - -#ifdef YY_USE_PROTOS -static void *yy_flex_alloc( yy_size_t size ) -#else -static void *yy_flex_alloc( size ) -yy_size_t size; -#endif - { +void *gram_alloc (yy_size_t size ) +{ return (void *) malloc( size ); - } +} -#ifdef YY_USE_PROTOS -static void *yy_flex_realloc( void *ptr, yy_size_t size ) -#else -static void *yy_flex_realloc( ptr, size ) -void *ptr; -yy_size_t size; -#endif - { +void *gram_realloc (void * ptr, yy_size_t size ) +{ /* The cast to (char *) in the following accommodates both * implementations that use char* generic pointers, and those * that use void* generic pointers. It works with the latter @@ -2917,26 +3280,34 @@ yy_size_t size; * as though doing an assignment. */ return (void *) realloc( (char *) ptr, size ); - } +} -#ifdef YY_USE_PROTOS -static void yy_flex_free( void *ptr ) -#else -static void yy_flex_free( ptr ) -void *ptr; -#endif - { - free( ptr ); - } +void gram_free (void * ptr ) +{ + free( (char *) ptr ); /* see gram_realloc() for (char *) cast */ +} -#if YY_MAIN -int main() - { - yylex(); - return 0; - } +/* %if-tables-serialization definitions */ +/* %define-yytables The name for this specific scanner's tables. */ +#define YYTABLES_NAME "yytables" +/* %endif */ + +/* %ok-for-header */ + +#undef YY_NEW_FILE +#undef YY_FLUSH_BUFFER +#undef yy_set_bol +#undef yy_new_buffer +#undef yy_set_interactive +#undef yytext_ptr +#undef YY_DO_BEFORE_ACTION + +#ifdef YY_DECL_IS_OURS +#undef YY_DECL_IS_OURS +#undef YY_DECL #endif -#line 659 "scan-gram.l" +#line 674 "scan-gram.l" + /* Keeps track of the maximum number of semantic values to the left of @@ -3086,7 +3457,7 @@ handle_action_dollar (char *text, location loc) if (!type_name) type_name = ""; obstack_fgrow3 (&obstack_for_string, - "]b4_rhs_value([%d], [%d], [%s])[", + "]b4_rhs_value(%d, %d, [%s])[", rule_length, n, type_name); } else @@ -3155,7 +3526,7 @@ handle_action_at (char *text, location loc) if (INT_MIN <= num && num <= rule_length && ! get_errno ()) { int n = num; - obstack_fgrow2 (&obstack_for_string, "]b4_rhs_location([%d], [%d])[", + obstack_fgrow2 (&obstack_for_string, "]b4_rhs_location(%d, %d)[", rule_length, n); } else @@ -3284,7 +3655,7 @@ handle_syncline (char *args) const char *file = NULL; file = strchr (args, '"') + 1; *strchr (file, '"') = 0; - scanner_cursor.file = current_file = xstrdup (file); + scanner_cursor.file = current_file = uniqstr_new (file); scanner_cursor.line = lineno; scanner_cursor.column = 1; } @@ -3349,5 +3720,6 @@ scanner_free (void) { obstack_free (&obstack_for_string, 0); /* Reclaim Flex's buffers. */ - yy_delete_buffer (YY_CURRENT_BUFFER); + gram__delete_buffer (YY_CURRENT_BUFFER); } + diff --git a/src/bin/bison/src/scan-gram.l b/src/bin/bison/src/scan-gram.l index 77c304f2be..7060ddbd62 100644 --- a/src/bin/bison/src/scan-gram.l +++ b/src/bin/bison/src/scan-gram.l @@ -1,6 +1,6 @@ /* Bison Grammar Scanner -*- C -*- - Copyright (C) 2002, 2003, 2004 Free Software Foundation, Inc. + Copyright (C) 2002, 2003, 2004, 2005 Free Software Foundation, Inc. This file is part of Bison, the GNU Compiler Compiler. @@ -16,8 +16,8 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA - 02111-1307 USA + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA + 02110-1301 USA */ %option debug nodefault nounput noyywrap never-interactive @@ -34,6 +34,7 @@ #include "files.h" #include "getargs.h" #include "gram.h" +#include "quotearg.h" #include "reader.h" #include "uniqstr.h" @@ -47,6 +48,19 @@ } \ while (0) +/* Pacify "gcc -Wmissing-prototypes" when flex 2.5.31 is used. */ +int gram_get_lineno (void); +FILE *gram_get_in (void); +FILE *gram_get_out (void); +int gram_get_leng (void); +char *gram_get_text (void); +void gram_set_lineno (int); +void gram_set_in (FILE *); +void gram_set_out (FILE *); +int gram_get_debug (void); +void gram_set_debug (int); +int gram_lex_destroy (void); + /* Location of scanner cursor. */ boundary scanner_cursor; @@ -249,7 +263,7 @@ splice (\\[ \f\t\v]*\n)* "'" STRING_GROW; token_start = loc->start; BEGIN SC_ESCAPED_CHARACTER; /* Strings. */ - "\"" STRING_GROW; token_start = loc->start; BEGIN SC_ESCAPED_STRING; + "\"" token_start = loc->start; BEGIN SC_ESCAPED_STRING; /* Prologue. */ "%{" code_start = loc->start; BEGIN SC_PROLOGUE; @@ -360,7 +374,6 @@ splice (\\[ \f\t\v]*\n)* { "\"" { - STRING_GROW; STRING_FINISH; loc->start = token_start; val->chars = last_string; @@ -384,7 +397,9 @@ splice (\\[ \f\t\v]*\n)* STRING_GROW; STRING_FINISH; loc->start = token_start; - val->symbol = symbol_get (last_string, *loc); + val->symbol = symbol_get (quotearg_style (escape_quoting_style, + last_string), + *loc); symbol_class_set (val->symbol, token_sym, *loc); last_string_1 = last_string[1]; symbol_user_token_number_set (val->symbol, last_string_1, *loc); @@ -413,7 +428,7 @@ splice (\\[ \f\t\v]*\n)* unsigned long int c = strtoul (yytext + 1, 0, 8); if (UCHAR_MAX < c) complain_at (*loc, _("invalid escape sequence: %s"), quote (yytext)); - else if (! c) + else if (! c) complain_at (*loc, _("invalid null character: %s"), quote (yytext)); else obstack_1grow (&obstack_for_string, c); @@ -534,7 +549,7 @@ splice (\\[ \f\t\v]*\n)* } else { - complain_at (*loc, _("missing `{' in `%s'"), + complain_at (*loc, _("missing `{' in %s"), token_name (token_type)); obstack_sgrow (&obstack_for_string, "{}"); STRING_FINISH; @@ -805,7 +820,7 @@ handle_action_dollar (char *text, location loc) if (!type_name) type_name = ""; obstack_fgrow3 (&obstack_for_string, - "]b4_rhs_value([%d], [%d], [%s])[", + "]b4_rhs_value(%d, %d, [%s])[", rule_length, n, type_name); } else @@ -874,7 +889,7 @@ handle_action_at (char *text, location loc) if (INT_MIN <= num && num <= rule_length && ! get_errno ()) { int n = num; - obstack_fgrow2 (&obstack_for_string, "]b4_rhs_location([%d], [%d])[", + obstack_fgrow2 (&obstack_for_string, "]b4_rhs_location(%d, %d)[", rule_length, n); } else @@ -1003,7 +1018,7 @@ handle_syncline (char *args) const char *file = NULL; file = strchr (args, '"') + 1; *strchr (file, '"') = 0; - scanner_cursor.file = current_file = xstrdup (file); + scanner_cursor.file = current_file = uniqstr_new (file); scanner_cursor.line = lineno; scanner_cursor.column = 1; } diff --git a/src/bin/bison/src/scan-skel.c b/src/bin/bison/src/scan-skel.c index e5c85b1178..303b7a9008 100644 --- a/src/bin/bison/src/scan-skel.c +++ b/src/bin/bison/src/scan-skel.c @@ -1,58 +1,107 @@ -#define yy_create_buffer skel__create_buffer -#define yy_delete_buffer skel__delete_buffer -#define yy_scan_buffer skel__scan_buffer -#define yy_scan_string skel__scan_string -#define yy_scan_bytes skel__scan_bytes -#define yy_flex_debug skel__flex_debug -#define yy_init_buffer skel__init_buffer -#define yy_flush_buffer skel__flush_buffer -#define yy_load_buffer_state skel__load_buffer_state -#define yy_switch_to_buffer skel__switch_to_buffer -#define yyin skel_in -#define yyleng skel_leng -#define yylex skel_lex -#define yyout skel_out -#define yyrestart skel_restart -#define yytext skel_text +#line 2 "scan-skel.c" + +#line 4 "scan-skel.c" + +#define YY_INT_ALIGNED short int -#line 19 "scan-skel.c" /* A lexical scanner generated by flex */ -/* Scanner skeleton version: - * $Header: /tmp/bonefish/open-beos/current/src/apps/bin/bison/src/scan-skel.c,v 1.1 2004/06/01 09:52:40 korli Exp $ - */ - #define FLEX_SCANNER #define YY_FLEX_MAJOR_VERSION 2 #define YY_FLEX_MINOR_VERSION 5 +#define YY_FLEX_SUBMINOR_VERSION 31 +#if YY_FLEX_SUBMINOR_VERSION > 0 +#define FLEX_BETA +#endif +/* %if-c++-only */ +/* %endif */ + +/* %if-c-only */ + +/* %endif */ + +/* %if-c-only */ + +/* %endif */ + +/* First, we deal with platform-specific or compiler-specific issues. */ + +/* begin standard C headers. */ +/* %if-c-only */ #include +#include #include +#include +/* %endif */ -/* cfront 1.2 defines "c_plusplus" instead of "__cplusplus" */ -#ifdef c_plusplus -#ifndef __cplusplus -#define __cplusplus +/* %if-tables-serialization */ +/* %endif */ +/* end standard C headers. */ + +/* %if-c-or-c++ */ +/* flex integer type definitions */ + +#ifndef FLEXINT_H +#define FLEXINT_H + +/* C99 systems have . Non-C99 systems may or may not. */ + +#if defined __STDC_VERSION__ && __STDC_VERSION__ >= 199901L +#include +typedef int8_t flex_int8_t; +typedef uint8_t flex_uint8_t; +typedef int16_t flex_int16_t; +typedef uint16_t flex_uint16_t; +typedef int32_t flex_int32_t; +typedef uint32_t flex_uint32_t; +#else +typedef signed char flex_int8_t; +typedef short int flex_int16_t; +typedef int flex_int32_t; +typedef unsigned char flex_uint8_t; +typedef unsigned short int flex_uint16_t; +typedef unsigned int flex_uint32_t; +#endif /* ! C99 */ + +/* Limits of integral types. */ +#ifndef INT8_MIN +#define INT8_MIN (-128) #endif +#ifndef INT16_MIN +#define INT16_MIN (-32767-1) +#endif +#ifndef INT32_MIN +#define INT32_MIN (-2147483647-1) +#endif +#ifndef INT8_MAX +#define INT8_MAX (127) +#endif +#ifndef INT16_MAX +#define INT16_MAX (32767) +#endif +#ifndef INT32_MAX +#define INT32_MAX (2147483647) +#endif +#ifndef UINT8_MAX +#define UINT8_MAX (255U) +#endif +#ifndef UINT16_MAX +#define UINT16_MAX (65535U) +#endif +#ifndef UINT32_MAX +#define UINT32_MAX (4294967295U) #endif +#endif /* ! FLEXINT_H */ + +/* %endif */ + +/* %if-c++-only */ +/* %endif */ #ifdef __cplusplus -#include -#ifndef _WIN32 -#include -#else -#ifndef YY_ALWAYS_INTERACTIVE -#ifndef YY_NEVER_INTERACTIVE -extern int isatty YY_PROTO(( int )); -#endif -#endif -#endif - -/* Use prototypes in function declarations. */ -#define YY_USE_PROTOS - /* The "const" storage-class-modifier is valid. */ #define YY_USE_CONST @@ -60,36 +109,24 @@ extern int isatty YY_PROTO(( int )); #if __STDC__ -#define YY_USE_PROTOS #define YY_USE_CONST #endif /* __STDC__ */ #endif /* ! __cplusplus */ -#ifdef __TURBOC__ - #pragma warn -rch - #pragma warn -use -#include -#include -#define YY_USE_CONST -#define YY_USE_PROTOS -#endif - #ifdef YY_USE_CONST #define yyconst const #else #define yyconst #endif - -#ifdef YY_USE_PROTOS -#define YY_PROTO(proto) proto -#else -#define YY_PROTO(proto) () -#endif +/* %not-for-header */ /* Returned upon end-of-file. */ #define YY_NULL 0 +/* %ok-for-header */ + +/* %not-for-header */ /* Promotes a possibly negative, possibly signed char to an unsigned * integer for use as an array index. If the signed char is negative, @@ -97,79 +134,98 @@ extern int isatty YY_PROTO(( int )); * double cast. */ #define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c) +/* %ok-for-header */ + +/* %if-reentrant */ +/* %endif */ + +/* %if-not-reentrant */ + +/* %endif */ /* Enter a start condition. This macro really ought to take a parameter, * but we do it the disgusting crufty way forced on us by the ()-less * definition of BEGIN. */ -#define BEGIN yy_start = 1 + 2 * +#define BEGIN (yy_start) = 1 + 2 * /* Translate the current start state into a value that can be later handed * to BEGIN to return to the state. The YYSTATE alias is for lex * compatibility. */ -#define YY_START ((yy_start - 1) / 2) +#define YY_START (((yy_start) - 1) / 2) #define YYSTATE YY_START /* Action number for EOF rule of a given start state. */ #define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1) /* Special action meaning "start processing a new file". */ -#define YY_NEW_FILE yyrestart( yyin ) +#define YY_NEW_FILE skel_restart(skel_in ) #define YY_END_OF_BUFFER_CHAR 0 /* Size of default input buffer. */ +#ifndef YY_BUF_SIZE #define YY_BUF_SIZE 16384 +#endif +#ifndef YY_TYPEDEF_YY_BUFFER_STATE +#define YY_TYPEDEF_YY_BUFFER_STATE typedef struct yy_buffer_state *YY_BUFFER_STATE; +#endif -extern int yyleng; -extern FILE *yyin, *yyout; +/* %if-not-reentrant */ +extern int skel_leng; +/* %endif */ + +/* %if-c-only */ +/* %if-not-reentrant */ +extern FILE *skel_in, *skel_out; +/* %endif */ +/* %endif */ #define EOB_ACT_CONTINUE_SCAN 0 #define EOB_ACT_END_OF_FILE 1 #define EOB_ACT_LAST_MATCH 2 -/* The funky do-while in the following #define is used to turn the definition - * int a single C statement (which needs a semi-colon terminator). This - * avoids problems with code like: - * - * if ( condition_holds ) - * yyless( 5 ); - * else - * do_something_else(); - * - * Prior to using the do-while the compiler would get upset at the - * "else" because it interpreted the "if" statement as being all - * done when it reached the ';' after the yyless() call. - */ - -/* Return all but the first 'n' matched characters back to the input stream. */ - + #define YY_LESS_LINENO(n) + +/* Return all but the first "n" matched characters back to the input stream. */ #define yyless(n) \ do \ { \ - /* Undo effects of setting up yytext. */ \ - *yy_cp = yy_hold_char; \ + /* Undo effects of setting up skel_text. */ \ + int yyless_macro_arg = (n); \ + YY_LESS_LINENO(yyless_macro_arg);\ + *yy_cp = (yy_hold_char); \ YY_RESTORE_YY_MORE_OFFSET \ - yy_c_buf_p = yy_cp = yy_bp + n - YY_MORE_ADJ; \ - YY_DO_BEFORE_ACTION; /* set up yytext again */ \ + (yy_c_buf_p) = yy_cp = yy_bp + yyless_macro_arg - YY_MORE_ADJ; \ + YY_DO_BEFORE_ACTION; /* set up skel_text again */ \ } \ while ( 0 ) -#define unput(c) yyunput( c, yytext_ptr ) +#define unput(c) yyunput( c, (yytext_ptr) ) /* The following is because we cannot portably get our hands on size_t * (without autoconf's help, which isn't available because we want * flex-generated scanners to compile on their own). */ + +#ifndef YY_TYPEDEF_YY_SIZE_T +#define YY_TYPEDEF_YY_SIZE_T typedef unsigned int yy_size_t; +#endif - +#ifndef YY_STRUCT_YY_BUFFER_STATE +#define YY_STRUCT_YY_BUFFER_STATE struct yy_buffer_state { +/* %if-c-only */ FILE *yy_input_file; +/* %endif */ + +/* %if-c++-only */ +/* %endif */ char *yy_ch_buf; /* input buffer */ char *yy_buf_pos; /* current position in input buffer */ @@ -203,12 +259,16 @@ struct yy_buffer_state */ int yy_at_bol; + int yy_bs_lineno; /**< The line count. */ + int yy_bs_column; /**< The column count. */ + /* Whether to try to fill the input buffer when we reach the * end of it. */ int yy_fill_buffer; int yy_buffer_status; + #define YY_BUFFER_NEW 0 #define YY_BUFFER_NORMAL 1 /* When an EOF's been seen but there's still some text to process @@ -218,116 +278,177 @@ struct yy_buffer_state * possible backing-up. * * When we actually see the EOF, we change the status to "new" - * (via yyrestart()), so that the user can continue scanning by - * just pointing yyin at a new input file. + * (via skel_restart()), so that the user can continue scanning by + * just pointing skel_in at a new input file. */ #define YY_BUFFER_EOF_PENDING 2 - }; -static YY_BUFFER_STATE yy_current_buffer = 0; + }; +#endif /* !YY_STRUCT_YY_BUFFER_STATE */ + +/* %if-c-only Standard (non-C++) definition */ +/* %not-for-header */ + +/* %if-not-reentrant */ + +/* Stack of input buffers. */ +static size_t yy_buffer_stack_top = 0; /**< index of top of stack. */ +static size_t yy_buffer_stack_max = 0; /**< capacity of stack. */ +static YY_BUFFER_STATE * yy_buffer_stack = 0; /**< Stack as an array. */ +/* %endif */ +/* %ok-for-header */ + +/* %endif */ /* We provide macros for accessing buffer states in case in the * future we want to put the buffer states in a more general * "scanner state". + * + * Returns the top of the stack, or NULL. */ -#define YY_CURRENT_BUFFER yy_current_buffer +#define YY_CURRENT_BUFFER ( (yy_buffer_stack) \ + ? (yy_buffer_stack)[(yy_buffer_stack_top)] \ + : NULL) +/* Same as previous macro, but useful when we know that the buffer stack is not + * NULL or when we need an lvalue. For internal use only. + */ +#define YY_CURRENT_BUFFER_LVALUE (yy_buffer_stack)[(yy_buffer_stack_top)] -/* yy_hold_char holds the character lost when yytext is formed. */ +/* %if-c-only Standard (non-C++) definition */ + +/* %if-not-reentrant */ +/* %not-for-header */ + +/* yy_hold_char holds the character lost when skel_text is formed. */ static char yy_hold_char; - static int yy_n_chars; /* number of characters read into yy_ch_buf */ - - -int yyleng; +int skel_leng; /* Points to current character in buffer. */ static char *yy_c_buf_p = (char *) 0; static int yy_init = 1; /* whether we need to initialize */ static int yy_start = 0; /* start state number */ -/* Flag which is used to allow yywrap()'s to do buffer switches - * instead of setting up a fresh yyin. A bit of a hack ... +/* Flag which is used to allow skel_wrap()'s to do buffer switches + * instead of setting up a fresh skel_in. A bit of a hack ... */ static int yy_did_buffer_switch_on_eof; +/* %ok-for-header */ -void yyrestart YY_PROTO(( FILE *input_file )); +/* %endif */ -void yy_switch_to_buffer YY_PROTO(( YY_BUFFER_STATE new_buffer )); -void yy_load_buffer_state YY_PROTO(( void )); -YY_BUFFER_STATE yy_create_buffer YY_PROTO(( FILE *file, int size )); -void yy_delete_buffer YY_PROTO(( YY_BUFFER_STATE b )); -void yy_init_buffer YY_PROTO(( YY_BUFFER_STATE b, FILE *file )); -void yy_flush_buffer YY_PROTO(( YY_BUFFER_STATE b )); -#define YY_FLUSH_BUFFER yy_flush_buffer( yy_current_buffer ) +void skel_restart (FILE *input_file ); +void skel__switch_to_buffer (YY_BUFFER_STATE new_buffer ); +YY_BUFFER_STATE skel__create_buffer (FILE *file,int size ); +void skel__delete_buffer (YY_BUFFER_STATE b ); +void skel__flush_buffer (YY_BUFFER_STATE b ); +void skel_push_buffer_state (YY_BUFFER_STATE new_buffer ); +void skel_pop_buffer_state (void ); -YY_BUFFER_STATE yy_scan_buffer YY_PROTO(( char *base, yy_size_t size )); -YY_BUFFER_STATE yy_scan_string YY_PROTO(( yyconst char *yy_str )); -YY_BUFFER_STATE yy_scan_bytes YY_PROTO(( yyconst char *bytes, int len )); +static void skel_ensure_buffer_stack (void ); +static void skel__load_buffer_state (void ); +static void skel__init_buffer (YY_BUFFER_STATE b,FILE *file ); -static void *yy_flex_alloc YY_PROTO(( yy_size_t )); -static void *yy_flex_realloc YY_PROTO(( void *, yy_size_t )); -static void yy_flex_free YY_PROTO(( void * )); +#define YY_FLUSH_BUFFER skel__flush_buffer(YY_CURRENT_BUFFER ) -#define yy_new_buffer yy_create_buffer +YY_BUFFER_STATE skel__scan_buffer (char *base,yy_size_t size ); +YY_BUFFER_STATE skel__scan_string (yyconst char *yy_str ); +YY_BUFFER_STATE skel__scan_bytes (yyconst char *bytes,int len ); + +/* %endif */ + +void *skel_alloc (yy_size_t ); +void *skel_realloc (void *,yy_size_t ); +void skel_free (void * ); + +#define yy_new_buffer skel__create_buffer #define yy_set_interactive(is_interactive) \ { \ - if ( ! yy_current_buffer ) \ - yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE ); \ - yy_current_buffer->yy_is_interactive = is_interactive; \ + if ( ! YY_CURRENT_BUFFER ){ \ + skel_ensure_buffer_stack (); \ + YY_CURRENT_BUFFER_LVALUE = \ + skel__create_buffer(skel_in,YY_BUF_SIZE ); \ + } \ + YY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \ } #define yy_set_bol(at_bol) \ { \ - if ( ! yy_current_buffer ) \ - yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE ); \ - yy_current_buffer->yy_at_bol = at_bol; \ + if ( ! YY_CURRENT_BUFFER ){\ + skel_ensure_buffer_stack (); \ + YY_CURRENT_BUFFER_LVALUE = \ + skel__create_buffer(skel_in,YY_BUF_SIZE ); \ + } \ + YY_CURRENT_BUFFER_LVALUE->yy_at_bol = at_bol; \ } -#define YY_AT_BOL() (yy_current_buffer->yy_at_bol) +#define YY_AT_BOL() (YY_CURRENT_BUFFER_LVALUE->yy_at_bol) +/* %% [1.0] skel_text/skel_in/skel_out/yy_state_type/skel_lineno etc. def's & init go here */ +/* Begin user sect3 */ -#define yywrap() 1 +#define skel_wrap(n) 1 #define YY_SKIP_YYWRAP #define FLEX_DEBUG + typedef unsigned char YY_CHAR; -FILE *yyin = (FILE *) 0, *yyout = (FILE *) 0; + +FILE *skel_in = (FILE *) 0, *skel_out = (FILE *) 0; + typedef int yy_state_type; -#define FLEX_DEBUG -extern char *yytext; -#define yytext_ptr yytext +extern int skel_lineno; -static yy_state_type yy_get_previous_state YY_PROTO(( void )); -static yy_state_type yy_try_NUL_trans YY_PROTO(( yy_state_type current_state )); -static int yy_get_next_buffer YY_PROTO(( void )); -static void yy_fatal_error YY_PROTO(( yyconst char msg[] )); +int skel_lineno = 1; + +extern char *skel_text; +#define yytext_ptr skel_text + +/* %if-c-only Standard (non-C++) definition */ + +static yy_state_type yy_get_previous_state (void ); +static yy_state_type yy_try_NUL_trans (yy_state_type current_state ); +static int yy_get_next_buffer (void ); +static void yy_fatal_error (yyconst char msg[] ); + +/* %endif */ /* Done after the current pattern has been matched and before the - * corresponding action - sets up yytext. + * corresponding action - sets up skel_text. */ #define YY_DO_BEFORE_ACTION \ - yytext_ptr = yy_bp; \ - yyleng = (int) (yy_cp - yy_bp); \ - yy_hold_char = *yy_cp; \ + (yytext_ptr) = yy_bp; \ +/* %% [2.0] code to fiddle skel_text and skel_leng for yymore() goes here \ */\ + skel_leng = (size_t) (yy_cp - yy_bp); \ + (yy_hold_char) = *yy_cp; \ *yy_cp = '\0'; \ - yy_c_buf_p = yy_cp; +/* %% [3.0] code to copy yytext_ptr to skel_text[] goes here, if %array \ */\ + (yy_c_buf_p) = yy_cp; +/* %% [4.0] data tables for the DFA and the user's section 1 definitions go here */ #define YY_NUM_RULES 12 #define YY_END_OF_BUFFER 13 -static yyconst short int yy_accept[56] = +/* This struct is not used in this scanner, + but its presence is necessary. */ +struct yy_trans_info + { + flex_int32_t yy_verify; + flex_int32_t yy_nxt; + }; +static yyconst flex_int16_t yy_accept[58] = { 0, - 0, 0, 13, 11, 10, 9, 11, 2, 0, 3, - 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 6, 5, 0, 0, 0, 0, 1, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 8, 7, 0 + 0, 0, 13, 11, 10, 9, 11, 9, 2, 9, + 3, 4, 9, 9, 9, 9, 9, 9, 9, 9, + 9, 9, 9, 9, 6, 5, 9, 9, 9, 9, + 1, 0, 9, 9, 9, 9, 9, 9, 9, 9, + 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, + 9, 9, 9, 9, 8, 7, 0 } ; -static yyconst int yy_ec[256] = +static yyconst flex_int32_t yy_ec[256] = { 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, @@ -359,67 +480,85 @@ static yyconst int yy_ec[256] = 1, 1, 1, 1, 1 } ; -static yyconst int yy_meta[23] = +static yyconst flex_int32_t yy_meta[23] = { 0, - 1, 2, 1, 2, 1, 1, 1, 1, 1, 1, + 1, 2, 1, 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 } ; -static yyconst short int yy_base[59] = +static yyconst flex_int16_t yy_base[63] = { 0, - 0, 1, 57, 0, 58, 2, 0, 58, 0, 58, - 58, 45, 44, 35, 41, 38, 35, 42, 41, 28, - 43, 42, 26, 58, 58, 5, 42, 3, 41, 58, - 34, 35, 34, 22, 31, 19, 28, 27, 17, 16, - 27, 26, 16, 15, 16, 15, 5, 3, 7, 6, - 7, 3, 58, 58, 58, 24, 0, 26 + 0, 1, 37, 0, 123, 2, 0, 4, 123, 23, + 123, 123, 42, 11, 0, 1, 4, 5, 20, 22, + 9, 3, 30, 28, 123, 123, 37, 63, 39, 84, + 123, 7, 43, 46, 50, 49, 51, 57, 61, 62, + 60, 63, 71, 76, 78, 79, 72, 85, 25, 84, + 90, 91, 96, 99, 123, 123, 123, 110, 0, 113, + 116, 119 } ; -static yyconst short int yy_def[59] = +static yyconst flex_int16_t yy_def[63] = { 0, - 56, 56, 55, 57, 55, 55, 57, 55, 55, 55, - 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, - 55, 55, 55, 55, 55, 55, 58, 55, 58, 55, - 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, - 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, - 55, 55, 55, 55, 0, 55, 55, 55 + 58, 58, 57, 59, 57, 60, 59, 60, 57, 60, + 57, 57, 60, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 57, 57, 13, 61, 13, 61, + 57, 62, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 57, 57, 0, 57, 57, 57, + 57, 57 } ; -static yyconst short int yy_nxt[81] = +static yyconst flex_int16_t yy_nxt[146] = { 0, - 7, 5, 5, 6, 6, 8, 54, 27, 12, 28, - 53, 13, 31, 52, 51, 50, 9, 49, 32, 14, - 48, 47, 10, 11, 4, 4, 29, 29, 46, 45, - 44, 43, 42, 41, 40, 39, 38, 37, 36, 35, - 34, 33, 30, 30, 26, 25, 24, 23, 22, 21, - 20, 19, 18, 17, 16, 15, 55, 3, 55, 55, - 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, - 55, 55, 55, 55, 55, 55, 55, 55, 55, 55 + 7, 5, 5, 6, 6, 9, 25, 57, 31, 57, + 8, 8, 19, 8, 8, 8, 10, 20, 18, 8, + 21, 17, 11, 12, 57, 57, 57, 22, 24, 23, + 8, 13, 8, 26, 14, 8, 57, 51, 8, 28, + 8, 29, 15, 57, 57, 57, 27, 8, 33, 8, + 35, 36, 16, 8, 34, 37, 8, 39, 57, 8, + 8, 8, 57, 57, 31, 38, 32, 8, 41, 42, + 8, 8, 8, 8, 40, 45, 43, 49, 57, 44, + 46, 8, 8, 32, 32, 31, 8, 32, 8, 8, + 50, 47, 48, 57, 8, 8, 52, 53, 54, 55, + + 8, 8, 56, 57, 32, 32, 8, 57, 57, 8, + 4, 4, 4, 8, 57, 8, 30, 30, 30, 32, + 32, 32, 3, 57, 57, 57, 57, 57, 57, 57, + 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, + 57, 57, 57, 57, 57 } ; -static yyconst short int yy_chk[81] = +static yyconst flex_int16_t yy_chk[146] = { 0, - 57, 1, 2, 1, 2, 6, 52, 26, 9, 26, - 51, 9, 28, 50, 49, 48, 6, 47, 28, 9, - 46, 45, 6, 6, 56, 56, 58, 58, 44, 43, - 42, 41, 40, 39, 38, 37, 36, 35, 34, 33, - 32, 31, 29, 27, 23, 22, 21, 20, 19, 18, - 17, 16, 15, 14, 13, 12, 3, 55, 55, 55, - 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, - 55, 55, 55, 55, 55, 55, 55, 55, 55, 55 + 59, 1, 2, 1, 2, 6, 22, 8, 32, 0, + 15, 16, 16, 22, 17, 18, 6, 17, 15, 21, + 18, 14, 6, 6, 8, 8, 10, 19, 21, 20, + 19, 10, 20, 23, 10, 49, 3, 49, 24, 27, + 23, 27, 10, 10, 10, 13, 24, 27, 29, 29, + 33, 34, 13, 33, 29, 35, 34, 37, 0, 36, + 35, 37, 13, 13, 28, 36, 28, 38, 39, 40, + 41, 39, 40, 42, 38, 43, 41, 47, 0, 42, + 44, 43, 47, 28, 28, 30, 44, 30, 45, 46, + 48, 45, 46, 0, 50, 48, 50, 51, 52, 53, + + 51, 52, 54, 0, 30, 30, 53, 0, 0, 54, + 58, 58, 58, 60, 0, 60, 61, 61, 61, 62, + 62, 62, 57, 57, 57, 57, 57, 57, 57, 57, + 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, + 57, 57, 57, 57, 57 } ; static yy_state_type yy_last_accepting_state; static char *yy_last_accepting_cpos; -extern int yy_flex_debug; -int yy_flex_debug = 1; +extern int skel__flex_debug; +int skel__flex_debug = 1; -static yyconst short int yy_rule_linenum[12] = +static yyconst flex_int16_t yy_rule_linenum[12] = { 0, - 47, 68, 69, 70, 72, 73, 74, 75, 77, 78, - 79 + 47, 71, 72, 73, 75, 76, 77, 78, 81, 82, + 83 } ; /* The intent behind this definition is that it'll catch @@ -429,12 +568,11 @@ static yyconst short int yy_rule_linenum[12] = #define yymore() yymore_used_but_not_detected #define YY_MORE_ADJ 0 #define YY_RESTORE_YY_MORE_OFFSET -char *yytext; +char *skel_text; #line 1 "scan-skel.l" -#define INITIAL 0 /* Scan Bison Skeletons. -*- C -*- - Copyright (C) 2001, 2002, 2003 Free Software Foundation, Inc. + Copyright (C) 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc. This file is part of Bison, the GNU Compiler Compiler. @@ -450,25 +588,49 @@ char *yytext; You should have received a copy of the GNU General Public License along with Bison; see the file COPYING. If not, write to the Free - Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - 02111-1307, USA. */ -#define YY_NO_UNPUT 1 -#define YY_NEVER_INTERACTIVE 1 + Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA + 02110-1301, USA. */ #line 26 "scan-skel.l" #include "system.h" #include #include +#include "complain.h" #include "getargs.h" #include "files.h" - -int skel_lex (void); +#include "scan-skel.h" #define QPUTS(String) \ - fputs (quotearg_style (c_quoting_style, (String)), yyout) + fputs (quotearg_style (c_quoting_style, (String)), skel_out) -#line 472 "scan-skel.c" +#line 608 "scan-skel.c" + +#define INITIAL 0 + +#ifndef YY_NO_UNISTD_H +/* Special case for "unistd.h", since it is non-ANSI. We include it way + * down here because we want the user's section 1 to have been scanned first. + * The user has a chance to override it with an option. + */ +/* %if-c-only */ +#include +/* %endif */ +/* %if-c++-only */ +/* %endif */ +#endif + +#ifndef YY_EXTRA_TYPE +#define YY_EXTRA_TYPE void * +#endif + +/* %if-c-only Reentrant structure and macros (non-C++). */ +/* %if-reentrant */ +/* %if-reentrant */ +/* %endif */ +/* %if-bison-bridge */ +/* %endif */ +/* %endif End reentrant structures and macros. */ /* Macros after this point can all be overridden by user definitions in * section 1. @@ -476,66 +638,43 @@ int skel_lex (void); #ifndef YY_SKIP_YYWRAP #ifdef __cplusplus -extern "C" int yywrap YY_PROTO(( void )); +extern "C" int skel_wrap (void ); #else -extern int yywrap YY_PROTO(( void )); +extern int skel_wrap (void ); #endif #endif -#ifndef YY_NO_UNPUT -static void yyunput YY_PROTO(( int c, char *buf_ptr )); -#endif +/* %not-for-header */ + +/* %ok-for-header */ + +/* %endif */ #ifndef yytext_ptr -static void yy_flex_strncpy YY_PROTO(( char *, yyconst char *, int )); +static void yy_flex_strncpy (char *,yyconst char *,int ); #endif #ifdef YY_NEED_STRLEN -static int yy_flex_strlen YY_PROTO(( yyconst char * )); +static int yy_flex_strlen (yyconst char * ); #endif #ifndef YY_NO_INPUT +/* %if-c-only Standard (non-C++) definition */ +/* %not-for-header */ + #ifdef __cplusplus -static int yyinput YY_PROTO(( void )); +static int yyinput (void ); #else -static int input YY_PROTO(( void )); +static int input (void ); #endif +/* %ok-for-header */ + +/* %endif */ #endif -#if YY_STACK_USED -static int yy_start_stack_ptr = 0; -static int yy_start_stack_depth = 0; -static int *yy_start_stack = 0; -#ifndef YY_NO_PUSH_STATE -static void yy_push_state YY_PROTO(( int new_state )); -#endif -#ifndef YY_NO_POP_STATE -static void yy_pop_state YY_PROTO(( void )); -#endif -#ifndef YY_NO_TOP_STATE -static int yy_top_state YY_PROTO(( void )); -#endif +/* %if-c-only */ -#else -#define YY_NO_PUSH_STATE 1 -#define YY_NO_POP_STATE 1 -#define YY_NO_TOP_STATE 1 -#endif - -#ifdef YY_MALLOC_DECL -YY_MALLOC_DECL -#else -#if __STDC__ -#ifndef __cplusplus -#include -#endif -#else -/* Just try to get by without declaring the routines. This will fail - * miserably on non-ANSI systems for which sizeof(size_t) != sizeof(int) - * or sizeof(void*) != sizeof(int). - */ -#endif -#endif +/* %endif */ /* Amount of stuff to slurp up with each read. */ #ifndef YY_READ_BUF_SIZE @@ -543,12 +682,15 @@ YY_MALLOC_DECL #endif /* Copy whatever the last rule matched to the standard output. */ - #ifndef ECHO +/* %if-c-only Standard (non-C++) definition */ /* This used to be an fputs(), but since the string might contain NUL's, * we now use fwrite(). */ -#define ECHO (void) fwrite( yytext, yyleng, 1, yyout ) +#define ECHO (void) fwrite( skel_text, skel_leng, 1, skel_out ) +/* %endif */ +/* %if-c++-only C++ definition */ +/* %endif */ #endif /* Gets input and stuffs it into "buf". number of characters read, or YY_NULL, @@ -556,22 +698,24 @@ YY_MALLOC_DECL */ #ifndef YY_INPUT #define YY_INPUT(buf,result,max_size) \ - if ( yy_current_buffer->yy_is_interactive ) \ +/* %% [5.0] fread()/read() definition of YY_INPUT goes here unless we're doing C++ \ */\ + if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \ { \ - int c = '*', n; \ + int c = '*'; \ + size_t n; \ for ( n = 0; n < max_size && \ - (c = getc( yyin )) != EOF && c != '\n'; ++n ) \ + (c = getc( skel_in )) != EOF && c != '\n'; ++n ) \ buf[n] = (char) c; \ if ( c == '\n' ) \ buf[n++] = (char) c; \ - if ( c == EOF && ferror( yyin ) ) \ + if ( c == EOF && ferror( skel_in ) ) \ YY_FATAL_ERROR( "input in flex scanner failed" ); \ result = n; \ } \ else \ { \ errno=0; \ - while ( (result = fread(buf, 1, max_size, yyin))==0 && ferror(yyin)) \ + while ( (result = fread(buf, 1, max_size, skel_in))==0 && ferror(skel_in)) \ { \ if( errno != EINTR) \ { \ @@ -579,9 +723,13 @@ YY_MALLOC_DECL break; \ } \ errno=0; \ - clearerr(yyin); \ + clearerr(skel_in); \ } \ - } + }\ +\ +/* %if-c++-only C++ definition \ */\ +/* %endif */ + #endif /* No semi-colon after return; correct usage is to write "yyterminate();" - @@ -599,17 +747,42 @@ YY_MALLOC_DECL /* Report a fatal error. */ #ifndef YY_FATAL_ERROR +/* %if-c-only */ #define YY_FATAL_ERROR(msg) yy_fatal_error( msg ) +/* %endif */ +/* %if-c++-only */ +/* %endif */ #endif +/* %if-tables-serialization structures and prototypes */ +/* %not-for-header */ + +/* %ok-for-header */ + +/* %not-for-header */ + +/* %tables-yydmap generated elements */ +/* %endif */ +/* end tables serialization structures and prototypes */ + +/* %ok-for-header */ + /* Default declaration of generated scanner - a define so the user can * easily add parameters. */ #ifndef YY_DECL -#define YY_DECL int yylex YY_PROTO(( void )) -#endif +#define YY_DECL_IS_OURS 1 +/* %if-c-only Standard (non-C++) definition */ -/* Code executed at the beginning of each rule, after yytext and yyleng +extern int skel_lex (void); + +#define YY_DECL int skel_lex (void) +/* %endif */ +/* %if-c++-only C++ definition */ +/* %endif */ +#endif /* !YY_DECL */ + +/* Code executed at the beginning of each rule, after skel_text and skel_leng * have been set up. */ #ifndef YY_USER_ACTION @@ -621,15 +794,21 @@ YY_MALLOC_DECL #define YY_BREAK break; #endif +/* %% [6.0] YY_RULE_SETUP definition goes here */ #define YY_RULE_SETUP \ YY_USER_ACTION +/* %not-for-header */ + +/** The main scanner function which does all the work. + */ YY_DECL - { +{ register yy_state_type yy_current_state; register char *yy_cp, *yy_bp; register int yy_act; - + +/* %% [7.0] user's declarations go here */ #line 40 "scan-skel.l" @@ -638,89 +817,100 @@ YY_DECL char *outname = NULL; -#line 642 "scan-skel.c" +#line 821 "scan-skel.c" - if ( yy_init ) + if ( (yy_init) ) { - yy_init = 0; + (yy_init) = 0; #ifdef YY_USER_INIT YY_USER_INIT; #endif - if ( ! yy_start ) - yy_start = 1; /* first start state */ + if ( ! (yy_start) ) + (yy_start) = 1; /* first start state */ - if ( ! yyin ) - yyin = stdin; + if ( ! skel_in ) +/* %if-c-only */ + skel_in = stdin; +/* %endif */ +/* %if-c++-only */ +/* %endif */ - if ( ! yyout ) - yyout = stdout; + if ( ! skel_out ) +/* %if-c-only */ + skel_out = stdout; +/* %endif */ +/* %if-c++-only */ +/* %endif */ - if ( ! yy_current_buffer ) - yy_current_buffer = - yy_create_buffer( yyin, YY_BUF_SIZE ); + if ( ! YY_CURRENT_BUFFER ) { + skel_ensure_buffer_stack (); + YY_CURRENT_BUFFER_LVALUE = + skel__create_buffer(skel_in,YY_BUF_SIZE ); + } - yy_load_buffer_state(); + skel__load_buffer_state( ); } while ( 1 ) /* loops until end-of-file is reached */ { - yy_cp = yy_c_buf_p; +/* %% [8.0] yymore()-related code goes here */ + yy_cp = (yy_c_buf_p); - /* Support of yytext. */ - *yy_cp = yy_hold_char; + /* Support of skel_text. */ + *yy_cp = (yy_hold_char); /* yy_bp points to the position in yy_ch_buf of the start of * the current run. */ yy_bp = yy_cp; - yy_current_state = yy_start; +/* %% [9.0] code to set up and find next match goes here */ + yy_current_state = (yy_start); yy_match: do { register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)]; if ( yy_accept[yy_current_state] ) { - yy_last_accepting_state = yy_current_state; - yy_last_accepting_cpos = yy_cp; + (yy_last_accepting_state) = yy_current_state; + (yy_last_accepting_cpos) = yy_cp; } while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) { yy_current_state = (int) yy_def[yy_current_state]; - if ( yy_current_state >= 56 ) + if ( yy_current_state >= 58 ) yy_c = yy_meta[(unsigned int) yy_c]; } yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; ++yy_cp; } - while ( yy_base[yy_current_state] != 58 ); + while ( yy_current_state != 57 ); + yy_cp = (yy_last_accepting_cpos); + yy_current_state = (yy_last_accepting_state); yy_find_action: +/* %% [10.0] code to find the action number goes here */ yy_act = yy_accept[yy_current_state]; - if ( yy_act == 0 ) - { /* have to back up */ - yy_cp = yy_last_accepting_cpos; - yy_current_state = yy_last_accepting_state; - yy_act = yy_accept[yy_current_state]; - } YY_DO_BEFORE_ACTION; +/* %% [11.0] code for skel_lineno update goes here */ do_action: /* This label is used only to access EOF actions. */ - if ( yy_flex_debug ) +/* %% [12.0] debug code goes here */ + if ( skel__flex_debug ) { if ( yy_act == 0 ) fprintf( stderr, "--scanner backing up\n" ); else if ( yy_act < 12 ) - fprintf( stderr, "--accepting rule at line %d (\"%s\")\n", - yy_rule_linenum[yy_act], yytext ); + fprintf( stderr, "--accepting rule at line %ld (\"%s\")\n", + (long)yy_rule_linenum[yy_act], skel_text ); else if ( yy_act == 12 ) fprintf( stderr, "--accepting default rule (\"%s\")\n", - yytext ); + skel_text ); else if ( yy_act == 13 ) fprintf( stderr, "--(end of buffer or a NUL)\n" ); else @@ -729,121 +919,135 @@ do_action: /* This label is used only to access EOF actions. */ switch ( yy_act ) { /* beginning of action switch */ +/* %% [13.0] actions go here */ case 0: /* must back up */ /* undo the effects of YY_DO_BEFORE_ACTION */ - *yy_cp = yy_hold_char; - yy_cp = yy_last_accepting_cpos; - yy_current_state = yy_last_accepting_state; + *yy_cp = (yy_hold_char); + yy_cp = (yy_last_accepting_cpos); + yy_current_state = (yy_last_accepting_state); goto yy_find_action; case 1: +/* rule 1 can match eol */ YY_RULE_SETUP #line 47 "scan-skel.l" { - char const *filename = yytext + sizeof "@output " - 1; - yytext[yyleng - 1] = '\0'; + char const *file_name = skel_text + sizeof "@output " - 1; + skel_text[skel_leng - 1] = '\0'; - if (*filename == '@') + if (*file_name == '@') { - if (strcmp (filename, "@output_header_name@") == 0) - filename = spec_defines_file; - else if (strcmp (filename, "@output_parser_name@") == 0) - filename = parser_file_name; + if (strcmp (file_name, "@output_header_name@") == 0) + file_name = spec_defines_file; + else if (strcmp (file_name, "@output_parser_name@") == 0) + file_name = parser_file_name; else - abort (); + fatal ("invalid token in skeleton: %s", skel_text); } - XFREE (outname); - outname = xstrdup (filename); - xfclose (yyout); - yyout = xfopen (outname, "w"); + if (outname) + { + free (outname); + xfclose (skel_out); + } + outname = xstrdup (file_name); + skel_out = xfopen (outname, "w"); lineno = 1; } YY_BREAK case 2: YY_RULE_SETUP -#line 68 "scan-skel.l" -fputc ('@', yyout); +#line 71 "scan-skel.l" +fputc ('@', skel_out); YY_BREAK case 3: YY_RULE_SETUP -#line 69 "scan-skel.l" -fputc ('[', yyout); +#line 72 "scan-skel.l" +fputc ('[', skel_out); YY_BREAK case 4: YY_RULE_SETUP -#line 70 "scan-skel.l" -fputc (']', yyout); +#line 73 "scan-skel.l" +fputc (']', skel_out); YY_BREAK case 5: YY_RULE_SETUP -#line 72 "scan-skel.l" -fprintf (yyout, "%d", lineno + 1); +#line 75 "scan-skel.l" +fprintf (skel_out, "%d", lineno + 1); YY_BREAK case 6: YY_RULE_SETUP -#line 73 "scan-skel.l" +#line 76 "scan-skel.l" QPUTS (outname); YY_BREAK case 7: YY_RULE_SETUP -#line 74 "scan-skel.l" +#line 77 "scan-skel.l" QPUTS (parser_file_name); YY_BREAK case 8: YY_RULE_SETUP -#line 75 "scan-skel.l" +#line 78 "scan-skel.l" QPUTS (spec_defines_file); YY_BREAK +/* This pattern must not match more than the previous @ patterns. */ case 9: YY_RULE_SETUP -#line 77 "scan-skel.l" -abort (); +#line 81 "scan-skel.l" +fatal ("invalid @ in skeleton: %s", skel_text); YY_BREAK case 10: +/* rule 10 can match eol */ YY_RULE_SETUP -#line 78 "scan-skel.l" +#line 82 "scan-skel.l" lineno++; ECHO; YY_BREAK case 11: YY_RULE_SETUP -#line 79 "scan-skel.l" +#line 83 "scan-skel.l" ECHO; YY_BREAK case YY_STATE_EOF(INITIAL): -#line 81 "scan-skel.l" -xfclose (yyout); free (outname); return EOF; +#line 85 "scan-skel.l" +{ + if (outname) + { + free (outname); + xfclose (skel_out); + } + return EOF; +} YY_BREAK case 12: YY_RULE_SETUP -#line 82 "scan-skel.l" +#line 93 "scan-skel.l" YY_FATAL_ERROR( "flex scanner jammed" ); YY_BREAK -#line 823 "scan-skel.c" +#line 1027 "scan-skel.c" case YY_END_OF_BUFFER: { /* Amount of text matched not including the EOB char. */ - int yy_amount_of_matched_text = (int) (yy_cp - yytext_ptr) - 1; + int yy_amount_of_matched_text = (int) (yy_cp - (yytext_ptr)) - 1; /* Undo the effects of YY_DO_BEFORE_ACTION. */ - *yy_cp = yy_hold_char; + *yy_cp = (yy_hold_char); YY_RESTORE_YY_MORE_OFFSET - if ( yy_current_buffer->yy_buffer_status == YY_BUFFER_NEW ) + if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_NEW ) { /* We're scanning a new file or input source. It's * possible that this happened because the user - * just pointed yyin at a new source and called - * yylex(). If so, then we have to assure - * consistency between yy_current_buffer and our + * just pointed skel_in at a new source and called + * skel_lex(). If so, then we have to assure + * consistency between YY_CURRENT_BUFFER and our * globals. Here is the right place to do so, because * this is the first action (other than possibly a * back-up) that will match for the new input source. */ - yy_n_chars = yy_current_buffer->yy_n_chars; - yy_current_buffer->yy_input_file = yyin; - yy_current_buffer->yy_buffer_status = YY_BUFFER_NORMAL; + (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars; + YY_CURRENT_BUFFER_LVALUE->yy_input_file = skel_in; + YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_NORMAL; } /* Note that here we test for yy_c_buf_p "<=" to the position @@ -853,13 +1057,13 @@ YY_FATAL_ERROR( "flex scanner jammed" ); * end-of-buffer state). Contrast this with the test * in input(). */ - if ( yy_c_buf_p <= &yy_current_buffer->yy_ch_buf[yy_n_chars] ) + if ( (yy_c_buf_p) <= &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] ) { /* This was really a NUL. */ yy_state_type yy_next_state; - yy_c_buf_p = yytext_ptr + yy_amount_of_matched_text; + (yy_c_buf_p) = (yytext_ptr) + yy_amount_of_matched_text; - yy_current_state = yy_get_previous_state(); + yy_current_state = yy_get_previous_state( ); /* Okay, we're now positioned to make the NUL * transition. We couldn't have @@ -872,41 +1076,43 @@ YY_FATAL_ERROR( "flex scanner jammed" ); yy_next_state = yy_try_NUL_trans( yy_current_state ); - yy_bp = yytext_ptr + YY_MORE_ADJ; + yy_bp = (yytext_ptr) + YY_MORE_ADJ; if ( yy_next_state ) { /* Consume the NUL. */ - yy_cp = ++yy_c_buf_p; + yy_cp = ++(yy_c_buf_p); yy_current_state = yy_next_state; goto yy_match; } else { - yy_cp = yy_c_buf_p; +/* %% [14.0] code to do back-up for compressed tables and set up yy_cp goes here */ + yy_cp = (yy_last_accepting_cpos); + yy_current_state = (yy_last_accepting_state); goto yy_find_action; } } - else switch ( yy_get_next_buffer() ) + else switch ( yy_get_next_buffer( ) ) { case EOB_ACT_END_OF_FILE: { - yy_did_buffer_switch_on_eof = 0; + (yy_did_buffer_switch_on_eof) = 0; - if ( yywrap() ) + if ( skel_wrap( ) ) { /* Note: because we've taken care in * yy_get_next_buffer() to have set up - * yytext, we can now set up + * skel_text, we can now set up * yy_c_buf_p so that if some total * hoser (like flex itself) wants to * call the scanner after we return the * YY_NULL, it'll still work - another * YY_NULL will get returned. */ - yy_c_buf_p = yytext_ptr + YY_MORE_ADJ; + (yy_c_buf_p) = (yytext_ptr) + YY_MORE_ADJ; yy_act = YY_STATE_EOF(YY_START); goto do_action; @@ -914,30 +1120,30 @@ YY_FATAL_ERROR( "flex scanner jammed" ); else { - if ( ! yy_did_buffer_switch_on_eof ) + if ( ! (yy_did_buffer_switch_on_eof) ) YY_NEW_FILE; } break; } case EOB_ACT_CONTINUE_SCAN: - yy_c_buf_p = - yytext_ptr + yy_amount_of_matched_text; + (yy_c_buf_p) = + (yytext_ptr) + yy_amount_of_matched_text; - yy_current_state = yy_get_previous_state(); + yy_current_state = yy_get_previous_state( ); - yy_cp = yy_c_buf_p; - yy_bp = yytext_ptr + YY_MORE_ADJ; + yy_cp = (yy_c_buf_p); + yy_bp = (yytext_ptr) + YY_MORE_ADJ; goto yy_match; case EOB_ACT_LAST_MATCH: - yy_c_buf_p = - &yy_current_buffer->yy_ch_buf[yy_n_chars]; + (yy_c_buf_p) = + &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)]; - yy_current_state = yy_get_previous_state(); + yy_current_state = yy_get_previous_state( ); - yy_cp = yy_c_buf_p; - yy_bp = yytext_ptr + YY_MORE_ADJ; + yy_cp = (yy_c_buf_p); + yy_bp = (yytext_ptr) + YY_MORE_ADJ; goto yy_find_action; } break; @@ -948,8 +1154,15 @@ YY_FATAL_ERROR( "flex scanner jammed" ); "fatal flex scanner internal error--no action found" ); } /* end of action switch */ } /* end of scanning one token */ - } /* end of yylex */ +} /* end of skel_lex */ +/* %ok-for-header */ +/* %if-c++-only */ +/* %not-for-header */ + +/* %ok-for-header */ + +/* %endif */ /* yy_get_next_buffer - try to read in a new buffer * @@ -958,21 +1171,24 @@ YY_FATAL_ERROR( "flex scanner jammed" ); * EOB_ACT_CONTINUE_SCAN - continue scanning from current position * EOB_ACT_END_OF_FILE - end of file */ - -static int yy_get_next_buffer() - { - register char *dest = yy_current_buffer->yy_ch_buf; - register char *source = yytext_ptr; +/* %if-c-only */ +static int yy_get_next_buffer (void) +/* %endif */ +/* %if-c++-only */ +/* %endif */ +{ + register char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf; + register char *source = (yytext_ptr); register int number_to_move, i; int ret_val; - if ( yy_c_buf_p > &yy_current_buffer->yy_ch_buf[yy_n_chars + 1] ) + if ( (yy_c_buf_p) > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] ) YY_FATAL_ERROR( "fatal flex scanner internal error--end of buffer missed" ); - if ( yy_current_buffer->yy_fill_buffer == 0 ) + if ( YY_CURRENT_BUFFER_LVALUE->yy_fill_buffer == 0 ) { /* Don't try to fill the buffer, so this is an EOF. */ - if ( yy_c_buf_p - yytext_ptr - YY_MORE_ADJ == 1 ) + if ( (yy_c_buf_p) - (yytext_ptr) - YY_MORE_ADJ == 1 ) { /* We matched a single character, the EOB, so * treat this as a final EOF. @@ -992,34 +1208,30 @@ static int yy_get_next_buffer() /* Try to read more data. */ /* First move last chars to start of buffer. */ - number_to_move = (int) (yy_c_buf_p - yytext_ptr) - 1; + number_to_move = (int) ((yy_c_buf_p) - (yytext_ptr)) - 1; for ( i = 0; i < number_to_move; ++i ) *(dest++) = *(source++); - if ( yy_current_buffer->yy_buffer_status == YY_BUFFER_EOF_PENDING ) + if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_EOF_PENDING ) /* don't do the read, it's not guaranteed to return an EOF, * just force an EOF */ - yy_current_buffer->yy_n_chars = yy_n_chars = 0; + YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars) = 0; else { - int num_to_read = - yy_current_buffer->yy_buf_size - number_to_move - 1; + size_t num_to_read = + YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1; while ( num_to_read <= 0 ) { /* Not enough room in the buffer - grow it. */ -#ifdef YY_USES_REJECT - YY_FATAL_ERROR( -"input buffer overflow, can't enlarge buffer because scanner uses REJECT" ); -#else /* just a shorter name for the current buffer */ - YY_BUFFER_STATE b = yy_current_buffer; + YY_BUFFER_STATE b = YY_CURRENT_BUFFER; int yy_c_buf_p_offset = - (int) (yy_c_buf_p - b->yy_ch_buf); + (int) ((yy_c_buf_p) - b->yy_ch_buf); if ( b->yy_is_our_buffer ) { @@ -1032,8 +1244,7 @@ static int yy_get_next_buffer() b->yy_ch_buf = (char *) /* Include room in for 2 EOB chars. */ - yy_flex_realloc( (void *) b->yy_ch_buf, - b->yy_buf_size + 2 ); + skel_realloc((void *) b->yy_ch_buf,b->yy_buf_size + 2 ); } else /* Can't grow it, we don't own it. */ @@ -1043,35 +1254,35 @@ static int yy_get_next_buffer() YY_FATAL_ERROR( "fatal error - scanner input buffer overflow" ); - yy_c_buf_p = &b->yy_ch_buf[yy_c_buf_p_offset]; + (yy_c_buf_p) = &b->yy_ch_buf[yy_c_buf_p_offset]; - num_to_read = yy_current_buffer->yy_buf_size - + num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1; -#endif + } if ( num_to_read > YY_READ_BUF_SIZE ) num_to_read = YY_READ_BUF_SIZE; /* Read in more data. */ - YY_INPUT( (&yy_current_buffer->yy_ch_buf[number_to_move]), - yy_n_chars, num_to_read ); + YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]), + (yy_n_chars), num_to_read ); - yy_current_buffer->yy_n_chars = yy_n_chars; + YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars); } - if ( yy_n_chars == 0 ) + if ( (yy_n_chars) == 0 ) { if ( number_to_move == YY_MORE_ADJ ) { ret_val = EOB_ACT_END_OF_FILE; - yyrestart( yyin ); + skel_restart(skel_in ); } else { ret_val = EOB_ACT_LAST_MATCH; - yy_current_buffer->yy_buffer_status = + YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_EOF_PENDING; } } @@ -1079,152 +1290,121 @@ static int yy_get_next_buffer() else ret_val = EOB_ACT_CONTINUE_SCAN; - yy_n_chars += number_to_move; - yy_current_buffer->yy_ch_buf[yy_n_chars] = YY_END_OF_BUFFER_CHAR; - yy_current_buffer->yy_ch_buf[yy_n_chars + 1] = YY_END_OF_BUFFER_CHAR; + (yy_n_chars) += number_to_move; + YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] = YY_END_OF_BUFFER_CHAR; + YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] = YY_END_OF_BUFFER_CHAR; - yytext_ptr = &yy_current_buffer->yy_ch_buf[0]; + (yytext_ptr) = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[0]; return ret_val; - } - +} /* yy_get_previous_state - get the state just before the EOB char was reached */ -static yy_state_type yy_get_previous_state() - { +/* %if-c-only */ +/* %not-for-header */ + + static yy_state_type yy_get_previous_state (void) +/* %endif */ +/* %if-c++-only */ +/* %endif */ +{ register yy_state_type yy_current_state; register char *yy_cp; + +/* %% [15.0] code to get the start state into yy_current_state goes here */ + yy_current_state = (yy_start); - yy_current_state = yy_start; - - for ( yy_cp = yytext_ptr + YY_MORE_ADJ; yy_cp < yy_c_buf_p; ++yy_cp ) + for ( yy_cp = (yytext_ptr) + YY_MORE_ADJ; yy_cp < (yy_c_buf_p); ++yy_cp ) { +/* %% [16.0] code to find the next state goes here */ register YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1); if ( yy_accept[yy_current_state] ) { - yy_last_accepting_state = yy_current_state; - yy_last_accepting_cpos = yy_cp; + (yy_last_accepting_state) = yy_current_state; + (yy_last_accepting_cpos) = yy_cp; } while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) { yy_current_state = (int) yy_def[yy_current_state]; - if ( yy_current_state >= 56 ) + if ( yy_current_state >= 58 ) yy_c = yy_meta[(unsigned int) yy_c]; } yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; } return yy_current_state; - } - +} /* yy_try_NUL_trans - try to make a transition on the NUL character * * synopsis * next_state = yy_try_NUL_trans( current_state ); */ - -#ifdef YY_USE_PROTOS -static yy_state_type yy_try_NUL_trans( yy_state_type yy_current_state ) -#else -static yy_state_type yy_try_NUL_trans( yy_current_state ) -yy_state_type yy_current_state; -#endif - { +/* %if-c-only */ + static yy_state_type yy_try_NUL_trans (yy_state_type yy_current_state ) +/* %endif */ +/* %if-c++-only */ +/* %endif */ +{ register int yy_is_jam; - register char *yy_cp = yy_c_buf_p; + /* %% [17.0] code to find the next state, and perhaps do backing up, goes here */ + register char *yy_cp = (yy_c_buf_p); register YY_CHAR yy_c = 1; if ( yy_accept[yy_current_state] ) { - yy_last_accepting_state = yy_current_state; - yy_last_accepting_cpos = yy_cp; + (yy_last_accepting_state) = yy_current_state; + (yy_last_accepting_cpos) = yy_cp; } while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) { yy_current_state = (int) yy_def[yy_current_state]; - if ( yy_current_state >= 56 ) + if ( yy_current_state >= 58 ) yy_c = yy_meta[(unsigned int) yy_c]; } yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; - yy_is_jam = (yy_current_state == 55); + yy_is_jam = (yy_current_state == 57); return yy_is_jam ? 0 : yy_current_state; - } +} +/* %if-c-only */ -#ifndef YY_NO_UNPUT -#ifdef YY_USE_PROTOS -static void yyunput( int c, register char *yy_bp ) -#else -static void yyunput( c, yy_bp ) -int c; -register char *yy_bp; -#endif - { - register char *yy_cp = yy_c_buf_p; - - /* undo effects of setting up yytext */ - *yy_cp = yy_hold_char; - - if ( yy_cp < yy_current_buffer->yy_ch_buf + 2 ) - { /* need to shift things up to make room */ - /* +2 for EOB chars. */ - register int number_to_move = yy_n_chars + 2; - register char *dest = &yy_current_buffer->yy_ch_buf[ - yy_current_buffer->yy_buf_size + 2]; - register char *source = - &yy_current_buffer->yy_ch_buf[number_to_move]; - - while ( source > yy_current_buffer->yy_ch_buf ) - *--dest = *--source; - - yy_cp += (int) (dest - source); - yy_bp += (int) (dest - source); - yy_current_buffer->yy_n_chars = - yy_n_chars = yy_current_buffer->yy_buf_size; - - if ( yy_cp < yy_current_buffer->yy_ch_buf + 2 ) - YY_FATAL_ERROR( "flex scanner push-back overflow" ); - } - - *--yy_cp = (char) c; - - - yytext_ptr = yy_bp; - yy_hold_char = *yy_cp; - yy_c_buf_p = yy_cp; - } -#endif /* ifndef YY_NO_UNPUT */ - +/* %endif */ +/* %if-c-only */ +#ifndef YY_NO_INPUT #ifdef __cplusplus -static int yyinput() + static int yyinput (void) #else -static int input() + static int input (void) #endif - { + +/* %endif */ +/* %if-c++-only */ +/* %endif */ +{ int c; + + *(yy_c_buf_p) = (yy_hold_char); - *yy_c_buf_p = yy_hold_char; - - if ( *yy_c_buf_p == YY_END_OF_BUFFER_CHAR ) + if ( *(yy_c_buf_p) == YY_END_OF_BUFFER_CHAR ) { /* yy_c_buf_p now points to the character we want to return. * If this occurs *before* the EOB characters, then it's a * valid NUL; if not, then we've hit the end of the buffer. */ - if ( yy_c_buf_p < &yy_current_buffer->yy_ch_buf[yy_n_chars] ) + if ( (yy_c_buf_p) < &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] ) /* This was really a NUL. */ - *yy_c_buf_p = '\0'; + *(yy_c_buf_p) = '\0'; else { /* need more input */ - int offset = yy_c_buf_p - yytext_ptr; - ++yy_c_buf_p; + int offset = (yy_c_buf_p) - (yytext_ptr); + ++(yy_c_buf_p); - switch ( yy_get_next_buffer() ) + switch ( yy_get_next_buffer( ) ) { case EOB_ACT_LAST_MATCH: /* This happens because yy_g_n_b() @@ -1238,16 +1418,16 @@ static int input() */ /* Reset buffer status. */ - yyrestart( yyin ); + skel_restart(skel_in ); - /* fall through */ + /*FALLTHROUGH*/ case EOB_ACT_END_OF_FILE: { - if ( yywrap() ) + if ( skel_wrap( ) ) return EOF; - if ( ! yy_did_buffer_switch_on_eof ) + if ( ! (yy_did_buffer_switch_on_eof) ) YY_NEW_FILE; #ifdef __cplusplus return yyinput(); @@ -1257,176 +1437,209 @@ static int input() } case EOB_ACT_CONTINUE_SCAN: - yy_c_buf_p = yytext_ptr + offset; + (yy_c_buf_p) = (yytext_ptr) + offset; break; } } } - c = *(unsigned char *) yy_c_buf_p; /* cast for 8-bit char's */ - *yy_c_buf_p = '\0'; /* preserve yytext */ - yy_hold_char = *++yy_c_buf_p; + c = *(unsigned char *) (yy_c_buf_p); /* cast for 8-bit char's */ + *(yy_c_buf_p) = '\0'; /* preserve skel_text */ + (yy_hold_char) = *++(yy_c_buf_p); +/* %% [19.0] update BOL and skel_lineno */ return c; +} +/* %if-c-only */ +#endif /* ifndef YY_NO_INPUT */ +/* %endif */ + +/** Immediately switch to a different input stream. + * @param input_file A readable stream. + * + * @note This function does not reset the start condition to @c INITIAL . + */ +/* %if-c-only */ + void skel_restart (FILE * input_file ) +/* %endif */ +/* %if-c++-only */ +/* %endif */ +{ + + if ( ! YY_CURRENT_BUFFER ){ + skel_ensure_buffer_stack (); + YY_CURRENT_BUFFER_LVALUE = + skel__create_buffer(skel_in,YY_BUF_SIZE ); } + skel__init_buffer(YY_CURRENT_BUFFER,input_file ); + skel__load_buffer_state( ); +} -#ifdef YY_USE_PROTOS -void yyrestart( FILE *input_file ) -#else -void yyrestart( input_file ) -FILE *input_file; -#endif - { - if ( ! yy_current_buffer ) - yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE ); - - yy_init_buffer( yy_current_buffer, input_file ); - yy_load_buffer_state(); - } - - -#ifdef YY_USE_PROTOS -void yy_switch_to_buffer( YY_BUFFER_STATE new_buffer ) -#else -void yy_switch_to_buffer( new_buffer ) -YY_BUFFER_STATE new_buffer; -#endif - { - if ( yy_current_buffer == new_buffer ) +/** Switch to a different input buffer. + * @param new_buffer The new input buffer. + * + */ +/* %if-c-only */ + void skel__switch_to_buffer (YY_BUFFER_STATE new_buffer ) +/* %endif */ +/* %if-c++-only */ +/* %endif */ +{ + + /* TODO. We should be able to replace this entire function body + * with + * skel_pop_buffer_state(); + * skel_push_buffer_state(new_buffer); + */ + skel_ensure_buffer_stack (); + if ( YY_CURRENT_BUFFER == new_buffer ) return; - if ( yy_current_buffer ) + if ( YY_CURRENT_BUFFER ) { /* Flush out information for old buffer. */ - *yy_c_buf_p = yy_hold_char; - yy_current_buffer->yy_buf_pos = yy_c_buf_p; - yy_current_buffer->yy_n_chars = yy_n_chars; + *(yy_c_buf_p) = (yy_hold_char); + YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p); + YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars); } - yy_current_buffer = new_buffer; - yy_load_buffer_state(); + YY_CURRENT_BUFFER_LVALUE = new_buffer; + skel__load_buffer_state( ); /* We don't actually know whether we did this switch during - * EOF (yywrap()) processing, but the only time this flag - * is looked at is after yywrap() is called, so it's safe + * EOF (skel_wrap()) processing, but the only time this flag + * is looked at is after skel_wrap() is called, so it's safe * to go ahead and always set it. */ - yy_did_buffer_switch_on_eof = 1; - } + (yy_did_buffer_switch_on_eof) = 1; +} +/* %if-c-only */ +static void skel__load_buffer_state (void) +/* %endif */ +/* %if-c++-only */ +/* %endif */ +{ + (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars; + (yytext_ptr) = (yy_c_buf_p) = YY_CURRENT_BUFFER_LVALUE->yy_buf_pos; + skel_in = YY_CURRENT_BUFFER_LVALUE->yy_input_file; + (yy_hold_char) = *(yy_c_buf_p); +} -#ifdef YY_USE_PROTOS -void yy_load_buffer_state( void ) -#else -void yy_load_buffer_state() -#endif - { - yy_n_chars = yy_current_buffer->yy_n_chars; - yytext_ptr = yy_c_buf_p = yy_current_buffer->yy_buf_pos; - yyin = yy_current_buffer->yy_input_file; - yy_hold_char = *yy_c_buf_p; - } - - -#ifdef YY_USE_PROTOS -YY_BUFFER_STATE yy_create_buffer( FILE *file, int size ) -#else -YY_BUFFER_STATE yy_create_buffer( file, size ) -FILE *file; -int size; -#endif - { +/** Allocate and initialize an input buffer state. + * @param file A readable stream. + * @param size The character buffer size in bytes. When in doubt, use @c YY_BUF_SIZE. + * + * @return the allocated buffer state. + */ +/* %if-c-only */ + YY_BUFFER_STATE skel__create_buffer (FILE * file, int size ) +/* %endif */ +/* %if-c++-only */ +/* %endif */ +{ YY_BUFFER_STATE b; - - b = (YY_BUFFER_STATE) yy_flex_alloc( sizeof( struct yy_buffer_state ) ); + + b = (YY_BUFFER_STATE) skel_alloc(sizeof( struct yy_buffer_state ) ); if ( ! b ) - YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" ); + YY_FATAL_ERROR( "out of dynamic memory in skel__create_buffer()" ); b->yy_buf_size = size; /* yy_ch_buf has to be 2 characters longer than the size given because * we need to put in 2 end-of-buffer characters. */ - b->yy_ch_buf = (char *) yy_flex_alloc( b->yy_buf_size + 2 ); + b->yy_ch_buf = (char *) skel_alloc(b->yy_buf_size + 2 ); if ( ! b->yy_ch_buf ) - YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" ); + YY_FATAL_ERROR( "out of dynamic memory in skel__create_buffer()" ); b->yy_is_our_buffer = 1; - yy_init_buffer( b, file ); + skel__init_buffer(b,file ); return b; - } +} - -#ifdef YY_USE_PROTOS -void yy_delete_buffer( YY_BUFFER_STATE b ) -#else -void yy_delete_buffer( b ) -YY_BUFFER_STATE b; -#endif - { +/** Destroy the buffer. + * @param b a buffer created with skel__create_buffer() + * + */ +/* %if-c-only */ + void skel__delete_buffer (YY_BUFFER_STATE b ) +/* %endif */ +/* %if-c++-only */ +/* %endif */ +{ + if ( ! b ) return; - if ( b == yy_current_buffer ) - yy_current_buffer = (YY_BUFFER_STATE) 0; + if ( b == YY_CURRENT_BUFFER ) /* Not sure if we should pop here. */ + YY_CURRENT_BUFFER_LVALUE = (YY_BUFFER_STATE) 0; if ( b->yy_is_our_buffer ) - yy_flex_free( (void *) b->yy_ch_buf ); + skel_free((void *) b->yy_ch_buf ); - yy_flex_free( (void *) b ); - } + skel_free((void *) b ); +} +/* %if-c-only */ -#ifndef _WIN32 -#include -#else -#ifndef YY_ALWAYS_INTERACTIVE -#ifndef YY_NEVER_INTERACTIVE -extern int isatty YY_PROTO(( int )); -#endif -#endif -#endif +/* %endif */ -#ifdef YY_USE_PROTOS -void yy_init_buffer( YY_BUFFER_STATE b, FILE *file ) -#else -void yy_init_buffer( b, file ) -YY_BUFFER_STATE b; -FILE *file; -#endif +/* %if-c++-only */ +/* %endif */ +/* Initializes or reinitializes a buffer. + * This function is sometimes called more than once on the same buffer, + * such as during a skel_restart() or at EOF. + */ +/* %if-c-only */ + static void skel__init_buffer (YY_BUFFER_STATE b, FILE * file ) +/* %endif */ +/* %if-c++-only */ +/* %endif */ - { - yy_flush_buffer( b ); +{ + int oerrno = errno; + + skel__flush_buffer(b ); b->yy_input_file = file; b->yy_fill_buffer = 1; -#if YY_ALWAYS_INTERACTIVE - b->yy_is_interactive = 1; -#else -#if YY_NEVER_INTERACTIVE - b->yy_is_interactive = 0; -#else - b->yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0; -#endif -#endif - } + /* If b is the current buffer, then skel__init_buffer was _probably_ + * called from skel_restart() or through yy_get_next_buffer. + * In that case, we don't want to reset the lineno or column. + */ + if (b != YY_CURRENT_BUFFER){ + b->yy_bs_lineno = 1; + b->yy_bs_column = 0; + } +/* %if-c-only */ -#ifdef YY_USE_PROTOS -void yy_flush_buffer( YY_BUFFER_STATE b ) -#else -void yy_flush_buffer( b ) -YY_BUFFER_STATE b; -#endif + b->yy_is_interactive = 0; + +/* %endif */ +/* %if-c++-only */ +/* %endif */ + errno = oerrno; +} - { - if ( ! b ) +/** Discard all buffered characters. On the next scan, YY_INPUT will be called. + * @param b the buffer state to be flushed, usually @c YY_CURRENT_BUFFER. + * + */ +/* %if-c-only */ + void skel__flush_buffer (YY_BUFFER_STATE b ) +/* %endif */ +/* %if-c++-only */ +/* %endif */ +{ + if ( ! b ) return; b->yy_n_chars = 0; @@ -1443,31 +1656,142 @@ YY_BUFFER_STATE b; b->yy_at_bol = 1; b->yy_buffer_status = YY_BUFFER_NEW; - if ( b == yy_current_buffer ) - yy_load_buffer_state(); + if ( b == YY_CURRENT_BUFFER ) + skel__load_buffer_state( ); +} + +/* %if-c-or-c++ */ +/** Pushes the new state onto the stack. The new state becomes + * the current state. This function will allocate the stack + * if necessary. + * @param new_buffer The new state. + * + */ +/* %if-c-only */ +void skel_push_buffer_state (YY_BUFFER_STATE new_buffer ) +/* %endif */ +/* %if-c++-only */ +/* %endif */ +{ + if (new_buffer == NULL) + return; + + skel_ensure_buffer_stack(); + + /* This block is copied from skel__switch_to_buffer. */ + if ( YY_CURRENT_BUFFER ) + { + /* Flush out information for old buffer. */ + *(yy_c_buf_p) = (yy_hold_char); + YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p); + YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars); + } + + /* Only push if top exists. Otherwise, replace top. */ + if (YY_CURRENT_BUFFER) + (yy_buffer_stack_top)++; + YY_CURRENT_BUFFER_LVALUE = new_buffer; + + /* copied from skel__switch_to_buffer. */ + skel__load_buffer_state( ); + (yy_did_buffer_switch_on_eof) = 1; +} +/* %endif */ + +/* %if-c-or-c++ */ +/** Removes and deletes the top of the stack, if present. + * The next element becomes the new top. + * + */ +/* %if-c-only */ +void skel_pop_buffer_state (void) +/* %endif */ +/* %if-c++-only */ +/* %endif */ +{ + if (!YY_CURRENT_BUFFER) + return; + + skel__delete_buffer(YY_CURRENT_BUFFER ); + YY_CURRENT_BUFFER_LVALUE = NULL; + if ((yy_buffer_stack_top) > 0) + --(yy_buffer_stack_top); + + if (YY_CURRENT_BUFFER) { + skel__load_buffer_state( ); + (yy_did_buffer_switch_on_eof) = 1; + } +} +/* %endif */ + +/* %if-c-or-c++ */ +/* Allocates the stack if it does not exist. + * Guarantees space for at least one push. + */ +/* %if-c-only */ +static void skel_ensure_buffer_stack (void) +/* %endif */ +/* %if-c++-only */ +/* %endif */ +{ + int num_to_alloc; + + if (!(yy_buffer_stack)) { + + /* First allocation is just for 2 elements, since we don't know if this + * scanner will even need a stack. We use 2 instead of 1 to avoid an + * immediate realloc on the next call. + */ + num_to_alloc = 1; + (yy_buffer_stack) = (struct yy_buffer_state**)skel_alloc + (num_to_alloc * sizeof(struct yy_buffer_state*) + ); + + memset((yy_buffer_stack), 0, num_to_alloc * sizeof(struct yy_buffer_state*)); + + (yy_buffer_stack_max) = num_to_alloc; + (yy_buffer_stack_top) = 0; + return; } + if ((yy_buffer_stack_top) >= ((yy_buffer_stack_max)) - 1){ -#ifndef YY_NO_SCAN_BUFFER -#ifdef YY_USE_PROTOS -YY_BUFFER_STATE yy_scan_buffer( char *base, yy_size_t size ) -#else -YY_BUFFER_STATE yy_scan_buffer( base, size ) -char *base; -yy_size_t size; -#endif - { + /* Increase the buffer to prepare for a possible push. */ + int grow_size = 8 /* arbitrary grow size */; + + num_to_alloc = (yy_buffer_stack_max) + grow_size; + (yy_buffer_stack) = (struct yy_buffer_state**)skel_realloc + ((yy_buffer_stack), + num_to_alloc * sizeof(struct yy_buffer_state*) + ); + + /* zero only the new slots.*/ + memset((yy_buffer_stack) + (yy_buffer_stack_max), 0, grow_size * sizeof(struct yy_buffer_state*)); + (yy_buffer_stack_max) = num_to_alloc; + } +} +/* %endif */ + +/* %if-c-only */ +/** Setup the input buffer state to scan directly from a user-specified character buffer. + * @param base the character buffer + * @param size the size in bytes of the character buffer + * + * @return the newly allocated buffer state object. + */ +YY_BUFFER_STATE skel__scan_buffer (char * base, yy_size_t size ) +{ YY_BUFFER_STATE b; - + if ( size < 2 || base[size-2] != YY_END_OF_BUFFER_CHAR || base[size-1] != YY_END_OF_BUFFER_CHAR ) /* They forgot to leave room for the EOB's. */ return 0; - b = (YY_BUFFER_STATE) yy_flex_alloc( sizeof( struct yy_buffer_state ) ); + b = (YY_BUFFER_STATE) skel_alloc(sizeof( struct yy_buffer_state ) ); if ( ! b ) - YY_FATAL_ERROR( "out of dynamic memory in yy_scan_buffer()" ); + YY_FATAL_ERROR( "out of dynamic memory in skel__scan_buffer()" ); b->yy_buf_size = size - 2; /* "- 2" to take care of EOB's */ b->yy_buf_pos = b->yy_ch_buf = base; @@ -1479,58 +1803,57 @@ yy_size_t size; b->yy_fill_buffer = 0; b->yy_buffer_status = YY_BUFFER_NEW; - yy_switch_to_buffer( b ); + skel__switch_to_buffer(b ); return b; - } -#endif +} +/* %endif */ +/* %if-c-only */ +/** Setup the input buffer state to scan a string. The next call to skel_lex() will + * scan from a @e copy of @a str. + * @param str a NUL-terminated string to scan + * + * @return the newly allocated buffer state object. + * @note If you want to scan bytes that may contain NUL values, then use + * skel__scan_bytes() instead. + */ +YY_BUFFER_STATE skel__scan_string (yyconst char * yy_str ) +{ + + return skel__scan_bytes(yy_str,strlen(yy_str) ); +} +/* %endif */ -#ifndef YY_NO_SCAN_STRING -#ifdef YY_USE_PROTOS -YY_BUFFER_STATE yy_scan_string( yyconst char *yy_str ) -#else -YY_BUFFER_STATE yy_scan_string( yy_str ) -yyconst char *yy_str; -#endif - { - int len; - for ( len = 0; yy_str[len]; ++len ) - ; - - return yy_scan_bytes( yy_str, len ); - } -#endif - - -#ifndef YY_NO_SCAN_BYTES -#ifdef YY_USE_PROTOS -YY_BUFFER_STATE yy_scan_bytes( yyconst char *bytes, int len ) -#else -YY_BUFFER_STATE yy_scan_bytes( bytes, len ) -yyconst char *bytes; -int len; -#endif - { +/* %if-c-only */ +/** Setup the input buffer state to scan the given bytes. The next call to skel_lex() will + * scan from a @e copy of @a bytes. + * @param bytes the byte buffer to scan + * @param len the number of bytes in the buffer pointed to by @a bytes. + * + * @return the newly allocated buffer state object. + */ +YY_BUFFER_STATE skel__scan_bytes (yyconst char * bytes, int len ) +{ YY_BUFFER_STATE b; char *buf; yy_size_t n; int i; - + /* Get memory for full buffer, including space for trailing EOB's. */ n = len + 2; - buf = (char *) yy_flex_alloc( n ); + buf = (char *) skel_alloc(n ); if ( ! buf ) - YY_FATAL_ERROR( "out of dynamic memory in yy_scan_bytes()" ); + YY_FATAL_ERROR( "out of dynamic memory in skel__scan_bytes()" ); for ( i = 0; i < len; ++i ) buf[i] = bytes[i]; buf[len] = buf[len+1] = YY_END_OF_BUFFER_CHAR; - b = yy_scan_buffer( buf, n ); + b = skel__scan_buffer(buf,n ); if ( ! b ) - YY_FATAL_ERROR( "bad buffer in yy_scan_bytes()" ); + YY_FATAL_ERROR( "bad buffer in skel__scan_bytes()" ); /* It's okay to grow etc. this buffer, and we should throw it * away when we're done. @@ -1538,78 +1861,22 @@ int len; b->yy_is_our_buffer = 1; return b; - } -#endif - - -#ifndef YY_NO_PUSH_STATE -#ifdef YY_USE_PROTOS -static void yy_push_state( int new_state ) -#else -static void yy_push_state( new_state ) -int new_state; -#endif - { - if ( yy_start_stack_ptr >= yy_start_stack_depth ) - { - yy_size_t new_size; - - yy_start_stack_depth += YY_START_STACK_INCR; - new_size = yy_start_stack_depth * sizeof( int ); - - if ( ! yy_start_stack ) - yy_start_stack = (int *) yy_flex_alloc( new_size ); - - else - yy_start_stack = (int *) yy_flex_realloc( - (void *) yy_start_stack, new_size ); - - if ( ! yy_start_stack ) - YY_FATAL_ERROR( - "out of memory expanding start-condition stack" ); - } - - yy_start_stack[yy_start_stack_ptr++] = YY_START; - - BEGIN(new_state); - } -#endif - - -#ifndef YY_NO_POP_STATE -static void yy_pop_state() - { - if ( --yy_start_stack_ptr < 0 ) - YY_FATAL_ERROR( "start-condition stack underflow" ); - - BEGIN(yy_start_stack[yy_start_stack_ptr]); - } -#endif - - -#ifndef YY_NO_TOP_STATE -static int yy_top_state() - { - return yy_start_stack[yy_start_stack_ptr - 1]; - } -#endif +} +/* %endif */ #ifndef YY_EXIT_FAILURE #define YY_EXIT_FAILURE 2 #endif -#ifdef YY_USE_PROTOS -static void yy_fatal_error( yyconst char msg[] ) -#else -static void yy_fatal_error( msg ) -char msg[]; -#endif - { - (void) fprintf( stderr, "%s\n", msg ); +/* %if-c-only */ +static void yy_fatal_error (yyconst char* msg ) +{ + (void) fprintf( stderr, "%s\n", msg ); exit( YY_EXIT_FAILURE ); - } - - +} +/* %endif */ +/* %if-c++-only */ +/* %endif */ /* Redefine yyless() so it works in section 3 code. */ @@ -1617,69 +1884,164 @@ char msg[]; #define yyless(n) \ do \ { \ - /* Undo effects of setting up yytext. */ \ - yytext[yyleng] = yy_hold_char; \ - yy_c_buf_p = yytext + n; \ - yy_hold_char = *yy_c_buf_p; \ - *yy_c_buf_p = '\0'; \ - yyleng = n; \ + /* Undo effects of setting up skel_text. */ \ + int yyless_macro_arg = (n); \ + YY_LESS_LINENO(yyless_macro_arg);\ + skel_text[skel_leng] = (yy_hold_char); \ + (yy_c_buf_p) = skel_text + yyless_macro_arg; \ + (yy_hold_char) = *(yy_c_buf_p); \ + *(yy_c_buf_p) = '\0'; \ + skel_leng = yyless_macro_arg; \ } \ while ( 0 ) +/* Accessor methods (get/set functions) to struct members. */ -/* Internal utility routines. */ +/* %if-c-only */ +/* %if-reentrant */ +/* %endif */ + +/** Get the current line number. + * + */ +int skel_get_lineno (void) +{ + + return skel_lineno; +} + +/** Get the input stream. + * + */ +FILE *skel_get_in (void) +{ + return skel_in; +} + +/** Get the output stream. + * + */ +FILE *skel_get_out (void) +{ + return skel_out; +} + +/** Get the length of the current token. + * + */ +int skel_get_leng (void) +{ + return skel_leng; +} + +/** Get the current token. + * + */ + +char *skel_get_text (void) +{ + return skel_text; +} + +/* %if-reentrant */ +/* %endif */ + +/** Set the current line number. + * @param line_number + * + */ +void skel_set_lineno (int line_number ) +{ + + skel_lineno = line_number; +} + +/** Set the input stream. This does not discard the current + * input buffer. + * @param in_str A readable stream. + * + * @see skel__switch_to_buffer + */ +void skel_set_in (FILE * in_str ) +{ + skel_in = in_str ; +} + +void skel_set_out (FILE * out_str ) +{ + skel_out = out_str ; +} + +int skel_get_debug (void) +{ + return skel__flex_debug; +} + +void skel_set_debug (int bdebug ) +{ + skel__flex_debug = bdebug ; +} + +/* %endif */ + +/* %if-reentrant */ +/* %if-bison-bridge */ +/* %endif */ +/* %endif */ + +/* %if-c-only SNIP! this currently causes conflicts with the c++ scanner */ +/* skel_lex_destroy is for both reentrant and non-reentrant scanners. */ +int skel_lex_destroy (void) +{ + + /* Pop the buffer stack, destroying each element. */ + while(YY_CURRENT_BUFFER){ + skel__delete_buffer(YY_CURRENT_BUFFER ); + YY_CURRENT_BUFFER_LVALUE = NULL; + skel_pop_buffer_state(); + } + + /* Destroy the stack itself. */ + skel_free((yy_buffer_stack) ); + (yy_buffer_stack) = NULL; + +/* %if-reentrant */ +/* %endif */ + return 0; +} +/* %endif */ + +/* + * Internal utility routines. + */ #ifndef yytext_ptr -#ifdef YY_USE_PROTOS -static void yy_flex_strncpy( char *s1, yyconst char *s2, int n ) -#else -static void yy_flex_strncpy( s1, s2, n ) -char *s1; -yyconst char *s2; -int n; -#endif - { +static void yy_flex_strncpy (char* s1, yyconst char * s2, int n ) +{ register int i; - for ( i = 0; i < n; ++i ) + for ( i = 0; i < n; ++i ) s1[i] = s2[i]; - } +} #endif #ifdef YY_NEED_STRLEN -#ifdef YY_USE_PROTOS -static int yy_flex_strlen( yyconst char *s ) -#else -static int yy_flex_strlen( s ) -yyconst char *s; -#endif - { +static int yy_flex_strlen (yyconst char * s ) +{ register int n; - for ( n = 0; s[n]; ++n ) + for ( n = 0; s[n]; ++n ) ; return n; - } +} #endif - -#ifdef YY_USE_PROTOS -static void *yy_flex_alloc( yy_size_t size ) -#else -static void *yy_flex_alloc( size ) -yy_size_t size; -#endif - { +void *skel_alloc (yy_size_t size ) +{ return (void *) malloc( size ); - } +} -#ifdef YY_USE_PROTOS -static void *yy_flex_realloc( void *ptr, yy_size_t size ) -#else -static void *yy_flex_realloc( ptr, size ) -void *ptr; -yy_size_t size; -#endif - { +void *skel_realloc (void * ptr, yy_size_t size ) +{ /* The cast to (char *) in the following accommodates both * implementations that use char* generic pointers, and those * that use void* generic pointers. It works with the latter @@ -1688,34 +2050,40 @@ yy_size_t size; * as though doing an assignment. */ return (void *) realloc( (char *) ptr, size ); - } +} -#ifdef YY_USE_PROTOS -static void yy_flex_free( void *ptr ) -#else -static void yy_flex_free( ptr ) -void *ptr; -#endif - { - free( ptr ); - } +void skel_free (void * ptr ) +{ + free( (char *) ptr ); /* see skel_realloc() for (char *) cast */ +} -#if YY_MAIN -int main() - { - yylex(); - return 0; - } +/* %if-tables-serialization definitions */ +/* %define-yytables The name for this specific scanner's tables. */ +#define YYTABLES_NAME "yytables" +/* %endif */ + +/* %ok-for-header */ + +#undef YY_NEW_FILE +#undef YY_FLUSH_BUFFER +#undef yy_set_bol +#undef yy_new_buffer +#undef yy_set_interactive +#undef yytext_ptr +#undef YY_DO_BEFORE_ACTION + +#ifdef YY_DECL_IS_OURS +#undef YY_DECL_IS_OURS +#undef YY_DECL #endif -#line 82 "scan-skel.l" +#line 93 "scan-skel.l" + /*------------------------. | Scan a Bison skeleton. | `------------------------*/ -void scan_skel (FILE *); - void scan_skel (FILE *in) { @@ -1723,5 +2091,6 @@ scan_skel (FILE *in) skel__flex_debug = trace_flag & trace_skeleton; skel_lex (); /* Reclaim Flex's buffers. */ - yy_delete_buffer (YY_CURRENT_BUFFER); + skel__delete_buffer (YY_CURRENT_BUFFER); } + diff --git a/src/bin/bison/src/scan-skel.h b/src/bin/bison/src/scan-skel.h new file mode 100644 index 0000000000..c5b19eaced --- /dev/null +++ b/src/bin/bison/src/scan-skel.h @@ -0,0 +1,41 @@ +/* Scan Bison Skeletons. + + Copyright (C) 2005 Free Software Foundation, Inc. + + This file is part of Bison, the GNU Compiler Compiler. + + Bison 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 2, or (at your option) + any later version. + + Bison 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 Bison; see the file COPYING. If not, write to + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. */ + +void scan_skel (FILE *); + +/* Pacify "make syntax-check". */ +extern FILE *skel_in; +extern FILE *skel_out; +extern int skel__flex_debug; +extern int skel_lineno; + +/* Pacify "gcc -Wmissing-prototypes" when flex 2.5.31 is used. */ +int skel_get_lineno (void); +FILE *skel_get_in (void); +FILE *skel_get_out (void); +int skel_get_leng (void); +char *skel_get_text (void); +void skel_set_lineno (int); +void skel_set_in (FILE *); +void skel_set_out (FILE *); +int skel_get_debug (void); +void skel_set_debug (int); +int skel_lex_destroy (void); diff --git a/src/bin/bison/src/scan-skel.l b/src/bin/bison/src/scan-skel.l index af5226c9dd..a5b5f3f192 100644 --- a/src/bin/bison/src/scan-skel.l +++ b/src/bin/bison/src/scan-skel.l @@ -1,6 +1,6 @@ /* Scan Bison Skeletons. -*- C -*- - Copyright (C) 2001, 2002, 2003 Free Software Foundation, Inc. + Copyright (C) 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc. This file is part of Bison, the GNU Compiler Compiler. @@ -16,8 +16,8 @@ You should have received a copy of the GNU General Public License along with Bison; see the file COPYING. If not, write to the Free - Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - 02111-1307, USA. */ + Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA + 02110-1301, USA. */ %option nodefault noyywrap nounput never-interactive debug %option prefix="skel_" outfile="lex.yy.c" @@ -28,10 +28,10 @@ #include #include +#include "complain.h" #include "getargs.h" #include "files.h" - -int skel_lex (void); +#include "scan-skel.h" #define QPUTS(String) \ fputs (quotearg_style (c_quoting_style, (String)), yyout) @@ -45,22 +45,25 @@ int skel_lex (void); %} "@output ".*\n { - char const *filename = yytext + sizeof "@output " - 1; + char const *file_name = yytext + sizeof "@output " - 1; yytext[yyleng - 1] = '\0'; - if (*filename == '@') + if (*file_name == '@') { - if (strcmp (filename, "@output_header_name@") == 0) - filename = spec_defines_file; - else if (strcmp (filename, "@output_parser_name@") == 0) - filename = parser_file_name; + if (strcmp (file_name, "@output_header_name@") == 0) + file_name = spec_defines_file; + else if (strcmp (file_name, "@output_parser_name@") == 0) + file_name = parser_file_name; else - abort (); + fatal ("invalid token in skeleton: %s", yytext); } - XFREE (outname); - outname = xstrdup (filename); - xfclose (yyout); + if (outname) + { + free (outname); + xfclose (yyout); + } + outname = xstrdup (file_name); yyout = xfopen (outname, "w"); lineno = 1; } @@ -72,21 +75,27 @@ int skel_lex (void); "@oline@" fprintf (yyout, "%d", lineno + 1); "@ofile@" QPUTS (outname); "@output_parser_name@" QPUTS (parser_file_name); -"@output_header_name@" QPUTS (spec_defines_file); +"@output_header_name@" QPUTS (spec_defines_file); -"@" abort (); + /* This pattern must not match more than the previous @ patterns. */ +@[^{}@\n]* fatal ("invalid @ in skeleton: %s", yytext); \n lineno++; ECHO; [^@\n]+ ECHO; -<> xfclose (yyout); free (outname); return EOF; +<> { + if (outname) + { + free (outname); + xfclose (yyout); + } + return EOF; +} %% /*------------------------. | Scan a Bison skeleton. | `------------------------*/ -void scan_skel (FILE *); - void scan_skel (FILE *in) { diff --git a/src/bin/bison/src/state.c b/src/bin/bison/src/state.c index 445c86fd9b..89d0c870b5 100644 --- a/src/bin/bison/src/state.c +++ b/src/bin/bison/src/state.c @@ -16,8 +16,8 @@ You should have received a copy of the GNU General Public License along with Bison; see the file COPYING. If not, write to - the Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. */ #include "system.h" @@ -102,7 +102,7 @@ reductions_new (int num, rule **reds) size_t rules_size = num * sizeof *reds; reductions *res = xmalloc (offsetof (reductions, rules) + rules_size); res->num = num; - res->lookaheads = NULL; + res->look_ahead_tokens = NULL; memcpy (res->rules, reds, rules_size); return res; } @@ -219,26 +219,26 @@ state_errs_set (state *s, int num, symbol **tokens) -/*-----------------------------------------------------. -| Print on OUT all the lookaheads such that S wants to | -| reduce R. | -`-----------------------------------------------------*/ +/*---------------------------------------------------. +| Print on OUT all the look-ahead tokens such that S | +| wants to reduce R. | +`---------------------------------------------------*/ void -state_rule_lookaheads_print (state *s, rule *r, FILE *out) +state_rule_look_ahead_tokens_print (state *s, rule *r, FILE *out) { /* Find the reduction we are handling. */ reductions *reds = s->reductions; int red = state_reduction_find (s, r); /* Print them if there are. */ - if (reds->lookaheads && red != -1) + if (reds->look_ahead_tokens && red != -1) { bitset_iterator biter; int k; char const *sep = ""; fprintf (out, " ["); - BITSET_FOR_EACH (biter, reds->lookaheads[red], k, 0) + BITSET_FOR_EACH (biter, reds->look_ahead_tokens[red], k, 0) { fprintf (out, "%s%s", sep, symbols[k]->tag); sep = ", "; @@ -261,7 +261,7 @@ static struct hash_table *state_table = NULL; static inline bool state_compare (state const *s1, state const *s2) { - int i; + size_t i; if (s1->nitems != s2->nitems) return false; @@ -284,7 +284,7 @@ state_hash (state const *s, size_t tablesize) { /* Add up the state's item numbers to get a hash key. */ size_t key = 0; - int i; + size_t i; for (i = 0; i < s->nitems; ++i) key += s->items[i]; return key % tablesize; diff --git a/src/bin/bison/src/state.h b/src/bin/bison/src/state.h index 2c6c45a54c..440cd466bf 100644 --- a/src/bin/bison/src/state.h +++ b/src/bin/bison/src/state.h @@ -17,8 +17,8 @@ You should have received a copy of the GNU General Public License along with Bison; see the file COPYING. If not, write to - the Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. */ /* These type definitions are used to represent a nondeterministic @@ -46,11 +46,11 @@ Each core contains a vector of NITEMS items which are the indices in the RITEMS vector of the items that are selected in this state. - The two types of actions are shifts/gotos (push the lookahead token + The two types of actions are shifts/gotos (push the look-ahead token and read another/goto to the state designated by a nterm) and reductions (combine the last n things on the stack via a rule, replace them with the symbol that the rule derives, and leave the - lookahead token alone). When the states are generated, these + look-ahead token alone). When the states are generated, these actions are represented in two other lists. Each transition structure describes the possible transitions out @@ -94,8 +94,8 @@ | Numbering states. | `-------------------*/ -typedef short int state_number; -# define STATE_NUMBER_MAXIMUM SHRT_MAX +typedef int state_number; +# define STATE_NUMBER_MAXIMUM INT_MAX /* Be ready to map a state_number to an int. */ static inline int @@ -113,7 +113,7 @@ typedef struct state state; typedef struct { - short int num; + int num; state *states[1]; } transitions; @@ -171,7 +171,7 @@ struct state *transitions_to (transitions *shifts, symbol_number sym); typedef struct { - short int num; + int num; symbol *symbols[1]; } errs; @@ -184,8 +184,8 @@ errs *errs_new (int num, symbol **tokens); typedef struct { - short int num; - bitset *lookaheads; + int num; + bitset *look_ahead_tokens; rule *rules[1]; } reductions; @@ -203,7 +203,7 @@ struct state reductions *reductions; errs *errs; - /* Nonzero if no lookahead is needed to decide what to do in state S. */ + /* Nonzero if no look-ahead is needed to decide what to do in state S. */ char consistent; /* If some conflicts were solved thanks to precedence/associativity, @@ -212,7 +212,7 @@ struct state /* Its items. Must be last, since ITEMS can be arbitrarily large. */ - unsigned short int nitems; + size_t nitems; item_number items[1]; }; @@ -234,9 +234,9 @@ int state_reduction_find (state *s, rule *r); /* Set the errs of STATE. */ void state_errs_set (state *s, int num, symbol **errors); -/* Print on OUT all the lookaheads such that this STATE wants to +/* Print on OUT all the look-ahead tokens such that this STATE wants to reduce R. */ -void state_rule_lookaheads_print (state *s, rule *r, FILE *out); +void state_rule_look_ahead_tokens_print (state *s, rule *r, FILE *out); /* Create/destroy the states hash table. */ void state_hash_new (void); diff --git a/src/bin/bison/src/symlist.c b/src/bin/bison/src/symlist.c index 5b25ac5689..106db46cb2 100644 --- a/src/bin/bison/src/symlist.c +++ b/src/bin/bison/src/symlist.c @@ -1,6 +1,6 @@ /* Lists of symbols for Bison - Copyright (C) 2002 Free Software Foundation, Inc. + Copyright (C) 2002, 2005 Free Software Foundation, Inc. This file is part of Bison, the GNU Compiler Compiler. @@ -16,8 +16,8 @@ You should have received a copy of the GNU General Public License along with Bison; see the file COPYING. If not, write to - the Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. */ #include "system.h" @@ -32,7 +32,7 @@ symbol_list * symbol_list_new (symbol *sym, location loc) { - symbol_list *res = MALLOC (res, 1); + symbol_list *res = xmalloc (sizeof *res); res->next = NULL; res->sym = sym; res->location = loc; @@ -44,6 +44,22 @@ symbol_list_new (symbol *sym, location loc) } +/*------------------. +| Print this list. | +`------------------*/ + +void +symbol_list_print (symbol_list *l, FILE *f) +{ + for (/* Nothing. */; l && l->sym; l = l->next) + { + symbol_print (l->sym, f); + if (l && l->sym) + fputc (' ', f); + } +} + + /*---------------------------------. | Prepend SYM at LOC to the LIST. | `---------------------------------*/ @@ -94,7 +110,7 @@ symbol_list_n_type_name_get (symbol_list *rp, location loc, int n) if (n < 0) { - complain_at (loc, _("invalid $ value")); + complain_at (loc, _("invalid $ value: $%d"), n); return NULL; } @@ -105,7 +121,7 @@ symbol_list_n_type_name_get (symbol_list *rp, location loc, int n) rp = rp->next; if (rp == NULL || rp->sym == NULL) { - complain_at (loc, _("invalid $ value")); + complain_at (loc, _("invalid $ value: $%d"), n); return NULL; } ++i; diff --git a/src/bin/bison/src/symlist.h b/src/bin/bison/src/symlist.h index c88c0cae1c..e4714f6cdc 100644 --- a/src/bin/bison/src/symlist.h +++ b/src/bin/bison/src/symlist.h @@ -1,6 +1,6 @@ /* Lists of symbols for Bison - Copyright (C) 2002 Free Software Foundation, Inc. + Copyright (C) 2002, 2005 Free Software Foundation, Inc. This file is part of Bison, the GNU Compiler Compiler. @@ -16,8 +16,8 @@ You should have received a copy of the GNU General Public License along with Bison; see the file COPYING. If not, write to - the Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. */ #ifndef SYMLIST_H_ # define SYMLIST_H_ @@ -44,6 +44,9 @@ typedef struct symbol_list /* Create a list containing SYM at LOC. */ symbol_list *symbol_list_new (symbol *sym, location loc); +/* Print it. */ +void symbol_list_print (symbol_list *l, FILE *f); + /* Prepend SYM at LOC to the LIST. */ symbol_list *symbol_list_prepend (symbol_list *list, symbol *sym, diff --git a/src/bin/bison/src/symtab.c b/src/bin/bison/src/symtab.c index 2a54205193..8cbfc54f6c 100644 --- a/src/bin/bison/src/symtab.c +++ b/src/bin/bison/src/symtab.c @@ -1,6 +1,6 @@ /* Symbol table manager for Bison. - Copyright (C) 1984, 1989, 2000, 2001, 2002, 2004 Free Software + Copyright (C) 1984, 1989, 2000, 2001, 2002, 2004, 2005 Free Software Foundation, Inc. This file is part of Bison, the GNU Compiler Compiler. @@ -17,8 +17,8 @@ You should have received a copy of the GNU General Public License along with Bison; see the file COPYING. If not, write to - the Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. */ #include "system.h" @@ -48,7 +48,7 @@ location startsymbol_location; static symbol * symbol_new (uniqstr tag, location loc) { - symbol *res = MALLOC (res, 1); + symbol *res = xmalloc (sizeof *res); uniqstr_assert (tag); res->tag = tag; @@ -66,11 +66,46 @@ symbol_new (uniqstr tag, location loc) res->alias = NULL; res->class = unknown_sym; + if (nsyms == SYMBOL_NUMBER_MAXIMUM) + fatal (_("too many symbols in input grammar (limit is %d)"), + SYMBOL_NUMBER_MAXIMUM); nsyms++; return res; } +/*-----------------. +| Print a symbol. | +`-----------------*/ + +#define SYMBOL_ATTR_PRINT(Attr) \ + if (s->Attr) \ + fprintf (f, " %s { %s }", #Attr, s->Attr) + +void +symbol_print (symbol *s, FILE *f) +{ + fprintf (f, "\"%s\"", s->tag); + SYMBOL_ATTR_PRINT (type_name); + SYMBOL_ATTR_PRINT (destructor); + SYMBOL_ATTR_PRINT (printer); +} + +#undef SYMBOL_ATTR_PRINT + +/*------------------------------------------------------------------. +| Complain that S's WHAT is redeclared at SECOND, and was first set | +| at FIRST. | +`------------------------------------------------------------------*/ + +static void +redeclaration (symbol* s, const char *what, location first, location second) +{ + complain_at (second, _("%s redeclaration for %s"), what, s->tag); + complain_at (first, _("first declaration")); +} + + /*-----------------------------------------------------------------. | Set the TYPE_NAME associated with SYM. Does nothing if passed 0 | | as TYPE_NAME. | @@ -82,9 +117,10 @@ symbol_type_set (symbol *sym, uniqstr type_name, location loc) if (type_name) { if (sym->type_name) - complain_at (loc, _("type redeclaration for %s"), sym->tag); + redeclaration (sym, "%type", sym->type_location, loc); uniqstr_assert (type_name); sym->type_name = type_name; + sym->type_location = loc; } } @@ -94,13 +130,12 @@ symbol_type_set (symbol *sym, uniqstr type_name, location loc) `------------------------------------------------------------------*/ void -symbol_destructor_set (symbol *sym, char *destructor, location loc) +symbol_destructor_set (symbol *sym, const char *destructor, location loc) { if (destructor) { if (sym->destructor) - complain_at (loc, _("%s redeclaration for %s"), - "%destructor", sym->tag); + redeclaration (sym, "%destructor", sym->destructor_location, loc); sym->destructor = destructor; sym->destructor_location = loc; } @@ -112,13 +147,12 @@ symbol_destructor_set (symbol *sym, char *destructor, location loc) `---------------------------------------------------------------*/ void -symbol_printer_set (symbol *sym, char *printer, location loc) +symbol_printer_set (symbol *sym, const char *printer, location loc) { if (printer) { if (sym->printer) - complain_at (loc, _("%s redeclaration for %s"), - "%printer", sym->tag); + redeclaration (sym, "%printer", sym->destructor_location, loc); sym->printer = printer; sym->printer_location = loc; } @@ -136,9 +170,10 @@ symbol_precedence_set (symbol *sym, int prec, assoc a, location loc) if (a != undef_assoc) { if (sym->prec != 0) - complain_at (loc, _("redefining precedence of %s"), sym->tag); + redeclaration (sym, assoc_to_string (a), sym->prec_location, loc); sym->prec = prec; sym->assoc = a; + sym->prec_location = loc; } /* Only terminals have a precedence. */ @@ -230,10 +265,10 @@ symbol_make_alias (symbol *sym, symbol *symval, location loc) { if (symval->alias) warn_at (loc, _("symbol `%s' used more than once as a literal string"), - symval->tag); + symval->tag); else if (sym->alias) warn_at (loc, _("symbol `%s' given more than one literal string"), - sym->tag); + sym->tag); else { symval->class = token_sym; @@ -258,45 +293,60 @@ symbol_make_alias (symbol *sym, symbol *symval, location loc) | associativity. | `---------------------------------------------------------*/ -static inline bool +static inline void symbol_check_alias_consistency (symbol *this) { - /* Check only those who _are_ the aliases. */ - if (this->alias && this->user_token_number == USER_NUMBER_ALIAS) - { - if (this->prec != this->alias->prec) - { - if (this->prec != 0 && this->alias->prec != 0) - complain_at (this->alias->location, - _("conflicting precedences for %s and %s"), - this->tag, this->alias->tag); - if (this->prec != 0) - this->alias->prec = this->prec; - else - this->prec = this->alias->prec; - } + symbol *alias = this; + symbol *orig = this->alias; - if (this->assoc != this->alias->assoc) - { - if (this->assoc != undef_assoc && this->alias->assoc != undef_assoc) - complain_at (this->alias->location, - _("conflicting associativities for %s (%s) and %s (%s)"), - this->tag, assoc_to_string (this->assoc), - this->alias->tag, assoc_to_string (this->alias->assoc)); - if (this->assoc != undef_assoc) - this->alias->assoc = this->assoc; - else - this->assoc = this->alias->assoc; - } + /* Check only those that _are_ the aliases. */ + if (!(this->alias && this->user_token_number == USER_NUMBER_ALIAS)) + return; + + if (orig->type_name != alias->type_name) + { + if (orig->type_name) + symbol_type_set (alias, orig->type_name, orig->type_location); + else + symbol_type_set (orig, alias->type_name, alias->type_location); + } + + + if (orig->destructor || alias->destructor) + { + if (orig->destructor) + symbol_destructor_set (alias, orig->destructor, + orig->destructor_location); + else + symbol_destructor_set (orig, alias->destructor, + alias->destructor_location); + } + + if (orig->printer || alias->printer) + { + if (orig->printer) + symbol_printer_set (alias, orig->printer, orig->printer_location); + else + symbol_printer_set (orig, alias->printer, alias->printer_location); + } + + if (alias->prec || orig->prec) + { + if (orig->prec) + symbol_precedence_set (alias, orig->prec, orig->assoc, + orig->prec_location); + else + symbol_precedence_set (orig, alias->prec, alias->assoc, + alias->prec_location); } - return true; } static bool symbol_check_alias_consistency_processor (void *this, void *null ATTRIBUTE_UNUSED) { - return symbol_check_alias_consistency (this); + symbol_check_alias_consistency (this); + return true; } @@ -444,8 +494,7 @@ symbol_get (const char *key, location loc) symbol probe; symbol *entry; - /* Keep the symbol in a printable form. */ - key = uniqstr_new (quotearg_style (escape_quoting_style, key)); + key = uniqstr_new (key); probe.tag = key; entry = hash_lookup (symbol_table, &probe); @@ -560,7 +609,8 @@ symbols_token_translations_init (void) max_user_token_number = this->user_token_number; } - CALLOC (token_translations, max_user_token_number + 1); + token_translations = xnmalloc (max_user_token_number + 1, + sizeof *token_translations); /* Initialize all entries for literal tokens to 2, the internal token number for $undefined, which represents all invalid inputs. @@ -579,7 +629,7 @@ symbols_token_translations_init (void) void symbols_pack (void) { - CALLOC (symbols, nsyms); + symbols = xcalloc (nsyms, sizeof *symbols); symbols_do (symbol_check_alias_consistency_processor, NULL); symbols_do (symbol_pack_processor, NULL); diff --git a/src/bin/bison/src/symtab.h b/src/bin/bison/src/symtab.h index 42c8ffb82a..0f87c224fc 100644 --- a/src/bin/bison/src/symtab.h +++ b/src/bin/bison/src/symtab.h @@ -1,6 +1,6 @@ /* Definitions for symtab.c and callers, part of Bison. - Copyright (C) 1984, 1989, 1992, 2000, 2001, 2002, 2004 + Copyright (C) 1984, 1989, 1992, 2000, 2001, 2002, 2004, 2005 Free Software Foundation, Inc. This file is part of Bison, the GNU Compiler Compiler. @@ -17,8 +17,8 @@ You should have received a copy of the GNU General Public License along with Bison; see the file COPYING. If not, write to - the Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. */ #ifndef SYMTAB_H_ # define SYMTAB_H_ @@ -41,11 +41,14 @@ typedef enum /* Internal token numbers. */ -typedef short int symbol_number; -#define SYMBOL_NUMBER_MAXIMUM SHRT_MAX +typedef int symbol_number; +#define SYMBOL_NUMBER_MAXIMUM INT_MAX typedef struct symbol symbol; + +/* When extending this structure, be sure to complete + symbol_check_alias_consistency. */ struct symbol { /* The key, name of the symbol. */ @@ -55,13 +58,19 @@ struct symbol /* Its %type and associated printer and destructor. */ uniqstr type_name; - char *destructor; + location type_location; + + /* Does not own the memory. */ + const char *destructor; location destructor_location; - char *printer; + + /* Does not own the memory. */ + const char *printer; location printer_location; symbol_number number; - short int prec; + location prec_location; + int prec; assoc assoc; int user_token_number; @@ -84,6 +93,8 @@ struct symbol /* Undefined internal token number. */ #define NUMBER_UNDEFINED (-1) +/* Print a symbol (for debugging). */ +void symbol_print (symbol *s, FILE *f); /* Fetch (or create) the symbol associated to KEY. */ symbol *symbol_get (const char *key, location loc); @@ -100,10 +111,10 @@ void symbol_make_alias (symbol *sym, symbol *symval, location loc); void symbol_type_set (symbol *sym, uniqstr type_name, location loc); /* Set the DESTRUCTOR associated with SYM. */ -void symbol_destructor_set (symbol *sym, char *destructor, location loc); +void symbol_destructor_set (symbol *sym, const char *destructor, location loc); /* Set the PRINTER associated with SYM. */ -void symbol_printer_set (symbol *sym, char *printer, location loc); +void symbol_printer_set (symbol *sym, const char *printer, location loc); /* Set the PRECEDENCE associated with SYM. Ensure that SYMBOL is a terminal. Do nothing if invoked with UNDEF_ASSOC as ASSOC. */ diff --git a/src/bin/bison/src/system.h b/src/bin/bison/src/system.h index 62640c5cc9..755a75cb39 100644 --- a/src/bin/bison/src/system.h +++ b/src/bin/bison/src/system.h @@ -1,6 +1,7 @@ /* System-dependent definitions for Bison. - Copyright (C) 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc. + Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005 Free Software + Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -14,7 +15,7 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, - Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #ifndef BISON_SYSTEM_H #define BISON_SYSTEM_H @@ -54,9 +55,6 @@ typedef size_t uintptr_t; #endif #include -#define CALLOC(P, N) ((P) = xcalloc (N, sizeof *(P))) -#define MALLOC(P, N) ((P) = xnmalloc (N, sizeof *(P))) -#define REALLOC(P, N) ((P) = xnrealloc (P, N, sizeof *(P))) /*---------------------. @@ -132,9 +130,9 @@ typedef size_t uintptr_t; | Obstacks. | `-----------*/ -# define obstack_chunk_alloc xmalloc -# define obstack_chunk_free free -# include +#define obstack_chunk_alloc xmalloc +#define obstack_chunk_free free +#include #define obstack_sgrow(Obs, Str) \ obstack_grow (Obs, Str, strlen (Str)) @@ -173,21 +171,13 @@ do { \ | Extensions to use for the output files. | `-----------------------------------------*/ -#ifdef VMS - /* VMS. */ -# define TAB_EXT "_tab" -# define OUTPUT_EXT ".output" -#else /* ! VMS */ -# ifdef MSDOS - /* MS DOS. */ -# define TAB_EXT "_tab" -# define OUTPUT_EXT ".out" -# else /* ! MSDOS */ - /* Standard. */ -# define TAB_EXT ".tab" -# define OUTPUT_EXT ".output" -# endif /* ! MSDOS */ -#endif /* ! VMS */ +#ifndef OUTPUT_EXT +# define OUTPUT_EXT ".output" +#endif + +#ifndef TAB_EXT +# define TAB_EXT ".tab" +#endif #ifndef DEFAULT_TMPDIR # define DEFAULT_TMPDIR "/tmp" @@ -205,7 +195,7 @@ do { \ for (_node = List; _node; _node = _next) \ { \ _next = _node->next; \ - XFREE (_node); \ + free (_node); \ } \ } while (0) diff --git a/src/bin/bison/src/tables.c b/src/bin/bison/src/tables.c index af5a5cb57b..4e99f4add9 100644 --- a/src/bin/bison/src/tables.c +++ b/src/bin/bison/src/tables.c @@ -1,7 +1,7 @@ /* Output the generated parsing program for Bison. - Copyright (C) 1984, 1986, 1989, 1992, 2000, 2001, 2002, 2003, 2004 - Free Software Foundation, Inc. + Copyright (C) 1984, 1986, 1989, 1992, 2000, 2001, 2002, 2003, 2004, + 2005 Free Software Foundation, Inc. This file is part of Bison, the GNU Compiler Compiler. @@ -17,8 +17,8 @@ You should have received a copy of the GNU General Public License along with Bison; see the file COPYING. If not, write to the Free - Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - 02111-1307, USA. */ + Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA + 02110-1301, USA. */ #include "system.h" @@ -42,13 +42,15 @@ Of course vector_number_t ought to be wide enough to contain state_number and symbol_number. */ -typedef short int vector_number; +typedef int vector_number; +#if 0 /* Not currently used. */ static inline vector_number state_number_to_vector_number (state_number s) { return s; } +#endif static inline vector_number symbol_number_to_vector_number (symbol_number sym) @@ -81,11 +83,11 @@ int nvectors; #define BASE_MAXIMUM INT_MAX #define BASE_MINIMUM INT_MIN -static base_number **froms = NULL; -static base_number **tos = NULL; -static unsigned int **conflict_tos = NULL; -static short int *tally = NULL; -static base_number *width = NULL; +static base_number **froms; +static base_number **tos; +static unsigned int **conflict_tos; +static int *tally; +static base_number *width; /* For a given state, N = ACTROW[SYMBOL]: @@ -94,15 +96,15 @@ static base_number *width = NULL; If N = MIN, stands for `raise a syntax error'. If N > 0, stands for `shift SYMBOL and go to n'. If N < 0, stands for `reduce -N'. */ -typedef short int action_number; -#define ACTION_NUMBER_MINIMUM SHRT_MIN +typedef int action_number; +#define ACTION_NUMBER_MINIMUM INT_MIN -static action_number *actrow = NULL; +static action_number *actrow; /* FROMS and TOS are reordered to be compressed. ORDER[VECTOR] is the new vector number of VECTOR. We skip `empty' vectors (i.e., TALLY[VECTOR] = 0), and call these `entries'. */ -static vector_number *order = NULL; +static vector_number *order; static int nentries; base_number *base = NULL; @@ -112,9 +114,9 @@ base_number *base = NULL; base_number base_ninf = 0; static base_number *pos = NULL; -static unsigned int *conflrow = NULL; -unsigned int *conflict_table = NULL; -unsigned int *conflict_list = NULL; +static unsigned int *conflrow; +unsigned int *conflict_table; +unsigned int *conflict_list; int conflict_list_cnt; static int conflict_list_free; @@ -122,8 +124,8 @@ static int conflict_list_free; with more or less the original hard-coded value (which was SHRT_MAX). */ static int table_size = 32768; -base_number *table = NULL; -base_number *check = NULL; +base_number *table; +base_number *check; /* The value used in TABLE to denote explicit syntax errors (%nonassoc), a negative infinite. First defaults to ACTION_NUMBER_MININUM, but in order to keep small tables, renumbered as TABLE_ERROR, which @@ -153,13 +155,15 @@ table_grow (int desired) fprintf (stderr, "growing table and check from: %d to %d\n", old_size, table_size); - REALLOC (table, table_size); - REALLOC (check, table_size); - REALLOC (conflict_table, table_size); + table = xnrealloc (table, table_size, sizeof *table); + conflict_table = xnrealloc (conflict_table, table_size, + sizeof *conflict_table); + check = xnrealloc (check, table_size, sizeof *check); for (/* Nothing. */; old_size < table_size; ++old_size) { table[old_size] = 0; + conflict_table[old_size] = 0; check[old_size] = -1; } } @@ -169,7 +173,7 @@ table_grow (int desired) /*-------------------------------------------------------------------. | For GLR parsers, for each conflicted token in S, as indicated | -| by non-zero entries in CONFLROW, create a list of possible | +| by non-zero entries in CONFLROW, create a list of possible | | reductions that are alternatives to the shift or reduction | | currently recorded for that token in S. Store the alternative | | reductions followed by a 0 in CONFLICT_LIST, updating | @@ -194,7 +198,7 @@ conflict_row (state *s) /* Find all reductions for token J, and record all that do not match ACTROW[J]. */ for (i = 0; i < reds->num; i += 1) - if (bitset_test (reds->lookaheads[i], j) + if (bitset_test (reds->look_ahead_tokens[i], j) && (actrow[j] != rule_number_as_item_number (reds->rules[i]->number))) { @@ -208,6 +212,7 @@ conflict_row (state *s) /* Leave a 0 at the end. */ if (conflict_list_free <= 0) abort (); + conflict_list[conflict_list_cnt] = 0; conflict_list_cnt += 1; conflict_list_free -= 1; } @@ -215,8 +220,8 @@ conflict_row (state *s) /*------------------------------------------------------------------. -| Decide what to do for each type of token if seen as the lookahead | -| token in specified state. The value returned is used as the | +| Decide what to do for each type of token if seen as the | +| look-ahead in specified state. The value returned is used as the | | default action (yydefact) for the state. In addition, ACTROW is | | filled with what to do for each kind of token, index by symbol | | number, with zero meaning do the default action. The value | @@ -224,7 +229,7 @@ conflict_row (state *s) | situation is an error. The parser recognizes this value | | specially. | | | -| This is where conflicts are resolved. The loop over lookahead | +| This is where conflicts are resolved. The loop over look-ahead | | rules considered lower-numbered rules last, and the last rule | | considered that likes a token gets to handle it. | | | @@ -249,17 +254,17 @@ action_row (state *s) for (i = 0; i < ntokens; i++) actrow[i] = conflrow[i] = 0; - if (reds->lookaheads) + if (reds->look_ahead_tokens) { int j; bitset_iterator biter; /* loop over all the rules available here which require - lookahead (in reverse order to give precedence to the first + look-ahead (in reverse order to give precedence to the first rule) */ for (i = reds->num - 1; i >= 0; --i) /* and find each token which the rule finds acceptable to come next */ - BITSET_FOR_EACH (biter, reds->lookaheads[i], j, 0) + BITSET_FOR_EACH (biter, reds->look_ahead_tokens[i], j, 0) { /* and record this rule as the rule to use if that token follows. */ @@ -373,7 +378,7 @@ save_row (state_number s) base_number *sp; base_number *sp1; base_number *sp2; - unsigned int *sp3 IF_LINT (= NULL); + unsigned int *sp3; /* Number of non default actions in S. */ count = 0; @@ -385,9 +390,10 @@ save_row (state_number s) return; /* Allocate non defaulted actions. */ - froms[s] = sp = CALLOC (sp1, count); - tos[s] = CALLOC (sp2, count); - conflict_tos[s] = nondeterministic_parser ? CALLOC (sp3, count) : NULL; + froms[s] = sp = sp1 = xnmalloc (count, sizeof *sp1); + tos[s] = sp2 = xnmalloc (count, sizeof *sp2); + conflict_tos[s] = sp3 = + nondeterministic_parser ? xnmalloc (count, sizeof *sp3) : NULL; /* Store non defaulted actions. */ for (i = 0; i < ntokens; i++) @@ -406,7 +412,7 @@ save_row (state_number s) /*------------------------------------------------------------------. | Figure out the actions for the specified state, indexed by | -| lookahead token type. | +| look-ahead token type. | | | | The YYDEFACT table is output now. The detailed info is saved for | | putting into YYTABLE later. | @@ -421,12 +427,12 @@ token_actions (void) int nconflict = nondeterministic_parser ? conflicts_total_count () : 0; - CALLOC (yydefact, nstates); + yydefact = xnmalloc (nstates, sizeof *yydefact); - CALLOC (actrow, ntokens); - CALLOC (conflrow, ntokens); + actrow = xnmalloc (ntokens, sizeof *actrow); + conflrow = xnmalloc (ntokens, sizeof *conflrow); - CALLOC (conflict_list, 1 + 2 * nconflict); + conflict_list = xnmalloc (1 + 2 * nconflict, sizeof *conflict_list); conflict_list_free = 2 * nconflict; conflict_list_cnt = 1; @@ -471,7 +477,7 @@ token_actions (void) static void save_column (symbol_number sym, state_number default_state) { - int i; + goto_number i; base_number *sp; base_number *sp1; base_number *sp2; @@ -491,8 +497,8 @@ save_column (symbol_number sym, state_number default_state) return; /* Allocate room for non defaulted gotos. */ - froms[symno] = sp = CALLOC (sp1, count); - tos[symno] = CALLOC (sp2, count); + froms[symno] = sp = sp1 = xnmalloc (count, sizeof *sp1); + tos[symno] = sp2 = xnmalloc (count, sizeof *sp2); /* Store the state numbers of the non defaulted gotos. */ for (i = begin; i < end; i++) @@ -512,14 +518,14 @@ save_column (symbol_number sym, state_number default_state) `-------------------------------------------------------------*/ static state_number -default_goto (symbol_number sym, short int state_count[]) +default_goto (symbol_number sym, size_t state_count[]) { state_number s; - int i; + goto_number i; goto_number m = goto_map[sym - ntokens]; goto_number n = goto_map[sym - ntokens + 1]; state_number default_state = -1; - int max = 0; + size_t max = 0; if (m == n) return -1; @@ -554,8 +560,8 @@ static void goto_actions (void) { symbol_number i; - short int *state_count = CALLOC (state_count, nstates); - MALLOC (yydefgoto, nvars); + size_t *state_count = xnmalloc (nstates, sizeof *state_count); + yydefgoto = xnmalloc (nvars, sizeof *yydefgoto); /* For a given nterm I, STATE_COUNT[S] is the number of times there is a GOTO to S on I. */ @@ -751,11 +757,11 @@ pack_table (void) { int i; - CALLOC (base, nvectors); - CALLOC (pos, nentries); - CALLOC (table, table_size); - CALLOC (conflict_table, table_size); - CALLOC (check, table_size); + base = xnmalloc (nvectors, sizeof *base); + pos = xnmalloc (nentries, sizeof *pos); + table = xcalloc (table_size, sizeof *table); + conflict_table = xcalloc (table_size, sizeof *conflict_table); + check = xnmalloc (table_size, sizeof *check); lowzero = 0; high = 0; @@ -810,11 +816,11 @@ tables_generate (void) nvectors = state_number_as_int (nstates) + nvars; - CALLOC (froms, nvectors); - CALLOC (tos, nvectors); - CALLOC (conflict_tos, nvectors); - CALLOC (tally, nvectors); - CALLOC (width, nvectors); + froms = xcalloc (nvectors, sizeof *froms); + tos = xcalloc (nvectors, sizeof *tos); + conflict_tos = xcalloc (nvectors, sizeof *conflict_tos); + tally = xcalloc (nvectors, sizeof *tally); + width = xnmalloc (nvectors, sizeof *width); token_actions (); @@ -823,7 +829,7 @@ tables_generate (void) free (from_state); free (to_state); - CALLOC (order, nvectors); + order = xcalloc (nvectors, sizeof *order); sort_actions (); pack_table (); free (order); @@ -835,7 +841,7 @@ tables_generate (void) { free (froms[i]); free (tos[i]); - XFREE (conflict_tos[i]); + free (conflict_tos[i]); } free (froms); diff --git a/src/bin/bison/src/tables.h b/src/bin/bison/src/tables.h index cda1e67d8c..911917fdfc 100644 --- a/src/bin/bison/src/tables.h +++ b/src/bin/bison/src/tables.h @@ -1,5 +1,5 @@ /* Prepare the LALR and GLR parser tables. - Copyright (C) 2002 Free Software Foundation, Inc. + Copyright (C) 2002, 2004 Free Software Foundation, Inc. This file is part of Bison, the GNU Compiler Compiler. @@ -15,8 +15,8 @@ You should have received a copy of the GNU General Public License along with Bison; see the file COPYING. If not, write to the Free - Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - 02111-1307, USA. */ + Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA + 02110-1301, USA. */ #ifndef TABLES_H_ # define TABLES_H_ @@ -56,7 +56,7 @@ something else to do. YYPACT[S] = index in YYTABLE of the portion describing state S. - The lookahead token's type is used to index that portion to find + The look-ahead token's type is used to index that portion to find out what to do. If the value in YYTABLE is positive, we shift the token and go to diff --git a/src/bin/bison/src/uniqstr.c b/src/bin/bison/src/uniqstr.c index cc5bc68579..f082f338b2 100644 --- a/src/bin/bison/src/uniqstr.c +++ b/src/bin/bison/src/uniqstr.c @@ -1,6 +1,6 @@ /* Keep a unique copy of strings. - Copyright (C) 2002, 2003, 2004 Free Software Foundation, Inc. + Copyright (C) 2002, 2003, 2004, 2005 Free Software Foundation, Inc. This file is part of Bison, the GNU Compiler Compiler. @@ -16,8 +16,8 @@ You should have received a copy of the GNU General Public License along with Bison; see the file COPYING. If not, write to - the Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. */ #include "system.h" @@ -63,7 +63,8 @@ uniqstr_assert (char const *str) { if (!hash_lookup (uniqstrs_table, str)) { - error (0, 0, "not a uniqstr: %s", quotearg (str)); + error (0, 0, + "not a uniqstr: %s", quotearg (str)); abort (); } } diff --git a/src/bin/bison/src/uniqstr.h b/src/bin/bison/src/uniqstr.h index 8f94114109..ab482bebab 100644 --- a/src/bin/bison/src/uniqstr.h +++ b/src/bin/bison/src/uniqstr.h @@ -16,8 +16,8 @@ You should have received a copy of the GNU General Public License along with Bison; see the file COPYING. If not, write to - the Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. */ #ifndef UNIQSTR_H_ # define UNIQSTR_H_ diff --git a/src/bin/bison/src/vcg.c b/src/bin/bison/src/vcg.c index d6ae21f8b8..fa5133888b 100644 --- a/src/bin/bison/src/vcg.c +++ b/src/bin/bison/src/vcg.c @@ -1,6 +1,6 @@ /* VCG description handler for Bison. - Copyright (C) 2001, 2002, 2003 Free Software Foundation, Inc. + Copyright (C) 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc. This file is part of Bison, the GNU Compiler Compiler. @@ -16,8 +16,8 @@ You should have received a copy of the GNU General Public License along with Bison; see the file COPYING. If not, write to - the Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. */ #include "system.h" @@ -59,7 +59,7 @@ new_graph (graph *g) g->y = G_Y; g->folding = G_FOLDING; g->shrink = G_SHRINK; - g->expand = G_EXPAND; + g->stretch = G_STRETCH; g->textmode = G_TEXTMODE; g->shape = G_SHAPE; @@ -85,7 +85,6 @@ new_graph (graph *g) g->classname = G_CLASSNAME; /* No class name association. */ - g->layoutalgorithm = G_LAYOUTALGORITHM; g->layout_downfactor = G_LAYOUT_DOWNFACTOR; g->layout_upfactor = G_LAYOUT_UPFACTOR; g->layout_nearfactor = G_LAYOUT_NEARFACTOR; @@ -149,7 +148,7 @@ new_node (node *n) n->height = N_HEIGHT; /* Also. */ n->shrink = N_SHRINK; - n->expand = N_EXPAND; + n->stretch = N_STRETCH; n->folding = N_FOLDING; /* No explicit default value. */ @@ -204,7 +203,7 @@ new_edge (edge *e) } /*----------------------------------------------. -| Get functions. | +| Get functions. | | Return string corresponding to an enum value. | `----------------------------------------------*/ @@ -274,29 +273,6 @@ get_shape_str (enum shape shape) } } -static const char * -get_layoutalgorithm_str (enum layoutalgorithm layoutalgorithm) -{ - switch (layoutalgorithm) - { - case normal: return "normal"; - case maxdepth: return "maxdepth"; - case mindepth: return "mindepth"; - case maxdepthslow: return "maxdepthslow"; - case mindepthslow: return "mindepthslow"; - case maxdegree: return "maxdegree"; - case mindegree: return "mindegree"; - case maxindegree: return "maxindegree"; - case minindegree: return "minindegree"; - case maxoutdegree: return "maxoutdegree"; - case minoutdegree: return "minoutdegree"; - case minbackward: return "minbackward"; - case dfs: return "dfs"; - case tree: return "tree"; - default: abort (); return NULL; - } -} - static const char * get_decision_str (enum decision decision) { @@ -360,9 +336,10 @@ get_crossing_type_str (enum crossing_type crossing_type) static const char * get_view_str (enum view view) { + /* There is no way with vcg 1.30 to specify a normal view explicitly, + so it is an error here if view == normal_view. */ switch (view) { - case normal_view: return "normal_view"; case cfish: return "cfish"; case pfish: return "pfish"; case fcfish: return "fcfish"; @@ -397,7 +374,7 @@ get_arrowstyle_str (enum arrowstyle arrowstyle) } /*------------------------------. -| Add functions. | +| Add functions. | | Edge and nodes into a graph. | `------------------------------*/ @@ -418,9 +395,7 @@ add_edge (graph *g, edge *e) void add_classname (graph *g, int val, const char *name) { - struct classname *classname; - - MALLOC (classname, 1); + struct classname *classname = xmalloc (sizeof *classname); classname->no = val; classname->name = name; classname->next = g->classname; @@ -430,9 +405,7 @@ add_classname (graph *g, int val, const char *name) void add_infoname (graph *g, int integer, const char *str) { - struct infoname *infoname; - - MALLOC (infoname, 1); + struct infoname *infoname = xmalloc (sizeof *infoname); infoname->integer = integer; infoname->chars = str; infoname->next = g->infoname; @@ -444,9 +417,7 @@ void add_colorentry (graph *g, int color_idx, int red_cp, int green_cp, int blue_cp) { - struct colorentry *ce; - - MALLOC (ce, 1); + struct colorentry *ce = xmalloc (sizeof *ce); ce->color_index = color_idx; ce->red_cp = red_cp; ce->green_cp = green_cp; @@ -565,8 +536,8 @@ output_node (node *n, FILE *fout) if (n->shrink != N_SHRINK) fprintf (fout, "\t\tshrink:\t%d\n", n->shrink); - if (n->expand != N_EXPAND) - fprintf (fout, "\t\texpand:\t%d\n", n->expand); + if (n->stretch != N_STRETCH) + fprintf (fout, "\t\tstretch:\t%d\n", n->stretch); if (n->folding != N_FOLDING) fprintf (fout, "\t\tfolding:\t%d\n", n->folding); @@ -613,8 +584,7 @@ output_edge (edge *e, FILE *fout) fprintf (fout, "\t\tlabel:\t%s\n", quote (e->label)); if (e->linestyle != E_LINESTYLE) - fprintf (fout, "\t\tlinestyle:\t%s\n", - quote (get_linestyle_str (e->linestyle))); + fprintf (fout, "\t\tlinestyle:\t%s\n", get_linestyle_str (e->linestyle)); if (e->thickness != E_THICKNESS) fprintf (fout, "\t\tthickness:\t%d\n", e->thickness); @@ -693,8 +663,8 @@ output_graph (graph *g, FILE *fout) if (g->shrink != G_SHRINK) fprintf (fout, "\tshrink:\t%d\n", g->shrink); - if (g->expand != G_EXPAND) - fprintf (fout, "\texpand:\t%d\n", g->expand); + if (g->stretch != G_STRETCH) + fprintf (fout, "\tstretch:\t%d\n", g->stretch); if (g->textmode != G_TEXTMODE) fprintf (fout, "\ttextmode:\t%s\n", @@ -767,10 +737,6 @@ output_graph (graph *g, FILE *fout) } } - if (g->layoutalgorithm != G_LAYOUTALGORITHM) - fprintf (fout, "\tlayoutalgorithm:\t%s\n", - get_layoutalgorithm_str (g->layoutalgorithm)); - if (g->layout_downfactor != G_LAYOUT_DOWNFACTOR) fprintf (fout, "\tlayout_downfactor:\t%d\n", g->layout_downfactor); if (g->layout_upfactor != G_LAYOUT_UPFACTOR) @@ -842,7 +808,7 @@ output_graph (graph *g, FILE *fout) fprintf (fout, "\tcrossing_optimization:\t%s\n", get_decision_str (g->crossing_optimization)); - if (g->view != G_VIEW) + if (g->view != normal_view) fprintf (fout, "\tview:\t%s\n", get_view_str (g->view)); if (g->edges != G_EDGES) diff --git a/src/bin/bison/src/vcg.h b/src/bin/bison/src/vcg.h index 44d700cb6b..ed356030a7 100644 --- a/src/bin/bison/src/vcg.h +++ b/src/bin/bison/src/vcg.h @@ -1,6 +1,6 @@ /* VCG description handler for Bison. - Copyright (C) 2001, 2002 Free Software Foundation, Inc. + Copyright (C) 2001, 2002, 2005 Free Software Foundation, Inc. This file is part of Bison, the GNU Compiler Compiler. @@ -16,8 +16,8 @@ You should have received a copy of the GNU General Public License along with Bison; see the file COPYING. If not, write to - the Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. */ #ifndef VCG_H_ # define VCG_H_ @@ -102,26 +102,6 @@ struct infoname struct infoname *next; }; -/* Layout Algorithms which can be found in VCG. - Details about each algoithm can be found below. */ -enum layoutalgorithm -{ - normal, - maxdepth, - mindepth, - maxdepthslow, - mindepthslow, - maxdegree, - mindegree, - maxindegree, - minindegree, - maxoutdegree, - minoutdegree, - minbackward, - dfs, - tree -}; - /* VCG decision yes/no. */ enum decision { @@ -232,18 +212,18 @@ struct node int width; int height; - /* shrink, expand gives the shrinking and expanding factor of the + /* shrink, stretch gives the shrinking and stretching factor of the node. The values of the attributes width, height, borderwidth and - the size of the label text is scaled by ((expand=shrink) \Lambda + the size of the label text is scaled by ((stretch=shrink) \Lambda 100) percent. Note that the actual scale value is determined by the scale value of a node relatively to a scale value of the graph, - i.e. if (expand,shrink) = (2,1) for the graph and (expand,shrink) + i.e. if (stretch,shrink) = (2,1) for the graph and (stretch,shrink) = (2,1) for the node of the graph, then the node is scaled by the factor 4 compared to the normal size. The scale value can also be specified by scaling: float. Default are 1,1. */ int shrink; - int expand; + int stretch; /* folding specifies the default folding of the nodes. The folding k (with k ? 0) means that the graph part that is reachable via edges @@ -542,16 +522,16 @@ struct graph Default value is 0 */ int folding; - /* Shrink, expand gives the shrinking and expanding factor for the - graph's representation (default is 1, 1). ((expand=shrink) \Lambda + /* Shrink, stretch gives the shrinking and stretching factor for the + graph's representation (default is 1, 1). ((stretch=shrink) \Lambda 100) is the scaling of the graph in percentage, e.g., - (expand,shrink) = (1,1) or (2,2) or (3,3) : : : is normal size, - (expand,shrink) = (1,2) is half size, (expand,shrink) = (2,1) is + (stretch,shrink) = (1,1) or (2,2) or (3,3) : : : is normal size, + (stretch,shrink) = (1,2) is half size, (stretch,shrink) = (2,1) is double size. For subgraphs, it is also the scaling factor of the summary node. The scaling factor can also be specified by scaling: float (here, scaling 1.0 means normal size). */ int shrink; - int expand; + int stretch; /* textmode specifies the adjustment of the text within the border of a summary node. The possibilities are center, left.justify and @@ -678,34 +658,6 @@ struct graph Default id NULL. */ struct colorentry *colorentry; - /* layoutalgorithm chooses different graph layout algorithms - Possibilities are maxdepth, mindepth, maxdepthslow, mindepthslow, - maxdegree, mindegree, maxindegree, minindegree, maxoutdegree, - minoutdegree, minbackward, dfs and tree. The default algorithm tries - to give all edges the same orientation and is based on the - calculation of strongly connected components. The algorithms that - are based on depth first search are faster. While the simple dfs - does not enforce additionally constraints, the algorithm maxdepth - tries to increase the depth of the layout and the algorithm mindepth - tries to increase the wide of the layout. These algorithms are fast - heuristics. If they are not appropriate, the algorithms maxdepthslow - or mindepthslow also increase the depth or wide, but they are very - slow. The algorithm maxindegree lays out the nodes by scheduling the - nodes with the maximum of incoming edges first, and minindegree lays - out the nodes by scheduling the nodes with the minimum of incoming - edges first. In the same manner work the algorithms maxoutdegree and - minoutdegree for outgoing edges, and maxdegree and mindegree for the - sum of incoming and outgoing edges. These algorithms may have various - effects, and can sometimes be used as replacements of maxdepthslow - or mindepthslow. - - The algorithm minbackward can be used if the graph is acyclic. - The algorithm tree is a specialized method for downward laid out - trees. It is much faster on such tree-like graphs and results in a - balanced layout. - Default is normal. */ - enum layoutalgorithm layoutalgorithm; - /* Layout downfactor, layout upfactor, layout nearfactor The layout algorithm partitions the set of edges into edges pointing upward, edges pointing downward, and edges pointing sidewards. The last type @@ -932,8 +884,8 @@ struct graph int cmin; /* Cmax set the maximal number of interactions for crossing reduction. - This is helpful for speedup the layout process. - Default is infinite. */ + This is helpful for speeding up the layout process. + Default is -1, which represents infinity. */ int cmax; /* Pmin set the minimal number of iterations that is done with the diff --git a/src/bin/bison/src/vcg_defaults.h b/src/bin/bison/src/vcg_defaults.h index 36d49bbb18..78e24b5c79 100644 --- a/src/bin/bison/src/vcg_defaults.h +++ b/src/bin/bison/src/vcg_defaults.h @@ -1,6 +1,6 @@ /* VCG description handler for Bison. - Copyright (C) 2001, 2002 Free Software Foundation, Inc. + Copyright (C) 2001, 2002, 2005 Free Software Foundation, Inc. This file is part of Bison, the GNU Compiler Compiler. @@ -16,8 +16,8 @@ You should have received a copy of the GNU General Public License along with Bison; see the file COPYING. If not, write to - the Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. */ #ifndef VCG_DEFAULTS_H_ # define VCG_DEFAULTS_H_ @@ -43,31 +43,31 @@ # define G_FOLDING 0 # define G_SHRINK 1 -# define G_EXPAND 1 +# define G_STRETCH 1 # define G_TEXTMODE centered # define G_SHAPE box -# define G_VERTICAL_ORDER 0 /* Unspecified for subgraphs. */ -# define G_HORIZONTAL_ORDER 0 /* Unspecified for subgraphs. */ +# define G_VERTICAL_ORDER 0 /* Unspecified for subgraphs. */ +# define G_HORIZONTAL_ORDER 0 /* Unspecified for subgraphs. */ -# define G_XMAX 90 /* Not output */ -# define G_YMAX 90 /* Not output */ +# define G_XMAX 90 /* Not output. */ +# define G_YMAX 90 /* Not output. */ # define G_XBASE 5 # define G_YBASE 5 # define G_XSPACE 20 # define G_YSPACE 70 -# define G_XLSPACE G_XSPACE / 2 /* Not output */ +# define G_XLSPACE (G_XSPACE / 2) /* Not output */ # define G_XRASTER 1 # define G_YRASTER 1 # define G_XLRASTER 1 -# define G_HIDDEN -1 /* No default value. */ +# define G_HIDDEN (-1) /* No default value. */ -# define G_CLASSNAME NULL /* No class name association */ +# define G_CLASSNAME NULL /* No class name association. */ # define G_INFONAME NULL # define G_COLORENTRY NULL @@ -105,7 +105,7 @@ # define G_BMAX 100 # define G_CMIN 0 -# define G_CMAX INT_MAX +# define G_CMAX (-1) /* Infinity */ # define G_PMIN 0 # define G_PMAX 100 # define G_RMIN 0 @@ -119,19 +119,19 @@ # define N_TITLE NULL # define N_LABEL NULL -# define N_LOCX -1 /* Default unspcified */ -# define N_LOCY -1 /* Default unspcified */ +# define N_LOCX (-1) /* Default unspcified */ +# define N_LOCY (-1) /* Default unspcified */ -# define N_VERTICAL_ORDER -1 /* Default unspcified */ -# define N_HORIZONTAL_ORDER -1 /* Default unspcified */ +# define N_VERTICAL_ORDER (-1) /* Default unspcified */ +# define N_HORIZONTAL_ORDER (-1) /* Default unspcified */ -# define N_WIDTH -1 /* We assume that we can't define it now. */ -# define N_HEIGHT -1 /* also. */ +# define N_WIDTH (-1) /* We assume that we can't define it now. */ +# define N_HEIGHT (-1) /* also. */ # define N_SHRINK 1 -# define N_EXPAND 1 +# define N_STRETCH 1 -# define N_FOLDING -1 /* no explicit default value. */ +# define N_FOLDING (-1) /* no explicit default value. */ # define N_SHAPE box # define N_TEXTMODE centered @@ -172,9 +172,9 @@ # define E_PRIORITY 1 -# define E_ANCHOR -1 +# define E_ANCHOR (-1) -# define E_HORIZONTAL_ORDER -1 +# define E_HORIZONTAL_ORDER (-1) # define E_NEXT NULL diff --git a/src/bin/bison/tests/Makefile.am b/src/bin/bison/tests/Makefile.am deleted file mode 100644 index c6bf2feddb..0000000000 --- a/src/bin/bison/tests/Makefile.am +++ /dev/null @@ -1,98 +0,0 @@ -## Process this file with automake to create Makefile.in. - -## Makefile for Bison testsuite. -## Copyright (C) 2000, 2001, 2002, 2003 Free Software Foundation, Inc. - -## This program is free software; you can redistribute it and/or modify -## it under the terms of the GNU General Public License as published by -## the Free Software Foundation; either version 2, 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, write to the Free Software -## Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA -## 02111-1307, USA. - -EXTRA_DIST = $(TESTSUITE_AT) testsuite package.m4 - -DISTCLEANFILES = atconfig $(check_SCRIPTS) -MAINTAINERCLEANFILES = Makefile.in $(TESTSUITE) - -## ------------ ## -## package.m4. ## -## ------------ ## - -$(srcdir)/package.m4: $(top_srcdir)/configure.ac - { \ - echo '# Signature of the current package.'; \ - echo 'm4_define([AT_PACKAGE_NAME], [@PACKAGE_NAME@])'; \ - echo 'm4_define([AT_PACKAGE_TARNAME], [@PACKAGE_TARNAME@])'; \ - echo 'm4_define([AT_PACKAGE_VERSION], [@PACKAGE_VERSION@])'; \ - echo 'm4_define([AT_PACKAGE_STRING], [@PACKAGE_STRING@])'; \ - echo 'm4_define([AT_PACKAGE_BUGREPORT], [@PACKAGE_BUGREPORT@])'; \ - } >$(srcdir)/package.m4 - -## ------------ ## -## Test suite. ## -## ------------ ## - -TESTSUITE_AT = \ - local.at \ - testsuite.at \ - input.at \ - output.at sets.at reduce.at \ - synclines.at headers.at actions.at conflicts.at \ - calc.at \ - torture.at existing.at regression.at \ - cxx-type.at glr-regression.at - -TESTSUITE = $(srcdir)/testsuite - -AUTOTEST = $(AUTOM4TE) --language=autotest -$(TESTSUITE): package.m4 $(TESTSUITE_AT) - $(AUTOTEST) -I $(srcdir) testsuite.at -o $@.tmp - mv $@.tmp $@ - -atconfig: $(top_builddir)/config.status - cd $(top_builddir) && ./config.status tests/$@ - -clean-local: - test ! -f $(TESTSUITE) || $(SHELL) $(TESTSUITE) --clean - -check-local: atconfig atlocal $(TESTSUITE) - $(SHELL) $(TESTSUITE) - -check_SCRIPTS = bison - -# Run the test suite on the *installed* tree. -installcheck-local: - $(SHELL) $(TESTSUITE) AUTOTEST_PATH=$(exec_prefix)/bin - -# Be real mean with it. -.PHONY: maintainer-check-g++ -maintainer-check-g++: $(TESTSUITE) - if test -n "$(VALGRIND)"; then \ - $(TESTSUITE) CC='$(GXX)'; \ - else \ - true; \ - fi - -.PHONY: maintainer-check-posix -maintainer-check-posix: $(TESTSUITE) - $(TESTSUITE) POSIXLY_CORRECT=1 - -.PHONY: maintainer-check-valgrind -maintainer-check-valgrind: $(TESTSUITE) - if test -n "$(VALGRIND)"; then \ - $(TESTSUITE) PREBISON='$(VALGRIND) -q' PREPARSER='$(VALGRIND) -q'; \ - else \ - true; \ - fi - -.PHONY: maintainer-check -maintainer-check: maintainer-check-posix maintainer-check-valgrind maintainer-check-g++ diff --git a/src/bin/bison/tests/Makefile.in b/src/bin/bison/tests/Makefile.in deleted file mode 100644 index e46243ebe2..0000000000 --- a/src/bin/bison/tests/Makefile.in +++ /dev/null @@ -1,411 +0,0 @@ -# Makefile.in generated by automake 1.8.5 from Makefile.am. -# @configure_input@ - -# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, -# 2003, 2004 Free Software Foundation, Inc. -# This Makefile.in is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY, to the extent permitted by law; without -# even the implied warranty of MERCHANTABILITY or FITNESS FOR A -# PARTICULAR PURPOSE. - -@SET_MAKE@ -srcdir = @srcdir@ -top_srcdir = @top_srcdir@ -VPATH = @srcdir@ -pkgdatadir = $(datadir)/@PACKAGE@ -pkglibdir = $(libdir)/@PACKAGE@ -pkgincludedir = $(includedir)/@PACKAGE@ -top_builddir = .. -am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd -INSTALL = @INSTALL@ -install_sh_DATA = $(install_sh) -c -m 644 -install_sh_PROGRAM = $(install_sh) -c -install_sh_SCRIPT = $(install_sh) -c -INSTALL_HEADER = $(INSTALL_DATA) -transform = $(program_transform_name) -NORMAL_INSTALL = : -PRE_INSTALL = : -POST_INSTALL = : -NORMAL_UNINSTALL = : -PRE_UNINSTALL = : -POST_UNINSTALL = : -host_triplet = @host@ -subdir = tests -DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \ - $(srcdir)/atlocal.in $(srcdir)/bison.in -ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -am__aclocal_m4_deps = $(top_srcdir)/m4/alloca.m4 \ - $(top_srcdir)/m4/dirname.m4 $(top_srcdir)/m4/dmalloc.m4 \ - $(top_srcdir)/m4/dos.m4 $(top_srcdir)/m4/error.m4 \ - $(top_srcdir)/m4/exitfail.m4 $(top_srcdir)/m4/extensions.m4 \ - $(top_srcdir)/m4/getopt.m4 $(top_srcdir)/m4/gettext.m4 \ - $(top_srcdir)/m4/gnulib.m4 $(top_srcdir)/m4/hard-locale.m4 \ - $(top_srcdir)/m4/hash.m4 $(top_srcdir)/m4/iconv.m4 \ - $(top_srcdir)/m4/lib-ld.m4 $(top_srcdir)/m4/lib-link.m4 \ - $(top_srcdir)/m4/lib-prefix.m4 $(top_srcdir)/m4/m4.m4 \ - $(top_srcdir)/m4/mbrtowc.m4 $(top_srcdir)/m4/mbstate_t.m4 \ - $(top_srcdir)/m4/mbswidth.m4 $(top_srcdir)/m4/nls.m4 \ - $(top_srcdir)/m4/obstack.m4 $(top_srcdir)/m4/onceonly.m4 \ - $(top_srcdir)/m4/po.m4 $(top_srcdir)/m4/progtest.m4 \ - $(top_srcdir)/m4/quote.m4 $(top_srcdir)/m4/quotearg.m4 \ - $(top_srcdir)/m4/stdbool.m4 $(top_srcdir)/m4/stpcpy.m4 \ - $(top_srcdir)/m4/strndup.m4 $(top_srcdir)/m4/strnlen.m4 \ - $(top_srcdir)/m4/subpipe.m4 $(top_srcdir)/m4/timevar.m4 \ - $(top_srcdir)/m4/unlocked-io.m4 $(top_srcdir)/m4/warning.m4 \ - $(top_srcdir)/m4/xalloc.m4 $(top_srcdir)/m4/xstrndup.m4 \ - $(top_srcdir)/configure.ac -am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ - $(ACLOCAL_M4) -mkinstalldirs = $(SHELL) $(top_srcdir)/config/mkinstalldirs -CONFIG_HEADER = $(top_builddir)/config.h -CONFIG_CLEAN_FILES = atlocal bison -SOURCES = -DIST_SOURCES = -DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) -ACLOCAL = @ACLOCAL@ -ALLOCA = @ALLOCA@ -ALLOCA_H = @ALLOCA_H@ -AMDEP_FALSE = @AMDEP_FALSE@ -AMDEP_TRUE = @AMDEP_TRUE@ -AMTAR = @AMTAR@ -AUTOCONF = @AUTOCONF@ -AUTOHEADER = @AUTOHEADER@ -AUTOM4TE = @AUTOM4TE@ -AUTOMAKE = @AUTOMAKE@ -AWK = @AWK@ -CC = @CC@ -CCDEPMODE = @CCDEPMODE@ -CFLAGS = @CFLAGS@ -CPP = @CPP@ -CPPFLAGS = @CPPFLAGS@ -CXX = @CXX@ -CXXDEPMODE = @CXXDEPMODE@ -CXXFLAGS = @CXXFLAGS@ -CYGPATH_W = @CYGPATH_W@ -DEFS = @DEFS@ -DEPDIR = @DEPDIR@ -ECHO_C = @ECHO_C@ -ECHO_N = @ECHO_N@ -ECHO_T = @ECHO_T@ -EGREP = @EGREP@ -EXEEXT = @EXEEXT@ -GCC = @GCC@ -GMSGFMT = @GMSGFMT@ -HAVE__BOOL = @HAVE__BOOL@ -INSTALL_DATA = @INSTALL_DATA@ -INSTALL_PROGRAM = @INSTALL_PROGRAM@ -INSTALL_SCRIPT = @INSTALL_SCRIPT@ -INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ -INTLLIBS = @INTLLIBS@ -LDFLAGS = @LDFLAGS@ -LEX = @LEX@ -LEXLIB = @LEXLIB@ -LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@ -LIBICONV = @LIBICONV@ -LIBINTL = @LIBINTL@ -LIBOBJS = @LIBOBJS@ -LIBS = @LIBS@ -LTLIBICONV = @LTLIBICONV@ -LTLIBINTL = @LTLIBINTL@ -LTLIBOBJS = @LTLIBOBJS@ -M4 = @M4@ -MAKEINFO = @MAKEINFO@ -MKINSTALLDIRS = @MKINSTALLDIRS@ -MSGFMT = @MSGFMT@ -MSGMERGE = @MSGMERGE@ -O0CFLAGS = @O0CFLAGS@ -OBJEXT = @OBJEXT@ -PACKAGE = @PACKAGE@ -PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ -PACKAGE_NAME = @PACKAGE_NAME@ -PACKAGE_STRING = @PACKAGE_STRING@ -PACKAGE_TARNAME = @PACKAGE_TARNAME@ -PACKAGE_VERSION = @PACKAGE_VERSION@ -PATH_SEPARATOR = @PATH_SEPARATOR@ -POSUB = @POSUB@ -RANLIB = @RANLIB@ -SET_MAKE = @SET_MAKE@ -SHELL = @SHELL@ -STDBOOL_H = @STDBOOL_H@ -STRIP = @STRIP@ -USE_NLS = @USE_NLS@ -VALGRIND = @VALGRIND@ -VERSION = @VERSION@ -WARNING_CFLAGS = @WARNING_CFLAGS@ -WARNING_CXXFLAGS = @WARNING_CXXFLAGS@ -WERROR_CFLAGS = @WERROR_CFLAGS@ -XGETTEXT = @XGETTEXT@ -YACC = @YACC@ -YACC_LIBRARY = @YACC_LIBRARY@ -YACC_SCRIPT = @YACC_SCRIPT@ -ac_ct_CC = @ac_ct_CC@ -ac_ct_CXX = @ac_ct_CXX@ -ac_ct_RANLIB = @ac_ct_RANLIB@ -ac_ct_STRIP = @ac_ct_STRIP@ -am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ -am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ -am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@ -am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@ -am__include = @am__include@ -am__leading_dot = @am__leading_dot@ -am__quote = @am__quote@ -bindir = @bindir@ -build = @build@ -build_alias = @build_alias@ -build_cpu = @build_cpu@ -build_os = @build_os@ -build_vendor = @build_vendor@ -datadir = @datadir@ -exec_prefix = @exec_prefix@ -host = @host@ -host_alias = @host_alias@ -host_cpu = @host_cpu@ -host_os = @host_os@ -host_vendor = @host_vendor@ -includedir = @includedir@ -infodir = @infodir@ -install_sh = @install_sh@ -libdir = @libdir@ -libexecdir = @libexecdir@ -localstatedir = @localstatedir@ -mandir = @mandir@ -mkdir_p = @mkdir_p@ -oldincludedir = @oldincludedir@ -prefix = @prefix@ -program_transform_name = @program_transform_name@ -sbindir = @sbindir@ -sharedstatedir = @sharedstatedir@ -sysconfdir = @sysconfdir@ -target_alias = @target_alias@ -EXTRA_DIST = $(TESTSUITE_AT) testsuite package.m4 -DISTCLEANFILES = atconfig $(check_SCRIPTS) -MAINTAINERCLEANFILES = Makefile.in $(TESTSUITE) -TESTSUITE_AT = \ - local.at \ - testsuite.at \ - input.at \ - output.at sets.at reduce.at \ - synclines.at headers.at actions.at conflicts.at \ - calc.at \ - torture.at existing.at regression.at \ - cxx-type.at glr-regression.at - -TESTSUITE = $(srcdir)/testsuite -AUTOTEST = $(AUTOM4TE) --language=autotest -check_SCRIPTS = bison -all: all-am - -.SUFFIXES: -$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) - @for dep in $?; do \ - case '$(am__configure_deps)' in \ - *$$dep*) \ - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ - && exit 0; \ - exit 1;; \ - esac; \ - done; \ - echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu tests/Makefile'; \ - cd $(top_srcdir) && \ - $(AUTOMAKE) --gnu tests/Makefile -.PRECIOUS: Makefile -Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status - @case '$?' in \ - *config.status*) \ - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ - *) \ - echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ - cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ - esac; - -$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh - -$(top_srcdir)/configure: $(am__configure_deps) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh -$(ACLOCAL_M4): $(am__aclocal_m4_deps) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh -atlocal: $(top_builddir)/config.status $(srcdir)/atlocal.in - cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ -bison: $(top_builddir)/config.status $(srcdir)/bison.in - cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ -uninstall-info-am: -tags: TAGS -TAGS: - -ctags: CTAGS -CTAGS: - - -distdir: $(DISTFILES) - @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ - topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ - list='$(DISTFILES)'; for file in $$list; do \ - case $$file in \ - $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ - $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ - esac; \ - if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ - dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ - if test "$$dir" != "$$file" && test "$$dir" != "."; then \ - dir="/$$dir"; \ - $(mkdir_p) "$(distdir)$$dir"; \ - else \ - dir=''; \ - fi; \ - if test -d $$d/$$file; then \ - if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ - cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ - fi; \ - cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ - else \ - test -f $(distdir)/$$file \ - || cp -p $$d/$$file $(distdir)/$$file \ - || exit 1; \ - fi; \ - done -check-am: all-am - $(MAKE) $(AM_MAKEFLAGS) $(check_SCRIPTS) - $(MAKE) $(AM_MAKEFLAGS) check-local -check: check-am -all-am: Makefile -installdirs: -install: install-am -install-exec: install-exec-am -install-data: install-data-am -uninstall: uninstall-am - -install-am: all-am - @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am - -installcheck: installcheck-am -install-strip: - $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ - install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ - `test -z '$(STRIP)' || \ - echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install -mostlyclean-generic: - -clean-generic: - -distclean-generic: - -rm -f $(CONFIG_CLEAN_FILES) - -test -z "$(DISTCLEANFILES)" || rm -f $(DISTCLEANFILES) - -maintainer-clean-generic: - @echo "This command is intended for maintainers to use" - @echo "it deletes files that may require special tools to rebuild." - -test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES) -clean: clean-am - -clean-am: clean-generic clean-local mostlyclean-am - -distclean: distclean-am - -rm -f Makefile -distclean-am: clean-am distclean-generic - -dvi: dvi-am - -dvi-am: - -html: html-am - -info: info-am - -info-am: - -install-data-am: - -install-exec-am: - -install-info: install-info-am - -install-man: - -installcheck-am: installcheck-local - -maintainer-clean: maintainer-clean-am - -rm -f Makefile -maintainer-clean-am: distclean-am maintainer-clean-generic - -mostlyclean: mostlyclean-am - -mostlyclean-am: mostlyclean-generic - -pdf: pdf-am - -pdf-am: - -ps: ps-am - -ps-am: - -uninstall-am: uninstall-info-am - -.PHONY: all all-am check check-am check-local clean clean-generic \ - clean-local distclean distclean-generic distdir dvi dvi-am \ - html html-am info info-am install install-am install-data \ - install-data-am install-exec install-exec-am install-info \ - install-info-am install-man install-strip installcheck \ - installcheck-am installcheck-local installdirs \ - maintainer-clean maintainer-clean-generic mostlyclean \ - mostlyclean-generic pdf pdf-am ps ps-am uninstall uninstall-am \ - uninstall-info-am - - -$(srcdir)/package.m4: $(top_srcdir)/configure.ac - { \ - echo '# Signature of the current package.'; \ - echo 'm4_define([AT_PACKAGE_NAME], [@PACKAGE_NAME@])'; \ - echo 'm4_define([AT_PACKAGE_TARNAME], [@PACKAGE_TARNAME@])'; \ - echo 'm4_define([AT_PACKAGE_VERSION], [@PACKAGE_VERSION@])'; \ - echo 'm4_define([AT_PACKAGE_STRING], [@PACKAGE_STRING@])'; \ - echo 'm4_define([AT_PACKAGE_BUGREPORT], [@PACKAGE_BUGREPORT@])'; \ - } >$(srcdir)/package.m4 -$(TESTSUITE): package.m4 $(TESTSUITE_AT) - $(AUTOTEST) -I $(srcdir) testsuite.at -o $@.tmp - mv $@.tmp $@ - -atconfig: $(top_builddir)/config.status - cd $(top_builddir) && ./config.status tests/$@ - -clean-local: - test ! -f $(TESTSUITE) || $(SHELL) $(TESTSUITE) --clean - -check-local: atconfig atlocal $(TESTSUITE) - $(SHELL) $(TESTSUITE) - -# Run the test suite on the *installed* tree. -installcheck-local: - $(SHELL) $(TESTSUITE) AUTOTEST_PATH=$(exec_prefix)/bin - -# Be real mean with it. -.PHONY: maintainer-check-g++ -maintainer-check-g++: $(TESTSUITE) - if test -n "$(VALGRIND)"; then \ - $(TESTSUITE) CC='$(GXX)'; \ - else \ - true; \ - fi - -.PHONY: maintainer-check-posix -maintainer-check-posix: $(TESTSUITE) - $(TESTSUITE) POSIXLY_CORRECT=1 - -.PHONY: maintainer-check-valgrind -maintainer-check-valgrind: $(TESTSUITE) - if test -n "$(VALGRIND)"; then \ - $(TESTSUITE) PREBISON='$(VALGRIND) -q' PREPARSER='$(VALGRIND) -q'; \ - else \ - true; \ - fi - -.PHONY: maintainer-check -maintainer-check: maintainer-check-posix maintainer-check-valgrind maintainer-check-g++ -# Tell versions [3.59,3.63) of GNU make to not export all variables. -# Otherwise a system limit (for SysV at least) may be exceeded. -.NOEXPORT: diff --git a/src/bin/bison/tests/actions.at b/src/bin/bison/tests/actions.at deleted file mode 100644 index d97e9164ce..0000000000 --- a/src/bin/bison/tests/actions.at +++ /dev/null @@ -1,560 +0,0 @@ -# Executing Actions. -*- Autotest -*- -# Copyright (C) 2001, 2002, 2003, 2004 Free Software Foundation, Inc. - -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2, 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, write to the Free Software -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA -# 02111-1307, USA. - -AT_BANNER([[User Actions.]]) - -## ------------------ ## -## Mid-rule actions. ## -## ------------------ ## - -AT_SETUP([Mid-rule actions]) - -# Bison once forgot the mid-rule actions. It was because the action -# was attached to the host rule (the one with the mid-rule action), -# instead of being attached to the empty rule dedicated to this -# action. - -AT_DATA_GRAMMAR([[input.y]], -[[%{ -# include -# include - static void yyerror (const char *msg); - static int yylex (void); -# define YYDEBUG 1 -# define YYERROR_VERBOSE 1 -%} -%% -exp: { putchar ('0'); } - '1' { putchar ('1'); } - '2' { putchar ('2'); } - '3' { putchar ('3'); } - '4' { putchar ('4'); } - '5' { putchar ('5'); } - '6' { putchar ('6'); } - '7' { putchar ('7'); } - '8' { putchar ('8'); } - '9' { putchar ('9'); } - { putchar ('\n'); } - ; -%% -static int -yylex (void) -{ - static const char *input = "123456789"; - return *input++; -} - -static void -yyerror (const char *msg) -{ - fprintf (stderr, "%s\n", msg); -} - -int -main (void) -{ - return yyparse (); -} -]]) - -AT_CHECK([bison -d -v -o input.c input.y]) -AT_COMPILE([input]) -AT_PARSER_CHECK([./input], 0, -[[0123456789 -]]) - -AT_CLEANUP - - - -## ---------------------- ## -## Actions after errors. ## -## ---------------------- ## - -AT_SETUP([Actions after errors]) - - - -AT_DATA_GRAMMAR([[input.y]], -[[%{ -#include -#include - -static int yylex (void); -static void yyerror (char const *); - -#define YYDEBUG 1 -%} -%union { int ival; } -%type 'x' ';' thing line input - -%% -input: - /* Nothing. */ - { - $$ = 0; - printf ("input (%d): /* Nothing */\n", $$); - } -| line input /* Right recursive to load the stack so that popping at - EOF can be exercised. */ - { - $$ = 2; - printf ("input (%d): line (%d) input (%d)\n", $$, $1, $2); - } -; - -line: - thing thing thing ';' - { - $$ = $1; - printf ("line (%d): thing (%d) thing (%d) thing (%d) ';' (%d)\n", - $$, $1, $2, $3, $4); - } -| thing thing ';' - { - $$ = $1; - printf ("line (%d): thing (%d) thing (%d) ';' (%d)\n", $$, $1, $2, $3); - } -| thing ';' - { - $$ = $1; - printf ("line (%d): thing (%d) ';' (%d)\n", $$, $1, $2); - } -| error ';' - { - $$ = -1; - printf ("line (%d): error ';' (%d)\n", $$, $2); - } -; - -thing: - 'x' - { - $$ = $1; - printf ("thing (%d): 'x' (%d)\n", $$, $1); - } -; -%% -static size_t counter; - -static int -yylex (void) -{ - static char const input[] = - { - /* Exercise the discarding of stack top and input until `error' - can be reduced. */ - 'x', 'x', 'x', 'x', 'x', 'x', ';', - - /* Load the stack and provoke an error that cannot be caught by - the grammar, to check that the stack is cleared. */ - 'x', 'x', ';', - 'x', ';', - 'y' - }; - - if (counter < sizeof input) - { - yylval.ival = counter; - printf ("sending: '%c' (%d)\n", input[counter], yylval.ival); - return input[counter++]; - } - else - { - printf ("sending: EOF\n"); - return EOF; - } -} - -static void -yyerror (char const *msg) -{ - printf ("%lu: %s\n", (unsigned long int) counter, msg); -} - -int -main (void) -{ - yydebug = !!getenv ("YYDEBUG"); - return yyparse (); -} -]]) - -AT_CHECK([bison -o input.c input.y]) -AT_COMPILE([input]) -AT_PARSER_CHECK([./input], 1, -[[sending: 'x' (0) -thing (0): 'x' (0) -sending: 'x' (1) -thing (1): 'x' (1) -sending: 'x' (2) -thing (2): 'x' (2) -sending: 'x' (3) -4: syntax error -sending: 'x' (4) -sending: 'x' (5) -sending: ';' (6) -line (-1): error ';' (6) -sending: 'x' (7) -thing (7): 'x' (7) -sending: 'x' (8) -thing (8): 'x' (8) -sending: ';' (9) -line (7): thing (7) thing (8) ';' (9) -sending: 'x' (10) -thing (10): 'x' (10) -sending: ';' (11) -line (10): thing (10) ';' (11) -sending: 'y' (12) -13: syntax error -sending: EOF -]]) - -AT_CLEANUP - - - -## ---------------- ## -## Exotic Dollars. ## -## ---------------- ## - -AT_SETUP([Exotic Dollars]) - -AT_DATA_GRAMMAR([[input.y]], -[[%{ -# include -# include - static void yyerror (const char *msg); - static int yylex (void); -# define YYDEBUG 1 -# define YYERROR_VERBOSE 1 -%} - -%union -{ - int val; -}; - -%type a_1 a_2 a_5 - sum_of_the_five_previous_values - -%% -exp: a_1 a_2 { $$ = 3; } { $$ = $3 + 1; } a_5 - sum_of_the_five_previous_values - { - printf ("%d\n", $6); - } -; -a_1: { $$ = 1; }; -a_2: { $$ = 2; }; -a_5: { $$ = 5; }; - -sum_of_the_five_previous_values: - { - $$ = $0 + $-1 + $-2 + $-3 + $-4; - } -; - -%% -static int -yylex (void) -{ - return EOF; -} - -static void -yyerror (const char *msg) -{ - fprintf (stderr, "%s\n", msg); -} - -int -main (void) -{ - return yyparse (); -} -]]) - -AT_CHECK([bison -d -v -o input.c input.y]) -AT_COMPILE([input]) -AT_PARSER_CHECK([./input], 0, -[[15 -]]) - -AT_CLEANUP - - - -## -------------------------- ## -## Printers and Destructors. ## -## -------------------------- ## - -# _AT_CHECK_PRINTER_AND_DESTRUCTOR($1, $2, $3, $4, BISON-DIRECTIVE) -# ----------------------------------------------------------------- -m4_define([_AT_CHECK_PRINTER_AND_DESTRUCTOR], -[m4_if([$1$2$3], $[1]$[2]$[3], [], - [m4_fatal([$0: Invalid arguments: $@])])dnl - -AT_SETUP([Printers and Destructors: $5]) - -# Make sure complex $n work. - -AT_BISON_OPTION_PUSHDEFS([$5]) -AT_DATA_GRAMMAR([[input.y]], -[[$5 -%{ -#include -#include -]AT_LALR1_CC_IF( - [#define RANGE(Location) (Location).begin.line, (Location).end.line], - [#define RANGE(Location) (Location).first_line, (Location).last_line]) -[%} -%error-verbose -%debug -%verbose -%locations -%union -{ - int ival; -} - -%{ -]AT_LALR1_CC_IF([typedef yy::Location YYLTYPE;]) -[static int yylex (]AT_LEX_FORMALS[); -]AT_LALR1_CC_IF([], [static void yyerror (const char *msg);]) -[%} - -%type 'x' ';' thing line input - -%printer { fprintf (yyoutput, "%d@%d-%d", $$, RANGE (@$)); } - input line thing 'x' - -%destructor - { printf ("Freeing nterm input (%d@%d-%d)\n", $$, RANGE (@$)); } - input - -%destructor - { printf ("Freeing nterm line (%d@%d-%d)\n", $$, RANGE (@$)); } - line - -%destructor - { printf ("Freeing nterm thing (%d@%d-%d)\n", $$, RANGE (@$)); } - thing - -%destructor - { printf ("Freeing token 'x' (%d@%d-%d)\n", $$, RANGE (@$)); } - 'x' - -%% -input: - /* Nothing. */ - { - $$ = 0; - printf ("input (%d@%d-%d): /* Nothing */\n", $$, RANGE (@$)); - } -| line input /* Right recursive to load the stack so that popping at - EOF can be exercised. */ - { - $$ = 2; - printf ("input (%d@%d-%d): line (%d@%d-%d) input (%d@%d-%d)\n", - $$, RANGE (@$), $1, RANGE (@1), $2, RANGE (@2)); - } -; - -line: - thing thing thing ';' - { - $$ = $1; - printf ("line (%d@%d-%d): thing (%d@%d-%d) thing (%d@%d-%d) thing (%d@%d-%d) ';' (%d@%d-%d)\n", - $$, RANGE (@$), $1, RANGE (@1), $2, RANGE (@2), - $3, RANGE (@3), $4, RANGE (@4)); - } -| thing thing ';' - { - $$ = $1; - printf ("line (%d@%d-%d): thing (%d@%d-%d) thing (%d@%d-%d) ';' (%d@%d-%d)\n", - $$, RANGE (@$), $1, RANGE (@1), $2, RANGE (@2), $3, RANGE (@3)); - } -| thing ';' - { - $$ = $1; - printf ("line (%d@%d-%d): thing (%d@%d-%d) ';' (%d@%d-%d)\n", - $$, RANGE (@$), $1, RANGE (@1), $2, RANGE (@2)); - } -| error ';' - { - $$ = -1; - printf ("line (%d@%d-%d): error (@%d-%d) ';' (%d@%d-%d)\n", - $$, RANGE (@$), RANGE (@1), $2, RANGE (@2)); - } -; - -thing: - 'x' - { - $$ = $1; - printf ("thing (%d@%d-%d): 'x' (%d@%d-%d)\n", - $$, RANGE (@$), $1, RANGE (@1)); - } -; -%% -static int -yylex (]AT_LEX_FORMALS[) -{ - static const unsigned int input[] = - { - /* Exercise the discarding of stack top and input until `error' - can be reduced. */ - 'x', 'x', 'x', 'x', 'x', 'x', ';', - - /* Load the stack and provoke an error that cannot be caught by - the grammar, to check that the stack is cleared. */ - 'x', 'x', ';', - 'x', ';', - 'y' - }; - static unsigned int counter = 0; - - if (counter < (sizeof(input) / sizeof (input[0]))) - { -]AT_LALR1_CC_IF( -[ yylval->ival = counter; - /* As in BASIC, line numbers go from 10 to 10. */ - yylloc->begin.line = yylloc->begin.column = 10 * counter; - yylloc->end.line = yylloc->end.column = yylloc->begin.line + 9; - printf ("sending: '%c' (%d@%d-%d)\n", - input[[counter]], yylval->ival, RANGE (*yylloc)); - return (int) input[[counter++]]; -], -[ yylval.ival = counter; - /* As in BASIC, line numbers go from 10 to 10. */ - yylloc.first_line = yylloc.first_column = 10 * counter; - yylloc.last_line = yylloc.last_column = yylloc.first_line + 9; - printf ("sending: '%c' (%d@%d-%d)\n", - input[[counter]], yylval.ival, RANGE (yylloc)); - return (int) input[[counter++]]; -])[ - } - else - { - printf ("sending: EOF\n"); - return EOF; - } -} - -]AT_LALR1_CC_IF( -[/* Currently, print_ is required in C++. */ -void -yy::Parser::print_ () -{ - std::cerr << location; -} - -/* A C++ error reporting function. */ -void -yy::Parser::error_ () -{ - printf ("%d-%d: %s\n", RANGE (location), message.c_str()); -} - -static bool yydebug; -int -yyparse () -{ - yy::Parser parser (yydebug, yy::Location::Location ()); - return parser.parse (); -} -], -[static void -yyerror (const char *msg) -{ - printf ("%d-%d: %s\n", RANGE (yylloc), msg); -}])[ - -int -main (void) -{ - yydebug = !!getenv ("YYDEBUG"); - if (yyparse ()) - { - printf ("Parsing FAILED.\n"); - exit (1); - } - printf ("Successful parse.\n"); - return 0; -} -]]) - -AT_CHECK([bison -o input.c input.y]) -AT_LALR1_CC_IF([AT_COMPILE_CXX([input])], - [AT_COMPILE([input])]) -AT_PARSER_CHECK([./input], 1, -[[sending: 'x' (0@0-9) -thing (0@0-9): 'x' (0@0-9) -sending: 'x' (1@10-19) -thing (1@10-19): 'x' (1@10-19) -sending: 'x' (2@20-29) -thing (2@20-29): 'x' (2@20-29) -sending: 'x' (3@30-39) -30-39: syntax error, unexpected 'x', expecting ';' -Freeing nterm thing (2@20-29) -Freeing nterm thing (1@10-19) -Freeing nterm thing (0@0-9) -Freeing token 'x' (3@30-39) -sending: 'x' (4@40-49) -Freeing token 'x' (4@40-49) -sending: 'x' (5@50-59) -Freeing token 'x' (5@50-59) -sending: ';' (6@60-69) -line (-1@0-69): error (@0-59) ';' (6@60-69) -sending: 'x' (7@70-79) -thing (7@70-79): 'x' (7@70-79) -sending: 'x' (8@80-89) -thing (8@80-89): 'x' (8@80-89) -sending: ';' (9@90-99) -line (7@70-99): thing (7@70-79) thing (8@80-89) ';' (9@90-99) -sending: 'x' (10@100-109) -thing (10@100-109): 'x' (10@100-109) -sending: ';' (11@110-119) -line (10@100-119): thing (10@100-109) ';' (11@110-119) -sending: 'y' (12@120-129) -120-129: syntax error, unexpected $undefined, expecting $end or 'x' -sending: EOF -Freeing nterm line (10@100-119) -Freeing nterm line (7@70-99) -Freeing nterm line (-1@0-69) -Parsing FAILED. -]]) - -AT_CLEANUP -]) - - -# AT_CHECK_PRINTER_AND_DESTRUCTOR([BISON-OPTIONS]) -# ------------------------------------------------ -# Produce `calc.y'. -m4_define([AT_CHECK_PRINTER_AND_DESTRUCTOR], -[_AT_CHECK_PRINTER_AND_DESTRUCTOR($[1], $[2], $[3], $[4], [$1]) -]) - - -AT_CHECK_PRINTER_AND_DESTRUCTOR() -AT_CHECK_PRINTER_AND_DESTRUCTOR([%locations %defines %skeleton "lalr1.cc"]) - -# FIXME. This test case fails. -#AT_CHECK_PRINTER_AND_DESTRUCTOR([%glr-parser]) diff --git a/src/bin/bison/tests/atlocal.in b/src/bin/bison/tests/atlocal.in deleted file mode 100644 index ac647c0e2b..0000000000 --- a/src/bin/bison/tests/atlocal.in +++ /dev/null @@ -1,27 +0,0 @@ -# @configure_input@ -*- shell-script -*- -# Configurable variable values for Bison test suite. -# Copyright (C) 2000, 2001, 2002, 2003 Free Software Foundation, Inc. - -# We need a C compiler. -CC='@CC@' - -# We want no optimization. -CFLAGS='@O0CFLAGS@ @WARNING_CFLAGS@ @WERROR_CFLAGS@' - -# We need `config.h'. -CPPFLAGS="-DHAVE_CONFIG_H=1 -I$abs_top_builddir @CPPFLAGS@" - -# Is the compiler GCC? -GCC='@GCC@' - -# The GCC C++ compiler. -CXX='@CXX@' - -# We want no optimization with C++, too. -CXXFLAGS='@O0CFLAGS@ @WARNING_CXXFLAGS@ @WERROR_CFLAGS@' - -# Are special link options needed? -LDFLAGS='@LDFLAGS@' - -# Are special libraries needed? -LIBS='@LIBS@' diff --git a/src/bin/bison/tests/bison.in b/src/bin/bison/tests/bison.in deleted file mode 100644 index 6d0de7e341..0000000000 --- a/src/bin/bison/tests/bison.in +++ /dev/null @@ -1,8 +0,0 @@ -#! @SHELL@ -# @configure_input@ -# Wrapper around a non installed bison to make it work as an installed one. - -# We want to use the files shipped with Bison. -BISON_PKGDATADIR='@abs_top_srcdir@/data' -export BISON_PKGDATADIR -exec $PREBISON '@abs_top_builddir@/src/bison' ${1+"$@"} diff --git a/src/bin/bison/tests/calc.at b/src/bin/bison/tests/calc.at deleted file mode 100644 index b2f8578348..0000000000 --- a/src/bin/bison/tests/calc.at +++ /dev/null @@ -1,633 +0,0 @@ -# Simple calculator. -*- Autotest -*- -# Copyright (C) 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc. - -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2, 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, write to the Free Software -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA -# 02111-1307, USA. - -## ---------------------------------------------------- ## -## Compile the grammar described in the documentation. ## -## ---------------------------------------------------- ## - - -# ------------------------- # -# Helping Autotest macros. # -# ------------------------- # - - -# _AT_DATA_CALC_Y($1, $2, $3, [BISON-DIRECTIVES]) -# ----------------------------------------------- -# Produce `calc.y'. Don't call this macro directly, because it contains -# some occurrences of `$1' etc. which will be interpreted by m4. So -# you should call it with $1, $2, and $3 as arguments, which is what -# AT_DATA_CALC_Y does. -m4_define([_AT_DATA_CALC_Y], -[m4_if([$1$2$3], $[1]$[2]$[3], [], - [m4_fatal([$0: Invalid arguments: $@])])dnl -AT_DATA_GRAMMAR([calc.y], -[[/* Infix notation calculator--calc */ -]$4[ -%{ -#include - -#include -#include -#if HAVE_UNISTD_H -# include -#else -# undef alarm -# define alarm(seconds) /* empty */ -#endif -#include - -/* Exercise pre-prologue dependency to %union. */ -typedef int semantic_value; - -static semantic_value global_result = 0; -static int global_count = 0; -%} - -/* Exercise %union. */ -%union -{ - semantic_value ival; -}; - -%{ -static int power (int base, int exponent); -]AT_LALR1_CC_IF([typedef yy::Location YYLTYPE;], -[/* yyerror receives the location if: - - %location & %pure & %glr - - %location & %pure & %yacc & %parse-param. */ -static void yyerror (AT_YYERROR_ARG_LOC_IF([YYLTYPE *yylloc, ]) - AT_PARAM_IF([semantic_value *result, int *count, ]) - const char *s - );])[ -static int yylex (]AT_LEX_FORMALS[); -static int yygetc (]AT_LEX_FORMALS[); -static void yyungetc (]AT_LEX_PRE_FORMALS[ int c); -%} - -/* Bison Declarations */ -%token CALC_EOF 0 "end of input" -%token NUM "number" -%type exp - -%nonassoc '=' /* comparison */ -%left '-' '+' -%left '*' '/' -%left NEG /* negation--unary minus */ -%right '^' /* exponentiation */ - -/* Grammar follows */ -%% -input: - line -| input line { ]AT_PARAM_IF([++*count; ++global_count;])[ } -; - -line: - '\n' -| exp '\n' { ]AT_PARAM_IF([*result = global_result = $1;])[ } -; - -exp: - NUM { $$ = $1; } -| exp '=' exp - { - if ($1 != $3) - fprintf (stderr, "calc: error: %d != %d\n", $1, $3); - $$ = $1; - } -| exp '+' exp { $$ = $1 + $3; } -| exp '-' exp { $$ = $1 - $3; } -| exp '*' exp { $$ = $1 * $3; } -| exp '/' exp { $$ = $1 / $3; } -| '-' exp %prec NEG { $$ = -$2; } -| exp '^' exp { $$ = power ($1, $3); } -| '(' exp ')' { $$ = $2; } -| '(' error ')' { $$ = 1111; } -| '!' { YYERROR; } -| '-' error { YYERROR; } -; -%% -/* The input. */ -static FILE *yyin; - -]AT_LALR1_CC_IF( -[/* Currently, print_ is required in C++. */ -void -yy::Parser::print_ () -{ -AT_LOCATION_IF([ - std::cerr << location;]) -} - -/* A C++ error reporting function. */ -void -yy::Parser::error_ () -{ - std::cerr << AT_LOCATION_IF([location << ": " << ])message << std::endl; -} - -int -yyparse (AT_PARAM_IF([semantic_value *result, int *count])) -{ - yy::Parser parser (!!YYDEBUG[]AT_LOCATION_IF([, yy::Location::Location ()])AT_PARAM_IF([, result, count])); - return parser.parse (); -} -], -[static void -yyerror (AT_YYERROR_ARG_LOC_IF([YYLTYPE *yylloc, ]) - AT_PARAM_IF([semantic_value *result, int *count, ]) - const char *s) -{ -AT_PARAM_IF([(void) result; (void) count;]) -AT_YYERROR_SEES_LOC_IF([ - fprintf (stderr, "%d.%d", - AT_LOC.first_line, AT_LOC.first_column); - if (AT_LOC.first_line != AT_LOC.last_line) - fprintf (stderr, "-%d.%d", - AT_LOC.last_line, AT_LOC.last_column - 1); - else if (AT_LOC.first_column != AT_LOC.last_column - 1) - fprintf (stderr, "-%d", - AT_LOC.last_column - 1); - fprintf (stderr, ": ");]) - fprintf (stderr, "%s\n", s); -}])[ - - -]AT_LOCATION_IF([ -static YYLTYPE last_yylloc; -])[ -static int -yygetc (]AT_LEX_FORMALS[) -{ - int res = getc (yyin); - ]AT_USE_LEX_ARGS[; -]AT_LOCATION_IF([ - last_yylloc = AT_LOC; - if (res == '\n') - { -AT_LALR1_CC_IF( -[ AT_LOC.end.line++; - AT_LOC.end.column = 0;], -[ AT_LOC.last_line++; - AT_LOC.last_column = 0;]) - } - else -AT_LALR1_CC_IF( -[ AT_LOC.end.column++;], -[ AT_LOC.last_column++;]) -])[ - return res; -} - - -static void -yyungetc (]AT_LEX_PRE_FORMALS[ int c) -{ - ]AT_USE_LEX_ARGS[; -]AT_LOCATION_IF([ - /* Wrong when C == `\n'. */ - AT_LOC = last_yylloc; -])[ - ungetc (c, yyin); -} - -static int -read_signed_integer (]AT_LEX_FORMALS[) -{ - int c = yygetc (]AT_LEX_ARGS[); - int sign = 1; - int n = 0; - - ]AT_USE_LEX_ARGS[; - if (c == '-') - { - c = yygetc (]AT_LEX_ARGS[); - sign = -1; - } - - while (isdigit (c)) - { - n = 10 * n + (c - '0'); - c = yygetc (]AT_LEX_ARGS[); - } - - yyungetc (]AT_LEX_PRE_ARGS[ c); - - return sign * n; -} - - - -/*---------------------------------------------------------------. -| Lexical analyzer returns an integer on the stack and the token | -| NUM, or the ASCII character read if not a number. Skips all | -| blanks and tabs, returns 0 for EOF. | -`---------------------------------------------------------------*/ - -static int -yylex (]AT_LEX_FORMALS[) -{ - static int init = 1; - int c; - - if (init) - { - init = 0; -]AT_LALR1_CC_IF([], -[AT_LOCATION_IF([ - AT_LOC.last_column = 0; - AT_LOC.last_line = 1; -])])[ - } - -]AT_LOCATION_IF([AT_LALR1_CC_IF( -[ AT_LOC.begin = AT_LOC.end;], -[ AT_LOC.first_column = AT_LOC.last_column; - AT_LOC.first_line = AT_LOC.last_line; -])])[ - - /* Skip white space. */ - while ((c = yygetc (]AT_LEX_ARGS[)) == ' ' || c == '\t') - { -]AT_LOCATION_IF([AT_LALR1_CC_IF( -[ AT_LOC.begin = AT_LOC.end;], -[ AT_LOC.first_column = AT_LOC.last_column; - AT_LOC.first_line = AT_LOC.last_line; -])])[ - } - - /* process numbers */ - if (c == '.' || isdigit (c)) - { - yyungetc (]AT_LEX_PRE_ARGS[ c); - ]AT_VAL[.ival = read_signed_integer (]AT_LEX_ARGS[); - return NUM; - } - - /* Return end-of-file. */ - if (c == EOF) - return CALC_EOF; - - /* Return single chars. */ - return c; -} - -static int -power (int base, int exponent) -{ - int res = 1; - if (exponent < 0) - exit (1); - for (/* Niente */; exponent; --exponent) - res *= base; - return res; -} - - -int -main (int argc, const char **argv) -{ - semantic_value result = 0; - int count = 0; - int status; - - alarm (10); - if (argc == 2) - yyin = fopen (argv[1], "r"); - else - yyin = stdin; - - if (!yyin) - { - perror (argv[1]); - exit (1); - } - -]AT_LALR1_CC_IF([], [m4_bmatch([$4], [%debug], -[ yydebug = 1;])])[ - status = yyparse (]AT_PARAM_IF([&result, &count])[); - if (global_result != result) - abort (); - if (global_count != count) - abort (); - return status; -} -]]) -])# _AT_DATA_CALC_Y - - -# AT_DATA_CALC_Y([BISON-OPTIONS]) -# ------------------------------- -# Produce `calc.y'. -m4_define([AT_DATA_CALC_Y], -[_AT_DATA_CALC_Y($[1], $[2], $[3], [$1]) -]) - - - -# _AT_CHECK_CALC(BISON-OPTIONS, INPUT, [NUM-STDERR-LINES = 0]) -# ------------------------------------------------------------ -# Run `calc' on INPUT and expect no STDOUT nor STDERR. -# -# If BISON-OPTIONS contains `%debug' but not `%glr-parser', then -# NUM-STDERR-LINES is the number of expected lines on stderr. -# -# We don't count GLR's traces yet, since its traces are somewhat -# different from LALR's. -m4_define([_AT_CHECK_CALC], -[AT_DATA([[input]], -[[$2 -]]) -AT_PARSER_CHECK([./calc input], 0, [], [stderr]) -m4_bmatch([$1], - [%debug.*%glr\|%glr.*%debug], - [], - [%debug], - [AT_CHECK([wc -l at-stderr -mv at-stderr stderr -# 2. Create the reference error message. -AT_DATA([[expout]], -[$5 -]) -# 3. If locations are not used, remove them. -AT_YYERROR_SEES_LOC_IF([], -[[sed 's/^[-0-9.]*: //' expout >at-expout -mv at-expout expout]]) -# 4. If error-verbose is not used, strip the`, unexpected....' part. -m4_bmatch([$1], [%error-verbose], [], -[[sed 's/syntax error, .*$/syntax error/' expout >at-expout -mv at-expout expout]]) -# 5. Check -AT_CHECK([cat stderr], 0, [expout]) -]) - - -# AT_CHECK_CALC([BISON-OPTIONS [, EXPECTED-TO-FAIL]]) -# ------------------------------ -# Start a testing chunk which compiles `calc' grammar with -# BISON-OPTIONS, and performs several tests over the parser. -# However, if EXPECTED-TO-FAIL is nonempty, this test is expected to fail. -m4_define([AT_CHECK_CALC], -[# We use integers to avoid dependencies upon the precision of doubles. -AT_SETUP([Calculator $1]) - -m4_ifval([$2], [AT_CHECK([exit 77])]) - -AT_BISON_OPTION_PUSHDEFS([$1]) - -AT_DATA_CALC_Y([$1]) - -# Specify the output files to avoid problems on different file systems. -AT_CHECK([bison -o calc.c calc.y]) - -AT_LALR1_CC_IF([AT_COMPILE_CXX([calc])], - [AT_COMPILE([calc])]) - -# Test the priorities. -_AT_CHECK_CALC([$1], -[1 + 2 * 3 = 7 -1 + 2 * -3 = -5 - --1^2 = -1 -(-1)^2 = 1 - ----1 = -1 - -1 - 2 - 3 = -4 -1 - (2 - 3) = 2 - -2^2^3 = 256 -(2^2)^3 = 64], - [486]) - -# Some syntax errors. -_AT_CHECK_CALC_ERROR([$1], [1], [0 0], [11], - [1.2: syntax error, unexpected "number"]) -_AT_CHECK_CALC_ERROR([$1], [1], [1//2], [15], - [1.2: syntax error, unexpected '/', expecting "number" or '-' or '(' or '!']) -_AT_CHECK_CALC_ERROR([$1], [1], [error], [4], - [1.0: syntax error, unexpected $undefined]) -_AT_CHECK_CALC_ERROR([$1], [1], [1 = 2 = 3], [22], - [1.6: syntax error, unexpected '=']) -_AT_CHECK_CALC_ERROR([$1], [1], - [ -+1], - [14], - [2.0: syntax error, unexpected '+']) -# Exercise error messages with EOF: work on an empty file. -_AT_CHECK_CALC_ERROR([$1], [1], [/dev/null], [4], - [1.0: syntax error, unexpected "end of input"]) - -# Exercise the error token: without it, we die at the first error, -# hence be sure to -# -# - have several errors which exercise different shift/discardings -# - (): nothing to pop, nothing to discard -# - (1 + 1 + 1 +): a lot to pop, nothing to discard -# - (* * *): nothing to pop, a lot to discard -# - (1 + 2 * *): some to pop and discard -# -# - test the action associated to `error' -# -# - check the lookahead that triggers an error is not discarded -# when we enter error recovery. Below, the lookahead causing the -# first error is ")", which is needed to recover from the error and -# produce the "0" that triggers the "0 != 1" error. -# -_AT_CHECK_CALC_ERROR([$1], [0], - [() + (1 + 1 + 1 +) + (* * *) + (1 * 2 * *) = 1], - [156], -[1.1: syntax error, unexpected ')', expecting "number" or '-' or '(' or '!' -1.17: syntax error, unexpected ')', expecting "number" or '-' or '(' or '!' -1.22: syntax error, unexpected '*', expecting "number" or '-' or '(' or '!' -1.40: syntax error, unexpected '*', expecting "number" or '-' or '(' or '!' -calc: error: 4444 != 1]) - -# The same, but this time exercising explicitly triggered syntax errors. -# POSIX says the lookahead causing the error should not be discarded. -_AT_CHECK_CALC_ERROR([$1], [0], [(!) + (0 0) = 1], [62], -[1.9: syntax error, unexpected "number" -calc: error: 2222 != 1]) -_AT_CHECK_CALC_ERROR([$1], [0], [(- *) + (0 0) = 1], [70], -[1.3: syntax error, unexpected '*', expecting "number" or '-' or '(' or '!' -1.11: syntax error, unexpected "number" -calc: error: 2222 != 1]) -AT_BISON_OPTION_POPDEFS - -AT_CLEANUP -])# AT_CHECK_CALC - - - - -# ------------------------ # -# Simple LALR Calculator. # -# ------------------------ # - -AT_BANNER([[Simple LALR Calculator.]]) - -# AT_CHECK_CALC_LALR([BISON-OPTIONS]) -# ----------------------------------- -# Start a testing chunk which compiles `calc' grammar with -# BISON-OPTIONS, and performs several tests over the parser. -m4_define([AT_CHECK_CALC_LALR], -[AT_CHECK_CALC($@)]) - -AT_CHECK_CALC_LALR() - -AT_CHECK_CALC_LALR([%defines]) -AT_CHECK_CALC_LALR([%locations]) -AT_CHECK_CALC_LALR([%name-prefix="calc"]) -AT_CHECK_CALC_LALR([%verbose]) -AT_CHECK_CALC_LALR([%yacc]) -AT_CHECK_CALC_LALR([%error-verbose]) - -AT_CHECK_CALC_LALR([%pure-parser %locations]) -AT_CHECK_CALC_LALR([%error-verbose %locations]) - -AT_CHECK_CALC_LALR([%error-verbose %locations %defines %name-prefix="calc" %verbose %yacc]) - -AT_CHECK_CALC_LALR([%debug]) -AT_CHECK_CALC_LALR([%error-verbose %debug %locations %defines %name-prefix="calc" %verbose %yacc]) - -AT_CHECK_CALC_LALR([%pure-parser %error-verbose %debug %locations %defines %name-prefix="calc" %verbose %yacc]) - -AT_CHECK_CALC_LALR([%pure-parser %error-verbose %debug %locations %defines %name-prefix="calc" %verbose %yacc %parse-param {semantic_value *result} %parse-param {int *count}]) - - -# ----------------------- # -# Simple GLR Calculator. # -# ----------------------- # - -AT_BANNER([[Simple GLR Calculator.]]) - -# AT_CHECK_CALC_GLR([BISON-OPTIONS]) -# ---------------------------------- -# Start a testing chunk which compiles `calc' grammar with -# BISON-OPTIONS and %glr-parser, and performs several tests over the parser. -m4_define([AT_CHECK_CALC_GLR], -[AT_CHECK_CALC([%glr-parser] $@)]) - - -AT_CHECK_CALC_GLR() - -AT_CHECK_CALC_GLR([%defines]) -AT_CHECK_CALC_GLR([%locations]) -AT_CHECK_CALC_GLR([%name-prefix="calc"]) -AT_CHECK_CALC_GLR([%verbose]) -AT_CHECK_CALC_GLR([%yacc]) -AT_CHECK_CALC_GLR([%error-verbose]) - -AT_CHECK_CALC_GLR([%pure-parser %locations]) -AT_CHECK_CALC_GLR([%error-verbose %locations]) - -AT_CHECK_CALC_GLR([%error-verbose %locations %defines %name-prefix="calc" %verbose %yacc]) - -AT_CHECK_CALC_GLR([%debug]) -AT_CHECK_CALC_GLR([%error-verbose %debug %locations %defines %name-prefix="calc" %verbose %yacc]) - -AT_CHECK_CALC_GLR([%pure-parser %error-verbose %debug %locations %defines %name-prefix="calc" %verbose %yacc]) - -AT_CHECK_CALC_GLR([%pure-parser %error-verbose %debug %locations %defines %name-prefix="calc" %verbose %yacc %parse-param {semantic_value *result} %parse-param {int *count}]) - - -# ----------------------------- # -# Simple LALR1 C++ Calculator. # -# ----------------------------- # - -AT_BANNER([[Simple LALR1 C++ Calculator.]]) - -# AT_CHECK_CALC_LALR1_CC([BISON-OPTIONS]) -# --------------------------------------- -# Start a testing chunk which compiles `calc' grammar with -# the C++ skeleton, and performs several tests over the parser. -m4_define([AT_CHECK_CALC_LALR1_CC], -[AT_CHECK_CALC([%skeleton "lalr1.cc"] $@)]) - -# AT_CHECK_CALC_LALR1_CC() - -AT_CHECK_CALC_LALR1_CC([%defines %locations]) - -AT_CHECK_CALC_LALR1_CC([%defines]) -# AT_CHECK_CALC_LALR1_CC([%locations]) -# AT_CHECK_CALC_LALR1_CC([%name-prefix="calc"]) -# AT_CHECK_CALC_LALR1_CC([%verbose]) -# AT_CHECK_CALC_LALR1_CC([%yacc]) -# AT_CHECK_CALC_LALR1_CC([%error-verbose]) - -# AT_CHECK_CALC_LALR1_CC([%pure-parser %locations]) -# AT_CHECK_CALC_LALR1_CC([%error-verbose %locations]) - -AT_CHECK_CALC_LALR1_CC([%error-verbose %locations %defines %name-prefix="calc" %verbose %yacc]) - -# AT_CHECK_CALC_LALR1_CC([%debug]) -AT_CHECK_CALC_LALR1_CC([%error-verbose %debug %locations %defines %name-prefix="calc" %verbose %yacc]) - -AT_CHECK_CALC_LALR1_CC([%pure-parser %error-verbose %debug %locations %defines %name-prefix="calc" %verbose %yacc]) - -AT_CHECK_CALC_LALR1_CC([%pure-parser %error-verbose %debug %locations %defines %name-prefix="calc" %verbose %yacc %parse-param {semantic_value *result} %parse-param {int *count}]) diff --git a/src/bin/bison/tests/conflicts.at b/src/bin/bison/tests/conflicts.at deleted file mode 100644 index 381b49ef99..0000000000 --- a/src/bin/bison/tests/conflicts.at +++ /dev/null @@ -1,621 +0,0 @@ -# Exercising Bison on conflicts. -*- Autotest -*- - -# Copyright (C) 2002, 2003, 2004 Free Software Foundation, Inc. - -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2, 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, write to the Free Software -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA -# 02111-1307, USA. - -AT_BANNER([[Conflicts.]]) - - -## ---------------- ## -## S/R in initial. ## -## ---------------- ## - -# I once hacked Bison in such a way that it lost its reductions on the -# initial state (because it was confusing it with the last state). It -# took me a while to strip down my failures to this simple case. So -# make sure it finds the s/r conflict below. - -AT_SETUP([S/R in initial]) - -AT_DATA([[input.y]], -[[%expect 1 -%% -exp: e 'e'; -e: 'e' | /* Nothing. */; -]]) - -AT_CHECK([bison -o input.c input.y], 0, [], -[[input.y:4.9: warning: rule never reduced because of conflicts: e: /* empty */ -]]) - -AT_CLEANUP - - -## ------------------- ## -## %nonassoc and eof. ## -## ------------------- ## - -AT_SETUP([%nonassoc and eof]) - -AT_DATA_GRAMMAR([input.y], -[[ -%{ -#include -#include - -#define YYERROR_VERBOSE 1 -static void -yyerror (const char *msg) -{ - fprintf (stderr, "%s\n", msg); - exit (1); -} - -/* The current argument. */ -static const char *input = NULL; - -static int -yylex (void) -{ - /* No token stands for end of file. */ - if (input && *input) - return *input++; - else - return 0; -} - -%} - -%nonassoc '<' '>' - -%% -expr: expr '<' expr - | expr '>' expr - | '0' - ; -%% -int -main (int argc, const char *argv[]) -{ - if (argc > 1) - input = argv[1]; - return yyparse (); -} -]]) - -# Specify the output files to avoid problems on different file systems. -AT_CHECK([bison -o input.c input.y]) -AT_COMPILE([input]) - -AT_PARSER_CHECK([./input '0<0']) -# FIXME: This is an actual bug, but a new one, in the sense that -# no one has ever spotted it! The messages are *wrong*: there should -# be nothing there, it should be expected eof. -AT_PARSER_CHECK([./input '0<0<0'], [1], [], - [syntax error, unexpected '<', expecting '<' or '>' -]) - -AT_PARSER_CHECK([./input '0>0']) -AT_PARSER_CHECK([./input '0>0>0'], [1], [], - [syntax error, unexpected '>', expecting '<' or '>' -]) - -AT_PARSER_CHECK([./input '0<0>0'], [1], [], - [syntax error, unexpected '>', expecting '<' or '>' -]) - -AT_CLEANUP - - - -## ------------------------- ## -## Unresolved SR Conflicts. ## -## ------------------------- ## - -AT_SETUP([Unresolved SR Conflicts]) - -AT_KEYWORDS([report]) - -AT_DATA([input.y], -[[%token NUM OP -%% -exp: exp OP exp | NUM; -]]) - -AT_CHECK([bison -o input.c --report=all input.y], 0, [], -[input.y: conflicts: 1 shift/reduce -]) - -# Check the contents of the report. -AT_CHECK([cat input.output], [], -[[State 5 conflicts: 1 shift/reduce - - -Grammar - - 0 $accept: exp $end - - 1 exp: exp OP exp - 2 | NUM - - -Terminals, with rules where they appear - -$end (0) 0 -error (256) -NUM (258) 2 -OP (259) 1 - - -Nonterminals, with rules where they appear - -$accept (5) - on left: 0 -exp (6) - on left: 1 2, on right: 0 1 - - -state 0 - - 0 $accept: . exp $end - 1 exp: . exp OP exp - 2 | . NUM - - NUM shift, and go to state 1 - - exp go to state 2 - - -state 1 - - 2 exp: NUM . - - $default reduce using rule 2 (exp) - - -state 2 - - 0 $accept: exp . $end - 1 exp: exp . OP exp - - $end shift, and go to state 3 - OP shift, and go to state 4 - - -state 3 - - 0 $accept: exp $end . - - $default accept - - -state 4 - - 1 exp: . exp OP exp - 1 | exp OP . exp - 2 | . NUM - - NUM shift, and go to state 1 - - exp go to state 5 - - -state 5 - - 1 exp: exp . OP exp [$end, OP] - 1 | exp OP exp . [$end, OP] - - OP shift, and go to state 4 - - OP [reduce using rule 1 (exp)] - $default reduce using rule 1 (exp) -]]) - -AT_CLEANUP - - - -## ----------------------- ## -## Resolved SR Conflicts. ## -## ----------------------- ## - -AT_SETUP([Resolved SR Conflicts]) - -AT_KEYWORDS([report]) - -AT_DATA([input.y], -[[%token NUM OP -%left OP -%% -exp: exp OP exp | NUM; -]]) - -AT_CHECK([bison -o input.c --report=all input.y]) - -# Check the contents of the report. -AT_CHECK([cat input.output], [], -[[Grammar - - 0 $accept: exp $end - - 1 exp: exp OP exp - 2 | NUM - - -Terminals, with rules where they appear - -$end (0) 0 -error (256) -NUM (258) 2 -OP (259) 1 - - -Nonterminals, with rules where they appear - -$accept (5) - on left: 0 -exp (6) - on left: 1 2, on right: 0 1 - - -state 0 - - 0 $accept: . exp $end - 1 exp: . exp OP exp - 2 | . NUM - - NUM shift, and go to state 1 - - exp go to state 2 - - -state 1 - - 2 exp: NUM . - - $default reduce using rule 2 (exp) - - -state 2 - - 0 $accept: exp . $end - 1 exp: exp . OP exp - - $end shift, and go to state 3 - OP shift, and go to state 4 - - -state 3 - - 0 $accept: exp $end . - - $default accept - - -state 4 - - 1 exp: . exp OP exp - 1 | exp OP . exp - 2 | . NUM - - NUM shift, and go to state 1 - - exp go to state 5 - - -state 5 - - 1 exp: exp . OP exp [$end, OP] - 1 | exp OP exp . [$end, OP] - - $default reduce using rule 1 (exp) - - Conflict between rule 1 and token OP resolved as reduce (%left OP). -]]) - -AT_CLEANUP - - -## -------------------------------- ## -## Defaulted Conflicted Reduction. ## -## -------------------------------- ## - -# When there are RR conflicts, some rules are disabled. Usually it is -# simply displayed as: -# -# $end reduce using rule 3 (num) -# $end [reduce using rule 4 (id)] -# -# But when `reduce 3' is the default action, we'd produce: -# -# $end [reduce using rule 4 (id)] -# $default reduce using rule 3 (num) -# -# In this precise case (a reduction is masked by the default -# reduction), we make the `reduce 3' explicit: -# -# $end reduce using rule 3 (num) -# $end [reduce using rule 4 (id)] -# $default reduce using rule 3 (num) -# -# Maybe that's not the best display, but then, please propose something -# else. - -AT_SETUP([Defaulted Conflicted Reduction]) -AT_KEYWORDS([report]) - -AT_DATA([input.y], -[[%% -exp: num | id; -num: '0'; -id : '0'; -%% -]]) - -AT_CHECK([bison -o input.c --report=all input.y], 0, [], -[[input.y: conflicts: 1 reduce/reduce -input.y:4.6-8: warning: rule never reduced because of conflicts: id: '0' -]]) - -# Check the contents of the report. -AT_CHECK([cat input.output], [], -[[Rules never reduced - - 4 id: '0' - - -State 1 conflicts: 1 reduce/reduce - - -Grammar - - 0 $accept: exp $end - - 1 exp: num - 2 | id - - 3 num: '0' - - 4 id: '0' - - -Terminals, with rules where they appear - -$end (0) 0 -'0' (48) 3 4 -error (256) - - -Nonterminals, with rules where they appear - -$accept (4) - on left: 0 -exp (5) - on left: 1 2, on right: 0 -num (6) - on left: 3, on right: 1 -id (7) - on left: 4, on right: 2 - - -state 0 - - 0 $accept: . exp $end - 1 exp: . num - 2 | . id - 3 num: . '0' - 4 id: . '0' - - '0' shift, and go to state 1 - - exp go to state 2 - num go to state 3 - id go to state 4 - - -state 1 - - 3 num: '0' . [$end] - 4 id: '0' . [$end] - - $end reduce using rule 3 (num) - $end [reduce using rule 4 (id)] - $default reduce using rule 3 (num) - - -state 2 - - 0 $accept: exp . $end - - $end shift, and go to state 5 - - -state 3 - - 1 exp: num . - - $default reduce using rule 1 (exp) - - -state 4 - - 2 exp: id . - - $default reduce using rule 2 (exp) - - -state 5 - - 0 $accept: exp $end . - - $default accept -]]) - -AT_CLEANUP - - - - -## -------------------- ## -## %expect not enough. ## -## -------------------- ## - -AT_SETUP([%expect not enough]) - -AT_DATA([input.y], -[[%token NUM OP -%expect 0 -%% -exp: exp OP exp | NUM; -]]) - -AT_CHECK([bison -o input.c input.y], 0, [], -[input.y: conflicts: 1 shift/reduce -input.y: warning: expected 0 shift/reduce conflicts -]) -AT_CLEANUP - - -## --------------- ## -## %expect right. ## -## --------------- ## - -AT_SETUP([%expect right]) - -AT_DATA([input.y], -[[%token NUM OP -%expect 1 -%% -exp: exp OP exp | NUM; -]]) - -AT_CHECK([bison -o input.c input.y]) -AT_CLEANUP - - -## ------------------ ## -## %expect too much. ## -## ------------------ ## - -AT_SETUP([%expect too much]) - -AT_DATA([input.y], -[[%token NUM OP -%expect 2 -%% -exp: exp OP exp | NUM; -]]) - -AT_CHECK([bison -o input.c input.y], 0, [], -[input.y: conflicts: 1 shift/reduce -input.y: warning: expected 2 shift/reduce conflicts -]) -AT_CLEANUP - - -## ------------------------------ ## -## %expect with reduce conflicts ## -## ------------------------------ ## - -AT_SETUP([%expect with reduce conflicts]) - -AT_DATA([input.y], -[[%expect 0 -%% -program: a 'a' | a a; -a: 'a'; -]]) - -AT_CHECK([bison -o input.c input.y], 0, [], -[input.y: conflicts: 1 reduce/reduce -input.y: warning: expected 0 reduce/reduce conflicts -]) -AT_CLEANUP - - -## ------------------------------- ## -## %no-default-prec without %prec ## -## ------------------------------- ## - -AT_SETUP([%no-default-prec without %prec]) - -AT_DATA([[input.y]], -[[%left '+' -%left '*' - -%% - -%no-default-prec; - -e: e '+' e - | e '*' e - | '0' - ; -]]) - -AT_CHECK([bison -o input.c input.y], 0, [], -[[input.y: conflicts: 4 shift/reduce -]]) -AT_CLEANUP - - -## ---------------------------- ## -## %no-default-prec with %prec ## -## ---------------------------- ## - -AT_SETUP([%no-default-prec with %prec]) - -AT_DATA([[input.y]], -[[%left '+' -%left '*' - -%% - -%no-default-prec; - -e: e '+' e %prec '+' - | e '*' e %prec '*' - | '0' - ; -]]) - -AT_CHECK([bison -o input.c input.y]) -AT_CLEANUP - - -## ---------------- ## -## %default-prec ## -## ---------------- ## - -AT_SETUP([%default-prec]) - -AT_DATA([[input.y]], -[[%left '+' -%left '*' - -%% - -%default-prec; - -e: e '+' e - | e '*' e - | '0' - ; -]]) - -AT_CHECK([bison -o input.c input.y]) -AT_CLEANUP diff --git a/src/bin/bison/tests/cxx-type.at b/src/bin/bison/tests/cxx-type.at deleted file mode 100644 index 89afc58a03..0000000000 --- a/src/bin/bison/tests/cxx-type.at +++ /dev/null @@ -1,376 +0,0 @@ -# Checking GLR Parsing. -*- Autotest -*- -# Copyright (C) 2002, 2003 Free Software Foundation, Inc. - -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2, 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, write to the Free Software -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA -# 02111-1307, USA. - -AT_BANNER([[C++ Type Syntax (GLR).]]) - -# _AT_TEST_GLR_CXXTYPES(DECL, RESOLVE1, RESOLVE2) -# ----------------------------------------------- -# Store into types.y the calc program, with DECL inserted as a declaration, -# and with RESOLVE1 and RESOLVE2 as annotations on the conflicted rule for -# stmt. Then compile the result. -m4_define([_AT_TEST_GLR_CXXTYPES], -[ -AT_BISON_OPTION_PUSHDEFS([$1]) - -AT_DATA_GRAMMAR([types.y], -[[/* Simplified C++ Type and Expression Grammar. */ - -$1 - -%{ - #include - #define YYSTYPE char const * -]m4_bmatch([$2], [stmtMerge], -[ static YYSTYPE stmtMerge (YYSTYPE x0, YYSTYPE x1);])[ - #define YYINITDEPTH 10 - static char *format (char const *, ...); - struct YYLTYPE; -#if YYPURE -# if YYLSP_NEEDED -# define LEX_PARAMETERS YYSTYPE *lvalp, struct YYLTYPE *llocp -# define ERROR_PARAMETERS struct YYLTYPE *llocp, char const *s -# else -# define LEX_PARAMETERS YYSTYPE *lvalp -# endif -#endif -#ifndef LEX_PARAMETERS -# define LEX_PARAMETERS void -#endif -#ifndef ERROR_PARAMETERS -# define ERROR_PARAMETERS char const *s -#endif - int yylex (LEX_PARAMETERS); - int yyerror (ERROR_PARAMETERS); -%} - -%token TYPENAME ID - -%right '=' -%left '+' - -%glr-parser - -%% - -prog : - | prog stmt { -]AT_LOCATION_IF([ - printf ("%d.%d-%d.%d: ", - @2.first_line, @2.first_column, - @2.last_line, @2.last_column);])[ - printf ("%s\n", ]$[2); - } - ; - -stmt : expr ';' $2 { $$ = ]$[1; } - | decl $3 - | error ';' { $$ = ""; } - | '@' { YYACCEPT; } - ; - -expr : ID - | TYPENAME '(' expr ')' { $$ = format ("(%s,%s)", ]$[3, ]$[1); } - | expr '+' expr { $$ = format ("+(%s,%s)", ]$[1, ]$[3); } - | expr '=' expr { $$ = format ("=(%s,%s)", ]$[1, ]$[3); } - ; - -decl : TYPENAME declarator ';' - { $$ = format ("(%s,%s)", ]$[1, ]$[2); } - | TYPENAME declarator '=' expr ';' - { $$ = format ("(%s,%s,%s)", ]$[1, ]$[2, ]$[4); } - ; - -declarator : ID - | '(' declarator ')' { $$ = ]$[2; } - ; - -%% - -#include -#include -#include -#include - -int -main (int argc, char **argv) -{ - if (argc != 2) - abort (); - if (!freopen (argv[1], "r", stdin)) - abort (); - exit (yyparse ()); -} - -int -yylex (LEX_PARAMETERS) -{ - char buffer[256]; - int c; - unsigned int i; - static int lineNum = 1; - static int colNum = 1; - - -#if YYPURE -# define yylloc (*llocp) -# define yylval (*lvalp) -#endif - - while (1) - { - c = getchar (); - switch (c) - { - case EOF: - return 0; - case '\t': - colNum = 1 + ((colNum + 7) & ~7); - break; - case ' ': case '\f': - colNum += 1; - break; - case '\n': - lineNum += 1; - colNum = 1; - break; - default: - { - int tok; -#if YYLSP_NEEDED - yylloc.first_line = yylloc.last_line = lineNum; - yylloc.first_column = colNum; -#endif - if (isalpha (c)) - { - i = 0; - - do - { - buffer[i++] = c; - colNum += 1; - if (i == sizeof buffer - 1) - abort (); - c = getchar (); - } - while (isalnum (c) || c == '_'); - - ungetc (c, stdin); - buffer[i++] = 0; - tok = isupper ((unsigned char) buffer[0]) ? TYPENAME : ID; - yylval = strcpy (malloc (i), buffer); - } - else - { - colNum += 1; - tok = c; - yylval = ""; - } -#if YYLSP_NEEDED - yylloc.last_column = colNum-1; -#endif - return tok; - } - } - } -} - -int -yyerror (ERROR_PARAMETERS) -{ -#if YYPURE && YYLSP_NEEDED - /* Pacify GCC by using llocp. */ - if (! llocp) - abort (); -#endif - fprintf (stderr, "%s\n", s); - return 0; -} - - -static char * -format (char const *form, ...) -{ - char buffer[1024]; - va_list args; - va_start (args, form); - vsprintf (buffer, form, args); - va_end (args); - return strcpy (malloc (strlen (buffer) + 1), buffer); -} - -]] -m4_bmatch([$2], [stmtMerge], -[[static YYSTYPE -stmtMerge (YYSTYPE x0, YYSTYPE x1) -{ - return format ("(%s,%s)", x0, x1); -} -]]) -) - -AT_DATA([test-input], -[[ - -z + q; - -T x; - -T x = y; - -x = y; - -T (x) + y; - -T (x); - -T (y) = z + q; - -T (y y) = z + q; - -z + q; - -@ - -This is total garbage, but it should be ignored. -]]) - -AT_CHECK([bison -o types.c types.y], 0, [], ignore) -AT_COMPILE([types]) -AT_BISON_OPTION_POPDEFS -]) - -m4_define([_AT_RESOLVED_GLR_OUTPUT], -[[+(z,q) -(T,x) -(T,x,y) -=(x,y) -+((x,T),y) -(T,x) -(T,y,+(z,q)) - -+(z,q) -]]) - -m4_define([_AT_RESOLVED_GLR_OUTPUT_WITH_LOC], -[[3.1-3.6: +(z,q) -5.1-5.4: (T,x) -7.1-7.8: (T,x,y) -9.1-9.6: =(x,y) -11.1-11.10: +((x,T),y) -13.1-13.6: (T,x) -15.1-15.14: (T,y,+(z,q)) -17.6-17.16: -19.1-19.6: +(z,q) -]]) - -m4_define([_AT_AMBIG_GLR_OUTPUT], -[[+(z,q) -(T,x) -(T,x,y) -=(x,y) -+((x,T),y) -((T,x),(x,T)) -((T,y,+(z,q)),=((y,T),+(z,q))) - -+(z,q) -]]) - -m4_define([_AT_AMBIG_GLR_OUTPUT_WITH_LOC], -[[3.1-3.6: +(z,q) -5.1-5.4: (T,x) -7.1-7.8: (T,x,y) -9.1-9.6: =(x,y) -11.1-11.10: +((x,T),y) -13.1-13.6: ((T,x),(x,T)) -15.1-15.14: ((T,y,+(z,q)),=((y,T),+(z,q))) -17.6-17.16: -19.1-19.6: +(z,q) -]]) - -m4_define([_AT_GLR_STDERR], -[[syntax error -]]) - -m4_define([_AT_VERBOSE_GLR_STDERR], -[[syntax error, unexpected ID, expecting '=' or '+' or ')' -]]) - -## ---------------------------------------------------- ## -## Compile the grammar described in the documentation. ## -## ---------------------------------------------------- ## - -AT_SETUP([GLR: Resolve ambiguity, impure, no locations]) -_AT_TEST_GLR_CXXTYPES([], - [%dprec 1], [%dprec 2]) -AT_PARSER_CHECK([[./types test-input | sed 's/ *$//']], 0, - _AT_RESOLVED_GLR_OUTPUT, _AT_GLR_STDERR) -AT_CLEANUP - -AT_SETUP([GLR: Resolve ambiguity, impure, locations]) -_AT_TEST_GLR_CXXTYPES([%locations],[%dprec 1],[%dprec 2]) -AT_PARSER_CHECK([[./types test-input | sed 's/ *$//']], 0, - _AT_RESOLVED_GLR_OUTPUT_WITH_LOC, _AT_GLR_STDERR) -AT_CLEANUP - -AT_SETUP([GLR: Resolve ambiguity, pure, no locations]) -_AT_TEST_GLR_CXXTYPES([%pure-parser], - [%dprec 1], [%dprec 2]) -AT_PARSER_CHECK([[./types test-input | sed 's/ *$//']], 0, - _AT_RESOLVED_GLR_OUTPUT, _AT_GLR_STDERR) -AT_CLEANUP - -AT_SETUP([GLR: Resolve ambiguity, pure, locations]) -_AT_TEST_GLR_CXXTYPES([%pure-parser %locations], - [%dprec 1], [%dprec 2]) -AT_PARSER_CHECK([[./types test-input | sed 's/ *$//']], 0, - _AT_RESOLVED_GLR_OUTPUT_WITH_LOC, _AT_GLR_STDERR) -AT_CLEANUP - -AT_SETUP([GLR: Merge conflicting parses, impure, no locations]) -_AT_TEST_GLR_CXXTYPES([], - [%merge ], [%merge ]) -AT_PARSER_CHECK([[./types test-input | sed 's/ *$//']], 0, - _AT_AMBIG_GLR_OUTPUT, _AT_GLR_STDERR) -AT_CLEANUP - -AT_SETUP([GLR: Merge conflicting parses, impure, locations]) -_AT_TEST_GLR_CXXTYPES([%locations], - [%merge ], [%merge ]) -AT_PARSER_CHECK([[./types test-input | sed 's/ *$//']], 0, - _AT_AMBIG_GLR_OUTPUT_WITH_LOC, _AT_GLR_STDERR) -AT_CLEANUP - -AT_SETUP([GLR: Merge conflicting parses, pure, no locations]) -_AT_TEST_GLR_CXXTYPES([%pure-parser], - [%merge ], [%merge ]) -AT_PARSER_CHECK([[./types test-input | sed 's/ *$//']], 0, - _AT_AMBIG_GLR_OUTPUT, _AT_GLR_STDERR) -AT_CLEANUP -AT_SETUP([GLR: Merge conflicting parses, pure, locations]) -_AT_TEST_GLR_CXXTYPES([%pure-parser %locations], - [%merge ],[%merge ]) -AT_PARSER_CHECK([[./types test-input | sed 's/ *$//']], 0, - _AT_AMBIG_GLR_OUTPUT_WITH_LOC, _AT_GLR_STDERR) -AT_CLEANUP - -AT_SETUP([GLR: Verbose messages, resolve ambiguity, impure, no locations]) -_AT_TEST_GLR_CXXTYPES([%error-verbose], - [%merge ], [%merge ]) -AT_PARSER_CHECK([[./types test-input | sed 's/ *$//']], 0, - _AT_AMBIG_GLR_OUTPUT, _AT_VERBOSE_GLR_STDERR) -AT_CLEANUP diff --git a/src/bin/bison/tests/existing.at b/src/bin/bison/tests/existing.at deleted file mode 100644 index f1af48b9d4..0000000000 --- a/src/bin/bison/tests/existing.at +++ /dev/null @@ -1,2753 +0,0 @@ -# Exercising Bison on actual grammars. -*- Autotest -*- - -# Copyright (C) 1989, 1990, 1991, 1992, 2000, 2001, 2002, 2003, 2004 -# Free Software Foundation, Inc. - -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2, 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, write to the Free Software -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA -# 02111-1307, USA. - -AT_BANNER([[Existing Grammars.]]) -## ----------------- ## -## GNU AWK Grammar. ## -## ----------------- ## - -AT_SETUP([GNU AWK Grammar]) - -# We have been careful to strip all the actions excepts the -# mid-rule actions. We rely on %expect to check that there are -# indeed 65 SR conflicts. -# -# Bison was once wrong, due to an incorrect computation of nullable. -# It reported 485 SR conflicts! - -AT_DATA([[input.y]], -[[%expect 65 - -%token FUNC_CALL NAME REGEXP -%token ERROR -%token YNUMBER YSTRING -%token RELOP APPEND_OP -%token ASSIGNOP MATCHOP NEWLINE CONCAT_OP -%token LEX_BEGIN LEX_END LEX_IF LEX_ELSE LEX_RETURN LEX_DELETE -%token LEX_WHILE LEX_DO LEX_FOR LEX_BREAK LEX_CONTINUE -%token LEX_PRINT LEX_PRINTF LEX_NEXT LEX_EXIT LEX_FUNCTION -%token LEX_GETLINE LEX_NEXTFILE -%token LEX_IN -%token LEX_AND LEX_OR INCREMENT DECREMENT -%token LEX_BUILTIN LEX_LENGTH - -/* Lowest to highest */ -%right ASSIGNOP -%right '?' ':' -%left LEX_OR -%left LEX_AND -%left LEX_GETLINE -%nonassoc LEX_IN -%left FUNC_CALL LEX_BUILTIN LEX_LENGTH -%nonassoc ',' -%nonassoc MATCHOP -%nonassoc RELOP '<' '>' '|' APPEND_OP TWOWAYIO -%left CONCAT_OP -%left YSTRING YNUMBER -%left '+' '-' -%left '*' '/' '%' -%right '!' UNARY -%right '^' -%left INCREMENT DECREMENT -%left '$' -%left '(' ')' -%% - -start - : opt_nls program opt_nls - ; - -program - : rule - | program rule - | error - | program error - | /* empty */ - ; - -rule - : LEX_BEGIN {} action - | LEX_END {} action - | LEX_BEGIN statement_term - | LEX_END statement_term - | pattern action - | action - | pattern statement_term - | function_prologue function_body - ; - -func_name - : NAME - | FUNC_CALL - | lex_builtin - ; - -lex_builtin - : LEX_BUILTIN - | LEX_LENGTH - ; - -function_prologue - : LEX_FUNCTION {} func_name '(' opt_param_list r_paren opt_nls - ; - -function_body - : l_brace statements r_brace opt_semi opt_nls - | l_brace r_brace opt_semi opt_nls - ; - - -pattern - : exp - | exp ',' exp - ; - -regexp - /* - * In this rule, want_regexp tells yylex that the next thing - * is a regexp so it should read up to the closing slash. - */ - : '/' {} REGEXP '/' - ; - -action - : l_brace statements r_brace opt_semi opt_nls - | l_brace r_brace opt_semi opt_nls - ; - -statements - : statement - | statements statement - | error - | statements error - ; - -statement_term - : nls - | semi opt_nls - ; - -statement - : semi opt_nls - | l_brace r_brace - | l_brace statements r_brace - | if_statement - | LEX_WHILE '(' exp r_paren opt_nls statement - | LEX_DO opt_nls statement LEX_WHILE '(' exp r_paren opt_nls - | LEX_FOR '(' NAME LEX_IN NAME r_paren opt_nls statement - | LEX_FOR '(' opt_exp semi opt_nls exp semi opt_nls opt_exp r_paren opt_nls statement - | LEX_FOR '(' opt_exp semi opt_nls semi opt_nls opt_exp r_paren opt_nls statement - | LEX_BREAK statement_term - | LEX_CONTINUE statement_term - | print '(' expression_list r_paren output_redir statement_term - | print opt_rexpression_list output_redir statement_term - | LEX_NEXT statement_term - | LEX_NEXTFILE statement_term - | LEX_EXIT opt_exp statement_term - | LEX_RETURN {} opt_exp statement_term - | LEX_DELETE NAME '[' expression_list ']' statement_term - | LEX_DELETE NAME statement_term - | exp statement_term - ; - -print - : LEX_PRINT - | LEX_PRINTF - ; - -if_statement - : LEX_IF '(' exp r_paren opt_nls statement - | LEX_IF '(' exp r_paren opt_nls statement - LEX_ELSE opt_nls statement - ; - -nls - : NEWLINE - | nls NEWLINE - ; - -opt_nls - : /* empty */ - | nls - ; - -input_redir - : /* empty */ - | '<' simp_exp - ; - -output_redir - : /* empty */ - | '>' exp - | APPEND_OP exp - | '|' exp - | TWOWAYIO exp - ; - -opt_param_list - : /* empty */ - | param_list - ; - -param_list - : NAME - | param_list comma NAME - | error - | param_list error - | param_list comma error - ; - -/* optional expression, as in for loop */ -opt_exp - : /* empty */ - | exp - ; - -opt_rexpression_list - : /* empty */ - | rexpression_list - ; - -rexpression_list - : rexp - | rexpression_list comma rexp - | error - | rexpression_list error - | rexpression_list error rexp - | rexpression_list comma error - ; - -opt_expression_list - : /* empty */ - | expression_list - ; - -expression_list - : exp - | expression_list comma exp - | error - | expression_list error - | expression_list error exp - | expression_list comma error - ; - -/* Expressions, not including the comma operator. */ -exp : variable ASSIGNOP {} exp - | '(' expression_list r_paren LEX_IN NAME - | exp '|' LEX_GETLINE opt_variable - | exp TWOWAYIO LEX_GETLINE opt_variable - | LEX_GETLINE opt_variable input_redir - | exp LEX_AND exp - | exp LEX_OR exp - | exp MATCHOP exp - | regexp - | '!' regexp %prec UNARY - | exp LEX_IN NAME - | exp RELOP exp - | exp '<' exp - | exp '>' exp - | exp '?' exp ':' exp - | simp_exp - | exp simp_exp %prec CONCAT_OP - ; - -rexp - : variable ASSIGNOP {} rexp - | rexp LEX_AND rexp - | rexp LEX_OR rexp - | LEX_GETLINE opt_variable input_redir - | regexp - | '!' regexp %prec UNARY - | rexp MATCHOP rexp - | rexp LEX_IN NAME - | rexp RELOP rexp - | rexp '?' rexp ':' rexp - | simp_exp - | rexp simp_exp %prec CONCAT_OP - ; - -simp_exp - : non_post_simp_exp - /* Binary operators in order of decreasing precedence. */ - | simp_exp '^' simp_exp - | simp_exp '*' simp_exp - | simp_exp '/' simp_exp - | simp_exp '%' simp_exp - | simp_exp '+' simp_exp - | simp_exp '-' simp_exp - | variable INCREMENT - | variable DECREMENT - ; - -non_post_simp_exp - : '!' simp_exp %prec UNARY - | '(' exp r_paren - | LEX_BUILTIN - '(' opt_expression_list r_paren - | LEX_LENGTH '(' opt_expression_list r_paren - | LEX_LENGTH - | FUNC_CALL '(' opt_expression_list r_paren - | variable - | INCREMENT variable - | DECREMENT variable - | YNUMBER - | YSTRING - | '-' simp_exp %prec UNARY - | '+' simp_exp %prec UNARY - ; - -opt_variable - : /* empty */ - | variable - ; - -variable - : NAME - | NAME '[' expression_list ']' - | '$' non_post_simp_exp - ; - -l_brace - : '{' opt_nls - ; - -r_brace - : '}' opt_nls - ; - -r_paren - : ')' - ; - -opt_semi - : /* empty */ - | semi - ; - -semi - : ';' - ; - -comma : ',' opt_nls - ; - -%% -]]) - -# Pass plenty of options, to exercise plenty of code, even if we -# don't actually check the output. But SEGV is watching us, and -# so might do dmalloc. -AT_CHECK([[bison --verbose --defines input.y]]) - -AT_CLEANUP - - -## ----------------- ## -## GNU Cim Grammar. ## -## ----------------- ## - -AT_SETUP([GNU Cim Grammar]) - -# GNU Cim, the GNU Simula 87 Compiler. - -# Bison was once wrong, due to an incorrect computation of the RR conflicts. -# It reported 80 SR && 99 RR conflicts instead of 78/10!!! - -AT_DATA([[input.y]], -[[%union { - long int token; - long int ival; - long int arrdim; - double rval; - char *ident; - char *tval; - char stat_decl; - } - -%token - HACTIVATE HAFTER /*HAND*/ HARRAY HAT - HBEFORE HBEGIN HBOOLEAN - HCHARACTER HCLASS /*HCOMMENT*/ HCONC - HDELAY HDO - HELSE HEND HEQ /*HEQV*/ HEXTERNAL - HFOR - HGE HGO HGOTO HGT - HHIDDEN - HIF /*HIMP*/ HIN HINNER HINSPECT HINTEGER HIS - HLABEL HLE HLONG HLT - HNAME HNE HNEW HNONE /*HNOT*/ HNOTEXT - /*HOR*/ HOTHERWISE - HPRIOR HPROCEDURE HPROTECTED - HQUA - HREACTIVATE HREAL HREF - HSHORT HSTEP HSWITCH - HTEXT HTHEN HTHIS HTO - HUNTIL - HVALUE HVAR HVIRTUAL - HWHEN HWHILE - - HASSIGNVALUE HASSIGNREF - /*HDOT*/ HPAREXPSEPARATOR HLABELSEPARATOR HSTATEMENTSEPARATOR - HBEGPAR HENDPAR - HEQR HNER - HADD HSUB HMUL HDIV HINTDIV HEXP - HDOTDOTDOT - -%token HIDENTIFIER -%token HBOOLEANKONST HINTEGERKONST HCHARACTERKONST -%token HREALKONST -%token HTEXTKONST - -%type EXT_IDENT -%type DECLSTATEMENT MODULSTATEMENT MBEE_DECLSTMS MBEE_DECLSTMSU -%type MODULS -%type EXPRESSION_SIMP MBEE_ARG_R_PT -%type BAUND_PAIR_LIST - -%right HASSIGN -%left HORELSE -%left HANDTHEN -%left HEQV -%left HIMP -%left HOR -%left HAND - -%left HNOT - -%left HVALRELOPERATOR HREFRELOPERATOR HOBJRELOPERATOR - -%left HCONC - -%left HTERMOPERATOR -%left UNEAR -%left HFACTOROPERATOR -%left HPRIMARYOPERATOR - -%left HQUA - -%left HDOT - -%start MAIN_MODULE -%% -/* GRAMATIKK FOR PROGRAM MODULES */ -MAIN_MODULE : { categ=CLOCAL; mout(MBLOCK); - beginBlock(KBLOKK);separat_comp=FALSE;} - MODULS { endBlock(NULL,CCNO); mout(MENDBLOCK);} - | error HSTATEMENTSEPARATOR MBEE_DECLSTMS - ; -EXT_DECLARATION : HEXTERNAL - MBEE_TYPE - HPROCEDURE - { MBEENEWBLOCK(); - kind=KPROC;} - EXT_LIST - | - HEXTERNAL - HIDENTIFIER - HPROCEDURE - { MBEENEWBLOCK(); - type=TNOTY; - kind=KPROC; - if($2==Ckind)categ=CCPROC;else - yerror (1); - ysensitive=sensitive; - sensitive=ON;} - HIDENTIFIER { $$=$5; - sensitive=ysensitive;} - EXTERNAL_KIND_ITEM - { categ=CLOCAL;} - | HEXTERNAL - HCLASS - { MBEENEWBLOCK(); - kind=KCLASS;} - EXT_LIST - - ; -EXTERNAL_KIND_ITEM: EXT_IDENT - HOBJRELOPERATOR - { if($2!=HIS)yerror (2);} - MBEE_TYPE HPROCEDURE - HIDENTIFIER - { regDecl($6, type, KPROC, CCPROC); - beginBlock(kind);} - HEADING EMPTY_BLOCK - { categ=CLOCAL; - endBlock($1==NULL?$0:tag($1),CCCPROC);} -/* | - EXT_IDENT - { if($1!=NULL)yerror (3); - regDecl($0, type, kind, categ);} - MBEE_REST_EXT_LIST - { endBlock(NULL,CCNO);} - ; -MBEE_REST_EXT_LIST: /* EMPTY - | HPAREXPSEPARATOR EXT_KIND_LIST - ; -EXT_KIND_LIST : EXT_KIND_ITEM - | EXT_KIND_LIST HPAREXPSEPARATOR EXT_KIND_ITEM - ; -EXT_KIND_ITEM : HIDENTIFIER - EXT_IDENT - { if($2!=NULL)yerror (3); - regDecl($1, type, kind, categ);}*/ - ; -EMPTY_BLOCK : /*EMPT*/ - | HBEGIN HEND - ; -EXT_LIST : EXT_ITEM - | EXT_LIST HPAREXPSEPARATOR EXT_ITEM - ; -EXT_ITEM : HIDENTIFIER - EXT_IDENT - { lesinn_external_spec($1,$2, kind);} - ; -EXT_IDENT : /* EMPTY */ { $$=NULL;} - | HVALRELOPERATOR { if($1!=HEQ)yerror (9); - external=TRUE;} - HTEXTKONST { $$=$3;external=FALSE;} - ; -/* GRAMATIKK FOR TYPER */ -NO_TYPE : /*EMPT*/ { type=TNOTY;} - ; -MBEE_TYPE : NO_TYPE - | TYPE - ; -TYPE : HREF HBEGPAR - HIDENTIFIER - { prefquantident=$3; - type=TREF;} - HENDPAR - | HTEXT { type=TTEXT;} - | HBOOLEAN { type=TBOOL;} - | HCHARACTER { type=TCHAR;} - | HSHORT HINTEGER { type=TSHORT;} - | HINTEGER { type=TINTG;} - | HREAL { type=TREAL;} - | HLONG HREAL { type=TLONG;} - ; - -/* GRAMATIKK FOR DEL AV SETNINGER */ -MBEE_ELSE_PART : /*EMPT*/ -/* | HELSE - HIF - EXPRESSION - HTHEN { mout(MELSE); - mout(MIF); - OBSBLOCK();} - BLOCK { MBEEENDBLOCK();} - MBEE_ELSE_PART { mout(MENDIF);}*/ - | HELSE { OBSBLOCK(); mout(MELSE);} - BLOCK { MBEEENDBLOCK();} - ; -FOR_LIST : FOR_LIST_ELEMENT { mout(MENDSEP); - mout(MLISTSEP);} - | FOR_LIST_ELEMENT - HPAREXPSEPARATOR - FOR_LIST { mout(MLISTSEP);} - ; -FOR_LIST_ELEMENT: EXPRESSION - MBEE_F_L_EL_R_PT - ; -MBEE_F_L_EL_R_PT: /*EMPT*/ - | HWHILE - EXPRESSION { mout(MFORWHILE);} - | HSTEP - EXPRESSION - HUNTIL - EXPRESSION { mout(MUNTIL); - mout(MSTEP);} - ; -GOTO : HGO - HTO - | HGOTO - ; -CONN_STATE_R_PT : WHEN_CLAUSE_LIST - | HDO { beginBlock(KCON); mout(MDO); - OBSBLOCK(); } - BLOCK { endBlock(NULL,CCNO); - MBEEENDBLOCK(); mout(MENDDO);} - ; -WHEN_CLAUSE_LIST: HWHEN - HIDENTIFIER - HDO { beginBlock(KCON); mout(MIDENTIFIER); - OBSBLOCK(); moutId($2); - mout(MWHEN);} - BLOCK { endBlock(NULL,CCNO); - MBEEENDBLOCK(); mout(MENDWHEN);} - | WHEN_CLAUSE_LIST - HWHEN - HIDENTIFIER - HDO { beginBlock(KCON); mout(MIDENTIFIER); - OBSBLOCK(); moutId($3); - mout(MWHEN);} - BLOCK { endBlock(NULL,CCNO); - MBEEENDBLOCK(); mout(MENDWHEN);} - ; -MBEE_OTWI_CLAUS : /*EMPT*/ - | HOTHERWISE {OBSBLOCK(); mout(MOTHERWISE);} - - BLOCK {MBEEENDBLOCK();mout(MENDOTHERWISE);} - ; -ACTIVATOR : HACTIVATE { mout(MBOOLEANKONST); - moutIval(FALSE);} - | HREACTIVATE { mout(MBOOLEANKONST); - moutIval(TRUE);} - ; -SCHEDULE : /*EMPT*/ { mout(MCHARACTERKONST); - moutIval(DIRECT); - mout(MINTEGERKONST); - moutIval(0); - mout(MNONE); - mout(MBOOLEANKONST); - moutIval(FALSE);} - | ATDELAY EXPRESSION { mout(MNONE);} - PRIOR - | BEFOREAFTER { mout(MINTEGERKONST); - moutIval(0);} - EXPRESSION { mout(MBOOLEANKONST); - moutIval(FALSE);} - ; -ATDELAY : HAT { mout(MCHARACTERKONST); - moutIval(AT);} - | HDELAY { mout(MCHARACTERKONST); - moutIval(DELAYS);} - ; -BEFOREAFTER : HBEFORE { mout(MCHARACTERKONST); - moutIval(BEFORE);} - | HAFTER { mout(MCHARACTERKONST); - moutIval(AFTER);} - ; -PRIOR : /*EMPT*/ { mout(MBOOLEANKONST); - moutIval(FALSE);} - | HPRIOR { mout(MBOOLEANKONST); - moutIval(TRUE);} - ; -/* GRAMATIKK FOR SETNINGER OG DEKLARASJONER */ -MODULSTATEMENT : HWHILE - EXPRESSION - HDO { STOPOBSBLOCK(); mout(MWHILE); - OBSBLOCK();} - BLOCK { MBEEENDBLOCK(); mout(MENDWHILE); - $$=STATEMENT;} - | HIF - EXPRESSION - HTHEN { STOPOBSBLOCK(); mout(MIF); - OBSBLOCK();} - BLOCK { MBEEENDBLOCK();} - MBEE_ELSE_PART { mout(MENDIF); - $$=STATEMENT;} - | HFOR - HIDENTIFIER - HASSIGN { STOPOBSBLOCK(); mout(MIDENTIFIER); - moutId($2);} - FOR_LIST - HDO { beginBlock(KFOR); - if($3==HASSIGNVALUE) mout(MFOR); - else mout(MFORR); - OBSBLOCK(); mout(MFORDO);} - BLOCK { MBEEENDBLOCK(); - endBlock(NULL,CCNO); mout(MENDFOR); - $$=STATEMENT;} - | GOTO - EXPRESSION { mout(MGOTO); - STOPOBSBLOCK(); $$=STATEMENT;} - | HINSPECT - EXPRESSION { mout(MINSPECT); - STOPOBSBLOCK(); - beginBlock(KINSP);} - CONN_STATE_R_PT - { endBlock(NULL,CCNO);} - MBEE_OTWI_CLAUS { mout(MENDINSPECT); - $$=STATEMENT;} - | HINNER { STOPOBSBLOCK(); mout(MINNER); - regInner(); $$=STATEMENT;} - | HIDENTIFIER - HLABELSEPARATOR - { STOPOBSBLOCK(); - regDecl($1, TLABEL, KSIMPLE, categ); mout(MLABEL); - moutId($1); - mout(MENDLABEL);} - DECLSTATEMENT { if($4<=DECLARATION) - { yerror (27); - $$=DECLARATION;} - else $$=$4;} - | EXPRESSION_SIMP - HBEGIN - { $$=$1; } - IMPORT_SPEC_MODULE - { mout(MPRBLOCK); - prefquantident=$1; - beginBlock(KPRBLK);} - MBEE_DECLSTMS - HEND { endBlock(NULL,CCNO); mout(MENDPRBLOCK); - $$=STATEMENT;} - | EXPRESSION_SIMP HBEGIN error HSTATEMENTSEPARATOR - MBEE_DECLSTMS HEND { $$=STATEMENT; - endBlock(NULL,CCNO); mout(MENDPRBLOCK);} - | EXPRESSION_SIMP HBEGIN error HEND - { $$=STATEMENT; - endBlock(NULL,CCNO); mout(MENDPRBLOCK);} - - | EXPRESSION_SIMP - { STOPOBSBLOCK(); $$=STATEMENT; - mout(MENDASSIGN);} - | ACTIVATOR EXPRESSION SCHEDULE - { $$=STATEMENT; - mout(MENDSEP); - mout(MARGUMENTSEP); - mout(MARGUMENTSEP); - mout(MARGUMENTSEP); - mout(MARGUMENTSEP); - mout(MARGUMENTSEP); - mout(MARGUMENTSEP); - mout(MARGUMENT); - moutId(activateid); - mout(MENDASSIGN);} - | HBEGIN - { STOPOBSBLOCK(); - OBSBLOCK();} - MBEE_DECLSTMS - HEND { MBEEENDBLOCK(); $$=STATEMENT;} - | MBEE_TYPE HPROCEDURE - HIDENTIFIER - { MBEENEWBLOCK(); mout(MPROCEDURE); - regDecl($3, type, KPROC, categ); - beginBlock(KPROC);} - HEADING BLOCK { endBlock(NULL,CCNO); $$=DECLARATION; - mout(MENDPROCEDURE);} - | HIDENTIFIER - HCLASS - NO_TYPE - { $$=$1; } - IMPORT_SPEC_MODULE - HIDENTIFIER - { prefquantident=$1; - mout(MCLASS); - regDecl($6, TNOTY, KCLASS, categ); - beginBlock(KCLASS);} - HEADING - BLOCK { endBlock(NULL,CCNO); $$=DECLARATION; - mout(MENDCLASS);} - | HCLASS - NO_TYPE - HIDENTIFIER - { prefquantident=0; - MBEENEWBLOCK(); mout(MCLASS); - regDecl($3, TNOTY, KCLASS, categ); - beginBlock(KCLASS);} - HEADING - BLOCK { endBlock(NULL,CCNO); $$=DECLARATION; - mout(MENDCLASS);} - | EXT_DECLARATION { $$=EXTDECLARATION;} - | /*EMPT*/{ STOPOBSBLOCK(); $$=EMPTYSTATEMENT;} - ; -IMPORT_SPEC_MODULE: { MBEENEWBLOCK(); - kind=KCLASS; - if($0==simsetident && - findDecl(simsetident,cblock,FALSE)==NULL) - lesinn_external_spec(simsetident, - SIMSETATRFILE, kind); - if($0==simulationident && findDecl( - simulationident,cblock,FALSE)==NULL) - lesinn_external_spec(simulationident, - SIMULATIONATRFILE, kind); - if(($0==fileident && findDecl( - fileident,cblock,FALSE)==NULL) || - ($0==outfileident && findDecl( - outfileident,cblock,FALSE)==NULL) || - ($0==infileident && findDecl( - infileident,cblock,FALSE)==NULL) || - ($0==directfileident && findDecl( - directfileident,cblock,FALSE)==NULL) || - ($0==printfileident && findDecl( - printfileident,cblock,FALSE)==NULL) || - ($0==bytefileident && findDecl( - bytefileident,cblock,FALSE)==NULL) || - ($0==inbytefileident && findDecl( - inbytefileident,cblock,FALSE)==NULL) || - ($0==outbytefileident && findDecl( - outbytefileident,cblock,FALSE)==NULL) || - ($0==directbytefileident && findDecl( - directbytefileident,cblock,FALSE)==NULL)) - lesinn_external_spec(fileident, - FILEATRFILE, kind);} - ; -DECLSTATEMENT : MODULSTATEMENT - | TYPE - HIDENTIFIER - MBEE_CONSTANT - HPAREXPSEPARATOR - { MBEENEWBLOCK(); - kind=KSIMPLE; - regDecl($2, type, KSIMPLE, categ); - categ=CLOCAL;} - IDENTIFIER_LISTC { $$=DECLARATION;} - | TYPE - HIDENTIFIER - MBEE_CONSTANT - { MBEENEWBLOCK(); - regDecl($2, type, KSIMPLE, categ); - categ=CLOCAL; $$=DECLARATION;} - | MBEE_TYPE - HARRAY { MBEENEWBLOCK(); - kind=KARRAY;} - ARR_SEGMENT_LIST { $$=DECLARATION;} - | HSWITCH - HIDENTIFIER - HASSIGN { MBEENEWBLOCK(); mout(MIDENTIFIER); - moutId($2); - regDecl($2, TLABEL, KARRAY, categ);} - SWITCH_LIST { $$=DECLARATION; - mout(MSWITCH); - mout(MENDSWITCH);} - ; -BLOCK : DECLSTATEMENT { if($1<=DECLARATION)yerror (29);} - | HBEGIN MBEE_DECLSTMS HEND - | HBEGIN error HSTATEMENTSEPARATOR MBEE_DECLSTMS HEND - | HBEGIN error HEND - ; -MBEE_DECLSTMS : MBEE_DECLSTMSU { if($1<=DECLARATION)yerror (28); - $$=$1;} - ; -MBEE_DECLSTMSU : DECLSTATEMENT { $$=$1;} - | MBEE_DECLSTMSU - HSTATEMENTSEPARATOR - DECLSTATEMENT { if($1>=STATEMENT && $3<=DECLARATION) - yerror (26); - $$=$3;} - ; -MODULS : MODULSTATEMENT { if($1==DECLARATION) - {separat_comp=TRUE;gettimestamp();} - $$=$1;} - | MODULS HSTATEMENTSEPARATOR MODULSTATEMENT - { if($1>=STATEMENT && $3<=DECLARATION) - yerror (26);else - if($1>=STATEMENT - && $3!=EMPTYSTATEMENT)yerror (25); - if(separat_comp && $3==STATEMENT) - yerror (25); - if($3==DECLARATION && !separat_comp) - {separat_comp=TRUE;gettimestamp();} - $$=$3;} - ; -/* GRAMATIKK FOR DEL AV DEKLARASJONER */ -ARR_SEGMENT_LIST: ARR_SEGMENT - | ARR_SEGMENT_LIST - HPAREXPSEPARATOR - ARR_SEGMENT - ; -ARR_SEGMENT : ARRAY_SEGMENT - HBEGPAR - BAUND_PAIR_LIST HENDPAR { mout(MARRAY); - mout(MENDARRAY); - setArrayDim($3);} - ; -ARRAY_SEGMENT : ARRAY_SEGMENT_EL { mout(MENDSEP); - mout(MARRAYSEP);} - - | ARRAY_SEGMENT_EL - HPAREXPSEPARATOR - ARRAY_SEGMENT { mout(MARRAYSEP);} - ; -ARRAY_SEGMENT_EL: HIDENTIFIER { mout(MIDENTIFIER); - moutId($1); - regDecl($1, type, kind, categ); - if(lastArray==NULL) - lastArray=cblock->lastparloc;} - ; -BAUND_PAIR_LIST : BAUND_PAIR { mout(MENDSEP); - mout(MBOUNDSEP); - $$=1;} - | BAUND_PAIR - HPAREXPSEPARATOR - BAUND_PAIR_LIST { mout(MBOUNDSEP); - $$=$3+1;} - ; -BAUND_PAIR : EXPRESSION - HLABELSEPARATOR - EXPRESSION { mout(MBOUNDPARSEP);} - ; -SWITCH_LIST : EXPRESSION { mout(MENDSEP); - mout(MSWITCHSEP);} - | EXPRESSION - HPAREXPSEPARATOR - SWITCH_LIST { mout(MSWITCHSEP);} - ; -HEADING : MBEE_FMAL_PAR_P HSTATEMENTSEPARATOR { kind=KNOKD;} - MBEE_MODE_PART { categ=CSPEC;} - MBEE_SPEC_PART { kind=KNOKD;} - MBEE_PROT_PART { categ=CVIRT;} - MBEE_VIRT_PART - { categ=CLOCAL;} - ; -MBEE_FMAL_PAR_P : /*EMPT*/ - | FMAL_PAR_PART - ; -FMAL_PAR_PART : HBEGPAR NO_TYPE - MBEE_LISTV HENDPAR - ; -MBEE_LISTV : /*EMPT*/ - | LISTV - ; -LISTV : HIDENTIFIER { regDecl($1, type, KNOKD, CDEFLT);} - | FPP_CATEG HDOTDOTDOT { regDecl(varargsid, TVARARGS, KNOKD, categ);} - | HIDENTIFIER { regDecl($1, type, KNOKD, CDEFLT);} - HPAREXPSEPARATOR LISTV {} - | FPP_SPEC - | FPP_SPEC - HPAREXPSEPARATOR LISTV - ; -FPP_HEADING : HBEGPAR NO_TYPE - FPP_MBEE_LISTV HENDPAR - ; -FPP_MBEE_LISTV : /*EMPT*/ - | FPP_LISTV - ; -FPP_LISTV : FPP_CATEG HDOTDOTDOT { regDecl(varargsid, TVARARGS, KNOKD, categ);} - | FPP_SPEC - | FPP_SPEC - HPAREXPSEPARATOR LISTV - ; -FPP_SPEC : FPP_CATEG SPECIFIER HIDENTIFIER - { regDecl($3, type, kind, categ);} - | FPP_CATEG FPP_PROC_DECL_IN_SPEC - ; -FPP_CATEG : HNAME HLABELSEPARATOR - { categ=CNAME;} - | HVALUE HLABELSEPARATOR - { categ=CVALUE;} - | HVAR HLABELSEPARATOR - { categ=CVAR;} - | /*EMPT*/ { categ=CDEFLT;} - ; -FPP_PROC_DECL_IN_SPEC: MBEE_TYPE HPROCEDURE - HIDENTIFIER - { $$=categ; - regDecl($3, type, KPROC, categ); - beginBlock(KPROC);} - FPP_HEADING - { categ=$4; /* M} settes tilbake*/} - { endBlock(NULL,CCNO);} - ; -IDENTIFIER_LISTV: HIDENTIFIER { regDecl($1, type, kind, categ);} - | HDOTDOTDOT { regDecl(varargsid, TVARARGS, kind, categ);} - | HIDENTIFIER { regDecl($1, type, kind, categ);} - HPAREXPSEPARATOR IDENTIFIER_LISTV {} - ; -MBEE_MODE_PART : /*EMPT*/ - | MODE_PART - ; -MODE_PART : NAME_PART - | VALUE_PART - | VAR_PART - | NAME_PART VALUE_PART - | VALUE_PART NAME_PART - | NAME_PART VAR_PART - | VAR_PART NAME_PART - | VALUE_PART VAR_PART - | VAR_PART VALUE_PART - | VAR_PART NAME_PART VALUE_PART - | NAME_PART VAR_PART VALUE_PART - | NAME_PART VALUE_PART VAR_PART - | VAR_PART VALUE_PART NAME_PART - | VALUE_PART VAR_PART NAME_PART - | VALUE_PART NAME_PART VAR_PART - ; -NAME_PART : HNAME { categ=CNAME;} - IDENTIFIER_LISTV - HSTATEMENTSEPARATOR - ; -VAR_PART : HVAR { categ=CVAR;} - IDENTIFIER_LISTV - HSTATEMENTSEPARATOR - ; -VALUE_PART : HVALUE { categ=CVALUE;} - IDENTIFIER_LISTV HSTATEMENTSEPARATOR - ; -MBEE_SPEC_PART : /*EMPT*/ - | SPEC_PART - ; -SPEC_PART : ONE_SPEC - | SPEC_PART ONE_SPEC - ; -ONE_SPEC : SPECIFIER IDENTIFIER_LIST HSTATEMENTSEPARATOR - | NO_TYPE HPROCEDURE HIDENTIFIER HOBJRELOPERATOR - { if($4!=HIS) yerror (8);} - PROC_DECL_IN_SPEC HSTATEMENTSEPARATOR - | FPP_PROC_DECL_IN_SPEC HSTATEMENTSEPARATOR - | MBEE_TYPE HPROCEDURE HIDENTIFIER HSTATEMENTSEPARATOR - { yerror (45);} - | MBEE_TYPE HPROCEDURE HIDENTIFIER HPAREXPSEPARATOR - IDENTIFIER_LIST HSTATEMENTSEPARATOR - { yerror (45);} - ; -SPECIFIER : TYPE { kind=KSIMPLE;} - | MBEE_TYPE - HARRAY { kind=KARRAY;} - | HLABEL { type=TLABEL; - kind=KSIMPLE;} - | HSWITCH { type=TLABEL; - kind=KARRAY;} - ; -PROC_DECL_IN_SPEC: MBEE_TYPE HPROCEDURE - HIDENTIFIER - { $$=categ; - regDecl($3, type, KPROC, categ); - beginBlock(KPROC);} - HEADING - { categ=$4; /* M} settes tilbake*/} - MBEE_BEGIN_END - { endBlock(NULL,CCNO);} - ; -MBEE_BEGIN_END : /* EMPTY */ - | HBEGIN HEND - ; -MBEE_PROT_PART : /*EMPT*/ - | PROTECTION_PART - ; -PROTECTION_PART : PROT_SPECIFIER IDENTIFIER_LIST - HSTATEMENTSEPARATOR - | PROTECTION_PART PROT_SPECIFIER - IDENTIFIER_LIST HSTATEMENTSEPARATOR - ; -PROT_SPECIFIER : HHIDDEN { categ=CHIDEN;} - | HPROTECTED { categ=CPROT;} - | HHIDDEN - HPROTECTED { categ=CHIPRO;} - | HPROTECTED - HHIDDEN { categ=CHIPRO;} - ; -MBEE_VIRT_PART : /*EMPT*/ - | VIRTUAL_PART - ; -VIRTUAL_PART : HVIRTUAL - HLABELSEPARATOR - MBEE_SPEC_PART - ; -IDENTIFIER_LIST : HIDENTIFIER { regDecl($1, type, kind, categ);} - | IDENTIFIER_LIST HPAREXPSEPARATOR - HIDENTIFIER { regDecl($3, type, kind, categ);} - ; -IDENTIFIER_LISTC: HIDENTIFIER - MBEE_CONSTANT { regDecl($1, type, kind, categ); - categ=CLOCAL;} - | IDENTIFIER_LISTC HPAREXPSEPARATOR - HIDENTIFIER - MBEE_CONSTANT { regDecl($3, type, kind, categ); - categ=CLOCAL;} - ; -MBEE_CONSTANT : /* EMPTY */ - | HVALRELOPERATOR - { MBEENEWBLOCK(); - if($1!=HEQ) yerror (8); - if(type==TREF)yerror (7); - categ=CCONSTU; - mout(MIDENTIFIER); - moutId($0);} - EXPRESSION { mout(MASSIGN); - mout(MCONST);} - ; - -/* GRAMATIKK FOR UTTRYKK */ -EXPRESSION : EXPRESSION_SIMP {} - | HIF - EXPRESSION - HTHEN - EXPRESSION - HELSE - EXPRESSION { mout(MELSEE); - mout(MIFE);} - ; -EXPRESSION_SIMP : EXPRESSION_SIMP - HASSIGN - EXPRESSION { if($2==HASSIGNREF)mout(MASSIGNR); - else mout(MASSIGN);$$=NULL;} - | - - EXPRESSION_SIMP - HCONC - EXPRESSION_SIMP { mout(MCONC);$$=NULL;} - | EXPRESSION_SIMP HOR - HELSE - EXPRESSION_SIMP - %prec HORELSE { mout(MORELSEE);$$=NULL;} - | EXPRESSION_SIMP HAND - HTHEN - EXPRESSION_SIMP - %prec HANDTHEN { mout(MANDTHENE);$$=NULL;} - | EXPRESSION_SIMP - HEQV EXPRESSION_SIMP { mout(MEQV);$$=NULL;} - | EXPRESSION_SIMP - HIMP EXPRESSION_SIMP { mout(MIMP);$$=NULL;} - | EXPRESSION_SIMP - HOR EXPRESSION_SIMP { mout(MOR);$$=NULL;} - | EXPRESSION_SIMP - HAND EXPRESSION_SIMP { mout(MAND);$$=NULL;} - | HNOT EXPRESSION_SIMP { mout(MNOT);$$=NULL;} - | EXPRESSION_SIMP - HVALRELOPERATOR - EXPRESSION_SIMP - { switch($2) - { case HEQ: mout(MEQ);break; - case HNE: mout(MNE);break; - case HLT: mout(MLT);break; - case HLE: mout(MLE);break; - case HGT: mout(MGT);break; - case HGE: mout(MGE);break; - }$$=NULL;} - | EXPRESSION_SIMP - HREFRELOPERATOR - EXPRESSION_SIMP - { if($2==HNER) mout(MNER); - else mout(MEQR);$$=NULL;} - | EXPRESSION_SIMP - HOBJRELOPERATOR - EXPRESSION_SIMP - { if($2==HIS) mout(MIS); - else mout(MINS);$$=NULL;} - | HTERMOPERATOR - EXPRESSION_SIMP %prec UNEAR - { if($1==HADD) mout(MUADD); - else mout(MUSUB);$$=NULL;} - | EXPRESSION_SIMP - HTERMOPERATOR - EXPRESSION_SIMP - { if($2==HADD) mout(MADD); - else mout(MSUB);$$=NULL;} - | EXPRESSION_SIMP - HFACTOROPERATOR - EXPRESSION_SIMP - { if($2==HMUL) mout(MMUL); else - if($2==HDIV) mout(MDIV); - else mout(MINTDIV);$$=NULL;} - | EXPRESSION_SIMP - HPRIMARYOPERATOR - EXPRESSION_SIMP { mout(MPRIMARY);$$=NULL;} - | HBEGPAR - EXPRESSION HENDPAR { mout(MNOOP);$$=NULL;} - | HTEXTKONST { mout(MTEXTKONST); - moutTval($1);$$=NULL;} - | HCHARACTERKONST { mout(MCHARACTERKONST); - moutIval($1);$$=NULL;} - | HREALKONST { mout(MREALKONST); - moutRval($1);$$=NULL;} - | HINTEGERKONST { mout(MINTEGERKONST); - moutIval($1);$$=NULL;} - | HBOOLEANKONST { mout(MBOOLEANKONST); - moutIval($1);$$=NULL;} - | HNONE { mout(MNONE);$$=NULL;} - | HIDENTIFIER - { $$=$1;} - MBEE_ARG_R_PT {} - | HTHIS HIDENTIFIER { mout(MTHIS); - moutId($2);$$=NULL;} - | HNEW - HIDENTIFIER - ARG_R_PT { mout(MNEWARG); - moutId($2);$$=NULL;} - | EXPRESSION_SIMP - HDOT - EXPRESSION_SIMP { mout(MDOT);$$=NULL;} - | EXPRESSION_SIMP - HQUA HIDENTIFIER { mout(MQUA); - moutId($3);$$=NULL;} - ; -ARG_R_PT : /*EMPTY*/ { mout(MENDSEP);} - | HBEGPAR - ARGUMENT_LIST HENDPAR - ; -MBEE_ARG_R_PT : /*EMPTY*/ { mout(MIDENTIFIER); - moutId($0); - $$=$0;} - | HBEGPAR - ARGUMENT_LIST HENDPAR { mout(MARGUMENT); - moutId($0);} - ; -ARGUMENT_LIST : EXPRESSION { mout(MENDSEP); - mout(MARGUMENTSEP);} - | EXPRESSION - HPAREXPSEPARATOR - ARGUMENT_LIST { mout(MARGUMENTSEP);} - ; -%% -]]) - -# Pass plenty of options, to exercise plenty of code, even if we -# don't actually check the output. But SEGV is watching us, and -# so might do dmalloc. -AT_CHECK([[bison --verbose --defines input.y]], 0, [], -[[input.y: conflicts: 78 shift/reduce, 10 reduce/reduce -]]) - -AT_CHECK([[grep '^State.*conflicts:' input.output]], 0, -[[State 64 conflicts: 14 shift/reduce -State 164 conflicts: 1 shift/reduce -State 201 conflicts: 33 shift/reduce, 4 reduce/reduce -State 206 conflicts: 1 shift/reduce -State 240 conflicts: 1 shift/reduce -State 335 conflicts: 9 shift/reduce, 2 reduce/reduce -State 356 conflicts: 1 shift/reduce -State 360 conflicts: 9 shift/reduce, 2 reduce/reduce -State 427 conflicts: 9 shift/reduce, 2 reduce/reduce -]]) - -AT_CLEANUP - - -## ----------------- ## -## GNU pic Grammar. ## -## ----------------- ## - -AT_SETUP([GNU pic Grammar]) - -# GNU pic, part of groff. - -# Bison once reported shift/reduce conflicts that it shouldn't have. - -AT_DATA([[input.y]], -[[%union { - char *str; - int n; - double x; - struct { double x, y; } pair; - struct { double x; char *body; } if_data; - struct { char *str; const char *filename; int lineno; } lstr; - struct { double *v; int nv; int maxv; } dv; - struct { double val; int is_multiplicative; } by; - place pl; - object *obj; - corner crn; - path *pth; - object_spec *spec; - saved_state *pstate; - graphics_state state; - object_type obtype; -} - -%token LABEL -%token VARIABLE -%token NUMBER -%token TEXT -%token COMMAND_LINE -%token DELIMITED -%token ORDINAL -%token TH -%token LEFT_ARROW_HEAD -%token RIGHT_ARROW_HEAD -%token DOUBLE_ARROW_HEAD -%token LAST -%token UP -%token DOWN -%token LEFT -%token RIGHT -%token BOX -%token CIRCLE -%token ELLIPSE -%token ARC -%token LINE -%token ARROW -%token MOVE -%token SPLINE -%token HEIGHT -%token RADIUS -%token WIDTH -%token DIAMETER -%token FROM -%token TO -%token AT -%token WITH -%token BY -%token THEN -%token SOLID -%token DOTTED -%token DASHED -%token CHOP -%token SAME -%token INVISIBLE -%token LJUST -%token RJUST -%token ABOVE -%token BELOW -%token OF -%token THE -%token WAY -%token BETWEEN -%token AND -%token HERE -%token DOT_N -%token DOT_E -%token DOT_W -%token DOT_S -%token DOT_NE -%token DOT_SE -%token DOT_NW -%token DOT_SW -%token DOT_C -%token DOT_START -%token DOT_END -%token DOT_X -%token DOT_Y -%token DOT_HT -%token DOT_WID -%token DOT_RAD -%token SIN -%token COS -%token ATAN2 -%token LOG -%token EXP -%token SQRT -%token K_MAX -%token K_MIN -%token INT -%token RAND -%token SRAND -%token COPY -%token THRU -%token TOP -%token BOTTOM -%token UPPER -%token LOWER -%token SH -%token PRINT -%token CW -%token CCW -%token FOR -%token DO -%token IF -%token ELSE -%token ANDAND -%token OROR -%token NOTEQUAL -%token EQUALEQUAL -%token LESSEQUAL -%token GREATEREQUAL -%token LEFT_CORNER -%token RIGHT_CORNER -%token NORTH -%token SOUTH -%token EAST -%token WEST -%token CENTER -%token END -%token START -%token RESET -%token UNTIL -%token PLOT -%token THICKNESS -%token FILL -%token COLORED -%token OUTLINED -%token SHADED -%token ALIGNED -%token SPRINTF -%token COMMAND - -%left '.' - -/* this ensures that plot 17 "%g" parses as (plot 17 "%g") */ -%left PLOT -%left TEXT SPRINTF - -/* give text adjustments higher precedence than TEXT, so that -box "foo" above ljust == box ("foo" above ljust) -*/ - -%left LJUST RJUST ABOVE BELOW - -%left LEFT RIGHT -/* Give attributes that take an optional expression a higher -precedence than left and right, so that eg `line chop left' -parses properly. */ -%left CHOP SOLID DASHED DOTTED UP DOWN FILL COLORED OUTLINED -%left LABEL - -%left VARIABLE NUMBER '(' SIN COS ATAN2 LOG EXP SQRT K_MAX K_MIN INT RAND SRAND LAST -%left ORDINAL HERE '`' - -%left BOX CIRCLE ELLIPSE ARC LINE ARROW SPLINE '[' /* ] */ - -/* these need to be lower than '-' */ -%left HEIGHT RADIUS WIDTH DIAMETER FROM TO AT THICKNESS - -/* these must have higher precedence than CHOP so that `label %prec CHOP' -works */ -%left DOT_N DOT_E DOT_W DOT_S DOT_NE DOT_SE DOT_NW DOT_SW DOT_C -%left DOT_START DOT_END TOP BOTTOM LEFT_CORNER RIGHT_CORNER -%left UPPER LOWER NORTH SOUTH EAST WEST CENTER START END - -%left ',' -%left OROR -%left ANDAND -%left EQUALEQUAL NOTEQUAL -%left '<' '>' LESSEQUAL GREATEREQUAL - -%left BETWEEN OF -%left AND - -%left '+' '-' -%left '*' '/' '%' -%right '!' -%right '^' - -%type expr any_expr text_expr -%type optional_by -%type expr_pair position_not_place -%type simple_if -%type nth_primitive -%type corner -%type path label_path relative_path -%type place label element element_list middle_element_list -%type object_spec -%type position -%type object_type -%type optional_ordinal_last ordinal -%type until -%type sprintf_args -%type text print_args print_arg - -%% - -top: - optional_separator - | element_list - { - if (olist.head) - print_picture(olist.head); - } - ; - - -element_list: - optional_separator middle_element_list optional_separator - { $$ = $2; } - ; - -middle_element_list: - element - { $$ = $1; } - | middle_element_list separator element - { $$ = $1; } - ; - -optional_separator: - /* empty */ - | separator - ; - -separator: - ';' - | separator ';' - ; - -placeless_element: - VARIABLE '=' any_expr - { - define_variable($1, $3); - a_delete $1; - } - | VARIABLE ':' '=' any_expr - { - place *p = lookup_label($1); - if (!p) { - lex_error("variable `%1' not defined", $1); - YYABORT; - } - p->obj = 0; - p->x = $4; - p->y = 0.0; - a_delete $1; - } - | UP - { current_direction = UP_DIRECTION; } - | DOWN - { current_direction = DOWN_DIRECTION; } - | LEFT - { current_direction = LEFT_DIRECTION; } - | RIGHT - { current_direction = RIGHT_DIRECTION; } - | COMMAND_LINE - { - olist.append(make_command_object($1.str, $1.filename, - $1.lineno)); - } - | COMMAND print_args - { - olist.append(make_command_object($2.str, $2.filename, - $2.lineno)); - } - | PRINT print_args - { - fprintf(stderr, "%s\n", $2.str); - a_delete $2.str; - fflush(stderr); - } - | SH - { delim_flag = 1; } - DELIMITED - { - delim_flag = 0; - if (safer_flag) - lex_error("unsafe to run command `%1'", $3); - else - system($3); - a_delete $3; - } - | COPY TEXT - { - if (yychar < 0) - do_lookahead(); - do_copy($2.str); - // do not delete the filename - } - | COPY TEXT THRU - { delim_flag = 2; } - DELIMITED - { delim_flag = 0; } - until - { - if (yychar < 0) - do_lookahead(); - copy_file_thru($2.str, $5, $7); - // do not delete the filename - a_delete $5; - a_delete $7; - } - | COPY THRU - { delim_flag = 2; } - DELIMITED - { delim_flag = 0; } - until - { - if (yychar < 0) - do_lookahead(); - copy_rest_thru($4, $6); - a_delete $4; - a_delete $6; - } - | FOR VARIABLE '=' expr TO expr optional_by DO - { delim_flag = 1; } - DELIMITED - { - delim_flag = 0; - if (yychar < 0) - do_lookahead(); - do_for($2, $4, $6, $7.is_multiplicative, $7.val, $10); - } - | simple_if - { - if (yychar < 0) - do_lookahead(); - if ($1.x != 0.0) - push_body($1.body); - a_delete $1.body; - } - | simple_if ELSE - { delim_flag = 1; } - DELIMITED - { - delim_flag = 0; - if (yychar < 0) - do_lookahead(); - if ($1.x != 0.0) - push_body($1.body); - else - push_body($4); - a_delete $1.body; - a_delete $4; - } - | reset_variables - | RESET - { define_variable("scale", 1.0); } - ; - -reset_variables: - RESET VARIABLE - { - reset($2); - a_delete $2; - } - | reset_variables VARIABLE - { - reset($2); - a_delete $2; - } - | reset_variables ',' VARIABLE - { - reset($3); - a_delete $3; - } - ; - -print_args: - print_arg - { $$ = $1; } - | print_args print_arg - { - $$.str = new char[strlen($1.str) + strlen($2.str) + 1]; - strcpy($$.str, $1.str); - strcat($$.str, $2.str); - a_delete $1.str; - a_delete $2.str; - if ($1.filename) { - $$.filename = $1.filename; - $$.lineno = $1.lineno; - } - else if ($2.filename) { - $$.filename = $2.filename; - $$.lineno = $2.lineno; - } - } - ; - -print_arg: - expr %prec ',' - { - $$.str = new char[GDIGITS + 1]; - sprintf($$.str, "%g", $1); - $$.filename = 0; - $$.lineno = 0; - } - | text - { $$ = $1; } - | position %prec ',' - { - $$.str = new char[GDIGITS + 2 + GDIGITS + 1]; - sprintf($$.str, "%g, %g", $1.x, $1.y); - $$.filename = 0; - $$.lineno = 0; - } - ; - -simple_if: - IF any_expr THEN - { delim_flag = 1; } - DELIMITED - { - delim_flag = 0; - $$.x = $2; - $$.body = $5; - } - ; - -until: - /* empty */ - { $$ = 0; } - | UNTIL TEXT - { $$ = $2.str; } - ; - -any_expr: - expr - { $$ = $1; } - | text_expr - { $$ = $1; } - ; - -text_expr: - text EQUALEQUAL text - { - $$ = strcmp($1.str, $3.str) == 0; - a_delete $1.str; - a_delete $3.str; - } - | text NOTEQUAL text - { - $$ = strcmp($1.str, $3.str) != 0; - a_delete $1.str; - a_delete $3.str; - } - | text_expr ANDAND text_expr - { $$ = ($1 != 0.0 && $3 != 0.0); } - | text_expr ANDAND expr - { $$ = ($1 != 0.0 && $3 != 0.0); } - | expr ANDAND text_expr - { $$ = ($1 != 0.0 && $3 != 0.0); } - | text_expr OROR text_expr - { $$ = ($1 != 0.0 || $3 != 0.0); } - | text_expr OROR expr - { $$ = ($1 != 0.0 || $3 != 0.0); } - | expr OROR text_expr - { $$ = ($1 != 0.0 || $3 != 0.0); } - | '!' text_expr - { $$ = ($2 == 0.0); } - ; - - -optional_by: - /* empty */ - { - $$.val = 1.0; - $$.is_multiplicative = 0; - } - | BY expr - { - $$.val = $2; - $$.is_multiplicative = 0; - } - | BY '*' expr - { - $$.val = $3; - $$.is_multiplicative = 1; - } - ; - -element: - object_spec - { - $$.obj = $1->make_object(¤t_position, - ¤t_direction); - if ($$.obj == 0) - YYABORT; - delete $1; - if ($$.obj) - olist.append($$.obj); - else { - $$.x = current_position.x; - $$.y = current_position.y; - } - } - | LABEL ':' optional_separator element - { - $$ = $4; - define_label($1, & $$); - a_delete $1; - } - | LABEL ':' optional_separator position_not_place - { - $$.obj = 0; - $$.x = $4.x; - $$.y = $4.y; - define_label($1, & $$); - a_delete $1; - } - | LABEL ':' optional_separator place - { - $$ = $4; - define_label($1, & $$); - a_delete $1; - } - | '{' - { - $$.x = current_position.x; - $$.y = current_position.y; - $$.dir = current_direction; - } - element_list '}' - { - current_position.x = $2.x; - current_position.y = $2.y; - current_direction = $2.dir; - } - optional_element - { - $$ = $3; - } - | placeless_element - { - $$.obj = 0; - $$.x = current_position.x; - $$.y = current_position.y; - } - ; - -optional_element: - /* empty */ - {} - | element - {} - ; - -object_spec: - BOX - { $$ = new object_spec(BOX_OBJECT); } - | CIRCLE - { $$ = new object_spec(CIRCLE_OBJECT); } - | ELLIPSE - { $$ = new object_spec(ELLIPSE_OBJECT); } - | ARC - { - $$ = new object_spec(ARC_OBJECT); - $$->dir = current_direction; - } - | LINE - { - $$ = new object_spec(LINE_OBJECT); - lookup_variable("lineht", & $$->segment_height); - lookup_variable("linewid", & $$->segment_width); - $$->dir = current_direction; - } - | ARROW - { - $$ = new object_spec(ARROW_OBJECT); - lookup_variable("lineht", & $$->segment_height); - lookup_variable("linewid", & $$->segment_width); - $$->dir = current_direction; - } - | MOVE - { - $$ = new object_spec(MOVE_OBJECT); - lookup_variable("moveht", & $$->segment_height); - lookup_variable("movewid", & $$->segment_width); - $$->dir = current_direction; - } - | SPLINE - { - $$ = new object_spec(SPLINE_OBJECT); - lookup_variable("lineht", & $$->segment_height); - lookup_variable("linewid", & $$->segment_width); - $$->dir = current_direction; - } - | text %prec TEXT - { - $$ = new object_spec(TEXT_OBJECT); - $$->text = new text_item($1.str, $1.filename, $1.lineno); - } - | PLOT expr - { - $$ = new object_spec(TEXT_OBJECT); - $$->text = new text_item(format_number(0, $2), 0, -1); - } - | PLOT expr text - { - $$ = new object_spec(TEXT_OBJECT); - $$->text = new text_item(format_number($3.str, $2), - $3.filename, $3.lineno); - a_delete $3.str; - } - | '[' - { - saved_state *p = new saved_state; - $$ = p; - p->x = current_position.x; - p->y = current_position.y; - p->dir = current_direction; - p->tbl = current_table; - p->prev = current_saved_state; - current_position.x = 0.0; - current_position.y = 0.0; - current_table = new PTABLE(place); - current_saved_state = p; - olist.append(make_mark_object()); - } - element_list ']' - { - current_position.x = $2->x; - current_position.y = $2->y; - current_direction = $2->dir; - $$ = new object_spec(BLOCK_OBJECT); - olist.wrap_up_block(& $$->oblist); - $$->tbl = current_table; - current_table = $2->tbl; - current_saved_state = $2->prev; - delete $2; - } - | object_spec HEIGHT expr - { - $$ = $1; - $$->height = $3; - $$->flags |= HAS_HEIGHT; - } - | object_spec RADIUS expr - { - $$ = $1; - $$->radius = $3; - $$->flags |= HAS_RADIUS; - } - | object_spec WIDTH expr - { - $$ = $1; - $$->width = $3; - $$->flags |= HAS_WIDTH; - } - | object_spec DIAMETER expr - { - $$ = $1; - $$->radius = $3/2.0; - $$->flags |= HAS_RADIUS; - } - | object_spec expr %prec HEIGHT - { - $$ = $1; - $$->flags |= HAS_SEGMENT; - switch ($$->dir) { - case UP_DIRECTION: - $$->segment_pos.y += $2; - break; - case DOWN_DIRECTION: - $$->segment_pos.y -= $2; - break; - case RIGHT_DIRECTION: - $$->segment_pos.x += $2; - break; - case LEFT_DIRECTION: - $$->segment_pos.x -= $2; - break; - } - } - | object_spec UP - { - $$ = $1; - $$->dir = UP_DIRECTION; - $$->flags |= HAS_SEGMENT; - $$->segment_pos.y += $$->segment_height; - } - | object_spec UP expr - { - $$ = $1; - $$->dir = UP_DIRECTION; - $$->flags |= HAS_SEGMENT; - $$->segment_pos.y += $3; - } - | object_spec DOWN - { - $$ = $1; - $$->dir = DOWN_DIRECTION; - $$->flags |= HAS_SEGMENT; - $$->segment_pos.y -= $$->segment_height; - } - | object_spec DOWN expr - { - $$ = $1; - $$->dir = DOWN_DIRECTION; - $$->flags |= HAS_SEGMENT; - $$->segment_pos.y -= $3; - } - | object_spec RIGHT - { - $$ = $1; - $$->dir = RIGHT_DIRECTION; - $$->flags |= HAS_SEGMENT; - $$->segment_pos.x += $$->segment_width; - } - | object_spec RIGHT expr - { - $$ = $1; - $$->dir = RIGHT_DIRECTION; - $$->flags |= HAS_SEGMENT; - $$->segment_pos.x += $3; - } - | object_spec LEFT - { - $$ = $1; - $$->dir = LEFT_DIRECTION; - $$->flags |= HAS_SEGMENT; - $$->segment_pos.x -= $$->segment_width; - } - | object_spec LEFT expr - { - $$ = $1; - $$->dir = LEFT_DIRECTION; - $$->flags |= HAS_SEGMENT; - $$->segment_pos.x -= $3; - } - | object_spec FROM position - { - $$ = $1; - $$->flags |= HAS_FROM; - $$->from.x = $3.x; - $$->from.y = $3.y; - } - | object_spec TO position - { - $$ = $1; - if ($$->flags & HAS_SEGMENT) - $$->segment_list = new segment($$->segment_pos, - $$->segment_is_absolute, - $$->segment_list); - $$->flags |= HAS_SEGMENT; - $$->segment_pos.x = $3.x; - $$->segment_pos.y = $3.y; - $$->segment_is_absolute = 1; - $$->flags |= HAS_TO; - $$->to.x = $3.x; - $$->to.y = $3.y; - } - | object_spec AT position - { - $$ = $1; - $$->flags |= HAS_AT; - $$->at.x = $3.x; - $$->at.y = $3.y; - if ($$->type != ARC_OBJECT) { - $$->flags |= HAS_FROM; - $$->from.x = $3.x; - $$->from.y = $3.y; - } - } - | object_spec WITH path - { - $$ = $1; - $$->flags |= HAS_WITH; - $$->with = $3; - } - | object_spec WITH position %prec ',' - { - $$ = $1; - $$->flags |= HAS_WITH; - position pos; - pos.x = $3.x; - pos.y = $3.y; - $$->with = new path(pos); - } - | object_spec BY expr_pair - { - $$ = $1; - $$->flags |= HAS_SEGMENT; - $$->segment_pos.x += $3.x; - $$->segment_pos.y += $3.y; - } - | object_spec THEN - { - $$ = $1; - if ($$->flags & HAS_SEGMENT) { - $$->segment_list = new segment($$->segment_pos, - $$->segment_is_absolute, - $$->segment_list); - $$->flags &= ~HAS_SEGMENT; - $$->segment_pos.x = $$->segment_pos.y = 0.0; - $$->segment_is_absolute = 0; - } - } - | object_spec SOLID - { - $$ = $1; // nothing - } - | object_spec DOTTED - { - $$ = $1; - $$->flags |= IS_DOTTED; - lookup_variable("dashwid", & $$->dash_width); - } - | object_spec DOTTED expr - { - $$ = $1; - $$->flags |= IS_DOTTED; - $$->dash_width = $3; - } - | object_spec DASHED - { - $$ = $1; - $$->flags |= IS_DASHED; - lookup_variable("dashwid", & $$->dash_width); - } - | object_spec DASHED expr - { - $$ = $1; - $$->flags |= IS_DASHED; - $$->dash_width = $3; - } - | object_spec FILL - { - $$ = $1; - $$->flags |= IS_DEFAULT_FILLED; - } - | object_spec FILL expr - { - $$ = $1; - $$->flags |= IS_FILLED; - $$->fill = $3; - } - | object_spec SHADED text - { - $$ = $1; - $$->flags |= (IS_SHADED | IS_FILLED); - $$->shaded = new char[strlen($3.str)+1]; - strcpy($$->shaded, $3.str); - } - | object_spec COLORED text - { - $$ = $1; - $$->flags |= (IS_SHADED | IS_OUTLINED | IS_FILLED); - $$->shaded = new char[strlen($3.str)+1]; - strcpy($$->shaded, $3.str); - $$->outlined = new char[strlen($3.str)+1]; - strcpy($$->outlined, $3.str); - } - | object_spec OUTLINED text - { - $$ = $1; - $$->flags |= IS_OUTLINED; - $$->outlined = new char[strlen($3.str)+1]; - strcpy($$->outlined, $3.str); - } - | object_spec CHOP - { - $$ = $1; - // line chop chop means line chop 0 chop 0 - if ($$->flags & IS_DEFAULT_CHOPPED) { - $$->flags |= IS_CHOPPED; - $$->flags &= ~IS_DEFAULT_CHOPPED; - $$->start_chop = $$->end_chop = 0.0; - } - else if ($$->flags & IS_CHOPPED) { - $$->end_chop = 0.0; - } - else { - $$->flags |= IS_DEFAULT_CHOPPED; - } - } - | object_spec CHOP expr - { - $$ = $1; - if ($$->flags & IS_DEFAULT_CHOPPED) { - $$->flags |= IS_CHOPPED; - $$->flags &= ~IS_DEFAULT_CHOPPED; - $$->start_chop = 0.0; - $$->end_chop = $3; - } - else if ($$->flags & IS_CHOPPED) { - $$->end_chop = $3; - } - else { - $$->start_chop = $$->end_chop = $3; - $$->flags |= IS_CHOPPED; - } - } - | object_spec SAME - { - $$ = $1; - $$->flags |= IS_SAME; - } - | object_spec INVISIBLE - { - $$ = $1; - $$->flags |= IS_INVISIBLE; - } - | object_spec LEFT_ARROW_HEAD - { - $$ = $1; - $$->flags |= HAS_LEFT_ARROW_HEAD; - } - | object_spec RIGHT_ARROW_HEAD - { - $$ = $1; - $$->flags |= HAS_RIGHT_ARROW_HEAD; - } - | object_spec DOUBLE_ARROW_HEAD - { - $$ = $1; - $$->flags |= (HAS_LEFT_ARROW_HEAD|HAS_RIGHT_ARROW_HEAD); - } - | object_spec CW - { - $$ = $1; - $$->flags |= IS_CLOCKWISE; - } - | object_spec CCW - { - $$ = $1; - $$->flags &= ~IS_CLOCKWISE; - } - | object_spec text %prec TEXT - { - $$ = $1; - text_item **p; - for (p = & $$->text; *p; p = &(*p)->next) - ; - *p = new text_item($2.str, $2.filename, $2.lineno); - } - | object_spec LJUST - { - $$ = $1; - if ($$->text) { - text_item *p; - for (p = $$->text; p->next; p = p->next) - ; - p->adj.h = LEFT_ADJUST; - } - } - | object_spec RJUST - { - $$ = $1; - if ($$->text) { - text_item *p; - for (p = $$->text; p->next; p = p->next) - ; - p->adj.h = RIGHT_ADJUST; - } - } - | object_spec ABOVE - { - $$ = $1; - if ($$->text) { - text_item *p; - for (p = $$->text; p->next; p = p->next) - ; - p->adj.v = ABOVE_ADJUST; - } - } - | object_spec BELOW - { - $$ = $1; - if ($$->text) { - text_item *p; - for (p = $$->text; p->next; p = p->next) - ; - p->adj.v = BELOW_ADJUST; - } - } - | object_spec THICKNESS expr - { - $$ = $1; - $$->flags |= HAS_THICKNESS; - $$->thickness = $3; - } - | object_spec ALIGNED - { - $$ = $1; - $$->flags |= IS_ALIGNED; - } - ; - -text: - TEXT - { $$ = $1; } - | SPRINTF '(' TEXT sprintf_args ')' - { - $$.filename = $3.filename; - $$.lineno = $3.lineno; - $$.str = do_sprintf($3.str, $4.v, $4.nv); - a_delete $4.v; - a_delete $3.str; - } - ; - -sprintf_args: - /* empty */ - { - $$.v = 0; - $$.nv = 0; - $$.maxv = 0; - } - | sprintf_args ',' expr - { - $$ = $1; - if ($$.nv >= $$.maxv) { - if ($$.nv == 0) { - $$.v = new double[4]; - $$.maxv = 4; - } - else { - double *oldv = $$.v; - $$.maxv *= 2; - $$.v = new double[$$.maxv]; - memcpy($$.v, oldv, $$.nv*sizeof(double)); - a_delete oldv; - } - } - $$.v[$$.nv] = $3; - $$.nv += 1; - } - ; - -position: - position_not_place - { $$ = $1; } - | place - { - position pos = $1; - $$.x = pos.x; - $$.y = pos.y; - } - ; - -position_not_place: - expr_pair - { $$ = $1; } - | position '+' expr_pair - { - $$.x = $1.x + $3.x; - $$.y = $1.y + $3.y; - } - | position '-' expr_pair - { - $$.x = $1.x - $3.x; - $$.y = $1.y - $3.y; - } - | '(' position ',' position ')' - { - $$.x = $2.x; - $$.y = $4.y; - } - | expr between position AND position - { - $$.x = (1.0 - $1)*$3.x + $1*$5.x; - $$.y = (1.0 - $1)*$3.y + $1*$5.y; - } - | expr '<' position ',' position '>' - { - $$.x = (1.0 - $1)*$3.x + $1*$5.x; - $$.y = (1.0 - $1)*$3.y + $1*$5.y; - } - ; - -between: - BETWEEN - | OF THE WAY BETWEEN - ; - -expr_pair: - expr ',' expr - { - $$.x = $1; - $$.y = $3; - } - | '(' expr_pair ')' - { $$ = $2; } - ; - -place: - /* line at A left == line (at A) left */ - label %prec CHOP - { $$ = $1; } - | label corner - { - path pth($2); - if (!pth.follow($1, & $$)) - YYABORT; - } - | corner label - { - path pth($1); - if (!pth.follow($2, & $$)) - YYABORT; - } - | corner OF label - { - path pth($1); - if (!pth.follow($3, & $$)) - YYABORT; - } - | HERE - { - $$.x = current_position.x; - $$.y = current_position.y; - $$.obj = 0; - } - ; - -label: - LABEL - { - place *p = lookup_label($1); - if (!p) { - lex_error("there is no place `%1'", $1); - YYABORT; - } - $$ = *p; - a_delete $1; - } - | nth_primitive - { $$.obj = $1; } - | label '.' LABEL - { - path pth($3); - if (!pth.follow($1, & $$)) - YYABORT; - } - ; - -ordinal: - ORDINAL - { $$ = $1; } - | '`' any_expr TH - { - // XXX Check for overflow (and non-integers?). - $$ = (int)$2; - } - ; - -optional_ordinal_last: - LAST - { $$ = 1; } - | ordinal LAST - { $$ = $1; } - ; - -nth_primitive: - ordinal object_type - { - int count = 0; - object *p; - for (p = olist.head; p != 0; p = p->next) - if (p->type() == $2 && ++count == $1) { - $$ = p; - break; - } - if (p == 0) { - lex_error("there is no %1%2 %3", $1, ordinal_postfix($1), - object_type_name($2)); - YYABORT; - } - } - | optional_ordinal_last object_type - { - int count = 0; - object *p; - for (p = olist.tail; p != 0; p = p->prev) - if (p->type() == $2 && ++count == $1) { - $$ = p; - break; - } - if (p == 0) { - lex_error("there is no %1%2 last %3", $1, - ordinal_postfix($1), object_type_name($2)); - YYABORT; - } - } - ; - -object_type: - BOX - { $$ = BOX_OBJECT; } - | CIRCLE - { $$ = CIRCLE_OBJECT; } - | ELLIPSE - { $$ = ELLIPSE_OBJECT; } - | ARC - { $$ = ARC_OBJECT; } - | LINE - { $$ = LINE_OBJECT; } - | ARROW - { $$ = ARROW_OBJECT; } - | SPLINE - { $$ = SPLINE_OBJECT; } - | '[' ']' - { $$ = BLOCK_OBJECT; } - | TEXT - { $$ = TEXT_OBJECT; } - ; - -label_path: - '.' LABEL - { $$ = new path($2); } - | label_path '.' LABEL - { - $$ = $1; - $$->append($3); - } - ; - -relative_path: - corner %prec CHOP - { $$ = new path($1); } - /* give this a lower precedence than LEFT and RIGHT so that - [A: box] with .A left == [A: box] with (.A left) */ - | label_path %prec TEXT - { $$ = $1; } - | label_path corner - { - $$ = $1; - $$->append($2); - } - ; - -path: - relative_path - { $$ = $1; } - | '(' relative_path ',' relative_path ')' - { - $$ = $2; - $$->set_ypath($4); - } - /* The rest of these rules are a compatibility sop. */ - | ORDINAL LAST object_type relative_path - { - lex_warning("`%1%2 last %3' in `with' argument ignored", - $1, ordinal_postfix($1), object_type_name($3)); - $$ = $4; - } - | LAST object_type relative_path - { - lex_warning("`last %1' in `with' argument ignored", - object_type_name($2)); - $$ = $3; - } - | ORDINAL object_type relative_path - { - lex_warning("`%1%2 %3' in `with' argument ignored", - $1, ordinal_postfix($1), object_type_name($2)); - $$ = $3; - } - | LABEL relative_path - { - lex_warning("initial `%1' in `with' argument ignored", $1); - a_delete $1; - $$ = $2; - } - ; - -corner: - DOT_N - { $$ = &object::north; } - | DOT_E - { $$ = &object::east; } - | DOT_W - { $$ = &object::west; } - | DOT_S - { $$ = &object::south; } - | DOT_NE - { $$ = &object::north_east; } - | DOT_SE - { $$ = &object:: south_east; } - | DOT_NW - { $$ = &object::north_west; } - | DOT_SW - { $$ = &object::south_west; } - | DOT_C - { $$ = &object::center; } - | DOT_START - { $$ = &object::start; } - | DOT_END - { $$ = &object::end; } - | TOP - { $$ = &object::north; } - | BOTTOM - { $$ = &object::south; } - | LEFT - { $$ = &object::west; } - | RIGHT - { $$ = &object::east; } - | UPPER LEFT - { $$ = &object::north_west; } - | LOWER LEFT - { $$ = &object::south_west; } - | UPPER RIGHT - { $$ = &object::north_east; } - | LOWER RIGHT - { $$ = &object::south_east; } - | LEFT_CORNER - { $$ = &object::west; } - | RIGHT_CORNER - { $$ = &object::east; } - | UPPER LEFT_CORNER - { $$ = &object::north_west; } - | LOWER LEFT_CORNER - { $$ = &object::south_west; } - | UPPER RIGHT_CORNER - { $$ = &object::north_east; } - | LOWER RIGHT_CORNER - { $$ = &object::south_east; } - | NORTH - { $$ = &object::north; } - | SOUTH - { $$ = &object::south; } - | EAST - { $$ = &object::east; } - | WEST - { $$ = &object::west; } - | CENTER - { $$ = &object::center; } - | START - { $$ = &object::start; } - | END - { $$ = &object::end; } - ; - -expr: - VARIABLE - { - if (!lookup_variable($1, & $$)) { - lex_error("there is no variable `%1'", $1); - YYABORT; - } - a_delete $1; - } - | NUMBER - { $$ = $1; } - | place DOT_X - { - if ($1.obj != 0) - $$ = $1.obj->origin().x; - else - $$ = $1.x; - } - | place DOT_Y - { - if ($1.obj != 0) - $$ = $1.obj->origin().y; - else - $$ = $1.y; - } - | place DOT_HT - { - if ($1.obj != 0) - $$ = $1.obj->height(); - else - $$ = 0.0; - } - | place DOT_WID - { - if ($1.obj != 0) - $$ = $1.obj->width(); - else - $$ = 0.0; - } - | place DOT_RAD - { - if ($1.obj != 0) - $$ = $1.obj->radius(); - else - $$ = 0.0; - } - | expr '+' expr - { $$ = $1 + $3; } - | expr '-' expr - { $$ = $1 - $3; } - | expr '*' expr - { $$ = $1 * $3; } - | expr '/' expr - { - if ($3 == 0.0) { - lex_error("division by zero"); - YYABORT; - } - $$ = $1/$3; - } - | expr '%' expr - { - if ($3 == 0.0) { - lex_error("modulus by zero"); - YYABORT; - } - $$ = fmod($1, $3); - } - | expr '^' expr - { - errno = 0; - $$ = pow($1, $3); - if (errno == EDOM) { - lex_error("arguments to `^' operator out of domain"); - YYABORT; - } - if (errno == ERANGE) { - lex_error("result of `^' operator out of range"); - YYABORT; - } - } - | '-' expr %prec '!' - { $$ = -$2; } - | '(' any_expr ')' - { $$ = $2; } - | SIN '(' any_expr ')' - { - errno = 0; - $$ = sin($3); - if (errno == ERANGE) { - lex_error("sin result out of range"); - YYABORT; - } - } - | COS '(' any_expr ')' - { - errno = 0; - $$ = cos($3); - if (errno == ERANGE) { - lex_error("cos result out of range"); - YYABORT; - } - } - | ATAN2 '(' any_expr ',' any_expr ')' - { - errno = 0; - $$ = atan2($3, $5); - if (errno == EDOM) { - lex_error("atan2 argument out of domain"); - YYABORT; - } - if (errno == ERANGE) { - lex_error("atan2 result out of range"); - YYABORT; - } - } - | LOG '(' any_expr ')' - { - errno = 0; - $$ = log10($3); - if (errno == ERANGE) { - lex_error("log result out of range"); - YYABORT; - } - } - | EXP '(' any_expr ')' - { - errno = 0; - $$ = pow(10.0, $3); - if (errno == ERANGE) { - lex_error("exp result out of range"); - YYABORT; - } - } - | SQRT '(' any_expr ')' - { - errno = 0; - $$ = sqrt($3); - if (errno == EDOM) { - lex_error("sqrt argument out of domain"); - YYABORT; - } - } - | K_MAX '(' any_expr ',' any_expr ')' - { $$ = $3 > $5 ? $3 : $5; } - | K_MIN '(' any_expr ',' any_expr ')' - { $$ = $3 < $5 ? $3 : $5; } - | INT '(' any_expr ')' - { $$ = floor($3); } - | RAND '(' any_expr ')' - { $$ = 1.0 + floor(((rand()&0x7fff)/double(0x7fff))*$3); } - | RAND '(' ')' - { - /* return a random number in the range >=0, <1 */ - /* portable, but not very random */ - $$ = (rand() & 0x7fff) / double(0x8000); - } - | SRAND '(' any_expr ')' - { - $$ = 0; - srand((unsigned int)$3); - } - | expr '<' expr - { $$ = ($1 < $3); } - | expr LESSEQUAL expr - { $$ = ($1 <= $3); } - | expr '>' expr - { $$ = ($1 > $3); } - | expr GREATEREQUAL expr - { $$ = ($1 >= $3); } - | expr EQUALEQUAL expr - { $$ = ($1 == $3); } - | expr NOTEQUAL expr - { $$ = ($1 != $3); } - | expr ANDAND expr - { $$ = ($1 != 0.0 && $3 != 0.0); } - | expr OROR expr - { $$ = ($1 != 0.0 || $3 != 0.0); } - | '!' expr - { $$ = ($2 == 0.0); } - - ; -]]) - -# Pass plenty of options, to exercise plenty of code, even if we -# don't actually check the output. But SEGV is watching us, and -# so might do dmalloc. -AT_CHECK([[bison --verbose --defines input.y]], 0, [], []) - -AT_CLEANUP diff --git a/src/bin/bison/tests/glr-regression.at b/src/bin/bison/tests/glr-regression.at deleted file mode 100644 index b7d24ab7a8..0000000000 --- a/src/bin/bison/tests/glr-regression.at +++ /dev/null @@ -1,220 +0,0 @@ -# Checking GLR Parsing: Regression Tests -*- Autotest -*- -# Copyright (C) 2002, 2003 Free Software Foundation, Inc. - -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2, 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, write to the Free Software -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA -# 02111-1307, USA. - -AT_BANNER([[GLR Regression Tests]]) - -## --------------------------- ## -## Badly Collapsed GLR States. ## -## --------------------------- ## - -AT_SETUP([Badly Collapsed GLR States]) - -AT_DATA_GRAMMAR([glr-regr1.y], -[[/* Regression Test: Improper state compression */ -/* Reported by Scott McPeak */ - -%{ -#include - -#define YYSTYPE int -static YYSTYPE exprMerge (YYSTYPE x0, YYSTYPE x1); -int yylex (void); -int yyerror (char const *msg); -%} - - -%glr-parser - - -/* -------- productions ------ */ -%% - -StartSymbol: E { $$=0; } %merge - ; - -E: E 'P' E { $$=1; printf("E -> E 'P' E\n"); } %merge - | 'B' { $$=2; printf("E -> 'B'\n"); } %merge - ; - - - -/* ---------- C code ----------- */ -%% - -static YYSTYPE exprMerge (YYSTYPE x0, YYSTYPE x1) -{ - (void) x0; - (void) x1; - printf ("\n"); - return 0; -} - -int -main (void) -{ - return yyparse (); -} - -int -yyerror (char const *msg) -{ - fprintf (stderr, "%s\n", msg); - exit (4); -} - - -int -yylex (void) -{ - for (;;) - { - int ch = getchar (); - if (ch == EOF) - return 0; - else if (ch == 'B' || ch == 'P') - return ch; - } -} -]]) - -AT_CHECK([[bison -o glr-regr1.c glr-regr1.y]], 0, [], -[glr-regr1.y: conflicts: 1 shift/reduce -]) -AT_COMPILE([glr-regr1]) -AT_CHECK([[echo BPBPB | ./glr-regr1]], 0, -[[E -> 'B' -E -> 'B' -E -> E 'P' E -E -> 'B' -E -> E 'P' E -E -> 'B' -E -> E 'P' E -E -> E 'P' E - -]], []) - -AT_CLEANUP - -## ------------------------------------------------------------ ## -## Improper handling of embedded actions and $-N in GLR parsers ## -## ------------------------------------------------------------ ## - -AT_SETUP([Improper handling of embedded actions and $-N in GLR parsers]) - -AT_DATA_GRAMMAR([glr-regr2a.y], -[[/* Regression Test: Improper handling of embedded actions and $-N */ -/* Reported by S. Eken */ - -%{ - #define YYSTYPE char const * - #define yyfalse 0 - #define yytrue 1 - - #include - #include - #include - int yylex (void); - void yyerror (char const *); -%} - -%glr-parser - -%% - -command: - 's' var 't' - { printf ("Variable: '%s'\n", $2); } - 'v' 'x' 'q' - | 's' var_list 't' 'e' - { printf ("Varlist: '%s'\n", $2); } - | 's' var 't' var_printer 'x' - ; - -var: - 'V' - { $$ = $1; } - ; - -var_list: - var - { $$ = $1; } - | var ',' var_list - { - char buffer[50]; - strcpy (buffer, $1); - strcat (buffer, ","); - strcat (buffer, $3); - $$ = strdup (buffer); - } - ; - -var_printer: 'v' - { printf ("Variable: '%s'\n", $-1); } - -%% - -FILE *yyin = NULL; - -int -yylex (void) -{ - char buf[50]; - switch (fscanf (yyin, " %1[a-z,]", buf)) { - case 1: - return buf[0]; - case EOF: - return 0; - default: - break; - } - fscanf (yyin, "%s", buf); - yylval = strdup (buf); - return 'V'; -} - -void -yyerror (char const *s) -{ printf ("%s\n", s); -} - -int -main (int argc, char **argv) -{ - yyin = stdin; - if (argc == 2 && !(yyin = fopen (argv[1], "r"))) return 1; - return yyparse (); -} -]]) - -AT_CHECK([[bison -o glr-regr2a.c glr-regr2a.y]], 0, [], -[glr-regr2a.y: conflicts: 2 shift/reduce -]) -AT_COMPILE([glr-regr2a]) - -AT_CHECK([[echo s VARIABLE_1 t v x q | ./glr-regr2a]], 0, -[[Variable: 'VARIABLE_1' -]], []) -AT_CHECK([[echo s VARIABLE_1 , ANOTHER_VARIABLE_2 t e | ./glr-regr2a]], 0, -[[Varlist: 'VARIABLE_1,ANOTHER_VARIABLE_2' -]]) -AT_CHECK([[echo s VARIABLE_3 t v x | ./glr-regr2a]], 0, -[[Variable: 'VARIABLE_3' -]], []) - - -AT_CLEANUP diff --git a/src/bin/bison/tests/headers.at b/src/bin/bison/tests/headers.at deleted file mode 100644 index 7865341c77..0000000000 --- a/src/bin/bison/tests/headers.at +++ /dev/null @@ -1,136 +0,0 @@ -# Bison Parser Headers. -*- Autotest -*- -# Copyright 2001 Free Software Foundation, Inc. - -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2, 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, write to the Free Software -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA -# 02111-1307, USA. - -AT_BANNER([[Parser Headers.]]) - - -## ---------------------- ## -## %union and --defines. ## -## ---------------------- ## - - -AT_SETUP([%union and --defines]) - -AT_DATA([input.y], -[%union -{ - int integer; - char *string ; -} -%% -exp: {}; -]) - -AT_CHECK([bison --defines input.y]) - -AT_CLEANUP - - - -## --------------------- ## -## Invalid CPP headers. ## -## --------------------- ## - -# AT_TEST_CPP_GUARD_H([INPUT-FILE-BASE) -# ------------------------------------- -m4_define([AT_TEST_CPP_GUARD_H], -[AT_SETUP([Invalid CPP guards: $1]) - -# Possibly create inner directories. -dirname=`AS_DIRNAME([$1])` -AS_MKDIR_P([$dirname]) - -AT_DATA_GRAMMAR([$1.y], -[%{ -#include "$1.h" -%} -%% -dummy:; -%% -#include "$1.h" -]) - -AT_CHECK([bison --defines=$1.h --output=y.tab.c $1.y]) - -# CPP should be happy with it. -AT_CHECK([$CC -E -I. y.tab.c], 0, [ignore]) - -AT_CLEANUP -]) - -AT_TEST_CPP_GUARD_H([input/input]) -AT_TEST_CPP_GUARD_H([9foo]) - - - -## ---------------- ## -## export YYLTYPE. ## -## ---------------- ## - - -AT_SETUP([export YYLTYPE]) - -AT_DATA_GRAMMAR([input.y], -[%locations - -%name-prefix="my_" -%{ -#include -#include - -static int -my_lex (void) -{ - return EOF; -} - -static void -my_error (const char *msg) -{ - fprintf (stderr, "%s\n", msg); -} - -%} -%% -exp:; -]) - -AT_CHECK([bison --defines -o input.c input.y]) - -# YYLTYPE should be defined, and MY_LLOC declared. -AT_DATA([caller.c], -[[#include "input.h" -YYLTYPE *my_llocp = &my_lloc; - -int my_parse (void); - -int -main (void) -{ - return my_parse (); -} -]]) - -# Link and execute, just to make sure everything is fine (and in -# particular, that MY_LLOC is indeed defined somewhere). -AT_COMPILE([caller.o], [-c caller.c]) -AT_COMPILE([input.o], [-c input.c]) -AT_COMPILE([caller], [caller.o input.o]) -AT_PARSER_CHECK([./caller]) - -AT_CLEANUP diff --git a/src/bin/bison/tests/input.at b/src/bin/bison/tests/input.at deleted file mode 100644 index 4b3e4e2128..0000000000 --- a/src/bin/bison/tests/input.at +++ /dev/null @@ -1,237 +0,0 @@ -# Checking the Bison scanner. -*- Autotest -*- -# Copyright (C) 2002, 2003 Free Software Foundation, Inc. - -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2, 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, write to the Free Software -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA -# 02111-1307, USA. - -AT_BANNER([[Input Processing.]]) - -# Mostly test that we are robust to mistakes. - - -## ------------ ## -## Invalid $n. ## -## ------------ ## - -AT_SETUP([Invalid $n]) - -AT_DATA([input.y], -[[%% -exp: { $$ = $1 ; }; -]]) - -AT_CHECK([bison input.y], [1], [], -[[input.y:2.13-14: integer out of range: `$1' -]]) - -AT_CLEANUP - - -## ------------ ## -## Invalid @n. ## -## ------------ ## - -AT_SETUP([Invalid @n]) - -AT_DATA([input.y], -[[%% -exp: { @$ = @1 ; }; -]]) - -AT_CHECK([bison input.y], [1], [], -[[input.y:2.13-14: integer out of range: `@1' -]]) - -AT_CLEANUP - - -## -------------- ## -## Type Clashes. ## -## -------------- ## - -AT_SETUP([Type Clashes]) - -AT_DATA([input.y], -[[%token foo -%type exp -%% -exp: foo {} foo - | foo - | /* Empty. */ - ; -]]) - -AT_CHECK([bison input.y], [], [], -[[input.y:4.6-15: warning: type clash on default action: != <> -input.y:5.6-8: warning: type clash on default action: != <> -input.y:6.5: warning: empty rule for typed nonterminal, and no action -]]) - -AT_CLEANUP - - - -## ----------------------- ## -## Torturing the Scanner. ## -## ----------------------- ## - -# Be sure to compile and run, so that the C compiler checks what -# we do. - -AT_SETUP([Torturing the Scanner]) - - -AT_DATA([input.y], []) -AT_CHECK([bison input.y], [1], [], -[[input.y:1.1: syntax error, unexpected "end of file" -]]) - - -AT_DATA_GRAMMAR([input.y], -[[%{ -/* This is seen in GCC: a %{ and %} in middle of a comment. */ -const char *foo = "So %{ and %} can be here too."; - -#if 0 -/* These examples test Bison while not stressing C compilers too much. - Many C compilers mishandle backslash-newlines, so this part of the - test is inside "#if 0". The comment and string are written so that - the "#endif" will be seen regardless of the C compiler bugs that we - know about, namely: - - HP C (as of late 2002) mishandles *\[newline]\[newline]/ within a - comment. - - The Apple Darwin compiler (as of late 2002) mishandles - \\[newline]' within a character constant. - - */ - -/\ -* A comment with backslash-newlines in it. %} *\ -\ -/ -/* { Close the above comment, if the C compiler mishandled it. */ - -char str[] = "\\ -" A string with backslash-newlines in it %{ %} \\ -\ -""; - -char apostrophe = '\''; -#endif - -#include -%} -/* %{ and %} can be here too. */ - -%{ -/* Exercise pre-prologue dependency to %union. */ -typedef int value; -%} - -/* Exercise M4 quoting: '@:>@@:>@', 0. */ - -/* Also exercise %union. */ -%union -{ - value ival; /* A comment to exercise an old bug. */ -}; - - -/* Exercise post-prologue dependency to %union. */ -%{ -static YYSTYPE value_as_yystype (value val); - -/* Exercise quotes in declarations. */ -char quote[] = "@:>@@:>@,"; -%} - -%{ -static void yyerror (const char *s); -static int yylex (void); -%} - -%type '@<:@' - -/* Exercise quotes in strings. */ -%token FAKE "fake @<:@@:>@ \a\b\f\n\r\t\v\"\'\?\\\u005B\U0000005c ??!??'??(??)??-??/?? \x1\1" - -%% -/* Exercise M4 quoting: '@:>@@:>@', @<:@, 1. */ -exp: '@<:@' '\1' two '$' '@' '{' oline output.or.oline.opt - { - /* Exercise quotes in braces. */ - char tmp[] = "@<:@%c@:>@,\n"; - printf (tmp, $1); - } -; - -two: '\x000000000000000000000000000000000000000000000000000000000000000000002'; -oline: '@' 'o' 'l' 'i' 'n' 'e' '@' '_' '_' 'o' 'l' 'i' 'n' 'e' '_' '_'; -output.or.oline.opt: ;|oline;;|output;;; -output: '#' 'o' 'u' 't' 'p' 'u' 't' ' '; -%% -/* Exercise M4 quoting: '@:>@@:>@', @<:@, 2. */ - -static YYSTYPE -value_as_yystype (value val) -{ - YYSTYPE res; - res.ival = val; - return res; -} - -static int -yylex (void) -{ - static const char *input = "@<:@\1\2$@{@oline@__@&t@oline__\ -#output "; /* " - */ - yylval = value_as_yystype (*input); - return *input++; -} - -static void -yyerror (const char *msg) -{ - fprintf (stderr, "%s\n", msg); -} -]]) - -# Pacify Emacs'font-lock-mode: " - -AT_DATA([main.c], -[[typedef int value; -#include "input.h" - -int yyparse (void); - -int -main (void) -{ - return yyparse (); -} -]]) - -AT_CHECK([bison -d -v -o input.c input.y]) -AT_COMPILE([input.o], [-c input.c]) -AT_COMPILE([main.o], [-c main.c]) -AT_COMPILE([input], [input.o main.o]) -AT_PARSER_CHECK([./input], 0, -[[[@<:@], -]]) - -AT_CLEANUP diff --git a/src/bin/bison/tests/local.at b/src/bin/bison/tests/local.at deleted file mode 100644 index 7ff9f3b44c..0000000000 --- a/src/bin/bison/tests/local.at +++ /dev/null @@ -1,206 +0,0 @@ -# Process this -*- Autotest -*- file with autom4te. - -# Macros for the GNU Bison Test suite. -# Copyright (C) 2003 Free Software Foundation, Inc. - -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2, 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, write to the Free Software -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA -# 02111-1307, USA. - -# We want a recent Autotest. -m4_version_prereq([2.58]) - - -## ------------------------------- ## -## Macros decoding Bison options. ## -## ------------------------------- ## - - -# AT_BISON_OPTION_PUSHDEFS([BISON-OPTIONS]) -# ----------------------------------------- -m4_define([AT_BISON_OPTION_PUSHDEFS], -[_AT_BISON_OPTION_PUSHDEFS($[1], $[2], [$1])]) - - -# _AT_BISON_OPTION_PUSHDEFS($1, $2, [BISON-OPTIONS]) -# -------------------------------------------------- -# This macro works around the impossibility to define macros -# inside macros, because issuing `[$1]' is not possible in M4 :(. -# This sucks hard, GNU M4 should really provide M5 like $$1. -m4_define([_AT_BISON_OPTION_PUSHDEFS], -[m4_if([$1$2], $[1]$[2], [], - [m4_fatal([$0: Invalid arguments: $@])])dnl -m4_pushdef([AT_LALR1_CC_IF], -[m4_bmatch([$3], ["lalr1.cc"], [$1], [$2])]) -m4_pushdef([AT_GLR_IF], -[m4_bmatch([$3], [%glr-parser], [$1], [$2])]) -# Using yacc.c? -m4_pushdef([AT_YACC_IF], -[m4_bmatch([$3], [%glr-parser\|%skeleton], [$2], [$1])]) -m4_pushdef([AT_PARAM_IF], -[m4_bmatch([$3], [%parse-param], [$1], [$2])]) -m4_pushdef([AT_LOCATION_IF], -[m4_bmatch([$3], [%locations], [$1], [$2])]) -m4_pushdef([AT_PURE_IF], -[m4_bmatch([$3], [%pure-parser], [$1], [$2])]) -m4_pushdef([AT_PURE_AND_LOC_IF], -[m4_bmatch([$3], [%locations.*%pure-parser\|%pure-parser.*%locations], - [$1], [$2])]) -m4_pushdef([AT_GLR_OR_PARAM_IF], -[m4_bmatch([$3], [%glr-parser\|%parse-param], [$1], [$2])]) - -# yyerror receives the location if %location & %pure & (%glr or %parse-param). -m4_pushdef([AT_YYERROR_ARG_LOC_IF], -[AT_GLR_OR_PARAM_IF([AT_PURE_AND_LOC_IF([$1], [$2])], - [$2])]) -# yyerror always sees the locations (when activated), except if -# yacc & pure & !param. -m4_pushdef([AT_YYERROR_SEES_LOC_IF], -[AT_LOCATION_IF([AT_YACC_IF([AT_PURE_IF([AT_PARAM_IF([$1], [$2])], - [$1])], - [$1])], - [$2])]) - -# The interface is pure: either because %pure-parser, or because we -# are using the C++ parsers. -m4_pushdef([AT_PURE_LEX_IF], -[AT_PURE_IF([$1], - [AT_LALR1_CC_IF([$1], [$2])])]) - -AT_PURE_LEX_IF( -[m4_pushdef([AT_LOC], [(*yylloc)]) - m4_pushdef([AT_VAL], [(*yylval)]) - m4_pushdef([AT_LEX_FORMALS], - [YYSTYPE *yylval[]AT_LOCATION_IF([, YYLTYPE *yylloc])]) - m4_pushdef([AT_LEX_ARGS], - [yylval[]AT_LOCATION_IF([, yylloc])]) - m4_pushdef([AT_USE_LEX_ARGS], - [(void) yylval;AT_LOCATION_IF([(void) yylloc])]) - m4_pushdef([AT_LEX_PRE_FORMALS], - [AT_LEX_FORMALS, ]) - m4_pushdef([AT_LEX_PRE_ARGS], - [AT_LEX_ARGS, ]) -], -[m4_pushdef([AT_LOC], [(yylloc)]) - m4_pushdef([AT_VAL], [(yylval)]) - m4_pushdef([AT_LEX_FORMALS], [void]) - m4_pushdef([AT_LEX_ARGS], []) - m4_pushdef([AT_USE_LEX_ARGS], []) - m4_pushdef([AT_LEX_PRE_FORMALS], []) - m4_pushdef([AT_LEX_PRE_ARGS], []) -]) -])# _AT_BISON_OPTION_PUSHDEFS - - -# AT_BISON_OPTION_POPDEFS -# ----------------------- -m4_define([AT_BISON_OPTION_POPDEFS], -[m4_popdef([AT_LEX_PRE_ARGS]) -m4_popdef([AT_LEX_PRE_FORMALS]) -m4_popdef([AT_USE_LEX_ARGS]) -m4_popdef([AT_LEX_ARGS]) -m4_popdef([AT_LEX_FORMALS]) -m4_popdef([AT_VAL]) -m4_popdef([AT_LOC]) -m4_popdef([AT_PURE_LEX_IF]) -m4_popdef([AT_YYERROR_SEES_LOC_IF]) -m4_popdef([AT_YYERROR_ARG_LOC_IF]) -m4_popdef([AT_GLR_OR_PARAM_IF]) -m4_popdef([AT_PURE_AND_LOC_IF]) -m4_popdef([AT_LOCATION_IF]) -m4_popdef([AT_PARAM_IF]) -m4_popdef([AT_YACC_IF]) -m4_popdef([AT_GLR_IF]) -m4_popdef([AT_LALR1_CC_IF]) -])# AT_BISON_OPTION_POPDEFS - - - -## -------------------------- ## -## Generating Grammar Files. ## -## -------------------------- ## - - -# AT_DATA_GRAMMAR_PROLOGUE -# ------------------------ -# The prologue that should be included in any grammar which parser is -# meant to be compiled. -m4_define([AT_DATA_GRAMMAR_PROLOGUE], -[[%{ -#if HAVE_CONFIG_H -# include - /* We don't need perfect functions for these tests. */ -# undef malloc -# undef memcmp -# undef realloc -#endif -%}] -]) - - -# AT_DATA_GRAMMAR(NAME, CONTENT) -# ------------------------------ -# Generate the file NAME, which CONTENT is preceded by -# AT_DATA_GRAMMAR_PROLOGUE. -m4_define([AT_DATA_GRAMMAR], -[AT_DATA([$1], -[AT_DATA_GRAMMAR_PROLOGUE -$2]) -]) - - -## ------------------------ ## -## Compiling C, C++ Files. ## -## ------------------------ ## - - -# AT_COMPILE(OUTPUT, [SOURCES = OUTPUT.c]) -# ---------------------------------------- -# Compile SOURCES into OUTPUT. If OUTPUT does not contain '.', -# assume that we are linking too; this is a hack. -m4_define([AT_COMPILE], -[AT_CHECK([$CC $CFLAGS $CPPFLAGS m4_bmatch([$1], [[.]], [], [$LDFLAGS ])m4_default([$2], [$1.c]) m4_bmatch([$1], [[.]], [], [$LIBS ])-o $1], - 0, [ignore], [ignore])]) - -# AT_COMPILE_CXX(OUTPUT, [SOURCES = OUTPUT.c]) -# -------------------------------------------- -# If the C++ compiler is not defined, ignore the test. -m4_define([AT_COMPILE_CXX], -[AT_KEYWORDS(c++) -AT_CHECK([$CXX --version || exit 77], 0, ignore, ignore) -AT_CHECK([$CXX $CXXFLAGS $CPPFLAGS m4_default([$2], [$1.c]) -o $1], - 0, [ignore], [ignore])]) - - - -## ---------------------------- ## -## Running a generated parser. ## -## ---------------------------- ## - -# AT_PARSER_CHECK(COMMAND, EXIT-STATUS, EXPOUT, EXPERR) -# ----------------------------------------------------- -# So that we can run `./testsuite PREPARSER='valgrind -q' for instance. -m4_define([AT_PARSER_CHECK], -[AT_CHECK([$PREPARSER $1], [$2], [$3], [$4])]) - - - - -## ----------------------- ## -## Launch the test suite. ## -## ----------------------- ## - -AT_INIT - -AT_TESTED([bison]) diff --git a/src/bin/bison/tests/output.at b/src/bin/bison/tests/output.at deleted file mode 100644 index 147e8b28ad..0000000000 --- a/src/bin/bison/tests/output.at +++ /dev/null @@ -1,83 +0,0 @@ -# Checking the output filenames. -*- Autotest -*- -# Copyright 2000, 2001 Free Software Foundation, Inc. - -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2, 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, write to the Free Software -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA -# 02111-1307, USA. - -AT_BANNER([[Output file names.]]) - - -# AT_CHECK_OUTPUT(INPUT-FILE, [DIRECTIVES], [FLAGS], EXPECTED-FILES) -# ------------------------------------------------------------------ -m4_define([AT_CHECK_OUTPUT], -[AT_SETUP([Output files: $2 & $3.]) -AT_DATA([$1], -[[$2 -%% -foo: {}; -]]) - -AT_CHECK([bison $3 $1], 0) -AT_CHECK([ls $4], [], [ignore]) -AT_CLEANUP -]) - -AT_CHECK_OUTPUT([foo.y], [], [-dv], - [foo.output foo.tab.c foo.tab.h]) -AT_CHECK_OUTPUT([foo.y], [], [-dv -o foo.c], - [foo.c foo.h foo.output]) -AT_CHECK_OUTPUT([foo.y], [], [-dv -o foo.tab.c], - [foo.output foo.tab.c foo.tab.h]) -AT_CHECK_OUTPUT([foo.y], [], [-dv -y], - [y.output y.tab.c y.tab.h]) -AT_CHECK_OUTPUT([foo.y], [], [-dv -b bar], - [bar.output bar.tab.c bar.tab.h]) -AT_CHECK_OUTPUT([foo.y], [], [-dv -g -o foo.c], - [foo.c foo.h foo.output foo.vcg]) - - -AT_CHECK_OUTPUT([foo.y], [%defines %verbose], [], - [foo.output foo.tab.c foo.tab.h]) -AT_CHECK_OUTPUT([foo.y], [%defines %verbose %yacc],[], - [y.output y.tab.c y.tab.h]) - -AT_CHECK_OUTPUT([foo.yy], [%defines %verbose %yacc],[], - [y.output y.tab.c y.tab.h]) - -# Exercise %output and %file-prefix -AT_CHECK_OUTPUT([foo.y], [%file-prefix="bar" %defines %verbose], [], - [bar.output bar.tab.c bar.tab.h]) -AT_CHECK_OUTPUT([foo.y], [%output="bar.c" %defines %verbose %yacc],[], - [bar.output bar.c bar.h]) -AT_CHECK_OUTPUT([foo.y], - [%file-prefix="baz" %output="bar.c" %defines %verbose %yacc], - [], - [bar.output bar.c bar.h]) - - -# Check priorities of extension control. -AT_CHECK_OUTPUT([foo.yy], [%defines %verbose], [], - [foo.output foo.tab.cc foo.tab.hh]) - -AT_CHECK_OUTPUT([foo.yy], [%defines %verbose ], [-o foo.c], - [foo.c foo.h foo.output]) - -AT_CHECK_OUTPUT([foo.yy], [], - [--defines=foo.hpp -o foo.c++], - [foo.c++ foo.hpp]) - -AT_CHECK_OUTPUT([foo.yy], [], - [-o foo.c++ --graph=foo.gph], - [foo.c++ foo.gph]) diff --git a/src/bin/bison/tests/package.m4 b/src/bin/bison/tests/package.m4 deleted file mode 100644 index a2ac18d0ea..0000000000 --- a/src/bin/bison/tests/package.m4 +++ /dev/null @@ -1,6 +0,0 @@ -# Signature of the current package. -m4_define([AT_PACKAGE_NAME], [GNU Bison]) -m4_define([AT_PACKAGE_TARNAME], [bison]) -m4_define([AT_PACKAGE_VERSION], [1.875d]) -m4_define([AT_PACKAGE_STRING], [GNU Bison 1.875d]) -m4_define([AT_PACKAGE_BUGREPORT], [bug-bison@gnu.org]) diff --git a/src/bin/bison/tests/reduce.at b/src/bin/bison/tests/reduce.at deleted file mode 100644 index c6e501fa9a..0000000000 --- a/src/bin/bison/tests/reduce.at +++ /dev/null @@ -1,355 +0,0 @@ -# Exercising Bison Grammar Reduction. -*- Autotest -*- -# Copyright (C) 2001, 2002 Free Software Foundation, Inc. - -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2, 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, write to the Free Software -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA -# 02111-1307, USA. - -AT_BANNER([[Grammar Reduction.]]) - - -## ------------------- ## -## Useless Terminals. ## -## ------------------- ## - -AT_SETUP([Useless Terminals]) - -AT_DATA([[input.y]], -[[%verbose -%output="input.c" - -%token useless1 -%token useless2 -%token useless3 -%token useless4 -%token useless5 -%token useless6 -%token useless7 -%token useless8 -%token useless9 - -%token useful -%% -exp: useful; -]]) - -AT_CHECK([[bison input.y]]) - -AT_CHECK([[sed -n '/^Grammar/q;/^$/!p' input.output]], 0, -[[Terminals which are not used - useless1 - useless2 - useless3 - useless4 - useless5 - useless6 - useless7 - useless8 - useless9 -]]) - -AT_CLEANUP - - - -## ---------------------- ## -## Useless Nonterminals. ## -## ---------------------- ## - -AT_SETUP([Useless Nonterminals]) - -AT_DATA([[input.y]], -[[%verbose -%output="input.c" - -%nterm useless1 -%nterm useless2 -%nterm useless3 -%nterm useless4 -%nterm useless5 -%nterm useless6 -%nterm useless7 -%nterm useless8 -%nterm useless9 - -%token useful -%% -exp: useful; -]]) - -AT_CHECK([[bison input.y]], 0, [], -[[input.y: warning: 9 useless nonterminals -input.y:4.8-15: warning: useless nonterminal: useless1 -input.y:5.8-15: warning: useless nonterminal: useless2 -input.y:6.8-15: warning: useless nonterminal: useless3 -input.y:7.8-15: warning: useless nonterminal: useless4 -input.y:8.8-15: warning: useless nonterminal: useless5 -input.y:9.8-15: warning: useless nonterminal: useless6 -input.y:10.8-15: warning: useless nonterminal: useless7 -input.y:11.8-15: warning: useless nonterminal: useless8 -input.y:12.8-15: warning: useless nonterminal: useless9 -]]) - -AT_CHECK([[sed -n '/^Grammar/q;/^$/!p' input.output]], 0, -[[Useless nonterminals - useless1 - useless2 - useless3 - useless4 - useless5 - useless6 - useless7 - useless8 - useless9 -]]) - -AT_CLEANUP - - - -## --------------- ## -## Useless Rules. ## -## --------------- ## - -AT_SETUP([Useless Rules]) - -AT_KEYWORDS([report]) - -AT_DATA([[input.y]], -[[%verbose -%output="input.c" -%token useful -%% -exp: useful; -useless1: '1'; -useless2: '2'; -useless3: '3'; -useless4: '4'; -useless5: '5'; -useless6: '6'; -useless7: '7'; -useless8: '8'; -useless9: '9'; -]]) - -AT_CHECK([[bison input.y]], 0, [], -[[input.y: warning: 9 useless nonterminals and 9 useless rules -input.y:6.1-8: warning: useless nonterminal: useless1 -input.y:7.1-8: warning: useless nonterminal: useless2 -input.y:8.1-8: warning: useless nonterminal: useless3 -input.y:9.1-8: warning: useless nonterminal: useless4 -input.y:10.1-8: warning: useless nonterminal: useless5 -input.y:11.1-8: warning: useless nonterminal: useless6 -input.y:12.1-8: warning: useless nonterminal: useless7 -input.y:13.1-8: warning: useless nonterminal: useless8 -input.y:14.1-8: warning: useless nonterminal: useless9 -input.y:6.11-13: warning: useless rule: useless1: '1' -input.y:7.11-13: warning: useless rule: useless2: '2' -input.y:8.11-13: warning: useless rule: useless3: '3' -input.y:9.11-13: warning: useless rule: useless4: '4' -input.y:10.11-13: warning: useless rule: useless5: '5' -input.y:11.11-13: warning: useless rule: useless6: '6' -input.y:12.11-13: warning: useless rule: useless7: '7' -input.y:13.11-13: warning: useless rule: useless8: '8' -input.y:14.11-13: warning: useless rule: useless9: '9' -]]) - -AT_CHECK([[sed -n '/^Grammar/q;/^$/!p' input.output]], 0, -[[Useless nonterminals - useless1 - useless2 - useless3 - useless4 - useless5 - useless6 - useless7 - useless8 - useless9 -Terminals which are not used - '1' - '2' - '3' - '4' - '5' - '6' - '7' - '8' - '9' -Useless rules - 2 useless1: '1' - 3 useless2: '2' - 4 useless3: '3' - 5 useless4: '4' - 6 useless5: '5' - 7 useless6: '6' - 8 useless7: '7' - 9 useless8: '8' - 10 useless9: '9' -]]) - -AT_CLEANUP - - - -## ------------------- ## -## Reduced Automaton. ## -## ------------------- ## - -# Check that the automaton is that as the for the grammar reduced by -# hand. - -AT_SETUP([Reduced Automaton]) - -AT_KEYWORDS([report]) - -# The non reduced grammar. -# ------------------------ -AT_DATA([[not-reduced.y]], -[[/* A useless token. */ -%token useless_token -/* A useful one. */ -%token useful -%verbose -%output="not-reduced.c" - -%% - -exp: useful { /* A useful action. */ } - | non_productive { /* A non productive action. */ } - ; - -not_reachable: useful { /* A not reachable action. */ } - ; - -non_productive: non_productive useless_token - { /* Another non productive action. */ } - ; -%% -]]) - -AT_CHECK([[bison not-reduced.y]], 0, [], -[[not-reduced.y: warning: 2 useless nonterminals and 3 useless rules -not-reduced.y:14.1-13: warning: useless nonterminal: not_reachable -not-reduced.y:11.6-19: warning: useless nonterminal: non_productive -not-reduced.y:11.6-57: warning: useless rule: exp: non_productive -not-reduced.y:14.16-56: warning: useless rule: not_reachable: useful -not-reduced.y:17.17-18.63: warning: useless rule: non_productive: non_productive useless_token -]]) - -AT_CHECK([[sed -n '/^Grammar/q;/^$/!p' not-reduced.output]], 0, -[[Useless nonterminals - not_reachable - non_productive -Terminals which are not used - useless_token -Useless rules - 2 exp: non_productive - 3 not_reachable: useful - 4 non_productive: non_productive useless_token -]]) - -# The reduced grammar. -# -------------------- -AT_DATA([[reduced.y]], -[[/* A useless token. */ -%token useless_token -/* A useful one. */ -%token useful -%verbose -%output="reduced.c" - -%% - -exp: useful { /* A useful action. */ } -// | non_productive { /* A non productive action. */ } */ - ; - -//not_reachable: useful { /* A not reachable action. */ } -// ; - -//non_productive: non_productive useless_token -// { /* Another non productive action. */ } -// ; -%% -]]) - -AT_CHECK([[bison reduced.y]]) - -# Comparing the parsers. -cp reduced.c expout -AT_CHECK([sed 's/not-reduced/reduced/g' not-reduced.c], 0, [expout]) - -AT_CLEANUP - - - -## ------------------- ## -## Underivable Rules. ## -## ------------------- ## - -AT_SETUP([Underivable Rules]) - -AT_KEYWORDS([report]) - -AT_DATA([[input.y]], -[[%verbose -%output="input.c" -%token useful -%% -exp: useful | underivable; -underivable: indirection; -indirection: underivable; -]]) - -AT_CHECK([[bison input.y]], 0, [], -[[input.y: warning: 2 useless nonterminals and 3 useless rules -input.y:5.15-25: warning: useless nonterminal: underivable -input.y:6.14-24: warning: useless nonterminal: indirection -input.y:5.15-25: warning: useless rule: exp: underivable -input.y:6.14-24: warning: useless rule: underivable: indirection -input.y:7.14-24: warning: useless rule: indirection: underivable -]]) - -AT_CHECK([[sed -n '/^Grammar/q;/^$/!p' input.output]], 0, -[[Useless nonterminals - underivable - indirection -Useless rules - 2 exp: underivable - 3 underivable: indirection - 4 indirection: underivable -]]) - -AT_CLEANUP - - - -## ---------------- ## -## Empty Language. ## -## ---------------- ## - -AT_SETUP([Empty Language]) - -AT_DATA([[input.y]], -[[%output="input.c" -%% -exp: exp; -]]) - -AT_CHECK([[bison input.y]], 1, [], -[[input.y: warning: 2 useless nonterminals and 2 useless rules -input.y:3.1-3: fatal error: start symbol exp does not derive any sentence -]]) - -AT_CLEANUP diff --git a/src/bin/bison/tests/regression.at b/src/bin/bison/tests/regression.at deleted file mode 100644 index 94422bd3e1..0000000000 --- a/src/bin/bison/tests/regression.at +++ /dev/null @@ -1,794 +0,0 @@ -# Bison Regressions. -*- Autotest -*- -# Copyright (C) 2001, 2002, 2003, 2004 Free Software Foundation, Inc. - -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2, 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, write to the Free Software -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA -# 02111-1307, USA. - -AT_BANNER([[Regression tests.]]) - - -## ------------------------- ## -## Early token definitions. ## -## ------------------------- ## - - -AT_SETUP([Early token definitions]) - -# Found in GCJ: they expect the tokens to be defined before the user -# prologue, so that they can use the token definitions in it. - -AT_DATA_GRAMMAR([input.y], -[[%{ -void yyerror (const char *s); -int yylex (void); -%} - -%union -{ - int val; -}; -%{ -#ifndef MY_TOKEN -# error "MY_TOKEN not defined." -#endif -%} -%token MY_TOKEN -%% -exp: MY_TOKEN; -%% -]]) - -AT_CHECK([bison -o input.c input.y]) -AT_COMPILE([input.o], [-c input.c]) - -AT_CLEANUP - - - -## ---------------- ## -## Braces parsing. ## -## ---------------- ## - - -AT_SETUP([Braces parsing]) - -AT_DATA([input.y], -[[/* Bison used to swallow the character after `}'. */ - -%% -exp: { tests = {{{{{{{{{{}}}}}}}}}}; }; -%% -]]) - -AT_CHECK([bison -v -o input.c input.y]) - -AT_CHECK([grep 'tests = {{{{{{{{{{}}}}}}}}}};' input.c], 0, [ignore]) - -AT_CLEANUP - - -## ------------------ ## -## Duplicate string. ## -## ------------------ ## - - -AT_SETUP([Duplicate string]) - -AT_DATA([input.y], -[[/* `Bison -v' used to dump core when two tokens are defined with the same - string, as LE and GE below. */ - -%token NUM -%token LE "<=" -%token GE "<=" - -%% -exp: '(' exp ')' | NUM ; -%% -]]) - -AT_CHECK([bison -v -o input.c input.y], 0, [], -[[input.y:6.8-14: warning: symbol `"<="' used more than once as a literal string -]]) - -AT_CLEANUP - - -## ------------------- ## -## Rule Line Numbers. ## -## ------------------- ## - -AT_SETUP([Rule Line Numbers]) - -AT_KEYWORDS([report]) - -AT_DATA([input.y], -[[%% -expr: -'a' - -{ - -} - -'b' - -{ - -} - -| - - -{ - - -} - -'c' - -{ - -}; -]]) - -AT_CHECK([bison -o input.c -v input.y]) - -# Check the contents of the report. -AT_CHECK([cat input.output], [], -[[Grammar - - 0 $accept: expr $end - - 1 @1: /* empty */ - - 2 expr: 'a' @1 'b' - - 3 @2: /* empty */ - - 4 expr: @2 'c' - - -Terminals, with rules where they appear - -$end (0) 0 -'a' (97) 2 -'b' (98) 2 -'c' (99) 4 -error (256) - - -Nonterminals, with rules where they appear - -$accept (6) - on left: 0 -expr (7) - on left: 2 4, on right: 0 -@1 (8) - on left: 1, on right: 2 -@2 (9) - on left: 3, on right: 4 - - -state 0 - - 0 $accept: . expr $end - - 'a' shift, and go to state 1 - - $default reduce using rule 3 (@2) - - expr go to state 2 - @2 go to state 3 - - -state 1 - - 2 expr: 'a' . @1 'b' - - $default reduce using rule 1 (@1) - - @1 go to state 4 - - -state 2 - - 0 $accept: expr . $end - - $end shift, and go to state 5 - - -state 3 - - 4 expr: @2 . 'c' - - 'c' shift, and go to state 6 - - -state 4 - - 2 expr: 'a' @1 . 'b' - - 'b' shift, and go to state 7 - - -state 5 - - 0 $accept: expr $end . - - $default accept - - -state 6 - - 4 expr: @2 'c' . - - $default reduce using rule 4 (expr) - - -state 7 - - 2 expr: 'a' @1 'b' . - - $default reduce using rule 2 (expr) -]]) - -AT_CLEANUP - - - -## ---------------------- ## -## Mixing %token styles. ## -## ---------------------- ## - - -AT_SETUP([Mixing %token styles]) - -# Taken from the documentation. -AT_DATA([input.y], -[[%token OR "||" -%token LE 134 "<=" -%left OR "<=" -%% -exp: ; -%% -]]) - -AT_CHECK([bison -v -o input.c input.y]) - -AT_CLEANUP - - - -## ---------------- ## -## Invalid inputs. ## -## ---------------- ## - - -AT_SETUP([Invalid inputs]) - -AT_DATA([input.y], -[[%% -? -default: 'a' } -%& -%a-does-not-exist -%- -%{ -]]) - -AT_CHECK([bison input.y], [1], [], -[[input.y:2.1: invalid character: `?' -input.y:3.14: invalid character: `}' -input.y:4.1: invalid character: `%' -input.y:4.2: invalid character: `&' -input.y:5.1-17: invalid directive: `%a-does-not-exist' -input.y:6.1: invalid character: `%' -input.y:6.2: invalid character: `-' -input.y:7.1-8.0: missing `%}' at end of file -]]) - -AT_CLEANUP - - - -## ------------------- ## -## Token definitions. ## -## ------------------- ## - - -AT_SETUP([Token definitions]) - -# Bison managed, when fed with `%token 'f' "f"' to #define 'f'! -AT_DATA_GRAMMAR([input.y], -[%{ -void yyerror (const char *s); -int yylex (void); -%} -[%token MYEOF 0 "end of file" -%token 'a' "a" -%token b "b" -%token c 'c' -%token 'd' d -%% -exp: "a"; -]]) - -AT_CHECK([bison -o input.c input.y]) -AT_COMPILE([input.o], [-c input.c]) -AT_CLEANUP - - - -## -------------------- ## -## Characters Escapes. ## -## -------------------- ## - - -AT_SETUP([Characters Escapes]) - -AT_DATA_GRAMMAR([input.y], -[%{ -void yyerror (const char *s); -int yylex (void); -%} -[%% -exp: - '\'' "\'" -| '\"' "\"" -| '"' "'" -; -]]) -# Pacify font-lock-mode: " - -AT_CHECK([bison -o input.c input.y]) -AT_COMPILE([input.o], [-c input.c]) -AT_CLEANUP - - - -## -------------- ## -## Web2c Report. ## -## -------------- ## - -# The generation of the reduction was once wrong in Bison, and made it -# miss some reductions. In the following test case, the reduction on -# `undef_id_tok' in state 1 was missing. This is stripped down from -# the actual web2c.y. - -AT_SETUP([Web2c Report]) - -AT_KEYWORDS([report]) - -AT_DATA([input.y], -[[%token undef_id_tok const_id_tok - -%start CONST_DEC_PART - -%% -CONST_DEC_PART: - CONST_DEC_LIST - ; - -CONST_DEC_LIST: - CONST_DEC - | CONST_DEC_LIST CONST_DEC - ; - -CONST_DEC: - { } undef_id_tok '=' const_id_tok ';' - ; -%% -]]) - -AT_CHECK([bison -v input.y]) -AT_CHECK([cat input.output], 0, -[[Grammar - - 0 $accept: CONST_DEC_PART $end - - 1 CONST_DEC_PART: CONST_DEC_LIST - - 2 CONST_DEC_LIST: CONST_DEC - 3 | CONST_DEC_LIST CONST_DEC - - 4 @1: /* empty */ - - 5 CONST_DEC: @1 undef_id_tok '=' const_id_tok ';' - - -Terminals, with rules where they appear - -$end (0) 0 -';' (59) 5 -'=' (61) 5 -error (256) -undef_id_tok (258) 5 -const_id_tok (259) 5 - - -Nonterminals, with rules where they appear - -$accept (7) - on left: 0 -CONST_DEC_PART (8) - on left: 1, on right: 0 -CONST_DEC_LIST (9) - on left: 2 3, on right: 1 3 -CONST_DEC (10) - on left: 5, on right: 2 3 -@1 (11) - on left: 4, on right: 5 - - -state 0 - - 0 $accept: . CONST_DEC_PART $end - - $default reduce using rule 4 (@1) - - CONST_DEC_PART go to state 1 - CONST_DEC_LIST go to state 2 - CONST_DEC go to state 3 - @1 go to state 4 - - -state 1 - - 0 $accept: CONST_DEC_PART . $end - - $end shift, and go to state 5 - - -state 2 - - 1 CONST_DEC_PART: CONST_DEC_LIST . - 3 CONST_DEC_LIST: CONST_DEC_LIST . CONST_DEC - - undef_id_tok reduce using rule 4 (@1) - $default reduce using rule 1 (CONST_DEC_PART) - - CONST_DEC go to state 6 - @1 go to state 4 - - -state 3 - - 2 CONST_DEC_LIST: CONST_DEC . - - $default reduce using rule 2 (CONST_DEC_LIST) - - -state 4 - - 5 CONST_DEC: @1 . undef_id_tok '=' const_id_tok ';' - - undef_id_tok shift, and go to state 7 - - -state 5 - - 0 $accept: CONST_DEC_PART $end . - - $default accept - - -state 6 - - 3 CONST_DEC_LIST: CONST_DEC_LIST CONST_DEC . - - $default reduce using rule 3 (CONST_DEC_LIST) - - -state 7 - - 5 CONST_DEC: @1 undef_id_tok . '=' const_id_tok ';' - - '=' shift, and go to state 8 - - -state 8 - - 5 CONST_DEC: @1 undef_id_tok '=' . const_id_tok ';' - - const_id_tok shift, and go to state 9 - - -state 9 - - 5 CONST_DEC: @1 undef_id_tok '=' const_id_tok . ';' - - ';' shift, and go to state 10 - - -state 10 - - 5 CONST_DEC: @1 undef_id_tok '=' const_id_tok ';' . - - $default reduce using rule 5 (CONST_DEC) -]]) - -AT_CLEANUP - - -## --------------- ## -## Web2c Actions. ## -## --------------- ## - -# The generation of the mapping `state -> action' was once wrong in -# extremely specific situations. web2c.y exhibits this situation. -# Below is a stripped version of the grammar. It looks like one can -# simplify it further, but just don't: it is tuned to exhibit a bug, -# which disapears when applying sane grammar transformations. -# -# It used to be wrong on yydefact only: -# -# static const short int yydefact[] = -# { -# - 2, 0, 1, 0, 0, 2, 3, 2, 5, 4, -# + 2, 0, 1, 0, 0, 0, 3, 2, 5, 4, -# 0, 0 -# }; -# -# but let's check all the tables. - - -AT_SETUP([Web2c Actions]) - -AT_KEYWORDS([report]) - -AT_DATA([input.y], -[[%% -statement: struct_stat; -struct_stat: /* empty. */ | if else; -if: "if" "const" "then" statement; -else: "else" statement; -%% -]]) - -AT_CHECK([bison -v -o input.c input.y]) - -# Check only the tables. We don't use --no-parser, because it is -# still to be implemented in the experimental branch of Bison. -[sed -n 's/ *$//;/^static const.*\[\] =/,/^}/p' input.c >tables.c] - -AT_CHECK([[cat tables.c]], 0, -[[static const unsigned char yytranslate[] = -{ - 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 1, 2, 3, 4, - 5, 6 -}; -static const unsigned char yyprhs[] = -{ - 0, 0, 3, 5, 6, 9, 14 -}; -static const yysigned_char yyrhs[] = -{ - 8, 0, -1, 9, -1, -1, 10, 11, -1, 3, - 4, 5, 8, -1, 6, 8, -1 -}; -static const unsigned char yyrline[] = -{ - 0, 2, 2, 3, 3, 4, 5 -}; -static const char *const yytname[] = -{ - "$end", "error", "$undefined", "\"if\"", "\"const\"", "\"then\"", - "\"else\"", "$accept", "statement", "struct_stat", "if", "else", 0 -}; -static const unsigned short int yytoknum[] = -{ - 0, 256, 257, 258, 259, 260, 261 -}; -static const unsigned char yyr1[] = -{ - 0, 7, 8, 9, 9, 10, 11 -}; -static const unsigned char yyr2[] = -{ - 0, 2, 1, 0, 2, 4, 2 -}; -static const unsigned char yydefact[] = -{ - 3, 0, 0, 2, 0, 0, 1, 3, 4, 3, - 6, 5 -}; -static const yysigned_char yydefgoto[] = -{ - -1, 2, 3, 4, 8 -}; -static const yysigned_char yypact[] = -{ - -2, -1, 4, -8, 0, 2, -8, -2, -8, -2, - -8, -8 -}; -static const yysigned_char yypgoto[] = -{ - -8, -7, -8, -8, -8 -}; -static const unsigned char yytable[] = -{ - 10, 1, 11, 5, 6, 0, 7, 9 -}; -static const yysigned_char yycheck[] = -{ - 7, 3, 9, 4, 0, -1, 6, 5 -}; -static const unsigned char yystos[] = -{ - 0, 3, 8, 9, 10, 4, 0, 6, 11, 5, - 8, 8 -}; -]]) - -AT_CLEANUP - - -## ------------------------- ## -## yycheck Bound Violation. ## -## ------------------------- ## - - -# _AT_DATA_DANCER_Y(BISON-OPTIONS) -# -------------------------------- -# The following grammar, taken from Andrew Suffield's GPL'd implementation -# of DGMTP, the Dancer Generic Message Transport Protocol, used to violate -# yycheck's bounds where issuing a verbose error message. Keep this test -# so that possible bound checking compilers could check all the skeletons. -m4_define([_AT_DATA_DANCER_Y], -[AT_DATA_GRAMMAR([dancer.y], -[%{ -static int yylex (AT_LALR1_CC_IF([int *], [void])); -AT_LALR1_CC_IF([], -[#include -static void yyerror (const char *);]) -%} -$1 -%token ARROW INVALID NUMBER STRING DATA -%defines -%verbose -%error-verbose -/* Grammar follows */ -%% -line: header body - ; - -header: '<' from ARROW to '>' type ':' - | '<' ARROW to '>' type ':' - | ARROW to type ':' - | type ':' - | '<' '>' - ; - -from: DATA - | STRING - | INVALID - ; - -to: DATA - | STRING - | INVALID - ; - -type: DATA - | STRING - | INVALID - ; - -body: /* empty */ - | body member - ; - -member: STRING - | DATA - | '+' NUMBER - | '-' NUMBER - | NUMBER - | INVALID - ; -%% -AT_LALR1_CC_IF( -[/* Currently, print_ is required in C++. */ -void -yy::Parser::print_ () -{ -} - -/* A C++ error reporting function. */ -void -yy::Parser::error_ () -{ - std::cerr << message << std::endl; -} - -int -yyparse (void) -{ - yy::Parser parser (!!YYDEBUG); - return parser.parse (); -} -], -[static void -yyerror (const char *s) -{ - fprintf (stderr, "%s\n", s); -}]) - -static int -yylex (AT_LALR1_CC_IF([int *lval], [void])) -[{ - static int toknum = 0; - int tokens[] = - { - ':', -1 - }; - ]AT_LALR1_CC_IF([*lval = 0; /* Pacify GCC. */])[ - return tokens[toknum++]; -}] - -int -main (void) -{ - return yyparse (); -} -]) -])# _AT_DATA_DANCER_Y - - -# AT_CHECK_DANCER(BISON-OPTIONS) -# ------------------------------ -# Generate the grammar, compile it, run it. -m4_define([AT_CHECK_DANCER], -[AT_SETUP([Dancer $1]) -AT_BISON_OPTION_PUSHDEFS([$1]) -_AT_DATA_DANCER_Y([$1]) -AT_CHECK([bison -o dancer.c dancer.y]) -AT_LALR1_CC_IF([AT_COMPILE_CXX([dancer])], - [AT_COMPILE([dancer])]) -AT_PARSER_CHECK([./dancer], 1, [], -[syntax error, unexpected ':' -]) -AT_BISON_OPTION_POPDEFS -AT_CLEANUP -]) - -AT_CHECK_DANCER() -AT_CHECK_DANCER([%glr-parser]) -AT_CHECK_DANCER([%skeleton "lalr1.cc"]) diff --git a/src/bin/bison/tests/sets.at b/src/bin/bison/tests/sets.at deleted file mode 100644 index 373271dc1a..0000000000 --- a/src/bin/bison/tests/sets.at +++ /dev/null @@ -1,254 +0,0 @@ -# Exercising Bison Grammar Sets. -*- Autotest -*- -# Copyright (C) 2001, 2002 Free Software Foundation, Inc. - -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2, 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, write to the Free Software -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA -# 02111-1307, USA. - - -# AT_EXTRACT_SETS(INPUT, OUTPUT) -# ------------------------------ -# Extract the information about the grammar sets from a bison -# trace output (INPUT), and save it in OUTPUT. -# And remember, there is no alternation in portable sed. -m4_define([AT_EXTRACT_SETS], -[AT_DATA([extract.sed], -[[#n -/^NULLABLE$/ { - :null - p - n - /^[ ]*$/ !b null -} -/^FIRSTS$/ { - :firsts - p - n - /^[ ]*$/ !b firsts -} -/^FDERIVES$/ { - :fderiv - p - n - /^[ ]*$/ !b fderiv -} -/^DERIVES$/ { - :deriv - p - n - /^[ ]*$/ !b deriv -} -]]) -AT_CHECK([sed -f extract.sed $1], 0, [stdout]) -AT_CHECK([mv stdout $2]) -]) - - - -AT_BANNER([[Grammar Sets (Firsts etc.).]]) - - -## ---------- ## -## Nullable. ## -## ---------- ## - -AT_SETUP([Nullable]) - -# At some point, nullable had been smoking grass, and managed to say: -# -# Entering set_nullable -# NULLABLE -# 'e': yes -# (null): no -# ... - -AT_DATA([[input.y]], -[[%% -e: 'e' | /* Nothing */; -]]) - -AT_CHECK([[bison --trace=sets input.y]], [], [], [stderr]) -AT_EXTRACT_SETS([stderr], [sets]) -AT_CHECK([[cat sets]], [], -[[DERIVES - $accept derives - 0 e $end - e derives - 1 'e' - 2 /* empty */ -NULLABLE - $accept: no - e: yes -FIRSTS - $accept firsts - $accept - e - e firsts - e -FDERIVES - $accept derives - 0 e $end - 1 'e' - 2 /* empty */ - e derives - 1 'e' - 2 /* empty */ -]]) - -AT_CLEANUP - - -## ---------------- ## -## Broken Closure. ## -## ---------------- ## - -# TC was once broken during a massive `simplification' of the code. -# It resulted in bison dumping core on the following grammar (the -# computation of FIRSTS uses TC). It managed to produce a pretty -# exotic closure: -# -# TC: Input -# -# 01234567 -# +--------+ -# 0| 1 | -# 1| 1 | -# 2| 1 | -# 3| 1 | -# 4| 1 | -# 5| 1 | -# 6| 1| -# 7| | -# +--------+ -# -# TC: Output -# -# 01234567 -# +--------+ -# 0| 1 | -# 1| 111 | -# 2| 111 | -# 3| 1111 | -# 4| 111 1 | -# 5| 111 1 | -# 6| 111 1| -# 7| 111 | -# +--------+ -# -# instead of that below. - -AT_SETUP([Broken Closure]) - -AT_DATA([input.y], -[[%% -a: b; -b: c; -c: d; -d: e; -e: f; -f: g; -g: h; -h: 'h'; -]]) - -AT_CHECK([[bison --trace=sets input.y]], [], [], [stderr]) - -AT_CHECK([[sed -n 's/[ ]*$//;/^RTC: Firsts Output BEGIN/,/^RTC: Firsts Output END/p' stderr]], [], -[[RTC: Firsts Output BEGIN - - 012345678 - .---------. - 0|111111111| - 1| 11111111| - 2| 1111111| - 3| 111111| - 4| 11111| - 5| 1111| - 6| 111| - 7| 11| - 8| 1| - `---------' -RTC: Firsts Output END -]]) - -AT_CLEANUP - - - -## -------- ## -## Firsts. ## -## -------- ## - -AT_SETUP([Firsts]) - -AT_DATA([input.y], -[[%nonassoc '<' '>' -%left '+' '-' -%right '^' '=' -%% -exp: - exp '<' exp - | exp '>' exp - | exp '+' exp - | exp '-' exp - | exp '^' exp - | exp '=' exp - | "exp" - ; -]]) - -AT_CHECK([[bison --trace=sets input.y]], [], [], [stderr]) -AT_EXTRACT_SETS([stderr], [sets]) -AT_CHECK([[cat sets]], [], -[[DERIVES - $accept derives - 0 exp $end - exp derives - 1 exp '<' exp - 2 exp '>' exp - 3 exp '+' exp - 4 exp '-' exp - 5 exp '^' exp - 6 exp '=' exp - 7 "exp" -NULLABLE - $accept: no - exp: no -FIRSTS - $accept firsts - $accept - exp - exp firsts - exp -FDERIVES - $accept derives - 0 exp $end - 1 exp '<' exp - 2 exp '>' exp - 3 exp '+' exp - 4 exp '-' exp - 5 exp '^' exp - 6 exp '=' exp - 7 "exp" - exp derives - 1 exp '<' exp - 2 exp '>' exp - 3 exp '+' exp - 4 exp '-' exp - 5 exp '^' exp - 6 exp '=' exp - 7 "exp" -]]) - -AT_CLEANUP diff --git a/src/bin/bison/tests/synclines.at b/src/bin/bison/tests/synclines.at deleted file mode 100644 index e10f3c6364..0000000000 --- a/src/bin/bison/tests/synclines.at +++ /dev/null @@ -1,173 +0,0 @@ -# Executing Actions. -*- Autotest -*- -# Copyright (C) 2002, 2004 Free Software Foundation, Inc. - -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2, 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, write to the Free Software -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA -# 02111-1307, USA. - -AT_BANNER([[User Actions.]]) - - -# AT_SYNCLINES_COMPILE(FILE) -# -------------------------- -# Compile FILE expecting an error, and save in the file stdout the -# normalized output. Ignore the exit status, since some compilers -# (e.g. c89 on IRIX 6.5) triger warnings on `#error', instead of -# errors. -m4_define([AT_SYNCLINES_COMPILE], -[AT_CHECK([$CC $CFLAGS $CPPFLAGS -c $1], [ignore], [], [stderr]) -# In case GCC displays column information, strip it down. -# -# input.y:4:2: #error "4" or input.y:4.2: #error "4" -# => -# input.y:4: #error "4" -# -AT_CHECK([[sed 's/^\([^:]*:[^:.]*\)[.:][^:]*:\(.*\)$/\1:\2/' stderr]], 0, [stdout]) -]) - -# AT_TEST_SYNCLINE(TITLE, INPUT, ERROR-MSG) -# ----------------------------------------- -# Check that compiling the parser produced from INPUT cause GCC -# to issue ERROR-MSG. -m4_define([AT_TEST_SYNCLINE], -[AT_SETUP([$1]) - -# It seems impossible to find a generic scheme to check the location -# of an error. Even requiring GCC is not sufficient, since for instance -# the version modified by Apple: -# -# | Reading specs from /usr/libexec/gcc/darwin/ppc/2.95.2/specs -# | Apple Computer, Inc. version gcc-934.3, based on gcc version 2.95.2 -# | 19991024 (release) configure:2124: $? = 0 -# -# instead of: -# -# | input.y:2: #error "2" -# -# it reports: -# -# | input.y:2: "2" -# | cpp-precomp: warning: errors during smart preprocessing, retrying in basic mode - -AT_DATA([syncline.c], -[[#error "1" -]]) - -AT_SYNCLINES_COMPILE([syncline.c]) -AT_CHECK([[test "`cat stdout`" = 'syncline.c:1: @%:@error "1"' || exit 77]]) - -AT_DATA([[input.y]], [$2]) -AT_CHECK([bison -o input.c input.y]) -AT_SYNCLINES_COMPILE([input.c]) -AT_CHECK([cat stdout], 0, [$3]) -AT_CLEANUP -]) - - -## --------------------- ## -## Prologue synch line. ## -## --------------------- ## - - -AT_TEST_SYNCLINE([Prologue synch line], -[[%{ -#error "2" -void yyerror (const char *s); -int yylex (void); -%} -%% -exp: '0'; -]], -[input.y:2: #error "2" -]) - - -## ------------------- ## -## %union synch line. ## -## ------------------- ## - -AT_TEST_SYNCLINE([%union synch line], -[[%union { -#error "2" - char dummy; -} -%{ -void yyerror (const char *s); -int yylex (void); -%} -%% -exp: '0'; -]], -[input.y:2: #error "2" -]) - - -## ------------------------- ## -## Postprologue synch line. ## -## ------------------------- ## - -AT_TEST_SYNCLINE([Postprologue synch line], -[[%{ -void yyerror (const char *s); -int yylex (void); -%} -%union -{ - int ival; -} -%{ -#error "10" -%} -%% -exp: '0'; -]], -[input.y:10: #error "10" -]) - - -## ------------------- ## -## Action synch line. ## -## ------------------- ## - -AT_TEST_SYNCLINE([Action synch line], -[[%{ -void yyerror (const char *s); -int yylex (void); -%} -%% -exp: -{ -#error "8" -}; -]], -[input.y:8: #error "8" -]) - - -## --------------------- ## -## Epilogue synch line. ## -## --------------------- ## - -AT_TEST_SYNCLINE([Epilogue synch line], -[[%{ -void yyerror (const char *s); -int yylex (void); -%} -%% -exp: '0'; -%% -#error "8" -]], -[input.y:8: #error "8" -]) diff --git a/src/bin/bison/tests/testsuite b/src/bin/bison/tests/testsuite deleted file mode 100644 index e5ecb224ca..0000000000 --- a/src/bin/bison/tests/testsuite +++ /dev/null @@ -1,60357 +0,0 @@ -#! /bin/sh -## --------------------- ## -## M4sh Initialization. ## -## --------------------- ## - -# Be Bourne compatible -if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then - emulate sh - NULLCMD=: - # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which - # is contrary to our usage. Disable this feature. - alias -g '${1+"$@"}'='"$@"' -elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then - set -o posix -fi -DUALCASE=1; export DUALCASE # for MKS sh - -# Support unset when possible. -if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then - as_unset=unset -else - as_unset=false -fi - - -# Work around bugs in pre-3.0 UWIN ksh. -$as_unset ENV MAIL MAILPATH -PS1='$ ' -PS2='> ' -PS4='+ ' - -# NLS nuisances. -for as_var in \ - LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \ - LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \ - LC_TELEPHONE LC_TIME -do - if (set +x; test -z "`(eval $as_var=C; export $as_var) 2>&1`"); then - eval $as_var=C; export $as_var - else - $as_unset $as_var - fi -done - -# Required to use basename. -if expr a : '\(a\)' >/dev/null 2>&1; then - as_expr=expr -else - as_expr=false -fi - -if (basename /) >/dev/null 2>&1 && test "X`basename / 2>&1`" = "X/"; then - as_basename=basename -else - as_basename=false -fi - - -# Name of the executable. -as_me=`$as_basename "$0" || -$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ - X"$0" : 'X\(//\)$' \| \ - X"$0" : 'X\(/\)$' \| \ - . : '\(.\)' 2>/dev/null || -echo X/"$0" | - sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/; q; } - /^X\/\(\/\/\)$/{ s//\1/; q; } - /^X\/\(\/\).*/{ s//\1/; q; } - s/.*/./; q'` - - -# PATH needs CR, and LINENO needs CR and PATH. -# Avoid depending upon Character Ranges. -as_cr_letters='abcdefghijklmnopqrstuvwxyz' -as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' -as_cr_Letters=$as_cr_letters$as_cr_LETTERS -as_cr_digits='0123456789' -as_cr_alnum=$as_cr_Letters$as_cr_digits - -# The user is always right. -if test "${PATH_SEPARATOR+set}" != set; then - echo "#! /bin/sh" >conf$$.sh - echo "exit 0" >>conf$$.sh - chmod +x conf$$.sh - if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then - PATH_SEPARATOR=';' - else - PATH_SEPARATOR=: - fi - rm -f conf$$.sh -fi - - - as_lineno_1=$LINENO - as_lineno_2=$LINENO - as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null` - test "x$as_lineno_1" != "x$as_lineno_2" && - test "x$as_lineno_3" = "x$as_lineno_2" || { - # Find who we are. Look in the path if we contain no path at all - # relative or not. - case $0 in - *[\\/]* ) as_myself=$0 ;; - *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break -done - - ;; - esac - # We did not find ourselves, most probably we were run as `sh COMMAND' - # in which case we are not to be found in the path. - if test "x$as_myself" = x; then - as_myself=$0 - fi - if test ! -f "$as_myself"; then - { echo "$as_me: error: cannot find myself; rerun with an absolute path" >&2 - { (exit 1); exit 1; }; } - fi - case $CONFIG_SHELL in - '') - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for as_base in sh bash ksh sh5; do - case $as_dir in - /*) - if ("$as_dir/$as_base" -c ' - as_lineno_1=$LINENO - as_lineno_2=$LINENO - as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null` - test "x$as_lineno_1" != "x$as_lineno_2" && - test "x$as_lineno_3" = "x$as_lineno_2" ') 2>/dev/null; then - $as_unset BASH_ENV || test "${BASH_ENV+set}" != set || { BASH_ENV=; export BASH_ENV; } - $as_unset ENV || test "${ENV+set}" != set || { ENV=; export ENV; } - CONFIG_SHELL=$as_dir/$as_base - export CONFIG_SHELL - exec "$CONFIG_SHELL" "$0" ${1+"$@"} - fi;; - esac - done -done -;; - esac - - # Create $as_me.lineno as a copy of $as_myself, but with $LINENO - # uniformly replaced by the line number. The first 'sed' inserts a - # line-number line before each line; the second 'sed' does the real - # work. The second script uses 'N' to pair each line-number line - # with the numbered line, and appends trailing '-' during - # substitution so that $LINENO is not a special case at line end. - # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the - # second 'sed' script. Blame Lee E. McMahon for sed's syntax. :-) - sed '=' <$as_myself | - sed ' - N - s,$,-, - : loop - s,^\(['$as_cr_digits']*\)\(.*\)[$]LINENO\([^'$as_cr_alnum'_]\),\1\2\1\3, - t loop - s,-$,, - s,^['$as_cr_digits']*\n,, - ' >$as_me.lineno && - chmod +x $as_me.lineno || - { echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2 - { (exit 1); exit 1; }; } - - # Don't try to exec as it changes $[0], causing all sort of problems - # (the dirname of $[0] is not the place where we might find the - # original and so on. Autoconf is especially sensible to this). - . ./$as_me.lineno - # Exit status is that of the last command. - exit -} - - -case `echo "testing\c"; echo 1,2,3`,`echo -n testing; echo 1,2,3` in - *c*,-n*) ECHO_N= ECHO_C=' -' ECHO_T=' ' ;; - *c*,* ) ECHO_N=-n ECHO_C= ECHO_T= ;; - *) ECHO_N= ECHO_C='\c' ECHO_T= ;; -esac - -if expr a : '\(a\)' >/dev/null 2>&1; then - as_expr=expr -else - as_expr=false -fi - -rm -f conf$$ conf$$.exe conf$$.file -echo >conf$$.file -if ln -s conf$$.file conf$$ 2>/dev/null; then - # We could just check for DJGPP; but this test a) works b) is more generic - # and c) will remain valid once DJGPP supports symlinks (DJGPP 2.04). - if test -f conf$$.exe; then - # Don't use ln at all; we don't have any links - as_ln_s='cp -p' - else - as_ln_s='ln -s' - fi -elif ln conf$$.file conf$$ 2>/dev/null; then - as_ln_s=ln -else - as_ln_s='cp -p' -fi -rm -f conf$$ conf$$.exe conf$$.file - -if mkdir -p . 2>/dev/null; then - as_mkdir_p=: -else - test -d ./-p && rmdir ./-p - as_mkdir_p=false -fi - -as_executable_p="test -f" - -# Sed expression to map a string onto a valid CPP name. -as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" - -# Sed expression to map a string onto a valid variable name. -as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" - - -# IFS -# We need space, tab and new line, in precisely that order. -as_nl=' -' -IFS=" $as_nl" - -# CDPATH. -$as_unset CDPATH - - -SHELL=${CONFIG_SHELL-/bin/sh} - -# How were we run? -at_cli_args="$@" - -# Load the config file. -for at_file in atconfig atlocal -do - test -r $at_file || continue - . ./$at_file || { echo "$as_me: error: invalid content: $at_file" >&2 - { (exit 1); exit 1; }; } -done - -# atconfig delivers paths relative to the directory the test suite is -# in, but the groups themselves are run in testsuite-dir/group-dir. -if test -n "$at_top_srcdir"; then - builddir=../.. - for at_dir in srcdir top_srcdir top_builddir - do - at_val=`eval echo '${'at_$at_dir'}'` - eval "$at_dir=\$at_val/../.." - done -fi - -# Not all shells have the 'times' builtin; the subshell is needed to make -# sure we discard the 'times: not found' message from the shell. -at_times_p=false -(times) >/dev/null 2>&1 && at_times_p=: - -# CLI Arguments to pass to the debugging scripts. -at_debug_args= -# -e sets to true -at_errexit_p=false -# Shall we be verbose? -at_verbose=: -at_quiet=echo - -# Shall we keep the debug scripts? Must be `:' when the suite is -# run by a debug script, so that the script doesn't remove itself. -at_debug_p=false -# Display help message? -at_help_p=false -# List test groups? -at_list_p=false -# Test groups to run -at_groups= - -# The directory we are in. -at_dir=`pwd` -# The directory the whole suite works in. -# Should be absolutely to let the user `cd' at will. -at_suite_dir=$at_dir/$as_me.dir -# The file containing the suite. -at_suite_log=$at_dir/$as_me.log -# The file containing the location of the last AT_CHECK. -at_check_line_file=$at_suite_dir/at-check-line -# The file containing the exit status of the last command. -at_status_file=$at_suite_dir/at-status -# The files containing the output of the tested commands. -at_stdout=$at_suite_dir/at-stdout -at_stder1=$at_suite_dir/at-stder1 -at_stderr=$at_suite_dir/at-stderr -# The file containing dates. -at_times_file=$at_suite_dir/at-times - -# List of the tested programs. -at_tested='bison' -# List of the all the test groups. -at_groups_all=' banner-1 1 2 3 4 banner-2 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 banner-3 21 22 23 banner-4 24 25 26 27 28 29 banner-5 30 31 32 33 34 banner-6 35 36 37 38 banner-7 39 40 41 42 43 banner-8 44 45 46 47 48 49 50 51 52 53 54 55 banner-9 56 57 58 59 60 61 62 63 64 65 66 67 68 69 banner-10 70 71 72 73 74 75 76 77 78 79 80 81 82 83 banner-11 84 85 86 87 88 89 banner-12 90 91 92 93 94 banner-13 95 96 97 banner-14 98 99 100 101 102 103 104 105 106 107 108 109 110 banner-15 111 112 113 114 115 116 117 118 119 banner-16 120 121' -# As many dots as there are digits in the last test group number. -# Used to normalize the test group numbers so that `ls' lists them in -# numerical order. -at_format='...' -# Description of all the test groups. -at_help_all='1;input.at:28;Invalid $n;; -2;input.at:46;Invalid @n;; -3;input.at:64;Type Clashes;; -4;input.at:93;Torturing the Scanner;; -5;output.at:38;Output files: & -dv.;; -6;output.at:40;Output files: & -dv -o foo.c.;; -7;output.at:42;Output files: & -dv -o foo.tab.c.;; -8;output.at:44;Output files: & -dv -y.;; -9;output.at:46;Output files: & -dv -b bar.;; -10;output.at:48;Output files: & -dv -g -o foo.c.;; -11;output.at:52;Output files: %defines %verbose & .;; -12;output.at:54;Output files: %defines %verbose %yacc & .;; -13;output.at:57;Output files: %defines %verbose %yacc & .;; -14;output.at:61;Output files: %file-prefix="bar" %defines %verbose & .;; -15;output.at:63;Output files: %output="bar.c" %defines %verbose %yacc & .;; -16;output.at:67;Output files: %file-prefix="baz" %output="bar.c" %defines %verbose %yacc & .;; -17;output.at:72;Output files: %defines %verbose & .;; -18;output.at:75;Output files: %defines %verbose & -o foo.c.;; -19;output.at:79;Output files: & --defines=foo.hpp -o foo.c++.;; -20;output.at:83;Output files: & -o foo.c++ --graph=foo.gph.;; -21;sets.at:66;Nullable;; -22;sets.at:151;Broken Closure;; -23;sets.at:193;Firsts;; -24;reduce.at:26;Useless Terminals;; -25;reduce.at:70;Useless Nonterminals;; -26;reduce.at:125;Useless Rules;report; -27;reduce.at:212;Reduced Automaton;report; -28;reduce.at:301;Underivable Rules;report; -29;reduce.at:342;Empty Language;; -30;synclines.at:93;Prologue synch line;; -31;synclines.at:113;%union synch line;; -32;synclines.at:136;Postprologue synch line;; -33;synclines.at:155;Action synch line;; -34;synclines.at:173;Epilogue synch line;; -35;headers.at:27;%union and --defines;; -36;headers.at:76;Invalid CPP guards: input/input;; -37;headers.at:77;Invalid CPP guards: 9foo;; -38;headers.at:86;export YYLTYPE;; -39;actions.at:25;Mid-rule actions;; -40;actions.at:89;Actions after errors;; -41;actions.at:236;Exotic Dollars;; -42;actions.at:556;Printers and Destructors: ;; -43;actions.at:557;Printers and Destructors: %locations %defines %skeleton "lalr1.cc";c++; -44;conflicts.at:32;S/R in initial;; -45;conflicts.at:52;%nonassoc and eof;; -46;conflicts.at:129;Unresolved SR Conflicts;report; -47;conflicts.at:236;Resolved SR Conflicts;report; -48;conflicts.at:358;Defaulted Conflicted Reduction;report; -49;conflicts.at:477;%expect not enough;; -50;conflicts.at:497;%expect right;; -51;conflicts.at:514;%expect too much;; -52;conflicts.at:534;%expect with reduce conflicts;; -53;conflicts.at:554;%no-default-prec without %prec;; -54;conflicts.at:580;%no-default-prec with %prec;; -55;conflicts.at:604;%default-prec;; -56;calc.at:541;Calculator ;; -57;calc.at:543;Calculator %defines;; -58;calc.at:544;Calculator %locations;; -59;calc.at:545;Calculator %name-prefix="calc";; -60;calc.at:546;Calculator %verbose;; -61;calc.at:547;Calculator %yacc;; -62;calc.at:548;Calculator %error-verbose;; -63;calc.at:550;Calculator %pure-parser %locations;; -64;calc.at:551;Calculator %error-verbose %locations;; -65;calc.at:553;Calculator %error-verbose %locations %defines %name-prefix="calc" %verbose %yacc;; -66;calc.at:555;Calculator %debug;; -67;calc.at:556;Calculator %error-verbose %debug %locations %defines %name-prefix="calc" %verbose %yacc;; -68;calc.at:558;Calculator %pure-parser %error-verbose %debug %locations %defines %name-prefix="calc" %verbose %yacc;; -69;calc.at:560;Calculator %pure-parser %error-verbose %debug %locations %defines %name-prefix="calc" %verbose %yacc %parse-param {semantic_value *result} %parse-param {int *count};; -70;calc.at:577;Calculator %glr-parser ;; -71;calc.at:579;Calculator %glr-parser %defines;; -72;calc.at:580;Calculator %glr-parser %locations;; -73;calc.at:581;Calculator %glr-parser %name-prefix="calc";; -74;calc.at:582;Calculator %glr-parser %verbose;; -75;calc.at:583;Calculator %glr-parser %yacc;; -76;calc.at:584;Calculator %glr-parser %error-verbose;; -77;calc.at:586;Calculator %glr-parser %pure-parser %locations;; -78;calc.at:587;Calculator %glr-parser %error-verbose %locations;; -79;calc.at:589;Calculator %glr-parser %error-verbose %locations %defines %name-prefix="calc" %verbose %yacc;; -80;calc.at:591;Calculator %glr-parser %debug;; -81;calc.at:592;Calculator %glr-parser %error-verbose %debug %locations %defines %name-prefix="calc" %verbose %yacc;; -82;calc.at:594;Calculator %glr-parser %pure-parser %error-verbose %debug %locations %defines %name-prefix="calc" %verbose %yacc;; -83;calc.at:596;Calculator %glr-parser %pure-parser %error-verbose %debug %locations %defines %name-prefix="calc" %verbose %yacc %parse-param {semantic_value *result} %parse-param {int *count};; -84;calc.at:614;Calculator %skeleton "lalr1.cc" %defines %locations;c++; -85;calc.at:616;Calculator %skeleton "lalr1.cc" %defines;c++; -86;calc.at:626;Calculator %skeleton "lalr1.cc" %error-verbose %locations %defines %name-prefix="calc" %verbose %yacc;c++; -87;calc.at:629;Calculator %skeleton "lalr1.cc" %error-verbose %debug %locations %defines %name-prefix="calc" %verbose %yacc;c++; -88;calc.at:631;Calculator %skeleton "lalr1.cc" %pure-parser %error-verbose %debug %locations %defines %name-prefix="calc" %verbose %yacc;c++; -89;calc.at:633;Calculator %skeleton "lalr1.cc" %pure-parser %error-verbose %debug %locations %defines %name-prefix="calc" %verbose %yacc %parse-param {semantic_value *result} %parse-param {int *count};c++; -90;torture.at:140;Big triangle;; -91;torture.at:231;Big horizontal;; -92;torture.at:366;Many lookaheads;; -93;torture.at:440;Exploding the Stack Size with Alloca;; -94;torture.at:461;Exploding the Stack Size with Malloc;; -95;existing.at:26;GNU AWK Grammar;; -96;existing.at:366;GNU Cim Grammar;; -97;existing.at:1218;GNU pic Grammar;; -98;regression.at:27;Early token definitions;; -99;regression.at:65;Braces parsing;; -100;regression.at:87;Duplicate string;; -101;regression.at:113;Rule Line Numbers;report; -102;regression.at:257;Mixing %token styles;; -103;regression.at:280;Invalid inputs;; -104;regression.at:312;Token definitions;; -105;regression.at:340;Characters Escapes;; -106;regression.at:371;Web2c Report;report; -107;regression.at:548;Web2c Actions;report; -108;regression.at:792;Dancer ;; -109;regression.at:793;Dancer %glr-parser;; -110;regression.at:794;Dancer %skeleton "lalr1.cc";c++; -111;cxx-type.at:317;GLR: Resolve ambiguity, impure, no locations;; -112;cxx-type.at:324;GLR: Resolve ambiguity, impure, locations;; -113;cxx-type.at:330;GLR: Resolve ambiguity, pure, no locations;; -114;cxx-type.at:337;GLR: Resolve ambiguity, pure, locations;; -115;cxx-type.at:344;GLR: Merge conflicting parses, impure, no locations;; -116;cxx-type.at:351;GLR: Merge conflicting parses, impure, locations;; -117;cxx-type.at:358;GLR: Merge conflicting parses, pure, no locations;; -118;cxx-type.at:364;GLR: Merge conflicting parses, pure, locations;; -119;cxx-type.at:371;GLR: Verbose messages, resolve ambiguity, impure, no locations;; -120;glr-regression.at:25;Badly Collapsed GLR States;; -121;glr-regression.at:117;Improper handling of embedded actions and $-N in GLR parsers;; -' - -at_keywords= -at_prev= -for at_option -do - # If the previous option needs an argument, assign it. - if test -n "$at_prev"; then - at_option=$at_prev=$at_option - at_prev= - fi - - at_optarg=`expr "x$at_option" : 'x[^=]*=\(.*\)'` - - # Accept the important Cygnus configure options, so we can diagnose typos. - - case $at_option in - --help | -h ) - at_help_p=: - ;; - - --list | -l ) - at_list_p=: - ;; - - --version | -V ) - echo "$as_me (GNU Bison 1.875d)" - exit 0 - ;; - - --clean | -c ) - rm -rf $at_suite_dir $at_suite_log - exit 0 - ;; - - --debug | -d ) - at_debug_p=: - ;; - - --errexit | -e ) - at_debug_p=: - at_errexit_p=: - ;; - - --verbose | -v ) - at_verbose=echo; at_quiet=: - ;; - - --trace | -x ) - at_traceon='set -vx'; at_traceoff='set +vx' - ;; - - [0-9] | [0-9][0-9] | [0-9][0-9][0-9] | [0-9][0-9][0-9][0-9]) - at_groups="$at_groups$at_option " - ;; - - # Ranges - [0-9]- | [0-9][0-9]- | [0-9][0-9][0-9]- | [0-9][0-9][0-9][0-9]-) - at_range_start=`echo $at_option |tr -d '-'` - at_range=`echo " $at_groups_all " | \ - sed -e 's,^.* '$at_range_start' ,'$at_range_start' ,'` - at_groups="$at_groups$at_range " - ;; - - -[0-9] | -[0-9][0-9] | -[0-9][0-9][0-9] | -[0-9][0-9][0-9][0-9]) - at_range_end=`echo $at_option |tr -d '-'` - at_range=`echo " $at_groups_all " | \ - sed -e 's, '$at_range_end' .*$, '$at_range_end','` - at_groups="$at_groups$at_range " - ;; - - [0-9]-[0-9] | [0-9]-[0-9][0-9] | [0-9]-[0-9][0-9][0-9] | \ - [0-9]-[0-9][0-9][0-9][0-9] | [0-9][0-9]-[0-9][0-9] | \ - [0-9][0-9]-[0-9][0-9][0-9] | [0-9][0-9]-[0-9][0-9][0-9][0-9] | \ - [0-9][0-9][0-9]-[0-9][0-9][0-9] | \ - [0-9][0-9][0-9]-[0-9][0-9][0-9][0-9] | \ - [0-9][0-9][0-9][0-9]-[0-9][0-9][0-9][0-9] ) - at_range_start=`echo $at_option |sed 's,-.*,,'` - at_range_end=`echo $at_option |sed 's,.*-,,'` - # FIXME: Maybe test to make sure start <= end? - at_range=`echo " $at_groups_all " | \ - sed -e 's,^.* '$at_range_start' ,'$at_range_start' ,' \ - -e 's, '$at_range_end' .*$, '$at_range_end','` - at_groups="$at_groups$at_range " - ;; - - # Keywords. - --keywords | -k ) - at_prev=--keywords - ;; - --keywords=* ) - at_keywords="$at_keywords,$at_optarg" - ;; - - *=*) - at_envvar=`expr "x$at_option" : 'x\([^=]*\)='` - # Reject names that are not valid shell variable names. - expr "x$at_envvar" : ".*[^_$as_cr_alnum]" >/dev/null && - { echo "$as_me: error: invalid variable name: $at_envvar" >&2 - { (exit 1); exit 1; }; } - at_value=`echo "$at_optarg" | sed "s/'/'\\\\\\\\''/g"` - eval "$at_envvar='$at_value'" - export $at_envvar - # Propagate to debug scripts. - at_debug_args="$at_debug_args $at_option" - ;; - - *) echo "$as_me: invalid option: $at_option" >&2 - echo "Try \`$0 --help' for more information." >&2 - exit 1 - ;; - esac -done - -# Process the --keywords -if test -n "$at_keywords"; then - at_groups_selected=$at_help_all - for at_keyword in `IFS=,; set X $at_keywords; shift; echo ${1+$@}` - do - # It is on purpose that we match the test group titles too. - at_groups_selected=`echo "$at_groups_selected" | - grep -i "^[^;]*;[^;]*.*[; ]$at_keyword[ ;]"` - done - at_groups_selected=`echo "$at_groups_selected" | sed 's/;.*//'` - # Smash the end of lines. - at_groups_selected=`echo $at_groups_selected` - at_groups="$at_groups$at_groups_selected " -fi - -# Selected test groups. -test -z "$at_groups" && at_groups=$at_groups_all - -# Help message. -if $at_help_p; then - cat <<_ATEOF -Usage: $0 [OPTION]... [VARIABLE=VALUE]... [TESTS] - -Run all the tests, or the selected TESTS, and save a detailed log file. -Upon failure, create debugging scripts. - -You should not change environment variables unless explicitly passed -as command line arguments. Set \`AUTOTEST_PATH' to select the executables -to exercise. Each relative directory is expanded as build and source -directories relatively to the top level of this distribution. E.g., - - $ $0 AUTOTEST_PATH=bin - -possibly amounts into - - PATH=/tmp/foo-1.0/bin:/src/foo-1.0/bin:\$PATH -_ATEOF -cat <<_ATEOF - -Operation modes: - -h, --help print the help message, then exit - -V, --version print version number, then exit - -c, --clean remove all the files this test suite might create and exit - -l, --list describes all the tests, or the selected TESTS -_ATEOF -cat <<_ATEOF - -Execution tuning: - -k, --keywords=KEYWORDS - select the tests matching all the comma separated KEYWORDS - accumulates - -e, --errexit abort as soon as a test fails; implies --debug - -v, --verbose force more detailed output - default for debugging scripts - -d, --debug inhibit clean up and debug script creation - default for debugging scripts - -x, --trace enable tests shell tracing -_ATEOF -cat <<_ATEOF - -Report bugs to . -_ATEOF - exit 0 -fi - -# List of tests. -if $at_list_p; then - cat <<_ATEOF -GNU Bison 1.875d test suite test groups: - - NUM: FILENAME:LINE TEST-GROUP-NAME - KEYWORDS - -_ATEOF - # " 1 42 45 " => "^(1|42|45);". - at_groups_pattern=`echo "$at_groups" | sed 's/^ *//;s/ *$//;s/ */|/g'` - echo "$at_help_all" | - awk 'BEGIN { FS = ";" } - { if ($1 !~ /^('"$at_groups_pattern"')$/) next } - { if ($1) printf " %3d: %-18s %s\n", $1, $2, $3 - if ($4) printf " %s\n", $4 } ' - exit 0 -fi - -# Don't take risks: use only absolute directories in PATH. -# -# For stand-alone test suites, AUTOTEST_PATH is relative to `.'. -# -# For embedded test suites, AUTOTEST_PATH is relative to the top level -# of the package. Then expand it into build/src parts, since users -# may create executables in both places. -# -# There might be directories that don't exist, but don't redirect -# builtins' (eg., cd) stderr directly: Ultrix's sh hates that. -AUTOTEST_PATH=`echo $AUTOTEST_PATH | tr ':' $PATH_SEPARATOR` -at_path= -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $AUTOTEST_PATH $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - case $as_dir in - [\\/]* | ?:[\\/]* ) - at_path=$at_path$PATH_SEPARATOR$as_dir - ;; - * ) - if test -z "$at_top_builddir"; then - # Stand-alone test suite. - at_path=$at_path$PATH_SEPARATOR$as_dir - else - # Embedded test suite. - at_path=$at_path$PATH_SEPARATOR$at_top_builddir/$as_dir - at_path=$at_path$PATH_SEPARATOR$at_top_srcdir/$as_dir - fi - ;; -esac -done - - -# Now build and simplify PATH. -PATH= -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $at_path -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - as_dir=`(cd "$as_dir" && pwd) 2>/dev/null` -test -d "$as_dir" || continue -case $PATH in - $as_dir | \ - $as_dir$PATH_SEPARATOR* | \ - *$PATH_SEPARATOR$as_dir | \ - *$PATH_SEPARATOR$as_dir$PATH_SEPARATOR* ) ;; - - '') PATH=$as_dir ;; - *) PATH=$PATH$PATH_SEPARATOR$as_dir ;; -esac -done - -export PATH - -# Setting up the FDs. -# 5 is the log file. Not to be overwritten if `-d'. - -$at_debug_p && at_suite_log=/dev/null -exec 5>$at_suite_log - -# Banners and logs. -cat <<\_ASBOX -## ---------------------------- ## -## GNU Bison 1.875d test suite. ## -## ---------------------------- ## -_ASBOX -{ - cat <<\_ASBOX -## ---------------------------- ## -## GNU Bison 1.875d test suite. ## -## ---------------------------- ## -_ASBOX - echo - - echo "$as_me: command line was:" - echo " $ $0 $at_cli_args" - echo - - # Try to find a few ChangeLogs in case it might help determining the - # exact version. Use the relative dir: if the top dir is a symlink, - # find will not follow it (and options to follow the links are not - # portable), which would result in no output here. - if test -n "$at_top_srcdir"; then - cat <<\_ASBOX -## ----------- ## -## ChangeLogs. ## -## ----------- ## -_ASBOX - echo - for at_file in `find "$at_top_srcdir" -name ChangeLog -print` - do - echo "$as_me: $at_file:" - sed 's/^/| /;10q' $at_file - echo - done - - { -cat <<_ASUNAME -## --------- ## -## Platform. ## -## --------- ## - -hostname = `(hostname || uname -n) 2>/dev/null | sed 1q` -uname -m = `(uname -m) 2>/dev/null || echo unknown` -uname -r = `(uname -r) 2>/dev/null || echo unknown` -uname -s = `(uname -s) 2>/dev/null || echo unknown` -uname -v = `(uname -v) 2>/dev/null || echo unknown` - -/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown` -/bin/uname -X = `(/bin/uname -X) 2>/dev/null || echo unknown` - -/bin/arch = `(/bin/arch) 2>/dev/null || echo unknown` -/usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null || echo unknown` -/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown` -hostinfo = `(hostinfo) 2>/dev/null || echo unknown` -/bin/machine = `(/bin/machine) 2>/dev/null || echo unknown` -/usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null || echo unknown` -/bin/universe = `(/bin/universe) 2>/dev/null || echo unknown` - -_ASUNAME - -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - echo "PATH: $as_dir" -done - -} - echo - fi - - # Contents of the config files. - for at_file in atconfig atlocal - do - test -r $at_file || continue - echo "$as_me: $at_file:" - sed 's/^/| /' $at_file - echo - done - - cat <<\_ASBOX -## ---------------- ## -## Tested programs. ## -## ---------------- ## -_ASBOX - echo -} >&5 - -# Report what programs are being tested. -for at_program in : $at_tested -do - test "$at_program" = : && continue - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - test -f $as_dir/$at_program && break -done - - if test -f $as_dir/$at_program; then - { - echo "local.at:204: $as_dir/$at_program --version" - $as_dir/$at_program --version - echo - } >&5 2>&1 - else - { { echo "$as_me:$LINENO: error: cannot find $at_program" >&5 -echo "$as_me: error: cannot find $at_program" >&2;} - { (exit 1); exit 1; }; } - fi -done - -{ - cat <<\_ASBOX -## ------------------ ## -## Running the tests. ## -## ------------------ ## -_ASBOX -} >&5 - -at_start_date=`date` -at_start_time=`(date +%s) 2>/dev/null` -echo "$as_me: starting at: $at_start_date" >&5 -at_xpass_list= -at_xfail_list= -at_pass_list= -at_fail_list= -at_skip_list= -at_group_count=0 - -# Create the master directory if it doesn't already exist. -test -d $at_suite_dir || - mkdir $at_suite_dir || - { { echo "$as_me:$LINENO: error: cannot create $at_suite_dir" >&5 -echo "$as_me: error: cannot create $at_suite_dir" >&2;} - { (exit 1); exit 1; }; } - -# Can we diff with `/dev/null'? DU 5.0 refuses. -if diff /dev/null /dev/null >/dev/null 2>&1; then - at_devnull=/dev/null -else - at_devnull=$at_suite_dir/devnull - cp /dev/null $at_devnull -fi - -# Use `diff -u' when possible. -if diff -u $at_devnull $at_devnull >/dev/null 2>&1; then - at_diff='diff -u' -else - at_diff=diff -fi - - -for at_group in $at_groups -do - # Be sure to come back to the top test directory. - cd $at_suite_dir - - case $at_group in - banner-*) - at_group_log=$at_suite_log - ;; - - *) - # Skip tests we already run (using --keywords makes it easy to get - # duplication). - case " $at_pass_test $at_skip_test $at_fail_test " in - *" $at_group "* ) continue;; - esac - - # Normalize the test group number. - at_group_normalized=`expr "00000$at_group" : ".*\($at_format\)"` - - # Create a fresh directory for the next test group, and enter. - at_group_dir=$at_suite_dir/$at_group_normalized - at_group_log=$at_group_dir/$as_me.log - rm -rf $at_group_dir - mkdir $at_group_dir || - { { echo "$as_me:$LINENO: error: cannot create $at_group_dir" >&5 -echo "$as_me: error: cannot create $at_group_dir" >&2;} - { (exit 1); exit 1; }; } - cd $at_group_dir - ;; - esac - - echo 0 > $at_status_file - - # Clearly separate the test groups when verbose. - test $at_group_count != 0 && $at_verbose - - # In verbose mode, append to the log file *and* show on - # the standard output; in quiet mode only write to the log - if test $at_verbose = echo; then - at_tee_pipe="tee -a $at_group_log" - else - at_tee_pipe="cat >> $at_group_log" - fi - - case $at_group in - - banner-1 ) # Banner 1. input.at:19 - cat <<\_ATEOF - -Input Processing. - -_ATEOF - ;; - - 1 ) # 1. input.at:28: Invalid $n - at_setup_line='input.at:28' - at_desc='Invalid $n' - $at_quiet $ECHO_N " 1: Invalid $n $ECHO_C" - at_xfail=no - ( - echo "1. input.at:28: testing ..." - $at_traceon - - -cat >input.y <<'_ATEOF' -%% -exp: { $$ = $1 ; }; -_ATEOF - - -$at_traceoff -echo "input.at:37: bison input.y" -echo input.at:37 >$at_check_line_file -( $at_traceon; bison input.y ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo >>$at_stderr; echo "input.y:2.13-14: integer out of range: \`\$1' -" | $at_diff - $at_stderr || at_failed=: -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 1) ;; - *) echo "input.at:37: exit code was $at_status, expected 1" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - - $at_traceoff - $at_times_p && times >$at_times_file - ) 5>&1 2>&1 | eval $at_tee_pipe - at_status=`cat $at_status_file` - ;; - - 2 ) # 2. input.at:46: Invalid @n - at_setup_line='input.at:46' - at_desc='Invalid @n' - $at_quiet $ECHO_N " 2: Invalid @n $ECHO_C" - at_xfail=no - ( - echo "2. input.at:46: testing ..." - $at_traceon - - -cat >input.y <<'_ATEOF' -%% -exp: { @$ = @1 ; }; -_ATEOF - - -$at_traceoff -echo "input.at:55: bison input.y" -echo input.at:55 >$at_check_line_file -( $at_traceon; bison input.y ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo >>$at_stderr; echo "input.y:2.13-14: integer out of range: \`@1' -" | $at_diff - $at_stderr || at_failed=: -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 1) ;; - *) echo "input.at:55: exit code was $at_status, expected 1" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - - $at_traceoff - $at_times_p && times >$at_times_file - ) 5>&1 2>&1 | eval $at_tee_pipe - at_status=`cat $at_status_file` - ;; - - 3 ) # 3. input.at:64: Type Clashes - at_setup_line='input.at:64' - at_desc='Type Clashes' - $at_quiet $ECHO_N " 3: Type Clashes $ECHO_C" - at_xfail=no - ( - echo "3. input.at:64: testing ..." - $at_traceon - - -cat >input.y <<'_ATEOF' -%token foo -%type exp -%% -exp: foo {} foo - | foo - | /* Empty. */ - ; -_ATEOF - - -$at_traceoff -echo "input.at:80: bison input.y" -echo input.at:80 >$at_check_line_file -( $at_traceon; bison input.y ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo >>$at_stderr; echo "input.y:4.6-15: warning: type clash on default action: != <> -input.y:5.6-8: warning: type clash on default action: != <> -input.y:6.5: warning: empty rule for typed nonterminal, and no action -" | $at_diff - $at_stderr || at_failed=: -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "input.at:80: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - - $at_traceoff - $at_times_p && times >$at_times_file - ) 5>&1 2>&1 | eval $at_tee_pipe - at_status=`cat $at_status_file` - ;; - - 4 ) # 4. input.at:93: Torturing the Scanner - at_setup_line='input.at:93' - at_desc='Torturing the Scanner' - $at_quiet $ECHO_N " 4: Torturing the Scanner $ECHO_C" - at_xfail=no - ( - echo "4. input.at:93: testing ..." - $at_traceon - - - -cat >input.y <<'_ATEOF' -_ATEOF - -$at_traceoff -echo "input.at:99: bison input.y" -echo input.at:99 >$at_check_line_file -( $at_traceon; bison input.y ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo >>$at_stderr; echo "input.y:1.1: syntax error, unexpected \"end of file\" -" | $at_diff - $at_stderr || at_failed=: -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 1) ;; - *) echo "input.at:99: exit code was $at_status, expected 1" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - - -cat >input.y <<'_ATEOF' -%{ -#if HAVE_CONFIG_H -# include - /* We don't need perfect functions for these tests. */ -# undef malloc -# undef memcmp -# undef realloc -#endif -%} - -%{ -/* This is seen in GCC: a %{ and %} in middle of a comment. */ -const char *foo = "So %{ and %} can be here too."; - -#if 0 -/* These examples test Bison while not stressing C compilers too much. - Many C compilers mishandle backslash-newlines, so this part of the - test is inside "#if 0". The comment and string are written so that - the "#endif" will be seen regardless of the C compiler bugs that we - know about, namely: - - HP C (as of late 2002) mishandles *\[newline]\[newline]/ within a - comment. - - The Apple Darwin compiler (as of late 2002) mishandles - \\[newline]' within a character constant. - - */ - -/\ -* A comment with backslash-newlines in it. %} *\ -\ -/ -/* { Close the above comment, if the C compiler mishandled it. */ - -char str[] = "\\ -" A string with backslash-newlines in it %{ %} \\ -\ -""; - -char apostrophe = '\''; -#endif - -#include -%} -/* %{ and %} can be here too. */ - -%{ -/* Exercise pre-prologue dependency to %union. */ -typedef int value; -%} - -/* Exercise M4 quoting: ']]', 0. */ - -/* Also exercise %union. */ -%union -{ - value ival; /* A comment to exercise an old bug. */ -}; - - -/* Exercise post-prologue dependency to %union. */ -%{ -static YYSTYPE value_as_yystype (value val); - -/* Exercise quotes in declarations. */ -char quote[] = "]],"; -%} - -%{ -static void yyerror (const char *s); -static int yylex (void); -%} - -%type '[' - -/* Exercise quotes in strings. */ -%token FAKE "fake [] \a\b\f\n\r\t\v\"\'\?\\\u005B\U0000005c ??!??'??(??)??-??/?? \x1\1" - -%% -/* Exercise M4 quoting: ']]', [, 1. */ -exp: '[' '\1' two '$' '@' '{' oline output.or.oline.opt - { - /* Exercise quotes in braces. */ - char tmp[] = "[%c],\n"; - printf (tmp, $1); - } -; - -two: '\x000000000000000000000000000000000000000000000000000000000000000000002'; -oline: '@' 'o' 'l' 'i' 'n' 'e' '@' '_' '_' 'o' 'l' 'i' 'n' 'e' '_' '_'; -output.or.oline.opt: ;|oline;;|output;;; -output: '#' 'o' 'u' 't' 'p' 'u' 't' ' '; -%% -/* Exercise M4 quoting: ']]', [, 2. */ - -static YYSTYPE -value_as_yystype (value val) -{ - YYSTYPE res; - res.ival = val; - return res; -} - -static int -yylex (void) -{ - static const char *input = "[\1\2$@{@oline@__oline__\ -#output "; /* " - */ - yylval = value_as_yystype (*input); - return *input++; -} - -static void -yyerror (const char *msg) -{ - fprintf (stderr, "%s\n", msg); -} -_ATEOF - - - -# Pacify Emacs'font-lock-mode: " - -cat >main.c <<'_ATEOF' -typedef int value; -#include "input.h" - -int yyparse (void); - -int -main (void) -{ - return yyparse (); -} -_ATEOF - - -$at_traceoff -echo "input.at:229: bison -d -v -o input.c input.y" -echo input.at:229 >$at_check_line_file -( $at_traceon; bison -d -v -o input.c input.y ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "input.at:229: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - -$at_traceoff -echo "input.at:230: \$CC \$CFLAGS \$CPPFLAGS -c input.c -o input.o" -echo input.at:230 >$at_check_line_file -( $at_traceon; $CC $CFLAGS $CPPFLAGS -c input.c -o input.o ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo stderr:; cat $at_stderr -echo stdout:; cat $at_stdout -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "input.at:230: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - -$at_traceoff -echo "input.at:231: \$CC \$CFLAGS \$CPPFLAGS -c main.c -o main.o" -echo input.at:231 >$at_check_line_file -( $at_traceon; $CC $CFLAGS $CPPFLAGS -c main.c -o main.o ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo stderr:; cat $at_stderr -echo stdout:; cat $at_stdout -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "input.at:231: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - -$at_traceoff -echo "input.at:232: \$CC \$CFLAGS \$CPPFLAGS \$LDFLAGS input.o main.o \$LIBS -o input" -echo input.at:232 >$at_check_line_file -( $at_traceon; $CC $CFLAGS $CPPFLAGS $LDFLAGS input.o main.o $LIBS -o input ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo stderr:; cat $at_stderr -echo stdout:; cat $at_stdout -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "input.at:232: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - -$at_traceoff -echo "input.at:235: \$PREPARSER ./input" -echo input.at:235 >$at_check_line_file -( $at_traceon; $PREPARSER ./input ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -echo >>$at_stdout; echo "[[], -" | $at_diff - $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "input.at:235: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - - $at_traceoff - $at_times_p && times >$at_times_file - ) 5>&1 2>&1 | eval $at_tee_pipe - at_status=`cat $at_status_file` - ;; - - - banner-2 ) # Banner 2. output.at:19 - cat <<\_ATEOF - -Output file names. - -_ATEOF - ;; - - 5 ) # 5. output.at:38: Output files: & -dv. - at_setup_line='output.at:38' - at_desc='Output files: & -dv.' - $at_quiet $ECHO_N " 5: Output files: & -dv. $ECHO_C" - at_xfail=no - ( - echo "5. output.at:38: testing ..." - $at_traceon - -cat >foo.y <<'_ATEOF' - -%% -foo: {}; -_ATEOF - - -$at_traceoff -echo "output.at:38: bison -dv foo.y" -echo output.at:38 >$at_check_line_file -( $at_traceon; bison -dv foo.y ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "output.at:38: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - -$at_traceoff -echo "output.at:38: ls foo.output foo.tab.c foo.tab.h" -echo output.at:38 >$at_check_line_file -( $at_traceon; ls foo.output foo.tab.c foo.tab.h ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -echo stdout:; cat $at_stdout -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "output.at:38: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - $at_traceoff - $at_times_p && times >$at_times_file - ) 5>&1 2>&1 | eval $at_tee_pipe - at_status=`cat $at_status_file` - ;; - - 6 ) # 6. output.at:40: Output files: & -dv -o foo.c. - at_setup_line='output.at:40' - at_desc='Output files: & -dv -o foo.c.' - $at_quiet $ECHO_N " 6: Output files: & -dv -o foo.c. $ECHO_C" - at_xfail=no - ( - echo "6. output.at:40: testing ..." - $at_traceon - -cat >foo.y <<'_ATEOF' - -%% -foo: {}; -_ATEOF - - -$at_traceoff -echo "output.at:40: bison -dv -o foo.c foo.y" -echo output.at:40 >$at_check_line_file -( $at_traceon; bison -dv -o foo.c foo.y ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "output.at:40: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - -$at_traceoff -echo "output.at:40: ls foo.c foo.h foo.output" -echo output.at:40 >$at_check_line_file -( $at_traceon; ls foo.c foo.h foo.output ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -echo stdout:; cat $at_stdout -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "output.at:40: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - $at_traceoff - $at_times_p && times >$at_times_file - ) 5>&1 2>&1 | eval $at_tee_pipe - at_status=`cat $at_status_file` - ;; - - 7 ) # 7. output.at:42: Output files: & -dv -o foo.tab.c. - at_setup_line='output.at:42' - at_desc='Output files: & -dv -o foo.tab.c.' - $at_quiet $ECHO_N " 7: Output files: & -dv -o foo.tab.c. $ECHO_C" - at_xfail=no - ( - echo "7. output.at:42: testing ..." - $at_traceon - -cat >foo.y <<'_ATEOF' - -%% -foo: {}; -_ATEOF - - -$at_traceoff -echo "output.at:42: bison -dv -o foo.tab.c foo.y" -echo output.at:42 >$at_check_line_file -( $at_traceon; bison -dv -o foo.tab.c foo.y ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "output.at:42: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - -$at_traceoff -echo "output.at:42: ls foo.output foo.tab.c foo.tab.h" -echo output.at:42 >$at_check_line_file -( $at_traceon; ls foo.output foo.tab.c foo.tab.h ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -echo stdout:; cat $at_stdout -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "output.at:42: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - $at_traceoff - $at_times_p && times >$at_times_file - ) 5>&1 2>&1 | eval $at_tee_pipe - at_status=`cat $at_status_file` - ;; - - 8 ) # 8. output.at:44: Output files: & -dv -y. - at_setup_line='output.at:44' - at_desc='Output files: & -dv -y.' - $at_quiet $ECHO_N " 8: Output files: & -dv -y. $ECHO_C" - at_xfail=no - ( - echo "8. output.at:44: testing ..." - $at_traceon - -cat >foo.y <<'_ATEOF' - -%% -foo: {}; -_ATEOF - - -$at_traceoff -echo "output.at:44: bison -dv -y foo.y" -echo output.at:44 >$at_check_line_file -( $at_traceon; bison -dv -y foo.y ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "output.at:44: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - -$at_traceoff -echo "output.at:44: ls y.output y.tab.c y.tab.h" -echo output.at:44 >$at_check_line_file -( $at_traceon; ls y.output y.tab.c y.tab.h ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -echo stdout:; cat $at_stdout -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "output.at:44: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - $at_traceoff - $at_times_p && times >$at_times_file - ) 5>&1 2>&1 | eval $at_tee_pipe - at_status=`cat $at_status_file` - ;; - - 9 ) # 9. output.at:46: Output files: & -dv -b bar. - at_setup_line='output.at:46' - at_desc='Output files: & -dv -b bar.' - $at_quiet $ECHO_N " 9: Output files: & -dv -b bar. $ECHO_C" - at_xfail=no - ( - echo "9. output.at:46: testing ..." - $at_traceon - -cat >foo.y <<'_ATEOF' - -%% -foo: {}; -_ATEOF - - -$at_traceoff -echo "output.at:46: bison -dv -b bar foo.y" -echo output.at:46 >$at_check_line_file -( $at_traceon; bison -dv -b bar foo.y ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "output.at:46: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - -$at_traceoff -echo "output.at:46: ls bar.output bar.tab.c bar.tab.h" -echo output.at:46 >$at_check_line_file -( $at_traceon; ls bar.output bar.tab.c bar.tab.h ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -echo stdout:; cat $at_stdout -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "output.at:46: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - $at_traceoff - $at_times_p && times >$at_times_file - ) 5>&1 2>&1 | eval $at_tee_pipe - at_status=`cat $at_status_file` - ;; - - 10 ) # 10. output.at:48: Output files: & -dv -g -o foo.c. - at_setup_line='output.at:48' - at_desc='Output files: & -dv -g -o foo.c.' - $at_quiet $ECHO_N " 10: Output files: & -dv -g -o foo.c. $ECHO_C" - at_xfail=no - ( - echo "10. output.at:48: testing ..." - $at_traceon - -cat >foo.y <<'_ATEOF' - -%% -foo: {}; -_ATEOF - - -$at_traceoff -echo "output.at:48: bison -dv -g -o foo.c foo.y" -echo output.at:48 >$at_check_line_file -( $at_traceon; bison -dv -g -o foo.c foo.y ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "output.at:48: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - -$at_traceoff -echo "output.at:48: ls foo.c foo.h foo.output foo.vcg" -echo output.at:48 >$at_check_line_file -( $at_traceon; ls foo.c foo.h foo.output foo.vcg ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -echo stdout:; cat $at_stdout -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "output.at:48: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - $at_traceoff - $at_times_p && times >$at_times_file - ) 5>&1 2>&1 | eval $at_tee_pipe - at_status=`cat $at_status_file` - ;; - - 11 ) # 11. output.at:52: Output files: %defines %verbose & . - at_setup_line='output.at:52' - at_desc='Output files: %defines %verbose & .' - $at_quiet $ECHO_N " 11: Output files: %defines %verbose & . $ECHO_C" - at_xfail=no - ( - echo "11. output.at:52: testing ..." - $at_traceon - -cat >foo.y <<'_ATEOF' -%defines %verbose -%% -foo: {}; -_ATEOF - - -$at_traceoff -echo "output.at:52: bison foo.y" -echo output.at:52 >$at_check_line_file -( $at_traceon; bison foo.y ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "output.at:52: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - -$at_traceoff -echo "output.at:52: ls foo.output foo.tab.c foo.tab.h" -echo output.at:52 >$at_check_line_file -( $at_traceon; ls foo.output foo.tab.c foo.tab.h ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -echo stdout:; cat $at_stdout -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "output.at:52: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - $at_traceoff - $at_times_p && times >$at_times_file - ) 5>&1 2>&1 | eval $at_tee_pipe - at_status=`cat $at_status_file` - ;; - - 12 ) # 12. output.at:54: Output files: %defines %verbose %yacc & . - at_setup_line='output.at:54' - at_desc='Output files: %defines %verbose %yacc & .' - $at_quiet $ECHO_N " 12: Output files: %defines %verbose %yacc & . $ECHO_C" - at_xfail=no - ( - echo "12. output.at:54: testing ..." - $at_traceon - -cat >foo.y <<'_ATEOF' -%defines %verbose %yacc -%% -foo: {}; -_ATEOF - - -$at_traceoff -echo "output.at:54: bison foo.y" -echo output.at:54 >$at_check_line_file -( $at_traceon; bison foo.y ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "output.at:54: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - -$at_traceoff -echo "output.at:54: ls y.output y.tab.c y.tab.h" -echo output.at:54 >$at_check_line_file -( $at_traceon; ls y.output y.tab.c y.tab.h ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -echo stdout:; cat $at_stdout -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "output.at:54: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - $at_traceoff - $at_times_p && times >$at_times_file - ) 5>&1 2>&1 | eval $at_tee_pipe - at_status=`cat $at_status_file` - ;; - - 13 ) # 13. output.at:57: Output files: %defines %verbose %yacc & . - at_setup_line='output.at:57' - at_desc='Output files: %defines %verbose %yacc & .' - $at_quiet $ECHO_N " 13: Output files: %defines %verbose %yacc & . $ECHO_C" - at_xfail=no - ( - echo "13. output.at:57: testing ..." - $at_traceon - -cat >foo.yy <<'_ATEOF' -%defines %verbose %yacc -%% -foo: {}; -_ATEOF - - -$at_traceoff -echo "output.at:57: bison foo.yy" -echo output.at:57 >$at_check_line_file -( $at_traceon; bison foo.yy ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "output.at:57: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - -$at_traceoff -echo "output.at:57: ls y.output y.tab.c y.tab.h" -echo output.at:57 >$at_check_line_file -( $at_traceon; ls y.output y.tab.c y.tab.h ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -echo stdout:; cat $at_stdout -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "output.at:57: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - $at_traceoff - $at_times_p && times >$at_times_file - ) 5>&1 2>&1 | eval $at_tee_pipe - at_status=`cat $at_status_file` - ;; - - 14 ) # 14. output.at:61: Output files: %file-prefix="bar" %defines %verbose & . - at_setup_line='output.at:61' - at_desc='Output files: %file-prefix="bar" %defines %verbose & .' - $at_quiet $ECHO_N " 14: Output files: %file-prefix="bar" %defines %verbose & .$ECHO_C" - at_xfail=no - ( - echo "14. output.at:61: testing ..." - $at_traceon - -cat >foo.y <<'_ATEOF' -%file-prefix="bar" %defines %verbose -%% -foo: {}; -_ATEOF - - -$at_traceoff -echo "output.at:61: bison foo.y" -echo output.at:61 >$at_check_line_file -( $at_traceon; bison foo.y ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "output.at:61: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - -$at_traceoff -echo "output.at:61: ls bar.output bar.tab.c bar.tab.h" -echo output.at:61 >$at_check_line_file -( $at_traceon; ls bar.output bar.tab.c bar.tab.h ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -echo stdout:; cat $at_stdout -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "output.at:61: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - $at_traceoff - $at_times_p && times >$at_times_file - ) 5>&1 2>&1 | eval $at_tee_pipe - at_status=`cat $at_status_file` - ;; - - 15 ) # 15. output.at:63: Output files: %output="bar.c" %defines %verbose %yacc & . - at_setup_line='output.at:63' - at_desc='Output files: %output="bar.c" %defines %verbose %yacc & .' - $at_quiet $ECHO_N " 15: Output files: %output="bar.c" %defines %verbose %yacc & .$ECHO_C" - at_xfail=no - ( - echo "15. output.at:63: testing ..." - $at_traceon - -cat >foo.y <<'_ATEOF' -%output="bar.c" %defines %verbose %yacc -%% -foo: {}; -_ATEOF - - -$at_traceoff -echo "output.at:63: bison foo.y" -echo output.at:63 >$at_check_line_file -( $at_traceon; bison foo.y ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "output.at:63: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - -$at_traceoff -echo "output.at:63: ls bar.output bar.c bar.h" -echo output.at:63 >$at_check_line_file -( $at_traceon; ls bar.output bar.c bar.h ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -echo stdout:; cat $at_stdout -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "output.at:63: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - $at_traceoff - $at_times_p && times >$at_times_file - ) 5>&1 2>&1 | eval $at_tee_pipe - at_status=`cat $at_status_file` - ;; - - 16 ) # 16. output.at:67: Output files: %file-prefix="baz" %output="bar.c" %defines %verbose %yacc & . - at_setup_line='output.at:67' - at_desc='Output files: %file-prefix="baz" %output="bar.c" %defines %verbose %yacc & .' - $at_quiet $ECHO_N " 16: Output files: %file-prefix="baz" %output="bar.c" %defines %verbose %yacc & .$ECHO_C" - at_xfail=no - ( - echo "16. output.at:67: testing ..." - $at_traceon - -cat >foo.y <<'_ATEOF' -%file-prefix="baz" %output="bar.c" %defines %verbose %yacc -%% -foo: {}; -_ATEOF - - -$at_traceoff -echo "output.at:67: bison foo.y" -echo output.at:67 >$at_check_line_file -( $at_traceon; bison foo.y ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "output.at:67: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - -$at_traceoff -echo "output.at:67: ls bar.output bar.c bar.h" -echo output.at:67 >$at_check_line_file -( $at_traceon; ls bar.output bar.c bar.h ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -echo stdout:; cat $at_stdout -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "output.at:67: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - $at_traceoff - $at_times_p && times >$at_times_file - ) 5>&1 2>&1 | eval $at_tee_pipe - at_status=`cat $at_status_file` - ;; - - 17 ) # 17. output.at:72: Output files: %defines %verbose & . - at_setup_line='output.at:72' - at_desc='Output files: %defines %verbose & .' - $at_quiet $ECHO_N " 17: Output files: %defines %verbose & . $ECHO_C" - at_xfail=no - ( - echo "17. output.at:72: testing ..." - $at_traceon - -cat >foo.yy <<'_ATEOF' -%defines %verbose -%% -foo: {}; -_ATEOF - - -$at_traceoff -echo "output.at:72: bison foo.yy" -echo output.at:72 >$at_check_line_file -( $at_traceon; bison foo.yy ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "output.at:72: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - -$at_traceoff -echo "output.at:72: ls foo.output foo.tab.cc foo.tab.hh" -echo output.at:72 >$at_check_line_file -( $at_traceon; ls foo.output foo.tab.cc foo.tab.hh ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -echo stdout:; cat $at_stdout -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "output.at:72: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - $at_traceoff - $at_times_p && times >$at_times_file - ) 5>&1 2>&1 | eval $at_tee_pipe - at_status=`cat $at_status_file` - ;; - - 18 ) # 18. output.at:75: Output files: %defines %verbose & -o foo.c. - at_setup_line='output.at:75' - at_desc='Output files: %defines %verbose & -o foo.c.' - $at_quiet $ECHO_N " 18: Output files: %defines %verbose & -o foo.c. $ECHO_C" - at_xfail=no - ( - echo "18. output.at:75: testing ..." - $at_traceon - -cat >foo.yy <<'_ATEOF' -%defines %verbose -%% -foo: {}; -_ATEOF - - -$at_traceoff -echo "output.at:75: bison -o foo.c foo.yy" -echo output.at:75 >$at_check_line_file -( $at_traceon; bison -o foo.c foo.yy ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "output.at:75: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - -$at_traceoff -echo "output.at:75: ls foo.c foo.h foo.output" -echo output.at:75 >$at_check_line_file -( $at_traceon; ls foo.c foo.h foo.output ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -echo stdout:; cat $at_stdout -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "output.at:75: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - $at_traceoff - $at_times_p && times >$at_times_file - ) 5>&1 2>&1 | eval $at_tee_pipe - at_status=`cat $at_status_file` - ;; - - 19 ) # 19. output.at:79: Output files: & --defines=foo.hpp -o foo.c++. - at_setup_line='output.at:79' - at_desc='Output files: & --defines=foo.hpp -o foo.c++.' - $at_quiet $ECHO_N " 19: Output files: & --defines=foo.hpp -o foo.c++.$ECHO_C" - at_xfail=no - ( - echo "19. output.at:79: testing ..." - $at_traceon - -cat >foo.yy <<'_ATEOF' - -%% -foo: {}; -_ATEOF - - -$at_traceoff -echo "output.at:79: bison --defines=foo.hpp -o foo.c++ foo.yy" -echo output.at:79 >$at_check_line_file -( $at_traceon; bison --defines=foo.hpp -o foo.c++ foo.yy ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "output.at:79: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - -$at_traceoff -echo "output.at:79: ls foo.c++ foo.hpp" -echo output.at:79 >$at_check_line_file -( $at_traceon; ls foo.c++ foo.hpp ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -echo stdout:; cat $at_stdout -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "output.at:79: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - $at_traceoff - $at_times_p && times >$at_times_file - ) 5>&1 2>&1 | eval $at_tee_pipe - at_status=`cat $at_status_file` - ;; - - 20 ) # 20. output.at:83: Output files: & -o foo.c++ --graph=foo.gph. - at_setup_line='output.at:83' - at_desc='Output files: & -o foo.c++ --graph=foo.gph.' - $at_quiet $ECHO_N " 20: Output files: & -o foo.c++ --graph=foo.gph. $ECHO_C" - at_xfail=no - ( - echo "20. output.at:83: testing ..." - $at_traceon - -cat >foo.yy <<'_ATEOF' - -%% -foo: {}; -_ATEOF - - -$at_traceoff -echo "output.at:83: bison -o foo.c++ --graph=foo.gph foo.yy" -echo output.at:83 >$at_check_line_file -( $at_traceon; bison -o foo.c++ --graph=foo.gph foo.yy ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "output.at:83: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - -$at_traceoff -echo "output.at:83: ls foo.c++ foo.gph" -echo output.at:83 >$at_check_line_file -( $at_traceon; ls foo.c++ foo.gph ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -echo stdout:; cat $at_stdout -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "output.at:83: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - $at_traceoff - $at_times_p && times >$at_times_file - ) 5>&1 2>&1 | eval $at_tee_pipe - at_status=`cat $at_status_file` - ;; - - - banner-3 ) # Banner 3. sets.at:59 - cat <<\_ATEOF - -Grammar Sets (Firsts etc.). - -_ATEOF - ;; - - 21 ) # 21. sets.at:66: Nullable - at_setup_line='sets.at:66' - at_desc='Nullable' - $at_quiet $ECHO_N " 21: Nullable $ECHO_C" - at_xfail=no - ( - echo "21. sets.at:66: testing ..." - $at_traceon - - -# At some point, nullable had been smoking grass, and managed to say: -# -# Entering set_nullable -# NULLABLE -# 'e': yes -# (null): no -# ... - -cat >input.y <<'_ATEOF' -%% -e: 'e' | /* Nothing */; -_ATEOF - - -$at_traceoff -echo "sets.at:81: bison --trace=sets input.y" -echo sets.at:81 >$at_check_line_file -( $at_traceon; bison --trace=sets input.y ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo stderr:; tee stderr <$at_stderr -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "sets.at:81: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - -cat >extract.sed <<'_ATEOF' -#n -/^NULLABLE$/ { - :null - p - n - /^[ ]*$/ !b null -} -/^FIRSTS$/ { - :firsts - p - n - /^[ ]*$/ !b firsts -} -/^FDERIVES$/ { - :fderiv - p - n - /^[ ]*$/ !b fderiv -} -/^DERIVES$/ { - :deriv - p - n - /^[ ]*$/ !b deriv -} -_ATEOF - -$at_traceoff -echo "sets.at:82: sed -f extract.sed stderr" -echo sets.at:82 >$at_check_line_file -( $at_traceon; sed -f extract.sed stderr ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -echo stdout:; tee stdout <$at_stdout -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "sets.at:82: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - -$at_traceoff -echo "sets.at:82: mv stdout sets" -echo sets.at:82 >$at_check_line_file -( $at_traceon; mv stdout sets ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "sets.at:82: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - -$at_traceoff -echo "sets.at:107: cat sets" -echo sets.at:107 >$at_check_line_file -( $at_traceon; cat sets ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -echo >>$at_stdout; echo "DERIVES - \$accept derives - 0 e \$end - e derives - 1 'e' - 2 /* empty */ -NULLABLE - \$accept: no - e: yes -FIRSTS - \$accept firsts - \$accept - e - e firsts - e -FDERIVES - \$accept derives - 0 e \$end - 1 'e' - 2 /* empty */ - e derives - 1 'e' - 2 /* empty */ -" | $at_diff - $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "sets.at:107: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - - $at_traceoff - $at_times_p && times >$at_times_file - ) 5>&1 2>&1 | eval $at_tee_pipe - at_status=`cat $at_status_file` - ;; - - 22 ) # 22. sets.at:151: Broken Closure - at_setup_line='sets.at:151' - at_desc='Broken Closure' - $at_quiet $ECHO_N " 22: Broken Closure $ECHO_C" - at_xfail=no - ( - echo "22. sets.at:151: testing ..." - $at_traceon - - -cat >input.y <<'_ATEOF' -%% -a: b; -b: c; -c: d; -d: e; -e: f; -f: g; -g: h; -h: 'h'; -_ATEOF - - -$at_traceoff -echo "sets.at:165: bison --trace=sets input.y" -echo sets.at:165 >$at_check_line_file -( $at_traceon; bison --trace=sets input.y ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo stderr:; tee stderr <$at_stderr -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "sets.at:165: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - -$at_traceoff -echo "sets.at:183: sed -n 's/[ ]*\$//;/^RTC: Firsts Output BEGIN/,/^RTC: Firsts Output END/p' stderr" -echo sets.at:183 >$at_check_line_file -( $at_traceon; sed -n 's/[ ]*$//;/^RTC: Firsts Output BEGIN/,/^RTC: Firsts Output END/p' stderr ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -echo >>$at_stdout; echo "RTC: Firsts Output BEGIN - - 012345678 - .---------. - 0|111111111| - 1| 11111111| - 2| 1111111| - 3| 111111| - 4| 11111| - 5| 1111| - 6| 111| - 7| 11| - 8| 1| - \`---------' -RTC: Firsts Output END -" | $at_diff - $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "sets.at:183: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - - $at_traceoff - $at_times_p && times >$at_times_file - ) 5>&1 2>&1 | eval $at_tee_pipe - at_status=`cat $at_status_file` - ;; - - 23 ) # 23. sets.at:193: Firsts - at_setup_line='sets.at:193' - at_desc='Firsts' - $at_quiet $ECHO_N " 23: Firsts $ECHO_C" - at_xfail=no - ( - echo "23. sets.at:193: testing ..." - $at_traceon - - -cat >input.y <<'_ATEOF' -%nonassoc '<' '>' -%left '+' '-' -%right '^' '=' -%% -exp: - exp '<' exp - | exp '>' exp - | exp '+' exp - | exp '-' exp - | exp '^' exp - | exp '=' exp - | "exp" - ; -_ATEOF - - -$at_traceoff -echo "sets.at:211: bison --trace=sets input.y" -echo sets.at:211 >$at_check_line_file -( $at_traceon; bison --trace=sets input.y ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo stderr:; tee stderr <$at_stderr -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "sets.at:211: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - -cat >extract.sed <<'_ATEOF' -#n -/^NULLABLE$/ { - :null - p - n - /^[ ]*$/ !b null -} -/^FIRSTS$/ { - :firsts - p - n - /^[ ]*$/ !b firsts -} -/^FDERIVES$/ { - :fderiv - p - n - /^[ ]*$/ !b fderiv -} -/^DERIVES$/ { - :deriv - p - n - /^[ ]*$/ !b deriv -} -_ATEOF - -$at_traceoff -echo "sets.at:212: sed -f extract.sed stderr" -echo sets.at:212 >$at_check_line_file -( $at_traceon; sed -f extract.sed stderr ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -echo stdout:; tee stdout <$at_stdout -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "sets.at:212: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - -$at_traceoff -echo "sets.at:212: mv stdout sets" -echo sets.at:212 >$at_check_line_file -( $at_traceon; mv stdout sets ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "sets.at:212: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - -$at_traceoff -echo "sets.at:252: cat sets" -echo sets.at:252 >$at_check_line_file -( $at_traceon; cat sets ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -echo >>$at_stdout; echo "DERIVES - \$accept derives - 0 exp \$end - exp derives - 1 exp '<' exp - 2 exp '>' exp - 3 exp '+' exp - 4 exp '-' exp - 5 exp '^' exp - 6 exp '=' exp - 7 \"exp\" -NULLABLE - \$accept: no - exp: no -FIRSTS - \$accept firsts - \$accept - exp - exp firsts - exp -FDERIVES - \$accept derives - 0 exp \$end - 1 exp '<' exp - 2 exp '>' exp - 3 exp '+' exp - 4 exp '-' exp - 5 exp '^' exp - 6 exp '=' exp - 7 \"exp\" - exp derives - 1 exp '<' exp - 2 exp '>' exp - 3 exp '+' exp - 4 exp '-' exp - 5 exp '^' exp - 6 exp '=' exp - 7 \"exp\" -" | $at_diff - $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "sets.at:252: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - - $at_traceoff - $at_times_p && times >$at_times_file - ) 5>&1 2>&1 | eval $at_tee_pipe - at_status=`cat $at_status_file` - ;; - - - banner-4 ) # Banner 4. reduce.at:19 - cat <<\_ATEOF - -Grammar Reduction. - -_ATEOF - ;; - - 24 ) # 24. reduce.at:26: Useless Terminals - at_setup_line='reduce.at:26' - at_desc='Useless Terminals' - $at_quiet $ECHO_N " 24: Useless Terminals $ECHO_C" - at_xfail=no - ( - echo "24. reduce.at:26: testing ..." - $at_traceon - - -cat >input.y <<'_ATEOF' -%verbose -%output="input.c" - -%token useless1 -%token useless2 -%token useless3 -%token useless4 -%token useless5 -%token useless6 -%token useless7 -%token useless8 -%token useless9 - -%token useful -%% -exp: useful; -_ATEOF - - -$at_traceoff -echo "reduce.at:47: bison input.y" -echo reduce.at:47 >$at_check_line_file -( $at_traceon; bison input.y ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "reduce.at:47: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - -$at_traceoff -echo "reduce.at:60: sed -n '/^Grammar/q;/^\$/!p' input.output" -echo reduce.at:60 >$at_check_line_file -( $at_traceon; sed -n '/^Grammar/q;/^$/!p' input.output ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -echo >>$at_stdout; echo "Terminals which are not used - useless1 - useless2 - useless3 - useless4 - useless5 - useless6 - useless7 - useless8 - useless9 -" | $at_diff - $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "reduce.at:60: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - - $at_traceoff - $at_times_p && times >$at_times_file - ) 5>&1 2>&1 | eval $at_tee_pipe - at_status=`cat $at_status_file` - ;; - - 25 ) # 25. reduce.at:70: Useless Nonterminals - at_setup_line='reduce.at:70' - at_desc='Useless Nonterminals' - $at_quiet $ECHO_N " 25: Useless Nonterminals $ECHO_C" - at_xfail=no - ( - echo "25. reduce.at:70: testing ..." - $at_traceon - - -cat >input.y <<'_ATEOF' -%verbose -%output="input.c" - -%nterm useless1 -%nterm useless2 -%nterm useless3 -%nterm useless4 -%nterm useless5 -%nterm useless6 -%nterm useless7 -%nterm useless8 -%nterm useless9 - -%token useful -%% -exp: useful; -_ATEOF - - -$at_traceoff -echo "reduce.at:102: bison input.y" -echo reduce.at:102 >$at_check_line_file -( $at_traceon; bison input.y ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo >>$at_stderr; echo "input.y: warning: 9 useless nonterminals -input.y:4.8-15: warning: useless nonterminal: useless1 -input.y:5.8-15: warning: useless nonterminal: useless2 -input.y:6.8-15: warning: useless nonterminal: useless3 -input.y:7.8-15: warning: useless nonterminal: useless4 -input.y:8.8-15: warning: useless nonterminal: useless5 -input.y:9.8-15: warning: useless nonterminal: useless6 -input.y:10.8-15: warning: useless nonterminal: useless7 -input.y:11.8-15: warning: useless nonterminal: useless8 -input.y:12.8-15: warning: useless nonterminal: useless9 -" | $at_diff - $at_stderr || at_failed=: -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "reduce.at:102: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - -$at_traceoff -echo "reduce.at:115: sed -n '/^Grammar/q;/^\$/!p' input.output" -echo reduce.at:115 >$at_check_line_file -( $at_traceon; sed -n '/^Grammar/q;/^$/!p' input.output ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -echo >>$at_stdout; echo "Useless nonterminals - useless1 - useless2 - useless3 - useless4 - useless5 - useless6 - useless7 - useless8 - useless9 -" | $at_diff - $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "reduce.at:115: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - - $at_traceoff - $at_times_p && times >$at_times_file - ) 5>&1 2>&1 | eval $at_tee_pipe - at_status=`cat $at_status_file` - ;; - - 26 ) # 26. reduce.at:125: Useless Rules - at_setup_line='reduce.at:125' - at_desc='Useless Rules' - $at_quiet $ECHO_N " 26: Useless Rules $ECHO_C" - at_xfail=no - ( - echo "26. reduce.at:125: testing ..." - $at_traceon - - - - -cat >input.y <<'_ATEOF' -%verbose -%output="input.c" -%token useful -%% -exp: useful; -useless1: '1'; -useless2: '2'; -useless3: '3'; -useless4: '4'; -useless5: '5'; -useless6: '6'; -useless7: '7'; -useless8: '8'; -useless9: '9'; -_ATEOF - - -$at_traceoff -echo "reduce.at:166: bison input.y" -echo reduce.at:166 >$at_check_line_file -( $at_traceon; bison input.y ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo >>$at_stderr; echo "input.y: warning: 9 useless nonterminals and 9 useless rules -input.y:6.1-8: warning: useless nonterminal: useless1 -input.y:7.1-8: warning: useless nonterminal: useless2 -input.y:8.1-8: warning: useless nonterminal: useless3 -input.y:9.1-8: warning: useless nonterminal: useless4 -input.y:10.1-8: warning: useless nonterminal: useless5 -input.y:11.1-8: warning: useless nonterminal: useless6 -input.y:12.1-8: warning: useless nonterminal: useless7 -input.y:13.1-8: warning: useless nonterminal: useless8 -input.y:14.1-8: warning: useless nonterminal: useless9 -input.y:6.11-13: warning: useless rule: useless1: '1' -input.y:7.11-13: warning: useless rule: useless2: '2' -input.y:8.11-13: warning: useless rule: useless3: '3' -input.y:9.11-13: warning: useless rule: useless4: '4' -input.y:10.11-13: warning: useless rule: useless5: '5' -input.y:11.11-13: warning: useless rule: useless6: '6' -input.y:12.11-13: warning: useless rule: useless7: '7' -input.y:13.11-13: warning: useless rule: useless8: '8' -input.y:14.11-13: warning: useless rule: useless9: '9' -" | $at_diff - $at_stderr || at_failed=: -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "reduce.at:166: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - -$at_traceoff -echo "reduce.at:199: sed -n '/^Grammar/q;/^\$/!p' input.output" -echo reduce.at:199 >$at_check_line_file -( $at_traceon; sed -n '/^Grammar/q;/^$/!p' input.output ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -echo >>$at_stdout; echo "Useless nonterminals - useless1 - useless2 - useless3 - useless4 - useless5 - useless6 - useless7 - useless8 - useless9 -Terminals which are not used - '1' - '2' - '3' - '4' - '5' - '6' - '7' - '8' - '9' -Useless rules - 2 useless1: '1' - 3 useless2: '2' - 4 useless3: '3' - 5 useless4: '4' - 6 useless5: '5' - 7 useless6: '6' - 8 useless7: '7' - 9 useless8: '8' - 10 useless9: '9' -" | $at_diff - $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "reduce.at:199: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - - $at_traceoff - $at_times_p && times >$at_times_file - ) 5>&1 2>&1 | eval $at_tee_pipe - at_status=`cat $at_status_file` - ;; - - 27 ) # 27. reduce.at:212: Reduced Automaton - at_setup_line='reduce.at:212' - at_desc='Reduced Automaton' - $at_quiet $ECHO_N " 27: Reduced Automaton $ECHO_C" - at_xfail=no - ( - echo "27. reduce.at:212: testing ..." - $at_traceon - - - - -# The non reduced grammar. -# ------------------------ -cat >not-reduced.y <<'_ATEOF' -/* A useless token. */ -%token useless_token -/* A useful one. */ -%token useful -%verbose -%output="not-reduced.c" - -%% - -exp: useful { /* A useful action. */ } - | non_productive { /* A non productive action. */ } - ; - -not_reachable: useful { /* A not reachable action. */ } - ; - -non_productive: non_productive useless_token - { /* Another non productive action. */ } - ; -%% -_ATEOF - - -$at_traceoff -echo "reduce.at:248: bison not-reduced.y" -echo reduce.at:248 >$at_check_line_file -( $at_traceon; bison not-reduced.y ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo >>$at_stderr; echo "not-reduced.y: warning: 2 useless nonterminals and 3 useless rules -not-reduced.y:14.1-13: warning: useless nonterminal: not_reachable -not-reduced.y:11.6-19: warning: useless nonterminal: non_productive -not-reduced.y:11.6-57: warning: useless rule: exp: non_productive -not-reduced.y:14.16-56: warning: useless rule: not_reachable: useful -not-reduced.y:17.17-18.63: warning: useless rule: non_productive: non_productive useless_token -" | $at_diff - $at_stderr || at_failed=: -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "reduce.at:248: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - -$at_traceoff -echo "reduce.at:260: sed -n '/^Grammar/q;/^\$/!p' not-reduced.output" -echo reduce.at:260 >$at_check_line_file -( $at_traceon; sed -n '/^Grammar/q;/^$/!p' not-reduced.output ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -echo >>$at_stdout; echo "Useless nonterminals - not_reachable - non_productive -Terminals which are not used - useless_token -Useless rules - 2 exp: non_productive - 3 not_reachable: useful - 4 non_productive: non_productive useless_token -" | $at_diff - $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "reduce.at:260: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - -# The reduced grammar. -# -------------------- -cat >reduced.y <<'_ATEOF' -/* A useless token. */ -%token useless_token -/* A useful one. */ -%token useful -%verbose -%output="reduced.c" - -%% - -exp: useful { /* A useful action. */ } -// | non_productive { /* A non productive action. */ } */ - ; - -//not_reachable: useful { /* A not reachable action. */ } -// ; - -//non_productive: non_productive useless_token -// { /* Another non productive action. */ } -// ; -%% -_ATEOF - - -$at_traceoff -echo "reduce.at:287: bison reduced.y" -echo reduce.at:287 >$at_check_line_file -( $at_traceon; bison reduced.y ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "reduce.at:287: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - -# Comparing the parsers. -cp reduced.c expout -$at_traceoff -echo "reduce.at:291: sed 's/not-reduced/reduced/g' not-reduced.c" -echo reduce.at:291 >$at_check_line_file -( $at_traceon; sed 's/not-reduced/reduced/g' not-reduced.c ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -$at_diff expout $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "reduce.at:291: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - - $at_traceoff - $at_times_p && times >$at_times_file - ) 5>&1 2>&1 | eval $at_tee_pipe - at_status=`cat $at_status_file` - ;; - - 28 ) # 28. reduce.at:301: Underivable Rules - at_setup_line='reduce.at:301' - at_desc='Underivable Rules' - $at_quiet $ECHO_N " 28: Underivable Rules $ECHO_C" - at_xfail=no - ( - echo "28. reduce.at:301: testing ..." - $at_traceon - - - - -cat >input.y <<'_ATEOF' -%verbose -%output="input.c" -%token useful -%% -exp: useful | underivable; -underivable: indirection; -indirection: underivable; -_ATEOF - - -$at_traceoff -echo "reduce.at:322: bison input.y" -echo reduce.at:322 >$at_check_line_file -( $at_traceon; bison input.y ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo >>$at_stderr; echo "input.y: warning: 2 useless nonterminals and 3 useless rules -input.y:5.15-25: warning: useless nonterminal: underivable -input.y:6.14-24: warning: useless nonterminal: indirection -input.y:5.15-25: warning: useless rule: exp: underivable -input.y:6.14-24: warning: useless rule: underivable: indirection -input.y:7.14-24: warning: useless rule: indirection: underivable -" | $at_diff - $at_stderr || at_failed=: -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "reduce.at:322: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - -$at_traceoff -echo "reduce.at:332: sed -n '/^Grammar/q;/^\$/!p' input.output" -echo reduce.at:332 >$at_check_line_file -( $at_traceon; sed -n '/^Grammar/q;/^$/!p' input.output ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -echo >>$at_stdout; echo "Useless nonterminals - underivable - indirection -Useless rules - 2 exp: underivable - 3 underivable: indirection - 4 indirection: underivable -" | $at_diff - $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "reduce.at:332: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - - $at_traceoff - $at_times_p && times >$at_times_file - ) 5>&1 2>&1 | eval $at_tee_pipe - at_status=`cat $at_status_file` - ;; - - 29 ) # 29. reduce.at:342: Empty Language - at_setup_line='reduce.at:342' - at_desc='Empty Language' - $at_quiet $ECHO_N " 29: Empty Language $ECHO_C" - at_xfail=no - ( - echo "29. reduce.at:342: testing ..." - $at_traceon - - -cat >input.y <<'_ATEOF' -%output="input.c" -%% -exp: exp; -_ATEOF - - -$at_traceoff -echo "reduce.at:353: bison input.y" -echo reduce.at:353 >$at_check_line_file -( $at_traceon; bison input.y ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo >>$at_stderr; echo "input.y: warning: 2 useless nonterminals and 2 useless rules -input.y:3.1-3: fatal error: start symbol exp does not derive any sentence -" | $at_diff - $at_stderr || at_failed=: -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 1) ;; - *) echo "reduce.at:353: exit code was $at_status, expected 1" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - - $at_traceoff - $at_times_p && times >$at_times_file - ) 5>&1 2>&1 | eval $at_tee_pipe - at_status=`cat $at_status_file` - ;; - - - banner-5 ) # Banner 5. synclines.at:19 - cat <<\_ATEOF - -User Actions. - -_ATEOF - ;; - - 30 ) # 30. synclines.at:93: Prologue synch line - at_setup_line='synclines.at:93' - at_desc='Prologue synch line' - $at_quiet $ECHO_N " 30: Prologue synch line $ECHO_C" - at_xfail=no - ( - echo "30. synclines.at:93: testing ..." - $at_traceon - - -# It seems impossible to find a generic scheme to check the location -# of an error. Even requiring GCC is not sufficient, since for instance -# the version modified by Apple: -# -# | Reading specs from /usr/libexec/gcc/darwin/ppc/2.95.2/specs -# | Apple Computer, Inc. version gcc-934.3, based on gcc version 2.95.2 -# | 19991024 (release) configure:2124: $? = 0 -# -# instead of: -# -# | input.y:2: #error "2" -# -# it reports: -# -# | input.y:2: "2" -# | cpp-precomp: warning: errors during smart preprocessing, retrying in basic mode - -cat >syncline.c <<'_ATEOF' -#error "1" -_ATEOF - - -$at_traceoff -echo "synclines.at:93: \$CC \$CFLAGS \$CPPFLAGS -c syncline.c" -echo synclines.at:93 >$at_check_line_file -( $at_traceon; $CC $CFLAGS $CPPFLAGS -c syncline.c ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo stderr:; tee stderr <$at_stderr -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - *);; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - -# In case GCC displays column information, strip it down. -# -# input.y:4:2: #error "4" or input.y:4.2: #error "4" -# => -# input.y:4: #error "4" -# -$at_traceoff -echo "synclines.at:93: sed 's/^\\([^:]*:[^:.]*\\)[.:][^:]*:\\(.*\\)\$/\\1:\\2/' stderr" -echo synclines.at:93 >$at_check_line_file -( $at_traceon; sed 's/^\([^:]*:[^:.]*\)[.:][^:]*:\(.*\)$/\1:\2/' stderr ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -echo stdout:; tee stdout <$at_stdout -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "synclines.at:93: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - -$at_traceoff -echo "synclines.at:93: test \"\`cat stdout\`\" = 'syncline.c:1: #error \"1\"' || exit 77" -echo synclines.at:93 >$at_check_line_file -( $at_traceon; test "`cat stdout`" = 'syncline.c:1: #error "1"' || exit 77 ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "synclines.at:93: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - -cat >input.y <<'_ATEOF' -%{ -#error "2" -void yyerror (const char *s); -int yylex (void); -%} -%% -exp: '0'; -_ATEOF - -$at_traceoff -echo "synclines.at:93: bison -o input.c input.y" -echo synclines.at:93 >$at_check_line_file -( $at_traceon; bison -o input.c input.y ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "synclines.at:93: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - -$at_traceoff -echo "synclines.at:93: \$CC \$CFLAGS \$CPPFLAGS -c input.c" -echo synclines.at:93 >$at_check_line_file -( $at_traceon; $CC $CFLAGS $CPPFLAGS -c input.c ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo stderr:; tee stderr <$at_stderr -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - *);; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - -# In case GCC displays column information, strip it down. -# -# input.y:4:2: #error "4" or input.y:4.2: #error "4" -# => -# input.y:4: #error "4" -# -$at_traceoff -echo "synclines.at:93: sed 's/^\\([^:]*:[^:.]*\\)[.:][^:]*:\\(.*\\)\$/\\1:\\2/' stderr" -echo synclines.at:93 >$at_check_line_file -( $at_traceon; sed 's/^\([^:]*:[^:.]*\)[.:][^:]*:\(.*\)$/\1:\2/' stderr ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -echo stdout:; tee stdout <$at_stdout -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "synclines.at:93: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - -$at_traceoff -echo "synclines.at:93: cat stdout" -echo synclines.at:93 >$at_check_line_file -( $at_traceon; cat stdout ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -echo >>$at_stdout; echo "input.y:2: #error \"2\" -" | $at_diff - $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "synclines.at:93: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - $at_traceoff - $at_times_p && times >$at_times_file - ) 5>&1 2>&1 | eval $at_tee_pipe - at_status=`cat $at_status_file` - ;; - - 31 ) # 31. synclines.at:113: %union synch line - at_setup_line='synclines.at:113' - at_desc='%union synch line' - $at_quiet $ECHO_N " 31: %union synch line $ECHO_C" - at_xfail=no - ( - echo "31. synclines.at:113: testing ..." - $at_traceon - - -# It seems impossible to find a generic scheme to check the location -# of an error. Even requiring GCC is not sufficient, since for instance -# the version modified by Apple: -# -# | Reading specs from /usr/libexec/gcc/darwin/ppc/2.95.2/specs -# | Apple Computer, Inc. version gcc-934.3, based on gcc version 2.95.2 -# | 19991024 (release) configure:2124: $? = 0 -# -# instead of: -# -# | input.y:2: #error "2" -# -# it reports: -# -# | input.y:2: "2" -# | cpp-precomp: warning: errors during smart preprocessing, retrying in basic mode - -cat >syncline.c <<'_ATEOF' -#error "1" -_ATEOF - - -$at_traceoff -echo "synclines.at:113: \$CC \$CFLAGS \$CPPFLAGS -c syncline.c" -echo synclines.at:113 >$at_check_line_file -( $at_traceon; $CC $CFLAGS $CPPFLAGS -c syncline.c ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo stderr:; tee stderr <$at_stderr -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - *);; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - -# In case GCC displays column information, strip it down. -# -# input.y:4:2: #error "4" or input.y:4.2: #error "4" -# => -# input.y:4: #error "4" -# -$at_traceoff -echo "synclines.at:113: sed 's/^\\([^:]*:[^:.]*\\)[.:][^:]*:\\(.*\\)\$/\\1:\\2/' stderr" -echo synclines.at:113 >$at_check_line_file -( $at_traceon; sed 's/^\([^:]*:[^:.]*\)[.:][^:]*:\(.*\)$/\1:\2/' stderr ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -echo stdout:; tee stdout <$at_stdout -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "synclines.at:113: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - -$at_traceoff -echo "synclines.at:113: test \"\`cat stdout\`\" = 'syncline.c:1: #error \"1\"' || exit 77" -echo synclines.at:113 >$at_check_line_file -( $at_traceon; test "`cat stdout`" = 'syncline.c:1: #error "1"' || exit 77 ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "synclines.at:113: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - -cat >input.y <<'_ATEOF' -%union { -#error "2" - char dummy; -} -%{ -void yyerror (const char *s); -int yylex (void); -%} -%% -exp: '0'; -_ATEOF - -$at_traceoff -echo "synclines.at:113: bison -o input.c input.y" -echo synclines.at:113 >$at_check_line_file -( $at_traceon; bison -o input.c input.y ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "synclines.at:113: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - -$at_traceoff -echo "synclines.at:113: \$CC \$CFLAGS \$CPPFLAGS -c input.c" -echo synclines.at:113 >$at_check_line_file -( $at_traceon; $CC $CFLAGS $CPPFLAGS -c input.c ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo stderr:; tee stderr <$at_stderr -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - *);; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - -# In case GCC displays column information, strip it down. -# -# input.y:4:2: #error "4" or input.y:4.2: #error "4" -# => -# input.y:4: #error "4" -# -$at_traceoff -echo "synclines.at:113: sed 's/^\\([^:]*:[^:.]*\\)[.:][^:]*:\\(.*\\)\$/\\1:\\2/' stderr" -echo synclines.at:113 >$at_check_line_file -( $at_traceon; sed 's/^\([^:]*:[^:.]*\)[.:][^:]*:\(.*\)$/\1:\2/' stderr ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -echo stdout:; tee stdout <$at_stdout -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "synclines.at:113: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - -$at_traceoff -echo "synclines.at:113: cat stdout" -echo synclines.at:113 >$at_check_line_file -( $at_traceon; cat stdout ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -echo >>$at_stdout; echo "input.y:2: #error \"2\" -" | $at_diff - $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "synclines.at:113: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - $at_traceoff - $at_times_p && times >$at_times_file - ) 5>&1 2>&1 | eval $at_tee_pipe - at_status=`cat $at_status_file` - ;; - - 32 ) # 32. synclines.at:136: Postprologue synch line - at_setup_line='synclines.at:136' - at_desc='Postprologue synch line' - $at_quiet $ECHO_N " 32: Postprologue synch line $ECHO_C" - at_xfail=no - ( - echo "32. synclines.at:136: testing ..." - $at_traceon - - -# It seems impossible to find a generic scheme to check the location -# of an error. Even requiring GCC is not sufficient, since for instance -# the version modified by Apple: -# -# | Reading specs from /usr/libexec/gcc/darwin/ppc/2.95.2/specs -# | Apple Computer, Inc. version gcc-934.3, based on gcc version 2.95.2 -# | 19991024 (release) configure:2124: $? = 0 -# -# instead of: -# -# | input.y:2: #error "2" -# -# it reports: -# -# | input.y:2: "2" -# | cpp-precomp: warning: errors during smart preprocessing, retrying in basic mode - -cat >syncline.c <<'_ATEOF' -#error "1" -_ATEOF - - -$at_traceoff -echo "synclines.at:136: \$CC \$CFLAGS \$CPPFLAGS -c syncline.c" -echo synclines.at:136 >$at_check_line_file -( $at_traceon; $CC $CFLAGS $CPPFLAGS -c syncline.c ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo stderr:; tee stderr <$at_stderr -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - *);; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - -# In case GCC displays column information, strip it down. -# -# input.y:4:2: #error "4" or input.y:4.2: #error "4" -# => -# input.y:4: #error "4" -# -$at_traceoff -echo "synclines.at:136: sed 's/^\\([^:]*:[^:.]*\\)[.:][^:]*:\\(.*\\)\$/\\1:\\2/' stderr" -echo synclines.at:136 >$at_check_line_file -( $at_traceon; sed 's/^\([^:]*:[^:.]*\)[.:][^:]*:\(.*\)$/\1:\2/' stderr ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -echo stdout:; tee stdout <$at_stdout -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "synclines.at:136: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - -$at_traceoff -echo "synclines.at:136: test \"\`cat stdout\`\" = 'syncline.c:1: #error \"1\"' || exit 77" -echo synclines.at:136 >$at_check_line_file -( $at_traceon; test "`cat stdout`" = 'syncline.c:1: #error "1"' || exit 77 ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "synclines.at:136: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - -cat >input.y <<'_ATEOF' -%{ -void yyerror (const char *s); -int yylex (void); -%} -%union -{ - int ival; -} -%{ -#error "10" -%} -%% -exp: '0'; -_ATEOF - -$at_traceoff -echo "synclines.at:136: bison -o input.c input.y" -echo synclines.at:136 >$at_check_line_file -( $at_traceon; bison -o input.c input.y ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "synclines.at:136: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - -$at_traceoff -echo "synclines.at:136: \$CC \$CFLAGS \$CPPFLAGS -c input.c" -echo synclines.at:136 >$at_check_line_file -( $at_traceon; $CC $CFLAGS $CPPFLAGS -c input.c ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo stderr:; tee stderr <$at_stderr -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - *);; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - -# In case GCC displays column information, strip it down. -# -# input.y:4:2: #error "4" or input.y:4.2: #error "4" -# => -# input.y:4: #error "4" -# -$at_traceoff -echo "synclines.at:136: sed 's/^\\([^:]*:[^:.]*\\)[.:][^:]*:\\(.*\\)\$/\\1:\\2/' stderr" -echo synclines.at:136 >$at_check_line_file -( $at_traceon; sed 's/^\([^:]*:[^:.]*\)[.:][^:]*:\(.*\)$/\1:\2/' stderr ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -echo stdout:; tee stdout <$at_stdout -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "synclines.at:136: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - -$at_traceoff -echo "synclines.at:136: cat stdout" -echo synclines.at:136 >$at_check_line_file -( $at_traceon; cat stdout ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -echo >>$at_stdout; echo "input.y:10: #error \"10\" -" | $at_diff - $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "synclines.at:136: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - $at_traceoff - $at_times_p && times >$at_times_file - ) 5>&1 2>&1 | eval $at_tee_pipe - at_status=`cat $at_status_file` - ;; - - 33 ) # 33. synclines.at:155: Action synch line - at_setup_line='synclines.at:155' - at_desc='Action synch line' - $at_quiet $ECHO_N " 33: Action synch line $ECHO_C" - at_xfail=no - ( - echo "33. synclines.at:155: testing ..." - $at_traceon - - -# It seems impossible to find a generic scheme to check the location -# of an error. Even requiring GCC is not sufficient, since for instance -# the version modified by Apple: -# -# | Reading specs from /usr/libexec/gcc/darwin/ppc/2.95.2/specs -# | Apple Computer, Inc. version gcc-934.3, based on gcc version 2.95.2 -# | 19991024 (release) configure:2124: $? = 0 -# -# instead of: -# -# | input.y:2: #error "2" -# -# it reports: -# -# | input.y:2: "2" -# | cpp-precomp: warning: errors during smart preprocessing, retrying in basic mode - -cat >syncline.c <<'_ATEOF' -#error "1" -_ATEOF - - -$at_traceoff -echo "synclines.at:155: \$CC \$CFLAGS \$CPPFLAGS -c syncline.c" -echo synclines.at:155 >$at_check_line_file -( $at_traceon; $CC $CFLAGS $CPPFLAGS -c syncline.c ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo stderr:; tee stderr <$at_stderr -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - *);; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - -# In case GCC displays column information, strip it down. -# -# input.y:4:2: #error "4" or input.y:4.2: #error "4" -# => -# input.y:4: #error "4" -# -$at_traceoff -echo "synclines.at:155: sed 's/^\\([^:]*:[^:.]*\\)[.:][^:]*:\\(.*\\)\$/\\1:\\2/' stderr" -echo synclines.at:155 >$at_check_line_file -( $at_traceon; sed 's/^\([^:]*:[^:.]*\)[.:][^:]*:\(.*\)$/\1:\2/' stderr ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -echo stdout:; tee stdout <$at_stdout -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "synclines.at:155: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - -$at_traceoff -echo "synclines.at:155: test \"\`cat stdout\`\" = 'syncline.c:1: #error \"1\"' || exit 77" -echo synclines.at:155 >$at_check_line_file -( $at_traceon; test "`cat stdout`" = 'syncline.c:1: #error "1"' || exit 77 ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "synclines.at:155: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - -cat >input.y <<'_ATEOF' -%{ -void yyerror (const char *s); -int yylex (void); -%} -%% -exp: -{ -#error "8" -}; -_ATEOF - -$at_traceoff -echo "synclines.at:155: bison -o input.c input.y" -echo synclines.at:155 >$at_check_line_file -( $at_traceon; bison -o input.c input.y ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "synclines.at:155: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - -$at_traceoff -echo "synclines.at:155: \$CC \$CFLAGS \$CPPFLAGS -c input.c" -echo synclines.at:155 >$at_check_line_file -( $at_traceon; $CC $CFLAGS $CPPFLAGS -c input.c ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo stderr:; tee stderr <$at_stderr -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - *);; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - -# In case GCC displays column information, strip it down. -# -# input.y:4:2: #error "4" or input.y:4.2: #error "4" -# => -# input.y:4: #error "4" -# -$at_traceoff -echo "synclines.at:155: sed 's/^\\([^:]*:[^:.]*\\)[.:][^:]*:\\(.*\\)\$/\\1:\\2/' stderr" -echo synclines.at:155 >$at_check_line_file -( $at_traceon; sed 's/^\([^:]*:[^:.]*\)[.:][^:]*:\(.*\)$/\1:\2/' stderr ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -echo stdout:; tee stdout <$at_stdout -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "synclines.at:155: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - -$at_traceoff -echo "synclines.at:155: cat stdout" -echo synclines.at:155 >$at_check_line_file -( $at_traceon; cat stdout ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -echo >>$at_stdout; echo "input.y:8: #error \"8\" -" | $at_diff - $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "synclines.at:155: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - $at_traceoff - $at_times_p && times >$at_times_file - ) 5>&1 2>&1 | eval $at_tee_pipe - at_status=`cat $at_status_file` - ;; - - 34 ) # 34. synclines.at:173: Epilogue synch line - at_setup_line='synclines.at:173' - at_desc='Epilogue synch line' - $at_quiet $ECHO_N " 34: Epilogue synch line $ECHO_C" - at_xfail=no - ( - echo "34. synclines.at:173: testing ..." - $at_traceon - - -# It seems impossible to find a generic scheme to check the location -# of an error. Even requiring GCC is not sufficient, since for instance -# the version modified by Apple: -# -# | Reading specs from /usr/libexec/gcc/darwin/ppc/2.95.2/specs -# | Apple Computer, Inc. version gcc-934.3, based on gcc version 2.95.2 -# | 19991024 (release) configure:2124: $? = 0 -# -# instead of: -# -# | input.y:2: #error "2" -# -# it reports: -# -# | input.y:2: "2" -# | cpp-precomp: warning: errors during smart preprocessing, retrying in basic mode - -cat >syncline.c <<'_ATEOF' -#error "1" -_ATEOF - - -$at_traceoff -echo "synclines.at:173: \$CC \$CFLAGS \$CPPFLAGS -c syncline.c" -echo synclines.at:173 >$at_check_line_file -( $at_traceon; $CC $CFLAGS $CPPFLAGS -c syncline.c ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo stderr:; tee stderr <$at_stderr -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - *);; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - -# In case GCC displays column information, strip it down. -# -# input.y:4:2: #error "4" or input.y:4.2: #error "4" -# => -# input.y:4: #error "4" -# -$at_traceoff -echo "synclines.at:173: sed 's/^\\([^:]*:[^:.]*\\)[.:][^:]*:\\(.*\\)\$/\\1:\\2/' stderr" -echo synclines.at:173 >$at_check_line_file -( $at_traceon; sed 's/^\([^:]*:[^:.]*\)[.:][^:]*:\(.*\)$/\1:\2/' stderr ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -echo stdout:; tee stdout <$at_stdout -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "synclines.at:173: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - -$at_traceoff -echo "synclines.at:173: test \"\`cat stdout\`\" = 'syncline.c:1: #error \"1\"' || exit 77" -echo synclines.at:173 >$at_check_line_file -( $at_traceon; test "`cat stdout`" = 'syncline.c:1: #error "1"' || exit 77 ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "synclines.at:173: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - -cat >input.y <<'_ATEOF' -%{ -void yyerror (const char *s); -int yylex (void); -%} -%% -exp: '0'; -%% -#error "8" -_ATEOF - -$at_traceoff -echo "synclines.at:173: bison -o input.c input.y" -echo synclines.at:173 >$at_check_line_file -( $at_traceon; bison -o input.c input.y ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "synclines.at:173: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - -$at_traceoff -echo "synclines.at:173: \$CC \$CFLAGS \$CPPFLAGS -c input.c" -echo synclines.at:173 >$at_check_line_file -( $at_traceon; $CC $CFLAGS $CPPFLAGS -c input.c ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo stderr:; tee stderr <$at_stderr -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - *);; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - -# In case GCC displays column information, strip it down. -# -# input.y:4:2: #error "4" or input.y:4.2: #error "4" -# => -# input.y:4: #error "4" -# -$at_traceoff -echo "synclines.at:173: sed 's/^\\([^:]*:[^:.]*\\)[.:][^:]*:\\(.*\\)\$/\\1:\\2/' stderr" -echo synclines.at:173 >$at_check_line_file -( $at_traceon; sed 's/^\([^:]*:[^:.]*\)[.:][^:]*:\(.*\)$/\1:\2/' stderr ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -echo stdout:; tee stdout <$at_stdout -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "synclines.at:173: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - -$at_traceoff -echo "synclines.at:173: cat stdout" -echo synclines.at:173 >$at_check_line_file -( $at_traceon; cat stdout ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -echo >>$at_stdout; echo "input.y:8: #error \"8\" -" | $at_diff - $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "synclines.at:173: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - $at_traceoff - $at_times_p && times >$at_times_file - ) 5>&1 2>&1 | eval $at_tee_pipe - at_status=`cat $at_status_file` - ;; - - - banner-6 ) # Banner 6. headers.at:19 - cat <<\_ATEOF - -Parser Headers. - -_ATEOF - ;; - - 35 ) # 35. headers.at:27: %union and --defines - at_setup_line='headers.at:27' - at_desc='%union and --defines' - $at_quiet $ECHO_N " 35: %union and --defines $ECHO_C" - at_xfail=no - ( - echo "35. headers.at:27: testing ..." - $at_traceon - - -cat >input.y <<'_ATEOF' -%union -{ - int integer; - char *string ; -} -%% -exp: {}; -_ATEOF - - -$at_traceoff -echo "headers.at:39: bison --defines input.y" -echo headers.at:39 >$at_check_line_file -( $at_traceon; bison --defines input.y ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "headers.at:39: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - - $at_traceoff - $at_times_p && times >$at_times_file - ) 5>&1 2>&1 | eval $at_tee_pipe - at_status=`cat $at_status_file` - ;; - - 36 ) # 36. headers.at:76: Invalid CPP guards: input/input - at_setup_line='headers.at:76' - at_desc='Invalid CPP guards: input/input' - $at_quiet $ECHO_N " 36: Invalid CPP guards: input/input $ECHO_C" - at_xfail=no - ( - echo "36. headers.at:76: testing ..." - $at_traceon - - -# Possibly create inner directories. -dirname=`(dirname input/input) 2>/dev/null || -$as_expr Xinput/input : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - Xinput/input : 'X\(//\)[^/]' \| \ - Xinput/input : 'X\(//\)$' \| \ - Xinput/input : 'X\(/\)' \| \ - . : '\(.\)' 2>/dev/null || -echo Xinput/input | - sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } - /^X\(\/\/\)[^/].*/{ s//\1/; q; } - /^X\(\/\/\)$/{ s//\1/; q; } - /^X\(\/\).*/{ s//\1/; q; } - s/.*/./; q'` -{ if $as_mkdir_p; then - mkdir -p $dirname - else - as_dir=$dirname - as_dirs= - while test ! -d "$as_dir"; do - as_dirs="$as_dir $as_dirs" - as_dir=`(dirname "$as_dir") 2>/dev/null || -$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$as_dir" : 'X\(//\)[^/]' \| \ - X"$as_dir" : 'X\(//\)$' \| \ - X"$as_dir" : 'X\(/\)' \| \ - . : '\(.\)' 2>/dev/null || -echo X"$as_dir" | - sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } - /^X\(\/\/\)[^/].*/{ s//\1/; q; } - /^X\(\/\/\)$/{ s//\1/; q; } - /^X\(\/\).*/{ s//\1/; q; } - s/.*/./; q'` - done - test ! -n "$as_dirs" || mkdir $as_dirs - fi || { { echo "$as_me:$LINENO: error: cannot create directory $dirname" >&5 -echo "$as_me: error: cannot create directory $dirname" >&2;} - { (exit 1); exit 1; }; }; } - - -cat >input/input.y <<'_ATEOF' -%{ -#if HAVE_CONFIG_H -# include - /* We don't need perfect functions for these tests. */ -# undef malloc -# undef memcmp -# undef realloc -#endif -%} - -%{ -#include "input/input.h" -%} -%% -dummy:; -%% -#include "input/input.h" -_ATEOF - - - -$at_traceoff -echo "headers.at:76: bison --defines=input/input.h --output=y.tab.c input/input.y" -echo headers.at:76 >$at_check_line_file -( $at_traceon; bison --defines=input/input.h --output=y.tab.c input/input.y ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "headers.at:76: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - -# CPP should be happy with it. -$at_traceoff -echo "headers.at:76: \$CC -E -I. y.tab.c" -echo headers.at:76 >$at_check_line_file -( $at_traceon; $CC -E -I. y.tab.c ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -echo stdout:; cat $at_stdout -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "headers.at:76: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - - $at_traceoff - $at_times_p && times >$at_times_file - ) 5>&1 2>&1 | eval $at_tee_pipe - at_status=`cat $at_status_file` - ;; - - 37 ) # 37. headers.at:77: Invalid CPP guards: 9foo - at_setup_line='headers.at:77' - at_desc='Invalid CPP guards: 9foo' - $at_quiet $ECHO_N " 37: Invalid CPP guards: 9foo $ECHO_C" - at_xfail=no - ( - echo "37. headers.at:77: testing ..." - $at_traceon - - -# Possibly create inner directories. -dirname=`(dirname 9foo) 2>/dev/null || -$as_expr X9foo : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X9foo : 'X\(//\)[^/]' \| \ - X9foo : 'X\(//\)$' \| \ - X9foo : 'X\(/\)' \| \ - . : '\(.\)' 2>/dev/null || -echo X9foo | - sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } - /^X\(\/\/\)[^/].*/{ s//\1/; q; } - /^X\(\/\/\)$/{ s//\1/; q; } - /^X\(\/\).*/{ s//\1/; q; } - s/.*/./; q'` -{ if $as_mkdir_p; then - mkdir -p $dirname - else - as_dir=$dirname - as_dirs= - while test ! -d "$as_dir"; do - as_dirs="$as_dir $as_dirs" - as_dir=`(dirname "$as_dir") 2>/dev/null || -$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$as_dir" : 'X\(//\)[^/]' \| \ - X"$as_dir" : 'X\(//\)$' \| \ - X"$as_dir" : 'X\(/\)' \| \ - . : '\(.\)' 2>/dev/null || -echo X"$as_dir" | - sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } - /^X\(\/\/\)[^/].*/{ s//\1/; q; } - /^X\(\/\/\)$/{ s//\1/; q; } - /^X\(\/\).*/{ s//\1/; q; } - s/.*/./; q'` - done - test ! -n "$as_dirs" || mkdir $as_dirs - fi || { { echo "$as_me:$LINENO: error: cannot create directory $dirname" >&5 -echo "$as_me: error: cannot create directory $dirname" >&2;} - { (exit 1); exit 1; }; }; } - - -cat >9foo.y <<'_ATEOF' -%{ -#if HAVE_CONFIG_H -# include - /* We don't need perfect functions for these tests. */ -# undef malloc -# undef memcmp -# undef realloc -#endif -%} - -%{ -#include "9foo.h" -%} -%% -dummy:; -%% -#include "9foo.h" -_ATEOF - - - -$at_traceoff -echo "headers.at:77: bison --defines=9foo.h --output=y.tab.c 9foo.y" -echo headers.at:77 >$at_check_line_file -( $at_traceon; bison --defines=9foo.h --output=y.tab.c 9foo.y ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "headers.at:77: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - -# CPP should be happy with it. -$at_traceoff -echo "headers.at:77: \$CC -E -I. y.tab.c" -echo headers.at:77 >$at_check_line_file -( $at_traceon; $CC -E -I. y.tab.c ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -echo stdout:; cat $at_stdout -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "headers.at:77: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - - $at_traceoff - $at_times_p && times >$at_times_file - ) 5>&1 2>&1 | eval $at_tee_pipe - at_status=`cat $at_status_file` - ;; - - 38 ) # 38. headers.at:86: export YYLTYPE - at_setup_line='headers.at:86' - at_desc='export YYLTYPE' - $at_quiet $ECHO_N " 38: export YYLTYPE $ECHO_C" - at_xfail=no - ( - echo "38. headers.at:86: testing ..." - $at_traceon - - -cat >input.y <<'_ATEOF' -%{ -#if HAVE_CONFIG_H -# include - /* We don't need perfect functions for these tests. */ -# undef malloc -# undef memcmp -# undef realloc -#endif -%} - -%locations - -%name-prefix="my_" -%{ -#include -#include - -static int -my_lex (void) -{ - return EOF; -} - -static void -my_error (const char *msg) -{ - fprintf (stderr, "%s\n", msg); -} - -%} -%% -exp:; -_ATEOF - - - -$at_traceoff -echo "headers.at:113: bison --defines -o input.c input.y" -echo headers.at:113 >$at_check_line_file -( $at_traceon; bison --defines -o input.c input.y ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "headers.at:113: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - -# YYLTYPE should be defined, and MY_LLOC declared. -cat >caller.c <<'_ATEOF' -#include "input.h" -YYLTYPE *my_llocp = &my_lloc; - -int my_parse (void); - -int -main (void) -{ - return my_parse (); -} -_ATEOF - - -# Link and execute, just to make sure everything is fine (and in -# particular, that MY_LLOC is indeed defined somewhere). -$at_traceoff -echo "headers.at:131: \$CC \$CFLAGS \$CPPFLAGS -c caller.c -o caller.o" -echo headers.at:131 >$at_check_line_file -( $at_traceon; $CC $CFLAGS $CPPFLAGS -c caller.c -o caller.o ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo stderr:; cat $at_stderr -echo stdout:; cat $at_stdout -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "headers.at:131: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - -$at_traceoff -echo "headers.at:132: \$CC \$CFLAGS \$CPPFLAGS -c input.c -o input.o" -echo headers.at:132 >$at_check_line_file -( $at_traceon; $CC $CFLAGS $CPPFLAGS -c input.c -o input.o ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo stderr:; cat $at_stderr -echo stdout:; cat $at_stdout -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "headers.at:132: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - -$at_traceoff -echo "headers.at:133: \$CC \$CFLAGS \$CPPFLAGS \$LDFLAGS caller.o input.o \$LIBS -o caller" -echo headers.at:133 >$at_check_line_file -( $at_traceon; $CC $CFLAGS $CPPFLAGS $LDFLAGS caller.o input.o $LIBS -o caller ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo stderr:; cat $at_stderr -echo stdout:; cat $at_stdout -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "headers.at:133: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - -$at_traceoff -echo "headers.at:134: \$PREPARSER ./caller" -echo headers.at:134 >$at_check_line_file -( $at_traceon; $PREPARSER ./caller ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "headers.at:134: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - - $at_traceoff - $at_times_p && times >$at_times_file - ) 5>&1 2>&1 | eval $at_tee_pipe - at_status=`cat $at_status_file` - ;; - - - banner-7 ) # Banner 7. actions.at:19 - cat <<\_ATEOF - -User Actions. - -_ATEOF - ;; - - 39 ) # 39. actions.at:25: Mid-rule actions - at_setup_line='actions.at:25' - at_desc='Mid-rule actions' - $at_quiet $ECHO_N " 39: Mid-rule actions $ECHO_C" - at_xfail=no - ( - echo "39. actions.at:25: testing ..." - $at_traceon - - -# Bison once forgot the mid-rule actions. It was because the action -# was attached to the host rule (the one with the mid-rule action), -# instead of being attached to the empty rule dedicated to this -# action. - -cat >input.y <<'_ATEOF' -%{ -#if HAVE_CONFIG_H -# include - /* We don't need perfect functions for these tests. */ -# undef malloc -# undef memcmp -# undef realloc -#endif -%} - -%{ -# include -# include - static void yyerror (const char *msg); - static int yylex (void); -# define YYDEBUG 1 -# define YYERROR_VERBOSE 1 -%} -%% -exp: { putchar ('0'); } - '1' { putchar ('1'); } - '2' { putchar ('2'); } - '3' { putchar ('3'); } - '4' { putchar ('4'); } - '5' { putchar ('5'); } - '6' { putchar ('6'); } - '7' { putchar ('7'); } - '8' { putchar ('8'); } - '9' { putchar ('9'); } - { putchar ('\n'); } - ; -%% -static int -yylex (void) -{ - static const char *input = "123456789"; - return *input++; -} - -static void -yyerror (const char *msg) -{ - fprintf (stderr, "%s\n", msg); -} - -int -main (void) -{ - return yyparse (); -} -_ATEOF - - - -$at_traceoff -echo "actions.at:75: bison -d -v -o input.c input.y" -echo actions.at:75 >$at_check_line_file -( $at_traceon; bison -d -v -o input.c input.y ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "actions.at:75: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - -$at_traceoff -echo "actions.at:76: \$CC \$CFLAGS \$CPPFLAGS \$LDFLAGS input.c \$LIBS -o input" -echo actions.at:76 >$at_check_line_file -( $at_traceon; $CC $CFLAGS $CPPFLAGS $LDFLAGS input.c $LIBS -o input ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo stderr:; cat $at_stderr -echo stdout:; cat $at_stdout -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "actions.at:76: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - -$at_traceoff -echo "actions.at:79: \$PREPARSER ./input" -echo actions.at:79 >$at_check_line_file -( $at_traceon; $PREPARSER ./input ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -echo >>$at_stdout; echo "0123456789 -" | $at_diff - $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "actions.at:79: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - - $at_traceoff - $at_times_p && times >$at_times_file - ) 5>&1 2>&1 | eval $at_tee_pipe - at_status=`cat $at_status_file` - ;; - - 40 ) # 40. actions.at:89: Actions after errors - at_setup_line='actions.at:89' - at_desc='Actions after errors' - $at_quiet $ECHO_N " 40: Actions after errors $ECHO_C" - at_xfail=no - ( - echo "40. actions.at:89: testing ..." - $at_traceon - - - - -cat >input.y <<'_ATEOF' -%{ -#if HAVE_CONFIG_H -# include - /* We don't need perfect functions for these tests. */ -# undef malloc -# undef memcmp -# undef realloc -#endif -%} - -%{ -#include -#include - -static int yylex (void); -static void yyerror (char const *); - -#define YYDEBUG 1 -%} -%union { int ival; } -%type 'x' ';' thing line input - -%% -input: - /* Nothing. */ - { - $$ = 0; - printf ("input (%d): /* Nothing */\n", $$); - } -| line input /* Right recursive to load the stack so that popping at - EOF can be exercised. */ - { - $$ = 2; - printf ("input (%d): line (%d) input (%d)\n", $$, $1, $2); - } -; - -line: - thing thing thing ';' - { - $$ = $1; - printf ("line (%d): thing (%d) thing (%d) thing (%d) ';' (%d)\n", - $$, $1, $2, $3, $4); - } -| thing thing ';' - { - $$ = $1; - printf ("line (%d): thing (%d) thing (%d) ';' (%d)\n", $$, $1, $2, $3); - } -| thing ';' - { - $$ = $1; - printf ("line (%d): thing (%d) ';' (%d)\n", $$, $1, $2); - } -| error ';' - { - $$ = -1; - printf ("line (%d): error ';' (%d)\n", $$, $2); - } -; - -thing: - 'x' - { - $$ = $1; - printf ("thing (%d): 'x' (%d)\n", $$, $1); - } -; -%% -static size_t counter; - -static int -yylex (void) -{ - static char const input[] = - { - /* Exercise the discarding of stack top and input until `error' - can be reduced. */ - 'x', 'x', 'x', 'x', 'x', 'x', ';', - - /* Load the stack and provoke an error that cannot be caught by - the grammar, to check that the stack is cleared. */ - 'x', 'x', ';', - 'x', ';', - 'y' - }; - - if (counter < sizeof input) - { - yylval.ival = counter; - printf ("sending: '%c' (%d)\n", input[counter], yylval.ival); - return input[counter++]; - } - else - { - printf ("sending: EOF\n"); - return EOF; - } -} - -static void -yyerror (char const *msg) -{ - printf ("%lu: %s\n", (unsigned long int) counter, msg); -} - -int -main (void) -{ - yydebug = !!getenv ("YYDEBUG"); - return yyparse (); -} -_ATEOF - - - -$at_traceoff -echo "actions.at:198: bison -o input.c input.y" -echo actions.at:198 >$at_check_line_file -( $at_traceon; bison -o input.c input.y ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "actions.at:198: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - -$at_traceoff -echo "actions.at:199: \$CC \$CFLAGS \$CPPFLAGS \$LDFLAGS input.c \$LIBS -o input" -echo actions.at:199 >$at_check_line_file -( $at_traceon; $CC $CFLAGS $CPPFLAGS $LDFLAGS input.c $LIBS -o input ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo stderr:; cat $at_stderr -echo stdout:; cat $at_stdout -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "actions.at:199: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - -$at_traceoff -echo "actions.at:226: \$PREPARSER ./input" -echo actions.at:226 >$at_check_line_file -( $at_traceon; $PREPARSER ./input ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -echo >>$at_stdout; echo "sending: 'x' (0) -thing (0): 'x' (0) -sending: 'x' (1) -thing (1): 'x' (1) -sending: 'x' (2) -thing (2): 'x' (2) -sending: 'x' (3) -4: syntax error -sending: 'x' (4) -sending: 'x' (5) -sending: ';' (6) -line (-1): error ';' (6) -sending: 'x' (7) -thing (7): 'x' (7) -sending: 'x' (8) -thing (8): 'x' (8) -sending: ';' (9) -line (7): thing (7) thing (8) ';' (9) -sending: 'x' (10) -thing (10): 'x' (10) -sending: ';' (11) -line (10): thing (10) ';' (11) -sending: 'y' (12) -13: syntax error -sending: EOF -" | $at_diff - $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 1) ;; - *) echo "actions.at:226: exit code was $at_status, expected 1" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - - $at_traceoff - $at_times_p && times >$at_times_file - ) 5>&1 2>&1 | eval $at_tee_pipe - at_status=`cat $at_status_file` - ;; - - 41 ) # 41. actions.at:236: Exotic Dollars - at_setup_line='actions.at:236' - at_desc='Exotic Dollars' - $at_quiet $ECHO_N " 41: Exotic Dollars $ECHO_C" - at_xfail=no - ( - echo "41. actions.at:236: testing ..." - $at_traceon - - -cat >input.y <<'_ATEOF' -%{ -#if HAVE_CONFIG_H -# include - /* We don't need perfect functions for these tests. */ -# undef malloc -# undef memcmp -# undef realloc -#endif -%} - -%{ -# include -# include - static void yyerror (const char *msg); - static int yylex (void); -# define YYDEBUG 1 -# define YYERROR_VERBOSE 1 -%} - -%union -{ - int val; -}; - -%type a_1 a_2 a_5 - sum_of_the_five_previous_values - -%% -exp: a_1 a_2 { $$ = 3; } { $$ = $3 + 1; } a_5 - sum_of_the_five_previous_values - { - printf ("%d\n", $6); - } -; -a_1: { $$ = 1; }; -a_2: { $$ = 2; }; -a_5: { $$ = 5; }; - -sum_of_the_five_previous_values: - { - $$ = $0 + $-1 + $-2 + $-3 + $-4; - } -; - -%% -static int -yylex (void) -{ - return EOF; -} - -static void -yyerror (const char *msg) -{ - fprintf (stderr, "%s\n", msg); -} - -int -main (void) -{ - return yyparse (); -} -_ATEOF - - - -$at_traceoff -echo "actions.at:293: bison -d -v -o input.c input.y" -echo actions.at:293 >$at_check_line_file -( $at_traceon; bison -d -v -o input.c input.y ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "actions.at:293: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - -$at_traceoff -echo "actions.at:294: \$CC \$CFLAGS \$CPPFLAGS \$LDFLAGS input.c \$LIBS -o input" -echo actions.at:294 >$at_check_line_file -( $at_traceon; $CC $CFLAGS $CPPFLAGS $LDFLAGS input.c $LIBS -o input ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo stderr:; cat $at_stderr -echo stdout:; cat $at_stdout -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "actions.at:294: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - -$at_traceoff -echo "actions.at:297: \$PREPARSER ./input" -echo actions.at:297 >$at_check_line_file -( $at_traceon; $PREPARSER ./input ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -echo >>$at_stdout; echo "15 -" | $at_diff - $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "actions.at:297: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - - $at_traceoff - $at_times_p && times >$at_times_file - ) 5>&1 2>&1 | eval $at_tee_pipe - at_status=`cat $at_status_file` - ;; - - 42 ) # 42. actions.at:556: Printers and Destructors: - at_setup_line='actions.at:556' - at_desc='Printers and Destructors: ' - $at_quiet $ECHO_N " 42: Printers and Destructors: $ECHO_C" - at_xfail=no - ( - echo "42. actions.at:556: testing ..." - $at_traceon - - -# Make sure complex $n work. - - - -# Using yacc.c? - - - - - - - -# yyerror receives the location if %location & %pure & (%glr or %parse-param). - -# yyerror always sees the locations (when activated), except if -# yacc & pure & !param. - - -# The interface is pure: either because %pure-parser, or because we -# are using the C++ parsers. - - - - - - - - - - - -cat >input.y <<'_ATEOF' -%{ -#if HAVE_CONFIG_H -# include - /* We don't need perfect functions for these tests. */ -# undef malloc -# undef memcmp -# undef realloc -#endif -%} - - -%{ -#include -#include -#define RANGE(Location) (Location).first_line, (Location).last_line -%} -%error-verbose -%debug -%verbose -%locations -%union -{ - int ival; -} - -%{ - -static int yylex (void); -static void yyerror (const char *msg); -%} - -%type 'x' ';' thing line input - -%printer { fprintf (yyoutput, "%d@%d-%d", $$, RANGE (@$)); } - input line thing 'x' - -%destructor - { printf ("Freeing nterm input (%d@%d-%d)\n", $$, RANGE (@$)); } - input - -%destructor - { printf ("Freeing nterm line (%d@%d-%d)\n", $$, RANGE (@$)); } - line - -%destructor - { printf ("Freeing nterm thing (%d@%d-%d)\n", $$, RANGE (@$)); } - thing - -%destructor - { printf ("Freeing token 'x' (%d@%d-%d)\n", $$, RANGE (@$)); } - 'x' - -%% -input: - /* Nothing. */ - { - $$ = 0; - printf ("input (%d@%d-%d): /* Nothing */\n", $$, RANGE (@$)); - } -| line input /* Right recursive to load the stack so that popping at - EOF can be exercised. */ - { - $$ = 2; - printf ("input (%d@%d-%d): line (%d@%d-%d) input (%d@%d-%d)\n", - $$, RANGE (@$), $1, RANGE (@1), $2, RANGE (@2)); - } -; - -line: - thing thing thing ';' - { - $$ = $1; - printf ("line (%d@%d-%d): thing (%d@%d-%d) thing (%d@%d-%d) thing (%d@%d-%d) ';' (%d@%d-%d)\n", - $$, RANGE (@$), $1, RANGE (@1), $2, RANGE (@2), - $3, RANGE (@3), $4, RANGE (@4)); - } -| thing thing ';' - { - $$ = $1; - printf ("line (%d@%d-%d): thing (%d@%d-%d) thing (%d@%d-%d) ';' (%d@%d-%d)\n", - $$, RANGE (@$), $1, RANGE (@1), $2, RANGE (@2), $3, RANGE (@3)); - } -| thing ';' - { - $$ = $1; - printf ("line (%d@%d-%d): thing (%d@%d-%d) ';' (%d@%d-%d)\n", - $$, RANGE (@$), $1, RANGE (@1), $2, RANGE (@2)); - } -| error ';' - { - $$ = -1; - printf ("line (%d@%d-%d): error (@%d-%d) ';' (%d@%d-%d)\n", - $$, RANGE (@$), RANGE (@1), $2, RANGE (@2)); - } -; - -thing: - 'x' - { - $$ = $1; - printf ("thing (%d@%d-%d): 'x' (%d@%d-%d)\n", - $$, RANGE (@$), $1, RANGE (@1)); - } -; -%% -static int -yylex (void) -{ - static const unsigned int input[] = - { - /* Exercise the discarding of stack top and input until `error' - can be reduced. */ - 'x', 'x', 'x', 'x', 'x', 'x', ';', - - /* Load the stack and provoke an error that cannot be caught by - the grammar, to check that the stack is cleared. */ - 'x', 'x', ';', - 'x', ';', - 'y' - }; - static unsigned int counter = 0; - - if (counter < (sizeof(input) / sizeof (input[0]))) - { - yylval.ival = counter; - /* As in BASIC, line numbers go from 10 to 10. */ - yylloc.first_line = yylloc.first_column = 10 * counter; - yylloc.last_line = yylloc.last_column = yylloc.first_line + 9; - printf ("sending: '%c' (%d@%d-%d)\n", - input[counter], yylval.ival, RANGE (yylloc)); - return (int) input[counter++]; - - } - else - { - printf ("sending: EOF\n"); - return EOF; - } -} - -static void -yyerror (const char *msg) -{ - printf ("%d-%d: %s\n", RANGE (yylloc), msg); -} - -int -main (void) -{ - yydebug = !!getenv ("YYDEBUG"); - if (yyparse ()) - { - printf ("Parsing FAILED.\n"); - exit (1); - } - printf ("Successful parse.\n"); - return 0; -} -_ATEOF - - - -$at_traceoff -echo "actions.at:556: bison -o input.c input.y" -echo actions.at:556 >$at_check_line_file -( $at_traceon; bison -o input.c input.y ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "actions.at:556: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - -$at_traceoff -echo "actions.at:556: \$CC \$CFLAGS \$CPPFLAGS \$LDFLAGS input.c \$LIBS -o input" -echo actions.at:556 >$at_check_line_file -( $at_traceon; $CC $CFLAGS $CPPFLAGS $LDFLAGS input.c $LIBS -o input ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo stderr:; cat $at_stderr -echo stdout:; cat $at_stdout -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "actions.at:556: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - -$at_traceoff -echo "actions.at:556: \$PREPARSER ./input" -echo actions.at:556 >$at_check_line_file -( $at_traceon; $PREPARSER ./input ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -echo >>$at_stdout; echo "sending: 'x' (0@0-9) -thing (0@0-9): 'x' (0@0-9) -sending: 'x' (1@10-19) -thing (1@10-19): 'x' (1@10-19) -sending: 'x' (2@20-29) -thing (2@20-29): 'x' (2@20-29) -sending: 'x' (3@30-39) -30-39: syntax error, unexpected 'x', expecting ';' -Freeing nterm thing (2@20-29) -Freeing nterm thing (1@10-19) -Freeing nterm thing (0@0-9) -Freeing token 'x' (3@30-39) -sending: 'x' (4@40-49) -Freeing token 'x' (4@40-49) -sending: 'x' (5@50-59) -Freeing token 'x' (5@50-59) -sending: ';' (6@60-69) -line (-1@0-69): error (@0-59) ';' (6@60-69) -sending: 'x' (7@70-79) -thing (7@70-79): 'x' (7@70-79) -sending: 'x' (8@80-89) -thing (8@80-89): 'x' (8@80-89) -sending: ';' (9@90-99) -line (7@70-99): thing (7@70-79) thing (8@80-89) ';' (9@90-99) -sending: 'x' (10@100-109) -thing (10@100-109): 'x' (10@100-109) -sending: ';' (11@110-119) -line (10@100-119): thing (10@100-109) ';' (11@110-119) -sending: 'y' (12@120-129) -120-129: syntax error, unexpected \$undefined, expecting \$end or 'x' -sending: EOF -Freeing nterm line (10@100-119) -Freeing nterm line (7@70-99) -Freeing nterm line (-1@0-69) -Parsing FAILED. -" | $at_diff - $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 1) ;; - *) echo "actions.at:556: exit code was $at_status, expected 1" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - - $at_traceoff - $at_times_p && times >$at_times_file - ) 5>&1 2>&1 | eval $at_tee_pipe - at_status=`cat $at_status_file` - ;; - - 43 ) # 43. actions.at:557: Printers and Destructors: %locations %defines %skeleton "lalr1.cc" - at_setup_line='actions.at:557' - at_desc='Printers and Destructors: %locations %defines %skeleton "lalr1.cc"' - $at_quiet $ECHO_N " 43: Printers and Destructors: %locations %defines %skeleton "lalr1.cc"$ECHO_C" - at_xfail=no - ( - echo "43. actions.at:557: testing ..." - $at_traceon - - -# Make sure complex $n work. - - - -# Using yacc.c? - - - - - - - -# yyerror receives the location if %location & %pure & (%glr or %parse-param). - -# yyerror always sees the locations (when activated), except if -# yacc & pure & !param. - - -# The interface is pure: either because %pure-parser, or because we -# are using the C++ parsers. - - - - - - - - - - - -cat >input.y <<'_ATEOF' -%{ -#if HAVE_CONFIG_H -# include - /* We don't need perfect functions for these tests. */ -# undef malloc -# undef memcmp -# undef realloc -#endif -%} - -%locations %defines %skeleton "lalr1.cc" -%{ -#include -#include -#define RANGE(Location) (Location).begin.line, (Location).end.line -%} -%error-verbose -%debug -%verbose -%locations -%union -{ - int ival; -} - -%{ -typedef yy::Location YYLTYPE; -static int yylex (YYSTYPE *yylval, YYLTYPE *yylloc); - -%} - -%type 'x' ';' thing line input - -%printer { fprintf (yyoutput, "%d@%d-%d", $$, RANGE (@$)); } - input line thing 'x' - -%destructor - { printf ("Freeing nterm input (%d@%d-%d)\n", $$, RANGE (@$)); } - input - -%destructor - { printf ("Freeing nterm line (%d@%d-%d)\n", $$, RANGE (@$)); } - line - -%destructor - { printf ("Freeing nterm thing (%d@%d-%d)\n", $$, RANGE (@$)); } - thing - -%destructor - { printf ("Freeing token 'x' (%d@%d-%d)\n", $$, RANGE (@$)); } - 'x' - -%% -input: - /* Nothing. */ - { - $$ = 0; - printf ("input (%d@%d-%d): /* Nothing */\n", $$, RANGE (@$)); - } -| line input /* Right recursive to load the stack so that popping at - EOF can be exercised. */ - { - $$ = 2; - printf ("input (%d@%d-%d): line (%d@%d-%d) input (%d@%d-%d)\n", - $$, RANGE (@$), $1, RANGE (@1), $2, RANGE (@2)); - } -; - -line: - thing thing thing ';' - { - $$ = $1; - printf ("line (%d@%d-%d): thing (%d@%d-%d) thing (%d@%d-%d) thing (%d@%d-%d) ';' (%d@%d-%d)\n", - $$, RANGE (@$), $1, RANGE (@1), $2, RANGE (@2), - $3, RANGE (@3), $4, RANGE (@4)); - } -| thing thing ';' - { - $$ = $1; - printf ("line (%d@%d-%d): thing (%d@%d-%d) thing (%d@%d-%d) ';' (%d@%d-%d)\n", - $$, RANGE (@$), $1, RANGE (@1), $2, RANGE (@2), $3, RANGE (@3)); - } -| thing ';' - { - $$ = $1; - printf ("line (%d@%d-%d): thing (%d@%d-%d) ';' (%d@%d-%d)\n", - $$, RANGE (@$), $1, RANGE (@1), $2, RANGE (@2)); - } -| error ';' - { - $$ = -1; - printf ("line (%d@%d-%d): error (@%d-%d) ';' (%d@%d-%d)\n", - $$, RANGE (@$), RANGE (@1), $2, RANGE (@2)); - } -; - -thing: - 'x' - { - $$ = $1; - printf ("thing (%d@%d-%d): 'x' (%d@%d-%d)\n", - $$, RANGE (@$), $1, RANGE (@1)); - } -; -%% -static int -yylex (YYSTYPE *yylval, YYLTYPE *yylloc) -{ - static const unsigned int input[] = - { - /* Exercise the discarding of stack top and input until `error' - can be reduced. */ - 'x', 'x', 'x', 'x', 'x', 'x', ';', - - /* Load the stack and provoke an error that cannot be caught by - the grammar, to check that the stack is cleared. */ - 'x', 'x', ';', - 'x', ';', - 'y' - }; - static unsigned int counter = 0; - - if (counter < (sizeof(input) / sizeof (input[0]))) - { - yylval->ival = counter; - /* As in BASIC, line numbers go from 10 to 10. */ - yylloc->begin.line = yylloc->begin.column = 10 * counter; - yylloc->end.line = yylloc->end.column = yylloc->begin.line + 9; - printf ("sending: '%c' (%d@%d-%d)\n", - input[counter], yylval->ival, RANGE (*yylloc)); - return (int) input[counter++]; - - } - else - { - printf ("sending: EOF\n"); - return EOF; - } -} - -/* Currently, print_ is required in C++. */ -void -yy::Parser::print_ () -{ - std::cerr << location; -} - -/* A C++ error reporting function. */ -void -yy::Parser::error_ () -{ - printf ("%d-%d: %s\n", RANGE (location), message.c_str()); -} - -static bool yydebug; -int -yyparse () -{ - yy::Parser parser (yydebug, yy::Location::Location ()); - return parser.parse (); -} - - -int -main (void) -{ - yydebug = !!getenv ("YYDEBUG"); - if (yyparse ()) - { - printf ("Parsing FAILED.\n"); - exit (1); - } - printf ("Successful parse.\n"); - return 0; -} -_ATEOF - - - -$at_traceoff -echo "actions.at:557: bison -o input.c input.y" -echo actions.at:557 >$at_check_line_file -( $at_traceon; bison -o input.c input.y ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "actions.at:557: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - -$at_traceoff -echo "actions.at:557: \$CXX --version || exit 77" -echo actions.at:557 >$at_check_line_file -( $at_traceon; $CXX --version || exit 77 ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo stderr:; cat $at_stderr -echo stdout:; cat $at_stdout -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "actions.at:557: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - -$at_traceoff -echo "actions.at:557: \$CXX \$CXXFLAGS \$CPPFLAGS input.c -o input" -echo actions.at:557 >$at_check_line_file -( $at_traceon; $CXX $CXXFLAGS $CPPFLAGS input.c -o input ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo stderr:; cat $at_stderr -echo stdout:; cat $at_stdout -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "actions.at:557: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - -$at_traceoff -echo "actions.at:557: \$PREPARSER ./input" -echo actions.at:557 >$at_check_line_file -( $at_traceon; $PREPARSER ./input ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -echo >>$at_stdout; echo "sending: 'x' (0@0-9) -thing (0@0-9): 'x' (0@0-9) -sending: 'x' (1@10-19) -thing (1@10-19): 'x' (1@10-19) -sending: 'x' (2@20-29) -thing (2@20-29): 'x' (2@20-29) -sending: 'x' (3@30-39) -30-39: syntax error, unexpected 'x', expecting ';' -Freeing nterm thing (2@20-29) -Freeing nterm thing (1@10-19) -Freeing nterm thing (0@0-9) -Freeing token 'x' (3@30-39) -sending: 'x' (4@40-49) -Freeing token 'x' (4@40-49) -sending: 'x' (5@50-59) -Freeing token 'x' (5@50-59) -sending: ';' (6@60-69) -line (-1@0-69): error (@0-59) ';' (6@60-69) -sending: 'x' (7@70-79) -thing (7@70-79): 'x' (7@70-79) -sending: 'x' (8@80-89) -thing (8@80-89): 'x' (8@80-89) -sending: ';' (9@90-99) -line (7@70-99): thing (7@70-79) thing (8@80-89) ';' (9@90-99) -sending: 'x' (10@100-109) -thing (10@100-109): 'x' (10@100-109) -sending: ';' (11@110-119) -line (10@100-119): thing (10@100-109) ';' (11@110-119) -sending: 'y' (12@120-129) -120-129: syntax error, unexpected \$undefined, expecting \$end or 'x' -sending: EOF -Freeing nterm line (10@100-119) -Freeing nterm line (7@70-99) -Freeing nterm line (-1@0-69) -Parsing FAILED. -" | $at_diff - $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 1) ;; - *) echo "actions.at:557: exit code was $at_status, expected 1" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - - $at_traceoff - $at_times_p && times >$at_times_file - ) 5>&1 2>&1 | eval $at_tee_pipe - at_status=`cat $at_status_file` - ;; - - - banner-8 ) # Banner 8. conflicts.at:20 - cat <<\_ATEOF - -Conflicts. - -_ATEOF - ;; - - 44 ) # 44. conflicts.at:32: S/R in initial - at_setup_line='conflicts.at:32' - at_desc='S/R in initial' - $at_quiet $ECHO_N " 44: S/R in initial $ECHO_C" - at_xfail=no - ( - echo "44. conflicts.at:32: testing ..." - $at_traceon - - -cat >input.y <<'_ATEOF' -%expect 1 -%% -exp: e 'e'; -e: 'e' | /* Nothing. */; -_ATEOF - - -$at_traceoff -echo "conflicts.at:43: bison -o input.c input.y" -echo conflicts.at:43 >$at_check_line_file -( $at_traceon; bison -o input.c input.y ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo >>$at_stderr; echo "input.y:4.9: warning: rule never reduced because of conflicts: e: /* empty */ -" | $at_diff - $at_stderr || at_failed=: -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "conflicts.at:43: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - - $at_traceoff - $at_times_p && times >$at_times_file - ) 5>&1 2>&1 | eval $at_tee_pipe - at_status=`cat $at_status_file` - ;; - - 45 ) # 45. conflicts.at:52: %nonassoc and eof - at_setup_line='conflicts.at:52' - at_desc='%nonassoc and eof' - $at_quiet $ECHO_N " 45: %nonassoc and eof $ECHO_C" - at_xfail=no - ( - echo "45. conflicts.at:52: testing ..." - $at_traceon - - -cat >input.y <<'_ATEOF' -%{ -#if HAVE_CONFIG_H -# include - /* We don't need perfect functions for these tests. */ -# undef malloc -# undef memcmp -# undef realloc -#endif -%} - - -%{ -#include -#include - -#define YYERROR_VERBOSE 1 -static void -yyerror (const char *msg) -{ - fprintf (stderr, "%s\n", msg); - exit (1); -} - -/* The current argument. */ -static const char *input = NULL; - -static int -yylex (void) -{ - /* No token stands for end of file. */ - if (input && *input) - return *input++; - else - return 0; -} - -%} - -%nonassoc '<' '>' - -%% -expr: expr '<' expr - | expr '>' expr - | '0' - ; -%% -int -main (int argc, const char *argv[]) -{ - if (argc > 1) - input = argv[1]; - return yyparse (); -} -_ATEOF - - - -# Specify the output files to avoid problems on different file systems. -$at_traceoff -echo "conflicts.at:101: bison -o input.c input.y" -echo conflicts.at:101 >$at_check_line_file -( $at_traceon; bison -o input.c input.y ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "conflicts.at:101: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - -$at_traceoff -echo "conflicts.at:102: \$CC \$CFLAGS \$CPPFLAGS \$LDFLAGS input.c \$LIBS -o input" -echo conflicts.at:102 >$at_check_line_file -( $at_traceon; $CC $CFLAGS $CPPFLAGS $LDFLAGS input.c $LIBS -o input ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo stderr:; cat $at_stderr -echo stdout:; cat $at_stdout -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "conflicts.at:102: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - -$at_traceoff -echo "conflicts.at:104: \$PREPARSER ./input '0<0'" -echo conflicts.at:104 >$at_check_line_file -( $at_traceon; $PREPARSER ./input '0<0' ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "conflicts.at:104: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - -# FIXME: This is an actual bug, but a new one, in the sense that -# no one has ever spotted it! The messages are *wrong*: there should -# be nothing there, it should be expected eof. -$at_traceoff -echo "conflicts.at:110: \$PREPARSER ./input '0<0<0'" -echo conflicts.at:110 >$at_check_line_file -( $at_traceon; $PREPARSER ./input '0<0<0' ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo >>$at_stderr; echo "syntax error, unexpected '<', expecting '<' or '>' -" | $at_diff - $at_stderr || at_failed=: -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 1) ;; - *) echo "conflicts.at:110: exit code was $at_status, expected 1" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - -$at_traceoff -echo "conflicts.at:112: \$PREPARSER ./input '0>0'" -echo conflicts.at:112 >$at_check_line_file -( $at_traceon; $PREPARSER ./input '0>0' ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "conflicts.at:112: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - -$at_traceoff -echo "conflicts.at:115: \$PREPARSER ./input '0>0>0'" -echo conflicts.at:115 >$at_check_line_file -( $at_traceon; $PREPARSER ./input '0>0>0' ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo >>$at_stderr; echo "syntax error, unexpected '>', expecting '<' or '>' -" | $at_diff - $at_stderr || at_failed=: -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 1) ;; - *) echo "conflicts.at:115: exit code was $at_status, expected 1" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - -$at_traceoff -echo "conflicts.at:119: \$PREPARSER ./input '0<0>0'" -echo conflicts.at:119 >$at_check_line_file -( $at_traceon; $PREPARSER ./input '0<0>0' ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo >>$at_stderr; echo "syntax error, unexpected '>', expecting '<' or '>' -" | $at_diff - $at_stderr || at_failed=: -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 1) ;; - *) echo "conflicts.at:119: exit code was $at_status, expected 1" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - - $at_traceoff - $at_times_p && times >$at_times_file - ) 5>&1 2>&1 | eval $at_tee_pipe - at_status=`cat $at_status_file` - ;; - - 46 ) # 46. conflicts.at:129: Unresolved SR Conflicts - at_setup_line='conflicts.at:129' - at_desc='Unresolved SR Conflicts' - $at_quiet $ECHO_N " 46: Unresolved SR Conflicts $ECHO_C" - at_xfail=no - ( - echo "46. conflicts.at:129: testing ..." - $at_traceon - - - - -cat >input.y <<'_ATEOF' -%token NUM OP -%% -exp: exp OP exp | NUM; -_ATEOF - - -$at_traceoff -echo "conflicts.at:141: bison -o input.c --report=all input.y" -echo conflicts.at:141 >$at_check_line_file -( $at_traceon; bison -o input.c --report=all input.y ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo >>$at_stderr; echo "input.y: conflicts: 1 shift/reduce -" | $at_diff - $at_stderr || at_failed=: -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "conflicts.at:141: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - -# Check the contents of the report. -$at_traceoff -echo "conflicts.at:226: cat input.output" -echo conflicts.at:226 >$at_check_line_file -( $at_traceon; cat input.output ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -echo >>$at_stdout; echo "State 5 conflicts: 1 shift/reduce - - -Grammar - - 0 \$accept: exp \$end - - 1 exp: exp OP exp - 2 | NUM - - -Terminals, with rules where they appear - -\$end (0) 0 -error (256) -NUM (258) 2 -OP (259) 1 - - -Nonterminals, with rules where they appear - -\$accept (5) - on left: 0 -exp (6) - on left: 1 2, on right: 0 1 - - -state 0 - - 0 \$accept: . exp \$end - 1 exp: . exp OP exp - 2 | . NUM - - NUM shift, and go to state 1 - - exp go to state 2 - - -state 1 - - 2 exp: NUM . - - \$default reduce using rule 2 (exp) - - -state 2 - - 0 \$accept: exp . \$end - 1 exp: exp . OP exp - - \$end shift, and go to state 3 - OP shift, and go to state 4 - - -state 3 - - 0 \$accept: exp \$end . - - \$default accept - - -state 4 - - 1 exp: . exp OP exp - 1 | exp OP . exp - 2 | . NUM - - NUM shift, and go to state 1 - - exp go to state 5 - - -state 5 - - 1 exp: exp . OP exp [\$end, OP] - 1 | exp OP exp . [\$end, OP] - - OP shift, and go to state 4 - - OP [reduce using rule 1 (exp)] - \$default reduce using rule 1 (exp) -" | $at_diff - $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "conflicts.at:226: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - - $at_traceoff - $at_times_p && times >$at_times_file - ) 5>&1 2>&1 | eval $at_tee_pipe - at_status=`cat $at_status_file` - ;; - - 47 ) # 47. conflicts.at:236: Resolved SR Conflicts - at_setup_line='conflicts.at:236' - at_desc='Resolved SR Conflicts' - $at_quiet $ECHO_N " 47: Resolved SR Conflicts $ECHO_C" - at_xfail=no - ( - echo "47. conflicts.at:236: testing ..." - $at_traceon - - - - -cat >input.y <<'_ATEOF' -%token NUM OP -%left OP -%% -exp: exp OP exp | NUM; -_ATEOF - - -$at_traceoff -echo "conflicts.at:247: bison -o input.c --report=all input.y" -echo conflicts.at:247 >$at_check_line_file -( $at_traceon; bison -o input.c --report=all input.y ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "conflicts.at:247: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - -# Check the contents of the report. -$at_traceoff -echo "conflicts.at:328: cat input.output" -echo conflicts.at:328 >$at_check_line_file -( $at_traceon; cat input.output ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -echo >>$at_stdout; echo "Grammar - - 0 \$accept: exp \$end - - 1 exp: exp OP exp - 2 | NUM - - -Terminals, with rules where they appear - -\$end (0) 0 -error (256) -NUM (258) 2 -OP (259) 1 - - -Nonterminals, with rules where they appear - -\$accept (5) - on left: 0 -exp (6) - on left: 1 2, on right: 0 1 - - -state 0 - - 0 \$accept: . exp \$end - 1 exp: . exp OP exp - 2 | . NUM - - NUM shift, and go to state 1 - - exp go to state 2 - - -state 1 - - 2 exp: NUM . - - \$default reduce using rule 2 (exp) - - -state 2 - - 0 \$accept: exp . \$end - 1 exp: exp . OP exp - - \$end shift, and go to state 3 - OP shift, and go to state 4 - - -state 3 - - 0 \$accept: exp \$end . - - \$default accept - - -state 4 - - 1 exp: . exp OP exp - 1 | exp OP . exp - 2 | . NUM - - NUM shift, and go to state 1 - - exp go to state 5 - - -state 5 - - 1 exp: exp . OP exp [\$end, OP] - 1 | exp OP exp . [\$end, OP] - - \$default reduce using rule 1 (exp) - - Conflict between rule 1 and token OP resolved as reduce (%left OP). -" | $at_diff - $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "conflicts.at:328: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - - $at_traceoff - $at_times_p && times >$at_times_file - ) 5>&1 2>&1 | eval $at_tee_pipe - at_status=`cat $at_status_file` - ;; - - 48 ) # 48. conflicts.at:358: Defaulted Conflicted Reduction - at_setup_line='conflicts.at:358' - at_desc='Defaulted Conflicted Reduction' - $at_quiet $ECHO_N " 48: Defaulted Conflicted Reduction $ECHO_C" - at_xfail=no - ( - echo "48. conflicts.at:358: testing ..." - $at_traceon - - - -cat >input.y <<'_ATEOF' -%% -exp: num | id; -num: '0'; -id : '0'; -%% -_ATEOF - - -$at_traceoff -echo "conflicts.at:372: bison -o input.c --report=all input.y" -echo conflicts.at:372 >$at_check_line_file -( $at_traceon; bison -o input.c --report=all input.y ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo >>$at_stderr; echo "input.y: conflicts: 1 reduce/reduce -input.y:4.6-8: warning: rule never reduced because of conflicts: id: '0' -" | $at_diff - $at_stderr || at_failed=: -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "conflicts.at:372: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - -# Check the contents of the report. -$at_traceoff -echo "conflicts.at:466: cat input.output" -echo conflicts.at:466 >$at_check_line_file -( $at_traceon; cat input.output ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -echo >>$at_stdout; echo "Rules never reduced - - 4 id: '0' - - -State 1 conflicts: 1 reduce/reduce - - -Grammar - - 0 \$accept: exp \$end - - 1 exp: num - 2 | id - - 3 num: '0' - - 4 id: '0' - - -Terminals, with rules where they appear - -\$end (0) 0 -'0' (48) 3 4 -error (256) - - -Nonterminals, with rules where they appear - -\$accept (4) - on left: 0 -exp (5) - on left: 1 2, on right: 0 -num (6) - on left: 3, on right: 1 -id (7) - on left: 4, on right: 2 - - -state 0 - - 0 \$accept: . exp \$end - 1 exp: . num - 2 | . id - 3 num: . '0' - 4 id: . '0' - - '0' shift, and go to state 1 - - exp go to state 2 - num go to state 3 - id go to state 4 - - -state 1 - - 3 num: '0' . [\$end] - 4 id: '0' . [\$end] - - \$end reduce using rule 3 (num) - \$end [reduce using rule 4 (id)] - \$default reduce using rule 3 (num) - - -state 2 - - 0 \$accept: exp . \$end - - \$end shift, and go to state 5 - - -state 3 - - 1 exp: num . - - \$default reduce using rule 1 (exp) - - -state 4 - - 2 exp: id . - - \$default reduce using rule 2 (exp) - - -state 5 - - 0 \$accept: exp \$end . - - \$default accept -" | $at_diff - $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "conflicts.at:466: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - - $at_traceoff - $at_times_p && times >$at_times_file - ) 5>&1 2>&1 | eval $at_tee_pipe - at_status=`cat $at_status_file` - ;; - - 49 ) # 49. conflicts.at:477: %expect not enough - at_setup_line='conflicts.at:477' - at_desc='%expect not enough' - $at_quiet $ECHO_N " 49: %expect not enough $ECHO_C" - at_xfail=no - ( - echo "49. conflicts.at:477: testing ..." - $at_traceon - - -cat >input.y <<'_ATEOF' -%token NUM OP -%expect 0 -%% -exp: exp OP exp | NUM; -_ATEOF - - -$at_traceoff -echo "conflicts.at:489: bison -o input.c input.y" -echo conflicts.at:489 >$at_check_line_file -( $at_traceon; bison -o input.c input.y ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo >>$at_stderr; echo "input.y: conflicts: 1 shift/reduce -input.y: warning: expected 0 shift/reduce conflicts -" | $at_diff - $at_stderr || at_failed=: -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "conflicts.at:489: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - $at_traceoff - $at_times_p && times >$at_times_file - ) 5>&1 2>&1 | eval $at_tee_pipe - at_status=`cat $at_status_file` - ;; - - 50 ) # 50. conflicts.at:497: %expect right - at_setup_line='conflicts.at:497' - at_desc='%expect right' - $at_quiet $ECHO_N " 50: %expect right $ECHO_C" - at_xfail=no - ( - echo "50. conflicts.at:497: testing ..." - $at_traceon - - -cat >input.y <<'_ATEOF' -%token NUM OP -%expect 1 -%% -exp: exp OP exp | NUM; -_ATEOF - - -$at_traceoff -echo "conflicts.at:506: bison -o input.c input.y" -echo conflicts.at:506 >$at_check_line_file -( $at_traceon; bison -o input.c input.y ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "conflicts.at:506: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - $at_traceoff - $at_times_p && times >$at_times_file - ) 5>&1 2>&1 | eval $at_tee_pipe - at_status=`cat $at_status_file` - ;; - - 51 ) # 51. conflicts.at:514: %expect too much - at_setup_line='conflicts.at:514' - at_desc='%expect too much' - $at_quiet $ECHO_N " 51: %expect too much $ECHO_C" - at_xfail=no - ( - echo "51. conflicts.at:514: testing ..." - $at_traceon - - -cat >input.y <<'_ATEOF' -%token NUM OP -%expect 2 -%% -exp: exp OP exp | NUM; -_ATEOF - - -$at_traceoff -echo "conflicts.at:526: bison -o input.c input.y" -echo conflicts.at:526 >$at_check_line_file -( $at_traceon; bison -o input.c input.y ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo >>$at_stderr; echo "input.y: conflicts: 1 shift/reduce -input.y: warning: expected 2 shift/reduce conflicts -" | $at_diff - $at_stderr || at_failed=: -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "conflicts.at:526: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - $at_traceoff - $at_times_p && times >$at_times_file - ) 5>&1 2>&1 | eval $at_tee_pipe - at_status=`cat $at_status_file` - ;; - - 52 ) # 52. conflicts.at:534: %expect with reduce conflicts - at_setup_line='conflicts.at:534' - at_desc='%expect with reduce conflicts' - $at_quiet $ECHO_N " 52: %expect with reduce conflicts $ECHO_C" - at_xfail=no - ( - echo "52. conflicts.at:534: testing ..." - $at_traceon - - -cat >input.y <<'_ATEOF' -%expect 0 -%% -program: a 'a' | a a; -a: 'a'; -_ATEOF - - -$at_traceoff -echo "conflicts.at:546: bison -o input.c input.y" -echo conflicts.at:546 >$at_check_line_file -( $at_traceon; bison -o input.c input.y ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo >>$at_stderr; echo "input.y: conflicts: 1 reduce/reduce -input.y: warning: expected 0 reduce/reduce conflicts -" | $at_diff - $at_stderr || at_failed=: -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "conflicts.at:546: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - $at_traceoff - $at_times_p && times >$at_times_file - ) 5>&1 2>&1 | eval $at_tee_pipe - at_status=`cat $at_status_file` - ;; - - 53 ) # 53. conflicts.at:554: %no-default-prec without %prec - at_setup_line='conflicts.at:554' - at_desc='%no-default-prec without %prec' - $at_quiet $ECHO_N " 53: %no-default-prec without %prec $ECHO_C" - at_xfail=no - ( - echo "53. conflicts.at:554: testing ..." - $at_traceon - - -cat >input.y <<'_ATEOF' -%left '+' -%left '*' - -%% - -%no-default-prec; - -e: e '+' e - | e '*' e - | '0' - ; -_ATEOF - - -$at_traceoff -echo "conflicts.at:572: bison -o input.c input.y" -echo conflicts.at:572 >$at_check_line_file -( $at_traceon; bison -o input.c input.y ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo >>$at_stderr; echo "input.y: conflicts: 4 shift/reduce -" | $at_diff - $at_stderr || at_failed=: -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "conflicts.at:572: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - $at_traceoff - $at_times_p && times >$at_times_file - ) 5>&1 2>&1 | eval $at_tee_pipe - at_status=`cat $at_status_file` - ;; - - 54 ) # 54. conflicts.at:580: %no-default-prec with %prec - at_setup_line='conflicts.at:580' - at_desc='%no-default-prec with %prec' - $at_quiet $ECHO_N " 54: %no-default-prec with %prec $ECHO_C" - at_xfail=no - ( - echo "54. conflicts.at:580: testing ..." - $at_traceon - - -cat >input.y <<'_ATEOF' -%left '+' -%left '*' - -%% - -%no-default-prec; - -e: e '+' e %prec '+' - | e '*' e %prec '*' - | '0' - ; -_ATEOF - - -$at_traceoff -echo "conflicts.at:596: bison -o input.c input.y" -echo conflicts.at:596 >$at_check_line_file -( $at_traceon; bison -o input.c input.y ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "conflicts.at:596: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - $at_traceoff - $at_times_p && times >$at_times_file - ) 5>&1 2>&1 | eval $at_tee_pipe - at_status=`cat $at_status_file` - ;; - - 55 ) # 55. conflicts.at:604: %default-prec - at_setup_line='conflicts.at:604' - at_desc='%default-prec' - $at_quiet $ECHO_N " 55: %default-prec $ECHO_C" - at_xfail=no - ( - echo "55. conflicts.at:604: testing ..." - $at_traceon - - -cat >input.y <<'_ATEOF' -%left '+' -%left '*' - -%% - -%default-prec; - -e: e '+' e - | e '*' e - | '0' - ; -_ATEOF - - -$at_traceoff -echo "conflicts.at:620: bison -o input.c input.y" -echo conflicts.at:620 >$at_check_line_file -( $at_traceon; bison -o input.c input.y ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "conflicts.at:620: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - $at_traceoff - $at_times_p && times >$at_times_file - ) 5>&1 2>&1 | eval $at_tee_pipe - at_status=`cat $at_status_file` - ;; - - - banner-9 ) # Banner 9. calc.at:532 - cat <<\_ATEOF - -Simple LALR Calculator. - -_ATEOF - ;; - - 56 ) # 56. calc.at:541: Calculator - at_setup_line='calc.at:541' - at_desc='Calculator ' - $at_quiet $ECHO_N " 56: Calculator $ECHO_C" - at_xfail=no - ( - echo "56. calc.at:541: testing ..." - $at_traceon - - - - - - -# Using yacc.c? - - - - - - - -# yyerror receives the location if %location & %pure & (%glr or %parse-param). - -# yyerror always sees the locations (when activated), except if -# yacc & pure & !param. - - -# The interface is pure: either because %pure-parser, or because we -# are using the C++ parsers. - - - - - - - - - - - - -cat >calc.y <<'_ATEOF' -%{ -#if HAVE_CONFIG_H -# include - /* We don't need perfect functions for these tests. */ -# undef malloc -# undef memcmp -# undef realloc -#endif -%} - -/* Infix notation calculator--calc */ - -%{ -#include - -#include -#include -#if HAVE_UNISTD_H -# include -#else -# undef alarm -# define alarm(seconds) /* empty */ -#endif -#include - -/* Exercise pre-prologue dependency to %union. */ -typedef int semantic_value; - -static semantic_value global_result = 0; -static int global_count = 0; -%} - -/* Exercise %union. */ -%union -{ - semantic_value ival; -}; - -%{ -static int power (int base, int exponent); -/* yyerror receives the location if: - - %location & %pure & %glr - - %location & %pure & %yacc & %parse-param. */ -static void yyerror ( - - const char *s - ); -static int yylex (void); -static int yygetc (void); -static void yyungetc ( int c); -%} - -/* Bison Declarations */ -%token CALC_EOF 0 "end of input" -%token NUM "number" -%type exp - -%nonassoc '=' /* comparison */ -%left '-' '+' -%left '*' '/' -%left NEG /* negation--unary minus */ -%right '^' /* exponentiation */ - -/* Grammar follows */ -%% -input: - line -| input line { } -; - -line: - '\n' -| exp '\n' { } -; - -exp: - NUM { $$ = $1; } -| exp '=' exp - { - if ($1 != $3) - fprintf (stderr, "calc: error: %d != %d\n", $1, $3); - $$ = $1; - } -| exp '+' exp { $$ = $1 + $3; } -| exp '-' exp { $$ = $1 - $3; } -| exp '*' exp { $$ = $1 * $3; } -| exp '/' exp { $$ = $1 / $3; } -| '-' exp %prec NEG { $$ = -$2; } -| exp '^' exp { $$ = power ($1, $3); } -| '(' exp ')' { $$ = $2; } -| '(' error ')' { $$ = 1111; } -| '!' { YYERROR; } -| '-' error { YYERROR; } -; -%% -/* The input. */ -static FILE *yyin; - -static void -yyerror ( - - const char *s) -{ - - - fprintf (stderr, "%s\n", s); -} - - - -static int -yygetc (void) -{ - int res = getc (yyin); - ; - - return res; -} - - -static void -yyungetc ( int c) -{ - ; - - ungetc (c, yyin); -} - -static int -read_signed_integer (void) -{ - int c = yygetc (); - int sign = 1; - int n = 0; - - ; - if (c == '-') - { - c = yygetc (); - sign = -1; - } - - while (isdigit (c)) - { - n = 10 * n + (c - '0'); - c = yygetc (); - } - - yyungetc ( c); - - return sign * n; -} - - - -/*---------------------------------------------------------------. -| Lexical analyzer returns an integer on the stack and the token | -| NUM, or the ASCII character read if not a number. Skips all | -| blanks and tabs, returns 0 for EOF. | -`---------------------------------------------------------------*/ - -static int -yylex (void) -{ - static int init = 1; - int c; - - if (init) - { - init = 0; - - } - - - - /* Skip white space. */ - while ((c = yygetc ()) == ' ' || c == '\t') - { - - } - - /* process numbers */ - if (c == '.' || isdigit (c)) - { - yyungetc ( c); - (yylval).ival = read_signed_integer (); - return NUM; - } - - /* Return end-of-file. */ - if (c == EOF) - return CALC_EOF; - - /* Return single chars. */ - return c; -} - -static int -power (int base, int exponent) -{ - int res = 1; - if (exponent < 0) - exit (1); - for (/* Niente */; exponent; --exponent) - res *= base; - return res; -} - - -int -main (int argc, const char **argv) -{ - semantic_value result = 0; - int count = 0; - int status; - - alarm (10); - if (argc == 2) - yyin = fopen (argv[1], "r"); - else - yyin = stdin; - - if (!yyin) - { - perror (argv[1]); - exit (1); - } - - - status = yyparse (); - if (global_result != result) - abort (); - if (global_count != count) - abort (); - return status; -} -_ATEOF - - - - - -# Specify the output files to avoid problems on different file systems. -$at_traceoff -echo "calc.at:541: bison -o calc.c calc.y" -echo calc.at:541 >$at_check_line_file -( $at_traceon; bison -o calc.c calc.y ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:541: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - -$at_traceoff -echo "calc.at:541: \$CC \$CFLAGS \$CPPFLAGS \$LDFLAGS calc.c \$LIBS -o calc" -echo calc.at:541 >$at_check_line_file -( $at_traceon; $CC $CFLAGS $CPPFLAGS $LDFLAGS calc.c $LIBS -o calc ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo stderr:; cat $at_stderr -echo stdout:; cat $at_stdout -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:541: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - -# Test the priorities. -cat >input <<'_ATEOF' -1 + 2 * 3 = 7 -1 + 2 * -3 = -5 - --1^2 = -1 -(-1)^2 = 1 - ----1 = -1 - -1 - 2 - 3 = -4 -1 - (2 - 3) = 2 - -2^2^3 = 256 -(2^2)^3 = 64 -_ATEOF - -$at_traceoff -echo "calc.at:541: \$PREPARSER ./calc input" -echo calc.at:541 >$at_check_line_file -( $at_traceon; $PREPARSER ./calc input ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo stderr:; tee stderr <$at_stderr -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:541: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - - - -# Some syntax errors. -cat >input <<'_ATEOF' -0 0 -_ATEOF - -$at_traceoff -echo "calc.at:541: \$PREPARSER ./calc input" -echo calc.at:541 >$at_check_line_file -( $at_traceon; $PREPARSER ./calc input ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo stderr:; tee stderr <$at_stderr -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 1) ;; - *) echo "calc.at:541: exit code was $at_status, expected 1" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - - -# Normalize the observed and expected error messages, depending upon the -# options. -# 1. Remove the traces from observed. -sed '/^Starting/d -/^Entering/d -/^Stack/d -/^Reading/d -/^Reducing/d -/^Shifting/d -/^state/d -/^Error:/d -/^Next/d -/^Discarding/d -/^yydestructor:/d' stderr >at-stderr -mv at-stderr stderr -# 2. Create the reference error message. -cat >expout <<'_ATEOF' -1.2: syntax error, unexpected "number" -_ATEOF - -# 3. If locations are not used, remove them. -sed 's/^[-0-9.]*: //' expout >at-expout -mv at-expout expout -# 4. If error-verbose is not used, strip the`, unexpected....' part. -sed 's/syntax error, .*$/syntax error/' expout >at-expout -mv at-expout expout -# 5. Check -$at_traceoff -echo "calc.at:541: cat stderr" -echo calc.at:541 >$at_check_line_file -( $at_traceon; cat stderr ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -$at_diff expout $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:541: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - -cat >input <<'_ATEOF' -1//2 -_ATEOF - -$at_traceoff -echo "calc.at:541: \$PREPARSER ./calc input" -echo calc.at:541 >$at_check_line_file -( $at_traceon; $PREPARSER ./calc input ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo stderr:; tee stderr <$at_stderr -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 1) ;; - *) echo "calc.at:541: exit code was $at_status, expected 1" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - - -# Normalize the observed and expected error messages, depending upon the -# options. -# 1. Remove the traces from observed. -sed '/^Starting/d -/^Entering/d -/^Stack/d -/^Reading/d -/^Reducing/d -/^Shifting/d -/^state/d -/^Error:/d -/^Next/d -/^Discarding/d -/^yydestructor:/d' stderr >at-stderr -mv at-stderr stderr -# 2. Create the reference error message. -cat >expout <<'_ATEOF' -1.2: syntax error, unexpected '/', expecting "number" or '-' or '(' or '!' -_ATEOF - -# 3. If locations are not used, remove them. -sed 's/^[-0-9.]*: //' expout >at-expout -mv at-expout expout -# 4. If error-verbose is not used, strip the`, unexpected....' part. -sed 's/syntax error, .*$/syntax error/' expout >at-expout -mv at-expout expout -# 5. Check -$at_traceoff -echo "calc.at:541: cat stderr" -echo calc.at:541 >$at_check_line_file -( $at_traceon; cat stderr ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -$at_diff expout $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:541: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - -cat >input <<'_ATEOF' -error -_ATEOF - -$at_traceoff -echo "calc.at:541: \$PREPARSER ./calc input" -echo calc.at:541 >$at_check_line_file -( $at_traceon; $PREPARSER ./calc input ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo stderr:; tee stderr <$at_stderr -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 1) ;; - *) echo "calc.at:541: exit code was $at_status, expected 1" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - - -# Normalize the observed and expected error messages, depending upon the -# options. -# 1. Remove the traces from observed. -sed '/^Starting/d -/^Entering/d -/^Stack/d -/^Reading/d -/^Reducing/d -/^Shifting/d -/^state/d -/^Error:/d -/^Next/d -/^Discarding/d -/^yydestructor:/d' stderr >at-stderr -mv at-stderr stderr -# 2. Create the reference error message. -cat >expout <<'_ATEOF' -1.0: syntax error, unexpected $undefined -_ATEOF - -# 3. If locations are not used, remove them. -sed 's/^[-0-9.]*: //' expout >at-expout -mv at-expout expout -# 4. If error-verbose is not used, strip the`, unexpected....' part. -sed 's/syntax error, .*$/syntax error/' expout >at-expout -mv at-expout expout -# 5. Check -$at_traceoff -echo "calc.at:541: cat stderr" -echo calc.at:541 >$at_check_line_file -( $at_traceon; cat stderr ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -$at_diff expout $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:541: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - -cat >input <<'_ATEOF' -1 = 2 = 3 -_ATEOF - -$at_traceoff -echo "calc.at:541: \$PREPARSER ./calc input" -echo calc.at:541 >$at_check_line_file -( $at_traceon; $PREPARSER ./calc input ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo stderr:; tee stderr <$at_stderr -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 1) ;; - *) echo "calc.at:541: exit code was $at_status, expected 1" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - - -# Normalize the observed and expected error messages, depending upon the -# options. -# 1. Remove the traces from observed. -sed '/^Starting/d -/^Entering/d -/^Stack/d -/^Reading/d -/^Reducing/d -/^Shifting/d -/^state/d -/^Error:/d -/^Next/d -/^Discarding/d -/^yydestructor:/d' stderr >at-stderr -mv at-stderr stderr -# 2. Create the reference error message. -cat >expout <<'_ATEOF' -1.6: syntax error, unexpected '=' -_ATEOF - -# 3. If locations are not used, remove them. -sed 's/^[-0-9.]*: //' expout >at-expout -mv at-expout expout -# 4. If error-verbose is not used, strip the`, unexpected....' part. -sed 's/syntax error, .*$/syntax error/' expout >at-expout -mv at-expout expout -# 5. Check -$at_traceoff -echo "calc.at:541: cat stderr" -echo calc.at:541 >$at_check_line_file -( $at_traceon; cat stderr ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -$at_diff expout $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:541: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - -cat >input <<'_ATEOF' - -+1 -_ATEOF - -$at_traceoff -echo "calc.at:541: \$PREPARSER ./calc input" -echo calc.at:541 >$at_check_line_file -( $at_traceon; $PREPARSER ./calc input ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo stderr:; tee stderr <$at_stderr -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 1) ;; - *) echo "calc.at:541: exit code was $at_status, expected 1" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - - -# Normalize the observed and expected error messages, depending upon the -# options. -# 1. Remove the traces from observed. -sed '/^Starting/d -/^Entering/d -/^Stack/d -/^Reading/d -/^Reducing/d -/^Shifting/d -/^state/d -/^Error:/d -/^Next/d -/^Discarding/d -/^yydestructor:/d' stderr >at-stderr -mv at-stderr stderr -# 2. Create the reference error message. -cat >expout <<'_ATEOF' -2.0: syntax error, unexpected '+' -_ATEOF - -# 3. If locations are not used, remove them. -sed 's/^[-0-9.]*: //' expout >at-expout -mv at-expout expout -# 4. If error-verbose is not used, strip the`, unexpected....' part. -sed 's/syntax error, .*$/syntax error/' expout >at-expout -mv at-expout expout -# 5. Check -$at_traceoff -echo "calc.at:541: cat stderr" -echo calc.at:541 >$at_check_line_file -( $at_traceon; cat stderr ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -$at_diff expout $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:541: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - -# Exercise error messages with EOF: work on an empty file. -$at_traceoff -echo "calc.at:541: \$PREPARSER ./calc /dev/null" -echo calc.at:541 >$at_check_line_file -( $at_traceon; $PREPARSER ./calc /dev/null ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo stderr:; tee stderr <$at_stderr -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 1) ;; - *) echo "calc.at:541: exit code was $at_status, expected 1" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - - -# Normalize the observed and expected error messages, depending upon the -# options. -# 1. Remove the traces from observed. -sed '/^Starting/d -/^Entering/d -/^Stack/d -/^Reading/d -/^Reducing/d -/^Shifting/d -/^state/d -/^Error:/d -/^Next/d -/^Discarding/d -/^yydestructor:/d' stderr >at-stderr -mv at-stderr stderr -# 2. Create the reference error message. -cat >expout <<'_ATEOF' -1.0: syntax error, unexpected "end of input" -_ATEOF - -# 3. If locations are not used, remove them. -sed 's/^[-0-9.]*: //' expout >at-expout -mv at-expout expout -# 4. If error-verbose is not used, strip the`, unexpected....' part. -sed 's/syntax error, .*$/syntax error/' expout >at-expout -mv at-expout expout -# 5. Check -$at_traceoff -echo "calc.at:541: cat stderr" -echo calc.at:541 >$at_check_line_file -( $at_traceon; cat stderr ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -$at_diff expout $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:541: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - - -# Exercise the error token: without it, we die at the first error, -# hence be sure to -# -# - have several errors which exercise different shift/discardings -# - (): nothing to pop, nothing to discard -# - (1 + 1 + 1 +): a lot to pop, nothing to discard -# - (* * *): nothing to pop, a lot to discard -# - (1 + 2 * *): some to pop and discard -# -# - test the action associated to `error' -# -# - check the lookahead that triggers an error is not discarded -# when we enter error recovery. Below, the lookahead causing the -# first error is ")", which is needed to recover from the error and -# produce the "0" that triggers the "0 != 1" error. -# -cat >input <<'_ATEOF' -() + (1 + 1 + 1 +) + (* * *) + (1 * 2 * *) = 1 -_ATEOF - -$at_traceoff -echo "calc.at:541: \$PREPARSER ./calc input" -echo calc.at:541 >$at_check_line_file -( $at_traceon; $PREPARSER ./calc input ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo stderr:; tee stderr <$at_stderr -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:541: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - - -# Normalize the observed and expected error messages, depending upon the -# options. -# 1. Remove the traces from observed. -sed '/^Starting/d -/^Entering/d -/^Stack/d -/^Reading/d -/^Reducing/d -/^Shifting/d -/^state/d -/^Error:/d -/^Next/d -/^Discarding/d -/^yydestructor:/d' stderr >at-stderr -mv at-stderr stderr -# 2. Create the reference error message. -cat >expout <<'_ATEOF' -1.1: syntax error, unexpected ')', expecting "number" or '-' or '(' or '!' -1.17: syntax error, unexpected ')', expecting "number" or '-' or '(' or '!' -1.22: syntax error, unexpected '*', expecting "number" or '-' or '(' or '!' -1.40: syntax error, unexpected '*', expecting "number" or '-' or '(' or '!' -calc: error: 4444 != 1 -_ATEOF - -# 3. If locations are not used, remove them. -sed 's/^[-0-9.]*: //' expout >at-expout -mv at-expout expout -# 4. If error-verbose is not used, strip the`, unexpected....' part. -sed 's/syntax error, .*$/syntax error/' expout >at-expout -mv at-expout expout -# 5. Check -$at_traceoff -echo "calc.at:541: cat stderr" -echo calc.at:541 >$at_check_line_file -( $at_traceon; cat stderr ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -$at_diff expout $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:541: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - - -# The same, but this time exercising explicitly triggered syntax errors. -# POSIX says the lookahead causing the error should not be discarded. -cat >input <<'_ATEOF' -(!) + (0 0) = 1 -_ATEOF - -$at_traceoff -echo "calc.at:541: \$PREPARSER ./calc input" -echo calc.at:541 >$at_check_line_file -( $at_traceon; $PREPARSER ./calc input ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo stderr:; tee stderr <$at_stderr -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:541: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - - -# Normalize the observed and expected error messages, depending upon the -# options. -# 1. Remove the traces from observed. -sed '/^Starting/d -/^Entering/d -/^Stack/d -/^Reading/d -/^Reducing/d -/^Shifting/d -/^state/d -/^Error:/d -/^Next/d -/^Discarding/d -/^yydestructor:/d' stderr >at-stderr -mv at-stderr stderr -# 2. Create the reference error message. -cat >expout <<'_ATEOF' -1.9: syntax error, unexpected "number" -calc: error: 2222 != 1 -_ATEOF - -# 3. If locations are not used, remove them. -sed 's/^[-0-9.]*: //' expout >at-expout -mv at-expout expout -# 4. If error-verbose is not used, strip the`, unexpected....' part. -sed 's/syntax error, .*$/syntax error/' expout >at-expout -mv at-expout expout -# 5. Check -$at_traceoff -echo "calc.at:541: cat stderr" -echo calc.at:541 >$at_check_line_file -( $at_traceon; cat stderr ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -$at_diff expout $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:541: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - -cat >input <<'_ATEOF' -(- *) + (0 0) = 1 -_ATEOF - -$at_traceoff -echo "calc.at:541: \$PREPARSER ./calc input" -echo calc.at:541 >$at_check_line_file -( $at_traceon; $PREPARSER ./calc input ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo stderr:; tee stderr <$at_stderr -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:541: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - - -# Normalize the observed and expected error messages, depending upon the -# options. -# 1. Remove the traces from observed. -sed '/^Starting/d -/^Entering/d -/^Stack/d -/^Reading/d -/^Reducing/d -/^Shifting/d -/^state/d -/^Error:/d -/^Next/d -/^Discarding/d -/^yydestructor:/d' stderr >at-stderr -mv at-stderr stderr -# 2. Create the reference error message. -cat >expout <<'_ATEOF' -1.3: syntax error, unexpected '*', expecting "number" or '-' or '(' or '!' -1.11: syntax error, unexpected "number" -calc: error: 2222 != 1 -_ATEOF - -# 3. If locations are not used, remove them. -sed 's/^[-0-9.]*: //' expout >at-expout -mv at-expout expout -# 4. If error-verbose is not used, strip the`, unexpected....' part. -sed 's/syntax error, .*$/syntax error/' expout >at-expout -mv at-expout expout -# 5. Check -$at_traceoff -echo "calc.at:541: cat stderr" -echo calc.at:541 >$at_check_line_file -( $at_traceon; cat stderr ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -$at_diff expout $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:541: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - - - - - - - - - - - - - - - - - - - - - $at_traceoff - $at_times_p && times >$at_times_file - ) 5>&1 2>&1 | eval $at_tee_pipe - at_status=`cat $at_status_file` - ;; - - 57 ) # 57. calc.at:543: Calculator %defines - at_setup_line='calc.at:543' - at_desc='Calculator %defines' - $at_quiet $ECHO_N " 57: Calculator %defines $ECHO_C" - at_xfail=no - ( - echo "57. calc.at:543: testing ..." - $at_traceon - - - - - - -# Using yacc.c? - - - - - - - -# yyerror receives the location if %location & %pure & (%glr or %parse-param). - -# yyerror always sees the locations (when activated), except if -# yacc & pure & !param. - - -# The interface is pure: either because %pure-parser, or because we -# are using the C++ parsers. - - - - - - - - - - - - -cat >calc.y <<'_ATEOF' -%{ -#if HAVE_CONFIG_H -# include - /* We don't need perfect functions for these tests. */ -# undef malloc -# undef memcmp -# undef realloc -#endif -%} - -/* Infix notation calculator--calc */ -%defines -%{ -#include - -#include -#include -#if HAVE_UNISTD_H -# include -#else -# undef alarm -# define alarm(seconds) /* empty */ -#endif -#include - -/* Exercise pre-prologue dependency to %union. */ -typedef int semantic_value; - -static semantic_value global_result = 0; -static int global_count = 0; -%} - -/* Exercise %union. */ -%union -{ - semantic_value ival; -}; - -%{ -static int power (int base, int exponent); -/* yyerror receives the location if: - - %location & %pure & %glr - - %location & %pure & %yacc & %parse-param. */ -static void yyerror ( - - const char *s - ); -static int yylex (void); -static int yygetc (void); -static void yyungetc ( int c); -%} - -/* Bison Declarations */ -%token CALC_EOF 0 "end of input" -%token NUM "number" -%type exp - -%nonassoc '=' /* comparison */ -%left '-' '+' -%left '*' '/' -%left NEG /* negation--unary minus */ -%right '^' /* exponentiation */ - -/* Grammar follows */ -%% -input: - line -| input line { } -; - -line: - '\n' -| exp '\n' { } -; - -exp: - NUM { $$ = $1; } -| exp '=' exp - { - if ($1 != $3) - fprintf (stderr, "calc: error: %d != %d\n", $1, $3); - $$ = $1; - } -| exp '+' exp { $$ = $1 + $3; } -| exp '-' exp { $$ = $1 - $3; } -| exp '*' exp { $$ = $1 * $3; } -| exp '/' exp { $$ = $1 / $3; } -| '-' exp %prec NEG { $$ = -$2; } -| exp '^' exp { $$ = power ($1, $3); } -| '(' exp ')' { $$ = $2; } -| '(' error ')' { $$ = 1111; } -| '!' { YYERROR; } -| '-' error { YYERROR; } -; -%% -/* The input. */ -static FILE *yyin; - -static void -yyerror ( - - const char *s) -{ - - - fprintf (stderr, "%s\n", s); -} - - - -static int -yygetc (void) -{ - int res = getc (yyin); - ; - - return res; -} - - -static void -yyungetc ( int c) -{ - ; - - ungetc (c, yyin); -} - -static int -read_signed_integer (void) -{ - int c = yygetc (); - int sign = 1; - int n = 0; - - ; - if (c == '-') - { - c = yygetc (); - sign = -1; - } - - while (isdigit (c)) - { - n = 10 * n + (c - '0'); - c = yygetc (); - } - - yyungetc ( c); - - return sign * n; -} - - - -/*---------------------------------------------------------------. -| Lexical analyzer returns an integer on the stack and the token | -| NUM, or the ASCII character read if not a number. Skips all | -| blanks and tabs, returns 0 for EOF. | -`---------------------------------------------------------------*/ - -static int -yylex (void) -{ - static int init = 1; - int c; - - if (init) - { - init = 0; - - } - - - - /* Skip white space. */ - while ((c = yygetc ()) == ' ' || c == '\t') - { - - } - - /* process numbers */ - if (c == '.' || isdigit (c)) - { - yyungetc ( c); - (yylval).ival = read_signed_integer (); - return NUM; - } - - /* Return end-of-file. */ - if (c == EOF) - return CALC_EOF; - - /* Return single chars. */ - return c; -} - -static int -power (int base, int exponent) -{ - int res = 1; - if (exponent < 0) - exit (1); - for (/* Niente */; exponent; --exponent) - res *= base; - return res; -} - - -int -main (int argc, const char **argv) -{ - semantic_value result = 0; - int count = 0; - int status; - - alarm (10); - if (argc == 2) - yyin = fopen (argv[1], "r"); - else - yyin = stdin; - - if (!yyin) - { - perror (argv[1]); - exit (1); - } - - - status = yyparse (); - if (global_result != result) - abort (); - if (global_count != count) - abort (); - return status; -} -_ATEOF - - - - - -# Specify the output files to avoid problems on different file systems. -$at_traceoff -echo "calc.at:543: bison -o calc.c calc.y" -echo calc.at:543 >$at_check_line_file -( $at_traceon; bison -o calc.c calc.y ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:543: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - -$at_traceoff -echo "calc.at:543: \$CC \$CFLAGS \$CPPFLAGS \$LDFLAGS calc.c \$LIBS -o calc" -echo calc.at:543 >$at_check_line_file -( $at_traceon; $CC $CFLAGS $CPPFLAGS $LDFLAGS calc.c $LIBS -o calc ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo stderr:; cat $at_stderr -echo stdout:; cat $at_stdout -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:543: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - -# Test the priorities. -cat >input <<'_ATEOF' -1 + 2 * 3 = 7 -1 + 2 * -3 = -5 - --1^2 = -1 -(-1)^2 = 1 - ----1 = -1 - -1 - 2 - 3 = -4 -1 - (2 - 3) = 2 - -2^2^3 = 256 -(2^2)^3 = 64 -_ATEOF - -$at_traceoff -echo "calc.at:543: \$PREPARSER ./calc input" -echo calc.at:543 >$at_check_line_file -( $at_traceon; $PREPARSER ./calc input ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo stderr:; tee stderr <$at_stderr -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:543: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - - - -# Some syntax errors. -cat >input <<'_ATEOF' -0 0 -_ATEOF - -$at_traceoff -echo "calc.at:543: \$PREPARSER ./calc input" -echo calc.at:543 >$at_check_line_file -( $at_traceon; $PREPARSER ./calc input ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo stderr:; tee stderr <$at_stderr -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 1) ;; - *) echo "calc.at:543: exit code was $at_status, expected 1" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - - -# Normalize the observed and expected error messages, depending upon the -# options. -# 1. Remove the traces from observed. -sed '/^Starting/d -/^Entering/d -/^Stack/d -/^Reading/d -/^Reducing/d -/^Shifting/d -/^state/d -/^Error:/d -/^Next/d -/^Discarding/d -/^yydestructor:/d' stderr >at-stderr -mv at-stderr stderr -# 2. Create the reference error message. -cat >expout <<'_ATEOF' -1.2: syntax error, unexpected "number" -_ATEOF - -# 3. If locations are not used, remove them. -sed 's/^[-0-9.]*: //' expout >at-expout -mv at-expout expout -# 4. If error-verbose is not used, strip the`, unexpected....' part. -sed 's/syntax error, .*$/syntax error/' expout >at-expout -mv at-expout expout -# 5. Check -$at_traceoff -echo "calc.at:543: cat stderr" -echo calc.at:543 >$at_check_line_file -( $at_traceon; cat stderr ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -$at_diff expout $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:543: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - -cat >input <<'_ATEOF' -1//2 -_ATEOF - -$at_traceoff -echo "calc.at:543: \$PREPARSER ./calc input" -echo calc.at:543 >$at_check_line_file -( $at_traceon; $PREPARSER ./calc input ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo stderr:; tee stderr <$at_stderr -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 1) ;; - *) echo "calc.at:543: exit code was $at_status, expected 1" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - - -# Normalize the observed and expected error messages, depending upon the -# options. -# 1. Remove the traces from observed. -sed '/^Starting/d -/^Entering/d -/^Stack/d -/^Reading/d -/^Reducing/d -/^Shifting/d -/^state/d -/^Error:/d -/^Next/d -/^Discarding/d -/^yydestructor:/d' stderr >at-stderr -mv at-stderr stderr -# 2. Create the reference error message. -cat >expout <<'_ATEOF' -1.2: syntax error, unexpected '/', expecting "number" or '-' or '(' or '!' -_ATEOF - -# 3. If locations are not used, remove them. -sed 's/^[-0-9.]*: //' expout >at-expout -mv at-expout expout -# 4. If error-verbose is not used, strip the`, unexpected....' part. -sed 's/syntax error, .*$/syntax error/' expout >at-expout -mv at-expout expout -# 5. Check -$at_traceoff -echo "calc.at:543: cat stderr" -echo calc.at:543 >$at_check_line_file -( $at_traceon; cat stderr ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -$at_diff expout $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:543: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - -cat >input <<'_ATEOF' -error -_ATEOF - -$at_traceoff -echo "calc.at:543: \$PREPARSER ./calc input" -echo calc.at:543 >$at_check_line_file -( $at_traceon; $PREPARSER ./calc input ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo stderr:; tee stderr <$at_stderr -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 1) ;; - *) echo "calc.at:543: exit code was $at_status, expected 1" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - - -# Normalize the observed and expected error messages, depending upon the -# options. -# 1. Remove the traces from observed. -sed '/^Starting/d -/^Entering/d -/^Stack/d -/^Reading/d -/^Reducing/d -/^Shifting/d -/^state/d -/^Error:/d -/^Next/d -/^Discarding/d -/^yydestructor:/d' stderr >at-stderr -mv at-stderr stderr -# 2. Create the reference error message. -cat >expout <<'_ATEOF' -1.0: syntax error, unexpected $undefined -_ATEOF - -# 3. If locations are not used, remove them. -sed 's/^[-0-9.]*: //' expout >at-expout -mv at-expout expout -# 4. If error-verbose is not used, strip the`, unexpected....' part. -sed 's/syntax error, .*$/syntax error/' expout >at-expout -mv at-expout expout -# 5. Check -$at_traceoff -echo "calc.at:543: cat stderr" -echo calc.at:543 >$at_check_line_file -( $at_traceon; cat stderr ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -$at_diff expout $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:543: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - -cat >input <<'_ATEOF' -1 = 2 = 3 -_ATEOF - -$at_traceoff -echo "calc.at:543: \$PREPARSER ./calc input" -echo calc.at:543 >$at_check_line_file -( $at_traceon; $PREPARSER ./calc input ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo stderr:; tee stderr <$at_stderr -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 1) ;; - *) echo "calc.at:543: exit code was $at_status, expected 1" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - - -# Normalize the observed and expected error messages, depending upon the -# options. -# 1. Remove the traces from observed. -sed '/^Starting/d -/^Entering/d -/^Stack/d -/^Reading/d -/^Reducing/d -/^Shifting/d -/^state/d -/^Error:/d -/^Next/d -/^Discarding/d -/^yydestructor:/d' stderr >at-stderr -mv at-stderr stderr -# 2. Create the reference error message. -cat >expout <<'_ATEOF' -1.6: syntax error, unexpected '=' -_ATEOF - -# 3. If locations are not used, remove them. -sed 's/^[-0-9.]*: //' expout >at-expout -mv at-expout expout -# 4. If error-verbose is not used, strip the`, unexpected....' part. -sed 's/syntax error, .*$/syntax error/' expout >at-expout -mv at-expout expout -# 5. Check -$at_traceoff -echo "calc.at:543: cat stderr" -echo calc.at:543 >$at_check_line_file -( $at_traceon; cat stderr ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -$at_diff expout $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:543: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - -cat >input <<'_ATEOF' - -+1 -_ATEOF - -$at_traceoff -echo "calc.at:543: \$PREPARSER ./calc input" -echo calc.at:543 >$at_check_line_file -( $at_traceon; $PREPARSER ./calc input ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo stderr:; tee stderr <$at_stderr -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 1) ;; - *) echo "calc.at:543: exit code was $at_status, expected 1" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - - -# Normalize the observed and expected error messages, depending upon the -# options. -# 1. Remove the traces from observed. -sed '/^Starting/d -/^Entering/d -/^Stack/d -/^Reading/d -/^Reducing/d -/^Shifting/d -/^state/d -/^Error:/d -/^Next/d -/^Discarding/d -/^yydestructor:/d' stderr >at-stderr -mv at-stderr stderr -# 2. Create the reference error message. -cat >expout <<'_ATEOF' -2.0: syntax error, unexpected '+' -_ATEOF - -# 3. If locations are not used, remove them. -sed 's/^[-0-9.]*: //' expout >at-expout -mv at-expout expout -# 4. If error-verbose is not used, strip the`, unexpected....' part. -sed 's/syntax error, .*$/syntax error/' expout >at-expout -mv at-expout expout -# 5. Check -$at_traceoff -echo "calc.at:543: cat stderr" -echo calc.at:543 >$at_check_line_file -( $at_traceon; cat stderr ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -$at_diff expout $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:543: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - -# Exercise error messages with EOF: work on an empty file. -$at_traceoff -echo "calc.at:543: \$PREPARSER ./calc /dev/null" -echo calc.at:543 >$at_check_line_file -( $at_traceon; $PREPARSER ./calc /dev/null ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo stderr:; tee stderr <$at_stderr -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 1) ;; - *) echo "calc.at:543: exit code was $at_status, expected 1" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - - -# Normalize the observed and expected error messages, depending upon the -# options. -# 1. Remove the traces from observed. -sed '/^Starting/d -/^Entering/d -/^Stack/d -/^Reading/d -/^Reducing/d -/^Shifting/d -/^state/d -/^Error:/d -/^Next/d -/^Discarding/d -/^yydestructor:/d' stderr >at-stderr -mv at-stderr stderr -# 2. Create the reference error message. -cat >expout <<'_ATEOF' -1.0: syntax error, unexpected "end of input" -_ATEOF - -# 3. If locations are not used, remove them. -sed 's/^[-0-9.]*: //' expout >at-expout -mv at-expout expout -# 4. If error-verbose is not used, strip the`, unexpected....' part. -sed 's/syntax error, .*$/syntax error/' expout >at-expout -mv at-expout expout -# 5. Check -$at_traceoff -echo "calc.at:543: cat stderr" -echo calc.at:543 >$at_check_line_file -( $at_traceon; cat stderr ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -$at_diff expout $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:543: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - - -# Exercise the error token: without it, we die at the first error, -# hence be sure to -# -# - have several errors which exercise different shift/discardings -# - (): nothing to pop, nothing to discard -# - (1 + 1 + 1 +): a lot to pop, nothing to discard -# - (* * *): nothing to pop, a lot to discard -# - (1 + 2 * *): some to pop and discard -# -# - test the action associated to `error' -# -# - check the lookahead that triggers an error is not discarded -# when we enter error recovery. Below, the lookahead causing the -# first error is ")", which is needed to recover from the error and -# produce the "0" that triggers the "0 != 1" error. -# -cat >input <<'_ATEOF' -() + (1 + 1 + 1 +) + (* * *) + (1 * 2 * *) = 1 -_ATEOF - -$at_traceoff -echo "calc.at:543: \$PREPARSER ./calc input" -echo calc.at:543 >$at_check_line_file -( $at_traceon; $PREPARSER ./calc input ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo stderr:; tee stderr <$at_stderr -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:543: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - - -# Normalize the observed and expected error messages, depending upon the -# options. -# 1. Remove the traces from observed. -sed '/^Starting/d -/^Entering/d -/^Stack/d -/^Reading/d -/^Reducing/d -/^Shifting/d -/^state/d -/^Error:/d -/^Next/d -/^Discarding/d -/^yydestructor:/d' stderr >at-stderr -mv at-stderr stderr -# 2. Create the reference error message. -cat >expout <<'_ATEOF' -1.1: syntax error, unexpected ')', expecting "number" or '-' or '(' or '!' -1.17: syntax error, unexpected ')', expecting "number" or '-' or '(' or '!' -1.22: syntax error, unexpected '*', expecting "number" or '-' or '(' or '!' -1.40: syntax error, unexpected '*', expecting "number" or '-' or '(' or '!' -calc: error: 4444 != 1 -_ATEOF - -# 3. If locations are not used, remove them. -sed 's/^[-0-9.]*: //' expout >at-expout -mv at-expout expout -# 4. If error-verbose is not used, strip the`, unexpected....' part. -sed 's/syntax error, .*$/syntax error/' expout >at-expout -mv at-expout expout -# 5. Check -$at_traceoff -echo "calc.at:543: cat stderr" -echo calc.at:543 >$at_check_line_file -( $at_traceon; cat stderr ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -$at_diff expout $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:543: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - - -# The same, but this time exercising explicitly triggered syntax errors. -# POSIX says the lookahead causing the error should not be discarded. -cat >input <<'_ATEOF' -(!) + (0 0) = 1 -_ATEOF - -$at_traceoff -echo "calc.at:543: \$PREPARSER ./calc input" -echo calc.at:543 >$at_check_line_file -( $at_traceon; $PREPARSER ./calc input ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo stderr:; tee stderr <$at_stderr -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:543: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - - -# Normalize the observed and expected error messages, depending upon the -# options. -# 1. Remove the traces from observed. -sed '/^Starting/d -/^Entering/d -/^Stack/d -/^Reading/d -/^Reducing/d -/^Shifting/d -/^state/d -/^Error:/d -/^Next/d -/^Discarding/d -/^yydestructor:/d' stderr >at-stderr -mv at-stderr stderr -# 2. Create the reference error message. -cat >expout <<'_ATEOF' -1.9: syntax error, unexpected "number" -calc: error: 2222 != 1 -_ATEOF - -# 3. If locations are not used, remove them. -sed 's/^[-0-9.]*: //' expout >at-expout -mv at-expout expout -# 4. If error-verbose is not used, strip the`, unexpected....' part. -sed 's/syntax error, .*$/syntax error/' expout >at-expout -mv at-expout expout -# 5. Check -$at_traceoff -echo "calc.at:543: cat stderr" -echo calc.at:543 >$at_check_line_file -( $at_traceon; cat stderr ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -$at_diff expout $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:543: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - -cat >input <<'_ATEOF' -(- *) + (0 0) = 1 -_ATEOF - -$at_traceoff -echo "calc.at:543: \$PREPARSER ./calc input" -echo calc.at:543 >$at_check_line_file -( $at_traceon; $PREPARSER ./calc input ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo stderr:; tee stderr <$at_stderr -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:543: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - - -# Normalize the observed and expected error messages, depending upon the -# options. -# 1. Remove the traces from observed. -sed '/^Starting/d -/^Entering/d -/^Stack/d -/^Reading/d -/^Reducing/d -/^Shifting/d -/^state/d -/^Error:/d -/^Next/d -/^Discarding/d -/^yydestructor:/d' stderr >at-stderr -mv at-stderr stderr -# 2. Create the reference error message. -cat >expout <<'_ATEOF' -1.3: syntax error, unexpected '*', expecting "number" or '-' or '(' or '!' -1.11: syntax error, unexpected "number" -calc: error: 2222 != 1 -_ATEOF - -# 3. If locations are not used, remove them. -sed 's/^[-0-9.]*: //' expout >at-expout -mv at-expout expout -# 4. If error-verbose is not used, strip the`, unexpected....' part. -sed 's/syntax error, .*$/syntax error/' expout >at-expout -mv at-expout expout -# 5. Check -$at_traceoff -echo "calc.at:543: cat stderr" -echo calc.at:543 >$at_check_line_file -( $at_traceon; cat stderr ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -$at_diff expout $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:543: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - - - - - - - - - - - - - - - - - - - - - $at_traceoff - $at_times_p && times >$at_times_file - ) 5>&1 2>&1 | eval $at_tee_pipe - at_status=`cat $at_status_file` - ;; - - 58 ) # 58. calc.at:544: Calculator %locations - at_setup_line='calc.at:544' - at_desc='Calculator %locations' - $at_quiet $ECHO_N " 58: Calculator %locations $ECHO_C" - at_xfail=no - ( - echo "58. calc.at:544: testing ..." - $at_traceon - - - - - - -# Using yacc.c? - - - - - - - -# yyerror receives the location if %location & %pure & (%glr or %parse-param). - -# yyerror always sees the locations (when activated), except if -# yacc & pure & !param. - - -# The interface is pure: either because %pure-parser, or because we -# are using the C++ parsers. - - - - - - - - - - - - -cat >calc.y <<'_ATEOF' -%{ -#if HAVE_CONFIG_H -# include - /* We don't need perfect functions for these tests. */ -# undef malloc -# undef memcmp -# undef realloc -#endif -%} - -/* Infix notation calculator--calc */ -%locations -%{ -#include - -#include -#include -#if HAVE_UNISTD_H -# include -#else -# undef alarm -# define alarm(seconds) /* empty */ -#endif -#include - -/* Exercise pre-prologue dependency to %union. */ -typedef int semantic_value; - -static semantic_value global_result = 0; -static int global_count = 0; -%} - -/* Exercise %union. */ -%union -{ - semantic_value ival; -}; - -%{ -static int power (int base, int exponent); -/* yyerror receives the location if: - - %location & %pure & %glr - - %location & %pure & %yacc & %parse-param. */ -static void yyerror ( - - const char *s - ); -static int yylex (void); -static int yygetc (void); -static void yyungetc ( int c); -%} - -/* Bison Declarations */ -%token CALC_EOF 0 "end of input" -%token NUM "number" -%type exp - -%nonassoc '=' /* comparison */ -%left '-' '+' -%left '*' '/' -%left NEG /* negation--unary minus */ -%right '^' /* exponentiation */ - -/* Grammar follows */ -%% -input: - line -| input line { } -; - -line: - '\n' -| exp '\n' { } -; - -exp: - NUM { $$ = $1; } -| exp '=' exp - { - if ($1 != $3) - fprintf (stderr, "calc: error: %d != %d\n", $1, $3); - $$ = $1; - } -| exp '+' exp { $$ = $1 + $3; } -| exp '-' exp { $$ = $1 - $3; } -| exp '*' exp { $$ = $1 * $3; } -| exp '/' exp { $$ = $1 / $3; } -| '-' exp %prec NEG { $$ = -$2; } -| exp '^' exp { $$ = power ($1, $3); } -| '(' exp ')' { $$ = $2; } -| '(' error ')' { $$ = 1111; } -| '!' { YYERROR; } -| '-' error { YYERROR; } -; -%% -/* The input. */ -static FILE *yyin; - -static void -yyerror ( - - const char *s) -{ - - - fprintf (stderr, "%d.%d", - (yylloc).first_line, (yylloc).first_column); - if ((yylloc).first_line != (yylloc).last_line) - fprintf (stderr, "-%d.%d", - (yylloc).last_line, (yylloc).last_column - 1); - else if ((yylloc).first_column != (yylloc).last_column - 1) - fprintf (stderr, "-%d", - (yylloc).last_column - 1); - fprintf (stderr, ": "); - fprintf (stderr, "%s\n", s); -} - - - -static YYLTYPE last_yylloc; - -static int -yygetc (void) -{ - int res = getc (yyin); - ; - - last_yylloc = (yylloc); - if (res == '\n') - { - (yylloc).last_line++; - (yylloc).last_column = 0; - } - else - (yylloc).last_column++; - - return res; -} - - -static void -yyungetc ( int c) -{ - ; - - /* Wrong when C == `\n'. */ - (yylloc) = last_yylloc; - - ungetc (c, yyin); -} - -static int -read_signed_integer (void) -{ - int c = yygetc (); - int sign = 1; - int n = 0; - - ; - if (c == '-') - { - c = yygetc (); - sign = -1; - } - - while (isdigit (c)) - { - n = 10 * n + (c - '0'); - c = yygetc (); - } - - yyungetc ( c); - - return sign * n; -} - - - -/*---------------------------------------------------------------. -| Lexical analyzer returns an integer on the stack and the token | -| NUM, or the ASCII character read if not a number. Skips all | -| blanks and tabs, returns 0 for EOF. | -`---------------------------------------------------------------*/ - -static int -yylex (void) -{ - static int init = 1; - int c; - - if (init) - { - init = 0; - - (yylloc).last_column = 0; - (yylloc).last_line = 1; - - } - - (yylloc).first_column = (yylloc).last_column; - (yylloc).first_line = (yylloc).last_line; - - - /* Skip white space. */ - while ((c = yygetc ()) == ' ' || c == '\t') - { - (yylloc).first_column = (yylloc).last_column; - (yylloc).first_line = (yylloc).last_line; - - } - - /* process numbers */ - if (c == '.' || isdigit (c)) - { - yyungetc ( c); - (yylval).ival = read_signed_integer (); - return NUM; - } - - /* Return end-of-file. */ - if (c == EOF) - return CALC_EOF; - - /* Return single chars. */ - return c; -} - -static int -power (int base, int exponent) -{ - int res = 1; - if (exponent < 0) - exit (1); - for (/* Niente */; exponent; --exponent) - res *= base; - return res; -} - - -int -main (int argc, const char **argv) -{ - semantic_value result = 0; - int count = 0; - int status; - - alarm (10); - if (argc == 2) - yyin = fopen (argv[1], "r"); - else - yyin = stdin; - - if (!yyin) - { - perror (argv[1]); - exit (1); - } - - - status = yyparse (); - if (global_result != result) - abort (); - if (global_count != count) - abort (); - return status; -} -_ATEOF - - - - - -# Specify the output files to avoid problems on different file systems. -$at_traceoff -echo "calc.at:544: bison -o calc.c calc.y" -echo calc.at:544 >$at_check_line_file -( $at_traceon; bison -o calc.c calc.y ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:544: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - -$at_traceoff -echo "calc.at:544: \$CC \$CFLAGS \$CPPFLAGS \$LDFLAGS calc.c \$LIBS -o calc" -echo calc.at:544 >$at_check_line_file -( $at_traceon; $CC $CFLAGS $CPPFLAGS $LDFLAGS calc.c $LIBS -o calc ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo stderr:; cat $at_stderr -echo stdout:; cat $at_stdout -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:544: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - -# Test the priorities. -cat >input <<'_ATEOF' -1 + 2 * 3 = 7 -1 + 2 * -3 = -5 - --1^2 = -1 -(-1)^2 = 1 - ----1 = -1 - -1 - 2 - 3 = -4 -1 - (2 - 3) = 2 - -2^2^3 = 256 -(2^2)^3 = 64 -_ATEOF - -$at_traceoff -echo "calc.at:544: \$PREPARSER ./calc input" -echo calc.at:544 >$at_check_line_file -( $at_traceon; $PREPARSER ./calc input ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo stderr:; tee stderr <$at_stderr -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:544: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - - - -# Some syntax errors. -cat >input <<'_ATEOF' -0 0 -_ATEOF - -$at_traceoff -echo "calc.at:544: \$PREPARSER ./calc input" -echo calc.at:544 >$at_check_line_file -( $at_traceon; $PREPARSER ./calc input ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo stderr:; tee stderr <$at_stderr -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 1) ;; - *) echo "calc.at:544: exit code was $at_status, expected 1" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - - -# Normalize the observed and expected error messages, depending upon the -# options. -# 1. Remove the traces from observed. -sed '/^Starting/d -/^Entering/d -/^Stack/d -/^Reading/d -/^Reducing/d -/^Shifting/d -/^state/d -/^Error:/d -/^Next/d -/^Discarding/d -/^yydestructor:/d' stderr >at-stderr -mv at-stderr stderr -# 2. Create the reference error message. -cat >expout <<'_ATEOF' -1.2: syntax error, unexpected "number" -_ATEOF - -# 3. If locations are not used, remove them. - -# 4. If error-verbose is not used, strip the`, unexpected....' part. -sed 's/syntax error, .*$/syntax error/' expout >at-expout -mv at-expout expout -# 5. Check -$at_traceoff -echo "calc.at:544: cat stderr" -echo calc.at:544 >$at_check_line_file -( $at_traceon; cat stderr ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -$at_diff expout $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:544: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - -cat >input <<'_ATEOF' -1//2 -_ATEOF - -$at_traceoff -echo "calc.at:544: \$PREPARSER ./calc input" -echo calc.at:544 >$at_check_line_file -( $at_traceon; $PREPARSER ./calc input ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo stderr:; tee stderr <$at_stderr -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 1) ;; - *) echo "calc.at:544: exit code was $at_status, expected 1" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - - -# Normalize the observed and expected error messages, depending upon the -# options. -# 1. Remove the traces from observed. -sed '/^Starting/d -/^Entering/d -/^Stack/d -/^Reading/d -/^Reducing/d -/^Shifting/d -/^state/d -/^Error:/d -/^Next/d -/^Discarding/d -/^yydestructor:/d' stderr >at-stderr -mv at-stderr stderr -# 2. Create the reference error message. -cat >expout <<'_ATEOF' -1.2: syntax error, unexpected '/', expecting "number" or '-' or '(' or '!' -_ATEOF - -# 3. If locations are not used, remove them. - -# 4. If error-verbose is not used, strip the`, unexpected....' part. -sed 's/syntax error, .*$/syntax error/' expout >at-expout -mv at-expout expout -# 5. Check -$at_traceoff -echo "calc.at:544: cat stderr" -echo calc.at:544 >$at_check_line_file -( $at_traceon; cat stderr ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -$at_diff expout $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:544: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - -cat >input <<'_ATEOF' -error -_ATEOF - -$at_traceoff -echo "calc.at:544: \$PREPARSER ./calc input" -echo calc.at:544 >$at_check_line_file -( $at_traceon; $PREPARSER ./calc input ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo stderr:; tee stderr <$at_stderr -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 1) ;; - *) echo "calc.at:544: exit code was $at_status, expected 1" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - - -# Normalize the observed and expected error messages, depending upon the -# options. -# 1. Remove the traces from observed. -sed '/^Starting/d -/^Entering/d -/^Stack/d -/^Reading/d -/^Reducing/d -/^Shifting/d -/^state/d -/^Error:/d -/^Next/d -/^Discarding/d -/^yydestructor:/d' stderr >at-stderr -mv at-stderr stderr -# 2. Create the reference error message. -cat >expout <<'_ATEOF' -1.0: syntax error, unexpected $undefined -_ATEOF - -# 3. If locations are not used, remove them. - -# 4. If error-verbose is not used, strip the`, unexpected....' part. -sed 's/syntax error, .*$/syntax error/' expout >at-expout -mv at-expout expout -# 5. Check -$at_traceoff -echo "calc.at:544: cat stderr" -echo calc.at:544 >$at_check_line_file -( $at_traceon; cat stderr ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -$at_diff expout $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:544: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - -cat >input <<'_ATEOF' -1 = 2 = 3 -_ATEOF - -$at_traceoff -echo "calc.at:544: \$PREPARSER ./calc input" -echo calc.at:544 >$at_check_line_file -( $at_traceon; $PREPARSER ./calc input ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo stderr:; tee stderr <$at_stderr -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 1) ;; - *) echo "calc.at:544: exit code was $at_status, expected 1" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - - -# Normalize the observed and expected error messages, depending upon the -# options. -# 1. Remove the traces from observed. -sed '/^Starting/d -/^Entering/d -/^Stack/d -/^Reading/d -/^Reducing/d -/^Shifting/d -/^state/d -/^Error:/d -/^Next/d -/^Discarding/d -/^yydestructor:/d' stderr >at-stderr -mv at-stderr stderr -# 2. Create the reference error message. -cat >expout <<'_ATEOF' -1.6: syntax error, unexpected '=' -_ATEOF - -# 3. If locations are not used, remove them. - -# 4. If error-verbose is not used, strip the`, unexpected....' part. -sed 's/syntax error, .*$/syntax error/' expout >at-expout -mv at-expout expout -# 5. Check -$at_traceoff -echo "calc.at:544: cat stderr" -echo calc.at:544 >$at_check_line_file -( $at_traceon; cat stderr ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -$at_diff expout $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:544: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - -cat >input <<'_ATEOF' - -+1 -_ATEOF - -$at_traceoff -echo "calc.at:544: \$PREPARSER ./calc input" -echo calc.at:544 >$at_check_line_file -( $at_traceon; $PREPARSER ./calc input ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo stderr:; tee stderr <$at_stderr -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 1) ;; - *) echo "calc.at:544: exit code was $at_status, expected 1" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - - -# Normalize the observed and expected error messages, depending upon the -# options. -# 1. Remove the traces from observed. -sed '/^Starting/d -/^Entering/d -/^Stack/d -/^Reading/d -/^Reducing/d -/^Shifting/d -/^state/d -/^Error:/d -/^Next/d -/^Discarding/d -/^yydestructor:/d' stderr >at-stderr -mv at-stderr stderr -# 2. Create the reference error message. -cat >expout <<'_ATEOF' -2.0: syntax error, unexpected '+' -_ATEOF - -# 3. If locations are not used, remove them. - -# 4. If error-verbose is not used, strip the`, unexpected....' part. -sed 's/syntax error, .*$/syntax error/' expout >at-expout -mv at-expout expout -# 5. Check -$at_traceoff -echo "calc.at:544: cat stderr" -echo calc.at:544 >$at_check_line_file -( $at_traceon; cat stderr ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -$at_diff expout $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:544: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - -# Exercise error messages with EOF: work on an empty file. -$at_traceoff -echo "calc.at:544: \$PREPARSER ./calc /dev/null" -echo calc.at:544 >$at_check_line_file -( $at_traceon; $PREPARSER ./calc /dev/null ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo stderr:; tee stderr <$at_stderr -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 1) ;; - *) echo "calc.at:544: exit code was $at_status, expected 1" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - - -# Normalize the observed and expected error messages, depending upon the -# options. -# 1. Remove the traces from observed. -sed '/^Starting/d -/^Entering/d -/^Stack/d -/^Reading/d -/^Reducing/d -/^Shifting/d -/^state/d -/^Error:/d -/^Next/d -/^Discarding/d -/^yydestructor:/d' stderr >at-stderr -mv at-stderr stderr -# 2. Create the reference error message. -cat >expout <<'_ATEOF' -1.0: syntax error, unexpected "end of input" -_ATEOF - -# 3. If locations are not used, remove them. - -# 4. If error-verbose is not used, strip the`, unexpected....' part. -sed 's/syntax error, .*$/syntax error/' expout >at-expout -mv at-expout expout -# 5. Check -$at_traceoff -echo "calc.at:544: cat stderr" -echo calc.at:544 >$at_check_line_file -( $at_traceon; cat stderr ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -$at_diff expout $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:544: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - - -# Exercise the error token: without it, we die at the first error, -# hence be sure to -# -# - have several errors which exercise different shift/discardings -# - (): nothing to pop, nothing to discard -# - (1 + 1 + 1 +): a lot to pop, nothing to discard -# - (* * *): nothing to pop, a lot to discard -# - (1 + 2 * *): some to pop and discard -# -# - test the action associated to `error' -# -# - check the lookahead that triggers an error is not discarded -# when we enter error recovery. Below, the lookahead causing the -# first error is ")", which is needed to recover from the error and -# produce the "0" that triggers the "0 != 1" error. -# -cat >input <<'_ATEOF' -() + (1 + 1 + 1 +) + (* * *) + (1 * 2 * *) = 1 -_ATEOF - -$at_traceoff -echo "calc.at:544: \$PREPARSER ./calc input" -echo calc.at:544 >$at_check_line_file -( $at_traceon; $PREPARSER ./calc input ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo stderr:; tee stderr <$at_stderr -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:544: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - - -# Normalize the observed and expected error messages, depending upon the -# options. -# 1. Remove the traces from observed. -sed '/^Starting/d -/^Entering/d -/^Stack/d -/^Reading/d -/^Reducing/d -/^Shifting/d -/^state/d -/^Error:/d -/^Next/d -/^Discarding/d -/^yydestructor:/d' stderr >at-stderr -mv at-stderr stderr -# 2. Create the reference error message. -cat >expout <<'_ATEOF' -1.1: syntax error, unexpected ')', expecting "number" or '-' or '(' or '!' -1.17: syntax error, unexpected ')', expecting "number" or '-' or '(' or '!' -1.22: syntax error, unexpected '*', expecting "number" or '-' or '(' or '!' -1.40: syntax error, unexpected '*', expecting "number" or '-' or '(' or '!' -calc: error: 4444 != 1 -_ATEOF - -# 3. If locations are not used, remove them. - -# 4. If error-verbose is not used, strip the`, unexpected....' part. -sed 's/syntax error, .*$/syntax error/' expout >at-expout -mv at-expout expout -# 5. Check -$at_traceoff -echo "calc.at:544: cat stderr" -echo calc.at:544 >$at_check_line_file -( $at_traceon; cat stderr ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -$at_diff expout $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:544: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - - -# The same, but this time exercising explicitly triggered syntax errors. -# POSIX says the lookahead causing the error should not be discarded. -cat >input <<'_ATEOF' -(!) + (0 0) = 1 -_ATEOF - -$at_traceoff -echo "calc.at:544: \$PREPARSER ./calc input" -echo calc.at:544 >$at_check_line_file -( $at_traceon; $PREPARSER ./calc input ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo stderr:; tee stderr <$at_stderr -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:544: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - - -# Normalize the observed and expected error messages, depending upon the -# options. -# 1. Remove the traces from observed. -sed '/^Starting/d -/^Entering/d -/^Stack/d -/^Reading/d -/^Reducing/d -/^Shifting/d -/^state/d -/^Error:/d -/^Next/d -/^Discarding/d -/^yydestructor:/d' stderr >at-stderr -mv at-stderr stderr -# 2. Create the reference error message. -cat >expout <<'_ATEOF' -1.9: syntax error, unexpected "number" -calc: error: 2222 != 1 -_ATEOF - -# 3. If locations are not used, remove them. - -# 4. If error-verbose is not used, strip the`, unexpected....' part. -sed 's/syntax error, .*$/syntax error/' expout >at-expout -mv at-expout expout -# 5. Check -$at_traceoff -echo "calc.at:544: cat stderr" -echo calc.at:544 >$at_check_line_file -( $at_traceon; cat stderr ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -$at_diff expout $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:544: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - -cat >input <<'_ATEOF' -(- *) + (0 0) = 1 -_ATEOF - -$at_traceoff -echo "calc.at:544: \$PREPARSER ./calc input" -echo calc.at:544 >$at_check_line_file -( $at_traceon; $PREPARSER ./calc input ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo stderr:; tee stderr <$at_stderr -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:544: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - - -# Normalize the observed and expected error messages, depending upon the -# options. -# 1. Remove the traces from observed. -sed '/^Starting/d -/^Entering/d -/^Stack/d -/^Reading/d -/^Reducing/d -/^Shifting/d -/^state/d -/^Error:/d -/^Next/d -/^Discarding/d -/^yydestructor:/d' stderr >at-stderr -mv at-stderr stderr -# 2. Create the reference error message. -cat >expout <<'_ATEOF' -1.3: syntax error, unexpected '*', expecting "number" or '-' or '(' or '!' -1.11: syntax error, unexpected "number" -calc: error: 2222 != 1 -_ATEOF - -# 3. If locations are not used, remove them. - -# 4. If error-verbose is not used, strip the`, unexpected....' part. -sed 's/syntax error, .*$/syntax error/' expout >at-expout -mv at-expout expout -# 5. Check -$at_traceoff -echo "calc.at:544: cat stderr" -echo calc.at:544 >$at_check_line_file -( $at_traceon; cat stderr ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -$at_diff expout $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:544: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - - - - - - - - - - - - - - - - - - - - - $at_traceoff - $at_times_p && times >$at_times_file - ) 5>&1 2>&1 | eval $at_tee_pipe - at_status=`cat $at_status_file` - ;; - - 59 ) # 59. calc.at:545: Calculator %name-prefix="calc" - at_setup_line='calc.at:545' - at_desc='Calculator %name-prefix="calc"' - $at_quiet $ECHO_N " 59: Calculator %name-prefix="calc" $ECHO_C" - at_xfail=no - ( - echo "59. calc.at:545: testing ..." - $at_traceon - - - - - - -# Using yacc.c? - - - - - - - -# yyerror receives the location if %location & %pure & (%glr or %parse-param). - -# yyerror always sees the locations (when activated), except if -# yacc & pure & !param. - - -# The interface is pure: either because %pure-parser, or because we -# are using the C++ parsers. - - - - - - - - - - - - -cat >calc.y <<'_ATEOF' -%{ -#if HAVE_CONFIG_H -# include - /* We don't need perfect functions for these tests. */ -# undef malloc -# undef memcmp -# undef realloc -#endif -%} - -/* Infix notation calculator--calc */ -%name-prefix="calc" -%{ -#include - -#include -#include -#if HAVE_UNISTD_H -# include -#else -# undef alarm -# define alarm(seconds) /* empty */ -#endif -#include - -/* Exercise pre-prologue dependency to %union. */ -typedef int semantic_value; - -static semantic_value global_result = 0; -static int global_count = 0; -%} - -/* Exercise %union. */ -%union -{ - semantic_value ival; -}; - -%{ -static int power (int base, int exponent); -/* yyerror receives the location if: - - %location & %pure & %glr - - %location & %pure & %yacc & %parse-param. */ -static void yyerror ( - - const char *s - ); -static int yylex (void); -static int yygetc (void); -static void yyungetc ( int c); -%} - -/* Bison Declarations */ -%token CALC_EOF 0 "end of input" -%token NUM "number" -%type exp - -%nonassoc '=' /* comparison */ -%left '-' '+' -%left '*' '/' -%left NEG /* negation--unary minus */ -%right '^' /* exponentiation */ - -/* Grammar follows */ -%% -input: - line -| input line { } -; - -line: - '\n' -| exp '\n' { } -; - -exp: - NUM { $$ = $1; } -| exp '=' exp - { - if ($1 != $3) - fprintf (stderr, "calc: error: %d != %d\n", $1, $3); - $$ = $1; - } -| exp '+' exp { $$ = $1 + $3; } -| exp '-' exp { $$ = $1 - $3; } -| exp '*' exp { $$ = $1 * $3; } -| exp '/' exp { $$ = $1 / $3; } -| '-' exp %prec NEG { $$ = -$2; } -| exp '^' exp { $$ = power ($1, $3); } -| '(' exp ')' { $$ = $2; } -| '(' error ')' { $$ = 1111; } -| '!' { YYERROR; } -| '-' error { YYERROR; } -; -%% -/* The input. */ -static FILE *yyin; - -static void -yyerror ( - - const char *s) -{ - - - fprintf (stderr, "%s\n", s); -} - - - -static int -yygetc (void) -{ - int res = getc (yyin); - ; - - return res; -} - - -static void -yyungetc ( int c) -{ - ; - - ungetc (c, yyin); -} - -static int -read_signed_integer (void) -{ - int c = yygetc (); - int sign = 1; - int n = 0; - - ; - if (c == '-') - { - c = yygetc (); - sign = -1; - } - - while (isdigit (c)) - { - n = 10 * n + (c - '0'); - c = yygetc (); - } - - yyungetc ( c); - - return sign * n; -} - - - -/*---------------------------------------------------------------. -| Lexical analyzer returns an integer on the stack and the token | -| NUM, or the ASCII character read if not a number. Skips all | -| blanks and tabs, returns 0 for EOF. | -`---------------------------------------------------------------*/ - -static int -yylex (void) -{ - static int init = 1; - int c; - - if (init) - { - init = 0; - - } - - - - /* Skip white space. */ - while ((c = yygetc ()) == ' ' || c == '\t') - { - - } - - /* process numbers */ - if (c == '.' || isdigit (c)) - { - yyungetc ( c); - (yylval).ival = read_signed_integer (); - return NUM; - } - - /* Return end-of-file. */ - if (c == EOF) - return CALC_EOF; - - /* Return single chars. */ - return c; -} - -static int -power (int base, int exponent) -{ - int res = 1; - if (exponent < 0) - exit (1); - for (/* Niente */; exponent; --exponent) - res *= base; - return res; -} - - -int -main (int argc, const char **argv) -{ - semantic_value result = 0; - int count = 0; - int status; - - alarm (10); - if (argc == 2) - yyin = fopen (argv[1], "r"); - else - yyin = stdin; - - if (!yyin) - { - perror (argv[1]); - exit (1); - } - - - status = yyparse (); - if (global_result != result) - abort (); - if (global_count != count) - abort (); - return status; -} -_ATEOF - - - - - -# Specify the output files to avoid problems on different file systems. -$at_traceoff -echo "calc.at:545: bison -o calc.c calc.y" -echo calc.at:545 >$at_check_line_file -( $at_traceon; bison -o calc.c calc.y ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:545: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - -$at_traceoff -echo "calc.at:545: \$CC \$CFLAGS \$CPPFLAGS \$LDFLAGS calc.c \$LIBS -o calc" -echo calc.at:545 >$at_check_line_file -( $at_traceon; $CC $CFLAGS $CPPFLAGS $LDFLAGS calc.c $LIBS -o calc ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo stderr:; cat $at_stderr -echo stdout:; cat $at_stdout -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:545: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - -# Test the priorities. -cat >input <<'_ATEOF' -1 + 2 * 3 = 7 -1 + 2 * -3 = -5 - --1^2 = -1 -(-1)^2 = 1 - ----1 = -1 - -1 - 2 - 3 = -4 -1 - (2 - 3) = 2 - -2^2^3 = 256 -(2^2)^3 = 64 -_ATEOF - -$at_traceoff -echo "calc.at:545: \$PREPARSER ./calc input" -echo calc.at:545 >$at_check_line_file -( $at_traceon; $PREPARSER ./calc input ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo stderr:; tee stderr <$at_stderr -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:545: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - - - -# Some syntax errors. -cat >input <<'_ATEOF' -0 0 -_ATEOF - -$at_traceoff -echo "calc.at:545: \$PREPARSER ./calc input" -echo calc.at:545 >$at_check_line_file -( $at_traceon; $PREPARSER ./calc input ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo stderr:; tee stderr <$at_stderr -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 1) ;; - *) echo "calc.at:545: exit code was $at_status, expected 1" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - - -# Normalize the observed and expected error messages, depending upon the -# options. -# 1. Remove the traces from observed. -sed '/^Starting/d -/^Entering/d -/^Stack/d -/^Reading/d -/^Reducing/d -/^Shifting/d -/^state/d -/^Error:/d -/^Next/d -/^Discarding/d -/^yydestructor:/d' stderr >at-stderr -mv at-stderr stderr -# 2. Create the reference error message. -cat >expout <<'_ATEOF' -1.2: syntax error, unexpected "number" -_ATEOF - -# 3. If locations are not used, remove them. -sed 's/^[-0-9.]*: //' expout >at-expout -mv at-expout expout -# 4. If error-verbose is not used, strip the`, unexpected....' part. -sed 's/syntax error, .*$/syntax error/' expout >at-expout -mv at-expout expout -# 5. Check -$at_traceoff -echo "calc.at:545: cat stderr" -echo calc.at:545 >$at_check_line_file -( $at_traceon; cat stderr ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -$at_diff expout $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:545: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - -cat >input <<'_ATEOF' -1//2 -_ATEOF - -$at_traceoff -echo "calc.at:545: \$PREPARSER ./calc input" -echo calc.at:545 >$at_check_line_file -( $at_traceon; $PREPARSER ./calc input ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo stderr:; tee stderr <$at_stderr -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 1) ;; - *) echo "calc.at:545: exit code was $at_status, expected 1" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - - -# Normalize the observed and expected error messages, depending upon the -# options. -# 1. Remove the traces from observed. -sed '/^Starting/d -/^Entering/d -/^Stack/d -/^Reading/d -/^Reducing/d -/^Shifting/d -/^state/d -/^Error:/d -/^Next/d -/^Discarding/d -/^yydestructor:/d' stderr >at-stderr -mv at-stderr stderr -# 2. Create the reference error message. -cat >expout <<'_ATEOF' -1.2: syntax error, unexpected '/', expecting "number" or '-' or '(' or '!' -_ATEOF - -# 3. If locations are not used, remove them. -sed 's/^[-0-9.]*: //' expout >at-expout -mv at-expout expout -# 4. If error-verbose is not used, strip the`, unexpected....' part. -sed 's/syntax error, .*$/syntax error/' expout >at-expout -mv at-expout expout -# 5. Check -$at_traceoff -echo "calc.at:545: cat stderr" -echo calc.at:545 >$at_check_line_file -( $at_traceon; cat stderr ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -$at_diff expout $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:545: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - -cat >input <<'_ATEOF' -error -_ATEOF - -$at_traceoff -echo "calc.at:545: \$PREPARSER ./calc input" -echo calc.at:545 >$at_check_line_file -( $at_traceon; $PREPARSER ./calc input ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo stderr:; tee stderr <$at_stderr -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 1) ;; - *) echo "calc.at:545: exit code was $at_status, expected 1" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - - -# Normalize the observed and expected error messages, depending upon the -# options. -# 1. Remove the traces from observed. -sed '/^Starting/d -/^Entering/d -/^Stack/d -/^Reading/d -/^Reducing/d -/^Shifting/d -/^state/d -/^Error:/d -/^Next/d -/^Discarding/d -/^yydestructor:/d' stderr >at-stderr -mv at-stderr stderr -# 2. Create the reference error message. -cat >expout <<'_ATEOF' -1.0: syntax error, unexpected $undefined -_ATEOF - -# 3. If locations are not used, remove them. -sed 's/^[-0-9.]*: //' expout >at-expout -mv at-expout expout -# 4. If error-verbose is not used, strip the`, unexpected....' part. -sed 's/syntax error, .*$/syntax error/' expout >at-expout -mv at-expout expout -# 5. Check -$at_traceoff -echo "calc.at:545: cat stderr" -echo calc.at:545 >$at_check_line_file -( $at_traceon; cat stderr ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -$at_diff expout $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:545: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - -cat >input <<'_ATEOF' -1 = 2 = 3 -_ATEOF - -$at_traceoff -echo "calc.at:545: \$PREPARSER ./calc input" -echo calc.at:545 >$at_check_line_file -( $at_traceon; $PREPARSER ./calc input ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo stderr:; tee stderr <$at_stderr -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 1) ;; - *) echo "calc.at:545: exit code was $at_status, expected 1" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - - -# Normalize the observed and expected error messages, depending upon the -# options. -# 1. Remove the traces from observed. -sed '/^Starting/d -/^Entering/d -/^Stack/d -/^Reading/d -/^Reducing/d -/^Shifting/d -/^state/d -/^Error:/d -/^Next/d -/^Discarding/d -/^yydestructor:/d' stderr >at-stderr -mv at-stderr stderr -# 2. Create the reference error message. -cat >expout <<'_ATEOF' -1.6: syntax error, unexpected '=' -_ATEOF - -# 3. If locations are not used, remove them. -sed 's/^[-0-9.]*: //' expout >at-expout -mv at-expout expout -# 4. If error-verbose is not used, strip the`, unexpected....' part. -sed 's/syntax error, .*$/syntax error/' expout >at-expout -mv at-expout expout -# 5. Check -$at_traceoff -echo "calc.at:545: cat stderr" -echo calc.at:545 >$at_check_line_file -( $at_traceon; cat stderr ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -$at_diff expout $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:545: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - -cat >input <<'_ATEOF' - -+1 -_ATEOF - -$at_traceoff -echo "calc.at:545: \$PREPARSER ./calc input" -echo calc.at:545 >$at_check_line_file -( $at_traceon; $PREPARSER ./calc input ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo stderr:; tee stderr <$at_stderr -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 1) ;; - *) echo "calc.at:545: exit code was $at_status, expected 1" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - - -# Normalize the observed and expected error messages, depending upon the -# options. -# 1. Remove the traces from observed. -sed '/^Starting/d -/^Entering/d -/^Stack/d -/^Reading/d -/^Reducing/d -/^Shifting/d -/^state/d -/^Error:/d -/^Next/d -/^Discarding/d -/^yydestructor:/d' stderr >at-stderr -mv at-stderr stderr -# 2. Create the reference error message. -cat >expout <<'_ATEOF' -2.0: syntax error, unexpected '+' -_ATEOF - -# 3. If locations are not used, remove them. -sed 's/^[-0-9.]*: //' expout >at-expout -mv at-expout expout -# 4. If error-verbose is not used, strip the`, unexpected....' part. -sed 's/syntax error, .*$/syntax error/' expout >at-expout -mv at-expout expout -# 5. Check -$at_traceoff -echo "calc.at:545: cat stderr" -echo calc.at:545 >$at_check_line_file -( $at_traceon; cat stderr ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -$at_diff expout $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:545: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - -# Exercise error messages with EOF: work on an empty file. -$at_traceoff -echo "calc.at:545: \$PREPARSER ./calc /dev/null" -echo calc.at:545 >$at_check_line_file -( $at_traceon; $PREPARSER ./calc /dev/null ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo stderr:; tee stderr <$at_stderr -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 1) ;; - *) echo "calc.at:545: exit code was $at_status, expected 1" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - - -# Normalize the observed and expected error messages, depending upon the -# options. -# 1. Remove the traces from observed. -sed '/^Starting/d -/^Entering/d -/^Stack/d -/^Reading/d -/^Reducing/d -/^Shifting/d -/^state/d -/^Error:/d -/^Next/d -/^Discarding/d -/^yydestructor:/d' stderr >at-stderr -mv at-stderr stderr -# 2. Create the reference error message. -cat >expout <<'_ATEOF' -1.0: syntax error, unexpected "end of input" -_ATEOF - -# 3. If locations are not used, remove them. -sed 's/^[-0-9.]*: //' expout >at-expout -mv at-expout expout -# 4. If error-verbose is not used, strip the`, unexpected....' part. -sed 's/syntax error, .*$/syntax error/' expout >at-expout -mv at-expout expout -# 5. Check -$at_traceoff -echo "calc.at:545: cat stderr" -echo calc.at:545 >$at_check_line_file -( $at_traceon; cat stderr ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -$at_diff expout $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:545: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - - -# Exercise the error token: without it, we die at the first error, -# hence be sure to -# -# - have several errors which exercise different shift/discardings -# - (): nothing to pop, nothing to discard -# - (1 + 1 + 1 +): a lot to pop, nothing to discard -# - (* * *): nothing to pop, a lot to discard -# - (1 + 2 * *): some to pop and discard -# -# - test the action associated to `error' -# -# - check the lookahead that triggers an error is not discarded -# when we enter error recovery. Below, the lookahead causing the -# first error is ")", which is needed to recover from the error and -# produce the "0" that triggers the "0 != 1" error. -# -cat >input <<'_ATEOF' -() + (1 + 1 + 1 +) + (* * *) + (1 * 2 * *) = 1 -_ATEOF - -$at_traceoff -echo "calc.at:545: \$PREPARSER ./calc input" -echo calc.at:545 >$at_check_line_file -( $at_traceon; $PREPARSER ./calc input ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo stderr:; tee stderr <$at_stderr -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:545: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - - -# Normalize the observed and expected error messages, depending upon the -# options. -# 1. Remove the traces from observed. -sed '/^Starting/d -/^Entering/d -/^Stack/d -/^Reading/d -/^Reducing/d -/^Shifting/d -/^state/d -/^Error:/d -/^Next/d -/^Discarding/d -/^yydestructor:/d' stderr >at-stderr -mv at-stderr stderr -# 2. Create the reference error message. -cat >expout <<'_ATEOF' -1.1: syntax error, unexpected ')', expecting "number" or '-' or '(' or '!' -1.17: syntax error, unexpected ')', expecting "number" or '-' or '(' or '!' -1.22: syntax error, unexpected '*', expecting "number" or '-' or '(' or '!' -1.40: syntax error, unexpected '*', expecting "number" or '-' or '(' or '!' -calc: error: 4444 != 1 -_ATEOF - -# 3. If locations are not used, remove them. -sed 's/^[-0-9.]*: //' expout >at-expout -mv at-expout expout -# 4. If error-verbose is not used, strip the`, unexpected....' part. -sed 's/syntax error, .*$/syntax error/' expout >at-expout -mv at-expout expout -# 5. Check -$at_traceoff -echo "calc.at:545: cat stderr" -echo calc.at:545 >$at_check_line_file -( $at_traceon; cat stderr ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -$at_diff expout $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:545: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - - -# The same, but this time exercising explicitly triggered syntax errors. -# POSIX says the lookahead causing the error should not be discarded. -cat >input <<'_ATEOF' -(!) + (0 0) = 1 -_ATEOF - -$at_traceoff -echo "calc.at:545: \$PREPARSER ./calc input" -echo calc.at:545 >$at_check_line_file -( $at_traceon; $PREPARSER ./calc input ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo stderr:; tee stderr <$at_stderr -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:545: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - - -# Normalize the observed and expected error messages, depending upon the -# options. -# 1. Remove the traces from observed. -sed '/^Starting/d -/^Entering/d -/^Stack/d -/^Reading/d -/^Reducing/d -/^Shifting/d -/^state/d -/^Error:/d -/^Next/d -/^Discarding/d -/^yydestructor:/d' stderr >at-stderr -mv at-stderr stderr -# 2. Create the reference error message. -cat >expout <<'_ATEOF' -1.9: syntax error, unexpected "number" -calc: error: 2222 != 1 -_ATEOF - -# 3. If locations are not used, remove them. -sed 's/^[-0-9.]*: //' expout >at-expout -mv at-expout expout -# 4. If error-verbose is not used, strip the`, unexpected....' part. -sed 's/syntax error, .*$/syntax error/' expout >at-expout -mv at-expout expout -# 5. Check -$at_traceoff -echo "calc.at:545: cat stderr" -echo calc.at:545 >$at_check_line_file -( $at_traceon; cat stderr ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -$at_diff expout $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:545: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - -cat >input <<'_ATEOF' -(- *) + (0 0) = 1 -_ATEOF - -$at_traceoff -echo "calc.at:545: \$PREPARSER ./calc input" -echo calc.at:545 >$at_check_line_file -( $at_traceon; $PREPARSER ./calc input ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo stderr:; tee stderr <$at_stderr -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:545: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - - -# Normalize the observed and expected error messages, depending upon the -# options. -# 1. Remove the traces from observed. -sed '/^Starting/d -/^Entering/d -/^Stack/d -/^Reading/d -/^Reducing/d -/^Shifting/d -/^state/d -/^Error:/d -/^Next/d -/^Discarding/d -/^yydestructor:/d' stderr >at-stderr -mv at-stderr stderr -# 2. Create the reference error message. -cat >expout <<'_ATEOF' -1.3: syntax error, unexpected '*', expecting "number" or '-' or '(' or '!' -1.11: syntax error, unexpected "number" -calc: error: 2222 != 1 -_ATEOF - -# 3. If locations are not used, remove them. -sed 's/^[-0-9.]*: //' expout >at-expout -mv at-expout expout -# 4. If error-verbose is not used, strip the`, unexpected....' part. -sed 's/syntax error, .*$/syntax error/' expout >at-expout -mv at-expout expout -# 5. Check -$at_traceoff -echo "calc.at:545: cat stderr" -echo calc.at:545 >$at_check_line_file -( $at_traceon; cat stderr ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -$at_diff expout $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:545: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - - - - - - - - - - - - - - - - - - - - - $at_traceoff - $at_times_p && times >$at_times_file - ) 5>&1 2>&1 | eval $at_tee_pipe - at_status=`cat $at_status_file` - ;; - - 60 ) # 60. calc.at:546: Calculator %verbose - at_setup_line='calc.at:546' - at_desc='Calculator %verbose' - $at_quiet $ECHO_N " 60: Calculator %verbose $ECHO_C" - at_xfail=no - ( - echo "60. calc.at:546: testing ..." - $at_traceon - - - - - - -# Using yacc.c? - - - - - - - -# yyerror receives the location if %location & %pure & (%glr or %parse-param). - -# yyerror always sees the locations (when activated), except if -# yacc & pure & !param. - - -# The interface is pure: either because %pure-parser, or because we -# are using the C++ parsers. - - - - - - - - - - - - -cat >calc.y <<'_ATEOF' -%{ -#if HAVE_CONFIG_H -# include - /* We don't need perfect functions for these tests. */ -# undef malloc -# undef memcmp -# undef realloc -#endif -%} - -/* Infix notation calculator--calc */ -%verbose -%{ -#include - -#include -#include -#if HAVE_UNISTD_H -# include -#else -# undef alarm -# define alarm(seconds) /* empty */ -#endif -#include - -/* Exercise pre-prologue dependency to %union. */ -typedef int semantic_value; - -static semantic_value global_result = 0; -static int global_count = 0; -%} - -/* Exercise %union. */ -%union -{ - semantic_value ival; -}; - -%{ -static int power (int base, int exponent); -/* yyerror receives the location if: - - %location & %pure & %glr - - %location & %pure & %yacc & %parse-param. */ -static void yyerror ( - - const char *s - ); -static int yylex (void); -static int yygetc (void); -static void yyungetc ( int c); -%} - -/* Bison Declarations */ -%token CALC_EOF 0 "end of input" -%token NUM "number" -%type exp - -%nonassoc '=' /* comparison */ -%left '-' '+' -%left '*' '/' -%left NEG /* negation--unary minus */ -%right '^' /* exponentiation */ - -/* Grammar follows */ -%% -input: - line -| input line { } -; - -line: - '\n' -| exp '\n' { } -; - -exp: - NUM { $$ = $1; } -| exp '=' exp - { - if ($1 != $3) - fprintf (stderr, "calc: error: %d != %d\n", $1, $3); - $$ = $1; - } -| exp '+' exp { $$ = $1 + $3; } -| exp '-' exp { $$ = $1 - $3; } -| exp '*' exp { $$ = $1 * $3; } -| exp '/' exp { $$ = $1 / $3; } -| '-' exp %prec NEG { $$ = -$2; } -| exp '^' exp { $$ = power ($1, $3); } -| '(' exp ')' { $$ = $2; } -| '(' error ')' { $$ = 1111; } -| '!' { YYERROR; } -| '-' error { YYERROR; } -; -%% -/* The input. */ -static FILE *yyin; - -static void -yyerror ( - - const char *s) -{ - - - fprintf (stderr, "%s\n", s); -} - - - -static int -yygetc (void) -{ - int res = getc (yyin); - ; - - return res; -} - - -static void -yyungetc ( int c) -{ - ; - - ungetc (c, yyin); -} - -static int -read_signed_integer (void) -{ - int c = yygetc (); - int sign = 1; - int n = 0; - - ; - if (c == '-') - { - c = yygetc (); - sign = -1; - } - - while (isdigit (c)) - { - n = 10 * n + (c - '0'); - c = yygetc (); - } - - yyungetc ( c); - - return sign * n; -} - - - -/*---------------------------------------------------------------. -| Lexical analyzer returns an integer on the stack and the token | -| NUM, or the ASCII character read if not a number. Skips all | -| blanks and tabs, returns 0 for EOF. | -`---------------------------------------------------------------*/ - -static int -yylex (void) -{ - static int init = 1; - int c; - - if (init) - { - init = 0; - - } - - - - /* Skip white space. */ - while ((c = yygetc ()) == ' ' || c == '\t') - { - - } - - /* process numbers */ - if (c == '.' || isdigit (c)) - { - yyungetc ( c); - (yylval).ival = read_signed_integer (); - return NUM; - } - - /* Return end-of-file. */ - if (c == EOF) - return CALC_EOF; - - /* Return single chars. */ - return c; -} - -static int -power (int base, int exponent) -{ - int res = 1; - if (exponent < 0) - exit (1); - for (/* Niente */; exponent; --exponent) - res *= base; - return res; -} - - -int -main (int argc, const char **argv) -{ - semantic_value result = 0; - int count = 0; - int status; - - alarm (10); - if (argc == 2) - yyin = fopen (argv[1], "r"); - else - yyin = stdin; - - if (!yyin) - { - perror (argv[1]); - exit (1); - } - - - status = yyparse (); - if (global_result != result) - abort (); - if (global_count != count) - abort (); - return status; -} -_ATEOF - - - - - -# Specify the output files to avoid problems on different file systems. -$at_traceoff -echo "calc.at:546: bison -o calc.c calc.y" -echo calc.at:546 >$at_check_line_file -( $at_traceon; bison -o calc.c calc.y ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:546: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - -$at_traceoff -echo "calc.at:546: \$CC \$CFLAGS \$CPPFLAGS \$LDFLAGS calc.c \$LIBS -o calc" -echo calc.at:546 >$at_check_line_file -( $at_traceon; $CC $CFLAGS $CPPFLAGS $LDFLAGS calc.c $LIBS -o calc ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo stderr:; cat $at_stderr -echo stdout:; cat $at_stdout -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:546: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - -# Test the priorities. -cat >input <<'_ATEOF' -1 + 2 * 3 = 7 -1 + 2 * -3 = -5 - --1^2 = -1 -(-1)^2 = 1 - ----1 = -1 - -1 - 2 - 3 = -4 -1 - (2 - 3) = 2 - -2^2^3 = 256 -(2^2)^3 = 64 -_ATEOF - -$at_traceoff -echo "calc.at:546: \$PREPARSER ./calc input" -echo calc.at:546 >$at_check_line_file -( $at_traceon; $PREPARSER ./calc input ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo stderr:; tee stderr <$at_stderr -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:546: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - - - -# Some syntax errors. -cat >input <<'_ATEOF' -0 0 -_ATEOF - -$at_traceoff -echo "calc.at:546: \$PREPARSER ./calc input" -echo calc.at:546 >$at_check_line_file -( $at_traceon; $PREPARSER ./calc input ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo stderr:; tee stderr <$at_stderr -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 1) ;; - *) echo "calc.at:546: exit code was $at_status, expected 1" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - - -# Normalize the observed and expected error messages, depending upon the -# options. -# 1. Remove the traces from observed. -sed '/^Starting/d -/^Entering/d -/^Stack/d -/^Reading/d -/^Reducing/d -/^Shifting/d -/^state/d -/^Error:/d -/^Next/d -/^Discarding/d -/^yydestructor:/d' stderr >at-stderr -mv at-stderr stderr -# 2. Create the reference error message. -cat >expout <<'_ATEOF' -1.2: syntax error, unexpected "number" -_ATEOF - -# 3. If locations are not used, remove them. -sed 's/^[-0-9.]*: //' expout >at-expout -mv at-expout expout -# 4. If error-verbose is not used, strip the`, unexpected....' part. -sed 's/syntax error, .*$/syntax error/' expout >at-expout -mv at-expout expout -# 5. Check -$at_traceoff -echo "calc.at:546: cat stderr" -echo calc.at:546 >$at_check_line_file -( $at_traceon; cat stderr ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -$at_diff expout $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:546: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - -cat >input <<'_ATEOF' -1//2 -_ATEOF - -$at_traceoff -echo "calc.at:546: \$PREPARSER ./calc input" -echo calc.at:546 >$at_check_line_file -( $at_traceon; $PREPARSER ./calc input ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo stderr:; tee stderr <$at_stderr -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 1) ;; - *) echo "calc.at:546: exit code was $at_status, expected 1" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - - -# Normalize the observed and expected error messages, depending upon the -# options. -# 1. Remove the traces from observed. -sed '/^Starting/d -/^Entering/d -/^Stack/d -/^Reading/d -/^Reducing/d -/^Shifting/d -/^state/d -/^Error:/d -/^Next/d -/^Discarding/d -/^yydestructor:/d' stderr >at-stderr -mv at-stderr stderr -# 2. Create the reference error message. -cat >expout <<'_ATEOF' -1.2: syntax error, unexpected '/', expecting "number" or '-' or '(' or '!' -_ATEOF - -# 3. If locations are not used, remove them. -sed 's/^[-0-9.]*: //' expout >at-expout -mv at-expout expout -# 4. If error-verbose is not used, strip the`, unexpected....' part. -sed 's/syntax error, .*$/syntax error/' expout >at-expout -mv at-expout expout -# 5. Check -$at_traceoff -echo "calc.at:546: cat stderr" -echo calc.at:546 >$at_check_line_file -( $at_traceon; cat stderr ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -$at_diff expout $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:546: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - -cat >input <<'_ATEOF' -error -_ATEOF - -$at_traceoff -echo "calc.at:546: \$PREPARSER ./calc input" -echo calc.at:546 >$at_check_line_file -( $at_traceon; $PREPARSER ./calc input ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo stderr:; tee stderr <$at_stderr -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 1) ;; - *) echo "calc.at:546: exit code was $at_status, expected 1" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - - -# Normalize the observed and expected error messages, depending upon the -# options. -# 1. Remove the traces from observed. -sed '/^Starting/d -/^Entering/d -/^Stack/d -/^Reading/d -/^Reducing/d -/^Shifting/d -/^state/d -/^Error:/d -/^Next/d -/^Discarding/d -/^yydestructor:/d' stderr >at-stderr -mv at-stderr stderr -# 2. Create the reference error message. -cat >expout <<'_ATEOF' -1.0: syntax error, unexpected $undefined -_ATEOF - -# 3. If locations are not used, remove them. -sed 's/^[-0-9.]*: //' expout >at-expout -mv at-expout expout -# 4. If error-verbose is not used, strip the`, unexpected....' part. -sed 's/syntax error, .*$/syntax error/' expout >at-expout -mv at-expout expout -# 5. Check -$at_traceoff -echo "calc.at:546: cat stderr" -echo calc.at:546 >$at_check_line_file -( $at_traceon; cat stderr ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -$at_diff expout $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:546: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - -cat >input <<'_ATEOF' -1 = 2 = 3 -_ATEOF - -$at_traceoff -echo "calc.at:546: \$PREPARSER ./calc input" -echo calc.at:546 >$at_check_line_file -( $at_traceon; $PREPARSER ./calc input ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo stderr:; tee stderr <$at_stderr -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 1) ;; - *) echo "calc.at:546: exit code was $at_status, expected 1" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - - -# Normalize the observed and expected error messages, depending upon the -# options. -# 1. Remove the traces from observed. -sed '/^Starting/d -/^Entering/d -/^Stack/d -/^Reading/d -/^Reducing/d -/^Shifting/d -/^state/d -/^Error:/d -/^Next/d -/^Discarding/d -/^yydestructor:/d' stderr >at-stderr -mv at-stderr stderr -# 2. Create the reference error message. -cat >expout <<'_ATEOF' -1.6: syntax error, unexpected '=' -_ATEOF - -# 3. If locations are not used, remove them. -sed 's/^[-0-9.]*: //' expout >at-expout -mv at-expout expout -# 4. If error-verbose is not used, strip the`, unexpected....' part. -sed 's/syntax error, .*$/syntax error/' expout >at-expout -mv at-expout expout -# 5. Check -$at_traceoff -echo "calc.at:546: cat stderr" -echo calc.at:546 >$at_check_line_file -( $at_traceon; cat stderr ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -$at_diff expout $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:546: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - -cat >input <<'_ATEOF' - -+1 -_ATEOF - -$at_traceoff -echo "calc.at:546: \$PREPARSER ./calc input" -echo calc.at:546 >$at_check_line_file -( $at_traceon; $PREPARSER ./calc input ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo stderr:; tee stderr <$at_stderr -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 1) ;; - *) echo "calc.at:546: exit code was $at_status, expected 1" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - - -# Normalize the observed and expected error messages, depending upon the -# options. -# 1. Remove the traces from observed. -sed '/^Starting/d -/^Entering/d -/^Stack/d -/^Reading/d -/^Reducing/d -/^Shifting/d -/^state/d -/^Error:/d -/^Next/d -/^Discarding/d -/^yydestructor:/d' stderr >at-stderr -mv at-stderr stderr -# 2. Create the reference error message. -cat >expout <<'_ATEOF' -2.0: syntax error, unexpected '+' -_ATEOF - -# 3. If locations are not used, remove them. -sed 's/^[-0-9.]*: //' expout >at-expout -mv at-expout expout -# 4. If error-verbose is not used, strip the`, unexpected....' part. -sed 's/syntax error, .*$/syntax error/' expout >at-expout -mv at-expout expout -# 5. Check -$at_traceoff -echo "calc.at:546: cat stderr" -echo calc.at:546 >$at_check_line_file -( $at_traceon; cat stderr ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -$at_diff expout $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:546: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - -# Exercise error messages with EOF: work on an empty file. -$at_traceoff -echo "calc.at:546: \$PREPARSER ./calc /dev/null" -echo calc.at:546 >$at_check_line_file -( $at_traceon; $PREPARSER ./calc /dev/null ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo stderr:; tee stderr <$at_stderr -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 1) ;; - *) echo "calc.at:546: exit code was $at_status, expected 1" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - - -# Normalize the observed and expected error messages, depending upon the -# options. -# 1. Remove the traces from observed. -sed '/^Starting/d -/^Entering/d -/^Stack/d -/^Reading/d -/^Reducing/d -/^Shifting/d -/^state/d -/^Error:/d -/^Next/d -/^Discarding/d -/^yydestructor:/d' stderr >at-stderr -mv at-stderr stderr -# 2. Create the reference error message. -cat >expout <<'_ATEOF' -1.0: syntax error, unexpected "end of input" -_ATEOF - -# 3. If locations are not used, remove them. -sed 's/^[-0-9.]*: //' expout >at-expout -mv at-expout expout -# 4. If error-verbose is not used, strip the`, unexpected....' part. -sed 's/syntax error, .*$/syntax error/' expout >at-expout -mv at-expout expout -# 5. Check -$at_traceoff -echo "calc.at:546: cat stderr" -echo calc.at:546 >$at_check_line_file -( $at_traceon; cat stderr ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -$at_diff expout $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:546: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - - -# Exercise the error token: without it, we die at the first error, -# hence be sure to -# -# - have several errors which exercise different shift/discardings -# - (): nothing to pop, nothing to discard -# - (1 + 1 + 1 +): a lot to pop, nothing to discard -# - (* * *): nothing to pop, a lot to discard -# - (1 + 2 * *): some to pop and discard -# -# - test the action associated to `error' -# -# - check the lookahead that triggers an error is not discarded -# when we enter error recovery. Below, the lookahead causing the -# first error is ")", which is needed to recover from the error and -# produce the "0" that triggers the "0 != 1" error. -# -cat >input <<'_ATEOF' -() + (1 + 1 + 1 +) + (* * *) + (1 * 2 * *) = 1 -_ATEOF - -$at_traceoff -echo "calc.at:546: \$PREPARSER ./calc input" -echo calc.at:546 >$at_check_line_file -( $at_traceon; $PREPARSER ./calc input ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo stderr:; tee stderr <$at_stderr -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:546: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - - -# Normalize the observed and expected error messages, depending upon the -# options. -# 1. Remove the traces from observed. -sed '/^Starting/d -/^Entering/d -/^Stack/d -/^Reading/d -/^Reducing/d -/^Shifting/d -/^state/d -/^Error:/d -/^Next/d -/^Discarding/d -/^yydestructor:/d' stderr >at-stderr -mv at-stderr stderr -# 2. Create the reference error message. -cat >expout <<'_ATEOF' -1.1: syntax error, unexpected ')', expecting "number" or '-' or '(' or '!' -1.17: syntax error, unexpected ')', expecting "number" or '-' or '(' or '!' -1.22: syntax error, unexpected '*', expecting "number" or '-' or '(' or '!' -1.40: syntax error, unexpected '*', expecting "number" or '-' or '(' or '!' -calc: error: 4444 != 1 -_ATEOF - -# 3. If locations are not used, remove them. -sed 's/^[-0-9.]*: //' expout >at-expout -mv at-expout expout -# 4. If error-verbose is not used, strip the`, unexpected....' part. -sed 's/syntax error, .*$/syntax error/' expout >at-expout -mv at-expout expout -# 5. Check -$at_traceoff -echo "calc.at:546: cat stderr" -echo calc.at:546 >$at_check_line_file -( $at_traceon; cat stderr ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -$at_diff expout $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:546: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - - -# The same, but this time exercising explicitly triggered syntax errors. -# POSIX says the lookahead causing the error should not be discarded. -cat >input <<'_ATEOF' -(!) + (0 0) = 1 -_ATEOF - -$at_traceoff -echo "calc.at:546: \$PREPARSER ./calc input" -echo calc.at:546 >$at_check_line_file -( $at_traceon; $PREPARSER ./calc input ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo stderr:; tee stderr <$at_stderr -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:546: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - - -# Normalize the observed and expected error messages, depending upon the -# options. -# 1. Remove the traces from observed. -sed '/^Starting/d -/^Entering/d -/^Stack/d -/^Reading/d -/^Reducing/d -/^Shifting/d -/^state/d -/^Error:/d -/^Next/d -/^Discarding/d -/^yydestructor:/d' stderr >at-stderr -mv at-stderr stderr -# 2. Create the reference error message. -cat >expout <<'_ATEOF' -1.9: syntax error, unexpected "number" -calc: error: 2222 != 1 -_ATEOF - -# 3. If locations are not used, remove them. -sed 's/^[-0-9.]*: //' expout >at-expout -mv at-expout expout -# 4. If error-verbose is not used, strip the`, unexpected....' part. -sed 's/syntax error, .*$/syntax error/' expout >at-expout -mv at-expout expout -# 5. Check -$at_traceoff -echo "calc.at:546: cat stderr" -echo calc.at:546 >$at_check_line_file -( $at_traceon; cat stderr ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -$at_diff expout $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:546: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - -cat >input <<'_ATEOF' -(- *) + (0 0) = 1 -_ATEOF - -$at_traceoff -echo "calc.at:546: \$PREPARSER ./calc input" -echo calc.at:546 >$at_check_line_file -( $at_traceon; $PREPARSER ./calc input ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo stderr:; tee stderr <$at_stderr -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:546: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - - -# Normalize the observed and expected error messages, depending upon the -# options. -# 1. Remove the traces from observed. -sed '/^Starting/d -/^Entering/d -/^Stack/d -/^Reading/d -/^Reducing/d -/^Shifting/d -/^state/d -/^Error:/d -/^Next/d -/^Discarding/d -/^yydestructor:/d' stderr >at-stderr -mv at-stderr stderr -# 2. Create the reference error message. -cat >expout <<'_ATEOF' -1.3: syntax error, unexpected '*', expecting "number" or '-' or '(' or '!' -1.11: syntax error, unexpected "number" -calc: error: 2222 != 1 -_ATEOF - -# 3. If locations are not used, remove them. -sed 's/^[-0-9.]*: //' expout >at-expout -mv at-expout expout -# 4. If error-verbose is not used, strip the`, unexpected....' part. -sed 's/syntax error, .*$/syntax error/' expout >at-expout -mv at-expout expout -# 5. Check -$at_traceoff -echo "calc.at:546: cat stderr" -echo calc.at:546 >$at_check_line_file -( $at_traceon; cat stderr ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -$at_diff expout $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:546: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - - - - - - - - - - - - - - - - - - - - - $at_traceoff - $at_times_p && times >$at_times_file - ) 5>&1 2>&1 | eval $at_tee_pipe - at_status=`cat $at_status_file` - ;; - - 61 ) # 61. calc.at:547: Calculator %yacc - at_setup_line='calc.at:547' - at_desc='Calculator %yacc' - $at_quiet $ECHO_N " 61: Calculator %yacc $ECHO_C" - at_xfail=no - ( - echo "61. calc.at:547: testing ..." - $at_traceon - - - - - - -# Using yacc.c? - - - - - - - -# yyerror receives the location if %location & %pure & (%glr or %parse-param). - -# yyerror always sees the locations (when activated), except if -# yacc & pure & !param. - - -# The interface is pure: either because %pure-parser, or because we -# are using the C++ parsers. - - - - - - - - - - - - -cat >calc.y <<'_ATEOF' -%{ -#if HAVE_CONFIG_H -# include - /* We don't need perfect functions for these tests. */ -# undef malloc -# undef memcmp -# undef realloc -#endif -%} - -/* Infix notation calculator--calc */ -%yacc -%{ -#include - -#include -#include -#if HAVE_UNISTD_H -# include -#else -# undef alarm -# define alarm(seconds) /* empty */ -#endif -#include - -/* Exercise pre-prologue dependency to %union. */ -typedef int semantic_value; - -static semantic_value global_result = 0; -static int global_count = 0; -%} - -/* Exercise %union. */ -%union -{ - semantic_value ival; -}; - -%{ -static int power (int base, int exponent); -/* yyerror receives the location if: - - %location & %pure & %glr - - %location & %pure & %yacc & %parse-param. */ -static void yyerror ( - - const char *s - ); -static int yylex (void); -static int yygetc (void); -static void yyungetc ( int c); -%} - -/* Bison Declarations */ -%token CALC_EOF 0 "end of input" -%token NUM "number" -%type exp - -%nonassoc '=' /* comparison */ -%left '-' '+' -%left '*' '/' -%left NEG /* negation--unary minus */ -%right '^' /* exponentiation */ - -/* Grammar follows */ -%% -input: - line -| input line { } -; - -line: - '\n' -| exp '\n' { } -; - -exp: - NUM { $$ = $1; } -| exp '=' exp - { - if ($1 != $3) - fprintf (stderr, "calc: error: %d != %d\n", $1, $3); - $$ = $1; - } -| exp '+' exp { $$ = $1 + $3; } -| exp '-' exp { $$ = $1 - $3; } -| exp '*' exp { $$ = $1 * $3; } -| exp '/' exp { $$ = $1 / $3; } -| '-' exp %prec NEG { $$ = -$2; } -| exp '^' exp { $$ = power ($1, $3); } -| '(' exp ')' { $$ = $2; } -| '(' error ')' { $$ = 1111; } -| '!' { YYERROR; } -| '-' error { YYERROR; } -; -%% -/* The input. */ -static FILE *yyin; - -static void -yyerror ( - - const char *s) -{ - - - fprintf (stderr, "%s\n", s); -} - - - -static int -yygetc (void) -{ - int res = getc (yyin); - ; - - return res; -} - - -static void -yyungetc ( int c) -{ - ; - - ungetc (c, yyin); -} - -static int -read_signed_integer (void) -{ - int c = yygetc (); - int sign = 1; - int n = 0; - - ; - if (c == '-') - { - c = yygetc (); - sign = -1; - } - - while (isdigit (c)) - { - n = 10 * n + (c - '0'); - c = yygetc (); - } - - yyungetc ( c); - - return sign * n; -} - - - -/*---------------------------------------------------------------. -| Lexical analyzer returns an integer on the stack and the token | -| NUM, or the ASCII character read if not a number. Skips all | -| blanks and tabs, returns 0 for EOF. | -`---------------------------------------------------------------*/ - -static int -yylex (void) -{ - static int init = 1; - int c; - - if (init) - { - init = 0; - - } - - - - /* Skip white space. */ - while ((c = yygetc ()) == ' ' || c == '\t') - { - - } - - /* process numbers */ - if (c == '.' || isdigit (c)) - { - yyungetc ( c); - (yylval).ival = read_signed_integer (); - return NUM; - } - - /* Return end-of-file. */ - if (c == EOF) - return CALC_EOF; - - /* Return single chars. */ - return c; -} - -static int -power (int base, int exponent) -{ - int res = 1; - if (exponent < 0) - exit (1); - for (/* Niente */; exponent; --exponent) - res *= base; - return res; -} - - -int -main (int argc, const char **argv) -{ - semantic_value result = 0; - int count = 0; - int status; - - alarm (10); - if (argc == 2) - yyin = fopen (argv[1], "r"); - else - yyin = stdin; - - if (!yyin) - { - perror (argv[1]); - exit (1); - } - - - status = yyparse (); - if (global_result != result) - abort (); - if (global_count != count) - abort (); - return status; -} -_ATEOF - - - - - -# Specify the output files to avoid problems on different file systems. -$at_traceoff -echo "calc.at:547: bison -o calc.c calc.y" -echo calc.at:547 >$at_check_line_file -( $at_traceon; bison -o calc.c calc.y ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:547: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - -$at_traceoff -echo "calc.at:547: \$CC \$CFLAGS \$CPPFLAGS \$LDFLAGS calc.c \$LIBS -o calc" -echo calc.at:547 >$at_check_line_file -( $at_traceon; $CC $CFLAGS $CPPFLAGS $LDFLAGS calc.c $LIBS -o calc ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo stderr:; cat $at_stderr -echo stdout:; cat $at_stdout -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:547: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - -# Test the priorities. -cat >input <<'_ATEOF' -1 + 2 * 3 = 7 -1 + 2 * -3 = -5 - --1^2 = -1 -(-1)^2 = 1 - ----1 = -1 - -1 - 2 - 3 = -4 -1 - (2 - 3) = 2 - -2^2^3 = 256 -(2^2)^3 = 64 -_ATEOF - -$at_traceoff -echo "calc.at:547: \$PREPARSER ./calc input" -echo calc.at:547 >$at_check_line_file -( $at_traceon; $PREPARSER ./calc input ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo stderr:; tee stderr <$at_stderr -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:547: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - - - -# Some syntax errors. -cat >input <<'_ATEOF' -0 0 -_ATEOF - -$at_traceoff -echo "calc.at:547: \$PREPARSER ./calc input" -echo calc.at:547 >$at_check_line_file -( $at_traceon; $PREPARSER ./calc input ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo stderr:; tee stderr <$at_stderr -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 1) ;; - *) echo "calc.at:547: exit code was $at_status, expected 1" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - - -# Normalize the observed and expected error messages, depending upon the -# options. -# 1. Remove the traces from observed. -sed '/^Starting/d -/^Entering/d -/^Stack/d -/^Reading/d -/^Reducing/d -/^Shifting/d -/^state/d -/^Error:/d -/^Next/d -/^Discarding/d -/^yydestructor:/d' stderr >at-stderr -mv at-stderr stderr -# 2. Create the reference error message. -cat >expout <<'_ATEOF' -1.2: syntax error, unexpected "number" -_ATEOF - -# 3. If locations are not used, remove them. -sed 's/^[-0-9.]*: //' expout >at-expout -mv at-expout expout -# 4. If error-verbose is not used, strip the`, unexpected....' part. -sed 's/syntax error, .*$/syntax error/' expout >at-expout -mv at-expout expout -# 5. Check -$at_traceoff -echo "calc.at:547: cat stderr" -echo calc.at:547 >$at_check_line_file -( $at_traceon; cat stderr ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -$at_diff expout $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:547: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - -cat >input <<'_ATEOF' -1//2 -_ATEOF - -$at_traceoff -echo "calc.at:547: \$PREPARSER ./calc input" -echo calc.at:547 >$at_check_line_file -( $at_traceon; $PREPARSER ./calc input ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo stderr:; tee stderr <$at_stderr -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 1) ;; - *) echo "calc.at:547: exit code was $at_status, expected 1" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - - -# Normalize the observed and expected error messages, depending upon the -# options. -# 1. Remove the traces from observed. -sed '/^Starting/d -/^Entering/d -/^Stack/d -/^Reading/d -/^Reducing/d -/^Shifting/d -/^state/d -/^Error:/d -/^Next/d -/^Discarding/d -/^yydestructor:/d' stderr >at-stderr -mv at-stderr stderr -# 2. Create the reference error message. -cat >expout <<'_ATEOF' -1.2: syntax error, unexpected '/', expecting "number" or '-' or '(' or '!' -_ATEOF - -# 3. If locations are not used, remove them. -sed 's/^[-0-9.]*: //' expout >at-expout -mv at-expout expout -# 4. If error-verbose is not used, strip the`, unexpected....' part. -sed 's/syntax error, .*$/syntax error/' expout >at-expout -mv at-expout expout -# 5. Check -$at_traceoff -echo "calc.at:547: cat stderr" -echo calc.at:547 >$at_check_line_file -( $at_traceon; cat stderr ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -$at_diff expout $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:547: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - -cat >input <<'_ATEOF' -error -_ATEOF - -$at_traceoff -echo "calc.at:547: \$PREPARSER ./calc input" -echo calc.at:547 >$at_check_line_file -( $at_traceon; $PREPARSER ./calc input ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo stderr:; tee stderr <$at_stderr -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 1) ;; - *) echo "calc.at:547: exit code was $at_status, expected 1" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - - -# Normalize the observed and expected error messages, depending upon the -# options. -# 1. Remove the traces from observed. -sed '/^Starting/d -/^Entering/d -/^Stack/d -/^Reading/d -/^Reducing/d -/^Shifting/d -/^state/d -/^Error:/d -/^Next/d -/^Discarding/d -/^yydestructor:/d' stderr >at-stderr -mv at-stderr stderr -# 2. Create the reference error message. -cat >expout <<'_ATEOF' -1.0: syntax error, unexpected $undefined -_ATEOF - -# 3. If locations are not used, remove them. -sed 's/^[-0-9.]*: //' expout >at-expout -mv at-expout expout -# 4. If error-verbose is not used, strip the`, unexpected....' part. -sed 's/syntax error, .*$/syntax error/' expout >at-expout -mv at-expout expout -# 5. Check -$at_traceoff -echo "calc.at:547: cat stderr" -echo calc.at:547 >$at_check_line_file -( $at_traceon; cat stderr ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -$at_diff expout $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:547: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - -cat >input <<'_ATEOF' -1 = 2 = 3 -_ATEOF - -$at_traceoff -echo "calc.at:547: \$PREPARSER ./calc input" -echo calc.at:547 >$at_check_line_file -( $at_traceon; $PREPARSER ./calc input ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo stderr:; tee stderr <$at_stderr -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 1) ;; - *) echo "calc.at:547: exit code was $at_status, expected 1" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - - -# Normalize the observed and expected error messages, depending upon the -# options. -# 1. Remove the traces from observed. -sed '/^Starting/d -/^Entering/d -/^Stack/d -/^Reading/d -/^Reducing/d -/^Shifting/d -/^state/d -/^Error:/d -/^Next/d -/^Discarding/d -/^yydestructor:/d' stderr >at-stderr -mv at-stderr stderr -# 2. Create the reference error message. -cat >expout <<'_ATEOF' -1.6: syntax error, unexpected '=' -_ATEOF - -# 3. If locations are not used, remove them. -sed 's/^[-0-9.]*: //' expout >at-expout -mv at-expout expout -# 4. If error-verbose is not used, strip the`, unexpected....' part. -sed 's/syntax error, .*$/syntax error/' expout >at-expout -mv at-expout expout -# 5. Check -$at_traceoff -echo "calc.at:547: cat stderr" -echo calc.at:547 >$at_check_line_file -( $at_traceon; cat stderr ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -$at_diff expout $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:547: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - -cat >input <<'_ATEOF' - -+1 -_ATEOF - -$at_traceoff -echo "calc.at:547: \$PREPARSER ./calc input" -echo calc.at:547 >$at_check_line_file -( $at_traceon; $PREPARSER ./calc input ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo stderr:; tee stderr <$at_stderr -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 1) ;; - *) echo "calc.at:547: exit code was $at_status, expected 1" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - - -# Normalize the observed and expected error messages, depending upon the -# options. -# 1. Remove the traces from observed. -sed '/^Starting/d -/^Entering/d -/^Stack/d -/^Reading/d -/^Reducing/d -/^Shifting/d -/^state/d -/^Error:/d -/^Next/d -/^Discarding/d -/^yydestructor:/d' stderr >at-stderr -mv at-stderr stderr -# 2. Create the reference error message. -cat >expout <<'_ATEOF' -2.0: syntax error, unexpected '+' -_ATEOF - -# 3. If locations are not used, remove them. -sed 's/^[-0-9.]*: //' expout >at-expout -mv at-expout expout -# 4. If error-verbose is not used, strip the`, unexpected....' part. -sed 's/syntax error, .*$/syntax error/' expout >at-expout -mv at-expout expout -# 5. Check -$at_traceoff -echo "calc.at:547: cat stderr" -echo calc.at:547 >$at_check_line_file -( $at_traceon; cat stderr ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -$at_diff expout $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:547: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - -# Exercise error messages with EOF: work on an empty file. -$at_traceoff -echo "calc.at:547: \$PREPARSER ./calc /dev/null" -echo calc.at:547 >$at_check_line_file -( $at_traceon; $PREPARSER ./calc /dev/null ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo stderr:; tee stderr <$at_stderr -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 1) ;; - *) echo "calc.at:547: exit code was $at_status, expected 1" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - - -# Normalize the observed and expected error messages, depending upon the -# options. -# 1. Remove the traces from observed. -sed '/^Starting/d -/^Entering/d -/^Stack/d -/^Reading/d -/^Reducing/d -/^Shifting/d -/^state/d -/^Error:/d -/^Next/d -/^Discarding/d -/^yydestructor:/d' stderr >at-stderr -mv at-stderr stderr -# 2. Create the reference error message. -cat >expout <<'_ATEOF' -1.0: syntax error, unexpected "end of input" -_ATEOF - -# 3. If locations are not used, remove them. -sed 's/^[-0-9.]*: //' expout >at-expout -mv at-expout expout -# 4. If error-verbose is not used, strip the`, unexpected....' part. -sed 's/syntax error, .*$/syntax error/' expout >at-expout -mv at-expout expout -# 5. Check -$at_traceoff -echo "calc.at:547: cat stderr" -echo calc.at:547 >$at_check_line_file -( $at_traceon; cat stderr ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -$at_diff expout $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:547: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - - -# Exercise the error token: without it, we die at the first error, -# hence be sure to -# -# - have several errors which exercise different shift/discardings -# - (): nothing to pop, nothing to discard -# - (1 + 1 + 1 +): a lot to pop, nothing to discard -# - (* * *): nothing to pop, a lot to discard -# - (1 + 2 * *): some to pop and discard -# -# - test the action associated to `error' -# -# - check the lookahead that triggers an error is not discarded -# when we enter error recovery. Below, the lookahead causing the -# first error is ")", which is needed to recover from the error and -# produce the "0" that triggers the "0 != 1" error. -# -cat >input <<'_ATEOF' -() + (1 + 1 + 1 +) + (* * *) + (1 * 2 * *) = 1 -_ATEOF - -$at_traceoff -echo "calc.at:547: \$PREPARSER ./calc input" -echo calc.at:547 >$at_check_line_file -( $at_traceon; $PREPARSER ./calc input ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo stderr:; tee stderr <$at_stderr -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:547: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - - -# Normalize the observed and expected error messages, depending upon the -# options. -# 1. Remove the traces from observed. -sed '/^Starting/d -/^Entering/d -/^Stack/d -/^Reading/d -/^Reducing/d -/^Shifting/d -/^state/d -/^Error:/d -/^Next/d -/^Discarding/d -/^yydestructor:/d' stderr >at-stderr -mv at-stderr stderr -# 2. Create the reference error message. -cat >expout <<'_ATEOF' -1.1: syntax error, unexpected ')', expecting "number" or '-' or '(' or '!' -1.17: syntax error, unexpected ')', expecting "number" or '-' or '(' or '!' -1.22: syntax error, unexpected '*', expecting "number" or '-' or '(' or '!' -1.40: syntax error, unexpected '*', expecting "number" or '-' or '(' or '!' -calc: error: 4444 != 1 -_ATEOF - -# 3. If locations are not used, remove them. -sed 's/^[-0-9.]*: //' expout >at-expout -mv at-expout expout -# 4. If error-verbose is not used, strip the`, unexpected....' part. -sed 's/syntax error, .*$/syntax error/' expout >at-expout -mv at-expout expout -# 5. Check -$at_traceoff -echo "calc.at:547: cat stderr" -echo calc.at:547 >$at_check_line_file -( $at_traceon; cat stderr ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -$at_diff expout $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:547: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - - -# The same, but this time exercising explicitly triggered syntax errors. -# POSIX says the lookahead causing the error should not be discarded. -cat >input <<'_ATEOF' -(!) + (0 0) = 1 -_ATEOF - -$at_traceoff -echo "calc.at:547: \$PREPARSER ./calc input" -echo calc.at:547 >$at_check_line_file -( $at_traceon; $PREPARSER ./calc input ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo stderr:; tee stderr <$at_stderr -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:547: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - - -# Normalize the observed and expected error messages, depending upon the -# options. -# 1. Remove the traces from observed. -sed '/^Starting/d -/^Entering/d -/^Stack/d -/^Reading/d -/^Reducing/d -/^Shifting/d -/^state/d -/^Error:/d -/^Next/d -/^Discarding/d -/^yydestructor:/d' stderr >at-stderr -mv at-stderr stderr -# 2. Create the reference error message. -cat >expout <<'_ATEOF' -1.9: syntax error, unexpected "number" -calc: error: 2222 != 1 -_ATEOF - -# 3. If locations are not used, remove them. -sed 's/^[-0-9.]*: //' expout >at-expout -mv at-expout expout -# 4. If error-verbose is not used, strip the`, unexpected....' part. -sed 's/syntax error, .*$/syntax error/' expout >at-expout -mv at-expout expout -# 5. Check -$at_traceoff -echo "calc.at:547: cat stderr" -echo calc.at:547 >$at_check_line_file -( $at_traceon; cat stderr ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -$at_diff expout $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:547: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - -cat >input <<'_ATEOF' -(- *) + (0 0) = 1 -_ATEOF - -$at_traceoff -echo "calc.at:547: \$PREPARSER ./calc input" -echo calc.at:547 >$at_check_line_file -( $at_traceon; $PREPARSER ./calc input ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo stderr:; tee stderr <$at_stderr -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:547: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - - -# Normalize the observed and expected error messages, depending upon the -# options. -# 1. Remove the traces from observed. -sed '/^Starting/d -/^Entering/d -/^Stack/d -/^Reading/d -/^Reducing/d -/^Shifting/d -/^state/d -/^Error:/d -/^Next/d -/^Discarding/d -/^yydestructor:/d' stderr >at-stderr -mv at-stderr stderr -# 2. Create the reference error message. -cat >expout <<'_ATEOF' -1.3: syntax error, unexpected '*', expecting "number" or '-' or '(' or '!' -1.11: syntax error, unexpected "number" -calc: error: 2222 != 1 -_ATEOF - -# 3. If locations are not used, remove them. -sed 's/^[-0-9.]*: //' expout >at-expout -mv at-expout expout -# 4. If error-verbose is not used, strip the`, unexpected....' part. -sed 's/syntax error, .*$/syntax error/' expout >at-expout -mv at-expout expout -# 5. Check -$at_traceoff -echo "calc.at:547: cat stderr" -echo calc.at:547 >$at_check_line_file -( $at_traceon; cat stderr ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -$at_diff expout $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:547: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - - - - - - - - - - - - - - - - - - - - - $at_traceoff - $at_times_p && times >$at_times_file - ) 5>&1 2>&1 | eval $at_tee_pipe - at_status=`cat $at_status_file` - ;; - - 62 ) # 62. calc.at:548: Calculator %error-verbose - at_setup_line='calc.at:548' - at_desc='Calculator %error-verbose' - $at_quiet $ECHO_N " 62: Calculator %error-verbose $ECHO_C" - at_xfail=no - ( - echo "62. calc.at:548: testing ..." - $at_traceon - - - - - - -# Using yacc.c? - - - - - - - -# yyerror receives the location if %location & %pure & (%glr or %parse-param). - -# yyerror always sees the locations (when activated), except if -# yacc & pure & !param. - - -# The interface is pure: either because %pure-parser, or because we -# are using the C++ parsers. - - - - - - - - - - - - -cat >calc.y <<'_ATEOF' -%{ -#if HAVE_CONFIG_H -# include - /* We don't need perfect functions for these tests. */ -# undef malloc -# undef memcmp -# undef realloc -#endif -%} - -/* Infix notation calculator--calc */ -%error-verbose -%{ -#include - -#include -#include -#if HAVE_UNISTD_H -# include -#else -# undef alarm -# define alarm(seconds) /* empty */ -#endif -#include - -/* Exercise pre-prologue dependency to %union. */ -typedef int semantic_value; - -static semantic_value global_result = 0; -static int global_count = 0; -%} - -/* Exercise %union. */ -%union -{ - semantic_value ival; -}; - -%{ -static int power (int base, int exponent); -/* yyerror receives the location if: - - %location & %pure & %glr - - %location & %pure & %yacc & %parse-param. */ -static void yyerror ( - - const char *s - ); -static int yylex (void); -static int yygetc (void); -static void yyungetc ( int c); -%} - -/* Bison Declarations */ -%token CALC_EOF 0 "end of input" -%token NUM "number" -%type exp - -%nonassoc '=' /* comparison */ -%left '-' '+' -%left '*' '/' -%left NEG /* negation--unary minus */ -%right '^' /* exponentiation */ - -/* Grammar follows */ -%% -input: - line -| input line { } -; - -line: - '\n' -| exp '\n' { } -; - -exp: - NUM { $$ = $1; } -| exp '=' exp - { - if ($1 != $3) - fprintf (stderr, "calc: error: %d != %d\n", $1, $3); - $$ = $1; - } -| exp '+' exp { $$ = $1 + $3; } -| exp '-' exp { $$ = $1 - $3; } -| exp '*' exp { $$ = $1 * $3; } -| exp '/' exp { $$ = $1 / $3; } -| '-' exp %prec NEG { $$ = -$2; } -| exp '^' exp { $$ = power ($1, $3); } -| '(' exp ')' { $$ = $2; } -| '(' error ')' { $$ = 1111; } -| '!' { YYERROR; } -| '-' error { YYERROR; } -; -%% -/* The input. */ -static FILE *yyin; - -static void -yyerror ( - - const char *s) -{ - - - fprintf (stderr, "%s\n", s); -} - - - -static int -yygetc (void) -{ - int res = getc (yyin); - ; - - return res; -} - - -static void -yyungetc ( int c) -{ - ; - - ungetc (c, yyin); -} - -static int -read_signed_integer (void) -{ - int c = yygetc (); - int sign = 1; - int n = 0; - - ; - if (c == '-') - { - c = yygetc (); - sign = -1; - } - - while (isdigit (c)) - { - n = 10 * n + (c - '0'); - c = yygetc (); - } - - yyungetc ( c); - - return sign * n; -} - - - -/*---------------------------------------------------------------. -| Lexical analyzer returns an integer on the stack and the token | -| NUM, or the ASCII character read if not a number. Skips all | -| blanks and tabs, returns 0 for EOF. | -`---------------------------------------------------------------*/ - -static int -yylex (void) -{ - static int init = 1; - int c; - - if (init) - { - init = 0; - - } - - - - /* Skip white space. */ - while ((c = yygetc ()) == ' ' || c == '\t') - { - - } - - /* process numbers */ - if (c == '.' || isdigit (c)) - { - yyungetc ( c); - (yylval).ival = read_signed_integer (); - return NUM; - } - - /* Return end-of-file. */ - if (c == EOF) - return CALC_EOF; - - /* Return single chars. */ - return c; -} - -static int -power (int base, int exponent) -{ - int res = 1; - if (exponent < 0) - exit (1); - for (/* Niente */; exponent; --exponent) - res *= base; - return res; -} - - -int -main (int argc, const char **argv) -{ - semantic_value result = 0; - int count = 0; - int status; - - alarm (10); - if (argc == 2) - yyin = fopen (argv[1], "r"); - else - yyin = stdin; - - if (!yyin) - { - perror (argv[1]); - exit (1); - } - - - status = yyparse (); - if (global_result != result) - abort (); - if (global_count != count) - abort (); - return status; -} -_ATEOF - - - - - -# Specify the output files to avoid problems on different file systems. -$at_traceoff -echo "calc.at:548: bison -o calc.c calc.y" -echo calc.at:548 >$at_check_line_file -( $at_traceon; bison -o calc.c calc.y ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:548: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - -$at_traceoff -echo "calc.at:548: \$CC \$CFLAGS \$CPPFLAGS \$LDFLAGS calc.c \$LIBS -o calc" -echo calc.at:548 >$at_check_line_file -( $at_traceon; $CC $CFLAGS $CPPFLAGS $LDFLAGS calc.c $LIBS -o calc ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo stderr:; cat $at_stderr -echo stdout:; cat $at_stdout -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:548: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - -# Test the priorities. -cat >input <<'_ATEOF' -1 + 2 * 3 = 7 -1 + 2 * -3 = -5 - --1^2 = -1 -(-1)^2 = 1 - ----1 = -1 - -1 - 2 - 3 = -4 -1 - (2 - 3) = 2 - -2^2^3 = 256 -(2^2)^3 = 64 -_ATEOF - -$at_traceoff -echo "calc.at:548: \$PREPARSER ./calc input" -echo calc.at:548 >$at_check_line_file -( $at_traceon; $PREPARSER ./calc input ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo stderr:; tee stderr <$at_stderr -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:548: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - - - -# Some syntax errors. -cat >input <<'_ATEOF' -0 0 -_ATEOF - -$at_traceoff -echo "calc.at:548: \$PREPARSER ./calc input" -echo calc.at:548 >$at_check_line_file -( $at_traceon; $PREPARSER ./calc input ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo stderr:; tee stderr <$at_stderr -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 1) ;; - *) echo "calc.at:548: exit code was $at_status, expected 1" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - - -# Normalize the observed and expected error messages, depending upon the -# options. -# 1. Remove the traces from observed. -sed '/^Starting/d -/^Entering/d -/^Stack/d -/^Reading/d -/^Reducing/d -/^Shifting/d -/^state/d -/^Error:/d -/^Next/d -/^Discarding/d -/^yydestructor:/d' stderr >at-stderr -mv at-stderr stderr -# 2. Create the reference error message. -cat >expout <<'_ATEOF' -1.2: syntax error, unexpected "number" -_ATEOF - -# 3. If locations are not used, remove them. -sed 's/^[-0-9.]*: //' expout >at-expout -mv at-expout expout -# 4. If error-verbose is not used, strip the`, unexpected....' part. - -# 5. Check -$at_traceoff -echo "calc.at:548: cat stderr" -echo calc.at:548 >$at_check_line_file -( $at_traceon; cat stderr ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -$at_diff expout $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:548: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - -cat >input <<'_ATEOF' -1//2 -_ATEOF - -$at_traceoff -echo "calc.at:548: \$PREPARSER ./calc input" -echo calc.at:548 >$at_check_line_file -( $at_traceon; $PREPARSER ./calc input ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo stderr:; tee stderr <$at_stderr -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 1) ;; - *) echo "calc.at:548: exit code was $at_status, expected 1" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - - -# Normalize the observed and expected error messages, depending upon the -# options. -# 1. Remove the traces from observed. -sed '/^Starting/d -/^Entering/d -/^Stack/d -/^Reading/d -/^Reducing/d -/^Shifting/d -/^state/d -/^Error:/d -/^Next/d -/^Discarding/d -/^yydestructor:/d' stderr >at-stderr -mv at-stderr stderr -# 2. Create the reference error message. -cat >expout <<'_ATEOF' -1.2: syntax error, unexpected '/', expecting "number" or '-' or '(' or '!' -_ATEOF - -# 3. If locations are not used, remove them. -sed 's/^[-0-9.]*: //' expout >at-expout -mv at-expout expout -# 4. If error-verbose is not used, strip the`, unexpected....' part. - -# 5. Check -$at_traceoff -echo "calc.at:548: cat stderr" -echo calc.at:548 >$at_check_line_file -( $at_traceon; cat stderr ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -$at_diff expout $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:548: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - -cat >input <<'_ATEOF' -error -_ATEOF - -$at_traceoff -echo "calc.at:548: \$PREPARSER ./calc input" -echo calc.at:548 >$at_check_line_file -( $at_traceon; $PREPARSER ./calc input ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo stderr:; tee stderr <$at_stderr -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 1) ;; - *) echo "calc.at:548: exit code was $at_status, expected 1" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - - -# Normalize the observed and expected error messages, depending upon the -# options. -# 1. Remove the traces from observed. -sed '/^Starting/d -/^Entering/d -/^Stack/d -/^Reading/d -/^Reducing/d -/^Shifting/d -/^state/d -/^Error:/d -/^Next/d -/^Discarding/d -/^yydestructor:/d' stderr >at-stderr -mv at-stderr stderr -# 2. Create the reference error message. -cat >expout <<'_ATEOF' -1.0: syntax error, unexpected $undefined -_ATEOF - -# 3. If locations are not used, remove them. -sed 's/^[-0-9.]*: //' expout >at-expout -mv at-expout expout -# 4. If error-verbose is not used, strip the`, unexpected....' part. - -# 5. Check -$at_traceoff -echo "calc.at:548: cat stderr" -echo calc.at:548 >$at_check_line_file -( $at_traceon; cat stderr ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -$at_diff expout $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:548: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - -cat >input <<'_ATEOF' -1 = 2 = 3 -_ATEOF - -$at_traceoff -echo "calc.at:548: \$PREPARSER ./calc input" -echo calc.at:548 >$at_check_line_file -( $at_traceon; $PREPARSER ./calc input ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo stderr:; tee stderr <$at_stderr -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 1) ;; - *) echo "calc.at:548: exit code was $at_status, expected 1" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - - -# Normalize the observed and expected error messages, depending upon the -# options. -# 1. Remove the traces from observed. -sed '/^Starting/d -/^Entering/d -/^Stack/d -/^Reading/d -/^Reducing/d -/^Shifting/d -/^state/d -/^Error:/d -/^Next/d -/^Discarding/d -/^yydestructor:/d' stderr >at-stderr -mv at-stderr stderr -# 2. Create the reference error message. -cat >expout <<'_ATEOF' -1.6: syntax error, unexpected '=' -_ATEOF - -# 3. If locations are not used, remove them. -sed 's/^[-0-9.]*: //' expout >at-expout -mv at-expout expout -# 4. If error-verbose is not used, strip the`, unexpected....' part. - -# 5. Check -$at_traceoff -echo "calc.at:548: cat stderr" -echo calc.at:548 >$at_check_line_file -( $at_traceon; cat stderr ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -$at_diff expout $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:548: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - -cat >input <<'_ATEOF' - -+1 -_ATEOF - -$at_traceoff -echo "calc.at:548: \$PREPARSER ./calc input" -echo calc.at:548 >$at_check_line_file -( $at_traceon; $PREPARSER ./calc input ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo stderr:; tee stderr <$at_stderr -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 1) ;; - *) echo "calc.at:548: exit code was $at_status, expected 1" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - - -# Normalize the observed and expected error messages, depending upon the -# options. -# 1. Remove the traces from observed. -sed '/^Starting/d -/^Entering/d -/^Stack/d -/^Reading/d -/^Reducing/d -/^Shifting/d -/^state/d -/^Error:/d -/^Next/d -/^Discarding/d -/^yydestructor:/d' stderr >at-stderr -mv at-stderr stderr -# 2. Create the reference error message. -cat >expout <<'_ATEOF' -2.0: syntax error, unexpected '+' -_ATEOF - -# 3. If locations are not used, remove them. -sed 's/^[-0-9.]*: //' expout >at-expout -mv at-expout expout -# 4. If error-verbose is not used, strip the`, unexpected....' part. - -# 5. Check -$at_traceoff -echo "calc.at:548: cat stderr" -echo calc.at:548 >$at_check_line_file -( $at_traceon; cat stderr ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -$at_diff expout $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:548: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - -# Exercise error messages with EOF: work on an empty file. -$at_traceoff -echo "calc.at:548: \$PREPARSER ./calc /dev/null" -echo calc.at:548 >$at_check_line_file -( $at_traceon; $PREPARSER ./calc /dev/null ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo stderr:; tee stderr <$at_stderr -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 1) ;; - *) echo "calc.at:548: exit code was $at_status, expected 1" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - - -# Normalize the observed and expected error messages, depending upon the -# options. -# 1. Remove the traces from observed. -sed '/^Starting/d -/^Entering/d -/^Stack/d -/^Reading/d -/^Reducing/d -/^Shifting/d -/^state/d -/^Error:/d -/^Next/d -/^Discarding/d -/^yydestructor:/d' stderr >at-stderr -mv at-stderr stderr -# 2. Create the reference error message. -cat >expout <<'_ATEOF' -1.0: syntax error, unexpected "end of input" -_ATEOF - -# 3. If locations are not used, remove them. -sed 's/^[-0-9.]*: //' expout >at-expout -mv at-expout expout -# 4. If error-verbose is not used, strip the`, unexpected....' part. - -# 5. Check -$at_traceoff -echo "calc.at:548: cat stderr" -echo calc.at:548 >$at_check_line_file -( $at_traceon; cat stderr ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -$at_diff expout $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:548: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - - -# Exercise the error token: without it, we die at the first error, -# hence be sure to -# -# - have several errors which exercise different shift/discardings -# - (): nothing to pop, nothing to discard -# - (1 + 1 + 1 +): a lot to pop, nothing to discard -# - (* * *): nothing to pop, a lot to discard -# - (1 + 2 * *): some to pop and discard -# -# - test the action associated to `error' -# -# - check the lookahead that triggers an error is not discarded -# when we enter error recovery. Below, the lookahead causing the -# first error is ")", which is needed to recover from the error and -# produce the "0" that triggers the "0 != 1" error. -# -cat >input <<'_ATEOF' -() + (1 + 1 + 1 +) + (* * *) + (1 * 2 * *) = 1 -_ATEOF - -$at_traceoff -echo "calc.at:548: \$PREPARSER ./calc input" -echo calc.at:548 >$at_check_line_file -( $at_traceon; $PREPARSER ./calc input ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo stderr:; tee stderr <$at_stderr -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:548: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - - -# Normalize the observed and expected error messages, depending upon the -# options. -# 1. Remove the traces from observed. -sed '/^Starting/d -/^Entering/d -/^Stack/d -/^Reading/d -/^Reducing/d -/^Shifting/d -/^state/d -/^Error:/d -/^Next/d -/^Discarding/d -/^yydestructor:/d' stderr >at-stderr -mv at-stderr stderr -# 2. Create the reference error message. -cat >expout <<'_ATEOF' -1.1: syntax error, unexpected ')', expecting "number" or '-' or '(' or '!' -1.17: syntax error, unexpected ')', expecting "number" or '-' or '(' or '!' -1.22: syntax error, unexpected '*', expecting "number" or '-' or '(' or '!' -1.40: syntax error, unexpected '*', expecting "number" or '-' or '(' or '!' -calc: error: 4444 != 1 -_ATEOF - -# 3. If locations are not used, remove them. -sed 's/^[-0-9.]*: //' expout >at-expout -mv at-expout expout -# 4. If error-verbose is not used, strip the`, unexpected....' part. - -# 5. Check -$at_traceoff -echo "calc.at:548: cat stderr" -echo calc.at:548 >$at_check_line_file -( $at_traceon; cat stderr ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -$at_diff expout $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:548: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - - -# The same, but this time exercising explicitly triggered syntax errors. -# POSIX says the lookahead causing the error should not be discarded. -cat >input <<'_ATEOF' -(!) + (0 0) = 1 -_ATEOF - -$at_traceoff -echo "calc.at:548: \$PREPARSER ./calc input" -echo calc.at:548 >$at_check_line_file -( $at_traceon; $PREPARSER ./calc input ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo stderr:; tee stderr <$at_stderr -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:548: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - - -# Normalize the observed and expected error messages, depending upon the -# options. -# 1. Remove the traces from observed. -sed '/^Starting/d -/^Entering/d -/^Stack/d -/^Reading/d -/^Reducing/d -/^Shifting/d -/^state/d -/^Error:/d -/^Next/d -/^Discarding/d -/^yydestructor:/d' stderr >at-stderr -mv at-stderr stderr -# 2. Create the reference error message. -cat >expout <<'_ATEOF' -1.9: syntax error, unexpected "number" -calc: error: 2222 != 1 -_ATEOF - -# 3. If locations are not used, remove them. -sed 's/^[-0-9.]*: //' expout >at-expout -mv at-expout expout -# 4. If error-verbose is not used, strip the`, unexpected....' part. - -# 5. Check -$at_traceoff -echo "calc.at:548: cat stderr" -echo calc.at:548 >$at_check_line_file -( $at_traceon; cat stderr ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -$at_diff expout $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:548: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - -cat >input <<'_ATEOF' -(- *) + (0 0) = 1 -_ATEOF - -$at_traceoff -echo "calc.at:548: \$PREPARSER ./calc input" -echo calc.at:548 >$at_check_line_file -( $at_traceon; $PREPARSER ./calc input ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo stderr:; tee stderr <$at_stderr -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:548: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - - -# Normalize the observed and expected error messages, depending upon the -# options. -# 1. Remove the traces from observed. -sed '/^Starting/d -/^Entering/d -/^Stack/d -/^Reading/d -/^Reducing/d -/^Shifting/d -/^state/d -/^Error:/d -/^Next/d -/^Discarding/d -/^yydestructor:/d' stderr >at-stderr -mv at-stderr stderr -# 2. Create the reference error message. -cat >expout <<'_ATEOF' -1.3: syntax error, unexpected '*', expecting "number" or '-' or '(' or '!' -1.11: syntax error, unexpected "number" -calc: error: 2222 != 1 -_ATEOF - -# 3. If locations are not used, remove them. -sed 's/^[-0-9.]*: //' expout >at-expout -mv at-expout expout -# 4. If error-verbose is not used, strip the`, unexpected....' part. - -# 5. Check -$at_traceoff -echo "calc.at:548: cat stderr" -echo calc.at:548 >$at_check_line_file -( $at_traceon; cat stderr ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -$at_diff expout $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:548: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - - - - - - - - - - - - - - - - - - - - - $at_traceoff - $at_times_p && times >$at_times_file - ) 5>&1 2>&1 | eval $at_tee_pipe - at_status=`cat $at_status_file` - ;; - - 63 ) # 63. calc.at:550: Calculator %pure-parser %locations - at_setup_line='calc.at:550' - at_desc='Calculator %pure-parser %locations' - $at_quiet $ECHO_N " 63: Calculator %pure-parser %locations $ECHO_C" - at_xfail=no - ( - echo "63. calc.at:550: testing ..." - $at_traceon - - - - - - -# Using yacc.c? - - - - - - - -# yyerror receives the location if %location & %pure & (%glr or %parse-param). - -# yyerror always sees the locations (when activated), except if -# yacc & pure & !param. - - -# The interface is pure: either because %pure-parser, or because we -# are using the C++ parsers. - - - - - - - - - - - - -cat >calc.y <<'_ATEOF' -%{ -#if HAVE_CONFIG_H -# include - /* We don't need perfect functions for these tests. */ -# undef malloc -# undef memcmp -# undef realloc -#endif -%} - -/* Infix notation calculator--calc */ -%pure-parser %locations -%{ -#include - -#include -#include -#if HAVE_UNISTD_H -# include -#else -# undef alarm -# define alarm(seconds) /* empty */ -#endif -#include - -/* Exercise pre-prologue dependency to %union. */ -typedef int semantic_value; - -static semantic_value global_result = 0; -static int global_count = 0; -%} - -/* Exercise %union. */ -%union -{ - semantic_value ival; -}; - -%{ -static int power (int base, int exponent); -/* yyerror receives the location if: - - %location & %pure & %glr - - %location & %pure & %yacc & %parse-param. */ -static void yyerror ( - - const char *s - ); -static int yylex (YYSTYPE *yylval, YYLTYPE *yylloc); -static int yygetc (YYSTYPE *yylval, YYLTYPE *yylloc); -static void yyungetc (YYSTYPE *yylval, YYLTYPE *yylloc, int c); -%} - -/* Bison Declarations */ -%token CALC_EOF 0 "end of input" -%token NUM "number" -%type exp - -%nonassoc '=' /* comparison */ -%left '-' '+' -%left '*' '/' -%left NEG /* negation--unary minus */ -%right '^' /* exponentiation */ - -/* Grammar follows */ -%% -input: - line -| input line { } -; - -line: - '\n' -| exp '\n' { } -; - -exp: - NUM { $$ = $1; } -| exp '=' exp - { - if ($1 != $3) - fprintf (stderr, "calc: error: %d != %d\n", $1, $3); - $$ = $1; - } -| exp '+' exp { $$ = $1 + $3; } -| exp '-' exp { $$ = $1 - $3; } -| exp '*' exp { $$ = $1 * $3; } -| exp '/' exp { $$ = $1 / $3; } -| '-' exp %prec NEG { $$ = -$2; } -| exp '^' exp { $$ = power ($1, $3); } -| '(' exp ')' { $$ = $2; } -| '(' error ')' { $$ = 1111; } -| '!' { YYERROR; } -| '-' error { YYERROR; } -; -%% -/* The input. */ -static FILE *yyin; - -static void -yyerror ( - - const char *s) -{ - - - fprintf (stderr, "%s\n", s); -} - - - -static YYLTYPE last_yylloc; - -static int -yygetc (YYSTYPE *yylval, YYLTYPE *yylloc) -{ - int res = getc (yyin); - (void) yylval;(void) yylloc; - - last_yylloc = (*yylloc); - if (res == '\n') - { - (*yylloc).last_line++; - (*yylloc).last_column = 0; - } - else - (*yylloc).last_column++; - - return res; -} - - -static void -yyungetc (YYSTYPE *yylval, YYLTYPE *yylloc, int c) -{ - (void) yylval;(void) yylloc; - - /* Wrong when C == `\n'. */ - (*yylloc) = last_yylloc; - - ungetc (c, yyin); -} - -static int -read_signed_integer (YYSTYPE *yylval, YYLTYPE *yylloc) -{ - int c = yygetc (yylval, yylloc); - int sign = 1; - int n = 0; - - (void) yylval;(void) yylloc; - if (c == '-') - { - c = yygetc (yylval, yylloc); - sign = -1; - } - - while (isdigit (c)) - { - n = 10 * n + (c - '0'); - c = yygetc (yylval, yylloc); - } - - yyungetc (yylval, yylloc, c); - - return sign * n; -} - - - -/*---------------------------------------------------------------. -| Lexical analyzer returns an integer on the stack and the token | -| NUM, or the ASCII character read if not a number. Skips all | -| blanks and tabs, returns 0 for EOF. | -`---------------------------------------------------------------*/ - -static int -yylex (YYSTYPE *yylval, YYLTYPE *yylloc) -{ - static int init = 1; - int c; - - if (init) - { - init = 0; - - (*yylloc).last_column = 0; - (*yylloc).last_line = 1; - - } - - (*yylloc).first_column = (*yylloc).last_column; - (*yylloc).first_line = (*yylloc).last_line; - - - /* Skip white space. */ - while ((c = yygetc (yylval, yylloc)) == ' ' || c == '\t') - { - (*yylloc).first_column = (*yylloc).last_column; - (*yylloc).first_line = (*yylloc).last_line; - - } - - /* process numbers */ - if (c == '.' || isdigit (c)) - { - yyungetc (yylval, yylloc, c); - (*yylval).ival = read_signed_integer (yylval, yylloc); - return NUM; - } - - /* Return end-of-file. */ - if (c == EOF) - return CALC_EOF; - - /* Return single chars. */ - return c; -} - -static int -power (int base, int exponent) -{ - int res = 1; - if (exponent < 0) - exit (1); - for (/* Niente */; exponent; --exponent) - res *= base; - return res; -} - - -int -main (int argc, const char **argv) -{ - semantic_value result = 0; - int count = 0; - int status; - - alarm (10); - if (argc == 2) - yyin = fopen (argv[1], "r"); - else - yyin = stdin; - - if (!yyin) - { - perror (argv[1]); - exit (1); - } - - - status = yyparse (); - if (global_result != result) - abort (); - if (global_count != count) - abort (); - return status; -} -_ATEOF - - - - - -# Specify the output files to avoid problems on different file systems. -$at_traceoff -echo "calc.at:550: bison -o calc.c calc.y" -echo calc.at:550 >$at_check_line_file -( $at_traceon; bison -o calc.c calc.y ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:550: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - -$at_traceoff -echo "calc.at:550: \$CC \$CFLAGS \$CPPFLAGS \$LDFLAGS calc.c \$LIBS -o calc" -echo calc.at:550 >$at_check_line_file -( $at_traceon; $CC $CFLAGS $CPPFLAGS $LDFLAGS calc.c $LIBS -o calc ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo stderr:; cat $at_stderr -echo stdout:; cat $at_stdout -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:550: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - -# Test the priorities. -cat >input <<'_ATEOF' -1 + 2 * 3 = 7 -1 + 2 * -3 = -5 - --1^2 = -1 -(-1)^2 = 1 - ----1 = -1 - -1 - 2 - 3 = -4 -1 - (2 - 3) = 2 - -2^2^3 = 256 -(2^2)^3 = 64 -_ATEOF - -$at_traceoff -echo "calc.at:550: \$PREPARSER ./calc input" -echo calc.at:550 >$at_check_line_file -( $at_traceon; $PREPARSER ./calc input ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo stderr:; tee stderr <$at_stderr -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:550: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - - - -# Some syntax errors. -cat >input <<'_ATEOF' -0 0 -_ATEOF - -$at_traceoff -echo "calc.at:550: \$PREPARSER ./calc input" -echo calc.at:550 >$at_check_line_file -( $at_traceon; $PREPARSER ./calc input ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo stderr:; tee stderr <$at_stderr -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 1) ;; - *) echo "calc.at:550: exit code was $at_status, expected 1" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - - -# Normalize the observed and expected error messages, depending upon the -# options. -# 1. Remove the traces from observed. -sed '/^Starting/d -/^Entering/d -/^Stack/d -/^Reading/d -/^Reducing/d -/^Shifting/d -/^state/d -/^Error:/d -/^Next/d -/^Discarding/d -/^yydestructor:/d' stderr >at-stderr -mv at-stderr stderr -# 2. Create the reference error message. -cat >expout <<'_ATEOF' -1.2: syntax error, unexpected "number" -_ATEOF - -# 3. If locations are not used, remove them. -sed 's/^[-0-9.]*: //' expout >at-expout -mv at-expout expout -# 4. If error-verbose is not used, strip the`, unexpected....' part. -sed 's/syntax error, .*$/syntax error/' expout >at-expout -mv at-expout expout -# 5. Check -$at_traceoff -echo "calc.at:550: cat stderr" -echo calc.at:550 >$at_check_line_file -( $at_traceon; cat stderr ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -$at_diff expout $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:550: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - -cat >input <<'_ATEOF' -1//2 -_ATEOF - -$at_traceoff -echo "calc.at:550: \$PREPARSER ./calc input" -echo calc.at:550 >$at_check_line_file -( $at_traceon; $PREPARSER ./calc input ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo stderr:; tee stderr <$at_stderr -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 1) ;; - *) echo "calc.at:550: exit code was $at_status, expected 1" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - - -# Normalize the observed and expected error messages, depending upon the -# options. -# 1. Remove the traces from observed. -sed '/^Starting/d -/^Entering/d -/^Stack/d -/^Reading/d -/^Reducing/d -/^Shifting/d -/^state/d -/^Error:/d -/^Next/d -/^Discarding/d -/^yydestructor:/d' stderr >at-stderr -mv at-stderr stderr -# 2. Create the reference error message. -cat >expout <<'_ATEOF' -1.2: syntax error, unexpected '/', expecting "number" or '-' or '(' or '!' -_ATEOF - -# 3. If locations are not used, remove them. -sed 's/^[-0-9.]*: //' expout >at-expout -mv at-expout expout -# 4. If error-verbose is not used, strip the`, unexpected....' part. -sed 's/syntax error, .*$/syntax error/' expout >at-expout -mv at-expout expout -# 5. Check -$at_traceoff -echo "calc.at:550: cat stderr" -echo calc.at:550 >$at_check_line_file -( $at_traceon; cat stderr ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -$at_diff expout $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:550: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - -cat >input <<'_ATEOF' -error -_ATEOF - -$at_traceoff -echo "calc.at:550: \$PREPARSER ./calc input" -echo calc.at:550 >$at_check_line_file -( $at_traceon; $PREPARSER ./calc input ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo stderr:; tee stderr <$at_stderr -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 1) ;; - *) echo "calc.at:550: exit code was $at_status, expected 1" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - - -# Normalize the observed and expected error messages, depending upon the -# options. -# 1. Remove the traces from observed. -sed '/^Starting/d -/^Entering/d -/^Stack/d -/^Reading/d -/^Reducing/d -/^Shifting/d -/^state/d -/^Error:/d -/^Next/d -/^Discarding/d -/^yydestructor:/d' stderr >at-stderr -mv at-stderr stderr -# 2. Create the reference error message. -cat >expout <<'_ATEOF' -1.0: syntax error, unexpected $undefined -_ATEOF - -# 3. If locations are not used, remove them. -sed 's/^[-0-9.]*: //' expout >at-expout -mv at-expout expout -# 4. If error-verbose is not used, strip the`, unexpected....' part. -sed 's/syntax error, .*$/syntax error/' expout >at-expout -mv at-expout expout -# 5. Check -$at_traceoff -echo "calc.at:550: cat stderr" -echo calc.at:550 >$at_check_line_file -( $at_traceon; cat stderr ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -$at_diff expout $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:550: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - -cat >input <<'_ATEOF' -1 = 2 = 3 -_ATEOF - -$at_traceoff -echo "calc.at:550: \$PREPARSER ./calc input" -echo calc.at:550 >$at_check_line_file -( $at_traceon; $PREPARSER ./calc input ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo stderr:; tee stderr <$at_stderr -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 1) ;; - *) echo "calc.at:550: exit code was $at_status, expected 1" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - - -# Normalize the observed and expected error messages, depending upon the -# options. -# 1. Remove the traces from observed. -sed '/^Starting/d -/^Entering/d -/^Stack/d -/^Reading/d -/^Reducing/d -/^Shifting/d -/^state/d -/^Error:/d -/^Next/d -/^Discarding/d -/^yydestructor:/d' stderr >at-stderr -mv at-stderr stderr -# 2. Create the reference error message. -cat >expout <<'_ATEOF' -1.6: syntax error, unexpected '=' -_ATEOF - -# 3. If locations are not used, remove them. -sed 's/^[-0-9.]*: //' expout >at-expout -mv at-expout expout -# 4. If error-verbose is not used, strip the`, unexpected....' part. -sed 's/syntax error, .*$/syntax error/' expout >at-expout -mv at-expout expout -# 5. Check -$at_traceoff -echo "calc.at:550: cat stderr" -echo calc.at:550 >$at_check_line_file -( $at_traceon; cat stderr ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -$at_diff expout $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:550: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - -cat >input <<'_ATEOF' - -+1 -_ATEOF - -$at_traceoff -echo "calc.at:550: \$PREPARSER ./calc input" -echo calc.at:550 >$at_check_line_file -( $at_traceon; $PREPARSER ./calc input ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo stderr:; tee stderr <$at_stderr -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 1) ;; - *) echo "calc.at:550: exit code was $at_status, expected 1" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - - -# Normalize the observed and expected error messages, depending upon the -# options. -# 1. Remove the traces from observed. -sed '/^Starting/d -/^Entering/d -/^Stack/d -/^Reading/d -/^Reducing/d -/^Shifting/d -/^state/d -/^Error:/d -/^Next/d -/^Discarding/d -/^yydestructor:/d' stderr >at-stderr -mv at-stderr stderr -# 2. Create the reference error message. -cat >expout <<'_ATEOF' -2.0: syntax error, unexpected '+' -_ATEOF - -# 3. If locations are not used, remove them. -sed 's/^[-0-9.]*: //' expout >at-expout -mv at-expout expout -# 4. If error-verbose is not used, strip the`, unexpected....' part. -sed 's/syntax error, .*$/syntax error/' expout >at-expout -mv at-expout expout -# 5. Check -$at_traceoff -echo "calc.at:550: cat stderr" -echo calc.at:550 >$at_check_line_file -( $at_traceon; cat stderr ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -$at_diff expout $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:550: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - -# Exercise error messages with EOF: work on an empty file. -$at_traceoff -echo "calc.at:550: \$PREPARSER ./calc /dev/null" -echo calc.at:550 >$at_check_line_file -( $at_traceon; $PREPARSER ./calc /dev/null ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo stderr:; tee stderr <$at_stderr -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 1) ;; - *) echo "calc.at:550: exit code was $at_status, expected 1" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - - -# Normalize the observed and expected error messages, depending upon the -# options. -# 1. Remove the traces from observed. -sed '/^Starting/d -/^Entering/d -/^Stack/d -/^Reading/d -/^Reducing/d -/^Shifting/d -/^state/d -/^Error:/d -/^Next/d -/^Discarding/d -/^yydestructor:/d' stderr >at-stderr -mv at-stderr stderr -# 2. Create the reference error message. -cat >expout <<'_ATEOF' -1.0: syntax error, unexpected "end of input" -_ATEOF - -# 3. If locations are not used, remove them. -sed 's/^[-0-9.]*: //' expout >at-expout -mv at-expout expout -# 4. If error-verbose is not used, strip the`, unexpected....' part. -sed 's/syntax error, .*$/syntax error/' expout >at-expout -mv at-expout expout -# 5. Check -$at_traceoff -echo "calc.at:550: cat stderr" -echo calc.at:550 >$at_check_line_file -( $at_traceon; cat stderr ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -$at_diff expout $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:550: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - - -# Exercise the error token: without it, we die at the first error, -# hence be sure to -# -# - have several errors which exercise different shift/discardings -# - (): nothing to pop, nothing to discard -# - (1 + 1 + 1 +): a lot to pop, nothing to discard -# - (* * *): nothing to pop, a lot to discard -# - (1 + 2 * *): some to pop and discard -# -# - test the action associated to `error' -# -# - check the lookahead that triggers an error is not discarded -# when we enter error recovery. Below, the lookahead causing the -# first error is ")", which is needed to recover from the error and -# produce the "0" that triggers the "0 != 1" error. -# -cat >input <<'_ATEOF' -() + (1 + 1 + 1 +) + (* * *) + (1 * 2 * *) = 1 -_ATEOF - -$at_traceoff -echo "calc.at:550: \$PREPARSER ./calc input" -echo calc.at:550 >$at_check_line_file -( $at_traceon; $PREPARSER ./calc input ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo stderr:; tee stderr <$at_stderr -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:550: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - - -# Normalize the observed and expected error messages, depending upon the -# options. -# 1. Remove the traces from observed. -sed '/^Starting/d -/^Entering/d -/^Stack/d -/^Reading/d -/^Reducing/d -/^Shifting/d -/^state/d -/^Error:/d -/^Next/d -/^Discarding/d -/^yydestructor:/d' stderr >at-stderr -mv at-stderr stderr -# 2. Create the reference error message. -cat >expout <<'_ATEOF' -1.1: syntax error, unexpected ')', expecting "number" or '-' or '(' or '!' -1.17: syntax error, unexpected ')', expecting "number" or '-' or '(' or '!' -1.22: syntax error, unexpected '*', expecting "number" or '-' or '(' or '!' -1.40: syntax error, unexpected '*', expecting "number" or '-' or '(' or '!' -calc: error: 4444 != 1 -_ATEOF - -# 3. If locations are not used, remove them. -sed 's/^[-0-9.]*: //' expout >at-expout -mv at-expout expout -# 4. If error-verbose is not used, strip the`, unexpected....' part. -sed 's/syntax error, .*$/syntax error/' expout >at-expout -mv at-expout expout -# 5. Check -$at_traceoff -echo "calc.at:550: cat stderr" -echo calc.at:550 >$at_check_line_file -( $at_traceon; cat stderr ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -$at_diff expout $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:550: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - - -# The same, but this time exercising explicitly triggered syntax errors. -# POSIX says the lookahead causing the error should not be discarded. -cat >input <<'_ATEOF' -(!) + (0 0) = 1 -_ATEOF - -$at_traceoff -echo "calc.at:550: \$PREPARSER ./calc input" -echo calc.at:550 >$at_check_line_file -( $at_traceon; $PREPARSER ./calc input ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo stderr:; tee stderr <$at_stderr -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:550: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - - -# Normalize the observed and expected error messages, depending upon the -# options. -# 1. Remove the traces from observed. -sed '/^Starting/d -/^Entering/d -/^Stack/d -/^Reading/d -/^Reducing/d -/^Shifting/d -/^state/d -/^Error:/d -/^Next/d -/^Discarding/d -/^yydestructor:/d' stderr >at-stderr -mv at-stderr stderr -# 2. Create the reference error message. -cat >expout <<'_ATEOF' -1.9: syntax error, unexpected "number" -calc: error: 2222 != 1 -_ATEOF - -# 3. If locations are not used, remove them. -sed 's/^[-0-9.]*: //' expout >at-expout -mv at-expout expout -# 4. If error-verbose is not used, strip the`, unexpected....' part. -sed 's/syntax error, .*$/syntax error/' expout >at-expout -mv at-expout expout -# 5. Check -$at_traceoff -echo "calc.at:550: cat stderr" -echo calc.at:550 >$at_check_line_file -( $at_traceon; cat stderr ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -$at_diff expout $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:550: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - -cat >input <<'_ATEOF' -(- *) + (0 0) = 1 -_ATEOF - -$at_traceoff -echo "calc.at:550: \$PREPARSER ./calc input" -echo calc.at:550 >$at_check_line_file -( $at_traceon; $PREPARSER ./calc input ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo stderr:; tee stderr <$at_stderr -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:550: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - - -# Normalize the observed and expected error messages, depending upon the -# options. -# 1. Remove the traces from observed. -sed '/^Starting/d -/^Entering/d -/^Stack/d -/^Reading/d -/^Reducing/d -/^Shifting/d -/^state/d -/^Error:/d -/^Next/d -/^Discarding/d -/^yydestructor:/d' stderr >at-stderr -mv at-stderr stderr -# 2. Create the reference error message. -cat >expout <<'_ATEOF' -1.3: syntax error, unexpected '*', expecting "number" or '-' or '(' or '!' -1.11: syntax error, unexpected "number" -calc: error: 2222 != 1 -_ATEOF - -# 3. If locations are not used, remove them. -sed 's/^[-0-9.]*: //' expout >at-expout -mv at-expout expout -# 4. If error-verbose is not used, strip the`, unexpected....' part. -sed 's/syntax error, .*$/syntax error/' expout >at-expout -mv at-expout expout -# 5. Check -$at_traceoff -echo "calc.at:550: cat stderr" -echo calc.at:550 >$at_check_line_file -( $at_traceon; cat stderr ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -$at_diff expout $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:550: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - - - - - - - - - - - - - - - - - - - - - $at_traceoff - $at_times_p && times >$at_times_file - ) 5>&1 2>&1 | eval $at_tee_pipe - at_status=`cat $at_status_file` - ;; - - 64 ) # 64. calc.at:551: Calculator %error-verbose %locations - at_setup_line='calc.at:551' - at_desc='Calculator %error-verbose %locations' - $at_quiet $ECHO_N " 64: Calculator %error-verbose %locations $ECHO_C" - at_xfail=no - ( - echo "64. calc.at:551: testing ..." - $at_traceon - - - - - - -# Using yacc.c? - - - - - - - -# yyerror receives the location if %location & %pure & (%glr or %parse-param). - -# yyerror always sees the locations (when activated), except if -# yacc & pure & !param. - - -# The interface is pure: either because %pure-parser, or because we -# are using the C++ parsers. - - - - - - - - - - - - -cat >calc.y <<'_ATEOF' -%{ -#if HAVE_CONFIG_H -# include - /* We don't need perfect functions for these tests. */ -# undef malloc -# undef memcmp -# undef realloc -#endif -%} - -/* Infix notation calculator--calc */ -%error-verbose %locations -%{ -#include - -#include -#include -#if HAVE_UNISTD_H -# include -#else -# undef alarm -# define alarm(seconds) /* empty */ -#endif -#include - -/* Exercise pre-prologue dependency to %union. */ -typedef int semantic_value; - -static semantic_value global_result = 0; -static int global_count = 0; -%} - -/* Exercise %union. */ -%union -{ - semantic_value ival; -}; - -%{ -static int power (int base, int exponent); -/* yyerror receives the location if: - - %location & %pure & %glr - - %location & %pure & %yacc & %parse-param. */ -static void yyerror ( - - const char *s - ); -static int yylex (void); -static int yygetc (void); -static void yyungetc ( int c); -%} - -/* Bison Declarations */ -%token CALC_EOF 0 "end of input" -%token NUM "number" -%type exp - -%nonassoc '=' /* comparison */ -%left '-' '+' -%left '*' '/' -%left NEG /* negation--unary minus */ -%right '^' /* exponentiation */ - -/* Grammar follows */ -%% -input: - line -| input line { } -; - -line: - '\n' -| exp '\n' { } -; - -exp: - NUM { $$ = $1; } -| exp '=' exp - { - if ($1 != $3) - fprintf (stderr, "calc: error: %d != %d\n", $1, $3); - $$ = $1; - } -| exp '+' exp { $$ = $1 + $3; } -| exp '-' exp { $$ = $1 - $3; } -| exp '*' exp { $$ = $1 * $3; } -| exp '/' exp { $$ = $1 / $3; } -| '-' exp %prec NEG { $$ = -$2; } -| exp '^' exp { $$ = power ($1, $3); } -| '(' exp ')' { $$ = $2; } -| '(' error ')' { $$ = 1111; } -| '!' { YYERROR; } -| '-' error { YYERROR; } -; -%% -/* The input. */ -static FILE *yyin; - -static void -yyerror ( - - const char *s) -{ - - - fprintf (stderr, "%d.%d", - (yylloc).first_line, (yylloc).first_column); - if ((yylloc).first_line != (yylloc).last_line) - fprintf (stderr, "-%d.%d", - (yylloc).last_line, (yylloc).last_column - 1); - else if ((yylloc).first_column != (yylloc).last_column - 1) - fprintf (stderr, "-%d", - (yylloc).last_column - 1); - fprintf (stderr, ": "); - fprintf (stderr, "%s\n", s); -} - - - -static YYLTYPE last_yylloc; - -static int -yygetc (void) -{ - int res = getc (yyin); - ; - - last_yylloc = (yylloc); - if (res == '\n') - { - (yylloc).last_line++; - (yylloc).last_column = 0; - } - else - (yylloc).last_column++; - - return res; -} - - -static void -yyungetc ( int c) -{ - ; - - /* Wrong when C == `\n'. */ - (yylloc) = last_yylloc; - - ungetc (c, yyin); -} - -static int -read_signed_integer (void) -{ - int c = yygetc (); - int sign = 1; - int n = 0; - - ; - if (c == '-') - { - c = yygetc (); - sign = -1; - } - - while (isdigit (c)) - { - n = 10 * n + (c - '0'); - c = yygetc (); - } - - yyungetc ( c); - - return sign * n; -} - - - -/*---------------------------------------------------------------. -| Lexical analyzer returns an integer on the stack and the token | -| NUM, or the ASCII character read if not a number. Skips all | -| blanks and tabs, returns 0 for EOF. | -`---------------------------------------------------------------*/ - -static int -yylex (void) -{ - static int init = 1; - int c; - - if (init) - { - init = 0; - - (yylloc).last_column = 0; - (yylloc).last_line = 1; - - } - - (yylloc).first_column = (yylloc).last_column; - (yylloc).first_line = (yylloc).last_line; - - - /* Skip white space. */ - while ((c = yygetc ()) == ' ' || c == '\t') - { - (yylloc).first_column = (yylloc).last_column; - (yylloc).first_line = (yylloc).last_line; - - } - - /* process numbers */ - if (c == '.' || isdigit (c)) - { - yyungetc ( c); - (yylval).ival = read_signed_integer (); - return NUM; - } - - /* Return end-of-file. */ - if (c == EOF) - return CALC_EOF; - - /* Return single chars. */ - return c; -} - -static int -power (int base, int exponent) -{ - int res = 1; - if (exponent < 0) - exit (1); - for (/* Niente */; exponent; --exponent) - res *= base; - return res; -} - - -int -main (int argc, const char **argv) -{ - semantic_value result = 0; - int count = 0; - int status; - - alarm (10); - if (argc == 2) - yyin = fopen (argv[1], "r"); - else - yyin = stdin; - - if (!yyin) - { - perror (argv[1]); - exit (1); - } - - - status = yyparse (); - if (global_result != result) - abort (); - if (global_count != count) - abort (); - return status; -} -_ATEOF - - - - - -# Specify the output files to avoid problems on different file systems. -$at_traceoff -echo "calc.at:551: bison -o calc.c calc.y" -echo calc.at:551 >$at_check_line_file -( $at_traceon; bison -o calc.c calc.y ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:551: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - -$at_traceoff -echo "calc.at:551: \$CC \$CFLAGS \$CPPFLAGS \$LDFLAGS calc.c \$LIBS -o calc" -echo calc.at:551 >$at_check_line_file -( $at_traceon; $CC $CFLAGS $CPPFLAGS $LDFLAGS calc.c $LIBS -o calc ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo stderr:; cat $at_stderr -echo stdout:; cat $at_stdout -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:551: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - -# Test the priorities. -cat >input <<'_ATEOF' -1 + 2 * 3 = 7 -1 + 2 * -3 = -5 - --1^2 = -1 -(-1)^2 = 1 - ----1 = -1 - -1 - 2 - 3 = -4 -1 - (2 - 3) = 2 - -2^2^3 = 256 -(2^2)^3 = 64 -_ATEOF - -$at_traceoff -echo "calc.at:551: \$PREPARSER ./calc input" -echo calc.at:551 >$at_check_line_file -( $at_traceon; $PREPARSER ./calc input ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo stderr:; tee stderr <$at_stderr -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:551: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - - - -# Some syntax errors. -cat >input <<'_ATEOF' -0 0 -_ATEOF - -$at_traceoff -echo "calc.at:551: \$PREPARSER ./calc input" -echo calc.at:551 >$at_check_line_file -( $at_traceon; $PREPARSER ./calc input ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo stderr:; tee stderr <$at_stderr -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 1) ;; - *) echo "calc.at:551: exit code was $at_status, expected 1" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - - -# Normalize the observed and expected error messages, depending upon the -# options. -# 1. Remove the traces from observed. -sed '/^Starting/d -/^Entering/d -/^Stack/d -/^Reading/d -/^Reducing/d -/^Shifting/d -/^state/d -/^Error:/d -/^Next/d -/^Discarding/d -/^yydestructor:/d' stderr >at-stderr -mv at-stderr stderr -# 2. Create the reference error message. -cat >expout <<'_ATEOF' -1.2: syntax error, unexpected "number" -_ATEOF - -# 3. If locations are not used, remove them. - -# 4. If error-verbose is not used, strip the`, unexpected....' part. - -# 5. Check -$at_traceoff -echo "calc.at:551: cat stderr" -echo calc.at:551 >$at_check_line_file -( $at_traceon; cat stderr ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -$at_diff expout $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:551: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - -cat >input <<'_ATEOF' -1//2 -_ATEOF - -$at_traceoff -echo "calc.at:551: \$PREPARSER ./calc input" -echo calc.at:551 >$at_check_line_file -( $at_traceon; $PREPARSER ./calc input ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo stderr:; tee stderr <$at_stderr -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 1) ;; - *) echo "calc.at:551: exit code was $at_status, expected 1" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - - -# Normalize the observed and expected error messages, depending upon the -# options. -# 1. Remove the traces from observed. -sed '/^Starting/d -/^Entering/d -/^Stack/d -/^Reading/d -/^Reducing/d -/^Shifting/d -/^state/d -/^Error:/d -/^Next/d -/^Discarding/d -/^yydestructor:/d' stderr >at-stderr -mv at-stderr stderr -# 2. Create the reference error message. -cat >expout <<'_ATEOF' -1.2: syntax error, unexpected '/', expecting "number" or '-' or '(' or '!' -_ATEOF - -# 3. If locations are not used, remove them. - -# 4. If error-verbose is not used, strip the`, unexpected....' part. - -# 5. Check -$at_traceoff -echo "calc.at:551: cat stderr" -echo calc.at:551 >$at_check_line_file -( $at_traceon; cat stderr ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -$at_diff expout $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:551: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - -cat >input <<'_ATEOF' -error -_ATEOF - -$at_traceoff -echo "calc.at:551: \$PREPARSER ./calc input" -echo calc.at:551 >$at_check_line_file -( $at_traceon; $PREPARSER ./calc input ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo stderr:; tee stderr <$at_stderr -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 1) ;; - *) echo "calc.at:551: exit code was $at_status, expected 1" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - - -# Normalize the observed and expected error messages, depending upon the -# options. -# 1. Remove the traces from observed. -sed '/^Starting/d -/^Entering/d -/^Stack/d -/^Reading/d -/^Reducing/d -/^Shifting/d -/^state/d -/^Error:/d -/^Next/d -/^Discarding/d -/^yydestructor:/d' stderr >at-stderr -mv at-stderr stderr -# 2. Create the reference error message. -cat >expout <<'_ATEOF' -1.0: syntax error, unexpected $undefined -_ATEOF - -# 3. If locations are not used, remove them. - -# 4. If error-verbose is not used, strip the`, unexpected....' part. - -# 5. Check -$at_traceoff -echo "calc.at:551: cat stderr" -echo calc.at:551 >$at_check_line_file -( $at_traceon; cat stderr ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -$at_diff expout $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:551: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - -cat >input <<'_ATEOF' -1 = 2 = 3 -_ATEOF - -$at_traceoff -echo "calc.at:551: \$PREPARSER ./calc input" -echo calc.at:551 >$at_check_line_file -( $at_traceon; $PREPARSER ./calc input ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo stderr:; tee stderr <$at_stderr -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 1) ;; - *) echo "calc.at:551: exit code was $at_status, expected 1" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - - -# Normalize the observed and expected error messages, depending upon the -# options. -# 1. Remove the traces from observed. -sed '/^Starting/d -/^Entering/d -/^Stack/d -/^Reading/d -/^Reducing/d -/^Shifting/d -/^state/d -/^Error:/d -/^Next/d -/^Discarding/d -/^yydestructor:/d' stderr >at-stderr -mv at-stderr stderr -# 2. Create the reference error message. -cat >expout <<'_ATEOF' -1.6: syntax error, unexpected '=' -_ATEOF - -# 3. If locations are not used, remove them. - -# 4. If error-verbose is not used, strip the`, unexpected....' part. - -# 5. Check -$at_traceoff -echo "calc.at:551: cat stderr" -echo calc.at:551 >$at_check_line_file -( $at_traceon; cat stderr ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -$at_diff expout $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:551: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - -cat >input <<'_ATEOF' - -+1 -_ATEOF - -$at_traceoff -echo "calc.at:551: \$PREPARSER ./calc input" -echo calc.at:551 >$at_check_line_file -( $at_traceon; $PREPARSER ./calc input ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo stderr:; tee stderr <$at_stderr -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 1) ;; - *) echo "calc.at:551: exit code was $at_status, expected 1" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - - -# Normalize the observed and expected error messages, depending upon the -# options. -# 1. Remove the traces from observed. -sed '/^Starting/d -/^Entering/d -/^Stack/d -/^Reading/d -/^Reducing/d -/^Shifting/d -/^state/d -/^Error:/d -/^Next/d -/^Discarding/d -/^yydestructor:/d' stderr >at-stderr -mv at-stderr stderr -# 2. Create the reference error message. -cat >expout <<'_ATEOF' -2.0: syntax error, unexpected '+' -_ATEOF - -# 3. If locations are not used, remove them. - -# 4. If error-verbose is not used, strip the`, unexpected....' part. - -# 5. Check -$at_traceoff -echo "calc.at:551: cat stderr" -echo calc.at:551 >$at_check_line_file -( $at_traceon; cat stderr ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -$at_diff expout $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:551: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - -# Exercise error messages with EOF: work on an empty file. -$at_traceoff -echo "calc.at:551: \$PREPARSER ./calc /dev/null" -echo calc.at:551 >$at_check_line_file -( $at_traceon; $PREPARSER ./calc /dev/null ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo stderr:; tee stderr <$at_stderr -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 1) ;; - *) echo "calc.at:551: exit code was $at_status, expected 1" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - - -# Normalize the observed and expected error messages, depending upon the -# options. -# 1. Remove the traces from observed. -sed '/^Starting/d -/^Entering/d -/^Stack/d -/^Reading/d -/^Reducing/d -/^Shifting/d -/^state/d -/^Error:/d -/^Next/d -/^Discarding/d -/^yydestructor:/d' stderr >at-stderr -mv at-stderr stderr -# 2. Create the reference error message. -cat >expout <<'_ATEOF' -1.0: syntax error, unexpected "end of input" -_ATEOF - -# 3. If locations are not used, remove them. - -# 4. If error-verbose is not used, strip the`, unexpected....' part. - -# 5. Check -$at_traceoff -echo "calc.at:551: cat stderr" -echo calc.at:551 >$at_check_line_file -( $at_traceon; cat stderr ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -$at_diff expout $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:551: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - - -# Exercise the error token: without it, we die at the first error, -# hence be sure to -# -# - have several errors which exercise different shift/discardings -# - (): nothing to pop, nothing to discard -# - (1 + 1 + 1 +): a lot to pop, nothing to discard -# - (* * *): nothing to pop, a lot to discard -# - (1 + 2 * *): some to pop and discard -# -# - test the action associated to `error' -# -# - check the lookahead that triggers an error is not discarded -# when we enter error recovery. Below, the lookahead causing the -# first error is ")", which is needed to recover from the error and -# produce the "0" that triggers the "0 != 1" error. -# -cat >input <<'_ATEOF' -() + (1 + 1 + 1 +) + (* * *) + (1 * 2 * *) = 1 -_ATEOF - -$at_traceoff -echo "calc.at:551: \$PREPARSER ./calc input" -echo calc.at:551 >$at_check_line_file -( $at_traceon; $PREPARSER ./calc input ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo stderr:; tee stderr <$at_stderr -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:551: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - - -# Normalize the observed and expected error messages, depending upon the -# options. -# 1. Remove the traces from observed. -sed '/^Starting/d -/^Entering/d -/^Stack/d -/^Reading/d -/^Reducing/d -/^Shifting/d -/^state/d -/^Error:/d -/^Next/d -/^Discarding/d -/^yydestructor:/d' stderr >at-stderr -mv at-stderr stderr -# 2. Create the reference error message. -cat >expout <<'_ATEOF' -1.1: syntax error, unexpected ')', expecting "number" or '-' or '(' or '!' -1.17: syntax error, unexpected ')', expecting "number" or '-' or '(' or '!' -1.22: syntax error, unexpected '*', expecting "number" or '-' or '(' or '!' -1.40: syntax error, unexpected '*', expecting "number" or '-' or '(' or '!' -calc: error: 4444 != 1 -_ATEOF - -# 3. If locations are not used, remove them. - -# 4. If error-verbose is not used, strip the`, unexpected....' part. - -# 5. Check -$at_traceoff -echo "calc.at:551: cat stderr" -echo calc.at:551 >$at_check_line_file -( $at_traceon; cat stderr ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -$at_diff expout $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:551: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - - -# The same, but this time exercising explicitly triggered syntax errors. -# POSIX says the lookahead causing the error should not be discarded. -cat >input <<'_ATEOF' -(!) + (0 0) = 1 -_ATEOF - -$at_traceoff -echo "calc.at:551: \$PREPARSER ./calc input" -echo calc.at:551 >$at_check_line_file -( $at_traceon; $PREPARSER ./calc input ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo stderr:; tee stderr <$at_stderr -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:551: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - - -# Normalize the observed and expected error messages, depending upon the -# options. -# 1. Remove the traces from observed. -sed '/^Starting/d -/^Entering/d -/^Stack/d -/^Reading/d -/^Reducing/d -/^Shifting/d -/^state/d -/^Error:/d -/^Next/d -/^Discarding/d -/^yydestructor:/d' stderr >at-stderr -mv at-stderr stderr -# 2. Create the reference error message. -cat >expout <<'_ATEOF' -1.9: syntax error, unexpected "number" -calc: error: 2222 != 1 -_ATEOF - -# 3. If locations are not used, remove them. - -# 4. If error-verbose is not used, strip the`, unexpected....' part. - -# 5. Check -$at_traceoff -echo "calc.at:551: cat stderr" -echo calc.at:551 >$at_check_line_file -( $at_traceon; cat stderr ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -$at_diff expout $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:551: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - -cat >input <<'_ATEOF' -(- *) + (0 0) = 1 -_ATEOF - -$at_traceoff -echo "calc.at:551: \$PREPARSER ./calc input" -echo calc.at:551 >$at_check_line_file -( $at_traceon; $PREPARSER ./calc input ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo stderr:; tee stderr <$at_stderr -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:551: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - - -# Normalize the observed and expected error messages, depending upon the -# options. -# 1. Remove the traces from observed. -sed '/^Starting/d -/^Entering/d -/^Stack/d -/^Reading/d -/^Reducing/d -/^Shifting/d -/^state/d -/^Error:/d -/^Next/d -/^Discarding/d -/^yydestructor:/d' stderr >at-stderr -mv at-stderr stderr -# 2. Create the reference error message. -cat >expout <<'_ATEOF' -1.3: syntax error, unexpected '*', expecting "number" or '-' or '(' or '!' -1.11: syntax error, unexpected "number" -calc: error: 2222 != 1 -_ATEOF - -# 3. If locations are not used, remove them. - -# 4. If error-verbose is not used, strip the`, unexpected....' part. - -# 5. Check -$at_traceoff -echo "calc.at:551: cat stderr" -echo calc.at:551 >$at_check_line_file -( $at_traceon; cat stderr ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -$at_diff expout $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:551: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - - - - - - - - - - - - - - - - - - - - - $at_traceoff - $at_times_p && times >$at_times_file - ) 5>&1 2>&1 | eval $at_tee_pipe - at_status=`cat $at_status_file` - ;; - - 65 ) # 65. calc.at:553: Calculator %error-verbose %locations %defines %name-prefix="calc" %verbose %yacc - at_setup_line='calc.at:553' - at_desc='Calculator %error-verbose %locations %defines %name-prefix="calc" %verbose %yacc' - $at_quiet $ECHO_N " 65: Calculator %error-verbose %locations %defines %name-prefix="calc" %verbose %yacc$ECHO_C" - at_xfail=no - ( - echo "65. calc.at:553: testing ..." - $at_traceon - - - - - - -# Using yacc.c? - - - - - - - -# yyerror receives the location if %location & %pure & (%glr or %parse-param). - -# yyerror always sees the locations (when activated), except if -# yacc & pure & !param. - - -# The interface is pure: either because %pure-parser, or because we -# are using the C++ parsers. - - - - - - - - - - - - -cat >calc.y <<'_ATEOF' -%{ -#if HAVE_CONFIG_H -# include - /* We don't need perfect functions for these tests. */ -# undef malloc -# undef memcmp -# undef realloc -#endif -%} - -/* Infix notation calculator--calc */ -%error-verbose %locations %defines %name-prefix="calc" %verbose %yacc -%{ -#include - -#include -#include -#if HAVE_UNISTD_H -# include -#else -# undef alarm -# define alarm(seconds) /* empty */ -#endif -#include - -/* Exercise pre-prologue dependency to %union. */ -typedef int semantic_value; - -static semantic_value global_result = 0; -static int global_count = 0; -%} - -/* Exercise %union. */ -%union -{ - semantic_value ival; -}; - -%{ -static int power (int base, int exponent); -/* yyerror receives the location if: - - %location & %pure & %glr - - %location & %pure & %yacc & %parse-param. */ -static void yyerror ( - - const char *s - ); -static int yylex (void); -static int yygetc (void); -static void yyungetc ( int c); -%} - -/* Bison Declarations */ -%token CALC_EOF 0 "end of input" -%token NUM "number" -%type exp - -%nonassoc '=' /* comparison */ -%left '-' '+' -%left '*' '/' -%left NEG /* negation--unary minus */ -%right '^' /* exponentiation */ - -/* Grammar follows */ -%% -input: - line -| input line { } -; - -line: - '\n' -| exp '\n' { } -; - -exp: - NUM { $$ = $1; } -| exp '=' exp - { - if ($1 != $3) - fprintf (stderr, "calc: error: %d != %d\n", $1, $3); - $$ = $1; - } -| exp '+' exp { $$ = $1 + $3; } -| exp '-' exp { $$ = $1 - $3; } -| exp '*' exp { $$ = $1 * $3; } -| exp '/' exp { $$ = $1 / $3; } -| '-' exp %prec NEG { $$ = -$2; } -| exp '^' exp { $$ = power ($1, $3); } -| '(' exp ')' { $$ = $2; } -| '(' error ')' { $$ = 1111; } -| '!' { YYERROR; } -| '-' error { YYERROR; } -; -%% -/* The input. */ -static FILE *yyin; - -static void -yyerror ( - - const char *s) -{ - - - fprintf (stderr, "%d.%d", - (yylloc).first_line, (yylloc).first_column); - if ((yylloc).first_line != (yylloc).last_line) - fprintf (stderr, "-%d.%d", - (yylloc).last_line, (yylloc).last_column - 1); - else if ((yylloc).first_column != (yylloc).last_column - 1) - fprintf (stderr, "-%d", - (yylloc).last_column - 1); - fprintf (stderr, ": "); - fprintf (stderr, "%s\n", s); -} - - - -static YYLTYPE last_yylloc; - -static int -yygetc (void) -{ - int res = getc (yyin); - ; - - last_yylloc = (yylloc); - if (res == '\n') - { - (yylloc).last_line++; - (yylloc).last_column = 0; - } - else - (yylloc).last_column++; - - return res; -} - - -static void -yyungetc ( int c) -{ - ; - - /* Wrong when C == `\n'. */ - (yylloc) = last_yylloc; - - ungetc (c, yyin); -} - -static int -read_signed_integer (void) -{ - int c = yygetc (); - int sign = 1; - int n = 0; - - ; - if (c == '-') - { - c = yygetc (); - sign = -1; - } - - while (isdigit (c)) - { - n = 10 * n + (c - '0'); - c = yygetc (); - } - - yyungetc ( c); - - return sign * n; -} - - - -/*---------------------------------------------------------------. -| Lexical analyzer returns an integer on the stack and the token | -| NUM, or the ASCII character read if not a number. Skips all | -| blanks and tabs, returns 0 for EOF. | -`---------------------------------------------------------------*/ - -static int -yylex (void) -{ - static int init = 1; - int c; - - if (init) - { - init = 0; - - (yylloc).last_column = 0; - (yylloc).last_line = 1; - - } - - (yylloc).first_column = (yylloc).last_column; - (yylloc).first_line = (yylloc).last_line; - - - /* Skip white space. */ - while ((c = yygetc ()) == ' ' || c == '\t') - { - (yylloc).first_column = (yylloc).last_column; - (yylloc).first_line = (yylloc).last_line; - - } - - /* process numbers */ - if (c == '.' || isdigit (c)) - { - yyungetc ( c); - (yylval).ival = read_signed_integer (); - return NUM; - } - - /* Return end-of-file. */ - if (c == EOF) - return CALC_EOF; - - /* Return single chars. */ - return c; -} - -static int -power (int base, int exponent) -{ - int res = 1; - if (exponent < 0) - exit (1); - for (/* Niente */; exponent; --exponent) - res *= base; - return res; -} - - -int -main (int argc, const char **argv) -{ - semantic_value result = 0; - int count = 0; - int status; - - alarm (10); - if (argc == 2) - yyin = fopen (argv[1], "r"); - else - yyin = stdin; - - if (!yyin) - { - perror (argv[1]); - exit (1); - } - - - status = yyparse (); - if (global_result != result) - abort (); - if (global_count != count) - abort (); - return status; -} -_ATEOF - - - - - -# Specify the output files to avoid problems on different file systems. -$at_traceoff -echo "calc.at:553: bison -o calc.c calc.y" -echo calc.at:553 >$at_check_line_file -( $at_traceon; bison -o calc.c calc.y ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:553: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - -$at_traceoff -echo "calc.at:553: \$CC \$CFLAGS \$CPPFLAGS \$LDFLAGS calc.c \$LIBS -o calc" -echo calc.at:553 >$at_check_line_file -( $at_traceon; $CC $CFLAGS $CPPFLAGS $LDFLAGS calc.c $LIBS -o calc ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo stderr:; cat $at_stderr -echo stdout:; cat $at_stdout -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:553: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - -# Test the priorities. -cat >input <<'_ATEOF' -1 + 2 * 3 = 7 -1 + 2 * -3 = -5 - --1^2 = -1 -(-1)^2 = 1 - ----1 = -1 - -1 - 2 - 3 = -4 -1 - (2 - 3) = 2 - -2^2^3 = 256 -(2^2)^3 = 64 -_ATEOF - -$at_traceoff -echo "calc.at:553: \$PREPARSER ./calc input" -echo calc.at:553 >$at_check_line_file -( $at_traceon; $PREPARSER ./calc input ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo stderr:; tee stderr <$at_stderr -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:553: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - - - -# Some syntax errors. -cat >input <<'_ATEOF' -0 0 -_ATEOF - -$at_traceoff -echo "calc.at:553: \$PREPARSER ./calc input" -echo calc.at:553 >$at_check_line_file -( $at_traceon; $PREPARSER ./calc input ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo stderr:; tee stderr <$at_stderr -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 1) ;; - *) echo "calc.at:553: exit code was $at_status, expected 1" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - - -# Normalize the observed and expected error messages, depending upon the -# options. -# 1. Remove the traces from observed. -sed '/^Starting/d -/^Entering/d -/^Stack/d -/^Reading/d -/^Reducing/d -/^Shifting/d -/^state/d -/^Error:/d -/^Next/d -/^Discarding/d -/^yydestructor:/d' stderr >at-stderr -mv at-stderr stderr -# 2. Create the reference error message. -cat >expout <<'_ATEOF' -1.2: syntax error, unexpected "number" -_ATEOF - -# 3. If locations are not used, remove them. - -# 4. If error-verbose is not used, strip the`, unexpected....' part. - -# 5. Check -$at_traceoff -echo "calc.at:553: cat stderr" -echo calc.at:553 >$at_check_line_file -( $at_traceon; cat stderr ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -$at_diff expout $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:553: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - -cat >input <<'_ATEOF' -1//2 -_ATEOF - -$at_traceoff -echo "calc.at:553: \$PREPARSER ./calc input" -echo calc.at:553 >$at_check_line_file -( $at_traceon; $PREPARSER ./calc input ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo stderr:; tee stderr <$at_stderr -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 1) ;; - *) echo "calc.at:553: exit code was $at_status, expected 1" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - - -# Normalize the observed and expected error messages, depending upon the -# options. -# 1. Remove the traces from observed. -sed '/^Starting/d -/^Entering/d -/^Stack/d -/^Reading/d -/^Reducing/d -/^Shifting/d -/^state/d -/^Error:/d -/^Next/d -/^Discarding/d -/^yydestructor:/d' stderr >at-stderr -mv at-stderr stderr -# 2. Create the reference error message. -cat >expout <<'_ATEOF' -1.2: syntax error, unexpected '/', expecting "number" or '-' or '(' or '!' -_ATEOF - -# 3. If locations are not used, remove them. - -# 4. If error-verbose is not used, strip the`, unexpected....' part. - -# 5. Check -$at_traceoff -echo "calc.at:553: cat stderr" -echo calc.at:553 >$at_check_line_file -( $at_traceon; cat stderr ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -$at_diff expout $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:553: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - -cat >input <<'_ATEOF' -error -_ATEOF - -$at_traceoff -echo "calc.at:553: \$PREPARSER ./calc input" -echo calc.at:553 >$at_check_line_file -( $at_traceon; $PREPARSER ./calc input ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo stderr:; tee stderr <$at_stderr -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 1) ;; - *) echo "calc.at:553: exit code was $at_status, expected 1" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - - -# Normalize the observed and expected error messages, depending upon the -# options. -# 1. Remove the traces from observed. -sed '/^Starting/d -/^Entering/d -/^Stack/d -/^Reading/d -/^Reducing/d -/^Shifting/d -/^state/d -/^Error:/d -/^Next/d -/^Discarding/d -/^yydestructor:/d' stderr >at-stderr -mv at-stderr stderr -# 2. Create the reference error message. -cat >expout <<'_ATEOF' -1.0: syntax error, unexpected $undefined -_ATEOF - -# 3. If locations are not used, remove them. - -# 4. If error-verbose is not used, strip the`, unexpected....' part. - -# 5. Check -$at_traceoff -echo "calc.at:553: cat stderr" -echo calc.at:553 >$at_check_line_file -( $at_traceon; cat stderr ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -$at_diff expout $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:553: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - -cat >input <<'_ATEOF' -1 = 2 = 3 -_ATEOF - -$at_traceoff -echo "calc.at:553: \$PREPARSER ./calc input" -echo calc.at:553 >$at_check_line_file -( $at_traceon; $PREPARSER ./calc input ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo stderr:; tee stderr <$at_stderr -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 1) ;; - *) echo "calc.at:553: exit code was $at_status, expected 1" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - - -# Normalize the observed and expected error messages, depending upon the -# options. -# 1. Remove the traces from observed. -sed '/^Starting/d -/^Entering/d -/^Stack/d -/^Reading/d -/^Reducing/d -/^Shifting/d -/^state/d -/^Error:/d -/^Next/d -/^Discarding/d -/^yydestructor:/d' stderr >at-stderr -mv at-stderr stderr -# 2. Create the reference error message. -cat >expout <<'_ATEOF' -1.6: syntax error, unexpected '=' -_ATEOF - -# 3. If locations are not used, remove them. - -# 4. If error-verbose is not used, strip the`, unexpected....' part. - -# 5. Check -$at_traceoff -echo "calc.at:553: cat stderr" -echo calc.at:553 >$at_check_line_file -( $at_traceon; cat stderr ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -$at_diff expout $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:553: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - -cat >input <<'_ATEOF' - -+1 -_ATEOF - -$at_traceoff -echo "calc.at:553: \$PREPARSER ./calc input" -echo calc.at:553 >$at_check_line_file -( $at_traceon; $PREPARSER ./calc input ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo stderr:; tee stderr <$at_stderr -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 1) ;; - *) echo "calc.at:553: exit code was $at_status, expected 1" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - - -# Normalize the observed and expected error messages, depending upon the -# options. -# 1. Remove the traces from observed. -sed '/^Starting/d -/^Entering/d -/^Stack/d -/^Reading/d -/^Reducing/d -/^Shifting/d -/^state/d -/^Error:/d -/^Next/d -/^Discarding/d -/^yydestructor:/d' stderr >at-stderr -mv at-stderr stderr -# 2. Create the reference error message. -cat >expout <<'_ATEOF' -2.0: syntax error, unexpected '+' -_ATEOF - -# 3. If locations are not used, remove them. - -# 4. If error-verbose is not used, strip the`, unexpected....' part. - -# 5. Check -$at_traceoff -echo "calc.at:553: cat stderr" -echo calc.at:553 >$at_check_line_file -( $at_traceon; cat stderr ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -$at_diff expout $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:553: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - -# Exercise error messages with EOF: work on an empty file. -$at_traceoff -echo "calc.at:553: \$PREPARSER ./calc /dev/null" -echo calc.at:553 >$at_check_line_file -( $at_traceon; $PREPARSER ./calc /dev/null ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo stderr:; tee stderr <$at_stderr -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 1) ;; - *) echo "calc.at:553: exit code was $at_status, expected 1" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - - -# Normalize the observed and expected error messages, depending upon the -# options. -# 1. Remove the traces from observed. -sed '/^Starting/d -/^Entering/d -/^Stack/d -/^Reading/d -/^Reducing/d -/^Shifting/d -/^state/d -/^Error:/d -/^Next/d -/^Discarding/d -/^yydestructor:/d' stderr >at-stderr -mv at-stderr stderr -# 2. Create the reference error message. -cat >expout <<'_ATEOF' -1.0: syntax error, unexpected "end of input" -_ATEOF - -# 3. If locations are not used, remove them. - -# 4. If error-verbose is not used, strip the`, unexpected....' part. - -# 5. Check -$at_traceoff -echo "calc.at:553: cat stderr" -echo calc.at:553 >$at_check_line_file -( $at_traceon; cat stderr ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -$at_diff expout $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:553: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - - -# Exercise the error token: without it, we die at the first error, -# hence be sure to -# -# - have several errors which exercise different shift/discardings -# - (): nothing to pop, nothing to discard -# - (1 + 1 + 1 +): a lot to pop, nothing to discard -# - (* * *): nothing to pop, a lot to discard -# - (1 + 2 * *): some to pop and discard -# -# - test the action associated to `error' -# -# - check the lookahead that triggers an error is not discarded -# when we enter error recovery. Below, the lookahead causing the -# first error is ")", which is needed to recover from the error and -# produce the "0" that triggers the "0 != 1" error. -# -cat >input <<'_ATEOF' -() + (1 + 1 + 1 +) + (* * *) + (1 * 2 * *) = 1 -_ATEOF - -$at_traceoff -echo "calc.at:553: \$PREPARSER ./calc input" -echo calc.at:553 >$at_check_line_file -( $at_traceon; $PREPARSER ./calc input ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo stderr:; tee stderr <$at_stderr -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:553: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - - -# Normalize the observed and expected error messages, depending upon the -# options. -# 1. Remove the traces from observed. -sed '/^Starting/d -/^Entering/d -/^Stack/d -/^Reading/d -/^Reducing/d -/^Shifting/d -/^state/d -/^Error:/d -/^Next/d -/^Discarding/d -/^yydestructor:/d' stderr >at-stderr -mv at-stderr stderr -# 2. Create the reference error message. -cat >expout <<'_ATEOF' -1.1: syntax error, unexpected ')', expecting "number" or '-' or '(' or '!' -1.17: syntax error, unexpected ')', expecting "number" or '-' or '(' or '!' -1.22: syntax error, unexpected '*', expecting "number" or '-' or '(' or '!' -1.40: syntax error, unexpected '*', expecting "number" or '-' or '(' or '!' -calc: error: 4444 != 1 -_ATEOF - -# 3. If locations are not used, remove them. - -# 4. If error-verbose is not used, strip the`, unexpected....' part. - -# 5. Check -$at_traceoff -echo "calc.at:553: cat stderr" -echo calc.at:553 >$at_check_line_file -( $at_traceon; cat stderr ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -$at_diff expout $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:553: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - - -# The same, but this time exercising explicitly triggered syntax errors. -# POSIX says the lookahead causing the error should not be discarded. -cat >input <<'_ATEOF' -(!) + (0 0) = 1 -_ATEOF - -$at_traceoff -echo "calc.at:553: \$PREPARSER ./calc input" -echo calc.at:553 >$at_check_line_file -( $at_traceon; $PREPARSER ./calc input ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo stderr:; tee stderr <$at_stderr -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:553: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - - -# Normalize the observed and expected error messages, depending upon the -# options. -# 1. Remove the traces from observed. -sed '/^Starting/d -/^Entering/d -/^Stack/d -/^Reading/d -/^Reducing/d -/^Shifting/d -/^state/d -/^Error:/d -/^Next/d -/^Discarding/d -/^yydestructor:/d' stderr >at-stderr -mv at-stderr stderr -# 2. Create the reference error message. -cat >expout <<'_ATEOF' -1.9: syntax error, unexpected "number" -calc: error: 2222 != 1 -_ATEOF - -# 3. If locations are not used, remove them. - -# 4. If error-verbose is not used, strip the`, unexpected....' part. - -# 5. Check -$at_traceoff -echo "calc.at:553: cat stderr" -echo calc.at:553 >$at_check_line_file -( $at_traceon; cat stderr ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -$at_diff expout $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:553: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - -cat >input <<'_ATEOF' -(- *) + (0 0) = 1 -_ATEOF - -$at_traceoff -echo "calc.at:553: \$PREPARSER ./calc input" -echo calc.at:553 >$at_check_line_file -( $at_traceon; $PREPARSER ./calc input ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo stderr:; tee stderr <$at_stderr -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:553: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - - -# Normalize the observed and expected error messages, depending upon the -# options. -# 1. Remove the traces from observed. -sed '/^Starting/d -/^Entering/d -/^Stack/d -/^Reading/d -/^Reducing/d -/^Shifting/d -/^state/d -/^Error:/d -/^Next/d -/^Discarding/d -/^yydestructor:/d' stderr >at-stderr -mv at-stderr stderr -# 2. Create the reference error message. -cat >expout <<'_ATEOF' -1.3: syntax error, unexpected '*', expecting "number" or '-' or '(' or '!' -1.11: syntax error, unexpected "number" -calc: error: 2222 != 1 -_ATEOF - -# 3. If locations are not used, remove them. - -# 4. If error-verbose is not used, strip the`, unexpected....' part. - -# 5. Check -$at_traceoff -echo "calc.at:553: cat stderr" -echo calc.at:553 >$at_check_line_file -( $at_traceon; cat stderr ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -$at_diff expout $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:553: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - - - - - - - - - - - - - - - - - - - - - $at_traceoff - $at_times_p && times >$at_times_file - ) 5>&1 2>&1 | eval $at_tee_pipe - at_status=`cat $at_status_file` - ;; - - 66 ) # 66. calc.at:555: Calculator %debug - at_setup_line='calc.at:555' - at_desc='Calculator %debug' - $at_quiet $ECHO_N " 66: Calculator %debug $ECHO_C" - at_xfail=no - ( - echo "66. calc.at:555: testing ..." - $at_traceon - - - - - - -# Using yacc.c? - - - - - - - -# yyerror receives the location if %location & %pure & (%glr or %parse-param). - -# yyerror always sees the locations (when activated), except if -# yacc & pure & !param. - - -# The interface is pure: either because %pure-parser, or because we -# are using the C++ parsers. - - - - - - - - - - - - -cat >calc.y <<'_ATEOF' -%{ -#if HAVE_CONFIG_H -# include - /* We don't need perfect functions for these tests. */ -# undef malloc -# undef memcmp -# undef realloc -#endif -%} - -/* Infix notation calculator--calc */ -%debug -%{ -#include - -#include -#include -#if HAVE_UNISTD_H -# include -#else -# undef alarm -# define alarm(seconds) /* empty */ -#endif -#include - -/* Exercise pre-prologue dependency to %union. */ -typedef int semantic_value; - -static semantic_value global_result = 0; -static int global_count = 0; -%} - -/* Exercise %union. */ -%union -{ - semantic_value ival; -}; - -%{ -static int power (int base, int exponent); -/* yyerror receives the location if: - - %location & %pure & %glr - - %location & %pure & %yacc & %parse-param. */ -static void yyerror ( - - const char *s - ); -static int yylex (void); -static int yygetc (void); -static void yyungetc ( int c); -%} - -/* Bison Declarations */ -%token CALC_EOF 0 "end of input" -%token NUM "number" -%type exp - -%nonassoc '=' /* comparison */ -%left '-' '+' -%left '*' '/' -%left NEG /* negation--unary minus */ -%right '^' /* exponentiation */ - -/* Grammar follows */ -%% -input: - line -| input line { } -; - -line: - '\n' -| exp '\n' { } -; - -exp: - NUM { $$ = $1; } -| exp '=' exp - { - if ($1 != $3) - fprintf (stderr, "calc: error: %d != %d\n", $1, $3); - $$ = $1; - } -| exp '+' exp { $$ = $1 + $3; } -| exp '-' exp { $$ = $1 - $3; } -| exp '*' exp { $$ = $1 * $3; } -| exp '/' exp { $$ = $1 / $3; } -| '-' exp %prec NEG { $$ = -$2; } -| exp '^' exp { $$ = power ($1, $3); } -| '(' exp ')' { $$ = $2; } -| '(' error ')' { $$ = 1111; } -| '!' { YYERROR; } -| '-' error { YYERROR; } -; -%% -/* The input. */ -static FILE *yyin; - -static void -yyerror ( - - const char *s) -{ - - - fprintf (stderr, "%s\n", s); -} - - - -static int -yygetc (void) -{ - int res = getc (yyin); - ; - - return res; -} - - -static void -yyungetc ( int c) -{ - ; - - ungetc (c, yyin); -} - -static int -read_signed_integer (void) -{ - int c = yygetc (); - int sign = 1; - int n = 0; - - ; - if (c == '-') - { - c = yygetc (); - sign = -1; - } - - while (isdigit (c)) - { - n = 10 * n + (c - '0'); - c = yygetc (); - } - - yyungetc ( c); - - return sign * n; -} - - - -/*---------------------------------------------------------------. -| Lexical analyzer returns an integer on the stack and the token | -| NUM, or the ASCII character read if not a number. Skips all | -| blanks and tabs, returns 0 for EOF. | -`---------------------------------------------------------------*/ - -static int -yylex (void) -{ - static int init = 1; - int c; - - if (init) - { - init = 0; - - } - - - - /* Skip white space. */ - while ((c = yygetc ()) == ' ' || c == '\t') - { - - } - - /* process numbers */ - if (c == '.' || isdigit (c)) - { - yyungetc ( c); - (yylval).ival = read_signed_integer (); - return NUM; - } - - /* Return end-of-file. */ - if (c == EOF) - return CALC_EOF; - - /* Return single chars. */ - return c; -} - -static int -power (int base, int exponent) -{ - int res = 1; - if (exponent < 0) - exit (1); - for (/* Niente */; exponent; --exponent) - res *= base; - return res; -} - - -int -main (int argc, const char **argv) -{ - semantic_value result = 0; - int count = 0; - int status; - - alarm (10); - if (argc == 2) - yyin = fopen (argv[1], "r"); - else - yyin = stdin; - - if (!yyin) - { - perror (argv[1]); - exit (1); - } - - yydebug = 1; - status = yyparse (); - if (global_result != result) - abort (); - if (global_count != count) - abort (); - return status; -} -_ATEOF - - - - - -# Specify the output files to avoid problems on different file systems. -$at_traceoff -echo "calc.at:555: bison -o calc.c calc.y" -echo calc.at:555 >$at_check_line_file -( $at_traceon; bison -o calc.c calc.y ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:555: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - -$at_traceoff -echo "calc.at:555: \$CC \$CFLAGS \$CPPFLAGS \$LDFLAGS calc.c \$LIBS -o calc" -echo calc.at:555 >$at_check_line_file -( $at_traceon; $CC $CFLAGS $CPPFLAGS $LDFLAGS calc.c $LIBS -o calc ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo stderr:; cat $at_stderr -echo stdout:; cat $at_stdout -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:555: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - -# Test the priorities. -cat >input <<'_ATEOF' -1 + 2 * 3 = 7 -1 + 2 * -3 = -5 - --1^2 = -1 -(-1)^2 = 1 - ----1 = -1 - -1 - 2 - 3 = -4 -1 - (2 - 3) = 2 - -2^2^3 = 256 -(2^2)^3 = 64 -_ATEOF - -$at_traceoff -echo "calc.at:555: \$PREPARSER ./calc input" -echo calc.at:555 >$at_check_line_file -( $at_traceon; $PREPARSER ./calc input ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo stderr:; tee stderr <$at_stderr -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:555: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - -$at_traceoff -echo "calc.at:555: wc -l $at_check_line_file -( $at_traceon; wc -l $at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -echo >>$at_stdout; echo "486 -" | $at_diff - $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:555: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - - -# Some syntax errors. -cat >input <<'_ATEOF' -0 0 -_ATEOF - -$at_traceoff -echo "calc.at:555: \$PREPARSER ./calc input" -echo calc.at:555 >$at_check_line_file -( $at_traceon; $PREPARSER ./calc input ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo stderr:; tee stderr <$at_stderr -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 1) ;; - *) echo "calc.at:555: exit code was $at_status, expected 1" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - -$at_traceoff -echo "calc.at:555: wc -l $at_check_line_file -( $at_traceon; wc -l $at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -echo >>$at_stdout; echo "11 -" | $at_diff - $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:555: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - -# Normalize the observed and expected error messages, depending upon the -# options. -# 1. Remove the traces from observed. -sed '/^Starting/d -/^Entering/d -/^Stack/d -/^Reading/d -/^Reducing/d -/^Shifting/d -/^state/d -/^Error:/d -/^Next/d -/^Discarding/d -/^yydestructor:/d' stderr >at-stderr -mv at-stderr stderr -# 2. Create the reference error message. -cat >expout <<'_ATEOF' -1.2: syntax error, unexpected "number" -_ATEOF - -# 3. If locations are not used, remove them. -sed 's/^[-0-9.]*: //' expout >at-expout -mv at-expout expout -# 4. If error-verbose is not used, strip the`, unexpected....' part. -sed 's/syntax error, .*$/syntax error/' expout >at-expout -mv at-expout expout -# 5. Check -$at_traceoff -echo "calc.at:555: cat stderr" -echo calc.at:555 >$at_check_line_file -( $at_traceon; cat stderr ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -$at_diff expout $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:555: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - -cat >input <<'_ATEOF' -1//2 -_ATEOF - -$at_traceoff -echo "calc.at:555: \$PREPARSER ./calc input" -echo calc.at:555 >$at_check_line_file -( $at_traceon; $PREPARSER ./calc input ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo stderr:; tee stderr <$at_stderr -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 1) ;; - *) echo "calc.at:555: exit code was $at_status, expected 1" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - -$at_traceoff -echo "calc.at:555: wc -l $at_check_line_file -( $at_traceon; wc -l $at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -echo >>$at_stdout; echo "15 -" | $at_diff - $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:555: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - -# Normalize the observed and expected error messages, depending upon the -# options. -# 1. Remove the traces from observed. -sed '/^Starting/d -/^Entering/d -/^Stack/d -/^Reading/d -/^Reducing/d -/^Shifting/d -/^state/d -/^Error:/d -/^Next/d -/^Discarding/d -/^yydestructor:/d' stderr >at-stderr -mv at-stderr stderr -# 2. Create the reference error message. -cat >expout <<'_ATEOF' -1.2: syntax error, unexpected '/', expecting "number" or '-' or '(' or '!' -_ATEOF - -# 3. If locations are not used, remove them. -sed 's/^[-0-9.]*: //' expout >at-expout -mv at-expout expout -# 4. If error-verbose is not used, strip the`, unexpected....' part. -sed 's/syntax error, .*$/syntax error/' expout >at-expout -mv at-expout expout -# 5. Check -$at_traceoff -echo "calc.at:555: cat stderr" -echo calc.at:555 >$at_check_line_file -( $at_traceon; cat stderr ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -$at_diff expout $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:555: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - -cat >input <<'_ATEOF' -error -_ATEOF - -$at_traceoff -echo "calc.at:555: \$PREPARSER ./calc input" -echo calc.at:555 >$at_check_line_file -( $at_traceon; $PREPARSER ./calc input ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo stderr:; tee stderr <$at_stderr -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 1) ;; - *) echo "calc.at:555: exit code was $at_status, expected 1" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - -$at_traceoff -echo "calc.at:555: wc -l $at_check_line_file -( $at_traceon; wc -l $at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -echo >>$at_stdout; echo "4 -" | $at_diff - $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:555: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - -# Normalize the observed and expected error messages, depending upon the -# options. -# 1. Remove the traces from observed. -sed '/^Starting/d -/^Entering/d -/^Stack/d -/^Reading/d -/^Reducing/d -/^Shifting/d -/^state/d -/^Error:/d -/^Next/d -/^Discarding/d -/^yydestructor:/d' stderr >at-stderr -mv at-stderr stderr -# 2. Create the reference error message. -cat >expout <<'_ATEOF' -1.0: syntax error, unexpected $undefined -_ATEOF - -# 3. If locations are not used, remove them. -sed 's/^[-0-9.]*: //' expout >at-expout -mv at-expout expout -# 4. If error-verbose is not used, strip the`, unexpected....' part. -sed 's/syntax error, .*$/syntax error/' expout >at-expout -mv at-expout expout -# 5. Check -$at_traceoff -echo "calc.at:555: cat stderr" -echo calc.at:555 >$at_check_line_file -( $at_traceon; cat stderr ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -$at_diff expout $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:555: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - -cat >input <<'_ATEOF' -1 = 2 = 3 -_ATEOF - -$at_traceoff -echo "calc.at:555: \$PREPARSER ./calc input" -echo calc.at:555 >$at_check_line_file -( $at_traceon; $PREPARSER ./calc input ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo stderr:; tee stderr <$at_stderr -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 1) ;; - *) echo "calc.at:555: exit code was $at_status, expected 1" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - -$at_traceoff -echo "calc.at:555: wc -l $at_check_line_file -( $at_traceon; wc -l $at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -echo >>$at_stdout; echo "22 -" | $at_diff - $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:555: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - -# Normalize the observed and expected error messages, depending upon the -# options. -# 1. Remove the traces from observed. -sed '/^Starting/d -/^Entering/d -/^Stack/d -/^Reading/d -/^Reducing/d -/^Shifting/d -/^state/d -/^Error:/d -/^Next/d -/^Discarding/d -/^yydestructor:/d' stderr >at-stderr -mv at-stderr stderr -# 2. Create the reference error message. -cat >expout <<'_ATEOF' -1.6: syntax error, unexpected '=' -_ATEOF - -# 3. If locations are not used, remove them. -sed 's/^[-0-9.]*: //' expout >at-expout -mv at-expout expout -# 4. If error-verbose is not used, strip the`, unexpected....' part. -sed 's/syntax error, .*$/syntax error/' expout >at-expout -mv at-expout expout -# 5. Check -$at_traceoff -echo "calc.at:555: cat stderr" -echo calc.at:555 >$at_check_line_file -( $at_traceon; cat stderr ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -$at_diff expout $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:555: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - -cat >input <<'_ATEOF' - -+1 -_ATEOF - -$at_traceoff -echo "calc.at:555: \$PREPARSER ./calc input" -echo calc.at:555 >$at_check_line_file -( $at_traceon; $PREPARSER ./calc input ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo stderr:; tee stderr <$at_stderr -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 1) ;; - *) echo "calc.at:555: exit code was $at_status, expected 1" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - -$at_traceoff -echo "calc.at:555: wc -l $at_check_line_file -( $at_traceon; wc -l $at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -echo >>$at_stdout; echo "14 -" | $at_diff - $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:555: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - -# Normalize the observed and expected error messages, depending upon the -# options. -# 1. Remove the traces from observed. -sed '/^Starting/d -/^Entering/d -/^Stack/d -/^Reading/d -/^Reducing/d -/^Shifting/d -/^state/d -/^Error:/d -/^Next/d -/^Discarding/d -/^yydestructor:/d' stderr >at-stderr -mv at-stderr stderr -# 2. Create the reference error message. -cat >expout <<'_ATEOF' -2.0: syntax error, unexpected '+' -_ATEOF - -# 3. If locations are not used, remove them. -sed 's/^[-0-9.]*: //' expout >at-expout -mv at-expout expout -# 4. If error-verbose is not used, strip the`, unexpected....' part. -sed 's/syntax error, .*$/syntax error/' expout >at-expout -mv at-expout expout -# 5. Check -$at_traceoff -echo "calc.at:555: cat stderr" -echo calc.at:555 >$at_check_line_file -( $at_traceon; cat stderr ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -$at_diff expout $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:555: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - -# Exercise error messages with EOF: work on an empty file. -$at_traceoff -echo "calc.at:555: \$PREPARSER ./calc /dev/null" -echo calc.at:555 >$at_check_line_file -( $at_traceon; $PREPARSER ./calc /dev/null ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo stderr:; tee stderr <$at_stderr -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 1) ;; - *) echo "calc.at:555: exit code was $at_status, expected 1" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - -$at_traceoff -echo "calc.at:555: wc -l $at_check_line_file -( $at_traceon; wc -l $at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -echo >>$at_stdout; echo "4 -" | $at_diff - $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:555: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - -# Normalize the observed and expected error messages, depending upon the -# options. -# 1. Remove the traces from observed. -sed '/^Starting/d -/^Entering/d -/^Stack/d -/^Reading/d -/^Reducing/d -/^Shifting/d -/^state/d -/^Error:/d -/^Next/d -/^Discarding/d -/^yydestructor:/d' stderr >at-stderr -mv at-stderr stderr -# 2. Create the reference error message. -cat >expout <<'_ATEOF' -1.0: syntax error, unexpected "end of input" -_ATEOF - -# 3. If locations are not used, remove them. -sed 's/^[-0-9.]*: //' expout >at-expout -mv at-expout expout -# 4. If error-verbose is not used, strip the`, unexpected....' part. -sed 's/syntax error, .*$/syntax error/' expout >at-expout -mv at-expout expout -# 5. Check -$at_traceoff -echo "calc.at:555: cat stderr" -echo calc.at:555 >$at_check_line_file -( $at_traceon; cat stderr ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -$at_diff expout $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:555: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - - -# Exercise the error token: without it, we die at the first error, -# hence be sure to -# -# - have several errors which exercise different shift/discardings -# - (): nothing to pop, nothing to discard -# - (1 + 1 + 1 +): a lot to pop, nothing to discard -# - (* * *): nothing to pop, a lot to discard -# - (1 + 2 * *): some to pop and discard -# -# - test the action associated to `error' -# -# - check the lookahead that triggers an error is not discarded -# when we enter error recovery. Below, the lookahead causing the -# first error is ")", which is needed to recover from the error and -# produce the "0" that triggers the "0 != 1" error. -# -cat >input <<'_ATEOF' -() + (1 + 1 + 1 +) + (* * *) + (1 * 2 * *) = 1 -_ATEOF - -$at_traceoff -echo "calc.at:555: \$PREPARSER ./calc input" -echo calc.at:555 >$at_check_line_file -( $at_traceon; $PREPARSER ./calc input ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo stderr:; tee stderr <$at_stderr -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:555: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - -$at_traceoff -echo "calc.at:555: wc -l $at_check_line_file -( $at_traceon; wc -l $at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -echo >>$at_stdout; echo "156 -" | $at_diff - $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:555: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - -# Normalize the observed and expected error messages, depending upon the -# options. -# 1. Remove the traces from observed. -sed '/^Starting/d -/^Entering/d -/^Stack/d -/^Reading/d -/^Reducing/d -/^Shifting/d -/^state/d -/^Error:/d -/^Next/d -/^Discarding/d -/^yydestructor:/d' stderr >at-stderr -mv at-stderr stderr -# 2. Create the reference error message. -cat >expout <<'_ATEOF' -1.1: syntax error, unexpected ')', expecting "number" or '-' or '(' or '!' -1.17: syntax error, unexpected ')', expecting "number" or '-' or '(' or '!' -1.22: syntax error, unexpected '*', expecting "number" or '-' or '(' or '!' -1.40: syntax error, unexpected '*', expecting "number" or '-' or '(' or '!' -calc: error: 4444 != 1 -_ATEOF - -# 3. If locations are not used, remove them. -sed 's/^[-0-9.]*: //' expout >at-expout -mv at-expout expout -# 4. If error-verbose is not used, strip the`, unexpected....' part. -sed 's/syntax error, .*$/syntax error/' expout >at-expout -mv at-expout expout -# 5. Check -$at_traceoff -echo "calc.at:555: cat stderr" -echo calc.at:555 >$at_check_line_file -( $at_traceon; cat stderr ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -$at_diff expout $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:555: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - - -# The same, but this time exercising explicitly triggered syntax errors. -# POSIX says the lookahead causing the error should not be discarded. -cat >input <<'_ATEOF' -(!) + (0 0) = 1 -_ATEOF - -$at_traceoff -echo "calc.at:555: \$PREPARSER ./calc input" -echo calc.at:555 >$at_check_line_file -( $at_traceon; $PREPARSER ./calc input ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo stderr:; tee stderr <$at_stderr -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:555: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - -$at_traceoff -echo "calc.at:555: wc -l $at_check_line_file -( $at_traceon; wc -l $at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -echo >>$at_stdout; echo "62 -" | $at_diff - $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:555: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - -# Normalize the observed and expected error messages, depending upon the -# options. -# 1. Remove the traces from observed. -sed '/^Starting/d -/^Entering/d -/^Stack/d -/^Reading/d -/^Reducing/d -/^Shifting/d -/^state/d -/^Error:/d -/^Next/d -/^Discarding/d -/^yydestructor:/d' stderr >at-stderr -mv at-stderr stderr -# 2. Create the reference error message. -cat >expout <<'_ATEOF' -1.9: syntax error, unexpected "number" -calc: error: 2222 != 1 -_ATEOF - -# 3. If locations are not used, remove them. -sed 's/^[-0-9.]*: //' expout >at-expout -mv at-expout expout -# 4. If error-verbose is not used, strip the`, unexpected....' part. -sed 's/syntax error, .*$/syntax error/' expout >at-expout -mv at-expout expout -# 5. Check -$at_traceoff -echo "calc.at:555: cat stderr" -echo calc.at:555 >$at_check_line_file -( $at_traceon; cat stderr ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -$at_diff expout $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:555: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - -cat >input <<'_ATEOF' -(- *) + (0 0) = 1 -_ATEOF - -$at_traceoff -echo "calc.at:555: \$PREPARSER ./calc input" -echo calc.at:555 >$at_check_line_file -( $at_traceon; $PREPARSER ./calc input ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo stderr:; tee stderr <$at_stderr -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:555: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - -$at_traceoff -echo "calc.at:555: wc -l $at_check_line_file -( $at_traceon; wc -l $at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -echo >>$at_stdout; echo "70 -" | $at_diff - $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:555: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - -# Normalize the observed and expected error messages, depending upon the -# options. -# 1. Remove the traces from observed. -sed '/^Starting/d -/^Entering/d -/^Stack/d -/^Reading/d -/^Reducing/d -/^Shifting/d -/^state/d -/^Error:/d -/^Next/d -/^Discarding/d -/^yydestructor:/d' stderr >at-stderr -mv at-stderr stderr -# 2. Create the reference error message. -cat >expout <<'_ATEOF' -1.3: syntax error, unexpected '*', expecting "number" or '-' or '(' or '!' -1.11: syntax error, unexpected "number" -calc: error: 2222 != 1 -_ATEOF - -# 3. If locations are not used, remove them. -sed 's/^[-0-9.]*: //' expout >at-expout -mv at-expout expout -# 4. If error-verbose is not used, strip the`, unexpected....' part. -sed 's/syntax error, .*$/syntax error/' expout >at-expout -mv at-expout expout -# 5. Check -$at_traceoff -echo "calc.at:555: cat stderr" -echo calc.at:555 >$at_check_line_file -( $at_traceon; cat stderr ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -$at_diff expout $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:555: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - - - - - - - - - - - - - - - - - - - - - $at_traceoff - $at_times_p && times >$at_times_file - ) 5>&1 2>&1 | eval $at_tee_pipe - at_status=`cat $at_status_file` - ;; - - 67 ) # 67. calc.at:556: Calculator %error-verbose %debug %locations %defines %name-prefix="calc" %verbose %yacc - at_setup_line='calc.at:556' - at_desc='Calculator %error-verbose %debug %locations %defines %name-prefix="calc" %verbose %yacc' - $at_quiet $ECHO_N " 67: Calculator %error-verbose %debug %locations %defines %name-prefix="calc" %verbose %yacc$ECHO_C" - at_xfail=no - ( - echo "67. calc.at:556: testing ..." - $at_traceon - - - - - - -# Using yacc.c? - - - - - - - -# yyerror receives the location if %location & %pure & (%glr or %parse-param). - -# yyerror always sees the locations (when activated), except if -# yacc & pure & !param. - - -# The interface is pure: either because %pure-parser, or because we -# are using the C++ parsers. - - - - - - - - - - - - -cat >calc.y <<'_ATEOF' -%{ -#if HAVE_CONFIG_H -# include - /* We don't need perfect functions for these tests. */ -# undef malloc -# undef memcmp -# undef realloc -#endif -%} - -/* Infix notation calculator--calc */ -%error-verbose %debug %locations %defines %name-prefix="calc" %verbose %yacc -%{ -#include - -#include -#include -#if HAVE_UNISTD_H -# include -#else -# undef alarm -# define alarm(seconds) /* empty */ -#endif -#include - -/* Exercise pre-prologue dependency to %union. */ -typedef int semantic_value; - -static semantic_value global_result = 0; -static int global_count = 0; -%} - -/* Exercise %union. */ -%union -{ - semantic_value ival; -}; - -%{ -static int power (int base, int exponent); -/* yyerror receives the location if: - - %location & %pure & %glr - - %location & %pure & %yacc & %parse-param. */ -static void yyerror ( - - const char *s - ); -static int yylex (void); -static int yygetc (void); -static void yyungetc ( int c); -%} - -/* Bison Declarations */ -%token CALC_EOF 0 "end of input" -%token NUM "number" -%type exp - -%nonassoc '=' /* comparison */ -%left '-' '+' -%left '*' '/' -%left NEG /* negation--unary minus */ -%right '^' /* exponentiation */ - -/* Grammar follows */ -%% -input: - line -| input line { } -; - -line: - '\n' -| exp '\n' { } -; - -exp: - NUM { $$ = $1; } -| exp '=' exp - { - if ($1 != $3) - fprintf (stderr, "calc: error: %d != %d\n", $1, $3); - $$ = $1; - } -| exp '+' exp { $$ = $1 + $3; } -| exp '-' exp { $$ = $1 - $3; } -| exp '*' exp { $$ = $1 * $3; } -| exp '/' exp { $$ = $1 / $3; } -| '-' exp %prec NEG { $$ = -$2; } -| exp '^' exp { $$ = power ($1, $3); } -| '(' exp ')' { $$ = $2; } -| '(' error ')' { $$ = 1111; } -| '!' { YYERROR; } -| '-' error { YYERROR; } -; -%% -/* The input. */ -static FILE *yyin; - -static void -yyerror ( - - const char *s) -{ - - - fprintf (stderr, "%d.%d", - (yylloc).first_line, (yylloc).first_column); - if ((yylloc).first_line != (yylloc).last_line) - fprintf (stderr, "-%d.%d", - (yylloc).last_line, (yylloc).last_column - 1); - else if ((yylloc).first_column != (yylloc).last_column - 1) - fprintf (stderr, "-%d", - (yylloc).last_column - 1); - fprintf (stderr, ": "); - fprintf (stderr, "%s\n", s); -} - - - -static YYLTYPE last_yylloc; - -static int -yygetc (void) -{ - int res = getc (yyin); - ; - - last_yylloc = (yylloc); - if (res == '\n') - { - (yylloc).last_line++; - (yylloc).last_column = 0; - } - else - (yylloc).last_column++; - - return res; -} - - -static void -yyungetc ( int c) -{ - ; - - /* Wrong when C == `\n'. */ - (yylloc) = last_yylloc; - - ungetc (c, yyin); -} - -static int -read_signed_integer (void) -{ - int c = yygetc (); - int sign = 1; - int n = 0; - - ; - if (c == '-') - { - c = yygetc (); - sign = -1; - } - - while (isdigit (c)) - { - n = 10 * n + (c - '0'); - c = yygetc (); - } - - yyungetc ( c); - - return sign * n; -} - - - -/*---------------------------------------------------------------. -| Lexical analyzer returns an integer on the stack and the token | -| NUM, or the ASCII character read if not a number. Skips all | -| blanks and tabs, returns 0 for EOF. | -`---------------------------------------------------------------*/ - -static int -yylex (void) -{ - static int init = 1; - int c; - - if (init) - { - init = 0; - - (yylloc).last_column = 0; - (yylloc).last_line = 1; - - } - - (yylloc).first_column = (yylloc).last_column; - (yylloc).first_line = (yylloc).last_line; - - - /* Skip white space. */ - while ((c = yygetc ()) == ' ' || c == '\t') - { - (yylloc).first_column = (yylloc).last_column; - (yylloc).first_line = (yylloc).last_line; - - } - - /* process numbers */ - if (c == '.' || isdigit (c)) - { - yyungetc ( c); - (yylval).ival = read_signed_integer (); - return NUM; - } - - /* Return end-of-file. */ - if (c == EOF) - return CALC_EOF; - - /* Return single chars. */ - return c; -} - -static int -power (int base, int exponent) -{ - int res = 1; - if (exponent < 0) - exit (1); - for (/* Niente */; exponent; --exponent) - res *= base; - return res; -} - - -int -main (int argc, const char **argv) -{ - semantic_value result = 0; - int count = 0; - int status; - - alarm (10); - if (argc == 2) - yyin = fopen (argv[1], "r"); - else - yyin = stdin; - - if (!yyin) - { - perror (argv[1]); - exit (1); - } - - yydebug = 1; - status = yyparse (); - if (global_result != result) - abort (); - if (global_count != count) - abort (); - return status; -} -_ATEOF - - - - - -# Specify the output files to avoid problems on different file systems. -$at_traceoff -echo "calc.at:556: bison -o calc.c calc.y" -echo calc.at:556 >$at_check_line_file -( $at_traceon; bison -o calc.c calc.y ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:556: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - -$at_traceoff -echo "calc.at:556: \$CC \$CFLAGS \$CPPFLAGS \$LDFLAGS calc.c \$LIBS -o calc" -echo calc.at:556 >$at_check_line_file -( $at_traceon; $CC $CFLAGS $CPPFLAGS $LDFLAGS calc.c $LIBS -o calc ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo stderr:; cat $at_stderr -echo stdout:; cat $at_stdout -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:556: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - -# Test the priorities. -cat >input <<'_ATEOF' -1 + 2 * 3 = 7 -1 + 2 * -3 = -5 - --1^2 = -1 -(-1)^2 = 1 - ----1 = -1 - -1 - 2 - 3 = -4 -1 - (2 - 3) = 2 - -2^2^3 = 256 -(2^2)^3 = 64 -_ATEOF - -$at_traceoff -echo "calc.at:556: \$PREPARSER ./calc input" -echo calc.at:556 >$at_check_line_file -( $at_traceon; $PREPARSER ./calc input ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo stderr:; tee stderr <$at_stderr -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:556: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - -$at_traceoff -echo "calc.at:556: wc -l $at_check_line_file -( $at_traceon; wc -l $at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -echo >>$at_stdout; echo "486 -" | $at_diff - $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:556: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - - -# Some syntax errors. -cat >input <<'_ATEOF' -0 0 -_ATEOF - -$at_traceoff -echo "calc.at:556: \$PREPARSER ./calc input" -echo calc.at:556 >$at_check_line_file -( $at_traceon; $PREPARSER ./calc input ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo stderr:; tee stderr <$at_stderr -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 1) ;; - *) echo "calc.at:556: exit code was $at_status, expected 1" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - -$at_traceoff -echo "calc.at:556: wc -l $at_check_line_file -( $at_traceon; wc -l $at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -echo >>$at_stdout; echo "11 -" | $at_diff - $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:556: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - -# Normalize the observed and expected error messages, depending upon the -# options. -# 1. Remove the traces from observed. -sed '/^Starting/d -/^Entering/d -/^Stack/d -/^Reading/d -/^Reducing/d -/^Shifting/d -/^state/d -/^Error:/d -/^Next/d -/^Discarding/d -/^yydestructor:/d' stderr >at-stderr -mv at-stderr stderr -# 2. Create the reference error message. -cat >expout <<'_ATEOF' -1.2: syntax error, unexpected "number" -_ATEOF - -# 3. If locations are not used, remove them. - -# 4. If error-verbose is not used, strip the`, unexpected....' part. - -# 5. Check -$at_traceoff -echo "calc.at:556: cat stderr" -echo calc.at:556 >$at_check_line_file -( $at_traceon; cat stderr ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -$at_diff expout $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:556: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - -cat >input <<'_ATEOF' -1//2 -_ATEOF - -$at_traceoff -echo "calc.at:556: \$PREPARSER ./calc input" -echo calc.at:556 >$at_check_line_file -( $at_traceon; $PREPARSER ./calc input ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo stderr:; tee stderr <$at_stderr -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 1) ;; - *) echo "calc.at:556: exit code was $at_status, expected 1" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - -$at_traceoff -echo "calc.at:556: wc -l $at_check_line_file -( $at_traceon; wc -l $at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -echo >>$at_stdout; echo "15 -" | $at_diff - $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:556: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - -# Normalize the observed and expected error messages, depending upon the -# options. -# 1. Remove the traces from observed. -sed '/^Starting/d -/^Entering/d -/^Stack/d -/^Reading/d -/^Reducing/d -/^Shifting/d -/^state/d -/^Error:/d -/^Next/d -/^Discarding/d -/^yydestructor:/d' stderr >at-stderr -mv at-stderr stderr -# 2. Create the reference error message. -cat >expout <<'_ATEOF' -1.2: syntax error, unexpected '/', expecting "number" or '-' or '(' or '!' -_ATEOF - -# 3. If locations are not used, remove them. - -# 4. If error-verbose is not used, strip the`, unexpected....' part. - -# 5. Check -$at_traceoff -echo "calc.at:556: cat stderr" -echo calc.at:556 >$at_check_line_file -( $at_traceon; cat stderr ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -$at_diff expout $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:556: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - -cat >input <<'_ATEOF' -error -_ATEOF - -$at_traceoff -echo "calc.at:556: \$PREPARSER ./calc input" -echo calc.at:556 >$at_check_line_file -( $at_traceon; $PREPARSER ./calc input ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo stderr:; tee stderr <$at_stderr -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 1) ;; - *) echo "calc.at:556: exit code was $at_status, expected 1" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - -$at_traceoff -echo "calc.at:556: wc -l $at_check_line_file -( $at_traceon; wc -l $at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -echo >>$at_stdout; echo "4 -" | $at_diff - $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:556: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - -# Normalize the observed and expected error messages, depending upon the -# options. -# 1. Remove the traces from observed. -sed '/^Starting/d -/^Entering/d -/^Stack/d -/^Reading/d -/^Reducing/d -/^Shifting/d -/^state/d -/^Error:/d -/^Next/d -/^Discarding/d -/^yydestructor:/d' stderr >at-stderr -mv at-stderr stderr -# 2. Create the reference error message. -cat >expout <<'_ATEOF' -1.0: syntax error, unexpected $undefined -_ATEOF - -# 3. If locations are not used, remove them. - -# 4. If error-verbose is not used, strip the`, unexpected....' part. - -# 5. Check -$at_traceoff -echo "calc.at:556: cat stderr" -echo calc.at:556 >$at_check_line_file -( $at_traceon; cat stderr ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -$at_diff expout $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:556: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - -cat >input <<'_ATEOF' -1 = 2 = 3 -_ATEOF - -$at_traceoff -echo "calc.at:556: \$PREPARSER ./calc input" -echo calc.at:556 >$at_check_line_file -( $at_traceon; $PREPARSER ./calc input ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo stderr:; tee stderr <$at_stderr -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 1) ;; - *) echo "calc.at:556: exit code was $at_status, expected 1" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - -$at_traceoff -echo "calc.at:556: wc -l $at_check_line_file -( $at_traceon; wc -l $at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -echo >>$at_stdout; echo "22 -" | $at_diff - $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:556: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - -# Normalize the observed and expected error messages, depending upon the -# options. -# 1. Remove the traces from observed. -sed '/^Starting/d -/^Entering/d -/^Stack/d -/^Reading/d -/^Reducing/d -/^Shifting/d -/^state/d -/^Error:/d -/^Next/d -/^Discarding/d -/^yydestructor:/d' stderr >at-stderr -mv at-stderr stderr -# 2. Create the reference error message. -cat >expout <<'_ATEOF' -1.6: syntax error, unexpected '=' -_ATEOF - -# 3. If locations are not used, remove them. - -# 4. If error-verbose is not used, strip the`, unexpected....' part. - -# 5. Check -$at_traceoff -echo "calc.at:556: cat stderr" -echo calc.at:556 >$at_check_line_file -( $at_traceon; cat stderr ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -$at_diff expout $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:556: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - -cat >input <<'_ATEOF' - -+1 -_ATEOF - -$at_traceoff -echo "calc.at:556: \$PREPARSER ./calc input" -echo calc.at:556 >$at_check_line_file -( $at_traceon; $PREPARSER ./calc input ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo stderr:; tee stderr <$at_stderr -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 1) ;; - *) echo "calc.at:556: exit code was $at_status, expected 1" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - -$at_traceoff -echo "calc.at:556: wc -l $at_check_line_file -( $at_traceon; wc -l $at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -echo >>$at_stdout; echo "14 -" | $at_diff - $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:556: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - -# Normalize the observed and expected error messages, depending upon the -# options. -# 1. Remove the traces from observed. -sed '/^Starting/d -/^Entering/d -/^Stack/d -/^Reading/d -/^Reducing/d -/^Shifting/d -/^state/d -/^Error:/d -/^Next/d -/^Discarding/d -/^yydestructor:/d' stderr >at-stderr -mv at-stderr stderr -# 2. Create the reference error message. -cat >expout <<'_ATEOF' -2.0: syntax error, unexpected '+' -_ATEOF - -# 3. If locations are not used, remove them. - -# 4. If error-verbose is not used, strip the`, unexpected....' part. - -# 5. Check -$at_traceoff -echo "calc.at:556: cat stderr" -echo calc.at:556 >$at_check_line_file -( $at_traceon; cat stderr ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -$at_diff expout $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:556: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - -# Exercise error messages with EOF: work on an empty file. -$at_traceoff -echo "calc.at:556: \$PREPARSER ./calc /dev/null" -echo calc.at:556 >$at_check_line_file -( $at_traceon; $PREPARSER ./calc /dev/null ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo stderr:; tee stderr <$at_stderr -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 1) ;; - *) echo "calc.at:556: exit code was $at_status, expected 1" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - -$at_traceoff -echo "calc.at:556: wc -l $at_check_line_file -( $at_traceon; wc -l $at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -echo >>$at_stdout; echo "4 -" | $at_diff - $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:556: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - -# Normalize the observed and expected error messages, depending upon the -# options. -# 1. Remove the traces from observed. -sed '/^Starting/d -/^Entering/d -/^Stack/d -/^Reading/d -/^Reducing/d -/^Shifting/d -/^state/d -/^Error:/d -/^Next/d -/^Discarding/d -/^yydestructor:/d' stderr >at-stderr -mv at-stderr stderr -# 2. Create the reference error message. -cat >expout <<'_ATEOF' -1.0: syntax error, unexpected "end of input" -_ATEOF - -# 3. If locations are not used, remove them. - -# 4. If error-verbose is not used, strip the`, unexpected....' part. - -# 5. Check -$at_traceoff -echo "calc.at:556: cat stderr" -echo calc.at:556 >$at_check_line_file -( $at_traceon; cat stderr ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -$at_diff expout $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:556: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - - -# Exercise the error token: without it, we die at the first error, -# hence be sure to -# -# - have several errors which exercise different shift/discardings -# - (): nothing to pop, nothing to discard -# - (1 + 1 + 1 +): a lot to pop, nothing to discard -# - (* * *): nothing to pop, a lot to discard -# - (1 + 2 * *): some to pop and discard -# -# - test the action associated to `error' -# -# - check the lookahead that triggers an error is not discarded -# when we enter error recovery. Below, the lookahead causing the -# first error is ")", which is needed to recover from the error and -# produce the "0" that triggers the "0 != 1" error. -# -cat >input <<'_ATEOF' -() + (1 + 1 + 1 +) + (* * *) + (1 * 2 * *) = 1 -_ATEOF - -$at_traceoff -echo "calc.at:556: \$PREPARSER ./calc input" -echo calc.at:556 >$at_check_line_file -( $at_traceon; $PREPARSER ./calc input ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo stderr:; tee stderr <$at_stderr -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:556: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - -$at_traceoff -echo "calc.at:556: wc -l $at_check_line_file -( $at_traceon; wc -l $at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -echo >>$at_stdout; echo "156 -" | $at_diff - $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:556: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - -# Normalize the observed and expected error messages, depending upon the -# options. -# 1. Remove the traces from observed. -sed '/^Starting/d -/^Entering/d -/^Stack/d -/^Reading/d -/^Reducing/d -/^Shifting/d -/^state/d -/^Error:/d -/^Next/d -/^Discarding/d -/^yydestructor:/d' stderr >at-stderr -mv at-stderr stderr -# 2. Create the reference error message. -cat >expout <<'_ATEOF' -1.1: syntax error, unexpected ')', expecting "number" or '-' or '(' or '!' -1.17: syntax error, unexpected ')', expecting "number" or '-' or '(' or '!' -1.22: syntax error, unexpected '*', expecting "number" or '-' or '(' or '!' -1.40: syntax error, unexpected '*', expecting "number" or '-' or '(' or '!' -calc: error: 4444 != 1 -_ATEOF - -# 3. If locations are not used, remove them. - -# 4. If error-verbose is not used, strip the`, unexpected....' part. - -# 5. Check -$at_traceoff -echo "calc.at:556: cat stderr" -echo calc.at:556 >$at_check_line_file -( $at_traceon; cat stderr ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -$at_diff expout $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:556: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - - -# The same, but this time exercising explicitly triggered syntax errors. -# POSIX says the lookahead causing the error should not be discarded. -cat >input <<'_ATEOF' -(!) + (0 0) = 1 -_ATEOF - -$at_traceoff -echo "calc.at:556: \$PREPARSER ./calc input" -echo calc.at:556 >$at_check_line_file -( $at_traceon; $PREPARSER ./calc input ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo stderr:; tee stderr <$at_stderr -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:556: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - -$at_traceoff -echo "calc.at:556: wc -l $at_check_line_file -( $at_traceon; wc -l $at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -echo >>$at_stdout; echo "62 -" | $at_diff - $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:556: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - -# Normalize the observed and expected error messages, depending upon the -# options. -# 1. Remove the traces from observed. -sed '/^Starting/d -/^Entering/d -/^Stack/d -/^Reading/d -/^Reducing/d -/^Shifting/d -/^state/d -/^Error:/d -/^Next/d -/^Discarding/d -/^yydestructor:/d' stderr >at-stderr -mv at-stderr stderr -# 2. Create the reference error message. -cat >expout <<'_ATEOF' -1.9: syntax error, unexpected "number" -calc: error: 2222 != 1 -_ATEOF - -# 3. If locations are not used, remove them. - -# 4. If error-verbose is not used, strip the`, unexpected....' part. - -# 5. Check -$at_traceoff -echo "calc.at:556: cat stderr" -echo calc.at:556 >$at_check_line_file -( $at_traceon; cat stderr ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -$at_diff expout $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:556: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - -cat >input <<'_ATEOF' -(- *) + (0 0) = 1 -_ATEOF - -$at_traceoff -echo "calc.at:556: \$PREPARSER ./calc input" -echo calc.at:556 >$at_check_line_file -( $at_traceon; $PREPARSER ./calc input ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo stderr:; tee stderr <$at_stderr -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:556: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - -$at_traceoff -echo "calc.at:556: wc -l $at_check_line_file -( $at_traceon; wc -l $at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -echo >>$at_stdout; echo "70 -" | $at_diff - $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:556: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - -# Normalize the observed and expected error messages, depending upon the -# options. -# 1. Remove the traces from observed. -sed '/^Starting/d -/^Entering/d -/^Stack/d -/^Reading/d -/^Reducing/d -/^Shifting/d -/^state/d -/^Error:/d -/^Next/d -/^Discarding/d -/^yydestructor:/d' stderr >at-stderr -mv at-stderr stderr -# 2. Create the reference error message. -cat >expout <<'_ATEOF' -1.3: syntax error, unexpected '*', expecting "number" or '-' or '(' or '!' -1.11: syntax error, unexpected "number" -calc: error: 2222 != 1 -_ATEOF - -# 3. If locations are not used, remove them. - -# 4. If error-verbose is not used, strip the`, unexpected....' part. - -# 5. Check -$at_traceoff -echo "calc.at:556: cat stderr" -echo calc.at:556 >$at_check_line_file -( $at_traceon; cat stderr ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -$at_diff expout $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:556: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - - - - - - - - - - - - - - - - - - - - - $at_traceoff - $at_times_p && times >$at_times_file - ) 5>&1 2>&1 | eval $at_tee_pipe - at_status=`cat $at_status_file` - ;; - - 68 ) # 68. calc.at:558: Calculator %pure-parser %error-verbose %debug %locations %defines %name-prefix="calc" %verbose %yacc - at_setup_line='calc.at:558' - at_desc='Calculator %pure-parser %error-verbose %debug %locations %defines %name-prefix="calc" %verbose %yacc' - $at_quiet $ECHO_N " 68: Calculator %pure-parser %error-verbose %debug %locations %defines %name-prefix="calc" %verbose %yacc$ECHO_C" - at_xfail=no - ( - echo "68. calc.at:558: testing ..." - $at_traceon - - - - - - -# Using yacc.c? - - - - - - - -# yyerror receives the location if %location & %pure & (%glr or %parse-param). - -# yyerror always sees the locations (when activated), except if -# yacc & pure & !param. - - -# The interface is pure: either because %pure-parser, or because we -# are using the C++ parsers. - - - - - - - - - - - - -cat >calc.y <<'_ATEOF' -%{ -#if HAVE_CONFIG_H -# include - /* We don't need perfect functions for these tests. */ -# undef malloc -# undef memcmp -# undef realloc -#endif -%} - -/* Infix notation calculator--calc */ -%pure-parser %error-verbose %debug %locations %defines %name-prefix="calc" %verbose %yacc -%{ -#include - -#include -#include -#if HAVE_UNISTD_H -# include -#else -# undef alarm -# define alarm(seconds) /* empty */ -#endif -#include - -/* Exercise pre-prologue dependency to %union. */ -typedef int semantic_value; - -static semantic_value global_result = 0; -static int global_count = 0; -%} - -/* Exercise %union. */ -%union -{ - semantic_value ival; -}; - -%{ -static int power (int base, int exponent); -/* yyerror receives the location if: - - %location & %pure & %glr - - %location & %pure & %yacc & %parse-param. */ -static void yyerror ( - - const char *s - ); -static int yylex (YYSTYPE *yylval, YYLTYPE *yylloc); -static int yygetc (YYSTYPE *yylval, YYLTYPE *yylloc); -static void yyungetc (YYSTYPE *yylval, YYLTYPE *yylloc, int c); -%} - -/* Bison Declarations */ -%token CALC_EOF 0 "end of input" -%token NUM "number" -%type exp - -%nonassoc '=' /* comparison */ -%left '-' '+' -%left '*' '/' -%left NEG /* negation--unary minus */ -%right '^' /* exponentiation */ - -/* Grammar follows */ -%% -input: - line -| input line { } -; - -line: - '\n' -| exp '\n' { } -; - -exp: - NUM { $$ = $1; } -| exp '=' exp - { - if ($1 != $3) - fprintf (stderr, "calc: error: %d != %d\n", $1, $3); - $$ = $1; - } -| exp '+' exp { $$ = $1 + $3; } -| exp '-' exp { $$ = $1 - $3; } -| exp '*' exp { $$ = $1 * $3; } -| exp '/' exp { $$ = $1 / $3; } -| '-' exp %prec NEG { $$ = -$2; } -| exp '^' exp { $$ = power ($1, $3); } -| '(' exp ')' { $$ = $2; } -| '(' error ')' { $$ = 1111; } -| '!' { YYERROR; } -| '-' error { YYERROR; } -; -%% -/* The input. */ -static FILE *yyin; - -static void -yyerror ( - - const char *s) -{ - - - fprintf (stderr, "%s\n", s); -} - - - -static YYLTYPE last_yylloc; - -static int -yygetc (YYSTYPE *yylval, YYLTYPE *yylloc) -{ - int res = getc (yyin); - (void) yylval;(void) yylloc; - - last_yylloc = (*yylloc); - if (res == '\n') - { - (*yylloc).last_line++; - (*yylloc).last_column = 0; - } - else - (*yylloc).last_column++; - - return res; -} - - -static void -yyungetc (YYSTYPE *yylval, YYLTYPE *yylloc, int c) -{ - (void) yylval;(void) yylloc; - - /* Wrong when C == `\n'. */ - (*yylloc) = last_yylloc; - - ungetc (c, yyin); -} - -static int -read_signed_integer (YYSTYPE *yylval, YYLTYPE *yylloc) -{ - int c = yygetc (yylval, yylloc); - int sign = 1; - int n = 0; - - (void) yylval;(void) yylloc; - if (c == '-') - { - c = yygetc (yylval, yylloc); - sign = -1; - } - - while (isdigit (c)) - { - n = 10 * n + (c - '0'); - c = yygetc (yylval, yylloc); - } - - yyungetc (yylval, yylloc, c); - - return sign * n; -} - - - -/*---------------------------------------------------------------. -| Lexical analyzer returns an integer on the stack and the token | -| NUM, or the ASCII character read if not a number. Skips all | -| blanks and tabs, returns 0 for EOF. | -`---------------------------------------------------------------*/ - -static int -yylex (YYSTYPE *yylval, YYLTYPE *yylloc) -{ - static int init = 1; - int c; - - if (init) - { - init = 0; - - (*yylloc).last_column = 0; - (*yylloc).last_line = 1; - - } - - (*yylloc).first_column = (*yylloc).last_column; - (*yylloc).first_line = (*yylloc).last_line; - - - /* Skip white space. */ - while ((c = yygetc (yylval, yylloc)) == ' ' || c == '\t') - { - (*yylloc).first_column = (*yylloc).last_column; - (*yylloc).first_line = (*yylloc).last_line; - - } - - /* process numbers */ - if (c == '.' || isdigit (c)) - { - yyungetc (yylval, yylloc, c); - (*yylval).ival = read_signed_integer (yylval, yylloc); - return NUM; - } - - /* Return end-of-file. */ - if (c == EOF) - return CALC_EOF; - - /* Return single chars. */ - return c; -} - -static int -power (int base, int exponent) -{ - int res = 1; - if (exponent < 0) - exit (1); - for (/* Niente */; exponent; --exponent) - res *= base; - return res; -} - - -int -main (int argc, const char **argv) -{ - semantic_value result = 0; - int count = 0; - int status; - - alarm (10); - if (argc == 2) - yyin = fopen (argv[1], "r"); - else - yyin = stdin; - - if (!yyin) - { - perror (argv[1]); - exit (1); - } - - yydebug = 1; - status = yyparse (); - if (global_result != result) - abort (); - if (global_count != count) - abort (); - return status; -} -_ATEOF - - - - - -# Specify the output files to avoid problems on different file systems. -$at_traceoff -echo "calc.at:558: bison -o calc.c calc.y" -echo calc.at:558 >$at_check_line_file -( $at_traceon; bison -o calc.c calc.y ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:558: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - -$at_traceoff -echo "calc.at:558: \$CC \$CFLAGS \$CPPFLAGS \$LDFLAGS calc.c \$LIBS -o calc" -echo calc.at:558 >$at_check_line_file -( $at_traceon; $CC $CFLAGS $CPPFLAGS $LDFLAGS calc.c $LIBS -o calc ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo stderr:; cat $at_stderr -echo stdout:; cat $at_stdout -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:558: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - -# Test the priorities. -cat >input <<'_ATEOF' -1 + 2 * 3 = 7 -1 + 2 * -3 = -5 - --1^2 = -1 -(-1)^2 = 1 - ----1 = -1 - -1 - 2 - 3 = -4 -1 - (2 - 3) = 2 - -2^2^3 = 256 -(2^2)^3 = 64 -_ATEOF - -$at_traceoff -echo "calc.at:558: \$PREPARSER ./calc input" -echo calc.at:558 >$at_check_line_file -( $at_traceon; $PREPARSER ./calc input ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo stderr:; tee stderr <$at_stderr -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:558: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - -$at_traceoff -echo "calc.at:558: wc -l $at_check_line_file -( $at_traceon; wc -l $at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -echo >>$at_stdout; echo "486 -" | $at_diff - $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:558: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - - -# Some syntax errors. -cat >input <<'_ATEOF' -0 0 -_ATEOF - -$at_traceoff -echo "calc.at:558: \$PREPARSER ./calc input" -echo calc.at:558 >$at_check_line_file -( $at_traceon; $PREPARSER ./calc input ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo stderr:; tee stderr <$at_stderr -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 1) ;; - *) echo "calc.at:558: exit code was $at_status, expected 1" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - -$at_traceoff -echo "calc.at:558: wc -l $at_check_line_file -( $at_traceon; wc -l $at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -echo >>$at_stdout; echo "11 -" | $at_diff - $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:558: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - -# Normalize the observed and expected error messages, depending upon the -# options. -# 1. Remove the traces from observed. -sed '/^Starting/d -/^Entering/d -/^Stack/d -/^Reading/d -/^Reducing/d -/^Shifting/d -/^state/d -/^Error:/d -/^Next/d -/^Discarding/d -/^yydestructor:/d' stderr >at-stderr -mv at-stderr stderr -# 2. Create the reference error message. -cat >expout <<'_ATEOF' -1.2: syntax error, unexpected "number" -_ATEOF - -# 3. If locations are not used, remove them. -sed 's/^[-0-9.]*: //' expout >at-expout -mv at-expout expout -# 4. If error-verbose is not used, strip the`, unexpected....' part. - -# 5. Check -$at_traceoff -echo "calc.at:558: cat stderr" -echo calc.at:558 >$at_check_line_file -( $at_traceon; cat stderr ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -$at_diff expout $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:558: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - -cat >input <<'_ATEOF' -1//2 -_ATEOF - -$at_traceoff -echo "calc.at:558: \$PREPARSER ./calc input" -echo calc.at:558 >$at_check_line_file -( $at_traceon; $PREPARSER ./calc input ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo stderr:; tee stderr <$at_stderr -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 1) ;; - *) echo "calc.at:558: exit code was $at_status, expected 1" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - -$at_traceoff -echo "calc.at:558: wc -l $at_check_line_file -( $at_traceon; wc -l $at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -echo >>$at_stdout; echo "15 -" | $at_diff - $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:558: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - -# Normalize the observed and expected error messages, depending upon the -# options. -# 1. Remove the traces from observed. -sed '/^Starting/d -/^Entering/d -/^Stack/d -/^Reading/d -/^Reducing/d -/^Shifting/d -/^state/d -/^Error:/d -/^Next/d -/^Discarding/d -/^yydestructor:/d' stderr >at-stderr -mv at-stderr stderr -# 2. Create the reference error message. -cat >expout <<'_ATEOF' -1.2: syntax error, unexpected '/', expecting "number" or '-' or '(' or '!' -_ATEOF - -# 3. If locations are not used, remove them. -sed 's/^[-0-9.]*: //' expout >at-expout -mv at-expout expout -# 4. If error-verbose is not used, strip the`, unexpected....' part. - -# 5. Check -$at_traceoff -echo "calc.at:558: cat stderr" -echo calc.at:558 >$at_check_line_file -( $at_traceon; cat stderr ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -$at_diff expout $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:558: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - -cat >input <<'_ATEOF' -error -_ATEOF - -$at_traceoff -echo "calc.at:558: \$PREPARSER ./calc input" -echo calc.at:558 >$at_check_line_file -( $at_traceon; $PREPARSER ./calc input ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo stderr:; tee stderr <$at_stderr -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 1) ;; - *) echo "calc.at:558: exit code was $at_status, expected 1" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - -$at_traceoff -echo "calc.at:558: wc -l $at_check_line_file -( $at_traceon; wc -l $at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -echo >>$at_stdout; echo "4 -" | $at_diff - $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:558: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - -# Normalize the observed and expected error messages, depending upon the -# options. -# 1. Remove the traces from observed. -sed '/^Starting/d -/^Entering/d -/^Stack/d -/^Reading/d -/^Reducing/d -/^Shifting/d -/^state/d -/^Error:/d -/^Next/d -/^Discarding/d -/^yydestructor:/d' stderr >at-stderr -mv at-stderr stderr -# 2. Create the reference error message. -cat >expout <<'_ATEOF' -1.0: syntax error, unexpected $undefined -_ATEOF - -# 3. If locations are not used, remove them. -sed 's/^[-0-9.]*: //' expout >at-expout -mv at-expout expout -# 4. If error-verbose is not used, strip the`, unexpected....' part. - -# 5. Check -$at_traceoff -echo "calc.at:558: cat stderr" -echo calc.at:558 >$at_check_line_file -( $at_traceon; cat stderr ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -$at_diff expout $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:558: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - -cat >input <<'_ATEOF' -1 = 2 = 3 -_ATEOF - -$at_traceoff -echo "calc.at:558: \$PREPARSER ./calc input" -echo calc.at:558 >$at_check_line_file -( $at_traceon; $PREPARSER ./calc input ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo stderr:; tee stderr <$at_stderr -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 1) ;; - *) echo "calc.at:558: exit code was $at_status, expected 1" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - -$at_traceoff -echo "calc.at:558: wc -l $at_check_line_file -( $at_traceon; wc -l $at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -echo >>$at_stdout; echo "22 -" | $at_diff - $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:558: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - -# Normalize the observed and expected error messages, depending upon the -# options. -# 1. Remove the traces from observed. -sed '/^Starting/d -/^Entering/d -/^Stack/d -/^Reading/d -/^Reducing/d -/^Shifting/d -/^state/d -/^Error:/d -/^Next/d -/^Discarding/d -/^yydestructor:/d' stderr >at-stderr -mv at-stderr stderr -# 2. Create the reference error message. -cat >expout <<'_ATEOF' -1.6: syntax error, unexpected '=' -_ATEOF - -# 3. If locations are not used, remove them. -sed 's/^[-0-9.]*: //' expout >at-expout -mv at-expout expout -# 4. If error-verbose is not used, strip the`, unexpected....' part. - -# 5. Check -$at_traceoff -echo "calc.at:558: cat stderr" -echo calc.at:558 >$at_check_line_file -( $at_traceon; cat stderr ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -$at_diff expout $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:558: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - -cat >input <<'_ATEOF' - -+1 -_ATEOF - -$at_traceoff -echo "calc.at:558: \$PREPARSER ./calc input" -echo calc.at:558 >$at_check_line_file -( $at_traceon; $PREPARSER ./calc input ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo stderr:; tee stderr <$at_stderr -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 1) ;; - *) echo "calc.at:558: exit code was $at_status, expected 1" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - -$at_traceoff -echo "calc.at:558: wc -l $at_check_line_file -( $at_traceon; wc -l $at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -echo >>$at_stdout; echo "14 -" | $at_diff - $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:558: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - -# Normalize the observed and expected error messages, depending upon the -# options. -# 1. Remove the traces from observed. -sed '/^Starting/d -/^Entering/d -/^Stack/d -/^Reading/d -/^Reducing/d -/^Shifting/d -/^state/d -/^Error:/d -/^Next/d -/^Discarding/d -/^yydestructor:/d' stderr >at-stderr -mv at-stderr stderr -# 2. Create the reference error message. -cat >expout <<'_ATEOF' -2.0: syntax error, unexpected '+' -_ATEOF - -# 3. If locations are not used, remove them. -sed 's/^[-0-9.]*: //' expout >at-expout -mv at-expout expout -# 4. If error-verbose is not used, strip the`, unexpected....' part. - -# 5. Check -$at_traceoff -echo "calc.at:558: cat stderr" -echo calc.at:558 >$at_check_line_file -( $at_traceon; cat stderr ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -$at_diff expout $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:558: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - -# Exercise error messages with EOF: work on an empty file. -$at_traceoff -echo "calc.at:558: \$PREPARSER ./calc /dev/null" -echo calc.at:558 >$at_check_line_file -( $at_traceon; $PREPARSER ./calc /dev/null ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo stderr:; tee stderr <$at_stderr -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 1) ;; - *) echo "calc.at:558: exit code was $at_status, expected 1" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - -$at_traceoff -echo "calc.at:558: wc -l $at_check_line_file -( $at_traceon; wc -l $at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -echo >>$at_stdout; echo "4 -" | $at_diff - $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:558: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - -# Normalize the observed and expected error messages, depending upon the -# options. -# 1. Remove the traces from observed. -sed '/^Starting/d -/^Entering/d -/^Stack/d -/^Reading/d -/^Reducing/d -/^Shifting/d -/^state/d -/^Error:/d -/^Next/d -/^Discarding/d -/^yydestructor:/d' stderr >at-stderr -mv at-stderr stderr -# 2. Create the reference error message. -cat >expout <<'_ATEOF' -1.0: syntax error, unexpected "end of input" -_ATEOF - -# 3. If locations are not used, remove them. -sed 's/^[-0-9.]*: //' expout >at-expout -mv at-expout expout -# 4. If error-verbose is not used, strip the`, unexpected....' part. - -# 5. Check -$at_traceoff -echo "calc.at:558: cat stderr" -echo calc.at:558 >$at_check_line_file -( $at_traceon; cat stderr ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -$at_diff expout $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:558: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - - -# Exercise the error token: without it, we die at the first error, -# hence be sure to -# -# - have several errors which exercise different shift/discardings -# - (): nothing to pop, nothing to discard -# - (1 + 1 + 1 +): a lot to pop, nothing to discard -# - (* * *): nothing to pop, a lot to discard -# - (1 + 2 * *): some to pop and discard -# -# - test the action associated to `error' -# -# - check the lookahead that triggers an error is not discarded -# when we enter error recovery. Below, the lookahead causing the -# first error is ")", which is needed to recover from the error and -# produce the "0" that triggers the "0 != 1" error. -# -cat >input <<'_ATEOF' -() + (1 + 1 + 1 +) + (* * *) + (1 * 2 * *) = 1 -_ATEOF - -$at_traceoff -echo "calc.at:558: \$PREPARSER ./calc input" -echo calc.at:558 >$at_check_line_file -( $at_traceon; $PREPARSER ./calc input ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo stderr:; tee stderr <$at_stderr -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:558: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - -$at_traceoff -echo "calc.at:558: wc -l $at_check_line_file -( $at_traceon; wc -l $at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -echo >>$at_stdout; echo "156 -" | $at_diff - $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:558: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - -# Normalize the observed and expected error messages, depending upon the -# options. -# 1. Remove the traces from observed. -sed '/^Starting/d -/^Entering/d -/^Stack/d -/^Reading/d -/^Reducing/d -/^Shifting/d -/^state/d -/^Error:/d -/^Next/d -/^Discarding/d -/^yydestructor:/d' stderr >at-stderr -mv at-stderr stderr -# 2. Create the reference error message. -cat >expout <<'_ATEOF' -1.1: syntax error, unexpected ')', expecting "number" or '-' or '(' or '!' -1.17: syntax error, unexpected ')', expecting "number" or '-' or '(' or '!' -1.22: syntax error, unexpected '*', expecting "number" or '-' or '(' or '!' -1.40: syntax error, unexpected '*', expecting "number" or '-' or '(' or '!' -calc: error: 4444 != 1 -_ATEOF - -# 3. If locations are not used, remove them. -sed 's/^[-0-9.]*: //' expout >at-expout -mv at-expout expout -# 4. If error-verbose is not used, strip the`, unexpected....' part. - -# 5. Check -$at_traceoff -echo "calc.at:558: cat stderr" -echo calc.at:558 >$at_check_line_file -( $at_traceon; cat stderr ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -$at_diff expout $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:558: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - - -# The same, but this time exercising explicitly triggered syntax errors. -# POSIX says the lookahead causing the error should not be discarded. -cat >input <<'_ATEOF' -(!) + (0 0) = 1 -_ATEOF - -$at_traceoff -echo "calc.at:558: \$PREPARSER ./calc input" -echo calc.at:558 >$at_check_line_file -( $at_traceon; $PREPARSER ./calc input ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo stderr:; tee stderr <$at_stderr -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:558: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - -$at_traceoff -echo "calc.at:558: wc -l $at_check_line_file -( $at_traceon; wc -l $at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -echo >>$at_stdout; echo "62 -" | $at_diff - $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:558: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - -# Normalize the observed and expected error messages, depending upon the -# options. -# 1. Remove the traces from observed. -sed '/^Starting/d -/^Entering/d -/^Stack/d -/^Reading/d -/^Reducing/d -/^Shifting/d -/^state/d -/^Error:/d -/^Next/d -/^Discarding/d -/^yydestructor:/d' stderr >at-stderr -mv at-stderr stderr -# 2. Create the reference error message. -cat >expout <<'_ATEOF' -1.9: syntax error, unexpected "number" -calc: error: 2222 != 1 -_ATEOF - -# 3. If locations are not used, remove them. -sed 's/^[-0-9.]*: //' expout >at-expout -mv at-expout expout -# 4. If error-verbose is not used, strip the`, unexpected....' part. - -# 5. Check -$at_traceoff -echo "calc.at:558: cat stderr" -echo calc.at:558 >$at_check_line_file -( $at_traceon; cat stderr ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -$at_diff expout $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:558: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - -cat >input <<'_ATEOF' -(- *) + (0 0) = 1 -_ATEOF - -$at_traceoff -echo "calc.at:558: \$PREPARSER ./calc input" -echo calc.at:558 >$at_check_line_file -( $at_traceon; $PREPARSER ./calc input ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo stderr:; tee stderr <$at_stderr -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:558: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - -$at_traceoff -echo "calc.at:558: wc -l $at_check_line_file -( $at_traceon; wc -l $at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -echo >>$at_stdout; echo "70 -" | $at_diff - $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:558: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - -# Normalize the observed and expected error messages, depending upon the -# options. -# 1. Remove the traces from observed. -sed '/^Starting/d -/^Entering/d -/^Stack/d -/^Reading/d -/^Reducing/d -/^Shifting/d -/^state/d -/^Error:/d -/^Next/d -/^Discarding/d -/^yydestructor:/d' stderr >at-stderr -mv at-stderr stderr -# 2. Create the reference error message. -cat >expout <<'_ATEOF' -1.3: syntax error, unexpected '*', expecting "number" or '-' or '(' or '!' -1.11: syntax error, unexpected "number" -calc: error: 2222 != 1 -_ATEOF - -# 3. If locations are not used, remove them. -sed 's/^[-0-9.]*: //' expout >at-expout -mv at-expout expout -# 4. If error-verbose is not used, strip the`, unexpected....' part. - -# 5. Check -$at_traceoff -echo "calc.at:558: cat stderr" -echo calc.at:558 >$at_check_line_file -( $at_traceon; cat stderr ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -$at_diff expout $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:558: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - - - - - - - - - - - - - - - - - - - - - $at_traceoff - $at_times_p && times >$at_times_file - ) 5>&1 2>&1 | eval $at_tee_pipe - at_status=`cat $at_status_file` - ;; - - 69 ) # 69. calc.at:560: Calculator %pure-parser %error-verbose %debug %locations %defines %name-prefix="calc" %verbose %yacc %parse-param {semantic_value *result} %parse-param {int *count} - at_setup_line='calc.at:560' - at_desc='Calculator %pure-parser %error-verbose %debug %locations %defines %name-prefix="calc" %verbose %yacc %parse-param {semantic_value *result} %parse-param {int *count}' - $at_quiet $ECHO_N " 69: Calculator %pure-parser %error-verbose %debug %locations %defines %name-prefix="calc" %verbose %yacc %parse-param {semantic_value *result} %parse-param {int *count}$ECHO_C" - at_xfail=no - ( - echo "69. calc.at:560: testing ..." - $at_traceon - - - - - - -# Using yacc.c? - - - - - - - -# yyerror receives the location if %location & %pure & (%glr or %parse-param). - -# yyerror always sees the locations (when activated), except if -# yacc & pure & !param. - - -# The interface is pure: either because %pure-parser, or because we -# are using the C++ parsers. - - - - - - - - - - - - -cat >calc.y <<'_ATEOF' -%{ -#if HAVE_CONFIG_H -# include - /* We don't need perfect functions for these tests. */ -# undef malloc -# undef memcmp -# undef realloc -#endif -%} - -/* Infix notation calculator--calc */ -%pure-parser %error-verbose %debug %locations %defines %name-prefix="calc" %verbose %yacc %parse-param {semantic_value *result} %parse-param {int *count} -%{ -#include - -#include -#include -#if HAVE_UNISTD_H -# include -#else -# undef alarm -# define alarm(seconds) /* empty */ -#endif -#include - -/* Exercise pre-prologue dependency to %union. */ -typedef int semantic_value; - -static semantic_value global_result = 0; -static int global_count = 0; -%} - -/* Exercise %union. */ -%union -{ - semantic_value ival; -}; - -%{ -static int power (int base, int exponent); -/* yyerror receives the location if: - - %location & %pure & %glr - - %location & %pure & %yacc & %parse-param. */ -static void yyerror (YYLTYPE *yylloc, - semantic_value *result, int *count, - const char *s - ); -static int yylex (YYSTYPE *yylval, YYLTYPE *yylloc); -static int yygetc (YYSTYPE *yylval, YYLTYPE *yylloc); -static void yyungetc (YYSTYPE *yylval, YYLTYPE *yylloc, int c); -%} - -/* Bison Declarations */ -%token CALC_EOF 0 "end of input" -%token NUM "number" -%type exp - -%nonassoc '=' /* comparison */ -%left '-' '+' -%left '*' '/' -%left NEG /* negation--unary minus */ -%right '^' /* exponentiation */ - -/* Grammar follows */ -%% -input: - line -| input line { ++*count; ++global_count; } -; - -line: - '\n' -| exp '\n' { *result = global_result = $1; } -; - -exp: - NUM { $$ = $1; } -| exp '=' exp - { - if ($1 != $3) - fprintf (stderr, "calc: error: %d != %d\n", $1, $3); - $$ = $1; - } -| exp '+' exp { $$ = $1 + $3; } -| exp '-' exp { $$ = $1 - $3; } -| exp '*' exp { $$ = $1 * $3; } -| exp '/' exp { $$ = $1 / $3; } -| '-' exp %prec NEG { $$ = -$2; } -| exp '^' exp { $$ = power ($1, $3); } -| '(' exp ')' { $$ = $2; } -| '(' error ')' { $$ = 1111; } -| '!' { YYERROR; } -| '-' error { YYERROR; } -; -%% -/* The input. */ -static FILE *yyin; - -static void -yyerror (YYLTYPE *yylloc, - semantic_value *result, int *count, - const char *s) -{ -(void) result; (void) count; - - fprintf (stderr, "%d.%d", - (*yylloc).first_line, (*yylloc).first_column); - if ((*yylloc).first_line != (*yylloc).last_line) - fprintf (stderr, "-%d.%d", - (*yylloc).last_line, (*yylloc).last_column - 1); - else if ((*yylloc).first_column != (*yylloc).last_column - 1) - fprintf (stderr, "-%d", - (*yylloc).last_column - 1); - fprintf (stderr, ": "); - fprintf (stderr, "%s\n", s); -} - - - -static YYLTYPE last_yylloc; - -static int -yygetc (YYSTYPE *yylval, YYLTYPE *yylloc) -{ - int res = getc (yyin); - (void) yylval;(void) yylloc; - - last_yylloc = (*yylloc); - if (res == '\n') - { - (*yylloc).last_line++; - (*yylloc).last_column = 0; - } - else - (*yylloc).last_column++; - - return res; -} - - -static void -yyungetc (YYSTYPE *yylval, YYLTYPE *yylloc, int c) -{ - (void) yylval;(void) yylloc; - - /* Wrong when C == `\n'. */ - (*yylloc) = last_yylloc; - - ungetc (c, yyin); -} - -static int -read_signed_integer (YYSTYPE *yylval, YYLTYPE *yylloc) -{ - int c = yygetc (yylval, yylloc); - int sign = 1; - int n = 0; - - (void) yylval;(void) yylloc; - if (c == '-') - { - c = yygetc (yylval, yylloc); - sign = -1; - } - - while (isdigit (c)) - { - n = 10 * n + (c - '0'); - c = yygetc (yylval, yylloc); - } - - yyungetc (yylval, yylloc, c); - - return sign * n; -} - - - -/*---------------------------------------------------------------. -| Lexical analyzer returns an integer on the stack and the token | -| NUM, or the ASCII character read if not a number. Skips all | -| blanks and tabs, returns 0 for EOF. | -`---------------------------------------------------------------*/ - -static int -yylex (YYSTYPE *yylval, YYLTYPE *yylloc) -{ - static int init = 1; - int c; - - if (init) - { - init = 0; - - (*yylloc).last_column = 0; - (*yylloc).last_line = 1; - - } - - (*yylloc).first_column = (*yylloc).last_column; - (*yylloc).first_line = (*yylloc).last_line; - - - /* Skip white space. */ - while ((c = yygetc (yylval, yylloc)) == ' ' || c == '\t') - { - (*yylloc).first_column = (*yylloc).last_column; - (*yylloc).first_line = (*yylloc).last_line; - - } - - /* process numbers */ - if (c == '.' || isdigit (c)) - { - yyungetc (yylval, yylloc, c); - (*yylval).ival = read_signed_integer (yylval, yylloc); - return NUM; - } - - /* Return end-of-file. */ - if (c == EOF) - return CALC_EOF; - - /* Return single chars. */ - return c; -} - -static int -power (int base, int exponent) -{ - int res = 1; - if (exponent < 0) - exit (1); - for (/* Niente */; exponent; --exponent) - res *= base; - return res; -} - - -int -main (int argc, const char **argv) -{ - semantic_value result = 0; - int count = 0; - int status; - - alarm (10); - if (argc == 2) - yyin = fopen (argv[1], "r"); - else - yyin = stdin; - - if (!yyin) - { - perror (argv[1]); - exit (1); - } - - yydebug = 1; - status = yyparse (&result, &count); - if (global_result != result) - abort (); - if (global_count != count) - abort (); - return status; -} -_ATEOF - - - - - -# Specify the output files to avoid problems on different file systems. -$at_traceoff -echo "calc.at:560: bison -o calc.c calc.y" -echo calc.at:560 >$at_check_line_file -( $at_traceon; bison -o calc.c calc.y ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:560: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - -$at_traceoff -echo "calc.at:560: \$CC \$CFLAGS \$CPPFLAGS \$LDFLAGS calc.c \$LIBS -o calc" -echo calc.at:560 >$at_check_line_file -( $at_traceon; $CC $CFLAGS $CPPFLAGS $LDFLAGS calc.c $LIBS -o calc ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo stderr:; cat $at_stderr -echo stdout:; cat $at_stdout -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:560: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - -# Test the priorities. -cat >input <<'_ATEOF' -1 + 2 * 3 = 7 -1 + 2 * -3 = -5 - --1^2 = -1 -(-1)^2 = 1 - ----1 = -1 - -1 - 2 - 3 = -4 -1 - (2 - 3) = 2 - -2^2^3 = 256 -(2^2)^3 = 64 -_ATEOF - -$at_traceoff -echo "calc.at:560: \$PREPARSER ./calc input" -echo calc.at:560 >$at_check_line_file -( $at_traceon; $PREPARSER ./calc input ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo stderr:; tee stderr <$at_stderr -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:560: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - -$at_traceoff -echo "calc.at:560: wc -l $at_check_line_file -( $at_traceon; wc -l $at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -echo >>$at_stdout; echo "486 -" | $at_diff - $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:560: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - - -# Some syntax errors. -cat >input <<'_ATEOF' -0 0 -_ATEOF - -$at_traceoff -echo "calc.at:560: \$PREPARSER ./calc input" -echo calc.at:560 >$at_check_line_file -( $at_traceon; $PREPARSER ./calc input ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo stderr:; tee stderr <$at_stderr -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 1) ;; - *) echo "calc.at:560: exit code was $at_status, expected 1" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - -$at_traceoff -echo "calc.at:560: wc -l $at_check_line_file -( $at_traceon; wc -l $at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -echo >>$at_stdout; echo "11 -" | $at_diff - $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:560: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - -# Normalize the observed and expected error messages, depending upon the -# options. -# 1. Remove the traces from observed. -sed '/^Starting/d -/^Entering/d -/^Stack/d -/^Reading/d -/^Reducing/d -/^Shifting/d -/^state/d -/^Error:/d -/^Next/d -/^Discarding/d -/^yydestructor:/d' stderr >at-stderr -mv at-stderr stderr -# 2. Create the reference error message. -cat >expout <<'_ATEOF' -1.2: syntax error, unexpected "number" -_ATEOF - -# 3. If locations are not used, remove them. - -# 4. If error-verbose is not used, strip the`, unexpected....' part. - -# 5. Check -$at_traceoff -echo "calc.at:560: cat stderr" -echo calc.at:560 >$at_check_line_file -( $at_traceon; cat stderr ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -$at_diff expout $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:560: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - -cat >input <<'_ATEOF' -1//2 -_ATEOF - -$at_traceoff -echo "calc.at:560: \$PREPARSER ./calc input" -echo calc.at:560 >$at_check_line_file -( $at_traceon; $PREPARSER ./calc input ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo stderr:; tee stderr <$at_stderr -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 1) ;; - *) echo "calc.at:560: exit code was $at_status, expected 1" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - -$at_traceoff -echo "calc.at:560: wc -l $at_check_line_file -( $at_traceon; wc -l $at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -echo >>$at_stdout; echo "15 -" | $at_diff - $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:560: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - -# Normalize the observed and expected error messages, depending upon the -# options. -# 1. Remove the traces from observed. -sed '/^Starting/d -/^Entering/d -/^Stack/d -/^Reading/d -/^Reducing/d -/^Shifting/d -/^state/d -/^Error:/d -/^Next/d -/^Discarding/d -/^yydestructor:/d' stderr >at-stderr -mv at-stderr stderr -# 2. Create the reference error message. -cat >expout <<'_ATEOF' -1.2: syntax error, unexpected '/', expecting "number" or '-' or '(' or '!' -_ATEOF - -# 3. If locations are not used, remove them. - -# 4. If error-verbose is not used, strip the`, unexpected....' part. - -# 5. Check -$at_traceoff -echo "calc.at:560: cat stderr" -echo calc.at:560 >$at_check_line_file -( $at_traceon; cat stderr ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -$at_diff expout $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:560: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - -cat >input <<'_ATEOF' -error -_ATEOF - -$at_traceoff -echo "calc.at:560: \$PREPARSER ./calc input" -echo calc.at:560 >$at_check_line_file -( $at_traceon; $PREPARSER ./calc input ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo stderr:; tee stderr <$at_stderr -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 1) ;; - *) echo "calc.at:560: exit code was $at_status, expected 1" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - -$at_traceoff -echo "calc.at:560: wc -l $at_check_line_file -( $at_traceon; wc -l $at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -echo >>$at_stdout; echo "4 -" | $at_diff - $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:560: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - -# Normalize the observed and expected error messages, depending upon the -# options. -# 1. Remove the traces from observed. -sed '/^Starting/d -/^Entering/d -/^Stack/d -/^Reading/d -/^Reducing/d -/^Shifting/d -/^state/d -/^Error:/d -/^Next/d -/^Discarding/d -/^yydestructor:/d' stderr >at-stderr -mv at-stderr stderr -# 2. Create the reference error message. -cat >expout <<'_ATEOF' -1.0: syntax error, unexpected $undefined -_ATEOF - -# 3. If locations are not used, remove them. - -# 4. If error-verbose is not used, strip the`, unexpected....' part. - -# 5. Check -$at_traceoff -echo "calc.at:560: cat stderr" -echo calc.at:560 >$at_check_line_file -( $at_traceon; cat stderr ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -$at_diff expout $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:560: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - -cat >input <<'_ATEOF' -1 = 2 = 3 -_ATEOF - -$at_traceoff -echo "calc.at:560: \$PREPARSER ./calc input" -echo calc.at:560 >$at_check_line_file -( $at_traceon; $PREPARSER ./calc input ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo stderr:; tee stderr <$at_stderr -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 1) ;; - *) echo "calc.at:560: exit code was $at_status, expected 1" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - -$at_traceoff -echo "calc.at:560: wc -l $at_check_line_file -( $at_traceon; wc -l $at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -echo >>$at_stdout; echo "22 -" | $at_diff - $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:560: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - -# Normalize the observed and expected error messages, depending upon the -# options. -# 1. Remove the traces from observed. -sed '/^Starting/d -/^Entering/d -/^Stack/d -/^Reading/d -/^Reducing/d -/^Shifting/d -/^state/d -/^Error:/d -/^Next/d -/^Discarding/d -/^yydestructor:/d' stderr >at-stderr -mv at-stderr stderr -# 2. Create the reference error message. -cat >expout <<'_ATEOF' -1.6: syntax error, unexpected '=' -_ATEOF - -# 3. If locations are not used, remove them. - -# 4. If error-verbose is not used, strip the`, unexpected....' part. - -# 5. Check -$at_traceoff -echo "calc.at:560: cat stderr" -echo calc.at:560 >$at_check_line_file -( $at_traceon; cat stderr ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -$at_diff expout $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:560: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - -cat >input <<'_ATEOF' - -+1 -_ATEOF - -$at_traceoff -echo "calc.at:560: \$PREPARSER ./calc input" -echo calc.at:560 >$at_check_line_file -( $at_traceon; $PREPARSER ./calc input ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo stderr:; tee stderr <$at_stderr -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 1) ;; - *) echo "calc.at:560: exit code was $at_status, expected 1" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - -$at_traceoff -echo "calc.at:560: wc -l $at_check_line_file -( $at_traceon; wc -l $at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -echo >>$at_stdout; echo "14 -" | $at_diff - $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:560: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - -# Normalize the observed and expected error messages, depending upon the -# options. -# 1. Remove the traces from observed. -sed '/^Starting/d -/^Entering/d -/^Stack/d -/^Reading/d -/^Reducing/d -/^Shifting/d -/^state/d -/^Error:/d -/^Next/d -/^Discarding/d -/^yydestructor:/d' stderr >at-stderr -mv at-stderr stderr -# 2. Create the reference error message. -cat >expout <<'_ATEOF' -2.0: syntax error, unexpected '+' -_ATEOF - -# 3. If locations are not used, remove them. - -# 4. If error-verbose is not used, strip the`, unexpected....' part. - -# 5. Check -$at_traceoff -echo "calc.at:560: cat stderr" -echo calc.at:560 >$at_check_line_file -( $at_traceon; cat stderr ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -$at_diff expout $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:560: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - -# Exercise error messages with EOF: work on an empty file. -$at_traceoff -echo "calc.at:560: \$PREPARSER ./calc /dev/null" -echo calc.at:560 >$at_check_line_file -( $at_traceon; $PREPARSER ./calc /dev/null ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo stderr:; tee stderr <$at_stderr -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 1) ;; - *) echo "calc.at:560: exit code was $at_status, expected 1" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - -$at_traceoff -echo "calc.at:560: wc -l $at_check_line_file -( $at_traceon; wc -l $at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -echo >>$at_stdout; echo "4 -" | $at_diff - $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:560: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - -# Normalize the observed and expected error messages, depending upon the -# options. -# 1. Remove the traces from observed. -sed '/^Starting/d -/^Entering/d -/^Stack/d -/^Reading/d -/^Reducing/d -/^Shifting/d -/^state/d -/^Error:/d -/^Next/d -/^Discarding/d -/^yydestructor:/d' stderr >at-stderr -mv at-stderr stderr -# 2. Create the reference error message. -cat >expout <<'_ATEOF' -1.0: syntax error, unexpected "end of input" -_ATEOF - -# 3. If locations are not used, remove them. - -# 4. If error-verbose is not used, strip the`, unexpected....' part. - -# 5. Check -$at_traceoff -echo "calc.at:560: cat stderr" -echo calc.at:560 >$at_check_line_file -( $at_traceon; cat stderr ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -$at_diff expout $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:560: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - - -# Exercise the error token: without it, we die at the first error, -# hence be sure to -# -# - have several errors which exercise different shift/discardings -# - (): nothing to pop, nothing to discard -# - (1 + 1 + 1 +): a lot to pop, nothing to discard -# - (* * *): nothing to pop, a lot to discard -# - (1 + 2 * *): some to pop and discard -# -# - test the action associated to `error' -# -# - check the lookahead that triggers an error is not discarded -# when we enter error recovery. Below, the lookahead causing the -# first error is ")", which is needed to recover from the error and -# produce the "0" that triggers the "0 != 1" error. -# -cat >input <<'_ATEOF' -() + (1 + 1 + 1 +) + (* * *) + (1 * 2 * *) = 1 -_ATEOF - -$at_traceoff -echo "calc.at:560: \$PREPARSER ./calc input" -echo calc.at:560 >$at_check_line_file -( $at_traceon; $PREPARSER ./calc input ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo stderr:; tee stderr <$at_stderr -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:560: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - -$at_traceoff -echo "calc.at:560: wc -l $at_check_line_file -( $at_traceon; wc -l $at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -echo >>$at_stdout; echo "156 -" | $at_diff - $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:560: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - -# Normalize the observed and expected error messages, depending upon the -# options. -# 1. Remove the traces from observed. -sed '/^Starting/d -/^Entering/d -/^Stack/d -/^Reading/d -/^Reducing/d -/^Shifting/d -/^state/d -/^Error:/d -/^Next/d -/^Discarding/d -/^yydestructor:/d' stderr >at-stderr -mv at-stderr stderr -# 2. Create the reference error message. -cat >expout <<'_ATEOF' -1.1: syntax error, unexpected ')', expecting "number" or '-' or '(' or '!' -1.17: syntax error, unexpected ')', expecting "number" or '-' or '(' or '!' -1.22: syntax error, unexpected '*', expecting "number" or '-' or '(' or '!' -1.40: syntax error, unexpected '*', expecting "number" or '-' or '(' or '!' -calc: error: 4444 != 1 -_ATEOF - -# 3. If locations are not used, remove them. - -# 4. If error-verbose is not used, strip the`, unexpected....' part. - -# 5. Check -$at_traceoff -echo "calc.at:560: cat stderr" -echo calc.at:560 >$at_check_line_file -( $at_traceon; cat stderr ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -$at_diff expout $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:560: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - - -# The same, but this time exercising explicitly triggered syntax errors. -# POSIX says the lookahead causing the error should not be discarded. -cat >input <<'_ATEOF' -(!) + (0 0) = 1 -_ATEOF - -$at_traceoff -echo "calc.at:560: \$PREPARSER ./calc input" -echo calc.at:560 >$at_check_line_file -( $at_traceon; $PREPARSER ./calc input ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo stderr:; tee stderr <$at_stderr -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:560: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - -$at_traceoff -echo "calc.at:560: wc -l $at_check_line_file -( $at_traceon; wc -l $at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -echo >>$at_stdout; echo "62 -" | $at_diff - $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:560: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - -# Normalize the observed and expected error messages, depending upon the -# options. -# 1. Remove the traces from observed. -sed '/^Starting/d -/^Entering/d -/^Stack/d -/^Reading/d -/^Reducing/d -/^Shifting/d -/^state/d -/^Error:/d -/^Next/d -/^Discarding/d -/^yydestructor:/d' stderr >at-stderr -mv at-stderr stderr -# 2. Create the reference error message. -cat >expout <<'_ATEOF' -1.9: syntax error, unexpected "number" -calc: error: 2222 != 1 -_ATEOF - -# 3. If locations are not used, remove them. - -# 4. If error-verbose is not used, strip the`, unexpected....' part. - -# 5. Check -$at_traceoff -echo "calc.at:560: cat stderr" -echo calc.at:560 >$at_check_line_file -( $at_traceon; cat stderr ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -$at_diff expout $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:560: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - -cat >input <<'_ATEOF' -(- *) + (0 0) = 1 -_ATEOF - -$at_traceoff -echo "calc.at:560: \$PREPARSER ./calc input" -echo calc.at:560 >$at_check_line_file -( $at_traceon; $PREPARSER ./calc input ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo stderr:; tee stderr <$at_stderr -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:560: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - -$at_traceoff -echo "calc.at:560: wc -l $at_check_line_file -( $at_traceon; wc -l $at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -echo >>$at_stdout; echo "70 -" | $at_diff - $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:560: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - -# Normalize the observed and expected error messages, depending upon the -# options. -# 1. Remove the traces from observed. -sed '/^Starting/d -/^Entering/d -/^Stack/d -/^Reading/d -/^Reducing/d -/^Shifting/d -/^state/d -/^Error:/d -/^Next/d -/^Discarding/d -/^yydestructor:/d' stderr >at-stderr -mv at-stderr stderr -# 2. Create the reference error message. -cat >expout <<'_ATEOF' -1.3: syntax error, unexpected '*', expecting "number" or '-' or '(' or '!' -1.11: syntax error, unexpected "number" -calc: error: 2222 != 1 -_ATEOF - -# 3. If locations are not used, remove them. - -# 4. If error-verbose is not used, strip the`, unexpected....' part. - -# 5. Check -$at_traceoff -echo "calc.at:560: cat stderr" -echo calc.at:560 >$at_check_line_file -( $at_traceon; cat stderr ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -$at_diff expout $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:560: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - - - - - - - - - - - - - - - - - - - - - $at_traceoff - $at_times_p && times >$at_times_file - ) 5>&1 2>&1 | eval $at_tee_pipe - at_status=`cat $at_status_file` - ;; - - - banner-10 ) # Banner 10. calc.at:567 - cat <<\_ATEOF - -Simple GLR Calculator. - -_ATEOF - ;; - - 70 ) # 70. calc.at:577: Calculator %glr-parser - at_setup_line='calc.at:577' - at_desc='Calculator %glr-parser ' - $at_quiet $ECHO_N " 70: Calculator %glr-parser $ECHO_C" - at_xfail=no - ( - echo "70. calc.at:577: testing ..." - $at_traceon - - - - - - -# Using yacc.c? - - - - - - - -# yyerror receives the location if %location & %pure & (%glr or %parse-param). - -# yyerror always sees the locations (when activated), except if -# yacc & pure & !param. - - -# The interface is pure: either because %pure-parser, or because we -# are using the C++ parsers. - - - - - - - - - - - - -cat >calc.y <<'_ATEOF' -%{ -#if HAVE_CONFIG_H -# include - /* We don't need perfect functions for these tests. */ -# undef malloc -# undef memcmp -# undef realloc -#endif -%} - -/* Infix notation calculator--calc */ -%glr-parser -%{ -#include - -#include -#include -#if HAVE_UNISTD_H -# include -#else -# undef alarm -# define alarm(seconds) /* empty */ -#endif -#include - -/* Exercise pre-prologue dependency to %union. */ -typedef int semantic_value; - -static semantic_value global_result = 0; -static int global_count = 0; -%} - -/* Exercise %union. */ -%union -{ - semantic_value ival; -}; - -%{ -static int power (int base, int exponent); -/* yyerror receives the location if: - - %location & %pure & %glr - - %location & %pure & %yacc & %parse-param. */ -static void yyerror ( - - const char *s - ); -static int yylex (void); -static int yygetc (void); -static void yyungetc ( int c); -%} - -/* Bison Declarations */ -%token CALC_EOF 0 "end of input" -%token NUM "number" -%type exp - -%nonassoc '=' /* comparison */ -%left '-' '+' -%left '*' '/' -%left NEG /* negation--unary minus */ -%right '^' /* exponentiation */ - -/* Grammar follows */ -%% -input: - line -| input line { } -; - -line: - '\n' -| exp '\n' { } -; - -exp: - NUM { $$ = $1; } -| exp '=' exp - { - if ($1 != $3) - fprintf (stderr, "calc: error: %d != %d\n", $1, $3); - $$ = $1; - } -| exp '+' exp { $$ = $1 + $3; } -| exp '-' exp { $$ = $1 - $3; } -| exp '*' exp { $$ = $1 * $3; } -| exp '/' exp { $$ = $1 / $3; } -| '-' exp %prec NEG { $$ = -$2; } -| exp '^' exp { $$ = power ($1, $3); } -| '(' exp ')' { $$ = $2; } -| '(' error ')' { $$ = 1111; } -| '!' { YYERROR; } -| '-' error { YYERROR; } -; -%% -/* The input. */ -static FILE *yyin; - -static void -yyerror ( - - const char *s) -{ - - - fprintf (stderr, "%s\n", s); -} - - - -static int -yygetc (void) -{ - int res = getc (yyin); - ; - - return res; -} - - -static void -yyungetc ( int c) -{ - ; - - ungetc (c, yyin); -} - -static int -read_signed_integer (void) -{ - int c = yygetc (); - int sign = 1; - int n = 0; - - ; - if (c == '-') - { - c = yygetc (); - sign = -1; - } - - while (isdigit (c)) - { - n = 10 * n + (c - '0'); - c = yygetc (); - } - - yyungetc ( c); - - return sign * n; -} - - - -/*---------------------------------------------------------------. -| Lexical analyzer returns an integer on the stack and the token | -| NUM, or the ASCII character read if not a number. Skips all | -| blanks and tabs, returns 0 for EOF. | -`---------------------------------------------------------------*/ - -static int -yylex (void) -{ - static int init = 1; - int c; - - if (init) - { - init = 0; - - } - - - - /* Skip white space. */ - while ((c = yygetc ()) == ' ' || c == '\t') - { - - } - - /* process numbers */ - if (c == '.' || isdigit (c)) - { - yyungetc ( c); - (yylval).ival = read_signed_integer (); - return NUM; - } - - /* Return end-of-file. */ - if (c == EOF) - return CALC_EOF; - - /* Return single chars. */ - return c; -} - -static int -power (int base, int exponent) -{ - int res = 1; - if (exponent < 0) - exit (1); - for (/* Niente */; exponent; --exponent) - res *= base; - return res; -} - - -int -main (int argc, const char **argv) -{ - semantic_value result = 0; - int count = 0; - int status; - - alarm (10); - if (argc == 2) - yyin = fopen (argv[1], "r"); - else - yyin = stdin; - - if (!yyin) - { - perror (argv[1]); - exit (1); - } - - - status = yyparse (); - if (global_result != result) - abort (); - if (global_count != count) - abort (); - return status; -} -_ATEOF - - - - - -# Specify the output files to avoid problems on different file systems. -$at_traceoff -echo "calc.at:577: bison -o calc.c calc.y" -echo calc.at:577 >$at_check_line_file -( $at_traceon; bison -o calc.c calc.y ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:577: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - -$at_traceoff -echo "calc.at:577: \$CC \$CFLAGS \$CPPFLAGS \$LDFLAGS calc.c \$LIBS -o calc" -echo calc.at:577 >$at_check_line_file -( $at_traceon; $CC $CFLAGS $CPPFLAGS $LDFLAGS calc.c $LIBS -o calc ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo stderr:; cat $at_stderr -echo stdout:; cat $at_stdout -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:577: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - -# Test the priorities. -cat >input <<'_ATEOF' -1 + 2 * 3 = 7 -1 + 2 * -3 = -5 - --1^2 = -1 -(-1)^2 = 1 - ----1 = -1 - -1 - 2 - 3 = -4 -1 - (2 - 3) = 2 - -2^2^3 = 256 -(2^2)^3 = 64 -_ATEOF - -$at_traceoff -echo "calc.at:577: \$PREPARSER ./calc input" -echo calc.at:577 >$at_check_line_file -( $at_traceon; $PREPARSER ./calc input ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo stderr:; tee stderr <$at_stderr -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:577: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - - - -# Some syntax errors. -cat >input <<'_ATEOF' -0 0 -_ATEOF - -$at_traceoff -echo "calc.at:577: \$PREPARSER ./calc input" -echo calc.at:577 >$at_check_line_file -( $at_traceon; $PREPARSER ./calc input ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo stderr:; tee stderr <$at_stderr -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 1) ;; - *) echo "calc.at:577: exit code was $at_status, expected 1" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - - -# Normalize the observed and expected error messages, depending upon the -# options. -# 1. Remove the traces from observed. -sed '/^Starting/d -/^Entering/d -/^Stack/d -/^Reading/d -/^Reducing/d -/^Shifting/d -/^state/d -/^Error:/d -/^Next/d -/^Discarding/d -/^yydestructor:/d' stderr >at-stderr -mv at-stderr stderr -# 2. Create the reference error message. -cat >expout <<'_ATEOF' -1.2: syntax error, unexpected "number" -_ATEOF - -# 3. If locations are not used, remove them. -sed 's/^[-0-9.]*: //' expout >at-expout -mv at-expout expout -# 4. If error-verbose is not used, strip the`, unexpected....' part. -sed 's/syntax error, .*$/syntax error/' expout >at-expout -mv at-expout expout -# 5. Check -$at_traceoff -echo "calc.at:577: cat stderr" -echo calc.at:577 >$at_check_line_file -( $at_traceon; cat stderr ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -$at_diff expout $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:577: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - -cat >input <<'_ATEOF' -1//2 -_ATEOF - -$at_traceoff -echo "calc.at:577: \$PREPARSER ./calc input" -echo calc.at:577 >$at_check_line_file -( $at_traceon; $PREPARSER ./calc input ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo stderr:; tee stderr <$at_stderr -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 1) ;; - *) echo "calc.at:577: exit code was $at_status, expected 1" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - - -# Normalize the observed and expected error messages, depending upon the -# options. -# 1. Remove the traces from observed. -sed '/^Starting/d -/^Entering/d -/^Stack/d -/^Reading/d -/^Reducing/d -/^Shifting/d -/^state/d -/^Error:/d -/^Next/d -/^Discarding/d -/^yydestructor:/d' stderr >at-stderr -mv at-stderr stderr -# 2. Create the reference error message. -cat >expout <<'_ATEOF' -1.2: syntax error, unexpected '/', expecting "number" or '-' or '(' or '!' -_ATEOF - -# 3. If locations are not used, remove them. -sed 's/^[-0-9.]*: //' expout >at-expout -mv at-expout expout -# 4. If error-verbose is not used, strip the`, unexpected....' part. -sed 's/syntax error, .*$/syntax error/' expout >at-expout -mv at-expout expout -# 5. Check -$at_traceoff -echo "calc.at:577: cat stderr" -echo calc.at:577 >$at_check_line_file -( $at_traceon; cat stderr ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -$at_diff expout $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:577: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - -cat >input <<'_ATEOF' -error -_ATEOF - -$at_traceoff -echo "calc.at:577: \$PREPARSER ./calc input" -echo calc.at:577 >$at_check_line_file -( $at_traceon; $PREPARSER ./calc input ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo stderr:; tee stderr <$at_stderr -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 1) ;; - *) echo "calc.at:577: exit code was $at_status, expected 1" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - - -# Normalize the observed and expected error messages, depending upon the -# options. -# 1. Remove the traces from observed. -sed '/^Starting/d -/^Entering/d -/^Stack/d -/^Reading/d -/^Reducing/d -/^Shifting/d -/^state/d -/^Error:/d -/^Next/d -/^Discarding/d -/^yydestructor:/d' stderr >at-stderr -mv at-stderr stderr -# 2. Create the reference error message. -cat >expout <<'_ATEOF' -1.0: syntax error, unexpected $undefined -_ATEOF - -# 3. If locations are not used, remove them. -sed 's/^[-0-9.]*: //' expout >at-expout -mv at-expout expout -# 4. If error-verbose is not used, strip the`, unexpected....' part. -sed 's/syntax error, .*$/syntax error/' expout >at-expout -mv at-expout expout -# 5. Check -$at_traceoff -echo "calc.at:577: cat stderr" -echo calc.at:577 >$at_check_line_file -( $at_traceon; cat stderr ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -$at_diff expout $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:577: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - -cat >input <<'_ATEOF' -1 = 2 = 3 -_ATEOF - -$at_traceoff -echo "calc.at:577: \$PREPARSER ./calc input" -echo calc.at:577 >$at_check_line_file -( $at_traceon; $PREPARSER ./calc input ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo stderr:; tee stderr <$at_stderr -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 1) ;; - *) echo "calc.at:577: exit code was $at_status, expected 1" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - - -# Normalize the observed and expected error messages, depending upon the -# options. -# 1. Remove the traces from observed. -sed '/^Starting/d -/^Entering/d -/^Stack/d -/^Reading/d -/^Reducing/d -/^Shifting/d -/^state/d -/^Error:/d -/^Next/d -/^Discarding/d -/^yydestructor:/d' stderr >at-stderr -mv at-stderr stderr -# 2. Create the reference error message. -cat >expout <<'_ATEOF' -1.6: syntax error, unexpected '=' -_ATEOF - -# 3. If locations are not used, remove them. -sed 's/^[-0-9.]*: //' expout >at-expout -mv at-expout expout -# 4. If error-verbose is not used, strip the`, unexpected....' part. -sed 's/syntax error, .*$/syntax error/' expout >at-expout -mv at-expout expout -# 5. Check -$at_traceoff -echo "calc.at:577: cat stderr" -echo calc.at:577 >$at_check_line_file -( $at_traceon; cat stderr ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -$at_diff expout $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:577: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - -cat >input <<'_ATEOF' - -+1 -_ATEOF - -$at_traceoff -echo "calc.at:577: \$PREPARSER ./calc input" -echo calc.at:577 >$at_check_line_file -( $at_traceon; $PREPARSER ./calc input ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo stderr:; tee stderr <$at_stderr -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 1) ;; - *) echo "calc.at:577: exit code was $at_status, expected 1" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - - -# Normalize the observed and expected error messages, depending upon the -# options. -# 1. Remove the traces from observed. -sed '/^Starting/d -/^Entering/d -/^Stack/d -/^Reading/d -/^Reducing/d -/^Shifting/d -/^state/d -/^Error:/d -/^Next/d -/^Discarding/d -/^yydestructor:/d' stderr >at-stderr -mv at-stderr stderr -# 2. Create the reference error message. -cat >expout <<'_ATEOF' -2.0: syntax error, unexpected '+' -_ATEOF - -# 3. If locations are not used, remove them. -sed 's/^[-0-9.]*: //' expout >at-expout -mv at-expout expout -# 4. If error-verbose is not used, strip the`, unexpected....' part. -sed 's/syntax error, .*$/syntax error/' expout >at-expout -mv at-expout expout -# 5. Check -$at_traceoff -echo "calc.at:577: cat stderr" -echo calc.at:577 >$at_check_line_file -( $at_traceon; cat stderr ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -$at_diff expout $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:577: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - -# Exercise error messages with EOF: work on an empty file. -$at_traceoff -echo "calc.at:577: \$PREPARSER ./calc /dev/null" -echo calc.at:577 >$at_check_line_file -( $at_traceon; $PREPARSER ./calc /dev/null ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo stderr:; tee stderr <$at_stderr -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 1) ;; - *) echo "calc.at:577: exit code was $at_status, expected 1" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - - -# Normalize the observed and expected error messages, depending upon the -# options. -# 1. Remove the traces from observed. -sed '/^Starting/d -/^Entering/d -/^Stack/d -/^Reading/d -/^Reducing/d -/^Shifting/d -/^state/d -/^Error:/d -/^Next/d -/^Discarding/d -/^yydestructor:/d' stderr >at-stderr -mv at-stderr stderr -# 2. Create the reference error message. -cat >expout <<'_ATEOF' -1.0: syntax error, unexpected "end of input" -_ATEOF - -# 3. If locations are not used, remove them. -sed 's/^[-0-9.]*: //' expout >at-expout -mv at-expout expout -# 4. If error-verbose is not used, strip the`, unexpected....' part. -sed 's/syntax error, .*$/syntax error/' expout >at-expout -mv at-expout expout -# 5. Check -$at_traceoff -echo "calc.at:577: cat stderr" -echo calc.at:577 >$at_check_line_file -( $at_traceon; cat stderr ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -$at_diff expout $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:577: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - - -# Exercise the error token: without it, we die at the first error, -# hence be sure to -# -# - have several errors which exercise different shift/discardings -# - (): nothing to pop, nothing to discard -# - (1 + 1 + 1 +): a lot to pop, nothing to discard -# - (* * *): nothing to pop, a lot to discard -# - (1 + 2 * *): some to pop and discard -# -# - test the action associated to `error' -# -# - check the lookahead that triggers an error is not discarded -# when we enter error recovery. Below, the lookahead causing the -# first error is ")", which is needed to recover from the error and -# produce the "0" that triggers the "0 != 1" error. -# -cat >input <<'_ATEOF' -() + (1 + 1 + 1 +) + (* * *) + (1 * 2 * *) = 1 -_ATEOF - -$at_traceoff -echo "calc.at:577: \$PREPARSER ./calc input" -echo calc.at:577 >$at_check_line_file -( $at_traceon; $PREPARSER ./calc input ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo stderr:; tee stderr <$at_stderr -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:577: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - - -# Normalize the observed and expected error messages, depending upon the -# options. -# 1. Remove the traces from observed. -sed '/^Starting/d -/^Entering/d -/^Stack/d -/^Reading/d -/^Reducing/d -/^Shifting/d -/^state/d -/^Error:/d -/^Next/d -/^Discarding/d -/^yydestructor:/d' stderr >at-stderr -mv at-stderr stderr -# 2. Create the reference error message. -cat >expout <<'_ATEOF' -1.1: syntax error, unexpected ')', expecting "number" or '-' or '(' or '!' -1.17: syntax error, unexpected ')', expecting "number" or '-' or '(' or '!' -1.22: syntax error, unexpected '*', expecting "number" or '-' or '(' or '!' -1.40: syntax error, unexpected '*', expecting "number" or '-' or '(' or '!' -calc: error: 4444 != 1 -_ATEOF - -# 3. If locations are not used, remove them. -sed 's/^[-0-9.]*: //' expout >at-expout -mv at-expout expout -# 4. If error-verbose is not used, strip the`, unexpected....' part. -sed 's/syntax error, .*$/syntax error/' expout >at-expout -mv at-expout expout -# 5. Check -$at_traceoff -echo "calc.at:577: cat stderr" -echo calc.at:577 >$at_check_line_file -( $at_traceon; cat stderr ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -$at_diff expout $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:577: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - - -# The same, but this time exercising explicitly triggered syntax errors. -# POSIX says the lookahead causing the error should not be discarded. -cat >input <<'_ATEOF' -(!) + (0 0) = 1 -_ATEOF - -$at_traceoff -echo "calc.at:577: \$PREPARSER ./calc input" -echo calc.at:577 >$at_check_line_file -( $at_traceon; $PREPARSER ./calc input ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo stderr:; tee stderr <$at_stderr -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:577: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - - -# Normalize the observed and expected error messages, depending upon the -# options. -# 1. Remove the traces from observed. -sed '/^Starting/d -/^Entering/d -/^Stack/d -/^Reading/d -/^Reducing/d -/^Shifting/d -/^state/d -/^Error:/d -/^Next/d -/^Discarding/d -/^yydestructor:/d' stderr >at-stderr -mv at-stderr stderr -# 2. Create the reference error message. -cat >expout <<'_ATEOF' -1.9: syntax error, unexpected "number" -calc: error: 2222 != 1 -_ATEOF - -# 3. If locations are not used, remove them. -sed 's/^[-0-9.]*: //' expout >at-expout -mv at-expout expout -# 4. If error-verbose is not used, strip the`, unexpected....' part. -sed 's/syntax error, .*$/syntax error/' expout >at-expout -mv at-expout expout -# 5. Check -$at_traceoff -echo "calc.at:577: cat stderr" -echo calc.at:577 >$at_check_line_file -( $at_traceon; cat stderr ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -$at_diff expout $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:577: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - -cat >input <<'_ATEOF' -(- *) + (0 0) = 1 -_ATEOF - -$at_traceoff -echo "calc.at:577: \$PREPARSER ./calc input" -echo calc.at:577 >$at_check_line_file -( $at_traceon; $PREPARSER ./calc input ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo stderr:; tee stderr <$at_stderr -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:577: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - - -# Normalize the observed and expected error messages, depending upon the -# options. -# 1. Remove the traces from observed. -sed '/^Starting/d -/^Entering/d -/^Stack/d -/^Reading/d -/^Reducing/d -/^Shifting/d -/^state/d -/^Error:/d -/^Next/d -/^Discarding/d -/^yydestructor:/d' stderr >at-stderr -mv at-stderr stderr -# 2. Create the reference error message. -cat >expout <<'_ATEOF' -1.3: syntax error, unexpected '*', expecting "number" or '-' or '(' or '!' -1.11: syntax error, unexpected "number" -calc: error: 2222 != 1 -_ATEOF - -# 3. If locations are not used, remove them. -sed 's/^[-0-9.]*: //' expout >at-expout -mv at-expout expout -# 4. If error-verbose is not used, strip the`, unexpected....' part. -sed 's/syntax error, .*$/syntax error/' expout >at-expout -mv at-expout expout -# 5. Check -$at_traceoff -echo "calc.at:577: cat stderr" -echo calc.at:577 >$at_check_line_file -( $at_traceon; cat stderr ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -$at_diff expout $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:577: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - - - - - - - - - - - - - - - - - - - - - $at_traceoff - $at_times_p && times >$at_times_file - ) 5>&1 2>&1 | eval $at_tee_pipe - at_status=`cat $at_status_file` - ;; - - 71 ) # 71. calc.at:579: Calculator %glr-parser %defines - at_setup_line='calc.at:579' - at_desc='Calculator %glr-parser %defines' - $at_quiet $ECHO_N " 71: Calculator %glr-parser %defines $ECHO_C" - at_xfail=no - ( - echo "71. calc.at:579: testing ..." - $at_traceon - - - - - - -# Using yacc.c? - - - - - - - -# yyerror receives the location if %location & %pure & (%glr or %parse-param). - -# yyerror always sees the locations (when activated), except if -# yacc & pure & !param. - - -# The interface is pure: either because %pure-parser, or because we -# are using the C++ parsers. - - - - - - - - - - - - -cat >calc.y <<'_ATEOF' -%{ -#if HAVE_CONFIG_H -# include - /* We don't need perfect functions for these tests. */ -# undef malloc -# undef memcmp -# undef realloc -#endif -%} - -/* Infix notation calculator--calc */ -%glr-parser %defines -%{ -#include - -#include -#include -#if HAVE_UNISTD_H -# include -#else -# undef alarm -# define alarm(seconds) /* empty */ -#endif -#include - -/* Exercise pre-prologue dependency to %union. */ -typedef int semantic_value; - -static semantic_value global_result = 0; -static int global_count = 0; -%} - -/* Exercise %union. */ -%union -{ - semantic_value ival; -}; - -%{ -static int power (int base, int exponent); -/* yyerror receives the location if: - - %location & %pure & %glr - - %location & %pure & %yacc & %parse-param. */ -static void yyerror ( - - const char *s - ); -static int yylex (void); -static int yygetc (void); -static void yyungetc ( int c); -%} - -/* Bison Declarations */ -%token CALC_EOF 0 "end of input" -%token NUM "number" -%type exp - -%nonassoc '=' /* comparison */ -%left '-' '+' -%left '*' '/' -%left NEG /* negation--unary minus */ -%right '^' /* exponentiation */ - -/* Grammar follows */ -%% -input: - line -| input line { } -; - -line: - '\n' -| exp '\n' { } -; - -exp: - NUM { $$ = $1; } -| exp '=' exp - { - if ($1 != $3) - fprintf (stderr, "calc: error: %d != %d\n", $1, $3); - $$ = $1; - } -| exp '+' exp { $$ = $1 + $3; } -| exp '-' exp { $$ = $1 - $3; } -| exp '*' exp { $$ = $1 * $3; } -| exp '/' exp { $$ = $1 / $3; } -| '-' exp %prec NEG { $$ = -$2; } -| exp '^' exp { $$ = power ($1, $3); } -| '(' exp ')' { $$ = $2; } -| '(' error ')' { $$ = 1111; } -| '!' { YYERROR; } -| '-' error { YYERROR; } -; -%% -/* The input. */ -static FILE *yyin; - -static void -yyerror ( - - const char *s) -{ - - - fprintf (stderr, "%s\n", s); -} - - - -static int -yygetc (void) -{ - int res = getc (yyin); - ; - - return res; -} - - -static void -yyungetc ( int c) -{ - ; - - ungetc (c, yyin); -} - -static int -read_signed_integer (void) -{ - int c = yygetc (); - int sign = 1; - int n = 0; - - ; - if (c == '-') - { - c = yygetc (); - sign = -1; - } - - while (isdigit (c)) - { - n = 10 * n + (c - '0'); - c = yygetc (); - } - - yyungetc ( c); - - return sign * n; -} - - - -/*---------------------------------------------------------------. -| Lexical analyzer returns an integer on the stack and the token | -| NUM, or the ASCII character read if not a number. Skips all | -| blanks and tabs, returns 0 for EOF. | -`---------------------------------------------------------------*/ - -static int -yylex (void) -{ - static int init = 1; - int c; - - if (init) - { - init = 0; - - } - - - - /* Skip white space. */ - while ((c = yygetc ()) == ' ' || c == '\t') - { - - } - - /* process numbers */ - if (c == '.' || isdigit (c)) - { - yyungetc ( c); - (yylval).ival = read_signed_integer (); - return NUM; - } - - /* Return end-of-file. */ - if (c == EOF) - return CALC_EOF; - - /* Return single chars. */ - return c; -} - -static int -power (int base, int exponent) -{ - int res = 1; - if (exponent < 0) - exit (1); - for (/* Niente */; exponent; --exponent) - res *= base; - return res; -} - - -int -main (int argc, const char **argv) -{ - semantic_value result = 0; - int count = 0; - int status; - - alarm (10); - if (argc == 2) - yyin = fopen (argv[1], "r"); - else - yyin = stdin; - - if (!yyin) - { - perror (argv[1]); - exit (1); - } - - - status = yyparse (); - if (global_result != result) - abort (); - if (global_count != count) - abort (); - return status; -} -_ATEOF - - - - - -# Specify the output files to avoid problems on different file systems. -$at_traceoff -echo "calc.at:579: bison -o calc.c calc.y" -echo calc.at:579 >$at_check_line_file -( $at_traceon; bison -o calc.c calc.y ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:579: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - -$at_traceoff -echo "calc.at:579: \$CC \$CFLAGS \$CPPFLAGS \$LDFLAGS calc.c \$LIBS -o calc" -echo calc.at:579 >$at_check_line_file -( $at_traceon; $CC $CFLAGS $CPPFLAGS $LDFLAGS calc.c $LIBS -o calc ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo stderr:; cat $at_stderr -echo stdout:; cat $at_stdout -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:579: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - -# Test the priorities. -cat >input <<'_ATEOF' -1 + 2 * 3 = 7 -1 + 2 * -3 = -5 - --1^2 = -1 -(-1)^2 = 1 - ----1 = -1 - -1 - 2 - 3 = -4 -1 - (2 - 3) = 2 - -2^2^3 = 256 -(2^2)^3 = 64 -_ATEOF - -$at_traceoff -echo "calc.at:579: \$PREPARSER ./calc input" -echo calc.at:579 >$at_check_line_file -( $at_traceon; $PREPARSER ./calc input ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo stderr:; tee stderr <$at_stderr -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:579: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - - - -# Some syntax errors. -cat >input <<'_ATEOF' -0 0 -_ATEOF - -$at_traceoff -echo "calc.at:579: \$PREPARSER ./calc input" -echo calc.at:579 >$at_check_line_file -( $at_traceon; $PREPARSER ./calc input ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo stderr:; tee stderr <$at_stderr -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 1) ;; - *) echo "calc.at:579: exit code was $at_status, expected 1" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - - -# Normalize the observed and expected error messages, depending upon the -# options. -# 1. Remove the traces from observed. -sed '/^Starting/d -/^Entering/d -/^Stack/d -/^Reading/d -/^Reducing/d -/^Shifting/d -/^state/d -/^Error:/d -/^Next/d -/^Discarding/d -/^yydestructor:/d' stderr >at-stderr -mv at-stderr stderr -# 2. Create the reference error message. -cat >expout <<'_ATEOF' -1.2: syntax error, unexpected "number" -_ATEOF - -# 3. If locations are not used, remove them. -sed 's/^[-0-9.]*: //' expout >at-expout -mv at-expout expout -# 4. If error-verbose is not used, strip the`, unexpected....' part. -sed 's/syntax error, .*$/syntax error/' expout >at-expout -mv at-expout expout -# 5. Check -$at_traceoff -echo "calc.at:579: cat stderr" -echo calc.at:579 >$at_check_line_file -( $at_traceon; cat stderr ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -$at_diff expout $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:579: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - -cat >input <<'_ATEOF' -1//2 -_ATEOF - -$at_traceoff -echo "calc.at:579: \$PREPARSER ./calc input" -echo calc.at:579 >$at_check_line_file -( $at_traceon; $PREPARSER ./calc input ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo stderr:; tee stderr <$at_stderr -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 1) ;; - *) echo "calc.at:579: exit code was $at_status, expected 1" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - - -# Normalize the observed and expected error messages, depending upon the -# options. -# 1. Remove the traces from observed. -sed '/^Starting/d -/^Entering/d -/^Stack/d -/^Reading/d -/^Reducing/d -/^Shifting/d -/^state/d -/^Error:/d -/^Next/d -/^Discarding/d -/^yydestructor:/d' stderr >at-stderr -mv at-stderr stderr -# 2. Create the reference error message. -cat >expout <<'_ATEOF' -1.2: syntax error, unexpected '/', expecting "number" or '-' or '(' or '!' -_ATEOF - -# 3. If locations are not used, remove them. -sed 's/^[-0-9.]*: //' expout >at-expout -mv at-expout expout -# 4. If error-verbose is not used, strip the`, unexpected....' part. -sed 's/syntax error, .*$/syntax error/' expout >at-expout -mv at-expout expout -# 5. Check -$at_traceoff -echo "calc.at:579: cat stderr" -echo calc.at:579 >$at_check_line_file -( $at_traceon; cat stderr ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -$at_diff expout $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:579: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - -cat >input <<'_ATEOF' -error -_ATEOF - -$at_traceoff -echo "calc.at:579: \$PREPARSER ./calc input" -echo calc.at:579 >$at_check_line_file -( $at_traceon; $PREPARSER ./calc input ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo stderr:; tee stderr <$at_stderr -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 1) ;; - *) echo "calc.at:579: exit code was $at_status, expected 1" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - - -# Normalize the observed and expected error messages, depending upon the -# options. -# 1. Remove the traces from observed. -sed '/^Starting/d -/^Entering/d -/^Stack/d -/^Reading/d -/^Reducing/d -/^Shifting/d -/^state/d -/^Error:/d -/^Next/d -/^Discarding/d -/^yydestructor:/d' stderr >at-stderr -mv at-stderr stderr -# 2. Create the reference error message. -cat >expout <<'_ATEOF' -1.0: syntax error, unexpected $undefined -_ATEOF - -# 3. If locations are not used, remove them. -sed 's/^[-0-9.]*: //' expout >at-expout -mv at-expout expout -# 4. If error-verbose is not used, strip the`, unexpected....' part. -sed 's/syntax error, .*$/syntax error/' expout >at-expout -mv at-expout expout -# 5. Check -$at_traceoff -echo "calc.at:579: cat stderr" -echo calc.at:579 >$at_check_line_file -( $at_traceon; cat stderr ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -$at_diff expout $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:579: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - -cat >input <<'_ATEOF' -1 = 2 = 3 -_ATEOF - -$at_traceoff -echo "calc.at:579: \$PREPARSER ./calc input" -echo calc.at:579 >$at_check_line_file -( $at_traceon; $PREPARSER ./calc input ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo stderr:; tee stderr <$at_stderr -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 1) ;; - *) echo "calc.at:579: exit code was $at_status, expected 1" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - - -# Normalize the observed and expected error messages, depending upon the -# options. -# 1. Remove the traces from observed. -sed '/^Starting/d -/^Entering/d -/^Stack/d -/^Reading/d -/^Reducing/d -/^Shifting/d -/^state/d -/^Error:/d -/^Next/d -/^Discarding/d -/^yydestructor:/d' stderr >at-stderr -mv at-stderr stderr -# 2. Create the reference error message. -cat >expout <<'_ATEOF' -1.6: syntax error, unexpected '=' -_ATEOF - -# 3. If locations are not used, remove them. -sed 's/^[-0-9.]*: //' expout >at-expout -mv at-expout expout -# 4. If error-verbose is not used, strip the`, unexpected....' part. -sed 's/syntax error, .*$/syntax error/' expout >at-expout -mv at-expout expout -# 5. Check -$at_traceoff -echo "calc.at:579: cat stderr" -echo calc.at:579 >$at_check_line_file -( $at_traceon; cat stderr ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -$at_diff expout $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:579: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - -cat >input <<'_ATEOF' - -+1 -_ATEOF - -$at_traceoff -echo "calc.at:579: \$PREPARSER ./calc input" -echo calc.at:579 >$at_check_line_file -( $at_traceon; $PREPARSER ./calc input ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo stderr:; tee stderr <$at_stderr -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 1) ;; - *) echo "calc.at:579: exit code was $at_status, expected 1" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - - -# Normalize the observed and expected error messages, depending upon the -# options. -# 1. Remove the traces from observed. -sed '/^Starting/d -/^Entering/d -/^Stack/d -/^Reading/d -/^Reducing/d -/^Shifting/d -/^state/d -/^Error:/d -/^Next/d -/^Discarding/d -/^yydestructor:/d' stderr >at-stderr -mv at-stderr stderr -# 2. Create the reference error message. -cat >expout <<'_ATEOF' -2.0: syntax error, unexpected '+' -_ATEOF - -# 3. If locations are not used, remove them. -sed 's/^[-0-9.]*: //' expout >at-expout -mv at-expout expout -# 4. If error-verbose is not used, strip the`, unexpected....' part. -sed 's/syntax error, .*$/syntax error/' expout >at-expout -mv at-expout expout -# 5. Check -$at_traceoff -echo "calc.at:579: cat stderr" -echo calc.at:579 >$at_check_line_file -( $at_traceon; cat stderr ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -$at_diff expout $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:579: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - -# Exercise error messages with EOF: work on an empty file. -$at_traceoff -echo "calc.at:579: \$PREPARSER ./calc /dev/null" -echo calc.at:579 >$at_check_line_file -( $at_traceon; $PREPARSER ./calc /dev/null ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo stderr:; tee stderr <$at_stderr -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 1) ;; - *) echo "calc.at:579: exit code was $at_status, expected 1" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - - -# Normalize the observed and expected error messages, depending upon the -# options. -# 1. Remove the traces from observed. -sed '/^Starting/d -/^Entering/d -/^Stack/d -/^Reading/d -/^Reducing/d -/^Shifting/d -/^state/d -/^Error:/d -/^Next/d -/^Discarding/d -/^yydestructor:/d' stderr >at-stderr -mv at-stderr stderr -# 2. Create the reference error message. -cat >expout <<'_ATEOF' -1.0: syntax error, unexpected "end of input" -_ATEOF - -# 3. If locations are not used, remove them. -sed 's/^[-0-9.]*: //' expout >at-expout -mv at-expout expout -# 4. If error-verbose is not used, strip the`, unexpected....' part. -sed 's/syntax error, .*$/syntax error/' expout >at-expout -mv at-expout expout -# 5. Check -$at_traceoff -echo "calc.at:579: cat stderr" -echo calc.at:579 >$at_check_line_file -( $at_traceon; cat stderr ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -$at_diff expout $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:579: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - - -# Exercise the error token: without it, we die at the first error, -# hence be sure to -# -# - have several errors which exercise different shift/discardings -# - (): nothing to pop, nothing to discard -# - (1 + 1 + 1 +): a lot to pop, nothing to discard -# - (* * *): nothing to pop, a lot to discard -# - (1 + 2 * *): some to pop and discard -# -# - test the action associated to `error' -# -# - check the lookahead that triggers an error is not discarded -# when we enter error recovery. Below, the lookahead causing the -# first error is ")", which is needed to recover from the error and -# produce the "0" that triggers the "0 != 1" error. -# -cat >input <<'_ATEOF' -() + (1 + 1 + 1 +) + (* * *) + (1 * 2 * *) = 1 -_ATEOF - -$at_traceoff -echo "calc.at:579: \$PREPARSER ./calc input" -echo calc.at:579 >$at_check_line_file -( $at_traceon; $PREPARSER ./calc input ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo stderr:; tee stderr <$at_stderr -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:579: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - - -# Normalize the observed and expected error messages, depending upon the -# options. -# 1. Remove the traces from observed. -sed '/^Starting/d -/^Entering/d -/^Stack/d -/^Reading/d -/^Reducing/d -/^Shifting/d -/^state/d -/^Error:/d -/^Next/d -/^Discarding/d -/^yydestructor:/d' stderr >at-stderr -mv at-stderr stderr -# 2. Create the reference error message. -cat >expout <<'_ATEOF' -1.1: syntax error, unexpected ')', expecting "number" or '-' or '(' or '!' -1.17: syntax error, unexpected ')', expecting "number" or '-' or '(' or '!' -1.22: syntax error, unexpected '*', expecting "number" or '-' or '(' or '!' -1.40: syntax error, unexpected '*', expecting "number" or '-' or '(' or '!' -calc: error: 4444 != 1 -_ATEOF - -# 3. If locations are not used, remove them. -sed 's/^[-0-9.]*: //' expout >at-expout -mv at-expout expout -# 4. If error-verbose is not used, strip the`, unexpected....' part. -sed 's/syntax error, .*$/syntax error/' expout >at-expout -mv at-expout expout -# 5. Check -$at_traceoff -echo "calc.at:579: cat stderr" -echo calc.at:579 >$at_check_line_file -( $at_traceon; cat stderr ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -$at_diff expout $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:579: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - - -# The same, but this time exercising explicitly triggered syntax errors. -# POSIX says the lookahead causing the error should not be discarded. -cat >input <<'_ATEOF' -(!) + (0 0) = 1 -_ATEOF - -$at_traceoff -echo "calc.at:579: \$PREPARSER ./calc input" -echo calc.at:579 >$at_check_line_file -( $at_traceon; $PREPARSER ./calc input ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo stderr:; tee stderr <$at_stderr -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:579: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - - -# Normalize the observed and expected error messages, depending upon the -# options. -# 1. Remove the traces from observed. -sed '/^Starting/d -/^Entering/d -/^Stack/d -/^Reading/d -/^Reducing/d -/^Shifting/d -/^state/d -/^Error:/d -/^Next/d -/^Discarding/d -/^yydestructor:/d' stderr >at-stderr -mv at-stderr stderr -# 2. Create the reference error message. -cat >expout <<'_ATEOF' -1.9: syntax error, unexpected "number" -calc: error: 2222 != 1 -_ATEOF - -# 3. If locations are not used, remove them. -sed 's/^[-0-9.]*: //' expout >at-expout -mv at-expout expout -# 4. If error-verbose is not used, strip the`, unexpected....' part. -sed 's/syntax error, .*$/syntax error/' expout >at-expout -mv at-expout expout -# 5. Check -$at_traceoff -echo "calc.at:579: cat stderr" -echo calc.at:579 >$at_check_line_file -( $at_traceon; cat stderr ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -$at_diff expout $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:579: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - -cat >input <<'_ATEOF' -(- *) + (0 0) = 1 -_ATEOF - -$at_traceoff -echo "calc.at:579: \$PREPARSER ./calc input" -echo calc.at:579 >$at_check_line_file -( $at_traceon; $PREPARSER ./calc input ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo stderr:; tee stderr <$at_stderr -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:579: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - - -# Normalize the observed and expected error messages, depending upon the -# options. -# 1. Remove the traces from observed. -sed '/^Starting/d -/^Entering/d -/^Stack/d -/^Reading/d -/^Reducing/d -/^Shifting/d -/^state/d -/^Error:/d -/^Next/d -/^Discarding/d -/^yydestructor:/d' stderr >at-stderr -mv at-stderr stderr -# 2. Create the reference error message. -cat >expout <<'_ATEOF' -1.3: syntax error, unexpected '*', expecting "number" or '-' or '(' or '!' -1.11: syntax error, unexpected "number" -calc: error: 2222 != 1 -_ATEOF - -# 3. If locations are not used, remove them. -sed 's/^[-0-9.]*: //' expout >at-expout -mv at-expout expout -# 4. If error-verbose is not used, strip the`, unexpected....' part. -sed 's/syntax error, .*$/syntax error/' expout >at-expout -mv at-expout expout -# 5. Check -$at_traceoff -echo "calc.at:579: cat stderr" -echo calc.at:579 >$at_check_line_file -( $at_traceon; cat stderr ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -$at_diff expout $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:579: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - - - - - - - - - - - - - - - - - - - - - $at_traceoff - $at_times_p && times >$at_times_file - ) 5>&1 2>&1 | eval $at_tee_pipe - at_status=`cat $at_status_file` - ;; - - 72 ) # 72. calc.at:580: Calculator %glr-parser %locations - at_setup_line='calc.at:580' - at_desc='Calculator %glr-parser %locations' - $at_quiet $ECHO_N " 72: Calculator %glr-parser %locations $ECHO_C" - at_xfail=no - ( - echo "72. calc.at:580: testing ..." - $at_traceon - - - - - - -# Using yacc.c? - - - - - - - -# yyerror receives the location if %location & %pure & (%glr or %parse-param). - -# yyerror always sees the locations (when activated), except if -# yacc & pure & !param. - - -# The interface is pure: either because %pure-parser, or because we -# are using the C++ parsers. - - - - - - - - - - - - -cat >calc.y <<'_ATEOF' -%{ -#if HAVE_CONFIG_H -# include - /* We don't need perfect functions for these tests. */ -# undef malloc -# undef memcmp -# undef realloc -#endif -%} - -/* Infix notation calculator--calc */ -%glr-parser %locations -%{ -#include - -#include -#include -#if HAVE_UNISTD_H -# include -#else -# undef alarm -# define alarm(seconds) /* empty */ -#endif -#include - -/* Exercise pre-prologue dependency to %union. */ -typedef int semantic_value; - -static semantic_value global_result = 0; -static int global_count = 0; -%} - -/* Exercise %union. */ -%union -{ - semantic_value ival; -}; - -%{ -static int power (int base, int exponent); -/* yyerror receives the location if: - - %location & %pure & %glr - - %location & %pure & %yacc & %parse-param. */ -static void yyerror ( - - const char *s - ); -static int yylex (void); -static int yygetc (void); -static void yyungetc ( int c); -%} - -/* Bison Declarations */ -%token CALC_EOF 0 "end of input" -%token NUM "number" -%type exp - -%nonassoc '=' /* comparison */ -%left '-' '+' -%left '*' '/' -%left NEG /* negation--unary minus */ -%right '^' /* exponentiation */ - -/* Grammar follows */ -%% -input: - line -| input line { } -; - -line: - '\n' -| exp '\n' { } -; - -exp: - NUM { $$ = $1; } -| exp '=' exp - { - if ($1 != $3) - fprintf (stderr, "calc: error: %d != %d\n", $1, $3); - $$ = $1; - } -| exp '+' exp { $$ = $1 + $3; } -| exp '-' exp { $$ = $1 - $3; } -| exp '*' exp { $$ = $1 * $3; } -| exp '/' exp { $$ = $1 / $3; } -| '-' exp %prec NEG { $$ = -$2; } -| exp '^' exp { $$ = power ($1, $3); } -| '(' exp ')' { $$ = $2; } -| '(' error ')' { $$ = 1111; } -| '!' { YYERROR; } -| '-' error { YYERROR; } -; -%% -/* The input. */ -static FILE *yyin; - -static void -yyerror ( - - const char *s) -{ - - - fprintf (stderr, "%d.%d", - (yylloc).first_line, (yylloc).first_column); - if ((yylloc).first_line != (yylloc).last_line) - fprintf (stderr, "-%d.%d", - (yylloc).last_line, (yylloc).last_column - 1); - else if ((yylloc).first_column != (yylloc).last_column - 1) - fprintf (stderr, "-%d", - (yylloc).last_column - 1); - fprintf (stderr, ": "); - fprintf (stderr, "%s\n", s); -} - - - -static YYLTYPE last_yylloc; - -static int -yygetc (void) -{ - int res = getc (yyin); - ; - - last_yylloc = (yylloc); - if (res == '\n') - { - (yylloc).last_line++; - (yylloc).last_column = 0; - } - else - (yylloc).last_column++; - - return res; -} - - -static void -yyungetc ( int c) -{ - ; - - /* Wrong when C == `\n'. */ - (yylloc) = last_yylloc; - - ungetc (c, yyin); -} - -static int -read_signed_integer (void) -{ - int c = yygetc (); - int sign = 1; - int n = 0; - - ; - if (c == '-') - { - c = yygetc (); - sign = -1; - } - - while (isdigit (c)) - { - n = 10 * n + (c - '0'); - c = yygetc (); - } - - yyungetc ( c); - - return sign * n; -} - - - -/*---------------------------------------------------------------. -| Lexical analyzer returns an integer on the stack and the token | -| NUM, or the ASCII character read if not a number. Skips all | -| blanks and tabs, returns 0 for EOF. | -`---------------------------------------------------------------*/ - -static int -yylex (void) -{ - static int init = 1; - int c; - - if (init) - { - init = 0; - - (yylloc).last_column = 0; - (yylloc).last_line = 1; - - } - - (yylloc).first_column = (yylloc).last_column; - (yylloc).first_line = (yylloc).last_line; - - - /* Skip white space. */ - while ((c = yygetc ()) == ' ' || c == '\t') - { - (yylloc).first_column = (yylloc).last_column; - (yylloc).first_line = (yylloc).last_line; - - } - - /* process numbers */ - if (c == '.' || isdigit (c)) - { - yyungetc ( c); - (yylval).ival = read_signed_integer (); - return NUM; - } - - /* Return end-of-file. */ - if (c == EOF) - return CALC_EOF; - - /* Return single chars. */ - return c; -} - -static int -power (int base, int exponent) -{ - int res = 1; - if (exponent < 0) - exit (1); - for (/* Niente */; exponent; --exponent) - res *= base; - return res; -} - - -int -main (int argc, const char **argv) -{ - semantic_value result = 0; - int count = 0; - int status; - - alarm (10); - if (argc == 2) - yyin = fopen (argv[1], "r"); - else - yyin = stdin; - - if (!yyin) - { - perror (argv[1]); - exit (1); - } - - - status = yyparse (); - if (global_result != result) - abort (); - if (global_count != count) - abort (); - return status; -} -_ATEOF - - - - - -# Specify the output files to avoid problems on different file systems. -$at_traceoff -echo "calc.at:580: bison -o calc.c calc.y" -echo calc.at:580 >$at_check_line_file -( $at_traceon; bison -o calc.c calc.y ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:580: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - -$at_traceoff -echo "calc.at:580: \$CC \$CFLAGS \$CPPFLAGS \$LDFLAGS calc.c \$LIBS -o calc" -echo calc.at:580 >$at_check_line_file -( $at_traceon; $CC $CFLAGS $CPPFLAGS $LDFLAGS calc.c $LIBS -o calc ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo stderr:; cat $at_stderr -echo stdout:; cat $at_stdout -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:580: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - -# Test the priorities. -cat >input <<'_ATEOF' -1 + 2 * 3 = 7 -1 + 2 * -3 = -5 - --1^2 = -1 -(-1)^2 = 1 - ----1 = -1 - -1 - 2 - 3 = -4 -1 - (2 - 3) = 2 - -2^2^3 = 256 -(2^2)^3 = 64 -_ATEOF - -$at_traceoff -echo "calc.at:580: \$PREPARSER ./calc input" -echo calc.at:580 >$at_check_line_file -( $at_traceon; $PREPARSER ./calc input ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo stderr:; tee stderr <$at_stderr -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:580: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - - - -# Some syntax errors. -cat >input <<'_ATEOF' -0 0 -_ATEOF - -$at_traceoff -echo "calc.at:580: \$PREPARSER ./calc input" -echo calc.at:580 >$at_check_line_file -( $at_traceon; $PREPARSER ./calc input ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo stderr:; tee stderr <$at_stderr -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 1) ;; - *) echo "calc.at:580: exit code was $at_status, expected 1" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - - -# Normalize the observed and expected error messages, depending upon the -# options. -# 1. Remove the traces from observed. -sed '/^Starting/d -/^Entering/d -/^Stack/d -/^Reading/d -/^Reducing/d -/^Shifting/d -/^state/d -/^Error:/d -/^Next/d -/^Discarding/d -/^yydestructor:/d' stderr >at-stderr -mv at-stderr stderr -# 2. Create the reference error message. -cat >expout <<'_ATEOF' -1.2: syntax error, unexpected "number" -_ATEOF - -# 3. If locations are not used, remove them. - -# 4. If error-verbose is not used, strip the`, unexpected....' part. -sed 's/syntax error, .*$/syntax error/' expout >at-expout -mv at-expout expout -# 5. Check -$at_traceoff -echo "calc.at:580: cat stderr" -echo calc.at:580 >$at_check_line_file -( $at_traceon; cat stderr ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -$at_diff expout $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:580: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - -cat >input <<'_ATEOF' -1//2 -_ATEOF - -$at_traceoff -echo "calc.at:580: \$PREPARSER ./calc input" -echo calc.at:580 >$at_check_line_file -( $at_traceon; $PREPARSER ./calc input ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo stderr:; tee stderr <$at_stderr -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 1) ;; - *) echo "calc.at:580: exit code was $at_status, expected 1" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - - -# Normalize the observed and expected error messages, depending upon the -# options. -# 1. Remove the traces from observed. -sed '/^Starting/d -/^Entering/d -/^Stack/d -/^Reading/d -/^Reducing/d -/^Shifting/d -/^state/d -/^Error:/d -/^Next/d -/^Discarding/d -/^yydestructor:/d' stderr >at-stderr -mv at-stderr stderr -# 2. Create the reference error message. -cat >expout <<'_ATEOF' -1.2: syntax error, unexpected '/', expecting "number" or '-' or '(' or '!' -_ATEOF - -# 3. If locations are not used, remove them. - -# 4. If error-verbose is not used, strip the`, unexpected....' part. -sed 's/syntax error, .*$/syntax error/' expout >at-expout -mv at-expout expout -# 5. Check -$at_traceoff -echo "calc.at:580: cat stderr" -echo calc.at:580 >$at_check_line_file -( $at_traceon; cat stderr ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -$at_diff expout $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:580: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - -cat >input <<'_ATEOF' -error -_ATEOF - -$at_traceoff -echo "calc.at:580: \$PREPARSER ./calc input" -echo calc.at:580 >$at_check_line_file -( $at_traceon; $PREPARSER ./calc input ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo stderr:; tee stderr <$at_stderr -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 1) ;; - *) echo "calc.at:580: exit code was $at_status, expected 1" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - - -# Normalize the observed and expected error messages, depending upon the -# options. -# 1. Remove the traces from observed. -sed '/^Starting/d -/^Entering/d -/^Stack/d -/^Reading/d -/^Reducing/d -/^Shifting/d -/^state/d -/^Error:/d -/^Next/d -/^Discarding/d -/^yydestructor:/d' stderr >at-stderr -mv at-stderr stderr -# 2. Create the reference error message. -cat >expout <<'_ATEOF' -1.0: syntax error, unexpected $undefined -_ATEOF - -# 3. If locations are not used, remove them. - -# 4. If error-verbose is not used, strip the`, unexpected....' part. -sed 's/syntax error, .*$/syntax error/' expout >at-expout -mv at-expout expout -# 5. Check -$at_traceoff -echo "calc.at:580: cat stderr" -echo calc.at:580 >$at_check_line_file -( $at_traceon; cat stderr ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -$at_diff expout $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:580: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - -cat >input <<'_ATEOF' -1 = 2 = 3 -_ATEOF - -$at_traceoff -echo "calc.at:580: \$PREPARSER ./calc input" -echo calc.at:580 >$at_check_line_file -( $at_traceon; $PREPARSER ./calc input ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo stderr:; tee stderr <$at_stderr -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 1) ;; - *) echo "calc.at:580: exit code was $at_status, expected 1" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - - -# Normalize the observed and expected error messages, depending upon the -# options. -# 1. Remove the traces from observed. -sed '/^Starting/d -/^Entering/d -/^Stack/d -/^Reading/d -/^Reducing/d -/^Shifting/d -/^state/d -/^Error:/d -/^Next/d -/^Discarding/d -/^yydestructor:/d' stderr >at-stderr -mv at-stderr stderr -# 2. Create the reference error message. -cat >expout <<'_ATEOF' -1.6: syntax error, unexpected '=' -_ATEOF - -# 3. If locations are not used, remove them. - -# 4. If error-verbose is not used, strip the`, unexpected....' part. -sed 's/syntax error, .*$/syntax error/' expout >at-expout -mv at-expout expout -# 5. Check -$at_traceoff -echo "calc.at:580: cat stderr" -echo calc.at:580 >$at_check_line_file -( $at_traceon; cat stderr ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -$at_diff expout $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:580: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - -cat >input <<'_ATEOF' - -+1 -_ATEOF - -$at_traceoff -echo "calc.at:580: \$PREPARSER ./calc input" -echo calc.at:580 >$at_check_line_file -( $at_traceon; $PREPARSER ./calc input ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo stderr:; tee stderr <$at_stderr -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 1) ;; - *) echo "calc.at:580: exit code was $at_status, expected 1" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - - -# Normalize the observed and expected error messages, depending upon the -# options. -# 1. Remove the traces from observed. -sed '/^Starting/d -/^Entering/d -/^Stack/d -/^Reading/d -/^Reducing/d -/^Shifting/d -/^state/d -/^Error:/d -/^Next/d -/^Discarding/d -/^yydestructor:/d' stderr >at-stderr -mv at-stderr stderr -# 2. Create the reference error message. -cat >expout <<'_ATEOF' -2.0: syntax error, unexpected '+' -_ATEOF - -# 3. If locations are not used, remove them. - -# 4. If error-verbose is not used, strip the`, unexpected....' part. -sed 's/syntax error, .*$/syntax error/' expout >at-expout -mv at-expout expout -# 5. Check -$at_traceoff -echo "calc.at:580: cat stderr" -echo calc.at:580 >$at_check_line_file -( $at_traceon; cat stderr ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -$at_diff expout $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:580: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - -# Exercise error messages with EOF: work on an empty file. -$at_traceoff -echo "calc.at:580: \$PREPARSER ./calc /dev/null" -echo calc.at:580 >$at_check_line_file -( $at_traceon; $PREPARSER ./calc /dev/null ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo stderr:; tee stderr <$at_stderr -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 1) ;; - *) echo "calc.at:580: exit code was $at_status, expected 1" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - - -# Normalize the observed and expected error messages, depending upon the -# options. -# 1. Remove the traces from observed. -sed '/^Starting/d -/^Entering/d -/^Stack/d -/^Reading/d -/^Reducing/d -/^Shifting/d -/^state/d -/^Error:/d -/^Next/d -/^Discarding/d -/^yydestructor:/d' stderr >at-stderr -mv at-stderr stderr -# 2. Create the reference error message. -cat >expout <<'_ATEOF' -1.0: syntax error, unexpected "end of input" -_ATEOF - -# 3. If locations are not used, remove them. - -# 4. If error-verbose is not used, strip the`, unexpected....' part. -sed 's/syntax error, .*$/syntax error/' expout >at-expout -mv at-expout expout -# 5. Check -$at_traceoff -echo "calc.at:580: cat stderr" -echo calc.at:580 >$at_check_line_file -( $at_traceon; cat stderr ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -$at_diff expout $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:580: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - - -# Exercise the error token: without it, we die at the first error, -# hence be sure to -# -# - have several errors which exercise different shift/discardings -# - (): nothing to pop, nothing to discard -# - (1 + 1 + 1 +): a lot to pop, nothing to discard -# - (* * *): nothing to pop, a lot to discard -# - (1 + 2 * *): some to pop and discard -# -# - test the action associated to `error' -# -# - check the lookahead that triggers an error is not discarded -# when we enter error recovery. Below, the lookahead causing the -# first error is ")", which is needed to recover from the error and -# produce the "0" that triggers the "0 != 1" error. -# -cat >input <<'_ATEOF' -() + (1 + 1 + 1 +) + (* * *) + (1 * 2 * *) = 1 -_ATEOF - -$at_traceoff -echo "calc.at:580: \$PREPARSER ./calc input" -echo calc.at:580 >$at_check_line_file -( $at_traceon; $PREPARSER ./calc input ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo stderr:; tee stderr <$at_stderr -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:580: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - - -# Normalize the observed and expected error messages, depending upon the -# options. -# 1. Remove the traces from observed. -sed '/^Starting/d -/^Entering/d -/^Stack/d -/^Reading/d -/^Reducing/d -/^Shifting/d -/^state/d -/^Error:/d -/^Next/d -/^Discarding/d -/^yydestructor:/d' stderr >at-stderr -mv at-stderr stderr -# 2. Create the reference error message. -cat >expout <<'_ATEOF' -1.1: syntax error, unexpected ')', expecting "number" or '-' or '(' or '!' -1.17: syntax error, unexpected ')', expecting "number" or '-' or '(' or '!' -1.22: syntax error, unexpected '*', expecting "number" or '-' or '(' or '!' -1.40: syntax error, unexpected '*', expecting "number" or '-' or '(' or '!' -calc: error: 4444 != 1 -_ATEOF - -# 3. If locations are not used, remove them. - -# 4. If error-verbose is not used, strip the`, unexpected....' part. -sed 's/syntax error, .*$/syntax error/' expout >at-expout -mv at-expout expout -# 5. Check -$at_traceoff -echo "calc.at:580: cat stderr" -echo calc.at:580 >$at_check_line_file -( $at_traceon; cat stderr ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -$at_diff expout $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:580: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - - -# The same, but this time exercising explicitly triggered syntax errors. -# POSIX says the lookahead causing the error should not be discarded. -cat >input <<'_ATEOF' -(!) + (0 0) = 1 -_ATEOF - -$at_traceoff -echo "calc.at:580: \$PREPARSER ./calc input" -echo calc.at:580 >$at_check_line_file -( $at_traceon; $PREPARSER ./calc input ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo stderr:; tee stderr <$at_stderr -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:580: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - - -# Normalize the observed and expected error messages, depending upon the -# options. -# 1. Remove the traces from observed. -sed '/^Starting/d -/^Entering/d -/^Stack/d -/^Reading/d -/^Reducing/d -/^Shifting/d -/^state/d -/^Error:/d -/^Next/d -/^Discarding/d -/^yydestructor:/d' stderr >at-stderr -mv at-stderr stderr -# 2. Create the reference error message. -cat >expout <<'_ATEOF' -1.9: syntax error, unexpected "number" -calc: error: 2222 != 1 -_ATEOF - -# 3. If locations are not used, remove them. - -# 4. If error-verbose is not used, strip the`, unexpected....' part. -sed 's/syntax error, .*$/syntax error/' expout >at-expout -mv at-expout expout -# 5. Check -$at_traceoff -echo "calc.at:580: cat stderr" -echo calc.at:580 >$at_check_line_file -( $at_traceon; cat stderr ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -$at_diff expout $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:580: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - -cat >input <<'_ATEOF' -(- *) + (0 0) = 1 -_ATEOF - -$at_traceoff -echo "calc.at:580: \$PREPARSER ./calc input" -echo calc.at:580 >$at_check_line_file -( $at_traceon; $PREPARSER ./calc input ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo stderr:; tee stderr <$at_stderr -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:580: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - - -# Normalize the observed and expected error messages, depending upon the -# options. -# 1. Remove the traces from observed. -sed '/^Starting/d -/^Entering/d -/^Stack/d -/^Reading/d -/^Reducing/d -/^Shifting/d -/^state/d -/^Error:/d -/^Next/d -/^Discarding/d -/^yydestructor:/d' stderr >at-stderr -mv at-stderr stderr -# 2. Create the reference error message. -cat >expout <<'_ATEOF' -1.3: syntax error, unexpected '*', expecting "number" or '-' or '(' or '!' -1.11: syntax error, unexpected "number" -calc: error: 2222 != 1 -_ATEOF - -# 3. If locations are not used, remove them. - -# 4. If error-verbose is not used, strip the`, unexpected....' part. -sed 's/syntax error, .*$/syntax error/' expout >at-expout -mv at-expout expout -# 5. Check -$at_traceoff -echo "calc.at:580: cat stderr" -echo calc.at:580 >$at_check_line_file -( $at_traceon; cat stderr ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -$at_diff expout $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:580: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - - - - - - - - - - - - - - - - - - - - - $at_traceoff - $at_times_p && times >$at_times_file - ) 5>&1 2>&1 | eval $at_tee_pipe - at_status=`cat $at_status_file` - ;; - - 73 ) # 73. calc.at:581: Calculator %glr-parser %name-prefix="calc" - at_setup_line='calc.at:581' - at_desc='Calculator %glr-parser %name-prefix="calc"' - $at_quiet $ECHO_N " 73: Calculator %glr-parser %name-prefix="calc" $ECHO_C" - at_xfail=no - ( - echo "73. calc.at:581: testing ..." - $at_traceon - - - - - - -# Using yacc.c? - - - - - - - -# yyerror receives the location if %location & %pure & (%glr or %parse-param). - -# yyerror always sees the locations (when activated), except if -# yacc & pure & !param. - - -# The interface is pure: either because %pure-parser, or because we -# are using the C++ parsers. - - - - - - - - - - - - -cat >calc.y <<'_ATEOF' -%{ -#if HAVE_CONFIG_H -# include - /* We don't need perfect functions for these tests. */ -# undef malloc -# undef memcmp -# undef realloc -#endif -%} - -/* Infix notation calculator--calc */ -%glr-parser %name-prefix="calc" -%{ -#include - -#include -#include -#if HAVE_UNISTD_H -# include -#else -# undef alarm -# define alarm(seconds) /* empty */ -#endif -#include - -/* Exercise pre-prologue dependency to %union. */ -typedef int semantic_value; - -static semantic_value global_result = 0; -static int global_count = 0; -%} - -/* Exercise %union. */ -%union -{ - semantic_value ival; -}; - -%{ -static int power (int base, int exponent); -/* yyerror receives the location if: - - %location & %pure & %glr - - %location & %pure & %yacc & %parse-param. */ -static void yyerror ( - - const char *s - ); -static int yylex (void); -static int yygetc (void); -static void yyungetc ( int c); -%} - -/* Bison Declarations */ -%token CALC_EOF 0 "end of input" -%token NUM "number" -%type exp - -%nonassoc '=' /* comparison */ -%left '-' '+' -%left '*' '/' -%left NEG /* negation--unary minus */ -%right '^' /* exponentiation */ - -/* Grammar follows */ -%% -input: - line -| input line { } -; - -line: - '\n' -| exp '\n' { } -; - -exp: - NUM { $$ = $1; } -| exp '=' exp - { - if ($1 != $3) - fprintf (stderr, "calc: error: %d != %d\n", $1, $3); - $$ = $1; - } -| exp '+' exp { $$ = $1 + $3; } -| exp '-' exp { $$ = $1 - $3; } -| exp '*' exp { $$ = $1 * $3; } -| exp '/' exp { $$ = $1 / $3; } -| '-' exp %prec NEG { $$ = -$2; } -| exp '^' exp { $$ = power ($1, $3); } -| '(' exp ')' { $$ = $2; } -| '(' error ')' { $$ = 1111; } -| '!' { YYERROR; } -| '-' error { YYERROR; } -; -%% -/* The input. */ -static FILE *yyin; - -static void -yyerror ( - - const char *s) -{ - - - fprintf (stderr, "%s\n", s); -} - - - -static int -yygetc (void) -{ - int res = getc (yyin); - ; - - return res; -} - - -static void -yyungetc ( int c) -{ - ; - - ungetc (c, yyin); -} - -static int -read_signed_integer (void) -{ - int c = yygetc (); - int sign = 1; - int n = 0; - - ; - if (c == '-') - { - c = yygetc (); - sign = -1; - } - - while (isdigit (c)) - { - n = 10 * n + (c - '0'); - c = yygetc (); - } - - yyungetc ( c); - - return sign * n; -} - - - -/*---------------------------------------------------------------. -| Lexical analyzer returns an integer on the stack and the token | -| NUM, or the ASCII character read if not a number. Skips all | -| blanks and tabs, returns 0 for EOF. | -`---------------------------------------------------------------*/ - -static int -yylex (void) -{ - static int init = 1; - int c; - - if (init) - { - init = 0; - - } - - - - /* Skip white space. */ - while ((c = yygetc ()) == ' ' || c == '\t') - { - - } - - /* process numbers */ - if (c == '.' || isdigit (c)) - { - yyungetc ( c); - (yylval).ival = read_signed_integer (); - return NUM; - } - - /* Return end-of-file. */ - if (c == EOF) - return CALC_EOF; - - /* Return single chars. */ - return c; -} - -static int -power (int base, int exponent) -{ - int res = 1; - if (exponent < 0) - exit (1); - for (/* Niente */; exponent; --exponent) - res *= base; - return res; -} - - -int -main (int argc, const char **argv) -{ - semantic_value result = 0; - int count = 0; - int status; - - alarm (10); - if (argc == 2) - yyin = fopen (argv[1], "r"); - else - yyin = stdin; - - if (!yyin) - { - perror (argv[1]); - exit (1); - } - - - status = yyparse (); - if (global_result != result) - abort (); - if (global_count != count) - abort (); - return status; -} -_ATEOF - - - - - -# Specify the output files to avoid problems on different file systems. -$at_traceoff -echo "calc.at:581: bison -o calc.c calc.y" -echo calc.at:581 >$at_check_line_file -( $at_traceon; bison -o calc.c calc.y ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:581: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - -$at_traceoff -echo "calc.at:581: \$CC \$CFLAGS \$CPPFLAGS \$LDFLAGS calc.c \$LIBS -o calc" -echo calc.at:581 >$at_check_line_file -( $at_traceon; $CC $CFLAGS $CPPFLAGS $LDFLAGS calc.c $LIBS -o calc ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo stderr:; cat $at_stderr -echo stdout:; cat $at_stdout -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:581: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - -# Test the priorities. -cat >input <<'_ATEOF' -1 + 2 * 3 = 7 -1 + 2 * -3 = -5 - --1^2 = -1 -(-1)^2 = 1 - ----1 = -1 - -1 - 2 - 3 = -4 -1 - (2 - 3) = 2 - -2^2^3 = 256 -(2^2)^3 = 64 -_ATEOF - -$at_traceoff -echo "calc.at:581: \$PREPARSER ./calc input" -echo calc.at:581 >$at_check_line_file -( $at_traceon; $PREPARSER ./calc input ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo stderr:; tee stderr <$at_stderr -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:581: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - - - -# Some syntax errors. -cat >input <<'_ATEOF' -0 0 -_ATEOF - -$at_traceoff -echo "calc.at:581: \$PREPARSER ./calc input" -echo calc.at:581 >$at_check_line_file -( $at_traceon; $PREPARSER ./calc input ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo stderr:; tee stderr <$at_stderr -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 1) ;; - *) echo "calc.at:581: exit code was $at_status, expected 1" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - - -# Normalize the observed and expected error messages, depending upon the -# options. -# 1. Remove the traces from observed. -sed '/^Starting/d -/^Entering/d -/^Stack/d -/^Reading/d -/^Reducing/d -/^Shifting/d -/^state/d -/^Error:/d -/^Next/d -/^Discarding/d -/^yydestructor:/d' stderr >at-stderr -mv at-stderr stderr -# 2. Create the reference error message. -cat >expout <<'_ATEOF' -1.2: syntax error, unexpected "number" -_ATEOF - -# 3. If locations are not used, remove them. -sed 's/^[-0-9.]*: //' expout >at-expout -mv at-expout expout -# 4. If error-verbose is not used, strip the`, unexpected....' part. -sed 's/syntax error, .*$/syntax error/' expout >at-expout -mv at-expout expout -# 5. Check -$at_traceoff -echo "calc.at:581: cat stderr" -echo calc.at:581 >$at_check_line_file -( $at_traceon; cat stderr ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -$at_diff expout $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:581: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - -cat >input <<'_ATEOF' -1//2 -_ATEOF - -$at_traceoff -echo "calc.at:581: \$PREPARSER ./calc input" -echo calc.at:581 >$at_check_line_file -( $at_traceon; $PREPARSER ./calc input ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo stderr:; tee stderr <$at_stderr -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 1) ;; - *) echo "calc.at:581: exit code was $at_status, expected 1" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - - -# Normalize the observed and expected error messages, depending upon the -# options. -# 1. Remove the traces from observed. -sed '/^Starting/d -/^Entering/d -/^Stack/d -/^Reading/d -/^Reducing/d -/^Shifting/d -/^state/d -/^Error:/d -/^Next/d -/^Discarding/d -/^yydestructor:/d' stderr >at-stderr -mv at-stderr stderr -# 2. Create the reference error message. -cat >expout <<'_ATEOF' -1.2: syntax error, unexpected '/', expecting "number" or '-' or '(' or '!' -_ATEOF - -# 3. If locations are not used, remove them. -sed 's/^[-0-9.]*: //' expout >at-expout -mv at-expout expout -# 4. If error-verbose is not used, strip the`, unexpected....' part. -sed 's/syntax error, .*$/syntax error/' expout >at-expout -mv at-expout expout -# 5. Check -$at_traceoff -echo "calc.at:581: cat stderr" -echo calc.at:581 >$at_check_line_file -( $at_traceon; cat stderr ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -$at_diff expout $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:581: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - -cat >input <<'_ATEOF' -error -_ATEOF - -$at_traceoff -echo "calc.at:581: \$PREPARSER ./calc input" -echo calc.at:581 >$at_check_line_file -( $at_traceon; $PREPARSER ./calc input ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo stderr:; tee stderr <$at_stderr -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 1) ;; - *) echo "calc.at:581: exit code was $at_status, expected 1" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - - -# Normalize the observed and expected error messages, depending upon the -# options. -# 1. Remove the traces from observed. -sed '/^Starting/d -/^Entering/d -/^Stack/d -/^Reading/d -/^Reducing/d -/^Shifting/d -/^state/d -/^Error:/d -/^Next/d -/^Discarding/d -/^yydestructor:/d' stderr >at-stderr -mv at-stderr stderr -# 2. Create the reference error message. -cat >expout <<'_ATEOF' -1.0: syntax error, unexpected $undefined -_ATEOF - -# 3. If locations are not used, remove them. -sed 's/^[-0-9.]*: //' expout >at-expout -mv at-expout expout -# 4. If error-verbose is not used, strip the`, unexpected....' part. -sed 's/syntax error, .*$/syntax error/' expout >at-expout -mv at-expout expout -# 5. Check -$at_traceoff -echo "calc.at:581: cat stderr" -echo calc.at:581 >$at_check_line_file -( $at_traceon; cat stderr ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -$at_diff expout $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:581: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - -cat >input <<'_ATEOF' -1 = 2 = 3 -_ATEOF - -$at_traceoff -echo "calc.at:581: \$PREPARSER ./calc input" -echo calc.at:581 >$at_check_line_file -( $at_traceon; $PREPARSER ./calc input ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo stderr:; tee stderr <$at_stderr -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 1) ;; - *) echo "calc.at:581: exit code was $at_status, expected 1" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - - -# Normalize the observed and expected error messages, depending upon the -# options. -# 1. Remove the traces from observed. -sed '/^Starting/d -/^Entering/d -/^Stack/d -/^Reading/d -/^Reducing/d -/^Shifting/d -/^state/d -/^Error:/d -/^Next/d -/^Discarding/d -/^yydestructor:/d' stderr >at-stderr -mv at-stderr stderr -# 2. Create the reference error message. -cat >expout <<'_ATEOF' -1.6: syntax error, unexpected '=' -_ATEOF - -# 3. If locations are not used, remove them. -sed 's/^[-0-9.]*: //' expout >at-expout -mv at-expout expout -# 4. If error-verbose is not used, strip the`, unexpected....' part. -sed 's/syntax error, .*$/syntax error/' expout >at-expout -mv at-expout expout -# 5. Check -$at_traceoff -echo "calc.at:581: cat stderr" -echo calc.at:581 >$at_check_line_file -( $at_traceon; cat stderr ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -$at_diff expout $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:581: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - -cat >input <<'_ATEOF' - -+1 -_ATEOF - -$at_traceoff -echo "calc.at:581: \$PREPARSER ./calc input" -echo calc.at:581 >$at_check_line_file -( $at_traceon; $PREPARSER ./calc input ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo stderr:; tee stderr <$at_stderr -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 1) ;; - *) echo "calc.at:581: exit code was $at_status, expected 1" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - - -# Normalize the observed and expected error messages, depending upon the -# options. -# 1. Remove the traces from observed. -sed '/^Starting/d -/^Entering/d -/^Stack/d -/^Reading/d -/^Reducing/d -/^Shifting/d -/^state/d -/^Error:/d -/^Next/d -/^Discarding/d -/^yydestructor:/d' stderr >at-stderr -mv at-stderr stderr -# 2. Create the reference error message. -cat >expout <<'_ATEOF' -2.0: syntax error, unexpected '+' -_ATEOF - -# 3. If locations are not used, remove them. -sed 's/^[-0-9.]*: //' expout >at-expout -mv at-expout expout -# 4. If error-verbose is not used, strip the`, unexpected....' part. -sed 's/syntax error, .*$/syntax error/' expout >at-expout -mv at-expout expout -# 5. Check -$at_traceoff -echo "calc.at:581: cat stderr" -echo calc.at:581 >$at_check_line_file -( $at_traceon; cat stderr ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -$at_diff expout $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:581: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - -# Exercise error messages with EOF: work on an empty file. -$at_traceoff -echo "calc.at:581: \$PREPARSER ./calc /dev/null" -echo calc.at:581 >$at_check_line_file -( $at_traceon; $PREPARSER ./calc /dev/null ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo stderr:; tee stderr <$at_stderr -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 1) ;; - *) echo "calc.at:581: exit code was $at_status, expected 1" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - - -# Normalize the observed and expected error messages, depending upon the -# options. -# 1. Remove the traces from observed. -sed '/^Starting/d -/^Entering/d -/^Stack/d -/^Reading/d -/^Reducing/d -/^Shifting/d -/^state/d -/^Error:/d -/^Next/d -/^Discarding/d -/^yydestructor:/d' stderr >at-stderr -mv at-stderr stderr -# 2. Create the reference error message. -cat >expout <<'_ATEOF' -1.0: syntax error, unexpected "end of input" -_ATEOF - -# 3. If locations are not used, remove them. -sed 's/^[-0-9.]*: //' expout >at-expout -mv at-expout expout -# 4. If error-verbose is not used, strip the`, unexpected....' part. -sed 's/syntax error, .*$/syntax error/' expout >at-expout -mv at-expout expout -# 5. Check -$at_traceoff -echo "calc.at:581: cat stderr" -echo calc.at:581 >$at_check_line_file -( $at_traceon; cat stderr ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -$at_diff expout $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:581: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - - -# Exercise the error token: without it, we die at the first error, -# hence be sure to -# -# - have several errors which exercise different shift/discardings -# - (): nothing to pop, nothing to discard -# - (1 + 1 + 1 +): a lot to pop, nothing to discard -# - (* * *): nothing to pop, a lot to discard -# - (1 + 2 * *): some to pop and discard -# -# - test the action associated to `error' -# -# - check the lookahead that triggers an error is not discarded -# when we enter error recovery. Below, the lookahead causing the -# first error is ")", which is needed to recover from the error and -# produce the "0" that triggers the "0 != 1" error. -# -cat >input <<'_ATEOF' -() + (1 + 1 + 1 +) + (* * *) + (1 * 2 * *) = 1 -_ATEOF - -$at_traceoff -echo "calc.at:581: \$PREPARSER ./calc input" -echo calc.at:581 >$at_check_line_file -( $at_traceon; $PREPARSER ./calc input ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo stderr:; tee stderr <$at_stderr -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:581: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - - -# Normalize the observed and expected error messages, depending upon the -# options. -# 1. Remove the traces from observed. -sed '/^Starting/d -/^Entering/d -/^Stack/d -/^Reading/d -/^Reducing/d -/^Shifting/d -/^state/d -/^Error:/d -/^Next/d -/^Discarding/d -/^yydestructor:/d' stderr >at-stderr -mv at-stderr stderr -# 2. Create the reference error message. -cat >expout <<'_ATEOF' -1.1: syntax error, unexpected ')', expecting "number" or '-' or '(' or '!' -1.17: syntax error, unexpected ')', expecting "number" or '-' or '(' or '!' -1.22: syntax error, unexpected '*', expecting "number" or '-' or '(' or '!' -1.40: syntax error, unexpected '*', expecting "number" or '-' or '(' or '!' -calc: error: 4444 != 1 -_ATEOF - -# 3. If locations are not used, remove them. -sed 's/^[-0-9.]*: //' expout >at-expout -mv at-expout expout -# 4. If error-verbose is not used, strip the`, unexpected....' part. -sed 's/syntax error, .*$/syntax error/' expout >at-expout -mv at-expout expout -# 5. Check -$at_traceoff -echo "calc.at:581: cat stderr" -echo calc.at:581 >$at_check_line_file -( $at_traceon; cat stderr ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -$at_diff expout $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:581: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - - -# The same, but this time exercising explicitly triggered syntax errors. -# POSIX says the lookahead causing the error should not be discarded. -cat >input <<'_ATEOF' -(!) + (0 0) = 1 -_ATEOF - -$at_traceoff -echo "calc.at:581: \$PREPARSER ./calc input" -echo calc.at:581 >$at_check_line_file -( $at_traceon; $PREPARSER ./calc input ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo stderr:; tee stderr <$at_stderr -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:581: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - - -# Normalize the observed and expected error messages, depending upon the -# options. -# 1. Remove the traces from observed. -sed '/^Starting/d -/^Entering/d -/^Stack/d -/^Reading/d -/^Reducing/d -/^Shifting/d -/^state/d -/^Error:/d -/^Next/d -/^Discarding/d -/^yydestructor:/d' stderr >at-stderr -mv at-stderr stderr -# 2. Create the reference error message. -cat >expout <<'_ATEOF' -1.9: syntax error, unexpected "number" -calc: error: 2222 != 1 -_ATEOF - -# 3. If locations are not used, remove them. -sed 's/^[-0-9.]*: //' expout >at-expout -mv at-expout expout -# 4. If error-verbose is not used, strip the`, unexpected....' part. -sed 's/syntax error, .*$/syntax error/' expout >at-expout -mv at-expout expout -# 5. Check -$at_traceoff -echo "calc.at:581: cat stderr" -echo calc.at:581 >$at_check_line_file -( $at_traceon; cat stderr ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -$at_diff expout $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:581: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - -cat >input <<'_ATEOF' -(- *) + (0 0) = 1 -_ATEOF - -$at_traceoff -echo "calc.at:581: \$PREPARSER ./calc input" -echo calc.at:581 >$at_check_line_file -( $at_traceon; $PREPARSER ./calc input ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo stderr:; tee stderr <$at_stderr -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:581: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - - -# Normalize the observed and expected error messages, depending upon the -# options. -# 1. Remove the traces from observed. -sed '/^Starting/d -/^Entering/d -/^Stack/d -/^Reading/d -/^Reducing/d -/^Shifting/d -/^state/d -/^Error:/d -/^Next/d -/^Discarding/d -/^yydestructor:/d' stderr >at-stderr -mv at-stderr stderr -# 2. Create the reference error message. -cat >expout <<'_ATEOF' -1.3: syntax error, unexpected '*', expecting "number" or '-' or '(' or '!' -1.11: syntax error, unexpected "number" -calc: error: 2222 != 1 -_ATEOF - -# 3. If locations are not used, remove them. -sed 's/^[-0-9.]*: //' expout >at-expout -mv at-expout expout -# 4. If error-verbose is not used, strip the`, unexpected....' part. -sed 's/syntax error, .*$/syntax error/' expout >at-expout -mv at-expout expout -# 5. Check -$at_traceoff -echo "calc.at:581: cat stderr" -echo calc.at:581 >$at_check_line_file -( $at_traceon; cat stderr ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -$at_diff expout $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:581: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - - - - - - - - - - - - - - - - - - - - - $at_traceoff - $at_times_p && times >$at_times_file - ) 5>&1 2>&1 | eval $at_tee_pipe - at_status=`cat $at_status_file` - ;; - - 74 ) # 74. calc.at:582: Calculator %glr-parser %verbose - at_setup_line='calc.at:582' - at_desc='Calculator %glr-parser %verbose' - $at_quiet $ECHO_N " 74: Calculator %glr-parser %verbose $ECHO_C" - at_xfail=no - ( - echo "74. calc.at:582: testing ..." - $at_traceon - - - - - - -# Using yacc.c? - - - - - - - -# yyerror receives the location if %location & %pure & (%glr or %parse-param). - -# yyerror always sees the locations (when activated), except if -# yacc & pure & !param. - - -# The interface is pure: either because %pure-parser, or because we -# are using the C++ parsers. - - - - - - - - - - - - -cat >calc.y <<'_ATEOF' -%{ -#if HAVE_CONFIG_H -# include - /* We don't need perfect functions for these tests. */ -# undef malloc -# undef memcmp -# undef realloc -#endif -%} - -/* Infix notation calculator--calc */ -%glr-parser %verbose -%{ -#include - -#include -#include -#if HAVE_UNISTD_H -# include -#else -# undef alarm -# define alarm(seconds) /* empty */ -#endif -#include - -/* Exercise pre-prologue dependency to %union. */ -typedef int semantic_value; - -static semantic_value global_result = 0; -static int global_count = 0; -%} - -/* Exercise %union. */ -%union -{ - semantic_value ival; -}; - -%{ -static int power (int base, int exponent); -/* yyerror receives the location if: - - %location & %pure & %glr - - %location & %pure & %yacc & %parse-param. */ -static void yyerror ( - - const char *s - ); -static int yylex (void); -static int yygetc (void); -static void yyungetc ( int c); -%} - -/* Bison Declarations */ -%token CALC_EOF 0 "end of input" -%token NUM "number" -%type exp - -%nonassoc '=' /* comparison */ -%left '-' '+' -%left '*' '/' -%left NEG /* negation--unary minus */ -%right '^' /* exponentiation */ - -/* Grammar follows */ -%% -input: - line -| input line { } -; - -line: - '\n' -| exp '\n' { } -; - -exp: - NUM { $$ = $1; } -| exp '=' exp - { - if ($1 != $3) - fprintf (stderr, "calc: error: %d != %d\n", $1, $3); - $$ = $1; - } -| exp '+' exp { $$ = $1 + $3; } -| exp '-' exp { $$ = $1 - $3; } -| exp '*' exp { $$ = $1 * $3; } -| exp '/' exp { $$ = $1 / $3; } -| '-' exp %prec NEG { $$ = -$2; } -| exp '^' exp { $$ = power ($1, $3); } -| '(' exp ')' { $$ = $2; } -| '(' error ')' { $$ = 1111; } -| '!' { YYERROR; } -| '-' error { YYERROR; } -; -%% -/* The input. */ -static FILE *yyin; - -static void -yyerror ( - - const char *s) -{ - - - fprintf (stderr, "%s\n", s); -} - - - -static int -yygetc (void) -{ - int res = getc (yyin); - ; - - return res; -} - - -static void -yyungetc ( int c) -{ - ; - - ungetc (c, yyin); -} - -static int -read_signed_integer (void) -{ - int c = yygetc (); - int sign = 1; - int n = 0; - - ; - if (c == '-') - { - c = yygetc (); - sign = -1; - } - - while (isdigit (c)) - { - n = 10 * n + (c - '0'); - c = yygetc (); - } - - yyungetc ( c); - - return sign * n; -} - - - -/*---------------------------------------------------------------. -| Lexical analyzer returns an integer on the stack and the token | -| NUM, or the ASCII character read if not a number. Skips all | -| blanks and tabs, returns 0 for EOF. | -`---------------------------------------------------------------*/ - -static int -yylex (void) -{ - static int init = 1; - int c; - - if (init) - { - init = 0; - - } - - - - /* Skip white space. */ - while ((c = yygetc ()) == ' ' || c == '\t') - { - - } - - /* process numbers */ - if (c == '.' || isdigit (c)) - { - yyungetc ( c); - (yylval).ival = read_signed_integer (); - return NUM; - } - - /* Return end-of-file. */ - if (c == EOF) - return CALC_EOF; - - /* Return single chars. */ - return c; -} - -static int -power (int base, int exponent) -{ - int res = 1; - if (exponent < 0) - exit (1); - for (/* Niente */; exponent; --exponent) - res *= base; - return res; -} - - -int -main (int argc, const char **argv) -{ - semantic_value result = 0; - int count = 0; - int status; - - alarm (10); - if (argc == 2) - yyin = fopen (argv[1], "r"); - else - yyin = stdin; - - if (!yyin) - { - perror (argv[1]); - exit (1); - } - - - status = yyparse (); - if (global_result != result) - abort (); - if (global_count != count) - abort (); - return status; -} -_ATEOF - - - - - -# Specify the output files to avoid problems on different file systems. -$at_traceoff -echo "calc.at:582: bison -o calc.c calc.y" -echo calc.at:582 >$at_check_line_file -( $at_traceon; bison -o calc.c calc.y ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:582: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - -$at_traceoff -echo "calc.at:582: \$CC \$CFLAGS \$CPPFLAGS \$LDFLAGS calc.c \$LIBS -o calc" -echo calc.at:582 >$at_check_line_file -( $at_traceon; $CC $CFLAGS $CPPFLAGS $LDFLAGS calc.c $LIBS -o calc ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo stderr:; cat $at_stderr -echo stdout:; cat $at_stdout -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:582: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - -# Test the priorities. -cat >input <<'_ATEOF' -1 + 2 * 3 = 7 -1 + 2 * -3 = -5 - --1^2 = -1 -(-1)^2 = 1 - ----1 = -1 - -1 - 2 - 3 = -4 -1 - (2 - 3) = 2 - -2^2^3 = 256 -(2^2)^3 = 64 -_ATEOF - -$at_traceoff -echo "calc.at:582: \$PREPARSER ./calc input" -echo calc.at:582 >$at_check_line_file -( $at_traceon; $PREPARSER ./calc input ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo stderr:; tee stderr <$at_stderr -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:582: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - - - -# Some syntax errors. -cat >input <<'_ATEOF' -0 0 -_ATEOF - -$at_traceoff -echo "calc.at:582: \$PREPARSER ./calc input" -echo calc.at:582 >$at_check_line_file -( $at_traceon; $PREPARSER ./calc input ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo stderr:; tee stderr <$at_stderr -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 1) ;; - *) echo "calc.at:582: exit code was $at_status, expected 1" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - - -# Normalize the observed and expected error messages, depending upon the -# options. -# 1. Remove the traces from observed. -sed '/^Starting/d -/^Entering/d -/^Stack/d -/^Reading/d -/^Reducing/d -/^Shifting/d -/^state/d -/^Error:/d -/^Next/d -/^Discarding/d -/^yydestructor:/d' stderr >at-stderr -mv at-stderr stderr -# 2. Create the reference error message. -cat >expout <<'_ATEOF' -1.2: syntax error, unexpected "number" -_ATEOF - -# 3. If locations are not used, remove them. -sed 's/^[-0-9.]*: //' expout >at-expout -mv at-expout expout -# 4. If error-verbose is not used, strip the`, unexpected....' part. -sed 's/syntax error, .*$/syntax error/' expout >at-expout -mv at-expout expout -# 5. Check -$at_traceoff -echo "calc.at:582: cat stderr" -echo calc.at:582 >$at_check_line_file -( $at_traceon; cat stderr ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -$at_diff expout $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:582: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - -cat >input <<'_ATEOF' -1//2 -_ATEOF - -$at_traceoff -echo "calc.at:582: \$PREPARSER ./calc input" -echo calc.at:582 >$at_check_line_file -( $at_traceon; $PREPARSER ./calc input ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo stderr:; tee stderr <$at_stderr -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 1) ;; - *) echo "calc.at:582: exit code was $at_status, expected 1" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - - -# Normalize the observed and expected error messages, depending upon the -# options. -# 1. Remove the traces from observed. -sed '/^Starting/d -/^Entering/d -/^Stack/d -/^Reading/d -/^Reducing/d -/^Shifting/d -/^state/d -/^Error:/d -/^Next/d -/^Discarding/d -/^yydestructor:/d' stderr >at-stderr -mv at-stderr stderr -# 2. Create the reference error message. -cat >expout <<'_ATEOF' -1.2: syntax error, unexpected '/', expecting "number" or '-' or '(' or '!' -_ATEOF - -# 3. If locations are not used, remove them. -sed 's/^[-0-9.]*: //' expout >at-expout -mv at-expout expout -# 4. If error-verbose is not used, strip the`, unexpected....' part. -sed 's/syntax error, .*$/syntax error/' expout >at-expout -mv at-expout expout -# 5. Check -$at_traceoff -echo "calc.at:582: cat stderr" -echo calc.at:582 >$at_check_line_file -( $at_traceon; cat stderr ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -$at_diff expout $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:582: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - -cat >input <<'_ATEOF' -error -_ATEOF - -$at_traceoff -echo "calc.at:582: \$PREPARSER ./calc input" -echo calc.at:582 >$at_check_line_file -( $at_traceon; $PREPARSER ./calc input ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo stderr:; tee stderr <$at_stderr -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 1) ;; - *) echo "calc.at:582: exit code was $at_status, expected 1" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - - -# Normalize the observed and expected error messages, depending upon the -# options. -# 1. Remove the traces from observed. -sed '/^Starting/d -/^Entering/d -/^Stack/d -/^Reading/d -/^Reducing/d -/^Shifting/d -/^state/d -/^Error:/d -/^Next/d -/^Discarding/d -/^yydestructor:/d' stderr >at-stderr -mv at-stderr stderr -# 2. Create the reference error message. -cat >expout <<'_ATEOF' -1.0: syntax error, unexpected $undefined -_ATEOF - -# 3. If locations are not used, remove them. -sed 's/^[-0-9.]*: //' expout >at-expout -mv at-expout expout -# 4. If error-verbose is not used, strip the`, unexpected....' part. -sed 's/syntax error, .*$/syntax error/' expout >at-expout -mv at-expout expout -# 5. Check -$at_traceoff -echo "calc.at:582: cat stderr" -echo calc.at:582 >$at_check_line_file -( $at_traceon; cat stderr ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -$at_diff expout $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:582: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - -cat >input <<'_ATEOF' -1 = 2 = 3 -_ATEOF - -$at_traceoff -echo "calc.at:582: \$PREPARSER ./calc input" -echo calc.at:582 >$at_check_line_file -( $at_traceon; $PREPARSER ./calc input ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo stderr:; tee stderr <$at_stderr -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 1) ;; - *) echo "calc.at:582: exit code was $at_status, expected 1" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - - -# Normalize the observed and expected error messages, depending upon the -# options. -# 1. Remove the traces from observed. -sed '/^Starting/d -/^Entering/d -/^Stack/d -/^Reading/d -/^Reducing/d -/^Shifting/d -/^state/d -/^Error:/d -/^Next/d -/^Discarding/d -/^yydestructor:/d' stderr >at-stderr -mv at-stderr stderr -# 2. Create the reference error message. -cat >expout <<'_ATEOF' -1.6: syntax error, unexpected '=' -_ATEOF - -# 3. If locations are not used, remove them. -sed 's/^[-0-9.]*: //' expout >at-expout -mv at-expout expout -# 4. If error-verbose is not used, strip the`, unexpected....' part. -sed 's/syntax error, .*$/syntax error/' expout >at-expout -mv at-expout expout -# 5. Check -$at_traceoff -echo "calc.at:582: cat stderr" -echo calc.at:582 >$at_check_line_file -( $at_traceon; cat stderr ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -$at_diff expout $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:582: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - -cat >input <<'_ATEOF' - -+1 -_ATEOF - -$at_traceoff -echo "calc.at:582: \$PREPARSER ./calc input" -echo calc.at:582 >$at_check_line_file -( $at_traceon; $PREPARSER ./calc input ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo stderr:; tee stderr <$at_stderr -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 1) ;; - *) echo "calc.at:582: exit code was $at_status, expected 1" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - - -# Normalize the observed and expected error messages, depending upon the -# options. -# 1. Remove the traces from observed. -sed '/^Starting/d -/^Entering/d -/^Stack/d -/^Reading/d -/^Reducing/d -/^Shifting/d -/^state/d -/^Error:/d -/^Next/d -/^Discarding/d -/^yydestructor:/d' stderr >at-stderr -mv at-stderr stderr -# 2. Create the reference error message. -cat >expout <<'_ATEOF' -2.0: syntax error, unexpected '+' -_ATEOF - -# 3. If locations are not used, remove them. -sed 's/^[-0-9.]*: //' expout >at-expout -mv at-expout expout -# 4. If error-verbose is not used, strip the`, unexpected....' part. -sed 's/syntax error, .*$/syntax error/' expout >at-expout -mv at-expout expout -# 5. Check -$at_traceoff -echo "calc.at:582: cat stderr" -echo calc.at:582 >$at_check_line_file -( $at_traceon; cat stderr ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -$at_diff expout $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:582: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - -# Exercise error messages with EOF: work on an empty file. -$at_traceoff -echo "calc.at:582: \$PREPARSER ./calc /dev/null" -echo calc.at:582 >$at_check_line_file -( $at_traceon; $PREPARSER ./calc /dev/null ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo stderr:; tee stderr <$at_stderr -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 1) ;; - *) echo "calc.at:582: exit code was $at_status, expected 1" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - - -# Normalize the observed and expected error messages, depending upon the -# options. -# 1. Remove the traces from observed. -sed '/^Starting/d -/^Entering/d -/^Stack/d -/^Reading/d -/^Reducing/d -/^Shifting/d -/^state/d -/^Error:/d -/^Next/d -/^Discarding/d -/^yydestructor:/d' stderr >at-stderr -mv at-stderr stderr -# 2. Create the reference error message. -cat >expout <<'_ATEOF' -1.0: syntax error, unexpected "end of input" -_ATEOF - -# 3. If locations are not used, remove them. -sed 's/^[-0-9.]*: //' expout >at-expout -mv at-expout expout -# 4. If error-verbose is not used, strip the`, unexpected....' part. -sed 's/syntax error, .*$/syntax error/' expout >at-expout -mv at-expout expout -# 5. Check -$at_traceoff -echo "calc.at:582: cat stderr" -echo calc.at:582 >$at_check_line_file -( $at_traceon; cat stderr ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -$at_diff expout $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:582: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - - -# Exercise the error token: without it, we die at the first error, -# hence be sure to -# -# - have several errors which exercise different shift/discardings -# - (): nothing to pop, nothing to discard -# - (1 + 1 + 1 +): a lot to pop, nothing to discard -# - (* * *): nothing to pop, a lot to discard -# - (1 + 2 * *): some to pop and discard -# -# - test the action associated to `error' -# -# - check the lookahead that triggers an error is not discarded -# when we enter error recovery. Below, the lookahead causing the -# first error is ")", which is needed to recover from the error and -# produce the "0" that triggers the "0 != 1" error. -# -cat >input <<'_ATEOF' -() + (1 + 1 + 1 +) + (* * *) + (1 * 2 * *) = 1 -_ATEOF - -$at_traceoff -echo "calc.at:582: \$PREPARSER ./calc input" -echo calc.at:582 >$at_check_line_file -( $at_traceon; $PREPARSER ./calc input ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo stderr:; tee stderr <$at_stderr -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:582: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - - -# Normalize the observed and expected error messages, depending upon the -# options. -# 1. Remove the traces from observed. -sed '/^Starting/d -/^Entering/d -/^Stack/d -/^Reading/d -/^Reducing/d -/^Shifting/d -/^state/d -/^Error:/d -/^Next/d -/^Discarding/d -/^yydestructor:/d' stderr >at-stderr -mv at-stderr stderr -# 2. Create the reference error message. -cat >expout <<'_ATEOF' -1.1: syntax error, unexpected ')', expecting "number" or '-' or '(' or '!' -1.17: syntax error, unexpected ')', expecting "number" or '-' or '(' or '!' -1.22: syntax error, unexpected '*', expecting "number" or '-' or '(' or '!' -1.40: syntax error, unexpected '*', expecting "number" or '-' or '(' or '!' -calc: error: 4444 != 1 -_ATEOF - -# 3. If locations are not used, remove them. -sed 's/^[-0-9.]*: //' expout >at-expout -mv at-expout expout -# 4. If error-verbose is not used, strip the`, unexpected....' part. -sed 's/syntax error, .*$/syntax error/' expout >at-expout -mv at-expout expout -# 5. Check -$at_traceoff -echo "calc.at:582: cat stderr" -echo calc.at:582 >$at_check_line_file -( $at_traceon; cat stderr ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -$at_diff expout $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:582: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - - -# The same, but this time exercising explicitly triggered syntax errors. -# POSIX says the lookahead causing the error should not be discarded. -cat >input <<'_ATEOF' -(!) + (0 0) = 1 -_ATEOF - -$at_traceoff -echo "calc.at:582: \$PREPARSER ./calc input" -echo calc.at:582 >$at_check_line_file -( $at_traceon; $PREPARSER ./calc input ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo stderr:; tee stderr <$at_stderr -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:582: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - - -# Normalize the observed and expected error messages, depending upon the -# options. -# 1. Remove the traces from observed. -sed '/^Starting/d -/^Entering/d -/^Stack/d -/^Reading/d -/^Reducing/d -/^Shifting/d -/^state/d -/^Error:/d -/^Next/d -/^Discarding/d -/^yydestructor:/d' stderr >at-stderr -mv at-stderr stderr -# 2. Create the reference error message. -cat >expout <<'_ATEOF' -1.9: syntax error, unexpected "number" -calc: error: 2222 != 1 -_ATEOF - -# 3. If locations are not used, remove them. -sed 's/^[-0-9.]*: //' expout >at-expout -mv at-expout expout -# 4. If error-verbose is not used, strip the`, unexpected....' part. -sed 's/syntax error, .*$/syntax error/' expout >at-expout -mv at-expout expout -# 5. Check -$at_traceoff -echo "calc.at:582: cat stderr" -echo calc.at:582 >$at_check_line_file -( $at_traceon; cat stderr ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -$at_diff expout $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:582: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - -cat >input <<'_ATEOF' -(- *) + (0 0) = 1 -_ATEOF - -$at_traceoff -echo "calc.at:582: \$PREPARSER ./calc input" -echo calc.at:582 >$at_check_line_file -( $at_traceon; $PREPARSER ./calc input ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo stderr:; tee stderr <$at_stderr -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:582: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - - -# Normalize the observed and expected error messages, depending upon the -# options. -# 1. Remove the traces from observed. -sed '/^Starting/d -/^Entering/d -/^Stack/d -/^Reading/d -/^Reducing/d -/^Shifting/d -/^state/d -/^Error:/d -/^Next/d -/^Discarding/d -/^yydestructor:/d' stderr >at-stderr -mv at-stderr stderr -# 2. Create the reference error message. -cat >expout <<'_ATEOF' -1.3: syntax error, unexpected '*', expecting "number" or '-' or '(' or '!' -1.11: syntax error, unexpected "number" -calc: error: 2222 != 1 -_ATEOF - -# 3. If locations are not used, remove them. -sed 's/^[-0-9.]*: //' expout >at-expout -mv at-expout expout -# 4. If error-verbose is not used, strip the`, unexpected....' part. -sed 's/syntax error, .*$/syntax error/' expout >at-expout -mv at-expout expout -# 5. Check -$at_traceoff -echo "calc.at:582: cat stderr" -echo calc.at:582 >$at_check_line_file -( $at_traceon; cat stderr ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -$at_diff expout $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:582: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - - - - - - - - - - - - - - - - - - - - - $at_traceoff - $at_times_p && times >$at_times_file - ) 5>&1 2>&1 | eval $at_tee_pipe - at_status=`cat $at_status_file` - ;; - - 75 ) # 75. calc.at:583: Calculator %glr-parser %yacc - at_setup_line='calc.at:583' - at_desc='Calculator %glr-parser %yacc' - $at_quiet $ECHO_N " 75: Calculator %glr-parser %yacc $ECHO_C" - at_xfail=no - ( - echo "75. calc.at:583: testing ..." - $at_traceon - - - - - - -# Using yacc.c? - - - - - - - -# yyerror receives the location if %location & %pure & (%glr or %parse-param). - -# yyerror always sees the locations (when activated), except if -# yacc & pure & !param. - - -# The interface is pure: either because %pure-parser, or because we -# are using the C++ parsers. - - - - - - - - - - - - -cat >calc.y <<'_ATEOF' -%{ -#if HAVE_CONFIG_H -# include - /* We don't need perfect functions for these tests. */ -# undef malloc -# undef memcmp -# undef realloc -#endif -%} - -/* Infix notation calculator--calc */ -%glr-parser %yacc -%{ -#include - -#include -#include -#if HAVE_UNISTD_H -# include -#else -# undef alarm -# define alarm(seconds) /* empty */ -#endif -#include - -/* Exercise pre-prologue dependency to %union. */ -typedef int semantic_value; - -static semantic_value global_result = 0; -static int global_count = 0; -%} - -/* Exercise %union. */ -%union -{ - semantic_value ival; -}; - -%{ -static int power (int base, int exponent); -/* yyerror receives the location if: - - %location & %pure & %glr - - %location & %pure & %yacc & %parse-param. */ -static void yyerror ( - - const char *s - ); -static int yylex (void); -static int yygetc (void); -static void yyungetc ( int c); -%} - -/* Bison Declarations */ -%token CALC_EOF 0 "end of input" -%token NUM "number" -%type exp - -%nonassoc '=' /* comparison */ -%left '-' '+' -%left '*' '/' -%left NEG /* negation--unary minus */ -%right '^' /* exponentiation */ - -/* Grammar follows */ -%% -input: - line -| input line { } -; - -line: - '\n' -| exp '\n' { } -; - -exp: - NUM { $$ = $1; } -| exp '=' exp - { - if ($1 != $3) - fprintf (stderr, "calc: error: %d != %d\n", $1, $3); - $$ = $1; - } -| exp '+' exp { $$ = $1 + $3; } -| exp '-' exp { $$ = $1 - $3; } -| exp '*' exp { $$ = $1 * $3; } -| exp '/' exp { $$ = $1 / $3; } -| '-' exp %prec NEG { $$ = -$2; } -| exp '^' exp { $$ = power ($1, $3); } -| '(' exp ')' { $$ = $2; } -| '(' error ')' { $$ = 1111; } -| '!' { YYERROR; } -| '-' error { YYERROR; } -; -%% -/* The input. */ -static FILE *yyin; - -static void -yyerror ( - - const char *s) -{ - - - fprintf (stderr, "%s\n", s); -} - - - -static int -yygetc (void) -{ - int res = getc (yyin); - ; - - return res; -} - - -static void -yyungetc ( int c) -{ - ; - - ungetc (c, yyin); -} - -static int -read_signed_integer (void) -{ - int c = yygetc (); - int sign = 1; - int n = 0; - - ; - if (c == '-') - { - c = yygetc (); - sign = -1; - } - - while (isdigit (c)) - { - n = 10 * n + (c - '0'); - c = yygetc (); - } - - yyungetc ( c); - - return sign * n; -} - - - -/*---------------------------------------------------------------. -| Lexical analyzer returns an integer on the stack and the token | -| NUM, or the ASCII character read if not a number. Skips all | -| blanks and tabs, returns 0 for EOF. | -`---------------------------------------------------------------*/ - -static int -yylex (void) -{ - static int init = 1; - int c; - - if (init) - { - init = 0; - - } - - - - /* Skip white space. */ - while ((c = yygetc ()) == ' ' || c == '\t') - { - - } - - /* process numbers */ - if (c == '.' || isdigit (c)) - { - yyungetc ( c); - (yylval).ival = read_signed_integer (); - return NUM; - } - - /* Return end-of-file. */ - if (c == EOF) - return CALC_EOF; - - /* Return single chars. */ - return c; -} - -static int -power (int base, int exponent) -{ - int res = 1; - if (exponent < 0) - exit (1); - for (/* Niente */; exponent; --exponent) - res *= base; - return res; -} - - -int -main (int argc, const char **argv) -{ - semantic_value result = 0; - int count = 0; - int status; - - alarm (10); - if (argc == 2) - yyin = fopen (argv[1], "r"); - else - yyin = stdin; - - if (!yyin) - { - perror (argv[1]); - exit (1); - } - - - status = yyparse (); - if (global_result != result) - abort (); - if (global_count != count) - abort (); - return status; -} -_ATEOF - - - - - -# Specify the output files to avoid problems on different file systems. -$at_traceoff -echo "calc.at:583: bison -o calc.c calc.y" -echo calc.at:583 >$at_check_line_file -( $at_traceon; bison -o calc.c calc.y ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:583: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - -$at_traceoff -echo "calc.at:583: \$CC \$CFLAGS \$CPPFLAGS \$LDFLAGS calc.c \$LIBS -o calc" -echo calc.at:583 >$at_check_line_file -( $at_traceon; $CC $CFLAGS $CPPFLAGS $LDFLAGS calc.c $LIBS -o calc ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo stderr:; cat $at_stderr -echo stdout:; cat $at_stdout -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:583: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - -# Test the priorities. -cat >input <<'_ATEOF' -1 + 2 * 3 = 7 -1 + 2 * -3 = -5 - --1^2 = -1 -(-1)^2 = 1 - ----1 = -1 - -1 - 2 - 3 = -4 -1 - (2 - 3) = 2 - -2^2^3 = 256 -(2^2)^3 = 64 -_ATEOF - -$at_traceoff -echo "calc.at:583: \$PREPARSER ./calc input" -echo calc.at:583 >$at_check_line_file -( $at_traceon; $PREPARSER ./calc input ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo stderr:; tee stderr <$at_stderr -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:583: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - - - -# Some syntax errors. -cat >input <<'_ATEOF' -0 0 -_ATEOF - -$at_traceoff -echo "calc.at:583: \$PREPARSER ./calc input" -echo calc.at:583 >$at_check_line_file -( $at_traceon; $PREPARSER ./calc input ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo stderr:; tee stderr <$at_stderr -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 1) ;; - *) echo "calc.at:583: exit code was $at_status, expected 1" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - - -# Normalize the observed and expected error messages, depending upon the -# options. -# 1. Remove the traces from observed. -sed '/^Starting/d -/^Entering/d -/^Stack/d -/^Reading/d -/^Reducing/d -/^Shifting/d -/^state/d -/^Error:/d -/^Next/d -/^Discarding/d -/^yydestructor:/d' stderr >at-stderr -mv at-stderr stderr -# 2. Create the reference error message. -cat >expout <<'_ATEOF' -1.2: syntax error, unexpected "number" -_ATEOF - -# 3. If locations are not used, remove them. -sed 's/^[-0-9.]*: //' expout >at-expout -mv at-expout expout -# 4. If error-verbose is not used, strip the`, unexpected....' part. -sed 's/syntax error, .*$/syntax error/' expout >at-expout -mv at-expout expout -# 5. Check -$at_traceoff -echo "calc.at:583: cat stderr" -echo calc.at:583 >$at_check_line_file -( $at_traceon; cat stderr ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -$at_diff expout $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:583: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - -cat >input <<'_ATEOF' -1//2 -_ATEOF - -$at_traceoff -echo "calc.at:583: \$PREPARSER ./calc input" -echo calc.at:583 >$at_check_line_file -( $at_traceon; $PREPARSER ./calc input ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo stderr:; tee stderr <$at_stderr -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 1) ;; - *) echo "calc.at:583: exit code was $at_status, expected 1" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - - -# Normalize the observed and expected error messages, depending upon the -# options. -# 1. Remove the traces from observed. -sed '/^Starting/d -/^Entering/d -/^Stack/d -/^Reading/d -/^Reducing/d -/^Shifting/d -/^state/d -/^Error:/d -/^Next/d -/^Discarding/d -/^yydestructor:/d' stderr >at-stderr -mv at-stderr stderr -# 2. Create the reference error message. -cat >expout <<'_ATEOF' -1.2: syntax error, unexpected '/', expecting "number" or '-' or '(' or '!' -_ATEOF - -# 3. If locations are not used, remove them. -sed 's/^[-0-9.]*: //' expout >at-expout -mv at-expout expout -# 4. If error-verbose is not used, strip the`, unexpected....' part. -sed 's/syntax error, .*$/syntax error/' expout >at-expout -mv at-expout expout -# 5. Check -$at_traceoff -echo "calc.at:583: cat stderr" -echo calc.at:583 >$at_check_line_file -( $at_traceon; cat stderr ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -$at_diff expout $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:583: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - -cat >input <<'_ATEOF' -error -_ATEOF - -$at_traceoff -echo "calc.at:583: \$PREPARSER ./calc input" -echo calc.at:583 >$at_check_line_file -( $at_traceon; $PREPARSER ./calc input ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo stderr:; tee stderr <$at_stderr -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 1) ;; - *) echo "calc.at:583: exit code was $at_status, expected 1" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - - -# Normalize the observed and expected error messages, depending upon the -# options. -# 1. Remove the traces from observed. -sed '/^Starting/d -/^Entering/d -/^Stack/d -/^Reading/d -/^Reducing/d -/^Shifting/d -/^state/d -/^Error:/d -/^Next/d -/^Discarding/d -/^yydestructor:/d' stderr >at-stderr -mv at-stderr stderr -# 2. Create the reference error message. -cat >expout <<'_ATEOF' -1.0: syntax error, unexpected $undefined -_ATEOF - -# 3. If locations are not used, remove them. -sed 's/^[-0-9.]*: //' expout >at-expout -mv at-expout expout -# 4. If error-verbose is not used, strip the`, unexpected....' part. -sed 's/syntax error, .*$/syntax error/' expout >at-expout -mv at-expout expout -# 5. Check -$at_traceoff -echo "calc.at:583: cat stderr" -echo calc.at:583 >$at_check_line_file -( $at_traceon; cat stderr ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -$at_diff expout $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:583: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - -cat >input <<'_ATEOF' -1 = 2 = 3 -_ATEOF - -$at_traceoff -echo "calc.at:583: \$PREPARSER ./calc input" -echo calc.at:583 >$at_check_line_file -( $at_traceon; $PREPARSER ./calc input ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo stderr:; tee stderr <$at_stderr -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 1) ;; - *) echo "calc.at:583: exit code was $at_status, expected 1" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - - -# Normalize the observed and expected error messages, depending upon the -# options. -# 1. Remove the traces from observed. -sed '/^Starting/d -/^Entering/d -/^Stack/d -/^Reading/d -/^Reducing/d -/^Shifting/d -/^state/d -/^Error:/d -/^Next/d -/^Discarding/d -/^yydestructor:/d' stderr >at-stderr -mv at-stderr stderr -# 2. Create the reference error message. -cat >expout <<'_ATEOF' -1.6: syntax error, unexpected '=' -_ATEOF - -# 3. If locations are not used, remove them. -sed 's/^[-0-9.]*: //' expout >at-expout -mv at-expout expout -# 4. If error-verbose is not used, strip the`, unexpected....' part. -sed 's/syntax error, .*$/syntax error/' expout >at-expout -mv at-expout expout -# 5. Check -$at_traceoff -echo "calc.at:583: cat stderr" -echo calc.at:583 >$at_check_line_file -( $at_traceon; cat stderr ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -$at_diff expout $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:583: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - -cat >input <<'_ATEOF' - -+1 -_ATEOF - -$at_traceoff -echo "calc.at:583: \$PREPARSER ./calc input" -echo calc.at:583 >$at_check_line_file -( $at_traceon; $PREPARSER ./calc input ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo stderr:; tee stderr <$at_stderr -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 1) ;; - *) echo "calc.at:583: exit code was $at_status, expected 1" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - - -# Normalize the observed and expected error messages, depending upon the -# options. -# 1. Remove the traces from observed. -sed '/^Starting/d -/^Entering/d -/^Stack/d -/^Reading/d -/^Reducing/d -/^Shifting/d -/^state/d -/^Error:/d -/^Next/d -/^Discarding/d -/^yydestructor:/d' stderr >at-stderr -mv at-stderr stderr -# 2. Create the reference error message. -cat >expout <<'_ATEOF' -2.0: syntax error, unexpected '+' -_ATEOF - -# 3. If locations are not used, remove them. -sed 's/^[-0-9.]*: //' expout >at-expout -mv at-expout expout -# 4. If error-verbose is not used, strip the`, unexpected....' part. -sed 's/syntax error, .*$/syntax error/' expout >at-expout -mv at-expout expout -# 5. Check -$at_traceoff -echo "calc.at:583: cat stderr" -echo calc.at:583 >$at_check_line_file -( $at_traceon; cat stderr ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -$at_diff expout $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:583: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - -# Exercise error messages with EOF: work on an empty file. -$at_traceoff -echo "calc.at:583: \$PREPARSER ./calc /dev/null" -echo calc.at:583 >$at_check_line_file -( $at_traceon; $PREPARSER ./calc /dev/null ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo stderr:; tee stderr <$at_stderr -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 1) ;; - *) echo "calc.at:583: exit code was $at_status, expected 1" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - - -# Normalize the observed and expected error messages, depending upon the -# options. -# 1. Remove the traces from observed. -sed '/^Starting/d -/^Entering/d -/^Stack/d -/^Reading/d -/^Reducing/d -/^Shifting/d -/^state/d -/^Error:/d -/^Next/d -/^Discarding/d -/^yydestructor:/d' stderr >at-stderr -mv at-stderr stderr -# 2. Create the reference error message. -cat >expout <<'_ATEOF' -1.0: syntax error, unexpected "end of input" -_ATEOF - -# 3. If locations are not used, remove them. -sed 's/^[-0-9.]*: //' expout >at-expout -mv at-expout expout -# 4. If error-verbose is not used, strip the`, unexpected....' part. -sed 's/syntax error, .*$/syntax error/' expout >at-expout -mv at-expout expout -# 5. Check -$at_traceoff -echo "calc.at:583: cat stderr" -echo calc.at:583 >$at_check_line_file -( $at_traceon; cat stderr ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -$at_diff expout $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:583: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - - -# Exercise the error token: without it, we die at the first error, -# hence be sure to -# -# - have several errors which exercise different shift/discardings -# - (): nothing to pop, nothing to discard -# - (1 + 1 + 1 +): a lot to pop, nothing to discard -# - (* * *): nothing to pop, a lot to discard -# - (1 + 2 * *): some to pop and discard -# -# - test the action associated to `error' -# -# - check the lookahead that triggers an error is not discarded -# when we enter error recovery. Below, the lookahead causing the -# first error is ")", which is needed to recover from the error and -# produce the "0" that triggers the "0 != 1" error. -# -cat >input <<'_ATEOF' -() + (1 + 1 + 1 +) + (* * *) + (1 * 2 * *) = 1 -_ATEOF - -$at_traceoff -echo "calc.at:583: \$PREPARSER ./calc input" -echo calc.at:583 >$at_check_line_file -( $at_traceon; $PREPARSER ./calc input ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo stderr:; tee stderr <$at_stderr -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:583: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - - -# Normalize the observed and expected error messages, depending upon the -# options. -# 1. Remove the traces from observed. -sed '/^Starting/d -/^Entering/d -/^Stack/d -/^Reading/d -/^Reducing/d -/^Shifting/d -/^state/d -/^Error:/d -/^Next/d -/^Discarding/d -/^yydestructor:/d' stderr >at-stderr -mv at-stderr stderr -# 2. Create the reference error message. -cat >expout <<'_ATEOF' -1.1: syntax error, unexpected ')', expecting "number" or '-' or '(' or '!' -1.17: syntax error, unexpected ')', expecting "number" or '-' or '(' or '!' -1.22: syntax error, unexpected '*', expecting "number" or '-' or '(' or '!' -1.40: syntax error, unexpected '*', expecting "number" or '-' or '(' or '!' -calc: error: 4444 != 1 -_ATEOF - -# 3. If locations are not used, remove them. -sed 's/^[-0-9.]*: //' expout >at-expout -mv at-expout expout -# 4. If error-verbose is not used, strip the`, unexpected....' part. -sed 's/syntax error, .*$/syntax error/' expout >at-expout -mv at-expout expout -# 5. Check -$at_traceoff -echo "calc.at:583: cat stderr" -echo calc.at:583 >$at_check_line_file -( $at_traceon; cat stderr ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -$at_diff expout $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:583: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - - -# The same, but this time exercising explicitly triggered syntax errors. -# POSIX says the lookahead causing the error should not be discarded. -cat >input <<'_ATEOF' -(!) + (0 0) = 1 -_ATEOF - -$at_traceoff -echo "calc.at:583: \$PREPARSER ./calc input" -echo calc.at:583 >$at_check_line_file -( $at_traceon; $PREPARSER ./calc input ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo stderr:; tee stderr <$at_stderr -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:583: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - - -# Normalize the observed and expected error messages, depending upon the -# options. -# 1. Remove the traces from observed. -sed '/^Starting/d -/^Entering/d -/^Stack/d -/^Reading/d -/^Reducing/d -/^Shifting/d -/^state/d -/^Error:/d -/^Next/d -/^Discarding/d -/^yydestructor:/d' stderr >at-stderr -mv at-stderr stderr -# 2. Create the reference error message. -cat >expout <<'_ATEOF' -1.9: syntax error, unexpected "number" -calc: error: 2222 != 1 -_ATEOF - -# 3. If locations are not used, remove them. -sed 's/^[-0-9.]*: //' expout >at-expout -mv at-expout expout -# 4. If error-verbose is not used, strip the`, unexpected....' part. -sed 's/syntax error, .*$/syntax error/' expout >at-expout -mv at-expout expout -# 5. Check -$at_traceoff -echo "calc.at:583: cat stderr" -echo calc.at:583 >$at_check_line_file -( $at_traceon; cat stderr ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -$at_diff expout $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:583: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - -cat >input <<'_ATEOF' -(- *) + (0 0) = 1 -_ATEOF - -$at_traceoff -echo "calc.at:583: \$PREPARSER ./calc input" -echo calc.at:583 >$at_check_line_file -( $at_traceon; $PREPARSER ./calc input ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo stderr:; tee stderr <$at_stderr -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:583: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - - -# Normalize the observed and expected error messages, depending upon the -# options. -# 1. Remove the traces from observed. -sed '/^Starting/d -/^Entering/d -/^Stack/d -/^Reading/d -/^Reducing/d -/^Shifting/d -/^state/d -/^Error:/d -/^Next/d -/^Discarding/d -/^yydestructor:/d' stderr >at-stderr -mv at-stderr stderr -# 2. Create the reference error message. -cat >expout <<'_ATEOF' -1.3: syntax error, unexpected '*', expecting "number" or '-' or '(' or '!' -1.11: syntax error, unexpected "number" -calc: error: 2222 != 1 -_ATEOF - -# 3. If locations are not used, remove them. -sed 's/^[-0-9.]*: //' expout >at-expout -mv at-expout expout -# 4. If error-verbose is not used, strip the`, unexpected....' part. -sed 's/syntax error, .*$/syntax error/' expout >at-expout -mv at-expout expout -# 5. Check -$at_traceoff -echo "calc.at:583: cat stderr" -echo calc.at:583 >$at_check_line_file -( $at_traceon; cat stderr ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -$at_diff expout $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:583: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - - - - - - - - - - - - - - - - - - - - - $at_traceoff - $at_times_p && times >$at_times_file - ) 5>&1 2>&1 | eval $at_tee_pipe - at_status=`cat $at_status_file` - ;; - - 76 ) # 76. calc.at:584: Calculator %glr-parser %error-verbose - at_setup_line='calc.at:584' - at_desc='Calculator %glr-parser %error-verbose' - $at_quiet $ECHO_N " 76: Calculator %glr-parser %error-verbose $ECHO_C" - at_xfail=no - ( - echo "76. calc.at:584: testing ..." - $at_traceon - - - - - - -# Using yacc.c? - - - - - - - -# yyerror receives the location if %location & %pure & (%glr or %parse-param). - -# yyerror always sees the locations (when activated), except if -# yacc & pure & !param. - - -# The interface is pure: either because %pure-parser, or because we -# are using the C++ parsers. - - - - - - - - - - - - -cat >calc.y <<'_ATEOF' -%{ -#if HAVE_CONFIG_H -# include - /* We don't need perfect functions for these tests. */ -# undef malloc -# undef memcmp -# undef realloc -#endif -%} - -/* Infix notation calculator--calc */ -%glr-parser %error-verbose -%{ -#include - -#include -#include -#if HAVE_UNISTD_H -# include -#else -# undef alarm -# define alarm(seconds) /* empty */ -#endif -#include - -/* Exercise pre-prologue dependency to %union. */ -typedef int semantic_value; - -static semantic_value global_result = 0; -static int global_count = 0; -%} - -/* Exercise %union. */ -%union -{ - semantic_value ival; -}; - -%{ -static int power (int base, int exponent); -/* yyerror receives the location if: - - %location & %pure & %glr - - %location & %pure & %yacc & %parse-param. */ -static void yyerror ( - - const char *s - ); -static int yylex (void); -static int yygetc (void); -static void yyungetc ( int c); -%} - -/* Bison Declarations */ -%token CALC_EOF 0 "end of input" -%token NUM "number" -%type exp - -%nonassoc '=' /* comparison */ -%left '-' '+' -%left '*' '/' -%left NEG /* negation--unary minus */ -%right '^' /* exponentiation */ - -/* Grammar follows */ -%% -input: - line -| input line { } -; - -line: - '\n' -| exp '\n' { } -; - -exp: - NUM { $$ = $1; } -| exp '=' exp - { - if ($1 != $3) - fprintf (stderr, "calc: error: %d != %d\n", $1, $3); - $$ = $1; - } -| exp '+' exp { $$ = $1 + $3; } -| exp '-' exp { $$ = $1 - $3; } -| exp '*' exp { $$ = $1 * $3; } -| exp '/' exp { $$ = $1 / $3; } -| '-' exp %prec NEG { $$ = -$2; } -| exp '^' exp { $$ = power ($1, $3); } -| '(' exp ')' { $$ = $2; } -| '(' error ')' { $$ = 1111; } -| '!' { YYERROR; } -| '-' error { YYERROR; } -; -%% -/* The input. */ -static FILE *yyin; - -static void -yyerror ( - - const char *s) -{ - - - fprintf (stderr, "%s\n", s); -} - - - -static int -yygetc (void) -{ - int res = getc (yyin); - ; - - return res; -} - - -static void -yyungetc ( int c) -{ - ; - - ungetc (c, yyin); -} - -static int -read_signed_integer (void) -{ - int c = yygetc (); - int sign = 1; - int n = 0; - - ; - if (c == '-') - { - c = yygetc (); - sign = -1; - } - - while (isdigit (c)) - { - n = 10 * n + (c - '0'); - c = yygetc (); - } - - yyungetc ( c); - - return sign * n; -} - - - -/*---------------------------------------------------------------. -| Lexical analyzer returns an integer on the stack and the token | -| NUM, or the ASCII character read if not a number. Skips all | -| blanks and tabs, returns 0 for EOF. | -`---------------------------------------------------------------*/ - -static int -yylex (void) -{ - static int init = 1; - int c; - - if (init) - { - init = 0; - - } - - - - /* Skip white space. */ - while ((c = yygetc ()) == ' ' || c == '\t') - { - - } - - /* process numbers */ - if (c == '.' || isdigit (c)) - { - yyungetc ( c); - (yylval).ival = read_signed_integer (); - return NUM; - } - - /* Return end-of-file. */ - if (c == EOF) - return CALC_EOF; - - /* Return single chars. */ - return c; -} - -static int -power (int base, int exponent) -{ - int res = 1; - if (exponent < 0) - exit (1); - for (/* Niente */; exponent; --exponent) - res *= base; - return res; -} - - -int -main (int argc, const char **argv) -{ - semantic_value result = 0; - int count = 0; - int status; - - alarm (10); - if (argc == 2) - yyin = fopen (argv[1], "r"); - else - yyin = stdin; - - if (!yyin) - { - perror (argv[1]); - exit (1); - } - - - status = yyparse (); - if (global_result != result) - abort (); - if (global_count != count) - abort (); - return status; -} -_ATEOF - - - - - -# Specify the output files to avoid problems on different file systems. -$at_traceoff -echo "calc.at:584: bison -o calc.c calc.y" -echo calc.at:584 >$at_check_line_file -( $at_traceon; bison -o calc.c calc.y ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:584: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - -$at_traceoff -echo "calc.at:584: \$CC \$CFLAGS \$CPPFLAGS \$LDFLAGS calc.c \$LIBS -o calc" -echo calc.at:584 >$at_check_line_file -( $at_traceon; $CC $CFLAGS $CPPFLAGS $LDFLAGS calc.c $LIBS -o calc ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo stderr:; cat $at_stderr -echo stdout:; cat $at_stdout -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:584: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - -# Test the priorities. -cat >input <<'_ATEOF' -1 + 2 * 3 = 7 -1 + 2 * -3 = -5 - --1^2 = -1 -(-1)^2 = 1 - ----1 = -1 - -1 - 2 - 3 = -4 -1 - (2 - 3) = 2 - -2^2^3 = 256 -(2^2)^3 = 64 -_ATEOF - -$at_traceoff -echo "calc.at:584: \$PREPARSER ./calc input" -echo calc.at:584 >$at_check_line_file -( $at_traceon; $PREPARSER ./calc input ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo stderr:; tee stderr <$at_stderr -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:584: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - - - -# Some syntax errors. -cat >input <<'_ATEOF' -0 0 -_ATEOF - -$at_traceoff -echo "calc.at:584: \$PREPARSER ./calc input" -echo calc.at:584 >$at_check_line_file -( $at_traceon; $PREPARSER ./calc input ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo stderr:; tee stderr <$at_stderr -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 1) ;; - *) echo "calc.at:584: exit code was $at_status, expected 1" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - - -# Normalize the observed and expected error messages, depending upon the -# options. -# 1. Remove the traces from observed. -sed '/^Starting/d -/^Entering/d -/^Stack/d -/^Reading/d -/^Reducing/d -/^Shifting/d -/^state/d -/^Error:/d -/^Next/d -/^Discarding/d -/^yydestructor:/d' stderr >at-stderr -mv at-stderr stderr -# 2. Create the reference error message. -cat >expout <<'_ATEOF' -1.2: syntax error, unexpected "number" -_ATEOF - -# 3. If locations are not used, remove them. -sed 's/^[-0-9.]*: //' expout >at-expout -mv at-expout expout -# 4. If error-verbose is not used, strip the`, unexpected....' part. - -# 5. Check -$at_traceoff -echo "calc.at:584: cat stderr" -echo calc.at:584 >$at_check_line_file -( $at_traceon; cat stderr ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -$at_diff expout $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:584: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - -cat >input <<'_ATEOF' -1//2 -_ATEOF - -$at_traceoff -echo "calc.at:584: \$PREPARSER ./calc input" -echo calc.at:584 >$at_check_line_file -( $at_traceon; $PREPARSER ./calc input ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo stderr:; tee stderr <$at_stderr -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 1) ;; - *) echo "calc.at:584: exit code was $at_status, expected 1" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - - -# Normalize the observed and expected error messages, depending upon the -# options. -# 1. Remove the traces from observed. -sed '/^Starting/d -/^Entering/d -/^Stack/d -/^Reading/d -/^Reducing/d -/^Shifting/d -/^state/d -/^Error:/d -/^Next/d -/^Discarding/d -/^yydestructor:/d' stderr >at-stderr -mv at-stderr stderr -# 2. Create the reference error message. -cat >expout <<'_ATEOF' -1.2: syntax error, unexpected '/', expecting "number" or '-' or '(' or '!' -_ATEOF - -# 3. If locations are not used, remove them. -sed 's/^[-0-9.]*: //' expout >at-expout -mv at-expout expout -# 4. If error-verbose is not used, strip the`, unexpected....' part. - -# 5. Check -$at_traceoff -echo "calc.at:584: cat stderr" -echo calc.at:584 >$at_check_line_file -( $at_traceon; cat stderr ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -$at_diff expout $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:584: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - -cat >input <<'_ATEOF' -error -_ATEOF - -$at_traceoff -echo "calc.at:584: \$PREPARSER ./calc input" -echo calc.at:584 >$at_check_line_file -( $at_traceon; $PREPARSER ./calc input ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo stderr:; tee stderr <$at_stderr -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 1) ;; - *) echo "calc.at:584: exit code was $at_status, expected 1" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - - -# Normalize the observed and expected error messages, depending upon the -# options. -# 1. Remove the traces from observed. -sed '/^Starting/d -/^Entering/d -/^Stack/d -/^Reading/d -/^Reducing/d -/^Shifting/d -/^state/d -/^Error:/d -/^Next/d -/^Discarding/d -/^yydestructor:/d' stderr >at-stderr -mv at-stderr stderr -# 2. Create the reference error message. -cat >expout <<'_ATEOF' -1.0: syntax error, unexpected $undefined -_ATEOF - -# 3. If locations are not used, remove them. -sed 's/^[-0-9.]*: //' expout >at-expout -mv at-expout expout -# 4. If error-verbose is not used, strip the`, unexpected....' part. - -# 5. Check -$at_traceoff -echo "calc.at:584: cat stderr" -echo calc.at:584 >$at_check_line_file -( $at_traceon; cat stderr ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -$at_diff expout $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:584: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - -cat >input <<'_ATEOF' -1 = 2 = 3 -_ATEOF - -$at_traceoff -echo "calc.at:584: \$PREPARSER ./calc input" -echo calc.at:584 >$at_check_line_file -( $at_traceon; $PREPARSER ./calc input ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo stderr:; tee stderr <$at_stderr -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 1) ;; - *) echo "calc.at:584: exit code was $at_status, expected 1" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - - -# Normalize the observed and expected error messages, depending upon the -# options. -# 1. Remove the traces from observed. -sed '/^Starting/d -/^Entering/d -/^Stack/d -/^Reading/d -/^Reducing/d -/^Shifting/d -/^state/d -/^Error:/d -/^Next/d -/^Discarding/d -/^yydestructor:/d' stderr >at-stderr -mv at-stderr stderr -# 2. Create the reference error message. -cat >expout <<'_ATEOF' -1.6: syntax error, unexpected '=' -_ATEOF - -# 3. If locations are not used, remove them. -sed 's/^[-0-9.]*: //' expout >at-expout -mv at-expout expout -# 4. If error-verbose is not used, strip the`, unexpected....' part. - -# 5. Check -$at_traceoff -echo "calc.at:584: cat stderr" -echo calc.at:584 >$at_check_line_file -( $at_traceon; cat stderr ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -$at_diff expout $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:584: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - -cat >input <<'_ATEOF' - -+1 -_ATEOF - -$at_traceoff -echo "calc.at:584: \$PREPARSER ./calc input" -echo calc.at:584 >$at_check_line_file -( $at_traceon; $PREPARSER ./calc input ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo stderr:; tee stderr <$at_stderr -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 1) ;; - *) echo "calc.at:584: exit code was $at_status, expected 1" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - - -# Normalize the observed and expected error messages, depending upon the -# options. -# 1. Remove the traces from observed. -sed '/^Starting/d -/^Entering/d -/^Stack/d -/^Reading/d -/^Reducing/d -/^Shifting/d -/^state/d -/^Error:/d -/^Next/d -/^Discarding/d -/^yydestructor:/d' stderr >at-stderr -mv at-stderr stderr -# 2. Create the reference error message. -cat >expout <<'_ATEOF' -2.0: syntax error, unexpected '+' -_ATEOF - -# 3. If locations are not used, remove them. -sed 's/^[-0-9.]*: //' expout >at-expout -mv at-expout expout -# 4. If error-verbose is not used, strip the`, unexpected....' part. - -# 5. Check -$at_traceoff -echo "calc.at:584: cat stderr" -echo calc.at:584 >$at_check_line_file -( $at_traceon; cat stderr ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -$at_diff expout $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:584: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - -# Exercise error messages with EOF: work on an empty file. -$at_traceoff -echo "calc.at:584: \$PREPARSER ./calc /dev/null" -echo calc.at:584 >$at_check_line_file -( $at_traceon; $PREPARSER ./calc /dev/null ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo stderr:; tee stderr <$at_stderr -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 1) ;; - *) echo "calc.at:584: exit code was $at_status, expected 1" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - - -# Normalize the observed and expected error messages, depending upon the -# options. -# 1. Remove the traces from observed. -sed '/^Starting/d -/^Entering/d -/^Stack/d -/^Reading/d -/^Reducing/d -/^Shifting/d -/^state/d -/^Error:/d -/^Next/d -/^Discarding/d -/^yydestructor:/d' stderr >at-stderr -mv at-stderr stderr -# 2. Create the reference error message. -cat >expout <<'_ATEOF' -1.0: syntax error, unexpected "end of input" -_ATEOF - -# 3. If locations are not used, remove them. -sed 's/^[-0-9.]*: //' expout >at-expout -mv at-expout expout -# 4. If error-verbose is not used, strip the`, unexpected....' part. - -# 5. Check -$at_traceoff -echo "calc.at:584: cat stderr" -echo calc.at:584 >$at_check_line_file -( $at_traceon; cat stderr ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -$at_diff expout $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:584: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - - -# Exercise the error token: without it, we die at the first error, -# hence be sure to -# -# - have several errors which exercise different shift/discardings -# - (): nothing to pop, nothing to discard -# - (1 + 1 + 1 +): a lot to pop, nothing to discard -# - (* * *): nothing to pop, a lot to discard -# - (1 + 2 * *): some to pop and discard -# -# - test the action associated to `error' -# -# - check the lookahead that triggers an error is not discarded -# when we enter error recovery. Below, the lookahead causing the -# first error is ")", which is needed to recover from the error and -# produce the "0" that triggers the "0 != 1" error. -# -cat >input <<'_ATEOF' -() + (1 + 1 + 1 +) + (* * *) + (1 * 2 * *) = 1 -_ATEOF - -$at_traceoff -echo "calc.at:584: \$PREPARSER ./calc input" -echo calc.at:584 >$at_check_line_file -( $at_traceon; $PREPARSER ./calc input ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo stderr:; tee stderr <$at_stderr -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:584: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - - -# Normalize the observed and expected error messages, depending upon the -# options. -# 1. Remove the traces from observed. -sed '/^Starting/d -/^Entering/d -/^Stack/d -/^Reading/d -/^Reducing/d -/^Shifting/d -/^state/d -/^Error:/d -/^Next/d -/^Discarding/d -/^yydestructor:/d' stderr >at-stderr -mv at-stderr stderr -# 2. Create the reference error message. -cat >expout <<'_ATEOF' -1.1: syntax error, unexpected ')', expecting "number" or '-' or '(' or '!' -1.17: syntax error, unexpected ')', expecting "number" or '-' or '(' or '!' -1.22: syntax error, unexpected '*', expecting "number" or '-' or '(' or '!' -1.40: syntax error, unexpected '*', expecting "number" or '-' or '(' or '!' -calc: error: 4444 != 1 -_ATEOF - -# 3. If locations are not used, remove them. -sed 's/^[-0-9.]*: //' expout >at-expout -mv at-expout expout -# 4. If error-verbose is not used, strip the`, unexpected....' part. - -# 5. Check -$at_traceoff -echo "calc.at:584: cat stderr" -echo calc.at:584 >$at_check_line_file -( $at_traceon; cat stderr ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -$at_diff expout $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:584: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - - -# The same, but this time exercising explicitly triggered syntax errors. -# POSIX says the lookahead causing the error should not be discarded. -cat >input <<'_ATEOF' -(!) + (0 0) = 1 -_ATEOF - -$at_traceoff -echo "calc.at:584: \$PREPARSER ./calc input" -echo calc.at:584 >$at_check_line_file -( $at_traceon; $PREPARSER ./calc input ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo stderr:; tee stderr <$at_stderr -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:584: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - - -# Normalize the observed and expected error messages, depending upon the -# options. -# 1. Remove the traces from observed. -sed '/^Starting/d -/^Entering/d -/^Stack/d -/^Reading/d -/^Reducing/d -/^Shifting/d -/^state/d -/^Error:/d -/^Next/d -/^Discarding/d -/^yydestructor:/d' stderr >at-stderr -mv at-stderr stderr -# 2. Create the reference error message. -cat >expout <<'_ATEOF' -1.9: syntax error, unexpected "number" -calc: error: 2222 != 1 -_ATEOF - -# 3. If locations are not used, remove them. -sed 's/^[-0-9.]*: //' expout >at-expout -mv at-expout expout -# 4. If error-verbose is not used, strip the`, unexpected....' part. - -# 5. Check -$at_traceoff -echo "calc.at:584: cat stderr" -echo calc.at:584 >$at_check_line_file -( $at_traceon; cat stderr ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -$at_diff expout $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:584: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - -cat >input <<'_ATEOF' -(- *) + (0 0) = 1 -_ATEOF - -$at_traceoff -echo "calc.at:584: \$PREPARSER ./calc input" -echo calc.at:584 >$at_check_line_file -( $at_traceon; $PREPARSER ./calc input ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo stderr:; tee stderr <$at_stderr -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:584: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - - -# Normalize the observed and expected error messages, depending upon the -# options. -# 1. Remove the traces from observed. -sed '/^Starting/d -/^Entering/d -/^Stack/d -/^Reading/d -/^Reducing/d -/^Shifting/d -/^state/d -/^Error:/d -/^Next/d -/^Discarding/d -/^yydestructor:/d' stderr >at-stderr -mv at-stderr stderr -# 2. Create the reference error message. -cat >expout <<'_ATEOF' -1.3: syntax error, unexpected '*', expecting "number" or '-' or '(' or '!' -1.11: syntax error, unexpected "number" -calc: error: 2222 != 1 -_ATEOF - -# 3. If locations are not used, remove them. -sed 's/^[-0-9.]*: //' expout >at-expout -mv at-expout expout -# 4. If error-verbose is not used, strip the`, unexpected....' part. - -# 5. Check -$at_traceoff -echo "calc.at:584: cat stderr" -echo calc.at:584 >$at_check_line_file -( $at_traceon; cat stderr ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -$at_diff expout $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:584: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - - - - - - - - - - - - - - - - - - - - - $at_traceoff - $at_times_p && times >$at_times_file - ) 5>&1 2>&1 | eval $at_tee_pipe - at_status=`cat $at_status_file` - ;; - - 77 ) # 77. calc.at:586: Calculator %glr-parser %pure-parser %locations - at_setup_line='calc.at:586' - at_desc='Calculator %glr-parser %pure-parser %locations' - $at_quiet $ECHO_N " 77: Calculator %glr-parser %pure-parser %locations$ECHO_C" - at_xfail=no - ( - echo "77. calc.at:586: testing ..." - $at_traceon - - - - - - -# Using yacc.c? - - - - - - - -# yyerror receives the location if %location & %pure & (%glr or %parse-param). - -# yyerror always sees the locations (when activated), except if -# yacc & pure & !param. - - -# The interface is pure: either because %pure-parser, or because we -# are using the C++ parsers. - - - - - - - - - - - - -cat >calc.y <<'_ATEOF' -%{ -#if HAVE_CONFIG_H -# include - /* We don't need perfect functions for these tests. */ -# undef malloc -# undef memcmp -# undef realloc -#endif -%} - -/* Infix notation calculator--calc */ -%glr-parser %pure-parser %locations -%{ -#include - -#include -#include -#if HAVE_UNISTD_H -# include -#else -# undef alarm -# define alarm(seconds) /* empty */ -#endif -#include - -/* Exercise pre-prologue dependency to %union. */ -typedef int semantic_value; - -static semantic_value global_result = 0; -static int global_count = 0; -%} - -/* Exercise %union. */ -%union -{ - semantic_value ival; -}; - -%{ -static int power (int base, int exponent); -/* yyerror receives the location if: - - %location & %pure & %glr - - %location & %pure & %yacc & %parse-param. */ -static void yyerror (YYLTYPE *yylloc, - - const char *s - ); -static int yylex (YYSTYPE *yylval, YYLTYPE *yylloc); -static int yygetc (YYSTYPE *yylval, YYLTYPE *yylloc); -static void yyungetc (YYSTYPE *yylval, YYLTYPE *yylloc, int c); -%} - -/* Bison Declarations */ -%token CALC_EOF 0 "end of input" -%token NUM "number" -%type exp - -%nonassoc '=' /* comparison */ -%left '-' '+' -%left '*' '/' -%left NEG /* negation--unary minus */ -%right '^' /* exponentiation */ - -/* Grammar follows */ -%% -input: - line -| input line { } -; - -line: - '\n' -| exp '\n' { } -; - -exp: - NUM { $$ = $1; } -| exp '=' exp - { - if ($1 != $3) - fprintf (stderr, "calc: error: %d != %d\n", $1, $3); - $$ = $1; - } -| exp '+' exp { $$ = $1 + $3; } -| exp '-' exp { $$ = $1 - $3; } -| exp '*' exp { $$ = $1 * $3; } -| exp '/' exp { $$ = $1 / $3; } -| '-' exp %prec NEG { $$ = -$2; } -| exp '^' exp { $$ = power ($1, $3); } -| '(' exp ')' { $$ = $2; } -| '(' error ')' { $$ = 1111; } -| '!' { YYERROR; } -| '-' error { YYERROR; } -; -%% -/* The input. */ -static FILE *yyin; - -static void -yyerror (YYLTYPE *yylloc, - - const char *s) -{ - - - fprintf (stderr, "%d.%d", - (*yylloc).first_line, (*yylloc).first_column); - if ((*yylloc).first_line != (*yylloc).last_line) - fprintf (stderr, "-%d.%d", - (*yylloc).last_line, (*yylloc).last_column - 1); - else if ((*yylloc).first_column != (*yylloc).last_column - 1) - fprintf (stderr, "-%d", - (*yylloc).last_column - 1); - fprintf (stderr, ": "); - fprintf (stderr, "%s\n", s); -} - - - -static YYLTYPE last_yylloc; - -static int -yygetc (YYSTYPE *yylval, YYLTYPE *yylloc) -{ - int res = getc (yyin); - (void) yylval;(void) yylloc; - - last_yylloc = (*yylloc); - if (res == '\n') - { - (*yylloc).last_line++; - (*yylloc).last_column = 0; - } - else - (*yylloc).last_column++; - - return res; -} - - -static void -yyungetc (YYSTYPE *yylval, YYLTYPE *yylloc, int c) -{ - (void) yylval;(void) yylloc; - - /* Wrong when C == `\n'. */ - (*yylloc) = last_yylloc; - - ungetc (c, yyin); -} - -static int -read_signed_integer (YYSTYPE *yylval, YYLTYPE *yylloc) -{ - int c = yygetc (yylval, yylloc); - int sign = 1; - int n = 0; - - (void) yylval;(void) yylloc; - if (c == '-') - { - c = yygetc (yylval, yylloc); - sign = -1; - } - - while (isdigit (c)) - { - n = 10 * n + (c - '0'); - c = yygetc (yylval, yylloc); - } - - yyungetc (yylval, yylloc, c); - - return sign * n; -} - - - -/*---------------------------------------------------------------. -| Lexical analyzer returns an integer on the stack and the token | -| NUM, or the ASCII character read if not a number. Skips all | -| blanks and tabs, returns 0 for EOF. | -`---------------------------------------------------------------*/ - -static int -yylex (YYSTYPE *yylval, YYLTYPE *yylloc) -{ - static int init = 1; - int c; - - if (init) - { - init = 0; - - (*yylloc).last_column = 0; - (*yylloc).last_line = 1; - - } - - (*yylloc).first_column = (*yylloc).last_column; - (*yylloc).first_line = (*yylloc).last_line; - - - /* Skip white space. */ - while ((c = yygetc (yylval, yylloc)) == ' ' || c == '\t') - { - (*yylloc).first_column = (*yylloc).last_column; - (*yylloc).first_line = (*yylloc).last_line; - - } - - /* process numbers */ - if (c == '.' || isdigit (c)) - { - yyungetc (yylval, yylloc, c); - (*yylval).ival = read_signed_integer (yylval, yylloc); - return NUM; - } - - /* Return end-of-file. */ - if (c == EOF) - return CALC_EOF; - - /* Return single chars. */ - return c; -} - -static int -power (int base, int exponent) -{ - int res = 1; - if (exponent < 0) - exit (1); - for (/* Niente */; exponent; --exponent) - res *= base; - return res; -} - - -int -main (int argc, const char **argv) -{ - semantic_value result = 0; - int count = 0; - int status; - - alarm (10); - if (argc == 2) - yyin = fopen (argv[1], "r"); - else - yyin = stdin; - - if (!yyin) - { - perror (argv[1]); - exit (1); - } - - - status = yyparse (); - if (global_result != result) - abort (); - if (global_count != count) - abort (); - return status; -} -_ATEOF - - - - - -# Specify the output files to avoid problems on different file systems. -$at_traceoff -echo "calc.at:586: bison -o calc.c calc.y" -echo calc.at:586 >$at_check_line_file -( $at_traceon; bison -o calc.c calc.y ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:586: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - -$at_traceoff -echo "calc.at:586: \$CC \$CFLAGS \$CPPFLAGS \$LDFLAGS calc.c \$LIBS -o calc" -echo calc.at:586 >$at_check_line_file -( $at_traceon; $CC $CFLAGS $CPPFLAGS $LDFLAGS calc.c $LIBS -o calc ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo stderr:; cat $at_stderr -echo stdout:; cat $at_stdout -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:586: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - -# Test the priorities. -cat >input <<'_ATEOF' -1 + 2 * 3 = 7 -1 + 2 * -3 = -5 - --1^2 = -1 -(-1)^2 = 1 - ----1 = -1 - -1 - 2 - 3 = -4 -1 - (2 - 3) = 2 - -2^2^3 = 256 -(2^2)^3 = 64 -_ATEOF - -$at_traceoff -echo "calc.at:586: \$PREPARSER ./calc input" -echo calc.at:586 >$at_check_line_file -( $at_traceon; $PREPARSER ./calc input ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo stderr:; tee stderr <$at_stderr -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:586: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - - - -# Some syntax errors. -cat >input <<'_ATEOF' -0 0 -_ATEOF - -$at_traceoff -echo "calc.at:586: \$PREPARSER ./calc input" -echo calc.at:586 >$at_check_line_file -( $at_traceon; $PREPARSER ./calc input ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo stderr:; tee stderr <$at_stderr -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 1) ;; - *) echo "calc.at:586: exit code was $at_status, expected 1" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - - -# Normalize the observed and expected error messages, depending upon the -# options. -# 1. Remove the traces from observed. -sed '/^Starting/d -/^Entering/d -/^Stack/d -/^Reading/d -/^Reducing/d -/^Shifting/d -/^state/d -/^Error:/d -/^Next/d -/^Discarding/d -/^yydestructor:/d' stderr >at-stderr -mv at-stderr stderr -# 2. Create the reference error message. -cat >expout <<'_ATEOF' -1.2: syntax error, unexpected "number" -_ATEOF - -# 3. If locations are not used, remove them. - -# 4. If error-verbose is not used, strip the`, unexpected....' part. -sed 's/syntax error, .*$/syntax error/' expout >at-expout -mv at-expout expout -# 5. Check -$at_traceoff -echo "calc.at:586: cat stderr" -echo calc.at:586 >$at_check_line_file -( $at_traceon; cat stderr ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -$at_diff expout $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:586: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - -cat >input <<'_ATEOF' -1//2 -_ATEOF - -$at_traceoff -echo "calc.at:586: \$PREPARSER ./calc input" -echo calc.at:586 >$at_check_line_file -( $at_traceon; $PREPARSER ./calc input ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo stderr:; tee stderr <$at_stderr -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 1) ;; - *) echo "calc.at:586: exit code was $at_status, expected 1" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - - -# Normalize the observed and expected error messages, depending upon the -# options. -# 1. Remove the traces from observed. -sed '/^Starting/d -/^Entering/d -/^Stack/d -/^Reading/d -/^Reducing/d -/^Shifting/d -/^state/d -/^Error:/d -/^Next/d -/^Discarding/d -/^yydestructor:/d' stderr >at-stderr -mv at-stderr stderr -# 2. Create the reference error message. -cat >expout <<'_ATEOF' -1.2: syntax error, unexpected '/', expecting "number" or '-' or '(' or '!' -_ATEOF - -# 3. If locations are not used, remove them. - -# 4. If error-verbose is not used, strip the`, unexpected....' part. -sed 's/syntax error, .*$/syntax error/' expout >at-expout -mv at-expout expout -# 5. Check -$at_traceoff -echo "calc.at:586: cat stderr" -echo calc.at:586 >$at_check_line_file -( $at_traceon; cat stderr ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -$at_diff expout $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:586: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - -cat >input <<'_ATEOF' -error -_ATEOF - -$at_traceoff -echo "calc.at:586: \$PREPARSER ./calc input" -echo calc.at:586 >$at_check_line_file -( $at_traceon; $PREPARSER ./calc input ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo stderr:; tee stderr <$at_stderr -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 1) ;; - *) echo "calc.at:586: exit code was $at_status, expected 1" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - - -# Normalize the observed and expected error messages, depending upon the -# options. -# 1. Remove the traces from observed. -sed '/^Starting/d -/^Entering/d -/^Stack/d -/^Reading/d -/^Reducing/d -/^Shifting/d -/^state/d -/^Error:/d -/^Next/d -/^Discarding/d -/^yydestructor:/d' stderr >at-stderr -mv at-stderr stderr -# 2. Create the reference error message. -cat >expout <<'_ATEOF' -1.0: syntax error, unexpected $undefined -_ATEOF - -# 3. If locations are not used, remove them. - -# 4. If error-verbose is not used, strip the`, unexpected....' part. -sed 's/syntax error, .*$/syntax error/' expout >at-expout -mv at-expout expout -# 5. Check -$at_traceoff -echo "calc.at:586: cat stderr" -echo calc.at:586 >$at_check_line_file -( $at_traceon; cat stderr ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -$at_diff expout $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:586: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - -cat >input <<'_ATEOF' -1 = 2 = 3 -_ATEOF - -$at_traceoff -echo "calc.at:586: \$PREPARSER ./calc input" -echo calc.at:586 >$at_check_line_file -( $at_traceon; $PREPARSER ./calc input ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo stderr:; tee stderr <$at_stderr -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 1) ;; - *) echo "calc.at:586: exit code was $at_status, expected 1" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - - -# Normalize the observed and expected error messages, depending upon the -# options. -# 1. Remove the traces from observed. -sed '/^Starting/d -/^Entering/d -/^Stack/d -/^Reading/d -/^Reducing/d -/^Shifting/d -/^state/d -/^Error:/d -/^Next/d -/^Discarding/d -/^yydestructor:/d' stderr >at-stderr -mv at-stderr stderr -# 2. Create the reference error message. -cat >expout <<'_ATEOF' -1.6: syntax error, unexpected '=' -_ATEOF - -# 3. If locations are not used, remove them. - -# 4. If error-verbose is not used, strip the`, unexpected....' part. -sed 's/syntax error, .*$/syntax error/' expout >at-expout -mv at-expout expout -# 5. Check -$at_traceoff -echo "calc.at:586: cat stderr" -echo calc.at:586 >$at_check_line_file -( $at_traceon; cat stderr ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -$at_diff expout $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:586: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - -cat >input <<'_ATEOF' - -+1 -_ATEOF - -$at_traceoff -echo "calc.at:586: \$PREPARSER ./calc input" -echo calc.at:586 >$at_check_line_file -( $at_traceon; $PREPARSER ./calc input ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo stderr:; tee stderr <$at_stderr -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 1) ;; - *) echo "calc.at:586: exit code was $at_status, expected 1" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - - -# Normalize the observed and expected error messages, depending upon the -# options. -# 1. Remove the traces from observed. -sed '/^Starting/d -/^Entering/d -/^Stack/d -/^Reading/d -/^Reducing/d -/^Shifting/d -/^state/d -/^Error:/d -/^Next/d -/^Discarding/d -/^yydestructor:/d' stderr >at-stderr -mv at-stderr stderr -# 2. Create the reference error message. -cat >expout <<'_ATEOF' -2.0: syntax error, unexpected '+' -_ATEOF - -# 3. If locations are not used, remove them. - -# 4. If error-verbose is not used, strip the`, unexpected....' part. -sed 's/syntax error, .*$/syntax error/' expout >at-expout -mv at-expout expout -# 5. Check -$at_traceoff -echo "calc.at:586: cat stderr" -echo calc.at:586 >$at_check_line_file -( $at_traceon; cat stderr ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -$at_diff expout $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:586: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - -# Exercise error messages with EOF: work on an empty file. -$at_traceoff -echo "calc.at:586: \$PREPARSER ./calc /dev/null" -echo calc.at:586 >$at_check_line_file -( $at_traceon; $PREPARSER ./calc /dev/null ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo stderr:; tee stderr <$at_stderr -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 1) ;; - *) echo "calc.at:586: exit code was $at_status, expected 1" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - - -# Normalize the observed and expected error messages, depending upon the -# options. -# 1. Remove the traces from observed. -sed '/^Starting/d -/^Entering/d -/^Stack/d -/^Reading/d -/^Reducing/d -/^Shifting/d -/^state/d -/^Error:/d -/^Next/d -/^Discarding/d -/^yydestructor:/d' stderr >at-stderr -mv at-stderr stderr -# 2. Create the reference error message. -cat >expout <<'_ATEOF' -1.0: syntax error, unexpected "end of input" -_ATEOF - -# 3. If locations are not used, remove them. - -# 4. If error-verbose is not used, strip the`, unexpected....' part. -sed 's/syntax error, .*$/syntax error/' expout >at-expout -mv at-expout expout -# 5. Check -$at_traceoff -echo "calc.at:586: cat stderr" -echo calc.at:586 >$at_check_line_file -( $at_traceon; cat stderr ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -$at_diff expout $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:586: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - - -# Exercise the error token: without it, we die at the first error, -# hence be sure to -# -# - have several errors which exercise different shift/discardings -# - (): nothing to pop, nothing to discard -# - (1 + 1 + 1 +): a lot to pop, nothing to discard -# - (* * *): nothing to pop, a lot to discard -# - (1 + 2 * *): some to pop and discard -# -# - test the action associated to `error' -# -# - check the lookahead that triggers an error is not discarded -# when we enter error recovery. Below, the lookahead causing the -# first error is ")", which is needed to recover from the error and -# produce the "0" that triggers the "0 != 1" error. -# -cat >input <<'_ATEOF' -() + (1 + 1 + 1 +) + (* * *) + (1 * 2 * *) = 1 -_ATEOF - -$at_traceoff -echo "calc.at:586: \$PREPARSER ./calc input" -echo calc.at:586 >$at_check_line_file -( $at_traceon; $PREPARSER ./calc input ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo stderr:; tee stderr <$at_stderr -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:586: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - - -# Normalize the observed and expected error messages, depending upon the -# options. -# 1. Remove the traces from observed. -sed '/^Starting/d -/^Entering/d -/^Stack/d -/^Reading/d -/^Reducing/d -/^Shifting/d -/^state/d -/^Error:/d -/^Next/d -/^Discarding/d -/^yydestructor:/d' stderr >at-stderr -mv at-stderr stderr -# 2. Create the reference error message. -cat >expout <<'_ATEOF' -1.1: syntax error, unexpected ')', expecting "number" or '-' or '(' or '!' -1.17: syntax error, unexpected ')', expecting "number" or '-' or '(' or '!' -1.22: syntax error, unexpected '*', expecting "number" or '-' or '(' or '!' -1.40: syntax error, unexpected '*', expecting "number" or '-' or '(' or '!' -calc: error: 4444 != 1 -_ATEOF - -# 3. If locations are not used, remove them. - -# 4. If error-verbose is not used, strip the`, unexpected....' part. -sed 's/syntax error, .*$/syntax error/' expout >at-expout -mv at-expout expout -# 5. Check -$at_traceoff -echo "calc.at:586: cat stderr" -echo calc.at:586 >$at_check_line_file -( $at_traceon; cat stderr ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -$at_diff expout $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:586: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - - -# The same, but this time exercising explicitly triggered syntax errors. -# POSIX says the lookahead causing the error should not be discarded. -cat >input <<'_ATEOF' -(!) + (0 0) = 1 -_ATEOF - -$at_traceoff -echo "calc.at:586: \$PREPARSER ./calc input" -echo calc.at:586 >$at_check_line_file -( $at_traceon; $PREPARSER ./calc input ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo stderr:; tee stderr <$at_stderr -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:586: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - - -# Normalize the observed and expected error messages, depending upon the -# options. -# 1. Remove the traces from observed. -sed '/^Starting/d -/^Entering/d -/^Stack/d -/^Reading/d -/^Reducing/d -/^Shifting/d -/^state/d -/^Error:/d -/^Next/d -/^Discarding/d -/^yydestructor:/d' stderr >at-stderr -mv at-stderr stderr -# 2. Create the reference error message. -cat >expout <<'_ATEOF' -1.9: syntax error, unexpected "number" -calc: error: 2222 != 1 -_ATEOF - -# 3. If locations are not used, remove them. - -# 4. If error-verbose is not used, strip the`, unexpected....' part. -sed 's/syntax error, .*$/syntax error/' expout >at-expout -mv at-expout expout -# 5. Check -$at_traceoff -echo "calc.at:586: cat stderr" -echo calc.at:586 >$at_check_line_file -( $at_traceon; cat stderr ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -$at_diff expout $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:586: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - -cat >input <<'_ATEOF' -(- *) + (0 0) = 1 -_ATEOF - -$at_traceoff -echo "calc.at:586: \$PREPARSER ./calc input" -echo calc.at:586 >$at_check_line_file -( $at_traceon; $PREPARSER ./calc input ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo stderr:; tee stderr <$at_stderr -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:586: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - - -# Normalize the observed and expected error messages, depending upon the -# options. -# 1. Remove the traces from observed. -sed '/^Starting/d -/^Entering/d -/^Stack/d -/^Reading/d -/^Reducing/d -/^Shifting/d -/^state/d -/^Error:/d -/^Next/d -/^Discarding/d -/^yydestructor:/d' stderr >at-stderr -mv at-stderr stderr -# 2. Create the reference error message. -cat >expout <<'_ATEOF' -1.3: syntax error, unexpected '*', expecting "number" or '-' or '(' or '!' -1.11: syntax error, unexpected "number" -calc: error: 2222 != 1 -_ATEOF - -# 3. If locations are not used, remove them. - -# 4. If error-verbose is not used, strip the`, unexpected....' part. -sed 's/syntax error, .*$/syntax error/' expout >at-expout -mv at-expout expout -# 5. Check -$at_traceoff -echo "calc.at:586: cat stderr" -echo calc.at:586 >$at_check_line_file -( $at_traceon; cat stderr ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -$at_diff expout $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:586: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - - - - - - - - - - - - - - - - - - - - - $at_traceoff - $at_times_p && times >$at_times_file - ) 5>&1 2>&1 | eval $at_tee_pipe - at_status=`cat $at_status_file` - ;; - - 78 ) # 78. calc.at:587: Calculator %glr-parser %error-verbose %locations - at_setup_line='calc.at:587' - at_desc='Calculator %glr-parser %error-verbose %locations' - $at_quiet $ECHO_N " 78: Calculator %glr-parser %error-verbose %locations$ECHO_C" - at_xfail=no - ( - echo "78. calc.at:587: testing ..." - $at_traceon - - - - - - -# Using yacc.c? - - - - - - - -# yyerror receives the location if %location & %pure & (%glr or %parse-param). - -# yyerror always sees the locations (when activated), except if -# yacc & pure & !param. - - -# The interface is pure: either because %pure-parser, or because we -# are using the C++ parsers. - - - - - - - - - - - - -cat >calc.y <<'_ATEOF' -%{ -#if HAVE_CONFIG_H -# include - /* We don't need perfect functions for these tests. */ -# undef malloc -# undef memcmp -# undef realloc -#endif -%} - -/* Infix notation calculator--calc */ -%glr-parser %error-verbose %locations -%{ -#include - -#include -#include -#if HAVE_UNISTD_H -# include -#else -# undef alarm -# define alarm(seconds) /* empty */ -#endif -#include - -/* Exercise pre-prologue dependency to %union. */ -typedef int semantic_value; - -static semantic_value global_result = 0; -static int global_count = 0; -%} - -/* Exercise %union. */ -%union -{ - semantic_value ival; -}; - -%{ -static int power (int base, int exponent); -/* yyerror receives the location if: - - %location & %pure & %glr - - %location & %pure & %yacc & %parse-param. */ -static void yyerror ( - - const char *s - ); -static int yylex (void); -static int yygetc (void); -static void yyungetc ( int c); -%} - -/* Bison Declarations */ -%token CALC_EOF 0 "end of input" -%token NUM "number" -%type exp - -%nonassoc '=' /* comparison */ -%left '-' '+' -%left '*' '/' -%left NEG /* negation--unary minus */ -%right '^' /* exponentiation */ - -/* Grammar follows */ -%% -input: - line -| input line { } -; - -line: - '\n' -| exp '\n' { } -; - -exp: - NUM { $$ = $1; } -| exp '=' exp - { - if ($1 != $3) - fprintf (stderr, "calc: error: %d != %d\n", $1, $3); - $$ = $1; - } -| exp '+' exp { $$ = $1 + $3; } -| exp '-' exp { $$ = $1 - $3; } -| exp '*' exp { $$ = $1 * $3; } -| exp '/' exp { $$ = $1 / $3; } -| '-' exp %prec NEG { $$ = -$2; } -| exp '^' exp { $$ = power ($1, $3); } -| '(' exp ')' { $$ = $2; } -| '(' error ')' { $$ = 1111; } -| '!' { YYERROR; } -| '-' error { YYERROR; } -; -%% -/* The input. */ -static FILE *yyin; - -static void -yyerror ( - - const char *s) -{ - - - fprintf (stderr, "%d.%d", - (yylloc).first_line, (yylloc).first_column); - if ((yylloc).first_line != (yylloc).last_line) - fprintf (stderr, "-%d.%d", - (yylloc).last_line, (yylloc).last_column - 1); - else if ((yylloc).first_column != (yylloc).last_column - 1) - fprintf (stderr, "-%d", - (yylloc).last_column - 1); - fprintf (stderr, ": "); - fprintf (stderr, "%s\n", s); -} - - - -static YYLTYPE last_yylloc; - -static int -yygetc (void) -{ - int res = getc (yyin); - ; - - last_yylloc = (yylloc); - if (res == '\n') - { - (yylloc).last_line++; - (yylloc).last_column = 0; - } - else - (yylloc).last_column++; - - return res; -} - - -static void -yyungetc ( int c) -{ - ; - - /* Wrong when C == `\n'. */ - (yylloc) = last_yylloc; - - ungetc (c, yyin); -} - -static int -read_signed_integer (void) -{ - int c = yygetc (); - int sign = 1; - int n = 0; - - ; - if (c == '-') - { - c = yygetc (); - sign = -1; - } - - while (isdigit (c)) - { - n = 10 * n + (c - '0'); - c = yygetc (); - } - - yyungetc ( c); - - return sign * n; -} - - - -/*---------------------------------------------------------------. -| Lexical analyzer returns an integer on the stack and the token | -| NUM, or the ASCII character read if not a number. Skips all | -| blanks and tabs, returns 0 for EOF. | -`---------------------------------------------------------------*/ - -static int -yylex (void) -{ - static int init = 1; - int c; - - if (init) - { - init = 0; - - (yylloc).last_column = 0; - (yylloc).last_line = 1; - - } - - (yylloc).first_column = (yylloc).last_column; - (yylloc).first_line = (yylloc).last_line; - - - /* Skip white space. */ - while ((c = yygetc ()) == ' ' || c == '\t') - { - (yylloc).first_column = (yylloc).last_column; - (yylloc).first_line = (yylloc).last_line; - - } - - /* process numbers */ - if (c == '.' || isdigit (c)) - { - yyungetc ( c); - (yylval).ival = read_signed_integer (); - return NUM; - } - - /* Return end-of-file. */ - if (c == EOF) - return CALC_EOF; - - /* Return single chars. */ - return c; -} - -static int -power (int base, int exponent) -{ - int res = 1; - if (exponent < 0) - exit (1); - for (/* Niente */; exponent; --exponent) - res *= base; - return res; -} - - -int -main (int argc, const char **argv) -{ - semantic_value result = 0; - int count = 0; - int status; - - alarm (10); - if (argc == 2) - yyin = fopen (argv[1], "r"); - else - yyin = stdin; - - if (!yyin) - { - perror (argv[1]); - exit (1); - } - - - status = yyparse (); - if (global_result != result) - abort (); - if (global_count != count) - abort (); - return status; -} -_ATEOF - - - - - -# Specify the output files to avoid problems on different file systems. -$at_traceoff -echo "calc.at:587: bison -o calc.c calc.y" -echo calc.at:587 >$at_check_line_file -( $at_traceon; bison -o calc.c calc.y ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:587: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - -$at_traceoff -echo "calc.at:587: \$CC \$CFLAGS \$CPPFLAGS \$LDFLAGS calc.c \$LIBS -o calc" -echo calc.at:587 >$at_check_line_file -( $at_traceon; $CC $CFLAGS $CPPFLAGS $LDFLAGS calc.c $LIBS -o calc ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo stderr:; cat $at_stderr -echo stdout:; cat $at_stdout -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:587: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - -# Test the priorities. -cat >input <<'_ATEOF' -1 + 2 * 3 = 7 -1 + 2 * -3 = -5 - --1^2 = -1 -(-1)^2 = 1 - ----1 = -1 - -1 - 2 - 3 = -4 -1 - (2 - 3) = 2 - -2^2^3 = 256 -(2^2)^3 = 64 -_ATEOF - -$at_traceoff -echo "calc.at:587: \$PREPARSER ./calc input" -echo calc.at:587 >$at_check_line_file -( $at_traceon; $PREPARSER ./calc input ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo stderr:; tee stderr <$at_stderr -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:587: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - - - -# Some syntax errors. -cat >input <<'_ATEOF' -0 0 -_ATEOF - -$at_traceoff -echo "calc.at:587: \$PREPARSER ./calc input" -echo calc.at:587 >$at_check_line_file -( $at_traceon; $PREPARSER ./calc input ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo stderr:; tee stderr <$at_stderr -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 1) ;; - *) echo "calc.at:587: exit code was $at_status, expected 1" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - - -# Normalize the observed and expected error messages, depending upon the -# options. -# 1. Remove the traces from observed. -sed '/^Starting/d -/^Entering/d -/^Stack/d -/^Reading/d -/^Reducing/d -/^Shifting/d -/^state/d -/^Error:/d -/^Next/d -/^Discarding/d -/^yydestructor:/d' stderr >at-stderr -mv at-stderr stderr -# 2. Create the reference error message. -cat >expout <<'_ATEOF' -1.2: syntax error, unexpected "number" -_ATEOF - -# 3. If locations are not used, remove them. - -# 4. If error-verbose is not used, strip the`, unexpected....' part. - -# 5. Check -$at_traceoff -echo "calc.at:587: cat stderr" -echo calc.at:587 >$at_check_line_file -( $at_traceon; cat stderr ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -$at_diff expout $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:587: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - -cat >input <<'_ATEOF' -1//2 -_ATEOF - -$at_traceoff -echo "calc.at:587: \$PREPARSER ./calc input" -echo calc.at:587 >$at_check_line_file -( $at_traceon; $PREPARSER ./calc input ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo stderr:; tee stderr <$at_stderr -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 1) ;; - *) echo "calc.at:587: exit code was $at_status, expected 1" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - - -# Normalize the observed and expected error messages, depending upon the -# options. -# 1. Remove the traces from observed. -sed '/^Starting/d -/^Entering/d -/^Stack/d -/^Reading/d -/^Reducing/d -/^Shifting/d -/^state/d -/^Error:/d -/^Next/d -/^Discarding/d -/^yydestructor:/d' stderr >at-stderr -mv at-stderr stderr -# 2. Create the reference error message. -cat >expout <<'_ATEOF' -1.2: syntax error, unexpected '/', expecting "number" or '-' or '(' or '!' -_ATEOF - -# 3. If locations are not used, remove them. - -# 4. If error-verbose is not used, strip the`, unexpected....' part. - -# 5. Check -$at_traceoff -echo "calc.at:587: cat stderr" -echo calc.at:587 >$at_check_line_file -( $at_traceon; cat stderr ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -$at_diff expout $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:587: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - -cat >input <<'_ATEOF' -error -_ATEOF - -$at_traceoff -echo "calc.at:587: \$PREPARSER ./calc input" -echo calc.at:587 >$at_check_line_file -( $at_traceon; $PREPARSER ./calc input ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo stderr:; tee stderr <$at_stderr -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 1) ;; - *) echo "calc.at:587: exit code was $at_status, expected 1" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - - -# Normalize the observed and expected error messages, depending upon the -# options. -# 1. Remove the traces from observed. -sed '/^Starting/d -/^Entering/d -/^Stack/d -/^Reading/d -/^Reducing/d -/^Shifting/d -/^state/d -/^Error:/d -/^Next/d -/^Discarding/d -/^yydestructor:/d' stderr >at-stderr -mv at-stderr stderr -# 2. Create the reference error message. -cat >expout <<'_ATEOF' -1.0: syntax error, unexpected $undefined -_ATEOF - -# 3. If locations are not used, remove them. - -# 4. If error-verbose is not used, strip the`, unexpected....' part. - -# 5. Check -$at_traceoff -echo "calc.at:587: cat stderr" -echo calc.at:587 >$at_check_line_file -( $at_traceon; cat stderr ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -$at_diff expout $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:587: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - -cat >input <<'_ATEOF' -1 = 2 = 3 -_ATEOF - -$at_traceoff -echo "calc.at:587: \$PREPARSER ./calc input" -echo calc.at:587 >$at_check_line_file -( $at_traceon; $PREPARSER ./calc input ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo stderr:; tee stderr <$at_stderr -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 1) ;; - *) echo "calc.at:587: exit code was $at_status, expected 1" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - - -# Normalize the observed and expected error messages, depending upon the -# options. -# 1. Remove the traces from observed. -sed '/^Starting/d -/^Entering/d -/^Stack/d -/^Reading/d -/^Reducing/d -/^Shifting/d -/^state/d -/^Error:/d -/^Next/d -/^Discarding/d -/^yydestructor:/d' stderr >at-stderr -mv at-stderr stderr -# 2. Create the reference error message. -cat >expout <<'_ATEOF' -1.6: syntax error, unexpected '=' -_ATEOF - -# 3. If locations are not used, remove them. - -# 4. If error-verbose is not used, strip the`, unexpected....' part. - -# 5. Check -$at_traceoff -echo "calc.at:587: cat stderr" -echo calc.at:587 >$at_check_line_file -( $at_traceon; cat stderr ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -$at_diff expout $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:587: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - -cat >input <<'_ATEOF' - -+1 -_ATEOF - -$at_traceoff -echo "calc.at:587: \$PREPARSER ./calc input" -echo calc.at:587 >$at_check_line_file -( $at_traceon; $PREPARSER ./calc input ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo stderr:; tee stderr <$at_stderr -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 1) ;; - *) echo "calc.at:587: exit code was $at_status, expected 1" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - - -# Normalize the observed and expected error messages, depending upon the -# options. -# 1. Remove the traces from observed. -sed '/^Starting/d -/^Entering/d -/^Stack/d -/^Reading/d -/^Reducing/d -/^Shifting/d -/^state/d -/^Error:/d -/^Next/d -/^Discarding/d -/^yydestructor:/d' stderr >at-stderr -mv at-stderr stderr -# 2. Create the reference error message. -cat >expout <<'_ATEOF' -2.0: syntax error, unexpected '+' -_ATEOF - -# 3. If locations are not used, remove them. - -# 4. If error-verbose is not used, strip the`, unexpected....' part. - -# 5. Check -$at_traceoff -echo "calc.at:587: cat stderr" -echo calc.at:587 >$at_check_line_file -( $at_traceon; cat stderr ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -$at_diff expout $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:587: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - -# Exercise error messages with EOF: work on an empty file. -$at_traceoff -echo "calc.at:587: \$PREPARSER ./calc /dev/null" -echo calc.at:587 >$at_check_line_file -( $at_traceon; $PREPARSER ./calc /dev/null ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo stderr:; tee stderr <$at_stderr -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 1) ;; - *) echo "calc.at:587: exit code was $at_status, expected 1" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - - -# Normalize the observed and expected error messages, depending upon the -# options. -# 1. Remove the traces from observed. -sed '/^Starting/d -/^Entering/d -/^Stack/d -/^Reading/d -/^Reducing/d -/^Shifting/d -/^state/d -/^Error:/d -/^Next/d -/^Discarding/d -/^yydestructor:/d' stderr >at-stderr -mv at-stderr stderr -# 2. Create the reference error message. -cat >expout <<'_ATEOF' -1.0: syntax error, unexpected "end of input" -_ATEOF - -# 3. If locations are not used, remove them. - -# 4. If error-verbose is not used, strip the`, unexpected....' part. - -# 5. Check -$at_traceoff -echo "calc.at:587: cat stderr" -echo calc.at:587 >$at_check_line_file -( $at_traceon; cat stderr ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -$at_diff expout $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:587: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - - -# Exercise the error token: without it, we die at the first error, -# hence be sure to -# -# - have several errors which exercise different shift/discardings -# - (): nothing to pop, nothing to discard -# - (1 + 1 + 1 +): a lot to pop, nothing to discard -# - (* * *): nothing to pop, a lot to discard -# - (1 + 2 * *): some to pop and discard -# -# - test the action associated to `error' -# -# - check the lookahead that triggers an error is not discarded -# when we enter error recovery. Below, the lookahead causing the -# first error is ")", which is needed to recover from the error and -# produce the "0" that triggers the "0 != 1" error. -# -cat >input <<'_ATEOF' -() + (1 + 1 + 1 +) + (* * *) + (1 * 2 * *) = 1 -_ATEOF - -$at_traceoff -echo "calc.at:587: \$PREPARSER ./calc input" -echo calc.at:587 >$at_check_line_file -( $at_traceon; $PREPARSER ./calc input ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo stderr:; tee stderr <$at_stderr -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:587: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - - -# Normalize the observed and expected error messages, depending upon the -# options. -# 1. Remove the traces from observed. -sed '/^Starting/d -/^Entering/d -/^Stack/d -/^Reading/d -/^Reducing/d -/^Shifting/d -/^state/d -/^Error:/d -/^Next/d -/^Discarding/d -/^yydestructor:/d' stderr >at-stderr -mv at-stderr stderr -# 2. Create the reference error message. -cat >expout <<'_ATEOF' -1.1: syntax error, unexpected ')', expecting "number" or '-' or '(' or '!' -1.17: syntax error, unexpected ')', expecting "number" or '-' or '(' or '!' -1.22: syntax error, unexpected '*', expecting "number" or '-' or '(' or '!' -1.40: syntax error, unexpected '*', expecting "number" or '-' or '(' or '!' -calc: error: 4444 != 1 -_ATEOF - -# 3. If locations are not used, remove them. - -# 4. If error-verbose is not used, strip the`, unexpected....' part. - -# 5. Check -$at_traceoff -echo "calc.at:587: cat stderr" -echo calc.at:587 >$at_check_line_file -( $at_traceon; cat stderr ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -$at_diff expout $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:587: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - - -# The same, but this time exercising explicitly triggered syntax errors. -# POSIX says the lookahead causing the error should not be discarded. -cat >input <<'_ATEOF' -(!) + (0 0) = 1 -_ATEOF - -$at_traceoff -echo "calc.at:587: \$PREPARSER ./calc input" -echo calc.at:587 >$at_check_line_file -( $at_traceon; $PREPARSER ./calc input ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo stderr:; tee stderr <$at_stderr -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:587: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - - -# Normalize the observed and expected error messages, depending upon the -# options. -# 1. Remove the traces from observed. -sed '/^Starting/d -/^Entering/d -/^Stack/d -/^Reading/d -/^Reducing/d -/^Shifting/d -/^state/d -/^Error:/d -/^Next/d -/^Discarding/d -/^yydestructor:/d' stderr >at-stderr -mv at-stderr stderr -# 2. Create the reference error message. -cat >expout <<'_ATEOF' -1.9: syntax error, unexpected "number" -calc: error: 2222 != 1 -_ATEOF - -# 3. If locations are not used, remove them. - -# 4. If error-verbose is not used, strip the`, unexpected....' part. - -# 5. Check -$at_traceoff -echo "calc.at:587: cat stderr" -echo calc.at:587 >$at_check_line_file -( $at_traceon; cat stderr ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -$at_diff expout $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:587: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - -cat >input <<'_ATEOF' -(- *) + (0 0) = 1 -_ATEOF - -$at_traceoff -echo "calc.at:587: \$PREPARSER ./calc input" -echo calc.at:587 >$at_check_line_file -( $at_traceon; $PREPARSER ./calc input ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo stderr:; tee stderr <$at_stderr -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:587: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - - -# Normalize the observed and expected error messages, depending upon the -# options. -# 1. Remove the traces from observed. -sed '/^Starting/d -/^Entering/d -/^Stack/d -/^Reading/d -/^Reducing/d -/^Shifting/d -/^state/d -/^Error:/d -/^Next/d -/^Discarding/d -/^yydestructor:/d' stderr >at-stderr -mv at-stderr stderr -# 2. Create the reference error message. -cat >expout <<'_ATEOF' -1.3: syntax error, unexpected '*', expecting "number" or '-' or '(' or '!' -1.11: syntax error, unexpected "number" -calc: error: 2222 != 1 -_ATEOF - -# 3. If locations are not used, remove them. - -# 4. If error-verbose is not used, strip the`, unexpected....' part. - -# 5. Check -$at_traceoff -echo "calc.at:587: cat stderr" -echo calc.at:587 >$at_check_line_file -( $at_traceon; cat stderr ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -$at_diff expout $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:587: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - - - - - - - - - - - - - - - - - - - - - $at_traceoff - $at_times_p && times >$at_times_file - ) 5>&1 2>&1 | eval $at_tee_pipe - at_status=`cat $at_status_file` - ;; - - 79 ) # 79. calc.at:589: Calculator %glr-parser %error-verbose %locations %defines %name-prefix="calc" %verbose %yacc - at_setup_line='calc.at:589' - at_desc='Calculator %glr-parser %error-verbose %locations %defines %name-prefix="calc" %verbose %yacc' - $at_quiet $ECHO_N " 79: Calculator %glr-parser %error-verbose %locations %defines %name-prefix="calc" %verbose %yacc$ECHO_C" - at_xfail=no - ( - echo "79. calc.at:589: testing ..." - $at_traceon - - - - - - -# Using yacc.c? - - - - - - - -# yyerror receives the location if %location & %pure & (%glr or %parse-param). - -# yyerror always sees the locations (when activated), except if -# yacc & pure & !param. - - -# The interface is pure: either because %pure-parser, or because we -# are using the C++ parsers. - - - - - - - - - - - - -cat >calc.y <<'_ATEOF' -%{ -#if HAVE_CONFIG_H -# include - /* We don't need perfect functions for these tests. */ -# undef malloc -# undef memcmp -# undef realloc -#endif -%} - -/* Infix notation calculator--calc */ -%glr-parser %error-verbose %locations %defines %name-prefix="calc" %verbose %yacc -%{ -#include - -#include -#include -#if HAVE_UNISTD_H -# include -#else -# undef alarm -# define alarm(seconds) /* empty */ -#endif -#include - -/* Exercise pre-prologue dependency to %union. */ -typedef int semantic_value; - -static semantic_value global_result = 0; -static int global_count = 0; -%} - -/* Exercise %union. */ -%union -{ - semantic_value ival; -}; - -%{ -static int power (int base, int exponent); -/* yyerror receives the location if: - - %location & %pure & %glr - - %location & %pure & %yacc & %parse-param. */ -static void yyerror ( - - const char *s - ); -static int yylex (void); -static int yygetc (void); -static void yyungetc ( int c); -%} - -/* Bison Declarations */ -%token CALC_EOF 0 "end of input" -%token NUM "number" -%type exp - -%nonassoc '=' /* comparison */ -%left '-' '+' -%left '*' '/' -%left NEG /* negation--unary minus */ -%right '^' /* exponentiation */ - -/* Grammar follows */ -%% -input: - line -| input line { } -; - -line: - '\n' -| exp '\n' { } -; - -exp: - NUM { $$ = $1; } -| exp '=' exp - { - if ($1 != $3) - fprintf (stderr, "calc: error: %d != %d\n", $1, $3); - $$ = $1; - } -| exp '+' exp { $$ = $1 + $3; } -| exp '-' exp { $$ = $1 - $3; } -| exp '*' exp { $$ = $1 * $3; } -| exp '/' exp { $$ = $1 / $3; } -| '-' exp %prec NEG { $$ = -$2; } -| exp '^' exp { $$ = power ($1, $3); } -| '(' exp ')' { $$ = $2; } -| '(' error ')' { $$ = 1111; } -| '!' { YYERROR; } -| '-' error { YYERROR; } -; -%% -/* The input. */ -static FILE *yyin; - -static void -yyerror ( - - const char *s) -{ - - - fprintf (stderr, "%d.%d", - (yylloc).first_line, (yylloc).first_column); - if ((yylloc).first_line != (yylloc).last_line) - fprintf (stderr, "-%d.%d", - (yylloc).last_line, (yylloc).last_column - 1); - else if ((yylloc).first_column != (yylloc).last_column - 1) - fprintf (stderr, "-%d", - (yylloc).last_column - 1); - fprintf (stderr, ": "); - fprintf (stderr, "%s\n", s); -} - - - -static YYLTYPE last_yylloc; - -static int -yygetc (void) -{ - int res = getc (yyin); - ; - - last_yylloc = (yylloc); - if (res == '\n') - { - (yylloc).last_line++; - (yylloc).last_column = 0; - } - else - (yylloc).last_column++; - - return res; -} - - -static void -yyungetc ( int c) -{ - ; - - /* Wrong when C == `\n'. */ - (yylloc) = last_yylloc; - - ungetc (c, yyin); -} - -static int -read_signed_integer (void) -{ - int c = yygetc (); - int sign = 1; - int n = 0; - - ; - if (c == '-') - { - c = yygetc (); - sign = -1; - } - - while (isdigit (c)) - { - n = 10 * n + (c - '0'); - c = yygetc (); - } - - yyungetc ( c); - - return sign * n; -} - - - -/*---------------------------------------------------------------. -| Lexical analyzer returns an integer on the stack and the token | -| NUM, or the ASCII character read if not a number. Skips all | -| blanks and tabs, returns 0 for EOF. | -`---------------------------------------------------------------*/ - -static int -yylex (void) -{ - static int init = 1; - int c; - - if (init) - { - init = 0; - - (yylloc).last_column = 0; - (yylloc).last_line = 1; - - } - - (yylloc).first_column = (yylloc).last_column; - (yylloc).first_line = (yylloc).last_line; - - - /* Skip white space. */ - while ((c = yygetc ()) == ' ' || c == '\t') - { - (yylloc).first_column = (yylloc).last_column; - (yylloc).first_line = (yylloc).last_line; - - } - - /* process numbers */ - if (c == '.' || isdigit (c)) - { - yyungetc ( c); - (yylval).ival = read_signed_integer (); - return NUM; - } - - /* Return end-of-file. */ - if (c == EOF) - return CALC_EOF; - - /* Return single chars. */ - return c; -} - -static int -power (int base, int exponent) -{ - int res = 1; - if (exponent < 0) - exit (1); - for (/* Niente */; exponent; --exponent) - res *= base; - return res; -} - - -int -main (int argc, const char **argv) -{ - semantic_value result = 0; - int count = 0; - int status; - - alarm (10); - if (argc == 2) - yyin = fopen (argv[1], "r"); - else - yyin = stdin; - - if (!yyin) - { - perror (argv[1]); - exit (1); - } - - - status = yyparse (); - if (global_result != result) - abort (); - if (global_count != count) - abort (); - return status; -} -_ATEOF - - - - - -# Specify the output files to avoid problems on different file systems. -$at_traceoff -echo "calc.at:589: bison -o calc.c calc.y" -echo calc.at:589 >$at_check_line_file -( $at_traceon; bison -o calc.c calc.y ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:589: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - -$at_traceoff -echo "calc.at:589: \$CC \$CFLAGS \$CPPFLAGS \$LDFLAGS calc.c \$LIBS -o calc" -echo calc.at:589 >$at_check_line_file -( $at_traceon; $CC $CFLAGS $CPPFLAGS $LDFLAGS calc.c $LIBS -o calc ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo stderr:; cat $at_stderr -echo stdout:; cat $at_stdout -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:589: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - -# Test the priorities. -cat >input <<'_ATEOF' -1 + 2 * 3 = 7 -1 + 2 * -3 = -5 - --1^2 = -1 -(-1)^2 = 1 - ----1 = -1 - -1 - 2 - 3 = -4 -1 - (2 - 3) = 2 - -2^2^3 = 256 -(2^2)^3 = 64 -_ATEOF - -$at_traceoff -echo "calc.at:589: \$PREPARSER ./calc input" -echo calc.at:589 >$at_check_line_file -( $at_traceon; $PREPARSER ./calc input ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo stderr:; tee stderr <$at_stderr -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:589: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - - - -# Some syntax errors. -cat >input <<'_ATEOF' -0 0 -_ATEOF - -$at_traceoff -echo "calc.at:589: \$PREPARSER ./calc input" -echo calc.at:589 >$at_check_line_file -( $at_traceon; $PREPARSER ./calc input ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo stderr:; tee stderr <$at_stderr -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 1) ;; - *) echo "calc.at:589: exit code was $at_status, expected 1" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - - -# Normalize the observed and expected error messages, depending upon the -# options. -# 1. Remove the traces from observed. -sed '/^Starting/d -/^Entering/d -/^Stack/d -/^Reading/d -/^Reducing/d -/^Shifting/d -/^state/d -/^Error:/d -/^Next/d -/^Discarding/d -/^yydestructor:/d' stderr >at-stderr -mv at-stderr stderr -# 2. Create the reference error message. -cat >expout <<'_ATEOF' -1.2: syntax error, unexpected "number" -_ATEOF - -# 3. If locations are not used, remove them. - -# 4. If error-verbose is not used, strip the`, unexpected....' part. - -# 5. Check -$at_traceoff -echo "calc.at:589: cat stderr" -echo calc.at:589 >$at_check_line_file -( $at_traceon; cat stderr ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -$at_diff expout $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:589: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - -cat >input <<'_ATEOF' -1//2 -_ATEOF - -$at_traceoff -echo "calc.at:589: \$PREPARSER ./calc input" -echo calc.at:589 >$at_check_line_file -( $at_traceon; $PREPARSER ./calc input ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo stderr:; tee stderr <$at_stderr -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 1) ;; - *) echo "calc.at:589: exit code was $at_status, expected 1" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - - -# Normalize the observed and expected error messages, depending upon the -# options. -# 1. Remove the traces from observed. -sed '/^Starting/d -/^Entering/d -/^Stack/d -/^Reading/d -/^Reducing/d -/^Shifting/d -/^state/d -/^Error:/d -/^Next/d -/^Discarding/d -/^yydestructor:/d' stderr >at-stderr -mv at-stderr stderr -# 2. Create the reference error message. -cat >expout <<'_ATEOF' -1.2: syntax error, unexpected '/', expecting "number" or '-' or '(' or '!' -_ATEOF - -# 3. If locations are not used, remove them. - -# 4. If error-verbose is not used, strip the`, unexpected....' part. - -# 5. Check -$at_traceoff -echo "calc.at:589: cat stderr" -echo calc.at:589 >$at_check_line_file -( $at_traceon; cat stderr ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -$at_diff expout $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:589: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - -cat >input <<'_ATEOF' -error -_ATEOF - -$at_traceoff -echo "calc.at:589: \$PREPARSER ./calc input" -echo calc.at:589 >$at_check_line_file -( $at_traceon; $PREPARSER ./calc input ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo stderr:; tee stderr <$at_stderr -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 1) ;; - *) echo "calc.at:589: exit code was $at_status, expected 1" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - - -# Normalize the observed and expected error messages, depending upon the -# options. -# 1. Remove the traces from observed. -sed '/^Starting/d -/^Entering/d -/^Stack/d -/^Reading/d -/^Reducing/d -/^Shifting/d -/^state/d -/^Error:/d -/^Next/d -/^Discarding/d -/^yydestructor:/d' stderr >at-stderr -mv at-stderr stderr -# 2. Create the reference error message. -cat >expout <<'_ATEOF' -1.0: syntax error, unexpected $undefined -_ATEOF - -# 3. If locations are not used, remove them. - -# 4. If error-verbose is not used, strip the`, unexpected....' part. - -# 5. Check -$at_traceoff -echo "calc.at:589: cat stderr" -echo calc.at:589 >$at_check_line_file -( $at_traceon; cat stderr ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -$at_diff expout $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:589: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - -cat >input <<'_ATEOF' -1 = 2 = 3 -_ATEOF - -$at_traceoff -echo "calc.at:589: \$PREPARSER ./calc input" -echo calc.at:589 >$at_check_line_file -( $at_traceon; $PREPARSER ./calc input ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo stderr:; tee stderr <$at_stderr -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 1) ;; - *) echo "calc.at:589: exit code was $at_status, expected 1" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - - -# Normalize the observed and expected error messages, depending upon the -# options. -# 1. Remove the traces from observed. -sed '/^Starting/d -/^Entering/d -/^Stack/d -/^Reading/d -/^Reducing/d -/^Shifting/d -/^state/d -/^Error:/d -/^Next/d -/^Discarding/d -/^yydestructor:/d' stderr >at-stderr -mv at-stderr stderr -# 2. Create the reference error message. -cat >expout <<'_ATEOF' -1.6: syntax error, unexpected '=' -_ATEOF - -# 3. If locations are not used, remove them. - -# 4. If error-verbose is not used, strip the`, unexpected....' part. - -# 5. Check -$at_traceoff -echo "calc.at:589: cat stderr" -echo calc.at:589 >$at_check_line_file -( $at_traceon; cat stderr ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -$at_diff expout $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:589: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - -cat >input <<'_ATEOF' - -+1 -_ATEOF - -$at_traceoff -echo "calc.at:589: \$PREPARSER ./calc input" -echo calc.at:589 >$at_check_line_file -( $at_traceon; $PREPARSER ./calc input ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo stderr:; tee stderr <$at_stderr -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 1) ;; - *) echo "calc.at:589: exit code was $at_status, expected 1" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - - -# Normalize the observed and expected error messages, depending upon the -# options. -# 1. Remove the traces from observed. -sed '/^Starting/d -/^Entering/d -/^Stack/d -/^Reading/d -/^Reducing/d -/^Shifting/d -/^state/d -/^Error:/d -/^Next/d -/^Discarding/d -/^yydestructor:/d' stderr >at-stderr -mv at-stderr stderr -# 2. Create the reference error message. -cat >expout <<'_ATEOF' -2.0: syntax error, unexpected '+' -_ATEOF - -# 3. If locations are not used, remove them. - -# 4. If error-verbose is not used, strip the`, unexpected....' part. - -# 5. Check -$at_traceoff -echo "calc.at:589: cat stderr" -echo calc.at:589 >$at_check_line_file -( $at_traceon; cat stderr ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -$at_diff expout $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:589: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - -# Exercise error messages with EOF: work on an empty file. -$at_traceoff -echo "calc.at:589: \$PREPARSER ./calc /dev/null" -echo calc.at:589 >$at_check_line_file -( $at_traceon; $PREPARSER ./calc /dev/null ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo stderr:; tee stderr <$at_stderr -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 1) ;; - *) echo "calc.at:589: exit code was $at_status, expected 1" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - - -# Normalize the observed and expected error messages, depending upon the -# options. -# 1. Remove the traces from observed. -sed '/^Starting/d -/^Entering/d -/^Stack/d -/^Reading/d -/^Reducing/d -/^Shifting/d -/^state/d -/^Error:/d -/^Next/d -/^Discarding/d -/^yydestructor:/d' stderr >at-stderr -mv at-stderr stderr -# 2. Create the reference error message. -cat >expout <<'_ATEOF' -1.0: syntax error, unexpected "end of input" -_ATEOF - -# 3. If locations are not used, remove them. - -# 4. If error-verbose is not used, strip the`, unexpected....' part. - -# 5. Check -$at_traceoff -echo "calc.at:589: cat stderr" -echo calc.at:589 >$at_check_line_file -( $at_traceon; cat stderr ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -$at_diff expout $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:589: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - - -# Exercise the error token: without it, we die at the first error, -# hence be sure to -# -# - have several errors which exercise different shift/discardings -# - (): nothing to pop, nothing to discard -# - (1 + 1 + 1 +): a lot to pop, nothing to discard -# - (* * *): nothing to pop, a lot to discard -# - (1 + 2 * *): some to pop and discard -# -# - test the action associated to `error' -# -# - check the lookahead that triggers an error is not discarded -# when we enter error recovery. Below, the lookahead causing the -# first error is ")", which is needed to recover from the error and -# produce the "0" that triggers the "0 != 1" error. -# -cat >input <<'_ATEOF' -() + (1 + 1 + 1 +) + (* * *) + (1 * 2 * *) = 1 -_ATEOF - -$at_traceoff -echo "calc.at:589: \$PREPARSER ./calc input" -echo calc.at:589 >$at_check_line_file -( $at_traceon; $PREPARSER ./calc input ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo stderr:; tee stderr <$at_stderr -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:589: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - - -# Normalize the observed and expected error messages, depending upon the -# options. -# 1. Remove the traces from observed. -sed '/^Starting/d -/^Entering/d -/^Stack/d -/^Reading/d -/^Reducing/d -/^Shifting/d -/^state/d -/^Error:/d -/^Next/d -/^Discarding/d -/^yydestructor:/d' stderr >at-stderr -mv at-stderr stderr -# 2. Create the reference error message. -cat >expout <<'_ATEOF' -1.1: syntax error, unexpected ')', expecting "number" or '-' or '(' or '!' -1.17: syntax error, unexpected ')', expecting "number" or '-' or '(' or '!' -1.22: syntax error, unexpected '*', expecting "number" or '-' or '(' or '!' -1.40: syntax error, unexpected '*', expecting "number" or '-' or '(' or '!' -calc: error: 4444 != 1 -_ATEOF - -# 3. If locations are not used, remove them. - -# 4. If error-verbose is not used, strip the`, unexpected....' part. - -# 5. Check -$at_traceoff -echo "calc.at:589: cat stderr" -echo calc.at:589 >$at_check_line_file -( $at_traceon; cat stderr ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -$at_diff expout $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:589: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - - -# The same, but this time exercising explicitly triggered syntax errors. -# POSIX says the lookahead causing the error should not be discarded. -cat >input <<'_ATEOF' -(!) + (0 0) = 1 -_ATEOF - -$at_traceoff -echo "calc.at:589: \$PREPARSER ./calc input" -echo calc.at:589 >$at_check_line_file -( $at_traceon; $PREPARSER ./calc input ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo stderr:; tee stderr <$at_stderr -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:589: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - - -# Normalize the observed and expected error messages, depending upon the -# options. -# 1. Remove the traces from observed. -sed '/^Starting/d -/^Entering/d -/^Stack/d -/^Reading/d -/^Reducing/d -/^Shifting/d -/^state/d -/^Error:/d -/^Next/d -/^Discarding/d -/^yydestructor:/d' stderr >at-stderr -mv at-stderr stderr -# 2. Create the reference error message. -cat >expout <<'_ATEOF' -1.9: syntax error, unexpected "number" -calc: error: 2222 != 1 -_ATEOF - -# 3. If locations are not used, remove them. - -# 4. If error-verbose is not used, strip the`, unexpected....' part. - -# 5. Check -$at_traceoff -echo "calc.at:589: cat stderr" -echo calc.at:589 >$at_check_line_file -( $at_traceon; cat stderr ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -$at_diff expout $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:589: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - -cat >input <<'_ATEOF' -(- *) + (0 0) = 1 -_ATEOF - -$at_traceoff -echo "calc.at:589: \$PREPARSER ./calc input" -echo calc.at:589 >$at_check_line_file -( $at_traceon; $PREPARSER ./calc input ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo stderr:; tee stderr <$at_stderr -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:589: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - - -# Normalize the observed and expected error messages, depending upon the -# options. -# 1. Remove the traces from observed. -sed '/^Starting/d -/^Entering/d -/^Stack/d -/^Reading/d -/^Reducing/d -/^Shifting/d -/^state/d -/^Error:/d -/^Next/d -/^Discarding/d -/^yydestructor:/d' stderr >at-stderr -mv at-stderr stderr -# 2. Create the reference error message. -cat >expout <<'_ATEOF' -1.3: syntax error, unexpected '*', expecting "number" or '-' or '(' or '!' -1.11: syntax error, unexpected "number" -calc: error: 2222 != 1 -_ATEOF - -# 3. If locations are not used, remove them. - -# 4. If error-verbose is not used, strip the`, unexpected....' part. - -# 5. Check -$at_traceoff -echo "calc.at:589: cat stderr" -echo calc.at:589 >$at_check_line_file -( $at_traceon; cat stderr ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -$at_diff expout $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:589: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - - - - - - - - - - - - - - - - - - - - - $at_traceoff - $at_times_p && times >$at_times_file - ) 5>&1 2>&1 | eval $at_tee_pipe - at_status=`cat $at_status_file` - ;; - - 80 ) # 80. calc.at:591: Calculator %glr-parser %debug - at_setup_line='calc.at:591' - at_desc='Calculator %glr-parser %debug' - $at_quiet $ECHO_N " 80: Calculator %glr-parser %debug $ECHO_C" - at_xfail=no - ( - echo "80. calc.at:591: testing ..." - $at_traceon - - - - - - -# Using yacc.c? - - - - - - - -# yyerror receives the location if %location & %pure & (%glr or %parse-param). - -# yyerror always sees the locations (when activated), except if -# yacc & pure & !param. - - -# The interface is pure: either because %pure-parser, or because we -# are using the C++ parsers. - - - - - - - - - - - - -cat >calc.y <<'_ATEOF' -%{ -#if HAVE_CONFIG_H -# include - /* We don't need perfect functions for these tests. */ -# undef malloc -# undef memcmp -# undef realloc -#endif -%} - -/* Infix notation calculator--calc */ -%glr-parser %debug -%{ -#include - -#include -#include -#if HAVE_UNISTD_H -# include -#else -# undef alarm -# define alarm(seconds) /* empty */ -#endif -#include - -/* Exercise pre-prologue dependency to %union. */ -typedef int semantic_value; - -static semantic_value global_result = 0; -static int global_count = 0; -%} - -/* Exercise %union. */ -%union -{ - semantic_value ival; -}; - -%{ -static int power (int base, int exponent); -/* yyerror receives the location if: - - %location & %pure & %glr - - %location & %pure & %yacc & %parse-param. */ -static void yyerror ( - - const char *s - ); -static int yylex (void); -static int yygetc (void); -static void yyungetc ( int c); -%} - -/* Bison Declarations */ -%token CALC_EOF 0 "end of input" -%token NUM "number" -%type exp - -%nonassoc '=' /* comparison */ -%left '-' '+' -%left '*' '/' -%left NEG /* negation--unary minus */ -%right '^' /* exponentiation */ - -/* Grammar follows */ -%% -input: - line -| input line { } -; - -line: - '\n' -| exp '\n' { } -; - -exp: - NUM { $$ = $1; } -| exp '=' exp - { - if ($1 != $3) - fprintf (stderr, "calc: error: %d != %d\n", $1, $3); - $$ = $1; - } -| exp '+' exp { $$ = $1 + $3; } -| exp '-' exp { $$ = $1 - $3; } -| exp '*' exp { $$ = $1 * $3; } -| exp '/' exp { $$ = $1 / $3; } -| '-' exp %prec NEG { $$ = -$2; } -| exp '^' exp { $$ = power ($1, $3); } -| '(' exp ')' { $$ = $2; } -| '(' error ')' { $$ = 1111; } -| '!' { YYERROR; } -| '-' error { YYERROR; } -; -%% -/* The input. */ -static FILE *yyin; - -static void -yyerror ( - - const char *s) -{ - - - fprintf (stderr, "%s\n", s); -} - - - -static int -yygetc (void) -{ - int res = getc (yyin); - ; - - return res; -} - - -static void -yyungetc ( int c) -{ - ; - - ungetc (c, yyin); -} - -static int -read_signed_integer (void) -{ - int c = yygetc (); - int sign = 1; - int n = 0; - - ; - if (c == '-') - { - c = yygetc (); - sign = -1; - } - - while (isdigit (c)) - { - n = 10 * n + (c - '0'); - c = yygetc (); - } - - yyungetc ( c); - - return sign * n; -} - - - -/*---------------------------------------------------------------. -| Lexical analyzer returns an integer on the stack and the token | -| NUM, or the ASCII character read if not a number. Skips all | -| blanks and tabs, returns 0 for EOF. | -`---------------------------------------------------------------*/ - -static int -yylex (void) -{ - static int init = 1; - int c; - - if (init) - { - init = 0; - - } - - - - /* Skip white space. */ - while ((c = yygetc ()) == ' ' || c == '\t') - { - - } - - /* process numbers */ - if (c == '.' || isdigit (c)) - { - yyungetc ( c); - (yylval).ival = read_signed_integer (); - return NUM; - } - - /* Return end-of-file. */ - if (c == EOF) - return CALC_EOF; - - /* Return single chars. */ - return c; -} - -static int -power (int base, int exponent) -{ - int res = 1; - if (exponent < 0) - exit (1); - for (/* Niente */; exponent; --exponent) - res *= base; - return res; -} - - -int -main (int argc, const char **argv) -{ - semantic_value result = 0; - int count = 0; - int status; - - alarm (10); - if (argc == 2) - yyin = fopen (argv[1], "r"); - else - yyin = stdin; - - if (!yyin) - { - perror (argv[1]); - exit (1); - } - - yydebug = 1; - status = yyparse (); - if (global_result != result) - abort (); - if (global_count != count) - abort (); - return status; -} -_ATEOF - - - - - -# Specify the output files to avoid problems on different file systems. -$at_traceoff -echo "calc.at:591: bison -o calc.c calc.y" -echo calc.at:591 >$at_check_line_file -( $at_traceon; bison -o calc.c calc.y ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:591: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - -$at_traceoff -echo "calc.at:591: \$CC \$CFLAGS \$CPPFLAGS \$LDFLAGS calc.c \$LIBS -o calc" -echo calc.at:591 >$at_check_line_file -( $at_traceon; $CC $CFLAGS $CPPFLAGS $LDFLAGS calc.c $LIBS -o calc ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo stderr:; cat $at_stderr -echo stdout:; cat $at_stdout -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:591: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - -# Test the priorities. -cat >input <<'_ATEOF' -1 + 2 * 3 = 7 -1 + 2 * -3 = -5 - --1^2 = -1 -(-1)^2 = 1 - ----1 = -1 - -1 - 2 - 3 = -4 -1 - (2 - 3) = 2 - -2^2^3 = 256 -(2^2)^3 = 64 -_ATEOF - -$at_traceoff -echo "calc.at:591: \$PREPARSER ./calc input" -echo calc.at:591 >$at_check_line_file -( $at_traceon; $PREPARSER ./calc input ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo stderr:; tee stderr <$at_stderr -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:591: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - - - -# Some syntax errors. -cat >input <<'_ATEOF' -0 0 -_ATEOF - -$at_traceoff -echo "calc.at:591: \$PREPARSER ./calc input" -echo calc.at:591 >$at_check_line_file -( $at_traceon; $PREPARSER ./calc input ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo stderr:; tee stderr <$at_stderr -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 1) ;; - *) echo "calc.at:591: exit code was $at_status, expected 1" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - - -# Normalize the observed and expected error messages, depending upon the -# options. -# 1. Remove the traces from observed. -sed '/^Starting/d -/^Entering/d -/^Stack/d -/^Reading/d -/^Reducing/d -/^Shifting/d -/^state/d -/^Error:/d -/^Next/d -/^Discarding/d -/^yydestructor:/d' stderr >at-stderr -mv at-stderr stderr -# 2. Create the reference error message. -cat >expout <<'_ATEOF' -1.2: syntax error, unexpected "number" -_ATEOF - -# 3. If locations are not used, remove them. -sed 's/^[-0-9.]*: //' expout >at-expout -mv at-expout expout -# 4. If error-verbose is not used, strip the`, unexpected....' part. -sed 's/syntax error, .*$/syntax error/' expout >at-expout -mv at-expout expout -# 5. Check -$at_traceoff -echo "calc.at:591: cat stderr" -echo calc.at:591 >$at_check_line_file -( $at_traceon; cat stderr ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -$at_diff expout $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:591: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - -cat >input <<'_ATEOF' -1//2 -_ATEOF - -$at_traceoff -echo "calc.at:591: \$PREPARSER ./calc input" -echo calc.at:591 >$at_check_line_file -( $at_traceon; $PREPARSER ./calc input ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo stderr:; tee stderr <$at_stderr -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 1) ;; - *) echo "calc.at:591: exit code was $at_status, expected 1" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - - -# Normalize the observed and expected error messages, depending upon the -# options. -# 1. Remove the traces from observed. -sed '/^Starting/d -/^Entering/d -/^Stack/d -/^Reading/d -/^Reducing/d -/^Shifting/d -/^state/d -/^Error:/d -/^Next/d -/^Discarding/d -/^yydestructor:/d' stderr >at-stderr -mv at-stderr stderr -# 2. Create the reference error message. -cat >expout <<'_ATEOF' -1.2: syntax error, unexpected '/', expecting "number" or '-' or '(' or '!' -_ATEOF - -# 3. If locations are not used, remove them. -sed 's/^[-0-9.]*: //' expout >at-expout -mv at-expout expout -# 4. If error-verbose is not used, strip the`, unexpected....' part. -sed 's/syntax error, .*$/syntax error/' expout >at-expout -mv at-expout expout -# 5. Check -$at_traceoff -echo "calc.at:591: cat stderr" -echo calc.at:591 >$at_check_line_file -( $at_traceon; cat stderr ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -$at_diff expout $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:591: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - -cat >input <<'_ATEOF' -error -_ATEOF - -$at_traceoff -echo "calc.at:591: \$PREPARSER ./calc input" -echo calc.at:591 >$at_check_line_file -( $at_traceon; $PREPARSER ./calc input ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo stderr:; tee stderr <$at_stderr -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 1) ;; - *) echo "calc.at:591: exit code was $at_status, expected 1" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - - -# Normalize the observed and expected error messages, depending upon the -# options. -# 1. Remove the traces from observed. -sed '/^Starting/d -/^Entering/d -/^Stack/d -/^Reading/d -/^Reducing/d -/^Shifting/d -/^state/d -/^Error:/d -/^Next/d -/^Discarding/d -/^yydestructor:/d' stderr >at-stderr -mv at-stderr stderr -# 2. Create the reference error message. -cat >expout <<'_ATEOF' -1.0: syntax error, unexpected $undefined -_ATEOF - -# 3. If locations are not used, remove them. -sed 's/^[-0-9.]*: //' expout >at-expout -mv at-expout expout -# 4. If error-verbose is not used, strip the`, unexpected....' part. -sed 's/syntax error, .*$/syntax error/' expout >at-expout -mv at-expout expout -# 5. Check -$at_traceoff -echo "calc.at:591: cat stderr" -echo calc.at:591 >$at_check_line_file -( $at_traceon; cat stderr ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -$at_diff expout $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:591: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - -cat >input <<'_ATEOF' -1 = 2 = 3 -_ATEOF - -$at_traceoff -echo "calc.at:591: \$PREPARSER ./calc input" -echo calc.at:591 >$at_check_line_file -( $at_traceon; $PREPARSER ./calc input ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo stderr:; tee stderr <$at_stderr -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 1) ;; - *) echo "calc.at:591: exit code was $at_status, expected 1" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - - -# Normalize the observed and expected error messages, depending upon the -# options. -# 1. Remove the traces from observed. -sed '/^Starting/d -/^Entering/d -/^Stack/d -/^Reading/d -/^Reducing/d -/^Shifting/d -/^state/d -/^Error:/d -/^Next/d -/^Discarding/d -/^yydestructor:/d' stderr >at-stderr -mv at-stderr stderr -# 2. Create the reference error message. -cat >expout <<'_ATEOF' -1.6: syntax error, unexpected '=' -_ATEOF - -# 3. If locations are not used, remove them. -sed 's/^[-0-9.]*: //' expout >at-expout -mv at-expout expout -# 4. If error-verbose is not used, strip the`, unexpected....' part. -sed 's/syntax error, .*$/syntax error/' expout >at-expout -mv at-expout expout -# 5. Check -$at_traceoff -echo "calc.at:591: cat stderr" -echo calc.at:591 >$at_check_line_file -( $at_traceon; cat stderr ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -$at_diff expout $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:591: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - -cat >input <<'_ATEOF' - -+1 -_ATEOF - -$at_traceoff -echo "calc.at:591: \$PREPARSER ./calc input" -echo calc.at:591 >$at_check_line_file -( $at_traceon; $PREPARSER ./calc input ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo stderr:; tee stderr <$at_stderr -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 1) ;; - *) echo "calc.at:591: exit code was $at_status, expected 1" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - - -# Normalize the observed and expected error messages, depending upon the -# options. -# 1. Remove the traces from observed. -sed '/^Starting/d -/^Entering/d -/^Stack/d -/^Reading/d -/^Reducing/d -/^Shifting/d -/^state/d -/^Error:/d -/^Next/d -/^Discarding/d -/^yydestructor:/d' stderr >at-stderr -mv at-stderr stderr -# 2. Create the reference error message. -cat >expout <<'_ATEOF' -2.0: syntax error, unexpected '+' -_ATEOF - -# 3. If locations are not used, remove them. -sed 's/^[-0-9.]*: //' expout >at-expout -mv at-expout expout -# 4. If error-verbose is not used, strip the`, unexpected....' part. -sed 's/syntax error, .*$/syntax error/' expout >at-expout -mv at-expout expout -# 5. Check -$at_traceoff -echo "calc.at:591: cat stderr" -echo calc.at:591 >$at_check_line_file -( $at_traceon; cat stderr ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -$at_diff expout $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:591: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - -# Exercise error messages with EOF: work on an empty file. -$at_traceoff -echo "calc.at:591: \$PREPARSER ./calc /dev/null" -echo calc.at:591 >$at_check_line_file -( $at_traceon; $PREPARSER ./calc /dev/null ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo stderr:; tee stderr <$at_stderr -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 1) ;; - *) echo "calc.at:591: exit code was $at_status, expected 1" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - - -# Normalize the observed and expected error messages, depending upon the -# options. -# 1. Remove the traces from observed. -sed '/^Starting/d -/^Entering/d -/^Stack/d -/^Reading/d -/^Reducing/d -/^Shifting/d -/^state/d -/^Error:/d -/^Next/d -/^Discarding/d -/^yydestructor:/d' stderr >at-stderr -mv at-stderr stderr -# 2. Create the reference error message. -cat >expout <<'_ATEOF' -1.0: syntax error, unexpected "end of input" -_ATEOF - -# 3. If locations are not used, remove them. -sed 's/^[-0-9.]*: //' expout >at-expout -mv at-expout expout -# 4. If error-verbose is not used, strip the`, unexpected....' part. -sed 's/syntax error, .*$/syntax error/' expout >at-expout -mv at-expout expout -# 5. Check -$at_traceoff -echo "calc.at:591: cat stderr" -echo calc.at:591 >$at_check_line_file -( $at_traceon; cat stderr ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -$at_diff expout $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:591: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - - -# Exercise the error token: without it, we die at the first error, -# hence be sure to -# -# - have several errors which exercise different shift/discardings -# - (): nothing to pop, nothing to discard -# - (1 + 1 + 1 +): a lot to pop, nothing to discard -# - (* * *): nothing to pop, a lot to discard -# - (1 + 2 * *): some to pop and discard -# -# - test the action associated to `error' -# -# - check the lookahead that triggers an error is not discarded -# when we enter error recovery. Below, the lookahead causing the -# first error is ")", which is needed to recover from the error and -# produce the "0" that triggers the "0 != 1" error. -# -cat >input <<'_ATEOF' -() + (1 + 1 + 1 +) + (* * *) + (1 * 2 * *) = 1 -_ATEOF - -$at_traceoff -echo "calc.at:591: \$PREPARSER ./calc input" -echo calc.at:591 >$at_check_line_file -( $at_traceon; $PREPARSER ./calc input ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo stderr:; tee stderr <$at_stderr -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:591: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - - -# Normalize the observed and expected error messages, depending upon the -# options. -# 1. Remove the traces from observed. -sed '/^Starting/d -/^Entering/d -/^Stack/d -/^Reading/d -/^Reducing/d -/^Shifting/d -/^state/d -/^Error:/d -/^Next/d -/^Discarding/d -/^yydestructor:/d' stderr >at-stderr -mv at-stderr stderr -# 2. Create the reference error message. -cat >expout <<'_ATEOF' -1.1: syntax error, unexpected ')', expecting "number" or '-' or '(' or '!' -1.17: syntax error, unexpected ')', expecting "number" or '-' or '(' or '!' -1.22: syntax error, unexpected '*', expecting "number" or '-' or '(' or '!' -1.40: syntax error, unexpected '*', expecting "number" or '-' or '(' or '!' -calc: error: 4444 != 1 -_ATEOF - -# 3. If locations are not used, remove them. -sed 's/^[-0-9.]*: //' expout >at-expout -mv at-expout expout -# 4. If error-verbose is not used, strip the`, unexpected....' part. -sed 's/syntax error, .*$/syntax error/' expout >at-expout -mv at-expout expout -# 5. Check -$at_traceoff -echo "calc.at:591: cat stderr" -echo calc.at:591 >$at_check_line_file -( $at_traceon; cat stderr ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -$at_diff expout $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:591: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - - -# The same, but this time exercising explicitly triggered syntax errors. -# POSIX says the lookahead causing the error should not be discarded. -cat >input <<'_ATEOF' -(!) + (0 0) = 1 -_ATEOF - -$at_traceoff -echo "calc.at:591: \$PREPARSER ./calc input" -echo calc.at:591 >$at_check_line_file -( $at_traceon; $PREPARSER ./calc input ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo stderr:; tee stderr <$at_stderr -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:591: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - - -# Normalize the observed and expected error messages, depending upon the -# options. -# 1. Remove the traces from observed. -sed '/^Starting/d -/^Entering/d -/^Stack/d -/^Reading/d -/^Reducing/d -/^Shifting/d -/^state/d -/^Error:/d -/^Next/d -/^Discarding/d -/^yydestructor:/d' stderr >at-stderr -mv at-stderr stderr -# 2. Create the reference error message. -cat >expout <<'_ATEOF' -1.9: syntax error, unexpected "number" -calc: error: 2222 != 1 -_ATEOF - -# 3. If locations are not used, remove them. -sed 's/^[-0-9.]*: //' expout >at-expout -mv at-expout expout -# 4. If error-verbose is not used, strip the`, unexpected....' part. -sed 's/syntax error, .*$/syntax error/' expout >at-expout -mv at-expout expout -# 5. Check -$at_traceoff -echo "calc.at:591: cat stderr" -echo calc.at:591 >$at_check_line_file -( $at_traceon; cat stderr ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -$at_diff expout $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:591: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - -cat >input <<'_ATEOF' -(- *) + (0 0) = 1 -_ATEOF - -$at_traceoff -echo "calc.at:591: \$PREPARSER ./calc input" -echo calc.at:591 >$at_check_line_file -( $at_traceon; $PREPARSER ./calc input ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo stderr:; tee stderr <$at_stderr -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:591: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - - -# Normalize the observed and expected error messages, depending upon the -# options. -# 1. Remove the traces from observed. -sed '/^Starting/d -/^Entering/d -/^Stack/d -/^Reading/d -/^Reducing/d -/^Shifting/d -/^state/d -/^Error:/d -/^Next/d -/^Discarding/d -/^yydestructor:/d' stderr >at-stderr -mv at-stderr stderr -# 2. Create the reference error message. -cat >expout <<'_ATEOF' -1.3: syntax error, unexpected '*', expecting "number" or '-' or '(' or '!' -1.11: syntax error, unexpected "number" -calc: error: 2222 != 1 -_ATEOF - -# 3. If locations are not used, remove them. -sed 's/^[-0-9.]*: //' expout >at-expout -mv at-expout expout -# 4. If error-verbose is not used, strip the`, unexpected....' part. -sed 's/syntax error, .*$/syntax error/' expout >at-expout -mv at-expout expout -# 5. Check -$at_traceoff -echo "calc.at:591: cat stderr" -echo calc.at:591 >$at_check_line_file -( $at_traceon; cat stderr ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -$at_diff expout $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:591: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - - - - - - - - - - - - - - - - - - - - - $at_traceoff - $at_times_p && times >$at_times_file - ) 5>&1 2>&1 | eval $at_tee_pipe - at_status=`cat $at_status_file` - ;; - - 81 ) # 81. calc.at:592: Calculator %glr-parser %error-verbose %debug %locations %defines %name-prefix="calc" %verbose %yacc - at_setup_line='calc.at:592' - at_desc='Calculator %glr-parser %error-verbose %debug %locations %defines %name-prefix="calc" %verbose %yacc' - $at_quiet $ECHO_N " 81: Calculator %glr-parser %error-verbose %debug %locations %defines %name-prefix="calc" %verbose %yacc$ECHO_C" - at_xfail=no - ( - echo "81. calc.at:592: testing ..." - $at_traceon - - - - - - -# Using yacc.c? - - - - - - - -# yyerror receives the location if %location & %pure & (%glr or %parse-param). - -# yyerror always sees the locations (when activated), except if -# yacc & pure & !param. - - -# The interface is pure: either because %pure-parser, or because we -# are using the C++ parsers. - - - - - - - - - - - - -cat >calc.y <<'_ATEOF' -%{ -#if HAVE_CONFIG_H -# include - /* We don't need perfect functions for these tests. */ -# undef malloc -# undef memcmp -# undef realloc -#endif -%} - -/* Infix notation calculator--calc */ -%glr-parser %error-verbose %debug %locations %defines %name-prefix="calc" %verbose %yacc -%{ -#include - -#include -#include -#if HAVE_UNISTD_H -# include -#else -# undef alarm -# define alarm(seconds) /* empty */ -#endif -#include - -/* Exercise pre-prologue dependency to %union. */ -typedef int semantic_value; - -static semantic_value global_result = 0; -static int global_count = 0; -%} - -/* Exercise %union. */ -%union -{ - semantic_value ival; -}; - -%{ -static int power (int base, int exponent); -/* yyerror receives the location if: - - %location & %pure & %glr - - %location & %pure & %yacc & %parse-param. */ -static void yyerror ( - - const char *s - ); -static int yylex (void); -static int yygetc (void); -static void yyungetc ( int c); -%} - -/* Bison Declarations */ -%token CALC_EOF 0 "end of input" -%token NUM "number" -%type exp - -%nonassoc '=' /* comparison */ -%left '-' '+' -%left '*' '/' -%left NEG /* negation--unary minus */ -%right '^' /* exponentiation */ - -/* Grammar follows */ -%% -input: - line -| input line { } -; - -line: - '\n' -| exp '\n' { } -; - -exp: - NUM { $$ = $1; } -| exp '=' exp - { - if ($1 != $3) - fprintf (stderr, "calc: error: %d != %d\n", $1, $3); - $$ = $1; - } -| exp '+' exp { $$ = $1 + $3; } -| exp '-' exp { $$ = $1 - $3; } -| exp '*' exp { $$ = $1 * $3; } -| exp '/' exp { $$ = $1 / $3; } -| '-' exp %prec NEG { $$ = -$2; } -| exp '^' exp { $$ = power ($1, $3); } -| '(' exp ')' { $$ = $2; } -| '(' error ')' { $$ = 1111; } -| '!' { YYERROR; } -| '-' error { YYERROR; } -; -%% -/* The input. */ -static FILE *yyin; - -static void -yyerror ( - - const char *s) -{ - - - fprintf (stderr, "%d.%d", - (yylloc).first_line, (yylloc).first_column); - if ((yylloc).first_line != (yylloc).last_line) - fprintf (stderr, "-%d.%d", - (yylloc).last_line, (yylloc).last_column - 1); - else if ((yylloc).first_column != (yylloc).last_column - 1) - fprintf (stderr, "-%d", - (yylloc).last_column - 1); - fprintf (stderr, ": "); - fprintf (stderr, "%s\n", s); -} - - - -static YYLTYPE last_yylloc; - -static int -yygetc (void) -{ - int res = getc (yyin); - ; - - last_yylloc = (yylloc); - if (res == '\n') - { - (yylloc).last_line++; - (yylloc).last_column = 0; - } - else - (yylloc).last_column++; - - return res; -} - - -static void -yyungetc ( int c) -{ - ; - - /* Wrong when C == `\n'. */ - (yylloc) = last_yylloc; - - ungetc (c, yyin); -} - -static int -read_signed_integer (void) -{ - int c = yygetc (); - int sign = 1; - int n = 0; - - ; - if (c == '-') - { - c = yygetc (); - sign = -1; - } - - while (isdigit (c)) - { - n = 10 * n + (c - '0'); - c = yygetc (); - } - - yyungetc ( c); - - return sign * n; -} - - - -/*---------------------------------------------------------------. -| Lexical analyzer returns an integer on the stack and the token | -| NUM, or the ASCII character read if not a number. Skips all | -| blanks and tabs, returns 0 for EOF. | -`---------------------------------------------------------------*/ - -static int -yylex (void) -{ - static int init = 1; - int c; - - if (init) - { - init = 0; - - (yylloc).last_column = 0; - (yylloc).last_line = 1; - - } - - (yylloc).first_column = (yylloc).last_column; - (yylloc).first_line = (yylloc).last_line; - - - /* Skip white space. */ - while ((c = yygetc ()) == ' ' || c == '\t') - { - (yylloc).first_column = (yylloc).last_column; - (yylloc).first_line = (yylloc).last_line; - - } - - /* process numbers */ - if (c == '.' || isdigit (c)) - { - yyungetc ( c); - (yylval).ival = read_signed_integer (); - return NUM; - } - - /* Return end-of-file. */ - if (c == EOF) - return CALC_EOF; - - /* Return single chars. */ - return c; -} - -static int -power (int base, int exponent) -{ - int res = 1; - if (exponent < 0) - exit (1); - for (/* Niente */; exponent; --exponent) - res *= base; - return res; -} - - -int -main (int argc, const char **argv) -{ - semantic_value result = 0; - int count = 0; - int status; - - alarm (10); - if (argc == 2) - yyin = fopen (argv[1], "r"); - else - yyin = stdin; - - if (!yyin) - { - perror (argv[1]); - exit (1); - } - - yydebug = 1; - status = yyparse (); - if (global_result != result) - abort (); - if (global_count != count) - abort (); - return status; -} -_ATEOF - - - - - -# Specify the output files to avoid problems on different file systems. -$at_traceoff -echo "calc.at:592: bison -o calc.c calc.y" -echo calc.at:592 >$at_check_line_file -( $at_traceon; bison -o calc.c calc.y ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:592: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - -$at_traceoff -echo "calc.at:592: \$CC \$CFLAGS \$CPPFLAGS \$LDFLAGS calc.c \$LIBS -o calc" -echo calc.at:592 >$at_check_line_file -( $at_traceon; $CC $CFLAGS $CPPFLAGS $LDFLAGS calc.c $LIBS -o calc ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo stderr:; cat $at_stderr -echo stdout:; cat $at_stdout -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:592: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - -# Test the priorities. -cat >input <<'_ATEOF' -1 + 2 * 3 = 7 -1 + 2 * -3 = -5 - --1^2 = -1 -(-1)^2 = 1 - ----1 = -1 - -1 - 2 - 3 = -4 -1 - (2 - 3) = 2 - -2^2^3 = 256 -(2^2)^3 = 64 -_ATEOF - -$at_traceoff -echo "calc.at:592: \$PREPARSER ./calc input" -echo calc.at:592 >$at_check_line_file -( $at_traceon; $PREPARSER ./calc input ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo stderr:; tee stderr <$at_stderr -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:592: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - - - -# Some syntax errors. -cat >input <<'_ATEOF' -0 0 -_ATEOF - -$at_traceoff -echo "calc.at:592: \$PREPARSER ./calc input" -echo calc.at:592 >$at_check_line_file -( $at_traceon; $PREPARSER ./calc input ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo stderr:; tee stderr <$at_stderr -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 1) ;; - *) echo "calc.at:592: exit code was $at_status, expected 1" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - - -# Normalize the observed and expected error messages, depending upon the -# options. -# 1. Remove the traces from observed. -sed '/^Starting/d -/^Entering/d -/^Stack/d -/^Reading/d -/^Reducing/d -/^Shifting/d -/^state/d -/^Error:/d -/^Next/d -/^Discarding/d -/^yydestructor:/d' stderr >at-stderr -mv at-stderr stderr -# 2. Create the reference error message. -cat >expout <<'_ATEOF' -1.2: syntax error, unexpected "number" -_ATEOF - -# 3. If locations are not used, remove them. - -# 4. If error-verbose is not used, strip the`, unexpected....' part. - -# 5. Check -$at_traceoff -echo "calc.at:592: cat stderr" -echo calc.at:592 >$at_check_line_file -( $at_traceon; cat stderr ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -$at_diff expout $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:592: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - -cat >input <<'_ATEOF' -1//2 -_ATEOF - -$at_traceoff -echo "calc.at:592: \$PREPARSER ./calc input" -echo calc.at:592 >$at_check_line_file -( $at_traceon; $PREPARSER ./calc input ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo stderr:; tee stderr <$at_stderr -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 1) ;; - *) echo "calc.at:592: exit code was $at_status, expected 1" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - - -# Normalize the observed and expected error messages, depending upon the -# options. -# 1. Remove the traces from observed. -sed '/^Starting/d -/^Entering/d -/^Stack/d -/^Reading/d -/^Reducing/d -/^Shifting/d -/^state/d -/^Error:/d -/^Next/d -/^Discarding/d -/^yydestructor:/d' stderr >at-stderr -mv at-stderr stderr -# 2. Create the reference error message. -cat >expout <<'_ATEOF' -1.2: syntax error, unexpected '/', expecting "number" or '-' or '(' or '!' -_ATEOF - -# 3. If locations are not used, remove them. - -# 4. If error-verbose is not used, strip the`, unexpected....' part. - -# 5. Check -$at_traceoff -echo "calc.at:592: cat stderr" -echo calc.at:592 >$at_check_line_file -( $at_traceon; cat stderr ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -$at_diff expout $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:592: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - -cat >input <<'_ATEOF' -error -_ATEOF - -$at_traceoff -echo "calc.at:592: \$PREPARSER ./calc input" -echo calc.at:592 >$at_check_line_file -( $at_traceon; $PREPARSER ./calc input ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo stderr:; tee stderr <$at_stderr -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 1) ;; - *) echo "calc.at:592: exit code was $at_status, expected 1" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - - -# Normalize the observed and expected error messages, depending upon the -# options. -# 1. Remove the traces from observed. -sed '/^Starting/d -/^Entering/d -/^Stack/d -/^Reading/d -/^Reducing/d -/^Shifting/d -/^state/d -/^Error:/d -/^Next/d -/^Discarding/d -/^yydestructor:/d' stderr >at-stderr -mv at-stderr stderr -# 2. Create the reference error message. -cat >expout <<'_ATEOF' -1.0: syntax error, unexpected $undefined -_ATEOF - -# 3. If locations are not used, remove them. - -# 4. If error-verbose is not used, strip the`, unexpected....' part. - -# 5. Check -$at_traceoff -echo "calc.at:592: cat stderr" -echo calc.at:592 >$at_check_line_file -( $at_traceon; cat stderr ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -$at_diff expout $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:592: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - -cat >input <<'_ATEOF' -1 = 2 = 3 -_ATEOF - -$at_traceoff -echo "calc.at:592: \$PREPARSER ./calc input" -echo calc.at:592 >$at_check_line_file -( $at_traceon; $PREPARSER ./calc input ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo stderr:; tee stderr <$at_stderr -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 1) ;; - *) echo "calc.at:592: exit code was $at_status, expected 1" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - - -# Normalize the observed and expected error messages, depending upon the -# options. -# 1. Remove the traces from observed. -sed '/^Starting/d -/^Entering/d -/^Stack/d -/^Reading/d -/^Reducing/d -/^Shifting/d -/^state/d -/^Error:/d -/^Next/d -/^Discarding/d -/^yydestructor:/d' stderr >at-stderr -mv at-stderr stderr -# 2. Create the reference error message. -cat >expout <<'_ATEOF' -1.6: syntax error, unexpected '=' -_ATEOF - -# 3. If locations are not used, remove them. - -# 4. If error-verbose is not used, strip the`, unexpected....' part. - -# 5. Check -$at_traceoff -echo "calc.at:592: cat stderr" -echo calc.at:592 >$at_check_line_file -( $at_traceon; cat stderr ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -$at_diff expout $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:592: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - -cat >input <<'_ATEOF' - -+1 -_ATEOF - -$at_traceoff -echo "calc.at:592: \$PREPARSER ./calc input" -echo calc.at:592 >$at_check_line_file -( $at_traceon; $PREPARSER ./calc input ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo stderr:; tee stderr <$at_stderr -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 1) ;; - *) echo "calc.at:592: exit code was $at_status, expected 1" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - - -# Normalize the observed and expected error messages, depending upon the -# options. -# 1. Remove the traces from observed. -sed '/^Starting/d -/^Entering/d -/^Stack/d -/^Reading/d -/^Reducing/d -/^Shifting/d -/^state/d -/^Error:/d -/^Next/d -/^Discarding/d -/^yydestructor:/d' stderr >at-stderr -mv at-stderr stderr -# 2. Create the reference error message. -cat >expout <<'_ATEOF' -2.0: syntax error, unexpected '+' -_ATEOF - -# 3. If locations are not used, remove them. - -# 4. If error-verbose is not used, strip the`, unexpected....' part. - -# 5. Check -$at_traceoff -echo "calc.at:592: cat stderr" -echo calc.at:592 >$at_check_line_file -( $at_traceon; cat stderr ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -$at_diff expout $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:592: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - -# Exercise error messages with EOF: work on an empty file. -$at_traceoff -echo "calc.at:592: \$PREPARSER ./calc /dev/null" -echo calc.at:592 >$at_check_line_file -( $at_traceon; $PREPARSER ./calc /dev/null ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo stderr:; tee stderr <$at_stderr -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 1) ;; - *) echo "calc.at:592: exit code was $at_status, expected 1" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - - -# Normalize the observed and expected error messages, depending upon the -# options. -# 1. Remove the traces from observed. -sed '/^Starting/d -/^Entering/d -/^Stack/d -/^Reading/d -/^Reducing/d -/^Shifting/d -/^state/d -/^Error:/d -/^Next/d -/^Discarding/d -/^yydestructor:/d' stderr >at-stderr -mv at-stderr stderr -# 2. Create the reference error message. -cat >expout <<'_ATEOF' -1.0: syntax error, unexpected "end of input" -_ATEOF - -# 3. If locations are not used, remove them. - -# 4. If error-verbose is not used, strip the`, unexpected....' part. - -# 5. Check -$at_traceoff -echo "calc.at:592: cat stderr" -echo calc.at:592 >$at_check_line_file -( $at_traceon; cat stderr ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -$at_diff expout $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:592: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - - -# Exercise the error token: without it, we die at the first error, -# hence be sure to -# -# - have several errors which exercise different shift/discardings -# - (): nothing to pop, nothing to discard -# - (1 + 1 + 1 +): a lot to pop, nothing to discard -# - (* * *): nothing to pop, a lot to discard -# - (1 + 2 * *): some to pop and discard -# -# - test the action associated to `error' -# -# - check the lookahead that triggers an error is not discarded -# when we enter error recovery. Below, the lookahead causing the -# first error is ")", which is needed to recover from the error and -# produce the "0" that triggers the "0 != 1" error. -# -cat >input <<'_ATEOF' -() + (1 + 1 + 1 +) + (* * *) + (1 * 2 * *) = 1 -_ATEOF - -$at_traceoff -echo "calc.at:592: \$PREPARSER ./calc input" -echo calc.at:592 >$at_check_line_file -( $at_traceon; $PREPARSER ./calc input ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo stderr:; tee stderr <$at_stderr -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:592: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - - -# Normalize the observed and expected error messages, depending upon the -# options. -# 1. Remove the traces from observed. -sed '/^Starting/d -/^Entering/d -/^Stack/d -/^Reading/d -/^Reducing/d -/^Shifting/d -/^state/d -/^Error:/d -/^Next/d -/^Discarding/d -/^yydestructor:/d' stderr >at-stderr -mv at-stderr stderr -# 2. Create the reference error message. -cat >expout <<'_ATEOF' -1.1: syntax error, unexpected ')', expecting "number" or '-' or '(' or '!' -1.17: syntax error, unexpected ')', expecting "number" or '-' or '(' or '!' -1.22: syntax error, unexpected '*', expecting "number" or '-' or '(' or '!' -1.40: syntax error, unexpected '*', expecting "number" or '-' or '(' or '!' -calc: error: 4444 != 1 -_ATEOF - -# 3. If locations are not used, remove them. - -# 4. If error-verbose is not used, strip the`, unexpected....' part. - -# 5. Check -$at_traceoff -echo "calc.at:592: cat stderr" -echo calc.at:592 >$at_check_line_file -( $at_traceon; cat stderr ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -$at_diff expout $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:592: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - - -# The same, but this time exercising explicitly triggered syntax errors. -# POSIX says the lookahead causing the error should not be discarded. -cat >input <<'_ATEOF' -(!) + (0 0) = 1 -_ATEOF - -$at_traceoff -echo "calc.at:592: \$PREPARSER ./calc input" -echo calc.at:592 >$at_check_line_file -( $at_traceon; $PREPARSER ./calc input ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo stderr:; tee stderr <$at_stderr -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:592: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - - -# Normalize the observed and expected error messages, depending upon the -# options. -# 1. Remove the traces from observed. -sed '/^Starting/d -/^Entering/d -/^Stack/d -/^Reading/d -/^Reducing/d -/^Shifting/d -/^state/d -/^Error:/d -/^Next/d -/^Discarding/d -/^yydestructor:/d' stderr >at-stderr -mv at-stderr stderr -# 2. Create the reference error message. -cat >expout <<'_ATEOF' -1.9: syntax error, unexpected "number" -calc: error: 2222 != 1 -_ATEOF - -# 3. If locations are not used, remove them. - -# 4. If error-verbose is not used, strip the`, unexpected....' part. - -# 5. Check -$at_traceoff -echo "calc.at:592: cat stderr" -echo calc.at:592 >$at_check_line_file -( $at_traceon; cat stderr ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -$at_diff expout $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:592: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - -cat >input <<'_ATEOF' -(- *) + (0 0) = 1 -_ATEOF - -$at_traceoff -echo "calc.at:592: \$PREPARSER ./calc input" -echo calc.at:592 >$at_check_line_file -( $at_traceon; $PREPARSER ./calc input ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo stderr:; tee stderr <$at_stderr -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:592: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - - -# Normalize the observed and expected error messages, depending upon the -# options. -# 1. Remove the traces from observed. -sed '/^Starting/d -/^Entering/d -/^Stack/d -/^Reading/d -/^Reducing/d -/^Shifting/d -/^state/d -/^Error:/d -/^Next/d -/^Discarding/d -/^yydestructor:/d' stderr >at-stderr -mv at-stderr stderr -# 2. Create the reference error message. -cat >expout <<'_ATEOF' -1.3: syntax error, unexpected '*', expecting "number" or '-' or '(' or '!' -1.11: syntax error, unexpected "number" -calc: error: 2222 != 1 -_ATEOF - -# 3. If locations are not used, remove them. - -# 4. If error-verbose is not used, strip the`, unexpected....' part. - -# 5. Check -$at_traceoff -echo "calc.at:592: cat stderr" -echo calc.at:592 >$at_check_line_file -( $at_traceon; cat stderr ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -$at_diff expout $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:592: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - - - - - - - - - - - - - - - - - - - - - $at_traceoff - $at_times_p && times >$at_times_file - ) 5>&1 2>&1 | eval $at_tee_pipe - at_status=`cat $at_status_file` - ;; - - 82 ) # 82. calc.at:594: Calculator %glr-parser %pure-parser %error-verbose %debug %locations %defines %name-prefix="calc" %verbose %yacc - at_setup_line='calc.at:594' - at_desc='Calculator %glr-parser %pure-parser %error-verbose %debug %locations %defines %name-prefix="calc" %verbose %yacc' - $at_quiet $ECHO_N " 82: Calculator %glr-parser %pure-parser %error-verbose %debug %locations %defines %name-prefix="calc" %verbose %yacc$ECHO_C" - at_xfail=no - ( - echo "82. calc.at:594: testing ..." - $at_traceon - - - - - - -# Using yacc.c? - - - - - - - -# yyerror receives the location if %location & %pure & (%glr or %parse-param). - -# yyerror always sees the locations (when activated), except if -# yacc & pure & !param. - - -# The interface is pure: either because %pure-parser, or because we -# are using the C++ parsers. - - - - - - - - - - - - -cat >calc.y <<'_ATEOF' -%{ -#if HAVE_CONFIG_H -# include - /* We don't need perfect functions for these tests. */ -# undef malloc -# undef memcmp -# undef realloc -#endif -%} - -/* Infix notation calculator--calc */ -%glr-parser %pure-parser %error-verbose %debug %locations %defines %name-prefix="calc" %verbose %yacc -%{ -#include - -#include -#include -#if HAVE_UNISTD_H -# include -#else -# undef alarm -# define alarm(seconds) /* empty */ -#endif -#include - -/* Exercise pre-prologue dependency to %union. */ -typedef int semantic_value; - -static semantic_value global_result = 0; -static int global_count = 0; -%} - -/* Exercise %union. */ -%union -{ - semantic_value ival; -}; - -%{ -static int power (int base, int exponent); -/* yyerror receives the location if: - - %location & %pure & %glr - - %location & %pure & %yacc & %parse-param. */ -static void yyerror (YYLTYPE *yylloc, - - const char *s - ); -static int yylex (YYSTYPE *yylval, YYLTYPE *yylloc); -static int yygetc (YYSTYPE *yylval, YYLTYPE *yylloc); -static void yyungetc (YYSTYPE *yylval, YYLTYPE *yylloc, int c); -%} - -/* Bison Declarations */ -%token CALC_EOF 0 "end of input" -%token NUM "number" -%type exp - -%nonassoc '=' /* comparison */ -%left '-' '+' -%left '*' '/' -%left NEG /* negation--unary minus */ -%right '^' /* exponentiation */ - -/* Grammar follows */ -%% -input: - line -| input line { } -; - -line: - '\n' -| exp '\n' { } -; - -exp: - NUM { $$ = $1; } -| exp '=' exp - { - if ($1 != $3) - fprintf (stderr, "calc: error: %d != %d\n", $1, $3); - $$ = $1; - } -| exp '+' exp { $$ = $1 + $3; } -| exp '-' exp { $$ = $1 - $3; } -| exp '*' exp { $$ = $1 * $3; } -| exp '/' exp { $$ = $1 / $3; } -| '-' exp %prec NEG { $$ = -$2; } -| exp '^' exp { $$ = power ($1, $3); } -| '(' exp ')' { $$ = $2; } -| '(' error ')' { $$ = 1111; } -| '!' { YYERROR; } -| '-' error { YYERROR; } -; -%% -/* The input. */ -static FILE *yyin; - -static void -yyerror (YYLTYPE *yylloc, - - const char *s) -{ - - - fprintf (stderr, "%d.%d", - (*yylloc).first_line, (*yylloc).first_column); - if ((*yylloc).first_line != (*yylloc).last_line) - fprintf (stderr, "-%d.%d", - (*yylloc).last_line, (*yylloc).last_column - 1); - else if ((*yylloc).first_column != (*yylloc).last_column - 1) - fprintf (stderr, "-%d", - (*yylloc).last_column - 1); - fprintf (stderr, ": "); - fprintf (stderr, "%s\n", s); -} - - - -static YYLTYPE last_yylloc; - -static int -yygetc (YYSTYPE *yylval, YYLTYPE *yylloc) -{ - int res = getc (yyin); - (void) yylval;(void) yylloc; - - last_yylloc = (*yylloc); - if (res == '\n') - { - (*yylloc).last_line++; - (*yylloc).last_column = 0; - } - else - (*yylloc).last_column++; - - return res; -} - - -static void -yyungetc (YYSTYPE *yylval, YYLTYPE *yylloc, int c) -{ - (void) yylval;(void) yylloc; - - /* Wrong when C == `\n'. */ - (*yylloc) = last_yylloc; - - ungetc (c, yyin); -} - -static int -read_signed_integer (YYSTYPE *yylval, YYLTYPE *yylloc) -{ - int c = yygetc (yylval, yylloc); - int sign = 1; - int n = 0; - - (void) yylval;(void) yylloc; - if (c == '-') - { - c = yygetc (yylval, yylloc); - sign = -1; - } - - while (isdigit (c)) - { - n = 10 * n + (c - '0'); - c = yygetc (yylval, yylloc); - } - - yyungetc (yylval, yylloc, c); - - return sign * n; -} - - - -/*---------------------------------------------------------------. -| Lexical analyzer returns an integer on the stack and the token | -| NUM, or the ASCII character read if not a number. Skips all | -| blanks and tabs, returns 0 for EOF. | -`---------------------------------------------------------------*/ - -static int -yylex (YYSTYPE *yylval, YYLTYPE *yylloc) -{ - static int init = 1; - int c; - - if (init) - { - init = 0; - - (*yylloc).last_column = 0; - (*yylloc).last_line = 1; - - } - - (*yylloc).first_column = (*yylloc).last_column; - (*yylloc).first_line = (*yylloc).last_line; - - - /* Skip white space. */ - while ((c = yygetc (yylval, yylloc)) == ' ' || c == '\t') - { - (*yylloc).first_column = (*yylloc).last_column; - (*yylloc).first_line = (*yylloc).last_line; - - } - - /* process numbers */ - if (c == '.' || isdigit (c)) - { - yyungetc (yylval, yylloc, c); - (*yylval).ival = read_signed_integer (yylval, yylloc); - return NUM; - } - - /* Return end-of-file. */ - if (c == EOF) - return CALC_EOF; - - /* Return single chars. */ - return c; -} - -static int -power (int base, int exponent) -{ - int res = 1; - if (exponent < 0) - exit (1); - for (/* Niente */; exponent; --exponent) - res *= base; - return res; -} - - -int -main (int argc, const char **argv) -{ - semantic_value result = 0; - int count = 0; - int status; - - alarm (10); - if (argc == 2) - yyin = fopen (argv[1], "r"); - else - yyin = stdin; - - if (!yyin) - { - perror (argv[1]); - exit (1); - } - - yydebug = 1; - status = yyparse (); - if (global_result != result) - abort (); - if (global_count != count) - abort (); - return status; -} -_ATEOF - - - - - -# Specify the output files to avoid problems on different file systems. -$at_traceoff -echo "calc.at:594: bison -o calc.c calc.y" -echo calc.at:594 >$at_check_line_file -( $at_traceon; bison -o calc.c calc.y ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:594: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - -$at_traceoff -echo "calc.at:594: \$CC \$CFLAGS \$CPPFLAGS \$LDFLAGS calc.c \$LIBS -o calc" -echo calc.at:594 >$at_check_line_file -( $at_traceon; $CC $CFLAGS $CPPFLAGS $LDFLAGS calc.c $LIBS -o calc ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo stderr:; cat $at_stderr -echo stdout:; cat $at_stdout -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:594: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - -# Test the priorities. -cat >input <<'_ATEOF' -1 + 2 * 3 = 7 -1 + 2 * -3 = -5 - --1^2 = -1 -(-1)^2 = 1 - ----1 = -1 - -1 - 2 - 3 = -4 -1 - (2 - 3) = 2 - -2^2^3 = 256 -(2^2)^3 = 64 -_ATEOF - -$at_traceoff -echo "calc.at:594: \$PREPARSER ./calc input" -echo calc.at:594 >$at_check_line_file -( $at_traceon; $PREPARSER ./calc input ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo stderr:; tee stderr <$at_stderr -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:594: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - - - -# Some syntax errors. -cat >input <<'_ATEOF' -0 0 -_ATEOF - -$at_traceoff -echo "calc.at:594: \$PREPARSER ./calc input" -echo calc.at:594 >$at_check_line_file -( $at_traceon; $PREPARSER ./calc input ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo stderr:; tee stderr <$at_stderr -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 1) ;; - *) echo "calc.at:594: exit code was $at_status, expected 1" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - - -# Normalize the observed and expected error messages, depending upon the -# options. -# 1. Remove the traces from observed. -sed '/^Starting/d -/^Entering/d -/^Stack/d -/^Reading/d -/^Reducing/d -/^Shifting/d -/^state/d -/^Error:/d -/^Next/d -/^Discarding/d -/^yydestructor:/d' stderr >at-stderr -mv at-stderr stderr -# 2. Create the reference error message. -cat >expout <<'_ATEOF' -1.2: syntax error, unexpected "number" -_ATEOF - -# 3. If locations are not used, remove them. - -# 4. If error-verbose is not used, strip the`, unexpected....' part. - -# 5. Check -$at_traceoff -echo "calc.at:594: cat stderr" -echo calc.at:594 >$at_check_line_file -( $at_traceon; cat stderr ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -$at_diff expout $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:594: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - -cat >input <<'_ATEOF' -1//2 -_ATEOF - -$at_traceoff -echo "calc.at:594: \$PREPARSER ./calc input" -echo calc.at:594 >$at_check_line_file -( $at_traceon; $PREPARSER ./calc input ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo stderr:; tee stderr <$at_stderr -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 1) ;; - *) echo "calc.at:594: exit code was $at_status, expected 1" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - - -# Normalize the observed and expected error messages, depending upon the -# options. -# 1. Remove the traces from observed. -sed '/^Starting/d -/^Entering/d -/^Stack/d -/^Reading/d -/^Reducing/d -/^Shifting/d -/^state/d -/^Error:/d -/^Next/d -/^Discarding/d -/^yydestructor:/d' stderr >at-stderr -mv at-stderr stderr -# 2. Create the reference error message. -cat >expout <<'_ATEOF' -1.2: syntax error, unexpected '/', expecting "number" or '-' or '(' or '!' -_ATEOF - -# 3. If locations are not used, remove them. - -# 4. If error-verbose is not used, strip the`, unexpected....' part. - -# 5. Check -$at_traceoff -echo "calc.at:594: cat stderr" -echo calc.at:594 >$at_check_line_file -( $at_traceon; cat stderr ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -$at_diff expout $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:594: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - -cat >input <<'_ATEOF' -error -_ATEOF - -$at_traceoff -echo "calc.at:594: \$PREPARSER ./calc input" -echo calc.at:594 >$at_check_line_file -( $at_traceon; $PREPARSER ./calc input ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo stderr:; tee stderr <$at_stderr -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 1) ;; - *) echo "calc.at:594: exit code was $at_status, expected 1" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - - -# Normalize the observed and expected error messages, depending upon the -# options. -# 1. Remove the traces from observed. -sed '/^Starting/d -/^Entering/d -/^Stack/d -/^Reading/d -/^Reducing/d -/^Shifting/d -/^state/d -/^Error:/d -/^Next/d -/^Discarding/d -/^yydestructor:/d' stderr >at-stderr -mv at-stderr stderr -# 2. Create the reference error message. -cat >expout <<'_ATEOF' -1.0: syntax error, unexpected $undefined -_ATEOF - -# 3. If locations are not used, remove them. - -# 4. If error-verbose is not used, strip the`, unexpected....' part. - -# 5. Check -$at_traceoff -echo "calc.at:594: cat stderr" -echo calc.at:594 >$at_check_line_file -( $at_traceon; cat stderr ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -$at_diff expout $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:594: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - -cat >input <<'_ATEOF' -1 = 2 = 3 -_ATEOF - -$at_traceoff -echo "calc.at:594: \$PREPARSER ./calc input" -echo calc.at:594 >$at_check_line_file -( $at_traceon; $PREPARSER ./calc input ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo stderr:; tee stderr <$at_stderr -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 1) ;; - *) echo "calc.at:594: exit code was $at_status, expected 1" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - - -# Normalize the observed and expected error messages, depending upon the -# options. -# 1. Remove the traces from observed. -sed '/^Starting/d -/^Entering/d -/^Stack/d -/^Reading/d -/^Reducing/d -/^Shifting/d -/^state/d -/^Error:/d -/^Next/d -/^Discarding/d -/^yydestructor:/d' stderr >at-stderr -mv at-stderr stderr -# 2. Create the reference error message. -cat >expout <<'_ATEOF' -1.6: syntax error, unexpected '=' -_ATEOF - -# 3. If locations are not used, remove them. - -# 4. If error-verbose is not used, strip the`, unexpected....' part. - -# 5. Check -$at_traceoff -echo "calc.at:594: cat stderr" -echo calc.at:594 >$at_check_line_file -( $at_traceon; cat stderr ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -$at_diff expout $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:594: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - -cat >input <<'_ATEOF' - -+1 -_ATEOF - -$at_traceoff -echo "calc.at:594: \$PREPARSER ./calc input" -echo calc.at:594 >$at_check_line_file -( $at_traceon; $PREPARSER ./calc input ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo stderr:; tee stderr <$at_stderr -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 1) ;; - *) echo "calc.at:594: exit code was $at_status, expected 1" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - - -# Normalize the observed and expected error messages, depending upon the -# options. -# 1. Remove the traces from observed. -sed '/^Starting/d -/^Entering/d -/^Stack/d -/^Reading/d -/^Reducing/d -/^Shifting/d -/^state/d -/^Error:/d -/^Next/d -/^Discarding/d -/^yydestructor:/d' stderr >at-stderr -mv at-stderr stderr -# 2. Create the reference error message. -cat >expout <<'_ATEOF' -2.0: syntax error, unexpected '+' -_ATEOF - -# 3. If locations are not used, remove them. - -# 4. If error-verbose is not used, strip the`, unexpected....' part. - -# 5. Check -$at_traceoff -echo "calc.at:594: cat stderr" -echo calc.at:594 >$at_check_line_file -( $at_traceon; cat stderr ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -$at_diff expout $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:594: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - -# Exercise error messages with EOF: work on an empty file. -$at_traceoff -echo "calc.at:594: \$PREPARSER ./calc /dev/null" -echo calc.at:594 >$at_check_line_file -( $at_traceon; $PREPARSER ./calc /dev/null ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo stderr:; tee stderr <$at_stderr -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 1) ;; - *) echo "calc.at:594: exit code was $at_status, expected 1" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - - -# Normalize the observed and expected error messages, depending upon the -# options. -# 1. Remove the traces from observed. -sed '/^Starting/d -/^Entering/d -/^Stack/d -/^Reading/d -/^Reducing/d -/^Shifting/d -/^state/d -/^Error:/d -/^Next/d -/^Discarding/d -/^yydestructor:/d' stderr >at-stderr -mv at-stderr stderr -# 2. Create the reference error message. -cat >expout <<'_ATEOF' -1.0: syntax error, unexpected "end of input" -_ATEOF - -# 3. If locations are not used, remove them. - -# 4. If error-verbose is not used, strip the`, unexpected....' part. - -# 5. Check -$at_traceoff -echo "calc.at:594: cat stderr" -echo calc.at:594 >$at_check_line_file -( $at_traceon; cat stderr ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -$at_diff expout $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:594: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - - -# Exercise the error token: without it, we die at the first error, -# hence be sure to -# -# - have several errors which exercise different shift/discardings -# - (): nothing to pop, nothing to discard -# - (1 + 1 + 1 +): a lot to pop, nothing to discard -# - (* * *): nothing to pop, a lot to discard -# - (1 + 2 * *): some to pop and discard -# -# - test the action associated to `error' -# -# - check the lookahead that triggers an error is not discarded -# when we enter error recovery. Below, the lookahead causing the -# first error is ")", which is needed to recover from the error and -# produce the "0" that triggers the "0 != 1" error. -# -cat >input <<'_ATEOF' -() + (1 + 1 + 1 +) + (* * *) + (1 * 2 * *) = 1 -_ATEOF - -$at_traceoff -echo "calc.at:594: \$PREPARSER ./calc input" -echo calc.at:594 >$at_check_line_file -( $at_traceon; $PREPARSER ./calc input ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo stderr:; tee stderr <$at_stderr -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:594: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - - -# Normalize the observed and expected error messages, depending upon the -# options. -# 1. Remove the traces from observed. -sed '/^Starting/d -/^Entering/d -/^Stack/d -/^Reading/d -/^Reducing/d -/^Shifting/d -/^state/d -/^Error:/d -/^Next/d -/^Discarding/d -/^yydestructor:/d' stderr >at-stderr -mv at-stderr stderr -# 2. Create the reference error message. -cat >expout <<'_ATEOF' -1.1: syntax error, unexpected ')', expecting "number" or '-' or '(' or '!' -1.17: syntax error, unexpected ')', expecting "number" or '-' or '(' or '!' -1.22: syntax error, unexpected '*', expecting "number" or '-' or '(' or '!' -1.40: syntax error, unexpected '*', expecting "number" or '-' or '(' or '!' -calc: error: 4444 != 1 -_ATEOF - -# 3. If locations are not used, remove them. - -# 4. If error-verbose is not used, strip the`, unexpected....' part. - -# 5. Check -$at_traceoff -echo "calc.at:594: cat stderr" -echo calc.at:594 >$at_check_line_file -( $at_traceon; cat stderr ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -$at_diff expout $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:594: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - - -# The same, but this time exercising explicitly triggered syntax errors. -# POSIX says the lookahead causing the error should not be discarded. -cat >input <<'_ATEOF' -(!) + (0 0) = 1 -_ATEOF - -$at_traceoff -echo "calc.at:594: \$PREPARSER ./calc input" -echo calc.at:594 >$at_check_line_file -( $at_traceon; $PREPARSER ./calc input ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo stderr:; tee stderr <$at_stderr -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:594: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - - -# Normalize the observed and expected error messages, depending upon the -# options. -# 1. Remove the traces from observed. -sed '/^Starting/d -/^Entering/d -/^Stack/d -/^Reading/d -/^Reducing/d -/^Shifting/d -/^state/d -/^Error:/d -/^Next/d -/^Discarding/d -/^yydestructor:/d' stderr >at-stderr -mv at-stderr stderr -# 2. Create the reference error message. -cat >expout <<'_ATEOF' -1.9: syntax error, unexpected "number" -calc: error: 2222 != 1 -_ATEOF - -# 3. If locations are not used, remove them. - -# 4. If error-verbose is not used, strip the`, unexpected....' part. - -# 5. Check -$at_traceoff -echo "calc.at:594: cat stderr" -echo calc.at:594 >$at_check_line_file -( $at_traceon; cat stderr ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -$at_diff expout $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:594: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - -cat >input <<'_ATEOF' -(- *) + (0 0) = 1 -_ATEOF - -$at_traceoff -echo "calc.at:594: \$PREPARSER ./calc input" -echo calc.at:594 >$at_check_line_file -( $at_traceon; $PREPARSER ./calc input ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo stderr:; tee stderr <$at_stderr -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:594: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - - -# Normalize the observed and expected error messages, depending upon the -# options. -# 1. Remove the traces from observed. -sed '/^Starting/d -/^Entering/d -/^Stack/d -/^Reading/d -/^Reducing/d -/^Shifting/d -/^state/d -/^Error:/d -/^Next/d -/^Discarding/d -/^yydestructor:/d' stderr >at-stderr -mv at-stderr stderr -# 2. Create the reference error message. -cat >expout <<'_ATEOF' -1.3: syntax error, unexpected '*', expecting "number" or '-' or '(' or '!' -1.11: syntax error, unexpected "number" -calc: error: 2222 != 1 -_ATEOF - -# 3. If locations are not used, remove them. - -# 4. If error-verbose is not used, strip the`, unexpected....' part. - -# 5. Check -$at_traceoff -echo "calc.at:594: cat stderr" -echo calc.at:594 >$at_check_line_file -( $at_traceon; cat stderr ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -$at_diff expout $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:594: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - - - - - - - - - - - - - - - - - - - - - $at_traceoff - $at_times_p && times >$at_times_file - ) 5>&1 2>&1 | eval $at_tee_pipe - at_status=`cat $at_status_file` - ;; - - 83 ) # 83. calc.at:596: Calculator %glr-parser %pure-parser %error-verbose %debug %locations %defines %name-prefix="calc" %verbose %yacc %parse-param {semantic_value *result} %parse-param {int *count} - at_setup_line='calc.at:596' - at_desc='Calculator %glr-parser %pure-parser %error-verbose %debug %locations %defines %name-prefix="calc" %verbose %yacc %parse-param {semantic_value *result} %parse-param {int *count}' - $at_quiet $ECHO_N " 83: Calculator %glr-parser %pure-parser %error-verbose %debug %locations %defines %name-prefix="calc" %verbose %yacc %parse-param {semantic_value *result} %parse-param {int *count}$ECHO_C" - at_xfail=no - ( - echo "83. calc.at:596: testing ..." - $at_traceon - - - - - - -# Using yacc.c? - - - - - - - -# yyerror receives the location if %location & %pure & (%glr or %parse-param). - -# yyerror always sees the locations (when activated), except if -# yacc & pure & !param. - - -# The interface is pure: either because %pure-parser, or because we -# are using the C++ parsers. - - - - - - - - - - - - -cat >calc.y <<'_ATEOF' -%{ -#if HAVE_CONFIG_H -# include - /* We don't need perfect functions for these tests. */ -# undef malloc -# undef memcmp -# undef realloc -#endif -%} - -/* Infix notation calculator--calc */ -%glr-parser %pure-parser %error-verbose %debug %locations %defines %name-prefix="calc" %verbose %yacc %parse-param {semantic_value *result} %parse-param {int *count} -%{ -#include - -#include -#include -#if HAVE_UNISTD_H -# include -#else -# undef alarm -# define alarm(seconds) /* empty */ -#endif -#include - -/* Exercise pre-prologue dependency to %union. */ -typedef int semantic_value; - -static semantic_value global_result = 0; -static int global_count = 0; -%} - -/* Exercise %union. */ -%union -{ - semantic_value ival; -}; - -%{ -static int power (int base, int exponent); -/* yyerror receives the location if: - - %location & %pure & %glr - - %location & %pure & %yacc & %parse-param. */ -static void yyerror (YYLTYPE *yylloc, - semantic_value *result, int *count, - const char *s - ); -static int yylex (YYSTYPE *yylval, YYLTYPE *yylloc); -static int yygetc (YYSTYPE *yylval, YYLTYPE *yylloc); -static void yyungetc (YYSTYPE *yylval, YYLTYPE *yylloc, int c); -%} - -/* Bison Declarations */ -%token CALC_EOF 0 "end of input" -%token NUM "number" -%type exp - -%nonassoc '=' /* comparison */ -%left '-' '+' -%left '*' '/' -%left NEG /* negation--unary minus */ -%right '^' /* exponentiation */ - -/* Grammar follows */ -%% -input: - line -| input line { ++*count; ++global_count; } -; - -line: - '\n' -| exp '\n' { *result = global_result = $1; } -; - -exp: - NUM { $$ = $1; } -| exp '=' exp - { - if ($1 != $3) - fprintf (stderr, "calc: error: %d != %d\n", $1, $3); - $$ = $1; - } -| exp '+' exp { $$ = $1 + $3; } -| exp '-' exp { $$ = $1 - $3; } -| exp '*' exp { $$ = $1 * $3; } -| exp '/' exp { $$ = $1 / $3; } -| '-' exp %prec NEG { $$ = -$2; } -| exp '^' exp { $$ = power ($1, $3); } -| '(' exp ')' { $$ = $2; } -| '(' error ')' { $$ = 1111; } -| '!' { YYERROR; } -| '-' error { YYERROR; } -; -%% -/* The input. */ -static FILE *yyin; - -static void -yyerror (YYLTYPE *yylloc, - semantic_value *result, int *count, - const char *s) -{ -(void) result; (void) count; - - fprintf (stderr, "%d.%d", - (*yylloc).first_line, (*yylloc).first_column); - if ((*yylloc).first_line != (*yylloc).last_line) - fprintf (stderr, "-%d.%d", - (*yylloc).last_line, (*yylloc).last_column - 1); - else if ((*yylloc).first_column != (*yylloc).last_column - 1) - fprintf (stderr, "-%d", - (*yylloc).last_column - 1); - fprintf (stderr, ": "); - fprintf (stderr, "%s\n", s); -} - - - -static YYLTYPE last_yylloc; - -static int -yygetc (YYSTYPE *yylval, YYLTYPE *yylloc) -{ - int res = getc (yyin); - (void) yylval;(void) yylloc; - - last_yylloc = (*yylloc); - if (res == '\n') - { - (*yylloc).last_line++; - (*yylloc).last_column = 0; - } - else - (*yylloc).last_column++; - - return res; -} - - -static void -yyungetc (YYSTYPE *yylval, YYLTYPE *yylloc, int c) -{ - (void) yylval;(void) yylloc; - - /* Wrong when C == `\n'. */ - (*yylloc) = last_yylloc; - - ungetc (c, yyin); -} - -static int -read_signed_integer (YYSTYPE *yylval, YYLTYPE *yylloc) -{ - int c = yygetc (yylval, yylloc); - int sign = 1; - int n = 0; - - (void) yylval;(void) yylloc; - if (c == '-') - { - c = yygetc (yylval, yylloc); - sign = -1; - } - - while (isdigit (c)) - { - n = 10 * n + (c - '0'); - c = yygetc (yylval, yylloc); - } - - yyungetc (yylval, yylloc, c); - - return sign * n; -} - - - -/*---------------------------------------------------------------. -| Lexical analyzer returns an integer on the stack and the token | -| NUM, or the ASCII character read if not a number. Skips all | -| blanks and tabs, returns 0 for EOF. | -`---------------------------------------------------------------*/ - -static int -yylex (YYSTYPE *yylval, YYLTYPE *yylloc) -{ - static int init = 1; - int c; - - if (init) - { - init = 0; - - (*yylloc).last_column = 0; - (*yylloc).last_line = 1; - - } - - (*yylloc).first_column = (*yylloc).last_column; - (*yylloc).first_line = (*yylloc).last_line; - - - /* Skip white space. */ - while ((c = yygetc (yylval, yylloc)) == ' ' || c == '\t') - { - (*yylloc).first_column = (*yylloc).last_column; - (*yylloc).first_line = (*yylloc).last_line; - - } - - /* process numbers */ - if (c == '.' || isdigit (c)) - { - yyungetc (yylval, yylloc, c); - (*yylval).ival = read_signed_integer (yylval, yylloc); - return NUM; - } - - /* Return end-of-file. */ - if (c == EOF) - return CALC_EOF; - - /* Return single chars. */ - return c; -} - -static int -power (int base, int exponent) -{ - int res = 1; - if (exponent < 0) - exit (1); - for (/* Niente */; exponent; --exponent) - res *= base; - return res; -} - - -int -main (int argc, const char **argv) -{ - semantic_value result = 0; - int count = 0; - int status; - - alarm (10); - if (argc == 2) - yyin = fopen (argv[1], "r"); - else - yyin = stdin; - - if (!yyin) - { - perror (argv[1]); - exit (1); - } - - yydebug = 1; - status = yyparse (&result, &count); - if (global_result != result) - abort (); - if (global_count != count) - abort (); - return status; -} -_ATEOF - - - - - -# Specify the output files to avoid problems on different file systems. -$at_traceoff -echo "calc.at:596: bison -o calc.c calc.y" -echo calc.at:596 >$at_check_line_file -( $at_traceon; bison -o calc.c calc.y ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:596: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - -$at_traceoff -echo "calc.at:596: \$CC \$CFLAGS \$CPPFLAGS \$LDFLAGS calc.c \$LIBS -o calc" -echo calc.at:596 >$at_check_line_file -( $at_traceon; $CC $CFLAGS $CPPFLAGS $LDFLAGS calc.c $LIBS -o calc ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo stderr:; cat $at_stderr -echo stdout:; cat $at_stdout -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:596: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - -# Test the priorities. -cat >input <<'_ATEOF' -1 + 2 * 3 = 7 -1 + 2 * -3 = -5 - --1^2 = -1 -(-1)^2 = 1 - ----1 = -1 - -1 - 2 - 3 = -4 -1 - (2 - 3) = 2 - -2^2^3 = 256 -(2^2)^3 = 64 -_ATEOF - -$at_traceoff -echo "calc.at:596: \$PREPARSER ./calc input" -echo calc.at:596 >$at_check_line_file -( $at_traceon; $PREPARSER ./calc input ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo stderr:; tee stderr <$at_stderr -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:596: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - - - -# Some syntax errors. -cat >input <<'_ATEOF' -0 0 -_ATEOF - -$at_traceoff -echo "calc.at:596: \$PREPARSER ./calc input" -echo calc.at:596 >$at_check_line_file -( $at_traceon; $PREPARSER ./calc input ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo stderr:; tee stderr <$at_stderr -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 1) ;; - *) echo "calc.at:596: exit code was $at_status, expected 1" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - - -# Normalize the observed and expected error messages, depending upon the -# options. -# 1. Remove the traces from observed. -sed '/^Starting/d -/^Entering/d -/^Stack/d -/^Reading/d -/^Reducing/d -/^Shifting/d -/^state/d -/^Error:/d -/^Next/d -/^Discarding/d -/^yydestructor:/d' stderr >at-stderr -mv at-stderr stderr -# 2. Create the reference error message. -cat >expout <<'_ATEOF' -1.2: syntax error, unexpected "number" -_ATEOF - -# 3. If locations are not used, remove them. - -# 4. If error-verbose is not used, strip the`, unexpected....' part. - -# 5. Check -$at_traceoff -echo "calc.at:596: cat stderr" -echo calc.at:596 >$at_check_line_file -( $at_traceon; cat stderr ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -$at_diff expout $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:596: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - -cat >input <<'_ATEOF' -1//2 -_ATEOF - -$at_traceoff -echo "calc.at:596: \$PREPARSER ./calc input" -echo calc.at:596 >$at_check_line_file -( $at_traceon; $PREPARSER ./calc input ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo stderr:; tee stderr <$at_stderr -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 1) ;; - *) echo "calc.at:596: exit code was $at_status, expected 1" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - - -# Normalize the observed and expected error messages, depending upon the -# options. -# 1. Remove the traces from observed. -sed '/^Starting/d -/^Entering/d -/^Stack/d -/^Reading/d -/^Reducing/d -/^Shifting/d -/^state/d -/^Error:/d -/^Next/d -/^Discarding/d -/^yydestructor:/d' stderr >at-stderr -mv at-stderr stderr -# 2. Create the reference error message. -cat >expout <<'_ATEOF' -1.2: syntax error, unexpected '/', expecting "number" or '-' or '(' or '!' -_ATEOF - -# 3. If locations are not used, remove them. - -# 4. If error-verbose is not used, strip the`, unexpected....' part. - -# 5. Check -$at_traceoff -echo "calc.at:596: cat stderr" -echo calc.at:596 >$at_check_line_file -( $at_traceon; cat stderr ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -$at_diff expout $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:596: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - -cat >input <<'_ATEOF' -error -_ATEOF - -$at_traceoff -echo "calc.at:596: \$PREPARSER ./calc input" -echo calc.at:596 >$at_check_line_file -( $at_traceon; $PREPARSER ./calc input ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo stderr:; tee stderr <$at_stderr -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 1) ;; - *) echo "calc.at:596: exit code was $at_status, expected 1" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - - -# Normalize the observed and expected error messages, depending upon the -# options. -# 1. Remove the traces from observed. -sed '/^Starting/d -/^Entering/d -/^Stack/d -/^Reading/d -/^Reducing/d -/^Shifting/d -/^state/d -/^Error:/d -/^Next/d -/^Discarding/d -/^yydestructor:/d' stderr >at-stderr -mv at-stderr stderr -# 2. Create the reference error message. -cat >expout <<'_ATEOF' -1.0: syntax error, unexpected $undefined -_ATEOF - -# 3. If locations are not used, remove them. - -# 4. If error-verbose is not used, strip the`, unexpected....' part. - -# 5. Check -$at_traceoff -echo "calc.at:596: cat stderr" -echo calc.at:596 >$at_check_line_file -( $at_traceon; cat stderr ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -$at_diff expout $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:596: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - -cat >input <<'_ATEOF' -1 = 2 = 3 -_ATEOF - -$at_traceoff -echo "calc.at:596: \$PREPARSER ./calc input" -echo calc.at:596 >$at_check_line_file -( $at_traceon; $PREPARSER ./calc input ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo stderr:; tee stderr <$at_stderr -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 1) ;; - *) echo "calc.at:596: exit code was $at_status, expected 1" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - - -# Normalize the observed and expected error messages, depending upon the -# options. -# 1. Remove the traces from observed. -sed '/^Starting/d -/^Entering/d -/^Stack/d -/^Reading/d -/^Reducing/d -/^Shifting/d -/^state/d -/^Error:/d -/^Next/d -/^Discarding/d -/^yydestructor:/d' stderr >at-stderr -mv at-stderr stderr -# 2. Create the reference error message. -cat >expout <<'_ATEOF' -1.6: syntax error, unexpected '=' -_ATEOF - -# 3. If locations are not used, remove them. - -# 4. If error-verbose is not used, strip the`, unexpected....' part. - -# 5. Check -$at_traceoff -echo "calc.at:596: cat stderr" -echo calc.at:596 >$at_check_line_file -( $at_traceon; cat stderr ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -$at_diff expout $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:596: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - -cat >input <<'_ATEOF' - -+1 -_ATEOF - -$at_traceoff -echo "calc.at:596: \$PREPARSER ./calc input" -echo calc.at:596 >$at_check_line_file -( $at_traceon; $PREPARSER ./calc input ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo stderr:; tee stderr <$at_stderr -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 1) ;; - *) echo "calc.at:596: exit code was $at_status, expected 1" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - - -# Normalize the observed and expected error messages, depending upon the -# options. -# 1. Remove the traces from observed. -sed '/^Starting/d -/^Entering/d -/^Stack/d -/^Reading/d -/^Reducing/d -/^Shifting/d -/^state/d -/^Error:/d -/^Next/d -/^Discarding/d -/^yydestructor:/d' stderr >at-stderr -mv at-stderr stderr -# 2. Create the reference error message. -cat >expout <<'_ATEOF' -2.0: syntax error, unexpected '+' -_ATEOF - -# 3. If locations are not used, remove them. - -# 4. If error-verbose is not used, strip the`, unexpected....' part. - -# 5. Check -$at_traceoff -echo "calc.at:596: cat stderr" -echo calc.at:596 >$at_check_line_file -( $at_traceon; cat stderr ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -$at_diff expout $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:596: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - -# Exercise error messages with EOF: work on an empty file. -$at_traceoff -echo "calc.at:596: \$PREPARSER ./calc /dev/null" -echo calc.at:596 >$at_check_line_file -( $at_traceon; $PREPARSER ./calc /dev/null ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo stderr:; tee stderr <$at_stderr -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 1) ;; - *) echo "calc.at:596: exit code was $at_status, expected 1" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - - -# Normalize the observed and expected error messages, depending upon the -# options. -# 1. Remove the traces from observed. -sed '/^Starting/d -/^Entering/d -/^Stack/d -/^Reading/d -/^Reducing/d -/^Shifting/d -/^state/d -/^Error:/d -/^Next/d -/^Discarding/d -/^yydestructor:/d' stderr >at-stderr -mv at-stderr stderr -# 2. Create the reference error message. -cat >expout <<'_ATEOF' -1.0: syntax error, unexpected "end of input" -_ATEOF - -# 3. If locations are not used, remove them. - -# 4. If error-verbose is not used, strip the`, unexpected....' part. - -# 5. Check -$at_traceoff -echo "calc.at:596: cat stderr" -echo calc.at:596 >$at_check_line_file -( $at_traceon; cat stderr ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -$at_diff expout $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:596: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - - -# Exercise the error token: without it, we die at the first error, -# hence be sure to -# -# - have several errors which exercise different shift/discardings -# - (): nothing to pop, nothing to discard -# - (1 + 1 + 1 +): a lot to pop, nothing to discard -# - (* * *): nothing to pop, a lot to discard -# - (1 + 2 * *): some to pop and discard -# -# - test the action associated to `error' -# -# - check the lookahead that triggers an error is not discarded -# when we enter error recovery. Below, the lookahead causing the -# first error is ")", which is needed to recover from the error and -# produce the "0" that triggers the "0 != 1" error. -# -cat >input <<'_ATEOF' -() + (1 + 1 + 1 +) + (* * *) + (1 * 2 * *) = 1 -_ATEOF - -$at_traceoff -echo "calc.at:596: \$PREPARSER ./calc input" -echo calc.at:596 >$at_check_line_file -( $at_traceon; $PREPARSER ./calc input ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo stderr:; tee stderr <$at_stderr -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:596: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - - -# Normalize the observed and expected error messages, depending upon the -# options. -# 1. Remove the traces from observed. -sed '/^Starting/d -/^Entering/d -/^Stack/d -/^Reading/d -/^Reducing/d -/^Shifting/d -/^state/d -/^Error:/d -/^Next/d -/^Discarding/d -/^yydestructor:/d' stderr >at-stderr -mv at-stderr stderr -# 2. Create the reference error message. -cat >expout <<'_ATEOF' -1.1: syntax error, unexpected ')', expecting "number" or '-' or '(' or '!' -1.17: syntax error, unexpected ')', expecting "number" or '-' or '(' or '!' -1.22: syntax error, unexpected '*', expecting "number" or '-' or '(' or '!' -1.40: syntax error, unexpected '*', expecting "number" or '-' or '(' or '!' -calc: error: 4444 != 1 -_ATEOF - -# 3. If locations are not used, remove them. - -# 4. If error-verbose is not used, strip the`, unexpected....' part. - -# 5. Check -$at_traceoff -echo "calc.at:596: cat stderr" -echo calc.at:596 >$at_check_line_file -( $at_traceon; cat stderr ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -$at_diff expout $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:596: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - - -# The same, but this time exercising explicitly triggered syntax errors. -# POSIX says the lookahead causing the error should not be discarded. -cat >input <<'_ATEOF' -(!) + (0 0) = 1 -_ATEOF - -$at_traceoff -echo "calc.at:596: \$PREPARSER ./calc input" -echo calc.at:596 >$at_check_line_file -( $at_traceon; $PREPARSER ./calc input ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo stderr:; tee stderr <$at_stderr -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:596: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - - -# Normalize the observed and expected error messages, depending upon the -# options. -# 1. Remove the traces from observed. -sed '/^Starting/d -/^Entering/d -/^Stack/d -/^Reading/d -/^Reducing/d -/^Shifting/d -/^state/d -/^Error:/d -/^Next/d -/^Discarding/d -/^yydestructor:/d' stderr >at-stderr -mv at-stderr stderr -# 2. Create the reference error message. -cat >expout <<'_ATEOF' -1.9: syntax error, unexpected "number" -calc: error: 2222 != 1 -_ATEOF - -# 3. If locations are not used, remove them. - -# 4. If error-verbose is not used, strip the`, unexpected....' part. - -# 5. Check -$at_traceoff -echo "calc.at:596: cat stderr" -echo calc.at:596 >$at_check_line_file -( $at_traceon; cat stderr ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -$at_diff expout $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:596: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - -cat >input <<'_ATEOF' -(- *) + (0 0) = 1 -_ATEOF - -$at_traceoff -echo "calc.at:596: \$PREPARSER ./calc input" -echo calc.at:596 >$at_check_line_file -( $at_traceon; $PREPARSER ./calc input ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo stderr:; tee stderr <$at_stderr -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:596: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - - -# Normalize the observed and expected error messages, depending upon the -# options. -# 1. Remove the traces from observed. -sed '/^Starting/d -/^Entering/d -/^Stack/d -/^Reading/d -/^Reducing/d -/^Shifting/d -/^state/d -/^Error:/d -/^Next/d -/^Discarding/d -/^yydestructor:/d' stderr >at-stderr -mv at-stderr stderr -# 2. Create the reference error message. -cat >expout <<'_ATEOF' -1.3: syntax error, unexpected '*', expecting "number" or '-' or '(' or '!' -1.11: syntax error, unexpected "number" -calc: error: 2222 != 1 -_ATEOF - -# 3. If locations are not used, remove them. - -# 4. If error-verbose is not used, strip the`, unexpected....' part. - -# 5. Check -$at_traceoff -echo "calc.at:596: cat stderr" -echo calc.at:596 >$at_check_line_file -( $at_traceon; cat stderr ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -$at_diff expout $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:596: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - - - - - - - - - - - - - - - - - - - - - $at_traceoff - $at_times_p && times >$at_times_file - ) 5>&1 2>&1 | eval $at_tee_pipe - at_status=`cat $at_status_file` - ;; - - - banner-11 ) # Banner 11. calc.at:603 - cat <<\_ATEOF - -Simple LALR1 C++ Calculator. - -_ATEOF - ;; - - 84 ) # 84. calc.at:614: Calculator %skeleton "lalr1.cc" %defines %locations - at_setup_line='calc.at:614' - at_desc='Calculator %skeleton "lalr1.cc" %defines %locations' - $at_quiet $ECHO_N " 84: Calculator %skeleton "lalr1.cc" %defines %locations$ECHO_C" - at_xfail=no - ( - echo "84. calc.at:614: testing ..." - $at_traceon - - - - - - -# Using yacc.c? - - - - - - - -# yyerror receives the location if %location & %pure & (%glr or %parse-param). - -# yyerror always sees the locations (when activated), except if -# yacc & pure & !param. - - -# The interface is pure: either because %pure-parser, or because we -# are using the C++ parsers. - - - - - - - - - - - - -cat >calc.y <<'_ATEOF' -%{ -#if HAVE_CONFIG_H -# include - /* We don't need perfect functions for these tests. */ -# undef malloc -# undef memcmp -# undef realloc -#endif -%} - -/* Infix notation calculator--calc */ -%skeleton "lalr1.cc" %defines %locations -%{ -#include - -#include -#include -#if HAVE_UNISTD_H -# include -#else -# undef alarm -# define alarm(seconds) /* empty */ -#endif -#include - -/* Exercise pre-prologue dependency to %union. */ -typedef int semantic_value; - -static semantic_value global_result = 0; -static int global_count = 0; -%} - -/* Exercise %union. */ -%union -{ - semantic_value ival; -}; - -%{ -static int power (int base, int exponent); -typedef yy::Location YYLTYPE; -static int yylex (YYSTYPE *yylval, YYLTYPE *yylloc); -static int yygetc (YYSTYPE *yylval, YYLTYPE *yylloc); -static void yyungetc (YYSTYPE *yylval, YYLTYPE *yylloc, int c); -%} - -/* Bison Declarations */ -%token CALC_EOF 0 "end of input" -%token NUM "number" -%type exp - -%nonassoc '=' /* comparison */ -%left '-' '+' -%left '*' '/' -%left NEG /* negation--unary minus */ -%right '^' /* exponentiation */ - -/* Grammar follows */ -%% -input: - line -| input line { } -; - -line: - '\n' -| exp '\n' { } -; - -exp: - NUM { $$ = $1; } -| exp '=' exp - { - if ($1 != $3) - fprintf (stderr, "calc: error: %d != %d\n", $1, $3); - $$ = $1; - } -| exp '+' exp { $$ = $1 + $3; } -| exp '-' exp { $$ = $1 - $3; } -| exp '*' exp { $$ = $1 * $3; } -| exp '/' exp { $$ = $1 / $3; } -| '-' exp %prec NEG { $$ = -$2; } -| exp '^' exp { $$ = power ($1, $3); } -| '(' exp ')' { $$ = $2; } -| '(' error ')' { $$ = 1111; } -| '!' { YYERROR; } -| '-' error { YYERROR; } -; -%% -/* The input. */ -static FILE *yyin; - -/* Currently, print_ is required in C++. */ -void -yy::Parser::print_ () -{ - - std::cerr << location; -} - -/* A C++ error reporting function. */ -void -yy::Parser::error_ () -{ - std::cerr << location << ": " << message << std::endl; -} - -int -yyparse () -{ - yy::Parser parser (!!YYDEBUG, yy::Location::Location ()); - return parser.parse (); -} - - - - -static YYLTYPE last_yylloc; - -static int -yygetc (YYSTYPE *yylval, YYLTYPE *yylloc) -{ - int res = getc (yyin); - (void) yylval;(void) yylloc; - - last_yylloc = (*yylloc); - if (res == '\n') - { - (*yylloc).end.line++; - (*yylloc).end.column = 0; - } - else - (*yylloc).end.column++; - - return res; -} - - -static void -yyungetc (YYSTYPE *yylval, YYLTYPE *yylloc, int c) -{ - (void) yylval;(void) yylloc; - - /* Wrong when C == `\n'. */ - (*yylloc) = last_yylloc; - - ungetc (c, yyin); -} - -static int -read_signed_integer (YYSTYPE *yylval, YYLTYPE *yylloc) -{ - int c = yygetc (yylval, yylloc); - int sign = 1; - int n = 0; - - (void) yylval;(void) yylloc; - if (c == '-') - { - c = yygetc (yylval, yylloc); - sign = -1; - } - - while (isdigit (c)) - { - n = 10 * n + (c - '0'); - c = yygetc (yylval, yylloc); - } - - yyungetc (yylval, yylloc, c); - - return sign * n; -} - - - -/*---------------------------------------------------------------. -| Lexical analyzer returns an integer on the stack and the token | -| NUM, or the ASCII character read if not a number. Skips all | -| blanks and tabs, returns 0 for EOF. | -`---------------------------------------------------------------*/ - -static int -yylex (YYSTYPE *yylval, YYLTYPE *yylloc) -{ - static int init = 1; - int c; - - if (init) - { - init = 0; - - } - - (*yylloc).begin = (*yylloc).end; - - /* Skip white space. */ - while ((c = yygetc (yylval, yylloc)) == ' ' || c == '\t') - { - (*yylloc).begin = (*yylloc).end; - } - - /* process numbers */ - if (c == '.' || isdigit (c)) - { - yyungetc (yylval, yylloc, c); - (*yylval).ival = read_signed_integer (yylval, yylloc); - return NUM; - } - - /* Return end-of-file. */ - if (c == EOF) - return CALC_EOF; - - /* Return single chars. */ - return c; -} - -static int -power (int base, int exponent) -{ - int res = 1; - if (exponent < 0) - exit (1); - for (/* Niente */; exponent; --exponent) - res *= base; - return res; -} - - -int -main (int argc, const char **argv) -{ - semantic_value result = 0; - int count = 0; - int status; - - alarm (10); - if (argc == 2) - yyin = fopen (argv[1], "r"); - else - yyin = stdin; - - if (!yyin) - { - perror (argv[1]); - exit (1); - } - - - status = yyparse (); - if (global_result != result) - abort (); - if (global_count != count) - abort (); - return status; -} -_ATEOF - - - - - -# Specify the output files to avoid problems on different file systems. -$at_traceoff -echo "calc.at:614: bison -o calc.c calc.y" -echo calc.at:614 >$at_check_line_file -( $at_traceon; bison -o calc.c calc.y ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:614: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - - -$at_traceoff -echo "calc.at:614: \$CXX --version || exit 77" -echo calc.at:614 >$at_check_line_file -( $at_traceon; $CXX --version || exit 77 ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo stderr:; cat $at_stderr -echo stdout:; cat $at_stdout -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:614: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - -$at_traceoff -echo "calc.at:614: \$CXX \$CXXFLAGS \$CPPFLAGS calc.c -o calc" -echo calc.at:614 >$at_check_line_file -( $at_traceon; $CXX $CXXFLAGS $CPPFLAGS calc.c -o calc ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo stderr:; cat $at_stderr -echo stdout:; cat $at_stdout -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:614: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - -# Test the priorities. -cat >input <<'_ATEOF' -1 + 2 * 3 = 7 -1 + 2 * -3 = -5 - --1^2 = -1 -(-1)^2 = 1 - ----1 = -1 - -1 - 2 - 3 = -4 -1 - (2 - 3) = 2 - -2^2^3 = 256 -(2^2)^3 = 64 -_ATEOF - -$at_traceoff -echo "calc.at:614: \$PREPARSER ./calc input" -echo calc.at:614 >$at_check_line_file -( $at_traceon; $PREPARSER ./calc input ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo stderr:; tee stderr <$at_stderr -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:614: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - - - -# Some syntax errors. -cat >input <<'_ATEOF' -0 0 -_ATEOF - -$at_traceoff -echo "calc.at:614: \$PREPARSER ./calc input" -echo calc.at:614 >$at_check_line_file -( $at_traceon; $PREPARSER ./calc input ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo stderr:; tee stderr <$at_stderr -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 1) ;; - *) echo "calc.at:614: exit code was $at_status, expected 1" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - - -# Normalize the observed and expected error messages, depending upon the -# options. -# 1. Remove the traces from observed. -sed '/^Starting/d -/^Entering/d -/^Stack/d -/^Reading/d -/^Reducing/d -/^Shifting/d -/^state/d -/^Error:/d -/^Next/d -/^Discarding/d -/^yydestructor:/d' stderr >at-stderr -mv at-stderr stderr -# 2. Create the reference error message. -cat >expout <<'_ATEOF' -1.2: syntax error, unexpected "number" -_ATEOF - -# 3. If locations are not used, remove them. - -# 4. If error-verbose is not used, strip the`, unexpected....' part. -sed 's/syntax error, .*$/syntax error/' expout >at-expout -mv at-expout expout -# 5. Check -$at_traceoff -echo "calc.at:614: cat stderr" -echo calc.at:614 >$at_check_line_file -( $at_traceon; cat stderr ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -$at_diff expout $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:614: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - -cat >input <<'_ATEOF' -1//2 -_ATEOF - -$at_traceoff -echo "calc.at:614: \$PREPARSER ./calc input" -echo calc.at:614 >$at_check_line_file -( $at_traceon; $PREPARSER ./calc input ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo stderr:; tee stderr <$at_stderr -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 1) ;; - *) echo "calc.at:614: exit code was $at_status, expected 1" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - - -# Normalize the observed and expected error messages, depending upon the -# options. -# 1. Remove the traces from observed. -sed '/^Starting/d -/^Entering/d -/^Stack/d -/^Reading/d -/^Reducing/d -/^Shifting/d -/^state/d -/^Error:/d -/^Next/d -/^Discarding/d -/^yydestructor:/d' stderr >at-stderr -mv at-stderr stderr -# 2. Create the reference error message. -cat >expout <<'_ATEOF' -1.2: syntax error, unexpected '/', expecting "number" or '-' or '(' or '!' -_ATEOF - -# 3. If locations are not used, remove them. - -# 4. If error-verbose is not used, strip the`, unexpected....' part. -sed 's/syntax error, .*$/syntax error/' expout >at-expout -mv at-expout expout -# 5. Check -$at_traceoff -echo "calc.at:614: cat stderr" -echo calc.at:614 >$at_check_line_file -( $at_traceon; cat stderr ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -$at_diff expout $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:614: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - -cat >input <<'_ATEOF' -error -_ATEOF - -$at_traceoff -echo "calc.at:614: \$PREPARSER ./calc input" -echo calc.at:614 >$at_check_line_file -( $at_traceon; $PREPARSER ./calc input ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo stderr:; tee stderr <$at_stderr -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 1) ;; - *) echo "calc.at:614: exit code was $at_status, expected 1" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - - -# Normalize the observed and expected error messages, depending upon the -# options. -# 1. Remove the traces from observed. -sed '/^Starting/d -/^Entering/d -/^Stack/d -/^Reading/d -/^Reducing/d -/^Shifting/d -/^state/d -/^Error:/d -/^Next/d -/^Discarding/d -/^yydestructor:/d' stderr >at-stderr -mv at-stderr stderr -# 2. Create the reference error message. -cat >expout <<'_ATEOF' -1.0: syntax error, unexpected $undefined -_ATEOF - -# 3. If locations are not used, remove them. - -# 4. If error-verbose is not used, strip the`, unexpected....' part. -sed 's/syntax error, .*$/syntax error/' expout >at-expout -mv at-expout expout -# 5. Check -$at_traceoff -echo "calc.at:614: cat stderr" -echo calc.at:614 >$at_check_line_file -( $at_traceon; cat stderr ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -$at_diff expout $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:614: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - -cat >input <<'_ATEOF' -1 = 2 = 3 -_ATEOF - -$at_traceoff -echo "calc.at:614: \$PREPARSER ./calc input" -echo calc.at:614 >$at_check_line_file -( $at_traceon; $PREPARSER ./calc input ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo stderr:; tee stderr <$at_stderr -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 1) ;; - *) echo "calc.at:614: exit code was $at_status, expected 1" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - - -# Normalize the observed and expected error messages, depending upon the -# options. -# 1. Remove the traces from observed. -sed '/^Starting/d -/^Entering/d -/^Stack/d -/^Reading/d -/^Reducing/d -/^Shifting/d -/^state/d -/^Error:/d -/^Next/d -/^Discarding/d -/^yydestructor:/d' stderr >at-stderr -mv at-stderr stderr -# 2. Create the reference error message. -cat >expout <<'_ATEOF' -1.6: syntax error, unexpected '=' -_ATEOF - -# 3. If locations are not used, remove them. - -# 4. If error-verbose is not used, strip the`, unexpected....' part. -sed 's/syntax error, .*$/syntax error/' expout >at-expout -mv at-expout expout -# 5. Check -$at_traceoff -echo "calc.at:614: cat stderr" -echo calc.at:614 >$at_check_line_file -( $at_traceon; cat stderr ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -$at_diff expout $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:614: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - -cat >input <<'_ATEOF' - -+1 -_ATEOF - -$at_traceoff -echo "calc.at:614: \$PREPARSER ./calc input" -echo calc.at:614 >$at_check_line_file -( $at_traceon; $PREPARSER ./calc input ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo stderr:; tee stderr <$at_stderr -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 1) ;; - *) echo "calc.at:614: exit code was $at_status, expected 1" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - - -# Normalize the observed and expected error messages, depending upon the -# options. -# 1. Remove the traces from observed. -sed '/^Starting/d -/^Entering/d -/^Stack/d -/^Reading/d -/^Reducing/d -/^Shifting/d -/^state/d -/^Error:/d -/^Next/d -/^Discarding/d -/^yydestructor:/d' stderr >at-stderr -mv at-stderr stderr -# 2. Create the reference error message. -cat >expout <<'_ATEOF' -2.0: syntax error, unexpected '+' -_ATEOF - -# 3. If locations are not used, remove them. - -# 4. If error-verbose is not used, strip the`, unexpected....' part. -sed 's/syntax error, .*$/syntax error/' expout >at-expout -mv at-expout expout -# 5. Check -$at_traceoff -echo "calc.at:614: cat stderr" -echo calc.at:614 >$at_check_line_file -( $at_traceon; cat stderr ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -$at_diff expout $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:614: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - -# Exercise error messages with EOF: work on an empty file. -$at_traceoff -echo "calc.at:614: \$PREPARSER ./calc /dev/null" -echo calc.at:614 >$at_check_line_file -( $at_traceon; $PREPARSER ./calc /dev/null ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo stderr:; tee stderr <$at_stderr -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 1) ;; - *) echo "calc.at:614: exit code was $at_status, expected 1" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - - -# Normalize the observed and expected error messages, depending upon the -# options. -# 1. Remove the traces from observed. -sed '/^Starting/d -/^Entering/d -/^Stack/d -/^Reading/d -/^Reducing/d -/^Shifting/d -/^state/d -/^Error:/d -/^Next/d -/^Discarding/d -/^yydestructor:/d' stderr >at-stderr -mv at-stderr stderr -# 2. Create the reference error message. -cat >expout <<'_ATEOF' -1.0: syntax error, unexpected "end of input" -_ATEOF - -# 3. If locations are not used, remove them. - -# 4. If error-verbose is not used, strip the`, unexpected....' part. -sed 's/syntax error, .*$/syntax error/' expout >at-expout -mv at-expout expout -# 5. Check -$at_traceoff -echo "calc.at:614: cat stderr" -echo calc.at:614 >$at_check_line_file -( $at_traceon; cat stderr ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -$at_diff expout $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:614: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - - -# Exercise the error token: without it, we die at the first error, -# hence be sure to -# -# - have several errors which exercise different shift/discardings -# - (): nothing to pop, nothing to discard -# - (1 + 1 + 1 +): a lot to pop, nothing to discard -# - (* * *): nothing to pop, a lot to discard -# - (1 + 2 * *): some to pop and discard -# -# - test the action associated to `error' -# -# - check the lookahead that triggers an error is not discarded -# when we enter error recovery. Below, the lookahead causing the -# first error is ")", which is needed to recover from the error and -# produce the "0" that triggers the "0 != 1" error. -# -cat >input <<'_ATEOF' -() + (1 + 1 + 1 +) + (* * *) + (1 * 2 * *) = 1 -_ATEOF - -$at_traceoff -echo "calc.at:614: \$PREPARSER ./calc input" -echo calc.at:614 >$at_check_line_file -( $at_traceon; $PREPARSER ./calc input ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo stderr:; tee stderr <$at_stderr -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:614: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - - -# Normalize the observed and expected error messages, depending upon the -# options. -# 1. Remove the traces from observed. -sed '/^Starting/d -/^Entering/d -/^Stack/d -/^Reading/d -/^Reducing/d -/^Shifting/d -/^state/d -/^Error:/d -/^Next/d -/^Discarding/d -/^yydestructor:/d' stderr >at-stderr -mv at-stderr stderr -# 2. Create the reference error message. -cat >expout <<'_ATEOF' -1.1: syntax error, unexpected ')', expecting "number" or '-' or '(' or '!' -1.17: syntax error, unexpected ')', expecting "number" or '-' or '(' or '!' -1.22: syntax error, unexpected '*', expecting "number" or '-' or '(' or '!' -1.40: syntax error, unexpected '*', expecting "number" or '-' or '(' or '!' -calc: error: 4444 != 1 -_ATEOF - -# 3. If locations are not used, remove them. - -# 4. If error-verbose is not used, strip the`, unexpected....' part. -sed 's/syntax error, .*$/syntax error/' expout >at-expout -mv at-expout expout -# 5. Check -$at_traceoff -echo "calc.at:614: cat stderr" -echo calc.at:614 >$at_check_line_file -( $at_traceon; cat stderr ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -$at_diff expout $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:614: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - - -# The same, but this time exercising explicitly triggered syntax errors. -# POSIX says the lookahead causing the error should not be discarded. -cat >input <<'_ATEOF' -(!) + (0 0) = 1 -_ATEOF - -$at_traceoff -echo "calc.at:614: \$PREPARSER ./calc input" -echo calc.at:614 >$at_check_line_file -( $at_traceon; $PREPARSER ./calc input ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo stderr:; tee stderr <$at_stderr -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:614: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - - -# Normalize the observed and expected error messages, depending upon the -# options. -# 1. Remove the traces from observed. -sed '/^Starting/d -/^Entering/d -/^Stack/d -/^Reading/d -/^Reducing/d -/^Shifting/d -/^state/d -/^Error:/d -/^Next/d -/^Discarding/d -/^yydestructor:/d' stderr >at-stderr -mv at-stderr stderr -# 2. Create the reference error message. -cat >expout <<'_ATEOF' -1.9: syntax error, unexpected "number" -calc: error: 2222 != 1 -_ATEOF - -# 3. If locations are not used, remove them. - -# 4. If error-verbose is not used, strip the`, unexpected....' part. -sed 's/syntax error, .*$/syntax error/' expout >at-expout -mv at-expout expout -# 5. Check -$at_traceoff -echo "calc.at:614: cat stderr" -echo calc.at:614 >$at_check_line_file -( $at_traceon; cat stderr ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -$at_diff expout $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:614: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - -cat >input <<'_ATEOF' -(- *) + (0 0) = 1 -_ATEOF - -$at_traceoff -echo "calc.at:614: \$PREPARSER ./calc input" -echo calc.at:614 >$at_check_line_file -( $at_traceon; $PREPARSER ./calc input ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo stderr:; tee stderr <$at_stderr -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:614: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - - -# Normalize the observed and expected error messages, depending upon the -# options. -# 1. Remove the traces from observed. -sed '/^Starting/d -/^Entering/d -/^Stack/d -/^Reading/d -/^Reducing/d -/^Shifting/d -/^state/d -/^Error:/d -/^Next/d -/^Discarding/d -/^yydestructor:/d' stderr >at-stderr -mv at-stderr stderr -# 2. Create the reference error message. -cat >expout <<'_ATEOF' -1.3: syntax error, unexpected '*', expecting "number" or '-' or '(' or '!' -1.11: syntax error, unexpected "number" -calc: error: 2222 != 1 -_ATEOF - -# 3. If locations are not used, remove them. - -# 4. If error-verbose is not used, strip the`, unexpected....' part. -sed 's/syntax error, .*$/syntax error/' expout >at-expout -mv at-expout expout -# 5. Check -$at_traceoff -echo "calc.at:614: cat stderr" -echo calc.at:614 >$at_check_line_file -( $at_traceon; cat stderr ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -$at_diff expout $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:614: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - - - - - - - - - - - - - - - - - - - - - $at_traceoff - $at_times_p && times >$at_times_file - ) 5>&1 2>&1 | eval $at_tee_pipe - at_status=`cat $at_status_file` - ;; - - 85 ) # 85. calc.at:616: Calculator %skeleton "lalr1.cc" %defines - at_setup_line='calc.at:616' - at_desc='Calculator %skeleton "lalr1.cc" %defines' - $at_quiet $ECHO_N " 85: Calculator %skeleton "lalr1.cc" %defines $ECHO_C" - at_xfail=no - ( - echo "85. calc.at:616: testing ..." - $at_traceon - - - - - - -# Using yacc.c? - - - - - - - -# yyerror receives the location if %location & %pure & (%glr or %parse-param). - -# yyerror always sees the locations (when activated), except if -# yacc & pure & !param. - - -# The interface is pure: either because %pure-parser, or because we -# are using the C++ parsers. - - - - - - - - - - - - -cat >calc.y <<'_ATEOF' -%{ -#if HAVE_CONFIG_H -# include - /* We don't need perfect functions for these tests. */ -# undef malloc -# undef memcmp -# undef realloc -#endif -%} - -/* Infix notation calculator--calc */ -%skeleton "lalr1.cc" %defines -%{ -#include - -#include -#include -#if HAVE_UNISTD_H -# include -#else -# undef alarm -# define alarm(seconds) /* empty */ -#endif -#include - -/* Exercise pre-prologue dependency to %union. */ -typedef int semantic_value; - -static semantic_value global_result = 0; -static int global_count = 0; -%} - -/* Exercise %union. */ -%union -{ - semantic_value ival; -}; - -%{ -static int power (int base, int exponent); -typedef yy::Location YYLTYPE; -static int yylex (YYSTYPE *yylval); -static int yygetc (YYSTYPE *yylval); -static void yyungetc (YYSTYPE *yylval, int c); -%} - -/* Bison Declarations */ -%token CALC_EOF 0 "end of input" -%token NUM "number" -%type exp - -%nonassoc '=' /* comparison */ -%left '-' '+' -%left '*' '/' -%left NEG /* negation--unary minus */ -%right '^' /* exponentiation */ - -/* Grammar follows */ -%% -input: - line -| input line { } -; - -line: - '\n' -| exp '\n' { } -; - -exp: - NUM { $$ = $1; } -| exp '=' exp - { - if ($1 != $3) - fprintf (stderr, "calc: error: %d != %d\n", $1, $3); - $$ = $1; - } -| exp '+' exp { $$ = $1 + $3; } -| exp '-' exp { $$ = $1 - $3; } -| exp '*' exp { $$ = $1 * $3; } -| exp '/' exp { $$ = $1 / $3; } -| '-' exp %prec NEG { $$ = -$2; } -| exp '^' exp { $$ = power ($1, $3); } -| '(' exp ')' { $$ = $2; } -| '(' error ')' { $$ = 1111; } -| '!' { YYERROR; } -| '-' error { YYERROR; } -; -%% -/* The input. */ -static FILE *yyin; - -/* Currently, print_ is required in C++. */ -void -yy::Parser::print_ () -{ - -} - -/* A C++ error reporting function. */ -void -yy::Parser::error_ () -{ - std::cerr << message << std::endl; -} - -int -yyparse () -{ - yy::Parser parser (!!YYDEBUG); - return parser.parse (); -} - - - - -static int -yygetc (YYSTYPE *yylval) -{ - int res = getc (yyin); - (void) yylval;; - - return res; -} - - -static void -yyungetc (YYSTYPE *yylval, int c) -{ - (void) yylval;; - - ungetc (c, yyin); -} - -static int -read_signed_integer (YYSTYPE *yylval) -{ - int c = yygetc (yylval); - int sign = 1; - int n = 0; - - (void) yylval;; - if (c == '-') - { - c = yygetc (yylval); - sign = -1; - } - - while (isdigit (c)) - { - n = 10 * n + (c - '0'); - c = yygetc (yylval); - } - - yyungetc (yylval, c); - - return sign * n; -} - - - -/*---------------------------------------------------------------. -| Lexical analyzer returns an integer on the stack and the token | -| NUM, or the ASCII character read if not a number. Skips all | -| blanks and tabs, returns 0 for EOF. | -`---------------------------------------------------------------*/ - -static int -yylex (YYSTYPE *yylval) -{ - static int init = 1; - int c; - - if (init) - { - init = 0; - - } - - - - /* Skip white space. */ - while ((c = yygetc (yylval)) == ' ' || c == '\t') - { - - } - - /* process numbers */ - if (c == '.' || isdigit (c)) - { - yyungetc (yylval, c); - (*yylval).ival = read_signed_integer (yylval); - return NUM; - } - - /* Return end-of-file. */ - if (c == EOF) - return CALC_EOF; - - /* Return single chars. */ - return c; -} - -static int -power (int base, int exponent) -{ - int res = 1; - if (exponent < 0) - exit (1); - for (/* Niente */; exponent; --exponent) - res *= base; - return res; -} - - -int -main (int argc, const char **argv) -{ - semantic_value result = 0; - int count = 0; - int status; - - alarm (10); - if (argc == 2) - yyin = fopen (argv[1], "r"); - else - yyin = stdin; - - if (!yyin) - { - perror (argv[1]); - exit (1); - } - - - status = yyparse (); - if (global_result != result) - abort (); - if (global_count != count) - abort (); - return status; -} -_ATEOF - - - - - -# Specify the output files to avoid problems on different file systems. -$at_traceoff -echo "calc.at:616: bison -o calc.c calc.y" -echo calc.at:616 >$at_check_line_file -( $at_traceon; bison -o calc.c calc.y ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:616: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - - -$at_traceoff -echo "calc.at:616: \$CXX --version || exit 77" -echo calc.at:616 >$at_check_line_file -( $at_traceon; $CXX --version || exit 77 ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo stderr:; cat $at_stderr -echo stdout:; cat $at_stdout -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:616: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - -$at_traceoff -echo "calc.at:616: \$CXX \$CXXFLAGS \$CPPFLAGS calc.c -o calc" -echo calc.at:616 >$at_check_line_file -( $at_traceon; $CXX $CXXFLAGS $CPPFLAGS calc.c -o calc ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo stderr:; cat $at_stderr -echo stdout:; cat $at_stdout -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:616: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - -# Test the priorities. -cat >input <<'_ATEOF' -1 + 2 * 3 = 7 -1 + 2 * -3 = -5 - --1^2 = -1 -(-1)^2 = 1 - ----1 = -1 - -1 - 2 - 3 = -4 -1 - (2 - 3) = 2 - -2^2^3 = 256 -(2^2)^3 = 64 -_ATEOF - -$at_traceoff -echo "calc.at:616: \$PREPARSER ./calc input" -echo calc.at:616 >$at_check_line_file -( $at_traceon; $PREPARSER ./calc input ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo stderr:; tee stderr <$at_stderr -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:616: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - - - -# Some syntax errors. -cat >input <<'_ATEOF' -0 0 -_ATEOF - -$at_traceoff -echo "calc.at:616: \$PREPARSER ./calc input" -echo calc.at:616 >$at_check_line_file -( $at_traceon; $PREPARSER ./calc input ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo stderr:; tee stderr <$at_stderr -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 1) ;; - *) echo "calc.at:616: exit code was $at_status, expected 1" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - - -# Normalize the observed and expected error messages, depending upon the -# options. -# 1. Remove the traces from observed. -sed '/^Starting/d -/^Entering/d -/^Stack/d -/^Reading/d -/^Reducing/d -/^Shifting/d -/^state/d -/^Error:/d -/^Next/d -/^Discarding/d -/^yydestructor:/d' stderr >at-stderr -mv at-stderr stderr -# 2. Create the reference error message. -cat >expout <<'_ATEOF' -1.2: syntax error, unexpected "number" -_ATEOF - -# 3. If locations are not used, remove them. -sed 's/^[-0-9.]*: //' expout >at-expout -mv at-expout expout -# 4. If error-verbose is not used, strip the`, unexpected....' part. -sed 's/syntax error, .*$/syntax error/' expout >at-expout -mv at-expout expout -# 5. Check -$at_traceoff -echo "calc.at:616: cat stderr" -echo calc.at:616 >$at_check_line_file -( $at_traceon; cat stderr ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -$at_diff expout $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:616: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - -cat >input <<'_ATEOF' -1//2 -_ATEOF - -$at_traceoff -echo "calc.at:616: \$PREPARSER ./calc input" -echo calc.at:616 >$at_check_line_file -( $at_traceon; $PREPARSER ./calc input ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo stderr:; tee stderr <$at_stderr -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 1) ;; - *) echo "calc.at:616: exit code was $at_status, expected 1" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - - -# Normalize the observed and expected error messages, depending upon the -# options. -# 1. Remove the traces from observed. -sed '/^Starting/d -/^Entering/d -/^Stack/d -/^Reading/d -/^Reducing/d -/^Shifting/d -/^state/d -/^Error:/d -/^Next/d -/^Discarding/d -/^yydestructor:/d' stderr >at-stderr -mv at-stderr stderr -# 2. Create the reference error message. -cat >expout <<'_ATEOF' -1.2: syntax error, unexpected '/', expecting "number" or '-' or '(' or '!' -_ATEOF - -# 3. If locations are not used, remove them. -sed 's/^[-0-9.]*: //' expout >at-expout -mv at-expout expout -# 4. If error-verbose is not used, strip the`, unexpected....' part. -sed 's/syntax error, .*$/syntax error/' expout >at-expout -mv at-expout expout -# 5. Check -$at_traceoff -echo "calc.at:616: cat stderr" -echo calc.at:616 >$at_check_line_file -( $at_traceon; cat stderr ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -$at_diff expout $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:616: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - -cat >input <<'_ATEOF' -error -_ATEOF - -$at_traceoff -echo "calc.at:616: \$PREPARSER ./calc input" -echo calc.at:616 >$at_check_line_file -( $at_traceon; $PREPARSER ./calc input ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo stderr:; tee stderr <$at_stderr -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 1) ;; - *) echo "calc.at:616: exit code was $at_status, expected 1" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - - -# Normalize the observed and expected error messages, depending upon the -# options. -# 1. Remove the traces from observed. -sed '/^Starting/d -/^Entering/d -/^Stack/d -/^Reading/d -/^Reducing/d -/^Shifting/d -/^state/d -/^Error:/d -/^Next/d -/^Discarding/d -/^yydestructor:/d' stderr >at-stderr -mv at-stderr stderr -# 2. Create the reference error message. -cat >expout <<'_ATEOF' -1.0: syntax error, unexpected $undefined -_ATEOF - -# 3. If locations are not used, remove them. -sed 's/^[-0-9.]*: //' expout >at-expout -mv at-expout expout -# 4. If error-verbose is not used, strip the`, unexpected....' part. -sed 's/syntax error, .*$/syntax error/' expout >at-expout -mv at-expout expout -# 5. Check -$at_traceoff -echo "calc.at:616: cat stderr" -echo calc.at:616 >$at_check_line_file -( $at_traceon; cat stderr ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -$at_diff expout $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:616: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - -cat >input <<'_ATEOF' -1 = 2 = 3 -_ATEOF - -$at_traceoff -echo "calc.at:616: \$PREPARSER ./calc input" -echo calc.at:616 >$at_check_line_file -( $at_traceon; $PREPARSER ./calc input ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo stderr:; tee stderr <$at_stderr -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 1) ;; - *) echo "calc.at:616: exit code was $at_status, expected 1" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - - -# Normalize the observed and expected error messages, depending upon the -# options. -# 1. Remove the traces from observed. -sed '/^Starting/d -/^Entering/d -/^Stack/d -/^Reading/d -/^Reducing/d -/^Shifting/d -/^state/d -/^Error:/d -/^Next/d -/^Discarding/d -/^yydestructor:/d' stderr >at-stderr -mv at-stderr stderr -# 2. Create the reference error message. -cat >expout <<'_ATEOF' -1.6: syntax error, unexpected '=' -_ATEOF - -# 3. If locations are not used, remove them. -sed 's/^[-0-9.]*: //' expout >at-expout -mv at-expout expout -# 4. If error-verbose is not used, strip the`, unexpected....' part. -sed 's/syntax error, .*$/syntax error/' expout >at-expout -mv at-expout expout -# 5. Check -$at_traceoff -echo "calc.at:616: cat stderr" -echo calc.at:616 >$at_check_line_file -( $at_traceon; cat stderr ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -$at_diff expout $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:616: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - -cat >input <<'_ATEOF' - -+1 -_ATEOF - -$at_traceoff -echo "calc.at:616: \$PREPARSER ./calc input" -echo calc.at:616 >$at_check_line_file -( $at_traceon; $PREPARSER ./calc input ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo stderr:; tee stderr <$at_stderr -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 1) ;; - *) echo "calc.at:616: exit code was $at_status, expected 1" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - - -# Normalize the observed and expected error messages, depending upon the -# options. -# 1. Remove the traces from observed. -sed '/^Starting/d -/^Entering/d -/^Stack/d -/^Reading/d -/^Reducing/d -/^Shifting/d -/^state/d -/^Error:/d -/^Next/d -/^Discarding/d -/^yydestructor:/d' stderr >at-stderr -mv at-stderr stderr -# 2. Create the reference error message. -cat >expout <<'_ATEOF' -2.0: syntax error, unexpected '+' -_ATEOF - -# 3. If locations are not used, remove them. -sed 's/^[-0-9.]*: //' expout >at-expout -mv at-expout expout -# 4. If error-verbose is not used, strip the`, unexpected....' part. -sed 's/syntax error, .*$/syntax error/' expout >at-expout -mv at-expout expout -# 5. Check -$at_traceoff -echo "calc.at:616: cat stderr" -echo calc.at:616 >$at_check_line_file -( $at_traceon; cat stderr ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -$at_diff expout $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:616: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - -# Exercise error messages with EOF: work on an empty file. -$at_traceoff -echo "calc.at:616: \$PREPARSER ./calc /dev/null" -echo calc.at:616 >$at_check_line_file -( $at_traceon; $PREPARSER ./calc /dev/null ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo stderr:; tee stderr <$at_stderr -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 1) ;; - *) echo "calc.at:616: exit code was $at_status, expected 1" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - - -# Normalize the observed and expected error messages, depending upon the -# options. -# 1. Remove the traces from observed. -sed '/^Starting/d -/^Entering/d -/^Stack/d -/^Reading/d -/^Reducing/d -/^Shifting/d -/^state/d -/^Error:/d -/^Next/d -/^Discarding/d -/^yydestructor:/d' stderr >at-stderr -mv at-stderr stderr -# 2. Create the reference error message. -cat >expout <<'_ATEOF' -1.0: syntax error, unexpected "end of input" -_ATEOF - -# 3. If locations are not used, remove them. -sed 's/^[-0-9.]*: //' expout >at-expout -mv at-expout expout -# 4. If error-verbose is not used, strip the`, unexpected....' part. -sed 's/syntax error, .*$/syntax error/' expout >at-expout -mv at-expout expout -# 5. Check -$at_traceoff -echo "calc.at:616: cat stderr" -echo calc.at:616 >$at_check_line_file -( $at_traceon; cat stderr ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -$at_diff expout $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:616: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - - -# Exercise the error token: without it, we die at the first error, -# hence be sure to -# -# - have several errors which exercise different shift/discardings -# - (): nothing to pop, nothing to discard -# - (1 + 1 + 1 +): a lot to pop, nothing to discard -# - (* * *): nothing to pop, a lot to discard -# - (1 + 2 * *): some to pop and discard -# -# - test the action associated to `error' -# -# - check the lookahead that triggers an error is not discarded -# when we enter error recovery. Below, the lookahead causing the -# first error is ")", which is needed to recover from the error and -# produce the "0" that triggers the "0 != 1" error. -# -cat >input <<'_ATEOF' -() + (1 + 1 + 1 +) + (* * *) + (1 * 2 * *) = 1 -_ATEOF - -$at_traceoff -echo "calc.at:616: \$PREPARSER ./calc input" -echo calc.at:616 >$at_check_line_file -( $at_traceon; $PREPARSER ./calc input ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo stderr:; tee stderr <$at_stderr -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:616: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - - -# Normalize the observed and expected error messages, depending upon the -# options. -# 1. Remove the traces from observed. -sed '/^Starting/d -/^Entering/d -/^Stack/d -/^Reading/d -/^Reducing/d -/^Shifting/d -/^state/d -/^Error:/d -/^Next/d -/^Discarding/d -/^yydestructor:/d' stderr >at-stderr -mv at-stderr stderr -# 2. Create the reference error message. -cat >expout <<'_ATEOF' -1.1: syntax error, unexpected ')', expecting "number" or '-' or '(' or '!' -1.17: syntax error, unexpected ')', expecting "number" or '-' or '(' or '!' -1.22: syntax error, unexpected '*', expecting "number" or '-' or '(' or '!' -1.40: syntax error, unexpected '*', expecting "number" or '-' or '(' or '!' -calc: error: 4444 != 1 -_ATEOF - -# 3. If locations are not used, remove them. -sed 's/^[-0-9.]*: //' expout >at-expout -mv at-expout expout -# 4. If error-verbose is not used, strip the`, unexpected....' part. -sed 's/syntax error, .*$/syntax error/' expout >at-expout -mv at-expout expout -# 5. Check -$at_traceoff -echo "calc.at:616: cat stderr" -echo calc.at:616 >$at_check_line_file -( $at_traceon; cat stderr ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -$at_diff expout $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:616: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - - -# The same, but this time exercising explicitly triggered syntax errors. -# POSIX says the lookahead causing the error should not be discarded. -cat >input <<'_ATEOF' -(!) + (0 0) = 1 -_ATEOF - -$at_traceoff -echo "calc.at:616: \$PREPARSER ./calc input" -echo calc.at:616 >$at_check_line_file -( $at_traceon; $PREPARSER ./calc input ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo stderr:; tee stderr <$at_stderr -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:616: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - - -# Normalize the observed and expected error messages, depending upon the -# options. -# 1. Remove the traces from observed. -sed '/^Starting/d -/^Entering/d -/^Stack/d -/^Reading/d -/^Reducing/d -/^Shifting/d -/^state/d -/^Error:/d -/^Next/d -/^Discarding/d -/^yydestructor:/d' stderr >at-stderr -mv at-stderr stderr -# 2. Create the reference error message. -cat >expout <<'_ATEOF' -1.9: syntax error, unexpected "number" -calc: error: 2222 != 1 -_ATEOF - -# 3. If locations are not used, remove them. -sed 's/^[-0-9.]*: //' expout >at-expout -mv at-expout expout -# 4. If error-verbose is not used, strip the`, unexpected....' part. -sed 's/syntax error, .*$/syntax error/' expout >at-expout -mv at-expout expout -# 5. Check -$at_traceoff -echo "calc.at:616: cat stderr" -echo calc.at:616 >$at_check_line_file -( $at_traceon; cat stderr ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -$at_diff expout $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:616: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - -cat >input <<'_ATEOF' -(- *) + (0 0) = 1 -_ATEOF - -$at_traceoff -echo "calc.at:616: \$PREPARSER ./calc input" -echo calc.at:616 >$at_check_line_file -( $at_traceon; $PREPARSER ./calc input ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo stderr:; tee stderr <$at_stderr -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:616: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - - -# Normalize the observed and expected error messages, depending upon the -# options. -# 1. Remove the traces from observed. -sed '/^Starting/d -/^Entering/d -/^Stack/d -/^Reading/d -/^Reducing/d -/^Shifting/d -/^state/d -/^Error:/d -/^Next/d -/^Discarding/d -/^yydestructor:/d' stderr >at-stderr -mv at-stderr stderr -# 2. Create the reference error message. -cat >expout <<'_ATEOF' -1.3: syntax error, unexpected '*', expecting "number" or '-' or '(' or '!' -1.11: syntax error, unexpected "number" -calc: error: 2222 != 1 -_ATEOF - -# 3. If locations are not used, remove them. -sed 's/^[-0-9.]*: //' expout >at-expout -mv at-expout expout -# 4. If error-verbose is not used, strip the`, unexpected....' part. -sed 's/syntax error, .*$/syntax error/' expout >at-expout -mv at-expout expout -# 5. Check -$at_traceoff -echo "calc.at:616: cat stderr" -echo calc.at:616 >$at_check_line_file -( $at_traceon; cat stderr ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -$at_diff expout $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:616: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - - - - - - - - - - - - - - - - - - - - - $at_traceoff - $at_times_p && times >$at_times_file - ) 5>&1 2>&1 | eval $at_tee_pipe - at_status=`cat $at_status_file` - ;; - - 86 ) # 86. calc.at:626: Calculator %skeleton "lalr1.cc" %error-verbose %locations %defines %name-prefix="calc" %verbose %yacc - at_setup_line='calc.at:626' - at_desc='Calculator %skeleton "lalr1.cc" %error-verbose %locations %defines %name-prefix="calc" %verbose %yacc' - $at_quiet $ECHO_N " 86: Calculator %skeleton "lalr1.cc" %error-verbose %locations %defines %name-prefix="calc" %verbose %yacc$ECHO_C" - at_xfail=no - ( - echo "86. calc.at:626: testing ..." - $at_traceon - - - - - - -# Using yacc.c? - - - - - - - -# yyerror receives the location if %location & %pure & (%glr or %parse-param). - -# yyerror always sees the locations (when activated), except if -# yacc & pure & !param. - - -# The interface is pure: either because %pure-parser, or because we -# are using the C++ parsers. - - - - - - - - - - - - -cat >calc.y <<'_ATEOF' -%{ -#if HAVE_CONFIG_H -# include - /* We don't need perfect functions for these tests. */ -# undef malloc -# undef memcmp -# undef realloc -#endif -%} - -/* Infix notation calculator--calc */ -%skeleton "lalr1.cc" %error-verbose %locations %defines %name-prefix="calc" %verbose %yacc -%{ -#include - -#include -#include -#if HAVE_UNISTD_H -# include -#else -# undef alarm -# define alarm(seconds) /* empty */ -#endif -#include - -/* Exercise pre-prologue dependency to %union. */ -typedef int semantic_value; - -static semantic_value global_result = 0; -static int global_count = 0; -%} - -/* Exercise %union. */ -%union -{ - semantic_value ival; -}; - -%{ -static int power (int base, int exponent); -typedef yy::Location YYLTYPE; -static int yylex (YYSTYPE *yylval, YYLTYPE *yylloc); -static int yygetc (YYSTYPE *yylval, YYLTYPE *yylloc); -static void yyungetc (YYSTYPE *yylval, YYLTYPE *yylloc, int c); -%} - -/* Bison Declarations */ -%token CALC_EOF 0 "end of input" -%token NUM "number" -%type exp - -%nonassoc '=' /* comparison */ -%left '-' '+' -%left '*' '/' -%left NEG /* negation--unary minus */ -%right '^' /* exponentiation */ - -/* Grammar follows */ -%% -input: - line -| input line { } -; - -line: - '\n' -| exp '\n' { } -; - -exp: - NUM { $$ = $1; } -| exp '=' exp - { - if ($1 != $3) - fprintf (stderr, "calc: error: %d != %d\n", $1, $3); - $$ = $1; - } -| exp '+' exp { $$ = $1 + $3; } -| exp '-' exp { $$ = $1 - $3; } -| exp '*' exp { $$ = $1 * $3; } -| exp '/' exp { $$ = $1 / $3; } -| '-' exp %prec NEG { $$ = -$2; } -| exp '^' exp { $$ = power ($1, $3); } -| '(' exp ')' { $$ = $2; } -| '(' error ')' { $$ = 1111; } -| '!' { YYERROR; } -| '-' error { YYERROR; } -; -%% -/* The input. */ -static FILE *yyin; - -/* Currently, print_ is required in C++. */ -void -yy::Parser::print_ () -{ - - std::cerr << location; -} - -/* A C++ error reporting function. */ -void -yy::Parser::error_ () -{ - std::cerr << location << ": " << message << std::endl; -} - -int -yyparse () -{ - yy::Parser parser (!!YYDEBUG, yy::Location::Location ()); - return parser.parse (); -} - - - - -static YYLTYPE last_yylloc; - -static int -yygetc (YYSTYPE *yylval, YYLTYPE *yylloc) -{ - int res = getc (yyin); - (void) yylval;(void) yylloc; - - last_yylloc = (*yylloc); - if (res == '\n') - { - (*yylloc).end.line++; - (*yylloc).end.column = 0; - } - else - (*yylloc).end.column++; - - return res; -} - - -static void -yyungetc (YYSTYPE *yylval, YYLTYPE *yylloc, int c) -{ - (void) yylval;(void) yylloc; - - /* Wrong when C == `\n'. */ - (*yylloc) = last_yylloc; - - ungetc (c, yyin); -} - -static int -read_signed_integer (YYSTYPE *yylval, YYLTYPE *yylloc) -{ - int c = yygetc (yylval, yylloc); - int sign = 1; - int n = 0; - - (void) yylval;(void) yylloc; - if (c == '-') - { - c = yygetc (yylval, yylloc); - sign = -1; - } - - while (isdigit (c)) - { - n = 10 * n + (c - '0'); - c = yygetc (yylval, yylloc); - } - - yyungetc (yylval, yylloc, c); - - return sign * n; -} - - - -/*---------------------------------------------------------------. -| Lexical analyzer returns an integer on the stack and the token | -| NUM, or the ASCII character read if not a number. Skips all | -| blanks and tabs, returns 0 for EOF. | -`---------------------------------------------------------------*/ - -static int -yylex (YYSTYPE *yylval, YYLTYPE *yylloc) -{ - static int init = 1; - int c; - - if (init) - { - init = 0; - - } - - (*yylloc).begin = (*yylloc).end; - - /* Skip white space. */ - while ((c = yygetc (yylval, yylloc)) == ' ' || c == '\t') - { - (*yylloc).begin = (*yylloc).end; - } - - /* process numbers */ - if (c == '.' || isdigit (c)) - { - yyungetc (yylval, yylloc, c); - (*yylval).ival = read_signed_integer (yylval, yylloc); - return NUM; - } - - /* Return end-of-file. */ - if (c == EOF) - return CALC_EOF; - - /* Return single chars. */ - return c; -} - -static int -power (int base, int exponent) -{ - int res = 1; - if (exponent < 0) - exit (1); - for (/* Niente */; exponent; --exponent) - res *= base; - return res; -} - - -int -main (int argc, const char **argv) -{ - semantic_value result = 0; - int count = 0; - int status; - - alarm (10); - if (argc == 2) - yyin = fopen (argv[1], "r"); - else - yyin = stdin; - - if (!yyin) - { - perror (argv[1]); - exit (1); - } - - - status = yyparse (); - if (global_result != result) - abort (); - if (global_count != count) - abort (); - return status; -} -_ATEOF - - - - - -# Specify the output files to avoid problems on different file systems. -$at_traceoff -echo "calc.at:626: bison -o calc.c calc.y" -echo calc.at:626 >$at_check_line_file -( $at_traceon; bison -o calc.c calc.y ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:626: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - - -$at_traceoff -echo "calc.at:626: \$CXX --version || exit 77" -echo calc.at:626 >$at_check_line_file -( $at_traceon; $CXX --version || exit 77 ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo stderr:; cat $at_stderr -echo stdout:; cat $at_stdout -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:626: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - -$at_traceoff -echo "calc.at:626: \$CXX \$CXXFLAGS \$CPPFLAGS calc.c -o calc" -echo calc.at:626 >$at_check_line_file -( $at_traceon; $CXX $CXXFLAGS $CPPFLAGS calc.c -o calc ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo stderr:; cat $at_stderr -echo stdout:; cat $at_stdout -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:626: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - -# Test the priorities. -cat >input <<'_ATEOF' -1 + 2 * 3 = 7 -1 + 2 * -3 = -5 - --1^2 = -1 -(-1)^2 = 1 - ----1 = -1 - -1 - 2 - 3 = -4 -1 - (2 - 3) = 2 - -2^2^3 = 256 -(2^2)^3 = 64 -_ATEOF - -$at_traceoff -echo "calc.at:626: \$PREPARSER ./calc input" -echo calc.at:626 >$at_check_line_file -( $at_traceon; $PREPARSER ./calc input ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo stderr:; tee stderr <$at_stderr -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:626: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - - - -# Some syntax errors. -cat >input <<'_ATEOF' -0 0 -_ATEOF - -$at_traceoff -echo "calc.at:626: \$PREPARSER ./calc input" -echo calc.at:626 >$at_check_line_file -( $at_traceon; $PREPARSER ./calc input ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo stderr:; tee stderr <$at_stderr -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 1) ;; - *) echo "calc.at:626: exit code was $at_status, expected 1" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - - -# Normalize the observed and expected error messages, depending upon the -# options. -# 1. Remove the traces from observed. -sed '/^Starting/d -/^Entering/d -/^Stack/d -/^Reading/d -/^Reducing/d -/^Shifting/d -/^state/d -/^Error:/d -/^Next/d -/^Discarding/d -/^yydestructor:/d' stderr >at-stderr -mv at-stderr stderr -# 2. Create the reference error message. -cat >expout <<'_ATEOF' -1.2: syntax error, unexpected "number" -_ATEOF - -# 3. If locations are not used, remove them. - -# 4. If error-verbose is not used, strip the`, unexpected....' part. - -# 5. Check -$at_traceoff -echo "calc.at:626: cat stderr" -echo calc.at:626 >$at_check_line_file -( $at_traceon; cat stderr ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -$at_diff expout $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:626: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - -cat >input <<'_ATEOF' -1//2 -_ATEOF - -$at_traceoff -echo "calc.at:626: \$PREPARSER ./calc input" -echo calc.at:626 >$at_check_line_file -( $at_traceon; $PREPARSER ./calc input ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo stderr:; tee stderr <$at_stderr -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 1) ;; - *) echo "calc.at:626: exit code was $at_status, expected 1" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - - -# Normalize the observed and expected error messages, depending upon the -# options. -# 1. Remove the traces from observed. -sed '/^Starting/d -/^Entering/d -/^Stack/d -/^Reading/d -/^Reducing/d -/^Shifting/d -/^state/d -/^Error:/d -/^Next/d -/^Discarding/d -/^yydestructor:/d' stderr >at-stderr -mv at-stderr stderr -# 2. Create the reference error message. -cat >expout <<'_ATEOF' -1.2: syntax error, unexpected '/', expecting "number" or '-' or '(' or '!' -_ATEOF - -# 3. If locations are not used, remove them. - -# 4. If error-verbose is not used, strip the`, unexpected....' part. - -# 5. Check -$at_traceoff -echo "calc.at:626: cat stderr" -echo calc.at:626 >$at_check_line_file -( $at_traceon; cat stderr ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -$at_diff expout $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:626: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - -cat >input <<'_ATEOF' -error -_ATEOF - -$at_traceoff -echo "calc.at:626: \$PREPARSER ./calc input" -echo calc.at:626 >$at_check_line_file -( $at_traceon; $PREPARSER ./calc input ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo stderr:; tee stderr <$at_stderr -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 1) ;; - *) echo "calc.at:626: exit code was $at_status, expected 1" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - - -# Normalize the observed and expected error messages, depending upon the -# options. -# 1. Remove the traces from observed. -sed '/^Starting/d -/^Entering/d -/^Stack/d -/^Reading/d -/^Reducing/d -/^Shifting/d -/^state/d -/^Error:/d -/^Next/d -/^Discarding/d -/^yydestructor:/d' stderr >at-stderr -mv at-stderr stderr -# 2. Create the reference error message. -cat >expout <<'_ATEOF' -1.0: syntax error, unexpected $undefined -_ATEOF - -# 3. If locations are not used, remove them. - -# 4. If error-verbose is not used, strip the`, unexpected....' part. - -# 5. Check -$at_traceoff -echo "calc.at:626: cat stderr" -echo calc.at:626 >$at_check_line_file -( $at_traceon; cat stderr ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -$at_diff expout $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:626: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - -cat >input <<'_ATEOF' -1 = 2 = 3 -_ATEOF - -$at_traceoff -echo "calc.at:626: \$PREPARSER ./calc input" -echo calc.at:626 >$at_check_line_file -( $at_traceon; $PREPARSER ./calc input ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo stderr:; tee stderr <$at_stderr -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 1) ;; - *) echo "calc.at:626: exit code was $at_status, expected 1" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - - -# Normalize the observed and expected error messages, depending upon the -# options. -# 1. Remove the traces from observed. -sed '/^Starting/d -/^Entering/d -/^Stack/d -/^Reading/d -/^Reducing/d -/^Shifting/d -/^state/d -/^Error:/d -/^Next/d -/^Discarding/d -/^yydestructor:/d' stderr >at-stderr -mv at-stderr stderr -# 2. Create the reference error message. -cat >expout <<'_ATEOF' -1.6: syntax error, unexpected '=' -_ATEOF - -# 3. If locations are not used, remove them. - -# 4. If error-verbose is not used, strip the`, unexpected....' part. - -# 5. Check -$at_traceoff -echo "calc.at:626: cat stderr" -echo calc.at:626 >$at_check_line_file -( $at_traceon; cat stderr ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -$at_diff expout $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:626: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - -cat >input <<'_ATEOF' - -+1 -_ATEOF - -$at_traceoff -echo "calc.at:626: \$PREPARSER ./calc input" -echo calc.at:626 >$at_check_line_file -( $at_traceon; $PREPARSER ./calc input ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo stderr:; tee stderr <$at_stderr -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 1) ;; - *) echo "calc.at:626: exit code was $at_status, expected 1" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - - -# Normalize the observed and expected error messages, depending upon the -# options. -# 1. Remove the traces from observed. -sed '/^Starting/d -/^Entering/d -/^Stack/d -/^Reading/d -/^Reducing/d -/^Shifting/d -/^state/d -/^Error:/d -/^Next/d -/^Discarding/d -/^yydestructor:/d' stderr >at-stderr -mv at-stderr stderr -# 2. Create the reference error message. -cat >expout <<'_ATEOF' -2.0: syntax error, unexpected '+' -_ATEOF - -# 3. If locations are not used, remove them. - -# 4. If error-verbose is not used, strip the`, unexpected....' part. - -# 5. Check -$at_traceoff -echo "calc.at:626: cat stderr" -echo calc.at:626 >$at_check_line_file -( $at_traceon; cat stderr ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -$at_diff expout $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:626: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - -# Exercise error messages with EOF: work on an empty file. -$at_traceoff -echo "calc.at:626: \$PREPARSER ./calc /dev/null" -echo calc.at:626 >$at_check_line_file -( $at_traceon; $PREPARSER ./calc /dev/null ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo stderr:; tee stderr <$at_stderr -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 1) ;; - *) echo "calc.at:626: exit code was $at_status, expected 1" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - - -# Normalize the observed and expected error messages, depending upon the -# options. -# 1. Remove the traces from observed. -sed '/^Starting/d -/^Entering/d -/^Stack/d -/^Reading/d -/^Reducing/d -/^Shifting/d -/^state/d -/^Error:/d -/^Next/d -/^Discarding/d -/^yydestructor:/d' stderr >at-stderr -mv at-stderr stderr -# 2. Create the reference error message. -cat >expout <<'_ATEOF' -1.0: syntax error, unexpected "end of input" -_ATEOF - -# 3. If locations are not used, remove them. - -# 4. If error-verbose is not used, strip the`, unexpected....' part. - -# 5. Check -$at_traceoff -echo "calc.at:626: cat stderr" -echo calc.at:626 >$at_check_line_file -( $at_traceon; cat stderr ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -$at_diff expout $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:626: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - - -# Exercise the error token: without it, we die at the first error, -# hence be sure to -# -# - have several errors which exercise different shift/discardings -# - (): nothing to pop, nothing to discard -# - (1 + 1 + 1 +): a lot to pop, nothing to discard -# - (* * *): nothing to pop, a lot to discard -# - (1 + 2 * *): some to pop and discard -# -# - test the action associated to `error' -# -# - check the lookahead that triggers an error is not discarded -# when we enter error recovery. Below, the lookahead causing the -# first error is ")", which is needed to recover from the error and -# produce the "0" that triggers the "0 != 1" error. -# -cat >input <<'_ATEOF' -() + (1 + 1 + 1 +) + (* * *) + (1 * 2 * *) = 1 -_ATEOF - -$at_traceoff -echo "calc.at:626: \$PREPARSER ./calc input" -echo calc.at:626 >$at_check_line_file -( $at_traceon; $PREPARSER ./calc input ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo stderr:; tee stderr <$at_stderr -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:626: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - - -# Normalize the observed and expected error messages, depending upon the -# options. -# 1. Remove the traces from observed. -sed '/^Starting/d -/^Entering/d -/^Stack/d -/^Reading/d -/^Reducing/d -/^Shifting/d -/^state/d -/^Error:/d -/^Next/d -/^Discarding/d -/^yydestructor:/d' stderr >at-stderr -mv at-stderr stderr -# 2. Create the reference error message. -cat >expout <<'_ATEOF' -1.1: syntax error, unexpected ')', expecting "number" or '-' or '(' or '!' -1.17: syntax error, unexpected ')', expecting "number" or '-' or '(' or '!' -1.22: syntax error, unexpected '*', expecting "number" or '-' or '(' or '!' -1.40: syntax error, unexpected '*', expecting "number" or '-' or '(' or '!' -calc: error: 4444 != 1 -_ATEOF - -# 3. If locations are not used, remove them. - -# 4. If error-verbose is not used, strip the`, unexpected....' part. - -# 5. Check -$at_traceoff -echo "calc.at:626: cat stderr" -echo calc.at:626 >$at_check_line_file -( $at_traceon; cat stderr ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -$at_diff expout $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:626: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - - -# The same, but this time exercising explicitly triggered syntax errors. -# POSIX says the lookahead causing the error should not be discarded. -cat >input <<'_ATEOF' -(!) + (0 0) = 1 -_ATEOF - -$at_traceoff -echo "calc.at:626: \$PREPARSER ./calc input" -echo calc.at:626 >$at_check_line_file -( $at_traceon; $PREPARSER ./calc input ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo stderr:; tee stderr <$at_stderr -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:626: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - - -# Normalize the observed and expected error messages, depending upon the -# options. -# 1. Remove the traces from observed. -sed '/^Starting/d -/^Entering/d -/^Stack/d -/^Reading/d -/^Reducing/d -/^Shifting/d -/^state/d -/^Error:/d -/^Next/d -/^Discarding/d -/^yydestructor:/d' stderr >at-stderr -mv at-stderr stderr -# 2. Create the reference error message. -cat >expout <<'_ATEOF' -1.9: syntax error, unexpected "number" -calc: error: 2222 != 1 -_ATEOF - -# 3. If locations are not used, remove them. - -# 4. If error-verbose is not used, strip the`, unexpected....' part. - -# 5. Check -$at_traceoff -echo "calc.at:626: cat stderr" -echo calc.at:626 >$at_check_line_file -( $at_traceon; cat stderr ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -$at_diff expout $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:626: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - -cat >input <<'_ATEOF' -(- *) + (0 0) = 1 -_ATEOF - -$at_traceoff -echo "calc.at:626: \$PREPARSER ./calc input" -echo calc.at:626 >$at_check_line_file -( $at_traceon; $PREPARSER ./calc input ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo stderr:; tee stderr <$at_stderr -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:626: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - - -# Normalize the observed and expected error messages, depending upon the -# options. -# 1. Remove the traces from observed. -sed '/^Starting/d -/^Entering/d -/^Stack/d -/^Reading/d -/^Reducing/d -/^Shifting/d -/^state/d -/^Error:/d -/^Next/d -/^Discarding/d -/^yydestructor:/d' stderr >at-stderr -mv at-stderr stderr -# 2. Create the reference error message. -cat >expout <<'_ATEOF' -1.3: syntax error, unexpected '*', expecting "number" or '-' or '(' or '!' -1.11: syntax error, unexpected "number" -calc: error: 2222 != 1 -_ATEOF - -# 3. If locations are not used, remove them. - -# 4. If error-verbose is not used, strip the`, unexpected....' part. - -# 5. Check -$at_traceoff -echo "calc.at:626: cat stderr" -echo calc.at:626 >$at_check_line_file -( $at_traceon; cat stderr ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -$at_diff expout $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:626: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - - - - - - - - - - - - - - - - - - - - - $at_traceoff - $at_times_p && times >$at_times_file - ) 5>&1 2>&1 | eval $at_tee_pipe - at_status=`cat $at_status_file` - ;; - - 87 ) # 87. calc.at:629: Calculator %skeleton "lalr1.cc" %error-verbose %debug %locations %defines %name-prefix="calc" %verbose %yacc - at_setup_line='calc.at:629' - at_desc='Calculator %skeleton "lalr1.cc" %error-verbose %debug %locations %defines %name-prefix="calc" %verbose %yacc' - $at_quiet $ECHO_N " 87: Calculator %skeleton "lalr1.cc" %error-verbose %debug %locations %defines %name-prefix="calc" %verbose %yacc$ECHO_C" - at_xfail=no - ( - echo "87. calc.at:629: testing ..." - $at_traceon - - - - - - -# Using yacc.c? - - - - - - - -# yyerror receives the location if %location & %pure & (%glr or %parse-param). - -# yyerror always sees the locations (when activated), except if -# yacc & pure & !param. - - -# The interface is pure: either because %pure-parser, or because we -# are using the C++ parsers. - - - - - - - - - - - - -cat >calc.y <<'_ATEOF' -%{ -#if HAVE_CONFIG_H -# include - /* We don't need perfect functions for these tests. */ -# undef malloc -# undef memcmp -# undef realloc -#endif -%} - -/* Infix notation calculator--calc */ -%skeleton "lalr1.cc" %error-verbose %debug %locations %defines %name-prefix="calc" %verbose %yacc -%{ -#include - -#include -#include -#if HAVE_UNISTD_H -# include -#else -# undef alarm -# define alarm(seconds) /* empty */ -#endif -#include - -/* Exercise pre-prologue dependency to %union. */ -typedef int semantic_value; - -static semantic_value global_result = 0; -static int global_count = 0; -%} - -/* Exercise %union. */ -%union -{ - semantic_value ival; -}; - -%{ -static int power (int base, int exponent); -typedef yy::Location YYLTYPE; -static int yylex (YYSTYPE *yylval, YYLTYPE *yylloc); -static int yygetc (YYSTYPE *yylval, YYLTYPE *yylloc); -static void yyungetc (YYSTYPE *yylval, YYLTYPE *yylloc, int c); -%} - -/* Bison Declarations */ -%token CALC_EOF 0 "end of input" -%token NUM "number" -%type exp - -%nonassoc '=' /* comparison */ -%left '-' '+' -%left '*' '/' -%left NEG /* negation--unary minus */ -%right '^' /* exponentiation */ - -/* Grammar follows */ -%% -input: - line -| input line { } -; - -line: - '\n' -| exp '\n' { } -; - -exp: - NUM { $$ = $1; } -| exp '=' exp - { - if ($1 != $3) - fprintf (stderr, "calc: error: %d != %d\n", $1, $3); - $$ = $1; - } -| exp '+' exp { $$ = $1 + $3; } -| exp '-' exp { $$ = $1 - $3; } -| exp '*' exp { $$ = $1 * $3; } -| exp '/' exp { $$ = $1 / $3; } -| '-' exp %prec NEG { $$ = -$2; } -| exp '^' exp { $$ = power ($1, $3); } -| '(' exp ')' { $$ = $2; } -| '(' error ')' { $$ = 1111; } -| '!' { YYERROR; } -| '-' error { YYERROR; } -; -%% -/* The input. */ -static FILE *yyin; - -/* Currently, print_ is required in C++. */ -void -yy::Parser::print_ () -{ - - std::cerr << location; -} - -/* A C++ error reporting function. */ -void -yy::Parser::error_ () -{ - std::cerr << location << ": " << message << std::endl; -} - -int -yyparse () -{ - yy::Parser parser (!!YYDEBUG, yy::Location::Location ()); - return parser.parse (); -} - - - - -static YYLTYPE last_yylloc; - -static int -yygetc (YYSTYPE *yylval, YYLTYPE *yylloc) -{ - int res = getc (yyin); - (void) yylval;(void) yylloc; - - last_yylloc = (*yylloc); - if (res == '\n') - { - (*yylloc).end.line++; - (*yylloc).end.column = 0; - } - else - (*yylloc).end.column++; - - return res; -} - - -static void -yyungetc (YYSTYPE *yylval, YYLTYPE *yylloc, int c) -{ - (void) yylval;(void) yylloc; - - /* Wrong when C == `\n'. */ - (*yylloc) = last_yylloc; - - ungetc (c, yyin); -} - -static int -read_signed_integer (YYSTYPE *yylval, YYLTYPE *yylloc) -{ - int c = yygetc (yylval, yylloc); - int sign = 1; - int n = 0; - - (void) yylval;(void) yylloc; - if (c == '-') - { - c = yygetc (yylval, yylloc); - sign = -1; - } - - while (isdigit (c)) - { - n = 10 * n + (c - '0'); - c = yygetc (yylval, yylloc); - } - - yyungetc (yylval, yylloc, c); - - return sign * n; -} - - - -/*---------------------------------------------------------------. -| Lexical analyzer returns an integer on the stack and the token | -| NUM, or the ASCII character read if not a number. Skips all | -| blanks and tabs, returns 0 for EOF. | -`---------------------------------------------------------------*/ - -static int -yylex (YYSTYPE *yylval, YYLTYPE *yylloc) -{ - static int init = 1; - int c; - - if (init) - { - init = 0; - - } - - (*yylloc).begin = (*yylloc).end; - - /* Skip white space. */ - while ((c = yygetc (yylval, yylloc)) == ' ' || c == '\t') - { - (*yylloc).begin = (*yylloc).end; - } - - /* process numbers */ - if (c == '.' || isdigit (c)) - { - yyungetc (yylval, yylloc, c); - (*yylval).ival = read_signed_integer (yylval, yylloc); - return NUM; - } - - /* Return end-of-file. */ - if (c == EOF) - return CALC_EOF; - - /* Return single chars. */ - return c; -} - -static int -power (int base, int exponent) -{ - int res = 1; - if (exponent < 0) - exit (1); - for (/* Niente */; exponent; --exponent) - res *= base; - return res; -} - - -int -main (int argc, const char **argv) -{ - semantic_value result = 0; - int count = 0; - int status; - - alarm (10); - if (argc == 2) - yyin = fopen (argv[1], "r"); - else - yyin = stdin; - - if (!yyin) - { - perror (argv[1]); - exit (1); - } - - - status = yyparse (); - if (global_result != result) - abort (); - if (global_count != count) - abort (); - return status; -} -_ATEOF - - - - - -# Specify the output files to avoid problems on different file systems. -$at_traceoff -echo "calc.at:629: bison -o calc.c calc.y" -echo calc.at:629 >$at_check_line_file -( $at_traceon; bison -o calc.c calc.y ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:629: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - - -$at_traceoff -echo "calc.at:629: \$CXX --version || exit 77" -echo calc.at:629 >$at_check_line_file -( $at_traceon; $CXX --version || exit 77 ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo stderr:; cat $at_stderr -echo stdout:; cat $at_stdout -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:629: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - -$at_traceoff -echo "calc.at:629: \$CXX \$CXXFLAGS \$CPPFLAGS calc.c -o calc" -echo calc.at:629 >$at_check_line_file -( $at_traceon; $CXX $CXXFLAGS $CPPFLAGS calc.c -o calc ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo stderr:; cat $at_stderr -echo stdout:; cat $at_stdout -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:629: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - -# Test the priorities. -cat >input <<'_ATEOF' -1 + 2 * 3 = 7 -1 + 2 * -3 = -5 - --1^2 = -1 -(-1)^2 = 1 - ----1 = -1 - -1 - 2 - 3 = -4 -1 - (2 - 3) = 2 - -2^2^3 = 256 -(2^2)^3 = 64 -_ATEOF - -$at_traceoff -echo "calc.at:629: \$PREPARSER ./calc input" -echo calc.at:629 >$at_check_line_file -( $at_traceon; $PREPARSER ./calc input ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo stderr:; tee stderr <$at_stderr -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:629: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - -$at_traceoff -echo "calc.at:629: wc -l $at_check_line_file -( $at_traceon; wc -l $at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -echo >>$at_stdout; echo "486 -" | $at_diff - $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:629: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - - -# Some syntax errors. -cat >input <<'_ATEOF' -0 0 -_ATEOF - -$at_traceoff -echo "calc.at:629: \$PREPARSER ./calc input" -echo calc.at:629 >$at_check_line_file -( $at_traceon; $PREPARSER ./calc input ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo stderr:; tee stderr <$at_stderr -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 1) ;; - *) echo "calc.at:629: exit code was $at_status, expected 1" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - -$at_traceoff -echo "calc.at:629: wc -l $at_check_line_file -( $at_traceon; wc -l $at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -echo >>$at_stdout; echo "11 -" | $at_diff - $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:629: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - -# Normalize the observed and expected error messages, depending upon the -# options. -# 1. Remove the traces from observed. -sed '/^Starting/d -/^Entering/d -/^Stack/d -/^Reading/d -/^Reducing/d -/^Shifting/d -/^state/d -/^Error:/d -/^Next/d -/^Discarding/d -/^yydestructor:/d' stderr >at-stderr -mv at-stderr stderr -# 2. Create the reference error message. -cat >expout <<'_ATEOF' -1.2: syntax error, unexpected "number" -_ATEOF - -# 3. If locations are not used, remove them. - -# 4. If error-verbose is not used, strip the`, unexpected....' part. - -# 5. Check -$at_traceoff -echo "calc.at:629: cat stderr" -echo calc.at:629 >$at_check_line_file -( $at_traceon; cat stderr ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -$at_diff expout $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:629: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - -cat >input <<'_ATEOF' -1//2 -_ATEOF - -$at_traceoff -echo "calc.at:629: \$PREPARSER ./calc input" -echo calc.at:629 >$at_check_line_file -( $at_traceon; $PREPARSER ./calc input ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo stderr:; tee stderr <$at_stderr -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 1) ;; - *) echo "calc.at:629: exit code was $at_status, expected 1" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - -$at_traceoff -echo "calc.at:629: wc -l $at_check_line_file -( $at_traceon; wc -l $at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -echo >>$at_stdout; echo "15 -" | $at_diff - $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:629: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - -# Normalize the observed and expected error messages, depending upon the -# options. -# 1. Remove the traces from observed. -sed '/^Starting/d -/^Entering/d -/^Stack/d -/^Reading/d -/^Reducing/d -/^Shifting/d -/^state/d -/^Error:/d -/^Next/d -/^Discarding/d -/^yydestructor:/d' stderr >at-stderr -mv at-stderr stderr -# 2. Create the reference error message. -cat >expout <<'_ATEOF' -1.2: syntax error, unexpected '/', expecting "number" or '-' or '(' or '!' -_ATEOF - -# 3. If locations are not used, remove them. - -# 4. If error-verbose is not used, strip the`, unexpected....' part. - -# 5. Check -$at_traceoff -echo "calc.at:629: cat stderr" -echo calc.at:629 >$at_check_line_file -( $at_traceon; cat stderr ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -$at_diff expout $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:629: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - -cat >input <<'_ATEOF' -error -_ATEOF - -$at_traceoff -echo "calc.at:629: \$PREPARSER ./calc input" -echo calc.at:629 >$at_check_line_file -( $at_traceon; $PREPARSER ./calc input ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo stderr:; tee stderr <$at_stderr -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 1) ;; - *) echo "calc.at:629: exit code was $at_status, expected 1" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - -$at_traceoff -echo "calc.at:629: wc -l $at_check_line_file -( $at_traceon; wc -l $at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -echo >>$at_stdout; echo "4 -" | $at_diff - $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:629: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - -# Normalize the observed and expected error messages, depending upon the -# options. -# 1. Remove the traces from observed. -sed '/^Starting/d -/^Entering/d -/^Stack/d -/^Reading/d -/^Reducing/d -/^Shifting/d -/^state/d -/^Error:/d -/^Next/d -/^Discarding/d -/^yydestructor:/d' stderr >at-stderr -mv at-stderr stderr -# 2. Create the reference error message. -cat >expout <<'_ATEOF' -1.0: syntax error, unexpected $undefined -_ATEOF - -# 3. If locations are not used, remove them. - -# 4. If error-verbose is not used, strip the`, unexpected....' part. - -# 5. Check -$at_traceoff -echo "calc.at:629: cat stderr" -echo calc.at:629 >$at_check_line_file -( $at_traceon; cat stderr ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -$at_diff expout $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:629: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - -cat >input <<'_ATEOF' -1 = 2 = 3 -_ATEOF - -$at_traceoff -echo "calc.at:629: \$PREPARSER ./calc input" -echo calc.at:629 >$at_check_line_file -( $at_traceon; $PREPARSER ./calc input ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo stderr:; tee stderr <$at_stderr -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 1) ;; - *) echo "calc.at:629: exit code was $at_status, expected 1" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - -$at_traceoff -echo "calc.at:629: wc -l $at_check_line_file -( $at_traceon; wc -l $at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -echo >>$at_stdout; echo "22 -" | $at_diff - $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:629: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - -# Normalize the observed and expected error messages, depending upon the -# options. -# 1. Remove the traces from observed. -sed '/^Starting/d -/^Entering/d -/^Stack/d -/^Reading/d -/^Reducing/d -/^Shifting/d -/^state/d -/^Error:/d -/^Next/d -/^Discarding/d -/^yydestructor:/d' stderr >at-stderr -mv at-stderr stderr -# 2. Create the reference error message. -cat >expout <<'_ATEOF' -1.6: syntax error, unexpected '=' -_ATEOF - -# 3. If locations are not used, remove them. - -# 4. If error-verbose is not used, strip the`, unexpected....' part. - -# 5. Check -$at_traceoff -echo "calc.at:629: cat stderr" -echo calc.at:629 >$at_check_line_file -( $at_traceon; cat stderr ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -$at_diff expout $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:629: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - -cat >input <<'_ATEOF' - -+1 -_ATEOF - -$at_traceoff -echo "calc.at:629: \$PREPARSER ./calc input" -echo calc.at:629 >$at_check_line_file -( $at_traceon; $PREPARSER ./calc input ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo stderr:; tee stderr <$at_stderr -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 1) ;; - *) echo "calc.at:629: exit code was $at_status, expected 1" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - -$at_traceoff -echo "calc.at:629: wc -l $at_check_line_file -( $at_traceon; wc -l $at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -echo >>$at_stdout; echo "14 -" | $at_diff - $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:629: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - -# Normalize the observed and expected error messages, depending upon the -# options. -# 1. Remove the traces from observed. -sed '/^Starting/d -/^Entering/d -/^Stack/d -/^Reading/d -/^Reducing/d -/^Shifting/d -/^state/d -/^Error:/d -/^Next/d -/^Discarding/d -/^yydestructor:/d' stderr >at-stderr -mv at-stderr stderr -# 2. Create the reference error message. -cat >expout <<'_ATEOF' -2.0: syntax error, unexpected '+' -_ATEOF - -# 3. If locations are not used, remove them. - -# 4. If error-verbose is not used, strip the`, unexpected....' part. - -# 5. Check -$at_traceoff -echo "calc.at:629: cat stderr" -echo calc.at:629 >$at_check_line_file -( $at_traceon; cat stderr ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -$at_diff expout $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:629: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - -# Exercise error messages with EOF: work on an empty file. -$at_traceoff -echo "calc.at:629: \$PREPARSER ./calc /dev/null" -echo calc.at:629 >$at_check_line_file -( $at_traceon; $PREPARSER ./calc /dev/null ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo stderr:; tee stderr <$at_stderr -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 1) ;; - *) echo "calc.at:629: exit code was $at_status, expected 1" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - -$at_traceoff -echo "calc.at:629: wc -l $at_check_line_file -( $at_traceon; wc -l $at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -echo >>$at_stdout; echo "4 -" | $at_diff - $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:629: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - -# Normalize the observed and expected error messages, depending upon the -# options. -# 1. Remove the traces from observed. -sed '/^Starting/d -/^Entering/d -/^Stack/d -/^Reading/d -/^Reducing/d -/^Shifting/d -/^state/d -/^Error:/d -/^Next/d -/^Discarding/d -/^yydestructor:/d' stderr >at-stderr -mv at-stderr stderr -# 2. Create the reference error message. -cat >expout <<'_ATEOF' -1.0: syntax error, unexpected "end of input" -_ATEOF - -# 3. If locations are not used, remove them. - -# 4. If error-verbose is not used, strip the`, unexpected....' part. - -# 5. Check -$at_traceoff -echo "calc.at:629: cat stderr" -echo calc.at:629 >$at_check_line_file -( $at_traceon; cat stderr ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -$at_diff expout $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:629: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - - -# Exercise the error token: without it, we die at the first error, -# hence be sure to -# -# - have several errors which exercise different shift/discardings -# - (): nothing to pop, nothing to discard -# - (1 + 1 + 1 +): a lot to pop, nothing to discard -# - (* * *): nothing to pop, a lot to discard -# - (1 + 2 * *): some to pop and discard -# -# - test the action associated to `error' -# -# - check the lookahead that triggers an error is not discarded -# when we enter error recovery. Below, the lookahead causing the -# first error is ")", which is needed to recover from the error and -# produce the "0" that triggers the "0 != 1" error. -# -cat >input <<'_ATEOF' -() + (1 + 1 + 1 +) + (* * *) + (1 * 2 * *) = 1 -_ATEOF - -$at_traceoff -echo "calc.at:629: \$PREPARSER ./calc input" -echo calc.at:629 >$at_check_line_file -( $at_traceon; $PREPARSER ./calc input ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo stderr:; tee stderr <$at_stderr -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:629: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - -$at_traceoff -echo "calc.at:629: wc -l $at_check_line_file -( $at_traceon; wc -l $at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -echo >>$at_stdout; echo "156 -" | $at_diff - $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:629: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - -# Normalize the observed and expected error messages, depending upon the -# options. -# 1. Remove the traces from observed. -sed '/^Starting/d -/^Entering/d -/^Stack/d -/^Reading/d -/^Reducing/d -/^Shifting/d -/^state/d -/^Error:/d -/^Next/d -/^Discarding/d -/^yydestructor:/d' stderr >at-stderr -mv at-stderr stderr -# 2. Create the reference error message. -cat >expout <<'_ATEOF' -1.1: syntax error, unexpected ')', expecting "number" or '-' or '(' or '!' -1.17: syntax error, unexpected ')', expecting "number" or '-' or '(' or '!' -1.22: syntax error, unexpected '*', expecting "number" or '-' or '(' or '!' -1.40: syntax error, unexpected '*', expecting "number" or '-' or '(' or '!' -calc: error: 4444 != 1 -_ATEOF - -# 3. If locations are not used, remove them. - -# 4. If error-verbose is not used, strip the`, unexpected....' part. - -# 5. Check -$at_traceoff -echo "calc.at:629: cat stderr" -echo calc.at:629 >$at_check_line_file -( $at_traceon; cat stderr ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -$at_diff expout $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:629: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - - -# The same, but this time exercising explicitly triggered syntax errors. -# POSIX says the lookahead causing the error should not be discarded. -cat >input <<'_ATEOF' -(!) + (0 0) = 1 -_ATEOF - -$at_traceoff -echo "calc.at:629: \$PREPARSER ./calc input" -echo calc.at:629 >$at_check_line_file -( $at_traceon; $PREPARSER ./calc input ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo stderr:; tee stderr <$at_stderr -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:629: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - -$at_traceoff -echo "calc.at:629: wc -l $at_check_line_file -( $at_traceon; wc -l $at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -echo >>$at_stdout; echo "62 -" | $at_diff - $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:629: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - -# Normalize the observed and expected error messages, depending upon the -# options. -# 1. Remove the traces from observed. -sed '/^Starting/d -/^Entering/d -/^Stack/d -/^Reading/d -/^Reducing/d -/^Shifting/d -/^state/d -/^Error:/d -/^Next/d -/^Discarding/d -/^yydestructor:/d' stderr >at-stderr -mv at-stderr stderr -# 2. Create the reference error message. -cat >expout <<'_ATEOF' -1.9: syntax error, unexpected "number" -calc: error: 2222 != 1 -_ATEOF - -# 3. If locations are not used, remove them. - -# 4. If error-verbose is not used, strip the`, unexpected....' part. - -# 5. Check -$at_traceoff -echo "calc.at:629: cat stderr" -echo calc.at:629 >$at_check_line_file -( $at_traceon; cat stderr ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -$at_diff expout $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:629: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - -cat >input <<'_ATEOF' -(- *) + (0 0) = 1 -_ATEOF - -$at_traceoff -echo "calc.at:629: \$PREPARSER ./calc input" -echo calc.at:629 >$at_check_line_file -( $at_traceon; $PREPARSER ./calc input ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo stderr:; tee stderr <$at_stderr -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:629: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - -$at_traceoff -echo "calc.at:629: wc -l $at_check_line_file -( $at_traceon; wc -l $at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -echo >>$at_stdout; echo "70 -" | $at_diff - $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:629: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - -# Normalize the observed and expected error messages, depending upon the -# options. -# 1. Remove the traces from observed. -sed '/^Starting/d -/^Entering/d -/^Stack/d -/^Reading/d -/^Reducing/d -/^Shifting/d -/^state/d -/^Error:/d -/^Next/d -/^Discarding/d -/^yydestructor:/d' stderr >at-stderr -mv at-stderr stderr -# 2. Create the reference error message. -cat >expout <<'_ATEOF' -1.3: syntax error, unexpected '*', expecting "number" or '-' or '(' or '!' -1.11: syntax error, unexpected "number" -calc: error: 2222 != 1 -_ATEOF - -# 3. If locations are not used, remove them. - -# 4. If error-verbose is not used, strip the`, unexpected....' part. - -# 5. Check -$at_traceoff -echo "calc.at:629: cat stderr" -echo calc.at:629 >$at_check_line_file -( $at_traceon; cat stderr ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -$at_diff expout $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:629: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - - - - - - - - - - - - - - - - - - - - - $at_traceoff - $at_times_p && times >$at_times_file - ) 5>&1 2>&1 | eval $at_tee_pipe - at_status=`cat $at_status_file` - ;; - - 88 ) # 88. calc.at:631: Calculator %skeleton "lalr1.cc" %pure-parser %error-verbose %debug %locations %defines %name-prefix="calc" %verbose %yacc - at_setup_line='calc.at:631' - at_desc='Calculator %skeleton "lalr1.cc" %pure-parser %error-verbose %debug %locations %defines %name-prefix="calc" %verbose %yacc' - $at_quiet $ECHO_N " 88: Calculator %skeleton "lalr1.cc" %pure-parser %error-verbose %debug %locations %defines %name-prefix="calc" %verbose %yacc$ECHO_C" - at_xfail=no - ( - echo "88. calc.at:631: testing ..." - $at_traceon - - - - - - -# Using yacc.c? - - - - - - - -# yyerror receives the location if %location & %pure & (%glr or %parse-param). - -# yyerror always sees the locations (when activated), except if -# yacc & pure & !param. - - -# The interface is pure: either because %pure-parser, or because we -# are using the C++ parsers. - - - - - - - - - - - - -cat >calc.y <<'_ATEOF' -%{ -#if HAVE_CONFIG_H -# include - /* We don't need perfect functions for these tests. */ -# undef malloc -# undef memcmp -# undef realloc -#endif -%} - -/* Infix notation calculator--calc */ -%skeleton "lalr1.cc" %pure-parser %error-verbose %debug %locations %defines %name-prefix="calc" %verbose %yacc -%{ -#include - -#include -#include -#if HAVE_UNISTD_H -# include -#else -# undef alarm -# define alarm(seconds) /* empty */ -#endif -#include - -/* Exercise pre-prologue dependency to %union. */ -typedef int semantic_value; - -static semantic_value global_result = 0; -static int global_count = 0; -%} - -/* Exercise %union. */ -%union -{ - semantic_value ival; -}; - -%{ -static int power (int base, int exponent); -typedef yy::Location YYLTYPE; -static int yylex (YYSTYPE *yylval, YYLTYPE *yylloc); -static int yygetc (YYSTYPE *yylval, YYLTYPE *yylloc); -static void yyungetc (YYSTYPE *yylval, YYLTYPE *yylloc, int c); -%} - -/* Bison Declarations */ -%token CALC_EOF 0 "end of input" -%token NUM "number" -%type exp - -%nonassoc '=' /* comparison */ -%left '-' '+' -%left '*' '/' -%left NEG /* negation--unary minus */ -%right '^' /* exponentiation */ - -/* Grammar follows */ -%% -input: - line -| input line { } -; - -line: - '\n' -| exp '\n' { } -; - -exp: - NUM { $$ = $1; } -| exp '=' exp - { - if ($1 != $3) - fprintf (stderr, "calc: error: %d != %d\n", $1, $3); - $$ = $1; - } -| exp '+' exp { $$ = $1 + $3; } -| exp '-' exp { $$ = $1 - $3; } -| exp '*' exp { $$ = $1 * $3; } -| exp '/' exp { $$ = $1 / $3; } -| '-' exp %prec NEG { $$ = -$2; } -| exp '^' exp { $$ = power ($1, $3); } -| '(' exp ')' { $$ = $2; } -| '(' error ')' { $$ = 1111; } -| '!' { YYERROR; } -| '-' error { YYERROR; } -; -%% -/* The input. */ -static FILE *yyin; - -/* Currently, print_ is required in C++. */ -void -yy::Parser::print_ () -{ - - std::cerr << location; -} - -/* A C++ error reporting function. */ -void -yy::Parser::error_ () -{ - std::cerr << location << ": " << message << std::endl; -} - -int -yyparse () -{ - yy::Parser parser (!!YYDEBUG, yy::Location::Location ()); - return parser.parse (); -} - - - - -static YYLTYPE last_yylloc; - -static int -yygetc (YYSTYPE *yylval, YYLTYPE *yylloc) -{ - int res = getc (yyin); - (void) yylval;(void) yylloc; - - last_yylloc = (*yylloc); - if (res == '\n') - { - (*yylloc).end.line++; - (*yylloc).end.column = 0; - } - else - (*yylloc).end.column++; - - return res; -} - - -static void -yyungetc (YYSTYPE *yylval, YYLTYPE *yylloc, int c) -{ - (void) yylval;(void) yylloc; - - /* Wrong when C == `\n'. */ - (*yylloc) = last_yylloc; - - ungetc (c, yyin); -} - -static int -read_signed_integer (YYSTYPE *yylval, YYLTYPE *yylloc) -{ - int c = yygetc (yylval, yylloc); - int sign = 1; - int n = 0; - - (void) yylval;(void) yylloc; - if (c == '-') - { - c = yygetc (yylval, yylloc); - sign = -1; - } - - while (isdigit (c)) - { - n = 10 * n + (c - '0'); - c = yygetc (yylval, yylloc); - } - - yyungetc (yylval, yylloc, c); - - return sign * n; -} - - - -/*---------------------------------------------------------------. -| Lexical analyzer returns an integer on the stack and the token | -| NUM, or the ASCII character read if not a number. Skips all | -| blanks and tabs, returns 0 for EOF. | -`---------------------------------------------------------------*/ - -static int -yylex (YYSTYPE *yylval, YYLTYPE *yylloc) -{ - static int init = 1; - int c; - - if (init) - { - init = 0; - - } - - (*yylloc).begin = (*yylloc).end; - - /* Skip white space. */ - while ((c = yygetc (yylval, yylloc)) == ' ' || c == '\t') - { - (*yylloc).begin = (*yylloc).end; - } - - /* process numbers */ - if (c == '.' || isdigit (c)) - { - yyungetc (yylval, yylloc, c); - (*yylval).ival = read_signed_integer (yylval, yylloc); - return NUM; - } - - /* Return end-of-file. */ - if (c == EOF) - return CALC_EOF; - - /* Return single chars. */ - return c; -} - -static int -power (int base, int exponent) -{ - int res = 1; - if (exponent < 0) - exit (1); - for (/* Niente */; exponent; --exponent) - res *= base; - return res; -} - - -int -main (int argc, const char **argv) -{ - semantic_value result = 0; - int count = 0; - int status; - - alarm (10); - if (argc == 2) - yyin = fopen (argv[1], "r"); - else - yyin = stdin; - - if (!yyin) - { - perror (argv[1]); - exit (1); - } - - - status = yyparse (); - if (global_result != result) - abort (); - if (global_count != count) - abort (); - return status; -} -_ATEOF - - - - - -# Specify the output files to avoid problems on different file systems. -$at_traceoff -echo "calc.at:631: bison -o calc.c calc.y" -echo calc.at:631 >$at_check_line_file -( $at_traceon; bison -o calc.c calc.y ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:631: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - - -$at_traceoff -echo "calc.at:631: \$CXX --version || exit 77" -echo calc.at:631 >$at_check_line_file -( $at_traceon; $CXX --version || exit 77 ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo stderr:; cat $at_stderr -echo stdout:; cat $at_stdout -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:631: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - -$at_traceoff -echo "calc.at:631: \$CXX \$CXXFLAGS \$CPPFLAGS calc.c -o calc" -echo calc.at:631 >$at_check_line_file -( $at_traceon; $CXX $CXXFLAGS $CPPFLAGS calc.c -o calc ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo stderr:; cat $at_stderr -echo stdout:; cat $at_stdout -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:631: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - -# Test the priorities. -cat >input <<'_ATEOF' -1 + 2 * 3 = 7 -1 + 2 * -3 = -5 - --1^2 = -1 -(-1)^2 = 1 - ----1 = -1 - -1 - 2 - 3 = -4 -1 - (2 - 3) = 2 - -2^2^3 = 256 -(2^2)^3 = 64 -_ATEOF - -$at_traceoff -echo "calc.at:631: \$PREPARSER ./calc input" -echo calc.at:631 >$at_check_line_file -( $at_traceon; $PREPARSER ./calc input ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo stderr:; tee stderr <$at_stderr -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:631: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - -$at_traceoff -echo "calc.at:631: wc -l $at_check_line_file -( $at_traceon; wc -l $at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -echo >>$at_stdout; echo "486 -" | $at_diff - $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:631: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - - -# Some syntax errors. -cat >input <<'_ATEOF' -0 0 -_ATEOF - -$at_traceoff -echo "calc.at:631: \$PREPARSER ./calc input" -echo calc.at:631 >$at_check_line_file -( $at_traceon; $PREPARSER ./calc input ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo stderr:; tee stderr <$at_stderr -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 1) ;; - *) echo "calc.at:631: exit code was $at_status, expected 1" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - -$at_traceoff -echo "calc.at:631: wc -l $at_check_line_file -( $at_traceon; wc -l $at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -echo >>$at_stdout; echo "11 -" | $at_diff - $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:631: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - -# Normalize the observed and expected error messages, depending upon the -# options. -# 1. Remove the traces from observed. -sed '/^Starting/d -/^Entering/d -/^Stack/d -/^Reading/d -/^Reducing/d -/^Shifting/d -/^state/d -/^Error:/d -/^Next/d -/^Discarding/d -/^yydestructor:/d' stderr >at-stderr -mv at-stderr stderr -# 2. Create the reference error message. -cat >expout <<'_ATEOF' -1.2: syntax error, unexpected "number" -_ATEOF - -# 3. If locations are not used, remove them. - -# 4. If error-verbose is not used, strip the`, unexpected....' part. - -# 5. Check -$at_traceoff -echo "calc.at:631: cat stderr" -echo calc.at:631 >$at_check_line_file -( $at_traceon; cat stderr ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -$at_diff expout $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:631: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - -cat >input <<'_ATEOF' -1//2 -_ATEOF - -$at_traceoff -echo "calc.at:631: \$PREPARSER ./calc input" -echo calc.at:631 >$at_check_line_file -( $at_traceon; $PREPARSER ./calc input ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo stderr:; tee stderr <$at_stderr -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 1) ;; - *) echo "calc.at:631: exit code was $at_status, expected 1" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - -$at_traceoff -echo "calc.at:631: wc -l $at_check_line_file -( $at_traceon; wc -l $at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -echo >>$at_stdout; echo "15 -" | $at_diff - $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:631: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - -# Normalize the observed and expected error messages, depending upon the -# options. -# 1. Remove the traces from observed. -sed '/^Starting/d -/^Entering/d -/^Stack/d -/^Reading/d -/^Reducing/d -/^Shifting/d -/^state/d -/^Error:/d -/^Next/d -/^Discarding/d -/^yydestructor:/d' stderr >at-stderr -mv at-stderr stderr -# 2. Create the reference error message. -cat >expout <<'_ATEOF' -1.2: syntax error, unexpected '/', expecting "number" or '-' or '(' or '!' -_ATEOF - -# 3. If locations are not used, remove them. - -# 4. If error-verbose is not used, strip the`, unexpected....' part. - -# 5. Check -$at_traceoff -echo "calc.at:631: cat stderr" -echo calc.at:631 >$at_check_line_file -( $at_traceon; cat stderr ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -$at_diff expout $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:631: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - -cat >input <<'_ATEOF' -error -_ATEOF - -$at_traceoff -echo "calc.at:631: \$PREPARSER ./calc input" -echo calc.at:631 >$at_check_line_file -( $at_traceon; $PREPARSER ./calc input ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo stderr:; tee stderr <$at_stderr -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 1) ;; - *) echo "calc.at:631: exit code was $at_status, expected 1" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - -$at_traceoff -echo "calc.at:631: wc -l $at_check_line_file -( $at_traceon; wc -l $at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -echo >>$at_stdout; echo "4 -" | $at_diff - $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:631: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - -# Normalize the observed and expected error messages, depending upon the -# options. -# 1. Remove the traces from observed. -sed '/^Starting/d -/^Entering/d -/^Stack/d -/^Reading/d -/^Reducing/d -/^Shifting/d -/^state/d -/^Error:/d -/^Next/d -/^Discarding/d -/^yydestructor:/d' stderr >at-stderr -mv at-stderr stderr -# 2. Create the reference error message. -cat >expout <<'_ATEOF' -1.0: syntax error, unexpected $undefined -_ATEOF - -# 3. If locations are not used, remove them. - -# 4. If error-verbose is not used, strip the`, unexpected....' part. - -# 5. Check -$at_traceoff -echo "calc.at:631: cat stderr" -echo calc.at:631 >$at_check_line_file -( $at_traceon; cat stderr ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -$at_diff expout $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:631: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - -cat >input <<'_ATEOF' -1 = 2 = 3 -_ATEOF - -$at_traceoff -echo "calc.at:631: \$PREPARSER ./calc input" -echo calc.at:631 >$at_check_line_file -( $at_traceon; $PREPARSER ./calc input ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo stderr:; tee stderr <$at_stderr -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 1) ;; - *) echo "calc.at:631: exit code was $at_status, expected 1" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - -$at_traceoff -echo "calc.at:631: wc -l $at_check_line_file -( $at_traceon; wc -l $at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -echo >>$at_stdout; echo "22 -" | $at_diff - $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:631: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - -# Normalize the observed and expected error messages, depending upon the -# options. -# 1. Remove the traces from observed. -sed '/^Starting/d -/^Entering/d -/^Stack/d -/^Reading/d -/^Reducing/d -/^Shifting/d -/^state/d -/^Error:/d -/^Next/d -/^Discarding/d -/^yydestructor:/d' stderr >at-stderr -mv at-stderr stderr -# 2. Create the reference error message. -cat >expout <<'_ATEOF' -1.6: syntax error, unexpected '=' -_ATEOF - -# 3. If locations are not used, remove them. - -# 4. If error-verbose is not used, strip the`, unexpected....' part. - -# 5. Check -$at_traceoff -echo "calc.at:631: cat stderr" -echo calc.at:631 >$at_check_line_file -( $at_traceon; cat stderr ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -$at_diff expout $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:631: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - -cat >input <<'_ATEOF' - -+1 -_ATEOF - -$at_traceoff -echo "calc.at:631: \$PREPARSER ./calc input" -echo calc.at:631 >$at_check_line_file -( $at_traceon; $PREPARSER ./calc input ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo stderr:; tee stderr <$at_stderr -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 1) ;; - *) echo "calc.at:631: exit code was $at_status, expected 1" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - -$at_traceoff -echo "calc.at:631: wc -l $at_check_line_file -( $at_traceon; wc -l $at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -echo >>$at_stdout; echo "14 -" | $at_diff - $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:631: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - -# Normalize the observed and expected error messages, depending upon the -# options. -# 1. Remove the traces from observed. -sed '/^Starting/d -/^Entering/d -/^Stack/d -/^Reading/d -/^Reducing/d -/^Shifting/d -/^state/d -/^Error:/d -/^Next/d -/^Discarding/d -/^yydestructor:/d' stderr >at-stderr -mv at-stderr stderr -# 2. Create the reference error message. -cat >expout <<'_ATEOF' -2.0: syntax error, unexpected '+' -_ATEOF - -# 3. If locations are not used, remove them. - -# 4. If error-verbose is not used, strip the`, unexpected....' part. - -# 5. Check -$at_traceoff -echo "calc.at:631: cat stderr" -echo calc.at:631 >$at_check_line_file -( $at_traceon; cat stderr ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -$at_diff expout $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:631: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - -# Exercise error messages with EOF: work on an empty file. -$at_traceoff -echo "calc.at:631: \$PREPARSER ./calc /dev/null" -echo calc.at:631 >$at_check_line_file -( $at_traceon; $PREPARSER ./calc /dev/null ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo stderr:; tee stderr <$at_stderr -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 1) ;; - *) echo "calc.at:631: exit code was $at_status, expected 1" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - -$at_traceoff -echo "calc.at:631: wc -l $at_check_line_file -( $at_traceon; wc -l $at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -echo >>$at_stdout; echo "4 -" | $at_diff - $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:631: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - -# Normalize the observed and expected error messages, depending upon the -# options. -# 1. Remove the traces from observed. -sed '/^Starting/d -/^Entering/d -/^Stack/d -/^Reading/d -/^Reducing/d -/^Shifting/d -/^state/d -/^Error:/d -/^Next/d -/^Discarding/d -/^yydestructor:/d' stderr >at-stderr -mv at-stderr stderr -# 2. Create the reference error message. -cat >expout <<'_ATEOF' -1.0: syntax error, unexpected "end of input" -_ATEOF - -# 3. If locations are not used, remove them. - -# 4. If error-verbose is not used, strip the`, unexpected....' part. - -# 5. Check -$at_traceoff -echo "calc.at:631: cat stderr" -echo calc.at:631 >$at_check_line_file -( $at_traceon; cat stderr ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -$at_diff expout $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:631: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - - -# Exercise the error token: without it, we die at the first error, -# hence be sure to -# -# - have several errors which exercise different shift/discardings -# - (): nothing to pop, nothing to discard -# - (1 + 1 + 1 +): a lot to pop, nothing to discard -# - (* * *): nothing to pop, a lot to discard -# - (1 + 2 * *): some to pop and discard -# -# - test the action associated to `error' -# -# - check the lookahead that triggers an error is not discarded -# when we enter error recovery. Below, the lookahead causing the -# first error is ")", which is needed to recover from the error and -# produce the "0" that triggers the "0 != 1" error. -# -cat >input <<'_ATEOF' -() + (1 + 1 + 1 +) + (* * *) + (1 * 2 * *) = 1 -_ATEOF - -$at_traceoff -echo "calc.at:631: \$PREPARSER ./calc input" -echo calc.at:631 >$at_check_line_file -( $at_traceon; $PREPARSER ./calc input ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo stderr:; tee stderr <$at_stderr -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:631: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - -$at_traceoff -echo "calc.at:631: wc -l $at_check_line_file -( $at_traceon; wc -l $at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -echo >>$at_stdout; echo "156 -" | $at_diff - $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:631: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - -# Normalize the observed and expected error messages, depending upon the -# options. -# 1. Remove the traces from observed. -sed '/^Starting/d -/^Entering/d -/^Stack/d -/^Reading/d -/^Reducing/d -/^Shifting/d -/^state/d -/^Error:/d -/^Next/d -/^Discarding/d -/^yydestructor:/d' stderr >at-stderr -mv at-stderr stderr -# 2. Create the reference error message. -cat >expout <<'_ATEOF' -1.1: syntax error, unexpected ')', expecting "number" or '-' or '(' or '!' -1.17: syntax error, unexpected ')', expecting "number" or '-' or '(' or '!' -1.22: syntax error, unexpected '*', expecting "number" or '-' or '(' or '!' -1.40: syntax error, unexpected '*', expecting "number" or '-' or '(' or '!' -calc: error: 4444 != 1 -_ATEOF - -# 3. If locations are not used, remove them. - -# 4. If error-verbose is not used, strip the`, unexpected....' part. - -# 5. Check -$at_traceoff -echo "calc.at:631: cat stderr" -echo calc.at:631 >$at_check_line_file -( $at_traceon; cat stderr ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -$at_diff expout $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:631: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - - -# The same, but this time exercising explicitly triggered syntax errors. -# POSIX says the lookahead causing the error should not be discarded. -cat >input <<'_ATEOF' -(!) + (0 0) = 1 -_ATEOF - -$at_traceoff -echo "calc.at:631: \$PREPARSER ./calc input" -echo calc.at:631 >$at_check_line_file -( $at_traceon; $PREPARSER ./calc input ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo stderr:; tee stderr <$at_stderr -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:631: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - -$at_traceoff -echo "calc.at:631: wc -l $at_check_line_file -( $at_traceon; wc -l $at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -echo >>$at_stdout; echo "62 -" | $at_diff - $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:631: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - -# Normalize the observed and expected error messages, depending upon the -# options. -# 1. Remove the traces from observed. -sed '/^Starting/d -/^Entering/d -/^Stack/d -/^Reading/d -/^Reducing/d -/^Shifting/d -/^state/d -/^Error:/d -/^Next/d -/^Discarding/d -/^yydestructor:/d' stderr >at-stderr -mv at-stderr stderr -# 2. Create the reference error message. -cat >expout <<'_ATEOF' -1.9: syntax error, unexpected "number" -calc: error: 2222 != 1 -_ATEOF - -# 3. If locations are not used, remove them. - -# 4. If error-verbose is not used, strip the`, unexpected....' part. - -# 5. Check -$at_traceoff -echo "calc.at:631: cat stderr" -echo calc.at:631 >$at_check_line_file -( $at_traceon; cat stderr ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -$at_diff expout $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:631: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - -cat >input <<'_ATEOF' -(- *) + (0 0) = 1 -_ATEOF - -$at_traceoff -echo "calc.at:631: \$PREPARSER ./calc input" -echo calc.at:631 >$at_check_line_file -( $at_traceon; $PREPARSER ./calc input ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo stderr:; tee stderr <$at_stderr -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:631: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - -$at_traceoff -echo "calc.at:631: wc -l $at_check_line_file -( $at_traceon; wc -l $at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -echo >>$at_stdout; echo "70 -" | $at_diff - $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:631: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - -# Normalize the observed and expected error messages, depending upon the -# options. -# 1. Remove the traces from observed. -sed '/^Starting/d -/^Entering/d -/^Stack/d -/^Reading/d -/^Reducing/d -/^Shifting/d -/^state/d -/^Error:/d -/^Next/d -/^Discarding/d -/^yydestructor:/d' stderr >at-stderr -mv at-stderr stderr -# 2. Create the reference error message. -cat >expout <<'_ATEOF' -1.3: syntax error, unexpected '*', expecting "number" or '-' or '(' or '!' -1.11: syntax error, unexpected "number" -calc: error: 2222 != 1 -_ATEOF - -# 3. If locations are not used, remove them. - -# 4. If error-verbose is not used, strip the`, unexpected....' part. - -# 5. Check -$at_traceoff -echo "calc.at:631: cat stderr" -echo calc.at:631 >$at_check_line_file -( $at_traceon; cat stderr ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -$at_diff expout $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:631: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - - - - - - - - - - - - - - - - - - - - - $at_traceoff - $at_times_p && times >$at_times_file - ) 5>&1 2>&1 | eval $at_tee_pipe - at_status=`cat $at_status_file` - ;; - - 89 ) # 89. calc.at:633: Calculator %skeleton "lalr1.cc" %pure-parser %error-verbose %debug %locations %defines %name-prefix="calc" %verbose %yacc %parse-param {semantic_value *result} %parse-param {int *count} - at_setup_line='calc.at:633' - at_desc='Calculator %skeleton "lalr1.cc" %pure-parser %error-verbose %debug %locations %defines %name-prefix="calc" %verbose %yacc %parse-param {semantic_value *result} %parse-param {int *count}' - $at_quiet $ECHO_N " 89: Calculator %skeleton "lalr1.cc" %pure-parser %error-verbose %debug %locations %defines %name-prefix="calc" %verbose %yacc %parse-param {semantic_value *result} %parse-param {int *count}$ECHO_C" - at_xfail=no - ( - echo "89. calc.at:633: testing ..." - $at_traceon - - - - - - -# Using yacc.c? - - - - - - - -# yyerror receives the location if %location & %pure & (%glr or %parse-param). - -# yyerror always sees the locations (when activated), except if -# yacc & pure & !param. - - -# The interface is pure: either because %pure-parser, or because we -# are using the C++ parsers. - - - - - - - - - - - - -cat >calc.y <<'_ATEOF' -%{ -#if HAVE_CONFIG_H -# include - /* We don't need perfect functions for these tests. */ -# undef malloc -# undef memcmp -# undef realloc -#endif -%} - -/* Infix notation calculator--calc */ -%skeleton "lalr1.cc" %pure-parser %error-verbose %debug %locations %defines %name-prefix="calc" %verbose %yacc %parse-param {semantic_value *result} %parse-param {int *count} -%{ -#include - -#include -#include -#if HAVE_UNISTD_H -# include -#else -# undef alarm -# define alarm(seconds) /* empty */ -#endif -#include - -/* Exercise pre-prologue dependency to %union. */ -typedef int semantic_value; - -static semantic_value global_result = 0; -static int global_count = 0; -%} - -/* Exercise %union. */ -%union -{ - semantic_value ival; -}; - -%{ -static int power (int base, int exponent); -typedef yy::Location YYLTYPE; -static int yylex (YYSTYPE *yylval, YYLTYPE *yylloc); -static int yygetc (YYSTYPE *yylval, YYLTYPE *yylloc); -static void yyungetc (YYSTYPE *yylval, YYLTYPE *yylloc, int c); -%} - -/* Bison Declarations */ -%token CALC_EOF 0 "end of input" -%token NUM "number" -%type exp - -%nonassoc '=' /* comparison */ -%left '-' '+' -%left '*' '/' -%left NEG /* negation--unary minus */ -%right '^' /* exponentiation */ - -/* Grammar follows */ -%% -input: - line -| input line { ++*count; ++global_count; } -; - -line: - '\n' -| exp '\n' { *result = global_result = $1; } -; - -exp: - NUM { $$ = $1; } -| exp '=' exp - { - if ($1 != $3) - fprintf (stderr, "calc: error: %d != %d\n", $1, $3); - $$ = $1; - } -| exp '+' exp { $$ = $1 + $3; } -| exp '-' exp { $$ = $1 - $3; } -| exp '*' exp { $$ = $1 * $3; } -| exp '/' exp { $$ = $1 / $3; } -| '-' exp %prec NEG { $$ = -$2; } -| exp '^' exp { $$ = power ($1, $3); } -| '(' exp ')' { $$ = $2; } -| '(' error ')' { $$ = 1111; } -| '!' { YYERROR; } -| '-' error { YYERROR; } -; -%% -/* The input. */ -static FILE *yyin; - -/* Currently, print_ is required in C++. */ -void -yy::Parser::print_ () -{ - - std::cerr << location; -} - -/* A C++ error reporting function. */ -void -yy::Parser::error_ () -{ - std::cerr << location << ": " << message << std::endl; -} - -int -yyparse (semantic_value *result, int *count) -{ - yy::Parser parser (!!YYDEBUG, yy::Location::Location (), result, count); - return parser.parse (); -} - - - - -static YYLTYPE last_yylloc; - -static int -yygetc (YYSTYPE *yylval, YYLTYPE *yylloc) -{ - int res = getc (yyin); - (void) yylval;(void) yylloc; - - last_yylloc = (*yylloc); - if (res == '\n') - { - (*yylloc).end.line++; - (*yylloc).end.column = 0; - } - else - (*yylloc).end.column++; - - return res; -} - - -static void -yyungetc (YYSTYPE *yylval, YYLTYPE *yylloc, int c) -{ - (void) yylval;(void) yylloc; - - /* Wrong when C == `\n'. */ - (*yylloc) = last_yylloc; - - ungetc (c, yyin); -} - -static int -read_signed_integer (YYSTYPE *yylval, YYLTYPE *yylloc) -{ - int c = yygetc (yylval, yylloc); - int sign = 1; - int n = 0; - - (void) yylval;(void) yylloc; - if (c == '-') - { - c = yygetc (yylval, yylloc); - sign = -1; - } - - while (isdigit (c)) - { - n = 10 * n + (c - '0'); - c = yygetc (yylval, yylloc); - } - - yyungetc (yylval, yylloc, c); - - return sign * n; -} - - - -/*---------------------------------------------------------------. -| Lexical analyzer returns an integer on the stack and the token | -| NUM, or the ASCII character read if not a number. Skips all | -| blanks and tabs, returns 0 for EOF. | -`---------------------------------------------------------------*/ - -static int -yylex (YYSTYPE *yylval, YYLTYPE *yylloc) -{ - static int init = 1; - int c; - - if (init) - { - init = 0; - - } - - (*yylloc).begin = (*yylloc).end; - - /* Skip white space. */ - while ((c = yygetc (yylval, yylloc)) == ' ' || c == '\t') - { - (*yylloc).begin = (*yylloc).end; - } - - /* process numbers */ - if (c == '.' || isdigit (c)) - { - yyungetc (yylval, yylloc, c); - (*yylval).ival = read_signed_integer (yylval, yylloc); - return NUM; - } - - /* Return end-of-file. */ - if (c == EOF) - return CALC_EOF; - - /* Return single chars. */ - return c; -} - -static int -power (int base, int exponent) -{ - int res = 1; - if (exponent < 0) - exit (1); - for (/* Niente */; exponent; --exponent) - res *= base; - return res; -} - - -int -main (int argc, const char **argv) -{ - semantic_value result = 0; - int count = 0; - int status; - - alarm (10); - if (argc == 2) - yyin = fopen (argv[1], "r"); - else - yyin = stdin; - - if (!yyin) - { - perror (argv[1]); - exit (1); - } - - - status = yyparse (&result, &count); - if (global_result != result) - abort (); - if (global_count != count) - abort (); - return status; -} -_ATEOF - - - - - -# Specify the output files to avoid problems on different file systems. -$at_traceoff -echo "calc.at:633: bison -o calc.c calc.y" -echo calc.at:633 >$at_check_line_file -( $at_traceon; bison -o calc.c calc.y ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:633: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - - -$at_traceoff -echo "calc.at:633: \$CXX --version || exit 77" -echo calc.at:633 >$at_check_line_file -( $at_traceon; $CXX --version || exit 77 ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo stderr:; cat $at_stderr -echo stdout:; cat $at_stdout -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:633: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - -$at_traceoff -echo "calc.at:633: \$CXX \$CXXFLAGS \$CPPFLAGS calc.c -o calc" -echo calc.at:633 >$at_check_line_file -( $at_traceon; $CXX $CXXFLAGS $CPPFLAGS calc.c -o calc ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo stderr:; cat $at_stderr -echo stdout:; cat $at_stdout -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:633: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - -# Test the priorities. -cat >input <<'_ATEOF' -1 + 2 * 3 = 7 -1 + 2 * -3 = -5 - --1^2 = -1 -(-1)^2 = 1 - ----1 = -1 - -1 - 2 - 3 = -4 -1 - (2 - 3) = 2 - -2^2^3 = 256 -(2^2)^3 = 64 -_ATEOF - -$at_traceoff -echo "calc.at:633: \$PREPARSER ./calc input" -echo calc.at:633 >$at_check_line_file -( $at_traceon; $PREPARSER ./calc input ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo stderr:; tee stderr <$at_stderr -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:633: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - -$at_traceoff -echo "calc.at:633: wc -l $at_check_line_file -( $at_traceon; wc -l $at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -echo >>$at_stdout; echo "486 -" | $at_diff - $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:633: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - - -# Some syntax errors. -cat >input <<'_ATEOF' -0 0 -_ATEOF - -$at_traceoff -echo "calc.at:633: \$PREPARSER ./calc input" -echo calc.at:633 >$at_check_line_file -( $at_traceon; $PREPARSER ./calc input ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo stderr:; tee stderr <$at_stderr -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 1) ;; - *) echo "calc.at:633: exit code was $at_status, expected 1" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - -$at_traceoff -echo "calc.at:633: wc -l $at_check_line_file -( $at_traceon; wc -l $at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -echo >>$at_stdout; echo "11 -" | $at_diff - $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:633: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - -# Normalize the observed and expected error messages, depending upon the -# options. -# 1. Remove the traces from observed. -sed '/^Starting/d -/^Entering/d -/^Stack/d -/^Reading/d -/^Reducing/d -/^Shifting/d -/^state/d -/^Error:/d -/^Next/d -/^Discarding/d -/^yydestructor:/d' stderr >at-stderr -mv at-stderr stderr -# 2. Create the reference error message. -cat >expout <<'_ATEOF' -1.2: syntax error, unexpected "number" -_ATEOF - -# 3. If locations are not used, remove them. - -# 4. If error-verbose is not used, strip the`, unexpected....' part. - -# 5. Check -$at_traceoff -echo "calc.at:633: cat stderr" -echo calc.at:633 >$at_check_line_file -( $at_traceon; cat stderr ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -$at_diff expout $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:633: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - -cat >input <<'_ATEOF' -1//2 -_ATEOF - -$at_traceoff -echo "calc.at:633: \$PREPARSER ./calc input" -echo calc.at:633 >$at_check_line_file -( $at_traceon; $PREPARSER ./calc input ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo stderr:; tee stderr <$at_stderr -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 1) ;; - *) echo "calc.at:633: exit code was $at_status, expected 1" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - -$at_traceoff -echo "calc.at:633: wc -l $at_check_line_file -( $at_traceon; wc -l $at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -echo >>$at_stdout; echo "15 -" | $at_diff - $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:633: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - -# Normalize the observed and expected error messages, depending upon the -# options. -# 1. Remove the traces from observed. -sed '/^Starting/d -/^Entering/d -/^Stack/d -/^Reading/d -/^Reducing/d -/^Shifting/d -/^state/d -/^Error:/d -/^Next/d -/^Discarding/d -/^yydestructor:/d' stderr >at-stderr -mv at-stderr stderr -# 2. Create the reference error message. -cat >expout <<'_ATEOF' -1.2: syntax error, unexpected '/', expecting "number" or '-' or '(' or '!' -_ATEOF - -# 3. If locations are not used, remove them. - -# 4. If error-verbose is not used, strip the`, unexpected....' part. - -# 5. Check -$at_traceoff -echo "calc.at:633: cat stderr" -echo calc.at:633 >$at_check_line_file -( $at_traceon; cat stderr ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -$at_diff expout $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:633: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - -cat >input <<'_ATEOF' -error -_ATEOF - -$at_traceoff -echo "calc.at:633: \$PREPARSER ./calc input" -echo calc.at:633 >$at_check_line_file -( $at_traceon; $PREPARSER ./calc input ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo stderr:; tee stderr <$at_stderr -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 1) ;; - *) echo "calc.at:633: exit code was $at_status, expected 1" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - -$at_traceoff -echo "calc.at:633: wc -l $at_check_line_file -( $at_traceon; wc -l $at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -echo >>$at_stdout; echo "4 -" | $at_diff - $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:633: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - -# Normalize the observed and expected error messages, depending upon the -# options. -# 1. Remove the traces from observed. -sed '/^Starting/d -/^Entering/d -/^Stack/d -/^Reading/d -/^Reducing/d -/^Shifting/d -/^state/d -/^Error:/d -/^Next/d -/^Discarding/d -/^yydestructor:/d' stderr >at-stderr -mv at-stderr stderr -# 2. Create the reference error message. -cat >expout <<'_ATEOF' -1.0: syntax error, unexpected $undefined -_ATEOF - -# 3. If locations are not used, remove them. - -# 4. If error-verbose is not used, strip the`, unexpected....' part. - -# 5. Check -$at_traceoff -echo "calc.at:633: cat stderr" -echo calc.at:633 >$at_check_line_file -( $at_traceon; cat stderr ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -$at_diff expout $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:633: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - -cat >input <<'_ATEOF' -1 = 2 = 3 -_ATEOF - -$at_traceoff -echo "calc.at:633: \$PREPARSER ./calc input" -echo calc.at:633 >$at_check_line_file -( $at_traceon; $PREPARSER ./calc input ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo stderr:; tee stderr <$at_stderr -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 1) ;; - *) echo "calc.at:633: exit code was $at_status, expected 1" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - -$at_traceoff -echo "calc.at:633: wc -l $at_check_line_file -( $at_traceon; wc -l $at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -echo >>$at_stdout; echo "22 -" | $at_diff - $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:633: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - -# Normalize the observed and expected error messages, depending upon the -# options. -# 1. Remove the traces from observed. -sed '/^Starting/d -/^Entering/d -/^Stack/d -/^Reading/d -/^Reducing/d -/^Shifting/d -/^state/d -/^Error:/d -/^Next/d -/^Discarding/d -/^yydestructor:/d' stderr >at-stderr -mv at-stderr stderr -# 2. Create the reference error message. -cat >expout <<'_ATEOF' -1.6: syntax error, unexpected '=' -_ATEOF - -# 3. If locations are not used, remove them. - -# 4. If error-verbose is not used, strip the`, unexpected....' part. - -# 5. Check -$at_traceoff -echo "calc.at:633: cat stderr" -echo calc.at:633 >$at_check_line_file -( $at_traceon; cat stderr ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -$at_diff expout $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:633: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - -cat >input <<'_ATEOF' - -+1 -_ATEOF - -$at_traceoff -echo "calc.at:633: \$PREPARSER ./calc input" -echo calc.at:633 >$at_check_line_file -( $at_traceon; $PREPARSER ./calc input ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo stderr:; tee stderr <$at_stderr -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 1) ;; - *) echo "calc.at:633: exit code was $at_status, expected 1" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - -$at_traceoff -echo "calc.at:633: wc -l $at_check_line_file -( $at_traceon; wc -l $at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -echo >>$at_stdout; echo "14 -" | $at_diff - $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:633: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - -# Normalize the observed and expected error messages, depending upon the -# options. -# 1. Remove the traces from observed. -sed '/^Starting/d -/^Entering/d -/^Stack/d -/^Reading/d -/^Reducing/d -/^Shifting/d -/^state/d -/^Error:/d -/^Next/d -/^Discarding/d -/^yydestructor:/d' stderr >at-stderr -mv at-stderr stderr -# 2. Create the reference error message. -cat >expout <<'_ATEOF' -2.0: syntax error, unexpected '+' -_ATEOF - -# 3. If locations are not used, remove them. - -# 4. If error-verbose is not used, strip the`, unexpected....' part. - -# 5. Check -$at_traceoff -echo "calc.at:633: cat stderr" -echo calc.at:633 >$at_check_line_file -( $at_traceon; cat stderr ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -$at_diff expout $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:633: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - -# Exercise error messages with EOF: work on an empty file. -$at_traceoff -echo "calc.at:633: \$PREPARSER ./calc /dev/null" -echo calc.at:633 >$at_check_line_file -( $at_traceon; $PREPARSER ./calc /dev/null ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo stderr:; tee stderr <$at_stderr -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 1) ;; - *) echo "calc.at:633: exit code was $at_status, expected 1" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - -$at_traceoff -echo "calc.at:633: wc -l $at_check_line_file -( $at_traceon; wc -l $at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -echo >>$at_stdout; echo "4 -" | $at_diff - $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:633: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - -# Normalize the observed and expected error messages, depending upon the -# options. -# 1. Remove the traces from observed. -sed '/^Starting/d -/^Entering/d -/^Stack/d -/^Reading/d -/^Reducing/d -/^Shifting/d -/^state/d -/^Error:/d -/^Next/d -/^Discarding/d -/^yydestructor:/d' stderr >at-stderr -mv at-stderr stderr -# 2. Create the reference error message. -cat >expout <<'_ATEOF' -1.0: syntax error, unexpected "end of input" -_ATEOF - -# 3. If locations are not used, remove them. - -# 4. If error-verbose is not used, strip the`, unexpected....' part. - -# 5. Check -$at_traceoff -echo "calc.at:633: cat stderr" -echo calc.at:633 >$at_check_line_file -( $at_traceon; cat stderr ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -$at_diff expout $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:633: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - - -# Exercise the error token: without it, we die at the first error, -# hence be sure to -# -# - have several errors which exercise different shift/discardings -# - (): nothing to pop, nothing to discard -# - (1 + 1 + 1 +): a lot to pop, nothing to discard -# - (* * *): nothing to pop, a lot to discard -# - (1 + 2 * *): some to pop and discard -# -# - test the action associated to `error' -# -# - check the lookahead that triggers an error is not discarded -# when we enter error recovery. Below, the lookahead causing the -# first error is ")", which is needed to recover from the error and -# produce the "0" that triggers the "0 != 1" error. -# -cat >input <<'_ATEOF' -() + (1 + 1 + 1 +) + (* * *) + (1 * 2 * *) = 1 -_ATEOF - -$at_traceoff -echo "calc.at:633: \$PREPARSER ./calc input" -echo calc.at:633 >$at_check_line_file -( $at_traceon; $PREPARSER ./calc input ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo stderr:; tee stderr <$at_stderr -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:633: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - -$at_traceoff -echo "calc.at:633: wc -l $at_check_line_file -( $at_traceon; wc -l $at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -echo >>$at_stdout; echo "156 -" | $at_diff - $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:633: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - -# Normalize the observed and expected error messages, depending upon the -# options. -# 1. Remove the traces from observed. -sed '/^Starting/d -/^Entering/d -/^Stack/d -/^Reading/d -/^Reducing/d -/^Shifting/d -/^state/d -/^Error:/d -/^Next/d -/^Discarding/d -/^yydestructor:/d' stderr >at-stderr -mv at-stderr stderr -# 2. Create the reference error message. -cat >expout <<'_ATEOF' -1.1: syntax error, unexpected ')', expecting "number" or '-' or '(' or '!' -1.17: syntax error, unexpected ')', expecting "number" or '-' or '(' or '!' -1.22: syntax error, unexpected '*', expecting "number" or '-' or '(' or '!' -1.40: syntax error, unexpected '*', expecting "number" or '-' or '(' or '!' -calc: error: 4444 != 1 -_ATEOF - -# 3. If locations are not used, remove them. - -# 4. If error-verbose is not used, strip the`, unexpected....' part. - -# 5. Check -$at_traceoff -echo "calc.at:633: cat stderr" -echo calc.at:633 >$at_check_line_file -( $at_traceon; cat stderr ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -$at_diff expout $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:633: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - - -# The same, but this time exercising explicitly triggered syntax errors. -# POSIX says the lookahead causing the error should not be discarded. -cat >input <<'_ATEOF' -(!) + (0 0) = 1 -_ATEOF - -$at_traceoff -echo "calc.at:633: \$PREPARSER ./calc input" -echo calc.at:633 >$at_check_line_file -( $at_traceon; $PREPARSER ./calc input ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo stderr:; tee stderr <$at_stderr -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:633: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - -$at_traceoff -echo "calc.at:633: wc -l $at_check_line_file -( $at_traceon; wc -l $at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -echo >>$at_stdout; echo "62 -" | $at_diff - $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:633: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - -# Normalize the observed and expected error messages, depending upon the -# options. -# 1. Remove the traces from observed. -sed '/^Starting/d -/^Entering/d -/^Stack/d -/^Reading/d -/^Reducing/d -/^Shifting/d -/^state/d -/^Error:/d -/^Next/d -/^Discarding/d -/^yydestructor:/d' stderr >at-stderr -mv at-stderr stderr -# 2. Create the reference error message. -cat >expout <<'_ATEOF' -1.9: syntax error, unexpected "number" -calc: error: 2222 != 1 -_ATEOF - -# 3. If locations are not used, remove them. - -# 4. If error-verbose is not used, strip the`, unexpected....' part. - -# 5. Check -$at_traceoff -echo "calc.at:633: cat stderr" -echo calc.at:633 >$at_check_line_file -( $at_traceon; cat stderr ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -$at_diff expout $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:633: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - -cat >input <<'_ATEOF' -(- *) + (0 0) = 1 -_ATEOF - -$at_traceoff -echo "calc.at:633: \$PREPARSER ./calc input" -echo calc.at:633 >$at_check_line_file -( $at_traceon; $PREPARSER ./calc input ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo stderr:; tee stderr <$at_stderr -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:633: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - -$at_traceoff -echo "calc.at:633: wc -l $at_check_line_file -( $at_traceon; wc -l $at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -echo >>$at_stdout; echo "70 -" | $at_diff - $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:633: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - -# Normalize the observed and expected error messages, depending upon the -# options. -# 1. Remove the traces from observed. -sed '/^Starting/d -/^Entering/d -/^Stack/d -/^Reading/d -/^Reducing/d -/^Shifting/d -/^state/d -/^Error:/d -/^Next/d -/^Discarding/d -/^yydestructor:/d' stderr >at-stderr -mv at-stderr stderr -# 2. Create the reference error message. -cat >expout <<'_ATEOF' -1.3: syntax error, unexpected '*', expecting "number" or '-' or '(' or '!' -1.11: syntax error, unexpected "number" -calc: error: 2222 != 1 -_ATEOF - -# 3. If locations are not used, remove them. - -# 4. If error-verbose is not used, strip the`, unexpected....' part. - -# 5. Check -$at_traceoff -echo "calc.at:633: cat stderr" -echo calc.at:633 >$at_check_line_file -( $at_traceon; cat stderr ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -$at_diff expout $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "calc.at:633: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - - - - - - - - - - - - - - - - - - - - - $at_traceoff - $at_times_p && times >$at_times_file - ) 5>&1 2>&1 | eval $at_tee_pipe - at_status=`cat $at_status_file` - ;; - - - banner-12 ) # Banner 12. torture.at:19 - cat <<\_ATEOF - -Torture Tests. - -_ATEOF - ;; - - 90 ) # 90. torture.at:140: Big triangle - at_setup_line='torture.at:140' - at_desc='Big triangle' - $at_quiet $ECHO_N " 90: Big triangle $ECHO_C" - at_xfail=no - ( - echo "90. torture.at:140: testing ..." - $at_traceon - - -# I have been able to go up to 2000 on my machine. -# I tried 3000, a 29Mb grammar file, but then my system killed bison. -# With 500 and the new parser, which consume far too much memory, -# it gets killed too. Of course the parser is to be cleaned. -cat >gengram.pl <<'_ATEOF' -#! /usr/bin/perl -w - -use strict; -my $max = $ARGV[0] || 10; - -print < - /* We don't need perfect functions for these tests. */ -# undef malloc -# undef memcmp -# undef realloc -#endif -%} - -%{ -#include -#include - -#define YYERROR_VERBOSE 1 -#define YYDEBUG 1 - -static int yylex (void); -static void yyerror (const char *msg); -%} -%union -{ - int val; -}; - -%token END "end" -%type exp input -EOF - -for my $size (1 .. $max) - { - print "%token t$size $size \"$size\"\n"; - }; - -print < $max) - return 0; - else if (inner > outer) - { - inner = 1; - ++outer; - return END; - } - return inner++; -} - -static void -yyerror (const char *msg) -{ - fprintf (stderr, "%s\\n", msg); -} - -int -main (void) -{ - yydebug = !!getenv ("YYDEBUG"); - return yyparse (); -} -EOF -_ATEOF - - -$at_traceoff -echo "torture.at:146: perl -w ./gengram.pl 200 || exit 77" -echo torture.at:146 >$at_check_line_file -( $at_traceon; perl -w ./gengram.pl 200 || exit 77 ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -echo stdout:; tee stdout <$at_stdout -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "torture.at:146: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - -mv stdout input.y - -$at_traceoff -echo "torture.at:147: bison -v -o input.c input.y" -echo torture.at:147 >$at_check_line_file -( $at_traceon; bison -v -o input.c input.y ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "torture.at:147: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - -$at_traceoff -echo "torture.at:148: \$CC \$CFLAGS \$CPPFLAGS \$LDFLAGS input.c \$LIBS -o input" -echo torture.at:148 >$at_check_line_file -( $at_traceon; $CC $CFLAGS $CPPFLAGS $LDFLAGS input.c $LIBS -o input ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo stderr:; cat $at_stderr -echo stdout:; cat $at_stdout -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "torture.at:148: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - -$at_traceoff -echo "torture.at:149: \$PREPARSER ./input" -echo torture.at:149 >$at_check_line_file -( $at_traceon; $PREPARSER ./input ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "torture.at:149: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - - $at_traceoff - $at_times_p && times >$at_times_file - ) 5>&1 2>&1 | eval $at_tee_pipe - at_status=`cat $at_status_file` - ;; - - 91 ) # 91. torture.at:231: Big horizontal - at_setup_line='torture.at:231' - at_desc='Big horizontal' - $at_quiet $ECHO_N " 91: Big horizontal $ECHO_C" - at_xfail=no - ( - echo "91. torture.at:231: testing ..." - $at_traceon - - -# I have been able to go up to 10000 on my machine, but I had to -# increase the maximum stack size (* 100). It gave: -# -# input.y 263k -# input.tab.c 1.3M -# input 453k -# -# gengram.pl 10000 0.70s user 0.01s sys 99% cpu 0.711 total -# bison input.y 730.56s user 0.53s sys 99% cpu 12:12.34 total -# gcc -Wall input.tab.c -o input 5.81s user 0.20s sys 100% cpu 6.01 total -# ./input 0.00s user 0.01s sys 108% cpu 0.01 total -# -cat >gengram.pl <<'_ATEOF' -#! /usr/bin/perl -w - -use strict; -my $max = $ARGV[0] || 10; - -print < - /* We don't need perfect functions for these tests. */ -# undef malloc -# undef memcmp -# undef realloc -#endif -%} - -%{ -#include -#include - -#define YYERROR_VERBOSE 1 -#define YYDEBUG 1 - -static int yylex (void); -static void yyerror (const char *msg); -%} -EOF - -for my $size (1 .. $max) - { - print "%token t$size $size \"$size\"\n"; - }; - -print < $max) - return 0; - else - return counter++; -} - -static void -yyerror (const char *msg) -{ - fprintf (stderr, "%s\\n", msg); -} - -int -main (void) -{ - yydebug = !!getenv ("YYDEBUG"); - return yyparse (); -} -EOF -_ATEOF - - -$at_traceoff -echo "torture.at:245: perl -w ./gengram.pl 1000 || exit 77" -echo torture.at:245 >$at_check_line_file -( $at_traceon; perl -w ./gengram.pl 1000 || exit 77 ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -echo stdout:; tee stdout <$at_stdout -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "torture.at:245: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - -mv stdout input.y - - -# GNU m4 requires about 70 MiB for this test on a 32-bit host. -# Ask for 200 MiB, which should be plenty even on a 64-bit host. -data_limit=`(ulimit -S -d) 2>/dev/null` -case $data_limit in -[0-9]*) - if test "$data_limit" -lt 204000; then - ulimit -S -d 204000 - fi -esac - -$at_traceoff -echo "torture.at:251: bison -v -o input.c input.y" -echo torture.at:251 >$at_check_line_file -( $at_traceon; bison -v -o input.c input.y ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "torture.at:251: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - -$at_traceoff -echo "torture.at:252: \$CC \$CFLAGS \$CPPFLAGS \$LDFLAGS input.c \$LIBS -o input" -echo torture.at:252 >$at_check_line_file -( $at_traceon; $CC $CFLAGS $CPPFLAGS $LDFLAGS input.c $LIBS -o input ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo stderr:; cat $at_stderr -echo stdout:; cat $at_stdout -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "torture.at:252: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - -$at_traceoff -echo "torture.at:253: \$PREPARSER ./input" -echo torture.at:253 >$at_check_line_file -( $at_traceon; $PREPARSER ./input ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "torture.at:253: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - - $at_traceoff - $at_times_p && times >$at_times_file - ) 5>&1 2>&1 | eval $at_tee_pipe - at_status=`cat $at_status_file` - ;; - - 92 ) # 92. torture.at:366: Many lookaheads - at_setup_line='torture.at:366' - at_desc='Many lookaheads' - $at_quiet $ECHO_N " 92: Many lookaheads $ECHO_C" - at_xfail=no - ( - echo "92. torture.at:366: testing ..." - $at_traceon - - -cat >gengram.pl <<'_ATEOF' -#! /usr/bin/perl -w - -use strict; -use Text::Wrap; -my $max = $ARGV[0] || 10; - -print < -#include - -#define YYERROR_VERBOSE 1 -#define YYDEBUG 1 - -static int yylex (void); -static void yyerror (const char *msg); -%} -%union -{ - int val; -}; - -%type input exp -%token token -EOF - -print - wrap ("%type ", - " ", - map { "n$_" } (1 .. $max)), - "\n"; - -for my $count (1 .. $max) - { - print "%token t$count $count \"$count\"\n"; - }; - -print < $max) - return 0; - if (return_token) - { - return_token = 0; - return token; - } - return_token = 1; - return counter++; -} - -static void -yyerror (const char *msg) -{ - fprintf (stderr, "%s\\n", msg); -} - -int -main (void) -{ - yydebug = !!getenv ("YYDEBUG"); - return yyparse (); -} -EOF -_ATEOF - - -$at_traceoff -echo "torture.at:368: perl -w ./gengram.pl 1000 || exit 77" -echo torture.at:368 >$at_check_line_file -( $at_traceon; perl -w ./gengram.pl 1000 || exit 77 ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -echo stdout:; tee stdout <$at_stdout -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "torture.at:368: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - -mv stdout input.y - - -# GNU m4 requires about 70 MiB for this test on a 32-bit host. -# Ask for 200 MiB, which should be plenty even on a 64-bit host. -data_limit=`(ulimit -S -d) 2>/dev/null` -case $data_limit in -[0-9]*) - if test "$data_limit" -lt 204000; then - ulimit -S -d 204000 - fi -esac - -$at_traceoff -echo "torture.at:374: bison -v -o input.c input.y" -echo torture.at:374 >$at_check_line_file -( $at_traceon; bison -v -o input.c input.y ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "torture.at:374: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - -$at_traceoff -echo "torture.at:375: \$CC \$CFLAGS \$CPPFLAGS \$LDFLAGS input.c \$LIBS -o input" -echo torture.at:375 >$at_check_line_file -( $at_traceon; $CC $CFLAGS $CPPFLAGS $LDFLAGS input.c $LIBS -o input ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo stderr:; cat $at_stderr -echo stdout:; cat $at_stdout -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "torture.at:375: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - -$at_traceoff -echo "torture.at:376: \$PREPARSER ./input" -echo torture.at:376 >$at_check_line_file -( $at_traceon; $PREPARSER ./input ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "torture.at:376: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - - $at_traceoff - $at_times_p && times >$at_times_file - ) 5>&1 2>&1 | eval $at_tee_pipe - at_status=`cat $at_status_file` - ;; - - 93 ) # 93. torture.at:440: Exploding the Stack Size with Alloca - at_setup_line='torture.at:440' - at_desc='Exploding the Stack Size with Alloca' - $at_quiet $ECHO_N " 93: Exploding the Stack Size with Alloca $ECHO_C" - at_xfail=no - ( - echo "93. torture.at:440: testing ..." - $at_traceon - - -# A grammar of parens growing the stack thanks to right recursion. -# exp: -cat >input.y <<'_ATEOF' -%{ -#include -#include - - static int yylex (void); - static void yyerror (const char *msg); -%} -%error-verbose -%debug -%token WAIT_FOR_EOF -%% -exp: WAIT_FOR_EOF exp | ; -%% -static void -yyerror (const char *msg) -{ - fprintf (stderr, "%s\n", msg); - exit (1); -} - -/* There are YYLVAL_MAX of WAIT_FOR_EOFs. */ -unsigned int yylval_max; - -static int -yylex (void) -{ - if (yylval--) - return WAIT_FOR_EOF; - else - return EOF; -} - -int -main (int argc, const char **argv) -{ - if (argc != 2) - abort (); - yylval = atoi (argv[1]); - yydebug = 1; - return yyparse (); -} -_ATEOF - -$at_traceoff -echo "torture.at:442: bison -o input.c input.y" -echo torture.at:442 >$at_check_line_file -( $at_traceon; bison -o input.c input.y ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "torture.at:442: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - -$at_traceoff -echo "torture.at:442: \$CC \$CFLAGS \$CPPFLAGS \$LDFLAGS input.c \$LIBS -o input" -echo torture.at:442 >$at_check_line_file -( $at_traceon; $CC $CFLAGS $CPPFLAGS $LDFLAGS input.c $LIBS -o input ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo stderr:; cat $at_stderr -echo stdout:; cat $at_stdout -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "torture.at:442: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - - -# Below the limit of 200. -$at_traceoff -echo "torture.at:445: \$PREPARSER ./input 20" -echo torture.at:445 >$at_check_line_file -( $at_traceon; $PREPARSER ./input 20 ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo stderr:; cat $at_stderr -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "torture.at:445: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - -# Two enlargements: 2 * 2 * 200. -$at_traceoff -echo "torture.at:447: \$PREPARSER ./input 900" -echo torture.at:447 >$at_check_line_file -( $at_traceon; $PREPARSER ./input 900 ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo stderr:; cat $at_stderr -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "torture.at:447: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - -# Fails: beyond the limit of 10,000 (which we don't reach anyway since we -# multiply by two starting at 200 => 5120 is the last possible). -$at_traceoff -echo "torture.at:450: \$PREPARSER ./input 10000" -echo torture.at:450 >$at_check_line_file -( $at_traceon; $PREPARSER ./input 10000 ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo stderr:; cat $at_stderr -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 1) ;; - *) echo "torture.at:450: exit code was $at_status, expected 1" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - - $at_traceoff - $at_times_p && times >$at_times_file - ) 5>&1 2>&1 | eval $at_tee_pipe - at_status=`cat $at_status_file` - ;; - - 94 ) # 94. torture.at:461: Exploding the Stack Size with Malloc - at_setup_line='torture.at:461' - at_desc='Exploding the Stack Size with Malloc' - $at_quiet $ECHO_N " 94: Exploding the Stack Size with Malloc $ECHO_C" - at_xfail=no - ( - echo "94. torture.at:461: testing ..." - $at_traceon - - -# A grammar of parens growing the stack thanks to right recursion. -# exp: -cat >input.y <<'_ATEOF' -%{ -#include -#include -#define YYSTACK_USE_ALLOCA 0 - static int yylex (void); - static void yyerror (const char *msg); -%} -%error-verbose -%debug -%token WAIT_FOR_EOF -%% -exp: WAIT_FOR_EOF exp | ; -%% -static void -yyerror (const char *msg) -{ - fprintf (stderr, "%s\n", msg); - exit (1); -} - -/* There are YYLVAL_MAX of WAIT_FOR_EOFs. */ -unsigned int yylval_max; - -static int -yylex (void) -{ - if (yylval--) - return WAIT_FOR_EOF; - else - return EOF; -} - -int -main (int argc, const char **argv) -{ - if (argc != 2) - abort (); - yylval = atoi (argv[1]); - yydebug = 1; - return yyparse (); -} -_ATEOF - -$at_traceoff -echo "torture.at:463: bison -o input.c input.y" -echo torture.at:463 >$at_check_line_file -( $at_traceon; bison -o input.c input.y ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "torture.at:463: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - -$at_traceoff -echo "torture.at:463: \$CC \$CFLAGS \$CPPFLAGS \$LDFLAGS input.c \$LIBS -o input" -echo torture.at:463 >$at_check_line_file -( $at_traceon; $CC $CFLAGS $CPPFLAGS $LDFLAGS input.c $LIBS -o input ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo stderr:; cat $at_stderr -echo stdout:; cat $at_stdout -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "torture.at:463: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - - -# Below the limit of 200. -$at_traceoff -echo "torture.at:466: \$PREPARSER ./input 20" -echo torture.at:466 >$at_check_line_file -( $at_traceon; $PREPARSER ./input 20 ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo stderr:; cat $at_stderr -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "torture.at:466: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - -# Two enlargements: 2 * 2 * 200. -$at_traceoff -echo "torture.at:468: \$PREPARSER ./input 900" -echo torture.at:468 >$at_check_line_file -( $at_traceon; $PREPARSER ./input 900 ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo stderr:; cat $at_stderr -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "torture.at:468: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - -# Fails: beyond the limit of 10,000 (which we don't reach anyway since we -# multiply by two starting at 200 => 5120 is the possible). -$at_traceoff -echo "torture.at:471: \$PREPARSER ./input 10000" -echo torture.at:471 >$at_check_line_file -( $at_traceon; $PREPARSER ./input 10000 ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo stderr:; cat $at_stderr -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 1) ;; - *) echo "torture.at:471: exit code was $at_status, expected 1" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - - $at_traceoff - $at_times_p && times >$at_times_file - ) 5>&1 2>&1 | eval $at_tee_pipe - at_status=`cat $at_status_file` - ;; - - - banner-13 ) # Banner 13. existing.at:21 - cat <<\_ATEOF - -Existing Grammars. - -_ATEOF - ;; - - 95 ) # 95. existing.at:26: GNU AWK Grammar - at_setup_line='existing.at:26' - at_desc='GNU AWK Grammar' - $at_quiet $ECHO_N " 95: GNU AWK Grammar $ECHO_C" - at_xfail=no - ( - echo "95. existing.at:26: testing ..." - $at_traceon - - -# We have been careful to strip all the actions excepts the -# mid-rule actions. We rely on %expect to check that there are -# indeed 65 SR conflicts. -# -# Bison was once wrong, due to an incorrect computation of nullable. -# It reported 485 SR conflicts! - -cat >input.y <<'_ATEOF' -%expect 65 - -%token FUNC_CALL NAME REGEXP -%token ERROR -%token YNUMBER YSTRING -%token RELOP APPEND_OP -%token ASSIGNOP MATCHOP NEWLINE CONCAT_OP -%token LEX_BEGIN LEX_END LEX_IF LEX_ELSE LEX_RETURN LEX_DELETE -%token LEX_WHILE LEX_DO LEX_FOR LEX_BREAK LEX_CONTINUE -%token LEX_PRINT LEX_PRINTF LEX_NEXT LEX_EXIT LEX_FUNCTION -%token LEX_GETLINE LEX_NEXTFILE -%token LEX_IN -%token LEX_AND LEX_OR INCREMENT DECREMENT -%token LEX_BUILTIN LEX_LENGTH - -/* Lowest to highest */ -%right ASSIGNOP -%right '?' ':' -%left LEX_OR -%left LEX_AND -%left LEX_GETLINE -%nonassoc LEX_IN -%left FUNC_CALL LEX_BUILTIN LEX_LENGTH -%nonassoc ',' -%nonassoc MATCHOP -%nonassoc RELOP '<' '>' '|' APPEND_OP TWOWAYIO -%left CONCAT_OP -%left YSTRING YNUMBER -%left '+' '-' -%left '*' '/' '%' -%right '!' UNARY -%right '^' -%left INCREMENT DECREMENT -%left '$' -%left '(' ')' -%% - -start - : opt_nls program opt_nls - ; - -program - : rule - | program rule - | error - | program error - | /* empty */ - ; - -rule - : LEX_BEGIN {} action - | LEX_END {} action - | LEX_BEGIN statement_term - | LEX_END statement_term - | pattern action - | action - | pattern statement_term - | function_prologue function_body - ; - -func_name - : NAME - | FUNC_CALL - | lex_builtin - ; - -lex_builtin - : LEX_BUILTIN - | LEX_LENGTH - ; - -function_prologue - : LEX_FUNCTION {} func_name '(' opt_param_list r_paren opt_nls - ; - -function_body - : l_brace statements r_brace opt_semi opt_nls - | l_brace r_brace opt_semi opt_nls - ; - - -pattern - : exp - | exp ',' exp - ; - -regexp - /* - * In this rule, want_regexp tells yylex that the next thing - * is a regexp so it should read up to the closing slash. - */ - : '/' {} REGEXP '/' - ; - -action - : l_brace statements r_brace opt_semi opt_nls - | l_brace r_brace opt_semi opt_nls - ; - -statements - : statement - | statements statement - | error - | statements error - ; - -statement_term - : nls - | semi opt_nls - ; - -statement - : semi opt_nls - | l_brace r_brace - | l_brace statements r_brace - | if_statement - | LEX_WHILE '(' exp r_paren opt_nls statement - | LEX_DO opt_nls statement LEX_WHILE '(' exp r_paren opt_nls - | LEX_FOR '(' NAME LEX_IN NAME r_paren opt_nls statement - | LEX_FOR '(' opt_exp semi opt_nls exp semi opt_nls opt_exp r_paren opt_nls statement - | LEX_FOR '(' opt_exp semi opt_nls semi opt_nls opt_exp r_paren opt_nls statement - | LEX_BREAK statement_term - | LEX_CONTINUE statement_term - | print '(' expression_list r_paren output_redir statement_term - | print opt_rexpression_list output_redir statement_term - | LEX_NEXT statement_term - | LEX_NEXTFILE statement_term - | LEX_EXIT opt_exp statement_term - | LEX_RETURN {} opt_exp statement_term - | LEX_DELETE NAME '[' expression_list ']' statement_term - | LEX_DELETE NAME statement_term - | exp statement_term - ; - -print - : LEX_PRINT - | LEX_PRINTF - ; - -if_statement - : LEX_IF '(' exp r_paren opt_nls statement - | LEX_IF '(' exp r_paren opt_nls statement - LEX_ELSE opt_nls statement - ; - -nls - : NEWLINE - | nls NEWLINE - ; - -opt_nls - : /* empty */ - | nls - ; - -input_redir - : /* empty */ - | '<' simp_exp - ; - -output_redir - : /* empty */ - | '>' exp - | APPEND_OP exp - | '|' exp - | TWOWAYIO exp - ; - -opt_param_list - : /* empty */ - | param_list - ; - -param_list - : NAME - | param_list comma NAME - | error - | param_list error - | param_list comma error - ; - -/* optional expression, as in for loop */ -opt_exp - : /* empty */ - | exp - ; - -opt_rexpression_list - : /* empty */ - | rexpression_list - ; - -rexpression_list - : rexp - | rexpression_list comma rexp - | error - | rexpression_list error - | rexpression_list error rexp - | rexpression_list comma error - ; - -opt_expression_list - : /* empty */ - | expression_list - ; - -expression_list - : exp - | expression_list comma exp - | error - | expression_list error - | expression_list error exp - | expression_list comma error - ; - -/* Expressions, not including the comma operator. */ -exp : variable ASSIGNOP {} exp - | '(' expression_list r_paren LEX_IN NAME - | exp '|' LEX_GETLINE opt_variable - | exp TWOWAYIO LEX_GETLINE opt_variable - | LEX_GETLINE opt_variable input_redir - | exp LEX_AND exp - | exp LEX_OR exp - | exp MATCHOP exp - | regexp - | '!' regexp %prec UNARY - | exp LEX_IN NAME - | exp RELOP exp - | exp '<' exp - | exp '>' exp - | exp '?' exp ':' exp - | simp_exp - | exp simp_exp %prec CONCAT_OP - ; - -rexp - : variable ASSIGNOP {} rexp - | rexp LEX_AND rexp - | rexp LEX_OR rexp - | LEX_GETLINE opt_variable input_redir - | regexp - | '!' regexp %prec UNARY - | rexp MATCHOP rexp - | rexp LEX_IN NAME - | rexp RELOP rexp - | rexp '?' rexp ':' rexp - | simp_exp - | rexp simp_exp %prec CONCAT_OP - ; - -simp_exp - : non_post_simp_exp - /* Binary operators in order of decreasing precedence. */ - | simp_exp '^' simp_exp - | simp_exp '*' simp_exp - | simp_exp '/' simp_exp - | simp_exp '%' simp_exp - | simp_exp '+' simp_exp - | simp_exp '-' simp_exp - | variable INCREMENT - | variable DECREMENT - ; - -non_post_simp_exp - : '!' simp_exp %prec UNARY - | '(' exp r_paren - | LEX_BUILTIN - '(' opt_expression_list r_paren - | LEX_LENGTH '(' opt_expression_list r_paren - | LEX_LENGTH - | FUNC_CALL '(' opt_expression_list r_paren - | variable - | INCREMENT variable - | DECREMENT variable - | YNUMBER - | YSTRING - | '-' simp_exp %prec UNARY - | '+' simp_exp %prec UNARY - ; - -opt_variable - : /* empty */ - | variable - ; - -variable - : NAME - | NAME '[' expression_list ']' - | '$' non_post_simp_exp - ; - -l_brace - : '{' opt_nls - ; - -r_brace - : '}' opt_nls - ; - -r_paren - : ')' - ; - -opt_semi - : /* empty */ - | semi - ; - -semi - : ';' - ; - -comma : ',' opt_nls - ; - -%% -_ATEOF - - -# Pass plenty of options, to exercise plenty of code, even if we -# don't actually check the output. But SEGV is watching us, and -# so might do dmalloc. -$at_traceoff -echo "existing.at:357: bison --verbose --defines input.y" -echo existing.at:357 >$at_check_line_file -( $at_traceon; bison --verbose --defines input.y ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "existing.at:357: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - - $at_traceoff - $at_times_p && times >$at_times_file - ) 5>&1 2>&1 | eval $at_tee_pipe - at_status=`cat $at_status_file` - ;; - - 96 ) # 96. existing.at:366: GNU Cim Grammar - at_setup_line='existing.at:366' - at_desc='GNU Cim Grammar' - $at_quiet $ECHO_N " 96: GNU Cim Grammar $ECHO_C" - at_xfail=no - ( - echo "96. existing.at:366: testing ..." - $at_traceon - - -# GNU Cim, the GNU Simula 87 Compiler. - -# Bison was once wrong, due to an incorrect computation of the RR conflicts. -# It reported 80 SR && 99 RR conflicts instead of 78/10!!! - -cat >input.y <<'_ATEOF' -%union { - long int token; - long int ival; - long int arrdim; - double rval; - char *ident; - char *tval; - char stat_decl; - } - -%token - HACTIVATE HAFTER /*HAND*/ HARRAY HAT - HBEFORE HBEGIN HBOOLEAN - HCHARACTER HCLASS /*HCOMMENT*/ HCONC - HDELAY HDO - HELSE HEND HEQ /*HEQV*/ HEXTERNAL - HFOR - HGE HGO HGOTO HGT - HHIDDEN - HIF /*HIMP*/ HIN HINNER HINSPECT HINTEGER HIS - HLABEL HLE HLONG HLT - HNAME HNE HNEW HNONE /*HNOT*/ HNOTEXT - /*HOR*/ HOTHERWISE - HPRIOR HPROCEDURE HPROTECTED - HQUA - HREACTIVATE HREAL HREF - HSHORT HSTEP HSWITCH - HTEXT HTHEN HTHIS HTO - HUNTIL - HVALUE HVAR HVIRTUAL - HWHEN HWHILE - - HASSIGNVALUE HASSIGNREF - /*HDOT*/ HPAREXPSEPARATOR HLABELSEPARATOR HSTATEMENTSEPARATOR - HBEGPAR HENDPAR - HEQR HNER - HADD HSUB HMUL HDIV HINTDIV HEXP - HDOTDOTDOT - -%token HIDENTIFIER -%token HBOOLEANKONST HINTEGERKONST HCHARACTERKONST -%token HREALKONST -%token HTEXTKONST - -%type EXT_IDENT -%type DECLSTATEMENT MODULSTATEMENT MBEE_DECLSTMS MBEE_DECLSTMSU -%type MODULS -%type EXPRESSION_SIMP MBEE_ARG_R_PT -%type BAUND_PAIR_LIST - -%right HASSIGN -%left HORELSE -%left HANDTHEN -%left HEQV -%left HIMP -%left HOR -%left HAND - -%left HNOT - -%left HVALRELOPERATOR HREFRELOPERATOR HOBJRELOPERATOR - -%left HCONC - -%left HTERMOPERATOR -%left UNEAR -%left HFACTOROPERATOR -%left HPRIMARYOPERATOR - -%left HQUA - -%left HDOT - -%start MAIN_MODULE -%% -/* GRAMATIKK FOR PROGRAM MODULES */ -MAIN_MODULE : { categ=CLOCAL; mout(MBLOCK); - beginBlock(KBLOKK);separat_comp=FALSE;} - MODULS { endBlock(NULL,CCNO); mout(MENDBLOCK);} - | error HSTATEMENTSEPARATOR MBEE_DECLSTMS - ; -EXT_DECLARATION : HEXTERNAL - MBEE_TYPE - HPROCEDURE - { MBEENEWBLOCK(); - kind=KPROC;} - EXT_LIST - | - HEXTERNAL - HIDENTIFIER - HPROCEDURE - { MBEENEWBLOCK(); - type=TNOTY; - kind=KPROC; - if($2==Ckind)categ=CCPROC;else - yerror (1); - ysensitive=sensitive; - sensitive=ON;} - HIDENTIFIER { $$=$5; - sensitive=ysensitive;} - EXTERNAL_KIND_ITEM - { categ=CLOCAL;} - | HEXTERNAL - HCLASS - { MBEENEWBLOCK(); - kind=KCLASS;} - EXT_LIST - - ; -EXTERNAL_KIND_ITEM: EXT_IDENT - HOBJRELOPERATOR - { if($2!=HIS)yerror (2);} - MBEE_TYPE HPROCEDURE - HIDENTIFIER - { regDecl($6, type, KPROC, CCPROC); - beginBlock(kind);} - HEADING EMPTY_BLOCK - { categ=CLOCAL; - endBlock($1==NULL?$0:tag($1),CCCPROC);} -/* | - EXT_IDENT - { if($1!=NULL)yerror (3); - regDecl($0, type, kind, categ);} - MBEE_REST_EXT_LIST - { endBlock(NULL,CCNO);} - ; -MBEE_REST_EXT_LIST: /* EMPTY - | HPAREXPSEPARATOR EXT_KIND_LIST - ; -EXT_KIND_LIST : EXT_KIND_ITEM - | EXT_KIND_LIST HPAREXPSEPARATOR EXT_KIND_ITEM - ; -EXT_KIND_ITEM : HIDENTIFIER - EXT_IDENT - { if($2!=NULL)yerror (3); - regDecl($1, type, kind, categ);}*/ - ; -EMPTY_BLOCK : /*EMPT*/ - | HBEGIN HEND - ; -EXT_LIST : EXT_ITEM - | EXT_LIST HPAREXPSEPARATOR EXT_ITEM - ; -EXT_ITEM : HIDENTIFIER - EXT_IDENT - { lesinn_external_spec($1,$2, kind);} - ; -EXT_IDENT : /* EMPTY */ { $$=NULL;} - | HVALRELOPERATOR { if($1!=HEQ)yerror (9); - external=TRUE;} - HTEXTKONST { $$=$3;external=FALSE;} - ; -/* GRAMATIKK FOR TYPER */ -NO_TYPE : /*EMPT*/ { type=TNOTY;} - ; -MBEE_TYPE : NO_TYPE - | TYPE - ; -TYPE : HREF HBEGPAR - HIDENTIFIER - { prefquantident=$3; - type=TREF;} - HENDPAR - | HTEXT { type=TTEXT;} - | HBOOLEAN { type=TBOOL;} - | HCHARACTER { type=TCHAR;} - | HSHORT HINTEGER { type=TSHORT;} - | HINTEGER { type=TINTG;} - | HREAL { type=TREAL;} - | HLONG HREAL { type=TLONG;} - ; - -/* GRAMATIKK FOR DEL AV SETNINGER */ -MBEE_ELSE_PART : /*EMPT*/ -/* | HELSE - HIF - EXPRESSION - HTHEN { mout(MELSE); - mout(MIF); - OBSBLOCK();} - BLOCK { MBEEENDBLOCK();} - MBEE_ELSE_PART { mout(MENDIF);}*/ - | HELSE { OBSBLOCK(); mout(MELSE);} - BLOCK { MBEEENDBLOCK();} - ; -FOR_LIST : FOR_LIST_ELEMENT { mout(MENDSEP); - mout(MLISTSEP);} - | FOR_LIST_ELEMENT - HPAREXPSEPARATOR - FOR_LIST { mout(MLISTSEP);} - ; -FOR_LIST_ELEMENT: EXPRESSION - MBEE_F_L_EL_R_PT - ; -MBEE_F_L_EL_R_PT: /*EMPT*/ - | HWHILE - EXPRESSION { mout(MFORWHILE);} - | HSTEP - EXPRESSION - HUNTIL - EXPRESSION { mout(MUNTIL); - mout(MSTEP);} - ; -GOTO : HGO - HTO - | HGOTO - ; -CONN_STATE_R_PT : WHEN_CLAUSE_LIST - | HDO { beginBlock(KCON); mout(MDO); - OBSBLOCK(); } - BLOCK { endBlock(NULL,CCNO); - MBEEENDBLOCK(); mout(MENDDO);} - ; -WHEN_CLAUSE_LIST: HWHEN - HIDENTIFIER - HDO { beginBlock(KCON); mout(MIDENTIFIER); - OBSBLOCK(); moutId($2); - mout(MWHEN);} - BLOCK { endBlock(NULL,CCNO); - MBEEENDBLOCK(); mout(MENDWHEN);} - | WHEN_CLAUSE_LIST - HWHEN - HIDENTIFIER - HDO { beginBlock(KCON); mout(MIDENTIFIER); - OBSBLOCK(); moutId($3); - mout(MWHEN);} - BLOCK { endBlock(NULL,CCNO); - MBEEENDBLOCK(); mout(MENDWHEN);} - ; -MBEE_OTWI_CLAUS : /*EMPT*/ - | HOTHERWISE {OBSBLOCK(); mout(MOTHERWISE);} - - BLOCK {MBEEENDBLOCK();mout(MENDOTHERWISE);} - ; -ACTIVATOR : HACTIVATE { mout(MBOOLEANKONST); - moutIval(FALSE);} - | HREACTIVATE { mout(MBOOLEANKONST); - moutIval(TRUE);} - ; -SCHEDULE : /*EMPT*/ { mout(MCHARACTERKONST); - moutIval(DIRECT); - mout(MINTEGERKONST); - moutIval(0); - mout(MNONE); - mout(MBOOLEANKONST); - moutIval(FALSE);} - | ATDELAY EXPRESSION { mout(MNONE);} - PRIOR - | BEFOREAFTER { mout(MINTEGERKONST); - moutIval(0);} - EXPRESSION { mout(MBOOLEANKONST); - moutIval(FALSE);} - ; -ATDELAY : HAT { mout(MCHARACTERKONST); - moutIval(AT);} - | HDELAY { mout(MCHARACTERKONST); - moutIval(DELAYS);} - ; -BEFOREAFTER : HBEFORE { mout(MCHARACTERKONST); - moutIval(BEFORE);} - | HAFTER { mout(MCHARACTERKONST); - moutIval(AFTER);} - ; -PRIOR : /*EMPT*/ { mout(MBOOLEANKONST); - moutIval(FALSE);} - | HPRIOR { mout(MBOOLEANKONST); - moutIval(TRUE);} - ; -/* GRAMATIKK FOR SETNINGER OG DEKLARASJONER */ -MODULSTATEMENT : HWHILE - EXPRESSION - HDO { STOPOBSBLOCK(); mout(MWHILE); - OBSBLOCK();} - BLOCK { MBEEENDBLOCK(); mout(MENDWHILE); - $$=STATEMENT;} - | HIF - EXPRESSION - HTHEN { STOPOBSBLOCK(); mout(MIF); - OBSBLOCK();} - BLOCK { MBEEENDBLOCK();} - MBEE_ELSE_PART { mout(MENDIF); - $$=STATEMENT;} - | HFOR - HIDENTIFIER - HASSIGN { STOPOBSBLOCK(); mout(MIDENTIFIER); - moutId($2);} - FOR_LIST - HDO { beginBlock(KFOR); - if($3==HASSIGNVALUE) mout(MFOR); - else mout(MFORR); - OBSBLOCK(); mout(MFORDO);} - BLOCK { MBEEENDBLOCK(); - endBlock(NULL,CCNO); mout(MENDFOR); - $$=STATEMENT;} - | GOTO - EXPRESSION { mout(MGOTO); - STOPOBSBLOCK(); $$=STATEMENT;} - | HINSPECT - EXPRESSION { mout(MINSPECT); - STOPOBSBLOCK(); - beginBlock(KINSP);} - CONN_STATE_R_PT - { endBlock(NULL,CCNO);} - MBEE_OTWI_CLAUS { mout(MENDINSPECT); - $$=STATEMENT;} - | HINNER { STOPOBSBLOCK(); mout(MINNER); - regInner(); $$=STATEMENT;} - | HIDENTIFIER - HLABELSEPARATOR - { STOPOBSBLOCK(); - regDecl($1, TLABEL, KSIMPLE, categ); mout(MLABEL); - moutId($1); - mout(MENDLABEL);} - DECLSTATEMENT { if($4<=DECLARATION) - { yerror (27); - $$=DECLARATION;} - else $$=$4;} - | EXPRESSION_SIMP - HBEGIN - { $$=$1; } - IMPORT_SPEC_MODULE - { mout(MPRBLOCK); - prefquantident=$1; - beginBlock(KPRBLK);} - MBEE_DECLSTMS - HEND { endBlock(NULL,CCNO); mout(MENDPRBLOCK); - $$=STATEMENT;} - | EXPRESSION_SIMP HBEGIN error HSTATEMENTSEPARATOR - MBEE_DECLSTMS HEND { $$=STATEMENT; - endBlock(NULL,CCNO); mout(MENDPRBLOCK);} - | EXPRESSION_SIMP HBEGIN error HEND - { $$=STATEMENT; - endBlock(NULL,CCNO); mout(MENDPRBLOCK);} - - | EXPRESSION_SIMP - { STOPOBSBLOCK(); $$=STATEMENT; - mout(MENDASSIGN);} - | ACTIVATOR EXPRESSION SCHEDULE - { $$=STATEMENT; - mout(MENDSEP); - mout(MARGUMENTSEP); - mout(MARGUMENTSEP); - mout(MARGUMENTSEP); - mout(MARGUMENTSEP); - mout(MARGUMENTSEP); - mout(MARGUMENTSEP); - mout(MARGUMENT); - moutId(activateid); - mout(MENDASSIGN);} - | HBEGIN - { STOPOBSBLOCK(); - OBSBLOCK();} - MBEE_DECLSTMS - HEND { MBEEENDBLOCK(); $$=STATEMENT;} - | MBEE_TYPE HPROCEDURE - HIDENTIFIER - { MBEENEWBLOCK(); mout(MPROCEDURE); - regDecl($3, type, KPROC, categ); - beginBlock(KPROC);} - HEADING BLOCK { endBlock(NULL,CCNO); $$=DECLARATION; - mout(MENDPROCEDURE);} - | HIDENTIFIER - HCLASS - NO_TYPE - { $$=$1; } - IMPORT_SPEC_MODULE - HIDENTIFIER - { prefquantident=$1; - mout(MCLASS); - regDecl($6, TNOTY, KCLASS, categ); - beginBlock(KCLASS);} - HEADING - BLOCK { endBlock(NULL,CCNO); $$=DECLARATION; - mout(MENDCLASS);} - | HCLASS - NO_TYPE - HIDENTIFIER - { prefquantident=0; - MBEENEWBLOCK(); mout(MCLASS); - regDecl($3, TNOTY, KCLASS, categ); - beginBlock(KCLASS);} - HEADING - BLOCK { endBlock(NULL,CCNO); $$=DECLARATION; - mout(MENDCLASS);} - | EXT_DECLARATION { $$=EXTDECLARATION;} - | /*EMPT*/{ STOPOBSBLOCK(); $$=EMPTYSTATEMENT;} - ; -IMPORT_SPEC_MODULE: { MBEENEWBLOCK(); - kind=KCLASS; - if($0==simsetident && - findDecl(simsetident,cblock,FALSE)==NULL) - lesinn_external_spec(simsetident, - SIMSETATRFILE, kind); - if($0==simulationident && findDecl( - simulationident,cblock,FALSE)==NULL) - lesinn_external_spec(simulationident, - SIMULATIONATRFILE, kind); - if(($0==fileident && findDecl( - fileident,cblock,FALSE)==NULL) || - ($0==outfileident && findDecl( - outfileident,cblock,FALSE)==NULL) || - ($0==infileident && findDecl( - infileident,cblock,FALSE)==NULL) || - ($0==directfileident && findDecl( - directfileident,cblock,FALSE)==NULL) || - ($0==printfileident && findDecl( - printfileident,cblock,FALSE)==NULL) || - ($0==bytefileident && findDecl( - bytefileident,cblock,FALSE)==NULL) || - ($0==inbytefileident && findDecl( - inbytefileident,cblock,FALSE)==NULL) || - ($0==outbytefileident && findDecl( - outbytefileident,cblock,FALSE)==NULL) || - ($0==directbytefileident && findDecl( - directbytefileident,cblock,FALSE)==NULL)) - lesinn_external_spec(fileident, - FILEATRFILE, kind);} - ; -DECLSTATEMENT : MODULSTATEMENT - | TYPE - HIDENTIFIER - MBEE_CONSTANT - HPAREXPSEPARATOR - { MBEENEWBLOCK(); - kind=KSIMPLE; - regDecl($2, type, KSIMPLE, categ); - categ=CLOCAL;} - IDENTIFIER_LISTC { $$=DECLARATION;} - | TYPE - HIDENTIFIER - MBEE_CONSTANT - { MBEENEWBLOCK(); - regDecl($2, type, KSIMPLE, categ); - categ=CLOCAL; $$=DECLARATION;} - | MBEE_TYPE - HARRAY { MBEENEWBLOCK(); - kind=KARRAY;} - ARR_SEGMENT_LIST { $$=DECLARATION;} - | HSWITCH - HIDENTIFIER - HASSIGN { MBEENEWBLOCK(); mout(MIDENTIFIER); - moutId($2); - regDecl($2, TLABEL, KARRAY, categ);} - SWITCH_LIST { $$=DECLARATION; - mout(MSWITCH); - mout(MENDSWITCH);} - ; -BLOCK : DECLSTATEMENT { if($1<=DECLARATION)yerror (29);} - | HBEGIN MBEE_DECLSTMS HEND - | HBEGIN error HSTATEMENTSEPARATOR MBEE_DECLSTMS HEND - | HBEGIN error HEND - ; -MBEE_DECLSTMS : MBEE_DECLSTMSU { if($1<=DECLARATION)yerror (28); - $$=$1;} - ; -MBEE_DECLSTMSU : DECLSTATEMENT { $$=$1;} - | MBEE_DECLSTMSU - HSTATEMENTSEPARATOR - DECLSTATEMENT { if($1>=STATEMENT && $3<=DECLARATION) - yerror (26); - $$=$3;} - ; -MODULS : MODULSTATEMENT { if($1==DECLARATION) - {separat_comp=TRUE;gettimestamp();} - $$=$1;} - | MODULS HSTATEMENTSEPARATOR MODULSTATEMENT - { if($1>=STATEMENT && $3<=DECLARATION) - yerror (26);else - if($1>=STATEMENT - && $3!=EMPTYSTATEMENT)yerror (25); - if(separat_comp && $3==STATEMENT) - yerror (25); - if($3==DECLARATION && !separat_comp) - {separat_comp=TRUE;gettimestamp();} - $$=$3;} - ; -/* GRAMATIKK FOR DEL AV DEKLARASJONER */ -ARR_SEGMENT_LIST: ARR_SEGMENT - | ARR_SEGMENT_LIST - HPAREXPSEPARATOR - ARR_SEGMENT - ; -ARR_SEGMENT : ARRAY_SEGMENT - HBEGPAR - BAUND_PAIR_LIST HENDPAR { mout(MARRAY); - mout(MENDARRAY); - setArrayDim($3);} - ; -ARRAY_SEGMENT : ARRAY_SEGMENT_EL { mout(MENDSEP); - mout(MARRAYSEP);} - - | ARRAY_SEGMENT_EL - HPAREXPSEPARATOR - ARRAY_SEGMENT { mout(MARRAYSEP);} - ; -ARRAY_SEGMENT_EL: HIDENTIFIER { mout(MIDENTIFIER); - moutId($1); - regDecl($1, type, kind, categ); - if(lastArray==NULL) - lastArray=cblock->lastparloc;} - ; -BAUND_PAIR_LIST : BAUND_PAIR { mout(MENDSEP); - mout(MBOUNDSEP); - $$=1;} - | BAUND_PAIR - HPAREXPSEPARATOR - BAUND_PAIR_LIST { mout(MBOUNDSEP); - $$=$3+1;} - ; -BAUND_PAIR : EXPRESSION - HLABELSEPARATOR - EXPRESSION { mout(MBOUNDPARSEP);} - ; -SWITCH_LIST : EXPRESSION { mout(MENDSEP); - mout(MSWITCHSEP);} - | EXPRESSION - HPAREXPSEPARATOR - SWITCH_LIST { mout(MSWITCHSEP);} - ; -HEADING : MBEE_FMAL_PAR_P HSTATEMENTSEPARATOR { kind=KNOKD;} - MBEE_MODE_PART { categ=CSPEC;} - MBEE_SPEC_PART { kind=KNOKD;} - MBEE_PROT_PART { categ=CVIRT;} - MBEE_VIRT_PART - { categ=CLOCAL;} - ; -MBEE_FMAL_PAR_P : /*EMPT*/ - | FMAL_PAR_PART - ; -FMAL_PAR_PART : HBEGPAR NO_TYPE - MBEE_LISTV HENDPAR - ; -MBEE_LISTV : /*EMPT*/ - | LISTV - ; -LISTV : HIDENTIFIER { regDecl($1, type, KNOKD, CDEFLT);} - | FPP_CATEG HDOTDOTDOT { regDecl(varargsid, TVARARGS, KNOKD, categ);} - | HIDENTIFIER { regDecl($1, type, KNOKD, CDEFLT);} - HPAREXPSEPARATOR LISTV {} - | FPP_SPEC - | FPP_SPEC - HPAREXPSEPARATOR LISTV - ; -FPP_HEADING : HBEGPAR NO_TYPE - FPP_MBEE_LISTV HENDPAR - ; -FPP_MBEE_LISTV : /*EMPT*/ - | FPP_LISTV - ; -FPP_LISTV : FPP_CATEG HDOTDOTDOT { regDecl(varargsid, TVARARGS, KNOKD, categ);} - | FPP_SPEC - | FPP_SPEC - HPAREXPSEPARATOR LISTV - ; -FPP_SPEC : FPP_CATEG SPECIFIER HIDENTIFIER - { regDecl($3, type, kind, categ);} - | FPP_CATEG FPP_PROC_DECL_IN_SPEC - ; -FPP_CATEG : HNAME HLABELSEPARATOR - { categ=CNAME;} - | HVALUE HLABELSEPARATOR - { categ=CVALUE;} - | HVAR HLABELSEPARATOR - { categ=CVAR;} - | /*EMPT*/ { categ=CDEFLT;} - ; -FPP_PROC_DECL_IN_SPEC: MBEE_TYPE HPROCEDURE - HIDENTIFIER - { $$=categ; - regDecl($3, type, KPROC, categ); - beginBlock(KPROC);} - FPP_HEADING - { categ=$4; /* M} settes tilbake*/} - { endBlock(NULL,CCNO);} - ; -IDENTIFIER_LISTV: HIDENTIFIER { regDecl($1, type, kind, categ);} - | HDOTDOTDOT { regDecl(varargsid, TVARARGS, kind, categ);} - | HIDENTIFIER { regDecl($1, type, kind, categ);} - HPAREXPSEPARATOR IDENTIFIER_LISTV {} - ; -MBEE_MODE_PART : /*EMPT*/ - | MODE_PART - ; -MODE_PART : NAME_PART - | VALUE_PART - | VAR_PART - | NAME_PART VALUE_PART - | VALUE_PART NAME_PART - | NAME_PART VAR_PART - | VAR_PART NAME_PART - | VALUE_PART VAR_PART - | VAR_PART VALUE_PART - | VAR_PART NAME_PART VALUE_PART - | NAME_PART VAR_PART VALUE_PART - | NAME_PART VALUE_PART VAR_PART - | VAR_PART VALUE_PART NAME_PART - | VALUE_PART VAR_PART NAME_PART - | VALUE_PART NAME_PART VAR_PART - ; -NAME_PART : HNAME { categ=CNAME;} - IDENTIFIER_LISTV - HSTATEMENTSEPARATOR - ; -VAR_PART : HVAR { categ=CVAR;} - IDENTIFIER_LISTV - HSTATEMENTSEPARATOR - ; -VALUE_PART : HVALUE { categ=CVALUE;} - IDENTIFIER_LISTV HSTATEMENTSEPARATOR - ; -MBEE_SPEC_PART : /*EMPT*/ - | SPEC_PART - ; -SPEC_PART : ONE_SPEC - | SPEC_PART ONE_SPEC - ; -ONE_SPEC : SPECIFIER IDENTIFIER_LIST HSTATEMENTSEPARATOR - | NO_TYPE HPROCEDURE HIDENTIFIER HOBJRELOPERATOR - { if($4!=HIS) yerror (8);} - PROC_DECL_IN_SPEC HSTATEMENTSEPARATOR - | FPP_PROC_DECL_IN_SPEC HSTATEMENTSEPARATOR - | MBEE_TYPE HPROCEDURE HIDENTIFIER HSTATEMENTSEPARATOR - { yerror (45);} - | MBEE_TYPE HPROCEDURE HIDENTIFIER HPAREXPSEPARATOR - IDENTIFIER_LIST HSTATEMENTSEPARATOR - { yerror (45);} - ; -SPECIFIER : TYPE { kind=KSIMPLE;} - | MBEE_TYPE - HARRAY { kind=KARRAY;} - | HLABEL { type=TLABEL; - kind=KSIMPLE;} - | HSWITCH { type=TLABEL; - kind=KARRAY;} - ; -PROC_DECL_IN_SPEC: MBEE_TYPE HPROCEDURE - HIDENTIFIER - { $$=categ; - regDecl($3, type, KPROC, categ); - beginBlock(KPROC);} - HEADING - { categ=$4; /* M} settes tilbake*/} - MBEE_BEGIN_END - { endBlock(NULL,CCNO);} - ; -MBEE_BEGIN_END : /* EMPTY */ - | HBEGIN HEND - ; -MBEE_PROT_PART : /*EMPT*/ - | PROTECTION_PART - ; -PROTECTION_PART : PROT_SPECIFIER IDENTIFIER_LIST - HSTATEMENTSEPARATOR - | PROTECTION_PART PROT_SPECIFIER - IDENTIFIER_LIST HSTATEMENTSEPARATOR - ; -PROT_SPECIFIER : HHIDDEN { categ=CHIDEN;} - | HPROTECTED { categ=CPROT;} - | HHIDDEN - HPROTECTED { categ=CHIPRO;} - | HPROTECTED - HHIDDEN { categ=CHIPRO;} - ; -MBEE_VIRT_PART : /*EMPT*/ - | VIRTUAL_PART - ; -VIRTUAL_PART : HVIRTUAL - HLABELSEPARATOR - MBEE_SPEC_PART - ; -IDENTIFIER_LIST : HIDENTIFIER { regDecl($1, type, kind, categ);} - | IDENTIFIER_LIST HPAREXPSEPARATOR - HIDENTIFIER { regDecl($3, type, kind, categ);} - ; -IDENTIFIER_LISTC: HIDENTIFIER - MBEE_CONSTANT { regDecl($1, type, kind, categ); - categ=CLOCAL;} - | IDENTIFIER_LISTC HPAREXPSEPARATOR - HIDENTIFIER - MBEE_CONSTANT { regDecl($3, type, kind, categ); - categ=CLOCAL;} - ; -MBEE_CONSTANT : /* EMPTY */ - | HVALRELOPERATOR - { MBEENEWBLOCK(); - if($1!=HEQ) yerror (8); - if(type==TREF)yerror (7); - categ=CCONSTU; - mout(MIDENTIFIER); - moutId($0);} - EXPRESSION { mout(MASSIGN); - mout(MCONST);} - ; - -/* GRAMATIKK FOR UTTRYKK */ -EXPRESSION : EXPRESSION_SIMP {} - | HIF - EXPRESSION - HTHEN - EXPRESSION - HELSE - EXPRESSION { mout(MELSEE); - mout(MIFE);} - ; -EXPRESSION_SIMP : EXPRESSION_SIMP - HASSIGN - EXPRESSION { if($2==HASSIGNREF)mout(MASSIGNR); - else mout(MASSIGN);$$=NULL;} - | - - EXPRESSION_SIMP - HCONC - EXPRESSION_SIMP { mout(MCONC);$$=NULL;} - | EXPRESSION_SIMP HOR - HELSE - EXPRESSION_SIMP - %prec HORELSE { mout(MORELSEE);$$=NULL;} - | EXPRESSION_SIMP HAND - HTHEN - EXPRESSION_SIMP - %prec HANDTHEN { mout(MANDTHENE);$$=NULL;} - | EXPRESSION_SIMP - HEQV EXPRESSION_SIMP { mout(MEQV);$$=NULL;} - | EXPRESSION_SIMP - HIMP EXPRESSION_SIMP { mout(MIMP);$$=NULL;} - | EXPRESSION_SIMP - HOR EXPRESSION_SIMP { mout(MOR);$$=NULL;} - | EXPRESSION_SIMP - HAND EXPRESSION_SIMP { mout(MAND);$$=NULL;} - | HNOT EXPRESSION_SIMP { mout(MNOT);$$=NULL;} - | EXPRESSION_SIMP - HVALRELOPERATOR - EXPRESSION_SIMP - { switch($2) - { case HEQ: mout(MEQ);break; - case HNE: mout(MNE);break; - case HLT: mout(MLT);break; - case HLE: mout(MLE);break; - case HGT: mout(MGT);break; - case HGE: mout(MGE);break; - }$$=NULL;} - | EXPRESSION_SIMP - HREFRELOPERATOR - EXPRESSION_SIMP - { if($2==HNER) mout(MNER); - else mout(MEQR);$$=NULL;} - | EXPRESSION_SIMP - HOBJRELOPERATOR - EXPRESSION_SIMP - { if($2==HIS) mout(MIS); - else mout(MINS);$$=NULL;} - | HTERMOPERATOR - EXPRESSION_SIMP %prec UNEAR - { if($1==HADD) mout(MUADD); - else mout(MUSUB);$$=NULL;} - | EXPRESSION_SIMP - HTERMOPERATOR - EXPRESSION_SIMP - { if($2==HADD) mout(MADD); - else mout(MSUB);$$=NULL;} - | EXPRESSION_SIMP - HFACTOROPERATOR - EXPRESSION_SIMP - { if($2==HMUL) mout(MMUL); else - if($2==HDIV) mout(MDIV); - else mout(MINTDIV);$$=NULL;} - | EXPRESSION_SIMP - HPRIMARYOPERATOR - EXPRESSION_SIMP { mout(MPRIMARY);$$=NULL;} - | HBEGPAR - EXPRESSION HENDPAR { mout(MNOOP);$$=NULL;} - | HTEXTKONST { mout(MTEXTKONST); - moutTval($1);$$=NULL;} - | HCHARACTERKONST { mout(MCHARACTERKONST); - moutIval($1);$$=NULL;} - | HREALKONST { mout(MREALKONST); - moutRval($1);$$=NULL;} - | HINTEGERKONST { mout(MINTEGERKONST); - moutIval($1);$$=NULL;} - | HBOOLEANKONST { mout(MBOOLEANKONST); - moutIval($1);$$=NULL;} - | HNONE { mout(MNONE);$$=NULL;} - | HIDENTIFIER - { $$=$1;} - MBEE_ARG_R_PT {} - | HTHIS HIDENTIFIER { mout(MTHIS); - moutId($2);$$=NULL;} - | HNEW - HIDENTIFIER - ARG_R_PT { mout(MNEWARG); - moutId($2);$$=NULL;} - | EXPRESSION_SIMP - HDOT - EXPRESSION_SIMP { mout(MDOT);$$=NULL;} - | EXPRESSION_SIMP - HQUA HIDENTIFIER { mout(MQUA); - moutId($3);$$=NULL;} - ; -ARG_R_PT : /*EMPTY*/ { mout(MENDSEP);} - | HBEGPAR - ARGUMENT_LIST HENDPAR - ; -MBEE_ARG_R_PT : /*EMPTY*/ { mout(MIDENTIFIER); - moutId($0); - $$=$0;} - | HBEGPAR - ARGUMENT_LIST HENDPAR { mout(MARGUMENT); - moutId($0);} - ; -ARGUMENT_LIST : EXPRESSION { mout(MENDSEP); - mout(MARGUMENTSEP);} - | EXPRESSION - HPAREXPSEPARATOR - ARGUMENT_LIST { mout(MARGUMENTSEP);} - ; -%% -_ATEOF - - -# Pass plenty of options, to exercise plenty of code, even if we -# don't actually check the output. But SEGV is watching us, and -# so might do dmalloc. -$at_traceoff -echo "existing.at:1197: bison --verbose --defines input.y" -echo existing.at:1197 >$at_check_line_file -( $at_traceon; bison --verbose --defines input.y ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo >>$at_stderr; echo "input.y: conflicts: 78 shift/reduce, 10 reduce/reduce -" | $at_diff - $at_stderr || at_failed=: -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "existing.at:1197: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - -$at_traceoff -echo "existing.at:1209: grep '^State.*conflicts:' input.output" -echo existing.at:1209 >$at_check_line_file -( $at_traceon; grep '^State.*conflicts:' input.output ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -echo >>$at_stdout; echo "State 64 conflicts: 14 shift/reduce -State 164 conflicts: 1 shift/reduce -State 201 conflicts: 33 shift/reduce, 4 reduce/reduce -State 206 conflicts: 1 shift/reduce -State 240 conflicts: 1 shift/reduce -State 335 conflicts: 9 shift/reduce, 2 reduce/reduce -State 356 conflicts: 1 shift/reduce -State 360 conflicts: 9 shift/reduce, 2 reduce/reduce -State 427 conflicts: 9 shift/reduce, 2 reduce/reduce -" | $at_diff - $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "existing.at:1209: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - - $at_traceoff - $at_times_p && times >$at_times_file - ) 5>&1 2>&1 | eval $at_tee_pipe - at_status=`cat $at_status_file` - ;; - - 97 ) # 97. existing.at:1218: GNU pic Grammar - at_setup_line='existing.at:1218' - at_desc='GNU pic Grammar' - $at_quiet $ECHO_N " 97: GNU pic Grammar $ECHO_C" - at_xfail=no - ( - echo "97. existing.at:1218: testing ..." - $at_traceon - - -# GNU pic, part of groff. - -# Bison once reported shift/reduce conflicts that it shouldn't have. - -cat >input.y <<'_ATEOF' -%union { - char *str; - int n; - double x; - struct { double x, y; } pair; - struct { double x; char *body; } if_data; - struct { char *str; const char *filename; int lineno; } lstr; - struct { double *v; int nv; int maxv; } dv; - struct { double val; int is_multiplicative; } by; - place pl; - object *obj; - corner crn; - path *pth; - object_spec *spec; - saved_state *pstate; - graphics_state state; - object_type obtype; -} - -%token LABEL -%token VARIABLE -%token NUMBER -%token TEXT -%token COMMAND_LINE -%token DELIMITED -%token ORDINAL -%token TH -%token LEFT_ARROW_HEAD -%token RIGHT_ARROW_HEAD -%token DOUBLE_ARROW_HEAD -%token LAST -%token UP -%token DOWN -%token LEFT -%token RIGHT -%token BOX -%token CIRCLE -%token ELLIPSE -%token ARC -%token LINE -%token ARROW -%token MOVE -%token SPLINE -%token HEIGHT -%token RADIUS -%token WIDTH -%token DIAMETER -%token FROM -%token TO -%token AT -%token WITH -%token BY -%token THEN -%token SOLID -%token DOTTED -%token DASHED -%token CHOP -%token SAME -%token INVISIBLE -%token LJUST -%token RJUST -%token ABOVE -%token BELOW -%token OF -%token THE -%token WAY -%token BETWEEN -%token AND -%token HERE -%token DOT_N -%token DOT_E -%token DOT_W -%token DOT_S -%token DOT_NE -%token DOT_SE -%token DOT_NW -%token DOT_SW -%token DOT_C -%token DOT_START -%token DOT_END -%token DOT_X -%token DOT_Y -%token DOT_HT -%token DOT_WID -%token DOT_RAD -%token SIN -%token COS -%token ATAN2 -%token LOG -%token EXP -%token SQRT -%token K_MAX -%token K_MIN -%token INT -%token RAND -%token SRAND -%token COPY -%token THRU -%token TOP -%token BOTTOM -%token UPPER -%token LOWER -%token SH -%token PRINT -%token CW -%token CCW -%token FOR -%token DO -%token IF -%token ELSE -%token ANDAND -%token OROR -%token NOTEQUAL -%token EQUALEQUAL -%token LESSEQUAL -%token GREATEREQUAL -%token LEFT_CORNER -%token RIGHT_CORNER -%token NORTH -%token SOUTH -%token EAST -%token WEST -%token CENTER -%token END -%token START -%token RESET -%token UNTIL -%token PLOT -%token THICKNESS -%token FILL -%token COLORED -%token OUTLINED -%token SHADED -%token ALIGNED -%token SPRINTF -%token COMMAND - -%left '.' - -/* this ensures that plot 17 "%g" parses as (plot 17 "%g") */ -%left PLOT -%left TEXT SPRINTF - -/* give text adjustments higher precedence than TEXT, so that -box "foo" above ljust == box ("foo" above ljust) -*/ - -%left LJUST RJUST ABOVE BELOW - -%left LEFT RIGHT -/* Give attributes that take an optional expression a higher -precedence than left and right, so that eg `line chop left' -parses properly. */ -%left CHOP SOLID DASHED DOTTED UP DOWN FILL COLORED OUTLINED -%left LABEL - -%left VARIABLE NUMBER '(' SIN COS ATAN2 LOG EXP SQRT K_MAX K_MIN INT RAND SRAND LAST -%left ORDINAL HERE '`' - -%left BOX CIRCLE ELLIPSE ARC LINE ARROW SPLINE '[' /* ] */ - -/* these need to be lower than '-' */ -%left HEIGHT RADIUS WIDTH DIAMETER FROM TO AT THICKNESS - -/* these must have higher precedence than CHOP so that `label %prec CHOP' -works */ -%left DOT_N DOT_E DOT_W DOT_S DOT_NE DOT_SE DOT_NW DOT_SW DOT_C -%left DOT_START DOT_END TOP BOTTOM LEFT_CORNER RIGHT_CORNER -%left UPPER LOWER NORTH SOUTH EAST WEST CENTER START END - -%left ',' -%left OROR -%left ANDAND -%left EQUALEQUAL NOTEQUAL -%left '<' '>' LESSEQUAL GREATEREQUAL - -%left BETWEEN OF -%left AND - -%left '+' '-' -%left '*' '/' '%' -%right '!' -%right '^' - -%type expr any_expr text_expr -%type optional_by -%type expr_pair position_not_place -%type simple_if -%type nth_primitive -%type corner -%type path label_path relative_path -%type place label element element_list middle_element_list -%type object_spec -%type position -%type object_type -%type optional_ordinal_last ordinal -%type until -%type sprintf_args -%type text print_args print_arg - -%% - -top: - optional_separator - | element_list - { - if (olist.head) - print_picture(olist.head); - } - ; - - -element_list: - optional_separator middle_element_list optional_separator - { $$ = $2; } - ; - -middle_element_list: - element - { $$ = $1; } - | middle_element_list separator element - { $$ = $1; } - ; - -optional_separator: - /* empty */ - | separator - ; - -separator: - ';' - | separator ';' - ; - -placeless_element: - VARIABLE '=' any_expr - { - define_variable($1, $3); - a_delete $1; - } - | VARIABLE ':' '=' any_expr - { - place *p = lookup_label($1); - if (!p) { - lex_error("variable `%1' not defined", $1); - YYABORT; - } - p->obj = 0; - p->x = $4; - p->y = 0.0; - a_delete $1; - } - | UP - { current_direction = UP_DIRECTION; } - | DOWN - { current_direction = DOWN_DIRECTION; } - | LEFT - { current_direction = LEFT_DIRECTION; } - | RIGHT - { current_direction = RIGHT_DIRECTION; } - | COMMAND_LINE - { - olist.append(make_command_object($1.str, $1.filename, - $1.lineno)); - } - | COMMAND print_args - { - olist.append(make_command_object($2.str, $2.filename, - $2.lineno)); - } - | PRINT print_args - { - fprintf(stderr, "%s\n", $2.str); - a_delete $2.str; - fflush(stderr); - } - | SH - { delim_flag = 1; } - DELIMITED - { - delim_flag = 0; - if (safer_flag) - lex_error("unsafe to run command `%1'", $3); - else - system($3); - a_delete $3; - } - | COPY TEXT - { - if (yychar < 0) - do_lookahead(); - do_copy($2.str); - // do not delete the filename - } - | COPY TEXT THRU - { delim_flag = 2; } - DELIMITED - { delim_flag = 0; } - until - { - if (yychar < 0) - do_lookahead(); - copy_file_thru($2.str, $5, $7); - // do not delete the filename - a_delete $5; - a_delete $7; - } - | COPY THRU - { delim_flag = 2; } - DELIMITED - { delim_flag = 0; } - until - { - if (yychar < 0) - do_lookahead(); - copy_rest_thru($4, $6); - a_delete $4; - a_delete $6; - } - | FOR VARIABLE '=' expr TO expr optional_by DO - { delim_flag = 1; } - DELIMITED - { - delim_flag = 0; - if (yychar < 0) - do_lookahead(); - do_for($2, $4, $6, $7.is_multiplicative, $7.val, $10); - } - | simple_if - { - if (yychar < 0) - do_lookahead(); - if ($1.x != 0.0) - push_body($1.body); - a_delete $1.body; - } - | simple_if ELSE - { delim_flag = 1; } - DELIMITED - { - delim_flag = 0; - if (yychar < 0) - do_lookahead(); - if ($1.x != 0.0) - push_body($1.body); - else - push_body($4); - a_delete $1.body; - a_delete $4; - } - | reset_variables - | RESET - { define_variable("scale", 1.0); } - ; - -reset_variables: - RESET VARIABLE - { - reset($2); - a_delete $2; - } - | reset_variables VARIABLE - { - reset($2); - a_delete $2; - } - | reset_variables ',' VARIABLE - { - reset($3); - a_delete $3; - } - ; - -print_args: - print_arg - { $$ = $1; } - | print_args print_arg - { - $$.str = new char[strlen($1.str) + strlen($2.str) + 1]; - strcpy($$.str, $1.str); - strcat($$.str, $2.str); - a_delete $1.str; - a_delete $2.str; - if ($1.filename) { - $$.filename = $1.filename; - $$.lineno = $1.lineno; - } - else if ($2.filename) { - $$.filename = $2.filename; - $$.lineno = $2.lineno; - } - } - ; - -print_arg: - expr %prec ',' - { - $$.str = new char[GDIGITS + 1]; - sprintf($$.str, "%g", $1); - $$.filename = 0; - $$.lineno = 0; - } - | text - { $$ = $1; } - | position %prec ',' - { - $$.str = new char[GDIGITS + 2 + GDIGITS + 1]; - sprintf($$.str, "%g, %g", $1.x, $1.y); - $$.filename = 0; - $$.lineno = 0; - } - ; - -simple_if: - IF any_expr THEN - { delim_flag = 1; } - DELIMITED - { - delim_flag = 0; - $$.x = $2; - $$.body = $5; - } - ; - -until: - /* empty */ - { $$ = 0; } - | UNTIL TEXT - { $$ = $2.str; } - ; - -any_expr: - expr - { $$ = $1; } - | text_expr - { $$ = $1; } - ; - -text_expr: - text EQUALEQUAL text - { - $$ = strcmp($1.str, $3.str) == 0; - a_delete $1.str; - a_delete $3.str; - } - | text NOTEQUAL text - { - $$ = strcmp($1.str, $3.str) != 0; - a_delete $1.str; - a_delete $3.str; - } - | text_expr ANDAND text_expr - { $$ = ($1 != 0.0 && $3 != 0.0); } - | text_expr ANDAND expr - { $$ = ($1 != 0.0 && $3 != 0.0); } - | expr ANDAND text_expr - { $$ = ($1 != 0.0 && $3 != 0.0); } - | text_expr OROR text_expr - { $$ = ($1 != 0.0 || $3 != 0.0); } - | text_expr OROR expr - { $$ = ($1 != 0.0 || $3 != 0.0); } - | expr OROR text_expr - { $$ = ($1 != 0.0 || $3 != 0.0); } - | '!' text_expr - { $$ = ($2 == 0.0); } - ; - - -optional_by: - /* empty */ - { - $$.val = 1.0; - $$.is_multiplicative = 0; - } - | BY expr - { - $$.val = $2; - $$.is_multiplicative = 0; - } - | BY '*' expr - { - $$.val = $3; - $$.is_multiplicative = 1; - } - ; - -element: - object_spec - { - $$.obj = $1->make_object(¤t_position, - ¤t_direction); - if ($$.obj == 0) - YYABORT; - delete $1; - if ($$.obj) - olist.append($$.obj); - else { - $$.x = current_position.x; - $$.y = current_position.y; - } - } - | LABEL ':' optional_separator element - { - $$ = $4; - define_label($1, & $$); - a_delete $1; - } - | LABEL ':' optional_separator position_not_place - { - $$.obj = 0; - $$.x = $4.x; - $$.y = $4.y; - define_label($1, & $$); - a_delete $1; - } - | LABEL ':' optional_separator place - { - $$ = $4; - define_label($1, & $$); - a_delete $1; - } - | '{' - { - $$.x = current_position.x; - $$.y = current_position.y; - $$.dir = current_direction; - } - element_list '}' - { - current_position.x = $2.x; - current_position.y = $2.y; - current_direction = $2.dir; - } - optional_element - { - $$ = $3; - } - | placeless_element - { - $$.obj = 0; - $$.x = current_position.x; - $$.y = current_position.y; - } - ; - -optional_element: - /* empty */ - {} - | element - {} - ; - -object_spec: - BOX - { $$ = new object_spec(BOX_OBJECT); } - | CIRCLE - { $$ = new object_spec(CIRCLE_OBJECT); } - | ELLIPSE - { $$ = new object_spec(ELLIPSE_OBJECT); } - | ARC - { - $$ = new object_spec(ARC_OBJECT); - $$->dir = current_direction; - } - | LINE - { - $$ = new object_spec(LINE_OBJECT); - lookup_variable("lineht", & $$->segment_height); - lookup_variable("linewid", & $$->segment_width); - $$->dir = current_direction; - } - | ARROW - { - $$ = new object_spec(ARROW_OBJECT); - lookup_variable("lineht", & $$->segment_height); - lookup_variable("linewid", & $$->segment_width); - $$->dir = current_direction; - } - | MOVE - { - $$ = new object_spec(MOVE_OBJECT); - lookup_variable("moveht", & $$->segment_height); - lookup_variable("movewid", & $$->segment_width); - $$->dir = current_direction; - } - | SPLINE - { - $$ = new object_spec(SPLINE_OBJECT); - lookup_variable("lineht", & $$->segment_height); - lookup_variable("linewid", & $$->segment_width); - $$->dir = current_direction; - } - | text %prec TEXT - { - $$ = new object_spec(TEXT_OBJECT); - $$->text = new text_item($1.str, $1.filename, $1.lineno); - } - | PLOT expr - { - $$ = new object_spec(TEXT_OBJECT); - $$->text = new text_item(format_number(0, $2), 0, -1); - } - | PLOT expr text - { - $$ = new object_spec(TEXT_OBJECT); - $$->text = new text_item(format_number($3.str, $2), - $3.filename, $3.lineno); - a_delete $3.str; - } - | '[' - { - saved_state *p = new saved_state; - $$ = p; - p->x = current_position.x; - p->y = current_position.y; - p->dir = current_direction; - p->tbl = current_table; - p->prev = current_saved_state; - current_position.x = 0.0; - current_position.y = 0.0; - current_table = new PTABLE(place); - current_saved_state = p; - olist.append(make_mark_object()); - } - element_list ']' - { - current_position.x = $2->x; - current_position.y = $2->y; - current_direction = $2->dir; - $$ = new object_spec(BLOCK_OBJECT); - olist.wrap_up_block(& $$->oblist); - $$->tbl = current_table; - current_table = $2->tbl; - current_saved_state = $2->prev; - delete $2; - } - | object_spec HEIGHT expr - { - $$ = $1; - $$->height = $3; - $$->flags |= HAS_HEIGHT; - } - | object_spec RADIUS expr - { - $$ = $1; - $$->radius = $3; - $$->flags |= HAS_RADIUS; - } - | object_spec WIDTH expr - { - $$ = $1; - $$->width = $3; - $$->flags |= HAS_WIDTH; - } - | object_spec DIAMETER expr - { - $$ = $1; - $$->radius = $3/2.0; - $$->flags |= HAS_RADIUS; - } - | object_spec expr %prec HEIGHT - { - $$ = $1; - $$->flags |= HAS_SEGMENT; - switch ($$->dir) { - case UP_DIRECTION: - $$->segment_pos.y += $2; - break; - case DOWN_DIRECTION: - $$->segment_pos.y -= $2; - break; - case RIGHT_DIRECTION: - $$->segment_pos.x += $2; - break; - case LEFT_DIRECTION: - $$->segment_pos.x -= $2; - break; - } - } - | object_spec UP - { - $$ = $1; - $$->dir = UP_DIRECTION; - $$->flags |= HAS_SEGMENT; - $$->segment_pos.y += $$->segment_height; - } - | object_spec UP expr - { - $$ = $1; - $$->dir = UP_DIRECTION; - $$->flags |= HAS_SEGMENT; - $$->segment_pos.y += $3; - } - | object_spec DOWN - { - $$ = $1; - $$->dir = DOWN_DIRECTION; - $$->flags |= HAS_SEGMENT; - $$->segment_pos.y -= $$->segment_height; - } - | object_spec DOWN expr - { - $$ = $1; - $$->dir = DOWN_DIRECTION; - $$->flags |= HAS_SEGMENT; - $$->segment_pos.y -= $3; - } - | object_spec RIGHT - { - $$ = $1; - $$->dir = RIGHT_DIRECTION; - $$->flags |= HAS_SEGMENT; - $$->segment_pos.x += $$->segment_width; - } - | object_spec RIGHT expr - { - $$ = $1; - $$->dir = RIGHT_DIRECTION; - $$->flags |= HAS_SEGMENT; - $$->segment_pos.x += $3; - } - | object_spec LEFT - { - $$ = $1; - $$->dir = LEFT_DIRECTION; - $$->flags |= HAS_SEGMENT; - $$->segment_pos.x -= $$->segment_width; - } - | object_spec LEFT expr - { - $$ = $1; - $$->dir = LEFT_DIRECTION; - $$->flags |= HAS_SEGMENT; - $$->segment_pos.x -= $3; - } - | object_spec FROM position - { - $$ = $1; - $$->flags |= HAS_FROM; - $$->from.x = $3.x; - $$->from.y = $3.y; - } - | object_spec TO position - { - $$ = $1; - if ($$->flags & HAS_SEGMENT) - $$->segment_list = new segment($$->segment_pos, - $$->segment_is_absolute, - $$->segment_list); - $$->flags |= HAS_SEGMENT; - $$->segment_pos.x = $3.x; - $$->segment_pos.y = $3.y; - $$->segment_is_absolute = 1; - $$->flags |= HAS_TO; - $$->to.x = $3.x; - $$->to.y = $3.y; - } - | object_spec AT position - { - $$ = $1; - $$->flags |= HAS_AT; - $$->at.x = $3.x; - $$->at.y = $3.y; - if ($$->type != ARC_OBJECT) { - $$->flags |= HAS_FROM; - $$->from.x = $3.x; - $$->from.y = $3.y; - } - } - | object_spec WITH path - { - $$ = $1; - $$->flags |= HAS_WITH; - $$->with = $3; - } - | object_spec WITH position %prec ',' - { - $$ = $1; - $$->flags |= HAS_WITH; - position pos; - pos.x = $3.x; - pos.y = $3.y; - $$->with = new path(pos); - } - | object_spec BY expr_pair - { - $$ = $1; - $$->flags |= HAS_SEGMENT; - $$->segment_pos.x += $3.x; - $$->segment_pos.y += $3.y; - } - | object_spec THEN - { - $$ = $1; - if ($$->flags & HAS_SEGMENT) { - $$->segment_list = new segment($$->segment_pos, - $$->segment_is_absolute, - $$->segment_list); - $$->flags &= ~HAS_SEGMENT; - $$->segment_pos.x = $$->segment_pos.y = 0.0; - $$->segment_is_absolute = 0; - } - } - | object_spec SOLID - { - $$ = $1; // nothing - } - | object_spec DOTTED - { - $$ = $1; - $$->flags |= IS_DOTTED; - lookup_variable("dashwid", & $$->dash_width); - } - | object_spec DOTTED expr - { - $$ = $1; - $$->flags |= IS_DOTTED; - $$->dash_width = $3; - } - | object_spec DASHED - { - $$ = $1; - $$->flags |= IS_DASHED; - lookup_variable("dashwid", & $$->dash_width); - } - | object_spec DASHED expr - { - $$ = $1; - $$->flags |= IS_DASHED; - $$->dash_width = $3; - } - | object_spec FILL - { - $$ = $1; - $$->flags |= IS_DEFAULT_FILLED; - } - | object_spec FILL expr - { - $$ = $1; - $$->flags |= IS_FILLED; - $$->fill = $3; - } - | object_spec SHADED text - { - $$ = $1; - $$->flags |= (IS_SHADED | IS_FILLED); - $$->shaded = new char[strlen($3.str)+1]; - strcpy($$->shaded, $3.str); - } - | object_spec COLORED text - { - $$ = $1; - $$->flags |= (IS_SHADED | IS_OUTLINED | IS_FILLED); - $$->shaded = new char[strlen($3.str)+1]; - strcpy($$->shaded, $3.str); - $$->outlined = new char[strlen($3.str)+1]; - strcpy($$->outlined, $3.str); - } - | object_spec OUTLINED text - { - $$ = $1; - $$->flags |= IS_OUTLINED; - $$->outlined = new char[strlen($3.str)+1]; - strcpy($$->outlined, $3.str); - } - | object_spec CHOP - { - $$ = $1; - // line chop chop means line chop 0 chop 0 - if ($$->flags & IS_DEFAULT_CHOPPED) { - $$->flags |= IS_CHOPPED; - $$->flags &= ~IS_DEFAULT_CHOPPED; - $$->start_chop = $$->end_chop = 0.0; - } - else if ($$->flags & IS_CHOPPED) { - $$->end_chop = 0.0; - } - else { - $$->flags |= IS_DEFAULT_CHOPPED; - } - } - | object_spec CHOP expr - { - $$ = $1; - if ($$->flags & IS_DEFAULT_CHOPPED) { - $$->flags |= IS_CHOPPED; - $$->flags &= ~IS_DEFAULT_CHOPPED; - $$->start_chop = 0.0; - $$->end_chop = $3; - } - else if ($$->flags & IS_CHOPPED) { - $$->end_chop = $3; - } - else { - $$->start_chop = $$->end_chop = $3; - $$->flags |= IS_CHOPPED; - } - } - | object_spec SAME - { - $$ = $1; - $$->flags |= IS_SAME; - } - | object_spec INVISIBLE - { - $$ = $1; - $$->flags |= IS_INVISIBLE; - } - | object_spec LEFT_ARROW_HEAD - { - $$ = $1; - $$->flags |= HAS_LEFT_ARROW_HEAD; - } - | object_spec RIGHT_ARROW_HEAD - { - $$ = $1; - $$->flags |= HAS_RIGHT_ARROW_HEAD; - } - | object_spec DOUBLE_ARROW_HEAD - { - $$ = $1; - $$->flags |= (HAS_LEFT_ARROW_HEAD|HAS_RIGHT_ARROW_HEAD); - } - | object_spec CW - { - $$ = $1; - $$->flags |= IS_CLOCKWISE; - } - | object_spec CCW - { - $$ = $1; - $$->flags &= ~IS_CLOCKWISE; - } - | object_spec text %prec TEXT - { - $$ = $1; - text_item **p; - for (p = & $$->text; *p; p = &(*p)->next) - ; - *p = new text_item($2.str, $2.filename, $2.lineno); - } - | object_spec LJUST - { - $$ = $1; - if ($$->text) { - text_item *p; - for (p = $$->text; p->next; p = p->next) - ; - p->adj.h = LEFT_ADJUST; - } - } - | object_spec RJUST - { - $$ = $1; - if ($$->text) { - text_item *p; - for (p = $$->text; p->next; p = p->next) - ; - p->adj.h = RIGHT_ADJUST; - } - } - | object_spec ABOVE - { - $$ = $1; - if ($$->text) { - text_item *p; - for (p = $$->text; p->next; p = p->next) - ; - p->adj.v = ABOVE_ADJUST; - } - } - | object_spec BELOW - { - $$ = $1; - if ($$->text) { - text_item *p; - for (p = $$->text; p->next; p = p->next) - ; - p->adj.v = BELOW_ADJUST; - } - } - | object_spec THICKNESS expr - { - $$ = $1; - $$->flags |= HAS_THICKNESS; - $$->thickness = $3; - } - | object_spec ALIGNED - { - $$ = $1; - $$->flags |= IS_ALIGNED; - } - ; - -text: - TEXT - { $$ = $1; } - | SPRINTF '(' TEXT sprintf_args ')' - { - $$.filename = $3.filename; - $$.lineno = $3.lineno; - $$.str = do_sprintf($3.str, $4.v, $4.nv); - a_delete $4.v; - a_delete $3.str; - } - ; - -sprintf_args: - /* empty */ - { - $$.v = 0; - $$.nv = 0; - $$.maxv = 0; - } - | sprintf_args ',' expr - { - $$ = $1; - if ($$.nv >= $$.maxv) { - if ($$.nv == 0) { - $$.v = new double[4]; - $$.maxv = 4; - } - else { - double *oldv = $$.v; - $$.maxv *= 2; - $$.v = new double[$$.maxv]; - memcpy($$.v, oldv, $$.nv*sizeof(double)); - a_delete oldv; - } - } - $$.v[$$.nv] = $3; - $$.nv += 1; - } - ; - -position: - position_not_place - { $$ = $1; } - | place - { - position pos = $1; - $$.x = pos.x; - $$.y = pos.y; - } - ; - -position_not_place: - expr_pair - { $$ = $1; } - | position '+' expr_pair - { - $$.x = $1.x + $3.x; - $$.y = $1.y + $3.y; - } - | position '-' expr_pair - { - $$.x = $1.x - $3.x; - $$.y = $1.y - $3.y; - } - | '(' position ',' position ')' - { - $$.x = $2.x; - $$.y = $4.y; - } - | expr between position AND position - { - $$.x = (1.0 - $1)*$3.x + $1*$5.x; - $$.y = (1.0 - $1)*$3.y + $1*$5.y; - } - | expr '<' position ',' position '>' - { - $$.x = (1.0 - $1)*$3.x + $1*$5.x; - $$.y = (1.0 - $1)*$3.y + $1*$5.y; - } - ; - -between: - BETWEEN - | OF THE WAY BETWEEN - ; - -expr_pair: - expr ',' expr - { - $$.x = $1; - $$.y = $3; - } - | '(' expr_pair ')' - { $$ = $2; } - ; - -place: - /* line at A left == line (at A) left */ - label %prec CHOP - { $$ = $1; } - | label corner - { - path pth($2); - if (!pth.follow($1, & $$)) - YYABORT; - } - | corner label - { - path pth($1); - if (!pth.follow($2, & $$)) - YYABORT; - } - | corner OF label - { - path pth($1); - if (!pth.follow($3, & $$)) - YYABORT; - } - | HERE - { - $$.x = current_position.x; - $$.y = current_position.y; - $$.obj = 0; - } - ; - -label: - LABEL - { - place *p = lookup_label($1); - if (!p) { - lex_error("there is no place `%1'", $1); - YYABORT; - } - $$ = *p; - a_delete $1; - } - | nth_primitive - { $$.obj = $1; } - | label '.' LABEL - { - path pth($3); - if (!pth.follow($1, & $$)) - YYABORT; - } - ; - -ordinal: - ORDINAL - { $$ = $1; } - | '`' any_expr TH - { - // XXX Check for overflow (and non-integers?). - $$ = (int)$2; - } - ; - -optional_ordinal_last: - LAST - { $$ = 1; } - | ordinal LAST - { $$ = $1; } - ; - -nth_primitive: - ordinal object_type - { - int count = 0; - object *p; - for (p = olist.head; p != 0; p = p->next) - if (p->type() == $2 && ++count == $1) { - $$ = p; - break; - } - if (p == 0) { - lex_error("there is no %1%2 %3", $1, ordinal_postfix($1), - object_type_name($2)); - YYABORT; - } - } - | optional_ordinal_last object_type - { - int count = 0; - object *p; - for (p = olist.tail; p != 0; p = p->prev) - if (p->type() == $2 && ++count == $1) { - $$ = p; - break; - } - if (p == 0) { - lex_error("there is no %1%2 last %3", $1, - ordinal_postfix($1), object_type_name($2)); - YYABORT; - } - } - ; - -object_type: - BOX - { $$ = BOX_OBJECT; } - | CIRCLE - { $$ = CIRCLE_OBJECT; } - | ELLIPSE - { $$ = ELLIPSE_OBJECT; } - | ARC - { $$ = ARC_OBJECT; } - | LINE - { $$ = LINE_OBJECT; } - | ARROW - { $$ = ARROW_OBJECT; } - | SPLINE - { $$ = SPLINE_OBJECT; } - | '[' ']' - { $$ = BLOCK_OBJECT; } - | TEXT - { $$ = TEXT_OBJECT; } - ; - -label_path: - '.' LABEL - { $$ = new path($2); } - | label_path '.' LABEL - { - $$ = $1; - $$->append($3); - } - ; - -relative_path: - corner %prec CHOP - { $$ = new path($1); } - /* give this a lower precedence than LEFT and RIGHT so that - [A: box] with .A left == [A: box] with (.A left) */ - | label_path %prec TEXT - { $$ = $1; } - | label_path corner - { - $$ = $1; - $$->append($2); - } - ; - -path: - relative_path - { $$ = $1; } - | '(' relative_path ',' relative_path ')' - { - $$ = $2; - $$->set_ypath($4); - } - /* The rest of these rules are a compatibility sop. */ - | ORDINAL LAST object_type relative_path - { - lex_warning("`%1%2 last %3' in `with' argument ignored", - $1, ordinal_postfix($1), object_type_name($3)); - $$ = $4; - } - | LAST object_type relative_path - { - lex_warning("`last %1' in `with' argument ignored", - object_type_name($2)); - $$ = $3; - } - | ORDINAL object_type relative_path - { - lex_warning("`%1%2 %3' in `with' argument ignored", - $1, ordinal_postfix($1), object_type_name($2)); - $$ = $3; - } - | LABEL relative_path - { - lex_warning("initial `%1' in `with' argument ignored", $1); - a_delete $1; - $$ = $2; - } - ; - -corner: - DOT_N - { $$ = &object::north; } - | DOT_E - { $$ = &object::east; } - | DOT_W - { $$ = &object::west; } - | DOT_S - { $$ = &object::south; } - | DOT_NE - { $$ = &object::north_east; } - | DOT_SE - { $$ = &object:: south_east; } - | DOT_NW - { $$ = &object::north_west; } - | DOT_SW - { $$ = &object::south_west; } - | DOT_C - { $$ = &object::center; } - | DOT_START - { $$ = &object::start; } - | DOT_END - { $$ = &object::end; } - | TOP - { $$ = &object::north; } - | BOTTOM - { $$ = &object::south; } - | LEFT - { $$ = &object::west; } - | RIGHT - { $$ = &object::east; } - | UPPER LEFT - { $$ = &object::north_west; } - | LOWER LEFT - { $$ = &object::south_west; } - | UPPER RIGHT - { $$ = &object::north_east; } - | LOWER RIGHT - { $$ = &object::south_east; } - | LEFT_CORNER - { $$ = &object::west; } - | RIGHT_CORNER - { $$ = &object::east; } - | UPPER LEFT_CORNER - { $$ = &object::north_west; } - | LOWER LEFT_CORNER - { $$ = &object::south_west; } - | UPPER RIGHT_CORNER - { $$ = &object::north_east; } - | LOWER RIGHT_CORNER - { $$ = &object::south_east; } - | NORTH - { $$ = &object::north; } - | SOUTH - { $$ = &object::south; } - | EAST - { $$ = &object::east; } - | WEST - { $$ = &object::west; } - | CENTER - { $$ = &object::center; } - | START - { $$ = &object::start; } - | END - { $$ = &object::end; } - ; - -expr: - VARIABLE - { - if (!lookup_variable($1, & $$)) { - lex_error("there is no variable `%1'", $1); - YYABORT; - } - a_delete $1; - } - | NUMBER - { $$ = $1; } - | place DOT_X - { - if ($1.obj != 0) - $$ = $1.obj->origin().x; - else - $$ = $1.x; - } - | place DOT_Y - { - if ($1.obj != 0) - $$ = $1.obj->origin().y; - else - $$ = $1.y; - } - | place DOT_HT - { - if ($1.obj != 0) - $$ = $1.obj->height(); - else - $$ = 0.0; - } - | place DOT_WID - { - if ($1.obj != 0) - $$ = $1.obj->width(); - else - $$ = 0.0; - } - | place DOT_RAD - { - if ($1.obj != 0) - $$ = $1.obj->radius(); - else - $$ = 0.0; - } - | expr '+' expr - { $$ = $1 + $3; } - | expr '-' expr - { $$ = $1 - $3; } - | expr '*' expr - { $$ = $1 * $3; } - | expr '/' expr - { - if ($3 == 0.0) { - lex_error("division by zero"); - YYABORT; - } - $$ = $1/$3; - } - | expr '%' expr - { - if ($3 == 0.0) { - lex_error("modulus by zero"); - YYABORT; - } - $$ = fmod($1, $3); - } - | expr '^' expr - { - errno = 0; - $$ = pow($1, $3); - if (errno == EDOM) { - lex_error("arguments to `^' operator out of domain"); - YYABORT; - } - if (errno == ERANGE) { - lex_error("result of `^' operator out of range"); - YYABORT; - } - } - | '-' expr %prec '!' - { $$ = -$2; } - | '(' any_expr ')' - { $$ = $2; } - | SIN '(' any_expr ')' - { - errno = 0; - $$ = sin($3); - if (errno == ERANGE) { - lex_error("sin result out of range"); - YYABORT; - } - } - | COS '(' any_expr ')' - { - errno = 0; - $$ = cos($3); - if (errno == ERANGE) { - lex_error("cos result out of range"); - YYABORT; - } - } - | ATAN2 '(' any_expr ',' any_expr ')' - { - errno = 0; - $$ = atan2($3, $5); - if (errno == EDOM) { - lex_error("atan2 argument out of domain"); - YYABORT; - } - if (errno == ERANGE) { - lex_error("atan2 result out of range"); - YYABORT; - } - } - | LOG '(' any_expr ')' - { - errno = 0; - $$ = log10($3); - if (errno == ERANGE) { - lex_error("log result out of range"); - YYABORT; - } - } - | EXP '(' any_expr ')' - { - errno = 0; - $$ = pow(10.0, $3); - if (errno == ERANGE) { - lex_error("exp result out of range"); - YYABORT; - } - } - | SQRT '(' any_expr ')' - { - errno = 0; - $$ = sqrt($3); - if (errno == EDOM) { - lex_error("sqrt argument out of domain"); - YYABORT; - } - } - | K_MAX '(' any_expr ',' any_expr ')' - { $$ = $3 > $5 ? $3 : $5; } - | K_MIN '(' any_expr ',' any_expr ')' - { $$ = $3 < $5 ? $3 : $5; } - | INT '(' any_expr ')' - { $$ = floor($3); } - | RAND '(' any_expr ')' - { $$ = 1.0 + floor(((rand()&0x7fff)/double(0x7fff))*$3); } - | RAND '(' ')' - { - /* return a random number in the range >=0, <1 */ - /* portable, but not very random */ - $$ = (rand() & 0x7fff) / double(0x8000); - } - | SRAND '(' any_expr ')' - { - $$ = 0; - srand((unsigned int)$3); - } - | expr '<' expr - { $$ = ($1 < $3); } - | expr LESSEQUAL expr - { $$ = ($1 <= $3); } - | expr '>' expr - { $$ = ($1 > $3); } - | expr GREATEREQUAL expr - { $$ = ($1 >= $3); } - | expr EQUALEQUAL expr - { $$ = ($1 == $3); } - | expr NOTEQUAL expr - { $$ = ($1 != $3); } - | expr ANDAND expr - { $$ = ($1 != 0.0 && $3 != 0.0); } - | expr OROR expr - { $$ = ($1 != 0.0 || $3 != 0.0); } - | '!' expr - { $$ = ($2 == 0.0); } - - ; -_ATEOF - - -# Pass plenty of options, to exercise plenty of code, even if we -# don't actually check the output. But SEGV is watching us, and -# so might do dmalloc. -$at_traceoff -echo "existing.at:2751: bison --verbose --defines input.y" -echo existing.at:2751 >$at_check_line_file -( $at_traceon; bison --verbose --defines input.y ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "existing.at:2751: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - - $at_traceoff - $at_times_p && times >$at_times_file - ) 5>&1 2>&1 | eval $at_tee_pipe - at_status=`cat $at_status_file` - ;; - - - banner-14 ) # Banner 14. regression.at:19 - cat <<\_ATEOF - -Regression tests. - -_ATEOF - ;; - - 98 ) # 98. regression.at:27: Early token definitions - at_setup_line='regression.at:27' - at_desc='Early token definitions' - $at_quiet $ECHO_N " 98: Early token definitions $ECHO_C" - at_xfail=no - ( - echo "98. regression.at:27: testing ..." - $at_traceon - - -# Found in GCJ: they expect the tokens to be defined before the user -# prologue, so that they can use the token definitions in it. - -cat >input.y <<'_ATEOF' -%{ -#if HAVE_CONFIG_H -# include - /* We don't need perfect functions for these tests. */ -# undef malloc -# undef memcmp -# undef realloc -#endif -%} - -%{ -void yyerror (const char *s); -int yylex (void); -%} - -%union -{ - int val; -}; -%{ -#ifndef MY_TOKEN -# error "MY_TOKEN not defined." -#endif -%} -%token MY_TOKEN -%% -exp: MY_TOKEN; -%% -_ATEOF - - - -$at_traceoff -echo "regression.at:53: bison -o input.c input.y" -echo regression.at:53 >$at_check_line_file -( $at_traceon; bison -o input.c input.y ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "regression.at:53: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - -$at_traceoff -echo "regression.at:54: \$CC \$CFLAGS \$CPPFLAGS -c input.c -o input.o" -echo regression.at:54 >$at_check_line_file -( $at_traceon; $CC $CFLAGS $CPPFLAGS -c input.c -o input.o ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo stderr:; cat $at_stderr -echo stdout:; cat $at_stdout -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "regression.at:54: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - - $at_traceoff - $at_times_p && times >$at_times_file - ) 5>&1 2>&1 | eval $at_tee_pipe - at_status=`cat $at_status_file` - ;; - - 99 ) # 99. regression.at:65: Braces parsing - at_setup_line='regression.at:65' - at_desc='Braces parsing' - $at_quiet $ECHO_N " 99: Braces parsing $ECHO_C" - at_xfail=no - ( - echo "99. regression.at:65: testing ..." - $at_traceon - - -cat >input.y <<'_ATEOF' -/* Bison used to swallow the character after `}'. */ - -%% -exp: { tests = {{{{{{{{{{}}}}}}}}}}; }; -%% -_ATEOF - - -$at_traceoff -echo "regression.at:75: bison -v -o input.c input.y" -echo regression.at:75 >$at_check_line_file -( $at_traceon; bison -v -o input.c input.y ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "regression.at:75: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - -$at_traceoff -echo "regression.at:77: grep 'tests = {{{{{{{{{{}}}}}}}}}};' input.c" -echo regression.at:77 >$at_check_line_file -( $at_traceon; grep 'tests = {{{{{{{{{{}}}}}}}}}};' input.c ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -echo stdout:; cat $at_stdout -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "regression.at:77: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - - $at_traceoff - $at_times_p && times >$at_times_file - ) 5>&1 2>&1 | eval $at_tee_pipe - at_status=`cat $at_status_file` - ;; - - 100 ) # 100. regression.at:87: Duplicate string - at_setup_line='regression.at:87' - at_desc='Duplicate string' - $at_quiet $ECHO_N "100: Duplicate string $ECHO_C" - at_xfail=no - ( - echo "100. regression.at:87: testing ..." - $at_traceon - - -cat >input.y <<'_ATEOF' -/* `Bison -v' used to dump core when two tokens are defined with the same - string, as LE and GE below. */ - -%token NUM -%token LE "<=" -%token GE "<=" - -%% -exp: '(' exp ')' | NUM ; -%% -_ATEOF - - -$at_traceoff -echo "regression.at:104: bison -v -o input.c input.y" -echo regression.at:104 >$at_check_line_file -( $at_traceon; bison -v -o input.c input.y ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo >>$at_stderr; echo "input.y:6.8-14: warning: symbol \`\"<=\"' used more than once as a literal string -" | $at_diff - $at_stderr || at_failed=: -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "regression.at:104: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - - $at_traceoff - $at_times_p && times >$at_times_file - ) 5>&1 2>&1 | eval $at_tee_pipe - at_status=`cat $at_status_file` - ;; - - 101 ) # 101. regression.at:113: Rule Line Numbers - at_setup_line='regression.at:113' - at_desc='Rule Line Numbers' - $at_quiet $ECHO_N "101: Rule Line Numbers $ECHO_C" - at_xfail=no - ( - echo "101. regression.at:113: testing ..." - $at_traceon - - - - -cat >input.y <<'_ATEOF' -%% -expr: -'a' - -{ - -} - -'b' - -{ - -} - -| - - -{ - - -} - -'c' - -{ - -}; -_ATEOF - - -$at_traceoff -echo "regression.at:147: bison -o input.c -v input.y" -echo regression.at:147 >$at_check_line_file -( $at_traceon; bison -o input.c -v input.y ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "regression.at:147: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - -# Check the contents of the report. -$at_traceoff -echo "regression.at:246: cat input.output" -echo regression.at:246 >$at_check_line_file -( $at_traceon; cat input.output ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -echo >>$at_stdout; echo "Grammar - - 0 \$accept: expr \$end - - 1 @1: /* empty */ - - 2 expr: 'a' @1 'b' - - 3 @2: /* empty */ - - 4 expr: @2 'c' - - -Terminals, with rules where they appear - -\$end (0) 0 -'a' (97) 2 -'b' (98) 2 -'c' (99) 4 -error (256) - - -Nonterminals, with rules where they appear - -\$accept (6) - on left: 0 -expr (7) - on left: 2 4, on right: 0 -@1 (8) - on left: 1, on right: 2 -@2 (9) - on left: 3, on right: 4 - - -state 0 - - 0 \$accept: . expr \$end - - 'a' shift, and go to state 1 - - \$default reduce using rule 3 (@2) - - expr go to state 2 - @2 go to state 3 - - -state 1 - - 2 expr: 'a' . @1 'b' - - \$default reduce using rule 1 (@1) - - @1 go to state 4 - - -state 2 - - 0 \$accept: expr . \$end - - \$end shift, and go to state 5 - - -state 3 - - 4 expr: @2 . 'c' - - 'c' shift, and go to state 6 - - -state 4 - - 2 expr: 'a' @1 . 'b' - - 'b' shift, and go to state 7 - - -state 5 - - 0 \$accept: expr \$end . - - \$default accept - - -state 6 - - 4 expr: @2 'c' . - - \$default reduce using rule 4 (expr) - - -state 7 - - 2 expr: 'a' @1 'b' . - - \$default reduce using rule 2 (expr) -" | $at_diff - $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "regression.at:246: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - - $at_traceoff - $at_times_p && times >$at_times_file - ) 5>&1 2>&1 | eval $at_tee_pipe - at_status=`cat $at_status_file` - ;; - - 102 ) # 102. regression.at:257: Mixing %token styles - at_setup_line='regression.at:257' - at_desc='Mixing %token styles' - $at_quiet $ECHO_N "102: Mixing %token styles $ECHO_C" - at_xfail=no - ( - echo "102. regression.at:257: testing ..." - $at_traceon - - -# Taken from the documentation. -cat >input.y <<'_ATEOF' -%token OR "||" -%token LE 134 "<=" -%left OR "<=" -%% -exp: ; -%% -_ATEOF - - -$at_traceoff -echo "regression.at:269: bison -v -o input.c input.y" -echo regression.at:269 >$at_check_line_file -( $at_traceon; bison -v -o input.c input.y ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "regression.at:269: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - - $at_traceoff - $at_times_p && times >$at_times_file - ) 5>&1 2>&1 | eval $at_tee_pipe - at_status=`cat $at_status_file` - ;; - - 103 ) # 103. regression.at:280: Invalid inputs - at_setup_line='regression.at:280' - at_desc='Invalid inputs' - $at_quiet $ECHO_N "103: Invalid inputs $ECHO_C" - at_xfail=no - ( - echo "103. regression.at:280: testing ..." - $at_traceon - - -cat >input.y <<'_ATEOF' -%% -? -default: 'a' } -%& -%a-does-not-exist -%- -%{ -_ATEOF - - -$at_traceoff -echo "regression.at:301: bison input.y" -echo regression.at:301 >$at_check_line_file -( $at_traceon; bison input.y ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo >>$at_stderr; echo "input.y:2.1: invalid character: \`?' -input.y:3.14: invalid character: \`}' -input.y:4.1: invalid character: \`%' -input.y:4.2: invalid character: \`&' -input.y:5.1-17: invalid directive: \`%a-does-not-exist' -input.y:6.1: invalid character: \`%' -input.y:6.2: invalid character: \`-' -input.y:7.1-8.0: missing \`%}' at end of file -" | $at_diff - $at_stderr || at_failed=: -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 1) ;; - *) echo "regression.at:301: exit code was $at_status, expected 1" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - - $at_traceoff - $at_times_p && times >$at_times_file - ) 5>&1 2>&1 | eval $at_tee_pipe - at_status=`cat $at_status_file` - ;; - - 104 ) # 104. regression.at:312: Token definitions - at_setup_line='regression.at:312' - at_desc='Token definitions' - $at_quiet $ECHO_N "104: Token definitions $ECHO_C" - at_xfail=no - ( - echo "104. regression.at:312: testing ..." - $at_traceon - - -# Bison managed, when fed with `%token 'f' "f"' to #define 'f'! -cat >input.y <<'_ATEOF' -%{ -#if HAVE_CONFIG_H -# include - /* We don't need perfect functions for these tests. */ -# undef malloc -# undef memcmp -# undef realloc -#endif -%} - -%{ -void yyerror (const char *s); -int yylex (void); -%} -%token MYEOF 0 "end of file" -%token 'a' "a" -%token b "b" -%token c 'c' -%token 'd' d -%% -exp: "a"; -_ATEOF - - - -$at_traceoff -echo "regression.at:329: bison -o input.c input.y" -echo regression.at:329 >$at_check_line_file -( $at_traceon; bison -o input.c input.y ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "regression.at:329: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - -$at_traceoff -echo "regression.at:330: \$CC \$CFLAGS \$CPPFLAGS -c input.c -o input.o" -echo regression.at:330 >$at_check_line_file -( $at_traceon; $CC $CFLAGS $CPPFLAGS -c input.c -o input.o ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo stderr:; cat $at_stderr -echo stdout:; cat $at_stdout -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "regression.at:330: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - $at_traceoff - $at_times_p && times >$at_times_file - ) 5>&1 2>&1 | eval $at_tee_pipe - at_status=`cat $at_status_file` - ;; - - 105 ) # 105. regression.at:340: Characters Escapes - at_setup_line='regression.at:340' - at_desc='Characters Escapes' - $at_quiet $ECHO_N "105: Characters Escapes $ECHO_C" - at_xfail=no - ( - echo "105. regression.at:340: testing ..." - $at_traceon - - -cat >input.y <<'_ATEOF' -%{ -#if HAVE_CONFIG_H -# include - /* We don't need perfect functions for these tests. */ -# undef malloc -# undef memcmp -# undef realloc -#endif -%} - -%{ -void yyerror (const char *s); -int yylex (void); -%} -%% -exp: - '\'' "\'" -| '\"' "\"" -| '"' "'" -; -_ATEOF - - -# Pacify font-lock-mode: " - -$at_traceoff -echo "regression.at:356: bison -o input.c input.y" -echo regression.at:356 >$at_check_line_file -( $at_traceon; bison -o input.c input.y ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "regression.at:356: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - -$at_traceoff -echo "regression.at:357: \$CC \$CFLAGS \$CPPFLAGS -c input.c -o input.o" -echo regression.at:357 >$at_check_line_file -( $at_traceon; $CC $CFLAGS $CPPFLAGS -c input.c -o input.o ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo stderr:; cat $at_stderr -echo stdout:; cat $at_stdout -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "regression.at:357: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - $at_traceoff - $at_times_p && times >$at_times_file - ) 5>&1 2>&1 | eval $at_tee_pipe - at_status=`cat $at_status_file` - ;; - - 106 ) # 106. regression.at:371: Web2c Report - at_setup_line='regression.at:371' - at_desc='Web2c Report' - $at_quiet $ECHO_N "106: Web2c Report $ECHO_C" - at_xfail=no - ( - echo "106. regression.at:371: testing ..." - $at_traceon - - - - -cat >input.y <<'_ATEOF' -%token undef_id_tok const_id_tok - -%start CONST_DEC_PART - -%% -CONST_DEC_PART: - CONST_DEC_LIST - ; - -CONST_DEC_LIST: - CONST_DEC - | CONST_DEC_LIST CONST_DEC - ; - -CONST_DEC: - { } undef_id_tok '=' const_id_tok ';' - ; -%% -_ATEOF - - -$at_traceoff -echo "regression.at:396: bison -v input.y" -echo regression.at:396 >$at_check_line_file -( $at_traceon; bison -v input.y ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "regression.at:396: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - -$at_traceoff -echo "regression.at:521: cat input.output" -echo regression.at:521 >$at_check_line_file -( $at_traceon; cat input.output ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -echo >>$at_stdout; echo "Grammar - - 0 \$accept: CONST_DEC_PART \$end - - 1 CONST_DEC_PART: CONST_DEC_LIST - - 2 CONST_DEC_LIST: CONST_DEC - 3 | CONST_DEC_LIST CONST_DEC - - 4 @1: /* empty */ - - 5 CONST_DEC: @1 undef_id_tok '=' const_id_tok ';' - - -Terminals, with rules where they appear - -\$end (0) 0 -';' (59) 5 -'=' (61) 5 -error (256) -undef_id_tok (258) 5 -const_id_tok (259) 5 - - -Nonterminals, with rules where they appear - -\$accept (7) - on left: 0 -CONST_DEC_PART (8) - on left: 1, on right: 0 -CONST_DEC_LIST (9) - on left: 2 3, on right: 1 3 -CONST_DEC (10) - on left: 5, on right: 2 3 -@1 (11) - on left: 4, on right: 5 - - -state 0 - - 0 \$accept: . CONST_DEC_PART \$end - - \$default reduce using rule 4 (@1) - - CONST_DEC_PART go to state 1 - CONST_DEC_LIST go to state 2 - CONST_DEC go to state 3 - @1 go to state 4 - - -state 1 - - 0 \$accept: CONST_DEC_PART . \$end - - \$end shift, and go to state 5 - - -state 2 - - 1 CONST_DEC_PART: CONST_DEC_LIST . - 3 CONST_DEC_LIST: CONST_DEC_LIST . CONST_DEC - - undef_id_tok reduce using rule 4 (@1) - \$default reduce using rule 1 (CONST_DEC_PART) - - CONST_DEC go to state 6 - @1 go to state 4 - - -state 3 - - 2 CONST_DEC_LIST: CONST_DEC . - - \$default reduce using rule 2 (CONST_DEC_LIST) - - -state 4 - - 5 CONST_DEC: @1 . undef_id_tok '=' const_id_tok ';' - - undef_id_tok shift, and go to state 7 - - -state 5 - - 0 \$accept: CONST_DEC_PART \$end . - - \$default accept - - -state 6 - - 3 CONST_DEC_LIST: CONST_DEC_LIST CONST_DEC . - - \$default reduce using rule 3 (CONST_DEC_LIST) - - -state 7 - - 5 CONST_DEC: @1 undef_id_tok . '=' const_id_tok ';' - - '=' shift, and go to state 8 - - -state 8 - - 5 CONST_DEC: @1 undef_id_tok '=' . const_id_tok ';' - - const_id_tok shift, and go to state 9 - - -state 9 - - 5 CONST_DEC: @1 undef_id_tok '=' const_id_tok . ';' - - ';' shift, and go to state 10 - - -state 10 - - 5 CONST_DEC: @1 undef_id_tok '=' const_id_tok ';' . - - \$default reduce using rule 5 (CONST_DEC) -" | $at_diff - $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "regression.at:521: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - - $at_traceoff - $at_times_p && times >$at_times_file - ) 5>&1 2>&1 | eval $at_tee_pipe - at_status=`cat $at_status_file` - ;; - - 107 ) # 107. regression.at:548: Web2c Actions - at_setup_line='regression.at:548' - at_desc='Web2c Actions' - $at_quiet $ECHO_N "107: Web2c Actions $ECHO_C" - at_xfail=no - ( - echo "107. regression.at:548: testing ..." - $at_traceon - - - - -cat >input.y <<'_ATEOF' -%% -statement: struct_stat; -struct_stat: /* empty. */ | if else; -if: "if" "const" "then" statement; -else: "else" statement; -%% -_ATEOF - - -$at_traceoff -echo "regression.at:561: bison -v -o input.c input.y" -echo regression.at:561 >$at_check_line_file -( $at_traceon; bison -v -o input.c input.y ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "regression.at:561: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - -# Check only the tables. We don't use --no-parser, because it is -# still to be implemented in the experimental branch of Bison. -sed -n 's/ *$//;/^static const.*\[\] =/,/^}/p' input.c >tables.c - -$at_traceoff -echo "regression.at:659: cat tables.c" -echo regression.at:659 >$at_check_line_file -( $at_traceon; cat tables.c ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -echo >>$at_stdout; echo "static const unsigned char yytranslate[] = -{ - 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 1, 2, 3, 4, - 5, 6 -}; -static const unsigned char yyprhs[] = -{ - 0, 0, 3, 5, 6, 9, 14 -}; -static const yysigned_char yyrhs[] = -{ - 8, 0, -1, 9, -1, -1, 10, 11, -1, 3, - 4, 5, 8, -1, 6, 8, -1 -}; -static const unsigned char yyrline[] = -{ - 0, 2, 2, 3, 3, 4, 5 -}; -static const char *const yytname[] = -{ - \"\$end\", \"error\", \"\$undefined\", \"\\\"if\\\"\", \"\\\"const\\\"\", \"\\\"then\\\"\", - \"\\\"else\\\"\", \"\$accept\", \"statement\", \"struct_stat\", \"if\", \"else\", 0 -}; -static const unsigned short int yytoknum[] = -{ - 0, 256, 257, 258, 259, 260, 261 -}; -static const unsigned char yyr1[] = -{ - 0, 7, 8, 9, 9, 10, 11 -}; -static const unsigned char yyr2[] = -{ - 0, 2, 1, 0, 2, 4, 2 -}; -static const unsigned char yydefact[] = -{ - 3, 0, 0, 2, 0, 0, 1, 3, 4, 3, - 6, 5 -}; -static const yysigned_char yydefgoto[] = -{ - -1, 2, 3, 4, 8 -}; -static const yysigned_char yypact[] = -{ - -2, -1, 4, -8, 0, 2, -8, -2, -8, -2, - -8, -8 -}; -static const yysigned_char yypgoto[] = -{ - -8, -7, -8, -8, -8 -}; -static const unsigned char yytable[] = -{ - 10, 1, 11, 5, 6, 0, 7, 9 -}; -static const yysigned_char yycheck[] = -{ - 7, 3, 9, 4, 0, -1, 6, 5 -}; -static const unsigned char yystos[] = -{ - 0, 3, 8, 9, 10, 4, 0, 6, 11, 5, - 8, 8 -}; -" | $at_diff - $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "regression.at:659: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - - $at_traceoff - $at_times_p && times >$at_times_file - ) 5>&1 2>&1 | eval $at_tee_pipe - at_status=`cat $at_status_file` - ;; - - 108 ) # 108. regression.at:792: Dancer - at_setup_line='regression.at:792' - at_desc='Dancer ' - $at_quiet $ECHO_N "108: Dancer $ECHO_C" - at_xfail=no - ( - echo "108. regression.at:792: testing ..." - $at_traceon - - - -# Using yacc.c? - - - - - - - -# yyerror receives the location if %location & %pure & (%glr or %parse-param). - -# yyerror always sees the locations (when activated), except if -# yacc & pure & !param. - - -# The interface is pure: either because %pure-parser, or because we -# are using the C++ parsers. - - - - - - - - - - - -cat >dancer.y <<'_ATEOF' -%{ -#if HAVE_CONFIG_H -# include - /* We don't need perfect functions for these tests. */ -# undef malloc -# undef memcmp -# undef realloc -#endif -%} - -%{ -static int yylex (void); -#include -static void yyerror (const char *); -%} - -%token ARROW INVALID NUMBER STRING DATA -%defines -%verbose -%error-verbose -/* Grammar follows */ -%% -line: header body - ; - -header: '<' from ARROW to '>' type ':' - | '<' ARROW to '>' type ':' - | ARROW to type ':' - | type ':' - | '<' '>' - ; - -from: DATA - | STRING - | INVALID - ; - -to: DATA - | STRING - | INVALID - ; - -type: DATA - | STRING - | INVALID - ; - -body: /* empty */ - | body member - ; - -member: STRING - | DATA - | '+' NUMBER - | '-' NUMBER - | NUMBER - | INVALID - ; -%% -static void -yyerror (const char *s) -{ - fprintf (stderr, "%s\n", s); -} - -static int -yylex (void) -{ - static int toknum = 0; - int tokens[] = - { - ':', -1 - }; - - return tokens[toknum++]; -} - -int -main (void) -{ - return yyparse (); -} -_ATEOF - - - -$at_traceoff -echo "regression.at:792: bison -o dancer.c dancer.y" -echo regression.at:792 >$at_check_line_file -( $at_traceon; bison -o dancer.c dancer.y ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "regression.at:792: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - -$at_traceoff -echo "regression.at:792: \$CC \$CFLAGS \$CPPFLAGS \$LDFLAGS dancer.c \$LIBS -o dancer" -echo regression.at:792 >$at_check_line_file -( $at_traceon; $CC $CFLAGS $CPPFLAGS $LDFLAGS dancer.c $LIBS -o dancer ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo stderr:; cat $at_stderr -echo stdout:; cat $at_stdout -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "regression.at:792: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - -$at_traceoff -echo "regression.at:792: \$PREPARSER ./dancer" -echo regression.at:792 >$at_check_line_file -( $at_traceon; $PREPARSER ./dancer ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo >>$at_stderr; echo "syntax error, unexpected ':' -" | $at_diff - $at_stderr || at_failed=: -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 1) ;; - *) echo "regression.at:792: exit code was $at_status, expected 1" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - - - - - - - - - - - - - - - - - - - $at_traceoff - $at_times_p && times >$at_times_file - ) 5>&1 2>&1 | eval $at_tee_pipe - at_status=`cat $at_status_file` - ;; - - 109 ) # 109. regression.at:793: Dancer %glr-parser - at_setup_line='regression.at:793' - at_desc='Dancer %glr-parser' - $at_quiet $ECHO_N "109: Dancer %glr-parser $ECHO_C" - at_xfail=no - ( - echo "109. regression.at:793: testing ..." - $at_traceon - - - -# Using yacc.c? - - - - - - - -# yyerror receives the location if %location & %pure & (%glr or %parse-param). - -# yyerror always sees the locations (when activated), except if -# yacc & pure & !param. - - -# The interface is pure: either because %pure-parser, or because we -# are using the C++ parsers. - - - - - - - - - - - -cat >dancer.y <<'_ATEOF' -%{ -#if HAVE_CONFIG_H -# include - /* We don't need perfect functions for these tests. */ -# undef malloc -# undef memcmp -# undef realloc -#endif -%} - -%{ -static int yylex (void); -#include -static void yyerror (const char *); -%} -%glr-parser -%token ARROW INVALID NUMBER STRING DATA -%defines -%verbose -%error-verbose -/* Grammar follows */ -%% -line: header body - ; - -header: '<' from ARROW to '>' type ':' - | '<' ARROW to '>' type ':' - | ARROW to type ':' - | type ':' - | '<' '>' - ; - -from: DATA - | STRING - | INVALID - ; - -to: DATA - | STRING - | INVALID - ; - -type: DATA - | STRING - | INVALID - ; - -body: /* empty */ - | body member - ; - -member: STRING - | DATA - | '+' NUMBER - | '-' NUMBER - | NUMBER - | INVALID - ; -%% -static void -yyerror (const char *s) -{ - fprintf (stderr, "%s\n", s); -} - -static int -yylex (void) -{ - static int toknum = 0; - int tokens[] = - { - ':', -1 - }; - - return tokens[toknum++]; -} - -int -main (void) -{ - return yyparse (); -} -_ATEOF - - - -$at_traceoff -echo "regression.at:793: bison -o dancer.c dancer.y" -echo regression.at:793 >$at_check_line_file -( $at_traceon; bison -o dancer.c dancer.y ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "regression.at:793: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - -$at_traceoff -echo "regression.at:793: \$CC \$CFLAGS \$CPPFLAGS \$LDFLAGS dancer.c \$LIBS -o dancer" -echo regression.at:793 >$at_check_line_file -( $at_traceon; $CC $CFLAGS $CPPFLAGS $LDFLAGS dancer.c $LIBS -o dancer ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo stderr:; cat $at_stderr -echo stdout:; cat $at_stdout -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "regression.at:793: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - -$at_traceoff -echo "regression.at:793: \$PREPARSER ./dancer" -echo regression.at:793 >$at_check_line_file -( $at_traceon; $PREPARSER ./dancer ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo >>$at_stderr; echo "syntax error, unexpected ':' -" | $at_diff - $at_stderr || at_failed=: -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 1) ;; - *) echo "regression.at:793: exit code was $at_status, expected 1" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - - - - - - - - - - - - - - - - - - - $at_traceoff - $at_times_p && times >$at_times_file - ) 5>&1 2>&1 | eval $at_tee_pipe - at_status=`cat $at_status_file` - ;; - - 110 ) # 110. regression.at:794: Dancer %skeleton "lalr1.cc" - at_setup_line='regression.at:794' - at_desc='Dancer %skeleton "lalr1.cc"' - $at_quiet $ECHO_N "110: Dancer %skeleton "lalr1.cc" $ECHO_C" - at_xfail=no - ( - echo "110. regression.at:794: testing ..." - $at_traceon - - - -# Using yacc.c? - - - - - - - -# yyerror receives the location if %location & %pure & (%glr or %parse-param). - -# yyerror always sees the locations (when activated), except if -# yacc & pure & !param. - - -# The interface is pure: either because %pure-parser, or because we -# are using the C++ parsers. - - - - - - - - - - - -cat >dancer.y <<'_ATEOF' -%{ -#if HAVE_CONFIG_H -# include - /* We don't need perfect functions for these tests. */ -# undef malloc -# undef memcmp -# undef realloc -#endif -%} - -%{ -static int yylex (int *); - -%} -%skeleton "lalr1.cc" -%token ARROW INVALID NUMBER STRING DATA -%defines -%verbose -%error-verbose -/* Grammar follows */ -%% -line: header body - ; - -header: '<' from ARROW to '>' type ':' - | '<' ARROW to '>' type ':' - | ARROW to type ':' - | type ':' - | '<' '>' - ; - -from: DATA - | STRING - | INVALID - ; - -to: DATA - | STRING - | INVALID - ; - -type: DATA - | STRING - | INVALID - ; - -body: /* empty */ - | body member - ; - -member: STRING - | DATA - | '+' NUMBER - | '-' NUMBER - | NUMBER - | INVALID - ; -%% -/* Currently, print_ is required in C++. */ -void -yy::Parser::print_ () -{ -} - -/* A C++ error reporting function. */ -void -yy::Parser::error_ () -{ - std::cerr << message << std::endl; -} - -int -yyparse (void) -{ - yy::Parser parser (!!YYDEBUG); - return parser.parse (); -} - - -static int -yylex (int *lval) -{ - static int toknum = 0; - int tokens[] = - { - ':', -1 - }; - *lval = 0; /* Pacify GCC. */ - return tokens[toknum++]; -} - -int -main (void) -{ - return yyparse (); -} -_ATEOF - - - -$at_traceoff -echo "regression.at:794: bison -o dancer.c dancer.y" -echo regression.at:794 >$at_check_line_file -( $at_traceon; bison -o dancer.c dancer.y ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "regression.at:794: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - -$at_traceoff -echo "regression.at:794: \$CXX --version || exit 77" -echo regression.at:794 >$at_check_line_file -( $at_traceon; $CXX --version || exit 77 ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo stderr:; cat $at_stderr -echo stdout:; cat $at_stdout -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "regression.at:794: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - -$at_traceoff -echo "regression.at:794: \$CXX \$CXXFLAGS \$CPPFLAGS dancer.c -o dancer" -echo regression.at:794 >$at_check_line_file -( $at_traceon; $CXX $CXXFLAGS $CPPFLAGS dancer.c -o dancer ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo stderr:; cat $at_stderr -echo stdout:; cat $at_stdout -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "regression.at:794: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - -$at_traceoff -echo "regression.at:794: \$PREPARSER ./dancer" -echo regression.at:794 >$at_check_line_file -( $at_traceon; $PREPARSER ./dancer ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo >>$at_stderr; echo "syntax error, unexpected ':' -" | $at_diff - $at_stderr || at_failed=: -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 1) ;; - *) echo "regression.at:794: exit code was $at_status, expected 1" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - - - - - - - - - - - - - - - - - - - $at_traceoff - $at_times_p && times >$at_times_file - ) 5>&1 2>&1 | eval $at_tee_pipe - at_status=`cat $at_status_file` - ;; - - - banner-15 ) # Banner 15. cxx-type.at:19 - cat <<\_ATEOF - -C++ Type Syntax (GLR). - -_ATEOF - ;; - - 111 ) # 111. cxx-type.at:317: GLR: Resolve ambiguity, impure, no locations - at_setup_line='cxx-type.at:317' - at_desc='GLR: Resolve ambiguity, impure, no locations' - $at_quiet $ECHO_N "111: GLR: Resolve ambiguity, impure, no locations $ECHO_C" - at_xfail=no - ( - echo "111. cxx-type.at:317: testing ..." - $at_traceon - - - - -# Using yacc.c? - - - - - - - -# yyerror receives the location if %location & %pure & (%glr or %parse-param). - -# yyerror always sees the locations (when activated), except if -# yacc & pure & !param. - - -# The interface is pure: either because %pure-parser, or because we -# are using the C++ parsers. - - - - - - - - - - - - -cat >types.y <<'_ATEOF' -%{ -#if HAVE_CONFIG_H -# include - /* We don't need perfect functions for these tests. */ -# undef malloc -# undef memcmp -# undef realloc -#endif -%} - -/* Simplified C++ Type and Expression Grammar. */ - - - -%{ - #include - #define YYSTYPE char const * - - #define YYINITDEPTH 10 - static char *format (char const *, ...); - struct YYLTYPE; -#if YYPURE -# if YYLSP_NEEDED -# define LEX_PARAMETERS YYSTYPE *lvalp, struct YYLTYPE *llocp -# define ERROR_PARAMETERS struct YYLTYPE *llocp, char const *s -# else -# define LEX_PARAMETERS YYSTYPE *lvalp -# endif -#endif -#ifndef LEX_PARAMETERS -# define LEX_PARAMETERS void -#endif -#ifndef ERROR_PARAMETERS -# define ERROR_PARAMETERS char const *s -#endif - int yylex (LEX_PARAMETERS); - int yyerror (ERROR_PARAMETERS); -%} - -%token TYPENAME ID - -%right '=' -%left '+' - -%glr-parser - -%% - -prog : - | prog stmt { - - printf ("%s\n", $2); - } - ; - -stmt : expr ';' %dprec 1 { $$ = $1; } - | decl %dprec 2 - | error ';' { $$ = ""; } - | '@' { YYACCEPT; } - ; - -expr : ID - | TYPENAME '(' expr ')' { $$ = format ("(%s,%s)", $3, $1); } - | expr '+' expr { $$ = format ("+(%s,%s)", $1, $3); } - | expr '=' expr { $$ = format ("=(%s,%s)", $1, $3); } - ; - -decl : TYPENAME declarator ';' - { $$ = format ("(%s,%s)", $1, $2); } - | TYPENAME declarator '=' expr ';' - { $$ = format ("(%s,%s,%s)", $1, $2, $4); } - ; - -declarator : ID - | '(' declarator ')' { $$ = $2; } - ; - -%% - -#include -#include -#include -#include - -int -main (int argc, char **argv) -{ - if (argc != 2) - abort (); - if (!freopen (argv[1], "r", stdin)) - abort (); - exit (yyparse ()); -} - -int -yylex (LEX_PARAMETERS) -{ - char buffer[256]; - int c; - unsigned int i; - static int lineNum = 1; - static int colNum = 1; - - -#if YYPURE -# define yylloc (*llocp) -# define yylval (*lvalp) -#endif - - while (1) - { - c = getchar (); - switch (c) - { - case EOF: - return 0; - case '\t': - colNum = 1 + ((colNum + 7) & ~7); - break; - case ' ': case '\f': - colNum += 1; - break; - case '\n': - lineNum += 1; - colNum = 1; - break; - default: - { - int tok; -#if YYLSP_NEEDED - yylloc.first_line = yylloc.last_line = lineNum; - yylloc.first_column = colNum; -#endif - if (isalpha (c)) - { - i = 0; - - do - { - buffer[i++] = c; - colNum += 1; - if (i == sizeof buffer - 1) - abort (); - c = getchar (); - } - while (isalnum (c) || c == '_'); - - ungetc (c, stdin); - buffer[i++] = 0; - tok = isupper ((unsigned char) buffer[0]) ? TYPENAME : ID; - yylval = strcpy (malloc (i), buffer); - } - else - { - colNum += 1; - tok = c; - yylval = ""; - } -#if YYLSP_NEEDED - yylloc.last_column = colNum-1; -#endif - return tok; - } - } - } -} - -int -yyerror (ERROR_PARAMETERS) -{ -#if YYPURE && YYLSP_NEEDED - /* Pacify GCC by using llocp. */ - if (! llocp) - abort (); -#endif - fprintf (stderr, "%s\n", s); - return 0; -} - - -static char * -format (char const *form, ...) -{ - char buffer[1024]; - va_list args; - va_start (args, form); - vsprintf (buffer, form, args); - va_end (args); - return strcpy (malloc (strlen (buffer) + 1), buffer); -} - - - -_ATEOF - - - -cat >test-input <<'_ATEOF' - - -z + q; - -T x; - -T x = y; - -x = y; - -T (x) + y; - -T (x); - -T (y) = z + q; - -T (y y) = z + q; - -z + q; - -@ - -This is total garbage, but it should be ignored. -_ATEOF - - -$at_traceoff -echo "cxx-type.at:319: bison -o types.c types.y" -echo cxx-type.at:319 >$at_check_line_file -( $at_traceon; bison -o types.c types.y ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo stderr:; cat $at_stderr -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "cxx-type.at:319: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - -$at_traceoff -echo "cxx-type.at:319: \$CC \$CFLAGS \$CPPFLAGS \$LDFLAGS types.c \$LIBS -o types" -echo cxx-type.at:319 >$at_check_line_file -( $at_traceon; $CC $CFLAGS $CPPFLAGS $LDFLAGS types.c $LIBS -o types ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo stderr:; cat $at_stderr -echo stdout:; cat $at_stdout -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "cxx-type.at:319: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - - - - - - - - - - - - - - - - - - - -$at_traceoff -echo "cxx-type.at:321: \$PREPARSER ./types test-input | sed 's/ *\$//'" -echo cxx-type.at:321 >$at_check_line_file -( $at_traceon; $PREPARSER ./types test-input | sed 's/ *$//' ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo >>$at_stderr; echo "syntax error -" | $at_diff - $at_stderr || at_failed=: -echo >>$at_stdout; echo "+(z,q) -(T,x) -(T,x,y) -=(x,y) -+((x,T),y) -(T,x) -(T,y,+(z,q)) - -+(z,q) -" | $at_diff - $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "cxx-type.at:321: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - $at_traceoff - $at_times_p && times >$at_times_file - ) 5>&1 2>&1 | eval $at_tee_pipe - at_status=`cat $at_status_file` - ;; - - 112 ) # 112. cxx-type.at:324: GLR: Resolve ambiguity, impure, locations - at_setup_line='cxx-type.at:324' - at_desc='GLR: Resolve ambiguity, impure, locations' - $at_quiet $ECHO_N "112: GLR: Resolve ambiguity, impure, locations $ECHO_C" - at_xfail=no - ( - echo "112. cxx-type.at:324: testing ..." - $at_traceon - - - - -# Using yacc.c? - - - - - - - -# yyerror receives the location if %location & %pure & (%glr or %parse-param). - -# yyerror always sees the locations (when activated), except if -# yacc & pure & !param. - - -# The interface is pure: either because %pure-parser, or because we -# are using the C++ parsers. - - - - - - - - - - - - -cat >types.y <<'_ATEOF' -%{ -#if HAVE_CONFIG_H -# include - /* We don't need perfect functions for these tests. */ -# undef malloc -# undef memcmp -# undef realloc -#endif -%} - -/* Simplified C++ Type and Expression Grammar. */ - -%locations - -%{ - #include - #define YYSTYPE char const * - - #define YYINITDEPTH 10 - static char *format (char const *, ...); - struct YYLTYPE; -#if YYPURE -# if YYLSP_NEEDED -# define LEX_PARAMETERS YYSTYPE *lvalp, struct YYLTYPE *llocp -# define ERROR_PARAMETERS struct YYLTYPE *llocp, char const *s -# else -# define LEX_PARAMETERS YYSTYPE *lvalp -# endif -#endif -#ifndef LEX_PARAMETERS -# define LEX_PARAMETERS void -#endif -#ifndef ERROR_PARAMETERS -# define ERROR_PARAMETERS char const *s -#endif - int yylex (LEX_PARAMETERS); - int yyerror (ERROR_PARAMETERS); -%} - -%token TYPENAME ID - -%right '=' -%left '+' - -%glr-parser - -%% - -prog : - | prog stmt { - - printf ("%d.%d-%d.%d: ", - @2.first_line, @2.first_column, - @2.last_line, @2.last_column); - printf ("%s\n", $2); - } - ; - -stmt : expr ';' %dprec 1 { $$ = $1; } - | decl %dprec 2 - | error ';' { $$ = ""; } - | '@' { YYACCEPT; } - ; - -expr : ID - | TYPENAME '(' expr ')' { $$ = format ("(%s,%s)", $3, $1); } - | expr '+' expr { $$ = format ("+(%s,%s)", $1, $3); } - | expr '=' expr { $$ = format ("=(%s,%s)", $1, $3); } - ; - -decl : TYPENAME declarator ';' - { $$ = format ("(%s,%s)", $1, $2); } - | TYPENAME declarator '=' expr ';' - { $$ = format ("(%s,%s,%s)", $1, $2, $4); } - ; - -declarator : ID - | '(' declarator ')' { $$ = $2; } - ; - -%% - -#include -#include -#include -#include - -int -main (int argc, char **argv) -{ - if (argc != 2) - abort (); - if (!freopen (argv[1], "r", stdin)) - abort (); - exit (yyparse ()); -} - -int -yylex (LEX_PARAMETERS) -{ - char buffer[256]; - int c; - unsigned int i; - static int lineNum = 1; - static int colNum = 1; - - -#if YYPURE -# define yylloc (*llocp) -# define yylval (*lvalp) -#endif - - while (1) - { - c = getchar (); - switch (c) - { - case EOF: - return 0; - case '\t': - colNum = 1 + ((colNum + 7) & ~7); - break; - case ' ': case '\f': - colNum += 1; - break; - case '\n': - lineNum += 1; - colNum = 1; - break; - default: - { - int tok; -#if YYLSP_NEEDED - yylloc.first_line = yylloc.last_line = lineNum; - yylloc.first_column = colNum; -#endif - if (isalpha (c)) - { - i = 0; - - do - { - buffer[i++] = c; - colNum += 1; - if (i == sizeof buffer - 1) - abort (); - c = getchar (); - } - while (isalnum (c) || c == '_'); - - ungetc (c, stdin); - buffer[i++] = 0; - tok = isupper ((unsigned char) buffer[0]) ? TYPENAME : ID; - yylval = strcpy (malloc (i), buffer); - } - else - { - colNum += 1; - tok = c; - yylval = ""; - } -#if YYLSP_NEEDED - yylloc.last_column = colNum-1; -#endif - return tok; - } - } - } -} - -int -yyerror (ERROR_PARAMETERS) -{ -#if YYPURE && YYLSP_NEEDED - /* Pacify GCC by using llocp. */ - if (! llocp) - abort (); -#endif - fprintf (stderr, "%s\n", s); - return 0; -} - - -static char * -format (char const *form, ...) -{ - char buffer[1024]; - va_list args; - va_start (args, form); - vsprintf (buffer, form, args); - va_end (args); - return strcpy (malloc (strlen (buffer) + 1), buffer); -} - - - -_ATEOF - - - -cat >test-input <<'_ATEOF' - - -z + q; - -T x; - -T x = y; - -x = y; - -T (x) + y; - -T (x); - -T (y) = z + q; - -T (y y) = z + q; - -z + q; - -@ - -This is total garbage, but it should be ignored. -_ATEOF - - -$at_traceoff -echo "cxx-type.at:325: bison -o types.c types.y" -echo cxx-type.at:325 >$at_check_line_file -( $at_traceon; bison -o types.c types.y ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo stderr:; cat $at_stderr -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "cxx-type.at:325: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - -$at_traceoff -echo "cxx-type.at:325: \$CC \$CFLAGS \$CPPFLAGS \$LDFLAGS types.c \$LIBS -o types" -echo cxx-type.at:325 >$at_check_line_file -( $at_traceon; $CC $CFLAGS $CPPFLAGS $LDFLAGS types.c $LIBS -o types ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo stderr:; cat $at_stderr -echo stdout:; cat $at_stdout -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "cxx-type.at:325: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - - - - - - - - - - - - - - - - - - - -$at_traceoff -echo "cxx-type.at:327: \$PREPARSER ./types test-input | sed 's/ *\$//'" -echo cxx-type.at:327 >$at_check_line_file -( $at_traceon; $PREPARSER ./types test-input | sed 's/ *$//' ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo >>$at_stderr; echo "syntax error -" | $at_diff - $at_stderr || at_failed=: -echo >>$at_stdout; echo "3.1-3.6: +(z,q) -5.1-5.4: (T,x) -7.1-7.8: (T,x,y) -9.1-9.6: =(x,y) -11.1-11.10: +((x,T),y) -13.1-13.6: (T,x) -15.1-15.14: (T,y,+(z,q)) -17.6-17.16: -19.1-19.6: +(z,q) -" | $at_diff - $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "cxx-type.at:327: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - $at_traceoff - $at_times_p && times >$at_times_file - ) 5>&1 2>&1 | eval $at_tee_pipe - at_status=`cat $at_status_file` - ;; - - 113 ) # 113. cxx-type.at:330: GLR: Resolve ambiguity, pure, no locations - at_setup_line='cxx-type.at:330' - at_desc='GLR: Resolve ambiguity, pure, no locations' - $at_quiet $ECHO_N "113: GLR: Resolve ambiguity, pure, no locations $ECHO_C" - at_xfail=no - ( - echo "113. cxx-type.at:330: testing ..." - $at_traceon - - - - -# Using yacc.c? - - - - - - - -# yyerror receives the location if %location & %pure & (%glr or %parse-param). - -# yyerror always sees the locations (when activated), except if -# yacc & pure & !param. - - -# The interface is pure: either because %pure-parser, or because we -# are using the C++ parsers. - - - - - - - - - - - - -cat >types.y <<'_ATEOF' -%{ -#if HAVE_CONFIG_H -# include - /* We don't need perfect functions for these tests. */ -# undef malloc -# undef memcmp -# undef realloc -#endif -%} - -/* Simplified C++ Type and Expression Grammar. */ - -%pure-parser - -%{ - #include - #define YYSTYPE char const * - - #define YYINITDEPTH 10 - static char *format (char const *, ...); - struct YYLTYPE; -#if YYPURE -# if YYLSP_NEEDED -# define LEX_PARAMETERS YYSTYPE *lvalp, struct YYLTYPE *llocp -# define ERROR_PARAMETERS struct YYLTYPE *llocp, char const *s -# else -# define LEX_PARAMETERS YYSTYPE *lvalp -# endif -#endif -#ifndef LEX_PARAMETERS -# define LEX_PARAMETERS void -#endif -#ifndef ERROR_PARAMETERS -# define ERROR_PARAMETERS char const *s -#endif - int yylex (LEX_PARAMETERS); - int yyerror (ERROR_PARAMETERS); -%} - -%token TYPENAME ID - -%right '=' -%left '+' - -%glr-parser - -%% - -prog : - | prog stmt { - - printf ("%s\n", $2); - } - ; - -stmt : expr ';' %dprec 1 { $$ = $1; } - | decl %dprec 2 - | error ';' { $$ = ""; } - | '@' { YYACCEPT; } - ; - -expr : ID - | TYPENAME '(' expr ')' { $$ = format ("(%s,%s)", $3, $1); } - | expr '+' expr { $$ = format ("+(%s,%s)", $1, $3); } - | expr '=' expr { $$ = format ("=(%s,%s)", $1, $3); } - ; - -decl : TYPENAME declarator ';' - { $$ = format ("(%s,%s)", $1, $2); } - | TYPENAME declarator '=' expr ';' - { $$ = format ("(%s,%s,%s)", $1, $2, $4); } - ; - -declarator : ID - | '(' declarator ')' { $$ = $2; } - ; - -%% - -#include -#include -#include -#include - -int -main (int argc, char **argv) -{ - if (argc != 2) - abort (); - if (!freopen (argv[1], "r", stdin)) - abort (); - exit (yyparse ()); -} - -int -yylex (LEX_PARAMETERS) -{ - char buffer[256]; - int c; - unsigned int i; - static int lineNum = 1; - static int colNum = 1; - - -#if YYPURE -# define yylloc (*llocp) -# define yylval (*lvalp) -#endif - - while (1) - { - c = getchar (); - switch (c) - { - case EOF: - return 0; - case '\t': - colNum = 1 + ((colNum + 7) & ~7); - break; - case ' ': case '\f': - colNum += 1; - break; - case '\n': - lineNum += 1; - colNum = 1; - break; - default: - { - int tok; -#if YYLSP_NEEDED - yylloc.first_line = yylloc.last_line = lineNum; - yylloc.first_column = colNum; -#endif - if (isalpha (c)) - { - i = 0; - - do - { - buffer[i++] = c; - colNum += 1; - if (i == sizeof buffer - 1) - abort (); - c = getchar (); - } - while (isalnum (c) || c == '_'); - - ungetc (c, stdin); - buffer[i++] = 0; - tok = isupper ((unsigned char) buffer[0]) ? TYPENAME : ID; - yylval = strcpy (malloc (i), buffer); - } - else - { - colNum += 1; - tok = c; - yylval = ""; - } -#if YYLSP_NEEDED - yylloc.last_column = colNum-1; -#endif - return tok; - } - } - } -} - -int -yyerror (ERROR_PARAMETERS) -{ -#if YYPURE && YYLSP_NEEDED - /* Pacify GCC by using llocp. */ - if (! llocp) - abort (); -#endif - fprintf (stderr, "%s\n", s); - return 0; -} - - -static char * -format (char const *form, ...) -{ - char buffer[1024]; - va_list args; - va_start (args, form); - vsprintf (buffer, form, args); - va_end (args); - return strcpy (malloc (strlen (buffer) + 1), buffer); -} - - - -_ATEOF - - - -cat >test-input <<'_ATEOF' - - -z + q; - -T x; - -T x = y; - -x = y; - -T (x) + y; - -T (x); - -T (y) = z + q; - -T (y y) = z + q; - -z + q; - -@ - -This is total garbage, but it should be ignored. -_ATEOF - - -$at_traceoff -echo "cxx-type.at:332: bison -o types.c types.y" -echo cxx-type.at:332 >$at_check_line_file -( $at_traceon; bison -o types.c types.y ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo stderr:; cat $at_stderr -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "cxx-type.at:332: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - -$at_traceoff -echo "cxx-type.at:332: \$CC \$CFLAGS \$CPPFLAGS \$LDFLAGS types.c \$LIBS -o types" -echo cxx-type.at:332 >$at_check_line_file -( $at_traceon; $CC $CFLAGS $CPPFLAGS $LDFLAGS types.c $LIBS -o types ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo stderr:; cat $at_stderr -echo stdout:; cat $at_stdout -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "cxx-type.at:332: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - - - - - - - - - - - - - - - - - - - -$at_traceoff -echo "cxx-type.at:334: \$PREPARSER ./types test-input | sed 's/ *\$//'" -echo cxx-type.at:334 >$at_check_line_file -( $at_traceon; $PREPARSER ./types test-input | sed 's/ *$//' ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo >>$at_stderr; echo "syntax error -" | $at_diff - $at_stderr || at_failed=: -echo >>$at_stdout; echo "+(z,q) -(T,x) -(T,x,y) -=(x,y) -+((x,T),y) -(T,x) -(T,y,+(z,q)) - -+(z,q) -" | $at_diff - $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "cxx-type.at:334: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - $at_traceoff - $at_times_p && times >$at_times_file - ) 5>&1 2>&1 | eval $at_tee_pipe - at_status=`cat $at_status_file` - ;; - - 114 ) # 114. cxx-type.at:337: GLR: Resolve ambiguity, pure, locations - at_setup_line='cxx-type.at:337' - at_desc='GLR: Resolve ambiguity, pure, locations' - $at_quiet $ECHO_N "114: GLR: Resolve ambiguity, pure, locations $ECHO_C" - at_xfail=no - ( - echo "114. cxx-type.at:337: testing ..." - $at_traceon - - - - -# Using yacc.c? - - - - - - - -# yyerror receives the location if %location & %pure & (%glr or %parse-param). - -# yyerror always sees the locations (when activated), except if -# yacc & pure & !param. - - -# The interface is pure: either because %pure-parser, or because we -# are using the C++ parsers. - - - - - - - - - - - - -cat >types.y <<'_ATEOF' -%{ -#if HAVE_CONFIG_H -# include - /* We don't need perfect functions for these tests. */ -# undef malloc -# undef memcmp -# undef realloc -#endif -%} - -/* Simplified C++ Type and Expression Grammar. */ - -%pure-parser %locations - -%{ - #include - #define YYSTYPE char const * - - #define YYINITDEPTH 10 - static char *format (char const *, ...); - struct YYLTYPE; -#if YYPURE -# if YYLSP_NEEDED -# define LEX_PARAMETERS YYSTYPE *lvalp, struct YYLTYPE *llocp -# define ERROR_PARAMETERS struct YYLTYPE *llocp, char const *s -# else -# define LEX_PARAMETERS YYSTYPE *lvalp -# endif -#endif -#ifndef LEX_PARAMETERS -# define LEX_PARAMETERS void -#endif -#ifndef ERROR_PARAMETERS -# define ERROR_PARAMETERS char const *s -#endif - int yylex (LEX_PARAMETERS); - int yyerror (ERROR_PARAMETERS); -%} - -%token TYPENAME ID - -%right '=' -%left '+' - -%glr-parser - -%% - -prog : - | prog stmt { - - printf ("%d.%d-%d.%d: ", - @2.first_line, @2.first_column, - @2.last_line, @2.last_column); - printf ("%s\n", $2); - } - ; - -stmt : expr ';' %dprec 1 { $$ = $1; } - | decl %dprec 2 - | error ';' { $$ = ""; } - | '@' { YYACCEPT; } - ; - -expr : ID - | TYPENAME '(' expr ')' { $$ = format ("(%s,%s)", $3, $1); } - | expr '+' expr { $$ = format ("+(%s,%s)", $1, $3); } - | expr '=' expr { $$ = format ("=(%s,%s)", $1, $3); } - ; - -decl : TYPENAME declarator ';' - { $$ = format ("(%s,%s)", $1, $2); } - | TYPENAME declarator '=' expr ';' - { $$ = format ("(%s,%s,%s)", $1, $2, $4); } - ; - -declarator : ID - | '(' declarator ')' { $$ = $2; } - ; - -%% - -#include -#include -#include -#include - -int -main (int argc, char **argv) -{ - if (argc != 2) - abort (); - if (!freopen (argv[1], "r", stdin)) - abort (); - exit (yyparse ()); -} - -int -yylex (LEX_PARAMETERS) -{ - char buffer[256]; - int c; - unsigned int i; - static int lineNum = 1; - static int colNum = 1; - - -#if YYPURE -# define yylloc (*llocp) -# define yylval (*lvalp) -#endif - - while (1) - { - c = getchar (); - switch (c) - { - case EOF: - return 0; - case '\t': - colNum = 1 + ((colNum + 7) & ~7); - break; - case ' ': case '\f': - colNum += 1; - break; - case '\n': - lineNum += 1; - colNum = 1; - break; - default: - { - int tok; -#if YYLSP_NEEDED - yylloc.first_line = yylloc.last_line = lineNum; - yylloc.first_column = colNum; -#endif - if (isalpha (c)) - { - i = 0; - - do - { - buffer[i++] = c; - colNum += 1; - if (i == sizeof buffer - 1) - abort (); - c = getchar (); - } - while (isalnum (c) || c == '_'); - - ungetc (c, stdin); - buffer[i++] = 0; - tok = isupper ((unsigned char) buffer[0]) ? TYPENAME : ID; - yylval = strcpy (malloc (i), buffer); - } - else - { - colNum += 1; - tok = c; - yylval = ""; - } -#if YYLSP_NEEDED - yylloc.last_column = colNum-1; -#endif - return tok; - } - } - } -} - -int -yyerror (ERROR_PARAMETERS) -{ -#if YYPURE && YYLSP_NEEDED - /* Pacify GCC by using llocp. */ - if (! llocp) - abort (); -#endif - fprintf (stderr, "%s\n", s); - return 0; -} - - -static char * -format (char const *form, ...) -{ - char buffer[1024]; - va_list args; - va_start (args, form); - vsprintf (buffer, form, args); - va_end (args); - return strcpy (malloc (strlen (buffer) + 1), buffer); -} - - - -_ATEOF - - - -cat >test-input <<'_ATEOF' - - -z + q; - -T x; - -T x = y; - -x = y; - -T (x) + y; - -T (x); - -T (y) = z + q; - -T (y y) = z + q; - -z + q; - -@ - -This is total garbage, but it should be ignored. -_ATEOF - - -$at_traceoff -echo "cxx-type.at:339: bison -o types.c types.y" -echo cxx-type.at:339 >$at_check_line_file -( $at_traceon; bison -o types.c types.y ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo stderr:; cat $at_stderr -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "cxx-type.at:339: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - -$at_traceoff -echo "cxx-type.at:339: \$CC \$CFLAGS \$CPPFLAGS \$LDFLAGS types.c \$LIBS -o types" -echo cxx-type.at:339 >$at_check_line_file -( $at_traceon; $CC $CFLAGS $CPPFLAGS $LDFLAGS types.c $LIBS -o types ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo stderr:; cat $at_stderr -echo stdout:; cat $at_stdout -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "cxx-type.at:339: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - - - - - - - - - - - - - - - - - - - -$at_traceoff -echo "cxx-type.at:341: \$PREPARSER ./types test-input | sed 's/ *\$//'" -echo cxx-type.at:341 >$at_check_line_file -( $at_traceon; $PREPARSER ./types test-input | sed 's/ *$//' ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo >>$at_stderr; echo "syntax error -" | $at_diff - $at_stderr || at_failed=: -echo >>$at_stdout; echo "3.1-3.6: +(z,q) -5.1-5.4: (T,x) -7.1-7.8: (T,x,y) -9.1-9.6: =(x,y) -11.1-11.10: +((x,T),y) -13.1-13.6: (T,x) -15.1-15.14: (T,y,+(z,q)) -17.6-17.16: -19.1-19.6: +(z,q) -" | $at_diff - $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "cxx-type.at:341: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - $at_traceoff - $at_times_p && times >$at_times_file - ) 5>&1 2>&1 | eval $at_tee_pipe - at_status=`cat $at_status_file` - ;; - - 115 ) # 115. cxx-type.at:344: GLR: Merge conflicting parses, impure, no locations - at_setup_line='cxx-type.at:344' - at_desc='GLR: Merge conflicting parses, impure, no locations' - $at_quiet $ECHO_N "115: GLR: Merge conflicting parses, impure, no locations$ECHO_C" - at_xfail=no - ( - echo "115. cxx-type.at:344: testing ..." - $at_traceon - - - - -# Using yacc.c? - - - - - - - -# yyerror receives the location if %location & %pure & (%glr or %parse-param). - -# yyerror always sees the locations (when activated), except if -# yacc & pure & !param. - - -# The interface is pure: either because %pure-parser, or because we -# are using the C++ parsers. - - - - - - - - - - - - -cat >types.y <<'_ATEOF' -%{ -#if HAVE_CONFIG_H -# include - /* We don't need perfect functions for these tests. */ -# undef malloc -# undef memcmp -# undef realloc -#endif -%} - -/* Simplified C++ Type and Expression Grammar. */ - - - -%{ - #include - #define YYSTYPE char const * - static YYSTYPE stmtMerge (YYSTYPE x0, YYSTYPE x1); - #define YYINITDEPTH 10 - static char *format (char const *, ...); - struct YYLTYPE; -#if YYPURE -# if YYLSP_NEEDED -# define LEX_PARAMETERS YYSTYPE *lvalp, struct YYLTYPE *llocp -# define ERROR_PARAMETERS struct YYLTYPE *llocp, char const *s -# else -# define LEX_PARAMETERS YYSTYPE *lvalp -# endif -#endif -#ifndef LEX_PARAMETERS -# define LEX_PARAMETERS void -#endif -#ifndef ERROR_PARAMETERS -# define ERROR_PARAMETERS char const *s -#endif - int yylex (LEX_PARAMETERS); - int yyerror (ERROR_PARAMETERS); -%} - -%token TYPENAME ID - -%right '=' -%left '+' - -%glr-parser - -%% - -prog : - | prog stmt { - - printf ("%s\n", $2); - } - ; - -stmt : expr ';' %merge { $$ = $1; } - | decl %merge - | error ';' { $$ = ""; } - | '@' { YYACCEPT; } - ; - -expr : ID - | TYPENAME '(' expr ')' { $$ = format ("(%s,%s)", $3, $1); } - | expr '+' expr { $$ = format ("+(%s,%s)", $1, $3); } - | expr '=' expr { $$ = format ("=(%s,%s)", $1, $3); } - ; - -decl : TYPENAME declarator ';' - { $$ = format ("(%s,%s)", $1, $2); } - | TYPENAME declarator '=' expr ';' - { $$ = format ("(%s,%s,%s)", $1, $2, $4); } - ; - -declarator : ID - | '(' declarator ')' { $$ = $2; } - ; - -%% - -#include -#include -#include -#include - -int -main (int argc, char **argv) -{ - if (argc != 2) - abort (); - if (!freopen (argv[1], "r", stdin)) - abort (); - exit (yyparse ()); -} - -int -yylex (LEX_PARAMETERS) -{ - char buffer[256]; - int c; - unsigned int i; - static int lineNum = 1; - static int colNum = 1; - - -#if YYPURE -# define yylloc (*llocp) -# define yylval (*lvalp) -#endif - - while (1) - { - c = getchar (); - switch (c) - { - case EOF: - return 0; - case '\t': - colNum = 1 + ((colNum + 7) & ~7); - break; - case ' ': case '\f': - colNum += 1; - break; - case '\n': - lineNum += 1; - colNum = 1; - break; - default: - { - int tok; -#if YYLSP_NEEDED - yylloc.first_line = yylloc.last_line = lineNum; - yylloc.first_column = colNum; -#endif - if (isalpha (c)) - { - i = 0; - - do - { - buffer[i++] = c; - colNum += 1; - if (i == sizeof buffer - 1) - abort (); - c = getchar (); - } - while (isalnum (c) || c == '_'); - - ungetc (c, stdin); - buffer[i++] = 0; - tok = isupper ((unsigned char) buffer[0]) ? TYPENAME : ID; - yylval = strcpy (malloc (i), buffer); - } - else - { - colNum += 1; - tok = c; - yylval = ""; - } -#if YYLSP_NEEDED - yylloc.last_column = colNum-1; -#endif - return tok; - } - } - } -} - -int -yyerror (ERROR_PARAMETERS) -{ -#if YYPURE && YYLSP_NEEDED - /* Pacify GCC by using llocp. */ - if (! llocp) - abort (); -#endif - fprintf (stderr, "%s\n", s); - return 0; -} - - -static char * -format (char const *form, ...) -{ - char buffer[1024]; - va_list args; - va_start (args, form); - vsprintf (buffer, form, args); - va_end (args); - return strcpy (malloc (strlen (buffer) + 1), buffer); -} - - -static YYSTYPE -stmtMerge (YYSTYPE x0, YYSTYPE x1) -{ - return format ("(%s,%s)", x0, x1); -} - -_ATEOF - - - -cat >test-input <<'_ATEOF' - - -z + q; - -T x; - -T x = y; - -x = y; - -T (x) + y; - -T (x); - -T (y) = z + q; - -T (y y) = z + q; - -z + q; - -@ - -This is total garbage, but it should be ignored. -_ATEOF - - -$at_traceoff -echo "cxx-type.at:346: bison -o types.c types.y" -echo cxx-type.at:346 >$at_check_line_file -( $at_traceon; bison -o types.c types.y ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo stderr:; cat $at_stderr -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "cxx-type.at:346: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - -$at_traceoff -echo "cxx-type.at:346: \$CC \$CFLAGS \$CPPFLAGS \$LDFLAGS types.c \$LIBS -o types" -echo cxx-type.at:346 >$at_check_line_file -( $at_traceon; $CC $CFLAGS $CPPFLAGS $LDFLAGS types.c $LIBS -o types ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo stderr:; cat $at_stderr -echo stdout:; cat $at_stdout -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "cxx-type.at:346: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - - - - - - - - - - - - - - - - - - - -$at_traceoff -echo "cxx-type.at:348: \$PREPARSER ./types test-input | sed 's/ *\$//'" -echo cxx-type.at:348 >$at_check_line_file -( $at_traceon; $PREPARSER ./types test-input | sed 's/ *$//' ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo >>$at_stderr; echo "syntax error -" | $at_diff - $at_stderr || at_failed=: -echo >>$at_stdout; echo "+(z,q) -(T,x) -(T,x,y) -=(x,y) -+((x,T),y) -((T,x),(x,T)) -((T,y,+(z,q)),=((y,T),+(z,q))) - -+(z,q) -" | $at_diff - $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "cxx-type.at:348: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - $at_traceoff - $at_times_p && times >$at_times_file - ) 5>&1 2>&1 | eval $at_tee_pipe - at_status=`cat $at_status_file` - ;; - - 116 ) # 116. cxx-type.at:351: GLR: Merge conflicting parses, impure, locations - at_setup_line='cxx-type.at:351' - at_desc='GLR: Merge conflicting parses, impure, locations' - $at_quiet $ECHO_N "116: GLR: Merge conflicting parses, impure, locations$ECHO_C" - at_xfail=no - ( - echo "116. cxx-type.at:351: testing ..." - $at_traceon - - - - -# Using yacc.c? - - - - - - - -# yyerror receives the location if %location & %pure & (%glr or %parse-param). - -# yyerror always sees the locations (when activated), except if -# yacc & pure & !param. - - -# The interface is pure: either because %pure-parser, or because we -# are using the C++ parsers. - - - - - - - - - - - - -cat >types.y <<'_ATEOF' -%{ -#if HAVE_CONFIG_H -# include - /* We don't need perfect functions for these tests. */ -# undef malloc -# undef memcmp -# undef realloc -#endif -%} - -/* Simplified C++ Type and Expression Grammar. */ - -%locations - -%{ - #include - #define YYSTYPE char const * - static YYSTYPE stmtMerge (YYSTYPE x0, YYSTYPE x1); - #define YYINITDEPTH 10 - static char *format (char const *, ...); - struct YYLTYPE; -#if YYPURE -# if YYLSP_NEEDED -# define LEX_PARAMETERS YYSTYPE *lvalp, struct YYLTYPE *llocp -# define ERROR_PARAMETERS struct YYLTYPE *llocp, char const *s -# else -# define LEX_PARAMETERS YYSTYPE *lvalp -# endif -#endif -#ifndef LEX_PARAMETERS -# define LEX_PARAMETERS void -#endif -#ifndef ERROR_PARAMETERS -# define ERROR_PARAMETERS char const *s -#endif - int yylex (LEX_PARAMETERS); - int yyerror (ERROR_PARAMETERS); -%} - -%token TYPENAME ID - -%right '=' -%left '+' - -%glr-parser - -%% - -prog : - | prog stmt { - - printf ("%d.%d-%d.%d: ", - @2.first_line, @2.first_column, - @2.last_line, @2.last_column); - printf ("%s\n", $2); - } - ; - -stmt : expr ';' %merge { $$ = $1; } - | decl %merge - | error ';' { $$ = ""; } - | '@' { YYACCEPT; } - ; - -expr : ID - | TYPENAME '(' expr ')' { $$ = format ("(%s,%s)", $3, $1); } - | expr '+' expr { $$ = format ("+(%s,%s)", $1, $3); } - | expr '=' expr { $$ = format ("=(%s,%s)", $1, $3); } - ; - -decl : TYPENAME declarator ';' - { $$ = format ("(%s,%s)", $1, $2); } - | TYPENAME declarator '=' expr ';' - { $$ = format ("(%s,%s,%s)", $1, $2, $4); } - ; - -declarator : ID - | '(' declarator ')' { $$ = $2; } - ; - -%% - -#include -#include -#include -#include - -int -main (int argc, char **argv) -{ - if (argc != 2) - abort (); - if (!freopen (argv[1], "r", stdin)) - abort (); - exit (yyparse ()); -} - -int -yylex (LEX_PARAMETERS) -{ - char buffer[256]; - int c; - unsigned int i; - static int lineNum = 1; - static int colNum = 1; - - -#if YYPURE -# define yylloc (*llocp) -# define yylval (*lvalp) -#endif - - while (1) - { - c = getchar (); - switch (c) - { - case EOF: - return 0; - case '\t': - colNum = 1 + ((colNum + 7) & ~7); - break; - case ' ': case '\f': - colNum += 1; - break; - case '\n': - lineNum += 1; - colNum = 1; - break; - default: - { - int tok; -#if YYLSP_NEEDED - yylloc.first_line = yylloc.last_line = lineNum; - yylloc.first_column = colNum; -#endif - if (isalpha (c)) - { - i = 0; - - do - { - buffer[i++] = c; - colNum += 1; - if (i == sizeof buffer - 1) - abort (); - c = getchar (); - } - while (isalnum (c) || c == '_'); - - ungetc (c, stdin); - buffer[i++] = 0; - tok = isupper ((unsigned char) buffer[0]) ? TYPENAME : ID; - yylval = strcpy (malloc (i), buffer); - } - else - { - colNum += 1; - tok = c; - yylval = ""; - } -#if YYLSP_NEEDED - yylloc.last_column = colNum-1; -#endif - return tok; - } - } - } -} - -int -yyerror (ERROR_PARAMETERS) -{ -#if YYPURE && YYLSP_NEEDED - /* Pacify GCC by using llocp. */ - if (! llocp) - abort (); -#endif - fprintf (stderr, "%s\n", s); - return 0; -} - - -static char * -format (char const *form, ...) -{ - char buffer[1024]; - va_list args; - va_start (args, form); - vsprintf (buffer, form, args); - va_end (args); - return strcpy (malloc (strlen (buffer) + 1), buffer); -} - - -static YYSTYPE -stmtMerge (YYSTYPE x0, YYSTYPE x1) -{ - return format ("(%s,%s)", x0, x1); -} - -_ATEOF - - - -cat >test-input <<'_ATEOF' - - -z + q; - -T x; - -T x = y; - -x = y; - -T (x) + y; - -T (x); - -T (y) = z + q; - -T (y y) = z + q; - -z + q; - -@ - -This is total garbage, but it should be ignored. -_ATEOF - - -$at_traceoff -echo "cxx-type.at:353: bison -o types.c types.y" -echo cxx-type.at:353 >$at_check_line_file -( $at_traceon; bison -o types.c types.y ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo stderr:; cat $at_stderr -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "cxx-type.at:353: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - -$at_traceoff -echo "cxx-type.at:353: \$CC \$CFLAGS \$CPPFLAGS \$LDFLAGS types.c \$LIBS -o types" -echo cxx-type.at:353 >$at_check_line_file -( $at_traceon; $CC $CFLAGS $CPPFLAGS $LDFLAGS types.c $LIBS -o types ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo stderr:; cat $at_stderr -echo stdout:; cat $at_stdout -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "cxx-type.at:353: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - - - - - - - - - - - - - - - - - - - -$at_traceoff -echo "cxx-type.at:355: \$PREPARSER ./types test-input | sed 's/ *\$//'" -echo cxx-type.at:355 >$at_check_line_file -( $at_traceon; $PREPARSER ./types test-input | sed 's/ *$//' ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo >>$at_stderr; echo "syntax error -" | $at_diff - $at_stderr || at_failed=: -echo >>$at_stdout; echo "3.1-3.6: +(z,q) -5.1-5.4: (T,x) -7.1-7.8: (T,x,y) -9.1-9.6: =(x,y) -11.1-11.10: +((x,T),y) -13.1-13.6: ((T,x),(x,T)) -15.1-15.14: ((T,y,+(z,q)),=((y,T),+(z,q))) -17.6-17.16: -19.1-19.6: +(z,q) -" | $at_diff - $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "cxx-type.at:355: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - $at_traceoff - $at_times_p && times >$at_times_file - ) 5>&1 2>&1 | eval $at_tee_pipe - at_status=`cat $at_status_file` - ;; - - 117 ) # 117. cxx-type.at:358: GLR: Merge conflicting parses, pure, no locations - at_setup_line='cxx-type.at:358' - at_desc='GLR: Merge conflicting parses, pure, no locations' - $at_quiet $ECHO_N "117: GLR: Merge conflicting parses, pure, no locations$ECHO_C" - at_xfail=no - ( - echo "117. cxx-type.at:358: testing ..." - $at_traceon - - - - -# Using yacc.c? - - - - - - - -# yyerror receives the location if %location & %pure & (%glr or %parse-param). - -# yyerror always sees the locations (when activated), except if -# yacc & pure & !param. - - -# The interface is pure: either because %pure-parser, or because we -# are using the C++ parsers. - - - - - - - - - - - - -cat >types.y <<'_ATEOF' -%{ -#if HAVE_CONFIG_H -# include - /* We don't need perfect functions for these tests. */ -# undef malloc -# undef memcmp -# undef realloc -#endif -%} - -/* Simplified C++ Type and Expression Grammar. */ - -%pure-parser - -%{ - #include - #define YYSTYPE char const * - static YYSTYPE stmtMerge (YYSTYPE x0, YYSTYPE x1); - #define YYINITDEPTH 10 - static char *format (char const *, ...); - struct YYLTYPE; -#if YYPURE -# if YYLSP_NEEDED -# define LEX_PARAMETERS YYSTYPE *lvalp, struct YYLTYPE *llocp -# define ERROR_PARAMETERS struct YYLTYPE *llocp, char const *s -# else -# define LEX_PARAMETERS YYSTYPE *lvalp -# endif -#endif -#ifndef LEX_PARAMETERS -# define LEX_PARAMETERS void -#endif -#ifndef ERROR_PARAMETERS -# define ERROR_PARAMETERS char const *s -#endif - int yylex (LEX_PARAMETERS); - int yyerror (ERROR_PARAMETERS); -%} - -%token TYPENAME ID - -%right '=' -%left '+' - -%glr-parser - -%% - -prog : - | prog stmt { - - printf ("%s\n", $2); - } - ; - -stmt : expr ';' %merge { $$ = $1; } - | decl %merge - | error ';' { $$ = ""; } - | '@' { YYACCEPT; } - ; - -expr : ID - | TYPENAME '(' expr ')' { $$ = format ("(%s,%s)", $3, $1); } - | expr '+' expr { $$ = format ("+(%s,%s)", $1, $3); } - | expr '=' expr { $$ = format ("=(%s,%s)", $1, $3); } - ; - -decl : TYPENAME declarator ';' - { $$ = format ("(%s,%s)", $1, $2); } - | TYPENAME declarator '=' expr ';' - { $$ = format ("(%s,%s,%s)", $1, $2, $4); } - ; - -declarator : ID - | '(' declarator ')' { $$ = $2; } - ; - -%% - -#include -#include -#include -#include - -int -main (int argc, char **argv) -{ - if (argc != 2) - abort (); - if (!freopen (argv[1], "r", stdin)) - abort (); - exit (yyparse ()); -} - -int -yylex (LEX_PARAMETERS) -{ - char buffer[256]; - int c; - unsigned int i; - static int lineNum = 1; - static int colNum = 1; - - -#if YYPURE -# define yylloc (*llocp) -# define yylval (*lvalp) -#endif - - while (1) - { - c = getchar (); - switch (c) - { - case EOF: - return 0; - case '\t': - colNum = 1 + ((colNum + 7) & ~7); - break; - case ' ': case '\f': - colNum += 1; - break; - case '\n': - lineNum += 1; - colNum = 1; - break; - default: - { - int tok; -#if YYLSP_NEEDED - yylloc.first_line = yylloc.last_line = lineNum; - yylloc.first_column = colNum; -#endif - if (isalpha (c)) - { - i = 0; - - do - { - buffer[i++] = c; - colNum += 1; - if (i == sizeof buffer - 1) - abort (); - c = getchar (); - } - while (isalnum (c) || c == '_'); - - ungetc (c, stdin); - buffer[i++] = 0; - tok = isupper ((unsigned char) buffer[0]) ? TYPENAME : ID; - yylval = strcpy (malloc (i), buffer); - } - else - { - colNum += 1; - tok = c; - yylval = ""; - } -#if YYLSP_NEEDED - yylloc.last_column = colNum-1; -#endif - return tok; - } - } - } -} - -int -yyerror (ERROR_PARAMETERS) -{ -#if YYPURE && YYLSP_NEEDED - /* Pacify GCC by using llocp. */ - if (! llocp) - abort (); -#endif - fprintf (stderr, "%s\n", s); - return 0; -} - - -static char * -format (char const *form, ...) -{ - char buffer[1024]; - va_list args; - va_start (args, form); - vsprintf (buffer, form, args); - va_end (args); - return strcpy (malloc (strlen (buffer) + 1), buffer); -} - - -static YYSTYPE -stmtMerge (YYSTYPE x0, YYSTYPE x1) -{ - return format ("(%s,%s)", x0, x1); -} - -_ATEOF - - - -cat >test-input <<'_ATEOF' - - -z + q; - -T x; - -T x = y; - -x = y; - -T (x) + y; - -T (x); - -T (y) = z + q; - -T (y y) = z + q; - -z + q; - -@ - -This is total garbage, but it should be ignored. -_ATEOF - - -$at_traceoff -echo "cxx-type.at:360: bison -o types.c types.y" -echo cxx-type.at:360 >$at_check_line_file -( $at_traceon; bison -o types.c types.y ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo stderr:; cat $at_stderr -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "cxx-type.at:360: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - -$at_traceoff -echo "cxx-type.at:360: \$CC \$CFLAGS \$CPPFLAGS \$LDFLAGS types.c \$LIBS -o types" -echo cxx-type.at:360 >$at_check_line_file -( $at_traceon; $CC $CFLAGS $CPPFLAGS $LDFLAGS types.c $LIBS -o types ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo stderr:; cat $at_stderr -echo stdout:; cat $at_stdout -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "cxx-type.at:360: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - - - - - - - - - - - - - - - - - - - -$at_traceoff -echo "cxx-type.at:362: \$PREPARSER ./types test-input | sed 's/ *\$//'" -echo cxx-type.at:362 >$at_check_line_file -( $at_traceon; $PREPARSER ./types test-input | sed 's/ *$//' ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo >>$at_stderr; echo "syntax error -" | $at_diff - $at_stderr || at_failed=: -echo >>$at_stdout; echo "+(z,q) -(T,x) -(T,x,y) -=(x,y) -+((x,T),y) -((T,x),(x,T)) -((T,y,+(z,q)),=((y,T),+(z,q))) - -+(z,q) -" | $at_diff - $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "cxx-type.at:362: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - $at_traceoff - $at_times_p && times >$at_times_file - ) 5>&1 2>&1 | eval $at_tee_pipe - at_status=`cat $at_status_file` - ;; - - 118 ) # 118. cxx-type.at:364: GLR: Merge conflicting parses, pure, locations - at_setup_line='cxx-type.at:364' - at_desc='GLR: Merge conflicting parses, pure, locations' - $at_quiet $ECHO_N "118: GLR: Merge conflicting parses, pure, locations$ECHO_C" - at_xfail=no - ( - echo "118. cxx-type.at:364: testing ..." - $at_traceon - - - - -# Using yacc.c? - - - - - - - -# yyerror receives the location if %location & %pure & (%glr or %parse-param). - -# yyerror always sees the locations (when activated), except if -# yacc & pure & !param. - - -# The interface is pure: either because %pure-parser, or because we -# are using the C++ parsers. - - - - - - - - - - - - -cat >types.y <<'_ATEOF' -%{ -#if HAVE_CONFIG_H -# include - /* We don't need perfect functions for these tests. */ -# undef malloc -# undef memcmp -# undef realloc -#endif -%} - -/* Simplified C++ Type and Expression Grammar. */ - -%pure-parser %locations - -%{ - #include - #define YYSTYPE char const * - static YYSTYPE stmtMerge (YYSTYPE x0, YYSTYPE x1); - #define YYINITDEPTH 10 - static char *format (char const *, ...); - struct YYLTYPE; -#if YYPURE -# if YYLSP_NEEDED -# define LEX_PARAMETERS YYSTYPE *lvalp, struct YYLTYPE *llocp -# define ERROR_PARAMETERS struct YYLTYPE *llocp, char const *s -# else -# define LEX_PARAMETERS YYSTYPE *lvalp -# endif -#endif -#ifndef LEX_PARAMETERS -# define LEX_PARAMETERS void -#endif -#ifndef ERROR_PARAMETERS -# define ERROR_PARAMETERS char const *s -#endif - int yylex (LEX_PARAMETERS); - int yyerror (ERROR_PARAMETERS); -%} - -%token TYPENAME ID - -%right '=' -%left '+' - -%glr-parser - -%% - -prog : - | prog stmt { - - printf ("%d.%d-%d.%d: ", - @2.first_line, @2.first_column, - @2.last_line, @2.last_column); - printf ("%s\n", $2); - } - ; - -stmt : expr ';' %merge { $$ = $1; } - | decl %merge - | error ';' { $$ = ""; } - | '@' { YYACCEPT; } - ; - -expr : ID - | TYPENAME '(' expr ')' { $$ = format ("(%s,%s)", $3, $1); } - | expr '+' expr { $$ = format ("+(%s,%s)", $1, $3); } - | expr '=' expr { $$ = format ("=(%s,%s)", $1, $3); } - ; - -decl : TYPENAME declarator ';' - { $$ = format ("(%s,%s)", $1, $2); } - | TYPENAME declarator '=' expr ';' - { $$ = format ("(%s,%s,%s)", $1, $2, $4); } - ; - -declarator : ID - | '(' declarator ')' { $$ = $2; } - ; - -%% - -#include -#include -#include -#include - -int -main (int argc, char **argv) -{ - if (argc != 2) - abort (); - if (!freopen (argv[1], "r", stdin)) - abort (); - exit (yyparse ()); -} - -int -yylex (LEX_PARAMETERS) -{ - char buffer[256]; - int c; - unsigned int i; - static int lineNum = 1; - static int colNum = 1; - - -#if YYPURE -# define yylloc (*llocp) -# define yylval (*lvalp) -#endif - - while (1) - { - c = getchar (); - switch (c) - { - case EOF: - return 0; - case '\t': - colNum = 1 + ((colNum + 7) & ~7); - break; - case ' ': case '\f': - colNum += 1; - break; - case '\n': - lineNum += 1; - colNum = 1; - break; - default: - { - int tok; -#if YYLSP_NEEDED - yylloc.first_line = yylloc.last_line = lineNum; - yylloc.first_column = colNum; -#endif - if (isalpha (c)) - { - i = 0; - - do - { - buffer[i++] = c; - colNum += 1; - if (i == sizeof buffer - 1) - abort (); - c = getchar (); - } - while (isalnum (c) || c == '_'); - - ungetc (c, stdin); - buffer[i++] = 0; - tok = isupper ((unsigned char) buffer[0]) ? TYPENAME : ID; - yylval = strcpy (malloc (i), buffer); - } - else - { - colNum += 1; - tok = c; - yylval = ""; - } -#if YYLSP_NEEDED - yylloc.last_column = colNum-1; -#endif - return tok; - } - } - } -} - -int -yyerror (ERROR_PARAMETERS) -{ -#if YYPURE && YYLSP_NEEDED - /* Pacify GCC by using llocp. */ - if (! llocp) - abort (); -#endif - fprintf (stderr, "%s\n", s); - return 0; -} - - -static char * -format (char const *form, ...) -{ - char buffer[1024]; - va_list args; - va_start (args, form); - vsprintf (buffer, form, args); - va_end (args); - return strcpy (malloc (strlen (buffer) + 1), buffer); -} - - -static YYSTYPE -stmtMerge (YYSTYPE x0, YYSTYPE x1) -{ - return format ("(%s,%s)", x0, x1); -} - -_ATEOF - - - -cat >test-input <<'_ATEOF' - - -z + q; - -T x; - -T x = y; - -x = y; - -T (x) + y; - -T (x); - -T (y) = z + q; - -T (y y) = z + q; - -z + q; - -@ - -This is total garbage, but it should be ignored. -_ATEOF - - -$at_traceoff -echo "cxx-type.at:366: bison -o types.c types.y" -echo cxx-type.at:366 >$at_check_line_file -( $at_traceon; bison -o types.c types.y ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo stderr:; cat $at_stderr -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "cxx-type.at:366: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - -$at_traceoff -echo "cxx-type.at:366: \$CC \$CFLAGS \$CPPFLAGS \$LDFLAGS types.c \$LIBS -o types" -echo cxx-type.at:366 >$at_check_line_file -( $at_traceon; $CC $CFLAGS $CPPFLAGS $LDFLAGS types.c $LIBS -o types ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo stderr:; cat $at_stderr -echo stdout:; cat $at_stdout -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "cxx-type.at:366: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - - - - - - - - - - - - - - - - - - - -$at_traceoff -echo "cxx-type.at:368: \$PREPARSER ./types test-input | sed 's/ *\$//'" -echo cxx-type.at:368 >$at_check_line_file -( $at_traceon; $PREPARSER ./types test-input | sed 's/ *$//' ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo >>$at_stderr; echo "syntax error -" | $at_diff - $at_stderr || at_failed=: -echo >>$at_stdout; echo "3.1-3.6: +(z,q) -5.1-5.4: (T,x) -7.1-7.8: (T,x,y) -9.1-9.6: =(x,y) -11.1-11.10: +((x,T),y) -13.1-13.6: ((T,x),(x,T)) -15.1-15.14: ((T,y,+(z,q)),=((y,T),+(z,q))) -17.6-17.16: -19.1-19.6: +(z,q) -" | $at_diff - $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "cxx-type.at:368: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - $at_traceoff - $at_times_p && times >$at_times_file - ) 5>&1 2>&1 | eval $at_tee_pipe - at_status=`cat $at_status_file` - ;; - - 119 ) # 119. cxx-type.at:371: GLR: Verbose messages, resolve ambiguity, impure, no locations - at_setup_line='cxx-type.at:371' - at_desc='GLR: Verbose messages, resolve ambiguity, impure, no locations' - $at_quiet $ECHO_N "119: GLR: Verbose messages, resolve ambiguity, impure, no locations$ECHO_C" - at_xfail=no - ( - echo "119. cxx-type.at:371: testing ..." - $at_traceon - - - - -# Using yacc.c? - - - - - - - -# yyerror receives the location if %location & %pure & (%glr or %parse-param). - -# yyerror always sees the locations (when activated), except if -# yacc & pure & !param. - - -# The interface is pure: either because %pure-parser, or because we -# are using the C++ parsers. - - - - - - - - - - - - -cat >types.y <<'_ATEOF' -%{ -#if HAVE_CONFIG_H -# include - /* We don't need perfect functions for these tests. */ -# undef malloc -# undef memcmp -# undef realloc -#endif -%} - -/* Simplified C++ Type and Expression Grammar. */ - -%error-verbose - -%{ - #include - #define YYSTYPE char const * - static YYSTYPE stmtMerge (YYSTYPE x0, YYSTYPE x1); - #define YYINITDEPTH 10 - static char *format (char const *, ...); - struct YYLTYPE; -#if YYPURE -# if YYLSP_NEEDED -# define LEX_PARAMETERS YYSTYPE *lvalp, struct YYLTYPE *llocp -# define ERROR_PARAMETERS struct YYLTYPE *llocp, char const *s -# else -# define LEX_PARAMETERS YYSTYPE *lvalp -# endif -#endif -#ifndef LEX_PARAMETERS -# define LEX_PARAMETERS void -#endif -#ifndef ERROR_PARAMETERS -# define ERROR_PARAMETERS char const *s -#endif - int yylex (LEX_PARAMETERS); - int yyerror (ERROR_PARAMETERS); -%} - -%token TYPENAME ID - -%right '=' -%left '+' - -%glr-parser - -%% - -prog : - | prog stmt { - - printf ("%s\n", $2); - } - ; - -stmt : expr ';' %merge { $$ = $1; } - | decl %merge - | error ';' { $$ = ""; } - | '@' { YYACCEPT; } - ; - -expr : ID - | TYPENAME '(' expr ')' { $$ = format ("(%s,%s)", $3, $1); } - | expr '+' expr { $$ = format ("+(%s,%s)", $1, $3); } - | expr '=' expr { $$ = format ("=(%s,%s)", $1, $3); } - ; - -decl : TYPENAME declarator ';' - { $$ = format ("(%s,%s)", $1, $2); } - | TYPENAME declarator '=' expr ';' - { $$ = format ("(%s,%s,%s)", $1, $2, $4); } - ; - -declarator : ID - | '(' declarator ')' { $$ = $2; } - ; - -%% - -#include -#include -#include -#include - -int -main (int argc, char **argv) -{ - if (argc != 2) - abort (); - if (!freopen (argv[1], "r", stdin)) - abort (); - exit (yyparse ()); -} - -int -yylex (LEX_PARAMETERS) -{ - char buffer[256]; - int c; - unsigned int i; - static int lineNum = 1; - static int colNum = 1; - - -#if YYPURE -# define yylloc (*llocp) -# define yylval (*lvalp) -#endif - - while (1) - { - c = getchar (); - switch (c) - { - case EOF: - return 0; - case '\t': - colNum = 1 + ((colNum + 7) & ~7); - break; - case ' ': case '\f': - colNum += 1; - break; - case '\n': - lineNum += 1; - colNum = 1; - break; - default: - { - int tok; -#if YYLSP_NEEDED - yylloc.first_line = yylloc.last_line = lineNum; - yylloc.first_column = colNum; -#endif - if (isalpha (c)) - { - i = 0; - - do - { - buffer[i++] = c; - colNum += 1; - if (i == sizeof buffer - 1) - abort (); - c = getchar (); - } - while (isalnum (c) || c == '_'); - - ungetc (c, stdin); - buffer[i++] = 0; - tok = isupper ((unsigned char) buffer[0]) ? TYPENAME : ID; - yylval = strcpy (malloc (i), buffer); - } - else - { - colNum += 1; - tok = c; - yylval = ""; - } -#if YYLSP_NEEDED - yylloc.last_column = colNum-1; -#endif - return tok; - } - } - } -} - -int -yyerror (ERROR_PARAMETERS) -{ -#if YYPURE && YYLSP_NEEDED - /* Pacify GCC by using llocp. */ - if (! llocp) - abort (); -#endif - fprintf (stderr, "%s\n", s); - return 0; -} - - -static char * -format (char const *form, ...) -{ - char buffer[1024]; - va_list args; - va_start (args, form); - vsprintf (buffer, form, args); - va_end (args); - return strcpy (malloc (strlen (buffer) + 1), buffer); -} - - -static YYSTYPE -stmtMerge (YYSTYPE x0, YYSTYPE x1) -{ - return format ("(%s,%s)", x0, x1); -} - -_ATEOF - - - -cat >test-input <<'_ATEOF' - - -z + q; - -T x; - -T x = y; - -x = y; - -T (x) + y; - -T (x); - -T (y) = z + q; - -T (y y) = z + q; - -z + q; - -@ - -This is total garbage, but it should be ignored. -_ATEOF - - -$at_traceoff -echo "cxx-type.at:373: bison -o types.c types.y" -echo cxx-type.at:373 >$at_check_line_file -( $at_traceon; bison -o types.c types.y ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo stderr:; cat $at_stderr -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "cxx-type.at:373: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - -$at_traceoff -echo "cxx-type.at:373: \$CC \$CFLAGS \$CPPFLAGS \$LDFLAGS types.c \$LIBS -o types" -echo cxx-type.at:373 >$at_check_line_file -( $at_traceon; $CC $CFLAGS $CPPFLAGS $LDFLAGS types.c $LIBS -o types ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo stderr:; cat $at_stderr -echo stdout:; cat $at_stdout -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "cxx-type.at:373: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - - - - - - - - - - - - - - - - - - - -$at_traceoff -echo "cxx-type.at:375: \$PREPARSER ./types test-input | sed 's/ *\$//'" -echo cxx-type.at:375 >$at_check_line_file -( $at_traceon; $PREPARSER ./types test-input | sed 's/ *$//' ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo >>$at_stderr; echo "syntax error, unexpected ID, expecting '=' or '+' or ')' -" | $at_diff - $at_stderr || at_failed=: -echo >>$at_stdout; echo "+(z,q) -(T,x) -(T,x,y) -=(x,y) -+((x,T),y) -((T,x),(x,T)) -((T,y,+(z,q)),=((y,T),+(z,q))) - -+(z,q) -" | $at_diff - $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "cxx-type.at:375: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - $at_traceoff - $at_times_p && times >$at_times_file - ) 5>&1 2>&1 | eval $at_tee_pipe - at_status=`cat $at_status_file` - ;; - - - banner-16 ) # Banner 16. glr-regression.at:19 - cat <<\_ATEOF - -GLR Regression Tests - -_ATEOF - ;; - - 120 ) # 120. glr-regression.at:25: Badly Collapsed GLR States - at_setup_line='glr-regression.at:25' - at_desc='Badly Collapsed GLR States' - $at_quiet $ECHO_N "120: Badly Collapsed GLR States $ECHO_C" - at_xfail=no - ( - echo "120. glr-regression.at:25: testing ..." - $at_traceon - - -cat >glr-regr1.y <<'_ATEOF' -%{ -#if HAVE_CONFIG_H -# include - /* We don't need perfect functions for these tests. */ -# undef malloc -# undef memcmp -# undef realloc -#endif -%} - -/* Regression Test: Improper state compression */ -/* Reported by Scott McPeak */ - -%{ -#include - -#define YYSTYPE int -static YYSTYPE exprMerge (YYSTYPE x0, YYSTYPE x1); -int yylex (void); -int yyerror (char const *msg); -%} - - -%glr-parser - - -/* -------- productions ------ */ -%% - -StartSymbol: E { $$=0; } %merge - ; - -E: E 'P' E { $$=1; printf("E -> E 'P' E\n"); } %merge - | 'B' { $$=2; printf("E -> 'B'\n"); } %merge - ; - - - -/* ---------- C code ----------- */ -%% - -static YYSTYPE exprMerge (YYSTYPE x0, YYSTYPE x1) -{ - (void) x0; - (void) x1; - printf ("\n"); - return 0; -} - -int -main (void) -{ - return yyparse (); -} - -int -yyerror (char const *msg) -{ - fprintf (stderr, "%s\n", msg); - exit (4); -} - - -int -yylex (void) -{ - for (;;) - { - int ch = getchar (); - if (ch == EOF) - return 0; - else if (ch == 'B' || ch == 'P') - return ch; - } -} -_ATEOF - - - -$at_traceoff -echo "glr-regression.at:97: bison -o glr-regr1.c glr-regr1.y" -echo glr-regression.at:97 >$at_check_line_file -( $at_traceon; bison -o glr-regr1.c glr-regr1.y ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo >>$at_stderr; echo "glr-regr1.y: conflicts: 1 shift/reduce -" | $at_diff - $at_stderr || at_failed=: -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "glr-regression.at:97: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - -$at_traceoff -echo "glr-regression.at:98: \$CC \$CFLAGS \$CPPFLAGS \$LDFLAGS glr-regr1.c \$LIBS -o glr-regr1" -echo glr-regression.at:98 >$at_check_line_file -( $at_traceon; $CC $CFLAGS $CPPFLAGS $LDFLAGS glr-regr1.c $LIBS -o glr-regr1 ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo stderr:; cat $at_stderr -echo stdout:; cat $at_stdout -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "glr-regression.at:98: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - -$at_traceoff -echo "glr-regression.at:109: echo BPBPB | ./glr-regr1" -echo glr-regression.at:109 >$at_check_line_file -( $at_traceon; echo BPBPB | ./glr-regr1 ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -echo >>$at_stdout; echo "E -> 'B' -E -> 'B' -E -> E 'P' E -E -> 'B' -E -> E 'P' E -E -> 'B' -E -> E 'P' E -E -> E 'P' E - -" | $at_diff - $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "glr-regression.at:109: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - - $at_traceoff - $at_times_p && times >$at_times_file - ) 5>&1 2>&1 | eval $at_tee_pipe - at_status=`cat $at_status_file` - ;; - - 121 ) # 121. glr-regression.at:117: Improper handling of embedded actions and $-N in GLR parsers - at_setup_line='glr-regression.at:117' - at_desc='Improper handling of embedded actions and $-N in GLR parsers' - $at_quiet $ECHO_N "121: Improper handling of embedded actions and $-N in GLR parsers$ECHO_C" - at_xfail=no - ( - echo "121. glr-regression.at:117: testing ..." - $at_traceon - - -cat >glr-regr2a.y <<'_ATEOF' -%{ -#if HAVE_CONFIG_H -# include - /* We don't need perfect functions for these tests. */ -# undef malloc -# undef memcmp -# undef realloc -#endif -%} - -/* Regression Test: Improper handling of embedded actions and $-N */ -/* Reported by S. Eken */ - -%{ - #define YYSTYPE char const * - #define yyfalse 0 - #define yytrue 1 - - #include - #include - #include - int yylex (void); - void yyerror (char const *); -%} - -%glr-parser - -%% - -command: - 's' var 't' - { printf ("Variable: '%s'\n", $2); } - 'v' 'x' 'q' - | 's' var_list 't' 'e' - { printf ("Varlist: '%s'\n", $2); } - | 's' var 't' var_printer 'x' - ; - -var: - 'V' - { $$ = $1; } - ; - -var_list: - var - { $$ = $1; } - | var ',' var_list - { - char buffer[50]; - strcpy (buffer, $1); - strcat (buffer, ","); - strcat (buffer, $3); - $$ = strdup (buffer); - } - ; - -var_printer: 'v' - { printf ("Variable: '%s'\n", $-1); } - -%% - -FILE *yyin = NULL; - -int -yylex (void) -{ - char buf[50]; - switch (fscanf (yyin, " %1[a-z,]", buf)) { - case 1: - return buf[0]; - case EOF: - return 0; - default: - break; - } - fscanf (yyin, "%s", buf); - yylval = strdup (buf); - return 'V'; -} - -void -yyerror (char const *s) -{ printf ("%s\n", s); -} - -int -main (int argc, char **argv) -{ - yyin = stdin; - if (argc == 2 && !(yyin = fopen (argv[1], "r"))) return 1; - return yyparse (); -} -_ATEOF - - - -$at_traceoff -echo "glr-regression.at:206: bison -o glr-regr2a.c glr-regr2a.y" -echo glr-regression.at:206 >$at_check_line_file -( $at_traceon; bison -o glr-regr2a.c glr-regr2a.y ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo >>$at_stderr; echo "glr-regr2a.y: conflicts: 2 shift/reduce -" | $at_diff - $at_stderr || at_failed=: -$at_diff $at_devnull $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "glr-regression.at:206: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - -$at_traceoff -echo "glr-regression.at:207: \$CC \$CFLAGS \$CPPFLAGS \$LDFLAGS glr-regr2a.c \$LIBS -o glr-regr2a" -echo glr-regression.at:207 >$at_check_line_file -( $at_traceon; $CC $CFLAGS $CPPFLAGS $LDFLAGS glr-regr2a.c $LIBS -o glr-regr2a ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -echo stderr:; cat $at_stderr -echo stdout:; cat $at_stdout -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "glr-regression.at:207: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - -$at_traceoff -echo "glr-regression.at:211: echo s VARIABLE_1 t v x q | ./glr-regr2a" -echo glr-regression.at:211 >$at_check_line_file -( $at_traceon; echo s VARIABLE_1 t v x q | ./glr-regr2a ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -echo >>$at_stdout; echo "Variable: 'VARIABLE_1' -" | $at_diff - $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "glr-regression.at:211: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - -$at_traceoff -echo "glr-regression.at:214: echo s VARIABLE_1 , ANOTHER_VARIABLE_2 t e | ./glr-regr2a" -echo glr-regression.at:214 >$at_check_line_file -( $at_traceon; echo s VARIABLE_1 , ANOTHER_VARIABLE_2 t e | ./glr-regr2a ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -echo >>$at_stdout; echo "Varlist: 'VARIABLE_1,ANOTHER_VARIABLE_2' -" | $at_diff - $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "glr-regression.at:214: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - -$at_traceoff -echo "glr-regression.at:217: echo s VARIABLE_3 t v x | ./glr-regr2a" -echo glr-regression.at:217 >$at_check_line_file -( $at_traceon; echo s VARIABLE_3 t v x | ./glr-regr2a ) >$at_stdout 2>$at_stder1 -at_status=$? -grep '^ *+' $at_stder1 >&2 -grep -v '^ *+' $at_stder1 >$at_stderr -at_failed=false -$at_diff $at_devnull $at_stderr || at_failed=: -echo >>$at_stdout; echo "Variable: 'VARIABLE_3' -" | $at_diff - $at_stdout || at_failed=: -case $at_status in - 77) echo 77 > $at_status_file - exit 77;; - 0) ;; - *) echo "glr-regression.at:217: exit code was $at_status, expected 0" - at_failed=:;; -esac -if $at_failed; then - - echo 1 > $at_status_file - exit 1 -fi - -$at_traceon - - - - $at_traceoff - $at_times_p && times >$at_times_file - ) 5>&1 2>&1 | eval $at_tee_pipe - at_status=`cat $at_status_file` - ;; - - - * ) - echo "$as_me: no such test group: $at_group" >&2 - continue - ;; - esac - - # Be sure to come back to the suite directory, in particular - # since below we might `rm' the group directory we are in currently. - cd $at_suite_dir - - case $at_group in - banner-*) ;; - *) - if test ! -f $at_check_line_file; then - sed "s/^ */$as_me: warning: /" <<_ATEOF - A failure happened in a test group before any test could be - run. This means that test suite is improperly designed. Please - report this failure to . -_ATEOF - echo "$at_setup_line" >$at_check_line_file - fi - at_group_count=`expr 1 + $at_group_count` - $at_verbose $ECHO_N "$at_group. $at_setup_line: $ECHO_C" - echo $ECHO_N "$at_group. $at_setup_line: $ECHO_C" >> $at_group_log - case $at_xfail:$at_status in - yes:0) - at_msg="UNEXPECTED PASS" - at_xpass_list="$at_xpass_list $at_group" - at_errexit=$at_errexit_p - ;; - no:0) - at_msg="ok" - at_pass_list="$at_pass_list $at_group" - at_errexit=false - ;; - *:77) - at_msg="skipped (`cat $at_check_line_file`)" - at_skip_list="$at_skip_list $at_group" - at_errexit=false - ;; - yes:*) - at_msg="expected failure (`cat $at_check_line_file`)" - at_xfail_list="$at_xfail_list $at_group" - at_errexit=false - ;; - no:*) - at_msg="FAILED (`cat $at_check_line_file`)" - at_fail_list="$at_fail_list $at_group" - at_errexit=$at_errexit_p - ;; - esac - echo $at_msg - at_log_msg="$at_group. $at_desc ($at_setup_line): $at_msg" - case $at_status in - 0|77) - # $at_times_file is only available if the group succeeded. - # We're not including the group log, so the success message - # is written in the global log separately. But we also - # write to the group log in case they're using -d. - if test -f $at_times_file; then - at_log_msg="$at_log_msg (`sed 1d $at_times_file`)" - rm -f $at_times_file - fi - echo "$at_log_msg" >> $at_group_log - echo "$at_log_msg" >&5 - - # Cleanup the group directory, unless the user wants the files. - $at_debug_p || rm -rf $at_group_dir - ;; - *) - # Upon failure, include the log into the testsuite's global - # log. The failure message is written in the group log. It - # is later included in the global log. - echo "$at_log_msg" >> $at_group_log - - # Upon failure, keep the group directory for autopsy, and - # create the debugging script. - { - echo "#! /bin/sh" - echo 'test "${ZSH_VERSION+set}" = set && alias -g '\''${1+"$@"}'\''='\''"$@"'\''' - echo "cd $at_dir" - echo 'exec ${CONFIG_SHELL-'"$SHELL"'}' "$0" \ - '-v -d' "$at_debug_args" "$at_group" '${1+"$@"}' - echo 'exit 1' - } >$at_group_dir/run - chmod +x $at_group_dir/run - $at_errexit && break - ;; - esac - ;; - esac -done - -# Back to the top directory. -cd $at_dir - -# Compute the duration of the suite. -at_stop_date=`date` -at_stop_time=`(date +%s) 2>/dev/null` -echo "$as_me: ending at: $at_stop_date" >&5 -at_duration_s=`(expr $at_stop_time - $at_start_time) 2>/dev/null` -at_duration_m=`(expr $at_duration_s / 60) 2>/dev/null` -at_duration_h=`(expr $at_duration_m / 60) 2>/dev/null` -at_duration_s=`(expr $at_duration_s % 60) 2>/dev/null` -at_duration_m=`(expr $at_duration_m % 60) 2>/dev/null` -at_duration="${at_duration_h}h ${at_duration_m}m ${at_duration_s}s" -if test "$at_duration" != "h m s"; then - echo "$as_me: test suite duration: $at_duration" >&5 -fi - -# Wrap up the test suite with summary statistics. -at_skip_count=`set dummy $at_skip_list; shift; echo $#` -at_fail_count=`set dummy $at_fail_list; shift; echo $#` -at_xpass_count=`set dummy $at_xpass_list; shift; echo $#` -at_xfail_count=`set dummy $at_xfail_list; shift; echo $#` - -at_run_count=`expr $at_group_count - $at_skip_count` -at_unexpected_count=`expr $at_xpass_count + $at_fail_count` -at_total_fail_count=`expr $at_xfail_count + $at_fail_count` - -echo -cat <<\_ASBOX -## ------------- ## -## Test results. ## -## ------------- ## -_ASBOX -echo -{ - echo - cat <<\_ASBOX -## ------------- ## -## Test results. ## -## ------------- ## -_ASBOX - echo -} >&5 - -if test $at_run_count = 1; then - at_result="1 test" - at_were=was -else - at_result="$at_run_count tests" - at_were=were -fi -if $at_errexit_p && test $at_unexpected_count != 0; then - if test $at_xpass_count = 1; then - at_result="$at_result $at_were run, one passed" - else - at_result="$at_result $at_were run, one failed" - fi - at_result="$at_result unexpectedly and inhibited subsequent tests." -else - # Don't you just love exponential explosion of the number of cases? - case $at_xpass_count:$at_fail_count:$at_xfail_count in - # So far, so good. - 0:0:0) at_result="$at_result $at_were successful." ;; - 0:0:*) at_result="$at_result behaved as expected." ;; - - # Some unexpected failures - 0:*:0) at_result="$at_result $at_were run, -$at_fail_count failed unexpectedly." ;; - - # Some failures, both expected and unexpected - 0:*:1) at_result="$at_result $at_were run, -$at_total_fail_count failed ($at_xfail_count expected failure)." ;; - 0:*:*) at_result="$at_result $at_were run, -$at_total_fail_count failed ($at_xfail_count expected failures)." ;; - - # No unexpected failures, but some xpasses - *:0:*) at_result="$at_result $at_were run, -$at_xpass_count passed unexpectedly." ;; - - # No expected failures, but failures and xpasses - *:1:0) at_result="$at_result $at_were run, -$at_unexpected_count did not behave as expected ($at_fail_count unexpected failure)." ;; - *:*:0) at_result="$at_result $at_were run, -$at_unexpected_count did not behave as expected ($at_fail_count unexpected failures)." ;; - - # All of them. - *:*:1) at_result="$at_result $at_were run, -$at_xpass_count passed unexpectedly, -$at_total_fail_count failed ($at_xfail_count expected failure)." ;; - *:*:*) at_result="$at_result $at_were run, -$at_xpass_count passed unexpectedly, -$at_total_fail_count failed ($at_xfail_count expected failures)." ;; - esac - - if test $at_skip_count = 0 && test $at_run_count -gt 1; then - at_result="All $at_result" - fi -fi - -# Now put skips in the mix. -case $at_skip_count in - 0) ;; - 1) at_result="$at_result -1 test was skipped." ;; - *) at_result="$at_result -$at_skip_count tests were skipped." ;; -esac - -if test $at_unexpected_count = 0; then - echo "$at_result" - echo "$at_result" >&5 -else - echo "ERROR: $at_result" >&2 - echo "ERROR: $at_result" >&5 - { - echo - cat <<\_ASBOX -## ------------------------ ## -## Summary of the failures. ## -## ------------------------ ## -_ASBOX - - # Summary of failed and skipped tests. - if test $at_fail_count != 0; then - echo "Failed tests:" - $SHELL $0 $at_fail_list --list - echo - fi - if test $at_skip_count != 0; then - echo "Skipped tests:" - $SHELL $0 $at_skip_list --list - echo - fi - if test $at_xpass_count != 0; then - echo "Unexpected passes:" - $SHELL $0 $at_xpass_list --list - echo - fi - if test $at_fail_count != 0; then - cat <<\_ASBOX -## ---------------------- ## -## Detailed failed tests. ## -## ---------------------- ## -_ASBOX - echo - for at_group in $at_fail_list - do - # Normalize the test group number. - at_group_normalized=`expr "00000$at_group" : ".*\($at_format\)"` - # Create a fresh directory for the next test group, and enter. - at_group_dir=$at_suite_dir/$at_group_normalized - at_group_log=$at_group_dir/$as_me.log - cat $at_group_log - echo - done - echo - fi - if test -n "$at_top_srcdir"; then - sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX -## $at_top_builddir/config.log ## -_ASBOX - sed 's/^/| /' $at_top_builddir/config.log - echo - fi - } >&5 - - sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX -## $as_me.log was created. ## -_ASBOX - - echo - echo "Please send \`$as_me.log' and all information you think might help:" - echo - echo " To: " - echo " Subject: [GNU Bison 1.875d] $as_me:$at_fail_list${at_fail_list:+ failed${at_xpass_list:+,}}$at_xpass_list${at_xpass_list:+ passed unexpectedly}" - echo - if test $at_debug_p = false; then - echo - echo 'You may investigate any problem if you feel able to do so, in which' - echo 'case the test suite provides a good starting point.' - echo - fi - exit 1 -fi - -exit 0 - - diff --git a/src/bin/bison/tests/testsuite.at b/src/bin/bison/tests/testsuite.at deleted file mode 100644 index d54975d704..0000000000 --- a/src/bin/bison/tests/testsuite.at +++ /dev/null @@ -1,63 +0,0 @@ -# Process this file with autom4te to create testsuite. -*- Autotest -*- - -# Test suite for GNU Bison. -# Copyright (C) 2000, 2001, 2002, 2003 Free Software Foundation, Inc. - -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2, 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, write to the Free Software -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA -# 02111-1307, USA. - - -# Testing resistance to user bugs. -m4_include([input.at]) - -# Testing output file names. -m4_include([output.at]) - -# Testing the part of the engine that computes FOLLOW etc. -m4_include([sets.at]) - -# Testing grammar reduction. -m4_include([reduce.at]) - -# Testing that #lines are correct. -m4_include([synclines.at]) - -# Testing that headers are sane. -m4_include([headers.at]) - -# Testing that user actions are properly performed. -m4_include([actions.at]) - -# Testing conflicts detection and resolution. -m4_include([conflicts.at]) - -# Fulling testing (compilation and execution of the parser) on calc. -m4_include([calc.at]) - -# Huge artificial grammars. -# Torturing the stack expansion at runtime. -m4_include([torture.at]) - -# Checking big, real world grammars. -m4_include([existing.at]) - -# Some old bugs. -m4_include([regression.at]) - -# GLR tests: -# C++ types, simplified -m4_include([cxx-type.at]) -# Regression tests -m4_include([glr-regression.at]) diff --git a/src/bin/bison/tests/torture.at b/src/bin/bison/tests/torture.at deleted file mode 100644 index 4882d83e0b..0000000000 --- a/src/bin/bison/tests/torture.at +++ /dev/null @@ -1,473 +0,0 @@ -# Torturing Bison. -*- Autotest -*- -# Copyright (C) 2001, 2002 Free Software Foundation, Inc. - -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2, 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, write to the Free Software -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA -# 02111-1307, USA. - -AT_BANNER([[Torture Tests.]]) - - -# AT_INCREASE_DATA_SIZE(SIZE) -# ------------------------------------------- -# Try to increase the data size to SIZE KiB if possible. -m4_define([AT_INCREASE_DATA_SIZE], -[data_limit=`(ulimit -S -d) 2>/dev/null` -case $data_limit in -[[0-9]]*) - if test "$data_limit" -lt $1; then - ulimit -S -d $1 - fi -esac]) - - -## ------------------------------------- ## -## Creating a large artificial grammar. ## -## ------------------------------------- ## - -# AT_DATA_TRIANGULAR_GRAMMAR(FILE-NAME, SIZE) -# ------------------------------------------- -# Create FILE-NAME, containing a self checking parser for a huge -# triangular grammar. -m4_define([AT_DATA_TRIANGULAR_GRAMMAR], -[AT_DATA([[gengram.pl]], -[[#! /usr/bin/perl -w - -use strict; -my $max = $ARGV[0] || 10; - -print < -#include - -#define YYERROR_VERBOSE 1 -#define YYDEBUG 1 - -static int yylex (void); -static void yyerror (const char *msg); -%} -%union -{ - int val; -}; - -%token END "end" -%type exp input -EOF - -for my $size (1 .. $max) - { - print "%token t$size $size \"$size\"\n"; - }; - -print < $max) - return 0; - else if (inner > outer) - { - inner = 1; - ++outer; - return END; - } - return inner++; -} - -static void -yyerror (const char *msg) -{ - fprintf (stderr, "%s\\n", msg); -} - -int -main (void) -{ - yydebug = !!getenv ("YYDEBUG"); - return yyparse (); -} -EOF -]]) - -AT_CHECK([perl -w ./gengram.pl $2 || exit 77], 0, [stdout]) -mv stdout $1 -]) - - -## -------------- ## -## Big triangle. ## -## -------------- ## - -AT_SETUP([Big triangle]) - -# I have been able to go up to 2000 on my machine. -# I tried 3000, a 29Mb grammar file, but then my system killed bison. -# With 500 and the new parser, which consume far too much memory, -# it gets killed too. Of course the parser is to be cleaned. -AT_DATA_TRIANGULAR_GRAMMAR([input.y], [200]) -AT_CHECK([bison -v -o input.c input.y]) -AT_COMPILE([input]) -AT_PARSER_CHECK([./input]) - -AT_CLEANUP - - - -# AT_DATA_HORIZONTAL_GRAMMAR(FILE-NAME, SIZE) -# ------------------------------------------- -# Create FILE-NAME, containing a self checking parser for a huge -# horizontal grammar. -m4_define([AT_DATA_HORIZONTAL_GRAMMAR], -[AT_DATA([[gengram.pl]], -[[#! /usr/bin/perl -w - -use strict; -my $max = $ARGV[0] || 10; - -print < -#include - -#define YYERROR_VERBOSE 1 -#define YYDEBUG 1 - -static int yylex (void); -static void yyerror (const char *msg); -%} -EOF - -for my $size (1 .. $max) - { - print "%token t$size $size \"$size\"\n"; - }; - -print < $max) - return 0; - else - return counter++; -} - -static void -yyerror (const char *msg) -{ - fprintf (stderr, "%s\\n", msg); -} - -int -main (void) -{ - yydebug = !!getenv ("YYDEBUG"); - return yyparse (); -} -EOF -]]) - -AT_CHECK([perl -w ./gengram.pl $2 || exit 77], 0, [stdout]) -mv stdout $1 -]) - - -## ---------------- ## -## Big horizontal. ## -## ---------------- ## - -AT_SETUP([Big horizontal]) - -# I have been able to go up to 10000 on my machine, but I had to -# increase the maximum stack size (* 100). It gave: -# -# input.y 263k -# input.tab.c 1.3M -# input 453k -# -# gengram.pl 10000 0.70s user 0.01s sys 99% cpu 0.711 total -# bison input.y 730.56s user 0.53s sys 99% cpu 12:12.34 total -# gcc -Wall input.tab.c -o input 5.81s user 0.20s sys 100% cpu 6.01 total -# ./input 0.00s user 0.01s sys 108% cpu 0.01 total -# -AT_DATA_HORIZONTAL_GRAMMAR([input.y], [1000]) - -# GNU m4 requires about 70 MiB for this test on a 32-bit host. -# Ask for 200 MiB, which should be plenty even on a 64-bit host. -AT_INCREASE_DATA_SIZE(204000) - -AT_CHECK([bison -v -o input.c input.y]) -AT_COMPILE([input]) -AT_PARSER_CHECK([./input]) - -AT_CLEANUP - - - -# AT_DATA_LOOKAHEADS_GRAMMAR(FILE-NAME, SIZE) -# ------------------------------------------- -# Create FILE-NAME, containing a self checking parser for a grammar -# requiring SIZE lookaheads. -m4_define([AT_DATA_LOOKAHEADS_GRAMMAR], -[AT_DATA([[gengram.pl]], -[[#! /usr/bin/perl -w - -use strict; -use Text::Wrap; -my $max = $ARGV[0] || 10; - -print < -#include - -#define YYERROR_VERBOSE 1 -#define YYDEBUG 1 - -static int yylex (void); -static void yyerror (const char *msg); -%} -%union -{ - int val; -}; - -%type input exp -%token token -EOF - -print - wrap ("%type ", - " ", - map { "n$_" } (1 .. $max)), - "\n"; - -for my $count (1 .. $max) - { - print "%token t$count $count \"$count\"\n"; - }; - -print < $max) - return 0; - if (return_token) - { - return_token = 0; - return token; - } - return_token = 1; - return counter++; -} - -static void -yyerror (const char *msg) -{ - fprintf (stderr, "%s\\n", msg); -} - -int -main (void) -{ - yydebug = !!getenv ("YYDEBUG"); - return yyparse (); -} -EOF -]]) - -AT_CHECK([perl -w ./gengram.pl $2 || exit 77], 0, [stdout]) -mv stdout $1 -]) - - -## ----------------- ## -## Many lookaheads. ## -## ----------------- ## - -AT_SETUP([Many lookaheads]) - -AT_DATA_LOOKAHEADS_GRAMMAR([input.y], [1000]) - -# GNU m4 requires about 70 MiB for this test on a 32-bit host. -# Ask for 200 MiB, which should be plenty even on a 64-bit host. -AT_INCREASE_DATA_SIZE(204000) - -AT_CHECK([bison -v -o input.c input.y]) -AT_COMPILE([input]) -AT_PARSER_CHECK([./input]) - -AT_CLEANUP - - - -# AT_DATA_STACK_TORTURE(C-PROLOGUE) -# --------------------------------- -# A parser specialized in torturing the stack size. -m4_define([AT_DATA_STACK_TORTURE], -[# A grammar of parens growing the stack thanks to right recursion. -# exp: -AT_DATA([input.y], -[[%{ -#include -#include -]$1[ - static int yylex (void); - static void yyerror (const char *msg); -%} -%error-verbose -%debug -%token WAIT_FOR_EOF -%% -exp: WAIT_FOR_EOF exp | ; -%% -static void -yyerror (const char *msg) -{ - fprintf (stderr, "%s\n", msg); - exit (1); -} - -/* There are YYLVAL_MAX of WAIT_FOR_EOFs. */ -unsigned int yylval_max; - -static int -yylex (void) -{ - if (yylval--) - return WAIT_FOR_EOF; - else - return EOF; -} - -int -main (int argc, const char **argv) -{ - if (argc != 2) - abort (); - yylval = atoi (argv[1]); - yydebug = 1; - return yyparse (); -} -]]) -AT_CHECK([bison -o input.c input.y]) -AT_COMPILE([input]) -]) - - -## -------------------------------------- ## -## Exploding the Stack Size with Alloca. ## -## -------------------------------------- ## - -AT_SETUP([Exploding the Stack Size with Alloca]) - -AT_DATA_STACK_TORTURE - -# Below the limit of 200. -AT_PARSER_CHECK([./input 20], 0, [], [ignore]) -# Two enlargements: 2 * 2 * 200. -AT_PARSER_CHECK([./input 900], 0, [], [ignore]) -# Fails: beyond the limit of 10,000 (which we don't reach anyway since we -# multiply by two starting at 200 => 5120 is the last possible). -AT_PARSER_CHECK([./input 10000], 1, [], [ignore]) - -AT_CLEANUP - - - - -## -------------------------------------- ## -## Exploding the Stack Size with Malloc. ## -## -------------------------------------- ## - -AT_SETUP([Exploding the Stack Size with Malloc]) - -AT_DATA_STACK_TORTURE([[#define YYSTACK_USE_ALLOCA 0]]) - -# Below the limit of 200. -AT_PARSER_CHECK([./input 20], 0, [], [ignore]) -# Two enlargements: 2 * 2 * 200. -AT_PARSER_CHECK([./input 900], 0, [], [ignore]) -# Fails: beyond the limit of 10,000 (which we don't reach anyway since we -# multiply by two starting at 200 => 5120 is the possible). -AT_PARSER_CHECK([./input 10000], 1, [], [ignore]) - -AT_CLEANUP