aboutsummaryrefslogtreecommitdiff
path: root/lib/permissions.nom
blob: bb492428e69678bb89a6398cc8b66498f5dfc184 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
use "lib/metaprogramming.nom"
use "lib/control_flow.nom"
use "lib/operators.nom"
use "lib/collections.nom"

action [called by %whitelist]:
    if ((%whitelist's "type") != "List"): %whitelist = [%whitelist]
    %defs = (..)
        dict ([(nomsu's "defs")->(nomsu "get_stub" [%]), yes] for all %whitelist)
    for %caller in (nomsu's "callstack"):
        if (%caller == "#macro"): do next %caller
        if (%defs -> (nomsu "get_stub" [%caller's 1])): return (yes)
    return (no)

parse [fail unless called by %whitelist] as:
    unless (called by %whitelist): error "Failed to find \(%whitelist) in callstack."