MatchContext type

Undocumented

Direct children types

TrContext
Transformation context

Methods

!~(x:Any, pattern:Any, mc:MatchContext) Source: stdlib.ngs:1250
Undocumented
=~(x:Any, pattern:Any, _mc:MatchContext) Source: stdlib.ngs:1219
Fallback for pattern matching. Throws NotImplemented.
=~(x:Any, pa:PatternAction, mc:MatchContext)experimental Source: stdlib.ngs:1239
Undocumented
=~(x:Any, bti:BasicTypeInstance, _mc:MatchContext) Source: stdlib.ngs:1253
Undocumented

Returns

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

Returns

Bool
=~(x:Any, t:Transformed, mc:MatchContext) Source: stdlib.ngs:1354
Undocumented
=~(x:Any, h:Hash, mc:MatchContext) Source: stdlib.ngs:1368
Checks whether object fields (or Hash keys) named after h keys match (=~) the corresponding h values. Key of type Str, Int or Real: the field must exist (unless the value is IfExists) and match. Key that is a pattern (other than Branch or Each): some field whose name matches the key must match. Key that is Each(pattern): every field whose name matches the pattern must match. Key that is Branch(pattern): every field whose name matches the pattern is tried, always matches. Inspired by underscorejs' "matcher"
=~(x:Any, a:Arr, mc:MatchContext) Source: stdlib.ngs:1416
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:1433
Undocumented

Returns

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

Returns

x is t
=~(x:Any, l:Lit, _mc:MatchContext) Source: stdlib.ngs:1440
Check whether x is the literal value l (using ==)
=~(x:Eachable1, r:Repeat, mc:MatchContext) Source: stdlib.ngs:1461
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:1490
Negate the match

Returns

Bool
=~(x:Any, ap:AtPath, mc:MatchContext)internal Source: stdlib.ngs:1507
Do not use directly!
=~(x:Any, rp:ResetPath, mc:MatchContext)experimental Source: stdlib.ngs:1561
Undocumented
=~(x:Any, a:AnyOf, mc:MatchContext) Source: stdlib.ngs:2141
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:2208
Checks whether all of the patterns (elements of AllOf) match

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:2965
Checks whether x is in the range.

Example

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

Returns

Bool

Example

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

Returns

Bool

Example

[1,2,3] =~ Absent(0)  # MatchSuccess
=~(x:Any, cp:CommandsPipeline, _mc:MatchContext) Source: stdlib.ngs:7669
A value that is not a commands pipeline, process or DecodeHints does not match a commands pipeline pattern.
=~(x:DecodeHints, cp:CommandsPipeline, mc:MatchContext) Source: stdlib.ngs:7672
Undocumented
=~(x:Command, c:Command, mc:MatchContext) Source: stdlib.ngs:7685
Match command based on argv and options. c.argv is matched as a prefix of x.argv: x with additional arguments also matches.
=~(x:CommandsPipeline, cp:CommandsPipeline, mc:MatchContext) Source: stdlib.ngs:7693
Match commands pipeline command by command: same number of commands, each matched as in =~(Command, Command). Pipes, redirects and pipeline options (e.g. &) are not compared.
=~(x:Process, cp:CommandsPipeline, mc:MatchContext) Source: stdlib.ngs:7696
Match process based on argv and options
=~(x:Any, pfx:Pfx, mc:MatchContext) Source: stdlib.ngs:8227
Undocumented

Example

[1,2,3] =~ Pfx([1,2])
=~(x:Any, sfx:Sfx, mc:MatchContext) Source: stdlib.ngs:8256
Undocumented

Returns

Bool

Example

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

Parameters

sSubSeq of Str

Returns

Bool
=~(x:Any, r:RegExp, mc:MatchContext)internal Source: stdlib.ngs:8485
Checks for RegExp match. Updates MatchContext.

Returns

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

Example

%[w1 w2].filter(/1/)  # %[w1]
deeper(mc:MatchContext, cb:Fun) Source: stdlib.ngs:1167
Undocumented
deeper(mc:MatchContext, new_fields:Hash, cb:Fun) Source: stdlib.ngs:1174
Undocumented
init(mc:MatchContext, root:Any)experimental Source: stdlib.ngs:1159
Undocumented
return(mc:MatchContext, x:Any)deprecated Source: stdlib.ngs:1192
Undocumented
set_last_path_element(mc:MatchContext, x:Any) Source: stdlib.ngs:1186
Undocumented