nit.git
8 years agomisc/vim: add option to disable omnifunc
Alexis Laferrière [Tue, 28 Apr 2015 03:51:47 +0000 (23:51 -0400)]
misc/vim: add option to disable omnifunc

Fix #1300.

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

8 years agolib/collection: better doc for Iterator
Alexis Laferrière [Tue, 14 Apr 2015 20:55:48 +0000 (16:55 -0400)]
lib/collection: better doc for Iterator

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

8 years agolib/java: fix typo
Alexis Laferrière [Tue, 14 Apr 2015 20:54:55 +0000 (16:54 -0400)]
lib/java: fix typo

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

8 years agosrc/frontend: fix typo
Alexis Laferrière [Tue, 14 Apr 2015 20:55:06 +0000 (16:55 -0400)]
src/frontend: fix typo

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

8 years agolib/bucketed_game: revamp constructor of `Buckets`
Alexis Laferrière [Tue, 28 Apr 2015 02:58:10 +0000 (22:58 -0400)]
lib/bucketed_game: revamp constructor of `Buckets`

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

8 years agoMerge: Named arguments
Jean Privat [Sat, 25 Apr 2015 02:19:15 +0000 (09:19 +0700)]
Merge: Named arguments

Named arguments allows the caller to specify some subset of arguments it wants to call.
This PR introduce a syntax for callers inspired from the Python one (the Ruby one uses columns that clashes with types declaration).

~~~nit
format(linewidth=80, separator=":", indent=true)
~~~

The specification tries to be as simple as possible

* Only default parameters can be passed by name; because the other are mandatory.
  This restriction is also useful to avoid to specify additional rules, like the last parameter of assignment methods, because the ones on default arguments apply.

~~~nit
fun foo(a,b: nullable Int) do ...
foo(b=1)
foo(null,1) # equivalent
~~~

* Named arguments can appear anywhere (not necessarily at the end)

~~~nit
fun foo(a: Int, b: nulable Int)
foo(b=1,2)
foo(2,1) # equivalent
~~~

* The order of evaluation is the order of the arguments (not the order of the parameters).
  I think this is more POLA this way.

* The names to use are the one of the statically designated method declaration (not the introduction).
  This one is problematic because the language permit the name of parameters to change in redefinitions.
  But in case of errors or in a IDE it is often more useful to point the most precise method definition.

The implementation was trivial because the hard work was already done in the previous PR.

This PR was unlocked by #1280

Pull-Request: #1281
Reviewed-by: Alexis Laferrière <alexis.laf@xymus.net>
Reviewed-by: Alexandre Terrasa <alexandre@moz-code.org>
Reviewed-by: Etienne M. Gagnon <egagnon@j-meg.com>
Reviewed-by: Lucas Bajolet <r4pass@hotmail.com>
Reviewed-by: Romain Chanoir <chanoir.romain@courrier.uqam.ca>

8 years agoMerge: Parallelization phase improvement
Jean Privat [Sat, 25 Apr 2015 02:18:54 +0000 (09:18 +0700)]
Merge: Parallelization phase improvement

Adds the support of methods with return value

If you use `is threaded` on a method with a return, it will instead return you a custom instance of `Thread` class on which you can use the method `join` to retrieve the return of the annotated method. `join` waits for the method to end before returning.If you want to make sure that the method has done his work before trying to retrieve it's return value, you can check it with the boolean `is_done`

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

8 years agotests: add base_arg_named_inherit.nit
Jean Privat [Sat, 18 Apr 2015 15:12:11 +0000 (22:12 +0700)]
tests: add base_arg_named_inherit.nit

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

8 years agotests: add base_arg_named.nit and base_arg_order.nit
Jean Privat [Sat, 18 Apr 2015 15:11:40 +0000 (22:11 +0700)]
tests: add base_arg_named.nit and base_arg_order.nit

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

8 years agoengines: process named arguments
Jean Privat [Thu, 16 Apr 2015 11:46:16 +0000 (18:46 +0700)]
engines: process named arguments

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

8 years agotyping: process named arguments
Jean Privat [Sat, 18 Apr 2015 15:22:40 +0000 (22:22 +0700)]
typing: process named arguments

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

8 years agoparser: regenerate
Jean Privat [Thu, 16 Apr 2015 11:43:05 +0000 (18:43 +0700)]
parser: regenerate

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

8 years agogrammar: add expr.namedargs
Jean Privat [Thu, 16 Apr 2015 11:42:50 +0000 (18:42 +0700)]
grammar: add expr.namedargs

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

8 years agogrammar: extract `vararg` in a specific arg production
Jean Privat [Thu, 16 Apr 2015 11:42:17 +0000 (18:42 +0700)]
grammar: extract `vararg` in a specific arg production

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

8 years agomodel: add `MSignature::mparameter_by_name`
Jean Privat [Thu, 16 Apr 2015 11:41:19 +0000 (18:41 +0700)]
model: add `MSignature::mparameter_by_name`

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

8 years agoMerge: More binary operators
Jean Privat [Fri, 24 Apr 2015 08:24:01 +0000 (15:24 +0700)]
Merge: More binary operators

The first part of the PR cleanup and factorize some things related to the operators in the grammar and the AST.
Then the four bitwise operators are added.

Close #1271 unless some more thing is added to it (like generalized unary operators)

Note: as usual, github is useless when the parser is regenerated, so review the individual commits if you prefer.

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

8 years agotests: clean and complete test_ffi_c_operators
Jean Privat [Fri, 24 Apr 2015 07:50:09 +0000 (14:50 +0700)]
tests: clean and complete test_ffi_c_operators

thanks nitpretty!

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

8 years agotests: update error_syntax2.nit because & is now an operator
Jean Privat [Thu, 23 Apr 2015 10:01:55 +0000 (17:01 +0700)]
tests: update error_syntax2.nit because & is now an operator

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

8 years agotests: improve (and rename) test_operators.nit
Jean Privat [Thu, 23 Apr 2015 08:45:41 +0000 (15:45 +0700)]
tests: improve (and rename) test_operators.nit

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

8 years agosrc: handle new bitwise operators
Jean Privat [Thu, 23 Apr 2015 08:46:06 +0000 (15:46 +0700)]
src: handle new bitwise operators

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

8 years agoMerge: nitdoc: prepare the migration of nitdoc component to new phases
Jean Privat [Fri, 24 Apr 2015 06:03:24 +0000 (13:03 +0700)]
Merge: nitdoc: prepare the migration of nitdoc component to new phases

Only internal modification, no diff with the generated HTML of the previous version.

If you don't trust me (I you shouldn't), the demos will be [there](http://gresil.org/jenkins/job/CI-nitdoc/ws/doc/stdlib/index.html) and [there](http://gresil.org/jenkins/job/CI-nitdoc/ws/doc/nitc/index.html) in a few minutes.

> Brace yourself, next PR on that subject will be big.

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

8 years agoMerge: nitrpg: periodize stats
Jean Privat [Fri, 24 Apr 2015 06:03:14 +0000 (13:03 +0700)]
Merge: nitrpg: periodize stats

This will be used to display periodic stats about players and games.

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

8 years agoMerge: Nitrpg work
Jean Privat [Fri, 24 Apr 2015 06:03:07 +0000 (13:03 +0700)]
Merge: Nitrpg work

Improve the dashboard on the player page with `request_for_comment` things, and assigned work

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

8 years agoMerge: Hint vararg
Jean Privat [Fri, 24 Apr 2015 06:02:47 +0000 (13:02 +0700)]
Merge: Hint vararg

Improve the error message so that user that try to pass an array as is instead of elements is hinted about the `...` reverse-vararg operator.

~~~
fun foo(xs: Int...) do end
foo(1,2,3) # OK
var a = [1,2,3]
foo(a) # Error, expected `Int`; got `Array[Int]`. Is `...` missing?
foo(a...) # OK
~~~

![](http://i.imgur.com/zmyi8GR.jpg)

close #98 (quite old bug)

Pull-Request: #1294
Reviewed-by: Alexis Laferrière <alexis.laf@xymus.net>
Reviewed-by: Lucas Bajolet <r4pass@hotmail.com>
Reviewed-by: Alexandre Terrasa <alexandre@moz-code.org>

8 years agoMerge: Some metrics improvement and cleaning
Jean Privat [Fri, 24 Apr 2015 06:02:37 +0000 (13:02 +0700)]
Merge: Some metrics improvement and cleaning

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

8 years agoMerge: Model: add mclassdef2node
Jean Privat [Fri, 24 Apr 2015 06:02:31 +0000 (13:02 +0700)]
Merge: Model: add mclassdef2node

This was missing, I don't understand why but I need it.

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

8 years agotests: update sav/base_vararg3* with new hint error message
Jean Privat [Thu, 23 Apr 2015 06:10:28 +0000 (13:10 +0700)]
tests: update sav/base_vararg3* with new hint error message

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

8 years agotyping: special message when a single vararg is refused bu could be `...`-ed
Jean Privat [Thu, 23 Apr 2015 06:08:44 +0000 (13:08 +0700)]
typing: special message when a single vararg is refused bu could be `...`-ed

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

8 years agocontrib/nitrpg: use stats to store player nitcoins
Alexandre Terrasa [Wed, 25 Feb 2015 21:31:43 +0000 (22:31 +0100)]
contrib/nitrpg: use stats to store player nitcoins

So podium and stats can be displayed by time periods.

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

8 years agocontrib/nitrpg: make stats periodized
Alexandre Terrasa [Tue, 24 Feb 2015 19:15:20 +0000 (20:15 +0100)]
contrib/nitrpg: make stats periodized

Currently stats are stored:
* all time
* yearly
* monthly
* daily
* weekly

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

8 years agolib/counter: introduce Counter::dec
Alexandre Terrasa [Fri, 24 Apr 2015 02:00:03 +0000 (22:00 -0400)]
lib/counter: introduce Counter::dec

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

8 years agosrc/doc: introduce DocComposite HTML rendering services
Alexandre Terrasa [Fri, 24 Apr 2015 01:05:12 +0000 (21:05 -0400)]
src/doc: introduce DocComposite HTML rendering services

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

8 years agometrics/mendel: add missing comments
Alexandre Terrasa [Tue, 21 Apr 2015 20:28:06 +0000 (16:28 -0400)]
metrics/mendel: add missing comments

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

8 years agometrics/mendel: use new constructors
Alexandre Terrasa [Tue, 21 Apr 2015 20:27:53 +0000 (16:27 -0400)]
metrics/mendel: use new constructors

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

8 years agometrics/mendel: sort results in console display
Alexandre Terrasa [Tue, 21 Apr 2015 20:27:32 +0000 (16:27 -0400)]
metrics/mendel: sort results in console display

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

8 years agometrics: fixe missing documentation warnings
Alexandre Terrasa [Thu, 23 Apr 2015 18:57:23 +0000 (14:57 -0400)]
metrics: fixe missing documentation warnings

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

8 years agometrics: remove useless return types in redefs
Alexandre Terrasa [Thu, 23 Apr 2015 18:58:32 +0000 (14:58 -0400)]
metrics: remove useless return types in redefs

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

8 years agometrics: move `sum` up to interface `Metric`
Alexandre Terrasa [Thu, 23 Apr 2015 18:58:11 +0000 (14:58 -0400)]
metrics: move `sum` up to interface `Metric`

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

8 years agometrics: allow Metric sorting
Alexandre Terrasa [Tue, 21 Apr 2015 20:26:29 +0000 (16:26 -0400)]
metrics: allow Metric sorting

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

8 years agolib/standard: introduce ReserveDefaultComparator
Alexandre Terrasa [Thu, 23 Apr 2015 18:55:19 +0000 (14:55 -0400)]
lib/standard: introduce ReserveDefaultComparator

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

8 years agosrc/doc: introduce `html_comment` and `html_short_comment` services
Alexandre Terrasa [Mon, 23 Feb 2015 20:43:10 +0000 (21:43 +0100)]
src/doc: introduce `html_comment` and `html_short_comment` services

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

8 years agosrc/doc: move components generation from `doc_model` to `doc_html` phase
Alexandre Terrasa [Mon, 23 Feb 2015 19:50:18 +0000 (20:50 +0100)]
src/doc: move components generation from `doc_model` to `doc_html` phase

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

8 years agoparser: regenerate
Jean Privat [Thu, 23 Apr 2015 08:30:35 +0000 (15:30 +0700)]
parser: regenerate

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

8 years agogrammar: add bitwise operators `|`, `^`, `&`, and `~`
Jean Privat [Thu, 23 Apr 2015 08:30:00 +0000 (15:30 +0700)]
grammar: add bitwise operators `|`, `^`, `&`, and `~`

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

8 years agosrc: use AUnaryopExpr
Jean Privat [Thu, 23 Apr 2015 08:24:56 +0000 (15:24 +0700)]
src: use AUnaryopExpr

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

8 years agoparser: new class AUnaryopExpr to factorize unary operations
Jean Privat [Thu, 23 Apr 2015 08:19:33 +0000 (15:19 +0700)]
parser: new class AUnaryopExpr to factorize unary operations

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

8 years agoparser: new class AOperatorMethid to factorize operator methods
Jean Privat [Thu, 23 Apr 2015 08:16:54 +0000 (15:16 +0700)]
parser: new class AOperatorMethid to factorize operator methods

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

8 years agonitrpg: add new player panel for work to do
Jean Privat [Wed, 22 Apr 2015 16:11:36 +0000 (23:11 +0700)]
nitrpg: add new player panel for work to do

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

8 years agonitrpg: extends PlayerReviewsPanel to add `request_for_comments` tags
Jean Privat [Wed, 22 Apr 2015 16:11:20 +0000 (23:11 +0700)]
nitrpg: extends PlayerReviewsPanel to add `request_for_comments` tags

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

9 years agocontrib/nitrpg: `save_in` uses string key instead of GameEntity
Alexandre Terrasa [Tue, 24 Feb 2015 18:06:44 +0000 (19:06 +0100)]
contrib/nitrpg: `save_in` uses string key instead of GameEntity

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

9 years agoMerge: Small clean up and improvements to MNit from WBTW
Jean Privat [Wed, 22 Apr 2015 06:46:03 +0000 (13:46 +0700)]
Merge: Small clean up and improvements to MNit from WBTW

The new OpenGL parameters affect the display of images for a better pixelated look:
* When zoomed out, the image is smoother, the color values are interpolated from the nearest source pixels.
* When zoomed in, the image is displayed pixelated.

You may recognize the `Int::next_pow` method, `inkscape_tools` use something similar for the same purpose. Actually, with this PR, `inkscape_tools` may not need it anymore and produce smaller PNG files.

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

9 years agoMerge: share/man: Update man for `nitpretty`
Jean Privat [Wed, 22 Apr 2015 04:18:41 +0000 (11:18 +0700)]
Merge: share/man: Update man for `nitpretty`

Fixes #1130

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

9 years agoMerge: Inkscape tool revamp and gamnit support
Jean Privat [Wed, 22 Apr 2015 04:18:34 +0000 (11:18 +0700)]
Merge: Inkscape tool revamp and gamnit support

* Clean up old style inits, add missing doc and refactor main code into classes and methods.
* Adds the gamnit target option, the generated code is much more simple, but the generation a bit more complex.
* Allow to specify the full path to the Nit source file to generate.
* Make rounding to the next power of 2 optional, it will no more be required for mnit programs on Android with #1284.

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

9 years agoMerge: Nitdoc: more cleaning and uniformize method names
Jean Privat [Wed, 22 Apr 2015 04:18:23 +0000 (11:18 +0700)]
Merge: Nitdoc: more cleaning and uniformize method names

Démos:

* [stdlib](http://gresil.org/jenkins/job/CI-nitdoc/ws/doc/stdlib/index.html)
* [nitc](http://gresil.org/jenkins/job/CI-nitdoc/ws/doc/nitc/index.html)

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

9 years agoMerge: nitrpg: minor enhancements
Jean Privat [Wed, 22 Apr 2015 04:18:11 +0000 (11:18 +0700)]
Merge: nitrpg: minor enhancements

Mainly designed to fully close #1168 and work on #1161.

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

9 years agonitpretty: fixes typo in option comment
Alexandre Terrasa [Tue, 21 Apr 2015 23:48:47 +0000 (19:48 -0400)]
nitpretty: fixes typo in option comment

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

9 years agoshare/man: Update man for `nitpretty`
Alexandre Terrasa [Tue, 21 Apr 2015 23:47:36 +0000 (19:47 -0400)]
share/man: Update man for `nitpretty`

Fixes #1130

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

9 years agocontrib/nitrpg: add a Comparator to sort games by number of players
Alexandre Terrasa [Tue, 21 Apr 2015 23:33:20 +0000 (19:33 -0400)]
contrib/nitrpg: add a Comparator to sort games by number of players

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

9 years agocontrib/nitrpg: return 404 on bad urls
Alexandre Terrasa [Mon, 23 Feb 2015 13:10:48 +0000 (14:10 +0100)]
contrib/nitrpg: return 404 on bad urls

Fixes #1168

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

9 years agocontrib/nitrpg: display the list of active games in /games
Alexandre Terrasa [Mon, 23 Feb 2015 12:54:23 +0000 (13:54 +0100)]
contrib/nitrpg: display the list of active games in /games

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

9 years agocontrib/nitrpg: display the readme and the active game list in homepage.
Alexandre Terrasa [Mon, 23 Feb 2015 12:50:27 +0000 (13:50 +0100)]
contrib/nitrpg: display the readme and the active game list in homepage.

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

9 years agocontrib/nitrpg: factorize game loading service from GameAction
Alexandre Terrasa [Mon, 23 Feb 2015 12:37:29 +0000 (13:37 +0100)]
contrib/nitrpg: factorize game loading service from GameAction

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

9 years agocontrib/nitrpg: add GamesListPanel to display the list of active games
Alexandre Terrasa [Mon, 23 Feb 2015 12:36:41 +0000 (13:36 +0100)]
contrib/nitrpg: add GamesListPanel to display the list of active games

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

9 years agocontrib/nitrpg: add MDPanel to display MDContent
Alexandre Terrasa [Mon, 23 Feb 2015 12:36:20 +0000 (13:36 +0100)]
contrib/nitrpg: add MDPanel to display MDContent

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

9 years agocontrib/nitrpg: add a README file
Alexandre Terrasa [Mon, 23 Feb 2015 12:35:43 +0000 (13:35 +0100)]
contrib/nitrpg: add a README file

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

9 years agocontrib/nitrpg: add some achievements on IssueComments
Alexandre Terrasa [Mon, 23 Feb 2015 11:07:04 +0000 (12:07 +0100)]
contrib/nitrpg: add some achievements on IssueComments

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

9 years agomodel: add missing service to retrieve a AClassDef from a MClassDef.
Alexandre Terrasa [Tue, 21 Apr 2015 20:24:18 +0000 (16:24 -0400)]
model: add missing service to retrieve a AClassDef from a MClassDef.

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

9 years agomodel: avoid running phase on fictive module
Alexandre Terrasa [Tue, 21 Apr 2015 20:23:43 +0000 (16:23 -0400)]
model: avoid running phase on fictive module

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

9 years agocontrib/inkscape_tools: update README.md file
Alexis Laferrière [Tue, 21 Apr 2015 10:09:24 +0000 (06:09 -0400)]
contrib/inkscape_tools: update README.md file

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

9 years agocontrib/inkscape_tools: make rounding to the next power of 2 optional
Alexis Laferrière [Tue, 21 Apr 2015 10:03:43 +0000 (06:03 -0400)]
contrib/inkscape_tools: make rounding to the next power of 2 optional

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

9 years agocontrib/inkscape_tools: add alternative code generation for gamnit target
Alexis Laferrière [Sun, 19 Apr 2015 16:38:16 +0000 (12:38 -0400)]
contrib/inkscape_tools: add alternative code generation for gamnit target

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

9 years agocontrib/inkscape_tools: refactor main code into 2 new classes
Alexis Laferrière [Tue, 21 Apr 2015 09:56:21 +0000 (05:56 -0400)]
contrib/inkscape_tools: refactor main code into 2 new classes

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

9 years agosrc/doc: clean signature HTML output with `html_signature` and `html_short_signature`
Alexandre Terrasa [Mon, 23 Feb 2015 19:45:42 +0000 (20:45 +0100)]
src/doc: clean signature HTML output with `html_signature` and `html_short_signature`

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

9 years agosrc/doc: rename `tpl_namespace` in `html_namespace` also clean comments
Alexandre Terrasa [Mon, 23 Feb 2015 19:12:37 +0000 (20:12 +0100)]
src/doc: rename `tpl_namespace` in `html_namespace` also clean comments

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

9 years agosrc/doc: rename `tpl_declaration` in `html_declaration` and uniformize output
Alexandre Terrasa [Mon, 23 Feb 2015 18:59:28 +0000 (19:59 +0100)]
src/doc: rename `tpl_declaration` in `html_declaration` and uniformize output

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

9 years agosrc/doc: rename `tpl_anchor` into `html_link_to_anchor` and use bootstrap template
Alexandre Terrasa [Mon, 23 Feb 2015 18:17:31 +0000 (19:17 +0100)]
src/doc: rename `tpl_anchor` into `html_link_to_anchor` and use bootstrap template

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

9 years agosrc/doc: rename `tpl_link` into `html_link` and use bootstrap template
Alexandre Terrasa [Tue, 21 Apr 2015 12:28:48 +0000 (08:28 -0400)]
src/doc: rename `tpl_link` into `html_link` and use bootstrap template

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

9 years agocontrib/inkscape_tools: add option for the full path to the generated source
Alexis Laferrière [Thu, 16 Apr 2015 15:40:44 +0000 (11:40 -0400)]
contrib/inkscape_tools: add option for the full path to the generated source

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

9 years agocontrib/inkscape_tools: revamp doc of svg_to_png_and_nit
Alexis Laferrière [Thu, 16 Apr 2015 15:38:29 +0000 (11:38 -0400)]
contrib/inkscape_tools: revamp doc of svg_to_png_and_nit

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

9 years agolib/mnit: fix and improve magnification for a pixelized (to smooth) look
Alexis Laferrière [Wed, 11 Mar 2015 15:10:09 +0000 (11:10 -0400)]
lib/mnit: fix and improve magnification for a pixelized (to smooth) look

The new OpenGL paramenter act of the display of images:
* When zoomed out, the image is smoother, the color values are interpolated
  from the neares source pixels.
* When zoomed in, the image is displayed pixelized.

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

9 years agolib/mnit: print the approximate memory used by textures loaded in memory
Alexis Laferrière [Sun, 22 Feb 2015 18:07:16 +0000 (13:07 -0500)]
lib/mnit: print the approximate memory used by textures loaded in memory

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

9 years agolib/mnit: expand images to the nearest power of 2 for OpenGL ES 1.0
Alexis Laferrière [Sun, 22 Feb 2015 17:55:49 +0000 (12:55 -0500)]
lib/mnit: expand images to the nearest power of 2 for OpenGL ES 1.0

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

9 years agolib/mnit: use PRINT_ERROR instead of printf on portable code
Alexis Laferrière [Sun, 22 Feb 2015 17:54:03 +0000 (12:54 -0500)]
lib/mnit: use PRINT_ERROR instead of printf on portable code

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

9 years agocontrib/inkscape_tools: remove old_style constructor and whitespace error
Alexis Laferrière [Thu, 16 Apr 2015 15:37:35 +0000 (11:37 -0400)]
contrib/inkscape_tools: remove old_style constructor and whitespace error

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

9 years agoMerge: Default arguments
Jean Privat [Sun, 19 Apr 2015 00:07:12 +0000 (07:07 +0700)]
Merge: Default arguments

Default arguments (aka parameters with a default value) are often a nice way to provide a complex operation with a lot of variations but allow the client to use it in a simple form when no complexity is required.
Also, it allows to extends the signature of existing operations while being API-compatible with previous versions.

This PR introduces default arguments to Nit as another tool in the toolbox of library designers.

The specification is quite simple:

* a nullable parameter can be ignored, the value of the argument will default to null

~~~nit
fun foo(a: Int, b: nullable Int) do ...
foo(1)
foo(1, null)  # equivalent thing
~~~

* default parameters can be anywhere (not necessarily at the end)

~~~nit
fun foo(a: nullable Int, b: Int) do ...
foo(1)
foo(null, 1)  # equivalent thing
~~~

* when there is multiple possible associations between arguments and parameters, arguments will be associated to the leftmost (first) parameter first.

~~~nit
fun foo(a, b: nullable Int) do ...
foo(1)
foo(1, null)  # equivalent thing
~~~

* if there is a vararg, all other parameters are mandatory (no default)

~~~nit
fun foo(a: Int..., b: nullable Int) do ...
foo(1) # Error: minimum 2 arguments (we chose that varargs require a minimum of 1 argument, but this old choice is a different issue)
foo(1, 2) # OK
foo([1]..., 2) # equivalent thing
~~~

* the last parameter of an assignment method (that is the right value of the assignment) is never default. For POLA reasons, the last argument is distinguished and syntactically mandatory, so the association with the parameter is always direct and unambiguous.

~~~nit
fun foo=(a, b: nullable Int) do ...
foo = 1
foo(null) = 1 # equivalent thing
~~~

I chose this specification because it uses the nullable facility of Nit in a nice way and is somewhat semantic: `null` means nothing to say, or keep it blank.
I prefer it over the specification of other languages that is to declare a specific default value on the declaration of parameters.

* no need not to update the grammar
* no need to specify the language of the default value (any expressions? only literal? other?)
* no need to specify when and by who the default value is evaluated (and what is the value of self? are the other parameters usable in the expression? etc.)
* no need to specify how to deal with default values on redefinitions in a OO point of view (do I inherit the default value? can I `super` the default value?)
* no need to expose the expressions used as default values in the metamodel
* no need to expose the expressions used as default values in the doc

Most of these things make the language less KISS (obviously), and less POLA because whatever spec we can choose for these points, 1) not 100% of user will find them obvious; and 2) for some cases the wanted behavior will not be the specified one.

Note that in Python, while they allow to define a specific default value on parameters, they recommend to use `null` as a default to avoid most of these aforementioned problems.

Note2: this PR was unlocked by #1269 and #1268

Pull-Request: #1280
Reviewed-by: Etienne M. Gagnon <egagnon@j-meg.com>
Reviewed-by: Alexis Laferrière <alexis.laf@xymus.net>
Reviewed-by: Ait younes Mehdi Adel <overpex@gmail.com>
Reviewed-by: Lucas Bajolet <r4pass@hotmail.com>

9 years agotests: add base_arg_default*.nit
Jean Privat [Thu, 16 Apr 2015 11:40:15 +0000 (18:40 +0700)]
tests: add base_arg_default*.nit

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

9 years agoneo: save MParameter::is_default
Jean Privat [Sat, 18 Apr 2015 14:49:32 +0000 (21:49 +0700)]
neo: save MParameter::is_default

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

9 years agotyping&engines: implement default arguments
Jean Privat [Sat, 18 Apr 2015 13:40:26 +0000 (20:40 +0700)]
typing&engines: implement default arguments

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

9 years agomodel&modelize: introduce default parameters
Jean Privat [Thu, 16 Apr 2015 11:11:09 +0000 (18:11 +0700)]
model&modelize: introduce default parameters

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

9 years agoMerge: Snake phase names
Jean Privat [Sat, 18 Apr 2015 09:47:34 +0000 (16:47 +0700)]
Merge: Snake phase names

Default name of phases where based on a lower cased version of their classnames.
That was bad. eg `FFILanguageAssignationPhase` -> `ffilanguageassignation`

So this PR snakecase them instead.

But the spec of `to_snake_case` was awful: `f_f_i_language_assignation`

So also fix the spec of this method and get something nice `ffi_language_assignation`.

Pull-Request: #1276
Reviewed-by: Alexis Laferrière <alexis.laf@xymus.net>
Reviewed-by: Romain Chanoir <chanoir.romain@courrier.uqam.ca>
Reviewed-by: Alexandre Terrasa <alexandre@moz-code.org>

9 years agoMerge: Microbenches for niti
Jean Privat [Sat, 18 Apr 2015 09:47:26 +0000 (16:47 +0700)]
Merge: Microbenches for niti

Some update on tests/ so that niti (and nitvm) can pass more tests

Pull-Request: #1275
Reviewed-by: Alexandre Terrasa <alexandre@moz-code.org>
Reviewed-by: Alexis Laferrière <alexis.laf@xymus.net>
Reviewed-by: Romain Chanoir <chanoir.romain@courrier.uqam.ca>

9 years agoMerge: Autocast and literal arrays
Jean Privat [Sat, 18 Apr 2015 09:47:17 +0000 (16:47 +0700)]
Merge: Autocast and literal arrays

Small bugfixes

* forbid autocasts in combined assignments and literal arrays
* keep autocast information in transform
* rta visits implicit methods of literal arrays

Only the first one was the original bug I wanted to fix, the two others where discovered and solved while writing the PR.

Pull-Request: #1272
Reviewed-by: Alexis Laferrière <alexis.laf@xymus.net>
Reviewed-by: Romain Chanoir <chanoir.romain@courrier.uqam.ca>

9 years agoMerge: Option --keep-going
Jean Privat [Sat, 18 Apr 2015 09:47:09 +0000 (16:47 +0700)]
Merge: Option --keep-going

Follow up of #959 and #1241. Now an option is exposed so people can happily try to use it on various tools that will turn them berserk and make them want to kill you.

Pull-Request: #1270
Reviewed-by: Alexis Laferrière <alexis.laf@xymus.net>
Reviewed-by: Romain Chanoir <chanoir.romain@courrier.uqam.ca>

9 years agoMerge: Check operator
Jean Privat [Sat, 18 Apr 2015 09:47:00 +0000 (16:47 +0700)]
Merge: Check operator

Previously, no checking was done on the signature of operators.
While this is not an issue for the model nor the tools this could yield to not POLA error messages when the operator is used. eg.

~~~nit
class A
   fun +(other: A) do print "hello"
end
var a = new A
var b = a + a # Error expected expression
a + a # Error unexpected operator +
# no way do invoke `+` in fact.
~~~

With the PR, we have

~~~
Error: mandatory return type for `+`.
fun +(other: A) do print "hello"
    ^
~~~

The following errors are added by the PR:

* mandatory return
* not enough parameters
* too much parameters
* illegal variadic parameter

Pull-Request: #1269
Reviewed-by: Alexandre Terrasa <alexandre@moz-code.org>
Reviewed-by: Alexis Laferrière <alexis.laf@xymus.net>
Reviewed-by: Romain Chanoir <chanoir.romain@courrier.uqam.ca>

9 years agoMerge: Signature map
Jean Privat [Sat, 18 Apr 2015 09:46:51 +0000 (16:46 +0700)]
Merge: Signature map

Provide an abstraction `SingatureMap` to factorize (and simplify) the association between arguments and parameters (not that easy in the context of varargs).

This PR is also required by a future PR.

Pull-Request: #1268
Reviewed-by: Alexandre Terrasa <alexandre@moz-code.org>
Reviewed-by: Alexis Laferrière <alexis.laf@xymus.net>
Reviewed-by: Romain Chanoir <chanoir.romain@courrier.uqam.ca>

9 years agotests: update test_ffi_c_operators for << and >>
Jean Privat [Thu, 16 Apr 2015 13:34:47 +0000 (20:34 +0700)]
tests: update test_ffi_c_operators for << and >>

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

9 years agotests: add error_operators.nit
Jean Privat [Thu, 16 Apr 2015 11:04:11 +0000 (18:04 +0700)]
tests: add error_operators.nit

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

9 years agomodelize_property: implement special validity rules for operators
Jean Privat [Thu, 16 Apr 2015 11:01:11 +0000 (18:01 +0700)]
modelize_property: implement special validity rules for operators

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

9 years agotests: update test_new_native.res because line change in array.nit
Jean Privat [Sat, 18 Apr 2015 09:36:31 +0000 (16:36 +0700)]
tests: update test_new_native.res because line change in array.nit

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

9 years agointerpreter: use SignatureMap to make varargize more robust
Jean Privat [Thu, 16 Apr 2015 09:57:27 +0000 (16:57 +0700)]
interpreter: use SignatureMap to make varargize more robust

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