[SCM] Lisaac compiler branch, stable, updated. lisaac-0.12-546-g2442565
Mildred Ki'Lya
silkensedai at online.fr
Fri Oct 9 23:17:41 UTC 2009
The following commit has been merged in the stable branch:
commit d62497dcad771a04b893a3fea4222a26123eb981
Author: Mildred Ki'Lya <silkensedai at online.fr>
Date: Sat Oct 10 00:59:33 2009 +0200
LIP: allow redefinition of data slots
diff --git a/src/lip/lip_slot_data.li b/src/lip/lip_slot_data.li
index d52391b..0cb958e 100644
--- a/src/lip/lip_slot_data.li
+++ b/src/lip/lip_slot_data.li
@@ -47,19 +47,27 @@ Section Public
-? {v != NULL};
]
( + result:SELF;
- result := clone;
- result.make p name n value v argument is_arg;
+ + s:LIP_SLOT_DATA;
+ ((!is_arg) && {s := get_data n; s != NULL}).if {
+ result ?= s;
+ ? {result != NULL};
+ (s.value.name !== v.name).if {
+ POSITION.put_error semantic text "Redefinition with incorrect type.";
+ s.position.put_position;
+ p.put_position;
+ POSITION.send_error;
+ };
+ } else {
+ result := clone;
+ result.make p name n value v argument is_arg;
+ };
result
);
- make p:POSITION name n:STRING_CONSTANT value v:LIP_CONSTANT
argument is_arg:BOOLEAN <-
- ( + s:LIP_SLOT_DATA;
+ (
position := p;
- s := get_data n;
- (s != NULL).if {
- semantic_error (s.position,"Double declaration.");
- };
name := n;
value := v;
(is_arg).if_false {
@@ -75,7 +83,7 @@ Section Public
( + new_val:LIP_CONSTANT;
new_val := value.copy_of v;
- (new_val != NULL).if {
+ (new_val != NULL).if {
value := new_val;
}
);
diff --git a/src/parser.li b/src/parser.li
index 32d7f78..3578ad4 100644
--- a/src/parser.li
+++ b/src/parser.li
@@ -2742,14 +2742,19 @@ Section Private
(t = NULL).if {
syntax_error (current_position,"type is incorrect.");
};
- data := LIP_SLOT_DATA.create current_position name n value t argument FALSE;
- (read_symbol (ALIAS_STR.symbol_affect_immediate)).if {
+ (! read_symbol (ALIAS_STR.symbol_affect_immediate)).if {
+ data := LIP_SLOT_DATA.create current_position name n value t argument FALSE;
+ } else {
cst := readlip_expr_constant;
(cst = NULL).if {
syntax_error (current_position,"Incorrect expression.");
};
- data.set_value cst;
- cst.free;
+ (cst.name !== t.name).if {
+ syntax_error (current_position,"Incorrect expression type.");
+ };
+ data := LIP_SLOT_DATA.create current_position name n value cst argument FALSE;
+ //data.set_value cst;
+ //cst.free;
};
}.elseif {read_character '-'} then {
// Function.
--
Lisaac compiler
More information about the Lisaac-commits
mailing list