Skip to content

Commit

Permalink
[stdlib] Cosmetics in ~(Arr, PredRange)
Browse files Browse the repository at this point in the history
  • Loading branch information
ilyash-b committed Feb 21, 2024
1 parent 18041c3 commit f84f551
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions lib/stdlib.ngs
Original file line number Diff line number Diff line change
Expand Up @@ -3094,13 +3094,13 @@ doc %RET - MatchResult
F ~(arr:Arr, r:PredRange) {
i = indexes(arr, r, dflt=null)
i is Null returns MatchFailure(arr, r)
ret = MatchSuccess([arr[i]], r)
ret.named = {}
ret.positions = [i]
ret.whole = ret.matches[0]
ret.before = arr[0..i.start]
ret.after = arr[i.end..null]
ret
MatchSuccess([arr[i]], r)::{
A.named = {}
A.positions = [i]
A.whole = A.matches[0]
A.before = arr[0..i.start]
A.after = arr[i.end..null]
}
}

TEST a = %[a1 a2 b1 b2]; m = a ~ /^a/../^b/; m.matches == [['a2']] and m.before == ['a1'] and m.after == ['b1', 'b2']
Expand Down

0 comments on commit f84f551

Please sign in to comment.