ni: fix allowing to rename parameters for redef as extern method

Is actually used by nits to generated expected names. Will but more
useful with inline interface.

Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>
icode: do not visit non-existant instanciation iroutines of extern classes

Fixes global compilation of programs using extern constructors.

Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>
c_src: fix last update, _nitni.h s were referring to _nit.h from Nit src

Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>
lib: adds a method to force invocation of garbage collector

The method Sys::force_garbage_collection is implemented internally.

Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>
ni: adds system to manage native local references to Nit objects

This ensures that references to Nit objects from C within an extern
method are preserved when the GC is invoqued. Theses references
are registered automatically when any callback to the Nit system is
made. They are registered in a stack, local to the currently executing
extern method (ie the one on the top of the execution stack). All
registered references are cleared on the function return.

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

Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>
add src/doc in gitignore

This will remove pollution in git tools when trying nitdoc in src.

Signed-off-by: Jean Privat <jean@pryen.org>
nitc: move line coloration to Location

Signed-off-by: Jean Privat <jean@pryen.org>
extract new module toolcontext from mmloader

Signed-off-by: Jean Privat <jean@pryen.org>
parser: generalize n_propdefs to AClassdef

Signed-off-by: Jean Privat <jean@pryen.org>
parser: new class ASendReassignFormExpr

This class specializes ASendExpr and AReassignFormExpr
and generalize ACallReassignExpr and ABraReassignExpr

In fact, specializing ASendExpr is not ideal but removing this link
will require more factorization.

Signed-off-by: Jean Privat <jean@pryen.org>
clean: make some classes abstract or interfaces

Some even have 'abstract' in their names.

Signed-off-by: Jean Privat <jean@pryen.org>
lib: add 'module' keyword to environ

Signed-off-by: Jean Privat <jean@pryen.org>
parser: simplify constroctors of nodes

in parser_nodes, ANode has an empty constructor inherited by all subclasses

Signed-off-by: Jean Privat <jean@pryen.org>
parser: add ANode::debug

This method simplify debugging.
The programmer can use debug instead of print to print traces and values.

Signed-off-by: Jean Privat <jean@pryen.org>
parser: add __debug__ type construct

The __debug__ syntax could be extended to force dialog with the compiler.

Signed-off-by: Jean Privat <jean@pryen.org>
syntax: implements __debug__ type construct

Signed-off-by: Jean Privat <jean@pryen.org>
tests: do not fail test_attr

_i and _j are not initialized.
but the current compiler do not check that Sys is correctly built.

Signed-off-by: Jean Privat <jean@pryen.org>
tests: generate files in out/ instead of tests/

Signed-off-by: Jean Privat <jean@pryen.org>
ni: adds global references to Nit objects from C code

Allows to preserve a reference during program execution. It is valid
no matter the extern method invoked.

Uses a global list to preserve all references explicitly asked to be
kept in the program. The user must call Object_incr_ref( Object obj )
to increment the reference count of obj. If it's reference count was
at 0, then it will be added to the global list.

The same Nit object may be present multiple times in the global list.
Only reference incrementation on the same C structure represernting
the object will increment the same counter.

This algorithm allows for fast increment, no matter how many global
references are already registered.

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