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

rule [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."