scanner: change NewScannerFromString() to accept empty strings

Signed-off-by: Alejandro Mery <amery@geeks.cl>
This commit is contained in:
2014-10-26 00:27:51 +02:00
parent 538ebfe37b
commit 71599c9adb
+2 -5
View File
@@ -22,12 +22,9 @@ type Scanner struct {
runes uint runes uint
} }
// Creates new Scanner to parse a given string, or nil if empty // NewScannerFromString instantiates a new Scanner to
// parse a given string
func NewScannerFromString(name, input string) *Scanner { func NewScannerFromString(name, input string) *Scanner {
if len(input) == 0 {
return nil
}
return &Scanner{ return &Scanner{
name: name, name: name,
input: input, input: input,