diff options
author | Özgür Kesim <oec@codeblau.de> | 2019-06-16 12:14:02 +0200 |
---|---|---|
committer | Özgür Kesim <oec@codeblau.de> | 2019-06-16 12:14:02 +0200 |
commit | 6b9cd80df517fd7d85a256a950f3de726d7e619e (patch) | |
tree | 2ce6060260a7fce287e7a714142b3953eab7058e | |
parent | 68e6e3dab81254011e451775a54b3791d5bbc502 (diff) |
use Fprint instead of Fprintf in debug
-rw-r--r-- | debugon.go | 4 | ||||
-rw-r--r-- | parser.go | 4 |
2 files changed, 4 insertions, 4 deletions
@@ -74,10 +74,10 @@ func (dp *debugParser) logStart(ps *State) { func (dp *debugParser) logEnd(ps *State, result *Result) { if log != nil { if pendingOpenLog != "" { - fmt.Fprintf(log, dp.logf(ps, result, dp.Name())) + fmt.Fprint(log, dp.logf(ps, result, dp.Name())) pendingOpenLog = "" } else { - fmt.Fprintf(log, dp.logf(ps, result, "}")) + fmt.Fprint(log, dp.logf(ps, result, "}")) } } } @@ -197,13 +197,13 @@ func parseMatcher(matcher string) (alphabet string, ranges [][]rune) { // - min and max: Chars("a-z0-9", 4, 6) will match 4-6 lowercase alphanumeric characters // the above can be combined in any order func Chars(matcher string, repetition ...int) Parser { - return NewParser(fmt.Sprintf("Chars(%q)", matcher), charsImpl(matcher, false, repetition...)) + return NewParser("["+matcher+"]", charsImpl(matcher, false, repetition...)) } // NotChars accepts the full range of input from Chars, but it will stop when any // character matches. If you need to match until you see a sequence use Until instead func NotChars(matcher string, repetition ...int) Parser { - return NewParser(fmt.Sprintf("!Chars(%q)", matcher), charsImpl(matcher, true, repetition...)) + return NewParser("!["+matcher+"]", charsImpl(matcher, true, repetition...)) } func charsImpl(matcher string, stopOn bool, repetition ...int) Parser { |