summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthías Páll Gissurarson <pallm@chalmers.se>2019-09-24 14:57:24 +0200
committerMatthías Páll Gissurarson <pallm@chalmers.se>2019-09-24 14:57:24 +0200
commit2733cd07b722f1c63f974114fe8544a1fc2775e3 (patch)
tree3da820ae5c9ae29d08c484322620567f116978ea
parentbb2c5cde0c1729bb7c55fcaa8e582f05b6af8320 (diff)
downloadhaskell-2733cd07b722f1c63f974114fe8544a1fc2775e3.tar.gz
Hide new features behind ExtendedTypedHoles extension
-rw-r--r--compiler/main/DynFlags.hs1
-rw-r--r--compiler/parser/Lexer.x18
-rw-r--r--libraries/ghc-boot-th/GHC/LanguageExtensions/Type.hs1
m---------utils/haddock0
4 files changed, 16 insertions, 4 deletions
diff --git a/compiler/main/DynFlags.hs b/compiler/main/DynFlags.hs
index c2d0322cd9..258ecebf8a 100644
--- a/compiler/main/DynFlags.hs
+++ b/compiler/main/DynFlags.hs
@@ -4515,6 +4515,7 @@ xFlagsDeps = [
flagSpec' "TemplateHaskell" LangExt.TemplateHaskell
checkTemplateHaskellOk,
flagSpec "TemplateHaskellQuotes" LangExt.TemplateHaskellQuotes,
+ flagSpec "ExtendedTypedHoles" LangExt.ExtendedTypedHoles,
flagSpec "TraditionalRecordSyntax" LangExt.TraditionalRecordSyntax,
flagSpec "TransformListComp" LangExt.TransformListComp,
flagSpec "TupleSections" LangExt.TupleSections,
diff --git a/compiler/parser/Lexer.x b/compiler/parser/Lexer.x
index 7c250e22bb..cc5878a8e5 100644
--- a/compiler/parser/Lexer.x
+++ b/compiler/parser/Lexer.x
@@ -381,10 +381,18 @@ $tab { warnTab }
"$(" / { ifExtension ThBit } { token ITparenEscape }
"$$(" / { ifExtension ThBit } { token ITparenTyEscape }
- "_(" { token ITopenTypedHole }
- \) $decdigit $decdigit* { skip_one_decimal ITcloseTypedHole }
- "_$(" / { ifExtension ThBit } { token ITopenTypedHoleEscape }
- "_$$(" / { ifExtension ThBit } { token ITopenTypedHoleTyEscape }
+ "_(" / { ifExtension EthBit } { token ITopenTypedHole }
+ \) $decdigit $decdigit*
+ / { ifExtension EthBit }
+ { skip_one_decimal ITcloseTypedHole }
+ "_$("
+ / { ifExtension EthBit `alexAndPred`
+ ifExtension ThBit }
+ { token ITopenTypedHoleEscape }
+ "_$$("
+ / { ifExtension EthBit `alexAndPred`
+ ifExtension ThBit }
+ { token ITopenTypedHoleTyEscape }
"[" @varid "|" / { ifExtension QqBit } { lex_quasiquote_tok }
@@ -2350,6 +2358,7 @@ data ExtBits
| MultiWayIfBit
| GadtSyntaxBit
| ImportQualifiedPostBit
+ | EthBit --Extended typed-holes
-- Flags that are updated once parsing starts
| InRulePragBit
@@ -2437,6 +2446,7 @@ mkParserFlags' warningFlags extensionFlags thisPackage
.|. MultiWayIfBit `xoptBit` LangExt.MultiWayIf
.|. GadtSyntaxBit `xoptBit` LangExt.GADTSyntax
.|. ImportQualifiedPostBit `xoptBit` LangExt.ImportQualifiedPost
+ .|. EthBit `xoptBit` LangExt.ExtendedTypedHoles
optBits =
HaddockBit `setBitIf` isHaddock
.|. RawTokenStreamBit `setBitIf` rawTokStream
diff --git a/libraries/ghc-boot-th/GHC/LanguageExtensions/Type.hs b/libraries/ghc-boot-th/GHC/LanguageExtensions/Type.hs
index ef1d5c9f9f..0305f1f0cb 100644
--- a/libraries/ghc-boot-th/GHC/LanguageExtensions/Type.hs
+++ b/libraries/ghc-boot-th/GHC/LanguageExtensions/Type.hs
@@ -42,6 +42,7 @@ data Extension
| Arrows -- Arrow-notation syntax
| TemplateHaskell
| TemplateHaskellQuotes -- subset of TH supported by stage1, no splice
+ | ExtendedTypedHoles
| QuasiQuotes
| ImplicitParams
| ImplicitPrelude
diff --git a/utils/haddock b/utils/haddock
-Subproject f7aee307c1050244f443c867c14d98ee276b348
+Subproject 75f71980dfcd9a009e2eeb3a8690a473f47fcdf