better strict funcs, WIP (#15199)
* better strict funcs, WIP * progress
This commit is contained in:
parent
e194cb41a4
commit
ddff13f01b
5 changed files with 36 additions and 14 deletions
|
|
@ -374,12 +374,14 @@ func checkNamedCaptured(pattern: RegexMatch, name: string): void =
|
|||
func `[]`*(pattern: CaptureBounds, name: string): HSlice[int, int] =
|
||||
let pattern = RegexMatch(pattern)
|
||||
checkNamedCaptured(pattern, name)
|
||||
pattern.captureBounds[pattern.pattern.captureNameToId[name]]
|
||||
{.noSideEffect.}:
|
||||
result = pattern.captureBounds[pattern.pattern.captureNameToId[name]]
|
||||
|
||||
func `[]`*(pattern: Captures, name: string): string =
|
||||
let pattern = RegexMatch(pattern)
|
||||
checkNamedCaptured(pattern, name)
|
||||
return pattern.captures[pattern.pattern.captureNameToId[name]]
|
||||
{.noSideEffect.}:
|
||||
result = pattern.captures[pattern.pattern.captureNameToId[name]]
|
||||
|
||||
template toTableImpl() {.dirty.} =
|
||||
for key in RegexMatch(pattern).pattern.captureNameId.keys:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue