summaryrefslogtreecommitdiff
path: root/libraries/ghc-boot-th
diff options
context:
space:
mode:
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