bug-gnu-utils
[Top][All Lists]
Advanced

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

Re: M4 problem with escaping macro arguments


From: Andreas Schwab
Subject: Re: M4 problem with escaping macro arguments
Date: 16 Jul 2001 20:37:37 +0200
User-agent: Gnus/5.090003 (Oort Gnus v0.03) Emacs/21.0.105

address@hidden (Chris Leishman) writes:

|> Hi all,
|> 
|> According to the info page:
|> 
|>  If you want a macro to expand to something like `$12', put a pair of
|>  quotes after the `$'.  This will prevent `m4' from interpreting the `$'
|>  sign as a reference to an argument.
|> 
|> However, with gnu m4 version 1.4, the following results are observed:
|> 
|> $ m4 --version
|> GNU m4 1.4
|> $ echo "define(y, \$1-\$\`'2)y(5,6)"
|> define(y, $1-$`'2)y(5,6)
|> $ echo "define(y, \$1-\$\`'2)y(5,6)" | m4

This is not correctly quoted:

$ echo "define(y, \$1-\$\`'2)y(5,6)" | m4 -dtaeq
m4trace: -1- define(`y', `$1-$2')
m4trace: -1- y(`5', `6') -> `5-6'
5-6
$ echo "define(\`y', \`\$1-\$\`'2')y(5,6)" | m4 -dtaeq
m4trace: -1- define(`y', `$1-$`'2')
m4trace: -1- y(`5', `6') -> `5-$`'2'
5-$2

Andreas.

-- 
Andreas Schwab                                  "And now for something
SuSE Labs                                        completely different."
address@hidden
SuSE GmbH, Schanzäckerstr. 10, D-90443 Nürnberg
Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5



reply via email to

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