From 945e9f0ef0d9e1e678435d3090d4a742f6682440 Mon Sep 17 00:00:00 2001 From: Adam Scarr Date: Thu, 10 Aug 2017 22:10:30 +1000 Subject: Improve cut godoc --- parser.go | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'parser.go') diff --git a/parser.go b/parser.go index 12bb858..bc65e6d 100644 --- a/parser.go +++ b/parser.go @@ -109,9 +109,11 @@ func WS() Parser { // Cut prevents backtracking beyond this point. Usually used after keywords when you // are sure this is the correct path. Improves performance and error reporting. -func Cut(ps *State) Result { - ps.Cut = ps.Pos - return Result{} +func Cut() Parser { + return func(ps *State) Result { + ps.Cut = ps.Pos + return Result{} + } } // Regex returns a match if the regex successfully matches -- cgit v1.2.3