summaryrefslogtreecommitdiff
path: root/src/pkg/go/token/token.go
diff options
context:
space:
mode:
authorRobert Griesemer <gri@golang.org>2009-11-06 14:24:38 -0800
committerRobert Griesemer <gri@golang.org>2009-11-06 14:24:38 -0800
commit828334dd95ce8e4bf3662bd5c89d7c417f0741d0 (patch)
treefd7e0c9961bc3af2ddf105e9cc1943f2509ac584 /src/pkg/go/token/token.go
parenteb5cdfd67ff6d32df4c4c27840eaee027c5e3512 (diff)
downloadgolang-828334dd95ce8e4bf3662bd5c89d7c417f0741d0.tar.gz
- fine-tuning of one-line func heuristic (nodes.go)
- enabled for function declarations (not just function literals) - applied gofmt -w $GOROOT/src (look for instance at src/pkg/debug/elf/elf.go) R=r, rsc CC=go-dev http://go/go-review/1026006
Diffstat (limited to 'src/pkg/go/token/token.go')
-rw-r--r--src/pkg/go/token/token.go20
1 files changed, 5 insertions, 15 deletions
diff --git a/src/pkg/go/token/token.go b/src/pkg/go/token/token.go
index b3191c22c..28c335461 100644
--- a/src/pkg/go/token/token.go
+++ b/src/pkg/go/token/token.go
@@ -308,23 +308,17 @@ func Lookup(ident []byte) Token {
// IsLiteral returns true for tokens corresponding to identifiers
// and basic type literals; returns false otherwise.
//
-func (tok Token) IsLiteral() bool {
- return literal_beg < tok && tok < literal_end;
-}
+func (tok Token) IsLiteral() bool { return literal_beg < tok && tok < literal_end }
// IsOperator returns true for tokens corresponding to operators and
// delimiters; returns false otherwise.
//
-func (tok Token) IsOperator() bool {
- return operator_beg < tok && tok < operator_end;
-}
+func (tok Token) IsOperator() bool { return operator_beg < tok && tok < operator_end }
// IsKeyword returns true for tokens corresponding to keywords;
// returns false otherwise.
//
-func (tok Token) IsKeyword() bool {
- return keyword_beg < tok && tok < keyword_end;
-}
+func (tok Token) IsKeyword() bool { return keyword_beg < tok && tok < keyword_end }
// Token source positions are represented by a Position value.
@@ -341,15 +335,11 @@ type Position struct {
// Pos is an accessor method for anonymous Position fields.
// It returns its receiver.
//
-func (pos *Position) Pos() Position {
- return *pos;
-}
+func (pos *Position) Pos() Position { return *pos }
// IsValid returns true if the position is valid.
-func (pos *Position) IsValid() bool {
- return pos.Line > 0;
-}
+func (pos *Position) IsValid() bool { return pos.Line > 0 }
func (pos Position) String() string {