X-Git-Url: https://gerrit.simantics.org/r/gitweb?p=simantics%2Fplatform.git;a=blobdiff_plain;f=bundles%2Forg.simantics.scl.compiler%2Fscl%2FSCL%2FModuleRepository.scl;h=e8d37789b00be77a32ef8cc6306fd6ab8fa6cb16;hp=eceb418be1a70c5a439737888c491681c040c5b9;hb=947cdc62f1d9a353726d29693c339edd1d0cacf6;hpb=7444d4b3a2f3c25fac462d8a168898656dafd52e diff --git a/bundles/org.simantics.scl.compiler/scl/SCL/ModuleRepository.scl b/bundles/org.simantics.scl.compiler/scl/SCL/ModuleRepository.scl index eceb418be..e8d37789b 100644 --- a/bundles/org.simantics.scl.compiler/scl/SCL/ModuleRepository.scl +++ b/bundles/org.simantics.scl.compiler/scl/SCL/ModuleRepository.scl @@ -1,10 +1,19 @@ module { - export = [possibleUnsafeSclValueByName, unsafeSclValueByName, sclModuleNames, moduleByName] + export = [possibleUnsafeSclValueByName, unsafeSclValueByName, sclModuleNames, moduleByName, + documentationOfSCLValue, sclValueRef, possibleModuleSourceText] } include "./CurrentModuleRepository" include "./Module" +importJava "org.simantics.scl.compiler.elaboration.modules.SCLValue" where + data SCLValue + + @JavaName getDocumentation + documentationOfSCLValue_ :: SCLValue -> Maybe String + +documentationOfSCLValue value = fromMaybe "" (documentationOfSCLValue_ value) + importJava "org.simantics.scl.compiler.module.repository.ModuleRepository" where // data ModuleRepository // defined in CurrentModuleRepository @@ -12,6 +21,9 @@ importJava "org.simantics.scl.compiler.module.repository.ModuleRepository" where @JavaName getValue unsafeSclValueByName_ :: ModuleRepository -> String -> a + @JavaName getValueRef + sclValueRef_ :: ModuleRepository -> String -> Maybe SCLValue + @JavaName getSourceRepository moduleSourceRepositoryOf :: ModuleRepository -> ModuleSourceRepository @@ -23,6 +35,9 @@ importJava "org.simantics.scl.compiler.source.repository.ModuleSourceRepository" @JavaName getModuleNames sclModuleNames_ :: ModuleSourceRepository -> [String] + + @JavaName getPossibleSourceText + possibleModuleSourceText_ :: ModuleSourceRepository -> String -> Maybe String importJava "org.simantics.scl.compiler.errors.Failable" where data Failable a @@ -33,6 +48,8 @@ importJava "org.simantics.scl.compiler.errors.Failable" where unsafeSclValueByName :: String -> a unsafeSclValueByName = unsafeSclValueByName_ MODULE_REPOSITORY +sclValueRef name = sclValueRef_ MODULE_REPOSITORY name + possibleUnsafeSclValueByName :: String -> Maybe a possibleUnsafeSclValueByName name = Just (unsafeSclValueByName name) `catch` \(_ :: Exception) -> Nothing @@ -42,4 +59,7 @@ sclModuleNames = sclModuleNames_ (moduleSourceRepositoryOf MODULE_REPOSITORY) moduleByName :: String -> Maybe Module moduleByName name = getResult failable where - failable = moduleByName_ MODULE_REPOSITORY name \ No newline at end of file + failable = moduleByName_ MODULE_REPOSITORY name + +possibleModuleSourceText :: String -> Maybe String +possibleModuleSourceText name = possibleModuleSourceText_ (moduleSourceRepositoryOf MODULE_REPOSITORY) name \ No newline at end of file