nit.git
9 years agoandroid: alwas generate `res/values/string.xml` if it does not exist
Alexis Laferrière [Wed, 30 Jul 2014 21:24:56 +0000 (17:24 -0400)]
android: alwas generate `res/values/string.xml` if it does not exist

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

9 years agoandroid: search for an icon in the res folder
Alexis Laferrière [Wed, 30 Jul 2014 21:24:18 +0000 (17:24 -0400)]
android: search for an icon in the res folder

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

9 years agoMerge: Toplevel for sys and exit
Jean Privat [Wed, 30 Jul 2014 18:08:58 +0000 (14:08 -0400)]
Merge: Toplevel for sys and exit

Because the new c_src can deal with it

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

9 years agoMerge: Android annotations and longs
Jean Privat [Wed, 30 Jul 2014 18:08:56 +0000 (14:08 -0400)]
Merge: Android annotations and longs

Fixes #621 and problems with annotations priority.

The new organization of mnit_simple, and its annotations, means that you can compile any of the test_*.nit and it will create a `.apk` with a distinct package. Thus they can be installed side by side, but they all have the same display name :(

Using Java `long` on Android works again, but they are not fully compatible with Nit's `Int`. Java's `long` are on 64 bits, and Nit's `Int` on 32 bit under ARM. There may be data loss.

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

9 years agoMerge: The Web server nitcorn, libevent and others
Jean Privat [Wed, 30 Jul 2014 18:08:53 +0000 (14:08 -0400)]
Merge: The Web server nitcorn, libevent and others

This PR contains many fixes and a major rework of the Nitcorn project by Jean-Philippe Caissy, Frederic Sevillano and Guillaume Auger.

Nitcorn is a Web server framework to create sever-side applications in Nit. It is currently used at http://tnitter.xymus.net/ and http://vps.xymus.net/nit/index.html The README files is missing and will be added soon.

What it does do:
* GET and POST support (for small uploads)
* Virtual hosts and routes
* Sessions
* Reading cookies
* Adding virtual hosts (and interfaces) on the fly
* Adding/removing route on the fly
* Play well with existing modules `drop_privileges`, `md5` and `sqlite3`.

What it does not do (yet):
* Encryption
* Support receiving big files
* Writing cookies
* Remove virtual hosts (and interfaces) on the fly

The Tnitter project will be in a future PR.

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

9 years agopnacl: redef exit as a top-level
Jean Privat [Wed, 30 Jul 2014 12:41:46 +0000 (08:41 -0400)]
pnacl: redef exit as a top-level

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

9 years agotests: update sav/base_gen_reassign because line changes in kernel.nit
Jean Privat [Wed, 30 Jul 2014 15:44:17 +0000 (11:44 -0400)]
tests: update sav/base_gen_reassign because line changes in kernel.nit

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

9 years agojava: cast arguments passed to JNI
Alexis Laferrière [Wed, 30 Jul 2014 17:14:01 +0000 (13:14 -0400)]
java: cast arguments passed to JNI

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

9 years agoexamples: remove annotations used to avoid bug in mnit_simple
Alexis Laferrière [Wed, 30 Jul 2014 17:13:23 +0000 (13:13 -0400)]
examples: remove annotations used to avoid bug in mnit_simple

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

9 years agoandroid: fix priority annotations bug
Alexis Laferrière [Wed, 30 Jul 2014 16:12:42 +0000 (12:12 -0400)]
android: fix priority annotations bug

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

9 years agoexamples: add two nitcorn examples
Alexis Laferrière [Thu, 24 Jul 2014 19:04:45 +0000 (15:04 -0400)]
examples: add two nitcorn examples

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

9 years agolib: intro the web server nitcorn
Alexis Laferrière [Tue, 22 Jul 2014 21:41:40 +0000 (17:41 -0400)]
lib: intro the web server nitcorn

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

9 years agolib: intro libevent
Alexis Laferrière [Thu, 24 Jul 2014 14:45:37 +0000 (10:45 -0400)]
lib: intro libevent

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

9 years agolib: intro Text::split_once_on
Alexis Laferrière [Wed, 30 Jul 2014 12:46:47 +0000 (08:46 -0400)]
lib: intro Text::split_once_on

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

9 years agolib: intro `Text::is_hex`
Alexis Laferrière [Thu, 24 Jul 2014 14:38:11 +0000 (10:38 -0400)]
lib: intro `Text::is_hex`

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

9 years agolib: intro percent encoding/decoding methods
Alexis Laferrière [Thu, 24 Jul 2014 03:46:28 +0000 (23:46 -0400)]
lib: intro percent encoding/decoding methods

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

9 years agolib/sqlite3: fix empty row on select without results
Alexis Laferrière [Thu, 24 Jul 2014 02:26:21 +0000 (22:26 -0400)]
lib/sqlite3: fix empty row on select without results

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

9 years agolib/sqlite3: fix conversion of NativeString to String
Alexis Laferrière [Mon, 21 Jul 2014 18:50:38 +0000 (14:50 -0400)]
lib/sqlite3: fix conversion of NativeString to String

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

9 years agolib/sqlite3: add the service `String::to_sql_string`
Alexis Laferrière [Thu, 24 Jul 2014 00:40:03 +0000 (20:40 -0400)]
lib/sqlite3: add the service `String::to_sql_string`

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

9 years agoMerge: Utf8 strings
Jean Privat [Wed, 30 Jul 2014 01:06:54 +0000 (21:06 -0400)]
Merge: Utf8 strings

(Re?)Introducing Unicode strings (with UTF-8) with mandatory indexes for now, the module is incomplete yet (don't go and try to concatenate two UTF-8 FlatStrings, you'll be surprised by the result).

There's still some work to do on the global API, but here's a WIP version that should not break anything, any comments are welcome !

Pull-Request: #602
Reviewed-by: Jean Privat <jean@pryen.org>
Reviewed-by: Frédéric Vachon <fredvac@gmail.com>

9 years agoMerge: Ropes optimizations
Jean Privat [Wed, 30 Jul 2014 01:06:51 +0000 (21:06 -0400)]
Merge: Ropes optimizations

Small optimizations on Rope, significantly speeds-up concatenation and indexed access, however, slows substring.

Before :
 * `./substr_bench -m rope --loops 100000 --strlen 25 --ccts 10 NIT_GC_CHOOSER=large` => 0.12s
 * `./chain_concat -m rope --loops 100000 --strlen 25 --ccts 10 NIT_GC_CHOOSER=large` => 1.47s
 * `./iteration_bench -m rope --iter-mode index --loops 100000 --strlen 25 --ccts 10 NIT_GC_CHOOSER=large` => 20.95s

After :
 * `./substr_bench -m rope --loops 100000 --strlen 25 --ccts 10 NIT_GC_CHOOSER=large` => 0.36s
 * `./chain_concat -m rope --loops 100000 --strlen 25 --ccts 10 NIT_GC_CHOOSER=large` => 0.25s
 * `./iteration_bench -m rope --iter-mode index --loops 100000 --strlen 25 --ccts 10 NIT_GC_CHOOSER=large` => 1.47s

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

9 years agoMerge: Benchmarks string
Jean Privat [Wed, 30 Jul 2014 01:06:48 +0000 (21:06 -0400)]
Merge: Benchmarks string

After postponing for a while, here are a few micro-benches (concat, substring, iteration using indexes or iterator) for variants of Text available at the moment with a shell script for automation.

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

9 years agoMerge: mnit_simple: rename FDROID metadata to match the java_package
Jean Privat [Tue, 29 Jul 2014 20:16:28 +0000 (16:16 -0400)]
Merge: mnit_simple: rename FDROID metadata to match the java_package

Pull-Request: #622

9 years agoMerge: gitignore: some update
Jean Privat [Tue, 29 Jul 2014 20:16:23 +0000 (16:16 -0400)]
Merge: gitignore: some update

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

9 years agoMerge: c_src: update
Jean Privat [Tue, 29 Jul 2014 20:16:06 +0000 (16:16 -0400)]
Merge: c_src: update

A fresh regeneration of the c_src. It is the first one based on `nitg --semi-global`.
Developers of the compiler and the stdlib can now use more new and fancy features of the Nit language.

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

9 years agolib/bufferized_ropes: Force insert_at for + operation
Lucas Bajolet [Tue, 29 Jul 2014 18:24:12 +0000 (14:24 -0400)]
lib/bufferized_ropes: Force insert_at for + operation

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

9 years agobenchmarks: Added script for all string-related benchmarks
Lucas Bajolet [Tue, 29 Jul 2014 14:59:47 +0000 (10:59 -0400)]
benchmarks: Added script for all string-related benchmarks

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

9 years agobenchmarks/string: Added String benchmarks
Lucas Bajolet [Tue, 29 Jul 2014 17:20:36 +0000 (13:20 -0400)]
benchmarks/string: Added String benchmarks

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

9 years agolib/standard/ropes: + operation in O(1) time now
Lucas Bajolet [Tue, 29 Jul 2014 17:14:38 +0000 (13:14 -0400)]
lib/standard/ropes: + operation in O(1) time now

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

9 years agotyping: no more special case for `sys` and `exit`
Jean Privat [Tue, 29 Jul 2014 14:08:43 +0000 (10:08 -0400)]
typing: no more special case for `sys` and `exit`

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

9 years agolib: `sys` and `exit` are toplevel
Jean Privat [Tue, 29 Jul 2014 14:07:57 +0000 (10:07 -0400)]
lib: `sys` and `exit` are toplevel

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

9 years agoc_src: update
Jean Privat [Mon, 28 Jul 2014 22:28:29 +0000 (18:28 -0400)]
c_src: update

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

9 years agotests: add passing Int in basic Java test
Alexis Laferrière [Tue, 29 Jul 2014 16:56:59 +0000 (12:56 -0400)]
tests: add passing Int in basic Java test

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

9 years agotests: Test for UTF-8 Strings.
Lucas Bajolet [Thu, 17 Jul 2014 17:54:23 +0000 (13:54 -0400)]
tests: Test for UTF-8 Strings.

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

9 years agolib/string_exp/utf8: Fixed print routine to support UTF8 strings.
Lucas Bajolet [Tue, 29 Jul 2014 15:13:42 +0000 (11:13 -0400)]
lib/string_exp/utf8: Fixed print routine to support UTF8 strings.

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

9 years agolib/string_exp/utf8: Output usable with UTF-8.
Lucas Bajolet [Mon, 21 Jul 2014 14:57:38 +0000 (10:57 -0400)]
lib/string_exp/utf8: Output usable with UTF-8.

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

9 years agolib/string_exp/utf8: to_upper/lower usable with UTF-8 strings.
Lucas Bajolet [Mon, 21 Jul 2014 14:56:22 +0000 (10:56 -0400)]
lib/string_exp/utf8: to_upper/lower usable with UTF-8 strings.

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

9 years agolib/string_exp/utf8: Implemented to_upper/to_lower on UnicodeChar.
Lucas Bajolet [Mon, 21 Jul 2014 14:55:04 +0000 (10:55 -0400)]
lib/string_exp/utf8: Implemented to_upper/to_lower on UnicodeChar.

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

9 years agolib/string_ext/utf8: to_cstring will work on UTF-8 strings now.
Lucas Bajolet [Mon, 21 Jul 2014 16:03:12 +0000 (12:03 -0400)]
lib/string_ext/utf8: to_cstring will work on UTF-8 strings now.

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

9 years agolib/string_exp/utf8: Substring now works with UTF-8 strings (pre-indexed).
Lucas Bajolet [Mon, 21 Jul 2014 14:52:46 +0000 (10:52 -0400)]
lib/string_exp/utf8: Substring now works with UTF-8 strings (pre-indexed).

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

9 years agolib/string_exp/utf8: Adapted reverse service on UTF-8 strings.
Lucas Bajolet [Mon, 21 Jul 2014 14:45:25 +0000 (10:45 -0400)]
lib/string_exp/utf8: Adapted reverse service on UTF-8 strings.

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

9 years agolib/string_exp/utf8: UnicodeChars can be tested for strict equivalence.
Lucas Bajolet [Mon, 21 Jul 2014 14:38:47 +0000 (10:38 -0400)]
lib/string_exp/utf8: UnicodeChars can be tested for strict equivalence.

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

9 years agolib/string_exp/utf8: Added routine to compute code point on a UTF-8 character.
Lucas Bajolet [Mon, 21 Jul 2014 14:37:11 +0000 (10:37 -0400)]
lib/string_exp/utf8: Added routine to compute code point on a UTF-8 character.

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

9 years agolib/string_exp/utf8: Adapted * for FlatString with UTF-8 chars
Lucas Bajolet [Mon, 21 Jul 2014 14:35:51 +0000 (10:35 -0400)]
lib/string_exp/utf8: Adapted * for FlatString with UTF-8 chars

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

9 years agolib/string_exp/utf8: Adapted the construction from a CString to work with UTF-8.
Lucas Bajolet [Tue, 29 Jul 2014 15:13:02 +0000 (11:13 -0400)]
lib/string_exp/utf8: Adapted the construction from a CString to work with UTF-8.

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

9 years agolib/string_exp/utf8: Introducing UTF-8 basics for String.
Lucas Bajolet [Mon, 21 Jul 2014 14:18:48 +0000 (10:18 -0400)]
lib/string_exp/utf8: Introducing UTF-8 basics for String.

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

9 years agolib/string_experimentations: Added README for project
Lucas Bajolet [Mon, 21 Jul 2014 16:48:27 +0000 (12:48 -0400)]
lib/string_experimentations: Added README for project

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

9 years agolib/string_experimentations: Added module for importation of string_experimentations
Lucas Bajolet [Mon, 21 Jul 2014 15:37:41 +0000 (11:37 -0400)]
lib/string_experimentations: Added module for importation of string_experimentations

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

9 years agolib/standard/ropes: Added cache on indexed access.
Lucas Bajolet [Fri, 6 Jun 2014 17:58:25 +0000 (13:58 -0400)]
lib/standard/ropes: Added cache on indexed access.

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

9 years agoMerge: model: add `MType::as_notnullable` to remove the `nullable` modifier
Jean Privat [Mon, 28 Jul 2014 18:29:23 +0000 (14:29 -0400)]
Merge: model: add `MType::as_notnullable` to remove the `nullable` modifier

Basically replace

~~~
if m isa MNullableType then m = m.mtype
~~~

by

~~~
m = m.as_notnullable
~~~

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

9 years agoMerge: type works: handle implicitly fixed formal parameters
Jean Privat [Mon, 28 Jul 2014 18:29:19 +0000 (14:29 -0400)]
Merge: type works: handle implicitly fixed formal parameters

~~~
class G[E: Int]
   # Here, since Int cannot have a subclass, then E == Int (implicitly fixed)
end
~~~

This series enhance the type system to understand this case, and give the user a warning when bounding formal parameter with final classes.

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

9 years agoMerge: Magic configuration for bash completion
Jean Privat [Mon, 28 Jul 2014 18:29:16 +0000 (14:29 -0400)]
Merge: Magic configuration for bash completion

Some bash magic to lazy load and configure bash_completion for nit.

Steps for a functional installation:

0. [if you have old binaries] `$ rm c_src/nitg`
1. `$ make`
2. [optional], put the `bin` directory in your PATH
3. `$ source misc/bash_completion/nit`
4. [optional] link (or copy) `misc/bash_completion/nit` in `/etc/bash_completion.d`, or source it in `~/.bash_completion`
5. profit

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

9 years agomnit_simple: rename FDROID metadata to match the java_package
Jean Privat [Mon, 28 Jul 2014 17:54:44 +0000 (13:54 -0400)]
mnit_simple: rename FDROID metadata to match the java_package

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

9 years agobash_completion: add a magic script that do the bash_completion setup
Jean Privat [Thu, 24 Jul 2014 15:32:59 +0000 (11:32 -0400)]
bash_completion: add a magic script that do the bash_completion setup

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

9 years agotests: update test_toolcontext
Jean Privat [Thu, 24 Jul 2014 15:38:07 +0000 (11:38 -0400)]
tests: update test_toolcontext

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

9 years agotool_context: do not need an attribute bash_completion
Jean Privat [Thu, 24 Jul 2014 15:09:00 +0000 (11:09 -0400)]
tool_context: do not need an attribute bash_completion

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

9 years agotool_context: just print the bash_completion, let the caller do what it want
Jean Privat [Thu, 24 Jul 2014 15:08:33 +0000 (11:08 -0400)]
tool_context: just print the bash_completion, let the caller do what it want

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

9 years agotool_context: correct default for bashcompletion
Jean Privat [Thu, 24 Jul 2014 15:06:53 +0000 (11:06 -0400)]
tool_context: correct default for bashcompletion

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

9 years agoMerge: Bufferized ropes
Jean Privat [Thu, 24 Jul 2014 19:42:12 +0000 (15:42 -0400)]
Merge: Bufferized ropes

Added module to lib for the support of an experimental way of handling ropes using Buffers as leaves.

Will require the merge of PRs #516 and #518 for tests to comply.

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

9 years agosrc: use `as_notnullable` in code
Jean Privat [Thu, 24 Jul 2014 18:46:33 +0000 (14:46 -0400)]
src: use `as_notnullable` in code

Basically replace

~~~
if m isa MNullableType then m = m.mtype
~~~

by

~~~
m = m.as_notnullable
~~~

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

9 years agomodel: add `MType::as_notnullable` to remove the `nullable` modifier
Jean Privat [Thu, 24 Jul 2014 18:44:33 +0000 (14:44 -0400)]
model: add `MType::as_notnullable` to remove the `nullable` modifier

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

9 years agotests: update existing savs (new warning or updates)
Jean Privat [Thu, 24 Jul 2014 18:34:55 +0000 (14:34 -0400)]
tests: update existing savs (new warning or updates)

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

9 years agotests: add base_gen_final_bound.nit
Jean Privat [Thu, 24 Jul 2014 18:10:18 +0000 (14:10 -0400)]
tests: add base_gen_final_bound.nit

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

9 years agomodelize_classes: warn on parameter types bounded on final classes
Jean Privat [Thu, 24 Jul 2014 18:07:46 +0000 (14:07 -0400)]
modelize_classes: warn on parameter types bounded on final classes

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

9 years agomodel: MParameterType.resolve_for handle the case of primitive bounds
Jean Privat [Thu, 24 Jul 2014 18:06:15 +0000 (14:06 -0400)]
model: MParameterType.resolve_for handle the case of primitive bounds

~~~
class G[E: Int]
   # Since Int cannot have sublclasses, E == Int
end
~~~

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

9 years agotyping: generalize warning on useless type tests.
Jean Privat [Thu, 24 Jul 2014 18:03:54 +0000 (14:03 -0400)]
typing: generalize warning on useless type tests.

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

9 years agotests: fix a typing error in some tests
Jean Privat [Thu, 24 Jul 2014 17:54:42 +0000 (13:54 -0400)]
tests: fix a typing error in some tests

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

9 years agotool_context: bashcompletion use the basename of sys.program_name
Jean Privat [Thu, 24 Jul 2014 15:06:29 +0000 (11:06 -0400)]
tool_context: bashcompletion use the basename of sys.program_name

as program_name can be a complex path.

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

9 years agolib/opts: cleaner init
Alexis Laferrière [Thu, 24 Jul 2014 00:39:38 +0000 (20:39 -0400)]
lib/opts: cleaner init

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

9 years agolib: intro `FStream::fd`
Alexis Laferrière [Wed, 23 Jul 2014 18:42:11 +0000 (14:42 -0400)]
lib: intro `FStream::fd`

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

9 years agolib/standard/ropes: Adapted substring iterators to new API.
Lucas Bajolet [Thu, 24 Jul 2014 14:19:55 +0000 (10:19 -0400)]
lib/standard/ropes: Adapted substring iterators to new API.

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

9 years agolib/bufferized_ropes: Redef to_leaf in concat to work with BufferLeaf
Lucas Bajolet [Thu, 24 Jul 2014 14:17:47 +0000 (10:17 -0400)]
lib/bufferized_ropes: Redef to_leaf in concat to work with BufferLeaf

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

9 years agolib/bufferized_ropes: Added default size of a buffer for rope leaves.
Lucas Bajolet [Thu, 24 Jul 2014 14:17:25 +0000 (10:17 -0400)]
lib/bufferized_ropes: Added default size of a buffer for rope leaves.

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

9 years agolib/bufferized_ropes: Added tests for bufferized ropes.
Lucas Bajolet [Thu, 24 Jul 2014 14:13:58 +0000 (10:13 -0400)]
lib/bufferized_ropes: Added tests for bufferized ropes.

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

9 years agolib/bufferized_ropes: Adapted substring and insert_at for bufferized ropes.
Lucas Bajolet [Wed, 25 Jun 2014 14:49:17 +0000 (10:49 -0400)]
lib/bufferized_ropes: Adapted substring and insert_at for bufferized ropes.

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

9 years agolib/bufferized_ropes: Added methods to handle creation of a new node in a Rope.
Lucas Bajolet [Mon, 23 Jun 2014 15:27:17 +0000 (11:27 -0400)]
lib/bufferized_ropes: Added methods to handle creation of a new node in a Rope.

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

9 years agolib/bufferized_ropes: Added lazy operations for substring and to_s on FlatBuffer.
Lucas Bajolet [Mon, 23 Jun 2014 15:26:25 +0000 (11:26 -0400)]
lib/bufferized_ropes: Added lazy operations for substring and to_s on FlatBuffer.

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

9 years agolib/standard/ropes: Added BufferLeaf to constructors.
Lucas Bajolet [Mon, 23 Jun 2014 15:23:33 +0000 (11:23 -0400)]
lib/standard/ropes: Added BufferLeaf to constructors.

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

9 years agolib/bufferized_ropes: Added module bufferized_ropes to lib.
Lucas Bajolet [Mon, 23 Jun 2014 15:18:45 +0000 (11:18 -0400)]
lib/bufferized_ropes: Added module bufferized_ropes to lib.

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

9 years agogitignore: some update
Jean Privat [Thu, 24 Jul 2014 13:59:36 +0000 (09:59 -0400)]
gitignore: some update

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

9 years agoMerge: lib/standard: assert "/home/../".simplify_path == "/"
Jean Privat [Wed, 23 Jul 2014 20:33:22 +0000 (16:33 -0400)]
Merge: lib/standard: assert "/home/../".simplify_path == "/"

Fixes #614

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

9 years agoMerge: Tired of having to remember all the Nit options? Try bash_completion!
Jean Privat [Wed, 23 Jul 2014 20:33:16 +0000 (16:33 -0400)]
Merge: Tired of having to remember all the Nit options? Try bash_completion!

This PR enables the option --gen-bash-completion that allow user to generate a bash completion file.

Exemple with `nitdoc`:

    $ nitdoc --gen-bash-completion
    $ sudo ln -s <nitdir>/bin/nitdoc.bash /etc/bash_completion.d/nitdoc
    $ . /etc/bash_completion.d/nitdoc

Then:

    $ nitdoc [TAB][TAB]
    $ file1.nit    file2.nit    file3.nit

    $ nitdoc --[TAB][TAB]
    --bash-toolname         --github-base-sha1      --no-dot                --sharedir
    --custom-brand          --github-gitdir         --only-metamodel        --shareurl
    --custom-footer-text    --github-upstream       --only-parse            --source
    --custom-overview-text  --help                  --path                  --stop-on-first-error
    --custom-title          --ignore-visibility     --piwik-site-id         --verbose
    --dir                   --log                   --piwik-tracker         --version
    --disable-phase         --log-dir               --private               --warn
    --gen-bash-completion   --no-color              --quiet

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

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

9 years agoMerge: rename Sys::args
Jean Privat [Wed, 23 Jul 2014 18:22:58 +0000 (14:22 -0400)]
Merge: rename Sys::args

A step towards #461 since I do not want to do a mass migration.

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

9 years agoMerge: Opts: small improvement
Jean Privat [Wed, 23 Jul 2014 18:22:54 +0000 (14:22 -0400)]
Merge: Opts: small improvement

- syntax & comment
- hide an option
- fix an old bug

This rewrites and closes #531

Pull-Request: #612
Reviewed-by: Frédéric Vachon <fredvac@gmail.com>
Reviewed-by: Alexandre Terrasa <alexandre@moz-code.org>

9 years agoMerge: Add annotation `fixed` for virtual types
Jean Privat [Wed, 23 Jul 2014 18:22:52 +0000 (14:22 -0400)]
Merge: Add annotation `fixed` for virtual types

Fixed virtual types prevent redefinition is subclasses

~~~
class A
   type F: Foo is fixed
end
class B
   super A
   redef type F: Foo # Static error
end
~~~

Currently, there is no really apparent benefit of fixed virtual types because the hack of `typing::check_subtype`. Thus this is only a step toward the resolution of #298.

Note: the first commits introduce the basic verification on redefinitons of virtual types that is missing; but nobody saw that there was no checks.

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

9 years agoMerge: Introduce `neo`: a model saver/loader from/to neo4j.
Jean Privat [Wed, 23 Jul 2014 18:22:49 +0000 (14:22 -0400)]
Merge: Introduce `neo`: a model saver/loader from/to neo4j.

The `neo` module can be used to save or load a model from a Neo4j graph database.

Next pull requests will bring tools based on `neo`.

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

9 years agotests: add `test_toolcontext`
Alexandre Terrasa [Wed, 23 Jul 2014 17:28:33 +0000 (13:28 -0400)]
tests: add `test_toolcontext`

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

9 years agotests: add `test_neo`
Alexandre Terrasa [Mon, 21 Jul 2014 14:38:42 +0000 (10:38 -0400)]
tests: add `test_neo`

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

9 years agotests: introduces `test_prog` a program that build a fake documented model to test...
Alexandre Terrasa [Mon, 21 Jul 2014 14:38:12 +0000 (10:38 -0400)]
tests: introduces `test_prog` a program that build a fake documented model to test model related tools.

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

9 years agosrc: Introduces `neo` a module for save and load Nit models intro a Neo4j graph database.
Alexandre Terrasa [Mon, 21 Jul 2014 14:36:12 +0000 (10:36 -0400)]
src: Introduces `neo` a module for save and load Nit models intro a Neo4j graph database.

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

9 years agoneo4j: add `save_entity` shortcut in NeoBatch.
Alexandre Terrasa [Wed, 23 Jul 2014 17:06:13 +0000 (13:06 -0400)]
neo4j: add `save_entity` shortcut in NeoBatch.

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

9 years agoneo4j: add `with_labels` to load node having multiple labels in one Cypher query.
Alexandre Terrasa [Mon, 21 Jul 2014 14:35:05 +0000 (10:35 -0400)]
neo4j: add `with_labels` to load node having multiple labels in one Cypher query.

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

9 years agolib/standard: assert "/home/../".simplify_path == "/"
Jean Privat [Wed, 23 Jul 2014 16:48:41 +0000 (12:48 -0400)]
lib/standard: assert "/home/../".simplify_path == "/"

Fixes #614

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

9 years agotoolcontext: add `bash_completion` generation option for nit tools.
Alexandre Terrasa [Wed, 23 Jul 2014 16:28:21 +0000 (12:28 -0400)]
toolcontext: add `bash_completion` generation option for nit tools.

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

9 years agotemplate: add `Template::addn` service
Alexandre Terrasa [Tue, 15 Jul 2014 19:17:24 +0000 (15:17 -0400)]
template: add `Template::addn` service

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

9 years agotoolcontext: provide option `set-dummy-tool` used to fix the `toolname` and `version...
Alexandre Terrasa [Wed, 23 Jul 2014 16:27:28 +0000 (12:27 -0400)]
toolcontext: provide option `set-dummy-tool` used to fix the `toolname` and `version` services so they return respectively "DUMMY_TOOL" and "DUMMY_VERSION".

Useful for testing.

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

9 years agotests: extends test_opts for grouped single options
Jean Privat [Wed, 23 Jul 2014 01:30:49 +0000 (21:30 -0400)]
tests: extends test_opts for grouped single options

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

9 years agotests: add base_virtual_type_fixed.nit
Jean Privat [Wed, 23 Jul 2014 02:20:08 +0000 (22:20 -0400)]
tests: add base_virtual_type_fixed.nit

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

9 years agomodel: introduce `MVirtualType::is_fixed` used indirectly by is_subtype
Jean Privat [Wed, 23 Jul 2014 02:17:48 +0000 (22:17 -0400)]
model: introduce `MVirtualType::is_fixed` used indirectly by is_subtype

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

9 years agotyping: remove hack for top-level method `args`
Jean Privat [Wed, 23 Jul 2014 01:45:20 +0000 (21:45 -0400)]
typing: remove hack for top-level method `args`

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