Parse.AaParse.expand: def of bend-osdev-apparmor@0.1.0.0 Import: import bend-osdev-apparmor@0.1.0.0/parse.bend as Parse Lines 424-451 of bend-osdev-apparmor@0.1.0.0/parse.bend: https://jend.leeeet.dev/read.txt?path=bend-osdev-apparmor@0.1.0.0/parse.bend&start_line=424&end_line=451 import Base # the items with every include replaced by the included file's items; # scopes: the files included so far in each open block, innermost first def AaParse.expand(+fuel: Nat, items: List<&2, AaItem>, +files: List<&2, AaSrcFile>, +scopes: List<&2, List<&2, List<&2, U32>>>, +acc: List<&2, AaItem>) -> AaExpOut: match fuel: case 0n: AaParse.expand0(items, scopes, acc) case 1n+f: match items: case Nil{}: AaExpOut{AaItem.rev_onto(acc, Nil{}), scopes} case Con{it, +rest}: match it: case AaIOpen{ts, src}: AaParse.expand(fuel, rest, files, Con{Nil{}, scopes}, Con{AaIOpen{ts, src}, acc}) case AaIClose{src}: AaParse.expand(fuel, rest, files, AaParse.pop(scopes), Con{AaIClose{src}, acc}) case AaIInclude{+name, opt, +src}: # Bend evaluates both arms of a Bool.pick, so the recursion is # one call whose arguments depend on whether the file is seen +seen = AaParse.seen(scopes, name) +sub = AaParse.expand(f, AaParse.inc_items(Bool.pick(Maybe<&2, AaSrcFile>, seen, None{}, AaParse.find_file(files, name)), Bool.or(seen, opt), src), files, AaParse.mark(scopes, name), Nil{}) AaParse.expand(fuel, rest, files, Bool.pick(List<&2, List<&2, List<&2, U32>>>, seen, scopes, AaExpOut.scopes(sub)), Bool.pick(List<&2, AaItem>, seen, acc, AaItem.rev_onto(AaExpOut.items(sub), acc))) case AaIStmt{ts, src}: AaParse.expand(fuel, rest, files, scopes, Con{AaIStmt{ts, src}, acc}) case AaIVar{ts, src}: AaParse.expand(fuel, rest, files, scopes, Con{AaIVar{ts, src}, acc}) case AaIError{e}: AaParse.expand(fuel, rest, files, scopes, Con{AaIError{e}, acc}) Uses (18): https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Bool.or https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Bool.pick https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=List https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Maybe https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Nat https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=U32 https://jend.leeeet.dev/definition.txt?path=bend-osdev-apparmor@0.1.0.0/parse.bend&name=AaExpOut https://jend.leeeet.dev/definition.txt?path=bend-osdev-apparmor@0.1.0.0/parse.bend&name=AaExpOut.items https://jend.leeeet.dev/definition.txt?path=bend-osdev-apparmor@0.1.0.0/parse.bend&name=AaExpOut.scopes https://jend.leeeet.dev/definition.txt?path=bend-osdev-apparmor@0.1.0.0/parse.bend&name=AaItem https://jend.leeeet.dev/definition.txt?path=bend-osdev-apparmor@0.1.0.0/parse.bend&name=AaItem.rev_onto https://jend.leeeet.dev/definition.txt?path=bend-osdev-apparmor@0.1.0.0/parse.bend&name=AaParse.expand0 https://jend.leeeet.dev/definition.txt?path=bend-osdev-apparmor@0.1.0.0/parse.bend&name=AaParse.find_file https://jend.leeeet.dev/definition.txt?path=bend-osdev-apparmor@0.1.0.0/parse.bend&name=AaParse.inc_items https://jend.leeeet.dev/definition.txt?path=bend-osdev-apparmor@0.1.0.0/parse.bend&name=AaParse.mark https://jend.leeeet.dev/definition.txt?path=bend-osdev-apparmor@0.1.0.0/parse.bend&name=AaParse.pop https://jend.leeeet.dev/definition.txt?path=bend-osdev-apparmor@0.1.0.0/parse.bend&name=AaParse.seen https://jend.leeeet.dev/definition.txt?path=bend-osdev-apparmor@0.1.0.0/parse.bend&name=AaSrcFile