Currently, depending on the contents of a single-line comment, FBC may allow or disallow multi-line comments in it. If a multi-line comment is allowed, then the comment continues after the end.
Code: Select all
this is a multi-line comment within a single-line comment
'/ this is part of the original single-line comment
'/ $lang: "fblite"
'' /' this is all a single-line comment
this is an invalid code statement, not a multi-line comment
'/ this is a single-line comment, because the line starts with an apostrophe
The reason for this is that FB parses comments, checking for something that looks like a metacommand, e.g. '$lang, '$dynamic. While it does this, it parses the comment as a statement, allowing multi-line comments.
As soon as FB detects that it's not a metacommand, e.g. it comes across a second apostrophe, or a normal word, or pretty much anything that's not a dollar sign, it indiscriminately skips the rest of the characters in the line, so any multi-line comment markers contained in there are ignored.
Anyway, VonGodric's posted a patch to fix this, and I think it's probably worth doing to improve consistency. Besides, metacommands are very much deprecated, and only supported in lang fb to either effect a dialect switch or prevent the user from accidentally trying to add something like '$dynamic, and being left with no clue to why it doesn't work.
But at the same time, I don't want to break any existing code, so I'd like to know if anyone is making use of this parsing anomaly before changing it...