diff options
author | Antti-Juhani Kaijanaho <ajk@debian.org> | 2013-05-11 15:51:03 +0400 |
---|---|---|
committer | Antti-Juhani Kaijanaho <ajk@debian.org> | 2013-05-11 15:51:03 +0400 |
commit | 4e924f09e8487b2728b2acb1fac0a0e7a7b6609b (patch) | |
tree | 06c8f00fec6100ee16f8127ec41c55f954dbbd6d /p/bnfc | |
parent | 8f7d167fc1fef0579e69a315e923ca120ce67268 (diff) | |
download | DHG_packages-4e924f09e8487b2728b2acb1fac0a0e7a7b6609b.tar.gz |
bnfc: Import version 2.4.2.0-1
Diffstat (limited to 'p/bnfc')
-rw-r--r-- | p/bnfc/debian/README.build-system | 6 | ||||
-rw-r--r-- | p/bnfc/debian/changelog | 31 | ||||
-rw-r--r-- | p/bnfc/debian/compat | 1 | ||||
-rw-r--r-- | p/bnfc/debian/control | 7 | ||||
-rw-r--r-- | p/bnfc/debian/copyright | 107 | ||||
-rw-r--r-- | p/bnfc/debian/librules-manual.txt | 133 | ||||
-rw-r--r-- | p/bnfc/debian/librules.mk | 185 | ||||
-rw-r--r-- | p/bnfc/debian/patches/dont-generate-unqualified.patch | 49 | ||||
-rw-r--r-- | p/bnfc/debian/patches/generate-alex3.patch | 580 | ||||
-rw-r--r-- | p/bnfc/debian/patches/remove-haskell98.patch | 1159 | ||||
-rw-r--r-- | p/bnfc/debian/patches/series | 4 | ||||
-rw-r--r-- | p/bnfc/debian/patches/use-alex-3.patch | 97 | ||||
-rwxr-xr-x | p/bnfc/debian/rules | 42 | ||||
-rw-r--r-- | p/bnfc/debian/source/format | 1 |
14 files changed, 1951 insertions, 451 deletions
diff --git a/p/bnfc/debian/README.build-system b/p/bnfc/debian/README.build-system deleted file mode 100644 index 8e7108ed0..000000000 --- a/p/bnfc/debian/README.build-system +++ /dev/null @@ -1,6 +0,0 @@ - -$Id: README.build-system,v 1.2 2000/04/25 21:58:52 ajk Exp $ - -This package uses a new experimental debian/rules helper, librules.mk, -written by Antti-Juhani Kaijanaho <ajk@debian.org>. Documentation for -it is available in the file librules-manual.txt. diff --git a/p/bnfc/debian/changelog b/p/bnfc/debian/changelog index f518e0332..0ff694d34 100644 --- a/p/bnfc/debian/changelog +++ b/p/bnfc/debian/changelog @@ -1,3 +1,27 @@ +bnfc (2.4.2.0-1) unstable; urgency=low + + * New upstream release. + * Converted to source format 3.0 (quilt). + * Fixed a build failure with recent GHC and Alex. New patches: + - remove-haskell98.patch + - use-alex-3.patch + Closes: #665063 (FTBFS: Could not find module `Char') + Reported by Lucas Nussbaum <lucas@lucas-nussbaum.net>. + * Now generates code that compiles with recent GHC and Alex. New patches: + - generate-alex3.patch + - dont-generate-unqualified.patch + * Removed Homepage, as it seems to have disappeared. + * Rewrote the packaging to use dh instead of my aging personal helper script. + * Rewrote debian/copyright following copyright-format/1.0. + * Build-Depends: + - Added ghc as an alternative to ghc6. + - Added libghc-mtl-dev|libghc6-mtl-dev as it was split off from base. + - Restricted alex to at least version 3. + - Added debhelper. + * Standards-Version 3.9.3. + + -- Antti-Juhani Kaijanaho <ajk@debian.org> Sun, 01 Apr 2012 21:21:59 +0300 + bnfc (2.2-3.1) unstable; urgency=low * Non-maintainer upload. @@ -70,10 +94,3 @@ bnfc (2.1-1) unstable; urgency=low * formats/haskell/CFtoAlex2.hs: Do not import Alex in generated code -- Antti-Juhani Kaijanaho <ajk@debian.org> Sun, 21 Mar 2004 12:41:54 +0200 - -bnfc (2.2-3.2) unstable; urgency=low - - * Non-maintainer upload. - * Replace tabs with spaces in source files. (Closes: #460386) - - -- Barry deFreese <bdefreese@debian2.bddebian.com> Fri, 11 Apr 2008 10:15:28 -0400 diff --git a/p/bnfc/debian/compat b/p/bnfc/debian/compat new file mode 100644 index 000000000..ec635144f --- /dev/null +++ b/p/bnfc/debian/compat @@ -0,0 +1 @@ +9 diff --git a/p/bnfc/debian/control b/p/bnfc/debian/control index 9cc3d8ad9..e627773c4 100644 --- a/p/bnfc/debian/control +++ b/p/bnfc/debian/control @@ -2,13 +2,12 @@ Source: bnfc Priority: optional Section: devel Maintainer: Antti-Juhani Kaijanaho <ajk@debian.org> -Build-Depends: ghc6 (>= 6.4-4.1) -Standards-Version: 3.7.2 -Homepage: http://www.cs.chalmers.se/~markus/BNFC/ +Build-Depends: debhelper (>= 9), ghc (>= 7.0.1) | ghc6 (>= 6.10.1+dfsg1), alex (>= 3.0.1), libghc-mtl-dev | libghc6-mtl-dev +Standards-Version: 3.9.3 Package: bnfc Architecture: any -Depends: ${shlibs:Depends} +Depends: ${shlibs:Depends}, ${misc:Depends} Description: Compiler front-end generator based on Labelled BNF The BNF Converter is a compiler construction tool that generates a compiler front-end and a readable syntax description document from a diff --git a/p/bnfc/debian/copyright b/p/bnfc/debian/copyright index f11451973..27462ba9f 100644 --- a/p/bnfc/debian/copyright +++ b/p/bnfc/debian/copyright @@ -1,96 +1,31 @@ -This package was Debianized by Antti-Juhani Kaijanaho <ajk@debian.org> -on 2004-03-10. It is maintained by him. - -The upstream sources for this version were downloaded on 2005-04-10 from - http://www.cs.chalmers.se/~markus/BNFC/bnfc_2.2.tgz - -Authors and copyright licenses: - - The file Alex.hs: - -Copyright (c) 1995-2002, Chris Dornan -All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are -met: - - * Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - - * Redistributions in binary form must reproduce the above - copyright notice, this list of conditions and the following - disclaimer in the documentation and/or other materials provided - with the distribution. - - * Neither the name of the copyright holders, nor the names of the - contributors may be used to endorse or promote products derived - from this software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - - The Debian packaging: - -Copyright (C) 2004 Antti-Juhani Kaijanaho -# You may treat this file as if it were in the public domain. - - The file debian/librules{-manual.txt,.mk}: - -# Copyright © 1999, 2000, 2002, 2003, 2004 Antti-Juhani Kaijanaho. -# -# Permission is hereby granted, free of charge, to any person -# obtaining a copy of this file, to deal in this file without -# restriction, including without limitation the rights to use, copy, -# modify, merge, publish, distribute, sublicense, and/or sell copies -# of this file, and to permit persons to whom this file is furnished -# to do so, subject to the following condition: The above copyright -# notice and this permission notice shall be included in all copies or -# substantial portions of this file. -# -# THIS FILE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -# MERCHANTABILITY, FIT- NESS FOR A PARTICULAR PURPOSE AND -# NONINFRINGEMENT. IN NO EVENT SHALL SOFTWARE IN THE PUBLIC INTEREST, -# INC. BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER -# IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR -# IN CONNECTION WITH THIS FILE OR THE USE OR OTHER DEALINGS IN THIS -# FILE. -# -# Except as contained in this notice, the name of the author(s) of -# this file shall not be used in advertising or otherwise to promote -# the sale, use or other dealings in this file without prior written -# authorization from the author(s). - - -Everything else: - - Copyright (C) 2004 Authors: - Björn Bringert, Markus Forberg, Peter Gammie, Patrik Jansson, - Antti-Juhani Kaijanaho, Michael Pellauer, Aarne Ranta - +Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ +Upstream-Name: BNFC +Upstream-Contact: Markus Forsberg <markus.forsberg@gu.se> + Aarne Ranta <aarne@chalmers.se> +Source: http://hackage.haskell.org/packages/archive/BNFC/2.4.2.0/BNFC-2.4.2.0.tar.gz + +Files: * +Copyright: Copyright (C) 2002-2010 Authors: + Björn Bringert, Johan Broberg, Markus Forberg, Peter Gammie, + Patrik Jansson, Antti-Juhani Kaijanaho, Ulf Norell, + Michael Pellauer, Aarne Ranta +License: GPL-2+ + +License: GPL-2+ This 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 - -The GNU General Public License, version 2 or later, is installed in -Debian systems as /usr/share/common-licenses/GPL . + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA + 02110-1301, USA. + . + The GNU General Public License, version 2, is installed in + Debian systems as /usr/share/common-licenses/GPL-2 . diff --git a/p/bnfc/debian/librules-manual.txt b/p/bnfc/debian/librules-manual.txt deleted file mode 100644 index eda7578df..000000000 --- a/p/bnfc/debian/librules-manual.txt +++ /dev/null @@ -1,133 +0,0 @@ -Manual for the librules helper -*- Text -*- ------------------------------- -Last modified: 2004-01-01 - -This file documents an experimental new debian/rules helper, a -makefile called "librules.mk", which does all the boring work of -building a package. - -Usage: - -The very first non-comment thing in your debian/rules should be the -following line: -librules_interface = 2 -This helps to spot incompatibilities with debian/rules and the -librules.mk file currently in use. -(See the section "Incompatible changes" for what to look for when -upgrading from an old version.) - -Include "debian/librules.mk" just after that line. Precede it with a -variable definition "librules_native_pkg=yes" if the package you are building -is a Debian native package. - -Define a target debian/stamp/build that builds the package (like the -build target does in conventional debian/rules files). Put "touch $@" -as the last action in that rule. - -For every binary package <package> you want to build: - - - If the package is "arch: all", make debian/stamp/binary/indep depend - on debian/stamp/binary/<package>; otherwise make debian/stamp/binary/arch - depend on that target - - - Write a target debian/stamp/binary/<package> using the following template: - -debian/stamp/binary/<package>: package=<package> -debian/stamp/binary/<package>: debian/stamp/build - $(prebinary) - # Add here your own commands - $(postbinary) - touch $@ - - The $(prebinary) macro will create a skeletal build tree for the - package. It also install the copyright file (debian/copyright) - and the Debian changelog file (debian/changelog). If there is a - debian/NEWS, it will install it as NEWS.Debian to the - documentation directory, compressed. - - See below for instructions about how to write your own install commands. - - The $(postbinary) macro fixes directory permissions, generates the binary - control file and builds the package. - - - You may want to define targets "clean", "clean-binary" and "clean-build" - to reverse the effects of your own commands in the build and binary targets. - The librules.mk file cleans up for itself, you don't need to worry about that. - - -How to write your own commands for binary targets: - -Use the following macros to install files: - - $(install_exec) SOURCE TARGET - $(install_exec) SOURCE SOURCE ... DIRECTORY - installs one or more binary executables - (TARGET need not be a directory name) - - $(install_nonex) SOURCE TARGET - $(install_nonex) SOURCE SOURCE ... DIRECTORY - install one or more non-executable files - (TARGET need not be a directory name) - - $(install_dir) DIRECTORY - create the directory - - $(install_script) SOURCE TARGET - $(install_script) SOURCE SOURCE ... DIRECTORY - install one or more executable scripts - (TARGET need not be a directory name) - - $(install_prerm) - $(install_postrm) - $(install_preinst) - $(install_postinst) - install debian/prerm.$(package) etc. - to DEBIAN using the appropriate name - -The macros above are wrappers around the "install" utility. - - $(install_symlink) SOURCE [TARGET] - Install a symlink from SOURCE to TARGET - (This macro is a wrapper around ln -s) - - $(gzip) FILE ... - Compress the given files - (This is a wrapper around gzip) - - $(strip_lib) FILE ... - Strip the given files the way shared libraries are stripped - (This is a wrapper around strip) - - -*Never* refer to a file in the install target tree by their real name. -Use the following macros instead: - - $(rootdir) - the directory that masquerades as / in the target tree - (usually a subdirectory under debian/tmp) - $(ctldir) - the directory where control files are installed - (usually $(rootdir)/DEBIAN) - $(bindir) - the main binary directory - (usually $(rootdir)/usr/bin) - $(docdir) - the main doc directory - (usually $(rootdir)/usr/share/doc/<package>) - ... -(see librules.mk for what's available) - - -If your debian/rules needs the dpkg-architecture variables, add the -definition "librules_need_archvars=yes" before the include at the top -of the file. If you use this feature, you need to Build-Depend on -"dpkg-dev (>= 1.4.1.5)". - -If you want to patch/unpatch the package, add the definitions -"librules_patch_support=yes" and "librules_patches=file1.diff -file2.diff ... filen.diff" before the include at the top of the file. -If you use this, you need to Build-Depend on "patch". - - -Incompatible changes --------------------- - -From 1 to 2: - - {pre,post}{rm,inst} scripts are not installed by default - (previously prerm and postinst were unconditionally installed) diff --git a/p/bnfc/debian/librules.mk b/p/bnfc/debian/librules.mk deleted file mode 100644 index 8d1e07362..000000000 --- a/p/bnfc/debian/librules.mk +++ /dev/null @@ -1,185 +0,0 @@ -# librules.mk - a library of convenient rules and macros for debian/rules files -# -# Copyright © 1999, 2000, 2002, 2003, 2004 Antti-Juhani Kaijanaho. -# -# Permission is hereby granted, free of charge, to any person -# obtaining a copy of this file, to deal in this file without -# restriction, including without limitation the rights to use, copy, -# modify, merge, publish, distribute, sublicense, and/or sell copies -# of this file, and to permit persons to whom this file is furnished -# to do so, subject to the following condition: The above copyright -# notice and this permission notice shall be included in all copies or -# substantial portions of this file. -# -# THIS FILE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -# MERCHANTABILITY, FIT- NESS FOR A PARTICULAR PURPOSE AND -# NONINFRINGEMENT. IN NO EVENT SHALL SOFTWARE IN THE PUBLIC INTEREST, -# INC. BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER -# IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR -# IN CONNECTION WITH THIS FILE OR THE USE OR OTHER DEALINGS IN THIS -# FILE. -# -# Except as contained in this notice, the name of the author(s) of -# this file shall not be used in advertising or otherwise to promote -# the sale, use or other dealings in this file without prior written -# authorization from the author(s). - -# This file is set up to be compliant with Debian Standards Version -# 3.6.0. - -# Changes: -# 2004-01-01 ajk Install NEWS.Debian if it exists -# 2003-08-10 ajk Add $(etcdir) -# 2002-10-16 ajk Don't force installing the prerm/postinst scripts -# Instead, install them if present. -# INCOMPATIBLE CHANGE; updated interface to 2 - -default: - @echo You need to specify a target. - @exit 1 - -librules_a_variable_just_to_run_the_commands1 := $(shell mkdir debian/stamp) -librules_a_variable_just_to_run_the_commands2 := $(shell mkdir debian/stamp/binary) - -# Make sure we don't get used by an incompatible debian/rules -# WHEN YOU MAKE INCOMPATIBLE CHANGES, EDIT THIS! -ifneq ($(librules_interface),2) -$(error incompatible debian/rules) -endif - -# Standard interface targets -build: debian/stamp/build -binary: binary-indep binary-arch -binary-arch: debian/stamp/binary/arch -binary-indep: debian/stamp/binary/indep -clean: clean-build clean-binary clean-std - - -# Nonstandard interface targets -clean-build: clean-build-std -clean-binary: clean-binary-std - -# Stamp targets for the standard binary targets -debian/stamp/binary/arch: debian/stamp/build - touch $@ - -debian/stamp/binary/indep: debian/stamp/build - touch $@ - -.PHONY: default build binary binary-arch binary-indep \ - clean clean-build clean-binary - -ifeq ($(librules_need_archvars),yes) -DEB_BUILD_ARCH = $(shell dpkg-architecture -qDEB_BUILD_ARCH) -DEB_BUILD_GNU_TYPE = $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE) -DEB_BUILD_GNU_CPU = $(shell dpkg-architecture -qDEB_BUILD_GNU_CPU) -DEB_BUILD_GNU_SYSTEM = $(shell dpkg-architecture -qDEB_BUILD_GNU_SYSTEM) -DEB_HOST_ARCH = $(shell dpkg-architecture -qDEB_HOST_ARCH) -DEB_HOST_GNU_TYPE = $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE) -DEB_HOST_GNU_CPU = $(shell dpkg-architecture -qDEB_HOST_GNU_CPU) -DEB_HOST_GNU_SYSTEM = $(shell dpkg-architecture -qDEB_HOST_GNU_SYSTEM) -endif - -CFLAGS = -O2 -Wall -STRIP = -ifneq (,$(findstring debug,$(DEB_BUILD_OPTIONS))) -CFLAGS += -g -endif -ifeq (,$(findstring nostrip,$(DEB_BUILD_OPTIONS))) -STRIP = -s -endif - -export CFLAGS - -install := install -o root -g root -install_exec := $(install) -m 0755 $(STRIP) -install_nonex := $(install) -m 0644 -install_dir := $(install) -m 0755 -d -install_script := $(install) -m 0755 -install_symlink := ln -s -gzip := gzip -9 -strip_lib := strip --strip-unneeded - -tmpdir := $(shell pwd)/debian/tmp - -# These must not be :='s! -rootdir = $(tmpdir)/$(package) -ctldir = $(rootdir)/DEBIAN -etcdir = $(rootdir)/etc -bindir = $(rootdir)/usr/bin -sbindir = $(rootdir)/usr/sbin -docdir = $(rootdir)/usr/share/doc/$(package) -exampledir = $(docdir)/examples -mandir = $(rootdir)/usr/share/man -elispdir = $(rootdir)/usr/share/emacs/site-lisp -emacs_d_dir = $(etcdir)/emacs/site-start.d -man1dir = $(mandir)/man1 -man2dir = $(mandir)/man2 -man3dir = $(mandir)/man3 -man4dir = $(mandir)/man4 -man5dir = $(mandir)/man5 -man6dir = $(mandir)/man6 -man7dir = $(mandir)/man7 -man8dir = $(mandir)/man8 -sharedir = $(rootdir)/usr/share/$(package) -libdir = $(rootdir)/usr/lib/$(package) -docbasedir = $(rootdir)/usr/share/doc-base -usrlib = $(rootdir)/usr/lib -includedir = $(rootdir)/usr/include - -ifeq ($(librules_native_pkg),yes) -librules_changelog=changelog -else -librules_changelog=changelog.Debian -endif - -install_prerm = $(install_script) debian/prerm.$(package) $(ctldir)/prerm -install_postrm = $(install_script) debian/postrm.$(package) $(ctldir)/postrm -install_preinst = $(install_script) debian/preinst.$(package) $(ctldir)/preinst -install_postinst = $(install_script) debian/postinst.$(package) $(ctldir)/postinst - - -define prebinary - $(RM) -r $(rootdir) - $(install_dir) $(ctldir) - $(install_dir) $(docdir) - $(install_nonex) debian/copyright $(docdir) - $(install_nonex) debian/changelog $(docdir)/$(librules_changelog) - set -e ; if test -e debian/NEWS ; then \ - $(install_nonex) debian/NEWS $(docdir)/NEWS.Debian ; \ - $(gzip) $(docdir)/NEWS.Debian ; \ - fi - $(gzip) $(docdir)/$(librules_changelog) -endef - -define postbinary - chmod -R g-s $(rootdir) - dpkg-gencontrol -isp -p$(package) -P$(rootdir) $(gencontrol_options) - dpkg --build $(rootdir) .. -endef - -clean-build-std: - rm -f debian/stamp/build - -clean-binary-std: - rm -f debian/stamp/binary/* - rm -f debian/files debian/substvars - rm -rf $(tmpdir) - -clean-std: - rm -rf debian/stamp/ - -# Patching support -ifeq ($(librules_patch_support),yes) -debian/stamp/build: debian/stamp/patch -clean-build: unpatch - -debian/stamp/patch: - $(foreach patch, $(librules_patches), patch -fs < $(patch) && )true - touch $@ - -unpatch: debian/stamp/patch - $(foreach patch, $(librules_patches), patch -fsR < $(patch) && )true - rm -f debian/stamp/patch -endif diff --git a/p/bnfc/debian/patches/dont-generate-unqualified.patch b/p/bnfc/debian/patches/dont-generate-unqualified.patch new file mode 100644 index 000000000..690271b3e --- /dev/null +++ b/p/bnfc/debian/patches/dont-generate-unqualified.patch @@ -0,0 +1,49 @@ +Description: Changes Haskell generation to not use unqualified modules + Recent base releases are incompatible with haskell98, which provides several + unqualified modules. Here we change Haskell generation to generate + qualified modules, so that haskell98 is not required to compile the + generated code. +Author: Antti-Juhani Kaijanaho <ajk@debian.org> +Forwarded: by email to Markus Forsberg <markus.forsberg@gu.se> and Aarne Ranta <aarne@chalmers.se> +Last-Update: 2012-04-01 +--- +This patch header follows DEP-3: http://dep.debian.net/deps/dep3/ +--- a/formats/haskell-gadt/HaskellTopGADT.hs ++++ b/formats/haskell-gadt/HaskellTopGADT.hs +@@ -231,8 +231,8 @@ + ["-- automatically generated by BNF Converter", + "module Main where\n", + "", +- "import IO ( stdin, hGetContents )", +- "import System ( getArgs, getProgName )", ++ "import System.IO ( stdin, hGetContents )", ++ "import System.Environment ( getArgs, getProgName )", + "", + "import " ++ alexFileM opts, + "import " ++ happyFileM opts, +--- a/formats/haskell2/HaskellTop.hs ++++ b/formats/haskell2/HaskellTop.hs +@@ -241,8 +241,8 @@ + ["-- automatically generated by BNF Converter", + "module Main where\n", + "", +- "import IO ( stdin, hGetContents )", +- "import System ( getArgs, getProgName )", ++ "import System.IO ( stdin, hGetContents )", ++ "import System.Environment ( getArgs, getProgName )", + "", + "import " ++ alexFileM opts, + "import " ++ happyFileM opts, +--- a/formats/profile/ProfileTop.hs ++++ b/formats/profile/ProfileTop.hs +@@ -184,8 +184,8 @@ + "", + "import Trees", + "import Profile", +- "import IO ( stdin, hGetContents )", +- "import System ( getArgs, getProgName )", ++ "import System.IO ( stdin, hGetContents )", ++ "import System.Environment ( getArgs, getProgName )", + "", + "import " ++ alexFileM inDir name, + "import " ++ happyFileM inDir name, diff --git a/p/bnfc/debian/patches/generate-alex3.patch b/p/bnfc/debian/patches/generate-alex3.patch new file mode 100644 index 000000000..575471fd4 --- /dev/null +++ b/p/bnfc/debian/patches/generate-alex3.patch @@ -0,0 +1,580 @@ +Description: Makes possible to generate Alex 3 code + Alex 3 changes the interface again; thus the generated code needs + to be specially adapted for Alex 3. This patch adds a new option + -alex3 which directs code generation for Alex 3; it is made + the default. +Author: Antti-Juhani Kaijanaho <ajk@debian.org> +Forwarded: by email to Markus Forsberg <markus.forsberg@gu.se> and Aarne Ranta <aarne@chalmers.se> +Last-Update: 2012-04-01 +--- +This patch header follows DEP-3: http://dep.debian.net/deps/dep3/ +--- /dev/null ++++ b/formats/haskell2/CFtoAlex3.hs +@@ -0,0 +1,355 @@ ++{- ++ BNF Converter: Alex 3.0 Generator ++ Copyright (C) 2012 Author: Antti-Juhani Kaijanaho ++ Copyright (C) 2004 Author: Peter Gammie ++ (C)opyright 2003, {aarne,markus,peteg} at cs dot chalmers dot se ++ ++ This 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 ++-} ++ ++module CFtoAlex3 (cf2alex3) where ++ ++import CF ++import Data.List ++ ++-- For RegToAlex, see below. ++import AbsBNF ++import Data.Char ++ ++cf2alex3 :: String -> String -> String -> Bool -> Bool -> CF -> String ++cf2alex3 name errMod shareMod shareStrings byteStrings cf = ++ unlines $ concat $ intersperse [""] [ ++ prelude name errMod shareMod shareStrings byteStrings, ++ cMacros, ++ rMacros cf, ++ restOfAlex shareMod shareStrings byteStrings cf ++ ] ++ ++prelude :: String -> String -> String -> Bool -> Bool -> [String] ++prelude name errMod shareMod shareStrings byteStrings = [ ++ "-- -*- haskell -*-", ++ "-- This Alex file was machine-generated by the BNF converter", ++ "{", ++ "{-# OPTIONS -fno-warn-incomplete-patterns #-}", ++ "module " ++ name ++ " where", ++ "", ++ -- "import " ++ errMod, ++ if shareStrings then "import " ++ shareMod else "", ++ if byteStrings then "import qualified Data.ByteString.Char8 as BS" else "", ++ "import qualified Data.Bits", ++ "import Data.Word (Word8)", ++ "}", ++ "" ++ ] ++ ++cMacros :: [String] ++cMacros = [ ++ "$l = [a-zA-Z\\192 - \\255] # [\\215 \\247] -- isolatin1 letter FIXME", ++ "$c = [A-Z\\192-\\221] # [\\215] -- capital isolatin1 letter FIXME", ++ "$s = [a-z\\222-\\255] # [\\247] -- small isolatin1 letter FIXME", ++ "$d = [0-9] -- digit", ++ "$i = [$l $d _ '] -- identifier character", ++ "$u = [\\0-\\255] -- universal: any character" ++ ] ++ ++rMacros :: CF -> [String] ++rMacros cf = ++ let symbs = symbols cf ++ in ++ (if null symbs then [] else [ ++ "@rsyms = -- symbols and non-identifier-like reserved words", ++ " " ++ unwords (intersperse "|" (map mkEsc symbs)) ++ ]) ++ where ++ mkEsc = unwords . esc ++ esc s = if null a then rest else show a : rest ++ where (a,r) = span isAlphaNum s ++ rest = case r of ++ [] -> [] ++ (c:xs) -> s : esc xs ++ where s = if isPrint c then ['\\',c] ++ else '\\':show (ord c) ++ ++restOfAlex :: String -> Bool -> Bool -> CF -> [String] ++restOfAlex shareMod shareStrings byteStrings cf = [ ++ ":-", ++ lexComments (comments cf), ++ "$white+ ;", ++ pTSpec (symbols cf), ++ ++ userDefTokenTypes, ++ ident, ++ ++ ifC "String" ("\\\" ([$u # [\\\" \\\\ \\n]] | (\\\\ (\\\" | \\\\ | \\' | n | t)))* \\\"" ++ ++ "{ tok (\\p s -> PT p (TL $ share $ unescapeInitTail s)) }"), ++ ifC "Char" "\\\' ($u # [\\\' \\\\] | \\\\ [\\\\ \\\' n t]) \\' { tok (\\p s -> PT p (TC $ share s)) }", ++ ifC "Integer" "$d+ { tok (\\p s -> PT p (TI $ share s)) }", ++ ifC "Double" "$d+ \\. $d+ (e (\\-)? $d+)? { tok (\\p s -> PT p (TD $ share s)) }", ++ "", ++ "{", ++ "", ++ "tok f p s = f p s", ++ "", ++ "share :: "++stringType++" -> "++stringType, ++ "share = " ++ if shareStrings then "shareString" else "id", ++ "", ++ "data Tok =", ++ " TS !"++stringType++" !Int -- reserved words and symbols", ++ " | TL !"++stringType++" -- string literals", ++ " | TI !"++stringType++" -- integer literals", ++ " | TV !"++stringType++" -- identifiers", ++ " | TD !"++stringType++" -- double precision float literals", ++ " | TC !"++stringType++" -- character literals", ++ userDefTokenConstrs, ++ " deriving (Eq,Show,Ord)", ++ "", ++ "data Token = ", ++ " PT Posn Tok", ++ " | Err Posn", ++ " deriving (Eq,Show,Ord)", ++ "", ++ "tokenPos (PT (Pn _ l _) _ :_) = \"line \" ++ show l", ++ "tokenPos (Err (Pn _ l _) :_) = \"line \" ++ show l", ++ "tokenPos _ = \"end of file\"", ++ "", ++ "posLineCol (Pn _ l c) = (l,c)", ++ "mkPosToken t@(PT p _) = (posLineCol p, prToken t)", ++ "", ++ "prToken t = case t of", ++ " PT _ (TS s _) -> s", ++ " PT _ (TL s) -> s", ++ " PT _ (TI s) -> s", ++ " PT _ (TV s) -> s", ++ " PT _ (TD s) -> s", ++ " PT _ (TC s) -> s", ++ userDefTokenPrint, ++ "", ++ "data BTree = N | B "++stringType++" Tok BTree BTree deriving (Show)", ++ "", ++ "eitherResIdent :: ("++stringType++" -> Tok) -> "++stringType++" -> Tok", ++ "eitherResIdent tv s = treeFind resWords", ++ " where", ++ " treeFind N = tv s", ++ " treeFind (B a t left right) | s < a = treeFind left", ++ " | s > a = treeFind right", ++ " | s == a = t", ++ "", ++ "resWords = " ++ (show $ sorted2tree $ zip (sort resws) [1..]), ++ " where b s n = let bs = "++stringPack++" s", ++ " in B bs (TS bs n)", ++ "", ++ "unescapeInitTail :: "++stringType++" -> "++stringType++"", ++ "unescapeInitTail = "++stringPack++" . unesc . tail . "++stringUnpack++" where", ++ " unesc s = case s of", ++ " '\\\\':c:cs | elem c ['\\\"', '\\\\', '\\\''] -> c : unesc cs", ++ " '\\\\':'n':cs -> '\\n' : unesc cs", ++ " '\\\\':'t':cs -> '\\t' : unesc cs", ++ " '\"':[] -> []", ++ " c:cs -> c : unesc cs", ++ " _ -> []", ++ "", ++ "-------------------------------------------------------------------", ++ "-- Alex wrapper code.", ++ "-- A modified \"posn\" wrapper.", ++ "-------------------------------------------------------------------", ++ "", ++ "data Posn = Pn !Int !Int !Int", ++ " deriving (Eq, Show,Ord)", ++ "", ++ "alexStartPos :: Posn", ++ "alexStartPos = Pn 0 1 1", ++ "", ++ "alexMove :: Posn -> Char -> Posn", ++ "alexMove (Pn a l c) '\\t' = Pn (a+1) l (((c+7) `div` 8)*8+1)", ++ "alexMove (Pn a l c) '\\n' = Pn (a+1) (l+1) 1", ++ "alexMove (Pn a l c) _ = Pn (a+1) l (c+1)", ++ "", ++ "type Byte = Word8", ++ "", ++ "type AlexInput = (Posn, -- current position,", ++ " Char, -- previous char", ++ " [Byte], -- pending bytes on the current char", ++ " "++stringType++") -- current input string", ++ "", ++ "tokens :: "++stringType++" -> [Token]", ++ "tokens str = go (alexStartPos, '\\n', [], str)", ++ " where", ++ " go :: AlexInput -> [Token]", ++ " go inp@(pos, _, _, str) =", ++ " case alexScan inp 0 of", ++ " AlexEOF -> []", ++ " AlexError (pos, _, _, _) -> [Err pos]", ++ " AlexSkip inp' len -> go inp'", ++ " AlexToken inp' len act -> act pos ("++stringTake++" len str) : (go inp')", ++ "", ++ "alexGetByte :: AlexInput -> Maybe (Byte,AlexInput)", ++ "alexGetByte (p, c, (b:bs), s) = Just (b, (p, c, bs, s))", ++ "alexGetByte (p, _, [], s) =", ++ " case "++stringUncons++" s of", ++ " "++stringNilP++" -> Nothing", ++ " "++stringConsP++" ->", ++ " let p' = alexMove p c", ++ " (b:bs) = utf8Encode c", ++ " in p' `seq` Just (b, (p', c, bs, s))", ++ "", ++ "alexInputPrevChar :: AlexInput -> Char", ++ "alexInputPrevChar (p, c, bs, s) = c", ++ "", ++ " -- | Encode a Haskell String to a list of Word8 values, in UTF8 format.", ++ "utf8Encode :: Char -> [Word8]", ++ "utf8Encode = map fromIntegral . go . ord", ++ " where", ++ " go oc", ++ " | oc <= 0x7f = [oc]", ++ "", ++ " | oc <= 0x7ff = [ 0xc0 + (oc `Data.Bits.shiftR` 6)", ++ " , 0x80 + oc Data.Bits..&. 0x3f", ++ " ]", ++ "", ++ " | oc <= 0xffff = [ 0xe0 + (oc `Data.Bits.shiftR` 12)", ++ " , 0x80 + ((oc `Data.Bits.shiftR` 6) Data.Bits..&. 0x3f)", ++ " , 0x80 + oc Data.Bits..&. 0x3f", ++ " ]", ++ " | otherwise = [ 0xf0 + (oc `Data.Bits.shiftR` 18)", ++ " , 0x80 + ((oc `Data.Bits.shiftR` 12) Data.Bits..&. 0x3f)", ++ " , 0x80 + ((oc `Data.Bits.shiftR` 6) Data.Bits..&. 0x3f)", ++ " , 0x80 + oc Data.Bits..&. 0x3f", ++ " ]", ++ "}" ++ ] ++ where ++ (stringType,stringTake,stringUncons,stringPack,stringUnpack,stringNilP,stringConsP) ++ | byteStrings = ("BS.ByteString", "BS.take", "BS.uncons", "BS.pack", "BS.unpack", "Nothing", "Just (c,s)") ++ | otherwise = ("String", "take", "", "id", "id", "[]", "(c:s)" ) ++ ++ ifC cat s = if isUsedCat cf cat then s else "" ++ lexComments ([],[]) = [] ++ lexComments (xs,s1:ys) = '\"' : s1 ++ "\"" ++ " [.]* ; -- Toss single line comments\n" ++ lexComments (xs, ys) ++ lexComments (([l1,l2],[r1,r2]):xs,[]) = concat $ ++ [ ++ ('\"':l1:l2:"\" ([$u # \\"), -- FIXME quotes or escape? ++ (l2:"] | \\"), ++ (r1:" [$u # \\"), ++ (r2:"])* (\""), ++ (r1:"\")+ \""), ++ (r2:"\" ; \n"), ++ lexComments (xs, []) ++ ] ++ lexComments ((_:xs),[]) = lexComments (xs,[]) ++--- lexComments (xs,(_:ys)) = lexComments (xs,ys) ++ ++ -- tokens consisting of special symbols ++ pTSpec [] = "" ++ pTSpec _ = "@rsyms { tok (\\p s -> PT p (eitherResIdent (TV . share) s)) }" ++ ++ userDefTokenTypes = unlines $ ++ [printRegAlex exp ++ ++ " { tok (\\p s -> PT p (eitherResIdent (T_" ++ name ++ " . share) s)) }" ++ | (name,exp) <- tokenPragmas cf] ++ userDefTokenConstrs = unlines $ ++ [" | T_" ++ name ++ " !"++stringType | (name,_) <- tokenPragmas cf] ++ userDefTokenPrint = unlines $ ++ [" PT _ (T_" ++ name ++ " s) -> s" | (name,_) <- tokenPragmas cf] ++ ++ ident = ++ "$l $i* { tok (\\p s -> PT p (eitherResIdent (TV . share) s)) }" ++ --ifC "Ident" "<ident> ::= ^l ^i* { ident p = PT p . eitherResIdent TV }" ++ ++ resws = reservedWords cf ++ symbols cf ++ ++ ++data BTree = N | B String Int BTree BTree ++ ++instance Show BTree where ++ showsPrec _ N = showString "N" ++ showsPrec n (B s k l r) = wrap (showString "b " . shows s . showChar ' '. shows k . showChar ' ' ++ . showsPrec 1 l . showChar ' ' ++ . showsPrec 1 r) ++ where wrap f = if n > 0 then showChar '(' . f . showChar ')' else f ++ ++sorted2tree :: [(String,Int)] -> BTree ++sorted2tree [] = N ++sorted2tree xs = B x n (sorted2tree t1) (sorted2tree t2) where ++ (t1,((x,n):t2)) = splitAt (length xs `div` 2) xs ++ ++ ++------------------------------------------------------------------- ++-- Inlined version of @RegToAlex@. ++-- Syntax has changed... ++------------------------------------------------------------------- ++ ++-- modified from pretty-printer generated by the BNF converter ++ ++-- the top-level printing method ++printRegAlex :: Reg -> String ++printRegAlex = render . prt 0 ++ ++-- you may want to change render and parenth ++ ++render :: [String] -> String ++render = rend 0 ++ where rend :: Int -> [String] -> String ++ rend i ss = case ss of ++ "[" :ts -> cons "[" $ rend i ts ++ "(" :ts -> cons "(" $ rend i ts ++ t : "," :ts -> cons t $ space "," $ rend i ts ++ t : ")" :ts -> cons t $ cons ")" $ rend i ts ++ t : "]" :ts -> cons t $ cons "]" $ rend i ts ++ t :ts -> space t $ rend i ts ++ _ -> "" ++ ++ cons s t = s ++ t ++ new i s = s ++ space t s = if null s then t else t ++ " " ++ s ++ ++parenth :: [String] -> [String] ++parenth ss = ["("] ++ ss ++ [")"] ++ ++-- the printer class does the job ++class Print a where ++ prt :: Int -> a -> [String] ++ prtList :: [a] -> [String] ++ prtList = concat . map (prt 0) ++ ++instance Print a => Print [a] where ++ prt _ = prtList ++ ++instance Print Char where ++ prt _ c = if isAlphaNum c then [[c]] else ['\\':[c]] ++ prtList s = map (concat . prt 0) s ++ ++prPrec :: Int -> Int -> [String] -> [String] ++prPrec i j = if j<i then parenth else id ++ ++instance Print Ident where ++ prt _ (Ident i) = [i] ++ ++instance Print Reg where ++ prt i e = case e of ++ RSeq reg0 reg -> prPrec i 2 (concat [prt 2 reg0 , prt 3 reg]) ++ RAlt reg0 reg -> prPrec i 1 (concat [prt 1 reg0 , ["|"] , prt 2 reg]) ++ RMinus reg0 reg -> prPrec i 1 (concat [prt 2 reg0 , ["#"] , prt 2 reg]) ++ RStar reg -> prPrec i 3 (concat [prt 3 reg , ["*"]]) ++ RPlus reg -> prPrec i 3 (concat [prt 3 reg , ["+"]]) ++ ROpt reg -> prPrec i 3 (concat [prt 3 reg , ["?"]]) ++ REps -> prPrec i 3 (["$"]) ++ RChar c -> prPrec i 3 (concat [prt 0 c]) ++ RAlts str -> prPrec i 3 (concat [["["],prt 0 str,["]"]]) ++ RSeqs str -> prPrec i 2 (concat (map (prt 0) str)) ++ RDigit -> prPrec i 3 (concat [["$d"]]) ++ RLetter -> prPrec i 3 (concat [["$l"]]) ++ RUpper -> prPrec i 3 (concat [["$c"]]) ++ RLower -> prPrec i 3 (concat [["$s"]]) ++ RAny -> prPrec i 3 (concat [["$u"]]) +--- a/formats/haskell2/HaskellTop.hs ++++ b/formats/haskell2/HaskellTop.hs +@@ -17,7 +17,7 @@ + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + -} + +-module HaskellTop (makeAll) where ++module HaskellTop (makeAll,AlexMode(..)) where + + + +@@ -26,6 +26,7 @@ + import CFtoHappy + import CFtoAlex + import CFtoAlex2 ++import CFtoAlex3 + import CFtoLatex + import CFtoTxt + import CFtoAbstract +@@ -106,10 +107,12 @@ + xmlFileM = mkMod withLang "XML" + layoutFile = mkFile withLang "Layout" "hs" + ++data AlexMode = Alex1 | Alex2 | Alex3 deriving Eq ++ + data Options = Options + { + make :: Bool, +- alex1 :: Bool, ++ alexMode :: AlexMode, + inDir :: Bool, + shareStrings :: Bool, + byteStrings :: Bool, +@@ -120,12 +123,12 @@ + multi :: Bool + } + +-makeAll :: Bool -> Bool -> Bool -> Bool -> Bool -> Bool -> Int ++makeAll :: Bool -> AlexMode -> Bool -> Bool -> Bool -> Bool -> Int + -> Maybe String -- ^ The hierarchical package to put the modules + -- in, or Nothing. + -> String -> Bool -> FilePath -> IO () +-makeAll m a1 d ss bs g x p n mu file = do +- let opts = Options { make = m, alex1 = a1, inDir = d, shareStrings = ss, byteStrings=bs, ++makeAll m am d ss bs g x p n mu file = do ++ let opts = Options { make = m, alexMode = am, inDir = d, shareStrings = ss, byteStrings=bs, + glr = if g then GLR else Standard, xml = x, + inPackage = p, lang = n, multi = mu} + +@@ -143,12 +146,16 @@ + putStrLn $ "Creating directory " ++ dir + prepareDir dir + writeFileRep (absFile opts) $ cf2Abstract (byteStrings opts) absMod cf +- if alex1 opts then do ++ case alexMode opts of ++ Alex1 -> do + writeFileRep (alexFile opts) $ cf2alex lexMod errMod cf + putStrLn " (Use Alex 1.1 to compile.)" +- else do ++ Alex2 -> do + writeFileRep (alexFile opts) $ cf2alex2 lexMod errMod shareMod (shareStrings opts) (byteStrings opts) cf + putStrLn " (Use Alex 2.0 to compile.)" ++ Alex3 -> do ++ writeFileRep (alexFile opts) $ cf2alex3 lexMod errMod shareMod (shareStrings opts) (byteStrings opts) cf ++ putStrLn " (Use Alex 3.0 to compile.)" + writeFileRep (happyFile opts) $ + cf2HappyS parMod absMod lexMod errMod (glr opts) (byteStrings opts) cf + putStrLn " (Tested with Happy 1.15)" +@@ -156,7 +163,7 @@ + writeFileRep (txtFile opts) $ cfToTxt (lang opts) cf + writeFileRep (templateFile opts) $ cf2Template (templateFileM opts) absMod errMod cf + writeFileRep (printerFile opts) $ cf2Printer (byteStrings opts) prMod absMod cf +- when (hasLayout cf) $ writeFileRep (layoutFile opts) $ cf2Layout (alex1 opts) (inDir opts) layMod lexMod cf ++ when (hasLayout cf) $ writeFileRep (layoutFile opts) $ cf2Layout (alexMode opts == Alex1) (inDir opts) layMod lexMod cf + writeFileRep (tFile opts) $ testfile opts cf + writeFileRep (errFile opts) $ errM errMod cf + when (shareStrings opts) $ writeFileRep (shareFile opts) $ sharedString shareMod (byteStrings opts) cf +--- a/BNFC.cabal ++++ b/BNFC.cabal +@@ -60,6 +60,7 @@ + HaskellTop, + RegToAlex, + CFtoTemplate, ++ CFtoAlex3, + CFtoAlex2, + CFtoAlex, + CFtoHappy, +--- a/Main.hs ++++ b/Main.hs +@@ -45,7 +45,7 @@ + import System.Environment + import System.Cmd + import Data.Char +-import Data.List (elemIndex) ++import Data.List (elemIndex,foldl') + + version = "2.4.2.0" + +@@ -95,9 +95,13 @@ + let haskell = elem "-haskell" args + let haskellGADT = elem "-gadt" args + let profile = elem "-prof" args +- let alex1 = "-alex1" `elem` args +- alex2 = "-alex2" `elem` args +- alex1or2 = alex1 ++ let alexMode = foldl' (\m arg -> case arg of ++ "-alex1" -> Alex1 ++ "-alex2" -> Alex2 ++ "-alex3" -> Alex3 ++ _ -> m ++ ) Alex3 args ++ alex1 = alexMode == Alex1 + alex2StringSharing = elem "-sharestrings" args + alex2ByteString = elem "-bytestrings" args + glr = "-glr" `elem` args +@@ -125,11 +129,11 @@ + _ | csharp -> makeCSharp make vsfiles wcfSupport inPackage file + _ | java -> makeJava make name file + _ | java15 -> makeJava15 make inPackage name file +- _ | ocaml -> makeOCaml make alex1or2 inDir alex2StringSharing glr xml inPackage name file +- _ | fsharp -> makeFSharp make alex1or2 inDir alex2StringSharing glr xml inPackage name file +- _ | profile-> makeAllProfile make alex1or2 False xml name file +- _ | haskellGADT -> makeAllGADT make alex1or2 inDir alex2StringSharing alex2ByteString glr xml inPackage name file +- _ -> makeAll make alex1or2 inDir alex2StringSharing alex2ByteString glr xml inPackage name multi file ++ _ | ocaml -> makeOCaml make alex1 inDir alex2StringSharing glr xml inPackage name file ++ _ | fsharp -> makeFSharp make alex1 inDir alex2StringSharing glr xml inPackage name file ++ _ | profile-> makeAllProfile make alex1 False xml name file ++ _ | haskellGADT -> makeAllGADT make alexMode inDir alex2StringSharing alex2ByteString glr xml inPackage name file ++ _ -> makeAll make alexMode inDir alex2StringSharing alex2ByteString glr xml inPackage name multi file + if (make && multi) + then (system ("cp Makefile Makefile_" ++ name)) >> return () + else return () +@@ -175,7 +179,8 @@ + putStrLn " -p <name> Prepend <name> to the Haskell module names." + putStrLn " Dots in the module name create hierarchical modules." + putStrLn " -alex1 Use Alex 1.1 as Haskell lexer tool" +- putStrLn " -alex2 Use Alex 2 as Haskell lexer tool (default)" ++ putStrLn " -alex2 Use Alex 2 as Haskell lexer tool" ++ putStrLn " -alex3 Use Alex 3 as Haskell lexer tool (default)" + putStrLn " -sharestrings Use string sharing in Alex 2 lexer" + putStrLn " -bytestrings Use byte string in Alex 2 lexer" + putStrLn " -glr Output Happy GLR parser" +--- a/formats/haskell-gadt/HaskellTopGADT.hs ++++ b/formats/haskell-gadt/HaskellTopGADT.hs +@@ -27,6 +27,7 @@ + import CFtoHappy + import CFtoAlex + import CFtoAlex2 ++import CFtoAlex3 + import CFtoLatex + import CFtoAbstractGADT + import CFtoTemplateGADT +@@ -39,6 +40,7 @@ + -- import System + import GetCF + import Utils ++import HaskellTop (AlexMode (..)) + + import Data.Char + import Data.Maybe (fromMaybe,maybe) +@@ -105,7 +107,7 @@ + data Options = Options + { + make :: Bool, +- alex1 :: Bool, ++ alexMode :: AlexMode, + inDir :: Bool, + shareStrings :: Bool, + byteStrings :: Bool, +@@ -115,12 +117,12 @@ + lang :: String + } + +-makeAllGADT :: Bool -> Bool -> Bool -> Bool -> Bool -> Bool -> Int ++makeAllGADT :: Bool -> AlexMode -> Bool -> Bool -> Bool -> Bool -> Int + -> Maybe String -- ^ The hierarchical package to put the modules + -- in, or Nothing. + -> String -> FilePath -> IO () +-makeAllGADT m a1 d ss bs g x p n file = do +- let opts = Options { make = m, alex1 = a1, inDir = d, shareStrings = ss, byteStrings = bs, ++makeAllGADT m am d ss bs g x p n file = do ++ let opts = Options { make = m, alexMode = am, inDir = d, shareStrings = ss, byteStrings = bs, + glr = if g then GLR else Standard, xml = x, + inPackage = p, lang = n } + +@@ -140,19 +142,23 @@ + prepareDir dir + writeFileRep (absFile opts) $ cf2Abstract (byteStrings opts) absMod cf composOpMod + writeFileRep (composOpFile opts) $ composOp composOpMod +- if alex1 opts then do ++ case alexMode opts of ++ Alex1 -> do + writeFileRep (alexFile opts) $ cf2alex lexMod errMod cf + putStrLn " (Use Alex 1.1 to compile.)" +- else do ++ Alex2 -> do + writeFileRep (alexFile opts) $ cf2alex2 lexMod errMod shareMod (shareStrings opts) (byteStrings opts) cf + putStrLn " (Use Alex 2.0 to compile.)" ++ Alex3 -> do ++ writeFileRep (alexFile opts) $ cf2alex3 lexMod errMod shareMod (shareStrings opts) (byteStrings opts) cf ++ putStrLn " (Use Alex 3.0 to compile.)" + writeFileRep (happyFile opts) $ + cf2HappyS parMod absMod lexMod errMod (glr opts) (byteStrings opts) cf + putStrLn " (Tested with Happy 1.15)" + writeFileRep (latexFile opts) $ cfToLatex (lang opts) cf + writeFileRep (templateFile opts) $ cf2Template (templateFileM opts) absMod errMod cf + writeFileRep (printerFile opts) $ cf2Printer prMod absMod cf +- when (hasLayout cf) $ writeFileRep (layoutFile opts) $ cf2Layout (alex1 opts) (inDir opts) layMod lexMod cf ++ when (hasLayout cf) $ writeFileRep (layoutFile opts) $ cf2Layout (alexMode opts == Alex1) (inDir opts) layMod lexMod cf + writeFileRep (tFile opts) $ testfile opts cf + writeFileRep (errFile opts) $ errM errMod cf + when (shareStrings opts) $ writeFileRep (shareFile opts) $ sharedString shareMod (byteStrings opts) cf diff --git a/p/bnfc/debian/patches/remove-haskell98.patch b/p/bnfc/debian/patches/remove-haskell98.patch new file mode 100644 index 000000000..4b5f0b4c4 --- /dev/null +++ b/p/bnfc/debian/patches/remove-haskell98.patch @@ -0,0 +1,1159 @@ +Description: Remove dependence on haskell98 + Since GHC 7.2, haskell98 has been incompatible with base. BNFC uses both; + this patch modifies it to remove the haskell98 dependence, allowing + compilation using GHC >= 7.2. +Author: Antti-Juhani Kaijanaho <ajk@debian.org> +Bug-Debian: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=665063 +Forwarded: by email to Markus Forsberg <markus.forsberg@gu.se> and Aarne Ranta <aarne@chalmers.se> +Last-Update: 2012-04-01 +--- +This patch header follows DEP-3: http://dep.debian.net/deps/dep3/ +--- a/BNFC.cabal ++++ b/BNFC.cabal +@@ -24,7 +24,7 @@ + Extra-source-files: BNF.cf + + Executable bnfc +- Build-Depends: haskell98, base>=4 && <5, mtl, directory, array, process ++ Build-Depends: base>=4 && <5, mtl, directory, array, process + Main-is: Main.hs + HS-source-dirs: . formats + formats/haskell2 +--- a/Main.hs ++++ b/Main.hs +@@ -41,9 +41,10 @@ + + import MultiView (preprocessMCF, mkTestMulti, mkMakefileMulti) + +-import System + import System.Exit +-import Char ++import System.Environment ++import System.Cmd ++import Data.Char + import Data.List (elemIndex) + + version = "2.4.2.0" +--- a/CF.hs ++++ b/CF.hs +@@ -101,8 +101,8 @@ + ) where + + import Utils (prParenth,(+++)) +-import List (nub, intersperse, partition, sort,sort,group) +-import Char ++import Data.List (nub, intersperse, partition, sort,sort,group) ++import Data.Char + import AbsBNF (Reg()) + + -- A context free grammar consists of a set of rules and some extended +--- a/GetCF.hs ++++ b/GetCF.hs +@@ -20,17 +20,17 @@ + + module GetCF where + +-import Directory ( doesFileExist, renameFile ) +-import Monad ( when ) ++import System.Directory ( doesFileExist, renameFile ) ++import Control.Monad ( when ) + + import CF + import Utils + import ParBNF +-import List(nub,partition) ++import Data.List(nub,partition) + import qualified AbsBNF as Abs + -- import LexBNF + import ErrM +-import Char ++import Data.Char + import TypeChecker + + readCF :: FilePath -> IO CF +--- a/MultiView.hs ++++ b/MultiView.hs +@@ -20,17 +20,17 @@ + + module MultiView where + +-import Directory ( doesFileExist, renameFile ) ++import System.Directory ( doesFileExist, renameFile ) + + import qualified CF as CF + import Utils + import ParBNF + import PrintBNF +-import List(nub,partition) ++import Data.List(nub,partition) + import AbsBNF + -- import LexBNF + import ErrM +-import Char ++import Data.Char + import TypeChecker + + preprocessMCF :: FilePath -> IO ([FilePath],String) +@@ -134,4 +134,4 @@ + ".printTree" | cnc <- cncs + ] + where +- sho = show . tail . dropWhile (/='_') +\ No newline at end of file ++ sho = show . tail . dropWhile (/='_') +--- a/ParBNF.hs ++++ b/ParBNF.hs +@@ -4,7 +4,7 @@ + import AbsBNF + import LexBNF + import ErrM +-import Array ++import Data.Array + #if __GLASGOW_HASKELL__ >= 503 + import GHC.Exts + #else +--- a/PrintBNF.hs ++++ b/PrintBNF.hs +@@ -4,7 +4,7 @@ + -- pretty-printer generated by the BNF converter + + import AbsBNF +-import Char ++import Data.Char + + -- the top-level printing method + printTree :: Print a => a -> String +--- a/formats/CFtoLatex.hs ++++ b/formats/CFtoLatex.hs +@@ -22,7 +22,7 @@ + import CF + import AbsBNF (Reg (..)) + import Utils +-import List (nub,intersperse) ++import Data.List (nub,intersperse) + + cfToLatex :: String -> CF -> String + cfToLatex name cf = unlines [ +--- a/formats/NamedVariables.hs ++++ b/formats/NamedVariables.hs +@@ -38,8 +38,8 @@ + module NamedVariables where + + import CF +-import Char (toLower) +-import List (nub) ++import Data.Char (toLower) ++import Data.List (nub) + + type IVar = (String, Int) + --The type of an instance variable +--- a/formats/OOAbstract.hs ++++ b/formats/OOAbstract.hs +@@ -44,8 +44,8 @@ + import CF + import Utils((+++),(++++)) + import NamedVariables +-import List +-import Char(toLower) ++import Data.List ++import Data.Char(toLower) + + -- A datastructure more appropriate than CF + +--- a/formats/c-sharp/CAbstoCSharpAbs.hs ++++ b/formats/c-sharp/CAbstoCSharpAbs.hs +@@ -44,8 +44,8 @@ + import CF + import Utils((+++),(++++)) + import NamedVariables +-import List +-import Char(toLower) ++import Data.List ++import Data.Char(toLower) + import Data.Maybe + import CSharpUtils + +--- a/formats/c-sharp/CAbstoCSharpAbstractVisitSkeleton.hs ++++ b/formats/c-sharp/CAbstoCSharpAbstractVisitSkeleton.hs +@@ -51,7 +51,7 @@ + import CF + import Utils ((+++), (++++)) + import NamedVariables +-import List ++import Data.List + import OOAbstract hiding (basetypes) + import CSharpUtils + import CAbstoCSharpAbs +--- a/formats/c-sharp/CAbstoCSharpVisitSkeleton.hs ++++ b/formats/c-sharp/CAbstoCSharpVisitSkeleton.hs +@@ -41,7 +41,7 @@ + import CF + import Utils ((+++), (++++)) + import NamedVariables +-import List ++import Data.List + import OOAbstract hiding (basetypes) + import CSharpUtils + import CAbstoCSharpAbs +--- a/formats/c-sharp/CFtoCSharpPrinter.hs ++++ b/formats/c-sharp/CFtoCSharpPrinter.hs +@@ -43,8 +43,8 @@ + import CF + import Utils ((+++), (++++)) + import NamedVariables +-import List +-import Char(toLower, toUpper, isSpace) ++import Data.List ++import Data.Char(toLower, toUpper, isSpace) + import Data.Maybe + import CSharpUtils + +--- a/formats/c-sharp/CFtoGPLEX.hs ++++ b/formats/c-sharp/CFtoGPLEX.hs +@@ -42,7 +42,7 @@ + import RegToGPLEX + import Utils((+++), (++++)) + import NamedVariables +-import List ++import Data.List + import CSharpUtils + + --The environment must be returned for the parser to use. +--- a/formats/c-sharp/CFtoGPPG.hs ++++ b/formats/c-sharp/CFtoGPPG.hs +@@ -39,9 +39,9 @@ + module CFtoGPPG (cf2gppg) where + + import CF +-import List (intersperse, isPrefixOf) ++import Data.List (intersperse, isPrefixOf) + import NamedVariables hiding (varName) +-import Char (toLower,isUpper,isDigit) ++import Data.Char (toLower,isUpper,isDigit) + import Utils ((+++), (++++)) + import TypeChecker + import ErrM +--- a/formats/c-sharp/CSharpTop.hs ++++ b/formats/c-sharp/CSharpTop.hs +@@ -48,11 +48,10 @@ + import CFtoCSharpPrinter + import CFtoLatex + import CSharpUtils +-import System + import GetCF +-import Char +-import System + import System.Directory ++import System.Environment ++import System.Exit + import System.IO + import System.Process + import Data.Maybe +--- a/formats/c-sharp/CSharpUtils.hs ++++ b/formats/c-sharp/CSharpUtils.hs +@@ -40,9 +40,9 @@ + import CF + import Control.Monad.ST + -- Control.Monad.State +-import Char (toLower) ++import Data.Char (toLower) + import Data.Maybe +-import List ++import Data.List + import OOAbstract hiding (basetypes) + + type Namespace = String +--- a/formats/c-sharp/RegToGPLEX.hs ++++ b/formats/c-sharp/RegToGPLEX.hs +@@ -3,7 +3,7 @@ + -- modified from RegToFlex + + import AbsBNF +-import Char ++import Data.Char + + -- the top-level printing method + printRegGPLEX :: Reg -> String +--- a/formats/c/CFtoBisonC.hs ++++ b/formats/c/CFtoBisonC.hs +@@ -42,9 +42,9 @@ + module CFtoBisonC (cf2Bison) where + + import CF +-import List (intersperse, isPrefixOf) ++import Data.List (intersperse, isPrefixOf) + import NamedVariables hiding (varName) +-import Char (toLower) ++import Data.Char (toLower) + import Utils ((+++), (++++)) + + --This follows the basic structure of CFtoHappy. +--- a/formats/c/CFtoCAbs.hs ++++ b/formats/c/CFtoCAbs.hs +@@ -43,8 +43,8 @@ + import CF + import Utils((+++),(++++)) + import NamedVariables +-import List +-import Char(toLower) ++import Data.List ++import Data.Char(toLower) + + + --The result is two files (.H file, .C file) +--- a/formats/c/CFtoCPrinter.hs ++++ b/formats/c/CFtoCPrinter.hs +@@ -44,8 +44,8 @@ + import CF + import Utils ((+++), (++++)) + import NamedVariables +-import List +-import Char(toLower, toUpper) ++import Data.List ++import Data.Char(toLower, toUpper) + + --Produces (.h file, .c file) + cf2CPrinter :: CF -> (String, String) +--- a/formats/c/CFtoCSkel.hs ++++ b/formats/c/CFtoCSkel.hs +@@ -42,8 +42,8 @@ + import CF + import Utils ( (+++) ) + import NamedVariables +-import List ( isPrefixOf ) +-import Char ( toLower, toUpper ) ++import Data.List ( isPrefixOf ) ++import Data.Char ( toLower, toUpper ) + + --Produces (.H file, .C file) + cf2CSkel :: CF -> (String, String) +--- a/formats/c/CFtoFlexC.hs ++++ b/formats/c/CFtoFlexC.hs +@@ -41,7 +41,7 @@ + import RegToFlex + -- import Utils((+++), (++++)) + import NamedVariables +-import List ++import Data.List + + --The environment must be returned for the parser to use. + cf2flex :: String -> CF -> (String, SymEnv) +--- a/formats/c/CTop.hs ++++ b/formats/c/CTop.hs +@@ -26,10 +26,9 @@ + import CFtoCSkel + import CFtoCPrinter + import CFtoLatex +--- import System ++import System.Exit + import GetCF +-import Char +-import System ++import Data.Char + + makeC :: Bool -> String -> FilePath -> IO () + makeC make name file = do +--- a/formats/cpp/CFtoBison.hs ++++ b/formats/cpp/CFtoBison.hs +@@ -61,9 +61,9 @@ + module CFtoBison (cf2Bison) where + + import CF +-import List (intersperse, isPrefixOf) ++import Data.List (intersperse, isPrefixOf) + import NamedVariables hiding (varName) +-import Char (toLower,isUpper) ++import Data.Char (toLower,isUpper) + import Utils ((+++), (++++)) + import TypeChecker + import ErrM +--- a/formats/cpp/CFtoCPPAbs.hs ++++ b/formats/cpp/CFtoCPPAbs.hs +@@ -43,8 +43,8 @@ + import CF + import Utils((+++),(++++)) + import NamedVariables +-import List +-import Char(toLower) ++import Data.List ++import Data.Char(toLower) + + + --The result is two files (.H file, .C file) +--- a/formats/cpp/CFtoCPPPrinter.hs ++++ b/formats/cpp/CFtoCPPPrinter.hs +@@ -25,8 +25,8 @@ + import CF + import Utils ((+++), (++++)) + import NamedVariables +-import List +-import Char(toLower, toUpper) ++import Data.List ++import Data.Char(toLower, toUpper) + + --Produces (.H file, .C file) + cf2CPPPrinter :: CF -> (String, String) +--- a/formats/cpp/CFtoCVisitSkel.hs ++++ b/formats/cpp/CFtoCVisitSkel.hs +@@ -42,8 +42,8 @@ + import CF + import Utils ((+++), (++++)) + import NamedVariables +-import List +-import Char(toLower, toUpper) ++import Data.List ++import Data.Char(toLower, toUpper) + + --Produces (.H file, .C file) + cf2CVisitSkel :: CF -> (String, String) +--- a/formats/cpp/CFtoFlex.hs ++++ b/formats/cpp/CFtoFlex.hs +@@ -41,7 +41,7 @@ + import RegToFlex + import Utils((+++), (++++)) + import NamedVariables +-import List ++import Data.List + import STLUtils + + --The environment must be returned for the parser to use. +--- a/formats/cpp/CPPTop.hs ++++ b/formats/cpp/CPPTop.hs +@@ -27,10 +27,9 @@ + import CFtoCVisitSkel + import CFtoCPPPrinter + import CFtoLatex +-import System + import GetCF +-import Char +-import System ++import Data.Char ++import System.Exit + + makeCPP :: Bool -> String -> FilePath -> IO () + makeCPP make name file = do +--- a/formats/cpp/RegToFlex.hs ++++ b/formats/cpp/RegToFlex.hs +@@ -3,7 +3,7 @@ + -- modified from pretty-printer generated by the BNF converter + + import AbsBNF +-import Char ++import Data.Char + + -- the top-level printing method + printRegFlex :: Reg -> String +--- a/formats/cpp_stl/CFtoBisonSTL.hs ++++ b/formats/cpp_stl/CFtoBisonSTL.hs +@@ -45,9 +45,9 @@ + module CFtoBisonSTL (cf2Bison) where + + import CF +-import List (intersperse, isPrefixOf) ++import Data.List (intersperse, isPrefixOf) + import NamedVariables hiding (varName) +-import Char (toLower,isUpper,isDigit) ++import Data.Char (toLower,isUpper,isDigit) + import Utils ((+++), (++++)) + import TypeChecker + import ErrM +--- a/formats/cpp_stl/CFtoCVisitSkelSTL.hs ++++ b/formats/cpp_stl/CFtoCVisitSkelSTL.hs +@@ -42,8 +42,8 @@ + import CF + import Utils ((+++), (++++)) + import NamedVariables +-import List +-import Char(toLower, toUpper) ++import Data.List ++import Data.Char(toLower, toUpper) + import OOAbstract + import STLUtils + +--- a/formats/cpp_stl/CFtoSTLAbs.hs ++++ b/formats/cpp_stl/CFtoSTLAbs.hs +@@ -44,8 +44,8 @@ + import CF + import Utils((+++),(++++)) + import NamedVariables +-import List +-import Char(toLower) ++import Data.List ++import Data.Char(toLower) + import STLUtils + + --The result is two files (.H file, .C file) +--- a/formats/cpp_stl/CFtoSTLPrinter.hs ++++ b/formats/cpp_stl/CFtoSTLPrinter.hs +@@ -25,8 +25,8 @@ + import CF + import Utils ((+++), (++++)) + import NamedVariables +-import List +-import Char(toLower, toUpper) ++import Data.List ++import Data.Char(toLower, toUpper) + import STLUtils + + --Produces (.H file, .C file) +--- a/formats/cpp_stl/STLTop.hs ++++ b/formats/cpp_stl/STLTop.hs +@@ -29,10 +29,9 @@ + import CFtoCVisitSkelSTL + import CFtoSTLPrinter + import CFtoLatex +-import System + import GetCF +-import Char +-import System ++import Data.Char ++import System.Exit + import STLUtils + + makeSTL :: Bool -> Bool -> Maybe String -> String -> FilePath -> IO () +--- a/formats/cpp_stl/STLUtils.hs ++++ b/formats/cpp_stl/STLUtils.hs +@@ -19,7 +19,7 @@ + + module STLUtils where + +-import Char ++import Data.Char + + nsDefine :: Maybe String -> String -> String + nsDefine inPackage h = maybe h (\ns -> map toUpper ns ++ "_" ++ h) inPackage +--- a/formats/f-sharp/FSharpTop.hs ++++ b/formats/f-sharp/FSharpTop.hs +@@ -36,10 +36,10 @@ + import GetCF + import Utils + +-import Char ++import Data.Char + import Data.Maybe (fromMaybe,maybe) +-import System +-import Monad(when) ++import Control.Monad(when) ++import System.Exit + + -- naming conventions + +--- a/formats/haskell2/CFtoTemplate.hs ++++ b/formats/haskell2/CFtoTemplate.hs +@@ -23,8 +23,8 @@ + ) where + + import CF +-import Char +-import List (delete) ++import Data.Char ++import Data.List (delete) + + type ModuleName = String + type Constructor = String +--- a/formats/java/CFtoCup.hs ++++ b/formats/java/CFtoCup.hs +@@ -38,7 +38,7 @@ + module CFtoCup ( cf2Cup ) where + + import CF +-import List (intersperse, isPrefixOf) ++import Data.List (intersperse, isPrefixOf) + import Data.Char (isUpper) + import NamedVariables + import TypeChecker -- We need to (re-)typecheck to figure out list instances in +--- a/formats/java/CFtoJLex.hs ++++ b/formats/java/CFtoJLex.hs +@@ -42,7 +42,7 @@ + import RegToJLex + import Utils ( (+++) ) + import NamedVariables +-import List ++import Data.List + + --The environment must be returned for the parser to use. + cf2jlex :: String -> String -> CF -> (String, SymEnv) +--- a/formats/java/CFtoJavaAbs.hs ++++ b/formats/java/CFtoJavaAbs.hs +@@ -47,8 +47,8 @@ + import CF + import Utils((+++),(++++)) + import NamedVariables hiding (IVar, getVars, varName) +-import List +-import Char(toLower) ++import Data.List ++import Data.Char(toLower) + + --Produces abstract data types in Java. + --These follow Appel's "non-object oriented" version. +--- a/formats/java/CFtoJavaPrinter.hs ++++ b/formats/java/CFtoJavaPrinter.hs +@@ -48,8 +48,8 @@ + import CF + import NamedVariables + import Utils ( (+++) ) +-import List +-import Char ( toLower ) ++import Data.List ++import Data.Char ( toLower ) + + --Produces the PrettyPrinter class. + --It will generate two methods "print" and "show" +@@ -381,4 +381,4 @@ + escapeChars ('\"':xs) = '\\' : ('\"' : (escapeChars xs)) + escapeChars (x:xs) = x : (escapeChars xs) + +-isInternalVar x = x == internalCat ++ "_" +\ No newline at end of file ++isInternalVar x = x == internalCat ++ "_" +--- a/formats/java/CFtoJavaSkeleton.hs ++++ b/formats/java/CFtoJavaSkeleton.hs +@@ -21,8 +21,8 @@ + import CF + import Utils ((+++), (++++)) + import NamedVariables +-import List +-import Char(toLower) ++import Data.List ++import Data.Char(toLower) + + + cf2JavaSkeleton :: String -> String -> CF -> String +--- a/formats/java/CFtoVisitSkel.hs ++++ b/formats/java/CFtoVisitSkel.hs +@@ -42,8 +42,8 @@ + import CF + import Utils ((+++), (++++)) + import NamedVariables +-import List +-import Char(toLower, toUpper) ++import Data.List ++import Data.Char(toLower, toUpper) + + --Produces a Skeleton using the Visitor Design Pattern. + --Thus the user can choose which Skeleton to use. +--- a/formats/java/JavaTop.hs ++++ b/formats/java/JavaTop.hs +@@ -37,8 +37,8 @@ + ------------------------------------------------------------------- + -- Dependencies. + ------------------------------------------------------------------- +-import Directory ( createDirectory ) +-import IO ( try, isAlreadyExistsError ) ++import System.Directory ( createDirectory ) ++import System.IO.Error ( try, isAlreadyExistsError ) + + import Utils + import CF +@@ -49,10 +49,10 @@ + import CFtoJavaSkeleton + import CFtoVisitSkel + import CFtoLatex +-import System + import GetCF ( tryReadCF, writeFileRep ) +-import Char +-import List(intersperse) ++import Data.Char ++import Data.List(intersperse) ++import System.Exit + + ------------------------------------------------------------------- + -- | Build the Java output. +--- a/formats/java/RegToJLex.hs ++++ b/formats/java/RegToJLex.hs +@@ -3,7 +3,7 @@ + -- modified from pretty-printer generated by the BNF converter + + import AbsBNF +-import Char ++import Data.Char + + -- the top-level printing method + printRegJLex :: Reg -> String +--- a/formats/java1.5/CFtoAbstractVisitor.hs ++++ b/formats/java1.5/CFtoAbstractVisitor.hs +@@ -24,8 +24,8 @@ + import CFtoJavaAbs15 (typename) + import Utils ((+++), (++++)) + import NamedVariables +-import List +-import Char(toLower, toUpper, isDigit) ++import Data.List ++import Data.Char(toLower, toUpper, isDigit) + + cf2AbstractVisitor :: String -> String -> CF -> String + cf2AbstractVisitor packageBase packageAbsyn cf = +--- a/formats/java1.5/CFtoAllVisitor.hs ++++ b/formats/java1.5/CFtoAllVisitor.hs +@@ -24,8 +24,8 @@ + import CFtoJavaAbs15 (typename) + import Utils ((+++), (++++)) + import NamedVariables +-import List +-import Char(toLower, toUpper, isDigit) ++import Data.List ++import Data.Char(toLower, toUpper, isDigit) + + cf2AllVisitor :: String -> String -> CF -> String + cf2AllVisitor packageBase packageAbsyn cf = +--- a/formats/java1.5/CFtoComposVisitor.hs ++++ b/formats/java1.5/CFtoComposVisitor.hs +@@ -24,8 +24,8 @@ + import CFtoJavaAbs15 (typename) + import Utils ((+++), (++++)) + import NamedVariables +-import List +-import Char(toLower, toUpper, isDigit) ++import Data.List ++import Data.Char(toLower, toUpper, isDigit) + + cf2ComposVisitor :: String -> String -> CF -> String + cf2ComposVisitor packageBase packageAbsyn cf = +--- a/formats/java1.5/CFtoCup15.hs ++++ b/formats/java1.5/CFtoCup15.hs +@@ -40,7 +40,7 @@ + module CFtoCup15 ( cf2Cup ) where + + import CF +-import List (intersperse, isPrefixOf) ++import Data.List (intersperse, isPrefixOf) + import NamedVariables + import Utils ( (+++) ) + import TypeChecker -- We need to (re-)typecheck to figure out list instances in +--- a/formats/java1.5/CFtoFoldVisitor.hs ++++ b/formats/java1.5/CFtoFoldVisitor.hs +@@ -24,8 +24,8 @@ + import CFtoJavaAbs15 (typename) + import Utils ((+++), (++++)) + import NamedVariables +-import List +-import Char(toLower, toUpper, isDigit) ++import Data.List ++import Data.Char(toLower, toUpper, isDigit) + + cf2FoldVisitor :: String -> String -> CF -> String + cf2FoldVisitor packageBase packageAbsyn cf = +--- a/formats/java1.5/CFtoJLex15.hs ++++ b/formats/java1.5/CFtoJLex15.hs +@@ -43,7 +43,7 @@ + import RegToJLex + import Utils ( (+++) ) + import NamedVariables +-import List ++import Data.List + + --The environment must be returned for the parser to use. + cf2jlex :: String -> String -> CF -> (String, SymEnv) +--- a/formats/java1.5/CFtoJavaAbs15.hs ++++ b/formats/java1.5/CFtoJavaAbs15.hs +@@ -48,9 +48,9 @@ + import CF + import Utils((+++),(++++)) + import NamedVariables hiding (IVar, getVars, varName) +-import List +-import Char(toLower, isDigit) +-import Maybe(catMaybes,fromMaybe) ++import Data.List ++import Data.Char(toLower, isDigit) ++import Data.Maybe(catMaybes,fromMaybe) + + --Produces abstract data types in Java. + --These follow Appel's "non-object oriented" version. +--- a/formats/java1.5/CFtoJavaPrinter15.hs ++++ b/formats/java1.5/CFtoJavaPrinter15.hs +@@ -51,8 +51,8 @@ + import CF + import NamedVariables + import Utils ( (+++) ) +-import List +-import Char ( toLower, isSpace ) ++import Data.List ++import Data.Char ( toLower, isSpace ) + + --Produces the PrettyPrinter class. + --It will generate two methods "print" and "show" +--- a/formats/java1.5/CFtoVisitSkel15.hs ++++ b/formats/java1.5/CFtoVisitSkel15.hs +@@ -44,8 +44,8 @@ + import CFtoJavaAbs15 (typename) + import Utils ((+++), (++++)) + import NamedVariables +-import List +-import Char(toLower, toUpper, isDigit) ++import Data.List ++import Data.Char(toLower, toUpper, isDigit) + + --Produces a Skeleton using the Visitor Design Pattern. + --Thus the user can choose which Skeleton to use. +--- a/formats/java1.5/JavaTop15.hs ++++ b/formats/java1.5/JavaTop15.hs +@@ -38,8 +38,8 @@ + ------------------------------------------------------------------- + -- Dependencies. + ------------------------------------------------------------------- +-import Directory ( createDirectory ) +-import IO ( try, isAlreadyExistsError ) ++import System.Directory ( createDirectory ) ++import System.Exit + + import Utils + import CF +@@ -54,10 +54,9 @@ + import CFtoFoldVisitor + import CFtoAllVisitor + import CFtoLatex +-import System + import GetCF ( tryReadCF, writeFileRep ) +-import Char +-import List(intersperse) ++import Data.Char ++import Data.List(intersperse) + + ------------------------------------------------------------------- + -- | Build the Java output. +--- a/formats/ocaml/CFtoOCamlAbs.hs ++++ b/formats/ocaml/CFtoOCamlAbs.hs +@@ -23,7 +23,7 @@ + + import CF + import Utils((+++),(++++)) +-import List(intersperse) ++import Data.List(intersperse) + import OCamlUtil + + -- to produce an OCaml module +@@ -60,4 +60,4 @@ + + contentSpec :: CF -> Cat -> String + contentSpec cf cat = -- if isPositionCat cf cat then "((Int,Int),String)" else "String" +- if isPositionCat cf cat then "((int * int) * string)" else "string" +\ No newline at end of file ++ if isPositionCat cf cat then "((int * int) * string)" else "string" +--- a/formats/ocaml/CFtoOCamlLex.hs ++++ b/formats/ocaml/CFtoOCamlLex.hs +@@ -22,8 +22,8 @@ + + module CFtoOCamlLex (cf2ocamllex) where + +-import List +-import Char ++import Data.List ++import Data.Char + + import CF + import AbsBNF +--- a/formats/ocaml/CFtoOCamlPrinter.hs ++++ b/formats/ocaml/CFtoOCamlPrinter.hs +@@ -24,8 +24,8 @@ + import CF + import Utils + import CFtoTemplate +-import List (intersperse) +-import Char(toLower,isDigit) ++import Data.List (intersperse) ++import Data.Char(toLower,isDigit) + import OCamlUtil + + -- derive pretty-printer from a BNF grammar. AR 15/2/2002 +@@ -197,4 +197,4 @@ + _ -> if precCat c > 0 -- precedence-level cats are not in abstract syntax + then "prt" ++ (fixTypeUpper $ reverse (dropWhile isDigit (reverse c))) + else "prt" ++ (fixTypeUpper c) +- +\ No newline at end of file ++ +--- a/formats/ocaml/CFtoOCamlShow.hs ++++ b/formats/ocaml/CFtoOCamlShow.hs +@@ -26,8 +26,8 @@ + import CF + import Utils + import CFtoTemplate +-import List (intersperse) +-import Char(toLower,isDigit) ++import Data.List (intersperse) ++import Data.Char(toLower,isDigit) + import OCamlUtil + + cf2show :: String -> String -> CF -> String +@@ -150,4 +150,4 @@ + _ -> if precCat c > 0 -- precedence-level cats are not in abstract syntax + then "show" ++ (fixTypeUpper $ reverse (dropWhile isDigit (reverse c))) + else "show" ++ (fixTypeUpper c) +- +\ No newline at end of file ++ +--- a/formats/ocaml/CFtoOCamlTemplate.hs ++++ b/formats/ocaml/CFtoOCamlTemplate.hs +@@ -25,8 +25,8 @@ + ) where + + import CF +-import Char +-import List (delete) ++import Data.Char ++import Data.List (delete) + import Utils((+++)) + import OCamlUtil + +--- a/formats/ocaml/CFtoOCamlYacc.hs ++++ b/formats/ocaml/CFtoOCamlYacc.hs +@@ -27,8 +27,8 @@ + where + + import CF +-import List (intersperse,nub) +-import Char ++import Data.List (intersperse,nub) ++import Data.Char + + import Utils ((+++)) + import OCamlUtil +--- a/formats/ocaml/OCamlTop.hs ++++ b/formats/ocaml/OCamlTop.hs +@@ -35,10 +35,10 @@ + import GetCF + import Utils + +-import Char ++import Data.Char + import Data.Maybe (fromMaybe,maybe) +-import System +-import Monad(when) ++import Control.Monad(when) ++import System.Exit + + -- naming conventions + +--- a/formats/ocaml/OCamlUtil.hs ++++ b/formats/ocaml/OCamlUtil.hs +@@ -21,7 +21,7 @@ + + import CF + import Utils +-import Char (toLower, toUpper) ++import Data.Char (toLower, toUpper) + + -- Translate Haskell types to OCaml types + -- Note: OCaml (data-)types start with lowercase letter +--- a/formats/profile/ProfileTop.hs ++++ b/formats/profile/ProfileTop.hs +@@ -36,9 +36,9 @@ + import GetCF + import Utils + +-import Char +-import System +-import Monad(when) ++import Data.Char ++import Control.Monad(when) ++import System.Exit + + -- naming conventions + +--- a/formats/xml/CFtoXML.hs ++++ b/formats/xml/CFtoXML.hs +@@ -24,8 +24,8 @@ + import GetCF (writeFileRep) + import Utils + import CFtoTemplate +-import List (intersperse, nub) +-import Char(toLower) ++import Data.List (intersperse, nub) ++import Data.Char(toLower) + + type Coding = Bool ---- change to at least three values + +--- a/formats/CFtoTxt.hs ++++ b/formats/CFtoTxt.hs +@@ -22,7 +22,7 @@ + import CF + import AbsBNF (Reg (..)) + import Utils +-import List (nub,intersperse) ++import Data.List (nub,intersperse) + + cfToTxt :: String -> CF -> String + cfToTxt name cf = unlines [ +--- a/formats/haskell-gadt/CFtoAbstractGADT.hs ++++ b/formats/haskell-gadt/CFtoAbstractGADT.hs +@@ -21,7 +21,7 @@ + + import CF + import Utils((+++),(++++)) +-import List(intersperse,nub) ++import Data.List(intersperse,nub) + + import HaskellGADTCommon + +--- a/formats/haskell-gadt/CFtoPrinterGADT.hs ++++ b/formats/haskell-gadt/CFtoPrinterGADT.hs +@@ -22,8 +22,8 @@ + import CF + import Utils + import CFtoTemplate +-import List (intersperse) +-import Char(toLower) ++import Data.List (intersperse) ++import Data.Char(toLower) + + import HaskellGADTCommon + +--- a/formats/haskell-gadt/CFtoTemplateGADT.hs ++++ b/formats/haskell-gadt/CFtoTemplateGADT.hs +@@ -24,7 +24,7 @@ + + import CF + import Utils((+++)) +-import List (delete,groupBy) ++import Data.List (delete,groupBy) + + import HaskellGADTCommon + +@@ -62,4 +62,4 @@ + prCatTrans :: Cat -> [Constructor] -> [String] + prCatTrans cat cs = ["trans" ++ cat +++ "::" +++ cat +++ "-> Result", + "trans" ++ cat +++ "t = case t of"] +- ++ map prConsCase cs +\ No newline at end of file ++ ++ map prConsCase cs +--- a/formats/haskell-gadt/HaskellGADTCommon.hs ++++ b/formats/haskell-gadt/HaskellGADTCommon.hs +@@ -21,7 +21,7 @@ + + import CF + +-import Char ++import Data.Char + + data Constructor = Constructor { + consCat :: Cat, +--- a/formats/haskell-gadt/HaskellTopGADT.hs ++++ b/formats/haskell-gadt/HaskellTopGADT.hs +@@ -40,10 +40,10 @@ + import GetCF + import Utils + +-import Char ++import Data.Char + import Data.Maybe (fromMaybe,maybe) +-import System +-import Monad(when) ++import Control.Monad(when) ++import System.Exit + + -- naming conventions + +--- a/formats/haskell2/CFtoAbstract.hs ++++ b/formats/haskell2/CFtoAbstract.hs +@@ -21,7 +21,7 @@ + + import CF + import Utils((+++),(++++)) +-import List(intersperse) ++import Data.List(intersperse) + + -- to produce a Haskell module + cf2Abstract :: Bool -> String -> CF -> String +@@ -48,4 +48,4 @@ + where + stringType + | byteStrings = "BS.ByteString" +- | otherwise = "String" +\ No newline at end of file ++ | otherwise = "String" +--- a/formats/haskell2/CFtoAlex.hs ++++ b/formats/haskell2/CFtoAlex.hs +@@ -22,7 +22,7 @@ + + import CF + import RegToAlex +-import List ++import Data.List + + cf2alex :: String -> String -> CF -> String + cf2alex name errMod cf = unlines $ concat $ intersperse [""] [ +--- a/formats/haskell2/CFtoAlex2.hs ++++ b/formats/haskell2/CFtoAlex2.hs +@@ -33,11 +33,11 @@ + module CFtoAlex2 (cf2alex2) where + + import CF +-import List ++import Data.List + + -- For RegToAlex, see below. + import AbsBNF +-import Char ++import Data.Char + + cf2alex2 :: String -> String -> String -> Bool -> Bool -> CF -> String + cf2alex2 name errMod shareMod shareStrings byteStrings cf = +--- a/formats/haskell2/CFtoHappy.hs ++++ b/formats/haskell2/CFtoHappy.hs +@@ -26,8 +26,8 @@ + + import CF + --import Lexer +-import List (intersperse, sort) +-import Char ++import Data.List (intersperse, sort) ++import Data.Char + + -- Type declarations + +--- a/formats/haskell2/CFtoPrinter.hs ++++ b/formats/haskell2/CFtoPrinter.hs +@@ -22,8 +22,8 @@ + import CF + import Utils + import CFtoTemplate +-import List (intersperse) +-import Char(toLower) ++import Data.List (intersperse) ++import Data.Char(toLower) + + -- derive pretty-printer from a BNF grammar. AR 15/2/2002 + cf2Printer :: Bool -> String -> String -> CF -> String +--- a/formats/haskell2/HaskellTop.hs ++++ b/formats/haskell2/HaskellTop.hs +@@ -36,14 +36,13 @@ + import MkErrM + import MkSharedString + -- import CFtoGF ( cf2AbsGF, cf2ConcGF ) +--- import System ++import System.Exit + import GetCF + import Utils + +-import Char ++import Data.Char + import Data.Maybe (fromMaybe,maybe) +-import System +-import Monad(when) ++import Control.Monad(when) + + -- naming conventions + +--- a/formats/haskell2/RegToAlex.hs ++++ b/formats/haskell2/RegToAlex.hs +@@ -22,7 +22,7 @@ + -- modified from pretty-printer generated by the BNF converter + + import AbsBNF +-import Char ++import Data.Char + + -- the top-level printing method + printRegAlex :: Reg -> String +--- a/formats/profile/CFtoHappyProfile.hs ++++ b/formats/profile/CFtoHappyProfile.hs +@@ -25,8 +25,8 @@ + + import CF + --import Lexer +-import List (intersperse) +-import Char ++import Data.List (intersperse) ++import Data.Char + + -- Type declarations diff --git a/p/bnfc/debian/patches/series b/p/bnfc/debian/patches/series new file mode 100644 index 000000000..01b3dd08b --- /dev/null +++ b/p/bnfc/debian/patches/series @@ -0,0 +1,4 @@ +remove-haskell98.patch +use-alex-3.patch +generate-alex3.patch +dont-generate-unqualified.patch diff --git a/p/bnfc/debian/patches/use-alex-3.patch b/p/bnfc/debian/patches/use-alex-3.patch new file mode 100644 index 000000000..f44187135 --- /dev/null +++ b/p/bnfc/debian/patches/use-alex-3.patch @@ -0,0 +1,97 @@ +Description: Makes BNFC buildable with Alex >= 3 (and only it) +Author: Antti-Juhani Kaijanaho <ajk@debian.org> +Bug-Debian: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=665063 +Forwarded: by email to Markus Forsberg <markus.forsberg@gu.se> and Aarne Ranta <aarne@chalmers.se> +Last-Update: 2012-04-01 +--- +This patch header follows DEP-3: http://dep.debian.net/deps/dep3/ +--- a/BNFC.cabal ++++ b/BNFC.cabal +@@ -25,6 +25,7 @@ + + Executable bnfc + Build-Depends: base>=4 && <5, mtl, directory, array, process ++ Build-Tools: alex>=3 + Main-is: Main.hs + HS-source-dirs: . formats + formats/haskell2 +--- a/LexBNF.x ++++ b/LexBNF.x +@@ -4,6 +4,8 @@ + {-# OPTIONS -fno-warn-incomplete-patterns #-} + module LexBNF where + ++import qualified Data.Bits ++import Data.Word (Word8) + + } + +@@ -108,27 +110,54 @@ + alexMove (Pn a l c) '\n' = Pn (a+1) (l+1) 1 + alexMove (Pn a l c) _ = Pn (a+1) l (c+1) + ++type Byte = Word8 ++ + type AlexInput = (Posn, -- current position, + Char, -- previous char ++ [Byte], -- pending bytes on the current char + String) -- current input string + + tokens :: String -> [Token] +-tokens str = go (alexStartPos, '\n', str) ++tokens str = go (alexStartPos, '\n', [], str) + where +- go :: (Posn, Char, String) -> [Token] +- go inp@(pos, _, str) = ++ go :: (Posn, Char, [Byte], String) -> [Token] ++ go inp@(pos, _, _, str) = + case alexScan inp 0 of +- AlexEOF -> [] +- AlexError (pos, _, _) -> [Err pos] +- AlexSkip inp' len -> go inp' +- AlexToken inp' len act -> act pos (take len str) : (go inp') +- +-alexGetChar :: AlexInput -> Maybe (Char,AlexInput) +-alexGetChar (p, c, []) = Nothing +-alexGetChar (p, _, (c:s)) = +- let p' = alexMove p c +- in p' `seq` Just (c, (p', c, s)) ++ AlexEOF -> [] ++ AlexError (pos, _, _, _) -> [Err pos] ++ AlexSkip inp' len -> go inp' ++ AlexToken inp' len act -> act pos (take len str) : (go inp') ++ ++alexGetByte :: AlexInput -> Maybe (Byte,AlexInput) ++alexGetByte (p, c, (b:bs), s) = Just (b, (p, c, bs, s)) ++alexGetByte (p, c, [], []) = Nothing ++alexGetByte (p, _, [], (c:s)) = ++ let p' = alexMove p c ++ (b:bs) = utf8Encode c ++ in p' `seq` Just (b, (p', c, bs, s)) + + alexInputPrevChar :: AlexInput -> Char +-alexInputPrevChar (p, c, s) = c ++alexInputPrevChar (p, c, _, s) = c ++ ++ ++-- | Encode a Haskell String to a list of Word8 values, in UTF8 format. ++utf8Encode :: Char -> [Word8] ++utf8Encode = map fromIntegral . go . ord ++ where ++ go oc ++ | oc <= 0x7f = [oc] ++ ++ | oc <= 0x7ff = [ 0xc0 + (oc `Data.Bits.shiftR` 6) ++ , 0x80 + oc Data.Bits..&. 0x3f ++ ] ++ ++ | oc <= 0xffff = [ 0xe0 + (oc `Data.Bits.shiftR` 12) ++ , 0x80 + ((oc `Data.Bits.shiftR` 6) Data.Bits..&. 0x3f) ++ , 0x80 + oc Data.Bits..&. 0x3f ++ ] ++ | otherwise = [ 0xf0 + (oc `Data.Bits.shiftR` 18) ++ , 0x80 + ((oc `Data.Bits.shiftR` 12) Data.Bits..&. 0x3f) ++ , 0x80 + ((oc `Data.Bits.shiftR` 6) Data.Bits..&. 0x3f) ++ , 0x80 + oc Data.Bits..&. 0x3f ++ ] + } diff --git a/p/bnfc/debian/rules b/p/bnfc/debian/rules index 72e5dbac4..785b230d7 100755 --- a/p/bnfc/debian/rules +++ b/p/bnfc/debian/rules @@ -1,36 +1,18 @@ #!/usr/bin/make -f -# Written by Antti-Juhani Kaijanaho <ajk@debian.org>. -# You may treat this file as if it were in the public domain. +%: + dh $@ -librules_interface = 2 -include debian/librules.mk +override_dh_auto_configure: + runghc Setup.lhs configure --ghc \ + --prefix=/usr --docdir=/usr/share/doc/bnfc -debian/stamp/build: #debian/stamp/build-configure - $(MAKE) - touch $@ +override_dh_auto_build: + runghc Setup.lhs build -clean-build: - [ ! -f Makefile ] || $(MAKE) clean - $(RM) bnfc - $(RM) $(shell find . -name *~) +override_dh_auto_install: + runghc Setup.lhs copy --destdir=debian/bnfc + rm debian/bnfc/usr/share/doc/bnfc/COPYING -debian/stamp/binary/arch: debian/stamp/binary/bnfc +override_dh_auto_clean: + runghc Setup.lhs clean -debian/stamp/binary/bnfc: package=bnfc -debian/stamp/binary/bnfc: debian/stamp/build - $(prebinary) -# Install the binary. - $(install_dir) $(bindir) - $(install_exec) bnfc $(bindir) -# Install the supporting documentation. - $(install_nonex) doc/LBNF-report.tex $(docdir) - $(gzip) $(docdir)/LBNF-report.tex -# $(install_dir) $(exampledir) -# $(install_nonex) doc/examples/* $(exampledir) -# Get the shared library deps - dpkg-shlibdeps $(bindir)/bnfc - $(postbinary) - touch $@ - -clean-binary: - $(RM) *~ diff --git a/p/bnfc/debian/source/format b/p/bnfc/debian/source/format new file mode 100644 index 000000000..163aaf8d8 --- /dev/null +++ b/p/bnfc/debian/source/format @@ -0,0 +1 @@ +3.0 (quilt) |