I7 syntax coloring for BBEdit (Mac)

I have whipped up a quick I7 syntax coloring module, for the BBEdit/TextWrangler editors (on MacOS).


The I7 parsing is off the top of my head, so it may be wrong in some situations. Let me know. It skips quite a few features of the standard IDEs. Notably, it colors an I6 inclusion as a single block, rather than trying to syntax-color the I6 in its own right.

(Vimes is in the process of porting the standard syntax colorer from the Mac IDE into the BBEdit framework. But I’ll let him report on that. :slight_smile:

While we’re on the subject, here’s the TextMate 1 bundle I’ve been using for my Inform 7 work for a while, in case it’s useful to anyone… not entirely finished and polished and all that, but it works nicely for my purposes.
Inform 7.tmbundle.zip (11.7 KB)

While we’re on that subject… not that we were really… here’s the Atom.io bundle I just whipped up for I7.


I’ve sent a pull request to Github. Hopefully they will pick it up to replace their current I7 coloring algorithm, which has some holes.

(Other syntax-highlighting posts on this forum:
https://intfiction.org/t/i6-syntax-coloring-in-python/6176/1 )

Github has indeed deployed my atom.io coloring package, as you can see on any .ni or .i7x file:

github.com/i7/extensions/blob/m … rlinks.i7x


…although, hm, long lines aren’t wrapped. Were they wrapped before? I didn’t think I changed anything that would change that.

Long lines were not wrapped for me before on Github, so it looks like that has stayed the same.

I really like writing I7 code with the Atom editor and this Inform7 extension. Is there any chance you can implement some code folding for the volume|book|part|chapter|section logic?


1 Like

The spec for code folding in these things is defined here: manual.macromates.com/en/language_grammars

Since it’s regex-based, I don’t think it’s possible to define five-level nested folding in the way you’d expect for Inform code. There is no ending marker for a chapter; the chapter ends at the next chapter, part, book, or volume heading (but not section heading).

If someone figures it out, I’d be delighted to take a patch. :slight_smile:

could you use a commented end marker just for the sake of editing?

I don’t suppose there is an easy way to update the BBEdit/TextWrangler syntax coloring to work with the latest versions?

When BBE/TW updated, I went to look for the updated SDK but failed to find it. The link on barebones.com/support/develop/index.html gives the old (circa-2009) SDK, which does not work.

I think it would be real nice if we had Atom as an option for edit/compile/run for Inform 7. I assume with a series of plugins/extensions this could be done. Wishlist spoken aloud :wink: