Here's a patch that fixes a problem with syntax highlighting in Tcl. Basically if you have
set foo "some [ escaped ] brackets"
all the code after the string is taken as a string.
The other problem this fixes (although I'm not sure this is the right fix) is with curly brackets in interpolated variables. E.g.
puts "${variable} ${weird variable with spaces}"
the first ${variable} works, but the second ${weird variable with spaces} doesn't.
Although, admittedly you have to question the sanity of whomever puts spaces in his variables...
Index: Bundles/Tcl.tmbundle/Syntaxes/Tcl.plist =================================================================== --- Bundles/Tcl.tmbundle/Syntaxes/Tcl.plist (revision 1719) +++ Bundles/Tcl.tmbundle/Syntaxes/Tcl.plist (working copy) @@ -100,7 +100,7 @@ <key>comment</key> <string>FIXME not sure this is the proper way to do Tcl escape sequences --Allan</string> <key>match</key> - <string>\([abfnrtv"\]|0\d {2}|x[a-fA-F0-9]{2}|u[a-fA-F0-9]{4})</string> + <string>\([[]abfnrtv"\]|0 \d{2}|x[a-fA-F0-9]{2}|u[a-fA-F0-9]{4})</string> <key>name</key>
<string>constant.character.escape.tcl</string> </dict> @@ -108,7 +108,7 @@ <key>comment</key> <string>FIXME what are legal variable characters? --Allan</string> <key>match</key> - <string>$[a-zA-Z]+</string> + <string>${?[a-zA-Z]+}?</string> <key>name</key> <string>variable.other.tcl</ string> </dict>
-- pgp fingerprint: BC64 2E7A CAEF 39E1 9544 80CA F7D5 784D FB46 16C1
On 08/09/2005, at 23.50, Oscar Bonilla wrote:
Here's a patch that fixes a problem with syntax highlighting in Tcl. [...]
I've applied it to the grammar on the svn repository. I made the variable pattern: $([a-zA-Z]+|{[a-zA-Z ]*})
So it does match spaces, when using the bracket form.
btw: seeing how many have subscribed to the appcast, I figured I should mention that the bundle repository also has a change log available via RSS: http://macromates.com/svnlog/bundles.rss (changes made to bundles are rarely/never mentioned in the release notes).
Ah, much better. Thank you Alan. I've already updated and it looks good.
One other question though... inside strings, if I use the brackets to embed code, should I see syntax highlighting?
What I mean is that if I have:
set code "embed some code [set foo bar]"
Should the embedded 'set' be the same color as the first 'set'? If I do the Ctrl-Shift-P while inside the brackets, I see the right scopes: {source.tcl, string.quoted.double.tcl, source.tcl.embedded}, and I see from the bundle that source.tcl.embedded includes source.tcl, so my hunch is that yeah, I both sets should be the same color... is that so?
On Sep 8, 2005, at 3:31 PM, Allan Odgaard wrote:
On 08/09/2005, at 23.50, Oscar Bonilla wrote:
Here's a patch that fixes a problem with syntax highlighting in Tcl. [...]
I've applied it to the grammar on the svn repository. I made the variable pattern: $([a-zA-Z]+|{[a-zA-Z ]*})
So it does match spaces, when using the bracket form.
btw: seeing how many have subscribed to the appcast, I figured I should mention that the bundle repository also has a change log available via RSS: http://macromates.com/svnlog/bundles.rss (changes made to bundles are rarely/never mentioned in the release notes).
For new threads USE THIS: textmate@lists.macromates.com (threading gets destroyed and the universe will collapse if you don't) http://lists.macromates.com/mailman/listinfo/textmate
-- pgp fingerprint: BC64 2E7A CAEF 39E1 9544 80CA F7D5 784D FB46 16C1
On 09/09/2005, at 0.51, Oscar Bonilla wrote:
One other question though... inside strings, if I use the brackets to embed code, should I see syntax highlighting?
Well, it was supposed to :) but all keyword rules include the [ or { as part of the match (since they are only keywords in that case), and for the embedded code in strings, the [ was already parsed.
I've changed all keyword rules to use look-behind instead.
Let me know if there are problems (I'm not a Tcl programmer myself).
Cool. It appears to fix it (in my limited testing). I'll report back if I find anything unusual.
Thanks,
-Oscar
On Sep 8, 2005, at 4:10 PM, Allan Odgaard wrote:
On 09/09/2005, at 0.51, Oscar Bonilla wrote:
One other question though... inside strings, if I use the brackets to embed code, should I see syntax highlighting?
Well, it was supposed to :) but all keyword rules include the [ or { as part of the match (since they are only keywords in that case), and for the embedded code in strings, the [ was already parsed.
I've changed all keyword rules to use look-behind instead.
Let me know if there are problems (I'm not a Tcl programmer myself).
For new threads USE THIS: textmate@lists.macromates.com (threading gets destroyed and the universe will collapse if you don't) http://lists.macromates.com/mailman/listinfo/textmate
-- pgp fingerprint: BC64 2E7A CAEF 39E1 9544 80CA F7D5 784D FB46 16C1