]> Cypherpunks repositories - gostls13.git/commitdiff
go/token: document that column positions and file offsets are in bytes
authorRobert Griesemer <gri@golang.org>
Mon, 23 Feb 2015 18:20:20 +0000 (10:20 -0800)
committerRobert Griesemer <gri@golang.org>
Mon, 23 Feb 2015 18:35:28 +0000 (18:35 +0000)
Fixes #9948.

Change-Id: I7b354fccd5e933eeeb2253a66acec050ebff6e41
Reviewed-on: https://go-review.googlesource.com/5611
Reviewed-by: Alan Donovan <adonovan@google.com>
src/go/token/position.go

index 82d90eeb7284fcaf24b3edfb0c28c33e14202bd7..17452bb3d54d66e6e26991e10ecf6df0814c9871 100644 (file)
@@ -21,7 +21,7 @@ type Position struct {
        Filename string // filename, if any
        Offset   int    // offset, starting at 0
        Line     int    // line number, starting at 1
-       Column   int    // column number, starting at 1 (character count)
+       Column   int    // column number, starting at 1 (byte count)
 }
 
 // IsValid returns true if the position is valid.
@@ -56,8 +56,8 @@ func (pos Position) String() string {
 // where base and size are specified when adding the file to the file set via
 // AddFile.
 //
-// To create the Pos value for a specific source offset, first add
-// the respective file to the current file set (via FileSet.AddFile)
+// To create the Pos value for a specific source offset (measured in bytes),
+// first add the respective file to the current file set using FileSet.AddFile
 // and then call File.Pos(offset) for that file. Given a Pos value p
 // for a specific file set fset, the corresponding Position value is
 // obtained by calling fset.Position(p).