MatchContext type

Undocumented

Direct children types

TrContext
Transformation context

Methods

!~(x:Any, pattern:Any, mc:MatchContext) Source: stdlib.ngs:1115
Undocumented
=~(x:Any, pattern:Any, _mc:MatchContext) Source: stdlib.ngs:1084
Fallback for pattern matching. Throws NotImplemented.
=~(x:Any, pa:PatternAction, mc:MatchContext)experimental Source: stdlib.ngs:1104
Undocumented
=~(x:Any, bti:BasicTypeInstance, _mc:MatchContext) Source: stdlib.ngs:1118
Undocumented

Returns

x == bti
=~(x:Any, c:Capture, mc:MatchContext)internal Source: stdlib.ngs:1148
Undocumented
=~(x:Any, ie:IfExists, mc:MatchContext) Source: stdlib.ngs:1180
Undocumented
=~(x:Any, b:Branch, mc:MatchContext)internal Source: stdlib.ngs:1198
Returns result of (=~)(x, b.pattern, mc)

Returns

Bool
=~(x:Any, t:Transformed, mc:MatchContext) Source: stdlib.ngs:1209
Undocumented
=~(x:Any, h:Hash, mc:MatchContext) Source: stdlib.ngs:1218
Checks whether object fields named after h hash keys match (=~) the corresponding hash values. Inspired by underscorejs' "matcher"
=~(x:Any, a:Arr, mc:MatchContext) Source: stdlib.ngs:1265
Checks that 1. The x is Eachable1 but not Str or Int 2. Each element of x matches (=~) corresponding element in a (If number of elements does not match - there is no match)
=~(x:Any, f:Fun, _mc:MatchContext) Source: stdlib.ngs:1282
Undocumented

Returns

f(x).Bool()
=~(x:Any, t:Type, _mc:MatchContext) Source: stdlib.ngs:1286
Check whether x is of type t

Returns

x is t
=~(x:Any, l:Lit, _mc:MatchContext) Source: stdlib.ngs:1289
Check whether x is the literal value l (using ==)
=~(x:Eachable1, r:Repeat, mc:MatchContext) Source: stdlib.ngs:1310
Check that x is a repetition of r.pattern and it occurs r.count times

Returns

Bool
=~(x:Any, n:Not, mc:MatchContext) Source: stdlib.ngs:1339
Negate the match

Returns

Bool
=~(x:Any, ap:AtPath, mc:MatchContext)internal Source: stdlib.ngs:1356
Do not use directly!
=~(x:Any, rp:ResetPath, mc:MatchContext)experimental Source: stdlib.ngs:1409
Undocumented
=~(x:Any, a:AnyOf, mc:MatchContext) Source: stdlib.ngs:1974
Check whether one of the patterns (elements of AnyOf) matches

Example

{"k1": "v1", "k2": "v2", "k3": "v3"}.filterk(AnyOf("k1", "k3"))  # {"k1": "v1", "k3": "v3"}
=~(x:Any, a:AllOf, mc:MatchContext) Source: stdlib.ngs:2002
Checks whether one of the patterns (elements of AllOf) matches

Example

{"k1": "v1", "k2": "v2", "kk3": "vv3"}.filterk(AllOf(/^k/, {len(A) <= 2})) == %{k1 v1 k2 v2}
=~(x:Any, nr:NumRange, _mc:MatchContext) Source: stdlib.ngs:2704
Checks whether x is in the range.

Example

1 =~ 0..5  # true
=~(x:Any, p:Present, mc:MatchContext) Source: stdlib.ngs:4433
Checks element presence.

Returns

Bool

Example

[1,2,3] =~ Present(3)  # MatchSuccess
=~(x:Any, a:Absent, mc:MatchContext) Source: stdlib.ngs:4456
Checks element absence.

Returns

Bool

Example

[1,2,3] =~ Absent(0)  # MatchSuccess
=~(x:DecodeHints, cp:CommandsPipeline, mc:MatchContext) Source: stdlib.ngs:7050
Undocumented
=~(x:Command, c:Command, mc:MatchContext) Source: stdlib.ngs:7063
Match command based on argv and options
=~(x:Process, cp:CommandsPipeline, mc:MatchContext) Source: stdlib.ngs:7070
Match process based on argv and options
=~(x:Any, pfx:Pfx, mc:MatchContext) Source: stdlib.ngs:7566
Undocumented

Example

[1,2,3] =~ Pfx([1,2])
=~(x:Any, s:SubSeq, _mc:MatchContext) Source: stdlib.ngs:7606
Checks subsequence presence

Parameters

sSubSeq of Str

Returns

Bool
=~(x:Any, r:RegExp, mc:MatchContext) Source: stdlib.ngs:7796
Undocumented

Returns

Checks whether the only argument is of type Str and matches (~) r

Example

%[w1 w2].filter(/1/)  # %[w1]
deeper(mc:MatchContext, cb:Fun) Source: stdlib.ngs:1032
Undocumented
deeper(mc:MatchContext, new_fields:Hash, cb:Fun) Source: stdlib.ngs:1039
Undocumented
init(mc:MatchContext, root:Any)experimental Source: stdlib.ngs:1024
Undocumented
return(mc:MatchContext, x:Any)deprecated Source: stdlib.ngs:1057
Undocumented
set_last_path_element(mc:MatchContext, x:Any) Source: stdlib.ngs:1051
Undocumented