File: macros.conf

package info (click to toggle)
nginx-confgen 2.2-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 276 kB
  • sloc: ansic: 867; makefile: 61
file content (38 lines) | stat: -rw-r--r-- 896 bytes parent folder | download
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
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;
    cnt $#rest $#{rest} $#{rest,x};
    invisible $invisible;
    pre_set $nested_var 1;
    block { █ }
    pre_if $#rest == 0 {
        no additional args;
    }
}
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; }