Merge: src/indexing: Introduces CodeIndex
authorJean Privat <jean@pryen.org>
Wed, 20 Jun 2018 18:59:09 +0000 (14:59 -0400)
committerJean Privat <jean@pryen.org>
Wed, 20 Jun 2018 18:59:09 +0000 (14:59 -0400)
This PR introduces a new Index based on VSM: CodeIndex, which can be used to retrieve pieces of code from a code query.

Model entities are indexed by their ANode and vectorization is based on model usage such as:
* modules importation
* classes spcialization and refinement
* methods calls and refinements

Example:
~~~nit
# Create the index
var index = new CodeIndex(toolcontext)
for mentity in mentities do
  index.index_mentity(mentity)
end

# Match a piece of code
var matches = index.match_code("print \"Hello, World!\"")
for match in matches do
  print match
end
~~~

Pull-Request: #2719


Trivial merge