Merge pull request #2800 from github/2794-local

[UPDATED] Switch to a different (and better) grammar for Inform 7 source code
This commit is contained in:
Arfon Smith
2016-01-07 16:37:28 -05:00
7 changed files with 127 additions and 9 deletions

6
.gitmodules vendored
View File

@@ -25,9 +25,6 @@
[submodule "vendor/grammars/Sublime-REBOL"] [submodule "vendor/grammars/Sublime-REBOL"]
path = vendor/grammars/Sublime-REBOL path = vendor/grammars/Sublime-REBOL
url = https://github.com/Oldes/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"] [submodule "vendor/grammars/autoitv3-tmbundle"]
path = vendor/grammars/autoitv3-tmbundle path = vendor/grammars/autoitv3-tmbundle
url = https://github.com/Red-Nova-Technologies/autoitv3-tmbundle url = https://github.com/Red-Nova-Technologies/autoitv3-tmbundle
@@ -704,6 +701,9 @@
[submodule "vendor/grammars/language-renpy"] [submodule "vendor/grammars/language-renpy"]
path = vendor/grammars/language-renpy path = vendor/grammars/language-renpy
url = https://github.com/williamd1k0/language-renpy.git 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
[submodule "vendor/grammars/atom-language-stan"] [submodule "vendor/grammars/atom-language-stan"]
path = vendor/grammars/atom-language-stan path = vendor/grammars/atom-language-stan
url = git@github.com:jrnold/atom-language-stan.git url = git@github.com:jrnold/atom-language-stan.git

View File

@@ -106,8 +106,6 @@ vendor/grammars/Sublime-Coq:
- source.coq - source.coq
vendor/grammars/Sublime-HTTP: vendor/grammars/Sublime-HTTP:
- source.httpspec - source.httpspec
vendor/grammars/Sublime-Inform:
- source.Inform7
vendor/grammars/Sublime-Lasso: vendor/grammars/Sublime-Lasso:
- file.lasso - file.lasso
vendor/grammars/Sublime-Logos: vendor/grammars/Sublime-Logos:
@@ -347,6 +345,8 @@ vendor/grammars/language-gfm:
- source.gfm - source.gfm
vendor/grammars/language-hy: vendor/grammars/language-hy:
- source.hy - source.hy
vendor/grammars/language-inform7:
- source.inform7
vendor/grammars/language-javascript: vendor/grammars/language-javascript:
- source.js - source.js
- source.js.regexp - source.js.regexp

View File

@@ -1510,7 +1510,7 @@ Inform 7:
extensions: extensions:
- .ni - .ni
- .i7x - .i7x
tm_scope: source.Inform7 tm_scope: source.inform7
aliases: aliases:
- i7 - i7
- inform7 - inform7

View File

@@ -1,6 +1,74 @@
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. 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 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.
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 a ! mark 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. 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.
say "Moo[if the noun is purple] indigo[end if]."
So we need to allow for that.

View File

@@ -2,11 +2,61 @@
Include Trivial Extension by Andrew Plotkin. Include Trivial Extension by Andrew Plotkin.
Volume 1 - overview
Chapter - setting the scene
The Kitchen is a room. 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. 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: Instead of examining Gelett:
say "You'd rather see than be one." 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]."