RE: [sv-bc] `` macro token gluing operator

From: Gran, Alex <alex_gran_at_.....>
Date: Thu Jun 21 2007 - 14:46:30 PDT
Steve,
   Dave Rich had added comment to 1537 suggesting `` could possibly
consume white space between the tokens it was going.  This got me
thinking about the exact thing you suggested below.
    I think doing what you suggest would work.  Basically we would be
adding an enhancement to the behavior of the `` operator within marcos,
to say that it would consume any white-space between the tokens it is
joining.
  I don't believe this would break any backward compatibility for
Verilog or SV 1800-2005 because I can't think on any way you could
currently legally have `` with white space around it as the language
currently exists.

Using your example below
	`define x \a ``b

A parser prior to evaluating the `` operator would see an escaped
identifier "\a " starting with the \ and ending at the space character.
The this would prevent the `` from being part of the identifier.


1364-2005 Sec 3.7.1 says:
	Neither the leading backslash character nor the terminating
white space is considered to be part of the identifier.

Therefore when the `` is processed, that space character that is
currently acting as the end delimiter of the escaped identifier is still
there as white-space so if `` were enhanced to consume whitespace, it
could consume that space character and the end result would become:

   \ab 
 

~Alex


-----Original Message-----
From: owner-sv-bc@server.eda.org [mailto:owner-sv-bc@server.eda.org] On
Behalf Of Steven Sharp
Sent: Thursday, June 21, 2007 2:34 PM
To: shalom.bresticker@intel.com; spsaha@cal.interrasystems.com
Cc: sv-bc@server.eda.org
Subject: Re: [sv-bc] `` macro token gluing operator


>From: Surya Pratik Saha <spsaha@cal.interrasystems.com>

>- When `` is present inside an escaped text, is it part of escaped
text, 
>or still it will act as operator. For e.g.
>`define x \a``b
>
>Will it be \ab , or \a``b


I had another thought on this.  As noted in Mantis 1537, full backward
compatibility would require the `` to be treated as part of the escaped
identifier.  But it is desirable to be able to use token pasting to
create an escaped identifier.

Could we do this with

`define x \a ``b

The white space after \a completes an escaped identifier token that
does not include the white space.  Then the following token, b, would
be pasted onto it, giving \ab.

Steven Sharp
sharp@cadence.com


-- 
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.


-- 
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.
Received on Thu Jun 21 14:46:48 2007

This archive was generated by hypermail 2.1.8 : Thu Jun 21 2007 - 14:47:00 PDT