module DDC.Core.Lite.Profile
( profile
, lexModuleString
, lexExpString)
where
import DDC.Core.Lite.Env
import DDC.Core.Lite.Name
import DDC.Core.Fragment
import DDC.Core.Lexer
import DDC.Data.Token
profile :: Profile Name
profile
= Profile
{ profileName = "Lite"
, profileFeatures = features
, profilePrimDataDefs = primDataDefs
, profilePrimKinds = primKindEnv
, profilePrimTypes = primTypeEnv
, profileTypeIsUnboxed = const False
, profileNameIsHole = Nothing }
features :: Features
features
= Features
{ featuresTrackedEffects = True
, featuresTrackedClosures = True
, featuresFunctionalEffects = True
, featuresFunctionalClosures = True
, featuresEffectCapabilities = False
, featuresPartialPrims = False
, featuresPartialApplication = True
, featuresGeneralApplication = True
, featuresNestedFunctions = True
, featuresDebruijnBinders = True
, featuresUnboundLevel0Vars = False
, featuresUnboxedInstantiation = True
, featuresNameShadowing = False
, featuresUnusedBindings = True
, featuresUnusedMatches = False }
lexModuleString :: String -> Int -> String -> [Token (Tok Name)]
lexModuleString sourceName lineStart str
= map rn $ lexModuleWithOffside sourceName lineStart str
where rn (Token strTok sp)
= case renameTok readName strTok of
Just t' -> Token t' sp
Nothing -> Token (KJunk "lexical error") sp
lexExpString :: String -> Int -> String -> [Token (Tok Name)]
lexExpString sourceName lineStart str
= map rn $ lexExp sourceName lineStart str
where rn (Token strTok sp)
= case renameTok readName strTok of
Just t' -> Token t' sp
Nothing -> Token (KJunk "lexical error") sp