Skip to content

Commit

Permalink
Add nimBug22740(), a workaround for Nim bug 22740
Browse files Browse the repository at this point in the history
  • Loading branch information
zevv committed Sep 25, 2023
1 parent b15a10e commit 049b4ca
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/npeg.nim
Original file line number Diff line number Diff line change
Expand Up @@ -177,5 +177,17 @@ proc captures*[S](mr: MatchResult[S]): seq[S] =
for cap in collectCaptures(mr.cs):
result.add cap.s

template nimBug22740*() =
## Provide stub templates as a workaround for https://github.com/nim-lang/Nim/issues/22740.
## Invoke this template in your code if you want to define a parser in a generic proc.
template `>`(a: untyped): untyped = discard
template `*`(a: untyped): untyped = discard
template `-`(a: untyped): untyped = discard
template `+`(a: untyped): untyped = discard
template `?`(a: untyped): untyped = discard
template `!`(a: untyped): untyped = discard
template `$`(a: untyped): untyped = discard


import npeg/lib/core

0 comments on commit 049b4ca

Please sign in to comment.