Finding an unclosed bracket

Is there a way to find an unclosed bracket?

Got this vague error:

**Problem.** Some source text ended in the middle of a comment: main source text. This probably means that a ']' is missing somewhere. (If you are using Inform with syntax colouring, look for where the comment colour starts.) Inform's convention on 'nested comments' is that each '[' in a comment must be matched by a corresponding ']': so for instance '[This [even nested like so] acts as a comment]' is a single comment - the first ']' character matches the second '[' and so doesn't end the comment: only the second ']' ends the comment.

And spent too much time looking for where the problem was. (I used a ‘}’ in my haste.) I’m sure to do it again, so is there a way I could have saved time rather than going line by line?

Are you using an Inform IDE with syntax coloring?

Sorry, I don’t know. Just Inform 7 straight from the box. Where do I look to answer?

(Stuff enclosed in [] changes green or purple depending on context, if that’s what you mean.)

Maybe you can put the ‘{’ in the search blank, then click on the response in the drop box that opens under it. You are probably not likely to use braces at all in your coding, at least not intentionally, so the search should take you right to it. (I make that error all the time)

I hope this helps!

Yes indeed and certainly will do so in the future. At the time, though, I didn’t know what the issue really was. So, more generally, is there somewhere in Inform7 I can go to locate a problem line of code?

Like “Line 157 is causing a problem” or something. Or even a “the problem is in heading: Chapter 2”.

If you make that mistake, the entire source text turns green starting from the comment that isn’t closed properly. You can scroll through the source and visually find the place where the coloring starts to go wrong.

The compiler does give the location of the error if it knows where it is, but in this particular case the missing bracket could be anywhere between where the comment begins and the end of the source text, so it can’t give a more specific location. It could tell where the comment begins but I guess it could be confusing if the real error is somewhere completely different.

In this case, it didn’t turn the following text green (which might be what Zarf was trying to suss out?) and thereby made my search fun.