Open ctrueden opened 9 years ago
@imagejan pointed out that there is a §
character midway through the script, which might be the culprit. But regardless, I think it is a bug to dump a big stack trace regardless of the script's contents. Would you agree, @Squareys?
OK, I take it back: this has nothing to do with javascript syntax highlighting. Sorry for the wrong classification, @Squareys. From the stack trace, it is a bug in the ImageJ1 macro support, written awhile ago by Johannes.
I am investigating!
I cannot reproduce with the posted script. Maybe the §
character is actually something else, or there is another hidden character.
In any case, I am closing this issue for now. If it comes up again, and someone can provide an MCVE to reproduce, then we will certainly fix it.
@ctrueden This issue caught my interest, because a user has experienced the same issue with another script. I have, however, for testing purposes used the script from SO.
The error does not appear every time I open the script, but it seems to happen more frequently after the script was executed and canceled. Opening it via File > Open Recent seems to increase the frequency of such errors occurring. I did about 30 runs in debug mode and caught the error several times. Every time, the issue was due to a comment. The end of a token (when the error occurred) during the tokenizing were somewhere way off, sometimes several lines below the actual end line of a comment.
What still baffles me is that the behavior is not deterministic..
Based on this report on SO, the Script Editor may be fragile when it comes to unusual characters or syntax.
The error in question is:
And the script which caused it: