RE: [sv-bc] multi-line text macros and string literals

From: Bresticker, Shalom <shalom.bresticker_at_.....>
Date: Sat Apr 01 2006 - 22:06:51 PST
I filed this clarification request as Mantis 1397.

Shalom

> -----Original Message-----
> From: owner-sv-bc@eda.org [mailto:owner-sv-bc@eda.org] On
> Behalf Of Greg Jaxon
> Sent: Tuesday, March 28, 2006 9:21 PM
> To: Bresticker, Shalom
> Cc: Greg Jaxon; sv-bc@eda.org
> Subject: Re: [sv-bc] multi-line text macros and string literals
> 
> By definition this is not a multiline string literal, Shalom.
> Printing it /does/ result in multiple lines of output, but
> that's not usually true for multiline string literals, consider
> this C example:
> 
> #include <stdio.h>
> int main(){
>     printf( "Hello "
>             "World!\n"
>     );
> }
> 
> The lexer delivers a token stream ending with these 11 tokens:
>   int main ( ) { printf ( "Hello World!\n" ) ; }
> 
> If \n was treated as newline *by macro expansion*, you could
> sprinkle them between tokens with impugnity.  But this escape
> sequence only means "newline" to the parsing layer which
> translates string literals into byte stream data values.  That
> newline character is never input to the tokenizer or parser
> (unless the APL "execute" function has been added to Verilog
>   and I missed all the fun!).
> 
> Bresticker, Shalom wrote:
> > How about " \n "?
> >
> > Shalom
> >
> >
> >>What I think is excluded by this model is any means of
> causing
> >>macro
> >>expansion to result in a multiline string literal being
> >>presented to
> >>the tokenizer.  I think this is impossible because there is
> no
> >>way to
> >>express newline as an output token of macro expansion.
Received on Sat Apr 1 22:06:59 2006

This archive was generated by hypermail 2.1.8 : Sat Apr 01 2006 - 22:07:03 PST