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

From: Greg Jaxon <Greg.Jaxon_at_.....>
Date: Tue Mar 28 2006 - 11:20:51 PST
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 Tue Mar 28 11:21:36 2006

This archive was generated by hypermail 2.1.8 : Tue Mar 28 2006 - 11:21:47 PST