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


  yeah - i noticed that if the fContentType matches whatever the default success token is, it will use that rule to continue evaluation.

  i use a unique partition type for all of my partitions except singe and double quotes, which share the same one. perhaps i should change that though after reading this...

  depending on how the final implementation winds up, you will probably need to use separate content types to distinguish between when D has an identifier in it's heredoc and when it doesn't.

On Fri, May 18, 2012 at 12:28 PM, Bruno Medeiros <bruno.do.medeiros@xxxxxxxxx> wrote:


On Wed, May 16, 2012 at 6:40 PM, Jae Gangemi <jgangemi@xxxxxxxxx> wrote:

  actually, i just went and re-read the wiki page, shouldn't this be simple for D?

  you'd just need multiple multi-line rules that look something like this (not sure if there is an escape char):

    new MultiLineRule("q(", ")\n", token, (char) 0, true);
    new MultiLineRule("q{", "}\n", token, (char) 0, true);

  no?


Actually, there's another bug here, and it's a tricky one, so heads up in case you might run to into in similar code on own work: If you use different rules to match the same token, the partitioner can at some times (especially for multi-line rules) try to resume scanning (look only for the end of the partition starting from the middle of it) using a rule different from the one that started the partition. So code like this:

q(
blah
}

might be scanned correctly as a partition of that token type, because one rule would start it, but another rule might end the scanning successfully. I mentioned this in more detail in this Eclipse bug:
https://bugs.eclipse.org/bugs/show_bug.cgi?id=346723


--
Bruno Medeiros

_______________________________________________
dltk-dev mailing list
dltk-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/dltk-dev




--
-jae