aboutsummaryrefslogtreecommitdiffstats
path: root/alv/base
diff options
context:
space:
mode:
authors-ol <s-ol@users.noreply.github.com>2020-05-27 11:09:15 +0000
committers-ol <s+removethis@s-ol.nu>2025-03-02 14:24:49 +0000
commit7c060bf6524ce63e34fe27a594851c295bed1231 (patch)
tree59b98be32a06dd2371af876504f0a46f106b434b /alv/base
parentallow > and < in symbol names (diff)
downloadalive-7c060bf6524ce63e34fe27a594851c295bed1231.tar.gz
alive-7c060bf6524ce63e34fe27a594851c295bed1231.zip
rename base.match.val → base.match.sig
Diffstat (limited to 'alv/base')
-rw-r--r--alv/base/init.moon6
-rw-r--r--alv/base/match.moon20
2 files changed, 13 insertions, 13 deletions
diff --git a/alv/base/init.moon b/alv/base/init.moon
index 65730a3..586a6bd 100644
--- a/alv/base/init.moon
+++ b/alv/base/init.moon
@@ -11,7 +11,7 @@
-- @see FnDef
-- @see Input
-- @see base.match.const
--- @see base.match.val
+-- @see base.match.sig
-- @see base.match.evt
-- @see Constant
-- @see SigStream
@@ -29,7 +29,7 @@ import PureOp from require 'alv.base.pureop'
import Builtin from require 'alv.base.builtin'
import FnDef from require 'alv.base.fndef'
import Input from require 'alv.base.input'
-import const, val, evt from require 'alv.base.match'
+import const, sig, evt from require 'alv.base.match'
import Constant, SigStream, EvtStream, IOStream from require 'alv.result'
import T, Primitive, Array, Struct from require 'alv.type'
import RTNode from require 'alv.rtnode'
@@ -40,7 +40,7 @@ import Error from require 'alv.error'
:Builtin
:FnDef
:Input
- :const, :val, :evt
+ :const, :sig, :evt
-- redundant exports, to keep anything an extension might need in one import
diff --git a/alv/base/match.moon b/alv/base/match.moon
index 65f53b1..4653107 100644
--- a/alv/base/match.moon
+++ b/alv/base/match.moon
@@ -9,9 +9,9 @@
-- `Repeat`, `Sequence`, `Choice`, and `Optional`. They can be used directly,
-- but there is also a number of shorthands for assembling patterns quickly:
--
--- - `const()`, `val()` and `evt()`: Shorthands for `Type('='), Type('~'), Type('!')`
+-- - `const()`, `sig()` and `evt()`: Shorthands for `Type('='), Type('~'), Type('!')`
-- - `const.sym`: Shorthand for `Type('=', T.sym)`
--- - `val.num`: Shorthand for `Type('~', T.num)`
+-- - `sig.num`: Shorthand for `Type('~', T.num)`
-- - `evt.str`: Shorthand for `Type('!', T.str)`
-- - `pat * 2`: Shorthand for `Repeat(pat, 1, 2)` (1-4 times `pat`)
-- - `pat * 0`: Shorthand for `Repeat(pat, 1, nil)` (1-* times `pat`)
@@ -29,7 +29,7 @@
-- Recalling patterns will memorize the first RTNode they match, and
-- only match further RTNodes of the same type. For example
--
--- arg = (val.num / val.str)!
+-- arg = (sig.num / sig.str)!
-- pattern = arg + arg
--
-- ...will match either two numbers or two strings, but not one number and one
@@ -39,7 +39,7 @@
-- sequence of keys that are used instead of integers when constructing the
-- capture table:
--
--- pattern = (val.str + val.num):named('key', 'value')
+-- pattern = (sig.str + sig.num):named('key', 'value')
-- pattern:match(...)
-- -- returns { {key='a', value=1}, {key='b', value=2}, ...}
--
@@ -282,12 +282,12 @@ const = setmetatable {}, {
-- Call or index with a string to obtain a `Type` instance.
-- Call to obtain a wildcard pattern.
--
--- val.str, val.num
--- val['vec3'], val(T.vec3)
--- val()
+-- sig.str, sig.num
+-- sig['vec3'], sig(T.vec3)
+-- sig()
--
--- @table val
-val = setmetatable {}, {
+-- @table sig
+sig = setmetatable {}, {
__index: (key) =>
with v = Type '~', T[key]
@[key] = v
@@ -315,5 +315,5 @@ evt = setmetatable {}, {
{
:Type, :Repeat, :Sequence, :Choice, :Optional
- :const, :val, :evt
+ :const, :sig, :evt
}