mirror of
https://github.com/ganelson/inform.git
synced 2024-07-08 01:54:21 +03:00
66 lines
2.5 KiB
OpenEdge ABL
66 lines
2.5 KiB
OpenEdge ABL
[Inter::Evaluation::] The Evaluation Construct.
|
|
|
|
Defining the Evaluation construct.
|
|
|
|
@
|
|
|
|
@e EVALUATION_IST
|
|
|
|
=
|
|
void Inter::Evaluation::define(void) {
|
|
inter_construct *IC = Inter::Defn::create_construct(
|
|
EVALUATION_IST,
|
|
L"evaluation",
|
|
I"evaluation", I"evaluations");
|
|
IC->min_level = 1;
|
|
IC->max_level = 100000000;
|
|
IC->usage_permissions = INSIDE_CODE_PACKAGE + CAN_HAVE_CHILDREN;
|
|
METHOD_ADD(IC, CONSTRUCT_READ_MTID, Inter::Evaluation::read);
|
|
METHOD_ADD(IC, CONSTRUCT_VERIFY_MTID, Inter::Evaluation::verify);
|
|
METHOD_ADD(IC, CONSTRUCT_WRITE_MTID, Inter::Evaluation::write);
|
|
METHOD_ADD(IC, VERIFY_INTER_CHILDREN_MTID, Inter::Evaluation::verify_children);
|
|
}
|
|
|
|
@
|
|
|
|
@d BLOCK_EVAL_IFLD 2
|
|
|
|
@d EXTENT_EVAL_IFR 3
|
|
|
|
=
|
|
void Inter::Evaluation::read(inter_construct *IC, inter_bookmark *IBM, inter_line_parse *ilp, inter_error_location *eloc, inter_error_message **E) {
|
|
if (Inter::Annotations::exist(&(ilp->set))) { *E = Inter::Errors::plain(I"__annotations are not allowed", eloc); return; }
|
|
|
|
*E = Inter::Defn::vet_level(IBM, EVALUATION_IST, ilp->indent_level, eloc);
|
|
if (*E) return;
|
|
|
|
inter_package *routine = Inter::Defn::get_latest_block_package();
|
|
if (routine == NULL) { *E = Inter::Errors::plain(I"'evaluation' used outside function", eloc); return; }
|
|
|
|
*E = Inter::Evaluation::new(IBM, ilp->indent_level, eloc);
|
|
}
|
|
|
|
inter_error_message *Inter::Evaluation::new(inter_bookmark *IBM, int level, inter_error_location *eloc) {
|
|
inter_tree_node *P = Inode::new_with_1_data_field(IBM, EVALUATION_IST, 0, eloc, (inter_ti) level);
|
|
inter_error_message *E = Inter::Defn::verify_construct(InterBookmark::package(IBM), P); if (E) return E;
|
|
NodePlacement::move_to_moving_bookmark(P, IBM);
|
|
return NULL;
|
|
}
|
|
|
|
void Inter::Evaluation::verify(inter_construct *IC, inter_tree_node *P, inter_package *owner, inter_error_message **E) {
|
|
if (P->W.extent != EXTENT_EVAL_IFR) { *E = Inode::error(P, I"extent wrong", NULL); return; }
|
|
}
|
|
|
|
void Inter::Evaluation::write(inter_construct *IC, OUTPUT_STREAM, inter_tree_node *P, inter_error_message **E) {
|
|
WRITE("evaluation");
|
|
}
|
|
|
|
void Inter::Evaluation::verify_children(inter_construct *IC, inter_tree_node *P, inter_error_message **E) {
|
|
LOOP_THROUGH_INTER_CHILDREN(C, P) {
|
|
if ((C->W.instruction[0] != INV_IST) && (C->W.instruction[0] != SPLAT_IST) && (C->W.instruction[0] != VAL_IST) && (C->W.instruction[0] != LABEL_IST) && (C->W.instruction[0] != EVALUATION_IST)) {
|
|
*E = Inode::error(C, I"only an inv, a splat, a val, or a label can be below an evaluation", NULL);
|
|
return;
|
|
}
|
|
}
|
|
}
|