aboutsummaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
Diffstat (limited to 'core')
-rw-r--r--core/cell.moon2
-rw-r--r--core/init.moon4
-rw-r--r--core/parsing.moon2
-rw-r--r--core/registry.moon13
-rw-r--r--core/tag.moon2
-rw-r--r--core/value.moon1
6 files changed, 15 insertions, 9 deletions
diff --git a/core/cell.moon b/core/cell.moon
index 3567a6d..2109ade 100644
--- a/core/cell.moon
+++ b/core/cell.moon
@@ -164,7 +164,7 @@ class Cell
-- @tparam table parts
-- @treturn Cell
@parse_root: (...) ->
- tag, children, white = parse_args (Tag\parse '0'), ...
+ tag, children, white = parse_args (Tag.parse '0'), ...
RootCell tag, children, white
-- @type RootCell
diff --git a/core/init.moon b/core/init.moon
index c4e8ffd..a5e892d 100644
--- a/core/init.moon
+++ b/core/init.moon
@@ -17,7 +17,7 @@ L or= setmetatable {}, __index: => ->
import Value from require 'core.value'
import Result from require 'core.result'
import Scope from require 'core.scope'
-import Registry from require 'core.registry'
+import Registry, SimpleRegistry from require 'core.registry'
import Tag from require 'core.tag'
import Cell from require 'core.cell'
@@ -44,7 +44,7 @@ globals = Scope.from_table require 'core.builtin'
:Cell, :RootCell
:Scope
- :Registry, :Tag
+ :Registry, :SimpleRegistry, :Tag
:globals
parse: program\match
diff --git a/core/parsing.moon b/core/parsing.moon
index 52dde27..b96f173 100644
--- a/core/parsing.moon
+++ b/core/parsing.moon
@@ -35,7 +35,7 @@ atom = num + sym + str
expr = (V 'cell') + atom
explist = Ct mspace * ((V 'expr') * (space * (V 'expr'))^0 * mspace)^-1
-tag = (P '[') * (digit^1 / Tag\parse) * (P ']')
+tag = (P '[') * (digit^1 / Tag.parse) * (P ']')
cell = (P '(') * tag^-1 * (V 'explist') * (P ')') / Cell.parse
root = P {
diff --git a/core/registry.moon b/core/registry.moon
index 7c785a6..374337a 100644
--- a/core/registry.moon
+++ b/core/registry.moon
@@ -71,11 +71,11 @@ class Registry
grab: =>
assert not @prev, "already have a previous registry? #{@prev}"
- @prev, @@active_registry = @@active_registry, @
+ @prev, Registry.active_registry = Registry.active_registry, @
release: =>
- assert @ == @@active_registry, "not the active registry!"
- @@active_registry, @prev = @prev, nil
+ assert @ == Registry.active_registry, "not the active registry!"
+ Registry.active_registry, @prev = @prev, nil
--- static functions
-- @section static
@@ -100,6 +100,8 @@ class SimpleRegistry extends Registry
new: =>
@cnt = 1
+ tick: 0
+
init: (tag, expr) =>
tag\set @cnt
@cnt += 1
@@ -107,6 +109,11 @@ class SimpleRegistry extends Registry
last: (index) =>
replace: (index, expr) =>
+ wrap: (fn) => (...) ->
+ @grab!
+ with fn ...
+ @release!
+
{
:Registry
:SimpleRegistry
diff --git a/core/tag.moon b/core/tag.moon
index 5819aae..a3ce1ae 100644
--- a/core/tag.moon
+++ b/core/tag.moon
@@ -97,7 +97,7 @@ class Tag
--
-- @tparam string num the number-string
-- @treturn Tag
- @parse: (num) => @ tonumber num
+ @parse: (num) -> Tag tonumber num
class ClonedTag extends Tag
new: (@original, @parent) =>
diff --git a/core/value.moon b/core/value.moon
index 1e528ed..2e93e70 100644
--- a/core/value.moon
+++ b/core/value.moon
@@ -130,7 +130,6 @@ class Value
-- @tparam string raw the raw string that resulted in this value. Used by `parsing`.
new: (@type, @value, @raw) =>
-
unescape = (str) -> str\gsub '\\([\'"\\])', '%1'
--- create a capture-function (for parsing with Lpeg).
--