Sublime Forum

Syntax bug?

#1

https://img.skitch.com/20120227-xbikyfdadgyuhyhamcpe2c16jd.gif

any comments?

0 Likes

#2

https://img.skitch.com/20120227-cmy7srppcudjs99uxhkeyq1uiw.gif

same

0 Likes

#3

The first issue, is kind of a long standing issue. The Perl syntax highlighting is not very robust.

This is the offending regex; I have recently started commented it out in the Perl.tmLanguage file (lines 1979 - 2015)

<dict> <key>begin</key> <string>((&lt;&lt;) *((?!=\d\$ ])^;,'"`\s)]*)).*\n?</string> <key>captures</key> <dict> <key>0</key> <dict> <key>name</key> <string>punctuation.definition.string.perl</string> </dict> <key>1</key> <dict> <key>name</key> <string>string.unquoted.heredoc.perl</string> </dict> <key>2</key> <dict> <key>name</key> <string>punctuation.definition.heredoc.perl</string> </dict> </dict> <key>contentName</key> <string>string.unquoted.heredoc.perl</string> <key>end</key> <string>(^\3$)</string> <key>patterns</key> <array> <dict> <key>include</key> <string>#escaped_char</string> </dict> <dict> <key>include</key> <string>#variable</string> </dict> </array> </dict>

Not sure about the 2nd one though. Ideally these regexes would be fixed to only highlight when they are wanted, but I haven’t taken any time to look into it closely.

0 Likes

#4

Oh I am aware of the second issue. This is a general issue with using s in regex for instance, this will also break it. It will mistake the ‘#’ for comments

s#/\*^*]*\*+(^/*]^*]*\*+)*/|//(^\\]|^\n]\n]?)*?\n|("(\\.|^"\\])*"|'(\\.|^'\\])*'|.^/"'\\]*)#defined $3 ? $3 : ""#gse;

This is from Perl being a tricky language to syntax highlight. Perl is kind of inconsistant at times with allowable regex. I have seen many other Perl syntax highlighters break on the above comment regex. I am not saying there is not a possible fix, but it looks to be something someone would have wrap there brain around first. If Perl would do something like require regex and other things to be defined in a consistant manner, it would be so much easier to predict them.

0 Likes

#5

[quote]The first issue, is kind of a long standing issue. The Perl syntax highlighting is not very robust.

This is the offending regex; I have recently started commented it out in the Perl.tmLanguage file (lines 1979 - 2015)[/quote]

not helps :frowning:

i’ve edited /Users/USERNAME/Library/Application Support/Sublime Text 2/Packages/Perl/Perl.tmLanguage and restared sublime - no effect with first issue :frowning:

0 Likes

#6

Did you restart ST2?

0 Likes

#7

yes, of course

0 Likes

#8

Something must have went wrong on your end. It is working here.


I could send you my tmLanguage file if that would help.

0 Likes

#9

[quote=“facelessuser”]Oh I am aware of the second issue. This is a general issue with using s in regex for instance, this will also break it. It will mistake the ‘#’ for comments

s#/\*^*]*\*+(^/*]^*]*\*+)*/|//(^\\]|^\n]\n]?)*?\n|("(\\.|^"\\])*"|'(\\.|^'\\])*'|.^/"'\\]*)#defined $3 ? $3 : ""#gse;

This is from Perl being a tricky language to syntax highlight. Perl is kind of inconsistant at times with allowable regex. I have seen many other Perl syntax highlighters break on the above comment regex. I am not saying there is not a possible fix, but it looks to be something someone would have wrap there brain around first. If Perl would do something like require regex and other things to be defined in a consistant manner, it would be so much easier to predict them.[/quote]

eclipse seems to be ok

https://img.skitch.com/20120227-ji7ufyp5c5xe4yucdbfi362sqt.gif

0 Likes

#10

[quote=“facelessuser”]Something must have went wrong on your end. It is working here.

[attachment=0]Screen Shot 2012-02-27 at 7.59.46 AM.png[/attachment]

I could send you my tmLanguage file if that would help.[/quote]

yes, plz, send it to r4[a]findfile.ru
what am I doing wrong? maybe path to perl.tmLanguage is not correct?

0 Likes

#11

[quote=“robot468”]

[quote=“facelessuser”]Oh I am aware of the second issue. This is a general issue with using s in regex for instance, this will also break it. It will mistake the ‘#’ for comments

s#/\*^*]*\*+(^/*]^*]*\*+)*/|//(^\\]|^\n]\n]?)*?\n|("(\\.|^"\\])*"|'(\\.|^'\\])*'|.^/"'\\]*)#defined $3 ? $3 : ""#gse;

This is from Perl being a tricky language to syntax highlight. Perl is kind of inconsistant at times with allowable regex. I have seen many other Perl syntax highlighters break on the above comment regex. I am not saying there is not a possible fix, but it looks to be something someone would have wrap there brain around first. If Perl would do something like require regex and other things to be defined in a consistant manner, it would be so much easier to predict them.[/quote]

eclipse seems to be ok

https://img.skitch.com/20120227-ji7ufyp5c5xe4yucdbfi362sqt.gif[/quote]

I am not saying there aren’t some people that have figured out a good way to do it. I am just saying it is a tricky thing to do well, and I have seen others suffer from the same issue. If I get ambitious, I might try and fix it, but honestly, though I am decent at Perl, if given the option of using something else, I opt for something else. So, I don’t use Perl a whole lot anymore. I actually had my company install Python on all machines, just so I could use Python instead of Perl :smile:.

No offense to Perl lovers though.

0 Likes

#12

[quote=“robot468”]yes, plz, send it to r4[a]findfile.ru
what am I doing wrong? maybe path to perl.tmLanguage is not correct?[/quote]

Sent.

0 Likes

#13

thank you, your file helps!

i’ve just replaced lines 1979-2015 with what u gave me, but i but I had to comment it.
sorry, english is not my native language :smile:

0 Likes

#14

[quote=“robot468”]thank you, your file helps!

i’ve just replaced lines 1979-2015 with what u gave me, but i but I had to comment it.
sorry, english is not my native language :smile:[/quote]

Oh, that is what I wanted you to do. Sorry for the confusion :smile: .

0 Likes

#15

[quote=“facelessuser”]I am not saying there aren’t some people that have figured out a good way to do it. I am just saying it is a tricky thing to do well, and I have seen others suffer from the same issue. If I get ambitious, I might try and fix it, but honestly, though I am decent at Perl, if given the option of using something else, I opt for something else. So, I don’t use Perl a whole lot anymore. I actually had my company install Python on all machines, just so I could use Python instead of Perl :smile:.

No offense to Perl lovers though.[/quote]

I’m thinking about learning python. what’s python advantages for you? speed, convenience of coding?

0 Likes

#16

Perl makes me want to jump out a window when I use it for an extended time.

It is fast and powerful, but it is cryptic, doesn’t understand the concept of structures and classes, makes me type $, @, % for every single variable type and reference to it. It feels outdated every time I try to do something a lot more complicated than file parsing.

I am able to code in Python much quicker than in Perl. It is much more intuitive and convenient. It also has a lot of great built in libraries already inside. It isn’t without its quirks, but I can live with those quirks compared to Perl’s.

0 Likes

#17

thank you

0 Likes