freebsd-skq/contrib/bmake/unit-tests/dollar.exp
Simon J. Gerraty e2eeea75eb Merge bmake-20201117
o allow env var MAKE_OBJDIR_CHECK_WRITABLE=no to skip writable
  checks in InitObjdir.  Explicit .OBJDIR target always allows
  read-only directory.

o More code cleanup and refactoring.

o More unit tests

MFC after:	1 week
2020-11-20 06:02:31 +00:00

52 lines
1.5 KiB
Plaintext

Printing dollar from literals and variables
To survive the parser, a dollar sign must be doubled.
1 dollar literal => <single-quote-var-value>
1 dollar literal eol => <>
2 dollar literal => <$>
4 dollar literal => <$$>
Some hungry part of make eats all the dollars after a :U modifier.
1 dollar default => <>
2 dollar default => <>
4 dollar default => <>
This works as expected.
1 dollar variable => <>
2 dollar variable => <$>
4 dollar variable => <$$>
Some hungry part of make eats all the dollars after a :U modifier.
1 dollar var-default => <>
2 dollar var-default => <$>
4 dollar var-default => <$$>
Dollar in :S pattern
S,$,word, => <$XYword>
S,$X,word, => <$XY>
S,$$X,word, => <$XY>
S,$$$X,word, => <$XY>
S,$X,replaced, => <replaced>
S,$$X,replaced, => <replaced>
S,$$$X,replaced, => <replaced>
Dollar in :C character class
The A is replaced because the $$ is reduced to a single $,
which is then resolved to the variable X with the value VAR_X.
The effective character class becomes [VAR_XY].
C,[$$XY],<&>,g => <$<A><X><Y>>
Dollar in :C pattern
For some reason, multiple dollars are folded into one.
C,$,dollar,g => <>
C,$$,dollar,g => <>
Dollar in :S replacement
For some reason, multiple dollars are folded into one.
S,word,a$Xo, => <aVAR_Xo>
S,word,a$$Xo, => <aVAR_Xo>
S,word,a$$$Xo, => <aVAR_Xo>
exit status 0