Bug report: Sublime mis-parses a language-formatting bundle.
This report is about Sublime build 4107 on a Mac, to which has been added the TextMate PostScript bundle, as assisted in this forum (PostScript language support?, 28th Dec 2014). The same error is present in Sublime build 4107 on a PC.
Start with the small example file, www.jdawiseman.com/papers/bugs/20210618_postscript_dict_formatting.ps.
%!PS
% http://forum.sublimetext.com/t/mis-parse-language-formatting-bundle/59051
/TestForm1 % as might be invoked with execform
<<
/FormType 1
/BBox [ 0 0 72 72 ]
/Matrix matrix identmatrix
/PaintProc
{
% stuff
}
>>
% Moving the comment repairs the formating
/TestForm2
<<
/FormType 1
/BBox [ 0 0 72 72 ]
/Matrix matrix identmatrix
/PaintProc
{
% stuff
}
>>
/TestForm3 % as might be invoked with execform
<< % Start line with space or tab: repairs
/FormType 1
/BBox [ 0 0 72 72 ]
/Matrix matrix identmatrix
/PaintProc
{
% stuff
}
>>
TextMate 2.0.19 seems happy:
But Sublime build 4107 has mess:
Observe the red blocks, the green text, and mis-colouration of the dictionary boundaries = <<
and >>
.
The problem seems to require both:
- previous line ends in a comment =
% ...
; - line begins with a dictionary-start token =
<<
.
The problem disappears if the previous line doesn’t end in a comment; the problem disappears if the <<
is preceded by a tab or a space.
Is the error in the language bundle, or in Sublime? It could be that there is an error in the language bundle, and another error in TextMate, these two errors precisely cancelling. But one error, Sublime only, would suffice to explain. Hence Ockham’s Razor points to Sublime.
FWLIW, the problem is the same as the “Weird colouring bug” that was posted on 29th Dec 2014 (image). It can be seen in the wild: in the 12th June 2021 version of placemat.ps from line 3869; in subsequent versions perhaps search near there for “\n<<”.
There is no obvious reason to believe that my setup is quirky. Nonetheless, please could somebody else test the example PostScript file in their Sublime and TextMate, and confirm or deny the behaviour described in this post? Thank you.