diff options
Diffstat (limited to 'src/pkg/exp/datafmt')
-rw-r--r-- | src/pkg/exp/datafmt/datafmt_test.go | 6 | ||||
-rw-r--r-- | src/pkg/exp/datafmt/parser.go | 5 |
2 files changed, 6 insertions, 5 deletions
diff --git a/src/pkg/exp/datafmt/datafmt_test.go b/src/pkg/exp/datafmt/datafmt_test.go index f6a09f820..d7c70b21d 100644 --- a/src/pkg/exp/datafmt/datafmt_test.go +++ b/src/pkg/exp/datafmt/datafmt_test.go @@ -80,10 +80,10 @@ func TestCustomFormatters(t *testing.T) { f = parse(t, ``, fmap1) verify(t, f, `even odd even odd `, 0, 1, 2, 3) - f = parse(t, `/ =@:blank; float="#"`, fmap1) + f = parse(t, `/ =@:blank; float64="#"`, fmap1) verify(t, f, `# # #`, 0.0, 1.0, 2.0) - f = parse(t, `float=@:nil`, fmap1) + f = parse(t, `float64=@:nil`, fmap1) verify(t, f, ``, 0.0, 1.0, 2.0) f = parse(t, `testing "testing"; ptr=*`, fmap2) @@ -139,7 +139,7 @@ func TestBasicTypes(t *testing.T) { const f = 3.141592 const fs = `3.141592` - check(t, `float ="%g"`, fs, f) + check(t, `float64="%g"`, fs, f) check(t, `float32="%g"`, fs, float32(f)) check(t, `float64="%g"`, fs, float64(f)) } diff --git a/src/pkg/exp/datafmt/parser.go b/src/pkg/exp/datafmt/parser.go index a01378ea5..c6d140264 100644 --- a/src/pkg/exp/datafmt/parser.go +++ b/src/pkg/exp/datafmt/parser.go @@ -42,8 +42,9 @@ func (p *parser) next() { func (p *parser) init(fset *token.FileSet, filename string, src []byte) { p.ErrorVector.Reset() - p.file = p.scanner.Init(fset, filename, src, p, scanner.AllowIllegalChars) // return '@' as token.ILLEGAL w/o error message - p.next() // initializes pos, tok, lit + p.file = fset.AddFile(filename, fset.Base(), len(src)) + p.scanner.Init(p.file, src, p, scanner.AllowIllegalChars) // return '@' as token.ILLEGAL w/o error message + p.next() // initializes pos, tok, lit p.packs = make(map[string]string) p.rules = make(map[string]expr) } |