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

From: Greg Jaxon <Greg.Jaxon_at_.....>
Date: Mon Mar 27 2006 - 09:47:12 PST
Bresticker, Shalom wrote:
> Both text macros and string literals can be continued on the next line 
> using a backslash at the end of the line.
> 
> In the case of the string literal, the line return as well as the 
> backslash are stripped off from the contents of the string.
> 
> I assume that if I have a text macro containing a multi-line string 
> literal, that the backslash-line return at the end of the line serves as 
> a line continuation for both the string literal and the text macro...

The \-newline escape sequence is a Unix-convention for expressing variable
length records in limited line-width settings.  It tends to be flattened
out quite early in lexical analysis.

You should get the effect I think you're seeking.  But from the tokenizer's
point of view there is no way for a macro expansion to deliver anything
"multi-line", because the macro ends at the first unescaped newline and it
does not become part of the macro definition.   The string literal inside
your macro definition appears to occur all on one "line" of input.

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.  I suppose the
`-escape could be put on steroids to provide this, but I hardly see any
benefit to adding so many levels of potential confusion to an already
dangerous and rather antique software engineering methodology.

Greg Jaxon
Disclaimer: this is not a Synopsys corporate position.
Received on Mon Mar 27 09:47:50 2006

This archive was generated by hypermail 2.1.8 : Mon Mar 27 2006 - 09:48:13 PST