From 048496723b1da98ab02b4b6d06174d107650c4c9 Mon Sep 17 00:00:00 2001 From: Andrew Plotkin Date: Fri, 1 Jan 2016 16:15:03 -0500 Subject: [PATCH 1/8] 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]." From 0f4cf11294b9ab029e6832c699419ccef3b4fcac Mon Sep 17 00:00:00 2001 From: Andrew Plotkin Date: Fri, 1 Jan 2016 16:34:23 -0500 Subject: [PATCH 2/8] Wrong semicolon. --- samples/Inform 7/Trivial Extension.i7x | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/samples/Inform 7/Trivial Extension.i7x b/samples/Inform 7/Trivial Extension.i7x index 1ba8316d..8b7e14cd 100644 --- a/samples/Inform 7/Trivial Extension.i7x +++ b/samples/Inform 7/Trivial Extension.i7x @@ -55,7 +55,7 @@ Global cowcount; Object i6cow with name 'cow' 'animal', - with description "It looks like a cow."; + with description "It looks like a cow.", has animate scenery; -) after "Global Variables" in "Output.i6t". From 7060b116f46c465f4879c3e644042846263173dd Mon Sep 17 00:00:00 2001 From: Andrew Plotkin Date: Fri, 1 Jan 2016 16:54:55 -0500 Subject: [PATCH 3/8] Reword a little. --- samples/Inform 7/Trivial Extension.i7x | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/samples/Inform 7/Trivial Extension.i7x b/samples/Inform 7/Trivial Extension.i7x index 8b7e14cd..df0412c3 100644 --- a/samples/Inform 7/Trivial Extension.i7x +++ b/samples/Inform 7/Trivial Extension.i7x @@ -45,7 +45,7 @@ To say /em -- running on: Include (- -! Inform 6 comments start with ! marks and run to the end of the line. +! Inform 6 comments start with a ! mark and run to the end of the line. Global cowcount; [ inform6func arg; From f488b9b9f793e0bddd45d29cdc770c4c5d9490ff Mon Sep 17 00:00:00 2001 From: Andrew Plotkin Date: Fri, 1 Jan 2016 17:22:06 -0500 Subject: [PATCH 4/8] Test strings and substs in a doc comment. --- samples/Inform 7/Trivial Extension.i7x | 1 + 1 file changed, 1 insertion(+) diff --git a/samples/Inform 7/Trivial Extension.i7x b/samples/Inform 7/Trivial Extension.i7x index df0412c3..e748c820 100644 --- a/samples/Inform 7/Trivial Extension.i7x +++ b/samples/Inform 7/Trivial Extension.i7x @@ -69,5 +69,6 @@ Everything after the "---- DOCUMENTATION ----" line is documentation, so it shou However, tab-indented lines are sample Inform code within the documentation: Horns are a kind of thing. Every cow has horns. + say "Moo[if the noun is purple] indigo[end if]." So we need to allow for that. From c0b9e2c3f416eb8605cac9a27c0ab4300fa7ec78 Mon Sep 17 00:00:00 2001 From: Andrew Plotkin Date: Fri, 1 Jan 2016 21:52:51 -0500 Subject: [PATCH 5/8] Update comment. --- samples/Inform 7/Trivial Extension.i7x | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/samples/Inform 7/Trivial Extension.i7x b/samples/Inform 7/Trivial Extension.i7x index e748c820..40f53dab 100644 --- a/samples/Inform 7/Trivial Extension.i7x +++ b/samples/Inform 7/Trivial Extension.i7x @@ -30,7 +30,7 @@ Chapter IV - not for release 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:] +[A line beginning "Volume" that does not have blank lines before and after it is *not* a header line. So the following should all be part of section foobar. Sadly, the "Volume is..." line gets colored as a header, because Atom's regexp model can't recognize "thing with blank lines before and after"!] Measure is a kind of value. Volume is a measure. Length is a measure. From 537b83c75935b8b8b2cc5aa48af87d9e13edc304 Mon Sep 17 00:00:00 2001 From: Andrew Plotkin Date: Fri, 1 Jan 2016 22:23:01 -0500 Subject: [PATCH 6/8] Switch from Sublime-Inform grammar to language-inform7 grammar for Inform 7 source code. --- .gitmodules | 3 +++ grammars.yml | 4 ++-- lib/linguist/languages.yml | 2 +- vendor/grammars/language-inform7 | 1 + 4 files changed, 7 insertions(+), 3 deletions(-) create mode 160000 vendor/grammars/language-inform7 diff --git a/.gitmodules b/.gitmodules index 8234378a..726e5e12 100644 --- a/.gitmodules +++ b/.gitmodules @@ -701,3 +701,6 @@ [submodule "vendor/grammars/language-renpy"] path = vendor/grammars/language-renpy url = https://github.com/williamd1k0/language-renpy.git +[submodule "vendor/grammars/language-inform7"] + path = vendor/grammars/language-inform7 + url = https://github.com/erkyrath/language-inform7 diff --git a/grammars.yml b/grammars.yml index 8f7b1173..bca5a898 100644 --- a/grammars.yml +++ b/grammars.yml @@ -103,8 +103,6 @@ vendor/grammars/Sublime-Coq: - source.coq vendor/grammars/Sublime-HTTP: - source.httpspec -vendor/grammars/Sublime-Inform: -- source.Inform7 vendor/grammars/Sublime-Lasso: - file.lasso vendor/grammars/Sublime-Logos: @@ -342,6 +340,8 @@ vendor/grammars/language-gfm: - source.gfm vendor/grammars/language-hy: - source.hy +vendor/grammars/language-inform7: +- source.inform7 vendor/grammars/language-javascript: - source.js - source.js.regexp diff --git a/lib/linguist/languages.yml b/lib/linguist/languages.yml index c5eb9e6a..257cd7fc 100644 --- a/lib/linguist/languages.yml +++ b/lib/linguist/languages.yml @@ -1510,7 +1510,7 @@ Inform 7: extensions: - .ni - .i7x - tm_scope: source.Inform7 + tm_scope: source.inform7 aliases: - i7 - inform7 diff --git a/vendor/grammars/language-inform7 b/vendor/grammars/language-inform7 new file mode 160000 index 00000000..b953a1ef --- /dev/null +++ b/vendor/grammars/language-inform7 @@ -0,0 +1 @@ +Subproject commit b953a1efedcff21091ba3b7e7fbcd1040c1f02bb From b790a49282d970f0123965c31c484469eb6dc53a Mon Sep 17 00:00:00 2001 From: Andrew Plotkin Date: Fri, 1 Jan 2016 22:25:11 -0500 Subject: [PATCH 7/8] Remove the old Sublime-Inform grammar from the submodules list. --- .gitmodules | 3 --- 1 file changed, 3 deletions(-) diff --git a/.gitmodules b/.gitmodules index 726e5e12..f52dc313 100644 --- a/.gitmodules +++ b/.gitmodules @@ -25,9 +25,6 @@ [submodule "vendor/grammars/Sublime-REBOL"] path = vendor/grammars/Sublime-REBOL url = https://github.com/Oldes/Sublime-REBOL -[submodule "vendor/grammars/Sublime-Inform"] - path = vendor/grammars/Sublime-Inform - url = https://github.com/PogiNate/Sublime-Inform [submodule "vendor/grammars/autoitv3-tmbundle"] path = vendor/grammars/autoitv3-tmbundle url = https://github.com/Red-Nova-Technologies/autoitv3-tmbundle From 5d4cad639430ae917653da29fcfca79566019fb9 Mon Sep 17 00:00:00 2001 From: Andrew Plotkin Date: Fri, 1 Jan 2016 22:40:23 -0500 Subject: [PATCH 8/8] Remove the old submodule entry. --- vendor/grammars/Sublime-Inform | 1 - 1 file changed, 1 deletion(-) delete mode 160000 vendor/grammars/Sublime-Inform diff --git a/vendor/grammars/Sublime-Inform b/vendor/grammars/Sublime-Inform deleted file mode 160000 index 8db129b8..00000000 --- a/vendor/grammars/Sublime-Inform +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 8db129b8389044a6660ca232566651c8fe3ab646