atom / language-perl

Perl package for Atom
Other
25 stars 32 forks source link

format statement results in highlighting corruption #1

Closed nall closed 9 years ago

nall commented 10 years ago

The following Perl code results in the syntax highlighting becoming corrupted:

        format FOO =
@<<<<<<<< @>>>> @>>>>  | @<<<<<<<< @>>>> @>>>>
$a, $b,$c, $d,  $e, $f
.
kevinsawicki commented 10 years ago

Can you include a screenshot? And a description of how you think it should be rendered?

Here is how it looks for me, it doesn't appear corrupted at first glance but I'm no perl expert:

screen shot 2014-04-03 at 11 44 46 am

nall commented 10 years ago

I see this (note how things go bad at 715).

cb085e55e3242bd72534 2014-04-03 14-00-13 2014-04-03 14-00-57

kevinsawicki commented 10 years ago

Would it be possible for you to include the contents of that entire file in a comment?

Fank commented 9 years ago

A perfect example for this one is http://perldoc.perl.org/perlform.html#Top-of-Form-Processing

# a report on the /etc/passwd file
 format STDOUT_TOP =
                         Passwd File
 Name                Login    Office   Uid   Gid Home
 ------------------------------------------------------------------
 .
 format STDOUT =
 @<<<<<<<<<<<<<<<<<< @||||||| @<<<<<<@>>>> @>>>> @<<<<<<<<<<<<<<<<<
 $name,              $login,  $office,$uid,$gid, $home
 .
 # a report from a bug report form
 format STDOUT_TOP =
                         Bug Reports
 @<<<<<<<<<<<<<<<<<<<<<<<     @|||         @>>>>>>>>>>>>>>>>>>>>>>>
 $system,                      $%,         $date
 ------------------------------------------------------------------
 .
 format STDOUT =
 Subject: @<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
          $subject
 Index: @<<<<<<<<<<<<<<<<<<<<<<<<<<<< ^<<<<<<<<<<<<<<<<<<<<<<<<<<<<
        $index,                       $description
 Priority: @<<<<<<<<<< Date: @<<<<<<< ^<<<<<<<<<<<<<<<<<<<<<<<<<<<<
           $priority,        $date,   $description
 From: @<<<<<<<<<<<<<<<<<<<<<<<<<<<<< ^<<<<<<<<<<<<<<<<<<<<<<<<<<<<
       $from,                         $description
 Assigned to: @<<<<<<<<<<<<<<<<<<<<<< ^<<<<<<<<<<<<<<<<<<<<<<<<<<<<
              $programmer,            $description
 ~                                    ^<<<<<<<<<<<<<<<<<<<<<<<<<<<<
                                      $description
 ~                                    ^<<<<<<<<<<<<<<<<<<<<<<<<<<<<
                                      $description
 ~                                    ^<<<<<<<<<<<<<<<<<<<<<<<<<<<<
                                      $description
 ~                                    ^<<<<<<<<<<<<<<<<<<<<<<<<<<<<
                                      $description
 ~                                    ^<<<<<<<<<<<<<<<<<<<<<<<...
                                      $description
 .

The problem here is that << will trigger a "here-document" hightlighting (http://perldoc.perl.org/perlop.html#Quote-Like-Operators, e.g. my $asd = <<SQL; .....) https://github.com/atom/language-perl/blob/master/grammars/perl.cson#L1090-L1109

Fank commented 9 years ago

I validated this issue and it seems to be fixed on the current build

Fank commented 9 years ago

Added tests in #24 to ensure this won't happen again

Fank commented 9 years ago

@kevinsawicki am i allowed to manage issues? e.g. closing etc.

kevinsawicki commented 9 years ago

am i allowed to manage issues? e.g. closing etc.

Absolutely