nit.git
9 years agoMerge branch 'master' into polymorphic_extern_classes
Alexis Laferrière [Wed, 10 Sep 2014 18:54:40 +0000 (14:54 -0400)]
Merge branch 'master' into polymorphic_extern_classes

9 years agoniti: fix type in tool description
Alexis Laferrière [Wed, 10 Sep 2014 18:45:36 +0000 (14:45 -0400)]
niti: fix type in tool description

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

9 years agolib/curl: fix missing import of string.h and clean up header
Alexis Laferrière [Wed, 10 Sep 2014 17:58:40 +0000 (13:58 -0400)]
lib/curl: fix missing import of string.h and clean up header

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

9 years agonitg*: extern classes a polymorph in Nit, and unboxed only for extern methods
Alexis Laferrière [Tue, 22 Jul 2014 17:32:13 +0000 (13:32 -0400)]
nitg*: extern classes a polymorph in Nit, and unboxed only for extern methods

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

9 years agoMerge: Markdown
Jean Privat [Wed, 10 Sep 2014 00:48:45 +0000 (20:48 -0400)]
Merge: Markdown

# lib: Introduce `markdown`, a Markdown parser for Nit.

_Please consider only f9c54c4, since previous commit are merged from #627._

This is the first step towards a better markdown interpretation into Nit code comments.
Next step will be to replace the current markdown parser used in `src/markdown`.

This parser try to be a little more closer to the Markdown specification from http://daringfireball.net/projects/markdown/ than the actual parser.
That said, some rules are not strictly followed as explained in the `README`.
Some other rules or features are not yet fully implemented, see `TODO` and `FIXME` in code.

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

9 years agoMerge: Clean AMethPropdef clients
Jean Privat [Tue, 9 Sep 2014 22:04:00 +0000 (18:04 -0400)]
Merge: Clean AMethPropdef clients

1. Update code to not rely on specific subclasses of AMethPropdef
2. Implements alternative path where abstract, intern and extern are annotations

The next PR should modify the grammar.

Pull-Request: #736
Reviewed-by: Alexandre Terrasa <alexandre@moz-code.org>
Reviewed-by: Lucas Bajolet <r4pass@hotmail.com>

9 years agoMerge: pkgconfig annotation uses the module name if no packages are specified
Jean Privat [Tue, 9 Sep 2014 22:03:56 +0000 (18:03 -0400)]
Merge: pkgconfig annotation uses the module name if no packages are specified

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

9 years agoMerge: Regular expressions & prop to bring back a better `String::has(Pattern)`
Jean Privat [Tue, 9 Sep 2014 22:03:53 +0000 (18:03 -0400)]
Merge: Regular expressions & prop to bring back a better `String::has(Pattern)`

As asked by everyone...

`String::has(Pattern)` is much faster than `String::index_of(Pattern)` with regex. It can be optimized even more with `optimize_is_in`.

I'll be waiting after the test to make sure that it doesn't break anything.

What do you think of the doc/tests on the protected methods? I don't have any info to add, only tests and `requires`.

The only TODO would be to implement subexpressions; to get the the substrings of the parenthetical subexpressions of a single match. It is not the most common use but could be useful in some compilers.

Pull-Request: #732
Reviewed-by: Jean Privat <jean@pryen.org>
Reviewed-by: Alexandre Terrasa <alexandre@moz-code.org>
Reviewed-by: Lucas Bajolet <r4pass@hotmail.com>

9 years agoMerge: Superclasses ordering in nitvm and a bug fix
Jean Privat [Tue, 9 Sep 2014 22:03:41 +0000 (18:03 -0400)]
Merge: Superclasses ordering in nitvm and a bug fix

The first commit fixes a bug in the allocation of internal attributes structures.

The second commit introduces structures for saving the offsets of each block of methods and attributes in each class.
For now, this is not used, but later this will help the compilation/recompilation protocol to chose which implementation mechanism could be used for a given call site.

The third commit presents an algorithm for ordering superclasses (a kind of linearization). This computed order is the order of classes in virtual tables.
This order is computed to follow the rule called "prefix condition": for a given class that we are currently ordering, we try to put the order of one of its direct superclasses in prefix of its own order.

Pull-Request: #728
Reviewed-by: Lucas Bajolet <r4pass@hotmail.com>
Reviewed-by: Alexandre Terrasa <alexandre@moz-code.org>
Reviewed-by: Jean Privat <jean@pryen.org>

9 years agoMerge: Benitlux web interface
Jean Privat [Tue, 9 Sep 2014 22:03:15 +0000 (18:03 -0400)]
Merge: Benitlux web interface

Also:
* Fix nitserial
* Improve nitcorn
* Add the config of xymus.net as example for nitcorn

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

9 years agoffi: use `AMethPropdef` instead of `AExternPropdef`
Jean Privat [Tue, 9 Sep 2014 19:42:21 +0000 (15:42 -0400)]
ffi: use `AMethPropdef` instead of `AExternPropdef`

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

9 years agotests: update tests for markdown.
Alexandre Terrasa [Wed, 3 Sep 2014 17:33:24 +0000 (13:33 -0400)]
tests: update tests for markdown.

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

9 years agotests: rename `test_markdown.nit` to `test_docdown` to avoid name conflicts with...
Alexandre Terrasa [Wed, 3 Sep 2014 17:33:10 +0000 (13:33 -0400)]
tests: rename `test_markdown.nit` to `test_docdown` to avoid name conflicts with `lib/markdown`.

`src/markdown` will be replaced by `src/doc_down` in a later PR.

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

9 years agolib: Introduce `markdown`, a Markdown parser for Nit.
Alexandre Terrasa [Wed, 3 Sep 2014 14:20:22 +0000 (10:20 -0400)]
lib: Introduce `markdown`, a Markdown parser for Nit.

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

9 years agoserialisation_phase: use `AMethPropdef` instead of `AConcreteInitPropdef`
Jean Privat [Tue, 9 Sep 2014 19:35:11 +0000 (15:35 -0400)]
serialisation_phase: use `AMethPropdef` instead of `AConcreteInitPropdef`

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

9 years agomodelize: works if abstract, intern and extern are annotations
Jean Privat [Tue, 9 Sep 2014 19:34:57 +0000 (15:34 -0400)]
modelize: works if abstract, intern and extern are annotations

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

9 years agolib: intro `re`, regular expressions in Nit
Alexis Laferrière [Mon, 8 Sep 2014 21:13:44 +0000 (17:13 -0400)]
lib: intro `re`, regular expressions in Nit

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

9 years agolib: update egl, glesv2 & x11 to use pkgconfig without args
Alexis Laferrière [Fri, 18 Apr 2014 21:49:47 +0000 (17:49 -0400)]
lib: update egl, glesv2 & x11 to use pkgconfig without args

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

9 years agopkgconfig: if there is no argument, use the module name
Alexis Laferrière [Fri, 18 Apr 2014 21:46:27 +0000 (17:46 -0400)]
pkgconfig: if there is no argument, use the module name

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

9 years agomodel: intro a service to get the `Pointer` type
Alexis Laferrière [Tue, 22 Jul 2014 17:31:21 +0000 (13:31 -0400)]
model: intro a service to get the `Pointer` type

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

9 years agonitvm: Introduce a custom algorithm for ordering superclasses
Julien Pagès [Mon, 8 Sep 2014 14:26:34 +0000 (16:26 +0200)]
nitvm: Introduce a custom algorithm for ordering superclasses

Signed-off-by: Julien Pagès <julien.projet@gmail.com>

9 years agonitvm: Keep the positions of methods and attributes blocks in each class
Julien Pagès [Mon, 8 Sep 2014 14:23:50 +0000 (16:23 +0200)]
nitvm: Keep the positions of methods and attributes blocks in each class

Signed-off-by: Julien Pagès <julien.projet@gmail.com>

9 years agonitvm: Fixing a bad allocation of internal structures for attributes
Julien Pagès [Tue, 22 Jul 2014 07:50:16 +0000 (09:50 +0200)]
nitvm: Fixing a bad allocation of internal structures for attributes

Signed-off-by: Julien Pagès <julien.projet@gmail.com>

9 years agotests: fix sav of xymus.net config
Alexis Laferrière [Tue, 9 Sep 2014 02:00:46 +0000 (22:00 -0400)]
tests: fix sav of xymus.net config

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

9 years agolib: replace `String.has(Char)` with `String.has(Pattern)`
Alexis Laferrière [Mon, 8 Sep 2014 22:27:31 +0000 (18:27 -0400)]
lib: replace `String.has(Char)` with `String.has(Pattern)`

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

9 years agoMerge: neo: Forces MParameter ranking in MSignatures
Jean Privat [Mon, 8 Sep 2014 20:30:27 +0000 (16:30 -0400)]
Merge: neo: Forces MParameter ranking in MSignatures

Also update corresponding test and make test sav more easy to read.

This PR provides two fixes and close #725:

1- use the MParameter `rank` node property to order the mparameters in the signature
2- use the MSignature `parameter_names` to get the declaration order of the parameters (so you don't have to load the MParameters nodes to display the short `MSignature`).

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

9 years agoMerge: Chain implememtations
Jean Privat [Mon, 8 Sep 2014 20:30:25 +0000 (16:30 -0400)]
Merge: Chain implememtations

Change in engine so the selected implementation is more abstract and has some kind of fall-back.

1. if intern or extern, try to get the specific implementation
2. else try to compile the body
3. else compile an error

The point is top prepare a future PR where intern and extern methods could provide an alternative (slow or degraded) implementation.

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

9 years agoMerge: phases: do not reanalyze amodules in run_phase
Jean Privat [Mon, 8 Sep 2014 20:30:20 +0000 (16:30 -0400)]
Merge: phases: do not reanalyze amodules in run_phase

Multiple `run_phase` invocation should not analyze a amodule twice.

This is a workaround, the whole phase API should be improved to make late
module loading less error-prone and more simple.

Close #726

Pull-Request: #729
Reviewed-by: Lucas Bajolet <r4pass@hotmail.com>
Reviewed-by: Alexandre Terrasa <alexandre@moz-code.org>

9 years agoMerge: nitpick, the nit lintian
Jean Privat [Mon, 8 Sep 2014 20:30:18 +0000 (16:30 -0400)]
Merge: nitpick, the nit lintian

Check Nit programs for issues and other stuff.

Currently, only a fast checker to use with the vim plugin.
50% faster than before.

~~~
$ time nitg nitg.nit --only-metamodel
user 0m1.752s
$ time nitpick nitg.nit
user 0m0.872s
~~~

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

9 years agoneo: Forces MParameter ranking in MSignatures
Alexandre Terrasa [Mon, 8 Sep 2014 18:34:48 +0000 (14:34 -0400)]
neo: Forces MParameter ranking in MSignatures

Also update corresponding test and make test sav more easy to read.

Fixes #725

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

9 years agoniti: chain implementation attempts
Jean Privat [Mon, 8 Sep 2014 13:45:40 +0000 (09:45 -0400)]
niti: chain implementation attempts

1. intern/extern
2. body
3. abort

Because of the lack of multiple return, `intern_call` returns an instance,
null, or a false object to indicate the error.

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

9 years agocomp: chain implementation attempts
Jean Privat [Mon, 8 Sep 2014 15:15:02 +0000 (11:15 -0400)]
comp: chain implementation attempts

1. intern/extern
2. body
3. abort

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

Conflicts:
src/modelize/modelize_property.nit

9 years agophases: do not reanalyze amodules in run_phase
Jean Privat [Mon, 8 Sep 2014 14:28:47 +0000 (10:28 -0400)]
phases: do not reanalyze amodules in run_phase

Multiple `run_phase` invocation should not analyze a amodule twice.

This is a workaround, the whole phase API should be improved to make late
module loading less error-prone and more simple.

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

9 years agopep8analysis: use header of xymus.net
Alexis Laferrière [Tue, 29 Jul 2014 15:19:00 +0000 (11:19 -0400)]
pep8analysis: use header of xymus.net

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

9 years agoexamples: add the config of xymus.net as a nitcorn example
Alexis Laferrière [Thu, 24 Jul 2014 15:49:29 +0000 (11:49 -0400)]
examples: add the config of xymus.net as a nitcorn example

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

9 years agocontrib: intro the benitlux project
Alexis Laferrière [Fri, 18 Jul 2014 06:31:36 +0000 (02:31 -0400)]
contrib: intro the benitlux project

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

9 years agoMerge: New `deprecated` annotation
Jean Privat [Mon, 8 Sep 2014 13:33:25 +0000 (09:33 -0400)]
Merge: New `deprecated` annotation

The `deprecated` annotation is used on methods to produce warnings when called in a non-deprecated method.

Instead of a simple Boolean flag, deprecation is a rich model information structure that can contains some documentation, and later be extended (eg. version information, suggested substitution, etc.).

Example:
~~~
class A
   # standard documentation
   fun foo is
      # doc for the deprecation
      deprecated
   do
     stuff
   end
end
~~~

Migration of the existing code to use `deprecated`will done in a future PR, once #719 is merged to avoid conflicts.

nitdoc need also to be extended and presents deprecation information. (see #640)
Since the deprecation documentation is autonomous, it could be displayed specifically (eg. in a colored box)

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

9 years agoMerge: make: initial make build nitpretty.
Jean Privat [Mon, 8 Sep 2014 13:14:08 +0000 (09:14 -0400)]
Merge: make: initial make build nitpretty.

Also rearrange the order of compilation.

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

9 years agoMerge: src: transform all old `writable` in annotations
Jean Privat [Mon, 8 Sep 2014 13:14:04 +0000 (09:14 -0400)]
Merge: src: transform all old `writable` in annotations

So just insert an `is`, and move it after the initial value if any.

~~~
sed -i '/ is /!s/\(\( redef\)\?\( protected\)\? writable\)\(.*\)/\4 is\1/'
~~~

The following commits disable old-style attributes and setters in modelize_rpoperty to prevent any reintroduction of them.

This prepare a future PR where old-style attributes and setters are removed from the parser.

Close #280

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

9 years agotests: add sav/nitpick.res
Jean Privat [Sat, 6 Sep 2014 19:29:23 +0000 (15:29 -0400)]
tests: add sav/nitpick.res

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

9 years agovim: use nitpick for faster syntastic
Jean Privat [Sat, 6 Sep 2014 15:37:31 +0000 (11:37 -0400)]
vim: use nitpick for faster syntastic

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

9 years agosrc: new tool nitpick
Jean Privat [Sat, 6 Sep 2014 15:35:20 +0000 (11:35 -0400)]
src: new tool nitpick

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

9 years agotests: add base_deprecated
Jean Privat [Sat, 6 Sep 2014 13:42:26 +0000 (09:42 -0400)]
tests: add base_deprecated

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

9 years agophase: add an indirection to process_npropdef so that specifc toolcontext can control it
Jean Privat [Sat, 6 Sep 2014 15:33:46 +0000 (11:33 -0400)]
phase: add an indirection to process_npropdef so that specifc toolcontext can control it

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

9 years agomodelize: introduce annotation
Jean Privat [Sat, 6 Sep 2014 13:39:31 +0000 (09:39 -0400)]
modelize: introduce annotation

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

9 years agomodelize: set_doc takes the modelbuilder
Jean Privat [Sat, 6 Sep 2014 13:36:49 +0000 (09:36 -0400)]
modelize: set_doc takes the modelbuilder

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

9 years agomodel: introduce MDeprecationInfo
Jean Privat [Sat, 6 Sep 2014 13:35:58 +0000 (09:35 -0400)]
model: introduce MDeprecationInfo

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

9 years agomake: initial make build nitpretty. Also rearrange the order of compilation.
Jean Privat [Fri, 5 Sep 2014 22:39:42 +0000 (18:39 -0400)]
make: initial make build nitpretty. Also rearrange the order of compilation.

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

9 years agotests: update but disable nitpretty_args22 since it segfaults
Jean Privat [Fri, 5 Sep 2014 22:08:18 +0000 (18:08 -0400)]
tests: update but disable nitpretty_args22 since it segfaults

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

9 years agomodelize_property: disable old-style attributes
Jean Privat [Fri, 5 Sep 2014 19:27:17 +0000 (15:27 -0400)]
modelize_property: disable old-style attributes

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

9 years agomodelize_property: disable old-style setter
Jean Privat [Fri, 5 Sep 2014 19:26:56 +0000 (15:26 -0400)]
modelize_property: disable old-style setter

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

9 years agosrc: transform all old writable in annotations
Jean Privat [Fri, 5 Sep 2014 00:49:39 +0000 (20:49 -0400)]
src: transform all old writable in annotations

So just insert an `is`, and move it after the initial value if any.

~~~
sed -i '/ is /!s/\(\( redef\)\?\( protected\)\? writable\)\(.*\)/\4 is\1/'
~~~

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

9 years agoMerge: Nitdoc: some cleaning and fixes.
Jean Privat [Fri, 5 Sep 2014 10:34:42 +0000 (06:34 -0400)]
Merge: Nitdoc: some cleaning and fixes.

Some small fixes for nitdoc before the introduction of new features.

No concrete impact on visual for now.

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

9 years agoMerge: Introduce `nitpretty`: a pretty printer for nit source files.
Jean Privat [Fri, 5 Sep 2014 10:34:22 +0000 (06:34 -0400)]
Merge: Introduce `nitpretty`: a pretty printer for nit source files.

# Commit summary

First commit introduce the tool (formated with nitpretty).
Second commit add tests for nitpretty.
Last two commits propose an update of lib files formatted with nitpretty.

# Tool Description

`nitpretty` is a tool able to pretty print Nit files.

Usage:

    $ nitpretty source.nit

Main options:

* `-o res.nit` output result into `res.nit`
* `--diff` show diff between `source` and `res`
* `--meld` open diff with `meld`
* `--check` check the format of multiple source files
* `--check --meld` perform `--check` and open `meld` for each difference

## Specification

The specification of the pretty printing is described here.

* Default indentation level is one `' '` character and
is increased by one for each indentation level.
* Default line max-size is 80.

### Comments

There is many categories of comments:

`Licence comments` are attached to the top of the file
no blank line before, one after.

    # This is a licence comment

    # Documentation for module `foo`
    module foo

`ADoc` are documentation comments attached to a `AModule`, `AClassdef`, `APropdef`.

They are printed before the definition with a blank line before and no after
at the same indentation level than the definition.

    # Documentation for module `foo`
    module foo

    # Documentation for class `Bar`
    class Bar
         # Documentation for method `baz`
         fun baz do end
    end

`Block comments` are comments composed of one or more line rattached to nothing.
They are displayed with one blank line before and after at current indent level.

    <blank>
    # block
    # comment
    <blank>

`Attached comments` are comments attached to a production.
They are printed as this.

    fun foo do # attached comment
    end

`nitpretty` automatically remove multiple blanks between comments:

    # Licence
    # ...
    <blank>
    # Block comment

### Inlinging

Productions are automatically inlined when possible.

Conditions:

* the production must be syntactically inlinable
* the inlined production length is less than `PrettyPrinterVisitor::max-size`
* the production do not contains any comments

### Modules

* There is a blank between the module declaration and its imports
* There is no blank between imports and only one after
* There is a blank between each exten block definition
* There is a blank between each class definition
* There is always a blank line at the end of the module

Example:

    # Documentation for module `foo`
    module foo

    import a
    # import b
    import c

    # Documentation for class `Bar`
    class Bar end

    class Baz end # not a `ADoc` comment

### Classes

* There is no blank between the class definition and its super-classes declarations
* There is no blank between two inlined property definition
* There is a blank between each block definition
* There no blank line at the end of the class definition

Example:

    # Documentation for class `Bar`
    class Bar end

    class Baz
         super Bar

         fun a is abstract
         private fun b do end

         fun c do
              # ...
         end
    end

Generic types have no espace after or before brackets and are separated by a comma and a space:

    class A[E: Type1, F: Type1] do end

### Blocks

* Inlined productions have no blank lines between them
* Block productions have a blank before and after

    var a = 10
    var b = 0

    if a > b then
         # is positive
         print "positive"
    end

    print "end"

### Calls and Binary Ops

Arguments are always printed separated with a comma and a space:

    foo(a, b, c)

Binary ops are always printed wrapped with spaces:

    var c = 1 + 2

Calls and binary ops can be splitted to feat the `max-size` constraint.
Breaking priority is given to arguments declaration after the comma.

    return foo("aaaaaaaaaaaaaaaaaaaaaaaaaa", "bbbbbbbbbbbbbbbbbbbbbbbbbbb",
       "cccccccccccccccccccccccccc")

Binary ops can also be broken to feet the `maz-size` limit:

    return "aaaaaaaaaaaaaaaaaaaaaaaaaa" + "bbbbbbbbbbbbbbbbbbbbbbbbbbb" +
       "cccccccccccccccccccccccccc"

# Fiability of the tool

I tested it on lib/ and verified manually all the changes. The result displayed in the two lasts commits contains no manual transformation (except to adjust some misplaced comments).

I guess that some constructs are not treated as well as they can, I need some user feedback.

There maybe still cases in src/ that are not printed without some bugs so I will not say that it's safe to print and replace files you are working on and have no copy of.

How to stay safe? Simple, commit before applying pretty printing and check the diff after or use options `--diff` or `--meld` to apply changes manually.

I used the option combination `--check --meld` to check and edit all the lib/ files one by one. It was surprinsingly fast but boring...

I also ran the tool on src/ and it ended up with no failures but there still formatting to update, I propose the lazy way: futures users may apply the formatter before commiting files.

# TODO

It can be cool to integrate this with vim or a Nit IDE.
It can also be integrated with some tests hooks before merging.

The `collect_length` calculation is based on `Token::collect_text` so the length is based on the tokens as they are written and not how they will be trasnformed. Furthermore, possibles spaces or trailing comments are not taken into account.

This have two impacts:

* some lines are not break at 80 chars and may overflow by a few chars
* when appliying the pretty printer on an already pretty printed file, some new transformation can append (because some `end` tokens have been removed by the previous execution and production is now shorter and can be inlined).

Possible fixes:

* ran the tool while the fix point if not reached :p
* redefines the `collect_length` method for all production to take spaces into accounts
* pre-do a transformation, test the length of the result then apply the inlining

All but first, can be long to implement for the possibles outcomes so I forward this to future-me "if needed later".

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

9 years agonitdoc: update tests
Alexandre Terrasa [Fri, 5 Sep 2014 03:53:51 +0000 (23:53 -0400)]
nitdoc: update tests

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

9 years agonitdoc:sanitize generated html
Alexandre Terrasa [Fri, 5 Sep 2014 03:26:17 +0000 (23:26 -0400)]
nitdoc:sanitize generated html

Fixes #669.

Remaining errors are related to duplicated html ids in comments.
Those are generated by the markdown parser and will be fixed in
a further pull request.

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

9 years agonitdoc: clean some useless super-strings
Alexandre Terrasa [Fri, 5 Sep 2014 02:17:58 +0000 (22:17 -0400)]
nitdoc: clean some useless super-strings

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

9 years agonitdoc: make `TplLink::text` type less specific
Alexandre Terrasa [Fri, 5 Sep 2014 02:23:54 +0000 (22:23 -0400)]
nitdoc: make `TplLink::text` type less specific

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

9 years agonitdoc: fix `TplArticle::is_empty`
Alexandre Terrasa [Fri, 5 Sep 2014 02:23:03 +0000 (22:23 -0400)]
nitdoc: fix `TplArticle::is_empty`

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

9 years agonitdoc: fix `MEntity::tpl_anchor` documentation
Alexandre Terrasa [Fri, 5 Sep 2014 02:21:40 +0000 (22:21 -0400)]
nitdoc: fix `MEntity::tpl_anchor` documentation

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

9 years agonitdoc: clean some templates generation
Alexandre Terrasa [Thu, 4 Sep 2014 19:04:07 +0000 (15:04 -0400)]
nitdoc: clean some templates generation

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

9 years agonitdoc: fix scroll bar display
Alexandre Terrasa [Thu, 4 Sep 2014 18:59:50 +0000 (14:59 -0400)]
nitdoc: fix scroll bar display

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

9 years agonitdoc: remove unused method `sort_by_public_owner`
Alexandre Terrasa [Mon, 25 Aug 2014 04:56:51 +0000 (00:56 -0400)]
nitdoc: remove unused method `sort_by_public_owner`

Fixes #668

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

9 years agonitdoc: avoid conflicts in MEntity urls
Alexandre Terrasa [Mon, 25 Aug 2014 04:55:17 +0000 (00:55 -0400)]
nitdoc: avoid conflicts in MEntity urls

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

9 years agonitdoc: avoid crash on empty mclassdef list.
Alexandre Terrasa [Mon, 25 Aug 2014 03:24:22 +0000 (23:24 -0400)]
nitdoc: avoid crash on empty mclassdef list.

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

9 years agonitdoc: clean breadcrumbs generation.
Alexandre Terrasa [Mon, 25 Aug 2014 03:18:11 +0000 (23:18 -0400)]
nitdoc: clean breadcrumbs generation.

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

9 years agonitdoc: move page url into `NitdocPage`
Alexandre Terrasa [Mon, 25 Aug 2014 03:01:37 +0000 (23:01 -0400)]
nitdoc: move page url into `NitdocPage`

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

9 years agoMerge: Clean benchs
Jean Privat [Fri, 5 Sep 2014 00:21:51 +0000 (20:21 -0400)]
Merge: Clean benchs

update benchs/bebch_engines.sh to fix issues, add options and programs.

Preview of updated version is available at http://info.uqam.ca/~privat/nitdoc/ ; was run in background on a busy machine, so numbers have a lot of uncertainty.
bench_engines is quite interesting.

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

9 years agoMerge: tests: improve documentation
Jean Privat [Fri, 5 Sep 2014 00:21:48 +0000 (20:21 -0400)]
Merge: tests: improve documentation

Closes #711

Pull-Request: #713
Reviewed-by: Alexandre Terrasa <alexandre@moz-code.org>
Reviewed-by: Lucas Bajolet <r4pass@hotmail.com>

9 years agotests: improve documentation
Jean Privat [Thu, 4 Sep 2014 16:13:38 +0000 (12:13 -0400)]
tests: improve documentation

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

9 years agobench: add generated files for xml and html to .gitignore
Jean Privat [Thu, 4 Sep 2014 15:55:51 +0000 (11:55 -0400)]
bench: add generated files for xml and html to .gitignore

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

9 years agobenchs: produce .xml files conform with junit
Jean Privat [Thu, 4 Sep 2014 15:54:38 +0000 (11:54 -0400)]
benchs: produce .xml files conform with junit

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

9 years agobenchs: add more engines and gc options
Jean Privat [Thu, 4 Sep 2014 00:10:51 +0000 (20:10 -0400)]
benchs: add more engines and gc options

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

9 years agobenchs: update compilation options (faster, slower, etc.)
Jean Privat [Thu, 4 Sep 2014 00:09:39 +0000 (20:09 -0400)]
benchs: update compilation options (faster, slower, etc.)

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

9 years agobenchs: use the bootstraped nitg because it is correcly compiled since d055af3c72
Jean Privat [Thu, 4 Sep 2014 00:08:27 +0000 (20:08 -0400)]
benchs: use the bootstraped nitg because it is correcly compiled since d055af3c72

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

9 years agobenchs: update run programs. Remove pep8analysis because it is too fast
Jean Privat [Thu, 4 Sep 2014 00:06:38 +0000 (20:06 -0400)]
benchs: update run programs. Remove pep8analysis because it is too fast

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

9 years agotests: add meta-tests related to the execution control
Jean Privat [Thu, 4 Sep 2014 00:55:53 +0000 (20:55 -0400)]
tests: add meta-tests related to the execution control

* zzz_tests/zzz_test_args.nit
* zzz_tests/zzz_test_envvar.nit
* zzz_tests/zzz_test_in.nit
* zzz_tests/zzz_test_post_proc.nit
* zzz_tests/zzz_test_write.nit

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

9 years agotests: add licence to existing zzz_tests files
Jean Privat [Thu, 4 Sep 2014 14:01:16 +0000 (10:01 -0400)]
tests: add licence to existing zzz_tests files

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

9 years agolib/pnacl: fix import of extern classes types source files
Alexis Laferrière [Thu, 4 Sep 2014 01:42:21 +0000 (21:42 -0400)]
lib/pnacl: fix import of extern classes types source files

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

9 years agotests: skip nitpretty for niti.
Alexandre Terrasa [Thu, 4 Sep 2014 01:01:38 +0000 (21:01 -0400)]
tests: skip nitpretty for niti.

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

9 years agoMerge: Kill oldstyle attributes
Jean Privat [Thu, 4 Sep 2014 00:20:40 +0000 (20:20 -0400)]
Merge: Kill oldstyle attributes

Remove remaining usage of old style attributes declarations `var _foo`.

Also remove the annotation `old_style_init` in the parser.

Pull-Request: #712
Reviewed-by: Lucas Bajolet <r4pass@hotmail.com>
Reviewed-by: Alexandre Terrasa <alexandre@moz-code.org>

9 years agoMerge: Clean src
Jean Privat [Thu, 4 Sep 2014 00:20:35 +0000 (20:20 -0400)]
Merge: Clean src

Since there is groups in the c_src compiler, use them in src to regroupe related concerns.

Thus, this PR creates new groups:

* modelize (AST-> model)
* semantize (AST+model -> augmented AST)
* frontend (modelize+semantize+other stuff)
* compiler (all compiler-related things)
* interpreter (all interpreter related things)

Some more things remain to discuss latter:

* the status of platforms things: I moved them to compiler, does this make sense?
* I let the nit*.nit and test_*.nit at the top level to have a fast glance of what are the entry points/main modules. Is this a good idea?
* what to do with the remaining modules in the src directory?

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

9 years agopep8analysis: update and remove old-style attributes
Jean Privat [Wed, 3 Sep 2014 18:04:19 +0000 (14:04 -0400)]
pep8analysis: update and remove old-style attributes

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

9 years agotests: update sav because ligne changes in lib
Jean Privat [Wed, 3 Sep 2014 17:47:32 +0000 (13:47 -0400)]
tests: update sav because ligne changes in lib

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

9 years agoparser: regenerate parser_abs.nit
Jean Privat [Wed, 3 Sep 2014 17:48:31 +0000 (13:48 -0400)]
parser: regenerate parser_abs.nit

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

9 years agoparser: remove old-style attributes in xss
Jean Privat [Wed, 3 Sep 2014 15:37:23 +0000 (11:37 -0400)]
parser: remove old-style attributes in xss

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

9 years agoparser: batch remove old style attribute
Jean Privat [Wed, 3 Sep 2014 15:54:34 +0000 (11:54 -0400)]
parser: batch remove old style attribute

~~~
sed -i 's/var _n\(.*: nullable.*\)/var n\1 is writable/' parser/parser_nodes.nit
sed -i 's/var _n\(.*\)/var n\1 is writable, noinit/' parser/parser_nodes.nit
sed -i '/fun n_\(.*\)/d' parser/parser_nodes.nit
sed -i '/init do end/d' parser/parser_nodes.nit
~~~

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

9 years agoparser: remove manual old-style attributes
Jean Privat [Wed, 3 Sep 2014 18:08:23 +0000 (14:08 -0400)]
parser: remove manual old-style attributes

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

9 years agoparser: _location it no more nullable, so use isset for magic when needed
Jean Privat [Wed, 3 Sep 2014 18:07:32 +0000 (14:07 -0400)]
parser: _location it no more nullable, so use isset for magic when needed

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

9 years agotests: add tests for nitpretty
Alexandre Terrasa [Mon, 4 Aug 2014 00:08:23 +0000 (20:08 -0400)]
tests: add tests for nitpretty

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

9 years agosrc: Introduce nitpretty, a pretty printer for Nit
Alexandre Terrasa [Mon, 4 Aug 2014 00:07:32 +0000 (20:07 -0400)]
src: Introduce nitpretty, a pretty printer for Nit

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

9 years agosrc: move model_vis to model
Jean Privat [Wed, 3 Sep 2014 14:11:15 +0000 (10:11 -0400)]
src: move model_vis to model

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

9 years agocontrib/online_ide: fix import of interpreter modules
Jean Privat [Tue, 2 Sep 2014 18:59:37 +0000 (14:59 -0400)]
contrib/online_ide: fix import of interpreter modules

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

9 years agosrc: create groups for related things
Jean Privat [Tue, 2 Sep 2014 16:09:19 +0000 (12:09 -0400)]
src: create groups for related things

File are moved, some minimal change in importations

* modelize
* semantize
* frontend
* compiler
* interpreter

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

9 years agosrc: clean white-spaces and license in some files
Jean Privat [Tue, 2 Sep 2014 19:00:23 +0000 (15:00 -0400)]
src: clean white-spaces and license in some files

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

9 years agosrc/metrics: clean importations
Jean Privat [Wed, 3 Sep 2014 13:55:20 +0000 (09:55 -0400)]
src/metrics: clean importations

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

9 years agolib/posix: fix import for extern classes types
Alexis Laferrière [Wed, 3 Sep 2014 15:11:03 +0000 (11:11 -0400)]
lib/posix: fix import for extern classes types

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

9 years agolib: remove remaining declaration of old-style attributes.
Jean Privat [Wed, 3 Sep 2014 15:06:07 +0000 (11:06 -0400)]
lib: remove remaining declaration of old-style attributes.

Since new-style attributes still allows low-level access to the real
attributes, the migration was easy; although some intrude imports where required.

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

9 years agonitcorn: custom header in FileServer
Alexis Laferrière [Tue, 2 Sep 2014 17:41:42 +0000 (13:41 -0400)]
nitcorn: custom header in FileServer

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

9 years agonitcorn: add utility to produce HTTP error pages (and use it in FileServer)
Alexis Laferrière [Fri, 1 Aug 2014 15:40:32 +0000 (11:40 -0400)]
nitcorn: add utility to produce HTTP error pages (and use it in FileServer)

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