nit.git
4 years agoREADME: document nit_env.sh
Jean Privat [Thu, 22 Oct 2015 14:55:34 +0000 (10:55 -0400)]
README: document nit_env.sh

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

4 years agomisc: add `nit_env.sh` to auto-magically configure shell environements
Jean Privat [Thu, 22 Oct 2015 14:53:09 +0000 (10:53 -0400)]
misc: add `nit_env.sh` to auto-magically configure shell environements

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

4 years agoMakefile: `all` generate manpages as `pandoc` is no more required
Jean Privat [Thu, 22 Oct 2015 14:00:30 +0000 (10:00 -0400)]
Makefile: `all` generate manpages as `pandoc` is no more required

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

4 years agoMerge: lib/serialization: fix deserialization constructor calling the default init
Jean Privat [Wed, 21 Oct 2015 13:03:23 +0000 (09:03 -0400)]
Merge: lib/serialization: fix deserialization constructor calling the default init

Restore previous behavior of the deserialization init which should not call the default init. This caused problems on default inits that accessed not yet deserialized attributes.

This also fixes WBTW troubles with game saving and multiplayer.

Pull-Request: #1766
Reviewed-by: Jean Privat <jean@pryen.org>
Reviewed-by: Alexandre Terrasa <alexandre@moz-code.org>

4 years agoMerge: lib/core: Optimized `html_escape` for FlatText variants
Jean Privat [Wed, 21 Oct 2015 01:10:06 +0000 (21:10 -0400)]
Merge: lib/core: Optimized `html_escape` for FlatText variants

As @privat requested, a byte-oriented optimized version of `FlatText` for `FlatString` as it is the most common case, like `escape_to_c`, it works at the byte level to accelerate fetching of characters.

On a short test program

~~~nit
var s = ""
for i in [0 .. 2000[ do s = "&lt;STRING&#47;&rt;".html_escape
~~~

Valgrind reports an old runtime of 18.208 MIr with a 8856 Ir/call to `html_escape`; the new runtime is 3.093 MIr, which translates to a 1298 Ir/call.

Pull-Request: #1775
Reviewed-by: Jean Privat <jean@pryen.org>
Reviewed-by: Alexis Laferrière <alexis.laf@xymus.net>

4 years agoMerge: lib/core: Added new `hexdigest` service on `Text`
Jean Privat [Wed, 21 Oct 2015 01:10:04 +0000 (21:10 -0400)]
Merge: lib/core: Added new `hexdigest` service on `Text`

Title says all, I needed this today to debug trailing zeroes in a produced string and I figured it could be PR'd

Pull-Request: #1774
Reviewed-by: Jean Privat <jean@pryen.org>
Reviewed-by: Alexis Laferrière <alexis.laf@xymus.net>

4 years agoMerge: loader: print error if bad files given to `scan_full` or `parse_full`
Jean Privat [Wed, 21 Oct 2015 01:10:02 +0000 (21:10 -0400)]
Merge: loader: print error if bad files given to `scan_full` or `parse_full`

The last series (#1750 ) removed then silently.

A test is also added to avoid regression.

Pull-Request: #1773
Reviewed-by: Alexis Laferrière <alexis.laf@xymus.net>

4 years agoMerge: nitdoc: opts --no-render and --test
Jean Privat [Wed, 21 Oct 2015 01:10:00 +0000 (21:10 -0400)]
Merge: nitdoc: opts --no-render and --test

Juste cleaning some options.

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

4 years agoRevert "tests: update deserializations tests with nitce because fixed autoinit fix...
Alexis Laferrière [Wed, 21 Oct 2015 00:23:16 +0000 (20:23 -0400)]
Revert "tests: update deserializations tests with nitce because fixed autoinit fix things"

This reverts commit 61d0c58a7bc53d6086e873fb4dd7d13cc985ca66.

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

4 years agolib/core: Optimized `html_escape` for FlatText variants
Lucas Bajolet [Tue, 20 Oct 2015 17:47:49 +0000 (13:47 -0400)]
lib/core: Optimized `html_escape` for FlatText variants

Signed-off-by: Lucas Bajolet <r4pass@hotmail.com>

4 years agolib/core: Added new `hexdigest` service on `Text`
Lucas Bajolet [Tue, 20 Oct 2015 15:37:47 +0000 (11:37 -0400)]
lib/core: Added new `hexdigest` service on `Text`

Signed-off-by: Lucas Bajolet <r4pass@hotmail.com>

4 years agoMerge: Optimize hash collection
Jean Privat [Tue, 20 Oct 2015 02:32:54 +0000 (22:32 -0400)]
Merge: Optimize hash collection

Some optimization when dealing with empty hash-based collection

user time for nitc nitc.nit:

* before: 0m6.640s
* after: 0m6.344s (-4.5%)

Pull-Request: #1768
Reviewed-by: Alexis Laferrière <alexis.laf@xymus.net>
Reviewed-by: Alexandre Terrasa <alexandre@moz-code.org>

4 years agoloader: print error if bad files given to `scan_full` or `parse_full`
Jean Privat [Tue, 20 Oct 2015 00:44:25 +0000 (20:44 -0400)]
loader: print error if bad files given to `scan_full` or `parse_full`

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

4 years agoMerge: lib: Introduce Stanford CoreNLP wrapper
Jean Privat [Tue, 20 Oct 2015 00:24:12 +0000 (20:24 -0400)]
Merge: lib: Introduce Stanford CoreNLP wrapper

## Stanford Core NLP

Stanford CoreNLP provides a set of natural language analysis tools which can take
raw text input and give the base forms of words, their parts of speech, whether
they are names of companies, people, etc., normalize dates, times, and numeric
quantities, and mark up the structure of sentences in terms of phrases and word
dependencies, indicate which noun phrases refer to the same entities, indicate
sentiment, etc.

This wrapper needs the Stanford CoreNLP jars that run on Java 1.8+.

See http://nlp.stanford.edu/software/corenlp.shtml.

## Usage

~~~nit
var proc = new NLPProcessor("path/to/StanfordCoreNLP/jars")

var doc = proc.process("String to analyze")

for sentence in doc.sentences do
for token in sentence.tokens do
print "{token.lemma}: {token.pos}"
end
end
~~~

Pull-Request: #1754
Reviewed-by: Jean Privat <jean@pryen.org>
Reviewed-by: Alexis Laferrière <alexis.laf@xymus.net>
Reviewed-by: Lucas Bajolet <r4pass@hotmail.com>

4 years agoMerge: parser: do not allocate a reduction table for each parser
Jean Privat [Tue, 20 Oct 2015 00:23:44 +0000 (20:23 -0400)]
Merge: parser: do not allocate a reduction table for each parser

This optimize multiple Parser allocation, for instance nitunit or nitdoc that need to deal with each nitunit in the documentation.

usertime for `./nitdoc ../lib/core/`:

* before: 0m2.184s
* after: 0m1.788s (-18.1%)

Pull-Request: #1770
Reviewed-by: Alexis Laferrière <alexis.laf@xymus.net>
Reviewed-by: Alexandre Terrasa <alexandre@moz-code.org>

4 years agoMerge: lib/html: implement the tag list as an hashset instead of a array.
Jean Privat [Tue, 20 Oct 2015 00:23:37 +0000 (20:23 -0400)]
Merge: lib/html: implement the tag list as an hashset instead of a array.

This optimize clients of lib/html like highlight.

usertime for `./test_highlight ../lib/core/`:

* before: 0m2.416s
* after: 0m2.328s (-3.64%)

Pull-Request: #1769
Reviewed-by: Alexandre Terrasa <alexandre@moz-code.org>

4 years agohash_debug: monitor calls to `enlarge`
Jean Privat [Tue, 20 Oct 2015 00:21:26 +0000 (20:21 -0400)]
hash_debug: monitor calls to `enlarge`

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

4 years agocore::hash_collection: simplify `enlarge`
Jean Privat [Tue, 20 Oct 2015 00:19:12 +0000 (20:19 -0400)]
core::hash_collection: simplify `enlarge`

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

4 years agocore::hash_collection: native array storage is no more nullable
Jean Privat [Tue, 20 Oct 2015 00:04:52 +0000 (20:04 -0400)]
core::hash_collection: native array storage is no more nullable

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

4 years agocore::hash_collection: do not allocate the storage, wait for the first `store`.
Jean Privat [Tue, 20 Oct 2015 00:04:11 +0000 (20:04 -0400)]
core::hash_collection: do not allocate the storage, wait for the first `store`.

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

4 years agosrc/doc: move the testing option to its own doc_phase.
Alexandre Terrasa [Mon, 19 Oct 2015 23:01:20 +0000 (19:01 -0400)]
src/doc: move the testing option to its own doc_phase.

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

4 years agosrc/doc: introduce option --no-render in HTML phase.
Alexandre Terrasa [Mon, 19 Oct 2015 22:57:57 +0000 (18:57 -0400)]
src/doc: introduce option --no-render in HTML phase.

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

4 years agolib/nlp: add package metadata and readme
Alexandre Terrasa [Fri, 16 Oct 2015 14:12:35 +0000 (10:12 -0400)]
lib/nlp: add package metadata and readme

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

4 years agolib/nlp: introduce nitnlp bin as a client example for lib/nlp.
Alexandre Terrasa [Thu, 15 Oct 2015 19:28:35 +0000 (15:28 -0400)]
lib/nlp: introduce nitnlp bin as a client example for lib/nlp.

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

4 years agolib/nlp: introduce NLPDocument to NLPVector translation
Alexandre Terrasa [Thu, 15 Oct 2015 19:11:08 +0000 (15:11 -0400)]
lib/nlp: introduce NLPDocument to NLPVector translation

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

4 years agolib/nlp: introduce Vector Space Model with NLPVectors
Alexandre Terrasa [Fri, 16 Oct 2015 14:11:05 +0000 (10:11 -0400)]
lib/nlp: introduce Vector Space Model with NLPVectors

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

4 years agolib/nlp: introduce StanfordNLP wrapper
Alexandre Terrasa [Fri, 16 Oct 2015 14:08:35 +0000 (10:08 -0400)]
lib/nlp: introduce StanfordNLP wrapper

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

4 years agocore::hash_collection: shortcut some methods on empty collections
Jean Privat [Mon, 19 Oct 2015 20:02:41 +0000 (16:02 -0400)]
core::hash_collection: shortcut some methods on empty collections

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

4 years agoparser: do not allocate a reduction table for each parser
Jean Privat [Mon, 19 Oct 2015 19:56:48 +0000 (15:56 -0400)]
parser: do not allocate a reduction table for each parser

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

4 years agolib/html: implement the tag list as an hashset instead of a array.
Jean Privat [Mon, 19 Oct 2015 19:48:22 +0000 (15:48 -0400)]
lib/html: implement the tag list as an hashset instead of a array.

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

4 years agoMerge: contrib/opportunity: store local participant's name in a cookie
Jean Privat [Mon, 19 Oct 2015 17:43:06 +0000 (13:43 -0400)]
Merge: contrib/opportunity: store local participant's name in a cookie

So we don't have to write our own name every single time we participate to an event.

Already deployed on xymus.net, you can test it here: http://xymus.net/opportunity/?meetup_id=5E8F7A00589D5F567FFB07EA09A8630A8A2BA048

Pull-Request: #1765
Reviewed-by: Jean Privat <jean@pryen.org>
Reviewed-by: Lucas Bajolet <r4pass@hotmail.com>

4 years agoMerge: Improve highlight
Jean Privat [Mon, 19 Oct 2015 12:50:35 +0000 (08:50 -0400)]
Merge: Improve highlight

highlight and nitlight need love.

The series fix some long issues. The main change is the improvement of the method `HightlightVisitor::enter_visit` that does only highlight the given node instead of the whole file.

Moreover, two new flags can be used to indicate how to deal with the context around the node given to highlight.

Note: A lot more love is needed, but this should really improve the current status of these modules.

Pull-Request: #1763
Reviewed-by: Alexandre Terrasa <alexandre@moz-code.org>

4 years agoMerge: Kill pseudo toplevel methods
Jean Privat [Mon, 19 Oct 2015 12:50:29 +0000 (08:50 -0400)]
Merge: Kill pseudo toplevel methods

Move some methods from Object to the top-level (Sys) as they do not rely on `self` and are intended to be called from everywhere.

Beside documentation improvement, this should slightly reduce the size of tables as methods introduced in Object are inherited by all classes.

Pull-Request: #1758
Reviewed-by: Alexandre Terrasa <alexandre@moz-code.org>
Reviewed-by: Alexis Laferrière <alexis.laf@xymus.net>

4 years agoMerge: Loader refactor
Jean Privat [Mon, 19 Oct 2015 12:50:24 +0000 (08:50 -0400)]
Merge: Loader refactor

A big refactorization of the loader

This include cleanup, renaming and documentation of the existing code.

The major change is the removal of `ModulePath` used to designate an identified module that is not yet loaded. This caused major issues since once the module was loaded, the MModule object has to be used instead.
Now, genuine `MModule` are used to also represent modules identified in the file system but not yet loaded.
This simplify the code of the loader, nitls and nitcatalog.

By the way, the option `-d` (and `-M`) of nitls that was broken by the previous changes in the loader is now fixed.

Another change is the introduction of `scan_full` that is a high-level method to be used by clients like nitls or nitcatalog that just need to identify packages, groups and modules in the filesystem without loading them.

By the way, nitcalatog works on directories of projects now. eg. `nitcatalog ../lib)

Note, because this PR introduces a lot of interrelated changes, It was hard to come up with nice commits. The alternative was to have a single big commit.

Pull-Request: #1750
Reviewed-by: Alexis Laferrière <alexis.laf@xymus.net>
Reviewed-by: Lucas Bajolet <r4pass@hotmail.com>

4 years agocontrib/opportunity: store local participant's name in a cookie
Alexis Laferrière [Sun, 18 Oct 2015 14:31:03 +0000 (10:31 -0400)]
contrib/opportunity: store local participant's name in a cookie

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

4 years agosrc: new program `test_highlight`
Jean Privat [Sat, 17 Oct 2015 19:24:17 +0000 (15:24 -0400)]
src: new program `test_highlight`

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

4 years agotests: update sav/ because of new loader
Jean Privat [Sat, 17 Oct 2015 14:24:48 +0000 (10:24 -0400)]
tests: update sav/ because of new loader

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

4 years agoloader: sort files in scanning to force determinism
Jean Privat [Sat, 17 Oct 2015 00:33:57 +0000 (20:33 -0400)]
loader: sort files in scanning to force determinism

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

4 years agoonline_ide: update to the new API of the loader
Jean Privat [Tue, 13 Oct 2015 15:47:20 +0000 (11:47 -0400)]
online_ide: update to the new API of the loader

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

4 years agomodel/model_viz: use OrderedTree[MConcern]
Jean Privat [Fri, 9 Oct 2015 19:47:03 +0000 (15:47 -0400)]
model/model_viz: use OrderedTree[MConcern]

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

4 years agotests: improve nitls tests
Jean Privat [Fri, 9 Oct 2015 19:46:30 +0000 (15:46 -0400)]
tests: improve nitls tests

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

4 years agonitls: use alpha_comparator
Jean Privat [Fri, 9 Oct 2015 19:46:06 +0000 (15:46 -0400)]
nitls: use alpha_comparator

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

4 years agonitls: use OrderedTree[MConcern]
Jean Privat [Fri, 9 Oct 2015 19:45:50 +0000 (15:45 -0400)]
nitls: use OrderedTree[MConcern]

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

4 years agonitls: adapt to new loader API
Jean Privat [Fri, 9 Oct 2015 19:38:20 +0000 (15:38 -0400)]
nitls: adapt to new loader API

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

4 years agonitcatalog: use MConcen to generalize MGroup and MModule
Jean Privat [Fri, 9 Oct 2015 19:37:26 +0000 (15:37 -0400)]
nitcatalog: use MConcen to generalize MGroup and MModule

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

4 years agonitcatalog: adapt to new loader API
Jean Privat [Fri, 9 Oct 2015 19:36:31 +0000 (15:36 -0400)]
nitcatalog: adapt to new loader API

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

4 years agoloader: improve documentation
Jean Privat [Fri, 9 Oct 2015 19:35:19 +0000 (15:35 -0400)]
loader: improve documentation

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

4 years agoloader: conditional_importations have only MModule now
Jean Privat [Fri, 9 Oct 2015 19:34:44 +0000 (15:34 -0400)]
loader: conditional_importations have only MModule now

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

4 years agoloader: `MModule::load` cause build_module_importation
Jean Privat [Fri, 9 Oct 2015 19:33:01 +0000 (15:33 -0400)]
loader: `MModule::load` cause build_module_importation

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

4 years agoloader: introduce `scan_full`
Jean Privat [Fri, 9 Oct 2015 19:31:22 +0000 (15:31 -0400)]
loader: introduce `scan_full`

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

4 years agotests: update nitlight.res
Jean Privat [Sat, 17 Oct 2015 14:02:51 +0000 (10:02 -0400)]
tests: update nitlight.res

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

4 years agonitlight: include whole lines and loose tookens
Jean Privat [Sat, 17 Oct 2015 14:02:11 +0000 (10:02 -0400)]
nitlight: include whole lines and loose tookens

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

4 years agohighlight: add flag `include_whole_lines`
Jean Privat [Sat, 17 Oct 2015 02:34:24 +0000 (22:34 -0400)]
highlight: add flag `include_whole_lines`

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

4 years agohighlight: add flag `include_loose_tokens`
Jean Privat [Sat, 17 Oct 2015 02:30:59 +0000 (22:30 -0400)]
highlight: add flag `include_loose_tokens`

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

4 years agolib/serialization: fix deserialization contructor calling the default init
Alexis Laferrière [Sat, 17 Oct 2015 00:52:30 +0000 (20:52 -0400)]
lib/serialization: fix deserialization contructor calling the default init

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

4 years agohighlight: only highlight the given node, not the whole AST
Jean Privat [Sat, 17 Oct 2015 02:30:31 +0000 (22:30 -0400)]
highlight: only highlight the given node, not the whole AST

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

4 years agonitlight: use `cname` or `full_name` to avoid module conflicts
Jean Privat [Sat, 17 Oct 2015 02:29:35 +0000 (22:29 -0400)]
nitlight: use `cname` or `full_name` to avoid module conflicts

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

4 years agoparallelization_phase: use `ANode::validate` after AST shenanigans.
Jean Privat [Sat, 17 Oct 2015 02:18:44 +0000 (22:18 -0400)]
parallelization_phase: use `ANode::validate` after AST shenanigans.

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

4 years agoastvalidation: add `ANode::validate` to simplify validation
Jean Privat [Sat, 17 Oct 2015 02:18:07 +0000 (22:18 -0400)]
astvalidation: add `ANode::validate` to simplify validation

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

4 years agoMerge: lib/github: clean code and add some services
Jean Privat [Fri, 16 Oct 2015 20:16:09 +0000 (16:16 -0400)]
Merge: lib/github: clean code and add some services

The first objective of this PR is to clean the `github::api` code and remove typing wranings.

It also add new services that can be useful for clients:
* `Issue::is_ull_request`
* Setters to modify GithubEntitties

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

4 years agoMerge: lib/mongodb: minor fixes
Jean Privat [Fri, 16 Oct 2015 20:16:05 +0000 (16:16 -0400)]
Merge: lib/mongodb: minor fixes

This PR apply some fixes to the MongoDB library:
* avoids crash when `Collection::find` returns only one element
* fixes the SegFault workaround in `Collection::find`

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

4 years agocontrib/wiringPi: move pseudo-toplevel methods from Object
Jean Privat [Fri, 16 Oct 2015 17:59:01 +0000 (13:59 -0400)]
contrib/wiringPi: move pseudo-toplevel methods from Object

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

4 years agosrc: move pseudo-toplevel methods from Object
Jean Privat [Fri, 16 Oct 2015 12:42:02 +0000 (08:42 -0400)]
src: move pseudo-toplevel methods from Object

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

4 years agolib/egl: move `report_egl_error` from Object to `EGLDisplay`
Jean Privat [Fri, 16 Oct 2015 17:49:21 +0000 (13:49 -0400)]
lib/egl: move `report_egl_error` from Object to `EGLDisplay`

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

4 years agolib: move pseudo-toplevel methods from Object
Jean Privat [Fri, 16 Oct 2015 17:57:15 +0000 (13:57 -0400)]
lib: move pseudo-toplevel methods from Object

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

4 years agolib/github: introduce `Issue::is_pull_request` method
Alexandre Terrasa [Fri, 16 Oct 2015 15:10:49 +0000 (11:10 -0400)]
lib/github: introduce `Issue::is_pull_request` method

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

4 years agolib/github: add setters to all github api entities and events
Alexandre Terrasa [Sat, 27 Jun 2015 00:03:10 +0000 (20:03 -0400)]
lib/github: add setters to all github api entities and events

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

4 years agolib/github: better type safety on json accesses
Alexandre Terrasa [Fri, 26 Jun 2015 01:38:09 +0000 (21:38 -0400)]
lib/github: better type safety on json accesses

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

4 years agolib/github: remove `to_s` on nullable warnings
Alexandre Terrasa [Fri, 26 Jun 2015 01:01:43 +0000 (21:01 -0400)]
lib/github: remove `to_s` on nullable warnings

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

4 years agolib/mongodb: fix segfault in `Collection::find` method
Alexandre Terrasa [Fri, 16 Oct 2015 15:10:05 +0000 (11:10 -0400)]
lib/mongodb: fix segfault in `Collection::find` method

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

4 years agolib/mongodb: collections do not call next when returning only one element
Alexandre Terrasa [Wed, 24 Jun 2015 23:06:24 +0000 (19:06 -0400)]
lib/mongodb: collections do not call next when returning only one element

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

4 years agoMerge: metrics: add some Mendel metrics for classes
Jean Privat [Fri, 16 Oct 2015 12:19:56 +0000 (08:19 -0400)]
Merge: metrics: add some Mendel metrics for classes

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

4 years agoMerge: metrics: not a number fix
Jean Privat [Fri, 16 Oct 2015 12:19:49 +0000 (08:19 -0400)]
Merge: metrics: not a number fix

Skip `nan` values in metrics so the sum and std_div still have sense.

Also change `Metric::collect` to accept any kind of `Collection`.

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

4 years agoMerge: Set HashMapIterator as a private class.
Jean Privat [Fri, 16 Oct 2015 12:19:43 +0000 (08:19 -0400)]
Merge: Set HashMapIterator as a private class.

Other specific iterators are private. So this PR uniformize with HashMapIterator.

@privat you should check this.

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

4 years agoMerge: FlatText is a private class
Jean Privat [Fri, 16 Oct 2015 12:19:42 +0000 (08:19 -0400)]
Merge: FlatText is a private class

This PR does two things:
* Define `FlatText` as a private class. Since every clients were using an intrude import, their code do not change.
* Remove nullable warning in text::flat

Pull-Request: #1752
Reviewed-by: Lucas Bajolet <r4pass@hotmail.com>
Reviewed-by: Jean Privat <jean@pryen.org>

4 years agoMerge: lib/graphs: introduce PageRank computation on digraphs
Jean Privat [Fri, 16 Oct 2015 12:19:39 +0000 (08:19 -0400)]
Merge: lib/graphs: introduce PageRank computation on digraphs

Implement famous Google's `PageRank` algorithm for directed graphs.

Ping @ablondin

Pull-Request: #1706
Reviewed-by: Jean Privat <jean@pryen.org>
Reviewed-by: Alexandre Blondin Massé <alexandre.blondin.masse@gmail.com>

4 years agometrics: add some Mendel metrics for classes
Alexandre Terrasa [Thu, 15 Oct 2015 22:55:59 +0000 (18:55 -0400)]
metrics: add some Mendel metrics for classes

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

4 years agometrics: make Metric interface accept any kind of collection
Alexandre Terrasa [Thu, 15 Oct 2015 21:42:15 +0000 (17:42 -0400)]
metrics: make Metric interface accept any kind of collection

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

4 years agometrics: skip `not a number` values when computinh the sum and std_dev
Alexandre Terrasa [Thu, 15 Oct 2015 21:41:50 +0000 (17:41 -0400)]
metrics: skip `not a number` values when computinh the sum and std_dev

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

4 years agocore/collection: set HashMapIterator as private
Alexandre Terrasa [Thu, 15 Oct 2015 17:51:10 +0000 (13:51 -0400)]
core/collection: set HashMapIterator as private

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

4 years agocore/text: remove call on nullable warnings
Alexandre Terrasa [Thu, 15 Oct 2015 21:35:17 +0000 (17:35 -0400)]
core/text: remove call on nullable warnings

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

4 years agolib/graphs: introduce PageRank computation on digraphs
Alexandre Terrasa [Thu, 15 Oct 2015 21:31:56 +0000 (17:31 -0400)]
lib/graphs: introduce PageRank computation on digraphs

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

4 years agolib/graphs: introduce `show_dot` for debugging digraphs.
Alexandre Terrasa [Fri, 11 Sep 2015 16:48:32 +0000 (12:48 -0400)]
lib/graphs: introduce `show_dot` for debugging digraphs.

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

4 years agolib/graphs: clean digraph.nit whitespaces
Alexandre Terrasa [Fri, 11 Sep 2015 16:47:40 +0000 (12:47 -0400)]
lib/graphs: clean digraph.nit whitespaces

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

4 years agocore/text: make FlatText private
Alexandre Terrasa [Thu, 15 Oct 2015 17:39:03 +0000 (13:39 -0400)]
core/text: make FlatText private

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

4 years agoMerge: mnit: Fix error on refined virtual types
Jean Privat [Tue, 13 Oct 2015 16:29:59 +0000 (12:29 -0400)]
Merge: mnit: Fix error on refined virtual types

Simple fix for the "Redef Error" in mnit clients: do not redef virtual types, instead assert the types in the users methods.

Pull-Request: #1751
Reviewed-by: Romain Chanoir <chanoir.romain@courrier.uqam.ca>
Reviewed-by: Jean Privat <jean@pryen.org>

4 years agoMerge: Rationalize the usages of tools on packages
Jean Privat [Tue, 13 Oct 2015 16:29:43 +0000 (12:29 -0400)]
Merge: Rationalize the usages of tools on packages

In order to have autonomous packages, they should be coherent and work as is without specific user hack.

The remaining issues are:

* The absence of required source files (eg. because generated by nitcc or nitserial) that make tools unusable or reports error. The proposed solution is a new optional Makefile goal `pre-build` that has to generate the missing files. close #1720

* The requirement of arbitrary `-I` that make the tools (eg the vim plugin) unusable on the projects without prior knowledge.
The only project that use a rogue -I is `online_editor` that require things from nitc.
The proposed solution is to virtually move src to contrib/nitc as a symbolic link.
New project could then choose to import nitc (or parts of it) without being in src.

* The presence of broken nit files. Currently, only 3 broken files remain: `contrib/pep8analysis/src/parser/parser_abs.nit`, `contrib/nitc/parser/parser_abs.nit` and `contrib/nitcc/src/nitcc_lexer0.nit`. These are still open issues and will be dealt latter.

Pull-Request: #1749
Reviewed-by: Lucas Bajolet <r4pass@hotmail.com>
Reviewed-by: Alexis Laferrière <alexis.laf@xymus.net>

4 years agoonline_ide: imports nitc (symlinked from contrib)
Jean Privat [Wed, 7 Oct 2015 15:24:50 +0000 (11:24 -0400)]
online_ide: imports nitc (symlinked from contrib)

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

4 years agocontrib: add `nitc` as a symbolic link to `src` so projects can import nitc
Jean Privat [Wed, 7 Oct 2015 15:23:39 +0000 (11:23 -0400)]
contrib: add `nitc` as a symbolic link to `src` so projects can import nitc

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

4 years agotinks: nitserial requires a valid model, so with a generated drawing.nit
Jean Privat [Wed, 7 Oct 2015 15:23:21 +0000 (11:23 -0400)]
tinks: nitserial requires a valid model, so with a generated drawing.nit

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

4 years agotests: do not expect the "Redef Error" on mnit clients
Alexis Laferrière [Sun, 11 Oct 2015 16:23:12 +0000 (12:23 -0400)]
tests: do not expect the "Redef Error" on mnit clients

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

4 years agolib/mnit: do not redef virtual types
Alexis Laferrière [Sun, 11 Oct 2015 16:16:43 +0000 (12:16 -0400)]
lib/mnit: do not redef virtual types

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

4 years agoloader: kill ModulePath
Jean Privat [Fri, 9 Oct 2015 19:25:46 +0000 (15:25 -0400)]
loader: kill ModulePath

This means that MModule objects are constructed once they are identified

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

4 years agoloader: rename `get_group` to `identify_group`
Jean Privat [Fri, 9 Oct 2015 19:12:32 +0000 (15:12 -0400)]
loader: rename `get_group` to `identify_group`

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

4 years agoMerge: Multi iterators
Jean Privat [Wed, 7 Oct 2015 17:53:39 +0000 (13:53 -0400)]
Merge: Multi iterators

Introduce multi-iterators in `for`.

A single `for` can now iterates over more than one collection at once. An iterator is used for each collection and the iteration is finished once the shortest iterator is finished.

~~~nit
for i in [10, 20, 30], j in [1..10] do print i+j # outputs 11 22 33
~~~

As expected by POLA, multi-iterators are also naturally usable on maps and comprehension arrays

~~~nit
var m = new HashMap[Int,String]
m[1] = "one"
m[2] = "two"
for k, v in m, i in [1..10] do print "{k}:{v}:{i}"
# outputs 1:one:1 2:two:2

var a = [for i in [10, 20, 30], j in [1..10] do i + j]
print a # outputs [11, 22, 33]
~~~

Close #1735

Pull-Request: #1748
Reviewed-by: Alexis Laferrière <alexis.laf@xymus.net>
Reviewed-by: Lucas Bajolet <r4pass@hotmail.com>

4 years agotransform: reactivate shortcut_range by not transforming it prematurely
Jean Privat [Wed, 7 Oct 2015 15:54:52 +0000 (11:54 -0400)]
transform: reactivate shortcut_range by not transforming it prematurely

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

4 years agoMakefiles: add pre-build
Jean Privat [Wed, 7 Oct 2015 15:21:01 +0000 (11:21 -0400)]
Makefiles: add pre-build

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

4 years agoMerge: Detach CallSite from the AST
Jean Privat [Wed, 7 Oct 2015 14:03:39 +0000 (10:03 -0400)]
Merge: Detach CallSite from the AST

A minor cleanup in the model that reduces the coupling of the model and the AST.

Pull-Request: #1747
Reviewed-by: Alexis Laferrière <alexis.laf@xymus.net>
Reviewed-by: Lucas Bajolet <r4pass@hotmail.com>

4 years agoMerge: More robustness in keep going
Jean Privat [Wed, 7 Oct 2015 14:02:59 +0000 (10:02 -0400)]
Merge: More robustness in keep going

A pass on the various modules of `nitc` to make them more robust when `keep_going` is activated.

The main changes are the introductions of the flags `is_broken` in the root classes ANode and MEntity. This flags simplify the clients code to check the validity of entities before working with them.

Pull-Request: #1746
Reviewed-by: Alexis Laferrière <alexis.laf@xymus.net>
Reviewed-by: Lucas Bajolet <r4pass@hotmail.com>

4 years agopretty: handle multi-iterators
Jean Privat [Wed, 7 Oct 2015 02:30:08 +0000 (22:30 -0400)]
pretty: handle multi-iterators

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