TrContext type
Direct parent types
- MatchContext
Undocumented Direct subtypes: 1
Methods
- descend(tc:TrContext)
Descend into current data, performing all the same transformations. Example
tr([1,2,[3,4]], Arr -> { ["start"] + descend(B) + ["end"] } ) # ["start", 1, 2, ["start", 3, 4, "end"], "end"]
- init(ctx:TrContext, root:Any, transformation:Any)
Undocumented
- init(cmd:TrCommand, x:Any, ctx:TrContext)
Undocumented
- skip(tc:TrContext)
Skip current object that matched %EX [1,2,"aa"].tr(Int -> skip(Y)) # The action is called with (Any, TrContext); Y is TrContext then.
- tr(x:Any, pattern:Any, tc:TrContext)
Checks whether x matches the pattern Returns
Lit(x) or TrNoMatch()
- tr(x:Any, a:Arr, tc:TrContext)
Match / transform x using the pattern in a Returns
Lit or TrCommand
- tr(x:Any, h:Hash, tc:TrContext)
Match / transform x using the pattern in h. Parameters
x Hash or HashLike Returns
Lit or TrCommand
- tr(x:Any, a:AnyOf, tc:TrContext)
Match / transform x using the pattern in a. First match shortcuts the evaluation: further items in a are not tried. Returns
Lit or TrNoMatch
- tr(x:Any, pa:PatternAction, tc:TrContext)
Transform x using pa::action of x matches pa::pattern. pa::action will be called with (Any, TrContext). pa::action can either return new data or perform an operation using TrContext. Currently supported operation is skip(TrContext). Returns
Lit, TrCommand, or TrNoMatch