From 76ae1a9083216ae87fd93c28c60aa7f2af3a2a22 Mon Sep 17 00:00:00 2001 From: Graham Nelson Date: Sun, 10 Apr 2022 15:54:11 +0100 Subject: [PATCH] Fix and test case for Mantis bug 1979 --- .../Test Problems/PM_NoSuchVerbNumberedColon.txt | 5 +++++ .../_Results_Ideal/PM_NoSuchVerbNumberedColon.txt | 15 +++++++++++++++ .../Chapter 2/Classifying Sentences.w | 14 ++++++++++++++ 3 files changed, 34 insertions(+) create mode 100644 inform7/Tests/Test Problems/PM_NoSuchVerbNumberedColon.txt create mode 100644 inform7/Tests/Test Problems/_Results_Ideal/PM_NoSuchVerbNumberedColon.txt diff --git a/inform7/Tests/Test Problems/PM_NoSuchVerbNumberedColon.txt b/inform7/Tests/Test Problems/PM_NoSuchVerbNumberedColon.txt new file mode 100644 index 000000000..157da2e45 --- /dev/null +++ b/inform7/Tests/Test Problems/PM_NoSuchVerbNumberedColon.txt @@ -0,0 +1,5 @@ +Lab is a room. + +To (X - a number) be praised!: say X. + +To recite a hymn to 3: 3 be praised!. diff --git a/inform7/Tests/Test Problems/_Results_Ideal/PM_NoSuchVerbNumberedColon.txt b/inform7/Tests/Test Problems/_Results_Ideal/PM_NoSuchVerbNumberedColon.txt new file mode 100644 index 000000000..92e7fd95e --- /dev/null +++ b/inform7/Tests/Test Problems/_Results_Ideal/PM_NoSuchVerbNumberedColon.txt @@ -0,0 +1,15 @@ +Inform 7 v10.1.0 has started. +I've now read your source text, which is 22 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_NoSuchVerbNumberedColon + >--> In the sentence 'To recite a hymn to 3: 3 be praised !' (source text, line 5), + I can't find a verb that I know how to deal with. I notice there's a colon + ':' with a number either side of it - this might have led to confusion + because the usual convention that ':' divides a rule or phrase from its + definition does not apply in this case, to avoid potential confusion with + times of day like '2:15 PM'. If you put a line break after the ':' and + before the second number, though, you can make sure I'm definitely reading + it as punctuation. +Inform 7 has finished. diff --git a/inform7/assertions-module/Chapter 2/Classifying Sentences.w b/inform7/assertions-module/Chapter 2/Classifying Sentences.w index f6e573d44..20b0cc432 100644 --- a/inform7/assertions-module/Chapter 2/Classifying Sentences.w +++ b/inform7/assertions-module/Chapter 2/Classifying Sentences.w @@ -209,6 +209,7 @@ this, a problem message of some kind will certainly result. before/every/after/when/instead/check/carry/report ... | ==> @ if ... | ==> @ ... , ... | ==> @ + ... : ... | ==> @ ... ==> @ ::= @@ -250,6 +251,19 @@ this, a problem message of some kind will certainly result. "have been a colon ':'?)"); Problems::issue_problem_end(); +@ = + Problems::quote_source(1, current_sentence); + StandardProblems::handmade_problem(Task::syntax_tree(), _p_(PM_NoSuchVerbNumberedColon)); + Problems::issue_problem_segment( + "In the sentence %1, I can't find a verb that I know how to deal with. " + "I notice there's a colon ':' with a number either side of it - this might " + "have led to confusion because the usual convention that ':' divides a " + "rule or phrase from its definition does not apply in this case, to avoid " + "potential confusion with times of day like '2:15 PM'. If you put a line " + "break after the ':' and before the second number, though, you can make " + "sure I'm definitely reading it as punctuation."); + Problems::issue_problem_end(); + @ = Problems::quote_source(1, current_sentence); StandardProblems::handmade_problem(Task::syntax_tree(), _p_(PM_NoSuchVerb));