Skip to content

Commit

Permalink
Fix for Mantis bug 1819
Browse files Browse the repository at this point in the history
  • Loading branch information
ganelson committed Apr 14, 2022
1 parent b1e7bd0 commit f824a92
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 2 deletions.
3 changes: 3 additions & 0 deletions inform7/Tests/Test Problems/PM_TableNameTooLong.txt
@@ -0,0 +1,3 @@
Table of Zoggle Zoggle Zoggle Zoggle Zoggle Zoggle Zoggle Zoggle Zoggle Zoggle Zoggle Zoggle Zoggle Zoggle Zoggle Zoggle Zoggle Zoggle Zoggle Zoggle Zoggle Zoggle Zoggle Zoggle Zoggle Zoggle Zoggle Zoggle Zoggle Zoggle Zoggle
foo
3
12 changes: 12 additions & 0 deletions inform7/Tests/Test Problems/_Results_Ideal/PM_TableNameTooLong.txt
@@ -0,0 +1,12 @@
Inform 7 v10.1.0 has started.
I've now read your source text, which is 35 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 32132 words long.
Problem__ PM_TableNameTooLong
>--> This table has been called 'Zoggle Zoggle Zoggle Zoggle Zoggle Zoggle
Zoggle Zoggle Zoggle Zoggle Zoggle Zoggle Zoggle Zoggle Zoggle Zoggle
Zoggle Zoggle Zoggle Zoggle Zoggle Zoggle Zoggle Zoggle Zoggle Zoggle
Zoggle Zoggle Zoggle Zoggle Zoggle' (source text, line 1), but that's just
too much text. Tables really don't need names longer than 20 words.
Inform 7 has finished.
18 changes: 16 additions & 2 deletions inform7/assertions-module/Chapter 7/Tables.w
Expand Up @@ -329,14 +329,28 @@ void Tables::create_table(parse_node *PN) {
t->table_name_text = GET_RW(<table-new-name>, 2);
break;
}

if ((Wordings::length(t->table_no_text) > 24) ||
(Wordings::length(t->table_name_text) > 24)) {
if (Wordings::length(t->table_no_text) > 24)
Problems::quote_wording_as_source(1, t->table_no_text);
else
Problems::quote_wording_as_source(1, t->table_name_text);
StandardProblems::handmade_problem(Task::syntax_tree(), _p_(PM_TableNameTooLong));
Problems::issue_problem_segment(
"This table has been called %1, but that's just too much text. Tables "
"really don't need names longer than 20 words.");
Problems::issue_problem_end();
DESTROY(t, table);
return;
}

@ Practical experience showed that the following restriction was wise:

@<Require the table name not to tread on some other value@> =
if (<s-type-expression-or-value>(t->table_name_text)) {
Problems::quote_wording_as_source(1, t->table_name_text);
StandardProblems::handmade_problem(Task::syntax_tree(),
_p_(PM_TableNameAmbiguous));
StandardProblems::handmade_problem(Task::syntax_tree(), _p_(PM_TableNameAmbiguous));
Problems::issue_problem_segment(
"The table name %1 will have to be disallowed as it is text which "
"already has a meaning to Inform. For instance, creating the 'Table "
Expand Down

0 comments on commit f824a92

Please sign in to comment.