Steffen Schuldenzucker wrote:
> Btw., does TH parse this correctly? (If I was TH, I would not):
>
>> myPHPCode = [s|
>> <?php
>> $description = "Use the quasiquoter like this: [s|some text|]";
>> print $description."\n";
>> ?>
>> |]
>
> (the tricky part is "|]" occurring in the quoted text)
>
> Can we escape it?

Yes, like this:

myPHPCode = [s|
<?php
$description = "Use the quasiquoter like this: [s|some text|]++"|]"++[s|";
print $description."\n";
?>
|]

It's a good thing I'm not the one who wrote this
quasiquoter. I would have built in a special exception
that rejects any string containing "<?php".

Regards,
Yitz

_______________________________________________
Haskell mailing list
Haskell@haskell.org
http://www.haskell.org/mailman/listinfo/haskell

Reply via email to