go mod and even more work

This commit is contained in:
zach rice committed 2019-03-27 17:26:27 -05:00
1 parent 1c14586cde
commit e79ffc6ae8
62 files changed
+1003 -8132

No files matched your search

+3 -3
View File
@@ -12,7 +12,7 @@ import (
"gopkg.in/warnings.v0"
)
var unescape = map[rune]rune{'\\': '\\', '"': '"', 'n': '\n', 't': '\t'}
var unescape = map[rune]rune{'\\': '\\', '"': '"', 'n': '\n', 't': '\t', 'b': '\b'}
// no error: invalid literals should be caught by scanner
func unquote(s string) string {
@@ -48,7 +48,7 @@ func unquote(s string) string {
return string(u)
}
func read(c *warnings.Collector, callback func(string,string,string,string,bool)error,
func read(c *warnings.Collector, callback func(string, string, string, string, bool) error,
fset *token.FileSet, file *token.File, src []byte) error {
//
var s scanner.Scanner
@@ -223,7 +223,7 @@ func readInto(config interface{}, fset *token.FileSet, file *token.File,
// (as opposed to set to empty string).
//
// If callback returns an error, ReadWithCallback terminates with an error too.
func ReadWithCallback(reader io.Reader, callback func(string,string,string,string,bool)error) error {
func ReadWithCallback(reader io.Reader, callback func(string, string, string, string, bool) error) error {
src, err := ioutil.ReadAll(reader)
if err != nil {
return err
+4 -4
View File
@@ -170,7 +170,7 @@ func (s *Scanner) scanEscape(val bool) {
switch ch {
case '\\', '"':
// ok
case 'n', 't':
case 'n', 't', 'b':
if val {
break // ok
}
@@ -232,10 +232,10 @@ loop:
s.next()
}
if s.ch != '\n' {
s.error(offs, "unquoted '\\' must be followed by new line")
break loop
s.scanEscape(true)
} else {
s.next()
}
s.next()
case ch == '"':
inQuote = !inQuote
case ch == '\r':