Verified Commit 96f1ea60 authored by Camil Staps's avatar Camil Staps 🚀

More logical indexing pipeline

parent f700b326
......@@ -88,6 +88,12 @@ derive JSONDecode CloogleEntry
| Builtin !Name ![CleanLangReportLocation] //* A language builtin
| NoLocation //* Only used internally
/**
* Wrapper around {{`Location`}} for use in {{`CloogleDBFactory`}} to avoid
* name clashes with {{`Module`}} in the compiler.
*/
location :: !Library !String !FilePath !LineNr !LineNr !Name -> Location
/**
* Not-type information that is often associated with things that have a type
*/
......
......@@ -145,6 +145,9 @@ where
m [c:p] [x:s] = c == x && m p s
m _ _ = False
location :: !Library !String !FilePath !LineNr !LineNr !Name -> Location
location lib mod fp dcl icl name = Location lib mod fp dcl icl name
instance getLocation FunctionEntry where getLocation fe = Just fe.fe_loc
instance getLocation TypeDefEntry where getLocation tde = Just tde.tde_loc
instance getLocation ModuleEntry where getLocation me = Just me.me_loc
......
......@@ -13,23 +13,45 @@ import CloogleDB
newTemporaryDB :: TemporaryDB
finaliseDB :: ![CloogleEntry] !TemporaryDB -> *CloogleDB
/**
* Something to index (typically, a library).
*/
:: IndexItem =
{ name :: !String //* The name of the library
, fetch_url :: !SourceURL //* Where to find the code to index
, info_url :: !Maybe String //* Where to find more information
, path :: !Maybe String //* The path to the root
, pattern_exclude :: !Maybe [PathPattern] //* Modules to exclude
, pattern_core :: !Maybe [PathPattern] //* Modules that should be marked as core
, pattern_app :: !Maybe [PathPattern] //* Modules that should be marked as app
}
/**
* A place to get a Clean library.
*/
:: SourceURL
= SVN !String
| Git !String
| CleanDistribution !String
/**
* Patterns on file paths.
*/
:: PathPattern
= PStartsWith !String
| PNot !PathPattern
| PWildcard
/**
* Find all modules that could be indexed
*
* @param Excluded modules. If the path contains any of the strings in this
* parameter, a module will not be considered.
* @param The root of the library directory (typically $CLEAN_HOME/lib).
* @param The library to look in.
* @param Some auxiliary value to store with the modules.
* @param A part of the module hierarchy to look for. The empty string to look
* in the whole library, otherwise e.g. Crypto.Hash to only include modules
* in that hierarchy.
* @param The {{`IndexItem`}} to look in.
* @param The base path to look in.
* @param The World.
* @result A list of modules found (library, module, whether it is part of the
* library core, whether it is an app).
* @result A list of modules found.
*/
findModules :: ![String] !String !Library !a !String !*World
-> *(![(Library, Module, a)], !*World)
findModules :: !String !IndexItem !String !*World -> *(![ModuleEntry], !*World)
/**
* Update a database with all the information found in a module
......@@ -37,14 +59,11 @@ findModules :: ![String] !String !Library !a !String !*World
* @param Whether local definitions (that only exist in the icl) should be indexed.
* @param The root of the library directory (typically $CLEAN_HOME/lib).
* @param The module to index.
* @param The library the module to index is in.
* @param A function to update module information (to set me_is_core, me_is_app).
* @param The old database.
* @result The new database.
*/
indexModule :: !Bool !String !Module !Library
!(String ModuleEntry -> ModuleEntry) !TemporaryDB !*World
-> *(!TemporaryDB, !*World)
indexModule :: !Bool !String !ModuleEntry !TemporaryDB !*World -> *(!TemporaryDB, !*World)
:: LocationInModule =
{ dcl_line :: Maybe Int
......
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment