nit.git
9 years agolib/crypto: Added cryptography basic algos to lib
Lucas Bajolet [Tue, 23 Sep 2014 13:52:25 +0000 (09:52 -0400)]
lib/crypto: Added cryptography basic algos to lib

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

9 years agoMerge: markdown: decorator generate headline ids and save them for further use in...
Jean Privat [Tue, 23 Sep 2014 05:01:52 +0000 (01:01 -0400)]
Merge: markdown: decorator generate headline ids and save them for further use in client.

Markdown decorator now remembers outputed headlines.

This will be usefull to reconstruct headline summary from parsed markdown.

Also added a fix on outofbound exception.

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

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

9 years agoMerge: Template strings and macros
Jean Privat [Tue, 23 Sep 2014 05:01:35 +0000 (01:01 -0400)]
Merge: Template strings and macros

# Template strings with macros replacement.

`TemplateString` provides a simple way to customize generic string templates
using macros and replacement.

A macro is represented as a string identifier like `%MACRO%` in the template
string. Using `TemplateString`, macros can be replaced by any `Streamable` data:

    var tpl = new TemplateString("Hello %NAME%!")
    tpl.replace("NAME", "Dave")
    assert tpl.write_to_string == "Hello Dave!"

A macro identifier is valid if:

* starts with an uppercase letter
* contains only numers, uppercase letters or '_'

See `String::is_valid_macro_name` for more details.

## External template files

When using large template files it's recommanded to use external template files.

In external file `example.tpl`:

    <!DOCTYPE html>
    <html lang="en">
     <head>
      <title>%TITLE%</title>
     </head>
     <body>
      <h1>%TITLE%</h1>
      <p>%ARTICLE%</p>
     </body>
    </html>

Loading the template file using `TemplateString`:

    var file = "example.tpl"
    if file.file_exists then
        tpl = new TemplateString.from_file("example.tpl")
        tpl.replace("TITLE", "Home Page")
        tpl.replace("ARTICLE", "Welcome on my site!")
    end

## Outputting

Once macro replacement has been made, the `TemplateString` can be
output like any other `Template` using methods like `write_to`, `write_to_string`
or `write_to_file`.

    tpl = new TemplateString("Hello %NAME%!")
    tpl.replace("NAME", "Dave")
    assert tpl.write_to_string == "Hello Dave!"

## Template correctness

`TemplateString` can be outputed even if all macros were not replaced.
In this case, the name of the macro will be displayed wuthout any replacement.

    tpl = new TemplateString("Hello %NAME%!")
    assert tpl.write_to_string == "Hello %NAME%!"

The `check` method can be used to ensure that all macros were replaced before
performing the output. Warning messages will be stored in `warnings` and can
be used to locate unreplaced macros.

    tpl = new TemplateString("Hello %NAME%!")
    if not tpl.check then
        assert not tpl.warnings.is_empty
        print "Cannot output unfinished template:"
        print tpl.warnings.join("
")
        exit(0)
    else
        tpl.write_to sys.stdout
    end
    assert tpl.write_to_string == "Hello %NAME%!"

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

9 years agoMerge: Nitdoc next
Jean Privat [Tue, 23 Sep 2014 05:01:32 +0000 (01:01 -0400)]
Merge: Nitdoc next

Some improvments for Nitdoc:

* **Better display of big class hierarchies in lists and graphs**: example with class Token: http://gresil.org/jenkins/job/CI-nitdoc/ws/doc/nitc/class_workspace__Token.html

* **Markdownize synopsys**: example with Concerns here: http://gresil.org/jenkins/job/CI-nitdoc/ws/doc/nitc/group_workspace__workspace.html#concerns

* **Better display for mpropdefs definition hierarchies**: example with the `Object::exit` method: http://gresil.org/jenkins/job/CI-nitdoc/ws/doc/nitc/class_standard__Object.html#standard__Object__exit

Also some minor fixes:

* add link to source even in local generation (link to the file so it can be openned in a browser but there is no jumps to lines)
* always redirect to mproperty definition in class page (try to hidde at a maximum the mproperty page so it only accessible from intro definition)

Previews:

* lib: 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: #745
Reviewed-by: Lucas Bajolet <r4pass@hotmail.com>
Reviewed-by: Jean Privat <jean@pryen.org>

9 years agonitdoc: show mpropdefs redef chain in MClass page.
Alexandre Terrasa [Tue, 23 Sep 2014 03:12:50 +0000 (23:12 -0400)]
nitdoc: show mpropdefs redef chain in MClass page.

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

9 years agolib/mnit_android: do not adjust input from C code
Alexis Laferrière [Tue, 12 Aug 2014 18:41:29 +0000 (14:41 -0400)]
lib/mnit_android: do not adjust input from C code

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

9 years agomnit_android: intro `AndroidKeyEvent::is_volume_up/down`
Alexis Laferrière [Tue, 12 Aug 2014 18:42:39 +0000 (14:42 -0400)]
mnit_android: intro `AndroidKeyEvent::is_volume_up/down`

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

9 years agomnit_android: rename `key_char` to implement `to_c`
Alexis Laferrière [Tue, 12 Aug 2014 18:41:57 +0000 (14:41 -0400)]
mnit_android: rename `key_char` to implement `to_c`

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

9 years agolib/tileset: TileSet::subimages is public so it can be scaled and such
Alexis Laferrière [Wed, 25 Jun 2014 21:40:57 +0000 (17:40 -0400)]
lib/tileset: TileSet::subimages is public so it can be scaled and such

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

9 years agocontrib/inkscape_tools: clip one pixel larger to get the whole image
Alexis Laferrière [Sun, 18 May 2014 12:05:36 +0000 (08:05 -0400)]
contrib/inkscape_tools: clip one pixel larger to get the whole image

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

9 years agomarkdown: fix out of bound access on MDLine
Alexandre Terrasa [Tue, 23 Sep 2014 00:05:02 +0000 (20:05 -0400)]
markdown: fix out of bound access on MDLine

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

9 years agomarkdown: decorator generate headline ids and save them for further use in client.
Alexandre Terrasa [Tue, 23 Sep 2014 00:04:33 +0000 (20:04 -0400)]
markdown: decorator generate headline ids and save them for further use in client.

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

9 years agolib: add tests for `TemplateMacro`
Alexandre Terrasa [Mon, 22 Sep 2014 23:39:47 +0000 (19:39 -0400)]
lib: add tests for `TemplateMacro`

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

9 years agolib: introduce `TemplateMacro`.
Alexandre Terrasa [Mon, 22 Sep 2014 23:39:12 +0000 (19:39 -0400)]
lib: introduce `TemplateMacro`.

TemplateMacro is a quick and easy way to replace macros in string by other Streamable replacement.

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

9 years agolib/standard/math: Added function is_even to Int
Lucas Bajolet [Mon, 22 Sep 2014 15:31:29 +0000 (11:31 -0400)]
lib/standard/math: Added function is_even to Int

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

9 years agoMerge: Add and improve warnings
Jean Privat [Mon, 22 Sep 2014 19:26:40 +0000 (15:26 -0400)]
Merge: Add and improve warnings

* Add tags (labels) for warnings. could be used by Jenkins or other tools to group warnings
* Add second-level warnings, called "advice", used to limit warning inflation a la java
* Add new warnings
  * missing doc
  * unread local variable
  * useless empty init
  * useless attribute type <- was already present, but made a advice, instead of a warnings.

Close #722

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

9 years agovim: activate -W for syntactic
Jean Privat [Mon, 22 Sep 2014 13:55:56 +0000 (09:55 -0400)]
vim: activate -W for syntactic

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

9 years agotests: update sav for changed loop-warning message
Jean Privat [Fri, 19 Sep 2014 22:59:29 +0000 (18:59 -0400)]
tests: update sav for changed loop-warning message

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

9 years agoscope: advice for unread local variables
Jean Privat [Fri, 19 Sep 2014 19:52:07 +0000 (15:52 -0400)]
scope: advice for unread local variables

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

9 years agomodelize: advice on useless empty init
Jean Privat [Fri, 19 Sep 2014 19:30:01 +0000 (15:30 -0400)]
modelize: advice on useless empty init

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

9 years agomodelize: advice on missing documentation
Jean Privat [Fri, 19 Sep 2014 19:09:59 +0000 (15:09 -0400)]
modelize: advice on missing documentation

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

9 years agomodelize: useless attribute type is an advice
Jean Privat [Fri, 19 Sep 2014 19:09:30 +0000 (15:09 -0400)]
modelize: useless attribute type is an advice

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

9 years agomodelize: useless-visibility is an advice
Jean Privat [Fri, 19 Sep 2014 19:08:40 +0000 (15:08 -0400)]
modelize: useless-visibility is an advice

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

9 years agotoolcontext: add a new category for warnings: advices.
Jean Privat [Mon, 22 Sep 2014 15:28:35 +0000 (11:28 -0400)]
toolcontext: add a new category for warnings: advices.

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

9 years agoMerge: lib/standard/string: Introducting Copy-on-Write FlatBuffers
Jean Privat [Sat, 20 Sep 2014 18:14:03 +0000 (14:14 -0400)]
Merge: lib/standard/string: Introducting Copy-on-Write FlatBuffers

As requested, implemented a Copy-on-Write mechanism on FlatBuffer, small performance improvement on the to_s operation.

Before :
![cct](https://cloud.githubusercontent.com/assets/1444825/4273670/fef3f1fc-3cec-11e4-9f81-8afaa6e4c92a.png)

After :
![concat](https://cloud.githubusercontent.com/assets/1444825/4273675/028c5bf6-3ced-11e4-93a9-ef20e94ba55f.png)

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

9 years agoMerge: nitcorn: redirect requests of directories to an URI ending with '/'
Jean Privat [Sat, 20 Sep 2014 11:22:29 +0000 (07:22 -0400)]
Merge: nitcorn: redirect requests of directories to an URI ending with '/'

Example: request sent to http://xymus.net/nit will be redirected to http://xymus.net/nit/ (xymus.net) has not been updated yet). It fixes the loading of other assets such as css files.

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

9 years agoMerge: Makefile: Document deeply-nested libraries.
Jean Privat [Sat, 20 Sep 2014 11:22:22 +0000 (07:22 -0400)]
Merge: Makefile: Document deeply-nested libraries.

Ensure that every module in `/lib` is included when calling nitdoc.

Closes #704

Pull-Request: #758
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: neo: Complete the documentation of neo.nit.
Jean Privat [Sat, 20 Sep 2014 11:22:16 +0000 (07:22 -0400)]
Merge: neo: Complete the documentation of neo.nit.

The documentation of the database model missed many attributes and
relationships. I only added the missing documentation.

Signed-off-by: Jean-Christophe Beaupré <jcbrinfo@users.noreply.github.com>

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

9 years agoMerge: Kill old syntax
Jean Privat [Fri, 19 Sep 2014 20:18:27 +0000 (16:18 -0400)]
Merge: Kill old syntax

Grammar is simplified and parser regenerated.

Changes

* one-line annotations can have a single argument without parentheses
* no more old-style attribute declaration
* no more intern, readable and writable as reserved keyword (they are identifiers now)
* intern, extern and abstract are genuine annotations for AMethPropdef
* no more zoo for AMethPropdef subclasses
* Bonus, introduce the power operation `**` (not implemented yet, but parsed)

TODO: see what is broken in nitpretty

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

9 years agotoolcontext: add `error_info` for displaying total errors&warnings
Jean Privat [Fri, 19 Sep 2014 18:54:59 +0000 (14:54 -0400)]
toolcontext: add `error_info` for displaying total errors&warnings

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

9 years agoMerge: introduces `MGroup::default_mmodule`
Jean Privat [Fri, 19 Sep 2014 19:11:14 +0000 (15:11 -0400)]
Merge: introduces `MGroup::default_mmodule`

There is no reason that "the module of a group that has the same name than the group and that is implicitly designated in importations when only the group's name is given" is not a concept of the model with a simple name name and a fully specified semantic.

A step toward #721 and maybe a help for #693

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

9 years agoneo: Explain how arguments of a MClasType are named.
Jean-Christophe Beaupré [Mon, 15 Sep 2014 15:36:10 +0000 (11:36 -0400)]
neo: Explain how arguments of a MClasType are named.

Signed-off-by: Jean-Christophe Beaupré <jcbrinfo@users.noreply.github.com>

9 years agoneo: Correct the documentation of neo.nit according to PR #734.
Jean-Christophe Beaupré [Thu, 11 Sep 2014 13:11:45 +0000 (09:11 -0400)]
neo: Correct the documentation of neo.nit according to PR #734.

Correct minor mistakes in the documentation.

Signed-off-by: Jean-Christophe Beaupré <jcbrinfo@users.noreply.github.com>

9 years agoneo: Complete the documentation of neo.nit.
Jean-Christophe Beaupré [Tue, 9 Sep 2014 14:06:42 +0000 (10:06 -0400)]
neo: Complete the documentation of neo.nit.

The documentation of the database model missed many attributes and
relationships.

Signed-off-by: Jean-Christophe Beaupré <jcbrinfo@users.noreply.github.com>

9 years agolib/standard/string: Fix the case of null items in FlatBuffer when calling to_s
Lucas Bajolet [Fri, 19 Sep 2014 19:01:57 +0000 (15:01 -0400)]
lib/standard/string: Fix the case of null items in FlatBuffer when calling to_s

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

9 years agoMakefile: Document deeply-nested libraries.
Jean-Christophe Beaupré [Fri, 19 Sep 2014 12:24:40 +0000 (08:24 -0400)]
Makefile: Document deeply-nested libraries.

Ensure that every module in /lib/ is included when calling nitdoc.

Signed-off-by: Jean-Christophe Beaupré <jcbrinfo@users.noreply.github.com>

9 years agosrc: add tag to existing warnings
Jean Privat [Fri, 19 Sep 2014 18:17:56 +0000 (14:17 -0400)]
src: add tag to existing warnings

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

9 years agotoolcontext: allow to tag messages
Jean Privat [Fri, 19 Sep 2014 18:16:54 +0000 (14:16 -0400)]
toolcontext: allow to tag messages

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

9 years agotoolcontext: add some documentation
Jean Privat [Fri, 19 Sep 2014 18:15:52 +0000 (14:15 -0400)]
toolcontext: add some documentation

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

9 years agotests: update some AST-related sav/*.res files for tools
Jean Privat [Thu, 18 Sep 2014 15:04:59 +0000 (11:04 -0400)]
tests: update some AST-related sav/*.res files for tools

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

9 years agonitpreyty: remove the oldstyle syntax, there is still some fixme to fix
Jean Privat [Thu, 18 Sep 2014 14:58:01 +0000 (10:58 -0400)]
nitpreyty: remove the oldstyle syntax, there is still some fixme to fix

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

9 years agonitx: remove unused methods `AAttrPropdef::*_accessor`
Jean Privat [Thu, 18 Sep 2014 18:42:02 +0000 (14:42 -0400)]
nitx: remove unused methods `AAttrPropdef::*_accessor`

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

9 years agosrc: remove classes and nodes related to the old syntax
Jean Privat [Thu, 18 Sep 2014 18:41:10 +0000 (14:41 -0400)]
src: remove classes and nodes related to the old syntax

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

9 years agoparser: regenerate the parser
Jean Privat [Thu, 18 Sep 2014 14:09:39 +0000 (10:09 -0400)]
parser: regenerate the parser

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

9 years agogrammar: new power operator `**` (starstar)
Jean Privat [Thu, 18 Sep 2014 13:58:53 +0000 (09:58 -0400)]
grammar: new power operator `**` (starstar)

~~~
var a = 2 ** 3 ** 4
~~~

Not yet implemented in the lib because a regeneration of c_src is needed

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

9 years agogrammar: unify method syntax
Jean Privat [Thu, 18 Sep 2014 13:38:37 +0000 (09:38 -0400)]
grammar: unify method syntax

Only one APropdef subclass for method: AMethPropdef

Specific method definitions are with annotations:

* new annotation `abstract` (still a keyword because `abstract class`)
* activate annotation `extern` (till a keyword because `extern class`)
* intern is no more a reserved keyword

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

9 years agogrammar: remove old-style syntax for attributes
Jean Privat [Thu, 18 Sep 2014 13:33:02 +0000 (09:33 -0400)]
grammar: remove old-style syntax for attributes

* no more `var _foo`
* no more `readable` and `writable` as reserved keywords

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

9 years agogrammar: enable single parentheses-less arguments in one-line annotations
Jean Privat [Thu, 18 Sep 2014 13:26:36 +0000 (09:26 -0400)]
grammar: enable single parentheses-less arguments in one-line annotations

~~~
fun foo is some_annot "hello"
~~~

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

9 years agogrammar: split `expr_atom` into `expr_single`
Jean Privat [Thu, 18 Sep 2014 13:24:24 +0000 (09:24 -0400)]
grammar: split `expr_atom` into `expr_single`

This new priority class enable args without parentheses in
one-line annotation.

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

9 years agolexer: fix `EOF::parser_index` generation.
Jean Privat [Thu, 18 Sep 2014 13:21:10 +0000 (09:21 -0400)]
lexer: fix `EOF::parser_index` generation.

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

9 years agocpp: add missing annotation declaration
Alexis Laferrière [Thu, 18 Sep 2014 16:14:31 +0000 (12:14 -0400)]
cpp: add missing annotation declaration

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

9 years agonitcorn: minor fix in the header of the HTML page
Alexis Laferrière [Thu, 18 Sep 2014 16:14:03 +0000 (12:14 -0400)]
nitcorn: minor fix in the header of the HTML page

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

9 years agonitcorn: improve default file listing of `FileServer`
Alexis Laferrière [Wed, 17 Sep 2014 20:45:40 +0000 (16:45 -0400)]
nitcorn: improve default file listing of `FileServer`

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

9 years agomodel: remove MModule::direct_owner
Jean Privat [Thu, 18 Sep 2014 00:08:28 +0000 (20:08 -0400)]
model: remove MModule::direct_owner

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

9 years agomodel: introduce MGroup::default_mmodule to replace fuzzy_owner
Jean Privat [Thu, 18 Sep 2014 00:00:01 +0000 (20:00 -0400)]
model: introduce MGroup::default_mmodule to replace fuzzy_owner

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

9 years agomodel: remove public_owner methods
Jean Privat [Wed, 17 Sep 2014 23:58:16 +0000 (19:58 -0400)]
model: remove public_owner methods

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

9 years agoMerge: Move `common_ffi` to `ffi` and clean up typos
Jean Privat [Wed, 17 Sep 2014 23:49:42 +0000 (19:49 -0400)]
Merge: Move `common_ffi` to `ffi` and clean up typos

Renaming `common_ffi` was long overdue, it was named this way to avoid conflicts with its `nitc` equivalent.

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

9 years agonitcorn: optimize `FileServer::root` to be used later on each request
Alexis Laferrière [Wed, 17 Sep 2014 20:17:16 +0000 (16:17 -0400)]
nitcorn: optimize `FileServer::root` to be used later on each request

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

9 years agonitcorn: better and safer access to root of a file server
Alexis Laferrière [Wed, 17 Sep 2014 20:15:40 +0000 (16:15 -0400)]
nitcorn: better and safer access to root of a file server

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

9 years agonitg: fix typo in doc of `before_send`
Alexis Laferrière [Wed, 17 Sep 2014 18:07:28 +0000 (14:07 -0400)]
nitg: fix typo in doc of `before_send`

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

9 years agonitg: fix typo in doc of `MParameterType`
Alexis Laferrière [Sat, 13 Sep 2014 17:26:49 +0000 (13:26 -0400)]
nitg: fix typo in doc of `MParameterType`

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

9 years agonitg: rename `common_ffi` group to `ffi`
Alexis Laferrière [Fri, 12 Sep 2014 19:46:56 +0000 (15:46 -0400)]
nitg: rename `common_ffi` group to `ffi`

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

9 years agonitcorn: redirect requests of directories to an URI ending with '/'
Alexis Laferrière [Wed, 17 Sep 2014 17:57:50 +0000 (13:57 -0400)]
nitcorn: redirect requests of directories to an URI ending with '/'

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

9 years agoMerge: Correct behavior of attribute reading in nitvm
Jean Privat [Wed, 17 Sep 2014 16:05:42 +0000 (12:05 -0400)]
Merge: Correct behavior of attribute reading in nitvm

This (small) PR allows the nitvm to pass more tests related to attributes reading.

The first commit introduces a new type and Instance which represent the initial values inside attributes.
In the second commit, the vm now throw the expected error when reading an uninitialized attribute.
The last commit implements ```isset``` expressions in the vm.

So, all tests base_attr*.nit are now corrects in the vm.

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

9 years agoMerge: Capitalize on Strings
Jean Privat [Wed, 17 Sep 2014 16:05:38 +0000 (12:05 -0400)]
Merge: Capitalize on Strings

Added the capitalized method on String as requested by @Morriar

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

9 years agolib/standard/string: FlatStrings built from NativeString now have free to_cstring.
Lucas Bajolet [Tue, 16 Sep 2014 14:29:50 +0000 (10:29 -0400)]
lib/standard/string: FlatStrings built from NativeString now have free to_cstring.

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

9 years agolib/standard/string: Introducting Copy-on-Write FlatBuffers
Lucas Bajolet [Tue, 16 Sep 2014 14:28:21 +0000 (10:28 -0400)]
lib/standard/string: Introducting Copy-on-Write FlatBuffers

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

9 years agonitvm: Handles isset expression
Julien Pagès [Sun, 14 Sep 2014 10:31:17 +0000 (12:31 +0200)]
nitvm: Handles isset expression

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

9 years agonitvm: Throw an error when trying to read an uninitialized attribute
Julien Pagès [Fri, 12 Sep 2014 14:54:31 +0000 (16:54 +0200)]
nitvm: Throw an error when trying to read an uninitialized attribute

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

9 years agonitvm: Introduces a type which represents initial values inside attributes
Julien Pagès [Fri, 12 Sep 2014 14:31:59 +0000 (16:31 +0200)]
nitvm: Introduces a type which represents initial values inside attributes

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

9 years agolib: create group `template`.
Alexandre Terrasa [Fri, 12 Sep 2014 17:12:16 +0000 (13:12 -0400)]
lib: create group `template`.

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

9 years agolib/standard/string: Added capitalized/capitalize method to String/Buffer
Lucas Bajolet [Fri, 12 Sep 2014 13:37:55 +0000 (09:37 -0400)]
lib/standard/string: Added capitalized/capitalize method to String/Buffer

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

9 years agoMerge: Nitcorn improvements & avoid double Tnits
Jean Privat [Wed, 10 Sep 2014 22:30:00 +0000 (18:30 -0400)]
Merge: Nitcorn improvements & avoid double Tnits

The tnitter part was asked by @privat

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

9 years agoMerge: Polymorphic extern classes
Jean Privat [Wed, 10 Sep 2014 22:29:55 +0000 (18:29 -0400)]
Merge: Polymorphic extern classes

The changes in the compiler ensure that extern classes (or sub classes of Pointer) are always boxed when in the generated code. This means that we now have 2 levels of boxing, the boxing within Nit and the unboxing for user C code where extern classes are pointers (FFI and legacy NI).

This change will allow to use extern classes in virtual types and generic types. It will be used by the `android::ui` modules.

The change also detected some wrongful use of the FFI which have been corected.

There's a bug weird on my computer on the test of nitcc, hopefully pratchett will do better.

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

9 years agotnitter: redirect after posting
Alexis Laferrière [Fri, 8 Aug 2014 17:03:40 +0000 (13:03 -0400)]
tnitter: redirect after posting

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

9 years agonitcorn: by default a file is an application/octet-stream
Alexis Laferrière [Fri, 8 Aug 2014 17:00:40 +0000 (13:00 -0400)]
nitcorn: by default a file is an application/octet-stream

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

9 years agonitcorn: use a default virtual host when none are configure to handle a request
Alexis Laferrière [Fri, 8 Aug 2014 16:58:24 +0000 (12:58 -0400)]
nitcorn: use a default virtual host when none are configure to handle a request

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

9 years agonitcorn: add the media type for `apk` extension
Alexis Laferrière [Fri, 8 Aug 2014 16:57:42 +0000 (12:57 -0400)]
nitcorn: add the media type for `apk` extension

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

9 years agotests: intro test for polymorphic use of extern classes
Alexis Laferrière [Wed, 10 Sep 2014 19:39:11 +0000 (15:39 -0400)]
tests: intro test for polymorphic use of extern classes

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

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>