m4-discuss
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How to not expand in strings


From: Gary V. Vaughan
Subject: Re: How to not expand in strings
Date: Fri, 1 Oct 2010 19:43:59 +0700

Hi Mike,

On 1 Oct 2010, at 11:00, Mike Gran wrote:
> I need to avoid processing
> a curly bracket that appears inside a string, as in the 
> following
> 
> (set! str 
>      m4_ifdef({USE_REGEX},
>               {" } "},
>               {" > "}))

This is what changequote was designed for.  If you want to avoid
using it, then you can either pick a different quote character,
perhaps using a multi-character string to avoid clashing with
legitimate uses by the surrounding text -- maybe something like

  m4_changequote(,)
  m4_changequote({:,:})

or you could have a post-processing stage that substitutes unlikely
strings when m4 has finished, like Autoconf does with quadrigraphs:

  m4_ifdef({USE_REGEX},
           {" @:)@ "},
           {" > "}))

  m4 source-file.m4 | sed 's|@:)@|}|g;s|@(:@|{|g' > out-file.scm

Cheers,
-- 
Gary V. Vaughan (address@hidden)

Attachment: PGP.sig
Description: This is a digitally signed message part


reply via email to

[Prev in Thread] Current Thread [Next in Thread]