mirror of
https://github.com/carp-lang/Carp.git
synced 2024-09-11 05:25:28 +03:00
parent
e42922e96e
commit
ce69cec245
10
src/Env.hs
10
src/Env.hs
@ -85,6 +85,16 @@ envBindingNames = concatMap select . envBindings
|
||||
select (Binder _ (XObj (Mod m) _ _)) = envBindingNames m
|
||||
select (Binder _ obj) = [getName obj]
|
||||
|
||||
envPublicBindingNames :: Env -> [String]
|
||||
envPublicBindingNames = concatMap select . envBindings
|
||||
where
|
||||
select :: Binder -> [String]
|
||||
select (Binder _ (XObj (Mod m) _ _)) = envPublicBindingNames m
|
||||
select (Binder meta obj) =
|
||||
if metaIsTrue meta "private" || metaIsTrue meta "hidden"
|
||||
then []
|
||||
else [getName obj]
|
||||
|
||||
-- | Recursively look through all environments for (def ...) forms.
|
||||
findAllGlobalVariables :: Env -> [Binder]
|
||||
findAllGlobalVariables env =
|
||||
|
12
src/Repl.hs
12
src/Repl.hs
@ -27,7 +27,7 @@ import System.Exit (exitSuccess)
|
||||
|
||||
completeKeywordsAnd :: Context -> String -> [Completion]
|
||||
completeKeywordsAnd context word =
|
||||
findKeywords word (envBindingNames (contextGlobalEnv context) ++ keywords) []
|
||||
findKeywords word (envPublicBindingNames (contextGlobalEnv context) ++ keywords) []
|
||||
where
|
||||
findKeywords _ [] res = res
|
||||
findKeywords match (x : xs) res =
|
||||
@ -35,15 +35,7 @@ completeKeywordsAnd context word =
|
||||
then findKeywords match xs (res ++ [simpleCompletion x])
|
||||
else findKeywords match xs res
|
||||
keywords =
|
||||
[ "Int", -- we should probably have a list of those somewhere
|
||||
"Float",
|
||||
"Double",
|
||||
"Bool",
|
||||
"String",
|
||||
"Char",
|
||||
"Array",
|
||||
"Fn",
|
||||
"def",
|
||||
[ "def",
|
||||
"defn",
|
||||
"let",
|
||||
"do",
|
||||
|
Loading…
Reference in New Issue
Block a user