diff options
author | Robert Griesemer <gri@golang.org> | 2009-05-18 14:59:16 -0700 |
---|---|---|
committer | Robert Griesemer <gri@golang.org> | 2009-05-18 14:59:16 -0700 |
commit | d4383f34051f1b4f799e413f7be57587f40affa1 (patch) | |
tree | edfd6ba7cec1d606d3b6cc2a0e4206214c31b684 /src/lib/go/token/token.go | |
parent | c40d14204290410ba56a30eb0457e37a71dae82e (diff) | |
download | golang-d4383f34051f1b4f799e413f7be57587f40affa1.tar.gz |
- changed parser to return os.Error, removed ErrorHandler
- added IsValid predicate to token.Position
- updated pretty, godoc, gobuild
- updated/expanded test cases
R=rsc
DELTA=265 (97 added, 78 deleted, 90 changed)
OCL=28961
CL=29005
Diffstat (limited to 'src/lib/go/token/token.go')
-rw-r--r-- | src/lib/go/token/token.go | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/lib/go/token/token.go b/src/lib/go/token/token.go index b71d0f03d..a70a75a54 100644 --- a/src/lib/go/token/token.go +++ b/src/lib/go/token/token.go @@ -324,6 +324,8 @@ func (tok Token) IsKeyword() bool { // Token source positions are represented by a Position value. +// A Position is valid if the line number is > 0. +// type Position struct { Offset int; // byte offset, starting at 0 Line int; // line number, starting at 1 @@ -337,3 +339,9 @@ type Position struct { func (pos *Position) Pos() Position { return *pos; } + + +// IsValid returns true if the position is valid. +func (pos *Position) IsValid() bool { + return pos.Line > 0 +} |