nit.git
9 years agomodelize: introduce `AAttrPropdef::has_value`
Jean Privat [Wed, 29 Oct 2014 16:43:01 +0000 (12:43 -0400)]
modelize: introduce `AAttrPropdef::has_value`

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

9 years agotools: accept statement block in attributes
Jean Privat [Wed, 29 Oct 2014 18:24:39 +0000 (14:24 -0400)]
tools: accept statement block in attributes

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

9 years agocompiler: introduce `AAttrPropdef::evaluate_expr` to factorize the compilation of...
Jean Privat [Wed, 29 Oct 2014 18:16:49 +0000 (14:16 -0400)]
compiler: introduce `AAttrPropdef::evaluate_expr` to factorize the compilation of default values

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

9 years agoMerge: neo4j: Print an error message when the server is down.
Jean Privat [Fri, 31 Oct 2014 01:58:38 +0000 (21:58 -0400)]
Merge: neo4j: Print an error message when the server is down.

Show the message as expected.

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

9 years agoMerge: Tweaks to Opportunity
Jean Privat [Fri, 31 Oct 2014 01:58:30 +0000 (21:58 -0400)]
Merge: Tweaks to Opportunity

Prettier forms and other modifications for your consideration.

I will deploy it on a server later today or tomorrow.

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

9 years agolib/android: hacks to fix new_global_ref awaiting a fix for #845
Alexis Laferrière [Fri, 10 Oct 2014 17:44:07 +0000 (13:44 -0400)]
lib/android: hacks to fix new_global_ref awaiting a fix for #845

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

9 years agoxymus.net: opportunity use site's header
Alexis Laferrière [Wed, 29 Oct 2014 23:10:14 +0000 (19:10 -0400)]
xymus.net: opportunity use site's header

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

9 years agoxymus.net: update xymus.net nitcorn config to include an opportunity client
Alexis Laferrière [Wed, 29 Oct 2014 21:59:13 +0000 (17:59 -0400)]
xymus.net: update xymus.net nitcorn config to include an opportunity client

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

9 years agoopportunity: always show at least 5 answer fields
Alexis Laferrière [Thu, 30 Oct 2014 14:58:58 +0000 (10:58 -0400)]
opportunity: always show at least 5 answer fields

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

9 years agoopportunity: nicer meetup creation confirmation
Alexis Laferrière [Thu, 30 Oct 2014 12:05:16 +0000 (08:05 -0400)]
opportunity: nicer meetup creation confirmation

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

9 years agoopportunity: improve look of welcome message
Alexis Laferrière [Thu, 30 Oct 2014 11:54:22 +0000 (07:54 -0400)]
opportunity: improve look of welcome message

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

9 years agoopportunity: restrict modification of old entries
Alexis Laferrière [Wed, 29 Oct 2014 23:30:57 +0000 (19:30 -0400)]
opportunity: restrict modification of old entries

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

9 years agoopportunity: use a container in "meetup" and "meetup_confirmation"
Alexis Laferrière [Wed, 29 Oct 2014 23:07:31 +0000 (19:07 -0400)]
opportunity: use a container in "meetup" and "meetup_confirmation"

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

9 years agoopportunity: meetups hash also rely on timestamp
Alexis Laferrière [Wed, 29 Oct 2014 21:53:59 +0000 (17:53 -0400)]
opportunity: meetups hash also rely on timestamp

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

9 years agoopportunity: support not being at web server root
Alexis Laferrière [Wed, 29 Oct 2014 21:52:11 +0000 (17:52 -0400)]
opportunity: support not being at web server root

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

9 years agoopportunity: by default the server uses port 8080
Alexis Laferrière [Wed, 29 Oct 2014 20:12:01 +0000 (16:12 -0400)]
opportunity: by default the server uses port 8080

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

9 years agoopportunity: prettier meetup participation form
Alexis Laferrière [Wed, 29 Oct 2014 20:11:32 +0000 (16:11 -0400)]
opportunity: prettier meetup participation form

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

9 years agoopportunity: prettier meetup creation
Alexis Laferrière [Wed, 29 Oct 2014 20:11:04 +0000 (16:11 -0400)]
opportunity: prettier meetup creation

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

9 years agoneo4j: Print an error message when the server is down.
Jean-Christophe Beaupré [Wed, 29 Oct 2014 18:54:03 +0000 (14:54 -0400)]
neo4j: Print an error message when the server is down.

Show the message as expected.

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

9 years agocompile: also generates a makefile named Makefile
Jean Privat [Thu, 30 Oct 2014 01:32:37 +0000 (21:32 -0400)]
compile: also generates a makefile named Makefile

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

9 years agocompile: add option --group-c-files
Jean Privat [Thu, 30 Oct 2014 01:22:57 +0000 (21:22 -0400)]
compile: add option --group-c-files

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

9 years agocompile: remove clib from the -I dir because the usufull files are already copied
Jean Privat [Thu, 30 Oct 2014 01:11:03 +0000 (21:11 -0400)]
compile: remove clib from the -I dir because the usufull files are already copied

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

9 years agocompile: use shortest path from the compiledir to the outname
Jean Privat [Thu, 30 Oct 2014 00:55:15 +0000 (20:55 -0400)]
compile: use shortest path from the compiledir to the outname

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

9 years agocompiler: add option --max-c-lines
Jean Privat [Thu, 30 Oct 2014 00:47:21 +0000 (20:47 -0400)]
compiler: add option --max-c-lines

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

9 years agocompiler: do not create empty .h file
Jean Privat [Thu, 30 Oct 2014 00:36:49 +0000 (20:36 -0400)]
compiler: do not create empty .h file

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

9 years agoopportunity: accept meetup without date or location
Alexis Laferrière [Wed, 29 Oct 2014 20:10:43 +0000 (16:10 -0400)]
opportunity: accept meetup without date or location

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

9 years agoMerge: Threads
Jean Privat [Wed, 29 Oct 2014 19:11:53 +0000 (15:11 -0400)]
Merge: Threads

Intro the `threads` module with support for POSIX threads, mutex and barriers. Also provides 2 ways to have thread-safe collections: refining existing collections and sub-classing them.

TODO:
* Complete the collection support.
* Modifiy `print` so that printing the user content and the new line is (generally) atomic
* Add more examples/use in real programs
* Reinforce error support.
* Fix compatibility with FFI's global refs.
* Add, when needed, GC_THREADS to `gc_chooser.[c|h]`
* Do not include `gc.h` when not using libgc

ping @egagnon

Pull-Request: #849
Reviewed-by: Jean-Philippe Caissy <jpcaissy@piji.ca>
Reviewed-by: Jean Privat <jean@pryen.org>
Reviewed-by: Alexandre Terrasa <alexandre@moz-code.org>
Reviewed-by: Etienne M. Gagnon <egagnon@j-meg.com>

9 years agoMerge: neo4j: Implement missing methods in `JsonArray`.
Jean Privat [Wed, 29 Oct 2014 19:11:45 +0000 (15:11 -0400)]
Merge: neo4j: Implement missing methods in `JsonArray`.

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

9 years agoMerge: Workaround nitlight
Jean Privat [Wed, 29 Oct 2014 19:11:41 +0000 (15:11 -0400)]
Merge: Workaround nitlight

nitlight was broken when `is cached` was used because highlight does not like AST transtormations.

This workaround justs disable the `cache` phase until something better is found.

http://nitlanguage.org/code2/nitserial.html#nitserial#MModule#serializable_type

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

9 years agoMerge: lib: fix semantic on has_substring on extreme cases
Jean Privat [Wed, 29 Oct 2014 19:11:38 +0000 (15:11 -0400)]
Merge: lib: fix semantic on has_substring on extreme cases

And avoid illegal access outside the string.

Detected thanks to the interpreted that warns on out-of-bound accesses in nativestrings.

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

9 years agolib/threads: intro an example `concurrent_array_and_barrier`
Alexis Laferrière [Mon, 27 Oct 2014 14:40:51 +0000 (10:40 -0400)]
lib/threads: intro an example `concurrent_array_and_barrier`

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

9 years agolib/threads: intro new thread-safe concurrent collections
Alexis Laferrière [Sun, 26 Oct 2014 16:23:11 +0000 (12:23 -0400)]
lib/threads: intro new thread-safe concurrent collections

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

9 years agoneo4j: Implement missing methods in `JsonArray`.
Jean-Christophe Beaupré [Wed, 29 Oct 2014 16:10:42 +0000 (12:10 -0400)]
neo4j: Implement missing methods in `JsonArray`.

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

9 years agolib/threads: optional redefs of collections to be thread-safe
Alexis Laferrière [Sun, 26 Oct 2014 16:21:22 +0000 (12:21 -0400)]
lib/threads: optional redefs of collections to be thread-safe

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

9 years agolib/threads: intro of the threads lib, with Thread, Mutex and Barrier
Alexis Laferrière [Sun, 26 Oct 2014 16:19:31 +0000 (12:19 -0400)]
lib/threads: intro of the threads lib, with Thread, Mutex and Barrier

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

9 years agohighlight: fix css for line and foldable
Jean Privat [Wed, 29 Oct 2014 13:27:33 +0000 (09:27 -0400)]
highlight: fix css for line and foldable

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

9 years agonitlight: disable `cached` since transformed AST cause issues in highlight
Jean Privat [Wed, 29 Oct 2014 13:05:01 +0000 (09:05 -0400)]
nitlight: disable `cached` since transformed AST cause issues in highlight

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

9 years agoauto_super_init: make code robust if `typing` is disabled
Jean Privat [Wed, 29 Oct 2014 12:52:06 +0000 (08:52 -0400)]
auto_super_init: make code robust if `typing` is disabled

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

9 years agophase: make `disabled=` public
Jean Privat [Wed, 29 Oct 2014 12:50:54 +0000 (08:50 -0400)]
phase: make `disabled=` public

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

9 years agolib: fix semantic on has_substring on extreme cases
Jean Privat [Wed, 29 Oct 2014 01:32:53 +0000 (21:32 -0400)]
lib: fix semantic on has_substring on extreme cases

And avoid illegal access outside the string.

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

9 years agoMerge: Opportunity
Jean Privat [Wed, 29 Oct 2014 00:11:46 +0000 (20:11 -0400)]
Merge: Opportunity

Addresses a few issues mentionned  in #811 :
- Return to the meetup creation page when the creation fails (auto-complete fields with old info)
- Use real buttons for the addition/deletion of an attendee to a Meetup
- Forbid creation of a Meetup without at least one answer

I also added feedback when an error is produced when creating the Meetup via a system similar to what @xymus does for Benitlux.

There were a few bugs hidden in the code, the update of the compiler with checks on useless null tests has revealed two of them.

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

9 years agoMerge: example: rosetta code
Jean Privat [Wed, 29 Oct 2014 00:11:43 +0000 (20:11 -0400)]
Merge: example: rosetta code

Starting playing #842
It is zen...

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

9 years agoMerge: xml: Introduce SAXophoNit, a SAX processor in Nit.
Jean Privat [Wed, 29 Oct 2014 00:11:40 +0000 (20:11 -0400)]
Merge: xml: Introduce SAXophoNit, a SAX processor in Nit.

This is a work in progress for a SAX processor in Nit.

Here is a sumary of what is (and what is not) supported at this point:
- [X] Content
- [X] XML declaration (parse it)
- [X] Acceptation of any XML document that Doxygen generates
- [ ] `DOCTYPE` declaration (or ignore it)
- [ ] XML declaration (do something with the settings)
- [x] Namespaces in XML
- [x] SAX mandatory feature flags
- [ ] XML 1.1
- [ ] Ignorable white space
- [ ] User-defined entities
- [ ] Encodings
- [ ] URIs
- [x] Test suite

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

9 years agoopportunity: Fixed a few typos.
Lucas Bajolet [Tue, 28 Oct 2014 18:38:57 +0000 (14:38 -0400)]
opportunity: Fixed a few typos.

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

9 years agoMerge: grammar: allow '`' inside foreign code blocks
Jean Privat [Tue, 28 Oct 2014 00:30:34 +0000 (20:30 -0400)]
Merge: grammar: allow '`' inside foreign code blocks

This was an old bug causing the use of ``` ` ``` within a foreign code block to break the block. Example:

~~~~
fun foo `{
    // Some comment on entity `foo` would prevent the whole block to be recognize
`}
~~~~

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

9 years agoexample: add some tasks of Rosetta code
Jean Privat [Mon, 27 Oct 2014 19:44:05 +0000 (15:44 -0400)]
example: add some tasks of Rosetta code

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

9 years agotests: update test_new_native_alt1 becaus eline change in array.nit
Jean Privat [Mon, 27 Oct 2014 23:53:58 +0000 (19:53 -0400)]
tests: update test_new_native_alt1 becaus eline change in array.nit

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

9 years agolib: add Array::+
Jean Privat [Mon, 27 Oct 2014 19:38:30 +0000 (15:38 -0400)]
lib: add Array::+

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

9 years agolib/collection: minor fix to doc in list.nit
Alexis Laferrière [Sun, 26 Oct 2014 13:12:59 +0000 (09:12 -0400)]
lib/collection: minor fix to doc in list.nit

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

9 years agoopportunity: Bugfix for answers at creation of a new attendee for a Meetup
Lucas Bajolet [Mon, 27 Oct 2014 18:50:25 +0000 (14:50 -0400)]
opportunity: Bugfix for answers at creation of a new attendee for a Meetup

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

9 years agoopportunity: Cosmetic changes to meetup visualization page
Lucas Bajolet [Mon, 27 Oct 2014 18:05:17 +0000 (14:05 -0400)]
opportunity: Cosmetic changes to meetup visualization page

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

9 years agoopportunity: Fixed useless null check
Lucas Bajolet [Mon, 27 Oct 2014 17:21:30 +0000 (13:21 -0400)]
opportunity: Fixed useless null check

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

9 years agoopportunity: Creation of a Meetup can now return to its page on error
Lucas Bajolet [Mon, 27 Oct 2014 17:21:15 +0000 (13:21 -0400)]
opportunity: Creation of a Meetup can now return to its page on error

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

9 years agoxml: Add an usage example.
Jean-Christophe Beaupré [Mon, 27 Oct 2014 16:17:49 +0000 (12:17 -0400)]
xml: Add an usage example.

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

9 years agoxml: Add some tests for SAXpohoNit.
Jean-Christophe Beaupré [Mon, 27 Oct 2014 15:45:06 +0000 (11:45 -0400)]
xml: Add some tests for SAXpohoNit.

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

9 years agoxml: Introduce SAXophoNit, a SAX processor in Nit.
Jean-Christophe Beaupré [Thu, 9 Oct 2014 14:53:46 +0000 (10:53 -0400)]
xml: Introduce SAXophoNit, a SAX processor in Nit.

For the moment, this implementation is mostly non-compliant, but it
works with most common XML documents.

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

9 years agoxml: Add classes to help testing a SAX parser.
Jean-Christophe Beaupré [Thu, 25 Sep 2014 19:25:03 +0000 (15:25 -0400)]
xml: Add classes to help testing a SAX parser.

Will be used to test SAXophoNit (A SAX parser in Nit).

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

9 years agoxml: Port SAX 2.0.
Jean-Christophe Beaupré [Fri, 19 Sep 2014 13:44:15 +0000 (09:44 -0400)]
xml: Port SAX 2.0.

This is a port of SAX 2.0.1 (http://www.saxproject.org) in Nit. The
following is **not** included in this port:

* Support for SAX1.
* Exceptions.
* Factories (requires run-time loading).

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

9 years agogrammar: allow '`' inside foreign code blocks
Alexis Laferrière [Sat, 25 Oct 2014 13:07:52 +0000 (09:07 -0400)]
grammar: allow '`' inside foreign code blocks

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

9 years agoopportunity: Changed layout from contrainer-fluid to container
Lucas Bajolet [Mon, 27 Oct 2014 15:29:51 +0000 (11:29 -0400)]
opportunity: Changed layout from contrainer-fluid to container

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

9 years agoopportunity: Corrected typo in welcome message
Lucas Bajolet [Mon, 27 Oct 2014 15:29:31 +0000 (11:29 -0400)]
opportunity: Corrected typo in welcome message

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

9 years agolib: add Text::justify
Jean Privat [Sat, 25 Oct 2014 01:59:36 +0000 (21:59 -0400)]
lib: add Text::justify

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

9 years agoMerge: New constructors with the `new` keyword
Jean Privat [Fri, 24 Oct 2014 23:58:38 +0000 (19:58 -0400)]
Merge: New constructors with the `new` keyword

`new` constructors where introduced with the FFI and generalized latter for intern methods.
This PR make them also legal with used-defined code in Nit.

~~~
abstract class Person
   var age: Int
   new(age: Int) do
      if i < 18 then
         return new Adult(age)
      else
         return new Child(age)
      end
end
~~~

A `new` constructor is specified like a static method.
By default it returns the type of self, but this can be changed by the user.

This PR starts by generalizing the `new` constructors. Thus a lot of specific code in engine is removed.
Then additional rules are added to control the usage of user-defined `new` constructors.

The original code was great enough to accepts these new kind of method without heavy modification.

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

9 years agoMerge: neo: Fix definition lists
Jean Privat [Fri, 24 Oct 2014 23:58:35 +0000 (19:58 -0400)]
Merge: neo: Fix definition lists

Fix the code that load relationships between a property or a class and its definitions.

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

9 years agoMerge: model: better implementation of the two `intro` methods
Jean Privat [Fri, 24 Oct 2014 23:58:26 +0000 (19:58 -0400)]
Merge: model: better implementation of the two `intro` methods

MClass and MProperty have a `intro` method to get the introducing
definition.
The initial implementation was to return the first known definition, that
make sense for a model constructed from a source-code where introductions
are read before refinements and redefinitions.

However, for a better robustness of the model that allows to load the
model form a serialized form or allows a model partially loaded, the
first-read definition is not necessary the intro.

This new implementation uses a different approach: the introduction is
the definition in the introducing compound (module for classes and
classdefs for properties). The introducing compound is known since the
construction, thus this new implementation is trivial and does not change
the API.

Rewrite-of: #841

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

9 years agotests: update some tests because buggy `new` are let untyped
Jean Privat [Thu, 23 Oct 2014 15:43:04 +0000 (11:43 -0400)]
tests: update some tests because buggy `new` are let untyped

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

9 years agotests: add base_new.nit
Jean Privat [Thu, 23 Oct 2014 01:51:06 +0000 (21:51 -0400)]
tests: add base_new.nit

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

9 years agotyping: ANew accepts only `init` on concrete class
Jean Privat [Thu, 23 Oct 2014 14:12:12 +0000 (10:12 -0400)]
typing: ANew accepts only `init` on concrete class

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

9 years agoneo: Remove `is_intro`.
Jean-Christophe Beaupré [Thu, 23 Oct 2014 19:33:17 +0000 (15:33 -0400)]
neo: Remove `is_intro`.

`is_intro` is computed by the model and is ignored anyway.

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

9 years agomodel: better implementation of the two `intro` methods
Jean Privat [Fri, 24 Oct 2014 00:37:53 +0000 (20:37 -0400)]
model: better implementation of the two `intro` methods

MClass and MProperty have a `intro` method the get the introducing
definition.
The initial implementation was to return the first known definition, that
make sense for a model constructed from a source-code where introductions
are read before refinements and redefinitions.

However, for a better robustness of the model that allows to load the
model form a serialized form or allows a model partially loaded, the
first-read definition is not necessary the intro.

This new implementation uses a different approach: the introduction is
the definition in the introducing compound (module for classes and
classdefs for properties). The introducing compound is known since the
construction, thus this new implementation is trivial and does not change
the API.

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

9 years agoneo: Fix linking between `MProperty` and `MPropDef`.
Jean-Christophe Beaupré [Thu, 23 Oct 2014 19:18:11 +0000 (15:18 -0400)]
neo: Fix linking between `MProperty` and `MPropDef`.

At loading, `neo.nit` linked each `MPropDef` two times to its
`MProperty`.

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

9 years agotyping: `new`-fatories are like top-level methods
Jean Privat [Thu, 23 Oct 2014 01:48:05 +0000 (21:48 -0400)]
typing: `new`-fatories are like top-level methods

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

9 years agotyping: allow `new` on interface and abstract classes that have a `new`-factory
Jean Privat [Wed, 22 Oct 2014 19:03:46 +0000 (15:03 -0400)]
typing: allow `new` on interface and abstract classes that have a `new`-factory

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

9 years agotyping: ANew distinguish the type of the class and the returned type
Jean Privat [Wed, 22 Oct 2014 19:00:47 +0000 (15:00 -0400)]
typing: ANew distinguish the type of the class and the returned type

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

9 years agomodel: `new` factories have a return type.
Jean Privat [Wed, 22 Oct 2014 18:56:15 +0000 (14:56 -0400)]
model: `new` factories have a return type.

The default is the definition class, so it remove a special case for
such methods.

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

9 years agomodel: `new` factories are named "new", not init.
Jean Privat [Wed, 22 Oct 2014 18:52:16 +0000 (14:52 -0400)]
model: `new` factories are named "new", not init.

It means that in `new X`, first the method name `new` is searched,
then the method named `init` as a fallback.

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

9 years agomodel-clients: use `is_root_init` instead of `.name == "init"`
Jean Privat [Fri, 17 Oct 2014 09:57:22 +0000 (05:57 -0400)]
model-clients: use `is_root_init` instead of `.name == "init"`

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

9 years agoMerge: Some gammar improvements
Jean Privat [Wed, 22 Oct 2014 22:45:27 +0000 (18:45 -0400)]
Merge: Some gammar improvements

A bunch of unrelated grammar work: bugfixes, a feature and stuff for future work.

The only implemented feature is the use of extended method identifiers in annotation (setters and operators)

~~~nit
class A
   var foo: String is writable(real_foo=)
   fun foo=(f: String) do
      print "Hello!"
      real_foo = f
   end
end
~~~

Some additional syntax for future works are now accepted but are ignored (or will crash at compile-time).

* user defined factories in class (eg. define `new` in interface)

~~~
interface Buffer
   new do return new FlatBuffer
end
var x = new Buffer
~~~

* code-block in attributes. when the default/lazy value is more complex than a single expression

~~~
class A
   var foo: Int do
      print "Hello!"
      return 5
   end
end
~~~

* generalized tuples. eg. for multiple returns, but more word is needed #839

~~~
fun foo(a,b: Int)
do
   return (a/b, a%b)
end
~~~

In fact, generalized tuples accepts anything that annotations accepts... (eventually they will be rejected just after parsing)

~~~
var x = (1, Array[Int], for x in a do print x, toto=, -)
# in order: a literal expression, a type, a statement, a method identifier (setter),
# an other method identifier (the minus operator)
~~~

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

9 years agotests: update tests because the parser gets better to parse arbitrary things.
Jean Privat [Wed, 22 Oct 2014 14:24:46 +0000 (10:24 -0400)]
tests: update tests because the parser gets better to parse arbitrary things.

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

9 years agoparser: regenerate
Jean Privat [Tue, 21 Oct 2014 23:52:03 +0000 (19:52 -0400)]
parser: regenerate

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

9 years agogrammar: allows blocks in attribute definitions
Jean Privat [Tue, 21 Oct 2014 23:45:22 +0000 (19:45 -0400)]
grammar: allows blocks in attribute definitions

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

9 years agogrammar: accepts new-factory with code
Jean Privat [Fri, 17 Oct 2014 09:55:28 +0000 (05:55 -0400)]
grammar: accepts new-factory with code

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

9 years agoannotation: `as_id` works with operators and setters
Jean Privat [Fri, 17 Oct 2014 02:44:18 +0000 (22:44 -0400)]
annotation: `as_id` works with operators and setters

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

9 years agoparser: generalise Prod::collect_text
Jean Privat [Fri, 17 Oct 2014 02:43:25 +0000 (22:43 -0400)]
parser: generalise Prod::collect_text

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

9 years agoast: accept methodid in at_args
Jean Privat [Fri, 17 Oct 2014 02:33:37 +0000 (22:33 -0400)]
ast: accept methodid in at_args

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

9 years agogrammar: add qmethid for qualified methid id
Jean Privat [Fri, 17 Oct 2014 02:24:40 +0000 (22:24 -0400)]
grammar: add qmethid for qualified methid id

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

9 years agoMerge: neo: Add `MAttributeDef.static_type` in the graph.
Jean Privat [Tue, 21 Oct 2014 23:42:20 +0000 (19:42 -0400)]
Merge: neo: Add `MAttributeDef.static_type` in the graph.

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

9 years agoneo: Add `MAttributeDef.static_type` in the graph.
Jean-Christophe Beaupré [Mon, 20 Oct 2014 17:40:59 +0000 (13:40 -0400)]
neo: Add `MAttributeDef.static_type` in the graph.

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

9 years agoMerge: Fix the old bug where (-0.1).to_s == "0.-1"
Jean Privat [Mon, 20 Oct 2014 13:48:17 +0000 (09:48 -0400)]
Merge: Fix the old bug where (-0.1).to_s == "0.-1"

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

9 years agoMerge: neo: correct the documentation of neo.nit according to PR #781.
Jean Privat [Mon, 20 Oct 2014 13:48:12 +0000 (09:48 -0400)]
Merge: neo: correct the documentation of neo.nit according to PR #781.

PR #781 changed the model, but not the documentation of neo.nit.

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

9 years agoMerge: Small compiler things
Jean Privat [Mon, 20 Oct 2014 13:47:55 +0000 (09:47 -0400)]
Merge: Small compiler things

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

9 years agoMerge: file: Fix `join_path` to handle paths ending with a slash.
Jean Privat [Mon, 20 Oct 2014 13:47:50 +0000 (09:47 -0400)]
Merge: file: Fix `join_path` to handle paths ending with a slash.

That way, we no longer need to manually remove the trailing slash before calling `join_path`.

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

9 years agotests: update savs for tests using the previously broken to_precision
Alexis Laferrière [Fri, 17 Oct 2014 15:36:06 +0000 (11:36 -0400)]
tests: update savs for tests using the previously broken to_precision

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

9 years agolib/standard: fix `Float::to_precision`
Alexis Laferrière [Sun, 12 Oct 2014 05:16:00 +0000 (01:16 -0400)]
lib/standard: fix `Float::to_precision`

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

9 years agoneo: correct the documentation of neo.nit according to PR #781.
Jean-Christophe Beaupré [Fri, 17 Oct 2014 14:41:12 +0000 (10:41 -0400)]
neo: correct the documentation of neo.nit according to PR #781.

PR #781 changed the model, but not the documentation of neo.nit.

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

9 years agoabstract_compiler: prefers implementing expr than stmt in assignments
Jean Privat [Fri, 17 Oct 2014 02:57:07 +0000 (22:57 -0400)]
abstract_compiler: prefers implementing expr than stmt in assignments

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

9 years agoabstract_compiler: default stmt implmentation do not need to execute variables as...
Jean Privat [Fri, 17 Oct 2014 02:56:17 +0000 (22:56 -0400)]
abstract_compiler: default stmt implmentation do not need to execute variables as statments

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

9 years agoparser: add tuples
Jean Privat [Thu, 16 Oct 2014 04:18:04 +0000 (00:18 -0400)]
parser: add tuples

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

9 years agoast: remove classes AAtArg and make them simple AExpr
Jean Privat [Thu, 16 Oct 2014 01:18:46 +0000 (21:18 -0400)]
ast: remove classes AAtArg and make them simple AExpr

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

9 years agoMerge: Robust debug
Jean Privat [Fri, 17 Oct 2014 00:21:34 +0000 (20:21 -0400)]
Merge: Robust debug

First pass on the debugger, simple cleanup/fixes that might be helpful for the end-user.

Addresses some of the issues mentioned in #742.

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