nit.git
14 years agosyntax: 'meth' -> 'fun', 'attr' -> 'var'
Jean Privat [Fri, 26 Jun 2009 14:40:54 +0000 (10:40 -0400)]
syntax: 'meth' -> 'fun', 'attr' -> 'var'

Tests results are updated to reflect the column change in error messages.

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

14 years agotools: generate version number and give it to tools
Jean Privat [Fri, 26 Jun 2009 04:55:52 +0000 (00:55 -0400)]
tools: generate version number and give it to tools

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

14 years agotools: programs know their names
Jean Privat [Fri, 26 Jun 2009 04:53:21 +0000 (00:53 -0400)]
tools: programs know their names

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

14 years agonullable: enforce static and dynamic rules.
Jean Privat [Thu, 25 Jun 2009 20:29:26 +0000 (16:29 -0400)]
nullable: enforce static and dynamic rules.

Switch warnings to errors.
Update tests to let them not produce errors. Note that:
 * base_nullable.nit have new error cases
 * test_isa.nit add some test cases
 * test_nil.nit is removed since it is to much outdated.

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

14 years agonullable: convert lib, tools and tests
Jean Privat [Thu, 25 Jun 2009 02:27:08 +0000 (22:27 -0400)]
nullable: convert lib, tools and tests

Add nullable, as(not null) and cie to libs, nitc, nitdoc and tests such
that they compile and run without nullable-related warnings.

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

14 years agoc_src: regenerate with soft nullable handling
Jean Privat [Thu, 25 Jun 2009 21:24:17 +0000 (17:24 -0400)]
c_src: regenerate with soft nullable handling

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

14 years agometamodel: fix MMType::is_valid for indirect types
Jean Privat [Thu, 25 Jun 2009 21:15:39 +0000 (17:15 -0400)]
metamodel: fix MMType::is_valid for indirect types

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

14 years agocompile: no default value for notnull primitive attributes.
Jean Privat [Wed, 24 Jun 2009 19:16:33 +0000 (15:16 -0400)]
compile: no default value for notnull primitive attributes.

However, instead of segfaulting, using an uninitialized attribute may
behave like if it was initialized to 0 (whatever it means).

Therefore the new test base_attr_nullable_int.nit makes more sense with -W to
activate non-lethal runtime warnings.

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

14 years agonullable: type, compile and test 'isset _attr'
Jean Privat [Wed, 24 Jun 2009 18:44:24 +0000 (14:44 -0400)]
nullable: type, compile and test 'isset _attr'

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

14 years agocompile: implicit isset for attribute read access
Jean Privat [Wed, 24 Jun 2009 08:57:45 +0000 (04:57 -0400)]
compile: implicit isset for attribute read access

Activated only if the program was compiled using -W and only display a
warning at run-time.
Therefore the new test base_attr_nullable.nit makes more sense with -W.

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

14 years agocompile: differentiate attribute read and write
Jean Privat [Wed, 24 Jun 2009 07:22:48 +0000 (03:22 -0400)]
compile: differentiate attribute read and write

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

14 years agosyntax: no isa/as warning for double nullable formal type
Jean Privat [Tue, 23 Jun 2009 21:22:11 +0000 (17:22 -0400)]
syntax: no isa/as warning for double nullable formal type

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

14 years agocompile: Check correct object construction
Jean Privat [Tue, 16 Jun 2009 13:45:23 +0000 (09:45 -0400)]
compile: Check correct object construction

Check that non nullable attributes are set at the end of the 'new'.
Activated only if the program was compiled using -W and only display a
warning at run-time.

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

14 years agosyntax: extends 'as' and 'isa' warning to nullable
Jean Privat [Thu, 18 Jun 2009 20:45:03 +0000 (16:45 -0400)]
syntax: extends 'as' and 'isa' warning to nullable

Example
  var x: nullable T
  var y = x.as(T) # Bad form
  var y = x.as(not null) # Good form
  if x isa T then ... # Bad form
  if x != null then ... # Good form

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

14 years agocompile: casts ('isa' and 'as') with nullable info
Jean Privat [Mon, 15 Jun 2009 20:54:57 +0000 (16:54 -0400)]
compile: casts ('isa' and 'as') with nullable info

Migration remark: considers that non-null objects can still contains null at runtime.

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

14 years agotests: base_nullable.nit and base_eq_null_notnull.nit
Jean Privat [Wed, 24 Jun 2009 19:54:22 +0000 (15:54 -0400)]
tests: base_nullable.nit and base_eq_null_notnull.nit

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

14 years agosyntax: "!= null" works like a "isa"
Jean Privat [Tue, 23 Jun 2009 17:48:46 +0000 (13:48 -0400)]
syntax: "!= null" works like a "isa"

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

14 years agotyping: warn when comparing null and not nullable
Jean Privat [Sat, 13 Jun 2009 04:42:08 +0000 (00:42 -0400)]
typing: warn when comparing null and not nullable

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

14 years agotests: nullable and array
Jean Privat [Mon, 15 Jun 2009 09:13:23 +0000 (05:13 -0400)]
tests: nullable and array

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

14 years agotyping: 'for' iterates on Collection[nullable Object]
Jean Privat [Fri, 12 Jun 2009 20:45:40 +0000 (16:45 -0400)]
typing: 'for' iterates on Collection[nullable Object]

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

14 years agonullable: type, compile and test 'as(not null)'
Jean Privat [Fri, 12 Jun 2009 14:59:28 +0000 (10:59 -0400)]
nullable: type, compile and test 'as(not null)'

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

14 years agosyntax: Update check_conform_multiexpr with nullables
Jean Privat [Fri, 12 Jun 2009 02:41:48 +0000 (22:41 -0400)]
syntax: Update check_conform_multiexpr with nullables

Add also some tests.

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

14 years agometamodel: add nullable static types
Jean Privat [Tue, 23 Jun 2009 17:54:47 +0000 (13:54 -0400)]
metamodel: add nullable static types

Syntax error on nullable type only display a warning

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

14 years agoparser: add nullables
Jean Privat [Wed, 10 Jun 2009 20:21:18 +0000 (16:21 -0400)]
parser: add nullables

add 'nullable' and 'isset' keywords.
add '.as(not null)' expression

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

14 years agotools: two -W promote warnings to errors
Jean Privat [Tue, 23 Jun 2009 19:13:44 +0000 (15:13 -0400)]
tools: two -W promote warnings to errors

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

14 years agolib/opt: add OptionCount
Jean Privat [Tue, 23 Jun 2009 19:11:50 +0000 (15:11 -0400)]
lib/opt: add OptionCount

An option count works like a OptionBool except it counts the number of
occurrences of the flag.

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

14 years agosrc: add nc0 and nc1 to test bootstrap from c_src
Jean Privat [Tue, 23 Jun 2009 14:39:52 +0000 (10:39 -0400)]
src: add nc0 and nc1 to test bootstrap from c_src

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

14 years agocompile: stop writing location of each node
Jean Privat [Tue, 23 Jun 2009 04:20:11 +0000 (00:20 -0400)]
compile: stop writing location of each node

So much runtime consuming.
Can always be reactivated in case of emergency.

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

14 years agocompile: clean compiling_global.nit
Jean Privat [Tue, 23 Jun 2009 04:10:02 +0000 (00:10 -0400)]
compile: clean compiling_global.nit

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

14 years agocompile: new class GlobalCompilerVisitor
Jean Privat [Tue, 23 Jun 2009 03:35:45 +0000 (23:35 -0400)]
compile: new class GlobalCompilerVisitor

Specialize CompilerVisitor to add global analysis information instead
of refininig it.

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

14 years agosyntax: fix OR if_false_var_ctx passing.
Jean Privat [Mon, 22 Jun 2009 20:05:00 +0000 (16:05 -0400)]
syntax: fix OR if_false_var_ctx passing.

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

14 years agosyntax: local variable assignment always cast
Jean Privat [Mon, 22 Jun 2009 18:53:02 +0000 (14:53 -0400)]
syntax: local variable assignment always cast

example:
  var a: A
  a = new B
  a.only_B_stuff # OK since the casted type of a is now B

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

14 years agosyntax: while condition can now cast variable
Jean Privat [Mon, 22 Jun 2009 18:19:12 +0000 (14:19 -0400)]
syntax: while condition can now cast variable

Example:
  var a = foo # foo gives a A
  # Before the while, the base static type of a is set to A
  while a isa B do
    a.some_b_stuff # OK, since a isa B
    a = foo # OK, since 'base' static type of a is A
  end

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

14 years agosyntax: variable assignment can bypass cast
Jean Privat [Mon, 22 Jun 2009 18:07:07 +0000 (14:07 -0400)]
syntax: variable assignment can bypass cast

Bypassing is allowed if it is conform to the 'base' type of the variable.
The 'base' type of the variable is set before while, for and closures.

Bypassing also means that casted type must propagate trough flow control.

Some tests are updated to avoid unexpected cast flow.

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

14 years agosyntax: if_false_variable_ctx
Jean Privat [Mon, 22 Jun 2009 16:07:50 +0000 (12:07 -0400)]
syntax: if_false_variable_ctx

Allow casts to be propagated in 'else' branches

Example:
  if not a isa B then
    a.only_b_can_do # Static error
  else
    a.only_b_can_do # OK since current static type of a is B here
  end

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

14 years agosyntax: add VariableContext::to_s
Jean Privat [Mon, 22 Jun 2009 15:50:55 +0000 (11:50 -0400)]
syntax: add VariableContext::to_s

Used to debug.

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

14 years agosyntax: var assignment can bypass casted type
Jean Privat [Fri, 19 Jun 2009 15:56:45 +0000 (11:56 -0400)]
syntax: var assignment can bypass casted type

If rvalue is conform with casted type then
  variable remains casted
else if rvalue is conform with base type then
  # It is the novelty
  variable is (up)casted to its base type
else error

Example:
  var x: T
  x.u_only_method # error
  assert x isa U
  x.u_only_method # ok
  x = a_t # ok
  x.u_only_method # error

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

14 years agosyntax: do_lvalue_typing do not do the final type check
Jean Privat [Fri, 19 Jun 2009 14:24:00 +0000 (10:24 -0400)]
syntax: do_lvalue_typing do not do the final type check

Clients can now deals with the fact that in
  x += 1
that is equivalent to
  x_new = x_old + 1
the static type of x_old is different from the one accepted by x_new.

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

14 years agosyntax: better internal VariableContex stype handling
Jean Privat [Fri, 19 Jun 2009 14:05:33 +0000 (10:05 -0400)]
syntax: better internal VariableContex stype handling

Remove the sublcass CastVariableContex.
Add the method VariableContext::stype=

Current client does not need to be updated.

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

14 years agosyntax: Move VariableContext and related to a new control_flow.nit
Jean Privat [Fri, 19 Jun 2009 06:03:54 +0000 (02:03 -0400)]
syntax: Move VariableContext and related to a new control_flow.nit

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

14 years agosyntax: merge control_flow.nit in typing.nit
Jean Privat [Fri, 19 Jun 2009 05:58:04 +0000 (01:58 -0400)]
syntax: merge control_flow.nit in typing.nit

VariableContext is used instead of ControlFlowContext.

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

14 years agotests: update base_closure6.nit
Jean Privat [Fri, 19 Jun 2009 05:48:22 +0000 (01:48 -0400)]
tests: update base_closure6.nit

Prevent potential error pollution by using uninitialized variables.

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

14 years agosyntax: variable with () is not a variable
Jean Privat [Fri, 19 Jun 2009 05:32:00 +0000 (01:32 -0400)]
syntax: variable with () is not a variable

So do not try to continue and pretend things.

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

14 years agosyntax: clean class VariableContext
Jean Privat [Fri, 19 Jun 2009 05:29:10 +0000 (01:29 -0400)]
syntax: clean class VariableContext

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

14 years agotests: add base_var_assignment_flow.nit
Jean Privat [Fri, 19 Jun 2009 05:07:17 +0000 (01:07 -0400)]
tests: add base_var_assignment_flow.nit

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

14 years agometamodel: promote _filename to MMModule
Jean Privat [Thu, 18 Jun 2009 21:11:18 +0000 (17:11 -0400)]
metamodel: promote _filename to MMModule

Update inits and MMSrcModule.

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

14 years agosyntax: warning for useless 'isa' and 'as' type checks
Jean Privat [Thu, 18 Jun 2009 20:41:24 +0000 (16:41 -0400)]
syntax: warning for useless 'isa' and 'as' type checks

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

14 years agometamodel: new MMType::is_valid method
Jean Privat [Thu, 18 Jun 2009 20:39:16 +0000 (16:39 -0400)]
metamodel: new MMType::is_valid method

is_valid is used to discriminate fully build MMType from others.
Currently, only MMTypeFormal require it.
Previous behavior of returning null on invalid MMTypeFormal's methods is disabled.

syntax_base.nit is adapted to the new behavior.

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

14 years agosyntax: update PExpr class to use _is_typed and cie.
Jean Privat [Thu, 18 Jun 2009 01:48:50 +0000 (21:48 -0400)]
syntax: update PExpr class to use _is_typed and cie.

PExpr::stype contracts are also enabled.

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

14 years agosyntax: add PExpr:is_typed and PExpr::is_statement
Jean Privat [Wed, 17 Jun 2009 20:38:07 +0000 (16:38 -0400)]
syntax: add PExpr:is_typed and PExpr::is_statement

Contracts are not enforced yet.
Update check_expr to profit from them.

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

14 years agotests: new base_var.nit
Jean Privat [Thu, 18 Jun 2009 01:47:42 +0000 (21:47 -0400)]
tests: new base_var.nit

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

14 years agosyntax: refactor AClosureCallExpr
Jean Privat [Tue, 16 Jun 2009 20:33:54 +0000 (16:33 -0400)]
syntax: refactor AClosureCallExpr

Add a alternative in the grammar to profit from generated walkers.
Makes AClosureCallExpr a subclass of AAbsAbsSendExpr instead of ACallFormExpr.

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

14 years agosyntax: new class AAbsAbsSendExpr
Jean Privat [Tue, 16 Jun 2009 20:32:19 +0000 (16:32 -0400)]
syntax: new class AAbsAbsSendExpr

Like AAbsSendExpr but without property.
AAbsSendExpr is a subclass of AAbsAbsSendExpr.

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

14 years agoparser: inits uses Collection instead of Array
Jean Privat [Tue, 16 Jun 2009 20:24:42 +0000 (16:24 -0400)]
parser: inits uses Collection instead of Array

This helps to generate them manually.

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

14 years agotests: bug to fix base_virtual_type_self.nit
Jean Privat [Mon, 15 Jun 2009 21:08:09 +0000 (17:08 -0400)]
tests: bug to fix base_virtual_type_self.nit

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

14 years agometamodel: MMLocalClass::init takes the MMModule
Jean Privat [Mon, 15 Jun 2009 18:36:23 +0000 (14:36 -0400)]
metamodel: MMLocalClass::init takes the MMModule

Also remove the MMModule::add_local_class method

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

14 years agocompile: clean class PrimitiveInfo
Jean Privat [Sat, 13 Jun 2009 03:42:47 +0000 (23:42 -0400)]
compile: clean class PrimitiveInfo

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

14 years agocompile: clean CompilerVisitor constructor
Jean Privat [Sat, 13 Jun 2009 03:42:15 +0000 (23:42 -0400)]
compile: clean CompilerVisitor constructor

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

14 years agocompile: distinguish compile_expr_call and compile_stmt_call
Jean Privat [Fri, 12 Jun 2009 21:32:56 +0000 (17:32 -0400)]
compile: distinguish compile_expr_call and compile_stmt_call

This helps to clean the mess in compiling_methods.nit.

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

14 years agocompile: new method compile_arguments_in
Jean Privat [Fri, 12 Jun 2009 20:20:08 +0000 (16:20 -0400)]
compile: new method compile_arguments_in

Factorize compilation of arguments.

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

14 years agocompile: compile_stmt is a noop on null PExpr
Jean Privat [Fri, 12 Jun 2009 19:46:51 +0000 (15:46 -0400)]
compile: compile_stmt is a noop on null PExpr

This simplify the code.

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

14 years agosyntax: new method use_if_true_variable_ctx
Jean Privat [Fri, 12 Jun 2009 18:54:57 +0000 (14:54 -0400)]
syntax: new method use_if_true_variable_ctx

This simplify the use of the _if_true_variable_ctx attribute of expressions.

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

14 years agosyntax: Split SubVariableContext and CastVariableContext
Jean Privat [Fri, 12 Jun 2009 18:43:09 +0000 (14:43 -0400)]
syntax: Split SubVariableContext and CastVariableContext

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

14 years agotests: add base_as_cast
Jean Privat [Fri, 12 Jun 2009 14:46:23 +0000 (10:46 -0400)]
tests: add base_as_cast

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

14 years agosyntax: new method check_conform_multiexpr
Jean Privat [Fri, 12 Jun 2009 01:58:40 +0000 (21:58 -0400)]
syntax: new method check_conform_multiexpr

This method is used to check conformance among multiple expressions.
It is used to factorize code between AIfexprExpr, AArrayExpr and process_closure.
Tests are also updated to use the new error messages.

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

14 years agometamodel: PartialOrder::[] fail on wrong key
Jean Privat [Thu, 11 Jun 2009 16:44:17 +0000 (12:44 -0400)]
metamodel: PartialOrder::[] fail on wrong key

Alike stdlib Map::[] method, PartialOrder::[] aborts if key does not exists.

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

14 years agolib: Map:[] aborts if key is not found
Jean Privat [Thu, 11 Jun 2009 19:03:47 +0000 (15:03 -0400)]
lib: Map:[] aborts if key is not found

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

14 years agometamodel: Check global_class existence instead of getting null
Jean Privat [Thu, 11 Jun 2009 19:02:49 +0000 (15:02 -0400)]
metamodel: Check global_class existence instead of getting null

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

14 years agometamodel: MMLocalClass::[] aborts if no global class
Jean Privat [Thu, 11 Jun 2009 18:58:33 +0000 (14:58 -0400)]
metamodel: MMLocalClass::[] aborts if no global class

Previous behavior was to return null.
Adapts existing clients by using the new MMLocalClass::has_global_property.

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

14 years agometamodel: new MMLocalClass::has_global_property
Jean Privat [Thu, 11 Jun 2009 18:54:53 +0000 (14:54 -0400)]
metamodel: new MMLocalClass::has_global_property

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

14 years agometamodel: fast-fail in getters
Jean Privat [Thu, 11 Jun 2009 15:45:43 +0000 (11:45 -0400)]
metamodel: fast-fail in getters

Instead of testing and returning null among getters, just do stuff and
abort if called methods abort.

syntax modules are adapted to use preventive methods (has_*).

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

14 years agolib: remove some explicit Object bounds
Jean Privat [Thu, 11 Jun 2009 15:42:15 +0000 (11:42 -0400)]
lib: remove some explicit Object bounds

The default bound for generic formal parameter is already 'Object'.
And soon the default bound will be 'nullable Object'.

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

14 years agometamodel: fix and comment upcast_for
Jean Privat [Thu, 11 Jun 2009 13:26:26 +0000 (09:26 -0400)]
metamodel: fix and comment upcast_for

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

14 years agorefactor: use Hash::has_key instead of getting null
Jean Privat [Thu, 11 Jun 2009 12:34:42 +0000 (08:34 -0400)]
refactor: use Hash::has_key instead of getting null

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

14 years agocompile: New function is_valid_variable v0.2.1
Jean Privat [Tue, 9 Jun 2009 16:10:47 +0000 (12:10 -0400)]
compile: New function is_valid_variable

Used to improve ensure_var and compile_expr.

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

14 years agocompile: Superstring compilation bug
Jean Privat [Tue, 9 Jun 2009 19:23:17 +0000 (15:23 -0400)]
compile: Superstring compilation bug

Before:
  var a = 5
  var b = "{a}"
  print(a == b) # => true, a was overwrite

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

14 years agocompile: Store cvariable indexes instead of names
Jean Privat [Tue, 9 Jun 2009 15:23:12 +0000 (11:23 -0400)]
compile: Store cvariable indexes instead of names

Variable names (strings) are stored in a 'once' dictionnary to avoid useless duplication.

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

14 years agocompile: ccomments for get_var and ensure_var
Jean Privat [Tue, 9 Jun 2009 14:36:41 +0000 (10:36 -0400)]
compile: ccomments for get_var and ensure_var

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

14 years agocompile: No systematic cvar for compile_constructor_call
Jean Privat [Tue, 9 Jun 2009 19:42:35 +0000 (15:42 -0400)]
compile: No systematic cvar for compile_constructor_call

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

14 years agoSpelling: bloc -> block
Jean Privat [Tue, 9 Jun 2009 19:41:55 +0000 (15:41 -0400)]
Spelling: bloc -> block

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

14 years agosyntax: New escape block management
Jean Privat [Tue, 9 Jun 2009 19:41:30 +0000 (15:41 -0400)]
syntax: New escape block management

New module syntax/escape.nit to handle escape context and structures.
Use it in syntax/typing.nit (thus removing many visitor attributes).
Remove duplicate break and continue errors from syntax/control_flow.nit now in escape.nit.
Remove useless ABlockControler & cie. from syntax/control_flow.nit.

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

14 years agocompile: Simplify closure C structures
Jean Privat [Tue, 9 Jun 2009 19:40:48 +0000 (15:40 -0400)]
compile: Simplify closure C structures

Use a common structure WBT_ and specific function types FWBT_*.

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

14 years agocompile: C comments for each compiled stmt/expr
Jean Privat [Wed, 3 Jun 2009 17:22:24 +0000 (13:22 -0400)]
compile: C comments for each compiled stmt/expr

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

14 years agocompile: Fix inlined return in closure
Jean Privat [Wed, 3 Jun 2009 13:47:35 +0000 (09:47 -0400)]
compile: Fix inlined return in closure

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

14 years agocompile: Fix closure break marker resetting
Jean Privat [Wed, 10 Jun 2009 14:00:28 +0000 (10:00 -0400)]
compile: Fix closure break marker resetting

Set the break marker each time the block is called, not at the top of the function.

Side-effect: this fix also remove a gcc warning.

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

14 years agocompile: Extract closure code from ASendExpr::compile_expr
Jean Privat [Tue, 7 Apr 2009 02:31:35 +0000 (22:31 -0400)]
compile: Extract closure code from ASendExpr::compile_expr

The new function is MMMethod::compile_call_and_closures.

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

14 years agotests: tests.sh returns 1 if some tests fails
Jean Privat [Wed, 10 Jun 2009 13:54:50 +0000 (09:54 -0400)]
tests: tests.sh returns 1 if some tests fails

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

14 years agotests: Add errlist
Jean Privat [Wed, 3 Jun 2009 16:31:50 +0000 (12:31 -0400)]
tests: Add errlist

Failed tests names are stored in a errlist.
The errlist can then be used to feed next tests.

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

14 years agotests: remove broken HTML output
Jean Privat [Wed, 3 Jun 2009 15:32:01 +0000 (11:32 -0400)]
tests: remove broken HTML output

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

14 years agoparser: Do not crash if last_loken is unset
Jean Privat [Wed, 3 Jun 2009 16:37:22 +0000 (12:37 -0400)]
parser: Do not crash if last_loken is unset

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

14 years agoparser: Add 'fun' and 'var'-as-attr keyword
Jean Privat [Wed, 20 May 2009 19:27:52 +0000 (15:27 -0400)]
parser: Add 'fun' and 'var'-as-attr keyword

New keywords are equivalent with the old 'meth' ant 'attr'.
The existing source Nit code is not adapted yet and keeps 'meth' and 'attr'.

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

14 years agoparser: Remove ~nobra on type production
Jean Privat [Wed, 20 May 2009 19:09:33 +0000 (15:09 -0400)]
parser: Remove ~nobra on type production

Why was it here?

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

14 years agoparser: Remove tl_propdef* parser rules
Jean Privat [Wed, 20 May 2009 18:54:39 +0000 (14:54 -0400)]
parser: Remove tl_propdef* parser rules

Instead use parametrized propdef rules with ~toplevel

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

14 years agoast: Merge classes AForExpr and AForVardeclExpr
Jean Privat [Mon, 6 Apr 2009 22:20:59 +0000 (18:20 -0400)]
ast: Merge classes AForExpr and AForVardeclExpr

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

14 years agoparser: Script for extended sablecc3 syntax
Jean Privat [Wed, 3 Jun 2009 16:55:34 +0000 (12:55 -0400)]
parser: Script for extended sablecc3 syntax

Move hacks from the Makefile to a new shell script (prescc.sh).
Propose a cleaner syntax with ~ and ! characters.
See doc in prescc.sh for details.

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

14 years agosyntax: Do not inherit signatures with closures
Jean Privat [Tue, 24 Mar 2009 14:23:04 +0000 (10:23 -0400)]
syntax: Do not inherit signatures with closures

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

14 years agosyntax: Systematic signature conformance checks
Jean Privat [Tue, 24 Mar 2009 14:06:18 +0000 (10:06 -0400)]
syntax: Systematic signature conformance checks

These tests will catch errors that are not yet specifically handeled by working on the syntax tree.

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

14 years agocompile: Implicit 'once' for literal strings
Jean Privat [Thu, 26 Feb 2009 20:54:26 +0000 (15:54 -0500)]
compile: Implicit 'once' for literal strings

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

14 years agolib: Split collections into readable and writable
Jean Privat [Wed, 10 Jun 2009 13:29:20 +0000 (09:29 -0400)]
lib: Split collections into readable and writable

Map ->
  MapRead (r)
  Map (rw)
IndexedCollection ->
  IndexedCollectionRead (r)
  IndexedCollection (rw)
AbstractArray ->
  AbstractArrayRead (r)
  AbstractArray (rw)
String ->
  String (ro)
  Buffer (rw)

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

14 years agonew c_src
Jean Privat [Wed, 10 Jun 2009 13:04:55 +0000 (09:04 -0400)]
new c_src

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