diff options
author | Adam Scarr <adam@vektah.net> | 2017-08-13 12:56:46 +1000 |
---|---|---|
committer | Adam Scarr <adam@vektah.net> | 2017-08-13 13:00:22 +1000 |
commit | 77930f8f066b058c7e6cbae015523370ca3dab7e (patch) | |
tree | fd0e4e3663f1183633fb16be297a20764a38d37c /parser.go | |
parent | f5b81e8e2eebd06e79159eaa3e721ac59ba3cc8c (diff) |
Add map shorthand
Diffstat (limited to 'parser.go')
-rw-r--r-- | parser.go | 5 |
1 files changed, 5 insertions, 0 deletions
@@ -25,6 +25,11 @@ type Result struct { // - A parser that consumed some input should advance state.Pos type Parser func(*State) Result +// Map shorthand for Map(p, func()) +func (p Parser) Map(f func(n Result) Result) Parser { + return Map(p, f) +} + // VoidParser is a special type of parser that never returns anything but can still consume input type VoidParser func(*State) |