Commit 904f158f authored by simonmar's avatar simonmar
Browse files

[project @ 1999-06-01 16:40:41 by simonmar]

This commit replaces the old yacc parser with a Happy-generated one.
Notes:

	- The generated .hs file is *big*.  Best to use a recent
	  version of Happy, and even better to add the -c flag
	  to use unsafeCoerce# with ghc (versions 4.02+ please).

	- The lexer has grown all sorts of unsightly growths and
	  should be put down as soon as possible.

	- Parse errors may result in strange diagnostics.  I'm looking
	  into this.

	- HsSyn now contains a few extra constructors due to the way
	  patterns are parsed as expressions in the parser.

	- The layout rule is implemented according to the Haskell
	  report.  I found a couple of places in the libraries where
	  we previously weren't adhering to this - in particular the
	  rule about "nested contexts must be more indented than
	  outer contexts".  The rule is necessary to disambiguate
	  in the presence of empty declaration lists.
parent 6ee2f67e
# -----------------------------------------------------------------------------
# $Id: Makefile,v 1.59 1999/05/18 16:38:23 simonpj Exp $
# $Id: Makefile,v 1.60 1999/06/01 16:40:41 simonmar Exp $
TOP = ..
include $(TOP)/mk/boilerplate.mk
......@@ -17,12 +17,7 @@ endif
# -----------------------------------------------------------------------------
# Set HS_PROG, LIBRARY
# Setting HS_PROG and LIBRARY causes all targets in target.mk
# (included below) to kick in.
LIBRARY=libhsp.a
#
# Note: there have been reports of people running up against the ARG_MAX limit
# when linking hsc with all its constituent object files. The likely source of
# the problem is that the environment is a bit too big, so a workaround could
......@@ -49,7 +44,7 @@ $(HS_PROG) :: $(HS_SRCS)
DIRS = \
utils basicTypes types hsSyn prelude rename typecheck deSugar coreSyn \
specialise simplCore stranal stgSyn simplStg codeGen absCSyn main \
reader profiling parser usageSP cprAnalysis
profiling parser usageSP cprAnalysis
ifeq ($(GhcWithNativeCodeGen),YES)
......@@ -59,47 +54,30 @@ SRC_HC_OPTS += -DOMIT_NATIVE_CODEGEN
endif
HS_SRCS = $(SRCS_UGNHS) \
$(foreach dir,$(DIRS),$(wildcard $(dir)/*.lhs))
HS_SRCS = $(foreach dir,$(DIRS),$(wildcard $(dir)/*.lhs))
ifneq "$(GhcWithHscBuiltViaC)" "YES"
HS_SRCS += rename/ParseIface.hs
HS_SRCS += rename/ParseIface.hs parser/Parser.hs
endif
# NB: it's no good to include *.hs in the top-line wildcard, because the .hs files
# in parser/ may not have been created at that point.
HCS = $(patsubst %.lhs, %.hc, $(patsubst %.hs, %.hc, $(HS_SRCS)))
# ParseIface.hs ain't part of HS_SRCS when this is on..
ifeq "$(GhcWithHscBuiltViaC)" "YES"
HCS += rename/ParseIface.hc
HCS += rename/ParseIface.hc parser/Parser.hc
endif
HS_OBJS = \
$(patsubst %.hc, %.o, $(HCS)) \
parser/hsclink.o parser/hschooks.o libhsp.a
parser/ctypes.o parser/hschooks.o
DESTDIR = $(INSTALL_LIBRARY_DIR_GHC)
SRCS_UGN = $(wildcard parser/*.ugn)
SRCS_UGNC = $(patsubst %.ugn, %.c, $(SRCS_UGN))
SRCS_UGNH = $(patsubst %.ugn, %.h, $(SRCS_UGN))
SRCS_UGNHS = $(patsubst parser/%.ugn, parser/U_%.hs, $(SRCS_UGN))
SRCS_UGN_OBJS = $(patsubst %.c, %.o, $(SRCS_UGNC))
#
# Add the generated C files to the C_SRCS, so as to let `depend'
# generate correct dependencies for them.
#
C_SRCS += $(SRCS_UGNC)
#
# Add misc .c helper code (used by the frontend.)
#
C_SRCS += parser/ctypes.c parser/hschooks.c parser/hsclink.c \
parser/id.c parser/infix.c parser/main.c parser/printtree.c \
parser/syntax.c parser/type2context.c parser/util.c
C_SRCS += parser/ctypes.c parser/hschooks.c
#
# Big Fudge to get around inherent problem that Makefile setup
......@@ -107,11 +85,6 @@ C_SRCS += parser/ctypes.c parser/hschooks.c parser/hsclink.c \
#
SRC_MKDEPENDC_OPTS += -D__GLASGOW_HASKELL__=$(ProjectVersionInt)
LIBOBJS = \
$(SRCS_UGN_OBJS) parser/hslexer.o parser/hsparser.tab.o \
parser/id.o parser/infix.o parser/syntax.o parser/type2context.o \
parser/util.o parser/ctypes.o
# stuff you get for free in a source distribution
#
# SRC_DIST_FILES += rename/ParseIface.hs \
......@@ -169,35 +142,20 @@ main/CmdLineOpts_HC_OPTS = -fvia-C -K6m
nativeGen/PprMach_HC_OPTS = -K2m
nativeGen/MachMisc_HC_OPTS = -K2m -fvia-C
nativeGen/MachCode_HC_OPTS = -H10m
parser/UgenAll_HC_OPTS = -fvia-C '-\#include"hspincl.h"'
parser/UgenUtil_HC_OPTS = -fvia-C '-\#include"hspincl.h"'
parser/U_binding_HC_OPTS = -fvia-C '-\#include"hspincl.h"'
parser/U_constr_HC_OPTS = -fvia-C '-\#include"hspincl.h"'
parser/U_either_HC_OPTS = -fvia-C '-\#include"hspincl.h"'
parser/U_entidt_HC_OPTS = -fvia-C '-\#include"hspincl.h"'
parser/U_gdexp_HC_OPTS = -fvia-C '-\#include"hspincl.h"'
parser/U_grhsb_HC_OPTS = -fvia-C '-\#include"hspincl.h"'
parser/U_list_HC_OPTS = -fvia-C '-\#include"hspincl.h"'
parser/U_literal_HC_OPTS = -fvia-C '-\#include"hspincl.h"'
parser/U_match_HC_OPTS = -fvia-C '-\#include"hspincl.h"'
parser/U_maybe_HC_OPTS = -fvia-C '-\#include"hspincl.h"'
parser/U_qid_HC_OPTS = -fvia-C '-\#include"hspincl.h"'
parser/U_rulevar_HC_OPTS = -fvia-C '-\#include"hspincl.h"'
parser/U_tree_HC_OPTS = -H12m -fvia-C '-\#include"hspincl.h"'
parser/U_ttype_HC_OPTS = -fvia-C '-\#include"hspincl.h"'
# Avoids Bug in 3.02, it seems
usageSP/UsageSPInf_HC_OPTS = -Onot
prelude/PrimOp_HC_OPTS = -H12m -K3m
reader/Lex_HC_OPTS = -K2m -H16m -fvia-C
# Heap was 6m with 2.10
reader/ReadPrefix_HC_OPTS = -fvia-C '-\#include"hspincl.h"' -H10m
parser/Lex_HC_OPTS = -K2m -H16m -fvia-C
rename/ParseIface_HC_OPTS += -Onot -H45m -dcore-lint -fno-warn-incomplete-patterns
# -dcore-lint is *temporary* to work around ghc space leak.
rename/ParseIface_HC_OPTS += -Onot -H45m -dcore-lint -fno-warn-incomplete-patterns -dcore-lint
rename/ParseIface_HAPPY_OPTS += -g
parser/Parser_HC_OPTS += -Onot -H45m -dcore-lint -fno-warn-incomplete-patterns -dcore-lint
parser/Parser_HAPPY_OPTS += -g
ifeq "$(TARGETPLATFORM)" "hppa1.1-hp-hpux9"
rename/RnMonad_HC_OPTS = -fvia-C -O2 -O2-for-C
endif
......@@ -266,22 +224,12 @@ simplStg/UpdAnal_HC_OPTS = -fno-strictness
# ----------------------------------------------------------------------------
# C compilations
SRC_C_OPTS += -O -Iparser -I. -IcodeGen
SRC_C_OPTS += -O -I. -IcodeGen
# ----------------------------------------------------------------------------
# Parsers/lexers
# Main parser uses Yacc/Bison
SRC_YACC_OPTS += -d -v
# Suppress the generation of a default rule
SRC_FLEX_OPTS += -s
#
# Want to keep the intermediate (included in src distribs).
#
.PRECIOUS: %.tab.c %.tab.h parser/hslexer.c
parser/hschooks.o : parser/hschooks.c
@$(RM) $@
$(HC) -c -o $@ -I$(GHC_INCLUDE_DIR) $(HC_OPTS) parser/hschooks.c
......@@ -295,16 +243,10 @@ rename/ParseIface.hs : rename/ParseIface.y
$(HAPPY) $(HAPPY_OPTS) -g rename/ParseIface.y
@chmod 444 rename/ParseIface.hs
#----------------------------------------------------------------------
#
# Building the stand-alone parser
#
all :: hsp
hsp: parser/printtree.o parser/main.o libhsp.a
$(CC) -o $@ $(CC_OPTS) $^
CLEAN_FILES += hsp
parser/Parser.hs : parser/Parser.y
@$(RM) parser/Parser.hs parser/ParseIface.hinfo
$(HAPPY) $(HAPPY_OPTS) -g parser/Parser.y
@chmod 444 parser/Parser.hs
#-----------------------------------------------------------------------------
# Linking
......@@ -324,7 +266,7 @@ endif
# but put it together with the libraries.
# Also don't want any interface files intstalled
INSTALL_LIBEXECS += hsc hsp
INSTALL_LIBEXECS += hsc
#-----------------------------------------------------------------------------
# depend
......@@ -332,7 +274,7 @@ INSTALL_LIBEXECS += hsc hsp
#
# Before doing `make depend', need to build all derived Haskell source files
#
depend :: $(LOOPS) $(SRCS_UGNHS)
depend :: $(LOOPS)
ifneq "$(GhcWithHscBuiltViaC)" "YES"
depend :: rename/ParseIface.hs
......@@ -341,10 +283,7 @@ endif
#-----------------------------------------------------------------------------
# clean
CLEAN_FILES += $(wildcard */*.$(way_)o */*.$(way_)hi) \
$(SRCS_UGNC) $(SRCS_UGNH) \
$(SRCS_UGNHS)\
parser/hslexer.c parser/hsparser.tab.h parser/hsparser.tab.c
CLEAN_FILES += $(wildcard */*.$(way_)o */*.$(way_)hi)
# Extra tidy, remove the .hc files (if you've got them).
MAINTAINER_CLEAN_FILES += $(wildcard */*.hc)
......@@ -362,27 +301,5 @@ TAGS_C_SRCS=$(strip $(foreach f,$(foreach dir,$(DIRS),$(wildcard $(dir)/*.c)),$(
include $(TOP)/mk/target.mk
parser/%.o : parser/%.c
#
# Special extra dependencies for yukky ugen stuff
#
parser/%.o : parser/%.c $(SRCS_UGNH)
parser/hslexer.o : parser/hslexer.c parser/hsparser.tab.h
parser/hspincl.h : $(SRCS_UGNH)
parser/UgenAll.o : parser/hspincl.h
parser/UgenUtil.o : parser/hspincl.h
parser/U_constr.o : parser/hspincl.h
parser/U_binding.o : parser/hspincl.h
parser/U_pbinding.o : parser/hspincl.h
parser/U_entidt.o : parser/hspincl.h
parser/U_list.o : parser/hspincl.h
parser/U_literal.o : parser/hspincl.h
parser/U_maybe.o : parser/hspincl.h
parser/U_either.o : parser/hspincl.h
parser/U_qid.o : parser/hspincl.h
parser/U_tree.o : parser/hspincl.h
parser/U_ttype.o : parser/hspincl.h
parser/printtree.o : parser/hspincl.h
reader/ReadPrefix.o : parser/hspincl.h
......@@ -342,6 +342,10 @@ pprLit lit
text "out of range",
brackets (ppr range_min <+> text ".."
<+> ppr range_max)])
-- in interface files, parenthesize raw negative ints.
-- this avoids problems like {-1} being interpreted
-- as a comment starter.
| ifaceStyle sty && i < 0 -> parens (integer i)
| otherwise -> integer i
where
......@@ -352,7 +356,8 @@ pprLit lit
MachFloat f | code_style -> ptext SLIT("(StgFloat)") <> rational f
| otherwise -> ptext SLIT("__float") <+> rational f
MachDouble d -> rational d
MachDouble d | ifaceStyle sty && d < 0 -> parens (rational d)
| otherwise -> rational d
MachAddr p | code_style -> ptext SLIT("(void*)") <> integer p
| otherwise -> ptext SLIT("__addr") <+> integer p
......
......@@ -16,7 +16,7 @@ module RdrName (
dummyRdrVarName, dummyRdrTcName,
-- Destruction
rdrNameModule, rdrNameOcc,
rdrNameModule, rdrNameOcc, setRdrNameOcc,
isRdrDataCon, isRdrTyVar, isQual, isUnqual
) where
......@@ -62,6 +62,9 @@ rdrNameModule (RdrName (Qual m) _) = m
rdrNameOcc :: RdrName -> OccName
rdrNameOcc (RdrName _ occ) = occ
setRdrNameOcc :: RdrName -> OccName -> RdrName
setRdrNameOcc (RdrName q _) occ = RdrName q occ
\end{code}
\begin{code}
......
......@@ -21,9 +21,10 @@ module SrcLoc (
mkGeneratedSrcLoc, -- Code generated within the compiler
incSrcLine,
incSrcLine, replaceSrcLine,
srcLocFile -- return the file name part.
srcLocFile, -- return the file name part.
srcLocLine -- return the line part.
) where
#include "HsVersions.h"
......@@ -78,9 +79,15 @@ isNoSrcLoc other = False
srcLocFile :: SrcLoc -> FAST_STRING
srcLocFile (SrcLoc fname _) = fname
srcLocLine :: SrcLoc -> FAST_INT
srcLocLine (SrcLoc _ l) = l
incSrcLine :: SrcLoc -> SrcLoc
incSrcLine (SrcLoc s l) = SrcLoc s (l +# 1#)
incSrcLine loc = loc
replaceSrcLine :: SrcLoc -> FAST_INT -> SrcLoc
replaceSrcLine (SrcLoc s _) l = SrcLoc s l
\end{code}
%************************************************************************
......
......@@ -153,6 +153,17 @@ data HsExpr id pat
(HsExpr id pat) -- expr whose cost is to be measured
\end{code}
These constructors only appear temporarily in the parser.
\begin{code}
| EWildPat -- wildcard
| EAsPat id -- as pattern
(HsExpr id pat)
| ELazyPat (HsExpr id pat) -- ~ pattern
\end{code}
Everything from here on appears only in typechecker output.
\begin{code}
......
......@@ -14,6 +14,8 @@ module CmdLineOpts (
intSwitchSet,
switchIsOn,
src_filename,
-- debugging opts
opt_D_dump_absC,
opt_D_dump_asm,
......@@ -155,6 +157,7 @@ import GlaExts
import Argv
import Constants -- Default values for some flags
import FastString ( headFS )
import Maybes ( assocMaybe, firstJust, maybeToBool )
import Panic ( panic, panic# )
......@@ -282,6 +285,13 @@ unpacked_opts =
-}
\end{code}
\begin{code}
src_filename :: FAST_STRING
src_filename = case argv of
filename : rest | headFS filename /= '-' -> filename
otherwise -> panic "no filename"
\end{code}
\begin{code}
-- debugging opts
opt_D_dump_absC = lookUp SLIT("-ddump-absC")
......
......@@ -12,7 +12,13 @@ import IO ( hPutStr, stderr )
import HsSyn
import BasicTypes ( NewOrData(..) )
import ReadPrefix ( rdModule )
import RdrHsSyn ( RdrNameHsModule )
import FastString ( mkFastCharString, unpackFS )
import StringBuffer ( hGetStringBuffer )
import Parser ( parse )
import Lex ( PState(..), P, ParseResult(..) )
import SrcLoc ( mkSrcLoc )
import Rename ( renameModule )
import MkIface ( startIface, ifaceDecls, endIface )
......@@ -54,6 +60,26 @@ main =
doIt classifyOpts
\end{code}
\begin{code}
parseModule :: IO (ModuleName, RdrNameHsModule)
parseModule = do
buf <- hGetStringBuffer True{-expand tabs-} (unpackFS src_filename)
case parse buf PState{ bol = 0#, atbol = 1#,
context = [], glasgow_exts = glaexts,
loc = mkSrcLoc src_filename 1 } of
PFailed err -> do
printErrs err
ghcExit 1
return (error "parseModule") -- just to get the types right
POk _ m@(HsModule mod _ _ _ _ _) ->
return (mod, m)
where
glaexts | opt_GlasgowExts = 1#
| otherwise = 0#
\end{code}
\begin{code}
doIt :: ([CoreToDo], [StgToDo]) -> IO ()
......@@ -66,7 +92,7 @@ doIt (core_cmds, stg_cmds)
-------------------------- Reader ----------------
show_pass "Reader" >>
_scc_ "Reader"
rdModule >>= \ (mod_name, rdr_module) ->
parseModule >>= \ (mod_name, rdr_module) ->
dumpIfSet opt_D_source_stats "Source Statistics"
(ppSourceStats False rdr_module) >>
......
Return-Path: mattson@dcs.gla.ac.uk
Return-Path: <mattson@dcs.gla.ac.uk>
Received: from starbuck.dcs.gla.ac.uk by goggins.dcs.gla.ac.uk
with LOCAL SMTP (PP) id <02535-0@goggins.dcs.gla.ac.uk>;
Thu, 18 Nov 1993 09:59:57 +0000
To: Robert.Corbett@Eng.Sun.COM
cc: partain@dcs.gla.ac.uk
Subject: Re: [Robert.Corbett@Eng.Sun.COM: Re: possible bug, byacc 1.9]
In-reply-to: Your message from 9:46 AM GMT
Date: Thu, 18 Nov 93 09:59:53 +0000
From: Jim Mattson <mattson@dcs.gla.ac.uk>
It's clear that this feature improves error detection, but it's not
clear to me how it improves the scope of possible error recoveries.
If I understand your explanation, it sounds like the only alternative
(short of changing the byacc source) is to add tens or hundreds of
error productions sprinkled throughout the code anywhere that an
unexpected symbol may appear, since no intervening reductions are
allowed.
Although the addition of all of these error productions increases the
scope of possible error recoveries, the same functionality (with, in fact,
the same approach) is provided by other versions of yacc. The apparent
advantage of other versions of yacc is that they provide a facility by
which a single _default_ error production can handle a number of
possibilities (after some possibly illegal reductions have been performed).
Am I missing something?
--jim
--------
In reply to the following message:
--------
------- Forwarded Message
Date: Wed, 17 Nov 93 22:33:44 PST
From: Robert.Corbett@Eng.Sun.COM (Robert Corbett)
Message-Id: <9311180633.AA07545@lupa.Eng.Sun.COM>
To: partain@dcs.gla.ac.uk
Subject: Re: possible bug, byacc 1.9
It is a feature. One difference between Berkeley Yacc and its
predecessors is that the parsers Berkeley Yacc produces detect
errors as soon as possible. That will lead to different behavior.
In this particular case, the token "IN" is not a permitted
lookahead symbol in state 390. AT&T Yacc parsers will not detect
the error until after doing more reductions than Berkeley Yacc
parsers. Doing reductions in illegal contexts limits the scope of
recoveries that are possible (unless backtracking is possible).
I am sorry that my attempt to provide better error detection is
causing you trouble. You can get the AT&T Yacc behavior by
replacing the routine sole_reduction in mkpar.c with a routine
that returns the most frequently occurring reduction.
Yours truly,
Bob Corbett
- ----- Begin Included Message -----
>From partain@dcs.gla.ac.uk Wed Nov 17 05:03:44 1993
To: robert.corbett@Eng
Subject: possible bug, byacc 1.9
Date: Wed, 17 Nov 93 12:33:42 +0000
From: Will Partain <partain@dcs.gla.ac.uk>
Sadly, it's in a *HUGE* grammar, which I will send you if you have the
stomach for it.
The problem occurs where {Sun's /usr/lang/yacc, bison} say:
state 390
aexp -> var . (rule 356)
aexp -> var . AT aexp (rule 366)
AT shift, and go to state 508
$default reduce using rule 356 (aexp)
but byacc says
state 396
aexp : var . (356)
aexp : var . AT aexp (366)
AT shift 511
error reduce 356
VARID reduce 356
CONID reduce 356
VARSYM reduce 356
CONSYM reduce 356
MINUS reduce 356
INTEGER reduce 356
FLOAT reduce 356
CHAR reduce 356
STRING reduce 356
CHARPRIM reduce 356
INTPRIM reduce 356
FLOATPRIM reduce 356
DOUBLEPRIM reduce 356
CLITLIT reduce 356
VOIDPRIM reduce 356
CCURLY reduce 356
VCCURLY reduce 356
SEMI reduce 356
OBRACK reduce 356
CBRACK reduce 356
OPAREN reduce 356
CPAREN reduce 356
COMMA reduce 356
BQUOTE reduce 356
RARROW reduce 356
VBAR reduce 356
EQUAL reduce 356
DOTDOT reduce 356
DCOLON reduce 356
LARROW reduce 356
WILDCARD reduce 356
LAZY reduce 356
WHERE reduce 356
OF reduce 356
THEN reduce 356
ELSE reduce 356
PLUS reduce 356
The token that comes in is "IN"; bison/sun-yacc-generated parser
tickles the default, reduces to "aexp", but byacc-generated tickles
"error" and the rest is history.
Maybe this is enough for you to exclaim, "Oh yes, that's a feature."
As I say, more info if you want it.
Will Partain
- ----- End Included Message -----
------- End of Forwarded Message
--------
%
% (c) The GRASP/AQUA Project, Glasgow University, 1999
%
\section[ParseUtil]{Parser Utilities}
\begin{code}
module ParseUtil (
parseError -- String -> Pa
, srcParseErr -- StringBuffer -> SrcLoc -> Message
, cbot -- a
, splitForConApp -- RdrNameHsType -> [RdrNameBangType]
-- -> P (RdrName, [RdrNameBangType])
, mkRecConstrOrUpdate -- HsExp -> [HsFieldUpdate] -> P HsExp
, groupBindings
, checkPrec -- String -> P String
, checkCallConv -- FAST_STRING -> P CallConv
, checkContext -- HsType -> P HsContext
, checkInstType -- HsType -> P HsType
, checkAssertion -- HsType -> P HsAsst
, checkDataHeader -- HsQualType -> P (HsContext,HsName,[HsName])
, checkSimple -- HsType -> [HsName] -> P ((HsName,[HsName]))
, checkPattern -- HsExp -> P HsPat
, checkPatterns -- [HsExp] -> P [HsPat]
-- , checkExpr -- HsExp -> P HsExp
, checkValDef -- (SrcLoc, HsExp, HsRhs, [HsDecl]) -> P HsDecl
-- some built-in names (all :: RdrName)
, unitCon_RDR, unitTyCon_RDR, nilCon_RDR, listTyCon_RDR
, tupleCon_RDR, tupleTyCon_RDR, ubxTupleCon_RDR, ubxTupleTyCon_RDR
, funTyCon_RDR
-- pseudo-keywords, in var and tyvar forms (all :: RdrName)
, as_var_RDR, hiding_var_RDR, qualified_var_RDR, forall_var_RDR
, export_var_RDR, label_var_RDR, dynamic_var_RDR, unsafe_var_RDR
, as_tyvar_RDR, hiding_tyvar_RDR, qualified_tyvar_RDR
, export_tyvar_RDR, label_tyvar_RDR, dynamic_tyvar_RDR
, unsafe_tyvar_RDR
, minus_RDR, pling_RDR, dot_RDR
) where
#include "HsVersions.h"
import Lex
import HsSyn
import SrcLoc
import RdrHsSyn
import RdrName
import CallConv
import PrelMods ( pRELUDE_Name, mkUbxTupNameStr, mkTupNameStr )
import OccName ( dataName, tcName, varName, tvName, setOccNameSpace )
import CmdLineOpts ( opt_NoImplicitPrelude )
import StringBuffer ( lexemeToString )
import FastString ( unpackFS )
import ErrUtils
import UniqFM ( UniqFM, listToUFM, lookupUFM )
import Outputable
-----------------------------------------------------------------------------
-- Misc utils
parseError :: String -> P a
parseError s =
getSrcLocP `thenP` \ loc ->
failMsgP (hcat [ppr loc, text ": ", text s])
srcParseErr :: StringBuffer -> SrcLoc -> Message
srcParseErr s l
= hcat [ppr l, ptext SLIT(": parse error on input "),
char '`', text (lexemeToString s), char '\'']
cbot = panic "CCall:result_ty"
-----------------------------------------------------------------------------
-- splitForConApp
-- When parsing data declarations, we sometimes inadvertently parse
-- a constructor application as a type (eg. in data T a b = C a b `D` E a b)
-- This function splits up the type application, adds any pending
-- arguments, and converts the type constructor back into a data constructor.
splitForConApp :: RdrNameHsType -> [RdrNameBangType]
-> P (RdrName, [RdrNameBangType])
splitForConApp t ts = split t ts
where