2019-02-05 02:44:07 +02:00
|
|
|
[Inter::Comment::] The Comment Construct.
|
|
|
|
|
2019-07-09 08:45:46 +03:00
|
|
|
Defining the comment construct.
|
2019-02-05 02:44:07 +02:00
|
|
|
|
|
|
|
@
|
|
|
|
|
|
|
|
@e COMMENT_IST
|
|
|
|
|
|
|
|
@d EXTENT_COMMENT_IFR 2
|
|
|
|
|
|
|
|
=
|
|
|
|
void Inter::Comment::define(void) {
|
2022-02-08 01:30:40 +02:00
|
|
|
inter_construct *IC = InterConstruct::create_construct(COMMENT_IST, I"comment");
|
2022-02-09 02:00:30 +02:00
|
|
|
InterConstruct::specify_syntax(IC, I"WHITESPACE");
|
2019-07-09 08:45:46 +03:00
|
|
|
METHOD_ADD(IC, CONSTRUCT_READ_MTID, Inter::Comment::read);
|
2019-09-07 03:28:18 +03:00
|
|
|
METHOD_ADD(IC, CONSTRUCT_TRANSPOSE_MTID, Inter::Comment::transpose);
|
2022-02-08 01:30:40 +02:00
|
|
|
InterConstruct::allow_in_depth_range(IC, 0, INFINITELY_DEEP);
|
|
|
|
InterConstruct::permit(IC, OUTSIDE_OF_PACKAGES_ICUP);
|
|
|
|
InterConstruct::permit(IC, INSIDE_PLAIN_PACKAGE_ICUP);
|
|
|
|
InterConstruct::permit(IC, INSIDE_CODE_PACKAGE_ICUP);
|
2019-02-05 02:44:07 +02:00
|
|
|
}
|
|
|
|
|
2019-07-14 12:44:07 +03:00
|
|
|
void Inter::Comment::read(inter_construct *IC, inter_bookmark *IBM, inter_line_parse *ilp, inter_error_location *eloc, inter_error_message **E) {
|
2022-02-09 12:33:49 +02:00
|
|
|
*E = InterConstruct::check_level_in_package(IBM, COMMENT_IST, ilp->indent_level, eloc);
|
2019-07-09 08:45:46 +03:00
|
|
|
if (*E) return;
|
2022-02-05 14:27:28 +02:00
|
|
|
if (SymbolAnnotation::nonempty(&(ilp->set))) { *E = Inter::Errors::plain(I"__annotations are not allowed", eloc); return; }
|
2020-07-01 02:58:55 +03:00
|
|
|
*E = Inter::Comment::new(IBM, (inter_ti) ilp->indent_level, eloc, ilp->terminal_comment);
|
2019-02-05 02:44:07 +02:00
|
|
|
}
|
|
|
|
|
2020-07-01 02:58:55 +03:00
|
|
|
inter_error_message *Inter::Comment::new(inter_bookmark *IBM, inter_ti level, inter_error_location *eloc, inter_ti comment_ID) {
|
2022-01-28 01:38:14 +02:00
|
|
|
inter_tree_node *P = Inode::new_with_0_data_fields(IBM, COMMENT_IST, eloc, level);
|
2020-05-11 17:21:29 +03:00
|
|
|
Inode::attach_comment(P, comment_ID);
|
2022-02-07 00:33:07 +02:00
|
|
|
inter_error_message *E = InterConstruct::verify_construct(InterBookmark::package(IBM), P); if (E) return E;
|
2022-01-27 01:59:02 +02:00
|
|
|
NodePlacement::move_to_moving_bookmark(P, IBM);
|
2019-02-05 02:44:07 +02:00
|
|
|
return NULL;
|
|
|
|
}
|
2019-09-07 03:28:18 +03:00
|
|
|
|
2020-07-01 02:58:55 +03:00
|
|
|
void Inter::Comment::transpose(inter_construct *IC, inter_tree_node *P, inter_ti *grid, inter_ti grid_extent, inter_error_message **E) {
|
2020-05-11 17:21:29 +03:00
|
|
|
Inode::attach_comment(P, grid[Inode::get_comment(P)]);
|
2019-09-07 03:28:18 +03:00
|
|
|
}
|