File tree Expand file tree Collapse file tree 2 files changed +6
-3
lines changed Expand file tree Collapse file tree 2 files changed +6
-3
lines changed Original file line number Diff line number Diff line change @@ -243,7 +243,7 @@ subpatterns or have trailing ``.._`` in pattern.
243
243
============= ============== ==============
244
244
245
245
Use examples
246
- ~~~~~~~~~~~~
246
+ ############
247
247
248
248
- capture all elements in sequence: ``[all @elems] ``
249
249
- get all elements until (not including "d"): ``[until @a is "d"] ``
@@ -419,7 +419,7 @@ Predicates and infix operators
419
419
------------------------------
420
420
421
421
Infix operators
422
- ~~~~~~~~~~~~~~~
422
+ ###############
423
423
424
424
By default object fields are either matched using recursive pattern, or
425
425
compared for equality (when ``field: "some value" `` is used). It is also
@@ -437,7 +437,7 @@ visible in the case branch.
437
437
438
438
439
439
Custom predicates
440
- ~~~~~~~~~~~~~~~~~
440
+ #################
441
441
442
442
Matching expressions using custom predicates is also possible. If it is not
443
443
necessary to capture matched element placeholder ``_. `` should be used as a
Original file line number Diff line number Diff line change @@ -904,6 +904,9 @@ suite "Matching":
904
904
text* : string
905
905
subn* : seq [HtmlNode]
906
906
907
+ proc `==` (x, y: HtmlNode): bool {.noSideEffect.} =
908
+ x.kind == y.kind and x.text == y.text and x.subn == y.subn
909
+
907
910
func add(n: var HtmlNode, s: HtmlNode) = n.subn.add s
908
911
909
912
func len(n: HtmlNode): int = n.subn.len
You can’t perform that action at this time.
0 commit comments