nit.git
9 years agotyping: ASuperExpr do not lose information about the type of self
Jean Privat [Tue, 23 Sep 2014 19:19:51 +0000 (15:19 -0400)]
typing: ASuperExpr do not lose information about the type of self

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

9 years agotest_phase: count method definitions
Jean Privat [Tue, 23 Sep 2014 17:02:34 +0000 (13:02 -0400)]
test_phase: count method definitions

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

9 years agoMerge: Embarassing fixes
Jean Privat [Tue, 23 Sep 2014 22:21:31 +0000 (18:21 -0400)]
Merge: Embarassing fixes

Don't ask me why it worked before...

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

9 years agobenitlux/view: add missing opening <html> tag
Alexis Laferrière [Tue, 23 Sep 2014 19:25:27 +0000 (15:25 -0400)]
benitlux/view: add missing opening <html> tag

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

9 years agolib/re: fix invalid malloc
Alexis Laferrière [Tue, 23 Sep 2014 19:23:47 +0000 (15:23 -0400)]
lib/re: fix invalid malloc

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

9 years agoMerge: Model uml
Jean Privat [Tue, 23 Sep 2014 19:10:01 +0000 (15:10 -0400)]
Merge: Model uml

Introducing a new tool `nituml` for the generation of UML diagrams from a Nit code base.

For now, it supports the generation of a class diagram from an endpoint based on the flattened class hierarchy and the generation of a package diagram from a module, showing all the introduced and refined classes using a colour scheme (will be changed as it is as ugly as it might be misleading for the end-user).

How to use :
`nituml --diagram class [-p] lib/standard/standard.nit` => generates a class diagram in dot format for the stdlib
`nituml --diagram package [-p] lib/standard/string.nit` => generates a package diagram for the string module, showing local intros and redefs of classes/methods

Example of diagram :
`nituml --diagram class lib/standard/kernel.nit`
![kernel](https://cloud.githubusercontent.com/assets/1444825/4342041/f600a4ea-403f-11e4-8720-3bd27d9802c7.png)
`nituml --diagram package -p lib/standard/queue.nit`
![str](https://cloud.githubusercontent.com/assets/1444825/4342100/bfb83398-4040-11e4-84e0-c83896748f87.png)

TODO :
* [ ] Generate associations between classes
* [ ] Eventually generate a diagram for a new Nit project as it could be used for model-first design approaches

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

9 years agoMerge: Crypto
Jean Privat [Tue, 23 Sep 2014 19:09:58 +0000 (15:09 -0400)]
Merge: Crypto

Basic cryptography module, introduces some simple forms of cryptography algorithms.

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

9 years agonituml: Added tests for new tool
Lucas Bajolet [Tue, 23 Sep 2014 16:45:56 +0000 (12:45 -0400)]
nituml: Added tests for new tool

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

9 years agonituml: Can generate UML package diagrams from nit source.
Lucas Bajolet [Tue, 23 Sep 2014 15:45:27 +0000 (11:45 -0400)]
nituml: Can generate UML package diagrams from nit source.

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

9 years agonit: Added new binary nituml, for generation of UML diagrams from Nit source code.
Lucas Bajolet [Wed, 17 Sep 2014 21:02:29 +0000 (17:02 -0400)]
nit: Added new binary nituml, for generation of UML diagrams from Nit source code.

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

9 years agouml: Added UML class diagram generation from a Nit model
Lucas Bajolet [Wed, 17 Sep 2014 20:12:49 +0000 (16:12 -0400)]
uml: Added UML class diagram generation from a Nit model

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

9 years agomodel: Fix comment for MVisibility
Lucas Bajolet [Wed, 17 Sep 2014 01:18:24 +0000 (21:18 -0400)]
model: Fix comment for MVisibility

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

9 years agolib/standard/string: Moved escape_to_dot from nitcc to standard/string.nit
Lucas Bajolet [Tue, 23 Sep 2014 18:06:15 +0000 (14:06 -0400)]
lib/standard/string: Moved escape_to_dot from nitcc to standard/string.nit

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

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>