vile / scheme / testdata / frontends / libraries.vile
26 lines · 26 sloc · 861 bytes · 76646891b77a3d5c6af4a1e42b122cd61dc1654b
Raw
1define-library((front,state),
2 export(count,bump!,next,literal,token),
3 import((scheme,base)), {
4 count := 0
5 token := 1
6 bump!() := {count=count+1, count}
7 define-syntax(next,syntax-rules((),((_,),bump!())))
8 define-syntax(literal,
9 syntax-rules((token,),((_,token),#t),((_,other),#f)))
10 })
11define-library((front,aliases),
12 export(rename(count,shared),bump!),
13 import(only((front,state),count,bump!)))
14count := 999
15bump! := #f
16token := 1
17import(prefix((front,aliases),a:),
18 rename(except((front,state),count,bump!),(token,renamed-token)))
19first := next()
20second := a:bump!()
21third := next()
22e := environment(quote(only((scheme,base),+)))
23list(first,second,third,a:shared,count,
24 literal(renamed-token),literal(token),
25 eval(quote(+(20,22)),e),
26 cond-expand((and(vile,library((front,state))),quote(present)),(else,quote(missing))))
27