Misc. cleanups.
This commit is contained in:
parent
09cb00e106
commit
9f61e7f90d
@ -159,6 +159,8 @@ rule [%items sorted by %key] =:
|
|||||||
%copy = (% for all %items)
|
%copy = (% for all %items)
|
||||||
sort %copy by %key
|
sort %copy by %key
|
||||||
%copy
|
%copy
|
||||||
|
rule [unique %items] =:
|
||||||
|
keys in (dict from entries ([%,yes] for all %items))
|
||||||
|
|
||||||
# Metatable stuff
|
# Metatable stuff
|
||||||
compile [counter] to: "setmetatable({}, {__index=function() return 0; end})"
|
compile [counter] to: "setmetatable({}, {__index=function() return 0; end})"
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
require "lib/metaprogramming.nom"
|
require "lib/metaprogramming.nom"
|
||||||
|
|
||||||
# Moonscript!
|
# Moonscript!
|
||||||
parse [moonscript block %moonscript_code] as:
|
parse [moonscript do> %moonscript_code] as:
|
||||||
lua do> ".."
|
lua do> ".."
|
||||||
|local parse, compile = require('moonscript.parse'), require('moonscript.compile');
|
|local parse, compile = require('moonscript.parse'), require('moonscript.compile');
|
||||||
|local moon_code = nomsu:tree_to_value(vars.moonscript_code, vars);
|
|local moon_code = nomsu:tree_to_value(vars.moonscript_code, vars);
|
||||||
@ -15,7 +15,7 @@ parse [moonscript block %moonscript_code] as:
|
|||||||
|end;
|
|end;
|
||||||
|return "do\\n"..lua_code.."\\nend";
|
|return "do\\n"..lua_code.."\\nend";
|
||||||
|
|
||||||
parse [moonscript %moonscript_code] as:
|
parse [moonscript> %moonscript_code] as:
|
||||||
lua do> ".."
|
lua do> ".."
|
||||||
|local parse, compile = require('moonscript.parse'), require('moonscript.compile');
|
|local parse, compile = require('moonscript.parse'), require('moonscript.compile');
|
||||||
|local moon_code = nomsu:tree_to_value(vars.moonscript_code, vars);
|
|local moon_code = nomsu:tree_to_value(vars.moonscript_code, vars);
|
||||||
|
@ -5,15 +5,16 @@ require "lib/collections.nom"
|
|||||||
|
|
||||||
# Permission functions
|
# Permission functions
|
||||||
rule [standardize rules %rules] =:
|
rule [standardize rules %rules] =:
|
||||||
if (=lua "type(vars.rules) == 'string'"): %rules = [%rules]
|
if ((type of %rules) == "string"): %rules = [%rules]
|
||||||
(nomsu "get_stub" [%]) for all %rules
|
(nomsu "get_stub" [%]) for all %rules
|
||||||
%set = []
|
%result = []
|
||||||
for %rule in %rules:
|
for %rule in %rules:
|
||||||
%stub = (nomsu "get_stub" [%rule])
|
%stub = (nomsu "get_stub" [%rule])
|
||||||
%aliases = (((nomsu's "defs")->%stub)->"aliases")
|
%def = ((nomsu's "defs")->%stub)
|
||||||
for all %aliases: %set -> % = (yes)
|
assert %def "Undefined rule: \(%stub)"
|
||||||
keys in %set
|
%aliases = (%def's "aliases")
|
||||||
|
for all %aliases: add % to %result
|
||||||
|
unique %result
|
||||||
|
|
||||||
rule [restrict %rules to within %elite_rules] =:
|
rule [restrict %rules to within %elite_rules] =:
|
||||||
%rules = (standardize rules %rules)
|
%rules = (standardize rules %rules)
|
||||||
|
Loading…
Reference in New Issue
Block a user