From 10ff2a1ea16eee3bcab0aea8dfd8582689d2ef95 Mon Sep 17 00:00:00 2001 From: Graham Nelson Date: Sun, 29 May 2022 12:17:26 +0100 Subject: [PATCH] Fix for Jira bug I7-2003 --- docs/CommandParserKit/S-prs.html | 24 ++++--- inform7/Figures/memory-diagnostics.txt | 64 +++++++++---------- inform7/Figures/timings-diagnostics.txt | 33 +++++----- .../CommandParserKit/Sections/Parser.i6t | 24 ++++--- inform7/Tests/Test Cases/Parser.txt | 10 +++ .../Test Cases/_Command_Scripts/Parser.txt | 4 ++ .../Test Cases/_Results_Ideal/Obedience-G.txt | 24 ++----- .../Test Cases/_Results_Ideal/Parser.txt | 14 ++++ .../_Results_Ideal/ParserErrors.txt | 4 +- .../Test Cases/_Results_Ideal/Parts-G.txt | 3 +- 10 files changed, 117 insertions(+), 87 deletions(-) diff --git a/docs/CommandParserKit/S-prs.html b/docs/CommandParserKit/S-prs.html index 0580951f4a..1462534e5f 100644 --- a/docs/CommandParserKit/S-prs.html +++ b/docs/CommandParserKit/S-prs.html @@ -997,7 +997,7 @@

nsns = 0; special_word = 0; multiple_object-->0 = 0; multi_context = 0; - etype = STUCK_PE; + etype = STUCK_PE; multi_had = 0; Put the word marker back to just after the verb @@ -1129,7 +1129,7 @@

parameters = 0; nsns = 0; special_word = 0; multiple_object-->0 = 0; - etype = STUCK_PE; + etype = STUCK_PE; multi_had = 1; wn = verb_wordnum+1;

§18. Parser Letter G. Parse each token in turn (calling ParseToken to do most of the work). @@ -1274,6 +1274,11 @@

jump GiveError; } + if (multi_had > 1) { + best_etype = TOOFEW_PE; + jump GiveError; + } + #Ifdef DEBUG; if (parser_trace >= 1) print "[Line successfully parsed]^"; #Endif; DEBUG @@ -2008,8 +2013,10 @@

if (token == MULTIEXCEPT_TOKEN or MULTIINSIDE_TOKEN) multi_context = token; if (indef_wanted < INDEF_ALL_WANTED && indef_wanted > 1) { multi_had = 1; multi_wanted = indef_wanted; - etype = TOOFEW_PE; - jump FailToken; + #Ifdef DEBUG; + if (parser_trace >= 4) print "Too few found at letter F^"; + #Endif; DEBUG + jump FailToken; } } } @@ -2767,10 +2774,11 @@

} } if (i < indef_wanted && indef_wanted < INDEF_ALL_WANTED) { - etype = TOOFEW_PE; multi_wanted = indef_wanted; - if (parser_trace >= 4) print "Too few found^"; - multi_had=i; - return -1; + multi_wanted = indef_wanted; + #Ifdef DEBUG; + if (parser_trace >= 4) print "Too few found in Adjudicate^"; + #Endif; DEBUG + multi_had=i; Allow to proceed for now } multiple_object-->0 = i+offset; multi_context = context; diff --git a/inform7/Figures/memory-diagnostics.txt b/inform7/Figures/memory-diagnostics.txt index e0923915aa..77ff3bbb73 100644 --- a/inform7/Figures/memory-diagnostics.txt +++ b/inform7/Figures/memory-diagnostics.txt @@ -1,47 +1,47 @@ -Total memory consumption was 129432K = 126 MB +Total memory consumption was 123375K = 120 MB ---- was used for 2044964 objects, in 362887 frames in 0 x 800K = 0K = 0 MB: - 31.5% inter_tree_node_array 58 x 8192 = 475136 objects, 41813824 bytes - 19.5% text_stream_array 4605 x 100 = 460500 objects, 25935360 bytes - 18.3% linked_list 43461 objects, 24338160 bytes - 10.6% inter_symbol_array 132 x 1024 = 135168 objects, 14061696 bytes - 9.9% inter_error_stash_array 101 x 1024 = 103424 objects, 13241504 bytes - 7.8% parse_node 129722 objects, 10377760 bytes - 5.6% verb_conjugation 160 objects, 7425280 bytes - 4.1% parse_node_annotation_array 346 x 500 = 173000 objects, 5547072 bytes - 2.5% pcalc_prop_array 25 x 1000 = 25000 objects, 3400800 bytes - 2.4% inter_name_array 67 x 1000 = 67000 objects, 3218144 bytes - 1.9% kind_array 66 x 1000 = 66000 objects, 2642112 bytes - 1.5% inter_name_generator_array 51 x 1000 = 51000 objects, 2041632 bytes + 33.0% inter_tree_node_array 58 x 8192 = 475136 objects, 41813824 bytes + 20.5% text_stream_array 4605 x 100 = 460500 objects, 25935360 bytes + 19.2% linked_list 43461 objects, 24338160 bytes + 11.1% inter_symbol_array 132 x 1024 = 135168 objects, 14061696 bytes + 10.4% inter_error_stash_array 101 x 1024 = 103424 objects, 13241504 bytes + 8.2% parse_node 129722 objects, 10377760 bytes + 5.8% verb_conjugation 160 objects, 7425280 bytes + 4.3% parse_node_annotation_array 346 x 500 = 173000 objects, 5547072 bytes + 2.6% pcalc_prop_array 25 x 1000 = 25000 objects, 3400800 bytes + 2.5% inter_name_array 67 x 1000 = 67000 objects, 3218144 bytes + 2.0% kind_array 66 x 1000 = 66000 objects, 2642112 bytes + 1.6% inter_name_generator_array 51 x 1000 = 51000 objects, 2041632 bytes 1.5% inter_schema_token 13969 objects, 2011536 bytes 1.4% package_request 21153 objects, 1861464 bytes - 1.3% vocabulary_entry_array 161 x 100 = 16100 objects, 1808352 bytes - 1.1% dict_entry_array 470 x 100 = 47000 objects, 1519040 bytes + 1.4% vocabulary_entry_array 161 x 100 = 16100 objects, 1808352 bytes + 1.2% dict_entry_array 470 x 100 = 47000 objects, 1519040 bytes 1.1% match_trie_array 11 x 1000 = 11000 objects, 1496352 bytes 1.1% inter_symbols_table 26592 objects, 1489152 bytes 1.0% i6_schema_array 23 x 100 = 2300 objects, 1380736 bytes - 0.9% scan_directory 314 objects, 1296192 bytes - 0.9% inter_package 26592 objects, 1276416 bytes + 1.0% scan_directory 314 objects, 1296192 bytes + 1.0% inter_package 26592 objects, 1276416 bytes 0.8% map_data 671 objects, 1127280 bytes 0.8% id_body 942 objects, 1077648 bytes 0.7% adjective_meaning 202 objects, 1000304 bytes 0.7% excerpt_meaning 3102 objects, 967824 bytes - 0.6% production 3878 objects, 899696 bytes + 0.7% production 3878 objects, 899696 bytes 0.6% ptoken 8397 objects, 873288 bytes 0.6% grammatical_usage 3613 objects, 867120 bytes 0.6% individual_form 2563 objects, 861168 bytes 0.6% inter_schema_node 8920 objects, 856320 bytes - 0.4% unary_predicate_array 16 x 1000 = 16000 objects, 640512 bytes + 0.5% unary_predicate_array 16 x 1000 = 16000 objects, 640512 bytes 0.3% local_variable_array 47 x 100 = 4700 objects, 452704 bytes - 0.2% verb_usage 1128 objects, 388032 bytes + 0.3% verb_usage 1128 objects, 388032 bytes 0.2% rule 470 objects, 368480 bytes 0.2% dictionary 7520 objects, 360960 bytes 0.2% verb_form 386 objects, 348944 bytes 0.2% noun 2382 objects, 285840 bytes 0.2% compilation_subtask 3355 objects, 268400 bytes - 0.1% inter_annotation_array 2 x 8192 = 16384 objects, 262208 bytes - 0.1% inference_subject 666 objects, 261072 bytes + 0.2% inter_annotation_array 2 x 8192 = 16384 objects, 262208 bytes + 0.2% inference_subject 666 objects, 261072 bytes 0.1% vanilla_function 3683 objects, 235712 bytes 0.1% binary_predicate 322 objects, 170016 bytes 0.1% hierarchy_location 1122 objects, 161568 bytes @@ -237,23 +237,23 @@ Total memory consumption was 129432K = 126 MB 100.0% was used for memory not allocated for objects: - 59.7% text stream storage 79137136 bytes in 478473 claims - 3.9% dictionary storage 5228544 bytes in 7520 claims + 57.7% text stream storage 72934448 bytes in 478022 claims + 4.1% dictionary storage 5228544 bytes in 7520 claims ---- sorting 1448 bytes in 149 claims - 5.4% source text 7200000 bytes in 3 claims - 8.1% source text details 10800000 bytes in 2 claims - 0.1% documentation fragments 262144 bytes in 1 claim + 5.6% source text 7200000 bytes in 3 claims + 8.5% source text details 10800000 bytes in 2 claims + 0.2% documentation fragments 262144 bytes in 1 claim ---- linguistic stock array 81920 bytes in 2 claims ---- small word set array 105600 bytes in 22 claims - 3.4% inter symbols storage 4520272 bytes in 27949 claims - 12.6% inter bytecode storage 16767680 bytes in 14 claims - 4.6% inter links storage 6222976 bytes in 11 claims + 3.5% inter symbols storage 4520272 bytes in 27949 claims + 13.2% inter bytecode storage 16767680 bytes in 14 claims + 4.9% inter links storage 6222976 bytes in 11 claims 0.1% inter tree location list storage 191232 bytes in 32 claims - 1.2% instance-of-kind counting 1700416 bytes in 1 claim + 1.3% instance-of-kind counting 1700416 bytes in 1 claim ---- compilation workspace for objects 21896 bytes in 25 claims ---- lists for type-checking invocations 16000 bytes in 1 claim ---- code generation workspace for objects 1336 bytes in 4 claims 0.2% emitter array storage 280288 bytes in 1999 claims --139.-3% was overhead - -184656920 bytes = -180329K = -176 MB +-146.-1% was overhead - -184656920 bytes = -180329K = -176 MB diff --git a/inform7/Figures/timings-diagnostics.txt b/inform7/Figures/timings-diagnostics.txt index 8242229923..10722797f8 100644 --- a/inform7/Figures/timings-diagnostics.txt +++ b/inform7/Figures/timings-diagnostics.txt @@ -1,33 +1,32 @@ 100.0% in inform7 run - 72.2% in compilation to Inter - 50.3% in //Sequence::undertake_queued_tasks// - 4.8% in //MajorNodes::pre_pass// - 3.6% in //MajorNodes::pass_1// - 2.4% in //RTPhrasebook::compile_entries// - 2.0% in //ImperativeDefinitions::assess_all// - 1.6% in //RTKindConstructors::compile// - 1.0% in //Sequence::lint_inter// - 0.6% in //ImperativeDefinitions::compile_first_block// + 71.1% in compilation to Inter + 50.6% in //Sequence::undertake_queued_tasks// + 4.6% in //MajorNodes::pre_pass// + 3.4% in //MajorNodes::pass_1// + 1.8% in //ImperativeDefinitions::assess_all// + 1.8% in //RTPhrasebook::compile_entries// + 1.4% in //RTKindConstructors::compile// + 1.2% in //Sequence::lint_inter// 0.6% in //MajorNodes::pass_2// + 0.6% in //Sequence::undertake_queued_tasks// 0.6% in //World::stage_V// - 0.4% in //Sequence::undertake_queued_tasks// + 0.4% in //ImperativeDefinitions::compile_first_block// 0.4% in //Sequence::undertake_queued_tasks// 0.2% in //CompletionModule::compile// 0.2% in //InferenceSubjects::emit_all// 0.2% in //RTKindConstructors::compile_permissions// 0.2% in //Task::make_built_in_kind_constructors// - 0.2% in //World::stages_II_and_III// 2.8% not specifically accounted for - 25.1% in running Inter pipeline + 26.0% in running Inter pipeline 9.8% in step 14/15: generate inform6 -> auto.inf - 5.6% in step 5/15: load-binary-kits - 5.2% in step 6/15: make-synoptic-module - 1.4% in step 9/15: make-identifiers-unique + 5.8% in step 5/15: load-binary-kits + 5.6% in step 6/15: make-synoptic-module + 1.6% in step 9/15: make-identifiers-unique 0.4% in step 12/15: eliminate-redundant-operations 0.4% in step 4/15: compile-splats 0.4% in step 7/15: shorten-wiring 0.4% in step 8/15: detect-indirect-calls 0.2% in step 11/15: eliminate-redundant-labels - 1.2% not specifically accounted for + 1.3% not specifically accounted for 2.2% in supervisor - 0.5% not specifically accounted for + 0.7% not specifically accounted for diff --git a/inform7/Internal/Inter/CommandParserKit/Sections/Parser.i6t b/inform7/Internal/Inter/CommandParserKit/Sections/Parser.i6t index c2763ef857..7b6a1445a9 100644 --- a/inform7/Internal/Inter/CommandParserKit/Sections/Parser.i6t +++ b/inform7/Internal/Inter/CommandParserKit/Sections/Parser.i6t @@ -923,7 +923,7 @@ Break down a syntax line into analysed tokens. nsns = 0; special_word = 0; multiple_object-->0 = 0; multi_context = 0; - etype = STUCK_PE; + etype = STUCK_PE; multi_had = 0; ! Put the word marker back to just after the verb @@ -1056,7 +1056,7 @@ and similarly for |multiinside|. parameters = 0; nsns = 0; special_word = 0; multiple_object-->0 = 0; - etype = STUCK_PE; + etype = STUCK_PE; multi_had = 1; wn = verb_wordnum+1; @h Parser Letter G. @@ -1200,6 +1200,11 @@ so that it may be reprinted by the parser later on. jump GiveError; } + if (multi_had > 1) { + best_etype = TOOFEW_PE; + jump GiveError; + } + #Ifdef DEBUG; if (parser_trace >= 1) print "[Line successfully parsed]^"; #Endif; ! DEBUG @@ -1926,8 +1931,10 @@ Return the conclusion of parsing an object list. if (token == MULTIEXCEPT_TOKEN or MULTIINSIDE_TOKEN) multi_context = token; if (indef_wanted < INDEF_ALL_WANTED && indef_wanted > 1) { multi_had = 1; multi_wanted = indef_wanted; - etype = TOOFEW_PE; - jump FailToken; + #Ifdef DEBUG; + if (parser_trace >= 4) print "Too few found at letter F^"; + #Endif; ! DEBUG + jump FailToken; } } } @@ -2680,10 +2687,11 @@ routines to clear up this mess, so we can't economise on working them out). } } if (i < indef_wanted && indef_wanted < INDEF_ALL_WANTED) { - etype = TOOFEW_PE; multi_wanted = indef_wanted; - if (parser_trace >= 4) print "Too few found^"; - multi_had=i; - return -1; + multi_wanted = indef_wanted; + #Ifdef DEBUG; + if (parser_trace >= 4) print "Too few found in Adjudicate^"; + #Endif; ! DEBUG + multi_had=i; ! Allow to proceed for now } multiple_object-->0 = i+offset; multi_context = context; diff --git a/inform7/Tests/Test Cases/Parser.txt b/inform7/Tests/Test Cases/Parser.txt index f0485a89c3..0a0f97548a 100644 --- a/inform7/Tests/Test Cases/Parser.txt +++ b/inform7/Tests/Test Cases/Parser.txt @@ -18,3 +18,13 @@ The description of the bottle is "It's [if the bottle is broken]broken[else]unbr Instead of attacking the unbroken bottle: say "Smash!"; now the bottle is broken. + +Section 2 - Too Few Error Testing + +A cube is a kind of thing. + +The Pea-green Boat is a room south of the Discard UNDO Testing Place. + +The owl and the pussycat are in the Pea-green Boat. + +South of the Boat is the Shore. Six cubes are in the Shore. diff --git a/inform7/Tests/Test Cases/_Command_Scripts/Parser.txt b/inform7/Tests/Test Cases/_Command_Scripts/Parser.txt index 54d442b6ad..09bcd75cb6 100644 --- a/inform7/Tests/Test Cases/_Command_Scripts/Parser.txt +++ b/inform7/Tests/Test Cases/_Command_Scripts/Parser.txt @@ -3,3 +3,7 @@ break bottle und undo examine bottle +s +take 5 pounds +s +take 17 cubes diff --git a/inform7/Tests/Test Cases/_Results_Ideal/Obedience-G.txt b/inform7/Tests/Test Cases/_Results_Ideal/Obedience-G.txt index 0f0819fd64..5d38859b6f 100644 --- a/inform7/Tests/Test Cases/_Results_Ideal/Obedience-G.txt +++ b/inform7/Tests/Test Cases/_Results_Ideal/Obedience-G.txt @@ -1538,21 +1538,13 @@ You can't put something inside itself. >** put strap in bag [inserting the strap into the frilly bag] -(first taking the strap) -[(1) taking the strap - silently] -That seems to be a part of the frilly bag. -[(1) taking the strap - silently - failed the can't take component parts rule] - -[inserting the strap into the frilly bag - failed the can't insert what's not held rule] +You can't put something inside itself. +[inserting the strap into the frilly bag - failed the can't insert something into itself rule] >** put my hand in the bag [inserting your hand into the frilly bag] -(first taking your hand) -[(1) taking your hand - silently] -That seems to be a part of yourself. -[(1) taking your hand - silently - failed the can't take component parts rule] - -[inserting your hand into the frilly bag - failed the can't insert what's not held rule] +You can't put something inside itself. +[inserting your hand into the frilly bag - failed the can't insert something into itself rule] >** close bag [closing the frilly bag] @@ -1659,12 +1651,8 @@ That seems to belong to Clark Gable. >** put scarf into briefcase [inserting the sparkly scarf into the briefcase] -(first taking the sparkly scarf) -[(1) taking the sparkly scarf - silently] -That seems to belong to Clark Gable. -[(1) taking the sparkly scarf - silently - failed the can't take people's possessions rule] - -[inserting the sparkly scarf into the briefcase - failed the can't insert what's not held rule] +The sparkly scarf is already there. +[inserting the sparkly scarf into the briefcase - failed the can't insert what's already inserted rule] >** undo Sound Stage diff --git a/inform7/Tests/Test Cases/_Results_Ideal/Parser.txt b/inform7/Tests/Test Cases/_Results_Ideal/Parser.txt index 3d0cf8e7ce..7ba2691de9 100644 --- a/inform7/Tests/Test Cases/_Results_Ideal/Parser.txt +++ b/inform7/Tests/Test Cases/_Results_Ideal/Parser.txt @@ -23,4 +23,18 @@ > > Discard UNDO Testing Place It's broken. +> > Pea-green Boat + Pea-green Boat + You can see an owl and a pussycat here. + +> > Pea-green Boat + You can't see any such thing. + +> > Shore + Shore + You can see six cubes here. + +> > Shore + Only six of those are available. + > > \ No newline at end of file diff --git a/inform7/Tests/Test Cases/_Results_Ideal/ParserErrors.txt b/inform7/Tests/Test Cases/_Results_Ideal/ParserErrors.txt index 062350d110..d1c9eca8e5 100644 --- a/inform7/Tests/Test Cases/_Results_Ideal/ParserErrors.txt +++ b/inform7/Tests/Test Cases/_Results_Ideal/ParserErrors.txt @@ -1,7 +1,7 @@ Garden Welcome An Interactive Fiction - Release 1 / Serial number 160118 / Inform 7 build 6M62 (I6/v6.33 lib 6/12N) SD + Release 1 / Serial number 160428 / Inform 7 v10.1.0 / D Garden You can see a wheelbarrow (in which is a pile of dirt), a flower plot and three marbles here. @@ -54,7 +54,7 @@ marble: Taken. >[14] get three marbles - "What, you seeing double? There ain't enough of those to go around." + What do you want to get those things from? >[15] "Come again?" diff --git a/inform7/Tests/Test Cases/_Results_Ideal/Parts-G.txt b/inform7/Tests/Test Cases/_Results_Ideal/Parts-G.txt index a200c1f2c0..58ac440d1e 100644 --- a/inform7/Tests/Test Cases/_Results_Ideal/Parts-G.txt +++ b/inform7/Tests/Test Cases/_Results_Ideal/Parts-G.txt @@ -351,8 +351,7 @@ You can't put something inside itself. >** put kangaroo in pouch (the mother kangaroo in the pouch) -(first taking the mother kangaroo) -I don't suppose the mother kangaroo would care for that. +You can't put something inside itself. >** open glass door You open the glass door.