From 048496723b1da98ab02b4b6d06174d107650c4c9 Mon Sep 17 00:00:00 2001 From: Andrew Plotkin Date: Fri, 1 Jan 2016 16:15:03 -0500 Subject: [PATCH] Include lots more forms of Inform7 syntax. Including embedded Inform6 syntax. --- samples/Inform 7/Trivial Extension.i7x | 69 +++++++++++++++++++++++++- samples/Inform 7/story.ni | 52 ++++++++++++++++++- 2 files changed, 119 insertions(+), 2 deletions(-) diff --git a/samples/Inform 7/Trivial Extension.i7x b/samples/Inform 7/Trivial Extension.i7x index 1aae1b85..1ba8316d 100644 --- a/samples/Inform 7/Trivial Extension.i7x +++ b/samples/Inform 7/Trivial Extension.i7x @@ -1,6 +1,73 @@ -Version 1 of Trivial Extension by Andrew Plotkin begins here. +Version 2 of Trivial Extension by Andrew Plotkin begins here. + +"This is the rubric of the extension." + +"provided for the Linguist package by Andrew Plotkin" + +[Note the two special quoted lines above.] A cow is a kind of animal. A cow can be purple. +Understand "cow" as a cow. +Understand "purple" as a purple cow. + +Check pushing a cow: + instead say "Cow-tipping, at your age?[paragraph break]Inconceivable." + +[Here are the possible levels of heading:] + +Volume One + +Text-line is always "A line of text." + +Book 2 + + Part the third - indented headings still count + +Chapter IV - not for release + +[Heading labels are case-insensitive.] + +section foobar + +[A line beginning "Volume" that does not have blank lines before and after it is *not* a header line. So the following is part of section foobar:] + +Measure is a kind of value. +Volume is a measure. Length is a measure. +Area is a measure. + +[And now some Inform 6 inclusions.] + +To say em -- running on: + (- style underline; -). +To say /em -- running on: + (- style roman; -). + +Include (- + +! Inform 6 comments start with ! marks and run to the end of the line. +Global cowcount; + +[ inform6func arg; + print "Here is some text; ", (address) 'dictword', ".^"; + cowcount++; ! increment this variable +]; + +Object i6cow + with name 'cow' 'animal', + with description "It looks like a cow."; + has animate scenery; + +-) after "Global Variables" in "Output.i6t". + Trivial Extension ends here. +---- DOCUMENTATION ---- + +Everything after the "---- DOCUMENTATION ----" line is documentation, so it should have the comment style. + +However, tab-indented lines are sample Inform code within the documentation: + + Horns are a kind of thing. Every cow has horns. + +So we need to allow for that. diff --git a/samples/Inform 7/story.ni b/samples/Inform 7/story.ni index f8873369..4fd774b5 100644 --- a/samples/Inform 7/story.ni +++ b/samples/Inform 7/story.ni @@ -2,11 +2,61 @@ Include Trivial Extension by Andrew Plotkin. +Volume 1 - overview + +Chapter - setting the scene + The Kitchen is a room. -[This kitchen is modelled after the one in Zork, although it lacks the detail to establish this to the player.] +[Comment: this kitchen is modelled after the one in Zork, although it lacks the detail to establish this to the player.] + +Section - the kitchen table + +The spicerack is a container in the Kitchen. + +Table of Spices +Name Flavor +"cinnamon" 5 +"nutmeg" 4 +"szechuan pepper" 8 + +The description of the spicerack is "It's mostly empty." + +Chapter - a character A purple cow called Gelett is in the Kitchen. +[This comment spans multiple lines.. + +...and this line contains [nested square[] brackets]... + +...which is legal in Inform 7.] + Instead of examining Gelett: say "You'd rather see than be one." + +Instead of examining Gelett: + say "You'd rather see than be one." + +Check smelling Gelett: + say "This text contains several lines. + +A blank line is displayed as a paragraph break, +but a simple line break is not."; + stop the action. + +Section - cow catching + +Gelett has a number called the mooness. + +Instead of taking Gelett: + increment the mooness of Gelett; + if the mooness of Gelett is one: + say "Gelett moos once."; + else: + say "Gelett moos [mooness of Gelett in words] times."; + +Volume 2 - the turn cycle + +Every turn: + say "A turn passes[one of][or] placidly[or] idly[or] tediously[at random]."