Compare commits
1 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 77e5924cae |
@@ -1,17 +0,0 @@
|
|||||||
// Package lexer provides basic helpers to implement parsers
|
|
||||||
package lexer
|
|
||||||
|
|
||||||
// StateFn is a State Function of the parser
|
|
||||||
type StateFn func() (StateFn, error)
|
|
||||||
|
|
||||||
// Run runs a state machine until the state function either
|
|
||||||
// returns nil or an error
|
|
||||||
func Run(fn StateFn) error {
|
|
||||||
var err error
|
|
||||||
|
|
||||||
for fn != nil && err == nil {
|
|
||||||
fn, err = fn()
|
|
||||||
}
|
|
||||||
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
+1
-1
@@ -9,7 +9,7 @@ import (
|
|||||||
|
|
||||||
const (
|
const (
|
||||||
// ReadBufferSize indicates the initial buffer size
|
// ReadBufferSize indicates the initial buffer size
|
||||||
ReadBufferSize = 2 // 1 << 7 // 128B
|
ReadBufferSize = 1 << 7 // 128B
|
||||||
|
|
||||||
// DoublingBufferSizeLimit indicates when we stop doubling
|
// DoublingBufferSizeLimit indicates when we stop doubling
|
||||||
// and just add instead
|
// and just add instead
|
||||||
|
|||||||
Reference in New Issue
Block a user