nit.git
5 years agolibevent: rename `bind_to` to the more precise `bind_tcp`
Alexis Laferrière [Wed, 18 Jul 2018 18:20:39 +0000 (14:20 -0400)]
libevent: rename `bind_to` to the more precise `bind_tcp`

Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>

5 years agolibevent: code style tweaks and cleanup
Alexis Laferrière [Wed, 18 Jul 2018 18:05:43 +0000 (14:05 -0400)]
libevent: code style tweaks and cleanup

Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>

5 years agolibevent: add UNIX domain socket support to addrin_to_address
Alexis Laferrière [Wed, 18 Jul 2018 18:06:59 +0000 (14:06 -0400)]
libevent: add UNIX domain socket support to addrin_to_address

Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>

5 years agolibevent: add UNIX domain socket support to libevent
Matthieu Le Guellaut [Mon, 4 Jun 2018 15:01:03 +0000 (11:01 -0400)]
libevent: add UNIX domain socket support to libevent

Signed-off-by: Matthieu Le Guellaut <leguellaut.matthieu@gmail.com>
Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>

5 years agoMerge: src/model/model_index: model index uses BKTree
Jean Privat [Thu, 5 Jul 2018 12:22:25 +0000 (08:22 -0400)]
Merge: src/model/model_index: model index uses BKTree

This PR makes ModelIndex use a BKTree (#2718) to speed up Nitweb name similarity search queries on large code corpora.

Levenstein names comparison with 300k+ entities took a bit long (up to 10s for Nitweb with `contrib` and `src` for some queries). The use of BKTree speeds things up and brings those queries under 0.1s.

Pull-Request: #2724
Reviewed-by: Jean Privat <jean@pryen.org>

5 years agonitweb: compute model index at startup
Alexandre Terrasa [Thu, 14 Jun 2018 19:57:22 +0000 (15:57 -0400)]
nitweb: compute model index at startup

Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>

5 years agosrc/model/model_index: fix tests
Alexandre Terrasa [Thu, 14 Jun 2018 20:20:12 +0000 (16:20 -0400)]
src/model/model_index: fix tests

Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>

5 years agosrc/model/model_index: use BKTree for similarity matches
Alexandre Terrasa [Thu, 14 Jun 2018 19:53:08 +0000 (15:53 -0400)]
src/model/model_index: use BKTree for similarity matches

Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>

5 years agosrc/model/model_index: name and full_name queries does not search prefix by default
Alexandre Terrasa [Thu, 14 Jun 2018 17:27:01 +0000 (13:27 -0400)]
src/model/model_index: name and full_name queries does not search prefix by default

Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>

5 years agosrc/test_model_index: add query time in interactive mode
Alexandre Terrasa [Thu, 14 Jun 2018 16:53:42 +0000 (12:53 -0400)]
src/test_model_index: add query time in interactive mode

Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>

5 years agosrc/test_model_index: add interactive mode
Alexandre Terrasa [Thu, 14 Jun 2018 16:34:01 +0000 (12:34 -0400)]
src/test_model_index: add interactive mode

Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>

5 years agosrc/test_model_index: expect `-q` option for query
Alexandre Terrasa [Thu, 14 Jun 2018 16:20:17 +0000 (12:20 -0400)]
src/test_model_index: expect `-q` option for query

Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>

5 years agoMerge: src/doc/commands: clean commands hierarchy
Jean Privat [Tue, 26 Jun 2018 13:30:47 +0000 (09:30 -0400)]
Merge: src/doc/commands: clean commands hierarchy

This PR does some cleaning around commands hierarchy to prepare for the merge with new-markdown (#2720).

Pull-Request: #2723

5 years agoMerge: src/doc/commands: use filters
Jean Privat [Tue, 26 Jun 2018 13:29:48 +0000 (09:29 -0400)]
Merge: src/doc/commands: use filters

This PR allows the DocCommands to use ModelFilter.

With this, one can setup the filter used by a command from:
* The commands programmatic Nit interface
   ~~~nit
   var filter = new ModelFilter(accept_test = false)
   var cmd = new CmdParents(model, main, filter, mentity_name = "MyEntity")
   ~~~
* The string interface through the CommandParser
   ~~~raw
   [[parents: MyEntity | no-test]]
   ~~~
* The HTTP interface
   ~~~raw
   /children/MyEntity?no-test=true
   ~~~

Pull-Request: #2722
Reviewed-by: Jean Privat <jean@pryen.org>

5 years agoMerge: lib/markdown2: introduce a new Markdown engine
Jean Privat [Tue, 26 Jun 2018 13:28:20 +0000 (09:28 -0400)]
Merge: lib/markdown2: introduce a new Markdown engine

This PR introduces a new Markdown engine called `markdown2`.

The current Markdown implementation is functional but does not follows the [CommonMark](http://commonmark.org/) specification as it passes only 273 tests of the 627 from the [CommonMark test suite](https://github.com/CommonMark/CommonMark).

Also there is a few issues with it as stated in #791, #1394, #1525 and #2507.

This new implementation aims at resolving these issues and follow the CommonMark specification.

Features:
* Markdown AST creation and rendering
* Rendering to HTML
* Rendering to Markdown
* Rendering to Man format
* Rendering to LaTeX
* Parsing of Github extended mode
* Parsing of wikilinks
* Parsing of LaTeX/Maths expression (upcoming in next PR)
* Respect of the CommonMark specification with only 10 tests failed (UTF-8 related)
* Extensive testing with a total of 980 test units...

I didn't remove the old markdown implementation since the benchmarks are not really good for now. Since `markdown2` uses a lot of regular expressions, performances can be an issue compared to `markdown`:

![screenshot from 2018-06-20 19 21 08](https://user-images.githubusercontent.com/583144/41689548-1a8bc5d0-74bf-11e8-899e-52b0eb093d57.png)

In the following PR some Nit tools will be migrated to the new implementation:
* nitunit
* nitiwiki
* nitdoc
* nitweb

Pull-Request: #2720

5 years agosrc/doc/commands/templates: move `commands_json` to `json_commands`
Alexandre Terrasa [Fri, 22 Jun 2018 04:05:13 +0000 (00:05 -0400)]
src/doc/commands/templates: move `commands_json` to `json_commands`

Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>

5 years agosrc/doc/commands/templates: move `commands_json` to `json_commands`
Alexandre Terrasa [Fri, 22 Jun 2018 04:01:30 +0000 (00:01 -0400)]
src/doc/commands/templates: move `commands_json` to `json_commands`

Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>

5 years agosrc/doc/commands/templates: move `commands_html` to `html_commands`
Alexandre Terrasa [Fri, 22 Jun 2018 03:59:09 +0000 (23:59 -0400)]
src/doc/commands/templates: move `commands_html` to `html_commands`

Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>

5 years agosrc/doc/commands/templates: rename `templates_json` in `json_model`
Alexandre Terrasa [Fri, 22 Jun 2018 03:54:06 +0000 (23:54 -0400)]
src/doc/commands/templates: rename `templates_json` in `json_model`

Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>

5 years agosrc/doc/commands/templates: rename `templates_term` in `term_model`
Alexandre Terrasa [Fri, 22 Jun 2018 03:49:38 +0000 (23:49 -0400)]
src/doc/commands/templates: rename `templates_term` in `term_model`

Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>

5 years agosrc/doc/commands/templates: rename `templates_html` in `html_model`
Alexandre Terrasa [Fri, 22 Jun 2018 03:48:20 +0000 (23:48 -0400)]
src/doc/commands/templates: rename `templates_html` in `html_model`

Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>

5 years agosrc/doc/commands: clean `commands_docdown`
Alexandre Terrasa [Tue, 12 Jun 2018 16:23:39 +0000 (12:23 -0400)]
src/doc/commands: clean `commands_docdown`

Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>

5 years agosrc/doc/commands: move cmd processing to `commands_html`
Alexandre Terrasa [Tue, 12 Jun 2018 16:07:28 +0000 (12:07 -0400)]
src/doc/commands: move cmd processing to `commands_html`

Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>

5 years agosrc/doc/commands: merge `doc_down` intro `templates_html`
Alexandre Terrasa [Tue, 12 Jun 2018 16:02:28 +0000 (12:02 -0400)]
src/doc/commands: merge `doc_down` intro `templates_html`

Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>

5 years agosrc/doc/commands: move markdown related services from `doc_down` to `commands_md`
Alexandre Terrasa [Tue, 12 Jun 2018 15:54:49 +0000 (11:54 -0400)]
src/doc/commands: move markdown related services from `doc_down` to `commands_md`

Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>

5 years agosrc/doc/commands: merge `catalog_json` intro `templates_json`
Alexandre Terrasa [Tue, 12 Jun 2018 15:41:59 +0000 (11:41 -0400)]
src/doc/commands: merge `catalog_json` intro `templates_json`

Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>

5 years agosrc/doc/commands: clean commands modules importation
Alexandre Terrasa [Tue, 12 Jun 2018 15:37:14 +0000 (11:37 -0400)]
src/doc/commands: clean commands modules importation

Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>

5 years agosrc/doc/commands: move `render_code` to clients modules
Alexandre Terrasa [Tue, 12 Jun 2018 15:25:31 +0000 (11:25 -0400)]
src/doc/commands: move `render_code` to clients modules

Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>

5 years agosrc/doc/commands: refactor `CmdCode` and `CmdEntityCode`
Alexandre Terrasa [Tue, 12 Jun 2018 15:17:48 +0000 (11:17 -0400)]
src/doc/commands: refactor `CmdCode` and `CmdEntityCode`

Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>

5 years agosrc/doc/commands: redef `render_comment` in `commands_html` and `commands_md`
Alexandre Terrasa [Sun, 10 Jun 2018 23:19:40 +0000 (19:19 -0400)]
src/doc/commands: redef `render_comment` in `commands_html` and `commands_md`

Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>

5 years agosrc/doc/templates: move `html_list_item` to `static_cards`
Alexandre Terrasa [Sun, 10 Jun 2018 23:03:33 +0000 (19:03 -0400)]
src/doc/templates: move `html_list_item` to `static_cards`

Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>

5 years agosrc/doc/doc_down: move base MDoc services to `mdoc` module
Alexandre Terrasa [Sun, 10 Jun 2018 22:47:50 +0000 (18:47 -0400)]
src/doc/doc_down: move base MDoc services to `mdoc` module

Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>

5 years agolib/html: escape Bootstrap links titles
Alexandre Terrasa [Sun, 10 Jun 2018 22:44:07 +0000 (18:44 -0400)]
lib/html: escape Bootstrap links titles

Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>

5 years agosrc/doc/commands: clean importation for `commands_base`
Alexandre Terrasa [Tue, 12 Jun 2018 14:59:31 +0000 (10:59 -0400)]
src/doc/commands: clean importation for `commands_base`

Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>

5 years agobenchmarks/markdown: add benches for markdown2
Alexandre Terrasa [Wed, 20 Jun 2018 15:15:15 +0000 (11:15 -0400)]
benchmarks/markdown: add benches for markdown2

Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>

5 years agolib/markdown2: introduce `nitmd` client
Alexandre Terrasa [Wed, 30 May 2018 02:38:52 +0000 (22:38 -0400)]
lib/markdown2: introduce `nitmd` client

Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>

5 years agolib/markdown2: introduce wikilinks parsing
Alexandre Terrasa [Wed, 30 May 2018 00:02:24 +0000 (20:02 -0400)]
lib/markdown2: introduce wikilinks parsing

Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>

5 years agolib/markdown2: introduce Github extended mode
Alexandre Terrasa [Wed, 30 May 2018 02:15:16 +0000 (22:15 -0400)]
lib/markdown2: introduce Github extended mode

Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>

5 years agolib/markdown2: introduce markdown rendering to LaTeX
Alexandre Terrasa [Tue, 29 May 2018 23:55:58 +0000 (19:55 -0400)]
lib/markdown2: introduce markdown rendering to LaTeX

Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>

5 years agocmd/commands_http: parse filter options from HttpRequest
Alexandre Terrasa [Tue, 15 May 2018 17:57:20 +0000 (13:57 -0400)]
cmd/commands_http: parse filter options from HttpRequest

Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>

5 years agocmd/commands_http: clean Bool options handling
Alexandre Terrasa [Tue, 15 May 2018 17:44:02 +0000 (13:44 -0400)]
cmd/commands_http: clean Bool options handling

Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>

5 years agocmd/commands_http: clean Int options handling
Alexandre Terrasa [Tue, 15 May 2018 17:43:34 +0000 (13:43 -0400)]
cmd/commands_http: clean Int options handling

Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>

5 years agocmd/commands_http: clean String options handling
Alexandre Terrasa [Tue, 15 May 2018 17:43:17 +0000 (13:43 -0400)]
cmd/commands_http: clean String options handling

Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>

5 years agocmd/cmd_parser: parse filter options from cmd string
Alexandre Terrasa [Tue, 15 May 2018 16:52:04 +0000 (12:52 -0400)]
cmd/cmd_parser: parse filter options from cmd string

Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>

5 years agocmd/cmd_parser: clean Bool options handling
Alexandre Terrasa [Tue, 15 May 2018 15:46:04 +0000 (11:46 -0400)]
cmd/cmd_parser: clean Bool options handling

Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>

5 years agocmd/cmd_parser: clean Int options handling
Alexandre Terrasa [Tue, 15 May 2018 15:42:45 +0000 (11:42 -0400)]
cmd/cmd_parser: clean Int options handling

Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>

5 years agocmd/cmd_parser: clean String options handling
Alexandre Terrasa [Tue, 15 May 2018 14:03:13 +0000 (10:03 -0400)]
cmd/cmd_parser: clean String options handling

Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>

5 years agocmd/cmd_parser: remove ModelFilter parameter from init
Alexandre Terrasa [Tue, 15 May 2018 17:27:55 +0000 (13:27 -0400)]
cmd/cmd_parser: remove ModelFilter parameter from init

Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>

5 years agodoc/commands: test commands with filters
Alexandre Terrasa [Tue, 15 May 2018 16:51:48 +0000 (12:51 -0400)]
doc/commands: test commands with filters

Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>

5 years agolib/markdown2: introduce markdown rendering to Manpages
Alexandre Terrasa [Tue, 29 May 2018 23:54:13 +0000 (19:54 -0400)]
lib/markdown2: introduce markdown rendering to Manpages

Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>

5 years agolib/markdown2: introduce markdown rendering to markdown
Alexandre Terrasa [Tue, 29 May 2018 23:55:11 +0000 (19:55 -0400)]
lib/markdown2: introduce markdown rendering to markdown

Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>

5 years agolib/markdown2: import tests from CommonMark spec
Alexandre Terrasa [Tue, 29 May 2018 23:56:40 +0000 (19:56 -0400)]
lib/markdown2: import tests from CommonMark spec

Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>

5 years agolib/markdown2: import tests from DaringFireball
Alexandre Terrasa [Wed, 30 May 2018 00:48:19 +0000 (20:48 -0400)]
lib/markdown2: import tests from DaringFireball

Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>

5 years agolib/markdown2: add tests from issues
Alexandre Terrasa [Wed, 30 May 2018 00:48:40 +0000 (20:48 -0400)]
lib/markdown2: add tests from issues

Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>

5 years agolib/markdown2: introduce markdown rendering to HTML
Alexandre Terrasa [Tue, 29 May 2018 23:52:35 +0000 (19:52 -0400)]
lib/markdown2: introduce markdown rendering to HTML

Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>

5 years agolib/markdown2: introduce markdown rendering interfaces
Alexandre Terrasa [Tue, 29 May 2018 23:57:20 +0000 (19:57 -0400)]
lib/markdown2: introduce markdown rendering interfaces

Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>

5 years agolib/markdown2: add tests for markdown nodes location
Alexandre Terrasa [Wed, 30 May 2018 00:49:28 +0000 (20:49 -0400)]
lib/markdown2: add tests for markdown nodes location

Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>

5 years agolib/markdown2: introduce markdown base test services
Alexandre Terrasa [Wed, 30 May 2018 00:48:05 +0000 (20:48 -0400)]
lib/markdown2: introduce markdown base test services

Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>

5 years agolib/markdown2: introduce markdown block parser
Alexandre Terrasa [Tue, 29 May 2018 23:51:24 +0000 (19:51 -0400)]
lib/markdown2: introduce markdown block parser

Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>

5 years agolib/markdown2: introduce markdown AST inline parser
Alexandre Terrasa [Tue, 29 May 2018 23:51:14 +0000 (19:51 -0400)]
lib/markdown2: introduce markdown AST inline parser

Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>

5 years agolib/markdown2: introduce markdown AST nodes
Alexandre Terrasa [Fri, 18 May 2018 17:52:06 +0000 (13:52 -0400)]
lib/markdown2: introduce markdown AST nodes

Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>

5 years agoMerge: nitdoc: full rewrite
Jean Privat [Wed, 20 Jun 2018 18:59:16 +0000 (14:59 -0400)]
Merge: nitdoc: full rewrite

This PR introduces a new version of Nitdoc based on DocCommands.
The main objective is to unify the display with `nitweb`.
Beside a cleaner implementation and the removal of a lot of code here a quick presentation of the new tool.

### Replace Overview page by Nit Catalog

Avoiding the clutter of the old overview page.

![home](https://user-images.githubusercontent.com/583144/40859182-df1db392-65ae-11e8-82d6-8abd1708722e.png)

This closes #1516

### New packages pages

Package READMEs are now rendered with support of `[[doc commands]]`

![screenshot from 2018-06-01 15 19 10](https://user-images.githubusercontent.com/583144/40859246-263b4a14-65af-11e8-9fe8-4806fedc4a2a.png)

### Simplified modules pages

The modules pages offer a simplified view of its content with introduced and redefined classes:

![screenshot from 2018-06-01 15 23 28](https://user-images.githubusercontent.com/583144/40859466-ed481434-65af-11e8-8c06-88d8b50b17e2.png)

### Module code view

The source code of a module can be viewed directly in the documentation:

![screenshot from 2018-06-01 15 25 12](https://user-images.githubusercontent.com/583144/40860212-9bca9192-65b2-11e8-9115-a623a3d9f026.png)

Entities in the source code can be clicked to access the related documentation page.
This closes #953.

### Class & property linearization

In the new nitdoc, I totally removed the concept of definition pages. Thus no more page for a MClassDef or a MPropDef.

Instead we present the linearization of a MClass or MProperty like in nitweb.

![screenshot from 2018-06-01 15 27 53](https://user-images.githubusercontent.com/583144/40859654-89aa4cca-65b0-11e8-9e2a-0f710a9186ea.png)

There is now a simple rule for where a click on a class or property will land:
* If the user clicks on an introduction, the target page is the documentation of the class or property (the intro def)
* If the user clicks on a redefinition, the target is the definition card in the linearization list.

Beside in the linearization lists, there is only two places where you can find a link to a redefinition:
* in the **Redefined classes** of a module page (tab #doc)
* in the **Redefined properties** of a class page (tab #doc)

Here also, the code is linked to the documentation.

I applied heuristics that disable the linearization lists for:
* `Sys`
* `Object::SELF`
* `Object::init`
* `Object::to_s`

This closes #1563.

### Better quicksearch results

In order to close #361, I added an heuristic to place the packages and modules on top of the list depending on the query.

If the query has a better matches with properties, they will be presented in top, here an example for the query `pop`:

![screenshot from 2018-06-01 15 36 44](https://user-images.githubusercontent.com/583144/40859970-9a7a4ce8-65b1-11e8-9a84-c6fc83886e96.png)

The `pop` first matches `pop` and `popup` then we presents the packages and modules `popcorn`.

For the query `popc`:

![screenshot from 2018-06-01 15 37 57](https://user-images.githubusercontent.com/583144/40860045-e0eea2dc-65b1-11e8-90d1-5f233ce7d204.png)

We directly show the matches for the packages and modules (same behavior than before).

### Redesign

The new design (imported from nitweb) add a lot of free spaces for future PR like example suggestions, doc generation, call graphs etc.

We can benefit from the tabbed view to add new content (like in nitweb with the license et contrib rules for examples).
We can also use the space under the documentation to introduce examples and other things.

### Regressions

The only regression is the disappearance of concerns sections. I'm working on it with new doc commands.

Final note, it also closes #962.

Pull-Request: #2707

5 years agoMerge: Windows: fix bootstrap
Jean Privat [Wed, 20 Jun 2018 18:59:15 +0000 (14:59 -0400)]
Merge: Windows: fix bootstrap

It looks like the use of the method `is_tty` in Nit tools triggered the FFI compilation of the `posix` module which fails on Windows. This module imports some headers that are unavailable in the msys2 environment, as used by our test servers.

Pull-Request: #2711
Reviewed-by: Lucas Bajolet <r4pass@hotmail.com>

5 years agoMerge: nitweb: show full name in mentities cards
Jean Privat [Wed, 20 Jun 2018 18:59:13 +0000 (14:59 -0400)]
Merge: nitweb: show full name in mentities cards

This PR shows the full name of a MEntity in all Nitweb cards.

Example:

![screenshot from 2018-06-14 15 10 19](https://user-images.githubusercontent.com/583144/41432831-1fde1be8-6fe5-11e8-88b8-149f3aa86bb6.png)

Closes #2365.

Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>

Pull-Request: #2716

5 years agoMerge: nitweb: fix access to query results count
Jean Privat [Wed, 20 Jun 2018 18:59:12 +0000 (14:59 -0400)]
Merge: nitweb: fix access to query results count

This PR replaces accesses to key `total` by `count` in all Nitweb views.

So the display in not broken.

Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>

Pull-Request: #2717

5 years agoMerge: lib/trees: introduce BKTree
Jean Privat [Wed, 20 Jun 2018 18:59:11 +0000 (14:59 -0400)]
Merge: lib/trees: introduce BKTree

This PR introduces a new kind of tree: the BKTree.

This data structure can be used to speed-up the comparison of a string and a collection of strings with Levenshtein distance.

See https://dl.acm.org/citation.cfm?id=362003.362025 for more details.

Pull-Request: #2718

5 years agoMerge: src/indexing: Introduces CodeIndex
Jean Privat [Wed, 20 Jun 2018 18:59:09 +0000 (14:59 -0400)]
Merge: src/indexing: Introduces CodeIndex

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

5 years agosrc/indexing: introduce `code_index`
Alexandre Terrasa [Tue, 19 Jun 2018 20:07:44 +0000 (16:07 -0400)]
src/indexing: introduce `code_index`

Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>

5 years agolib/vsm: default tfidf values are extracted from terms frequencies
Alexandre Terrasa [Tue, 19 Jun 2018 20:07:07 +0000 (16:07 -0400)]
lib/vsm: default tfidf values are extracted from terms frequencies

Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>

5 years agolib/vsm: factorize term increments
Alexandre Terrasa [Tue, 19 Jun 2018 20:06:28 +0000 (16:06 -0400)]
lib/vsm: factorize term increments

Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>

5 years agolib/vsm: speedup matches using a reverse index
Alexandre Terrasa [Tue, 19 Jun 2018 20:10:01 +0000 (16:10 -0400)]
lib/vsm: speedup matches using a reverse index

Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>

5 years agolib/vsm: make documents kind customizable
Alexandre Terrasa [Tue, 15 May 2018 23:04:13 +0000 (19:04 -0400)]
lib/vsm: make documents kind customizable

Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>

5 years agolib/trees: introduce BKTree
Alexandre Terrasa [Thu, 14 Jun 2018 17:30:04 +0000 (13:30 -0400)]
lib/trees: introduce BKTree

Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>

5 years agodoc/commands: remove default filter from tests
Alexandre Terrasa [Tue, 15 May 2018 13:38:51 +0000 (09:38 -0400)]
doc/commands: remove default filter from tests

Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>

5 years agocmd/cmd_catalog: use filter
Alexandre Terrasa [Tue, 15 May 2018 16:51:10 +0000 (12:51 -0400)]
cmd/cmd_catalog: use filter

Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>

5 years agomodel_index: use filter
Alexandre Terrasa [Tue, 15 May 2018 16:50:31 +0000 (12:50 -0400)]
model_index: use filter

Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>

5 years agomodel_filters: allow copy of filter options
Alexandre Terrasa [Tue, 15 May 2018 16:50:11 +0000 (12:50 -0400)]
model_filters: allow copy of filter options

Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>

5 years agomodel_filters: make all options writable
Alexandre Terrasa [Tue, 15 May 2018 16:49:55 +0000 (12:49 -0400)]
model_filters: make all options writable

Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>

5 years agomodel_collect: fix MClass ancestors and descendants access
Alexandre Terrasa [Tue, 15 May 2018 15:47:34 +0000 (11:47 -0400)]
model_collect: fix MClass ancestors and descendants access

So filters will work.

Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>

5 years agonitweb: fix access to query results count
Alexandre Terrasa [Thu, 14 Jun 2018 19:04:38 +0000 (15:04 -0400)]
nitweb: fix access to query results count

Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>

5 years agonitweb: show full name in mentities cards
Alexandre Terrasa [Thu, 14 Jun 2018 19:04:31 +0000 (15:04 -0400)]
nitweb: show full name in mentities cards

Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>

5 years agolib/github: fix README commands
Alexandre Terrasa [Fri, 1 Jun 2018 16:04:16 +0000 (12:04 -0400)]
lib/github: fix README commands

Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>

5 years agoMakefile: update rules for the new nitdoc
Alexandre Terrasa [Fri, 1 Jun 2018 17:27:48 +0000 (13:27 -0400)]
Makefile: update rules for the new nitdoc

Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>

5 years agotests: update tests for the new nitdoc
Alexandre Terrasa [Fri, 1 Jun 2018 19:06:53 +0000 (15:06 -0400)]
tests: update tests for the new nitdoc

Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>

5 years agonitdoc: full rewrite of the nitdoc engine
Alexandre Terrasa [Fri, 1 Jun 2018 15:05:11 +0000 (11:05 -0400)]
nitdoc: full rewrite of the nitdoc engine

Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>

5 years agosrc/doc/templates: add template for the Person class from the nit catalog
Alexandre Terrasa [Sat, 2 Jun 2018 16:11:52 +0000 (12:11 -0400)]
src/doc/templates: add template for the Person class from the nit catalog

Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>

5 years agosrc/doc/templates: protect access to nullable signatures
Alexandre Terrasa [Sat, 2 Jun 2018 16:11:21 +0000 (12:11 -0400)]
src/doc/templates: protect access to nullable signatures

Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>

5 years agosrc/doc/commands: CmdRedefs to return definitions instead of intros
Alexandre Terrasa [Fri, 1 Jun 2018 16:08:16 +0000 (12:08 -0400)]
src/doc/commands: CmdRedefs to return definitions instead of intros

Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>

5 years agosrc/doc_down: save headlines from InlineDecorator
Alexandre Terrasa [Fri, 1 Jun 2018 16:04:32 +0000 (12:04 -0400)]
src/doc_down: save headlines from InlineDecorator

So it can be used to generate Markdown summaries

Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>

5 years agosrc/catalog: export package stats to map
Alexandre Terrasa [Fri, 1 Jun 2018 15:06:28 +0000 (11:06 -0400)]
src/catalog: export package stats to map

Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>

5 years agosrc/nitdoc: remove old nitdoc
Alexandre Terrasa [Tue, 19 Dec 2017 18:34:00 +0000 (13:34 -0500)]
src/nitdoc: remove old nitdoc

Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>

5 years agosrc/doc/api: add links to renderer code
Alexandre Terrasa [Fri, 1 Jun 2018 16:38:35 +0000 (12:38 -0400)]
src/doc/api: add links to renderer code

Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>

5 years agogit: ignore .exe versions of bootstrap compilers
Alexis Laferrière [Fri, 8 Jun 2018 02:23:34 +0000 (22:23 -0400)]
git: ignore .exe versions of bootstrap compilers

Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>

5 years agowindows: skip more tests failing in separate compilation mode
Alexis Laferrière [Thu, 7 Jun 2018 19:42:08 +0000 (15:42 -0400)]
windows: skip more tests failing in separate compilation mode

Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>

5 years agoMerge: nitce: do not forgot to autoadapt in native_array_instance
Jean Privat [Fri, 8 Jun 2018 22:42:36 +0000 (18:42 -0400)]
Merge: nitce: do not forgot to autoadapt in native_array_instance

This fix test_new_native.nit with a more strict compiler

Pull-Request: #2715

5 years agoMerge: nitc: intro hidden option to compile to a shared native lib (.so/.dll)
Jean Privat [Fri, 8 Jun 2018 22:42:35 +0000 (18:42 -0400)]
Merge: nitc: intro hidden option to compile to a shared native lib (.so/.dll)

Add the `--shared-lib` command line option for `nitc` to generate a native library (.so or .dll). It is hidden because by itself it is not very useful. This is a first step to create polyglot programs where Nit is not the entrypoing.

I currently use such a DLL by first calling `nit_main` and then invoking callbacks generated by the FFI for a dummy method. Once we have a better way to generate the callbacks (or entrypoint actually) and maybe generate a .h, we could make this an official feature.

Pull-Request: #2714
Reviewed-by: Jean Privat <jean@pryen.org>

5 years agoMerge: lib/core: remove uses of Byte for Text
Jean Privat [Fri, 8 Jun 2018 22:42:33 +0000 (18:42 -0400)]
Merge: lib/core: remove uses of Byte for Text

Byte is convenient for automatic modular arithmetic on 8-bit values.

However, due to the way our Numeric types are handled, no automatic
conversion is done when working on primitive types, and operations like
comparison will fail when comparing two values of different type.

This is a cause of bugs as the u8 suffix is requires for comparing two
bytes, and is also the cause for tedious cast operations to go
back-and-forth between Byte and Int.

We remove the uses of Byte in the Text API, and replace then with Int.
This should not have a negative impact on performance.

Signed-off-by: Lucas Bajolet <lucas.bajolet@gmail.com>

Pull-Request: #2688

5 years agolib/core: remove ascii method on Int and 'b' prefix
Lucas Bajolet [Tue, 5 Jun 2018 21:40:55 +0000 (17:40 -0400)]
lib/core: remove ascii method on Int and 'b' prefix

Since no distinction is to be done between both Int and Byte when
dealing with strings, there is no need to have both an 'ascii' and a
'code_point' service on both Int and Char.

Therefore, we remove the ascii method, as our Chars are first and
foremost Unicode-compliant.

Signed-off-by: Lucas Bajolet <lucas.bajolet@gmail.com>

5 years agolib/core: remove uses of Byte for Text
Lucas Bajolet [Mon, 14 May 2018 18:56:51 +0000 (14:56 -0400)]
lib/core: remove uses of Byte for Text

Byte is convenient for automatic modular arithmetic on 8-bit values.

However, due to the way our Numeric types are handled, no automatic
conversion is done when working on primitive types, and operations like
comparison will fail when comparing two values of different type.

This is a cause of bugs as the u8 suffix is required for comparing two
bytes, and is also the cause for tedious cast operations to go
back-and-forth between Byte and Int.

We remove the uses of Byte in the Text API, and replace them with Int.
This should not have a negative impact on performance.

Signed-off-by: Lucas Bajolet <lucas.bajolet@gmail.com>

5 years agonitce: do not forgot to autoadapt in native_array_instance
Jean Privat [Fri, 8 Jun 2018 15:42:23 +0000 (11:42 -0400)]
nitce: do not forgot to autoadapt in native_array_instance

Signed-off-by: Jean Privat <jean@pryen.org>