summaryrefslogtreecommitdiff
path: root/compiler/parser/Parser.y
diff options
context:
space:
mode:
Diffstat (limited to 'compiler/parser/Parser.y')
-rw-r--r--compiler/parser/Parser.y8
1 files changed, 8 insertions, 0 deletions
diff --git a/compiler/parser/Parser.y b/compiler/parser/Parser.y
index 21737b46e6..997f497510 100644
--- a/compiler/parser/Parser.y
+++ b/compiler/parser/Parser.y
@@ -259,6 +259,8 @@ from the Haskell98 data constructor for a tuple. Shift resolves in
favor of sysdcon, which is good because a tuple section will get rejected
if -XTupleSections is not specified.
+See also Note [ExplicitTuple] in GHC.Hs.Expr.
+
-------------------------------------------------------------------------------
state 408 contains 1 shift/reduce conflicts.
@@ -2934,6 +2936,9 @@ texp :: { ECP }
amms (mkHsViewPatPV (comb2 $1 $>) $1 $3) [mu AnnRarrow $2] }
-- Always at least one comma or bar.
+-- Though this can parse just commas (without any expressions), it won't
+-- in practice, because (,,,) is parsed as a name. See Note [ExplicitTuple]
+-- in GHC.Hs.Expr.
tup_exprs :: { forall b. DisambECP b => PV ([AddAnn],SumOrTuple b) }
: texp commas_tup_tail
{ runECP_PV $1 >>= \ $1 ->
@@ -2978,6 +2983,7 @@ tup_tail :: { forall b. DisambECP b => PV [Located (Maybe (Located b))] }
-- The rules below are little bit contorted to keep lexps left-recursive while
-- avoiding another shift/reduce-conflict.
+-- Never empty.
list :: { forall b. DisambECP b => SrcSpan -> PV (Located b) }
: texp { \loc -> runECP_PV $1 >>= \ $1 ->
mkHsExplicitListPV loc [$1] }
@@ -3399,6 +3405,7 @@ con_list : con { sL1 $1 [$1] }
| con ',' con_list {% addAnnotation (gl $1) AnnComma (gl $2) >>
return (sLL $1 $> ($1 : unLoc $3)) }
+-- See Note [ExplicitTuple] in GHC.Hs.Expr
sysdcon_nolist :: { Located DataCon } -- Wired in data constructors
: '(' ')' {% ams (sLL $1 $> unitDataCon) [mop $1,mcp $2] }
| '(' commas ')' {% ams (sLL $1 $> $ tupleDataCon Boxed (snd $2 + 1))
@@ -3407,6 +3414,7 @@ sysdcon_nolist :: { Located DataCon } -- Wired in data constructors
| '(#' commas '#)' {% ams (sLL $1 $> $ tupleDataCon Unboxed (snd $2 + 1))
(mo $1:mc $3:(mcommas (fst $2))) }
+-- See Note [Empty lists] in GHC.Hs.Expr
sysdcon :: { Located DataCon }
: sysdcon_nolist { $1 }
| '[' ']' {% ams (sLL $1 $> nilDataCon) [mos $1,mcs $2] }