summaryrefslogtreecommitdiff
path: root/test/macros.conf
blob: ed7c84dd73e72a7e78fe4c95537fdaf4a2e5329d (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
macro empty {}
macro arg1 $a { arg1 invoked with $a; } # should not recurse
macro arg2 $a $b { arg2 { arg1 $a; arg1 $b; empty; } }
macro arg3 $a $b $c { arg3 { arg2 $a $b; arg1 $c; } }

empty;
arg1 argument;
arg2 argument1 argument2;
arg3 x y z;

# nested & conditional macro definitions
macro toplevel $arg {
    pre_if $arg ~ (a) {
        macro nested {
            toplevel was called with $arg and contains $1;
        }
    }
    nested;
}
toplevel b;
toplevel hallo;
nested; # not available here

macro multi $first @rest &block {
    first $first;
    rest @rest;
    invisible $invisible;
    pre_set $nested_var 1;
    block { █ }
}
pre_set $invisible 'this variable isn\'t visible';
pre_set $quot He\ 'lo;
multi a1 { empty; }
multi $quot a2 $quot { arg1 $quot; no $nested_var here; }