Skip to content

Commit

Permalink
Fix for Mantis bug 1930
Browse files Browse the repository at this point in the history
  • Loading branch information
ganelson committed Apr 11, 2022
1 parent 3ece0f2 commit d3bf06e
Show file tree
Hide file tree
Showing 3 changed files with 52 additions and 0 deletions.
14 changes: 14 additions & 0 deletions inform7/Tests/Test Problems/PM_TableCorrFruitless2
@@ -0,0 +1,14 @@
Lab is a room.

Fooing is an action applying to one topic.
Understand "foo [text]" as fooing.

Check fooing:
if there is a token of the topic understood in the Table of Foo:
say "There is."

Table of Foo
token (text)
"blah"

Test me with "foo blah".
@@ -0,0 +1,20 @@
Inform 7 v10.1.0 has started.
I've now read your source text, which is 47 words long.
I've also read Basic Inform by Graham Nelson, which is 7691 words long.
I've also read English Language by Graham Nelson, which is 2328 words long.
I've also read Standard Rules by Graham Nelson, which is 32092 words long.
Problem__ PM_TableCorrFruitless2
>--> In the sentence 'if there is a token of the topic understood in the
Table of Foo' (source text, line 7), you seem to be looking up a
corresponding entry in a table: but you're looking up a snippet of a
command (a snippet) in a column of text. Although those look the same, they
really aren't, and no match can be made. (You might be able to fix matters
by converting the snippet to text, say writing '"[the topic understood]"'
in place of 'the topic understood'.)
I was trying to match this phrase:
there is (a token of the topic understood in the table of foo - a table
entry)
I recognised:
a token of the topic understood in the table of foo = a table entry, holding
a text
Inform 7 has finished.
18 changes: 18 additions & 0 deletions inform7/values-module/Chapter 5/Dash.w
Expand Up @@ -1997,6 +1997,24 @@ a property when recovering from other problems.
"since the entry is taken from something which isn't a table.");
return NEVER_MATCH;
}
if ((K_snippet) &&
(Kinds::eq(key_kind, K_snippet)) && (Kinds::eq(col_contents_kind, K_text))) {
THIS_IS_A_GROSSER_THAN_GROSS_PROBLEM;
Problems::quote_source(1, current_sentence);
Problems::quote_kind(2, col_contents_kind);
Problems::quote_kind(3, key_kind);
Problems::quote_wording(4, Node::get_text(p->down->next->next));
StandardProblems::handmade_problem(Task::syntax_tree(), _p_(PM_TableCorrFruitless2));
Problems::issue_problem_segment(
"In the sentence %1, you seem to be looking up a corresponding "
"entry in a table: but you're looking up a snippet of a command "
"(%3) in a column of text. Although those look the same, they "
"really aren't, and no match can be made. (You might be able to "
"fix matters by converting the snippet to text, say writing '\"[%4]\"' "
"in place of '%4'.)");
Problems::issue_problem_end();
return NEVER_MATCH;
}
if (Kinds::compatible(key_kind, col_contents_kind) == NEVER_MATCH) {
THIS_IS_A_GROSSER_THAN_GROSS_PROBLEM;
Problems::quote_source(1, current_sentence);
Expand Down

0 comments on commit d3bf06e

Please sign in to comment.