Code coverage for lip_slot_code.li
///////////////////////////////////////////////////////////////////////////////
// Lisaac Compiler //
// //
// LSIIT - ULP - CNRS - INRIA - FRANCE //
// //
// This program is free software: you can redistribute it and/or modify //
// it under the terms of the GNU General Public License as published by //
// the Free Software Foundation, either version 3 of the License, or //
// (at your option) any later version. //
// //
// This program is distributed in the hope that it will be useful, //
// but WITHOUT ANY WARRANTY; without even the implied warranty of //
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
// GNU General Public License for more details. //
// //
// You should have received a copy of the GNU General Public License //
// along with this program. If not, see <http://www.gnu.org/licenses/>. //
// //
// http://isaacproject.u-strasbg.fr/ //
///////////////////////////////////////////////////////////////////////////////
Section Header
+ name := LIP_SLOT_CODE;
- copyright := "2003-2008 Sonntag Benoit";
- author := "Sonntag Benoit (sonntag@icps.u-strasbg.fr)";
- comment := "The main prototype";
Section Inherit
- parent_lip_code:Expanded LIP_CODE;
Section Public
+ section:STRING_CONSTANT;
+ name:STRING_CONSTANT;
+ argument:LIP_SLOT_DATA;
+ code:LIP_CODE;
+ comment:STRING_CONSTANT;
// + comment_chapter:STRING_CONSTANT;
- set_comment c:STRING_CONSTANT <-
(
comment := c;
);
/*
- set_comment_chapter cmt:STRING_CONSTANT <-
(
comment_chapter := cmt;
);
*/
//
// Creation.
//
- create p:POSITION section sec:STRING_CONSTANT
name n:STRING_CONSTANT
argument arg:LIP_SLOT_DATA
code c:LIP_CODE :LIP_SLOT_CODE <-
( + result:LIP_SLOT_CODE;
result := get_method n;
(result != NULL).if {
((arg = NULL) ^ (result.argument = NULL)).if {
semantic_error (result.position,"Incorrect redefinition.");
};
} else {
result := clone;
result.make p section sec name n argument arg code c;
};
result
);
- make p:POSITION section sec:STRING_CONSTANT
name n:STRING_CONSTANT
argument arg:LIP_SLOT_DATA
code c:LIP_CODE <-
(
position := p;
section := sec;
name := n;
argument := arg;
code := c;
list_method.add_last Self;
);
//
// Operation.
//
- run_with val:LIP_CONSTANT :BOOLEAN <-
( + result:BOOLEAN;
result := ! ((val = NULL) ^ (argument = NULL));
(result).if {
(argument != NULL).if {
? { val != NULL };
result := argument.set_value val;
stack.add_last argument;
} else {
stack.add_last NULL;
};
(result).if {
code.run;
};
stack.remove_last;
};
result
);
//
// Print.
//
- print <-
(
" -".print;
name.print;
(argument != NULL).if {
" <".print;
argument.print;
">".print;
};
":\n".print;
(comment != NULL).if {
'\t'.print;
(comment.lower).to (comment.upper) do { i:INTEGER;
comment.item i.print;
((comment.item i = '\n') {i < comment.upper}).if {
'\t'.print;
};
};
} else {
"\t Sorry, no comment (see `make.lip').\n".print;
};
);