/usr/share/gocode/src/github.com/influxdata/toml/parse.go is in golang-github-influxdata-toml-dev 0.0~git20160905.0.ad49a5c-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 | package toml
import (
"fmt"
"github.com/influxdata/toml/ast"
)
// Parse returns an AST representation of TOML.
// The toplevel is represented by a table.
func Parse(data []byte) (*ast.Table, error) {
d := &parseState{p: &tomlParser{Buffer: string(data)}}
d.init()
if err := d.parse(); err != nil {
return nil, err
}
return d.p.toml.table, nil
}
type parseState struct {
p *tomlParser
}
func (d *parseState) init() {
d.p.Init()
d.p.toml.init(d.p.buffer)
}
func (d *parseState) parse() error {
if err := d.p.Parse(); err != nil {
if err, ok := err.(*parseError); ok {
return fmt.Errorf("toml: line %d: parse error", err.Line())
}
return err
}
return d.execute()
}
func (d *parseState) execute() (err error) {
defer func() {
e := recover()
if e != nil {
cerr, ok := e.(convertError)
if !ok {
panic(e)
}
err = cerr.err
}
}()
d.p.Execute()
return nil
}
|