Reputation: 11
From 1 week i use sublime. And i'm very pleased. But i have little problem. I write in perl with sublime.
Here is the problem:
Sublime did not recognize that 'some string
is quoted and $test_scalar
and everything after it like it is string. When i type it like that:
There is no problem.
I tried with the Perl.tmLanguage
file, but i did not understand it.
Can someone help me please?
Upvotes: 1
Views: 1716
Reputation: 107060
Perl is one of the few programming languages that use this type of construct for quoting strings, and many program editors simply don't get it.
Imagine you're writing a syntax highlighter, and you have to understand all of these are the same:
my $string = "this is my string";
my $string = qq(This is my string);
my $string = qq/This is my string/;
my $string = qq@This is my string@;
my $string = qq
(This is my string);
Your syntax highlighter would have to understand that q
, qq
, and qx
are quoting options, and that the character following them (after possible white space) is the character that's doing the quoting. Oh, and also that if the character is a (
, a {
, or a [
, the closing quote is a )
, }
, or a ]
. And, that this can be on more than one line. And, you really only need this for Perl.
I know that VIM can handle the qq quoting issue, but many other program editors I have tried failed. Even Stackoverflow's syntax highlighter (Google's prettify) fails.
Try Notepad++ or Textpad if you're on Windows. Or, try Eclipse with the EPIC editor. I believe that one also works.
Upvotes: 3
Reputation: 672
cperl-mode.el for Emacs does the job:
Maybe you can take a look at it's source and try to use the same rules in Sublime or at last point this to the plugin author.
Upvotes: 0
Reputation: 2316
Because Perl5 can't be statically parsed, editors have to make guesses about syntax. Could they do a better job in this case? Probably, but do keep in mind that it's impossible to do this perfectly.
In any case, your best bet is to get in touch with the author of the Perl syntax highlighting plugin for your editor.
Upvotes: 1
Reputation: 3272
As you said there is no problem and no syntax error. It is normal behavior either for sublime or vim editor. When you go on write qq operator on next line then highlighting string doesn't works on either editors.
Upvotes: 0