summaryrefslogtreecommitdiff
path: root/devel/bmake/files/unit-tests/dollar.exp
blob: 496adc02f157c7e77eb94d1d1cae6b74dfc59e1a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51

Printing dollar from literals and variables

To survive the parser, a dollar character 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