Skip to main content

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



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?


That should be correct to:
  new MultiLineRule("q\"(", ")\"", token, (char) 0, true);
but anyways: yes and no, that would work for the heredoc with "a delimiter character (any of () <> {} or []) " which is the first case as shown in the wiki, but it wouldn't work for the second case with a delimiter identifier string:
int main() {
    string list = q"IDENT
1. Item One
2. Item Two
3. Item Three
IDENT";
    writef( list );
}
which is more like the Ruby and Perl heredoc.

--
Bruno Medeiros

Back to the top