summaryrefslogtreecommitdiff
path: root/libraries/ghc-boot-th
diff options
context:
space:
mode:
authorBen Gamari <ben@smart-cactus.org>2016-09-01 15:03:46 -0400
committerBen Gamari <ben@smart-cactus.org>2016-09-01 15:03:46 -0400
commitb946cf3f5d6fd273a79b008472e8cb0ad1432be1 (patch)
tree99f4e3c5e556de48cbc596aabc7f10275567266f /libraries/ghc-boot-th
parent8d35e18d885e60f998a9dddb6db19762fe4c6d92 (diff)
downloadhaskell-b946cf3f5d6fd273a79b008472e8cb0ad1432be1.tar.gz
Revert "Fix startsVarSym and refactor operator predicates (fixes #4239)"
This reverts commit 8d35e18d885e60f998a9dddb6db19762fe4c6d92. arc butchered the authorship on this.
Diffstat (limited to 'libraries/ghc-boot-th')
-rw-r--r--libraries/ghc-boot-th/GHC/Lexeme.hs23
1 files changed, 3 insertions, 20 deletions
diff --git a/libraries/ghc-boot-th/GHC/Lexeme.hs b/libraries/ghc-boot-th/GHC/Lexeme.hs
index 2ecee61ea6..677c9a65e6 100644
--- a/libraries/ghc-boot-th/GHC/Lexeme.hs
+++ b/libraries/ghc-boot-th/GHC/Lexeme.hs
@@ -11,31 +11,14 @@
module GHC.Lexeme (
-- * Lexical characteristics of Haskell names
startsVarSym, startsVarId, startsConSym, startsConId,
- startsVarSymASCII, isVarSymChar, okSymChar
+ startsVarSymASCII, isVarSymChar
) where
import Data.Char
--- | Is this character acceptable in a symbol (after the first char)?
--- See alexGetByte in Lexer.x
-okSymChar :: Char -> Bool
-okSymChar c
- | c `elem` "(),;[]`{}_\"'"
- = False
- | otherwise
- = case generalCategory c of
- ConnectorPunctuation -> True
- DashPunctuation -> True
- OtherPunctuation -> True
- MathSymbol -> True
- CurrencySymbol -> True
- ModifierSymbol -> True
- OtherSymbol -> True
- _ -> False
-
startsVarSym, startsVarId, startsConSym, startsConId :: Char -> Bool
-startsVarSym c = okSymChar c && c /= ':' -- Infix Ids
-startsConSym c = c == ':' -- Infix data constructors
+startsVarSym c = startsVarSymASCII c || (ord c > 0x7f && isSymbol c) -- Infix Ids
+startsConSym c = c == ':' -- Infix data constructors
startsVarId c = c == '_' || case generalCategory c of -- Ordinary Ids
LowercaseLetter -> True
OtherLetter -> True -- See #1103