mirror of
https://github.com/ganelson/inform.git
synced 2024-06-26 04:00:43 +03:00
Moved heading dependencies into inbuild
This commit is contained in:
parent
4c1757a7ed
commit
cda6af2f05
|
@ -118,3 +118,11 @@ void InbuildModule::start(void) {
|
|||
=
|
||||
void InbuildModule::end(void) {
|
||||
}
|
||||
|
||||
@ =
|
||||
DECLARE_ANNOTATION_FUNCTIONS(embodying_heading, heading)
|
||||
MAKE_ANNOTATION_FUNCTIONS(embodying_heading, heading)
|
||||
|
||||
heading *InbuildModule::heading(parse_node *PN) {
|
||||
return ParseTree::get_embodying_heading(PN);
|
||||
}
|
||||
|
|
|
@ -158,6 +158,9 @@ typedef struct copy_error {
|
|||
int details_N;
|
||||
struct wording details_W;
|
||||
struct parse_node *details_node;
|
||||
struct parse_node *details_node2;
|
||||
struct inbuild_work *details_work;
|
||||
struct inbuild_work *details_work2;
|
||||
wchar_t *word;
|
||||
MEMORY_MANAGEMENT
|
||||
} copy_error;
|
||||
|
@ -172,6 +175,9 @@ copy_error *Copies::new_error(int cat, text_stream *NB) {
|
|||
CE->details_N = -1;
|
||||
CE->details_W = EMPTY_WORDING;
|
||||
CE->details_node = NULL;
|
||||
CE->details_node2 = NULL;
|
||||
CE->details_work = NULL;
|
||||
CE->details_work2 = NULL;
|
||||
CE->pos = TextFiles::nowhere();
|
||||
CE->copy = NULL;
|
||||
CE->word = NULL;
|
||||
|
@ -267,6 +273,14 @@ void Copies::write_problem(OUTPUT_STREAM, copy_error *CE) {
|
|||
WRITE("extension is not compatible with the target virtual machine"); break;
|
||||
case ExtMisidentifiedEnds_SYNERROR:
|
||||
WRITE("extension has an 'ends here' but it does not match the 'begins here'"); break;
|
||||
case HeadingInPlaceOfUnincluded_SYNERROR:
|
||||
WRITE("heading is in place of an extension not included"); break;
|
||||
case UnequalHeadingInPlaceOf_SYNERROR:
|
||||
WRITE("heading is in place of another heading but of a diffeent level"); break;
|
||||
case HeadingInPlaceOfSubordinate_SYNERROR:
|
||||
WRITE("heading is in place of another heading subordinate to itself"); break;
|
||||
case HeadingInPlaceOfUnknown_SYNERROR:
|
||||
WRITE("heading is in place of another heading which doesn't seem to exist'"); break;
|
||||
default:
|
||||
WRITE("syntax error"); break;
|
||||
}
|
||||
|
|
|
@ -390,7 +390,11 @@ LOG("Running rstf\n");
|
|||
|
||||
ParseTree::push_attachment_point(project->syntax_tree, implicit_heading);
|
||||
|
||||
// Inclusions::traverse(project->syntax_tree);
|
||||
#ifdef CORE_MODULE
|
||||
Projects::activate_plugins(project);
|
||||
#endif
|
||||
Inclusions::traverse(project->as_copy, project->syntax_tree);
|
||||
Headings::satisfy_dependencies(project->syntax_tree, project->as_copy);
|
||||
}
|
||||
|
||||
@ It might seem sensible to parse the opening sentence of the source text,
|
||||
|
|
|
@ -563,3 +563,154 @@ heading *Headings::heading_of(source_location sl) {
|
|||
heading *Headings::of_wording(wording W) {
|
||||
return Headings::heading_of(Wordings::location(W));
|
||||
}
|
||||
|
||||
@h Headings with extension dependencies.
|
||||
If the content under a heading depended on the VM not in use, or was marked
|
||||
not for release in a release run, we were able to exclude it just by
|
||||
skipping. The same cannot be done when a heading says that it should be
|
||||
used only if a given extension is, or is not, being used, because when
|
||||
the heading is created we don't yet know which extensions are included.
|
||||
But when the following is called, we do know that.
|
||||
|
||||
@e HeadingInPlaceOfUnincluded_SYNERROR
|
||||
@e UnequalHeadingInPlaceOf_SYNERROR
|
||||
@e HeadingInPlaceOfSubordinate_SYNERROR
|
||||
@e HeadingInPlaceOfUnknown_SYNERROR
|
||||
|
||||
=
|
||||
void Headings::satisfy_dependencies(parse_node_tree *T, inbuild_copy *C) {
|
||||
heading *h;
|
||||
LOOP_OVER(h, heading)
|
||||
if (h->use_with_or_without != NOT_APPLICABLE)
|
||||
Headings::satisfy_individual_heading_dependency(T, C, h);
|
||||
}
|
||||
|
||||
@ And now the code to check an individual heading's usage. This whole
|
||||
thing is carefully timed so that we can still afford to cut up and rearrange
|
||||
the parse tree on quite a large scale, and that's just what we do.
|
||||
|
||||
=
|
||||
void Headings::satisfy_individual_heading_dependency(parse_node_tree *T, inbuild_copy *C, heading *h) {
|
||||
if (h->level < 1) return;
|
||||
inbuild_work *work = h->for_use_with;
|
||||
int loaded = FALSE;
|
||||
if (Works::no_times_used_in_context(work, LOADED_WDBC) != 0) loaded = TRUE;
|
||||
LOGIF(HEADINGS, "SIHD on $H: loaded %d: annotation %d: %W: %d\n", h, loaded,
|
||||
ParseTree::int_annotation(h->sentence_declaring,
|
||||
suppress_heading_dependencies_ANNOT),
|
||||
h->in_place_of_text, h->use_with_or_without);
|
||||
if (Wordings::nonempty(h->in_place_of_text)) {
|
||||
wording S = h->in_place_of_text;
|
||||
if (ParseTree::int_annotation(h->sentence_declaring,
|
||||
suppress_heading_dependencies_ANNOT) == FALSE) {
|
||||
if (<quoted-text>(h->in_place_of_text)) {
|
||||
Word::dequote(Wordings::first_wn(S));
|
||||
wchar_t *text = Lexer::word_text(Wordings::first_wn(S));
|
||||
S = Feeds::feed_text(text);
|
||||
}
|
||||
heading *h2; int found = FALSE;
|
||||
if (loaded == FALSE) @<Can't replace heading in an unincluded extension@>
|
||||
else {
|
||||
LOOP_OVER(h2, heading)
|
||||
if ((Wordings::nonempty(h2->heading_text)) &&
|
||||
(Wordings::match_perhaps_quoted(S, h2->heading_text)) &&
|
||||
(Works::match(
|
||||
Headings::get_extension_containing(h2)->as_copy->edition->work, work))) {
|
||||
found = TRUE;
|
||||
if (h->level != h2->level)
|
||||
@<Can't replace heading unless level matches@>;
|
||||
Headings::excise_material_under(T, C, h2, NULL);
|
||||
Headings::excise_material_under(T, C, h, h2->sentence_declaring);
|
||||
break;
|
||||
}
|
||||
if (found == FALSE) @<Can't find heading in the given extension@>;
|
||||
}
|
||||
}
|
||||
} else
|
||||
if (h->use_with_or_without != loaded) Headings::excise_material_under(T, C, h, NULL);
|
||||
}
|
||||
|
||||
@<Can't replace heading in an unincluded extension@> =
|
||||
copy_error *CE = Copies::new_error(SYNTAX_CE, NULL);
|
||||
CE->error_subcategory = HeadingInPlaceOfUnincluded_SYNERROR;
|
||||
CE->details_node = h->sentence_declaring;
|
||||
CE->details_work = h->for_use_with;
|
||||
Copies::attach(C, CE);
|
||||
|
||||
@ To excise, we simply prune the heading's contents from the parse tree,
|
||||
though optionally grafting them to another node rather than discarding them
|
||||
altogether.
|
||||
|
||||
Any heading which is excised is marked so that it won't have its own
|
||||
dependencies checked. This clarifies several cases, and in particular ensures
|
||||
that if Chapter X is excised then a subordinate Section Y cannot live on by
|
||||
replacing something elsewhere (which would effectively delete the content
|
||||
elsewhere).
|
||||
|
||||
=
|
||||
void Headings::excise_material_under(parse_node_tree *T, inbuild_copy *C, heading *h, parse_node *transfer_to) {
|
||||
LOGIF(HEADINGS, "Excision under $H\n", h);
|
||||
parse_node *hpn = h->sentence_declaring;
|
||||
if (h->sentence_declaring == NULL) internal_error("stipulations on a non-sentence heading");
|
||||
|
||||
if (Wordings::nonempty(h->in_place_of_text)) {
|
||||
heading *h2 = Headings::find_dependent_heading(hpn->down);
|
||||
if (h2) @<Can't replace heading subordinate to another replaced heading@>;
|
||||
}
|
||||
|
||||
Headings::suppress_dependencies(hpn);
|
||||
if (transfer_to) ParseTree::graft(T, hpn->down, transfer_to);
|
||||
hpn->down = NULL;
|
||||
}
|
||||
|
||||
heading *Headings::find_dependent_heading(parse_node *pn) {
|
||||
if (ParseTree::get_type(pn) == HEADING_NT) {
|
||||
heading *h = InbuildModule::heading(pn);
|
||||
if ((h) && (Wordings::nonempty(h->in_place_of_text))) return h;
|
||||
}
|
||||
for (parse_node *p = pn->down; p; p = p->next) {
|
||||
heading *h = InbuildModule::heading(p);
|
||||
if (h) return h;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void Headings::suppress_dependencies(parse_node *pn) {
|
||||
if (ParseTree::get_type(pn) == HEADING_NT)
|
||||
ParseTree::annotate_int(pn, suppress_heading_dependencies_ANNOT, TRUE);
|
||||
for (parse_node *p = pn->down; p; p = p->next)
|
||||
Headings::suppress_dependencies(p);
|
||||
}
|
||||
|
||||
@<Can't replace heading subordinate to another replaced heading@> =
|
||||
copy_error *CE = Copies::new_error(SYNTAX_CE, NULL);
|
||||
CE->error_subcategory = HeadingInPlaceOfSubordinate_SYNERROR;
|
||||
CE->details_node = h2->sentence_declaring;
|
||||
CE->details_work = h2->for_use_with;
|
||||
CE->details_work2 = h->for_use_with;
|
||||
CE->details_node2 = h->sentence_declaring;
|
||||
Copies::attach(C, CE);
|
||||
|
||||
@<Can't find heading in the given extension@> =
|
||||
TEMPORARY_TEXT(vt);
|
||||
WRITE_TO(vt, "unspecified, that is, the extension didn't have a version number");
|
||||
inform_extension *E;
|
||||
LOOP_OVER(E, inform_extension)
|
||||
if (Works::match(h->for_use_with, E->as_copy->edition->work)) {
|
||||
Str::clear(vt);
|
||||
VersionNumbers::to_text(vt, E->as_copy->edition->version);
|
||||
}
|
||||
copy_error *CE = Copies::new_error(SYNTAX_CE, NULL);
|
||||
CE->error_subcategory = HeadingInPlaceOfUnknown_SYNERROR;
|
||||
CE->details_node = h->sentence_declaring;
|
||||
CE->details_work = h->for_use_with;
|
||||
CE->details_W = h->in_place_of_text;
|
||||
CE->details = Str::duplicate(vt);
|
||||
Copies::attach(C, CE);
|
||||
DISCARD_TEXT(vt);
|
||||
|
||||
@<Can't replace heading unless level matches@> =
|
||||
copy_error *CE = Copies::new_error(SYNTAX_CE, NULL);
|
||||
CE->error_subcategory = UnequalHeadingInPlaceOf_SYNERROR;
|
||||
CE->details_node = h->sentence_declaring;
|
||||
Copies::attach(C, CE);
|
||||
|
|
|
@ -29,3 +29,7 @@ PM_ExtVersionTooLow
|
|||
PM_ExtVersionMalformed
|
||||
PM_ExtInadequateVM
|
||||
PM_ExtMisidentifiedEnds
|
||||
PM_HeadingInPlaceOfUnincluded
|
||||
PM_UnequalHeadingInPlaceOf
|
||||
PM_HeadingInPlaceOfSubordinate
|
||||
PM_HeadingInPlaceOfUnknown
|
||||
|
|
|
@ -12,7 +12,6 @@ on to the next.
|
|||
in order of when they work:
|
||||
|
||||
@e STARTED_CSEQ from 0
|
||||
@e LEXICAL_CSEQ
|
||||
@e SEMANTIC_LANGUAGE_CSEQ
|
||||
@e SEMANTIC_I_CSEQ
|
||||
@e SEMANTIC_II_CSEQ
|
||||
|
@ -100,20 +99,11 @@ most of these worker functions are in the |core| module, some are not.
|
|||
|
||||
@<Boot up the compiler@> =
|
||||
BENCH(Emit::begin);
|
||||
BENCH(Plugins::Manage::start);
|
||||
BENCH(InferenceSubjects::begin);
|
||||
BENCH(Index::DocReferences::read_xrefs);
|
||||
|
||||
@<Perform textual analysis@> =
|
||||
Task::advance_stage_to(LEXICAL_CSEQ, I"Textual analysis", 0);
|
||||
BENCH(Task::activate_language_elements)
|
||||
Inclusions::traverse(Task::project()->as_copy, Task::syntax_tree());
|
||||
SourceProblems::issue_problems_arising(Task::project()->as_copy);
|
||||
|
||||
// BENCH(Inclusions::traverse)
|
||||
BENCH(Sentences::Headings::satisfy_dependencies)
|
||||
|
||||
Task::advance_stage_to(SEMANTIC_LANGUAGE_CSEQ, I"Initialise language semantics", -1);
|
||||
Task::advance_stage_to(SEMANTIC_LANGUAGE_CSEQ, I"Semantic analysis Ia", -1);
|
||||
BENCH(Plugins::Manage::start_plugins);
|
||||
BENCH(Task::load_types);
|
||||
BENCH(BinaryPredicates::make_built_in)
|
||||
|
|
|
@ -46,6 +46,7 @@ plain text error written to |stderr|. See the |problems| module for more.
|
|||
@<Banner and startup@> =
|
||||
Errors::set_internal_handler(&Problems::Issue::internal_error_fn);
|
||||
PRINT("%B build %B has started.\n", FALSE, TRUE);
|
||||
Plugins::Manage::start();
|
||||
|
||||
@ |inbuild| supplies us with a folder in which to write the debugging log
|
||||
and the Problems report (the HTML version of our error messages or success
|
||||
|
|
|
@ -361,7 +361,56 @@ void SourceProblems::issue_problems_arising(inbuild_copy *C) {
|
|||
"would match with 'Hocus Pocus ends here.')");
|
||||
Problems::issue_problem_end();
|
||||
break;
|
||||
|
||||
case HeadingInPlaceOfUnincluded_SYNERROR:
|
||||
current_sentence = CE->details_node;
|
||||
Problems::quote_source(1, current_sentence);
|
||||
Problems::quote_extension_id(2, CE->details_work);
|
||||
Problems::Issue::handmade_problem(
|
||||
Task::syntax_tree(), _p_(PM_HeadingInPlaceOfUnincluded));
|
||||
Problems::issue_problem_segment(
|
||||
"In the sentence %1, it looks as if you intend to replace a section "
|
||||
"of source text from the extension '%2', but no extension of that "
|
||||
"name has been included - so it is not possible to replace any of its "
|
||||
"headings.");
|
||||
Problems::issue_problem_end();
|
||||
break;
|
||||
case UnequalHeadingInPlaceOf_SYNERROR:
|
||||
current_sentence = CE->details_node;
|
||||
Problems::Issue::sentence_problem(
|
||||
Task::syntax_tree(), _p_(PM_UnequalHeadingInPlaceOf),
|
||||
"these headings are not of the same level",
|
||||
"so it is not possible to make the replacement. (Level here means "
|
||||
"being a Volume, Book, Part, Chapter or Section: for instance, "
|
||||
"only a Chapter heading can be used 'in place of' a Chapter.)");
|
||||
break;
|
||||
case HeadingInPlaceOfSubordinate_SYNERROR:
|
||||
current_sentence = CE->details_node;
|
||||
Problems::quote_source(1, current_sentence);
|
||||
Problems::quote_extension_id(2, CE->details_work);
|
||||
Problems::quote_source(3, CE->details_node2);
|
||||
Problems::quote_extension_id(4, CE->details_work2);
|
||||
Problems::Issue::handmade_problem(Task::syntax_tree(), _p_(PM_HeadingInPlaceOfSubordinate));
|
||||
Problems::issue_problem_segment(
|
||||
"In the sentence %1, it looks as if you intend to replace a section "
|
||||
"of source text from the extension '%2', but that doesn't really make "
|
||||
"sense because this new piece of source text is part of a superior "
|
||||
"heading ('%3') which is already being replaced spliced into '%4'.");
|
||||
Problems::issue_problem_end();
|
||||
break;
|
||||
case HeadingInPlaceOfUnknown_SYNERROR:
|
||||
current_sentence = CE->details_node;
|
||||
Problems::quote_source(1, current_sentence);
|
||||
Problems::quote_extension_id(2, CE->details_work);
|
||||
Problems::quote_wording(3, CE->details_W);
|
||||
Problems::quote_stream(4, CE->details);
|
||||
Problems::Issue::handmade_problem(Task::syntax_tree(), _p_(PM_HeadingInPlaceOfUnknown));
|
||||
Problems::issue_problem_segment(
|
||||
"In the sentence %1, it looks as if you intend to replace a section "
|
||||
"of source text from the extension '%2', but that extension does "
|
||||
"not seem to have any heading called '%3'. (The version I loaded "
|
||||
"was %4.)");
|
||||
Problems::issue_problem_end();
|
||||
break;
|
||||
default:
|
||||
internal_error("unknown syntax error");
|
||||
}
|
||||
|
|
|
@ -35,7 +35,7 @@ void Modules::traverse_to_define(void) {
|
|||
|
||||
void Modules::look_for_cu(parse_node *p) {
|
||||
if (ParseTree::get_type(p) == HEADING_NT) {
|
||||
heading *h = ParseTree::get_embodying_heading(p);
|
||||
heading *h = InbuildModule::heading(p);
|
||||
if ((h) && (h->level == 0)) Modules::new(p);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,169 +3,6 @@
|
|||
To keep track of the hierarchy of headings and subheadings found
|
||||
in the source text.
|
||||
|
||||
@h Headings with extension dependencies.
|
||||
If the content under a heading depended on the VM not in use, or was marked
|
||||
not for release in a release run, we were able to exclude it just by
|
||||
skipping. The same cannot be done when a heading says that it should be
|
||||
used only if a given extension is, or is not, being used, because when
|
||||
the heading is created we don't yet know which extensions are included.
|
||||
But when the following is called, we do know that.
|
||||
|
||||
=
|
||||
void Sentences::Headings::satisfy_dependencies(void) {
|
||||
heading *h;
|
||||
LOOP_OVER(h, heading)
|
||||
if (h->use_with_or_without != NOT_APPLICABLE)
|
||||
Sentences::Headings::satisfy_individual_heading_dependency(h);
|
||||
}
|
||||
|
||||
@ And now the code to check an individual heading's usage. This whole
|
||||
thing is carefully timed so that we can still afford to cut up and rearrange
|
||||
the parse tree on quite a large scale, and that's just what we do.
|
||||
|
||||
=
|
||||
void Sentences::Headings::satisfy_individual_heading_dependency(heading *h) {
|
||||
if (h->level < 1) return;
|
||||
inbuild_work *work = h->for_use_with;
|
||||
int loaded = FALSE;
|
||||
if (Works::no_times_used_in_context(work, LOADED_WDBC) != 0) loaded = TRUE;
|
||||
LOGIF(HEADINGS, "SIHD on $H: loaded %d: annotation %d: %W: %d\n", h, loaded,
|
||||
ParseTree::int_annotation(h->sentence_declaring,
|
||||
suppress_heading_dependencies_ANNOT),
|
||||
h->in_place_of_text, h->use_with_or_without);
|
||||
if (Wordings::nonempty(h->in_place_of_text)) {
|
||||
wording S = h->in_place_of_text;
|
||||
if (ParseTree::int_annotation(h->sentence_declaring,
|
||||
suppress_heading_dependencies_ANNOT) == FALSE) {
|
||||
if (<quoted-text>(h->in_place_of_text)) {
|
||||
Word::dequote(Wordings::first_wn(S));
|
||||
wchar_t *text = Lexer::word_text(Wordings::first_wn(S));
|
||||
S = Feeds::feed_text(text);
|
||||
}
|
||||
heading *h2; int found = FALSE;
|
||||
if (loaded == FALSE) @<Can't replace heading in an unincluded extension@>
|
||||
else {
|
||||
LOOP_OVER(h2, heading)
|
||||
if ((Wordings::nonempty(h2->heading_text)) &&
|
||||
(Wordings::match_perhaps_quoted(S, h2->heading_text)) &&
|
||||
(Works::match(
|
||||
Headings::get_extension_containing(h2)->as_copy->edition->work, work))) {
|
||||
found = TRUE;
|
||||
if (h->level != h2->level)
|
||||
@<Can't replace heading unless level matches@>;
|
||||
Sentences::Headings::excise_material_under(h2, NULL);
|
||||
Sentences::Headings::excise_material_under(h, h2->sentence_declaring);
|
||||
break;
|
||||
}
|
||||
if (found == FALSE) @<Can't find heading in the given extension@>;
|
||||
}
|
||||
}
|
||||
} else
|
||||
if (h->use_with_or_without != loaded) Sentences::Headings::excise_material_under(h, NULL);
|
||||
}
|
||||
|
||||
@<Can't replace heading in an unincluded extension@> =
|
||||
current_sentence = h->sentence_declaring;
|
||||
Problems::quote_source(1, current_sentence);
|
||||
Problems::quote_extension_id(2, h->for_use_with);
|
||||
Problems::Issue::handmade_problem(Task::syntax_tree(), _p_(PM_HeadingInPlaceOfUnincluded));
|
||||
Problems::issue_problem_segment(
|
||||
"In the sentence %1, it looks as if you intend to replace a section "
|
||||
"of source text from the extension '%2', but no extension of that "
|
||||
"name has been included - so it is not possible to replace any of its "
|
||||
"headings.");
|
||||
Problems::issue_problem_end();
|
||||
|
||||
@ To excise, we simply prune the heading's contents from the parse tree,
|
||||
though optionally grafting them to another node rather than discarding them
|
||||
altogether.
|
||||
|
||||
Any heading which is excised is marked so that it won't have its own
|
||||
dependencies checked. This clarifies several cases, and in particular ensures
|
||||
that if Chapter X is excised then a subordinate Section Y cannot live on by
|
||||
replacing something elsewhere (which would effectively delete the content
|
||||
elsewhere).
|
||||
|
||||
=
|
||||
void Sentences::Headings::excise_material_under(heading *h, parse_node *transfer_to) {
|
||||
LOGIF(HEADINGS, "Excision under $H\n", h);
|
||||
parse_node *hpn = h->sentence_declaring;
|
||||
if (h->sentence_declaring == NULL) internal_error("stipulations on a non-sentence heading");
|
||||
|
||||
if (Wordings::nonempty(h->in_place_of_text)) {
|
||||
heading *h2 = Sentences::Headings::find_dependent_heading(hpn->down);
|
||||
if (h2) @<Can't replace heading subordinate to another replaced heading@>;
|
||||
}
|
||||
|
||||
Sentences::Headings::suppress_dependencies(hpn);
|
||||
if (transfer_to) ParseTree::graft(Task::syntax_tree(), hpn->down, transfer_to);
|
||||
hpn->down = NULL;
|
||||
}
|
||||
|
||||
heading *Sentences::Headings::find_dependent_heading(parse_node *pn) {
|
||||
if (ParseTree::get_type(pn) == HEADING_NT) {
|
||||
heading *h = ParseTree::get_embodying_heading(pn);
|
||||
if ((h) && (Wordings::nonempty(h->in_place_of_text))) return h;
|
||||
}
|
||||
for (parse_node *p = pn->down; p; p = p->next) {
|
||||
heading *h = ParseTree::get_embodying_heading(p);
|
||||
if (h) return h;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void Sentences::Headings::suppress_dependencies(parse_node *pn) {
|
||||
if (ParseTree::get_type(pn) == HEADING_NT)
|
||||
ParseTree::annotate_int(pn, suppress_heading_dependencies_ANNOT, TRUE);
|
||||
for (parse_node *p = pn->down; p; p = p->next)
|
||||
Sentences::Headings::suppress_dependencies(p);
|
||||
}
|
||||
|
||||
@<Can't replace heading subordinate to another replaced heading@> =
|
||||
current_sentence = h2->sentence_declaring;
|
||||
Problems::quote_source(1, current_sentence);
|
||||
Problems::quote_extension_id(2, h2->for_use_with);
|
||||
Problems::quote_source(3, h->sentence_declaring);
|
||||
Problems::quote_extension_id(4, h->for_use_with);
|
||||
Problems::Issue::handmade_problem(Task::syntax_tree(), _p_(PM_HeadingInPlaceOfSubordinate));
|
||||
Problems::issue_problem_segment(
|
||||
"In the sentence %1, it looks as if you intend to replace a section "
|
||||
"of source text from the extension '%2', but that doesn't really make "
|
||||
"sense because this new piece of source text is part of a superior "
|
||||
"heading ('%3') which is already being replaced spliced into '%4'.");
|
||||
Problems::issue_problem_end();
|
||||
|
||||
@<Can't find heading in the given extension@> =
|
||||
TEMPORARY_TEXT(vt);
|
||||
current_sentence = h->sentence_declaring;
|
||||
Problems::quote_source(1, current_sentence);
|
||||
Problems::quote_extension_id(2, h->for_use_with);
|
||||
Problems::quote_wording(3, h->in_place_of_text);
|
||||
Problems::quote_text(4,
|
||||
"unspecified, that is, the extension didn't have a version number");
|
||||
inform_extension *E;
|
||||
LOOP_OVER(E, inform_extension)
|
||||
if (Works::match(h->for_use_with, E->as_copy->edition->work)) {
|
||||
VersionNumbers::to_text(vt, E->as_copy->edition->version);
|
||||
Problems::quote_stream(4, vt);
|
||||
}
|
||||
Problems::Issue::handmade_problem(Task::syntax_tree(), _p_(PM_HeadingInPlaceOfUnknown));
|
||||
Problems::issue_problem_segment(
|
||||
"In the sentence %1, it looks as if you intend to replace a section "
|
||||
"of source text from the extension '%2', but that extension does "
|
||||
"not seem to have any heading called '%3'. (The version I loaded "
|
||||
"was %4.)");
|
||||
Problems::issue_problem_end();
|
||||
DISCARD_TEXT(vt);
|
||||
|
||||
@<Can't replace heading unless level matches@> =
|
||||
current_sentence = h->sentence_declaring;
|
||||
Problems::Issue::sentence_problem(Task::syntax_tree(), _p_(PM_UnequalHeadingInPlaceOf),
|
||||
"these headings are not of the same level",
|
||||
"so it is not possible to make the replacement. (Level here means "
|
||||
"being a Volume, Book, Part, Chapter or Section: for instance, "
|
||||
"only a Chapter heading can be used 'in place of' a Chapter.)");
|
||||
|
||||
@h World objects under each heading.
|
||||
Every heading must carry with it a linked list of the nametags created in
|
||||
sentences which belong to it. So when any noun is created, the following
|
||||
|
|
|
@ -29,7 +29,6 @@ DECLARE_ANNOTATION_FUNCTIONS(constant_verb_form, verb_form)
|
|||
DECLARE_ANNOTATION_FUNCTIONS(control_structure_used, control_structure_phrase)
|
||||
DECLARE_ANNOTATION_FUNCTIONS(creation_proposition, pcalc_prop)
|
||||
DECLARE_ANNOTATION_FUNCTIONS(defn_language, inform_language)
|
||||
DECLARE_ANNOTATION_FUNCTIONS(embodying_heading, heading)
|
||||
DECLARE_ANNOTATION_FUNCTIONS(end_control_structure_used, control_structure_phrase)
|
||||
DECLARE_ANNOTATION_FUNCTIONS(evaluation, parse_node)
|
||||
DECLARE_ANNOTATION_FUNCTIONS(explicit_vh, value_holster)
|
||||
|
@ -86,7 +85,6 @@ MAKE_ANNOTATION_FUNCTIONS(constant_verb_form, verb_form)
|
|||
MAKE_ANNOTATION_FUNCTIONS(control_structure_used, control_structure_phrase)
|
||||
MAKE_ANNOTATION_FUNCTIONS(creation_proposition, pcalc_prop)
|
||||
MAKE_ANNOTATION_FUNCTIONS(defn_language, inform_language)
|
||||
MAKE_ANNOTATION_FUNCTIONS(embodying_heading, heading)
|
||||
MAKE_ANNOTATION_FUNCTIONS(end_control_structure_used, control_structure_phrase)
|
||||
MAKE_ANNOTATION_FUNCTIONS(evaluation, parse_node)
|
||||
MAKE_ANNOTATION_FUNCTIONS(explicit_vh, value_holster)
|
||||
|
@ -240,7 +238,6 @@ goes. The annotations used are identified by nonzero ID numbers, as follows:
|
|||
@e creation_proposition_ANNOT /* |pcalc_prop|: proposition which newly created value satisfies */
|
||||
@e creation_site_ANNOT /* |int|: whether an instance was created from this node */
|
||||
@e defn_language_ANNOT /* |inform_language|: what language this definition is in */
|
||||
@e embodying_heading_ANNOT /* |heading|: for parse nodes of headings */
|
||||
@e end_control_structure_used_ANNOT /* |control_structure_phrase|: for CODE BLOCK nodes only */
|
||||
@e epistemological_status_ANNOT /* |int|: a bitmap of results from checking an ambiguous reading */
|
||||
@e evaluation_ANNOT /* |parse_node|: result of evaluating the text */
|
||||
|
@ -299,7 +296,6 @@ goes. The annotations used are identified by nonzero ID numbers, as follows:
|
|||
@e ssp_segment_count_ANNOT /* |int|: number of subsequent complex-say phrases in stream */
|
||||
@e subject_ANNOT /* |inference_subject|: what this node describes */
|
||||
@e subject_term_ANNOT /* |pcalc_term|: what the subject of the subtree was */
|
||||
@e suppress_heading_dependencies_ANNOT /* int: ignore extension dependencies on this heading node */
|
||||
@e suppress_newlines_ANNOT /* |int|: whether the next say term runs on */
|
||||
@e table_cell_unspecified_ANNOT /* int: used to mark table entries as unset */
|
||||
@e text_unescaped_ANNOT /* |int|: flag used only for literal texts */
|
||||
|
|
|
@ -1,5 +0,0 @@
|
|||
[StructuralSentences::] Structural Sentences.
|
||||
|
||||
To parse structurally important sentences.
|
||||
|
||||
@
|
|
@ -57,7 +57,6 @@ which these sentences are collected under a hierarchy of headings, with
|
|||
material intended only for certain target virtual machines included or
|
||||
excluded as need be."
|
||||
Parse Tree Usage
|
||||
Structural Sentences
|
||||
Headings
|
||||
Nonstructural Sentences
|
||||
Of and From
|
||||
|
|
|
@ -105,8 +105,8 @@ which they differ.
|
|||
for (f=FALSE; i<NO_HEADING_LEVELS; i++)
|
||||
if (problem_headings[i] != NULL) {
|
||||
wording W = ParseTree::get_text(problem_headings[i]);
|
||||
#ifdef IF_MODULE
|
||||
W = Headings::get_text(ParseTree::get_embodying_heading(problem_headings[i]));
|
||||
#ifdef INBUILD_MODULE
|
||||
W = Headings::get_text(InbuildModule::heading(problem_headings[i]));
|
||||
#endif
|
||||
pos = Lexer::file_of_origin(Wordings::first_wn(W));
|
||||
if (f) WRITE_TO(PBUFF, ", ");
|
||||
|
|
|
@ -183,6 +183,8 @@ typedef struct parse_node_annotation {
|
|||
@e heading_level_ANNOT from 1 /* int: for HEADING nodes, a hierarchical level, 0 (highest) to 9 (lowest) */
|
||||
@e language_element_ANNOT /* |int|: this node is not really a sentence, but a language definition Use */
|
||||
@e sentence_unparsed_ANNOT /* int: set if verbs haven't been sought yet here */
|
||||
@e suppress_heading_dependencies_ANNOT /* int: ignore extension dependencies on this heading node */
|
||||
@e embodying_heading_ANNOT /* |heading|: for parse nodes of headings */
|
||||
|
||||
@d MAX_ANNOT_NUMBER (NO_DEFINED_ANNOT_VALUES+1)
|
||||
|
||||
|
|
Loading…
Reference in a new issue