diff options
| author | s-ol <s-ol@users.noreply.github.com> | 2020-05-12 16:12:09 +0000 |
|---|---|---|
| committer | s-ol <s+removethis@s-ol.nu> | 2025-03-02 14:23:21 +0000 |
| commit | d6e1decfb1791913ff6b11eb6cb69129ceb1a7e9 (patch) | |
| tree | eadd79f8edd960b9d0f8c03a0d1dee8c38188648 /alv/base | |
| parent | fix alv-lib (diff) | |
| download | alive-d6e1decfb1791913ff6b11eb6cb69129ceb1a7e9.tar.gz alive-d6e1decfb1791913ff6b11eb6cb69129ceb1a7e9.zip | |
base.match: never recall by default
Diffstat (limited to 'alv/base')
| -rw-r--r-- | alv/base/match.moon | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/alv/base/match.moon b/alv/base/match.moon index 74046f2..37d2fad 100644 --- a/alv/base/match.moon +++ b/alv/base/match.moon @@ -33,8 +33,7 @@ -- pattern = arg + arg -- -- ...will match either two numbers or two strings, but not one number and one --- string. Recalling works on `Choice` and `Type` patterns. `Type` patterns --- without a type (`val!` and `evt!`) always behave like this. +-- string. Recalling works on `Choice` and `Type` patterns. -- -- On `Sequence` patterns, a special method `:named` exists. It takes a -- sequence of keys that are used instead of integers when constructing the @@ -99,8 +98,7 @@ class Pattern -- @tparam string metatype `'~', '!' or '=' -- @tparam ?string type type name class Type extends Pattern - new: (@metatype, @type) => - @recall = not @type + new: (@metatype, @type, @recall=false) => casts = { '!!': true, '==': true, '~~': true, '~=': true } capture: (seq, i) => @@ -114,6 +112,7 @@ class Type extends Pattern if match 1, seq[i] + __call: => @@ @metatype, @type, true __tostring: => "#{@type or 'any'}#{@metatype}" --- Repeat a pattern. |
