[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [Dltk-dev] heredoc scanner help

On Tue, May 1, 2012 at 8:25 PM, Jae Gangemi <jgangemi@xxxxxxxxx> wrote:
hello all -

  i was hoping someone here might have a suggestion on how to approach dealing w/ heredoc in order to create a document partition so it can be 'colored'

  i can't just have a rule that starts the partition as starting as soon as it sees the heredoc, b/c things like this are valid:

    $x = <<EOF . "blah"; 

  and the
    . "blah";

  should be treated differently from the rest of the statement.

  i'm guessing that i'm going to have to override some portion of the RuleBasedPartitionScanner in order to trace some kind of state that indicates heredoc was seen and all text after the newline up until the terminator should be treated as such??

  if there's a better idea/approach, please let me know. i checked the ruby plugin for ideas since it supports heredoc, but it doesn't look like anyone's tackled this there either.



dltk-dev mailing list

Hum, do you know if the simpler case of Heredoc scanner has been solved/implemented somewhere? That is, when there is nothing after the heredoc initial delimiter, like this:

$x = <<EOF

Such code would be useful for me as this is an open issue in the D language IDE. D supports heredoc, but only in the simpler form above (http://en.wikipedia.org/wiki/Here_document#D ), there is no way to continue a statement/_expression_ right after the initial delimiter/tag, like Perl and Ruby support.

It seems this simpler case can be implemented by just creating a new PatternRule, no need to change the RuleBasedPartitionScanner.

Bruno Medeiros