From c7c657d38f999901225b33482ef3a15994526feb Mon Sep 17 00:00:00 2001 From: Bruce Hill Date: Wed, 18 Jul 2018 01:04:16 -0700 Subject: Prep work for next big upgrade, including adding a shorthand for upgrading actions similarly to 'parse % as %' --- core/collections.nom | 3 +++ core/metaprogramming.nom | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) (limited to 'core') diff --git a/core/collections.nom b/core/collections.nom index 100781b..d99ae49 100644 --- a/core/collections.nom +++ b/core/collections.nom @@ -62,6 +62,9 @@ compile [..] to %list append %item ..to (Lua "table.insert(\(%list as lua expr), \(%item as lua expr))") +compile [add %item to %list at index %i] to (..) + Lua "table.insert(\(%list as lua expr), \(%i as lua expr), \(%item as lua expr))" + compile [pop from %list, remove last from %list] to (..) Lua value "table.remove(\(%list as lua expr))" diff --git a/core/metaprogramming.nom b/core/metaprogramming.nom index f78ab50..c81eb74 100644 --- a/core/metaprogramming.nom +++ b/core/metaprogramming.nom @@ -3,7 +3,7 @@ This File contains actions for making actions and compile-time actions and some helper functions to make that easier. -lua> "NOMSU_CORE_VERSION = 2" +lua> "NOMSU_CORE_VERSION = 3" lua> ".." nomsu.COMPILE_ACTIONS["% -> %"] = function(nomsu, tree, \%args, \%body) local lua = LuaCode.Value(tree.source, "function(") -- cgit v1.2.3