~hduran-8/+junk/caddylegacy

« back to all changes in this revision

Viewing changes to debian/gocode/src/github.com/naoina/toml/error.go

  • Committer: Horacio Durán
  • Date: 2016-10-14 14:33:43 UTC
  • Revision ID: horacio.duran@canonical.com-20161014143343-ytyhz5sx7d1cje4q
Added new upstream version

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
package toml
 
2
 
 
3
import (
 
4
        "fmt"
 
5
        "reflect"
 
6
)
 
7
 
 
8
func (e *parseError) Line() int {
 
9
        tokens := e.p.tokenTree.Error()
 
10
        positions := make([]int, len(tokens)*2)
 
11
        p := 0
 
12
        for _, token := range tokens {
 
13
                positions[p], p = int(token.begin), p+1
 
14
                positions[p], p = int(token.end), p+1
 
15
        }
 
16
        for _, t := range translatePositions(e.p.Buffer, positions) {
 
17
                if e.p.line < t.line {
 
18
                        e.p.line = t.line
 
19
                }
 
20
        }
 
21
        return e.p.line
 
22
}
 
23
 
 
24
type errorOutOfRange struct {
 
25
        kind reflect.Kind
 
26
        v    interface{}
 
27
}
 
28
 
 
29
func (err *errorOutOfRange) Error() string {
 
30
        return fmt.Sprintf("value %d is out of range for `%v` type", err.v, err.kind)
 
31
}