On Thu, Jul 22, 2004 at 12:31:08AM +0400, Alexey Trofimenko wrote:
: I used $d='b' ,and not $d="b" above, just because it should be $d=\"b\"
: yes, I know, perl5 parser makes several passes on quotes, and when it sees  
: open quote, it finds closing quote first, then parses all inside.
: AFAIK, perl6 will be one-passing (with backtracking), and with new rules  
: it should be much easier to make a "parsing recursion".. do we need in  
: this \" ?. why not to parse strings as rules? so here's the
: 
: Question:
: 
:  perl6, Larry's new syntax:
: 
:  my $d="a";
:  print "--$d--{my $d = "b" }--$d--\n";
:                        ^ ^
:  is it correct?

Yes, that is correct.

: Oh my.. if my guessing about one-pass compilation of quoting constructs  
: was correct, does it mean that heredoc inside heredoc is possible?! :)

Ought to work unless we botch it somehow.  The trick to parsing
heredocs correctly is that you have to store away the rest of the
current line somewhere safe, then parse the next lines as string with a
user-specified terminator.  After completing the parse and finding that
terminator, you then go back to parsing the rest of the original line.
(Which may itself have another heredoc in it!)

Keeping the line numbers straight for error messages is also a bit
tricksy, but doable.  Two-dimensional parsing is fun...

Larry

Reply via email to