fix bug with EOF after value, improve error handling
diff --git a/read.go b/read.go
index 7d42a1d..bf2b53f 100644
--- a/read.go
+++ b/read.go
@@ -33,13 +33,17 @@
 
 func readInto(config interface{}, fset *token.FileSet, file *token.File, src []byte) error {
 	var s scanner.Scanner
-	s.Init(file, src, nil, 0)
+	var errs scanner.ErrorList
+	s.Init(file, src, func(p token.Position, m string) { errs.Add(p, m) }, 0)
 	sect, sectsub := "", ""
 	pos, tok, lit := s.Scan()
 	errfn := func(msg string) error {
 		return fmt.Errorf("%s: %s", fset.Position(pos), msg)
 	}
 	for {
+		if errs.Len() > 0 {
+			return errs.Err()
+		}
 		switch tok {
 		case token.EOF:
 			return nil
@@ -47,17 +51,26 @@
 			pos, tok, lit = s.Scan()
 		case token.LBRACK:
 			pos, tok, lit = s.Scan()
+			if errs.Len() > 0 {
+				return errs.Err()
+			}
 			if tok != token.IDENT {
 				return errfn("expected section name")
 			}
 			sect, sectsub = lit, ""
 			pos, tok, lit = s.Scan()
+			if errs.Len() > 0 {
+				return errs.Err()
+			}
 			if tok == token.STRING {
 				sectsub = unquote(lit)
 				if sectsub == "" {
 					return errfn("empty subsection name")
 				}
 				pos, tok, lit = s.Scan()
+				if errs.Len() > 0 {
+					return errs.Err()
+				}
 			}
 			if tok != token.RBRACK {
 				if sectsub == "" {
@@ -75,6 +88,9 @@
 			}
 			n := lit
 			pos, tok, lit = s.Scan()
+			if errs.Len() > 0 {
+				return errs.Err()
+			}
 			var v string
 			if tok == token.EOF || tok == token.EOL || tok == token.COMMENT {
 				v = defaultValue
@@ -83,11 +99,17 @@
 					return errfn("expected '='")
 				}
 				pos, tok, lit = s.Scan()
+				if errs.Len() > 0 {
+					return errs.Err()
+				}
 				if tok != token.STRING {
 					return errfn("expected value")
 				}
 				v = unquote(lit)
 				pos, tok, lit = s.Scan()
+				if errs.Len() > 0 {
+					return errs.Err()
+				}
 				if tok != token.EOL && tok != token.EOF && tok != token.COMMENT {
 					return errfn("expected EOL, EOF, or comment")
 				}
diff --git a/read_test.go b/read_test.go
index adcfd09..f65c01e 100644
--- a/read_test.go
+++ b/read_test.go
@@ -120,6 +120,8 @@
 	{"\n[section \"nonexistent\"]\nname=value", &conf01{}, false},
 	// error: variable name not matched
 	{"\n[section]\nnonexistent=value", &conf01{}, false},
+	// error: missing end quote
+	{"[section]\nname=\"value", &conf01{}, false},
 }},
 }
 
@@ -134,22 +136,22 @@
 			err := ReadStringInto(res, tt.gcfg)
 			if tt.ok {
 				if err != nil {
-					t.Errorf("%s fail: got error %v, wanted ok", id, err)
+					t.Errorf("%s failed; got error %v, wanted ok", id, err)
 					continue
 				} else if !reflect.DeepEqual(res, tt.exp) {
-					t.Errorf("%s fail: got %#v, wanted %#v", id, res, tt.exp)
+					t.Errorf("%s failed; got value %#v, wanted value %#v", id, res, tt.exp)
 					continue
 				}
 				if !testing.Short() {
-					t.Logf("%s pass: ok, %#v", id, res)
+					t.Logf("%s passed; got value %#v", id, res)
 				}
 			} else { // !tt.ok
 				if err == nil {
-					t.Errorf("%s fail: got %#v, wanted error", id, res)
+					t.Errorf("%s failed; got value %#v, wanted error", id, res)
 					continue
 				}
 				if !testing.Short() {
-					t.Logf("%s pass: !ok, %#v", id, err)
+					t.Logf("%s passed; got error %v", id, err)
 				}
 			}
 		}
@@ -160,7 +162,7 @@
 	res := &struct{ Section struct{ Name string } }{}
 	err := ReadFileInto(res, "testdata/gcfg_test.gcfg")
 	if err != nil {
-		t.Fatal(err)
+		t.Errorf(err.Error())
 	}
 	if "value" != res.Section.Name {
 		t.Errorf("got %q, wanted %q", res.Section.Name, "value")
diff --git a/scanner/scanner.go b/scanner/scanner.go
index 099cc74..9554428 100644
--- a/scanner/scanner.go
+++ b/scanner/scanner.go
@@ -217,7 +217,7 @@
 	end := offs
 	inQuote := false
 loop:
-	for inQuote || s.ch != '\n' && s.ch != ';' && s.ch != '#' {
+	for inQuote || s.ch >= 0 && s.ch != '\n' && s.ch != ';' && s.ch != '#' {
 		ch := s.ch
 		s.next()
 		switch {
diff --git a/scanner/scanner_test.go b/scanner/scanner_test.go
index f1feeb3..2188da0 100644
--- a/scanner/scanner_test.go
+++ b/scanner/scanner_test.go
@@ -217,6 +217,22 @@
 	}
 }
 
+func TestScanValStringEOF(t *testing.T) {
+	var s Scanner
+	src := "= value"
+	f := fset.AddFile("src", fset.Base(), len(src))
+	s.Init(f, []byte(src), nil, 0)
+	s.Scan()              // =
+	s.Scan()              // value
+	_, tok, _ := s.Scan() // EOF
+	if tok != token.EOF {
+		t.Errorf("bad token: got %s, expected %s", tok, token.EOF)
+	}
+	if s.ErrorCount > 0 {
+		t.Error("scanning error")
+	}
+}
+
 // Verify that initializing the same scanner more then once works correctly.
 func TestInit(t *testing.T) {
 	var s Scanner