[SCM] Lisaac compiler branch, mildred-projects, updated. lisaac-0.12-503-g64b7bec
Mildred Ki'Lya
silkensedai at online.fr
Mon Aug 24 20:14:15 UTC 2009
The following commit has been merged in the mildred-projects branch:
commit 64b7becd691566e501e8772a0075b68faae40f6c
Author: Mildred Ki'Lya <silkensedai at online.fr>
Date: Mon Aug 24 22:12:42 2009 +0200
Fix bug that prevented bootstrap. constant string length was not computed as it should have been. The reason is that the mildred-project branch added escape sequence parsing in PARSER (before, the escape sequences were written without processing in the resulting source file). The code that computed the length of a string (removing extra characters used for escape sequences) had to be removed.
diff --git a/editor/kate/lisaac_v2.xml b/editor/kate/lisaac_v2.xml
index 55335e4..8fc960a 100644
--- a/editor/kate/lisaac_v2.xml
+++ b/editor/kate/lisaac_v2.xml
@@ -1238,8 +1238,8 @@
</highlighting>
<general>
<comments>
- <!--<comment name="singleLine" start="//" />
- <comment name="multiLine" start="/*" end="*/" />-->
+ <comment name="singleLine" start="//" />
+ <!--<comment name="multiLine" start="/*" end="*/" />-->
</comments>
<keywords casesensitive="1" additionalDeliminator="`"/>
</general>
diff --git a/make.lip b/make.lip
index bb32b29..853d8d8 100644
--- a/make.lip
+++ b/make.lip
@@ -57,14 +57,51 @@ Section Private
+ target:STRING := "unix";
+ + lib_std :PROJECT;
+ + parent_project :PROJECT;
+
+ //
+ // Code
+ //
+
+ - default_init prj:PROJECT <-
+ // Initialize the library
+ (
+ "Initialize project ".print; Self.print;
+ prj.if { " from ".print; prj.print; };
+ "\n".print;
+
+ parent_project := prj;
+ parent_project.if {
+ lisaac := parent_project.lisaac;
+ target := parent_project.target;
+ debug_level := parent_project.debug_level;
+ debug_with_code := parent_project.debug_with_code;
+ is_all_warning := parent_project.is_all_warning;
+ is_optimization := parent_project.is_optimization;
+ inline_level := parent_project.inline_level;
+ is_java := parent_project.is_java;
+ is_cop := parent_project.is_cop;
+ is_statistic := parent_project.is_statistic;
+ is_quiet := parent_project.is_quiet;
+ };
+ );
+
+ - init prj:PROJECT <-
+ // Initialize the library
+ (
+ default_init prj;
+ );
+
//
// Directory.
//
- standard_path <-
// Standard library.
- (
- path (lisaac + "lib/*");
+ (
+ lib_std := lib_std.create("STD");
+ lib_std := lib_std.load("lib.lip");
);
//
@@ -73,31 +110,18 @@ Section Private
- unix_target <-
(
- path (lisaac + "lib_os/unix/system/");
- path (lisaac + "lib_os/unix/file_system/");
- path (lisaac + "lib_os/unix/video/");
);
- windows_target <-
(
- path (lisaac + "lib_os/unix/system/");
- path (lisaac + "lib_os/windows/file_system/");
- path (lisaac + "lib_os/unix/file_system/"); // BSBS: ??
- path (lisaac + "lib_os/windows/video/");
);
- dos_target <-
(
- path (lisaac + "lib_os/unix/system/");
- path (lisaac + "lib_os/unix/file_system/"); // BSBS: ??
- path (lisaac + "lib_os/dos/file_system/");
- path (lisaac + "lib_os/dos/video/");
);
- java_target <-
(
- path (lisaac + "lib_os/java/system/");
- path (lisaac + "lib_os/java/file_system/");
);
- get_target <-
@@ -116,7 +140,7 @@ Section Private
};
(target = "").if {
"Target code needed.\n".print;
- exit;
+ exit 1;
};
);
@@ -194,6 +218,12 @@ Section Private
(
general_back_end;
);
+
+ - print_info <-
+ // Print information about the project
+ (
+ info_project.print;
+ );
Section Public
@@ -279,7 +309,15 @@ Section Public
//
// Other.
//
-
+
+ - info <-
+ // Information about the project
+ (
+ front_end;
+ print_info;
+ exit;
+ );
+
- q <-
// Quiet operation.
(
diff --git a/src/item/itm_string.li b/src/item/itm_string.li
index 109cc2b..419198e 100644
--- a/src/item/itm_string.li
+++ b/src/item/itm_string.li
@@ -91,7 +91,8 @@ Section Public
Section Private
- - length:INTEGER <-
+ - length:INTEGER <- string.count;
+ /*
( + i,result:INTEGER;
i := string.lower;
{i <= string.upper}.while_do {
@@ -109,6 +110,7 @@ Section Private
};
result
);
+ */
diff --git a/src/parser.li b/src/parser.li
index 4c66a50..f79bcf4 100644
--- a/src/parser.li
+++ b/src/parser.li
@@ -286,7 +286,7 @@ Section Private
(is_shorter2).if {
(stat)
.when 0 or 1 then { string_tmp3.add_last '\n'; }
- .when 2 then { string_tmp4.add_last '\n'; };
+ .when 2 then { string_tmp4.add_last '\n'; };
};
(is_shorter).if {
// BSBS: A revoir ...
@@ -353,7 +353,7 @@ Section Private
last_comment_slot := NULL;
} else {
put_new_line_comment string_tmp3 with (ALIAS_STR.short_comment_new_line_slot);
- last_comment_slot := ALIAS_STR.get string_tmp3;
+ last_comment_slot := ALIAS_STR.get string_tmp3;
};
(string_tmp4.is_empty).if_false {
put_new_line_comment string_tmp4 with (ALIAS_STR.short_comment_new_line_extern);
@@ -716,73 +716,60 @@ Section Private
string_tmp.remove_last 1;
position := position+1;
}.elseif {last_character != 0.to_character} then {
- syntax_error (current_position,"Unknown escape sequence.");
- };
- }.elseif {last_character != 0.to_character} then {
- ( (last_character = 'a') ||
- {last_character = 'b'} ||
- {last_character = 'f'} ||
- {last_character = 'n'} ||
- {last_character = 'r'} ||
- {last_character = 't'} ||
- {last_character = 'v'} ||
- {last_character = '\\'} ||
- {last_character = '?'} ||
- {last_character = '\''} ||
- {last_character = '\"'}
+ syntax_error (current_position,"Malformed spacing escape sequence.");
+ };
+ }.elseif { "abfnrtv?\\\'\"".has last_character } then {
+ // Read named escape sequence
+ string_tmp.remove_last 1; // remove '\\'
+ last_character
+ .when 'a' then { string_tmp.add_last '\a'; }
+ .when 'b' then { string_tmp.add_last '\b'; }
+ .when 'f' then { string_tmp.add_last '\f'; }
+ .when 'n' then { string_tmp.add_last '\n'; }
+ .when 'r' then { string_tmp.add_last '\r'; }
+ .when 't' then { string_tmp.add_last '\t'; }
+ .when 'v' then { string_tmp.add_last '\v'; }
+ .when '?' then { string_tmp.add_last '\?'; }
+ .when '\\' then { string_tmp.add_last '\\'; }
+ .when '\'' then { string_tmp.add_last '\''; }
+ .when '\"' then { string_tmp.add_last '\"'; };
+ //string_tmp.add_last last_character;
+ position := position+1;
+ }.elseif {last_character.in_range '0' to '9'} then {
+ (
+ (last_character='0') &&
+ {position<source.upper} &&
+ {! source.item(position+1).is_hexadecimal_digit}
).if {
- // Read named escape sequence
- string_tmp.remove_last 1; // remove '\\'
- last_character
- .when 'a' then { string_tmp.add_last '\a'; }
- .when 'b' then { string_tmp.add_last '\b'; }
- .when 'f' then { string_tmp.add_last '\f'; }
- .when 'n' then { string_tmp.add_last '\n'; }
- .when 'r' then { string_tmp.add_last '\r'; }
- .when 't' then { string_tmp.add_last '\t'; }
- .when 'v' then { string_tmp.add_last '\v'; }
- .when '\\' then { string_tmp.add_last '\\'; }
- .when '?' then { string_tmp.add_last '\?'; }
- .when '\'' then { string_tmp.add_last '\''; }
- .when '\"' then { string_tmp.add_last '\"'; };
- //string_tmp.add_last last_character;
+ // Read \0
+ string_tmp.remove_last 1; // remove '\\'
+ string_tmp.add_last '\0';
+ //string_tmp.add_last last_character;
position := position+1;
- }.elseif {last_character.in_range '0' to '9'} then {
- (
- (last_character='0') &&
- {position<source.upper} &&
- {! source.item(position+1).is_hexadecimal_digit}
- ).if {
- // Read \0
- string_tmp.remove_last 1; // remove '\\'
- string_tmp.add_last '\0';
- //string_tmp.add_last last_character;
- position := position+1;
+ } else {
+ // Read '\' integer '\'
+ string_tmp2.copy string_tmp;
+ nothing := read_integer; // result is Always TRUE.
+ string_tmp.copy string_tmp2;
+ ((last_integer > 255) || {last_integer < 0}).if {
+ syntax_error (current_position,
+ "Invalid range character number [0,255].");
+ };
+ string_tmp.remove_last 1; // remove '\\'
+ string_tmp.add_last (last_integer.to_character);
+ //string_tmp.println; last_integer.to_character.code.print; " ".print; last_integer.print; "\n".print;
+ // Save 3 octal digits
+ //string_tmp.add_last ((val / 64).decimal_digit);
+ //string_tmp.add_last (((val % 64) / 8).decimal_digit);
+ //string_tmp.add_last ((val % 8).decimal_digit);
+ (last_character='\\').if {
+ position := position + 1;
} else {
- // Read '\' integer '\'
- string_tmp2.copy string_tmp;
- nothing := read_integer; // result is Always TRUE.
- string_tmp.copy string_tmp2;
- ((last_integer > 255) || {last_integer < 0}).if {
- syntax_error (current_position,
- "Invalid range character number [0,255].");
- };
- string_tmp.remove_last 1; // remove '\\'
- string_tmp.add_last (last_integer.to_character);
- //string_tmp.println; last_integer.to_character.code.print; " ".print; last_integer.print; "\n".print;
- // Save 3 octal digits
- //string_tmp.add_last ((val / 64).decimal_digit);
- //string_tmp.add_last (((val % 64) / 8).decimal_digit);
- //string_tmp.add_last ((val % 8).decimal_digit);
- (last_character='\\').if {
- position := position + 1;
- } else {
- syntax_error (current_position,"Character '\' is needed.");
- };
+ syntax_error (current_position,"Character '\' is needed.");
};
- } else {
- syntax_error (current_position,"Unknown escape sequence.");
- };
+ };
+ } else {
+ syntax_error (current_position,"Unknown escape sequence.");
};
);
@@ -907,9 +894,27 @@ Section Private
+ old_pos:INTEGER;
// On passe les espaces :
(read_space).if {
- };
+ };
+
old_pos:=position;
string_tmp.clear;
+ /*is_all_warning.if {
+ "123".print;
+ last_character.print;
+ "456".print;
+ " ('\\".print;
+ last_character.code.print;
+ "' == (0.to_character || ! \"!@#$%^&<|*-+=~/?\\>\".has '".print;
+ last_character.to_string.print;
+ "') == (".print;
+ (last_character = 0.to_character).if { "TRUE".print; } else { "FALSE".print; };
+ " || ! ".print;
+ "!@#$%^&<|*-+=~/?\\>".has last_character.if { "TRUE".print; } else { "FALSE".print; };
+ " ) = ".print;
+ ((last_character = 0.to_character) ||
+ {! "!@#$%^&<|*-+=~/?\\>".has last_character}).if { "TRUE".print; } else { "FALSE".print; };
+ "\n".print;
+ };*/
{(last_character = 0.to_character) ||
{! "!@#$%^&<|*-+=~/?\\>".has last_character}}.until_do {
string_tmp.add_last last_character;
@@ -924,7 +929,7 @@ Section Private
).if {
syntax_error (current_position,"Incorrect operator.");
};
- short (ALIAS_STR.short_operator) token old_pos to position;
+ short (ALIAS_STR.short_operator) token old_pos to position;
result := TRUE;
};
result
@@ -1482,7 +1487,7 @@ Section Private
}
}
).if {
- syntax_error (current_position,"Type `SELF' is needed. (local_arg)");
+ syntax_error (current_position,"Type `SELF' is needed.");
};
(name.count = 1).if {
// Single Argument.
@@ -1600,7 +1605,7 @@ Section Private
};
};
(! read_character '}').if {
- warning_error (current_position,"Added '}' to close block type definition.");
+ warning_error (current_position,"Added '}'.");
}; // if
result := ITM_TYPE_BLOCK.get typ_arg and typ_res;
} else {
@@ -1692,7 +1697,7 @@ Section Private
(styl != NULL).if {
string_tmp.copy "Style `";
string_tmp.append styl;
- string_tmp.append "' ignored.";
+ string_tmp.append "' ignored for SELF.";
warning_error (current_position,string_tmp);
};
result := ITM_TYPE_SIMPLE.type_self;
@@ -1700,7 +1705,7 @@ Section Private
(styl != NULL).if {
string_tmp.copy "Style `";
string_tmp.append styl;
- string_tmp.append "' ignored.";
+ string_tmp.append "' ignored for NULL.";
warning_error (current_position,string_tmp);
};
result := ITM_TYPE_SIMPLE.type_null;
@@ -1795,8 +1800,8 @@ Section Private
((! l_assignment.is_empty) && {read_character ')'} && {read_affect}).if {
l_assignment := ALIAS_ARRAY(STRING_CONSTANT).copy l_assignment;
result := ITM_LIST_IDF.create current_position with l_assignment;
- affect := last_string.first;
- old_pos:= current_position;
+ affect := last_string.first;
+ old_pos:= current_position;
value := read_expr;
(value = NULL).if {
//syntax_error (current_position,"Incorrect expression.");
@@ -1837,7 +1842,7 @@ Section Private
(read_affect).if {
result := ITM_READ.create current_position name name;
affect := last_string.first;
- old_pos:= current_position;
+ old_pos:= current_position;
value := read_expr;
(value = NULL).if {
//syntax_error (current_position,"Incorrect expression.");
@@ -1877,12 +1882,16 @@ Section Private
+ l_expr:FAST_ARRAY(ITM_CODE);
+ itm_op:ITM_OPERATOR;
+ last_msg,first_msg:INTEGER;
-
+
+// is_all_warning.if { warning_error (current_position, "-> Begin read EXPR_OPERATOR"); };
+
l_expr := ALIAS_ARRAY(ITM_CODE).new;
{read_operator}.while_do {
+// is_all_warning.if { warning_error (current_position, " EXPR_OPERATOR: Read operator"); };
expr := ITM_OPERATOR.create current_position name last_string;
l_expr.add_last expr;
};
+// is_all_warning.if { warning_error (current_position, " EXPR_OPERATOR: Read EXPR_MESSAGE"); };
expr := read_expr_message;
(expr = NULL).if {
// Error.
@@ -1895,18 +1904,29 @@ Section Private
first_msg := l_expr.count;
{
last_msg := l_expr.count;
- l_expr.add_last expr;
+ l_expr.add_last expr;
+// read_space;
+// string_tmp4.copy " EXPR_OPERATOR: Prepare to read an operator ";
+// string_tmp4.add_last last_character;
+// string_tmp4.add_last ' ';
+// string_tmp4.append (last_character.code.to_string);
+ is_all_warning.if { warning_error (current_position, string_tmp4); };
(read_operator).if {
{
+// is_all_warning.if { warning_error (current_position, " EXPR_OPERATOR: Read operator"); };
expr := ITM_OPERATOR.create current_position name last_string;
l_expr.add_last expr;
- }.do_while {read_operator};
+ }.do_while {read_operator};
+// is_all_warning.if { warning_error (current_position, " EXPR_OPERATOR: Read EXPR_MESSAGE"); };
expr := read_expr_message;
- } else {
+ } else {
+// is_all_warning.if { warning_error (current_position, " EXPR_OPERATOR: Fail to read an operator"); };
expr := NULL;
};
}.do_while {expr != NULL};
-
+
+// is_all_warning.if { warning_error (current_position, "-> End read EXPR_OPERATOR"); };
+
// Last Post-fix operator.
{last_msg < l_expr.upper}.while_do {
itm_op ?= l_expr.item (last_msg + 1);
@@ -1945,6 +1965,7 @@ Section Private
result := ITM_EXPRESSION.create l_expr;
};
};
+
result
); // read_expr_operator
@@ -2058,7 +2079,7 @@ Section Private
last_group.set_code read_group;
(! read_character '}').if {
- warning_error (current_position,"Added '}' to close a block.");
+ warning_error (current_position,"Added '}'.");
}; // if
short (ALIAS_STR.short_block) token (position-1) to position;
last_group := group_sav;
@@ -2079,7 +2100,7 @@ Section Private
syntax_error (current_position,"Incorrect live type list.");
};
(! read_character '}').if {
- warning_error (current_position,"Added '}' to close live type list after an external.");
+ warning_error (current_position,"Added '}'.");
};
ext.set_type_list ltype;
};
@@ -2841,7 +2862,7 @@ Section Private
(cst = NULL).if {
syntax_error (current_position,"Incorrect expression.");
};
- data.set_value cst;
+ data.set_value cst;
cst.free;
};
}.elseif {read_character '-'} then {
@@ -2900,18 +2921,18 @@ Section Private
//// TYPE -> 'BOOLEAN' | 'STRING' | 'INTEGER'
( + result:LIP_CONSTANT;
- (read_cap_identifier).if {
+ (read_cap_identifier).if {
(last_string = ALIAS_STR.prototype_integer).if {
result := LIP_INTEGER.get 0;
- }.elseif {last_string = ALIAS_STR.prototype_string} then {
- result := LIP_STRING.get (ALIAS_STR.get "");
- }.elseif {last_string = ALIAS_STR.prototype_boolean} then {
+ }.elseif {last_string = ALIAS_STR.prototype_string} then {
+ result := LIP_STRING.get (ALIAS_STR.get "");
+ }.elseif {last_string = ALIAS_STR.prototype_boolean} then {
result := LIP_BOOLEAN.get FALSE;
}.elseif {last_string = ALIAS_STR.prototype_project} then {
result := LIP_VALUEPROJECT.get NULL;
} else {
syntax_error (current_position,"Incorrect type.");
- };
+ };
};
result
);
diff --git a/src/tools/backend.li b/src/tools/backend.li
index ac0fa59..de03dba 100644
--- a/src/tools/backend.li
+++ b/src/tools/backend.li
@@ -62,7 +62,7 @@ Section Public
}.elseif {c = '\t'} then { buf.add_last '\\'; buf.add_last 't';
}.elseif {c = '\v'} then { buf.add_last '\\'; buf.add_last 'v';
}.elseif {c = '\\'} then { buf.add_last '\\'; buf.add_last '\\';
- }.elseif {c = '\?'} then { buf.add_last '\\'; buf.add_last '?';
+ //}.elseif {c = '\?'} then { buf.add_last '\\'; buf.add_last '?';
}.elseif {c = '\v'} then { buf.add_last '\\'; buf.add_last 'v';
}.elseif {c = '\''} then { buf.add_last '\\'; buf.add_last '\'';
}.elseif {c = '\"'} then { buf.add_last '\\'; buf.add_last '\"';
--
Lisaac compiler
More information about the Lisaac-commits
mailing list