summaryrefslogtreecommitdiff
path: root/combinator.go
diff options
context:
space:
mode:
authorAdam Scarr <adam@vektah.net>2017-08-13 21:20:41 +1000
committerAdam Scarr <adam@vektah.net>2017-08-13 21:20:41 +1000
commit139e7606f4ab68b469438956c378745f51f7b65b (patch)
tree2eaa9cb87e008ecaffefc01c5da933f1ea9852dd /combinator.go
parent1c37779bd46d988c9e7b4bdb846b9daa89856b7c (diff)
Update benchmarks
Diffstat (limited to 'combinator.go')
-rw-r--r--combinator.go7
1 files changed, 2 insertions, 5 deletions
diff --git a/combinator.go b/combinator.go
index ca62f30..d7be3f9 100644
--- a/combinator.go
+++ b/combinator.go
@@ -39,11 +39,11 @@ func Any(parsers ...Parserish) Parser {
predictor := [255]int{}
return NewParser("Any()", func(ps *State, node *Result) {
+ ps.WS(ps)
if ps.Pos >= len(ps.Input) {
ps.ErrorHere("!EOF")
return
}
- longestError := Error{}
startpos := ps.Pos
predictorChar := ps.Input[startpos]
predicted := predictor[predictorChar]
@@ -53,9 +53,7 @@ func Any(parsers ...Parserish) Parser {
return
}
- if ps.Error.pos >= longestError.pos {
- longestError = ps.Error
- }
+ longestError := ps.Error
if ps.Cut <= startpos {
ps.Recover()
} else {
@@ -159,7 +157,6 @@ func Bind(parser Parserish, val interface{}) Parser {
return
}
node.Result = val
- return
}
}