summaryrefslogtreecommitdiff
path: root/compiler/parser/Parser.y
diff options
context:
space:
mode:
authorJosh Price <thepig247@gmail.com>2016-05-24 12:35:21 +0200
committerBen Gamari <ben@smart-cactus.org>2016-05-24 13:03:08 +0200
commit8f7d01632cd79957fe42ea37103ca9b91a1c54f5 (patch)
tree79c734d0733bd752f2910c5da6a24e6080d0a6f9 /compiler/parser/Parser.y
parent1bf5c126c028285911138454689ea8068a7f9c37 (diff)
downloadhaskell-8f7d01632cd79957fe42ea37103ca9b91a1c54f5.tar.gz
Add support for unicode TH quotes (#11743)
I've also added cases for `IToparenbar` and `ITcparenbar` (aka banana brackets) to `isUnicode`. Document unicode TH quote alternatives (#11743) Test Plan: ./validate Reviewers: austin, goldfire, bgamari Reviewed By: bgamari Subscribers: thomie, mpickering Differential Revision: https://phabricator.haskell.org/D2185 GHC Trac Issues: #11743
Diffstat (limited to 'compiler/parser/Parser.y')
-rw-r--r--compiler/parser/Parser.y32
1 files changed, 18 insertions, 14 deletions
diff --git a/compiler/parser/Parser.y b/compiler/parser/Parser.y
index 4502dcae26..e1c8559933 100644
--- a/compiler/parser/Parser.y
+++ b/compiler/parser/Parser.y
@@ -464,11 +464,11 @@ output it generates.
DOCSECTION { L _ (ITdocSection _ _) }
-- Template Haskell
-'[|' { L _ (ITopenExpQuote _) }
+'[|' { L _ (ITopenExpQuote _ _) }
'[p|' { L _ ITopenPatQuote }
'[t|' { L _ ITopenTypQuote }
'[d|' { L _ ITopenDecQuote }
-'|]' { L _ ITcloseQuote }
+'|]' { L _ (ITcloseQuote _) }
'[||' { L _ (ITopenTExpQuote _) }
'||]' { L _ ITcloseTExpQuote }
TH_ID_SPLICE { L _ (ITidEscape _) } -- $x
@@ -3206,20 +3206,24 @@ getCTYPEs (L _ (ITctype src)) = src
getStringLiteral l = StringLiteral (getSTRINGs l) (getSTRING l)
isUnicode :: Located Token -> Bool
-isUnicode (L _ (ITforall iu)) = iu == UnicodeSyntax
-isUnicode (L _ (ITdarrow iu)) = iu == UnicodeSyntax
-isUnicode (L _ (ITdcolon iu)) = iu == UnicodeSyntax
-isUnicode (L _ (ITlarrow iu)) = iu == UnicodeSyntax
-isUnicode (L _ (ITrarrow iu)) = iu == UnicodeSyntax
-isUnicode (L _ (ITrarrow iu)) = iu == UnicodeSyntax
-isUnicode (L _ (ITlarrowtail iu)) = iu == UnicodeSyntax
-isUnicode (L _ (ITrarrowtail iu)) = iu == UnicodeSyntax
-isUnicode (L _ (ITLarrowtail iu)) = iu == UnicodeSyntax
-isUnicode (L _ (ITRarrowtail iu)) = iu == UnicodeSyntax
-isUnicode _ = False
+isUnicode (L _ (ITforall iu)) = iu == UnicodeSyntax
+isUnicode (L _ (ITdarrow iu)) = iu == UnicodeSyntax
+isUnicode (L _ (ITdcolon iu)) = iu == UnicodeSyntax
+isUnicode (L _ (ITlarrow iu)) = iu == UnicodeSyntax
+isUnicode (L _ (ITrarrow iu)) = iu == UnicodeSyntax
+isUnicode (L _ (ITrarrow iu)) = iu == UnicodeSyntax
+isUnicode (L _ (ITlarrowtail iu)) = iu == UnicodeSyntax
+isUnicode (L _ (ITrarrowtail iu)) = iu == UnicodeSyntax
+isUnicode (L _ (ITLarrowtail iu)) = iu == UnicodeSyntax
+isUnicode (L _ (ITRarrowtail iu)) = iu == UnicodeSyntax
+isUnicode (L _ (IToparenbar iu)) = iu == UnicodeSyntax
+isUnicode (L _ (ITcparenbar iu)) = iu == UnicodeSyntax
+isUnicode (L _ (ITopenExpQuote _ iu)) = iu == UnicodeSyntax
+isUnicode (L _ (ITcloseQuote iu)) = iu == UnicodeSyntax
+isUnicode _ = False
hasE :: Located Token -> Bool
-hasE (L _ (ITopenExpQuote HasE)) = True
+hasE (L _ (ITopenExpQuote HasE _)) = True
hasE (L _ (ITopenTExpQuote HasE)) = True
hasE _ = False