module GHC.Lexeme (
startsVarSym, startsVarId, startsConSym, startsConId,
startsVarSymASCII, isVarSymChar
) where
import Data.Char
startsVarSym, startsVarId, startsConSym, startsConId :: Char -> Bool
startsVarSym c = startsVarSymASCII c || (ord c > 0x7f && isSymbol c)
startsConSym c = c == ':'
startsVarId c = c == '_' || case generalCategory c of
LowercaseLetter -> True
OtherLetter -> True
_ -> False
startsConId c = isUpper c || c == '('
startsVarSymASCII :: Char -> Bool
startsVarSymASCII c = c `elem` "!#$%&*+./<=>?@\\^|~-"
isVarSymChar :: Char -> Bool
isVarSymChar c = c == ':' || startsVarSym c