nit.git
9 years agohighlight: factorize the creation of tags
Jean Privat [Wed, 8 Apr 2015 05:21:31 +0000 (12:21 +0700)]
highlight: factorize the creation of tags

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

9 years agotoolcontext: error methods return the messages, to add information
Jean Privat [Wed, 8 Apr 2015 05:08:41 +0000 (12:08 +0700)]
toolcontext: error methods return the messages, to add information

unused yet.

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

9 years agotoolcontext: attach errors message to their location
Jean Privat [Wed, 8 Apr 2015 16:10:42 +0000 (23:10 +0700)]
toolcontext: attach errors message to their location

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

9 years agoparser: reuse child location when possible
Jean Privat [Wed, 8 Apr 2015 05:01:07 +0000 (12:01 +0700)]
parser: reuse child location when possible

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

9 years agolexer: do not create useless location (for whitespaces)
Jean Privat [Wed, 8 Apr 2015 05:00:20 +0000 (12:00 +0700)]
lexer: do not create useless location (for whitespaces)

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

9 years agoMerge: Not null types
Jean Privat [Wed, 8 Apr 2015 01:01:49 +0000 (08:01 +0700)]
Merge: Not null types

In order to fix #86 and #1238 some preliminary work to solve remaining issues with the type system is needed. This PR is a step toward this goal.

This introduce not-null types, that is a modifier to indicate that a type cannot contain null.
Basically, this new modifier is almost useless because it is the semantic of all the types (except obviously null and nullable things). Except in one case: when one adapts a formal type whose bound is nullable.

Before the PR, the semantic was the following

~~~nit
class A[E: nullable Object]
   fun foo(e: E, o: nullable Object) do
      var o2 = o.as(not null) # the static type of o2 is `Object`
      print o2 # OK
      var e2 = e.as(not null) # the static type of e2 is still `E` because there is no `nullable` to remove
      print e2 # Error: expected Object, got E
   end
end
~~~

Obviously, the issue was not that important because people managed to program complex things in Nit and I do not remember getting some complain about that particular issue. For the rare cases of this unexpected behavior, a workaround was possible: to cast on the non-nullable bound

~~~nit
   var e2 = e.as(Object)
   print e2 # OK
~~~

Nevertheless, the behavior was still buggy since type information was lost and not POLA. Moreover, `!= null` and `or else` did not have a workaround.

So, this PR introduces a special new type-modifier for this case so that everything become sensible.

~~~nit
      var e2 = e.as(not null) # the static type of e2 is now `not null E`
      print e2 # OK
~~~

Moreover, a lot of local refactorisation was done in model.nit and typing.nit to clean and harmonize the code. So that independently of the new notnull modifier, the code is cleaner, some bugs where removed and some small features added, especially the detection of useless `or else`.

Last, but not least, the `not null` thing is only an internal modifier and is not usable as a syntactic type construction (the grammar and the AST is unchanged); `not null` can however be shown to the programmer in messages.

~~~nit
      var e2 = e.as(not null) # the static type of e2 is now `not null E`
      var e3 = e2.as(not null) # << Warning: expression is not null, since it is a `not null E` >>
~~~

I could easily add `not null` as a specific syntactic construction since everything internally is ready. but 1. does this worth it?. 2. I do not want to conflict with #1243 that also change the grammar.
As an example, is it useful to write the following? (currently refused but very easy to add after this PR)

~~~nit
class A[E: nullable Object]
   fun foo(e: not null E): not null E do
      var x = e.to_s # no null pointer exception
      # ...
      return e
   end
end

var a = new A[nullable Int]
var i = a.foo(5)
~~~

Pull-Request: #1244
Reviewed-by: Etienne M. Gagnon <egagnon@j-meg.com>
Reviewed-by: Lucas Bajolet <r4pass@hotmail.com>
Reviewed-by: Romain Chanoir <chanoir.romain@courrier.uqam.ca>
Reviewed-by: Alexandre Terrasa <alexandre@moz-code.org>

9 years agoMerge: Improve checking of virtual types
Jean Privat [Wed, 8 Apr 2015 01:01:15 +0000 (08:01 +0700)]
Merge: Improve checking of virtual types

This PR does 2 things to avoid runtime errors during nitc. Invalid programs that crashed the compiler now display errors messages.

* improve the static detection of loops in virtual types.
* consider types in the signatures of properties to be fragile since they contains potentially bad virtual types.

If merged with #1241 then nitpick can process the whole tests directory without crashing (impressive, since there is 1584 border-case files).
~~~
$ ./nitpick ../tests/*.nit ../tests/alt/*.nit -I ../lib/standard/ -I ../lib/standard/collection/
[... lots of errors ...]
Errors: 1766. Warnings: 195.
~~~

Pull-Request: #1245
Reviewed-by: Lucas Bajolet <r4pass@hotmail.com>
Reviewed-by: Romain Chanoir <chanoir.romain@courrier.uqam.ca>
Reviewed-by: Alexandre Terrasa <alexandre@moz-code.org>

9 years agoMerge: Clean benches
Jean Privat [Wed, 8 Apr 2015 01:01:07 +0000 (08:01 +0700)]
Merge: Clean benches

Some janitoring in the benchmarks directory

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

9 years agoMerge: Robust keep-going
Jean Privat [Wed, 8 Apr 2015 01:00:53 +0000 (08:00 +0700)]
Merge: Robust keep-going

Detection and resolution of crashes or irrelevant error messages with tools that keeps going (eg. nitpick).

Historically, the compiler just exited at the end on a step when an error occured. The ToolContext#keep_going flag disable this automatic exit and was introduced for tool that are expected to be launched on broken code: nitpick and nitlight. However most parts of the code expected that:

* the previous steps where completed successfully, and expected information where available and correct.
* they are that special important snowflake can just exit the whole program when they are unhappy.

These rules can make sense for a compiler but are to strict for most SE tools that need to work (or continue working) when some random module contain an error.
Thus this PR improve the robustness of various parts of the code for the keep-going case so that we do not exit or crash before having processed all the modules.

With this PR, the following command does not crash anymore:

~~~
$ nitpick `nitls -rps ../lib ../contrib ../examples`
[...]
Errors: 10. Warnings: 31.
~~~

Note that `nitpick ../tests` still crashes. There is ugly errors hard to recover from in this directory.

Maybe, one day most of the tools can be made keep going by default.

Pull-Request: #1241
Reviewed-by: Alexandre Terrasa <alexandre@moz-code.org>
Reviewed-by: Lucas Bajolet <r4pass@hotmail.com>
Reviewed-by: Etienne M. Gagnon <egagnon@j-meg.com>

9 years agosrc/hightlight: hightlight and do not crash on MNotNullType
Jean Privat [Tue, 7 Apr 2015 10:37:36 +0000 (17:37 +0700)]
src/hightlight: hightlight and do not crash on MNotNullType

Also add MNullType that where missing.

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

9 years agotests: add base_not_null.nit and base_notnull_lit.nit
Jean Privat [Sat, 4 Apr 2015 15:50:58 +0000 (22:50 +0700)]
tests: add base_not_null.nit and base_notnull_lit.nit

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

9 years agocode: remove useless `or else` now that they are detected
Jean Privat [Sat, 4 Apr 2015 15:46:56 +0000 (22:46 +0700)]
code: remove useless `or else` now that they are detected

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

9 years agotests: update test_new_native_alt1.res because line change in array :(
Jean Privat [Sat, 4 Apr 2015 15:38:26 +0000 (22:38 +0700)]
tests: update test_new_native_alt1.res because line change in array :(

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

9 years agotests: update because resolved types are in error messages
Jean Privat [Sat, 4 Apr 2015 15:37:56 +0000 (22:37 +0700)]
tests: update because resolved types are in error messages

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

9 years agotyping: on type error, also indicate the resolved type
Jean Privat [Sat, 4 Apr 2015 15:36:53 +0000 (22:36 +0700)]
typing: on type error, also indicate the resolved type

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

9 years agoUpdate tests error message on null adaptation and tests
Jean Privat [Sat, 4 Apr 2015 15:04:55 +0000 (22:04 +0700)]
Update tests error message on null adaptation and tests

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

9 years agolib/array: suppress a warning to be compatible with the bootstrap
Jean Privat [Sat, 4 Apr 2015 13:36:44 +0000 (20:36 +0700)]
lib/array: suppress a warning to be compatible with the bootstrap

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

9 years agomodel: rename `as_notnullable` to `undecorate`
Jean Privat [Sat, 4 Apr 2015 13:35:41 +0000 (20:35 +0700)]
model: rename `as_notnullable` to `undecorate`

The behavior is to remove the decoration, and `as_notnullabe` is not
the best name to undecorate a `MNotNullType`

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

9 years agotyping: add `check_can_be_null` to fix and factorize as_notnull transformations
Jean Privat [Sat, 4 Apr 2015 13:31:11 +0000 (20:31 +0700)]
typing: add `check_can_be_null` to fix and factorize as_notnull transformations

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

9 years agomodel: add new type `MNotNullType` to force that null is excluded from a type.
Jean Privat [Sat, 4 Apr 2015 13:29:08 +0000 (20:29 +0700)]
model: add new type `MNotNullType` to force that null is excluded from a type.

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

9 years agotests: update sav/base_virtual_type7.res
Jean Privat [Mon, 6 Apr 2015 08:22:54 +0000 (15:22 +0700)]
tests: update sav/base_virtual_type7.res

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

9 years agotests: add error_virtual_type.nit and error_virtual_type2.nit
Jean Privat [Mon, 6 Apr 2015 08:19:43 +0000 (15:19 +0700)]
tests: add error_virtual_type.nit and error_virtual_type2.nit

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

9 years agomodelize_property: improve the search of circularity for virtual types
Jean Privat [Mon, 6 Apr 2015 08:17:00 +0000 (15:17 +0700)]
modelize_property: improve the search of circularity for virtual types

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

9 years agomodelize_property: use resolve_mtype_unchecked during build_signature
Jean Privat [Mon, 6 Apr 2015 05:10:29 +0000 (12:10 +0700)]
modelize_property: use resolve_mtype_unchecked during build_signature

Signature can contain illegal type made of virtual types.
But at this point, the virtual types are not yet validated.

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

9 years agomodelize_property: remove unused ASignature::build_signature
Jean Privat [Mon, 6 Apr 2015 08:11:24 +0000 (15:11 +0700)]
modelize_property: remove unused ASignature::build_signature

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

9 years agolib/ai: remove randomness in puzzle so benches can compare sanely
Jean Privat [Sat, 4 Apr 2015 21:43:32 +0000 (04:43 +0700)]
lib/ai: remove randomness in puzzle so benches can compare sanely

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

9 years agomodel: extract a common proxy from MNullableType
Jean Privat [Sat, 4 Apr 2015 10:34:05 +0000 (17:34 +0700)]
model: extract a common proxy from MNullableType

This will simplify the creation of future proxys/decorations for types.

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

9 years agosrc: use MFormalType for type checks when it makes sense
Jean Privat [Sat, 4 Apr 2015 09:57:09 +0000 (16:57 +0700)]
src: use MFormalType for type checks when it makes sense

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

9 years agomodel: introduce MFormalType as a superclass of MVirtualType and MParameterType
Jean Privat [Sat, 4 Apr 2015 09:56:12 +0000 (16:56 +0700)]
model: introduce MFormalType as a superclass of MVirtualType and MParameterType

Strangely enough, they do not have common methods yet.
It is why a super-class was never introduced.

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

9 years agobenches/strings: add .gitignore and `make clean`
Jean Privat [Fri, 3 Apr 2015 05:44:33 +0000 (12:44 +0700)]
benches/strings: add .gitignore and `make clean`

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

9 years agobenches/engines: remove nitcc generated files for calc
Jean Privat [Fri, 3 Apr 2015 05:36:47 +0000 (12:36 +0700)]
benches/engines: remove nitcc generated files for calc

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

9 years agobenchs/markdown: add a .gitignore to avoid cruft
Jean Privat [Fri, 3 Apr 2015 05:32:06 +0000 (12:32 +0700)]
benchs/markdown: add a .gitignore to avoid cruft

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

9 years agobenchs/markdown: add a root Makefile
Jean Privat [Fri, 3 Apr 2015 05:31:38 +0000 (12:31 +0700)]
benchs/markdown: add a root Makefile

most for the for the `clean` than for the `all`

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

9 years agotests: update fatal error messages.
Jean Privat [Fri, 3 Apr 2015 05:52:14 +0000 (12:52 +0700)]
tests: update fatal error messages.

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

9 years agotoolcontext: call only `errors_info` once at the end
Jean Privat [Fri, 3 Apr 2015 02:47:05 +0000 (09:47 +0700)]
toolcontext: call only `errors_info` once at the end

Thus only display one total of errors/warnings, not one per call of `check_errors`

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

9 years agomodelbuilder: run_global_phases do nothing for an empty list of modules
Jean Privat [Fri, 3 Apr 2015 02:45:57 +0000 (09:45 +0700)]
modelbuilder: run_global_phases do nothing for an empty list of modules

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

9 years agotyping: do not rely on `MModule.object_type` that will fatal error
Jean Privat [Fri, 3 Apr 2015 02:45:21 +0000 (09:45 +0700)]
typing: do not rely on `MModule.object_type` that will fatal error

Instead get the standard `missing class` error and continue processing

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

9 years agomodel: get_primitive_class filter classes by module
Jean Privat [Fri, 3 Apr 2015 02:35:54 +0000 (09:35 +0700)]
model: get_primitive_class filter classes by module

This make the analysis of distinct kernels possible (and robust)

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

9 years agotyping: be more robust on missing/buggy information
Jean Privat [Fri, 3 Apr 2015 02:42:20 +0000 (09:42 +0700)]
typing: be more robust on missing/buggy information

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

9 years agomodelize_class: make the class-name-conflict a warning
Jean Privat [Fri, 3 Apr 2015 02:44:12 +0000 (09:44 +0700)]
modelize_class: make the class-name-conflict a warning

as an error, it prevents temporary duplication of same classes
for development and experimentation.

One do not want to have an hard error in a file because a random file
in the same directory has issues.

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

9 years agomodelize_property: invalidate information to avoid causing cascaded errors
Jean Privat [Fri, 3 Apr 2015 05:54:46 +0000 (12:54 +0700)]
modelize_property: invalidate information to avoid causing cascaded errors

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

9 years agomodelize_class: make various steps more robust if the previous steps failed
Jean Privat [Fri, 3 Apr 2015 02:40:36 +0000 (09:40 +0700)]
modelize_class: make various steps more robust if the previous steps failed

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

9 years agomodelbuilder: promote `get_mclass_by_name` from typing
Jean Privat [Fri, 3 Apr 2015 02:36:57 +0000 (09:36 +0700)]
modelbuilder: promote `get_mclass_by_name` from typing

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

9 years agomodelbuilder: resolve_mtype does not crash when the class is incomplete
Jean Privat [Fri, 3 Apr 2015 02:34:36 +0000 (09:34 +0700)]
modelbuilder: resolve_mtype does not crash when the class is incomplete

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

9 years agomodel: protect MClassDef.is_intro and provide MClass.try_intro
Jean Privat [Fri, 3 Apr 2015 02:34:01 +0000 (09:34 +0700)]
model: protect MClassDef.is_intro and provide MClass.try_intro

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

9 years agoloader: build_module_importation invalidates the mmodule on errors
Jean Privat [Fri, 3 Apr 2015 02:33:01 +0000 (09:33 +0700)]
loader: build_module_importation invalidates the mmodule on errors

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

9 years agoloader: the AModule.mmodule can be null if the mmodule is invalid
Jean Privat [Fri, 3 Apr 2015 02:32:04 +0000 (09:32 +0700)]
loader: the AModule.mmodule can be null if the mmodule is invalid

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

9 years agovarious phases: more robust for keep-going
Jean Privat [Fri, 3 Apr 2015 02:30:22 +0000 (09:30 +0700)]
various phases: more robust for keep-going

Entry point of most phases return gracefully in case of missing info.
Instead of crashing.

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

9 years agobenchs/markdown: fix location of nitc
Jean Privat [Fri, 3 Apr 2015 05:30:46 +0000 (12:30 +0700)]
benchs/markdown: fix location of nitc

do not assume $PATH and make it modifiable

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

9 years agoMerge: parser: add a basic sabblecc3 parser in Java
Jean Privat [Fri, 3 Apr 2015 01:28:33 +0000 (08:28 +0700)]
Merge: parser: add a basic sabblecc3 parser in Java

So one can more easily play and compare parsers.

Sometime, when I have issues with the parser, it helps to understand if it is nit-related, sablecc-related or grammar-relater.

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

9 years agoMerge: Unite app.nit metadata annotations common to Android and iOS
Jean Privat [Fri, 3 Apr 2015 01:27:33 +0000 (08:27 +0700)]
Merge: Unite app.nit metadata annotations common to Android and iOS

* Rename the annotation `java_package` to `app_namespace`.
* Move up `app_name`, `app_version` and `app_namespace` and their default values from the Android platform.
* Apply these annotations in iOS too.
* Use the annotations in Hello iOS.

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

9 years agoMerge: Updated bench scripts for strings
Jean Privat [Fri, 3 Apr 2015 01:27:25 +0000 (08:27 +0700)]
Merge: Updated bench scripts for strings

Updated the script for benching the variants of strings.

Some new variations for strings will follow in further PRs

Pull-Request: #1230
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 agoparser: add a basic sabblecc3 parser in Java
Jean Privat [Fri, 3 Apr 2015 01:11:49 +0000 (08:11 +0700)]
parser: add a basic sabblecc3 parser in Java

So one can more easily play and compare parsers.

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

9 years agoMerge: benches/markdown: add `pandoc` engine.
Jean Privat [Thu, 2 Apr 2015 16:54:08 +0000 (23:54 +0700)]
Merge: benches/markdown: add `pandoc` engine.

Here the result for 5 consecutive runs.

![image](https://cloud.githubusercontent.com/assets/583144/6013527/3bc7acae-ab56-11e4-819a-937b4550575e.png)

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

9 years agoMerge: Test compilation of OS X and iOS programs, on OS X
Jean Privat [Thu, 2 Apr 2015 16:53:38 +0000 (23:53 +0700)]
Merge: Test compilation of OS X and iOS programs, on OS X

The results of the compilation of iOS apps by XCode are directories. This PR fix tests.sh to detect those directory and report them cleanly.

Also intro a script for running OS X specific tests.

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

9 years agoMerge: lib/standard/string: Added faster to_cstring method on FlatText.
Jean Privat [Thu, 2 Apr 2015 16:53:11 +0000 (23:53 +0700)]
Merge: lib/standard/string: Added faster to_cstring method on FlatText.

Adds a service for quick cstring in `FlatTexts`, this is mainly to speedup some methods like `write_native`, which takes a cstring in input.

This just creates a new pointer to the same `char*` with an offset.

Since no copy is ever made, its use is highly discouraged in extern code or in cases other than ephemereal uses of the resulting `NativeString`.

Since it adds a new intern service, it cannot be used as is in the standard library as it will need a regeneration of c_src beforehand.

Pull-Request: #1231
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 agolib/ios: add metadata annotations to "Hello iOS"
Alexis Laferrière [Tue, 31 Mar 2015 20:32:33 +0000 (16:32 -0400)]
lib/ios: add metadata annotations to "Hello iOS"

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

9 years agonitc: the iOS platform use app.nit annotations
Alexis Laferrière [Tue, 31 Mar 2015 19:26:05 +0000 (15:26 -0400)]
nitc: the iOS platform use app.nit annotations

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

9 years agolib & examples: update modules using the java_package annotation
Alexis Laferrière [Tue, 31 Mar 2015 19:25:05 +0000 (15:25 -0400)]
lib & examples: update modules using the java_package annotation

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

9 years agonitc: move up the default values of a project from the android platform
Alexis Laferrière [Thu, 2 Apr 2015 15:50:57 +0000 (11:50 -0400)]
nitc: move up the default values of a project from the android platform

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

9 years agonitc: extract common app.nit annotations from Android
Alexis Laferrière [Tue, 31 Mar 2015 19:23:13 +0000 (15:23 -0400)]
nitc: extract common app.nit annotations from Android

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

9 years agomodel: intro `MModule::first_real_mmodule` to get the first non-fictive module
Alexis Laferrière [Tue, 31 Mar 2015 20:10:23 +0000 (16:10 -0400)]
model: intro `MModule::first_real_mmodule` to get the first non-fictive module

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

9 years agobenchmarks/string: Added README
Lucas Bajolet [Thu, 2 Apr 2015 14:24:00 +0000 (10:24 -0400)]
benchmarks/string: Added README

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

9 years agoMerge: Improve loader
Jean Privat [Thu, 2 Apr 2015 04:10:22 +0000 (11:10 +0700)]
Merge: Improve loader

This PR improves the loader that can now accepts

* directories of projects: to load all modules of all projects (eg `contrib`)
* root directories of groups: to load all modules of the groups (eg `contrib/benitlux`).
  Previously, this worked if there was no `src` subdirectory)

This works for tools that rely on full_parse (basically all tools except the engines).

~~~sh
$ ./test_test_phase ../lib -q
It works
I have 89 projects
I have 285 modules
I have 1038 classes
For 1366 definitions of classes
I have 7101 methods
For 9098 definitions of methods
~~~

Note that if any files has an error most tools will just stop.

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

9 years agoMerge: nitdoc: introduce Bootstrap components
Jean Privat [Thu, 2 Apr 2015 04:10:08 +0000 (11:10 +0700)]
Merge: nitdoc: introduce Bootstrap components

The main objectif of this PR is to introduce a new module that abstracts Bootstrap component rendering (2d8ea6e).

Commit 63aab1e gives an example of how nitdoc will use these abstractions in the future PRs.

Also do some fixes and cleaning.

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

9 years agoMerge: Bench markdown --semi-global
Jean Privat [Thu, 2 Apr 2015 04:09:52 +0000 (11:09 +0700)]
Merge: Bench markdown --semi-global

Add a second nitmd engine compiled with --semi-global.

One can see that it helps to win against some java impl.

![](https://cloud.githubusercontent.com/assets/135828/6934753/ffe2f672-d863-11e4-8961-75b03e566da9.png)

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

9 years agobenchmarks/strings: Added Makefile for tests with default values.
Lucas Bajolet [Tue, 31 Mar 2015 17:44:17 +0000 (13:44 -0400)]
benchmarks/strings: Added Makefile for tests with default values.

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

9 years agobenchmarks/string: Updated bench scripts for strings
Lucas Bajolet [Tue, 31 Mar 2015 15:55:03 +0000 (11:55 -0400)]
benchmarks/string: Updated bench scripts for strings

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

9 years agobenches/markdown: add `pandoc` engine.
Alexandre Terrasa [Wed, 1 Apr 2015 14:25:34 +0000 (10:25 -0400)]
benches/markdown: add `pandoc` engine.

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

9 years agotests: add the testosx.sh script to run OSX and iOS specific tests
Alexis Laferrière [Tue, 31 Mar 2015 17:58:29 +0000 (13:58 -0400)]
tests: add the testosx.sh script to run OSX and iOS specific tests

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

9 years agotests: add savs file for ios tests
Alexis Laferrière [Tue, 31 Mar 2015 17:37:28 +0000 (13:37 -0400)]
tests: add savs file for ios tests

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

9 years agotests: tests.sh detects directories before trying to execute them
Alexis Laferrière [Tue, 31 Mar 2015 17:27:49 +0000 (13:27 -0400)]
tests: tests.sh detects directories before trying to execute them

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

9 years agoloader: get_mgroup can be given the root directory or the src directory
Jean Privat [Mon, 30 Mar 2015 04:57:16 +0000 (11:57 +0700)]
loader: get_mgroup can be given the root directory or the src directory

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

9 years agoloader: get_mgroup search README in src first then in the root directory
Jean Privat [Mon, 30 Mar 2015 04:41:38 +0000 (11:41 +0700)]
loader: get_mgroup search README in src first then in the root directory

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

9 years agoloader: parse_full look inside directories of projects
Jean Privat [Mon, 30 Mar 2015 04:39:08 +0000 (11:39 +0700)]
loader: parse_full look inside directories of projects

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

9 years agosrc/doc: uniformize name display
Alexandre Terrasa [Mon, 23 Feb 2015 17:02:12 +0000 (18:02 +0100)]
src/doc: uniformize name display

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

9 years agosrc/doc: migrate topmenu to new templates.
Alexandre Terrasa [Tue, 17 Feb 2015 19:59:05 +0000 (20:59 +0100)]
src/doc: migrate topmenu to new templates.

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

9 years agosrc/doc: introduce bootstrap components abstraction.
Alexandre Terrasa [Mon, 23 Feb 2015 15:02:30 +0000 (16:02 +0100)]
src/doc: introduce bootstrap components abstraction.

This will be used to migrate templates in a cleaner version.

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

9 years agolib/standard/string: Added faster cstring method on flatstring.
Lucas Bajolet [Tue, 31 Mar 2015 20:31:07 +0000 (16:31 -0400)]
lib/standard/string: Added faster cstring method on flatstring.

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

9 years agoversion 0.7.3 v0.7.3
Jean Privat [Tue, 31 Mar 2015 06:00:24 +0000 (13:00 +0700)]
version 0.7.3

9 years agobench_markdown: add a new engine, nitmd-o that is nitmd + optimisations
Jean Privat [Tue, 31 Mar 2015 03:49:23 +0000 (10:49 +0700)]
bench_markdown: add a new engine, nitmd-o that is nitmd + optimisations

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

9 years agobench_markdown: increase $s so that times are more meaningful
Jean Privat [Tue, 31 Mar 2015 03:48:10 +0000 (10:48 +0700)]
bench_markdown: increase $s so that times are more meaningful

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

9 years agoMerge: lib/std/union_find: make DisjointSet Cloneable
Jean Privat [Tue, 31 Mar 2015 03:22:05 +0000 (10:22 +0700)]
Merge: lib/std/union_find: make DisjointSet Cloneable

Just because I need it.

I'm still not sure about what is the best way to deal with the various copy-constructors and clone methods. I think the following make sense:

A copy constructor named `from` that takes, if possible a general classifier (like an interface). This named constructor may use `nosuper` to avoid the automatic invocation of the standard init method if this cause a useless complex initialization that will be throw away by the copy.
A direct copy `clone` than can just return `new SELFTYPE.from(self)`

The advantage is that for simple clone, the `clone` method do the job.
If one want to change the class but keep the data, then the `from` constructor can be used. Like `new HashSet.from([1,2,3])`

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

9 years agoMerge: Rewrite the coloration for properties and types.
Jean Privat [Tue, 31 Mar 2015 03:21:57 +0000 (10:21 +0700)]
Merge: Rewrite the coloration for properties and types.

This introduce a new colorer, `POSetGroupColorer` that colors elements introduced by the classes in a class-hierarchy.
The advantage of this new colorer is that it uses conflict graphs of classes to colorize elements.
By comparison, the previously used colorers work with conflict graphs of elements; that are therefore much larger.

An other advantage is that only the introductions of elements are needed by the colorer, so filling the information from the model is far more easier.

The construction of the poset of types is also removed.
Instead, subtyping tables are computed with a more standard way:

* target cast types are grouped by classes: a map class->types is created
* the map is colored: a table layout by class is computed
* for each live type, the table layout of the associated class is used to build the type table

Results are so good that most of the time of the coloring is removed.

For nitc/nitc/nit

Before:

user: 0m6.044s
total: 15096 MIr
do_property_coloring: 1420 MIr
do_type_coloring: 2600 MIr

After:

user: 0m5.608s (-7%)
total: 12800 MIr (-15%)
do_property_coloring: 452 MIr (-68%)
do_type_coloring: 895 MIr (-65%)

note that in the previous numbers, most of the time is done in the model to inherit or resolve things.
Pure coloring algorithm is now negligible:

conflict_graph: 34 MIr (<1% of the total Ir)
coloring: 60 MIr (<1% of the total Ir)

Unfortunately, with types the coloring can degenerate and produce big tables. If this is an issue, the options `--type-poset` use the previous coloring method for types

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

9 years agoMerge: Misc for lib
Jean Privat [Tue, 31 Mar 2015 00:44:48 +0000 (07:44 +0700)]
Merge: Misc for lib

Litttle features and warning-fixes for the libs

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

9 years agoMerge: iOS support
Jean Privat [Tue, 31 Mar 2015 00:44:42 +0000 (07:44 +0700)]
Merge: iOS support

Adds a target platform in the compiler which generates an XCode project for iOS applications.

Intro the `ios` projet to group services for iOS. It implements the callbacks expected by the iOS system for a basic graphical application. It also triggers compilation for the iOS platform.

Adds one example of a graphical application `hello_ios` and a very minimal test for the iOS platform.

This is still very much a work in progress, you will notice many TODO in the code. Here are some of the next features to implement:
* Extend support to all iOS devices, not only the iPhone in the simulator.
* Reorganize annotations for app.nit: app_name, package_name, and maybe organization_name.
* Add more services of the Cocoa touch library and rewrite the `hello_ios` app in Nit.
* Support assets and other game related features.
* Some cleanup of the generated XCode project files could be a good thing.

Pull-Request: #1227
Reviewed-by: Jean Privat <jean@pryen.org>
Reviewed-by: Lucas Bajolet <r4pass@hotmail.com>
Reviewed-by: Romain Chanoir <chanoir.romain@courrier.uqam.ca>

9 years agoMerge: sepcomp: fixup trampoline with tagged primitive values
Jean Privat [Tue, 31 Mar 2015 00:44:35 +0000 (07:44 +0700)]
Merge: sepcomp: fixup trampoline with tagged primitive values

Thus fix --trampoline-call (and --link-boost)

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

9 years agoMerge: Fix escape to c
Jean Privat [Tue, 31 Mar 2015 00:44:30 +0000 (07:44 +0700)]
Merge: Fix escape to c

close #1223

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

9 years agoMerge: Fix warnings from clang on OS X
Jean Privat [Tue, 31 Mar 2015 00:44:23 +0000 (07:44 +0700)]
Merge: Fix warnings from clang on OS X

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

9 years agolib/template: migrate the example to new constructors
Jean Privat [Mon, 30 Mar 2015 13:01:05 +0000 (20:01 +0700)]
lib/template: migrate the example to new constructors

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

9 years agolib/geometry: document ILine
Jean Privat [Mon, 30 Mar 2015 13:00:40 +0000 (20:00 +0700)]
lib/geometry: document ILine

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

9 years agolib: move privileges.nit to its subdirectory
Jean Privat [Mon, 30 Mar 2015 12:51:15 +0000 (19:51 +0700)]
lib: move privileges.nit to its subdirectory

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

9 years agolib/standard: document FileReader::from_fd
Jean Privat [Mon, 30 Mar 2015 12:48:34 +0000 (19:48 +0700)]
lib/standard: document FileReader::from_fd

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

9 years agolib/standard: factorize File*::close
Jean Privat [Mon, 30 Mar 2015 12:46:44 +0000 (19:46 +0700)]
lib/standard: factorize File*::close

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

9 years agolib/standard: add Collection::not_empty
Jean Privat [Mon, 30 Mar 2015 12:37:44 +0000 (19:37 +0700)]
lib/standard: add Collection::not_empty

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

9 years agolib/sorter: add `MapRead::keys_sorted_by_values` and the related comparator
Jean Privat [Mon, 30 Mar 2015 12:33:51 +0000 (19:33 +0700)]
lib/sorter: add `MapRead::keys_sorted_by_values` and the related comparator

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

9 years agotests: skip iOS tests on GNU/Linux
Alexis Laferrière [Sun, 29 Mar 2015 19:55:33 +0000 (15:55 -0400)]
tests: skip iOS tests on GNU/Linux

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

9 years agolib/ios: add the simple hello_ios app
Alexis Laferrière [Sun, 29 Mar 2015 15:01:44 +0000 (11:01 -0400)]
lib/ios: add the simple hello_ios app

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

9 years agotests: add a very minimal test for the iOS platform
Alexis Laferrière [Fri, 27 Mar 2015 22:41:28 +0000 (18:41 -0400)]
tests: add a very minimal test for the iOS platform

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

9 years agolib: intro the iOS library
Alexis Laferrière [Thu, 15 Jan 2015 16:03:52 +0000 (11:03 -0500)]
lib: intro the iOS library

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